00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "stdafx.h"
00027 #include "mplayerc.h"
00028 #include "PPageMpegDecoder.h"
00029 #include "..\..\filters\transform\Mpeg2DecFilter\Mpeg2DecFilter.h"
00030
00031
00032
00033 IMPLEMENT_DYNAMIC(CPPageMpegDecoder, CPPageBase)
00034 CPPageMpegDecoder::CPPageMpegDecoder(IFilterGraph* pFG)
00035 : CPPageBase(CPPageMpegDecoder::IDD, CPPageMpegDecoder::IDD)
00036 , m_fForcedSubs(FALSE)
00037 , m_fPlanarYUV(FALSE)
00038 {
00039 m_pMpeg2DecFilter = FindFilter(__uuidof(CMpeg2DecFilter), pFG);
00040 }
00041
00042 CPPageMpegDecoder::~CPPageMpegDecoder()
00043 {
00044 }
00045
00046 void CPPageMpegDecoder::DoDataExchange(CDataExchange* pDX)
00047 {
00048 __super::DoDataExchange(pDX);
00049 DDX_Control(pDX, IDC_COMBO2, m_dilist);
00050 DDX_Control(pDX, IDC_SLIDER1, m_brightctrl);
00051 DDX_Control(pDX, IDC_SLIDER2, m_contctrl);
00052 DDX_Control(pDX, IDC_SLIDER3, m_huectrl);
00053 DDX_Control(pDX, IDC_SLIDER4, m_satctrl);
00054 DDX_Check(pDX, IDC_CHECK1, m_fForcedSubs);
00055 DDX_Check(pDX, IDC_CHECK2, m_fPlanarYUV);
00056 }
00057
00058
00059 BEGIN_MESSAGE_MAP(CPPageMpegDecoder, CPPageBase)
00060 ON_CBN_SELCHANGE(IDC_COMBO2, OnCbnSelchangeCombo2)
00061 ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1)
00062 ON_WM_HSCROLL()
00063 ON_BN_CLICKED(IDC_CHECK1, OnBnClickedCheck1)
00064 ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
00065 ON_BN_CLICKED(IDC_CHECK2, OnBnClickedCheck2)
00066 ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
00067 END_MESSAGE_MAP()
00068
00069
00070
00071
00072 BOOL CPPageMpegDecoder::OnInitDialog()
00073 {
00074 __super::OnInitDialog();
00075
00076 AppSettings& s = AfxGetAppSettings();
00077
00078 m_dilist.SetItemData(m_dilist.AddString(_T("Auto")), (DWORD)DIAuto);
00079 m_dilist.SetItemData(m_dilist.AddString(_T("Weave")), (DWORD)DIWeave);
00080 m_dilist.SetItemData(m_dilist.AddString(_T("Blend")), (DWORD)DIBlend);
00081 m_dilist.SetItemData(m_dilist.AddString(_T("Bob")), (DWORD)DIBob);
00082 m_dilist.SetCurSel(0);
00083 for(int i = 0; i < m_dilist.GetCount(); i++)
00084 if((int)m_dilist.GetItemData(i) == s.mpegdi)
00085 m_dilist.SetCurSel(i);
00086 m_brightctrl.SetRange(0, 2*128);
00087 m_brightctrl.SetTic(128);
00088 m_brightctrl.SetPos((int)(s.mpegbright)+128);
00089 m_contctrl.SetRange(0, 200);
00090 m_contctrl.SetTic(100);
00091 m_contctrl.SetPos((int)(100*s.mpegcont));
00092 m_huectrl.SetRange(0, 2*180);
00093 m_huectrl.SetTic(180);
00094 m_huectrl.SetPos((int)(s.mpeghue)+180);
00095 m_satctrl.SetRange(0, 200);
00096 m_satctrl.SetTic(100);
00097 m_satctrl.SetPos((int)(100*s.mpegsat));
00098 m_fForcedSubs = s.mpegforcedsubs;
00099 m_fPlanarYUV = s.mpegplanaryuv;
00100
00101 UpdateData(FALSE);
00102
00103 return TRUE;
00104
00105 }
00106
00107 BOOL CPPageMpegDecoder::OnApply()
00108 {
00109 UpdateData();
00110
00111 AppSettings& s = AfxGetAppSettings();
00112
00113 s.mpegdi = (int)m_dilist.GetItemData(m_dilist.GetCurSel());
00114 s.mpegbright = (double)m_brightctrl.GetPos()-128;
00115 s.mpegcont = (double)m_contctrl.GetPos() / 100;
00116 s.mpeghue = (double)m_huectrl.GetPos()-180;
00117 s.mpegsat = (double)m_satctrl.GetPos() / 100;
00118 s.mpegforcedsubs = !!m_fForcedSubs;
00119 s.mpegplanaryuv = !!m_fPlanarYUV;
00120
00121 if(m_pMpeg2DecFilter)
00122 {
00123 m_pMpeg2DecFilter->SetDeinterlaceMethod((ditype)s.mpegdi);
00124 m_pMpeg2DecFilter->SetBrightness(s.mpegbright);
00125 m_pMpeg2DecFilter->SetContrast(s.mpegcont);
00126 m_pMpeg2DecFilter->SetHue(s.mpeghue);
00127 m_pMpeg2DecFilter->SetSaturation(s.mpegsat);
00128 m_pMpeg2DecFilter->EnableForcedSubtitles(s.mpegforcedsubs);
00129 m_pMpeg2DecFilter->EnablePlanarYUV(s.mpegplanaryuv);
00130 }
00131
00132 return __super::OnApply();
00133 }
00134
00135 void CPPageMpegDecoder::OnCbnSelchangeCombo2()
00136 {
00137 SetModified();
00138
00139 if(m_pMpeg2DecFilter)
00140 m_pMpeg2DecFilter->SetDeinterlaceMethod((ditype)m_dilist.GetItemData(m_dilist.GetCurSel()));
00141 }
00142
00143 void CPPageMpegDecoder::OnCbnSelchangeCombo1()
00144 {
00145 SetModified();
00146 }
00147
00148 void CPPageMpegDecoder::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
00149 {
00150 SetModified();
00151
00152 if(m_pMpeg2DecFilter)
00153 {
00154 if(*pScrollBar == m_brightctrl)
00155 m_pMpeg2DecFilter->SetBrightness((double)m_brightctrl.GetPos()-128);
00156 else if(*pScrollBar == m_contctrl)
00157 m_pMpeg2DecFilter->SetContrast((double)m_contctrl.GetPos() / 100);
00158 else if(*pScrollBar == m_huectrl)
00159 m_pMpeg2DecFilter->SetHue((double)m_huectrl.GetPos()-180);
00160 else if(*pScrollBar == m_satctrl)
00161 m_pMpeg2DecFilter->SetSaturation((double)m_satctrl.GetPos() / 100);
00162 }
00163
00164 CPPageBase::OnHScroll(nSBCode, nPos, pScrollBar);
00165 }
00166
00167 void CPPageMpegDecoder::OnBnClickedCheck1()
00168 {
00169 SetModified();
00170
00171 UpdateData();
00172
00173 if(m_pMpeg2DecFilter)
00174 m_pMpeg2DecFilter->EnableForcedSubtitles(!!m_fForcedSubs);
00175 }
00176
00177 void CPPageMpegDecoder::OnBnClickedButton1()
00178 {
00179 SetModified();
00180
00181 m_brightctrl.SetPos(128);
00182 m_contctrl.SetPos(100);
00183 m_huectrl.SetPos(180);
00184 m_satctrl.SetPos(100);
00185
00186 if(m_pMpeg2DecFilter)
00187 {
00188 m_pMpeg2DecFilter->SetBrightness((double)m_brightctrl.GetPos()-128);
00189 m_pMpeg2DecFilter->SetContrast((double)m_contctrl.GetPos() / 100);
00190 m_pMpeg2DecFilter->SetHue((double)m_huectrl.GetPos()-180);
00191 m_pMpeg2DecFilter->SetSaturation((double)m_satctrl.GetPos() / 100);
00192 }
00193 }
00194
00195 void CPPageMpegDecoder::OnBnClickedCheck2()
00196 {
00197 SetModified();
00198
00199 UpdateData();
00200
00201 if(m_pMpeg2DecFilter)
00202 m_pMpeg2DecFilter->EnablePlanarYUV(!!m_fPlanarYUV);
00203 }
00204
00205 void CPPageMpegDecoder::OnBnClickedButton2()
00206 {
00207 SetModified();
00208
00209 m_brightctrl.SetPos(128-16);
00210 m_contctrl.SetPos(100*255/(235-16));
00211
00212 if(m_pMpeg2DecFilter)
00213 {
00214 m_pMpeg2DecFilter->SetBrightness((double)m_brightctrl.GetPos()-128);
00215 m_pMpeg2DecFilter->SetContrast((double)m_contctrl.GetPos() / 100);
00216 }
00217 }