Commit d4b79b2e authored by Anton Khirnov's avatar Anton Khirnov Committed by James Almer

mlp: convert to new channel layout API

Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 6d8b2584
......@@ -57,12 +57,21 @@ const ChannelInformation ff_mlp_ch_info[21] = {
{ 0x3F, 0x04, 0x02, 0x00 },
};
#if FF_API_OLD_CHANNEL_LAYOUT
const uint64_t ff_mlp_channel_layouts[12] = {
AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_2_1,
AV_CH_LAYOUT_QUAD, AV_CH_LAYOUT_2POINT1, AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_4POINT0, AV_CH_LAYOUT_5POINT0_BACK, AV_CH_LAYOUT_3POINT1,
AV_CH_LAYOUT_4POINT1, AV_CH_LAYOUT_5POINT1_BACK, 0,
};
#endif
const AVChannelLayout ff_mlp_ch_layouts[12] = {
AV_CHANNEL_LAYOUT_MONO, AV_CHANNEL_LAYOUT_STEREO, AV_CHANNEL_LAYOUT_2_1,
AV_CHANNEL_LAYOUT_QUAD, AV_CHANNEL_LAYOUT_2POINT1, AV_CHANNEL_LAYOUT_SURROUND,
AV_CHANNEL_LAYOUT_4POINT0, AV_CHANNEL_LAYOUT_5POINT0_BACK, AV_CHANNEL_LAYOUT_3POINT1,
AV_CHANNEL_LAYOUT_4POINT1, AV_CHANNEL_LAYOUT_5POINT1_BACK, { 0 },
};
#if CONFIG_SMALL
#define CRC_TABLE_SIZE 257
......
......@@ -24,6 +24,8 @@
#include <stdint.h>
#include "libavutil/channel_layout.h"
#define SYNC_MLP 0xbb
#define SYNC_TRUEHD 0xba
......@@ -135,7 +137,10 @@ typedef struct {
*/
extern const ChannelInformation ff_mlp_ch_info[21];
#if FF_API_OLD_CHANNEL_LAYOUT
extern const uint64_t ff_mlp_channel_layouts[12];
#endif
extern const AVChannelLayout ff_mlp_ch_layouts[12];
/** MLP uses checksums that seem to be based on the standard CRC algorithm, but
* are not (in implementation terms, the table lookup and XOR are reversed).
......
......@@ -175,22 +175,18 @@ static int mlp_parse(AVCodecParserContext *s,
avctx->frame_size =
s->duration = mh.access_unit_size;
if(!avctx->channels || !avctx->channel_layout) {
av_channel_layout_uninit(&avctx->ch_layout);
if (mh.stream_type == 0xbb) {
/* MLP stream */
avctx->channels = mh.channels_mlp;
avctx->channel_layout = mh.channel_layout_mlp;
av_channel_layout_from_mask(&avctx->ch_layout, mh.channel_layout_mlp);
} else { /* mh.stream_type == 0xba */
/* TrueHD stream */
if (!mh.channels_thd_stream2) {
avctx->channels = mh.channels_thd_stream1;
avctx->channel_layout = mh.channel_layout_thd_stream1;
av_channel_layout_from_mask(&avctx->ch_layout, mh.channel_layout_thd_stream1);
} else {
avctx->channels = mh.channels_thd_stream2;
avctx->channel_layout = mh.channel_layout_thd_stream2;
av_channel_layout_from_mask(&avctx->ch_layout, mh.channel_layout_thd_stream2);
}
}
}
if (!mh.is_vbr) /* Stream is CBR */
avctx->bit_rate = mh.peak_bitrate;
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment