From patchwork Thu Jan 13 01:49:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 33321 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp15508iog; Wed, 12 Jan 2022 17:58:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGmpC2Lvwx5uYBzSjWdqA/O4G7aL6v68gMAO5pAFxYQ2scbLpfIu5Nv3/mm+XyIJgcZSa8 X-Received: by 2002:a17:906:589:: with SMTP id 9mr1922591ejn.721.1642039096972; Wed, 12 Jan 2022 17:58:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642039096; cv=none; d=google.com; s=arc-20160816; b=idkvqFucOx6dIrwIbAfCmaPCy2FWGo4vu4gLFeHYS6u2T05Hz0w6dPhlqCgn5Y52d2 czJgWbv60IEpNd5OfCdPwjvIHYM/Mw1viLFNK9okr2xjHXlFWA+dGEujpFpdHPHmmVmC +Th4n8lxYNUr9sFYw3wAsQ+VJ1uSc9imUUrbd85AjqCpe10OadNtemW1qjFFY+/HVU66 C58jpk36Uu4VV5iPpSnxht1smCideovcEf6K7BxfyyHJmhw7b7KH8Rm+hoXXTrH7zGb/ wCoJi6o+lGV779Z9mCsWXgOHc2GNPV0u9QUGDu/xby/RO3VVYHjI/5EGBgmrilI+kpc2 4Hxg== 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=ujkeu7AlzccoCLtyHSqSsl48zXlulGswh6/rlvvuSTQ=; b=U/dOAwuQDW04jtJiTCOGnI9H96ZuAWj6XZ2DFLbeJWupCsOi6ERdkY0IdauFp64Tcf JJDYWSQK1kPfwYg/oQOSbcqOqCTniLgKjRl8cHD3jOhDmcfWT9LeaKnkc0+62O/64b9K TbHu77KU3sfBmf7jjI4q8hYSg0jymlrC9t+H/nox103UKNrTIinMJpyHoJj9h7ktrckU eRYBxwnhBNil0g4MDUdGOoHXuR6gm8nvBHUpU5k7f4NbuSprVnE6Wdl8T+tEaD3J9Gf2 JKDzQJtSh+RRXrRY/DpszPwjfSUZf794QE+dfTL00pK0fqaCtfNO/4YCuYaYncaQNoVR oV2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=IhXalA6g; 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 f19si838843edd.540.2022.01.12.17.58.16; Wed, 12 Jan 2022 17:58:16 -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=IhXalA6g; 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 3810868AFCB; Thu, 13 Jan 2022 03:52:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2FE3368B034 for ; Thu, 13 Jan 2022 03:52:38 +0200 (EET) Received: by mail-qv1-f51.google.com with SMTP id kc16so5128586qvb.3 for ; Wed, 12 Jan 2022 17:52:38 -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=8PGN6vSUrXpLhAuxy2+MsbXpJMUKAODHkTvElhX4LK0=; b=IhXalA6gt0ZN+xfYm/YY0urczMX/qT5Vzr0xfmk9kWMK9rvwtvh6Giu1xgFV/s/Ai7 kRlUf/sjd9YavimAhsV00UsF9puxRQAhg4JKalk336PLtEc+Owq4cc0k5SCQlZhIZ0al WQDLhF8hZhRJ1S8HIP6WDRmF/gCu8ZDtBCGukDA7pg/h1tVG+1WcWFKBTzdm9N3EZKmE DNVN4GBALI8MBuFlrwlLVOBfLXAFvgwo+EJ58kTdi6jR9RaI1fqY7/yOLnCU3RY24cyL etQYYLdrewnUqYTJj3jp1C/u4kuTPDx6HBgbiBIMZPDl0kzZxOFN2YBAZDnQtLJSORLE KvSA== 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=8PGN6vSUrXpLhAuxy2+MsbXpJMUKAODHkTvElhX4LK0=; b=HijGYEl+hH6RvDLmlarmH8nKl0Mdg7JuOfLEWtU7h/guMqEFvIoIw98Y0Klmmrs6h3 glKFOn28tqALU/uf731h49Fah7NA63ZNHrML4czpKigdpC1TCePEQ0K+dQ59yFV61/TQ Z+K0u8xgtkeFqZqDRk9NIof3J9cmY54HSbVD4VjP1CqFMNdN575XyQMkNyy+8GFfXfuR tMhIng9yAAgv1BEqJLdegICqIV8eCcMGtVWSBysE+bp6Jz1ubH8GHe3GPvY40ukl3vjf vnmQIf2glQmXuFwxrDxwS4xj83Rx0Rm5gBTRZJt3qaomDwp/bTuzFC3pwjGfs27eZAHH 979w== X-Gm-Message-State: AOAM533jL2bHb+EL0VWAFzKvYP3+ly5nWO1NzSV4IUzTd+bSwSPNl5mS IydOv91jw156pLhR10PR1xIxc6TC89Q= X-Received: by 2002:a05:6214:410f:: with SMTP id kc15mr2345345qvb.113.1642038757455; Wed, 12 Jan 2022 17:52:37 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id i21sm1204710qti.31.2022.01.12.17.52.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 17:52:37 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 22:49:53 -0300 Message-Id: <20220113015101.4-32-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 031/281] argo: convert to new channel layout API 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: sxD4NFVkYcNq From: Anton Khirnov Signed-off-by: James Almer --- libavformat/argo_asf.c | 18 ++++++++---------- libavformat/argo_cvg.c | 5 ++--- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c index 2b3569ebc3..cb598b3e04 100644 --- a/libavformat/argo_asf.c +++ b/libavformat/argo_asf.c @@ -96,11 +96,9 @@ int ff_argo_asf_fill_stream(AVFormatContext *s, AVStream *st, const ArgoASFFileH st->codecpar->format = AV_SAMPLE_FMT_S16P; if (ckhdr->flags & ASF_CF_STEREO) { - st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; - st->codecpar->channels = 2; + st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; } else { - st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; - st->codecpar->channels = 1; + st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; } /* v1.1 files (FX Fighter) are all marked as 44100, but are actually 22050. */ @@ -121,11 +119,11 @@ int ff_argo_asf_fill_stream(AVFormatContext *s, AVStream *st, const ArgoASFFileH * (nchannel control bytes) + ((bytes_per_channel) * nchannel) * For mono, this is 17. For stereo, this is 34. */ - st->codecpar->block_align = st->codecpar->channels + + st->codecpar->block_align = st->codecpar->ch_layout.nb_channels + (ckhdr->num_samples / 2) * - st->codecpar->channels; + st->codecpar->ch_layout.nb_channels; - st->codecpar->bit_rate = st->codecpar->channels * + st->codecpar->bit_rate = st->codecpar->ch_layout.nb_channels * st->codecpar->sample_rate * st->codecpar->bits_per_coded_sample; @@ -305,12 +303,12 @@ static int argo_asf_write_init(AVFormatContext *s) return AVERROR(EINVAL); } - if (par->channels > 2) { + if (par->ch_layout.nb_channels > 2) { av_log(s, AV_LOG_ERROR, "ASF files only support up to 2 channels\n"); return AVERROR(EINVAL); } - if (par->block_align != 17 * par->channels) + if (par->block_align != 17 * par->ch_layout.nb_channels) return AVERROR(EINVAL); if (par->sample_rate > UINT16_MAX) { @@ -392,7 +390,7 @@ static int argo_asf_write_header(AVFormatContext *s) chdr.unk2 = ~0; chdr.flags = ASF_CF_BITS_PER_SAMPLE | ASF_CF_ALWAYS1; - if (par->channels == 2) + if (par->ch_layout.nb_channels == 2) chdr.flags |= ASF_CF_STEREO; argo_asf_write_file_header(&fhdr, s->pb); diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c index e1854b4493..cdf13016a8 100644 --- a/libavformat/argo_cvg.c +++ b/libavformat/argo_cvg.c @@ -182,8 +182,7 @@ static int argo_cvg_read_header(AVFormatContext *s) break; } - par->channels = 1; - par->channel_layout = AV_CH_LAYOUT_MONO; + par->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; par->bits_per_coded_sample = 4; par->block_align = ARGO_CVG_BLOCK_ALIGN; @@ -275,7 +274,7 @@ static int argo_cvg_write_init(AVFormatContext *s) return AVERROR(EINVAL); } - if (par->channels != 1) { + if (par->ch_layout.nb_channels != 1) { av_log(s, AV_LOG_ERROR, "CVG files only support 1 channel\n"); return AVERROR(EINVAL); }