[FFmpeg-devel] [RFC PATCH 1/3] frame: decode: propagate PRFT side data packet to frame

Clément Péron peron.clem at gmail.com
Thu Sep 21 15:16:58 EEST 2023


Introduce a new AV_FRAME_DATA_PRFT to propagate Producer Reference Timestamp.

Signed-off-by: Clément Péron <peron.clem at gmail.com>
---
 libavcodec/decode.c      | 1 +
 libavfilter/f_sidedata.c | 1 +
 libavutil/frame.c        | 1 +
 libavutil/frame.h        | 4 ++++
 4 files changed, 7 insertions(+)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 169ee79acd..223bb2e35e 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1429,6 +1429,7 @@ int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx,
         { AV_PKT_DATA_S12M_TIMECODE,              AV_FRAME_DATA_S12M_TIMECODE },
         { AV_PKT_DATA_DYNAMIC_HDR10_PLUS,         AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
         { AV_PKT_DATA_SKIP_SAMPLES,               AV_FRAME_DATA_SKIP_SAMPLES },
+        { AV_PKT_DATA_PRFT,                       AV_FRAME_DATA_PRFT },
     };
 
     frame->pts          = pkt->pts;
diff --git a/libavfilter/f_sidedata.c b/libavfilter/f_sidedata.c
index c86190b062..becc5cfa3e 100644
--- a/libavfilter/f_sidedata.c
+++ b/libavfilter/f_sidedata.c
@@ -73,6 +73,7 @@ static const AVOption filt_name##_options[] = { \
     {   "REGIONS_OF_INTEREST",        "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_REGIONS_OF_INTEREST        }, 0, 0, FLAGS, "type" }, \
     {   "DETECTION_BOUNDING_BOXES",   "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_DETECTION_BBOXES           }, 0, 0, FLAGS, "type" }, \
     {   "SEI_UNREGISTERED",           "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_SEI_UNREGISTERED           }, 0, 0, FLAGS, "type" }, \
+    {   "PRFT",                       "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_PRFT                       }, 0, 0, FLAGS, "type" }, \
     { NULL } \
 }
 
diff --git a/libavutil/frame.c b/libavutil/frame.c
index a3f07ca089..d379e57814 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -958,6 +958,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
     case AV_FRAME_DATA_DOVI_RPU_BUFFER:             return "Dolby Vision RPU Data";
     case AV_FRAME_DATA_DOVI_METADATA:               return "Dolby Vision Metadata";
     case AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT: return "Ambient viewing environment";
+    case AV_FRAME_DATA_PRFT                       : return "Producer time reference";
     }
     return NULL;
 }
diff --git a/libavutil/frame.h b/libavutil/frame.h
index c0c1b23db7..8bd87aa545 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -224,6 +224,10 @@ enum AVFrameSideDataType {
      * encoding.
      */
     AV_FRAME_DATA_VIDEO_HINT,
+    /**
+     * Producer time reference data in the form of the AVProducerReferenceTime struct.
+     */
+    AV_FRAME_DATA_PRFT,
 };
 
 enum AVActiveFormatDescription {
-- 
2.42.0



More information about the ffmpeg-devel mailing list