From patchwork Thu Jan 13 02:09:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 33533 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp46877iog; Wed, 12 Jan 2022 18:52:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyMhFYzOm9YWa41zHCtWY1H/DKrd/AglUm71MnVG/I6BKP6uX0LRxhfGQ9pPEUWucS8vTC X-Received: by 2002:a17:906:9a52:: with SMTP id aj18mr1861761ejc.511.1642042335917; Wed, 12 Jan 2022 18:52:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642042335; cv=none; d=google.com; s=arc-20160816; b=ITuyOmpljJ/ZEujQu6kfGjmjBafGrJnbD95gXVSHoZjlbFjfvGbZz7LxTder+7VJrR Pe6lkrTgwo1yztrXnzbXXgTdhUp7J+i0XmXdIJSQOV/8Z2nNqYhchqaC4sIm+xgaXmHg x+z7MY8v/F2DsAZ7BTHXNWuwMhueHV5zwmNuJ4SHBcsqA/wj/UQ6d1nOGVRhAry6UFKK 5/k74OJlroBxxNEE0gdAf05m36AHCwK6Om52OIUCmT5i0dRqpmi7t9PCTUu3xZluLU3h W24cN/G37foTdGGo/cnv5zcXaDyHF+swjCeAyp0NkmkS62CZewLUiEbYGJSsDNGO+VEY KnGw== 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:dkim-signature:delivered-to; bh=Db/Hu35x4Xnr1dNaQ9ge7Aow0AQaotwbEEUXOd0rX2w=; b=aYvCDdh0IH9R9x1hWaDaOJJWlaAhMWJTCd9GmDhxfCmyGAVXDY37AfYyXPxTrbhM8b L2W1BkDA+TsOucQ8rQ2w9XhJAoQGq3GtDl1R9kdBY5Q/aXvKeJZ63ZHQgbloOpFsblvm 8hgIFSgVbgVblzMrElIuYSjAbo0hU83mGxxGYdH6y98YKs7RptXs1yQFOL2MBH3t0R6l Ooepiwp8EwE5stSQqiprYBJXYeZXuaukYPg3nbs2V8G53BFoD3JLzOnzvYK6PGS9tRiT TGpiCQYEXTzyW5mCoJLUaIcUTvpWnh9D01vhT71RHGObVLtd0ECV/Qu2v15KvEiMzbYp DJLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ORf5pq1n; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dp22si824601ejc.266.2022.01.12.18.52.15; Wed, 12 Jan 2022 18:52:15 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ORf5pq1n; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CF77368BA95; Thu, 13 Jan 2022 04:09:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 952A968BA62 for ; Thu, 13 Jan 2022 04:09:31 +0200 (EET) Received: by mail-qt1-f171.google.com with SMTP id y10so5400236qtw.1 for ; Wed, 12 Jan 2022 18:09:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=YR9oF/Dz2pIvicS/ui3zcSlYJlijVCfVyYCAQ78OrdI=; b=ORf5pq1nKE9besMjbRfHtuW8blRNeXZQy3pHvy9YOAcfUVG2dv5Nl6RpZCceUPrm+N +RfE3n+Dq380OE/Z8U83GhvV5gKH+jfJT18xAuAI7dSuFVo0LRGl2V5wqLqCqDteZNkQ laMNp2kFwCVNhaYB67YlEry8lnEfaMtTMwVtnGBtcFgh6JPg4GKtoPvFQ1o0uY4IAL1Z U2XkLY06qAJrZcgrizOr8bcveDurMvmdEhu4om+lOLOfcpa2/K+wk8d8aHgZ72RYRgJO 52FEPufVhLKmBrM+sQItYmPzcSrg08K27kNn/7ioCNJHcGIEAylvIamHvtrw34Mrx/pq 3sIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YR9oF/Dz2pIvicS/ui3zcSlYJlijVCfVyYCAQ78OrdI=; b=wTySDhUqA/msQu54VlTo2U7W2c8o/9OiQcQsOgrzZiRO9sXypKDAls/J0npJKywHf7 Hjyo2ISa9DlIYJseOs2pjb5KgzE+Q/8XSwj0vhzBtgmXdGMTPJBPg/MnZLumzjzA9Wkn YkKZ6sWuuO7lepvM5fGkrO6ESEnRV75dVyen/1CgcclnKiSvErSNwX5DgwH82QiIJWgA vj/DGhn1H57Fb0yNqEARLoaqG2wdBYju5yCtymquQ8tNinhLsZVVyNzGMJqH895vaf9p SKUCYuwykB6EiU3zXJca4PDC+54kR8qxQRlL+fHs422lkvsWR7vYtWW63EL/CyOI1Xab YhSA== X-Gm-Message-State: AOAM530ao6usq7y15jwFBtFGn4T4/syZ39IlC9GRDz1cFbP8Ma8fxTHw uLHEV7qSoQKEyElZZttm9n0m4nb2KXo= X-Received: by 2002:a05:622a:552:: with SMTP id m18mr2127723qtx.50.1642039770093; Wed, 12 Jan 2022 18:09:30 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id u6sm1068031qko.83.2022.01.12.18.09.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:09:29 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:09:04 -0300 Message-Id: <20220113020913.870-3-jamrial@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220113015101.4-1-jamrial@gmail.com> References: <20220113015101.4-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 272/281] lavc: drop temporary compat wrappers for channel layout API change 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: 9ANw8xiLWfLZ From: Anton Khirnov Signed-off-by: James Almer --- libavcodec/aacdec_template.c | 7 ------- libavcodec/avcodec.c | 29 ----------------------------- libavcodec/dca_lbr.c | 7 ------- libavcodec/dcadec.c | 8 -------- libavcodec/decode.c | 20 -------------------- libavcodec/encode.c | 17 +---------------- 6 files changed, 1 insertion(+), 87 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 387a4acfce..349ecdefb3 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -592,13 +592,6 @@ FF_ENABLE_DEPRECATION_WARNINGS } av_channel_layout_copy(&avctx->ch_layout, &ac->oc[1].ch_layout); -#if FF_API_OLD_CHANNEL_LAYOUT -FF_DISABLE_DEPRECATION_WARNINGS - avctx->channels = avctx->ch_layout.nb_channels; - avctx->channel_layout = avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? - avctx->ch_layout.u.mask : 0; -FF_ENABLE_DEPRECATION_WARNINGS -#endif ac->oc[1].status = oc_type; if (get_new_frame) { diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 0436a6d0bd..5b68e799ec 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -137,8 +137,6 @@ static int64_t get_bit_rate(AVCodecContext *ctx) int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) { int ret = 0; - int orig_channels; - uint64_t orig_channel_layout; AVCodecInternal *avci; if (avcodec_is_open(avctx)) @@ -275,14 +273,6 @@ FF_DISABLE_DEPRECATION_WARNINGS avctx->ch_layout.nb_channels = avctx->channels; } } - - /* temporary compat wrapper for new-style callers and old-style codecs; - * to be removed once all the codecs have been converted */ - if (avctx->ch_layout.nb_channels) { - avctx->channels = avctx->ch_layout.nb_channels; - avctx->channel_layout = avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? - avctx->ch_layout.u.mask : 0; - } FF_ENABLE_DEPRECATION_WARNINGS #endif @@ -345,13 +335,6 @@ FF_ENABLE_DEPRECATION_WARNINGS if (!HAVE_THREADS && !(codec->caps_internal & FF_CODEC_CAP_AUTO_THREADS)) avctx->thread_count = 1; -#if FF_API_OLD_CHANNEL_LAYOUT -FF_DISABLE_DEPRECATION_WARNINGS - orig_channels = avctx->channels; - orig_channel_layout = avctx->channel_layout; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - if (!(avctx->active_thread_type & FF_THREAD_FRAME) || avci->frame_thread_encoder) { if (avctx->codec->init) { @@ -372,18 +355,6 @@ FF_ENABLE_DEPRECATION_WARNINGS #if FF_API_OLD_CHANNEL_LAYOUT FF_DISABLE_DEPRECATION_WARNINGS - /* decoder setting the old-style fields */ - if (avctx->channels != orig_channels || - avctx->channel_layout != orig_channel_layout) { - av_channel_layout_uninit(&avctx->ch_layout); - if (avctx->channel_layout) { - av_channel_layout_from_mask(&avctx->ch_layout, avctx->channel_layout); - } else { - avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; - avctx->ch_layout.nb_channels = avctx->channels; - } - } - /* update the deprecated fields for old-style callers */ avctx->channels = avctx->ch_layout.nb_channels; avctx->channel_layout = avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? diff --git a/libavcodec/dca_lbr.c b/libavcodec/dca_lbr.c index c11f2f7e18..527bc8b7c0 100644 --- a/libavcodec/dca_lbr.c +++ b/libavcodec/dca_lbr.c @@ -1744,13 +1744,6 @@ int ff_dca_lbr_filter_frame(DCALbrDecoder *s, AVFrame *frame) av_channel_layout_uninit(&avctx->ch_layout); av_channel_layout_from_mask(&avctx->ch_layout, channel_mask); -#if FF_API_OLD_CHANNEL_LAYOUT -FF_DISABLE_DEPRECATION_WARNINGS - avctx->channels = avctx->ch_layout.nb_channels; - avctx->channel_layout = avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? - avctx->ch_layout.u.mask : 0; -FF_ENABLE_DEPRECATION_WARNINGS -#endif frame->nb_samples = 1024 << s->freq_range; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c index 239ed9ac91..9f40da20fc 100644 --- a/libavcodec/dcadec.c +++ b/libavcodec/dcadec.c @@ -78,14 +78,6 @@ int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask av_channel_layout_from_mask(&avctx->ch_layout, wav_mask); } -#if FF_API_OLD_CHANNEL_LAYOUT -FF_DISABLE_DEPRECATION_WARNINGS - avctx->channels = avctx->ch_layout.nb_channels; - avctx->channel_layout = avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? - avctx->ch_layout.u.mask : 0; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - return nchannels; } diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 6381ec68e1..a076a8884f 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1698,26 +1698,6 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) { #if FF_API_OLD_CHANNEL_LAYOUT FF_DISABLE_DEPRECATION_WARNINGS - /* temporary compat layer for decoders setting the old-style channel - * layout fields; shall be removed after all the decoders are converted - * to the new API */ - if ((avctx->channels > 0 && avctx->ch_layout.nb_channels != avctx->channels) || - (avctx->channel_layout && (avctx->ch_layout.order != AV_CHANNEL_ORDER_NATIVE || - avctx->ch_layout.u.mask != avctx->channel_layout))) { - av_channel_layout_uninit(&avctx->ch_layout); - if (avctx->channel_layout) { - if (av_popcount64(avctx->channel_layout) != avctx->channels) { - av_log(avctx, AV_LOG_ERROR, "Inconsistent channel layout/channels\n"); - ret = AVERROR(EINVAL); - goto fail; - } - av_channel_layout_from_mask(&avctx->ch_layout, avctx->channel_layout); - } else { - avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; - avctx->ch_layout.nb_channels = avctx->channels; - } - } - /* compat layer for old-style get_buffer() implementations */ avctx->channels = avctx->ch_layout.nb_channels; avctx->channel_layout = (avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE) ? diff --git a/libavcodec/encode.c b/libavcodec/encode.c index f9f8879b8e..47fa3ac4bf 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -486,24 +486,9 @@ int ff_encode_preinit(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n", buf); return AVERROR(EINVAL); } -FF_DISABLE_DEPRECATION_WARNINGS } #if FF_API_OLD_CHANNEL_LAYOUT - else if (avctx->codec->channel_layouts) { - if (!avctx->channel_layout) { - av_log(avctx, AV_LOG_WARNING, "Channel layout not specified\n"); - } else { - for (i = 0; avctx->codec->channel_layouts[i] != 0; i++) - if (avctx->channel_layout == avctx->codec->channel_layouts[i]) - break; - if (avctx->codec->channel_layouts[i] == 0) { - char buf[512]; - av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); - av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n", buf); - return AVERROR(EINVAL); - } - } - } +FF_DISABLE_DEPRECATION_WARNINGS if (avctx->channel_layout && avctx->channels) { int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); if (channels != avctx->channels) {