]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mlpdec.c
Support the new lossless mode.
[ffmpeg] / libavcodec / mlpdec.c
index 421abdece1312d421c8710bb60b12de10e2e512a..d3c9c2bdd7a9efe27a39be4d5181b3c62bf8362e 100644 (file)
@@ -222,7 +222,7 @@ static av_cold int mlp_decode_init(AVCodecContext *avctx)
     m->avctx = avctx;
     for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
         m->substream[substr].lossless_check_data = 0xffffffff;
-    avctx->sample_fmt = SAMPLE_FMT_S16;
+
     return 0;
 }
 
@@ -296,12 +296,11 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
     m->avctx->sample_rate    = mh.group1_samplerate;
     m->avctx->frame_size     = mh.access_unit_size;
 
-#ifdef CONFIG_AUDIO_NONSHORT
-    m->avctx->bits_per_sample = mh.group1_bits;
-    if (mh.group1_bits > 16) {
+    m->avctx->bits_per_raw_sample = mh.group1_bits;
+    if (mh.group1_bits > 16)
         m->avctx->sample_fmt = SAMPLE_FMT_S32;
-    }
-#endif
+    else
+        m->avctx->sample_fmt = SAMPLE_FMT_S16;
 
     m->params_valid = 1;
     for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
@@ -990,7 +989,7 @@ static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size,
 
         skip_bits(&gb, (-get_bits_count(&gb)) & 15);
         if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32 &&
-            (show_bits_long(&gb, 32) == 0xd234d234 ||
+            (show_bits_long(&gb, 32) == END_OF_STREAM ||
              show_bits_long(&gb, 20) == 0xd234e)) {
             skip_bits(&gb, 18);
             if (substr == m->max_decoded_substream)