From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 30C1C44EB7 for ; Sun, 27 Nov 2022 19:59:25 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EF69068BBB1; Sun, 27 Nov 2022 21:59:22 +0200 (EET) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 81AE468A5E1 for ; Sun, 27 Nov 2022 21:59:16 +0200 (EET) Received: by mail-ot1-f52.google.com with SMTP id w26-20020a056830061a00b0066c320f5b49so5747277oti.5 for ; Sun, 27 Nov 2022 11:59:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=fl44LJV5lLOFAXdSS4BCuP7ly+l/1hiIoSU0G/+mj20=; b=U697ymlPxQ3w+Df6Q7daDXjmDae924OINKTnweGTVAJj6gsg/N/byxiwBVBocoEqw5 ee59ksdW8+zsYLTb3CHovg39yvy0nLemmmr809IEZnDFHw0JWgrv/07eIDGUU0o5SXDm hyKOzSIW3UWjuZD+3AUFjDv/AdgKpDJVSPG0zBdGkL6Syrtd4V2bn5JJQAnAeF+1R30e Hg4+Zq8xaXyHIuPY0G+GdIC2HdKu8vy3DrKPb9Y/ybnSdzVIiw+ZYcpFV/ZbkF+r4Dt8 zrYFXuvKGj1q52vM4NumnEhpp9qOipPFn7POn0ExbQp+bghjLyetkGMP0TqmLaqA5udn Vdjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fl44LJV5lLOFAXdSS4BCuP7ly+l/1hiIoSU0G/+mj20=; b=sabWDm1o8GlilUFlPBuV/pQyyFD1viYrS1gwUnJZ8gPf+ueLj+ve67hvOODIpAAywp 9vuqLIw6x1+YldDHWyzxiYphoNlNrGkrmM3iTmPIgyg9xAq1M68OOaCT3N8dKFlVdOxe /HHqC/X3bgvJq0so9hzYVHx6vheA3VPCDKTVHr+uLU7nSJuuTxyrfoCPcaarerd4E1Ez lkjwutgPc081kxmcA2DWmZr3RynWhBI1ZgTCYAvFtvgpcDoz4PeNMPHnzvotJvZcl5PV Wc+N25Jdm4bJBjMByFEmXeiwT+9E70YL5PiC8Yx+0ofG2IlCXlJtQ0cv/8RYbikCBaK3 5YbA== X-Gm-Message-State: ANoB5pn4oWvTRgAZoOSDlVCfLkS99ms0I0Pi8syd645tb7PcM7u54lhg XAYXDjQOhd78zit9gv3/pvufzZzu+Ro= X-Google-Smtp-Source: AA0mqf4ayX85C4aNlbxsOwq7P3h//Yzn6FgTiM1KGx5/Ss8CpsfXwDdI7KK4rkaG8sBx7LcLoKNkCA== X-Received: by 2002:a9d:373:0:b0:659:73c9:8497 with SMTP id 106-20020a9d0373000000b0065973c98497mr13273126otv.341.1669579154036; Sun, 27 Nov 2022 11:59:14 -0800 (PST) Received: from [192.168.0.15] ([181.85.72.69]) by smtp.gmail.com with ESMTPSA id eo7-20020a056870ec8700b0011e37fb5493sm4930813oab.30.2022.11.27.11.59.12 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Nov 2022 11:59:13 -0800 (PST) Message-ID: Date: Sun, 27 Nov 2022 17:00:01 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20221127170351.11477-1-anton@khirnov.net> <20221127170351.11477-17-anton@khirnov.net> From: James Almer In-Reply-To: <20221127170351.11477-17-anton@khirnov.net> Subject: Re: [FFmpeg-devel] [PATCH 17/30] lavc: support AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE in all no-delay encoders 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 11/27/2022 2:03 PM, Anton Khirnov wrote: > diff --git a/libavcodec/encode.c b/libavcodec/encode.c > index 7e2d54ae9b..e4270b6c34 100644 > --- a/libavcodec/encode.c > +++ b/libavcodec/encode.c > @@ -220,6 +220,18 @@ int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt, > avpkt->duration = ff_samples_to_time_base(avctx, > frame->nb_samples); > } > + > + avctx->reordered_opaque = frame->reordered_opaque; > + if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) { > + avpkt->opaque = frame->opaque; > + if (frame->opaque_ref) { > + avpkt->opaque_ref = av_buffer_ref(frame->opaque_ref); > + if (!avpkt->opaque_ref) { > + ret = AVERROR(ENOMEM); > + goto unref; > + } > + } You could simplify this to simply ret = av_buffer_replace(&avpkt->opaque_ref, frame->opaque_ref); if (ret < 0) return ret; Here and elsewhere you did the same thing. No need to check for frame->opaque_ref since av_buffer_replace() can handle NULL src, in which case for this scenario (where avpkt->opaque_ref is always NULL) it will be a no-op. > + } > } > > // dts equals pts unless there is reordering _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".