avcodec/flac_parser: export sample_rate also when PARSER_FLAG_COMPLETE_FRAMES is set
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 6 Oct 2013 23:11:22 +0000 (01:11 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 6 Oct 2013 23:36:05 +0000 (01:36 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/flac_parser.c

index 69c2965..ba1f060 100644 (file)
@@ -512,8 +512,11 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
 
     if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
         FLACFrameInfo fi;
-        if (frame_header_is_valid(avctx, buf, &fi))
+        if (frame_header_is_valid(avctx, buf, &fi)) {
             s->duration = fi.blocksize;
+            if (!avctx->sample_rate)
+                avctx->sample_rate = fi.samplerate;
+        }
         *poutbuf      = buf;
         *poutbuf_size = buf_size;
         return buf_size;