diff mbox

[FFmpeg-devel] lavc/parser: export field order if not already set

Message ID 20160920111325.60492-1-rodger.combs@gmail.com
State Accepted
Commit d13740f3a207668f53ce167cf96f353379ac2c14
Headers show

Commit Message

Rodger Combs Sept. 20, 2016, 11:13 a.m. UTC
Some codecs set this in the parser, but not the decoder
---
 libavcodec/parser.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Carl Eugen Hoyos Sept. 20, 2016, 3:18 p.m. UTC | #1
2016-09-20 13:13 GMT+02:00 Rodger Combs <rodger.combs@gmail.com>:
> Some codecs set this in the parser, but not the decoder

> +#define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name
> +    if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
> +        FILL(field_order);

How is this a useful macro?

Carl Eugen
Rodger Combs Sept. 20, 2016, 3:29 p.m. UTC | #2
> On Sep 20, 2016, at 10:18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> 
> 2016-09-20 13:13 GMT+02:00 Rodger Combs <rodger.combs@gmail.com>:
>> Some codecs set this in the parser, but not the decoder
> 
>> +#define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name
>> +    if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
>> +        FILL(field_order);
> 
> How is this a useful macro?

Could also fill dimensions.

> 
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff mbox

Patch

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 2c8fc69..30cfc55 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -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 */