]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mlp_parser.c
vc1: skip motion compensation when data for last picture is invalid
[ffmpeg] / libavcodec / mlp_parser.c
index 45764e83f218c0b0c53f0013a00ac14d650d5b91..bff6258cbaf7027a67e690342a6a0cd957a01fa1 100644 (file)
@@ -120,7 +120,7 @@ static uint64_t truehd_layout(int chanmap)
     return layout;
 }
 
-static int ff_mlp_get_major_sync_size(const uint8_t * buf, int bufsize)
+static int mlp_get_major_sync_size(const uint8_t * buf, int bufsize)
 {
     int has_extension, extensions = 0;
     int size = 28;
@@ -150,7 +150,7 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, BitstreamContext *bc)
 
     assert(bitstream_tell(bc) == 0);
 
-    header_size = ff_mlp_get_major_sync_size(bc->buffer, bc->size_in_bits >> 3);
+    header_size = mlp_get_major_sync_size(bc->buffer, bc->size_in_bits >> 3);
     if (header_size < 0 || bc->size_in_bits < header_size << 3) {
         av_log(log, AV_LOG_ERROR, "packet too short, unable to read major sync\n");
         return -1;
@@ -332,7 +332,7 @@ static int mlp_parse(AVCodecParserContext *s,
         BitstreamContext bc;
         MLPHeaderInfo mh;
 
-        bitstream_init(&bc, buf + 4, (buf_size - 4) << 3);
+        bitstream_init8(&bc, buf + 4, buf_size - 4);
         if (ff_mlp_read_major_sync(avctx, &mh, &bc) < 0)
             goto lost_sync;
 
@@ -346,28 +346,11 @@ static int mlp_parse(AVCodecParserContext *s,
 
         if (mh.stream_type == 0xbb) {
             /* MLP stream */
-            if (avctx->request_channel_layout &&
-                (avctx->request_channel_layout & AV_CH_LAYOUT_STEREO) ==
-                avctx->request_channel_layout &&
-                mh.num_substreams > 1) {
-                avctx->channels       = 2;
-                avctx->channel_layout = AV_CH_LAYOUT_STEREO;
-            } else {
-                avctx->channels       = mh.channels_mlp;
-                avctx->channel_layout = mh.channel_layout_mlp;
-            }
+            avctx->channels       = mh.channels_mlp;
+            avctx->channel_layout = mh.channel_layout_mlp;
         } else { /* mh.stream_type == 0xba */
             /* TrueHD stream */
-                if (avctx->request_channel_layout &&
-                    (avctx->request_channel_layout & AV_CH_LAYOUT_STEREO) ==
-                    avctx->request_channel_layout &&
-                    mh.num_substreams > 1) {
-                avctx->channels       = 2;
-                avctx->channel_layout = AV_CH_LAYOUT_STEREO;
-            } else if (!mh.channels_thd_stream2 ||
-                       (avctx->request_channel_layout &&
-                        (avctx->request_channel_layout & mh.channel_layout_thd_stream1) ==
-                        avctx->request_channel_layout)) {
+            if (!mh.channels_thd_stream2) {
                 avctx->channels       = mh.channels_thd_stream1;
                 avctx->channel_layout = mh.channel_layout_thd_stream1;
             } else {