summaryrefslogtreecommitdiffstats
path: root/libavcodec/mlp_parser.c
diff options
context:
space:
mode:
authorTim Walker <tdskywalker@gmail.com>2012-12-31 15:33:23 +0100
committerJustin Ruggles <justin.ruggles@gmail.com>2013-01-22 16:10:02 -0500
commit99ccd2ba10eac2b282c272ad9e75f082123c765a (patch)
tree83a1ad8f47fdbc3bf7b6be9f951e6524573de7a7 /libavcodec/mlp_parser.c
parent73b704ac609d83e0be124589f24efd9b94947cf9 (diff)
downloadffmpeg-streaming-99ccd2ba10eac2b282c272ad9e75f082123c765a.zip
ffmpeg-streaming-99ccd2ba10eac2b282c272ad9e75f082123c765a.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
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 d1a3dc1..31c79c9 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -126,7 +126,7 @@ static uint64_t 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;
assert(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 = 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 = 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 = truehd_layout(channel_arrangement);
} else
return AVERROR_INVALIDDATA;
@@ -316,16 +322,16 @@ static int mlp_parse(AVCodecParserContext *s,
if (mh.stream_type == 0xbb) {
/* MLP stream */
- avctx->channels = mlp_channels[mh.channels_mlp];
- avctx->channel_layout = 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 = 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 = truehd_layout(mh.channels_thd_stream1);
+ avctx->channels = mh.channels_thd_stream1;
+ avctx->channel_layout = mh.channel_layout_thd_stream1;
}
}
OpenPOWER on IntegriCloud