Support unrar64.dll
[xy_vsfilter.git] / src / apps / mplayerc / PPageOutput.cpp
blobfb020cbf81977b9cdded7e987d20b4b9956de82c
1 /*
2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 // CPPageOutput.cpp : implementation file
25 #include "stdafx.h"
26 #include "mplayerc.h"
27 #include "MainFrm.h"
28 #include "PPageOutput.h"
29 #include "../../../include/moreuuids.h"
31 // CPPageOutput dialog
33 IMPLEMENT_DYNAMIC(CPPageOutput, CPPageBase)
34 CPPageOutput::CPPageOutput()
35 : CPPageBase(CPPageOutput::IDD, CPPageOutput::IDD)
36 , m_iDSVideoRendererType(0)
37 , m_iRMVideoRendererType(0)
38 , m_iQTVideoRendererType(0)
39 , m_iAPSurfaceUsage(0)
40 , m_iAudioRendererType(0)
41 , m_fVMRSyncFix(FALSE)
42 , m_iDX9Resizer(0)
43 , m_fVMR9MixerMode(FALSE)
44 , m_fVMR9MixerYUV(FALSE)
48 CPPageOutput::~CPPageOutput()
52 void CPPageOutput::DoDataExchange(CDataExchange* pDX)
54 __super::DoDataExchange(pDX);
55 DDX_Radio(pDX, IDC_DSSYSDEF, m_iDSVideoRendererType);
56 DDX_Radio(pDX, IDC_RMSYSDEF, m_iRMVideoRendererType);
57 DDX_Radio(pDX, IDC_QTSYSDEF, m_iQTVideoRendererType);
58 DDX_Radio(pDX, IDC_REGULARSURF, m_iAPSurfaceUsage);
59 DDX_CBIndex(pDX, IDC_COMBO1, m_iAudioRendererType);
60 DDX_Control(pDX, IDC_COMBO1, m_iAudioRendererTypeCtrl);
61 DDX_Check(pDX, IDC_CHECK1, m_fVMRSyncFix);
62 DDX_CBIndex(pDX, IDC_DX9RESIZER_COMBO, m_iDX9Resizer);
63 DDX_Check(pDX, IDC_DSVMR9LOADMIXER, m_fVMR9MixerMode);
64 DDX_Check(pDX, IDC_DSVMR9YUVMIXER, m_fVMR9MixerYUV);
67 BEGIN_MESSAGE_MAP(CPPageOutput, CPPageBase)
68 ON_UPDATE_COMMAND_UI(IDC_DSVMR9YUVMIXER, OnUpdateMixerYUV)
69 END_MESSAGE_MAP()
71 void CPPageOutput::DisableRadioButton(UINT nID, UINT nDefID)
73 if(IsDlgButtonChecked(nID))
75 CheckDlgButton(nID, BST_UNCHECKED);
76 CheckDlgButton(nDefID, BST_CHECKED);
79 GetDlgItem(nID)->EnableWindow(FALSE);
82 // CPPageOutput message handlers
84 BOOL CPPageOutput::OnInitDialog()
86 __super::OnInitDialog();
88 AppSettings& s = AfxGetAppSettings();
90 m_iDSVideoRendererType = s.iDSVideoRendererType;
91 m_iRMVideoRendererType = s.iRMVideoRendererType;
92 m_iQTVideoRendererType = s.iQTVideoRendererType;
93 m_iAPSurfaceUsage = s.iAPSurfaceUsage;
94 m_fVMRSyncFix = s.fVMRSyncFix;
95 m_iDX9Resizer = s.iDX9Resizer;
96 m_fVMR9MixerMode = s.fVMR9MixerMode;
97 m_fVMR9MixerYUV = s.fVMR9MixerYUV;
99 m_AudioRendererDisplayNames.Add(_T(""));
100 m_iAudioRendererTypeCtrl.AddString(_T("System Default"));
101 m_iAudioRendererType = 0;
103 BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker)
105 LPOLESTR olestr = NULL;
106 if(FAILED(pMoniker->GetDisplayName(0, 0, &olestr)))
107 continue;
109 CStringW str(olestr);
110 CoTaskMemFree(olestr);
112 m_AudioRendererDisplayNames.Add(CString(str));
114 CComPtr<IPropertyBag> pPB;
115 if(SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
117 CComVariant var;
118 pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL);
120 CString fstr(var.bstrVal);
122 var.Clear();
123 if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL)))
125 BSTR* pbstr;
126 if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pbstr)))
128 fstr.Format(_T("%s (%08x)"), CString(fstr), *((DWORD*)pbstr + 1));
129 SafeArrayUnaccessData(var.parray);
133 m_iAudioRendererTypeCtrl.AddString(fstr);
135 else
137 m_iAudioRendererTypeCtrl.AddString(CString(str));
140 if(s.AudioRendererDisplayName == str && m_iAudioRendererType == 0)
142 m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
145 EndEnumSysDev
147 m_AudioRendererDisplayNames.Add(AUDRNDT_NULL_COMP);
148 m_iAudioRendererTypeCtrl.AddString(AUDRNDT_NULL_COMP);
149 if(s.AudioRendererDisplayName == AUDRNDT_NULL_COMP && m_iAudioRendererType == 0)
150 m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
152 m_AudioRendererDisplayNames.Add(AUDRNDT_NULL_UNCOMP);
153 m_iAudioRendererTypeCtrl.AddString(AUDRNDT_NULL_UNCOMP);
154 if(s.AudioRendererDisplayName == AUDRNDT_NULL_UNCOMP && m_iAudioRendererType == 0)
155 m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
157 CorrectComboListWidth(m_iAudioRendererTypeCtrl, GetFont());
159 UpdateData(FALSE);
161 if(!IsCLSIDRegistered(CLSID_VideoMixingRenderer))
163 DisableRadioButton(IDC_DSVMR7WIN, IDC_DSSYSDEF);
164 DisableRadioButton(IDC_DSVMR7REN, IDC_DSSYSDEF);
167 if(!IsCLSIDRegistered(CLSID_VideoMixingRenderer9))
169 DisableRadioButton(IDC_DSVMR9WIN, IDC_DSSYSDEF);
170 DisableRadioButton(IDC_DSVMR9REN, IDC_DSSYSDEF);
171 DisableRadioButton(IDC_RMDX9, IDC_RMSYSDEF);
172 DisableRadioButton(IDC_QTDX9, IDC_QTSYSDEF);
175 if(!IsCLSIDRegistered(CLSID_DXR))
177 DisableRadioButton(IDC_DSDXR, IDC_DSSYSDEF);
180 // YUV mixing is not compatible with Vista
181 if (AfxGetMyApp()->IsVistaOrAbove())
183 GetDlgItem(IDC_DSVMR9YUVMIXER)->ShowWindow (SW_HIDE);
186 CreateToolTip();
188 return TRUE; // return TRUE unless you set the focus to a control
189 // EXCEPTION: OCX Property Pages should return FALSE
192 BOOL CPPageOutput::OnApply()
194 UpdateData();
196 AppSettings& s = AfxGetAppSettings();
198 s.iDSVideoRendererType = m_iDSVideoRendererType;
199 s.iRMVideoRendererType = m_iRMVideoRendererType;
200 s.iQTVideoRendererType = m_iQTVideoRendererType;
201 s.iAPSurfaceUsage = m_iAPSurfaceUsage;
202 s.fVMRSyncFix = !!m_fVMRSyncFix;
203 s.AudioRendererDisplayName = m_AudioRendererDisplayNames[m_iAudioRendererType];
204 s.iDX9Resizer = m_iDX9Resizer;
205 s.fVMR9MixerMode = !!m_fVMR9MixerMode;
206 s.fVMR9MixerYUV = !!m_fVMR9MixerYUV;
208 return __super::OnApply();
211 void CPPageOutput::OnUpdateMixerYUV(CCmdUI* pCmdUI)
213 pCmdUI->Enable(!!IsDlgButtonChecked(IDC_DSVMR9LOADMIXER));