From patchwork Thu Jun 30 06:42:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 36539 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8b27:b0:88:1bbf:7fd2 with SMTP id l39csp106616pzh; Wed, 29 Jun 2022 23:43:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uClMp0a3FxKoAra3ac/EhRLJRaBRq7aD9M3TLKNLtCJBaByO3BiatjtoP4mEpfrPmW17t5 X-Received: by 2002:a17:907:2081:b0:726:b8d2:fba2 with SMTP id pv1-20020a170907208100b00726b8d2fba2mr6925272ejb.686.1656571387883; Wed, 29 Jun 2022 23:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656571387; cv=none; d=google.com; s=arc-20160816; b=nIbmdD7jtCBEQUX/NQ86xB0TiCG+mt3T7Av8vo7rI7UHQAWWOp6BEetlq3xQ+qMLlH xRYjirI6+7v5H1xgcWbTFc/f2rdgBudDyJqFBDtMfLNLXrb4ZthJoMHk97p+ZFn5pyKw 2aRuXRswtxlqgSPakXadyIdlbzT/Up43hBXY0azbd6tJh0Tdcj65GMNB/5U5OpznF0KP amQJxOqRnX3Q8DIYkbei8iINrrEolP2NWk+EeW2OeciCjapBJbJjyE8ok+fbL0mVya3J 0TFgf7gPiyNwU5+16BnyvW7G+e3Z7PZ5KOhKDpXSAKGjG2pN0Ikr4rzI9ZFklbRJ8IXV lHTA== 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=QOoD4b/jkBiUloSWByGSliK31zahOr7hkC7igUGzBBM=; b=Ir1kL4CQhf9cdgrvdndlvGhw9sooaQY6cWEHBajsT7czJ+nyt+nVQHn5hobdfgp7i0 kYjn0L5GPVzjpgsKN8vXmrDdCeZi9RbTqhDwGBKJK8eoJIdMBiQ/K4P3zM9iu7tQyy6q ZMHJLduUfvmpo/exHOJVnrjyX4yvO9IlL2SsZyi6mN96HjQaHsrN8HvhIheLk34OXlI2 NmL9hmkP3LrSNNCgCcVFf/wuNOceN1P390yofnibCY+EHNg1oeuWy82IVBDaK1xSsQz8 mpIQ8V7+eub9TehW91h3AuTVopPcjTGJhHKHmNsWoneeZbRryOzqBL7hPLMRC4FAI3LI /FMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="NZkvuB/T"; 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 y7-20020aa7ccc7000000b0043573246900si9994882edt.497.2022.06.29.23.43.07; Wed, 29 Jun 2022 23:43:07 -0700 (PDT) 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="NZkvuB/T"; 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 DCB2068B793; Thu, 30 Jun 2022 09:42:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BAC6D68B741 for ; Thu, 30 Jun 2022 09:42:46 +0300 (EEST) Received: by mail-lf1-f48.google.com with SMTP id i18so31992554lfu.8 for ; Wed, 29 Jun 2022 23:42:46 -0700 (PDT) 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=IqYfklNB6BtvdJcz5NOcaL2adzJAd/4JLQhZlt53TYo=; b=NZkvuB/TUp8kgDjbIfbSdEKfKeX01UIOvD9VcX/9t9EYyFTWySkp/vfWqUDMzth2ek Z8p72JLjDJdZWKZKlpvxwHHF+ZrqJxVhnWaKtqNSf0xsnr5MytcK9NwEnx6IAs8Z4Bp9 Nk7NLWwWEbagabg1QgfWjFP+Sl5Thc2XG36oN2eM0/9zDZyK3fmu7F3QllpVyskSrgFG QUZio1O1qjeQ0/BHYM9V/wfAcXXCRJJmABqhnbkxTGOPnhesLVBcnvkYnq73GLPN35IR mpOf6X7HUV6eh4Ihnow2WtZtGtC1+JpjSlIh8x5DjGVghrisFp7VLs0JRtdR97InAK+v x0Kg== 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=IqYfklNB6BtvdJcz5NOcaL2adzJAd/4JLQhZlt53TYo=; b=D8jMTrToDrA5ePTxVSfe8F4LtczNXdY7s55Doqk/pFm+FsWh5c3jfMeP6iZ+MT4CYB FSQJozpt4o73p7xhwmnLASd7vapm2Gi1OuJ7z2w/TIU2+VaJkvDIrMkUueBGNsLCP87z CioT9GrsN7nS6u7p91XTBiruwZJSc5NXdxPAJ0KFUvT9OEH3nbGuOAixr7vocDEWkhXo p/c3VLrfNVeFfwY6e4avJwYDcQ1Sk2rNfTMg68Qb+WpM4zdNPWaRKHv23JEaVlgZZF9B O+/+s2CV0mnZvlMSKKcTufYVqhP/pB+z+eI8qOUuNAMFR+6vHSQgguvIh8VhTtFq/jqD tMWw== X-Gm-Message-State: AJIora+p6rI/Jl+SCtde3OWMnUG+8R/Z+FY7rAxULBbRBmjC2Kk6en53 pmwhq21hLm6b2/bMzcpv/wTtaKsYmWk= X-Received: by 2002:a05:6512:3183:b0:47f:79f3:af9a with SMTP id i3-20020a056512318300b0047f79f3af9amr4342319lfe.182.1656571366065; Wed, 29 Jun 2022 23:42:46 -0700 (PDT) Received: from localhost.localdomain (91-153-198-187.elisa-laajakaista.fi. [91.153.198.187]) by smtp.gmail.com with ESMTPSA id c17-20020a056512075100b00479112bb555sm2948091lfs.60.2022.06.29.23.42.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 23:42:45 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Jun 2022 09:42:32 +0300 Message-Id: <20220630064238.45315-2-jeebjp@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220630064238.45315-1-jeebjp@gmail.com> References: <20220630064238.45315-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 1/7] avcodec/ac3_parser{, _internal}: expose AC-3 bit_rate_code 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: jxFbXdqx6vmY From: Jan Ekström Required by MP4's AC3SpecificBox and MPEG-TS AC-3 audio_descriptor, of which the former is implemented in our MP4 writer. Signed-off-by: Jan Ekström --- libavcodec/ac3_parser.c | 5 ++++- libavcodec/ac3_parser_internal.h | 1 + libavcodec/version.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c index 119b1598c5..4f154bb7c4 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -70,6 +70,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) return AAC_AC3_PARSE_ERROR_BSID; hdr->num_blocks = 6; + hdr->ac3_bit_rate_code = -1; /* set default mix levels */ hdr->center_mix_level = 5; // -4.5dB @@ -89,6 +90,8 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) if(frame_size_code > 37) return AAC_AC3_PARSE_ERROR_FRAME_SIZE; + hdr->ac3_bit_rate_code = (frame_size_code >> 1); + skip_bits(gbc, 5); // skip bsid, already got it hdr->bitstream_mode = get_bits(gbc, 3); @@ -106,7 +109,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8; hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift; - hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift; + hdr->bit_rate = (ff_ac3_bitrate_tab[hdr->ac3_bit_rate_code] * 1000) >> hdr->sr_shift; hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on; hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2; hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; //EAC3_FRAME_TYPE_INDEPENDENT; diff --git a/libavcodec/ac3_parser_internal.h b/libavcodec/ac3_parser_internal.h index dd57dc95a6..bd4e1bbffb 100644 --- a/libavcodec/ac3_parser_internal.h +++ b/libavcodec/ac3_parser_internal.h @@ -60,6 +60,7 @@ typedef struct AC3HeaderInfo { uint8_t channels; uint16_t frame_size; uint64_t channel_layout; + int8_t ac3_bit_rate_code; /** @} */ } AC3HeaderInfo; diff --git a/libavcodec/version.h b/libavcodec/version.h index 0ef6c991f3..1008fead27 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 34 +#define LIBAVCODEC_VERSION_MINOR 35 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \