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

James Almer jamrial at gmail.com
Thu Jan 23 22:25:34 EET 2020


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)
 /**
  * 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, \
-- 
2.25.0



More information about the ffmpeg-devel mailing list