From d005a7cdfd8762d436dc5d3ec12bab4f96781c4f Mon Sep 17 00:00:00 2001 From: James Almer Date: Sun, 2 Feb 2020 19:12:08 -0300 Subject: [PATCH] avcodec: add an AVCodecContext flag to export PRFT side data on demand Signed-off-by: James Almer --- doc/APIchanges | 3 +++ doc/codecs.texi | 3 +++ libavcodec/avcodec.h | 8 +++++++- libavcodec/options_table.h | 1 + libavcodec/version.h | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index aba4f5fd7a..5bfb0a654e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2020-02-21 - xxxxxxxxxx - lavc 58.73.101 - avcodec.h + Add AV_CODEC_EXPORT_DATA_PRFT. + 2020-02-21 - xxxxxxxxxx - lavc 58.73.100 - avcodec.h Add AVCodecContext.export_side_data and AV_CODEC_EXPORT_DATA_MVS. diff --git a/doc/codecs.texi b/doc/codecs.texi index 62090b3d51..2112ce5f46 100644 --- a/doc/codecs.texi +++ b/doc/codecs.texi @@ -795,6 +795,9 @@ Possible values: @item 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}. +@item prft +Export encoder Producer Reference Time into packet side-data (see @code{AV_PKT_DATA_PRFT}) +for codecs that support it. @end table @item error @var{integer} (@emph{encoding,video}) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index ba0fdd3493..82dce38bb8 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1110,6 +1110,10 @@ typedef struct RcOverride{ * Export motion vectors through frame side data */ #define AV_CODEC_EXPORT_DATA_MVS (1 << 0) +/** + * Export encoder Producer Reference Time through packet side data + */ +#define AV_CODEC_EXPORT_DATA_PRFT (1 << 1) /** * Pan Scan area. @@ -1430,7 +1434,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, + * usually exported by some encoders (on demand through the prft flag set in the + * AVCodecContext export_side_data field). */ AV_PKT_DATA_PRFT, diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 3f278d5c68..3265889b8e 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -80,6 +80,7 @@ static const AVOption avcodec_options[] = { {"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"}, {"export_side_data", "Export metadata as side data", OFFSET(export_side_data), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, A|V|S|D|E, "export_side_data"}, {"mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_MVS}, INT_MIN, INT_MAX, V|D, "export_side_data"}, +{"prft", "export Producer Reference Time through packet side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_PRFT}, INT_MIN, INT_MAX, A|V|S|E, "export_side_data"}, {"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, INT_MAX}, {"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E}, {"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E}, diff --git a/libavcodec/version.h b/libavcodec/version.h index c2b5864e5f..a356445596 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 73 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \