[FFmpeg-devel] [PATCH]TTA channel layout
Carl Eugen Hoyos
cehoyos at ag.or.at
Mon Apr 25 01:18:01 CEST 2011
Hi!
I did not find any documentation, but attached matches both my tests and the
tta source.
Please comment, Carl Eugen
switch (tta_hdr.NumChannels) {
case 2: chMask = 0x00000003; break;
case 3: chMask = 0x0000000B; break;
case 4: chMask = 0x00000033; break;
case 6: chMask = 0x0000003F; break;
case 7: chMask = 0x0000013F; break;
case 8: chMask = 0x000000FF; break;
};
-------------- next part --------------
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index ece5c1c..5815b2a 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -205,6 +205,16 @@ static int tta_get_unary(GetBitContext *gb)
return ret;
}
+static const int64_t tta_channel_layouts[7] = {
+ AV_CH_LAYOUT_STEREO,
+ AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY,
+ AV_CH_LAYOUT_QUAD,
+ 0,
+ AV_CH_LAYOUT_5POINT1_BACK,
+ AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER,
+ AV_CH_LAYOUT_7POINT1_WIDE
+};
+
static av_cold int tta_decode_init(AVCodecContext * avctx)
{
TTAContext *s = avctx->priv_data;
@@ -234,6 +244,8 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
}
s->is_float = (s->flags == FORMAT_FLOAT);
avctx->channels = s->channels = get_bits(&s->gb, 16);
+ if (s->channels > 1 && s->channels < 9)
+ avctx->channel_layout = tta_channel_layouts[s->channels-2];
avctx->bits_per_coded_sample = get_bits(&s->gb, 16);
s->bps = (avctx->bits_per_coded_sample + 7) / 8;
avctx->sample_rate = get_bits_long(&s->gb, 32);
More information about the ffmpeg-devel
mailing list