diff options
author | James Almer <jamrial@gmail.com> | 2017-10-22 20:29:53 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-10-26 00:26:08 -0300 |
commit | 6bd665b7c5798803366b877903fa3bce7f129d05 (patch) | |
tree | 599450b1996076a58c703e17167c696ba3482d8b /libavcodec/tak.c | |
parent | 984b882b769cab6372454cf8d5cda7c554c5ee77 (diff) | |
download | ffmpeg-6bd665b7c5798803366b877903fa3bce7f129d05.tar.gz |
avcodec/tak: remove GetBitContext usage from avpriv_tak_parse_streaminfo()
This prevents potential ABI issues with GetBitContext.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/tak.c')
-rw-r--r-- | libavcodec/tak.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libavcodec/tak.c b/libavcodec/tak.c index d2670e00ff..8aa956b661 100644 --- a/libavcodec/tak.c +++ b/libavcodec/tak.c @@ -90,7 +90,7 @@ int ff_tak_check_crc(const uint8_t *buf, unsigned int buf_size) return 0; } -void avpriv_tak_parse_streaminfo(GetBitContext *gb, TAKStreamInfo *s) +void ff_tak_parse_streaminfo(TAKStreamInfo *s, GetBitContext *gb) { uint64_t channel_mask = 0; int frame_type, i; @@ -125,6 +125,19 @@ void avpriv_tak_parse_streaminfo(GetBitContext *gb, TAKStreamInfo *s) s->frame_samples = tak_get_nb_samples(s->sample_rate, frame_type); } +int avpriv_tak_parse_streaminfo(TAKStreamInfo *s, const uint8_t *buf, int size) +{ + GetBitContext gb; + int ret = init_get_bits8(&gb, buf, size); + + if (ret < 0) + return AVERROR_INVALIDDATA; + + ff_tak_parse_streaminfo(s, &gb); + + return 0; +} + int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, TAKStreamInfo *ti, int log_level_offset) { @@ -144,7 +157,7 @@ int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, } if (ti->flags & TAK_FRAME_FLAG_HAS_INFO) { - avpriv_tak_parse_streaminfo(gb, ti); + ff_tak_parse_streaminfo(ti, gb); if (get_bits(gb, 6)) skip_bits(gb, 25); |