Merge commit '1f6e5dd4d4dd9c02371ad211049d27edb6d95286'
authorJames Almer <jamrial@gmail.com>
Mon, 30 Oct 2017 19:40:11 +0000 (16:40 -0300)
committerJames Almer <jamrial@gmail.com>
Mon, 30 Oct 2017 19:40:11 +0000 (16:40 -0300)
* commit '1f6e5dd4d4dd9c02371ad211049d27edb6d95286':
  mlp: Rename the channel layout variable

Merged-by: James Almer <jamrial@gmail.com>
1  2 
libavcodec/mlpdec.c

@@@ -383,41 -382,20 +383,41 @@@ static int read_major_sync(MLPDecodeCon
       * substream is Stereo. Subsequent substreams' layouts are indicated in the
       * major sync. */
      if (m->avctx->codec_id == AV_CODEC_ID_MLP) {
 +        if (mh.stream_type != 0xbb) {
 +            avpriv_request_sample(m->avctx,
 +                        "unexpected stream_type %X in MLP",
 +                        mh.stream_type);
 +            return AVERROR_PATCHWELCOME;
 +        }
          if ((substr = (mh.num_substreams > 1)))
-             m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
-         m->substream[substr].ch_layout = mh.channel_layout_mlp;
+             m->substream[0].mask = AV_CH_LAYOUT_STEREO;
+         m->substream[substr].mask = mh.channel_layout_mlp;
      } else {
 +        if (mh.stream_type != 0xba) {
 +            avpriv_request_sample(m->avctx,
 +                        "unexpected stream_type %X in !MLP",
 +                        mh.stream_type);
 +            return AVERROR_PATCHWELCOME;
 +        }
          if ((substr = (mh.num_substreams > 1)))
-             m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
+             m->substream[0].mask = AV_CH_LAYOUT_STEREO;
          if (mh.num_substreams > 2)
              if (mh.channel_layout_thd_stream2)
-                 m->substream[2].ch_layout = mh.channel_layout_thd_stream2;
+                 m->substream[2].mask = mh.channel_layout_thd_stream2;
              else
-                 m->substream[2].ch_layout = mh.channel_layout_thd_stream1;
-         m->substream[substr].ch_layout = mh.channel_layout_thd_stream1;
+                 m->substream[2].mask = mh.channel_layout_thd_stream1;
+         m->substream[substr].mask = mh.channel_layout_thd_stream1;
 +
-         if (m->avctx->channels<=2 && m->substream[substr].ch_layout == AV_CH_LAYOUT_MONO && m->max_decoded_substream == 1) {
++        if (m->avctx->channels<=2 && m->substream[substr].mask == AV_CH_LAYOUT_MONO && m->max_decoded_substream == 1) {
 +            av_log(m->avctx, AV_LOG_DEBUG, "Mono stream with 2 substreams, ignoring 2nd\n");
 +            m->max_decoded_substream = 0;
 +            if (m->avctx->channels==2)
 +                m->avctx->channel_layout = AV_CH_LAYOUT_STEREO;
 +        }
      }
  
 +    m->needs_reordering = mh.channel_arrangement >= 18 && mh.channel_arrangement <= 20;
 +
      /* Parse the TrueHD decoder channel modifiers and set each substream's
       * AVMatrixEncoding accordingly.
       *
@@@ -563,11 -541,11 +563,11 @@@ static int read_restart_header(MLPDecod
      memset(s->ch_assign, 0, sizeof(s->ch_assign));
  
      for (ch = 0; ch <= s->max_matrix_channel; ch++) {
 -        int ch_assign = bitstream_read(bc, 6);
 +        int ch_assign = get_bits(gbp, 6);
          if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD) {
-             uint64_t channel = thd_channel_layout_extract_channel(s->ch_layout,
+             uint64_t channel = thd_channel_layout_extract_channel(s->mask,
                                                                    ch_assign);
-             ch_assign = av_get_channel_layout_channel_index(s->ch_layout,
+             ch_assign = av_get_channel_layout_channel_index(s->mask,
                                                              channel);
          }
          if (ch_assign < 0 || ch_assign > s->max_matrix_channel) {