]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mlp_parser.c
Rename ff_parse_eval() to ff_eval_expr().
[ffmpeg] / libavcodec / mlp_parser.c
index 191433376a5a801be3f0df99f43807c58c4b57e2..716e9e9b2a1da77bb2105a065f0550346a7b225a 100644 (file)
  */
 
 /**
- * @file mlp_parser.c
+ * @file libavcodec/mlp_parser.c
  * MLP parser
  */
 
 #include <stdint.h>
 
 #include "libavutil/crc.h"
-#include "bitstream.h"
+#include "get_bits.h"
 #include "parser.h"
 #include "mlp_parser.h"
 #include "mlp.h"
@@ -176,7 +176,9 @@ static int mlp_parse(AVCodecParserContext *s,
 
         for (i = 0; i < buf_size; i++) {
             mp->pc.state = (mp->pc.state << 8) | buf[i];
-            if ((mp->pc.state & 0xfffffffe) == 0xf8726fba) {
+            if ((mp->pc.state & 0xfffffffe) == 0xf8726fba &&
+                // ignore if we do not have the data for the start of header
+                mp->pc.index + i >= 7) {
                 mp->in_sync = 1;
                 mp->bytes_left = 0;
                 break;
@@ -251,11 +253,11 @@ static int mlp_parse(AVCodecParserContext *s,
         if (ff_mlp_read_major_sync(avctx, &mh, &gb) < 0)
             goto lost_sync;
 
-#ifdef CONFIG_AUDIO_NONSHORT
-        avctx->bits_per_sample = mh.group1_bits;
-        if (avctx->bits_per_sample > 16)
+        avctx->bits_per_raw_sample = mh.group1_bits;
+        if (avctx->bits_per_raw_sample > 16)
             avctx->sample_fmt = SAMPLE_FMT_S32;
-#endif
+        else
+            avctx->sample_fmt = SAMPLE_FMT_S16;
         avctx->sample_rate = mh.group1_samplerate;
         avctx->frame_size = mh.access_unit_size;
 
@@ -287,9 +289,9 @@ lost_sync:
 }
 
 AVCodecParser mlp_parser = {
-    { CODEC_ID_MLP },
+    { CODEC_ID_MLP, CODEC_ID_TRUEHD },
     sizeof(MLPParseContext),
     mlp_init,
     mlp_parse,
-    NULL,
+    ff_parse_close,
 };