This adds a time_base field (currently unused), analogue to the 
AVPacket.time_base field.

Patch attached. doc/APIchanges and version bump to be done at push time.

>From c87391f77b8c4479ebea80e5bd06905c974c8e5b Mon Sep 17 00:00:00 2001
From: Lynne <d...@lynne.ee>
Date: Tue, 7 Sep 2021 19:24:24 +0200
Subject: [PATCH] frame: add a time_base field

This adds a time_base field (currently unused), analogue to the
AVPacket.time_base field.
---
 libavutil/frame.c | 2 ++
 libavutil/frame.h | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index b0ceaf7145..1922e4e5c2 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -63,6 +63,7 @@ static void get_frame_defaults(AVFrame *frame)
     frame->pkt_duration        = 0;
     frame->pkt_pos             = -1;
     frame->pkt_size            = -1;
+    frame->time_base           = (AVRational){ 0, 1 };
     frame->key_frame           = 1;
     frame->sample_aspect_ratio = (AVRational){ 0, 1 };
     frame->format              = -1; /* unknown */
@@ -278,6 +279,7 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
     dst->pkt_pos                = src->pkt_pos;
     dst->pkt_size               = src->pkt_size;
     dst->pkt_duration           = src->pkt_duration;
+    dst->time_base              = src->time_base;
     dst->reordered_opaque       = src->reordered_opaque;
     dst->quality                = src->quality;
     dst->best_effort_timestamp  = src->best_effort_timestamp;
diff --git a/libavutil/frame.h b/libavutil/frame.h
index ff2540a20f..93740ee0f7 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -402,6 +402,12 @@ typedef struct AVFrame {
      */
     int64_t pkt_dts;
 
+    /**
+     * Time base for the timestamps in this frame. May be 0, in which case the
+     * time_base from the frame source should be used.
+     */
+    AVRational time_base;
+
     /**
      * picture number in bitstream order
      */
-- 
2.33.0.252.g9b09ab0cd71

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to