mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-04 14:40:26 +00:00
avcodec/dcadec: output a custom channel layout when requesting coded channel ordering
Outputting an UNSPEC layout will make most callers guess the speaker layout, and more likely than not get it wrong. Now that we can freely export custom order layouts, lets use them. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
de647bfbbc
commit
c65c8f1f49
3 changed files with 20 additions and 8 deletions
|
|
@ -47,23 +47,31 @@ int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask
|
|||
DCAContext *s = avctx->priv_data;
|
||||
|
||||
int dca_ch, wav_ch, nchannels = 0;
|
||||
const uint8_t *dca2wav;
|
||||
|
||||
if (dca_mask == DCA_SPEAKER_LAYOUT_7POINT0_WIDE ||
|
||||
dca_mask == DCA_SPEAKER_LAYOUT_7POINT1_WIDE)
|
||||
dca2wav = dca2wav_wide;
|
||||
else
|
||||
dca2wav = dca2wav_norm;
|
||||
|
||||
av_channel_layout_uninit(&avctx->ch_layout);
|
||||
if (s->output_channel_order == CHANNEL_ORDER_CODED) {
|
||||
int ret;
|
||||
for (dca_ch = 0; dca_ch < DCA_SPEAKER_COUNT; dca_ch++)
|
||||
if (dca_mask & (1U << dca_ch))
|
||||
ch_remap[nchannels++] = dca_ch;
|
||||
avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
|
||||
avctx->ch_layout.nb_channels = nchannels;
|
||||
ret = av_channel_layout_custom_init(&avctx->ch_layout, nchannels);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
nchannels = 0;
|
||||
for (dca_ch = 0; dca_ch < DCA_SPEAKER_COUNT; dca_ch++)
|
||||
if (dca_mask & (1U << dca_ch))
|
||||
avctx->ch_layout.u.map[nchannels++].id = dca2wav[dca_ch];
|
||||
} else {
|
||||
int wav_mask = 0;
|
||||
int wav_map[18];
|
||||
const uint8_t *dca2wav;
|
||||
if (dca_mask == DCA_SPEAKER_LAYOUT_7POINT0_WIDE ||
|
||||
dca_mask == DCA_SPEAKER_LAYOUT_7POINT1_WIDE)
|
||||
dca2wav = dca2wav_wide;
|
||||
else
|
||||
dca2wav = dca2wav_norm;
|
||||
for (dca_ch = 0; dca_ch < 28; dca_ch++) {
|
||||
if (dca_mask & (1 << dca_ch)) {
|
||||
wav_ch = dca2wav[dca_ch];
|
||||
|
|
|
|||
|
|
@ -73,6 +73,9 @@ fate-dca-core: REF = $(SAMPLES)/dts/dts.pcm
|
|||
FATE_DCA-$(call DEMDEC, DTS, DCA, ARESAMPLE_FILTER PCM_S24LE_ENCODER PCM_S24LE_MUXER) += fate-dca-xll
|
||||
fate-dca-xll: CMD = md5 -i $(TARGET_SAMPLES)/dts/master_audio_7.1_24bit.dts -f s24le -af aresample
|
||||
|
||||
FATE_DCA-$(call DEMDEC, DTS, DCA, ARESAMPLE_FILTER PCM_S24LE_ENCODER PCM_S24LE_MUXER) += fate-dca-xll-coded
|
||||
fate-dca-xll-coded: CMD = md5 -channel_order coded -i $(TARGET_SAMPLES)/dts/master_audio_7.1_24bit.dts -f s24le -af aresample
|
||||
|
||||
FATE_DCA-$(call PCM, DTS, DCA, ARESAMPLE_FILTER) += fate-dts_es
|
||||
fate-dts_es: CMD = pcm -i $(TARGET_SAMPLES)/dts/dts_es.dts
|
||||
fate-dts_es: CMP = oneoff
|
||||
|
|
|
|||
1
tests/ref/fate/dca-xll-coded
Normal file
1
tests/ref/fate/dca-xll-coded
Normal file
|
|
@ -0,0 +1 @@
|
|||
0ae67d520a46776046ab5ab7d1c6a387
|
||||
Loading…
Add table
Add a link
Reference in a new issue