aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mlpdec.c
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2009-05-06 15:46:10 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2009-05-06 15:46:10 +0000
commite8d341ce19bf70914b2cc4a61c9e52d607904cd0 (patch)
tree7f1f9dc241707024b82ea2ede8e6336fe42013b2 /libavcodec/mlpdec.c
parentaff42ee0ff50d307c5eb0cc768645452194dea98 (diff)
downloadffmpeg-e8d341ce19bf70914b2cc4a61c9e52d607904cd0.tar.gz
mlpdec: Split sync word error and MLP sync word check.
The previous code would print the wrong error message for MLP streams with TrueHD noise type. Originally committed as revision 18762 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mlpdec.c')
-rw-r--r--libavcodec/mlpdec.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 491fb864c0..f1a3b3a348 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -344,15 +344,20 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
: MAX_MATRIX_CHANNEL_TRUEHD;
sync_word = get_bits(gbp, 13);
- s->noise_type = get_bits1(gbp);
- if ((m->avctx->codec_id == CODEC_ID_MLP && s->noise_type) ||
- sync_word != 0x31ea >> 1) {
+ if (sync_word != 0x31ea >> 1) {
av_log(m->avctx, AV_LOG_ERROR,
"restart header sync incorrect (got 0x%04x)\n", sync_word);
return -1;
}
+ s->noise_type = get_bits1(gbp);
+
+ if (m->avctx->codec_id == CODEC_ID_MLP && s->noise_type) {
+ av_log(m->avctx, AV_LOG_ERROR, "MLP must have 0x31ea sync word.\n");
+ return -1;
+ }
+
skip_bits(gbp, 16); /* Output timestamp */
s->min_channel = get_bits(gbp, 4);