From patchwork Thu Feb 18 03:42:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25749 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 034B444A234 for ; Thu, 18 Feb 2021 05:46:24 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 12F6168A3A0; Thu, 18 Feb 2021 05:43:14 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A538A689FB4 for ; Thu, 18 Feb 2021 05:43:01 +0200 (EET) Received: by mail-wr1-f53.google.com with SMTP id n6so1142013wrv.8 for ; Wed, 17 Feb 2021 19:43:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=jwAnmQbAsZBM7uhYLB9crmDddYpDMF8FMk2Sgyok5k8=; b=mDWoS5Py9+fM4LTmpwW+XE505ozWpV5USQAVDm4L5Vs1v5J9BDTTDvl1vYkPiZ59bp iz2jyBDQCbg9tUYGv/FN8Fq3KUw/E37kiFzp4XUZVVsHi/rCQVt5wI22NLaa3WGIU1HG fmzmaf8QXxYdHE5fAVgeEKw7OP6mMV9SRMsiH9V2Yo0UwcegR0HyQHlxWWSjAlX/8wAR 44YF7VSI7co+xMGY5lxmCk9PjF2ub2GDLSTpjVvT7eADRL6evQuRTT06B8qy46Ey26eX DXRURu7M8AWXUriANOaQEtSbOzDyd2xuNOYweTdif6SoM4px7w2FKANVzR/e72TIcfu4 UGRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=jwAnmQbAsZBM7uhYLB9crmDddYpDMF8FMk2Sgyok5k8=; b=m0fDb7sgUdehU0Gr4M5EF7fvZmyA4BzWwjfMvFhFtwXut1A6pJhB5DwEGZ7HvgEorC 48RlF3yrRY8XVlqniYYchhhpqQArRHo59vuge3yk+ukNkYqV3yqo2WmmU/VZoAvNRsFt Q/CRrzJNsZuGKuY3FJ7i2rVFRZqLNQRZqC+nP9yNTfjcu8eF2NGKyYNUmcbunE0qrEOu 7VbVfKH/At0ni4cRpNWdQDOmssIK8VAreqXXWlX6gIUNZgl+7WFOAFRGgjGGGtr7xSTc gkvNEK3nqyMwXfbbbkqOGwXd7RVSShZ4mt5n43/RaaaQTW6Xj/WB4YMRJk6IItchvXd7 9Cuw== X-Gm-Message-State: AOAM533cvDs+wyfutD/tRKjv5QpvxA0XnbIWeyQ2aT/PGT8kn7uVGscx waJjrVWx+Z8OdSwfoi701Z6WhpkMK0E= X-Google-Smtp-Source: ABdhPJxPOMN7vn3RmyjqgqO+38hLFvP4Ehk5gKS47NDKGnz/6xsb6LJ7UzsZ3Yl5OrweRvRskY63sw== X-Received: by 2002:adf:fa91:: with SMTP id h17mr2125666wrr.257.1613619780951; Wed, 17 Feb 2021 19:43:00 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id p9sm5643855wmc.1.2021.02.17.19.43.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 19:43:00 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 18 Feb 2021 04:42:08 +0100 Message-Id: <20210218034214.2090223-23-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210218034214.2090223-1-andreas.rheinhardt@gmail.com> References: <20210218034214.2090223-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 23/29] avformat/oma: Move stuff only used by demuxer to demuxer X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- libavformat/oma.c | 17 +---------------- libavformat/oma.h | 3 --- libavformat/omadec.c | 18 ++++++++++++++++-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/libavformat/oma.c b/libavformat/oma.c index e7bf8553f0..7282d464aa 100644 --- a/libavformat/oma.c +++ b/libavformat/oma.c @@ -19,10 +19,9 @@ */ #include +#include "libavcodec/codec_id.h" #include "internal.h" #include "oma.h" -#include "libavcodec/avcodec.h" -#include "libavutil/channel_layout.h" const uint16_t ff_oma_srate_tab[8] = { 320, 441, 480, 882, 960, 0 }; @@ -37,17 +36,3 @@ const AVCodecTag ff_oma_codec_tags[] = { }; const AVCodecTag *const ff_oma_codec_tags_list[] = { ff_oma_codec_tags, NULL }; - -/** map ATRAC-X channel id to internal channel layout */ -const uint64_t ff_oma_chid_to_native_layout[7] = { - AV_CH_LAYOUT_MONO, - AV_CH_LAYOUT_STEREO, - AV_CH_LAYOUT_SURROUND, - AV_CH_LAYOUT_4POINT0, - AV_CH_LAYOUT_5POINT1_BACK, - AV_CH_LAYOUT_6POINT1_BACK, - AV_CH_LAYOUT_7POINT1 -}; - -/** map ATRAC-X channel id to total number of channels */ -const int ff_oma_chid_to_num_channels[7] = {1, 2, 3, 4, 6, 7, 8}; diff --git a/libavformat/oma.h b/libavformat/oma.h index 5df50c8eb4..85d5932f1d 100644 --- a/libavformat/oma.h +++ b/libavformat/oma.h @@ -44,7 +44,4 @@ extern const uint16_t ff_oma_srate_tab[8]; extern const AVCodecTag ff_oma_codec_tags[]; extern const AVCodecTag *const ff_oma_codec_tags_list[]; -extern const uint64_t ff_oma_chid_to_native_layout[7]; -extern const int ff_oma_chid_to_num_channels[7]; - #endif /* AVFORMAT_OMA_H */ diff --git a/libavformat/omadec.c b/libavformat/omadec.c index 0b36d4e867..0c90f2644d 100644 --- a/libavformat/omadec.c +++ b/libavformat/omadec.c @@ -59,6 +59,20 @@ static const uint64_t leaf_table[] = { 0x1573cd93da7df623, 0x47f98d79620dd535 }; +/** map ATRAC-X channel id to internal channel layout */ +static const uint64_t oma_chid_to_native_layout[7] = { + AV_CH_LAYOUT_MONO, + AV_CH_LAYOUT_STEREO, + AV_CH_LAYOUT_SURROUND, + AV_CH_LAYOUT_4POINT0, + AV_CH_LAYOUT_5POINT1_BACK, + AV_CH_LAYOUT_6POINT1_BACK, + AV_CH_LAYOUT_7POINT1 +}; + +/** map ATRAC-X channel id to total number of channels */ +static const int oma_chid_to_num_channels[7] = {1, 2, 3, 4, 6, 7, 8}; + typedef struct OMAContext { uint64_t content_start; int encrypted; @@ -492,8 +506,8 @@ static int oma_read_header(AVFormatContext *s) ret = AVERROR_INVALIDDATA; goto fail; } - st->codecpar->channel_layout = ff_oma_chid_to_native_layout[channel_id - 1]; - st->codecpar->channels = ff_oma_chid_to_num_channels[channel_id - 1]; + st->codecpar->channel_layout = oma_chid_to_native_layout[channel_id - 1]; + st->codecpar->channels = oma_chid_to_num_channels[channel_id - 1]; framesize = ((codec_params & 0x3FF) * 8) + 8; samplerate = ff_oma_srate_tab[(codec_params >> 13) & 7] * 100; if (!samplerate) {