]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Set sample format in flac_decode_init() rather than in
authorjbr <jbr@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sun, 1 Nov 2009 16:48:05 +0000 (16:48 +0000)
committerjbr <jbr@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sun, 1 Nov 2009 16:48:05 +0000 (16:48 +0000)
ff_flac_parse_streaminfo() since the latter is shared with the raw FLAC
demuxer, which should not be setting the sample format.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@20430 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/flacdec.c

index 781b4fadf1df3d8dcc3b9170276ed82469aa8695..0ebc23d6cfe5679d5fbe8b2455b94b6ffa025432 100644 (file)
@@ -125,6 +125,10 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
 
     /* initialize based on the demuxer-supplied streamdata header */
     ff_flac_parse_streaminfo(avctx, (FLACStreaminfo *)s, streaminfo);
+    if (s->bps > 16)
+        avctx->sample_fmt = SAMPLE_FMT_S32;
+    else
+        avctx->sample_fmt = SAMPLE_FMT_S16;
     allocate_buffers(s);
     s->got_streaminfo = 1;
 
@@ -186,10 +190,6 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
     avctx->channels = s->channels;
     avctx->sample_rate = s->samplerate;
     avctx->bits_per_raw_sample = s->bps;
-    if (s->bps > 16)
-        avctx->sample_fmt = SAMPLE_FMT_S32;
-    else
-        avctx->sample_fmt = SAMPLE_FMT_S16;
 
     s->samples  = get_bits_long(&gb, 32) << 4;
     s->samples |= get_bits(&gb, 4);