diff options
author | Tim Walker <tdskywalker@gmail.com> | 2012-12-31 18:33:23 +0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2013-01-23 01:10:02 +0400 |
commit | 99ccd2ba10eac2b282c272ad9e75f082123c765a (patch) | |
tree | 83a1ad8f47fdbc3bf7b6be9f951e6524573de7a7 /libavcodec/mlpdec.c | |
parent | 73b704ac609d83e0be124589f24efd9b94947cf9 (diff) |
mlp: store the channel layout for each substream.
Also stop storing the channel arrangement in the header info, as it's unused outside of ff_mlp_read_major_sync.
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
CC:libav-stable@libav.org
Diffstat (limited to 'libavcodec/mlpdec.c')
-rw-r--r-- | libavcodec/mlpdec.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index 3852f6eff8..cd9426d5fe 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -28,6 +28,7 @@ #include "avcodec.h" #include "libavutil/intreadwrite.h" +#include "libavutil/channel_layout.h" #include "get_bits.h" #include "internal.h" #include "libavutil/crc.h" @@ -56,6 +57,8 @@ typedef struct SubStream { uint8_t max_matrix_channel; /// For each channel output by the matrix, the output channel to map it to uint8_t ch_assign[MAX_CHANNELS]; + /// The channel layout for this substream + uint64_t ch_layout; /// Channel coding parameters for channels in the substream ChannelParams channel_params[MAX_CHANNELS]; @@ -325,6 +328,24 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb) for (substr = 0; substr < MAX_SUBSTREAMS; substr++) m->substream[substr].restart_seen = 0; + /* Set the layout for each substream. When there's more than one, the first + * substream is Stereo. Subsequent substreams' layouts are indicated in the + * major sync. */ + if (m->avctx->codec_id == AV_CODEC_ID_MLP) { + if ((substr = (mh.num_substreams > 1))) + m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO; + m->substream[substr].ch_layout = mh.channel_layout_mlp; + } else { + if ((substr = (mh.num_substreams > 1))) + m->substream[0].ch_layout = 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; + else + m->substream[2].ch_layout = mh.channel_layout_thd_stream1; + m->substream[substr].ch_layout = mh.channel_layout_thd_stream1; + } + return 0; } |