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>2015-09-22 12:24:29 +0300
committerHendrik Leppkes <h.leppkes@gmail.com>2015-09-22 12:24:29 +0300
commit78f4d5a47e8b94acc15e995c419d519318a8b973 (patch)
treed7c6aca585ac7432d78c2256ce2b503a68a2e316
parentc9c91b5ce05171f7f360d1453b4aebd798ca5b46 (diff)
Added an option to switch back to the old 5.1 legacy format
Some software seems to still have problems with the new layout. Its 2015 people, update your stuff!
-rw-r--r--decoder/LAVAudio/AudioSettingsProp.cpp11
-rw-r--r--decoder/LAVAudio/AudioSettingsProp.h1
-rw-r--r--decoder/LAVAudio/LAVAudio.cpp20
-rw-r--r--decoder/LAVAudio/LAVAudio.h3
-rw-r--r--decoder/LAVAudio/LAVAudio.rc11
-rw-r--r--decoder/LAVAudio/LAVAudioSettings.h4
-rw-r--r--decoder/LAVAudio/PostProcessor.cpp17
-rw-r--r--decoder/LAVAudio/resource.h3
8 files changed, 53 insertions, 17 deletions
diff --git a/decoder/LAVAudio/AudioSettingsProp.cpp b/decoder/LAVAudio/AudioSettingsProp.cpp
index fccb5f91..cf14fb18 100644
--- a/decoder/LAVAudio/AudioSettingsProp.cpp
+++ b/decoder/LAVAudio/AudioSettingsProp.cpp
@@ -91,6 +91,9 @@ HRESULT CLAVAudioSettingsProp::OnApplyChanges()
bFlag = (BOOL)SendDlgItemMessage(m_Dlg, IDC_STANDARD_CH_LAYOUT, BM_GETCHECK, 0, 0);
m_pAudioSettings->SetOutputStandardLayout(bFlag);
+ bFlag = (BOOL)SendDlgItemMessage(m_Dlg, IDC_OUTPUT51_LEGACY, BM_GETCHECK, 0, 0);
+ m_pAudioSettings->SetOutput51LegacyLayout(bFlag);
+
bFlag = (BOOL)SendDlgItemMessage(m_Dlg, IDC_EXPAND_MONO, BM_GETCHECK, 0, 0);
m_pAudioSettings->SetExpandMono(bFlag);
@@ -175,6 +178,9 @@ HRESULT CLAVAudioSettingsProp::OnActivate()
SendDlgItemMessage(m_Dlg, IDC_STANDARD_CH_LAYOUT, BM_SETCHECK, m_bOutputStdLayout, 0);
addHint(IDC_STANDARD_CH_LAYOUT, L"Converts all channel layouts to one of the \"standard\" layouts (5.1/6.1/7.1) by adding silent channels. This is required for sending the PCM over HDMI if not using another downstream mixer, for example when using WASAPI.");
+ SendDlgItemMessage(m_Dlg, IDC_OUTPUT51_LEGACY, BM_SETCHECK, m_bOutput51Legacy, 0);
+ addHint(IDC_OUTPUT51_LEGACY, L"Use the legacy 5.1 channel layout which uses back channels instead of side channels, required for some audio devices and/or software.");
+
SendDlgItemMessage(m_Dlg, IDC_EXPAND_MONO, BM_SETCHECK, m_bExpandMono, 0);
addHint(IDC_EXPAND_MONO, L"Plays Mono Audio in both Left/Right Front channels, instead of the center.");
SendDlgItemMessage(m_Dlg, IDC_EXPAND61, BM_SETCHECK, m_bExpand61, 0);
@@ -213,6 +219,7 @@ HRESULT CLAVAudioSettingsProp::LoadData()
m_bDTSHDFraming = m_pAudioSettings->GetDTSHDFraming();
m_bAutoAVSync = m_pAudioSettings->GetAutoAVSync();
m_bOutputStdLayout = m_pAudioSettings->GetOutputStandardLayout();
+ m_bOutput51Legacy = m_pAudioSettings->GetOutput51LegacyLayout();
m_bExpandMono = m_pAudioSettings->GetExpandMono();
m_bExpand61 = m_pAudioSettings->GetExpand61();
@@ -273,6 +280,10 @@ INT_PTR CLAVAudioSettingsProp::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wPa
BOOL bFlag = (BOOL)SendDlgItemMessage(m_Dlg, LOWORD(wParam), BM_GETCHECK, 0, 0);
if (bFlag != m_bOutputStdLayout)
SetDirty();
+ } else if (LOWORD(wParam) == IDC_OUTPUT51_LEGACY && HIWORD(wParam) == BN_CLICKED) {
+ BOOL bFlag = (BOOL)SendDlgItemMessage(m_Dlg, LOWORD(wParam), BM_GETCHECK, 0, 0);
+ if (bFlag != m_bOutput51Legacy)
+ SetDirty();
} else if (LOWORD(wParam) == IDC_EXPAND_MONO && HIWORD(wParam) == BN_CLICKED) {
BOOL bFlag = (BOOL)SendDlgItemMessage(m_Dlg, LOWORD(wParam), BM_GETCHECK, 0, 0);
if (bFlag != m_bExpandMono)
diff --git a/decoder/LAVAudio/AudioSettingsProp.h b/decoder/LAVAudio/AudioSettingsProp.h
index 55b38134..84710a4b 100644
--- a/decoder/LAVAudio/AudioSettingsProp.h
+++ b/decoder/LAVAudio/AudioSettingsProp.h
@@ -73,6 +73,7 @@ private:
BOOL m_bDTSHDFraming;
BOOL m_bAutoAVSync;
BOOL m_bOutputStdLayout;
+ BOOL m_bOutput51Legacy;
BOOL m_bExpandMono;
BOOL m_bExpand61;
bool m_bSampleFormats[SampleFormat_NB];
diff --git a/decoder/LAVAudio/LAVAudio.cpp b/decoder/LAVAudio/LAVAudio.cpp
index 4f064e61..23d81d02 100644
--- a/decoder/LAVAudio/LAVAudio.cpp
+++ b/decoder/LAVAudio/LAVAudio.cpp
@@ -170,6 +170,7 @@ HRESULT CLAVAudio::LoadDefaults()
m_settings.ExpandMono = FALSE;
m_settings.Expand61 = FALSE;
m_settings.OutputStandardLayout = TRUE;
+ m_settings.Output51Legacy = FALSE;
m_settings.AllowRawSPDIF = FALSE;
// Default all Sample Formats to enabled
@@ -261,6 +262,9 @@ HRESULT CLAVAudio::ReadSettings(HKEY rootKey)
bFlag = reg.ReadBOOL(L"OutputStandardLayout", hr);
if (SUCCEEDED(hr)) m_settings.OutputStandardLayout = bFlag;
+ bFlag = reg.ReadBOOL(L"Output51Legacy", hr);
+ if (SUCCEEDED(hr)) m_settings.Output51Legacy = bFlag;
+
bFlag = reg.ReadBOOL(L"Mixing", hr);
if (SUCCEEDED(hr)) m_settings.MixingEnabled = bFlag;
@@ -344,6 +348,7 @@ HRESULT CLAVAudio::SaveSettings()
reg.WriteBOOL(L"ExpandMono", m_settings.ExpandMono);
reg.WriteBOOL(L"Expand61", m_settings.Expand61);
reg.WriteBOOL(L"OutputStandardLayout", m_settings.OutputStandardLayout);
+ reg.WriteBOOL(L"Output51Legacy", m_settings.Output51Legacy);
reg.WriteBOOL(L"AudioDelayEnabled", m_settings.AudioDelayEnabled);
reg.WriteDWORD(L"AudioDelay", m_settings.AudioDelay);
@@ -786,6 +791,17 @@ STDMETHODIMP_(BOOL) CLAVAudio::GetSuppressFormatChanges()
return m_settings.SuppressFormatChanges;
}
+STDMETHODIMP CLAVAudio::SetOutput51LegacyLayout(BOOL b51Legacy)
+{
+ m_settings.Output51Legacy = b51Legacy;
+ return SaveSettings();
+}
+
+STDMETHODIMP_(BOOL) CLAVAudio::GetOutput51LegacyLayout()
+{
+ return m_settings.Output51Legacy;
+}
+
// ILAVAudioStatus
BOOL CLAVAudio::IsSampleFormatSupported(LAVAudioSampleFormat sfCheck)
{
@@ -975,6 +991,10 @@ HRESULT CLAVAudio::GetMediaType(int iPosition, CMediaType *pMediaType)
}
}
+ // map to legacy 5.1 if user requested
+ if (dwChannelMask == AV_CH_LAYOUT_5POINT1 && m_settings.Output51Legacy)
+ dwChannelMask = AV_CH_LAYOUT_5POINT1_BACK;
+
if (dwChannelMask == AV_CH_LAYOUT_5POINT1 && iPosition > 1 && iPosition < 4)
dwChannelMask = AV_CH_LAYOUT_5POINT1_BACK;
else if (iPosition > 1)
diff --git a/decoder/LAVAudio/LAVAudio.h b/decoder/LAVAudio/LAVAudio.h
index dc4db3a2..1d7f283e 100644
--- a/decoder/LAVAudio/LAVAudio.h
+++ b/decoder/LAVAudio/LAVAudio.h
@@ -136,6 +136,8 @@ public:
STDMETHODIMP_(BOOL) GetSampleConvertDithering();
STDMETHODIMP SetSuppressFormatChanges(BOOL bEnabled);
STDMETHODIMP_(BOOL) GetSuppressFormatChanges();
+ STDMETHODIMP SetOutput51LegacyLayout(BOOL b51Legacy);
+ STDMETHODIMP_(BOOL) GetOutput51LegacyLayout();
// ILAVAudioStatus
STDMETHODIMP_(BOOL) IsSampleFormatSupported(LAVAudioSampleFormat sfCheck);
@@ -282,6 +284,7 @@ private:
BOOL ExpandMono;
BOOL Expand61;
BOOL OutputStandardLayout;
+ BOOL Output51Legacy;
BOOL AllowRawSPDIF;
BOOL bSampleFormats[SampleFormat_NB];
BOOL SampleConvertDither;
diff --git a/decoder/LAVAudio/LAVAudio.rc b/decoder/LAVAudio/LAVAudio.rc
index 1f77fca6..00756d61 100644
--- a/decoder/LAVAudio/LAVAudio.rc
+++ b/decoder/LAVAudio/LAVAudio.rc
@@ -63,7 +63,7 @@ END
// Dialog
//
-IDD_PROPPAGE_AUDIO_SETTINGS DIALOGEX 0, 0, 369, 215
+IDD_PROPPAGE_AUDIO_SETTINGS DIALOGEX 0, 0, 369, 224
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x0
BEGIN
@@ -83,13 +83,14 @@ BEGIN
LTEXT "Options",IDC_BS_OPTIONS,12,112,26,8
CONTROL "Use DTS-HD Framing for all DTS types",IDC_BS_DTSHD_FRAMING,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,123,137,10
- GROUPBOX "Options",IDC_OPTIONS,7,139,196,52
+ GROUPBOX "Options",IDC_OPTIONS,7,139,196,65
CONTROL "Auto A/V Sync correction",IDC_AUTO_AVSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,150,96,10
CONTROL "Convert Output to Standard Channel Layouts",IDC_STANDARD_CH_LAYOUT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,164,162,10
CONTROL "Expand Mono to Stereo",IDC_EXPAND_MONO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,178,91,10
CONTROL "Expand 6.1 to 7.1",IDC_EXPAND61,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,178,74,10
- LTEXT "LAV Audio Decoder x.xx",IDC_LAVAUDIO_FOOTER,209,202,149,8,0,WS_EX_RIGHT
+ CONTROL "Use Legacy 5.1 channel layout",IDC_OUTPUT51_LEGACY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,192,162,10
+ LTEXT "LAV Audio Decoder x.xx",IDC_LAVAUDIO_FOOTER,209,211,149,8,0,WS_EX_RIGHT
GROUPBOX "Output Formats",IDC_OUTPUT_FORMATS,207,59,151,132
LTEXT "Select which output formats are available.\nThe best format is used automatically.",IDC_LBL_OUTPUTFORMATS,213,70,140,22
CONTROL "16-bit Integer",IDC_OUT_S16,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,216,91,61,10
@@ -105,7 +106,7 @@ BEGIN
LTEXT "Delay (in ms):",IDC_STATIC,213,37,47,8
EDITTEXT IDC_DELAY,261,35,46,13,ES_AUTOHSCROLL,WS_EX_RIGHT
CONTROL "",IDC_DELAYSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,305,35,11,13
- CONTROL "Enable System Tray Icon",IDC_TRAYICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,200,192,10
+ CONTROL "Enable System Tray Icon",IDC_TRAYICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,209,192,10
END
IDD_PROPPAGE_AUDIO_MIXING DIALOGEX 0, 0, 369, 215
@@ -199,7 +200,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 358
TOPMARGIN, 7
- BOTTOMMARGIN, 210
+ BOTTOMMARGIN, 219
END
IDD_PROPPAGE_AUDIO_MIXING, DIALOG
diff --git a/decoder/LAVAudio/LAVAudioSettings.h b/decoder/LAVAudio/LAVAudioSettings.h
index 85601748..476040c1 100644
--- a/decoder/LAVAudio/LAVAudioSettings.h
+++ b/decoder/LAVAudio/LAVAudioSettings.h
@@ -190,6 +190,10 @@ interface ILAVAudioSettings : public IUnknown
// This option is NOT persistent
STDMETHOD(SetSuppressFormatChanges)(BOOL bEnabled) = 0;
STDMETHOD_(BOOL, GetSuppressFormatChanges)() = 0;
+
+ // Use 5.1 legacy layout (using back channels instead of side)
+ STDMETHOD_(BOOL, GetOutput51LegacyLayout)() = 0;
+ STDMETHOD(SetOutput51LegacyLayout)(BOOL b51Legacy) = 0;
};
// LAV Audio Status Interface
diff --git a/decoder/LAVAudio/PostProcessor.cpp b/decoder/LAVAudio/PostProcessor.cpp
index d100c5de..447bcfb7 100644
--- a/decoder/LAVAudio/PostProcessor.cpp
+++ b/decoder/LAVAudio/PostProcessor.cpp
@@ -389,15 +389,6 @@ HRESULT CLAVAudio::Create71Conformity(DWORD dwLayout)
return S_OK;
}
-static inline DWORD sanitize_mask(DWORD mask, AVCodecID codec)
-{
- // Prefer the 5.1 SIDE mask
- if (mask == AV_CH_LAYOUT_5POINT1_BACK)
- mask = AV_CH_LAYOUT_5POINT1;
-
- return mask;
-}
-
HRESULT CLAVAudio::PadTo32(BufferDetails *buffer)
{
ASSERT(buffer->sfFormat == SampleFormat_24);
@@ -580,8 +571,6 @@ setuperr:
HRESULT CLAVAudio::PostProcess(BufferDetails *buffer)
{
- buffer->dwChannelMask = sanitize_mask(buffer->dwChannelMask, m_nCodecId);
-
int layout_channels = av_get_channel_layout_nb_channels(buffer->dwChannelMask);
// Validate channel mask
@@ -630,6 +619,12 @@ HRESULT CLAVAudio::PostProcess(BufferDetails *buffer)
}
}
+ // Map to the requested 5.1 layout
+ if (m_settings.Output51Legacy && buffer->dwChannelMask == AV_CH_LAYOUT_5POINT1)
+ buffer->dwChannelMask = AV_CH_LAYOUT_5POINT1_BACK;
+ else if (!m_settings.Output51Legacy && buffer->dwChannelMask == AV_CH_LAYOUT_5POINT1_BACK)
+ buffer->dwChannelMask = AV_CH_LAYOUT_5POINT1;
+
// Check if current output uses back layout, and keep it active in that case
if (buffer->dwChannelMask == AV_CH_LAYOUT_5POINT1) {
WAVEFORMATEX * wfe = (WAVEFORMATEX *)m_pOutput->CurrentMediaType().Format();
diff --git a/decoder/LAVAudio/resource.h b/decoder/LAVAudio/resource.h
index 48859b02..c20b0559 100644
--- a/decoder/LAVAudio/resource.h
+++ b/decoder/LAVAudio/resource.h
@@ -107,6 +107,7 @@
#define IDC_LBL_MIXING_LEVEL 1130
#define IDC_TRAYICON 1131
#define IDC_OUT_S16_DITHER 1132
+#define IDC_OUTPUT51_LEGACY 1133
// Next default values for new objects
//
@@ -114,7 +115,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1133
+#define _APS_NEXT_CONTROL_VALUE 1134
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif