diff mbox series

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

Message ID 20221127170351.11477-29-anton@khirnov.net
State New
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/libx265.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 7ba547a7e7..088ddef3fc 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -43,6 +43,7 @@ 
 
 typedef struct ReorderedData {
     int64_t reordered_opaque;
+    int64_t duration;
 
     void        *frame_opaque;
     AVBufferRef *frame_opaque_ref;
@@ -616,6 +617,7 @@  static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         }
         rd = &ctx->rd[rd_idx];
 
+        rd->duration         = pic->duration;
         rd->reordered_opaque = pic->reordered_opaque;
         rd->frame_opaque     = pic->opaque;
         if (pic->opaque_ref && avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
@@ -754,6 +756,7 @@  static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         ReorderedData *rd = &ctx->rd[idx];
 
         avctx->reordered_opaque = rd->reordered_opaque;
+        pkt->duration           = rd->duration;
 
         if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
             pkt->opaque          = rd->frame_opaque;