diff options
author | Ramiro Polla <ramiro.polla@gmail.com> | 2009-03-30 03:34:15 +0000 |
---|---|---|
committer | Ramiro Polla <ramiro.polla@gmail.com> | 2009-03-30 03:34:15 +0000 |
commit | 7b18e13a7c158a1bf50bcbeb363ecb0fe38cd5be (patch) | |
tree | 3c728a83366026df8cc1a7e19151398909de7946 /libavcodec/mlpdec.c | |
parent | 125cf771f6d17b9b9db7588cbf8f36619bc41f35 (diff) | |
download | ffmpeg-7b18e13a7c158a1bf50bcbeb363ecb0fe38cd5be.tar.gz |
mlpdec: Cleaner and better termination word check.
Originally committed as revision 18236 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mlpdec.c')
-rw-r--r-- | libavcodec/mlpdec.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index ff725e43d9..3be27b40f8 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -1021,19 +1021,20 @@ static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size, && get_bits1(&gb) == 0); skip_bits(&gb, (-get_bits_count(&gb)) & 15); - if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32 && - (show_bits_long(&gb, 32) == END_OF_STREAM || - show_bits_long(&gb, 20) == 0xd234e)) { - skip_bits(&gb, 18); + if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32) { + int shorten_by; + + if (get_bits(&gb, 16) != 0xD234) + return -1; + + shorten_by = get_bits(&gb, 16); + if (m->avctx->codec_id == CODEC_ID_TRUEHD && shorten_by & 0x2000) + s->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos); + else if (m->avctx->codec_id == CODEC_ID_MLP && shorten_by != 0xD234) + return -1; + if (substr == m->max_decoded_substream) av_log(m->avctx, AV_LOG_INFO, "End of stream indicated.\n"); - - if (get_bits1(&gb)) { - int shorten_by = get_bits(&gb, 13); - shorten_by = FFMIN(shorten_by, s->blockpos); - s->blockpos -= shorten_by; - } else - skip_bits(&gb, 13); } if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 16 && substream_parity_present[substr]) { |