From patchwork Wed Jan 25 16:55:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 40112 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3ca3:b0:b9:1511:ac2c with SMTP id b35csp546653pzj; Wed, 25 Jan 2023 08:57:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXuR9pK/JiUVlpdekEkWNBLxebhrtq3ARqtdKPPiZbrUsR6yEczJExf/NJS2JhZywzZnK2dR X-Received: by 2002:a17:906:a08:b0:877:6177:309c with SMTP id w8-20020a1709060a0800b008776177309cmr27561950ejf.31.1674665841583; Wed, 25 Jan 2023 08:57:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674665841; cv=none; d=google.com; s=arc-20160816; b=fT3eqQX6tVtJGeZDtTgG/rBFzWLC5xmzXoJNXqWk6CN6MaMkIsqwNDks9Y037sc2gR cguA1Z+dM+oKVXZgDERMh27pOX9OnGG2uqEb0bjwIwjHXf/of3TlarLWxpVVIR6hDU+c shuFgJVfYzg0XmXry2sa+inh+uDOyHGuUr6E7dzZaHnBBMU5vS/y5TlsIJNyNCzXNPMr 3iANc8dezqkE0cUQ4RIXlJYGu+KcftLQiHUxGK0HgprWO4U1bRt9Br2gXM0atUIA6o3P xy9fbj87p0msFtvPM35Bw7fTk/aGxSEEXINJcj+Qshsvkb8Kc2XC7yc8/jIjW1DJf/Ro wGtA== 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=6EQ9sTCHkaYxQhFtgbxpAk+bQR9t7CUop9v0+/mysV0=; b=KnywcCox6oas5Skx+nA1S5bN+ENPURimdlv013GOoVhgv/byGtRaOOb/hvp428Uwu0 h7/4w4DFk3oiRps2KB+c9hoXJIrWS48D5un+cyOBCZf2VW2sQoCL8uMVg3eVUCLHcLHf 4cEyaxdqlHEMCd3T44nyrGGNJHwTf69lFRYcfb6PLHd/uVepDwRlqR4cRUIzp8Wr+cp4 3nWeO1Hb3YMIZebJXdRb3CCSkKtHuII7CQ17yTw2tBn4ZngzY8ry5vanFLkNWI2aVOmy q5O/zwn33i+riuo7ZxuVF6/gaaLhWjXdzG/VHMylHPP3bz2I7fIyLWhJkwGhqVdJK0hy mnGA== 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 ab14-20020a170907340e00b0086fd54a8f19si6739487ejc.63.2023.01.25.08.57.20; Wed, 25 Jan 2023 08:57:21 -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 2A07768BDEA; Wed, 25 Jan 2023 18:56:27 +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 DDAA468BD2C for ; Wed, 25 Jan 2023 18:56:20 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 0D580240178 for ; Wed, 25 Jan 2023 17:56:20 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id aIENV8SSvMNj for ; Wed, 25 Jan 2023 17:56:18 +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 3D28E2406D0 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 058223A043F 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:29 +0100 Message-Id: <20230125165537.5371-11-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 11/19] lavc/libtheoraenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE 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: ZzI+cnNvonq+ --- libavcodec/libtheoraenc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c index da16c6372e..73295e22b9 100644 --- a/libavcodec/libtheoraenc.c +++ b/libavcodec/libtheoraenc.c @@ -347,6 +347,12 @@ static int encode_frame(AVCodecContext* avc_context, AVPacket *pkt, // HACK: assumes no encoder delay, this is true until libtheora becomes // multithreaded (which will be disabled unless explicitly requested) pkt->pts = pkt->dts = frame->pts; + pkt->duration = frame->duration; + + ret = ff_encode_reordered_opaque(avc_context, pkt, frame); + if (ret < 0) + return ret; + if (!(o_packet.granulepos & h->keyframe_mask)) pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; @@ -373,7 +379,9 @@ const FFCodec ff_libtheora_encoder = { .p.type = AVMEDIA_TYPE_VIDEO, .p.id = AV_CODEC_ID_THEORA, .p.capabilities = AV_CODEC_CAP_DR1 | - AV_CODEC_CAP_DELAY /* for statsfile summary */, + /* for statsfile summary */ + AV_CODEC_CAP_DELAY | + AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE, .priv_data_size = sizeof(TheoraContext), .init = encode_init,