PPageOutput.cpp

00001 /* 
00002  *      Copyright (C) 2003-2005 Gabest
00003  *      http://www.gabest.org
00004  *
00005  *  This Program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2, or (at your option)
00008  *  any later version.
00009  *   
00010  *  This Program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *   
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with GNU Make; see the file COPYING.  If not, write to
00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
00018  *  http://www.gnu.org/copyleft/gpl.html
00019  *
00020  */
00021 
00022 // CPPageOutput.cpp : implementation file
00023 //
00024 
00025 #include "stdafx.h"
00026 #include "mplayerc.h"
00027 #include "MainFrm.h"
00028 #include "PPageOutput.h"
00029 
00030 // CPPageOutput dialog
00031 
00032 IMPLEMENT_DYNAMIC(CPPageOutput, CPPageBase)
00033 CPPageOutput::CPPageOutput()
00034         : CPPageBase(CPPageOutput::IDD, CPPageOutput::IDD)
00035         , m_iDSVideoRendererType(0)
00036         , m_iRMVideoRendererType(0)
00037         , m_iQTVideoRendererType(0)
00038         , m_iAPSurfaceUsage(0)
00039         , m_iAudioRendererType(0)
00040         , m_fVMRSyncFix(FALSE)
00041         , m_iDX9Resizer(0)
00042 {
00043 }
00044 
00045 CPPageOutput::~CPPageOutput()
00046 {
00047 }
00048 
00049 void CPPageOutput::DoDataExchange(CDataExchange* pDX)
00050 {
00051         __super::DoDataExchange(pDX);
00052         DDX_Radio(pDX, IDC_DSSYSDEF, m_iDSVideoRendererType);
00053         DDX_Radio(pDX, IDC_RMSYSDEF, m_iRMVideoRendererType);
00054         DDX_Radio(pDX, IDC_QTSYSDEF, m_iQTVideoRendererType);
00055         DDX_Radio(pDX, IDC_REGULARSURF, m_iAPSurfaceUsage);
00056         DDX_CBIndex(pDX, IDC_COMBO1, m_iAudioRendererType);
00057         DDX_Control(pDX, IDC_COMBO1, m_iAudioRendererTypeCtrl);
00058         DDX_Check(pDX, IDC_CHECK1, m_fVMRSyncFix);
00059         DDX_CBIndex(pDX, IDC_DX9RESIZER_COMBO, m_iDX9Resizer);
00060 }
00061 
00062 
00063 BEGIN_MESSAGE_MAP(CPPageOutput, CPPageBase)
00064 END_MESSAGE_MAP()
00065 
00066 
00067 // CPPageOutput message handlers
00068 
00069 BOOL CPPageOutput::OnInitDialog()
00070 {
00071         __super::OnInitDialog();
00072 
00073         AppSettings& s = AfxGetAppSettings();
00074 
00075         m_iDSVideoRendererType = s.iDSVideoRendererType;
00076         m_iRMVideoRendererType = s.iRMVideoRendererType;
00077         m_iQTVideoRendererType = s.iQTVideoRendererType;
00078         m_iAPSurfaceUsage = s.iAPSurfaceUsage;
00079         m_fVMRSyncFix = s.fVMRSyncFix;
00080         m_iDX9Resizer = s.iDX9Resizer;
00081 
00082         m_AudioRendererDisplayNames.Add(_T(""));
00083         m_iAudioRendererTypeCtrl.AddString(_T("System Default"));
00084         m_iAudioRendererType = 0;
00085 
00086         BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker)
00087         {
00088                 LPOLESTR olestr = NULL;
00089                 if(FAILED(pMoniker->GetDisplayName(0, 0, &olestr)))
00090                         continue;
00091                 CStringW str(olestr);
00092                 CoTaskMemFree(olestr);
00093                 m_AudioRendererDisplayNames.Add(CString(str));
00094 
00095                 CComPtr<IPropertyBag> pPB;
00096                 if(SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
00097                 {
00098                         CComVariant var;
00099                         pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL);
00100 
00101                         CString fstr(var.bstrVal);
00102 
00103                         var.Clear();
00104                         if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL)))
00105                         {                       
00106                                 BSTR* pbstr;
00107                                 if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pbstr)))
00108                                 {
00109                                         fstr.Format(_T("%s (%08x)"), CString(fstr), *((DWORD*)pbstr + 1));
00110                                         SafeArrayUnaccessData(var.parray);
00111                                 }
00112                         }
00113 
00114                         m_iAudioRendererTypeCtrl.AddString(fstr);
00115                 }
00116                 else
00117                 {
00118                         m_iAudioRendererTypeCtrl.AddString(CString(str));
00119                 }
00120 
00121                 if(s.AudioRendererDisplayName == str && m_iAudioRendererType == 0)
00122                 {
00123                         m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
00124                 }
00125         }
00126         EndEnumSysDev
00127 
00128         m_AudioRendererDisplayNames.Add(AUDRNDT_NULL_COMP);
00129         m_iAudioRendererTypeCtrl.AddString(AUDRNDT_NULL_COMP);
00130         if(s.AudioRendererDisplayName == AUDRNDT_NULL_COMP && m_iAudioRendererType == 0)
00131                 m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
00132 
00133         m_AudioRendererDisplayNames.Add(AUDRNDT_NULL_UNCOMP);
00134         m_iAudioRendererTypeCtrl.AddString(AUDRNDT_NULL_UNCOMP);
00135         if(s.AudioRendererDisplayName == AUDRNDT_NULL_UNCOMP && m_iAudioRendererType == 0)
00136                 m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
00137 
00138         CorrectComboListWidth(m_iAudioRendererTypeCtrl, GetFont());
00139 
00140         UpdateData(FALSE);
00141 
00142 
00143         if(!AfxGetAppSettings().fXpOrBetter)
00144         {
00145                 GetDlgItem(IDC_DSVMR7WIN)->EnableWindow(FALSE);
00146                 GetDlgItem(IDC_DSVMR7REN)->EnableWindow(FALSE);
00147         }
00148 
00149         if(!IsCLSIDRegistered(CLSID_VideoMixingRenderer9))
00150         {
00151                 GetDlgItem(IDC_DSVMR9WIN)->EnableWindow(FALSE);
00152                 GetDlgItem(IDC_DSVMR9REN)->EnableWindow(FALSE);
00153                 GetDlgItem(IDC_RMDX9)->EnableWindow(FALSE);
00154                 GetDlgItem(IDC_QTDX9)->EnableWindow(FALSE);
00155         }
00156 
00157         CreateToolTip();
00158 
00159         return TRUE;  // return TRUE unless you set the focus to a control
00160         // EXCEPTION: OCX Property Pages should return FALSE
00161 }
00162 
00163 BOOL CPPageOutput::OnApply()
00164 {
00165         UpdateData();
00166 
00167         AppSettings& s = AfxGetAppSettings();
00168 
00169         s.iDSVideoRendererType = m_iDSVideoRendererType;
00170         s.iRMVideoRendererType = m_iRMVideoRendererType;
00171         s.iQTVideoRendererType = m_iQTVideoRendererType;
00172         s.iAPSurfaceUsage = m_iAPSurfaceUsage;
00173         s.fVMRSyncFix = !!m_fVMRSyncFix;
00174         s.AudioRendererDisplayName = m_AudioRendererDisplayNames[m_iAudioRendererType];
00175         s.iDX9Resizer = m_iDX9Resizer;
00176 
00177         return __super::OnApply();
00178 }
00179 

Generated on Tue Dec 13 14:47:01 2005 for guliverkli by  doxygen 1.4.5