From patchwork Fri Dec 6 10:17:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 16620 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 3C5B944ABC2 for ; Fri, 6 Dec 2019 12:19:06 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2319E68B660; Fri, 6 Dec 2019 12:19:06 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BA15568B659 for ; Fri, 6 Dec 2019 12:18:58 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 5E4DA2945BB for ; Fri, 6 Dec 2019 11:18:58 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 5gf6FpiqJY0K for ; Fri, 6 Dec 2019 11:18:58 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2002:b061:f0a:201:5e:e696:5100:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 651082945B4 for ; Fri, 6 Dec 2019 11:18:55 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id CA2047F9AA for ; Fri, 6 Dec 2019 11:18:52 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id YTVkLozKWkkv for ; Fri, 6 Dec 2019 11:18:51 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 556237F936 for ; Fri, 6 Dec 2019 11:18:45 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id C8A7320E0151; Fri, 6 Dec 2019 11:17:48 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 6 Dec 2019 11:17:02 +0100 Message-Id: <20191206101710.22028-8-anton@khirnov.net> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191206101710.22028-1-anton@khirnov.net> References: <20191206101710.22028-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 008/244] 3dostr: convert to new channel layout API 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/3dostr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavformat/3dostr.c b/libavformat/3dostr.c index 6c49f7589c..bfa52c0da5 100644 --- a/libavformat/3dostr.c +++ b/libavformat/3dostr.c @@ -63,15 +63,16 @@ static int threedostr_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->sample_rate = avio_rb32(s->pb); - st->codecpar->channels = avio_rb32(s->pb); - if (st->codecpar->channels <= 0) + st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; + st->codecpar->ch_layout.nb_channels = avio_rb32(s->pb); + if (st->codecpar->ch_layout.nb_channels <= 0) return AVERROR_INVALIDDATA; codec = avio_rl32(s->pb); avio_skip(s->pb, 4); if (ctrl_size == 20 || ctrl_size == 3 || ctrl_size == -1) - st->duration = (avio_rb32(s->pb) - 1) / st->codecpar->channels; + st->duration = (avio_rb32(s->pb) - 1) / st->codecpar->ch_layout.nb_channels; else - st->duration = avio_rb32(s->pb) * 16 / st->codecpar->channels; + st->duration = avio_rb32(s->pb) * 16 / st->codecpar->ch_layout.nb_channels; size -= 56; found_shdr = 1; break; @@ -96,7 +97,7 @@ static int threedostr_read_header(AVFormatContext *s) switch (codec) { case MKTAG('S','D','X','2'): st->codecpar->codec_id = AV_CODEC_ID_SDX2_DPCM; - st->codecpar->block_align = 1 * st->codecpar->channels; + st->codecpar->block_align = 1 * st->codecpar->ch_layout.nb_channels; break; default: avpriv_request_sample(s, "codec %X", codec); @@ -142,7 +143,7 @@ static int threedostr_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(s->pb, pkt, size); pkt->pos = pos; pkt->stream_index = 0; - pkt->duration = size / st->codecpar->channels; + pkt->duration = size / st->codecpar->ch_layout.nb_channels; size = 0; found_ssmp = 1; break;