From patchwork Sun Nov 27 17:03:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39573 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a05:6a11:561f:b0:33d:fc04:f431 with SMTP id rr31csp8295422pxb; Sun, 27 Nov 2022 09:09:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Y/swiCsHUzzMdqNjcn/tbq4dbC8tRLZNcy0b4X9h7VuFACHvukCkPOkqLwSe4JIJRLJQp X-Received: by 2002:a17:906:2e82:b0:7ae:44b2:cb7f with SMTP id o2-20020a1709062e8200b007ae44b2cb7fmr25782099eji.437.1669568949189; Sun, 27 Nov 2022 09:09:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669568949; cv=none; d=google.com; s=arc-20160816; b=Pd3bH+Z7g1b7x7Fa/pw71g9wUZntrP/vPgkHPcSHSmva5ZYearRCDa2Gxc984sMF// vMeomEtTJ1TsPmjRCGrmNr7iFQUxcOU/p3ZyDWJ87UJID6fHLQW2j65LADB7bLU99FuU a58TCRauEw8aEI+upmb5kEuZWGn0HBMymnDK1b0heDqADBNeUUCRz8BNSnZJPjxMT+7K gSe7pLPBJbv086VE50hGohWxAoi2sFyJybeqmc8j6ZlijK62Wljl8bd8WCSldMPT4Cs4 ISvOK5zTq+U9vSTnpfHHi1t4OuNrDWREeH2NXUlWIFsN0etIDvhUFU8qR6DEVfPucqXF CVDw== 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=yOw3rrQ528upIndFZouPMoGunTmSHdj7bsSj+mqD3r0=; b=m5IFwL9VKvT1gnFLWsj4NDd4jkuykP4+/685prUjenCTKqaEFEysUPhZ6YMmkURK6g bTRVDKH9D/FbijXs0EqTXwJsZkMQQOfJMzN4fZdfIRPYgKHhRw9F5VXqPYQDzorA3XxQ QVrv3AgTqdWtrGCZ6VdFKK/5OWqAZ4wN5rhQDfXFcIdOI+jniIn5pMDFLZPp7W6cdpJb 67lt/v7is3FZYd1OABzYvoMuQMkiS8hjNvmnxhOcPvO0ew0q8hUKuATlmliE35Y2nbDV gmPMPDIpBeHRR+0Iaxmhbs73c8Kr2caM6jrVvvTByWHx9JhS3KK1P5BH5NCsWKZOpsrz FGaw== 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 g10-20020a056402180a00b0045d3e06e4d5si7271182edy.389.2022.11.27.09.09.08; Sun, 27 Nov 2022 09:09:09 -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 7CC7168BC3B; Sun, 27 Nov 2022 19:06:20 +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 DBBB468B9E8 for ; Sun, 27 Nov 2022 19:05:58 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 64A312406CC for ; Sun, 27 Nov 2022 18:05:56 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id NeiKCKn2N1z7 for ; Sun, 27 Nov 2022 18:05:55 +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 C1B952406CD for ; Sun, 27 Nov 2022 18:05:51 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id C87083A25FB for ; Sun, 27 Nov 2022 18:05:46 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 27 Nov 2022 18:03:43 +0100 Message-Id: <20221127170351.11477-22-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 22/30] lavc/adxenc: support 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: CdTo9FYL5UQz Content-Length: 1598 --- libavcodec/adxenc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c index e1bf344b01..9e0ceb61eb 100644 --- a/libavcodec/adxenc.c +++ b/libavcodec/adxenc.c @@ -185,6 +185,18 @@ static int adx_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, avpkt->pts = frame->pts; avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); + + 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) + return AVERROR(ENOMEM); + } + } + + avctx->reordered_opaque = frame->reordered_opaque; + *got_packet_ptr = 1; return 0; } @@ -194,7 +206,8 @@ const FFCodec ff_adpcm_adx_encoder = { CODEC_LONG_NAME("SEGA CRI ADX ADPCM"), .p.type = AVMEDIA_TYPE_AUDIO, .p.id = AV_CODEC_ID_ADPCM_ADX, - .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, + .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | + AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, .priv_data_size = sizeof(ADXContext), .init = adx_encode_init, FF_CODEC_ENCODE_CB(adx_encode_frame),