Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2012-07-19 15:47:04 +0400
committerHendrik Leppkes <h.leppkes@gmail.com>2012-07-19 18:36:41 +0400
commit875effe0f696fd320f8ed3601343fffe4633dc6a (patch)
treec76b21c5cb14b32e60439dc46d8532b78448995c /decoder/LAVAudio
parent5ba0e782d4538e6a42d33c71afe4c9377fc929d9 (diff)
Take mixing into account for the initial media type.
Diffstat (limited to 'decoder/LAVAudio')
-rw-r--r--decoder/LAVAudio/LAVAudio.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/decoder/LAVAudio/LAVAudio.cpp b/decoder/LAVAudio/LAVAudio.cpp
index 1363a03c..00113e60 100644
--- a/decoder/LAVAudio/LAVAudio.cpp
+++ b/decoder/LAVAudio/LAVAudio.cpp
@@ -898,8 +898,9 @@ HRESULT CLAVAudio::GetMediaType(int iPosition, CMediaType *pMediaType)
if (m_avBSContext) {
*pMediaType = CreateBitstreamMediaType(m_nCodecId, m_pAVCtx->sample_rate);
} else {
- const int nChannels = m_pAVCtx->channels;
const int nSamplesPerSec = m_pAVCtx->sample_rate;
+ int nChannels = m_pAVCtx->channels;
+ DWORD dwChannelMask = get_channel_mask(nChannels);
AVSampleFormat sample_fmt = (m_pAVCtx->sample_fmt != AV_SAMPLE_FMT_NONE) ? m_pAVCtx->sample_fmt : (m_pAVCodec->sample_fmts ? m_pAVCodec->sample_fmts[0] : AV_SAMPLE_FMT_NONE);
if (sample_fmt == AV_SAMPLE_FMT_NONE) {
@@ -908,12 +909,20 @@ HRESULT CLAVAudio::GetMediaType(int iPosition, CMediaType *pMediaType)
else
sample_fmt = AV_SAMPLE_FMT_S16;
}
- const DWORD dwChannelMask = get_channel_mask(nChannels);
// Prefer bits_per_raw_sample if set, but if not, try to do a better guess with bits per coded sample
const int bits = m_pAVCtx->bits_per_raw_sample ? m_pAVCtx->bits_per_raw_sample : m_pAVCtx->bits_per_coded_sample;
LAVAudioSampleFormat lav_sample_fmt = m_pDTSDecoderContext ? SampleFormat_24 : get_lav_sample_fmt(sample_fmt, bits);
+ if (m_settings.MixingEnabled) {
+ if (nChannels != av_get_channel_layout_nb_channels(m_settings.MixingLayout)
+ && (nChannels > 2 || !(m_settings.MixingFlags & LAV_MIXING_FLAG_UNTOUCHED_STEREO))) {
+ lav_sample_fmt = SampleFormat_FP32;
+ dwChannelMask = m_settings.MixingLayout;
+ nChannels = av_get_channel_layout_nb_channels(dwChannelMask);
+ }
+ }
+
if (iPosition == 1)
lav_sample_fmt = SampleFormat_16;