diff mbox series

[FFmpeg-devel,28/30] lavc/libx264: pass through frame durations to encoded packets

Message ID 20221127170351.11477-28-anton@khirnov.net
State Accepted
Commit a172b33ebf19f91fcb9daf854af56af2e5fbbada
Headers show
Series [FFmpeg-devel,01/30] lavc/libx264: factor out setting up the input frame | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Nov. 27, 2022, 5:03 p.m. UTC
---
 libavcodec/libx264.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 8944a7df36..b87db78fb4 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -52,6 +52,7 @@ 
 typedef struct X264Opaque {
     int64_t reordered_opaque;
     int64_t wallclock;
+    int64_t duration;
 
     void        *frame_opaque;
     AVBufferRef *frame_opaque_ref;
@@ -461,6 +462,7 @@  static int setup_frame(AVCodecContext *ctx, const AVFrame *frame,
     }
 
     opaque->reordered_opaque = frame->reordered_opaque;
+    opaque->duration         = frame->duration;
     opaque->wallclock = wallclock;
     if (ctx->export_side_data & AV_CODEC_EXPORT_DATA_PRFT)
         opaque->wallclock = av_gettime();
@@ -614,6 +616,7 @@  static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
         out_opaque < &x4->reordered_opaque[x4->nb_reordered_opaque]) {
         ctx->reordered_opaque = out_opaque->reordered_opaque;
         wallclock = out_opaque->wallclock;
+        pkt->duration = out_opaque->duration;
 
         if (ctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
             pkt->opaque                  = out_opaque->frame_opaque;