[FFmpeg-devel] [PATCH 4/9] lavf: use AVFrame.duration instead of AVFrame.pkt_duration

Anton Khirnov anton at khirnov.net
Wed Jul 13 12:17:20 EEST 2022


---
 libavformat/mux.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 31361f9b46..a3b50dadb6 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1417,7 +1417,14 @@ static int write_uncoded_frame_internal(AVFormatContext *s, int stream_index,
         pkt->size         = sizeof(frame);
         pkt->pts          =
         pkt->dts          = frame->pts;
-        pkt->duration     = frame->pkt_duration;
+#if FF_API_PKT_DURATION
+FF_DISABLE_DEPRECATION_WARNINGS
+        if (frame->pkt_duration)
+            pkt->duration     = frame->pkt_duration;
+        else
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+        pkt->duration = frame->duration;
         pkt->stream_index = stream_index;
         pkt->flags |= AV_PKT_FLAG_UNCODED_FRAME;
     }
-- 
2.34.1



More information about the ffmpeg-devel mailing list