diff options
author | Anton Khirnov <anton@khirnov.net> | 2017-03-30 16:56:28 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2017-04-12 15:39:00 +0200 |
commit | 50a1c66cf6ab7eb683daaa9e2da3869fa3a54609 (patch) | |
tree | 4c967343ff0b2f0e6d61eb22b8782138c937bf8f /libavformat/ac3dec.c | |
parent | 193b09189004ede4a6998e69192d1a9f63602088 (diff) | |
download | ffmpeg-50a1c66cf6ab7eb683daaa9e2da3869fa3a54609.tar.gz |
ac3_parser: add a public function for parsing the data required by the demuxer
Make the current semi-public avpriv_ac3_parse_header() private to lavc.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavformat/ac3dec.c')
-rw-r--r-- | libavformat/ac3dec.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/libavformat/ac3dec.c b/libavformat/ac3dec.c index 4ceffa54dd..7a868056c7 100644 --- a/libavformat/ac3dec.c +++ b/libavformat/ac3dec.c @@ -28,8 +28,6 @@ static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID expected_codec_id) { int max_frames, first_frames = 0, frames; uint8_t *buf, *buf2, *end; - AC3HeaderInfo hdr; - GetBitContext gbc; enum AVCodecID codec_id = AV_CODEC_ID_AC3; max_frames = 0; @@ -40,15 +38,20 @@ static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID expected_codec_id) buf2 = buf; for(frames = 0; buf2 < end; frames++) { - init_get_bits(&gbc, buf2, 54); - if(avpriv_ac3_parse_header(&gbc, &hdr) < 0) + uint8_t bitstream_id; + uint16_t frame_size; + int ret; + + ret = av_ac3_parse_header(buf2, end - buf2, &bitstream_id, + &frame_size); + if (ret < 0) break; - if(buf2 + hdr.frame_size > end || - av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2)) + if (buf2 + frame_size > end || + av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, frame_size - 2)) break; - if (hdr.bitstream_id > 10) + if (bitstream_id > 10) codec_id = AV_CODEC_ID_EAC3; - buf2 += hdr.frame_size; + buf2 += frame_size; } max_frames = FFMAX(max_frames, frames); if(buf == p->buf) |