[FFmpeg-devel] [PATCH 3/9] avformat/avisynth: add read_frameprops option

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Aug 31 02:17:44 EEST 2022


Stephen Hutchinson:
> On 8/28/22 8:41 PM, Andreas Rheinhardt wrote:
>> This will make frameprops a global on-off which overrides everything
>> else even if some of the "else" stuff has been enabled explicitly. Worse
>> yet, if you want to disable everything except exactly one field, you
>> have to leave frameprops enabled and disable everything else explicitly.
>>
>> Why not use a bitfield (with AV_OPT_TYPE_FLAGS and AV_OPT_TYPE_CONST)?
>> These properties certainly seem like a bitfield and the above would be
>> easily achievable with it.
>>
> 
> How are flags supposed to be set to on by default? With av_dict_set or
> a different mechanism?  Because the closest I was able to get¹,
> 
> if(avs->flags & AVISYNTH_FRAMEPROP_FIELD_ORDER |
> AVISYNTH_FRAMEPROP_DEFAULT) {
> 
> ends up correctly setting the flags that should be on by default,
> with the new sar flag able to be enabled or disabled, but the ones
> flagged as default refuse to be disabled now.
> 
> ¹https://github.com/qyot27/FFmpeg/commit/6d3d6108145f9c7ac2dfcdaf09852b7472f6ca7f
> 

{ "avisynth_flags", "set flags related to reading frame properties from
script (AviSynth+ v3.7.1 or higher)", OFFSET(flags), AV_OPT_TYPE_FLAGS,
{.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, "flags" },

This is wrong. It should be
{ "avisynth_flags", "set flags related to reading frame properties from
script (AviSynth+ v3.7.1 or higher)", OFFSET(flags), AV_OPT_TYPE_FLAGS,
{.i64 = AVISYNTH_FRAMEPROP_FIELD_ORDER | AVISYNTH_FRAMEPROP_RANGE |
AVISYNTH_FRAMEPROP_PRIMARIES | AVISYNTH_FRAMEPROP_TRANSFER |
AVISYNTH_FRAMEPROP_MATRIX | AVISYNTH_FRAMEPROP_CHROMA_LOCATION}, 0,
INT_MAX, AV_OPT_FLAG_DECODING_PARAM, "flags" }
The default option should be removed. Users can then set the options via
avisynth_flags=+sar-range or via avisynth_flags=matrix or however they wish.
The AVISYNTH_FRAMEPROP_DEFAULT should also be removed (at least, it
should not be part of the bitfield, but you can of course add a define
(or an enum value) equivalent to the default value I used above and you
can use that for the default value above); to know whether field order
should be exported, you simply query via "if (avs->flags &
AVISYNTH_FRAMEPROP_FIELD_ORDER)". For this it is of course important
that the default value is a combination of other bits of the bitfield
and not a bit of its own.

- Andreas


More information about the ffmpeg-devel mailing list