diff mbox

[FFmpeg-devel,2/3] avcodec/mpeg4audio: make the size parameter in avpriv_mpeg4audio_get_config() take bytes instead of bits

Message ID 20190921155253.1004-2-jamrial@gmail.com
State New
Headers show

Commit Message

James Almer Sept. 21, 2019, 3:52 p.m. UTC
This is an ABI change, so it's scheduled for the next bump.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 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 mbox

Patch

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