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 482F442D6E for ; Thu, 13 Jan 2022 02:10:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1EE0668B21F; Thu, 13 Jan 2022 03:53:48 +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 676A668B20A for ; Thu, 13 Jan 2022 03:53:45 +0200 (EET) Received: by mail-qk1-f182.google.com with SMTP id z10so1203704qkf.7 for ; Wed, 12 Jan 2022 17:53:45 -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=DhOVrKla3kszH/aOpCy49UyB1KPEff18uNGXqmvAkqQ=; b=Sd5zqyQ7vhWH9tnDD4bEODVSboll42xTXm86ZzhCXnxKJONkkMNFfkseJha54Wwt2M Q/UtJxuuuhxzHjWclr3YZXF8cKut/BgBsEt2QaTrASH5omhjpaq9HsratBT01JvhOd6k gE4EBbt/XrCLeKiowKe8xI/M1ZukVT9FqlcOPLnyi46U171VqsYEGx7yUZFP8WtnAp2G 5f5F4E5pDW1c/7toQ+qgssuas9E1vzgEPChWl+hwRsf3ttGfM8yoJFkUldMYlLdptf+z 9Dh4ApH2Co0z53j/tTYEMrMVovhVSySXhRhs3FPUu4yZlY/rDLYHvr1zGGeyaL6jhkwf K6dA== 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=DhOVrKla3kszH/aOpCy49UyB1KPEff18uNGXqmvAkqQ=; b=WHjreWGZ+cgxq2mmzTuGvXNmWfaW8zXw/vggAjU8fKPw03toB4fz8uVeQLPjsMknM4 B9310Gcm/h5UnGrHpFVL0nRF//45HqiOjSsCfquWF3JgXk4C7YJqrXDuoWHKFPGhAaWD FKKGJGWn+UbZipnjveN9kFLeDVoutOYwTpuN2xJpvpVX8jY7j9o27GIjruULV5SpH6I1 WwhyxSmXBuSxR/gguTVqxAG3dtaMLU2LCDLqi5zu1mo1wJtLm7DTcpe4muULhsHMZgGs oTYdWE1G7kv4zkFQuVggG47e8bqw4ezN3X12nrAyx268+p8Yvp3wWhUy6xccC+H2nhNp CnJQ== X-Gm-Message-State: AOAM532gB+pGz+Ezls8aaeRLqNKhAvlQKK6gwYcmOWMtwSGnllVYnIdm NeLNtKgsZx0b/wcdquAKh5rXAfsU3T0= X-Google-Smtp-Source: ABdhPJwHa/GkY+1QmXyFJt7YaAuHETQHOg4dek5MUql0McxnU2xLDlGtzLkNETO7QvVRSsy2CfWfvA== X-Received: by 2002:ae9:ee08:: with SMTP id i8mr1836447qkg.73.1642038824008; Wed, 12 Jan 2022 17:53:44 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id i21sm1204710qti.31.2022.01.12.17.53.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 17:53:43 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 22:50:48 -0300 Message-Id: <20220113015101.4-87-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 086/281] kvag: 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: Signed-off-by: James Almer --- libavformat/kvag.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/libavformat/kvag.c b/libavformat/kvag.c index a277c28128..5cb856cf07 100644 --- a/libavformat/kvag.c +++ b/libavformat/kvag.c @@ -71,18 +71,11 @@ static int kvag_read_header(AVFormatContext *s) par->codec_id = AV_CODEC_ID_ADPCM_IMA_SSI; par->format = AV_SAMPLE_FMT_S16; - if (hdr.stereo) { - par->channel_layout = AV_CH_LAYOUT_STEREO; - par->channels = 2; - } else { - par->channel_layout = AV_CH_LAYOUT_MONO; - par->channels = 1; - } - + av_channel_layout_default(&par->ch_layout, !!hdr.stereo + 1); par->sample_rate = hdr.sample_rate; par->bits_per_coded_sample = 4; par->block_align = 1; - par->bit_rate = par->channels * + par->bit_rate = par->ch_layout.nb_channels * (uint64_t)par->sample_rate * par->bits_per_coded_sample; @@ -90,7 +83,7 @@ static int kvag_read_header(AVFormatContext *s) st->start_time = 0; st->duration = hdr.data_size * (8 / par->bits_per_coded_sample) / - par->channels; + par->ch_layout.nb_channels; return 0; } @@ -105,7 +98,7 @@ static int kvag_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->flags &= ~AV_PKT_FLAG_CORRUPT; pkt->stream_index = 0; - pkt->duration = ret * (8 / par->bits_per_coded_sample) / par->channels; + pkt->duration = ret * (8 / par->bits_per_coded_sample) / par->ch_layout.nb_channels; return 0; } @@ -147,7 +140,7 @@ static int kvag_write_init(AVFormatContext *s) return AVERROR(EINVAL); } - if (par->channels > 2) { + if (par->ch_layout.nb_channels > 2) { av_log(s, AV_LOG_ERROR, "KVAG files only support up to 2 channels\n"); return AVERROR(EINVAL); } @@ -168,7 +161,7 @@ static int kvag_write_header(AVFormatContext *s) AV_WL32(buf + 0, KVAG_TAG); AV_WL32(buf + 4, 0); /* Data size, we fix this up later. */ AV_WL32(buf + 8, par->sample_rate); - AV_WL16(buf + 12, par->channels == 2); + AV_WL16(buf + 12, par->ch_layout.nb_channels == 2); avio_write(s->pb, buf, sizeof(buf)); return 0; -- 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".