Message ID | 20200123202535.232-1-jamrial@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [FFmpeg-devel,1/2] avcodec: add an AVCodecContext flag to export PRFT side data on demand | expand |
Context | Check | Description |
---|---|---|
andriy/ffmpeg-patchwork | success | Make fate finished |
On 1/23/2020 5:25 PM, James Almer wrote: > Signed-off-by: James Almer <jamrial@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. > +@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) > /** > * Export motion vectors through frame side data > */ > @@ -1416,7 +1420,9 @@ enum AVPacketSideDataType { > AV_PKT_DATA_AFD, > > /** > - * Producer Reference Time data corresponding to the AVProducerReferenceTime struct. > + * Producer Reference Time data corresponding to the AVProducerReferenceTime struct > + * exported by some encoders (on demand through the export_prft flag set in the > + * AVCodecContext flags2 field). > */ > AV_PKT_DATA_PRFT, > > diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h > index d4c0cdeb48..479a85071b 100644 > --- a/libavcodec/options_table.h > +++ b/libavcodec/options_table.h > @@ -75,6 +75,7 @@ static const AVOption avcodec_options[] = { > {"local_header", "place global headers at every keyframe instead of in extradata", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_LOCAL_HEADER }, INT_MIN, INT_MAX, V|E, "flags2"}, > {"chunks", "Frame data might be split into multiple chunks", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_CHUNKS }, INT_MIN, INT_MAX, V|D, "flags2"}, > {"showall", "Show all frames before the first keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, V|D, "flags2"}, > +{"export_prft", "export Producer Reference Time through packet side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_PRFT}, INT_MIN, INT_MAX, A|V|E, "flags2"}, > {"export_mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"}, > {"skip_manual", "do not skip samples and export skip information as frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, INT_MIN, INT_MAX, A|D, "flags2"}, > {"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, S|D, "flags2"}, > diff --git a/libavcodec/version.h b/libavcodec/version.h > index 6cf333eeb6..b438a09d6d 100644 > --- a/libavcodec/version.h > +++ b/libavcodec/version.h > @@ -29,7 +29,7 @@ > > #define LIBAVCODEC_VERSION_MAJOR 58 > #define LIBAVCODEC_VERSION_MINOR 66 > -#define LIBAVCODEC_VERSION_MICRO 100 > +#define LIBAVCODEC_VERSION_MICRO 101 > > #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ > LIBAVCODEC_VERSION_MINOR, \ Will push this set soon if no one objects.
Quoting James Almer (2020-01-23 21:25:34) > Signed-off-by: James Almer <jamrial@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. > +@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.
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@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. >> +@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?
Quoting James Almer (2020-01-29 17:05:52) > On 1/29/2020 12:12 PM, Anton Khirnov wrote: > > > > 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, export_metadata? (the word 'metadata' is now a bit overloaded though) export_opt_data? ('opt' could be somewhat misleading) > define prefix AVCODEC_EXPORT_FOO possibly AVCODEC_EXPORT_METADATA_FOO (or whatever we choose from above, but that's getting too long) > and options.h names do you suggest? matching the field name in AVCodecContext? For the flags, the same you used in original patch. > Should it cover both packets (encoders) and frames (decoders)? Yes. > And should we move existing flags like export_mvs to it, deprecating > the existing ones? What others are there? I'd say probably yes.
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. +@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) /** * Export motion vectors through frame side data */ @@ -1416,7 +1420,9 @@ enum AVPacketSideDataType { AV_PKT_DATA_AFD, /** - * Producer Reference Time data corresponding to the AVProducerReferenceTime struct. + * Producer Reference Time data corresponding to the AVProducerReferenceTime struct + * exported by some encoders (on demand through the export_prft flag set in the + * AVCodecContext flags2 field). */ AV_PKT_DATA_PRFT, diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index d4c0cdeb48..479a85071b 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -75,6 +75,7 @@ static const AVOption avcodec_options[] = { {"local_header", "place global headers at every keyframe instead of in extradata", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_LOCAL_HEADER }, INT_MIN, INT_MAX, V|E, "flags2"}, {"chunks", "Frame data might be split into multiple chunks", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_CHUNKS }, INT_MIN, INT_MAX, V|D, "flags2"}, {"showall", "Show all frames before the first keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, V|D, "flags2"}, +{"export_prft", "export Producer Reference Time through packet side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_PRFT}, INT_MIN, INT_MAX, A|V|E, "flags2"}, {"export_mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"}, {"skip_manual", "do not skip samples and export skip information as frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, INT_MIN, INT_MAX, A|D, "flags2"}, {"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, S|D, "flags2"}, diff --git a/libavcodec/version.h b/libavcodec/version.h index 6cf333eeb6..b438a09d6d 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 66 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \
Signed-off-by: James Almer <jamrial@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(-)