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 7911442CA6 for ; Thu, 13 Jan 2022 01:55:31 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E112B68AFD2; Thu, 13 Jan 2022 03:52:25 +0200 (EET) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6446B68AFA1 for ; Thu, 13 Jan 2022 03:52:23 +0200 (EET) Received: by mail-qk1-f182.google.com with SMTP id 193so4855203qkh.13 for ; Wed, 12 Jan 2022 17:52:23 -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=iVAezJUOtw7hicZc2BC6n0J1H4KFYdy7+AEzYJzxFMs=; b=Ow4UdA9Am6Q+d8A5oMl2zv3EXHSzaK0utIWR4AAoNJI0zMSGArVab4T7K/MlUzRMdt 65zPGTR1CkE4/YT39TFR20xLDZN98gzLDWADkUrJWGzstr88iotwLGSPr9UaYBPXGZfS GrSPiiNSthGd/mq1B6PXTVHxz3VK27XdjVGFoC8N0NA0awJN0kRMKC55c6oWcl0UZUSN vMgJ/y2z6gZP8pD2rNKZauBMu1561WC/7Zb0Tb6VUF+TZqfGfw6R86o+n6TuzS50aOL5 c4StMbt6+zd5ENxs2SvVRFKUxL2aexVhslNxwoUSLTiaROYaE2d8ovZDlFF0NZ9/MCVu RixQ== 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=iVAezJUOtw7hicZc2BC6n0J1H4KFYdy7+AEzYJzxFMs=; b=YGhQns1VSZc//yctoULOkIh5htc7YWIl0tz9mkqzinLu4UuIaWa/7fqUrEhVrwQL31 Taj4wlFRAeBLfCGPFEXczim9h5FIb23535WTIi2nBK41Gb1LyXOaKE5QzcJviOe9H9Gf qDljVMXxeWDwdF6UyhEz/CZ+Lod+JfTtcvESa5SYAK4eF3WviB/J47tCR+lN7UErdNOy ZwFwwtPY1brV7uIdndP27Czug1m26xNxVx6vDQ8KqZYbCxb7L4PjpFXoBpXOYVBlA5ry emJ0KWnZFsI9kcr2x6GOeX4aOd0jZX3mFTQ7vTj6PLk1ARQaMKcQSp4if9jG4kHN4ZeS WpCw== X-Gm-Message-State: AOAM533xV/dTrCWSaJckUk0Apr21nCVeGhrKMBSe4tyx5VjVz5e5lEhd Q3GDGdsqHL83mCyT5l12QsDe0sf/43M= X-Google-Smtp-Source: ABdhPJxhytAGMYlhIAYU7bhrwi30EV0sFquOWhEmCsLkZn/kRx3c+yvwDASxxFWIN2rWAsdqlyeLMg== X-Received: by 2002:a05:620a:1794:: with SMTP id ay20mr1777579qkb.485.1642038741544; Wed, 12 Jan 2022 17:52:21 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id i21sm1204710qti.31.2022.01.12.17.52.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 17:52:21 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 22:49:40 -0300 Message-Id: <20220113015101.4-19-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 018/281] adxdec: 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: Anton Khirnov Signed-off-by: James Almer --- libavformat/adxdec.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c index d91d43d114..fa91080f41 100644 --- a/libavformat/adxdec.c +++ b/libavformat/adxdec.c @@ -56,12 +56,12 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt) if (avio_feof(s->pb)) return AVERROR_EOF; - if (par->channels <= 0) { - av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", par->channels); + if (par->ch_layout.nb_channels <= 0) { + av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", par->ch_layout.nb_channels); return AVERROR_INVALIDDATA; } - size = BLOCK_SIZE * par->channels; + size = BLOCK_SIZE * par->ch_layout.nb_channels; pkt->pos = avio_tell(s->pb); pkt->stream_index = 0; @@ -79,8 +79,8 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt) size = ret; } - pkt->duration = size / (BLOCK_SIZE * par->channels); - pkt->pts = (pkt->pos - c->header_size) / (BLOCK_SIZE * par->channels); + pkt->duration = size / (BLOCK_SIZE * par->ch_layout.nb_channels); + pkt->pts = (pkt->pos - c->header_size) / (BLOCK_SIZE * par->ch_layout.nb_channels); return 0; } @@ -90,6 +90,8 @@ static int adx_read_header(AVFormatContext *s) ADXDemuxerContext *c = s->priv_data; AVCodecParameters *par; int ret; + int channels; + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -107,11 +109,11 @@ static int adx_read_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Invalid extradata size.\n"); return AVERROR_INVALIDDATA; } - par->channels = AV_RB8 (par->extradata + 7); + channels = AV_RB8 (par->extradata + 7); par->sample_rate = AV_RB32(par->extradata + 8); - if (par->channels <= 0) { - av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", par->channels); + if (channels <= 0) { + av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", channels); return AVERROR_INVALIDDATA; } @@ -120,9 +122,11 @@ static int adx_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } + par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; + par->ch_layout.nb_channels = channels; par->codec_type = AVMEDIA_TYPE_AUDIO; par->codec_id = s->iformat->raw_codec_id; - par->bit_rate = (int64_t)par->sample_rate * par->channels * BLOCK_SIZE * 8LL / BLOCK_SAMPLES; + par->bit_rate = (int64_t)par->sample_rate * par->ch_layout.nb_channels * BLOCK_SIZE * 8LL / BLOCK_SAMPLES; avpriv_set_pts_info(st, 64, BLOCK_SAMPLES, par->sample_rate); -- 2.34.1 _______________________________________________ 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".