summaryrefslogtreecommitdiff
path: root/libavcodec/mlp_parser.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-23 14:54:40 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-23 15:52:39 +0100
commitfa36270c4c68589882cfeae68a037f1d191231c2 (patch)
tree2ddefb2bbda1108755170cd97f514b75780da51a /libavcodec/mlp_parser.c
parent8102f27b5b3dff54f8099019c2df4701ac5e5d4f (diff)
parent99ccd2ba10eac2b282c272ad9e75f082123c765a (diff)
downloadffmpeg-fa36270c4c68589882cfeae68a037f1d191231c2.tar.gz
Merge commit '99ccd2ba10eac2b282c272ad9e75f082123c765a'
* commit '99ccd2ba10eac2b282c272ad9e75f082123c765a': mlp: store the channel layout for each substream. Conflicts: libavcodec/mlp_parser.c libavcodec/mlpdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mlp_parser.c')
-rw-r--r--libavcodec/mlp_parser.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index f1c0a0d1e8..2497ac3612 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -126,7 +126,7 @@ uint64_t ff_truehd_layout(int chanmap)
int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
{
- int ratebits;
+ int ratebits, channel_arrangement;
uint16_t checksum;
av_assert1(get_bits_count(gb) == 0);
@@ -157,7 +157,9 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
skip_bits(gb, 11);
- mh->channels_mlp = get_bits(gb, 5);
+ channel_arrangement = get_bits(gb, 5);
+ mh->channels_mlp = mlp_channels[channel_arrangement];
+ mh->channel_layout_mlp = ff_mlp_layout[channel_arrangement];
} else if (mh->stream_type == 0xba) {
mh->group1_bits = 24; // TODO: Is this information actually conveyed anywhere?
mh->group2_bits = 0;
@@ -168,11 +170,15 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
skip_bits(gb, 8);
- mh->channels_thd_stream1 = get_bits(gb, 5);
+ channel_arrangement = get_bits(gb, 5);
+ mh->channels_thd_stream1 = truehd_channels(channel_arrangement);
+ mh->channel_layout_thd_stream1 = ff_truehd_layout(channel_arrangement);
skip_bits(gb, 2);
- mh->channels_thd_stream2 = get_bits(gb, 13);
+ channel_arrangement = get_bits(gb, 13);
+ mh->channels_thd_stream2 = truehd_channels(channel_arrangement);
+ mh->channel_layout_thd_stream2 = ff_truehd_layout(channel_arrangement);
} else
return AVERROR_INVALIDDATA;
@@ -322,16 +328,16 @@ static int mlp_parse(AVCodecParserContext *s,
if(!avctx->channels || !avctx->channel_layout) {
if (mh.stream_type == 0xbb) {
/* MLP stream */
- avctx->channels = mlp_channels[mh.channels_mlp];
- avctx->channel_layout = ff_mlp_layout[mh.channels_mlp];
+ avctx->channels = mh.channels_mlp;
+ avctx->channel_layout = mh.channel_layout_mlp;
} else { /* mh.stream_type == 0xba */
/* TrueHD stream */
if (mh.channels_thd_stream2) {
- avctx->channels = truehd_channels(mh.channels_thd_stream2);
- avctx->channel_layout = ff_truehd_layout(mh.channels_thd_stream2);
+ avctx->channels = mh.channels_thd_stream2;
+ avctx->channel_layout = mh.channel_layout_thd_stream2;
} else {
- avctx->channels = truehd_channels(mh.channels_thd_stream1);
- avctx->channel_layout = ff_truehd_layout(mh.channels_thd_stream1);
+ avctx->channels = mh.channels_thd_stream1;
+ avctx->channel_layout = mh.channel_layout_thd_stream1;
}
}
}