Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stefan Strogin
flac
Commits
eda534f2
Commit
eda534f2
authored
Aug 31, 2002
by
Josh Coalson
Browse files
add checks for changing bps/sample_rate/channels mid-stream
parent
214d3191
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/flac/decode.c
View file @
eda534f2
...
...
@@ -535,7 +535,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const void *decoder, const FLAC__F
{
DecoderSession
*
decoder_session
=
(
DecoderSession
*
)
client_data
;
FILE
*
fout
=
decoder_session
->
fout
;
unsigned
bps
=
decoder_session
->
bps
,
channels
=
decoder_session
->
channels
;
const
unsigned
bps
=
frame
->
header
.
bits_per_sample
,
channels
=
frame
->
header
.
channels
;
FLAC__bool
is_big_endian
=
(
decoder_session
->
is_wave_out
?
false
:
decoder_session
->
is_big_endian
);
FLAC__bool
is_unsigned_samples
=
(
decoder_session
->
is_wave_out
?
bps
<=
8
:
decoder_session
->
is_unsigned_samples
);
unsigned
wide_samples
=
frame
->
header
.
blocksize
,
wide_sample
,
sample
,
channel
,
byte
;
...
...
@@ -551,6 +551,19 @@ FLAC__StreamDecoderWriteStatus write_callback(const void *decoder, const FLAC__F
if
(
decoder_session
->
abort_flag
)
return
FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
;
if
(
bps
!=
decoder_session
->
bps
)
{
fprintf
(
"ERROR, bits-per-sample is %u in frame but %u in STREAMINFO
\n
"
,
bps
,
decoder_session
->
bps
);
return
FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
;
}
if
(
channels
!=
decoder_session
->
channels
)
{
fprintf
(
"ERROR, channels is %u in frame but %u in STREAMINFO
\n
"
,
channels
,
decoder_session
->
channels
);
return
FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
;
}
if
(
frame
->
header
.
sample_rate
!=
decoder_session
->
sample_rate
)
{
fprintf
(
"ERROR, sample rate is %u in frame but %u in STREAMINFO
\n
"
,
frame
->
header
.
sample_rate
,
decoder_session
->
sample_rate
);
return
FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
;
}
decoder_session
->
samples_processed
+=
wide_samples
;
decoder_session
->
frame_counter
++
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment