[FFmpeg-devel] [PATCH 1/2] avcodec: add an AVCodecContext flag to export PRFT side data on demand

James Almer jamrial at gmail.com
Wed Jan 29 18:05:52 EET 2020


On 1/29/2020 12:12 PM, Anton Khirnov wrote:
> Quoting James Almer (2020-01-23 21:25:34)
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>  doc/APIchanges             | 3 +++
>>  doc/codecs.texi            | 2 ++
>>  libavcodec/avcodec.h       | 8 +++++++-
>>  libavcodec/options_table.h | 1 +
>>  libavcodec/version.h       | 2 +-
>>  5 files changed, 14 insertions(+), 2 deletions(-)
>>
>> diff --git a/doc/APIchanges b/doc/APIchanges
>> index 2977b00b60..2433083d55 100644
>> --- a/doc/APIchanges
>> +++ b/doc/APIchanges
>> @@ -15,6 +15,9 @@ libavutil:     2017-10-21
>>  
>>  API changes, most recent first:
>>  
>> +2020-01-xx - xxxxxxxxxx - lavc 58.66.101 - avcodec.h
>> +  Add AV_CODEC_FLAG2_EXPORT_PRFT.
>> +
>>  2020-01-15 - xxxxxxxxxx - lavc 58.66.100 - avcodec.h
>>    Add AV_PKT_DATA_PRFT and AVProducerReferenceTime.
>>  
>> diff --git a/doc/codecs.texi b/doc/codecs.texi
>> index 15e55cca39..ebf7bab0fb 100644
>> --- a/doc/codecs.texi
>> +++ b/doc/codecs.texi
>> @@ -779,6 +779,8 @@ Place global headers at every keyframe instead of in extradata.
>>  Frame data might be split into multiple chunks.
>>  @item showall
>>  Show all frames before the first keyframe.
>> + at item export_prft
>> +Export Producer Reference Time into packet side-data (see @code{AV_PKT_DATA_PRFT})
>>  @item export_mvs
>>  Export motion vectors into frame side-data (see @code{AV_FRAME_DATA_MOTION_VECTORS})
>>  for codecs that support it. See also @file{doc/examples/export_mvs.c}.
>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>> index 774ed1e641..aae6e83568 100644
>> --- a/libavcodec/avcodec.h
>> +++ b/libavcodec/avcodec.h
>> @@ -955,6 +955,10 @@ typedef struct RcOverride{
>>   * Show all frames before the first keyframe
>>   */
>>  #define AV_CODEC_FLAG2_SHOW_ALL       (1 << 22)
>> +/**
>> + * Export Producer Reference Time through packet side data
>> + */
>> +#define AV_CODEC_FLAG2_EXPORT_PRFT    (1 << 27)
> 
> I wonder if we couldn't figure out a better place for this toggle.
> flags/flags2 are currently a hot mess of everything and the kitchensink
> squashed together. Perhaps we could add a new field for "flags to
> indicate to the codec that it should export this optional kind of
> metadata". It might make things clearer and better organized. Just a
> random thought though - feel free to ignore me.

I added it to flags2 since that one also has the export_mvs option to
export one specific kind of frame side data, but yeah, both flags and
flags2 are a dumping ground of options and it's hardly intuitive.

What field name, define prefix and options.h names do you suggest?
Should it cover both packets (encoders) and frames (decoders)? And
should we move existing flags like export_mvs to it, deprecating the
existing ones?


More information about the ffmpeg-devel mailing list