mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
Set channel layout for True Audio files.
This is not documented (and possibly not originally intended), but it's what the current reference decoder does.
This commit is contained in:
parent
d2ee3c913d
commit
d804784db5
@ -205,6 +205,16 @@ static int tta_get_unary(GetBitContext *gb)
|
|||||||
return ret;
|
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)
|
static av_cold int tta_decode_init(AVCodecContext * avctx)
|
||||||
{
|
{
|
||||||
TTAContext *s = avctx->priv_data;
|
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);
|
s->is_float = (s->flags == FORMAT_FLOAT);
|
||||||
avctx->channels = s->channels = get_bits(&s->gb, 16);
|
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);
|
avctx->bits_per_coded_sample = get_bits(&s->gb, 16);
|
||||||
s->bps = (avctx->bits_per_coded_sample + 7) / 8;
|
s->bps = (avctx->bits_per_coded_sample + 7) / 8;
|
||||||
avctx->sample_rate = get_bits_long(&s->gb, 32);
|
avctx->sample_rate = get_bits_long(&s->gb, 32);
|
||||||
|
Loading…
Reference in New Issue
Block a user