diff options
author | James Almer <jamrial@gmail.com> | 2019-09-21 19:57:11 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-09-27 10:37:11 -0300 |
commit | f96a8b015f2fa62b18a613ebdb3c26da50951652 (patch) | |
tree | 987a30dc2e3eeceaa605a29176ead08fa77f2c9e /libavcodec/mpeg4audio.c | |
parent | bb697f30ab28604c57f4ac396f31116fd765d4b8 (diff) | |
download | ffmpeg-f96a8b015f2fa62b18a613ebdb3c26da50951652.tar.gz |
avcodec/mpeg4audio: add avpriv_mpeg4audio_get_config2()
Identical to avpriv_mpeg4audio_get_config() except taking a size argument in
bytes, and featuring a new logging context paremeter.
Schedule avpriv_mpeg4audio_get_config() for removal as soon as major is bumped
as well.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/mpeg4audio.c')
-rw-r--r-- | libavcodec/mpeg4audio.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c index 219714752f..6962a42537 100644 --- a/libavcodec/mpeg4audio.c +++ b/libavcodec/mpeg4audio.c @@ -84,7 +84,7 @@ static inline int get_sample_rate(GetBitContext *gb, int *index) } int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, - int sync_extension) + int sync_extension, void *logctx) { int specific_config_bitindex, ret; int start_bit_index = get_bits_count(gb); @@ -152,6 +152,7 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, return specific_config_bitindex - start_bit_index; } +#if LIBAVCODEC_VERSION_MAJOR < 59 int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int bit_size, int sync_extension) { @@ -165,5 +166,22 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, if (ret < 0) return ret; - return ff_mpeg4audio_get_config_gb(c, &gb, sync_extension); + return ff_mpeg4audio_get_config_gb(c, &gb, sync_extension, NULL); +} +#endif + +int avpriv_mpeg4audio_get_config2(MPEG4AudioConfig *c, const uint8_t *buf, + int size, int sync_extension, void *logctx) +{ + GetBitContext gb; + int ret; + + if (size <= 0) + return AVERROR_INVALIDDATA; + + ret = init_get_bits8(&gb, buf, size); + if (ret < 0) + return ret; + + return ff_mpeg4audio_get_config_gb(c, &gb, sync_extension, logctx); } |