From 4b5cee4617d0decbf93d06df4f45097fd7e00105 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 6 Apr 2013 22:43:12 +0200 Subject: core: use channel map on demuxer level too This helps passing the channel layout correctly from decoder to audio filter chain. (Because that part "reuses" the demuxer level codec parameters, which is very disgusting.) Note that ffmpeg stuff already passed the channel layout via mp_copy_lav_codec_headers(). So other than easier dealing with the demuxer/decoder parameters mess, there's no real advantage to doing this. Make the --channels option accept a channel map. Since simple numbers map to standard layouts with the given number of channels, this is downwards compatible. Likewise for demux_rawaudio. --- demux/demux_mkv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'demux/demux_mkv.c') diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index ee39038c77..4452aa9929 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -1393,7 +1393,7 @@ static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track, sh_a->format = track->a_formattag; sh_a->wf->wFormatTag = track->a_formattag; - sh_a->channels = track->a_channels; + mp_chmap_from_channels(&sh_a->channels, track->a_channels); sh_a->wf->nChannels = track->a_channels; sh_a->samplerate = (uint32_t) track->a_sfreq; sh_a->container_out_samplerate = track->a_osfreq; @@ -1411,7 +1411,7 @@ static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track, free(sh_a->wf); sh_a->wf = NULL; } else if (track->a_formattag == 0x0001) { /* PCM || PCM_BE */ - sh_a->wf->nAvgBytesPerSec = sh_a->channels * sh_a->samplerate * 2; + sh_a->wf->nAvgBytesPerSec = sh_a->channels.num * sh_a->samplerate * 2; sh_a->wf->nBlockAlign = sh_a->wf->nAvgBytesPerSec; if (!strcmp(track->codec_id, MKV_A_PCM_BE)) sh_a->format = mmioFOURCC('t', 'w', 'o', 's'); @@ -1583,7 +1583,7 @@ static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track, char *data = sh_a->codecdata; memcpy(data + 0, "TTA1", 4); AV_WL16(data + 4, 1); - AV_WL16(data + 6, sh_a->channels); + AV_WL16(data + 6, sh_a->channels.num); AV_WL16(data + 8, sh_a->wf->wBitsPerSample); AV_WL32(data + 10, sh_a->samplerate); // Bogus: last frame won't be played. -- cgit v1.2.3