From patchwork Sun Nov 27 17:03:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39511 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp6961612pzb; Sun, 27 Nov 2022 09:10:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf7jtO9T6Mz+vy+fIUnqDa0ED190czf8o+yoSCQ8r/bUDO5HIdI4s9oW/h/b5eQvKIQ/L0zm X-Received: by 2002:a17:906:6bd8:b0:78b:a8d:e76a with SMTP id t24-20020a1709066bd800b0078b0a8de76amr41482678ejs.725.1669569001117; Sun, 27 Nov 2022 09:10:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669569001; cv=none; d=google.com; s=arc-20160816; b=Au5eHJO0XIA4ieGGIyuxA1yM7lII6CZAGPB3A9y6PoK3hTwlOw87/LdgWg4tQex3yy FKkKG6tDeX3dUv46HOhLhmoPCk4zZ37S+YMaa6KSwK4msMhxOZcVuqwU+Bkz3rlkRa0l d4yqCiNzz4dV0xyoXRKHM1bsQDGCQIQVd+GgKIxIywGvymxYTjQYzX8I5H8GqRC6Cte/ Cd3jK5Z+68RS7I8+TaZmOlHUE2JJxHIOxp7zcQCLcsw4wkbAAEGjSV9cehj+KA5qp9F2 7GrCnuZbvdTCYONF893MPD201rg3pwb/pIm6guV45dVr/+NOoATwy4if860VvP7xrsnC fFog== 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=UEvhpbLuGF42OVkbNG01JWaqqeXgjPZrasEAtvgL0sw=; b=pPpBO9obDq5eGvXdzJLrvrkh3NpH1eNibSb5x3a5JGf9Prul54PVLNFUG5MJl7tzSH zEM6KXnS+hBFnkFiaYMaIF5H9k6YE6l6+bhMy1Jm/H3RG67gLDDe8eEVIu00MVWQkpqW pNo2Pyyd4cu4ioQAW6ySz0/1iIf+VMMlgi77NgVAjHTm6kVSK8uTWqhGWwwc2S3EXXOC Q8Re+XxdCjQC7dt24PkJ2u4aITfHA6ST1aTvoHHIQ2Uz/uLeiCTBHf1989h5DEJFBmyQ JojZkDRhn4jnj0KEkomDhOj/7gQt/Q6VN/VsMg5aJWzpINb7cVL4VydAhCnsJF8f7CWq rFQw== 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 y17-20020aa7c251000000b0046b1c26d81dsi1415422edo.80.2022.11.27.09.10.00; Sun, 27 Nov 2022 09:10:01 -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 8760F68BCA9; Sun, 27 Nov 2022 19:06:26 +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 8DBE468B9A3 for ; Sun, 27 Nov 2022 19:06:05 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id C6FFD240499 for ; Sun, 27 Nov 2022 18:06:04 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 60-IvIoIbIdo for ; Sun, 27 Nov 2022 18:06:03 +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 09606240D22 for ; Sun, 27 Nov 2022 18:05:52 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 1ABE73A264F for ; Sun, 27 Nov 2022 18:05:47 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 27 Nov 2022 18:03:49 +0100 Message-Id: <20221127170351.11477-28-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221127170351.11477-1-anton@khirnov.net> References: <20221127170351.11477-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 28/30] lavc/libx264: 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: UR2fhZOpCRi/ --- libavcodec/libx264.c | 3 +++ 1 file changed, 3 insertions(+) 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;