summaryrefslogtreecommitdiff
path: root/libavcodec/mlpdec.c
diff options
context:
space:
mode:
authorTim Walker <tdskywalker@gmail.com>2012-12-31 15:33:23 +0100
committerReinhard Tartler <siretart@tauware.de>2013-02-07 07:15:01 +0100
commit5af78cc98d807f3b43510410dad46e1840c5c99f (patch)
tree8a28bde4ed26218b7c9b75456c936b3841647542 /libavcodec/mlpdec.c
parent59f22ef91a1e84caadccc5a179b4a973267243b4 (diff)
downloadffmpeg-5af78cc98d807f3b43510410dad46e1840c5c99f.tar.gz
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 (cherry picked from commit 99ccd2ba10eac2b282c272ad9e75f082123c765a) Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Diffstat (limited to 'libavcodec/mlpdec.c')
-rw-r--r--libavcodec/mlpdec.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index de08f1ab62..80ff4017f7 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];
@@ -355,6 +358,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;
}