PPageOutput.cpp
上传用户:tangyu_668
上传日期:2014-02-27
资源大小:678k
文件大小:6k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /* 
  2.  * Copyright (C) 2003-2006 Gabest
  3.  * http://www.gabest.org
  4.  *
  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.
  14.  *   
  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
  19.  *
  20.  */
  21. // CPPageOutput.cpp : implementation file
  22. //
  23. #include "stdafx.h"
  24. #include "mplayerc.h"
  25. #include "MainFrm.h"
  26. #include "PPageOutput.h"
  27. #include "../../../include/moreuuids.h"
  28. // CPPageOutput dialog
  29. IMPLEMENT_DYNAMIC(CPPageOutput, CPPageBase)
  30. CPPageOutput::CPPageOutput()
  31. : CPPageBase(CPPageOutput::IDD, CPPageOutput::IDD)
  32. , m_iDSVideoRendererType(0)
  33. , m_iRMVideoRendererType(0)
  34. , m_iQTVideoRendererType(0)
  35. , m_iAPSurfaceUsage(0)
  36. , m_iAudioRendererType(0)
  37. , m_fVMRSyncFix(FALSE)
  38. , m_iDX9Resizer(0)
  39. , m_fVMR9MixerMode(FALSE)
  40. , m_fVMR9MixerYUV(FALSE)
  41. {
  42. }
  43. CPPageOutput::~CPPageOutput()
  44. {
  45. }
  46. void CPPageOutput::DoDataExchange(CDataExchange* pDX)
  47. {
  48. __super::DoDataExchange(pDX);
  49. DDX_Radio(pDX, IDC_DSSYSDEF, m_iDSVideoRendererType);
  50. DDX_Radio(pDX, IDC_RMSYSDEF, m_iRMVideoRendererType);
  51. DDX_Radio(pDX, IDC_QTSYSDEF, m_iQTVideoRendererType);
  52. DDX_Radio(pDX, IDC_REGULARSURF, m_iAPSurfaceUsage);
  53. DDX_CBIndex(pDX, IDC_COMBO1, m_iAudioRendererType);
  54. DDX_Control(pDX, IDC_COMBO1, m_iAudioRendererTypeCtrl);
  55. DDX_Check(pDX, IDC_CHECK1, m_fVMRSyncFix);
  56. DDX_CBIndex(pDX, IDC_DX9RESIZER_COMBO, m_iDX9Resizer);
  57. DDX_Check(pDX, IDC_DSVMR9LOADMIXER, m_fVMR9MixerMode);
  58. DDX_Check(pDX, IDC_DSVMR9YUVMIXER, m_fVMR9MixerYUV);
  59. }
  60. BEGIN_MESSAGE_MAP(CPPageOutput, CPPageBase)
  61. ON_UPDATE_COMMAND_UI(IDC_DSVMR9YUVMIXER, OnUpdateMixerYUV)
  62. END_MESSAGE_MAP()
  63. void CPPageOutput::DisableRadioButton(UINT nID, UINT nDefID)
  64. {
  65. if(IsDlgButtonChecked(nID))
  66. {
  67. CheckDlgButton(nID, BST_UNCHECKED);
  68. CheckDlgButton(nDefID, BST_CHECKED);
  69. }
  70. GetDlgItem(nID)->EnableWindow(FALSE);
  71. }
  72. // CPPageOutput message handlers
  73. BOOL CPPageOutput::OnInitDialog()
  74. {
  75. __super::OnInitDialog();
  76. AppSettings& s = AfxGetAppSettings();
  77. m_iDSVideoRendererType = s.iDSVideoRendererType;
  78. m_iRMVideoRendererType = s.iRMVideoRendererType;
  79. m_iQTVideoRendererType = s.iQTVideoRendererType;
  80. m_iAPSurfaceUsage = s.iAPSurfaceUsage;
  81. m_fVMRSyncFix = s.fVMRSyncFix;
  82. m_iDX9Resizer = s.iDX9Resizer;
  83. m_fVMR9MixerMode = s.fVMR9MixerMode;
  84. m_fVMR9MixerYUV = s.fVMR9MixerYUV;
  85. m_AudioRendererDisplayNames.Add(_T(""));
  86. m_iAudioRendererTypeCtrl.AddString(_T("System Default"));
  87. m_iAudioRendererType = 0;
  88. BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker)
  89. {
  90. LPOLESTR olestr = NULL;
  91. if(FAILED(pMoniker->GetDisplayName(0, 0, &olestr)))
  92. continue;
  93. CStringW str(olestr);
  94. CoTaskMemFree(olestr);
  95. m_AudioRendererDisplayNames.Add(CString(str));
  96. CComPtr<IPropertyBag> pPB;
  97. if(SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
  98. {
  99. CComVariant var;
  100. pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL);
  101. CString fstr(var.bstrVal);
  102. var.Clear();
  103. if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL)))
  104. {
  105. BSTR* pbstr;
  106. if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pbstr)))
  107. {
  108. fstr.Format(_T("%s (%08x)"), CString(fstr), *((DWORD*)pbstr + 1));
  109. SafeArrayUnaccessData(var.parray);
  110. }
  111. }
  112. m_iAudioRendererTypeCtrl.AddString(fstr);
  113. }
  114. else
  115. {
  116. m_iAudioRendererTypeCtrl.AddString(CString(str));
  117. }
  118. if(s.AudioRendererDisplayName == str && m_iAudioRendererType == 0)
  119. {
  120. m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
  121. }
  122. }
  123. EndEnumSysDev
  124. m_AudioRendererDisplayNames.Add(AUDRNDT_NULL_COMP);
  125. m_iAudioRendererTypeCtrl.AddString(AUDRNDT_NULL_COMP);
  126. if(s.AudioRendererDisplayName == AUDRNDT_NULL_COMP && m_iAudioRendererType == 0)
  127. m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
  128. m_AudioRendererDisplayNames.Add(AUDRNDT_NULL_UNCOMP);
  129. m_iAudioRendererTypeCtrl.AddString(AUDRNDT_NULL_UNCOMP);
  130. if(s.AudioRendererDisplayName == AUDRNDT_NULL_UNCOMP && m_iAudioRendererType == 0)
  131. m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
  132. CorrectComboListWidth(m_iAudioRendererTypeCtrl, GetFont());
  133. UpdateData(FALSE);
  134. if(!IsCLSIDRegistered(CLSID_VideoMixingRenderer))
  135. {
  136. DisableRadioButton(IDC_DSVMR7WIN, IDC_DSSYSDEF);
  137. DisableRadioButton(IDC_DSVMR7REN, IDC_DSSYSDEF);
  138. }
  139. if(!IsCLSIDRegistered(CLSID_VideoMixingRenderer9))
  140. {
  141. DisableRadioButton(IDC_DSVMR9WIN, IDC_DSSYSDEF);
  142. DisableRadioButton(IDC_DSVMR9REN, IDC_DSSYSDEF);
  143. DisableRadioButton(IDC_RMDX9, IDC_RMSYSDEF);
  144. DisableRadioButton(IDC_QTDX9, IDC_QTSYSDEF);
  145. }
  146. if(!IsCLSIDRegistered(CLSID_DXR))
  147. {
  148. DisableRadioButton(IDC_DSDXR, IDC_DSSYSDEF);
  149. }
  150. CreateToolTip();
  151. return TRUE;  // return TRUE unless you set the focus to a control
  152. // EXCEPTION: OCX Property Pages should return FALSE
  153. }
  154. BOOL CPPageOutput::OnApply()
  155. {
  156. UpdateData();
  157. AppSettings& s = AfxGetAppSettings();
  158. s.iDSVideoRendererType = m_iDSVideoRendererType;
  159. s.iRMVideoRendererType = m_iRMVideoRendererType;
  160. s.iQTVideoRendererType = m_iQTVideoRendererType;
  161. s.iAPSurfaceUsage = m_iAPSurfaceUsage;
  162. s.fVMRSyncFix = !!m_fVMRSyncFix;
  163. s.AudioRendererDisplayName = m_AudioRendererDisplayNames[m_iAudioRendererType];
  164. s.iDX9Resizer = m_iDX9Resizer;
  165. s.fVMR9MixerMode = !!m_fVMR9MixerMode;
  166. s.fVMR9MixerYUV = !!m_fVMR9MixerYUV;
  167. return __super::OnApply();
  168. }
  169. void CPPageOutput::OnUpdateMixerYUV(CCmdUI* pCmdUI)
  170. {
  171. pCmdUI->Enable(!!IsDlgButtonChecked(IDC_DSVMR9LOADMIXER));
  172. }