changeset 9613:56f0a4054770 libavcodec

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.
author ramiro
date Wed, 06 May 2009 15:46:10 +0000
parents de33a215fd84
children 2d9e7d5cd89b
files mlpdec.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mlpdec.c	Wed May 06 15:37:25 2009 +0000
+++ b/mlpdec.c	Wed May 06 15:46:10 2009 +0000
@@ -344,12 +344,17 @@
                                  : MAX_MATRIX_CHANNEL_TRUEHD;
 
     sync_word = get_bits(gbp, 13);
+
+    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) ||
-        sync_word != 0x31ea >> 1) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "restart header sync incorrect (got 0x%04x)\n", sync_word);
+    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;
     }