diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-07-05 16:58:42 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-07-05 16:58:42 +0400 |
commit | f6883a2c09507d0acb9ccbf0156e5948211dc480 (patch) | |
tree | 7789b4fecd6b2e846f070e2e0bdb1e16ea7555e9 /src/apps/mplayerc/SaveDlg.cpp | |
parent | e9b446380bc3bc122e3e3a1d0622163a5f1920a3 (diff) |
astyle formatting
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2103 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/SaveDlg.cpp')
-rw-r--r-- | src/apps/mplayerc/SaveDlg.cpp | 318 |
1 files changed, 159 insertions, 159 deletions
diff --git a/src/apps/mplayerc/SaveDlg.cpp b/src/apps/mplayerc/SaveDlg.cpp index 546419e67..1bd8047aa 100644 --- a/src/apps/mplayerc/SaveDlg.cpp +++ b/src/apps/mplayerc/SaveDlg.cpp @@ -32,9 +32,9 @@ IMPLEMENT_DYNAMIC(CSaveDlg, CCmdUIDialog)
CSaveDlg::CSaveDlg(CString in, CString out, CWnd* pParent /*=NULL*/)
- : CCmdUIDialog(CSaveDlg::IDD, pParent)
- , m_in(in), m_out(out)
- , m_nIDTimerEvent((UINT_PTR)-1)
+ : CCmdUIDialog(CSaveDlg::IDD, pParent)
+ , m_in(in), m_out(out)
+ , m_nIDTimerEvent((UINT_PTR)-1)
{
}
@@ -44,18 +44,18 @@ CSaveDlg::~CSaveDlg() void CSaveDlg::DoDataExchange(CDataExchange* pDX)
{
- CCmdUIDialog::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_ANIMATE1, m_anim);
- DDX_Control(pDX, IDC_PROGRESS1, m_progress);
- DDX_Control(pDX, IDC_REPORT, m_report);
- DDX_Control(pDX, IDC_FROMTO, m_fromto);
+ CCmdUIDialog::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_ANIMATE1, m_anim);
+ DDX_Control(pDX, IDC_PROGRESS1, m_progress);
+ DDX_Control(pDX, IDC_REPORT, m_report);
+ DDX_Control(pDX, IDC_FROMTO, m_fromto);
}
BEGIN_MESSAGE_MAP(CSaveDlg, CCmdUIDialog)
- ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
- ON_MESSAGE(WM_GRAPHNOTIFY, OnGraphNotify)
- ON_WM_TIMER()
+ ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
+ ON_MESSAGE(WM_GRAPHNOTIFY, OnGraphNotify)
+ ON_WM_TIMER()
END_MESSAGE_MAP()
@@ -63,184 +63,184 @@ END_MESSAGE_MAP() BOOL CSaveDlg::OnInitDialog()
{
- CCmdUIDialog::OnInitDialog();
+ CCmdUIDialog::OnInitDialog();
- m_anim.Open(IDR_AVI_FILECOPY);
- m_anim.Play(0, (UINT)-1, (UINT)-1);
+ m_anim.Open(IDR_AVI_FILECOPY);
+ m_anim.Play(0, (UINT)-1, (UINT)-1);
- CString str, in = m_in, out = m_out;
- if(in.GetLength() > 60) in = in.Left(17) + _T("..") + in.Right(43);
- if(out.GetLength() > 60) out = out.Left(17) + _T("..") + out.Right(43);
- str.Format(_T("%s\r\n%s"), in, out);
- m_fromto.SetWindowText(str);
+ CString str, in = m_in, out = m_out;
+ if(in.GetLength() > 60) in = in.Left(17) + _T("..") + in.Right(43);
+ if(out.GetLength() > 60) out = out.Left(17) + _T("..") + out.Right(43);
+ str.Format(_T("%s\r\n%s"), in, out);
+ m_fromto.SetWindowText(str);
- m_progress.SetRange(0, 100);
+ m_progress.SetRange(0, 100);
- if(FAILED(pGB.CoCreateInstance(CLSID_FilterGraph)) || !(pMC = pGB) || !(pME = pGB) || !(pMS = pGB)
- || FAILED(pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0)))
- {
- m_report.SetWindowText(_T("Error"));
- return FALSE;
- }
+ if(FAILED(pGB.CoCreateInstance(CLSID_FilterGraph)) || !(pMC = pGB) || !(pME = pGB) || !(pMS = pGB)
+ || FAILED(pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0)))
+ {
+ m_report.SetWindowText(_T("Error"));
+ return FALSE;
+ }
- HRESULT hr;
+ HRESULT hr;
- CStringW fnw = m_in;
- CComPtr<IFileSourceFilter> pReader;
+ CStringW fnw = m_in;
+ CComPtr<IFileSourceFilter> pReader;
#if INTERNAL_SOURCEFILTER_CDDA
- if(!pReader && m_in.Mid(m_in.ReverseFind('.')+1).MakeLower() == _T("cda"))
- {
- hr = S_OK;
- CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CCDDAReader(NULL, &hr);
- if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
- pReader.Release();
- }
+ if(!pReader && m_in.Mid(m_in.ReverseFind('.')+1).MakeLower() == _T("cda"))
+ {
+ hr = S_OK;
+ CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CCDDAReader(NULL, &hr);
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
+ pReader.Release();
+ }
#endif
#if INTERNAL_SOURCEFILTER_CDXA
- if(!pReader)
- {
- hr = S_OK;
- CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CCDXAReader(NULL, &hr);
- if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
- pReader.Release();
- }
+ if(!pReader)
+ {
+ hr = S_OK;
+ CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CCDXAReader(NULL, &hr);
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
+ pReader.Release();
+ }
#endif
#if INTERNAL_SOURCEFILTER_VTS
- if(!pReader /*&& ext == _T("ifo")*/)
- {
- hr = S_OK;
- CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CVTSReader(NULL, &hr);
- if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
- pReader.Release();
- else
- {
- CPath pout(m_out);
- pout.RenameExtension(_T(".ifo"));
- CopyFile(m_in, pout, FALSE);
- }
- }
+ if(!pReader /*&& ext == _T("ifo")*/)
+ {
+ hr = S_OK;
+ CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CVTSReader(NULL, &hr);
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
+ pReader.Release();
+ else
+ {
+ CPath pout(m_out);
+ pout.RenameExtension(_T(".ifo"));
+ CopyFile(m_in, pout, FALSE);
+ }
+ }
#endif
- if(!pReader)
- {
- hr = S_OK;
- CComPtr<IUnknown> pUnk;
- pUnk.CoCreateInstance(CLSID_AsyncReader);
- if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
- pReader.Release();
- }
-
- if(!pReader)
- {
- hr = S_OK;
- CComPtr<IUnknown> pUnk;
- pUnk.CoCreateInstance(CLSID_URLReader);
- if(CComQIPtr<IBaseFilter> pSrc = pUnk) // url reader has to be in the graph to load the file
- {
- pGB->AddFilter(pSrc, fnw);
- if(FAILED(hr) || !(pReader = pUnk) || FAILED(hr = pReader->Load(fnw, NULL)))
- {
- pReader.Release();
- pGB->RemoveFilter(pSrc);
- }
- }
- }
-
- CComQIPtr<IBaseFilter> pSrc = pReader;
- if(FAILED(pGB->AddFilter(pSrc, fnw)))
- {
- m_report.SetWindowText(_T("Sorry, can't save this file, press cancel"));
- return FALSE;
- }
-
- CComQIPtr<IBaseFilter> pMid = DNew CStreamDriveThruFilter(NULL, &hr);
- if(FAILED(pGB->AddFilter(pMid, L"StreamDriveThru")))
- {
- m_report.SetWindowText(_T("Error"));
- return FALSE;
- }
-
- CComQIPtr<IBaseFilter> pDst;
- pDst.CoCreateInstance(CLSID_FileWriter);
- CComQIPtr<IFileSinkFilter2> pFSF = pDst;
- pFSF->SetFileName(CStringW(m_out), NULL);
- pFSF->SetMode(AM_FILE_OVERWRITE);
- if(FAILED(pGB->AddFilter(pDst, L"File Writer")))
- {
- m_report.SetWindowText(_T("Error"));
- return FALSE;
- }
-
- hr = pGB->Connect(
- GetFirstPin((pSrc), PINDIR_OUTPUT),
- GetFirstPin((pMid), PINDIR_INPUT));
-
- hr = pGB->Connect(
- GetFirstPin((pMid), PINDIR_OUTPUT),
- GetFirstPin((pDst), PINDIR_INPUT));
-
- pMS = pMid;
-
- pMC->Run();
-
- m_nIDTimerEvent = SetTimer(1, 1000, NULL);
-
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
+ if(!pReader)
+ {
+ hr = S_OK;
+ CComPtr<IUnknown> pUnk;
+ pUnk.CoCreateInstance(CLSID_AsyncReader);
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
+ pReader.Release();
+ }
+
+ if(!pReader)
+ {
+ hr = S_OK;
+ CComPtr<IUnknown> pUnk;
+ pUnk.CoCreateInstance(CLSID_URLReader);
+ if(CComQIPtr<IBaseFilter> pSrc = pUnk) // url reader has to be in the graph to load the file
+ {
+ pGB->AddFilter(pSrc, fnw);
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(hr = pReader->Load(fnw, NULL)))
+ {
+ pReader.Release();
+ pGB->RemoveFilter(pSrc);
+ }
+ }
+ }
+
+ CComQIPtr<IBaseFilter> pSrc = pReader;
+ if(FAILED(pGB->AddFilter(pSrc, fnw)))
+ {
+ m_report.SetWindowText(_T("Sorry, can't save this file, press cancel"));
+ return FALSE;
+ }
+
+ CComQIPtr<IBaseFilter> pMid = DNew CStreamDriveThruFilter(NULL, &hr);
+ if(FAILED(pGB->AddFilter(pMid, L"StreamDriveThru")))
+ {
+ m_report.SetWindowText(_T("Error"));
+ return FALSE;
+ }
+
+ CComQIPtr<IBaseFilter> pDst;
+ pDst.CoCreateInstance(CLSID_FileWriter);
+ CComQIPtr<IFileSinkFilter2> pFSF = pDst;
+ pFSF->SetFileName(CStringW(m_out), NULL);
+ pFSF->SetMode(AM_FILE_OVERWRITE);
+ if(FAILED(pGB->AddFilter(pDst, L"File Writer")))
+ {
+ m_report.SetWindowText(_T("Error"));
+ return FALSE;
+ }
+
+ hr = pGB->Connect(
+ GetFirstPin((pSrc), PINDIR_OUTPUT),
+ GetFirstPin((pMid), PINDIR_INPUT));
+
+ hr = pGB->Connect(
+ GetFirstPin((pMid), PINDIR_OUTPUT),
+ GetFirstPin((pDst), PINDIR_INPUT));
+
+ pMS = pMid;
+
+ pMC->Run();
+
+ m_nIDTimerEvent = SetTimer(1, 1000, NULL);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
}
void CSaveDlg::OnBnClickedCancel()
{
- if(pMC) pMC->Stop();
+ if(pMC) pMC->Stop();
- OnCancel();
+ OnCancel();
}
LRESULT CSaveDlg::OnGraphNotify(WPARAM wParam, LPARAM lParam)
{
- LONG evCode, evParam1, evParam2;
- while(pME && SUCCEEDED(pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0)))
- {
+ LONG evCode, evParam1, evParam2;
+ while(pME && SUCCEEDED(pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0)))
+ {
HRESULT hr = pME->FreeEventParams(evCode, evParam1, evParam2);
UNUSED_ALWAYS(hr);
- if(EC_COMPLETE == evCode)
- {
- EndDialog(IDOK);
- }
- else if(EC_ERRORABORT == evCode)
- {
- TRACE(_T("CSaveDlg::OnGraphNotify / EC_ERRORABORT, hr = %08x\n"), (HRESULT)evParam1);
- m_report.SetWindowText(_T("Copying unexpectedly terminated!"));
- }
- }
-
- return 0;
+ if(EC_COMPLETE == evCode)
+ {
+ EndDialog(IDOK);
+ }
+ else if(EC_ERRORABORT == evCode)
+ {
+ TRACE(_T("CSaveDlg::OnGraphNotify / EC_ERRORABORT, hr = %08x\n"), (HRESULT)evParam1);
+ m_report.SetWindowText(_T("Copying unexpectedly terminated!"));
+ }
+ }
+
+ return 0;
}
void CSaveDlg::OnTimer(UINT_PTR nIDEvent)
{
- if(nIDEvent == m_nIDTimerEvent && pGB)
- {
- if(pMS)
- {
- CString str;
- REFERENCE_TIME pos = 0, dur = 0;
- pMS->GetCurrentPosition(&pos);
- pMS->GetDuration(&dur);
- REFERENCE_TIME time = 0;
- CComQIPtr<IMediaSeeking>(pGB)->GetCurrentPosition(&time);
- REFERENCE_TIME speed = time > 0 ? pos*10000000/time / 1024 : 0i64;
- str.Format(_T("%I64d/%I64d KB, %I64d KB/s, %I64d s"),
- pos/1024, dur/1024, speed, speed > 0 ? (dur-pos)/1024 / speed : 0);
- m_report.SetWindowText(str);
-
- m_progress.SetPos(dur > 0 ? (int)(100*pos/dur) : 0);
- }
- }
-
- CCmdUIDialog::OnTimer(nIDEvent);
+ if(nIDEvent == m_nIDTimerEvent && pGB)
+ {
+ if(pMS)
+ {
+ CString str;
+ REFERENCE_TIME pos = 0, dur = 0;
+ pMS->GetCurrentPosition(&pos);
+ pMS->GetDuration(&dur);
+ REFERENCE_TIME time = 0;
+ CComQIPtr<IMediaSeeking>(pGB)->GetCurrentPosition(&time);
+ REFERENCE_TIME speed = time > 0 ? pos*10000000/time / 1024 : 0i64;
+ str.Format(_T("%I64d/%I64d KB, %I64d KB/s, %I64d s"),
+ pos/1024, dur/1024, speed, speed > 0 ? (dur-pos)/1024 / speed : 0);
+ m_report.SetWindowText(str);
+
+ m_progress.SetPos(dur > 0 ? (int)(100*pos/dur) : 0);
+ }
+ }
+
+ CCmdUIDialog::OnTimer(nIDEvent);
}
|