From patchwork Wed Jan 25 16:55:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 40121 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3ca3:b0:b9:1511:ac2c with SMTP id b35csp547347pzj; Wed, 25 Jan 2023 08:58:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXsPQvInVsf5rzca3VS4t+ZKokKdQLh6WtGvgkZyaB16/LjHex8SjjmS8gfGnMyP+pOTHegy X-Received: by 2002:a17:906:774f:b0:870:94e:13f9 with SMTP id o15-20020a170906774f00b00870094e13f9mr34888626ejn.0.1674665920595; Wed, 25 Jan 2023 08:58:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674665920; cv=none; d=google.com; s=arc-20160816; b=jv0ZSkHMCW00NWR1mKeTKwDXAMh3fXGJgdHoR8v/l7r1rLnjKuQmXH2NDqHO/rroBr 0+zQQuPMIbDtINbINXukVa6Q+ZqVIelEgoQm89Ieb4nMawVEPa3cwG/oObwzvwIvzCS8 dUiVYMDH803LJzsK4/HlNfJv/SgEcSvstfY5e+csnNPCxG6LJX9Hejdhkc2XooU9ayGj 2foEfqR+NvHAm/4cA48H38YzNWVQmC7/7v2zRkxI7hiMONXaoSeTS3Rp32HGzSQ2hPZY TYB+gy4nUtGvGDAeGCLkOt2mUiYo+BS3SCY0KC5mNp7jUkNb8bvnnAJeJ3p04yjKzJZO Frfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=P7g0wrN75/iE4/5JerJWKg0gnfV7jlvbqIzSaUtr0rs=; b=rxtrESJPrzcSEIGZtEaPLkAzp2UsYABI9Lo/afSdD7/HqH14p/zvn4aqcSVIpI8T0a 2665OB1+WLUSiFp+ODQtbpzTEMJEbluW+ON0SK3xVZRNHnu+zlss9iajQCL1eyH+fsBm NSlpw99fwDthneuVeMChcG1TmOB8vXPsYB94pfGPC8qMg/Bgac8k5MyR50oDU2C6Yces YfwxVdrFupGcvjnpjHnIuvyebcFeeCvl/Vv9W4b3oVwlJtXUNDk4iBwE0KMTeroEcEFb w/UOfQ4QrWS7c6s4t2R55u0JRL2ZLl7jxl6HHGE/zX9w2UX3VYLi8KMgixvKGo8iz5nw mDww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j9-20020a170906534900b0087814312d0csi3149034ejo.900.2023.01.25.08.58.40; Wed, 25 Jan 2023 08:58:40 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3D38668BD90; Wed, 25 Jan 2023 18:56:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EFC2168BDCB for ; Wed, 25 Jan 2023 18:56:19 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E32312406CB for ; Wed, 25 Jan 2023 17:56:17 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id EzOkaI1FXykT for ; Wed, 25 Jan 2023 17:56:17 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 39F632406CE for ; Wed, 25 Jan 2023 17:56:05 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 575C53A0505 for ; Wed, 25 Jan 2023 17:55:59 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 25 Jan 2023 17:55:36 +0100 Message-Id: <20230125165537.5371-18-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230125165537.5371-1-anton@khirnov.net> References: <20230125165537.5371-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 18/19] lavc/libx265: pass through frame durations to encoded packets X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Ng1yQCRSrUDy --- libavcodec/libx265.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index a71f1f76d3..6fc189f1b5 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; if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) { rd->frame_opaque = pic->opaque; @@ -755,6 +757,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;