Commit f8dcc693 authored by jbr's avatar jbr

flacdec: allow sample rate to change mid-stream, but log a warning

message when it does


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18162 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 5023d14a
...@@ -563,9 +563,7 @@ static int decode_frame(FLACContext *s) ...@@ -563,9 +563,7 @@ static int decode_frame(FLACContext *s)
} }
/* sample rate */ /* sample rate */
if (sr_code == 0) { if (sr_code < 12) {
samplerate= s->samplerate;
} else if (sr_code < 12) {
samplerate = ff_flac_sample_rate_table[sr_code]; samplerate = ff_flac_sample_rate_table[sr_code];
} else if (sr_code == 12) { } else if (sr_code == 12) {
samplerate = get_bits(gb, 8) * 1000; samplerate = get_bits(gb, 8) * 1000;
...@@ -578,6 +576,12 @@ static int decode_frame(FLACContext *s) ...@@ -578,6 +576,12 @@ static int decode_frame(FLACContext *s)
sr_code); sr_code);
return -1; return -1;
} }
if (samplerate == 0) {
samplerate = s->samplerate;
} else if (samplerate != s->samplerate) {
av_log(s->avctx, AV_LOG_WARNING, "sample rate changed from %d to %d\n",
s->samplerate, samplerate);
}
/* header CRC-8 check */ /* header CRC-8 check */
skip_bits(gb, 8); skip_bits(gb, 8);
...@@ -588,7 +592,7 @@ static int decode_frame(FLACContext *s) ...@@ -588,7 +592,7 @@ static int decode_frame(FLACContext *s)
} }
s->blocksize = blocksize; s->blocksize = blocksize;
s->samplerate = samplerate; s->samplerate = s->avctx->sample_rate = samplerate;
s->bps = bps; s->bps = bps;
s->ch_mode = ch_mode; s->ch_mode = ch_mode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment