[FFmpeg-devel] [PATCH 1/4] avcodec/h264dec: add missing flags to is_avc and nal_length_size AVOptions

James Almer jamrial at gmail.com
Sun Apr 11 16:25:57 EEST 2021


On 4/11/2021 6:56 AM, Anton Khirnov wrote:
> Quoting James Almer (2021-04-10 23:00:20)
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>   libavcodec/h264dec.c      | 5 +++--
>>   tests/ref/fate/mov-zombie | 2 +-
>>   2 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
>> index 47b9abbc5c..f44c8c8175 100644
>> --- a/libavcodec/h264dec.c
>> +++ b/libavcodec/h264dec.c
>> @@ -1027,9 +1027,10 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
>>   
>>   #define OFFSET(x) offsetof(H264Context, x)
>>   #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
>> +#define VDE VD | AV_OPT_FLAG_EXPORT
>>   static const AVOption h264_options[] = {
>> -    { "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0 },
>> -    { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0 },
>> +    { "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VDE },
>> +    { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VDE },
> 
> Not objecting to the patch, but does anyone know how these fields are
> useful to callers?

When i asked if these two were meant to be exported at all on IRC, Jan 
Ekström argued that as exported avoptions they could be useful for 
callers to know if the stream being decoded is annexb or size delimited, 
so i figured i might as well keep them as is.
As for being input options, if there's no extradata during init or 
propagated as packet side data, situation where decoder will not 
overwrite them but still use them when splitting NALUs, the caller can 
set them manually and decoding could in theory succeed.

I don't know if the user that opened ticket #9176 cared about and used 
them, or just noticed ffprobe printed different values in his own tests, 
and reported it.


More information about the ffmpeg-devel mailing list