path: root/stream
diff options
authorwm4 <wm4@nowhere>2013-04-06 22:43:12 +0200
committerwm4 <wm4@nowhere>2013-05-12 21:24:55 +0200
commit4b5cee4617d0decbf93d06df4f45097fd7e00105 (patch)
treeb6d293e86d83ab5c3efd99153aa7a7a134d2937f /stream
parent586b75ad0840e154835ae67c7720b71bd36f8cc9 (diff)
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.
Diffstat (limited to 'stream')
1 files changed, 6 insertions, 4 deletions
diff --git a/stream/tv.c b/stream/tv.c
index 80dd53e6a1..38368d4925 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -792,23 +792,25 @@ static demuxer_t* demux_open_tv(demuxer_t *demuxer)
funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLESIZE,
+ int nchannels = sh_audio->channels.num;
funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_CHANNELS,
- &sh_audio->channels);
+ &nchannels);
+ mp_chmap_from_channels(&sh_audio->channels, nchannels);
sh_audio->gsh->codec = "mp-pcm";
sh_audio->format = audio_format;
sh_audio->i_bps = sh_audio->o_bps =
sh_audio->samplerate * sh_audio->samplesize *
- sh_audio->channels;
+ sh_audio->channels.num;
// emulate WF for win32 codecs:
sh_audio->wf = malloc(sizeof(*sh_audio->wf));
sh_audio->wf->wFormatTag = sh_audio->format;
- sh_audio->wf->nChannels = sh_audio->channels;
+ sh_audio->wf->nChannels = sh_audio->channels.num;
sh_audio->wf->wBitsPerSample = sh_audio->samplesize * 8;
sh_audio->wf->nSamplesPerSec = sh_audio->samplerate;
- sh_audio->wf->nBlockAlign = sh_audio->samplesize * sh_audio->channels;
+ sh_audio->wf->nBlockAlign = sh_audio->samplesize * sh_audio->channels.num;
sh_audio->wf->nAvgBytesPerSec = sh_audio->i_bps;
mp_tmsg(MSGT_DECVIDEO, MSGL_V, " TV audio: %d channels, %d bits, %d Hz\n",