From patchwork Sat Sep 21 15:52:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 15211 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 9C71B441489 for ; Sat, 21 Sep 2019 18:53:21 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7B31E68A98D; Sat, 21 Sep 2019 18:53:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 840C868A661 for ; Sat, 21 Sep 2019 18:53:14 +0300 (EEST) Received: by mail-qk1-f194.google.com with SMTP id u22so7104016qkk.11 for ; Sat, 21 Sep 2019 08:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=xJFYnC6BPbL0impVoSEAoFj8uEVvFc5AgZwBOumV7to=; b=jbRsWx5AlHl1hRPvTunj4AAQ6Hb9/H0GW5pma6qWfBh7EHwqMutGvSVKVTDocNKszo mU4CegfUhMheXpNqTApZw4BYY5NLHcNMY9kKONE/ieOU453mkNx+QV47r5sHMg+qHosF 4OdKB1y5gYawYNCOJ0AtSAoxAEdZgf1MSSN1DRMsmaUDqObXbS8SSG82Zq31BQtOTlqp U6x5WvmFMDZ2QkmEr6nrtTeVUz4wis+h3a9EV1I0B8NUKV+g+hc0/AVkrAbgWQXmcTd7 swh63iJpiOg58wwqRcZPWlE53IIFZ82sg/mbBVK/dFE5fN1lbLewnNJKAu9lnd8gX2Y8 baiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xJFYnC6BPbL0impVoSEAoFj8uEVvFc5AgZwBOumV7to=; b=cIOIDyz3a7rFBgJu3BxG9Pg+FST05OFRnDeSht8Opl5CIizw9wAOyx4RvrIXEaJzmn dW4hM2OqYdJ/25AtSfkGG/pefSxmCcK6gQGOwOmXLVRzmu1Gvo3HJs2W9hTdj56i63qk MRgmBGDeO2Ol1Nkz+aF1MD6ukpgYnTT7k+B6R+txrFo8N2+ZMRA1UU7pfqehG9Uo0ZEY Mblk3QRihkdf+ooPCzdmPa3auMF9NZ1gDS59W4vvc01wuMMTlNgPjD3tdYAmKTzTmkcQ x3sRpcLwmtDbq7X/XIHTA2y4p8+7uoFLRqaYx81JEl0vOYKufQc3YbKvMMIOnORt1z4o y7QQ== X-Gm-Message-State: APjAAAWLzhN8NG5747SeqIxQ1AdaHN6AbFouu2cvpSguf4DTmrDKj68M B4BhVMoAMDg9DM1aZjbwU7dN0M+J X-Google-Smtp-Source: APXvYqxmsz0jqG57C7WAHIjS0uPGDruS8wC87iSPItBUs7saSKHa+Lz2kmAdROPpprG0scr0DQ8+sA== X-Received: by 2002:a37:a310:: with SMTP id m16mr9042246qke.123.1569081193050; Sat, 21 Sep 2019 08:53:13 -0700 (PDT) Received: from localhost.localdomain ([191.83.209.38]) by smtp.gmail.com with ESMTPSA id 56sm4269650qty.15.2019.09.21.08.53.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Sep 2019 08:53:12 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 21 Sep 2019 12:52:52 -0300 Message-Id: <20190921155253.1004-2-jamrial@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190921155253.1004-1-jamrial@gmail.com> References: <20190921155253.1004-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/mpeg4audio: make the size parameter in avpriv_mpeg4audio_get_config() take bytes instead of bits 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" This is an ABI change, so it's scheduled for the next bump. Signed-off-by: James Almer --- libavcodec/alsdec.c | 2 +- libavcodec/mpeg4audio.c | 12 ++++++++---- libavcodec/mpeg4audio.h | 2 +- libavcodec/mpegaudiodec_template.c | 2 +- libavformat/adtsenc.c | 2 +- libavformat/isom.c | 2 +- libavformat/latmenc.c | 2 +- libavformat/matroskaenc.c | 2 +- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 767d1be7d3..6b4f3555c0 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -306,7 +306,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx) #if LIBAVCODEC_VERSION_MAJOR < 59 avctx->extradata_size * 8, 1); #else - avctx->extradata_size * 8, 1, avctx); + avctx->extradata_size, 1, avctx); #endif if (config_offset < 0) diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c index 43c19c4188..b2c8baf815 100644 --- a/libavcodec/mpeg4audio.c +++ b/libavcodec/mpeg4audio.c @@ -154,21 +154,25 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, #if LIBAVCODEC_VERSION_MAJOR < 59 int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, - int bit_size, int sync_extension) + int size, int sync_extension) { void *logctx = NULL; #else int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, - int bit_size, int sync_extension, void *logctx) + int size, int sync_extension, void *logctx) { #endif GetBitContext gb; int ret; - if (bit_size <= 0) + if (size <= 0) return AVERROR_INVALIDDATA; - ret = init_get_bits(&gb, buf, bit_size); +#if LIBAVCODEC_VERSION_MAJOR < 59 + ret = init_get_bits(&gb, buf, size); +#else + ret = init_get_bits8(&gb, buf, size); +#endif if (ret < 0) return ret; diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h index ee6c8da233..79ab352ce2 100644 --- a/libavcodec/mpeg4audio.h +++ b/libavcodec/mpeg4audio.h @@ -72,7 +72,7 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, #if LIBAVCODEC_VERSION_MAJOR < 59 int bit_size, int sync_extension); #else - int bit_size, int sync_extension, void *logctx); + int size, int sync_extension, void *logctx); #endif enum AudioObjectType { diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c index a89d7e408f..c35c1ee216 100644 --- a/libavcodec/mpegaudiodec_template.c +++ b/libavcodec/mpegaudiodec_template.c @@ -1855,7 +1855,7 @@ static av_cold int decode_init_mp3on4(AVCodecContext * avctx) #if LIBAVCODEC_VERSION_MAJOR < 59 avctx->extradata_size * 8, 1); #else - avctx->extradata_size * 8, 1, avctx); + avctx->extradata_size, 1, avctx); #endif if (!cfg.chan_config || cfg.chan_config > 7) { av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n"); diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 48871efe1a..d63fad8e76 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -56,7 +56,7 @@ static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, const ui #if LIBAVCODEC_VERSION_MAJOR < 59 off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1); #else - off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1, s); + off = avpriv_mpeg4audio_get_config(&m4ac, buf, size, 1, s); #endif if (off < 0) return off; diff --git a/libavformat/isom.c b/libavformat/isom.c index 6d5e9b56d0..6e28407f8f 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -551,7 +551,7 @@ FF_ENABLE_DEPRECATION_WARNINGS #if LIBAVCODEC_VERSION_MAJOR < 59 st->codecpar->extradata_size * 8, 1); #else - st->codecpar->extradata_size * 8, 1, fc); + st->codecpar->extradata_size, 1, fc); #endif if (ret < 0) return ret; diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c index d33e39074c..74030d8b3c 100644 --- a/libavformat/latmenc.c +++ b/libavformat/latmenc.c @@ -65,7 +65,7 @@ static int latm_decode_extradata(AVFormatContext *s, uint8_t *buf, int size) #if LIBAVCODEC_VERSION_MAJOR < 59 ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1); #else - ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1, s); + ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size, 1, s); #endif if (ctx->off < 0) return ctx->off; diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 475578c6ba..fae82a5c60 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -721,7 +721,7 @@ static int get_aac_sample_rates(AVFormatContext *s, uint8_t *extradata, int extr #if LIBAVCODEC_VERSION_MAJOR < 59 extradata_size * 8, 1); #else - extradata_size * 8, 1, s); + extradata_size, 1, s); #endif /* Don't abort if the failure is because of missing extradata. Assume in that * case a bitstream filter will provide the muxer with the extradata in the