OSDN Git Service

lavc/parser: export field order if not already set
authorRodger Combs <rodger.combs@gmail.com>
Tue, 20 Sep 2016 10:57:39 +0000 (05:57 -0500)
committerRodger Combs <rodger.combs@gmail.com>
Mon, 24 Oct 2016 06:20:18 +0000 (01:20 -0500)
Some codecs set this in the parser, but not the decoder

libavcodec/parser.c

index 2c8fc69..30cfc55 100644 (file)
@@ -182,6 +182,11 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
     index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,
                                     poutbuf_size, buf, buf_size);
     av_assert0(index > -0x20000000); // The API does not allow returning AVERROR codes
+#define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name
+    if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
+        FILL(field_order);
+    }
+
     /* update the file pointer */
     if (*poutbuf_size) {
         /* fill the data for the current frame */