diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-12-17 19:42:55 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-12-17 19:42:55 +0300 |
commit | 7359bd509afa235acc2ac2f7f95fc9cb5cafd1a4 (patch) | |
tree | b5bb90eeca58fdeb9fde6825f21a25a319823cb4 /src/apps | |
parent | d30b15ed4b98c28951d6d45b8928f4c2b6a11129 (diff) |
apply astyle formatting
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2786 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps')
189 files changed, 13751 insertions, 14491 deletions
diff --git a/src/apps/MPCTestAPI/MPCTestAPI.cpp b/src/apps/MPCTestAPI/MPCTestAPI.cpp index 3887155d2..5a99a25de 100644 --- a/src/apps/MPCTestAPI/MPCTestAPI.cpp +++ b/src/apps/MPCTestAPI/MPCTestAPI.cpp @@ -58,13 +58,10 @@ BOOL CRegisterCopyDataApp::InitInstance() CRegisterCopyDataDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
- if (nResponse == IDOK)
- {
+ if (nResponse == IDOK) {
// TODO: Place code here to handle when the dialog is
// dismissed with OK
- }
- else if (nResponse == IDCANCEL)
- {
+ } else if (nResponse == IDCANCEL) {
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
diff --git a/src/apps/MPCTestAPI/MPCTestAPI.h b/src/apps/MPCTestAPI/MPCTestAPI.h index 11e90ae6e..75c7c7651 100644 --- a/src/apps/MPCTestAPI/MPCTestAPI.h +++ b/src/apps/MPCTestAPI/MPCTestAPI.h @@ -18,14 +18,14 @@ class CRegisterCopyDataApp : public CWinApp public:
CRegisterCopyDataApp();
-// Overrides
+ // Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRegisterCopyDataApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
-// Implementation
+ // Implementation
//{{AFX_MSG(CRegisterCopyDataApp)
// NOTE - the ClassWizard will add and remove member functions here.
diff --git a/src/apps/MPCTestAPI/MPCTestAPIDlg.cpp b/src/apps/MPCTestAPI/MPCTestAPIDlg.cpp index 81fa51d86..5ecf1eb76 100644 --- a/src/apps/MPCTestAPI/MPCTestAPIDlg.cpp +++ b/src/apps/MPCTestAPI/MPCTestAPIDlg.cpp @@ -15,24 +15,23 @@ static char THIS_FILE[] = __FILE__; LPCTSTR GetMPCCommandName(MPCAPI_COMMAND nCmd)
{
- switch (nCmd)
- {
- case CMD_CONNECT :
- return _T("CMD_CONNECT");
- case CMD_STATE :
- return _T("CMD_STATE");
- case CMD_PLAYMODE :
- return _T("CMD_PLAYMODE");
- case CMD_NOWPLAYING :
- return _T("CMD_NOWPLAYING");
- case CMD_LISTSUBTITLETRACKS :
- return _T("CMD_LISTSUBTITLETRACKS");
- case CMD_LISTAUDIOTRACKS :
- return _T("CMD_LISTAUDIOTRACKS");
- case CMD_PLAYLIST :
- return _T("CMD_PLAYLIST");
- default :
- return _T("CMD_UNK");
+ switch (nCmd) {
+ case CMD_CONNECT :
+ return _T("CMD_CONNECT");
+ case CMD_STATE :
+ return _T("CMD_STATE");
+ case CMD_PLAYMODE :
+ return _T("CMD_PLAYMODE");
+ case CMD_NOWPLAYING :
+ return _T("CMD_NOWPLAYING");
+ case CMD_LISTSUBTITLETRACKS :
+ return _T("CMD_LISTSUBTITLETRACKS");
+ case CMD_LISTAUDIOTRACKS :
+ return _T("CMD_LISTAUDIOTRACKS");
+ case CMD_PLAYLIST :
+ return _T("CMD_PLAYLIST");
+ default :
+ return _T("CMD_UNK");
}
}
@@ -44,7 +43,7 @@ class CAboutDlg : public CDialog public:
CAboutDlg();
-// Dialog Data
+ // Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
@@ -55,7 +54,7 @@ protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
-// Implementation
+ // Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
@@ -135,12 +134,10 @@ BOOL CRegisterCopyDataDlg::OnInitDialog() ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
- if (pSysMenu != NULL)
- {
+ if (pSysMenu != NULL) {
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
- if (!strAboutMenu.IsEmpty())
- {
+ if (!strAboutMenu.IsEmpty()) {
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
@@ -152,19 +149,19 @@ BOOL CRegisterCopyDataDlg::OnInitDialog() SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
- #if (_MSC_VER == 1600)
- #if defined (_DEBUG)
- m_strMPCPath = _T("..\\..\\..\\..\\..\\bin10\\mpc-hc_x86_Debug\\mpc-hc.exe");
- #else
- m_strMPCPath = _T("..\\..\\..\\..\\..\\bin10\\mpc-hc_x86\\mpc-hc.exe");
- #endif
- #elif (_MSC_VER < 1600)
- #if defined (_DEBUG)
- m_strMPCPath = _T("..\\..\\..\\..\\..\\bin\\mpc-hc_x86_Debug\\mpc-hc.exe");
- #else
- m_strMPCPath = _T("..\\..\\..\\..\\..\\bin\\mpc-hc_x86\\mpc-hc.exe");
- #endif
- #endif
+#if (_MSC_VER == 1600)
+#if defined (_DEBUG)
+ m_strMPCPath = _T("..\\..\\..\\..\\..\\bin10\\mpc-hc_x86_Debug\\mpc-hc.exe");
+#else
+ m_strMPCPath = _T("..\\..\\..\\..\\..\\bin10\\mpc-hc_x86\\mpc-hc.exe");
+#endif
+#elif (_MSC_VER < 1600)
+#if defined (_DEBUG)
+ m_strMPCPath = _T("..\\..\\..\\..\\..\\bin\\mpc-hc_x86_Debug\\mpc-hc.exe");
+#else
+ m_strMPCPath = _T("..\\..\\..\\..\\..\\bin\\mpc-hc_x86\\mpc-hc.exe");
+#endif
+#endif
UpdateData(FALSE);
@@ -173,13 +170,10 @@ BOOL CRegisterCopyDataDlg::OnInitDialog() void CRegisterCopyDataDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
- if ((nID & 0xFFF0) == IDM_ABOUTBOX)
- {
+ if ((nID & 0xFFF0) == IDM_ABOUTBOX) {
CAboutDlg dlgAbout;
dlgAbout.DoModal();
- }
- else
- {
+ } else {
CDialog::OnSysCommand(nID, lParam);
}
}
@@ -190,8 +184,7 @@ void CRegisterCopyDataDlg::OnSysCommand(UINT nID, LPARAM lParam) void CRegisterCopyDataDlg::OnPaint()
{
- if (IsIconic())
- {
+ if (IsIconic()) {
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
@@ -206,9 +199,7 @@ void CRegisterCopyDataDlg::OnPaint() // Draw the icon
dc.DrawIcon(x, y, m_hIcon);
- }
- else
- {
+ } else {
CDialog::OnPaint();
}
}
@@ -238,8 +229,7 @@ void CRegisterCopyDataDlg::OnButtonFindwindow() }
-struct MyStruct
-{
+struct MyStruct {
int nNum;
TCHAR szData[256];
@@ -247,8 +237,7 @@ struct MyStruct void CRegisterCopyDataDlg::Senddata(MPCAPI_COMMAND nCmd, LPCTSTR strCommand)
{
- if (m_hWndMPC)
- {
+ if (m_hWndMPC) {
COPYDATASTRUCT MyCDS;
MyCDS.dwData = nCmd;
@@ -264,8 +253,9 @@ BOOL CRegisterCopyDataDlg::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruc CString strMsg;
MyStruct *tcsBuff=(MyStruct*)(pCopyDataStruct->lpData);
- if (pCopyDataStruct->dwData == CMD_CONNECT)
+ if (pCopyDataStruct->dwData == CMD_CONNECT) {
m_hWndMPC = (HWND)_wtol((LPCTSTR)pCopyDataStruct->lpData);
+ }
strMsg.Format (_T("%s : %s"), GetMPCCommandName ((MPCAPI_COMMAND)pCopyDataStruct->dwData), (LPCTSTR)pCopyDataStruct->lpData);
m_lbLog.InsertString (0, strMsg);
@@ -279,76 +269,75 @@ void CRegisterCopyDataDlg::OnBnClickedButtonSendcommand() CString strEmpty (_T(""));
UpdateData(TRUE);
- switch (m_nCommandType)
- {
- case 0 :
- Senddata (CMD_OPENFILE, m_txtCommand);
- break;
- case 1 :
- Senddata (CMD_STOP, strEmpty);
- break;
- case 2 :
- Senddata (CMD_CLOSEFILE, strEmpty);
- break;
- case 3 :
- Senddata (CMD_PLAYPAUSE, strEmpty);
- break;
- case 4 :
- Senddata (CMD_ADDTOPLAYLIST, m_txtCommand);
- break;
- case 5 :
- Senddata (CMD_STARTPLAYLIST, strEmpty);
- break;
- case 6 :
- Senddata (CMD_CLEARPLAYLIST, strEmpty);
- break;
- case 7 :
- Senddata (CMD_SETPOSITION, m_txtCommand);
- break;
- case 8 :
- Senddata (CMD_SETAUDIODELAY, m_txtCommand);
- break;
- case 9 :
- Senddata (CMD_SETSUBTITLEDELAY, m_txtCommand);
- break;
- case 10 :
- Senddata (CMD_GETAUDIOTRACKS, strEmpty);
- break;
- case 11 :
- Senddata (CMD_GETSUBTITLETRACKS, strEmpty);
- break;
- case 12 :
- Senddata (CMD_GETPLAYLIST, strEmpty);
- break;
- case 13 :
- Senddata (CMD_SETINDEXPLAYLIST, m_txtCommand);
- break;
- case 14 :
- Senddata (CMD_SETAUDIOTRACK, m_txtCommand);
- break;
- case 15 :
- Senddata (CMD_SETSUBTITLETRACK, m_txtCommand);
- break;
- case 16 :
- Senddata (CMD_TOGGLEFULLSCREEN, m_txtCommand);
- break;
- case 17 :
- Senddata (CMD_JUMPFORWARDMED, m_txtCommand);
- break;
- case 18 :
- Senddata (CMD_JUMPBACKWARDMED, m_txtCommand);
- break;
- case 19 :
- Senddata (CMD_INCREASEVOLUME, m_txtCommand);
- break;
- case 20 :
- Senddata (CMD_DECREASEVOLUME, m_txtCommand);
- break;
- case 21 :
- Senddata (CMD_SHADER_TOGGLE, m_txtCommand);
- break;
- case 22 :
- Senddata (CMD_CLOSEAPP, m_txtCommand);
- break;
+ switch (m_nCommandType) {
+ case 0 :
+ Senddata (CMD_OPENFILE, m_txtCommand);
+ break;
+ case 1 :
+ Senddata (CMD_STOP, strEmpty);
+ break;
+ case 2 :
+ Senddata (CMD_CLOSEFILE, strEmpty);
+ break;
+ case 3 :
+ Senddata (CMD_PLAYPAUSE, strEmpty);
+ break;
+ case 4 :
+ Senddata (CMD_ADDTOPLAYLIST, m_txtCommand);
+ break;
+ case 5 :
+ Senddata (CMD_STARTPLAYLIST, strEmpty);
+ break;
+ case 6 :
+ Senddata (CMD_CLEARPLAYLIST, strEmpty);
+ break;
+ case 7 :
+ Senddata (CMD_SETPOSITION, m_txtCommand);
+ break;
+ case 8 :
+ Senddata (CMD_SETAUDIODELAY, m_txtCommand);
+ break;
+ case 9 :
+ Senddata (CMD_SETSUBTITLEDELAY, m_txtCommand);
+ break;
+ case 10 :
+ Senddata (CMD_GETAUDIOTRACKS, strEmpty);
+ break;
+ case 11 :
+ Senddata (CMD_GETSUBTITLETRACKS, strEmpty);
+ break;
+ case 12 :
+ Senddata (CMD_GETPLAYLIST, strEmpty);
+ break;
+ case 13 :
+ Senddata (CMD_SETINDEXPLAYLIST, m_txtCommand);
+ break;
+ case 14 :
+ Senddata (CMD_SETAUDIOTRACK, m_txtCommand);
+ break;
+ case 15 :
+ Senddata (CMD_SETSUBTITLETRACK, m_txtCommand);
+ break;
+ case 16 :
+ Senddata (CMD_TOGGLEFULLSCREEN, m_txtCommand);
+ break;
+ case 17 :
+ Senddata (CMD_JUMPFORWARDMED, m_txtCommand);
+ break;
+ case 18 :
+ Senddata (CMD_JUMPBACKWARDMED, m_txtCommand);
+ break;
+ case 19 :
+ Senddata (CMD_INCREASEVOLUME, m_txtCommand);
+ break;
+ case 20 :
+ Senddata (CMD_DECREASEVOLUME, m_txtCommand);
+ break;
+ case 21 :
+ Senddata (CMD_SHADER_TOGGLE, m_txtCommand);
+ break;
+ case 22 :
+ Senddata (CMD_CLOSEAPP, m_txtCommand);
+ break;
}
}
diff --git a/src/apps/MPCTestAPI/MPCTestAPIDlg.h b/src/apps/MPCTestAPI/MPCTestAPIDlg.h index d3f86f147..bb362241b 100644 --- a/src/apps/MPCTestAPI/MPCTestAPIDlg.h +++ b/src/apps/MPCTestAPI/MPCTestAPIDlg.h @@ -14,12 +14,12 @@ class CRegisterCopyDataDlg : public CDialog
{
-// Construction
+ // Construction
public:
HWND m_RemoteWindow;
CRegisterCopyDataDlg(CWnd* pParent = NULL); // standard constructor
-// Dialog Data
+ // Dialog Data
//{{AFX_DATA(CRegisterCopyDataDlg)
enum { IDD = IDD_REGISTERCOPYDATA_DIALOG };
// NOTE: the ClassWizard will add data members here
@@ -31,7 +31,7 @@ protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
-// Implementation
+ // Implementation
protected:
HICON m_hIcon;
HWND m_hWndMPC;
diff --git a/src/apps/mplayerc/AppSettings.cpp b/src/apps/mplayerc/AppSettings.cpp index f4c54537a..367a230fb 100644 --- a/src/apps/mplayerc/AppSettings.cpp +++ b/src/apps/mplayerc/AppSettings.cpp @@ -36,7 +36,7 @@ CAppSettings::CAppSettings() , nCmdlnWebServerPort(-1)
, fShowDebugInfo(false)
{
-// Internal source filter
+ // Internal source filter
#if INTERNAL_SOURCEFILTER_CDDA
SrcFiltersKeys[SRC_CDDA] = _T("SRC_CDDA");
#endif
@@ -90,7 +90,7 @@ CAppSettings::CAppSettings() SrcFiltersKeys[SRC_FLAC] = _T("SRC_FLAC");
#endif
-// Internal decoders
+ // Internal decoders
#if INTERNAL_DECODER_MPEG1
TraFiltersKeys[TRA_MPEG1] = _T("TRA_MPEG1");
#endif
@@ -135,7 +135,7 @@ CAppSettings::CAppSettings() TraFiltersKeys[TRA_PCM] = _T("TRA_PCM");
#endif
-// Internal DXVA decoders
+ // Internal DXVA decoders
#if INTERNAL_DECODER_H264_DXVA
DXVAFiltersKeys[TRA_DXVA_H264] = _T("TRA_DXVA_H264");
#endif
@@ -146,7 +146,7 @@ CAppSettings::CAppSettings() DXVAFiltersKeys[TRA_DXVA_MPEG2] = _T("TRA_DXVA_MPEG2");
#endif
-// Internal FFMpeg decoders
+ // Internal FFMpeg decoders
#if INTERNAL_DECODER_H264
FFMFiltersKeys[FFM_H264] = _T("FFM_H264");
#endif
@@ -358,24 +358,27 @@ void CAppSettings::CreateCommands() CAppSettings::~CAppSettings()
{
- if(hAccel)
+ if(hAccel) {
DestroyAcceleratorTable(hAccel);
+ }
}
bool CAppSettings::IsD3DFullscreen() const
{
- if(nCLSwitches&CLSW_D3DFULLSCREEN)
+ if(nCLSwitches&CLSW_D3DFULLSCREEN) {
return true;
- else
+ } else {
return fD3DFullscreen;
+ }
}
CString CAppSettings::SelectedAudioRenderer() const
{
CString strResult;
- if(AfxGetMyApp()->m_AudioRendererDisplayName_CL != _T(""))
+ if(AfxGetMyApp()->m_AudioRendererDisplayName_CL != _T("")) {
strResult = AfxGetMyApp()->m_AudioRendererDisplayName_CL;
- else
+ } else {
strResult = AfxGetAppSettings().strAudioRendererDisplayName;
+ }
return strResult;
}
@@ -388,10 +391,11 @@ void CAppSettings::ResetPositions() DVD_POSITION* CAppSettings::CurrentDVDPosition()
{
- if (nCurrentDvdPosition != -1)
+ if (nCurrentDvdPosition != -1) {
return &DvdPosition[nCurrentDvdPosition];
- else
+ } else {
return NULL;
+ }
}
bool CAppSettings::NewDvd(ULONGLONG llDVDGuid)
@@ -399,18 +403,17 @@ bool CAppSettings::NewDvd(ULONGLONG llDVDGuid) int i;
// Look for the DVD position
- for (i=0; i<MAX_DVD_POSITION; i++)
- {
- if (DvdPosition[i].llDVDGuid == llDVDGuid)
- {
+ for (i=0; i<MAX_DVD_POSITION; i++) {
+ if (DvdPosition[i].llDVDGuid == llDVDGuid) {
nCurrentDvdPosition = i;
return false;
}
}
// If DVD is unknown, we put it first
- for (int i=MAX_DVD_POSITION-1; i>0; i--)
+ for (int i=MAX_DVD_POSITION-1; i>0; i--) {
memcpy (&DvdPosition[i], &DvdPosition[i-1], sizeof(DVD_POSITION));
+ }
DvdPosition[0].llDVDGuid = llDVDGuid;
nCurrentDvdPosition = 0;
return true;
@@ -418,10 +421,11 @@ bool CAppSettings::NewDvd(ULONGLONG llDVDGuid) FILE_POSITION* CAppSettings::CurrentFilePosition()
{
- if (nCurrentFilePosition != -1)
+ if (nCurrentFilePosition != -1) {
return &FilePosition[nCurrentFilePosition];
- else
+ } else {
return NULL;
+ }
}
bool CAppSettings::NewFile(LPCTSTR strFileName)
@@ -429,18 +433,15 @@ bool CAppSettings::NewFile(LPCTSTR strFileName) int i;
// Look for the file position
- for (i=0; i<MAX_FILE_POSITION; i++)
- {
- if (FilePosition[i].strFile == strFileName)
- {
+ for (i=0; i<MAX_FILE_POSITION; i++) {
+ if (FilePosition[i].strFile == strFileName) {
nCurrentFilePosition = i;
return false;
}
}
// If it is unknown, we put it first
- for (int i=MAX_FILE_POSITION-1; i>0; i--)
- {
+ for (int i=MAX_FILE_POSITION-1; i>0; i--) {
FilePosition[i].strFile = FilePosition[i-1].strFile;
FilePosition[i].llPosition = FilePosition[i-1].llPosition;
}
@@ -455,8 +456,7 @@ void CAppSettings::DeserializeHex (LPCTSTR strVal, BYTE* pBuffer, int nBufSize) {
long lRes;
- for (int i=0; i<nBufSize; i++)
- {
+ for (int i=0; i<nBufSize; i++) {
_stscanf_s (strVal+(i*2), _T("%02x"), &lRes);
pBuffer[i] = (BYTE)lRes;
}
@@ -467,8 +467,7 @@ CString CAppSettings::SerializeHex (BYTE* pBuffer, int nBufSize) const CString strTemp;
CString strResult;
- for (int i=0; i<nBufSize; i++)
- {
+ for (int i=0; i<nBufSize; i++) {
strTemp.Format (_T("%02x"), pBuffer[i]);
strResult += strTemp;
}
@@ -484,9 +483,10 @@ void CAppSettings::UpdateData(bool fSave) UINT len;
BYTE* ptr = NULL;
- if(fSave)
- {
- if(!fInitialized) return;
+ if(fSave) {
+ if(!fInitialized) {
+ return;
+ }
pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_HIDECAPTIONMENU, iCaptionMenuMode);
pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_HIDENAVIGATION, fHideNavigation);
@@ -625,8 +625,7 @@ void CAppSettings::UpdateData(bool fSave) int iChannel = 0;
POSITION pos = m_DVBChannels.GetHeadPosition();
- while (pos)
- {
+ while (pos) {
CString strTemp;
CString strChannel;
CDVBChannel& Channel = m_DVBChannels.GetNext(pos);
@@ -638,10 +637,8 @@ void CAppSettings::UpdateData(bool fSave) // playback positions for last played DVDs
pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_DVDPOS, (int)fRememberDVDPos);
pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_FILEPOS, (int)fRememberFilePos);
- if (fKeepHistory)
- {
- for (int i=0; i<MAX_DVD_POSITION; i++)
- {
+ if (fKeepHistory) {
+ for (int i=0; i<MAX_DVD_POSITION; i++) {
CString strDVDPos;
CString strValue;
@@ -651,8 +648,7 @@ void CAppSettings::UpdateData(bool fSave) }
// playback positions for last played files
- for (int i=0; i<MAX_FILE_POSITION; i++)
- {
+ for (int i=0; i<MAX_FILE_POSITION; i++) {
CString strFilePos;
CString strValue;
@@ -668,50 +664,46 @@ void CAppSettings::UpdateData(bool fSave) // CASIMIR666 : end of new settings
{
- for(int i = 0; ; i++)
- {
+ for(int i = 0; ; i++) {
CString key;
key.Format(_T("%s\\%04d"), IDS_R_FILTERS, i);
int j = pApp->GetProfileInt(key, _T("Enabled"), -1);
pApp->WriteProfileString(key, NULL, NULL);
- if(j < 0) break;
+ if(j < 0) {
+ break;
+ }
}
pApp->WriteProfileString(IDS_R_FILTERS, NULL, NULL);
POSITION pos = m_filters.GetHeadPosition();
- for(int i = 0; pos; i++)
- {
+ for(int i = 0; pos; i++) {
FilterOverride* f = m_filters.GetNext(pos);
- if(f->fTemporary)
+ if(f->fTemporary) {
continue;
+ }
CString key;
key.Format(_T("%s\\%04d"), IDS_R_FILTERS, i);
pApp->WriteProfileInt(key, _T("SourceType"), (int)f->type);
pApp->WriteProfileInt(key, _T("Enabled"), (int)!f->fDisabled);
- if(f->type == FilterOverride::REGISTERED)
- {
+ if(f->type == FilterOverride::REGISTERED) {
pApp->WriteProfileString(key, _T("DisplayName"), CString(f->dispname));
pApp->WriteProfileString(key, _T("Name"), f->name);
- }
- else if(f->type == FilterOverride::EXTERNAL)
- {
+ } else if(f->type == FilterOverride::EXTERNAL) {
pApp->WriteProfileString(key, _T("Path"), f->path);
pApp->WriteProfileString(key, _T("Name"), f->name);
pApp->WriteProfileString(key, _T("CLSID"), CStringFromGUID(f->clsid));
}
POSITION pos2 = f->backup.GetHeadPosition();
- for(int i = 0; pos2; i++)
- {
+ for(int i = 0; pos2; i++) {
CString val;
val.Format(_T("org%04d"), i);
pApp->WriteProfileString(key, val, CStringFromGUID(f->backup.GetNext(pos2)));
}
pos2 = f->guids.GetHeadPosition();
- for(int i = 0; pos2; i++)
- {
+ for(int i = 0; pos2; i++) {
CString val;
val.Format(_T("mod%04d"), i);
pApp->WriteProfileString(key, val, CStringFromGUID(f->guids.GetNext(pos2)));
@@ -727,8 +719,7 @@ void CAppSettings::UpdateData(bool fSave) //pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_REALMEDIAFPS, *((DWORD*)&dRealMediaQuickTimeFPS));
pApp->WriteProfileString(IDS_R_SETTINGS _T("\\") IDS_RS_PNSPRESETS, NULL, NULL);
- for(int i = 0, j = m_pnspresets.GetCount(); i < j; i++)
- {
+ for(int i = 0, j = m_pnspresets.GetCount(); i < j; i++) {
CString str;
str.Format(_T("Preset%d"), i);
pApp->WriteProfileString(IDS_R_SETTINGS _T("\\") IDS_RS_PNSPRESETS, str, m_pnspresets[i]);
@@ -736,11 +727,9 @@ void CAppSettings::UpdateData(bool fSave) pApp->WriteProfileString(IDS_R_COMMANDS, NULL, NULL);
pos = wmcmds.GetHeadPosition();
- for(int i = 0; pos; )
- {
+ for(int i = 0; pos; ) {
wmcmd& wc = wmcmds.GetNext(pos);
- if(wc.IsModified())
- {
+ if(wc.IsModified()) {
CString str;
str.Format(_T("CommandMod%d"), i);
CString str2;
@@ -773,14 +762,18 @@ void CAppSettings::UpdateData(bool fSave) m_Formats.UpdateData(true);
// Internal filters
- for (int f=0; f<SRC_LAST; f++)
+ for (int f=0; f<SRC_LAST; f++) {
pApp->WriteProfileInt(IDS_R_INTERNAL_FILTERS, SrcFiltersKeys[f], SrcFilters[f]);
- for (int f=0; f<TRA_LAST; f++)
+ }
+ for (int f=0; f<TRA_LAST; f++) {
pApp->WriteProfileInt(IDS_R_INTERNAL_FILTERS, TraFiltersKeys[f], TraFilters[f]);
- for (int f=0; f<TRA_DXVA_LAST; f++)
+ }
+ for (int f=0; f<TRA_DXVA_LAST; f++) {
pApp->WriteProfileInt(IDS_R_INTERNAL_FILTERS, DXVAFiltersKeys[f], DXVAFilters[f]);
- for (int f=0; f<FFM_LAST; f++)
+ }
+ for (int f=0; f<FFM_LAST; f++) {
pApp->WriteProfileInt(IDS_R_INTERNAL_FILTERS, FFMFiltersKeys[f], FFmpegFilters[f]);
+ }
pApp->WriteProfileString(IDS_R_SETTINGS, IDS_RS_LOGOFILE, strLogoFileName);
pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_LOGOID, nLogoId);
@@ -816,12 +809,10 @@ void CAppSettings::UpdateData(bool fSave) pos = m_shaders.GetHeadPosition();
- for(int i = 0; pos; i++)
- {
+ for(int i = 0; pos; i++) {
const Shader& s = m_shaders.GetNext(pos);
- if(!s.label.IsEmpty())
- {
+ if(!s.label.IsEmpty()) {
CString index;
index.Format(_T("%d"), i);
CString srcdata = s.srcdata;
@@ -832,24 +823,21 @@ void CAppSettings::UpdateData(bool fSave) }
}
- if(pApp->m_pszRegistryKey)
- {
+ if(pApp->m_pszRegistryKey) {
// WINBUG: on win2k this would crash WritePrivateProfileString
pApp->WriteProfileInt(_T(""), _T(""), pApp->GetProfileInt(_T(""), _T(""), 0)?0:1);
}
- }
- else
- {
- if(fInitialized) return;
+ } else {
+ if(fInitialized) {
+ return;
+ }
iDXVer = 0;
CRegKey dxver;
- if(ERROR_SUCCESS == dxver.Open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\DirectX"), KEY_READ))
- {
+ if(ERROR_SUCCESS == dxver.Open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\DirectX"), KEY_READ)) {
CString str;
ULONG len = 64;
- if(ERROR_SUCCESS == dxver.QueryStringValue(_T("Version"), str.GetBuffer(len), &len))
- {
+ if(ERROR_SUCCESS == dxver.QueryStringValue(_T("Version"), str.GetBuffer(len), &len)) {
str.ReleaseBuffer(len);
int ver[4];
_stscanf_s(str, _T("%d.%d.%d.%d"), ver+0, ver+1, ver+2, ver+3);
@@ -859,7 +847,9 @@ void CAppSettings::UpdateData(bool fSave) // Set interface language first!
iLanguage = pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_LANGUAGE, CMPlayerCApp::GetDefLanguage());
- if (iLanguage != 0) CMPlayerCApp::SetLanguage(iLanguage);
+ if (iLanguage != 0) {
+ CMPlayerCApp::SetLanguage(iLanguage);
+ }
CreateCommands();
iCaptionMenuMode = pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_HIDECAPTIONMENU, MODE_SHOWCAPTIONMENU);
@@ -914,16 +904,14 @@ void CAppSettings::UpdateData(bool fSave) // Last Open Dir
strLastOpenDir = pApp->GetProfileString(IDS_R_SETTINGS, IDS_RS_LAST_OPEN_DIR, _T("C:\\"));
- if ( pApp->GetProfileBinary(IDS_R_SETTINGS, IDS_RS_FULLSCREENRES, &ptr, &len) )
- {
- if ( len == sizeof(AChFR) )
+ if ( pApp->GetProfileBinary(IDS_R_SETTINGS, IDS_RS_FULLSCREENRES, &ptr, &len) ) {
+ if ( len == sizeof(AChFR) ) {
memcpy( &AutoChangeFullscrRes, ptr, sizeof(AChFR) );
- else
+ } else {
AutoChangeFullscrRes.bEnabled = false;
+ }
delete [] ptr;
- }
- else
- {
+ } else {
AutoChangeFullscrRes.bEnabled = false;
}
@@ -935,16 +923,14 @@ void CAppSettings::UpdateData(bool fSave) sizeAspectRatio.cx = pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_ASPECTRATIO_X, 0);
sizeAspectRatio.cy = pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_ASPECTRATIO_Y, 0);
fKeepHistory = !!pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_KEEPHISTORY, 1);
- if ( pApp->GetProfileBinary(IDS_R_SETTINGS, IDS_RS_LASTWINDOWRECT, &ptr, &len) )
- {
- if ( len == sizeof(CRect) )
+ if ( pApp->GetProfileBinary(IDS_R_SETTINGS, IDS_RS_LASTWINDOWRECT, &ptr, &len) ) {
+ if ( len == sizeof(CRect) ) {
memcpy( &rcLastWindowPos, ptr, sizeof(CRect) );
- else
+ } else {
fRememberWindowPos = false;
+ }
delete [] ptr;
- }
- else
- {
+ } else {
fRememberWindowPos = false;
}
nLastWindowType = pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_LASTWINDOWTYPE, SIZE_RESTORED);
@@ -958,8 +944,9 @@ void CAppSettings::UpdateData(bool fSave) {
CString temp = pApp->GetProfileString(IDS_R_SETTINGS, IDS_RS_SPLOGFONT, _T(""));
subdefstyle <<= temp;
- if(temp == _T(""))
- subdefstyle.relativeTo = 1; //default "Position subtitles relative to the video frame" option is checked
+ if(temp == _T("")) {
+ subdefstyle.relativeTo = 1; //default "Position subtitles relative to the video frame" option is checked
+ }
}
fOverridePlacement = !!pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_SPOVERRIDEPLACEMENT, 0);
nHorPos = pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_SPHORPOS, 50);
@@ -978,16 +965,14 @@ void CAppSettings::UpdateData(bool fSave) fCustomChannelMapping = !!pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_CUSTOMCHANNELMAPPING, 0);
BOOL bResult = pApp->GetProfileBinary( IDS_R_SETTINGS, IDS_RS_SPEAKERTOCHANNELMAPPING, &ptr, &len );
- if ( bResult && len == sizeof(pSpeakerToChannelMap) )
- {
+ if ( bResult && len == sizeof(pSpeakerToChannelMap) ) {
memcpy( pSpeakerToChannelMap, ptr, sizeof(pSpeakerToChannelMap) );
- }
- else
- {
+ } else {
memset(pSpeakerToChannelMap, 0, sizeof(pSpeakerToChannelMap));
for(int j = 0; j < 18; j++)
- for(int i = 0; i <= j; i++)
+ for(int i = 0; i <= j; i++) {
pSpeakerToChannelMap[j][i] = 1<<i;
+ }
pSpeakerToChannelMap[0][0] = 1<<0;
pSpeakerToChannelMap[0][1] = 1<<0;
@@ -1006,19 +991,21 @@ void CAppSettings::UpdateData(bool fSave) pSpeakerToChannelMap[4][4] = 1<<3;
pSpeakerToChannelMap[4][5] = 1<<4;
}
- if ( bResult )
+ if ( bResult ) {
delete [] ptr;
+ }
fAudioNormalize = !!pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_AUDIONORMALIZE, FALSE);
fAudioNormalizeRecover = !!pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_AUDIONORMALIZERECOVER, TRUE);
dAudioBoost_dB = (float)_tstof(pApp->GetProfileString(IDS_R_SETTINGS, IDS_RS_AUDIOBOOST, _T("0")));
- if (dAudioBoost_dB<0 || dAudioBoost_dB>10) dAudioBoost_dB = 0;
+ if (dAudioBoost_dB<0 || dAudioBoost_dB>10) {
+ dAudioBoost_dB = 0;
+ }
nSpeakerChannels = pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_SPEAKERCHANNELS, 2);
{
- for(int i = 0; ; i++)
- {
+ for(int i = 0; ; i++) {
CString key;
key.Format(_T("%s\\%04d"), IDS_R_FILTERS, i);
@@ -1027,47 +1014,46 @@ void CAppSettings::UpdateData(bool fSave) f->fDisabled = !pApp->GetProfileInt(key, _T("Enabled"), 0);
UINT j = pApp->GetProfileInt(key, _T("SourceType"), -1);
- if(j == 0)
- {
+ if(j == 0) {
f->type = FilterOverride::REGISTERED;
f->dispname = CStringW(pApp->GetProfileString(key, _T("DisplayName"), _T("")));
f->name = pApp->GetProfileString(key, _T("Name"), _T(""));
- }
- else if(j == 1)
- {
+ } else if(j == 1) {
f->type = FilterOverride::EXTERNAL;
f->path = pApp->GetProfileString(key, _T("Path"), _T(""));
f->name = pApp->GetProfileString(key, _T("Name"), _T(""));
f->clsid = GUIDFromCString(pApp->GetProfileString(key, _T("CLSID"), _T("")));
- }
- else
- {
+ } else {
pApp->WriteProfileString(key, NULL, 0);
break;
}
f->backup.RemoveAll();
- for(int i = 0; ; i++)
- {
+ for(int i = 0; ; i++) {
CString val;
val.Format(_T("org%04d"), i);
CString guid = pApp->GetProfileString(key, val, _T(""));
- if(guid.IsEmpty()) break;
+ if(guid.IsEmpty()) {
+ break;
+ }
f->backup.AddTail(GUIDFromCString(guid));
}
f->guids.RemoveAll();
- for(int i = 0; ; i++)
- {
+ for(int i = 0; ; i++) {
CString val;
val.Format(_T("mod%04d"), i);
CString guid = pApp->GetProfileString(key, val, _T(""));
- if(guid.IsEmpty()) break;
+ if(guid.IsEmpty()) {
+ break;
+ }
f->guids.AddTail(GUIDFromCString(guid));
}
f->iLoadType = (int)pApp->GetProfileInt(key, _T("LoadType"), -1);
- if(f->iLoadType < 0) break;
+ if(f->iLoadType < 0) {
+ break;
+ }
f->dwMerit = pApp->GetProfileInt(key, _T("Merit"), MERIT_DO_NOT_USE+1);
@@ -1082,16 +1068,16 @@ void CAppSettings::UpdateData(bool fSave) //*((DWORD*)&dRealMediaQuickTimeFPS) = pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_REALMEDIAFPS, *((DWORD*)&dRealMediaQuickTimeFPS));
m_pnspresets.RemoveAll();
- for(int i = 0; i < (ID_PANNSCAN_PRESETS_END - ID_PANNSCAN_PRESETS_START); i++)
- {
+ for(int i = 0; i < (ID_PANNSCAN_PRESETS_END - ID_PANNSCAN_PRESETS_START); i++) {
CString str;
str.Format(_T("Preset%d"), i);
str = pApp->GetProfileString(IDS_R_SETTINGS _T("\\") IDS_RS_PNSPRESETS, str, _T(""));
- if(str.IsEmpty()) break;
+ if(str.IsEmpty()) {
+ break;
+ }
m_pnspresets.Add(str);
}
- if(m_pnspresets.IsEmpty())
- {
+ if(m_pnspresets.IsEmpty()) {
double _4p3 = 4.0/3.0;
double _16p9 = 16.0/9.0;
double _185p1 = 1.85/1.0;
@@ -1107,25 +1093,30 @@ void CAppSettings::UpdateData(bool fSave) m_pnspresets.Add(str);
}
- for(int i = 0; i < wmcmds.GetCount(); i++)
- {
+ for(int i = 0; i < wmcmds.GetCount(); i++) {
CString str;
str.Format(_T("CommandMod%d"), i);
str = pApp->GetProfileString(IDS_R_COMMANDS, str, _T(""));
- if(str.IsEmpty()) break;
+ if(str.IsEmpty()) {
+ break;
+ }
int cmd, fVirt, key, repcnt, mouse, appcmd;
TCHAR buff[128];
int n;
- if(5 > (n = _stscanf_s(str, _T("%d %x %x %s %d %d %d"), &cmd, &fVirt, &key, buff, countof(buff), &repcnt, &mouse, &appcmd)))
+ if(5 > (n = _stscanf_s(str, _T("%d %x %x %s %d %d %d"), &cmd, &fVirt, &key, buff, countof(buff), &repcnt, &mouse, &appcmd))) {
break;
- if(POSITION pos = wmcmds.Find(cmd))
- {
+ }
+ if(POSITION pos = wmcmds.Find(cmd)) {
wmcmd& wc = wmcmds.GetAt(pos);
wc.cmd = cmd;
wc.fVirt = fVirt;
wc.key = key;
- if(n >= 6) wc.mouse = (UINT)mouse;
- if(n >= 7) wc.appcmd = (UINT)appcmd;
+ if(n >= 6) {
+ wc.mouse = (UINT)mouse;
+ }
+ if(n >= 7) {
+ wc.appcmd = (UINT)appcmd;
+ }
wc.rmcmd = CStringA(buff).Trim('\"');
wc.rmrepcnt = repcnt;
}
@@ -1134,7 +1125,9 @@ void CAppSettings::UpdateData(bool fSave) CAtlArray<ACCEL> pAccel;
pAccel.SetCount(wmcmds.GetCount());
POSITION pos = wmcmds.GetHeadPosition();
- for(int i = 0; pos; i++) pAccel[i] = wmcmds.GetNext(pos);
+ for(int i = 0; pos; i++) {
+ pAccel[i] = wmcmds.GetNext(pos);
+ }
hAccel = CreateAcceleratorTable(pAccel.GetData(), pAccel.GetCount());
strWinLircAddr = pApp->GetProfileString(IDS_R_SETTINGS, IDS_RS_WINLIRCADDR, _T("127.0.0.1:8765"));
@@ -1155,14 +1148,18 @@ void CAppSettings::UpdateData(bool fSave) m_Formats.UpdateData(false);
// Internal filters
- for (int f=0; f<SRC_LAST; f++)
+ for (int f=0; f<SRC_LAST; f++) {
SrcFilters[f] = !!pApp->GetProfileInt(IDS_R_INTERNAL_FILTERS, SrcFiltersKeys[f], 1);
- for (int f=0; f<TRA_LAST; f++)
+ }
+ for (int f=0; f<TRA_LAST; f++) {
TraFilters[f] = !!pApp->GetProfileInt(IDS_R_INTERNAL_FILTERS, TraFiltersKeys[f], 1);
- for (int f=0; f<TRA_DXVA_LAST; f++)
+ }
+ for (int f=0; f<TRA_DXVA_LAST; f++) {
DXVAFilters[f] = !!pApp->GetProfileInt(IDS_R_INTERNAL_FILTERS, DXVAFiltersKeys[f], 1);
- for (int f=0; f<FFM_LAST; f++)
+ }
+ for (int f=0; f<FFM_LAST; f++) {
FFmpegFilters[f] = !!pApp->GetProfileInt(IDS_R_INTERNAL_FILTERS, FFMFiltersKeys[f], 1);
+ }
strLogoFileName = pApp->GetProfileString(IDS_R_SETTINGS, IDS_RS_LOGOFILE, _T(""));
nLogoId = pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_LOGOID, DEF_LOGO);
@@ -1189,11 +1186,13 @@ void CAppSettings::UpdateData(bool fSave) // grrrrr
// if(!SHGetSpecialFolderPath(NULL, MyPictures.GetBufferSetLength(_MAX_PATH), CSIDL_MYPICTURES, TRUE)) MyPictures.Empty();
// else MyPictures.ReleaseBuffer();
- if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"), KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"), KEY_READ)) {
ULONG len = _MAX_PATH;
- if(ERROR_SUCCESS == key.QueryStringValue(_T("My Pictures"), MyPictures.GetBuffer(_MAX_PATH), &len)) MyPictures.ReleaseBufferSetLength(len);
- else MyPictures.Empty();
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("My Pictures"), MyPictures.GetBuffer(_MAX_PATH), &len)) {
+ MyPictures.ReleaseBufferSetLength(len);
+ } else {
+ MyPictures.Empty();
+ }
}
strSnapShotPath = pApp->GetProfileString(IDS_R_SETTINGS, IDS_RS_SNAPSHOTPATH, MyPictures);
strSnapShotExt = pApp->GetProfileString(IDS_R_SETTINGS, IDS_RS_SNAPSHOTEXT, _T(".jpg"));
@@ -1233,16 +1232,19 @@ void CAppSettings::UpdateData(bool fSave) shaders[_T("denoise")] = IDF_SHADER_DENOISE;
shaders[_T("YV12 Chroma Upsampling")] = IDF_SHADER_YV12CHROMAUP;
- for(int iShader=0; ; iShader++)
- {
+ for(int iShader=0; ; iShader++) {
CString str;
str.Format(_T("%d"), iShader);
str = pApp->GetProfileString(_T("Shaders"), str);
CAtlList<CString> sl;
CString label = Explode(str, sl, '|');
- if(label.IsEmpty()) break;
- if(sl.GetCount() < 3) continue;
+ if(label.IsEmpty()) {
+ break;
+ }
+ if(sl.GetCount() < 3) {
+ continue;
+ }
Shader s;
s.label = sl.RemoveHead();
@@ -1256,28 +1258,25 @@ void CAppSettings::UpdateData(bool fSave) }
pos = shaders.GetStartPosition();
- while(pos)
- {
+ while(pos) {
CAtlStringMap<UINT>::CPair* pPair = shaders.GetNext(pos);
CStringA srcdata;
- if(LoadResource(pPair->m_value, srcdata, _T("FILE")))
- {
+ if(LoadResource(pPair->m_value, srcdata, _T("FILE"))) {
Shader s;
s.label = pPair->m_key;
// Select minimum version for each shader!
- switch (pPair->m_value)
- {
- case IDF_SHADER_DENOISE :
- s.target = _T("ps_3_0");
- break;
- case IDF_SHADER_SHARPEN_COMPLEX2 :
- s.target = _T("ps_2_a");
- break;
- default :
- s.target = _T("ps_2_0");
- break;
+ switch (pPair->m_value) {
+ case IDF_SHADER_DENOISE :
+ s.target = _T("ps_3_0");
+ break;
+ case IDF_SHADER_SHARPEN_COMPLEX2 :
+ s.target = _T("ps_2_a");
+ break;
+ default :
+ s.target = _T("ps_2_0");
+ break;
}
s.srcdata = CString(srcdata);
m_shaders.AddTail(s);
@@ -1318,14 +1317,15 @@ void CAppSettings::UpdateData(bool fSave) fBDAIgnoreEncryptedChannels = !!pApp->GetProfileInt(IDS_RS_DVB, IDS_RS_BDA_IGNORE_ENCRYPTED_CHANNELS, 0);
nDVBLastChannel = pApp->GetProfileInt(IDS_RS_DVB, IDS_RS_DVB_LAST_CHANNEL, 1);
- for(int iChannel = 0; ; iChannel++)
- {
+ for(int iChannel = 0; ; iChannel++) {
CString strTemp;
CString strChannel;
CDVBChannel Channel;
strTemp.Format(_T("%d"), iChannel);
strChannel = pApp->GetProfileString(IDS_RS_DVB, strTemp, _T(""));
- if (strChannel.IsEmpty()) break;
+ if (strChannel.IsEmpty()) {
+ break;
+ }
Channel.FromString(strChannel);
m_DVBChannels.AddTail (Channel);
}
@@ -1334,15 +1334,13 @@ void CAppSettings::UpdateData(bool fSave) fRememberDVDPos = !!pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_DVDPOS, 0);
nCurrentDvdPosition = -1;
memset (DvdPosition, 0, sizeof(DvdPosition));
- for (int i=0; i<MAX_DVD_POSITION; i++)
- {
+ for (int i=0; i<MAX_DVD_POSITION; i++) {
CString strDVDPos;
CString strValue;
strDVDPos.Format (_T("DVD Position %d"), i);
strValue = pApp->GetProfileString(IDS_R_SETTINGS, strDVDPos, _T(""));
- if (strValue.GetLength()/2 == sizeof(DVD_POSITION))
- {
+ if (strValue.GetLength()/2 == sizeof(DVD_POSITION)) {
DeserializeHex(strValue, (BYTE*)&DvdPosition[i], sizeof(DVD_POSITION));
}
}
@@ -1350,8 +1348,7 @@ void CAppSettings::UpdateData(bool fSave) // playback positions for last played files
fRememberFilePos = !!pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_FILEPOS, 0);
nCurrentFilePosition = -1;
- for (int i=0; i<MAX_FILE_POSITION; i++)
- {
+ for (int i=0; i<MAX_FILE_POSITION; i++) {
CString strFilePos;
CString strValue;
@@ -1372,7 +1369,9 @@ void CAppSettings::UpdateData(bool fSave) strShadercombine = pApp->GetProfileString(_T("Shaders"), _T("Combine"), _T(""));
strShadercombineScreenSpace = pApp->GetProfileString(_T("Shaders"), _T("CombineScreenSpace"), _T(""));
- if(fLaunchfullscreen) nCLSwitches |= CLSW_FULLSCREEN;
+ if(fLaunchfullscreen) {
+ nCLSwitches |= CLSW_FULLSCREEN;
+ }
fInitialized = true;
}
@@ -1383,10 +1382,9 @@ void CAppSettings::UpdateRenderersData(bool fSave) CWinApp* pApp = AfxGetApp();
CRenderersSettings& r = m_RenderersSettings;
- if(fSave)
- {
+ if(fSave) {
pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_APSURACEFUSAGE, r.iAPSurfaceUsage);
-// pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_VMRSYNCFIX, fVMRSyncFix);
+ // pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_VMRSYNCFIX, fVMRSyncFix);
pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_DX9_RESIZER, r.iDX9Resizer);
pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_VMR9MIXERMODE, r.fVMR9MixerMode);
pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_VMR9MIXERYUV, r.fVMR9MixerYUV);
@@ -1434,11 +1432,9 @@ void CAppSettings::UpdateRenderersData(bool fSave) pApp->WriteProfileInt(IDS_R_SETTINGS, IDS_RS_EVR_BUFFERS, r.iEvrBuffers);
pApp->WriteProfileString(IDS_R_SETTINGS, IDS_D3D9RENDERDEVICE, r.D3D9RenderDevice);
- }
- else
- {
+ } else {
r.iAPSurfaceUsage = pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_APSURACEFUSAGE, (IsVistaOrAbove() ? VIDRNDT_AP_TEXTURE3D : VIDRNDT_AP_TEXTURE2D));
-// fVMRSyncFix = !!pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_VMRSYNCFIX, FALSE);
+ // fVMRSyncFix = !!pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_VMRSYNCFIX, FALSE);
r.iDX9Resizer = pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_DX9_RESIZER, 1);
r.fVMR9MixerMode = !!pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_VMR9MIXERMODE, TRUE);
r.fVMR9MixerYUV = !!pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_VMR9MIXERYUV, FALSE);
@@ -1475,19 +1471,16 @@ void CAppSettings::UpdateRenderersData(bool fSave) double *dPtr;
UINT dSize;
- if(pApp->GetProfileBinary(IDS_R_SETTINGS, _T("CycleDelta"), (LPBYTE*)&dPtr, &dSize))
- {
+ if(pApp->GetProfileBinary(IDS_R_SETTINGS, _T("CycleDelta"), (LPBYTE*)&dPtr, &dSize)) {
renderSettings.fCycleDelta = *dPtr;
delete [] dPtr;
}
- if(pApp->GetProfileBinary(IDS_R_SETTINGS, _T("TargetSyncOffset"), (LPBYTE*)&dPtr, &dSize))
- {
+ if(pApp->GetProfileBinary(IDS_R_SETTINGS, _T("TargetSyncOffset"), (LPBYTE*)&dPtr, &dSize)) {
renderSettings.fTargetSyncOffset = *dPtr;
delete [] dPtr;
}
- if(pApp->GetProfileBinary(IDS_R_SETTINGS, _T("ControlLimit"), (LPBYTE*)&dPtr, &dSize))
- {
+ if(pApp->GetProfileBinary(IDS_R_SETTINGS, _T("ControlLimit"), (LPBYTE*)&dPtr, &dSize)) {
renderSettings.fControlLimit = *dPtr;
delete [] dPtr;
}
@@ -1501,8 +1494,9 @@ void CAppSettings::UpdateRenderersData(bool fSave) bool bAllowAnimationWhenBuffering = true;
SYSTEM_INFO SysInfo;
GetSystemInfo(&SysInfo);
- if (SysInfo.dwNumberOfProcessors < 3)
+ if (SysInfo.dwNumberOfProcessors < 3) {
bAllowAnimationWhenBuffering = false;
+ }
r.fSPCAllowAnimationWhenBuffering = !!pApp->GetProfileInt(IDS_R_SETTINGS, _T("SPCAllowAnimationWhenBuffering"), bAllowAnimationWhenBuffering);
r.iEvrBuffers = pApp->GetProfileInt(IDS_R_SETTINGS, IDS_RS_EVR_BUFFERS, 5);
@@ -1543,28 +1537,22 @@ __int64 CAppSettings::ConvertTimeToMSec(CString& time) const __int64 mult = 1;
int pos = time.GetLength() - 1;
- if (pos < 3) return 0;
+ if (pos < 3) {
+ return 0;
+ }
- while (pos >= 0)
- {
+ while (pos >= 0) {
TCHAR ch = time[pos];
- if (ch == '.')
- {
+ if (ch == '.') {
mSec = Sec * 1000 / mult;
Sec = 0;
mult = 1;
- }
- else if (ch == ':')
- {
+ } else if (ch == ':') {
mult = mult * 6 / 10;
- }
- else if (ch >= '0' && ch <= '9')
- {
+ } else if (ch >= '0' && ch <= '9') {
Sec += (ch - '0') * mult;
mult *= 10;
- }
- else
- {
+ } else {
mSec = Sec = 0;
break;
}
@@ -1578,23 +1566,20 @@ void CAppSettings::ExtractDVDStartPos(CString& strParam) int i = 0, j = 0;
for(CString token = strParam.Tokenize(_T("#"), i);
j < 3 && !token.IsEmpty();
- token = strParam.Tokenize(_T("#"), i), j++)
- {
- switch (j)
- {
- case 0 :
- lDVDTitle = token.IsEmpty() ? 0 : (ULONG)_wtol(token);
- break;
- case 1 :
- if (token.Find(':') >0)
- {
- _stscanf_s(token, _T("%02d:%02d:%02d.%03d"), &DVDPosition.bHours, &DVDPosition.bMinutes, &DVDPosition.bSeconds, &DVDPosition.bFrames);
- /* Hack by Ron. If bFrames >= 30, PlayTime commands fail due to invalid arg */
- DVDPosition.bFrames = 0;
- }
- else
- lDVDChapter = token.IsEmpty() ? 0 : (ULONG)_wtol(token);
- break;
+ token = strParam.Tokenize(_T("#"), i), j++) {
+ switch (j) {
+ case 0 :
+ lDVDTitle = token.IsEmpty() ? 0 : (ULONG)_wtol(token);
+ break;
+ case 1 :
+ if (token.Find(':') >0) {
+ _stscanf_s(token, _T("%02d:%02d:%02d.%03d"), &DVDPosition.bHours, &DVDPosition.bMinutes, &DVDPosition.bSeconds, &DVDPosition.bFrames);
+ /* Hack by Ron. If bFrames >= 30, PlayTime commands fail due to invalid arg */
+ DVDPosition.bFrames = 0;
+ } else {
+ lDVDChapter = token.IsEmpty() ? 0 : (ULONG)_wtol(token);
+ }
+ break;
}
}
}
@@ -1618,106 +1603,112 @@ void CAppSettings::ParseCommandLine(CAtlList<CString>& cmdln) strPnSPreset.Empty();
POSITION pos = cmdln.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CString param = cmdln.GetNext(pos);
- if(param.IsEmpty()) continue;
+ if(param.IsEmpty()) {
+ continue;
+ }
- if((param[0] == '-' || param[0] == '/') && param.GetLength() > 1)
- {
+ if((param[0] == '-' || param[0] == '/') && param.GetLength() > 1) {
CString sw = param.Mid(1).MakeLower();
- if(sw == _T("open")) nCLSwitches |= CLSW_OPEN;
- else if(sw == _T("play")) nCLSwitches |= CLSW_PLAY;
- else if(sw == _T("fullscreen")) nCLSwitches |= CLSW_FULLSCREEN;
- else if(sw == _T("minimized")) nCLSwitches |= CLSW_MINIMIZED;
- else if(sw == _T("new")) nCLSwitches |= CLSW_NEW;
- else if(sw == _T("help") || sw == _T("h") || sw == _T("?")) nCLSwitches |= CLSW_HELP;
- else if(sw == _T("dub") && pos) slDubs.AddTail(cmdln.GetNext(pos));
- else if(sw == _T("dubdelay") && pos)
- {
+ if(sw == _T("open")) {
+ nCLSwitches |= CLSW_OPEN;
+ } else if(sw == _T("play")) {
+ nCLSwitches |= CLSW_PLAY;
+ } else if(sw == _T("fullscreen")) {
+ nCLSwitches |= CLSW_FULLSCREEN;
+ } else if(sw == _T("minimized")) {
+ nCLSwitches |= CLSW_MINIMIZED;
+ } else if(sw == _T("new")) {
+ nCLSwitches |= CLSW_NEW;
+ } else if(sw == _T("help") || sw == _T("h") || sw == _T("?")) {
+ nCLSwitches |= CLSW_HELP;
+ } else if(sw == _T("dub") && pos) {
+ slDubs.AddTail(cmdln.GetNext(pos));
+ } else if(sw == _T("dubdelay") && pos) {
CString strFile = cmdln.GetNext(pos);
int nPos = strFile.Find (_T("DELAY"));
- if (nPos != -1)
+ if (nPos != -1) {
rtShift = 10000 * _tstol(strFile.Mid(nPos + 6));
+ }
slDubs.AddTail(strFile);
- }
- else if(sw == _T("sub") && pos) slSubs.AddTail(cmdln.GetNext(pos));
- else if(sw == _T("filter") && pos) slFilters.AddTail(cmdln.GetNext(pos));
- else if(sw == _T("dvd")) nCLSwitches |= CLSW_DVD;
- else if(sw == _T("dvdpos")) ExtractDVDStartPos(cmdln.GetNext(pos));
- else if(sw == _T("cd")) nCLSwitches |= CLSW_CD;
- else if(sw == _T("add")) nCLSwitches |= CLSW_ADD;
- else if(sw == _T("regvid")) nCLSwitches |= CLSW_REGEXTVID;
- else if(sw == _T("regaud")) nCLSwitches |= CLSW_REGEXTAUD;
- else if(sw == _T("unregall")) nCLSwitches |= CLSW_UNREGEXT;
- else if(sw == _T("unregvid")) nCLSwitches |= CLSW_UNREGEXT; /* keep for compatibility with old versions */
- else if(sw == _T("unregaud")) nCLSwitches |= CLSW_UNREGEXT; /* keep for compatibility with old versions */
- else if(sw == _T("start") && pos)
- {
+ } else if(sw == _T("sub") && pos) {
+ slSubs.AddTail(cmdln.GetNext(pos));
+ } else if(sw == _T("filter") && pos) {
+ slFilters.AddTail(cmdln.GetNext(pos));
+ } else if(sw == _T("dvd")) {
+ nCLSwitches |= CLSW_DVD;
+ } else if(sw == _T("dvdpos")) {
+ ExtractDVDStartPos(cmdln.GetNext(pos));
+ } else if(sw == _T("cd")) {
+ nCLSwitches |= CLSW_CD;
+ } else if(sw == _T("add")) {
+ nCLSwitches |= CLSW_ADD;
+ } else if(sw == _T("regvid")) {
+ nCLSwitches |= CLSW_REGEXTVID;
+ } else if(sw == _T("regaud")) {
+ nCLSwitches |= CLSW_REGEXTAUD;
+ } else if(sw == _T("unregall")) {
+ nCLSwitches |= CLSW_UNREGEXT;
+ } else if(sw == _T("unregvid")) {
+ nCLSwitches |= CLSW_UNREGEXT; /* keep for compatibility with old versions */
+ } else if(sw == _T("unregaud")) {
+ nCLSwitches |= CLSW_UNREGEXT; /* keep for compatibility with old versions */
+ } else if(sw == _T("start") && pos) {
rtStart = 10000i64*_tcstol(cmdln.GetNext(pos), NULL, 10);
nCLSwitches |= CLSW_STARTVALID;
- }
- else if(sw == _T("startpos") && pos)
- {
+ } else if(sw == _T("startpos") && pos) {
rtStart = 10000i64 * ConvertTimeToMSec(cmdln.GetNext(pos));
nCLSwitches |= CLSW_STARTVALID;
- }
- else if(sw == _T("nofocus")) nCLSwitches |= CLSW_NOFOCUS;
- else if(sw == _T("close")) nCLSwitches |= CLSW_CLOSE;
- else if(sw == _T("standby")) nCLSwitches |= CLSW_STANDBY;
- else if(sw == _T("hibernate")) nCLSwitches |= CLSW_HIBERNATE;
- else if(sw == _T("shutdown")) nCLSwitches |= CLSW_SHUTDOWN;
- else if(sw == _T("logoff")) nCLSwitches |= CLSW_LOGOFF;
- else if(sw == _T("d3dfs")) nCLSwitches |= CLSW_D3DFULLSCREEN;
- else if(sw == _T("adminoption"))
- {
+ } else if(sw == _T("nofocus")) {
+ nCLSwitches |= CLSW_NOFOCUS;
+ } else if(sw == _T("close")) {
+ nCLSwitches |= CLSW_CLOSE;
+ } else if(sw == _T("standby")) {
+ nCLSwitches |= CLSW_STANDBY;
+ } else if(sw == _T("hibernate")) {
+ nCLSwitches |= CLSW_HIBERNATE;
+ } else if(sw == _T("shutdown")) {
+ nCLSwitches |= CLSW_SHUTDOWN;
+ } else if(sw == _T("logoff")) {
+ nCLSwitches |= CLSW_LOGOFF;
+ } else if(sw == _T("d3dfs")) {
+ nCLSwitches |= CLSW_D3DFULLSCREEN;
+ } else if(sw == _T("adminoption")) {
nCLSwitches |= CLSW_ADMINOPTION;
iAdminOption = _ttoi (cmdln.GetNext(pos));
- }
- else if(sw == _T("slave"))
- {
+ } else if(sw == _T("slave")) {
nCLSwitches |= CLSW_SLAVE;
hMasterWnd = (HWND)_ttol (cmdln.GetNext(pos));
- }
- else if(sw == _T("fixedsize") && pos)
- {
+ } else if(sw == _T("fixedsize") && pos) {
CAtlList<CString> sl;
Explode(cmdln.GetNext(pos), sl, ',', 2);
- if(sl.GetCount() == 2)
- {
+ if(sl.GetCount() == 2) {
sizeFixedWindow.SetSize(_ttol(sl.GetHead()), _ttol(sl.GetTail()));
- if(sizeFixedWindow.cx > 0 && sizeFixedWindow.cy > 0)
+ if(sizeFixedWindow.cx > 0 && sizeFixedWindow.cy > 0) {
nCLSwitches |= CLSW_FIXEDSIZE;
+ }
}
- }
- else if(sw == _T("monitor") && pos)
- {
+ } else if(sw == _T("monitor") && pos) {
iMonitor = _tcstol(cmdln.GetNext(pos), NULL, 10);
nCLSwitches |= CLSW_MONITOR;
- }
- else if(sw == _T("minidump"))
- {
+ } else if(sw == _T("minidump")) {
CMiniDump::Enable();
- }
- else if(sw == _T("pns")) strPnSPreset = cmdln.GetNext(pos);
- else if(sw == _T("webport") && pos)
- {
+ } else if(sw == _T("pns")) {
+ strPnSPreset = cmdln.GetNext(pos);
+ } else if(sw == _T("webport") && pos) {
int tmpport = _tcstol(cmdln.GetNext(pos), NULL, 10);
- if ( tmpport >= 0 && tmpport <= 65535 )
+ if ( tmpport >= 0 && tmpport <= 65535 ) {
nCmdlnWebServerPort = tmpport;
- }
- else if(sw == _T("debug"))
- {
+ }
+ } else if(sw == _T("debug")) {
fShowDebugInfo = true;
- }
- else if(sw == _T("audiorenderer") && pos)
- {
+ } else if(sw == _T("audiorenderer") && pos) {
SetAudioRenderer(_ttoi(cmdln.GetNext(pos)));
+ } else {
+ nCLSwitches |= CLSW_HELP|CLSW_UNRECOGNIZEDSWITCH;
}
- else nCLSwitches |= CLSW_HELP|CLSW_UNRECOGNIZEDSWITCH;
- }
- else
- {
+ } else {
slFiles.AddTail(param);
}
}
@@ -1729,27 +1720,27 @@ void CAppSettings::GetFav(favtype ft, CAtlList<CString>& sl) CString root;
- switch(ft)
- {
- case FAV_FILE:
- root = IDS_R_FAVFILES;
- break;
- case FAV_DVD:
- root = IDS_R_FAVDVDS;
- break;
- case FAV_DEVICE:
- root = IDS_R_FAVDEVICES;
- break;
- default:
- return;
+ switch(ft) {
+ case FAV_FILE:
+ root = IDS_R_FAVFILES;
+ break;
+ case FAV_DVD:
+ root = IDS_R_FAVDVDS;
+ break;
+ case FAV_DEVICE:
+ root = IDS_R_FAVDEVICES;
+ break;
+ default:
+ return;
}
- for(int i = 0; ; i++)
- {
+ for(int i = 0; ; i++) {
CString s;
s.Format(_T("Name%d"), i);
s = AfxGetApp()->GetProfileString(root, s, NULL);
- if(s.IsEmpty()) break;
+ if(s.IsEmpty()) {
+ break;
+ }
sl.AddTail(s);
}
}
@@ -1758,27 +1749,25 @@ void CAppSettings::SetFav(favtype ft, CAtlList<CString>& sl) {
CString root;
- switch(ft)
- {
- case FAV_FILE:
- root = IDS_R_FAVFILES;
- break;
- case FAV_DVD:
- root = IDS_R_FAVDVDS;
- break;
- case FAV_DEVICE:
- root = IDS_R_FAVDEVICES;
- break;
- default:
- return;
+ switch(ft) {
+ case FAV_FILE:
+ root = IDS_R_FAVFILES;
+ break;
+ case FAV_DVD:
+ root = IDS_R_FAVDVDS;
+ break;
+ case FAV_DEVICE:
+ root = IDS_R_FAVDEVICES;
+ break;
+ default:
+ return;
}
AfxGetApp()->WriteProfileString(root, NULL, NULL);
int i = 0;
POSITION pos = sl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CString s;
s.Format(_T("Name%d"), i++);
AfxGetApp()->WriteProfileString(root, s, sl.GetNext(pos));
@@ -1789,7 +1778,9 @@ void CAppSettings::AddFav(favtype ft, CString s) {
CAtlList<CString> sl;
GetFav(ft, sl);
- if(sl.Find(s)) return;
+ if(sl.Find(s)) {
+ return;
+ }
sl.AddTail(s);
SetFav(ft, sl);
}
@@ -1797,11 +1788,9 @@ void CAppSettings::AddFav(favtype ft, CString s) CDVBChannel* CAppSettings::FindChannelByPref(int nPrefNumber)
{
POSITION pos = m_DVBChannels.GetHeadPosition();
- while (pos)
- {
+ while (pos) {
CDVBChannel& Channel = m_DVBChannels.GetNext (pos);
- if (Channel.GetPrefNumber() == nPrefNumber)
- {
+ if (Channel.GetPrefNumber() == nPrefNumber) {
return &Channel;
}
}
@@ -1828,27 +1817,30 @@ void CAppSettings::CRecentFileAndURLList::Add(LPCTSTR lpszPathName) ASSERT(lpszPathName != NULL);
ASSERT(AfxIsValidString(lpszPathName));
- if(CString(lpszPathName).MakeLower().Find(_T("@device:")) >= 0)
+ if(CString(lpszPathName).MakeLower().Find(_T("@device:")) >= 0) {
return;
+ }
bool fURL = (CString(lpszPathName).Find(_T("://")) >= 0);
// fully qualify the path name
TCHAR szTemp[1024];
- if(fURL) _tcscpy_s(szTemp, lpszPathName);
- else AfxFullPath(szTemp, lpszPathName);
+ if(fURL) {
+ _tcscpy_s(szTemp, lpszPathName);
+ } else {
+ AfxFullPath(szTemp, lpszPathName);
+ }
// update the MRU list, if an existing MRU string matches file name
int iMRU;
- for (iMRU = 0; iMRU < m_nSize-1; iMRU++)
- {
+ for (iMRU = 0; iMRU < m_nSize-1; iMRU++) {
if((fURL && !_tcscmp(m_arrNames[iMRU], szTemp))
- || AfxComparePath(m_arrNames[iMRU], szTemp))
- break; // iMRU will point to matching entry
+ || AfxComparePath(m_arrNames[iMRU], szTemp)) {
+ break; // iMRU will point to matching entry
+ }
}
// move MRU strings before this one down
- for (; iMRU > 0; iMRU--)
- {
+ for (; iMRU > 0; iMRU--) {
ASSERT(iMRU > 0);
ASSERT(iMRU < m_nSize);
m_arrNames[iMRU] = m_arrNames[iMRU-1];
diff --git a/src/apps/mplayerc/AppSettings.h b/src/apps/mplayerc/AppSettings.h index 63ea68d6d..09735d637 100644 --- a/src/apps/mplayerc/AppSettings.h +++ b/src/apps/mplayerc/AppSettings.h @@ -31,8 +31,7 @@ #include "DVBChannel.h"
// flags for AppSettings::nCS
-enum
-{
+enum {
CS_NONE=0,
CS_SEEKBAR=1,
CS_TOOLBAR=CS_SEEKBAR<<1,
@@ -42,8 +41,7 @@ enum CS_LAST=CS_STATUSBAR
};
-enum
-{
+enum {
CLSW_NONE=0,
CLSW_OPEN=1,
CLSW_PLAY=CLSW_OPEN<<1,
@@ -74,16 +72,14 @@ enum CLSW_UNRECOGNIZEDSWITCH=CLSW_AUDIORENDERER<<1
};
-enum
-{
+enum {
MODE_SHOWCAPTIONMENU,
MODE_BORDERLESS,
MODE_FRAMEONLY,
MODE_COUNT
}; // flags for Caption & Menu Mode
-enum
-{
+enum {
VIDRNDT_DS_DEFAULT,
VIDRNDT_DS_OLDRENDERER,
VIDRNDT_DS_OVERLAYMIXER,
@@ -101,8 +97,7 @@ enum };
// Enumeration for MCE remote control (careful : add 0x010000 for all keys!)
-enum MCE_RAW_INPUT
-{
+enum MCE_RAW_INPUT {
MCE_DETAILS = 0x010209,
MCE_GUIDE = 0x01008D,
MCE_TVJUMP = 0x010025,
@@ -131,8 +126,7 @@ enum MCE_RAW_INPUT #define AUDRNDT_NULL_UNCOMP _T("Null Audio Renderer (Uncompressed)")
#define AUDRNDT_MPC _T("MPC Audio Renderer")
-typedef enum
-{
+typedef enum {
DVS_HALF,
DVS_NORMAL,
DVS_DOUBLE,
@@ -143,38 +137,33 @@ typedef enum DVS_ZOOM2
} dvstype;
-typedef enum
-{
+typedef enum {
FAV_FILE,
FAV_DVD,
FAV_DEVICE
} favtype;
#define MAX_DVD_POSITION 20
-typedef struct
-{
+typedef struct {
ULONGLONG llDVDGuid;
ULONG lTitle;
DVD_HMSF_TIMECODE Timecode;
} DVD_POSITION;
#define MAX_FILE_POSITION 20
-typedef struct
-{
+typedef struct {
CString strFile;
LONGLONG llPosition;
} FILE_POSITION;
#pragma pack(push, 1)
-typedef struct
-{
+typedef struct {
bool fValid;
CSize size;
int bpp, freq;
DWORD dmDisplayFlags;
} dispmode;
-typedef struct
-{
+typedef struct {
bool bEnabled;
dispmode dmFullscreenRes24Hz;
dispmode dmFullscreenRes25Hz;
@@ -198,12 +187,10 @@ public: UINT mouse;
CStringA rmcmd;
int rmrepcnt;
- wmcmd(WORD cmd = 0)
- {
+ wmcmd(WORD cmd = 0) {
this->cmd = cmd;
}
- wmcmd(WORD cmd, WORD key, BYTE fVirt, DWORD dwname, UINT appcmd = 0, UINT mouse = NONE, LPCSTR rmcmd = "", int rmrepcnt = 5)
- {
+ wmcmd(WORD cmd, WORD key, BYTE fVirt, DWORD dwname, UINT appcmd = 0, UINT mouse = NONE, LPCSTR rmcmd = "", int rmrepcnt = 5) {
this->cmd = cmd;
this->key = key;
this->fVirt = fVirt;
@@ -214,25 +201,21 @@ public: this->rmrepcnt = rmrepcnt;
backup = *this;
}
- bool operator == (const wmcmd& wc) const
- {
+ bool operator == (const wmcmd& wc) const {
return(cmd > 0 && cmd == wc.cmd);
}
- CString GetName() const
- {
+ CString GetName() const {
return ResStr (dwname);
}
- void Restore()
- {
+ void Restore() {
*(ACCEL*)this = backup;
appcmd = appcmdorg;
mouse = mouseorg;
rmcmd.Empty();
rmrepcnt = 5;
}
- bool IsModified() const
- {
+ bool IsModified() const {
return(memcmp((const ACCEL*)this, &backup, sizeof(ACCEL)) || appcmd != appcmdorg || mouse != mouseorg || !rmcmd.IsEmpty() || rmrepcnt != 5);
}
};
@@ -259,8 +242,7 @@ public: CRemoteCtrlClient();
void SetHWND(HWND hWnd);
void Connect(CString addr);
- int GetStatus() const
- {
+ int GetStatus() const {
return(m_nStatus);
}
};
@@ -310,8 +292,7 @@ public: DVD_HMSF_TIMECODE DVDPosition;
CSize sizeFixedWindow;
- bool HasFixedWindowSize() const
- {
+ bool HasFixedWindowSize() const {
return sizeFixedWindow.cx > 0 || sizeFixedWindow.cy > 0;
}
//int iFixedWidth, iFixedHeight;
@@ -474,8 +455,7 @@ public: CString strISDb;
- struct Shader
- {
+ struct Shader {
CString label;
CString target;
CString srcdata;
diff --git a/src/apps/mplayerc/AuthDlg.cpp b/src/apps/mplayerc/AuthDlg.cpp index ad4cf6f5a..29feb12c6 100644 --- a/src/apps/mplayerc/AuthDlg.cpp +++ b/src/apps/mplayerc/AuthDlg.cpp @@ -53,8 +53,9 @@ void CAuthDlg::DoDataExchange(CDataExchange* pDX) CString CAuthDlg::DEncrypt(CString str)
{
- for(int i = 0; i < str.GetLength(); i++)
+ for(int i = 0; i < str.GetLength(); i++) {
str.SetAt(i, str[i]^5);
+ }
return str;
}
@@ -74,33 +75,25 @@ BOOL CAuthDlg::OnInitDialog() CWinApp* pApp = AfxGetApp();
- if(pApp->m_pszRegistryKey)
- {
+ if(pApp->m_pszRegistryKey) {
CRegKey hSecKey(pApp->GetSectionKey(IDS_R_LOGINS));
- if(hSecKey)
- {
+ if(hSecKey) {
int i = 0;
TCHAR username[256], password[256];
- while(1)
- {
+ while(1) {
DWORD unlen = countof(username);
DWORD pwlen = sizeof(password);
DWORD type = REG_SZ;
if(ERROR_SUCCESS == RegEnumValue(
- hSecKey, i++, username, &unlen, 0, &type, (BYTE*)password, &pwlen))
- {
+ hSecKey, i++, username, &unlen, 0, &type, (BYTE*)password, &pwlen)) {
m_logins[username] = DEncrypt(password);
m_usernamectrl.AddString(username);
- }
- else
- {
+ } else {
break;
}
}
}
- }
- else
- {
+ } else {
CAutoVectorPtr<TCHAR> buff;
buff.Allocate(32767/sizeof(TCHAR));
@@ -108,15 +101,13 @@ BOOL CAuthDlg::OnInitDialog() IDS_R_LOGINS, buff, 32767/sizeof(TCHAR), pApp->m_pszProfileName);
TCHAR* p = buff;
- while(*p && len > 0)
- {
+ while(*p && len > 0) {
CString str = p;
p += str.GetLength()+1;
len -= str.GetLength()+1;
CAtlList<CString> sl;
Explode(str, sl, '=', 2);
- if(sl.GetCount() == 2)
- {
+ if(sl.GetCount() == 2) {
m_logins[sl.GetHead()] = DEncrypt(sl.GetTail());
m_usernamectrl.AddString(sl.GetHead());
}
@@ -133,8 +124,7 @@ void CAuthDlg::OnBnClickedOk() {
UpdateData();
- if(!m_username.IsEmpty())
- {
+ if(!m_username.IsEmpty()) {
CWinApp* pApp = AfxGetApp();
pApp->WriteProfileString(IDS_R_LOGINS, m_username, m_remember ? DEncrypt(m_password) : _T(""));
}
@@ -149,8 +139,7 @@ void CAuthDlg::OnCbnSelchangeCombo1() m_usernamectrl.GetLBText(m_usernamectrl.GetCurSel(), username);
CString password;
- if(m_logins.Lookup(username, password))
- {
+ if(m_logins.Lookup(username, password)) {
m_password = password;
m_remember = TRUE;
UpdateData(FALSE);
@@ -162,8 +151,7 @@ void CAuthDlg::OnEnSetfocusEdit3() UpdateData();
CString password;
- if(m_logins.Lookup(m_username, password))
- {
+ if(m_logins.Lookup(m_username, password)) {
m_password = password;
m_remember = TRUE;
UpdateData(FALSE);
diff --git a/src/apps/mplayerc/AuthDlg.h b/src/apps/mplayerc/AuthDlg.h index 748cbffe7..89d589967 100644 --- a/src/apps/mplayerc/AuthDlg.h +++ b/src/apps/mplayerc/AuthDlg.h @@ -40,7 +40,7 @@ public: CAuthDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CAuthDlg();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_AUTH_DLG };
CComboBox m_usernamectrl;
CString m_username;
diff --git a/src/apps/mplayerc/BaseGraph.cpp b/src/apps/mplayerc/BaseGraph.cpp index 39d1af02b..3f3c27c3c 100644 --- a/src/apps/mplayerc/BaseGraph.cpp +++ b/src/apps/mplayerc/BaseGraph.cpp @@ -32,8 +32,9 @@ BOOL CPlayerWindow::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CWnd::PreCreateWindow(cs))
+ if(!CWnd::PreCreateWindow(cs)) {
return FALSE;
+ }
cs.style &= ~WS_BORDER;
cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
@@ -48,9 +49,10 @@ END_MESSAGE_MAP() BOOL CPlayerWindow::OnEraseBkgnd(CDC* pDC)
{
- for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
- {
- if(!pChild->IsWindowVisible()) continue;
+ for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) {
+ if(!pChild->IsWindowVisible()) {
+ continue;
+ }
CRect r;
pChild->GetClientRect(&r);
@@ -101,8 +103,7 @@ STDMETHODIMP CBaseGraph::NonDelegatingQueryInterface(REFIID riid, void** ppv) void CBaseGraph::ClearMessageQueue()
{
- while(!m_msgqueue.IsEmpty())
- {
+ while(!m_msgqueue.IsEmpty()) {
GMSG msg = m_msgqueue.RemoveHead();
FreeEventParams(msg.m_lEventCode, msg.m_lParam1, msg.m_lParam2);
}
@@ -111,7 +112,9 @@ void CBaseGraph::ClearMessageQueue() void CBaseGraph::NotifyEvent(long lEventCode, LONG_PTR lParam1, LONG_PTR lParam2)
{
- if(!m_hNotifyWnd) return;
+ if(!m_hNotifyWnd) {
+ return;
+ }
GMSG msg;
msg.m_lEventCode = lEventCode;
@@ -302,12 +305,20 @@ STDMETHODIMP CBaseGraph::GetEventHandle(OAEVENT* hEvent) }
STDMETHODIMP CBaseGraph::GetEvent(long* lEventCode, LONG_PTR* lParam1, LONG_PTR* lParam2, long msTimeout)
{
- if(m_msgqueue.IsEmpty()) return E_FAIL;
+ if(m_msgqueue.IsEmpty()) {
+ return E_FAIL;
+ }
GMSG msg = m_msgqueue.RemoveHead();
- if(lEventCode) *lEventCode = msg.m_lEventCode;
- if(lParam1) *lParam1 = msg.m_lParam1;
- if(lParam2) *lParam2 = msg.m_lParam2;
+ if(lEventCode) {
+ *lEventCode = msg.m_lEventCode;
+ }
+ if(lParam1) {
+ *lParam1 = msg.m_lParam1;
+ }
+ if(lParam2) {
+ *lParam2 = msg.m_lParam2;
+ }
return S_OK;
}
@@ -325,9 +336,10 @@ STDMETHODIMP CBaseGraph::RestoreDefaultHandling(long lEvCode) }
STDMETHODIMP CBaseGraph::FreeEventParams(long lEvCode, LONG_PTR lParam1, LONG_PTR lParam2)
{
- if(EC_BG_ERROR == lEvCode)
- {
- if(lParam1) CoTaskMemFree((void*)lParam1);
+ if(EC_BG_ERROR == lEvCode) {
+ if(lParam1) {
+ CoTaskMemFree((void*)lParam1);
+ }
}
return S_OK;
@@ -340,8 +352,7 @@ STDMETHODIMP CBaseGraph::SetNotifyWindow(OAHWND hwnd, long lMsg, LONG_PTR lInsta m_lNotifyMsg = lMsg;
m_lNotifyInstData = lInstanceData;
- if(!IsWindow((HWND)m_hNotifyWnd))
- {
+ if(!IsWindow((HWND)m_hNotifyWnd)) {
m_hNotifyWnd = NULL;
return E_FAIL;
}
@@ -366,7 +377,9 @@ STDMETHODIMP CBaseGraph::CheckCapabilities(DWORD* pCapabilities) {
CheckPointer(pCapabilities, E_POINTER);
- if(*pCapabilities == 0) return S_OK;
+ if(*pCapabilities == 0) {
+ return S_OK;
+ }
DWORD caps;
GetCapabilities(&caps);
diff --git a/src/apps/mplayerc/BaseGraph.h b/src/apps/mplayerc/BaseGraph.h index 5e7c10935..13661d4ba 100644 --- a/src/apps/mplayerc/BaseGraph.h +++ b/src/apps/mplayerc/BaseGraph.h @@ -41,13 +41,11 @@ typedef enum {DirectShow = 0, RealMedia, QuickTime, ShockWave} engine_t; interface __declspec(uuid("B110CDE5-6331-4118-8AAF-A870D6F7E2E4"))
IGraphEngine :
-public IUnknown
-{
+public IUnknown {
STDMETHOD_(engine_t, GetEngine) () = 0;
};
-enum
-{
+enum {
EC_BG_AUDIO_CHANGED = EC_USER+1,
EC_BG_ERROR
};
@@ -68,8 +66,7 @@ class CBaseGraph long m_lNotifyMsg;
LONG_PTR m_lNotifyInstData;
- typedef struct
- {
+ typedef struct {
long m_lEventCode;
LONG_PTR m_lParam1, m_lParam2;
} GMSG;
diff --git a/src/apps/mplayerc/CGdiPlusBitmap.h b/src/apps/mplayerc/CGdiPlusBitmap.h index bf251e392..1ea829478 100644 --- a/src/apps/mplayerc/CGdiPlusBitmap.h +++ b/src/apps/mplayerc/CGdiPlusBitmap.h @@ -6,35 +6,29 @@ public: Gdiplus::Bitmap* m_pBitmap;
public:
- CGdiPlusBitmap()
- {
+ CGdiPlusBitmap() {
m_pBitmap = NULL;
}
- CGdiPlusBitmap(LPCWSTR pFile)
- {
+ CGdiPlusBitmap(LPCWSTR pFile) {
m_pBitmap = NULL;
Load(pFile);
}
- virtual ~CGdiPlusBitmap()
- {
+ virtual ~CGdiPlusBitmap() {
Empty();
}
- void Empty()
- {
+ void Empty() {
delete m_pBitmap;
m_pBitmap = NULL;
}
- bool Load(LPCWSTR pFile)
- {
+ bool Load(LPCWSTR pFile) {
Empty();
m_pBitmap = Gdiplus::Bitmap::FromFile(pFile);
return m_pBitmap->GetLastStatus() == Gdiplus::Ok;
}
- operator Gdiplus::Bitmap*() const
- {
+ operator Gdiplus::Bitmap*() const {
return m_pBitmap;
}
};
@@ -46,39 +40,32 @@ protected: HGLOBAL m_hBuffer;
public:
- CGdiPlusBitmapResource()
- {
+ CGdiPlusBitmapResource() {
m_hBuffer = NULL;
}
- CGdiPlusBitmapResource(LPCTSTR pName, LPCTSTR pType = RT_RCDATA, HMODULE hInst = NULL)
- {
+ CGdiPlusBitmapResource(LPCTSTR pName, LPCTSTR pType = RT_RCDATA, HMODULE hInst = NULL) {
m_hBuffer = NULL;
Load(pName, pType, hInst);
}
- CGdiPlusBitmapResource(UINT id, LPCTSTR pType = RT_RCDATA, HMODULE hInst = NULL)
- {
+ CGdiPlusBitmapResource(UINT id, LPCTSTR pType = RT_RCDATA, HMODULE hInst = NULL) {
m_hBuffer = NULL;
Load(id, pType, hInst);
}
- CGdiPlusBitmapResource(UINT id, UINT type, HMODULE hInst = NULL)
- {
+ CGdiPlusBitmapResource(UINT id, UINT type, HMODULE hInst = NULL) {
m_hBuffer = NULL;
Load(id, type, hInst);
}
- virtual ~CGdiPlusBitmapResource()
- {
+ virtual ~CGdiPlusBitmapResource() {
Empty();
}
void Empty();
bool Load(LPCTSTR pName, LPCTSTR pType = RT_RCDATA, HMODULE hInst = NULL);
- bool Load(UINT id, LPCTSTR pType = RT_RCDATA, HMODULE hInst = NULL)
- {
+ bool Load(UINT id, LPCTSTR pType = RT_RCDATA, HMODULE hInst = NULL) {
return Load(MAKEINTRESOURCE(id), pType, hInst);
}
- bool Load(UINT id, UINT type, HMODULE hInst = NULL)
- {
+ bool Load(UINT id, UINT type, HMODULE hInst = NULL) {
return Load(MAKEINTRESOURCE(id), MAKEINTRESOURCE(type), hInst);
}
};
@@ -87,8 +74,7 @@ inline void CGdiPlusBitmapResource::Empty()
{
CGdiPlusBitmap::Empty();
- if (m_hBuffer)
- {
+ if (m_hBuffer) {
::GlobalUnlock(m_hBuffer);
::GlobalFree(m_hBuffer);
m_hBuffer = NULL;
@@ -101,34 +87,34 @@ bool CGdiPlusBitmapResource::Load(LPCTSTR pName, LPCTSTR pType, HMODULE hInst) Empty();
HRSRC hResource = ::FindResource(hInst, pName, pType);
- if (!hResource)
+ if (!hResource) {
return false;
+ }
DWORD imageSize = ::SizeofResource(hInst, hResource);
- if (!imageSize)
+ if (!imageSize) {
return false;
+ }
const void* pResourceData = ::LockResource(::LoadResource(hInst, hResource));
- if (!pResourceData)
+ if (!pResourceData) {
return false;
+ }
m_hBuffer = ::GlobalAlloc(GMEM_MOVEABLE, imageSize);
- if (m_hBuffer)
- {
+ if (m_hBuffer) {
void* pBuffer = ::GlobalLock(m_hBuffer);
- if (pBuffer)
- {
+ if (pBuffer) {
CopyMemory(pBuffer, pResourceData, imageSize);
IStream* pStream = NULL;
- if (::CreateStreamOnHGlobal(m_hBuffer, FALSE, &pStream) == S_OK)
- {
+ if (::CreateStreamOnHGlobal(m_hBuffer, FALSE, &pStream) == S_OK) {
m_pBitmap = Gdiplus::Bitmap::FromStream(pStream);
pStream->Release();
- if (m_pBitmap)
- {
- if (m_pBitmap->GetLastStatus() == Gdiplus::Ok)
+ if (m_pBitmap) {
+ if (m_pBitmap->GetLastStatus() == Gdiplus::Ok) {
return true;
+ }
delete m_pBitmap;
m_pBitmap = NULL;
diff --git a/src/apps/mplayerc/CShockwaveFlash.h b/src/apps/mplayerc/CShockwaveFlash.h index 0d1b6c6c8..5d722a53f 100644 --- a/src/apps/mplayerc/CShockwaveFlash.h +++ b/src/apps/mplayerc/CShockwaveFlash.h @@ -31,429 +31,353 @@ class CShockwaveFlash : public CWnd protected:
DECLARE_DYNCREATE(CShockwaveFlash)
public:
- CLSID const& GetClsid()
- {
+ CLSID const& GetClsid() {
static CLSID const clsid
= { 0xD27CDB6E, 0xAE6D, 0x11CF, { 0x96, 0xB8, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
- CCreateContext* pContext = NULL)
- {
+ CCreateContext* pContext = NULL) {
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID);
}
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE,
- BSTR bstrLicKey = NULL)
- {
+ BSTR bstrLicKey = NULL) {
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey);
}
-// Attributes
+ // Attributes
public:
-// Operations
+ // Operations
public:
- long get_ReadyState()
- {
+ long get_ReadyState() {
long result;
InvokeHelper(DISPID_READYSTATE, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
- long get_TotalFrames()
- {
+ long get_TotalFrames() {
long result;
InvokeHelper(0x7c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
- BOOL get_Playing()
- {
+ BOOL get_Playing() {
BOOL result;
InvokeHelper(0x7d, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
- void put_Playing(BOOL newValue)
- {
+ void put_Playing(BOOL newValue) {
static BYTE parms[] = VTS_BOOL ;
InvokeHelper(0x7d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- long get_Quality()
- {
+ long get_Quality() {
long result;
InvokeHelper(0x69, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
- void put_Quality(long newValue)
- {
+ void put_Quality(long newValue) {
static BYTE parms[] = VTS_I4 ;
InvokeHelper(0x69, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- long get_ScaleMode()
- {
+ long get_ScaleMode() {
long result;
InvokeHelper(0x78, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
- void put_ScaleMode(long newValue)
- {
+ void put_ScaleMode(long newValue) {
static BYTE parms[] = VTS_I4 ;
InvokeHelper(0x78, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- long get_AlignMode()
- {
+ long get_AlignMode() {
long result;
InvokeHelper(0x79, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
- void put_AlignMode(long newValue)
- {
+ void put_AlignMode(long newValue) {
static BYTE parms[] = VTS_I4 ;
InvokeHelper(0x79, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- long get_BackgroundColor()
- {
+ long get_BackgroundColor() {
long result;
InvokeHelper(0x7b, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
- void put_BackgroundColor(long newValue)
- {
+ void put_BackgroundColor(long newValue) {
static BYTE parms[] = VTS_I4 ;
InvokeHelper(0x7b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- BOOL get_Loop()
- {
+ BOOL get_Loop() {
BOOL result;
InvokeHelper(0x6a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
- void put_Loop(BOOL newValue)
- {
+ void put_Loop(BOOL newValue) {
static BYTE parms[] = VTS_BOOL ;
InvokeHelper(0x6a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- CString get_Movie()
- {
+ CString get_Movie() {
CString result;
InvokeHelper(0x66, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
- void put_Movie(LPCTSTR newValue)
- {
+ void put_Movie(LPCTSTR newValue) {
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x66, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- long get_FrameNum()
- {
+ long get_FrameNum() {
long result;
InvokeHelper(0x6b, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
- void put_FrameNum(long newValue)
- {
+ void put_FrameNum(long newValue) {
static BYTE parms[] = VTS_I4 ;
InvokeHelper(0x6b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- void SetZoomRect(long left, long top, long right, long bottom)
- {
+ void SetZoomRect(long left, long top, long right, long bottom) {
static BYTE parms[] = VTS_I4 VTS_I4 VTS_I4 VTS_I4 ;
InvokeHelper(0x6d, DISPATCH_METHOD, VT_EMPTY, NULL, parms, left, top, right, bottom);
}
- void Zoom(long factor)
- {
+ void Zoom(long factor) {
static BYTE parms[] = VTS_I4 ;
InvokeHelper(0x76, DISPATCH_METHOD, VT_EMPTY, NULL, parms, factor);
}
- void Pan(long x, long y, long mode)
- {
+ void Pan(long x, long y, long mode) {
static BYTE parms[] = VTS_I4 VTS_I4 VTS_I4 ;
InvokeHelper(0x77, DISPATCH_METHOD, VT_EMPTY, NULL, parms, x, y, mode);
}
- void Play()
- {
+ void Play() {
InvokeHelper(0x70, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
- void Stop()
- {
+ void Stop() {
InvokeHelper(0x71, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
- void Back()
- {
+ void Back() {
InvokeHelper(0x72, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
- void Forward()
- {
+ void Forward() {
InvokeHelper(0x73, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
- void Rewind()
- {
+ void Rewind() {
InvokeHelper(0x74, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
- void StopPlay()
- {
+ void StopPlay() {
InvokeHelper(0x7e, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
- void GotoFrame(long FrameNum)
- {
+ void GotoFrame(long FrameNum) {
static BYTE parms[] = VTS_I4 ;
InvokeHelper(0x7f, DISPATCH_METHOD, VT_EMPTY, NULL, parms, FrameNum);
}
- long CurrentFrame()
- {
+ long CurrentFrame() {
long result;
InvokeHelper(0x80, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
return result;
}
- BOOL IsPlaying()
- {
+ BOOL IsPlaying() {
BOOL result;
InvokeHelper(0x81, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
return result;
}
- long PercentLoaded()
- {
+ long PercentLoaded() {
long result;
InvokeHelper(0x82, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
return result;
}
- BOOL FrameLoaded(long FrameNum)
- {
+ BOOL FrameLoaded(long FrameNum) {
BOOL result;
static BYTE parms[] = VTS_I4 ;
InvokeHelper(0x83, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms, FrameNum);
return result;
}
- long FlashVersion()
- {
+ long FlashVersion() {
long result;
InvokeHelper(0x84, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
return result;
}
- CString get_WMode()
- {
+ CString get_WMode() {
CString result;
InvokeHelper(0x85, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
- void put_WMode(LPCTSTR newValue)
- {
+ void put_WMode(LPCTSTR newValue) {
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x85, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- CString get_SAlign()
- {
+ CString get_SAlign() {
CString result;
InvokeHelper(0x86, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
- void put_SAlign(LPCTSTR newValue)
- {
+ void put_SAlign(LPCTSTR newValue) {
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x86, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- BOOL get_Menu()
- {
+ BOOL get_Menu() {
BOOL result;
InvokeHelper(0x87, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
- void put_Menu(BOOL newValue)
- {
+ void put_Menu(BOOL newValue) {
static BYTE parms[] = VTS_BOOL ;
InvokeHelper(0x87, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- CString get_Base()
- {
+ CString get_Base() {
CString result;
InvokeHelper(0x88, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
- void put_Base(LPCTSTR newValue)
- {
+ void put_Base(LPCTSTR newValue) {
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x88, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- CString get_Scale()
- {
+ CString get_Scale() {
CString result;
InvokeHelper(0x89, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
- void put_Scale(LPCTSTR newValue)
- {
+ void put_Scale(LPCTSTR newValue) {
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x89, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- BOOL get_DeviceFont()
- {
+ BOOL get_DeviceFont() {
BOOL result;
InvokeHelper(0x8a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
- void put_DeviceFont(BOOL newValue)
- {
+ void put_DeviceFont(BOOL newValue) {
static BYTE parms[] = VTS_BOOL ;
InvokeHelper(0x8a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- BOOL get_EmbedMovie()
- {
+ BOOL get_EmbedMovie() {
BOOL result;
InvokeHelper(0x8b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
- void put_EmbedMovie(BOOL newValue)
- {
+ void put_EmbedMovie(BOOL newValue) {
static BYTE parms[] = VTS_BOOL ;
InvokeHelper(0x8b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- CString get_BGColor()
- {
+ CString get_BGColor() {
CString result;
InvokeHelper(0x8c, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
- void put_BGColor(LPCTSTR newValue)
- {
+ void put_BGColor(LPCTSTR newValue) {
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x8c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- CString get_Quality2()
- {
+ CString get_Quality2() {
CString result;
InvokeHelper(0x8d, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
- void put_Quality2(LPCTSTR newValue)
- {
+ void put_Quality2(LPCTSTR newValue) {
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x8d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- void LoadMovie(long layer, LPCTSTR url)
- {
+ void LoadMovie(long layer, LPCTSTR url) {
static BYTE parms[] = VTS_I4 VTS_BSTR ;
InvokeHelper(0x8e, DISPATCH_METHOD, VT_EMPTY, NULL, parms, layer, url);
}
- void TGotoFrame(LPCTSTR target, long FrameNum)
- {
+ void TGotoFrame(LPCTSTR target, long FrameNum) {
static BYTE parms[] = VTS_BSTR VTS_I4 ;
InvokeHelper(0x8f, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, FrameNum);
}
- void TGotoLabel(LPCTSTR target, LPCTSTR label)
- {
+ void TGotoLabel(LPCTSTR target, LPCTSTR label) {
static BYTE parms[] = VTS_BSTR VTS_BSTR ;
InvokeHelper(0x90, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, label);
}
- long TCurrentFrame(LPCTSTR target)
- {
+ long TCurrentFrame(LPCTSTR target) {
long result;
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x91, DISPATCH_METHOD, VT_I4, (void*)&result, parms, target);
return result;
}
- CString TCurrentLabel(LPCTSTR target)
- {
+ CString TCurrentLabel(LPCTSTR target) {
CString result;
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x92, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms, target);
return result;
}
- void TPlay(LPCTSTR target)
- {
+ void TPlay(LPCTSTR target) {
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x93, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target);
}
- void TStopPlay(LPCTSTR target)
- {
+ void TStopPlay(LPCTSTR target) {
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x94, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target);
}
- void SetVariable(LPCTSTR name, LPCTSTR value)
- {
+ void SetVariable(LPCTSTR name, LPCTSTR value) {
static BYTE parms[] = VTS_BSTR VTS_BSTR ;
InvokeHelper(0x97, DISPATCH_METHOD, VT_EMPTY, NULL, parms, name, value);
}
- CString GetVariable(LPCTSTR name)
- {
+ CString GetVariable(LPCTSTR name) {
CString result;
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x98, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms, name);
return result;
}
- void TSetProperty(LPCTSTR target, long property, LPCTSTR value)
- {
+ void TSetProperty(LPCTSTR target, long property, LPCTSTR value) {
static BYTE parms[] = VTS_BSTR VTS_I4 VTS_BSTR ;
InvokeHelper(0x99, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, property, value);
}
- CString TGetProperty(LPCTSTR target, long property)
- {
+ CString TGetProperty(LPCTSTR target, long property) {
CString result;
static BYTE parms[] = VTS_BSTR VTS_I4 ;
InvokeHelper(0x9a, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms, target, property);
return result;
}
- void TCallFrame(LPCTSTR target, long FrameNum)
- {
+ void TCallFrame(LPCTSTR target, long FrameNum) {
static BYTE parms[] = VTS_BSTR VTS_I4 ;
InvokeHelper(0x9b, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, FrameNum);
}
- void TCallLabel(LPCTSTR target, LPCTSTR label)
- {
+ void TCallLabel(LPCTSTR target, LPCTSTR label) {
static BYTE parms[] = VTS_BSTR VTS_BSTR ;
InvokeHelper(0x9c, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, label);
}
- void TSetPropertyNum(LPCTSTR target, long property, double value)
- {
+ void TSetPropertyNum(LPCTSTR target, long property, double value) {
static BYTE parms[] = VTS_BSTR VTS_I4 VTS_R8 ;
InvokeHelper(0x9d, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, property, value);
}
- double TGetPropertyNum(LPCTSTR target, long property)
- {
+ double TGetPropertyNum(LPCTSTR target, long property) {
double result;
static BYTE parms[] = VTS_BSTR VTS_I4 ;
InvokeHelper(0x9e, DISPATCH_METHOD, VT_R8, (void*)&result, parms, target, property);
return result;
}
- double TGetPropertyAsNumber(LPCTSTR target, long property)
- {
+ double TGetPropertyAsNumber(LPCTSTR target, long property) {
double result;
static BYTE parms[] = VTS_BSTR VTS_I4 ;
InvokeHelper(0xac, DISPATCH_METHOD, VT_R8, (void*)&result, parms, target, property);
return result;
}
- CString get_SWRemote()
- {
+ CString get_SWRemote() {
CString result;
InvokeHelper(0x9f, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
- void put_SWRemote(LPCTSTR newValue)
- {
+ void put_SWRemote(LPCTSTR newValue) {
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x9f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- CString get_FlashVars()
- {
+ CString get_FlashVars() {
CString result;
InvokeHelper(0xaa, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
- void put_FlashVars(LPCTSTR newValue)
- {
+ void put_FlashVars(LPCTSTR newValue) {
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0xaa, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
- CString get_AllowScriptAccess()
- {
+ CString get_AllowScriptAccess() {
CString result;
InvokeHelper(0xab, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
- void put_AllowScriptAccess(LPCTSTR newValue)
- {
+ void put_AllowScriptAccess(LPCTSTR newValue) {
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0xab, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
diff --git a/src/apps/mplayerc/ChildView.cpp b/src/apps/mplayerc/ChildView.cpp index ee2cd068f..0349125e9 100644 --- a/src/apps/mplayerc/ChildView.cpp +++ b/src/apps/mplayerc/ChildView.cpp @@ -45,8 +45,9 @@ CChildView::~CChildView() BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CWnd::PreCreateWindow(cs))
+ if(!CWnd::PreCreateWindow(cs)) {
return FALSE;
+ }
cs.style &= ~WS_BORDER;
cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
@@ -57,8 +58,7 @@ BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs) BOOL CChildView::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MYMOUSELAST)
- {
+ if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MYMOUSELAST) {
CWnd* pParent = GetParent();
CPoint p(pMsg->lParam);
::MapWindowPoints(pMsg->hwnd, pParent->m_hWnd, &p, 1);
@@ -66,48 +66,43 @@ BOOL CChildView::PreTranslateMessage(MSG* pMsg) bool fDblClick = false;
bool fInteractiveVideo = ((CMainFrame*)AfxGetMainWnd())->IsInteractiveVideo();
-/*
- if(fInteractiveVideo)
- {
- if(pMsg->message == WM_LBUTTONDOWN)
- {
- if((pMsg->time - m_lastlmdowntime) <= GetDoubleClickTime()
- && abs(pMsg->pt.x - m_lastlmdownpoint.x) <= GetSystemMetrics(SM_CXDOUBLECLK)
- && abs(pMsg->pt.y - m_lastlmdownpoint.y) <= GetSystemMetrics(SM_CYDOUBLECLK))
- {
- fDblClick = true;
- m_lastlmdowntime = 0;
- m_lastlmdownpoint.SetPoint(0, 0);
- }
- else
+ /*
+ if(fInteractiveVideo)
{
- m_lastlmdowntime = pMsg->time;
- m_lastlmdownpoint = pMsg->pt;
+ if(pMsg->message == WM_LBUTTONDOWN)
+ {
+ if((pMsg->time - m_lastlmdowntime) <= GetDoubleClickTime()
+ && abs(pMsg->pt.x - m_lastlmdownpoint.x) <= GetSystemMetrics(SM_CXDOUBLECLK)
+ && abs(pMsg->pt.y - m_lastlmdownpoint.y) <= GetSystemMetrics(SM_CYDOUBLECLK))
+ {
+ fDblClick = true;
+ m_lastlmdowntime = 0;
+ m_lastlmdownpoint.SetPoint(0, 0);
+ }
+ else
+ {
+ m_lastlmdowntime = pMsg->time;
+ m_lastlmdownpoint = pMsg->pt;
+ }
+ }
+ else if(pMsg->message == WM_LBUTTONDBLCLK)
+ {
+ m_lastlmdowntime = pMsg->time;
+ m_lastlmdownpoint = pMsg->pt;
+ }
}
- }
- else if(pMsg->message == WM_LBUTTONDBLCLK)
- {
- m_lastlmdowntime = pMsg->time;
- m_lastlmdownpoint = pMsg->pt;
- }
- }
-*/
+ */
if((pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONUP || pMsg->message == WM_MOUSEMOVE)
- && fInteractiveVideo)
- {
- if(pMsg->message == WM_MOUSEMOVE)
- {
+ && fInteractiveVideo) {
+ if(pMsg->message == WM_MOUSEMOVE) {
pParent->PostMessage(pMsg->message, pMsg->wParam, MAKELPARAM(p.x, p.y));
}
- if(fDblClick)
- {
+ if(fDblClick) {
pParent->PostMessage(WM_LBUTTONDOWN, pMsg->wParam, MAKELPARAM(p.x, p.y));
pParent->PostMessage(WM_LBUTTONDBLCLK, pMsg->wParam, MAKELPARAM(p.x, p.y));
}
- }
- else
- {
+ } else {
pParent->PostMessage(pMsg->message, pMsg->wParam, MAKELPARAM(p.x, p.y));
return TRUE;
}
@@ -132,26 +127,30 @@ void CChildView::LoadLogo() m_logo.Destroy();
- if(s.fLogoExternal)
+ if(s.fLogoExternal) {
bHaveLogo = SUCCEEDED(m_logo.Load(s.strLogoFileName));
+ }
- if(!bHaveLogo)
- {
+ if(!bHaveLogo) {
s.fLogoExternal = false; // use the built-in logo instead
s.strLogoFileName = ""; // clear logo file name
- if (!m_logo.LoadFromResource(s.nLogoId)) // try the latest selected build-in logo
- m_logo.LoadFromResource(s.nLogoId=DEF_LOGO); // if fail then use the default logo, should never fail
+ if (!m_logo.LoadFromResource(s.nLogoId)) { // try the latest selected build-in logo
+ m_logo.LoadFromResource(s.nLogoId=DEF_LOGO); // if fail then use the default logo, should never fail
+ }
}
- if(m_hWnd) Invalidate();
+ if(m_hWnd) {
+ Invalidate();
+ }
}
CSize CChildView::GetLogoSize() const
{
CSize ret(0,0);
- if(!m_logo.IsNull())
+ if(!m_logo.IsNull()) {
ret.SetSize(m_logo.GetWidth(), m_logo.GetHeight());
+ }
return ret;
}
@@ -192,27 +191,24 @@ BOOL CChildView::OnEraseBkgnd(CDC* pDC) CAutoLock cAutoLock(&m_csLogo);
- if(((CMainFrame*)GetParentFrame())->IsSomethingLoaded())
- {
+ if(((CMainFrame*)GetParentFrame())->IsSomethingLoaded()) {
pDC->ExcludeClipRect(m_vrect);
- }
- else if(!m_logo.IsNull() /*&& ((CMainFrame*)GetParentFrame())->IsPlaylistEmpty()*/)
- {
+ } else if(!m_logo.IsNull() /*&& ((CMainFrame*)GetParentFrame())->IsPlaylistEmpty()*/) {
BITMAP bm;
GetObject(m_logo, sizeof(bm), &bm);
GetClientRect(r);
int w = min(bm.bmWidth, r.Width());
int h = min(abs(bm.bmHeight), r.Height());
-// int w = min(m_logo.GetWidth(), r.Width());
-// int h = min(m_logo.GetHeight(), r.Height());
+ // int w = min(m_logo.GetWidth(), r.Width());
+ // int h = min(m_logo.GetHeight(), r.Height());
int x = (r.Width() - w) / 2;
int y = (r.Height() - h) / 2;
r = CRect(CPoint(x, y), CSize(w, h));
int oldmode = pDC->SetStretchBltMode(STRETCH_HALFTONE);
m_logo.StretchBlt(*pDC, r, CRect(0,0,bm.bmWidth,abs(bm.bmHeight)));
-// m_logo.Draw(*pDC, r);
+ // m_logo.Draw(*pDC, r);
pDC->SetStretchBltMode(oldmode);
pDC->ExcludeClipRect(r);
@@ -233,29 +229,34 @@ void CChildView::OnSize(UINT nType, int cx, int cy) BOOL CChildView::OnPlayPlayPauseStop(UINT nID)
{
- if(nID == ID_PLAY_STOP) SetVideoRect();
+ if(nID == ID_PLAY_STOP) {
+ SetVideoRect();
+ }
CString osd = ResStr(nID);
int i = osd.Find(_T("\n"));
- if(i > 0) osd.Delete(i, osd.GetLength()-i);
+ if(i > 0) {
+ osd.Delete(i, osd.GetLength()-i);
+ }
CRect r1;
((CMainFrame*)AfxGetMainWnd())->GetClientRect(&r1);
- if((!r1.Width()) || (!r1.Height())) return FALSE;
+ if((!r1.Width()) || (!r1.Height())) {
+ return FALSE;
+ }
- if(!(((CMainFrame*)AfxGetMainWnd())->m_OpenFile))
+ if(!(((CMainFrame*)AfxGetMainWnd())->m_OpenFile)) {
((CMainFrame*)AfxGetMainWnd())->m_OSD.DisplayMessage(OSD_TOPLEFT, osd, 1500);
+ }
return FALSE;
}
BOOL CChildView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
- if(((CMainFrame*)GetParentFrame())->m_fHideCursor)
- {
+ if(((CMainFrame*)GetParentFrame())->m_fHideCursor) {
SetCursor(NULL);
return TRUE;
}
- if(((CMainFrame*)GetParentFrame())->IsSomethingLoaded() && (nHitTest == HTCLIENT))
- {
+ if(((CMainFrame*)GetParentFrame())->IsSomethingLoaded() && (nHitTest == HTCLIENT)) {
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_HAND));
return TRUE;
}
@@ -271,10 +272,10 @@ LRESULT CChildView::OnNcHitTest(CPoint point) AppSettings& s = AfxGetAppSettings();
POSITION pos = s.wmcmds.GetHeadPosition();
while(pos && fLeftMouseBtnUnassigned)
- if(s.wmcmds.GetNext(pos).mouse == wmcmd::LDOWN)
+ if(s.wmcmds.GetNext(pos).mouse == wmcmd::LDOWN) {
fLeftMouseBtnUnassigned = false;
- if(!pFrame->m_fFullScreen && (pFrame->IsCaptionMenuHidden() || fLeftMouseBtnUnassigned))
- {
+ }
+ if(!pFrame->m_fFullScreen && (pFrame->IsCaptionMenuHidden() || fLeftMouseBtnUnassigned)) {
CRect rcClient, rcFrame;
GetWindowRect(&rcFrame);
rcClient = rcFrame;
@@ -284,44 +285,26 @@ LRESULT CChildView::OnNcHitTest(CPoint point) rcClient.InflateRect(-(5 * sizeBorder.cx), -(5 * sizeBorder.cy));
rcFrame.InflateRect(sizeBorder.cx, sizeBorder.cy);
- if(rcFrame.PtInRect(point))
- {
- if(point.x > rcClient.right)
- {
- if(point.y < rcClient.top)
- {
+ if(rcFrame.PtInRect(point)) {
+ if(point.x > rcClient.right) {
+ if(point.y < rcClient.top) {
nHitTest = HTTOPRIGHT;
- }
- else if(point.y > rcClient.bottom)
- {
+ } else if(point.y > rcClient.bottom) {
nHitTest = HTBOTTOMRIGHT;
- }
- else
- {
+ } else {
nHitTest = HTRIGHT;
}
- }
- else if(point.x < rcClient.left)
- {
- if(point.y < rcClient.top)
- {
+ } else if(point.x < rcClient.left) {
+ if(point.y < rcClient.top) {
nHitTest = HTTOPLEFT;
- }
- else if(point.y > rcClient.bottom)
- {
+ } else if(point.y > rcClient.bottom) {
nHitTest = HTBOTTOMLEFT;
- }
- else
- {
+ } else {
nHitTest = HTLEFT;
}
- }
- else if(point.y < rcClient.top)
- {
+ } else if(point.y < rcClient.top) {
nHitTest = HTTOP;
- }
- else if(point.y > rcClient.bottom)
- {
+ } else if(point.y > rcClient.bottom) {
nHitTest = HTBOTTOM;
}
}
@@ -336,44 +319,40 @@ void CChildView::OnNcLButtonDown(UINT nHitTest, CPoint point) AppSettings& s = AfxGetAppSettings();
POSITION pos = s.wmcmds.GetHeadPosition();
while(pos && fLeftMouseBtnUnassigned)
- if(s.wmcmds.GetNext(pos).mouse == wmcmd::LDOWN)
+ if(s.wmcmds.GetNext(pos).mouse == wmcmd::LDOWN) {
fLeftMouseBtnUnassigned = false;
- if(!pFrame->m_fFullScreen && (pFrame->IsCaptionMenuHidden() || fLeftMouseBtnUnassigned))
- {
+ }
+ if(!pFrame->m_fFullScreen && (pFrame->IsCaptionMenuHidden() || fLeftMouseBtnUnassigned)) {
BYTE bFlag = 0;
- switch(nHitTest)
- {
- case HTTOP:
- bFlag = WMSZ_TOP;
- break;
- case HTTOPLEFT:
- bFlag = WMSZ_TOPLEFT;
- break;
- case HTTOPRIGHT:
- bFlag = WMSZ_TOPRIGHT;
- break;
- case HTLEFT:
- bFlag = WMSZ_LEFT;
- break;
- case HTRIGHT:
- bFlag = WMSZ_RIGHT;
- break;
- case HTBOTTOM:
- bFlag = WMSZ_BOTTOM;
- break;
- case HTBOTTOMLEFT:
- bFlag = WMSZ_BOTTOMLEFT;
- break;
- case HTBOTTOMRIGHT:
- bFlag = WMSZ_BOTTOMRIGHT;
- break;
+ switch(nHitTest) {
+ case HTTOP:
+ bFlag = WMSZ_TOP;
+ break;
+ case HTTOPLEFT:
+ bFlag = WMSZ_TOPLEFT;
+ break;
+ case HTTOPRIGHT:
+ bFlag = WMSZ_TOPRIGHT;
+ break;
+ case HTLEFT:
+ bFlag = WMSZ_LEFT;
+ break;
+ case HTRIGHT:
+ bFlag = WMSZ_RIGHT;
+ break;
+ case HTBOTTOM:
+ bFlag = WMSZ_BOTTOM;
+ break;
+ case HTBOTTOMLEFT:
+ bFlag = WMSZ_BOTTOMLEFT;
+ break;
+ case HTBOTTOMRIGHT:
+ bFlag = WMSZ_BOTTOMRIGHT;
+ break;
}
- if(bFlag)
- {
+ if(bFlag) {
pFrame->PostMessage(WM_SYSCOMMAND, (SC_SIZE | bFlag), (LPARAM)POINTTOPOINTS(point));
- }
- else
- {
+ } else {
CWnd::OnNcLButtonDown(nHitTest, point);
}
}
diff --git a/src/apps/mplayerc/ChildView.h b/src/apps/mplayerc/ChildView.h index 05cdf8c24..be8dabe6b 100644 --- a/src/apps/mplayerc/ChildView.h +++ b/src/apps/mplayerc/ChildView.h @@ -43,8 +43,7 @@ public: public:
void SetVideoRect(CRect r = CRect(0,0,0,0));
- CRect GetVideoRect() const
- {
+ CRect GetVideoRect() const {
return(m_vrect);
}
diff --git a/src/apps/mplayerc/ComPropertyPage.cpp b/src/apps/mplayerc/ComPropertyPage.cpp index 5cbd5bd44..90519a5a3 100644 --- a/src/apps/mplayerc/ComPropertyPage.cpp +++ b/src/apps/mplayerc/ComPropertyPage.cpp @@ -75,8 +75,7 @@ BOOL CComPropertyPage::OnSetActive() SetModified(S_OK == m_pPage->IsPageDirty());
CWnd* pParent = GetParent();
- if(pParent->IsKindOf(RUNTIME_CLASS(CComPropertySheet)))
- {
+ if(pParent->IsKindOf(RUNTIME_CLASS(CComPropertySheet))) {
CComPropertySheet* pSheet = static_cast<CComPropertySheet*>(pParent);
pSheet->OnActivated(this);
}
@@ -101,7 +100,9 @@ END_MESSAGE_MAP() void CComPropertyPage::OnOK()
{
- if(S_OK == m_pPage->IsPageDirty()) m_pPage->Apply();
+ if(S_OK == m_pPage->IsPageDirty()) {
+ m_pPage->Apply();
+ }
SetModified(FALSE);
CPropertyPage::OnOK();
diff --git a/src/apps/mplayerc/ComPropertyPage.h b/src/apps/mplayerc/ComPropertyPage.h index e8fa04d64..ba09ab502 100644 --- a/src/apps/mplayerc/ComPropertyPage.h +++ b/src/apps/mplayerc/ComPropertyPage.h @@ -35,7 +35,7 @@ public: CComPropertyPage(IPropertyPage* pPage);
virtual ~CComPropertyPage();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_COMPROPERTYPAGE };
protected:
diff --git a/src/apps/mplayerc/ComPropertySheet.cpp b/src/apps/mplayerc/ComPropertySheet.cpp index b1c6502c5..dc9c47fe8 100644 --- a/src/apps/mplayerc/ComPropertySheet.cpp +++ b/src/apps/mplayerc/ComPropertySheet.cpp @@ -38,35 +38,33 @@ public: CComPropertyPageSite(IComPropertyPageDirty* pPPD) : CUnknown(NAME("CComPropertyPageSite"), NULL), m_pPPD(pPPD) {}
DECLARE_IUNKNOWN
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
- {
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) {
return
QI(IPropertyPageSite)
__super::NonDelegatingQueryInterface(riid, ppv);
}
// IPropertyPageSite
- STDMETHODIMP OnStatusChange(DWORD flags)
- {
- if(m_pPPD)
- {
- if(flags&PROPPAGESTATUS_DIRTY) m_pPPD->OnSetDirty(true);
- if(flags&PROPPAGESTATUS_CLEAN) m_pPPD->OnSetDirty(false);
+ STDMETHODIMP OnStatusChange(DWORD flags) {
+ if(m_pPPD) {
+ if(flags&PROPPAGESTATUS_DIRTY) {
+ m_pPPD->OnSetDirty(true);
+ }
+ if(flags&PROPPAGESTATUS_CLEAN) {
+ m_pPPD->OnSetDirty(false);
+ }
}
return S_OK;
}
- STDMETHODIMP GetLocaleID(LCID* pLocaleID)
- {
+ STDMETHODIMP GetLocaleID(LCID* pLocaleID) {
CheckPointer(pLocaleID, E_POINTER);
*pLocaleID = ::GetUserDefaultLCID();
return S_OK;
}
- STDMETHODIMP GetPageContainer(IUnknown** ppUnk)
- {
+ STDMETHODIMP GetPageContainer(IUnknown** ppUnk) {
return E_NOTIMPL;
}
- STDMETHODIMP TranslateAccelerator(LPMSG pMsg)
- {
+ STDMETHODIMP TranslateAccelerator(LPMSG pMsg) {
return E_NOTIMPL;
}
};
@@ -94,16 +92,20 @@ CComPropertySheet::~CComPropertySheet() int CComPropertySheet::AddPages(ISpecifyPropertyPages* pSPP)
{
- if(!pSPP) return(0);
+ if(!pSPP) {
+ return(0);
+ }
CAUUID caGUID;
caGUID.pElems = NULL;
- if(FAILED(pSPP->GetPages(&caGUID)))
+ if(FAILED(pSPP->GetPages(&caGUID))) {
return(0);
+ }
IUnknown* lpUnk = NULL;
- if(FAILED(pSPP->QueryInterface(&lpUnk)))
+ if(FAILED(pSPP->QueryInterface(&lpUnk))) {
return(0);
+ }
m_spp.AddTail(pSPP);
@@ -111,35 +113,33 @@ int CComPropertySheet::AddPages(ISpecifyPropertyPages* pSPP) CComQIPtr<IPersist> pPersist = pSPP;
ULONG nPages = 0;
- for(ULONG i = 0; i < caGUID.cElems; i++)
- {
+ for(ULONG i = 0; i < caGUID.cElems; i++) {
CComPtr<IPropertyPage> pPage;
HRESULT hr = E_FAIL;
- if(FAILED(hr) && !pPage && pSPP2)
- {
+ if(FAILED(hr) && !pPage && pSPP2) {
hr = pSPP2->CreatePage(caGUID.pElems[i], &pPage);
}
- if(FAILED(hr) && !pPage)
- {
+ if(FAILED(hr) && !pPage) {
hr = pPage.CoCreateInstance(caGUID.pElems[i]);
}
- if(FAILED(hr) && !pPage && pPersist)
- {
+ if(FAILED(hr) && !pPage && pPersist) {
hr = LoadExternalPropertyPage(pPersist, caGUID.pElems[i], &pPage);
}
- if(SUCCEEDED(hr))
- {
- if(AddPage(pPage, lpUnk))
+ if(SUCCEEDED(hr)) {
+ if(AddPage(pPage, lpUnk)) {
nPages++;
+ }
}
}
- if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
+ if(caGUID.pElems) {
+ CoTaskMemFree(caGUID.pElems);
+ }
lpUnk->Release();
return(nPages);
@@ -147,7 +147,9 @@ int CComPropertySheet::AddPages(ISpecifyPropertyPages* pSPP) bool CComPropertySheet::AddPage(IPropertyPage* pPage, IUnknown* pUnk)
{
- if(!pPage || !pUnk) return false;
+ if(!pPage || !pUnk) {
+ return false;
+ }
HRESULT hr;
hr = pPage->SetPageSite(m_pSite);
@@ -165,7 +167,9 @@ bool CComPropertySheet::AddPage(IPropertyPage* pPage, IUnknown* pUnk) void CComPropertySheet::OnActivated(CPropertyPage* pPage)
{
- if(!pPage) return;
+ if(!pPage) {
+ return;
+ }
CRect bounds(30000,30000,-30000,-30000);
@@ -180,14 +184,14 @@ void CComPropertySheet::OnActivated(CPropertyPage* pPage) pTC->GetClientRect(tcr);
CSize tws = twr.Size(), tcs = tcr.Size();
- if(CWnd* pChild = pPage->GetWindow(GW_CHILD))
- {
+ if(CWnd* pChild = pPage->GetWindow(GW_CHILD)) {
pChild->ModifyStyle(WS_CAPTION|WS_THICKFRAME, 0);
pChild->ModifyStyleEx(WS_EX_DLGMODALFRAME, WS_EX_CONTROLPARENT);
- for(CWnd* pGrandChild = pChild->GetWindow(GW_CHILD); pGrandChild; pGrandChild = pGrandChild->GetNextWindow())
- {
- if(!(pGrandChild->GetStyle()&WS_VISIBLE)) continue;
+ for(CWnd* pGrandChild = pChild->GetWindow(GW_CHILD); pGrandChild; pGrandChild = pGrandChild->GetNextWindow()) {
+ if(!(pGrandChild->GetStyle()&WS_VISIBLE)) {
+ continue;
+ }
CRect r;
pGrandChild->GetWindowRect(&r);
@@ -208,10 +212,10 @@ void CComPropertySheet::OnActivated(CPropertyPage* pPage) CSize diff = r.Size() - tws;
- if(!bounds.IsRectEmpty())
- {
- if(CWnd* pChild = pPage->GetWindow(GW_CHILD))
+ if(!bounds.IsRectEmpty()) {
+ if(CWnd* pChild = pPage->GetWindow(GW_CHILD)) {
pChild->MoveWindow(bounds);
+ }
CRect r = twr;
pTC->AdjustRect(FALSE, r);
ScreenToClient(r);
@@ -219,10 +223,8 @@ void CComPropertySheet::OnActivated(CPropertyPage* pPage) }
int _afxPropSheetButtons[] = { IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP };
- for(int i = 0; i < countof(_afxPropSheetButtons); i++)
- {
- if(CWnd* pWnd = GetDlgItem(_afxPropSheetButtons[i]))
- {
+ for(int i = 0; i < countof(_afxPropSheetButtons); i++) {
+ if(CWnd* pWnd = GetDlgItem(_afxPropSheetButtons[i])) {
pWnd->GetWindowRect(r);
ScreenToClient(r);
pWnd->MoveWindow(CRect(r.TopLeft() + diff, r.Size()));
@@ -245,8 +247,9 @@ BOOL CComPropertySheet::OnInitDialog() {
BOOL bResult = (BOOL)Default();//CPropertySheet::OnInitDialog();
- if (!(GetStyle() & WS_CHILD))
+ if (!(GetStyle() & WS_CHILD)) {
CenterWindow();
+ }
return bResult;
}
diff --git a/src/apps/mplayerc/ComPropertySheet.h b/src/apps/mplayerc/ComPropertySheet.h index 4508a45f8..f96044980 100644 --- a/src/apps/mplayerc/ComPropertySheet.h +++ b/src/apps/mplayerc/ComPropertySheet.h @@ -26,8 +26,7 @@ #include "ComPropertyPage.h"
-interface IComPropertyPageDirty
-{
+interface IComPropertyPageDirty {
virtual void OnSetDirty(bool fDirty) = 0;
};
@@ -53,9 +52,10 @@ public: void OnActivated(CPropertyPage* pPage);
// IComPropertyPageDirty
- void OnSetDirty(bool fDirty)
- {
- if(CPropertyPage* p = GetActivePage()) p->SetModified(fDirty);
+ void OnSetDirty(bool fDirty) {
+ if(CPropertyPage* p = GetActivePage()) {
+ p->SetModified(fDirty);
+ }
}
virtual BOOL OnInitDialog();
diff --git a/src/apps/mplayerc/DVBChannel.cpp b/src/apps/mplayerc/DVBChannel.cpp index 30f17449e..6a0d8bff4 100644 --- a/src/apps/mplayerc/DVBChannel.cpp +++ b/src/apps/mplayerc/DVBChannel.cpp @@ -58,10 +58,12 @@ void CDVBChannel::FromString(CString strValue) m_ulFrequency = _tstol(strValue.Tokenize(_T("|"), i));
m_nPrefNumber = _tstol(strValue.Tokenize(_T("|"), i));
m_nOriginNumber = _tstol(strValue.Tokenize(_T("|"), i));
- if (nVersion > FORMAT_VERSION_0)
+ if (nVersion > FORMAT_VERSION_0) {
m_bEncrypted = _tstol(strValue.Tokenize(_T("|"), i));
- if (nVersion > FORMAT_VERSION_1)
+ }
+ if (nVersion > FORMAT_VERSION_1) {
m_bNowNextFlag = _tstol(strValue.Tokenize(_T("|"), i));
+ }
m_ulONID = _tstol(strValue.Tokenize(_T("|"), i));
m_ulTSID = _tstol(strValue.Tokenize(_T("|"), i));
m_ulSID = _tstol(strValue.Tokenize(_T("|"), i));
@@ -70,20 +72,19 @@ void CDVBChannel::FromString(CString strValue) m_ulVideoPID = _tstol(strValue.Tokenize(_T("|"), i));
m_nVideoType = (DVB_STREAM_TYPE)_tstol(strValue.Tokenize(_T("|"), i));
m_nAudioCount = _tstol(strValue.Tokenize(_T("|"), i));
- if (nVersion > FORMAT_VERSION_1)
+ if (nVersion > FORMAT_VERSION_1) {
m_nDefaultAudio = _tstol(strValue.Tokenize(_T("|"), i));
+ }
m_nSubtitleCount = _tstol(strValue.Tokenize(_T("|"), i));
- for(int j=0; j<m_nAudioCount; j++)
- {
+ for(int j=0; j<m_nAudioCount; j++) {
m_Audios[j].PID = _tstol(strValue.Tokenize(_T("|"), i));
m_Audios[j].Type = (DVB_STREAM_TYPE)_tstol(strValue.Tokenize(_T("|"), i));
m_Audios[j].PesType = (PES_STREAM_TYPE)_tstol(strValue.Tokenize(_T("|"), i));
m_Audios[j].Language = strValue.Tokenize(_T("|"), i);
}
- for(int j=0; j<m_nSubtitleCount; j++)
- {
+ for(int j=0; j<m_nSubtitleCount; j++) {
m_Subtitles[j].PID = _tstol(strValue.Tokenize(_T("|"), i));
m_Subtitles[j].Type = (DVB_STREAM_TYPE)_tstol(strValue.Tokenize(_T("|"), i));
m_Subtitles[j].PesType = (PES_STREAM_TYPE)_tstol(strValue.Tokenize(_T("|"), i));
@@ -114,11 +115,13 @@ CString CDVBChannel::ToString() m_nDefaultAudio,
m_nSubtitleCount);
- for(int i=0; i<m_nAudioCount; i++)
+ for(int i=0; i<m_nAudioCount; i++) {
strValue.AppendFormat (_T("|%ld|%d|%d|%s"), m_Audios[i].PID, m_Audios[i].Type, m_Audios[i].PesType, m_Audios[i].Language);
+ }
- for(int i=0; i<m_nSubtitleCount; i++)
+ for(int i=0; i<m_nSubtitleCount; i++) {
strValue.AppendFormat (_T("|%ld|%d|%d|%s"), m_Subtitles[i].PID, m_Subtitles[i].Type, m_Subtitles[i].PesType, m_Subtitles[i].Language);
+ }
return strValue;
}
@@ -132,34 +135,31 @@ void CDVBChannel::SetName(BYTE* Value) void CDVBChannel::AddStreamInfo (ULONG ulPID, DVB_STREAM_TYPE nType, PES_STREAM_TYPE nPesType, LPCTSTR strLanguage)
{
- switch (nType)
- {
- case DVB_MPV :
- case DVB_H264 :
- m_ulVideoPID = ulPID;
- m_nVideoType = nType;
- break;
- case DVB_MPA :
- case DVB_AC3 :
- case DVB_EAC3 :
- if (m_nAudioCount < DVB_MAX_AUDIO)
- {
- m_Audios[m_nAudioCount].PID = ulPID;
- m_Audios[m_nAudioCount].Type = nType;
- m_Audios[m_nAudioCount].PesType = nPesType;
- m_Audios[m_nAudioCount].Language = strLanguage;
- m_nAudioCount++;
- }
- break;
- case DVB_SUBTITLE :
- if (m_nSubtitleCount < DVB_MAX_SUBTITLE)
- {
- m_Subtitles[m_nSubtitleCount].PID = ulPID;
- m_Subtitles[m_nSubtitleCount].Type = nType;
- m_Subtitles[m_nSubtitleCount].PesType = nPesType;
- m_Subtitles[m_nSubtitleCount].Language = strLanguage;
- m_nSubtitleCount++;
- }
- break;
+ switch (nType) {
+ case DVB_MPV :
+ case DVB_H264 :
+ m_ulVideoPID = ulPID;
+ m_nVideoType = nType;
+ break;
+ case DVB_MPA :
+ case DVB_AC3 :
+ case DVB_EAC3 :
+ if (m_nAudioCount < DVB_MAX_AUDIO) {
+ m_Audios[m_nAudioCount].PID = ulPID;
+ m_Audios[m_nAudioCount].Type = nType;
+ m_Audios[m_nAudioCount].PesType = nPesType;
+ m_Audios[m_nAudioCount].Language = strLanguage;
+ m_nAudioCount++;
+ }
+ break;
+ case DVB_SUBTITLE :
+ if (m_nSubtitleCount < DVB_MAX_SUBTITLE) {
+ m_Subtitles[m_nSubtitleCount].PID = ulPID;
+ m_Subtitles[m_nSubtitleCount].Type = nType;
+ m_Subtitles[m_nSubtitleCount].PesType = nPesType;
+ m_Subtitles[m_nSubtitleCount].Language = strLanguage;
+ m_nSubtitleCount++;
+ }
+ break;
}
}
\ No newline at end of file diff --git a/src/apps/mplayerc/DVBChannel.h b/src/apps/mplayerc/DVBChannel.h index 25d296b60..7a8937a69 100644 --- a/src/apps/mplayerc/DVBChannel.h +++ b/src/apps/mplayerc/DVBChannel.h @@ -30,8 +30,7 @@ #define DVB_MAX_AUDIO 10
#define DVB_MAX_SUBTITLE 10
-typedef enum
-{
+typedef enum {
DVB_MPV = 0x00,
DVB_H264 = 0x01,
DVB_MPA = 0x02,
@@ -47,15 +46,13 @@ typedef enum } DVB_STREAM_TYPE;
-typedef struct
-{
+typedef struct {
ULONG PID;
DVB_STREAM_TYPE Type;
PES_STREAM_TYPE PesType;
CString Language;
- LCID GetLCID()
- {
+ LCID GetLCID() {
return ISO6392ToLcid(CStringA(Language));
};
} DVBStreamInfo;
@@ -69,147 +66,112 @@ public: void FromString(CString strValue);
CString ToString();
- LPCTSTR GetName() const
- {
+ LPCTSTR GetName() const {
return m_strName;
};
- ULONG GetFrequency() const
- {
+ ULONG GetFrequency() const {
return m_ulFrequency;
};
- int GetPrefNumber() const
- {
+ int GetPrefNumber() const {
return m_nPrefNumber;
};
- int GetOriginNumber() const
- {
+ int GetOriginNumber() const {
return m_nOriginNumber;
};
- ULONG GetONID() const
- {
+ ULONG GetONID() const {
return m_ulONID;
};
- ULONG GetTSID() const
- {
+ ULONG GetTSID() const {
return m_ulTSID;
};
- ULONG GetSID() const
- {
+ ULONG GetSID() const {
return m_ulSID;
};
- ULONG GetPMT() const
- {
+ ULONG GetPMT() const {
return m_ulPMT;
};
- ULONG GetPCR() const
- {
+ ULONG GetPCR() const {
return m_ulPCR;
};
- ULONG GetVideoPID() const
- {
+ ULONG GetVideoPID() const {
return m_ulVideoPID;
};
- DVB_STREAM_TYPE GetVideoType() const
- {
+ DVB_STREAM_TYPE GetVideoType() const {
return m_nVideoType;
}
- ULONG GetDefaultAudioPID() const
- {
+ ULONG GetDefaultAudioPID() const {
return m_Audios[GetDefaultAudio()].PID;
};
- DVB_STREAM_TYPE GetDefaultAudioType() const
- {
+ DVB_STREAM_TYPE GetDefaultAudioType() const {
return m_Audios[0].Type;
}
- ULONG GetDefaultSubtitlePID() const
- {
+ ULONG GetDefaultSubtitlePID() const {
return m_Subtitles[0].PID; /* TODO : fa*/
};
- int GetAudioCount() const
- {
+ int GetAudioCount() const {
return m_nAudioCount;
};
- int GetDefaultAudio() const
- {
+ int GetDefaultAudio() const {
return m_nDefaultAudio;
};
- int GetSubtitleCount() const
- {
+ int GetSubtitleCount() const {
return m_nSubtitleCount;
};
- DVBStreamInfo* GetAudio(int nIndex)
- {
+ DVBStreamInfo* GetAudio(int nIndex) {
return &m_Audios[nIndex];
};
- DVBStreamInfo* GetSubtitle(int nIndex)
- {
+ DVBStreamInfo* GetSubtitle(int nIndex) {
return &m_Subtitles[nIndex];
};
- bool HasName()
- {
+ bool HasName() {
return !m_strName.IsEmpty();
};
- bool IsEncrypted()
- {
+ bool IsEncrypted() {
return m_bEncrypted;
};
- bool GetNowNextFlag()
- {
+ bool GetNowNextFlag() {
return m_bNowNextFlag;
};
void SetName(BYTE* Value);
- void SetName(LPCTSTR Value)
- {
+ void SetName(LPCTSTR Value) {
m_strName = Value;
};
- void SetFrequency(ULONG Value)
- {
+ void SetFrequency(ULONG Value) {
m_ulFrequency = Value;
};
- void SetPrefNumber(int Value)
- {
+ void SetPrefNumber(int Value) {
m_nPrefNumber = Value;
};
- void SetOriginNumber(int Value)
- {
+ void SetOriginNumber(int Value) {
m_nOriginNumber = m_nPrefNumber = Value;
};
- void SetEncrypted(bool Value)
- {
+ void SetEncrypted(bool Value) {
m_bEncrypted = Value;
};
- void SetNowNextFlag(bool Value)
- {
+ void SetNowNextFlag(bool Value) {
m_bNowNextFlag = Value;
};
- void SetONID(ULONG Value)
- {
+ void SetONID(ULONG Value) {
m_ulONID = Value;
};
- void SetTSID(ULONG Value)
- {
+ void SetTSID(ULONG Value) {
m_ulTSID = Value;
};
- void SetSID(ULONG Value)
- {
+ void SetSID(ULONG Value) {
m_ulSID = Value;
};
- void SetPMT(ULONG Value)
- {
+ void SetPMT(ULONG Value) {
m_ulPMT = Value;
};
- void SetPCR(ULONG Value)
- {
+ void SetPCR(ULONG Value) {
m_ulPCR = Value;
};
- void SetVideoPID(ULONG Value)
- {
+ void SetVideoPID(ULONG Value) {
m_ulVideoPID = Value;
};
- void SetDefaultAudio(int Value)
- {
+ void SetDefaultAudio(int Value) {
m_nDefaultAudio = Value;
}
diff --git a/src/apps/mplayerc/DeinterlacerFilter.cpp b/src/apps/mplayerc/DeinterlacerFilter.cpp index b199d4e42..a6e531828 100644 --- a/src/apps/mplayerc/DeinterlacerFilter.cpp +++ b/src/apps/mplayerc/DeinterlacerFilter.cpp @@ -30,7 +30,9 @@ CDeinterlacerFilter::CDeinterlacerFilter(LPUNKNOWN punk, HRESULT* phr)
: CTransformFilter(NAME("CDeinterlacerFilter"), punk, __uuidof(CDeinterlacerFilter))
{
- if(phr) *phr = S_OK;
+ if(phr) {
+ *phr = S_OK;
+ }
}
HRESULT CDeinterlacerFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
@@ -41,8 +43,9 @@ HRESULT CDeinterlacerFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin) HRESULT CDeinterlacerFilter::CheckInputType(const CMediaType* mtIn)
{
BITMAPINFOHEADER bih;
- if(!ExtractBIH(mtIn, &bih) /*|| bih.biHeight <= 0*/ || bih.biHeight <= 288)
+ if(!ExtractBIH(mtIn, &bih) /*|| bih.biHeight <= 0*/ || bih.biHeight <= 288) {
return E_FAIL;
+ }
return mtIn->subtype == MEDIASUBTYPE_YUY2 || mtIn->subtype == MEDIASUBTYPE_UYVY
|| mtIn->subtype == MEDIASUBTYPE_I420 || mtIn->subtype == MEDIASUBTYPE_YV12 || mtIn->subtype == MEDIASUBTYPE_IYUV
@@ -60,20 +63,21 @@ HRESULT CDeinterlacerFilter::Transform(IMediaSample* pIn, IMediaSample* pOut) HRESULT hr;
AM_MEDIA_TYPE* pmt = NULL;
- if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
- {
+ if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt) {
CMediaType mt = *pmt;
m_pOutput->SetMediaType(&mt);
DeleteMediaType(pmt);
}
BYTE* pDataIn = NULL;
- if(FAILED(pIn->GetPointer(&pDataIn)) || !pDataIn)
+ if(FAILED(pIn->GetPointer(&pDataIn)) || !pDataIn) {
return S_FALSE;
+ }
BYTE* pDataOut = NULL;
- if(FAILED(hr = pOut->GetPointer(&pDataOut)) || !pDataOut)
+ if(FAILED(hr = pOut->GetPointer(&pDataOut)) || !pDataOut) {
return hr;
+ }
const CMediaType& mtIn = m_pInput->CurrentMediaType();
const CMediaType& mtOut = m_pOutput->CurrentMediaType();
@@ -91,18 +95,14 @@ HRESULT CDeinterlacerFilter::Transform(IMediaSample* pIn, IMediaSample* pOut) int pitchIn = bihIn.biWidth*bppIn>>3;
int pitchOut = bihOut.biWidth*bppOut>>3;
BYTE* pDataOut2 = pDataOut;
- if(fFlip)
- {
+ if(fFlip) {
pDataOut2 += pitchOut*(bihIn.biHeight-1);
pitchOut = -pitchOut;
}
- if(mtIn.subtype == MEDIASUBTYPE_YUY2 || mtIn.subtype == MEDIASUBTYPE_UYVY)
- {
+ if(mtIn.subtype == MEDIASUBTYPE_YUY2 || mtIn.subtype == MEDIASUBTYPE_UYVY) {
DeinterlaceBlend(pDataOut, pDataIn, pitchIn, bihIn.biHeight, pitchOut, pitchIn);
- }
- else if(mtIn.subtype == MEDIASUBTYPE_I420 || mtIn.subtype == MEDIASUBTYPE_YV12 || mtIn.subtype == MEDIASUBTYPE_IYUV)
- {
+ } else if(mtIn.subtype == MEDIASUBTYPE_I420 || mtIn.subtype == MEDIASUBTYPE_YV12 || mtIn.subtype == MEDIASUBTYPE_IYUV) {
DeinterlaceBlend(pDataOut, pDataIn, pitchIn, bihIn.biHeight, pitchOut, pitchIn);
int sizeIn = bihIn.biHeight*pitchIn, sizeOut = abs(bihOut.biHeight)*pitchOut;
@@ -123,7 +123,9 @@ HRESULT CDeinterlacerFilter::Transform(IMediaSample* pIn, IMediaSample* pOut) HRESULT CDeinterlacerFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+ if(m_pInput->IsConnected() == FALSE) {
+ return E_UNEXPECTED;
+ }
BITMAPINFOHEADER bih;
ExtractBIH(&m_pOutput->CurrentMediaType(), &bih);
@@ -135,8 +137,9 @@ HRESULT CDeinterlacerFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCAT HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
+ }
return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
? E_FAIL
@@ -145,9 +148,15 @@ HRESULT CDeinterlacerFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCAT HRESULT CDeinterlacerFilter::GetMediaType(int iPosition, CMediaType* pmt)
{
- if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+ if(m_pInput->IsConnected() == FALSE) {
+ return E_UNEXPECTED;
+ }
+ if(iPosition < 0) {
+ return E_INVALIDARG;
+ }
+ if(iPosition > 0) {
+ return VFW_S_NO_MORE_ITEMS;
+ }
*pmt = m_pInput->CurrentMediaType();
CorrectMediaType(pmt);
return S_OK;
diff --git a/src/apps/mplayerc/EditListEditor.cpp b/src/apps/mplayerc/EditListEditor.cpp index 8518fefaa..061630170 100644 --- a/src/apps/mplayerc/EditListEditor.cpp +++ b/src/apps/mplayerc/EditListEditor.cpp @@ -45,30 +45,36 @@ void CClip::SetOut(LPCTSTR strVal) void CClip::SetIn (REFERENCE_TIME rtVal)
{
m_rtIn = rtVal;
- if (m_rtIn > m_rtOut) m_rtOut = _I64_MIN;
+ if (m_rtIn > m_rtOut) {
+ m_rtOut = _I64_MIN;
+ }
};
void CClip::SetOut (REFERENCE_TIME rtVal)
{
m_rtOut = rtVal;
- if (m_rtIn > m_rtOut) m_rtIn = _I64_MIN;
+ if (m_rtIn > m_rtOut) {
+ m_rtIn = _I64_MIN;
+ }
};
CString CClip::GetIn()
{
- if (m_rtIn == _I64_MIN)
+ if (m_rtIn == _I64_MIN) {
return _T("");
- else
+ } else {
return ReftimeToString(m_rtIn);
+ }
}
CString CClip::GetOut()
{
- if (m_rtOut == _I64_MIN)
+ if (m_rtOut == _I64_MIN) {
return _T("");
- else
+ } else {
return ReftimeToString(m_rtOut);
+ }
}
@@ -104,8 +110,9 @@ END_MESSAGE_MAP() BOOL CEditListEditor::Create(CWnd* pParentWnd)
{
- if(!CSizingControlBarG::Create(_T("Edit List Editor"), pParentWnd, ID_VIEW_EDITLISTEDITOR))
+ if(!CSizingControlBarG::Create(_T("Edit List Editor"), pParentWnd, ID_VIEW_EDITLISTEDITOR)) {
return FALSE;
+ }
m_stUsers.Create (_T("User :"), WS_VISIBLE|WS_CHILD, CRect (5,5,100,21), this, 0);
m_cbUsers.Create (WS_CHILD|WS_VISIBLE|CBS_DROPDOWNLIST, CRect (90,0, 260, 21), this, 0);
@@ -144,8 +151,7 @@ void CEditListEditor::OnSize(UINT nType, int cx, int cy) void CEditListEditor::ResizeListColumn()
{
- if(::IsWindow(m_list.m_hWnd))
- {
+ if(::IsWindow(m_list.m_hWnd)) {
CRect r;
GetClientRect(r);
r.DeflateRect(2, 2);
@@ -161,35 +167,29 @@ void CEditListEditor::ResizeListColumn() void CEditListEditor::SaveEditListToFile()
{
- if ((m_bFileOpen || m_EditList.GetCount() >0) && !m_strFileName.IsEmpty())
- {
+ if ((m_bFileOpen || m_EditList.GetCount() >0) && !m_strFileName.IsEmpty()) {
CStdioFile EditListFile;
- if (EditListFile.Open (m_strFileName, CFile::modeCreate|CFile::modeWrite))
- {
+ if (EditListFile.Open (m_strFileName, CFile::modeCreate|CFile::modeWrite)) {
CString strLine;
int nIndex;
CString strUser;
CString strHotFolders;
nIndex = m_cbUsers.GetCurSel();
- if (nIndex >= 0)
- {
+ if (nIndex >= 0) {
m_cbUsers.GetLBText(nIndex, strUser);
}
nIndex = m_cbHotFolders.GetCurSel();
- if (nIndex >= 0)
- {
+ if (nIndex >= 0) {
m_cbHotFolders.GetLBText(nIndex, strHotFolders);
}
POSITION pos = m_EditList.GetHeadPosition();
- for(int i = 0; pos; i++, m_EditList.GetNext(pos))
- {
+ for(int i = 0; pos; i++, m_EditList.GetNext(pos)) {
CClip& CurClip = m_EditList.GetAt(pos);
- if (CurClip.HaveIn() && CurClip.HaveOut())
- {
+ if (CurClip.HaveIn() && CurClip.HaveOut()) {
strLine.Format(_T("%s\t%s\t%s\t%s\t%s\n"), CurClip.GetIn(), CurClip.GetOut(), CurClip.GetName(), strUser, strHotFolders);
EditListFile.WriteString (strLine);
}
@@ -221,11 +221,9 @@ void CEditListEditor::OpenFile(LPCTSTR lpFileName) CloseFile();
m_strFileName.Format(_T("%s.edl"), lpFileName);
- if (EditListFile.Open (m_strFileName, CFile::modeRead))
- {
+ if (EditListFile.Open (m_strFileName, CFile::modeRead)) {
m_bFileOpen = true;
- while (EditListFile.ReadString(strLine))
- {
+ while (EditListFile.ReadString(strLine)) {
//int nPos = 0;
CString strIn; // = strLine.Tokenize(_T(" \t"), nPos);
CString strOut; // = strLine.Tokenize(_T(" \t"), nPos);
@@ -234,19 +232,16 @@ void CEditListEditor::OpenFile(LPCTSTR lpFileName) AfxExtractSubString (strIn, strLine, 0, _T('\t'));
AfxExtractSubString (strOut, strLine, 1, _T('\t'));
AfxExtractSubString (strName, strLine, 2, _T('\t'));
- if (strUser.IsEmpty())
- {
+ if (strUser.IsEmpty()) {
AfxExtractSubString (strUser, strLine, 3, _T('\t'));
SelectCombo(strUser, m_cbUsers);
}
- if (strHotFolders.IsEmpty())
- {
+ if (strHotFolders.IsEmpty()) {
AfxExtractSubString (strHotFolders, strLine, 4, _T('\t'));
SelectCombo(strHotFolders, m_cbHotFolders);
}
- if (!strIn.IsEmpty() && !strOut.IsEmpty())
- {
+ if (!strIn.IsEmpty() && !strOut.IsEmpty()) {
CClip NewClip;
NewClip.SetIn (strIn);
NewClip.SetOut (strOut);
@@ -257,18 +252,15 @@ void CEditListEditor::OpenFile(LPCTSTR lpFileName) }
EditListFile.Close();
- }
- else
+ } else {
m_bFileOpen = false;
+ }
- if (m_NameList.GetCount() == 0)
- {
+ if (m_NameList.GetCount() == 0) {
CStdioFile NameFile;
CString str;
- if (NameFile.Open (_T("EditListNames.txt"), CFile::modeRead))
- {
- while(NameFile.ReadString(str))
- {
+ if (NameFile.Open (_T("EditListNames.txt"), CFile::modeRead)) {
+ while(NameFile.ReadString(str)) {
m_NameList.Add(str);
}
NameFile.Close();
@@ -278,8 +270,7 @@ void CEditListEditor::OpenFile(LPCTSTR lpFileName) void CEditListEditor::SetIn (REFERENCE_TIME rtIn)
{
- if (m_CurPos != NULL)
- {
+ if (m_CurPos != NULL) {
CClip& CurClip = m_EditList.GetAt (m_CurPos);
CurClip.SetIn (rtIn);
@@ -289,8 +280,7 @@ void CEditListEditor::SetIn (REFERENCE_TIME rtIn) void CEditListEditor::SetOut(REFERENCE_TIME rtOut)
{
- if (m_CurPos != NULL)
- {
+ if (m_CurPos != NULL) {
CClip& CurClip = m_EditList.GetAt (m_CurPos);
CurClip.SetOut (rtOut);
@@ -302,14 +292,13 @@ void CEditListEditor::NewClip(REFERENCE_TIME rtVal) {
CClip NewClip;
- if (m_CurPos != NULL)
- {
+ if (m_CurPos != NULL) {
CClip& CurClip = m_EditList.GetAt (m_CurPos);
- if (CurClip.HaveIn())
- {
- if (!CurClip.HaveOut())
+ if (CurClip.HaveIn()) {
+ if (!CurClip.HaveOut()) {
CurClip.SetOut (rtVal);
+ }
}
}
m_CurPos = InsertClip (m_CurPos, NewClip);
@@ -325,8 +314,7 @@ int CEditListEditor::FindIndex(POSITION pos) {
int iItem = 0;
POSITION CurPos = m_EditList.GetHeadPosition();
- while (CurPos && CurPos != pos)
- {
+ while (CurPos && CurPos != pos) {
m_EditList.GetNext (CurPos);
iItem++;
}
@@ -338,10 +326,11 @@ POSITION CEditListEditor::InsertClip(POSITION pos, CClip& NewClip) LVITEM lv;
POSITION NewClipPos;
- if (pos == NULL)
+ if (pos == NULL) {
NewClipPos = m_EditList.AddTail (NewClip);
- else
+ } else {
NewClipPos = m_EditList.InsertAfter (pos, NewClip);
+ }
lv.mask = LVIF_STATE | LVIF_TEXT;
lv.iItem = FindIndex (pos);
@@ -356,14 +345,15 @@ POSITION CEditListEditor::InsertClip(POSITION pos, CClip& NewClip) void CEditListEditor::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
- if(nIDCtl != IDC_EDITLIST) return;
+ if(nIDCtl != IDC_EDITLIST) {
+ return;
+ }
int nItem = lpDrawItemStruct->itemID;
CRect rcItem = lpDrawItemStruct->rcItem;
POSITION pos = m_EditList.FindIndex(nItem);
- if (pos != NULL)
- {
+ if (pos != NULL) {
bool fSelected = (pos == m_CurPos);
UNUSED_ALWAYS(fSelected);
CClip& CurClip = m_EditList.GetAt(pos);
@@ -371,38 +361,35 @@ void CEditListEditor::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
- if(!!m_list.GetItemState(nItem, LVIS_SELECTED))
- {
+ if(!!m_list.GetItemState(nItem, LVIS_SELECTED)) {
FillRect(pDC->m_hDC, rcItem, CBrush(0xf1dacc));
FrameRect(pDC->m_hDC, rcItem, CBrush(0xc56a31));
- }
- else
- {
+ } else {
FillRect(pDC->m_hDC, rcItem, CBrush(GetSysColor(COLOR_WINDOW)));
}
COLORREF textcolor = RGB(0,0,0);
- if(!CurClip.HaveIn() || !CurClip.HaveOut()) textcolor = RGB(255,0,0);
+ if(!CurClip.HaveIn() || !CurClip.HaveOut()) {
+ textcolor = RGB(255,0,0);
+ }
- for (int i=0; i<COL_MAX; i++)
- {
+ for (int i=0; i<COL_MAX; i++) {
m_list.GetSubItemRect(nItem, i, LVIR_LABEL, rcItem);
pDC->SetTextColor(textcolor);
- switch (i)
- {
- case COL_INDEX :
- strTemp.Format (_T("%d"), nItem+1);
- pDC->DrawText (strTemp, rcItem, DT_CENTER | DT_VCENTER);
- break;
- case COL_IN :
- pDC->DrawText (CurClip.GetIn(), rcItem, DT_CENTER | DT_VCENTER);
- break;
- case COL_OUT :
- pDC->DrawText (CurClip.GetOut(), rcItem, DT_CENTER | DT_VCENTER);
- break;
- case COL_NAME :
- pDC->DrawText (CurClip.GetName(), rcItem, DT_LEFT | DT_VCENTER);
- break;
+ switch (i) {
+ case COL_INDEX :
+ strTemp.Format (_T("%d"), nItem+1);
+ pDC->DrawText (strTemp, rcItem, DT_CENTER | DT_VCENTER);
+ break;
+ case COL_IN :
+ pDC->DrawText (CurClip.GetIn(), rcItem, DT_CENTER | DT_VCENTER);
+ break;
+ case COL_OUT :
+ pDC->DrawText (CurClip.GetOut(), rcItem, DT_CENTER | DT_VCENTER);
+ break;
+ case COL_NAME :
+ pDC->DrawText (CurClip.GetName(), rcItem, DT_LEFT | DT_VCENTER);
+ break;
}
}
}
@@ -412,8 +399,7 @@ void CEditListEditor::OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult) {
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
- if(pNMLV->iItem >= 0)
- {
+ if(pNMLV->iItem >= 0) {
m_CurPos = m_EditList.FindIndex (pNMLV->iItem);
}
}
@@ -424,23 +410,21 @@ void CEditListEditor::OnLvnKeyDown(NMHDR* pNMHDR, LRESULT* pResult) *pResult = FALSE;
- if(pLVKeyDown->wVKey == VK_DELETE)
- {
+ if(pLVKeyDown->wVKey == VK_DELETE) {
POSITION pos = m_list.GetFirstSelectedItemPosition();
POSITION ClipPos;
int nItem = -1;
- while(pos)
- {
+ while(pos) {
nItem = m_list.GetNextSelectedItem(pos);
ClipPos = m_EditList.FindIndex (nItem);
- if (ClipPos)
- {
+ if (ClipPos) {
m_EditList.RemoveAt (ClipPos);
}
m_list.DeleteItem (nItem);
}
- if (nItem != -1)
+ if (nItem != -1) {
m_list.SetItemState (min (nItem, m_list.GetItemCount()-1), LVIS_SELECTED, LVIS_SELECTED);
+ }
m_list.Invalidate();
}
}
@@ -468,8 +452,7 @@ void CEditListEditor::OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult) void CEditListEditor::OnMouseMove(UINT nFlags, CPoint point)
{
- if(m_bDragging)
- {
+ if(m_bDragging) {
m_ptDropPoint = point;
ClientToScreen(&m_ptDropPoint);
@@ -485,15 +468,17 @@ void CEditListEditor::OnMouseMove(UINT nFlags, CPoint point) int iTopItem = m_list.GetTopIndex();
int iBottomItem = m_list.GetBottomIndex();
- if(iOverItem == iTopItem && iTopItem != 0) // top of list
+ if(iOverItem == iTopItem && iTopItem != 0) { // top of list
SetTimer(1, 100, NULL);
- else
+ } else {
KillTimer(1);
+ }
- if(iOverItem >= iBottomItem && iBottomItem != (m_list.GetItemCount() - 1)) // bottom of list
+ if(iOverItem >= iBottomItem && iBottomItem != (m_list.GetItemCount() - 1)) { // bottom of list
SetTimer(2, 100, NULL);
- else
+ } else {
KillTimer(2);
+ }
}
}
@@ -505,21 +490,21 @@ void CEditListEditor::OnTimer(UINT_PTR nIDEvent) int iTopItem = m_list.GetTopIndex();
int iBottomItem = iTopItem + m_list.GetCountPerPage() - 1;
- if(m_bDragging)
- {
+ if(m_bDragging) {
m_pDragImage->DragShowNolock(FALSE);
- if(nIDEvent == 1)
- {
+ if(nIDEvent == 1) {
m_list.EnsureVisible(iTopItem - 1, false);
m_list.UpdateWindow();
- if(m_list.GetTopIndex() == 0) KillTimer(1);
- }
- else if(nIDEvent == 2)
- {
+ if(m_list.GetTopIndex() == 0) {
+ KillTimer(1);
+ }
+ } else if(nIDEvent == 2) {
m_list.EnsureVisible(iBottomItem + 1, false);
m_list.UpdateWindow();
- if(m_list.GetBottomIndex() == (m_list.GetItemCount() - 1)) KillTimer(2);
+ if(m_list.GetBottomIndex() == (m_list.GetItemCount() - 1)) {
+ KillTimer(2);
+ }
}
m_pDragImage->DragShowNolock(TRUE);
@@ -530,8 +515,7 @@ void CEditListEditor::OnTimer(UINT_PTR nIDEvent) void CEditListEditor::OnLButtonUp(UINT nFlags, CPoint point)
{
- if(m_bDragging)
- {
+ if(m_bDragging) {
::ReleaseCapture();
m_bDragging = FALSE;
@@ -547,8 +531,9 @@ void CEditListEditor::OnLButtonUp(UINT nFlags, CPoint point) CPoint pt(point);
ClientToScreen(&pt);
- if(WindowFromPoint(pt) == &m_list)
+ if(WindowFromPoint(pt) == &m_list) {
DropItemOnList();
+ }
}
ModifyStyle(0, WS_EX_ACCEPTFILES);
@@ -564,8 +549,7 @@ void CEditListEditor::DropItemOnList() POSITION DragPos = m_EditList.FindIndex (m_nDragIndex);
POSITION DropPos = m_EditList.FindIndex (m_nDropIndex);
- if ((DragPos!=NULL) && (DropPos!=NULL))
- {
+ if ((DragPos!=NULL) && (DropPos!=NULL)) {
CClip& DragClip = m_EditList.GetAt(DragPos);
m_EditList.InsertAfter (DropPos, DragClip);
m_EditList.RemoveAt (DragPos);
@@ -580,11 +564,11 @@ void CEditListEditor::OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = FALSE;
- if(pItem->iItem < 0)
+ if(pItem->iItem < 0) {
return;
+ }
- if(pItem->iSubItem == COL_NAME)
- {
+ if(pItem->iSubItem == COL_NAME) {
*pResult = TRUE;
}
}
@@ -596,17 +580,18 @@ void CEditListEditor::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = FALSE;
- if(pItem->iItem < 0)
+ if(pItem->iItem < 0) {
return;
+ }
- if (m_CurPos != NULL && pItem->iSubItem == COL_NAME)
- {
+ if (m_CurPos != NULL && pItem->iSubItem == COL_NAME) {
CClip& CurClip = m_EditList.GetAt (m_CurPos);
int nSel = FindNameIndex (CurClip.GetName());
CAtlList<CString> sl;
- for (int i=0; i<m_NameList.GetCount(); i++)
+ for (int i=0; i<m_NameList.GetCount(); i++) {
sl.AddTail(m_NameList.GetAt(i));
+ }
m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel, true);
*pResult = TRUE;
@@ -620,16 +605,17 @@ void CEditListEditor::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = FALSE;
- if(!m_list.m_fInPlaceDirty)
+ if(!m_list.m_fInPlaceDirty) {
return;
+ }
- if(pItem->iItem < 0)
+ if(pItem->iItem < 0) {
return;
+ }
CString& CurName = m_NameList.GetAt(pItem->lParam);
- if(m_CurPos != NULL && pItem->iSubItem == COL_NAME)
- {
+ if(m_CurPos != NULL && pItem->iSubItem == COL_NAME) {
CClip& CurClip = m_EditList.GetAt (m_CurPos);
CurClip.SetName(CurName);
@@ -641,12 +627,10 @@ int CEditListEditor::FindNameIndex(LPCTSTR strName) {
int nResult = -1;
- for(int i = 0; i<m_NameList.GetCount(); i++)
- {
+ for(int i = 0; i<m_NameList.GetCount(); i++) {
CString& CurName = m_NameList.GetAt(i);
- if (CurName == strName)
- {
+ if (CurName == strName) {
nResult = i;
break;
}
@@ -659,12 +643,12 @@ void CEditListEditor::FillCombo(LPCTSTR strFileName, CComboBox& Combo, bool bAll {
CStdioFile NameFile;
CString str;
- if (NameFile.Open (strFileName, CFile::modeRead))
- {
- if (bAllowNull) Combo.AddString(_T(""));
+ if (NameFile.Open (strFileName, CFile::modeRead)) {
+ if (bAllowNull) {
+ Combo.AddString(_T(""));
+ }
- while(NameFile.ReadString(str))
- {
+ while(NameFile.ReadString(str)) {
Combo.AddString(str);
}
NameFile.Close();
@@ -673,12 +657,10 @@ void CEditListEditor::FillCombo(LPCTSTR strFileName, CComboBox& Combo, bool bAll void CEditListEditor::SelectCombo(LPCTSTR strValue, CComboBox& Combo)
{
- for (int i=0; i<Combo.GetCount(); i++)
- {
+ for (int i=0; i<Combo.GetCount(); i++) {
CString strTemp;
Combo.GetLBText(i, strTemp);
- if (strTemp == strValue)
- {
+ if (strTemp == strValue) {
Combo.SetCurSel(i);
break;
}
diff --git a/src/apps/mplayerc/EditListEditor.h b/src/apps/mplayerc/EditListEditor.h index de72a9735..717ec70e8 100644 --- a/src/apps/mplayerc/EditListEditor.h +++ b/src/apps/mplayerc/EditListEditor.h @@ -35,12 +35,10 @@ public : CClip();
- bool HaveIn()
- {
+ bool HaveIn() {
return m_rtIn != _I64_MIN;
};
- bool HaveOut()
- {
+ bool HaveOut() {
return m_rtOut != _I64_MIN;
};
@@ -48,15 +46,13 @@ public : void SetIn (LPCTSTR strVal);
void SetIn (REFERENCE_TIME rtVal);
void SetOut (REFERENCE_TIME rtVal);
- void SetName(LPCTSTR strName)
- {
+ void SetName(LPCTSTR strName) {
m_strName = strName;
};
CString GetIn();
CString GetOut();
- CString GetName() const
- {
+ CString GetName() const {
return m_strName;
};
};
diff --git a/src/apps/mplayerc/FGFilter.cpp b/src/apps/mplayerc/FGFilter.cpp index 3c44dfa66..1dd22af4c 100644 --- a/src/apps/mplayerc/FGFilter.cpp +++ b/src/apps/mplayerc/FGFilter.cpp @@ -62,29 +62,25 @@ void CFGFilter::AddType(const GUID& majortype, const GUID& subtype) bool CFGFilter::CheckTypes(const CAtlArray<GUID>& types, bool fExactMatch)
{
POSITION pos = m_types.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
const GUID& majortype = m_types.GetNext(pos);
- if(!pos)
- {
+ if(!pos) {
ASSERT(0);
break;
}
const GUID& subtype = m_types.GetNext(pos);
- for(int i = 0, len = types.GetCount() & ~1; i < len; i += 2)
- {
- if(fExactMatch)
- {
+ for(int i = 0, len = types.GetCount() & ~1; i < len; i += 2) {
+ if(fExactMatch) {
if(majortype == types[i] && majortype != GUID_NULL
- && subtype == types[i+1] && subtype != GUID_NULL)
+ && subtype == types[i+1] && subtype != GUID_NULL) {
return true;
- }
- else
- {
+ }
+ } else {
if((majortype == GUID_NULL || types[i] == GUID_NULL || majortype == types[i])
- && (subtype == GUID_NULL || types[i+1] == GUID_NULL || subtype == types[i+1]))
+ && (subtype == GUID_NULL || types[i+1] == GUID_NULL || subtype == types[i+1])) {
return true;
+ }
}
}
}
@@ -100,34 +96,33 @@ CFGFilterRegistry::CFGFilterRegistry(IMoniker* pMoniker, UINT64 merit) : CFGFilter(GUID_NULL, L"", merit)
, m_pMoniker(pMoniker)
{
- if(!m_pMoniker) return;
+ if(!m_pMoniker) {
+ return;
+ }
LPOLESTR str = NULL;
- if(FAILED(m_pMoniker->GetDisplayName(0, 0, &str))) return;
+ if(FAILED(m_pMoniker->GetDisplayName(0, 0, &str))) {
+ return;
+ }
m_DisplayName = m_name = str;
CoTaskMemFree(str), str = NULL;
CComPtr<IPropertyBag> pPB;
- if(SUCCEEDED(m_pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
- {
+ if(SUCCEEDED(m_pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB))) {
CComVariant var;
- if(SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
- {
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL))) {
m_name = var.bstrVal;
var.Clear();
}
- if(SUCCEEDED(pPB->Read(CComBSTR(_T("CLSID")), &var, NULL)))
- {
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("CLSID")), &var, NULL))) {
CLSIDFromString(var.bstrVal, &m_clsid);
var.Clear();
}
- if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL)))
- {
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL))) {
BSTR* pstr;
- if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pstr)))
- {
+ if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pstr))) {
ExtractFilterData((BYTE*)pstr, var.parray->cbElements*(var.parray->rgsabound[0].cElements));
SafeArrayUnaccessData(var.parray);
}
@@ -136,43 +131,43 @@ CFGFilterRegistry::CFGFilterRegistry(IMoniker* pMoniker, UINT64 merit) }
}
- if(merit != MERIT64_DO_USE) m_merit.val = merit;
+ if(merit != MERIT64_DO_USE) {
+ m_merit.val = merit;
+ }
}
CFGFilterRegistry::CFGFilterRegistry(CStringW DisplayName, UINT64 merit)
: CFGFilter(GUID_NULL, L"", merit)
, m_DisplayName(DisplayName)
{
- if(m_DisplayName.IsEmpty()) return;
+ if(m_DisplayName.IsEmpty()) {
+ return;
+ }
CComPtr<IBindCtx> pBC;
CreateBindCtx(0, &pBC);
ULONG chEaten;
- if(S_OK != MkParseDisplayName(pBC, CComBSTR(m_DisplayName), &chEaten, &m_pMoniker))
+ if(S_OK != MkParseDisplayName(pBC, CComBSTR(m_DisplayName), &chEaten, &m_pMoniker)) {
return;
+ }
CComPtr<IPropertyBag> pPB;
- if(SUCCEEDED(m_pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
- {
+ if(SUCCEEDED(m_pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB))) {
CComVariant var;
- if(SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
- {
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL))) {
m_name = var.bstrVal;
var.Clear();
}
- if(SUCCEEDED(pPB->Read(CComBSTR(_T("CLSID")), &var, NULL)))
- {
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("CLSID")), &var, NULL))) {
CLSIDFromString(var.bstrVal, &m_clsid);
var.Clear();
}
- if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL)))
- {
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL))) {
BSTR* pstr;
- if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pstr)))
- {
+ if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pstr))) {
ExtractFilterData((BYTE*)pstr, var.parray->cbElements*(var.parray->rgsabound[0].cElements));
SafeArrayUnaccessData(var.parray);
}
@@ -181,26 +176,27 @@ CFGFilterRegistry::CFGFilterRegistry(CStringW DisplayName, UINT64 merit) }
}
- if(merit != MERIT64_DO_USE) m_merit.val = merit;
+ if(merit != MERIT64_DO_USE) {
+ m_merit.val = merit;
+ }
}
CFGFilterRegistry::CFGFilterRegistry(const CLSID& clsid, UINT64 merit)
: CFGFilter(clsid, L"", merit)
{
- if(m_clsid == GUID_NULL) return;
+ if(m_clsid == GUID_NULL) {
+ return;
+ }
CString guid = CStringFromGUID(m_clsid);
CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\") + guid, KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\") + guid, KEY_READ)) {
ULONG nChars = 0;
- if(ERROR_SUCCESS == key.QueryStringValue(NULL, NULL, &nChars))
- {
+ if(ERROR_SUCCESS == key.QueryStringValue(NULL, NULL, &nChars)) {
CString name;
- if(ERROR_SUCCESS == key.QueryStringValue(NULL, name.GetBuffer(nChars), &nChars))
- {
+ if(ERROR_SUCCESS == key.QueryStringValue(NULL, name.GetBuffer(nChars), &nChars)) {
name.ReleaseBuffer(nChars);
m_name = name;
}
@@ -211,48 +207,40 @@ CFGFilterRegistry::CFGFilterRegistry(const CLSID& clsid, UINT64 merit) CRegKey catkey;
- if(ERROR_SUCCESS == catkey.Open(HKEY_CLASSES_ROOT, _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance"), KEY_READ))
- {
- if(ERROR_SUCCESS != key.Open(catkey, guid, KEY_READ))
- {
+ if(ERROR_SUCCESS == catkey.Open(HKEY_CLASSES_ROOT, _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance"), KEY_READ)) {
+ if(ERROR_SUCCESS != key.Open(catkey, guid, KEY_READ)) {
// illiminable pack uses the name of the filter and not the clsid, have to enum all keys to find it...
FILETIME ft;
TCHAR buff[256];
DWORD len = countof(buff);
- for(DWORD i = 0; ERROR_SUCCESS == catkey.EnumKey(i, buff, &len, &ft); i++, len = countof(buff))
- {
- if(ERROR_SUCCESS == key.Open(catkey, buff, KEY_READ))
- {
+ for(DWORD i = 0; ERROR_SUCCESS == catkey.EnumKey(i, buff, &len, &ft); i++, len = countof(buff)) {
+ if(ERROR_SUCCESS == key.Open(catkey, buff, KEY_READ)) {
TCHAR clsid[256];
len = countof(clsid);
- if(ERROR_SUCCESS == key.QueryStringValue(_T("CLSID"), clsid, &len) && GUIDFromCString(clsid) == m_clsid)
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("CLSID"), clsid, &len) && GUIDFromCString(clsid) == m_clsid) {
break;
+ }
key.Close();
}
}
}
- if(key)
- {
+ if(key) {
ULONG nChars = 0;
- if(ERROR_SUCCESS == key.QueryStringValue(_T("FriendlyName"), NULL, &nChars))
- {
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("FriendlyName"), NULL, &nChars)) {
CString name;
- if(ERROR_SUCCESS == key.QueryStringValue(_T("FriendlyName"), name.GetBuffer(nChars), &nChars))
- {
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("FriendlyName"), name.GetBuffer(nChars), &nChars)) {
name.ReleaseBuffer(nChars);
m_name = name;
}
}
ULONG nBytes = 0;
- if(ERROR_SUCCESS == key.QueryBinaryValue(_T("FilterData"), NULL, &nBytes))
- {
+ if(ERROR_SUCCESS == key.QueryBinaryValue(_T("FilterData"), NULL, &nBytes)) {
CAutoVectorPtr<BYTE> buff;
- if(buff.Allocate(nBytes) && ERROR_SUCCESS == key.QueryBinaryValue(_T("FilterData"), buff, &nBytes))
- {
+ if(buff.Allocate(nBytes) && ERROR_SUCCESS == key.QueryBinaryValue(_T("FilterData"), buff, &nBytes)) {
ExtractFilterData(buff, nBytes);
}
}
@@ -261,7 +249,9 @@ CFGFilterRegistry::CFGFilterRegistry(const CLSID& clsid, UINT64 merit) }
}
- if(merit != MERIT64_DO_USE) m_merit.val = merit;
+ if(merit != MERIT64_DO_USE) {
+ m_merit.val = merit;
+ }
}
HRESULT CFGFilterRegistry::Create(IBaseFilter** ppBF, CInterfaceList<IUnknown, &IID_IUnknown>& pUnks)
@@ -270,19 +260,16 @@ HRESULT CFGFilterRegistry::Create(IBaseFilter** ppBF, CInterfaceList<IUnknown, & HRESULT hr = E_FAIL;
- if(m_pMoniker)
- {
- if(SUCCEEDED(hr = m_pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)ppBF)))
- {
+ if(m_pMoniker) {
+ if(SUCCEEDED(hr = m_pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)ppBF))) {
m_clsid = ::GetCLSID(*ppBF);
}
- }
- else if(m_clsid != GUID_NULL)
- {
+ } else if(m_clsid != GUID_NULL) {
CComQIPtr<IBaseFilter> pBF;
- if(FAILED(pBF.CoCreateInstance(m_clsid)))
+ if(FAILED(pBF.CoCreateInstance(m_clsid))) {
return E_FAIL;
+ }
*ppBF = pBF.Detach();
@@ -294,8 +281,7 @@ HRESULT CFGFilterRegistry::Create(IBaseFilter** ppBF, CInterfaceList<IUnknown, & interface __declspec(uuid("97f7c4d4-547b-4a5f-8332-536430ad2e4d"))
IAMFilterData :
-public IUnknown
-{
+public IUnknown {
STDMETHOD (ParseFilterData) (BYTE* rgbFilterData, ULONG cb, BYTE** prgbRegFilter2) PURE;
STDMETHOD (CreateFilterData) (REGFILTER2* prf2, BYTE** prgbFilterData, ULONG* pcb) PURE;
};
@@ -306,40 +292,36 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len) BYTE* ptr = NULL;
if(SUCCEEDED(pFD.CoCreateInstance(CLSID_FilterMapper2))
- && SUCCEEDED(pFD->ParseFilterData(p, len, (BYTE**)&ptr)))
- {
+ && SUCCEEDED(pFD->ParseFilterData(p, len, (BYTE**)&ptr))) {
REGFILTER2* prf = (REGFILTER2*)*(WPARAM*)ptr; // this is f*cked up
m_merit.mid = prf->dwMerit;
- if(prf->dwVersion == 1)
- {
- for(UINT i = 0; i < prf->cPins; i++)
- {
- if(prf->rgPins[i].bOutput)
+ if(prf->dwVersion == 1) {
+ for(UINT i = 0; i < prf->cPins; i++) {
+ if(prf->rgPins[i].bOutput) {
continue;
+ }
- for(UINT j = 0; j < prf->rgPins[i].nMediaTypes; j++)
- {
- if(!prf->rgPins[i].lpMediaType[j].clsMajorType || !prf->rgPins[i].lpMediaType[j].clsMinorType)
+ for(UINT j = 0; j < prf->rgPins[i].nMediaTypes; j++) {
+ if(!prf->rgPins[i].lpMediaType[j].clsMajorType || !prf->rgPins[i].lpMediaType[j].clsMinorType) {
break;
+ }
const REGPINTYPES& rpt = prf->rgPins[i].lpMediaType[j];
AddType(*rpt.clsMajorType, *rpt.clsMinorType);
}
}
- }
- else if(prf->dwVersion == 2)
- {
- for(UINT i = 0; i < prf->cPins2; i++)
- {
- if(prf->rgPins2[i].dwFlags®_PINFLAG_B_OUTPUT)
+ } else if(prf->dwVersion == 2) {
+ for(UINT i = 0; i < prf->cPins2; i++) {
+ if(prf->rgPins2[i].dwFlags®_PINFLAG_B_OUTPUT) {
continue;
+ }
- for(UINT j = 0; j < prf->rgPins2[i].nMediaTypes; j++)
- {
- if(!prf->rgPins2[i].lpMediaType[j].clsMajorType || !prf->rgPins2[i].lpMediaType[j].clsMinorType)
+ for(UINT j = 0; j < prf->rgPins2[i].nMediaTypes; j++) {
+ if(!prf->rgPins2[i].lpMediaType[j].clsMajorType || !prf->rgPins2[i].lpMediaType[j].clsMinorType) {
break;
+ }
const REGPINTYPES& rpt = prf->rgPins2[i].lpMediaType[j];
AddType(*rpt.clsMajorType, *rpt.clsMinorType);
@@ -348,15 +330,15 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len) }
CoTaskMemFree(prf);
- }
- else
- {
+ } else {
BYTE* base = p;
#define ChkLen(size) if(p - base + size > (int)len) return;
ChkLen(4)
- if(*(DWORD*)p != 0x00000002) return; // only version 2 supported, no samples found for 1
+ if(*(DWORD*)p != 0x00000002) {
+ return; // only version 2 supported, no samples found for 1
+ }
p += 4;
ChkLen(4)
@@ -368,8 +350,7 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len) ChkLen(8)
DWORD nPins = *(DWORD*)p;
p += 8;
- while(nPins-- > 0)
- {
+ while(nPins-- > 0) {
ChkLen(1)
BYTE n = *p-0x30;
p++;
@@ -392,8 +373,7 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len) ChkLen(12)
DWORD nTypes = *(DWORD*)p;
p += 12;
- while(nTypes-- > 0)
- {
+ while(nTypes-- > 0) {
ChkLen(1)
BYTE n = *p-0x30;
p++;
@@ -412,8 +392,7 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len) ChkLen(8)
if(*(DWORD*)p < (p-base+8) || *(DWORD*)p >= len
- || *(DWORD*)(p+4) < (p-base+8) || *(DWORD*)(p+4) >= len)
- {
+ || *(DWORD*)(p+4) < (p-base+8) || *(DWORD*)(p+4) >= len) {
p += 8;
continue;
}
@@ -421,7 +400,9 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len) GUID majortype, subtype;
memcpy(&majortype, &base[*(DWORD*)p], sizeof(GUID));
p += 4;
- if(!fOutput) AddType(majortype, subtype);
+ if(!fOutput) {
+ AddType(majortype, subtype);
+ }
}
}
@@ -472,31 +453,23 @@ HRESULT CFGFilterVideoRenderer::Create(IBaseFilter** ppBF, CInterfaceList<IUnkno || m_clsid == CLSID_DXRAllocatorPresenter
|| m_clsid == CLSID_madVRAllocatorPresenter
|| m_clsid == CLSID_EVRAllocatorPresenter
- || m_clsid == CLSID_SyncAllocatorPresenter)
- {
+ || m_clsid == CLSID_SyncAllocatorPresenter) {
bool bFullscreen = (AfxGetApp()->m_pMainWnd != NULL) && (((CMainFrame*)AfxGetApp()->m_pMainWnd)->IsD3DFullScreenMode());
if(SUCCEEDED(CreateAP7(m_clsid, m_hWnd, &pCAP))
|| SUCCEEDED(CreateAP9(m_clsid, m_hWnd, bFullscreen, &pCAP))
|| SUCCEEDED(CreateEVR(m_clsid, m_hWnd, bFullscreen, &pCAP))
- || SUCCEEDED(CreateSyncRenderer(m_clsid, m_hWnd, bFullscreen, &pCAP)))
- {
+ || SUCCEEDED(CreateSyncRenderer(m_clsid, m_hWnd, bFullscreen, &pCAP))) {
CComPtr<IUnknown> pRenderer;
- if(SUCCEEDED(hr = pCAP->CreateRenderer(&pRenderer)))
- {
+ if(SUCCEEDED(hr = pCAP->CreateRenderer(&pRenderer))) {
*ppBF = CComQIPtr<IBaseFilter>(pRenderer).Detach();
pUnks.AddTail(pCAP);
}
}
- }
- else
- {
+ } else {
CComPtr<IBaseFilter> pBF;
- if(SUCCEEDED(pBF.CoCreateInstance(m_clsid)))
- {
- BeginEnumPins(pBF, pEP, pPin)
- {
- if(CComQIPtr<IMixerPinConfig, &IID_IMixerPinConfig> pMPC = pPin)
- {
+ if(SUCCEEDED(pBF.CoCreateInstance(m_clsid))) {
+ BeginEnumPins(pBF, pEP, pPin) {
+ if(CComQIPtr<IMixerPinConfig, &IID_IMixerPinConfig> pMPC = pPin) {
pUnks.AddTail(pMPC);
break;
}
@@ -507,7 +480,9 @@ HRESULT CFGFilterVideoRenderer::Create(IBaseFilter** ppBF, CInterfaceList<IUnkno }
}
- if(!*ppBF) hr = E_FAIL;
+ if(!*ppBF) {
+ hr = E_FAIL;
+ }
return hr;
}
@@ -527,10 +502,11 @@ CFGFilterList::~CFGFilterList() void CFGFilterList::RemoveAll()
{
- while(!m_filters.IsEmpty())
- {
+ while(!m_filters.IsEmpty()) {
const filter_t& f = m_filters.RemoveHead();
- if(f.autodelete) delete f.pFGF;
+ if(f.autodelete) {
+ delete f.pFGF;
+ }
}
m_sortedfilters.RemoveAll();
@@ -538,25 +514,25 @@ void CFGFilterList::RemoveAll() void CFGFilterList::Insert(CFGFilter* pFGF, int group, bool exactmatch, bool autodelete)
{
- if(CFGFilterRegistry* f1r = dynamic_cast<CFGFilterRegistry*>(pFGF))
- {
+ if(CFGFilterRegistry* f1r = dynamic_cast<CFGFilterRegistry*>(pFGF)) {
POSITION pos = m_filters.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
filter_t& f2 = m_filters.GetNext(pos);
- if(group != f2.group) continue;
+ if(group != f2.group) {
+ continue;
+ }
- if(CFGFilterRegistry* f2r = dynamic_cast<CFGFilterRegistry*>(f2.pFGF))
- {
+ if(CFGFilterRegistry* f2r = dynamic_cast<CFGFilterRegistry*>(f2.pFGF)) {
if(f1r->GetMoniker() && f2r->GetMoniker() && S_OK == f1r->GetMoniker()->IsEqual(f2r->GetMoniker())
- || f1r->GetCLSID() != GUID_NULL && f1r->GetCLSID() == f2r->GetCLSID())
- {
+ || f1r->GetCLSID() != GUID_NULL && f1r->GetCLSID() == f2r->GetCLSID()) {
TRACE(_T("FGM: Inserting %d %d %016I64x '%s' NOT!\n"),
group, exactmatch, pFGF->GetMerit(),
pFGF->GetName().IsEmpty() ? CStringFromGUID(pFGF->GetCLSID()) : CString(pFGF->GetName()));
- if(autodelete) delete pFGF;
+ if(autodelete) {
+ delete pFGF;
+ }
return;
}
}
@@ -564,15 +540,15 @@ void CFGFilterList::Insert(CFGFilter* pFGF, int group, bool exactmatch, bool aut }
POSITION pos = m_filters.GetHeadPosition();
- while(pos)
- {
- if(m_filters.GetNext(pos).pFGF == pFGF)
- {
+ while(pos) {
+ if(m_filters.GetNext(pos).pFGF == pFGF) {
TRACE(_T("FGM: Inserting %d %d %016I64x '%s' DUP!\n"),
group, exactmatch, pFGF->GetMerit(),
pFGF->GetName().IsEmpty() ? CStringFromGUID(pFGF->GetCLSID()) : CString(pFGF->GetName()));
- if(autodelete) delete pFGF;
+ if(autodelete) {
+ delete pFGF;
+ }
return;
}
}
@@ -589,23 +565,24 @@ void CFGFilterList::Insert(CFGFilter* pFGF, int group, bool exactmatch, bool aut POSITION CFGFilterList::GetHeadPosition()
{
- if(m_sortedfilters.IsEmpty())
- {
+ if(m_sortedfilters.IsEmpty()) {
CAtlArray<filter_t> sort;
sort.SetCount(m_filters.GetCount());
POSITION pos = m_filters.GetHeadPosition();
- for(int i = 0; pos; i++) sort[i] = m_filters.GetNext(pos);
+ for(int i = 0; pos; i++) {
+ sort[i] = m_filters.GetNext(pos);
+ }
qsort(&sort[0], sort.GetCount(), sizeof(sort[0]), filter_cmp);
for(size_t i = 0; i < sort.GetCount(); i++)
- if(sort[i].pFGF->GetMerit() >= MERIT64_DO_USE)
+ if(sort[i].pFGF->GetMerit() >= MERIT64_DO_USE) {
m_sortedfilters.AddTail(sort[i].pFGF);
+ }
}
TRACE(_T("FGM: Sorting filters\n"));
POSITION pos = m_sortedfilters.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CFGFilter* pFGF = m_sortedfilters.GetNext(pos);
TRACE(_T("FGM: - %016I64x '%s'\n"), pFGF->GetMerit(), pFGF->GetName().IsEmpty() ? CStringFromGUID(pFGF->GetCLSID()) : CString(pFGF->GetName()));
}
@@ -623,26 +600,45 @@ int CFGFilterList::filter_cmp(const void* a, const void* b) filter_t* fa = (filter_t*)a;
filter_t* fb = (filter_t*)b;
- if(fa->group < fb->group) return -1;
- if(fa->group > fb->group) return +1;
+ if(fa->group < fb->group) {
+ return -1;
+ }
+ if(fa->group > fb->group) {
+ return +1;
+ }
- if(fa->pFGF->GetCLSID() == fb->pFGF->GetCLSID())
- {
+ if(fa->pFGF->GetCLSID() == fb->pFGF->GetCLSID()) {
CFGFilterFile* fgfa = dynamic_cast<CFGFilterFile*>(fa->pFGF);
CFGFilterFile* fgfb = dynamic_cast<CFGFilterFile*>(fb->pFGF);
- if(fgfa && !fgfb) return -1;
- if(!fgfa && fgfb) return +1;
+ if(fgfa && !fgfb) {
+ return -1;
+ }
+ if(!fgfa && fgfb) {
+ return +1;
+ }
}
- if(fa->pFGF->GetMerit() > fb->pFGF->GetMerit()) return -1;
- if(fa->pFGF->GetMerit() < fb->pFGF->GetMerit()) return +1;
+ if(fa->pFGF->GetMerit() > fb->pFGF->GetMerit()) {
+ return -1;
+ }
+ if(fa->pFGF->GetMerit() < fb->pFGF->GetMerit()) {
+ return +1;
+ }
- if(fa->exactmatch && !fb->exactmatch) return -1;
- if(!fa->exactmatch && fb->exactmatch) return +1;
+ if(fa->exactmatch && !fb->exactmatch) {
+ return -1;
+ }
+ if(!fa->exactmatch && fb->exactmatch) {
+ return +1;
+ }
- if(fa->index < fb->index) return -1;
- if(fa->index > fb->index) return +1;
+ if(fa->index < fb->index) {
+ return -1;
+ }
+ if(fa->index > fb->index) {
+ return +1;
+ }
return 0;
}
diff --git a/src/apps/mplayerc/FGFilter.h b/src/apps/mplayerc/FGFilter.h index 020c130bb..b87494a4e 100644 --- a/src/apps/mplayerc/FGFilter.h +++ b/src/apps/mplayerc/FGFilter.h @@ -37,13 +37,10 @@ class CFGFilter protected:
CLSID m_clsid;
CStringW m_name;
- struct
- {
- union
- {
+ struct {
+ union {
UINT64 val;
- struct
- {
+ struct {
UINT64 low:16, mid:32, high:16;
};
};
@@ -54,20 +51,16 @@ public: CFGFilter(const CLSID& clsid, CStringW name = L"", UINT64 merit = MERIT64_DO_USE);
virtual ~CFGFilter() {}
- CLSID GetCLSID() const
- {
+ CLSID GetCLSID() const {
return m_clsid;
}
- CStringW GetName() const
- {
+ CStringW GetName() const {
return m_name;
}
- UINT64 GetMerit() const
- {
+ UINT64 GetMerit() const {
return m_merit.val;
}
- DWORD GetMeritForDirectShow() const
- {
+ DWORD GetMeritForDirectShow() const {
return m_merit.mid;
}
const CAtlList<GUID>& GetTypes() const;
@@ -93,12 +86,10 @@ public: CFGFilterRegistry(CStringW DisplayName, UINT64 merit = MERIT64_DO_USE);
CFGFilterRegistry(const CLSID& clsid, UINT64 merit = MERIT64_DO_USE);
- CStringW GetDisplayName()
- {
+ CStringW GetDisplayName() {
return m_DisplayName;
}
- IMoniker* GetMoniker()
- {
+ IMoniker* GetMoniker() {
return m_pMoniker;
}
@@ -111,13 +102,14 @@ class CFGFilterInternal : public CFGFilter public:
CFGFilterInternal(CStringW name = L"", UINT64 merit = MERIT64_DO_USE) : CFGFilter(__uuidof(T), name, merit) {}
- HRESULT Create(IBaseFilter** ppBF, CInterfaceList<IUnknown, &IID_IUnknown>& pUnks)
- {
+ HRESULT Create(IBaseFilter** ppBF, CInterfaceList<IUnknown, &IID_IUnknown>& pUnks) {
CheckPointer(ppBF, E_POINTER);
HRESULT hr = S_OK;
CComPtr<IBaseFilter> pBF = DNew T(NULL, &hr);
- if(FAILED(hr)) return hr;
+ if(FAILED(hr)) {
+ return hr;
+ }
*ppBF = pBF.Detach();
@@ -150,8 +142,7 @@ public: class CFGFilterList
{
- struct filter_t
- {
+ struct filter_t {
int index;
CFGFilter* pFGF;
int group;
@@ -165,8 +156,7 @@ public: CFGFilterList();
virtual ~CFGFilterList();
- bool IsEmpty()
- {
+ bool IsEmpty() {
return m_filters.IsEmpty();
}
void RemoveAll();
diff --git a/src/apps/mplayerc/FGManager.cpp b/src/apps/mplayerc/FGManager.cpp index 0693bf98e..79aa841ce 100644 --- a/src/apps/mplayerc/FGManager.cpp +++ b/src/apps/mplayerc/FGManager.cpp @@ -55,9 +55,15 @@ CFGManager::CFGManager(LPCTSTR pName, LPUNKNOWN pUnk) CFGManager::~CFGManager()
{
CAutoLock cAutoLock(this);
- while(!m_source.IsEmpty()) delete m_source.RemoveHead();
- while(!m_transform.IsEmpty()) delete m_transform.RemoveHead();
- while(!m_override.IsEmpty()) delete m_override.RemoveHead();
+ while(!m_source.IsEmpty()) {
+ delete m_source.RemoveHead();
+ }
+ while(!m_transform.IsEmpty()) {
+ delete m_transform.RemoveHead();
+ }
+ while(!m_override.IsEmpty()) {
+ delete m_override.RemoveHead();
+ }
m_pUnks.RemoveAll();
m_pUnkInner.Release();
}
@@ -92,13 +98,15 @@ bool CFGManager::CStreamPath::Compare(const CStreamPath& path) POSITION pos1 = GetHeadPosition();
POSITION pos2 = path.GetHeadPosition();
- while(pos1 && pos2)
- {
+ while(pos1 && pos2) {
const path_t& p1 = GetNext(pos1);
const path_t& p2 = path.GetNext(pos2);
- if(p1.filter != p2.filter) return true;
- else if(p1.pin != p2.pin) return false;
+ if(p1.filter != p2.filter) {
+ return true;
+ } else if(p1.pin != p2.pin) {
+ return false;
+ }
}
return true;
@@ -111,16 +119,16 @@ bool CFGManager::CheckBytes(HANDLE hFile, CString chkbytes) CAtlList<CString> sl;
Explode(chkbytes, sl, ',');
- if(sl.GetCount() < 4)
+ if(sl.GetCount() < 4) {
return false;
+ }
ASSERT(!(sl.GetCount()&3));
LARGE_INTEGER size = {0, 0};
size.LowPart = GetFileSize(hFile, (DWORD*)&size.HighPart);
- while(sl.GetCount() >= 4)
- {
+ while(sl.GetCount() >= 4) {
CString offsetstr = sl.RemoveHead();
CString cbstr = sl.RemoveHead();
CString maskstr = sl.RemoveHead();
@@ -130,28 +138,32 @@ bool CFGManager::CheckBytes(HANDLE hFile, CString chkbytes) if(offsetstr.IsEmpty() || cbstr.IsEmpty()
|| valstr.IsEmpty() || (valstr.GetLength() & 1)
- || cb*2 != valstr.GetLength())
+ || cb*2 != valstr.GetLength()) {
return false;
+ }
LARGE_INTEGER offset;
offset.QuadPart = _ttoi64(offsetstr);
- if(offset.QuadPart < 0) offset.QuadPart = size.QuadPart - offset.QuadPart;
+ if(offset.QuadPart < 0) {
+ offset.QuadPart = size.QuadPart - offset.QuadPart;
+ }
SetFilePointer(hFile, offset.LowPart, &offset.HighPart, FILE_BEGIN);
// LAME
- while(maskstr.GetLength() < valstr.GetLength())
+ while(maskstr.GetLength() < valstr.GetLength()) {
maskstr += 'F';
+ }
CAtlArray<BYTE> mask, val;
CStringToBin(maskstr, mask);
CStringToBin(valstr, val);
- for(size_t i = 0; i < val.GetCount(); i++)
- {
+ for(size_t i = 0; i < val.GetCount(); i++) {
BYTE b;
DWORD r;
- if(!ReadFile(hFile, &b, 1, &r, NULL) || (b & mask[i]) != val[i])
+ if(!ReadFile(hFile, &b, 1, &r, NULL) || (b & mask[i]) != val[i]) {
return false;
+ }
}
}
@@ -172,52 +184,43 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl HANDLE hFile = INVALID_HANDLE_VALUE;
- if(protocol.GetLength() <= 1 || protocol == L"file")
- {
+ if(protocol.GetLength() <= 1 || protocol == L"file") {
hFile = CreateFile(CString(fn), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)NULL);
- if(hFile == INVALID_HANDLE_VALUE)
- {
+ if(hFile == INVALID_HANDLE_VALUE) {
return VFW_E_NOT_FOUND;
}
}
// exceptions first
- if(ext == _T(".dvr-ms") || ext == _T(".wtv")) // doh, this is stupid
- {
+ if(ext == _T(".dvr-ms") || ext == _T(".wtv")) { // doh, this is stupid
fl.Insert(DNew CFGFilterRegistry(CLSID_StreamBufferSource, MERIT64_PREFERRED), 0);
}
TCHAR buff[256], buff2[256];
ULONG len, len2;
- if(hFile == INVALID_HANDLE_VALUE)
- {
+ if(hFile == INVALID_HANDLE_VALUE) {
// internal / protocol
POSITION pos = m_source.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CFGFilter* pFGF = m_source.GetNext(pos);
- if(pFGF->m_protocols.Find(CString(protocol)))
+ if(pFGF->m_protocols.Find(CString(protocol))) {
fl.Insert(pFGF, 0, false, false);
+ }
}
- }
- else
- {
+ } else {
// internal / check bytes
POSITION pos = m_source.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CFGFilter* pFGF = m_source.GetNext(pos);
POSITION pos2 = pFGF->m_chkbytes.GetHeadPosition();
- while(pos2)
- {
- if(CheckBytes(hFile, pFGF->m_chkbytes.GetNext(pos2)))
- {
+ while(pos2) {
+ if(CheckBytes(hFile, pFGF->m_chkbytes.GetNext(pos2))) {
fl.Insert(pFGF, 1, false, false);
break;
}
@@ -225,16 +228,15 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl }
}
- if(!ext.IsEmpty())
- {
+ if(!ext.IsEmpty()) {
// internal / file extension
POSITION pos = m_source.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CFGFilter* pFGF = m_source.GetNext(pos);
- if(pFGF->m_extensions.Find(CString(ext)))
+ if(pFGF->m_extensions.Find(CString(ext))) {
fl.Insert(pFGF, 2, false, false);
+ }
}
}
@@ -242,67 +244,62 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl // internal / the rest
POSITION pos = m_source.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CFGFilter* pFGF = m_source.GetNext(pos);
- if(pFGF->m_protocols.IsEmpty() && pFGF->m_chkbytes.IsEmpty() && pFGF->m_extensions.IsEmpty())
+ if(pFGF->m_protocols.IsEmpty() && pFGF->m_chkbytes.IsEmpty() && pFGF->m_extensions.IsEmpty()) {
fl.Insert(pFGF, 3, false, false);
+ }
}
}
- if(hFile == INVALID_HANDLE_VALUE)
- {
+ if(hFile == INVALID_HANDLE_VALUE) {
// protocol
CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, CString(protocol), KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, CString(protocol), KEY_READ)) {
CRegKey exts;
- if(ERROR_SUCCESS == exts.Open(key, _T("Extensions"), KEY_READ))
- {
+ if(ERROR_SUCCESS == exts.Open(key, _T("Extensions"), KEY_READ)) {
len = countof(buff);
- if(ERROR_SUCCESS == exts.QueryStringValue(CString(ext), buff, &len))
+ if(ERROR_SUCCESS == exts.QueryStringValue(CString(ext), buff, &len)) {
fl.Insert(DNew CFGFilterRegistry(GUIDFromCString(buff)), 4);
+ }
}
len = countof(buff);
- if(ERROR_SUCCESS == key.QueryStringValue(_T("Source Filter"), buff, &len))
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("Source Filter"), buff, &len)) {
fl.Insert(DNew CFGFilterRegistry(GUIDFromCString(buff)), 5);
+ }
}
fl.Insert(DNew CFGFilterRegistry(CLSID_URLReader), 6);
- }
- else
- {
+ } else {
// check bytes
CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Media Type"), KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Media Type"), KEY_READ)) {
FILETIME ft;
len = countof(buff);
- for(DWORD i = 0; ERROR_SUCCESS == key.EnumKey(i, buff, &len, &ft); i++, len = countof(buff))
- {
+ for(DWORD i = 0; ERROR_SUCCESS == key.EnumKey(i, buff, &len, &ft); i++, len = countof(buff)) {
GUID majortype;
- if(FAILED(GUIDFromCString(buff, majortype)))
+ if(FAILED(GUIDFromCString(buff, majortype))) {
continue;
+ }
CRegKey majorkey;
- if(ERROR_SUCCESS == majorkey.Open(key, buff, KEY_READ))
- {
+ if(ERROR_SUCCESS == majorkey.Open(key, buff, KEY_READ)) {
len = countof(buff);
- for(DWORD j = 0; ERROR_SUCCESS == majorkey.EnumKey(j, buff, &len, &ft); j++, len = countof(buff))
- {
+ for(DWORD j = 0; ERROR_SUCCESS == majorkey.EnumKey(j, buff, &len, &ft); j++, len = countof(buff)) {
GUID subtype;
- if(FAILED(GUIDFromCString(buff, subtype)))
+ if(FAILED(GUIDFromCString(buff, subtype))) {
continue;
+ }
CRegKey subkey;
- if(ERROR_SUCCESS == subkey.Open(majorkey, buff, KEY_READ))
- {
+ if(ERROR_SUCCESS == subkey.Open(majorkey, buff, KEY_READ)) {
len = countof(buff);
- if(ERROR_SUCCESS != subkey.QueryStringValue(_T("Source Filter"), buff, &len))
+ if(ERROR_SUCCESS != subkey.QueryStringValue(_T("Source Filter"), buff, &len)) {
continue;
+ }
GUID clsid = GUIDFromCString(buff);
@@ -310,10 +307,8 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl len2 = sizeof(buff2);
for(DWORD k = 0, type;
clsid != GUID_NULL && ERROR_SUCCESS == RegEnumValue(subkey, k, buff2, &len2, 0, &type, (BYTE*)buff, &len);
- k++, len = countof(buff), len2 = sizeof(buff2))
- {
- if(CheckBytes(hFile, CString(buff)))
- {
+ k++, len = countof(buff), len2 = sizeof(buff2)) {
+ if(CheckBytes(hFile, CString(buff))) {
CFGFilter* pFGF = DNew CFGFilterRegistry(clsid);
pFGF->AddType(majortype, subtype);
fl.Insert(pFGF, 9);
@@ -327,29 +322,28 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl }
}
- if(!ext.IsEmpty())
- {
+ if(!ext.IsEmpty()) {
// file extension
CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Media Type\\Extensions\\") + CString(ext), KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Media Type\\Extensions\\") + CString(ext), KEY_READ)) {
ULONG len = countof(buff);
memset(buff, 0, sizeof(buff));
LONG ret = key.QueryStringValue(_T("Source Filter"), buff, &len); // QueryStringValue can return ERROR_INVALID_DATA on bogus strings (radlight mpc v1003, fixed in v1004)
- if(ERROR_SUCCESS == ret || ERROR_INVALID_DATA == ret && GUIDFromCString(buff) != GUID_NULL)
- {
+ if(ERROR_SUCCESS == ret || ERROR_INVALID_DATA == ret && GUIDFromCString(buff) != GUID_NULL) {
GUID clsid = GUIDFromCString(buff);
GUID majortype = GUID_NULL;
GUID subtype = GUID_NULL;
len = countof(buff);
- if(ERROR_SUCCESS == key.QueryStringValue(_T("Media Type"), buff, &len))
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("Media Type"), buff, &len)) {
majortype = GUIDFromCString(buff);
+ }
len = countof(buff);
- if(ERROR_SUCCESS == key.QueryStringValue(_T("Subtype"), buff, &len))
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("Subtype"), buff, &len)) {
subtype = GUIDFromCString(buff);
+ }
CFGFilter* pFGF = DNew CFGFilterRegistry(clsid);
pFGF->AddType(majortype, subtype);
@@ -358,8 +352,7 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl }
}
- if(hFile != INVALID_HANDLE_VALUE)
- {
+ if(hFile != INVALID_HANDLE_VALUE) {
CloseHandle(hFile);
}
@@ -383,36 +376,37 @@ HRESULT CFGManager::AddSourceFilter(CFGFilter* pFGF, LPCWSTR lpcwstrFileName, LP CComPtr<IBaseFilter> pBF;
CInterfaceList<IUnknown, &IID_IUnknown> pUnks;
- if(FAILED(hr = pFGF->Create(&pBF, pUnks)))
+ if(FAILED(hr = pFGF->Create(&pBF, pUnks))) {
return hr;
+ }
CComQIPtr<IFileSourceFilter> pFSF = pBF;
- if(!pFSF) return E_NOINTERFACE;
+ if(!pFSF) {
+ return E_NOINTERFACE;
+ }
- if(FAILED(hr = AddFilter(pBF, lpcwstrFilterName)))
+ if(FAILED(hr = AddFilter(pBF, lpcwstrFilterName))) {
return hr;
+ }
const AM_MEDIA_TYPE* pmt = NULL;
CMediaType mt;
const CAtlList<GUID>& types = pFGF->GetTypes();
- if(types.GetCount() == 2 && (types.GetHead() != GUID_NULL || types.GetTail() != GUID_NULL))
- {
+ if(types.GetCount() == 2 && (types.GetHead() != GUID_NULL || types.GetTail() != GUID_NULL)) {
mt.majortype = types.GetHead();
mt.subtype = types.GetTail();
pmt = &mt;
}
// sometimes looping with AviSynth
- if(FAILED(hr = pFSF->Load(lpcwstrFileName, pmt)))
- {
+ if(FAILED(hr = pFSF->Load(lpcwstrFileName, pmt))) {
RemoveFilter(pBF);
return hr;
}
// doh :P
- BeginEnumMediaTypes(GetFirstPin(pBF, PINDIR_OUTPUT), pEMT, pmt)
- {
+ BeginEnumMediaTypes(GetFirstPin(pBF, PINDIR_OUTPUT), pEMT, pmt) {
static const GUID guid1 =
{ 0x640999A0, 0xA946, 0x11D0, { 0xA5, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
static const GUID guid2 =
@@ -420,8 +414,7 @@ HRESULT CFGManager::AddSourceFilter(CFGFilter* pFGF, LPCWSTR lpcwstrFileName, LP static const GUID guid3 =
{ 0xD51BD5AE, 0x7548, 0x11CF, { 0xA5, 0x20, 0x00, 0x80, 0xC7, 0x7E, 0xF5, 0x8A } };
- if(pmt->subtype == guid1 || pmt->subtype == guid2 || pmt->subtype == guid3)
- {
+ if(pmt->subtype == guid1 || pmt->subtype == guid2 || pmt->subtype == guid3) {
RemoveFilter(pBF);
pFGF = DNew CFGFilterRegistry(CLSID_NetShowSource);
hr = AddSourceFilter(pFGF, lpcwstrFileName, lpcwstrFilterName, ppBF);
@@ -442,14 +435,17 @@ HRESULT CFGManager::AddSourceFilter(CFGFilter* pFGF, LPCWSTR lpcwstrFileName, LP STDMETHODIMP CFGManager::AddFilter(IBaseFilter* pFilter, LPCWSTR pName)
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
CAutoLock cAutoLock(this);
HRESULT hr;
- if(FAILED(hr = CComQIPtr<IFilterGraph2>(m_pUnkInner)->AddFilter(pFilter, pName)))
+ if(FAILED(hr = CComQIPtr<IFilterGraph2>(m_pUnkInner)->AddFilter(pFilter, pName))) {
return hr;
+ }
// TODO
hr = pFilter->JoinFilterGraph(NULL, NULL);
@@ -460,7 +456,9 @@ STDMETHODIMP CFGManager::AddFilter(IBaseFilter* pFilter, LPCWSTR pName) STDMETHODIMP CFGManager::RemoveFilter(IBaseFilter* pFilter)
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
CAutoLock cAutoLock(this);
@@ -469,7 +467,9 @@ STDMETHODIMP CFGManager::RemoveFilter(IBaseFilter* pFilter) STDMETHODIMP CFGManager::EnumFilters(IEnumFilters** ppEnum)
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
// Not locking here fixes a deadlock involving ReClock
//CAutoLock cAutoLock(this);
@@ -479,7 +479,9 @@ STDMETHODIMP CFGManager::EnumFilters(IEnumFilters** ppEnum) STDMETHODIMP CFGManager::FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter)
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
CAutoLock cAutoLock(this);
@@ -488,7 +490,9 @@ STDMETHODIMP CFGManager::FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter) STDMETHODIMP CFGManager::ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MEDIA_TYPE* pmt)
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
CAutoLock cAutoLock(this);
@@ -496,10 +500,13 @@ STDMETHODIMP CFGManager::ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MED CLSID clsid = GetCLSID(pBF);
// TODO: GetUpStreamFilter goes up on the first input pin only
- for(CComPtr<IBaseFilter> pBFUS = GetFilterFromPin(pPinOut); pBFUS; pBFUS = GetUpStreamFilter(pBFUS))
- {
- if(pBFUS == pBF) return VFW_E_CIRCULAR_GRAPH;
- if(clsid!=CLSID_Proxy && GetCLSID(pBFUS) == clsid) return VFW_E_CANNOT_CONNECT;
+ for(CComPtr<IBaseFilter> pBFUS = GetFilterFromPin(pPinOut); pBFUS; pBFUS = GetUpStreamFilter(pBFUS)) {
+ if(pBFUS == pBF) {
+ return VFW_E_CIRCULAR_GRAPH;
+ }
+ if(clsid!=CLSID_Proxy && GetCLSID(pBFUS) == clsid) {
+ return VFW_E_CANNOT_CONNECT;
+ }
}
return CComQIPtr<IFilterGraph2>(m_pUnkInner)->ConnectDirect(pPinOut, pPinIn, pmt);
@@ -507,7 +514,9 @@ STDMETHODIMP CFGManager::ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MED STDMETHODIMP CFGManager::Reconnect(IPin* ppin)
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
CAutoLock cAutoLock(this);
@@ -516,7 +525,9 @@ STDMETHODIMP CFGManager::Reconnect(IPin* ppin) STDMETHODIMP CFGManager::Disconnect(IPin* ppin)
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
CAutoLock cAutoLock(this);
@@ -525,7 +536,9 @@ STDMETHODIMP CFGManager::Disconnect(IPin* ppin) STDMETHODIMP CFGManager::SetDefaultSyncSource()
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
CAutoLock cAutoLock(this);
@@ -548,30 +561,30 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender) HRESULT hr;
if(S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT)
- || pPinIn && S_OK != IsPinDirection(pPinIn, PINDIR_INPUT))
+ || pPinIn && S_OK != IsPinDirection(pPinIn, PINDIR_INPUT)) {
return VFW_E_INVALID_DIRECTION;
+ }
if(S_OK == IsPinConnected(pPinOut)
- || pPinIn && S_OK == IsPinConnected(pPinIn))
+ || pPinIn && S_OK == IsPinConnected(pPinIn)) {
return VFW_E_ALREADY_CONNECTED;
+ }
bool fDeadEnd = true;
- if(pPinIn)
- {
+ if(pPinIn) {
// 1. Try a direct connection between the filters, with no intermediate filters
- if(SUCCEEDED(hr = ConnectDirect(pPinOut, pPinIn, NULL)))
+ if(SUCCEEDED(hr = ConnectDirect(pPinOut, pPinIn, NULL))) {
return hr;
- }
- else
- {
+ }
+ } else {
// 1. Use IStreamBuilder
- if(CComQIPtr<IStreamBuilder> pSB = pPinOut)
- {
- if(SUCCEEDED(hr = pSB->Render(pPinOut, this)))
+ if(CComQIPtr<IStreamBuilder> pSB = pPinOut) {
+ if(SUCCEEDED(hr = pSB->Render(pPinOut, this))) {
return hr;
+ }
pSB->Backout(pPinOut, this);
}
@@ -579,23 +592,24 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender) // 2. Try cached filters
- if(CComQIPtr<IGraphConfig> pGC = (IGraphBuilder2*)this)
- {
- BeginEnumCachedFilters(pGC, pEF, pBF)
- {
- if(pPinIn && GetFilterFromPin(pPinIn) == pBF)
+ if(CComQIPtr<IGraphConfig> pGC = (IGraphBuilder2*)this) {
+ BeginEnumCachedFilters(pGC, pEF, pBF) {
+ if(pPinIn && GetFilterFromPin(pPinIn) == pBF) {
continue;
+ }
hr = pGC->RemoveFilterFromCache(pBF);
// does RemoveFilterFromCache call AddFilter like AddFilterToCache calls RemoveFilter ?
- if(SUCCEEDED(hr = ConnectFilterDirect(pPinOut, pBF, NULL)))
- {
- if(!IsStreamEnd(pBF)) fDeadEnd = false;
+ if(SUCCEEDED(hr = ConnectFilterDirect(pPinOut, pBF, NULL))) {
+ if(!IsStreamEnd(pBF)) {
+ fDeadEnd = false;
+ }
- if(SUCCEEDED(hr = ConnectFilter(pBF, pPinIn)))
+ if(SUCCEEDED(hr = ConnectFilter(pBF, pPinIn))) {
return hr;
+ }
}
hr = pGC->AddFilterToCache(pBF);
@@ -608,32 +622,34 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender) {
CInterfaceList<IBaseFilter> pBFs;
- BeginEnumFilters(this, pEF, pBF)
- {
+ BeginEnumFilters(this, pEF, pBF) {
if(pPinIn && GetFilterFromPin(pPinIn) == pBF
- || GetFilterFromPin(pPinOut) == pBF)
+ || GetFilterFromPin(pPinOut) == pBF) {
continue;
+ }
// HACK: ffdshow - audio capture filter
if(GetCLSID(pPinOut) == GUIDFromCString(_T("{04FE9017-F873-410E-871E-AB91661A4EF7}"))
- && GetCLSID(pBF) == GUIDFromCString(_T("{E30629D2-27E5-11CE-875D-00608CB78066}")))
+ && GetCLSID(pBF) == GUIDFromCString(_T("{E30629D2-27E5-11CE-875D-00608CB78066}"))) {
continue;
+ }
pBFs.AddTail(pBF);
}
EndEnumFilters;
POSITION pos = pBFs.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
IBaseFilter* pBF = pBFs.GetNext(pos);
- if(SUCCEEDED(hr = ConnectFilterDirect(pPinOut, pBF, NULL)))
- {
- if(!IsStreamEnd(pBF)) fDeadEnd = false;
+ if(SUCCEEDED(hr = ConnectFilterDirect(pPinOut, pBF, NULL))) {
+ if(!IsStreamEnd(pBF)) {
+ fDeadEnd = false;
+ }
- if(SUCCEEDED(hr = ConnectFilter(pBF, pPinIn)))
+ if(SUCCEEDED(hr = ConnectFilter(pBF, pPinIn))) {
return hr;
+ }
}
EXECUTE_ASSERT(Disconnect(pPinOut));
@@ -649,19 +665,19 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender) ExtractMediaTypes(pPinOut, types);
POSITION pos = m_transform.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CFGFilter* pFGF = m_transform.GetNext(pos);
- if(pFGF->GetMerit() < MERIT64_DO_USE || pFGF->CheckTypes(types, false))
+ if(pFGF->GetMerit() < MERIT64_DO_USE || pFGF->CheckTypes(types, false)) {
fl.Insert(pFGF, 0, pFGF->CheckTypes(types, true), false);
+ }
}
pos = m_override.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CFGFilter* pFGF = m_override.GetNext(pos);
- if(pFGF->GetMerit() < MERIT64_DO_USE || pFGF->CheckTypes(types, false))
+ if(pFGF->GetMerit() < MERIT64_DO_USE || pFGF->CheckTypes(types, false)) {
fl.Insert(pFGF, 0, pFGF->CheckTypes(types, true), false);
+ }
}
CComPtr<IEnumMoniker> pEM;
@@ -669,29 +685,26 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender) && SUCCEEDED(m_pFM->EnumMatchingFilters(
&pEM, 0, FALSE, MERIT_DO_NOT_USE+1,
TRUE, types.GetCount()/2, types.GetData(), NULL, NULL, FALSE,
- !!pPinIn, 0, NULL, NULL, NULL)))
- {
- for(CComPtr<IMoniker> pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL)
- {
+ !!pPinIn, 0, NULL, NULL, NULL))) {
+ for(CComPtr<IMoniker> pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL) {
CFGFilterRegistry* pFGF = DNew CFGFilterRegistry(pMoniker);
fl.Insert(pFGF, 0, pFGF->CheckTypes(types, true));
}
}
pos = fl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CFGFilter* pFGF = fl.GetNext(pos);
TRACE(_T("FGM: Connecting '%s'\n"), pFGF->GetName());
CComPtr<IBaseFilter> pBF;
CInterfaceList<IUnknown, &IID_IUnknown> pUnks;
- if(FAILED(pFGF->Create(&pBF, pUnks)))
+ if(FAILED(pFGF->Create(&pBF, pUnks))) {
continue;
+ }
- if(FAILED(hr = AddFilter(pBF, pFGF->GetName())))
- {
+ if(FAILED(hr = AddFilter(pBF, pFGF->GetName()))) {
pBF.Release();
continue;
}
@@ -714,51 +727,57 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender) }
}
*/
- if(SUCCEEDED(hr))
- {
- if(!IsStreamEnd(pBF)) fDeadEnd = false;
+ if(SUCCEEDED(hr)) {
+ if(!IsStreamEnd(pBF)) {
+ fDeadEnd = false;
+ }
- if (bContinueRender)
+ if (bContinueRender) {
hr = ConnectFilter(pBF, pPinIn);
+ }
- if(SUCCEEDED(hr))
- {
+ if(SUCCEEDED(hr)) {
m_pUnks.AddTailList(&pUnks);
// maybe the application should do this...
POSITION pos = pUnks.GetHeadPosition();
- while(pos)
- {
- if(CComQIPtr<IMixerPinConfig, &IID_IMixerPinConfig> pMPC = pUnks.GetNext(pos))
+ while(pos) {
+ if(CComQIPtr<IMixerPinConfig, &IID_IMixerPinConfig> pMPC = pUnks.GetNext(pos)) {
pMPC->SetAspectRatioMode(AM_ARMODE_STRETCHED);
+ }
}
- if(CComQIPtr<IVMRAspectRatioControl> pARC = pBF)
+ if(CComQIPtr<IVMRAspectRatioControl> pARC = pBF) {
pARC->SetAspectRatioMode(VMR_ARMODE_NONE);
+ }
- if(CComQIPtr<IVMRAspectRatioControl9> pARC = pBF)
+ if(CComQIPtr<IVMRAspectRatioControl9> pARC = pBF) {
pARC->SetAspectRatioMode(VMR_ARMODE_NONE);
+ }
- if(CComQIPtr<IVMRMixerControl9> pMC = pBF)
+ if(CComQIPtr<IVMRMixerControl9> pMC = pBF) {
m_pUnks.AddTail (pMC);
+ }
- if(CComQIPtr<IVMRMixerBitmap9> pMB = pBF)
+ if(CComQIPtr<IVMRMixerBitmap9> pMB = pBF) {
m_pUnks.AddTail (pMB);
+ }
- if(CComQIPtr<IMFGetService, &__uuidof(IMFGetService)> pMFGS = pBF)
- {
+ if(CComQIPtr<IMFGetService, &__uuidof(IMFGetService)> pMFGS = pBF) {
CComPtr<IMFVideoDisplayControl> pMFVDC;
CComPtr<IMFVideoMixerBitmap> pMFMB;
- if (SUCCEEDED (pMFGS->GetService (MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl, (void**)&pMFVDC)))
+ if (SUCCEEDED (pMFGS->GetService (MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl, (void**)&pMFVDC))) {
m_pUnks.AddTail (pMFVDC);
+ }
- if (SUCCEEDED (pMFGS->GetService (MR_VIDEO_MIXER_SERVICE, IID_IMFVideoMixerBitmap, (void**)&pMFMB)))
+ if (SUCCEEDED (pMFGS->GetService (MR_VIDEO_MIXER_SERVICE, IID_IMFVideoMixerBitmap, (void**)&pMFMB))) {
m_pUnks.AddTail (pMFMB);
+ }
-// CComPtr<IMFWorkQueueServices> pMFWQS;
-// pMFGS->GetService (MF_WORKQUEUE_SERVICES, IID_IMFWorkQueueServices, (void**)&pMFWQS);
-// pMFWQS->BeginRegisterPlatformWorkQueueWithMMCSS(
+ // CComPtr<IMFWorkQueueServices> pMFWQS;
+ // pMFGS->GetService (MF_WORKQUEUE_SERVICES, IID_IMFWorkQueueServices, (void**)&pMFWQS);
+ // pMFWQS->BeginRegisterPlatformWorkQueueWithMMCSS(
}
@@ -772,19 +791,20 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender) }
}
- if(fDeadEnd)
- {
+ if(fDeadEnd) {
CAutoPtr<CStreamDeadEnd> psde(DNew CStreamDeadEnd());
psde->AddTailList(&m_streampath);
int skip = 0;
- BeginEnumMediaTypes(pPinOut, pEM, pmt)
- {
- if(pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_NULL) skip++;
+ BeginEnumMediaTypes(pPinOut, pEM, pmt) {
+ if(pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_NULL) {
+ skip++;
+ }
psde->mts.AddTail(CMediaType(*pmt));
}
EndEnumMediaTypes(pmt)
- if(skip < psde->mts.GetCount())
+ if(skip < psde->mts.GetCount()) {
m_deadends.Add(psde);
+ }
}
return pPinIn ? VFW_E_CANNOT_CONNECT : VFW_E_CANNOT_RENDER;
@@ -816,25 +836,25 @@ STDMETHODIMP CFGManager::RenderFile(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrPlay */
CFGFilterList fl;
- if(FAILED(hr = EnumSourceFilters(lpcwstrFileName, fl)))
+ if(FAILED(hr = EnumSourceFilters(lpcwstrFileName, fl))) {
return hr;
+ }
CAutoPtrArray<CStreamDeadEnd> deadends;
hr = VFW_E_CANNOT_RENDER;
POSITION pos = fl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CComPtr<IBaseFilter> pBF;
- if(SUCCEEDED(hr = AddSourceFilter(fl.GetNext(pos), lpcwstrFileName, lpcwstrFileName, &pBF)))
- {
+ if(SUCCEEDED(hr = AddSourceFilter(fl.GetNext(pos), lpcwstrFileName, lpcwstrFileName, &pBF))) {
m_streampath.RemoveAll();
m_deadends.RemoveAll();
- if(SUCCEEDED(hr = ConnectFilter(pBF, NULL)))
+ if(SUCCEEDED(hr = ConnectFilter(pBF, NULL))) {
return hr;
+ }
NukeDownstream(pBF);
RemoveFilter(pBF);
@@ -855,14 +875,15 @@ STDMETHODIMP CFGManager::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwst HRESULT hr;
CFGFilterList fl;
- if(FAILED(hr = EnumSourceFilters(lpcwstrFileName, fl)))
+ if(FAILED(hr = EnumSourceFilters(lpcwstrFileName, fl))) {
return hr;
+ }
POSITION pos = fl.GetHeadPosition();
- while(pos)
- {
- if(SUCCEEDED(hr = AddSourceFilter(fl.GetNext(pos), lpcwstrFileName, lpcwstrFilterName, ppFilter)))
+ while(pos) {
+ if(SUCCEEDED(hr = AddSourceFilter(fl.GetNext(pos), lpcwstrFileName, lpcwstrFilterName, ppFilter))) {
return hr;
+ }
}
return VFW_E_CANNOT_LOAD_SOURCE_FILTER;
@@ -870,7 +891,9 @@ STDMETHODIMP CFGManager::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwst STDMETHODIMP CFGManager::SetLogFile(DWORD_PTR hFile)
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
CAutoLock cAutoLock(this);
@@ -879,7 +902,9 @@ STDMETHODIMP CFGManager::SetLogFile(DWORD_PTR hFile) STDMETHODIMP CFGManager::Abort()
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
CAutoLock cAutoLock(this);
@@ -888,7 +913,9 @@ STDMETHODIMP CFGManager::Abort() STDMETHODIMP CFGManager::ShouldOperationContinue()
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
CAutoLock cAutoLock(this);
@@ -899,7 +926,9 @@ STDMETHODIMP CFGManager::ShouldOperationContinue() STDMETHODIMP CFGManager::AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx* pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter)
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
CAutoLock cAutoLock(this);
@@ -908,7 +937,9 @@ STDMETHODIMP CFGManager::AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx* STDMETHODIMP CFGManager::ReconnectEx(IPin* ppin, const AM_MEDIA_TYPE* pmt)
{
- if(!m_pUnkInner) return E_UNEXPECTED;
+ if(!m_pUnkInner) {
+ return E_UNEXPECTED;
+ }
CAutoLock cAutoLock(this);
@@ -922,32 +953,25 @@ STDMETHODIMP CFGManager::RenderEx(IPin* pPinOut, DWORD dwFlags, DWORD* pvContext m_streampath.RemoveAll();
m_deadends.RemoveAll();
- if(!pPinOut || dwFlags > AM_RENDEREX_RENDERTOEXISTINGRENDERERS || pvContext)
+ if(!pPinOut || dwFlags > AM_RENDEREX_RENDERTOEXISTINGRENDERERS || pvContext) {
return E_INVALIDARG;
+ }
HRESULT hr;
- if(dwFlags & AM_RENDEREX_RENDERTOEXISTINGRENDERERS)
- {
+ if(dwFlags & AM_RENDEREX_RENDERTOEXISTINGRENDERERS) {
CInterfaceList<IBaseFilter> pBFs;
- BeginEnumFilters(this, pEF, pBF)
- {
- if(CComQIPtr<IAMFilterMiscFlags> pAMMF = pBF)
- {
- if(pAMMF->GetMiscFlags() & AM_FILTER_MISC_FLAGS_IS_RENDERER)
- {
+ BeginEnumFilters(this, pEF, pBF) {
+ if(CComQIPtr<IAMFilterMiscFlags> pAMMF = pBF) {
+ if(pAMMF->GetMiscFlags() & AM_FILTER_MISC_FLAGS_IS_RENDERER) {
pBFs.AddTail(pBF);
}
- }
- else
- {
- BeginEnumPins(pBF, pEP, pPin)
- {
+ } else {
+ BeginEnumPins(pBF, pEP, pPin) {
CComPtr<IPin> pPinIn;
DWORD size = 1;
- if(SUCCEEDED(pPin->QueryInternalConnections(&pPinIn, &size)) && size == 0)
- {
+ if(SUCCEEDED(pPin->QueryInternalConnections(&pPinIn, &size)) && size == 0) {
pBFs.AddTail(pBF);
break;
}
@@ -957,10 +981,10 @@ STDMETHODIMP CFGManager::RenderEx(IPin* pPinOut, DWORD dwFlags, DWORD* pvContext }
EndEnumFilters;
- while(!pBFs.IsEmpty())
- {
- if(SUCCEEDED(hr = ConnectFilter(pPinOut, pBFs.RemoveHead())))
+ while(!pBFs.IsEmpty()) {
+ if(SUCCEEDED(hr = ConnectFilter(pPinOut, pBFs.RemoveHead()))) {
return hr;
+ }
}
return VFW_E_CANNOT_RENDER;
@@ -978,8 +1002,9 @@ STDMETHODIMP CFGManager::IsPinDirection(IPin* pPin, PIN_DIRECTION dir1) CheckPointer(pPin, E_POINTER);
PIN_DIRECTION dir2;
- if(FAILED(pPin->QueryDirection(&dir2)))
+ if(FAILED(pPin->QueryDirection(&dir2))) {
return E_FAIL;
+ }
return dir1 == dir2 ? S_OK : S_FALSE;
}
@@ -1000,26 +1025,25 @@ STDMETHODIMP CFGManager::ConnectFilter(IBaseFilter* pBF, IPin* pPinIn) CheckPointer(pBF, E_POINTER);
- if(pPinIn && S_OK != IsPinDirection(pPinIn, PINDIR_INPUT))
+ if(pPinIn && S_OK != IsPinDirection(pPinIn, PINDIR_INPUT)) {
return VFW_E_INVALID_DIRECTION;
+ }
int nTotal = 0, nRendered = 0;
- BeginEnumPins(pBF, pEP, pPin)
- {
+ BeginEnumPins(pBF, pEP, pPin) {
if(GetPinName(pPin)[0] != '~'
&& S_OK == IsPinDirection(pPin, PINDIR_OUTPUT)
- && S_OK != IsPinConnected(pPin))
- {
+ && S_OK != IsPinConnected(pPin)) {
m_streampath.Append(pBF, pPin);
HRESULT hr = Connect(pPin, pPinIn);
- if(SUCCEEDED(hr))
- {
+ if(SUCCEEDED(hr)) {
for(int i = m_deadends.GetCount()-1; i >= 0; i--)
- if(m_deadends[i]->Compare(m_streampath))
+ if(m_deadends[i]->Compare(m_streampath)) {
m_deadends.RemoveAt(i);
+ }
nRendered++;
}
@@ -1028,8 +1052,9 @@ STDMETHODIMP CFGManager::ConnectFilter(IBaseFilter* pBF, IPin* pPinIn) m_streampath.RemoveTail();
- if(SUCCEEDED(hr) && pPinIn)
+ if(SUCCEEDED(hr) && pPinIn) {
return S_OK;
+ }
}
}
EndEnumPins;
@@ -1047,18 +1072,18 @@ STDMETHODIMP CFGManager::ConnectFilter(IPin* pPinOut, IBaseFilter* pBF) CheckPointer(pPinOut, E_POINTER);
CheckPointer(pBF, E_POINTER);
- if(S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT))
+ if(S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT)) {
return VFW_E_INVALID_DIRECTION;
+ }
- BeginEnumPins(pBF, pEP, pPin)
- {
+ BeginEnumPins(pBF, pEP, pPin) {
if(GetPinName(pPin)[0] != '~'
&& S_OK == IsPinDirection(pPin, PINDIR_INPUT)
- && S_OK != IsPinConnected(pPin))
- {
+ && S_OK != IsPinConnected(pPin)) {
HRESULT hr = Connect(pPinOut, pPin);
- if(SUCCEEDED(hr))
+ if(SUCCEEDED(hr)) {
return hr;
+ }
}
}
EndEnumPins;
@@ -1073,18 +1098,18 @@ STDMETHODIMP CFGManager::ConnectFilterDirect(IPin* pPinOut, IBaseFilter* pBF, co CheckPointer(pPinOut, E_POINTER);
CheckPointer(pBF, E_POINTER);
- if(S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT))
+ if(S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT)) {
return VFW_E_INVALID_DIRECTION;
+ }
- BeginEnumPins(pBF, pEP, pPin)
- {
+ BeginEnumPins(pBF, pEP, pPin) {
if(GetPinName(pPin)[0] != '~'
&& S_OK == IsPinDirection(pPin, PINDIR_INPUT)
- && S_OK != IsPinConnected(pPin))
- {
+ && S_OK != IsPinConnected(pPin)) {
HRESULT hr = ConnectDirect(pPinOut, pPin, pmt);
- if(SUCCEEDED(hr))
+ if(SUCCEEDED(hr)) {
return hr;
+ }
}
}
EndEnumPins;
@@ -1096,31 +1121,23 @@ STDMETHODIMP CFGManager::NukeDownstream(IUnknown* pUnk) {
CAutoLock cAutoLock(this);
- if(CComQIPtr<IBaseFilter> pBF = pUnk)
- {
- BeginEnumPins(pBF, pEP, pPin)
- {
+ if(CComQIPtr<IBaseFilter> pBF = pUnk) {
+ BeginEnumPins(pBF, pEP, pPin) {
NukeDownstream(pPin);
}
EndEnumPins;
- }
- else if(CComQIPtr<IPin> pPin = pUnk)
- {
+ } else if(CComQIPtr<IPin> pPin = pUnk) {
CComPtr<IPin> pPinTo;
if(S_OK == IsPinDirection(pPin, PINDIR_OUTPUT)
- && SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo)
- {
- if(CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo))
- {
+ && SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo) {
+ if(CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo)) {
NukeDownstream(pBF);
Disconnect(pPinTo);
Disconnect(pPin);
RemoveFilter(pBF);
}
}
- }
- else
- {
+ } else {
return E_INVALIDARG;
}
@@ -1133,11 +1150,11 @@ STDMETHODIMP CFGManager::FindInterface(REFIID iid, void** ppv, BOOL bRemove) CheckPointer(ppv, E_POINTER);
- for(POSITION pos = m_pUnks.GetHeadPosition(); pos; m_pUnks.GetNext(pos))
- {
- if(SUCCEEDED(m_pUnks.GetAt(pos)->QueryInterface(iid, ppv)))
- {
- if(bRemove) m_pUnks.RemoveAt(pos);
+ for(POSITION pos = m_pUnks.GetHeadPosition(); pos; m_pUnks.GetNext(pos)) {
+ if(SUCCEEDED(m_pUnks.GetAt(pos)->QueryInterface(iid, ppv))) {
+ if(bRemove) {
+ m_pUnks.RemoveAt(pos);
+ }
return S_OK;
}
}
@@ -1151,15 +1168,18 @@ STDMETHODIMP CFGManager::AddToROT() HRESULT hr;
- if(m_dwRegister) return S_FALSE;
+ if(m_dwRegister) {
+ return S_FALSE;
+ }
CComPtr<IRunningObjectTable> pROT;
CComPtr<IMoniker> pMoniker;
WCHAR wsz[256];
swprintf(wsz, L"FilterGraph %08p pid %08x (MPC)", (DWORD_PTR)this, GetCurrentProcessId());
if(SUCCEEDED(hr = GetRunningObjectTable(0, &pROT))
- && SUCCEEDED(hr = CreateItemMoniker(L"!", wsz, &pMoniker)))
+ && SUCCEEDED(hr = CreateItemMoniker(L"!", wsz, &pMoniker))) {
hr = pROT->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE, (IGraphBuilder2*)this, pMoniker, &m_dwRegister);
+ }
return hr;
}
@@ -1170,12 +1190,15 @@ STDMETHODIMP CFGManager::RemoveFromROT() HRESULT hr;
- if(!m_dwRegister) return S_FALSE;
+ if(!m_dwRegister) {
+ return S_FALSE;
+ }
CComPtr<IRunningObjectTable> pROT;
if(SUCCEEDED(hr = GetRunningObjectTable(0, &pROT))
- && SUCCEEDED(hr = pROT->Revoke(m_dwRegister)))
+ && SUCCEEDED(hr = pROT->Revoke(m_dwRegister))) {
m_dwRegister = 0;
+ }
return hr;
}
@@ -1193,14 +1216,15 @@ STDMETHODIMP CFGManager::GetDeadEnd(int iIndex, CAtlList<CStringW>& path, CAtlLi {
CAutoLock cAutoLock(this);
- if(iIndex < 0 || iIndex >= m_deadends.GetCount()) return E_FAIL;
+ if(iIndex < 0 || iIndex >= m_deadends.GetCount()) {
+ return E_FAIL;
+ }
path.RemoveAll();
mts.RemoveAll();
POSITION pos = m_deadends[iIndex]->GetHeadPosition();
- while(pos)
- {
+ while(pos) {
const path_t& p = m_deadends[iIndex]->GetNext(pos);
CStringW str;
@@ -1233,8 +1257,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) // Source filters
#if INTERNAL_SOURCEFILTER_SHOUTCAST
- if(src[SRC_SHOUTCAST])
- {
+ if(src[SRC_SHOUTCAST]) {
pFGF = DNew CFGFilterInternal<CShoutcastSource>();
pFGF->m_protocols.AddTail(_T("http"));
m_source.AddTail(pFGF);
@@ -1251,8 +1274,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_AVI
- if(src[SRC_AVI])
- {
+ if(src[SRC_AVI]) {
pFGF = DNew CFGFilterInternal<CAviSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564920"));
pFGF->m_chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564958"));
@@ -1261,8 +1283,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_MP4
- if(src[SRC_MP4])
- {
+ if(src[SRC_MP4]) {
pFGF = DNew CFGFilterInternal<CMP4SourceFilter>();
pFGF->m_chkbytes.AddTail(_T("4,4,,66747970")); // ftyp
pFGF->m_chkbytes.AddTail(_T("4,4,,6d6f6f76")); // moov
@@ -1276,8 +1297,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_FLV
- if(src[SRC_FLV])
- {
+ if(src[SRC_FLV]) {
pFGF = DNew CFGFilterInternal<CFLVSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,4,,464C5601")); // FLV (v1)
m_source.AddTail(pFGF);
@@ -1285,8 +1305,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_MATROSKA
- if(src[SRC_MATROSKA])
- {
+ if(src[SRC_MATROSKA]) {
pFGF = DNew CFGFilterInternal<CMatroskaSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,4,,1A45DFA3"));
m_source.AddTail(pFGF);
@@ -1294,8 +1313,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_REALMEDIA
- if(src[SRC_REALMEDIA])
- {
+ if(src[SRC_REALMEDIA]) {
pFGF = DNew CFGFilterInternal<CRealMediaSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,4,,2E524D46"));
m_source.AddTail(pFGF);
@@ -1303,8 +1321,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_DSM
- if(src[SRC_DSM])
- {
+ if(src[SRC_DSM]) {
pFGF = DNew CFGFilterInternal<CDSMSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,4,,44534D53"));
m_source.AddTail(pFGF);
@@ -1312,8 +1329,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_FLIC
- if(src[SRC_FLIC])
- {
+ if(src[SRC_FLIC]) {
pFGF = DNew CFGFilterInternal<CFLICSource>();
pFGF->m_chkbytes.AddTail(_T("4,2,,11AF"));
pFGF->m_chkbytes.AddTail(_T("4,2,,12AF"));
@@ -1324,8 +1340,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_FLAC
- if(src[SRC_FLAC])
- {
+ if(src[SRC_FLAC]) {
pFGF = DNew CFGFilterInternal<CFlacSource>();
pFGF->m_chkbytes.AddTail(_T("0,4,,664C6143"));
pFGF->m_extensions.AddTail(_T(".flac"));
@@ -1334,8 +1349,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_CDDA
- if(src[SRC_CDDA])
- {
+ if(src[SRC_CDDA]) {
pFGF = DNew CFGFilterInternal<CCDDAReader>();
pFGF->m_extensions.AddTail(_T(".cda"));
m_source.AddTail(pFGF);
@@ -1343,8 +1357,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_CDXA
- if(src[SRC_CDXA])
- {
+ if(src[SRC_CDXA]) {
pFGF = DNew CFGFilterInternal<CCDXAReader>();
pFGF->m_chkbytes.AddTail(_T("0,4,,52494646,8,4,,43445841"));
m_source.AddTail(pFGF);
@@ -1352,8 +1365,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_VTS
- if(src[SRC_VTS])
- {
+ if(src[SRC_VTS]) {
pFGF = DNew CFGFilterInternal<CVTSReader>();
pFGF->m_chkbytes.AddTail(_T("0,12,,445644564944454F2D565453"));
m_source.AddTail(pFGF);
@@ -1361,12 +1373,10 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_DVSOURCE
-// TODOX64 : fix DVSource internal filter
+ // TODOX64 : fix DVSource internal filter
#ifndef _WIN64
- __if_exists(CD2VSource)
- {
- if(src[SRC_D2V])
- {
+ __if_exists(CD2VSource) {
+ if(src[SRC_D2V]) {
pFGF = DNew CFGFilterInternal<CD2VSource>();
pFGF->m_chkbytes.AddTail(_T("0,18,,4456443241564950726F6A65637446696C65"));
pFGF->m_extensions.AddTail(_T(".d2v"));
@@ -1377,8 +1387,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_OGG
- if(src[SRC_OGG])
- {
+ if(src[SRC_OGG]) {
pFGF = DNew CFGFilterInternal<COggSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,4,,4F676753"));
m_source.AddTail(pFGF);
@@ -1386,8 +1395,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_MPEG
- if(src[SRC_MPEG])
- {
+ if(src[SRC_MPEG]) {
pFGF = DNew CFGFilterInternal<CMpegSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,16,FFFFFFFFF100010001800001FFFFFFFF,000001BA2100010001800001000001BB"));
pFGF->m_chkbytes.AddTail(_T("0,5,FFFFFFFFC0,000001BA40"));
@@ -1402,8 +1410,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_DTSAC3
- if(src[SRC_DTSAC3])
- {
+ if(src[SRC_DTSAC3]) {
pFGF = DNew CFGFilterInternal<CDTSAC3Source>();
pFGF->m_chkbytes.AddTail(_T("0,4,,7FFE8001"));
pFGF->m_chkbytes.AddTail(_T("0,2,,0B77"));
@@ -1415,8 +1422,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_MPEGAUDIO
- if(src[SRC_MPA])
- {
+ if(src[SRC_MPA]) {
pFGF = DNew CFGFilterInternal<CMpaSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,2,FFE0,FFE0"));
pFGF->m_chkbytes.AddTail(_T("0,10,FFFFFF00000080808080,49443300000000000000"));
@@ -1424,8 +1430,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
- if(AfxGetAppSettings().fUseWMASFReader)
- {
+ if(AfxGetAppSettings().fUseWMASFReader) {
pFGF = DNew CFGFilterRegistry(CLSID_WMAsfReader);
pFGF->m_chkbytes.AddTail(_T("0,4,,3026B275"));
pFGF->m_chkbytes.AddTail(_T("0,4,,D129E2D6"));
@@ -1441,12 +1446,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_MATROSKA
- if(src[SRC_MATROSKA])
- {
+ if(src[SRC_MATROSKA]) {
pFGF = DNew CFGFilterInternal<CMatroskaSplitterFilter>(L"Matroska Splitter", MERIT64_ABOVE_DSHOW);
- }
- else
- {
+ } else {
pFGF = DNew CFGFilterInternal<CMatroskaSplitterFilter>(L"Matroska Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Matroska);
@@ -1455,12 +1457,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_REALMEDIA
- if(src[SRC_REALMEDIA])
- {
+ if(src[SRC_REALMEDIA]) {
pFGF = DNew CFGFilterInternal<CRealMediaSplitterFilter>(L"RealMedia Splitter", MERIT64_ABOVE_DSHOW);
- }
- else
- {
+ } else {
pFGF = DNew CFGFilterInternal<CRealMediaSplitterFilter>(L"RealMedia Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_RealMedia);
@@ -1469,12 +1468,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_AVI
- if(src[SRC_AVI])
- {
+ if(src[SRC_AVI]) {
pFGF = DNew CFGFilterInternal<CAviSplitterFilter>(L"Avi Splitter", MERIT64_ABOVE_DSHOW);
- }
- else
- {
+ } else {
pFGF = DNew CFGFilterInternal<CAviSplitterFilter>(L"Avi Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Avi);
@@ -1483,12 +1479,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_OGG
- if(src[SRC_OGG])
- {
+ if(src[SRC_OGG]) {
pFGF = DNew CFGFilterInternal<COggSplitterFilter>(L"Ogg Splitter", MERIT64_ABOVE_DSHOW);
- }
- else
- {
+ } else {
pFGF = DNew CFGFilterInternal<COggSplitterFilter>(L"Ogg Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Ogg);
@@ -1497,12 +1490,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_MPEG
- if(src[SRC_MPEG])
- {
+ if(src[SRC_MPEG]) {
pFGF = DNew CFGFilterInternal<CMpegSplitterFilter>(L"Mpeg Splitter", MERIT64_ABOVE_DSHOW);
- }
- else
- {
+ } else {
pFGF = DNew CFGFilterInternal<CMpegSplitterFilter>(L"Mpeg Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG1System);
@@ -1514,12 +1504,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_MPEGAUDIO
- if(src[SRC_MPA])
- {
+ if(src[SRC_MPA]) {
pFGF = DNew CFGFilterInternal<CMpaSplitterFilter>(L"Mpa Splitter", MERIT64_ABOVE_DSHOW);
- }
- else
- {
+ } else {
pFGF = DNew CFGFilterInternal<CMpaSplitterFilter>(L"Mpa Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG1Audio);
@@ -1528,12 +1515,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_DSM
- if(src[SRC_DSM])
- {
+ if(src[SRC_DSM]) {
pFGF = DNew CFGFilterInternal<CDSMSplitterFilter>(L"DSM Splitter", MERIT64_ABOVE_DSHOW);
- }
- else
- {
+ } else {
pFGF = DNew CFGFilterInternal<CDSMSplitterFilter>(L"DSM Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_DirectShowMedia);
@@ -1542,12 +1526,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_MP4
- if(src[SRC_MP4])
- {
+ if(src[SRC_MP4]) {
pFGF = DNew CFGFilterInternal<CMP4SplitterFilter>(L"MP4 Splitter", MERIT64_ABOVE_DSHOW);
- }
- else
- {
+ } else {
pFGF = DNew CFGFilterInternal<CMP4SplitterFilter>(L"MP4 Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MP4);
@@ -1556,12 +1537,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_SOURCEFILTER_FLV
- if(src[SRC_FLV])
- {
+ if(src[SRC_FLV]) {
pFGF = DNew CFGFilterInternal<CFLVSplitterFilter>(L"FLV Splitter", MERIT64_ABOVE_DSHOW);
- }
- else
- {
+ } else {
pFGF = DNew CFGFilterInternal<CFLVSplitterFilter>(L"FLV Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_FLV);
@@ -1763,8 +1741,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if HAS_FFMPEG_VIDEO_DECODERS | HAS_DXVA_VIDEO_DECODERS
pFGF = DNew CFGFilterInternal<CMPCVideoDecFilter>(_T("MPC Video Decoder"), MERIT64_ABOVE_DSHOW);
#if INTERNAL_DECODER_FLV
- if (ffmpeg_filters[FFM_FLV4])
- {
+ if (ffmpeg_filters[FFM_FLV4]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_FLV1);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_flv1);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_FLV4);
@@ -1772,8 +1749,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_VP6
- if (ffmpeg_filters[FFM_VP62])
- {
+ if (ffmpeg_filters[FFM_VP62]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_VP50);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_vp50);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_VP60);
@@ -1789,8 +1765,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_H264 | INTERNAL_DECODER_H264_DXVA
- if ((ffmpeg_filters[FFM_H264]) || (dxva_filters[TRA_DXVA_H264]))
- {
+ if ((ffmpeg_filters[FFM_H264]) || (dxva_filters[TRA_DXVA_H264])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_H264);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_h264);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_X264);
@@ -1808,8 +1783,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_MPEG2_DXVA
- if (dxva_filters[TRA_DXVA_MPEG2])
- {
+ if (dxva_filters[TRA_DXVA_MPEG2]) {
pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_MPEG2_VIDEO);
pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_MPEG2_VIDEO);
pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_MPEG2_VIDEO);
@@ -1817,15 +1791,13 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_VC1 | INTERNAL_DECODER_VC1_DXVA
- if ((ffmpeg_filters[FFM_VC1]) || (dxva_filters[TRA_DXVA_VC1]))
- {
+ if ((ffmpeg_filters[FFM_VC1]) || (dxva_filters[TRA_DXVA_VC1])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_WVC1);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_wvc1);
}
#endif
#if INTERNAL_DECODER_XVID
- if (ffmpeg_filters[FFM_XVID])
- {
+ if (ffmpeg_filters[FFM_XVID]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_XVID);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_xvid);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_XVIX);
@@ -1869,8 +1841,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_DIVX
- if (ffmpeg_filters[FFM_DIVX])
- {
+ if (ffmpeg_filters[FFM_DIVX]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_DIVX);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_divx);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_DX50);
@@ -1878,8 +1849,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_WMV
- if (ffmpeg_filters[FFM_WMV])
- {
+ if (ffmpeg_filters[FFM_WMV]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_WMV1);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_wmv1);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_WMV2);
@@ -1889,8 +1859,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_MSMPEG4
- if (ffmpeg_filters[FFM_MSMPEG4])
- {
+ if (ffmpeg_filters[FFM_MSMPEG4]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_DIV3);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_div3);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_DVX3);
@@ -1922,15 +1891,13 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_SVQ
- if (ffmpeg_filters[FFM_SVQ3])
- {
+ if (ffmpeg_filters[FFM_SVQ3]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_SVQ3);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_SVQ1);
}
#endif
#if INTERNAL_DECODER_H263
- if (ffmpeg_filters[FFM_H263])
- {
+ if (ffmpeg_filters[FFM_H263]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_H263);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_h263);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_S263);
@@ -1938,21 +1905,18 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_THEORA
- if (ffmpeg_filters[FFM_THEORA])
- {
+ if (ffmpeg_filters[FFM_THEORA]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_THEORA);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_theora);
}
#endif
#if INTERNAL_DECODER_AMVV
- if (ffmpeg_filters[FFM_AMVV])
- {
+ if (ffmpeg_filters[FFM_AMVV]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_AMVV);
}
#endif
#if INTERNAL_DECODER_VP8
- if (ffmpeg_filters[FFM_VP8])
- {
+ if (ffmpeg_filters[FFM_VP8]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_VP80);
}
#endif
@@ -1962,8 +1926,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) // Low merit MPC Video Decoder
pFGF = DNew CFGFilterInternal<CMPCVideoDecFilter>(_T("MPC Video Decoder (low merit)"), MERIT64_DO_USE);
#if INTERNAL_DECODER_FLV
- if (!(ffmpeg_filters[FFM_FLV4]))
- {
+ if (!(ffmpeg_filters[FFM_FLV4])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_FLV1);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_flv1);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_FLV4);
@@ -1971,8 +1934,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_VP6
- if (!(ffmpeg_filters[FFM_VP62]))
- {
+ if (!(ffmpeg_filters[FFM_VP62])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_VP50);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_vp50);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_VP60);
@@ -1988,8 +1950,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_H264 | INTERNAL_DECODER_H264_DXVA
- if (!(ffmpeg_filters[FFM_H264]) && !(dxva_filters[TRA_DXVA_H264]))
- {
+ if (!(ffmpeg_filters[FFM_H264]) && !(dxva_filters[TRA_DXVA_H264])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_H264);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_h264);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_X264);
@@ -2007,8 +1968,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_MPEG2_DXVA
- if (!(dxva_filters[TRA_DXVA_MPEG2]))
- {
+ if (!(dxva_filters[TRA_DXVA_MPEG2])) {
pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_MPEG2_VIDEO);
pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_MPEG2_VIDEO);
pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_MPEG2_VIDEO);
@@ -2016,15 +1976,13 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_VC1 | INTERNAL_DECODER_VC1_DXVA
- if (!(ffmpeg_filters[FFM_VC1]) && !(dxva_filters[TRA_DXVA_VC1]))
- {
+ if (!(ffmpeg_filters[FFM_VC1]) && !(dxva_filters[TRA_DXVA_VC1])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_WVC1);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_wvc1);
}
#endif
#if INTERNAL_DECODER_XVID
- if (!(ffmpeg_filters[FFM_XVID]))
- {
+ if (!(ffmpeg_filters[FFM_XVID])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_XVID);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_xvid);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_XVIX);
@@ -2068,8 +2026,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_DIVX
- if (!(ffmpeg_filters[FFM_DIVX]))
- {
+ if (!(ffmpeg_filters[FFM_DIVX])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_DIVX);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_divx);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_DX50);
@@ -2077,8 +2034,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_WMV
- if (!(ffmpeg_filters[FFM_WMV]))
- {
+ if (!(ffmpeg_filters[FFM_WMV])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_WMV1);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_wmv1);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_WMV2);
@@ -2088,8 +2044,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_MSMPEG4
- if (!(ffmpeg_filters[FFM_MSMPEG4]))
- {
+ if (!(ffmpeg_filters[FFM_MSMPEG4])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_DIV3);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_div3);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_DVX3);
@@ -2121,35 +2076,30 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_SVQ
- if (!(ffmpeg_filters[FFM_SVQ3]))
- {
+ if (!(ffmpeg_filters[FFM_SVQ3])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_SVQ3);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_SVQ1);
}
#endif
#if INTERNAL_DECODER_H263
- if (!(ffmpeg_filters[FFM_H263]))
- {
+ if (!(ffmpeg_filters[FFM_H263])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_H263);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_h263);
}
#endif
#if INTERNAL_DECODER_THEORA
- if (!(ffmpeg_filters[FFM_THEORA]))
- {
+ if (!(ffmpeg_filters[FFM_THEORA])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_THEORA);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_theora);
}
#endif
#if INTERNAL_DECODER_AMVV
- if (!(ffmpeg_filters[FFM_AMVV]))
- {
+ if (!(ffmpeg_filters[FFM_AMVV])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_AMVV);
}
#endif
#if INTERNAL_DECODER_VP8
- if (!(ffmpeg_filters[FFM_VP8]))
- {
+ if (!(ffmpeg_filters[FFM_VP8])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_VP80);
}
#endif
@@ -2181,8 +2131,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) CMPCVideoDecFilter::DXVAFilters = (HAS_DXVA_VIDEO_DECODERS) ? s.DXVAFilters : NULL;
CMPCVideoDecFilter::m_ref_frame_count_check_skip = false;
- if((!IsVistaOrAbove()) && ((s.iDSVideoRendererType == VIDRNDT_DS_DEFAULT) || (s.iDSVideoRendererType == VIDRNDT_DS_DXR)))
- {
+ if((!IsVistaOrAbove()) && ((s.iDSVideoRendererType == VIDRNDT_DS_DEFAULT) || (s.iDSVideoRendererType == VIDRNDT_DS_DXR))) {
CMPCVideoDecFilter::m_ref_frame_count_check_skip = true;
}
#endif
@@ -2222,8 +2171,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\") + clsid + _T("\\InprocServer32"), KEY_READ)
&& ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len)
- && GetFileVersion(buff) < 0x0001000000030000ui64)
- {
+ && GetFileVersion(buff) < 0x0001000000030000ui64) {
m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(clsid), MERIT64_DO_NOT_USE));
}
}
@@ -2237,10 +2185,8 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{272D77A0-A852-4851-ADA4-9091FEAD4C86}")), MERIT64_DO_NOT_USE));
// Block VSFilter when internal subtitle renderer will get used
- if(s.fAutoloadSubtitles && s.fBlockVSFilter)
- {
- if(s.iDSVideoRendererType == VIDRNDT_DS_VMR7RENDERLESS || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS || s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_DXR || s.iDSVideoRendererType == VIDRNDT_DS_SYNC)
- {
+ if(s.fAutoloadSubtitles && s.fBlockVSFilter) {
+ if(s.iDSVideoRendererType == VIDRNDT_DS_VMR7RENDERLESS || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS || s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_DXR || s.iDSVideoRendererType == VIDRNDT_DS_SYNC) {
m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{9852A670-F845-491B-9BE6-EBD841B8A613}")), MERIT64_DO_NOT_USE));
}
}
@@ -2250,15 +2196,16 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) WORD merit_low = 1;
POSITION pos = s.m_filters.GetTailPosition();
- while(pos)
- {
+ while(pos) {
FilterOverride* fo = s.m_filters.GetPrev(pos);
- if (!fo->fDisabled && fo->name == _T("Broadcom Video Decoder"))
+ if (!fo->fDisabled && fo->name == _T("Broadcom Video Decoder")) {
bOverrideBroadcom = true;
+ }
- if(fo->fDisabled || fo->type == FilterOverride::EXTERNAL && !CPath(MakeFullPath(fo->path)).FileExists())
+ if(fo->fDisabled || fo->type == FilterOverride::EXTERNAL && !CPath(MakeFullPath(fo->path)).FileExists()) {
continue;
+ }
ULONGLONG merit =
fo->iLoadType == FilterOverride::PREFERRED ? MERIT64_ABOVE_DSHOW :
@@ -2269,25 +2216,20 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) CFGFilter* pFGF = NULL;
- if(fo->type == FilterOverride::REGISTERED)
- {
+ if(fo->type == FilterOverride::REGISTERED) {
pFGF = DNew CFGFilterRegistry(fo->dispname, merit);
- }
- else if(fo->type == FilterOverride::EXTERNAL)
- {
+ } else if(fo->type == FilterOverride::EXTERNAL) {
pFGF = DNew CFGFilterFile(fo->clsid, fo->path, CStringW(fo->name), merit);
}
- if(pFGF)
- {
+ if(pFGF) {
pFGF->SetTypes(fo->guids);
m_override.AddTail(pFGF);
}
}
/* Use Broadcom decoder (if installed) for VC-1, H.264 and MPEG-2 */
- if (!bOverrideBroadcom)
- {
+ if (!bOverrideBroadcom) {
pFGF = DNew CFGFilterRegistry(GUIDFromCString(_T("{2DE1D17E-46B1-42A8-9AEC-E20E80D9B1A9}")), MERIT64_ABOVE_DSHOW);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_H264);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_h264);
@@ -2321,22 +2263,20 @@ STDMETHODIMP CFGManagerCustom::AddFilter(IBaseFilter* pBF, LPCWSTR pName) HRESULT hr;
- if(FAILED(hr = __super::AddFilter(pBF, pName)))
+ if(FAILED(hr = __super::AddFilter(pBF, pName))) {
return hr;
+ }
AppSettings& s = AfxGetAppSettings();
- if(GetCLSID(pBF) == CLSID_DMOWrapperFilter)
- {
- if(CComQIPtr<IPropertyBag> pPB = pBF)
- {
+ if(GetCLSID(pBF) == CLSID_DMOWrapperFilter) {
+ if(CComQIPtr<IPropertyBag> pPB = pBF) {
CComVariant var(true);
pPB->Write(CComBSTR(L"_HIRESOUTPUT"), &var);
}
}
- if(CComQIPtr<IAudioSwitcherFilter> pASF = pBF)
- {
+ if(CComQIPtr<IAudioSwitcherFilter> pASF = pBF) {
pASF->EnableDownSamplingTo441(s.fDownSampleTo441);
pASF->SetSpeakerConfig(s.fCustomChannelMapping, s.pSpeakerToChannelMap);
pASF->SetAudioTimeShift(s.fAudioTimeShift ? 10000i64*s.iAudioTimeShift : 0);
@@ -2361,17 +2301,14 @@ CFGManagerPlayer::CFGManagerPlayer(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) AppSettings& s = AfxGetAppSettings();
- if(m_pFM)
- {
+ if(m_pFM) {
CComPtr<IEnumMoniker> pEM;
GUID guids[] = {MEDIATYPE_Video, MEDIASUBTYPE_NULL};
if(SUCCEEDED(m_pFM->EnumMatchingFilters(&pEM, 0, FALSE, MERIT_DO_NOT_USE+1,
- TRUE, 1, guids, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL)))
- {
- for(CComPtr<IMoniker> pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL)
- {
+ TRUE, 1, guids, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL))) {
+ for(CComPtr<IMoniker> pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL) {
CFGFilterRegistry f(pMoniker);
m_vrmerit = max(m_vrmerit, f.GetMerit());
}
@@ -2380,24 +2317,20 @@ CFGManagerPlayer::CFGManagerPlayer(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) m_vrmerit += 0x100;
}
- if(m_pFM)
- {
+ if(m_pFM) {
CComPtr<IEnumMoniker> pEM;
GUID guids[] = {MEDIATYPE_Audio, MEDIASUBTYPE_NULL};
if(SUCCEEDED(m_pFM->EnumMatchingFilters(&pEM, 0, FALSE, MERIT_DO_NOT_USE+1,
- TRUE, 1, guids, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL)))
- {
- for(CComPtr<IMoniker> pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL)
- {
+ TRUE, 1, guids, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL))) {
+ for(CComPtr<IMoniker> pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL) {
CFGFilterRegistry f(pMoniker);
m_armerit = max(m_armerit, f.GetMerit());
}
}
- BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker)
- {
+ BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker) {
CFGFilterRegistry f(pMoniker);
m_armerit = max(m_armerit, f.GetMerit());
}
@@ -2408,8 +2341,7 @@ CFGManagerPlayer::CFGManagerPlayer(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) // Switchers
- if(s.fEnableAudioSwitcher)
- {
+ if(s.fEnableAudioSwitcher) {
pFGF = DNew CFGFilterInternal<CAudioSwitcherFilter>(L"Audio Switcher", m_armerit + 0x100);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
@@ -2420,74 +2352,66 @@ CFGManagerPlayer::CFGManagerPlayer(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) // Renderers
- switch(s.iDSVideoRendererType)
- {
- case VIDRNDT_DS_OLDRENDERER:
- m_transform.AddTail(DNew CFGFilterRegistry(CLSID_VideoRenderer, m_vrmerit));
- break;
- case VIDRNDT_DS_OVERLAYMIXER:
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit));
- break;
- case VIDRNDT_DS_VMR7WINDOWED:
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer, L"Video Mixing Renderer 7", m_vrmerit));
- break;
- case VIDRNDT_DS_VMR9WINDOWED:
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer9, L"Video Mixing Renderer 9", m_vrmerit));
- break;
- case VIDRNDT_DS_VMR7RENDERLESS:
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VMR7AllocatorPresenter, L"Video Mixing Renderer 7 (Renderless)", m_vrmerit));
- break;
- case VIDRNDT_DS_VMR9RENDERLESS:
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VMR9AllocatorPresenter, L"Video Mixing Renderer 9 (Renderless)", m_vrmerit));
- break;
- case VIDRNDT_DS_EVR:
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_EnhancedVideoRenderer, L"Enhanced Video Renderer", m_vrmerit));
- break;
- case VIDRNDT_DS_EVR_CUSTOM:
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_EVRAllocatorPresenter, L"Enhanced Video Renderer (custom presenter)", m_vrmerit));
- break;
- case VIDRNDT_DS_DXR:
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_DXRAllocatorPresenter, L"Haali's Video Renderer", m_vrmerit));
- break;
- case VIDRNDT_DS_MADVR:
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_madVRAllocatorPresenter, L"madVR Renderer", m_vrmerit));
- break;
- case VIDRNDT_DS_SYNC:
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_SyncAllocatorPresenter, L"EVR Sync", m_vrmerit));
- break;
- case VIDRNDT_DS_NULL_COMP:
- pFGF = DNew CFGFilterInternal<CNullVideoRenderer>(L"Null Video Renderer (Any)", MERIT64_ABOVE_DSHOW+2);
- pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
- m_transform.AddTail(pFGF);
- break;
- case VIDRNDT_DS_NULL_UNCOMP:
- pFGF = DNew CFGFilterInternal<CNullUVideoRenderer>(L"Null Video Renderer (Uncompressed)", MERIT64_ABOVE_DSHOW+2);
- pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
- m_transform.AddTail(pFGF);
- break;
+ switch(s.iDSVideoRendererType) {
+ case VIDRNDT_DS_OLDRENDERER:
+ m_transform.AddTail(DNew CFGFilterRegistry(CLSID_VideoRenderer, m_vrmerit));
+ break;
+ case VIDRNDT_DS_OVERLAYMIXER:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit));
+ break;
+ case VIDRNDT_DS_VMR7WINDOWED:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer, L"Video Mixing Renderer 7", m_vrmerit));
+ break;
+ case VIDRNDT_DS_VMR9WINDOWED:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer9, L"Video Mixing Renderer 9", m_vrmerit));
+ break;
+ case VIDRNDT_DS_VMR7RENDERLESS:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VMR7AllocatorPresenter, L"Video Mixing Renderer 7 (Renderless)", m_vrmerit));
+ break;
+ case VIDRNDT_DS_VMR9RENDERLESS:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VMR9AllocatorPresenter, L"Video Mixing Renderer 9 (Renderless)", m_vrmerit));
+ break;
+ case VIDRNDT_DS_EVR:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_EnhancedVideoRenderer, L"Enhanced Video Renderer", m_vrmerit));
+ break;
+ case VIDRNDT_DS_EVR_CUSTOM:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_EVRAllocatorPresenter, L"Enhanced Video Renderer (custom presenter)", m_vrmerit));
+ break;
+ case VIDRNDT_DS_DXR:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_DXRAllocatorPresenter, L"Haali's Video Renderer", m_vrmerit));
+ break;
+ case VIDRNDT_DS_MADVR:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_madVRAllocatorPresenter, L"madVR Renderer", m_vrmerit));
+ break;
+ case VIDRNDT_DS_SYNC:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_SyncAllocatorPresenter, L"EVR Sync", m_vrmerit));
+ break;
+ case VIDRNDT_DS_NULL_COMP:
+ pFGF = DNew CFGFilterInternal<CNullVideoRenderer>(L"Null Video Renderer (Any)", MERIT64_ABOVE_DSHOW+2);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
+ m_transform.AddTail(pFGF);
+ break;
+ case VIDRNDT_DS_NULL_UNCOMP:
+ pFGF = DNew CFGFilterInternal<CNullUVideoRenderer>(L"Null Video Renderer (Uncompressed)", MERIT64_ABOVE_DSHOW+2);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
+ m_transform.AddTail(pFGF);
+ break;
}
CString SelAudioRenderer = s.SelectedAudioRenderer();
- if(SelAudioRenderer == AUDRNDT_NULL_COMP)
- {
+ if(SelAudioRenderer == AUDRNDT_NULL_COMP) {
pFGF = DNew CFGFilterInternal<CNullAudioRenderer>(AUDRNDT_NULL_COMP, MERIT64_ABOVE_DSHOW+2);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
- }
- else if(SelAudioRenderer == AUDRNDT_NULL_UNCOMP)
- {
+ } else if(SelAudioRenderer == AUDRNDT_NULL_UNCOMP) {
pFGF = DNew CFGFilterInternal<CNullUAudioRenderer>(AUDRNDT_NULL_UNCOMP, MERIT64_ABOVE_DSHOW+2);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
- }
- else if(SelAudioRenderer == AUDRNDT_MPC)
- {
+ } else if(SelAudioRenderer == AUDRNDT_MPC) {
pFGF = DNew CFGFilterInternal<CMpcAudioRenderer>(AUDRNDT_MPC, MERIT64_ABOVE_DSHOW+2);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
- }
- else if(SelAudioRenderer!="")
- {
+ } else if(SelAudioRenderer!="") {
pFGF = DNew CFGFilterRegistry(SelAudioRenderer, m_armerit);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
@@ -2498,12 +2422,12 @@ STDMETHODIMP CFGManagerPlayer::ConnectDirect(IPin* pPinOut, IPin* pPinIn, const {
CAutoLock cAutoLock(this);
- if(GetCLSID(pPinOut) == CLSID_MPEG2Demultiplexer)
- {
+ if(GetCLSID(pPinOut) == CLSID_MPEG2Demultiplexer) {
CComQIPtr<IMediaSeeking> pMS = pPinOut;
REFERENCE_TIME rtDur = 0;
- if(!pMS || FAILED(pMS->GetDuration(&rtDur)) || rtDur <= 0)
+ if(!pMS || FAILED(pMS->GetDuration(&rtDur)) || rtDur <= 0) {
return E_FAIL;
+ }
}
return __super::ConnectDirect(pPinOut, pPinIn, pmt);
@@ -2519,8 +2443,9 @@ CFGManagerDVD::CFGManagerDVD(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) AppSettings& s = AfxGetAppSettings();
// have to avoid the old video renderer
- if(s.iDSVideoRendererType == VIDRNDT_DS_OLDRENDERER)
+ if(s.iDSVideoRendererType == VIDRNDT_DS_OLDRENDERER) {
m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit-1));
+ }
// elecard's decoder isn't suited for dvd playback (atm)
m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{F50B3F13-19C4-11CF-AA9A-02608C9BABA2}")), MERIT64_DO_NOT_USE));
@@ -2531,12 +2456,9 @@ CFGManagerDVD::CFGManagerDVD(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) class CResetDVD : public CDVDSession
{
public:
- CResetDVD(LPCTSTR path)
- {
- if(Open(path))
- {
- if(BeginSession())
- {
+ CResetDVD(LPCTSTR path) {
+ if(Open(path)) {
+ if(BeginSession()) {
Authenticate(); /*GetDiscKey();*/
EndSession();
}
@@ -2552,8 +2474,9 @@ STDMETHODIMP CFGManagerDVD::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayL HRESULT hr;
CComPtr<IBaseFilter> pBF;
- if(FAILED(hr = AddSourceFilter(lpcwstrFile, lpcwstrFile, &pBF)))
+ if(FAILED(hr = AddSourceFilter(lpcwstrFile, lpcwstrFile, &pBF))) {
return hr;
+ }
return ConnectFilter(pBF, NULL);
}
@@ -2575,14 +2498,16 @@ STDMETHODIMP CFGManagerDVD::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpc CComPtr<IBaseFilter> pBF;
if(FAILED(hr = pBF.CoCreateInstance(clsid))
- || FAILED(hr = AddFilter(pBF, L"DVD Navigator")))
+ || FAILED(hr = AddFilter(pBF, L"DVD Navigator"))) {
return VFW_E_CANNOT_LOAD_SOURCE_FILTER;
+ }
CComQIPtr<IDvdControl2> pDVDC;
CComQIPtr<IDvdInfo2> pDVDI;
- if(!((pDVDC = pBF) && (pDVDI = pBF)))
+ if(!((pDVDC = pBF) && (pDVDI = pBF))) {
return E_NOINTERFACE;
+ }
WCHAR buff[_MAX_PATH];
ULONG len;
@@ -2590,14 +2515,16 @@ STDMETHODIMP CFGManagerDVD::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpc && FAILED(hr = pDVDC->SetDVDDirectory(fn))
&& FAILED(hr = pDVDC->SetDVDDirectory(fn + L"VIDEO_TS"))
&& FAILED(hr = pDVDC->SetDVDDirectory(fn + L"\\VIDEO_TS")))
- || FAILED(hr = pDVDI->GetDVDDirectory(buff, countof(buff), &len)) || len == 0)
+ || FAILED(hr = pDVDI->GetDVDDirectory(buff, countof(buff), &len)) || len == 0) {
return E_INVALIDARG;
+ }
pDVDC->SetOption(DVD_ResetOnStop, FALSE);
pDVDC->SetOption(DVD_HMSF_TimeCodeEvents, TRUE);
- if(clsid == CLSID_DVDNavigator)
+ if(clsid == CLSID_DVDNavigator) {
CResetDVD(CString(buff));
+ }
*ppFilter = pBF.Detach();
diff --git a/src/apps/mplayerc/FGManager.h b/src/apps/mplayerc/FGManager.h index 017b365df..095ab89f3 100644 --- a/src/apps/mplayerc/FGManager.h +++ b/src/apps/mplayerc/FGManager.h @@ -34,8 +34,7 @@ class CFGManager , public CCritSec
{
public:
- struct path_t
- {
+ struct path_t {
CLSID clsid;
CString filter, pin;
};
diff --git a/src/apps/mplayerc/FGManagerBDA.cpp b/src/apps/mplayerc/FGManagerBDA.cpp index c491d1385..2d0ee5b81 100644 --- a/src/apps/mplayerc/FGManagerBDA.cpp +++ b/src/apps/mplayerc/FGManagerBDA.cpp @@ -43,8 +43,7 @@ /// Format, Video MPEG2
-static const MPEG2VIDEOINFO sMpv_fmt =
-{
+static const MPEG2VIDEOINFO sMpv_fmt = {
{
// hdr
{0,0,720,576}, // rcSource
@@ -69,8 +68,7 @@ static const MPEG2VIDEOINFO sMpv_fmt = };
/// Media type, Video MPEG2
-static const AM_MEDIA_TYPE mt_Mpv =
-{
+static const AM_MEDIA_TYPE mt_Mpv = {
MEDIATYPE_Video, // majortype
MEDIASUBTYPE_MPEG2_VIDEO, // subtype
FALSE, // bFixedSizeSamples
@@ -85,8 +83,7 @@ static const AM_MEDIA_TYPE mt_Mpv = #define FCC_h264 MAKEFOURCC('h', '2', '6', '4')
/// Format, Video H264
-static const VIDEOINFOHEADER2 vih2_H264 =
-{
+static const VIDEOINFOHEADER2 vih2_H264 = {
{0,0,0,0}, // rcSource
{0,0,0,0}, // rcTarget
0, // dwBitRate,
@@ -101,8 +98,8 @@ static const VIDEOINFOHEADER2 vih2_H264 = {
// bmiHeader
sizeof(BITMAPINFOHEADER), // biSize
-// 720, // biWidth
-// 576, // biHeight
+ // 720, // biWidth
+ // 576, // biHeight
1920, // biWidth
1080, // biHeight
0, // biPlanes
@@ -113,8 +110,7 @@ static const VIDEOINFOHEADER2 vih2_H264 = };
/// Media type, Video H264
-static const AM_MEDIA_TYPE mt_H264 =
-{
+static const AM_MEDIA_TYPE mt_H264 = {
MEDIATYPE_Video, // majortype
MEDIASUBTYPE_H264, // subtype
FALSE, // bFixedSizeSamples
@@ -127,8 +123,7 @@ static const AM_MEDIA_TYPE mt_H264 = };
/// Format, Audio (common)
-static const WAVEFORMATEX wf_Audio =
-{
+static const WAVEFORMATEX wf_Audio = {
WAVE_FORMAT_PCM, // wFormatTag
2, // nChannels
48000, // nSamplesPerSec
@@ -139,8 +134,7 @@ static const WAVEFORMATEX wf_Audio = };
/// Media type, Audio MPEG2
-static const AM_MEDIA_TYPE mt_Mpa =
-{
+static const AM_MEDIA_TYPE mt_Mpa = {
MEDIATYPE_Audio, // majortype
MEDIASUBTYPE_MPEG2_AUDIO, // subtype
TRUE, // bFixedSizeSamples
@@ -153,8 +147,7 @@ static const AM_MEDIA_TYPE mt_Mpa = };
/// Media type, Audio AC3
-static const AM_MEDIA_TYPE mt_Ac3 =
-{
+static const AM_MEDIA_TYPE mt_Ac3 = {
MEDIATYPE_Audio, // majortype
MEDIASUBTYPE_DOLBY_AC3, // subtype
TRUE, // bFixedSizeSamples
@@ -167,8 +160,7 @@ static const AM_MEDIA_TYPE mt_Ac3 = };
/// Media type, Audio EAC3
-static const AM_MEDIA_TYPE mt_Eac3 =
-{
+static const AM_MEDIA_TYPE mt_Eac3 = {
MEDIATYPE_Audio, // majortype
MEDIASUBTYPE_DOLBY_DDPLUS, // subtype
TRUE, // bFixedSizeSamples
@@ -181,8 +173,7 @@ static const AM_MEDIA_TYPE mt_Eac3 = };
/// Media type, PSI
-static const AM_MEDIA_TYPE mt_Psi =
-{
+static const AM_MEDIA_TYPE mt_Psi = {
MEDIATYPE_MPEG2_SECTIONS, // majortype
MEDIASUBTYPE_MPEG2DATA, // subtype
TRUE, // bFixedSizeSamples
@@ -195,8 +186,7 @@ static const AM_MEDIA_TYPE mt_Psi = };
/// Media type, TIF
-static const AM_MEDIA_TYPE mt_Tif =
-{
+static const AM_MEDIA_TYPE mt_Tif = {
MEDIATYPE_MPEG2_SECTIONS, // majortype
MEDIASUBTYPE_DVB_SI, // subtype
TRUE, // bFixedSizeSamples
@@ -209,8 +199,7 @@ static const AM_MEDIA_TYPE mt_Tif = };
/// Media type, EPG
-static const AM_MEDIA_TYPE mt_Epg =
-{
+static const AM_MEDIA_TYPE mt_Epg = {
MEDIATYPE_MPEG2_SECTIONS, // majortype
MEDIASUBTYPE_DVB_SI, // subtype
TRUE, // bFixedSizeSamples
@@ -223,8 +212,7 @@ static const AM_MEDIA_TYPE mt_Epg = };
/// Media type, PMT
-static const AM_MEDIA_TYPE mt_Pmt =
-{
+static const AM_MEDIA_TYPE mt_Pmt = {
MEDIATYPE_MPEG2_SECTIONS, // majortype
MEDIASUBTYPE_DVB_SI, // subtype
TRUE, // bFixedSizeSamples
@@ -239,8 +227,7 @@ static const AM_MEDIA_TYPE mt_Pmt = static const SUBTITLEINFO SubFormat = { 0, "", L"" };
/// Media type, subtitle
-static const AM_MEDIA_TYPE mt_Subtitle =
-{
+static const AM_MEDIA_TYPE mt_Subtitle = {
MEDIATYPE_Subtitle, // majortype
MEDIASUBTYPE_DVB_SUBTITLES, // subtype
FALSE, // bFixedSizeSamples
@@ -271,10 +258,11 @@ CFGManagerBDA::CFGManagerBDA(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) m_DVBStreams[DVB_EPG] = CDVBStream(L"epg", &mt_Epg);
// Warning : MEDIA_ELEMENTARY_STREAM didn't work for subtitles with Windows XP!
- if (IsVistaOrAbove())
+ if (IsVistaOrAbove()) {
m_DVBStreams[DVB_SUB] = CDVBStream(L"sub", &mt_Subtitle/*, false, MEDIA_TRANSPORT_PAYLOAD*/);
- else
+ } else {
m_DVBStreams[DVB_SUB] = CDVBStream(L"sub", &mt_Subtitle, false, MEDIA_TRANSPORT_PAYLOAD);
+ }
m_nCurVideoType = DVB_MPV;
m_nCurAudioType = DVB_MPA;
@@ -282,11 +270,9 @@ CFGManagerBDA::CFGManagerBDA(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) // Hack : remove audio switcher !
POSITION pos = m_transform.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CFGFilter* pFGF = m_transform.GetAt(pos);
- if(pFGF->GetCLSID() == __uuidof(CAudioSwitcherFilter))
- {
+ if(pFGF->GetCLSID() == __uuidof(CAudioSwitcherFilter)) {
m_transform.RemoveAt (pos);
delete pFGF;
break;
@@ -306,24 +292,28 @@ CFGManagerBDA::~CFGManagerBDA() HRESULT CFGManagerBDA::CreateKSFilter(IBaseFilter** ppBF, CLSID KSCategory, CStringW& DisplayName)
{
HRESULT hr = VFW_E_NOT_FOUND;
- BeginEnumSysDev (KSCategory, pMoniker)
- {
+ BeginEnumSysDev (KSCategory, pMoniker) {
CComPtr<IPropertyBag> pPB;
CComVariant var;
LPOLESTR strName = NULL;
if (SUCCEEDED (pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)) &&
SUCCEEDED (pMoniker->GetDisplayName(NULL, NULL, &strName)) &&
- SUCCEEDED (pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)) )
- {
+ SUCCEEDED (pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)) ) {
CStringW Name = CStringW(strName);
- if (Name != DisplayName) continue;
+ if (Name != DisplayName) {
+ continue;
+ }
hr = pMoniker->BindToObject(NULL, NULL, IID_IBaseFilter, (void**)ppBF);
- if (SUCCEEDED (hr)) hr = AddFilter (*ppBF, CStringW(var.bstrVal));
+ if (SUCCEEDED (hr)) {
+ hr = AddFilter (*ppBF, CStringW(var.bstrVal));
+ }
break;
}
- if (strName) CoTaskMemFree(strName);
+ if (strName) {
+ CoTaskMemFree(strName);
+ }
}
EndEnumSysDev
@@ -341,23 +331,24 @@ HRESULT CFGManagerBDA::SearchIBDATopology(const CComPtr<IBaseFilter>& pTuner, RE HRESULT hr = pTop->GetNodeTypes(&NodeTypes, _countof(NodeType), NodeType);
- if (FAILED(hr))
+ if (FAILED(hr)) {
return hr;
+ }
- for (ULONG i = 0; i < NodeTypes; i++)
- {
+ for (ULONG i = 0; i < NodeTypes; i++) {
ULONG nInterfaces;
GUID aInterface[32];
hr = pTop->GetNodeInterfaces(NodeType[i], &nInterfaces, _countof(aInterface), aInterface);
- if (FAILED(hr))
+ if (FAILED(hr)) {
continue;
+ }
- for (ULONG j = 0; j < nInterfaces; j++)
- {
- if (aInterface[j] == iid)
+ for (ULONG j = 0; j < nInterfaces; j++) {
+ if (aInterface[j] == iid) {
return pTop->GetControlNode(0, 1, NodeType[i], &pUnk);
+ }
}
}
@@ -369,32 +360,30 @@ HRESULT CFGManagerBDA::SearchIBDATopology(const CComPtr<IBaseFilter>& pTuner, RE HRESULT CFGManagerBDA::ConnectFilters(IBaseFilter* pOutFiter, IBaseFilter* pInFilter)
{
HRESULT hr = VFW_E_CANNOT_CONNECT;
- BeginEnumPins(pOutFiter, pEP, pOutPin)
- {
+ BeginEnumPins(pOutFiter, pEP, pOutPin) {
if(S_OK == IsPinDirection(pOutPin, PINDIR_OUTPUT)
- && S_OK != IsPinConnected(pOutPin))
- {
- BeginEnumPins(pInFilter, pEP, pInPin)
- {
+ && S_OK != IsPinConnected(pOutPin)) {
+ BeginEnumPins(pInFilter, pEP, pInPin) {
if(S_OK == IsPinDirection(pInPin, PINDIR_INPUT)
- && S_OK != IsPinConnected(pInPin))
- {
+ && S_OK != IsPinConnected(pInPin)) {
hr = this->ConnectDirect(pOutPin, pInPin, NULL);
-/*#ifdef _DEBUG
- PIN_INFO InfoPinIn, InfoPinOut;
- FILTER_INFO InfoFilterIn, InfoFilterOut;
- pInPin->QueryPinInfo (&InfoPinIn);
- pOutPin->QueryPinInfo (&InfoPinOut);
- InfoPinIn.pFilter->QueryFilterInfo(&InfoFilterIn);
- InfoPinOut.pFilter->QueryFilterInfo(&InfoFilterOut);
-
- TRACE ("%S - %S => %S - %S (hr=0x%08x)\n", InfoFilterOut.achName, InfoPinOut.achName, InfoFilterIn.achName, InfoPinIn.achName, hr);
-
- InfoPinIn.pFilter->Release();
- InfoPinOut.pFilter->Release();
-#endif*/
- if (SUCCEEDED (hr)) return hr;
+ /*#ifdef _DEBUG
+ PIN_INFO InfoPinIn, InfoPinOut;
+ FILTER_INFO InfoFilterIn, InfoFilterOut;
+ pInPin->QueryPinInfo (&InfoPinIn);
+ pOutPin->QueryPinInfo (&InfoPinOut);
+ InfoPinIn.pFilter->QueryFilterInfo(&InfoFilterIn);
+ InfoPinOut.pFilter->QueryFilterInfo(&InfoFilterOut);
+
+ TRACE ("%S - %S => %S - %S (hr=0x%08x)\n", InfoFilterOut.achName, InfoPinOut.achName, InfoFilterIn.achName, InfoPinIn.achName, hr);
+
+ InfoPinIn.pFilter->Release();
+ InfoPinOut.pFilter->Release();
+ #endif*/
+ if (SUCCEEDED (hr)) {
+ return hr;
+ }
}
}
EndEnumPins;
@@ -417,32 +406,27 @@ STDMETHODIMP CFGManagerBDA::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayL LOG (_T("\nCreating BDA filters..."));
CheckAndLog (CreateKSFilter (&pNetwork, KSCATEGORY_BDA_NETWORK_PROVIDER, s.strBDANetworkProvider), "BDA : Network provider creation");
-// CheckAndLog (CreateKSFilter (&pTuner, KSCATEGORY_BDA_NETWORK_TUNER, s.strBDATuner), "BDA : Network tuner creation");
- if (FAILED(hr = CreateKSFilter (&pTuner, KSCATEGORY_BDA_NETWORK_TUNER, s.strBDATuner)))
- {
+ // CheckAndLog (CreateKSFilter (&pTuner, KSCATEGORY_BDA_NETWORK_TUNER, s.strBDATuner), "BDA : Network tuner creation");
+ if (FAILED(hr = CreateKSFilter (&pTuner, KSCATEGORY_BDA_NETWORK_TUNER, s.strBDATuner))) {
AfxMessageBox(_T("BDA Error: could not create Network tuner. "), MB_OK);
TRACE("BDA : Network tuner creation"" :0x%08x\n",hr);
return hr;
}
- if (s.strBDATuner.Right(40) != s.strBDAReceiver.Right(40)) // check if filters are the same
- {
-// CheckAndLog (CreateKSFilter (&pReceiver, KSCATEGORY_BDA_RECEIVER_COMPONENT, s.strBDAReceiver), "BDA : Receiver creation");
- if (FAILED(hr = CreateKSFilter (&pReceiver, KSCATEGORY_BDA_RECEIVER_COMPONENT, s.strBDAReceiver)))
- {
+ if (s.strBDATuner.Right(40) != s.strBDAReceiver.Right(40)) { // check if filters are the same
+ // CheckAndLog (CreateKSFilter (&pReceiver, KSCATEGORY_BDA_RECEIVER_COMPONENT, s.strBDAReceiver), "BDA : Receiver creation");
+ if (FAILED(hr = CreateKSFilter (&pReceiver, KSCATEGORY_BDA_RECEIVER_COMPONENT, s.strBDAReceiver))) {
AfxMessageBox(_T("BDA Error: could not create Network receiver."), MB_OK);
TRACE("BDA : Receiver creation"" :0x%08x\n",hr);
return hr;
}
-// CheckAndLog (ConnectFilters (pNetwork, pTuner), "BDA : Network <-> Tuner");
- if (FAILED(hr = ConnectFilters (pNetwork, pTuner)))
- {
+ // CheckAndLog (ConnectFilters (pNetwork, pTuner), "BDA : Network <-> Tuner");
+ if (FAILED(hr = ConnectFilters (pNetwork, pTuner))) {
AfxMessageBox(_T("BDA Error: could not connect Network and Tuner."), MB_OK);
TRACE("BDA : Network <-> Tuner"" :0x%08x\n",hr);
return hr;
}
-// CheckAndLog (ConnectFilters (pTuner, pReceiver), "BDA : Tuner <-> Receiver");
- if (FAILED(hr = ConnectFilters (pTuner, pReceiver)))
- {
+ // CheckAndLog (ConnectFilters (pTuner, pReceiver), "BDA : Tuner <-> Receiver");
+ if (FAILED(hr = ConnectFilters (pTuner, pReceiver))) {
AfxMessageBox(_T("BDA Error: could not connect Tuner and Receiver."), MB_OK);
TRACE("BDA : Tuner <-> Receiver"" :0x%08x\n",hr);
return hr;
@@ -451,35 +435,29 @@ STDMETHODIMP CFGManagerBDA::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayL CComPtr<IBaseFilter> pMpeg2Demux;
m_pBDAControl = pTuner;
-// CheckAndLog (SearchIBDATopology (pTuner, m_pBDAFreq), "BDA : IBDA_FrequencyFilter topology");
- if (FAILED(hr = SearchIBDATopology (pTuner, m_pBDAFreq)))
- {
+ // CheckAndLog (SearchIBDATopology (pTuner, m_pBDAFreq), "BDA : IBDA_FrequencyFilter topology");
+ if (FAILED(hr = SearchIBDATopology (pTuner, m_pBDAFreq))) {
AfxMessageBox(_T("BDA Error: IBDA_FrequencyFilter topology."), MB_OK);
TRACE("BDA : IBDA_FrequencyFilter topology"" :0x%08x\n",hr);
return hr;
}
-// CheckAndLog (SearchIBDATopology (pTuner, m_pBDAStats), "BDA : IBDA_SignalStatistics topology");
- if (FAILED(hr = SearchIBDATopology (pTuner, m_pBDAStats)))
- {
+ // CheckAndLog (SearchIBDATopology (pTuner, m_pBDAStats), "BDA : IBDA_SignalStatistics topology");
+ if (FAILED(hr = SearchIBDATopology (pTuner, m_pBDAStats))) {
AfxMessageBox(_T("BDA Error: IBDA_SignalStatistics topology."), MB_OK);
TRACE("BDA : IBDA_SignalStatistics topology"" :0x%08x\n",hr);
return hr;
}
// Create Mpeg2 demux
-// CheckAndLog (CreateMicrosoftDemux (pReceiver, pMpeg2Demux), "BDA : Microsoft demux creation");
- if (FAILED(hr = CreateMicrosoftDemux (pReceiver, pMpeg2Demux)))
- {
+ // CheckAndLog (CreateMicrosoftDemux (pReceiver, pMpeg2Demux), "BDA : Microsoft demux creation");
+ if (FAILED(hr = CreateMicrosoftDemux (pReceiver, pMpeg2Demux))) {
AfxMessageBox(_T("BDA Error: could not create Demux."), MB_OK);
TRACE("BDA : Microsoft demux creation"" :0x%08x\n",hr);
return hr;
}
- }
- else // if same filters, connect pNetwork to pTuner directly
- {
-// CheckAndLog (ConnectFilters (pNetwork, pTuner), "BDA : Network <-> Tuner/Receiver");
- if (FAILED(hr = ConnectFilters (pNetwork, pTuner)))
- {
+ } else { // if same filters, connect pNetwork to pTuner directly
+ // CheckAndLog (ConnectFilters (pNetwork, pTuner), "BDA : Network <-> Tuner/Receiver");
+ if (FAILED(hr = ConnectFilters (pNetwork, pTuner))) {
AfxMessageBox(_T("BDA Error: could not connect Network <-> Tuner/Receiver."), MB_OK);
TRACE("BDA : Network <-> Tuner/Receiver"" :0x%08x\n",hr);
return hr;
@@ -487,16 +465,14 @@ STDMETHODIMP CFGManagerBDA::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayL CComPtr<IBaseFilter> pMpeg2Demux;
m_pBDAControl = pTuner;
-// CheckAndLog (SearchIBDATopology (pTuner, m_pBDAFreq), "BDA : IBDA_FrequencyFilter topology");
- if (FAILED(hr = SearchIBDATopology (pTuner, m_pBDAFreq)))
- {
+ // CheckAndLog (SearchIBDATopology (pTuner, m_pBDAFreq), "BDA : IBDA_FrequencyFilter topology");
+ if (FAILED(hr = SearchIBDATopology (pTuner, m_pBDAFreq))) {
AfxMessageBox(_T("BDA Error: IBDA_FrequencyFilter topology."), MB_OK);
TRACE("BDA : IBDA_FrequencyFilter topology"" :0x%08x\n",hr);
return hr;
}
-// CheckAndLog (SearchIBDATopology (pTuner, m_pBDAStats), "BDA : IBDA_SignalStatistics topology");
- if (FAILED(hr = SearchIBDATopology (pTuner, m_pBDAStats)))
- {
+ // CheckAndLog (SearchIBDATopology (pTuner, m_pBDAStats), "BDA : IBDA_SignalStatistics topology");
+ if (FAILED(hr = SearchIBDATopology (pTuner, m_pBDAStats))) {
AfxMessageBox(_T("BDA Error: IBDA_SignalStatistics topology."), MB_OK);
TRACE("BDA : IBDA_SignalStatistics topology"" :0x%08x\n",hr);
return hr;
@@ -504,9 +480,8 @@ STDMETHODIMP CFGManagerBDA::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayL LOG (_T("Network -> Receiver connected."));
// Create Mpeg2 demux
-// CheckAndLog (CreateMicrosoftDemux (pTuner, pMpeg2Demux), "BDA : Microsoft demux creation");
- if (FAILED(hr = CreateMicrosoftDemux (pTuner, pMpeg2Demux)))
- {
+ // CheckAndLog (CreateMicrosoftDemux (pTuner, pMpeg2Demux), "BDA : Microsoft demux creation");
+ if (FAILED(hr = CreateMicrosoftDemux (pTuner, pMpeg2Demux))) {
AfxMessageBox(_T("BDA Error: could not create Demux."), MB_OK);
TRACE("BDA : Microsoft demux creation"" :0x%08x\n",hr);
return hr;
@@ -515,8 +490,7 @@ STDMETHODIMP CFGManagerBDA::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayL #ifdef _DEBUG
LOG (_T("\nFilter list:"));
- BeginEnumFilters(this, pEF, pBF)
- {
+ BeginEnumFilters(this, pEF, pBF) {
LOG(GetFilterName(pBF));
}
EndEnumFilters;
@@ -537,12 +511,12 @@ STDMETHODIMP CFGManagerBDA::SetChannel (int nChannelPrefNumber) AppSettings& s = AfxGetAppSettings();
CDVBChannel* pChannel = s.FindChannelByPref(nChannelPrefNumber);
- if (pChannel != NULL)
- {
+ if (pChannel != NULL) {
hr = SetChannelInternal (pChannel);
- if (SUCCEEDED (hr))
+ if (SUCCEEDED (hr)) {
s.nDVBLastChannel = nChannelPrefNumber;
+ }
}
return hr;
@@ -579,11 +553,11 @@ STDMETHODIMP CFGManagerBDA::Scan(ULONG ulFrequency, HWND hWnd) Parser.ParseNIT();
POSITION pos = Parser.Channels.GetStartPosition();
- while(pos)
- {
+ while(pos) {
CDVBChannel& Channel = Parser.Channels.GetNextValue(pos);
- if (Channel.HasName())
+ if (Channel.HasName()) {
::SendMessage (hWnd, WM_TUNER_NEW_CHANNEL, 0, (LPARAM)(LPCTSTR)Channel.ToString());
+ }
}
return S_OK;
@@ -611,8 +585,9 @@ STDMETHODIMP CFGManagerBDA::Count(DWORD* pcStreams) *pcStreams = 0;
- if (pChannel != 0)
+ if (pChannel != 0) {
*pcStreams = pChannel->GetAudioCount() + pChannel->GetSubtitleCount();
+ }
return S_OK;
}
@@ -626,29 +601,24 @@ STDMETHODIMP CFGManagerBDA::Enable(long lIndex, DWORD dwFlags) CDVBStream* pStream = NULL;
FILTER_STATE nState;
- if (pChannel)
- {
- if (lIndex>=0 && lIndex < pChannel->GetAudioCount())
- {
+ if (pChannel) {
+ if (lIndex>=0 && lIndex < pChannel->GetAudioCount()) {
pStreamInfo = pChannel->GetAudio(lIndex);
pStream = &m_DVBStreams[pStreamInfo->Type];
- if (pStream && pStreamInfo)
- {
+ if (pStream && pStreamInfo) {
nState = GetState();
- if (m_nCurAudioType != pStreamInfo->Type)
+ if (m_nCurAudioType != pStreamInfo->Type) {
SwitchStream (m_nCurAudioType, pStreamInfo->Type);
+ }
pStream->Map (pStreamInfo->PID);
ChangeState ((FILTER_STATE)nState);
hr = S_OK;
}
- }
- else if (lIndex > 0 && lIndex < pChannel->GetAudioCount()+pChannel->GetSubtitleCount())
- {
+ } else if (lIndex > 0 && lIndex < pChannel->GetAudioCount()+pChannel->GetSubtitleCount()) {
pStreamInfo = pChannel->GetSubtitle(lIndex-pChannel->GetAudioCount());
- if (pStreamInfo)
- {
+ if (pStreamInfo) {
m_DVBStreams[DVB_SUB].Map(pStreamInfo->PID);
hr = S_OK;
}
@@ -667,38 +637,52 @@ STDMETHODIMP CFGManagerBDA::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFl CDVBStream* pStream = NULL;
CDVBStream* pCurrentStream = NULL;
- if (pChannel)
- {
- if (lIndex>=0 && lIndex < pChannel->GetAudioCount())
- {
+ if (pChannel) {
+ if (lIndex>=0 && lIndex < pChannel->GetAudioCount()) {
pCurrentStream = &m_DVBStreams[m_nCurAudioType];
pStreamInfo = pChannel->GetAudio(lIndex);
- if(pStreamInfo) pStream = &m_DVBStreams[pStreamInfo->Type];
- if(pdwGroup) *pdwGroup = 1; // Audio group
- }
- else if (lIndex > 0 && lIndex < pChannel->GetAudioCount()+pChannel->GetSubtitleCount())
- {
+ if(pStreamInfo) {
+ pStream = &m_DVBStreams[pStreamInfo->Type];
+ }
+ if(pdwGroup) {
+ *pdwGroup = 1; // Audio group
+ }
+ } else if (lIndex > 0 && lIndex < pChannel->GetAudioCount()+pChannel->GetSubtitleCount()) {
pCurrentStream = &m_DVBStreams[DVB_SUB];
pStreamInfo = pChannel->GetSubtitle(lIndex-pChannel->GetAudioCount());
- if(pStreamInfo) pStream = &m_DVBStreams[pStreamInfo->Type];
- if(pdwGroup) *pdwGroup = 2; // Subtitle group
+ if(pStreamInfo) {
+ pStream = &m_DVBStreams[pStreamInfo->Type];
+ }
+ if(pdwGroup) {
+ *pdwGroup = 2; // Subtitle group
+ }
}
- if (pStreamInfo && pStream && pCurrentStream)
- {
- if(ppmt) *ppmt = CreateMediaType(pStream->GetMediaType());
- if(pdwFlags) *pdwFlags = (pCurrentStream->GetMappedPID() == pStreamInfo->PID) ? AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE : 0;
- if(plcid) *plcid = pStreamInfo->GetLCID();
- if(ppObject) *ppObject = NULL;
- if(ppUnk) *ppUnk = NULL;
- if(ppszName)
- {
+ if (pStreamInfo && pStream && pCurrentStream) {
+ if(ppmt) {
+ *ppmt = CreateMediaType(pStream->GetMediaType());
+ }
+ if(pdwFlags) {
+ *pdwFlags = (pCurrentStream->GetMappedPID() == pStreamInfo->PID) ? AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE : 0;
+ }
+ if(plcid) {
+ *plcid = pStreamInfo->GetLCID();
+ }
+ if(ppObject) {
+ *ppObject = NULL;
+ }
+ if(ppUnk) {
+ *ppUnk = NULL;
+ }
+ if(ppszName) {
CStringW str;
str = StreamTypeToName(pStreamInfo->PesType);
*ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength()+1)*sizeof(WCHAR));
- if(*ppszName == NULL) return E_OUTOFMEMORY;
+ if(*ppszName == NULL) {
+ return E_OUTOFMEMORY;
+ }
wcscpy_s(*ppszName, str.GetLength()+1, str);
}
@@ -743,35 +727,29 @@ HRESULT CFGManagerBDA::CreateMicrosoftDemux(IBaseFilter* pReceiver, CComPtr<IBas LOG (_T("Receiver -> Demux connected."));
POSITION pos = m_DVBStreams.GetStartPosition();
- while (pos)
- {
+ while (pos) {
CComPtr<IPin> pPin;
DVB_STREAM_TYPE nType = m_DVBStreams.GetNextKey(pos);
CDVBStream& Stream = m_DVBStreams[nType];
- if (nType != DVB_EPG) // Hack: DVB_EPG not required
- {
+ if (nType != DVB_EPG) { // Hack: DVB_EPG not required
if (!Stream.GetFindExisting() ||
- (pPin = FindPin (pMpeg2Demux, PINDIR_OUTPUT, Stream.GetMediaType())) == NULL)
- {
+ (pPin = FindPin (pMpeg2Demux, PINDIR_OUTPUT, Stream.GetMediaType())) == NULL) {
CheckNoLog (pDemux->CreateOutputPin ((AM_MEDIA_TYPE*)Stream.GetMediaType(), Stream.GetName(), &pPin));
}
-// CheckNoLog (Connect (pPin, NULL, false));
-// Stream.SetPin (pPin);
+ // CheckNoLog (Connect (pPin, NULL, false));
+ // Stream.SetPin (pPin);
// Complete graph for one audio stream and one video stream (using standard graph builder rules)
-// if (nType == m_nCurVideoType || nType == m_nCurAudioType)
-// {
-// Connect (GetFirstDisconnectedPin (Stream.GetFilter(), PINDIR_OUTPUT), NULL);
-// }
- if (nType == m_nCurVideoType || nType == m_nCurAudioType)
- {
+ // if (nType == m_nCurVideoType || nType == m_nCurAudioType)
+ // {
+ // Connect (GetFirstDisconnectedPin (Stream.GetFilter(), PINDIR_OUTPUT), NULL);
+ // }
+ if (nType == m_nCurVideoType || nType == m_nCurAudioType) {
CheckNoLog (Connect (pPin, NULL, true));
Stream.SetPin (pPin);
LOG (_T("Graph completed for stream type %d."),nType);
- }
- else
- {
+ } else {
CheckNoLog (Connect (pPin, NULL, false));
Stream.SetPin (pPin);
LOG (_T("Filter connected to Demux for media type %d."),nType);
@@ -792,14 +770,12 @@ HRESULT CFGManagerBDA::SetChannelInternal (CDVBChannel* pChannel) int nState = GetState();
- if (pChannel->GetVideoPID() != 0)
- {
+ if (pChannel->GetVideoPID() != 0) {
SwitchStream (m_nCurVideoType, pChannel->GetVideoType());
- if (m_fHideWindow)
+ if (m_fHideWindow) {
fRadioToTV = true;
- }
- else
- {
+ }
+ } else {
m_fHideWindow = true;
((CMainFrame*)AfxGetMainWnd())->HideVideoWindow(m_fHideWindow);
}
@@ -807,25 +783,24 @@ HRESULT CFGManagerBDA::SetChannelInternal (CDVBChannel* pChannel) SwitchStream (m_nCurAudioType, pChannel->GetDefaultAudioType());
CheckNoLog (SetFrequency (pChannel->GetFrequency()));
- if (pChannel->GetVideoPID() != 0)
- {
+ if (pChannel->GetVideoPID() != 0) {
CheckNoLog (m_DVBStreams[m_nCurVideoType].Map (pChannel->GetVideoPID()));
}
CheckNoLog (m_DVBStreams[m_nCurAudioType].Map (pChannel->GetDefaultAudioPID()));
- if (GetState() == State_Stopped)
+ if (GetState() == State_Stopped) {
hr = ChangeState ((FILTER_STATE)nState);
+ }
- if (fRadioToTV)
- {
+ if (fRadioToTV) {
m_fHideWindow = false;
Sleep(1800);
((CMainFrame*)AfxGetMainWnd())->HideVideoWindow(m_fHideWindow);
}
// TODO : remove sub later!
-// CheckNoLog (m_DVBStreams[DVB_SUB].Map (pChannel->GetDefaultSubtitlePID()));
+ // CheckNoLog (m_DVBStreams[DVB_SUB].Map (pChannel->GetDefaultSubtitlePID()));
return hr;
}
@@ -833,16 +808,16 @@ HRESULT CFGManagerBDA::SetChannelInternal (CDVBChannel* pChannel) HRESULT CFGManagerBDA::SwitchStream (DVB_STREAM_TYPE& nOldType, DVB_STREAM_TYPE nNewType)
{
- if (nNewType != nOldType)
- {
+ if (nNewType != nOldType) {
CComPtr<IBaseFilter> pFGOld = m_DVBStreams[nOldType].GetFilter();
CComPtr<IBaseFilter> pFGNew = m_DVBStreams[nNewType].GetFilter();
CComPtr<IPin> pOldOut = GetFirstPin (pFGOld, PINDIR_OUTPUT);
CComPtr<IPin> pInPin;
CComPtr<IPin> pNewOut = GetFirstPin (pFGNew, PINDIR_OUTPUT);
- if (GetState() != State_Stopped)
+ if (GetState() != State_Stopped) {
ChangeState (State_Stopped);
+ }
pOldOut->ConnectedTo(&pInPin);
Disconnect (pOldOut);
Disconnect (pInPin);
@@ -859,8 +834,9 @@ HRESULT CFGManagerBDA::UpdatePSI(PresentFollowing &NowNext) CDVBChannel* pChannel = s.FindChannelByPref(s.nDVBLastChannel);
CMpeg2DataParser Parser (m_DVBStreams[DVB_PSI].GetFilter());
- if (pChannel->GetNowNextFlag())
+ if (pChannel->GetNowNextFlag()) {
hr = Parser.ParseEIT(pChannel->GetSID(), NowNext);
+ }
return hr;
}
@@ -874,37 +850,34 @@ HRESULT CFGManagerBDA::ChangeState(FILTER_STATE nRequested) CComPtr<IMediaControl> pMC;
QueryInterface(__uuidof(IMediaControl), (void**) &pMC);
pMC->GetState (500, &nState);
- if (nState != nRequested)
- {
- switch (nRequested)
- {
- case State_Stopped :
- {
- if (SUCCEEDED(hr = pMC->Stop()))
- ((CMainFrame*)AfxGetMainWnd())->KillTimersStop();
- LOG (_T("IMediaControl stop: %d."),hr);
- return hr;
- }
- case State_Paused :
- {
- LOG (_T("IMediaControl pause."));
- return pMC->Pause();
- }
- case State_Running :
- {
- int iCount = 0;
- hr = S_FALSE;
- while ((hr == S_FALSE) && (iCount++ < 10))
- {
- hr = pMC->Run();
- if (hr == S_FALSE)
- Sleep(50);
+ if (nState != nRequested) {
+ switch (nRequested) {
+ case State_Stopped : {
+ if (SUCCEEDED(hr = pMC->Stop())) {
+ ((CMainFrame*)AfxGetMainWnd())->KillTimersStop();
+ }
+ LOG (_T("IMediaControl stop: %d."),hr);
+ return hr;
+ }
+ case State_Paused : {
+ LOG (_T("IMediaControl pause."));
+ return pMC->Pause();
+ }
+ case State_Running : {
+ int iCount = 0;
+ hr = S_FALSE;
+ while ((hr == S_FALSE) && (iCount++ < 10)) {
+ hr = pMC->Run();
+ if (hr == S_FALSE) {
+ Sleep(50);
+ }
+ }
+ if (SUCCEEDED(hr)) {
+ ((CMainFrame*)AfxGetMainWnd())->SetTimersPlay();
+ }
+ LOG (_T("IMediaControl play: %d."),hr);
+ return hr;
}
- if (SUCCEEDED(hr))
- ((CMainFrame*)AfxGetMainWnd())->SetTimersPlay();
- LOG (_T("IMediaControl play: %d."),hr);
- return hr;
- }
}
}
return hr;
diff --git a/src/apps/mplayerc/FGManagerBDA.h b/src/apps/mplayerc/FGManagerBDA.h index 1ad9239fc..12804ffb3 100644 --- a/src/apps/mplayerc/FGManagerBDA.h +++ b/src/apps/mplayerc/FGManagerBDA.h @@ -34,8 +34,7 @@ class CDVBStream {
public :
CDVBStream() :
- m_ulMappedPID(0)
- {
+ m_ulMappedPID(0) {
}
CDVBStream(LPWSTR strName, const AM_MEDIA_TYPE * pmt, bool bFindExisting = false, MEDIA_SAMPLE_CONTENT nMsc=MEDIA_ELEMENTARY_STREAM) :
@@ -46,54 +45,45 @@ public : m_ulMappedPID(0)
{}
- LPWSTR GetName() /*const*/
- {
+ LPWSTR GetName() { /*const*/
return m_Name;
};
- const AM_MEDIA_TYPE* GetMediaType() /*const*/
- {
+ const AM_MEDIA_TYPE* GetMediaType() { /*const*/
return m_pmt;
};
- bool GetFindExisting() const
- {
+ bool GetFindExisting() const {
return m_bFindExisting;
};
- IBaseFilter* GetFilter()
- {
+ IBaseFilter* GetFilter() {
return m_pFilter;
};
- void SetPin(IPin* pPin)
- {
+ void SetPin(IPin* pPin) {
CComPtr<IPin> pPinOut;
PIN_INFO PinInfo;
m_pMap = pPin;
if (m_pMap &&
SUCCEEDED (pPin->ConnectedTo (&pPinOut)) &&
- SUCCEEDED (pPinOut->QueryPinInfo (&PinInfo)))
- {
+ SUCCEEDED (pPinOut->QueryPinInfo (&PinInfo))) {
m_pFilter.Attach (PinInfo.pFilter);
}
}
- HRESULT Map (ULONG ulPID)
- {
+ HRESULT Map (ULONG ulPID) {
CheckPointer (m_pMap, E_UNEXPECTED);
ClearMaps();
m_ulMappedPID = ulPID;
return m_pMap->MapPID (1, &ulPID, m_nMsc);
}
- HRESULT Unmap (ULONG ulPID)
- {
+ HRESULT Unmap (ULONG ulPID) {
CheckPointer (m_pMap, E_UNEXPECTED);
m_ulMappedPID = 0;
return m_pMap->UnmapPID (1, &ulPID);
}
- ULONG GetMappedPID() const
- {
+ ULONG GetMappedPID() const {
return m_ulMappedPID;
}
@@ -106,20 +96,16 @@ private : MEDIA_SAMPLE_CONTENT m_nMsc;
ULONG m_ulMappedPID;
- void ClearMaps()
- {
+ void ClearMaps() {
HRESULT hr;
CComPtr<IEnumPIDMap> pEnumMap;
- if (SUCCEEDED(hr = m_pMap->EnumPIDMap(&pEnumMap)))
- {
+ if (SUCCEEDED(hr = m_pMap->EnumPIDMap(&pEnumMap))) {
PID_MAP maps[8];
ULONG nbPids = 0;
- if (pEnumMap->Next(_countof(maps), maps, &nbPids)==S_OK)
- {
- for (ULONG i=0; i<nbPids; i++)
- {
+ if (pEnumMap->Next(_countof(maps), maps, &nbPids)==S_OK) {
+ for (ULONG i=0; i<nbPids; i++) {
ULONG pid = maps[i].ulPID;
m_pMap->UnmapPID(1, &pid);
@@ -179,13 +165,11 @@ private : FILTER_STATE GetState();
template <class ITF>
- HRESULT SearchIBDATopology(const CComPtr<IBaseFilter> & pTuner, CComPtr<ITF> & pItf)
- {
+ HRESULT SearchIBDATopology(const CComPtr<IBaseFilter> & pTuner, CComPtr<ITF> & pItf) {
CComPtr<IUnknown> pUnk;
HRESULT hr = SearchIBDATopology(pTuner, __uuidof(ITF), pUnk);
- if (SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
hr = pUnk.QueryInterface(&pItf);
}
return !pItf ? E_NOINTERFACE : hr;
@@ -193,10 +177,11 @@ private : HRESULT SearchIBDATopology(const CComPtr<IBaseFilter>& pTuner, REFIID iid, CComPtr<IUnknown>& pUnk);
- void Sleep(unsigned int mseconds)
- {
+ void Sleep(unsigned int mseconds) {
clock_t goal = mseconds + clock();
- while (goal > clock());
+ while (goal > clock()) {
+ ;
+ }
}
};
@@ -207,12 +192,11 @@ static void LOG(LPCTSTR fmt, ...) {
va_list args;
va_start(args, fmt);
-// int nCount = _vsctprintf(fmt, args) + 1;
+ // int nCount = _vsctprintf(fmt, args) + 1;
TCHAR buff[3000];
FILE* f;
_vstprintf_s(buff, countof(buff), fmt, args);
- if(_tfopen_s(&f, LOG_FILE, _T("at")) == 0)
- {
+ if(_tfopen_s(&f, LOG_FILE, _T("at")) == 0) {
fseek(f, 0, 2);
_ftprintf(f, _T("%s\n"), buff);
fclose(f);
diff --git a/src/apps/mplayerc/FakeFilterMapper2.cpp b/src/apps/mplayerc/FakeFilterMapper2.cpp index 2c9c43bba..daafea342 100644 --- a/src/apps/mplayerc/FakeFilterMapper2.cpp +++ b/src/apps/mplayerc/FakeFilterMapper2.cpp @@ -228,34 +228,28 @@ LONG (WINAPI * Real_RegSetValueA)(HKEY a0, LPCSTR a1, DWORD a2, LPCSTR a3, DWORD HRESULT WINAPI Mine_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter,
IN DWORD dwClsContext, IN REFIID riid, OUT LPVOID FAR* ppv)
{
- if(CFilterMapper2::m_pFilterMapper2)
- {
+ if(CFilterMapper2::m_pFilterMapper2) {
CheckPointer(ppv, E_POINTER);
- if(rclsid == CLSID_FilterMapper)
- {
+ if(rclsid == CLSID_FilterMapper) {
ASSERT(0);
return REGDB_E_CLASSNOTREG; // sorry...
}
- if(rclsid == CLSID_FilterMapper2)
- {
- if(pUnkOuter) return CLASS_E_NOAGGREGATION;
+ if(rclsid == CLSID_FilterMapper2) {
+ if(pUnkOuter) {
+ return CLASS_E_NOAGGREGATION;
+ }
- if(riid == __uuidof(IUnknown))
- {
+ if(riid == __uuidof(IUnknown)) {
CFilterMapper2::m_pFilterMapper2->AddRef();
*ppv = (IUnknown*)CFilterMapper2::m_pFilterMapper2;
return S_OK;
- }
- else if(riid == __uuidof(IFilterMapper2))
- {
+ } else if(riid == __uuidof(IFilterMapper2)) {
CFilterMapper2::m_pFilterMapper2->AddRef();
*ppv = (IFilterMapper2*)CFilterMapper2::m_pFilterMapper2;
return S_OK;
- }
- else
- {
+ } else {
return E_NOINTERFACE;
}
}
@@ -273,14 +267,12 @@ HRESULT WINAPI Mine_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter, if(!pUnkOuter)
if(rclsid == CLSID_VideoMixingRenderer || rclsid == CLSID_VideoMixingRenderer9
|| rclsid == CLSID_VideoRenderer || rclsid == CLSID_VideoRendererDefault
- || rclsid == CLSID_OverlayMixer)// || rclsid == CLSID_OverlayMixer2 - where is this declared?)
- {
+ || rclsid == CLSID_OverlayMixer) { // || rclsid == CLSID_OverlayMixer2 - where is this declared?)
CMacrovisionKicker* pMK = DNew CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL);
CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK;
CComPtr<IUnknown> pInner;
HRESULT hr;
- if(SUCCEEDED(hr = Real_CoCreateInstance(rclsid, pUnk, dwClsContext, __uuidof(IUnknown), (void**)&pInner)))
- {
+ if(SUCCEEDED(hr = Real_CoCreateInstance(rclsid, pUnk, dwClsContext, __uuidof(IUnknown), (void**)&pInner))) {
pMK->SetInner(pInner);
return pUnk->QueryInterface(riid, ppv);
}
@@ -293,24 +285,21 @@ HRESULT WINAPI Mine_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter, LONG WINAPI Mine_RegCloseKey(HKEY a0)
{
- if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY)
- {
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {
return ERROR_SUCCESS;
}
return Real_RegCloseKey(a0);
}
LONG WINAPI Mine_RegFlushKey(HKEY a0)
{
- if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY)
- {
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {
return ERROR_SUCCESS;
}
return Real_RegFlushKey(a0);
}
LONG WINAPI Mine_RegCreateKeyA(HKEY a0, LPCSTR a1, PHKEY a2)
{
- if(CFilterMapper2::m_pFilterMapper2)
- {
+ if(CFilterMapper2::m_pFilterMapper2) {
*a2 = FAKEHKEY;
return ERROR_SUCCESS;
}
@@ -318,8 +307,7 @@ LONG WINAPI Mine_RegCreateKeyA(HKEY a0, LPCSTR a1, PHKEY a2) }
LONG WINAPI Mine_RegCreateKeyW(HKEY a0, LPCWSTR a1, PHKEY a2)
{
- if(CFilterMapper2::m_pFilterMapper2)
- {
+ if(CFilterMapper2::m_pFilterMapper2) {
*a2 = FAKEHKEY;
return ERROR_SUCCESS;
}
@@ -327,8 +315,7 @@ LONG WINAPI Mine_RegCreateKeyW(HKEY a0, LPCWSTR a1, PHKEY a2) }
LONG WINAPI Mine_RegCreateKeyExA(HKEY a0, LPCSTR a1, DWORD a2, LPSTR a3, DWORD a4, REGSAM a5, LPSECURITY_ATTRIBUTES a6, PHKEY a7, LPDWORD a8)
{
- if(CFilterMapper2::m_pFilterMapper2)
- {
+ if(CFilterMapper2::m_pFilterMapper2) {
*a7 = FAKEHKEY;
return ERROR_SUCCESS;
}
@@ -336,8 +323,7 @@ LONG WINAPI Mine_RegCreateKeyExA(HKEY a0, LPCSTR a1, DWORD a2, LPSTR a3, DWORD a }
LONG WINAPI Mine_RegCreateKeyExW(HKEY a0, LPCWSTR a1, DWORD a2, LPWSTR a3, DWORD a4, REGSAM a5, LPSECURITY_ATTRIBUTES a6, PHKEY a7, LPDWORD a8)
{
- if(CFilterMapper2::m_pFilterMapper2)
- {
+ if(CFilterMapper2::m_pFilterMapper2) {
*a7 = FAKEHKEY;
return ERROR_SUCCESS;
}
@@ -345,72 +331,63 @@ LONG WINAPI Mine_RegCreateKeyExW(HKEY a0, LPCWSTR a1, DWORD a2, LPWSTR a3, DWORD }
LONG WINAPI Mine_RegDeleteKeyA(HKEY a0, LPCSTR a1)
{
- if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0))
- {
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {
return ERROR_SUCCESS;
}
return Real_RegDeleteKeyA(a0, a1);
}
LONG WINAPI Mine_RegDeleteKeyW(HKEY a0, LPCWSTR a1)
{
- if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0))
- {
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {
return ERROR_SUCCESS;
}
return Real_RegDeleteKeyW(a0, a1);
}
LONG WINAPI Mine_RegDeleteValueA(HKEY a0, LPCSTR a1)
{
- if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0))
- {
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {
return ERROR_SUCCESS;
}
return Real_RegDeleteValueA(a0, a1);
}
LONG WINAPI Mine_RegDeleteValueW(HKEY a0, LPCWSTR a1)
{
- if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0))
- {
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {
return ERROR_SUCCESS;
}
return Real_RegDeleteValueW(a0, a1);
}
LONG WINAPI Mine_RegEnumKeyExA(HKEY a0, DWORD a1, LPSTR a2, LPDWORD a3, LPDWORD a4, LPSTR a5, LPDWORD a6, struct _FILETIME* a7)
{
- if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY)
- {
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {
return ERROR_NO_MORE_ITEMS;
}
return Real_RegEnumKeyExA(a0, a1, a2, a3, a4, a5, a6, a7);
}
LONG WINAPI Mine_RegEnumKeyExW(HKEY a0, DWORD a1, LPWSTR a2, LPDWORD a3, LPDWORD a4, LPWSTR a5, LPDWORD a6, struct _FILETIME* a7)
{
- if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY)
- {
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {
return ERROR_NO_MORE_ITEMS;
}
return Real_RegEnumKeyExW(a0, a1, a2, a3, a4, a5, a6, a7);
}
LONG WINAPI Mine_RegEnumValueA(HKEY a0, DWORD a1, LPSTR a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPBYTE a6, LPDWORD a7)
{
- if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY)
- {
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {
return ERROR_NO_MORE_ITEMS;
}
return Real_RegEnumValueA(a0, a1, a2, a3, a4, a5, a6, a7);
}
LONG WINAPI Mine_RegEnumValueW(HKEY a0, DWORD a1, LPWSTR a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPBYTE a6, LPDWORD a7)
{
- if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY)
- {
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {
return ERROR_NO_MORE_ITEMS;
}
return Real_RegEnumValueW(a0, a1, a2, a3, a4, a5, a6, a7);
}
LONG WINAPI Mine_RegOpenKeyA(HKEY a0, LPCSTR a1, PHKEY a2)
{
- if(CFilterMapper2::m_pFilterMapper2)
- {
+ if(CFilterMapper2::m_pFilterMapper2) {
*a2 = FAKEHKEY;
return ERROR_SUCCESS;
}
@@ -418,8 +395,7 @@ LONG WINAPI Mine_RegOpenKeyA(HKEY a0, LPCSTR a1, PHKEY a2) }
LONG WINAPI Mine_RegOpenKeyW(HKEY a0, LPCWSTR a1, PHKEY a2)
{
- if(CFilterMapper2::m_pFilterMapper2)
- {
+ if(CFilterMapper2::m_pFilterMapper2) {
*a2 = FAKEHKEY;
return ERROR_SUCCESS;
}
@@ -427,8 +403,7 @@ LONG WINAPI Mine_RegOpenKeyW(HKEY a0, LPCWSTR a1, PHKEY a2) }
LONG WINAPI Mine_RegOpenKeyExA(HKEY a0, LPCSTR a1, DWORD a2, REGSAM a3, PHKEY a4)
{
- if(CFilterMapper2::m_pFilterMapper2 && (a3&(KEY_SET_VALUE|KEY_CREATE_SUB_KEY)))
- {
+ if(CFilterMapper2::m_pFilterMapper2 && (a3&(KEY_SET_VALUE|KEY_CREATE_SUB_KEY))) {
*a4 = FAKEHKEY;
return ERROR_SUCCESS;
}
@@ -436,8 +411,7 @@ LONG WINAPI Mine_RegOpenKeyExA(HKEY a0, LPCSTR a1, DWORD a2, REGSAM a3, PHKEY a4 }
LONG WINAPI Mine_RegOpenKeyExW(HKEY a0, LPCWSTR a1, DWORD a2, REGSAM a3, PHKEY a4)
{
- if(CFilterMapper2::m_pFilterMapper2 && (a3&(KEY_SET_VALUE|KEY_CREATE_SUB_KEY)))
- {
+ if(CFilterMapper2::m_pFilterMapper2 && (a3&(KEY_SET_VALUE|KEY_CREATE_SUB_KEY))) {
*a4 = FAKEHKEY;
return ERROR_SUCCESS;
}
@@ -445,24 +419,21 @@ LONG WINAPI Mine_RegOpenKeyExW(HKEY a0, LPCWSTR a1, DWORD a2, REGSAM a3, PHKEY a }
LONG WINAPI Mine_RegQueryInfoKeyA(HKEY a0, LPSTR a1, LPDWORD a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPDWORD a6, LPDWORD a7, LPDWORD a8, LPDWORD a9, LPDWORD a10, struct _FILETIME* a11)
{
- if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY)
- {
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {
return ERROR_INVALID_HANDLE;
}
return Real_RegQueryInfoKeyA(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
}
LONG WINAPI Mine_RegQueryInfoKeyW(HKEY a0, LPWSTR a1, LPDWORD a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPDWORD a6, LPDWORD a7, LPDWORD a8, LPDWORD a9, LPDWORD a10, struct _FILETIME* a11)
{
- if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY)
- {
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {
return ERROR_INVALID_HANDLE;
}
return Real_RegQueryInfoKeyW(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
}
LONG WINAPI Mine_RegQueryValueA(HKEY a0, LPCSTR a1, LPSTR a2, PLONG a3)
{
- if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY)
- {
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {
*a3 = 0;
return ERROR_SUCCESS;
}
@@ -470,8 +441,7 @@ LONG WINAPI Mine_RegQueryValueA(HKEY a0, LPCSTR a1, LPSTR a2, PLONG a3) }
LONG WINAPI Mine_RegQueryValueW(HKEY a0, LPCWSTR a1, LPWSTR a2, PLONG a3)
{
- if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY)
- {
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {
*a3 = 0;
return ERROR_SUCCESS;
}
@@ -479,8 +449,7 @@ LONG WINAPI Mine_RegQueryValueW(HKEY a0, LPCWSTR a1, LPWSTR a2, PLONG a3) }
LONG WINAPI Mine_RegQueryValueExA(HKEY a0, LPCSTR a1, LPDWORD a2, LPDWORD a3, LPBYTE a4, LPDWORD a5)
{
- if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY)
- {
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {
*a5 = 0;
return ERROR_SUCCESS;
}
@@ -488,8 +457,7 @@ LONG WINAPI Mine_RegQueryValueExA(HKEY a0, LPCSTR a1, LPDWORD a2, LPDWORD a3, LP }
LONG WINAPI Mine_RegQueryValueExW(HKEY a0, LPCWSTR a1, LPDWORD a2, LPDWORD a3, LPBYTE a4, LPDWORD a5)
{
- if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY)
- {
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {
*a5 = 0;
return ERROR_SUCCESS;
}
@@ -497,32 +465,28 @@ LONG WINAPI Mine_RegQueryValueExW(HKEY a0, LPCWSTR a1, LPDWORD a2, LPDWORD a3, L }
LONG WINAPI Mine_RegSetValueA(HKEY a0, LPCSTR a1, DWORD a2, LPCSTR a3, DWORD a4)
{
- if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0))
- {
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {
return ERROR_SUCCESS;
}
return Real_RegSetValueA(a0, a1, a2, a3, a4);
}
LONG WINAPI Mine_RegSetValueW(HKEY a0, LPCWSTR a1, DWORD a2, LPCWSTR a3, DWORD a4)
{
- if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0))
- {
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {
return ERROR_SUCCESS;
}
return Real_RegSetValueW(a0, a1, a2, a3, a4);
}
LONG WINAPI Mine_RegSetValueExA(HKEY a0, LPCSTR a1, DWORD a2, DWORD a3, BYTE* a4, DWORD a5)
{
- if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0))
- {
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {
return ERROR_SUCCESS;
}
return Real_RegSetValueExA(a0, a1, a2, a3, a4, a5);
}
LONG WINAPI Mine_RegSetValueExW(HKEY a0, LPCWSTR a1, DWORD a2, DWORD a3, BYTE* a4, DWORD a5)
{
- if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0))
- {
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {
return ERROR_SUCCESS;
}
return Real_RegSetValueExW(a0, a1, a2, a3, a4, a5);
@@ -538,8 +502,7 @@ bool CFilterMapper2::fInitialized = false; void CFilterMapper2::Init()
{
- if(!fInitialized)
- {
+ if(!fInitialized) {
DetourAttach(&(PVOID&)Real_CoCreateInstance, (PVOID)Mine_CoCreateInstance);
DetourAttach(&(PVOID&)Real_RegCloseKey, (PVOID)Mine_RegCloseKey);
DetourAttach(&(PVOID&)Real_RegFlushKey, (PVOID)Mine_RegFlushKey);
@@ -585,8 +548,7 @@ CFilterMapper2::CFilterMapper2(bool fRefCounted, bool fAllowUnreg, LPUNKNOWN pUn HRESULT hr = Real_CoCreateInstance(
CLSID_FilterMapper2, (IUnknown*)(INonDelegatingUnknown*)this, CLSCTX_ALL,
__uuidof(IUnknown), (void**)&m_pFM2);
- if(FAILED(hr) || !m_pFM2)
- {
+ if(FAILED(hr) || !m_pFM2) {
ASSERT(0);
return;
}
@@ -595,13 +557,16 @@ CFilterMapper2::CFilterMapper2(bool fRefCounted, bool fAllowUnreg, LPUNKNOWN pUn CFilterMapper2::~CFilterMapper2()
{
POSITION pos = m_filters.GetHeadPosition();
- while(pos) delete m_filters.GetNext(pos);
+ while(pos) {
+ delete m_filters.GetNext(pos);
+ }
}
STDMETHODIMP CFilterMapper2::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- if(riid == __uuidof(IFilterMapper2))
+ if(riid == __uuidof(IFilterMapper2)) {
return GetInterface((IFilterMapper2*)this, ppv);
+ }
HRESULT hr = m_pFM2 ? m_pFM2->QueryInterface(riid, ppv) : E_NOINTERFACE;
@@ -612,11 +577,9 @@ STDMETHODIMP CFilterMapper2::NonDelegatingQueryInterface(REFIID riid, void** ppv void CFilterMapper2::Register(CString path)
{
- if(HMODULE h = LoadLibrary(path))
- {
+ if(HMODULE h = LoadLibrary(path)) {
typedef HRESULT (__stdcall * PDllRegisterServer)();
- if(PDllRegisterServer p = (PDllRegisterServer)GetProcAddress(h, "DllRegisterServer"))
- {
+ if(PDllRegisterServer p = (PDllRegisterServer)GetProcAddress(h, "DllRegisterServer")) {
ASSERT(CFilterMapper2::m_pFilterMapper2 == NULL);
CFilterMapper2::m_pFilterMapper2 = this;
@@ -634,12 +597,9 @@ void CFilterMapper2::Register(CString path) STDMETHODIMP CFilterMapper2::CreateCategory(REFCLSID clsidCategory, DWORD dwCategoryMerit, LPCWSTR Description)
{
- if(!m_path.IsEmpty())
- {
+ if(!m_path.IsEmpty()) {
return S_OK;
- }
- else if(CComQIPtr<IFilterMapper2> pFM2 = m_pFM2)
- {
+ } else if(CComQIPtr<IFilterMapper2> pFM2 = m_pFM2) {
return pFM2->CreateCategory(clsidCategory, dwCategoryMerit, Description);
}
@@ -648,12 +608,9 @@ STDMETHODIMP CFilterMapper2::CreateCategory(REFCLSID clsidCategory, DWORD dwCate STDMETHODIMP CFilterMapper2::UnregisterFilter(const CLSID* pclsidCategory, const OLECHAR* szInstance, REFCLSID Filter)
{
- if(!m_path.IsEmpty())
- {
+ if(!m_path.IsEmpty()) {
return S_OK;
- }
- else if(CComQIPtr<IFilterMapper2> pFM2 = m_pFM2)
- {
+ } else if(CComQIPtr<IFilterMapper2> pFM2 = m_pFM2) {
return m_fAllowUnreg
? pFM2->UnregisterFilter(pclsidCategory, szInstance, Filter)
: S_OK;
@@ -664,10 +621,8 @@ STDMETHODIMP CFilterMapper2::UnregisterFilter(const CLSID* pclsidCategory, const STDMETHODIMP CFilterMapper2::RegisterFilter(REFCLSID clsidFilter, LPCWSTR Name, IMoniker** ppMoniker, const CLSID* pclsidCategory, const OLECHAR* szInstance, const REGFILTER2* prf2)
{
- if(!m_path.IsEmpty())
- {
- if(FilterOverride* f = DNew FilterOverride)
- {
+ if(!m_path.IsEmpty()) {
+ if(FilterOverride* f = DNew FilterOverride) {
f->fDisabled = false;
f->type = FilterOverride::EXTERNAL;
f->path = m_path;
@@ -676,31 +631,32 @@ STDMETHODIMP CFilterMapper2::RegisterFilter(REFCLSID clsidFilter, LPCWSTR Name, f->iLoadType = FilterOverride::MERIT;
f->dwMerit = prf2->dwMerit;
- if(prf2->dwVersion == 1)
- {
- for(ULONG i = 0; i < prf2->cPins; i++)
- {
+ if(prf2->dwVersion == 1) {
+ for(ULONG i = 0; i < prf2->cPins; i++) {
const REGFILTERPINS& rgPin = prf2->rgPins[i];
- if(rgPin.bOutput) continue;
+ if(rgPin.bOutput) {
+ continue;
+ }
- for(UINT i = 0; i < rgPin.nMediaTypes; i++)
- {
- if(!rgPin.lpMediaType[i].clsMajorType || !rgPin.lpMediaType[i].clsMinorType) break;
+ for(UINT i = 0; i < rgPin.nMediaTypes; i++) {
+ if(!rgPin.lpMediaType[i].clsMajorType || !rgPin.lpMediaType[i].clsMinorType) {
+ break;
+ }
f->guids.AddTail(*rgPin.lpMediaType[i].clsMajorType);
f->guids.AddTail(*rgPin.lpMediaType[i].clsMinorType);
}
}
- }
- else if(prf2->dwVersion == 2)
- {
- for(ULONG i = 0; i < prf2->cPins2; i++)
- {
+ } else if(prf2->dwVersion == 2) {
+ for(ULONG i = 0; i < prf2->cPins2; i++) {
const REGFILTERPINS2& rgPin = prf2->rgPins2[i];
- if(rgPin.dwFlags®_PINFLAG_B_OUTPUT) continue;
+ if(rgPin.dwFlags®_PINFLAG_B_OUTPUT) {
+ continue;
+ }
- for(UINT i = 0; i < rgPin.nMediaTypes; i++)
- {
- if(!rgPin.lpMediaType[i].clsMajorType || !rgPin.lpMediaType[i].clsMinorType) break;
+ for(UINT i = 0; i < rgPin.nMediaTypes; i++) {
+ if(!rgPin.lpMediaType[i].clsMajorType || !rgPin.lpMediaType[i].clsMinorType) {
+ break;
+ }
f->guids.AddTail(*rgPin.lpMediaType[i].clsMajorType);
f->guids.AddTail(*rgPin.lpMediaType[i].clsMinorType);
}
@@ -713,9 +669,7 @@ STDMETHODIMP CFilterMapper2::RegisterFilter(REFCLSID clsidFilter, LPCWSTR Name, }
return S_OK;
- }
- else if(CComQIPtr<IFilterMapper2> pFM2 = m_pFM2)
- {
+ } else if(CComQIPtr<IFilterMapper2> pFM2 = m_pFM2) {
return pFM2->RegisterFilter(clsidFilter, Name, ppMoniker, pclsidCategory, szInstance, prf2);
}
@@ -726,8 +680,7 @@ STDMETHODIMP CFilterMapper2::EnumMatchingFilters(IEnumMoniker** ppEnum, DWORD dw BOOL bInputNeeded, DWORD cInputTypes, const GUID* pInputTypes, const REGPINMEDIUM* pMedIn, const CLSID* pPinCategoryIn, BOOL bRender,
BOOL bOutputNeeded, DWORD cOutputTypes, const GUID* pOutputTypes, const REGPINMEDIUM* pMedOut, const CLSID* pPinCategoryOut)
{
- if(CComQIPtr<IFilterMapper2> pFM2 = m_pFM2)
- {
+ if(CComQIPtr<IFilterMapper2> pFM2 = m_pFM2) {
pFM2->EnumMatchingFilters(ppEnum, dwFlags, bExactMatch, dwMerit,
bInputNeeded, cInputTypes, pInputTypes, pMedIn, pPinCategoryIn, bRender,
bOutputNeeded, cOutputTypes, pOutputTypes, pMedOut, pPinCategoryOut);
diff --git a/src/apps/mplayerc/FakeFilterMapper2.h b/src/apps/mplayerc/FakeFilterMapper2.h index d68d4b7c1..2d7b39610 100644 --- a/src/apps/mplayerc/FakeFilterMapper2.h +++ b/src/apps/mplayerc/FakeFilterMapper2.h @@ -42,12 +42,10 @@ public: int iLoadType;
DWORD dwMerit;
- FilterOverride()
- {
+ FilterOverride() {
fTemporary = false;
}
- FilterOverride(FilterOverride* f)
- {
+ FilterOverride(FilterOverride* f) {
fDisabled = f->fDisabled;
fTemporary = f->fTemporary;
type = f->type;
@@ -120,8 +118,7 @@ public: CFilterMapper2(bool fRefCounted, bool fAllowUnreg = false, LPUNKNOWN pUnkOuter = NULL);
virtual ~CFilterMapper2();
- void SetInner(IUnknown* pUnk)
- {
+ void SetInner(IUnknown* pUnk) {
m_pFM2 = pUnk;
}
diff --git a/src/apps/mplayerc/FavoriteAddDlg.cpp b/src/apps/mplayerc/FavoriteAddDlg.cpp index 013c9d7d5..32afdf363 100644 --- a/src/apps/mplayerc/FavoriteAddDlg.cpp +++ b/src/apps/mplayerc/FavoriteAddDlg.cpp @@ -56,11 +56,13 @@ BOOL CFavoriteAddDlg::OnInitDialog() {
__super::OnInitDialog();
- if ( !m_shortname.IsEmpty() )
+ if ( !m_shortname.IsEmpty() ) {
m_namectrl.AddString( m_shortname );
+ }
- if ( !m_fullname.IsEmpty() )
+ if ( !m_fullname.IsEmpty() ) {
m_namectrl.AddString( m_fullname );
+ }
::CorrectComboListWidth( m_namectrl, GetFont() );
diff --git a/src/apps/mplayerc/FavoriteAddDlg.h b/src/apps/mplayerc/FavoriteAddDlg.h index 4aa2ea809..619d64ff1 100644 --- a/src/apps/mplayerc/FavoriteAddDlg.h +++ b/src/apps/mplayerc/FavoriteAddDlg.h @@ -36,7 +36,7 @@ public: CFavoriteAddDlg(CString shortname, CString fullname, CWnd* pParent = NULL); // standard constructor
virtual ~CFavoriteAddDlg();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_FAVADD };
CComboBox m_namectrl;
diff --git a/src/apps/mplayerc/FavoriteOrganizeDlg.cpp b/src/apps/mplayerc/FavoriteOrganizeDlg.cpp index da8f07741..ca83c1315 100644 --- a/src/apps/mplayerc/FavoriteOrganizeDlg.cpp +++ b/src/apps/mplayerc/FavoriteOrganizeDlg.cpp @@ -42,12 +42,10 @@ void CFavoriteOrganizeDlg::SetupList(bool fSave) {
int i = m_tab.GetCurSel();
- if(fSave)
- {
+ if(fSave) {
CAtlList<CString> sl;
- for(int j = 0; j < m_list.GetItemCount(); j++)
- {
+ for(int j = 0; j < m_list.GetItemCount(); j++) {
CString desc = m_list.GetItemText(j, 0);
desc.Remove(';');
CString str = m_sl[i].GetAt((POSITION)m_list.GetItemData(j));
@@ -56,18 +54,17 @@ void CFavoriteOrganizeDlg::SetupList(bool fSave) m_sl[i].RemoveAll();
m_sl[i].AddTailList(&sl);
- }
- else
- {
+ } else {
m_list.DeleteAllItems();
POSITION pos = m_sl[i].GetHeadPosition(), tmp;
- while(pos)
- {
+ while(pos) {
tmp = pos;
CString s = m_sl[i].GetNext(pos);
int i = s.Find(';');
- if(i >= 0) s = s.Left(i);
+ if(i >= 0) {
+ s = s.Left(i);
+ }
m_list.SetItemData(m_list.InsertItem(m_list.GetItemCount(), s), (DWORD_PTR)tmp);
}
@@ -113,7 +110,7 @@ BOOL CFavoriteOrganizeDlg::OnInitDialog() m_tab.InsertItem(0, ResStr(IDS_FAVFILES));
m_tab.InsertItem(1, ResStr(IDS_FAVDVDS));
-// m_tab.InsertItem(2, ResStr(IDS_FAVDEVICES));
+ // m_tab.InsertItem(2, ResStr(IDS_FAVDEVICES));
m_tab.SetCurSel(0);
m_list.InsertColumn(0, _T(""));
@@ -148,20 +145,19 @@ void CFavoriteOrganizeDlg::OnTcnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult) void CFavoriteOrganizeDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
- if(nIDCtl != IDC_LIST2) return;
+ if(nIDCtl != IDC_LIST2) {
+ return;
+ }
int nItem = lpDrawItemStruct->itemID;
CRect rcItem = lpDrawItemStruct->rcItem;
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
- if(!!m_list.GetItemState(nItem, LVIS_SELECTED))
- {
+ if(!!m_list.GetItemState(nItem, LVIS_SELECTED)) {
FillRect(pDC->m_hDC, rcItem, CBrush(0xf1dacc));
FrameRect(pDC->m_hDC, rcItem, CBrush(0xc56a31));
- }
- else
- {
+ } else {
CBrush b;
b.CreateSysColorBrush(COLOR_WINDOW);
FillRect(pDC->m_hDC, rcItem, b);
@@ -175,8 +171,7 @@ void CFavoriteOrganizeDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStr void CFavoriteOrganizeDlg::OnBnClickedButton1()
{
- if(POSITION pos = m_list.GetFirstSelectedItemPosition())
- {
+ if(POSITION pos = m_list.GetFirstSelectedItemPosition()) {
m_list.SetFocus();
m_list.EditLabel(m_list.GetNextSelectedItem(pos));
}
@@ -185,17 +180,19 @@ void CFavoriteOrganizeDlg::OnBnClickedButton1() void CFavoriteOrganizeDlg::OnLvnEndlabeleditList2(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLVDISPINFO* pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
- if(pDispInfo->item.iItem >= 0 && pDispInfo->item.pszText)
+ if(pDispInfo->item.iItem >= 0 && pDispInfo->item.pszText) {
m_list.SetItemText(pDispInfo->item.iItem, 0, pDispInfo->item.pszText);
+ }
*pResult = 0;
}
void CFavoriteOrganizeDlg::OnBnClickedButton2()
{
- if(POSITION pos = m_list.GetFirstSelectedItemPosition())
- {
+ if(POSITION pos = m_list.GetFirstSelectedItemPosition()) {
int nItem = m_list.GetNextSelectedItem(pos);
- if(nItem < 0 || nItem >= m_list.GetItemCount()) return;
+ if(nItem < 0 || nItem >= m_list.GetItemCount()) {
+ return;
+ }
m_list.DeleteItem(nItem);
@@ -208,10 +205,11 @@ void CFavoriteOrganizeDlg::OnBnClickedButton2() void CFavoriteOrganizeDlg::OnBnClickedButton3()
{
- if(POSITION pos = m_list.GetFirstSelectedItemPosition())
- {
+ if(POSITION pos = m_list.GetFirstSelectedItemPosition()) {
int nItem = m_list.GetNextSelectedItem(pos);
- if(nItem <= 0) return;
+ if(nItem <= 0) {
+ return;
+ }
DWORD_PTR data = m_list.GetItemData(nItem);
CString str = m_list.GetItemText(nItem, 0);
@@ -229,10 +227,11 @@ void CFavoriteOrganizeDlg::OnBnClickedButton3() void CFavoriteOrganizeDlg::OnBnClickedButton7()
{
- if(POSITION pos = m_list.GetFirstSelectedItemPosition())
- {
+ if(POSITION pos = m_list.GetFirstSelectedItemPosition()) {
int nItem = m_list.GetNextSelectedItem(pos);
- if(nItem < 0 || nItem >= m_list.GetItemCount()-1) return;
+ if(nItem < 0 || nItem >= m_list.GetItemCount()-1) {
+ return;
+ }
DWORD_PTR data = m_list.GetItemData(nItem);
CString str = m_list.GetItemText(nItem, 0);
@@ -270,14 +269,16 @@ void CFavoriteOrganizeDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimi {
__super::OnActivate(nState, pWndOther, bMinimized);
- if(nState == WA_ACTIVE)
+ if(nState == WA_ACTIVE) {
m_list.SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ }
}
void CFavoriteOrganizeDlg::OnSize(UINT nType, int cx, int cy)
{
__super::OnSize(nType, cx, cy);
- if(IsWindow(m_list))
+ if(IsWindow(m_list)) {
m_list.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
+ }
}
diff --git a/src/apps/mplayerc/FavoriteOrganizeDlg.h b/src/apps/mplayerc/FavoriteOrganizeDlg.h index e056cdc5c..a4898deac 100644 --- a/src/apps/mplayerc/FavoriteOrganizeDlg.h +++ b/src/apps/mplayerc/FavoriteOrganizeDlg.h @@ -32,7 +32,7 @@ class CFavoriteOrganizeDlg : public CResizableDialog
{
-// DECLARE_DYNAMIC(CFavoriteOrganizeDlg)
+ // DECLARE_DYNAMIC(CFavoriteOrganizeDlg)
private:
CAtlList<CString> m_sl[3];
@@ -42,7 +42,7 @@ public: CFavoriteOrganizeDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CFavoriteOrganizeDlg();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_FAVORGANIZE };
CTabCtrl m_tab;
diff --git a/src/apps/mplayerc/FileDropTarget.cpp b/src/apps/mplayerc/FileDropTarget.cpp index a1e9e8888..0dacf127f 100644 --- a/src/apps/mplayerc/FileDropTarget.cpp +++ b/src/apps/mplayerc/FileDropTarget.cpp @@ -61,7 +61,9 @@ DROPEFFECT CFileDropTarget::OnDropEx(CWnd* pWnd, COleDataObject* pDataObject, DR void CFileDropTarget::OnDragLeave(CWnd* pWnd)
{
- if(m_pDropTarget) m_pDropTarget->OnDragLeave();
+ if(m_pDropTarget) {
+ m_pDropTarget->OnDragLeave();
+ }
}
DROPEFFECT CFileDropTarget::OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point)
diff --git a/src/apps/mplayerc/FileDropTarget.h b/src/apps/mplayerc/FileDropTarget.h index 8021d4915..d94f88304 100644 --- a/src/apps/mplayerc/FileDropTarget.h +++ b/src/apps/mplayerc/FileDropTarget.h @@ -31,25 +31,20 @@ class CDropTarget public:
CDropTarget() {}
- virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
- {
+ virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) {
return DROPEFFECT_NONE;
}
- virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
- {
+ virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) {
return DROPEFFECT_NONE;
}
- virtual BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
- {
+ virtual BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point) {
return FALSE;
}
- virtual DROPEFFECT OnDropEx(COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point)
- {
+ virtual DROPEFFECT OnDropEx(COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point) {
return (DROPEFFECT)-1;
}
virtual void OnDragLeave() {}
- virtual DROPEFFECT OnDragScroll(DWORD dwKeyState, CPoint point)
- {
+ virtual DROPEFFECT OnDragScroll(DWORD dwKeyState, CPoint point) {
return DROPEFFECT_NONE;
}
};
@@ -58,7 +53,7 @@ public: class CFileDropTarget : public COleDropTarget
{
-// DECLARE_DYNAMIC(CFileDropTarget)
+ // DECLARE_DYNAMIC(CFileDropTarget)
private:
CDropTarget* m_pDropTarget;
diff --git a/src/apps/mplayerc/FilterEnum.h b/src/apps/mplayerc/FilterEnum.h index 542bbbd32..2cd5db2a2 100644 --- a/src/apps/mplayerc/FilterEnum.h +++ b/src/apps/mplayerc/FilterEnum.h @@ -24,16 +24,14 @@ #include "internal_filter_config.h"
-enum
-{
+enum {
SOURCE_FILTER,
DECODER,
DXVA_DECODER,
FFMPEG_DECODER
};
-enum SOURCE_FILTER
-{
+enum SOURCE_FILTER {
#if INTERNAL_SOURCEFILTER_CDDA
SRC_CDDA,
#endif
@@ -89,8 +87,7 @@ enum SOURCE_FILTER SRC_LAST
};
-enum DECODER
-{
+enum DECODER {
#if INTERNAL_DECODER_MPEG1
TRA_MPEG1,
#endif
@@ -137,8 +134,7 @@ enum DECODER TRA_LAST
};
-enum DXVA_DECODER
-{
+enum DXVA_DECODER {
#if INTERNAL_DECODER_H264_DXVA
TRA_DXVA_H264,
#endif
@@ -149,7 +145,7 @@ enum DXVA_DECODER TRA_DXVA_MPEG2,
#endif
TRA_DXVA_LAST,
-// dummy values (needed in FGManager.cpp)
+ // dummy values (needed in FGManager.cpp)
#if !INTERNAL_DECODER_H264_DXVA & INTERNAL_DECODER_H264
TRA_DXVA_H264,
#endif
@@ -158,8 +154,7 @@ enum DXVA_DECODER #endif
};
-enum FFMPEG_DECODER
-{
+enum FFMPEG_DECODER {
#if INTERNAL_DECODER_H264
FFM_H264,
#endif
@@ -200,7 +195,7 @@ enum FFMPEG_DECODER FFM_AMVV,
#endif
FFM_LAST,
-// dummy values (needed in FGManager.cpp)
+ // dummy values (needed in FGManager.cpp)
#if !INTERNAL_DECODER_H264 & INTERNAL_DECODER_H264_DXVA
FFM_H264,
#endif
diff --git a/src/apps/mplayerc/FloatEdit.cpp b/src/apps/mplayerc/FloatEdit.cpp index 4f4ca6326..b3dbedddc 100644 --- a/src/apps/mplayerc/FloatEdit.cpp +++ b/src/apps/mplayerc/FloatEdit.cpp @@ -58,20 +58,23 @@ END_MESSAGE_MAP() void CFloatEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
- if(!(nChar >= '0' && nChar <= '9' || nChar == '.' || nChar == '\b'))
+ if(!(nChar >= '0' && nChar <= '9' || nChar == '.' || nChar == '\b')) {
return;
+ }
CString str;
GetWindowText(str);
- if(nChar == '.' && (str.Find('.') >= 0 || str.IsEmpty()))
+ if(nChar == '.' && (str.Find('.') >= 0 || str.IsEmpty())) {
return;
+ }
int nStartChar, nEndChar;
GetSel(nStartChar, nEndChar);
- if(nChar == '\b' && nStartChar <= 0)
+ if(nChar == '\b' && nStartChar <= 0) {
return;
+ }
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
@@ -86,23 +89,27 @@ END_MESSAGE_MAP() void CIntEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
- if(!(nChar >= '0' && nChar <= '9' || nChar == '-' || nChar == '\b'))
+ if(!(nChar >= '0' && nChar <= '9' || nChar == '-' || nChar == '\b')) {
return;
+ }
CString str;
GetWindowText(str);
- if(nChar == '-' && !str.IsEmpty() && str[0] == '-')
+ if(nChar == '-' && !str.IsEmpty() && str[0] == '-') {
return;
+ }
int nStartChar, nEndChar;
GetSel(nStartChar, nEndChar);
- if(nChar == '\b' && nStartChar <= 0)
+ if(nChar == '\b' && nStartChar <= 0) {
return;
+ }
- if(nChar == '-' && (nStartChar != 0 || nEndChar != 0))
+ if(nChar == '-' && (nStartChar != 0 || nEndChar != 0)) {
return;
+ }
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
@@ -141,8 +148,9 @@ END_MESSAGE_MAP() void CHexEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(!(nChar >= 'A' && nChar <= 'F' || nChar >= 'a' && nChar <= 'f'
- || nChar >= '0' && nChar <= '9' || nChar == '\b'))
+ || nChar >= '0' && nChar <= '9' || nChar == '\b')) {
return;
+ }
CString str;
GetWindowText(str);
@@ -150,11 +158,13 @@ void CHexEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) int nStartChar, nEndChar;
GetSel(nStartChar, nEndChar);
- if(nChar == '\b' && nStartChar <= 0)
+ if(nChar == '\b' && nStartChar <= 0) {
return;
+ }
- if(nChar != '\b' && nEndChar - nStartChar == 0 && str.GetLength() >= 8)
+ if(nChar != '\b' && nEndChar - nStartChar == 0 && str.GetLength() >= 8) {
return;
+ }
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
diff --git a/src/apps/mplayerc/FullscreenWnd.cpp b/src/apps/mplayerc/FullscreenWnd.cpp index 2405458d5..7127a4924 100644 --- a/src/apps/mplayerc/FullscreenWnd.cpp +++ b/src/apps/mplayerc/FullscreenWnd.cpp @@ -50,43 +50,41 @@ END_MESSAGE_MAP() LRESULT CFullscreenWnd::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
- switch (message)
- {
- case WM_COMMAND :
- m_pMainFrame->PostMessage(message, wParam, lParam);
- break;
+ switch (message) {
+ case WM_COMMAND :
+ m_pMainFrame->PostMessage(message, wParam, lParam);
+ break;
}
return CWnd::WindowProc(message, wParam, lParam);
}
BOOL CFullscreenWnd::PreTranslateMessage(MSG* pMsg)
{
- switch (pMsg->message)
- {
- case WM_MOUSEMOVE :
- case WM_SYSKEYDOWN :
- case WM_SYSKEYUP :
- case WM_SYSCHAR :
- case WM_SYSCOMMAND :
-
- case WM_KEYDOWN :
- case WM_KEYUP :
- case WM_CHAR :
-
- case WM_LBUTTONDOWN :
- case WM_LBUTTONUP :
- case WM_LBUTTONDBLCLK :
- case WM_MBUTTONDOWN :
- case WM_MBUTTONUP :
- case WM_MBUTTONDBLCLK :
- case WM_RBUTTONDOWN :
- case WM_RBUTTONUP :
- case WM_RBUTTONDBLCLK :
-
- case WM_MOUSEWHEEL :
-
- m_pMainFrame->PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
- break;
+ switch (pMsg->message) {
+ case WM_MOUSEMOVE :
+ case WM_SYSKEYDOWN :
+ case WM_SYSKEYUP :
+ case WM_SYSCHAR :
+ case WM_SYSCOMMAND :
+
+ case WM_KEYDOWN :
+ case WM_KEYUP :
+ case WM_CHAR :
+
+ case WM_LBUTTONDOWN :
+ case WM_LBUTTONUP :
+ case WM_LBUTTONDBLCLK :
+ case WM_MBUTTONDOWN :
+ case WM_MBUTTONUP :
+ case WM_MBUTTONDBLCLK :
+ case WM_RBUTTONDOWN :
+ case WM_RBUTTONUP :
+ case WM_RBUTTONDBLCLK :
+
+ case WM_MOUSEWHEEL :
+
+ m_pMainFrame->PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
+ break;
}
return CWnd::PreTranslateMessage(pMsg);
@@ -95,8 +93,9 @@ BOOL CFullscreenWnd::PreTranslateMessage(MSG* pMsg) BOOL CFullscreenWnd::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CWnd::PreCreateWindow(cs))
+ if(!CWnd::PreCreateWindow(cs)) {
return FALSE;
+ }
cs.style &= ~WS_BORDER;
cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS, m_hCursor, HBRUSH(COLOR_WINDOW+1), NULL);
@@ -114,18 +113,18 @@ BOOL CFullscreenWnd::OnEraseBkgnd(CDC* pDC) BOOL CFullscreenWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
- if (m_bCursorVisible)
+ if (m_bCursorVisible) {
::SetCursor(m_hCursor);
- else
+ } else {
::SetCursor(NULL);
+ }
return FALSE;
}
void CFullscreenWnd::ShowCursor(bool bVisible)
{
- if (m_bCursorVisible != bVisible)
- {
+ if (m_bCursorVisible != bVisible) {
m_bCursorVisible = bVisible;
PostMessage (WM_SETCURSOR,0,0);
}
diff --git a/src/apps/mplayerc/GoToDlg.cpp b/src/apps/mplayerc/GoToDlg.cpp index e403803e7..a69ddd1c1 100644 --- a/src/apps/mplayerc/GoToDlg.cpp +++ b/src/apps/mplayerc/GoToDlg.cpp @@ -38,10 +38,11 @@ CGoToDlg::CGoToDlg(int time, float fps, CWnd* pParent /*=NULL*/) , m_time(time)
, m_fps(fps)
{
- if(m_fps == 0)
- {
+ if(m_fps == 0) {
CString str = AfxGetApp()->GetProfileString(IDS_R_SETTINGS, _T("fps"), _T("0"));
- if(_stscanf_s(str, _T("%f"), &m_fps) != 1) m_fps = 0;
+ if(_stscanf_s(str, _T("%f"), &m_fps) != 1) {
+ m_fps = 0;
+ }
}
}
@@ -62,36 +63,33 @@ BOOL CGoToDlg::OnInitDialog() {
CDialog::OnInitDialog();
- if(m_time >= 0)
- {
+ if(m_time >= 0) {
m_timestr.Format(_T("%02d:%02d:%02d.%03d"),
(m_time/(1000*60*60))%60, (m_time/(1000*60))%60, (m_time/1000)%60, m_time%1000);
- if(m_fps > 0)
- {
+ if(m_fps > 0) {
m_framestr.Format(_T("%d, %.3f"), (int)(m_fps*m_time/1000), m_fps);
}
UpdateData(FALSE);
- switch(AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("gotoluf"), 0))
- {
- default:
- case 0:
- m_timeedit.SetFocus();
- m_timeedit.SetSel(0, 0);
- break;
- case 1:
- m_frameedit.SetFocus();
- m_frameedit.SetSel(0, m_framestr.Find(','));
- break;
+ switch(AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("gotoluf"), 0)) {
+ default:
+ case 0:
+ m_timeedit.SetFocus();
+ m_timeedit.SetSel(0, 0);
+ break;
+ case 1:
+ m_frameedit.SetFocus();
+ m_frameedit.SetSel(0, m_framestr.Find(','));
+ break;
}
}
return TRUE;
-// return TRUE; // return TRUE unless you set the focus to a control
+ // return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
@@ -114,20 +112,17 @@ void CGoToDlg::OnBnClickedOk1() CAtlRegExp<> re;
REParseError status = re.Parse(_T("{\\z}"), FALSE);
- if(REPARSE_ERROR_OK == status)
- {
+ if(REPARSE_ERROR_OK == status) {
m_timestr += 'A'; // HACK: Without this the while loop below would keep going on X64 on release builds...
CAtlREMatchContext<> mc;
const CAtlREMatchContext<>::RECHAR* s = m_timestr.GetBuffer();
const CAtlREMatchContext<>::RECHAR* e = NULL;
- while(s && re.Match(s, &mc, &e))
- {
+ while(s && re.Match(s, &mc, &e)) {
const CAtlREMatchContext<>::RECHAR* szStart = 0;
const CAtlREMatchContext<>::RECHAR* szEnd = 0;
mc.GetMatch(0, &szStart, &szEnd);
- if(hh != 0 || hh > 59 || mm > 59 || ss > 59)
- {
+ if(hh != 0 || hh > 59 || mm > 59 || ss > 59) {
AfxMessageBox(_T("Error parsing entered time!"));
return;
}
@@ -159,13 +154,11 @@ void CGoToDlg::OnBnClickedOk2() CAtlRegExp<> re;
REParseError status = re.Parse(_T("{\\z}[^0-9\\.]+{[0-9\\.]+}"), FALSE);
- if(REPARSE_ERROR_OK == status)
- {
+ if(REPARSE_ERROR_OK == status) {
CAtlREMatchContext<> mc;
const CAtlREMatchContext<>::RECHAR* s = m_framestr.GetBuffer();
const CAtlREMatchContext<>::RECHAR* e = NULL;
- if(re.Match(s, &mc, &e))
- {
+ if(re.Match(s, &mc, &e)) {
const CAtlREMatchContext<>::RECHAR* szStart = 0;
const CAtlREMatchContext<>::RECHAR* szEnd = 0;
@@ -173,17 +166,17 @@ void CGoToDlg::OnBnClickedOk2() frame = _tcstol(szStart, (TCHAR**)&szStart, 10);
mc.GetMatch(1, &szStart, &szEnd);
- if(_stscanf_s(szStart, _T("%f"), &fps) != 1) fps = 0;
- else AfxGetApp()->WriteProfileString(IDS_R_SETTINGS, _T("fps"), szStart);
- }
- else
- {
+ if(_stscanf_s(szStart, _T("%f"), &fps) != 1) {
+ fps = 0;
+ } else {
+ AfxGetApp()->WriteProfileString(IDS_R_SETTINGS, _T("fps"), szStart);
+ }
+ } else {
AfxMessageBox(_T("Error parsing entered text!"));
return;
}
- if(fps == 0)
- {
+ if(fps == 0) {
AfxMessageBox(_T("Error parsing entered frame rate!"));
return;
}
@@ -198,10 +191,12 @@ void CGoToDlg::OnBnClickedOk2() BOOL CGoToDlg::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
- {
- if(*GetFocus() == m_timeedit) OnBnClickedOk1();
- else if(*GetFocus() == m_frameedit) OnBnClickedOk2();
+ if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) {
+ if(*GetFocus() == m_timeedit) {
+ OnBnClickedOk1();
+ } else if(*GetFocus() == m_frameedit) {
+ OnBnClickedOk2();
+ }
return TRUE;
}
diff --git a/src/apps/mplayerc/GoToDlg.h b/src/apps/mplayerc/GoToDlg.h index 1b98ca34d..d63b657e1 100644 --- a/src/apps/mplayerc/GoToDlg.h +++ b/src/apps/mplayerc/GoToDlg.h @@ -44,7 +44,7 @@ public: int m_time;
float m_fps;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_GOTO_DLG };
protected:
diff --git a/src/apps/mplayerc/IGraphBuilder2.h b/src/apps/mplayerc/IGraphBuilder2.h index 57c6ae3d7..20633c66e 100644 --- a/src/apps/mplayerc/IGraphBuilder2.h +++ b/src/apps/mplayerc/IGraphBuilder2.h @@ -23,8 +23,7 @@ #pragma once
-typedef struct
-{
+typedef struct {
CString cPresent;
CString SummaryDesc;
CString StartTime;
@@ -37,8 +36,7 @@ typedef struct interface __declspec(uuid("165BE9D6-0929-4363-9BA3-580D735AA0F6"))
IGraphBuilder2 :
-public IFilterGraph2
-{
+public IFilterGraph2 {
STDMETHOD(IsPinDirection) (IPin* pPin, PIN_DIRECTION dir) = 0;
STDMETHOD(IsPinConnected) (IPin* pPin) = 0;
STDMETHOD(ConnectFilter) (IBaseFilter* pBF, IPin* pPinIn) = 0;
@@ -53,8 +51,7 @@ public IFilterGraph2 // private use only
interface __declspec(uuid("43CDA93D-6A4E-4A07-BD3E-49D161073EE7"))
IGraphBuilderDeadEnd :
-public IUnknown
-{
+public IUnknown {
STDMETHOD_(size_t, GetCount)() = 0;
STDMETHOD(GetDeadEnd) (int iIndex, CAtlList<CStringW>& path, CAtlList<CMediaType>& mts) = 0;
};
@@ -63,8 +60,7 @@ public IUnknown // private use only
interface __declspec(uuid("43CDA93D-6A4E-4A07-BD3E-49D161073EE7"))
IBDATuner :
-public IUnknown
-{
+public IUnknown {
STDMETHOD(SetChannel) (int nChannelPrefNumber) = 0;
STDMETHOD(SetAudio) (int nAudioIndex) = 0;
STDMETHOD(SetFrequency) (ULONG ulFrequency) = 0;
diff --git a/src/apps/mplayerc/ISDb.cpp b/src/apps/mplayerc/ISDb.cpp index 93083cfb8..f05aa1d8d 100644 --- a/src/apps/mplayerc/ISDb.cpp +++ b/src/apps/mplayerc/ISDb.cpp @@ -30,8 +30,9 @@ bool hash(LPCTSTR fn, filehash& fh) {
CFile f;
CFileException fe;
- if(!f.Open(fn, CFile::modeRead|CFile::osSequentialScan|CFile::shareDenyNone, &fe))
+ if(!f.Open(fn, CFile::modeRead|CFile::osSequentialScan|CFile::shareDenyNone, &fe)) {
return false;
+ }
CPath p(fn);
p.StripPath();
@@ -40,9 +41,13 @@ bool hash(LPCTSTR fn, filehash& fh) fh.size = f.GetLength();
fh.hash = fh.size;
- for(UINT64 tmp = 0, i = 0; i < 65536/sizeof(tmp) && f.Read(&tmp, sizeof(tmp)); fh.hash += tmp, i++);
+ for(UINT64 tmp = 0, i = 0; i < 65536/sizeof(tmp) && f.Read(&tmp, sizeof(tmp)); fh.hash += tmp, i++) {
+ ;
+ }
f.Seek(max(0, (INT64)fh.size - 65536), CFile::begin);
- for(UINT64 tmp = 0, i = 0; i < 65536/sizeof(tmp) && f.Read(&tmp, sizeof(tmp)); fh.hash += tmp, i++);
+ for(UINT64 tmp = 0, i = 0; i < 65536/sizeof(tmp) && f.Read(&tmp, sizeof(tmp)); fh.hash += tmp, i++) {
+ ;
+ }
return true;
}
@@ -52,15 +57,16 @@ void hash(CPlaylist& pl, CList<filehash>& fhs) fhs.RemoveAll();
POSITION pos = pl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CString fn = pl.GetNext(pos).m_fns.GetHead();
- if(AfxGetAppSettings().m_Formats.FindExt(CPath(fn).GetExtension().MakeLower(), true))
+ if(AfxGetAppSettings().m_Formats.FindExt(CPath(fn).GetExtension().MakeLower(), true)) {
continue;
+ }
filehash fh;
- if(!hash(fn, fh))
+ if(!hash(fn, fh)) {
continue;
+ }
fhs.AddTail(fh);
}
@@ -74,8 +80,7 @@ CStringA makeargs(CPlaylist& pl) CAtlList<CStringA> args;
POSITION pos = fhs.GetHeadPosition();
- for(int i = 0; pos; i++)
- {
+ for(int i = 0; pos; i++) {
filehash& fh = fhs.GetNext(pos);
CStringA str;
@@ -94,17 +99,16 @@ bool OpenUrl(CInternetSession& is, CString url, CStringA& str) {
str.Empty();
- try
- {
+ try {
CAutoPtr<CStdioFile> f(is.OpenURL(url, 1, INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_EXISTING_CONNECT));
char buff[1024];
- for(int len; (len = f->Read(buff, sizeof(buff))) > 0; str += CStringA(buff, len));
+ for(int len; (len = f->Read(buff, sizeof(buff))) > 0; str += CStringA(buff, len)) {
+ ;
+ }
f->Close(); // must close it because the destructor doesn't seem to do it and we will get an exception when "is" is destroying
- }
- catch(CInternetException* ie)
- {
+ } catch(CInternetException* ie) {
ie->Delete();
return false;
}
diff --git a/src/apps/mplayerc/ISDb.h b/src/apps/mplayerc/ISDb.h index fdc6dea56..3173380bc 100644 --- a/src/apps/mplayerc/ISDb.h +++ b/src/apps/mplayerc/ISDb.h @@ -30,34 +30,27 @@ #define ISDb_PROTOCOL_VERSION 1
-struct isdb_subtitle
-{
+struct isdb_subtitle {
int id, discs, disc_no;
CStringA name, format, language, iso639_2, nick, email;
- struct isdb_subtitle()
- {
+ struct isdb_subtitle() {
reset();
}
- void reset()
- {
+ void reset() {
id = discs = disc_no = 0;
format = language = nick = email = "";
}
};
-struct isdb_movie
-{
+struct isdb_movie {
CAtlList<CStringA> titles;
CAtlList<isdb_subtitle> subs;
- void reset()
- {
+ void reset() {
titles.RemoveAll();
subs.RemoveAll();
}
- isdb_movie& operator = (const struct isdb_movie& m)
- {
- if(this != &m)
- {
+ isdb_movie& operator = (const struct isdb_movie& m) {
+ if(this != &m) {
titles.RemoveAll();
titles.AddTailList(&m.titles);
subs.RemoveAll();
@@ -67,8 +60,7 @@ struct isdb_movie }
};
-struct filehash
-{
+struct filehash {
CString name;
UINT64 size, hash;
};
diff --git a/src/apps/mplayerc/Ifo.cpp b/src/apps/mplayerc/Ifo.cpp index 8072f033b..e0866ad18 100644 --- a/src/apps/mplayerc/Ifo.cpp +++ b/src/apps/mplayerc/Ifo.cpp @@ -118,20 +118,17 @@ void CIfo::RemovePgciUOPs (uint8_t *ptr) ptr += IFO_HDR_LEN;
num = be2me_16(hdr->num);
- for (i=1; i<=num; i++)
- {
+ for (i=1; i<=num; i++) {
lu_sub_t *lu_sub = (lu_sub_t *) ptr;
UNUSED_ALWAYS(lu_sub);
ptr += LU_SUB_LEN;
}
- for (i=0; i<be2me_16(hdr->num); i++)
- {
+ for (i=0; i<be2me_16(hdr->num); i++) {
uint8_t *ptr;
- if (GetMiscPGCI (hdr, i, &ptr) >= 0)
- {
+ if (GetMiscPGCI (hdr, i, &ptr) >= 0) {
pgc_t* pgc = (pgc_t*) ptr;
pgc->prohibited_ops = 0;
}
@@ -140,10 +137,11 @@ void CIfo::RemovePgciUOPs (uint8_t *ptr) CIfo::pgc_t* CIfo::GetFirstPGC()
{
- if (m_pBuffer)
+ if (m_pBuffer) {
return (pgc_t*) (m_pBuffer + 0x0400);
- else
+ } else {
return NULL;
+ }
}
CIfo::pgc_t* CIfo::GetPGCI(const int title, const ifo_hdr_t* hdr)
@@ -159,8 +157,7 @@ CIfo::pgc_t* CIfo::GetPGCI(const int title, const ifo_hdr_t* hdr) ptr = (uint8_t *) hdr + be2me_32 (pgci_sub->start);
/* jdw */
- if ( ptr >= ( (uint8_t *) hdr + be2me_32 ( hdr->len )))
- {
+ if ( ptr >= ( (uint8_t *) hdr + be2me_32 ( hdr->len ))) {
return NULL ;
}
/* /jdw */
@@ -171,8 +168,9 @@ CIfo::pgc_t* CIfo::GetPGCI(const int title, const ifo_hdr_t* hdr) bool CIfo::IsVTS()
{
- if (m_dwSize<12 || (strncmp ((char*)m_pBuffer, "DVDVIDEO-VTS", 12)!=0))
+ if (m_dwSize<12 || (strncmp ((char*)m_pBuffer, "DVDVIDEO-VTS", 12)!=0)) {
return false;
+ }
return true;
}
@@ -180,8 +178,9 @@ bool CIfo::IsVTS() bool CIfo::IsVMG()
{
- if (m_dwSize<12 || (strncmp ((char*)m_pBuffer, "DVDVIDEO-VMG", 12)!=0))
+ if (m_dwSize<12 || (strncmp ((char*)m_pBuffer, "DVDVIDEO-VMG", 12)!=0)) {
return false;
+ }
return true;
}
@@ -194,20 +193,18 @@ bool CIfo::OpenFile (LPCTSTR strFile) hFile = Real_CreateFileW((LPTSTR) strFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
ASSERT (hFile != INVALID_HANDLE_VALUE);
- if (hFile != INVALID_HANDLE_VALUE)
- {
+ if (hFile != INVALID_HANDLE_VALUE) {
DWORD dwSize = GetFileSize (hFile, NULL);
m_pBuffer = DNew BYTE [dwSize];
ReadFile (hFile, m_pBuffer, dwSize, &m_dwSize, NULL);
CloseHandle (hFile);
- if (IsVTS() && (OFF_VTSM_PGCI_UT(m_pBuffer)!=0))
- {
+ if (IsVTS() && (OFF_VTSM_PGCI_UT(m_pBuffer)!=0)) {
m_pPGCI = (ifo_hdr_t*)(m_pBuffer + OFF_VTSM_PGCI_UT(m_pBuffer) * DVD_VIDEO_LB_LEN);
m_pPGCIT = (ifo_hdr_t*)(m_pBuffer + OFF_VTS_PGCIT(m_pBuffer) * DVD_VIDEO_LB_LEN);
- }
- else if (IsVMG() && (OFF_VMGM_PGCI_UT(m_pBuffer)!=0))
+ } else if (IsVMG() && (OFF_VMGM_PGCI_UT(m_pBuffer)!=0)) {
m_pPGCI = (ifo_hdr_t*)(m_pBuffer + OFF_VMGM_PGCI_UT(m_pBuffer) * DVD_VIDEO_LB_LEN);
+ }
bRet = (m_pPGCI != NULL);
}
@@ -219,25 +216,23 @@ bool CIfo::RemoveUOPs() {
pgc_t* pgc;
- if (m_pPGCI)
- {
+ if (m_pPGCI) {
pgc = GetFirstPGC();
pgc->prohibited_ops = 0;
- for (int i=0; i<be2me_16(m_pPGCI->num); i++)
- {
+ for (int i=0; i<be2me_16(m_pPGCI->num); i++) {
pgc = GetPGCI(i, m_pPGCI);
- if (pgc)
+ if (pgc) {
RemovePgciUOPs ((uint8_t*)pgc);
+ }
}
}
- if (m_pPGCIT)
- {
- for (int i=0; i<be2me_16(m_pPGCIT->num); i++)
- {
+ if (m_pPGCIT) {
+ for (int i=0; i<be2me_16(m_pPGCIT->num); i++) {
pgc = GetPGCI(i, m_pPGCIT);
- if (pgc)
+ if (pgc) {
pgc->prohibited_ops = 0;
+ }
}
}
return true;
@@ -248,14 +243,12 @@ bool CIfo::SaveFile (LPCTSTR strFile) bool bRet = false;
HANDLE m_hFile;
- if (m_pBuffer)
- {
+ if (m_pBuffer) {
m_hFile = Real_CreateFileW((LPTSTR) strFile, GENERIC_WRITE|GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
ASSERT (m_hFile != INVALID_HANDLE_VALUE);
- if (m_hFile != INVALID_HANDLE_VALUE)
- {
+ if (m_hFile != INVALID_HANDLE_VALUE) {
DWORD dwSize;
WriteFile (m_hFile, m_pBuffer, m_dwSize, &dwSize, NULL);
CloseHandle(m_hFile);
diff --git a/src/apps/mplayerc/Ifo.h b/src/apps/mplayerc/Ifo.h index 74787d671..bbd21c442 100644 --- a/src/apps/mplayerc/Ifo.h +++ b/src/apps/mplayerc/Ifo.h @@ -44,15 +44,13 @@ public: private :
- typedef struct
- {
+ typedef struct {
uint16_t id : 16; // Language
uint16_t : 16; // don't know
uint32_t start : 32; // Start of unit
} pgci_sub_t;
- typedef struct
- {
+ typedef struct {
uint8_t hour;
uint8_t minute;
uint8_t second;
@@ -62,8 +60,7 @@ private : typedef uint8_t command_data_t[8];
#define COMMAND_DATA_SIZE 8
- typedef struct // PGC Command Table
- {
+ typedef struct { // PGC Command Table
uint16_t nr_of_pre;
uint16_t nr_of_post;
uint16_t nr_of_cell;
@@ -76,8 +73,7 @@ private : typedef uint8_t pgc_program_map_t;
- typedef struct // Cell Playback Information
- {
+ typedef struct { // Cell Playback Information
uint8_t chain_info : 8; // 0x5e 0xde(2 angles, no overlay), 0x5f 0x9f 0x9f 0xdf(4 angles overlay), 0x2 0xa 0x8(1 angle)
uint8_t foo; // parental control ??
uint8_t still_time;
@@ -90,8 +86,7 @@ private : uint32_t vobu_last_end;
} ifo_pgci_caddr_t;
- typedef struct // Cell Position Information
- {
+ typedef struct { // Cell Position Information
uint16_t vob_id : 16; // Video Object Identifier
uint8_t foo : 8; // Unknown
uint8_t cell_id : 8; // Cell Identifier
@@ -100,8 +95,7 @@ private : #ifndef CLUT_T
#define CLUT_T
- typedef struct // CLUT == Color LookUp Table
- {
+ typedef struct { // CLUT == Color LookUp Table
uint8_t foo : 8; // UNKNOWN: 0x00?
uint8_t y : 8;
uint8_t cr : 8;
@@ -109,8 +103,7 @@ private : } clut_t;
#endif
- typedef struct // Audio Status
- {
+ typedef struct { // Audio Status
#if BYTE_ORDER == BIG_ENDIAN
uint8_t available : 1;
uint8_t link : 7;
@@ -122,8 +115,7 @@ private : } audio_status_t;
- typedef struct // Subpicture status
- {
+ typedef struct { // Subpicture status
#if BYTE_ORDER == BIG_ENDIAN
uint8_t available : 1;
uint8_t format4_3 : 7;
@@ -137,8 +129,7 @@ private : } subp_status_t;
- typedef struct // Program Chain Information
- {
+ typedef struct { // Program Chain Information
uint16_t zero_1;
uint8_t nr_of_programs;
uint8_t nr_of_cells;
@@ -163,15 +154,13 @@ private : } pgc_t;
#define PGC_SIZE 236
- typedef struct
- {
+ typedef struct {
uint16_t num : 16; // number of entries
uint16_t : 16; // UNKNOWN
uint32_t len : 32; // length of table
} ifo_hdr_t;
- typedef struct
- {
+ typedef struct {
#if BYTE_ORDER == BIG_ENDIAN
uint16_t foo1 : 4; // don't know
uint8_t menu_id : 4; // 0=off, 3=root, 4=spu,
diff --git a/src/apps/mplayerc/LcdSupport.cpp b/src/apps/mplayerc/LcdSupport.cpp index 18b8fb3f8..b67d1cb83 100644 --- a/src/apps/mplayerc/LcdSupport.cpp +++ b/src/apps/mplayerc/LcdSupport.cpp @@ -43,11 +43,9 @@ void LCD_UpdateThread(void * Control) struct tm thetime;
_tsetlocale(LC_ALL, _T("")); // set current system locale
- while (ctrl->Thread_Loop)
- {
+ while (ctrl->Thread_Loop) {
EnterCriticalSection(&ctrl->cs);
- if (_time64(<ime) != otime) // Retrieve the time
- {
+ if (_time64(<ime) != otime) { // Retrieve the time
otime = ltime;
_localtime64_s(&thetime, <ime);
@@ -55,11 +53,13 @@ void LCD_UpdateThread(void * Control) // using %#x is the long date representation,
// appropriate to the current locale
if (wcsftime(str, sizeof(str)/sizeof(wchar_t), _T("%#x"), (const struct tm *)&thetime) &&
- (ltime > ctrl->nThread_tTimeout || ltime < otime)) // message displayed, no update until timeout
+ (ltime > ctrl->nThread_tTimeout || ltime < otime)) { // message displayed, no update until timeout
ctrl->m_Manager.m_Text[0].SetText(str);
+ }
- if (wcsftime(str, sizeof(str)/sizeof(wchar_t), _T("%X"), (const struct tm *)&thetime))
+ if (wcsftime(str, sizeof(str)/sizeof(wchar_t), _T("%X"), (const struct tm *)&thetime)) {
ctrl->m_Manager.m_Text[1].SetText(str);
+ }
}
ctrl->m_Output.Update(GetTickCount()); // This invokes OnUpdate for the active screen
@@ -157,31 +157,29 @@ HRESULT CLCDMyManager::Initialize() void CLCDMyManager::OnLCDButtonUp(int nButton)
{
- switch(nButton)
- {
- case LGLCDBUTTON_BUTTON0:
- {
- /* LOGFONT lf;
- HFONT hFont = m_Text1.GetFont();
-
- GetObject(hFont, sizeof(LOGFONT), &lf);
-
- CFontDialog cfd(&lf);
- if (cfd.DoModal() == IDOK)
- {
- cfd.GetCurrentFont(&lf);
- m_Text1.SetFont(lf);
- }
- */ break;
- }
- case LGLCDBUTTON_BUTTON1:
- break;
- case LGLCDBUTTON_BUTTON2:
- break;
- case LGLCDBUTTON_BUTTON3:
- break;
- default:
- break;
+ switch(nButton) {
+ case LGLCDBUTTON_BUTTON0: {
+ /* LOGFONT lf;
+ HFONT hFont = m_Text1.GetFont();
+
+ GetObject(hFont, sizeof(LOGFONT), &lf);
+
+ CFontDialog cfd(&lf);
+ if (cfd.DoModal() == IDOK)
+ {
+ cfd.GetCurrentFont(&lf);
+ m_Text1.SetFont(lf);
+ }
+ */ break;
+ }
+ case LGLCDBUTTON_BUTTON1:
+ break;
+ case LGLCDBUTTON_BUTTON2:
+ break;
+ case LGLCDBUTTON_BUTTON3:
+ break;
+ default:
+ break;
}
}
@@ -237,8 +235,7 @@ CMPC_Lcd::CMPC_Lcd(void) m_ConnCtx.connection = LGLCD_INVALID_CONNECTION; // the "connection" member will be returned upon return
if (m_Output.Initialize(&m_ConnCtx) != ERROR_SUCCESS || // Initialize the output object
- m_Manager.Initialize() != ERROR_SUCCESS)
- {
+ m_Manager.Initialize() != ERROR_SUCCESS) {
//_tperror(_T("Initialize"));
return;
}
@@ -252,8 +249,7 @@ CMPC_Lcd::CMPC_Lcd(void) m_Output.Update(GetTickCount()); // This invokes OnUpdate for the active screen
m_Output.Draw(); // This invokes OnDraw for the active screen
- if (m_Output.IsOpened())
- {
+ if (m_Output.IsOpened()) {
Thread_Loop = true;
SetPlayState(PS_STOP);
hLCD_UpdateThread = (HANDLE) _beginthread(LCD_UpdateThread, 512 /* stack */, (void*) this /* arg */);
@@ -263,8 +259,7 @@ CMPC_Lcd::CMPC_Lcd(void) /* detach from lcd */
CMPC_Lcd::~CMPC_Lcd(void)
{
- if ( m_Output.IsOpened() )
- {
+ if ( m_Output.IsOpened() ) {
Thread_Loop = false;
WaitForSingleObject( hLCD_UpdateThread, LCD_UPD_TIMER * 2 /* timeout */ );
hLCD_UpdateThread = NULL;
@@ -319,13 +314,15 @@ void CMPC_Lcd::SetMediaPos(__int64 nPos) /* update status message (displayed for nTimeOut milliseconds) */
void CMPC_Lcd::SetStatusMessage(const _TCHAR * text, int nTimeOut)
{
- if (!m_Output.IsOpened())
+ if (!m_Output.IsOpened()) {
return;
+ }
__time64_t ltime;
_time64(<ime);
- if ((nTimeOut /= 1000) < 1)
+ if ((nTimeOut /= 1000) < 1) {
nTimeOut = 1;
+ }
EnterCriticalSection(&cs);
nThread_tTimeout = ltime + nTimeOut;
@@ -336,38 +333,38 @@ void CMPC_Lcd::SetStatusMessage(const _TCHAR * text, int nTimeOut) /* update play state bitmap */
void CMPC_Lcd::SetPlayState(CMPC_Lcd::PlayState ps)
{
- if (!m_Output.IsOpened())
+ if (!m_Output.IsOpened()) {
return;
+ }
EnterCriticalSection(&cs);
- switch (ps)
- {
- case PS_PLAY:
- m_Output.SetAsForeground(true);
- m_Manager.m_PlayState.SetBitmap(hBmp[PS_PLAY]);
- m_Manager.m_PlayState.ResetUpdate();
- m_Manager.m_PlayState.SetSubpicWidth(7);
- m_Manager.m_PlayState.SetAnimationRate(300);
- break;
-
- case PS_PAUSE:
- m_Manager.m_PlayState.SetBitmap(hBmp[PS_PAUSE]);
- m_Manager.m_PlayState.ResetUpdate();
- m_Manager.m_PlayState.SetSubpicWidth(7);
- m_Manager.m_PlayState.SetAnimationRate(800);
- break;
-
- case PS_STOP:
- m_Output.SetAsForeground(false);
- m_Manager.m_ProgBar[1].SetPos(0);
- m_Manager.m_PlayState.SetBitmap(hBmp[PS_STOP]);
- m_Manager.m_PlayState.ResetUpdate();
- m_Manager.m_PlayState.SetSubpicWidth(7);
- m_Manager.m_PlayState.SetAnimationRate(5000); // dummy, only one picture
- break;
-
- default:
- break;
+ switch (ps) {
+ case PS_PLAY:
+ m_Output.SetAsForeground(true);
+ m_Manager.m_PlayState.SetBitmap(hBmp[PS_PLAY]);
+ m_Manager.m_PlayState.ResetUpdate();
+ m_Manager.m_PlayState.SetSubpicWidth(7);
+ m_Manager.m_PlayState.SetAnimationRate(300);
+ break;
+
+ case PS_PAUSE:
+ m_Manager.m_PlayState.SetBitmap(hBmp[PS_PAUSE]);
+ m_Manager.m_PlayState.ResetUpdate();
+ m_Manager.m_PlayState.SetSubpicWidth(7);
+ m_Manager.m_PlayState.SetAnimationRate(800);
+ break;
+
+ case PS_STOP:
+ m_Output.SetAsForeground(false);
+ m_Manager.m_ProgBar[1].SetPos(0);
+ m_Manager.m_PlayState.SetBitmap(hBmp[PS_STOP]);
+ m_Manager.m_PlayState.ResetUpdate();
+ m_Manager.m_PlayState.SetSubpicWidth(7);
+ m_Manager.m_PlayState.SetAnimationRate(5000); // dummy, only one picture
+ break;
+
+ default:
+ break;
}
LeaveCriticalSection(&cs);
}
diff --git a/src/apps/mplayerc/LcdSupport.h b/src/apps/mplayerc/LcdSupport.h index 195e3a174..44ed3d306 100644 --- a/src/apps/mplayerc/LcdSupport.h +++ b/src/apps/mplayerc/LcdSupport.h @@ -48,8 +48,7 @@ public: class CMPC_Lcd
{
public:
- enum PlayState
- {
+ enum PlayState {
PS_PLAY = 0,
PS_PAUSE = 1,
PS_STOP = 2,
diff --git a/src/apps/mplayerc/MainFrm.cpp b/src/apps/mplayerc/MainFrm.cpp index ea64f6dea..db270ec6f 100644 --- a/src/apps/mplayerc/MainFrm.cpp +++ b/src/apps/mplayerc/MainFrm.cpp @@ -98,8 +98,7 @@ DWORD last_run = 0; class CSubClock : public CUnknown, public ISubClock
{
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
- {
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) {
return
QI(ISubClock)
CUnknown::NonDelegatingQueryInterface(riid, ppv);
@@ -108,21 +107,18 @@ class CSubClock : public CUnknown, public ISubClock REFERENCE_TIME m_rt;
public:
- CSubClock() : CUnknown(NAME("CSubClock"), NULL)
- {
+ CSubClock() : CUnknown(NAME("CSubClock"), NULL) {
m_rt = 0;
}
DECLARE_IUNKNOWN;
// ISubClock
- STDMETHODIMP SetTime(REFERENCE_TIME rt)
- {
+ STDMETHODIMP SetTime(REFERENCE_TIME rt) {
m_rt = rt;
return S_OK;
}
- STDMETHODIMP_(REFERENCE_TIME) GetTime()
- {
+ STDMETHODIMP_(REFERENCE_TIME) GetTime() {
return(m_rt);
}
};
@@ -137,7 +133,7 @@ public: \
if(__fs != State_Stopped) \
SendMessage(WM_COMMAND, ID_PLAY_STOP); \
-
+
#define RestoreMediaState \
if(m_iMediaLoadState == MLS_LOADED) \
@@ -151,7 +147,7 @@ public: else if(__fs == State_Running) \
SendMessage(WM_COMMAND, ID_PLAY_PLAY); \
} \
-
+
using namespace DSObjects;
/////////////////////////////////////////////////////////////////////////////
@@ -517,73 +513,72 @@ END_MESSAGE_MAP() const TCHAR *GetEventString(LONG evCode)
{
#define UNPACK_VALUE(VALUE) case VALUE: return _T( #VALUE );
- switch(evCode)
- {
- UNPACK_VALUE(EC_COMPLETE);
- UNPACK_VALUE(EC_USERABORT);
- UNPACK_VALUE(EC_ERRORABORT);
- UNPACK_VALUE(EC_TIME);
- UNPACK_VALUE(EC_REPAINT);
- UNPACK_VALUE(EC_STREAM_ERROR_STOPPED);
- UNPACK_VALUE(EC_STREAM_ERROR_STILLPLAYING);
- UNPACK_VALUE(EC_ERROR_STILLPLAYING);
- UNPACK_VALUE(EC_PALETTE_CHANGED);
- UNPACK_VALUE(EC_VIDEO_SIZE_CHANGED);
- UNPACK_VALUE(EC_QUALITY_CHANGE);
- UNPACK_VALUE(EC_SHUTTING_DOWN);
- UNPACK_VALUE(EC_CLOCK_CHANGED);
- UNPACK_VALUE(EC_PAUSED);
- UNPACK_VALUE(EC_OPENING_FILE);
- UNPACK_VALUE(EC_BUFFERING_DATA);
- UNPACK_VALUE(EC_FULLSCREEN_LOST);
- UNPACK_VALUE(EC_ACTIVATE);
- UNPACK_VALUE(EC_NEED_RESTART);
- UNPACK_VALUE(EC_WINDOW_DESTROYED);
- UNPACK_VALUE(EC_DISPLAY_CHANGED);
- UNPACK_VALUE(EC_STARVATION);
- UNPACK_VALUE(EC_OLE_EVENT);
- UNPACK_VALUE(EC_NOTIFY_WINDOW);
- UNPACK_VALUE(EC_STREAM_CONTROL_STOPPED);
- UNPACK_VALUE(EC_STREAM_CONTROL_STARTED);
- UNPACK_VALUE(EC_END_OF_SEGMENT);
- UNPACK_VALUE(EC_SEGMENT_STARTED);
- UNPACK_VALUE(EC_LENGTH_CHANGED);
- UNPACK_VALUE(EC_DEVICE_LOST);
- UNPACK_VALUE(EC_SAMPLE_NEEDED);
- UNPACK_VALUE(EC_PROCESSING_LATENCY);
- UNPACK_VALUE(EC_SAMPLE_LATENCY);
- UNPACK_VALUE(EC_SCRUB_TIME);
- UNPACK_VALUE(EC_STEP_COMPLETE);
- UNPACK_VALUE(EC_TIMECODE_AVAILABLE);
- UNPACK_VALUE(EC_EXTDEVICE_MODE_CHANGE);
- UNPACK_VALUE(EC_STATE_CHANGE);
- UNPACK_VALUE(EC_GRAPH_CHANGED);
- UNPACK_VALUE(EC_CLOCK_UNSET);
- UNPACK_VALUE(EC_VMR_RENDERDEVICE_SET);
- UNPACK_VALUE(EC_VMR_SURFACE_FLIPPED);
- UNPACK_VALUE(EC_VMR_RECONNECTION_FAILED);
- UNPACK_VALUE(EC_PREPROCESS_COMPLETE);
- UNPACK_VALUE(EC_CODECAPI_EVENT);
- UNPACK_VALUE(EC_WMT_INDEX_EVENT);
- UNPACK_VALUE(EC_WMT_EVENT);
- UNPACK_VALUE(EC_BUILT);
- UNPACK_VALUE(EC_UNBUILT);
- UNPACK_VALUE(EC_SKIP_FRAMES);
- UNPACK_VALUE(EC_PLEASE_REOPEN);
- UNPACK_VALUE(EC_STATUS);
- UNPACK_VALUE(EC_MARKER_HIT);
- UNPACK_VALUE(EC_LOADSTATUS);
- UNPACK_VALUE(EC_FILE_CLOSED);
- UNPACK_VALUE(EC_ERRORABORTEX);
- //UNPACK_VALUE(EC_NEW_PIN);
- //UNPACK_VALUE(EC_RENDER_FINISHED);
- UNPACK_VALUE(EC_EOS_SOON);
- UNPACK_VALUE(EC_CONTENTPROPERTY_CHANGED);
- UNPACK_VALUE(EC_BANDWIDTHCHANGE);
- UNPACK_VALUE(EC_VIDEOFRAMEREADY);
-
- UNPACK_VALUE(EC_BG_AUDIO_CHANGED);
- UNPACK_VALUE(EC_BG_ERROR);
+ switch(evCode) {
+ UNPACK_VALUE(EC_COMPLETE);
+ UNPACK_VALUE(EC_USERABORT);
+ UNPACK_VALUE(EC_ERRORABORT);
+ UNPACK_VALUE(EC_TIME);
+ UNPACK_VALUE(EC_REPAINT);
+ UNPACK_VALUE(EC_STREAM_ERROR_STOPPED);
+ UNPACK_VALUE(EC_STREAM_ERROR_STILLPLAYING);
+ UNPACK_VALUE(EC_ERROR_STILLPLAYING);
+ UNPACK_VALUE(EC_PALETTE_CHANGED);
+ UNPACK_VALUE(EC_VIDEO_SIZE_CHANGED);
+ UNPACK_VALUE(EC_QUALITY_CHANGE);
+ UNPACK_VALUE(EC_SHUTTING_DOWN);
+ UNPACK_VALUE(EC_CLOCK_CHANGED);
+ UNPACK_VALUE(EC_PAUSED);
+ UNPACK_VALUE(EC_OPENING_FILE);
+ UNPACK_VALUE(EC_BUFFERING_DATA);
+ UNPACK_VALUE(EC_FULLSCREEN_LOST);
+ UNPACK_VALUE(EC_ACTIVATE);
+ UNPACK_VALUE(EC_NEED_RESTART);
+ UNPACK_VALUE(EC_WINDOW_DESTROYED);
+ UNPACK_VALUE(EC_DISPLAY_CHANGED);
+ UNPACK_VALUE(EC_STARVATION);
+ UNPACK_VALUE(EC_OLE_EVENT);
+ UNPACK_VALUE(EC_NOTIFY_WINDOW);
+ UNPACK_VALUE(EC_STREAM_CONTROL_STOPPED);
+ UNPACK_VALUE(EC_STREAM_CONTROL_STARTED);
+ UNPACK_VALUE(EC_END_OF_SEGMENT);
+ UNPACK_VALUE(EC_SEGMENT_STARTED);
+ UNPACK_VALUE(EC_LENGTH_CHANGED);
+ UNPACK_VALUE(EC_DEVICE_LOST);
+ UNPACK_VALUE(EC_SAMPLE_NEEDED);
+ UNPACK_VALUE(EC_PROCESSING_LATENCY);
+ UNPACK_VALUE(EC_SAMPLE_LATENCY);
+ UNPACK_VALUE(EC_SCRUB_TIME);
+ UNPACK_VALUE(EC_STEP_COMPLETE);
+ UNPACK_VALUE(EC_TIMECODE_AVAILABLE);
+ UNPACK_VALUE(EC_EXTDEVICE_MODE_CHANGE);
+ UNPACK_VALUE(EC_STATE_CHANGE);
+ UNPACK_VALUE(EC_GRAPH_CHANGED);
+ UNPACK_VALUE(EC_CLOCK_UNSET);
+ UNPACK_VALUE(EC_VMR_RENDERDEVICE_SET);
+ UNPACK_VALUE(EC_VMR_SURFACE_FLIPPED);
+ UNPACK_VALUE(EC_VMR_RECONNECTION_FAILED);
+ UNPACK_VALUE(EC_PREPROCESS_COMPLETE);
+ UNPACK_VALUE(EC_CODECAPI_EVENT);
+ UNPACK_VALUE(EC_WMT_INDEX_EVENT);
+ UNPACK_VALUE(EC_WMT_EVENT);
+ UNPACK_VALUE(EC_BUILT);
+ UNPACK_VALUE(EC_UNBUILT);
+ UNPACK_VALUE(EC_SKIP_FRAMES);
+ UNPACK_VALUE(EC_PLEASE_REOPEN);
+ UNPACK_VALUE(EC_STATUS);
+ UNPACK_VALUE(EC_MARKER_HIT);
+ UNPACK_VALUE(EC_LOADSTATUS);
+ UNPACK_VALUE(EC_FILE_CLOSED);
+ UNPACK_VALUE(EC_ERRORABORTEX);
+ //UNPACK_VALUE(EC_NEW_PIN);
+ //UNPACK_VALUE(EC_RENDER_FINISHED);
+ UNPACK_VALUE(EC_EOS_SOON);
+ UNPACK_VALUE(EC_CONTENTPROPERTY_CHANGED);
+ UNPACK_VALUE(EC_BANDWIDTHCHANGE);
+ UNPACK_VALUE(EC_VIDEOFRAMEREADY);
+
+ UNPACK_VALUE(EC_BG_AUDIO_CHANGED);
+ UNPACK_VALUE(EC_BG_ERROR);
};
#undef UNPACK_VALUE
return _T("UNKNOWN");
@@ -642,14 +637,15 @@ CMainFrame::CMainFrame() : CMainFrame::~CMainFrame()
{
-// m_owner.DestroyWindow();
+ // m_owner.DestroyWindow();
//delete m_pFullscreenWnd; // double delete see CMainFrame::OnDestroy
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if(__super::OnCreate(lpCreateStruct) == -1)
+ if(__super::OnCreate(lpCreateStruct) == -1) {
return -1;
+ }
m_popup.LoadMenu(IDR_POPUP);
m_popupmain.LoadMenu(IDR_POPUPMAIN);
@@ -658,8 +654,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) // create a view to occupy the client area of the frame
if(!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
- CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
- {
+ CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL)) {
TRACE0("Failed to create view window\n");
return -1;
}
@@ -667,16 +662,19 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) // static bars
BOOL bResult = m_wndStatusBar.Create(this);
- if(bResult)
+ if(bResult) {
bResult = m_wndStatsBar.Create(this);
- if(bResult)
+ }
+ if(bResult) {
bResult = m_wndInfoBar.Create(this);
- if(bResult)
+ }
+ if(bResult) {
bResult = m_wndToolBar.Create(this);
- if(bResult)
+ }
+ if(bResult) {
bResult = m_wndSeekBar.Create(this);
- if(!bResult)
- {
+ }
+ if(!bResult) {
TRACE0("Failed to create all control bars\n");
return -1; // fail to create
}
@@ -747,15 +745,16 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) m_pGraphThread = (CGraphThread*)AfxBeginThread(RUNTIME_CLASS(CGraphThread));
- if(m_pGraphThread)
+ if(m_pGraphThread) {
m_pGraphThread->SetMainFrame(this);
+ }
- if(s.nCmdlnWebServerPort != 0)
- {
- if(s.nCmdlnWebServerPort > 0)
+ if(s.nCmdlnWebServerPort != 0) {
+ if(s.nCmdlnWebServerPort > 0) {
StartWebServer(s.nCmdlnWebServerPort);
- else if(s.fEnableWebServer)
+ } else if(s.fEnableWebServer) {
StartWebServer(s.nWebServerPort);
+ }
}
// Casimir666 : reload Shaders
@@ -765,8 +764,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) int curPos= 0;
strRes = strList.Tokenize (_T("|"), curPos);
- while (strRes != _T(""))
- {
+ while (strRes != _T("")) {
m_shaderlabels.AddTail (strRes);
strRes = strList.Tokenize(_T("|"),curPos);
}
@@ -777,8 +775,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) int curPos= 0;
strRes = strList.Tokenize (_T("|"), curPos);
- while (strRes != _T(""))
- {
+ while (strRes != _T("")) {
m_shaderlabelsScreenSpace.AddTail (strRes);
strRes = strList.Tokenize(_T("|"),curPos);
}
@@ -809,21 +806,19 @@ void CMainFrame::OnDestroy() m_fileDropTarget.Revoke();
- if ( m_pGraphThread )
- {
+ if ( m_pGraphThread ) {
CAMEvent e;
m_pGraphThread->PostThreadMessage( CGraphThread::TM_EXIT, 0, (LPARAM)&e );
- if( !e.Wait(5000) )
- {
+ if( !e.Wait(5000) ) {
TRACE(_T("ERROR: Must call TerminateThread() on CMainFrame::m_pGraphThread->m_hThread\n"));
TerminateThread( m_pGraphThread->m_hThread, (DWORD)-1 );
}
}
- if ( m_pFullscreenWnd )
- {
- if ( m_pFullscreenWnd->IsWindow() )
+ if ( m_pFullscreenWnd ) {
+ if ( m_pFullscreenWnd->IsWindow() ) {
m_pFullscreenWnd->DestroyWindow();
+ }
delete m_pFullscreenWnd;
}
@@ -839,8 +834,7 @@ void CMainFrame::OnClose() CString strList = "";
pos = m_shaderlabels.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
strList += m_shaderlabels.GetAt (pos) + "|";
m_dockingbars.GetNext(pos);
}
@@ -851,8 +845,7 @@ void CMainFrame::OnClose() CString strList = "";
pos = m_shaderlabelsScreenSpace.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
strList += m_shaderlabelsScreenSpace.GetAt (pos) + "|";
m_dockingbars.GetNext(pos);
}
@@ -890,14 +883,11 @@ BOOL CMainFrame::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoi BOOL bResult = FALSE;
- if(pDataObject->IsDataAvailable(CF_URL))
- {
+ if(pDataObject->IsDataAvailable(CF_URL)) {
FORMATETC fmt = {CF_URL, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
- if(HGLOBAL hGlobal = pDataObject->GetGlobalData(CF_URL, &fmt))
- {
+ if(HGLOBAL hGlobal = pDataObject->GetGlobalData(CF_URL, &fmt)) {
LPCSTR pText = (LPCSTR)GlobalLock(hGlobal);
- if(AfxIsValidString(pText))
- {
+ if(AfxIsValidString(pText)) {
CStringA url(pText);
SetForegroundWindow();
@@ -905,12 +895,9 @@ BOOL CMainFrame::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoi CAtlList<CString> sl;
sl.AddTail(CString(url));
- if(m_wndPlaylistBar.IsWindowVisible())
- {
+ if(m_wndPlaylistBar.IsWindowVisible()) {
m_wndPlaylistBar.Append(sl, true);
- }
- else
- {
+ } else {
m_wndPlaylistBar.Open(sl, true);
OpenCurPlaylistItem();
}
@@ -942,29 +929,32 @@ LPCTSTR CMainFrame::GetRecentFile() {
CRecentFileList& MRU = AfxGetAppSettings().MRU;
MRU.ReadList();
- for(int i = 0; i < MRU.GetSize(); i++)
- {
- if(!MRU[i].IsEmpty())
+ for(int i = 0; i < MRU.GetSize(); i++) {
+ if(!MRU[i].IsEmpty()) {
return MRU[i].GetString();
+ }
}
return NULL;
}
void CMainFrame::LoadControlBar(CControlBar* pBar, UINT defDockBarID)
{
- if(!pBar) return;
+ if(!pBar) {
+ return;
+ }
CString str;
pBar->GetWindowText(str);
- if(str.IsEmpty()) return;
+ if(str.IsEmpty()) {
+ return;
+ }
CString section = _T("ToolBars\\") + str;
CWinApp* pApp = AfxGetApp();
UINT nID = pApp->GetProfileInt(section, _T("DockState"), defDockBarID);
- if(nID != AFX_IDW_DOCKBAR_FLOAT)
- {
+ if(nID != AFX_IDW_DOCKBAR_FLOAT) {
DockControlBar(pBar, nID);
}
@@ -978,8 +968,7 @@ void CMainFrame::LoadControlBar(CControlBar* pBar, UINT defDockBarID) ? SW_SHOW
: SW_HIDE);
- if(CSizingControlBar* pSCB = dynamic_cast<CSizingControlBar*>(pBar))
- {
+ if(CSizingControlBar* pSCB = dynamic_cast<CSizingControlBar*>(pBar)) {
pSCB->LoadState(section + _T("\\State"));
m_dockingbars.AddTail(pSCB);
}
@@ -993,27 +982,36 @@ void CMainFrame::RestoreFloatingControlBars() GetWindowRect(r);
POSITION pos = m_dockingbars.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CSizingControlBar* pBar = m_dockingbars.GetNext(pos);
CString str;
pBar->GetWindowText(str);
- if(str.IsEmpty()) return;
+ if(str.IsEmpty()) {
+ return;
+ }
CString section = _T("ToolBars\\") + str;
- if((pBar == &m_wndPlaylistBar) && pApp->GetProfileInt(section, _T("Visible"), FALSE))
+ if((pBar == &m_wndPlaylistBar) && pApp->GetProfileInt(section, _T("Visible"), FALSE)) {
pBar->ShowWindow(SW_SHOW);
+ }
- if(pApp->GetProfileInt(section, _T("DockState"), ~AFX_IDW_DOCKBAR_FLOAT) == AFX_IDW_DOCKBAR_FLOAT)
- {
+ if(pApp->GetProfileInt(section, _T("DockState"), ~AFX_IDW_DOCKBAR_FLOAT) == AFX_IDW_DOCKBAR_FLOAT) {
CPoint p;
p.x = pApp->GetProfileInt(section, _T("DockPosX"), r.right);
p.y = pApp->GetProfileInt(section, _T("DockPosY"), r.top);
- if(p.x < m_rcDesktop.left) p.x = m_rcDesktop.left;
- if(p.y < m_rcDesktop.top) p.y = m_rcDesktop.top;
- if(p.x >= m_rcDesktop.right) p.x = m_rcDesktop.right-1;
- if(p.y >= m_rcDesktop.bottom) p.y = m_rcDesktop.bottom-1;
+ if(p.x < m_rcDesktop.left) {
+ p.x = m_rcDesktop.left;
+ }
+ if(p.y < m_rcDesktop.top) {
+ p.y = m_rcDesktop.top;
+ }
+ if(p.x >= m_rcDesktop.right) {
+ p.x = m_rcDesktop.right-1;
+ }
+ if(p.y >= m_rcDesktop.bottom) {
+ p.y = m_rcDesktop.bottom-1;
+ }
FloatControlBar(pBar, p);
}
}
@@ -1024,26 +1022,25 @@ void CMainFrame::SaveControlBars() CWinApp* pApp = AfxGetApp();
POSITION pos = m_dockingbars.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CSizingControlBar* pBar = m_dockingbars.GetNext(pos);
CString str;
pBar->GetWindowText(str);
- if(str.IsEmpty()) return;
+ if(str.IsEmpty()) {
+ return;
+ }
CString section = _T("ToolBars\\") + str;
pApp->WriteProfileInt(section, _T("Visible"), pBar->IsWindowVisible());
- if(CSizingControlBar* pSCB = dynamic_cast<CSizingControlBar*>(pBar))
- {
+ if(CSizingControlBar* pSCB = dynamic_cast<CSizingControlBar*>(pBar)) {
pSCB->SaveState(section + _T("\\State"));
}
UINT nID = pBar->GetParent()->GetDlgCtrlID();
- if(nID == AFX_IDW_DOCKBAR_FLOAT)
- {
+ if(nID == AFX_IDW_DOCKBAR_FLOAT) {
CRect r;
pBar->GetParent()->GetParent()->GetWindowRect(r);
pApp->WriteProfileInt(section, _T("DockPosX"), r.left);
@@ -1064,41 +1061,39 @@ LRESULT CMainFrame::OnTaskBarRestart(WPARAM, LPARAM) LRESULT CMainFrame::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
{
- if((UINT)wParam != IDR_MAINFRAME)
+ if((UINT)wParam != IDR_MAINFRAME) {
return -1;
+ }
- switch((UINT)lParam)
- {
- case WM_LBUTTONDOWN:
- ShowWindow(SW_SHOW);
- MoveVideoWindow();
- SetForegroundWindow();
- break;
+ switch((UINT)lParam) {
+ case WM_LBUTTONDOWN:
+ ShowWindow(SW_SHOW);
+ MoveVideoWindow();
+ SetForegroundWindow();
+ break;
- case WM_LBUTTONDBLCLK:
- PostMessage(WM_COMMAND, ID_FILE_OPENMEDIA);
- break;
+ case WM_LBUTTONDBLCLK:
+ PostMessage(WM_COMMAND, ID_FILE_OPENMEDIA);
+ break;
- case WM_RBUTTONDOWN:
- {
- POINT p;
- GetCursorPos(&p);
- SetForegroundWindow();
- m_popupmain.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTBUTTON|TPM_NOANIMATION, p.x, p.y, GetModalParent());
- PostMessage(WM_NULL);
- break;
- }
+ case WM_RBUTTONDOWN: {
+ POINT p;
+ GetCursorPos(&p);
+ SetForegroundWindow();
+ m_popupmain.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTBUTTON|TPM_NOANIMATION, p.x, p.y, GetModalParent());
+ PostMessage(WM_NULL);
+ break;
+ }
- case WM_MOUSEMOVE:
- {
- CString str;
- GetWindowText(str);
- SetTrayTip(str);
- break;
- }
+ case WM_MOUSEMOVE: {
+ CString str;
+ GetWindowText(str);
+ SetTrayTip(str);
+ break;
+ }
- default:
- break;
+ default:
+ break;
}
return 0;
@@ -1119,10 +1114,8 @@ void CMainFrame::ShowTrayIcon(bool fShow) tnid.hWnd = m_hWnd;
tnid.uID = IDR_MAINFRAME;
- if(fShow)
- {
- if(!m_fTrayIcon)
- {
+ if(fShow) {
+ if(!m_fTrayIcon) {
tnid.hIcon = (HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
tnid.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP;
tnid.uCallbackMessage = WM_NOTIFYICON;
@@ -1131,19 +1124,17 @@ void CMainFrame::ShowTrayIcon(bool fShow) m_fTrayIcon = true;
}
- }
- else
- {
- if(m_fTrayIcon)
- {
+ } else {
+ if(m_fTrayIcon) {
Shell_NotifyIcon(NIM_DELETE, &tnid);
m_fTrayIcon = false;
}
}
- if(bWasVisible)
+ if(bWasVisible) {
ShowWindow(SW_SHOW);
+ }
}
void CMainFrame::SetTrayTip(CString str)
@@ -1159,8 +1150,9 @@ void CMainFrame::SetTrayTip(CString str) BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!__super::PreCreateWindow(cs))
+ if(!__super::PreCreateWindow(cs)) {
return FALSE;
+ }
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
@@ -1171,44 +1163,35 @@ BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN)
- {
+ if(pMsg->message == WM_KEYDOWN) {
/* if(m_fShockwaveGraph
&& (pMsg->wParam == VK_LEFT || pMsg->wParam == VK_RIGHT
|| pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN))
return FALSE;
*/
- if(pMsg->wParam == VK_ESCAPE)
- {
+ if(pMsg->wParam == VK_ESCAPE) {
bool fEscapeNotAssigned = true;
AppSettings& s = AfxGetAppSettings();
POSITION pos = s.wmcmds.GetHeadPosition();
while(pos && fEscapeNotAssigned)
- if(s.wmcmds.GetNext(pos).key == VK_ESCAPE)
+ if(s.wmcmds.GetNext(pos).key == VK_ESCAPE) {
fEscapeNotAssigned = false;
+ }
- if(fEscapeNotAssigned)
- {
- if(m_iMediaLoadState == MLS_LOADED && m_fFullScreen)
- {
+ if(fEscapeNotAssigned) {
+ if(m_iMediaLoadState == MLS_LOADED && m_fFullScreen) {
OnViewFullscreen();
PostMessage(WM_COMMAND, ID_PLAY_PAUSE);
return TRUE;
- }
- else if(IsCaptionMenuHidden())
- {
+ } else if(IsCaptionMenuHidden()) {
PostMessage(WM_COMMAND, ID_VIEW_CAPTIONMENU);
return TRUE;
}
}
- }
- else if(pMsg->wParam == VK_LEFT && pAMTuner)
- {
+ } else if(pMsg->wParam == VK_LEFT && pAMTuner) {
PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPBACK);
return TRUE;
- }
- else if(pMsg->wParam == VK_RIGHT && pAMTuner)
- {
+ } else if(pMsg->wParam == VK_RIGHT && pAMTuner) {
PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD);
return TRUE;
}
@@ -1253,28 +1236,30 @@ void CMainFrame::OnSetFocus(CWnd* pOldWnd) SetAlwaysOnTop(AfxGetAppSettings().iOnTop);
// forward focus to the view window
- if(IsWindow(m_wndView.m_hWnd))
+ if(IsWindow(m_wndView.m_hWnd)) {
m_wndView.SetFocus();
+ }
}
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
// let the view have first crack at the command
- if(m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
+ if(m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) {
return TRUE;
+ }
POSITION pos = m_bars.GetHeadPosition();
- while(pos)
- {
- if(m_bars.GetNext(pos)->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
+ while(pos) {
+ if(m_bars.GetNext(pos)->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) {
return TRUE;
+ }
}
pos = m_dockingbars.GetHeadPosition();
- while(pos)
- {
- if(m_dockingbars.GetNext(pos)->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
+ while(pos) {
+ if(m_dockingbars.GetNext(pos)->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) {
return TRUE;
+ }
}
// otherwise, do default handling
@@ -1291,44 +1276,45 @@ void CMainFrame::OnGetMinMaxInfo(MINMAXINFO* lpMMI) ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi);
lpMMI->ptMinTrackSize.x = 0;
- if ( !IsCaptionMenuHidden() )
- {
+ if ( !IsCaptionMenuHidden() ) {
// Calculate menu's horizontal length in pixels
lpMMI->ptMinTrackSize.x = 10;
CRect r;
- for (int i = 0; ::GetMenuItemRect(m_hWnd, mbi.hMenu, i, &r); i++)
+ for (int i = 0; ::GetMenuItemRect(m_hWnd, mbi.hMenu, i, &r); i++) {
lpMMI->ptMinTrackSize.x += r.Width();
+ }
lpMMI->ptMinTrackSize.x = max( m_wndToolBar.GetMinWidth(), lpMMI->ptMinTrackSize.x );
}
- if ( style & WS_THICKFRAME )
+ if ( style & WS_THICKFRAME ) {
lpMMI->ptMinTrackSize.x += GetSystemMetrics( (style & WS_CAPTION) ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME ) * 2;
+ }
lpMMI->ptMinTrackSize.y = 0;
- if ( style & WS_CAPTION )
- {
+ if ( style & WS_CAPTION ) {
lpMMI->ptMinTrackSize.y += GetSystemMetrics( SM_CYCAPTION );
// If we have a caption then we have a menu bar
lpMMI->ptMinTrackSize.y += GetSystemMetrics( SM_CYMENU ); //(mbi.rcBar.bottom - mbi.rcBar.top);
}
- if ( style & WS_THICKFRAME )
+ if ( style & WS_THICKFRAME ) {
lpMMI->ptMinTrackSize.y += GetSystemMetrics( SM_CYSIZEFRAME ) * 2;
+ }
POSITION pos = m_bars.GetHeadPosition();
- while ( pos )
- {
+ while ( pos ) {
CControlBar *pCB = m_bars.GetNext( pos );
- if ( !IsWindow(pCB->m_hWnd) || !pCB->IsVisible() )
+ if ( !IsWindow(pCB->m_hWnd) || !pCB->IsVisible() ) {
continue;
+ }
lpMMI->ptMinTrackSize.y += pCB->CalcFixedLayout(TRUE, TRUE).cy;
}
pos = m_dockingbars.GetHeadPosition();
- while ( pos )
- {
+ while ( pos ) {
CSizingControlBar *pCB = m_dockingbars.GetNext( pos );
- if ( IsWindow(pCB->m_hWnd) && pCB->IsWindowVisible() && !pCB->IsFloating() )
- lpMMI->ptMinTrackSize.y += pCB->CalcFixedLayout(TRUE, TRUE).cy - 2; // 2 is a magic value from CSizingControlBar class, i guess this should be GetSystemMetrics( SM_CXBORDER ) or similar
+ if ( IsWindow(pCB->m_hWnd) && pCB->IsWindowVisible() && !pCB->IsFloating() ) {
+ lpMMI->ptMinTrackSize.y += pCB->CalcFixedLayout(TRUE, TRUE).cy - 2; // 2 is a magic value from CSizingControlBar class, i guess this should be GetSystemMetrics( SM_CXBORDER ) or similar
+ }
}
__super::OnGetMinMaxInfo( lpMMI );
@@ -1343,16 +1329,16 @@ void CMainFrame::OnMove(int x, int y) WINDOWPLACEMENT wp;
GetWindowPlacement(&wp);
- if(!m_fFirstFSAfterLaunchOnFS && !m_fFullScreen && wp.flags != WPF_RESTORETOMAXIMIZED && wp.showCmd != SW_SHOWMINIMIZED)
+ if(!m_fFirstFSAfterLaunchOnFS && !m_fFullScreen && wp.flags != WPF_RESTORETOMAXIMIZED && wp.showCmd != SW_SHOWMINIMIZED) {
GetWindowRect(AfxGetAppSettings().rcLastWindowPos);
+ }
}
void CMainFrame::OnMoving(UINT fwSide, LPRECT pRect)
{
__super::OnMoving(fwSide, pRect);
- if(AfxGetAppSettings().fSnapToDesktopEdges)
- {
+ if(AfxGetAppSettings().fSnapToDesktopEdges) {
const CPoint threshold(3, 3);
CRect r0 = m_rcDesktop;
@@ -1362,17 +1348,21 @@ void CMainFrame::OnMoving(UINT fwSide, LPRECT pRect) RECT& wr = *pRect;
CSize ws = CRect(wr).Size();
- if(wr.left < r1.left && wr.left > r2.left)
+ if(wr.left < r1.left && wr.left > r2.left) {
wr.right = (wr.left = r0.left) + ws.cx;
+ }
- if(wr.top < r1.top && wr.top > r2.top)
+ if(wr.top < r1.top && wr.top > r2.top) {
wr.bottom = (wr.top = r0.top) + ws.cy;
+ }
- if(wr.right < r1.right && wr.right > r2.right)
+ if(wr.right < r1.right && wr.right > r2.right) {
wr.left = (wr.right = r0.right) - ws.cx;
+ }
- if(wr.bottom < r1.bottom && wr.bottom > r2.bottom)
+ if(wr.bottom < r1.bottom && wr.bottom > r2.bottom) {
wr.top = (wr.bottom = r0.bottom) - ws.cy;
+ }
}
}
@@ -1382,16 +1372,15 @@ void CMainFrame::OnSize(UINT nType, int cx, int cy) m_OSD.OnSize (nType, cx, cy);
- if(nType == SIZE_RESTORED && m_fTrayIcon)
- {
+ if(nType == SIZE_RESTORED && m_fTrayIcon) {
ShowWindow(SW_SHOW);
}
- if(!m_fFirstFSAfterLaunchOnFS && IsWindowVisible() && !m_fFullScreen)
- {
+ if(!m_fFirstFSAfterLaunchOnFS && IsWindowVisible() && !m_fFullScreen) {
AppSettings& s = AfxGetAppSettings();
- if(nType != SIZE_MAXIMIZED && nType != SIZE_MINIMIZED)
+ if(nType != SIZE_MAXIMIZED && nType != SIZE_MINIMIZED) {
GetWindowRect(s.rcLastWindowPos);
+ }
s.nLastWindowType = nType;
}
}
@@ -1406,15 +1395,17 @@ void CMainFrame::OnSizing(UINT fwSide, LPRECT pRect) if(m_iMediaLoadState != MLS_LOADED || m_fFullScreen
|| s.iDefaultVideoSize == DVS_STRETCH
- || (fCtrl == s.fLimitWindowProportions)) // remember that fCtrl is initialized with !!whatever(), same with fLimitWindowProportions
+ || (fCtrl == s.fLimitWindowProportions)) { // remember that fCtrl is initialized with !!whatever(), same with fLimitWindowProportions
return;
+ }
CSize wsize(pRect->right - pRect->left, pRect->bottom - pRect->top);
CSize vsize = GetVideoSize();
CSize fsize(0, 0);
- if(!vsize.cx || !vsize.cy)
+ if(!vsize.cx || !vsize.cy) {
return;
+ }
// TODO
{
@@ -1426,37 +1417,37 @@ void CMainFrame::OnSizing(UINT fwSide, LPRECT pRect) //mbi.cbSize = sizeof(mbi);
//::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi);
- if ( style & WS_THICKFRAME )
+ if ( style & WS_THICKFRAME ) {
fsize.cx += GetSystemMetrics( SM_CXSIZEFRAME ) * 2;
+ }
- if ( style & WS_CAPTION )
- {
+ if ( style & WS_CAPTION ) {
fsize.cy += GetSystemMetrics( SM_CYCAPTION );
// If we have a caption then we have a menu bar
fsize.cy += GetSystemMetrics( SM_CYMENU ); //mbi.rcBar.bottom - mbi.rcBar.top;
}
- if ( style & WS_THICKFRAME )
+ if ( style & WS_THICKFRAME ) {
fsize.cy += GetSystemMetrics( SM_CYSIZEFRAME ) * 2;
+ }
POSITION pos = m_bars.GetHeadPosition();
- while ( pos )
- {
+ while ( pos ) {
CControlBar * pCB = m_bars.GetNext( pos );
- if ( IsWindow(pCB->m_hWnd) && pCB->IsVisible() )
+ if ( IsWindow(pCB->m_hWnd) && pCB->IsVisible() ) {
fsize.cy += pCB->CalcFixedLayout(TRUE, TRUE).cy;
+ }
}
pos = m_dockingbars.GetHeadPosition();
- while ( pos )
- {
+ while ( pos ) {
CSizingControlBar *pCB = m_dockingbars.GetNext( pos );
- if ( IsWindow(pCB->m_hWnd) && pCB->IsWindowVisible() && !pCB->IsFloating() )
- {
- if ( pCB->IsHorzDocked() )
+ if ( IsWindow(pCB->m_hWnd) && pCB->IsWindowVisible() && !pCB->IsFloating() ) {
+ if ( pCB->IsHorzDocked() ) {
fsize.cy += pCB->CalcFixedLayout(TRUE, TRUE).cy - 2;
- else if ( pCB->IsVertDocked() )
+ } else if ( pCB->IsVertDocked() ) {
fsize.cx += pCB->CalcFixedLayout(TRUE, FALSE).cx;
+ }
}
}
}
@@ -1471,20 +1462,13 @@ void CMainFrame::OnSizing(UINT fwSide, LPRECT pRect) wsize += fsize;
- if(fwSide == WMSZ_TOP || fwSide == WMSZ_BOTTOM || !fWider && (fwSide == WMSZ_TOPRIGHT || fwSide == WMSZ_BOTTOMRIGHT))
- {
+ if(fwSide == WMSZ_TOP || fwSide == WMSZ_BOTTOM || !fWider && (fwSide == WMSZ_TOPRIGHT || fwSide == WMSZ_BOTTOMRIGHT)) {
pRect->right = pRect->left + wsize.cx;
- }
- else if(fwSide == WMSZ_LEFT || fwSide == WMSZ_RIGHT || fWider && (fwSide == WMSZ_BOTTOMLEFT || fwSide == WMSZ_BOTTOMRIGHT))
- {
+ } else if(fwSide == WMSZ_LEFT || fwSide == WMSZ_RIGHT || fWider && (fwSide == WMSZ_BOTTOMLEFT || fwSide == WMSZ_BOTTOMRIGHT)) {
pRect->bottom = pRect->top + wsize.cy;
- }
- else if(!fWider && (fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_BOTTOMLEFT))
- {
+ } else if(!fWider && (fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_BOTTOMLEFT)) {
pRect->left = pRect->right - wsize.cx;
- }
- else if(fWider && (fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_TOPRIGHT))
- {
+ } else if(fWider && (fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_TOPRIGHT)) {
pRect->top = pRect->bottom - wsize.cy;
}
}
@@ -1498,15 +1482,13 @@ void CMainFrame::OnDisplayChange() // untested, not sure if it's working... */
GetDesktopWindow()->GetWindowRect(&m_rcDesktop);
- if (m_pFullscreenWnd && m_pFullscreenWnd->IsWindow())
- {
+ if (m_pFullscreenWnd && m_pFullscreenWnd->IsWindow()) {
MONITORINFO MonitorInfo;
HMONITOR hMonitor;
ZeroMemory (&MonitorInfo, sizeof(MonitorInfo));
MonitorInfo.cbSize = sizeof(MonitorInfo);
hMonitor = MonitorFromWindow (m_pFullscreenWnd->m_hWnd, 0);
- if (GetMonitorInfo (hMonitor, &MonitorInfo))
- {
+ if (GetMonitorInfo (hMonitor, &MonitorInfo)) {
CRect MonitorRect = CRect (MonitorInfo.rcMonitor);
m_fullWndSize.cx = MonitorRect.Width();
m_fullWndSize.cy = MonitorRect.Height();
@@ -1525,13 +1507,10 @@ void CMainFrame::OnDisplayChange() // untested, not sure if it's working... void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
// Only stop screensaver if video playing; allow for audio only
- if ((GetMediaState() == State_Running && !m_fAudioOnly) && (((nID & 0xFFF0) == SC_SCREENSAVE) || ((nID & 0xFFF0) == SC_MONITORPOWER)))
- {
+ if ((GetMediaState() == State_Running && !m_fAudioOnly) && (((nID & 0xFFF0) == SC_SCREENSAVE) || ((nID & 0xFFF0) == SC_MONITORPOWER))) {
TRACE(_T("SC_SCREENSAVE, nID = %d, lParam = %d\n"), nID, lParam);
return;
- }
- else if((nID & 0xFFF0) == SC_MINIMIZE && m_fTrayIcon)
- {
+ } else if((nID & 0xFFF0) == SC_MINIMIZE && m_fTrayIcon) {
ShowWindow(SW_HIDE);
return;
}
@@ -1547,38 +1526,33 @@ void CMainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID) mi.cbSize = sizeof(MONITORINFO);
GetMonitorInfo(MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), &mi);
- if(!bActive && (mi.dwFlags&MONITORINFOF_PRIMARY) && m_fFullScreen && m_iMediaLoadState == MLS_LOADED)
- {
+ if(!bActive && (mi.dwFlags&MONITORINFOF_PRIMARY) && m_fFullScreen && m_iMediaLoadState == MLS_LOADED) {
bool fExitFullscreen = true;
- if(CWnd* pWnd = GetForegroundWindow())
- {
+ if(CWnd* pWnd = GetForegroundWindow()) {
HMONITOR hMonitor1 = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
HMONITOR hMonitor2 = MonitorFromWindow(pWnd->m_hWnd, MONITOR_DEFAULTTONEAREST);
CMonitors monitors;
- if(hMonitor1 && hMonitor2 && ((hMonitor1 != hMonitor2) || (monitors.GetCount()>1))) fExitFullscreen = false;
+ if(hMonitor1 && hMonitor2 && ((hMonitor1 != hMonitor2) || (monitors.GetCount()>1))) {
+ fExitFullscreen = false;
+ }
CString title;
pWnd->GetWindowText(title);
CString module;
- if(GetVersion()&0x80000000)
- {
+ if(GetVersion()&0x80000000) {
module.ReleaseBufferSetLength(GetWindowModuleFileName(pWnd->m_hWnd, module.GetBuffer(_MAX_PATH), _MAX_PATH));
- }
- else
- {
+ } else {
DWORD pid;
GetWindowThreadProcessId(pWnd->m_hWnd, &pid);
- if(HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid))
- {
+ if(HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid)) {
HMODULE hMod;
DWORD cbNeeded;
- if(EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded))
- {
+ if(EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded)) {
module.ReleaseBufferSetLength(GetModuleFileNameEx(hProcess, hMod, module.GetBuffer(_MAX_PATH), _MAX_PATH));
}
@@ -1596,7 +1570,9 @@ void CMainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID) SendStatusMessage(str, 5000);
}
- if(fExitFullscreen) OnViewFullscreen();
+ if(fExitFullscreen) {
+ OnViewFullscreen();
+ }
}
}
@@ -1608,21 +1584,22 @@ LRESULT CMainFrame::OnAppCommand(WPARAM wParam, LPARAM lParam) if(uDevice != FAPPCOMMAND_OEM ||
cmd == APPCOMMAND_MEDIA_PLAY || cmd == APPCOMMAND_MEDIA_PAUSE || cmd == APPCOMMAND_MEDIA_CHANNEL_UP ||
cmd == APPCOMMAND_MEDIA_CHANNEL_DOWN || cmd == APPCOMMAND_MEDIA_RECORD ||
- cmd == APPCOMMAND_MEDIA_FAST_FORWARD || cmd == APPCOMMAND_MEDIA_REWIND )
- {
+ cmd == APPCOMMAND_MEDIA_FAST_FORWARD || cmd == APPCOMMAND_MEDIA_REWIND ) {
AppSettings& s = AfxGetAppSettings();
BOOL fRet = FALSE;
POSITION pos = s.wmcmds.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
wmcmd& wc = s.wmcmds.GetNext(pos);
- if(wc.appcmd == cmd && TRUE == SendMessage(WM_COMMAND, wc.cmd))
+ if(wc.appcmd == cmd && TRUE == SendMessage(WM_COMMAND, wc.cmd)) {
fRet = TRUE;
+ }
}
- if(fRet) return TRUE;
+ if(fRet) {
+ return TRUE;
+ }
}
return Default();
@@ -1634,40 +1611,37 @@ void CMainFrame::OnRawInput(UINT nInputcode, HRAWINPUT hRawInput) UINT nMceCmd = 0;
nMceCmd = AfxGetMyApp()->GetRemoteControlCode (nInputcode, hRawInput);
- switch (nMceCmd)
- {
- case MCE_DETAILS :
- case MCE_GUIDE :
- case MCE_TVJUMP :
- case MCE_STANDBY :
- case MCE_OEM1 :
- case MCE_OEM2 :
- case MCE_MYTV :
- case MCE_MYVIDEOS :
- case MCE_MYPICTURES :
- case MCE_MYMUSIC :
- case MCE_RECORDEDTV :
- case MCE_DVDANGLE :
- case MCE_DVDAUDIO :
- case MCE_DVDMENU :
- case MCE_DVDSUBTITLE :
- case MCE_RED :
- case MCE_GREEN :
- case MCE_YELLOW :
- case MCE_BLUE :
- case MCE_MEDIA_NEXTTRACK :
- case MCE_MEDIA_PREVIOUSTRACK :
- POSITION pos = s.wmcmds.GetHeadPosition();
- while(pos)
- {
- wmcmd& wc = s.wmcmds.GetNext(pos);
- if(wc.appcmd == nMceCmd)
- {
- SendMessage(WM_COMMAND, wc.cmd);
- break;
+ switch (nMceCmd) {
+ case MCE_DETAILS :
+ case MCE_GUIDE :
+ case MCE_TVJUMP :
+ case MCE_STANDBY :
+ case MCE_OEM1 :
+ case MCE_OEM2 :
+ case MCE_MYTV :
+ case MCE_MYVIDEOS :
+ case MCE_MYPICTURES :
+ case MCE_MYMUSIC :
+ case MCE_RECORDEDTV :
+ case MCE_DVDANGLE :
+ case MCE_DVDAUDIO :
+ case MCE_DVDMENU :
+ case MCE_DVDSUBTITLE :
+ case MCE_RED :
+ case MCE_GREEN :
+ case MCE_YELLOW :
+ case MCE_BLUE :
+ case MCE_MEDIA_NEXTTRACK :
+ case MCE_MEDIA_PREVIOUSTRACK :
+ POSITION pos = s.wmcmds.GetHeadPosition();
+ while(pos) {
+ wmcmd& wc = s.wmcmds.GetNext(pos);
+ if(wc.appcmd == nMceCmd) {
+ SendMessage(WM_COMMAND, wc.cmd);
+ break;
+ }
}
- }
- break;
+ break;
}
}
@@ -1676,15 +1650,14 @@ LRESULT CMainFrame::OnHotKey(WPARAM wParam, LPARAM lParam) AppSettings& s = AfxGetAppSettings();
BOOL fRet = FALSE;
- if (GetActiveWindow() == this || s.fGlobalMedia == TRUE)
- {
+ if (GetActiveWindow() == this || s.fGlobalMedia == TRUE) {
POSITION pos = s.wmcmds.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
wmcmd& wc = s.wmcmds.GetNext(pos);
- if (wc.appcmd == wParam && TRUE == SendMessage(WM_COMMAND, wc.cmd))
+ if (wc.appcmd == wParam && TRUE == SendMessage(WM_COMMAND, wc.cmd)) {
fRet = TRUE;
+ }
}
}
@@ -1696,511 +1669,480 @@ bool g_bExternalSubtitleTime = false; void CMainFrame::OnTimer(UINT_PTR nIDEvent)
{
- switch (nIDEvent)
- {
- case TIMER_STREAMPOSPOLLER:
- if(m_iMediaLoadState == MLS_LOADED)
- {
- REFERENCE_TIME rtNow = 0, rtDur = 0;
-
- if(GetPlaybackMode() == PM_FILE)
- {
- pMS->GetCurrentPosition(&rtNow);
- pMS->GetDuration(&rtDur);
-
- // Casimir666 : autosave subtitle sync after play
- if ((m_nCurSubtitle >= 0) && (m_rtCurSubPos != rtNow))
- {
- if (m_lSubtitleShift != 0)
- {
- if (m_wndSubresyncBar.SaveToDisk())
- m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_AG_SUBTITLES_SAVED), 500);
- else
- m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_MAINFRM_4));
+ switch (nIDEvent) {
+ case TIMER_STREAMPOSPOLLER:
+ if(m_iMediaLoadState == MLS_LOADED) {
+ REFERENCE_TIME rtNow = 0, rtDur = 0;
+
+ if(GetPlaybackMode() == PM_FILE) {
+ pMS->GetCurrentPosition(&rtNow);
+ pMS->GetDuration(&rtDur);
+
+ // Casimir666 : autosave subtitle sync after play
+ if ((m_nCurSubtitle >= 0) && (m_rtCurSubPos != rtNow)) {
+ if (m_lSubtitleShift != 0) {
+ if (m_wndSubresyncBar.SaveToDisk()) {
+ m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_AG_SUBTITLES_SAVED), 500);
+ } else {
+ m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_MAINFRM_4));
+ }
+ }
+ m_nCurSubtitle = -1;
+ m_lSubtitleShift = 0;
}
- m_nCurSubtitle = -1;
- m_lSubtitleShift = 0;
- }
- if(!m_fEndOfStream)
- {
- AppSettings& s = AfxGetAppSettings();
- FILE_POSITION* FilePosition = s.CurrentFilePosition();
- if (FilePosition)
- {
- FilePosition->llPosition = rtNow;
-
- LARGE_INTEGER time;
- QueryPerformanceCounter(&time);
- LARGE_INTEGER freq;
- QueryPerformanceFrequency(&freq);
- if((time.QuadPart - m_LastSaveTime.QuadPart) >= 30 * freq.QuadPart) // save every half of minute
- {
- m_LastSaveTime = time;
- if (s.fKeepHistory && s.fRememberFilePos)
- s.SaveCurrentFilePosition();
+ if(!m_fEndOfStream) {
+ AppSettings& s = AfxGetAppSettings();
+ FILE_POSITION* FilePosition = s.CurrentFilePosition();
+ if (FilePosition) {
+ FilePosition->llPosition = rtNow;
+
+ LARGE_INTEGER time;
+ QueryPerformanceCounter(&time);
+ LARGE_INTEGER freq;
+ QueryPerformanceFrequency(&freq);
+ if((time.QuadPart - m_LastSaveTime.QuadPart) >= 30 * freq.QuadPart) { // save every half of minute
+ m_LastSaveTime = time;
+ if (s.fKeepHistory && s.fRememberFilePos) {
+ s.SaveCurrentFilePosition();
+ }
+ }
}
}
- }
- if(m_rtDurationOverride >= 0) rtDur = m_rtDurationOverride;
+ if(m_rtDurationOverride >= 0) {
+ rtDur = m_rtDurationOverride;
+ }
- g_bNoDuration = rtDur <= 0;
- m_wndSeekBar.Enable(rtDur > 0);
- m_wndSeekBar.SetRange(0, rtDur);
- m_wndSeekBar.SetPos(rtNow);
- m_OSD.SetRange (0, rtDur);
- m_OSD.SetPos (rtNow);
- m_Lcd.SetMediaRange(0, rtDur);
- m_Lcd.SetMediaPos(rtNow);
- }
- else if(GetPlaybackMode() == PM_CAPTURE)
- {
- pMS->GetCurrentPosition(&rtNow);
- if(m_fCapturing && m_wndCaptureBar.m_capdlg.m_pMux)
- {
- CComQIPtr<IMediaSeeking> pMuxMS = m_wndCaptureBar.m_capdlg.m_pMux;
- if(!pMuxMS || FAILED(pMuxMS->GetCurrentPosition(&rtNow))) rtNow = 0;
- }
+ g_bNoDuration = rtDur <= 0;
+ m_wndSeekBar.Enable(rtDur > 0);
+ m_wndSeekBar.SetRange(0, rtDur);
+ m_wndSeekBar.SetPos(rtNow);
+ m_OSD.SetRange (0, rtDur);
+ m_OSD.SetPos (rtNow);
+ m_Lcd.SetMediaRange(0, rtDur);
+ m_Lcd.SetMediaPos(rtNow);
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
+ pMS->GetCurrentPosition(&rtNow);
+ if(m_fCapturing && m_wndCaptureBar.m_capdlg.m_pMux) {
+ CComQIPtr<IMediaSeeking> pMuxMS = m_wndCaptureBar.m_capdlg.m_pMux;
+ if(!pMuxMS || FAILED(pMuxMS->GetCurrentPosition(&rtNow))) {
+ rtNow = 0;
+ }
+ }
- if(m_rtDurationOverride >= 0) rtDur = m_rtDurationOverride;
+ if(m_rtDurationOverride >= 0) {
+ rtDur = m_rtDurationOverride;
+ }
- g_bNoDuration = rtDur <= 0;
- m_wndSeekBar.Enable(false);
- m_wndSeekBar.SetRange(0, rtDur);
- m_wndSeekBar.SetPos(rtNow);
- m_OSD.SetRange (0, rtDur);
- m_OSD.SetPos (rtNow);
- m_Lcd.SetMediaRange(0, rtDur);
- m_Lcd.SetMediaPos(rtNow);
- /*
- if(m_fCapturing)
- {
- if(rtNow > 10000i64*1000*60*60*3)
+ g_bNoDuration = rtDur <= 0;
+ m_wndSeekBar.Enable(false);
+ m_wndSeekBar.SetRange(0, rtDur);
+ m_wndSeekBar.SetPos(rtNow);
+ m_OSD.SetRange (0, rtDur);
+ m_OSD.SetPos (rtNow);
+ m_Lcd.SetMediaRange(0, rtDur);
+ m_Lcd.SetMediaPos(rtNow);
+ /*
+ if(m_fCapturing)
{
- m_wndCaptureBar.m_capdlg.OnRecord();
+ if(rtNow > 10000i64*1000*60*60*3)
+ {
+ m_wndCaptureBar.m_capdlg.OnRecord();
+ }
}
+ */
}
- */
- }
- if(m_pCAP && GetPlaybackMode() != PM_FILE)
- {
- g_bExternalSubtitleTime = true;
- if (pDVDI)
- {
- DVD_PLAYBACK_LOCATION2 Location;
- if (pDVDI->GetCurrentLocation(&Location) == S_OK)
- {
- double fps = Location.TimeCodeFlags == DVD_TC_FLAG_25fps ? 25.0
- : Location.TimeCodeFlags == DVD_TC_FLAG_30fps ? 30.0
- : Location.TimeCodeFlags == DVD_TC_FLAG_DropFrame ? 29.97
- : 25.0;
-
- LONGLONG rtTimeCode = HMSF2RT(Location.TimeCode, fps);
- m_pCAP->SetTime(rtTimeCode);
+ if(m_pCAP && GetPlaybackMode() != PM_FILE) {
+ g_bExternalSubtitleTime = true;
+ if (pDVDI) {
+ DVD_PLAYBACK_LOCATION2 Location;
+ if (pDVDI->GetCurrentLocation(&Location) == S_OK) {
+ double fps = Location.TimeCodeFlags == DVD_TC_FLAG_25fps ? 25.0
+ : Location.TimeCodeFlags == DVD_TC_FLAG_30fps ? 30.0
+ : Location.TimeCodeFlags == DVD_TC_FLAG_DropFrame ? 29.97
+ : 25.0;
+
+ LONGLONG rtTimeCode = HMSF2RT(Location.TimeCode, fps);
+ m_pCAP->SetTime(rtTimeCode);
+ } else {
+ m_pCAP->SetTime(/*rtNow*/m_wndSeekBar.GetPos());
+ }
+ } else {
+ // Set rtNow to support DVB subtitle
+ m_pCAP->SetTime(rtNow);
}
- else
- m_pCAP->SetTime(/*rtNow*/m_wndSeekBar.GetPos());
- }
- else
- {
- // Set rtNow to support DVB subtitle
- m_pCAP->SetTime(rtNow);
+ } else {
+ g_bExternalSubtitleTime = false;
}
}
- else
- g_bExternalSubtitleTime = false;
- }
- break;
- case TIMER_STREAMPOSPOLLER2:
- if (m_iMediaLoadState == MLS_LOADED)
- {
- __int64 start, stop, pos;
- m_wndSeekBar.GetRange(start, stop);
- pos = m_wndSeekBar.GetPosReal();
-
- GUID tf;
- pMS->GetTimeFormat(&tf);
+ break;
+ case TIMER_STREAMPOSPOLLER2:
+ if (m_iMediaLoadState == MLS_LOADED) {
+ __int64 start, stop, pos;
+ m_wndSeekBar.GetRange(start, stop);
+ pos = m_wndSeekBar.GetPosReal();
+
+ GUID tf;
+ pMS->GetTimeFormat(&tf);
+
+ if(GetPlaybackMode() == PM_CAPTURE && !m_fCapturing) {
+ CString str = _T("Live");
+
+ long lChannel = 0, lVivSub = 0, lAudSub = 0;
+ if(pAMTuner
+ && m_wndCaptureBar.m_capdlg.IsTunerActive()
+ && SUCCEEDED(pAMTuner->get_Channel(&lChannel, &lVivSub, &lAudSub))) {
+ CString ch;
+ ch.Format(_T(" (ch%d)"), lChannel);
+ str += ch;
+ }
- if(GetPlaybackMode() == PM_CAPTURE && !m_fCapturing)
- {
- CString str = _T("Live");
+ m_wndStatusBar.SetStatusTimer(str);
+ } else {
+ m_wndStatusBar.SetStatusTimer(pos, stop, !!m_wndSubresyncBar.IsWindowVisible(), &tf);
+ if (m_bRemainingTime) {
+ m_OSD.DisplayMessage(OSD_TOPLEFT, m_wndStatusBar.GetStatusTimer());
+ }
- long lChannel = 0, lVivSub = 0, lAudSub = 0;
- if(pAMTuner
- && m_wndCaptureBar.m_capdlg.IsTunerActive()
- && SUCCEEDED(pAMTuner->get_Channel(&lChannel, &lVivSub, &lAudSub)))
- {
- CString ch;
- ch.Format(_T(" (ch%d)"), lChannel);
- str += ch;
}
- m_wndStatusBar.SetStatusTimer(str);
- }
- else
- {
- m_wndStatusBar.SetStatusTimer(pos, stop, !!m_wndSubresyncBar.IsWindowVisible(), &tf);
- if (m_bRemainingTime) m_OSD.DisplayMessage(OSD_TOPLEFT, m_wndStatusBar.GetStatusTimer());
+ m_wndSubresyncBar.SetTime(pos);
+ if(m_pCAP && GetMediaState() == State_Paused) {
+ m_pCAP->Paint(false);
+ }
}
+ break;
+ case TIMER_FULLSCREENCONTROLBARHIDER: {
+ CPoint p;
+ GetCursorPos(&p);
- m_wndSubresyncBar.SetTime(pos);
+ CRect r;
+ GetWindowRect(r);
+ bool fCursorOutside = !r.PtInRect(p);
- if(m_pCAP && GetMediaState() == State_Paused)
- m_pCAP->Paint(false);
+ CWnd* pWnd = WindowFromPoint(p);
+ if(pWnd && (m_wndView == *pWnd || m_wndView.IsChild(pWnd) || fCursorOutside)) {
+ if(AfxGetAppSettings().nShowBarsWhenFullScreenTimeOut >= 0) {
+ ShowControls(CS_NONE, false);
+ }
+ }
}
break;
- case TIMER_FULLSCREENCONTROLBARHIDER:
- {
- CPoint p;
- GetCursorPos(&p);
-
- CRect r;
- GetWindowRect(r);
- bool fCursorOutside = !r.PtInRect(p);
-
- CWnd* pWnd = WindowFromPoint(p);
- if(pWnd && (m_wndView == *pWnd || m_wndView.IsChild(pWnd) || fCursorOutside))
- {
- if(AfxGetAppSettings().nShowBarsWhenFullScreenTimeOut >= 0)
- ShowControls(CS_NONE, false);
- }
- }
- break;
- case TIMER_FULLSCREENMOUSEHIDER:
- {
- CPoint p;
- GetCursorPos(&p);
+ case TIMER_FULLSCREENMOUSEHIDER: {
+ CPoint p;
+ GetCursorPos(&p);
- CRect r;
- GetWindowRect(r);
- bool fCursorOutside = !r.PtInRect(p);
+ CRect r;
+ GetWindowRect(r);
+ bool fCursorOutside = !r.PtInRect(p);
- if (m_pFullscreenWnd->IsWindow())
- {
- TRACE ("==> HIDE!\n");
- if (!m_bInOptions)
- m_pFullscreenWnd->ShowCursor(false);
- KillTimer(TIMER_FULLSCREENMOUSEHIDER);
- }
- else
- {
- CWnd* pWnd = WindowFromPoint(p);
- if(pWnd && (m_wndView == *pWnd || m_wndView.IsChild(pWnd) || fCursorOutside))
- {
- m_fHideCursor = true;
- SetCursor(NULL);
+ if (m_pFullscreenWnd->IsWindow()) {
+ TRACE ("==> HIDE!\n");
+ if (!m_bInOptions) {
+ m_pFullscreenWnd->ShowCursor(false);
+ }
+ KillTimer(TIMER_FULLSCREENMOUSEHIDER);
+ } else {
+ CWnd* pWnd = WindowFromPoint(p);
+ if(pWnd && (m_wndView == *pWnd || m_wndView.IsChild(pWnd) || fCursorOutside)) {
+ m_fHideCursor = true;
+ SetCursor(NULL);
+ }
}
}
- }
- break;
- case TIMER_STATS:
- {
- if(pQP)
- {
- CString rate;
- if(m_iSpeedLevel >= -11 && m_iSpeedLevel <= 3 && m_iSpeedLevel != -4)
- {
- CString speeds[] = {_T("1/8"),_T("1/4"),_T("1/2"),_T("1"),_T("2"),_T("4"),_T("8")};
- rate = speeds[(m_iSpeedLevel >= -3 ? m_iSpeedLevel : (-m_iSpeedLevel - 8)) + 3];
- if(m_iSpeedLevel < -4) rate = _T("-") + rate;
- if(!rate.IsEmpty()) rate = _T("(") + rate + _T("X)");
- }
+ break;
+ case TIMER_STATS: {
+ if(pQP) {
+ CString rate;
+ if(m_iSpeedLevel >= -11 && m_iSpeedLevel <= 3 && m_iSpeedLevel != -4) {
+ CString speeds[] = {_T("1/8"),_T("1/4"),_T("1/2"),_T("1"),_T("2"),_T("4"),_T("8")};
+ rate = speeds[(m_iSpeedLevel >= -3 ? m_iSpeedLevel : (-m_iSpeedLevel - 8)) + 3];
+ if(m_iSpeedLevel < -4) {
+ rate = _T("-") + rate;
+ }
+ if(!rate.IsEmpty()) {
+ rate = _T("(") + rate + _T("X)");
+ }
+ }
- CString info;
- int val;
+ CString info;
+ int val;
- pQP->get_AvgFrameRate(&val);
- info.Format(_T("%d.%02d %s"), val/100, val%100, rate);
- m_wndStatsBar.SetLine(ResStr(IDS_AG_FRAMERATE), info);
+ pQP->get_AvgFrameRate(&val);
+ info.Format(_T("%d.%02d %s"), val/100, val%100, rate);
+ m_wndStatsBar.SetLine(ResStr(IDS_AG_FRAMERATE), info);
- int avg, dev;
- pQP->get_AvgSyncOffset(&avg);
- pQP->get_DevSyncOffset(&dev);
- info.Format(_T("avg: %d ms, dev: %d ms"), avg, dev);
- m_wndStatsBar.SetLine(_T("Sync Offset"), info);
+ int avg, dev;
+ pQP->get_AvgSyncOffset(&avg);
+ pQP->get_DevSyncOffset(&dev);
+ info.Format(_T("avg: %d ms, dev: %d ms"), avg, dev);
+ m_wndStatsBar.SetLine(_T("Sync Offset"), info);
- int drawn, dropped;
- pQP->get_FramesDrawn(&drawn);
- pQP->get_FramesDroppedInRenderer(&dropped);
- info.Format(ResStr(IDS_MAINFRM_6), drawn, dropped);
- m_wndStatsBar.SetLine(ResStr(IDS_AG_FRAMES), info);
+ int drawn, dropped;
+ pQP->get_FramesDrawn(&drawn);
+ pQP->get_FramesDroppedInRenderer(&dropped);
+ info.Format(ResStr(IDS_MAINFRM_6), drawn, dropped);
+ m_wndStatsBar.SetLine(ResStr(IDS_AG_FRAMES), info);
- pQP->get_Jitter(&val);
- info.Format(_T("%d ms"), val);
- m_wndStatsBar.SetLine(_T("Jitter"), info);
- }
+ pQP->get_Jitter(&val);
+ info.Format(_T("%d ms"), val);
+ m_wndStatsBar.SetLine(_T("Jitter"), info);
+ }
- if(pBI)
- {
- CAtlList<CString> sl;
+ if(pBI) {
+ CAtlList<CString> sl;
- for(int i = 0, j = pBI->GetCount(); i < j; i++)
- {
- int samples, size;
- if(S_OK == pBI->GetStatus(i, samples, size))
- {
- CString str;
- str.Format(_T("[%d]: %03d/%d KB"), i, samples, size / 1024);
- sl.AddTail(str);
+ for(int i = 0, j = pBI->GetCount(); i < j; i++) {
+ int samples, size;
+ if(S_OK == pBI->GetStatus(i, samples, size)) {
+ CString str;
+ str.Format(_T("[%d]: %03d/%d KB"), i, samples, size / 1024);
+ sl.AddTail(str);
+ }
}
- }
- if(!sl.IsEmpty())
- {
- CString str;
- str.Format(_T("%s (p%d)"), Implode(sl, ' '), pBI->GetPriority());
+ if(!sl.IsEmpty()) {
+ CString str;
+ str.Format(_T("%s (p%d)"), Implode(sl, ' '), pBI->GetPriority());
- m_wndStatsBar.SetLine(ResStr(IDS_AG_BUFFERS), str);
+ m_wndStatsBar.SetLine(ResStr(IDS_AG_BUFFERS), str);
+ }
}
- }
- CInterfaceList<IBitRateInfo> pBRIs;
+ CInterfaceList<IBitRateInfo> pBRIs;
- BeginEnumFilters(pGB, pEF, pBF)
- {
- BeginEnumPins(pBF, pEP, pPin)
- {
- if(CComQIPtr<IBitRateInfo> pBRI = pPin)
- {
- pBRIs.AddTail(pBRI);
+ BeginEnumFilters(pGB, pEF, pBF) {
+ BeginEnumPins(pBF, pEP, pPin) {
+ if(CComQIPtr<IBitRateInfo> pBRI = pPin) {
+ pBRIs.AddTail(pBRI);
+ }
}
- }
- EndEnumPins;
+ EndEnumPins;
- if(!pBRIs.IsEmpty())
- {
- CAtlList<CString> sl;
+ if(!pBRIs.IsEmpty()) {
+ CAtlList<CString> sl;
- POSITION pos = pBRIs.GetHeadPosition();
- for(int i = 0; pos; i++)
- {
- IBitRateInfo* pBRI = pBRIs.GetNext(pos);
+ POSITION pos = pBRIs.GetHeadPosition();
+ for(int i = 0; pos; i++) {
+ IBitRateInfo* pBRI = pBRIs.GetNext(pos);
- DWORD cur = pBRI->GetCurrentBitRate() / 1000;
- DWORD avg = pBRI->GetAverageBitRate() / 1000;
+ DWORD cur = pBRI->GetCurrentBitRate() / 1000;
+ DWORD avg = pBRI->GetAverageBitRate() / 1000;
- if(avg == 0) continue;
+ if(avg == 0) {
+ continue;
+ }
- CString str;
- if(cur != avg) str.Format(_T("[%d]: %d/%d Kb/s"), i, avg, cur);
- else str.Format(_T("[%d]: %d Kb/s"), i, avg);
- sl.AddTail(str);
- }
+ CString str;
+ if(cur != avg) {
+ str.Format(_T("[%d]: %d/%d Kb/s"), i, avg, cur);
+ } else {
+ str.Format(_T("[%d]: %d Kb/s"), i, avg);
+ }
+ sl.AddTail(str);
+ }
- if(!sl.IsEmpty())
- {
- m_wndStatsBar.SetLine(_T("Bitrate"), Implode(sl, ' ') + _T(" (avg/cur)"));
+ if(!sl.IsEmpty()) {
+ m_wndStatsBar.SetLine(_T("Bitrate"), Implode(sl, ' ') + _T(" (avg/cur)"));
+ }
+
+ break;
}
+ }
+ EndEnumFilters;
- break;
+ if(GetPlaybackMode() == PM_FILE) {
+ SetupChapters();
}
- }
- EndEnumFilters;
- if(GetPlaybackMode() == PM_FILE)
- {
- SetupChapters();
- }
+ if(GetPlaybackMode() == PM_DVD) { // we also use this timer to update the info panel for DVD playback
+ ULONG ulAvailable, ulCurrent;
+
+ // Location
+
+ CString Location('-');
+
+ DVD_PLAYBACK_LOCATION2 loc;
+ ULONG ulNumOfVolumes, ulVolume;
+ DVD_DISC_SIDE Side;
+ ULONG ulNumOfTitles;
+ ULONG ulNumOfChapters;
+
+ if(SUCCEEDED(pDVDI->GetCurrentLocation(&loc))
+ && SUCCEEDED(pDVDI->GetNumberOfChapters(loc.TitleNum, &ulNumOfChapters))
+ && SUCCEEDED(pDVDI->GetDVDVolumeInfo(&ulNumOfVolumes, &ulVolume, &Side, &ulNumOfTitles))) {
+ Location.Format(ResStr(IDS_MAINFRM_9),
+ ulVolume, ulNumOfVolumes,
+ loc.TitleNum, ulNumOfTitles,
+ loc.ChapterNum, ulNumOfChapters);
+ ULONG tsec = (loc.TimeCode.bHours*3600)
+ + (loc.TimeCode.bMinutes*60)
+ + (loc.TimeCode.bSeconds);
+ /* This might not always work, such as on resume */
+ if ( loc.ChapterNum != m_lCurrentChapter ) {
+ m_lCurrentChapter = loc.ChapterNum;
+ m_lChapterStartTime = tsec;
+ } else {
+ /* If a resume point was used, and the user chapter jumps,
+ then it might do some funky time jumping. Try to 'fix' the
+ chapter start time if this happens */
+ if ( m_lChapterStartTime > tsec ) {
+ m_lChapterStartTime = tsec;
+ }
+ }
+ }
- if(GetPlaybackMode() == PM_DVD) // we also use this timer to update the info panel for DVD playback
- {
- ULONG ulAvailable, ulCurrent;
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_LOCATION), Location);
- // Location
+ // Video
- CString Location('-');
+ CString Video('-');
- DVD_PLAYBACK_LOCATION2 loc;
- ULONG ulNumOfVolumes, ulVolume;
- DVD_DISC_SIDE Side;
- ULONG ulNumOfTitles;
- ULONG ulNumOfChapters;
+ DVD_VideoAttributes VATR;
- if(SUCCEEDED(pDVDI->GetCurrentLocation(&loc))
- && SUCCEEDED(pDVDI->GetNumberOfChapters(loc.TitleNum, &ulNumOfChapters))
- && SUCCEEDED(pDVDI->GetDVDVolumeInfo(&ulNumOfVolumes, &ulVolume, &Side, &ulNumOfTitles)))
- {
- Location.Format(ResStr(IDS_MAINFRM_9),
- ulVolume, ulNumOfVolumes,
- loc.TitleNum, ulNumOfTitles,
- loc.ChapterNum, ulNumOfChapters);
- ULONG tsec = (loc.TimeCode.bHours*3600)
- + (loc.TimeCode.bMinutes*60)
- + (loc.TimeCode.bSeconds);
- /* This might not always work, such as on resume */
- if ( loc.ChapterNum != m_lCurrentChapter )
- {
- m_lCurrentChapter = loc.ChapterNum;
- m_lChapterStartTime = tsec;
+ if(SUCCEEDED(pDVDI->GetCurrentAngle(&ulAvailable, &ulCurrent))
+ && SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR))) {
+ Video.Format(ResStr(IDS_MAINFRM_10),
+ ulAvailable, ulCurrent,
+ VATR.ulSourceResolutionX, VATR.ulSourceResolutionY, VATR.ulFrameRate,
+ VATR.ulAspectX, VATR.ulAspectY);
}
- else
- {
- /* If a resume point was used, and the user chapter jumps,
- then it might do some funky time jumping. Try to 'fix' the
- chapter start time if this happens */
- if ( m_lChapterStartTime > tsec )
- m_lChapterStartTime = tsec;
- }
- }
-
- m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_LOCATION), Location);
- // Video
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_VIDEO), Video);
- CString Video('-');
+ // Audio
- DVD_VideoAttributes VATR;
-
- if(SUCCEEDED(pDVDI->GetCurrentAngle(&ulAvailable, &ulCurrent))
- && SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR)))
- {
- Video.Format(ResStr(IDS_MAINFRM_10),
- ulAvailable, ulCurrent,
- VATR.ulSourceResolutionX, VATR.ulSourceResolutionY, VATR.ulFrameRate,
- VATR.ulAspectX, VATR.ulAspectY);
- }
+ CString Audio('-');
- m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_VIDEO), Video);
+ DVD_AudioAttributes AATR;
- // Audio
+ if(SUCCEEDED(pDVDI->GetCurrentAudio(&ulAvailable, &ulCurrent))
+ && SUCCEEDED(pDVDI->GetAudioAttributes(ulCurrent, &AATR))) {
+ CString lang;
+ int len = GetLocaleInfo(AATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64);
+ lang.ReleaseBufferSetLength(max(len-1, 0));
- CString Audio('-');
+ switch(AATR.LanguageExtension) {
+ case DVD_AUD_EXT_NotSpecified:
+ default:
+ break;
+ case DVD_AUD_EXT_Captions:
+ lang += _T(" (Captions)");
+ break;
+ case DVD_AUD_EXT_VisuallyImpaired:
+ lang += _T(" (Visually Impaired)");
+ break;
+ case DVD_AUD_EXT_DirectorComments1:
+ lang += _T(" (Director Comments 1)");
+ break;
+ case DVD_AUD_EXT_DirectorComments2:
+ lang += _T(" (Director Comments 2)");
+ break;
+ }
- DVD_AudioAttributes AATR;
+ CString format = GetDVDAudioFormatName(AATR);
- if(SUCCEEDED(pDVDI->GetCurrentAudio(&ulAvailable, &ulCurrent))
- && SUCCEEDED(pDVDI->GetAudioAttributes(ulCurrent, &AATR)))
- {
- CString lang;
- int len = GetLocaleInfo(AATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64);
- lang.ReleaseBufferSetLength(max(len-1, 0));
+ Audio.Format(ResStr(IDS_MAINFRM_11),
+ lang,
+ format,
+ AATR.dwFrequency,
+ AATR.bQuantization,
+ AATR.bNumberOfChannels,
+ (AATR.bNumberOfChannels > 1 ? ResStr(IDS_MAINFRM_13) : ResStr(IDS_MAINFRM_12)));
- switch(AATR.LanguageExtension)
- {
- case DVD_AUD_EXT_NotSpecified:
- default:
- break;
- case DVD_AUD_EXT_Captions:
- lang += _T(" (Captions)");
- break;
- case DVD_AUD_EXT_VisuallyImpaired:
- lang += _T(" (Visually Impaired)");
- break;
- case DVD_AUD_EXT_DirectorComments1:
- lang += _T(" (Director Comments 1)");
- break;
- case DVD_AUD_EXT_DirectorComments2:
- lang += _T(" (Director Comments 2)");
- break;
+ m_wndStatusBar.SetStatusBitmap(
+ AATR.bNumberOfChannels == 1 ? IDB_MONO
+ : AATR.bNumberOfChannels >= 2 ? IDB_STEREO
+ : IDB_NOAUDIO);
}
- CString format = GetDVDAudioFormatName(AATR);
-
- Audio.Format(ResStr(IDS_MAINFRM_11),
- lang,
- format,
- AATR.dwFrequency,
- AATR.bQuantization,
- AATR.bNumberOfChannels,
- (AATR.bNumberOfChannels > 1 ? ResStr(IDS_MAINFRM_13) : ResStr(IDS_MAINFRM_12)));
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_AUDIO), Audio);
- m_wndStatusBar.SetStatusBitmap(
- AATR.bNumberOfChannels == 1 ? IDB_MONO
- : AATR.bNumberOfChannels >= 2 ? IDB_STEREO
- : IDB_NOAUDIO);
- }
+ // Subtitles
- m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_AUDIO), Audio);
+ CString Subtitles('-');
- // Subtitles
+ BOOL bIsDisabled;
+ DVD_SubpictureAttributes SATR;
- CString Subtitles('-');
+ if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulAvailable, &ulCurrent, &bIsDisabled))
+ && SUCCEEDED(pDVDI->GetSubpictureAttributes(ulCurrent, &SATR))) {
+ CString lang;
+ int len = GetLocaleInfo(SATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64);
+ lang.ReleaseBufferSetLength(max(len-1, 0));
- BOOL bIsDisabled;
- DVD_SubpictureAttributes SATR;
+ switch(SATR.LanguageExtension) {
+ case DVD_SP_EXT_NotSpecified:
+ default:
+ break;
+ case DVD_SP_EXT_Caption_Normal:
+ lang += _T("");
+ break;
+ case DVD_SP_EXT_Caption_Big:
+ lang += _T(" (Big)");
+ break;
+ case DVD_SP_EXT_Caption_Children:
+ lang += _T(" (Children)");
+ break;
+ case DVD_SP_EXT_CC_Normal:
+ lang += _T(" (CC)");
+ break;
+ case DVD_SP_EXT_CC_Big:
+ lang += _T(" (CC Big)");
+ break;
+ case DVD_SP_EXT_CC_Children:
+ lang += _T(" (CC Children)");
+ break;
+ case DVD_SP_EXT_Forced:
+ lang += _T(" (Forced)");
+ break;
+ case DVD_SP_EXT_DirectorComments_Normal:
+ lang += _T(" (Director Comments)");
+ break;
+ case DVD_SP_EXT_DirectorComments_Big:
+ lang += _T(" (Director Comments, Big)");
+ break;
+ case DVD_SP_EXT_DirectorComments_Children:
+ lang += _T(" (Director Comments, Children)");
+ break;
+ }
- if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulAvailable, &ulCurrent, &bIsDisabled))
- && SUCCEEDED(pDVDI->GetSubpictureAttributes(ulCurrent, &SATR)))
- {
- CString lang;
- int len = GetLocaleInfo(SATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64);
- lang.ReleaseBufferSetLength(max(len-1, 0));
+ if(bIsDisabled) {
+ lang = _T("-");
+ }
- switch(SATR.LanguageExtension)
- {
- case DVD_SP_EXT_NotSpecified:
- default:
- break;
- case DVD_SP_EXT_Caption_Normal:
- lang += _T("");
- break;
- case DVD_SP_EXT_Caption_Big:
- lang += _T(" (Big)");
- break;
- case DVD_SP_EXT_Caption_Children:
- lang += _T(" (Children)");
- break;
- case DVD_SP_EXT_CC_Normal:
- lang += _T(" (CC)");
- break;
- case DVD_SP_EXT_CC_Big:
- lang += _T(" (CC Big)");
- break;
- case DVD_SP_EXT_CC_Children:
- lang += _T(" (CC Children)");
- break;
- case DVD_SP_EXT_Forced:
- lang += _T(" (Forced)");
- break;
- case DVD_SP_EXT_DirectorComments_Normal:
- lang += _T(" (Director Comments)");
- break;
- case DVD_SP_EXT_DirectorComments_Big:
- lang += _T(" (Director Comments, Big)");
- break;
- case DVD_SP_EXT_DirectorComments_Children:
- lang += _T(" (Director Comments, Children)");
- break;
+ Subtitles.Format(_T("%s"),
+ lang);
}
- if(bIsDisabled) lang = _T("-");
-
- Subtitles.Format(_T("%s"),
- lang);
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_SUBTITLES), Subtitles);
}
- m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_SUBTITLES), Subtitles);
- }
-
- if(GetMediaState() == State_Running && !m_fAudioOnly)
- {
- UINT fSaverActive = 0;
- if(SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, (PVOID)&fSaverActive, 0))
- {
- SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, 0, SPIF_SENDWININICHANGE); // this might not be needed at all...
- SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, fSaverActive, 0, SPIF_SENDWININICHANGE);
- }
+ if(GetMediaState() == State_Running && !m_fAudioOnly) {
+ UINT fSaverActive = 0;
+ if(SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, (PVOID)&fSaverActive, 0)) {
+ SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, 0, SPIF_SENDWININICHANGE); // this might not be needed at all...
+ SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, fSaverActive, 0, SPIF_SENDWININICHANGE);
+ }
- fSaverActive = 0;
- if(SystemParametersInfo(SPI_GETPOWEROFFACTIVE, 0, (PVOID)&fSaverActive, 0))
- {
- SystemParametersInfo(SPI_SETPOWEROFFACTIVE, 0, 0, SPIF_SENDWININICHANGE); // this might not be needed at all...
- SystemParametersInfo(SPI_SETPOWEROFFACTIVE, fSaverActive, 0, SPIF_SENDWININICHANGE);
+ fSaverActive = 0;
+ if(SystemParametersInfo(SPI_GETPOWEROFFACTIVE, 0, (PVOID)&fSaverActive, 0)) {
+ SystemParametersInfo(SPI_SETPOWEROFFACTIVE, 0, 0, SPIF_SENDWININICHANGE); // this might not be needed at all...
+ SystemParametersInfo(SPI_SETPOWEROFFACTIVE, fSaverActive, 0, SPIF_SENDWININICHANGE);
+ }
+ // prevent screensaver activate, monitor sleep/turn off after playback
+ SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
}
- // prevent screensaver activate, monitor sleep/turn off after playback
- SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
}
- }
- break;
- case TIMER_STATUSERASER:
- {
- KillTimer(TIMER_STATUSERASER);
- m_playingmsg.Empty();
- }
- break;
+ break;
+ case TIMER_STATUSERASER: {
+ KillTimer(TIMER_STATUSERASER);
+ m_playingmsg.Empty();
+ }
+ break;
}
__super::OnTimer(nIDEvent);
@@ -2214,8 +2156,9 @@ static bool SetShutdownPrivilege() SetThreadExecutionState (ES_CONTINUOUS);
// Get a token for this process.
- if(!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
+ if(!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) {
return(false);
+ }
// Get the LUID for the shutdown privilege.
@@ -2228,8 +2171,9 @@ static bool SetShutdownPrivilege() AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
- if(GetLastError() != ERROR_SUCCESS)
+ if(GetLastError() != ERROR_SUCCESS) {
return false;
+ }
return true;
}
@@ -2240,37 +2184,31 @@ bool CMainFrame::DoAfterPlaybackEvent() bool fExit = false;
- if(s.nCLSwitches&CLSW_CLOSE || s.fExitAfterPlayback)
- {
+ if(s.nCLSwitches&CLSW_CLOSE || s.fExitAfterPlayback) {
fExit = true;
}
- if(s.nCLSwitches&CLSW_STANDBY)
- {
+ if(s.nCLSwitches&CLSW_STANDBY) {
SetShutdownPrivilege();
SetSystemPowerState(TRUE, FALSE);
fExit = true; // TODO: unless the app closes, it will call standby or hibernate once again forever, how to avoid that?
- }
- else if(s.nCLSwitches&CLSW_HIBERNATE)
- {
+ } else if(s.nCLSwitches&CLSW_HIBERNATE) {
SetShutdownPrivilege();
SetSystemPowerState(FALSE, FALSE);
fExit = true; // TODO: unless the app closes, it will call standby or hibernate once again forever, how to avoid that?
- }
- else if(s.nCLSwitches&CLSW_SHUTDOWN)
- {
+ } else if(s.nCLSwitches&CLSW_SHUTDOWN) {
SetShutdownPrivilege();
ExitWindowsEx(EWX_SHUTDOWN|EWX_POWEROFF|EWX_FORCEIFHUNG, 0);
fExit = true;
- }
- else if(s.nCLSwitches&CLSW_LOGOFF)
- {
+ } else if(s.nCLSwitches&CLSW_LOGOFF) {
SetShutdownPrivilege();
ExitWindowsEx(EWX_LOGOFF|EWX_FORCEIFHUNG, 0);
fExit = true;
}
- if(!fExit) return false;
+ if(!fExit) {
+ return false;
+ }
SendMessage(WM_COMMAND, ID_FILE_EXIT);
@@ -2284,95 +2222,78 @@ bool CMainFrame::GraphEventComplete( ) {
AppSettings& s = AfxGetAppSettings();
FILE_POSITION* FilePosition = s.CurrentFilePosition();
- if (FilePosition)
- {
+ if (FilePosition) {
FilePosition->llPosition = 0;
QueryPerformanceCounter(&m_LastSaveTime);
- if (s.fKeepHistory && s.fRememberFilePos)
+ if (s.fKeepHistory && s.fRememberFilePos) {
s.SaveCurrentFilePosition();
+ }
}
- if(m_wndPlaylistBar.GetCount() <= 1)
- {
+ if(m_wndPlaylistBar.GetCount() <= 1) {
m_nLoops++;
- if(DoAfterPlaybackEvent())
+ if(DoAfterPlaybackEvent()) {
return false;
+ }
- if(s.fLoopForever || m_nLoops < s.nLoops)
- {
- if(GetMediaState() == State_Stopped)
- {
+ if(s.fLoopForever || m_nLoops < s.nLoops) {
+ if(GetMediaState() == State_Stopped) {
SendMessage(WM_COMMAND, ID_PLAY_PLAY);
- }
- else
- {
+ } else {
LONGLONG pos = 0;
pMS->SetPositions(&pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
- if(GetMediaState() == State_Paused)
- {
+ if(GetMediaState() == State_Paused) {
SendMessage(WM_COMMAND, ID_PLAY_PLAY);
}
}
- }
- else
- {
+ } else {
int NextMediaExist = 0;
- if (s.fNextInDirAfterPlayback)
- {
+ if (s.fNextInDirAfterPlayback) {
NextMediaExist = SearchInDir(true);
}
- if (!s.fNextInDirAfterPlayback || !(NextMediaExist>1))
- {
- if(s.fRewind)
+ if (!s.fNextInDirAfterPlayback || !(NextMediaExist>1)) {
+ if(s.fRewind) {
SendMessage(WM_COMMAND, ID_PLAY_STOP);
- else
- {
+ } else {
m_fEndOfStream = true;
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
}
m_OSD.ClearMessage();
- if(m_fFullScreen && s.fExitFullScreenAtTheEnd)
+ if(m_fFullScreen && s.fExitFullScreenAtTheEnd) {
OnViewFullscreen();
+ }
}
- if (s.fNextInDirAfterPlayback && !NextMediaExist)
- {
+ if (s.fNextInDirAfterPlayback && !NextMediaExist) {
m_OSD.DisplayMessage(OSD_TOPLEFT, ResStr(IDS_NO_MORE_MEDIA));
// Don't move it. Else OSD message "Pause" will rewrite this message.
}
}
- }
- else if(m_wndPlaylistBar.GetCount() > 1)
- {
- if(m_wndPlaylistBar.IsAtEnd())
- {
- if(DoAfterPlaybackEvent())
+ } else if(m_wndPlaylistBar.GetCount() > 1) {
+ if(m_wndPlaylistBar.IsAtEnd()) {
+ if(DoAfterPlaybackEvent()) {
return false;
+ }
m_nLoops++;
}
- if(s.fLoopForever || m_nLoops < s.nLoops)
- {
+ if(s.fLoopForever || m_nLoops < s.nLoops) {
int nLoops = m_nLoops;
PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD);
m_nLoops = nLoops;
- }
- else
- {
- if(m_fFullScreen && s.fExitFullScreenAtTheEnd)
+ } else {
+ if(m_fFullScreen && s.fExitFullScreenAtTheEnd) {
OnViewFullscreen();
+ }
- if(s.fRewind)
- {
+ if(s.fRewind) {
s.nCLSwitches |= CLSW_OPEN; // HACK
PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD);
- }
- else
- {
+ } else {
m_fEndOfStream = true;
PostMessage(WM_COMMAND, ID_PLAY_PAUSE);
}
@@ -2392,371 +2313,361 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam) LONG evCode;
LONG_PTR evParam1, evParam2;
- while(pME && SUCCEEDED(pME->GetEvent(&evCode, &evParam1, &evParam2, 0)))
- {
+ while(pME && SUCCEEDED(pME->GetEvent(&evCode, &evParam1, &evParam2, 0))) {
#ifdef _DEBUG
TRACE("--> CMainFrame::OnGraphNotify on thread: %d; event: 0x%08x (%ws)\n", GetCurrentThreadId(), evCode, GetEventString(evCode));
#endif
CString str;
- if(m_fCustomGraph)
- {
- if(EC_BG_ERROR == evCode)
- {
+ if(m_fCustomGraph) {
+ if(EC_BG_ERROR == evCode) {
str = CString((char*)evParam1);
}
}
- if (!m_fFrameSteppingActive) m_nStepForwardCount = 0;
+ if (!m_fFrameSteppingActive) {
+ m_nStepForwardCount = 0;
+ }
hr = pME->FreeEventParams(evCode, evParam1, evParam2);
- switch(evCode)
- {
- case EC_COMPLETE:
- if (!GraphEventComplete())
- return hr;
- break;
- case EC_ERRORABORT:
- TRACE(_T("\thr = %08x\n"), (HRESULT)evParam1);
- break;
- case EC_BUFFERING_DATA:
- TRACE(_T("\t%d, %d\n"), (HRESULT)evParam1, evParam2);
+ switch(evCode) {
+ case EC_COMPLETE:
+ if (!GraphEventComplete()) {
+ return hr;
+ }
+ break;
+ case EC_ERRORABORT:
+ TRACE(_T("\thr = %08x\n"), (HRESULT)evParam1);
+ break;
+ case EC_BUFFERING_DATA:
+ TRACE(_T("\t%d, %d\n"), (HRESULT)evParam1, evParam2);
- m_fBuffering = ((HRESULT)evParam1 != S_OK);
- break;
- case EC_STEP_COMPLETE:
- if(m_fFrameSteppingActive)
- {
- m_nStepForwardCount++;
- m_fFrameSteppingActive = false;
- pBA->put_Volume(m_VolumeBeforeFrameStepping);
- }
- break;
- case EC_DEVICE_LOST:
- if(GetPlaybackMode() == PM_CAPTURE && evParam2 == 0)
- {
- CComQIPtr<IBaseFilter> pBF = (IUnknown*)evParam1;
- if (!pVidCap && pVidCap == pBF || !pAudCap && pAudCap == pBF)
- SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
- }
- break;
- case EC_DVD_TITLE_CHANGE:
- {
- // Casimir666 : Save current chapter
- DVD_POSITION* DvdPos = s.CurrentDVDPosition();
- if (DvdPos) DvdPos->lTitle = (DWORD)evParam1;
+ m_fBuffering = ((HRESULT)evParam1 != S_OK);
+ break;
+ case EC_STEP_COMPLETE:
+ if(m_fFrameSteppingActive) {
+ m_nStepForwardCount++;
+ m_fFrameSteppingActive = false;
+ pBA->put_Volume(m_VolumeBeforeFrameStepping);
+ }
+ break;
+ case EC_DEVICE_LOST:
+ if(GetPlaybackMode() == PM_CAPTURE && evParam2 == 0) {
+ CComQIPtr<IBaseFilter> pBF = (IUnknown*)evParam1;
+ if (!pVidCap && pVidCap == pBF || !pAudCap && pAudCap == pBF) {
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ }
+ }
+ break;
+ case EC_DVD_TITLE_CHANGE: {
+ // Casimir666 : Save current chapter
+ DVD_POSITION* DvdPos = s.CurrentDVDPosition();
+ if (DvdPos) {
+ DvdPos->lTitle = (DWORD)evParam1;
+ }
- if(GetPlaybackMode() == PM_FILE)
- {
- SetupChapters();
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
- m_iDVDTitle = (DWORD)evParam1;
+ if(GetPlaybackMode() == PM_FILE) {
+ SetupChapters();
+ } else if(GetPlaybackMode() == PM_DVD) {
+ m_iDVDTitle = (DWORD)evParam1;
- if(m_iDVDDomain == DVD_DOMAIN_Title)
- {
- CString Domain;
- Domain.Format(ResStr(IDS_AG_TITLE), m_iDVDTitle);
- m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain);
+ if(m_iDVDDomain == DVD_DOMAIN_Title) {
+ CString Domain;
+ Domain.Format(ResStr(IDS_AG_TITLE), m_iDVDTitle);
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain);
+ }
}
}
- }
- break;
- case EC_DVD_DOMAIN_CHANGE:
- {
- m_iDVDDomain = (DVD_DOMAIN)evParam1;
-
- CString Domain('-');
-
- switch(m_iDVDDomain)
- {
- case DVD_DOMAIN_FirstPlay:
- ULONGLONG llDVDGuid;
+ break;
+ case EC_DVD_DOMAIN_CHANGE: {
+ m_iDVDDomain = (DVD_DOMAIN)evParam1;
- Domain = _T("First Play");
+ CString Domain('-');
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("%s"), Domain);
+ switch(m_iDVDDomain) {
+ case DVD_DOMAIN_FirstPlay:
+ ULONGLONG llDVDGuid;
- if (pDVDI && SUCCEEDED (pDVDI->GetDiscID (NULL, &llDVDGuid)))
- {
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("DVD Title: %d"), s.lDVDTitle);
+ Domain = _T("First Play");
- if (s.lDVDTitle != 0)
- {
- s.NewDvd (llDVDGuid);
- // Set command line position
- hr = pDVDC->PlayTitle(s.lDVDTitle, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- if ( s.fShowDebugInfo )
- {
- m_OSD.DebugMessage(_T("PlayTitle: 0x%08X"), hr);
- m_OSD.DebugMessage(_T("DVD Chapter: %d"), s.lDVDChapter);
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("%s"), Domain);
}
- if (s.lDVDChapter > 1)
- {
- hr = pDVDC->PlayChapterInTitle(s.lDVDTitle, s.lDVDChapter, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("PlayChapterInTitle: 0x%08X"), hr);
- }
- else
- {
- // Trick: skip trailers with some DVDs
- hr = pDVDC->Resume(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("Resume: 0x%08X"), hr);
-
- // If the resume call succeeded, then we skip PlayChapterInTitle
- // and PlayAtTimeInTitle.
- if ( hr == S_OK )
- {
- // This might fail if the Title is not available yet?
- hr = pDVDC->PlayAtTime(&s.DVDPosition,
- DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("PlayAtTime: 0x%08X"), hr);
+ if (pDVDI && SUCCEEDED (pDVDI->GetDiscID (NULL, &llDVDGuid))) {
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("DVD Title: %d"), s.lDVDTitle);
}
- else
- {
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("Timecode requested: %02d:%02d:%02d.%03d"),
- s.DVDPosition.bHours, s.DVDPosition.bMinutes,
- s.DVDPosition.bSeconds, s.DVDPosition.bFrames);
-
- // Always play chapter 1 (for now, until something else dumb happens)
- hr = pDVDC->PlayChapterInTitle(s.lDVDTitle, 1,
- DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("PlayChapterInTitle: 0x%08X"), hr);
- // This might fail if the Title is not available yet?
- hr = pDVDC->PlayAtTime(&s.DVDPosition,
- DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("PlayAtTime: 0x%08X"), hr);
-
- if ( hr != S_OK )
- {
- hr = pDVDC->PlayAtTimeInTitle(s.lDVDTitle, &s.DVDPosition,
- DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("PlayAtTimeInTitle: 0x%08X"), hr);
+ if (s.lDVDTitle != 0) {
+ s.NewDvd (llDVDGuid);
+ // Set command line position
+ hr = pDVDC->PlayTitle(s.lDVDTitle, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("PlayTitle: 0x%08X"), hr);
+ m_OSD.DebugMessage(_T("DVD Chapter: %d"), s.lDVDChapter);
}
- } // Resume
- hr = pDVDC->PlayAtTime(&s.DVDPosition,
- DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("PlayAtTime: %d"), hr);
- }
+ if (s.lDVDChapter > 1) {
+ hr = pDVDC->PlayChapterInTitle(s.lDVDTitle, s.lDVDChapter, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("PlayChapterInTitle: 0x%08X"), hr);
+ }
+ } else {
+ // Trick: skip trailers with some DVDs
+ hr = pDVDC->Resume(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("Resume: 0x%08X"), hr);
+ }
+
+ // If the resume call succeeded, then we skip PlayChapterInTitle
+ // and PlayAtTimeInTitle.
+ if ( hr == S_OK ) {
+ // This might fail if the Title is not available yet?
+ hr = pDVDC->PlayAtTime(&s.DVDPosition,
+ DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("PlayAtTime: 0x%08X"), hr);
+ }
+ } else {
+ if ( s.fShowDebugInfo )
+ m_OSD.DebugMessage(_T("Timecode requested: %02d:%02d:%02d.%03d"),
+ s.DVDPosition.bHours, s.DVDPosition.bMinutes,
+ s.DVDPosition.bSeconds, s.DVDPosition.bFrames);
+
+ // Always play chapter 1 (for now, until something else dumb happens)
+ hr = pDVDC->PlayChapterInTitle(s.lDVDTitle, 1,
+ DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("PlayChapterInTitle: 0x%08X"), hr);
+ }
+
+ // This might fail if the Title is not available yet?
+ hr = pDVDC->PlayAtTime(&s.DVDPosition,
+ DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("PlayAtTime: 0x%08X"), hr);
+ }
+
+ if ( hr != S_OK ) {
+ hr = pDVDC->PlayAtTimeInTitle(s.lDVDTitle, &s.DVDPosition,
+ DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("PlayAtTimeInTitle: 0x%08X"), hr);
+ }
+ }
+ } // Resume
+
+ hr = pDVDC->PlayAtTime(&s.DVDPosition,
+ DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("PlayAtTime: %d"), hr);
+ }
+ }
- m_iDVDTitle = s.lDVDTitle;
- s.lDVDTitle = 0;
- s.lDVDChapter = 0;
- }
- else if (!s.NewDvd (llDVDGuid) && s.fRememberDVDPos)
- {
- // Set last remembered position (if founded...)
- DVD_POSITION* DvdPos = s.CurrentDVDPosition();
+ m_iDVDTitle = s.lDVDTitle;
+ s.lDVDTitle = 0;
+ s.lDVDChapter = 0;
+ } else if (!s.NewDvd (llDVDGuid) && s.fRememberDVDPos) {
+ // Set last remembered position (if founded...)
+ DVD_POSITION* DvdPos = s.CurrentDVDPosition();
- pDVDC->PlayTitle(DvdPos->lTitle, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- pDVDC->Resume(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ pDVDC->PlayTitle(DvdPos->lTitle, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ pDVDC->Resume(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
#if 1
- if (SUCCEEDED (hr = pDVDC->PlayAtTimeInTitle(
- DvdPos->lTitle, &DvdPos->Timecode,
- DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL)))
+ if (SUCCEEDED (hr = pDVDC->PlayAtTimeInTitle(
+ DvdPos->lTitle, &DvdPos->Timecode,
+ DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL)))
#else
- if (SUCCEEDED (hr = pDVDC->PlayAtTime (&DvdPos->Timecode,
- DVD_CMD_FLAG_Flush, NULL)))
+ if (SUCCEEDED (hr = pDVDC->PlayAtTime (&DvdPos->Timecode,
+ DVD_CMD_FLAG_Flush, NULL)))
#endif
- {
- m_iDVDTitle = DvdPos->lTitle;
+ {
+ m_iDVDTitle = DvdPos->lTitle;
+ }
+ }
}
- }
+ break;
+ case DVD_DOMAIN_VideoManagerMenu:
+ Domain = _T("Video Manager Menu");
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("%s"), Domain);
+ }
+ break;
+ case DVD_DOMAIN_VideoTitleSetMenu:
+ Domain = _T("Video Title Set Menu");
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("%s"), Domain);
+ }
+ break;
+ case DVD_DOMAIN_Title:
+ Domain.Format(ResStr(IDS_AG_TITLE), m_iDVDTitle);
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("%s"), Domain);
+ }
+ DVD_POSITION* DvdPos;
+ DvdPos = s.CurrentDVDPosition();
+ if (DvdPos) {
+ DvdPos->lTitle = m_iDVDTitle;
+ }
+ break;
+ case DVD_DOMAIN_Stop:
+ Domain = ResStr(IDS_AG_STOP);
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("%s"), Domain);
+ }
+ break;
+ default:
+ Domain = _T("-");
+ if ( s.fShowDebugInfo ) {
+ m_OSD.DebugMessage(_T("%s"), Domain);
+ }
+ break;
}
- break;
- case DVD_DOMAIN_VideoManagerMenu:
- Domain = _T("Video Manager Menu");
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("%s"), Domain);
- break;
- case DVD_DOMAIN_VideoTitleSetMenu:
- Domain = _T("Video Title Set Menu");
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("%s"), Domain);
- break;
- case DVD_DOMAIN_Title:
- Domain.Format(ResStr(IDS_AG_TITLE), m_iDVDTitle);
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("%s"), Domain);
- DVD_POSITION* DvdPos;
- DvdPos = s.CurrentDVDPosition();
- if (DvdPos)
- DvdPos->lTitle = m_iDVDTitle;
- break;
- case DVD_DOMAIN_Stop:
- Domain = ResStr(IDS_AG_STOP);
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("%s"), Domain);
- break;
- default:
- Domain = _T("-");
- if ( s.fShowDebugInfo )
- m_OSD.DebugMessage(_T("%s"), Domain);
- break;
- }
- m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain);
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain);
#if 0 // UOPs debug traces
- if (hr == VFW_E_DVD_OPERATION_INHIBITED)
- {
- ULONG UOPfields = 0;
- pDVDI->GetCurrentUOPS(&UOPfields);
- CString message;
- message.Format( _T("UOP bitfield: 0x%08X; domain: %s"), UOPfields, Domain);
- m_OSD.DisplayMessage( OSD_TOPLEFT, message );
- }
- else
- m_OSD.DisplayMessage( OSD_TOPRIGHT, Domain );
+ if (hr == VFW_E_DVD_OPERATION_INHIBITED) {
+ ULONG UOPfields = 0;
+ pDVDI->GetCurrentUOPS(&UOPfields);
+ CString message;
+ message.Format( _T("UOP bitfield: 0x%08X; domain: %s"), UOPfields, Domain);
+ m_OSD.DisplayMessage( OSD_TOPLEFT, message );
+ } else {
+ m_OSD.DisplayMessage( OSD_TOPRIGHT, Domain );
+ }
#endif
- MoveVideoWindow(); // AR might have changed
- }
- break;
- case EC_DVD_CURRENT_HMSF_TIME:
- {
- double fps = evParam2 == DVD_TC_FLAG_25fps ? 25.0
- : evParam2 == DVD_TC_FLAG_30fps ? 30.0
- : evParam2 == DVD_TC_FLAG_DropFrame ? 29.97
- : 25.0;
+ MoveVideoWindow(); // AR might have changed
+ }
+ break;
+ case EC_DVD_CURRENT_HMSF_TIME: {
+ double fps = evParam2 == DVD_TC_FLAG_25fps ? 25.0
+ : evParam2 == DVD_TC_FLAG_30fps ? 30.0
+ : evParam2 == DVD_TC_FLAG_DropFrame ? 29.97
+ : 25.0;
+
+ REFERENCE_TIME rtDur = 0;
+
+ DVD_HMSF_TIMECODE tcDur;
+ ULONG ulFlags;
+ if(SUCCEEDED(pDVDI->GetTotalTitleTime(&tcDur, &ulFlags))) {
+ rtDur = HMSF2RT(tcDur, fps);
+ }
- REFERENCE_TIME rtDur = 0;
+ g_bNoDuration = rtDur <= 0;
+ m_wndSeekBar.Enable(rtDur > 0);
+ m_wndSeekBar.SetRange(0, rtDur);
+ m_OSD.SetRange (0, rtDur);
+ m_Lcd.SetMediaRange(0, rtDur);
- DVD_HMSF_TIMECODE tcDur;
- ULONG ulFlags;
- if(SUCCEEDED(pDVDI->GetTotalTitleTime(&tcDur, &ulFlags)))
- rtDur = HMSF2RT(tcDur, fps);
+ REFERENCE_TIME rtNow = HMSF2RT(*((DVD_HMSF_TIMECODE*)&evParam1), fps);
- g_bNoDuration = rtDur <= 0;
- m_wndSeekBar.Enable(rtDur > 0);
- m_wndSeekBar.SetRange(0, rtDur);
- m_OSD.SetRange (0, rtDur);
- m_Lcd.SetMediaRange(0, rtDur);
+ // Casimir666 : Save current position in the chapter
+ DVD_POSITION* DvdPos = s.CurrentDVDPosition();
+ if (DvdPos) {
+ memcpy (&DvdPos->Timecode, (void*)&evParam1, sizeof(DVD_HMSF_TIMECODE));
+ }
- REFERENCE_TIME rtNow = HMSF2RT(*((DVD_HMSF_TIMECODE*)&evParam1), fps);
+ m_wndSeekBar.SetPos(rtNow);
+ m_OSD.SetPos(rtNow);
+ m_Lcd.SetMediaPos(rtNow);
- // Casimir666 : Save current position in the chapter
- DVD_POSITION* DvdPos = s.CurrentDVDPosition();
- if (DvdPos)
- memcpy (&DvdPos->Timecode, (void*)&evParam1, sizeof(DVD_HMSF_TIMECODE));
+ if(m_pSubClock) {
+ m_pSubClock->SetTime(rtNow);
+ }
+ }
+ break;
+ case EC_DVD_ERROR: {
+ TRACE(_T("\t%d %d\n"), evParam1, evParam2);
- m_wndSeekBar.SetPos(rtNow);
- m_OSD.SetPos(rtNow);
- m_Lcd.SetMediaPos(rtNow);
+ CString err;
- if(m_pSubClock) m_pSubClock->SetTime(rtNow);
- }
- break;
- case EC_DVD_ERROR:
- {
- TRACE(_T("\t%d %d\n"), evParam1, evParam2);
+ switch(evParam1) {
+ case DVD_ERROR_Unexpected:
+ default:
+ err = ResStr(IDS_MAINFRM_16);
+ break;
+ case DVD_ERROR_CopyProtectFail:
+ err = ResStr(IDS_MAINFRM_17);
+ break;
+ case DVD_ERROR_InvalidDVD1_0Disc:
+ err = ResStr(IDS_MAINFRM_18);
+ break;
+ case DVD_ERROR_InvalidDiscRegion:
+ err = ResStr(IDS_MAINFRM_19);
+ break;
+ case DVD_ERROR_LowParentalLevel:
+ err = ResStr(IDS_MAINFRM_20);
+ break;
+ case DVD_ERROR_MacrovisionFail:
+ err = ResStr(IDS_MAINFRM_21);
+ break;
+ case DVD_ERROR_IncompatibleSystemAndDecoderRegions:
+ err = ResStr(IDS_MAINFRM_22);
+ break;
+ case DVD_ERROR_IncompatibleDiscAndDecoderRegions:
+ err = ResStr(IDS_MAINFRM_23);
+ break;
+ }
- CString err;
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
- switch(evParam1)
- {
- case DVD_ERROR_Unexpected:
- default:
- err = ResStr(IDS_MAINFRM_16);
- break;
- case DVD_ERROR_CopyProtectFail:
- err = ResStr(IDS_MAINFRM_17);
- break;
- case DVD_ERROR_InvalidDVD1_0Disc:
- err = ResStr(IDS_MAINFRM_18);
- break;
- case DVD_ERROR_InvalidDiscRegion:
- err = ResStr(IDS_MAINFRM_19);
- break;
- case DVD_ERROR_LowParentalLevel:
- err = ResStr(IDS_MAINFRM_20);
- break;
- case DVD_ERROR_MacrovisionFail:
- err = ResStr(IDS_MAINFRM_21);
- break;
- case DVD_ERROR_IncompatibleSystemAndDecoderRegions:
- err = ResStr(IDS_MAINFRM_22);
- break;
- case DVD_ERROR_IncompatibleDiscAndDecoderRegions:
- err = ResStr(IDS_MAINFRM_23);
- break;
+ m_closingmsg = err;
}
-
- SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
-
- m_closingmsg = err;
- }
- break;
- case EC_DVD_WARNING:
- TRACE(_T("\t%d %d\n"), evParam1, evParam2);
break;
- case EC_VIDEO_SIZE_CHANGED:
- {
- TRACE(_T("\t%dx%d\n"), CSize(evParam1));
+ case EC_DVD_WARNING:
+ TRACE(_T("\t%d %d\n"), evParam1, evParam2);
+ break;
+ case EC_VIDEO_SIZE_CHANGED: {
+ TRACE(_T("\t%dx%d\n"), CSize(evParam1));
- WINDOWPLACEMENT wp;
- wp.length = sizeof(wp);
- GetWindowPlacement(&wp);
+ WINDOWPLACEMENT wp;
+ wp.length = sizeof(wp);
+ GetWindowPlacement(&wp);
- CSize size(evParam1);
- m_fAudioOnly = (size.cx <= 0 || size.cy <= 0);
+ CSize size(evParam1);
+ m_fAudioOnly = (size.cx <= 0 || size.cy <= 0);
- if(s.fRememberZoomLevel
- && !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED))
- {
- ZoomVideoWindow();
- }
- else
- {
- MoveVideoWindow();
- }
- }
- break;
- case EC_LENGTH_CHANGED:
- {
- __int64 rtDur = 0;
- pMS->GetDuration(&rtDur);
- m_wndPlaylistBar.SetCurTime(rtDur);
- }
- break;
- case EC_BG_AUDIO_CHANGED:
- if(m_fCustomGraph)
- {
- int nAudioChannels = evParam1;
-
- m_wndStatusBar.SetStatusBitmap(nAudioChannels == 1 ? IDB_MONO
- : nAudioChannels >= 2 ? IDB_STEREO
- : IDB_NOAUDIO);
+ if(s.fRememberZoomLevel
+ && !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED)) {
+ ZoomVideoWindow();
+ } else {
+ MoveVideoWindow();
+ }
}
break;
- case EC_BG_ERROR:
- if(m_fCustomGraph)
- {
- SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
- m_closingmsg = !str.IsEmpty() ? str : _T("Unspecified graph error");
- m_wndPlaylistBar.SetCurValid(false);
- return hr;
+ case EC_LENGTH_CHANGED: {
+ __int64 rtDur = 0;
+ pMS->GetDuration(&rtDur);
+ m_wndPlaylistBar.SetCurTime(rtDur);
}
break;
- case EC_DVD_PLAYBACK_RATE_CHANGE:
- if(m_fCustomGraph && s.AutoChangeFullscrRes.bEnabled &&
- m_fFullScreen && m_iDVDDomain == DVD_DOMAIN_Title)
- AutoChangeMonitorMode();
- break;
+ case EC_BG_AUDIO_CHANGED:
+ if(m_fCustomGraph) {
+ int nAudioChannels = evParam1;
+
+ m_wndStatusBar.SetStatusBitmap(nAudioChannels == 1 ? IDB_MONO
+ : nAudioChannels >= 2 ? IDB_STEREO
+ : IDB_NOAUDIO);
+ }
+ break;
+ case EC_BG_ERROR:
+ if(m_fCustomGraph) {
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ m_closingmsg = !str.IsEmpty() ? str : _T("Unspecified graph error");
+ m_wndPlaylistBar.SetCurValid(false);
+ return hr;
+ }
+ break;
+ case EC_DVD_PLAYBACK_RATE_CHANGE:
+ if(m_fCustomGraph && s.AutoChangeFullscrRes.bEnabled &&
+ m_fFullScreen && m_iDVDDomain == DVD_DOMAIN_Title) {
+ AutoChangeMonitorMode();
+ }
+ break;
}
}
@@ -2767,19 +2678,22 @@ LRESULT CMainFrame::OnResetDevice( WPARAM wParam, LPARAM lParam ) {
OAFilterState fs = State_Stopped;
pMC->GetState(0, &fs);
- if(fs == State_Running) pMC->Pause();
+ if(fs == State_Running) {
+ pMC->Pause();
+ }
BOOL bResult = false;
- if (m_bOpenedThruThread)
- {
+ if (m_bOpenedThruThread) {
CAMEvent e;
m_pGraphThread->PostThreadMessage(CGraphThread::TM_RESET, (WPARAM)&bResult, (LPARAM)&e);
e.Wait();
- }
- else
+ } else {
ResetDevice();
+ }
- if(fs == State_Running) pMC->Run();
+ if(fs == State_Running) {
+ pMC->Run();
+ }
return S_OK;
}
@@ -2793,22 +2707,17 @@ LRESULT CMainFrame::OnResumeFromState(WPARAM wParam, LPARAM lParam) {
int iPlaybackMode = (int)wParam;
- if(iPlaybackMode == PM_FILE)
- {
+ if(iPlaybackMode == PM_FILE) {
SeekTo(10000i64*int(lParam));
- }
- else if(iPlaybackMode == PM_DVD)
- {
+ } else if(iPlaybackMode == PM_DVD) {
CComPtr<IDvdState> pDvdState;
pDvdState.Attach((IDvdState*)lParam);
- if(pDVDC) pDVDC->SetState(pDvdState, DVD_CMD_FLAG_Block, NULL);
- }
- else if(iPlaybackMode == PM_CAPTURE)
- {
+ if(pDVDC) {
+ pDVDC->SetState(pDvdState, DVD_CMD_FLAG_Block, NULL);
+ }
+ } else if(iPlaybackMode == PM_CAPTURE) {
// not implemented
- }
- else
- {
+ } else {
ASSERT(0);
return FALSE;
}
@@ -2821,27 +2730,24 @@ BOOL CMainFrame::OnButton(UINT id, UINT nFlags, CPoint point) SetFocus();
CRect r;
- if (m_pFullscreenWnd->IsWindow())
- {
+ if (m_pFullscreenWnd->IsWindow()) {
m_pFullscreenWnd->GetClientRect(r);
- }
- else
- {
+ } else {
m_wndView.GetClientRect(r);
m_wndView.MapWindowPoints(this, &r);
}
- if(id != wmcmd::WDOWN && id != wmcmd::WUP && !r.PtInRect(point)) return FALSE;
+ if(id != wmcmd::WDOWN && id != wmcmd::WUP && !r.PtInRect(point)) {
+ return FALSE;
+ }
BOOL ret = FALSE;
AppSettings& s = AfxGetAppSettings();
POSITION pos = s.wmcmds.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
wmcmd& wc = s.wmcmds.GetNext(pos);
- if(wc.mouse == id)
- {
+ if(wc.mouse == id) {
SendMessage(WM_COMMAND, wc.cmd);
ret = true;
}
@@ -2854,40 +2760,37 @@ static bool s_fLDown = false; void CMainFrame::OnLButtonDown(UINT nFlags, CPoint point)
{
- if (!m_pFullscreenWnd->IsWindow() || !m_OSD.OnLButtonDown (nFlags, point))
- {
+ if (!m_pFullscreenWnd->IsWindow() || !m_OSD.OnLButtonDown (nFlags, point)) {
SetFocus();
bool fClicked = false;
- if(GetPlaybackMode() == PM_DVD)
- {
+ if(GetPlaybackMode() == PM_DVD) {
CPoint p = point - m_wndView.GetVideoRect().TopLeft();
if(SUCCEEDED(pDVDC->ActivateAtPosition(p))
|| m_iDVDDomain == DVD_DOMAIN_VideoManagerMenu
- || m_iDVDDomain == DVD_DOMAIN_VideoTitleSetMenu)
+ || m_iDVDDomain == DVD_DOMAIN_VideoTitleSetMenu) {
fClicked = true;
+ }
}
- if(!fClicked)
- {
+ if(!fClicked) {
bool fLeftMouseBtnUnassigned = true;
AppSettings& s = AfxGetAppSettings();
POSITION pos = s.wmcmds.GetHeadPosition();
while(pos && fLeftMouseBtnUnassigned)
- if(s.wmcmds.GetNext(pos).mouse == wmcmd::LDOWN)
+ if(s.wmcmds.GetNext(pos).mouse == wmcmd::LDOWN) {
fLeftMouseBtnUnassigned = false;
+ }
- if(!m_fFullScreen && (IsCaptionMenuHidden() || fLeftMouseBtnUnassigned))
- {
+ if(!m_fFullScreen && (IsCaptionMenuHidden() || fLeftMouseBtnUnassigned)) {
PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
- }
- else
- {
+ } else {
s_fLDown = true;
- if(OnButton(wmcmd::LDOWN, nFlags, point))
+ if(OnButton(wmcmd::LDOWN, nFlags, point)) {
return;
+ }
}
}
@@ -2897,61 +2800,67 @@ void CMainFrame::OnLButtonDown(UINT nFlags, CPoint point) void CMainFrame::OnLButtonUp(UINT nFlags, CPoint point)
{
- if (!m_pFullscreenWnd->IsWindow() || !m_OSD.OnLButtonUp (nFlags, point))
- {
- if(!OnButton(wmcmd::LUP, nFlags, point))
+ if (!m_pFullscreenWnd->IsWindow() || !m_OSD.OnLButtonUp (nFlags, point)) {
+ if(!OnButton(wmcmd::LUP, nFlags, point)) {
__super::OnLButtonUp(nFlags, point);
+ }
}
}
void CMainFrame::OnLButtonDblClk(UINT nFlags, CPoint point)
{
- if(s_fLDown)
- {
+ if(s_fLDown) {
SendMessage(WM_LBUTTONDOWN, nFlags, MAKELPARAM(point.x, point.y));
s_fLDown = false;
}
- if(!OnButton(wmcmd::LDBLCLK, nFlags, point))
+ if(!OnButton(wmcmd::LDBLCLK, nFlags, point)) {
__super::OnLButtonDblClk(nFlags, point);
+ }
}
void CMainFrame::OnMButtonDown(UINT nFlags, CPoint point)
{
SendMessage(WM_CANCELMODE);
- if(!OnButton(wmcmd::MDOWN, nFlags, point))
+ if(!OnButton(wmcmd::MDOWN, nFlags, point)) {
__super::OnMButtonDown(nFlags, point);
+ }
}
void CMainFrame::OnMButtonUp(UINT nFlags, CPoint point)
{
- if(!OnButton(wmcmd::MUP, nFlags, point))
+ if(!OnButton(wmcmd::MUP, nFlags, point)) {
__super::OnMButtonUp(nFlags, point);
+ }
}
void CMainFrame::OnMButtonDblClk(UINT nFlags, CPoint point)
{
SendMessage(WM_MBUTTONDOWN, nFlags, MAKELPARAM(point.x, point.y));
- if(!OnButton(wmcmd::MDBLCLK, nFlags, point))
+ if(!OnButton(wmcmd::MDBLCLK, nFlags, point)) {
__super::OnMButtonDblClk(nFlags, point);
+ }
}
void CMainFrame::OnRButtonDown(UINT nFlags, CPoint point)
{
- if(!OnButton(wmcmd::RDOWN, nFlags, point))
+ if(!OnButton(wmcmd::RDOWN, nFlags, point)) {
__super::OnRButtonDown(nFlags, point);
+ }
}
void CMainFrame::OnRButtonUp(UINT nFlags, CPoint point)
{
- if(!OnButton(wmcmd::RUP, nFlags, point))
+ if(!OnButton(wmcmd::RUP, nFlags, point)) {
__super::OnRButtonUp(nFlags, point);
+ }
}
void CMainFrame::OnRButtonDblClk(UINT nFlags, CPoint point)
{
SendMessage(WM_RBUTTONDOWN, nFlags, MAKELPARAM(point.x, point.y));
- if(!OnButton(wmcmd::RDBLCLK, nFlags, point))
+ if(!OnButton(wmcmd::RDBLCLK, nFlags, point)) {
__super::OnRButtonDblClk(nFlags, point);
+ }
}
LRESULT CMainFrame::OnXButtonDown(WPARAM wParam, LPARAM lParam)
@@ -2992,16 +2901,13 @@ BOOL CMainFrame::OnMouseWheel(UINT nFlags, short zDelta, CPoint point) void CMainFrame::OnMouseMove(UINT nFlags, CPoint point)
{
// Waffs : ignore mousemoves when entering fullscreen
- if (m_lastMouseMove.x == -1 && m_lastMouseMove.y == -1)
- {
+ if (m_lastMouseMove.x == -1 && m_lastMouseMove.y == -1) {
m_lastMouseMove.x = point.x;
m_lastMouseMove.y = point.y;
}
- if (!m_OSD.OnMouseMove (nFlags, point))
- {
- if(GetPlaybackMode() == PM_DVD)
- {
+ if (!m_OSD.OnMouseMove (nFlags, point)) {
+ if(GetPlaybackMode() == PM_DVD) {
CPoint vp = point - m_wndView.GetVideoRect().TopLeft();
pDVDC->SelectAtPosition(vp);
}
@@ -3009,30 +2915,23 @@ void CMainFrame::OnMouseMove(UINT nFlags, CPoint point) CSize diff = m_lastMouseMove - point;
AppSettings& s = AfxGetAppSettings();
- if (m_pFullscreenWnd->IsWindow() && (abs(diff.cx)+abs(diff.cy)) >= 1)
- {
+ if (m_pFullscreenWnd->IsWindow() && (abs(diff.cx)+abs(diff.cy)) >= 1) {
// TRACE ("==> SHOW!\n");
m_pFullscreenWnd->ShowCursor(true);
// Casimir666 : hide the cursor if we are not in the DVD menu
- if ((GetPlaybackMode() == PM_FILE) || (GetPlaybackMode() == PM_DVD))
- {
+ if ((GetPlaybackMode() == PM_FILE) || (GetPlaybackMode() == PM_DVD)) {
KillTimer(TIMER_FULLSCREENMOUSEHIDER);
SetTimer(TIMER_FULLSCREENMOUSEHIDER, 2000, NULL);
}
- }
- else if(m_fFullScreen && (abs(diff.cx)+abs(diff.cy)) >= 1)
- {
+ } else if(m_fFullScreen && (abs(diff.cx)+abs(diff.cy)) >= 1) {
int nTimeOut = s.nShowBarsWhenFullScreenTimeOut;
- if(nTimeOut < 0)
- {
+ if(nTimeOut < 0) {
m_fHideCursor = false;
- if(s.fShowBarsWhenFullScreen)
- {
+ if(s.fShowBarsWhenFullScreen) {
ShowControls(s.nCS);
- if (GetPlaybackMode() == PM_CAPTURE && !s.fHideNavigation && s.iDefaultCaptureDevice == 1)
- {
+ if (GetPlaybackMode() == PM_CAPTURE && !s.fHideNavigation && s.iDefaultCaptureDevice == 1) {
m_wndNavigationBar.m_navdlg.UpdateElementList();
m_wndNavigationBar.ShowControls(this, TRUE);
}
@@ -3040,44 +2939,42 @@ void CMainFrame::OnMouseMove(UINT nFlags, CPoint point) KillTimer(TIMER_FULLSCREENCONTROLBARHIDER);
SetTimer(TIMER_FULLSCREENMOUSEHIDER, 2000, NULL);
- }
- else if(nTimeOut == 0)
- {
+ } else if(nTimeOut == 0) {
CRect r;
GetClientRect(r);
r.top = r.bottom;
POSITION pos = m_bars.GetHeadPosition();
- for(int i = 1; pos; i <<= 1)
- {
+ for(int i = 1; pos; i <<= 1) {
CControlBar* pNext = m_bars.GetNext(pos);
CSize size = pNext->CalcFixedLayout(FALSE, TRUE);
- if(s.nCS&i) r.top -= size.cy;
+ if(s.nCS&i) {
+ r.top -= size.cy;
+ }
}
// HACK: the controls would cover the menu too early hiding some buttons
if(GetPlaybackMode() == PM_DVD
&& (m_iDVDDomain == DVD_DOMAIN_VideoManagerMenu
- || m_iDVDDomain == DVD_DOMAIN_VideoTitleSetMenu))
+ || m_iDVDDomain == DVD_DOMAIN_VideoTitleSetMenu)) {
r.top = r.bottom - 10;
+ }
m_fHideCursor = false;
- if(r.PtInRect(point))
- {
- if(s.fShowBarsWhenFullScreen)
+ if(r.PtInRect(point)) {
+ if(s.fShowBarsWhenFullScreen) {
ShowControls(s.nCS);
- }
- else
- {
- if(s.fShowBarsWhenFullScreen)
+ }
+ } else {
+ if(s.fShowBarsWhenFullScreen) {
ShowControls(CS_NONE, false);
+ }
}
// PM_CAPTURE: Left Navigation panel for switching channels
- if (GetPlaybackMode() == PM_CAPTURE && !s.fHideNavigation && s.iDefaultCaptureDevice == 1)
- {
+ if (GetPlaybackMode() == PM_CAPTURE && !s.fHideNavigation && s.iDefaultCaptureDevice == 1) {
CRect rLeft;
GetClientRect(rLeft);
rLeft.right = rLeft.left;
@@ -3086,28 +2983,24 @@ void CMainFrame::OnMouseMove(UINT nFlags, CPoint point) m_fHideCursor = false;
- if(rLeft.PtInRect(point))
- {
- if(s.fShowBarsWhenFullScreen)
- {
+ if(rLeft.PtInRect(point)) {
+ if(s.fShowBarsWhenFullScreen) {
m_wndNavigationBar.m_navdlg.UpdateElementList();
m_wndNavigationBar.ShowControls(this, TRUE);
}
- }
- else
- {
- if(s.fShowBarsWhenFullScreen)
+ } else {
+ if(s.fShowBarsWhenFullScreen) {
m_wndNavigationBar.ShowControls(this, FALSE);
+ }
}
}
SetTimer(TIMER_FULLSCREENMOUSEHIDER, 2000, NULL);
- }
- else
- {
+ } else {
m_fHideCursor = false;
- if(s.fShowBarsWhenFullScreen)
+ if(s.fShowBarsWhenFullScreen) {
ShowControls(s.nCS);
+ }
SetTimer(TIMER_FULLSCREENCONTROLBARHIDER, nTimeOut*1000, NULL);
SetTimer(TIMER_FULLSCREENMOUSEHIDER, max(nTimeOut*1000, 2000), NULL);
@@ -3128,16 +3021,11 @@ LRESULT CMainFrame::OnNcHitTest(CPoint point) void CMainFrame::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
- if(pScrollBar->IsKindOf(RUNTIME_CLASS(CVolumeCtrl)))
- {
+ if(pScrollBar->IsKindOf(RUNTIME_CLASS(CVolumeCtrl))) {
OnPlayVolume(0);
- }
- else if(pScrollBar->IsKindOf(RUNTIME_CLASS(CPlayerSeekBar)) && m_iMediaLoadState == MLS_LOADED)
- {
+ } else if(pScrollBar->IsKindOf(RUNTIME_CLASS(CPlayerSeekBar)) && m_iMediaLoadState == MLS_LOADED) {
SeekTo(m_wndSeekBar.GetPos(), !!(::GetKeyState(VK_SHIFT)&0x8000));
- }
- else if (m_pVideoWnd == m_pVideoWnd)
- {
+ } else if (m_pVideoWnd == m_pVideoWnd) {
SeekTo(m_OSD.GetPos(), !!(::GetKeyState(VK_SHIFT)&0x8000));
}
@@ -3151,26 +3039,22 @@ void CMainFrame::OnInitMenu(CMenu* pMenu) MENUITEMINFO mii;
mii.cbSize = sizeof(mii);
- for(UINT i = 0, j = pMenu->GetMenuItemCount(); i < j; i++)
- {
+ for(UINT i = 0, j = pMenu->GetMenuItemCount(); i < j; i++) {
CString str;
pMenu->GetMenuString(i, str, MF_BYPOSITION);
CMenu* pSubMenu = NULL;
- if(str == ResStr(IDS_FAVORITES_POPUP))
- {
+ if(str == ResStr(IDS_FAVORITES_POPUP)) {
SetupFavoritesSubMenu();
pSubMenu = &m_favorites;
}
- if(str == ResStr(IDS_RECENT_FILES_POPUP))
- {
+ if(str == ResStr(IDS_RECENT_FILES_POPUP)) {
SetupRecentFilesSubMenu();
pSubMenu = &m_recentfiles;
}
- if(pSubMenu)
- {
+ if(pSubMenu) {
mii.fMask = MIIM_STATE|MIIM_SUBMENU;
mii.fType = MF_POPUP;
mii.hSubMenu = pSubMenu->m_hMenu;
@@ -3209,8 +3093,7 @@ void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) MENUITEMINFO mii;
mii.cbSize = sizeof(mii);
- for(UINT i = 0, j = pPopupMenu->GetMenuItemCount(); i < j; i++)
- {
+ for(UINT i = 0, j = pPopupMenu->GetMenuItemCount(); i < j; i++) {
CString str;
pPopupMenu->GetMenuString(i, str, MF_BYPOSITION);
@@ -3220,8 +3103,7 @@ void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) CMenu* pSubMenu = NULL;
UINT id;
- if(transl.Lookup(lookupstr, id))
- {
+ if(transl.Lookup(lookupstr, id)) {
str = ResStr(id);
// pPopupMenu->ModifyMenu(i, MF_BYPOSITION|MF_STRING, 0, str);
MENUITEMINFO mii;
@@ -3231,84 +3113,58 @@ void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) pPopupMenu->SetMenuItemInfo(i, &mii, TRUE);
}
- if(str == ResStr(IDS_NAVIGATE_POPUP))
- {
+ if(str == ResStr(IDS_NAVIGATE_POPUP)) {
UINT fState = (m_iMediaLoadState == MLS_LOADED
&& (1/*GetPlaybackMode() == PM_DVD *//*|| (GetPlaybackMode() == PM_FILE && m_PlayList.GetCount() > 0)*/))
? MF_ENABLED
: (MF_DISABLED|MF_GRAYED);
pPopupMenu->EnableMenuItem(i, MF_BYPOSITION|fState);
- }
- else if(str == ResStr(IDS_VIDEOFRAME_POPUP)
- || str == ResStr(IDS_PANSCAN_POPUP)
- || str == ResStr(IDS_ASPECTRATIO_POPUP)
- || str == ResStr(IDS_ZOOM_POPUP))
- {
+ } else if(str == ResStr(IDS_VIDEOFRAME_POPUP)
+ || str == ResStr(IDS_PANSCAN_POPUP)
+ || str == ResStr(IDS_ASPECTRATIO_POPUP)
+ || str == ResStr(IDS_ZOOM_POPUP)) {
UINT fState = (m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly)
? MF_ENABLED
: (MF_DISABLED|MF_GRAYED);
pPopupMenu->EnableMenuItem(i, MF_BYPOSITION|fState);
- }
- else if(str == ResStr(IDS_OPENCDROM_POPUP))
- {
+ } else if(str == ResStr(IDS_OPENCDROM_POPUP)) {
SetupOpenCDSubMenu();
pSubMenu = &m_opencds;
- }
- else if(str == ResStr(IDS_FILTERS_POPUP))
- {
+ } else if(str == ResStr(IDS_FILTERS_POPUP)) {
SetupFiltersSubMenu();
pSubMenu = &m_filters;
- }
- else if(str == ResStr(IDS_AUDIO_POPUP))
- {
+ } else if(str == ResStr(IDS_AUDIO_POPUP)) {
SetupAudioSwitcherSubMenu();
pSubMenu = &m_audios;
- }
- else if(str == ResStr(IDS_SUBTITLES_POPUP))
- {
+ } else if(str == ResStr(IDS_SUBTITLES_POPUP)) {
SetupSubtitlesSubMenu();
pSubMenu = &m_subtitles;
- }
- else if(str == ResStr(IDS_AUDIOLANGUAGE_POPUP))
- {
+ } else if(str == ResStr(IDS_AUDIOLANGUAGE_POPUP)) {
SetupNavAudioSubMenu();
pSubMenu = &m_navaudio;
- }
- else if(str == ResStr(IDS_SUBTITLELANGUAGE_POPUP))
- {
+ } else if(str == ResStr(IDS_SUBTITLELANGUAGE_POPUP)) {
SetupNavSubtitleSubMenu();
pSubMenu = &m_navsubtitle;
- }
- else if(str == ResStr(IDS_VIDEOANGLE_POPUP))
- {
+ } else if(str == ResStr(IDS_VIDEOANGLE_POPUP)) {
SetupNavAngleSubMenu();
pSubMenu = &m_navangle;
- }
- else if(str == ResStr(IDS_JUMPTO_POPUP))
- {
+ } else if(str == ResStr(IDS_JUMPTO_POPUP)) {
SetupNavChaptersSubMenu();
pSubMenu = &m_navchapters;
- }
- else if(str == ResStr(IDS_FAVORITES_POPUP))
- {
+ } else if(str == ResStr(IDS_FAVORITES_POPUP)) {
SetupFavoritesSubMenu();
pSubMenu = &m_favorites;
- }
- else if(str == ResStr(IDS_RECENT_FILES_POPUP))
- {
+ } else if(str == ResStr(IDS_RECENT_FILES_POPUP)) {
SetupRecentFilesSubMenu();
pSubMenu = &m_recentfiles;
- }
- else if(str == ResStr(IDS_SHADER_POPUP))
- {
+ } else if(str == ResStr(IDS_SHADER_POPUP)) {
SetupShadersSubMenu();
pSubMenu = &m_shaders;
}
- if(pSubMenu)
- {
+ if(pSubMenu) {
mii.fMask = MIIM_STATE|MIIM_SUBMENU;
mii.fType = MF_POPUP;
mii.hSubMenu = pSubMenu->m_hMenu;
@@ -3319,27 +3175,33 @@ void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) //
- for(UINT i = 0, j = pPopupMenu->GetMenuItemCount(); i < j; i++)
- {
+ for(UINT i = 0, j = pPopupMenu->GetMenuItemCount(); i < j; i++) {
UINT nID = pPopupMenu->GetMenuItemID(i);
if(nID == ID_SEPARATOR || nID == -1
|| nID >= ID_FAVORITES_FILE_START && nID <= ID_FAVORITES_FILE_END
|| nID >= ID_RECENT_FILE_START && nID <= ID_RECENT_FILE_END
- || nID >= ID_NAVIGATE_CHAP_SUBITEM_START && nID <= ID_NAVIGATE_CHAP_SUBITEM_END)
+ || nID >= ID_NAVIGATE_CHAP_SUBITEM_START && nID <= ID_NAVIGATE_CHAP_SUBITEM_END) {
continue;
+ }
CString str;
pPopupMenu->GetMenuString(i, str, MF_BYPOSITION);
int k = str.Find('\t');
- if(k > 0) str = str.Left(k);
+ if(k > 0) {
+ str = str.Left(k);
+ }
CString key = CPPageAccelTbl::MakeAccelShortcutLabel(nID);
- if(!key.IsEmpty()) str += _T("\t") + key;
+ if(!key.IsEmpty()) {
+ str += _T("\t") + key;
+ }
- if(key.IsEmpty() && i < 0) continue;
+ if(key.IsEmpty() && i < 0) {
+ continue;
+ }
// BUG(?): this disables menu item update ui calls for some reason...
-// pPopupMenu->ModifyMenu(i, MF_BYPOSITION|MF_STRING, nID, str);
+ // pPopupMenu->ModifyMenu(i, MF_BYPOSITION|MF_STRING, nID, str);
// this works fine
MENUITEMINFO mii;
@@ -3354,40 +3216,33 @@ void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) bool fPnSPresets = false;
- for(UINT i = 0, j = pPopupMenu->GetMenuItemCount(); i < j; i++)
- {
+ for(UINT i = 0, j = pPopupMenu->GetMenuItemCount(); i < j; i++) {
UINT nID = pPopupMenu->GetMenuItemID(i);
- if(nID >= ID_PANNSCAN_PRESETS_START && nID < ID_PANNSCAN_PRESETS_END)
- {
- do
- {
+ if(nID >= ID_PANNSCAN_PRESETS_START && nID < ID_PANNSCAN_PRESETS_END) {
+ do {
nID = pPopupMenu->GetMenuItemID(i);
pPopupMenu->DeleteMenu(i, MF_BYPOSITION);
j--;
- }
- while(i < j && nID >= ID_PANNSCAN_PRESETS_START && nID < ID_PANNSCAN_PRESETS_END);
+ } while(i < j && nID >= ID_PANNSCAN_PRESETS_START && nID < ID_PANNSCAN_PRESETS_END);
nID = pPopupMenu->GetMenuItemID(i);
}
- if(nID == ID_VIEW_RESET)
- {
+ if(nID == ID_VIEW_RESET) {
fPnSPresets = true;
}
}
- if(fPnSPresets)
- {
+ if(fPnSPresets) {
AppSettings& s = AfxGetAppSettings();
int i = 0, j = s.m_pnspresets.GetCount();
- for(; i < j; i++)
- {
+ for(; i < j; i++) {
int k = 0;
CString label = s.m_pnspresets[i].Tokenize(_T(","), k);
pPopupMenu->InsertMenu(ID_VIEW_RESET, MF_BYCOMMAND, ID_PANNSCAN_PRESETS_START+i, label);
}
-// if(j > 0)
+ // if(j > 0)
{
pPopupMenu->InsertMenu(ID_VIEW_RESET, MF_BYCOMMAND, ID_PANNSCAN_PRESETS_START+i, ResStr(IDS_PANSCAN_EDIT));
pPopupMenu->InsertMenu(ID_VIEW_RESET, MF_BYCOMMAND|MF_SEPARATOR);
@@ -3397,11 +3252,14 @@ void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) BOOL CMainFrame::OnMenu(CMenu* pMenu)
{
- if(!pMenu) return FALSE;
+ if(!pMenu) {
+ return FALSE;
+ }
AppSettings& s = AfxGetAppSettings();
// Do not show popup menu in D3D fullscreen for Sync Renderer. It has several adverse effects.
- if (IsD3DFullScreenMode() && s.iDSVideoRendererType == VIDRNDT_DS_SYNC)
+ if (IsD3DFullScreenMode() && s.iDSVideoRendererType == VIDRNDT_DS_SYNC) {
return FALSE;
+ }
KillTimer(TIMER_FULLSCREENMOUSEHIDER);
m_fHideCursor = false;
@@ -3415,12 +3273,9 @@ BOOL CMainFrame::OnMenu(CMenu* pMenu) void CMainFrame::OnMenuPlayerShort()
{
- if(IsCaptionMenuHidden() || m_pFullscreenWnd->IsWindow())
- {
+ if(IsCaptionMenuHidden() || m_pFullscreenWnd->IsWindow()) {
OnMenu(m_popupmain.GetSubMenu(0));
- }
- else
- {
+ } else {
OnMenu(m_popup.GetSubMenu(0));
}
}
@@ -3438,32 +3293,26 @@ void CMainFrame::OnMenuFilters() void CMainFrame::OnUpdatePlayerStatus(CCmdUI* pCmdUI)
{
- if(m_iMediaLoadState == MLS_LOADING)
- {
+ if(m_iMediaLoadState == MLS_LOADING) {
pCmdUI->SetText(ResStr(IDS_CONTROLS_OPENING));
- if((AfxGetAppSettings().fUseWin7TaskBar) && (m_pTaskbarList)) m_pTaskbarList->SetProgressState(m_hWnd, TBPF_INDETERMINATE);
- }
- else if(m_iMediaLoadState == MLS_LOADED)
- {
+ if((AfxGetAppSettings().fUseWin7TaskBar) && (m_pTaskbarList)) {
+ m_pTaskbarList->SetProgressState(m_hWnd, TBPF_INDETERMINATE);
+ }
+ } else if(m_iMediaLoadState == MLS_LOADED) {
CString msg;
- if(!m_playingmsg.IsEmpty())
- {
+ if(!m_playingmsg.IsEmpty()) {
msg = m_playingmsg;
- }
- else if(m_fCapturing)
- {
+ } else if(m_fCapturing) {
msg = ResStr(IDS_CONTROLS_CAPTURING);
- if(pAMDF)
- {
+ if(pAMDF) {
long lDropped = 0;
pAMDF->GetNumDropped(&lDropped);
long lNotDropped = 0;
pAMDF->GetNumNotDropped(&lNotDropped);
- if((lDropped + lNotDropped) > 0)
- {
+ if((lDropped + lNotDropped) > 0) {
CString str;
str.Format(ResStr(IDS_MAINFRM_37), lDropped + lNotDropped, lDropped);
msg += str;
@@ -3471,24 +3320,22 @@ void CMainFrame::OnUpdatePlayerStatus(CCmdUI* pCmdUI) }
CComPtr<IPin> pPin;
- if(SUCCEEDED(pCGB->FindPin(m_wndCaptureBar.m_capdlg.m_pDst, PINDIR_INPUT, NULL, NULL, FALSE, 0, &pPin)))
- {
+ if(SUCCEEDED(pCGB->FindPin(m_wndCaptureBar.m_capdlg.m_pDst, PINDIR_INPUT, NULL, NULL, FALSE, 0, &pPin))) {
LONGLONG size = 0;
- if(CComQIPtr<IStream> pStream = pPin)
- {
+ if(CComQIPtr<IStream> pStream = pPin) {
pStream->Commit(STGC_DEFAULT);
WIN32_FIND_DATA findFileData;
HANDLE h = FindFirstFile(m_wndCaptureBar.m_capdlg.m_file, &findFileData);
- if(h != INVALID_HANDLE_VALUE)
- {
+ if(h != INVALID_HANDLE_VALUE) {
size = ((LONGLONG)findFileData.nFileSizeHigh << 32) | findFileData.nFileSizeLow;
CString str;
- if(size < 1024i64*1024)
+ if(size < 1024i64*1024) {
str.Format(ResStr(IDS_MAINFRM_38), size/1024);
- else //if(size < 1024i64*1024*1024)
+ } else { //if(size < 1024i64*1024*1024)
str.Format(ResStr(IDS_MAINFRM_39), size/1024/1024);
+ }
msg += str;
FindClose(h);
@@ -3498,52 +3345,47 @@ void CMainFrame::OnUpdatePlayerStatus(CCmdUI* pCmdUI) ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes;
if(GetDiskFreeSpaceEx(
m_wndCaptureBar.m_capdlg.m_file.Left(m_wndCaptureBar.m_capdlg.m_file.ReverseFind('\\')+1),
- &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes))
- {
+ &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes)) {
CString str;
- if(FreeBytesAvailable.QuadPart < 1024i64*1024)
+ if(FreeBytesAvailable.QuadPart < 1024i64*1024) {
str.Format(ResStr(IDS_MAINFRM_40), FreeBytesAvailable.QuadPart/1024);
- else //if(FreeBytesAvailable.QuadPart < 1024i64*1024*1024)
+ } else { //if(FreeBytesAvailable.QuadPart < 1024i64*1024*1024)
str.Format(ResStr(IDS_MAINFRM_41), FreeBytesAvailable.QuadPart/1024/1024);
+ }
msg += str;
}
- if(m_wndCaptureBar.m_capdlg.m_pMux)
- {
+ if(m_wndCaptureBar.m_capdlg.m_pMux) {
__int64 pos = 0;
CComQIPtr<IMediaSeeking> pMuxMS = m_wndCaptureBar.m_capdlg.m_pMux;
- if(pMuxMS && SUCCEEDED(pMuxMS->GetCurrentPosition(&pos)) && pos > 0)
- {
+ if(pMuxMS && SUCCEEDED(pMuxMS->GetCurrentPosition(&pos)) && pos > 0) {
double bytepersec = 10000000.0 * size / pos;
- if(bytepersec > 0)
+ if(bytepersec > 0) {
m_rtDurationOverride = __int64(10000000.0 * (FreeBytesAvailable.QuadPart+size) / bytepersec);
+ }
}
}
if(m_wndCaptureBar.m_capdlg.m_pVidBuffer
- || m_wndCaptureBar.m_capdlg.m_pAudBuffer)
- {
+ || m_wndCaptureBar.m_capdlg.m_pAudBuffer) {
int nFreeVidBuffers = 0, nFreeAudBuffers = 0;
- if(CComQIPtr<IBufferFilter> pVB = m_wndCaptureBar.m_capdlg.m_pVidBuffer)
+ if(CComQIPtr<IBufferFilter> pVB = m_wndCaptureBar.m_capdlg.m_pVidBuffer) {
nFreeVidBuffers = pVB->GetFreeBuffers();
- if(CComQIPtr<IBufferFilter> pAB = m_wndCaptureBar.m_capdlg.m_pAudBuffer)
+ }
+ if(CComQIPtr<IBufferFilter> pAB = m_wndCaptureBar.m_capdlg.m_pAudBuffer) {
nFreeAudBuffers = pAB->GetFreeBuffers();
+ }
CString str;
str.Format(ResStr(IDS_MAINFRM_42), nFreeVidBuffers, nFreeAudBuffers);
msg += str;
}
}
- }
- else if(m_fBuffering)
- {
- BeginEnumFilters(pGB, pEF, pBF)
- {
- if(CComQIPtr<IAMNetworkStatus, &IID_IAMNetworkStatus> pAMNS = pBF)
- {
+ } else if(m_fBuffering) {
+ BeginEnumFilters(pGB, pEF, pBF) {
+ if(CComQIPtr<IAMNetworkStatus, &IID_IAMNetworkStatus> pAMNS = pBF) {
long BufferingProgress = 0;
- if(SUCCEEDED(pAMNS->get_BufferingProgress(&BufferingProgress)) && BufferingProgress > 0)
- {
+ if(SUCCEEDED(pAMNS->get_BufferingProgress(&BufferingProgress)) && BufferingProgress > 0) {
msg.Format(ResStr(IDS_CONTROLS_BUFFERING), BufferingProgress);
__int64 start = 0, stop = 0;
@@ -3554,15 +3396,15 @@ void CMainFrame::OnUpdatePlayerStatus(CCmdUI* pCmdUI) }
}
EndEnumFilters;
- }
- else if(pAMOP)
- {
+ } else if(pAMOP) {
__int64 t = 0, c = 0;
- if(SUCCEEDED(pAMOP->QueryProgress(&t, &c)) && t > 0 && c < t)
+ if(SUCCEEDED(pAMOP->QueryProgress(&t, &c)) && t > 0 && c < t) {
msg.Format(ResStr(IDS_CONTROLS_BUFFERING), c*100/t);
+ }
- if(m_fUpdateInfoBar)
+ if(m_fUpdateInfoBar) {
OpenSetupInfoBar();
+ }
}
OAFilterState fs = GetMediaState();
@@ -3572,21 +3414,19 @@ void CMainFrame::OnUpdatePlayerStatus(CCmdUI* pCmdUI) (fs == State_Paused || m_fFrameSteppingActive) ? ResStr(IDS_CONTROLS_PAUSED) :
fs == State_Running ? ResStr(IDS_CONTROLS_PLAYING) :
_T("");
- if((!m_fAudioOnly) && (UI_Text == ResStr(IDS_CONTROLS_PLAYING)))
- {
+ if((!m_fAudioOnly) && (UI_Text == ResStr(IDS_CONTROLS_PLAYING))) {
CString DXVA_Text = GetDXVADecoderDescription();
- if(!(_T("Not using DXVA")==DXVA_Text) || (_T("Unknown")==DXVA_Text))
+ if(!(_T("Not using DXVA")==DXVA_Text) || (_T("Unknown")==DXVA_Text)) {
UI_Text += _T(" [DXVA]");
+ }
}
pCmdUI->SetText(UI_Text);
- }
- else if(m_iMediaLoadState == MLS_CLOSING)
- {
+ } else if(m_iMediaLoadState == MLS_CLOSING) {
pCmdUI->SetText(ResStr(IDS_CONTROLS_CLOSING));
- if((AfxGetAppSettings().fUseWin7TaskBar) && (m_pTaskbarList)) m_pTaskbarList->SetProgressState(m_hWnd, TBPF_INDETERMINATE);
- }
- else
- {
+ if((AfxGetAppSettings().fUseWin7TaskBar) && (m_pTaskbarList)) {
+ m_pTaskbarList->SetProgressState(m_hWnd, TBPF_INDETERMINATE);
+ }
+ } else {
pCmdUI->SetText(m_closingmsg);
}
}
@@ -3607,16 +3447,17 @@ void CMainFrame::OnFilePostOpenmedia() pMS->GetDuration(&rtDur);
m_wndPlaylistBar.SetCurTime(rtDur);
- if(GetPlaybackMode() == PM_CAPTURE)
- {
+ if(GetPlaybackMode() == PM_CAPTURE) {
ShowControlBar(&m_wndSubresyncBar, FALSE, TRUE);
-// ShowControlBar(&m_wndPlaylistBar, FALSE, TRUE);
-// ShowControlBar(&m_wndCaptureBar, TRUE, TRUE);
+ // ShowControlBar(&m_wndPlaylistBar, FALSE, TRUE);
+ // ShowControlBar(&m_wndCaptureBar, TRUE, TRUE);
}
m_nCurSubtitle = -1;
m_lSubtitleShift = 0;
- if(m_pCAP) m_pCAP->SetSubtitleDelay(0);
+ if(m_pCAP) {
+ m_pCAP->SetSubtitleDelay(0);
+ }
SetLoadState (MLS_LOADED);
AppSettings& s = AfxGetAppSettings();
@@ -3634,8 +3475,7 @@ void CMainFrame::OnFilePostOpenmedia() // Workaround to avoid MadVR freezing when switching channels in PM_CAPTURE mode:
if(IsWindowVisible() && s.fRememberZoomLevel
&& !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED)
- && GetPlaybackMode() == PM_CAPTURE && s.iDSVideoRendererType == VIDRNDT_DS_MADVR)
- {
+ && GetPlaybackMode() == PM_CAPTURE && s.iDSVideoRendererType == VIDRNDT_DS_MADVR) {
ShowWindow(SW_MAXIMIZE);
wp.showCmd = SW_SHOWMAXIMIZED;
}
@@ -3643,21 +3483,20 @@ void CMainFrame::OnFilePostOpenmedia() // restore magnification
if(IsWindowVisible() && s.fRememberZoomLevel
- && !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED))
- {
+ && !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED)) {
ZoomVideoWindow(false);
}
}
// Waffs : PnS command line
- if(!s.strPnSPreset.IsEmpty())
- {
- for(int i = 0; i < s.m_pnspresets.GetCount(); i++)
- {
+ if(!s.strPnSPreset.IsEmpty()) {
+ for(int i = 0; i < s.m_pnspresets.GetCount(); i++) {
int j = 0;
CString str = s.m_pnspresets[i];
CString label = str.Tokenize(_T(","), j);
- if(s.strPnSPreset == label) OnViewPanNScanPresets(i+ID_PANNSCAN_PRESETS_START);
+ if(s.strPnSPreset == label) {
+ OnViewPanNScanPresets(i+ID_PANNSCAN_PRESETS_START);
+ }
}
s.strPnSPreset.Empty();
}
@@ -3673,8 +3512,7 @@ void CMainFrame::OnUpdateFilePostOpenmedia(CCmdUI* pCmdUI) void CMainFrame::OnFilePostClosemedia()
{
- if (IsD3DFullScreenMode())
- {
+ if (IsD3DFullScreenMode()) {
KillTimer(TIMER_FULLSCREENMOUSEHIDER);
KillTimer(TIMER_FULLSCREENCONTROLBARHIDER);
m_fHideCursor = false;
@@ -3687,17 +3525,16 @@ void CMainFrame::OnFilePostClosemedia() m_wndStatusBar.Clear();
m_wndStatusBar.ShowTimer(false);
- if (AfxGetAppSettings().fEnableEDLEditor)
+ if (AfxGetAppSettings().fEnableEDLEditor) {
m_wndEditListEditor.CloseFile();
+ }
- if(IsWindow(m_wndSubresyncBar.m_hWnd))
- {
+ if(IsWindow(m_wndSubresyncBar.m_hWnd)) {
ShowControlBar(&m_wndSubresyncBar, FALSE, TRUE);
SetSubtitle(NULL);
}
- if(IsWindow(m_wndCaptureBar.m_hWnd))
- {
+ if(IsWindow(m_wndCaptureBar.m_hWnd)) {
ShowControlBar(&m_wndCaptureBar, FALSE, TRUE);
m_wndCaptureBar.m_capdlg.SetupVideoControls(_T(""), NULL, NULL, NULL);
m_wndCaptureBar.m_capdlg.SetupAudioControls(_T(""), NULL, CInterfaceArray<IAMAudioInputMixer>());
@@ -3732,7 +3569,9 @@ void CMainFrame::OnUpdateFilePostClosemedia(CCmdUI* pCmdUI) void CMainFrame::OnBossKey()
{
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
- if(m_fFullScreen) SendMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
+ if(m_fFullScreen) {
+ SendMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
+ }
SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, -1);
}
@@ -3740,130 +3579,156 @@ void CMainFrame::OnStreamAudio(UINT nID) {
nID -= ID_STREAM_AUDIO_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
- if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); // morgan's switcher
+ if(!pSS) {
+ pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); // morgan's switcher
+ }
DWORD cStreams = 0;
- if(pSS && SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 1)
- {
+ if(pSS && SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 1) {
nID = m_iAudioStreams.GetAt(m_iAudioStreams.FindIndex(nID)); // remember that the audio streams are reordered according to user preference, so have to figure out which stream from the original order was clicked
- for(int i = 0; i < (int)cStreams; i++)
- {
+ for(int i = 0; i < (int)cStreams; i++) {
AM_MEDIA_TYPE* pmt = NULL;
DWORD dwFlags = 0;
LCID lcid = 0;
DWORD dwGroup = 0;
WCHAR* pszName = NULL;
- if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)))
+ if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))) {
return;
+ }
- if(pmt) DeleteMediaType(pmt);
- if(pszName) CoTaskMemFree(pszName);
+ if(pmt) {
+ DeleteMediaType(pmt);
+ }
+ if(pszName) {
+ CoTaskMemFree(pszName);
+ }
- if(dwFlags&(AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE))
- {
+ if(dwFlags&(AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE)) {
long stream_index = (i+(nID==0?1:cStreams-1))%cStreams;
pSS->Enable(stream_index, AMSTREAMSELECTENABLE_ENABLE);
- if(SUCCEEDED(pSS->Info(stream_index, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)))
- {
+ if(SUCCEEDED(pSS->Info(stream_index, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))) {
CString strMessage = ResStr(IDS_AUDIO_STREAM);
strMessage.Append(pszName);
m_OSD.DisplayMessage (OSD_TOPLEFT, strMessage);
- if(pmt) DeleteMediaType(pmt);
- if(pszName) CoTaskMemFree(pszName);
+ if(pmt) {
+ DeleteMediaType(pmt);
+ }
+ if(pszName) {
+ CoTaskMemFree(pszName);
+ }
}
break;
}
}
+ } else if(GetPlaybackMode() == PM_FILE) {
+ SendMessage(WM_COMMAND, ID_OGM_AUDIO_NEXT+nID);
+ } else if(GetPlaybackMode() == PM_DVD) {
+ SendMessage(WM_COMMAND, ID_DVD_AUDIO_NEXT+nID);
}
- else if(GetPlaybackMode() == PM_FILE) SendMessage(WM_COMMAND, ID_OGM_AUDIO_NEXT+nID);
- else if(GetPlaybackMode() == PM_DVD) SendMessage(WM_COMMAND, ID_DVD_AUDIO_NEXT+nID);
}
void CMainFrame::OnStreamSub(UINT nID)
{
nID -= ID_STREAM_SUB_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
int cnt = 0;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos) cnt += m_pSubStreams.GetNext(pos)->GetStreamCount();
+ while(pos) {
+ cnt += m_pSubStreams.GetNext(pos)->GetStreamCount();
+ }
- if(cnt > 1)
- {
+ if(cnt > 1) {
int i = ((m_iSubtitleSel&0x7fffffff)+(nID==0?1:cnt-1))%cnt;
m_iSubtitleSel = i | (m_iSubtitleSel&0x80000000);
UpdateSubtitle(true);
SetFocus();
+ } else if(GetPlaybackMode() == PM_FILE) {
+ SendMessage(WM_COMMAND, ID_OGM_SUB_NEXT+nID);
+ } else if(GetPlaybackMode() == PM_DVD) {
+ SendMessage(WM_COMMAND, ID_DVD_SUB_NEXT+nID);
}
- else if(GetPlaybackMode() == PM_FILE) SendMessage(WM_COMMAND, ID_OGM_SUB_NEXT+nID);
- else if(GetPlaybackMode() == PM_DVD) SendMessage(WM_COMMAND, ID_DVD_SUB_NEXT+nID);
}
void CMainFrame::OnStreamSubOnOff()
{
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
int cnt = 0;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos) cnt += m_pSubStreams.GetNext(pos)->GetStreamCount();
+ while(pos) {
+ cnt += m_pSubStreams.GetNext(pos)->GetStreamCount();
+ }
- if(cnt > 0)
- {
- if (m_iSubtitleSel == -1)
+ if(cnt > 0) {
+ if (m_iSubtitleSel == -1) {
m_iSubtitleSel = 0;
- else
+ } else {
m_iSubtitleSel ^= 0x80000000;
+ }
UpdateSubtitle(true);
SetFocus();
AfxGetAppSettings().fEnableSubtitles = !(m_iSubtitleSel & 0x80000000);
- }
- else if(GetPlaybackMode() == PM_DVD)
+ } else if(GetPlaybackMode() == PM_DVD) {
SendMessage(WM_COMMAND, ID_DVD_SUB_ONOFF);
+ }
}
void CMainFrame::OnOgmAudio(UINT nID)
{
nID -= ID_OGM_AUDIO_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
CComQIPtr<IAMStreamSelect> pSS = FindSourceSelectableFilter();
- if(!pSS) return;
+ if(!pSS) {
+ return;
+ }
CAtlArray<int> snds;
int iSel = -1;
DWORD cStreams = 0;
- if(SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 1)
- {
- for(int i = 0; i < (int)cStreams; i++)
- {
+ if(SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 1) {
+ for(int i = 0; i < (int)cStreams; i++) {
AM_MEDIA_TYPE* pmt = NULL;
DWORD dwFlags = 0;
LCID lcid = 0;
DWORD dwGroup = 0;
WCHAR* pszName = NULL;
- if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)))
+ if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))) {
return;
+ }
- if(dwGroup == 1)
- {
- if(dwFlags&(AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE))
+ if(dwGroup == 1) {
+ if(dwFlags&(AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE)) {
iSel = snds.GetCount();
+ }
snds.Add(i);
}
- if(pmt) DeleteMediaType(pmt);
- if(pszName) CoTaskMemFree(pszName);
+ if(pmt) {
+ DeleteMediaType(pmt);
+ }
+ if(pszName) {
+ CoTaskMemFree(pszName);
+ }
}
int cnt = snds.GetCount();
- if(cnt > 1 && iSel >= 0)
- {
+ if(cnt > 1 && iSel >= 0) {
int nNewStream = snds[(iSel+(nID==0?1:cnt-1))%cnt];
pSS->Enable(nNewStream, AMSTREAMSELECTENABLE_ENABLE);
@@ -3873,17 +3738,22 @@ void CMainFrame::OnOgmAudio(UINT nID) DWORD dwGroup = 0;
WCHAR* pszName = NULL;
- if(SUCCEEDED(pSS->Info(nNewStream, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)))
- {
+ if(SUCCEEDED(pSS->Info(nNewStream, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))) {
CString strMessage;
CString audio_stream = pszName;
int k = audio_stream.Find(_T("Audio - "));
- if(k>=0) audio_stream = audio_stream.Right(audio_stream.GetLength() - k - 8);
+ if(k>=0) {
+ audio_stream = audio_stream.Right(audio_stream.GetLength() - k - 8);
+ }
strMessage.Format (_T("%s%s"), ResStr(IDS_AUDIO_STREAM), audio_stream);
m_OSD.DisplayMessage (OSD_TOPLEFT, strMessage);
- if(pmt) DeleteMediaType(pmt);
- if(pszName) CoTaskMemFree(pszName);
+ if(pmt) {
+ DeleteMediaType(pmt);
+ }
+ if(pszName) {
+ CoTaskMemFree(pszName);
+ }
}
}
}
@@ -3893,42 +3763,48 @@ void CMainFrame::OnOgmSub(UINT nID) {
nID -= ID_OGM_SUB_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
CComQIPtr<IAMStreamSelect> pSS = FindSourceSelectableFilter();
- if(!pSS) return;
+ if(!pSS) {
+ return;
+ }
CArray<int> subs;
int iSel = -1;
DWORD cStreams = 0;
- if(SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 1)
- {
- for(int i = 0; i < (int)cStreams; i++)
- {
+ if(SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 1) {
+ for(int i = 0; i < (int)cStreams; i++) {
AM_MEDIA_TYPE* pmt = NULL;
DWORD dwFlags = 0;
LCID lcid = 0;
DWORD dwGroup = 0;
WCHAR* pszName = NULL;
- if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)))
+ if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))) {
return;
+ }
- if(dwGroup == 2)
- {
- if(dwFlags&(AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE))
+ if(dwGroup == 2) {
+ if(dwFlags&(AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE)) {
iSel = subs.GetCount();
+ }
subs.Add(i);
}
- if(pmt) DeleteMediaType(pmt);
- if(pszName) CoTaskMemFree(pszName);
+ if(pmt) {
+ DeleteMediaType(pmt);
+ }
+ if(pszName) {
+ CoTaskMemFree(pszName);
+ }
}
int cnt = subs.GetCount();
- if(cnt > 1 && iSel >= 0)
- {
+ if(cnt > 1 && iSel >= 0) {
int nNewStream = subs[(iSel+(nID==0?1:cnt-1))%cnt];
pSS->Enable(nNewStream, AMSTREAMSELECTENABLE_ENABLE);
@@ -3937,22 +3813,24 @@ void CMainFrame::OnOgmSub(UINT nID) LCID lcid = 0;
DWORD dwGroup = 0;
WCHAR* pszName = NULL;
- if(SUCCEEDED(pSS->Info(nNewStream, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)))
- {
+ if(SUCCEEDED(pSS->Info(nNewStream, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))) {
CString lang;
CString strMessage;
- if (lcid == 0)
+ if (lcid == 0) {
lang = pszName;
- else
- {
+ } else {
int len = GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64);
lang.ReleaseBufferSetLength(max(len-1, 0));
}
strMessage.Format (ResStr(IDS_MAINFRM_45), lang, _T(""));
m_OSD.DisplayMessage (OSD_TOPLEFT, strMessage);
- if(pmt) DeleteMediaType(pmt);
- if(pszName) CoTaskMemFree(pszName);
+ if(pmt) {
+ DeleteMediaType(pmt);
+ }
+ if(pszName) {
+ CoTaskMemFree(pszName);
+ }
}
}
}
@@ -3962,16 +3840,19 @@ void CMainFrame::OnDvdAngle(UINT nID) {
nID -= ID_DVD_ANGLE_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
- if(pDVDI && pDVDC)
- {
+ if(pDVDI && pDVDC) {
ULONG ulAnglesAvailable, ulCurrentAngle;
- if(SUCCEEDED(pDVDI->GetCurrentAngle(&ulAnglesAvailable, &ulCurrentAngle)) && ulAnglesAvailable > 1)
- {
+ if(SUCCEEDED(pDVDI->GetCurrentAngle(&ulAnglesAvailable, &ulCurrentAngle)) && ulAnglesAvailable > 1) {
ulCurrentAngle += nID==0 ? 1 : ulAnglesAvailable-1;
- if(ulCurrentAngle > ulAnglesAvailable) ulCurrentAngle = 1;
- else if(ulCurrentAngle < 1) ulCurrentAngle = ulAnglesAvailable;
+ if(ulCurrentAngle > ulAnglesAvailable) {
+ ulCurrentAngle = 1;
+ } else if(ulCurrentAngle < 1) {
+ ulCurrentAngle = ulAnglesAvailable;
+ }
pDVDC->SelectAngle(ulCurrentAngle, DVD_CMD_FLAG_Block, NULL);
}
}
@@ -3982,19 +3863,18 @@ void CMainFrame::OnDvdAudio(UINT nID) HRESULT hr;
nID -= ID_DVD_AUDIO_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
- if(pDVDI && pDVDC)
- {
+ if(pDVDI && pDVDC) {
ULONG nStreamsAvailable, nCurrentStream;
- if(SUCCEEDED(pDVDI->GetCurrentAudio(&nStreamsAvailable, &nCurrentStream)) && nStreamsAvailable > 1)
- {
+ if(SUCCEEDED(pDVDI->GetCurrentAudio(&nStreamsAvailable, &nCurrentStream)) && nStreamsAvailable > 1) {
DVD_AudioAttributes AATR;
UINT nNextStream = (nCurrentStream+(nID==0?1:nStreamsAvailable-1))%nStreamsAvailable;
hr = pDVDC->SelectAudioStream(nNextStream, DVD_CMD_FLAG_Block, NULL);
- if (SUCCEEDED(pDVDI->GetAudioAttributes(nNextStream, &AATR)))
- {
+ if (SUCCEEDED(pDVDI->GetAudioAttributes(nNextStream, &AATR))) {
CString lang;
CString strMessage;
int len = GetLocaleInfo(AATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64);
@@ -4011,36 +3891,33 @@ void CMainFrame::OnDvdSub(UINT nID) HRESULT hr;
nID -= ID_DVD_SUB_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
- if(pDVDI && pDVDC)
- {
+ if(pDVDI && pDVDC) {
ULONG ulStreamsAvailable, ulCurrentStream;
BOOL bIsDisabled;
if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled))
- && ulStreamsAvailable > 1)
- {
-// UINT nNextStream = (ulCurrentStream+(nID==0?1:ulStreamsAvailable-1))%ulStreamsAvailable;
+ && ulStreamsAvailable > 1) {
+ // UINT nNextStream = (ulCurrentStream+(nID==0?1:ulStreamsAvailable-1))%ulStreamsAvailable;
int nNextStream;
- if (!bIsDisabled)
+ if (!bIsDisabled) {
nNextStream = ulCurrentStream+ (nID==0?1:-1);
- else
+ } else {
nNextStream = (nID==0?0:ulStreamsAvailable-1);
+ }
- if (!bIsDisabled && ((nNextStream < 0) || (nNextStream >= ulStreamsAvailable)))
- {
+ if (!bIsDisabled && ((nNextStream < 0) || (nNextStream >= ulStreamsAvailable))) {
pDVDC->SetSubpictureState(FALSE, DVD_CMD_FLAG_Block, NULL);
m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_MAINFRM_44));
- }
- else
- {
+ } else {
hr = pDVDC->SelectSubpictureStream(nNextStream, DVD_CMD_FLAG_Block, NULL);
DVD_SubpictureAttributes SATR;
pDVDC->SetSubpictureState(TRUE, DVD_CMD_FLAG_Block, NULL);
- if(SUCCEEDED(pDVDI->GetSubpictureAttributes(nNextStream, &SATR)))
- {
+ if(SUCCEEDED(pDVDI->GetSubpictureAttributes(nNextStream, &SATR))) {
CString lang;
CString strMessage;
int len = GetLocaleInfo(SATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64);
@@ -4055,14 +3932,14 @@ void CMainFrame::OnDvdSub(UINT nID) void CMainFrame::OnDvdSubOnOff()
{
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
- if(pDVDI && pDVDC)
- {
+ if(pDVDI && pDVDC) {
ULONG ulStreamsAvailable, ulCurrentStream;
BOOL bIsDisabled;
- if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled)))
- {
+ if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled))) {
pDVDC->SetSubpictureState(bIsDisabled, DVD_CMD_FLAG_Block, NULL);
}
}
@@ -4076,7 +3953,9 @@ void CMainFrame::OnDvdSubOnOff() void CMainFrame::OnFileOpenQuick()
{
- if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar)) return;
+ if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar)) {
+ return;
+ }
CString filter;
CAtlArray<CString> mask;
@@ -4084,20 +3963,23 @@ void CMainFrame::OnFileOpenQuick() COpenFileDlg fd(mask, true, NULL, NULL,
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLEINCLUDENOTIFY,
filter, GetModalParent());
- if(fd.DoModal() != IDOK) return;
+ if(fd.DoModal() != IDOK) {
+ return;
+ }
CAtlList<CString> fns;
POSITION pos = fd.GetStartPosition();
- while(pos) fns.AddTail(fd.GetNextPathName(pos));
+ while(pos) {
+ fns.AddTail(fd.GetNextPathName(pos));
+ }
bool fMultipleFiles = false;
if(fns.GetCount() > 1
|| fns.GetCount() == 1
&& (fns.GetHead()[fns.GetHead().GetLength()-1] == '\\'
- || fns.GetHead()[fns.GetHead().GetLength()-1] == '*'))
- {
+ || fns.GetHead()[fns.GetHead().GetLength()-1] == '*')) {
fMultipleFiles = true;
}
@@ -4108,8 +3990,7 @@ void CMainFrame::OnFileOpenQuick() m_wndPlaylistBar.Open(fns, fMultipleFiles);
- if(m_wndPlaylistBar.GetCount() == 1 && m_wndPlaylistBar.IsWindowVisible() && !m_wndPlaylistBar.IsFloating())
- {
+ if(m_wndPlaylistBar.GetCount() == 1 && m_wndPlaylistBar.IsWindowVisible() && !m_wndPlaylistBar.IsFloating()) {
ShowControlBar(&m_wndPlaylistBar, FALSE, TRUE);
}
@@ -4118,29 +3999,30 @@ void CMainFrame::OnFileOpenQuick() void CMainFrame::OnFileOpenmedia()
{
- if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar) || m_pFullscreenWnd->IsWindow()) return;
+ if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar) || m_pFullscreenWnd->IsWindow()) {
+ return;
+ }
COpenDlg dlg;
- if(dlg.DoModal() != IDOK || dlg.m_fns.GetCount() == 0) return;
+ if(dlg.DoModal() != IDOK || dlg.m_fns.GetCount() == 0) {
+ return;
+ }
- if(!dlg.m_fAppendPlaylist)
- {
+ if(!dlg.m_fAppendPlaylist) {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
}
ShowWindow(SW_SHOW);
SetForegroundWindow();
- if(dlg.m_fAppendPlaylist)
- {
+ if(dlg.m_fAppendPlaylist) {
m_wndPlaylistBar.Append(dlg.m_fns, dlg.m_fMultipleFiles);
return;
}
m_wndPlaylistBar.Open(dlg.m_fns, dlg.m_fMultipleFiles);
- if(m_wndPlaylistBar.GetCount() == 1 && m_wndPlaylistBar.IsWindowVisible() && !m_wndPlaylistBar.IsFloating())
- {
+ if(m_wndPlaylistBar.GetCount() == 1 && m_wndPlaylistBar.IsWindowVisible() && !m_wndPlaylistBar.IsFloating()) {
ShowControlBar(&m_wndPlaylistBar, FALSE, TRUE);
}
@@ -4163,8 +4045,7 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS) {
AppSettings& s = AfxGetAppSettings();
- if (s.hMasterWnd)
- {
+ if (s.hMasterWnd) {
ProcessAPICommand(pCDS);
return TRUE;
}
@@ -4174,8 +4055,9 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS) return FALSE;
*/
- if(pCDS->dwData != 0x6ABE51 || pCDS->cbData < sizeof(DWORD))
+ if(pCDS->dwData != 0x6ABE51 || pCDS->cbData < sizeof(DWORD)) {
return FALSE;
+ }
DWORD len = *((DWORD*)pCDS->lpData);
TCHAR* pBuff = (TCHAR*)((DWORD*)pCDS->lpData + 1);
@@ -4183,24 +4065,23 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS) CAtlList<CString> cmdln;
- while(len-- > 0)
- {
+ while(len-- > 0) {
CString str;
- while(pBuff < pBuffEnd && *pBuff) str += *pBuff++;
+ while(pBuff < pBuffEnd && *pBuff) {
+ str += *pBuff++;
+ }
pBuff++;
cmdln.AddTail(str);
}
s.ParseCommandLine(cmdln);
- if(s.nCLSwitches&CLSW_SLAVE)
- {
+ if(s.nCLSwitches&CLSW_SLAVE) {
SendAPICommand (CMD_CONNECT, L"%d", GetSafeHwnd());
}
POSITION pos = s.slFilters.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CString fullpath = MakeFullPath(s.slFilters.GetNext(pos));
CPath tmp(fullpath);
@@ -4210,42 +4091,36 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS) WIN32_FIND_DATA fd = {0};
HANDLE hFind = FindFirstFile(fullpath, &fd);
- if(hFind != INVALID_HANDLE_VALUE)
- {
- do
- {
- if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) continue;
+ if(hFind != INVALID_HANDLE_VALUE) {
+ do {
+ if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
+ continue;
+ }
CFilterMapper2 fm2(false);
fm2.Register(path + fd.cFileName);
- while(!fm2.m_filters.IsEmpty())
- {
- if(FilterOverride* f = fm2.m_filters.RemoveTail())
- {
+ while(!fm2.m_filters.IsEmpty()) {
+ if(FilterOverride* f = fm2.m_filters.RemoveTail()) {
f->fTemporary = true;
bool fFound = false;
POSITION pos2 = s.m_filters.GetHeadPosition();
- while(pos2)
- {
+ while(pos2) {
FilterOverride* f2 = s.m_filters.GetNext(pos2);
- if(f2->type == FilterOverride::EXTERNAL && !f2->path.CompareNoCase(f->path))
- {
+ if(f2->type == FilterOverride::EXTERNAL && !f2->path.CompareNoCase(f->path)) {
fFound = true;
break;
}
}
- if(!fFound)
- {
+ if(!fFound) {
CAutoPtr<FilterOverride> p(f);
s.m_filters.AddHead(p);
}
}
}
- }
- while(FindNextFile(hFind, &fd));
+ } while(FindNextFile(hFind, &fd));
FindClose(hFind);
}
@@ -4253,60 +4128,51 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS) bool fSetForegroundWindow = false;
- if((s.nCLSwitches&CLSW_DVD) && !s.slFiles.IsEmpty())
- {
+ if((s.nCLSwitches&CLSW_DVD) && !s.slFiles.IsEmpty()) {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
fSetForegroundWindow = true;
CAutoPtr<OpenDVDData> p(DNew OpenDVDData());
- if(p)
- {
+ if(p) {
p->path = s.slFiles.GetHead();
p->subs.AddTailList(&s.slSubs);
}
OpenMedia(p);
- }
- else if(s.nCLSwitches&CLSW_CD)
- {
+ } else if(s.nCLSwitches&CLSW_CD) {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
fSetForegroundWindow = true;
CAtlList<CString> sl;
- if(!s.slFiles.IsEmpty())
- {
+ if(!s.slFiles.IsEmpty()) {
GetCDROMType(s.slFiles.GetHead()[0], sl);
- }
- else
- {
+ } else {
CString dir;
dir.ReleaseBufferSetLength(GetCurrentDirectory(_MAX_PATH, dir.GetBuffer(_MAX_PATH)));
GetCDROMType(dir[0], sl);
- for(TCHAR drive = 'C'; sl.IsEmpty() && drive <= 'Z'; drive++)
- {
+ for(TCHAR drive = 'C'; sl.IsEmpty() && drive <= 'Z'; drive++) {
GetCDROMType(drive, sl);
}
}
m_wndPlaylistBar.Open(sl, true);
OpenCurPlaylistItem();
- }
- else if(!s.slFiles.IsEmpty())
- {
+ } else if(!s.slFiles.IsEmpty()) {
bool fMulti = s.slFiles.GetCount() > 1;
CAtlList<CString> sl;
sl.AddTailList(&s.slFiles);
- if(!fMulti) sl.AddTailList(&s.slDubs);
+ if(!fMulti) {
+ sl.AddTailList(&s.slDubs);
+ }
CHdmvClipInfo ClipInfo;
CString strPlaylistFile;
CAtlList<CHdmvClipInfo::PlaylistItem> MainPlaylist;
- if(!fMulti && is_dir(s.slFiles.GetHead() + _T("\\BDMV")) && SUCCEEDED(ClipInfo.FindMainMovie (s.slFiles.GetHead(), strPlaylistFile, MainPlaylist)))
- {
+ if(!fMulti && is_dir(s.slFiles.GetHead() + _T("\\BDMV")) && SUCCEEDED(ClipInfo.FindMainMovie (s.slFiles.GetHead(), strPlaylistFile, MainPlaylist))) {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
fSetForegroundWindow = true;
@@ -4314,37 +4180,30 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS) CAutoPtr<OpenFileData> p(DNew OpenFileData());
p->fns.AddTail(strPlaylistFile);
OpenMedia(p);
- }
- else if(!fMulti && is_dir(s.slFiles.GetHead() + _T("\\VIDEO_TS")))
- {
+ } else if(!fMulti && is_dir(s.slFiles.GetHead() + _T("\\VIDEO_TS"))) {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
fSetForegroundWindow = true;
CAutoPtr<OpenDVDData> p(DNew OpenDVDData());
- if(p)
- {
+ if(p) {
p->path = s.slFiles.GetHead();
p->subs.AddTailList(&s.slSubs);
}
OpenMedia(p);
- }
- else
- {
- if(last_run && ((GetTickCount()-last_run)<500)) s.nCLSwitches |= CLSW_ADD;
+ } else {
+ if(last_run && ((GetTickCount()-last_run)<500)) {
+ s.nCLSwitches |= CLSW_ADD;
+ }
last_run = GetTickCount();
- if((s.nCLSwitches&CLSW_ADD) && m_wndPlaylistBar.GetCount() > 0)
- {
+ if((s.nCLSwitches&CLSW_ADD) && m_wndPlaylistBar.GetCount() > 0) {
m_wndPlaylistBar.Append(sl, fMulti, &s.slSubs);
- if(s.nCLSwitches&(CLSW_OPEN|CLSW_PLAY))
- {
+ if(s.nCLSwitches&(CLSW_OPEN|CLSW_PLAY)) {
m_wndPlaylistBar.SetLast();
OpenCurPlaylistItem();
}
- }
- else
- {
+ } else {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
fSetForegroundWindow = true;
@@ -4355,14 +4214,13 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS) s.rtStart = 0;
}
}
- }
- else
- {
+ } else {
s.nCLSwitches = CLSW_NONE;
}
- if(fSetForegroundWindow && !(s.nCLSwitches&CLSW_NOFOCUS))
+ if(fSetForegroundWindow && !(s.nCLSwitches&CLSW_NOFOCUS)) {
SetForegroundWindow();
+ }
s.nCLSwitches &= ~CLSW_NOFOCUS;
@@ -4371,14 +4229,13 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS) int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData)
{
- switch(uMsg)
- {
- case BFFM_INITIALIZED:
- //Initial directory is set here
- SendMessage(hwnd, BFFM_SETSELECTION, TRUE,(LPARAM)(LPCTSTR)AfxGetAppSettings().strDVDPath);
- break;
- default:
- break;
+ switch(uMsg) {
+ case BFFM_INITIALIZED:
+ //Initial directory is set here
+ SendMessage(hwnd, BFFM_SETSELECTION, TRUE,(LPARAM)(LPCTSTR)AfxGetAppSettings().strDVDPath);
+ break;
+ default:
+ break;
}
return 0;
}
@@ -4387,7 +4244,9 @@ int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData) void CMainFrame::OnFileOpendvd()
{
- if ((m_iMediaLoadState == MLS_LOADING) || m_pFullscreenWnd->IsWindow()) return;
+ if ((m_iMediaLoadState == MLS_LOADING) || m_pFullscreenWnd->IsWindow()) {
+ return;
+ }
/*
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
@@ -4424,27 +4283,25 @@ void CMainFrame::OnFileOpendvd() static LPITEMIDLIST iil;
iil = SHBrowseForFolder(&bi);
- if(iil)
- {
+ if(iil) {
CHdmvClipInfo ClipInfo;
CString strPlaylistFile;
CAtlList<CHdmvClipInfo::PlaylistItem> MainPlaylist;
SHGetPathFromIDList(iil, path);
s.strDVDPath = path;
- if (SUCCEEDED (ClipInfo.FindMainMovie (path, strPlaylistFile, MainPlaylist)))
- {
+ if (SUCCEEDED (ClipInfo.FindMainMovie (path, strPlaylistFile, MainPlaylist))) {
m_wndPlaylistBar.Empty();
CAutoPtr<OpenFileData> p(DNew OpenFileData());
p->fns.AddTail(strPlaylistFile);
OpenMedia(p);
- }
- else
- {
+ } else {
CAutoPtr<OpenDVDData> p(DNew OpenDVDData());
p->path = path;
p->path.Replace('/', '\\');
- if(p->path[p->path.GetLength()-1] != '\\') p->path += '\\';
+ if(p->path[p->path.GetLength()-1] != '\\') {
+ p->path += '\\';
+ }
OpenMedia(p);
}
@@ -4455,7 +4312,9 @@ void CMainFrame::OnFileOpendevice() {
AppSettings& s = AfxGetAppSettings();
- if(m_iMediaLoadState == MLS_LOADING) return;
+ if(m_iMediaLoadState == MLS_LOADING) {
+ return;
+ }
//COpenCapDeviceDlg capdlg;
//if(capdlg.DoModal() != IDOK)
@@ -4469,14 +4328,12 @@ void CMainFrame::OnFileOpendevice() m_wndPlaylistBar.Empty();
CAutoPtr<OpenDeviceData> p(DNew OpenDeviceData());
- if(p)
- {
+ if(p) {
p->DisplayName[0] = s.strAnalogVideo;
p->DisplayName[1] = s.strAnalogAudio;
}
OpenMedia(p);
- if (GetPlaybackMode() == PM_CAPTURE && !s.fHideNavigation && m_iMediaLoadState == MLS_LOADED && s.iDefaultCaptureDevice == 1)
- {
+ if (GetPlaybackMode() == PM_CAPTURE && !s.fHideNavigation && m_iMediaLoadState == MLS_LOADED && s.iDefaultCaptureDevice == 1) {
m_wndNavigationBar.m_navdlg.UpdateElementList();
ShowControlBar(&m_wndNavigationBar, !s.fHideNavigation, TRUE);
}
@@ -4487,23 +4344,20 @@ void CMainFrame::OnFileOpenCD(UINT nID) nID -= ID_FILE_OPEN_CD_START;
nID++;
- for(TCHAR drive = 'C'; drive <= 'Z'; drive++)
- {
+ for(TCHAR drive = 'C'; drive <= 'Z'; drive++) {
CAtlList<CString> sl;
- switch(GetCDROMType(drive, sl))
- {
- case CDROM_Audio:
- case CDROM_VideoCD:
- case CDROM_DVDVideo:
- nID--;
- break;
- default:
- break;
+ switch(GetCDROMType(drive, sl)) {
+ case CDROM_Audio:
+ case CDROM_VideoCD:
+ case CDROM_DVDVideo:
+ nID--;
+ break;
+ default:
+ break;
}
- if(nID == 0)
- {
+ if(nID == 0) {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
SetForegroundWindow();
@@ -4526,8 +4380,7 @@ void CMainFrame::OnDropFiles(HDROP hDropInfo) {
SetForegroundWindow();
- if(m_wndPlaylistBar.IsWindowVisible())
- {
+ if(m_wndPlaylistBar.IsWindowVisible()) {
m_wndPlaylistBar.OnDropFiles(hDropInfo);
return;
}
@@ -4536,19 +4389,18 @@ void CMainFrame::OnDropFiles(HDROP hDropInfo) UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
- for(UINT iFile = 0; iFile < nFiles; iFile++)
- {
+ for(UINT iFile = 0; iFile < nFiles; iFile++) {
CString fn;
fn.ReleaseBuffer(::DragQueryFile(hDropInfo, iFile, fn.GetBuffer(_MAX_PATH), _MAX_PATH));
sl.AddTail(fn);
WIN32_FIND_DATA fd = {0};
HANDLE hFind = FindFirstFile(fn, &fd);
- if(hFind != INVALID_HANDLE_VALUE)
- {
- if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
- {
- if(fn[fn.GetLength()-1] != '\\') fn += '\\';
+ if(hFind != INVALID_HANDLE_VALUE) {
+ if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
+ if(fn[fn.GetLength()-1] != '\\') {
+ fn += '\\';
+ }
COpenDirHelper::RecurseAddDir(fn, &sl);
}
FindClose(hFind);
@@ -4557,13 +4409,13 @@ void CMainFrame::OnDropFiles(HDROP hDropInfo) ::DragFinish(hDropInfo);
- if(sl.IsEmpty()) return;
+ if(sl.IsEmpty()) {
+ return;
+ }
- if(sl.GetCount() == 1 && m_iMediaLoadState == MLS_LOADED && m_pCAP)
- {
+ if(sl.GetCount() == 1 && m_iMediaLoadState == MLS_LOADED && m_pCAP) {
ISubStream *pSubStream = NULL;
- if(LoadSubtitle(sl.GetHead(), &pSubStream))
- {
+ if(LoadSubtitle(sl.GetHead(), &pSubStream)) {
SetSubtitle(pSubStream); // the subtitle at the insert position according to LoadSubtitle()
CPath p(sl.GetHead());
p.StripPath();
@@ -4580,39 +4432,46 @@ void CMainFrame::OnFileSaveAs() {
CString ext, in = m_wndPlaylistBar.GetCurFileName(), out = in;
- if(out.Find(_T("://")) < 0)
- {
+ if(out.Find(_T("://")) < 0) {
ext = CString(CPath(out).GetExtension()).MakeLower();
- if(ext == _T(".cda")) out = out.Left(out.GetLength()-4) + _T(".wav");
- else if(ext == _T(".ifo")) out = out.Left(out.GetLength()-4) + _T(".vob");
- }
- else
- {
+ if(ext == _T(".cda")) {
+ out = out.Left(out.GetLength()-4) + _T(".wav");
+ } else if(ext == _T(".ifo")) {
+ out = out.Left(out.GetLength()-4) + _T(".vob");
+ }
+ } else {
out.Empty();
}
CFileDialog fd(FALSE, 0, out,
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
ResStr(IDS_MAINFRM_48), GetModalParent(), 0);
- if(fd.DoModal() != IDOK || !in.CompareNoCase(fd.GetPathName())) return;
+ if(fd.DoModal() != IDOK || !in.CompareNoCase(fd.GetPathName())) {
+ return;
+ }
CPath p(fd.GetPathName());
- if(!ext.IsEmpty()) p.AddExtension(ext);
+ if(!ext.IsEmpty()) {
+ p.AddExtension(ext);
+ }
OAFilterState fs = State_Stopped;
pMC->GetState(0, &fs);
- if(fs == State_Running) pMC->Pause();
+ if(fs == State_Running) {
+ pMC->Pause();
+ }
CSaveDlg dlg(in, p);
dlg.DoModal();
- if(fs == State_Running) pMC->Run();
+ if(fs == State_Running) {
+ pMC->Run();
+ }
}
void CMainFrame::OnUpdateFileSaveAs(CCmdUI* pCmdUI)
{
- if(m_iMediaLoadState != MLS_LOADED || GetPlaybackMode() != PM_FILE)
- {
+ if(m_iMediaLoadState != MLS_LOADED || GetPlaybackMode() != PM_FILE) {
pCmdUI->Enable(FALSE);
return;
}
@@ -4620,14 +4479,12 @@ void CMainFrame::OnUpdateFileSaveAs(CCmdUI* pCmdUI) CString fn = m_wndPlaylistBar.GetCurFileName();
CString ext = fn.Mid(fn.ReverseFind('.')+1).MakeLower();
- if(fn.Find(_T("://")) >= 0)
- {
+ if(fn.Find(_T("://")) >= 0) {
pCmdUI->Enable(FALSE);
return;
}
- if((GetVersion()&0x80000000) && (ext == _T("cda") || ext == _T("ifo")))
- {
+ if((GetVersion()&0x80000000) && (ext == _T("cda") || ext == _T("ifo"))) {
pCmdUI->Enable(FALSE);
return;
}
@@ -4637,22 +4494,28 @@ void CMainFrame::OnUpdateFileSaveAs(CCmdUI* pCmdUI) bool CMainFrame::GetDIB(BYTE** ppData, long& size, bool fSilent)
{
- if(!ppData) return false;
+ if(!ppData) {
+ return false;
+ }
*ppData = NULL;
size = 0;
bool fNeedsToPause = !m_pCAP;
- if(fNeedsToPause) fNeedsToPause = !IsVMR7InGraph(pGB);
- if(fNeedsToPause) fNeedsToPause = !IsVMR9InGraph(pGB);
+ if(fNeedsToPause) {
+ fNeedsToPause = !IsVMR7InGraph(pGB);
+ }
+ if(fNeedsToPause) {
+ fNeedsToPause = !IsVMR9InGraph(pGB);
+ }
OAFilterState fs = GetMediaState();
- if(!(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && (fs == State_Paused || fs == State_Running)))
+ if(!(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && (fs == State_Paused || fs == State_Running))) {
return false;
+ }
- if(fs == State_Running && fNeedsToPause)
- {
+ if(fs == State_Running && fNeedsToPause) {
pMC->Pause();
GetMediaState(); // wait for completion of the pause command
}
@@ -4660,101 +4523,90 @@ bool CMainFrame::GetDIB(BYTE** ppData, long& size, bool fSilent) HRESULT hr = S_OK;
CString errmsg;
- do
- {
- if(m_pCAP)
- {
+ do {
+ if(m_pCAP) {
hr = m_pCAP->GetDIB(NULL, (DWORD*)&size);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
errmsg.Format(ResStr(IDS_MAINFRM_49), hr);
break;
}
*ppData = DNew BYTE[size];
- if(!(*ppData)) return false;
+ if(!(*ppData)) {
+ return false;
+ }
hr = m_pCAP->GetDIB(*ppData, (DWORD*)&size);
-// if(FAILED(hr)) {errmsg.Format(_T("GetDIB failed, hr = %08x"), hr); break;}
- if(FAILED(hr))
- {
+ // if(FAILED(hr)) {errmsg.Format(_T("GetDIB failed, hr = %08x"), hr); break;}
+ if(FAILED(hr)) {
OnPlayPause();
GetMediaState(); // Pause and retry to support ffdshow queuing.
int retry = 0;
- while(FAILED(hr) && retry < 20)
- {
+ while(FAILED(hr) && retry < 20) {
hr = m_pCAP->GetDIB(*ppData, (DWORD*)&size);
- if(SUCCEEDED(hr)) break;
+ if(SUCCEEDED(hr)) {
+ break;
+ }
Sleep(1);
retry++;
}
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
errmsg.Format(ResStr(IDS_MAINFRM_49), hr);
break;
}
}
- }
- else if (m_pMFVDC)
- {
+ } else if (m_pMFVDC) {
// Capture with EVR
BITMAPINFOHEADER bih = {sizeof(BITMAPINFOHEADER)};
BYTE* pDib;
DWORD dwSize;
REFERENCE_TIME rtImage = 0;
hr = m_pMFVDC->GetCurrentImage (&bih, &pDib, &dwSize, &rtImage);
- if(FAILED(hr) || dwSize == 0)
- {
+ if(FAILED(hr) || dwSize == 0) {
errmsg.Format(ResStr(IDS_MAINFRM_51), hr);
break;
}
size = (long)dwSize+sizeof(BITMAPINFOHEADER);
*ppData = DNew BYTE[size];
- if(!(*ppData)) return false;
+ if(!(*ppData)) {
+ return false;
+ }
memcpy_s (*ppData, size, &bih, sizeof(BITMAPINFOHEADER));
memcpy_s (*ppData+sizeof(BITMAPINFOHEADER), size-sizeof(BITMAPINFOHEADER), pDib, dwSize);
CoTaskMemFree (pDib);
- }
- else
- {
+ } else {
hr = pBV->GetCurrentImage(&size, NULL);
- if(FAILED(hr) || size == 0)
- {
+ if(FAILED(hr) || size == 0) {
errmsg.Format(ResStr(IDS_MAINFRM_51), hr);
break;
}
*ppData = DNew BYTE[size];
- if(!(*ppData)) return false;
+ if(!(*ppData)) {
+ return false;
+ }
hr = pBV->GetCurrentImage(&size, (long*)*ppData);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
errmsg.Format(ResStr(IDS_MAINFRM_51), hr);
break;
}
}
- }
- while(0);
+ } while(0);
- if(!fSilent)
- {
- if(!errmsg.IsEmpty())
- {
+ if(!fSilent) {
+ if(!errmsg.IsEmpty()) {
AfxMessageBox(errmsg, MB_OK);
}
}
- if(fs == State_Running && GetMediaState() != State_Running)
- {
+ if(fs == State_Running && GetMediaState() != State_Running) {
pMC->Run();
}
- if(FAILED(hr))
- {
- if(*ppData)
- {
+ if(FAILED(hr)) {
+ if(*ppData) {
ASSERT(0); // huh?
delete [] *ppData;
*ppData = NULL;
@@ -4772,10 +4624,8 @@ void CMainFrame::SaveDIB(LPCTSTR fn, BYTE* pData, long size) {
CString ext = CString(CPath(fn).GetExtension()).MakeLower();
- if(ext == _T(".bmp"))
- {
- if(FILE* f = _tfopen(fn, _T("wb")))
- {
+ if(ext == _T(".bmp")) {
+ if(FILE* f = _tfopen(fn, _T("wb"))) {
BITMAPINFO* bi = (BITMAPINFO*)pData;
BITMAPFILEHEADER bfh;
@@ -4784,24 +4634,22 @@ void CMainFrame::SaveDIB(LPCTSTR fn, BYTE* pData, long size) bfh.bfSize = sizeof(bfh) + size;
bfh.bfReserved1 = bfh.bfReserved2 = 0;
- if(bi->bmiHeader.biBitCount <= 8)
- {
- if(bi->bmiHeader.biClrUsed) bfh.bfOffBits += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]);
- else bfh.bfOffBits += (1 << bi->bmiHeader.biBitCount) * DWORD(sizeof(bi->bmiColors[0]));
+ if(bi->bmiHeader.biBitCount <= 8) {
+ if(bi->bmiHeader.biClrUsed) {
+ bfh.bfOffBits += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]);
+ } else {
+ bfh.bfOffBits += (1 << bi->bmiHeader.biBitCount) * DWORD(sizeof(bi->bmiColors[0]));
+ }
}
fwrite(&bfh, 1, sizeof(bfh), f);
fwrite(pData, 1, size, f);
fclose(f);
- }
- else
- {
+ } else {
AfxMessageBox(ResStr(IDS_MAINFRM_53), MB_OK);
}
- }
- else if(ext == _T(".png"))
- {
+ } else if(ext == _T(".png")) {
DWORD bmpsize = size;
LPBITMAPINFOHEADER pdib;
LPBITMAPFILEHEADER pbmfh;
@@ -4817,10 +4665,12 @@ void CMainFrame::SaveDIB(LPCTSTR fn, BYTE* pData, long size) bfh.bfSize = sizeof(bfh) + size;
bfh.bfReserved1 = bfh.bfReserved2 = 0;
- if(bi->bmiHeader.biBitCount <= 8)
- {
- if(bi->bmiHeader.biClrUsed) bfh.bfOffBits += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]);
- else bfh.bfOffBits += (1 << bi->bmiHeader.biBitCount) * DWORD(sizeof(bi->bmiColors[0]));
+ if(bi->bmiHeader.biBitCount <= 8) {
+ if(bi->bmiHeader.biClrUsed) {
+ bfh.bfOffBits += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]);
+ } else {
+ bfh.bfOffBits += (1 << bi->bmiHeader.biBitCount) * DWORD(sizeof(bi->bmiColors[0]));
+ }
}
pbmfh = (LPBITMAPFILEHEADER)&bfh;
pbits = &pData[pbmfh->bfOffBits-sizeof(bfh)];
@@ -4831,22 +4681,18 @@ void CMainFrame::SaveDIB(LPCTSTR fn, BYTE* pData, long size) pngdib_d2p_set_gamma_label(pngdib, 1, PNGDIB_DEFAULT_FILE_GAMMA);
ret = pngdib_d2p_run(pngdib);
pngdib_done(pngdib);
- if(ret)
- {
+ if(ret) {
CString err_str;
err_str.Format(_T("%s\n%s (%d)"), IDS_MAINFRM_53, pngdib_get_error_msg(pngdib), ret);
AfxMessageBox(err_str, MB_OK);
}
- }
- else if(ext == _T(".jpg"))
- {
+ } else if(ext == _T(".jpg")) {
CJpegEncoderFile(fn).Encode(pData);
}
CPath p(fn);
- if(CDC* pDC = m_wndStatusBar.m_status.GetDC())
- {
+ if(CDC* pDC = m_wndStatusBar.m_status.GetDC()) {
CRect r;
m_wndStatusBar.m_status.GetClientRect(r);
p.CompactPath(pDC->m_hDC, r.Width());
@@ -4861,8 +4707,7 @@ void CMainFrame::SaveImage(LPCTSTR fn) BYTE* pData = NULL;
long size = 0;
- if(GetDIB(&pData, size))
- {
+ if(GetDIB(&pData, size)) {
SaveDIB(fn, pData, size);
delete [] pData;
}
@@ -4870,14 +4715,14 @@ void CMainFrame::SaveImage(LPCTSTR fn) void CMainFrame::SaveThumbnails(LPCTSTR fn)
{
- if(!pMC || !pMS || GetPlaybackMode() != PM_FILE /*&& GetPlaybackMode() != PM_DVD*/)
+ if(!pMC || !pMS || GetPlaybackMode() != PM_FILE /*&& GetPlaybackMode() != PM_DVD*/) {
return;
+ }
REFERENCE_TIME rtPos = GetPos();
REFERENCE_TIME rtDur = GetDur();
- if(rtDur <= 0)
- {
+ if(rtDur <= 0) {
AfxMessageBox(ResStr(IDS_MAINFRM_54));
return;
}
@@ -4889,35 +4734,31 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn) CSize video, wh(0, 0), arxy(0, 0);
- if (m_pMFVDC)
- {
+ if (m_pMFVDC) {
m_pMFVDC->GetNativeVideoSize(&wh, &arxy);
- }
- else if(m_pCAP)
- {
+ } else if(m_pCAP) {
wh = m_pCAP->GetVideoSize(false);
arxy = m_pCAP->GetVideoSize(true);
- }
- else
- {
+ } else {
pBV->GetVideoSize(&wh.cx, &wh.cy);
long arx = 0, ary = 0;
CComQIPtr<IBasicVideo2> pBV2 = pBV;
- if(pBV2 && SUCCEEDED(pBV2->GetPreferredAspectRatio(&arx, &ary)) && arx > 0 && ary > 0)
+ if(pBV2 && SUCCEEDED(pBV2->GetPreferredAspectRatio(&arx, &ary)) && arx > 0 && ary > 0) {
arxy.SetSize(arx, ary);
+ }
}
- if(wh.cx <= 0 || wh.cy <= 0)
- {
+ if(wh.cx <= 0 || wh.cy <= 0) {
AfxMessageBox(ResStr(IDS_MAINFRM_55));
return;
}
// with the overlay mixer IBasicVideo2 won't tell the new AR when changed dynamically
DVD_VideoAttributes VATR;
- if(GetPlaybackMode() == PM_DVD && SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR)))
+ if(GetPlaybackMode() == PM_DVD && SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR))) {
arxy.SetSize(VATR.ulAspectX, VATR.ulAspectY);
+ }
video = (arxy.cx <= 0 || arxy.cy <= 0) ? wh : CSize(MulDiv(wh.cy, arxy.cx, arxy.cy), wh.cy);
@@ -4935,8 +4776,7 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn) int dibsize = sizeof(BITMAPINFOHEADER) + width*height*4;
CAutoVectorPtr<BYTE> dib;
- if(!dib.Allocate(dibsize))
- {
+ if(!dib.Allocate(dibsize)) {
AfxMessageBox(ResStr(IDS_MAINFRM_56));
return;
}
@@ -4963,15 +4803,15 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn) {
BYTE* p = (BYTE*)spd.bits;
for(int y = 0; y < spd.h; y++, p += spd.pitch)
- for(int x = 0; x < spd.w; x++)
+ for(int x = 0; x < spd.w; x++) {
((DWORD*)p)[x] = 0x010101 * (0xe0 + 0x08*y/spd.h + 0x18*(spd.w-x)/spd.w);
+ }
}
CCritSec csSubLock;
RECT bbox;
- for(int i = 1, pics = cols*rows; i <= pics; i++)
- {
+ for(int i = 1, pics = cols*rows; i <= pics; i++) {
REFERENCE_TIME rt = rtDur * i / (pics+1);
DVD_HMSF_TIMECODE hmsf = RT2HMSF(rt, 25);
@@ -4982,8 +4822,7 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn) HRESULT hr = pFS ? pFS->Step(1, NULL) : E_FAIL;
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
pBA->put_Volume(m_VolumeBeforeFrameStepping);
AfxMessageBox(_T("Cannot frame step, try a different video renderer."));
return;
@@ -4992,13 +4831,13 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn) HANDLE hGraphEvent = NULL;
pME->GetEventHandle((OAEVENT*)&hGraphEvent);
- while(hGraphEvent && WaitForSingleObject(hGraphEvent, INFINITE) == WAIT_OBJECT_0)
- {
+ while(hGraphEvent && WaitForSingleObject(hGraphEvent, INFINITE) == WAIT_OBJECT_0) {
LONG evCode = 0, evParam1, evParam2;
- while(SUCCEEDED(pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0)))
- {
+ while(SUCCEEDED(pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0))) {
pME->FreeEventParams(evCode, evParam1, evParam2);
- if(EC_STEP_COMPLETE == evCode) hGraphEvent = NULL;
+ if(EC_STEP_COMPLETE == evCode) {
+ hGraphEvent = NULL;
+ }
}
}
@@ -5031,12 +4870,13 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn) BYTE* pData = NULL;
long size = 0;
- if(!GetDIB(&pData, size)) return;
+ if(!GetDIB(&pData, size)) {
+ return;
+ }
BITMAPINFO* bi = (BITMAPINFO*)pData;
- if(bi->bmiHeader.biBitCount != 32)
- {
+ if(bi->bmiHeader.biBitCount != 32) {
delete [] pData;
CString str;
str.Format(ResStr(IDS_MAINFRM_57), bi->bmiHeader.biBitCount);
@@ -5048,8 +4888,7 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn) int sh = abs(bi->bmiHeader.biHeight);
int sp = sw*4;
const BYTE* src = pData + sizeof(bi->bmiHeader);
- if(bi->bmiHeader.biHeight >= 0)
- {
+ if(bi->bmiHeader.biHeight >= 0) {
src += sp*(sh-1);
sp = -sp;
}
@@ -5057,8 +4896,7 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn) int dp = spd.pitch;
BYTE* dst = (BYTE*)spd.bits + spd.pitch*r.top + r.left*4;
- for(DWORD h = r.bottom - r.top, y = 0, yd = (sh<<8)/h; h > 0; y += yd, h--)
- {
+ for(DWORD h = r.bottom - r.top, y = 0, yd = (sh<<8)/h; h > 0; y += yd, h--) {
DWORD yf = y&0xff;
DWORD yi = y>>8;
@@ -5066,8 +4904,7 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn) DWORD* s1 = (DWORD*)(src + (int)yi*sp + sp);
DWORD* d = (DWORD*)dst;
- for(DWORD w = r.right - r.left, x = 0, xd = (sw<<8)/w; w > 0; x += xd, w--)
- {
+ for(DWORD w = r.right - r.left, x = 0, xd = (sw<<8)/w; w > 0; x += xd, w--) {
DWORD xf = x&0xff;
DWORD xi = x>>8;
@@ -5118,22 +4955,28 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn) CStringW fs;
WIN32_FIND_DATA wfd;
HANDLE hFind = FindFirstFile(m_wndPlaylistBar.GetCurFileName(), &wfd);
- if(hFind != INVALID_HANDLE_VALUE)
- {
+ if(hFind != INVALID_HANDLE_VALUE) {
FindClose(hFind);
__int64 size = (__int64(wfd.nFileSizeHigh)<<32)|wfd.nFileSizeLow;
__int64 shortsize = size;
CStringW measure = _T("B");
- if(shortsize > 10240) shortsize /= 1024, measure = L"KB";
- if(shortsize > 10240) shortsize /= 1024, measure = L"MB";
- if(shortsize > 10240) shortsize /= 1024, measure = L"GB";
+ if(shortsize > 10240) {
+ shortsize /= 1024, measure = L"KB";
+ }
+ if(shortsize > 10240) {
+ shortsize /= 1024, measure = L"MB";
+ }
+ if(shortsize > 10240) {
+ shortsize /= 1024, measure = L"GB";
+ }
fs.Format(ResStr(IDS_MAINFRM_58), shortsize, measure, size);
}
CStringW ar;
- if(arxy.cx > 0 && arxy.cy > 0 && arxy.cx != wh.cx && arxy.cy != wh.cy)
+ if(arxy.cx > 0 && arxy.cy > 0 && arxy.cx != wh.cx && arxy.cy != wh.cy) {
ar.Format(L"(%d:%d)", arxy.cx, arxy.cy);
+ }
str.Format(ResStr(IDS_MAINFRM_59),
fn, fs, wh.cx, wh.cy, ar, hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds);
@@ -5160,35 +5003,23 @@ BOOL CMainFrame::IsRendererCompatibleWithSaveImage() BOOL result = TRUE;
AppSettings& s = AfxGetAppSettings();
- if(m_fRealMediaGraph)
- {
- if(s.iRMVideoRendererType == VIDRNDT_RM_DEFAULT)
- {
+ if(m_fRealMediaGraph) {
+ if(s.iRMVideoRendererType == VIDRNDT_RM_DEFAULT) {
AfxMessageBox(_T("The 'Save Image' and 'Save Thumbnails' functions do not work with the default video renderer for RealMedia.\nSelect one of the DirectX renderers for RealMedia in MPC's output options and reopen the file."));
result = FALSE;
}
- }
- else
- {
- if(m_fQuicktimeGraph)
- {
- if(s.iQTVideoRendererType == VIDRNDT_QT_DEFAULT)
- {
+ } else {
+ if(m_fQuicktimeGraph) {
+ if(s.iQTVideoRendererType == VIDRNDT_QT_DEFAULT) {
AfxMessageBox(_T("The 'Save Image and 'Save Thumbnails' functions do not work with the default video renderer for QuickTime.\nSelect one of the DirectX renderers for QuickTime in MPC's output options and reopen the file."));
result = FALSE;
}
- }
- else
- {
- if(m_fShockwaveGraph)
- {
+ } else {
+ if(m_fShockwaveGraph) {
AfxMessageBox(_T("The 'Save Image' and 'Save Thumbnails' functions do not work for Shockwave files."));
result = FALSE;
- }
- else
- {
- if(s.iDSVideoRendererType == VIDRNDT_DS_OVERLAYMIXER)
- {
+ } else {
+ if(s.iDSVideoRendererType == VIDRNDT_DS_OVERLAYMIXER) {
AfxMessageBox(_T("The 'Save Image' and 'Save Thumbnails' functions do not work with the Overlay Mixer video renderer.\nChange the video renderer in MPC's output options and reopen the file."));
result = FALSE;
}
@@ -5201,8 +5032,7 @@ BOOL CMainFrame::IsRendererCompatibleWithSaveImage() CString CMainFrame::GetVidPos()
{
CString posstr = _T("");
- if((GetPlaybackMode() == PM_FILE) || (GetPlaybackMode() == PM_DVD))
- {
+ if((GetPlaybackMode() == PM_FILE) || (GetPlaybackMode() == PM_DVD)) {
__int64 start, stop, pos;
m_wndSeekBar.GetRange(start, stop);
pos = m_wndSeekBar.GetPosReal();
@@ -5210,10 +5040,11 @@ CString CMainFrame::GetVidPos() DVD_HMSF_TIMECODE tcNow = RT2HMSF(pos);
DVD_HMSF_TIMECODE tcDur = RT2HMSF(stop);
- if(tcDur.bHours > 0 || (pos >= stop && tcNow.bHours > 0))
+ if(tcDur.bHours > 0 || (pos >= stop && tcNow.bHours > 0)) {
posstr.Format(_T("%02d.%02d.%02d"), tcNow.bHours, tcNow.bMinutes, tcNow.bSeconds);
- else
+ } else {
posstr.Format(_T("%02d.%02d"), tcNow.bMinutes, tcNow.bSeconds);
+ }
}
return posstr;
@@ -5224,22 +5055,18 @@ void CMainFrame::OnFileSaveImage() AppSettings& s = AfxGetAppSettings();
/* Check if a compatible renderer is being used */
- if(!IsRendererCompatibleWithSaveImage())
- {
+ if(!IsRendererCompatibleWithSaveImage()) {
return;
}
CPath psrc(s.strSnapShotPath);
CStringW prefix = _T("snapshot");
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
CPath path(m_wndPlaylistBar.GetCurFileName());
path.StripPath();
prefix.Format(_T("%s_snapshot_%s"), path, GetVidPos());
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
prefix = _T("snapshot_dvd");
prefix.Format(_T("snapshot_dvd_%s"), GetVidPos());
}
@@ -5249,22 +5076,31 @@ void CMainFrame::OnFileSaveImage() OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
_T("BMP - Windows Bitmap (*.bmp)|*.bmp|JPG - JPEG Image (*.jpg)|*.jpg|PNG - Portable Network Graphics (*.png)|*.png||"), GetModalParent(), 0);
- if(s.strSnapShotExt == _T(".bmp")) fd.m_pOFN->nFilterIndex = 1;
- else if(s.strSnapShotExt == _T(".jpg")) fd.m_pOFN->nFilterIndex = 2;
- else if(s.strSnapShotExt == _T(".png")) fd.m_pOFN->nFilterIndex = 3;
+ if(s.strSnapShotExt == _T(".bmp")) {
+ fd.m_pOFN->nFilterIndex = 1;
+ } else if(s.strSnapShotExt == _T(".jpg")) {
+ fd.m_pOFN->nFilterIndex = 2;
+ } else if(s.strSnapShotExt == _T(".png")) {
+ fd.m_pOFN->nFilterIndex = 3;
+ }
- if(fd.DoModal() != IDOK) return;
+ if(fd.DoModal() != IDOK) {
+ return;
+ }
- if(fd.m_pOFN->nFilterIndex == 1) s.strSnapShotExt = _T(".bmp");
- else if(fd.m_pOFN->nFilterIndex == 2) s.strSnapShotExt = _T(".jpg");
- else
- {
+ if(fd.m_pOFN->nFilterIndex == 1) {
+ s.strSnapShotExt = _T(".bmp");
+ } else if(fd.m_pOFN->nFilterIndex == 2) {
+ s.strSnapShotExt = _T(".jpg");
+ } else {
fd.m_pOFN->nFilterIndex = 3;
s.strSnapShotExt = _T(".png");
}
CPath pdst(fd.GetPathName());
- if(pdst.GetExtension().MakeLower() != s.strSnapShotExt) pdst.RenameExtension(s.strSnapShotExt);
+ if(pdst.GetExtension().MakeLower() != s.strSnapShotExt) {
+ pdst.RenameExtension(s.strSnapShotExt);
+ }
CString path = (LPCTSTR)pdst;
pdst.RemoveFileSpec();
s.strSnapShotPath = (LPCTSTR)pdst;
@@ -5277,20 +5113,16 @@ void CMainFrame::OnFileSaveImageAuto() AppSettings& s = AfxGetAppSettings();
/* Check if a compatible renderer is being used */
- if(!IsRendererCompatibleWithSaveImage())
- {
+ if(!IsRendererCompatibleWithSaveImage()) {
return;
}
CStringW prefix = _T("snapshot");
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
CPath path(m_wndPlaylistBar.GetCurFileName());
path.StripPath();
prefix.Format(_T("%s_snapshot_%s"), path, GetVidPos());
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
prefix.Format(_T("snapshot_dvd_%s"), GetVidPos());
}
@@ -5310,15 +5142,13 @@ void CMainFrame::OnFileSaveThumbnails() AppSettings& s = AfxGetAppSettings();
/* Check if a compatible renderer is being used */
- if(!IsRendererCompatibleWithSaveImage())
- {
+ if(!IsRendererCompatibleWithSaveImage()) {
return;
}
CPath psrc(s.strSnapShotPath);
CStringW prefix = _T("thumbs");
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
CPath path(m_wndPlaylistBar.GetCurFileName());
path.StripPath();
prefix.Format(_T("%s_thumbs"), path);
@@ -5330,16 +5160,23 @@ void CMainFrame::OnFileSaveThumbnails() 0, (LPCTSTR)psrc,
_T("BMP - Windows Bitmap (*.bmp)|*.bmp|JPG - JPEG Image (*.jpg)|*.jpg|PNG - Portable Network Graphics (*.png)|*.png||"), GetModalParent());
- if(s.strSnapShotExt == _T(".bmp")) fd.m_pOFN->nFilterIndex = 1;
- else if(s.strSnapShotExt == _T(".jpg")) fd.m_pOFN->nFilterIndex = 2;
- else if(s.strSnapShotExt == _T(".png")) fd.m_pOFN->nFilterIndex = 3;
+ if(s.strSnapShotExt == _T(".bmp")) {
+ fd.m_pOFN->nFilterIndex = 1;
+ } else if(s.strSnapShotExt == _T(".jpg")) {
+ fd.m_pOFN->nFilterIndex = 2;
+ } else if(s.strSnapShotExt == _T(".png")) {
+ fd.m_pOFN->nFilterIndex = 3;
+ }
- if(fd.DoModal() != IDOK) return;
+ if(fd.DoModal() != IDOK) {
+ return;
+ }
- if(fd.m_pOFN->nFilterIndex == 1) s.strSnapShotExt = _T(".bmp");
- else if(fd.m_pOFN->nFilterIndex == 2) s.strSnapShotExt = _T(".jpg");
- else
- {
+ if(fd.m_pOFN->nFilterIndex == 1) {
+ s.strSnapShotExt = _T(".bmp");
+ } else if(fd.m_pOFN->nFilterIndex == 2) {
+ s.strSnapShotExt = _T(".jpg");
+ } else {
fd.m_pOFN->nFilterIndex = 3;
s.strSnapShotExt = _T(".png");
}
@@ -5349,7 +5186,9 @@ void CMainFrame::OnFileSaveThumbnails() s.iThumbWidth = fd.m_width;
CPath pdst(fd.GetPathName());
- if(pdst.GetExtension().MakeLower() != s.strSnapShotExt) pdst.RenameExtension(s.strSnapShotExt);
+ if(pdst.GetExtension().MakeLower() != s.strSnapShotExt) {
+ pdst.RenameExtension(s.strSnapShotExt);
+ }
CString path = (LPCTSTR)pdst;
pdst.RemoveFileSpec();
s.strSnapShotPath = (LPCTSTR)pdst;
@@ -5377,8 +5216,7 @@ void CMainFrame::OnUpdateFileConvert(CCmdUI* pCmdUI) */
void CMainFrame::OnFileLoadsubtitle()
{
- if(!m_pCAP)
- {
+ if(!m_pCAP) {
AfxMessageBox(ResStr(IDS_MAINFRM_60)+
ResStr(IDS_MAINFRM_61)+
ResStr(IDS_MAINFRM_62)+
@@ -5396,11 +5234,14 @@ void CMainFrame::OnFileLoadsubtitle() OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY,
szFilter, GetModalParent(), 0);
- if(fd.DoModal() != IDOK) return;
+ if(fd.DoModal() != IDOK) {
+ return;
+ }
ISubStream *pSubStream = NULL;
- if(LoadSubtitle(fd.GetPathName(), &pSubStream))
- SetSubtitle(pSubStream); // the subtitle at the insert position according to LoadSubtitle()
+ if(LoadSubtitle(fd.GetPathName(), &pSubStream)) {
+ SetSubtitle(pSubStream); // the subtitle at the insert position according to LoadSubtitle()
+ }
}
void CMainFrame::OnUpdateFileLoadsubtitle(CCmdUI *pCmdUI)
@@ -5413,27 +5254,24 @@ void CMainFrame::OnFileSavesubtitle() int i = m_iSubtitleSel;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos && i >= 0)
- {
+ while(pos && i >= 0) {
CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
- if(i < pSubStream->GetStreamCount())
- {
+ if(i < pSubStream->GetStreamCount()) {
CLSID clsid;
- if(FAILED(pSubStream->GetClassID(&clsid)))
+ if(FAILED(pSubStream->GetClassID(&clsid))) {
continue;
+ }
OpenMediaData *pOMD = m_wndPlaylistBar.GetCurOMD();
CString suggestedFileName("");
- if(OpenFileData* p = dynamic_cast<OpenFileData*>(pOMD))
- {
+ if(OpenFileData* p = dynamic_cast<OpenFileData*>(pOMD)) {
// HACK: get the file name from the current playlist item
suggestedFileName = m_wndPlaylistBar.GetCurFileName();
suggestedFileName = suggestedFileName.Left(suggestedFileName.ReverseFind('.')); // exclude the extension, it will be auto completed
}
- if(clsid == __uuidof(CVobSubFile))
- {
+ if(clsid == __uuidof(CVobSubFile)) {
CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)pSubStream;
// remember to set lpszDefExt to the first extension in the filter so that the save dialog autocompletes the extension
@@ -5442,16 +5280,13 @@ void CMainFrame::OnFileSavesubtitle() OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
_T("VobSub (*.idx, *.sub)|*.idx;*.sub||"), GetModalParent(), 0);
- if(fd.DoModal() == IDOK)
- {
+ if(fd.DoModal() == IDOK) {
CAutoLock cAutoLock(&m_csSubLock);
pVSF->Save(fd.GetPathName());
}
return;
- }
- else if(clsid == __uuidof(CRenderedTextSubtitle))
- {
+ } else if(clsid == __uuidof(CRenderedTextSubtitle)) {
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream;
CString filter;
@@ -5467,8 +5302,7 @@ void CMainFrame::OnFileSavesubtitle() // same thing as in the case of CVobSubFile above for lpszDefExt
CSaveTextFileDialog fd(pRTS->m_encoding, _T("srt"), suggestedFileName, filter, GetModalParent());
- if(fd.DoModal() == IDOK)
- {
+ if(fd.DoModal() == IDOK) {
CAutoLock cAutoLock(&m_csSubLock);
pRTS->SaveAs(fd.GetPathName(), (exttype)(fd.m_ofn.nFilterIndex-1), m_pCAP->GetFPS(), fd.GetEncoding());
}
@@ -5519,8 +5353,7 @@ void CMainFrame::OnFileISDBDownload() {
AppSettings& s = AfxGetAppSettings();
filehash fh;
- if(!::hash((CString)m_wndPlaylistBar.GetCurFileName(), fh))
- {
+ if(!::hash((CString)m_wndPlaylistBar.GetCurFileName(), fh)) {
MessageBeep((UINT)-1);
return;
}
@@ -5532,13 +5365,11 @@ void CMainFrame::OnFileISDBDownload() args.Format("player=mpc&name[0]=%s&size[0]=%016I64x&hash[0]=%016I64x",
UrlEncode(CStringA(fh.name)), fh.size, fh.hash);
- try
- {
+ try {
CInternetSession is;
CStringA str;
- if(!OpenUrl(is, CString(url+args), str))
- {
+ if(!OpenUrl(is, CString(url+args), str)) {
AfxMessageBox(_T("Cannot connect to subtitle database site"), MB_OK);
return;
}
@@ -5552,78 +5383,78 @@ void CMainFrame::OnFileISDBDownload() Explode(str, sl, '\n');
POSITION pos = sl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
str = sl.GetNext(pos);
CStringA param = str.Left(max(0, str.Find('=')));
CStringA value = str.Mid(str.Find('=')+1);
- if(param == "ticket") ticket = value;
- else if(param == "movie")
- {
+ if(param == "ticket") {
+ ticket = value;
+ } else if(param == "movie") {
m.reset();
Explode(value, m.titles, '|');
- }
- else if(param == "subtitle")
- {
+ } else if(param == "subtitle") {
sub.reset();
sub.id = atoi(value);
- }
- else if(param == "name") sub.name = value;
- else if(param == "discs") sub.discs = atoi(value);
- else if(param == "disc_no") sub.disc_no = atoi(value);
- else if(param == "format") sub.format = value;
- else if(param == "iso639_2") sub.iso639_2 = value;
- else if(param == "language") sub.language = value;
- else if(param == "nick") sub.nick = value;
- else if(param == "email") sub.email = value;
- else if(param == "" && value == "endsubtitle")
- {
+ } else if(param == "name") {
+ sub.name = value;
+ } else if(param == "discs") {
+ sub.discs = atoi(value);
+ } else if(param == "disc_no") {
+ sub.disc_no = atoi(value);
+ } else if(param == "format") {
+ sub.format = value;
+ } else if(param == "iso639_2") {
+ sub.iso639_2 = value;
+ } else if(param == "language") {
+ sub.language = value;
+ } else if(param == "nick") {
+ sub.nick = value;
+ } else if(param == "email") {
+ sub.email = value;
+ } else if(param == "" && value == "endsubtitle") {
m.subs.AddTail(sub);
- }
- else if(param == "" && value == "endmovie")
- {
+ } else if(param == "" && value == "endmovie") {
movies.AddTail(m);
+ } else if(param == "" && value == "end") {
+ break;
}
- else if(param == "" && value == "end") break;
}
CSubtitleDlDlg dlg(movies, GetModalParent());
- if(IDOK == dlg.DoModal())
- {
- if(dlg.m_fReplaceSubs)
+ if(IDOK == dlg.DoModal()) {
+ if(dlg.m_fReplaceSubs) {
m_pSubStreams.RemoveAll();
+ }
CComPtr<ISubStream> pSubStreamToSet;
POSITION pos = dlg.m_selsubs.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
isdb_subtitle& sub = dlg.m_selsubs.GetNext(pos);
CStringA url = "http://" + s.strISDb + "/dl.php?";
CStringA args;
args.Format("id=%d&ticket=%s", sub.id, UrlEncode(ticket));
- if(OpenUrl(is, CString(url+args), str))
- {
+ if(OpenUrl(is, CString(url+args), str)) {
CAutoPtr<CRenderedTextSubtitle> pRTS(DNew CRenderedTextSubtitle(&m_csSubLock, &s.subdefstyle, s.fUseDefaultSubtitlesStyle));
- if(pRTS && pRTS->Open((BYTE*)(LPCSTR)str, str.GetLength(), DEFAULT_CHARSET, CString(sub.name)) && pRTS->GetStreamCount() > 0)
- {
+ if(pRTS && pRTS->Open((BYTE*)(LPCSTR)str, str.GetLength(), DEFAULT_CHARSET, CString(sub.name)) && pRTS->GetStreamCount() > 0) {
CComPtr<ISubStream> pSubStream = pRTS.Detach();
m_pSubStreams.AddTail(pSubStream);
- if(!pSubStreamToSet) pSubStreamToSet = pSubStream;
+ if(!pSubStreamToSet) {
+ pSubStreamToSet = pSubStream;
+ }
}
}
}
- if(pSubStreamToSet)
+ if(pSubStreamToSet) {
SetSubtitle(pSubStreamToSet);
+ }
}
- }
- catch(CInternetException* ie)
- {
+ } catch(CInternetException* ie) {
ie->Delete();
return;
}
@@ -5683,8 +5514,9 @@ void CMainFrame::OnViewResetStats() void CMainFrame::OnViewDisplayStatsSC()
{
++AfxGetMyApp()->m_Renderers.m_fDisplayStats;
- if (AfxGetMyApp()->m_Renderers.m_fDisplayStats > 3)
+ if (AfxGetMyApp()->m_Renderers.m_fDisplayStats > 3) {
AfxGetMyApp()->m_Renderers.m_fDisplayStats = 0;
+ }
}
void CMainFrame::OnUpdateViewVSync(CCmdUI* pCmdUI)
@@ -5783,23 +5615,22 @@ void CMainFrame::OnUpdateViewColorManagementInput(CCmdUI* pCmdUI) pCmdUI->Enable (supported);
- switch (pCmdUI->m_nID)
- {
- case ID_VIEW_COLORMANAGEMENT_INPUT_AUTO:
- pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementInput == VIDEO_SYSTEM_UNKNOWN);
- break;
+ switch (pCmdUI->m_nID) {
+ case ID_VIEW_COLORMANAGEMENT_INPUT_AUTO:
+ pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementInput == VIDEO_SYSTEM_UNKNOWN);
+ break;
- case ID_VIEW_COLORMANAGEMENT_INPUT_HDTV:
- pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementInput == VIDEO_SYSTEM_HDTV);
- break;
+ case ID_VIEW_COLORMANAGEMENT_INPUT_HDTV:
+ pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementInput == VIDEO_SYSTEM_HDTV);
+ break;
- case ID_VIEW_COLORMANAGEMENT_INPUT_SDTV_NTSC:
- pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementInput == VIDEO_SYSTEM_SDTV_NTSC);
- break;
+ case ID_VIEW_COLORMANAGEMENT_INPUT_SDTV_NTSC:
+ pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementInput == VIDEO_SYSTEM_SDTV_NTSC);
+ break;
- case ID_VIEW_COLORMANAGEMENT_INPUT_SDTV_PAL:
- pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementInput == VIDEO_SYSTEM_SDTV_PAL);
- break;
+ case ID_VIEW_COLORMANAGEMENT_INPUT_SDTV_PAL:
+ pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementInput == VIDEO_SYSTEM_SDTV_PAL);
+ break;
}
}
@@ -5816,19 +5647,18 @@ void CMainFrame::OnUpdateViewColorManagementAmbientLight(CCmdUI* pCmdUI) pCmdUI->Enable (supported);
- switch (pCmdUI->m_nID)
- {
- case ID_VIEW_COLORMANAGEMENT_AMBIENTLIGHT_BRIGHT:
- pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementAmbientLight == AMBIENT_LIGHT_BRIGHT);
- break;
+ switch (pCmdUI->m_nID) {
+ case ID_VIEW_COLORMANAGEMENT_AMBIENTLIGHT_BRIGHT:
+ pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementAmbientLight == AMBIENT_LIGHT_BRIGHT);
+ break;
- case ID_VIEW_COLORMANAGEMENT_AMBIENTLIGHT_DIM:
- pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementAmbientLight == AMBIENT_LIGHT_DIM);
- break;
+ case ID_VIEW_COLORMANAGEMENT_AMBIENTLIGHT_DIM:
+ pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementAmbientLight == AMBIENT_LIGHT_DIM);
+ break;
- case ID_VIEW_COLORMANAGEMENT_AMBIENTLIGHT_DARK:
- pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementAmbientLight == AMBIENT_LIGHT_DARK);
- break;
+ case ID_VIEW_COLORMANAGEMENT_AMBIENTLIGHT_DARK:
+ pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementAmbientLight == AMBIENT_LIGHT_DARK);
+ break;
}
}
@@ -5845,23 +5675,22 @@ void CMainFrame::OnUpdateViewColorManagementIntent(CCmdUI* pCmdUI) pCmdUI->Enable (supported);
- switch (pCmdUI->m_nID)
- {
- case ID_VIEW_COLORMANAGEMENT_INTENT_PERCEPTUAL:
- pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementIntent == COLOR_RENDERING_INTENT_PERCEPTUAL);
- break;
+ switch (pCmdUI->m_nID) {
+ case ID_VIEW_COLORMANAGEMENT_INTENT_PERCEPTUAL:
+ pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementIntent == COLOR_RENDERING_INTENT_PERCEPTUAL);
+ break;
- case ID_VIEW_COLORMANAGEMENT_INTENT_RELATIVECOLORIMETRIC:
- pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementIntent == COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC);
- break;
+ case ID_VIEW_COLORMANAGEMENT_INTENT_RELATIVECOLORIMETRIC:
+ pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementIntent == COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC);
+ break;
- case ID_VIEW_COLORMANAGEMENT_INTENT_SATURATION:
- pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementIntent == COLOR_RENDERING_INTENT_SATURATION);
- break;
+ case ID_VIEW_COLORMANAGEMENT_INTENT_SATURATION:
+ pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementIntent == COLOR_RENDERING_INTENT_SATURATION);
+ break;
- case ID_VIEW_COLORMANAGEMENT_INTENT_ABSOLUTECOLORIMETRIC:
- pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementIntent == COLOR_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC);
- break;
+ case ID_VIEW_COLORMANAGEMENT_INTENT_ABSOLUTECOLORIMETRIC:
+ pCmdUI->SetCheck(r.m_RenderSettings.iVMR9ColorManagementIntent == COLOR_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC);
+ break;
}
}
@@ -5875,10 +5704,11 @@ void CMainFrame::OnUpdateViewEVROutputRange(CCmdUI* pCmdUI) pCmdUI->Enable (supported);
- if (pCmdUI->m_nID == ID_VIEW_EVROUTPUTRANGE_0_255)
+ if (pCmdUI->m_nID == ID_VIEW_EVROUTPUTRANGE_0_255) {
pCmdUI->SetCheck(r.m_RenderSettings.iEVROutputRange == 0);
- else if (pCmdUI->m_nID == ID_VIEW_EVROUTPUTRANGE_16_235)
+ } else if (pCmdUI->m_nID == ID_VIEW_EVROUTPUTRANGE_16_235) {
pCmdUI->SetCheck(r.m_RenderSettings.iEVROutputRange == 1);
+ }
}
@@ -5892,12 +5722,13 @@ void CMainFrame::OnUpdateViewFlushGPU(CCmdUI* pCmdUI) pCmdUI->Enable (supported);
- if (pCmdUI->m_nID == ID_VIEW_FLUSHGPU_BEFOREVSYNC)
+ if (pCmdUI->m_nID == ID_VIEW_FLUSHGPU_BEFOREVSYNC) {
pCmdUI->SetCheck(r.m_RenderSettings.iVMRFlushGPUBeforeVSync != 0);
- else if (pCmdUI->m_nID == ID_VIEW_FLUSHGPU_AFTERPRESENT)
+ } else if (pCmdUI->m_nID == ID_VIEW_FLUSHGPU_AFTERPRESENT) {
pCmdUI->SetCheck(r.m_RenderSettings.iVMRFlushGPUAfterPresent != 0);
- else if (pCmdUI->m_nID == ID_VIEW_FLUSHGPU_WAIT)
+ } else if (pCmdUI->m_nID == ID_VIEW_FLUSHGPU_WAIT) {
pCmdUI->SetCheck(r.m_RenderSettings.iVMRFlushGPUWait != 0);
+ }
}
@@ -6054,8 +5885,7 @@ void CMainFrame::OnViewSynchronizeVideo() {
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.bSynchronizeVideo = !s.m_RenderSettings.bSynchronizeVideo;
- if (s.m_RenderSettings.bSynchronizeVideo)
- {
+ if (s.m_RenderSettings.bSynchronizeVideo) {
s.m_RenderSettings.bSynchronizeDisplay = false;
s.m_RenderSettings.bSynchronizeNearest = false;
s.m_RenderSettings.iVMR9VSync = false;
@@ -6073,8 +5903,7 @@ void CMainFrame::OnViewSynchronizeDisplay() {
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.bSynchronizeDisplay = !s.m_RenderSettings.bSynchronizeDisplay;
- if (s.m_RenderSettings.bSynchronizeDisplay)
- {
+ if (s.m_RenderSettings.bSynchronizeDisplay) {
s.m_RenderSettings.bSynchronizeVideo = false;
s.m_RenderSettings.bSynchronizeNearest = false;
s.m_RenderSettings.iVMR9VSync = false;
@@ -6092,8 +5921,7 @@ void CMainFrame::OnViewSynchronizeNearest() {
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.bSynchronizeNearest = !s.m_RenderSettings.bSynchronizeNearest;
- if (s.m_RenderSettings.bSynchronizeNearest)
- {
+ if (s.m_RenderSettings.bSynchronizeNearest) {
s.m_RenderSettings.bSynchronizeVideo = false;
s.m_RenderSettings.bSynchronizeDisplay = false;
s.m_RenderSettings.iVMR9VSync = false;
@@ -6382,13 +6210,10 @@ void CMainFrame::OnViewVSyncOffsetIncrease() AppSettings& s = AfxGetAppSettings();
CRenderersSettings& r = s.m_RenderersSettings;
CString Format;
- if (s.iDSVideoRendererType == VIDRNDT_DS_SYNC)
- {
+ if (s.iDSVideoRendererType == VIDRNDT_DS_SYNC) {
r.m_RenderSettings.fTargetSyncOffset = r.m_RenderSettings.fTargetSyncOffset - 0.5; // Yeah, it should be a "-"
Format.Format(L"Target VSync Offset: %.1f", r.m_RenderSettings.fTargetSyncOffset);
- }
- else
- {
+ } else {
++r.m_RenderSettings.iVMR9VSyncOffset;
Format.Format(L"VSync Offset: %d", r.m_RenderSettings.iVMR9VSyncOffset);
}
@@ -6401,13 +6226,10 @@ void CMainFrame::OnViewVSyncOffsetDecrease() AppSettings& s = AfxGetAppSettings();
CRenderersSettings& r = s.m_RenderersSettings;
CString Format;
- if (s.iDSVideoRendererType == VIDRNDT_DS_SYNC)
- {
+ if (s.iDSVideoRendererType == VIDRNDT_DS_SYNC) {
r.m_RenderSettings.fTargetSyncOffset = r.m_RenderSettings.fTargetSyncOffset + 0.5;
Format.Format(L"Target VSync Offset: %.1f", r.m_RenderSettings.fTargetSyncOffset);
- }
- else
- {
+ } else {
--r.m_RenderSettings.iVMR9VSyncOffset;
Format.Format(L"VSync Offset: %d", r.m_RenderSettings.iVMR9VSyncOffset);
}
@@ -6425,7 +6247,9 @@ void CMainFrame::OnUpdateViewRemainingTime(CCmdUI* pCmdUI) void CMainFrame::OnViewRemainingTime()
{
m_bRemainingTime = !m_bRemainingTime;
- if (!m_bRemainingTime) m_OSD.ClearMessage();
+ if (!m_bRemainingTime) {
+ m_OSD.ClearMessage();
+ }
}
void CMainFrame::OnUpdateShaderToggle(CCmdUI* pCmdUI)
@@ -6443,15 +6267,13 @@ void CMainFrame::OnUpdateShaderToggleScreenSpace(CCmdUI* pCmdUI) void CMainFrame::OnShaderToggle()
{
m_bToggleShader = !m_bToggleShader;
- if (!m_bToggleShader)
- {
+ if (!m_bToggleShader) {
SetShaders();
m_OSD.DisplayMessage (OSD_TOPRIGHT, ResStr(IDS_MAINFRM_65));
- }
- else
- {
- if (m_pCAP)
+ } else {
+ if (m_pCAP) {
m_pCAP->SetPixelShader(NULL, NULL);
+ }
m_OSD.DisplayMessage (OSD_TOPRIGHT, ResStr(IDS_MAINFRM_66));
}
@@ -6460,15 +6282,13 @@ void CMainFrame::OnShaderToggle() void CMainFrame::OnShaderToggleScreenSpace()
{
m_bToggleShaderScreenSpace = !m_bToggleShaderScreenSpace;
- if (!m_bToggleShaderScreenSpace)
- {
+ if (!m_bToggleShaderScreenSpace) {
SetShaders();
m_OSD.DisplayMessage (OSD_TOPRIGHT, ResStr(IDS_MAINFRM_PPONSCR));
- }
- else
- {
- if (m_pCAP2)
+ } else {
+ if (m_pCAP2) {
m_pCAP2->SetPixelShader2(NULL, NULL, true);
+ }
m_OSD.DisplayMessage (OSD_TOPRIGHT, ResStr(IDS_MAINFRM_PPOFFSCR));
}
@@ -6482,10 +6302,11 @@ void CMainFrame::OnD3DFullscreenToggle() s.fD3DFullscreen = !s.fD3DFullscreen;
strMsg = s.fD3DFullscreen ? ResStr(IDS_MAINFRM_67) : _T("D3D Fullscreen off");
- if (m_iMediaLoadState == MLS_CLOSED)
+ if (m_iMediaLoadState == MLS_CLOSED) {
m_closingmsg = strMsg;
- else
+ } else {
m_OSD.DisplayMessage (OSD_TOPRIGHT, strMsg);
+ }
}
void CMainFrame::OnFileClosePlaylist()
@@ -6507,8 +6328,9 @@ void CMainFrame::OnViewCaptionmenu() s.iCaptionMenuMode++;
s.iCaptionMenuMode %= MODE_COUNT; // three states: normal->borderless->frame only->
- if ( m_fFullScreen )
+ if ( m_fFullScreen ) {
return;
+ }
DWORD dwRemove = 0, dwAdd = 0;
HMENU hMenu = NULL;
@@ -6516,26 +6338,25 @@ void CMainFrame::OnViewCaptionmenu() CRect wr;
GetWindowRect( &wr );
- switch(s.iCaptionMenuMode)
- {
- case MODE_BORDERLESS : // normal -> borderless
- dwRemove = WS_CAPTION | WS_THICKFRAME;
- wr.right -= (GetSystemMetrics( SM_CXSIZEFRAME ) * 2); // "Resize" borders
- wr.bottom -= (GetSystemMetrics( SM_CYSIZEFRAME ) * 2); // "Resize" borders
- wr.bottom -= (GetSystemMetrics( SM_CYCAPTION ) + GetSystemMetrics( SM_CYMENU ));
- break;
+ switch(s.iCaptionMenuMode) {
+ case MODE_BORDERLESS : // normal -> borderless
+ dwRemove = WS_CAPTION | WS_THICKFRAME;
+ wr.right -= (GetSystemMetrics( SM_CXSIZEFRAME ) * 2); // "Resize" borders
+ wr.bottom -= (GetSystemMetrics( SM_CYSIZEFRAME ) * 2); // "Resize" borders
+ wr.bottom -= (GetSystemMetrics( SM_CYCAPTION ) + GetSystemMetrics( SM_CYMENU ));
+ break;
- case MODE_SHOWCAPTIONMENU: // frameonly -> normal
- dwAdd = WS_CAPTION;
- hMenu = m_hMenuDefault;
- wr.bottom += (GetSystemMetrics( SM_CYCAPTION ) + GetSystemMetrics( SM_CYMENU ));
- break;
+ case MODE_SHOWCAPTIONMENU: // frameonly -> normal
+ dwAdd = WS_CAPTION;
+ hMenu = m_hMenuDefault;
+ wr.bottom += (GetSystemMetrics( SM_CYCAPTION ) + GetSystemMetrics( SM_CYMENU ));
+ break;
- case MODE_FRAMEONLY: // borderless -> frameonly
- dwAdd = WS_THICKFRAME;
- wr.right += (GetSystemMetrics( SM_CXSIZEFRAME ) * 2);
- wr.bottom += (GetSystemMetrics( SM_CYSIZEFRAME ) * 2);
- break;
+ case MODE_FRAMEONLY: // borderless -> frameonly
+ dwAdd = WS_THICKFRAME;
+ wr.right += (GetSystemMetrics( SM_CXSIZEFRAME ) * 2);
+ wr.bottom += (GetSystemMetrics( SM_CYSIZEFRAME ) * 2);
+ break;
}
ModifyStyle(dwRemove, dwAdd, SWP_NOZORDER);
@@ -6593,8 +6414,7 @@ void CMainFrame::OnViewEditListEditor() {
AppSettings& s = AfxGetAppSettings();
- if (s.fEnableEDLEditor || (AfxMessageBox(_T("Do you want to activate EDL editor?"), MB_YESNO) == IDYES))
- {
+ if (s.fEnableEDLEditor || (AfxMessageBox(_T("Do you want to activate EDL editor?"), MB_YESNO) == IDYES)) {
s.fEnableEDLEditor = true;
ShowControlBar(&m_wndEditListEditor, !m_wndEditListEditor.IsWindowVisible(), TRUE);
}
@@ -6602,8 +6422,7 @@ void CMainFrame::OnViewEditListEditor() void CMainFrame::OnEDLIn()
{
- if(AfxGetAppSettings().fEnableEDLEditor && (m_iMediaLoadState == MLS_LOADED) && (GetPlaybackMode() == PM_FILE))
- {
+ if(AfxGetAppSettings().fEnableEDLEditor && (m_iMediaLoadState == MLS_LOADED) && (GetPlaybackMode() == PM_FILE)) {
REFERENCE_TIME rt;
pMS->GetCurrentPosition(&rt);
@@ -6618,8 +6437,7 @@ void CMainFrame::OnUpdateEDLIn(CCmdUI* pCmdUI) void CMainFrame::OnEDLOut()
{
- if(AfxGetAppSettings().fEnableEDLEditor && (m_iMediaLoadState == MLS_LOADED) && (GetPlaybackMode() == PM_FILE))
- {
+ if(AfxGetAppSettings().fEnableEDLEditor && (m_iMediaLoadState == MLS_LOADED) && (GetPlaybackMode() == PM_FILE)) {
REFERENCE_TIME rt;
pMS->GetCurrentPosition(&rt);
@@ -6634,8 +6452,7 @@ void CMainFrame::OnUpdateEDLOut(CCmdUI* pCmdUI) void CMainFrame::OnEDLNewClip()
{
- if(AfxGetAppSettings().fEnableEDLEditor && (m_iMediaLoadState == MLS_LOADED) && (GetPlaybackMode() == PM_FILE))
- {
+ if(AfxGetAppSettings().fEnableEDLEditor && (m_iMediaLoadState == MLS_LOADED) && (GetPlaybackMode() == PM_FILE)) {
REFERENCE_TIME rt;
pMS->GetCurrentPosition(&rt);
@@ -6650,8 +6467,7 @@ void CMainFrame::OnUpdateEDLNewClip(CCmdUI* pCmdUI) void CMainFrame::OnEDLSave()
{
- if(AfxGetAppSettings().fEnableEDLEditor && (m_iMediaLoadState == MLS_LOADED) && (GetPlaybackMode() == PM_FILE))
- {
+ if(AfxGetAppSettings().fEnableEDLEditor && (m_iMediaLoadState == MLS_LOADED) && (GetPlaybackMode() == PM_FILE)) {
m_wndEditListEditor.Save();
}
}
@@ -6667,8 +6483,9 @@ void CMainFrame::OnViewNavigation() AppSettings& s = AfxGetAppSettings();
s.fHideNavigation = !s.fHideNavigation;
m_wndNavigationBar.m_navdlg.UpdateElementList();
- if (GetPlaybackMode() == PM_CAPTURE)
+ if (GetPlaybackMode() == PM_CAPTURE) {
ShowControlBar(&m_wndNavigationBar, !s.fHideNavigation, TRUE);
+ }
}
void CMainFrame::OnUpdateViewNavigation(CCmdUI* pCmdUI)
@@ -6701,8 +6518,9 @@ void CMainFrame::OnUpdateViewShaderEditor(CCmdUI* pCmdUI) void CMainFrame::OnViewMinimal()
{
- while(AfxGetAppSettings().iCaptionMenuMode!=MODE_BORDERLESS)
+ while(AfxGetAppSettings().iCaptionMenuMode!=MODE_BORDERLESS) {
SendMessage(WM_COMMAND, ID_VIEW_CAPTIONMENU);
+ }
ShowControls(CS_NONE);
}
@@ -6712,8 +6530,9 @@ void CMainFrame::OnUpdateViewMinimal(CCmdUI* pCmdUI) void CMainFrame::OnViewCompact()
{
- while(AfxGetAppSettings().iCaptionMenuMode!=MODE_FRAMEONLY)
+ while(AfxGetAppSettings().iCaptionMenuMode!=MODE_FRAMEONLY) {
SendMessage(WM_COMMAND, ID_VIEW_CAPTIONMENU);
+ }
ShowControls(CS_TOOLBAR);
}
@@ -6723,8 +6542,9 @@ void CMainFrame::OnUpdateViewCompact(CCmdUI* pCmdUI) void CMainFrame::OnViewNormal()
{
- while(AfxGetAppSettings().iCaptionMenuMode!=MODE_SHOWCAPTIONMENU)
+ while(AfxGetAppSettings().iCaptionMenuMode!=MODE_SHOWCAPTIONMENU) {
SendMessage(WM_COMMAND, ID_VIEW_CAPTIONMENU);
+ }
ShowControls(CS_SEEKBAR|CS_TOOLBAR|CS_STATUSBAR|CS_INFOBAR);
}
@@ -6781,31 +6601,31 @@ void CMainFrame::OnUpdateViewDefaultVideoFrame(CCmdUI* pCmdUI) void CMainFrame::OnViewSwitchVideoFrame()
{
int vs = AfxGetAppSettings().iDefaultVideoSize;
- if (vs <= DVS_DOUBLE || vs == DVS_FROMOUTSIDE)
+ if (vs <= DVS_DOUBLE || vs == DVS_FROMOUTSIDE) {
vs = DVS_STRETCH;
- else if (vs == DVS_FROMINSIDE)
+ } else if (vs == DVS_FROMINSIDE) {
vs = DVS_ZOOM1;
- else if (vs == DVS_ZOOM2)
+ } else if (vs == DVS_ZOOM2) {
vs = DVS_FROMOUTSIDE;
- else
+ } else {
vs++;
- switch(vs) // TODO: Read messages from resource file
- {
- case DVS_STRETCH:
- m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_STRETCH_TO_WINDOW));
- break;
- case DVS_FROMINSIDE:
- m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_TOUCH_WINDOW_FROM_INSIDE));
- break;
- case DVS_ZOOM1:
- m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_ZOOM1));
- break;
- case DVS_ZOOM2:
- m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_ZOOM2));
- break;
- case DVS_FROMOUTSIDE:
- m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_TOUCH_WINDOW_FROM_OUTSIDE));
- break;
+ }
+ switch(vs) { // TODO: Read messages from resource file
+ case DVS_STRETCH:
+ m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_STRETCH_TO_WINDOW));
+ break;
+ case DVS_FROMINSIDE:
+ m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_TOUCH_WINDOW_FROM_INSIDE));
+ break;
+ case DVS_ZOOM1:
+ m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_ZOOM1));
+ break;
+ case DVS_ZOOM2:
+ m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_ZOOM2));
+ break;
+ case DVS_FROMOUTSIDE:
+ m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_TOUCH_WINDOW_FROM_OUTSIDE));
+ break;
}
AfxGetAppSettings().iDefaultVideoSize = vs;
m_ZoomX = m_ZoomY = 1;
@@ -6839,78 +6659,95 @@ void CMainFrame::OnUpdateViewCompMonDeskARDiff(CCmdUI* pCmdUI) void CMainFrame::OnViewPanNScan(UINT nID)
{
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
int x = 0, y = 0;
int dx = 0, dy = 0;
- switch(nID)
- {
- case ID_VIEW_RESET:
- m_ZoomX = m_ZoomY = 1.0;
- m_PosX = m_PosY = 0.5;
- m_AngleX = m_AngleY = m_AngleZ = 0;
- break;
- case ID_VIEW_INCSIZE:
- x = y = 1;
- break;
- case ID_VIEW_DECSIZE:
- x = y = -1;
- break;
- case ID_VIEW_INCWIDTH:
- x = 1;
- break;
- case ID_VIEW_DECWIDTH:
- x = -1;
- break;
- case ID_VIEW_INCHEIGHT:
- y = 1;
- break;
- case ID_VIEW_DECHEIGHT:
- y = -1;
- break;
- case ID_PANSCAN_CENTER:
- m_PosX = m_PosY = 0.5;
- break;
- case ID_PANSCAN_MOVELEFT:
- dx = -1;
- break;
- case ID_PANSCAN_MOVERIGHT:
- dx = 1;
- break;
- case ID_PANSCAN_MOVEUP:
- dy = -1;
- break;
- case ID_PANSCAN_MOVEDOWN:
- dy = 1;
- break;
- case ID_PANSCAN_MOVEUPLEFT:
- dx = dy = -1;
- break;
- case ID_PANSCAN_MOVEUPRIGHT:
- dx = 1;
- dy = -1;
- break;
- case ID_PANSCAN_MOVEDOWNLEFT:
- dx = -1;
- dy = 1;
- break;
- case ID_PANSCAN_MOVEDOWNRIGHT:
- dx = dy = 1;
- break;
- default:
- break;
+ switch(nID) {
+ case ID_VIEW_RESET:
+ m_ZoomX = m_ZoomY = 1.0;
+ m_PosX = m_PosY = 0.5;
+ m_AngleX = m_AngleY = m_AngleZ = 0;
+ break;
+ case ID_VIEW_INCSIZE:
+ x = y = 1;
+ break;
+ case ID_VIEW_DECSIZE:
+ x = y = -1;
+ break;
+ case ID_VIEW_INCWIDTH:
+ x = 1;
+ break;
+ case ID_VIEW_DECWIDTH:
+ x = -1;
+ break;
+ case ID_VIEW_INCHEIGHT:
+ y = 1;
+ break;
+ case ID_VIEW_DECHEIGHT:
+ y = -1;
+ break;
+ case ID_PANSCAN_CENTER:
+ m_PosX = m_PosY = 0.5;
+ break;
+ case ID_PANSCAN_MOVELEFT:
+ dx = -1;
+ break;
+ case ID_PANSCAN_MOVERIGHT:
+ dx = 1;
+ break;
+ case ID_PANSCAN_MOVEUP:
+ dy = -1;
+ break;
+ case ID_PANSCAN_MOVEDOWN:
+ dy = 1;
+ break;
+ case ID_PANSCAN_MOVEUPLEFT:
+ dx = dy = -1;
+ break;
+ case ID_PANSCAN_MOVEUPRIGHT:
+ dx = 1;
+ dy = -1;
+ break;
+ case ID_PANSCAN_MOVEDOWNLEFT:
+ dx = -1;
+ dy = 1;
+ break;
+ case ID_PANSCAN_MOVEDOWNRIGHT:
+ dx = dy = 1;
+ break;
+ default:
+ break;
}
- if(x > 0 && m_ZoomX < 3) m_ZoomX *= 1.02;
- if(x < 0 && m_ZoomX > 0.2) m_ZoomX /= 1.02;
- if(y > 0 && m_ZoomY < 3) m_ZoomY *= 1.02;
- if(y < 0 && m_ZoomY > 0.2) m_ZoomY /= 1.02;
+ if(x > 0 && m_ZoomX < 3) {
+ m_ZoomX *= 1.02;
+ }
+ if(x < 0 && m_ZoomX > 0.2) {
+ m_ZoomX /= 1.02;
+ }
+ if(y > 0 && m_ZoomY < 3) {
+ m_ZoomY *= 1.02;
+ }
+ if(y < 0 && m_ZoomY > 0.2) {
+ m_ZoomY /= 1.02;
+ }
- if(dx < 0 && m_PosX > 0) m_PosX = max(m_PosX - 0.005*m_ZoomX, 0);
- if(dx > 0 && m_PosX < 1) m_PosX = min(m_PosX + 0.005*m_ZoomX, 1);
- if(dy < 0 && m_PosY > 0) m_PosY = max(m_PosY - 0.005*m_ZoomY, 0);
- if(dy > 0 && m_PosY < 1) m_PosY = min(m_PosY + 0.005*m_ZoomY, 1);
+ if(dx < 0 && m_PosX > 0) {
+ m_PosX = max(m_PosX - 0.005*m_ZoomX, 0);
+ }
+ if(dx > 0 && m_PosX < 1) {
+ m_PosX = min(m_PosX + 0.005*m_ZoomX, 1);
+ }
+ if(dy < 0 && m_PosY > 0) {
+ m_PosY = max(m_PosY - 0.005*m_ZoomY, 0);
+ }
+ if(dy > 0 && m_PosY < 1) {
+ m_PosY = min(m_PosY + 0.005*m_ZoomY, 1);
+ }
MoveVideoWindow(true);
}
@@ -6922,18 +6759,18 @@ void CMainFrame::OnUpdateViewPanNScan(CCmdUI* pCmdUI) void CMainFrame::OnViewPanNScanPresets(UINT nID)
{
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
AppSettings& s = AfxGetAppSettings();
nID -= ID_PANNSCAN_PRESETS_START;
- if((INT_PTR)nID == s.m_pnspresets.GetCount())
- {
+ if((INT_PTR)nID == s.m_pnspresets.GetCount()) {
CPnSPresetsDlg dlg;
dlg.m_pnspresets.Copy(s.m_pnspresets);
- if(dlg.DoModal() == IDOK)
- {
+ if(dlg.DoModal() == IDOK) {
s.m_pnspresets.Copy(dlg.m_pnspresets);
s.UpdateData(true);
}
@@ -6948,33 +6785,35 @@ void CMainFrame::OnViewPanNScanPresets(UINT nID) CString str = s.m_pnspresets[nID];
int i = 0, j = 0;
- for(CString token = str.Tokenize(_T(","), i); !token.IsEmpty(); token = str.Tokenize(_T(","), i), j++)
- {
+ for(CString token = str.Tokenize(_T(","), i); !token.IsEmpty(); token = str.Tokenize(_T(","), i), j++) {
float f = 0;
- if(_stscanf_s(token, _T("%f"), &f) != 1) continue;
+ if(_stscanf_s(token, _T("%f"), &f) != 1) {
+ continue;
+ }
- switch(j)
- {
- case 0:
- break;
- case 1:
- m_PosX = f;
- break;
- case 2:
- m_PosY = f;
- break;
- case 3:
- m_ZoomX = f;
- break;
- case 4:
- m_ZoomY = f;
- break;
- default:
- break;
+ switch(j) {
+ case 0:
+ break;
+ case 1:
+ m_PosX = f;
+ break;
+ case 2:
+ m_PosY = f;
+ break;
+ case 3:
+ m_ZoomX = f;
+ break;
+ case 4:
+ m_ZoomY = f;
+ break;
+ default:
+ break;
}
}
- if(j != 5) return;
+ if(j != 5) {
+ return;
+ }
m_PosX = min(max(m_PosX, 0), 1);
m_PosY = min(max(m_PosY, 0), 1);
@@ -6993,32 +6832,33 @@ void CMainFrame::OnUpdateViewPanNScanPresets(CCmdUI* pCmdUI) void CMainFrame::OnViewRotate(UINT nID)
{
- if(!m_pCAP) return;
-
- switch(nID)
- {
- case ID_PANSCAN_ROTATEXP:
- m_AngleX += 2;
- break;
- case ID_PANSCAN_ROTATEXM:
- m_AngleX -= 2;
- break;
- case ID_PANSCAN_ROTATEYP:
- m_AngleY += 2;
- break;
- case ID_PANSCAN_ROTATEYM:
- m_AngleY -= 2;
- break;
- case ID_PANSCAN_ROTATEZP:
- m_AngleZ += 2;
- break;
- case ID_PANSCAN_ROTATEZM:
- m_AngleZ -= 2;
- break;
- default:
+ if(!m_pCAP) {
return;
}
+ switch(nID) {
+ case ID_PANSCAN_ROTATEXP:
+ m_AngleX += 2;
+ break;
+ case ID_PANSCAN_ROTATEXM:
+ m_AngleX -= 2;
+ break;
+ case ID_PANSCAN_ROTATEYP:
+ m_AngleY += 2;
+ break;
+ case ID_PANSCAN_ROTATEYM:
+ m_AngleY -= 2;
+ break;
+ case ID_PANSCAN_ROTATEZP:
+ m_AngleZ += 2;
+ break;
+ case ID_PANSCAN_ROTATEZM:
+ m_AngleZ -= 2;
+ break;
+ default:
+ return;
+ }
+
m_pCAP->SetVideoAngle(Vector(DegToRad(m_AngleX), DegToRad(m_AngleY), DegToRad(m_AngleZ)));
CString info;
@@ -7041,8 +6881,11 @@ void CMainFrame::OnViewAspectRatio(UINT nID) ar = s_ar[nID - ID_ASPECTRATIO_START];
CString info;
- if(ar.cx && ar.cy) info.Format(ResStr(IDS_MAINFRM_68), ar.cx, ar.cy);
- else info.Format(ResStr(IDS_MAINFRM_69));
+ if(ar.cx && ar.cy) {
+ info.Format(ResStr(IDS_MAINFRM_68), ar.cx, ar.cy);
+ } else {
+ info.Format(ResStr(IDS_MAINFRM_69));
+ }
SendStatusMessage(info, 3000);
m_OSD.DisplayMessage(OSD_TOPLEFT, info, 3000);
@@ -7062,10 +6905,8 @@ void CMainFrame::OnViewAspectRatioNext() UINT nID = ID_ASPECTRATIO_START;
- for(int i = 0; i < countof(s_ar); i++)
- {
- if(ar == s_ar[i])
- {
+ for(int i = 0; i < countof(s_ar); i++) {
+ if(ar == s_ar[i]) {
nID += (i + 1) % countof(s_ar);
break;
}
@@ -7077,8 +6918,9 @@ void CMainFrame::OnViewAspectRatioNext() void CMainFrame::OnViewOntop(UINT nID)
{
nID -= ID_ONTOP_NEVER;
- if(AfxGetAppSettings().iOnTop == (int)nID)
+ if(AfxGetAppSettings().iOnTop == (int)nID) {
nID = !nID;
+ }
SetAlwaysOnTop(nID);
}
@@ -7098,41 +6940,36 @@ void CMainFrame::OnViewOptions() void CMainFrame::OnPlayPlay()
{
- if(m_iMediaLoadState == MLS_CLOSED)
- {
+ if(m_iMediaLoadState == MLS_CLOSED) {
OpenCurPlaylistItem();
return;
}
- if(m_iMediaLoadState == MLS_LOADED)
- {
- if(GetMediaState() == State_Stopped) m_iSpeedLevel = 0;
+ if(m_iMediaLoadState == MLS_LOADED) {
+ if(GetMediaState() == State_Stopped) {
+ m_iSpeedLevel = 0;
+ }
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
m_iSpeedLevel = 0;
- if(m_fEndOfStream) SendMessage(WM_COMMAND, ID_PLAY_STOP);
+ if(m_fEndOfStream) {
+ SendMessage(WM_COMMAND, ID_PLAY_STOP);
+ }
pMS->SetRate (1.0);
pMC->Run();
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
double dRate = 1.0;
m_iSpeedLevel = 0;
pDVDC->PlayForwards(dRate, DVD_CMD_FLAG_Block, NULL);
pDVDC->Pause(FALSE);
pMC->Run();
- }
- else if(GetPlaybackMode() == PM_CAPTURE)
- {
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
pMC->Stop(); // audio preview won't be in sync if we run it from paused state
pMC->Run();
- if (AfxGetAppSettings().iDefaultCaptureDevice == 1)
- {
+ if (AfxGetAppSettings().iDefaultCaptureDevice == 1) {
CComQIPtr<IBDATuner> pTun = pGB;
- if (pTun)
- {
+ if (pTun) {
pTun->SetChannel (AfxGetAppSettings().nDVBLastChannel);
DisplayCurrentChannelOSD();
}
@@ -7140,8 +6977,7 @@ void CMainFrame::OnPlayPlay() }
SetTimersPlay();
- if(m_fFrameSteppingActive) // FIXME
- {
+ if(m_fFrameSteppingActive) { // FIXME
m_fFrameSteppingActive = false;
pBA->put_Volume(m_VolumeBeforeFrameStepping);
}
@@ -7158,20 +6994,14 @@ void CMainFrame::OnPlayPlay() void CMainFrame::OnPlayPauseI()
{
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
//SetAlwaysOnTop(AfxGetAppSettings().iOnTop);
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
pMC->Pause();
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
pMC->Pause();
- }
- else if(GetPlaybackMode() == PM_CAPTURE)
- {
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
pMC->Pause();
}
@@ -7188,8 +7018,7 @@ void CMainFrame::OnPlayPause() {
// Support ffdshow queuing.
// To avoid black out on pause, we have to lock g_ffdshowReceive to synchronize with ReceiveMine.
- if(queue_ffdshow_support)
- {
+ if(queue_ffdshow_support) {
CAutoLock lck(&g_ffdshowReceive);
return OnPlayPauseI();
}
@@ -7200,16 +7029,17 @@ void CMainFrame::OnPlayPause() void CMainFrame::OnPlayPlaypause()
{
OAFilterState fs = GetMediaState();
- if(fs == State_Running) SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
- else if(fs == State_Stopped || fs == State_Paused) SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ if(fs == State_Running) {
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ } else if(fs == State_Stopped || fs == State_Paused) {
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
}
void CMainFrame::OnPlayStop()
{
- if(m_iMediaLoadState == MLS_LOADED)
- {
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
+ if(GetPlaybackMode() == PM_FILE) {
LONGLONG pos = 0;
pMS->SetPositions(&pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
pMC->Stop();
@@ -7219,16 +7049,13 @@ void CMainFrame::OnPlayStop() //
// Note: WMPx may be using some undocumented interface to restart streaming.
- BeginEnumFilters(pGB, pEF, pBF)
- {
+ BeginEnumFilters(pGB, pEF, pBF) {
CComQIPtr<IAMNetworkStatus, &IID_IAMNetworkStatus> pAMNS = pBF;
CComQIPtr<IFileSourceFilter> pFSF = pBF;
- if(pAMNS && pFSF)
- {
+ if(pAMNS && pFSF) {
WCHAR* pFN = NULL;
AM_MEDIA_TYPE mt;
- if(SUCCEEDED(pFSF->GetCurFile(&pFN, &mt)) && pFN && *pFN)
- {
+ if(SUCCEEDED(pFSF->GetCurFile(&pFN, &mt)) && pFN && *pFN) {
pFSF->Load(pFN, NULL);
CoTaskMemFree(pFN);
}
@@ -7236,22 +7063,17 @@ void CMainFrame::OnPlayStop() }
}
EndEnumFilters;
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
pDVDC->SetOption(DVD_ResetOnStop, TRUE);
pMC->Stop();
pDVDC->SetOption(DVD_ResetOnStop, FALSE);
- }
- else if(GetPlaybackMode() == PM_CAPTURE)
- {
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
pMC->Stop();
}
m_iSpeedLevel = 0;
- if(m_fFrameSteppingActive) // FIXME
- {
+ if(m_fFrameSteppingActive) { // FIXME
m_fFrameSteppingActive = false;
pBA->put_Volume(m_VolumeBeforeFrameStepping);
}
@@ -7261,19 +7083,18 @@ void CMainFrame::OnPlayStop() m_nLoops = 0;
- if(m_hWnd)
- {
+ if(m_hWnd) {
KillTimersStop();
MoveVideoWindow();
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
__int64 start, stop;
m_wndSeekBar.GetRange(start, stop);
GUID tf;
pMS->GetTimeFormat(&tf);
- if (GetPlaybackMode() != PM_CAPTURE)
+ if (GetPlaybackMode() != PM_CAPTURE) {
m_wndStatusBar.SetStatusTimer(m_wndSeekBar.GetPosReal(), stop, !!m_wndSubresyncBar.IsWindowVisible(), &tf);
+ }
SetAlwaysOnTop(AfxGetAppSettings().iOnTop);
}
@@ -7294,26 +7115,28 @@ void CMainFrame::OnUpdatePlayPauseStop(CCmdUI* pCmdUI) bool fEnable = false;
- if(fs >= 0)
- {
- if(GetPlaybackMode() == PM_FILE || GetPlaybackMode() == PM_CAPTURE)
- {
+ if(fs >= 0) {
+ if(GetPlaybackMode() == PM_FILE || GetPlaybackMode() == PM_CAPTURE) {
fEnable = true;
- if(fs == State_Stopped && pCmdUI->m_nID == ID_PLAY_PAUSE && m_fRealMediaGraph) fEnable = false; // can't go into paused state from stopped with rm
- else if(m_fCapturing) fEnable = false;
- else if(m_fLiveWM && pCmdUI->m_nID == ID_PLAY_PAUSE) fEnable = false;
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ if(fs == State_Stopped && pCmdUI->m_nID == ID_PLAY_PAUSE && m_fRealMediaGraph) {
+ fEnable = false; // can't go into paused state from stopped with rm
+ } else if(m_fCapturing) {
+ fEnable = false;
+ } else if(m_fLiveWM && pCmdUI->m_nID == ID_PLAY_PAUSE) {
+ fEnable = false;
+ }
+ } else if(GetPlaybackMode() == PM_DVD) {
fEnable = m_iDVDDomain != DVD_DOMAIN_VideoManagerMenu
&& m_iDVDDomain != DVD_DOMAIN_VideoTitleSetMenu;
- if(fs == State_Stopped && pCmdUI->m_nID == ID_PLAY_PAUSE) fEnable = false;
+ if(fs == State_Stopped && pCmdUI->m_nID == ID_PLAY_PAUSE) {
+ fEnable = false;
+ }
}
- }
- else if (pCmdUI->m_nID == ID_PLAY_PLAY && m_wndPlaylistBar.GetCount() > 0)
+ } else if (pCmdUI->m_nID == ID_PLAY_PLAY && m_wndPlaylistBar.GetCount() > 0) {
fEnable = true;
+ }
pCmdUI->Enable(fEnable);
}
@@ -7322,22 +7145,22 @@ void CMainFrame::OnPlayFramestep(UINT nID) {
REFERENCE_TIME rt;
- if(pFS && m_fQuicktimeGraph)
- {
- if(GetMediaState() != State_Paused)
+ if(pFS && m_fQuicktimeGraph) {
+ if(GetMediaState() != State_Paused) {
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
pFS->Step(nID == ID_PLAY_FRAMESTEP ? 1 : -1, NULL);
- }
- else if(pFS && nID == ID_PLAY_FRAMESTEP)
- {
- if(GetMediaState() != State_Paused && !queue_ffdshow_support)
+ } else if(pFS && nID == ID_PLAY_FRAMESTEP) {
+ if(GetMediaState() != State_Paused && !queue_ffdshow_support) {
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
// To support framestep back, store the initial position when
// stepping forward
- if (m_nStepForwardCount == 0)
+ if (m_nStepForwardCount == 0) {
pMS->GetCurrentPosition(&m_rtStepForwardStart);
+ }
m_fFrameSteppingActive = true;
@@ -7345,38 +7168,34 @@ void CMainFrame::OnPlayFramestep(UINT nID) pBA->put_Volume(-10000);
pFS->Step(1, NULL);
- }
- else if(S_OK == pMS->IsFormatSupported(&TIME_FORMAT_FRAME))
- {
- if(GetMediaState() != State_Paused)
+ } else if(S_OK == pMS->IsFormatSupported(&TIME_FORMAT_FRAME)) {
+ if(GetMediaState() != State_Paused) {
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
pMS->SetTimeFormat(&TIME_FORMAT_FRAME);
pMS->GetCurrentPosition(&rt);
- if(nID == ID_PLAY_FRAMESTEP) rt++;
- else if(nID == ID_PLAY_FRAMESTEPCANCEL) rt--;
+ if(nID == ID_PLAY_FRAMESTEP) {
+ rt++;
+ } else if(nID == ID_PLAY_FRAMESTEPCANCEL) {
+ rt--;
+ }
pMS->SetPositions(&rt, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
pMS->SetTimeFormat(&TIME_FORMAT_MEDIA_TIME);
- }
- else //if (s.iDSVideoRendererType != VIDRNDT_DS_VMR9WINDOWED && s.iDSVideoRendererType != VIDRNDT_DS_VMR9RENDERLESS)
- {
- if(GetMediaState() != State_Paused)
+ } else { //if (s.iDSVideoRendererType != VIDRNDT_DS_VMR9WINDOWED && s.iDSVideoRendererType != VIDRNDT_DS_VMR9RENDERLESS)
+ if(GetMediaState() != State_Paused) {
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
REFERENCE_TIME rtAvgTime = 0;
- BeginEnumFilters(pGB, pEF, pBF)
- {
- BeginEnumPins(pBF, pEP, pPin)
- {
+ BeginEnumFilters(pGB, pEF, pBF) {
+ BeginEnumPins(pBF, pEP, pPin) {
AM_MEDIA_TYPE mt;
pPin->ConnectionMediaType(&mt);
- if(mt.majortype == MEDIATYPE_Video && mt.formattype == FORMAT_VideoInfo)
- {
+ if(mt.majortype == MEDIATYPE_Video && mt.formattype == FORMAT_VideoInfo) {
rtAvgTime = ((VIDEOINFOHEADER*)mt.pbFormat)->AvgTimePerFrame;
- }
- else if(mt.majortype == MEDIATYPE_Video && mt.formattype == FORMAT_VideoInfo2)
- {
+ } else if(mt.majortype == MEDIATYPE_Video && mt.formattype == FORMAT_VideoInfo2) {
rtAvgTime = ((VIDEOINFOHEADER2*)mt.pbFormat)->AvgTimePerFrame;
}
}
@@ -7385,18 +7204,18 @@ void CMainFrame::OnPlayFramestep(UINT nID) EndEnumFilters;
// Exit of framestep forward : calculate the initial position
- if (m_nStepForwardCount != 0)
- {
+ if (m_nStepForwardCount != 0) {
pFS->CancelStep();
rt = m_rtStepForwardStart + m_nStepForwardCount*rtAvgTime;
m_nStepForwardCount = 0;
- }
- else
+ } else {
pMS->GetCurrentPosition(&rt);
- if(nID == ID_PLAY_FRAMESTEP)
+ }
+ if(nID == ID_PLAY_FRAMESTEP) {
rt += rtAvgTime;
- else if(nID == ID_PLAY_FRAMESTEPCANCEL)
+ } else if(nID == ID_PLAY_FRAMESTEPCANCEL) {
rt -= rtAvgTime;
+ }
pMS->SetPositions(&rt, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
}
}
@@ -7408,16 +7227,16 @@ void CMainFrame::OnUpdatePlayFramestep(CCmdUI* pCmdUI) if(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly &&
(GetPlaybackMode() != PM_DVD || m_iDVDDomain == DVD_DOMAIN_Title) &&
GetPlaybackMode() != PM_CAPTURE &&
- !m_fLiveWM)
- {
- if(S_OK == pMS->IsFormatSupported(&TIME_FORMAT_FRAME))
+ !m_fLiveWM) {
+ if(S_OK == pMS->IsFormatSupported(&TIME_FORMAT_FRAME)) {
fEnable = true;
- else if(pCmdUI->m_nID == ID_PLAY_FRAMESTEP)
+ } else if(pCmdUI->m_nID == ID_PLAY_FRAMESTEP) {
fEnable = true;
- else if(pCmdUI->m_nID == ID_PLAY_FRAMESTEPCANCEL && pFS && pFS->CanStep(0, NULL) == S_OK)
+ } else if(pCmdUI->m_nID == ID_PLAY_FRAMESTEPCANCEL && pFS && pFS->CanStep(0, NULL) == S_OK) {
fEnable = true;
- else if(m_fQuicktimeGraph && pFS)
+ } else if(m_fQuicktimeGraph && pFS) {
fEnable = true;
+ }
}
pCmdUI->Enable(fEnable);
@@ -7436,10 +7255,14 @@ void CMainFrame::OnPlaySeek(UINT nID) nID == ID_PLAY_SEEKFORWARDLARGE ? +10000i64*s.nJumpDistL :
0;
- if(!dt) return;
+ if(!dt) {
+ return;
+ }
// HACK: the custom graph should support frame based seeking instead
- if(m_fShockwaveGraph) dt /= 10000i64*100;
+ if(m_fShockwaveGraph) {
+ dt /= 10000i64*100;
+ }
SeekTo(m_wndSeekBar.GetPos() + dt);
}
@@ -7462,27 +7285,27 @@ static int rangebsearch(REFERENCE_TIME val, CAtlArray<REFERENCE_TIME>& rta) {
int i = 0, j = rta.GetCount() - 1, ret = -1;
- if(j >= 0 && val >= rta[j]) return(j);
+ if(j >= 0 && val >= rta[j]) {
+ return(j);
+ }
- while(i < j)
- {
+ while(i < j) {
int mid = (i + j) >> 1;
REFERENCE_TIME midt = rta[mid];
- if(val == midt)
- {
+ if(val == midt) {
ret = mid;
break;
- }
- else if(val < midt)
- {
+ } else if(val < midt) {
ret = -1;
- if(j == mid) mid--;
+ if(j == mid) {
+ mid--;
+ }
j = mid;
- }
- else if(val > midt)
- {
+ } else if(val > midt) {
ret = mid;
- if(i == mid) mid++;
+ if(i == mid) {
+ mid++;
+ }
i = mid;
}
}
@@ -7492,12 +7315,12 @@ static int rangebsearch(REFERENCE_TIME val, CAtlArray<REFERENCE_TIME>& rta) void CMainFrame::OnPlaySeekKey(UINT nID)
{
- if(m_kfs.GetCount() > 0)
- {
+ if(m_kfs.GetCount() > 0) {
HRESULT hr;
- if(GetMediaState() == State_Stopped)
+ if(GetMediaState() == State_Stopped) {
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
REFERENCE_TIME rtCurrent, rtDur;
hr = pMS->GetCurrentPosition(&rtCurrent);
@@ -7505,7 +7328,9 @@ void CMainFrame::OnPlaySeekKey(UINT nID) int dec = 1;
int i = rangebsearch(rtCurrent, m_kfs);
- if(i > 0) dec = (UINT)max(min(rtCurrent - m_kfs[i-1], 10000000), 0);
+ if(i > 0) {
+ dec = (UINT)max(min(rtCurrent - m_kfs[i-1], 10000000), 0);
+ }
rtCurrent =
nID == ID_PLAY_SEEKKEYBACKWARD ? max(rtCurrent - dec, 0) :
@@ -7513,12 +7338,13 @@ void CMainFrame::OnPlaySeekKey(UINT nID) i = rangebsearch(rtCurrent, m_kfs);
- if(nID == ID_PLAY_SEEKKEYBACKWARD)
+ if(nID == ID_PLAY_SEEKKEYBACKWARD) {
rtCurrent = m_kfs[max(i, 0)];
- else if(nID == ID_PLAY_SEEKKEYFORWARD && i < m_kfs.GetCount()-1)
+ } else if(nID == ID_PLAY_SEEKKEYFORWARD && i < m_kfs.GetCount()-1) {
rtCurrent = m_kfs[i+1];
- else
+ } else {
return;
+ }
// HACK: if d3d or something changes fpu control word the values of
// m_kfs may be different now (if it was asked again), adding a little
@@ -7540,11 +7366,13 @@ void CMainFrame::OnUpdatePlaySeek(CCmdUI* pCmdUI) OAFilterState fs = GetMediaState();
- if(m_iMediaLoadState == MLS_LOADED && (fs == State_Paused || fs == State_Running))
- {
+ if(m_iMediaLoadState == MLS_LOADED && (fs == State_Paused || fs == State_Running)) {
fEnable = true;
- if(GetPlaybackMode() == PM_DVD && (m_iDVDDomain != DVD_DOMAIN_Title || fs != State_Running)) fEnable = false;
- else if(GetPlaybackMode() == PM_CAPTURE) fEnable = false;
+ if(GetPlaybackMode() == PM_DVD && (m_iDVDDomain != DVD_DOMAIN_Title || fs != State_Running)) {
+ fEnable = false;
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
+ fEnable = false;
+ }
}
pCmdUI->Enable(fEnable);
@@ -7552,31 +7380,30 @@ void CMainFrame::OnUpdatePlaySeek(CCmdUI* pCmdUI) void CMainFrame::OnPlayGoto()
{
- if ((m_iMediaLoadState != MLS_LOADED) || m_pFullscreenWnd->IsWindow())
+ if ((m_iMediaLoadState != MLS_LOADED) || m_pFullscreenWnd->IsWindow()) {
return;
+ }
REFTIME atpf = 0;
- if(FAILED(pBV->get_AvgTimePerFrame(&atpf)) || atpf < 0)
- {
+ if(FAILED(pBV->get_AvgTimePerFrame(&atpf)) || atpf < 0) {
atpf = 0;
- BeginEnumFilters(pGB, pEF, pBF)
- {
- if(atpf > 0) break;
+ BeginEnumFilters(pGB, pEF, pBF) {
+ if(atpf > 0) {
+ break;
+ }
- BeginEnumPins(pBF, pEP, pPin)
- {
- if(atpf > 0) break;
+ BeginEnumPins(pBF, pEP, pPin) {
+ if(atpf > 0) {
+ break;
+ }
AM_MEDIA_TYPE mt;
pPin->ConnectionMediaType(&mt);
- if(mt.majortype == MEDIATYPE_Video && mt.formattype == FORMAT_VideoInfo)
- {
+ if(mt.majortype == MEDIATYPE_Video && mt.formattype == FORMAT_VideoInfo) {
atpf = (REFTIME)((VIDEOINFOHEADER*)mt.pbFormat)->AvgTimePerFrame / 10000000i64;
- }
- else if(mt.majortype == MEDIATYPE_Video && mt.formattype == FORMAT_VideoInfo2)
- {
+ } else if(mt.majortype == MEDIATYPE_Video && mt.formattype == FORMAT_VideoInfo2) {
atpf = (REFTIME)((VIDEOINFOHEADER2*)mt.pbFormat)->AvgTimePerFrame / 10000000i64;
}
}
@@ -7586,7 +7413,9 @@ void CMainFrame::OnPlayGoto() }
CGoToDlg dlg((int)(m_wndSeekBar.GetPos()/10000), atpf > 0 ? (float)(1.0/atpf) : 0);
- if(IDOK != dlg.DoModal() || dlg.m_time < 0) return;
+ if(IDOK != dlg.DoModal() || dlg.m_time < 0) {
+ return;
+ }
SeekTo(10000i64 * dlg.m_time);
}
@@ -7595,11 +7424,13 @@ void CMainFrame::OnUpdateGoto(CCmdUI* pCmdUI) {
bool fEnable = false;
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
fEnable = true;
- if(GetPlaybackMode() == PM_DVD && m_iDVDDomain != DVD_DOMAIN_Title) fEnable = false;
- else if(GetPlaybackMode() == PM_CAPTURE) fEnable = false;
+ if(GetPlaybackMode() == PM_DVD && m_iDVDDomain != DVD_DOMAIN_Title) {
+ fEnable = false;
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
+ fEnable = false;
+ }
}
pCmdUI->Enable(fEnable);
@@ -7607,13 +7438,14 @@ void CMainFrame::OnUpdateGoto(CCmdUI* pCmdUI) void CMainFrame::OnPlayChangeRate(UINT nID)
{
- if(m_iMediaLoadState != MLS_LOADED)
+ if(m_iMediaLoadState != MLS_LOADED) {
return;
+ }
- if(GetPlaybackMode() == PM_CAPTURE)
- {
- if(GetMediaState() != State_Running)
+ if(GetPlaybackMode() == PM_CAPTURE) {
+ if(GetMediaState() != State_Running) {
SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
long lChannelMin = 0, lChannelMax = 0;
pAMTuner->ChannelMinMax(&lChannelMin, &lChannelMax);
@@ -7623,80 +7455,84 @@ void CMainFrame::OnPlayChangeRate(UINT nID) long lFreqOrg = 0, lFreqNew = -1;
pAMTuner->get_VideoFrequency(&lFreqOrg);
-// long lSignalStrength;
- do
- {
- if(nID == ID_PLAY_DECRATE) lChannel--;
- else if(nID == ID_PLAY_INCRATE) lChannel++;
+ // long lSignalStrength;
+ do {
+ if(nID == ID_PLAY_DECRATE) {
+ lChannel--;
+ } else if(nID == ID_PLAY_INCRATE) {
+ lChannel++;
+ }
-// if(lChannel < lChannelMin) lChannel = lChannelMax;
-// if(lChannel > lChannelMax) lChannel = lChannelMin;
+ // if(lChannel < lChannelMin) lChannel = lChannelMax;
+ // if(lChannel > lChannelMax) lChannel = lChannelMin;
- if(lChannel < lChannelMin || lChannel > lChannelMax)
+ if(lChannel < lChannelMin || lChannel > lChannelMax) {
break;
+ }
- if(FAILED(pAMTuner->put_Channel(lChannel, AMTUNER_SUBCHAN_DEFAULT, AMTUNER_SUBCHAN_DEFAULT)))
+ if(FAILED(pAMTuner->put_Channel(lChannel, AMTUNER_SUBCHAN_DEFAULT, AMTUNER_SUBCHAN_DEFAULT))) {
break;
+ }
long flFoundSignal;
pAMTuner->AutoTune(lChannel, &flFoundSignal);
pAMTuner->get_VideoFrequency(&lFreqNew);
- }
- while(FALSE);
+ } while(FALSE);
/* SUCCEEDED(pAMTuner->SignalPresent(&lSignalStrength))
&& (lSignalStrength != AMTUNER_SIGNALPRESENT || lFreqNew == lFreqOrg));*/
- }
- else
- {
+ } else {
int iNewSpeedLevel;
// Cap the max FFWD and RWD rates to 128x.
- if(nID == ID_PLAY_INCRATE) iNewSpeedLevel = (m_iSpeedLevel < 7 ? m_iSpeedLevel+1 : 7);
- else if(nID == ID_PLAY_DECRATE) iNewSpeedLevel = (m_iSpeedLevel > -7 ? m_iSpeedLevel-1 : -7);
- else return;
+ if(nID == ID_PLAY_INCRATE) {
+ iNewSpeedLevel = (m_iSpeedLevel < 7 ? m_iSpeedLevel+1 : 7);
+ } else if(nID == ID_PLAY_DECRATE) {
+ iNewSpeedLevel = (m_iSpeedLevel > -7 ? m_iSpeedLevel-1 : -7);
+ } else {
+ return;
+ }
HRESULT hr = E_FAIL;
- if((iNewSpeedLevel == -4) && (GetPlaybackMode() == PM_FILE))
- {
- if(GetMediaState() != State_Paused)
+ if((iNewSpeedLevel == -4) && (GetPlaybackMode() == PM_FILE)) {
+ if(GetMediaState() != State_Paused) {
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
- if(GetMediaState() == State_Paused) hr = S_OK;
- }
- else
- {
+ if(GetMediaState() == State_Paused) {
+ hr = S_OK;
+ }
+ } else {
double dRate = 1.0;
- if(GetMediaState() != State_Running)
+ if(GetMediaState() != State_Running) {
SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
dRate = pow(2.0, iNewSpeedLevel >= -3 ? iNewSpeedLevel : (-iNewSpeedLevel - 8));
- if(fabs(dRate - 1.0) < 0.01) dRate = 1.0;
+ if(fabs(dRate - 1.0) < 0.01) {
+ dRate = 1.0;
+ }
hr = pMS->SetRate(dRate);
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
dRate = pow(2.0, abs(iNewSpeedLevel));
- if(iNewSpeedLevel >= 0)
+ if(iNewSpeedLevel >= 0) {
hr = pDVDC->PlayForwards(dRate, DVD_CMD_FLAG_Block, NULL);
- else
+ } else {
hr = pDVDC->PlayBackwards(dRate, DVD_CMD_FLAG_Block, NULL);
+ }
}
- if(SUCCEEDED(hr))
- {
+ if(SUCCEEDED(hr)) {
CString strMessage;
m_iSpeedLevel = iNewSpeedLevel;
- if (dRate == 1.0)
+ if (dRate == 1.0) {
m_OSD.DisplayMessage (OSD_TOPRIGHT, _T("Play"));
- else
- {
+ } else {
strMessage.Format (_T("%s x %.01f"), (iNewSpeedLevel > 0)?_T(">"):_T("<"), fabs(dRate));
m_OSD.DisplayMessage (OSD_TOPRIGHT, strMessage);
}
@@ -7710,18 +7546,25 @@ void CMainFrame::OnUpdatePlayChangeRate(CCmdUI* pCmdUI) {
bool fEnable = false;
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
bool fInc = pCmdUI->m_nID == ID_PLAY_INCRATE;
fEnable = true;
- if(fInc && m_iSpeedLevel >= 7) fEnable = false;
- else if(!fInc && GetPlaybackMode() == PM_FILE && m_iSpeedLevel <= -4) fEnable = false;
- else if(!fInc && GetPlaybackMode() == PM_DVD && m_iSpeedLevel <= -11) fEnable = false;
- else if(GetPlaybackMode() == PM_DVD && m_iDVDDomain != DVD_DOMAIN_Title) fEnable = false;
- else if(m_fRealMediaGraph || m_fShockwaveGraph) fEnable = false;
- else if(GetPlaybackMode() == PM_CAPTURE && (!m_wndCaptureBar.m_capdlg.IsTunerActive() || m_fCapturing)) fEnable = false;
- else if(m_fLiveWM) fEnable = false;
+ if(fInc && m_iSpeedLevel >= 7) {
+ fEnable = false;
+ } else if(!fInc && GetPlaybackMode() == PM_FILE && m_iSpeedLevel <= -4) {
+ fEnable = false;
+ } else if(!fInc && GetPlaybackMode() == PM_DVD && m_iSpeedLevel <= -11) {
+ fEnable = false;
+ } else if(GetPlaybackMode() == PM_DVD && m_iDVDDomain != DVD_DOMAIN_Title) {
+ fEnable = false;
+ } else if(m_fRealMediaGraph || m_fShockwaveGraph) {
+ fEnable = false;
+ } else if(GetPlaybackMode() == PM_CAPTURE && (!m_wndCaptureBar.m_capdlg.IsTunerActive() || m_fCapturing)) {
+ fEnable = false;
+ } else if(m_fLiveWM) {
+ fEnable = false;
+ }
}
pCmdUI->Enable(fEnable);
@@ -7729,25 +7572,25 @@ void CMainFrame::OnUpdatePlayChangeRate(CCmdUI* pCmdUI) void CMainFrame::OnPlayResetRate()
{
- if(m_iMediaLoadState != MLS_LOADED)
+ if(m_iMediaLoadState != MLS_LOADED) {
return;
+ }
HRESULT hr = E_FAIL;
- if(GetMediaState() != State_Running)
+ if(GetMediaState() != State_Running) {
SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
hr = pMS->SetRate(1.0);
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
hr = pDVDC->PlayForwards(1.0, DVD_CMD_FLAG_Block, NULL);
}
- if(SUCCEEDED(hr))
+ if(SUCCEEDED(hr)) {
m_iSpeedLevel = 0;
+ }
}
void CMainFrame::OnUpdatePlayResetRate(CCmdUI* pCmdUI)
@@ -7758,8 +7601,7 @@ void CMainFrame::OnUpdatePlayResetRate(CCmdUI* pCmdUI) void CMainFrame::SetAudioDelay(REFERENCE_TIME rtShift)
{
- if(CComQIPtr<IAudioSwitcherFilter> pASF = FindFilter(__uuidof(CAudioSwitcherFilter), pGB))
- {
+ if(CComQIPtr<IAudioSwitcherFilter> pASF = FindFilter(__uuidof(CAudioSwitcherFilter), pGB)) {
pASF->SetAudioTimeShift(rtShift);
CString str;
@@ -7771,8 +7613,7 @@ void CMainFrame::SetAudioDelay(REFERENCE_TIME rtShift) void CMainFrame::SetSubtitleDelay(int delay_ms)
{
- if(m_pCAP)
- {
+ if(m_pCAP) {
m_pCAP->SetSubtitleDelay(delay_ms);
CString strSubDelay;
@@ -7784,8 +7625,7 @@ void CMainFrame::SetSubtitleDelay(int delay_ms) void CMainFrame::OnPlayChangeAudDelay(UINT nID)
{
- if(CComQIPtr<IAudioSwitcherFilter> pASF = FindFilter(__uuidof(CAudioSwitcherFilter), pGB))
- {
+ if(CComQIPtr<IAudioSwitcherFilter> pASF = FindFilter(__uuidof(CAudioSwitcherFilter), pGB)) {
REFERENCE_TIME rtShift = pASF->GetAudioTimeShift();
rtShift +=
nID == ID_PLAY_INCAUDDELAY ? 100000 :
@@ -7803,26 +7643,23 @@ void CMainFrame::OnUpdatePlayChangeAudDelay(CCmdUI* pCmdUI) void CMainFrame::OnPlayFilters(UINT nID)
{
-// ShowPPage(m_spparray[nID - ID_FILTERS_SUBITEM_START], m_hWnd);
+ // ShowPPage(m_spparray[nID - ID_FILTERS_SUBITEM_START], m_hWnd);
CComPtr<IUnknown> pUnk = m_pparray[nID - ID_FILTERS_SUBITEM_START];
CComPropertySheet ps(ResStr(IDS_PROPSHEET_PROPERTIES), GetModalParent());
- if(CComQIPtr<ISpecifyPropertyPages> pSPP = pUnk)
- {
+ if(CComQIPtr<ISpecifyPropertyPages> pSPP = pUnk) {
ps.AddPages(pSPP);
}
- if(CComQIPtr<IBaseFilter> pBF = pUnk)
- {
+ if(CComQIPtr<IBaseFilter> pBF = pUnk) {
HRESULT hr;
CComPtr<IPropertyPage> pPP = DNew CInternalPropertyPageTempl<CPinInfoWnd>(NULL, &hr);
ps.AddPage(pPP, pBF);
}
- if(ps.GetPageCount() > 0)
- {
+ if(ps.GetPageCount() > 0) {
ps.DoModal();
OpenSetupStatusBar();
}
@@ -7833,8 +7670,7 @@ void CMainFrame::OnUpdatePlayFilters(CCmdUI* pCmdUI) pCmdUI->Enable(!m_fCapturing);
}
-enum
-{
+enum {
ID_SHADERS_OFF = ID_SHADERS_START,
ID_SHADERS_COMBINE,
ID_SHADERS_EDIT,
@@ -7847,34 +7683,28 @@ enum void CMainFrame::OnPlayShaders(UINT nID)
{
- if(nID == ID_SHADERS_EDIT)
- {
+ if(nID == ID_SHADERS_EDIT) {
ShowControlBar(&m_wndShaderEditorBar, TRUE, TRUE);
return;
}
- if(!m_pCAP) return;
+ if(!m_pCAP) {
+ return;
+ }
- if(nID == ID_SHADERS_OFF)
- {
+ if(nID == ID_SHADERS_OFF) {
m_shaderlabels.RemoveAll();
- }
- else if(nID == ID_SHADERS_OFFSCR)
- {
+ } else if(nID == ID_SHADERS_OFFSCR) {
m_shaderlabelsScreenSpace.RemoveAll();
- }
- else if(nID == ID_SHADERS_COMBINE)
- {
- if(IDOK != CShaderCombineDlg(m_shaderlabels, GetModalParent(), false).DoModal())
+ } else if(nID == ID_SHADERS_COMBINE) {
+ if(IDOK != CShaderCombineDlg(m_shaderlabels, GetModalParent(), false).DoModal()) {
return;
- }
- else if(nID == ID_SHADERS_COMBINESCR)
- {
- if(IDOK != CShaderCombineDlg(m_shaderlabelsScreenSpace, GetModalParent(), true).DoModal())
+ }
+ } else if(nID == ID_SHADERS_COMBINESCR) {
+ if(IDOK != CShaderCombineDlg(m_shaderlabelsScreenSpace, GetModalParent(), true).DoModal()) {
return;
- }
- else if(nID >= ID_SHADERS_DYNAMIC)
- {
+ }
+ } else if(nID >= ID_SHADERS_DYNAMIC) {
MENUITEMINFO mii;
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
@@ -7890,42 +7720,40 @@ void CMainFrame::OnPlayShaders(UINT nID) void CMainFrame::OnUpdatePlayShaders(CCmdUI* pCmdUI)
{
- if(pCmdUI->m_nID >= ID_SHADERS_START)
- {
- if (pCmdUI->m_nID >= ID_SHADERS_STARTSCR && pCmdUI->m_nID < ID_SHADERS_ENDSCR )
+ if(pCmdUI->m_nID >= ID_SHADERS_START) {
+ if (pCmdUI->m_nID >= ID_SHADERS_STARTSCR && pCmdUI->m_nID < ID_SHADERS_ENDSCR ) {
pCmdUI->Enable(!!m_pCAP2);
- else
+ } else {
pCmdUI->Enable(!!m_pCAP);
+ }
- switch(pCmdUI->m_nID)
- {
- case ID_SHADERS_OFF:
- pCmdUI->SetRadio(m_shaderlabels.IsEmpty());
- break;
- case ID_SHADERS_OFFSCR:
- pCmdUI->SetRadio(m_shaderlabelsScreenSpace.IsEmpty());
- break;
- case ID_SHADERS_COMBINE:
- pCmdUI->SetRadio(m_shaderlabels.GetCount() > 1);
- break;
- case ID_SHADERS_COMBINESCR:
- pCmdUI->SetRadio(m_shaderlabelsScreenSpace.GetCount() > 0);
- break;
- case ID_SHADERS_EDIT:
- pCmdUI->Enable(TRUE);
- break;
- default:
- {
- MENUITEMINFO mii;
- memset(&mii, 0, sizeof(mii));
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_DATA;
- m_shaders.GetMenuItemInfo(pCmdUI->m_nID, &mii);
+ switch(pCmdUI->m_nID) {
+ case ID_SHADERS_OFF:
+ pCmdUI->SetRadio(m_shaderlabels.IsEmpty());
+ break;
+ case ID_SHADERS_OFFSCR:
+ pCmdUI->SetRadio(m_shaderlabelsScreenSpace.IsEmpty());
+ break;
+ case ID_SHADERS_COMBINE:
+ pCmdUI->SetRadio(m_shaderlabels.GetCount() > 1);
+ break;
+ case ID_SHADERS_COMBINESCR:
+ pCmdUI->SetRadio(m_shaderlabelsScreenSpace.GetCount() > 0);
+ break;
+ case ID_SHADERS_EDIT:
+ pCmdUI->Enable(TRUE);
+ break;
+ default: {
+ MENUITEMINFO mii;
+ memset(&mii, 0, sizeof(mii));
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_DATA;
+ m_shaders.GetMenuItemInfo(pCmdUI->m_nID, &mii);
- pCmdUI->SetRadio(m_shaderlabels.GetCount() == 1
- && m_shaderlabels.GetHead() == ((AppSettings::Shader*)mii.dwItemData)->label);
- }
- break;
+ pCmdUI->SetRadio(m_shaderlabels.GetCount() == 1
+ && m_shaderlabels.GetHead() == ((AppSettings::Shader*)mii.dwItemData)->label);
+ }
+ break;
}
}
}
@@ -7935,14 +7763,13 @@ void CMainFrame::OnPlayAudio(UINT nID) int i = (int)nID - (1 + ID_AUDIO_SUBITEM_START);
CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
- if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB);
+ if(!pSS) {
+ pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB);
+ }
- if(i == -1)
- {
+ if(i == -1) {
ShowOptions(CPPageAudioSwitcher::IDD);
- }
- else if(i >= 0 && pSS)
- {
+ } else if(i >= 0 && pSS) {
i = m_iAudioStreams.GetAt(m_iAudioStreams.FindIndex(i)); // don't forget that the audio streams are reordered, so have to figure which one from the initial order is used here
pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE);
}
@@ -7954,26 +7781,28 @@ void CMainFrame::OnUpdatePlayAudio(CCmdUI* pCmdUI) int i = (int)nID - (1 + ID_AUDIO_SUBITEM_START);
CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
- if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB);
+ if(!pSS) {
+ pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB);
+ }
/*if(i == -1)
{
// TODO****
}
else*/
- if(i >= 0 && pSS)
- {
+ if(i >= 0 && pSS) {
i = m_iAudioStreams.GetAt(m_iAudioStreams.FindIndex(i)); // audio streams are reordered, so figure out which one from the initial order is used here
DWORD flags = 0;
- if(SUCCEEDED(pSS->Info(i, NULL, &flags, NULL, NULL, NULL, NULL, NULL)))
- {
- if(flags&AMSTREAMSELECTINFO_EXCLUSIVE) pCmdUI->SetRadio(TRUE);
- else if(flags&AMSTREAMSELECTINFO_ENABLED) pCmdUI->SetCheck(TRUE);
- else pCmdUI->SetCheck(FALSE);
- }
- else
- {
+ if(SUCCEEDED(pSS->Info(i, NULL, &flags, NULL, NULL, NULL, NULL, NULL))) {
+ if(flags&AMSTREAMSELECTINFO_EXCLUSIVE) {
+ pCmdUI->SetRadio(TRUE);
+ } else if(flags&AMSTREAMSELECTINFO_ENABLED) {
+ pCmdUI->SetCheck(TRUE);
+ } else {
+ pCmdUI->SetCheck(FALSE);
+ }
+ } else {
pCmdUI->Enable(FALSE);
}
}
@@ -7983,37 +7812,31 @@ void CMainFrame::OnPlaySubtitles(UINT nID) {
int i = (int)nID - (5 + ID_SUBTITLES_SUBITEM_START); // currently the subtitles submenu contains 5 items, apart from the actual subtitles list
- if(i == -5)
- {
+ if(i == -5) {
// options
ShowOptions(CPPageSubtitles::IDD);
- }
- else if(i == -4)
- {
+ } else if(i == -4) {
// styles
int i = m_iSubtitleSel;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos && i >= 0)
- {
+ while(pos && i >= 0) {
CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
- if(i < pSubStream->GetStreamCount())
- {
+ if(i < pSubStream->GetStreamCount()) {
CLSID clsid;
- if(FAILED(pSubStream->GetClassID(&clsid)))
+ if(FAILED(pSubStream->GetClassID(&clsid))) {
continue;
+ }
- if(clsid == __uuidof(CRenderedTextSubtitle))
- {
+ if(clsid == __uuidof(CRenderedTextSubtitle)) {
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream;
CAutoPtrArray<CPPageSubStyle> pages;
CAtlArray<STSStyle*> styles;
POSITION pos = pRTS->m_styles.GetStartPosition();
- for(int i = 0; pos; i++)
- {
+ for(int i = 0; pos; i++) {
CString key;
STSStyle* val;
pRTS->m_styles.GetNextAssoc(pos, key, val);
@@ -8026,15 +7849,18 @@ void CMainFrame::OnPlaySubtitles(UINT nID) CString m_style = ResStr(IDS_SUBTITLES_STYLES);
int i = m_style.Find(_T("&"));
- if(i!=-1 ) m_style.Delete(i, 1);
+ if(i!=-1 ) {
+ m_style.Delete(i, 1);
+ }
CPropertySheet dlg(m_style, GetModalParent());
- for(int i = 0; i < (int)pages.GetCount(); i++)
+ for(int i = 0; i < (int)pages.GetCount(); i++) {
dlg.AddPage(pages[i]);
+ }
- if(dlg.DoModal() == IDOK)
- {
- for(int j = 0; j < (int)pages.GetCount(); j++)
+ if(dlg.DoModal() == IDOK) {
+ for(int j = 0; j < (int)pages.GetCount(); j++) {
pages[j]->GetStyle(*styles[j]);
+ }
UpdateSubtitle(false, false);
}
@@ -8044,28 +7870,23 @@ void CMainFrame::OnPlaySubtitles(UINT nID) i -= pSubStream->GetStreamCount();
}
- }
- else if(i == -3)
- {
+ } else if(i == -3) {
// reload
ReloadSubtitle();
- }
- else if(i == -2)
- {
+ } else if(i == -2) {
// enable
- if(m_iSubtitleSel == -1) m_iSubtitleSel = 0;
- else m_iSubtitleSel ^= (1<<31);
+ if(m_iSubtitleSel == -1) {
+ m_iSubtitleSel = 0;
+ } else {
+ m_iSubtitleSel ^= (1<<31);
+ }
UpdateSubtitle();
- }
- else if(i == -1)
- {
+ } else if(i == -1) {
// override default style
// TODO: default subtitles style toggle here
AfxGetAppSettings().fUseDefaultSubtitlesStyle = !AfxGetAppSettings().fUseDefaultSubtitlesStyle;
UpdateSubtitle();
- }
- else if(i >= 0)
- {
+ } else if(i >= 0) {
// this is an actual item from the subtitles list
m_iSubtitleSel = i;
UpdateSubtitle();
@@ -8081,26 +7902,23 @@ void CMainFrame::OnUpdatePlaySubtitles(CCmdUI* pCmdUI) pCmdUI->Enable(m_pCAP && !m_fAudioOnly);
- if(i == -4)
- {
+ if(i == -4) {
// styles
pCmdUI->Enable(FALSE);
int i = m_iSubtitleSel;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos && i >= 0)
- {
+ while(pos && i >= 0) {
CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
- if(i < pSubStream->GetStreamCount())
- {
+ if(i < pSubStream->GetStreamCount()) {
CLSID clsid;
- if(FAILED(pSubStream->GetClassID(&clsid)))
+ if(FAILED(pSubStream->GetClassID(&clsid))) {
continue;
+ }
- if(clsid == __uuidof(CRenderedTextSubtitle))
- {
+ if(clsid == __uuidof(CRenderedTextSubtitle)) {
pCmdUI->Enable(TRUE);
break;
}
@@ -8108,21 +7926,15 @@ void CMainFrame::OnUpdatePlaySubtitles(CCmdUI* pCmdUI) i -= pSubStream->GetStreamCount();
}
- }
- else if(i == -2)
- {
+ } else if(i == -2) {
// enabled
pCmdUI->SetCheck(AfxGetAppSettings().fEnableSubtitles);
- }
- else if(i == -1)
- {
+ } else if(i == -1) {
// override
// TODO: foxX - default subtitles style toggle here; still wip
pCmdUI->SetCheck(AfxGetAppSettings().fUseDefaultSubtitlesStyle);
pCmdUI->Enable(AfxGetAppSettings().fEnableSubtitles);
- }
- else if(i >= 0)
- {
+ } else if(i >= 0) {
pCmdUI->SetRadio(i == abs(m_iSubtitleSel));
}
}
@@ -8132,9 +7944,12 @@ void CMainFrame::OnPlayLanguage(UINT nID) nID -= ID_FILTERSTREAMS_SUBITEM_START;
CComPtr<IAMStreamSelect> pAMSS = m_ssarray[nID];
UINT i = nID;
- while(i > 0 && pAMSS == m_ssarray[i-1]) i--;
- if(FAILED(pAMSS->Enable(nID-i, AMSTREAMSELECTENABLE_ENABLE)))
+ while(i > 0 && pAMSS == m_ssarray[i-1]) {
+ i--;
+ }
+ if(FAILED(pAMSS->Enable(nID-i, AMSTREAMSELECTENABLE_ENABLE))) {
MessageBeep((UINT)-1);
+ }
OpenSetupStatusBar();
}
@@ -8145,28 +7960,30 @@ void CMainFrame::OnUpdatePlayLanguage(CCmdUI* pCmdUI) nID -= ID_FILTERSTREAMS_SUBITEM_START;
CComPtr<IAMStreamSelect> pAMSS = m_ssarray[nID];
UINT i = nID;
- while(i > 0 && pAMSS == m_ssarray[i-1]) i--;
+ while(i > 0 && pAMSS == m_ssarray[i-1]) {
+ i--;
+ }
DWORD flags = 0;
pAMSS->Info(nID-i, NULL, &flags, NULL, NULL, NULL, NULL, NULL);
- if(flags&AMSTREAMSELECTINFO_EXCLUSIVE) pCmdUI->SetRadio(TRUE);
- else if(flags&AMSTREAMSELECTINFO_ENABLED) pCmdUI->SetCheck(TRUE);
- else pCmdUI->SetCheck(FALSE);
+ if(flags&AMSTREAMSELECTINFO_EXCLUSIVE) {
+ pCmdUI->SetRadio(TRUE);
+ } else if(flags&AMSTREAMSELECTINFO_ENABLED) {
+ pCmdUI->SetCheck(TRUE);
+ } else {
+ pCmdUI->SetCheck(FALSE);
+ }
}
void CMainFrame::OnPlayVolume(UINT nID)
{
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
CString strVolume;
pBA->put_Volume(m_wndToolBar.Volume);
//strVolume.Format (L"Vol : %d dB", m_wndToolBar.Volume / 100);
- if(m_wndToolBar.Volume == -10000)
- {
+ if(m_wndToolBar.Volume == -10000) {
strVolume.Format(ResStr(IDS_VOLUME_OSD), 0);
- }
- else
- {
+ } else {
strVolume.Format(ResStr(IDS_VOLUME_OSD), m_wndToolBar.m_volctrl.GetPos());
}
m_OSD.DisplayMessage(OSD_TOPLEFT, strVolume);
@@ -8181,26 +7998,24 @@ void CMainFrame::OnPlayVolumeBoost(UINT nID) int i = (int)(s.dAudioBoost_dB*10+0.1);
- switch(nID)
- {
- case ID_VOLUME_BOOST_INC:
- i = min(i+10, 100);
- break;
- case ID_VOLUME_BOOST_DEC:
- i = max(i-10, 0);
- break;
- case ID_VOLUME_BOOST_MIN:
- i = 0;
- break;
- case ID_VOLUME_BOOST_MAX:
- i = 100;
- break;
+ switch(nID) {
+ case ID_VOLUME_BOOST_INC:
+ i = min(i+10, 100);
+ break;
+ case ID_VOLUME_BOOST_DEC:
+ i = max(i-10, 0);
+ break;
+ case ID_VOLUME_BOOST_MIN:
+ i = 0;
+ break;
+ case ID_VOLUME_BOOST_MAX:
+ i = 100;
+ break;
}
s.dAudioBoost_dB = (float)i/10;
- if(CComQIPtr<IAudioSwitcherFilter> pASF = FindFilter(__uuidof(CAudioSwitcherFilter), pGB))
- {
+ if(CComQIPtr<IAudioSwitcherFilter> pASF = FindFilter(__uuidof(CAudioSwitcherFilter), pGB)) {
bool fNormalize, fNormalizeRecover;
float boost;
pASF->GetNormalizeBoost(fNormalize, fNormalizeRecover, boost);
@@ -8219,35 +8034,34 @@ void CMainFrame::OnAfterplayback(UINT nID) s.nCLSwitches &= ~CLSW_AFTERPLAYBACK_MASK;
- switch(nID)
- {
- case ID_AFTERPLAYBACK_NEXT :
- s.fNextInDirAfterPlayback = true;
- s.fExitAfterPlayback = false;
- break;
- case ID_AFTERPLAYBACK_EXIT :
- s.fExitAfterPlayback = true;
- s.fNextInDirAfterPlayback = false;
- break;
- case ID_AFTERPLAYBACK_DONOTHING:
- s.fExitAfterPlayback = false;
- s.fNextInDirAfterPlayback = false;
- break;
- case ID_AFTERPLAYBACK_CLOSE:
- s.nCLSwitches |= CLSW_CLOSE;
- break;
- case ID_AFTERPLAYBACK_STANDBY:
- s.nCLSwitches |= CLSW_STANDBY;
- break;
- case ID_AFTERPLAYBACK_HIBERNATE:
- s.nCLSwitches |= CLSW_HIBERNATE;
- break;
- case ID_AFTERPLAYBACK_SHUTDOWN:
- s.nCLSwitches |= CLSW_SHUTDOWN;
- break;
- case ID_AFTERPLAYBACK_LOGOFF:
- s.nCLSwitches |= CLSW_LOGOFF;
- break;
+ switch(nID) {
+ case ID_AFTERPLAYBACK_NEXT :
+ s.fNextInDirAfterPlayback = true;
+ s.fExitAfterPlayback = false;
+ break;
+ case ID_AFTERPLAYBACK_EXIT :
+ s.fExitAfterPlayback = true;
+ s.fNextInDirAfterPlayback = false;
+ break;
+ case ID_AFTERPLAYBACK_DONOTHING:
+ s.fExitAfterPlayback = false;
+ s.fNextInDirAfterPlayback = false;
+ break;
+ case ID_AFTERPLAYBACK_CLOSE:
+ s.nCLSwitches |= CLSW_CLOSE;
+ break;
+ case ID_AFTERPLAYBACK_STANDBY:
+ s.nCLSwitches |= CLSW_STANDBY;
+ break;
+ case ID_AFTERPLAYBACK_HIBERNATE:
+ s.nCLSwitches |= CLSW_HIBERNATE;
+ break;
+ case ID_AFTERPLAYBACK_SHUTDOWN:
+ s.nCLSwitches |= CLSW_SHUTDOWN;
+ break;
+ case ID_AFTERPLAYBACK_LOGOFF:
+ s.nCLSwitches |= CLSW_LOGOFF;
+ break;
}
}
@@ -8257,32 +8071,31 @@ void CMainFrame::OnUpdateAfterplayback(CCmdUI* pCmdUI) bool fChecked = false;
- switch(pCmdUI->m_nID)
- {
- case ID_AFTERPLAYBACK_EXIT:
- fChecked = !!s.fExitAfterPlayback;
- break;
- case ID_AFTERPLAYBACK_NEXT:
- fChecked = !!s.fNextInDirAfterPlayback;
- break;
- case ID_AFTERPLAYBACK_CLOSE:
- fChecked = !!(s.nCLSwitches & CLSW_CLOSE);
- break;
- case ID_AFTERPLAYBACK_STANDBY:
- fChecked = !!(s.nCLSwitches & CLSW_STANDBY);
- break;
- case ID_AFTERPLAYBACK_HIBERNATE:
- fChecked = !!(s.nCLSwitches & CLSW_HIBERNATE);
- break;
- case ID_AFTERPLAYBACK_SHUTDOWN:
- fChecked = !!(s.nCLSwitches & CLSW_SHUTDOWN);
- break;
- case ID_AFTERPLAYBACK_LOGOFF:
- fChecked = !!(s.nCLSwitches & CLSW_LOGOFF);
- break;
- case ID_AFTERPLAYBACK_DONOTHING:
- fChecked = (!s.fExitAfterPlayback) && (!s.fNextInDirAfterPlayback);
- break;
+ switch(pCmdUI->m_nID) {
+ case ID_AFTERPLAYBACK_EXIT:
+ fChecked = !!s.fExitAfterPlayback;
+ break;
+ case ID_AFTERPLAYBACK_NEXT:
+ fChecked = !!s.fNextInDirAfterPlayback;
+ break;
+ case ID_AFTERPLAYBACK_CLOSE:
+ fChecked = !!(s.nCLSwitches & CLSW_CLOSE);
+ break;
+ case ID_AFTERPLAYBACK_STANDBY:
+ fChecked = !!(s.nCLSwitches & CLSW_STANDBY);
+ break;
+ case ID_AFTERPLAYBACK_HIBERNATE:
+ fChecked = !!(s.nCLSwitches & CLSW_HIBERNATE);
+ break;
+ case ID_AFTERPLAYBACK_SHUTDOWN:
+ fChecked = !!(s.nCLSwitches & CLSW_SHUTDOWN);
+ break;
+ case ID_AFTERPLAYBACK_LOGOFF:
+ fChecked = !!(s.nCLSwitches & CLSW_LOGOFF);
+ break;
+ case ID_AFTERPLAYBACK_DONOTHING:
+ fChecked = (!s.fExitAfterPlayback) && (!s.fNextInDirAfterPlayback);
+ break;
}
pCmdUI->SetRadio(fChecked);
@@ -8291,12 +8104,12 @@ void CMainFrame::OnUpdateAfterplayback(CCmdUI* pCmdUI) // navigate
void CMainFrame::OnNavigateSkip(UINT nID)
{
- if(GetPlaybackMode() == PM_FILE)
- {
- if(GetPlaybackMode() == PM_FILE) SetupChapters();
+ if(GetPlaybackMode() == PM_FILE) {
+ if(GetPlaybackMode() == PM_FILE) {
+ SetupChapters();
+ }
- if(DWORD nChapters = m_pCB->ChapGetCount())
- {
+ if(DWORD nChapters = m_pCB->ChapGetCount()) {
REFERENCE_TIME rtCur;
pMS->GetCurrentPosition(&rtCur);
@@ -8304,20 +8117,18 @@ void CMainFrame::OnNavigateSkip(UINT nID) CComBSTR name;
long i = 0;
- if(nID == ID_NAVIGATE_SKIPBACK)
- {
+ if(nID == ID_NAVIGATE_SKIPBACK) {
rt -= 30000000;
i = m_pCB->ChapLookup(&rt, &name);
- }
- else if(nID == ID_NAVIGATE_SKIPFORWARD)
- {
+ } else if(nID == ID_NAVIGATE_SKIPFORWARD) {
i = m_pCB->ChapLookup(&rt, &name) + 1;
name.Empty();
- if(i < nChapters) m_pCB->ChapGet(i, &rt, &name);
+ if(i < nChapters) {
+ m_pCB->ChapGet(i, &rt, &name);
+ }
}
- if(i >= 0 && i < nChapters)
- {
+ if(i >= 0 && i < nChapters) {
SeekTo(rt);
SendStatusMessage(ResStr(IDS_AG_CHAPTER2) + CString(name), 3000);
@@ -8331,33 +8142,29 @@ void CMainFrame::OnNavigateSkip(UINT nID) }
- if(m_wndPlaylistBar.GetCount() != 1)
- {
- if(nID == ID_NAVIGATE_SKIPBACK)
+ if(m_wndPlaylistBar.GetCount() != 1) {
+ if(nID == ID_NAVIGATE_SKIPBACK) {
SendMessage(WM_COMMAND, ID_NAVIGATE_SKIPBACKPLITEM);
- else if(nID == ID_NAVIGATE_SKIPFORWARD)
+ } else if(nID == ID_NAVIGATE_SKIPFORWARD) {
SendMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARDPLITEM);
- }
- else if ((m_wndPlaylistBar.GetCount() == 1) && !AfxGetAppSettings().fDontUseSearchInFolder)
- {
- if(nID == ID_NAVIGATE_SKIPBACK)
- {
- if (!SearchInDir(false))
- m_OSD.DisplayMessage(OSD_TOPLEFT, ResStr(IDS_FIRST_IN_FOLDER));
}
- else if(nID == ID_NAVIGATE_SKIPFORWARD)
- {
- if (!SearchInDir(true))
+ } else if ((m_wndPlaylistBar.GetCount() == 1) && !AfxGetAppSettings().fDontUseSearchInFolder) {
+ if(nID == ID_NAVIGATE_SKIPBACK) {
+ if (!SearchInDir(false)) {
+ m_OSD.DisplayMessage(OSD_TOPLEFT, ResStr(IDS_FIRST_IN_FOLDER));
+ }
+ } else if(nID == ID_NAVIGATE_SKIPFORWARD) {
+ if (!SearchInDir(true)) {
m_OSD.DisplayMessage(OSD_TOPLEFT, ResStr(IDS_LAST_IN_FOLDER));
+ }
}
}
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
m_iSpeedLevel = 0;
- if(GetMediaState() != State_Running)
+ if(GetMediaState() != State_Running) {
SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
ULONG ulNumOfVolumes, ulVolume;
DVD_DISC_SIDE Side;
@@ -8370,42 +8177,34 @@ void CMainFrame::OnNavigateSkip(UINT nID) ULONG ulNumOfChapters = 0;
pDVDI->GetNumberOfChapters(Location.TitleNum, &ulNumOfChapters);
- if(nID == ID_NAVIGATE_SKIPBACK)
- {
- if(Location.ChapterNum == 1 && Location.TitleNum > 1)
- {
+ if(nID == ID_NAVIGATE_SKIPBACK) {
+ if(Location.ChapterNum == 1 && Location.TitleNum > 1) {
pDVDI->GetNumberOfChapters(Location.TitleNum-1, &ulNumOfChapters);
pDVDC->PlayChapterInTitle(Location.TitleNum-1, ulNumOfChapters, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- }
- else
- {
+ } else {
ULONG tsec = (Location.TimeCode.bHours * 3600)
+ (Location.TimeCode.bMinutes * 60)
+ (Location.TimeCode.bSeconds);
ULONG diff = 0;
- if ( m_lChapterStartTime != 0xFFFFFFFF && tsec > m_lChapterStartTime )
+ if ( m_lChapterStartTime != 0xFFFFFFFF && tsec > m_lChapterStartTime ) {
diff = tsec - m_lChapterStartTime;
+ }
// Restart the chapter if more than 7 seconds have passed
- if ( diff <= 7 )
+ if ( diff <= 7 ) {
pDVDC->PlayPrevChapter(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- else
+ } else {
pDVDC->ReplayChapter(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ }
}
- }
- else if(nID == ID_NAVIGATE_SKIPFORWARD)
- {
- if(Location.ChapterNum == ulNumOfChapters && Location.TitleNum < ulNumOfTitles)
- {
+ } else if(nID == ID_NAVIGATE_SKIPFORWARD) {
+ if(Location.ChapterNum == ulNumOfChapters && Location.TitleNum < ulNumOfTitles) {
pDVDC->PlayChapterInTitle(Location.TitleNum+1, 1, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- }
- else
- {
+ } else {
pDVDC->PlayNextChapter(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
}
}
- if((pDVDI->GetCurrentLocation(&Location) == S_OK))
- {
+ if((pDVDI->GetCurrentLocation(&Location) == S_OK)) {
pDVDI->GetNumberOfChapters(Location.TitleNum, &ulNumOfChapters);
CString m_strTitle;
m_strTitle.Format(IDS_AG_TITLE, Location.TitleNum);
@@ -8416,44 +8215,40 @@ void CMainFrame::OnNavigateSkip(UINT nID) if(stop>0)
m_strOSD.Format(_T("%02d:%02d:%02d/%s %s, %s: %d/%d"), Location.TimeCode.bHours, Location.TimeCode.bMinutes, Location.TimeCode.bSeconds,
DVDtimeToString(RT2HMSF(stop)), m_strTitle, ResStr(IDS_AG_CHAPTER2), Location.ChapterNum, ulNumOfChapters);
- else
+ else {
m_strOSD.Format(_T("%s, %s: %d/%d"), m_strTitle, ResStr(IDS_AG_CHAPTER2), Location.ChapterNum, ulNumOfChapters);
+ }
m_OSD.DisplayMessage(OSD_TOPLEFT, m_strOSD, 3000);
}
-/*
- if(nID == ID_NAVIGATE_SKIPBACK)
- pDVDC->PlayPrevChapter(DVD_CMD_FLAG_Block, NULL);
- else if(nID == ID_NAVIGATE_SKIPFORWARD)
- pDVDC->PlayNextChapter(DVD_CMD_FLAG_Block, NULL);
-*/
- }
- else if(GetPlaybackMode() == PM_CAPTURE)
- {
- if (AfxGetAppSettings().iDefaultCaptureDevice == 1)
- {
+ /*
+ if(nID == ID_NAVIGATE_SKIPBACK)
+ pDVDC->PlayPrevChapter(DVD_CMD_FLAG_Block, NULL);
+ else if(nID == ID_NAVIGATE_SKIPFORWARD)
+ pDVDC->PlayNextChapter(DVD_CMD_FLAG_Block, NULL);
+ */
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
+ if (AfxGetAppSettings().iDefaultCaptureDevice == 1) {
CComQIPtr<IBDATuner> pTun = pGB;
- if (pTun)
- {
+ if (pTun) {
int nCurrentChannel;
AppSettings& s = AfxGetAppSettings();
nCurrentChannel = s.nDVBLastChannel;
- if(nID == ID_NAVIGATE_SKIPBACK)
- {
+ if(nID == ID_NAVIGATE_SKIPBACK) {
pTun->SetChannel (nCurrentChannel - 1);
DisplayCurrentChannelOSD();
- if (m_wndNavigationBar.IsVisible())
+ if (m_wndNavigationBar.IsVisible()) {
m_wndNavigationBar.m_navdlg.UpdatePos(nCurrentChannel - 1);
- }
- else if(nID == ID_NAVIGATE_SKIPFORWARD)
- {
+ }
+ } else if(nID == ID_NAVIGATE_SKIPFORWARD) {
pTun->SetChannel (nCurrentChannel + 1);
DisplayCurrentChannelOSD();
- if (m_wndNavigationBar.IsVisible())
+ if (m_wndNavigationBar.IsVisible()) {
m_wndNavigationBar.m_navdlg.UpdatePos(nCurrentChannel + 1);
+ }
}
}
@@ -8465,7 +8260,7 @@ void CMainFrame::OnNavigateSkip(UINT nID) void CMainFrame::OnUpdateNavigateSkip(CCmdUI* pCmdUI)
{
// moved to the timer callback function, that runs less frequent
-// if(GetPlaybackMode() == PM_FILE) SetupChapters();
+ // if(GetPlaybackMode() == PM_FILE) SetupChapters();
pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED
&& ((GetPlaybackMode() == PM_DVD
@@ -8478,21 +8273,14 @@ void CMainFrame::OnUpdateNavigateSkip(CCmdUI* pCmdUI) void CMainFrame::OnNavigateSkipPlaylistItem(UINT nID)
{
- if(GetPlaybackMode() == PM_FILE || GetPlaybackMode() == PM_CAPTURE)
- {
- if(m_wndPlaylistBar.GetCount() == 1)
- {
+ if(GetPlaybackMode() == PM_FILE || GetPlaybackMode() == PM_CAPTURE) {
+ if(m_wndPlaylistBar.GetCount() == 1) {
SendMessage(WM_COMMAND, ID_PLAY_STOP); // do not remove this, unless you want a circular call with OnPlayPlay()
SendMessage(WM_COMMAND, ID_PLAY_PLAY);
- }
- else
- {
- if(nID == ID_NAVIGATE_SKIPBACKPLITEM)
- {
+ } else {
+ if(nID == ID_NAVIGATE_SKIPBACKPLITEM) {
m_wndPlaylistBar.SetPrev();
- }
- else if(nID == ID_NAVIGATE_SKIPFORWARDPLITEM)
- {
+ } else if(nID == ID_NAVIGATE_SKIPFORWARDPLITEM) {
m_wndPlaylistBar.SetNext();
}
@@ -8511,13 +8299,15 @@ void CMainFrame::OnNavigateMenu(UINT nID) {
nID -= ID_NAVIGATE_TITLEMENU;
- if(m_iMediaLoadState != MLS_LOADED || GetPlaybackMode() != PM_DVD)
+ if(m_iMediaLoadState != MLS_LOADED || GetPlaybackMode() != PM_DVD) {
return;
+ }
m_iSpeedLevel = 0;
- if(GetMediaState() != State_Running)
+ if(GetMediaState() != State_Running) {
SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
pDVDC->ShowMenu((DVD_MENU_ID)(nID+2), DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
}
@@ -8528,8 +8318,7 @@ void CMainFrame::OnUpdateNavigateMenu(CCmdUI* pCmdUI) ULONG ulUOPs;
if(m_iMediaLoadState != MLS_LOADED || GetPlaybackMode() != PM_DVD
- || FAILED(pDVDI->GetCurrentUOPS(&ulUOPs)))
- {
+ || FAILED(pDVDI->GetCurrentUOPS(&ulUOPs))) {
pCmdUI->Enable(FALSE);
return;
}
@@ -8541,35 +8330,27 @@ void CMainFrame::OnNavigateAudio(UINT nID) {
nID -= ID_NAVIGATE_AUDIO_SUBITEM_START;
- if(GetPlaybackMode() == PM_FILE || (GetPlaybackMode() == PM_CAPTURE && AfxGetAppSettings().iDefaultCaptureDevice == 1))
- {
+ if(GetPlaybackMode() == PM_FILE || (GetPlaybackMode() == PM_CAPTURE && AfxGetAppSettings().iDefaultCaptureDevice == 1)) {
OnNavStreamSelectSubMenu(nID, 1);
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
pDVDC->SelectAudioStream(nID, DVD_CMD_FLAG_Block, NULL);
}
}
void CMainFrame::OnNavigateSubpic(UINT nID)
{
- if(GetPlaybackMode() == PM_FILE || (GetPlaybackMode() == PM_CAPTURE && AfxGetAppSettings().iDefaultCaptureDevice == 1))
- {
+ if(GetPlaybackMode() == PM_FILE || (GetPlaybackMode() == PM_CAPTURE && AfxGetAppSettings().iDefaultCaptureDevice == 1)) {
OnNavStreamSelectSubMenu(nID - ID_NAVIGATE_SUBP_SUBITEM_START, 2);
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
int i = (int)nID - (1 + ID_NAVIGATE_SUBP_SUBITEM_START);
- if(i == -1)
- {
+ if(i == -1) {
ULONG ulStreamsAvailable, ulCurrentStream;
BOOL bIsDisabled;
- if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled)))
+ if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled))) {
pDVDC->SetSubpictureState(bIsDisabled, DVD_CMD_FLAG_Block, NULL);
- }
- else
- {
+ }
+ } else {
pDVDC->SelectSubpictureStream(i, DVD_CMD_FLAG_Block, NULL);
pDVDC->SetSubpictureState(TRUE, DVD_CMD_FLAG_Block, NULL);
}
@@ -8580,12 +8361,9 @@ void CMainFrame::OnNavigateAngle(UINT nID) {
nID -= ID_NAVIGATE_ANGLE_SUBITEM_START;
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
OnNavStreamSelectSubMenu(nID, 0);
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
pDVDC->SelectAngle(nID+1, DVD_CMD_FLAG_Block, NULL);
}
}
@@ -8594,14 +8372,11 @@ void CMainFrame::OnNavigateChapters(UINT nID) {
nID -= ID_NAVIGATE_CHAP_SUBITEM_START;
- if(GetPlaybackMode() == PM_FILE)
- {
- if((int)nID >= 0 && nID < m_pCB->ChapGetCount())
- {
+ if(GetPlaybackMode() == PM_FILE) {
+ if((int)nID >= 0 && nID < m_pCB->ChapGetCount()) {
REFERENCE_TIME rt;
CComBSTR name;
- if(SUCCEEDED(m_pCB->ChapGet(nID, &rt, &name)))
- {
+ if(SUCCEEDED(m_pCB->ChapGet(nID, &rt, &name))) {
SeekTo(rt);
SendStatusMessage(ResStr(IDS_AG_CHAPTER2) + CString(name), 3000);
@@ -8617,14 +8392,11 @@ void CMainFrame::OnNavigateChapters(UINT nID) nID -= m_pCB->ChapGetCount();
if((int)nID >= 0 && (int)nID < m_wndPlaylistBar.GetCount()
- && m_wndPlaylistBar.GetSelIdx() != (int)nID)
- {
+ && m_wndPlaylistBar.GetSelIdx() != (int)nID) {
m_wndPlaylistBar.SetSelIdx(nID);
OpenCurPlaylistItem();
}
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
ULONG ulNumOfVolumes, ulVolume;
DVD_DISC_SIDE Side;
ULONG ulNumOfTitles = 0;
@@ -8638,23 +8410,18 @@ void CMainFrame::OnNavigateChapters(UINT nID) nID++;
- if(nID > 0 && nID <= ulNumOfTitles)
- {
+ if(nID > 0 && nID <= ulNumOfTitles) {
pDVDC->PlayTitle(nID, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); // sometimes this does not do anything ...
pDVDC->PlayChapterInTitle(nID, 1, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); // ... but this does!
- }
- else
- {
+ } else {
nID -= ulNumOfTitles;
- if(nID > 0 && nID <= ulNumOfChapters)
- {
+ if(nID > 0 && nID <= ulNumOfChapters) {
pDVDC->PlayChapter(nID, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
}
}
- if((pDVDI->GetCurrentLocation(&Location) == S_OK))
- {
+ if((pDVDI->GetCurrentLocation(&Location) == S_OK)) {
pDVDI->GetNumberOfChapters(Location.TitleNum, &ulNumOfChapters);
CString m_strTitle;
m_strTitle.Format(IDS_AG_TITLE, Location.TitleNum);
@@ -8665,27 +8432,24 @@ void CMainFrame::OnNavigateChapters(UINT nID) if(stop>0)
m_strOSD.Format(_T("%02d:%02d:%02d/%s %s, %s: %d/%d"), Location.TimeCode.bHours, Location.TimeCode.bMinutes, Location.TimeCode.bSeconds,
DVDtimeToString(RT2HMSF(stop)), m_strTitle, ResStr(IDS_AG_CHAPTER2), Location.ChapterNum, ulNumOfChapters);
- else
+ else {
m_strOSD.Format(_T("%s, %s: %d/%d"), m_strTitle, ResStr(IDS_AG_CHAPTER2), Location.ChapterNum, ulNumOfChapters);
+ }
m_OSD.DisplayMessage(OSD_TOPLEFT, m_strOSD, 3000);
}
- }
- else if(GetPlaybackMode() == PM_CAPTURE)
- {
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
AppSettings& s = AfxGetAppSettings();
- if (s.iDefaultCaptureDevice == 1)
- {
+ if (s.iDefaultCaptureDevice == 1) {
CComQIPtr<IBDATuner> pTun = pGB;
- if (pTun)
- {
- if (s.nDVBLastChannel != nID)
- {
+ if (pTun) {
+ if (s.nDVBLastChannel != nID) {
pTun->SetChannel (nID);
DisplayCurrentChannelOSD();
- if (m_wndNavigationBar.IsVisible())
+ if (m_wndNavigationBar.IsVisible()) {
m_wndNavigationBar.m_navdlg.UpdatePos(nID);
+ }
}
}
}
@@ -8696,39 +8460,39 @@ void CMainFrame::OnNavigateMenuItem(UINT nID) {
nID -= ID_NAVIGATE_MENU_LEFT;
- if(GetPlaybackMode() == PM_DVD)
- {
- switch(nID)
- {
- case 0:
- pDVDC->SelectRelativeButton(DVD_Relative_Left);
- break;
- case 1:
- pDVDC->SelectRelativeButton(DVD_Relative_Right);
- break;
- case 2:
- pDVDC->SelectRelativeButton(DVD_Relative_Upper);
- break;
- case 3:
- pDVDC->SelectRelativeButton(DVD_Relative_Lower);
- break;
- case 4:
- if (m_iDVDDomain != DVD_DOMAIN_Title) // Casimir666 : for the remote control
- pDVDC->ActivateButton();
- else
- OnPlayPlay();
- break;
- case 5:
- pDVDC->ReturnFromSubmenu(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- break;
- case 6:
- pDVDC->Resume(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- break;
- default:
- break;
+ if(GetPlaybackMode() == PM_DVD) {
+ switch(nID) {
+ case 0:
+ pDVDC->SelectRelativeButton(DVD_Relative_Left);
+ break;
+ case 1:
+ pDVDC->SelectRelativeButton(DVD_Relative_Right);
+ break;
+ case 2:
+ pDVDC->SelectRelativeButton(DVD_Relative_Upper);
+ break;
+ case 3:
+ pDVDC->SelectRelativeButton(DVD_Relative_Lower);
+ break;
+ case 4:
+ if (m_iDVDDomain != DVD_DOMAIN_Title) { // Casimir666 : for the remote control
+ pDVDC->ActivateButton();
+ } else {
+ OnPlayPlay();
+ }
+ break;
+ case 5:
+ pDVDC->ReturnFromSubmenu(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ break;
+ case 6:
+ pDVDC->Resume(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ break;
+ default:
+ break;
}
+ } else if (GetPlaybackMode() == PM_FILE) {
+ OnPlayPlay();
}
- else if (GetPlaybackMode() == PM_FILE) OnPlayPlay();
}
void CMainFrame::OnUpdateNavigateMenuItem(CCmdUI* pCmdUI)
@@ -8753,8 +8517,7 @@ void CMainFrame::OnUpdateTunerScan(CCmdUI* pCmdUI) class CDVDStateStream : public CUnknown, public IStream
{
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
- {
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) {
return
QI(IStream)
CUnknown::NonDelegatingQueryInterface(riid, ppv);
@@ -8763,8 +8526,7 @@ class CDVDStateStream : public CUnknown, public IStream __int64 m_pos;
public:
- CDVDStateStream() : CUnknown(NAME("CDVDStateStream"), NULL)
- {
+ CDVDStateStream() : CUnknown(NAME("CDVDStateStream"), NULL) {
m_pos = 0;
}
@@ -8773,60 +8535,54 @@ public: CAtlArray<BYTE> m_data;
// ISequentialStream
- STDMETHODIMP Read(void* pv, ULONG cb, ULONG* pcbRead)
- {
+ STDMETHODIMP Read(void* pv, ULONG cb, ULONG* pcbRead) {
__int64 cbRead = min(m_data.GetCount() - m_pos, (__int64)cb);
cbRead = max(cbRead, 0);
memcpy(pv, &m_data[(INT_PTR)m_pos], (int)cbRead);
- if(pcbRead) *pcbRead = (ULONG)cbRead;
+ if(pcbRead) {
+ *pcbRead = (ULONG)cbRead;
+ }
m_pos += cbRead;
return S_OK;
}
- STDMETHODIMP Write(const void* pv, ULONG cb, ULONG* pcbWritten)
- {
+ STDMETHODIMP Write(const void* pv, ULONG cb, ULONG* pcbWritten) {
BYTE* p = (BYTE*)pv;
ULONG cbWritten = (ULONG)-1;
- while(++cbWritten < cb)
+ while(++cbWritten < cb) {
m_data.Add(*p++);
- if(pcbWritten) *pcbWritten = cbWritten;
+ }
+ if(pcbWritten) {
+ *pcbWritten = cbWritten;
+ }
return S_OK;
}
// IStream
- STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
- {
+ STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) {
return E_NOTIMPL;
}
- STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize)
- {
+ STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize) {
return E_NOTIMPL;
}
- STDMETHODIMP CopyTo(IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten)
- {
+ STDMETHODIMP CopyTo(IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) {
return E_NOTIMPL;
}
- STDMETHODIMP Commit(DWORD grfCommitFlags)
- {
+ STDMETHODIMP Commit(DWORD grfCommitFlags) {
return E_NOTIMPL;
}
- STDMETHODIMP Revert()
- {
+ STDMETHODIMP Revert() {
return E_NOTIMPL;
}
- STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
- {
+ STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) {
return E_NOTIMPL;
}
- STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
- {
+ STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) {
return E_NOTIMPL;
}
- STDMETHODIMP Stat(STATSTG* pstatstg, DWORD grfStatFlag)
- {
+ STDMETHODIMP Stat(STATSTG* pstatstg, DWORD grfStatFlag) {
return E_NOTIMPL;
}
- STDMETHODIMP Clone(IStream** ppstm)
- {
+ STDMETHODIMP Clone(IStream** ppstm) {
return E_NOTIMPL;
}
};
@@ -8836,19 +8592,25 @@ void CMainFrame::OnFavoritesAdd() {
AppSettings& s = AfxGetAppSettings();
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
CString fn = m_wndPlaylistBar.GetCurFileName();
- if(fn.IsEmpty()) return;
+ if(fn.IsEmpty()) {
+ return;
+ }
CString desc = fn;
desc.Replace('\\', '/');
int i = desc.Find(_T("://")), j = desc.Find(_T("?")), k = desc.ReverseFind('/');
- if(i >= 0) desc = j >= 0 ? desc.Left(j) : desc;
- else if(k >= 0) desc = desc.Mid(k+1);
+ if(i >= 0) {
+ desc = j >= 0 ? desc.Left(j) : desc;
+ } else if(k >= 0) {
+ desc = desc.Mid(k+1);
+ }
CFavoriteAddDlg dlg(desc, fn);
- if(dlg.DoModal() != IDOK) return;
+ if(dlg.DoModal() != IDOK) {
+ return;
+ }
// Name
CString str = dlg.m_name;
@@ -8856,8 +8618,9 @@ void CMainFrame::OnFavoritesAdd() // RememberPos
CString pos(_T("0"));
- if(dlg.m_bRememberPos)
+ if(dlg.m_bRememberPos) {
pos.Format(_T("%I64d"), GetPos());
+ }
str += ';';
str += pos;
@@ -8871,16 +8634,15 @@ void CMainFrame::OnFavoritesAdd() // Paths
CPlaylistItem pli;
- if(m_wndPlaylistBar.GetCur(pli))
- {
+ if(m_wndPlaylistBar.GetCur(pli)) {
POSITION pos = pli.m_fns.GetHeadPosition();
- while(pos) str += _T(";") + pli.m_fns.GetNext(pos);
+ while(pos) {
+ str += _T(";") + pli.m_fns.GetNext(pos);
+ }
}
s.AddFav(FAV_FILE, str);
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
WCHAR path[_MAX_PATH];
ULONG len = 0;
pDVDI->GetDVDDirectory(path, _MAX_PATH, &len);
@@ -8894,7 +8656,9 @@ void CMainFrame::OnFavoritesAdd() Location.TimeCode.bHours, Location.TimeCode.bMinutes, Location.TimeCode.bSeconds);
CFavoriteAddDlg dlg(fn, desc);
- if(dlg.DoModal() != IDOK) return;
+ if(dlg.DoModal() != IDOK) {
+ return;
+ }
// Name
CString str = dlg.m_name;
@@ -8902,8 +8666,7 @@ void CMainFrame::OnFavoritesAdd() // RememberPos
CString pos(_T("0"));
- if(dlg.m_bRememberPos)
- {
+ if(dlg.m_bRememberPos) {
CDVDStateStream stream;
stream.AddRef();
@@ -8911,8 +8674,7 @@ void CMainFrame::OnFavoritesAdd() CComQIPtr<IPersistStream> pPersistStream;
if(SUCCEEDED(pDVDI->GetState(&pStateData))
&& (pPersistStream = pStateData)
- && SUCCEEDED(OleSaveToStream(pPersistStream, (IStream*)&stream)))
- {
+ && SUCCEEDED(OleSaveToStream(pPersistStream, (IStream*)&stream))) {
pos = BinToCString(stream.m_data.GetData(), stream.m_data.GetCount());
}
}
@@ -8925,9 +8687,7 @@ void CMainFrame::OnFavoritesAdd() str += fn;
s.AddFav(FAV_DVD, str);
- }
- else if(GetPlaybackMode() == PM_CAPTURE)
- {
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
// TODO
}
}
@@ -8942,24 +8702,29 @@ void CMainFrame::OnFavoritesQuickAddFavorite() {
AppSettings& s = AfxGetAppSettings();
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
CString fn = m_wndPlaylistBar.GetCurFileName();
- if(fn.IsEmpty()) return;
+ if(fn.IsEmpty()) {
+ return;
+ }
CString desc = fn;
desc.Replace('\\', '/');
int i = desc.Find(_T("://")), j = desc.Find(_T("?")), k = desc.ReverseFind('/');
- if(i >= 0) desc = j >= 0 ? desc.Left(j) : desc;
- else if(k >= 0) desc = desc.Mid(k+1);
+ if(i >= 0) {
+ desc = j >= 0 ? desc.Left(j) : desc;
+ } else if(k >= 0) {
+ desc = desc.Mid(k+1);
+ }
// TODO: Make this proper code
BOOL bRememberPos = AfxGetApp()->GetProfileInt(IDS_R_FAVORITES, IDS_RS_FAV_REMEMBERPOS, TRUE);
BOOL bRelativeDrive = AfxGetApp()->GetProfileInt(IDS_R_FAVORITES, IDS_RS_FAV_RELATIVEDRIVE, FALSE);
CString fn_with_pos(desc);
- if(bRememberPos)
- fn_with_pos.Format(_T("%s_%s"), desc, GetVidPos()); // Add file position (time format) so it will be easier to organize later
+ if(bRememberPos) {
+ fn_with_pos.Format(_T("%s_%s"), desc, GetVidPos()); // Add file position (time format) so it will be easier to organize later
+ }
// Name
CString str = fn_with_pos;
@@ -8967,8 +8732,9 @@ void CMainFrame::OnFavoritesQuickAddFavorite() // RememberPos
CString pos(_T("0"));
- if(bRememberPos)
+ if(bRememberPos) {
pos.Format(_T("%I64d"), GetPos());
+ }
str += ';';
str += pos;
@@ -8982,16 +8748,15 @@ void CMainFrame::OnFavoritesQuickAddFavorite() // Paths
CPlaylistItem pli;
- if(m_wndPlaylistBar.GetCur(pli))
- {
+ if(m_wndPlaylistBar.GetCur(pli)) {
POSITION pos = pli.m_fns.GetHeadPosition();
- while(pos) str += _T(";") + pli.m_fns.GetNext(pos);
+ while(pos) {
+ str += _T(";") + pli.m_fns.GetNext(pos);
+ }
}
s.AddFav(FAV_FILE, str);
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
WCHAR path[_MAX_PATH];
ULONG len = 0;
pDVDI->GetDVDDirectory(path, _MAX_PATH, &len);
@@ -9013,8 +8778,7 @@ void CMainFrame::OnFavoritesQuickAddFavorite() // RememberPos
CString pos(_T("0"));
- if(bRememberPos)
- {
+ if(bRememberPos) {
CDVDStateStream stream;
stream.AddRef();
@@ -9022,8 +8786,7 @@ void CMainFrame::OnFavoritesQuickAddFavorite() CComQIPtr<IPersistStream> pPersistStream;
if(SUCCEEDED(pDVDI->GetState(&pStateData))
&& (pPersistStream = pStateData)
- && SUCCEEDED(OleSaveToStream(pPersistStream, (IStream*)&stream)))
- {
+ && SUCCEEDED(OleSaveToStream(pPersistStream, (IStream*)&stream))) {
pos = BinToCString(stream.m_data.GetData(), stream.m_data.GetCount());
}
}
@@ -9036,9 +8799,7 @@ void CMainFrame::OnFavoritesQuickAddFavorite() str += fn;
s.AddFav(FAV_DVD, str);
- }
- else if(GetPlaybackMode() == PM_CAPTURE)
- {
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
// TODO
}
}
@@ -9056,13 +8817,18 @@ void CMainFrame::OnUpdateFavoritesOrganize(CCmdUI* pCmdUI) void CMainFrame::OnRecentFileClear()
{
- if(IDYES != AfxMessageBox(ResStr(IDS_RECENT_FILES_QUESTION), MB_YESNO))
+ if(IDYES != AfxMessageBox(ResStr(IDS_RECENT_FILES_QUESTION), MB_YESNO)) {
return;
+ }
AppSettings& s = AfxGetAppSettings();
- for(int i = 0; i < s.MRU.GetSize(); i++) s.MRU[i] = _T("");
- for(int i = 0; i < s.MRUDub.GetSize(); i++) s.MRUDub[i] = _T("");
+ for(int i = 0; i < s.MRU.GetSize(); i++) {
+ s.MRU[i] = _T("");
+ }
+ for(int i = 0; i < s.MRUDub.GetSize(); i++) {
+ s.MRUDub[i] = _T("");
+ }
s.MRU.WriteList();
s.MRUDub.WriteList();
}
@@ -9079,8 +8845,7 @@ void CMainFrame::OnFavoritesFile(UINT nID) CAtlList<CString> sl;
AfxGetAppSettings().GetFav(FAV_FILE, sl);
- if(POSITION pos = sl.FindIndex(nID))
- {
+ if(POSITION pos = sl.FindIndex(nID)) {
CAtlList<CString> fns;
REFERENCE_TIME rtStart = 0;
BOOL bRelativeDrive = FALSE;
@@ -9088,18 +8853,21 @@ void CMainFrame::OnFavoritesFile(UINT nID) int i = 0, j = 0;
for(CString s1 = sl.GetAt(pos), s2 = s1.Tokenize(_T(";"), i);
!s2.IsEmpty();
- s2 = s1.Tokenize(_T(";"), i), j++)
- {
- if(j == 0) ; // desc / name
- else if(j == 1) _stscanf_s(s2, _T("%I64d"), &rtStart); // pos
- else if(j == 2) _stscanf_s(s2, _T("%d"), &bRelativeDrive); // relative drive
- else fns.AddTail(s2); // paths
+ s2 = s1.Tokenize(_T(";"), i), j++) {
+ if(j == 0) {
+ ; // desc / name
+ } else if(j == 1) {
+ _stscanf_s(s2, _T("%I64d"), &rtStart); // pos
+ } else if(j == 2) {
+ _stscanf_s(s2, _T("%d"), &bRelativeDrive); // relative drive
+ } else {
+ fns.AddTail(s2); // paths
+ }
}
// NOTE: This is just for the favorites but we could add a global settings that does this always when on. Could be useful when using removable devices.
// All you have to do then is plug in your 500 gb drive, full with movies and/or music, start MPC-HC (from the 500 gb drive) with a preloaded playlist and press play.
- if ( bRelativeDrive )
- {
+ if ( bRelativeDrive ) {
// Get the drive MPC-HC is on and apply it to the path list
CString exePath;
DWORD dwLength = GetModuleFileName( AfxGetInstanceHandle(), exePath.GetBuffer(_MAX_PATH), _MAX_PATH );
@@ -9107,21 +8875,17 @@ void CMainFrame::OnFavoritesFile(UINT nID) CPath exeDrive( exePath );
- if ( exeDrive.StripToRoot() )
- {
+ if ( exeDrive.StripToRoot() ) {
POSITION pos = fns.GetHeadPosition();
- while ( pos != NULL )
- {
+ while ( pos != NULL ) {
CString &stringPath = fns.GetNext( pos );
CPath path( stringPath );
int rootLength = path.SkipRoot();
- if ( path.StripToRoot() )
- {
- if ( _tcsicmp(exeDrive, path) != 0 ) // Do we need to replace the drive letter ?
- {
+ if ( path.StripToRoot() ) {
+ if ( _tcsicmp(exeDrive, path) != 0 ) { // Do we need to replace the drive letter ?
// Replace drive letter
CString newPath( exeDrive );
@@ -9169,8 +8933,7 @@ void CMainFrame::OnFavoritesDVD(UINT nID) CAtlList<CString> sl;
AfxGetAppSettings().GetFav(FAV_DVD, sl);
- if(POSITION pos = sl.FindIndex(nID))
- {
+ if(POSITION pos = sl.FindIndex(nID)) {
CString fn;
CDVDStateStream stream;
@@ -9179,14 +8942,14 @@ void CMainFrame::OnFavoritesDVD(UINT nID) int i = 0, j = 0;
for(CString s1 = sl.GetAt(pos), s2 = s1.Tokenize(_T(";"), i);
!s2.IsEmpty();
- s2 = s1.Tokenize(_T(";"), i), j++)
- {
- if(j == 0) ; // desc
- else if(j == 1 && s2 != _T("0")) // state
- {
+ s2 = s1.Tokenize(_T(";"), i), j++) {
+ if(j == 0) {
+ ; // desc
+ } else if(j == 1 && s2 != _T("0")) { // state
CStringToBin(s2, stream.m_data);
+ } else if(j == 2) {
+ fn = s2; // path
}
- else if(j == 2) fn = s2; // path
}
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
@@ -9196,8 +8959,7 @@ void CMainFrame::OnFavoritesDVD(UINT nID) UNUSED_ALWAYS(hr);
CAutoPtr<OpenDVDData> p(DNew OpenDVDData());
- if(p)
- {
+ if(p) {
p->path = fn;
p->pDvdState = pDvdState;
}
@@ -9237,8 +8999,9 @@ void CMainFrame::OnHelpDocumentation() void CMainFrame::OnHelpDonate()
{
const TCHAR URL[] = _T("http://sourceforge.net/project/showfiles.php?group_id=170561");
- if(CString(URL).Find(CString(_T("A4N")).MakeReverse()) >= 0)
+ if(CString(URL).Find(CString(_T("A4N")).MakeReverse()) >= 0) {
ShellExecute(m_hWnd, _T("open"), URL, NULL, NULL, SW_SHOWDEFAULT);
+ }
}
//////////////////////////////////
@@ -9255,17 +9018,13 @@ void CMainFrame::SetDefaultWindowRect(int iMonitor) AppSettings& s = AfxGetAppSettings();
int w, h, x, y;
- if(s.HasFixedWindowSize())
- {
+ if(s.HasFixedWindowSize()) {
w = s.sizeFixedWindow.cx;
h = s.sizeFixedWindow.cy;
- }
- else if(s.fRememberWindowSize)
- {
+ } else if(s.fRememberWindowSize) {
w = s.rcLastWindowPos.Width();
h = s.rcLastWindowPos.Height();
- }
- else {
+ } else {
CRect r1, r2;
GetClientRect(&r1);
m_wndView.GetClientRect(&r2);
@@ -9274,8 +9033,9 @@ void CMainFrame::SetDefaultWindowRect(int iMonitor) int _DEFCLIENTW = max(logosize.cx, DEFCLIENTW);
int _DEFCLIENTH = max(logosize.cy, DEFCLIENTH);
- if(GetSystemMetrics(SM_REMOTESESSION))
+ if(GetSystemMetrics(SM_REMOTESESSION)) {
_DEFCLIENTH = 0;
+ }
DWORD style = GetStyle();
@@ -9290,21 +9050,19 @@ void CMainFrame::SetDefaultWindowRect(int iMonitor) }
}
- if(s.fRememberWindowPos)
- {
+ if(s.fRememberWindowPos) {
x = s.rcLastWindowPos.TopLeft().x;
y = s.rcLastWindowPos.TopLeft().y;
- }
- else
- {
+ } else {
HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
- if(iMonitor > 0)
- {
+ if(iMonitor > 0) {
iMonitor--;
CAtlArray<HMONITOR> ml;
EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (LPARAM)&ml);
- if(iMonitor < ml.GetCount()) hMonitor = ml[iMonitor];
+ if(iMonitor < ml.GetCount()) {
+ hMonitor = ml[iMonitor];
+ }
}
MONITORINFO mi;
@@ -9318,35 +9076,39 @@ void CMainFrame::SetDefaultWindowRect(int iMonitor) UINT lastWindowType = s.nLastWindowType;
MoveWindow(x, y, w, h);
- if(s.iCaptionMenuMode!=MODE_SHOWCAPTIONMENU)
- {
+ if(s.iCaptionMenuMode!=MODE_SHOWCAPTIONMENU) {
DWORD dwRemove = WS_CAPTION;
- if(s.iCaptionMenuMode == MODE_BORDERLESS) dwRemove |= WS_THICKFRAME;
+ if(s.iCaptionMenuMode == MODE_BORDERLESS) {
+ dwRemove |= WS_THICKFRAME;
+ }
ModifyStyle(dwRemove, 0, SWP_NOZORDER);
::SetMenu(m_hWnd, NULL);
SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER);
}
- if(!s.fRememberWindowPos) CenterWindow();
-
+ if(!s.fRememberWindowPos) {
+ CenterWindow();
+ }
+
// Waffs : fullscreen command line
- if(!(s.nCLSwitches&CLSW_ADD) && (s.nCLSwitches&CLSW_FULLSCREEN) && !s.slFiles.IsEmpty())
- {
+ if(!(s.nCLSwitches&CLSW_ADD) && (s.nCLSwitches&CLSW_FULLSCREEN) && !s.slFiles.IsEmpty()) {
ToggleFullscreen(true, true);
SetCursor(NULL);
AfxGetAppSettings().nCLSwitches &= ~CLSW_FULLSCREEN;
m_fFirstFSAfterLaunchOnFS = true;
}
- if(s.fRememberWindowSize && s.fRememberWindowPos)
- {
- if(lastWindowType == SIZE_MAXIMIZED)
+ if(s.fRememberWindowSize && s.fRememberWindowPos) {
+ if(lastWindowType == SIZE_MAXIMIZED) {
ShowWindow(SW_MAXIMIZE);
- else if(lastWindowType == SIZE_MINIMIZED)
+ } else if(lastWindowType == SIZE_MINIMIZED) {
ShowWindow(SW_MINIMIZE);
+ }
// Casimir666 : if fullscreen was on, put it on back
- if (!m_fFullScreen && s.fLastFullScreen) ToggleFullscreen(true, true);
+ if (!m_fFullScreen && s.fLastFullScreen) {
+ ToggleFullscreen(true, true);
+ }
}
}
@@ -9357,18 +9119,14 @@ void CMainFrame::RestoreDefaultWindowRect() WINDOWPLACEMENT wp;
GetWindowPlacement(&wp);
if(!m_fFullScreen && wp.showCmd != SW_SHOWMAXIMIZED && wp.showCmd != SW_SHOWMINIMIZED
-// && (GetExStyle()&WS_EX_APPWINDOW)
- && !s.fRememberWindowSize)
- {
+ // && (GetExStyle()&WS_EX_APPWINDOW)
+ && !s.fRememberWindowSize) {
int x, y, w, h;
- if(s.HasFixedWindowSize())
- {
+ if(s.HasFixedWindowSize()) {
w = s.sizeFixedWindow.cx;
h = s.sizeFixedWindow.cy;
- }
- else
- {
+ } else {
CRect r1, r2;
GetClientRect(&r1);
m_wndView.GetClientRect(&r2);
@@ -9383,20 +9141,16 @@ void CMainFrame::RestoreDefaultWindowRect() h = _DEFCLIENTH + ((style&WS_THICKFRAME) ? GetSystemMetrics(SM_CYSIZEFRAME)*2 : 0)
+ r1.Height() - r2.Height();
- if(style&WS_CAPTION)
- {
+ if(style&WS_CAPTION) {
h += GetSystemMetrics(SM_CYCAPTION);
h += GetSystemMetrics(SM_CYMENU);
}
}
- if(s.fRememberWindowPos)
- {
+ if(s.fRememberWindowPos) {
x = s.rcLastWindowPos.TopLeft().x;
y = s.rcLastWindowPos.TopLeft().y;
- }
- else
- {
+ } else {
CRect r;
GetWindowRect(r);
@@ -9406,22 +9160,27 @@ void CMainFrame::RestoreDefaultWindowRect() MoveWindow(x, y, w, h);
- if(!s.fRememberWindowPos) CenterWindow();
+ if(!s.fRememberWindowPos) {
+ CenterWindow();
+ }
}
}
OAFilterState CMainFrame::GetMediaState()
{
OAFilterState ret = -1;
- if(m_iMediaLoadState == MLS_LOADED) pMC->GetState(0, &ret);
+ if(m_iMediaLoadState == MLS_LOADED) {
+ pMC->GetState(0, &ret);
+ }
return(ret);
}
void CMainFrame::SetPlaybackMode(int iNewStatus)
{
m_iPlaybackMode = iNewStatus;
- if (m_wndNavigationBar.IsWindowVisible() && GetPlaybackMode() != PM_CAPTURE)
+ if (m_wndNavigationBar.IsWindowVisible() && GetPlaybackMode() != PM_CAPTURE) {
ShowControlBar(&m_wndNavigationBar, !m_wndNavigationBar.IsWindowVisible(), TRUE);
+ }
}
CSize CMainFrame::GetVideoSize()
@@ -9430,64 +9189,64 @@ CSize CMainFrame::GetVideoSize() bool fCompMonDeskARDiff = AfxGetAppSettings().fCompMonDeskARDiff;
CSize ret(0,0);
- if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly)
+ if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly) {
return ret;
+ }
CSize wh(0, 0), arxy(0, 0);
- if (m_pMFVDC)
- {
+ if (m_pMFVDC) {
m_pMFVDC->GetNativeVideoSize(&wh, &arxy); // TODO : check AR !!
- }
- else if(m_pCAP)
- {
+ } else if(m_pCAP) {
wh = m_pCAP->GetVideoSize(false);
arxy = m_pCAP->GetVideoSize(fKeepAspectRatio);
- }
- else
- {
+ } else {
pBV->GetVideoSize(&wh.cx, &wh.cy);
long arx = 0, ary = 0;
CComQIPtr<IBasicVideo2> pBV2 = pBV;
// FIXME: It can hang here, for few seconds (CPU goes to 100%), after the window have been moving over to another screen,
// due to GetPreferredAspectRatio, if it happens before CAudioSwitcherFilter::DeliverEndFlush, it seems.
- if(pBV2 && SUCCEEDED(pBV2->GetPreferredAspectRatio(&arx, &ary)) && arx > 0 && ary > 0)
+ if(pBV2 && SUCCEEDED(pBV2->GetPreferredAspectRatio(&arx, &ary)) && arx > 0 && ary > 0) {
arxy.SetSize(arx, ary);
+ }
}
- if(wh.cx <= 0 || wh.cy <= 0)
+ if(wh.cx <= 0 || wh.cy <= 0) {
return ret;
+ }
// with the overlay mixer IBasicVideo2 won't tell the new AR when changed dynamically
DVD_VideoAttributes VATR;
- if(GetPlaybackMode() == PM_DVD && SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR)))
+ if(GetPlaybackMode() == PM_DVD && SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR))) {
arxy.SetSize(VATR.ulAspectX, VATR.ulAspectY);
+ }
CSize& ar = AfxGetAppSettings().sizeAspectRatio;
- if(ar.cx && ar.cy) arxy = ar;
+ if(ar.cx && ar.cy) {
+ arxy = ar;
+ }
ret = (!fKeepAspectRatio || arxy.cx <= 0 || arxy.cy <= 0)
? wh
: CSize(MulDiv(wh.cy, arxy.cx, arxy.cy), wh.cy);
if(fCompMonDeskARDiff)
- if(HDC hDC = ::GetDC(0))
- {
+ if(HDC hDC = ::GetDC(0)) {
int _HORZSIZE = GetDeviceCaps(hDC, HORZSIZE);
int _VERTSIZE = GetDeviceCaps(hDC, VERTSIZE);
int _HORZRES = GetDeviceCaps(hDC, HORZRES);
int _VERTRES = GetDeviceCaps(hDC, VERTRES);
- if(_HORZSIZE > 0 && _VERTSIZE > 0 && _HORZRES > 0 && _VERTRES > 0)
- {
+ if(_HORZSIZE > 0 && _VERTSIZE > 0 && _HORZRES > 0 && _VERTRES > 0) {
double a = 1.0*_HORZSIZE/_VERTSIZE;
double b = 1.0*_HORZRES/_VERTRES;
- if(b < a)
+ if(b < a) {
ret.cy = (DWORD)(1.0*ret.cy * a / b);
- else if(a < b)
+ } else if(a < b) {
ret.cx = (DWORD)(1.0*ret.cx * b / a);
+ }
}
::ReleaseDC(0, hDC);
@@ -9512,52 +9271,60 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT CMonitors monitors;
static bool m_PlayListBarVisible = false;
- if(!m_fFullScreen)
- {
+ if(!m_fFullScreen) {
m_PlayListBarVisible = m_wndPlaylistBar.IsVisible();
- if((AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("HidePlaylistFullScreen"), FALSE)) && (m_PlayListBarVisible)) ShowControlBar(&m_wndPlaylistBar, !m_PlayListBarVisible, TRUE);
+ if((AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("HidePlaylistFullScreen"), FALSE)) && (m_PlayListBarVisible)) {
+ ShowControlBar(&m_wndPlaylistBar, !m_PlayListBarVisible, TRUE);
+ }
- if(!m_fFirstFSAfterLaunchOnFS) GetWindowRect(&m_lastWindowRect);
- if(s.AutoChangeFullscrRes.bEnabled && fSwitchScreenResWhenHasTo && (GetPlaybackMode() != PM_NONE)) AutoChangeMonitorMode();
+ if(!m_fFirstFSAfterLaunchOnFS) {
+ GetWindowRect(&m_lastWindowRect);
+ }
+ if(s.AutoChangeFullscrRes.bEnabled && fSwitchScreenResWhenHasTo && (GetPlaybackMode() != PM_NONE)) {
+ AutoChangeMonitorMode();
+ }
m_LastWindow_HM = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
CString str;
CMonitor monitor;
- if(s.strFullScreenMonitor == _T("Current"))
- {
+ if(s.strFullScreenMonitor == _T("Current")) {
hm = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
- }
- else
- {
- for ( int i = 0; i < monitors.GetCount(); i++ )
- {
+ } else {
+ for ( int i = 0; i < monitors.GetCount(); i++ ) {
monitor = monitors.GetMonitor( i );
monitor.GetName(str);
- if((monitor.IsMonitor()) && (s.strFullScreenMonitor == str))
- {
+ if((monitor.IsMonitor()) && (s.strFullScreenMonitor == str)) {
hm = monitor;
break;
}
}
- if(!hm) hm = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
+ if(!hm) {
+ hm = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
+ }
}
dwRemove = WS_CAPTION|WS_THICKFRAME;
GetMonitorInfo(hm, &mi);
- if(fToNearest) r = mi.rcMonitor;
- else GetDesktopWindow()->GetWindowRect(&r);
+ if(fToNearest) {
+ r = mi.rcMonitor;
+ } else {
+ GetDesktopWindow()->GetWindowRect(&r);
+ }
hMenu = NULL;
- }
- else
- {
- if(s.AutoChangeFullscrRes.bEnabled && s.AutoChangeFullscrRes.bApplyDefault)
+ } else {
+ if(s.AutoChangeFullscrRes.bEnabled && s.AutoChangeFullscrRes.bApplyDefault) {
SetDispMode(s.AutoChangeFullscrRes.dmFullscreenResOther, s.strFullScreenMonitor);
+ }
dwAdd = (s.iCaptionMenuMode==MODE_BORDERLESS ? 0 : s.iCaptionMenuMode==MODE_FRAMEONLY? WS_THICKFRAME: WS_CAPTION | WS_THICKFRAME);
- if (!m_fFirstFSAfterLaunchOnFS) r = m_lastWindowRect;
+ if (!m_fFirstFSAfterLaunchOnFS) {
+ r = m_lastWindowRect;
+ }
hMenu = (s.iCaptionMenuMode==MODE_SHOWCAPTIONMENU) ? m_hMenuDefault: NULL;
- if(AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("HidePlaylistFullScreen"), FALSE)) ShowControlBar(&m_wndPlaylistBar, m_PlayListBarVisible, TRUE);
+ if(AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("HidePlaylistFullScreen"), FALSE)) {
+ ShowControlBar(&m_wndPlaylistBar, m_PlayListBarVisible, TRUE);
+ }
}
m_lastMouseMove.x = m_lastMouseMove.y = -1;
@@ -9576,77 +9343,65 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT static bool m_Change_Monitor = false;
// try disable shader when move from one monitor to other ...
- if(m_fFullScreen)
- {
+ if(m_fFullScreen) {
m_Change_Monitor = (hm != hm_cur) ? true : false;
- if((m_Change_Monitor) && (!m_bToggleShader))
- {
- if (m_pCAP)
+ if((m_Change_Monitor) && (!m_bToggleShader)) {
+ if (m_pCAP) {
m_pCAP->SetPixelShader(NULL, NULL);
+ }
}
- if((m_Change_Monitor) && (!m_bToggleShaderScreenSpace))
- {
- if (m_pCAP2)
+ if((m_Change_Monitor) && (!m_bToggleShaderScreenSpace)) {
+ if (m_pCAP2) {
m_pCAP2->SetPixelShader2(NULL, NULL, 1);
+ }
}
- }
- else
- {
- if((m_Change_Monitor) && (!m_bToggleShader))
- {
- if (m_pCAP) m_pCAP->SetPixelShader(NULL, NULL);
+ } else {
+ if((m_Change_Monitor) && (!m_bToggleShader)) {
+ if (m_pCAP) {
+ m_pCAP->SetPixelShader(NULL, NULL);
+ }
}
}
- if(m_fFullScreen)
- {
+ if(m_fFullScreen) {
m_fHideCursor = true;
- if(s.fShowBarsWhenFullScreen)
- {
+ if(s.fShowBarsWhenFullScreen) {
int nTimeOut = s.nShowBarsWhenFullScreenTimeOut;
- if(nTimeOut == 0)
- {
+ if(nTimeOut == 0) {
ShowControls(CS_NONE, false);
ShowControlBar(&m_wndNavigationBar, false, TRUE);
- }
- else if(nTimeOut > 0)
- {
+ } else if(nTimeOut > 0) {
SetTimer(TIMER_FULLSCREENCONTROLBARHIDER, nTimeOut*1000, NULL);
SetTimer(TIMER_FULLSCREENMOUSEHIDER, max(nTimeOut*1000, 2000), NULL);
}
- }
- else
- {
+ } else {
ShowControls(CS_NONE, false);
ShowControlBar(&m_wndNavigationBar, false, TRUE);
}
- if(s.fPreventMinimize)
- {
- if(hm != hm_cur) ModifyStyle(WS_MINIMIZEBOX, 0, SWP_NOZORDER);
+ if(s.fPreventMinimize) {
+ if(hm != hm_cur) {
+ ModifyStyle(WS_MINIMIZEBOX, 0, SWP_NOZORDER);
+ }
}
- }
- else
- {
+ } else {
ModifyStyle(0, WS_MINIMIZEBOX, SWP_NOZORDER);
KillTimer(TIMER_FULLSCREENCONTROLBARHIDER);
KillTimer(TIMER_FULLSCREENMOUSEHIDER);
m_fHideCursor = false;
ShowControls(s.nCS);
- if (GetPlaybackMode() == PM_CAPTURE && s.iDefaultCaptureDevice == 1)
+ if (GetPlaybackMode() == PM_CAPTURE && s.iDefaultCaptureDevice == 1) {
ShowControlBar(&m_wndNavigationBar, !s.fHideNavigation, TRUE);
+ }
}
m_fAudioOnly = fAudioOnly;
- if (m_fFirstFSAfterLaunchOnFS) //Play started in Fullscreen
- {
- if(s.fRememberWindowSize || s.fRememberWindowPos)
- {
+ if (m_fFirstFSAfterLaunchOnFS) { //Play started in Fullscreen
+ if(s.fRememberWindowSize || s.fRememberWindowPos) {
r = s.rcLastWindowPos;
- if(!s.fRememberWindowPos)
- {
+ if(!s.fRememberWindowPos) {
hm = MonitorFromPoint( CPoint( 0,0 ), MONITOR_DEFAULTTOPRIMARY );
GetMonitorInfo(hm, &mi);
CRect m_r = mi.rcMonitor;
@@ -9654,42 +9409,36 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT int top = m_r.top + (m_r.Height() - r.Height())/2;
r = CRect(left, top, left + r.Width(), top + r.Height());
}
- if(!s.fRememberWindowSize)
- {
+ if(!s.fRememberWindowSize) {
CSize vsize = GetVideoSize();
r = CRect(r.left, r.top, r.left + vsize.cx, r.top + vsize.cy);
ShowWindow(SW_HIDE);
}
SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER|SWP_NOSENDCHANGING);
- if(!s.fRememberWindowSize)
- {
+ if(!s.fRememberWindowSize) {
ZoomVideoWindow();
ShowWindow(SW_SHOW);
}
- }
- else
- {
- if(m_LastWindow_HM != hm_cur)
- {
+ } else {
+ if(m_LastWindow_HM != hm_cur) {
GetMonitorInfo(m_LastWindow_HM, &mi);
r = mi.rcMonitor;
ShowWindow(SW_HIDE);
SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER|SWP_NOSENDCHANGING);
}
ZoomVideoWindow();
- if(m_LastWindow_HM != hm_cur) ShowWindow(SW_SHOW);
+ if(m_LastWindow_HM != hm_cur) {
+ ShowWindow(SW_SHOW);
+ }
}
m_fFirstFSAfterLaunchOnFS = false;
- }
- else
- {
+ } else {
SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER|SWP_NOSENDCHANGING);
}
MoveVideoWindow();
- if((m_Change_Monitor) && (!m_bToggleShader || !m_bToggleShaderScreenSpace)) // Enabled shader ...
- {
+ if((m_Change_Monitor) && (!m_bToggleShader || !m_bToggleShaderScreenSpace)) { // Enabled shader ...
SetShaders();
}
}
@@ -9700,21 +9449,22 @@ void CMainFrame::AutoChangeMonitorMode() CStringW mf_hmonitor = s.strFullScreenMonitor;
double MediaFPS = 0.0;
- if (GetPlaybackMode() == PM_FILE)
- {
+ if (GetPlaybackMode() == PM_FILE) {
LONGLONG m_rtTimePerFrame = 1;
// if ExtractAvgTimePerFrame isn't executed then MediaFPS=10000000.0,
// (int)(MediaFPS + 0.5)=10000000 and SetDispMode is executed to Default.
- BeginEnumFilters(pGB, pEF, pBF)
- {
- BeginEnumPins(pBF, pEP, pPin)
- {
+ BeginEnumFilters(pGB, pEF, pBF) {
+ BeginEnumPins(pBF, pEP, pPin) {
CMediaTypeEx mt;
PIN_DIRECTION dir;
if(FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_OUTPUT
- || FAILED(pPin->ConnectionMediaType(&mt))) continue;
+ || FAILED(pPin->ConnectionMediaType(&mt))) {
+ continue;
+ }
ExtractAvgTimePerFrame (&mt, m_rtTimePerFrame);
- if (m_rtTimePerFrame == 0) m_rtTimePerFrame=1;
+ if (m_rtTimePerFrame == 0) {
+ m_rtTimePerFrame=1;
+ }
}
EndEnumPins;
}
@@ -9722,11 +9472,9 @@ void CMainFrame::AutoChangeMonitorMode() MediaFPS = 10000000.0 / m_rtTimePerFrame;
}
- if (GetPlaybackMode() == PM_DVD)
- {
+ if (GetPlaybackMode() == PM_DVD) {
DVD_PLAYBACK_LOCATION2 Location;
- if (pDVDI->GetCurrentLocation(&Location) == S_OK)
- {
+ if (pDVDI->GetCurrentLocation(&Location) == S_OK) {
MediaFPS = Location.TimeCodeFlags == DVD_TC_FLAG_25fps ? 25.0
: Location.TimeCodeFlags == DVD_TC_FLAG_30fps ? 30.0
: Location.TimeCodeFlags == DVD_TC_FLAG_DropFrame ? 29.97
@@ -9734,50 +9482,42 @@ void CMainFrame::AutoChangeMonitorMode() }
}
- if (IsVistaOrAbove())
- {
- if ((MediaFPS > 23.971) && (MediaFPS < 23.981))
- {
+ if (IsVistaOrAbove()) {
+ if ((MediaFPS > 23.971) && (MediaFPS < 23.981)) {
SetDispMode(s.AutoChangeFullscrRes.dmFullscreenRes23d976Hz, mf_hmonitor);
return;
}
- if ((MediaFPS > 29.965) && (MediaFPS < 29.975))
- {
+ if ((MediaFPS > 29.965) && (MediaFPS < 29.975)) {
SetDispMode(s.AutoChangeFullscrRes.dmFullscreenRes29d97Hz, mf_hmonitor);
return;
}
}
- switch ((int)(MediaFPS + 0.5))
- {
- case 24 :
- SetDispMode(s.AutoChangeFullscrRes.dmFullscreenRes24Hz, mf_hmonitor);
- break;
- case 25 :
- SetDispMode(s.AutoChangeFullscrRes.dmFullscreenRes25Hz, mf_hmonitor);
- break;
- case 30 :
- SetDispMode(s.AutoChangeFullscrRes.dmFullscreenRes30Hz, mf_hmonitor);
- break;
- default:
- SetDispMode(s.AutoChangeFullscrRes.dmFullscreenResOther, mf_hmonitor);
+ switch ((int)(MediaFPS + 0.5)) {
+ case 24 :
+ SetDispMode(s.AutoChangeFullscrRes.dmFullscreenRes24Hz, mf_hmonitor);
+ break;
+ case 25 :
+ SetDispMode(s.AutoChangeFullscrRes.dmFullscreenRes25Hz, mf_hmonitor);
+ break;
+ case 30 :
+ SetDispMode(s.AutoChangeFullscrRes.dmFullscreenRes30Hz, mf_hmonitor);
+ break;
+ default:
+ SetDispMode(s.AutoChangeFullscrRes.dmFullscreenResOther, mf_hmonitor);
}
}
void CMainFrame::MoveVideoWindow(bool fShowStats)
{
- if(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && IsWindowVisible())
- {
+ if(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && IsWindowVisible()) {
CRect wr;
- if (m_pFullscreenWnd->IsWindow())
+ if (m_pFullscreenWnd->IsWindow()) {
m_pFullscreenWnd->GetClientRect(&wr);
- else if(!m_fFullScreen)
- {
+ } else if(!m_fFullScreen) {
m_wndView.GetClientRect(&wr);
- }
- else
- {
+ } else {
GetWindowRect(&wr);
// it's code need for work in fullscreen on secondary monitor;
@@ -9789,8 +9529,7 @@ void CMainFrame::MoveVideoWindow(bool fShowStats) CRect vr = CRect(0,0,0,0);
OAFilterState fs = GetMediaState();
- if(fs == State_Paused || fs == State_Running || fs == State_Stopped && (m_fShockwaveGraph || m_fQuicktimeGraph))
- {
+ if(fs == State_Paused || fs == State_Running || fs == State_Stopped && (m_fShockwaveGraph || m_fQuicktimeGraph)) {
CSize arxy = GetVideoSize();
dvstype iDefaultVideoSize = (dvstype)AfxGetAppSettings().iDefaultVideoSize;
@@ -9804,33 +9543,31 @@ void CMainFrame::MoveVideoWindow(bool fShowStats) int w = ws.cx;
int h = ws.cy;
- if(!m_fShockwaveGraph) //&& !m_fQuicktimeGraph)
- {
+ if(!m_fShockwaveGraph) { //&& !m_fQuicktimeGraph)
if(iDefaultVideoSize == DVS_FROMINSIDE || iDefaultVideoSize == DVS_FROMOUTSIDE ||
- iDefaultVideoSize == DVS_ZOOM1 || iDefaultVideoSize == DVS_ZOOM2)
- {
+ iDefaultVideoSize == DVS_ZOOM1 || iDefaultVideoSize == DVS_ZOOM2) {
int dh = ws.cy;
int dw = MulDiv(dh, arxy.cx, arxy.cy);
int i = 0;
- switch(iDefaultVideoSize)
- {
- case DVS_ZOOM1:
- i = 1;
- break;
- case DVS_ZOOM2:
- i = 2;
- break;
- case DVS_FROMOUTSIDE:
- i = 3;
- break;
+ switch(iDefaultVideoSize) {
+ case DVS_ZOOM1:
+ i = 1;
+ break;
+ case DVS_ZOOM2:
+ i = 2;
+ break;
+ case DVS_FROMOUTSIDE:
+ i = 3;
+ break;
}
int minw = dw;
int maxw = dw;
- if(ws.cx < dw)
+ if(ws.cx < dw) {
minw = ws.cx;
- else if(ws.cx > dw)
+ } else if(ws.cx > dw) {
maxw = ws.cx;
+ }
float scale = i / 3.0f;
w = minw + (maxw - minw) * scale;
@@ -9859,32 +9596,28 @@ void CMainFrame::MoveVideoWindow(bool fShowStats) //wr |= CRect(0,0,0,0);
//vr |= CRect(0,0,0,0);
- if(m_pCAP)
- {
+ if(m_pCAP) {
m_pCAP->SetPosition(wr, vr);
m_pCAP->SetVideoAngle(Vector(DegToRad(m_AngleX), DegToRad(m_AngleY), DegToRad(m_AngleZ)));
- }
- else
- {
+ } else {
HRESULT hr;
hr = pBV->SetDefaultSourcePosition();
hr = pBV->SetDestinationPosition(vr.left, vr.top, vr.Width(), vr.Height());
hr = pVW->SetWindowPosition(wr.left, wr.top, wr.Width(), wr.Height());
- if (m_pMFVDC) m_pMFVDC->SetVideoPosition (NULL, wr);
+ if (m_pMFVDC) {
+ m_pMFVDC->SetVideoPosition (NULL, wr);
+ }
}
m_wndView.SetVideoRect(wr);
- if(fShowStats && vr.Height() > 0)
- {
+ if(fShowStats && vr.Height() > 0) {
CString info;
info.Format(_T("Pos %.2f %.2f, Zoom %.2f %.2f, AR %.2f"), m_PosX, m_PosY, m_ZoomX, m_ZoomY, (float)vr.Width()/vr.Height());
SendStatusMessage(info, 3000);
}
- }
- else
- {
+ } else {
m_wndView.SetVideoRect();
}
@@ -9894,14 +9627,11 @@ void CMainFrame::MoveVideoWindow(bool fShowStats) void CMainFrame::HideVideoWindow(bool fHide)
{
CRect wr;
- if (m_pFullscreenWnd->IsWindow())
+ if (m_pFullscreenWnd->IsWindow()) {
m_pFullscreenWnd->GetClientRect(&wr);
- else if(!m_fFullScreen)
- {
+ } else if(!m_fFullScreen) {
m_wndView.GetClientRect(&wr);
- }
- else
- {
+ } else {
GetWindowRect(&wr);
// this code is needed to work in fullscreen on secondary monitor
@@ -9911,25 +9641,25 @@ void CMainFrame::HideVideoWindow(bool fHide) }
CRect vr = CRect(0,0,0,0);
- if(m_pCAP)
- {
- if (fHide)
- m_pCAP->SetPosition(wr, vr); //hide
- else
- m_pCAP->SetPosition(wr, wr); // show
+ if(m_pCAP) {
+ if (fHide) {
+ m_pCAP->SetPosition(wr, vr); //hide
+ } else {
+ m_pCAP->SetPosition(wr, wr); // show
+ }
}
}
void CMainFrame::ZoomVideoWindow(bool snap, double scale)
{
- if(m_iMediaLoadState != MLS_LOADED)
+ if(m_iMediaLoadState != MLS_LOADED) {
return;
+ }
AppSettings& s = AfxGetAppSettings();
- if(scale <= 0)
- {
+ if(scale <= 0) {
scale =
s.iZoomLevel == 0 ? 0.5 :
s.iZoomLevel == 1 ? 1.0 :
@@ -9938,8 +9668,7 @@ void CMainFrame::ZoomVideoWindow(bool snap, double scale) 1.0;
}
- if(m_fFullScreen)
- {
+ if(m_fFullScreen) {
OnViewFullscreen();
}
@@ -9950,8 +9679,7 @@ void CMainFrame::ZoomVideoWindow(bool snap, double scale) GetWindowRect(r);
int w = 0, h = 0;
- if(!m_fAudioOnly)
- {
+ if(!m_fAudioOnly) {
CSize arxy = GetVideoSize();
long lWidth = int(arxy.cx * scale + 0.5);
@@ -9971,24 +9699,20 @@ void CMainFrame::ZoomVideoWindow(bool snap, double scale) + r1.Height() - r2.Height()
+ lHeight;
- if ( style & WS_CAPTION )
- {
+ if ( style & WS_CAPTION ) {
h += GetSystemMetrics( SM_CYCAPTION );
// If we have a caption then we have a menu bar
h += GetSystemMetrics( SM_CYMENU );
}
- if (GetPlaybackMode() == PM_CAPTURE && !s.fHideNavigation && !m_fFullScreen && !m_wndNavigationBar.IsVisible())
- {
+ if (GetPlaybackMode() == PM_CAPTURE && !s.fHideNavigation && !m_fFullScreen && !m_wndNavigationBar.IsVisible()) {
CSize r = m_wndNavigationBar.CalcFixedLayout(FALSE, TRUE);
w += r.cx;
}
w = max(w, mmi.ptMinTrackSize.x);
h = max(h, mmi.ptMinTrackSize.y);
- }
- else
- {
+ } else {
w = r.Width(); // mmi.ptMinTrackSize.x;
h = mmi.ptMinTrackSize.y;
}
@@ -10000,8 +9724,7 @@ void CMainFrame::ZoomVideoWindow(bool snap, double scale) w = min(w, (mi.rcWork.right - mi.rcWork.left));
h = min(h, (mi.rcWork.bottom - mi.rcWork.top));
- if(!s.fRememberWindowPos)
- {
+ if(!s.fRememberWindowPos) {
bool isSnapped = false;
if(snap && s.fSnapToDesktopEdges) { // check if snapped to edges
@@ -10009,22 +9732,17 @@ void CMainFrame::ZoomVideoWindow(bool snap, double scale) || (r.right == mi.rcWork.right) || (r.bottom == mi.rcWork.bottom);
}
- if(isSnapped) // prefer left, top snap to right, bottom snap
- {
+ if(isSnapped) { // prefer left, top snap to right, bottom snap
if(r.left == mi.rcWork.left) {}
- else if(r.right == mi.rcWork.right)
- {
+ else if(r.right == mi.rcWork.right) {
r.left = r.right - w;
}
if(r.top == mi.rcWork.top) {}
- else if(r.bottom == mi.rcWork.bottom)
- {
+ else if(r.bottom == mi.rcWork.bottom) {
r.top = r.bottom - h;
}
- }
- else // center window
- {
+ } else { // center window
CPoint cp = r.CenterPoint();
r.left = cp.x - w/2;
r.top = cp.y - h/2;
@@ -10034,25 +9752,33 @@ void CMainFrame::ZoomVideoWindow(bool snap, double scale) r.right = r.left + w;
r.bottom = r.top + h;
- if(r.right > mi.rcWork.right) r.OffsetRect(mi.rcWork.right-r.right, 0);
- if(r.left < mi.rcWork.left) r.OffsetRect(mi.rcWork.left-r.left, 0);
- if(r.bottom > mi.rcWork.bottom) r.OffsetRect(0, mi.rcWork.bottom-r.bottom);
- if(r.top < mi.rcWork.top) r.OffsetRect(0, mi.rcWork.top-r.top);
+ if(r.right > mi.rcWork.right) {
+ r.OffsetRect(mi.rcWork.right-r.right, 0);
+ }
+ if(r.left < mi.rcWork.left) {
+ r.OffsetRect(mi.rcWork.left-r.left, 0);
+ }
+ if(r.bottom > mi.rcWork.bottom) {
+ r.OffsetRect(0, mi.rcWork.bottom-r.bottom);
+ }
+ if(r.top < mi.rcWork.top) {
+ r.OffsetRect(0, mi.rcWork.top-r.top);
+ }
- if((m_fFullScreen || !s.HasFixedWindowSize()) && !m_pFullscreenWnd->IsWindow())
- {
+ if((m_fFullScreen || !s.HasFixedWindowSize()) && !m_pFullscreenWnd->IsWindow()) {
MoveWindow(r);
}
-// ShowWindow(SW_SHOWNORMAL);
+ // ShowWindow(SW_SHOWNORMAL);
MoveVideoWindow();
}
double CMainFrame::GetZoomAutoFitScale()
{
- if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly)
+ if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly) {
return 1.0;
+ }
CSize arxy = GetVideoSize();
@@ -10064,67 +9790,70 @@ double CMainFrame::GetZoomAutoFitScale() void CMainFrame::RepaintVideo()
{
- if(m_pCAP)
+ if(m_pCAP) {
m_pCAP->Paint(false);
+ }
}
void CMainFrame::SetShaders()
{
- if(!m_pCAP) return;
+ if(!m_pCAP) {
+ return;
+ }
AppSettings& s = AfxGetAppSettings();
CAtlStringMap<const AppSettings::Shader*> s2s;
POSITION pos = s.m_shaders.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
const AppSettings::Shader* pShader = &s.m_shaders.GetNext(pos);
s2s[pShader->label] = pShader;
}
m_pCAP->SetPixelShader(NULL, NULL);
- if (m_pCAP2)
+ if (m_pCAP2) {
m_pCAP2->SetPixelShader2(NULL, NULL, true);
+ }
- for (int i = 0; i < 2; ++i)
- {
- if (i == 0 && m_bToggleShader)
+ for (int i = 0; i < 2; ++i) {
+ if (i == 0 && m_bToggleShader) {
continue;
- if (i == 1 && m_bToggleShaderScreenSpace)
+ }
+ if (i == 1 && m_bToggleShaderScreenSpace) {
continue;
+ }
CAtlList<CString> labels;
CAtlList<CString> *pLabels;
- if (i == 0)
+ if (i == 0) {
pLabels = &m_shaderlabels;
- else
- {
- if (!m_pCAP2)
+ } else {
+ if (!m_pCAP2) {
break;
+ }
pLabels = &m_shaderlabelsScreenSpace;
}
pos = pLabels->GetHeadPosition();
- while(pos)
- {
+ while(pos) {
const AppSettings::Shader* pShader = NULL;
- if(s2s.Lookup(pLabels->GetNext(pos), pShader))
- {
+ if(s2s.Lookup(pLabels->GetNext(pos), pShader)) {
CStringA target = pShader->target;
CStringA srcdata = pShader->srcdata;
HRESULT hr;
- if (i == 0)
+ if (i == 0) {
hr = m_pCAP->SetPixelShader(srcdata, target);
- else
+ } else {
hr = m_pCAP2->SetPixelShader2(srcdata, target, true);
+ }
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
m_pCAP->SetPixelShader(NULL, NULL);
- if (m_pCAP2)
+ if (m_pCAP2) {
m_pCAP2->SetPixelShader2(NULL, NULL, true);
+ }
SendStatusMessage(ResStr(IDS_MAINFRM_73) + pShader->label, 3000);
return;
}
@@ -10133,8 +9862,7 @@ void CMainFrame::SetShaders() }
}
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
CString str = Implode(labels, '|');
str.Replace(_T("|"), _T(", "));
SendStatusMessage(ResStr(IDS_AG_SHADER) + str, 3000);
@@ -10144,27 +9872,31 @@ void CMainFrame::SetShaders() void CMainFrame::UpdateShaders(CString label)
{
- if(!m_pCAP) return;
+ if(!m_pCAP) {
+ return;
+ }
- if(m_shaderlabels.GetCount() <= 1)
+ if(m_shaderlabels.GetCount() <= 1) {
m_shaderlabels.RemoveAll();
+ }
- if(m_shaderlabels.IsEmpty() && !label.IsEmpty())
+ if(m_shaderlabels.IsEmpty() && !label.IsEmpty()) {
m_shaderlabels.AddTail(label);
+ }
bool fUpdate = m_shaderlabels.IsEmpty();
POSITION pos = m_shaderlabels.GetHeadPosition();
- while(pos)
- {
- if(label == m_shaderlabels.GetNext(pos))
- {
+ while(pos) {
+ if(label == m_shaderlabels.GetNext(pos)) {
fUpdate = true;
break;
}
}
- if(fUpdate) SetShaders();
+ if(fUpdate) {
+ SetShaders();
+ }
}
@@ -10177,67 +9909,66 @@ void CMainFrame::SetBalance(int balance) balance = (int)((log10(1.0*balance)-2)*5000*sign);
balance = max(min(balance, 10000), -10000);
- if(m_iMediaLoadState == MLS_LOADED)
+ if(m_iMediaLoadState == MLS_LOADED) {
pBA->put_Balance(balance);
+ }
}
void CMainFrame::SetupIViAudReg()
{
- if(!AfxGetAppSettings().fAutoSpeakerConf) return;
+ if(!AfxGetAppSettings().fAutoSpeakerConf) {
+ return;
+ }
DWORD spc = 0, defchnum = 0;
- if(AfxGetAppSettings().fAutoSpeakerConf)
- {
+ if(AfxGetAppSettings().fAutoSpeakerConf) {
CComPtr<IDirectSound> pDS;
if(SUCCEEDED(DirectSoundCreate(NULL, &pDS, NULL))
- && SUCCEEDED(pDS->SetCooperativeLevel(m_hWnd, DSSCL_NORMAL)))
- {
- if(SUCCEEDED(pDS->GetSpeakerConfig(&spc)))
- {
- switch(spc)
- {
- case DSSPEAKER_DIRECTOUT:
- defchnum = 6;
- break;
- case DSSPEAKER_HEADPHONE:
- defchnum = 2;
- break;
- case DSSPEAKER_MONO:
- defchnum = 1;
- break;
- case DSSPEAKER_QUAD:
- defchnum = 4;
- break;
- default:
- case DSSPEAKER_STEREO:
- defchnum = 2;
- break;
- case DSSPEAKER_SURROUND:
- defchnum = 2;
- break;
- case DSSPEAKER_5POINT1:
- defchnum = 5;
- break;
- case DSSPEAKER_7POINT1:
- defchnum = 5;
- break;
+ && SUCCEEDED(pDS->SetCooperativeLevel(m_hWnd, DSSCL_NORMAL))) {
+ if(SUCCEEDED(pDS->GetSpeakerConfig(&spc))) {
+ switch(spc) {
+ case DSSPEAKER_DIRECTOUT:
+ defchnum = 6;
+ break;
+ case DSSPEAKER_HEADPHONE:
+ defchnum = 2;
+ break;
+ case DSSPEAKER_MONO:
+ defchnum = 1;
+ break;
+ case DSSPEAKER_QUAD:
+ defchnum = 4;
+ break;
+ default:
+ case DSSPEAKER_STEREO:
+ defchnum = 2;
+ break;
+ case DSSPEAKER_SURROUND:
+ defchnum = 2;
+ break;
+ case DSSPEAKER_5POINT1:
+ defchnum = 5;
+ break;
+ case DSSPEAKER_7POINT1:
+ defchnum = 5;
+ break;
}
}
}
- }
- else
- {
+ } else {
defchnum = 2;
}
CRegKey iviaud;
- if(ERROR_SUCCESS == iviaud.Create(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\InterVideo\\Common\\AudioDec")))
- {
+ if(ERROR_SUCCESS == iviaud.Create(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\InterVideo\\Common\\AudioDec"))) {
DWORD chnum = 0;
- if(FAILED(iviaud.QueryDWORDValue(_T("AUDIO"), chnum))) chnum = 0;
- if(chnum <= defchnum) // check if the user has already set it..., but we won't skip if it's lower than sensible :P
+ if(FAILED(iviaud.QueryDWORDValue(_T("AUDIO"), chnum))) {
+ chnum = 0;
+ }
+ if(chnum <= defchnum) { // check if the user has already set it..., but we won't skip if it's lower than sensible :P
iviaud.SetDWORDValue(_T("AUDIO"), defchnum);
+ }
}
}
@@ -10248,11 +9979,11 @@ void CMainFrame::SetupIViAudReg() bool CMainFrame::IsRealEngineCompatible(CString strFilename) const
{
// Real Media engine didn't support Unicode filename (nor filenames with # characters)
- for(int i=0; i<strFilename.GetLength(); i++)
- {
+ for(int i=0; i<strFilename.GetLength(); i++) {
WCHAR Char = strFilename[i];
- if (Char<32 || Char>126 || Char==35)
+ if (Char<32 || Char>126 || Char==35) {
return false;
+ }
}
return true;
}
@@ -10272,122 +10003,106 @@ void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD) ((s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) ||
(s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM) ||
(s.iDSVideoRendererType == VIDRNDT_DS_MADVR) ||
- (s.iDSVideoRendererType == VIDRNDT_DS_SYNC)))
- {
+ (s.iDSVideoRendererType == VIDRNDT_DS_SYNC))) {
CreateFullScreenWindow();
m_pVideoWnd = m_pFullscreenWnd;
- }
- else
- {
+ } else {
m_pVideoWnd = &m_wndView;
}
- if(OpenFileData* p = dynamic_cast<OpenFileData*>(pOMD))
- {
+ if(OpenFileData* p = dynamic_cast<OpenFileData*>(pOMD)) {
engine_t engine = s.m_Formats.GetEngine(p->fns.GetHead());
CStringA ct = GetContentType(p->fns.GetHead());
- if(ct == "video/x-ms-asf")
- {
+ if(ct == "video/x-ms-asf") {
// TODO: put something here to make the windows media source filter load later
- }
- else if(ct == "audio/x-pn-realaudio"
- || ct == "audio/x-pn-realaudio-plugin"
- || ct == "audio/x-realaudio-secure"
- || ct == "video/vnd.rn-realvideo-secure"
- || ct == "application/vnd.rn-realmedia"
- || ct.Find("vnd.rn-") >= 0
- || ct.Find("realaudio") >= 0
- || ct.Find("realvideo") >= 0)
- {
+ } else if(ct == "audio/x-pn-realaudio"
+ || ct == "audio/x-pn-realaudio-plugin"
+ || ct == "audio/x-realaudio-secure"
+ || ct == "video/vnd.rn-realvideo-secure"
+ || ct == "application/vnd.rn-realmedia"
+ || ct.Find("vnd.rn-") >= 0
+ || ct.Find("realaudio") >= 0
+ || ct.Find("realvideo") >= 0) {
engine = RealMedia;
- }
- else if(ct == "application/x-shockwave-flash")
- {
+ } else if(ct == "application/x-shockwave-flash") {
engine = ShockWave;
- }
- else if(ct == "video/quicktime"
- || ct == "application/x-quicktimeplayer")
- {
+ } else if(ct == "video/quicktime"
+ || ct == "application/x-quicktimeplayer") {
engine = QuickTime;
}
HRESULT hr = E_FAIL;
CComPtr<IUnknown> pUnk;
- if(engine == RealMedia)
- {
+ if(engine == RealMedia) {
// TODO : see why Real SDK crash here ...
//if (!IsRealEngineCompatible(p->fns.GetHead()))
// throw ResStr(IDS_REALVIDEO_INCOMPATIBLE);
pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CRealMediaGraph(m_pVideoWnd->m_hWnd, hr);
- if(!pUnk)
+ if(!pUnk) {
throw ResStr(IDS_AG_OUT_OF_MEMORY);
+ }
- if(SUCCEEDED(hr))
- {
+ if(SUCCEEDED(hr)) {
pGB = CComQIPtr<IGraphBuilder>(pUnk);
- if(pGB)
+ if(pGB) {
m_fRealMediaGraph = true;
+ }
}
- }
- else if(engine == ShockWave)
- {
+ } else if(engine == ShockWave) {
#ifdef _WIN64 // No flash on x64
MessageBox(ResStr(IDS_MAINFRM_76), _T(""), MB_OK);
#else
pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CShockwaveGraph(m_pVideoWnd->m_hWnd, hr);
- if(!pUnk)
+ if(!pUnk) {
throw ResStr(IDS_AG_OUT_OF_MEMORY);
+ }
- if(SUCCEEDED(hr))
+ if(SUCCEEDED(hr)) {
pGB = CComQIPtr<IGraphBuilder>(pUnk);
- if(FAILED(hr) || !pGB)
+ }
+ if(FAILED(hr) || !pGB) {
throw ResStr(IDS_MAINFRM_77);
+ }
m_fShockwaveGraph = true;
#endif
- }
- else if(engine == QuickTime)
- {
+ } else if(engine == QuickTime) {
#ifdef _WIN64 // TODOX64
// MessageBox (ResStr(IDS_MAINFRM_78), _T(""), MB_OK);
#else
pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CQuicktimeGraph(m_pVideoWnd->m_hWnd, hr);
- if(!pUnk)
+ if(!pUnk) {
throw ResStr(IDS_AG_OUT_OF_MEMORY);
+ }
- if(SUCCEEDED(hr))
- {
+ if(SUCCEEDED(hr)) {
pGB = CComQIPtr<IGraphBuilder>(pUnk);
- if(pGB)
+ if(pGB) {
m_fQuicktimeGraph = true;
+ }
}
#endif
}
m_fCustomGraph = m_fRealMediaGraph || m_fShockwaveGraph || m_fQuicktimeGraph;
- if(!m_fCustomGraph)
- {
+ if(!m_fCustomGraph) {
pGB = DNew CFGManagerPlayer(_T("CFGManagerPlayer"), NULL, m_pVideoWnd->m_hWnd);
}
- }
- else if(OpenDVDData* p = dynamic_cast<OpenDVDData*>(pOMD))
- {
+ } else if(OpenDVDData* p = dynamic_cast<OpenDVDData*>(pOMD)) {
pGB = DNew CFGManagerDVD(_T("CFGManagerDVD"), NULL, m_pVideoWnd->m_hWnd);
- }
- else if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD))
- {
- if (s.iDefaultCaptureDevice == 1)
+ } else if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD)) {
+ if (s.iDefaultCaptureDevice == 1) {
pGB = DNew CFGManagerBDA(_T("CFGManagerBDA"), NULL, m_pVideoWnd->m_hWnd);
- else
+ } else {
pGB = DNew CFGManagerCapture(_T("CFGManagerCapture"), NULL, m_pVideoWnd->m_hWnd);
+ }
}
- if(!pGB)
- {
+ if(!pGB) {
throw ResStr(IDS_MAINFRM_80);
}
@@ -10403,20 +10118,19 @@ void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD) if(!(pMC && pME && pMS)
|| !(pVW && pBV)
- || !(pBA))
- {
+ || !(pBA)) {
throw _T("Failed to query the needed interfaces for playback");
}
- if(FAILED(pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0)))
- {
+ if(FAILED(pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0))) {
throw _T("Could not set target window for graph notification");
}
m_pProv = (IUnknown*)DNew CKeyProvider();
- if(CComQIPtr<IObjectWithSite> pObjectWithSite = pGB)
+ if(CComQIPtr<IObjectWithSite> pObjectWithSite = pGB) {
pObjectWithSite->SetSite(m_pProv);
+ }
m_pCB = DNew CDSMChapterBag(NULL, NULL);
}
@@ -10425,95 +10139,95 @@ CWnd *CMainFrame::GetModalParent() {
AppSettings& s = AfxGetAppSettings();
CWnd *pParentWnd = this;
- if (m_pFullscreenWnd->IsWindow() && s.m_RenderersSettings.m_RenderSettings.iVMR9FullscreenGUISupport)
+ if (m_pFullscreenWnd->IsWindow() && s.m_RenderersSettings.m_RenderSettings.iVMR9FullscreenGUISupport) {
pParentWnd = m_pFullscreenWnd;
+ }
return pParentWnd;
}
void CMainFrame::OpenFile(OpenFileData* pOFD)
{
- if(pOFD->fns.IsEmpty())
+ if(pOFD->fns.IsEmpty()) {
throw ResStr(IDS_MAINFRM_81);
+ }
AppSettings& s = AfxGetAppSettings();
bool fFirst = true;
POSITION pos = pOFD->fns.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CString fn = pOFD->fns.GetNext(pos);
fn.Trim();
- if(fn.IsEmpty() && !fFirst)
+ if(fn.IsEmpty() && !fFirst) {
break;
+ }
HRESULT hr = pGB->RenderFile(CStringW(fn), NULL);
- if (!s.NewFile (fn) && s.fRememberFilePos)
- {
+ if (!s.NewFile (fn) && s.fRememberFilePos) {
REFERENCE_TIME rtPos = s.CurrentFilePosition()->llPosition;
- if (pMS) pMS->SetPositions (&rtPos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+ if (pMS) {
+ pMS->SetPositions (&rtPos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+ }
}
QueryPerformanceCounter(&m_LastSaveTime);
- if(FAILED(hr))
- {
- if(fFirst)
- {
- if(s.fReportFailedPins)
- {
+ if(FAILED(hr)) {
+ if(fFirst) {
+ if(s.fReportFailedPins) {
CComQIPtr<IGraphBuilderDeadEnd> pGBDE = pGB;
- if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, GetModalParent()).DoModal();
+ if(pGBDE && pGBDE->GetCount()) {
+ CMediaTypesDlg(pGBDE, GetModalParent()).DoModal();
+ }
}
CString err;
- switch(hr)
- {
- case E_ABORT:
- err = ResStr(IDS_MAINFRM_82);
- break;
- case E_FAIL:
- case E_POINTER:
- default:
- err = ResStr(IDS_MAINFRM_83);
- break;
- case E_INVALIDARG:
- err = ResStr(IDS_MAINFRM_84);
- break;
- case E_OUTOFMEMORY:
- err = ResStr(IDS_AG_OUT_OF_MEMORY);
- break;
- case VFW_E_CANNOT_CONNECT:
- err = ResStr(IDS_MAINFRM_86);
- break;
- case VFW_E_CANNOT_LOAD_SOURCE_FILTER:
- err = ResStr(IDS_MAINFRM_87);
- break;
- case VFW_E_CANNOT_RENDER:
- err = ResStr(IDS_MAINFRM_88);
- break;
- case VFW_E_INVALID_FILE_FORMAT:
- err = ResStr(IDS_MAINFRM_89);
- break;
- case VFW_E_NOT_FOUND:
- err = ResStr(IDS_MAINFRM_90);
- break;
- case VFW_E_UNKNOWN_FILE_TYPE:
- err = ResStr(IDS_MAINFRM_91);
- break;
- case VFW_E_UNSUPPORTED_STREAM:
- err = ResStr(IDS_MAINFRM_92);
- break;
+ switch(hr) {
+ case E_ABORT:
+ err = ResStr(IDS_MAINFRM_82);
+ break;
+ case E_FAIL:
+ case E_POINTER:
+ default:
+ err = ResStr(IDS_MAINFRM_83);
+ break;
+ case E_INVALIDARG:
+ err = ResStr(IDS_MAINFRM_84);
+ break;
+ case E_OUTOFMEMORY:
+ err = ResStr(IDS_AG_OUT_OF_MEMORY);
+ break;
+ case VFW_E_CANNOT_CONNECT:
+ err = ResStr(IDS_MAINFRM_86);
+ break;
+ case VFW_E_CANNOT_LOAD_SOURCE_FILTER:
+ err = ResStr(IDS_MAINFRM_87);
+ break;
+ case VFW_E_CANNOT_RENDER:
+ err = ResStr(IDS_MAINFRM_88);
+ break;
+ case VFW_E_INVALID_FILE_FORMAT:
+ err = ResStr(IDS_MAINFRM_89);
+ break;
+ case VFW_E_NOT_FOUND:
+ err = ResStr(IDS_MAINFRM_90);
+ break;
+ case VFW_E_UNKNOWN_FILE_TYPE:
+ err = ResStr(IDS_MAINFRM_91);
+ break;
+ case VFW_E_UNSUPPORTED_STREAM:
+ err = ResStr(IDS_MAINFRM_92);
+ break;
}
throw err;
}
}
- if(s.fKeepHistory)
- {
+ if(s.fKeepHistory) {
CRecentFileList* pMRU = fFirst ? &s.MRU : &s.MRUDub;
pMRU->ReadList();
pMRU->Add(fn);
@@ -10521,44 +10235,50 @@ void CMainFrame::OpenFile(OpenFileData* pOFD) SHAddToRecentDocs(SHARD_PATH, fn);
}
- if(fFirst)
- {
+ if(fFirst) {
pOFD->title = fn;
}
fFirst = false;
- if(m_fCustomGraph) break;
+ if(m_fCustomGraph) {
+ break;
+ }
}
- if(s.fReportFailedPins)
- {
+ if(s.fReportFailedPins) {
CComQIPtr<IGraphBuilderDeadEnd> pGBDE = pGB;
- if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, GetModalParent()).DoModal();
+ if(pGBDE && pGBDE->GetCount()) {
+ CMediaTypesDlg(pGBDE, GetModalParent()).DoModal();
+ }
}
- if(!(pAMOP = pGB))
- {
+ if(!(pAMOP = pGB)) {
BeginEnumFilters(pGB, pEF, pBF)
- if(pAMOP = pBF) break;
+ if(pAMOP = pBF) {
+ break;
+ }
EndEnumFilters;
}
- if(FindFilter(__uuidof(CShoutcastSource), pGB))
+ if(FindFilter(__uuidof(CShoutcastSource), pGB)) {
m_fUpdateInfoBar = true;
+ }
SetupChapters();
CComQIPtr<IKeyFrameInfo> pKFI;
BeginEnumFilters(pGB, pEF, pBF)
- if(pKFI = pBF) break;
+ if(pKFI = pBF) {
+ break;
+ }
EndEnumFilters;
UINT nKFs = 0, nKFsTmp = 0;
- if(pKFI && S_OK == pKFI->GetKeyFrameCount(nKFs) && nKFs > 0)
- {
+ if(pKFI && S_OK == pKFI->GetKeyFrameCount(nKFs) && nKFs > 0) {
m_kfs.SetCount(nKFsTmp = nKFs);
- if(S_OK != pKFI->GetKeyFrames(&TIME_FORMAT_MEDIA_TIME, m_kfs.GetData(), nKFsTmp) || nKFsTmp != nKFs)
+ if(S_OK != pKFI->GetKeyFrames(&TIME_FORMAT_MEDIA_TIME, m_kfs.GetData(), nKFsTmp) || nKFsTmp != nKFs) {
m_kfs.RemoveAll();
+ }
}
SetPlaybackMode(PM_FILE);
@@ -10578,43 +10298,45 @@ void CMainFrame::SetupChapters() POSITION pos;
pos = pBFs.GetHeadPosition();
- while(pos && !m_pCB->ChapGetCount())
- {
+ while(pos && !m_pCB->ChapGetCount()) {
IBaseFilter* pBF = pBFs.GetNext(pos);
CComQIPtr<IDSMChapterBag> pCB = pBF;
- if(!pCB) continue;
+ if(!pCB) {
+ continue;
+ }
- for(DWORD i = 0, cnt = pCB->ChapGetCount(); i < cnt; i++)
- {
+ for(DWORD i = 0, cnt = pCB->ChapGetCount(); i < cnt; i++) {
REFERENCE_TIME rt;
CComBSTR name;
- if(SUCCEEDED(pCB->ChapGet(i, &rt, &name)))
+ if(SUCCEEDED(pCB->ChapGet(i, &rt, &name))) {
m_pCB->ChapAppend(rt, name);
+ }
}
}
pos = pBFs.GetHeadPosition();
- while(pos && !m_pCB->ChapGetCount())
- {
+ while(pos && !m_pCB->ChapGetCount()) {
IBaseFilter* pBF = pBFs.GetNext(pos);
CComQIPtr<IChapterInfo> pCI = pBF;
- if(!pCI) continue;
+ if(!pCI) {
+ continue;
+ }
CHAR iso6391[3];
::GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, iso6391, 3);
CStringA iso6392 = ISO6391To6392(iso6391);
- if(iso6392.GetLength() < 3) iso6392 = "eng";
+ if(iso6392.GetLength() < 3) {
+ iso6392 = "eng";
+ }
UINT cnt = pCI->GetChapterCount(CHAPTER_ROOT_ID);
- for(UINT i = 1; i <= cnt; i++)
- {
+ for(UINT i = 1; i <= cnt; i++) {
UINT cid = pCI->GetChapterId(CHAPTER_ROOT_ID, i);
ChapterElement ce;
- if(pCI->GetChapterInfo(cid, &ce))
- {
+ if(pCI->GetChapterInfo(cid, &ce)) {
char pl[3] = {iso6392[0], iso6392[1], iso6392[2]};
char cc[] = " ";
CComBSTR name;
@@ -10625,27 +10347,26 @@ void CMainFrame::SetupChapters() }
pos = pBFs.GetHeadPosition();
- while(pos && !m_pCB->ChapGetCount())
- {
+ while(pos && !m_pCB->ChapGetCount()) {
IBaseFilter* pBF = pBFs.GetNext(pos);
CComQIPtr<IAMExtendedSeeking, &IID_IAMExtendedSeeking> pES = pBF;
- if(!pES) continue;
+ if(!pES) {
+ continue;
+ }
long MarkerCount = 0;
- if(SUCCEEDED(pES->get_MarkerCount(&MarkerCount)))
- {
- for(long i = 1; i <= MarkerCount; i++)
- {
+ if(SUCCEEDED(pES->get_MarkerCount(&MarkerCount))) {
+ for(long i = 1; i <= MarkerCount; i++) {
double MarkerTime = 0;
- if(SUCCEEDED(pES->GetMarkerTime(i, &MarkerTime)))
- {
+ if(SUCCEEDED(pES->GetMarkerTime(i, &MarkerTime))) {
CStringW name;
name.Format(L"Chapter %d", i);
CComBSTR bstr;
- if(S_OK == pES->GetMarkerName(i, &bstr))
+ if(S_OK == pES->GetMarkerName(i, &bstr)) {
name = bstr;
+ }
m_pCB->ChapAppend(REFERENCE_TIME(MarkerTime*10000000), name);
}
@@ -10654,40 +10375,42 @@ void CMainFrame::SetupChapters() }
pos = pBFs.GetHeadPosition();
- while(pos && !m_pCB->ChapGetCount())
- {
+ while(pos && !m_pCB->ChapGetCount()) {
IBaseFilter* pBF = pBFs.GetNext(pos);
- if(GetCLSID(pBF) != CLSID_OggSplitter)
+ if(GetCLSID(pBF) != CLSID_OggSplitter) {
continue;
+ }
- BeginEnumPins(pBF, pEP, pPin)
- {
- if(m_pCB->ChapGetCount()) break;
+ BeginEnumPins(pBF, pEP, pPin) {
+ if(m_pCB->ChapGetCount()) {
+ break;
+ }
- if(CComQIPtr<IPropertyBag> pPB = pPin)
- {
- for(int i = 1; ; i++)
- {
+ if(CComQIPtr<IPropertyBag> pPB = pPin) {
+ for(int i = 1; ; i++) {
CStringW str;
CComVariant var;
var.Clear();
str.Format(L"CHAPTER%02d", i);
- if(S_OK != pPB->Read(str, &var, NULL))
+ if(S_OK != pPB->Read(str, &var, NULL)) {
break;
+ }
int h, m, s, ms;
WCHAR wc;
- if(7 != swscanf_s(CStringW(var), L"%d%c%d%c%d%c%d", &h, &wc, &m, &wc, &s, &wc, &ms))
+ if(7 != swscanf_s(CStringW(var), L"%d%c%d%c%d%c%d", &h, &wc, &m, &wc, &s, &wc, &ms)) {
break;
+ }
CStringW name;
name.Format(L"Chapter %d", i);
var.Clear();
str += L"NAME";
- if(S_OK == pPB->Read(str, &var, NULL))
+ if(S_OK == pPB->Read(str, &var, NULL)) {
name = var;
+ }
m_pCB->ChapAppend(10000i64*(((h*60 + m)*60 + s)*1000 + ms), name);
}
@@ -10705,44 +10428,53 @@ void CMainFrame::OpenDVD(OpenDVDData* pODD) AppSettings& s = AfxGetAppSettings();
- if(s.fReportFailedPins)
- {
+ if(s.fReportFailedPins) {
CComQIPtr<IGraphBuilderDeadEnd> pGBDE = pGB;
- if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, GetModalParent()).DoModal();
+ if(pGBDE && pGBDE->GetCount()) {
+ CMediaTypesDlg(pGBDE, GetModalParent()).DoModal();
+ }
}
- BeginEnumFilters(pGB, pEF, pBF)
- {
- if((pDVDC = pBF) && (pDVDI = pBF))
+ BeginEnumFilters(pGB, pEF, pBF) {
+ if((pDVDC = pBF) && (pDVDI = pBF)) {
break;
+ }
}
EndEnumFilters;
- if(hr == E_INVALIDARG)
+ if(hr == E_INVALIDARG) {
throw ResStr(IDS_MAINFRM_93);
- else if(hr == VFW_E_CANNOT_RENDER)
+ } else if(hr == VFW_E_CANNOT_RENDER) {
throw _T("Failed to render all pins of the DVD Navigator filter");
- else if(hr == VFW_S_PARTIAL_RENDER)
+ } else if(hr == VFW_S_PARTIAL_RENDER) {
throw _T("Failed to render some of the pins of the DVD Navigator filter");
- else if(hr == E_NOINTERFACE || !pDVDC || !pDVDI)
+ } else if(hr == E_NOINTERFACE || !pDVDC || !pDVDI) {
throw _T("Failed to query the needed interfaces for DVD playback");
- else if(hr == VFW_E_CANNOT_LOAD_SOURCE_FILTER)
+ } else if(hr == VFW_E_CANNOT_LOAD_SOURCE_FILTER) {
throw ResStr(IDS_MAINFRM_94);
- else if(FAILED(hr))
+ } else if(FAILED(hr)) {
throw ResStr(IDS_AG_FAILED);
+ }
WCHAR buff[_MAX_PATH];
ULONG len = 0;
- if(SUCCEEDED(hr = pDVDI->GetDVDDirectory(buff, countof(buff), &len)))
+ if(SUCCEEDED(hr = pDVDI->GetDVDDirectory(buff, countof(buff), &len))) {
pODD->title = CString(CStringW(buff));
+ }
// TODO: resetdvd
pDVDC->SetOption(DVD_ResetOnStop, FALSE);
pDVDC->SetOption(DVD_HMSF_TimeCodeEvents, TRUE);
- if(s.idMenuLang) pDVDC->SelectDefaultMenuLanguage(s.idMenuLang);
- if(s.idAudioLang) pDVDC->SelectDefaultAudioLanguage(s.idAudioLang, DVD_AUD_EXT_NotSpecified);
- if(s.idSubtitlesLang) pDVDC->SelectDefaultSubpictureLanguage(s.idSubtitlesLang, DVD_SP_EXT_NotSpecified);
+ if(s.idMenuLang) {
+ pDVDC->SelectDefaultMenuLanguage(s.idMenuLang);
+ }
+ if(s.idAudioLang) {
+ pDVDC->SelectDefaultAudioLanguage(s.idAudioLang, DVD_AUD_EXT_NotSpecified);
+ }
+ if(s.idSubtitlesLang) {
+ pDVDC->SelectDefaultSubpictureLanguage(s.idSubtitlesLang, DVD_SP_EXT_NotSpecified);
+ }
m_iDVDDomain = DVD_DOMAIN_Stop;
@@ -10752,8 +10484,7 @@ void CMainFrame::OpenDVD(OpenDVDData* pODD) HRESULT CMainFrame::OpenBDAGraph()
{
HRESULT hr = pGB->RenderFile (L"",L"");
- if (!FAILED(hr))
- {
+ if (!FAILED(hr)) {
AddTextPassThruFilter();
SetPlaybackMode(PM_CAPTURE);
}
@@ -10767,22 +10498,21 @@ void CMainFrame::OpenCapture(OpenDeviceData* pODD) m_VidDispName = pODD->DisplayName[0];
- if(!m_VidDispName.IsEmpty())
- {
- if(!CreateFilter(m_VidDispName, &pVidCapTmp, vidfrname))
+ if(!m_VidDispName.IsEmpty()) {
+ if(!CreateFilter(m_VidDispName, &pVidCapTmp, vidfrname)) {
throw ResStr(IDS_MAINFRM_96);
+ }
}
m_AudDispName = pODD->DisplayName[1];
- if(!m_AudDispName.IsEmpty())
- {
- if(!CreateFilter(m_AudDispName, &pAudCapTmp, audfrname))
+ if(!m_AudDispName.IsEmpty()) {
+ if(!CreateFilter(m_AudDispName, &pAudCapTmp, audfrname)) {
throw ResStr(IDS_MAINFRM_96);
+ }
}
- if(!pVidCapTmp && !pAudCapTmp)
- {
+ if(!pVidCapTmp && !pAudCapTmp) {
throw ResStr(IDS_MAINFRM_98);
}
@@ -10790,8 +10520,7 @@ void CMainFrame::OpenCapture(OpenDeviceData* pODD) pVidCap = NULL;
pAudCap = NULL;
- if(FAILED(pCGB.CoCreateInstance(CLSID_CaptureGraphBuilder2)))
- {
+ if(FAILED(pCGB.CoCreateInstance(CLSID_CaptureGraphBuilder2))) {
throw ResStr(IDS_MAINFRM_99);
}
@@ -10799,49 +10528,47 @@ void CMainFrame::OpenCapture(OpenDeviceData* pODD) pCGB->SetFiltergraph(pGB);
- if(pVidCapTmp)
- {
- if(FAILED(hr = pGB->AddFilter(pVidCapTmp, vidfrname)))
- {
+ if(pVidCapTmp) {
+ if(FAILED(hr = pGB->AddFilter(pVidCapTmp, vidfrname))) {
throw _T("Can't add video capture filter to the graph");
}
pVidCap = pVidCapTmp;
- if(!pAudCapTmp)
- {
+ if(!pAudCapTmp) {
if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap))
- && FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap)))
+ && FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap))) {
TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture"));
+ }
if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Interleaved, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCPrev))
- && FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCPrev)))
+ && FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCPrev))) {
TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture"));
+ }
if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, pVidCap, IID_IAMStreamConfig, (void **)&pAMASC))
- && FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Audio, pVidCap, IID_IAMStreamConfig, (void **)&pAMASC)))
- {
+ && FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Audio, pVidCap, IID_IAMStreamConfig, (void **)&pAMASC))) {
TRACE(_T("Warning: No IAMStreamConfig interface for vidcap"));
- }
- else
- {
+ } else {
pAudCap = pVidCap;
}
- }
- else
- {
- if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap)))
+ } else {
+ if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap))) {
TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture"));
+ }
- if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCPrev)))
+ if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCPrev))) {
TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture"));
+ }
}
- if(FAILED(pCGB->FindInterface(&LOOK_UPSTREAM_ONLY, NULL, pVidCap, IID_IAMCrossbar, (void**)&pAMXBar)))
+ if(FAILED(pCGB->FindInterface(&LOOK_UPSTREAM_ONLY, NULL, pVidCap, IID_IAMCrossbar, (void**)&pAMXBar))) {
TRACE(_T("Warning: No IAMCrossbar interface was found\n"));
+ }
- if(FAILED(pCGB->FindInterface(&LOOK_UPSTREAM_ONLY, NULL, pVidCap, IID_IAMTVTuner, (void**)&pAMTuner)))
+ if(FAILED(pCGB->FindInterface(&LOOK_UPSTREAM_ONLY, NULL, pVidCap, IID_IAMTVTuner, (void**)&pAMTuner))) {
TRACE(_T("Warning: No IAMTVTuner interface was found\n"));
+ }
/*
if(pAMVSCCap)
{
@@ -10859,35 +10586,36 @@ void CMainFrame::OpenCapture(OpenDeviceData* pODD) */
// TODO: init pAMXBar
- if(pAMTuner) // load saved channel
- {
+ if(pAMTuner) { // load saved channel
pAMTuner->put_CountryCode(AfxGetApp()->GetProfileInt(_T("Capture"), _T("Country"), 1));
int vchannel = pODD->vchannel;
- if(vchannel < 0) vchannel = AfxGetApp()->GetProfileInt(_T("Capture\\") + CString(m_VidDispName), _T("Channel"), -1);
- if(vchannel >= 0)
- {
+ if(vchannel < 0) {
+ vchannel = AfxGetApp()->GetProfileInt(_T("Capture\\") + CString(m_VidDispName), _T("Channel"), -1);
+ }
+ if(vchannel >= 0) {
OAFilterState fs = State_Stopped;
pMC->GetState(0, &fs);
- if(fs == State_Running) pMC->Pause();
+ if(fs == State_Running) {
+ pMC->Pause();
+ }
pAMTuner->put_Channel(vchannel, AMTUNER_SUBCHAN_DEFAULT, AMTUNER_SUBCHAN_DEFAULT);
- if(fs == State_Running) pMC->Run();
+ if(fs == State_Running) {
+ pMC->Run();
+ }
}
}
}
- if(pAudCapTmp)
- {
- if(FAILED(hr = pGB->AddFilter(pAudCapTmp, CStringW(audfrname))))
- {
+ if(pAudCapTmp) {
+ if(FAILED(hr = pGB->AddFilter(pAudCapTmp, CStringW(audfrname)))) {
throw _T("Can't add audio capture filter to the graph");
}
pAudCap = pAudCapTmp;
if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, pAudCap, IID_IAMStreamConfig, (void **)&pAMASC))
- && FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Audio, pAudCap, IID_IAMStreamConfig, (void **)&pAMASC)))
- {
+ && FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Audio, pAudCap, IID_IAMStreamConfig, (void **)&pAMASC))) {
TRACE(_T("Warning: No IAMStreamConfig interface for vidcap"));
}
/*
@@ -10911,8 +10639,7 @@ void CMainFrame::OpenCapture(OpenDeviceData* pODD) */
}
- if(!(pVidCap || pAudCap))
- {
+ if(!(pVidCap || pAudCap)) {
throw ResStr(IDS_MAINFRM_108);
}
@@ -10923,21 +10650,21 @@ void CMainFrame::OpenCapture(OpenDeviceData* pODD) void CMainFrame::OpenCustomizeGraph()
{
- if(GetPlaybackMode() == PM_CAPTURE)
+ if(GetPlaybackMode() == PM_CAPTURE) {
return;
+ }
CleanGraph();
- if(GetPlaybackMode() == PM_FILE)
- {
- if(m_pCAP && AfxGetAppSettings().fAutoloadSubtitles)
+ if(GetPlaybackMode() == PM_FILE) {
+ if(m_pCAP && AfxGetAppSettings().fAutoloadSubtitles) {
AddTextPassThruFilter();
+ }
}
AppSettings& s = AfxGetAppSettings();
CRenderersSettings& r = s.m_RenderersSettings;
- if (r.m_RenderSettings.bSynchronizeVideo && s.iDSVideoRendererType == VIDRNDT_DS_SYNC)
- {
+ if (r.m_RenderSettings.bSynchronizeVideo && s.iDSVideoRendererType == VIDRNDT_DS_SYNC) {
HRESULT hr;
m_pRefClock = DNew CSyncClockFilter(NULL, &hr);
CStringW name;
@@ -10955,70 +10682,73 @@ void CMainFrame::OpenCustomizeGraph() m_pRefClock->QueryInterface(IID_ISyncClock, reinterpret_cast<void**>(&m_pSyncClock));
CComQIPtr<ISyncClockAdviser> pAdviser = m_pCAP;
- if (pAdviser)
+ if (pAdviser) {
pAdviser->AdviseSyncClock(m_pSyncClock);
+ }
}
- if(GetPlaybackMode() == PM_DVD)
- {
- BeginEnumFilters(pGB, pEF, pBF)
- {
- if(CComQIPtr<IDirectVobSub2> pDVS2 = pBF)
- {
-// pDVS2->AdviseSubClock(m_pSubClock = DNew CSubClock);
-// break;
+ if(GetPlaybackMode() == PM_DVD) {
+ BeginEnumFilters(pGB, pEF, pBF) {
+ if(CComQIPtr<IDirectVobSub2> pDVS2 = pBF) {
+ // pDVS2->AdviseSubClock(m_pSubClock = DNew CSubClock);
+ // break;
// TODO: test multiple dvobsub instances with one clock
- if(!m_pSubClock) m_pSubClock = DNew CSubClock;
+ if(!m_pSubClock) {
+ m_pSubClock = DNew CSubClock;
+ }
pDVS2->AdviseSubClock(m_pSubClock);
}
}
EndEnumFilters;
}
- BeginEnumFilters(pGB, pEF, pBF)
- {
- if(GetCLSID(pBF) == CLSID_OggSplitter)
- {
- if(CComQIPtr<IAMStreamSelect> pSS = pBF)
- {
+ BeginEnumFilters(pGB, pEF, pBF) {
+ if(GetCLSID(pBF) == CLSID_OggSplitter) {
+ if(CComQIPtr<IAMStreamSelect> pSS = pBF) {
LCID idAudio = s.idAudioLang;
- if(!idAudio) idAudio = GetUserDefaultLCID();
+ if(!idAudio) {
+ idAudio = GetUserDefaultLCID();
+ }
LCID idSub = s.idSubtitlesLang;
- if(!idSub) idSub = GetUserDefaultLCID();
+ if(!idSub) {
+ idSub = GetUserDefaultLCID();
+ }
DWORD cnt = 0;
pSS->Count(&cnt);
- for(DWORD i = 0; i < cnt; i++)
- {
+ for(DWORD i = 0; i < cnt; i++) {
AM_MEDIA_TYPE* pmt = NULL;
DWORD dwFlags = 0;
LCID lcid = 0;
DWORD dwGroup = 0;
WCHAR* pszName = NULL;
- if(SUCCEEDED(pSS->Info((long)i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)))
- {
+ if(SUCCEEDED(pSS->Info((long)i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))) {
CStringW name(pszName), sound(ResStr(IDS_AG_SOUND)), subtitle(L"Subtitle");
if(idAudio != (LCID)-1 && (idAudio&0x3ff) == (lcid&0x3ff) // sublang seems to be zeroed out in ogm...
&& name.GetLength() > sound.GetLength()
- && !name.Left(sound.GetLength()).CompareNoCase(sound))
- {
- if(SUCCEEDED(pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE)))
+ && !name.Left(sound.GetLength()).CompareNoCase(sound)) {
+ if(SUCCEEDED(pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE))) {
idAudio = (LCID)-1;
+ }
}
if(idSub != (LCID)-1 && (idSub&0x3ff) == (lcid&0x3ff) // sublang seems to be zeroed out in ogm...
&& name.GetLength() > subtitle.GetLength()
&& !name.Left(subtitle.GetLength()).CompareNoCase(subtitle)
- && name.Mid(subtitle.GetLength()).Trim().CompareNoCase(L"off"))
- {
- if(SUCCEEDED(pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE)))
+ && name.Mid(subtitle.GetLength()).Trim().CompareNoCase(L"off")) {
+ if(SUCCEEDED(pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE))) {
idSub = (LCID)-1;
+ }
}
- if(pmt) DeleteMediaType(pmt);
- if(pszName) CoTaskMemFree(pszName);
+ if(pmt) {
+ DeleteMediaType(pmt);
+ }
+ if(pszName) {
+ CoTaskMemFree(pszName);
+ }
}
}
}
@@ -11033,49 +10763,39 @@ void CMainFrame::OpenSetupVideo() {
m_fAudioOnly = true;
- if (m_pMFVDC) // EVR
- {
+ if (m_pMFVDC) { // EVR
m_fAudioOnly = false;
- }
- else if(m_pCAP)
- {
+ } else if(m_pCAP) {
CSize vs = m_pCAP->GetVideoSize();
m_fAudioOnly = (vs.cx <= 0 || vs.cy <= 0);
- }
- else
- {
+ } else {
{
long w = 0, h = 0;
- if(CComQIPtr<IBasicVideo> pBV = pGB)
- {
+ if(CComQIPtr<IBasicVideo> pBV = pGB) {
pBV->GetVideoSize(&w, &h);
}
- if(w > 0 && h > 0)
- {
+ if(w > 0 && h > 0) {
m_fAudioOnly = false;
}
}
- if(m_fAudioOnly)
- {
- BeginEnumFilters(pGB, pEF, pBF)
- {
+ if(m_fAudioOnly) {
+ BeginEnumFilters(pGB, pEF, pBF) {
long w = 0, h = 0;
- if(CComQIPtr<IVideoWindow> pVW = pBF)
- {
+ if(CComQIPtr<IVideoWindow> pVW = pBF) {
long lVisible;
- if(FAILED(pVW->get_Visible(&lVisible)))
+ if(FAILED(pVW->get_Visible(&lVisible))) {
continue;
+ }
pVW->get_Width(&w);
pVW->get_Height(&h);
}
- if(w > 0 && h > 0)
- {
+ if(w > 0 && h > 0) {
m_fAudioOnly = false;
break;
}
@@ -11084,13 +10804,11 @@ void CMainFrame::OpenSetupVideo() }
}
- if(m_fShockwaveGraph)
- {
+ if(m_fShockwaveGraph) {
m_fAudioOnly = false;
}
- if(m_pCAP)
- {
+ if(m_pCAP) {
SetShaders();
}
// else
@@ -11101,12 +10819,14 @@ void CMainFrame::OpenSetupVideo() pVW->put_WindowStyle(WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN);
pVW->put_MessageDrain((OAHWND)m_hWnd);
- for(CWnd* pWnd = m_wndView.GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
- pWnd->EnableWindow(FALSE); // little trick to let WM_SETCURSOR thru
+ for(CWnd* pWnd = m_wndView.GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
+ pWnd->EnableWindow(FALSE); // little trick to let WM_SETCURSOR thru
+ }
}
- if (m_fAudioOnly && m_pFullscreenWnd->IsWindow())
+ if (m_fAudioOnly && m_pFullscreenWnd->IsWindow()) {
m_pFullscreenWnd->DestroyWindow();
+ }
}
void CMainFrame::OpenSetupAudio()
@@ -11130,30 +10850,24 @@ void CMainFrame::OpenSetupToolBar() */
void CMainFrame::OpenSetupCaptureBar()
{
- if(GetPlaybackMode() == PM_CAPTURE)
- {
- if(pVidCap && pAMVSCCap)
- {
+ if(GetPlaybackMode() == PM_CAPTURE) {
+ if(pVidCap && pAMVSCCap) {
CComQIPtr<IAMVfwCaptureDialogs> pVfwCD = pVidCap;
- if(!pAMXBar && pVfwCD)
- {
+ if(!pAMXBar && pVfwCD) {
m_wndCaptureBar.m_capdlg.SetupVideoControls(m_VidDispName, pAMVSCCap, pVfwCD);
- }
- else
- {
+ } else {
m_wndCaptureBar.m_capdlg.SetupVideoControls(m_VidDispName, pAMVSCCap, pAMXBar, pAMTuner);
}
}
- if(pAudCap && pAMASC)
- {
+ if(pAudCap && pAMASC) {
CInterfaceArray<IAMAudioInputMixer> pAMAIM;
- BeginEnumPins(pAudCap, pEP, pPin)
- {
- if(CComQIPtr<IAMAudioInputMixer> pAIM = pPin)
+ BeginEnumPins(pAudCap, pEP, pPin) {
+ if(CComQIPtr<IAMAudioInputMixer> pAIM = pPin) {
pAMAIM.Add(pAIM);
+ }
}
EndEnumPins;
@@ -11168,55 +10882,54 @@ void CMainFrame::OpenSetupCaptureBar() void CMainFrame::OpenSetupInfoBar()
{
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
bool fEmpty = true;
- BeginEnumFilters(pGB, pEF, pBF)
- {
- if(CComQIPtr<IAMMediaContent, &IID_IAMMediaContent> pAMMC = pBF)
- {
+ BeginEnumFilters(pGB, pEF, pBF) {
+ if(CComQIPtr<IAMMediaContent, &IID_IAMMediaContent> pAMMC = pBF) {
CComBSTR bstr;
- if(SUCCEEDED(pAMMC->get_Title(&bstr)))
- {
+ if(SUCCEEDED(pAMMC->get_Title(&bstr))) {
m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_TITLE), bstr.m_str);
- if(bstr.Length()) fEmpty = false;
+ if(bstr.Length()) {
+ fEmpty = false;
+ }
}
bstr.Empty();
- if(SUCCEEDED(pAMMC->get_AuthorName(&bstr)))
- {
+ if(SUCCEEDED(pAMMC->get_AuthorName(&bstr))) {
m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_AUTHOR), bstr.m_str);
- if(bstr.Length()) fEmpty = false;
+ if(bstr.Length()) {
+ fEmpty = false;
+ }
}
bstr.Empty();
- if(SUCCEEDED(pAMMC->get_Copyright(&bstr)))
- {
+ if(SUCCEEDED(pAMMC->get_Copyright(&bstr))) {
m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_COPYRIGHT), bstr.m_str);
- if(bstr.Length()) fEmpty = false;
+ if(bstr.Length()) {
+ fEmpty = false;
+ }
}
bstr.Empty();
- if(SUCCEEDED(pAMMC->get_Rating(&bstr)))
- {
+ if(SUCCEEDED(pAMMC->get_Rating(&bstr))) {
m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_RATING), bstr.m_str);
- if(bstr.Length()) fEmpty = false;
+ if(bstr.Length()) {
+ fEmpty = false;
+ }
}
bstr.Empty();
- if(SUCCEEDED(pAMMC->get_Description(&bstr)))
- {
+ if(SUCCEEDED(pAMMC->get_Description(&bstr))) {
m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DESCRIPTION), bstr.m_str);
- if(bstr.Length()) fEmpty = false;
+ if(bstr.Length()) {
+ fEmpty = false;
+ }
}
bstr.Empty();
- if(!fEmpty)
- {
+ if(!fEmpty) {
RecalcLayout();
break;
}
}
}
EndEnumFilters;
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
CString info('-');
m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), info);
m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_LOCATION), info);
@@ -11231,10 +10944,8 @@ void CMainFrame::OpenSetupStatsBar() {
CString info('-');
- BeginEnumFilters(pGB, pEF, pBF)
- {
- if(!pQP && (pQP = pBF))
- {
+ BeginEnumFilters(pGB, pEF, pBF) {
+ if(!pQP && (pQP = pBF)) {
m_wndStatsBar.SetLine(ResStr(IDS_AG_FRAMERATE), info);
m_wndStatsBar.SetLine(_T("Sync Offset"), info);
m_wndStatsBar.SetLine(ResStr(IDS_AG_FRAMES), info);
@@ -11244,8 +10955,7 @@ void CMainFrame::OpenSetupStatsBar() RecalcLayout();
}
- if(!pBI && (pBI = pBF))
- {
+ if(!pBI && (pBI = pBF)) {
m_wndStatsBar.SetLine(ResStr(IDS_AG_BUFFERS), info);
m_wndStatsBar.SetLine(_T("Bitrate"), info); // FIXME: shouldn't be here
RecalcLayout();
@@ -11260,40 +10970,34 @@ void CMainFrame::OpenSetupStatusBar() //
- if(!m_fCustomGraph)
- {
+ if(!m_fCustomGraph) {
UINT id = IDB_NOAUDIO;
- BeginEnumFilters(pGB, pEF, pBF)
- {
+ BeginEnumFilters(pGB, pEF, pBF) {
CComQIPtr<IBasicAudio> pBA = pBF;
- if(!pBA) continue;
+ if(!pBA) {
+ continue;
+ }
- BeginEnumPins(pBF, pEP, pPin)
- {
+ BeginEnumPins(pBF, pEP, pPin) {
if(S_OK == pGB->IsPinDirection(pPin, PINDIR_INPUT)
- && S_OK == pGB->IsPinConnected(pPin))
- {
+ && S_OK == pGB->IsPinConnected(pPin)) {
AM_MEDIA_TYPE mt;
memset(&mt, 0, sizeof(mt));
pPin->ConnectionMediaType(&mt);
- if(mt.majortype == MEDIATYPE_Audio && mt.formattype == FORMAT_WaveFormatEx)
- {
- switch(((WAVEFORMATEX*)mt.pbFormat)->nChannels)
- {
- case 1:
- id = IDB_MONO;
- break;
- case 2:
- default:
- id = IDB_STEREO;
- break;
+ if(mt.majortype == MEDIATYPE_Audio && mt.formattype == FORMAT_WaveFormatEx) {
+ switch(((WAVEFORMATEX*)mt.pbFormat)->nChannels) {
+ case 1:
+ id = IDB_MONO;
+ break;
+ case 2:
+ default:
+ id = IDB_STEREO;
+ break;
}
break;
- }
- else if(mt.majortype == MEDIATYPE_Midi)
- {
+ } else if(mt.majortype == MEDIATYPE_Midi) {
id = NULL;
break;
}
@@ -11301,8 +11005,7 @@ void CMainFrame::OpenSetupStatusBar() }
EndEnumPins;
- if(id != IDB_NOAUDIO)
- {
+ if(id != IDB_NOAUDIO) {
break;
}
}
@@ -11315,18 +11018,13 @@ void CMainFrame::OpenSetupStatusBar() HICON hIcon = NULL;
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
CString fn = m_wndPlaylistBar.GetCurFileName();
CString ext = fn.Mid(fn.ReverseFind('.')+1);
hIcon = LoadIcon(ext, true);
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
hIcon = LoadIcon(_T(".ifo"), true);
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
// hIcon = ; // TODO
}
@@ -11341,24 +11039,19 @@ void CMainFrame::OpenSetupWindowTitle(CString fn) int i = s.iTitleBarTextStyle;
- if(!fn.IsEmpty() && (i == 0 || i == 1))
- {
- if(i == 1)
- {
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(!fn.IsEmpty() && (i == 0 || i == 1)) {
+ if(i == 1) {
+ if(GetPlaybackMode() == PM_FILE) {
fn.Replace('\\', '/');
CString fn2 = fn.Mid(fn.ReverseFind('/')+1);
- if(!fn2.IsEmpty()) fn = fn2;
- if(s.fTitleBarTextTitle)
- {
- BeginEnumFilters(pGB, pEF, pBF)
- {
- if(CComQIPtr<IAMMediaContent, &IID_IAMMediaContent> pAMMC = pBF)
- {
+ if(!fn2.IsEmpty()) {
+ fn = fn2;
+ }
+ if(s.fTitleBarTextTitle) {
+ BeginEnumFilters(pGB, pEF, pBF) {
+ if(CComQIPtr<IAMMediaContent, &IID_IAMMediaContent> pAMMC = pBF) {
CComBSTR bstr;
- if(SUCCEEDED(pAMMC->get_Title(&bstr)) && bstr.Length())
- {
+ if(SUCCEEDED(pAMMC->get_Title(&bstr)) && bstr.Length()) {
fn = CString(bstr.m_str);
break;
}
@@ -11366,13 +11059,9 @@ void CMainFrame::OpenSetupWindowTitle(CString fn) }
EndEnumFilters;
}
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
fn = _T("DVD");
- }
- else if(GetPlaybackMode() == PM_CAPTURE)
- {
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
fn = _T("Live");
}
}
@@ -11389,13 +11078,15 @@ void CMainFrame::OpenSetupWindowTitle(CString fn) bool DoesAudioPrecede(const CComPtr<IAMStreamSelect> &pSS, int a, int b)
{
WCHAR* pName = NULL;
- if(FAILED(pSS->Info(a, NULL, NULL, NULL, NULL, &pName, NULL, NULL)))
+ if(FAILED(pSS->Info(a, NULL, NULL, NULL, NULL, &pName, NULL, NULL))) {
return false;
+ }
CString nameA(pName);
CoTaskMemFree(pName);
- if(FAILED(pSS->Info(b, NULL, NULL, NULL, NULL, &pName, NULL, NULL)))
+ if(FAILED(pSS->Info(b, NULL, NULL, NULL, NULL, &pName, NULL, NULL))) {
return false;
+ }
CString nameB(pName);
CoTaskMemFree(pName);
@@ -11404,17 +11095,19 @@ bool DoesAudioPrecede(const CComPtr<IAMStreamSelect> &pSS, int a, int b) CStringW alo = AfxGetAppSettings().strAudiosLanguageOrder;
int tPos = 0;
CStringW lang = alo.Tokenize(_T(",; "), tPos);
- while(tPos != -1 && ia == -1 && ib == -1)
- {
+ while(tPos != -1 && ia == -1 && ib == -1) {
int ll = lang.GetLength();
- if(nameA.Left(ll).CompareNoCase(lang) == 0)
+ if(nameA.Left(ll).CompareNoCase(lang) == 0) {
ia = tPos;
- if(nameB.Left(ll).CompareNoCase(lang) == 0)
+ }
+ if(nameB.Left(ll).CompareNoCase(lang) == 0) {
ib = tPos;
+ }
lang = alo.Tokenize(_T(",; "), tPos);
}
- if(ia != -1 && ib == -1)
+ if(ia != -1 && ib == -1) {
return true;
+ }
return false;
}
@@ -11424,38 +11117,40 @@ void CMainFrame::InsertAudioStream(const CComQIPtr<IAMStreamSelect> &pSS, int i) {
POSITION pos = m_iAudioStreams.GetHeadPosition();
bool processed = false;
- while(!processed && pos)
- {
+ while(!processed && pos) {
POSITION prevPos = pos;
int j = m_iAudioStreams.GetNext(pos);
- if(DoesAudioPrecede(pSS, i, j))
- {
- if(prevPos == m_iAudioStreams.GetHeadPosition())
+ if(DoesAudioPrecede(pSS, i, j)) {
+ if(prevPos == m_iAudioStreams.GetHeadPosition()) {
m_iAudioStreams.AddHead(i);
- else
+ } else {
m_iAudioStreams.InsertBefore(prevPos, i);
+ }
processed = true;
}
}
- if(!processed)
+ if(!processed) {
m_iAudioStreams.AddTail(i);
+ }
}
// foxX: creates a mapping of audio streams, where they're ordered based on their language and the user language order options
void CMainFrame::SetupAudioStreams()
{
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
m_iAudioStreams.RemoveAll();
CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
- if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); // morgan's switcher
+ if(!pSS) {
+ pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); // morgan's switcher
+ }
DWORD cStreams = 0;
- if(pSS && SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 0)
- {
- for(int i = 0; i < (int)cStreams; i++)
- {
+ if(pSS && SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 0) {
+ for(int i = 0; i < (int)cStreams; i++) {
InsertAudioStream(pSS, i);
}
}
@@ -11465,8 +11160,7 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD) {
AppSettings& s = AfxGetAppSettings();
- if(m_iMediaLoadState != MLS_CLOSED)
- {
+ if(m_iMediaLoadState != MLS_CLOSED) {
ASSERT(0);
return(false);
}
@@ -11474,8 +11168,7 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD) OpenFileData *pFileData = dynamic_cast<OpenFileData *>(pOMD.m_p);
OpenDVDData* pDVDData = dynamic_cast<OpenDVDData*>(pOMD.m_p);
OpenDeviceData* pDeviceData = dynamic_cast<OpenDeviceData*>(pOMD.m_p);
- if(!pFileData && !pDVDData && !pDeviceData)
- {
+ if(!pFileData && !pDVDData && !pDeviceData) {
ASSERT(0);
return(false);
}
@@ -11483,12 +11176,10 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD) #ifdef _DEBUG
// Debug trace code - Begin
// Check for bad / buggy auto loading file code
- if ( pFileData )
- {
+ if ( pFileData ) {
POSITION pos = pFileData->fns.GetHeadPosition();
UINT index = 0;
- while ( pos != NULL )
- {
+ while ( pos != NULL ) {
CString path = pFileData->fns.GetNext( pos );
TRACE(_T("--> CMainFrame::OpenMediaPrivate - pFileData->fns[%d]:\n"), index);
TRACE(_T("\t%ws\n"), path.GetString()); // %ws - wide character string always
@@ -11498,41 +11189,36 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD) // Debug trace code - End
#endif
- if(pFileData)
- {
- if(pFileData->fns.IsEmpty())
+ if(pFileData) {
+ if(pFileData->fns.IsEmpty()) {
return(false);
+ }
CString fn = pFileData->fns.GetHead();
int i = fn.Find(_T(":\\"));
- if(i > 0)
- {
+ if(i > 0) {
CString drive = fn.Left(i+2);
UINT type = GetDriveType(drive);
CAtlList<CString> sl;
- if(type == DRIVE_REMOVABLE || type == DRIVE_CDROM && GetCDROMType(drive[0], sl) != CDROM_Audio)
- {
+ if(type == DRIVE_REMOVABLE || type == DRIVE_CDROM && GetCDROMType(drive[0], sl) != CDROM_Audio) {
int ret = IDRETRY;
- while(ret == IDRETRY)
- {
+ while(ret == IDRETRY) {
WIN32_FIND_DATA findFileData;
HANDLE h = FindFirstFile(fn, &findFileData);
- if(h != INVALID_HANDLE_VALUE)
- {
+ if(h != INVALID_HANDLE_VALUE) {
FindClose(h);
ret = IDOK;
- }
- else
- {
+ } else {
CString msg;
msg.Format(ResStr(IDS_MAINFRM_114), fn);
ret = AfxMessageBox(msg, MB_RETRYCANCEL);
}
}
- if(ret != IDOK)
+ if(ret != IDOK) {
return(false);
+ }
}
}
}
@@ -11547,33 +11233,41 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD) m_fUpdateInfoBar = false;
BeginWaitCursor();
- try
- {
+ try {
CComPtr<IVMRMixerBitmap9> pVMB;
CComPtr<IMFVideoMixerBitmap> pMFVMB;
- if(m_fOpeningAborted) throw aborted;
+ if(m_fOpeningAborted) {
+ throw aborted;
+ }
OpenCreateGraphObject(pOMD);
- if(m_fOpeningAborted) throw aborted;
+ if(m_fOpeningAborted) {
+ throw aborted;
+ }
SetupIViAudReg();
- if(m_fOpeningAborted) throw aborted;
+ if(m_fOpeningAborted) {
+ throw aborted;
+ }
- if(pFileData) OpenFile(pFileData);
- else if(pDVDData) OpenDVD(pDVDData);
- else if(pDeviceData)
- {
- if (s.iDefaultCaptureDevice == 1)
- {
+ if(pFileData) {
+ OpenFile(pFileData);
+ } else if(pDVDData) {
+ OpenDVD(pDVDData);
+ } else if(pDeviceData) {
+ if (s.iDefaultCaptureDevice == 1) {
HRESULT hr = OpenBDAGraph();
- if FAILED(hr) throw _T("Could not open capture device.");
- }
- else
+ if FAILED(hr) {
+ throw _T("Could not open capture device.");
+ }
+ } else {
OpenCapture(pDeviceData);
+ }
+ } else {
+ throw _T("Can't open, invalid input parameters");
}
- else throw _T("Can't open, invalid input parameters");
m_pCAP2 = NULL;
m_pCAP = NULL;
@@ -11583,12 +11277,12 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD) pGB->FindInterface(__uuidof(IVMRMixerControl9), (void**)&m_pMC, TRUE);
pGB->FindInterface(__uuidof(IVMRMixerBitmap9), (void**)&pVMB, TRUE);
pGB->FindInterface(__uuidof(IMFVideoMixerBitmap), (void**)&pMFVMB, TRUE);
- if (pVMB && s.fShowOSD)
+ if (pVMB && s.fShowOSD) {
m_OSD.Start (m_pVideoWnd, pVMB);
- else if (pMFVMB && s.fShowOSD)
+ } else if (pMFVMB && s.fShowOSD) {
m_OSD.Start (m_pVideoWnd, pMFVMB);
- if (m_pMC)
- {
+ }
+ if (m_pMC) {
m_pMC->GetProcAmpControlRange (0, (VMR9ProcAmpControlRange*)AfxGetMyApp()->GetColorControl (Brightness));
m_pMC->GetProcAmpControlRange (0, (VMR9ProcAmpControlRange*)AfxGetMyApp()->GetColorControl (Contrast));
m_pMC->GetProcAmpControlRange (0, (VMR9ProcAmpControlRange*)AfxGetMyApp()->GetColorControl (Hue));
@@ -11598,34 +11292,39 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD) // === EVR !
pGB->FindInterface(__uuidof(IMFVideoDisplayControl), (void**)&m_pMFVDC, TRUE);
- if (m_pMFVDC)
- {
+ if (m_pMFVDC) {
RECT Rect;
::GetClientRect (m_pVideoWnd->m_hWnd, &Rect);
m_pMFVDC->SetVideoWindow (m_pVideoWnd->m_hWnd);
m_pMFVDC->SetVideoPosition(NULL, &Rect);
}
- if(m_fOpeningAborted) throw aborted;
+ if(m_fOpeningAborted) {
+ throw aborted;
+ }
OpenCustomizeGraph();
- if(m_fOpeningAborted) throw aborted;
+ if(m_fOpeningAborted) {
+ throw aborted;
+ }
OpenSetupVideo();
- if(m_fOpeningAborted) throw aborted;
+ if(m_fOpeningAborted) {
+ throw aborted;
+ }
OpenSetupAudio();
- if(m_fOpeningAborted) throw aborted;
+ if(m_fOpeningAborted) {
+ throw aborted;
+ }
- if(m_pCAP && (!m_fAudioOnly || m_fRealMediaGraph))
- {
+ if(m_pCAP && (!m_fAudioOnly || m_fRealMediaGraph)) {
int nInternalSubCount = m_pSubStreams.GetCount();
- if(s.fDisableInternalSubtitles && nInternalSubCount > 0)
- {
+ if(s.fDisableInternalSubtitles && nInternalSubCount > 0) {
m_pSubStreams.RemoveAll(); // Needs to be replaced with code that checks for forced subtitles.
// Update the the internal subtitle count
@@ -11633,25 +11332,25 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD) }
POSITION pos = pOMD->subs.GetHeadPosition();
- while(pos) LoadSubtitle(pOMD->subs.GetNext(pos));
+ while(pos) {
+ LoadSubtitle(pOMD->subs.GetNext(pos));
+ }
- if(AfxGetAppSettings().fEnableSubtitles && m_pSubStreams.GetCount() > 0)
- {
+ if(AfxGetAppSettings().fEnableSubtitles && m_pSubStreams.GetCount() > 0) {
CComPtr<ISubStream> pSub = m_pSubStreams.GetHead();
- if(s.fPrioritizeExternalSubtitles && m_pSubStreams.GetCount() > nInternalSubCount)
- {
+ if(s.fPrioritizeExternalSubtitles && m_pSubStreams.GetCount() > nInternalSubCount) {
int nCurrentSubIndex = -1;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
pSub = m_pSubStreams.GetNext(pos);
nCurrentSubIndex++;
- if(nCurrentSubIndex == nInternalSubCount)
+ if(nCurrentSubIndex == nInternalSubCount) {
break;
+ }
}
}
@@ -11659,28 +11358,29 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD) }
}
- if(m_fOpeningAborted) throw aborted;
+ if(m_fOpeningAborted) {
+ throw aborted;
+ }
OpenSetupWindowTitle(pOMD->title);
- if (s.fEnableEDLEditor)
+ if (s.fEnableEDLEditor) {
m_wndEditListEditor.OpenFile(pOMD->title);
+ }
- if(pFileData) m_OpenFile = true;
+ if(pFileData) {
+ m_OpenFile = true;
+ }
- if(::GetCurrentThreadId() == AfxGetApp()->m_nThreadID)
- {
+ if(::GetCurrentThreadId() == AfxGetApp()->m_nThreadID) {
OnFilePostOpenmedia();
- }
- else
- {
+ } else {
PostMessage(WM_COMMAND, ID_FILE_POST_OPENMEDIA);
}
while(m_iMediaLoadState != MLS_LOADED
&& m_iMediaLoadState != MLS_CLOSING // FIXME
- )
- {
+ ) {
Sleep(50);
}
@@ -11690,101 +11390,96 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD) PostMessage(WM_COMMAND, ID_PLAY_PAUSE);
- if(!(AfxGetAppSettings().nCLSwitches&CLSW_OPEN) && (AfxGetAppSettings().nLoops > 0))
+ if(!(AfxGetAppSettings().nCLSwitches&CLSW_OPEN) && (AfxGetAppSettings().nLoops > 0)) {
PostMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
// Casimir666 : audio selection should be done before running the graph to prevent an
// unnecessary seek when a file is opened (PostMessage ID_AUDIO_SUBITEM_START removed)
- if(m_iAudioStreams.GetCount() > 0)
+ if(m_iAudioStreams.GetCount() > 0) {
OnPlayAudio (ID_AUDIO_SUBITEM_START + 1);
+ }
AfxGetAppSettings().nCLSwitches &= ~CLSW_OPEN;
- if(pFileData)
- {
- if(pFileData->rtStart > 0)
- PostMessage(WM_RESUMEFROMSTATE, (WPARAM)PM_FILE, (LPARAM)(pFileData->rtStart/10000)); // REFERENCE_TIME doesn't fit in LPARAM under a 32bit env.
- }
- else if(pDVDData)
- {
- if(pDVDData->pDvdState)
- PostMessage(WM_RESUMEFROMSTATE, (WPARAM)PM_DVD, (LPARAM)(CComPtr<IDvdState>(pDVDData->pDvdState).Detach())); // must be released by the called message handler
- }
- else if(pDeviceData)
- {
+ if(pFileData) {
+ if(pFileData->rtStart > 0) {
+ PostMessage(WM_RESUMEFROMSTATE, (WPARAM)PM_FILE, (LPARAM)(pFileData->rtStart/10000)); // REFERENCE_TIME doesn't fit in LPARAM under a 32bit env.
+ }
+ } else if(pDVDData) {
+ if(pDVDData->pDvdState) {
+ PostMessage(WM_RESUMEFROMSTATE, (WPARAM)PM_DVD, (LPARAM)(CComPtr<IDvdState>(pDVDData->pDvdState).Detach())); // must be released by the called message handler
+ }
+ } else if(pDeviceData) {
m_wndCaptureBar.m_capdlg.SetVideoInput(pDeviceData->vinput);
m_wndCaptureBar.m_capdlg.SetVideoChannel(pDeviceData->vchannel);
m_wndCaptureBar.m_capdlg.SetAudioInput(pDeviceData->ainput);
}
- }
- catch(LPCTSTR msg)
- {
+ } catch(LPCTSTR msg) {
err = msg;
- }
- catch(CString msg)
- {
+ } catch(CString msg) {
err = msg;
}
EndWaitCursor();
- if(!err.IsEmpty())
- {
+ if(!err.IsEmpty()) {
CloseMediaPrivate();
m_closingmsg = err;
- if(err != aborted)
- {
- if(pFileData)
+ if(err != aborted) {
+ if(pFileData) {
m_wndPlaylistBar.SetCurValid(false);
+ }
OnNavigateSkip(ID_NAVIGATE_SKIPFORWARD);
}
- }
- else
- {
+ } else {
m_wndPlaylistBar.SetCurValid(true);
// Apply command line audio shift
- if (s.rtShift != 0)
- {
+ if (s.rtShift != 0) {
SetAudioDelay (s.rtShift);
s.rtShift = 0;
}
}
- if (AfxGetAppSettings().AutoChangeFullscrRes.bEnabled && m_fFullScreen) AutoChangeMonitorMode();
- if (m_fFullScreen && AfxGetAppSettings().fRememberZoomLevel) m_fFirstFSAfterLaunchOnFS = true;
+ if (AfxGetAppSettings().AutoChangeFullscrRes.bEnabled && m_fFullScreen) {
+ AutoChangeMonitorMode();
+ }
+ if (m_fFullScreen && AfxGetAppSettings().fRememberZoomLevel) {
+ m_fFirstFSAfterLaunchOnFS = true;
+ }
m_LastOpenFile = pOMD->title;
PostMessage(WM_KICKIDLE); // calls main thread to update things
CString m_strOSD = _T("");
- if(pFileData)
- {
+ if(pFileData) {
m_strOSD = m_wndPlaylistBar.GetCurFileName();
- if(m_strOSD != _T(""))
- {
+ if(m_strOSD != _T("")) {
m_strOSD.TrimRight('/');
m_strOSD.Replace('\\', '/');
m_strOSD = m_strOSD.Mid(m_strOSD.ReverseFind('/')+1);
- }
- else
- {
+ } else {
m_strOSD = ResStr(ID_PLAY_PLAY);
int i = m_strOSD.Find(_T("\n"));
- if(i > 0) m_strOSD.Delete(i, m_strOSD.GetLength()-i);
+ if(i > 0) {
+ m_strOSD.Delete(i, m_strOSD.GetLength()-i);
+ }
m_strOSD += _T(" BD");
}
- }
- else if(pDVDData)
- {
+ } else if(pDVDData) {
m_strOSD = ResStr(ID_PLAY_PLAY);
int i = m_strOSD.Find(_T("\n"));
- if(i > 0) m_strOSD.Delete(i, m_strOSD.GetLength()-i);
+ if(i > 0) {
+ m_strOSD.Delete(i, m_strOSD.GetLength()-i);
+ }
m_strOSD += _T(" DVD");
}
- if(m_strOSD != _T("")) m_OSD.DisplayMessage(OSD_TOPLEFT, m_strOSD, 3000);
+ if(m_strOSD != _T("")) {
+ m_OSD.DisplayMessage(OSD_TOPLEFT, m_strOSD, 3000);
+ }
return(err.IsEmpty());
@@ -11809,8 +11504,8 @@ void CMainFrame::CloseMediaPrivate() m_pCB = NULL;
-// if(pVW) pVW->put_Visible(OAFALSE);
-// if(pVW) pVW->put_MessageDrain((OAHWND)NULL), pVW->put_Owner((OAHWND)NULL);
+ // if(pVW) pVW->put_Visible(OAFALSE);
+ // if(pVW) pVW->put_MessageDrain((OAHWND)NULL), pVW->put_Owner((OAHWND)NULL);
m_pCAP = NULL; // IMPORTANT: IVMRSurfaceAllocatorNotify/IVMRSurfaceAllocatorNotify9 has to be released before the VMR/VMR9, otherwise it will crash in Release()
m_pCAP2 = NULL;
@@ -11843,14 +11538,14 @@ void CMainFrame::CloseMediaPrivate() pBV.Release();
pBA.Release();
- if(pGB)
- {
+ if(pGB) {
pGB->RemoveFromROT();
pGB.Release();
}
- if (m_pFullscreenWnd->IsWindow())
- m_pFullscreenWnd->DestroyWindow(); // TODO : still freezing sometimes...
+ if (m_pFullscreenWnd->IsWindow()) {
+ m_pFullscreenWnd->DestroyWindow(); // TODO : still freezing sometimes...
+ }
m_fRealMediaGraph = m_fShockwaveGraph = m_fQuicktimeGraph = false;
@@ -11896,43 +11591,45 @@ int CMainFrame::SearchInDir(bool DirForward) CString mask = dir + _T("*.*");
WIN32_FIND_DATA fd;
HANDLE h = FindFirstFile(mask, &fd);
- if(h != INVALID_HANDLE_VALUE)
- {
- do
- {
- if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) continue;
+ if(h != INVALID_HANDLE_VALUE) {
+ do {
+ if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
+ continue;
+ }
CString fn = fd.cFileName;
CString ext = fn.Mid(fn.ReverseFind('.')).MakeLower();
CString path = dir + fd.cFileName;
- if(mf.FindExt(ext) && mf.GetCount() > 0)
- {
+ if(mf.FindExt(ext) && mf.GetCount() > 0) {
fileName f_name;
f_name.fn = path;
f_array.Add(f_name);
}
- }
- while(FindNextFile(h, &fd));
+ } while(FindNextFile(h, &fd));
FindClose(h);
}
- if(f_array.GetCount() == 1) return true;
+ if(f_array.GetCount() == 1) {
+ return true;
+ }
qsort(f_array.GetData(), f_array.GetCount(), sizeof(fileName), compare);
- for(int i = 0; i < f_array.GetCount(); i++)
+ for(int i = 0; i < f_array.GetCount(); i++) {
sl.AddTail(f_array[i].fn);
+ }
POSITION Pos;
Pos = sl.Find(m_LastOpenFile);
- if (DirForward)
- {
- if (Pos == sl.GetTailPosition()) return(false);
+ if (DirForward) {
+ if (Pos == sl.GetTailPosition()) {
+ return(false);
+ }
sl.GetNext(Pos);
- }
- else
- {
- if (Pos == sl.GetHeadPosition()) return(false);
+ } else {
+ if (Pos == sl.GetHeadPosition()) {
+ return(false);
+ }
sl.GetPrev(Pos);
}
Play_sl.AddHead(sl.GetAt(Pos));
@@ -11943,11 +11640,9 @@ int CMainFrame::SearchInDir(bool DirForward) void CMainFrame::DoTunerScan(TunerScanData* pTSD)
{
- if(GetPlaybackMode() == PM_CAPTURE)
- {
+ if(GetPlaybackMode() == PM_CAPTURE) {
CComQIPtr<IBDATuner> pTun = pGB;
- if (pTun)
- {
+ if (pTun) {
BOOLEAN bPresent;
BOOLEAN bLocked;
LONG lStrength;
@@ -11958,15 +11653,12 @@ void CMainFrame::DoTunerScan(TunerScanData* pTSD) bool bSucceeded;
m_bStopTunerScan = false;
- for(ULONG ulFrequency = pTSD->FrequencyStart; ulFrequency <= pTSD->FrequencyStop; ulFrequency += pTSD->Bandwidth)
- {
+ for(ULONG ulFrequency = pTSD->FrequencyStart; ulFrequency <= pTSD->FrequencyStop; ulFrequency += pTSD->Bandwidth) {
bSucceeded = false;
- for (int nOffsetPos = 0; nOffsetPos < nOffset && !bSucceeded; nOffsetPos++)
- {
+ for (int nOffsetPos = 0; nOffsetPos < nOffset && !bSucceeded; nOffsetPos++) {
pTun->SetFrequency (ulFrequency + lOffsets[nOffsetPos]);
Sleep (200);
- if (SUCCEEDED (pTun->GetStats (bPresent, bLocked, lStrength, lQuality)) && bPresent)
- {
+ if (SUCCEEDED (pTun->GetStats (bPresent, bLocked, lStrength, lQuality)) && bPresent) {
::SendMessage (pTSD->Hwnd, WM_TUNER_STATS, lStrength, lQuality);
pTun->Scan (ulFrequency + lOffsets[nOffsetPos], pTSD->Hwnd);
bSucceeded = true;
@@ -11977,7 +11669,9 @@ void CMainFrame::DoTunerScan(TunerScanData* pTSD) ::SendMessage (pTSD->Hwnd, WM_TUNER_SCAN_PROGRESS, nProgress,0);
::SendMessage (pTSD->Hwnd, WM_TUNER_STATS, lStrength, lQuality);
- if (m_bStopTunerScan) break;
+ if (m_bStopTunerScan) {
+ break;
+ }
}
::SendMessage (pTSD->Hwnd, WM_TUNER_SCAN_END, 0, 0);
@@ -11989,32 +11683,30 @@ void CMainFrame::DoTunerScan(TunerScanData* pTSD) void CMainFrame::SendNowPlayingToMSN()
{
- if(!AfxGetAppSettings().fNotifyMSN)
+ if(!AfxGetAppSettings().fNotifyMSN) {
return;
+ }
CString title, author;
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_TITLE), title);
m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_AUTHOR), author);
- if(title.IsEmpty())
- {
+ if(title.IsEmpty()) {
CPlaylistItem pli;
m_wndPlaylistBar.GetCur(pli);
- if(!pli.m_fns.IsEmpty())
- {
+ if(!pli.m_fns.IsEmpty()) {
CString label = !pli.m_label.IsEmpty() ? pli.m_label : pli.m_fns.GetHead();
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
CString fn = label;
- if(fn.Find(_T("://")) >= 0)
- {
+ if(fn.Find(_T("://")) >= 0) {
int i = fn.Find('?');
- if(i >= 0) fn = fn.Left(i);
+ if(i >= 0) {
+ fn = fn.Left(i);
+ }
}
CPath path(fn);
path.StripPath();
@@ -12022,14 +11714,10 @@ void CMainFrame::SendNowPlayingToMSN() path.RemoveExtension();
title = (LPCTSTR)path;
author.Empty();
- }
- else if(GetPlaybackMode() == PM_CAPTURE)
- {
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
title = label != pli.m_fns.GetHead() ? label : _T("Live");
author.Empty();
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
title = _T("DVD");
author.Empty();
}
@@ -12043,8 +11731,7 @@ void CMainFrame::SendNowPlayingToMSN() buff += L"\\0";
buff += author.IsEmpty() ? L"{0}" : L"{0} - {1}";
buff += L"\\0";
- if(!author.IsEmpty())
- {
+ if(!author.IsEmpty()) {
buff += CStringW(author) + L"\\0";
}
buff += CStringW(title) + L"\\0";
@@ -12056,8 +11743,7 @@ void CMainFrame::SendNowPlayingToMSN() data.cbData = buff.GetLength() * 2 + 2;
HWND hWnd = ::FindWindowEx(NULL, NULL, _T("MsnMsgrUIManager"), NULL);
- while(hWnd)
- {
+ while(hWnd) {
::SendMessage(hWnd, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&data);
hWnd = ::FindWindowEx(NULL, hWnd, _T("MsnMsgrUIManager"), NULL);
}
@@ -12067,28 +11753,29 @@ void CMainFrame::SendNowPlayingToMSN() void CMainFrame::SendNowPlayingTomIRC()
{
- if(!AfxGetAppSettings().fNotifyGTSdll)
+ if(!AfxGetAppSettings().fNotifyGTSdll) {
return;
+ }
- for(int i = 0; i < 20; i++)
- {
+ for(int i = 0; i < 20; i++) {
HANDLE hFMap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 1024, _T("mIRC"));
- if(!hFMap) return;
+ if(!hFMap) {
+ return;
+ }
- if(GetLastError() == ERROR_ALREADY_EXISTS)
- {
+ if(GetLastError() == ERROR_ALREADY_EXISTS) {
CloseHandle(hFMap);
Sleep(50);
continue;
}
- if(LPVOID lpMappingAddress = MapViewOfFile(hFMap, FILE_MAP_WRITE, 0, 0, 0))
- {
+ if(LPVOID lpMappingAddress = MapViewOfFile(hFMap, FILE_MAP_WRITE, 0, 0, 0)) {
LPCSTR cmd = m_fAudioOnly ? "/.timerAUDGTS 1 5 mpcaud" : "/.timerVIDGTS 1 5 mpcvid";
strcpy((char*)lpMappingAddress, cmd);
- if(HWND hWnd = ::FindWindow(_T("mIRC"), NULL))
+ if(HWND hWnd = ::FindWindow(_T("mIRC"), NULL)) {
::SendMessage(hWnd, (WM_USER + 200), (WPARAM)1, (LPARAM)0);
+ }
UnmapViewOfFile(lpMappingAddress);
}
@@ -12105,40 +11792,52 @@ void CMainFrame::SetupOpenCDSubMenu() {
CMenu* pSub = &m_opencds;
- if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
- else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+ if(!IsMenu(pSub->m_hMenu)) {
+ pSub->CreatePopupMenu();
+ } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ ;
+ }
- if(m_iMediaLoadState == MLS_LOADING) return;
+ if(m_iMediaLoadState == MLS_LOADING) {
+ return;
+ }
- if(AfxGetAppSettings().fHideCDROMsSubMenu) return;
+ if(AfxGetAppSettings().fHideCDROMsSubMenu) {
+ return;
+ }
UINT id = ID_FILE_OPEN_CD_START;
- for(TCHAR drive = 'C'; drive <= 'Z'; drive++)
- {
+ for(TCHAR drive = 'C'; drive <= 'Z'; drive++) {
CString label = GetDriveLabel(drive), str;
CAtlList<CString> files;
- switch(GetCDROMType(drive, files))
- {
- case CDROM_Audio:
- if(label.IsEmpty()) label = _T("Audio CD");
- str.Format(_T("%s (%c:)"), label, drive);
- break;
- case CDROM_VideoCD:
- if(label.IsEmpty()) label = _T("(S)VCD");
- str.Format(_T("%s (%c:)"), label, drive);
- break;
- case CDROM_DVDVideo:
- if(label.IsEmpty()) label = _T("DVD Video");
- str.Format(_T("%s (%c:)"), label, drive);
- break;
- default:
- break;
+ switch(GetCDROMType(drive, files)) {
+ case CDROM_Audio:
+ if(label.IsEmpty()) {
+ label = _T("Audio CD");
+ }
+ str.Format(_T("%s (%c:)"), label, drive);
+ break;
+ case CDROM_VideoCD:
+ if(label.IsEmpty()) {
+ label = _T("(S)VCD");
+ }
+ str.Format(_T("%s (%c:)"), label, drive);
+ break;
+ case CDROM_DVDVideo:
+ if(label.IsEmpty()) {
+ label = _T("DVD Video");
+ }
+ str.Format(_T("%s (%c:)"), label, drive);
+ break;
+ default:
+ break;
}
- if(!str.IsEmpty())
+ if(!str.IsEmpty()) {
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, str);
+ }
}
}
@@ -12146,67 +11845,62 @@ void CMainFrame::SetupFiltersSubMenu() {
CMenu* pSub = &m_filters;
- if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
- else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+ if(!IsMenu(pSub->m_hMenu)) {
+ pSub->CreatePopupMenu();
+ } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ ;
+ }
m_filterpopups.RemoveAll();
m_pparray.RemoveAll();
m_ssarray.RemoveAll();
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
UINT idf = 0;
UINT ids = ID_FILTERS_SUBITEM_START;
UINT idl = ID_FILTERSTREAMS_SUBITEM_START;
- BeginEnumFilters(pGB, pEF, pBF)
- {
+ BeginEnumFilters(pGB, pEF, pBF) {
CString name(GetFilterName(pBF));
- if(name.GetLength() >= 43) name = name.Left(40) + _T("...");
+ if(name.GetLength() >= 43) {
+ name = name.Left(40) + _T("...");
+ }
CLSID clsid = GetCLSID(pBF);
- if(clsid == CLSID_AVIDec)
- {
+ if(clsid == CLSID_AVIDec) {
CComPtr<IPin> pPin = GetFirstPin(pBF);
AM_MEDIA_TYPE mt;
- if(pPin && SUCCEEDED(pPin->ConnectionMediaType(&mt)))
- {
+ if(pPin && SUCCEEDED(pPin->ConnectionMediaType(&mt))) {
DWORD c = ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression;
- switch(c)
- {
- case BI_RGB:
- name += _T(" (RGB)");
- break;
- case BI_RLE4:
- name += _T(" (RLE4)");
- break;
- case BI_RLE8:
- name += _T(" (RLE8)");
- break;
- case BI_BITFIELDS:
- name += _T(" (BITF)");
- break;
- default:
- name.Format(_T("%s (%c%c%c%c)"),
- CString(name), (TCHAR)((c>>0)&0xff), (TCHAR)((c>>8)&0xff), (TCHAR)((c>>16)&0xff), (TCHAR)((c>>24)&0xff));
- break;
+ switch(c) {
+ case BI_RGB:
+ name += _T(" (RGB)");
+ break;
+ case BI_RLE4:
+ name += _T(" (RLE4)");
+ break;
+ case BI_RLE8:
+ name += _T(" (RLE8)");
+ break;
+ case BI_BITFIELDS:
+ name += _T(" (BITF)");
+ break;
+ default:
+ name.Format(_T("%s (%c%c%c%c)"),
+ CString(name), (TCHAR)((c>>0)&0xff), (TCHAR)((c>>8)&0xff), (TCHAR)((c>>16)&0xff), (TCHAR)((c>>24)&0xff));
+ break;
}
}
- }
- else if(clsid == CLSID_ACMWrapper)
- {
+ } else if(clsid == CLSID_ACMWrapper) {
CComPtr<IPin> pPin = GetFirstPin(pBF);
AM_MEDIA_TYPE mt;
- if(pPin && SUCCEEDED(pPin->ConnectionMediaType(&mt)))
- {
+ if(pPin && SUCCEEDED(pPin->ConnectionMediaType(&mt))) {
WORD c = ((WAVEFORMATEX*)mt.pbFormat)->wFormatTag;
name.Format(_T("%s (0x%04x)"), CString(name), (int)c);
}
- }
- else if(clsid == __uuidof(CTextPassThruFilter) || clsid == __uuidof(CNullTextRenderer)
- || clsid == GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}"))) // ISCR
- {
+ } else if(clsid == __uuidof(CTextPassThruFilter) || clsid == __uuidof(CNullTextRenderer)
+ || clsid == GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}"))) { // ISCR
// hide these
continue;
}
@@ -12234,21 +11928,20 @@ void CMainFrame::SetupFiltersSubMenu() /* }
}
*/
- BeginEnumPins(pBF, pEP, pPin)
- {
+ BeginEnumPins(pBF, pEP, pPin) {
CString name = GetPinName(pPin);
name.Replace(_T("&"), _T("&&"));
- if(pSPP = pPin)
- {
+ if(pSPP = pPin) {
CAUUID caGUID;
caGUID.pElems = NULL;
- if(SUCCEEDED(pSPP->GetPages(&caGUID)) && caGUID.cElems > 0)
- {
+ if(SUCCEEDED(pSPP->GetPages(&caGUID)) && caGUID.cElems > 0) {
m_pparray.Add(pPin);
pSubSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ids+nPPages, name + ResStr(IDS_MAINFRM_117));
- if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
+ if(caGUID.pElems) {
+ CoTaskMemFree(caGUID.pElems);
+ }
nPPages++;
}
@@ -12257,8 +11950,7 @@ void CMainFrame::SetupFiltersSubMenu() EndEnumPins;
CComQIPtr<IAMStreamSelect> pSS = pBF;
- if(pSS)
- {
+ if(pSS) {
DWORD nStreams = 0;
DWORD flags = (DWORD)-1;
DWORD group = (DWORD)-1;
@@ -12269,31 +11961,29 @@ void CMainFrame::SetupFiltersSubMenu() pSS->Count(&nStreams);
- if(nStreams > 0 && nPPages > 0) pSubSub->AppendMenu(MF_SEPARATOR|MF_ENABLED);
+ if(nStreams > 0 && nPPages > 0) {
+ pSubSub->AppendMenu(MF_SEPARATOR|MF_ENABLED);
+ }
UINT idlstart = idl;
- for(DWORD i = 0; i < nStreams; i++, pObj = NULL, pUnk = NULL)
- {
+ for(DWORD i = 0; i < nStreams; i++, pObj = NULL, pUnk = NULL) {
m_ssarray.Add(pSS);
flags = group = 0;
wname = NULL;
pSS->Info(i, NULL, &flags, &lcid, &group, &wname, &pObj, &pUnk);
- if(group != prevgroup && idl > idlstart)
+ if(group != prevgroup && idl > idlstart) {
pSubSub->AppendMenu(MF_SEPARATOR|MF_ENABLED);
+ }
prevgroup = group;
- if(flags & AMSTREAMSELECTINFO_EXCLUSIVE)
- {
- }
- else if(flags & AMSTREAMSELECTINFO_ENABLED)
- {
+ if(flags & AMSTREAMSELECTINFO_EXCLUSIVE) {
+ } else if(flags & AMSTREAMSELECTINFO_ENABLED) {
}
- if(!wname)
- {
+ if(!wname) {
CStringW stream(ResStr(IDS_AG_UNKNOWN_STREAM));
wname = (WCHAR*)CoTaskMemAlloc((stream.GetLength()+3+1)*sizeof(WCHAR));
swprintf(wname, L"%s %d", stream, min(i+1,999));
@@ -12307,19 +11997,17 @@ void CMainFrame::SetupFiltersSubMenu() CoTaskMemFree(wname);
}
- if(nStreams == 0) pSS.Release();
+ if(nStreams == 0) {
+ pSS.Release();
+ }
}
- if(nPPages == 1 && !pSS)
- {
+ if(nPPages == 1 && !pSS) {
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ids, name);
- }
- else
- {
+ } else {
pSub->AppendMenu(MF_BYPOSITION|MF_STRING|MF_DISABLED|MF_GRAYED, idf, name);
- if(nPPages > 0 || pSS)
- {
+ if(nPPages > 0 || pSS) {
MENUITEMINFO mii;
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_STATE|MIIM_SUBMENU;
@@ -12343,31 +12031,33 @@ void CMainFrame::SetupAudioSwitcherSubMenu() {
CMenu* pSub = &m_audios;
- if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
- else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+ if(!IsMenu(pSub->m_hMenu)) {
+ pSub->CreatePopupMenu();
+ } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ ;
+ }
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
UINT id = ID_AUDIO_SUBITEM_START;
CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
- if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB);
+ if(!pSS) {
+ pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB);
+ }
- if(pSS)
- {
+ if(pSS) {
DWORD cStreams = 0;
- if(SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 0)
- {
+ if(SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 0) {
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_OPTIONS));
pSub->AppendMenu(MF_SEPARATOR|MF_ENABLED);
- for(int i = 0; i < (int)cStreams; i++)
- {
+ for(int i = 0; i < (int)cStreams; i++) {
WCHAR* pName = NULL;
POSITION idx = m_iAudioStreams.FindIndex(i);
int iStream = m_iAudioStreams.GetAt(idx);
- if(FAILED(pSS->Info(iStream, NULL, NULL, NULL, NULL, &pName, NULL, NULL))) // audio streams are reordered, so find the index from the initial order
+ if(FAILED(pSS->Info(iStream, NULL, NULL, NULL, NULL, &pName, NULL, NULL))) { // audio streams are reordered, so find the index from the initial order
break;
+ }
CString name(pName);
name.Replace(_T("&"), _T("&&"));
@@ -12385,18 +12075,21 @@ void CMainFrame::SetupSubtitlesSubMenu() {
CMenu* pSub = &m_subtitles;
- if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
- else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+ if(!IsMenu(pSub->m_hMenu)) {
+ pSub->CreatePopupMenu();
+ } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ ;
+ }
- if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly || !m_pCAP)
+ if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly || !m_pCAP) {
return;
+ }
UINT id = ID_SUBTITLES_SUBITEM_START;
POSITION pos = m_pSubStreams.GetHeadPosition();
- if(pos)
- {
+ if(pos) {
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_OPTIONS));
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_STYLES));
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_RELOAD));
@@ -12407,37 +12100,34 @@ void CMainFrame::SetupSubtitlesSubMenu() pSub->AppendMenu(MF_SEPARATOR);
}
- while(pos)
- {
+ while(pos) {
CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
- if(!pSubStream) continue;
+ if(!pSubStream) {
+ continue;
+ }
- for(int i = 0, j = pSubStream->GetStreamCount(); i < j; i++)
- {
+ for(int i = 0, j = pSubStream->GetStreamCount(); i < j; i++) {
WCHAR* pName = NULL;
- if(SUCCEEDED(pSubStream->GetStreamInfo(i, &pName, NULL)))
- {
+ if(SUCCEEDED(pSubStream->GetStreamInfo(i, &pName, NULL))) {
CString name(pName);
name.Replace(_T("&"), _T("&&"));
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, name);
CoTaskMemFree(pName);
- }
- else
- {
+ } else {
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_AG_UNKNOWN));
}
}
// TODO: find a better way to group these entries
- if(pos && m_pSubStreams.GetAt(pos))
- {
+ if(pos && m_pSubStreams.GetAt(pos)) {
CLSID cur, next;
pSubStream->GetClassID(&cur);
m_pSubStreams.GetAt(pos)->GetClassID(&next);
- if(cur != next)
+ if(cur != next) {
pSub->AppendMenu(MF_SEPARATOR);
+ }
}
}
}
@@ -12446,71 +12136,75 @@ void CMainFrame::SetupNavAudioSubMenu() {
CMenu* pSub = &m_navaudio;
- if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
- else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+ if(!IsMenu(pSub->m_hMenu)) {
+ pSub->CreatePopupMenu();
+ } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ ;
+ }
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
UINT id = ID_NAVIGATE_AUDIO_SUBITEM_START;
- if(GetPlaybackMode() == PM_FILE || (GetPlaybackMode() == PM_CAPTURE && AfxGetAppSettings().iDefaultCaptureDevice == 1))
- {
+ if(GetPlaybackMode() == PM_FILE || (GetPlaybackMode() == PM_CAPTURE && AfxGetAppSettings().iDefaultCaptureDevice == 1)) {
SetupNavStreamSelectSubMenu(pSub, id, 1);
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
ULONG ulStreamsAvailable, ulCurrentStream;
- if(FAILED(pDVDI->GetCurrentAudio(&ulStreamsAvailable, &ulCurrentStream)))
+ if(FAILED(pDVDI->GetCurrentAudio(&ulStreamsAvailable, &ulCurrentStream))) {
return;
+ }
LCID DefLanguage;
DVD_AUDIO_LANG_EXT ext;
- if(FAILED(pDVDI->GetDefaultAudioLanguage(&DefLanguage, &ext)))
+ if(FAILED(pDVDI->GetDefaultAudioLanguage(&DefLanguage, &ext))) {
return;
+ }
- for(ULONG i = 0; i < ulStreamsAvailable; i++)
- {
+ for(ULONG i = 0; i < ulStreamsAvailable; i++) {
LCID Language;
- if(FAILED(pDVDI->GetAudioLanguage(i, &Language)))
+ if(FAILED(pDVDI->GetAudioLanguage(i, &Language))) {
continue;
+ }
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
- if(Language == DefLanguage) flags |= MF_DEFAULT;
- if(i == ulCurrentStream) flags |= MF_CHECKED;
+ if(Language == DefLanguage) {
+ flags |= MF_DEFAULT;
+ }
+ if(i == ulCurrentStream) {
+ flags |= MF_CHECKED;
+ }
CString str(ResStr(IDS_AG_UNKNOWN));
- if(Language)
- {
+ if(Language) {
int len = GetLocaleInfo(Language, LOCALE_SENGLANGUAGE, str.GetBuffer(256), 256);
str.ReleaseBufferSetLength(max(len-1, 0));
}
DVD_AudioAttributes ATR;
- if(SUCCEEDED(pDVDI->GetAudioAttributes(i, &ATR)))
- {
- switch(ATR.LanguageExtension)
- {
- case DVD_AUD_EXT_NotSpecified:
- default:
- break;
- case DVD_AUD_EXT_Captions:
- str += _T(" (Captions)");
- break;
- case DVD_AUD_EXT_VisuallyImpaired:
- str += _T(" (Visually Impaired)");
- break;
- case DVD_AUD_EXT_DirectorComments1:
- str += ResStr(IDS_MAINFRM_121);
- break;
- case DVD_AUD_EXT_DirectorComments2:
- str += ResStr(IDS_MAINFRM_122);
- break;
+ if(SUCCEEDED(pDVDI->GetAudioAttributes(i, &ATR))) {
+ switch(ATR.LanguageExtension) {
+ case DVD_AUD_EXT_NotSpecified:
+ default:
+ break;
+ case DVD_AUD_EXT_Captions:
+ str += _T(" (Captions)");
+ break;
+ case DVD_AUD_EXT_VisuallyImpaired:
+ str += _T(" (Visually Impaired)");
+ break;
+ case DVD_AUD_EXT_DirectorComments1:
+ str += ResStr(IDS_MAINFRM_121);
+ break;
+ case DVD_AUD_EXT_DirectorComments2:
+ str += ResStr(IDS_MAINFRM_122);
+ break;
}
CString format = GetDVDAudioFormatName(ATR);
- if(!format.IsEmpty())
- {
+ if(!format.IsEmpty()) {
str.Format(ResStr(IDS_MAINFRM_11),
CString(str),
format,
@@ -12532,88 +12226,93 @@ void CMainFrame::SetupNavSubtitleSubMenu() {
CMenu* pSub = &m_navsubtitle;
- if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
- else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+ if(!IsMenu(pSub->m_hMenu)) {
+ pSub->CreatePopupMenu();
+ } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ ;
+ }
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
UINT id = ID_NAVIGATE_SUBP_SUBITEM_START;
- if(GetPlaybackMode() == PM_FILE || (GetPlaybackMode() == PM_CAPTURE && AfxGetAppSettings().iDefaultCaptureDevice == 1))
- {
+ if(GetPlaybackMode() == PM_FILE || (GetPlaybackMode() == PM_CAPTURE && AfxGetAppSettings().iDefaultCaptureDevice == 1)) {
SetupNavStreamSelectSubMenu(pSub, id, 2);
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
ULONG ulStreamsAvailable, ulCurrentStream;
BOOL bIsDisabled;
if(FAILED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled))
- || ulStreamsAvailable == 0)
+ || ulStreamsAvailable == 0) {
return;
+ }
LCID DefLanguage;
DVD_SUBPICTURE_LANG_EXT ext;
- if(FAILED(pDVDI->GetDefaultSubpictureLanguage(&DefLanguage, &ext)))
+ if(FAILED(pDVDI->GetDefaultSubpictureLanguage(&DefLanguage, &ext))) {
return;
+ }
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|(bIsDisabled?0:MF_CHECKED), id++, ResStr(IDS_AG_ENABLED));
pSub->AppendMenu(MF_BYCOMMAND|MF_SEPARATOR|MF_ENABLED);
- for(ULONG i = 0; i < ulStreamsAvailable; i++)
- {
+ for(ULONG i = 0; i < ulStreamsAvailable; i++) {
LCID Language;
- if(FAILED(pDVDI->GetSubpictureLanguage(i, &Language)))
+ if(FAILED(pDVDI->GetSubpictureLanguage(i, &Language))) {
continue;
+ }
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
- if(Language == DefLanguage) flags |= MF_DEFAULT;
- if(i == ulCurrentStream) flags |= MF_CHECKED;
+ if(Language == DefLanguage) {
+ flags |= MF_DEFAULT;
+ }
+ if(i == ulCurrentStream) {
+ flags |= MF_CHECKED;
+ }
CString str(ResStr(IDS_AG_UNKNOWN));
- if(Language)
- {
+ if(Language) {
int len = GetLocaleInfo(Language, LOCALE_SENGLANGUAGE, str.GetBuffer(256), 256);
str.ReleaseBufferSetLength(max(len-1, 0));
}
DVD_SubpictureAttributes ATR;
- if(SUCCEEDED(pDVDI->GetSubpictureAttributes(i, &ATR)))
- {
- switch(ATR.LanguageExtension)
- {
- case DVD_SP_EXT_NotSpecified:
- default:
- break;
- case DVD_SP_EXT_Caption_Normal:
- str += _T("");
- break;
- case DVD_SP_EXT_Caption_Big:
- str += _T(" (Big)");
- break;
- case DVD_SP_EXT_Caption_Children:
- str += _T(" (Children)");
- break;
- case DVD_SP_EXT_CC_Normal:
- str += _T(" (CC)");
- break;
- case DVD_SP_EXT_CC_Big:
- str += _T(" (CC Big)");
- break;
- case DVD_SP_EXT_CC_Children:
- str += _T(" (CC Children)");
- break;
- case DVD_SP_EXT_Forced:
- str += _T(" (Forced)");
- break;
- case DVD_SP_EXT_DirectorComments_Normal:
- str += _T(" (Director Comments)");
- break;
- case DVD_SP_EXT_DirectorComments_Big:
- str += _T(" (Director Comments, Big)");
- break;
- case DVD_SP_EXT_DirectorComments_Children:
- str += _T(" (Director Comments, Children)");
- break;
+ if(SUCCEEDED(pDVDI->GetSubpictureAttributes(i, &ATR))) {
+ switch(ATR.LanguageExtension) {
+ case DVD_SP_EXT_NotSpecified:
+ default:
+ break;
+ case DVD_SP_EXT_Caption_Normal:
+ str += _T("");
+ break;
+ case DVD_SP_EXT_Caption_Big:
+ str += _T(" (Big)");
+ break;
+ case DVD_SP_EXT_Caption_Children:
+ str += _T(" (Children)");
+ break;
+ case DVD_SP_EXT_CC_Normal:
+ str += _T(" (CC)");
+ break;
+ case DVD_SP_EXT_CC_Big:
+ str += _T(" (CC Big)");
+ break;
+ case DVD_SP_EXT_CC_Children:
+ str += _T(" (CC Children)");
+ break;
+ case DVD_SP_EXT_Forced:
+ str += _T(" (Forced)");
+ break;
+ case DVD_SP_EXT_DirectorComments_Normal:
+ str += _T(" (Director Comments)");
+ break;
+ case DVD_SP_EXT_DirectorComments_Big:
+ str += _T(" (Director Comments, Big)");
+ break;
+ case DVD_SP_EXT_DirectorComments_Children:
+ str += _T(" (Director Comments, Children)");
+ break;
}
}
@@ -12628,29 +12327,35 @@ void CMainFrame::SetupNavAngleSubMenu() {
CMenu* pSub = &m_navangle;
- if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
- else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+ if(!IsMenu(pSub->m_hMenu)) {
+ pSub->CreatePopupMenu();
+ } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ ;
+ }
- if(m_iMediaLoadState != MLS_LOADED) return;
+ if(m_iMediaLoadState != MLS_LOADED) {
+ return;
+ }
UINT id = ID_NAVIGATE_ANGLE_SUBITEM_START;
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
SetupNavStreamSelectSubMenu(pSub, id, 0);
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
ULONG ulStreamsAvailable, ulCurrentStream;
- if(FAILED(pDVDI->GetCurrentAngle(&ulStreamsAvailable, &ulCurrentStream)))
+ if(FAILED(pDVDI->GetCurrentAngle(&ulStreamsAvailable, &ulCurrentStream))) {
return;
+ }
- if(ulStreamsAvailable < 2) return; // one choice is not a choice...
+ if(ulStreamsAvailable < 2) {
+ return; // one choice is not a choice...
+ }
- for(ULONG i = 1; i <= ulStreamsAvailable; i++)
- {
+ for(ULONG i = 1; i <= ulStreamsAvailable; i++) {
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
- if(i == ulCurrentStream) flags |= MF_CHECKED;
+ if(i == ulCurrentStream) {
+ flags |= MF_CHECKED;
+ }
CString str;
str.Format(ResStr(IDS_AG_ANGLE), i);
@@ -12664,27 +12369,30 @@ void CMainFrame::SetupNavChaptersSubMenu() {
CMenu* pSub = &m_navchapters;
- if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
- else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+ if(!IsMenu(pSub->m_hMenu)) {
+ pSub->CreatePopupMenu();
+ } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ ;
+ }
- if(m_iMediaLoadState != MLS_LOADED)
+ if(m_iMediaLoadState != MLS_LOADED) {
return;
+ }
UINT id = ID_NAVIGATE_CHAP_SUBITEM_START;
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
SetupChapters();
REFERENCE_TIME rt = GetPos();
DWORD j = m_pCB->ChapLookup(&rt, NULL);
- for(DWORD i = 0; i < m_pCB->ChapGetCount(); i++, id++)
- {
+ for(DWORD i = 0; i < m_pCB->ChapGetCount(); i++, id++) {
rt = 0;
CComBSTR bstr;
- if(FAILED(m_pCB->ChapGet(i, &rt, &bstr)))
+ if(FAILED(m_pCB->ChapGet(i, &rt, &bstr))) {
continue;
+ }
int s = (int)((rt/10000000)%60);
int m = (int)((rt/10000000/60)%60);
@@ -12698,29 +12406,32 @@ void CMainFrame::SetupNavChaptersSubMenu() name.Replace(_T("\t"), _T(" "));
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
- if(i == j) flags |= MF_CHECKED;
- if(id != ID_NAVIGATE_CHAP_SUBITEM_START && i == 0) pSub->AppendMenu(MF_SEPARATOR);
+ if(i == j) {
+ flags |= MF_CHECKED;
+ }
+ if(id != ID_NAVIGATE_CHAP_SUBITEM_START && i == 0) {
+ pSub->AppendMenu(MF_SEPARATOR);
+ }
pSub->AppendMenu(flags, id, name + '\t' + time);
}
- if(m_wndPlaylistBar.GetCount() > 1)
- {
+ if(m_wndPlaylistBar.GetCount() > 1) {
POSITION pos = m_wndPlaylistBar.m_pl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
- if(pos == m_wndPlaylistBar.m_pl.GetPos()) flags |= MF_CHECKED;
- if(id != ID_NAVIGATE_CHAP_SUBITEM_START && pos == m_wndPlaylistBar.m_pl.GetHeadPosition())
+ if(pos == m_wndPlaylistBar.m_pl.GetPos()) {
+ flags |= MF_CHECKED;
+ }
+ if(id != ID_NAVIGATE_CHAP_SUBITEM_START && pos == m_wndPlaylistBar.m_pl.GetHeadPosition()) {
pSub->AppendMenu(MF_SEPARATOR);
+ }
CPlaylistItem& pli = m_wndPlaylistBar.m_pl.GetNext(pos);
CString name = pli.GetLabel();
name.Replace(_T("&"), _T("&&"));
pSub->AppendMenu(flags, id++, name);
}
}
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
+ } else if(GetPlaybackMode() == PM_DVD) {
ULONG ulNumOfVolumes, ulVolume;
DVD_DISC_SIDE Side;
ULONG ulNumOfTitles = 0;
@@ -12735,11 +12446,14 @@ void CMainFrame::SetupNavChaptersSubMenu() ULONG ulUOPs = 0;
pDVDI->GetCurrentUOPS(&ulUOPs);
- for(ULONG i = 1; i <= ulNumOfTitles; i++)
- {
+ for(ULONG i = 1; i <= ulNumOfTitles; i++) {
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
- if(i == Location.TitleNum) flags |= MF_CHECKED;
- if(ulUOPs&UOP_FLAG_Play_Title) flags |= MF_DISABLED|MF_GRAYED;
+ if(i == Location.TitleNum) {
+ flags |= MF_CHECKED;
+ }
+ if(ulUOPs&UOP_FLAG_Play_Title) {
+ flags |= MF_DISABLED|MF_GRAYED;
+ }
CString str;
str.Format(ResStr(IDS_AG_TITLE), i);
@@ -12747,31 +12461,34 @@ void CMainFrame::SetupNavChaptersSubMenu() pSub->AppendMenu(flags, id++, str);
}
- for(ULONG i = 1; i <= ulNumOfChapters; i++)
- {
+ for(ULONG i = 1; i <= ulNumOfChapters; i++) {
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
- if(i == Location.ChapterNum) flags |= MF_CHECKED;
- if(ulUOPs&UOP_FLAG_Play_Chapter) flags |= MF_DISABLED|MF_GRAYED;
- if(i == 1) flags |= MF_MENUBARBREAK;
+ if(i == Location.ChapterNum) {
+ flags |= MF_CHECKED;
+ }
+ if(ulUOPs&UOP_FLAG_Play_Chapter) {
+ flags |= MF_DISABLED|MF_GRAYED;
+ }
+ if(i == 1) {
+ flags |= MF_MENUBARBREAK;
+ }
CString str;
str.Format(ResStr(IDS_AG_CHAPTER), i);
pSub->AppendMenu(flags, id++, str);
}
- }
- else if(GetPlaybackMode() == PM_CAPTURE && AfxGetAppSettings().iDefaultCaptureDevice == 1)
- {
+ } else if(GetPlaybackMode() == PM_CAPTURE && AfxGetAppSettings().iDefaultCaptureDevice == 1) {
AppSettings& s = AfxGetAppSettings();
POSITION pos = s.m_DVBChannels.GetHeadPosition();
- while (pos)
- {
+ while (pos) {
CDVBChannel& Channel = s.m_DVBChannels.GetNext(pos);
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
- if (Channel.GetPrefNumber() == s.nDVBLastChannel)
+ if (Channel.GetPrefNumber() == s.nDVBLastChannel) {
flags |= MF_CHECKED;
+ }
pSub->AppendMenu(flags, ID_NAVIGATE_CHAP_SUBITEM_START + Channel.GetPrefNumber(), Channel.GetName());
}
}
@@ -12782,9 +12499,15 @@ IBaseFilter* CMainFrame::FindSourceSelectableFilter() IBaseFilter* pSF = NULL;
pSF = FindFilter(CLSID_OggSplitter, pGB);
- if(!pSF) pSF = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGB);
- if(!pSF) pSF = FindFilter(__uuidof(CMpegSplitterFilter), pGB);
- if(!pSF) pSF = FindFilter(__uuidof(CMpegSourceFilter), pGB);
+ if(!pSF) {
+ pSF = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGB);
+ }
+ if(!pSF) {
+ pSF = FindFilter(__uuidof(CMpegSplitterFilter), pGB);
+ }
+ if(!pSF) {
+ pSF = FindFilter(__uuidof(CMpegSourceFilter), pGB);
+ }
return pSF;
}
@@ -12794,63 +12517,71 @@ void CMainFrame::SetupNavStreamSelectSubMenu(CMenu* pSub, UINT id, DWORD dwSelGr UINT baseid = id;
CComQIPtr<IAMStreamSelect> pSS = FindSourceSelectableFilter();
- if (!pSS) pSS = pGB;
- if(!pSS) return;
+ if (!pSS) {
+ pSS = pGB;
+ }
+ if(!pSS) {
+ return;
+ }
DWORD cStreams;
- if(FAILED(pSS->Count(&cStreams)))
+ if(FAILED(pSS->Count(&cStreams))) {
return;
+ }
DWORD dwPrevGroup = (DWORD)-1;
- for(int i = 0, j = cStreams; i < j; i++)
- {
+ for(int i = 0, j = cStreams; i < j; i++) {
DWORD dwFlags, dwGroup;
LCID lcid;
WCHAR* pszName = NULL;
if(FAILED(pSS->Info(i, NULL, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))
- || !pszName)
+ || !pszName) {
continue;
+ }
CString name(pszName);
CString lcname = CString(name).MakeLower();
- if(pszName) CoTaskMemFree(pszName);
+ if(pszName) {
+ CoTaskMemFree(pszName);
+ }
- if(dwGroup != dwSelGroup)
+ if(dwGroup != dwSelGroup) {
continue;
+ }
- if(dwPrevGroup != -1 && dwPrevGroup != dwGroup)
+ if(dwPrevGroup != -1 && dwPrevGroup != dwGroup) {
pSub->AppendMenu(MF_SEPARATOR);
+ }
dwPrevGroup = dwGroup;
CString str;
- if(lcname.Find(_T(" off")) >= 0)
- {
+ if(lcname.Find(_T(" off")) >= 0) {
str = ResStr(IDS_AG_DISABLED);
- }
- else
- {
- if(lcid == 0)
- {
+ } else {
+ if(lcid == 0) {
str.Format(ResStr(IDS_AG_UNKNOWN), id - baseid);
- }
- else
- {
+ } else {
int len = GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, str.GetBuffer(64), 64);
str.ReleaseBufferSetLength(max(len-1, 0));
}
CString lcstr = CString(str).MakeLower();
- if(str.IsEmpty() || lcname.Find(lcstr) >= 0) str = name;
- else if(!name.IsEmpty()) str = CString(name) + _T(" (") + str + _T(")");
+ if(str.IsEmpty() || lcname.Find(lcstr) >= 0) {
+ str = name;
+ } else if(!name.IsEmpty()) {
+ str = CString(name) + _T(" (") + str + _T(")");
+ }
}
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
- if(dwFlags) flags |= MF_CHECKED;
+ if(dwFlags) {
+ flags |= MF_CHECKED;
+ }
str.Replace(_T("&"), _T("&&"));
pSub->AppendMenu(flags, id++, str);
@@ -12860,30 +12591,37 @@ void CMainFrame::SetupNavStreamSelectSubMenu(CMenu* pSub, UINT id, DWORD dwSelGr void CMainFrame::OnNavStreamSelectSubMenu(UINT id, DWORD dwSelGroup)
{
CComQIPtr<IAMStreamSelect> pSS = FindSourceSelectableFilter();
- if (!pSS) pSS = pGB;
- if(!pSS) return;
+ if (!pSS) {
+ pSS = pGB;
+ }
+ if(!pSS) {
+ return;
+ }
DWORD cStreams;
- if(FAILED(pSS->Count(&cStreams)))
+ if(FAILED(pSS->Count(&cStreams))) {
return;
+ }
- for(int i = 0, j = cStreams; i < j; i++)
- {
+ for(int i = 0, j = cStreams; i < j; i++) {
DWORD dwFlags, dwGroup;
LCID lcid;
WCHAR* pszName = NULL;
if(FAILED(pSS->Info(i, NULL, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))
- || !pszName)
+ || !pszName) {
continue;
+ }
- if(pszName) CoTaskMemFree(pszName);
+ if(pszName) {
+ CoTaskMemFree(pszName);
+ }
- if(dwGroup != dwSelGroup)
+ if(dwGroup != dwSelGroup) {
continue;
+ }
- if(id == 0)
- {
+ if(id == 0) {
pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE);
break;
}
@@ -12896,33 +12634,31 @@ void CMainFrame::SetupRecentFilesSubMenu() {
CMenu* pSub = &m_recentfiles;
- if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
- else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+ if(!IsMenu(pSub->m_hMenu)) {
+ pSub->CreatePopupMenu();
+ } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ ;
+ }
UINT id = ID_RECENT_FILE_START;
CRecentFileList& MRU = AfxGetAppSettings().MRU;
MRU.ReadList();
int mru_count=0;
- for(int i = 0; i < MRU.GetSize(); i++)
- {
- if(!MRU[i].IsEmpty())
- {
+ for(int i = 0; i < MRU.GetSize(); i++) {
+ if(!MRU[i].IsEmpty()) {
mru_count++;
break;
}
}
- if(mru_count)
- {
+ if(mru_count) {
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_RECENT_FILES_CLEAR, ResStr(IDS_RECENT_FILES_CLEAR));
pSub->AppendMenu(MF_SEPARATOR|MF_ENABLED);
}
- for(int i = 0; i < MRU.GetSize(); i++)
- {
+ for(int i = 0; i < MRU.GetSize(); i++) {
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
- if(!MRU[i].IsEmpty())
- {
+ if(!MRU[i].IsEmpty()) {
pSub->AppendMenu(flags, id, MRU[i]);
}
id++;
@@ -12933,8 +12669,11 @@ void CMainFrame::SetupFavoritesSubMenu() {
CMenu* pSub = &m_favorites;
- if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
- else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+ if(!IsMenu(pSub->m_hMenu)) {
+ pSub->CreatePopupMenu();
+ } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ ;
+ }
AppSettings& s = AfxGetAppSettings();
@@ -12949,8 +12688,7 @@ void CMainFrame::SetupFavoritesSubMenu() AfxGetAppSettings().GetFav(FAV_FILE, sl);
POSITION pos = sl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
CString str = sl.GetNext(pos);
@@ -12962,40 +12700,38 @@ void CMainFrame::SetupFavoritesSubMenu() str = sl.RemoveHead();
- if(!sl.IsEmpty())
- {
+ if(!sl.IsEmpty()) {
bool bPositionDataPresent = false;
// pos
REFERENCE_TIME rt = 0;
- if(1 == _stscanf_s(sl.GetHead(), _T("%I64d"), &rt) && rt > 0)
- {
+ if(1 == _stscanf_s(sl.GetHead(), _T("%I64d"), &rt) && rt > 0) {
DVD_HMSF_TIMECODE hmsf = RT2HMSF(rt, 0);
str.Format(_T("%s\t[%02d:%02d:%02d]"), CString(str), hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds);
bPositionDataPresent = true;
}
// relative drive
- if ( sl.GetCount() > 1 ) // Here to prevent crash if old favorites settings are present
- {
+ if ( sl.GetCount() > 1 ) { // Here to prevent crash if old favorites settings are present
sl.RemoveHead();
BOOL bRelativeDrive = FALSE;
- if ( _stscanf_s(sl.GetHead(), _T("%d"), &bRelativeDrive) == 1 )
- {
+ if ( _stscanf_s(sl.GetHead(), _T("%d"), &bRelativeDrive) == 1 ) {
str.Format(_T("%s%s[RD: %s]"), CString(str), bPositionDataPresent ? _T(" ") : _T("\t"), bRelativeDrive ? _T("On") : _T("Off"));
}
}
}
- if(!str.IsEmpty())
+ if(!str.IsEmpty()) {
pSub->AppendMenu(flags, id, str);
+ }
id++;
}
- if(id > ID_FAVORITES_FILE_START)
+ if(id > ID_FAVORITES_FILE_START) {
pSub->InsertMenu(nLastGroupStart, MF_SEPARATOR|MF_ENABLED|MF_BYPOSITION);
+ }
nLastGroupStart = pSub->GetMenuItemCount();
@@ -13004,8 +12740,7 @@ void CMainFrame::SetupFavoritesSubMenu() s.GetFav(FAV_DVD, sl);
pos = sl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
CString str = sl.GetNext(pos);
@@ -13016,19 +12751,20 @@ void CMainFrame::SetupFavoritesSubMenu() str = sl.RemoveHead();
- if(!sl.IsEmpty())
- {
+ if(!sl.IsEmpty()) {
// TODO
}
- if(!str.IsEmpty())
+ if(!str.IsEmpty()) {
pSub->AppendMenu(flags, id, str);
+ }
id++;
}
- if(id > ID_FAVORITES_DVD_START)
+ if(id > ID_FAVORITES_DVD_START) {
pSub->InsertMenu(nLastGroupStart, MF_SEPARATOR|MF_ENABLED|MF_BYPOSITION);
+ }
nLastGroupStart = pSub->GetMenuItemCount();
@@ -13037,8 +12773,7 @@ void CMainFrame::SetupFavoritesSubMenu() s.GetFav(FAV_DEVICE, sl);
pos = sl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
CString str = sl.GetNext(pos);
@@ -13049,8 +12784,9 @@ void CMainFrame::SetupFavoritesSubMenu() str = sl.RemoveHead();
- if(!str.IsEmpty())
+ if(!str.IsEmpty()) {
pSub->AppendMenu(flags, id, str);
+ }
id++;
}
@@ -13061,14 +12797,16 @@ void CMainFrame::SetupShadersSubMenu() {
CMenu* pSub = &m_shaders;
- if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
- else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+ if(!IsMenu(pSub->m_hMenu)) {
+ pSub->CreatePopupMenu();
+ } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ ;
+ }
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_OFF, ResStr(IDS_SHADER_OFF));
- if(POSITION pos = AfxGetAppSettings().m_shaders.GetHeadPosition())
- {
+ if(POSITION pos = AfxGetAppSettings().m_shaders.GetHeadPosition()) {
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_COMBINE, ResStr(IDS_SHADER_COMBINE));
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_EDIT, ResStr(IDS_SHADER_EDIT));
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADER_TOGGLE, ResStr(IDS_SHADER_TOGGLE));
@@ -13085,8 +12823,7 @@ void CMainFrame::SetupShadersSubMenu() mii.cbSize = sizeof(mii);
mii.fMask |= MIIM_DATA;
- while(pos)
- {
+ while(pos) {
const AppSettings::Shader& s = AfxGetAppSettings().m_shaders.GetNext(pos);
CString label = s.label;
label.Replace(_T("&"), _T("&&"));
@@ -13108,30 +12845,35 @@ void CMainFrame::ShowControls(int nCS, bool fSave) m_pLastBar = NULL;
POSITION pos = m_bars.GetHeadPosition();
- for(int i = 1; pos; i <<= 1)
- {
+ for(int i = 1; pos; i <<= 1) {
CControlBar* pNext = m_bars.GetNext(pos);
ShowControlBar(pNext, !!(nCS&i), TRUE);
- if(nCS&i) m_pLastBar = pNext;
+ if(nCS&i) {
+ m_pLastBar = pNext;
+ }
CSize s = pNext->CalcFixedLayout(FALSE, TRUE);
- if(nCSprev&i) hbefore += s.cy;
- if(nCS&i) hafter += s.cy;
+ if(nCSprev&i) {
+ hbefore += s.cy;
+ }
+ if(nCS&i) {
+ hafter += s.cy;
+ }
}
WINDOWPLACEMENT wp;
wp.length = sizeof(wp);
GetWindowPlacement(&wp);
- if(wp.showCmd != SW_SHOWMAXIMIZED && !m_fFullScreen)
- {
+ if(wp.showCmd != SW_SHOWMAXIMIZED && !m_fFullScreen) {
CRect r;
GetWindowRect(r);
MoveWindow(r.left, r.top, r.Width(), r.Height()+(hafter-hbefore));
}
- if(fSave)
+ if(fSave) {
AfxGetAppSettings().nCS = nCS;
+ }
RecalcLayout();
}
@@ -13140,23 +12882,22 @@ void CMainFrame::SetAlwaysOnTop(int i) {
AfxGetAppSettings().iOnTop = i;
- if(!m_fFullScreen)
- {
+ if(!m_fFullScreen) {
const CWnd* pInsertAfter = NULL;
- if(i == 0)
+ if(i == 0) {
pInsertAfter = &wndNoTopMost;
- else if(i == 1)
+ } else if(i == 1) {
pInsertAfter = &wndTopMost;
- else // if(i == 2)
+ } else { // if(i == 2)
pInsertAfter = GetMediaState() == State_Running ? &wndTopMost : &wndNoTopMost;
+ }
SetWindowPos(pInsertAfter, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
- }
- else if(!(GetWindowLong(m_hWnd, GWL_EXSTYLE)&WS_EX_TOPMOST))
- {
- if (!AfxGetAppSettings().IsD3DFullscreen())
+ } else if(!(GetWindowLong(m_hWnd, GWL_EXSTYLE)&WS_EX_TOPMOST)) {
+ if (!AfxGetAppSettings().IsD3DFullscreen()) {
SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+ }
}
}
@@ -13165,13 +12906,15 @@ void CMainFrame::SetAlwaysOnTop(int i) bool DoesSubPrecede(const CComPtr<ISubStream> &a, const CComPtr<ISubStream> &b)
{
WCHAR *pName;
- if(!SUCCEEDED(a->GetStreamInfo(0, &pName, NULL)))
+ if(!SUCCEEDED(a->GetStreamInfo(0, &pName, NULL))) {
return false;
+ }
CStringW nameA(pName);
CoTaskMemFree(pName);
- if(!SUCCEEDED(b->GetStreamInfo(0, &pName, NULL)))
+ if(!SUCCEEDED(b->GetStreamInfo(0, &pName, NULL))) {
return false;
+ }
CStringW nameB(pName);
CoTaskMemFree(pName);
@@ -13180,17 +12923,19 @@ bool DoesSubPrecede(const CComPtr<ISubStream> &a, const CComPtr<ISubStream> &b) CStringW slo = AfxGetAppSettings().strSubtitlesLanguageOrder;
int tPos = 0;
CStringW lang = slo.Tokenize(_T(",; "), tPos);
- while(tPos != -1 && ia == -1 && ib == -1)
- {
+ while(tPos != -1 && ia == -1 && ib == -1) {
int ll = lang.GetLength();
- if(nameA.Left(ll).CompareNoCase(lang) == 0)
+ if(nameA.Left(ll).CompareNoCase(lang) == 0) {
ia = tPos;
- if(nameB.Left(ll).CompareNoCase(lang) == 0)
+ }
+ if(nameB.Left(ll).CompareNoCase(lang) == 0) {
ib = tPos;
+ }
lang = slo.Tokenize(_T(",; "), tPos);
}
- if(ia != -1 && ib == -1)
+ if(ia != -1 && ib == -1) {
return true;
+ }
return false;
}
@@ -13200,48 +12945,52 @@ ISubStream *InsertSubStream(CInterfaceList<ISubStream> *subStreams, const CComPt POSITION pos = subStreams->GetHeadPosition();
POSITION newPos = NULL;
bool processed = false;
- while(!processed && pos)
- {
+ while(!processed && pos) {
POSITION prevPos = pos;
CComPtr<ISubStream> pSubStream = subStreams->GetNext(pos);
- if(DoesSubPrecede(theSubStream, pSubStream))
- {
- if(prevPos == subStreams->GetHeadPosition())
+ if(DoesSubPrecede(theSubStream, pSubStream)) {
+ if(prevPos == subStreams->GetHeadPosition()) {
newPos = subStreams->AddHead(theSubStream);
- else
+ } else {
newPos = subStreams->InsertBefore(prevPos, theSubStream);
+ }
processed = true;
}
}
- if(!processed)
+ if(!processed) {
newPos = subStreams->AddTail(theSubStream);
- if(newPos == NULL)
+ }
+ if(newPos == NULL) {
newPos = subStreams->GetTailPosition();
- if(newPos == NULL)
+ }
+ if(newPos == NULL) {
return NULL;
+ }
return subStreams->GetAt(newPos);
}
void CMainFrame::AddTextPassThruFilter()
{
- BeginEnumFilters(pGB, pEF, pBF)
- {
- if(!IsSplitter(pBF)) continue;
+ BeginEnumFilters(pGB, pEF, pBF) {
+ if(!IsSplitter(pBF)) {
+ continue;
+ }
- BeginEnumPins(pBF, pEP, pPin)
- {
+ BeginEnumPins(pBF, pEP, pPin) {
CComPtr<IPin> pPinTo;
AM_MEDIA_TYPE mt;
if(FAILED(pPin->ConnectedTo(&pPinTo)) || !pPinTo
|| FAILED(pPin->ConnectionMediaType(&mt))
- || mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle)
+ || mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle) {
continue;
+ }
CComQIPtr<IBaseFilter> pTPTF = DNew CTextPassThruFilter(this);
CStringW name;
name.Format(L"TextPassThru%08x", pTPTF);
- if(FAILED(pGB->AddFilter(pTPTF, name)))
+ if(FAILED(pGB->AddFilter(pTPTF, name))) {
continue;
+ }
HRESULT hr;
@@ -13249,10 +12998,9 @@ void CMainFrame::AddTextPassThruFilter() hr = pPin->Disconnect();
if(FAILED(hr = pGB->ConnectDirect(pPin, GetFirstPin(pTPTF, PINDIR_INPUT), NULL))
- || FAILED(hr = pGB->ConnectDirect(GetFirstPin(pTPTF, PINDIR_OUTPUT), pPinTo, NULL)))
+ || FAILED(hr = pGB->ConnectDirect(GetFirstPin(pTPTF, PINDIR_OUTPUT), pPinTo, NULL))) {
hr = pGB->ConnectDirect(pPin, pPinTo, NULL);
- else
- {
+ } else {
InsertSubStream(&m_pSubStreams, CComQIPtr<ISubStream>(pTPTF));
}
}
@@ -13266,33 +13014,30 @@ bool CMainFrame::LoadSubtitle(CString fn, ISubStream **actualStream) CComPtr<ISubStream> pSubStream;
// TMP: maybe this will catch something for those who get a runtime error dialog when opening subtitles from cds
- try
- {
- if(!pSubStream)
- {
+ try {
+ if(!pSubStream) {
CAutoPtr<CVobSubFile> pVSF(DNew CVobSubFile(&m_csSubLock));
- if(CString(CPath(fn).GetExtension()).MakeLower() == _T(".idx") && pVSF && pVSF->Open(fn) && pVSF->GetStreamCount() > 0)
+ if(CString(CPath(fn).GetExtension()).MakeLower() == _T(".idx") && pVSF && pVSF->Open(fn) && pVSF->GetStreamCount() > 0) {
pSubStream = pVSF.Detach();
+ }
}
- if(!pSubStream)
- {
+ if(!pSubStream) {
CAutoPtr<CRenderedTextSubtitle> pRTS(DNew CRenderedTextSubtitle(&m_csSubLock, &AfxGetAppSettings().subdefstyle, AfxGetAppSettings().fUseDefaultSubtitlesStyle));
- if(pRTS && pRTS->Open(fn, DEFAULT_CHARSET) && pRTS->GetStreamCount() > 0)
+ if(pRTS && pRTS->Open(fn, DEFAULT_CHARSET) && pRTS->GetStreamCount() > 0) {
pSubStream = pRTS.Detach();
+ }
}
- }
- catch(CException* e)
- {
+ } catch(CException* e) {
e->Delete();
}
- if(pSubStream)
- {
+ if(pSubStream) {
//m_pSubStreams.AddTail(pSubStream);
ISubStream *r = InsertSubStream(&m_pSubStreams, pSubStream);
- if(actualStream != NULL)
+ if(actualStream != NULL) {
*actualStream = r;
+ }
}
return(!!pSubStream);
@@ -13300,26 +13045,24 @@ bool CMainFrame::LoadSubtitle(CString fn, ISubStream **actualStream) void CMainFrame::UpdateSubtitle(bool fDisplayMessage, bool fApplyDefStyle)
{
- if(!m_pCAP) return;
+ if(!m_pCAP) {
+ return;
+ }
int i = m_iSubtitleSel;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos && i >= 0)
- {
+ while(pos && i >= 0) {
CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
- if(i < pSubStream->GetStreamCount())
- {
+ if(i < pSubStream->GetStreamCount()) {
CAutoLock cAutoLock(&m_csSubLock);
pSubStream->SetStream(i);
SetSubtitle(pSubStream, fApplyDefStyle);
- if (fDisplayMessage)
- {
+ if (fDisplayMessage) {
WCHAR* pName = NULL;
- if(SUCCEEDED(pSubStream->GetStreamInfo(0, &pName, NULL)))
- {
+ if(SUCCEEDED(pSubStream->GetStreamInfo(0, &pName, NULL))) {
CString strMessage;
strMessage.Format(ResStr(IDS_MAINFRM_45), pName, _T(""));
m_OSD.DisplayMessage (OSD_TOPLEFT, strMessage);
@@ -13331,8 +13074,9 @@ void CMainFrame::UpdateSubtitle(bool fDisplayMessage, bool fApplyDefStyle) i -= pSubStream->GetStreamCount();
}
- if (fDisplayMessage && m_iSubtitleSel < 0)
+ if (fDisplayMessage && m_iSubtitleSel < 0) {
m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_MAINFRM_44));
+ }
m_pCAP->SetSubPicProvider(NULL);
}
@@ -13341,41 +13085,31 @@ void CMainFrame::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle) {
AppSettings& s = AfxGetAppSettings();
- if(pSubStream)
- {
+ if(pSubStream) {
CLSID clsid;
pSubStream->GetClassID(&clsid);
- if(clsid == __uuidof(CVobSubFile))
- {
+ if(clsid == __uuidof(CVobSubFile)) {
CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)pSubStream;
- if(fApplyDefStyle)
- {
+ if(fApplyDefStyle) {
pVSF->SetAlignment(s.fOverridePlacement, s.nHorPos, s.nVerPos, 1, 1);
}
- }
- else if(clsid == __uuidof(CVobSubStream))
- {
+ } else if(clsid == __uuidof(CVobSubStream)) {
CVobSubStream* pVSS = (CVobSubStream*)(ISubStream*)pSubStream;
- if(fApplyDefStyle)
- {
+ if(fApplyDefStyle) {
pVSS->SetAlignment(s.fOverridePlacement, s.nHorPos, s.nVerPos, 1, 1);
}
- }
- else if(clsid == __uuidof(CRenderedTextSubtitle))
- {
+ } else if(clsid == __uuidof(CRenderedTextSubtitle)) {
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream;
STSStyle style;
- if(fApplyDefStyle || pRTS->m_fUsingAutoGeneratedDefaultStyle)
- {
+ if(fApplyDefStyle || pRTS->m_fUsingAutoGeneratedDefaultStyle) {
style = s.subdefstyle;
- if(s.fOverridePlacement)
- {
+ if(s.fOverridePlacement) {
style.scrAlignment = 2;
int w = pRTS->m_dstScreenSize.cx;
int h = pRTS->m_dstScreenSize.cy;
@@ -13389,8 +13123,7 @@ void CMainFrame::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle) UNUSED_ALWAYS(res);
}
- if(pRTS->GetDefaultStyle(style) && style.relativeTo == 2)
- {
+ if(pRTS->GetDefaultStyle(style) && style.relativeTo == 2) {
style.relativeTo = s.subdefstyle.relativeTo;
pRTS->SetDefaultStyle(style);
}
@@ -13401,22 +13134,18 @@ void CMainFrame::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle) }
}
- if(!fApplyDefStyle)
- {
+ if(!fApplyDefStyle) {
m_iSubtitleSel = -1;
- if(pSubStream)
- {
+ if(pSubStream) {
int i = 0;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CComPtr<ISubStream> pSubStream2 = m_pSubStreams.GetNext(pos);
- if(pSubStream == pSubStream2)
- {
+ if(pSubStream == pSubStream2) {
m_iSubtitleSel = i + pSubStream2->GetStream();
break;
}
@@ -13429,8 +13158,7 @@ void CMainFrame::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle) m_nSubtitleId = (DWORD_PTR)pSubStream;
- if(m_pCAP)
- {
+ if(m_pCAP) {
m_pCAP->SetSubPicProvider(CComQIPtr<ISubPicProvider>(pSubStream));
m_wndSubresyncBar.SetSubtitle(pSubStream, m_pCAP->GetFPS());
}
@@ -13439,11 +13167,9 @@ void CMainFrame::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle) void CMainFrame::ReplaceSubtitle(ISubStream* pSubStreamOld, ISubStream* pSubStreamNew)
{
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
POSITION cur = pos;
- if(pSubStreamOld == m_pSubStreams.GetNext(pos))
- {
+ if(pSubStreamOld == m_pSubStreams.GetNext(pos)) {
m_pSubStreams.SetAt(cur, pSubStreamNew);
UpdateSubtitle();
break;
@@ -13453,33 +13179,32 @@ void CMainFrame::ReplaceSubtitle(ISubStream* pSubStreamOld, ISubStream* pSubStre void CMainFrame::InvalidateSubtitle(DWORD_PTR nSubtitleId, REFERENCE_TIME rtInvalidate)
{
- if(m_pCAP)
- {
- if(nSubtitleId == -1 || nSubtitleId == m_nSubtitleId)
+ if(m_pCAP) {
+ if(nSubtitleId == -1 || nSubtitleId == m_nSubtitleId) {
m_pCAP->Invalidate(rtInvalidate);
+ }
}
}
void CMainFrame::ReloadSubtitle()
{
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos) m_pSubStreams.GetNext(pos)->Reload();
+ while(pos) {
+ m_pSubStreams.GetNext(pos)->Reload();
+ }
UpdateSubtitle();
}
void CMainFrame::SetSubtitleTrackIdx(int index)
{
- if(m_iMediaLoadState == MLS_LOADED)
- {
- if (index < 0)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
+ if (index < 0) {
m_iSubtitleSel ^= 0x80000000;
- }
- else
- {
+ } else {
POSITION pos = m_pSubStreams.FindIndex(index);
- if(pos)
+ if(pos) {
m_iSubtitleSel = index;
+ }
}
UpdateSubtitle();
AfxGetAppSettings().fEnableSubtitles = !(m_iSubtitleSel & 0x80000000);
@@ -13488,16 +13213,18 @@ void CMainFrame::SetSubtitleTrackIdx(int index) void CMainFrame::SetAudioTrackIdx(int index)
{
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
- if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); // morgan's switcher
+ if(!pSS) {
+ pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); // morgan's switcher
+ }
DWORD cStreams = 0;
DWORD dwFlags = AMSTREAMSELECTENABLE_ENABLE;
if(pSS && SUCCEEDED(pSS->Count(&cStreams)))
- if((index >= 0) && (index < ((int)cStreams)))
+ if((index >= 0) && (index < ((int)cStreams))) {
pSS->Enable(index, dwFlags);
+ }
}
}
@@ -13517,11 +13244,12 @@ void CMainFrame::SeekTo(REFERENCE_TIME rtPos, bool fSeekToKeyFrame) {
OAFilterState fs = GetMediaState();
- if(rtPos < 0) rtPos = 0;
+ if(rtPos < 0) {
+ rtPos = 0;
+ }
m_nStepForwardCount = 0;
- if(GetPlaybackMode() != PM_CAPTURE)
- {
+ if(GetPlaybackMode() != PM_CAPTURE) {
__int64 start, stop;
m_wndSeekBar.GetRange(start, stop);
GUID tf;
@@ -13530,38 +13258,34 @@ void CMainFrame::SeekTo(REFERENCE_TIME rtPos, bool fSeekToKeyFrame) m_OSD.DisplayMessage(OSD_TOPLEFT, m_wndStatusBar.GetStatusTimer(), 1500);
}
- if(GetPlaybackMode() == PM_FILE)
- {
- if(fs == State_Stopped)
+ if(GetPlaybackMode() == PM_FILE) {
+ if(fs == State_Stopped) {
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
HRESULT hr;
- if(fSeekToKeyFrame)
- {
- if(!m_kfs.IsEmpty())
- {
+ if(fSeekToKeyFrame) {
+ if(!m_kfs.IsEmpty()) {
int i = rangebsearch(rtPos, m_kfs);
- if(i >= 0 && i < m_kfs.GetCount())
+ if(i >= 0 && i < m_kfs.GetCount()) {
rtPos = m_kfs[i];
+ }
}
}
hr = pMS->SetPositions(&rtPos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
- }
- else if(GetPlaybackMode() == PM_DVD && m_iDVDDomain == DVD_DOMAIN_Title)
- {
- if(fs != State_Running)
+ } else if(GetPlaybackMode() == PM_DVD && m_iDVDDomain == DVD_DOMAIN_Title) {
+ if(fs != State_Running) {
SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
DVD_HMSF_TIMECODE tc = RT2HMSF(rtPos);
pDVDC->PlayAtTime(&tc, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
-// if(fs != State_Running)
-// SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
- }
- else if(GetPlaybackMode() == PM_CAPTURE)
- {
+ // if(fs != State_Running)
+ // SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ } else if(GetPlaybackMode() == PM_CAPTURE) {
TRACE(_T("Warning (CMainFrame::SeekTo): Trying to seek in capture mode"));
}
m_fEndOfStream = false;
@@ -13571,25 +13295,28 @@ void CMainFrame::SeekTo(REFERENCE_TIME rtPos, bool fSeekToKeyFrame) void CMainFrame::CleanGraph()
{
- if(!pGB) return;
+ if(!pGB) {
+ return;
+ }
- BeginEnumFilters(pGB, pEF, pBF)
- {
+ BeginEnumFilters(pGB, pEF, pBF) {
CComQIPtr<IAMFilterMiscFlags> pAMMF(pBF);
- if(pAMMF && (pAMMF->GetMiscFlags()&AM_FILTER_MISC_FLAGS_IS_SOURCE))
+ if(pAMMF && (pAMMF->GetMiscFlags()&AM_FILTER_MISC_FLAGS_IS_SOURCE)) {
continue;
+ }
// some capture filters forget to set AM_FILTER_MISC_FLAGS_IS_SOURCE
// or to implement the IAMFilterMiscFlags interface
- if(pBF == pVidCap || pBF == pAudCap)
+ if(pBF == pVidCap || pBF == pAudCap) {
continue;
+ }
- if(CComQIPtr<IFileSourceFilter>(pBF))
+ if(CComQIPtr<IFileSourceFilter>(pBF)) {
continue;
+ }
int nIn, nOut, nInC, nOutC;
- if(CountPins(pBF, nIn, nOut, nInC, nOutC) > 0 && (nInC+nOutC) == 0)
- {
+ if(CountPins(pBF, nIn, nOut, nInC, nOutC) > 0 && (nInC+nOutC) == 0) {
TRACE(CStringW(L"Removing: ") + GetFilterName(pBF) + '\n');
pGB->RemoveFilter(pBF);
@@ -13603,10 +13330,8 @@ void CMainFrame::CleanGraph() static void SetLatency(IBaseFilter* pBF, int cbBuffer)
{
- BeginEnumPins(pBF, pEP, pPin)
- {
- if(CComQIPtr<IAMBufferNegotiation> pAMBN = pPin)
- {
+ BeginEnumPins(pBF, pEP, pPin) {
+ if(CComQIPtr<IAMBufferNegotiation> pAMBN = pPin) {
ALLOCATOR_PROPERTIES ap;
ap.cbAlign = -1; // -1 means no preference.
ap.cbBuffer = cbBuffer;
@@ -13624,35 +13349,38 @@ HRESULT CMainFrame::BuildCapture(IPin* pPin, IBaseFilter* pBF[3], const GUID& ma IBaseFilter* pEnc = pBF[1];
IBaseFilter* pMux = pBF[2];
- if(!pPin || !pMux) return E_FAIL;
+ if(!pPin || !pMux) {
+ return E_FAIL;
+ }
CString err;
HRESULT hr = S_OK;
CFilterInfo fi;
- if(FAILED(pMux->QueryFilterInfo(&fi)) || !fi.pGraph)
+ if(FAILED(pMux->QueryFilterInfo(&fi)) || !fi.pGraph) {
pGB->AddFilter(pMux, L"Multiplexer");
+ }
CStringW prefix, prefixl;
- if(majortype == MEDIATYPE_Video) prefix = L"Video ";
- else if(majortype == MEDIATYPE_Audio) prefix = L"Audio ";
+ if(majortype == MEDIATYPE_Video) {
+ prefix = L"Video ";
+ } else if(majortype == MEDIATYPE_Audio) {
+ prefix = L"Audio ";
+ }
prefixl = prefix;
prefixl.MakeLower();
- if(pBuff)
- {
+ if(pBuff) {
hr = pGB->AddFilter(pBuff, prefix + L"Buffer");
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
err = _T("Can't add ") + CString(prefixl) + _T("buffer filter");
AfxMessageBox(err);
return hr;
}
hr = pGB->ConnectFilter(pPin, pBuff);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
err = _T("Error connecting the ") + CString(prefixl) + _T("buffer filter");
AfxMessageBox(err);
return(hr);
@@ -13661,19 +13389,16 @@ HRESULT CMainFrame::BuildCapture(IPin* pPin, IBaseFilter* pBF[3], const GUID& ma pPin = GetFirstPin(pBuff, PINDIR_OUTPUT);
}
- if(pEnc)
- {
+ if(pEnc) {
hr = pGB->AddFilter(pEnc, prefix + L"Encoder");
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
err = _T("Can't add ") + CString(prefixl) + _T("encoder filter");
AfxMessageBox(err);
return hr;
}
hr = pGB->ConnectFilter(pPin, pEnc);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
err = _T("Error connecting the ") + CString(prefixl) + _T("encoder filter");
AfxMessageBox(err);
return(hr);
@@ -13681,13 +13406,10 @@ HRESULT CMainFrame::BuildCapture(IPin* pPin, IBaseFilter* pBF[3], const GUID& ma pPin = GetFirstPin(pEnc, PINDIR_OUTPUT);
- if(CComQIPtr<IAMStreamConfig> pAMSC = pPin)
- {
- if(pmt->majortype == majortype)
- {
+ if(CComQIPtr<IAMStreamConfig> pAMSC = pPin) {
+ if(pmt->majortype == majortype) {
hr = pAMSC->SetFormat(pmt);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
err = _T("Can't set compression format on the ") + CString(prefixl) + _T("encoder filter");
AfxMessageBox(err);
return(hr);
@@ -13697,11 +13419,10 @@ HRESULT CMainFrame::BuildCapture(IPin* pPin, IBaseFilter* pBF[3], const GUID& ma }
-// if(pMux)
+ // if(pMux)
{
hr = pGB->ConnectFilter(pPin, pMux);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
err = _T("Error connecting ") + CString(prefixl) + _T(" to the muliplexer filter");
AfxMessageBox(err);
return(hr);
@@ -13724,12 +13445,10 @@ bool CMainFrame::BuildToCapturePreviewPin( CComPtr<IPin> pDVAudPin;
- if(pVidCap)
- {
+ if(pVidCap) {
CComPtr<IPin> pPin;
if(!pAudCap // only look for interleaved stream when we don't use any other audio capture source
- && SUCCEEDED(pCGB->FindPin(pVidCap, PINDIR_OUTPUT, &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved, TRUE, 0, &pPin)))
- {
+ && SUCCEEDED(pCGB->FindPin(pVidCap, PINDIR_OUTPUT, &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved, TRUE, 0, &pPin))) {
CComPtr<IBaseFilter> pDVSplitter;
hr = pDVSplitter.CoCreateInstance(CLSID_DVSplitter);
hr = pGB->AddFilter(pDVSplitter, L"DV Splitter");
@@ -13748,12 +13467,8 @@ bool CMainFrame::BuildToCapturePreviewPin( pPin = NULL;
hr = pCGB->FindPin(pDVDec, PINDIR_OUTPUT, NULL, &MEDIATYPE_Video, TRUE, 0, &pPin);
- }
- else if(SUCCEEDED(pCGB->FindPin(pVidCap, PINDIR_OUTPUT, &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, TRUE, 0, &pPin)))
- {
- }
- else
- {
+ } else if(SUCCEEDED(pCGB->FindPin(pVidCap, PINDIR_OUTPUT, &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, TRUE, 0, &pPin))) {
+ } else {
AfxMessageBox(_T("No video capture pin was found"));
return(false);
}
@@ -13768,18 +13483,12 @@ bool CMainFrame::BuildToCapturePreviewPin( hr = pSmartTee->FindPin(L"Capture", ppVidCapPin);
}
- if(pAudCap || pDVAudPin)
- {
+ if(pAudCap || pDVAudPin) {
CComPtr<IPin> pPin;
- if(pDVAudPin)
- {
+ if(pDVAudPin) {
pPin = pDVAudPin;
- }
- else if(SUCCEEDED(pCGB->FindPin(pAudCap, PINDIR_OUTPUT, &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, TRUE, 0, &pPin)))
- {
- }
- else
- {
+ } else if(SUCCEEDED(pCGB->FindPin(pAudCap, PINDIR_OUTPUT, &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, TRUE, 0, &pPin))) {
+ } else {
AfxMessageBox(_T("No audio capture pin was found"));
return(false);
}
@@ -13799,7 +13508,9 @@ bool CMainFrame::BuildToCapturePreviewPin( bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPreview, bool fACapture)
{
- if(!pCGB) return(false);
+ if(!pCGB) {
+ return(false);
+ }
SaveMediaState;
@@ -13810,9 +13521,15 @@ bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPrevi CleanGraph();
- if(pAMVSCCap) hr = pAMVSCCap->SetFormat(&m_wndCaptureBar.m_capdlg.m_mtv);
- if(pAMVSCPrev) hr = pAMVSCPrev->SetFormat(&m_wndCaptureBar.m_capdlg.m_mtv);
- if(pAMASC) hr = pAMASC->SetFormat(&m_wndCaptureBar.m_capdlg.m_mta);
+ if(pAMVSCCap) {
+ hr = pAMVSCCap->SetFormat(&m_wndCaptureBar.m_capdlg.m_mtv);
+ }
+ if(pAMVSCPrev) {
+ hr = pAMVSCPrev->SetFormat(&m_wndCaptureBar.m_capdlg.m_mtv);
+ }
+ if(pAMASC) {
+ hr = pAMASC->SetFormat(&m_wndCaptureBar.m_capdlg.m_mta);
+ }
CComPtr<IBaseFilter> pVidBuffer = m_wndCaptureBar.m_capdlg.m_pVidBuffer;
CComPtr<IBaseFilter> pAudBuffer = m_wndCaptureBar.m_capdlg.m_pAudBuffer;
@@ -13826,30 +13543,30 @@ bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPrevi bool fFileOutput = (pMux && pDst) || (pAudMux && pAudDst);
bool fCapture = (fVCapture || fACapture);
- if(pAudCap)
- {
+ if(pAudCap) {
AM_MEDIA_TYPE* pmt = &m_wndCaptureBar.m_capdlg.m_mta;
int ms = (fACapture && fFileOutput && m_wndCaptureBar.m_capdlg.m_fAudOutput) ? AUDIOBUFFERLEN : 60;
- if(pMux != pAudMux && fACapture) SetLatency(pAudCap, -1);
- else if(pmt->pbFormat) SetLatency(pAudCap, ((WAVEFORMATEX*)pmt->pbFormat)->nAvgBytesPerSec * ms / 1000);
+ if(pMux != pAudMux && fACapture) {
+ SetLatency(pAudCap, -1);
+ } else if(pmt->pbFormat) {
+ SetLatency(pAudCap, ((WAVEFORMATEX*)pmt->pbFormat)->nAvgBytesPerSec * ms / 1000);
+ }
}
CComPtr<IPin> pVidCapPin, pVidPrevPin, pAudCapPin, pAudPrevPin;
BuildToCapturePreviewPin(pVidCap, &pVidCapPin, &pVidPrevPin, pAudCap, &pAudCapPin, &pAudPrevPin);
-// if(pVidCap)
+ // if(pVidCap)
{
bool fVidPrev = pVidPrevPin && fVPreview;
bool fVidCap = pVidCapPin && fVCapture && fFileOutput && m_wndCaptureBar.m_capdlg.m_fVidOutput;
- if(fVPreview == 2 && !fVidCap && pVidCapPin)
- {
+ if(fVPreview == 2 && !fVidCap && pVidCapPin) {
pVidPrevPin = pVidCapPin;
pVidCapPin = NULL;
}
- if(fVidPrev)
- {
+ if(fVidPrev) {
m_pCAP = NULL;
m_pCAP2 = NULL;
pGB->Render(pVidPrevPin);
@@ -13857,8 +13574,7 @@ bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPrevi pGB->FindInterface(__uuidof(ISubPicAllocatorPresenter2), (void**)&m_pCAP2, TRUE);
}
- if(fVidCap)
- {
+ if(fVidCap) {
IBaseFilter* pBF[3] = {pVidBuffer, pVidEnc, pMux};
HRESULT hr = BuildCapture(pVidCapPin, pBF, MEDIATYPE_Video, &m_wndCaptureBar.m_capdlg.m_mtcv);
UNUSED_ALWAYS(hr);
@@ -13868,59 +13584,52 @@ bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPrevi pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMDroppedFrames, (void**)&pAMDF);
}
-// if(pAudCap)
+ // if(pAudCap)
{
bool fAudPrev = pAudPrevPin && fAPreview;
bool fAudCap = pAudCapPin && fACapture && fFileOutput && m_wndCaptureBar.m_capdlg.m_fAudOutput;
- if(fAPreview == 2 && !fAudCap && pAudCapPin)
- {
+ if(fAPreview == 2 && !fAudCap && pAudCapPin) {
pAudPrevPin = pAudCapPin;
pAudCapPin = NULL;
}
- if(fAudPrev)
- {
+ if(fAudPrev) {
pGB->Render(pAudPrevPin);
}
- if(fAudCap)
- {
+ if(fAudCap) {
IBaseFilter* pBF[3] = {pAudBuffer, pAudEnc, pAudMux ? pAudMux : pMux};
HRESULT hr = BuildCapture(pAudCapPin, pBF, MEDIATYPE_Audio, &m_wndCaptureBar.m_capdlg.m_mtca);
UNUSED_ALWAYS(hr);
}
}
- if((pVidCap || pAudCap) && fCapture && fFileOutput)
- {
- if(pMux != pDst)
- {
+ if((pVidCap || pAudCap) && fCapture && fFileOutput) {
+ if(pMux != pDst) {
hr = pGB->AddFilter(pDst, L"File Writer V/A");
hr = pGB->ConnectFilter(GetFirstPin(pMux, PINDIR_OUTPUT), pDst);
}
- if(CComQIPtr<IConfigAviMux> pCAM = pMux)
- {
+ if(CComQIPtr<IConfigAviMux> pCAM = pMux) {
int nIn, nOut, nInC, nOutC;
CountPins(pMux, nIn, nOut, nInC, nOutC);
pCAM->SetMasterStream(nInC-1);
-// pCAM->SetMasterStream(-1);
+ // pCAM->SetMasterStream(-1);
pCAM->SetOutputCompatibilityIndex(FALSE);
}
- if(CComQIPtr<IConfigInterleaving> pCI = pMux)
- {
-// if(FAILED(pCI->put_Mode(INTERLEAVE_CAPTURE)))
- if(FAILED(pCI->put_Mode(INTERLEAVE_NONE_BUFFERED)))
+ if(CComQIPtr<IConfigInterleaving> pCI = pMux) {
+ // if(FAILED(pCI->put_Mode(INTERLEAVE_CAPTURE)))
+ if(FAILED(pCI->put_Mode(INTERLEAVE_NONE_BUFFERED))) {
pCI->put_Mode(INTERLEAVE_NONE);
+ }
REFERENCE_TIME rtInterleave = 10000i64*AUDIOBUFFERLEN, rtPreroll = 0;//10000i64*500
pCI->put_Interleaving(&rtInterleave, &rtPreroll);
}
- if(pMux != pAudMux && pAudMux != pAudDst)
- {
+ if(pMux != pAudMux && pAudMux != pAudDst) {
hr = pGB->AddFilter(pAudDst, L"File Writer A");
hr = pGB->ConnectFilter(GetFirstPin(pAudMux, PINDIR_OUTPUT), pAudDst);
}
@@ -13943,16 +13652,20 @@ bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPrevi bool CMainFrame::StartCapture()
{
- if(!pCGB || m_fCapturing) return(false);
+ if(!pCGB || m_fCapturing) {
+ return(false);
+ }
- if(!m_wndCaptureBar.m_capdlg.m_pMux && !m_wndCaptureBar.m_capdlg.m_pDst) return(false);
+ if(!m_wndCaptureBar.m_capdlg.m_pMux && !m_wndCaptureBar.m_capdlg.m_pDst) {
+ return(false);
+ }
HRESULT hr;
::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS);
// rare to see two capture filters to support IAMPushSource at the same time...
-// hr = CComQIPtr<IAMGraphStreams>(pGB)->SyncUsingStreamOffset(TRUE); // TODO:
+ // hr = CComQIPtr<IAMGraphStreams>(pGB)->SyncUsingStreamOffset(TRUE); // TODO:
BuildGraphVideoAudio(
m_wndCaptureBar.m_capdlg.m_fVidPreview, true,
@@ -13969,9 +13682,13 @@ bool CMainFrame::StartCapture() bool CMainFrame::StopCapture()
{
- if(!pCGB || !m_fCapturing) return(false);
+ if(!pCGB || !m_fCapturing) {
+ return(false);
+ }
- if(!m_wndCaptureBar.m_capdlg.m_pMux && !m_wndCaptureBar.m_capdlg.m_pDst) return(false);
+ if(!m_wndCaptureBar.m_capdlg.m_pMux && !m_wndCaptureBar.m_capdlg.m_pDst) {
+ return(false);
+ }
HRESULT hr;
@@ -14001,11 +13718,11 @@ void CMainFrame::ShowOptions(int idPage) CPPageSheet options(ResStr(IDS_OPTIONS_CAPTION), pGB, GetModalParent(), idPage);
m_bInOptions = true;
- if(options.DoModal() == IDOK)
- {
+ if(options.DoModal() == IDOK) {
m_bInOptions = false;
- if(!m_fFullScreen)
+ if(!m_fFullScreen) {
SetAlwaysOnTop(s.iOnTop);
+ }
m_wndView.LoadLogo();
@@ -14018,14 +13735,16 @@ void CMainFrame::ShowOptions(int idPage) void CMainFrame::StartWebServer(int nPort)
{
- if(!m_pWebServer)
+ if(!m_pWebServer) {
m_pWebServer.Attach(DNew CWebServer(this, nPort));
+ }
}
void CMainFrame::StopWebServer()
{
- if(m_pWebServer)
+ if(m_pWebServer) {
m_pWebServer.Free();
+ }
}
CString CMainFrame::GetStatusMessage()
@@ -14040,7 +13759,9 @@ void CMainFrame::SendStatusMessage(CString msg, int nTimeOut) KillTimer(TIMER_STATUSERASER);
m_playingmsg.Empty();
- if(nTimeOut <= 0) return;
+ if(nTimeOut <= 0) {
+ return;
+ }
m_playingmsg = msg;
SetTimer(TIMER_STATUSERASER, nTimeOut, NULL);
@@ -14049,21 +13770,27 @@ void CMainFrame::SendStatusMessage(CString msg, int nTimeOut) void CMainFrame::OpenCurPlaylistItem(REFERENCE_TIME rtStart)
{
- if(m_wndPlaylistBar.GetCount() == 0)
+ if(m_wndPlaylistBar.GetCount() == 0) {
return;
+ }
CPlaylistItem pli;
- if(!m_wndPlaylistBar.GetCur(pli)) m_wndPlaylistBar.SetFirstSelected();
- if(!m_wndPlaylistBar.GetCur(pli)) return;
+ if(!m_wndPlaylistBar.GetCur(pli)) {
+ m_wndPlaylistBar.SetFirstSelected();
+ }
+ if(!m_wndPlaylistBar.GetCur(pli)) {
+ return;
+ }
CAutoPtr<OpenMediaData> p(m_wndPlaylistBar.GetCurOMD(rtStart));
- if(p) OpenMedia(p);
+ if(p) {
+ OpenMedia(p);
+ }
}
void CMainFrame::AddCurDevToPlaylist()
{
- if(GetPlaybackMode() == PM_CAPTURE)
- {
+ if(GetPlaybackMode() == PM_CAPTURE) {
m_wndPlaylistBar.Append(
m_VidDispName,
m_AudDispName,
@@ -14077,11 +13804,9 @@ void CMainFrame::AddCurDevToPlaylist() void CMainFrame::OpenMedia(CAutoPtr<OpenMediaData> pOMD)
{
// shortcut
- if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD.m_p))
- {
+ if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD.m_p)) {
if(m_iMediaLoadState == MLS_LOADED && pAMTuner
- && m_VidDispName == p->DisplayName[0] && m_AudDispName == p->DisplayName[1])
- {
+ && m_VidDispName == p->DisplayName[0] && m_AudDispName == p->DisplayName[1]) {
m_wndCaptureBar.m_capdlg.SetVideoInput(p->vinput);
m_wndCaptureBar.m_capdlg.SetVideoChannel(p->vchannel);
m_wndCaptureBar.m_capdlg.SetAudioInput(p->ainput);
@@ -14091,36 +13816,31 @@ void CMainFrame::OpenMedia(CAutoPtr<OpenMediaData> pOMD) }
}
- if(m_iMediaLoadState != MLS_CLOSED)
+ if(m_iMediaLoadState != MLS_CLOSED) {
CloseMedia();
+ }
-// m_iMediaLoadState = MLS_LOADING; // HACK: hides the logo
+ // m_iMediaLoadState = MLS_LOADING; // HACK: hides the logo
AppSettings& s = AfxGetAppSettings();
bool fUseThread = m_pGraphThread && AfxGetAppSettings().fEnableWorkerThreadForOpening;
- if(OpenFileData* p = dynamic_cast<OpenFileData*>(pOMD.m_p))
- {
- if(p->fns.GetCount() > 0)
- {
+ if(OpenFileData* p = dynamic_cast<OpenFileData*>(pOMD.m_p)) {
+ if(p->fns.GetCount() > 0) {
engine_t e = s.m_Formats.GetEngine(p->fns.GetHead());
- if (e != DirectShow /*&& e != RealMedia && e != QuickTime*/)
+ if (e != DirectShow /*&& e != RealMedia && e != QuickTime*/) {
fUseThread = false;
+ }
}
- }
- else if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD.m_p))
- {
+ } else if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD.m_p)) {
fUseThread = false;
}
- if(fUseThread)
- {
+ if(fUseThread) {
m_pGraphThread->PostThreadMessage(CGraphThread::TM_OPEN, 0, (LPARAM)pOMD.Detach());
m_bOpenedThruThread = true;
- }
- else
- {
+ } else {
OpenMediaPrivate(pOMD);
m_bOpenedThruThread = false;
}
@@ -14128,29 +13848,29 @@ void CMainFrame::OpenMedia(CAutoPtr<OpenMediaData> pOMD) bool CMainFrame::ResetDevice()
{
- if (m_pCAP)
+ if (m_pCAP) {
return m_pCAP->ResetDevice();
+ }
return true;
}
void CMainFrame::CloseMedia()
{
- if(m_iMediaLoadState == MLS_CLOSING)
- {
+ if(m_iMediaLoadState == MLS_CLOSING) {
TRACE(_T("WARNING: CMainFrame::CloseMedia() called twice or more\n"));
return;
}
int nTimeWaited = 0;
- while(m_iMediaLoadState == MLS_LOADING)
- {
+ while(m_iMediaLoadState == MLS_LOADING) {
m_fOpeningAborted = true;
- if(pGB) pGB->Abort(); // TODO: lock on graph objects somehow, this is not thread safe
+ if(pGB) {
+ pGB->Abort(); // TODO: lock on graph objects somehow, this is not thread safe
+ }
- if(nTimeWaited > 5*1000 && m_pGraphThread)
- {
+ if(nTimeWaited > 5*1000 && m_pGraphThread) {
MessageBeep(MB_ICONEXCLAMATION);
TRACE(_T("CRITICAL ERROR: !!! Must kill opener thread !!!"));
TerminateThread(m_pGraphThread->m_hThread, (DWORD)-1);
@@ -14172,29 +13892,28 @@ void CMainFrame::CloseMedia() OnFilePostClosemedia();
- if(m_pGraphThread && m_bOpenedThruThread)
- {
+ if(m_pGraphThread && m_bOpenedThruThread) {
CAMEvent e;
m_pGraphThread->PostThreadMessage(CGraphThread::TM_CLOSE, 0, (LPARAM)&e);
e.Wait(); // either opening or closing has to be blocked to prevent reentering them, closing is the better choice
- }
- else
- {
+ } else {
CloseMediaPrivate();
}
UnloadExternalObjects();
- if (m_pFullscreenWnd->IsWindow())
+ if (m_pFullscreenWnd->IsWindow()) {
m_pFullscreenWnd->ShowWindow (SW_HIDE);
+ }
}
void CMainFrame::StartTunerScan(CAutoPtr<TunerScanData> pTSD)
{
- if(m_pGraphThread)
+ if(m_pGraphThread) {
m_pGraphThread->PostThreadMessage(CGraphThread::TM_TUNER_SCAN, 0, (LPARAM)pTSD.Detach());
- else
+ } else {
DoTunerScan(pTSD);
+ }
}
void CMainFrame::StopTunerScan()
@@ -14210,15 +13929,17 @@ void CMainFrame::DisplayCurrentChannelOSD() int i = osd.Find(_T("\n"));
PresentFollowing NowNext;
- if (pChannel != NULL)
- {
+ if (pChannel != NULL) {
// Get EIT information:
CComQIPtr<IBDATuner> pTun = pGB;
- if (pTun)
+ if (pTun) {
pTun->UpdatePSI(NowNext);
+ }
NowNext.cPresent.Insert(0,_T(" "));
osd = pChannel->GetName()+ NowNext.cPresent;
- if(i > 0) osd.Delete(i, osd.GetLength()-i);
+ if(i > 0) {
+ osd.Delete(i, osd.GetLength()-i);
+ }
m_OSD.DisplayMessage(OSD_TOPLEFT, osd ,3500);
}
}
@@ -14230,16 +13951,18 @@ void CMainFrame::DisplayCurrentChannelInfo() CString osd;
PresentFollowing NowNext;
- if (pChannel != NULL)
- {
+ if (pChannel != NULL) {
// Get EIT information:
CComQIPtr<IBDATuner> pTun = pGB;
- if (pTun)
+ if (pTun) {
pTun->UpdatePSI(NowNext);
+ }
osd = NowNext.cPresent + _T(". ") + NowNext.StartTime + _T(" - ") + NowNext.Duration + _T(". ") + NowNext.SummaryDesc +_T(" ");
int i = osd.Find(_T("\n"));
- if(i > 0) osd.Delete(i, osd.GetLength()-i);
+ if(i > 0) {
+ osd.Delete(i, osd.GetLength()-i);
+ }
m_OSD.DisplayMessage(OSD_TOPLEFT, osd ,8000, 12);
}
}
@@ -14274,14 +13997,15 @@ END_MESSAGE_MAP() void CGraphThread::OnExit(WPARAM wParam, LPARAM lParam)
{
PostQuitMessage(0);
- if(CAMEvent* e = (CAMEvent*)lParam) e->Set();
+ if(CAMEvent* e = (CAMEvent*)lParam) {
+ e->Set();
+ }
}
void CGraphThread::OnOpen(WPARAM wParam, LPARAM lParam)
{
TRACE("--> CGraphThread::OnOpen on thread: %d\n", GetCurrentThreadId());
- if(m_pMainFrame)
- {
+ if(m_pMainFrame) {
CAutoPtr<OpenMediaData> pOMD((OpenMediaData*)lParam);
m_pMainFrame->OpenMediaPrivate(pOMD);
}
@@ -14289,25 +14013,31 @@ void CGraphThread::OnOpen(WPARAM wParam, LPARAM lParam) void CGraphThread::OnClose(WPARAM wParam, LPARAM lParam)
{
- if(m_pMainFrame) m_pMainFrame->CloseMediaPrivate();
- if(CAMEvent* e = (CAMEvent*)lParam) e->Set();
+ if(m_pMainFrame) {
+ m_pMainFrame->CloseMediaPrivate();
+ }
+ if(CAMEvent* e = (CAMEvent*)lParam) {
+ e->Set();
+ }
}
void CGraphThread::OnReset(WPARAM wParam, LPARAM lParam)
{
- if(m_pMainFrame)
- {
+ if(m_pMainFrame) {
BOOL* b = (BOOL*)wParam;
BOOL bResult = m_pMainFrame->ResetDevice();
- if (b) *b = bResult;
+ if (b) {
+ *b = bResult;
+ }
+ }
+ if(CAMEvent* e = (CAMEvent*)lParam) {
+ e->Set();
}
- if(CAMEvent* e = (CAMEvent*)lParam) e->Set();
}
void CGraphThread::OnTunerScan(WPARAM wParam, LPARAM lParam)
{
- if(m_pMainFrame)
- {
+ if(m_pMainFrame) {
CAutoPtr<TunerScanData> pTSD((TunerScanData*)lParam);
m_pMainFrame->DoTunerScan(pTSD);
}
@@ -14326,14 +14056,16 @@ void CMainFrame::SetPlayState(MPC_PLAYSTATE iState) m_Lcd.SetPlayState((CMPC_Lcd::PlayState)iState);
SendAPICommand (CMD_PLAYMODE, L"%d", iState);
- if (m_fEndOfStream)
- SendAPICommand (CMD_NOTIFYENDOFSTREAM, L"\0"); // do not pass NULL here!
+ if (m_fEndOfStream) {
+ SendAPICommand (CMD_NOTIFYENDOFSTREAM, L"\0"); // do not pass NULL here!
+ }
// Prevent sleep when playing audio and/or video, but allow screensaver when only audio
- if(!m_fAudioOnly)
+ if(!m_fAudioOnly) {
SetThreadExecutionState (iState == PS_PLAY ? ES_CONTINUOUS | ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED : ES_CONTINUOUS);
- else
+ } else {
SetThreadExecutionState (iState == PS_PLAY ? ES_CONTINUOUS | ES_SYSTEM_REQUIRED : ES_CONTINUOUS);
+ }
// Set thumbnails button state
UpdateThumbarButton();
@@ -14345,8 +14077,9 @@ bool CMainFrame::CreateFullScreenWindow() MONITORINFOEX MonitorInfo;
CRect MonitorRect;
- if (m_pFullscreenWnd->IsWindow())
+ if (m_pFullscreenWnd->IsWindow()) {
m_pFullscreenWnd->DestroyWindow();
+ }
ZeroMemory (&MonitorInfo, sizeof(MonitorInfo));
MonitorInfo.cbSize = sizeof(MonitorInfo);
@@ -14357,34 +14090,27 @@ bool CMainFrame::CreateFullScreenWindow() AppSettings& s = AfxGetAppSettings();
hMonitor = NULL;
- if(!s.iMonitor)
- {
- if(s.strFullScreenMonitor == _T("Current"))
- {
+ if(!s.iMonitor) {
+ if(s.strFullScreenMonitor == _T("Current")) {
hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
- }
- else
- {
- for ( int i = 0; i < monitors.GetCount(); i++ )
- {
+ } else {
+ for ( int i = 0; i < monitors.GetCount(); i++ ) {
monitor = monitors.GetMonitor( i );
monitor.GetName(str);
- if((monitor.IsMonitor()) && (s.strFullScreenMonitor == str))
- {
+ if((monitor.IsMonitor()) && (s.strFullScreenMonitor == str)) {
hMonitor = monitor;
break;
}
}
- if(!hMonitor) hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
+ if(!hMonitor) {
+ hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
+ }
}
- }
- else
- {
+ } else {
hMonitor = MonitorFromWindow (m_hWnd, 0);
}
- if (GetMonitorInfo (hMonitor, &MonitorInfo))
- {
+ if (GetMonitorInfo (hMonitor, &MonitorInfo)) {
MonitorRect = CRect (MonitorInfo.rcMonitor);
// Window creation
DWORD dwStyle = WS_POPUP | WS_VISIBLE ;
@@ -14392,7 +14118,7 @@ bool CMainFrame::CreateFullScreenWindow() m_fullWndSize.cy = MonitorRect.Height();
m_pFullscreenWnd->CreateEx (WS_EX_TOPMOST | WS_EX_TOOLWINDOW, _T(""), ResStr(IDS_MAINFRM_136), dwStyle, MonitorRect.left, MonitorRect.top, MonitorRect.Width(), MonitorRect.Height(), NULL, NULL, NULL);
-// SetWindowLong(m_pFullscreenWnd->m_hWnd, GWL_EXSTYLE, WS_EX_TOPMOST); // TODO : still freezing sometimes...
+ // SetWindowLong(m_pFullscreenWnd->m_hWnd, GWL_EXSTYLE, WS_EX_TOPMOST); // TODO : still freezing sometimes...
/*
CRect r;
GetWindowRect(r);
@@ -14420,8 +14146,7 @@ void CMainFrame::SetVMR9ColorControl(float dBrightness, float dContrast, float d {
VMR9ProcAmpControl ClrControl;
- if(m_pMC && !AfxGetAppSettings().m_RenderersSettings.fVMR9MixerYUV)
- {
+ if(m_pMC && !AfxGetAppSettings().m_RenderersSettings.fVMR9MixerYUV) {
ClrControl.dwSize = sizeof(ClrControl);
ClrControl.dwFlags = ProcAmpControl9_Mask;
ClrControl.Brightness = dBrightness;
@@ -14435,25 +14160,24 @@ void CMainFrame::SetVMR9ColorControl(float dBrightness, float dContrast, float d LPCTSTR CMainFrame::GetDVDAudioFormatName (DVD_AudioAttributes& ATR) const
{
- switch(ATR.AudioFormat)
- {
- case DVD_AudioFormat_AC3:
- return _T("AC3");
- case DVD_AudioFormat_MPEG1:
- case DVD_AudioFormat_MPEG1_DRC:
- return _T("MPEG1");
- case DVD_AudioFormat_MPEG2:
- case DVD_AudioFormat_MPEG2_DRC:
- return _T("MPEG2");
- case DVD_AudioFormat_LPCM:
- return _T("LPCM");
- case DVD_AudioFormat_DTS:
- return _T("DTS");
- case DVD_AudioFormat_SDDS:
- return _T("SDDS");
- case DVD_AudioFormat_Other:
- default:
- return ResStr(IDS_MAINFRM_137);
+ switch(ATR.AudioFormat) {
+ case DVD_AudioFormat_AC3:
+ return _T("AC3");
+ case DVD_AudioFormat_MPEG1:
+ case DVD_AudioFormat_MPEG1_DRC:
+ return _T("MPEG1");
+ case DVD_AudioFormat_MPEG2:
+ case DVD_AudioFormat_MPEG2_DRC:
+ return _T("MPEG2");
+ case DVD_AudioFormat_LPCM:
+ return _T("LPCM");
+ case DVD_AudioFormat_DTS:
+ return _T("DTS");
+ case DVD_AudioFormat_SDDS:
+ return _T("SDDS");
+ case DVD_AudioFormat_Other:
+ default:
+ return ResStr(IDS_MAINFRM_137);
}
}
@@ -14464,22 +14188,23 @@ afx_msg void CMainFrame::OnGotoSubtitle(UINT nID) m_rtCurSubPos = m_wndSeekBar.GetPosReal();
m_lSubtitleShift = 0;
m_nCurSubtitle = m_wndSubresyncBar.FindNearestSub (m_rtCurSubPos, (nID == ID_GOTO_NEXT_SUB));
- if ((m_nCurSubtitle != -1) && pMS)
+ if ((m_nCurSubtitle != -1) && pMS) {
pMS->SetPositions (&m_rtCurSubPos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+ }
}
afx_msg void CMainFrame::OnShiftSubtitle(UINT nID)
{
- if (m_nCurSubtitle >= 0)
- {
+ if (m_nCurSubtitle >= 0) {
long lShift = (nID == ID_SHIFT_SUB_DOWN) ? -100 : 100;
CString strSubShift;
- if (m_wndSubresyncBar.ShiftSubtitle (m_nCurSubtitle, lShift, m_rtCurSubPos))
- {
+ if (m_wndSubresyncBar.ShiftSubtitle (m_nCurSubtitle, lShift, m_rtCurSubPos)) {
m_lSubtitleShift += lShift;
- if (pMS) pMS->SetPositions (&m_rtCurSubPos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+ if (pMS) {
+ pMS->SetPositions (&m_rtCurSubPos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+ }
}
strSubShift.Format (ResStr(IDS_MAINFRM_138), m_lSubtitleShift);
@@ -14490,10 +14215,8 @@ afx_msg void CMainFrame::OnShiftSubtitle(UINT nID) afx_msg void CMainFrame::OnSubtitleDelay(UINT nID)
{
- if(m_pCAP)
- {
- if (m_pSubStreams.IsEmpty())
- {
+ if(m_pCAP) {
+ if (m_pSubStreams.IsEmpty()) {
SendStatusMessage(ResStr(IDS_SUBTITLES_ERROR), 3000);
return;
}
@@ -14501,10 +14224,11 @@ afx_msg void CMainFrame::OnSubtitleDelay(UINT nID) int newDelay;
int oldDelay = m_pCAP->GetSubtitleDelay();
- if(nID == ID_SUB_DELAY_DOWN)
+ if(nID == ID_SUB_DELAY_DOWN) {
newDelay = oldDelay-AfxGetAppSettings().nSubDelayInterval;
- else
+ } else {
newDelay = oldDelay+AfxGetAppSettings().nSubDelayInterval;
+ }
SetSubtitleDelay(newDelay);
}
@@ -14542,7 +14266,7 @@ afx_msg void CMainFrame::OnLanguage(UINT nID) m_hMenuDefault = DefaultMenu;
DefaultMenu.Detach();
// TODO : destroy old menu ???
-// OldMenu->DestroyMenu();
+ // OldMenu->DestroyMenu();
}
@@ -14552,11 +14276,11 @@ afx_msg void CMainFrame::OnUpdateLanguage(CCmdUI* pCmdUI) int nLang = pCmdUI->m_nID - ID_LANGUAGE_ENGLISH;
LPCTSTR strSatellite = AfxGetMyApp()->GetSatelliteDll(nLang);
- if (strSatellite)
- {
+ if (strSatellite) {
HMODULE lib = NULL;
- if ((lib = LoadLibrary(strSatellite)) != NULL)
+ if ((lib = LoadLibrary(strSatellite)) != NULL) {
FreeLibrary(lib);
+ }
pCmdUI->Enable(lib != NULL);
}
@@ -14571,107 +14295,107 @@ void CMainFrame::ProcessAPICommand(COPYDATASTRUCT* pCDS) REFERENCE_TIME rtPos = 0;
long lPos = 0;
- switch (pCDS->dwData)
- {
- case CMD_OPENFILE :
- fns.AddHead ((LPCWSTR)pCDS->lpData);
- m_wndPlaylistBar.Open(fns, false);
- OpenCurPlaylistItem();
- break;
- case CMD_STOP :
- OnPlayStop();
- break;
- case CMD_CLOSEFILE :
- CloseMedia();
- break;
- case CMD_PLAYPAUSE :
- OnPlayPlaypause();
- break;
- case CMD_ADDTOPLAYLIST :
- fns.AddHead ((LPCWSTR)pCDS->lpData);
- m_wndPlaylistBar.Append(fns, true);
- break;
- case CMD_STARTPLAYLIST :
- OpenCurPlaylistItem();
- break;
- case CMD_CLEARPLAYLIST :
- m_wndPlaylistBar.Empty();
- break;
- case CMD_SETPOSITION :
- DVD_HMSF_TIMECODE tcPos;
-
- lPos = _wtol ((LPCWSTR)pCDS->lpData);
- tcPos.bHours = lPos/3600;
- tcPos.bMinutes = (lPos/60) % 60;
- tcPos.bSeconds = lPos%60;
- rtPos = HMSF2RT(tcPos);
- // imianz: quick and dirty trick
- // Pause->SeekTo->Play (in place of SeekTo only) seems to prevents in most cases
- // some strange video effects on avi files (ex. locks a while and than running fast).
- if(!m_fAudioOnly)SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
- SeekTo(rtPos);
- if(!m_fAudioOnly)
- {
- SendMessage(WM_COMMAND, ID_PLAY_PLAY);
- // show current position overridden by play command
- m_OSD.DisplayMessage(OSD_TOPLEFT, m_wndStatusBar.GetStatusTimer(), 2000);
- }
- break;
- case CMD_SETAUDIODELAY :
- rtPos = _wtol ((LPCWSTR)pCDS->lpData) * 10000;
- SetAudioDelay (rtPos);
- break;
- case CMD_SETSUBTITLEDELAY :
- SetSubtitleDelay(_wtoi((LPCWSTR)pCDS->lpData));
- break;
- case CMD_SETINDEXPLAYLIST :
- //m_wndPlaylistBar.SetSelIdx(_wtoi((LPCWSTR)pCDS->lpData));
- break;
- case CMD_SETAUDIOTRACK :
- SetAudioTrackIdx(_wtoi((LPCWSTR)pCDS->lpData));
- break;
- case CMD_SETSUBTITLETRACK :
- SetSubtitleTrackIdx(_wtoi((LPCWSTR)pCDS->lpData));
- break;
- case CMD_GETSUBTITLETRACKS :
- SendSubtitleTracksToApi();
- break;
- case CMD_GETAUDIOTRACKS :
- SendAudioTracksToApi();
- break;
- case CMD_GETCURRENTPOSITION :
- SendCurrentPositionToApi();
- break;
- case CMD_JUMPOFNSECONDS :
- JumpOfNSeconds(_wtoi((LPCWSTR)pCDS->lpData));
- break;
- case CMD_GETPLAYLIST :
- SendPlaylistToApi();
- break;
- case CMD_JUMPFORWARDMED :
- OnPlaySeek(ID_PLAY_SEEKFORWARDMED);
- break;
- case CMD_JUMPBACKWARDMED :
- OnPlaySeek(ID_PLAY_SEEKBACKWARDMED);
- break;
- case CMD_TOGGLEFULLSCREEN :
- OnViewFullscreen();
- break;
- case CMD_INCREASEVOLUME :
- m_wndToolBar.m_volctrl.IncreaseVolume();
- break;
- case CMD_DECREASEVOLUME :
- m_wndToolBar.m_volctrl.DecreaseVolume();
- break;
- case CMD_SHADER_TOGGLE :
- OnShaderToggle();
- break;
- case CMD_CLOSEAPP :
- PostMessage(WM_CLOSE);
- break;
- case CMD_OSDSHOWMESSAGE:
- ShowOSDCustomMessageApi((MPC_OSDDATA *)pCDS->lpData);
- break;
+ switch (pCDS->dwData) {
+ case CMD_OPENFILE :
+ fns.AddHead ((LPCWSTR)pCDS->lpData);
+ m_wndPlaylistBar.Open(fns, false);
+ OpenCurPlaylistItem();
+ break;
+ case CMD_STOP :
+ OnPlayStop();
+ break;
+ case CMD_CLOSEFILE :
+ CloseMedia();
+ break;
+ case CMD_PLAYPAUSE :
+ OnPlayPlaypause();
+ break;
+ case CMD_ADDTOPLAYLIST :
+ fns.AddHead ((LPCWSTR)pCDS->lpData);
+ m_wndPlaylistBar.Append(fns, true);
+ break;
+ case CMD_STARTPLAYLIST :
+ OpenCurPlaylistItem();
+ break;
+ case CMD_CLEARPLAYLIST :
+ m_wndPlaylistBar.Empty();
+ break;
+ case CMD_SETPOSITION :
+ DVD_HMSF_TIMECODE tcPos;
+
+ lPos = _wtol ((LPCWSTR)pCDS->lpData);
+ tcPos.bHours = lPos/3600;
+ tcPos.bMinutes = (lPos/60) % 60;
+ tcPos.bSeconds = lPos%60;
+ rtPos = HMSF2RT(tcPos);
+ // imianz: quick and dirty trick
+ // Pause->SeekTo->Play (in place of SeekTo only) seems to prevents in most cases
+ // some strange video effects on avi files (ex. locks a while and than running fast).
+ if(!m_fAudioOnly) {
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
+ SeekTo(rtPos);
+ if(!m_fAudioOnly) {
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ // show current position overridden by play command
+ m_OSD.DisplayMessage(OSD_TOPLEFT, m_wndStatusBar.GetStatusTimer(), 2000);
+ }
+ break;
+ case CMD_SETAUDIODELAY :
+ rtPos = _wtol ((LPCWSTR)pCDS->lpData) * 10000;
+ SetAudioDelay (rtPos);
+ break;
+ case CMD_SETSUBTITLEDELAY :
+ SetSubtitleDelay(_wtoi((LPCWSTR)pCDS->lpData));
+ break;
+ case CMD_SETINDEXPLAYLIST :
+ //m_wndPlaylistBar.SetSelIdx(_wtoi((LPCWSTR)pCDS->lpData));
+ break;
+ case CMD_SETAUDIOTRACK :
+ SetAudioTrackIdx(_wtoi((LPCWSTR)pCDS->lpData));
+ break;
+ case CMD_SETSUBTITLETRACK :
+ SetSubtitleTrackIdx(_wtoi((LPCWSTR)pCDS->lpData));
+ break;
+ case CMD_GETSUBTITLETRACKS :
+ SendSubtitleTracksToApi();
+ break;
+ case CMD_GETAUDIOTRACKS :
+ SendAudioTracksToApi();
+ break;
+ case CMD_GETCURRENTPOSITION :
+ SendCurrentPositionToApi();
+ break;
+ case CMD_JUMPOFNSECONDS :
+ JumpOfNSeconds(_wtoi((LPCWSTR)pCDS->lpData));
+ break;
+ case CMD_GETPLAYLIST :
+ SendPlaylistToApi();
+ break;
+ case CMD_JUMPFORWARDMED :
+ OnPlaySeek(ID_PLAY_SEEKFORWARDMED);
+ break;
+ case CMD_JUMPBACKWARDMED :
+ OnPlaySeek(ID_PLAY_SEEKBACKWARDMED);
+ break;
+ case CMD_TOGGLEFULLSCREEN :
+ OnViewFullscreen();
+ break;
+ case CMD_INCREASEVOLUME :
+ m_wndToolBar.m_volctrl.IncreaseVolume();
+ break;
+ case CMD_DECREASEVOLUME :
+ m_wndToolBar.m_volctrl.DecreaseVolume();
+ break;
+ case CMD_SHADER_TOGGLE :
+ OnShaderToggle();
+ break;
+ case CMD_CLOSEAPP :
+ PostMessage(WM_CLOSE);
+ break;
+ case CMD_OSDSHOWMESSAGE:
+ ShowOSDCustomMessageApi((MPC_OSDDATA *)pCDS->lpData);
+ break;
}
}
@@ -14680,8 +14404,7 @@ void CMainFrame::SendAPICommand (MPCAPI_COMMAND nCommand, LPCWSTR fmt, ...) {
AppSettings& s = AfxGetAppSettings();
- if (s.hMasterWnd)
- {
+ if (s.hMasterWnd) {
COPYDATASTRUCT CDS;
TCHAR buff[800];
@@ -14702,12 +14425,12 @@ void CMainFrame::SendAPICommand (MPCAPI_COMMAND nCommand, LPCWSTR fmt, ...) void CMainFrame::SendNowPlayingToApi()
{
- if(!AfxGetAppSettings().hMasterWnd)
+ if(!AfxGetAppSettings().hMasterWnd) {
return;
+ }
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
CPlaylistItem pli;
CString title, author, description;
CString label;
@@ -14719,11 +14442,9 @@ void CMainFrame::SendNowPlayingToApi() m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_DESCRIPTION), description);
m_wndPlaylistBar.GetCur(pli);
- if(!pli.m_fns.IsEmpty())
- {
+ if(!pli.m_fns.IsEmpty()) {
label = !pli.m_label.IsEmpty() ? pli.m_label : pli.m_fns.GetHead();
- if(GetPlaybackMode() == PM_FILE)
- {
+ if(GetPlaybackMode() == PM_FILE) {
pMS->GetDuration(&rtDur);
DVD_HMSF_TIMECODE tcDur = RT2HMSF(rtDur);
lDuration = tcDur.bHours*60*60 + tcDur.bMinutes*60 + tcDur.bSeconds;
@@ -14773,47 +14494,37 @@ void CMainFrame::SendSubtitleTracksToApi() CStringW strSubs;
POSITION pos = m_pSubStreams.GetHeadPosition();
- if(m_iMediaLoadState == MLS_LOADED)
- {
- if (pos)
- {
- while(pos)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
+ if (pos) {
+ while(pos) {
CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
- for(int i = 0, j = pSubStream->GetStreamCount(); i < j; i++)
- {
+ for(int i = 0, j = pSubStream->GetStreamCount(); i < j; i++) {
WCHAR* pName = NULL;
- if(SUCCEEDED(pSubStream->GetStreamInfo(i, &pName, NULL)))
- {
+ if(SUCCEEDED(pSubStream->GetStreamInfo(i, &pName, NULL))) {
CString name(pName);
- if (!strSubs.IsEmpty())
+ if (!strSubs.IsEmpty()) {
strSubs.Append (L"|");
+ }
name.Replace(L"|", L"\\|");
strSubs.AppendFormat(L"%s", name);
CoTaskMemFree(pName);
}
}
}
- if(AfxGetAppSettings().fEnableSubtitles)
- {
- if(m_iSubtitleSel >= 0)
+ if(AfxGetAppSettings().fEnableSubtitles) {
+ if(m_iSubtitleSel >= 0) {
strSubs.AppendFormat(L"|%i", m_iSubtitleSel);
- else
+ } else {
strSubs.Append(L"|-1");
- }
- else
- {
+ }
+ } else {
strSubs.Append (L"|-1");
}
- }
- else
- {
+ } else {
strSubs.Append (L"-1");
}
- }
- else
- {
+ } else {
strSubs.Append (L"-2");
}
SendAPICommand (CMD_LISTSUBTITLETRACKS, strSubs);
@@ -14824,44 +14535,46 @@ void CMainFrame::SendAudioTracksToApi() {
CStringW strAudios;
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
- if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); // morgan's switcher
+ if(!pSS) {
+ pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); // morgan's switcher
+ }
DWORD cStreams = 0;
- if(pSS && SUCCEEDED(pSS->Count(&cStreams)))
- {
+ if(pSS && SUCCEEDED(pSS->Count(&cStreams))) {
int currentStream = -1;
- for(int i = 0; i < (int)cStreams; i++)
- {
+ for(int i = 0; i < (int)cStreams; i++) {
AM_MEDIA_TYPE* pmt = NULL;
DWORD dwFlags = 0;
LCID lcid = 0;
DWORD dwGroup = 0;
WCHAR* pszName = NULL;
- if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)))
+ if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))) {
return;
- if(dwFlags == AMSTREAMSELECTINFO_EXCLUSIVE)
+ }
+ if(dwFlags == AMSTREAMSELECTINFO_EXCLUSIVE) {
currentStream = i;
+ }
CString name(pszName);
- if (!strAudios.IsEmpty())
+ if (!strAudios.IsEmpty()) {
strAudios.Append (L"|");
+ }
name.Replace(L"|", L"\\|");
strAudios.AppendFormat(L"%s", name);
- if(pmt) DeleteMediaType(pmt);
- if(pszName) CoTaskMemFree(pszName);
+ if(pmt) {
+ DeleteMediaType(pmt);
+ }
+ if(pszName) {
+ CoTaskMemFree(pszName);
+ }
}
strAudios.AppendFormat(L"|%i", currentStream);
- }
- else
- {
+ } else {
strAudios.Append(L"-1");
}
- }
- else
- {
+ } else {
strAudios.Append(L"-2");
}
SendAPICommand (CMD_LISTAUDIOTRACKS, strAudios);
@@ -14875,43 +14588,41 @@ void CMainFrame::SendPlaylistToApi() int index;
POSITION pos = m_wndPlaylistBar.m_pl.GetHeadPosition(), pos2;
- while(pos)
- {
+ while(pos) {
CPlaylistItem& pli = m_wndPlaylistBar.m_pl.GetNext(pos);
- if(pli.m_type == CPlaylistItem::file)
- {
+ if(pli.m_type == CPlaylistItem::file) {
pos2 = pli.m_fns.GetHeadPosition();
- while(pos2)
- {
+ while(pos2) {
CString fn = pli.m_fns.GetNext(pos2);
- if (!strPlaylist.IsEmpty())
+ if (!strPlaylist.IsEmpty()) {
strPlaylist.Append (L"|");
+ }
fn.Replace(L"|", L"\\|");
strPlaylist.AppendFormat(L"%s", fn);
}
}
}
index = m_wndPlaylistBar.GetSelIdx();
- if (strPlaylist.IsEmpty())
+ if (strPlaylist.IsEmpty()) {
strPlaylist.Append(L"-1");
- else
+ } else {
strPlaylist.AppendFormat(L"|%i", index);
+ }
SendAPICommand (CMD_PLAYLIST, strPlaylist);
}
void CMainFrame::SendCurrentPositionToApi(bool fNotifySeek)
{
- if(!AfxGetAppSettings().hMasterWnd)
+ if(!AfxGetAppSettings().hMasterWnd) {
return;
+ }
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
long lPosition = 0;
REFERENCE_TIME rtCur;
- if(m_iPlaybackMode == PM_FILE)
- {
+ if(m_iPlaybackMode == PM_FILE) {
pMS->GetCurrentPosition(&rtCur);
DVD_HMSF_TIMECODE tcCur = RT2HMSF(rtCur);
lPosition = tcCur.bHours*60*60 + tcCur.bMinutes*60 + tcCur.bSeconds;
@@ -14931,13 +14642,11 @@ void CMainFrame::ShowOSDCustomMessageApi(MPC_OSDDATA *osdData) void CMainFrame::JumpOfNSeconds(int nSeconds)
{
- if(m_iMediaLoadState == MLS_LOADED)
- {
+ if(m_iMediaLoadState == MLS_LOADED) {
long lPosition = 0;
REFERENCE_TIME rtCur;
- if(m_iPlaybackMode == PM_FILE)
- {
+ if(m_iPlaybackMode == PM_FILE) {
pMS->GetCurrentPosition(&rtCur);
DVD_HMSF_TIMECODE tcCur = RT2HMSF(rtCur);
lPosition = tcCur.bHours*60*60 + tcCur.bMinutes*60 + tcCur.bSeconds + nSeconds;
@@ -14951,10 +14660,11 @@ void CMainFrame::JumpOfNSeconds(int nSeconds) // quick and dirty trick:
// pause->seekto->play seems to prevents some strange
// video effect (ex. locks for a while and than running fast)
- if(!m_fAudioOnly)SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ if(!m_fAudioOnly) {
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
SeekTo(rtCur);
- if(!m_fAudioOnly)
- {
+ if(!m_fAudioOnly) {
SendMessage(WM_COMMAND, ID_PLAY_PLAY);
// show current position overridden by play command
m_OSD.DisplayMessage(OSD_TOPLEFT, m_wndStatusBar.GetStatusTimer(), 2000);
@@ -15066,7 +14776,9 @@ void CMainFrame::JumpOfNSeconds(int nSeconds) void CMainFrame::OnFileOpendirectory()
{
- if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar)) return;
+ if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar)) {
+ return;
+ }
AppSettings& s = AfxGetAppSettings();
@@ -15092,24 +14804,24 @@ void CMainFrame::OnFileOpendirectory() static LPITEMIDLIST iil;
iil = SHBrowseForFolder(&bi);
- if(iil)
- {
+ if(iil) {
SHGetPathFromIDList(iil, path);
CString _path = path;
_path.Replace('/', '\\');
- if(_path[_path.GetLength()-1] != '\\') _path += '\\';
+ if(_path[_path.GetLength()-1] != '\\') {
+ _path += '\\';
+ }
s.strLastOpenDir = _path;
CAtlList<CString> sl;
sl.AddTail(_path);
- if(COpenDirHelper::m_incl_subdir) COpenDirHelper::RecurseAddDir(_path, &sl);
+ if(COpenDirHelper::m_incl_subdir) {
+ COpenDirHelper::RecurseAddDir(_path, &sl);
+ }
- if(m_wndPlaylistBar.IsWindowVisible())
- {
+ if(m_wndPlaylistBar.IsWindowVisible()) {
m_wndPlaylistBar.Append(sl, true);
- }
- else
- {
+ } else {
m_wndPlaylistBar.Open(sl, true);
OpenCurPlaylistItem();
}
@@ -15120,22 +14832,26 @@ void CMainFrame::OnFileOpendirectory() HRESULT CMainFrame::CreateThumbnailToolbar()
{
- if(!AfxGetAppSettings().fUseWin7TaskBar) return E_FAIL;
+ if(!AfxGetAppSettings().fUseWin7TaskBar) {
+ return E_FAIL;
+ }
DWORD dwMajor = LOBYTE(LOWORD(GetVersion()));
DWORD dwMinor = HIBYTE(LOWORD(GetVersion()));
- if (!( dwMajor > 6 || ( dwMajor == 6 && dwMinor > 0 ))) return E_FAIL;
+ if (!( dwMajor > 6 || ( dwMajor == 6 && dwMinor > 0 ))) {
+ return E_FAIL;
+ }
- if(m_pTaskbarList) m_pTaskbarList->Release();
+ if(m_pTaskbarList) {
+ m_pTaskbarList->Release();
+ }
HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&m_pTaskbarList));
- if (SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);
CGdiPlusBitmapResource* pBitmap = new CGdiPlusBitmapResource;
- if (!pBitmap->Load(_T("W7_TOOLBAR"), _T("PNG"), AfxGetInstanceHandle()))
- {
+ if (!pBitmap->Load(_T("W7_TOOLBAR"), _T("PNG"), AfxGetInstanceHandle())) {
delete pBitmap;
Gdiplus::GdiplusShutdown(m_gdiplusToken);
m_pTaskbarList->Release();
@@ -15150,8 +14866,7 @@ HRESULT CMainFrame::CreateThumbnailToolbar() HBITMAP hB = 0;
pBitmap->m_pBitmap->GetHBITMAP(co,&hB);
- if (!hB)
- {
+ if (!hB) {
m_pTaskbarList->Release();
delete pBitmap;
Gdiplus::GdiplusShutdown(m_gdiplusToken);
@@ -15161,8 +14876,7 @@ HRESULT CMainFrame::CreateThumbnailToolbar() // Check dimensions
BITMAP bi = {0};
GetObject((HANDLE)hB,sizeof(bi),&bi);
- if (bi.bmHeight == 0)
- {
+ if (bi.bmHeight == 0) {
DeleteObject(hB);
m_pTaskbarList->Release();
delete pBitmap;
@@ -15178,8 +14892,7 @@ HRESULT CMainFrame::CreateThumbnailToolbar() hr = m_pTaskbarList->ThumbBarSetImageList(m_hWnd,himl);
DeleteObject(hB);
- if (SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
THUMBBUTTON buttons[5] = {};
// SEEK BACKWARD
@@ -15229,11 +14942,11 @@ HRESULT CMainFrame::CreateThumbnailToolbar() HRESULT CMainFrame::UpdateThumbarButton()
{
- if ( !m_pTaskbarList )
+ if ( !m_pTaskbarList ) {
return E_FAIL;
+ }
- if ( !AfxGetAppSettings().fUseWin7TaskBar )
- {
+ if ( !AfxGetAppSettings().fUseWin7TaskBar ) {
m_pTaskbarList->SetOverlayIcon( m_hWnd, NULL, L"" );
m_pTaskbarList->SetProgressState( m_hWnd, TBPF_NOPROGRESS );
@@ -15295,20 +15008,16 @@ HRESULT CMainFrame::UpdateThumbarButton() HICON hIcon = NULL;
- if ( m_iMediaLoadState == MLS_LOADED )
- {
+ if ( m_iMediaLoadState == MLS_LOADED ) {
OAFilterState fs = GetMediaState();
- if ( fs == State_Running )
- {
+ if ( fs == State_Running ) {
buttons[1].dwFlags = THBF_ENABLED;
buttons[2].dwFlags = THBF_ENABLED;
buttons[2].iBitmap = 2;
hIcon = AfxGetApp()->LoadIcon( IDR_TB_PLAY );
m_pTaskbarList->SetProgressState( m_hWnd, TBPF_NORMAL );
- }
- else if ( fs == State_Stopped )
- {
+ } else if ( fs == State_Stopped ) {
buttons[0].dwFlags = THBF_DISABLED;
buttons[1].dwFlags = THBF_DISABLED;
buttons[2].dwFlags = THBF_ENABLED;
@@ -15317,9 +15026,7 @@ HRESULT CMainFrame::UpdateThumbarButton() hIcon = AfxGetApp()->LoadIcon( IDR_TB_STOP );
m_pTaskbarList->SetProgressState( m_hWnd, TBPF_NOPROGRESS );
- }
- else if ( fs == State_Paused )
- {
+ } else if ( fs == State_Paused ) {
buttons[1].dwFlags = THBF_ENABLED;
buttons[2].dwFlags = THBF_ENABLED;
buttons[2].iBitmap = 3;
@@ -15328,16 +15035,16 @@ HRESULT CMainFrame::UpdateThumbarButton() m_pTaskbarList->SetProgressState( m_hWnd, TBPF_PAUSED );
}
- if ( m_fAudioOnly )
+ if ( m_fAudioOnly ) {
buttons[4].dwFlags = THBF_DISABLED;
+ }
m_pTaskbarList->SetOverlayIcon( m_hWnd, hIcon, L"" );
- if ( hIcon != NULL )
+ if ( hIcon != NULL ) {
DestroyIcon( hIcon );
- }
- else
- {
+ }
+ } else {
buttons[0].dwFlags = THBF_DISABLED;
buttons[1].dwFlags = THBF_DISABLED;
buttons[2].dwFlags = THBF_DISABLED;
@@ -15357,11 +15064,11 @@ HRESULT CMainFrame::UpdateThumbarButton() HRESULT CMainFrame::UpdateThumbnailClip()
{
- if ( !m_pTaskbarList )
+ if ( !m_pTaskbarList ) {
return E_FAIL;
+ }
- if ( (!AfxGetAppSettings().fUseWin7TaskBar) || (m_iMediaLoadState != MLS_LOADED) || (m_fAudioOnly) || m_fFullScreen )
- {
+ if ( (!AfxGetAppSettings().fUseWin7TaskBar) || (m_iMediaLoadState != MLS_LOADED) || (m_fAudioOnly) || m_fFullScreen ) {
return m_pTaskbarList->SetThumbnailClip( m_hWnd, NULL );
}
@@ -15379,41 +15086,38 @@ HRESULT CMainFrame::UpdateThumbnailClip() LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
- if((message == WM_COMMAND) && (THBN_CLICKED == HIWORD(wParam)))
- {
+ if((message == WM_COMMAND) && (THBN_CLICKED == HIWORD(wParam))) {
int const wmId = LOWORD(wParam);
- switch(wmId)
- {
- case IDTB_BUTTON1:
- SendMessage(WM_COMMAND, ID_PLAY_STOP);
- break;
+ switch(wmId) {
+ case IDTB_BUTTON1:
+ SendMessage(WM_COMMAND, ID_PLAY_STOP);
+ break;
- case IDTB_BUTTON2:
- SendMessage(WM_COMMAND, ID_PLAY_PLAYPAUSE);
- break;
+ case IDTB_BUTTON2:
+ SendMessage(WM_COMMAND, ID_PLAY_PLAYPAUSE);
+ break;
- case IDTB_BUTTON3:
- SendMessage(WM_COMMAND, ID_PLAY_SEEKBACKWARDMED);
- break;
+ case IDTB_BUTTON3:
+ SendMessage(WM_COMMAND, ID_PLAY_SEEKBACKWARDMED);
+ break;
- case IDTB_BUTTON4:
- SendMessage(WM_COMMAND, ID_PLAY_SEEKFORWARDMED);
- break;
+ case IDTB_BUTTON4:
+ SendMessage(WM_COMMAND, ID_PLAY_SEEKFORWARDMED);
+ break;
- case IDTB_BUTTON5:
- WINDOWPLACEMENT wp;
- GetWindowPlacement(&wp);
- if(wp.showCmd == SW_SHOWMINIMIZED)
- {
- SendMessage(WM_SYSCOMMAND, SC_RESTORE, -1);
- }
- SetForegroundWindow();
+ case IDTB_BUTTON5:
+ WINDOWPLACEMENT wp;
+ GetWindowPlacement(&wp);
+ if(wp.showCmd == SW_SHOWMINIMIZED) {
+ SendMessage(WM_SYSCOMMAND, SC_RESTORE, -1);
+ }
+ SetForegroundWindow();
- SendMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
- break;
+ SendMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
+ break;
- default:
- break;
+ default:
+ break;
}
return 0;
}
@@ -15426,27 +15130,26 @@ UINT CMainFrame::OnPowerBroadcast(UINT nPowerEvent, UINT nEventData) static BOOL bWasPausedBeforeSuspention;
OAFilterState mediaState;
- switch ( nPowerEvent )
- {
- case PBT_APMSUSPEND: // System is suspending operation.
- TRACE("OnPowerBroadcast - suspending\n"); // For user tracking
+ switch ( nPowerEvent ) {
+ case PBT_APMSUSPEND: // System is suspending operation.
+ TRACE("OnPowerBroadcast - suspending\n"); // For user tracking
- bWasPausedBeforeSuspention = FALSE; // Reset value
+ bWasPausedBeforeSuspention = FALSE; // Reset value
- mediaState = GetMediaState();
- if ( mediaState == State_Running )
- {
- bWasPausedBeforeSuspention = TRUE;
- SendMessage( WM_COMMAND, ID_PLAY_PAUSE ); // Pause
- }
- break;
- case PBT_APMRESUMEAUTOMATIC: // Operation is resuming automatically from a low-power state. This message is sent every time the system resumes.
- TRACE("OnPowerBroadcast - resuming\n"); // For user tracking
+ mediaState = GetMediaState();
+ if ( mediaState == State_Running ) {
+ bWasPausedBeforeSuspention = TRUE;
+ SendMessage( WM_COMMAND, ID_PLAY_PAUSE ); // Pause
+ }
+ break;
+ case PBT_APMRESUMEAUTOMATIC: // Operation is resuming automatically from a low-power state. This message is sent every time the system resumes.
+ TRACE("OnPowerBroadcast - resuming\n"); // For user tracking
- // Resume if we paused before suspension.
- if ( bWasPausedBeforeSuspention )
- SendMessage( WM_COMMAND, ID_PLAY_PLAY ); // Resume
- break;
+ // Resume if we paused before suspension.
+ if ( bWasPausedBeforeSuspention ) {
+ SendMessage( WM_COMMAND, ID_PLAY_PLAY ); // Resume
+ }
+ break;
}
return __super::OnPowerBroadcast(nPowerEvent, nEventData);
diff --git a/src/apps/mplayerc/MainFrm.h b/src/apps/mplayerc/MainFrm.h index e5131b0f9..2823c9fcc 100644 --- a/src/apps/mplayerc/MainFrm.h +++ b/src/apps/mplayerc/MainFrm.h @@ -79,7 +79,7 @@ enum {PM_NONE, PM_FILE, PM_DVD, PM_CAPTURE}; class OpenMediaData
{
public:
-// OpenMediaData() {}
+ // OpenMediaData() {}
virtual ~OpenMediaData() {} // one virtual funct is needed to enable rtti
CString title;
CAtlList<CString> subs;
@@ -96,7 +96,7 @@ public: class OpenDVDData : public OpenMediaData
{
public:
-// OpenDVDData() {}
+ // OpenDVDData() {}
CString path;
CComPtr<IDvdState> pDvdState;
};
@@ -104,8 +104,7 @@ public: class OpenDeviceData : public OpenMediaData
{
public:
- OpenDeviceData()
- {
+ OpenDeviceData() {
vinput = vchannel = ainput = -1;
}
CStringW DisplayName[2];
@@ -133,8 +132,7 @@ class CGraphThread : public CWinThread public:
CGraphThread() : m_pMainFrame(NULL) {}
- void SetMainFrame(CMainFrame* pMainFrame)
- {
+ void SetMainFrame(CMainFrame* pMainFrame) {
m_pMainFrame = pMainFrame;
}
@@ -173,8 +171,7 @@ interface ISubClock; class CMainFrame : public CFrameWnd, public CDropTarget
{
- enum
- {
+ enum {
TIMER_STREAMPOSPOLLER = 1,
TIMER_STREAMPOSPOLLER2,
TIMER_FULLSCREENCONTROLBARHIDER,
@@ -342,17 +339,14 @@ public: void StopWebServer();
CString GetStatusMessage();
- int GetPlaybackMode() const
- {
+ int GetPlaybackMode() const {
return m_iPlaybackMode;
}
void SetPlaybackMode(int iNewStatus);
- bool IsMuted()
- {
+ bool IsMuted() {
return m_wndToolBar.GetVolume() == -10000;
}
- int GetVolume()
- {
+ int GetVolume() {
return m_wndToolBar.m_volctrl.GetPos();
}
@@ -361,7 +355,7 @@ public: DECLARE_DYNAMIC(CMainFrame)
-// Attributes
+ // Attributes
public:
bool m_fFullScreen;
bool m_fFirstFSAfterLaunchOnFS;
@@ -371,24 +365,19 @@ public: CComPtr<IBaseFilter> m_pRefClock; // Adjustable reference clock. GothSync
CComPtr<ISyncClock> m_pSyncClock;
- bool IsFrameLessWindow() const
- {
+ bool IsFrameLessWindow() const {
return(m_fFullScreen || AfxGetAppSettings().iCaptionMenuMode==MODE_BORDERLESS);
}
- bool IsCaptionMenuHidden() const
- {
+ bool IsCaptionMenuHidden() const {
return(!m_fFullScreen && AfxGetAppSettings().iCaptionMenuMode!=MODE_SHOWCAPTIONMENU);
}
- bool IsSomethingLoaded() const
- {
+ bool IsSomethingLoaded() const {
return((m_iMediaLoadState == MLS_LOADING || m_iMediaLoadState == MLS_LOADED) && !IsD3DFullScreenMode());
}
- bool IsPlaylistEmpty()
- {
+ bool IsPlaylistEmpty() {
return(m_wndPlaylistBar.GetCount() == 0);
}
- bool IsInteractiveVideo() const
- {
+ bool IsInteractiveVideo() const {
return(AfxGetAppSettings().fIntRealMedia && m_fRealMediaGraph || m_fShockwaveGraph);
}
bool IsD3DFullScreenMode() const;
@@ -410,7 +399,7 @@ protected: double m_ZoomX, m_ZoomY, m_PosX, m_PosY;
int m_AngleX, m_AngleY, m_AngleZ;
-// Operations
+ // Operations
bool OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD);
void CloseMediaPrivate();
void DoTunerScan(TunerScanData* pTSD);
@@ -512,7 +501,7 @@ public: void DisplayCurrentChannelOSD();
void DisplayCurrentChannelInfo();
-// Implementation
+ // Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
@@ -557,7 +546,7 @@ protected: // control bar embedded members void RestoreFloatingControlBars();
void SaveControlBars();
-// Generated message map functions
+ // Generated message map functions
DECLARE_MESSAGE_MAP()
@@ -915,7 +904,7 @@ public: LPCTSTR GetDVDAudioFormatName (DVD_AudioAttributes& ATR) const;
void SetAudioDelay(REFERENCE_TIME rtShift);
void SetSubtitleDelay(int delay_ms);
-// void AutoSelectTracks();
+ // void AutoSelectTracks();
bool IsRealEngineCompatible(CString strFilename) const;
void SetTimersPlay();
void KillTimersStop();
diff --git a/src/apps/mplayerc/MediaFormats.cpp b/src/apps/mplayerc/MediaFormats.cpp index 5986e208a..679c8ff8f 100644 --- a/src/apps/mplayerc/MediaFormats.cpp +++ b/src/apps/mplayerc/MediaFormats.cpp @@ -54,7 +54,9 @@ CMediaFormatCategory::CMediaFormatCategory( m_label = label;
ExplodeMin(exts, m_exts, ' ');
POSITION pos = m_exts.GetHeadPosition();
- while(pos) m_exts.GetNext(pos).TrimLeft('.');
+ while(pos) {
+ m_exts.GetNext(pos).TrimLeft('.');
+ }
m_backupexts.AddTailList(&m_exts);
m_specreqnote = specreqnote;
@@ -68,12 +70,9 @@ CMediaFormatCategory::~CMediaFormatCategory() void CMediaFormatCategory::UpdateData(bool fSave)
{
- if(fSave)
- {
+ if(fSave) {
AfxGetApp()->WriteProfileString(_T("FileFormats"), m_label, GetExts(true));
- }
- else
- {
+ } else {
SetExts(AfxGetApp()->GetProfileString(_T("FileFormats"), m_label, GetExts(true)));
}
}
@@ -85,8 +84,7 @@ CMediaFormatCategory::CMediaFormatCategory(const CMediaFormatCategory& mfc) CMediaFormatCategory& CMediaFormatCategory::operator = (const CMediaFormatCategory& mfc)
{
- if(this != &mfc)
- {
+ if(this != &mfc) {
m_label = mfc.m_label;
m_specreqnote = mfc.m_specreqnote;
m_exts.RemoveAll();
@@ -116,16 +114,15 @@ void CMediaFormatCategory::SetExts(CString exts) m_exts.RemoveAll();
ExplodeMin(exts, m_exts, ' ');
POSITION pos = m_exts.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
POSITION cur = pos;
CString& ext = m_exts.GetNext(pos);
- if(ext[0] == '\\')
- {
+ if(ext[0] == '\\') {
m_engine = (engine_t)_tcstol(ext.TrimLeft('\\'), NULL, 10);
m_exts.RemoveAt(cur);
+ } else {
+ ext.TrimLeft('.');
}
- else ext.TrimLeft('.');
}
}
@@ -133,7 +130,9 @@ CString CMediaFormatCategory::GetFilter() {
CString filter;
POSITION pos = m_exts.GetHeadPosition();
- while(pos) filter += _T("*.") + m_exts.GetNext(pos) + _T(";");
+ while(pos) {
+ filter += _T("*.") + m_exts.GetNext(pos) + _T(";");
+ }
filter.TrimRight(_T(";")); // cheap...
return(filter);
}
@@ -141,7 +140,9 @@ CString CMediaFormatCategory::GetFilter() CString CMediaFormatCategory::GetExts(bool fAppendEngine)
{
CString exts = Implode(m_exts, ' ');
- if(fAppendEngine) exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine);
+ if(fAppendEngine) {
+ exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine);
+ }
return(exts);
}
@@ -149,9 +150,13 @@ CString CMediaFormatCategory::GetExtsWithPeriod(bool fAppendEngine) {
CString exts;
POSITION pos = m_exts.GetHeadPosition();
- while(pos) exts += _T(".") + m_exts.GetNext(pos) + _T(" ");
+ while(pos) {
+ exts += _T(".") + m_exts.GetNext(pos) + _T(" ");
+ }
exts.TrimRight(_T(" ")); // cheap...
- if(fAppendEngine) exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine);
+ if(fAppendEngine) {
+ exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine);
+ }
return(exts);
}
@@ -159,9 +164,13 @@ CString CMediaFormatCategory::GetBackupExtsWithPeriod(bool fAppendEngine) {
CString exts;
POSITION pos = m_backupexts.GetHeadPosition();
- while(pos) exts += _T(".") + m_backupexts.GetNext(pos) + _T(" ");
+ while(pos) {
+ exts += _T(".") + m_backupexts.GetNext(pos) + _T(" ");
+ }
exts.TrimRight(_T(" ")); // cheap...
- if(fAppendEngine) exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine);
+ if(fAppendEngine) {
+ exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine);
+ }
return(exts);
}
@@ -179,15 +188,12 @@ CMediaFormats::~CMediaFormats() void CMediaFormats::UpdateData(bool fSave)
{
- if(fSave)
- {
+ if(fSave) {
AfxGetApp()->WriteProfileString(_T("FileFormats"), NULL, NULL);
AfxGetApp()->WriteProfileInt(_T("FileFormats"), _T("RtspHandler"), m_iRtspHandler);
AfxGetApp()->WriteProfileInt(_T("FileFormats"), _T("RtspFileExtFirst"), m_fRtspFileExtFirst);
- }
- else
- {
+ } else {
RemoveAll();
#define ADDFMT(f) Add(CMediaFormatCategory##f)
@@ -254,8 +260,9 @@ void CMediaFormats::UpdateData(bool fSave) m_fRtspFileExtFirst = !!AfxGetApp()->GetProfileInt(_T("FileFormats"), _T("RtspFileExtFirst"), 1);
}
- for(int i = 0; i < GetCount(); i++)
+ for(int i = 0; i < GetCount(); i++) {
GetAt(i).UpdateData(fSave);
+ }
}
engine_t CMediaFormats::GetRtspHandler(bool& fRtspFileExtFirst)
@@ -279,31 +286,33 @@ engine_t CMediaFormats::GetEngine(CString path) {
path.Trim().MakeLower();
- if(!m_fRtspFileExtFirst && path.Find(_T("rtsp://")) == 0)
+ if(!m_fRtspFileExtFirst && path.Find(_T("rtsp://")) == 0) {
return m_iRtspHandler;
+ }
CString ext = CPath(path).GetExtension();
ext.MakeLower();
- if(!ext.IsEmpty())
- {
- if(path.Find(_T("rtsp://")) == 0)
- {
- if(ext == _T(".ram") || ext == _T(".rm") || ext == _T(".ra"))
+ if(!ext.IsEmpty()) {
+ if(path.Find(_T("rtsp://")) == 0) {
+ if(ext == _T(".ram") || ext == _T(".rm") || ext == _T(".ra")) {
return RealMedia;
- if(ext == _T(".qt") || ext == _T(".mov"))
+ }
+ if(ext == _T(".qt") || ext == _T(".mov")) {
return QuickTime;
+ }
}
- for(int i = 0; i < GetCount(); i++)
- {
+ for(int i = 0; i < GetCount(); i++) {
CMediaFormatCategory& mfc = GetAt(i);
- if(mfc.FindExt(ext))
+ if(mfc.FindExt(ext)) {
return mfc.GetEngineType();
+ }
}
}
- if(m_fRtspFileExtFirst && path.Find(_T("rtsp://")) == 0)
+ if(m_fRtspFileExtFirst && path.Find(_T("rtsp://")) == 0) {
return m_iRtspHandler;
+ }
return DirectShow;
}
@@ -312,13 +321,12 @@ bool CMediaFormats::FindExt(CString ext, bool fAudioOnly) {
ext.TrimLeft(_T("."));
- if(!ext.IsEmpty())
- {
- for(int i = 0; i < GetCount(); i++)
- {
+ if(!ext.IsEmpty()) {
+ for(int i = 0; i < GetCount(); i++) {
CMediaFormatCategory& mfc = GetAt(i);
- if((!fAudioOnly || mfc.IsAudioOnly()) && mfc.FindExt(ext))
+ if((!fAudioOnly || mfc.IsAudioOnly()) && mfc.FindExt(ext)) {
return(true);
+ }
}
}
@@ -332,8 +340,7 @@ void CMediaFormats::GetFilter(CString& filter, CAtlArray<CString>& mask) filter += ResStr(IDS_MEDIAFORMATS_34);
mask.Add(_T(""));
- for(int i = 0; i < GetCount(); i++)
- {
+ for(int i = 0; i < GetCount(); i++) {
strTemp = GetAt(i).GetFilter() + _T(";");
mask[0] += strTemp;
filter += strTemp;
@@ -342,8 +349,7 @@ void CMediaFormats::GetFilter(CString& filter, CAtlArray<CString>& mask) filter.TrimRight(_T(";"));
filter += _T("|");
- for(int i = 0; i < GetCount(); i++)
- {
+ for(int i = 0; i < GetCount(); i++) {
CMediaFormatCategory& mfc = GetAt(i);
filter += mfc.GetLabel() + _T("|" + GetAt(i).GetFilter() + _T("|"));
mask.Add(mfc.GetFilter());
@@ -361,10 +367,11 @@ void CMediaFormats::GetAudioFilter(CString& filter, CAtlArray<CString>& mask) filter += ResStr(IDS_MEDIAFORMATS_36);
mask.Add(_T(""));
- for(int i = 0; i < GetCount(); i++)
- {
+ for(int i = 0; i < GetCount(); i++) {
CMediaFormatCategory& mfc = GetAt(i);
- if(!mfc.IsAudioOnly() || mfc.GetEngineType() != DirectShow) continue;
+ if(!mfc.IsAudioOnly() || mfc.GetEngineType() != DirectShow) {
+ continue;
+ }
strTemp = GetAt(i).GetFilter() + _T(";");
mask[0] += strTemp;
filter += strTemp;
@@ -374,10 +381,11 @@ void CMediaFormats::GetAudioFilter(CString& filter, CAtlArray<CString>& mask) filter.TrimRight(_T(";"));
filter += _T("|");
- for(int i = 0; i < GetCount(); i++)
- {
+ for(int i = 0; i < GetCount(); i++) {
CMediaFormatCategory& mfc = GetAt(i);
- if(!mfc.IsAudioOnly() || mfc.GetEngineType() != DirectShow) continue;
+ if(!mfc.IsAudioOnly() || mfc.GetEngineType() != DirectShow) {
+ continue;
+ }
filter += mfc.GetLabel() + _T("|") + GetAt(i).GetFilter() + _T("|");
mask.Add(mfc.GetFilter());
}
diff --git a/src/apps/mplayerc/MediaFormats.h b/src/apps/mplayerc/MediaFormats.h index 287537d49..2348c03f1 100644 --- a/src/apps/mplayerc/MediaFormats.h +++ b/src/apps/mplayerc/MediaFormats.h @@ -54,33 +54,27 @@ public: void SetExts(CAtlList<CString>& exts);
void SetExts(CString exts);
- bool FindExt(CString ext)
- {
+ bool FindExt(CString ext) {
return m_exts.Find(ext.TrimLeft(_T(".")).MakeLower()) != NULL;
}
- CString GetLabel() const
- {
+ CString GetLabel() const {
return m_label;
}
CString GetFilter();
CString GetExts(bool fAppendEngine = false);
CString GetExtsWithPeriod(bool fAppendEngine = false);
CString GetBackupExtsWithPeriod(bool fAppendEngine = false);
- CString GetSpecReqNote() const
- {
+ CString GetSpecReqNote() const {
return m_specreqnote;
}
- bool IsAudioOnly() const
- {
+ bool IsAudioOnly() const {
return m_fAudioOnly;
}
- engine_t GetEngineType() const
- {
+ engine_t GetEngineType() const {
return m_engine;
}
- void SetEngineType(engine_t e)
- {
+ void SetEngineType(engine_t e) {
m_engine = e;
}
};
diff --git a/src/apps/mplayerc/MediaTypesDlg.cpp b/src/apps/mplayerc/MediaTypesDlg.cpp index 11559504b..9512ef25f 100644 --- a/src/apps/mplayerc/MediaTypesDlg.cpp +++ b/src/apps/mplayerc/MediaTypesDlg.cpp @@ -61,14 +61,20 @@ void CMediaTypesDlg::AddLine(CString str) void CMediaTypesDlg::AddMediaType(AM_MEDIA_TYPE* pmt)
{
m_subtype = pmt->subtype;
- if(pmt->majortype == MEDIATYPE_Video) m_type = VIDEO;
- else if(pmt->majortype == MEDIATYPE_Audio) m_type = AUDIO;
- else m_type = UNKNOWN;
+ if(pmt->majortype == MEDIATYPE_Video) {
+ m_type = VIDEO;
+ } else if(pmt->majortype == MEDIATYPE_Audio) {
+ m_type = AUDIO;
+ } else {
+ m_type = UNKNOWN;
+ }
CAtlList<CString> sl;
CMediaTypeEx(*pmt).Dump(sl);
POSITION pos = sl.GetHeadPosition();
- while(pos) AddLine(sl.GetNext(pos) + '\n');
+ while(pos) {
+ AddLine(sl.GetNext(pos) + '\n');
+ }
}
BEGIN_MESSAGE_MAP(CMediaTypesDlg, CResizableDialog)
@@ -85,9 +91,10 @@ BOOL CMediaTypesDlg::OnInitDialog() CAtlList<CStringW> path;
CAtlList<CMediaType> mts;
- for(int i = 0; S_OK == m_pGBDE->GetDeadEnd(i, path, mts); i++)
- {
- if(!path.GetCount()) continue;
+ for(int i = 0; S_OK == m_pGBDE->GetDeadEnd(i, path, mts); i++) {
+ if(!path.GetCount()) {
+ continue;
+ }
m_pins.SetItemData(m_pins.AddString(CString(path.GetTail())), (DWORD_PTR)i);
}
@@ -111,24 +118,27 @@ void CMediaTypesDlg::OnCbnSelchangeCombo1() m_report.SetWindowText(_T(""));
int i = m_pins.GetCurSel();
- if(i < 0) return;
+ if(i < 0) {
+ return;
+ }
CAtlList<CStringW> path;
CAtlList<CMediaType> mts;
- if(FAILED(m_pGBDE->GetDeadEnd(i, path, mts)) || !path.GetCount())
+ if(FAILED(m_pGBDE->GetDeadEnd(i, path, mts)) || !path.GetCount()) {
return;
+ }
POSITION pos = path.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
AddLine(CString(path.GetNext(pos)) + _T("\n"));
- if(!pos) AddLine(_T("\n"));
+ if(!pos) {
+ AddLine(_T("\n"));
+ }
}
pos = mts.GetHeadPosition();
- for(int j = 0; pos; j++)
- {
+ for(int j = 0; pos; j++) {
CString str;
str.Format(_T("Media Type %d:\n"), j);
AddLine(str);
diff --git a/src/apps/mplayerc/MediaTypesDlg.h b/src/apps/mplayerc/MediaTypesDlg.h index ea343b2ff..1ba83bc2d 100644 --- a/src/apps/mplayerc/MediaTypesDlg.h +++ b/src/apps/mplayerc/MediaTypesDlg.h @@ -32,7 +32,7 @@ class CMediaTypesDlg : public CResizableDialog
{
-// DECLARE_DYNAMIC(CMediaTypesDlg)
+ // DECLARE_DYNAMIC(CMediaTypesDlg)
private:
CComPtr<IGraphBuilderDeadEnd> m_pGBDE;
@@ -45,7 +45,7 @@ public: CMediaTypesDlg(IGraphBuilderDeadEnd* pGBDE, CWnd* pParent = NULL); // standard constructor
virtual ~CMediaTypesDlg();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_MEDIATYPES_DLG };
CComboBox m_pins;
CEdit m_report;
diff --git a/src/apps/mplayerc/MiniDump.cpp b/src/apps/mplayerc/MiniDump.cpp index f52e11747..9f09b9dac 100644 --- a/src/apps/mplayerc/MiniDump.cpp +++ b/src/apps/mplayerc/MiniDump.cpp @@ -47,7 +47,7 @@ CMiniDump::CMiniDump() #ifndef _WIN64
// Enable catching in CRT (http://blog.kalmbachnet.de/?postid=75)
-// PreventSetUnhandledExceptionFilter();
+ // PreventSetUnhandledExceptionFilter();
#endif
#endif
}
@@ -60,12 +60,14 @@ LPTOP_LEVEL_EXCEPTION_FILTER WINAPI MyDummySetUnhandledExceptionFilter( LPTOP_LE BOOL CMiniDump::PreventSetUnhandledExceptionFilter()
{
HMODULE hKernel32 = LoadLibrary( _T("kernel32.dll") );
- if ( hKernel32 == NULL )
+ if ( hKernel32 == NULL ) {
return FALSE;
+ }
void *pOrgEntry = GetProcAddress( hKernel32, "SetUnhandledExceptionFilter" );
- if ( pOrgEntry == NULL )
+ if ( pOrgEntry == NULL ) {
return FALSE;
+ }
unsigned char newJump[ 100 ];
DWORD dwOrgEntryAddr = (DWORD) pOrgEntry;
@@ -89,34 +91,30 @@ LONG WINAPI CMiniDump::UnhandledExceptionFilter( _EXCEPTION_POINTERS *lpTopLevel _TCHAR szResult[ 800 ];
_TCHAR szDbgHelpPath[ _MAX_PATH ];
- if ( !m_bMiniDumpEnabled )
+ if ( !m_bMiniDumpEnabled ) {
return 0;
+ }
// firstly see if dbghelp.dll is around and has the function we need
// look next to the EXE first, as the one in System32 might be old
// (e.g. Windows 2000)
- if ( GetModuleFileName(NULL, szDbgHelpPath, _MAX_PATH) )
- {
+ if ( GetModuleFileName(NULL, szDbgHelpPath, _MAX_PATH) ) {
_TCHAR *pSlash = _tcsrchr( szDbgHelpPath, _T('\\') );
- if ( pSlash != NULL )
- {
+ if ( pSlash != NULL ) {
_tcscpy_s( pSlash + 1, _MAX_PATH + szDbgHelpPath - pSlash, _T("DBGHELP.DLL") );
hDll = ::LoadLibrary( szDbgHelpPath );
}
}
- if ( hDll == NULL )
- {
+ if ( hDll == NULL ) {
// load any version we can
hDll = ::LoadLibrary( _T("DBGHELP.DLL") );
}
- if ( hDll != NULL )
- {
+ if ( hDll != NULL ) {
MINIDUMPWRITEDUMP pMiniDumpWriteDump = (MINIDUMPWRITEDUMP)::GetProcAddress( hDll, "MiniDumpWriteDump" );
- if ( pMiniDumpWriteDump != NULL )
- {
+ if ( pMiniDumpWriteDump != NULL ) {
_TCHAR szDumpPath[ _MAX_PATH ];
_TCHAR szVersion[ 40 ];
@@ -129,8 +127,7 @@ LONG WINAPI CMiniDump::UnhandledExceptionFilter( _EXCEPTION_POINTERS *lpTopLevel HANDLE hFile = ::CreateFile( szDumpPath, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL );
- if ( hFile != INVALID_HANDLE_VALUE )
- {
+ if ( hFile != INVALID_HANDLE_VALUE ) {
_MINIDUMP_EXCEPTION_INFORMATION ExInfo;
ExInfo.ThreadId = ::GetCurrentThreadId();
@@ -139,28 +136,24 @@ LONG WINAPI CMiniDump::UnhandledExceptionFilter( _EXCEPTION_POINTERS *lpTopLevel // write the dump
BOOL bOK = pMiniDumpWriteDump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL );
- if ( bOK )
- {
+ if ( bOK ) {
_stprintf_s( szResult, countof(szResult), ResStr(IDS_MPC_CRASH), szDumpPath );
retval = EXCEPTION_EXECUTE_HANDLER;
- }
- else
- {
+ } else {
_stprintf_s( szResult, countof(szResult), ResStr(IDS_MPC_MINIDUMP_FAIL), szDumpPath, GetLastError() );
}
::CloseHandle( hFile );
- }
- else
- {
+ } else {
_stprintf_s( szResult, countof(szResult), ResStr(IDS_MPC_MINIDUMP_FAIL), szDumpPath, GetLastError() );
}
}
FreeLibrary( hDll );
}
- if ( szResult )
+ if ( szResult ) {
MessageBox( NULL, szResult, _T("MPC-HC Mini Dump"), MB_OK );
+ }
return retval;
}
diff --git a/src/apps/mplayerc/MiniDump.h b/src/apps/mplayerc/MiniDump.h index 9d708d0f6..829124693 100644 --- a/src/apps/mplayerc/MiniDump.h +++ b/src/apps/mplayerc/MiniDump.h @@ -27,8 +27,7 @@ class CMiniDump public:
CMiniDump();
- static void Enable()
- {
+ static void Enable() {
m_bMiniDumpEnabled = true;
};
diff --git a/src/apps/mplayerc/Monitors.cpp b/src/apps/mplayerc/Monitors.cpp index f27771fbe..57c23ea93 100644 --- a/src/apps/mplayerc/Monitors.cpp +++ b/src/apps/mplayerc/Monitors.cpp @@ -32,7 +32,7 @@ CMonitors::CMonitors() {
// WARNING : GetSystemMetrics(SM_CMONITORS) return only visible display monitors, and EnumDisplayMonitors
// enumerate visible and pseudo invisible monitors !!!
-// m_MonitorArray.SetSize( GetMonitorCount() );
+ // m_MonitorArray.SetSize( GetMonitorCount() );
ADDMONITOR addMonitor;
addMonitor.pMonitors = &m_MonitorArray;
@@ -43,8 +43,9 @@ CMonitors::CMonitors() CMonitors::~CMonitors()
{
- for ( int i = 0; i < m_MonitorArray.GetSize(); i++ )
+ for ( int i = 0; i < m_MonitorArray.GetSize(); i++ ) {
delete m_MonitorArray.GetAt( i );
+ }
}
@@ -81,8 +82,9 @@ CMonitor CMonitors::GetPrimaryMonitor() // is the given handle a valid monitor handle
BOOL CMonitors::IsMonitor( const HMONITOR hMonitor )
{
- if ( hMonitor == NULL )
+ if ( hMonitor == NULL ) {
return FALSE;
+ }
MATCHMONITOR match;
match.target = hMonitor;
@@ -100,8 +102,7 @@ BOOL CALLBACK CMonitors::FindMatchingMonitorHandle( HMONITOR hMonitor, HDC hdcMo {
LPMATCHMONITOR pMatch = (LPMATCHMONITOR)dwData;
- if ( hMonitor == pMatch->target )
- {
+ if ( hMonitor == pMatch->target ) {
//found a monitor with the same handle we are looking for
pMatch->foundMatch = TRUE;
return FALSE; //stop enumerating
diff --git a/src/apps/mplayerc/Monitors.h b/src/apps/mplayerc/Monitors.h index 122afe80e..04654b08e 100644 --- a/src/apps/mplayerc/Monitors.h +++ b/src/apps/mplayerc/Monitors.h @@ -38,18 +38,16 @@ public: #if _MFC_VER >= 0x0700
- int GetCount() const
- {
+ int GetCount() const {
return (int)m_MonitorArray.GetCount();
}
#else
- int GetCount() const
- {
+ int GetCount() const {
return (int)m_MonitorArray.GetSize();
}
#endif
-//static members
+ //static members
static CMonitor GetNearestMonitor( const LPRECT lprc );
static CMonitor GetNearestMonitor( const POINT pt );
static CMonitor GetNearestMonitor( const CWnd* pWnd );
@@ -70,8 +68,7 @@ public: private:
CObArray m_MonitorArray;
- typedef struct tagMATCHMONITOR
- {
+ typedef struct tagMATCHMONITOR {
HMONITOR target;
BOOL foundMatch;
} MATCHMONITOR, *LPMATCHMONITOR;
@@ -84,8 +81,7 @@ private: );
- typedef struct tagADDMONITOR
- {
+ typedef struct tagADDMONITOR {
CObArray* pMonitors;
int currentIndex;
} ADDMONITOR, *LPADDMONITOR;
diff --git a/src/apps/mplayerc/MpcApi.h b/src/apps/mplayerc/MpcApi.h index cea885a42..b858cf9e6 100644 --- a/src/apps/mplayerc/MpcApi.h +++ b/src/apps/mplayerc/MpcApi.h @@ -44,8 +44,7 @@ #pragma once
-typedef enum MPC_LOADSTATE
-{
+typedef enum MPC_LOADSTATE {
MLS_CLOSED,
MLS_LOADING,
MLS_LOADED,
@@ -53,8 +52,7 @@ typedef enum MPC_LOADSTATE };
-typedef enum MPC_PLAYSTATE
-{
+typedef enum MPC_PLAYSTATE {
PS_PLAY = 0,
PS_PAUSE = 1,
PS_STOP = 2,
@@ -62,8 +60,7 @@ typedef enum MPC_PLAYSTATE };
-struct MPC_OSDDATA
-{
+struct MPC_OSDDATA {
int nMsgPos; // screen position constant (see OSD_MESSAGEPOS constants)
int nDurationMS; // duration in milliseconds
TCHAR strMsg[128]; // message to display thought OSD
@@ -77,8 +74,7 @@ struct MPC_OSDDATA //} OSD_MESSAGEPOS;
-typedef enum MPCAPI_COMMAND
-{
+typedef enum MPCAPI_COMMAND {
// ==== Commands from MPC to host
// Send after connection
diff --git a/src/apps/mplayerc/Mpeg2SectionData.cpp b/src/apps/mplayerc/Mpeg2SectionData.cpp index eebce8fa5..12768cd05 100644 --- a/src/apps/mplayerc/Mpeg2SectionData.cpp +++ b/src/apps/mplayerc/Mpeg2SectionData.cpp @@ -55,8 +55,7 @@ CMpeg2DataParser::CMpeg2DataParser(IBaseFilter* pFilter) CString CMpeg2DataParser::ConvertString (BYTE* pBuffer, int nLength)
{
- static const UINT16 codepages[0x20] =
- {
+ static const UINT16 codepages[0x20] = {
28591, // 00 - ISO 8859-1 Latin I
28595, // 01 - ISO 8859-5 Cyrillic
28596, // 02 - ISO 8859-6 Arabic
@@ -83,15 +82,16 @@ CString CMpeg2DataParser::ConvertString (BYTE* pBuffer, int nLength) int nDestSize;
CString strResult;
- if (nLength>0 && pBuffer[0]<0x20)
- {
+ if (nLength>0 && pBuffer[0]<0x20) {
cp = codepages[pBuffer[0]];
pBuffer++;
nLength--;
}
nDestSize = MultiByteToWideChar (cp, MB_PRECOMPOSED, (LPCSTR)pBuffer, nLength, NULL, 0);
- if(nDestSize < 0) return strResult;
+ if(nDestSize < 0) {
+ return strResult;
+ }
MultiByteToWideChar (cp, MB_PRECOMPOSED, (LPCSTR)pBuffer, nLength, strResult.GetBuffer(nLength), nDestSize);
strResult.ReleaseBuffer();
@@ -101,22 +101,21 @@ CString CMpeg2DataParser::ConvertString (BYTE* pBuffer, int nLength) DVB_STREAM_TYPE CMpeg2DataParser::ConvertToDVBType(PES_STREAM_TYPE nType)
{
- switch (nType)
- {
- case VIDEO_STREAM_MPEG1 :
- case VIDEO_STREAM_MPEG2 :
- return DVB_MPV;
- case AUDIO_STREAM_MPEG1 :
- case AUDIO_STREAM_MPEG2 :
- return DVB_MPA;
- case VIDEO_STREAM_H264 :
- return DVB_H264;
- case AUDIO_STREAM_AC3 :
- return DVB_AC3;
- case AUDIO_STREAM_AC3_PLUS :
- return DVB_EAC3;
- case SUBTITLE_STREAM :
- return DVB_SUBTITLE;
+ switch (nType) {
+ case VIDEO_STREAM_MPEG1 :
+ case VIDEO_STREAM_MPEG2 :
+ return DVB_MPV;
+ case AUDIO_STREAM_MPEG1 :
+ case AUDIO_STREAM_MPEG2 :
+ return DVB_MPA;
+ case VIDEO_STREAM_H264 :
+ return DVB_H264;
+ case AUDIO_STREAM_AC3 :
+ return DVB_AC3;
+ case AUDIO_STREAM_AC3_PLUS :
+ return DVB_EAC3;
+ case SUBTITLE_STREAM :
+ return DVB_SUBTITLE;
}
return DVB_UNKNOWN;
@@ -124,7 +123,9 @@ DVB_STREAM_TYPE CMpeg2DataParser::ConvertToDVBType(PES_STREAM_TYPE nType) HRESULT CMpeg2DataParser::ParseSIHeader(CGolombBuffer& gb, DVB_SI SIType, WORD& wSectionLength, WORD& wTSID)
{
- if (gb.BitRead(8) != SIType) return ERROR_INVALID_DATA; // table_id
+ if (gb.BitRead(8) != SIType) {
+ return ERROR_INVALID_DATA; // table_id
+ }
gb.BitRead(1); // section_syntax_indicator
gb.BitRead(1); // reserved_future_use
gb.BitRead(2); // reserved
@@ -161,8 +162,7 @@ HRESULT CMpeg2DataParser::ParseSDT(ULONG ulFreq) wONID = gb.BitRead(16); // original_network_id
gb.BitRead(8); // reserved_future_use
- while (gb.GetSize() - gb.GetPos() > 4)
- {
+ while (gb.GetSize() - gb.GetPos() > 4) {
CDVBChannel Channel;
Channel.SetFrequency (ulFreq);
Channel.SetTSID (wTSID);
@@ -175,31 +175,30 @@ HRESULT CMpeg2DataParser::ParseSDT(ULONG ulFreq) Channel.SetEncrypted (gb.BitRead(1)); // free_CA_mode bslbf
// Descriptors:
- BeginEnumDescriptors(gb, nType, nLength)
- {
- switch (nType)
- {
- case DT_SERVICE :
- gb.BitRead(8); // service_type
- nLength = gb.BitRead(8); // service_provider_name_length
- gb.ReadBuffer (DescBuffer, nLength); // service_provider_name
-
- nLength = gb.BitRead(8); // service_name_length
- gb.ReadBuffer (DescBuffer, nLength); // service_name
- DescBuffer[nLength] = 0;
- Channel.SetName (ConvertString (DescBuffer, nLength));
- TRACE ("%15S %d\n", Channel.GetName(), Channel.GetSID());
- break;
- default :
- SkipDescriptor (gb, nType, nLength); // descriptor()
- break;
+ BeginEnumDescriptors(gb, nType, nLength) {
+ switch (nType) {
+ case DT_SERVICE :
+ gb.BitRead(8); // service_type
+ nLength = gb.BitRead(8); // service_provider_name_length
+ gb.ReadBuffer (DescBuffer, nLength); // service_provider_name
+
+ nLength = gb.BitRead(8); // service_name_length
+ gb.ReadBuffer (DescBuffer, nLength); // service_name
+ DescBuffer[nLength] = 0;
+ Channel.SetName (ConvertString (DescBuffer, nLength));
+ TRACE ("%15S %d\n", Channel.GetName(), Channel.GetSID());
+ break;
+ default :
+ SkipDescriptor (gb, nType, nLength); // descriptor()
+ break;
}
}
EndEnumDescriptors
- if (!Channels.Lookup(Channel.GetSID()))
+ if (!Channels.Lookup(Channel.GetSID())) {
Channels [Channel.GetSID()] = Channel;
+ }
}
return S_OK;
@@ -222,20 +221,17 @@ HRESULT CMpeg2DataParser::ParsePAT() // program_association_section()
CheckNoLog (ParseSIHeader (gb, SI_PAT, wSectionLength, wTSID));
- while (gb.GetSize() - gb.GetPos() > 4)
- {
+ while (gb.GetSize() - gb.GetPos() > 4) {
WORD program_number;
WORD program_map_PID = 0;
program_number = gb.BitRead(16); // program_number
gb.BitRead(3); // reserved
- if (program_number==0)
- gb.BitRead(13); // network_PID
- else
- {
+ if (program_number==0) {
+ gb.BitRead(13); // network_PID
+ } else {
program_map_PID = gb.BitRead(13); // program_map_PID
- if (Channels.Lookup(program_number))
- {
+ if (Channels.Lookup(program_number)) {
Channels [program_number].SetPMT (program_map_PID);
ParsePMT (Channels [program_number]);
}
@@ -267,15 +263,13 @@ HRESULT CMpeg2DataParser::ParsePMT(CDVBChannel& Channel) gb.BitRead(3); // reserved
Channel.SetPCR (gb.BitRead(13)); // PCR_PID
gb.BitRead(4); // reserved
- BeginEnumDescriptors(gb, nType, nLength) // for (i=0;i<N;i++) {
- {
+ BeginEnumDescriptors(gb, nType, nLength) { // for (i=0;i<N;i++) {
SkipDescriptor (gb, nType, nLength); // descriptor()
}
EndEnumDescriptors
- while (gb.GetSize() - gb.GetPos() > 4)
- {
+ while (gb.GetSize() - gb.GetPos() > 4) {
PES_STREAM_TYPE pes_stream_type;
DVB_STREAM_TYPE dvb_stream_type;
WORD wPID;
@@ -286,37 +280,35 @@ HRESULT CMpeg2DataParser::ParsePMT(CDVBChannel& Channel) wPID = gb.BitRead(13); // elementary_PID
gb.BitRead(4); // reserved
- BeginEnumDescriptors(gb, nType, nLength) // ES_info_length
- {
- switch (nType)
- {
- case DT_ISO_639_LANGUAGE :
- gb.ReadBuffer(DescBuffer, nLength);
- strLanguage = ConvertString (DescBuffer, 3);
- break;
- case DT_AC3_AUDIO :
- pes_stream_type = AUDIO_STREAM_AC3;
- SkipDescriptor (gb, nType, nLength);
- break;
- case DT_EXTENDED_AC3_AUDIO :
- pes_stream_type = AUDIO_STREAM_AC3_PLUS;
- SkipDescriptor (gb, nType, nLength);
- break;
- case DT_SUBTITLING :
- {
- gb.ReadBuffer(DescBuffer, nLength);
- strLanguage = ConvertString (DescBuffer, 3);
- pes_stream_type = SUBTITLE_STREAM;
- }
- break;
- default :
- SkipDescriptor (gb, nType, nLength);
+ BeginEnumDescriptors(gb, nType, nLength) { // ES_info_length
+ switch (nType) {
+ case DT_ISO_639_LANGUAGE :
+ gb.ReadBuffer(DescBuffer, nLength);
+ strLanguage = ConvertString (DescBuffer, 3);
+ break;
+ case DT_AC3_AUDIO :
+ pes_stream_type = AUDIO_STREAM_AC3;
+ SkipDescriptor (gb, nType, nLength);
+ break;
+ case DT_EXTENDED_AC3_AUDIO :
+ pes_stream_type = AUDIO_STREAM_AC3_PLUS;
+ SkipDescriptor (gb, nType, nLength);
+ break;
+ case DT_SUBTITLING : {
+ gb.ReadBuffer(DescBuffer, nLength);
+ strLanguage = ConvertString (DescBuffer, 3);
+ pes_stream_type = SUBTITLE_STREAM;
+ }
break;
+ default :
+ SkipDescriptor (gb, nType, nLength);
+ break;
}
}
EndEnumDescriptors
- if ((dvb_stream_type = ConvertToDVBType(pes_stream_type)) != DVB_UNKNOWN)
+ if ((dvb_stream_type = ConvertToDVBType(pes_stream_type)) != DVB_UNKNOWN) {
Channel.AddStreamInfo (wPID, dvb_stream_type, pes_stream_type, strLanguage);
+ }
}
return S_OK;
@@ -338,8 +330,9 @@ HRESULT CMpeg2DataParser::SetTime(CGolombBuffer& gb, PresentFollowing &NowNext) tmTime1 = *localtime( &tTime1 );
_tzset();
_get_timezone(&timezone);
- if (_get_daylight(&daylight))
+ if (_get_daylight(&daylight)) {
timezone -= daylight * 3600;
+ }
// Start time:
tmTime1.tm_hour = gb.BitRead(4)*10;
@@ -387,8 +380,7 @@ HRESULT CMpeg2DataParser::ParseEIT(ULONG ulSID, PresentFollowing &NowNext) CString itemDesc, itemText;
CString text;
- do
- {
+ do {
CheckNoLog (m_pData->GetSection (PID_EIT, SI_EIT_act, NULL, 5000, &pSectionList));
CheckNoLog (pSectionList->GetSectionData (0, &dwLength, &data));
@@ -423,64 +415,59 @@ HRESULT CMpeg2DataParser::ParseEIT(ULONG ulSID, PresentFollowing &NowNext) NowNext.ExtendedDescriptorsItems.RemoveAll();
NowNext.ExtendedDescriptorsTexts.RemoveAll();
- if ((InfoEvent.ServiceId == ulSID) && (InfoEvent.CurrentNextIndicator == 1) && (InfoEvent.RunninStatus == 4))
- {
+ if ((InfoEvent.ServiceId == ulSID) && (InfoEvent.CurrentNextIndicator == 1) && (InfoEvent.RunninStatus == 4)) {
// Descriptors:
- BeginEnumDescriptors(gb, nType, nLength)
- {
- switch (nType)
- {
- case DT_SHORT_EVENT:
- gb.BitRead(24); // ISO_639_language_code
-
- nLen = gb.BitRead(8); // event_name_length
- gb.ReadBuffer(DescBuffer, nLen);
- NowNext.cPresent = ConvertString(DescBuffer, nLen);
-
- nLen = gb.BitRead(8); // text_length
- gb.ReadBuffer(DescBuffer, nLen);
- NowNext.SummaryDesc = ConvertString(DescBuffer, nLen);
- break;
- case DT_EXTENDED_EVENT:
- descriptorNumber = gb.BitRead(4); // descriptor_number
- gb.BitRead(4); // last_descriptor_number
- gb.BitRead(24); // ISO_639_language_code
-
- nbItems = gb.BitRead(8); // length_of_items
- for (int i=0; i<nbItems; i++)
- {
- nLen = gb.BitRead(8); // item_description_length
- gb.ReadBuffer(DescBuffer, nLen);
- itemDesc = ConvertString(DescBuffer, nLen);
- nLen = gb.BitRead(8); // item_length
+ BeginEnumDescriptors(gb, nType, nLength) {
+ switch (nType) {
+ case DT_SHORT_EVENT:
+ gb.BitRead(24); // ISO_639_language_code
+
+ nLen = gb.BitRead(8); // event_name_length
gb.ReadBuffer(DescBuffer, nLen);
- itemText = ConvertString(DescBuffer, nLen);
- NowNext.ExtendedDescriptorsItems.SetAt(itemDesc, itemText);
- }
+ NowNext.cPresent = ConvertString(DescBuffer, nLen);
- nLen = gb.BitRead(8); // text_length
- gb.ReadBuffer(DescBuffer, nLen);
- text = ConvertString(DescBuffer, nLen);
- if (descriptorNumber == 0) // new descriptor set
- NowNext.ExtendedDescriptorsTexts.AddTail(text);
- else
- NowNext.ExtendedDescriptorsTexts.GetTail().Append(text);
- break;
- default:
- SkipDescriptor (gb, nType, nLength);
- break;
+ nLen = gb.BitRead(8); // text_length
+ gb.ReadBuffer(DescBuffer, nLen);
+ NowNext.SummaryDesc = ConvertString(DescBuffer, nLen);
+ break;
+ case DT_EXTENDED_EVENT:
+ descriptorNumber = gb.BitRead(4); // descriptor_number
+ gb.BitRead(4); // last_descriptor_number
+ gb.BitRead(24); // ISO_639_language_code
+
+ nbItems = gb.BitRead(8); // length_of_items
+ for (int i=0; i<nbItems; i++) {
+ nLen = gb.BitRead(8); // item_description_length
+ gb.ReadBuffer(DescBuffer, nLen);
+ itemDesc = ConvertString(DescBuffer, nLen);
+ nLen = gb.BitRead(8); // item_length
+ gb.ReadBuffer(DescBuffer, nLen);
+ itemText = ConvertString(DescBuffer, nLen);
+ NowNext.ExtendedDescriptorsItems.SetAt(itemDesc, itemText);
+ }
+
+ nLen = gb.BitRead(8); // text_length
+ gb.ReadBuffer(DescBuffer, nLen);
+ text = ConvertString(DescBuffer, nLen);
+ if (descriptorNumber == 0) { // new descriptor set
+ NowNext.ExtendedDescriptorsTexts.AddTail(text);
+ } else {
+ NowNext.ExtendedDescriptorsTexts.GetTail().Append(text);
+ }
+ break;
+ default:
+ SkipDescriptor (gb, nType, nLength);
+ break;
}
}
EndEnumDescriptors
}
m_Filter.SectionNumber++;
pSectionList.Release();
- }
- while (((InfoEvent.ServiceId != ulSID) || (InfoEvent.CurrentNextIndicator != 1) || (InfoEvent.RunninStatus != 4)) &&
- (m_Filter.SectionNumber <= 22));
+ } while (((InfoEvent.ServiceId != ulSID) || (InfoEvent.CurrentNextIndicator != 1) || (InfoEvent.RunninStatus != 4)) &&
+ (m_Filter.SectionNumber <= 22));
- if (InfoEvent.ServiceId != ulSID)
- {
+ if (InfoEvent.ServiceId != ulSID) {
NowNext.StartTime = _T("");
NowNext.Duration = _T("");
NowNext.cPresent = _T(" Info not available.");
@@ -510,41 +497,35 @@ HRESULT CMpeg2DataParser::ParseNIT() CheckNoLog (ParseSIHeader (gb, SI_NIT, wSectionLength, wTSID));
gb.BitRead(4); // reserved_future_use
- BeginEnumDescriptors(gb, nType, nLength) // for (i=0;i<N;i++) {
- {
+ BeginEnumDescriptors(gb, nType, nLength) { // for (i=0;i<N;i++) {
SkipDescriptor (gb, nType, nLength); // descriptor()
}
EndEnumDescriptors
gb.BitRead(4); // reserved_future_use
transport_stream_loop_length = gb.BitRead(12); // network_descriptors_length
- while (gb.GetSize() - gb.GetPos() > 4)
- {
+ while (gb.GetSize() - gb.GetPos() > 4) {
WORD transport_stream_id = gb.BitRead(16); // transport_stream_id
UNUSED_ALWAYS(transport_stream_id);
WORD original_network_id = gb.BitRead(16); // original_network_id
UNUSED_ALWAYS(original_network_id);
gb.BitRead(4); // reserved_future_use
- BeginEnumDescriptors (gb, nType, nLength)
- {
- switch (nType)
- {
- case DT_LOGICAL_CHANNEL :
- for (int i=0; i<nLength/4; i++)
- {
- WORD service_id = gb.BitRead (16);
- gb.BitRead(6);
- WORD logical_channel_number = gb.BitRead(10);
- if (Channels.Lookup(service_id))
- {
- Channels[service_id].SetOriginNumber (logical_channel_number);
- TRACE ("NIT association : %d -> %S\n", logical_channel_number, Channels[service_id].ToString());
+ BeginEnumDescriptors (gb, nType, nLength) {
+ switch (nType) {
+ case DT_LOGICAL_CHANNEL :
+ for (int i=0; i<nLength/4; i++) {
+ WORD service_id = gb.BitRead (16);
+ gb.BitRead(6);
+ WORD logical_channel_number = gb.BitRead(10);
+ if (Channels.Lookup(service_id)) {
+ Channels[service_id].SetOriginNumber (logical_channel_number);
+ TRACE ("NIT association : %d -> %S\n", logical_channel_number, Channels[service_id].ToString());
+ }
}
- }
- break;
- default :
- SkipDescriptor (gb, nType, nLength);
- break;
+ break;
+ default :
+ SkipDescriptor (gb, nType, nLength);
+ break;
}
}
EndEnumDescriptors
diff --git a/src/apps/mplayerc/Mpeg2SectionData.h b/src/apps/mplayerc/Mpeg2SectionData.h index 55b79673b..23c67084c 100644 --- a/src/apps/mplayerc/Mpeg2SectionData.h +++ b/src/apps/mplayerc/Mpeg2SectionData.h @@ -27,8 +27,7 @@ #pragma pack(1)
-typedef struct
-{
+typedef struct {
UINT8 TableID;
WORD SectionSyntaxIndicator : 1;
WORD Reserved1 : 3;
@@ -41,8 +40,7 @@ typedef struct UINT8 LastSectionNumber;
} SI_HEADER;
-typedef struct
-{
+typedef struct {
UINT8 TableID;
WORD SectionSyntaxIndicator : 1;
WORD Reserved1 : 3;
diff --git a/src/apps/mplayerc/MultiMonitor.cpp b/src/apps/mplayerc/MultiMonitor.cpp index b29f78b94..8dc6bb127 100644 --- a/src/apps/mplayerc/MultiMonitor.cpp +++ b/src/apps/mplayerc/MultiMonitor.cpp @@ -178,10 +178,11 @@ void CMonitor::CenterRectToMonitor( LPRECT lprc, const BOOL UseWorkAreaRect ) co int h = lprc->bottom - lprc->top;
CRect rect;
- if ( UseWorkAreaRect )
+ if ( UseWorkAreaRect ) {
GetWorkAreaRect( &rect );
- else
+ } else {
GetMonitorRect( &rect );
+ }
lprc->left = rect.left + ( rect.Width() - w ) / 2;
lprc->top = rect.top + ( rect.Height() - h ) / 2;
@@ -207,10 +208,11 @@ void CMonitor::ClipRectToMonitor( LPRECT lprc, const BOOL UseWorkAreaRect ) cons int h = lprc->bottom - lprc->top;
CRect rect;
- if ( UseWorkAreaRect )
+ if ( UseWorkAreaRect ) {
GetWorkAreaRect( &rect );
- else
+ } else {
GetMonitorRect( &rect );
+ }
lprc->left = max( rect.left, min( rect.right - w, lprc->left ) );
lprc->top = max( rect.top, min( rect.bottom - h, lprc->top ) );
diff --git a/src/apps/mplayerc/MultiMonitor.h b/src/apps/mplayerc/MultiMonitor.h index b1363494e..282a14e31 100644 --- a/src/apps/mplayerc/MultiMonitor.h +++ b/src/apps/mplayerc/MultiMonitor.h @@ -36,12 +36,12 @@ class CMonitor : public CObject
{
public:
-//construction destruction
+ //construction destruction
CMonitor();
CMonitor( const CMonitor& monitor );
virtual ~CMonitor();
-//operations
+ //operations
void Attach( const HMONITOR hMonitor );
HMONITOR Detach();
@@ -51,7 +51,7 @@ public: HDC CreateDC() const;
-//properties
+ //properties
void GetMonitorRect( LPRECT lprc ) const;
void GetWorkAreaRect( LPRECT lprc ) const;
@@ -66,24 +66,20 @@ public: BOOL IsPrimaryMonitor() const;
BOOL IsMonitor() const;
-//operators
- operator HMONITOR() const
- {
+ //operators
+ operator HMONITOR() const {
return this == NULL ? NULL : m_hMonitor;
}
- BOOL operator ==( const CMonitor& monitor ) const
- {
+ BOOL operator ==( const CMonitor& monitor ) const {
return m_hMonitor == (HMONITOR)monitor;
}
- BOOL operator !=( const CMonitor& monitor ) const
- {
+ BOOL operator !=( const CMonitor& monitor ) const {
return !( *this == monitor );
}
- CMonitor& operator =( const CMonitor& monitor )
- {
+ CMonitor& operator =( const CMonitor& monitor ) {
m_hMonitor = (HMONITOR)monitor;
return *this;
}
diff --git a/src/apps/mplayerc/OpenCapDeviceDlg.cpp b/src/apps/mplayerc/OpenCapDeviceDlg.cpp index a3f6410d0..3c1575414 100644 --- a/src/apps/mplayerc/OpenCapDeviceDlg.cpp +++ b/src/apps/mplayerc/OpenCapDeviceDlg.cpp @@ -27,44 +27,42 @@ #include "../../DSUtil/DSUtil.h"
-static struct cc_t
-{
+static struct cc_t {
long code;
AnalogVideoStandard standard;
const TCHAR* str;
-} s_countrycodes[] =
-{
+} s_countrycodes[] = {
{1, AnalogVideo_NTSC_M, _T("USA")},
-/* {1, AnalogVideo_NTSC_M, _T("Anguilla")},
- {1, AnalogVideo_NTSC_M, _T("Antigua")},
- {1, AnalogVideo_NTSC_M, _T("Bahamas")},
- {1, AnalogVideo_NTSC_M, _T("Barbados")},
- {1, AnalogVideo_NTSC_M, _T("Bermuda")},
- {1, AnalogVideo_NTSC_M, _T("British Virgin Islands")},
- {1, AnalogVideo_NTSC_M, _T("Canada")},
- {1, AnalogVideo_NTSC_M, _T("Cayman Islands")},
- {1, AnalogVideo_NTSC_M, _T("Dominica")},
- {1, AnalogVideo_NTSC_M, _T("Dominican Republic")},
- {1, AnalogVideo_NTSC_M, _T("Grenada")},
- {1, AnalogVideo_NTSC_M, _T("Jamaica")},
- {1, AnalogVideo_NTSC_M, _T("Montserrat")},
- {1, AnalogVideo_NTSC_M, _T("Nevis")},
- {1, AnalogVideo_NTSC_M, _T("St. Kitts")},
- {1, AnalogVideo_NTSC_M, _T("St. Vincent and the Grenadines")},
- {1, AnalogVideo_NTSC_M, _T("Trinidad and Tobago")},
- {1, AnalogVideo_NTSC_M, _T("Turks and Caicos Islands")},
- {1, AnalogVideo_NTSC_M, _T("Barbuda")},
- {1, AnalogVideo_NTSC_M, _T("Puerto Rico")},
- {1, AnalogVideo_NTSC_M, _T("Saint Lucia")},
- {1, AnalogVideo_NTSC_M, _T("United States Virgin Islands")},
-*/ {2, AnalogVideo_NTSC_M, _T("Canada")},
+ /* {1, AnalogVideo_NTSC_M, _T("Anguilla")},
+ {1, AnalogVideo_NTSC_M, _T("Antigua")},
+ {1, AnalogVideo_NTSC_M, _T("Bahamas")},
+ {1, AnalogVideo_NTSC_M, _T("Barbados")},
+ {1, AnalogVideo_NTSC_M, _T("Bermuda")},
+ {1, AnalogVideo_NTSC_M, _T("British Virgin Islands")},
+ {1, AnalogVideo_NTSC_M, _T("Canada")},
+ {1, AnalogVideo_NTSC_M, _T("Cayman Islands")},
+ {1, AnalogVideo_NTSC_M, _T("Dominica")},
+ {1, AnalogVideo_NTSC_M, _T("Dominican Republic")},
+ {1, AnalogVideo_NTSC_M, _T("Grenada")},
+ {1, AnalogVideo_NTSC_M, _T("Jamaica")},
+ {1, AnalogVideo_NTSC_M, _T("Montserrat")},
+ {1, AnalogVideo_NTSC_M, _T("Nevis")},
+ {1, AnalogVideo_NTSC_M, _T("St. Kitts")},
+ {1, AnalogVideo_NTSC_M, _T("St. Vincent and the Grenadines")},
+ {1, AnalogVideo_NTSC_M, _T("Trinidad and Tobago")},
+ {1, AnalogVideo_NTSC_M, _T("Turks and Caicos Islands")},
+ {1, AnalogVideo_NTSC_M, _T("Barbuda")},
+ {1, AnalogVideo_NTSC_M, _T("Puerto Rico")},
+ {1, AnalogVideo_NTSC_M, _T("Saint Lucia")},
+ {1, AnalogVideo_NTSC_M, _T("United States Virgin Islands")},
+ */ {2, AnalogVideo_NTSC_M, _T("Canada")},
{7, AnalogVideo_SECAM_D, _T("Russia")},
-/* {7, AnalogVideo_SECAM_D, _T("Kazakhstan")},
- {7, AnalogVideo_SECAM_D, _T("Kyrgyzstan")},
- {7, AnalogVideo_SECAM_D, _T("Tajikistan")},
- {7, AnalogVideo_SECAM_D, _T("Turkmenistan")},
- {7, AnalogVideo_SECAM_D, _T("Uzbekistan")},
-*/ {20, AnalogVideo_SECAM_B, _T("Egypt")},
+ /* {7, AnalogVideo_SECAM_D, _T("Kazakhstan")},
+ {7, AnalogVideo_SECAM_D, _T("Kyrgyzstan")},
+ {7, AnalogVideo_SECAM_D, _T("Tajikistan")},
+ {7, AnalogVideo_SECAM_D, _T("Turkmenistan")},
+ {7, AnalogVideo_SECAM_D, _T("Uzbekistan")},
+ */ {20, AnalogVideo_SECAM_B, _T("Egypt")},
{27, AnalogVideo_PAL_I, _T("South Africa")},
{30, AnalogVideo_SECAM_B, _T("Greece")},
{31, AnalogVideo_PAL_B, _T("Netherlands")},
@@ -95,7 +93,7 @@ static struct cc_t {58, AnalogVideo_NTSC_M, _T("Bolivarian Republic of Venezuela")},
{60, AnalogVideo_PAL_B, _T("Malaysia")},
{61, AnalogVideo_PAL_B, _T("Australia")},
-// {61, AnalogVideo_NTSC_M, _T("Cocos-Keeling Islands")},
+ // {61, AnalogVideo_NTSC_M, _T("Cocos-Keeling Islands")},
{62, AnalogVideo_PAL_B, _T("Indonesia")},
{63, AnalogVideo_NTSC_M, _T("Philippines")},
{64, AnalogVideo_PAL_B, _T("New Zealand")},
@@ -165,7 +163,7 @@ static struct cc_t {267, AnalogVideo_SECAM_K, _T("Botswana")},
{268, AnalogVideo_PAL_B, _T("Swaziland")},
{269, AnalogVideo_SECAM_K, _T("Mayotte Island")},
-// {269, AnalogVideo_NTSC_M, _T("Comoros")},
+ // {269, AnalogVideo_NTSC_M, _T("Comoros")},
{290, AnalogVideo_NTSC_M, _T("St. Helena")},
{291, AnalogVideo_NTSC_M, _T("Eritrea")},
{297, AnalogVideo_NTSC_M, _T("Aruba")},
@@ -209,7 +207,7 @@ static struct cc_t {508, AnalogVideo_SECAM_K, _T("St. Pierre and Miquelon")},
{509, AnalogVideo_NTSC_M, _T("Haiti")},
{590, AnalogVideo_SECAM_K, _T("Guadeloupe")},
-// {590, AnalogVideo_NTSC_M, _T("French Antilles")},
+ // {590, AnalogVideo_NTSC_M, _T("French Antilles")},
{591, AnalogVideo_PAL_N, _T("Bolivia")},
{592, AnalogVideo_SECAM_K, _T("Guyana")},
{593, AnalogVideo_NTSC_M, _T("Ecuador")},
@@ -220,12 +218,12 @@ static struct cc_t {598, AnalogVideo_PAL_N, _T("Uruguay")},
{599, AnalogVideo_NTSC_M, _T("Netherlands Antilles")},
{670, AnalogVideo_NTSC_M, _T("Saipan Island")},
-// {670, AnalogVideo_NTSC_M, _T("Rota Island")},
-// {670, AnalogVideo_NTSC_M, _T("Tinian Island")},
+ // {670, AnalogVideo_NTSC_M, _T("Rota Island")},
+ // {670, AnalogVideo_NTSC_M, _T("Tinian Island")},
{671, AnalogVideo_NTSC_M, _T("Guam")},
{672, AnalogVideo_NTSC_M, _T("Christmas Island")},
{672, AnalogVideo_NTSC_M, _T("Australian Antarctic Territory")},
-// {672, AnalogVideo_PAL_B, _T("Norfolk Island")},
+ // {672, AnalogVideo_PAL_B, _T("Norfolk Island")},
{673, AnalogVideo_PAL_B, _T("Brunei")},
{674, AnalogVideo_NTSC_M, _T("Nauru")},
{675, AnalogVideo_PAL_B, _T("Papua New Guinea")},
@@ -333,8 +331,7 @@ BOOL COpenCapDeviceDlg::OnInitDialog() int iSel = vidstr == dummy ? 0 : -1;
- BeginEnumSysDev(CLSID_VideoInputDeviceCategory, pMoniker)
- {
+ BeginEnumSysDev(CLSID_VideoInputDeviceCategory, pMoniker) {
CComPtr<IPropertyBag> pPB;
pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB);
@@ -343,22 +340,23 @@ BOOL COpenCapDeviceDlg::OnInitDialog() int i = m_vidctrl.AddString(CString(var.bstrVal));
LPOLESTR strName = NULL;
- if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName)))
- {
+ if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName))) {
m_vidnames.Add(CString(strName));
- if(vidstr == CString(strName)) iSel = i;
+ if(vidstr == CString(strName)) {
+ iSel = i;
+ }
CoTaskMemFree(strName);
}
}
EndEnumSysDev
- if(m_vidctrl.GetCount())
+ if(m_vidctrl.GetCount()) {
m_vidctrl.SetCurSel(iSel);
+ }
iSel = audstr == dummy ? 0 : -1;
- BeginEnumSysDev(CLSID_AudioInputDeviceCategory, pMoniker)
- {
+ BeginEnumSysDev(CLSID_AudioInputDeviceCategory, pMoniker) {
CComPtr<IPropertyBag> pPB;
pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB);
@@ -367,10 +365,11 @@ BOOL COpenCapDeviceDlg::OnInitDialog() int i = m_audctrl.AddString(CString(var.bstrVal));
LPOLESTR strName = NULL;
- if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName)))
- {
+ if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName))) {
m_audnames.Add(CString(strName));
- if(audstr == CString(strName)) iSel = i;
+ if(audstr == CString(strName)) {
+ iSel = i;
+ }
CoTaskMemFree(strName);
}
}
@@ -379,79 +378,80 @@ BOOL COpenCapDeviceDlg::OnInitDialog() {
int i = m_audctrl.AddString(_T("<Video Capture Device>"));
m_audnames.Add(_T(""));
- if(audstr.IsEmpty()) iSel = i;
+ if(audstr.IsEmpty()) {
+ iSel = i;
+ }
}
- if(m_audctrl.GetCount())
+ if(m_audctrl.GetCount()) {
m_audctrl.SetCurSel(iSel);
+ }
iSel = 0;
- for(int j = 0; j < countof(s_countrycodes); j++)
- {
+ for(int j = 0; j < countof(s_countrycodes); j++) {
CString standard;
- switch(s_countrycodes[j].standard)
- {
- case AnalogVideo_NTSC_M:
- standard = _T("NTSC M");
- break;
- case AnalogVideo_NTSC_M_J:
- standard = _T("NTSC M J");
- break;
- case AnalogVideo_NTSC_433:
- standard = _T("NTSC 433");
- break;
- case AnalogVideo_PAL_B:
- standard = _T("PAL B");
- break;
- case AnalogVideo_PAL_D:
- standard = _T("PAL D");
- break;
- case AnalogVideo_PAL_G:
- standard = _T("PAL G");
- break;
- case AnalogVideo_PAL_H:
- standard = _T("PAL H");
- break;
- case AnalogVideo_PAL_I:
- standard = _T("PAL I");
- break;
- case AnalogVideo_PAL_M:
- standard = _T("PAL M");
- break;
- case AnalogVideo_PAL_N:
- standard = _T("PAL N");
- break;
- case AnalogVideo_PAL_60:
- standard = _T("PAL 60");
- break;
- case AnalogVideo_SECAM_B:
- standard = _T("SECAM B");
- break;
- case AnalogVideo_SECAM_D:
- standard = _T("SECAM D");
- break;
- case AnalogVideo_SECAM_G:
- standard = _T("SECAM G");
- break;
- case AnalogVideo_SECAM_H:
- standard = _T("SECAM H");
- break;
- case AnalogVideo_SECAM_K:
- standard = _T("SECAM K");
- break;
- case AnalogVideo_SECAM_K1:
- standard = _T("SECAM K1");
- break;
- case AnalogVideo_SECAM_L:
- standard = _T("SECAM L");
- break;
- case AnalogVideo_SECAM_L1:
- standard = _T("SECAM L1");
- break;
- case AnalogVideo_PAL_N_COMBO:
- standard = _T("PAL N COMBO");
- break;
+ switch(s_countrycodes[j].standard) {
+ case AnalogVideo_NTSC_M:
+ standard = _T("NTSC M");
+ break;
+ case AnalogVideo_NTSC_M_J:
+ standard = _T("NTSC M J");
+ break;
+ case AnalogVideo_NTSC_433:
+ standard = _T("NTSC 433");
+ break;
+ case AnalogVideo_PAL_B:
+ standard = _T("PAL B");
+ break;
+ case AnalogVideo_PAL_D:
+ standard = _T("PAL D");
+ break;
+ case AnalogVideo_PAL_G:
+ standard = _T("PAL G");
+ break;
+ case AnalogVideo_PAL_H:
+ standard = _T("PAL H");
+ break;
+ case AnalogVideo_PAL_I:
+ standard = _T("PAL I");
+ break;
+ case AnalogVideo_PAL_M:
+ standard = _T("PAL M");
+ break;
+ case AnalogVideo_PAL_N:
+ standard = _T("PAL N");
+ break;
+ case AnalogVideo_PAL_60:
+ standard = _T("PAL 60");
+ break;
+ case AnalogVideo_SECAM_B:
+ standard = _T("SECAM B");
+ break;
+ case AnalogVideo_SECAM_D:
+ standard = _T("SECAM D");
+ break;
+ case AnalogVideo_SECAM_G:
+ standard = _T("SECAM G");
+ break;
+ case AnalogVideo_SECAM_H:
+ standard = _T("SECAM H");
+ break;
+ case AnalogVideo_SECAM_K:
+ standard = _T("SECAM K");
+ break;
+ case AnalogVideo_SECAM_K1:
+ standard = _T("SECAM K1");
+ break;
+ case AnalogVideo_SECAM_L:
+ standard = _T("SECAM L");
+ break;
+ case AnalogVideo_SECAM_L1:
+ standard = _T("SECAM L1");
+ break;
+ case AnalogVideo_PAL_N_COMBO:
+ standard = _T("PAL N COMBO");
+ break;
}
CString str;
@@ -459,11 +459,14 @@ BOOL COpenCapDeviceDlg::OnInitDialog() int i = m_countryctrl.AddString(str);
m_countryctrl.SetItemDataPtr(i, &s_countrycodes[j]);
- if(country == s_countrycodes[j].code) iSel = i;
+ if(country == s_countrycodes[j].code) {
+ iSel = i;
+ }
}
- if(m_countryctrl.GetCount())
+ if(m_countryctrl.GetCount()) {
m_countryctrl.SetCurSel(iSel);
+ }
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
@@ -475,20 +478,17 @@ void COpenCapDeviceDlg::OnBnClickedOk() AppSettings& s = AfxGetAppSettings();
- if(m_vidctrl.GetCurSel() >= 0)
- {
+ if(m_vidctrl.GetCurSel() >= 0) {
m_vidstr = m_vidnames[m_vidctrl.GetCurSel()];
s.strAnalogVideo = m_vidstr;
}
- if(m_audctrl.GetCurSel() >= 0)
- {
+ if(m_audctrl.GetCurSel() >= 0) {
m_audstr = m_audnames[m_audctrl.GetCurSel()];
s.strAnalogAudio = m_audstr;
}
- if(m_countryctrl.GetCurSel() >= 0)
- {
+ if(m_countryctrl.GetCurSel() >= 0) {
m_country = ((cc_t*)m_countryctrl.GetItemDataPtr(m_countryctrl.GetCurSel()))->code;
s.iAnalogCountry = m_country;
}
diff --git a/src/apps/mplayerc/OpenCapDeviceDlg.h b/src/apps/mplayerc/OpenCapDeviceDlg.h index 5a16c72e6..3039ac4c2 100644 --- a/src/apps/mplayerc/OpenCapDeviceDlg.h +++ b/src/apps/mplayerc/OpenCapDeviceDlg.h @@ -31,7 +31,7 @@ class COpenCapDeviceDlg : public CResizableDialog
{
-// DECLARE_DYNAMIC(COpenCapDeviceDlg)
+ // DECLARE_DYNAMIC(COpenCapDeviceDlg)
private:
CAtlArray<CString> m_vidnames, m_audnames;
@@ -47,7 +47,7 @@ public: CString m_vidstr, m_audstr;
int m_country;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_OPENCAPDEVICE_DLG };
protected:
diff --git a/src/apps/mplayerc/OpenDirHelper.cpp b/src/apps/mplayerc/OpenDirHelper.cpp index 6b2cc6514..170565e2c 100644 --- a/src/apps/mplayerc/OpenDirHelper.cpp +++ b/src/apps/mplayerc/OpenDirHelper.cpp @@ -45,7 +45,9 @@ void COpenDirHelper::SetFont(HWND hwnd,LPTSTR FontName,int FontSize) hfOld = (HFONT)SendMessage(hwnd,WM_GETFONT,NULL,NULL); //get old font
SendMessage(hwnd,WM_SETFONT,(WPARAM)hf,TRUE); // set new font
- if(!hfOld && (hfOld!=hf)) DeleteObject(hfOld); //if the old font is not system font or the same as newfont, release it.
+ if(!hfOld && (hfOld!=hf)) {
+ DeleteObject(hfOld); //if the old font is not system font or the same as newfont, release it.
+ }
ReleaseDC(hwnd,hdc);
}
@@ -53,14 +55,10 @@ void COpenDirHelper::SetFont(HWND hwnd,LPTSTR FontName,int FontSize) // Subclass procedure
LRESULT APIENTRY COpenDirHelper::CheckBoxSubclassProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
- if(uMsg==WM_LBUTTONUP)
- {
- if((SendMessage(hwnd,BM_GETCHECK,0,0))==1)
- {
+ if(uMsg==WM_LBUTTONUP) {
+ if((SendMessage(hwnd,BM_GETCHECK,0,0))==1) {
m_incl_subdir = FALSE;
- }
- else
- {
+ } else {
m_incl_subdir = TRUE;
}
}
@@ -72,8 +70,7 @@ int __stdcall COpenDirHelper::BrowseCallbackProcDIR(HWND hwnd,UINT uMsg,LPARAM HWND checkbox;
//Initialization callback message
- if(uMsg==BFFM_INITIALIZED)
- {
+ if(uMsg==BFFM_INITIALIZED) {
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)(LPCTSTR)strLastOpenDir);
RECT ListViewRect;
@@ -120,24 +117,20 @@ void COpenDirHelper::RecurseAddDir(CString path, CAtlList<CString>* sl) WIN32_FIND_DATA fd = {0};
HANDLE hFind = FindFirstFile(path + _T("*.*"), &fd);
- if(hFind != INVALID_HANDLE_VALUE)
- {
- do
- {
+ if(hFind != INVALID_HANDLE_VALUE) {
+ do {
CString f_name = fd.cFileName;
- if((fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (f_name!=_T(".")) && (f_name!=_T("..")))
- {
+ if((fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (f_name!=_T(".")) && (f_name!=_T(".."))) {
CString fullpath = path + f_name;
- if(fullpath[fullpath.GetLength()-1] != '\\') fullpath += '\\';
+ if(fullpath[fullpath.GetLength()-1] != '\\') {
+ fullpath += '\\';
+ }
sl->AddTail(fullpath);
RecurseAddDir(fullpath, sl);
- }
- else
- {
+ } else {
continue;
}
- }
- while(FindNextFile(hFind, &fd));
+ } while(FindNextFile(hFind, &fd));
FindClose(hFind);
}
}
diff --git a/src/apps/mplayerc/OpenDirHelper.h b/src/apps/mplayerc/OpenDirHelper.h index 9118c3463..f82aa713e 100644 --- a/src/apps/mplayerc/OpenDirHelper.h +++ b/src/apps/mplayerc/OpenDirHelper.h @@ -23,7 +23,8 @@ #pragma once
-class COpenDirHelper {
+class COpenDirHelper
+{
public:
static WNDPROC CBProc;
static bool m_incl_subdir;
diff --git a/src/apps/mplayerc/OpenDlg.cpp b/src/apps/mplayerc/OpenDlg.cpp index 9bce1117f..60c50e3c4 100644 --- a/src/apps/mplayerc/OpenDlg.cpp +++ b/src/apps/mplayerc/OpenDlg.cpp @@ -75,19 +75,23 @@ BOOL COpenDlg::OnInitDialog() MRU.ReadList();
m_mrucombo.ResetContent();
for(int i = 0; i < MRU.GetSize(); i++)
- if(!MRU[i].IsEmpty())
+ if(!MRU[i].IsEmpty()) {
m_mrucombo.AddString(MRU[i]);
+ }
CorrectComboListWidth(m_mrucombo, GetFont());
CRecentFileList& MRUDub = AfxGetAppSettings().MRUDub;
MRUDub.ReadList();
m_mrucombo2.ResetContent();
for(int i = 0; i < MRUDub.GetSize(); i++)
- if(!MRUDub[i].IsEmpty())
+ if(!MRUDub[i].IsEmpty()) {
m_mrucombo2.AddString(MRUDub[i]);
+ }
CorrectComboListWidth(m_mrucombo2, GetFont());
- if(m_mrucombo.GetCount() > 0) m_mrucombo.SetCurSel(0);
+ if(m_mrucombo.GetCount() > 0) {
+ m_mrucombo.SetCurSel(0);
+ }
AddAnchor(m_mrucombo, TOP_LEFT, TOP_RIGHT);
AddAnchor(m_mrucombo2, TOP_LEFT, TOP_RIGHT);
@@ -126,13 +130,14 @@ void COpenDlg::OnBnClickedBrowsebutton() COpenFileDlg fd(mask, true, NULL, m_path,
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLEINCLUDENOTIFY,
filter, this);
- if(fd.DoModal() != IDOK) return;
+ if(fd.DoModal() != IDOK) {
+ return;
+ }
m_fns.RemoveAll();
POSITION pos = fd.GetStartPosition();
- while(pos)
- {
+ while(pos) {
/*
CString str = fd.GetNextPathName(pos);
POSITION insertpos = m_fns.GetTailPosition();
@@ -147,8 +152,7 @@ void COpenDlg::OnBnClickedBrowsebutton() if(m_fns.GetCount() > 1
|| m_fns.GetCount() == 1
&& (m_fns.GetHead()[m_fns.GetHead().GetLength()-1] == '\\'
- || m_fns.GetHead()[m_fns.GetHead().GetLength()-1] == '*'))
- {
+ || m_fns.GetHead()[m_fns.GetHead().GetLength()-1] == '*')) {
m_fMultipleFiles = true;
EndDialog(IDOK);
return;
@@ -169,7 +173,9 @@ void COpenDlg::OnBnClickedBrowsebutton2() OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ENABLEINCLUDENOTIFY,
filter, this);
- if(fd.DoModal() != IDOK) return;
+ if(fd.DoModal() != IDOK) {
+ return;
+ }
m_mrucombo2.SetWindowText(fd.GetPathName());
}
@@ -180,8 +186,9 @@ void COpenDlg::OnBnClickedOk() m_fns.RemoveAll();
m_fns.AddTail(m_path);
- if(m_mrucombo2.IsWindowEnabled())
+ if(m_mrucombo2.IsWindowEnabled()) {
m_fns.AddTail(m_path2);
+ }
m_fMultipleFiles = false;
diff --git a/src/apps/mplayerc/OpenDlg.h b/src/apps/mplayerc/OpenDlg.h index b30e8cf4e..c4ccbb91c 100644 --- a/src/apps/mplayerc/OpenDlg.h +++ b/src/apps/mplayerc/OpenDlg.h @@ -30,7 +30,7 @@ class COpenDlg : public CResizableDialog
{
-// DECLARE_DYNAMIC(COpenDlg)
+ // DECLARE_DYNAMIC(COpenDlg)
public:
COpenDlg(CWnd* pParent = NULL); // standard constructor
@@ -39,7 +39,7 @@ public: bool m_fMultipleFiles;
CAtlList<CString> m_fns;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_OPEN_DLG };
CComboBox m_mrucombo;
CString m_path;
diff --git a/src/apps/mplayerc/OpenFileDlg.cpp b/src/apps/mplayerc/OpenFileDlg.cpp index 2d0247995..bb471d95d 100644 --- a/src/apps/mplayerc/OpenFileDlg.cpp +++ b/src/apps/mplayerc/OpenFileDlg.cpp @@ -64,13 +64,13 @@ END_MESSAGE_MAP() LRESULT CALLBACK COpenFileDlg::WindowProcNew(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == WM_COMMAND && HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDOK
- && m_fAllowDirSelection)
- {
+ && m_fAllowDirSelection) {
CAutoVectorPtr<TCHAR> path;
path.Allocate(_MAX_PATH+1); // _MAX_PATH should be bigger for multiple selection, but we are only interested if it's zero length
// note: allocating _MAX_PATH only will cause a buffer overrun for too long strings, and will result in a silent app disappearing crash, 100% reproducible
- if(::GetDlgItemText(hwnd, cmb13, (TCHAR*)path, _MAX_PATH) == 0)
+ if(::GetDlgItemText(hwnd, cmb13, (TCHAR*)path, _MAX_PATH) == 0) {
::SendMessage(hwnd, CDM_SETCONTROLTEXT, edt1, (LPARAM)__DUMMY__);
+ }
}
return CallWindowProc(COpenFileDlg::m_wndProc, hwnd, message, wParam, lParam);
@@ -89,7 +89,9 @@ BOOL COpenFileDlg::OnInitDialog() void COpenFileDlg::OnDestroy()
{
int i = GetPathName().Find(__DUMMY__);
- if(i >= 0) m_pOFN->lpstrFile[i] = m_pOFN->lpstrFile[i+1] = 0;
+ if(i >= 0) {
+ m_pOFN->lpstrFile[i] = m_pOFN->lpstrFile[i+1] = 0;
+ }
CFileDialog::OnDestroy();
}
@@ -100,18 +102,17 @@ BOOL COpenFileDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) OFNOTIFY* pNotify = (OFNOTIFY*)lParam;
// allow message map to override
- if (__super::OnNotify(wParam, lParam, pResult))
- {
+ if (__super::OnNotify(wParam, lParam, pResult)) {
ASSERT(pNotify->hdr.code != CDN_INCLUDEITEM);
return TRUE;
}
- switch(pNotify->hdr.code)
- {
- case CDN_INCLUDEITEM:
- if(OnIncludeItem((OFNOTIFYEX*)lParam, pResult))
- return TRUE;
- break;
+ switch(pNotify->hdr.code) {
+ case CDN_INCLUDEITEM:
+ if(OnIncludeItem((OFNOTIFYEX*)lParam, pResult)) {
+ return TRUE;
+ }
+ break;
}
return FALSE; // not handled
@@ -120,23 +121,23 @@ BOOL COpenFileDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) BOOL COpenFileDlg::OnIncludeItem(OFNOTIFYEX* pOFNEx, LRESULT* pResult)
{
TCHAR buff[_MAX_PATH];
- if(!SHGetPathFromIDList((LPCITEMIDLIST)pOFNEx->pidl, buff))
- {
+ if(!SHGetPathFromIDList((LPCITEMIDLIST)pOFNEx->pidl, buff)) {
STRRET s;
HRESULT hr = ((IShellFolder*)pOFNEx->psf)->GetDisplayNameOf((LPCITEMIDLIST)pOFNEx->pidl, SHGDN_NORMAL|SHGDN_FORPARSING, &s);
- if(S_OK != hr) return FALSE;
- switch(s.uType)
- {
- case STRRET_CSTR:
- _tcscpy(buff, CString(s.cStr));
- break;
- case STRRET_WSTR:
- _tcscpy(buff, CString(s.pOleStr));
- CoTaskMemFree(s.pOleStr);
- break;
- default:
+ if(S_OK != hr) {
return FALSE;
}
+ switch(s.uType) {
+ case STRRET_CSTR:
+ _tcscpy(buff, CString(s.cStr));
+ break;
+ case STRRET_WSTR:
+ _tcscpy(buff, CString(s.pOleStr));
+ CoTaskMemFree(s.pOleStr);
+ break;
+ default:
+ return FALSE;
+ }
}
CString fn(buff);
@@ -147,8 +148,9 @@ BOOL COpenFileDlg::OnIncludeItem(OFNOTIFYEX* pOFNEx, LRESULT* pResult) return FALSE;
*/
int i = fn.ReverseFind('.'), j = fn.ReverseFind('\\');
- if(i < 0 || i < j)
+ if(i < 0 || i < j) {
return FALSE;
+ }
CString mask = m_mask[pOFNEx->lpOFN->nFilterIndex-1] + _T(";");
CString ext = fn.Mid(i).MakeLower() + _T(";");
diff --git a/src/apps/mplayerc/PPageAccelTbl.cpp b/src/apps/mplayerc/PPageAccelTbl.cpp index 0c46c930c..e0214fae3 100644 --- a/src/apps/mplayerc/PPageAccelTbl.cpp +++ b/src/apps/mplayerc/PPageAccelTbl.cpp @@ -26,14 +26,12 @@ #include "PPageAccelTbl.h"
-struct APP_COMMAND
-{
+struct APP_COMMAND {
UINT appcmd;
LPCTSTR cmdname;
};
-APP_COMMAND g_CommandList[] =
-{
+APP_COMMAND g_CommandList[] = {
{0, _T("")},
{APPCOMMAND_BROWSER_BACKWARD, _T("BROWSER_BACKWARD")},
{APPCOMMAND_BROWSER_FORWARD, _T("BROWSER_FORWARD")},
@@ -134,8 +132,7 @@ CPPageAccelTbl::~CPPageAccelTbl() BOOL CPPageAccelTbl::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN
- && (pMsg->hwnd == m_WinLircEdit.m_hWnd || pMsg->hwnd == m_UIceEdit.m_hWnd))
- {
+ && (pMsg->hwnd == m_WinLircEdit.m_hWnd || pMsg->hwnd == m_UIceEdit.m_hWnd)) {
OnApply();
return TRUE;
}
@@ -146,8 +143,7 @@ BOOL CPPageAccelTbl::PreTranslateMessage(MSG* pMsg) void CPPageAccelTbl::SetupList()
{
- for(int row = 0; row < m_list.GetItemCount(); row++)
- {
+ for(int row = 0; row < m_list.GetItemCount(); row++) {
wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(row));
CString mod = MakeAccelModLabel(wc.fVirt);
@@ -178,579 +174,583 @@ void CPPageAccelTbl::SetupList() CString CPPageAccelTbl::MakeAccelModLabel(BYTE fVirt)
{
CString str;
- if(fVirt&FCONTROL)
- {
- if(!str.IsEmpty()) str += _T(" + ");
+ if(fVirt&FCONTROL) {
+ if(!str.IsEmpty()) {
+ str += _T(" + ");
+ }
str += _T("Ctrl");
}
- if(fVirt&FALT)
- {
- if(!str.IsEmpty()) str += _T(" + ");
+ if(fVirt&FALT) {
+ if(!str.IsEmpty()) {
+ str += _T(" + ");
+ }
str += _T("Alt");
}
- if(fVirt&FSHIFT)
- {
- if(!str.IsEmpty()) str += _T(" + ");
+ if(fVirt&FSHIFT) {
+ if(!str.IsEmpty()) {
+ str += _T(" + ");
+ }
str += _T("Shift");
}
- if(str.IsEmpty()) str = ResStr(IDS_AG_NONE);
+ if(str.IsEmpty()) {
+ str = ResStr(IDS_AG_NONE);
+ }
return(str);
}
CString CPPageAccelTbl::MakeAccelVkeyLabel(WORD key, bool fVirtKey)
{
-// Reference page for Virtual-Key Codes: http://msdn.microsoft.com/en-us/library/ms645540
+ // Reference page for Virtual-Key Codes: http://msdn.microsoft.com/en-us/library/ms645540
CString str;
- switch(key)
- {
- case VK_LBUTTON:
- str = _T("VK_LBUTTON");
- break;
- case VK_RBUTTON:
- str = _T("VK_RBUTTON");
- break;
- case VK_CANCEL:
- str = _T("VK_CANCEL");
- break;
- case VK_MBUTTON:
- str = _T("VK_MBUTTON");
- break;
- case VK_XBUTTON1:
- str = _T("VK_XBUTTON1");
- break;
- case VK_XBUTTON2:
- str = _T("VK_XBUTTON2");
- break;
- case VK_BACK:
- str = _T("VK_BACK");
- break;
- case VK_TAB:
- str = _T("VK_TAB");
- break;
- case VK_CLEAR:
- str = _T("VK_CLEAR");
- break;
- case VK_RETURN:
- str = _T("VK_RETURN");
- break;
- case VK_SHIFT:
- str = _T("VK_SHIFT");
- break;
- case VK_CONTROL:
- str = _T("VK_CONTROL");
- break;
- case VK_MENU:
- str = _T("VK_MENU");
- break;
- case VK_PAUSE:
- str = _T("VK_PAUSE");
- break;
- case VK_CAPITAL:
- str = _T("VK_CAPITAL");
- break;
-// case VK_KANA: str = _T("VK_KANA"); break;
-// case VK_HANGEUL: str = _T("VK_HANGEUL"); break;
- case VK_HANGUL:
- str = _T("VK_HANGUL");
- break;
- case VK_JUNJA:
- str = _T("VK_JUNJA");
- break;
- case VK_FINAL:
- str = _T("VK_FINAL");
- break;
-// case VK_HANJA: str = _T("VK_HANJA"); break;
- case VK_KANJI:
- str = _T("VK_KANJI");
- break;
- case VK_ESCAPE:
- str = _T("VK_ESCAPE");
- break;
- case VK_CONVERT:
- str = _T("VK_CONVERT");
- break;
- case VK_NONCONVERT:
- str = _T("VK_NONCONVERT");
- break;
- case VK_ACCEPT:
- str = _T("VK_ACCEPT");
- break;
- case VK_MODECHANGE:
- str = _T("VK_MODECHANGE");
- break;
- case VK_SPACE:
- str = _T("VK_SPACE");
- break;
- case VK_PRIOR:
- str = _T("VK_PRIOR");
- break;
- case VK_NEXT:
- str = _T("VK_NEXT");
- break;
- case VK_END:
- str = _T("VK_END");
- break;
- case VK_HOME:
- str = _T("VK_HOME");
- break;
- case VK_LEFT:
- str = _T("VK_LEFT");
- break;
- case VK_UP:
- str = _T("VK_UP");
- break;
- case VK_RIGHT:
- str = _T("VK_RIGHT");
- break;
- case VK_DOWN:
- str = _T("VK_DOWN");
- break;
- case VK_SELECT:
- str = _T("VK_SELECT");
- break;
- case VK_PRINT:
- str = _T("VK_PRINT");
- break;
- case VK_EXECUTE:
- str = _T("VK_EXECUTE");
- break;
- case VK_SNAPSHOT:
- str = _T("VK_SNAPSHOT");
- break;
- case VK_INSERT:
- str = _T("VK_INSERT");
- break;
- case VK_DELETE:
- str = _T("VK_DELETE");
- break;
- case VK_HELP:
- str = _T("VK_HELP");
- break;
- case VK_LWIN:
- str = _T("VK_LWIN");
- break;
- case VK_RWIN:
- str = _T("VK_RWIN");
- break;
- case VK_APPS:
- str = _T("VK_APPS");
- break;
- case VK_SLEEP:
- str = _T("VK_SLEEP");
- break;
- case VK_NUMPAD0:
- str = _T("VK_NUMPAD0");
- break;
- case VK_NUMPAD1:
- str = _T("VK_NUMPAD1");
- break;
- case VK_NUMPAD2:
- str = _T("VK_NUMPAD2");
- break;
- case VK_NUMPAD3:
- str = _T("VK_NUMPAD3");
- break;
- case VK_NUMPAD4:
- str = _T("VK_NUMPAD4");
- break;
- case VK_NUMPAD5:
- str = _T("VK_NUMPAD5");
- break;
- case VK_NUMPAD6:
- str = _T("VK_NUMPAD6");
- break;
- case VK_NUMPAD7:
- str = _T("VK_NUMPAD7");
- break;
- case VK_NUMPAD8:
- str = _T("VK_NUMPAD8");
- break;
- case VK_NUMPAD9:
- str = _T("VK_NUMPAD9");
- break;
- case VK_MULTIPLY:
- str = _T("VK_MULTIPLY");
- break;
- case VK_ADD:
- str = _T("VK_ADD");
- break;
- case VK_SEPARATOR:
- str = _T("VK_SEPARATOR");
- break;
- case VK_SUBTRACT:
- str = _T("VK_SUBTRACT");
- break;
- case VK_DECIMAL:
- str = _T("VK_DECIMAL");
- break;
- case VK_DIVIDE:
- str = _T("VK_DIVIDE");
- break;
- case VK_F1:
- str = _T("VK_F1");
- break;
- case VK_F2:
- str = _T("VK_F2");
- break;
- case VK_F3:
- str = _T("VK_F3");
- break;
- case VK_F4:
- str = _T("VK_F4");
- break;
- case VK_F5:
- str = _T("VK_F5");
- break;
- case VK_F6:
- str = _T("VK_F6");
- break;
- case VK_F7:
- str = _T("VK_F7");
- break;
- case VK_F8:
- str = _T("VK_F8");
- break;
- case VK_F9:
- str = _T("VK_F9");
- break;
- case VK_F10:
- str = _T("VK_F10");
- break;
- case VK_F11:
- str = _T("VK_F11");
- break;
- case VK_F12:
- str = _T("VK_F12");
- break;
- case VK_F13:
- str = _T("VK_F13");
- break;
- case VK_F14:
- str = _T("VK_F14");
- break;
- case VK_F15:
- str = _T("VK_F15");
- break;
- case VK_F16:
- str = _T("VK_F16");
- break;
- case VK_F17:
- str = _T("VK_F17");
- break;
- case VK_F18:
- str = _T("VK_F18");
- break;
- case VK_F19:
- str = _T("VK_F19");
- break;
- case VK_F20:
- str = _T("VK_F20");
- break;
- case VK_F21:
- str = _T("VK_F21");
- break;
- case VK_F22:
- str = _T("VK_F22");
- break;
- case VK_F23:
- str = _T("VK_F23");
- break;
- case VK_F24:
- str = _T("VK_F24");
- break;
- case VK_NUMLOCK:
- str = _T("VK_NUMLOCK");
- break;
- case VK_SCROLL:
- str = _T("VK_SCROLL");
- break;
-// case VK_OEM_NEC_EQUAL: str = _T("VK_OEM_NEC_EQUAL"); break;
- case VK_OEM_FJ_JISHO:
- str = _T("VK_OEM_FJ_JISHO");
- break;
- case VK_OEM_FJ_MASSHOU:
- str = _T("VK_OEM_FJ_MASSHOU");
- break;
- case VK_OEM_FJ_TOUROKU:
- str = _T("VK_OEM_FJ_TOUROKU");
- break;
- case VK_OEM_FJ_LOYA:
- str = _T("VK_OEM_FJ_LOYA");
- break;
- case VK_OEM_FJ_ROYA:
- str = _T("VK_OEM_FJ_ROYA");
- break;
- case VK_LSHIFT:
- str = _T("VK_LSHIFT");
- break;
- case VK_RSHIFT:
- str = _T("VK_RSHIFT");
- break;
- case VK_LCONTROL:
- str = _T("VK_LCONTROL");
- break;
- case VK_RCONTROL:
- str = _T("VK_RCONTROL");
- break;
- case VK_LMENU:
- str = _T("VK_LMENU");
- break;
- case VK_RMENU:
- str = _T("VK_RMENU");
- break;
- case VK_BROWSER_BACK:
- str = _T("VK_BROWSER_BACK");
- break;
- case VK_BROWSER_FORWARD:
- str = _T("VK_BROWSER_FORWARD");
- break;
- case VK_BROWSER_REFRESH:
- str = _T("VK_BROWSER_REFRESH");
- break;
- case VK_BROWSER_STOP:
- str = _T("VK_BROWSER_STOP");
- break;
- case VK_BROWSER_SEARCH:
- str = _T("VK_BROWSER_SEARCH");
- break;
- case VK_BROWSER_FAVORITES:
- str = _T("VK_BROWSER_FAVORITES");
- break;
- case VK_BROWSER_HOME:
- str = _T("VK_BROWSER_HOME");
- break;
- case VK_VOLUME_MUTE:
- str = _T("VK_VOLUME_MUTE");
- break;
- case VK_VOLUME_DOWN:
- str = _T("VK_VOLUME_DOWN");
- break;
- case VK_VOLUME_UP:
- str = _T("VK_VOLUME_UP");
- break;
- case VK_MEDIA_NEXT_TRACK:
- str = _T("VK_MEDIA_NEXT_TRACK");
- break;
- case VK_MEDIA_PREV_TRACK:
- str = _T("VK_MEDIA_PREV_TRACK");
- break;
- case VK_MEDIA_STOP:
- str = _T("VK_MEDIA_STOP");
- break;
- case VK_MEDIA_PLAY_PAUSE:
- str = _T("VK_MEDIA_PLAY_PAUSE");
- break;
- case VK_LAUNCH_MAIL:
- str = _T("VK_LAUNCH_MAIL");
- break;
- case VK_LAUNCH_MEDIA_SELECT:
- str = _T("VK_LAUNCH_MEDIA_SELECT");
- break;
- case VK_LAUNCH_APP1:
- str = _T("VK_LAUNCH_APP1");
- break;
- case VK_LAUNCH_APP2:
- str = _T("VK_LAUNCH_APP2");
- break;
- case VK_OEM_1:
- str = _T("VK_OEM_1");
- break;
- case VK_OEM_PLUS:
- str = _T("VK_OEM_PLUS");
- break;
- case VK_OEM_COMMA:
- str = _T("VK_OEM_COMMA");
- break;
- case VK_OEM_MINUS:
- str = _T("VK_OEM_MINUS");
- break;
- case VK_OEM_PERIOD:
- str = _T("VK_OEM_PERIOD");
- break;
- case VK_OEM_2:
- str = _T("VK_OEM_2");
- break;
- case VK_OEM_3:
- str = _T("VK_OEM_3");
- break;
- case VK_OEM_4:
- str = _T("VK_OEM_4");
- break;
- case VK_OEM_5:
- str = _T("VK_OEM_5");
- break;
- case VK_OEM_6:
- str = _T("VK_OEM_6");
- break;
- case VK_OEM_7:
- str = _T("VK_OEM_7");
- break;
- case VK_OEM_8:
- str = _T("VK_OEM_8");
- break;
- case VK_OEM_AX:
- str = _T("VK_OEM_AX");
- break;
- case VK_OEM_102:
- str = _T("VK_OEM_102");
- break;
- case VK_ICO_HELP:
- str = _T("VK_ICO_HELP");
- break;
- case VK_ICO_00:
- str = _T("VK_ICO_00");
- break;
- case VK_PROCESSKEY:
- str = _T("VK_PROCESSKEY");
- break;
- case VK_ICO_CLEAR:
- str = _T("VK_ICO_CLEAR");
- break;
- case VK_PACKET:
- str = _T("VK_PACKET");
- break;
- case VK_OEM_RESET:
- str = _T("VK_OEM_RESET");
- break;
- case VK_OEM_JUMP:
- str = _T("VK_OEM_JUMP");
- break;
- case VK_OEM_PA1:
- str = _T("VK_OEM_PA1");
- break;
- case VK_OEM_PA2:
- str = _T("VK_OEM_PA2");
- break;
- case VK_OEM_PA3:
- str = _T("VK_OEM_PA3");
- break;
- case VK_OEM_WSCTRL:
- str = _T("VK_OEM_WSCTRL");
- break;
- case VK_OEM_CUSEL:
- str = _T("VK_OEM_CUSEL");
- break;
- case VK_OEM_ATTN:
- str = _T("VK_OEM_ATTN");
- break;
- case VK_OEM_FINISH:
- str = _T("VK_OEM_FINISH");
- break;
- case VK_OEM_COPY:
- str = _T("VK_OEM_COPY");
- break;
- case VK_OEM_AUTO:
- str = _T("VK_OEM_AUTO");
- break;
- case VK_OEM_ENLW:
- str = _T("VK_OEM_ENLW");
- break;
- case VK_OEM_BACKTAB:
- str = _T("VK_OEM_BACKTAB");
- break;
- case VK_ATTN:
- str = _T("VK_ATTN");
- break;
- case VK_CRSEL:
- str = _T("VK_CRSEL");
- break;
- case VK_EXSEL:
- str = _T("VK_EXSEL");
- break;
- case VK_EREOF:
- str = _T("VK_EREOF");
- break;
- case VK_PLAY:
- str = _T("VK_PLAY");
- break;
- case VK_ZOOM:
- str = _T("VK_ZOOM");
- break;
- case VK_NONAME:
- str = _T("VK_NONAME");
- break;
- case VK_PA1:
- str = _T("VK_PA1");
- break;
- case VK_OEM_CLEAR:
- str = _T("VK_OEM_CLEAR");
- break;
- case 0x07:
- case 0x0E:
- case 0x0F:
- case 0x16:
- case 0x1A:
- case 0x3A:
- case 0x3B:
- case 0x3C:
- case 0x3D:
- case 0x3E:
- case 0x3F:
- case 0x40:
- str.Format(_T("Undefined (0x%02x)"), (TCHAR)key);
- break;
- case 0x0A:
- case 0x0B:
- case 0x5E:
- case 0xB8:
- case 0xB9:
- case 0xC1:
- case 0xC2:
- case 0xC3:
- case 0xC4:
- case 0xC5:
- case 0xC6:
- case 0xC7:
- case 0xC8:
- case 0xC9:
- case 0xCA:
- case 0xCB:
- case 0xCC:
- case 0xCD:
- case 0xCE:
- case 0xCF:
- case 0xD0:
- case 0xD1:
- case 0xD2:
- case 0xD3:
- case 0xD4:
- case 0xD5:
- case 0xD6:
- case 0xD7:
- case 0xE0:
- str.Format(_T("Reserved (0x%02x)"), (TCHAR)key);
- break;
- case 0x88:
- case 0x89:
- case 0x8A:
- case 0x8B:
- case 0x8C:
- case 0x8D:
- case 0x8E:
- case 0x8F:
- case 0x97:
- case 0x98:
- case 0x99:
- case 0x9A:
- case 0x9B:
- case 0x9C:
- case 0x9D:
- case 0x9E:
- case 0x9F:
- case 0xD8:
- case 0xD9:
- case 0xDA:
- case 0xE8:
- str.Format(_T("Unassigned (0x%02x)"), (TCHAR)key);
- break;
- case 0xFF:
- str = _T("Multimedia keys");
- break;
- default:
-// if('0' <= key && key <= '9' || 'A' <= key && key <= 'Z')
- str.Format(_T("%c"), (TCHAR)key);
- break;
+ switch(key) {
+ case VK_LBUTTON:
+ str = _T("VK_LBUTTON");
+ break;
+ case VK_RBUTTON:
+ str = _T("VK_RBUTTON");
+ break;
+ case VK_CANCEL:
+ str = _T("VK_CANCEL");
+ break;
+ case VK_MBUTTON:
+ str = _T("VK_MBUTTON");
+ break;
+ case VK_XBUTTON1:
+ str = _T("VK_XBUTTON1");
+ break;
+ case VK_XBUTTON2:
+ str = _T("VK_XBUTTON2");
+ break;
+ case VK_BACK:
+ str = _T("VK_BACK");
+ break;
+ case VK_TAB:
+ str = _T("VK_TAB");
+ break;
+ case VK_CLEAR:
+ str = _T("VK_CLEAR");
+ break;
+ case VK_RETURN:
+ str = _T("VK_RETURN");
+ break;
+ case VK_SHIFT:
+ str = _T("VK_SHIFT");
+ break;
+ case VK_CONTROL:
+ str = _T("VK_CONTROL");
+ break;
+ case VK_MENU:
+ str = _T("VK_MENU");
+ break;
+ case VK_PAUSE:
+ str = _T("VK_PAUSE");
+ break;
+ case VK_CAPITAL:
+ str = _T("VK_CAPITAL");
+ break;
+ // case VK_KANA: str = _T("VK_KANA"); break;
+ // case VK_HANGEUL: str = _T("VK_HANGEUL"); break;
+ case VK_HANGUL:
+ str = _T("VK_HANGUL");
+ break;
+ case VK_JUNJA:
+ str = _T("VK_JUNJA");
+ break;
+ case VK_FINAL:
+ str = _T("VK_FINAL");
+ break;
+ // case VK_HANJA: str = _T("VK_HANJA"); break;
+ case VK_KANJI:
+ str = _T("VK_KANJI");
+ break;
+ case VK_ESCAPE:
+ str = _T("VK_ESCAPE");
+ break;
+ case VK_CONVERT:
+ str = _T("VK_CONVERT");
+ break;
+ case VK_NONCONVERT:
+ str = _T("VK_NONCONVERT");
+ break;
+ case VK_ACCEPT:
+ str = _T("VK_ACCEPT");
+ break;
+ case VK_MODECHANGE:
+ str = _T("VK_MODECHANGE");
+ break;
+ case VK_SPACE:
+ str = _T("VK_SPACE");
+ break;
+ case VK_PRIOR:
+ str = _T("VK_PRIOR");
+ break;
+ case VK_NEXT:
+ str = _T("VK_NEXT");
+ break;
+ case VK_END:
+ str = _T("VK_END");
+ break;
+ case VK_HOME:
+ str = _T("VK_HOME");
+ break;
+ case VK_LEFT:
+ str = _T("VK_LEFT");
+ break;
+ case VK_UP:
+ str = _T("VK_UP");
+ break;
+ case VK_RIGHT:
+ str = _T("VK_RIGHT");
+ break;
+ case VK_DOWN:
+ str = _T("VK_DOWN");
+ break;
+ case VK_SELECT:
+ str = _T("VK_SELECT");
+ break;
+ case VK_PRINT:
+ str = _T("VK_PRINT");
+ break;
+ case VK_EXECUTE:
+ str = _T("VK_EXECUTE");
+ break;
+ case VK_SNAPSHOT:
+ str = _T("VK_SNAPSHOT");
+ break;
+ case VK_INSERT:
+ str = _T("VK_INSERT");
+ break;
+ case VK_DELETE:
+ str = _T("VK_DELETE");
+ break;
+ case VK_HELP:
+ str = _T("VK_HELP");
+ break;
+ case VK_LWIN:
+ str = _T("VK_LWIN");
+ break;
+ case VK_RWIN:
+ str = _T("VK_RWIN");
+ break;
+ case VK_APPS:
+ str = _T("VK_APPS");
+ break;
+ case VK_SLEEP:
+ str = _T("VK_SLEEP");
+ break;
+ case VK_NUMPAD0:
+ str = _T("VK_NUMPAD0");
+ break;
+ case VK_NUMPAD1:
+ str = _T("VK_NUMPAD1");
+ break;
+ case VK_NUMPAD2:
+ str = _T("VK_NUMPAD2");
+ break;
+ case VK_NUMPAD3:
+ str = _T("VK_NUMPAD3");
+ break;
+ case VK_NUMPAD4:
+ str = _T("VK_NUMPAD4");
+ break;
+ case VK_NUMPAD5:
+ str = _T("VK_NUMPAD5");
+ break;
+ case VK_NUMPAD6:
+ str = _T("VK_NUMPAD6");
+ break;
+ case VK_NUMPAD7:
+ str = _T("VK_NUMPAD7");
+ break;
+ case VK_NUMPAD8:
+ str = _T("VK_NUMPAD8");
+ break;
+ case VK_NUMPAD9:
+ str = _T("VK_NUMPAD9");
+ break;
+ case VK_MULTIPLY:
+ str = _T("VK_MULTIPLY");
+ break;
+ case VK_ADD:
+ str = _T("VK_ADD");
+ break;
+ case VK_SEPARATOR:
+ str = _T("VK_SEPARATOR");
+ break;
+ case VK_SUBTRACT:
+ str = _T("VK_SUBTRACT");
+ break;
+ case VK_DECIMAL:
+ str = _T("VK_DECIMAL");
+ break;
+ case VK_DIVIDE:
+ str = _T("VK_DIVIDE");
+ break;
+ case VK_F1:
+ str = _T("VK_F1");
+ break;
+ case VK_F2:
+ str = _T("VK_F2");
+ break;
+ case VK_F3:
+ str = _T("VK_F3");
+ break;
+ case VK_F4:
+ str = _T("VK_F4");
+ break;
+ case VK_F5:
+ str = _T("VK_F5");
+ break;
+ case VK_F6:
+ str = _T("VK_F6");
+ break;
+ case VK_F7:
+ str = _T("VK_F7");
+ break;
+ case VK_F8:
+ str = _T("VK_F8");
+ break;
+ case VK_F9:
+ str = _T("VK_F9");
+ break;
+ case VK_F10:
+ str = _T("VK_F10");
+ break;
+ case VK_F11:
+ str = _T("VK_F11");
+ break;
+ case VK_F12:
+ str = _T("VK_F12");
+ break;
+ case VK_F13:
+ str = _T("VK_F13");
+ break;
+ case VK_F14:
+ str = _T("VK_F14");
+ break;
+ case VK_F15:
+ str = _T("VK_F15");
+ break;
+ case VK_F16:
+ str = _T("VK_F16");
+ break;
+ case VK_F17:
+ str = _T("VK_F17");
+ break;
+ case VK_F18:
+ str = _T("VK_F18");
+ break;
+ case VK_F19:
+ str = _T("VK_F19");
+ break;
+ case VK_F20:
+ str = _T("VK_F20");
+ break;
+ case VK_F21:
+ str = _T("VK_F21");
+ break;
+ case VK_F22:
+ str = _T("VK_F22");
+ break;
+ case VK_F23:
+ str = _T("VK_F23");
+ break;
+ case VK_F24:
+ str = _T("VK_F24");
+ break;
+ case VK_NUMLOCK:
+ str = _T("VK_NUMLOCK");
+ break;
+ case VK_SCROLL:
+ str = _T("VK_SCROLL");
+ break;
+ // case VK_OEM_NEC_EQUAL: str = _T("VK_OEM_NEC_EQUAL"); break;
+ case VK_OEM_FJ_JISHO:
+ str = _T("VK_OEM_FJ_JISHO");
+ break;
+ case VK_OEM_FJ_MASSHOU:
+ str = _T("VK_OEM_FJ_MASSHOU");
+ break;
+ case VK_OEM_FJ_TOUROKU:
+ str = _T("VK_OEM_FJ_TOUROKU");
+ break;
+ case VK_OEM_FJ_LOYA:
+ str = _T("VK_OEM_FJ_LOYA");
+ break;
+ case VK_OEM_FJ_ROYA:
+ str = _T("VK_OEM_FJ_ROYA");
+ break;
+ case VK_LSHIFT:
+ str = _T("VK_LSHIFT");
+ break;
+ case VK_RSHIFT:
+ str = _T("VK_RSHIFT");
+ break;
+ case VK_LCONTROL:
+ str = _T("VK_LCONTROL");
+ break;
+ case VK_RCONTROL:
+ str = _T("VK_RCONTROL");
+ break;
+ case VK_LMENU:
+ str = _T("VK_LMENU");
+ break;
+ case VK_RMENU:
+ str = _T("VK_RMENU");
+ break;
+ case VK_BROWSER_BACK:
+ str = _T("VK_BROWSER_BACK");
+ break;
+ case VK_BROWSER_FORWARD:
+ str = _T("VK_BROWSER_FORWARD");
+ break;
+ case VK_BROWSER_REFRESH:
+ str = _T("VK_BROWSER_REFRESH");
+ break;
+ case VK_BROWSER_STOP:
+ str = _T("VK_BROWSER_STOP");
+ break;
+ case VK_BROWSER_SEARCH:
+ str = _T("VK_BROWSER_SEARCH");
+ break;
+ case VK_BROWSER_FAVORITES:
+ str = _T("VK_BROWSER_FAVORITES");
+ break;
+ case VK_BROWSER_HOME:
+ str = _T("VK_BROWSER_HOME");
+ break;
+ case VK_VOLUME_MUTE:
+ str = _T("VK_VOLUME_MUTE");
+ break;
+ case VK_VOLUME_DOWN:
+ str = _T("VK_VOLUME_DOWN");
+ break;
+ case VK_VOLUME_UP:
+ str = _T("VK_VOLUME_UP");
+ break;
+ case VK_MEDIA_NEXT_TRACK:
+ str = _T("VK_MEDIA_NEXT_TRACK");
+ break;
+ case VK_MEDIA_PREV_TRACK:
+ str = _T("VK_MEDIA_PREV_TRACK");
+ break;
+ case VK_MEDIA_STOP:
+ str = _T("VK_MEDIA_STOP");
+ break;
+ case VK_MEDIA_PLAY_PAUSE:
+ str = _T("VK_MEDIA_PLAY_PAUSE");
+ break;
+ case VK_LAUNCH_MAIL:
+ str = _T("VK_LAUNCH_MAIL");
+ break;
+ case VK_LAUNCH_MEDIA_SELECT:
+ str = _T("VK_LAUNCH_MEDIA_SELECT");
+ break;
+ case VK_LAUNCH_APP1:
+ str = _T("VK_LAUNCH_APP1");
+ break;
+ case VK_LAUNCH_APP2:
+ str = _T("VK_LAUNCH_APP2");
+ break;
+ case VK_OEM_1:
+ str = _T("VK_OEM_1");
+ break;
+ case VK_OEM_PLUS:
+ str = _T("VK_OEM_PLUS");
+ break;
+ case VK_OEM_COMMA:
+ str = _T("VK_OEM_COMMA");
+ break;
+ case VK_OEM_MINUS:
+ str = _T("VK_OEM_MINUS");
+ break;
+ case VK_OEM_PERIOD:
+ str = _T("VK_OEM_PERIOD");
+ break;
+ case VK_OEM_2:
+ str = _T("VK_OEM_2");
+ break;
+ case VK_OEM_3:
+ str = _T("VK_OEM_3");
+ break;
+ case VK_OEM_4:
+ str = _T("VK_OEM_4");
+ break;
+ case VK_OEM_5:
+ str = _T("VK_OEM_5");
+ break;
+ case VK_OEM_6:
+ str = _T("VK_OEM_6");
+ break;
+ case VK_OEM_7:
+ str = _T("VK_OEM_7");
+ break;
+ case VK_OEM_8:
+ str = _T("VK_OEM_8");
+ break;
+ case VK_OEM_AX:
+ str = _T("VK_OEM_AX");
+ break;
+ case VK_OEM_102:
+ str = _T("VK_OEM_102");
+ break;
+ case VK_ICO_HELP:
+ str = _T("VK_ICO_HELP");
+ break;
+ case VK_ICO_00:
+ str = _T("VK_ICO_00");
+ break;
+ case VK_PROCESSKEY:
+ str = _T("VK_PROCESSKEY");
+ break;
+ case VK_ICO_CLEAR:
+ str = _T("VK_ICO_CLEAR");
+ break;
+ case VK_PACKET:
+ str = _T("VK_PACKET");
+ break;
+ case VK_OEM_RESET:
+ str = _T("VK_OEM_RESET");
+ break;
+ case VK_OEM_JUMP:
+ str = _T("VK_OEM_JUMP");
+ break;
+ case VK_OEM_PA1:
+ str = _T("VK_OEM_PA1");
+ break;
+ case VK_OEM_PA2:
+ str = _T("VK_OEM_PA2");
+ break;
+ case VK_OEM_PA3:
+ str = _T("VK_OEM_PA3");
+ break;
+ case VK_OEM_WSCTRL:
+ str = _T("VK_OEM_WSCTRL");
+ break;
+ case VK_OEM_CUSEL:
+ str = _T("VK_OEM_CUSEL");
+ break;
+ case VK_OEM_ATTN:
+ str = _T("VK_OEM_ATTN");
+ break;
+ case VK_OEM_FINISH:
+ str = _T("VK_OEM_FINISH");
+ break;
+ case VK_OEM_COPY:
+ str = _T("VK_OEM_COPY");
+ break;
+ case VK_OEM_AUTO:
+ str = _T("VK_OEM_AUTO");
+ break;
+ case VK_OEM_ENLW:
+ str = _T("VK_OEM_ENLW");
+ break;
+ case VK_OEM_BACKTAB:
+ str = _T("VK_OEM_BACKTAB");
+ break;
+ case VK_ATTN:
+ str = _T("VK_ATTN");
+ break;
+ case VK_CRSEL:
+ str = _T("VK_CRSEL");
+ break;
+ case VK_EXSEL:
+ str = _T("VK_EXSEL");
+ break;
+ case VK_EREOF:
+ str = _T("VK_EREOF");
+ break;
+ case VK_PLAY:
+ str = _T("VK_PLAY");
+ break;
+ case VK_ZOOM:
+ str = _T("VK_ZOOM");
+ break;
+ case VK_NONAME:
+ str = _T("VK_NONAME");
+ break;
+ case VK_PA1:
+ str = _T("VK_PA1");
+ break;
+ case VK_OEM_CLEAR:
+ str = _T("VK_OEM_CLEAR");
+ break;
+ case 0x07:
+ case 0x0E:
+ case 0x0F:
+ case 0x16:
+ case 0x1A:
+ case 0x3A:
+ case 0x3B:
+ case 0x3C:
+ case 0x3D:
+ case 0x3E:
+ case 0x3F:
+ case 0x40:
+ str.Format(_T("Undefined (0x%02x)"), (TCHAR)key);
+ break;
+ case 0x0A:
+ case 0x0B:
+ case 0x5E:
+ case 0xB8:
+ case 0xB9:
+ case 0xC1:
+ case 0xC2:
+ case 0xC3:
+ case 0xC4:
+ case 0xC5:
+ case 0xC6:
+ case 0xC7:
+ case 0xC8:
+ case 0xC9:
+ case 0xCA:
+ case 0xCB:
+ case 0xCC:
+ case 0xCD:
+ case 0xCE:
+ case 0xCF:
+ case 0xD0:
+ case 0xD1:
+ case 0xD2:
+ case 0xD3:
+ case 0xD4:
+ case 0xD5:
+ case 0xD6:
+ case 0xD7:
+ case 0xE0:
+ str.Format(_T("Reserved (0x%02x)"), (TCHAR)key);
+ break;
+ case 0x88:
+ case 0x89:
+ case 0x8A:
+ case 0x8B:
+ case 0x8C:
+ case 0x8D:
+ case 0x8E:
+ case 0x8F:
+ case 0x97:
+ case 0x98:
+ case 0x99:
+ case 0x9A:
+ case 0x9B:
+ case 0x9C:
+ case 0x9D:
+ case 0x9E:
+ case 0x9F:
+ case 0xD8:
+ case 0xD9:
+ case 0xDA:
+ case 0xE8:
+ str.Format(_T("Unassigned (0x%02x)"), (TCHAR)key);
+ break;
+ case 0xFF:
+ str = _T("Multimedia keys");
+ break;
+ default:
+ // if('0' <= key && key <= '9' || 'A' <= key && key <= 'Z')
+ str.Format(_T("%c"), (TCHAR)key);
+ break;
}
return(str);
@@ -760,11 +760,11 @@ CString CPPageAccelTbl::MakeAccelShortcutLabel(UINT id) {
CList<wmcmd>& wmcmds = AfxGetAppSettings().wmcmds;
POSITION pos = wmcmds.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
ACCEL& a = wmcmds.GetNext(pos);
- if(a.cmd == id)
+ if(a.cmd == id) {
return(MakeAccelShortcutLabel(a));
+ }
}
return(_T(""));
@@ -772,562 +772,562 @@ CString CPPageAccelTbl::MakeAccelShortcutLabel(UINT id) CString CPPageAccelTbl::MakeAccelShortcutLabel(ACCEL& a)
{
-// Reference page for Virtual-Key Codes: http://msdn.microsoft.com/en-us/library/ms645540
+ // Reference page for Virtual-Key Codes: http://msdn.microsoft.com/en-us/library/ms645540
CString str;
- switch(a.key)
- {
- case VK_LBUTTON:
- str = _T("LBtn");
- break;
- case VK_RBUTTON:
- str = _T("RBtn");
- break;
- case VK_CANCEL:
- str = _T("Cancel");
- break;
- case VK_MBUTTON:
- str = _T("MBtn");
- break;
- case VK_XBUTTON1:
- str = _T("X1Btn");
- break;
- case VK_XBUTTON2:
- str = _T("X2Btn");
- break;
- case VK_BACK:
- str = _T("Back");
- break;
- case VK_TAB:
- str = _T("Tab");
- break;
- case VK_CLEAR:
- str = _T("Clear");
- break;
- case VK_RETURN:
- str = _T("Return");
- break;
- case VK_SHIFT:
- str = _T("Shift");
- break;
- case VK_CONTROL:
- str = _T("Ctrl");
- break;
- case VK_MENU:
- str = _T("Alt");
- break;
- case VK_PAUSE:
- str = _T("Pause");
- break;
- case VK_CAPITAL:
- str = _T("Capital");
- break;
-// case VK_KANA: str = _T("Kana"); break;
-// case VK_HANGEUL: str = _T("Hangeul"); break;
- case VK_HANGUL:
- str = _T("Hangul");
- break;
- case VK_JUNJA:
- str = _T("Junja");
- break;
- case VK_FINAL:
- str = _T("Final");
- break;
-// case VK_HANJA: str = _T("Hanja"); break;
- case VK_KANJI:
- str = _T("Kanji");
- break;
- case VK_ESCAPE:
- str = _T("Escape");
- break;
- case VK_CONVERT:
- str = _T("Convert");
- break;
- case VK_NONCONVERT:
- str = _T("Non Convert");
- break;
- case VK_ACCEPT:
- str = _T("Accept");
- break;
- case VK_MODECHANGE:
- str = _T("Mode Change");
- break;
- case VK_SPACE:
- str = _T("Space");
- break;
- case VK_PRIOR:
- str = _T("PgUp");
- break;
- case VK_NEXT:
- str = _T("PgDn");
- break;
- case VK_END:
- str = _T("End");
- break;
- case VK_HOME:
- str = _T("Home");
- break;
- case VK_LEFT:
- str = _T("Left");
- break;
- case VK_UP:
- str = _T("Up");
- break;
- case VK_RIGHT:
- str = _T("Right");
- break;
- case VK_DOWN:
- str = _T("Down");
- break;
- case VK_SELECT:
- str = _T("Select");
- break;
- case VK_PRINT:
- str = _T("Print");
- break;
- case VK_EXECUTE:
- str = _T("Execute");
- break;
- case VK_SNAPSHOT:
- str = _T("Snapshot");
- break;
- case VK_INSERT:
- str = _T("Insert");
- break;
- case VK_DELETE:
- str = _T("Delete");
- break;
- case VK_HELP:
- str = _T("Help");
- break;
- case VK_LWIN:
- str = _T("LWin");
- break;
- case VK_RWIN:
- str = _T("RWin");
- break;
- case VK_APPS:
- str = _T("Apps");
- break;
- case VK_SLEEP:
- str = _T("Sleep");
- break;
- case VK_NUMPAD0:
- str = _T("Numpad 0");
- break;
- case VK_NUMPAD1:
- str = _T("Numpad 1");
- break;
- case VK_NUMPAD2:
- str = _T("Numpad 2");
- break;
- case VK_NUMPAD3:
- str = _T("Numpad 3");
- break;
- case VK_NUMPAD4:
- str = _T("Numpad 4");
- break;
- case VK_NUMPAD5:
- str = _T("Numpad 5");
- break;
- case VK_NUMPAD6:
- str = _T("Numpad 6");
- break;
- case VK_NUMPAD7:
- str = _T("Numpad 7");
- break;
- case VK_NUMPAD8:
- str = _T("Numpad 8");
- break;
- case VK_NUMPAD9:
- str = _T("Numpad 9");
- break;
- case VK_MULTIPLY:
- str = _T("Multiply");
- break;
- case VK_ADD:
- str = _T("Add");
- break;
- case VK_SEPARATOR:
- str = _T("Separator");
- break;
- case VK_SUBTRACT:
- str = _T("Subtract");
- break;
- case VK_DECIMAL:
- str = _T("Decimal");
- break;
- case VK_DIVIDE:
- str = _T("Divide");
- break;
- case VK_F1:
- str = _T("F1");
- break;
- case VK_F2:
- str = _T("F2");
- break;
- case VK_F3:
- str = _T("F3");
- break;
- case VK_F4:
- str = _T("F4");
- break;
- case VK_F5:
- str = _T("F5");
- break;
- case VK_F6:
- str = _T("F6");
- break;
- case VK_F7:
- str = _T("F7");
- break;
- case VK_F8:
- str = _T("F8");
- break;
- case VK_F9:
- str = _T("F9");
- break;
- case VK_F10:
- str = _T("F10");
- break;
- case VK_F11:
- str = _T("F11");
- break;
- case VK_F12:
- str = _T("F12");
- break;
- case VK_F13:
- str = _T("F13");
- break;
- case VK_F14:
- str = _T("F14");
- break;
- case VK_F15:
- str = _T("F15");
- break;
- case VK_F16:
- str = _T("F16");
- break;
- case VK_F17:
- str = _T("F17");
- break;
- case VK_F18:
- str = _T("F18");
- break;
- case VK_F19:
- str = _T("F19");
- break;
- case VK_F20:
- str = _T("F20");
- break;
- case VK_F21:
- str = _T("F21");
- break;
- case VK_F22:
- str = _T("F22");
- break;
- case VK_F23:
- str = _T("F23");
- break;
- case VK_F24:
- str = _T("F24");
- break;
- case VK_NUMLOCK:
- str = _T("Numlock");
- break;
- case VK_SCROLL:
- str = _T("Scroll");
- break;
-// case VK_OEM_NEC_EQUAL: str = _T("OEM NEC Equal"); break;
- case VK_OEM_FJ_JISHO:
- str = _T("OEM FJ Jisho");
- break;
- case VK_OEM_FJ_MASSHOU:
- str = _T("OEM FJ Msshou");
- break;
- case VK_OEM_FJ_TOUROKU:
- str = _T("OEM FJ Touroku");
- break;
- case VK_OEM_FJ_LOYA:
- str = _T("OEM FJ Loya");
- break;
- case VK_OEM_FJ_ROYA:
- str = _T("OEM FJ Roya");
- break;
- case VK_LSHIFT:
- str = _T("LShift");
- break;
- case VK_RSHIFT:
- str = _T("RShift");
- break;
- case VK_LCONTROL:
- str = _T("LCtrl");
- break;
- case VK_RCONTROL:
- str = _T("RCtrl");
- break;
- case VK_LMENU:
- str = _T("LAlt");
- break;
- case VK_RMENU:
- str = _T("RAlt");
- break;
- case VK_BROWSER_BACK:
- str = _T("Browser Back");
- break;
- case VK_BROWSER_FORWARD:
- str = _T("Browser Forward");
- break;
- case VK_BROWSER_REFRESH:
- str = _T("Browser Refresh");
- break;
- case VK_BROWSER_STOP:
- str = _T("Browser Stop");
- break;
- case VK_BROWSER_SEARCH:
- str = _T("Browser Search");
- break;
- case VK_BROWSER_FAVORITES:
- str = _T("Browser Favorites");
- break;
- case VK_BROWSER_HOME:
- str = _T("Browser Home");
- break;
- case VK_VOLUME_MUTE:
- str = _T("Volume Mute");
- break;
- case VK_VOLUME_DOWN:
- str = _T("Volume Down");
- break;
- case VK_VOLUME_UP:
- str = _T("Volume Up");
- break;
- case VK_MEDIA_NEXT_TRACK:
- str = _T("Media Next Track");
- break;
- case VK_MEDIA_PREV_TRACK:
- str = _T("Media Prev Track");
- break;
- case VK_MEDIA_STOP:
- str = _T("Media Stop");
- break;
- case VK_MEDIA_PLAY_PAUSE:
- str = _T("Media Play/Pause");
- break;
- case VK_LAUNCH_MAIL:
- str = _T("Launch Mail");
- break;
- case VK_LAUNCH_MEDIA_SELECT:
- str = _T("Launch Media Select");
- break;
- case VK_LAUNCH_APP1:
- str = _T("Launch App1");
- break;
- case VK_LAUNCH_APP2:
- str = _T("Launch App2");
- break;
- case VK_OEM_1:
- str = _T("OEM 1");
- break;
- case VK_OEM_PLUS:
- str = _T("Plus");
- break;
- case VK_OEM_COMMA:
- str = _T("Comma");
- break;
- case VK_OEM_MINUS:
- str = _T("Minus");
- break;
- case VK_OEM_PERIOD:
- str = _T("Period");
- break;
- case VK_OEM_2:
- str = _T("OEM 2");
- break;
- case VK_OEM_3:
- str = _T("OEM 3");
- break;
- case VK_OEM_4:
- str = _T("OEM 4");
- break;
- case VK_OEM_5:
- str = _T("OEM 5");
- break;
- case VK_OEM_6:
- str = _T("OEM 6");
- break;
- case VK_OEM_7:
- str = _T("OEM 7");
- break;
- case VK_OEM_8:
- str = _T("OEM 8");
- break;
- case VK_OEM_AX:
- str = _T("OEM AX");
- break;
- case VK_OEM_102:
- str = _T("OEM 102");
- break;
- case VK_ICO_HELP:
- str = _T("ICO Help");
- break;
- case VK_ICO_00:
- str = _T("ICO 00");
- break;
- case VK_PROCESSKEY:
- str = _T("Process Key");
- break;
- case VK_ICO_CLEAR:
- str = _T("ICO Clear");
- break;
- case VK_PACKET:
- str = _T("Packet");
- break;
- case VK_OEM_RESET:
- str = _T("OEM Reset");
- break;
- case VK_OEM_JUMP:
- str = _T("OEM Jump");
- break;
- case VK_OEM_PA1:
- str = _T("OEM PA1");
- break;
- case VK_OEM_PA2:
- str = _T("OEM PA2");
- break;
- case VK_OEM_PA3:
- str = _T("OEM PA3");
- break;
- case VK_OEM_WSCTRL:
- str = _T("OEM WSCtrl");
- break;
- case VK_OEM_CUSEL:
- str = _T("OEM CUSEL");
- break;
- case VK_OEM_ATTN:
- str = _T("OEM ATTN");
- break;
- case VK_OEM_FINISH:
- str = _T("OEM Finish");
- break;
- case VK_OEM_COPY:
- str = _T("OEM Copy");
- break;
- case VK_OEM_AUTO:
- str = _T("OEM Auto");
- break;
- case VK_OEM_ENLW:
- str = _T("OEM ENLW");
- break;
- case VK_OEM_BACKTAB:
- str = _T("OEM Backtab");
- break;
- case VK_ATTN:
- str = _T("ATTN");
- break;
- case VK_CRSEL:
- str = _T("CRSEL");
- break;
- case VK_EXSEL:
- str = _T("EXSEL");
- break;
- case VK_EREOF:
- str = _T("EREOF");
- break;
- case VK_PLAY:
- str = _T("Play");
- break;
- case VK_ZOOM:
- str = _T("Zoom");
- break;
- case VK_NONAME:
- str = _T("Noname");
- break;
- case VK_PA1:
- str = _T("PA1");
- break;
- case VK_OEM_CLEAR:
- str = _T("OEM Clear");
- break;
- case 0x07:
- case 0x0E:
- case 0x0F:
- case 0x16:
- case 0x1A:
- case 0x3A:
- case 0x3B:
- case 0x3C:
- case 0x3D:
- case 0x3E:
- case 0x3F:
- case 0x40:
- str.Format(_T("Undefined (0x%02x)"), (TCHAR)a.key);
- break;
- case 0x0A:
- case 0x0B:
- case 0x5E:
- case 0xB8:
- case 0xB9:
- case 0xC1:
- case 0xC2:
- case 0xC3:
- case 0xC4:
- case 0xC5:
- case 0xC6:
- case 0xC7:
- case 0xC8:
- case 0xC9:
- case 0xCA:
- case 0xCB:
- case 0xCC:
- case 0xCD:
- case 0xCE:
- case 0xCF:
- case 0xD0:
- case 0xD1:
- case 0xD2:
- case 0xD3:
- case 0xD4:
- case 0xD5:
- case 0xD6:
- case 0xD7:
- case 0xE0:
- str.Format(_T("Reserved (0x%02x)"), (TCHAR)a.key);
- break;
- case 0x88:
- case 0x89:
- case 0x8A:
- case 0x8B:
- case 0x8C:
- case 0x8D:
- case 0x8E:
- case 0x8F:
- case 0x97:
- case 0x98:
- case 0x99:
- case 0x9A:
- case 0x9B:
- case 0x9C:
- case 0x9D:
- case 0x9E:
- case 0x9F:
- case 0xD8:
- case 0xD9:
- case 0xDA:
- case 0xE8:
- str.Format(_T("Unassigned (0x%02x)"), (TCHAR)a.key);
- break;
- case 0xFF:
- str = _T("Multimedia keys");
- break;
- default:
-// if('0' <= a.key && a.key <= '9' || 'A' <= a.key && a.key <= 'Z')
- str.Format(_T("%c"), (TCHAR)a.key);
- break;
+ switch(a.key) {
+ case VK_LBUTTON:
+ str = _T("LBtn");
+ break;
+ case VK_RBUTTON:
+ str = _T("RBtn");
+ break;
+ case VK_CANCEL:
+ str = _T("Cancel");
+ break;
+ case VK_MBUTTON:
+ str = _T("MBtn");
+ break;
+ case VK_XBUTTON1:
+ str = _T("X1Btn");
+ break;
+ case VK_XBUTTON2:
+ str = _T("X2Btn");
+ break;
+ case VK_BACK:
+ str = _T("Back");
+ break;
+ case VK_TAB:
+ str = _T("Tab");
+ break;
+ case VK_CLEAR:
+ str = _T("Clear");
+ break;
+ case VK_RETURN:
+ str = _T("Return");
+ break;
+ case VK_SHIFT:
+ str = _T("Shift");
+ break;
+ case VK_CONTROL:
+ str = _T("Ctrl");
+ break;
+ case VK_MENU:
+ str = _T("Alt");
+ break;
+ case VK_PAUSE:
+ str = _T("Pause");
+ break;
+ case VK_CAPITAL:
+ str = _T("Capital");
+ break;
+ // case VK_KANA: str = _T("Kana"); break;
+ // case VK_HANGEUL: str = _T("Hangeul"); break;
+ case VK_HANGUL:
+ str = _T("Hangul");
+ break;
+ case VK_JUNJA:
+ str = _T("Junja");
+ break;
+ case VK_FINAL:
+ str = _T("Final");
+ break;
+ // case VK_HANJA: str = _T("Hanja"); break;
+ case VK_KANJI:
+ str = _T("Kanji");
+ break;
+ case VK_ESCAPE:
+ str = _T("Escape");
+ break;
+ case VK_CONVERT:
+ str = _T("Convert");
+ break;
+ case VK_NONCONVERT:
+ str = _T("Non Convert");
+ break;
+ case VK_ACCEPT:
+ str = _T("Accept");
+ break;
+ case VK_MODECHANGE:
+ str = _T("Mode Change");
+ break;
+ case VK_SPACE:
+ str = _T("Space");
+ break;
+ case VK_PRIOR:
+ str = _T("PgUp");
+ break;
+ case VK_NEXT:
+ str = _T("PgDn");
+ break;
+ case VK_END:
+ str = _T("End");
+ break;
+ case VK_HOME:
+ str = _T("Home");
+ break;
+ case VK_LEFT:
+ str = _T("Left");
+ break;
+ case VK_UP:
+ str = _T("Up");
+ break;
+ case VK_RIGHT:
+ str = _T("Right");
+ break;
+ case VK_DOWN:
+ str = _T("Down");
+ break;
+ case VK_SELECT:
+ str = _T("Select");
+ break;
+ case VK_PRINT:
+ str = _T("Print");
+ break;
+ case VK_EXECUTE:
+ str = _T("Execute");
+ break;
+ case VK_SNAPSHOT:
+ str = _T("Snapshot");
+ break;
+ case VK_INSERT:
+ str = _T("Insert");
+ break;
+ case VK_DELETE:
+ str = _T("Delete");
+ break;
+ case VK_HELP:
+ str = _T("Help");
+ break;
+ case VK_LWIN:
+ str = _T("LWin");
+ break;
+ case VK_RWIN:
+ str = _T("RWin");
+ break;
+ case VK_APPS:
+ str = _T("Apps");
+ break;
+ case VK_SLEEP:
+ str = _T("Sleep");
+ break;
+ case VK_NUMPAD0:
+ str = _T("Numpad 0");
+ break;
+ case VK_NUMPAD1:
+ str = _T("Numpad 1");
+ break;
+ case VK_NUMPAD2:
+ str = _T("Numpad 2");
+ break;
+ case VK_NUMPAD3:
+ str = _T("Numpad 3");
+ break;
+ case VK_NUMPAD4:
+ str = _T("Numpad 4");
+ break;
+ case VK_NUMPAD5:
+ str = _T("Numpad 5");
+ break;
+ case VK_NUMPAD6:
+ str = _T("Numpad 6");
+ break;
+ case VK_NUMPAD7:
+ str = _T("Numpad 7");
+ break;
+ case VK_NUMPAD8:
+ str = _T("Numpad 8");
+ break;
+ case VK_NUMPAD9:
+ str = _T("Numpad 9");
+ break;
+ case VK_MULTIPLY:
+ str = _T("Multiply");
+ break;
+ case VK_ADD:
+ str = _T("Add");
+ break;
+ case VK_SEPARATOR:
+ str = _T("Separator");
+ break;
+ case VK_SUBTRACT:
+ str = _T("Subtract");
+ break;
+ case VK_DECIMAL:
+ str = _T("Decimal");
+ break;
+ case VK_DIVIDE:
+ str = _T("Divide");
+ break;
+ case VK_F1:
+ str = _T("F1");
+ break;
+ case VK_F2:
+ str = _T("F2");
+ break;
+ case VK_F3:
+ str = _T("F3");
+ break;
+ case VK_F4:
+ str = _T("F4");
+ break;
+ case VK_F5:
+ str = _T("F5");
+ break;
+ case VK_F6:
+ str = _T("F6");
+ break;
+ case VK_F7:
+ str = _T("F7");
+ break;
+ case VK_F8:
+ str = _T("F8");
+ break;
+ case VK_F9:
+ str = _T("F9");
+ break;
+ case VK_F10:
+ str = _T("F10");
+ break;
+ case VK_F11:
+ str = _T("F11");
+ break;
+ case VK_F12:
+ str = _T("F12");
+ break;
+ case VK_F13:
+ str = _T("F13");
+ break;
+ case VK_F14:
+ str = _T("F14");
+ break;
+ case VK_F15:
+ str = _T("F15");
+ break;
+ case VK_F16:
+ str = _T("F16");
+ break;
+ case VK_F17:
+ str = _T("F17");
+ break;
+ case VK_F18:
+ str = _T("F18");
+ break;
+ case VK_F19:
+ str = _T("F19");
+ break;
+ case VK_F20:
+ str = _T("F20");
+ break;
+ case VK_F21:
+ str = _T("F21");
+ break;
+ case VK_F22:
+ str = _T("F22");
+ break;
+ case VK_F23:
+ str = _T("F23");
+ break;
+ case VK_F24:
+ str = _T("F24");
+ break;
+ case VK_NUMLOCK:
+ str = _T("Numlock");
+ break;
+ case VK_SCROLL:
+ str = _T("Scroll");
+ break;
+ // case VK_OEM_NEC_EQUAL: str = _T("OEM NEC Equal"); break;
+ case VK_OEM_FJ_JISHO:
+ str = _T("OEM FJ Jisho");
+ break;
+ case VK_OEM_FJ_MASSHOU:
+ str = _T("OEM FJ Msshou");
+ break;
+ case VK_OEM_FJ_TOUROKU:
+ str = _T("OEM FJ Touroku");
+ break;
+ case VK_OEM_FJ_LOYA:
+ str = _T("OEM FJ Loya");
+ break;
+ case VK_OEM_FJ_ROYA:
+ str = _T("OEM FJ Roya");
+ break;
+ case VK_LSHIFT:
+ str = _T("LShift");
+ break;
+ case VK_RSHIFT:
+ str = _T("RShift");
+ break;
+ case VK_LCONTROL:
+ str = _T("LCtrl");
+ break;
+ case VK_RCONTROL:
+ str = _T("RCtrl");
+ break;
+ case VK_LMENU:
+ str = _T("LAlt");
+ break;
+ case VK_RMENU:
+ str = _T("RAlt");
+ break;
+ case VK_BROWSER_BACK:
+ str = _T("Browser Back");
+ break;
+ case VK_BROWSER_FORWARD:
+ str = _T("Browser Forward");
+ break;
+ case VK_BROWSER_REFRESH:
+ str = _T("Browser Refresh");
+ break;
+ case VK_BROWSER_STOP:
+ str = _T("Browser Stop");
+ break;
+ case VK_BROWSER_SEARCH:
+ str = _T("Browser Search");
+ break;
+ case VK_BROWSER_FAVORITES:
+ str = _T("Browser Favorites");
+ break;
+ case VK_BROWSER_HOME:
+ str = _T("Browser Home");
+ break;
+ case VK_VOLUME_MUTE:
+ str = _T("Volume Mute");
+ break;
+ case VK_VOLUME_DOWN:
+ str = _T("Volume Down");
+ break;
+ case VK_VOLUME_UP:
+ str = _T("Volume Up");
+ break;
+ case VK_MEDIA_NEXT_TRACK:
+ str = _T("Media Next Track");
+ break;
+ case VK_MEDIA_PREV_TRACK:
+ str = _T("Media Prev Track");
+ break;
+ case VK_MEDIA_STOP:
+ str = _T("Media Stop");
+ break;
+ case VK_MEDIA_PLAY_PAUSE:
+ str = _T("Media Play/Pause");
+ break;
+ case VK_LAUNCH_MAIL:
+ str = _T("Launch Mail");
+ break;
+ case VK_LAUNCH_MEDIA_SELECT:
+ str = _T("Launch Media Select");
+ break;
+ case VK_LAUNCH_APP1:
+ str = _T("Launch App1");
+ break;
+ case VK_LAUNCH_APP2:
+ str = _T("Launch App2");
+ break;
+ case VK_OEM_1:
+ str = _T("OEM 1");
+ break;
+ case VK_OEM_PLUS:
+ str = _T("Plus");
+ break;
+ case VK_OEM_COMMA:
+ str = _T("Comma");
+ break;
+ case VK_OEM_MINUS:
+ str = _T("Minus");
+ break;
+ case VK_OEM_PERIOD:
+ str = _T("Period");
+ break;
+ case VK_OEM_2:
+ str = _T("OEM 2");
+ break;
+ case VK_OEM_3:
+ str = _T("OEM 3");
+ break;
+ case VK_OEM_4:
+ str = _T("OEM 4");
+ break;
+ case VK_OEM_5:
+ str = _T("OEM 5");
+ break;
+ case VK_OEM_6:
+ str = _T("OEM 6");
+ break;
+ case VK_OEM_7:
+ str = _T("OEM 7");
+ break;
+ case VK_OEM_8:
+ str = _T("OEM 8");
+ break;
+ case VK_OEM_AX:
+ str = _T("OEM AX");
+ break;
+ case VK_OEM_102:
+ str = _T("OEM 102");
+ break;
+ case VK_ICO_HELP:
+ str = _T("ICO Help");
+ break;
+ case VK_ICO_00:
+ str = _T("ICO 00");
+ break;
+ case VK_PROCESSKEY:
+ str = _T("Process Key");
+ break;
+ case VK_ICO_CLEAR:
+ str = _T("ICO Clear");
+ break;
+ case VK_PACKET:
+ str = _T("Packet");
+ break;
+ case VK_OEM_RESET:
+ str = _T("OEM Reset");
+ break;
+ case VK_OEM_JUMP:
+ str = _T("OEM Jump");
+ break;
+ case VK_OEM_PA1:
+ str = _T("OEM PA1");
+ break;
+ case VK_OEM_PA2:
+ str = _T("OEM PA2");
+ break;
+ case VK_OEM_PA3:
+ str = _T("OEM PA3");
+ break;
+ case VK_OEM_WSCTRL:
+ str = _T("OEM WSCtrl");
+ break;
+ case VK_OEM_CUSEL:
+ str = _T("OEM CUSEL");
+ break;
+ case VK_OEM_ATTN:
+ str = _T("OEM ATTN");
+ break;
+ case VK_OEM_FINISH:
+ str = _T("OEM Finish");
+ break;
+ case VK_OEM_COPY:
+ str = _T("OEM Copy");
+ break;
+ case VK_OEM_AUTO:
+ str = _T("OEM Auto");
+ break;
+ case VK_OEM_ENLW:
+ str = _T("OEM ENLW");
+ break;
+ case VK_OEM_BACKTAB:
+ str = _T("OEM Backtab");
+ break;
+ case VK_ATTN:
+ str = _T("ATTN");
+ break;
+ case VK_CRSEL:
+ str = _T("CRSEL");
+ break;
+ case VK_EXSEL:
+ str = _T("EXSEL");
+ break;
+ case VK_EREOF:
+ str = _T("EREOF");
+ break;
+ case VK_PLAY:
+ str = _T("Play");
+ break;
+ case VK_ZOOM:
+ str = _T("Zoom");
+ break;
+ case VK_NONAME:
+ str = _T("Noname");
+ break;
+ case VK_PA1:
+ str = _T("PA1");
+ break;
+ case VK_OEM_CLEAR:
+ str = _T("OEM Clear");
+ break;
+ case 0x07:
+ case 0x0E:
+ case 0x0F:
+ case 0x16:
+ case 0x1A:
+ case 0x3A:
+ case 0x3B:
+ case 0x3C:
+ case 0x3D:
+ case 0x3E:
+ case 0x3F:
+ case 0x40:
+ str.Format(_T("Undefined (0x%02x)"), (TCHAR)a.key);
+ break;
+ case 0x0A:
+ case 0x0B:
+ case 0x5E:
+ case 0xB8:
+ case 0xB9:
+ case 0xC1:
+ case 0xC2:
+ case 0xC3:
+ case 0xC4:
+ case 0xC5:
+ case 0xC6:
+ case 0xC7:
+ case 0xC8:
+ case 0xC9:
+ case 0xCA:
+ case 0xCB:
+ case 0xCC:
+ case 0xCD:
+ case 0xCE:
+ case 0xCF:
+ case 0xD0:
+ case 0xD1:
+ case 0xD2:
+ case 0xD3:
+ case 0xD4:
+ case 0xD5:
+ case 0xD6:
+ case 0xD7:
+ case 0xE0:
+ str.Format(_T("Reserved (0x%02x)"), (TCHAR)a.key);
+ break;
+ case 0x88:
+ case 0x89:
+ case 0x8A:
+ case 0x8B:
+ case 0x8C:
+ case 0x8D:
+ case 0x8E:
+ case 0x8F:
+ case 0x97:
+ case 0x98:
+ case 0x99:
+ case 0x9A:
+ case 0x9B:
+ case 0x9C:
+ case 0x9D:
+ case 0x9E:
+ case 0x9F:
+ case 0xD8:
+ case 0xD9:
+ case 0xDA:
+ case 0xE8:
+ str.Format(_T("Unassigned (0x%02x)"), (TCHAR)a.key);
+ break;
+ case 0xFF:
+ str = _T("Multimedia keys");
+ break;
+ default:
+ // if('0' <= a.key && a.key <= '9' || 'A' <= a.key && a.key <= 'Z')
+ str.Format(_T("%c"), (TCHAR)a.key);
+ break;
}
- if(a.fVirt&(FCONTROL|FALT|FSHIFT))
+ if(a.fVirt&(FCONTROL|FALT|FSHIFT)) {
str = MakeAccelModLabel(a.fVirt) + _T(" + ") + str;
+ }
str.Replace(_T(" + "), _T("+"));
@@ -1337,73 +1337,72 @@ CString CPPageAccelTbl::MakeAccelShortcutLabel(ACCEL& a) CString CPPageAccelTbl::MakeMouseButtonLabel(UINT mouse)
{
CString ret;
- switch(mouse)
- {
- case wmcmd::NONE:
- default:
- ret = ResStr(IDS_AG_NONE);
- break;
- case wmcmd::LDOWN:
- ret = _T("Left Down");
- break;
- case wmcmd::LUP:
- ret = _T("Left Up");
- break;
- case wmcmd::LDBLCLK:
- ret = _T("Left DblClk");
- break;
- case wmcmd::MDOWN:
- ret = _T("Middle Down");
- break;
- case wmcmd::MUP:
- ret = _T("Middle Up");
- break;
- case wmcmd::MDBLCLK:
- ret = _T("Middle DblClk");
- break;
- case wmcmd::RDOWN:
- ret = _T("Right Down");
- break;
- case wmcmd::RUP:
- ret = _T("Right Up");
- break;
- case wmcmd::RDBLCLK:
- ret = _T("Right DblClk");
- break;
- case wmcmd::X1DOWN:
- ret = _T("X1 Down");
- break;
- case wmcmd::X1UP:
- ret = _T("X1 Up");
- break;
- case wmcmd::X1DBLCLK:
- ret = _T("X1 DblClk");
- break;
- case wmcmd::X2DOWN:
- ret = _T("X2 Down");
- break;
- case wmcmd::X2UP:
- ret = _T("X2 Up");
- break;
- case wmcmd::X2DBLCLK:
- ret = _T("X2 DblClk");
- break;
- case wmcmd::WUP:
- ret = _T("Wheel Up");
- break;
- case wmcmd::WDOWN:
- ret = _T("Wheel Down");
- break;
+ switch(mouse) {
+ case wmcmd::NONE:
+ default:
+ ret = ResStr(IDS_AG_NONE);
+ break;
+ case wmcmd::LDOWN:
+ ret = _T("Left Down");
+ break;
+ case wmcmd::LUP:
+ ret = _T("Left Up");
+ break;
+ case wmcmd::LDBLCLK:
+ ret = _T("Left DblClk");
+ break;
+ case wmcmd::MDOWN:
+ ret = _T("Middle Down");
+ break;
+ case wmcmd::MUP:
+ ret = _T("Middle Up");
+ break;
+ case wmcmd::MDBLCLK:
+ ret = _T("Middle DblClk");
+ break;
+ case wmcmd::RDOWN:
+ ret = _T("Right Down");
+ break;
+ case wmcmd::RUP:
+ ret = _T("Right Up");
+ break;
+ case wmcmd::RDBLCLK:
+ ret = _T("Right DblClk");
+ break;
+ case wmcmd::X1DOWN:
+ ret = _T("X1 Down");
+ break;
+ case wmcmd::X1UP:
+ ret = _T("X1 Up");
+ break;
+ case wmcmd::X1DBLCLK:
+ ret = _T("X1 DblClk");
+ break;
+ case wmcmd::X2DOWN:
+ ret = _T("X2 Down");
+ break;
+ case wmcmd::X2UP:
+ ret = _T("X2 Up");
+ break;
+ case wmcmd::X2DBLCLK:
+ ret = _T("X2 DblClk");
+ break;
+ case wmcmd::WUP:
+ ret = _T("Wheel Up");
+ break;
+ case wmcmd::WDOWN:
+ ret = _T("Wheel Down");
+ break;
}
return ret;
}
CString CPPageAccelTbl::MakeAppCommandLabel(UINT id)
{
- for (int i=0; i<countof(g_CommandList); i++)
- {
- if (g_CommandList[i].appcmd == id)
+ for (int i=0; i<countof(g_CommandList); i++) {
+ if (g_CommandList[i].appcmd == id) {
return CString(g_CommandList[i].cmdname);
+ }
}
return CString("");
}
@@ -1440,8 +1439,9 @@ static LRESULT CALLBACK ControlProc(HWND control, UINT message, WPARAM wParam, L if ((LOWORD(wParam)== 'A' || LOWORD(wParam) == 'a') &&(GetKeyState(VK_CONTROL) < 0)) {
CPlayerListCtrl *pList = (CPlayerListCtrl*)CWnd::FromHandle(control);
- for(int i = 0, j = pList->GetItemCount(); i < j; i++)
+ for(int i = 0, j = pList->GetItemCount(); i < j; i++) {
pList->SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
+ }
return 0;
}
@@ -1477,7 +1477,9 @@ BOOL CPPageAccelTbl::OnInitDialog() m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER|LVS_EX_GRIDLINES);
- for(int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) m_list.DeleteColumn(0);
+ for(int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) {
+ m_list.DeleteColumn(0);
+ }
m_list.InsertColumn(COL_CMD, ResStr(IDS_AG_COMMAND), LVCFMT_LEFT, 80);
m_list.InsertColumn(COL_MOD, _T("Modifier"), LVCFMT_LEFT, 40);
m_list.InsertColumn(COL_KEY, ResStr(IDS_AG_KEY), LVCFMT_LEFT, 40);
@@ -1489,8 +1491,7 @@ BOOL CPPageAccelTbl::OnInitDialog() m_list.InsertColumn(COL_RMREPCNT, _T("RepCnt"), LVCFMT_CENTER, 60);
POSITION pos = m_wmcmds.GetHeadPosition();
- for(int i = 0; pos; i++)
- {
+ for(int i = 0; pos; i++) {
int row = m_list.InsertItem(m_list.GetItemCount(), m_wmcmds.GetAt(pos).GetName(), COL_CMD);
m_list.SetItemData(row, (DWORD_PTR)pos);
m_wmcmds.GetNext(pos);
@@ -1524,18 +1525,26 @@ BOOL CPPageAccelTbl::OnApply() CAtlArray<ACCEL> pAccel;
pAccel.SetCount(m_wmcmds.GetCount());
POSITION pos = m_wmcmds.GetHeadPosition();
- for(int i = 0; pos; i++) pAccel[i] = m_wmcmds.GetNext(pos);
- if(s.hAccel) DestroyAcceleratorTable(s.hAccel);
+ for(int i = 0; pos; i++) {
+ pAccel[i] = m_wmcmds.GetNext(pos);
+ }
+ if(s.hAccel) {
+ DestroyAcceleratorTable(s.hAccel);
+ }
s.hAccel = CreateAcceleratorTable(pAccel.GetData(), pAccel.GetCount());
GetParentFrame()->m_hAccelTable = s.hAccel;
s.fWinLirc = !!m_fWinLirc;
s.strWinLircAddr = m_WinLircAddr;
- if(s.fWinLirc) s.WinLircClient.Connect(m_WinLircAddr);
+ if(s.fWinLirc) {
+ s.WinLircClient.Connect(m_WinLircAddr);
+ }
s.fUIce = !!m_fUIce;
s.strUIceAddr = m_UIceAddr;
- if(s.fUIce) s.UIceClient.Connect(m_UIceAddr);
+ if(s.fUIce) {
+ s.UIceClient.Connect(m_UIceAddr);
+ }
s.fGlobalMedia = !!m_fGlobalMedia;
AfxGetMyApp()->RegisterHotkeys();
@@ -1547,8 +1556,7 @@ void CPPageAccelTbl::OnBnClickedButton1() {
m_list.SetFocus();
- for(int i = 0, j = m_list.GetItemCount(); i < j; i++)
- {
+ for(int i = 0, j = m_list.GetItemCount(); i < j; i++) {
m_list.SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
}
}
@@ -1558,10 +1566,11 @@ void CPPageAccelTbl::OnBnClickedButton2() m_list.SetFocus();
POSITION pos = m_list.GetFirstSelectedItemPosition();
- if(!pos) return;
+ if(!pos) {
+ return;
+ }
- while(pos)
- {
+ while(pos) {
int ni = m_list.GetNextSelectedItem(pos);
POSITION pi = (POSITION)m_list.GetItemData(ni);
wmcmd& wc = m_wmcmds.GetAt(pi);
@@ -1580,13 +1589,13 @@ void CPPageAccelTbl::OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = FALSE;
- if(pItem->iItem < 0)
+ if(pItem->iItem < 0) {
return;
+ }
if(pItem->iSubItem == COL_MOD || pItem->iSubItem == COL_KEY || pItem->iSubItem == COL_TYPE
|| pItem->iSubItem == COL_MOUSE || pItem->iSubItem == COL_APPCMD
- || pItem->iSubItem == COL_RMCMD || pItem->iSubItem == COL_RMREPCNT)
- {
+ || pItem->iSubItem == COL_RMCMD || pItem->iSubItem == COL_RMREPCNT) {
*pResult = TRUE;
}
}
@@ -1598,8 +1607,7 @@ void CPPageAccelTbl::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult) LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
LV_ITEM* pItem = &pDispInfo->item;
- if(pItem->iItem < 0)
- {
+ if(pItem->iItem < 0) {
*pResult = FALSE;
return;
}
@@ -1612,61 +1620,64 @@ void CPPageAccelTbl::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult) CAtlList<CString> sl;
int nSel = -1;
- switch(pItem->iSubItem)
- {
- case COL_MOD:
- for(int i = 0; i < countof(s_mods); i++)
- {
- sl.AddTail(MakeAccelModLabel(s_mods[i]));
- if((a.fVirt&~3) == s_mods[i]) nSel = i;
- }
-
- m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
- break;
- case COL_KEY:
- for(int i = 0; i < 256; i++)
- {
- sl.AddTail(MakeAccelVkeyLabel(i, a.fVirt&FVIRTKEY));
- if(a.key == i) nSel = i;
- }
-
- m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
- break;
- case COL_TYPE:
- sl.AddTail(_T("VIRTKEY"));
- sl.AddTail(_T("ASCII"));
-
- nSel = !(a.fVirt&FVIRTKEY);
-
- m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
- break;
- case COL_MOUSE:
- for(UINT i = 0; i < wmcmd::LAST; i++)
- {
- sl.AddTail(MakeMouseButtonLabel(i));
- if(wc.mouse == i) nSel = i;
- }
-
- m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
- break;
- case COL_APPCMD:
- for(int i = 0; i < countof(g_CommandList); i++)
- {
- sl.AddTail(g_CommandList[i].cmdname);
- if(wc.appcmd == g_CommandList[i].appcmd) nSel = i;
- }
-
- m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
- break;
- case COL_RMCMD:
- m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
- break;
- case COL_RMREPCNT:
- m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
- break;
- default:
- *pResult = FALSE;
- break;
+ switch(pItem->iSubItem) {
+ case COL_MOD:
+ for(int i = 0; i < countof(s_mods); i++) {
+ sl.AddTail(MakeAccelModLabel(s_mods[i]));
+ if((a.fVirt&~3) == s_mods[i]) {
+ nSel = i;
+ }
+ }
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+ break;
+ case COL_KEY:
+ for(int i = 0; i < 256; i++) {
+ sl.AddTail(MakeAccelVkeyLabel(i, a.fVirt&FVIRTKEY));
+ if(a.key == i) {
+ nSel = i;
+ }
+ }
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+ break;
+ case COL_TYPE:
+ sl.AddTail(_T("VIRTKEY"));
+ sl.AddTail(_T("ASCII"));
+
+ nSel = !(a.fVirt&FVIRTKEY);
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+ break;
+ case COL_MOUSE:
+ for(UINT i = 0; i < wmcmd::LAST; i++) {
+ sl.AddTail(MakeMouseButtonLabel(i));
+ if(wc.mouse == i) {
+ nSel = i;
+ }
+ }
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+ break;
+ case COL_APPCMD:
+ for(int i = 0; i < countof(g_CommandList); i++) {
+ sl.AddTail(g_CommandList[i].cmdname);
+ if(wc.appcmd == g_CommandList[i].appcmd) {
+ nSel = i;
+ }
+ }
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+ break;
+ case COL_RMCMD:
+ m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
+ break;
+ case COL_RMREPCNT:
+ m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
+ break;
+ default:
+ *pResult = FALSE;
+ break;
}
}
@@ -1677,79 +1688,74 @@ void CPPageAccelTbl::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = FALSE;
- if(!m_list.m_fInPlaceDirty)
+ if(!m_list.m_fInPlaceDirty) {
return;
+ }
- if(pItem->iItem < 0)
+ if(pItem->iItem < 0) {
return;
+ }
wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(pItem->iItem));
- switch(pItem->iSubItem)
- {
- case COL_MOD:
- if(pItem->lParam >= 0 && pItem->lParam < countof(s_mods))
- {
- wc.fVirt = (wc.fVirt&3) | (s_mods[pItem->lParam]&~3);
- m_list.SetItemText(pItem->iItem, COL_MOD, pItem->pszText);
- *pResult = TRUE;
+ switch(pItem->iSubItem) {
+ case COL_MOD:
+ if(pItem->lParam >= 0 && pItem->lParam < countof(s_mods)) {
+ wc.fVirt = (wc.fVirt&3) | (s_mods[pItem->lParam]&~3);
+ m_list.SetItemText(pItem->iItem, COL_MOD, pItem->pszText);
+ *pResult = TRUE;
+ }
+ break;
+ case COL_KEY: {
+ int i = pItem->lParam;
+ if(i >= 0 && i < 256) {
+ wc.key = (WORD)i;
+ m_list.SetItemText(pItem->iItem, COL_KEY, pItem->pszText);
+ *pResult = TRUE;
+ }
}
break;
- case COL_KEY:
- {
- int i = pItem->lParam;
- if(i >= 0 && i < 256)
- {
- wc.key = (WORD)i;
- m_list.SetItemText(pItem->iItem, COL_KEY, pItem->pszText);
- *pResult = TRUE;
- }
- }
- break;
- case COL_TYPE:
- {
- int i = pItem->lParam;
- if(i >= 0 && i < 2)
- {
- wc.fVirt = (wc.fVirt&~FVIRTKEY) | (i == 0 ? FVIRTKEY : 0);
- m_list.SetItemText(pItem->iItem, COL_KEY, MakeAccelVkeyLabel(wc.key, wc.fVirt&FVIRTKEY));
- m_list.SetItemText(pItem->iItem, COL_TYPE, (wc.fVirt&FVIRTKEY)?_T("VIRTKEY"):_T("ASCII"));
- *pResult = TRUE;
- }
- }
- break;
- case COL_APPCMD:
- {
- int i = pItem->lParam;
- if(i >= 0 && i < countof(g_CommandList))
- {
- wc.appcmd = g_CommandList[i].appcmd;
- m_list.SetItemText(pItem->iItem, COL_APPCMD, pItem->pszText);
- *pResult = TRUE;
+ case COL_TYPE: {
+ int i = pItem->lParam;
+ if(i >= 0 && i < 2) {
+ wc.fVirt = (wc.fVirt&~FVIRTKEY) | (i == 0 ? FVIRTKEY : 0);
+ m_list.SetItemText(pItem->iItem, COL_KEY, MakeAccelVkeyLabel(wc.key, wc.fVirt&FVIRTKEY));
+ m_list.SetItemText(pItem->iItem, COL_TYPE, (wc.fVirt&FVIRTKEY)?_T("VIRTKEY"):_T("ASCII"));
+ *pResult = TRUE;
+ }
}
- }
- break;
- case COL_MOUSE:
- wc.mouse = pItem->lParam;
- m_list.SetItemText(pItem->iItem, COL_MOUSE, pItem->pszText);
break;
- case COL_RMCMD:
- wc.rmcmd = CStringA(CString(pItem->pszText)).Trim();
- wc.rmcmd.Replace(' ', '_');
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, CString(wc.rmcmd));
- *pResult = TRUE;
- break;
- case COL_RMREPCNT:
- CString str = CString(pItem->pszText).Trim();
- wc.rmrepcnt = _tcstol(str, NULL, 10);
- str.Format(_T("%d"), wc.rmrepcnt);
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
- *pResult = TRUE;
+ case COL_APPCMD: {
+ int i = pItem->lParam;
+ if(i >= 0 && i < countof(g_CommandList)) {
+ wc.appcmd = g_CommandList[i].appcmd;
+ m_list.SetItemText(pItem->iItem, COL_APPCMD, pItem->pszText);
+ *pResult = TRUE;
+ }
+ }
break;
+ case COL_MOUSE:
+ wc.mouse = pItem->lParam;
+ m_list.SetItemText(pItem->iItem, COL_MOUSE, pItem->pszText);
+ break;
+ case COL_RMCMD:
+ wc.rmcmd = CStringA(CString(pItem->pszText)).Trim();
+ wc.rmcmd.Replace(' ', '_');
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, CString(wc.rmcmd));
+ *pResult = TRUE;
+ break;
+ case COL_RMREPCNT:
+ CString str = CString(pItem->pszText).Trim();
+ wc.rmrepcnt = _tcstol(str, NULL, 10);
+ str.Format(_T("%d"), wc.rmrepcnt);
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ *pResult = TRUE;
+ break;
}
- if(*pResult)
+ if(*pResult) {
SetModified();
+ }
}
@@ -1757,8 +1763,7 @@ void CPPageAccelTbl::OnTimer(UINT_PTR nIDEvent) {
UpdateData();
- if(m_fWinLirc)
- {
+ if(m_fWinLirc) {
CString addr;
m_WinLircEdit.GetWindowText(addr);
AfxGetAppSettings().WinLircClient.Connect(addr);
@@ -1766,8 +1771,7 @@ void CPPageAccelTbl::OnTimer(UINT_PTR nIDEvent) m_WinLircEdit.Invalidate();
- if(m_fUIce)
- {
+ if(m_fUIce) {
CString addr;
m_UIceEdit.GetWindowText(addr);
AfxGetAppSettings().UIceClient.Connect(addr);
@@ -1786,15 +1790,17 @@ HBRUSH CPPageAccelTbl::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) int status = -1;
- if(*pWnd == m_WinLircEdit)
+ if(*pWnd == m_WinLircEdit) {
status = AfxGetAppSettings().WinLircClient.GetStatus();
- else if(*pWnd == m_UIceEdit)
+ } else if(*pWnd == m_UIceEdit) {
status = AfxGetAppSettings().UIceClient.GetStatus();
+ }
- if(status == 0 || status == 2 && (m_counter&1))
+ if(status == 0 || status == 2 && (m_counter&1)) {
pDC->SetTextColor(0x0000ff);
- else if(status == 1)
+ } else if(status == 1) {
pDC->SetTextColor(0x008000);
+ }
return hbr;
}
diff --git a/src/apps/mplayerc/PPageAccelTbl.h b/src/apps/mplayerc/PPageAccelTbl.h index 8b1bbb4a5..f6d0b14de 100644 --- a/src/apps/mplayerc/PPageAccelTbl.h +++ b/src/apps/mplayerc/PPageAccelTbl.h @@ -55,7 +55,7 @@ public: enum {APPCOMMAND_LAST=APPCOMMAND_DWM_FLIP3D};
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGEACCELTBL };
CPlayerListCtrl m_list;
BOOL m_fWinLirc;
diff --git a/src/apps/mplayerc/PPageAudioSwitcher.cpp b/src/apps/mplayerc/PPageAudioSwitcher.cpp index d5cac0e9c..c664b916a 100644 --- a/src/apps/mplayerc/PPageAudioSwitcher.cpp +++ b/src/apps/mplayerc/PPageAudioSwitcher.cpp @@ -116,14 +116,16 @@ BOOL CPPageAudioSwitcher::OnInitDialog() m_fCustomChannelMapping = s.fCustomChannelMapping;
memcpy(m_pSpeakerToChannelMap, s.pSpeakerToChannelMap, sizeof(s.pSpeakerToChannelMap));
- if(m_pASF)
+ if(m_pASF) {
m_pASF->GetInputSpeakerConfig(&m_dwChannelMask);
+ }
m_nChannels = s.nSpeakerChannels;
m_nChannelsSpinCtrl.SetRange(1, 18);
- if(m_pASF)
+ if(m_pASF) {
m_nChannels = m_pASF->GetNumberOfInputChannels();
+ }
m_list.InsertColumn(0, _T(""), LVCFMT_LEFT, 100);
m_list.InsertItem(0, _T(""));
@@ -147,14 +149,13 @@ BOOL CPPageAudioSwitcher::OnInitDialog() m_list.InsertItem(18, ResStr(IDS_TOP_BACK_RIGHT));
m_list.SetColumnWidth(0, LVSCW_AUTOSIZE);
- for(int i = 1; i <= 18; i++)
- {
+ for(int i = 1; i <= 18; i++) {
m_list.InsertColumn(i, _T(""), LVCFMT_CENTER, 16);
CString n;
n.Format(_T("%d"), i);
m_list.SetItemText(0, i, n);
-// m_list.SetColumnWidth(i, LVSCW_AUTOSIZE);
-// m_list.SetColumnWidth(i, m_list.GetColumnWidth(i)*8/10);
+ // m_list.SetColumnWidth(i, LVSCW_AUTOSIZE);
+ // m_list.SetColumnWidth(i, m_list.GetColumnWidth(i)*8/10);
}
m_tooltip.Create(GetDlgItem(IDC_SLIDER1));
@@ -182,8 +183,7 @@ BOOL CPPageAudioSwitcher::OnApply() s.fCustomChannelMapping = !!m_fCustomChannelMapping;
memcpy(s.pSpeakerToChannelMap, m_pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap));
- if(m_pASF)
- {
+ if(m_pASF) {
m_pASF->SetSpeakerConfig(s.fCustomChannelMapping, s.pSpeakerToChannelMap);
m_pASF->EnableDownSamplingTo441(s.fDownSampleTo441);
m_pASF->SetAudioTimeShift(s.fAudioTimeShift ? 10000i64*s.iAudioTimeShift : 0);
@@ -199,15 +199,13 @@ void CPPageAudioSwitcher::OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult) {
LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
- if(lpnmlv->iItem > 0 && lpnmlv->iSubItem > 0 && lpnmlv->iSubItem <= m_nChannels)
- {
+ if(lpnmlv->iItem > 0 && lpnmlv->iSubItem > 0 && lpnmlv->iSubItem <= m_nChannels) {
UpdateData();
m_pSpeakerToChannelMap[m_nChannels-1][lpnmlv->iItem-1] ^= 1<<(lpnmlv->iSubItem-1);
m_list.RedrawItems(lpnmlv->iItem, lpnmlv->iItem);
SetModified();
- if(GetKeyState(VK_SHIFT) & 0x8000)
- {
+ if(GetKeyState(VK_SHIFT) & 0x8000) {
OnApply();
}
}
@@ -217,8 +215,7 @@ void CPPageAudioSwitcher::OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult) void CPPageAudioSwitcher::OnEnChangeEdit1()
{
- if(IsWindow(m_list.m_hWnd))
- {
+ if(IsWindow(m_list.m_hWnd)) {
UpdateData();
m_list.Invalidate();
SetModified();
@@ -229,10 +226,12 @@ void CPPageAudioSwitcher::OnEnChangeEdit1() void CPPageAudioSwitcher::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
- if(nIDCtl != IDC_LIST1) return;
+ if(nIDCtl != IDC_LIST1) {
+ return;
+ }
-// if(lpDrawItemStruct->itemID == 0)
-// UpdateData();
+ // if(lpDrawItemStruct->itemID == 0)
+ // UpdateData();
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
@@ -247,8 +246,7 @@ void CPPageAudioSwitcher::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStru CHeaderCtrl* pHeader = m_list.GetHeaderCtrl();
int nColumnCount = pHeader->GetItemCount();
- for(int i = 0; i < nColumnCount; i++)
- {
+ for(int i = 0; i < nColumnCount; i++) {
CRect r, rb;
m_list.GetSubItemRect(lpDrawItemStruct->itemID, i, LVIR_BOUNDS, rb);
m_list.GetSubItemRect(lpDrawItemStruct->itemID, i, LVIR_LABEL, r);
@@ -258,43 +256,32 @@ void CPPageAudioSwitcher::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStru CSize s = pDC->GetTextExtent(m_list.GetItemText(lpDrawItemStruct->itemID, i));
- if(i == 0)
- {
+ if(i == 0) {
r.left = rb.left;
- if(lpDrawItemStruct->itemID == 0)
- {
+ if(lpDrawItemStruct->itemID == 0) {
pDC->MoveTo(0, 0);
pDC->LineTo(r.right, r.bottom-1);
- }
- else
- {
+ } else {
pDC->SetTextColor(m_list.IsWindowEnabled() ? 0 : 0xb0b0b0);
pDC->TextOut(r.left+1, (r.top+r.bottom-s.cy)/2, m_list.GetItemText(lpDrawItemStruct->itemID, i));
}
- }
- else
- {
+ } else {
pDC->SetTextColor(i > m_nChannels ? 0xe0e0e0 : (!m_list.IsWindowEnabled() ? 0xb0b0b0 : 0));
- if(lpDrawItemStruct->itemID == 0)
- {
+ if(lpDrawItemStruct->itemID == 0) {
pDC->TextOut((r.left+r.right-s.cx)/2, (r.top+r.bottom-s.cy)/2, m_list.GetItemText(lpDrawItemStruct->itemID, i));
- }
- else
- {
- if(m_dwChannelMask & (1<<(lpDrawItemStruct->itemID-1)))
- {
+ } else {
+ if(m_dwChannelMask & (1<<(lpDrawItemStruct->itemID-1))) {
int nBitsSet = 0;
- for(int j = 1; j <= (1<<(lpDrawItemStruct->itemID-1)); j <<= 1)
- {
- if(m_dwChannelMask & j)
+ for(int j = 1; j <= (1<<(lpDrawItemStruct->itemID-1)); j <<= 1) {
+ if(m_dwChannelMask & j) {
nBitsSet++;
+ }
}
- if(nBitsSet == i)
- {
+ if(nBitsSet == i) {
COLORREF tmp = pDC->GetTextColor();
pDC->SetTextColor(0xe0e0e0);
@@ -309,8 +296,7 @@ void CPPageAudioSwitcher::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStru }
}
- if(m_pSpeakerToChannelMap[m_nChannels-1][lpDrawItemStruct->itemID-1] & (1<<(i-1)))
- {
+ if(m_pSpeakerToChannelMap[m_nChannels-1][lpDrawItemStruct->itemID-1] & (1<<(i-1))) {
CFont f;
f.CreatePointFont(MulDiv(100, 96, pDC->GetDeviceCaps(LOGPIXELSX)), _T("Marlett"));
CFont* old = pDC->SelectObject(&f);
@@ -327,13 +313,13 @@ void CPPageAudioSwitcher::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStru void CPPageAudioSwitcher::OnUpdateAudioSwitcher(CCmdUI* pCmdUI)
{
-// UpdateData();
+ // UpdateData();
pCmdUI->Enable(IsDlgButtonChecked(IDC_CHECK2)/*m_fEnableAudioSwitcher*/);
}
void CPPageAudioSwitcher::OnUpdateChannelMapping(CCmdUI* pCmdUI)
{
-// UpdateData();
+ // UpdateData();
pCmdUI->Enable(IsDlgButtonChecked(IDC_CHECK2)/*m_fEnableAudioSwitcher*/
&& IsDlgButtonChecked(IDC_CHECK1)/*m_fCustomChannelMapping*/);
}
@@ -351,20 +337,21 @@ BOOL CPPageAudioSwitcher::OnToolTipNotify(UINT id, NMHDR * pNMHDR, LRESULT * pRe UINT nID = pNMHDR->idFrom;
- if (pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
- {
+ if (pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND)) {
nID = ::GetDlgCtrlID((HWND)nID);
}
- if(nID == 0)
+ if(nID == 0) {
return FALSE;
+ }
static CStringW m_strTipTextW;
m_strTipTextW.Format(L"+%.1f dB", m_AudioBoostCtrl.GetPos()/10.0);
- if(pNMHDR->code == TTN_NEEDTEXTW) //?possible check is not needed
+ if(pNMHDR->code == TTN_NEEDTEXTW) { //?possible check is not needed
pTTTW->lpszText = (LPWSTR)(LPCWSTR)m_strTipTextW;
+ }
*pResult = 0;
diff --git a/src/apps/mplayerc/PPageAudioSwitcher.h b/src/apps/mplayerc/PPageAudioSwitcher.h index 67c24d184..dbc332049 100644 --- a/src/apps/mplayerc/PPageAudioSwitcher.h +++ b/src/apps/mplayerc/PPageAudioSwitcher.h @@ -43,7 +43,7 @@ public: CPPageAudioSwitcher(IFilterGraph* pFG);
virtual ~CPPageAudioSwitcher();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGEAUDIOSWITCHER };
BOOL m_fEnableAudioSwitcher;
diff --git a/src/apps/mplayerc/PPageBase.cpp b/src/apps/mplayerc/PPageBase.cpp index f3c23a6a9..de49f2931 100644 --- a/src/apps/mplayerc/PPageBase.cpp +++ b/src/apps/mplayerc/PPageBase.cpp @@ -49,30 +49,27 @@ void CPPageBase::CreateToolTip() m_wndToolTip.Activate(TRUE);
m_wndToolTip.SetMaxTipWidth(300);
m_wndToolTip.SetDelayTime(TTDT_AUTOPOP, 10000);
- for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetWindow(GW_HWNDNEXT))
- {
+ for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetWindow(GW_HWNDNEXT)) {
CString strToolTip;
- if(strToolTip.LoadString(pChild->GetDlgCtrlID()))
+ if(strToolTip.LoadString(pChild->GetDlgCtrlID())) {
m_wndToolTip.AddTool(pChild, strToolTip);
+ }
}
}
BOOL CPPageBase::PreTranslateMessage(MSG* pMsg)
{
if(IsWindow(m_wndToolTip))
- if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST)
- {
+ if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST) {
MSG msg;
memcpy(&msg, pMsg, sizeof(MSG));
for(HWND hWndParent = ::GetParent(msg.hwnd);
hWndParent && hWndParent != m_hWnd;
- hWndParent = ::GetParent(hWndParent))
- {
+ hWndParent = ::GetParent(hWndParent)) {
msg.hwnd = hWndParent;
}
- if(msg.hwnd)
- {
+ if(msg.hwnd) {
m_wndToolTip.RelayEvent(&msg);
}
}
diff --git a/src/apps/mplayerc/PPageBase.h b/src/apps/mplayerc/PPageBase.h index 3db4f17c3..b1bc4aaac 100644 --- a/src/apps/mplayerc/PPageBase.h +++ b/src/apps/mplayerc/PPageBase.h @@ -37,7 +37,7 @@ public: CPPageBase(UINT nIDTemplate, UINT nIDCaption = 0);
virtual ~CPPageBase();
-// Dialog Data
+ // Dialog Data
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
diff --git a/src/apps/mplayerc/PPageCapture.cpp b/src/apps/mplayerc/PPageCapture.cpp index 49feaa013..ad82c2ded 100644 --- a/src/apps/mplayerc/PPageCapture.cpp +++ b/src/apps/mplayerc/PPageCapture.cpp @@ -35,13 +35,11 @@ #include "../../DSUtil/DSUtil.h"
-static struct cc_t
-{
+static struct cc_t {
long code;
AnalogVideoStandard standard;
const TCHAR* str;
-} s_countrycodes[] =
-{
+} s_countrycodes[] = {
{1, AnalogVideo_NTSC_M, _T("USA")},
{2, AnalogVideo_NTSC_M, _T("Canada")},
{7, AnalogVideo_SECAM_D, _T("Russia")},
@@ -312,8 +310,7 @@ void CPPageCapture::FindAnalogDevices() int iSel = 0;
// List video devised
- BeginEnumSysDev(CLSID_VideoInputDeviceCategory, pMoniker)
- {
+ BeginEnumSysDev(CLSID_VideoInputDeviceCategory, pMoniker) {
CComPtr<IPropertyBag> pPB;
pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB);
@@ -322,10 +319,11 @@ void CPPageCapture::FindAnalogDevices() int i = m_cbAnalogVideo.AddString(CString(var.bstrVal));
LPOLESTR strName = NULL;
- if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName)))
- {
+ if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName))) {
m_vidnames.Add(CString(strName));
- if(s.strAnalogVideo == CString(strName)) iSel = i;
+ if(s.strAnalogVideo == CString(strName)) {
+ iSel = i;
+ }
CoTaskMemFree(strName);
}
}
@@ -334,18 +332,18 @@ void CPPageCapture::FindAnalogDevices() {
int i = m_cbAnalogAudio.AddString(_T("<Video Capture Device>"));
m_audnames.Add(_T(""));
- if(s.strAnalogAudio.IsEmpty()) iSel = i;
+ if(s.strAnalogAudio.IsEmpty()) {
+ iSel = i;
+ }
}
- if(m_cbAnalogVideo.GetCount())
- {
+ if(m_cbAnalogVideo.GetCount()) {
m_cbAnalogVideo.SetCurSel(iSel);
}
// List audio devised
iSel = 0;
- BeginEnumSysDev(CLSID_AudioInputDeviceCategory, pMoniker)
- {
+ BeginEnumSysDev(CLSID_AudioInputDeviceCategory, pMoniker) {
CComPtr<IPropertyBag> pPB;
pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB);
@@ -354,84 +352,84 @@ void CPPageCapture::FindAnalogDevices() int i = m_cbAnalogAudio.AddString(CString(var.bstrVal));
LPOLESTR strName = NULL;
- if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName)))
- {
+ if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName))) {
m_audnames.Add(CString(strName));
- if(s.strAnalogAudio == CString(strName)) iSel = i;
+ if(s.strAnalogAudio == CString(strName)) {
+ iSel = i;
+ }
CoTaskMemFree(strName);
}
}
EndEnumSysDev
- if(m_cbAnalogAudio.GetCount())
+ if(m_cbAnalogAudio.GetCount()) {
m_cbAnalogAudio.SetCurSel(iSel);
+ }
// Fill country
iSel = 0;
- for(int j = 0; j < countof(s_countrycodes); j++)
- {
+ for(int j = 0; j < countof(s_countrycodes); j++) {
CString standard;
- switch(s_countrycodes[j].standard)
- {
- case AnalogVideo_NTSC_M:
- standard = _T("NTSC M");
- break;
- case AnalogVideo_NTSC_M_J:
- standard = _T("NTSC M J");
- break;
- case AnalogVideo_NTSC_433:
- standard = _T("NTSC 433");
- break;
- case AnalogVideo_PAL_B:
- standard = _T("PAL B");
- break;
- case AnalogVideo_PAL_D:
- standard = _T("PAL D");
- break;
- case AnalogVideo_PAL_G:
- standard = _T("PAL G");
- break;
- case AnalogVideo_PAL_H:
- standard = _T("PAL H");
- break;
- case AnalogVideo_PAL_I:
- standard = _T("PAL I");
- break;
- case AnalogVideo_PAL_M:
- standard = _T("PAL M");
- break;
- case AnalogVideo_PAL_N:
- standard = _T("PAL N");
- break;
- case AnalogVideo_PAL_60:
- standard = _T("PAL 60");
- break;
- case AnalogVideo_SECAM_B:
- standard = _T("SECAM B");
- break;
- case AnalogVideo_SECAM_D:
- standard = _T("SECAM D");
- break;
- case AnalogVideo_SECAM_G:
- standard = _T("SECAM G");
- break;
- case AnalogVideo_SECAM_H:
- standard = _T("SECAM H");
- break;
- case AnalogVideo_SECAM_K:
- standard = _T("SECAM K");
- break;
- case AnalogVideo_SECAM_K1:
- standard = _T("SECAM K1");
- break;
- case AnalogVideo_SECAM_L:
- standard = _T("SECAM L");
- break;
- case AnalogVideo_SECAM_L1:
- standard = _T("SECAM L1");
- break;
- case AnalogVideo_PAL_N_COMBO:
- standard = _T("PAL N COMBO");
- break;
+ switch(s_countrycodes[j].standard) {
+ case AnalogVideo_NTSC_M:
+ standard = _T("NTSC M");
+ break;
+ case AnalogVideo_NTSC_M_J:
+ standard = _T("NTSC M J");
+ break;
+ case AnalogVideo_NTSC_433:
+ standard = _T("NTSC 433");
+ break;
+ case AnalogVideo_PAL_B:
+ standard = _T("PAL B");
+ break;
+ case AnalogVideo_PAL_D:
+ standard = _T("PAL D");
+ break;
+ case AnalogVideo_PAL_G:
+ standard = _T("PAL G");
+ break;
+ case AnalogVideo_PAL_H:
+ standard = _T("PAL H");
+ break;
+ case AnalogVideo_PAL_I:
+ standard = _T("PAL I");
+ break;
+ case AnalogVideo_PAL_M:
+ standard = _T("PAL M");
+ break;
+ case AnalogVideo_PAL_N:
+ standard = _T("PAL N");
+ break;
+ case AnalogVideo_PAL_60:
+ standard = _T("PAL 60");
+ break;
+ case AnalogVideo_SECAM_B:
+ standard = _T("SECAM B");
+ break;
+ case AnalogVideo_SECAM_D:
+ standard = _T("SECAM D");
+ break;
+ case AnalogVideo_SECAM_G:
+ standard = _T("SECAM G");
+ break;
+ case AnalogVideo_SECAM_H:
+ standard = _T("SECAM H");
+ break;
+ case AnalogVideo_SECAM_K:
+ standard = _T("SECAM K");
+ break;
+ case AnalogVideo_SECAM_K1:
+ standard = _T("SECAM K1");
+ break;
+ case AnalogVideo_SECAM_L:
+ standard = _T("SECAM L");
+ break;
+ case AnalogVideo_SECAM_L1:
+ standard = _T("SECAM L1");
+ break;
+ case AnalogVideo_PAL_N_COMBO:
+ standard = _T("PAL N COMBO");
+ break;
}
CString str;
@@ -439,11 +437,14 @@ void CPPageCapture::FindAnalogDevices() int i = m_cbAnalogCountry.AddString(str);
m_cbAnalogCountry.SetItemDataPtr(i, &s_countrycodes[j]);
- if(s.iAnalogCountry == s_countrycodes[j].code) iSel = i;
+ if(s.iAnalogCountry == s_countrycodes[j].code) {
+ iSel = i;
+ }
}
- if(m_cbAnalogCountry.GetCount())
+ if(m_cbAnalogCountry.GetCount()) {
m_cbAnalogCountry.SetCurSel(iSel);
+ }
}
void CPPageCapture::FindDigitalDevices()
@@ -451,8 +452,7 @@ void CPPageCapture::FindDigitalDevices() AppSettings& s = AfxGetAppSettings();
int iSel = 0;
- BeginEnumSysDev(KSCATEGORY_BDA_NETWORK_PROVIDER, pMoniker)
- {
+ BeginEnumSysDev(KSCATEGORY_BDA_NETWORK_PROVIDER, pMoniker) {
CComPtr<IPropertyBag> pPB;
pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB);
@@ -461,21 +461,22 @@ void CPPageCapture::FindDigitalDevices() int i = m_cbDigitalNetworkProvider.AddString(CString(var.bstrVal));
LPOLESTR strName = NULL;
- if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName)))
- {
+ if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName))) {
m_providernames.Add(CString(strName));
- if (s.strBDANetworkProvider == CString(strName)) iSel = i;
+ if (s.strBDANetworkProvider == CString(strName)) {
+ iSel = i;
+ }
CoTaskMemFree(strName);
}
}
EndEnumSysDev
- if(m_cbDigitalNetworkProvider.GetCount())
+ if(m_cbDigitalNetworkProvider.GetCount()) {
m_cbDigitalNetworkProvider.SetCurSel(iSel);
+ }
iSel = 0;
- BeginEnumSysDev(KSCATEGORY_BDA_NETWORK_TUNER, pMoniker)
- {
+ BeginEnumSysDev(KSCATEGORY_BDA_NETWORK_TUNER, pMoniker) {
CComPtr<IPropertyBag> pPB;
pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB);
@@ -484,20 +485,21 @@ void CPPageCapture::FindDigitalDevices() int i = m_cbDigitalTuner.AddString(CString(var.bstrVal));
LPOLESTR strName = NULL;
- if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName)))
- {
+ if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName))) {
m_tunernames.Add(CString(strName));
- if (s.strBDATuner == CString(strName)) iSel = i;
+ if (s.strBDATuner == CString(strName)) {
+ iSel = i;
+ }
CoTaskMemFree(strName);
}
}
EndEnumSysDev
- if(m_cbDigitalTuner.GetCount())
+ if(m_cbDigitalTuner.GetCount()) {
m_cbDigitalTuner.SetCurSel(iSel);
+ }
iSel = 0;
- BeginEnumSysDev(KSCATEGORY_BDA_RECEIVER_COMPONENT, pMoniker)
- {
+ BeginEnumSysDev(KSCATEGORY_BDA_RECEIVER_COMPONENT, pMoniker) {
CComPtr<IPropertyBag> pPB;
pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB);
@@ -506,16 +508,18 @@ void CPPageCapture::FindDigitalDevices() int i = m_cbDigitalReceiver.AddString(CString(var.bstrVal));
LPOLESTR strName = NULL;
- if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName)))
- {
+ if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName))) {
m_receivernames.Add(CString(strName));
- if (s.strBDAReceiver == CString(strName)) iSel = i;
+ if (s.strBDAReceiver == CString(strName)) {
+ iSel = i;
+ }
CoTaskMemFree(strName);
}
}
EndEnumSysDev
- if(m_cbDigitalReceiver.GetCount())
+ if(m_cbDigitalReceiver.GetCount()) {
m_cbDigitalReceiver.SetCurSel(iSel);
+ }
}
BOOL CPPageCapture::OnApply()
@@ -526,19 +530,25 @@ BOOL CPPageCapture::OnApply() s.iDefaultCaptureDevice = m_iDefaultDevice;
- if (m_cbAnalogVideo.GetCurSel()>=0)
+ if (m_cbAnalogVideo.GetCurSel()>=0) {
s.strAnalogVideo = m_vidnames[m_cbAnalogVideo.GetCurSel()];
- if (m_cbAnalogAudio.GetCurSel()>=0)
+ }
+ if (m_cbAnalogAudio.GetCurSel()>=0) {
s.strAnalogAudio = m_audnames[m_cbAnalogAudio.GetCurSel()];
- if (m_cbAnalogCountry.GetCurSel()>=0)
+ }
+ if (m_cbAnalogCountry.GetCurSel()>=0) {
s.iAnalogCountry = ((cc_t*)m_cbAnalogCountry.GetItemDataPtr(m_cbAnalogCountry.GetCurSel()))->code;
+ }
- if (m_cbDigitalNetworkProvider.GetCurSel()>=0)
+ if (m_cbDigitalNetworkProvider.GetCurSel()>=0) {
s.strBDANetworkProvider = m_providernames[m_cbDigitalNetworkProvider.GetCurSel()];
- if (m_cbDigitalTuner.GetCurSel()>=0)
+ }
+ if (m_cbDigitalTuner.GetCurSel()>=0) {
s.strBDATuner = m_tunernames[m_cbDigitalTuner.GetCurSel()];
- if (m_cbDigitalReceiver.GetCurSel()>=0)
+ }
+ if (m_cbDigitalReceiver.GetCurSel()>=0) {
s.strBDAReceiver = m_receivernames[m_cbDigitalReceiver.GetCurSel()];
+ }
return __super::OnApply();
}
diff --git a/src/apps/mplayerc/PPageCapture.h b/src/apps/mplayerc/PPageCapture.h index e78030b26..ecebdb341 100644 --- a/src/apps/mplayerc/PPageCapture.h +++ b/src/apps/mplayerc/PPageCapture.h @@ -38,7 +38,7 @@ public: CPPageCapture(); // standard constructor
virtual ~CPPageCapture();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGECAPTURE };
protected:
diff --git a/src/apps/mplayerc/PPageCasimir.cpp b/src/apps/mplayerc/PPageCasimir.cpp index e340cf09f..49760cc1d 100644 --- a/src/apps/mplayerc/PPageCasimir.cpp +++ b/src/apps/mplayerc/PPageCasimir.cpp @@ -71,8 +71,7 @@ BOOL CPPageCasimir::OnInitDialog() CreateToolTip();
ControlRange = AfxGetMyApp()->GetColorControl (Contrast);
- if (ControlRange)
- {
+ if (ControlRange) {
m_dContrast = s.dContrast;
m_SliContrast.EnableWindow (TRUE);
m_SliContrast.SetRange ((int)ControlRange->MinValue*100, (int)ControlRange->MaxValue*100);
@@ -81,8 +80,7 @@ BOOL CPPageCasimir::OnInitDialog() }
ControlRange = AfxGetMyApp()->GetColorControl (Brightness);
- if (ControlRange)
- {
+ if (ControlRange) {
m_dBrightness = s.dBrightness;
m_SliBrightness.EnableWindow (TRUE);
m_SliBrightness.SetRange ((int)ControlRange->MinValue, (int)ControlRange->MaxValue);
@@ -91,8 +89,7 @@ BOOL CPPageCasimir::OnInitDialog() }
ControlRange = AfxGetMyApp()->GetColorControl (Hue);
- if (ControlRange)
- {
+ if (ControlRange) {
m_dHue = s.dHue;
m_SliHue.EnableWindow (TRUE);
m_SliHue.SetRange ((int)ControlRange->MinValue, (int)ControlRange->MaxValue);
@@ -101,8 +98,7 @@ BOOL CPPageCasimir::OnInitDialog() }
ControlRange = AfxGetMyApp()->GetColorControl (Saturation);
- if (ControlRange)
- {
+ if (ControlRange) {
m_dSaturation = s.dSaturation;
m_SliSaturation.EnableWindow (TRUE);
m_SliSaturation.SetRange ((int)ControlRange->MinValue*100, (int)ControlRange->MaxValue*100);
@@ -130,23 +126,16 @@ BOOL CPPageCasimir::OnApply() void CPPageCasimir::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
- if(*pScrollBar == m_SliContrast)
- {
+ if(*pScrollBar == m_SliContrast) {
UpdateData();
m_dContrast = (float)(m_SliContrast.GetPos()/100.0);
- }
- else if(*pScrollBar == m_SliBrightness)
- {
+ } else if(*pScrollBar == m_SliBrightness) {
UpdateData();
m_dBrightness = (float)m_SliBrightness.GetPos();
- }
- else if(*pScrollBar == m_SliHue)
- {
+ } else if(*pScrollBar == m_SliHue) {
UpdateData();
m_dHue = (float)m_SliHue.GetPos();
- }
- else if(*pScrollBar == m_SliSaturation)
- {
+ } else if(*pScrollBar == m_SliSaturation) {
UpdateData();
m_dSaturation = (float)(m_SliSaturation.GetPos()/100.0);
}
diff --git a/src/apps/mplayerc/PPageCasimir.h b/src/apps/mplayerc/PPageCasimir.h index d9420c91c..204d03d78 100644 --- a/src/apps/mplayerc/PPageCasimir.h +++ b/src/apps/mplayerc/PPageCasimir.h @@ -42,7 +42,7 @@ public: CPPageCasimir();
virtual ~CPPageCasimir();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGECASIMIR };
protected:
diff --git a/src/apps/mplayerc/PPageDVD.cpp b/src/apps/mplayerc/PPageDVD.cpp index 823163d45..33adb2695 100644 --- a/src/apps/mplayerc/PPageDVD.cpp +++ b/src/apps/mplayerc/PPageDVD.cpp @@ -26,13 +26,11 @@ #include "PPageDVD.h"
-struct
-{
+struct {
LCID lcid;
LPCSTR name;
}
-LCIDNameList[] =
-{
+LCIDNameList[] = {
{0x0000, "Default"},
{0x0436, "Afrikaans"},
{0x041c, "Albanian"},
@@ -212,10 +210,8 @@ void CPPageDVD::UpdateLCIDList() : m_iDVDLangType == 1 ? m_idAudioLang
: m_idSubtitlesLang;
- for(int i = 0; i < m_lcids.GetCount(); i++)
- {
- if(m_lcids.GetItemData(i) == lcid)
- {
+ for(int i = 0; i < m_lcids.GetCount(); i++) {
+ if(m_lcids.GetItemData(i) == lcid) {
m_lcids.SetCurSel(i);
m_lcids.SetTopIndex(i);
break;
@@ -251,8 +247,7 @@ BOOL CPPageDVD::OnInitDialog() UpdateData(FALSE);
- for(int i = 0; i < countof(LCIDNameList); i++)
- {
+ for(int i = 0; i < countof(LCIDNameList); i++) {
m_lcids.AddString(CString(LCIDNameList[i].name));
m_lcids.SetItemData(i, LCIDNameList[i].lcid);
}
@@ -294,8 +289,7 @@ void CPPageDVD::OnBnClickedButton1() bi.iImage = 0;
LPITEMIDLIST iil = SHBrowseForFolder(&bi);
- if(iil)
- {
+ if(iil) {
SHGetPathFromIDList(iil, path);
m_dvdpath = path;
diff --git a/src/apps/mplayerc/PPageDVD.h b/src/apps/mplayerc/PPageDVD.h index 6579611d5..3a0a4aefd 100644 --- a/src/apps/mplayerc/PPageDVD.h +++ b/src/apps/mplayerc/PPageDVD.h @@ -52,7 +52,7 @@ public: BOOL m_fAutoSpeakerConf;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGEDVD};
protected:
diff --git a/src/apps/mplayerc/PPageExternalFilters.cpp b/src/apps/mplayerc/PPageExternalFilters.cpp index b088096cc..672037df3 100644 --- a/src/apps/mplayerc/PPageExternalFilters.cpp +++ b/src/apps/mplayerc/PPageExternalFilters.cpp @@ -60,7 +60,9 @@ void CPPageExternalFilters::DoDataExchange(CDataExchange* pDX) void CPPageExternalFilters::StepUp(CCheckListBox& list)
{
int i = list.GetCurSel();
- if(i < 1) return;
+ if(i < 1) {
+ return;
+ }
CString str;
list.GetText(i, str);
@@ -77,7 +79,9 @@ void CPPageExternalFilters::StepUp(CCheckListBox& list) void CPPageExternalFilters::StepDown(CCheckListBox& list)
{
int i = list.GetCurSel();
- if(i < 0 || i >= list.GetCount()-1) return;
+ if(i < 0 || i >= list.GetCount()-1) {
+ return;
+ }
CString str;
list.GetText(i, str);
@@ -287,22 +291,24 @@ BOOL CPPageExternalFilters::OnInitDialog() m_pFilters.RemoveAll();
POSITION pos = s.m_filters.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CAutoPtr<FilterOverride> f(DNew FilterOverride(s.m_filters.GetNext(pos)));
CString name(_T("<unknown>"));
- if(f->type == FilterOverride::REGISTERED)
- {
+ if(f->type == FilterOverride::REGISTERED) {
name = CFGFilterRegistry(f->dispname).GetName();
- if(name.IsEmpty()) name = f->name + _T(" <not registered>");
- }
- else if(f->type == FilterOverride::EXTERNAL)
- {
+ if(name.IsEmpty()) {
+ name = f->name + _T(" <not registered>");
+ }
+ } else if(f->type == FilterOverride::EXTERNAL) {
name = f->name;
- if(f->fTemporary) name += _T(" <temporary>");
- if(!CPath(MakeFullPath(f->path)).FileExists()) name += _T(" <not found!>");
+ if(f->fTemporary) {
+ name += _T(" <temporary>");
+ }
+ if(!CPath(MakeFullPath(f->path)).FileExists()) {
+ name += _T(" <not found!>");
+ }
}
int i = m_filters.AddString(name);
@@ -324,10 +330,8 @@ BOOL CPPageExternalFilters::OnApply() s.m_filters.RemoveAll();
- for(int i = 0; i < m_filters.GetCount(); i++)
- {
- if(POSITION pos = (POSITION)m_filters.GetItemData(i))
- {
+ for(int i = 0; i < m_filters.GetCount(); i++) {
+ if(POSITION pos = (POSITION)m_filters.GetItemData(i)) {
CAutoPtr<FilterOverride> f(DNew FilterOverride(m_pFilters.GetAt(pos)));
f->fDisabled = !m_filters.GetCheck(i);
s.m_filters.AddTail(f);
@@ -339,12 +343,9 @@ BOOL CPPageExternalFilters::OnApply() void CPPageExternalFilters::OnUpdateFilter(CCmdUI* pCmdUI)
{
- if(FilterOverride* f = GetCurFilter())
- {
+ if(FilterOverride* f = GetCurFilter()) {
pCmdUI->Enable(!(pCmdUI->m_nID == IDC_RADIO2 && f->type == FilterOverride::EXTERNAL));
- }
- else
- {
+ } else {
pCmdUI->Enable(FALSE);
}
}
@@ -379,27 +380,24 @@ void CPPageExternalFilters::OnUpdateDeleteType(CCmdUI* pCmdUI) void CPPageExternalFilters::OnAddRegistered()
{
CRegFilterChooserDlg dlg(this);
- if(dlg.DoModal() == IDOK)
- {
- while(!dlg.m_filters.IsEmpty())
- {
- if(FilterOverride* f = dlg.m_filters.RemoveHead())
- {
+ if(dlg.DoModal() == IDOK) {
+ while(!dlg.m_filters.IsEmpty()) {
+ if(FilterOverride* f = dlg.m_filters.RemoveHead()) {
CAutoPtr<FilterOverride> p(f);
CString name = f->name;
- if(f->type == FilterOverride::EXTERNAL)
- {
- if(!CPath(MakeFullPath(f->path)).FileExists()) name += _T(" <not found!>");
+ if(f->type == FilterOverride::EXTERNAL) {
+ if(!CPath(MakeFullPath(f->path)).FileExists()) {
+ name += _T(" <not found!>");
+ }
}
int i = m_filters.AddString(name);
m_filters.SetItemDataPtr(i, m_pFilters.AddTail(p));
m_filters.SetCheck(i, 1);
- if(dlg.m_filters.IsEmpty())
- {
+ if(dlg.m_filters.IsEmpty()) {
m_filters.SetCurSel(i);
OnLbnSelchangeList1();
}
@@ -413,7 +411,9 @@ void CPPageExternalFilters::OnRemoveFilter() int i = m_filters.GetCurSel();
m_pFilters.RemoveAt((POSITION)m_filters.GetItemDataPtr(i));
m_filters.DeleteString(i);
- if(i >= m_filters.GetCount()) i--;
+ if(i >= m_filters.GetCount()) {
+ i--;
+ }
m_filters.SetCurSel(i);
OnLbnSelchangeList1();
}
@@ -430,31 +430,28 @@ void CPPageExternalFilters::OnMoveFilterDown() void CPPageExternalFilters::OnLbnDblclkFilter()
{
- if(FilterOverride* f = GetCurFilter())
- {
+ if(FilterOverride* f = GetCurFilter()) {
CComPtr<IBaseFilter> pBF;
CString name;
- if(f->type == FilterOverride::REGISTERED)
- {
+ if(f->type == FilterOverride::REGISTERED) {
CStringW namew;
- if(CreateFilter(f->dispname, &pBF, namew))
+ if(CreateFilter(f->dispname, &pBF, namew)) {
name = namew;
- }
- else if(f->type == FilterOverride::EXTERNAL)
- {
- if(SUCCEEDED(LoadExternalFilter(f->path, f->clsid, &pBF)))
+ }
+ } else if(f->type == FilterOverride::EXTERNAL) {
+ if(SUCCEEDED(LoadExternalFilter(f->path, f->clsid, &pBF))) {
name = f->name;
+ }
}
- if(CComQIPtr<ISpecifyPropertyPages> pSPP = pBF)
- {
+ if(CComQIPtr<ISpecifyPropertyPages> pSPP = pBF) {
CComPropertySheet ps(name, this);
- if(ps.AddPages(pSPP) > 0)
- {
+ if(ps.AddPages(pSPP) > 0) {
CComPtr<IFilterGraph> pFG;
- if(SUCCEEDED(pFG.CoCreateInstance(CLSID_FilterGraph)))
+ if(SUCCEEDED(pFG.CoCreateInstance(CLSID_FilterGraph))) {
pFG->AddFilter(pBF, L"");
+ }
ps.DoModal();
}
@@ -465,19 +462,18 @@ void CPPageExternalFilters::OnLbnDblclkFilter() void CPPageExternalFilters::OnAddMajorType()
{
FilterOverride* f = GetCurFilter();
- if(!f) return;
+ if(!f) {
+ return;
+ }
CAtlArray<GUID> guids;
SetupMajorTypes(guids);
CSelectMediaType dlg(guids, MEDIATYPE_NULL, this);
- if(dlg.DoModal() == IDOK)
- {
+ if(dlg.DoModal() == IDOK) {
POSITION pos = f->guids.GetHeadPosition();
- while(pos)
- {
- if(f->guids.GetNext(pos) == dlg.m_guid)
- {
+ while(pos) {
+ if(f->guids.GetNext(pos) == dlg.m_guid) {
AfxMessageBox(_T("Already on the list!"));
return;
}
@@ -502,13 +498,19 @@ void CPPageExternalFilters::OnAddMajorType() void CPPageExternalFilters::OnAddSubType()
{
FilterOverride* f = GetCurFilter();
- if(!f) return;
+ if(!f) {
+ return;
+ }
HTREEITEM node = m_tree.GetSelectedItem();
- if(!node) return;
+ if(!node) {
+ return;
+ }
HTREEITEM child = m_tree.GetChildItem(node);
- if(!child) return;
+ if(!child) {
+ return;
+ }
POSITION pos = (POSITION)m_tree.GetItemData(child);
GUID major = f->guids.GetAt(pos);
@@ -517,14 +519,11 @@ void CPPageExternalFilters::OnAddSubType() SetupSubTypes(guids);
CSelectMediaType dlg(guids, MEDIASUBTYPE_NULL, this);
- if(dlg.DoModal() == IDOK)
- {
- for(child = m_tree.GetChildItem(node); child; child = m_tree.GetNextSiblingItem(child))
- {
+ if(dlg.DoModal() == IDOK) {
+ for(child = m_tree.GetChildItem(node); child; child = m_tree.GetNextSiblingItem(child)) {
pos = (POSITION)m_tree.GetItemData(child);
f->guids.GetNext(pos);
- if(f->guids.GetAt(pos) == dlg.m_guid)
- {
+ if(f->guids.GetAt(pos) == dlg.m_guid) {
AfxMessageBox(_T("Already on the list!"));
return;
}
@@ -543,17 +542,16 @@ void CPPageExternalFilters::OnAddSubType() void CPPageExternalFilters::OnDeleteType()
{
- if(FilterOverride* f = GetCurFilter())
- {
+ if(FilterOverride* f = GetCurFilter()) {
HTREEITEM node = m_tree.GetSelectedItem();
- if(!node) return;
+ if(!node) {
+ return;
+ }
POSITION pos = (POSITION)m_tree.GetItemData(node);
- if(pos == NULL)
- {
- for(HTREEITEM child = m_tree.GetChildItem(node); child; child = m_tree.GetNextSiblingItem(child))
- {
+ if(pos == NULL) {
+ for(HTREEITEM child = m_tree.GetChildItem(node); child; child = m_tree.GetNextSiblingItem(child)) {
pos = (POSITION)m_tree.GetItemData(child);
POSITION pos1 = pos;
@@ -566,9 +564,7 @@ void CPPageExternalFilters::OnDeleteType() }
m_tree.DeleteItem(node);
- }
- else
- {
+ } else {
HTREEITEM parent = m_tree.GetParentItem(node);
POSITION pos1 = pos;
@@ -578,14 +574,11 @@ void CPPageExternalFilters::OnDeleteType() m_tree.DeleteItem(node);
- if(!m_tree.ItemHasChildren(parent))
- {
+ if(!m_tree.ItemHasChildren(parent)) {
f->guids.SetAt(pos2, GUID_NULL);
node = m_tree.InsertItem(GetMediaTypeName(GUID_NULL), parent);
m_tree.SetItemData(node, (DWORD_PTR)pos1);
- }
- else
- {
+ } else {
f->guids.RemoveAt(pos1);
f->guids.RemoveAt(pos2);
}
@@ -595,8 +588,7 @@ void CPPageExternalFilters::OnDeleteType() void CPPageExternalFilters::OnResetTypes()
{
- if(FilterOverride* f = GetCurFilter())
- {
+ if(FilterOverride* f = GetCurFilter()) {
f->guids.RemoveAll();
f->guids.AddTailList(&f->backup);
@@ -607,9 +599,10 @@ void CPPageExternalFilters::OnResetTypes() void CPPageExternalFilters::OnLbnSelchangeList1()
{
- if(FilterOverride* f = GetCurFilter())
- {
- if(m_pLastSelFilter == f) return;
+ if(FilterOverride* f = GetCurFilter()) {
+ if(m_pLastSelFilter == f) {
+ return;
+ }
m_pLastSelFilter = f;
m_iLoadType = f->iLoadType;
@@ -618,14 +611,14 @@ void CPPageExternalFilters::OnLbnSelchangeList1() HTREEITEM dummy_item = m_tree.InsertItem(_T(""), 0,0, NULL, TVI_FIRST);
if(dummy_item)
- for(HTREEITEM item = m_tree.GetNextVisibleItem(dummy_item); item; item = m_tree.GetNextVisibleItem(dummy_item))
+ for(HTREEITEM item = m_tree.GetNextVisibleItem(dummy_item); item; item = m_tree.GetNextVisibleItem(dummy_item)) {
m_tree.DeleteItem(item);
+ }
CMapStringToPtr map;
POSITION pos = f->guids.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
POSITION tmp = pos;
CString major = GetMediaTypeName(f->guids.GetNext(pos));
CString sub = GetMediaTypeName(f->guids.GetNext(pos));
@@ -633,8 +626,11 @@ void CPPageExternalFilters::OnLbnSelchangeList1() HTREEITEM node = NULL;
void* val = NULL;
- if(map.Lookup(major, val)) node = (HTREEITEM)val;
- else map[major] = node = m_tree.InsertItem(major);
+ if(map.Lookup(major, val)) {
+ node = (HTREEITEM)val;
+ } else {
+ map[major] = node = m_tree.InsertItem(major);
+ }
m_tree.SetItemData(node, NULL);
node = m_tree.InsertItem(sub, node);
@@ -643,13 +639,12 @@ void CPPageExternalFilters::OnLbnSelchangeList1() m_tree.DeleteItem(dummy_item);
- for(HTREEITEM item = m_tree.GetFirstVisibleItem(); item; item = m_tree.GetNextVisibleItem(item))
+ for(HTREEITEM item = m_tree.GetFirstVisibleItem(); item; item = m_tree.GetNextVisibleItem(item)) {
m_tree.Expand(item, TVE_EXPAND);
+ }
m_tree.EnsureVisible(m_tree.GetRootItem());
- }
- else
- {
+ } else {
m_pLastSelFilter = NULL;
m_iLoadType = FilterOverride::PREFERRED;
@@ -663,18 +658,19 @@ void CPPageExternalFilters::OnLbnSelchangeList1() void CPPageExternalFilters::OnBnClickedRadio()
{
UpdateData();
- if(FilterOverride* f = GetCurFilter())
+ if(FilterOverride* f = GetCurFilter()) {
f->iLoadType = m_iLoadType;
+ }
}
void CPPageExternalFilters::OnEnChangeEdit1()
{
UpdateData();
- if(FilterOverride* f = GetCurFilter())
- {
+ if(FilterOverride* f = GetCurFilter()) {
DWORD dw;
- if(m_dwMerit.GetDWORD(dw))
+ if(m_dwMerit.GetDWORD(dw)) {
f->dwMerit = dw;
+ }
}
}
@@ -682,23 +678,27 @@ void CPPageExternalFilters::OnNMDblclkTree2(NMHDR *pNMHDR, LRESULT *pResult) {
*pResult = 0;
- if(FilterOverride* f = GetCurFilter())
- {
+ if(FilterOverride* f = GetCurFilter()) {
HTREEITEM node = m_tree.GetSelectedItem();
- if(!node) return;
+ if(!node) {
+ return;
+ }
POSITION pos = (POSITION)m_tree.GetItemData(node);
- if(!pos) return;
+ if(!pos) {
+ return;
+ }
f->guids.GetNext(pos);
- if(!pos) return;
+ if(!pos) {
+ return;
+ }
CAtlArray<GUID> guids;
SetupSubTypes(guids);
CSelectMediaType dlg(guids, f->guids.GetAt(pos), this);
- if(dlg.DoModal() == IDOK)
- {
+ if(dlg.DoModal() == IDOK) {
f->guids.SetAt(pos, dlg.m_guid);
m_tree.SetItemText(node, GetMediaTypeName(dlg.m_guid));
}
@@ -710,25 +710,21 @@ void CPPageExternalFilters::OnDropFiles(HDROP hDropInfo) SetActiveWindow();
UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
- for(UINT iFile = 0; iFile < nFiles; iFile++)
- {
+ for(UINT iFile = 0; iFile < nFiles; iFile++) {
TCHAR szFileName[_MAX_PATH];
::DragQueryFile(hDropInfo, iFile, szFileName, _MAX_PATH);
CFilterMapper2 fm2(false);
fm2.Register(szFileName);
- while(!fm2.m_filters.IsEmpty())
- {
- if(FilterOverride* f = fm2.m_filters.RemoveHead())
- {
+ while(!fm2.m_filters.IsEmpty()) {
+ if(FilterOverride* f = fm2.m_filters.RemoveHead()) {
CAutoPtr<FilterOverride> p(f);
int i = m_filters.AddString(f->name);
m_filters.SetItemDataPtr(i, m_pFilters.AddTail(p));
m_filters.SetCheck(i, 1);
- if(fm2.m_filters.IsEmpty())
- {
+ if(fm2.m_filters.IsEmpty()) {
m_filters.SetCurSel(i);
OnLbnSelchangeList1();
}
diff --git a/src/apps/mplayerc/PPageExternalFilters.h b/src/apps/mplayerc/PPageExternalFilters.h index a627e6111..acd7ee551 100644 --- a/src/apps/mplayerc/PPageExternalFilters.h +++ b/src/apps/mplayerc/PPageExternalFilters.h @@ -49,7 +49,7 @@ public: CPPageExternalFilters();
virtual ~CPPageExternalFilters();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGEEXTERNALFILTERS };
CCheckListBox m_filters;
diff --git a/src/apps/mplayerc/PPageFileInfoClip.cpp b/src/apps/mplayerc/PPageFileInfoClip.cpp index 62b60d520..357e88a84 100644 --- a/src/apps/mplayerc/PPageFileInfoClip.cpp +++ b/src/apps/mplayerc/PPageFileInfoClip.cpp @@ -47,7 +47,9 @@ CPPageFileInfoClip::CPPageFileInfoClip(CString fn, IFilterGraph* pFG) CPPageFileInfoClip::~CPPageFileInfoClip()
{
- if(m_hIcon) DestroyIcon(m_hIcon);
+ if(m_hIcon) {
+ DestroyIcon(m_hIcon);
+ }
}
void CPPageFileInfoClip::DoDataExchange(CDataExchange* pDX)
@@ -73,17 +75,13 @@ BOOL CPPageFileInfoClip::OnInitDialog() {
__super::OnInitDialog();
- if(m_fn == _T(""))
- {
- BeginEnumFilters(m_pFG, pEF, pBF)
- {
+ if(m_fn == _T("")) {
+ BeginEnumFilters(m_pFG, pEF, pBF) {
CComQIPtr<IFileSourceFilter> pFSF = pBF;
- if(pFSF)
- {
+ if(pFSF) {
LPOLESTR pFN = NULL;
AM_MEDIA_TYPE mt;
- if(SUCCEEDED(pFSF->GetCurFile(&pFN, &mt)) && pFN && *pFN)
- {
+ if(SUCCEEDED(pFSF->GetCurFile(&pFN, &mt)) && pFN && *pFN) {
m_fn = CStringW(pFN);
CoTaskMemFree(pFN);
}
@@ -94,52 +92,48 @@ BOOL CPPageFileInfoClip::OnInitDialog() }
m_hIcon = LoadIcon(m_fn, false);
- if(m_hIcon)
+ if(m_hIcon) {
m_icon.SetIcon(m_hIcon);
+ }
m_fn.TrimRight('/');
int i = max(m_fn.ReverseFind('\\'), m_fn.ReverseFind('/'));
- if(i >= 0 && i < m_fn.GetLength()-1)
- {
+ if(i >= 0 && i < m_fn.GetLength()-1) {
m_location = m_fn.Left(i);
m_fn = m_fn.Mid(i+1);
- if(m_location.GetLength() == 2 && m_location[1] == ':')
+ if(m_location.GetLength() == 2 && m_location[1] == ':') {
m_location += '\\';
+ }
}
bool fEmpty = true;
- BeginEnumFilters(m_pFG, pEF, pBF)
- {
- if(CComQIPtr<IAMMediaContent, &IID_IAMMediaContent> pAMMC = pBF)
- {
+ BeginEnumFilters(m_pFG, pEF, pBF) {
+ if(CComQIPtr<IAMMediaContent, &IID_IAMMediaContent> pAMMC = pBF) {
CComBSTR bstr;
- if(SUCCEEDED(pAMMC->get_Title(&bstr)) && wcslen(bstr.m_str) > 0)
- {
+ if(SUCCEEDED(pAMMC->get_Title(&bstr)) && wcslen(bstr.m_str) > 0) {
m_clip = bstr.m_str;
fEmpty = false;
}
- if(SUCCEEDED(pAMMC->get_AuthorName(&bstr)) && wcslen(bstr.m_str) > 0)
- {
+ if(SUCCEEDED(pAMMC->get_AuthorName(&bstr)) && wcslen(bstr.m_str) > 0) {
m_author = bstr.m_str;
fEmpty = false;
}
- if(SUCCEEDED(pAMMC->get_Copyright(&bstr)) && wcslen(bstr.m_str) > 0)
- {
+ if(SUCCEEDED(pAMMC->get_Copyright(&bstr)) && wcslen(bstr.m_str) > 0) {
m_copyright = bstr.m_str;
fEmpty = false;
}
- if(SUCCEEDED(pAMMC->get_Rating(&bstr)) && wcslen(bstr.m_str) > 0)
- {
+ if(SUCCEEDED(pAMMC->get_Rating(&bstr)) && wcslen(bstr.m_str) > 0) {
m_rating = bstr.m_str;
fEmpty = false;
}
- if(SUCCEEDED(pAMMC->get_Description(&bstr)) && wcslen(bstr.m_str) > 0)
- {
+ if(SUCCEEDED(pAMMC->get_Description(&bstr)) && wcslen(bstr.m_str) > 0) {
m_desc.SetWindowText(CString(bstr.m_str));
fEmpty = false;
}
- if(!fEmpty) break;
+ if(!fEmpty) {
+ break;
+ }
}
}
EndEnumFilters;
diff --git a/src/apps/mplayerc/PPageFileInfoClip.h b/src/apps/mplayerc/PPageFileInfoClip.h index d28c5ff85..29e01cdb4 100644 --- a/src/apps/mplayerc/PPageFileInfoClip.h +++ b/src/apps/mplayerc/PPageFileInfoClip.h @@ -40,7 +40,7 @@ public: CPPageFileInfoClip(CString fn, IFilterGraph* pFG);
virtual ~CPPageFileInfoClip();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_FILEPROPCLIP };
CStatic m_icon;
diff --git a/src/apps/mplayerc/PPageFileInfoDetails.cpp b/src/apps/mplayerc/PPageFileInfoDetails.cpp index 9b339daeb..d99a8314a 100644 --- a/src/apps/mplayerc/PPageFileInfoDetails.cpp +++ b/src/apps/mplayerc/PPageFileInfoDetails.cpp @@ -50,7 +50,9 @@ CPPageFileInfoDetails::CPPageFileInfoDetails(CString fn, IFilterGraph* pFG, ISub CPPageFileInfoDetails::~CPPageFileInfoDetails()
{
- if(m_hIcon) DestroyIcon(m_hIcon);
+ if(m_hIcon) {
+ DestroyIcon(m_hIcon);
+ }
}
void CPPageFileInfoDetails::DoDataExchange(CDataExchange* pDX)
@@ -73,11 +75,11 @@ END_MESSAGE_MAP() static bool GetProperty(IFilterGraph* pFG, LPCOLESTR propName, VARIANT* vt)
{
- BeginEnumFilters(pFG, pEF, pBF)
- {
+ BeginEnumFilters(pFG, pEF, pBF) {
if(CComQIPtr<IPropertyBag> pPB = pBF)
- if(SUCCEEDED(pPB->Read(propName, vt, NULL)))
+ if(SUCCEEDED(pPB->Read(propName, vt, NULL))) {
return true;
+ }
}
EndEnumFilters;
@@ -101,17 +103,13 @@ BOOL CPPageFileInfoDetails::OnInitDialog() {
__super::OnInitDialog();
- if(m_fn == _T(""))
- {
- BeginEnumFilters(m_pFG, pEF, pBF)
- {
+ if(m_fn == _T("")) {
+ BeginEnumFilters(m_pFG, pEF, pBF) {
CComQIPtr<IFileSourceFilter> pFSF = pBF;
- if(pFSF)
- {
+ if(pFSF) {
LPOLESTR pFN = NULL;
AM_MEDIA_TYPE mt;
- if(SUCCEEDED(pFSF->GetCurFile(&pFN, &mt)) && pFN && *pFN)
- {
+ if(SUCCEEDED(pFSF->GetCurFile(&pFN, &mt)) && pFN && *pFN) {
m_fn = CStringW(pFN);
CoTaskMemFree(pFN);
}
@@ -122,21 +120,22 @@ BOOL CPPageFileInfoDetails::OnInitDialog() }
CString ext = m_fn.Left(m_fn.Find(_T("://"))+1).TrimRight(':');
- if(ext.IsEmpty() || !ext.CompareNoCase(_T("file")))
+ if(ext.IsEmpty() || !ext.CompareNoCase(_T("file"))) {
ext = _T(".") + m_fn.Mid(m_fn.ReverseFind('.')+1);
+ }
m_hIcon = LoadIcon(m_fn, false);
- if(m_hIcon)
+ if(m_hIcon) {
m_icon.SetIcon(m_hIcon);
+ }
- if(!LoadType(ext, m_type))
+ if(!LoadType(ext, m_type)) {
m_type = ResStr(IDS_AG_NOT_KNOWN);
+ }
CComVariant vt;
- if(::GetProperty(m_pFG, L"CurFile.TimeCreated", &vt))
- {
- if(V_VT(&vt) == VT_UI8)
- {
+ if(::GetProperty(m_pFG, L"CurFile.TimeCreated", &vt)) {
+ if(V_VT(&vt) == VT_UI8) {
ULARGE_INTEGER uli;
uli.QuadPart = V_UI8(&vt);
@@ -150,28 +149,31 @@ BOOL CPPageFileInfoDetails::OnInitDialog() WIN32_FIND_DATA wfd;
HANDLE hFind = FindFirstFile(m_fn, &wfd);
- if(hFind != INVALID_HANDLE_VALUE)
- {
+ if(hFind != INVALID_HANDLE_VALUE) {
FindClose(hFind);
__int64 size = (__int64(wfd.nFileSizeHigh)<<32)|wfd.nFileSizeLow;
__int64 shortsize = size;
CString measure = _T("B");
- if(shortsize > 10240) shortsize /= 1024, measure = _T("KB");
- if(shortsize > 10240) shortsize /= 1024, measure = _T("MB");
- if(shortsize > 10240) shortsize /= 1024, measure = _T("GB");
+ if(shortsize > 10240) {
+ shortsize /= 1024, measure = _T("KB");
+ }
+ if(shortsize > 10240) {
+ shortsize /= 1024, measure = _T("MB");
+ }
+ if(shortsize > 10240) {
+ shortsize /= 1024, measure = _T("GB");
+ }
m_size.Format(_T("%I64d%s (%I64d bytes)"), shortsize, measure, size);
- if(m_created.IsEmpty())
- {
+ if(m_created.IsEmpty()) {
m_created = FormatDateTime(wfd.ftCreationTime);
}
}
REFERENCE_TIME rtDur = 0;
CComQIPtr<IMediaSeeking> pMS = m_pFG;
- if(pMS && SUCCEEDED(pMS->GetDuration(&rtDur)) && rtDur > 0)
- {
+ if(pMS && SUCCEEDED(pMS->GetDuration(&rtDur)) && rtDur > 0) {
m_time.Format(_T("%02d:%02d:%02d"),
int(rtDur/10000000/60/60),
int((rtDur/10000000/60)%60),
@@ -180,44 +182,32 @@ BOOL CPPageFileInfoDetails::OnInitDialog() CSize wh(0, 0), arxy(0, 0);
- if(m_pCAP)
- {
+ if(m_pCAP) {
wh = m_pCAP->GetVideoSize(false);
arxy = m_pCAP->GetVideoSize(true);
- }
- else
- {
- if(CComQIPtr<IBasicVideo> pBV = m_pFG)
- {
- if(SUCCEEDED(pBV->GetVideoSize(&wh.cx, &wh.cy)))
- {
- if(CComQIPtr<IBasicVideo2> pBV2 = m_pFG)
+ } else {
+ if(CComQIPtr<IBasicVideo> pBV = m_pFG) {
+ if(SUCCEEDED(pBV->GetVideoSize(&wh.cx, &wh.cy))) {
+ if(CComQIPtr<IBasicVideo2> pBV2 = m_pFG) {
pBV2->GetPreferredAspectRatio(&arxy.cx, &arxy.cy);
- }
- else
- {
+ }
+ } else {
wh.SetSize(0, 0);
}
}
- if(wh.cx == 0 && wh.cy == 0)
- {
- BeginEnumFilters(m_pFG, pEF, pBF)
- {
- if(CComQIPtr<IBasicVideo> pBV = pBF)
- {
+ if(wh.cx == 0 && wh.cy == 0) {
+ BeginEnumFilters(m_pFG, pEF, pBF) {
+ if(CComQIPtr<IBasicVideo> pBV = pBF) {
pBV->GetVideoSize(&wh.cx, &wh.cy);
- if(CComQIPtr<IBasicVideo2> pBV2 = pBF)
+ if(CComQIPtr<IBasicVideo2> pBV2 = pBF) {
pBV2->GetPreferredAspectRatio(&arxy.cx, &arxy.cy);
+ }
break;
- }
- else if(CComQIPtr<IVMRWindowlessControl> pWC = pBF)
- {
+ } else if(CComQIPtr<IVMRWindowlessControl> pWC = pBF) {
pWC->GetNativeVideoSize(&wh.cx, &wh.cy, &arxy.cx, &arxy.cy);
break;
- }
- else if(CComQIPtr<IVMRWindowlessControl9> pWC = pBF)
- {
+ } else if(CComQIPtr<IVMRWindowlessControl9> pWC = pBF) {
pWC->GetNativeVideoSize(&wh.cx, &wh.cy, &arxy.cx, &arxy.cy);
break;
}
@@ -226,15 +216,15 @@ BOOL CPPageFileInfoDetails::OnInitDialog() }
}
- if(wh.cx > 0 && wh.cy > 0)
- {
+ if(wh.cx > 0 && wh.cy > 0) {
m_res.Format(_T("%d x %d"), wh.cx, wh.cy);
int lnko = LNKO(arxy.cx, arxy.cy);
- if(lnko > 1) arxy.cx /= lnko, arxy.cy /= lnko;
+ if(lnko > 1) {
+ arxy.cx /= lnko, arxy.cy /= lnko;
+ }
- if(arxy.cx > 0 && arxy.cy > 0 && arxy.cx*wh.cy != arxy.cy*wh.cx)
- {
+ if(arxy.cx > 0 && arxy.cy > 0 && arxy.cx*wh.cy != arxy.cy*wh.cx) {
CString ar;
ar.Format(_T(" (AR %d:%d)"), arxy.cx, arxy.cy);
m_res += ar;
@@ -260,43 +250,38 @@ void CPPageFileInfoDetails::InitEncoding() {
CAtlList<CString> sl;
- BeginEnumFilters(m_pFG, pEF, pBF)
- {
+ BeginEnumFilters(m_pFG, pEF, pBF) {
CComPtr<IBaseFilter> pUSBF = GetUpStreamFilter(pBF);
- if(GetCLSID(pBF) == CLSID_NetShowSource)
- {
+ if(GetCLSID(pBF) == CLSID_NetShowSource) {
continue;
- }
- else if(GetCLSID(pUSBF) != CLSID_NetShowSource)
- {
- if(IPin* pPin = GetFirstPin(pBF, PINDIR_INPUT))
- {
+ } else if(GetCLSID(pUSBF) != CLSID_NetShowSource) {
+ if(IPin* pPin = GetFirstPin(pBF, PINDIR_INPUT)) {
CMediaType mt;
- if(FAILED(pPin->ConnectionMediaType(&mt)) || mt.majortype != MEDIATYPE_Stream)
+ if(FAILED(pPin->ConnectionMediaType(&mt)) || mt.majortype != MEDIATYPE_Stream) {
continue;
+ }
}
- if(IPin* pPin = GetFirstPin(pBF, PINDIR_OUTPUT))
- {
+ if(IPin* pPin = GetFirstPin(pBF, PINDIR_OUTPUT)) {
CMediaType mt;
- if(SUCCEEDED(pPin->ConnectionMediaType(&mt)) && mt.majortype == MEDIATYPE_Stream)
+ if(SUCCEEDED(pPin->ConnectionMediaType(&mt)) && mt.majortype == MEDIATYPE_Stream) {
continue;
+ }
}
}
- BeginEnumPins(pBF, pEP, pPin)
- {
+ BeginEnumPins(pBF, pEP, pPin) {
CMediaTypeEx mt;
PIN_DIRECTION dir;
if(FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_OUTPUT
- || FAILED(pPin->ConnectionMediaType(&mt)))
+ || FAILED(pPin->ConnectionMediaType(&mt))) {
continue;
+ }
CString str = mt.ToString();
- if(!str.IsEmpty())
- {
+ if(!str.IsEmpty()) {
sl.AddTail(mt.ToString() + CString(L" [" + GetPinName(pPin) + L"]"));
}
}
diff --git a/src/apps/mplayerc/PPageFileInfoDetails.h b/src/apps/mplayerc/PPageFileInfoDetails.h index 0b9b419e8..672043620 100644 --- a/src/apps/mplayerc/PPageFileInfoDetails.h +++ b/src/apps/mplayerc/PPageFileInfoDetails.h @@ -45,7 +45,7 @@ public: CPPageFileInfoDetails(CString fn, IFilterGraph* pFG, ISubPicAllocatorPresenter* pCAP);
virtual ~CPPageFileInfoDetails();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_FILEPROPDETAILS };
CStatic m_icon;
diff --git a/src/apps/mplayerc/PPageFileInfoRes.cpp b/src/apps/mplayerc/PPageFileInfoRes.cpp index 9b01bc030..773924b5d 100644 --- a/src/apps/mplayerc/PPageFileInfoRes.cpp +++ b/src/apps/mplayerc/PPageFileInfoRes.cpp @@ -39,7 +39,9 @@ CPPageFileInfoRes::CPPageFileInfoRes(CString fn, IFilterGraph* pFG) CPPageFileInfoRes::~CPPageFileInfoRes()
{
- if(m_hIcon) DestroyIcon(m_hIcon);
+ if(m_hIcon) {
+ DestroyIcon(m_hIcon);
+ }
}
void CPPageFileInfoRes::DoDataExchange(CDataExchange* pDX)
@@ -63,31 +65,29 @@ BOOL CPPageFileInfoRes::OnInitDialog() __super::OnInitDialog();
m_hIcon = LoadIcon(m_fn, false);
- if(m_hIcon)
+ if(m_hIcon) {
m_icon.SetIcon(m_hIcon);
+ }
m_fn.TrimRight('/');
int i = max(m_fn.ReverseFind('\\'), m_fn.ReverseFind('/'));
- if(i >= 0 && i < m_fn.GetLength()-1)
+ if(i >= 0 && i < m_fn.GetLength()-1) {
m_fn = m_fn.Mid(i+1);
+ }
m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
m_list.InsertColumn(0, _T("Name"), LVCFMT_LEFT, 187);
m_list.InsertColumn(1, _T("Mime Type"), LVCFMT_LEFT, 127);
- BeginEnumFilters(m_pFG, pEF, pBF)
- {
+ BeginEnumFilters(m_pFG, pEF, pBF) {
if(CComQIPtr<IDSMResourceBag> pRB = pBF)
- if(pRB && pRB->ResGetCount() > 0)
- {
- for(DWORD i = 0; i < pRB->ResGetCount(); i++)
- {
+ if(pRB && pRB->ResGetCount() > 0) {
+ for(DWORD i = 0; i < pRB->ResGetCount(); i++) {
CComBSTR name, desc, mime;
BYTE* pData = NULL;
DWORD len = 0;
- if(SUCCEEDED(pRB->ResGet(i, &name, &desc, &mime, &pData, &len, NULL)))
- {
+ if(SUCCEEDED(pRB->ResGet(i, &name, &desc, &mime, &pData, &len, NULL))) {
CDSMResource r;
r.name = name;
r.desc = desc;
@@ -114,17 +114,17 @@ BOOL CPPageFileInfoRes::OnInitDialog() void CPPageFileInfoRes::OnSaveAs()
{
int i = m_list.GetSelectionMark();
- if(i < 0) return;
+ if(i < 0) {
+ return;
+ }
CDSMResource& r = m_res.GetAt((POSITION)m_list.GetItemData(i));
CFileDialog fd(FALSE, NULL, CString(r.name),
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
_T("All files|*.*||"), this, 0);
- if(fd.DoModal() == IDOK)
- {
- if(FILE* f = _tfopen(fd.GetPathName(), _T("wb")))
- {
+ if(fd.DoModal() == IDOK) {
+ if(FILE* f = _tfopen(fd.GetPathName(), _T("wb"))) {
fwrite(r.data.GetData(), 1, r.data.GetCount(), f);
fclose(f);
}
@@ -139,7 +139,9 @@ void CPPageFileInfoRes::OnUpdateSaveAs(CCmdUI* pCmdUI) void CPPageFileInfoRes::OnNMDblclkList1(NMHDR *pNMHDR, LRESULT *pResult)
{
int i = m_list.GetSelectionMark();
- if(i < 0) return;
+ if(i < 0) {
+ return;
+ }
CDSMResource& r = m_res.GetAt((POSITION)m_list.GetItemData(i));
diff --git a/src/apps/mplayerc/PPageFileInfoRes.h b/src/apps/mplayerc/PPageFileInfoRes.h index 5882ff16d..f8f9bd4df 100644 --- a/src/apps/mplayerc/PPageFileInfoRes.h +++ b/src/apps/mplayerc/PPageFileInfoRes.h @@ -44,7 +44,7 @@ public: CPPageFileInfoRes(CString fn, IFilterGraph* pFG); // standard constructor
virtual ~CPPageFileInfoRes();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_FILEPROPRES };
CStatic m_icon;
diff --git a/src/apps/mplayerc/PPageFileInfoSheet.cpp b/src/apps/mplayerc/PPageFileInfoSheet.cpp index 655e04196..54179b7f1 100644 --- a/src/apps/mplayerc/PPageFileInfoSheet.cpp +++ b/src/apps/mplayerc/PPageFileInfoSheet.cpp @@ -41,11 +41,9 @@ CPPageFileInfoSheet::CPPageFileInfoSheet(CString fn, CMainFrame* pMainFrame, CWn AddPage(&m_clip);
AddPage(&m_details);
- BeginEnumFilters(pMainFrame->pGB, pEF, pBF)
- {
+ BeginEnumFilters(pMainFrame->pGB, pEF, pBF) {
if(CComQIPtr<IDSMResourceBag> pRB = pBF)
- if(pRB && pRB->ResGetCount() > 0)
- {
+ if(pRB && pRB->ResGetCount() > 0) {
AddPage(&m_res);
break;
}
@@ -75,8 +73,9 @@ BOOL CPPageFileInfoSheet::OnInitDialog() m_fn.TrimRight('/');
int i = max(m_fn.ReverseFind('\\'), m_fn.ReverseFind('/'));
- if(i >= 0 && i < m_fn.GetLength()-1)
+ if(i >= 0 && i < m_fn.GetLength()-1) {
m_fn = m_fn.Mid(i+1);
+ }
m_fn = m_fn+_T(".MediaInfo.txt");
GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);
@@ -103,12 +102,10 @@ void CPPageFileInfoSheet::OnSaveAs() OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
_T("Text Files (*.txt)|*.txt|All Files (*.*)|*.*||"), NULL);
- if (filedlg.DoModal() == IDOK) // user has chosen a file, so
- {
+ if (filedlg.DoModal() == IDOK) { // user has chosen a file, so
_TCHAR bom = (_TCHAR)0xFEFF;
CFile mFile;
- if(mFile.Open(filedlg.GetPathName(), CFile::modeCreate | CFile::modeWrite))
- {
+ if(mFile.Open(filedlg.GetPathName(), CFile::modeCreate | CFile::modeWrite)) {
mFile.Write(&bom, sizeof(_TCHAR));
mFile.Write(LPCTSTR(m_mi.MI_Text), m_mi.MI_Text.GetLength()*sizeof(_TCHAR));
mFile.Close();
diff --git a/src/apps/mplayerc/PPageFileMediaInfo.cpp b/src/apps/mplayerc/PPageFileMediaInfo.cpp index 89621ab55..285109d20 100644 --- a/src/apps/mplayerc/PPageFileMediaInfo.cpp +++ b/src/apps/mplayerc/PPageFileMediaInfo.cpp @@ -84,20 +84,20 @@ BOOL CPPageFileMediaInfo::OnInitDialog() {
__super::OnInitDialog();
- if(!m_pCFont) m_pCFont = DNew CFont;
- if(!m_pCFont) return TRUE;
+ if(!m_pCFont) {
+ m_pCFont = DNew CFont;
+ }
+ if(!m_pCFont) {
+ return TRUE;
+ }
- if(m_fn == _T(""))
- {
- BeginEnumFilters(m_pFG, pEF, pBF)
- {
+ if(m_fn == _T("")) {
+ BeginEnumFilters(m_pFG, pEF, pBF) {
CComQIPtr<IFileSourceFilter> pFSF = pBF;
- if(pFSF)
- {
+ if(pFSF) {
LPOLESTR pFN = NULL;
AM_MEDIA_TYPE mt;
- if(SUCCEEDED(pFSF->GetCurFile(&pFN, &mt)) && pFN && *pFN)
- {
+ if(SUCCEEDED(pFSF->GetCurFile(&pFN, &mt)) && pFN && *pFN) {
m_fn = CStringW(pFN);
CoTaskMemFree(pFN);
}
@@ -119,7 +119,9 @@ BOOL CPPageFileMediaInfo::OnInitDialog() MI.Option(_T("Complete"));
MI_Text = MI.Inform().c_str();
MI.Close();
- if(!MI_Text.Find(_T("Unable to load"))) MI_Text = _T("");
+ if(!MI_Text.Find(_T("Unable to load"))) {
+ MI_Text = _T("");
+ }
LOGFONT lf;
memset( &lf, 0, sizeof(lf) );
@@ -140,10 +142,11 @@ BOOL CPPageFileMediaInfo::OnInitDialog() void CPPageFileMediaInfo::OnShowWindow(BOOL bShow, UINT nStatus)
{
__super::OnShowWindow(bShow, nStatus);
- if(bShow)
+ if(bShow) {
GetParent()->GetDlgItem(IDC_BUTTON_MI)->ShowWindow(SW_SHOW);
- else
+ } else {
GetParent()->GetDlgItem(IDC_BUTTON_MI)->ShowWindow(SW_HIDE);
+ }
}
#ifndef USE_MEDIAINFO_STATIC
diff --git a/src/apps/mplayerc/PPageFileMediaInfo.h b/src/apps/mplayerc/PPageFileMediaInfo.h index 24d522006..b1a63bdb6 100644 --- a/src/apps/mplayerc/PPageFileMediaInfo.h +++ b/src/apps/mplayerc/PPageFileMediaInfo.h @@ -37,7 +37,7 @@ public: CPPageFileMediaInfo(CString fn, IFilterGraph* pFG);
virtual ~CPPageFileMediaInfo();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_FILEMEDIAINFO };
CEdit m_mediainfo;
diff --git a/src/apps/mplayerc/PPageFormats.cpp b/src/apps/mplayerc/PPageFormats.cpp index bf8afc85d..e4cb26116 100644 --- a/src/apps/mplayerc/PPageFormats.cpp +++ b/src/apps/mplayerc/PPageFormats.cpp @@ -51,8 +51,7 @@ CPPageFormats::CPPageFormats() , m_fRtspFileExtFirst(FALSE)
, m_bInsufficientPrivileges(false)
{
- if (m_pAAR == NULL)
- {
+ if (m_pAAR == NULL) {
// Default manager (requiered at least Vista)
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
NULL,
@@ -110,8 +109,9 @@ CString CPPageFormats::GetEnqueueCommand() CString path;
TCHAR buff[_MAX_PATH];
- if(::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH) == 0)
+ if(::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH) == 0) {
return _T("");
+ }
path = buff;
return _T("\"") + path + _T("\" /add \"%1\"");
@@ -122,8 +122,9 @@ CString CPPageFormats::GetOpenCommand() CString path;
TCHAR buff[_MAX_PATH];
- if(::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH) == 0)
+ if(::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH) == 0) {
return _T("");
+ }
path = buff;
return _T("\"") + path + _T("\" \"%1\"");
@@ -135,8 +136,7 @@ bool CPPageFormats::IsRegistered(CString ext) BOOL bIsDefault = FALSE;
CString strProgID = _T("mplayerc") + ext;
- if (m_pAAR == NULL)
- {
+ if (m_pAAR == NULL) {
// Default manager (requires at least Vista)
hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
NULL,
@@ -145,54 +145,51 @@ bool CPPageFormats::IsRegistered(CString ext) (void**)&m_pAAR);
}
- if (m_pAAR)
- {
+ if (m_pAAR) {
// The Vista way
hr = m_pAAR->QueryAppIsDefault(ext, AT_FILEEXTENSION, AL_EFFECTIVE, g_strRegisteredAppName, &bIsDefault);
- }
- else
- {
+ } else {
// The 2000/XP way
CRegKey key;
TCHAR buff[256];
ULONG len = sizeof(buff)/sizeof(buff[0]);
memset(buff, 0, sizeof(buff));
- if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext))
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext)) {
return false;
+ }
- if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len) && !CString(buff).Trim().IsEmpty())
+ if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len) && !CString(buff).Trim().IsEmpty()) {
return false;
+ }
bIsDefault = (buff == strProgID);
}
- if(!f_setContextFiles)
- {
+ if(!f_setContextFiles) {
CRegKey key;
TCHAR buff[_MAX_PATH];
ULONG len = sizeof(buff)/sizeof(buff[0]);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open"), KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open"), KEY_READ)) {
CString strCommand = ResStr(IDS_OPEN_WITH_MPC);
- if (ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len))
+ if (ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len)) {
f_setContextFiles = (strCommand.CompareNoCase(CString(buff)) == 0);
+ }
}
}
// Check if association is for this instance of MPC
- if (bIsDefault)
- {
+ if (bIsDefault) {
CRegKey key;
TCHAR buff[_MAX_PATH];
ULONG len = sizeof(buff)/sizeof(buff[0]);
bIsDefault = FALSE;
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open\\command"), KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open\\command"), KEY_READ)) {
CString strCommand = GetOpenCommand();
- if (ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len))
+ if (ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len)) {
bIsDefault = (strCommand.CompareNoCase(CString(buff)) == 0);
+ }
}
}
@@ -214,8 +211,9 @@ int FileExists(const TCHAR *fileName) {
DWORD fileAttr;
fileAttr = ::GetFileAttributes(fileName);
- if (0xFFFFFFFF == fileAttr)
+ if (0xFFFFFFFF == fileAttr) {
return false;
+ }
return true;
}
@@ -226,11 +224,9 @@ int GetIconIndex(CString ext) int iconindex = -1;
GetIconIndexFunc _getIconIndexFunc;
HINSTANCE mpciconlib = LoadLibrary(_T("mpciconlib.dll"));
- if(mpciconlib)
- {
+ if(mpciconlib) {
_getIconIndexFunc = (GetIconIndexFunc) GetProcAddress(mpciconlib, "get_icon_index");
- if(_getIconIndexFunc)
- {
+ if(_getIconIndexFunc) {
iconindex = _getIconIndexFunc(ext);
}
FreeLibrary(mpciconlib);
@@ -245,10 +241,10 @@ bool CPPageFormats::RegisterExt(CString ext, CString strLabel, bool fRegister) bool bSetValue;
CString strProgID = _T("mplayerc") + ext;
- if(!fRegister)
- {
- if(fRegister != IsRegistered(ext))
+ if(!fRegister) {
+ if(fRegister != IsRegistered(ext)) {
SetFileAssociation (ext, strProgID, fRegister);
+ }
key.Attach(HKEY_CLASSES_ROOT);
key.RecurseDeleteKey(strProgID);
return(true);
@@ -257,91 +253,108 @@ bool CPPageFormats::RegisterExt(CString ext, CString strLabel, bool fRegister) bSetValue = fRegister || (ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open\\command"), KEY_READ));
// Create ProgID for this file type
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID)) return(false);
- if(ERROR_SUCCESS != key.SetStringValue(NULL, strLabel)) return(false);
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID)) {
+ return(false);
+ }
+ if(ERROR_SUCCESS != key.SetStringValue(NULL, strLabel)) {
+ return(false);
+ }
// Add to playlist option
- if(f_setContextFiles)
- {
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\enqueue"))) return(false);
- if(ERROR_SUCCESS != key.SetStringValue(NULL, ResStr(IDS_ADD_TO_PLAYLIST))) return(false);
+ if(f_setContextFiles) {
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\enqueue"))) {
+ return(false);
+ }
+ if(ERROR_SUCCESS != key.SetStringValue(NULL, ResStr(IDS_ADD_TO_PLAYLIST))) {
+ return(false);
+ }
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\enqueue\\command"))) return(false);
- if(bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, GetEnqueueCommand()))) return(false);
- }
- else
- {
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\enqueue\\command"))) {
+ return(false);
+ }
+ if(bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, GetEnqueueCommand()))) {
+ return(false);
+ }
+ } else {
key.Close();
key.Attach(HKEY_CLASSES_ROOT);
key.RecurseDeleteKey(strProgID + _T("\\shell\\enqueue"));
}
// Play option
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open"))) return(false);
- if(f_setContextFiles)
- {
- if(ERROR_SUCCESS != key.SetStringValue(NULL, ResStr(IDS_OPEN_WITH_MPC))) return(false);
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open"))) {
+ return(false);
}
- else
- {
- if(ERROR_SUCCESS != key.SetStringValue(NULL, _T(""))) return(false);
+ if(f_setContextFiles) {
+ if(ERROR_SUCCESS != key.SetStringValue(NULL, ResStr(IDS_OPEN_WITH_MPC))) {
+ return(false);
+ }
+ } else {
+ if(ERROR_SUCCESS != key.SetStringValue(NULL, _T(""))) {
+ return(false);
+ }
}
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open\\command"))) return(false);
- if(bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, GetOpenCommand()))) return(false);
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open\\command"))) {
+ return(false);
+ }
+ if(bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, GetOpenCommand()))) {
+ return(false);
+ }
- if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE, g_strRegisteredKey + _T("\\FileAssociations"))) return(false);
- if(ERROR_SUCCESS != key.SetStringValue(ext, strProgID)) return(false);
+ if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE, g_strRegisteredKey + _T("\\FileAssociations"))) {
+ return(false);
+ }
+ if(ERROR_SUCCESS != key.SetStringValue(ext, strProgID)) {
+ return(false);
+ }
- if(f_setAssociatedWithIcon)
- {
+ if(f_setAssociatedWithIcon) {
CString AppIcon = _T("");
TCHAR buff[_MAX_PATH];
CString mpciconlib = GetProgramDir() + _T("\\mpciconlib.dll");
- if(FileExists(mpciconlib))
- {
+ if(FileExists(mpciconlib)) {
int icon_index = GetIconIndex(ext);
CString m_typeicon = mpciconlib;
/* icon_index value -1 means no icon was found in the iconlib for the file extension */
- if((icon_index >= 0) && ExtractIcon(AfxGetApp()->m_hInstance,(LPCWSTR)m_typeicon, icon_index))
- {
+ if((icon_index >= 0) && ExtractIcon(AfxGetApp()->m_hInstance,(LPCWSTR)m_typeicon, icon_index)) {
m_typeicon = "\""+mpciconlib+"\"";
AppIcon.Format(_T("%s,%d"), m_typeicon, icon_index);
}
}
/* no icon was found for the file extension, so use MPC's icon */
- if((AppIcon.IsEmpty()) && (::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH)))
- {
+ if((AppIcon.IsEmpty()) && (::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH))) {
AppIcon = buff;
AppIcon = "\""+AppIcon+"\"";
AppIcon += _T(",0");
}
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\DefaultIcon"))) return(false);
- if(bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, AppIcon))) return(false);
- }
- else
- {
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\DefaultIcon"))) {
+ return(false);
+ }
+ if(bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, AppIcon))) {
+ return(false);
+ }
+ } else {
key.Attach(HKEY_CLASSES_ROOT);
key.RecurseDeleteKey(strProgID + _T("\\DefaultIcon"));
}
- if(fRegister != IsRegistered(ext))
+ if(fRegister != IsRegistered(ext)) {
SetFileAssociation (ext, strProgID, fRegister);
+ }
return(true);
}
-static struct
-{
+static struct {
LPCSTR verb, cmd;
UINT action;
-} handlers[] =
-{
+} handlers[] = {
{"VideoFiles", " %1", IDS_AUTOPLAY_PLAYVIDEO},
{"MusicFiles", " %1", IDS_AUTOPLAY_PLAYMUSIC},
{"CDAudio", " %1 /cd", IDS_AUTOPLAY_PLAYAUDIOCD},
@@ -351,26 +364,35 @@ static struct void CPPageFormats::AddAutoPlayToRegistry(autoplay_t ap, bool fRegister)
{
TCHAR buff[_MAX_PATH];
- if(::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH) == 0) return;
+ if(::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH) == 0) {
+ return;
+ }
CString exe = buff;
int i = (int)ap;
- if(i < 0 || i >= countof(handlers)) return;
+ if(i < 0 || i >= countof(handlers)) {
+ return;
+ }
CRegKey key;
- if(fRegister)
- {
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, _T("MediaPlayerClassic.Autorun"))) return;
+ if(fRegister) {
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, _T("MediaPlayerClassic.Autorun"))) {
+ return;
+ }
key.Close();
if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT,
- CString(CStringA("MediaPlayerClassic.Autorun\\Shell\\Play") + handlers[i].verb + "\\Command"))) return;
+ CString(CStringA("MediaPlayerClassic.Autorun\\Shell\\Play") + handlers[i].verb + "\\Command"))) {
+ return;
+ }
key.SetStringValue(NULL, _T("\"") + exe + _T("\"") + handlers[i].cmd);
key.Close();
if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE,
- CString(CStringA("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\Handlers\\MPCPlay") + handlers[i].verb + "OnArrival"))) return;
+ CString(CStringA("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\Handlers\\MPCPlay") + handlers[i].verb + "OnArrival"))) {
+ return;
+ }
key.SetStringValue(_T("Action"), ResStr(handlers[i].action));
key.SetStringValue(_T("Provider"), _T("Media Player Classic"));
key.SetStringValue(_T("InvokeProgID"), _T("MediaPlayerClassic.Autorun"));
@@ -379,14 +401,16 @@ void CPPageFormats::AddAutoPlayToRegistry(autoplay_t ap, bool fRegister) key.Close();
if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE,
- CString(CStringA("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\EventHandlers\\Play") + handlers[i].verb + "OnArrival"))) return;
+ CString(CStringA("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\EventHandlers\\Play") + handlers[i].verb + "OnArrival"))) {
+ return;
+ }
key.SetStringValue(CString(CStringA("MPCPlay") + handlers[i].verb + "OnArrival"), _T(""));
key.Close();
- }
- else
- {
+ } else {
if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE,
- CString(CStringA("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\EventHandlers\\Play") + handlers[i].verb + "OnArrival"))) return;
+ CString(CStringA("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\EventHandlers\\Play") + handlers[i].verb + "OnArrival"))) {
+ return;
+ }
key.DeleteValue(CString(CStringA("MPCPlay") + handlers[i].verb + "OnArrival"));
key.Close();
}
@@ -396,31 +420,43 @@ bool CPPageFormats::IsAutoPlayRegistered(autoplay_t ap) {
ULONG len;
TCHAR buff[_MAX_PATH];
- if(::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH) == 0) return(false);
+ if(::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH) == 0) {
+ return(false);
+ }
CString exe = buff;
int i = (int)ap;
- if(i < 0 || i >= countof(handlers)) return(false);
+ if(i < 0 || i >= countof(handlers)) {
+ return(false);
+ }
CRegKey key;
if(ERROR_SUCCESS != key.Open(HKEY_LOCAL_MACHINE,
CString(CStringA("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\EventHandlers\\Play") + handlers[i].verb + "OnArrival"),
- KEY_READ)) return(false);
+ KEY_READ)) {
+ return(false);
+ }
len = countof(buff);
if(ERROR_SUCCESS != key.QueryStringValue(
CString(_T("MPCPlay")) + handlers[i].verb + _T("OnArrival"),
- buff, &len)) return(false);
+ buff, &len)) {
+ return(false);
+ }
key.Close();
if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT,
CString(CStringA("MediaPlayerClassic.Autorun\\Shell\\Play") + handlers[i].verb + "\\Command"),
- KEY_READ)) return(false);
+ KEY_READ)) {
+ return(false);
+ }
len = countof(buff);
- if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len))
+ if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len)) {
return(false);
- if(_tcsnicmp(_T("\"") + exe, buff, exe.GetLength() + 1))
+ }
+ if(_tcsnicmp(_T("\"") + exe, buff, exe.GetLength() + 1)) {
return(false);
+ }
key.Close();
return(true);
@@ -428,7 +464,9 @@ bool CPPageFormats::IsAutoPlayRegistered(autoplay_t ap) void CPPageFormats::SetListItemState(int nItem)
{
- if(nItem < 0) return;
+ if(nItem < 0) {
+ return;
+ }
CString str = AfxGetAppSettings().m_Formats[(int)m_list.GetItemData(nItem)].GetExtsWithPeriod();
@@ -438,10 +476,13 @@ void CPPageFormats::SetListItemState(int nItem) int cnt = 0;
POSITION pos = exts.GetHeadPosition();
- while(pos) if(IsRegistered(exts.GetNext(pos))) cnt++;
+ while(pos) if(IsRegistered(exts.GetNext(pos))) {
+ cnt++;
+ }
- if (cnt != 0)
+ if (cnt != 0) {
cnt = (cnt == (int)exts.GetCount() ? 1 : 2);
+ }
SetChecked(nItem, cnt);
}
@@ -477,8 +518,7 @@ BOOL CPPageFormats::OnInitDialog() CMediaFormats& mf = AfxGetAppSettings().m_Formats;
mf.UpdateData(FALSE);
- for(int i = 0; i < (int)mf.GetCount(); i++)
- {
+ for(int i = 0; i < (int)mf.GetCount(); i++) {
CString label;
label.Format (_T("%s (%s)"), mf[i].GetLabel(), mf[i].GetExts());
@@ -492,7 +532,7 @@ BOOL CPPageFormats::OnInitDialog() e == ShockWave ? _T("ShockWave") : _T("-"));
}
-// m_list.SetColumnWidth(COL_CATEGORY, LVSCW_AUTOSIZE);
+ // m_list.SetColumnWidth(COL_CATEGORY, LVSCW_AUTOSIZE);
m_list.SetColumnWidth(COL_ENGINE, LVSCW_AUTOSIZE_USEHEADER);
m_list.SetSelectionMark(0);
@@ -509,8 +549,7 @@ BOOL CPPageFormats::OnInitDialog() f_setContextFiles = 0;
- for(int i = 0; i < m_list.GetItemCount(); i++)
- {
+ for(int i = 0; i < m_list.GetItemCount(); i++) {
SetListItemState(i);
}
m_fContextFiles.SetCheck(f_setContextFiles);
@@ -523,8 +562,7 @@ BOOL CPPageFormats::OnInitDialog() CreateToolTip();
- if (IsVistaOrAbove() && !IsUserAnAdmin())
- {
+ if (IsVistaOrAbove() && !IsUserAnAdmin()) {
GetDlgItem(IDC_BUTTON1)->ShowWindow (SW_HIDE);
GetDlgItem(IDC_BUTTON3)->ShowWindow (SW_HIDE);
GetDlgItem(IDC_BUTTON4)->ShowWindow (SW_HIDE);
@@ -542,9 +580,9 @@ BOOL CPPageFormats::OnInitDialog() GetDlgItem(IDC_BUTTON5)->SendMessage (BCM_SETSHIELD, 0, 1);
m_bInsufficientPrivileges = true;
- }
- else
+ } else {
GetDlgItem(IDC_BUTTON5)->ShowWindow (SW_HIDE);
+ }
CRegKey key;
@@ -552,11 +590,11 @@ BOOL CPPageFormats::OnInitDialog() ULONG len = sizeof(buff)/sizeof(buff[0]);
int fContextDir = 0;
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Directory\\shell\\mplayerc.play\\command"), KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Directory\\shell\\mplayerc.play\\command"), KEY_READ)) {
CString strCommand = GetOpenCommand();
- if (ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len))
+ if (ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len)) {
fContextDir = (strCommand.CompareNoCase(CString(buff)) == 0);
+ }
}
m_fContextDir.SetCheck(fContextDir);
m_fAssociatedWithIcons.SetCheck(s.fAssociatedWithIcons);
@@ -575,8 +613,7 @@ BOOL CPPageFormats::SetFileAssociation(CString strExt, CString strProgID, bool f ULONG len = sizeof(buff)/sizeof(buff[0]);
memset(buff, 0, sizeof(buff));
- if (m_pAAR == NULL)
- {
+ if (m_pAAR == NULL) {
// Default manager (requiered at least Vista)
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
NULL,
@@ -586,21 +623,21 @@ BOOL CPPageFormats::SetFileAssociation(CString strExt, CString strProgID, bool f UNUSED_ALWAYS(hr);
}
- if (m_pAAR)
- {
+ if (m_pAAR) {
// The Vista way
CString strNewApp;
- if (fRegister)
- {
+ if (fRegister) {
// Create non existing file type
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strExt)) return(false);
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strExt)) {
+ return(false);
+ }
WCHAR* pszCurrentAssociation;
// Save current application associated
- if (SUCCEEDED (m_pAAR->QueryCurrentDefault (strExt, AT_FILEEXTENSION, AL_EFFECTIVE, &pszCurrentAssociation)))
- {
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID))
+ if (SUCCEEDED (m_pAAR->QueryCurrentDefault (strExt, AT_FILEEXTENSION, AL_EFFECTIVE, &pszCurrentAssociation))) {
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID)) {
return(false);
+ }
key.SetStringValue(g_strOldAssoc, pszCurrentAssociation);
@@ -620,34 +657,35 @@ BOOL CPPageFormats::SetFileAssociation(CString strExt, CString strProgID, bool f CoTaskMemFree (pszCurrentAssociation);
}
strNewApp = g_strRegisteredAppName;
- }
- else
- {
- if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, strProgID))
+ } else {
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, strProgID)) {
return(false);
+ }
- if(ERROR_SUCCESS == key.QueryStringValue(g_strOldAssoc, buff, &len))
+ if(ERROR_SUCCESS == key.QueryStringValue(g_strOldAssoc, buff, &len)) {
strNewApp = buff;
+ }
// TODO : retrieve registered app name from previous association (or find Bill function for that...)
}
hr = m_pAAR->SetAppAsDefault(strNewApp, strExt, AT_FILEEXTENSION);
- }
- else
- {
+ } else {
// The 2000/XP way
- if (fRegister)
- {
+ if (fRegister) {
// Set new association
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strExt))
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strExt)) {
return(false);
+ }
len = sizeof(buff)/sizeof(buff[0]);
memset(buff, 0, sizeof(buff));
- if(ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && !CString(buff).Trim().IsEmpty())
+ if(ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && !CString(buff).Trim().IsEmpty()) {
extoldreg = buff;
- if(ERROR_SUCCESS != key.SetStringValue(NULL, strProgID)) return(false);
+ }
+ if(ERROR_SUCCESS != key.SetStringValue(NULL, strProgID)) {
+ return(false);
+ }
// Get current icon for file type
/*
@@ -664,28 +702,30 @@ BOOL CPPageFormats::SetFileAssociation(CString strExt, CString strProgID, bool f */
// Save old association
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID))
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID)) {
return(false);
+ }
key.SetStringValue(g_strOldAssoc, extoldreg);
/*
if (!extOldIcon.IsEmpty() && (ERROR_SUCCESS == key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\DefaultIcon"))))
key.SetStringValue (NULL, extOldIcon);
*/
- }
- else
- {
+ } else {
// Get previous association
len = sizeof(buff)/sizeof(buff[0]);
memset(buff, 0, sizeof(buff));
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID))
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID)) {
return(false);
- if(ERROR_SUCCESS == key.QueryStringValue(g_strOldAssoc, buff, &len) && !CString(buff).Trim().IsEmpty())
+ }
+ if(ERROR_SUCCESS == key.QueryStringValue(g_strOldAssoc, buff, &len) && !CString(buff).Trim().IsEmpty()) {
extoldreg = buff;
+ }
// Set previous association
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strExt))
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strExt)) {
return(false);
+ }
key.SetStringValue(NULL, extoldreg);
}
@@ -701,9 +741,10 @@ BOOL CPPageFormats::OnApply() {
int i = m_list.GetSelectionMark();
- if(i >= 0) i = (int)m_list.GetItemData(i);
- if(i >= 0)
- {
+ if(i >= 0) {
+ i = (int)m_list.GetItemData(i);
+ }
+ if(i >= 0) {
CMediaFormats& mf = AfxGetAppSettings().m_Formats;
mf[i].SetExts(m_exts);
m_exts = mf[i].GetExtsWithPeriod();
@@ -716,24 +757,22 @@ BOOL CPPageFormats::OnApply() CString AppIcon = _T("");
TCHAR buff[_MAX_PATH];
- if(::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH))
- {
+ if(::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH)) {
AppIcon = buff;
AppIcon = "\""+AppIcon+"\"";
AppIcon += _T(",0");
}
- if (m_pAAR)
- {
+ if (m_pAAR) {
// Register MPC for the windows "Default application" manager
CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\RegisteredApplications")))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\RegisteredApplications"))) {
key.SetStringValue(_T("Media Player Classic"), g_strRegisteredKey);
- if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE, g_strRegisteredKey))
+ if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE, g_strRegisteredKey)) {
return(false);
+ }
// ==>> TODO icon !!!
key.SetStringValue(_T("ApplicationDescription"), ResStr(IDS_APP_DESCRIPTION), REG_EXPAND_SZ);
@@ -745,44 +784,39 @@ BOOL CPPageFormats::OnApply() f_setContextFiles = m_fContextFiles.GetCheck();
f_setAssociatedWithIcon = m_fAssociatedWithIcons.GetCheck();
- for(int i = 0; i < m_list.GetItemCount(); i++)
- {
+ for(int i = 0; i < m_list.GetItemCount(); i++) {
int iChecked = GetChecked(i);
- if(iChecked == 2) continue;
+ if(iChecked == 2) {
+ continue;
+ }
CAtlList<CString> exts;
Explode(mf[(int)m_list.GetItemData(i)].GetExtsWithPeriod(), exts, ' ');
POSITION pos = exts.GetHeadPosition();
- while(pos)
+ while(pos) {
RegisterExt(exts.GetNext(pos), mf[(int)m_list.GetItemData(i)].GetLabel(), !!iChecked);
+ }
}
CRegKey key;
- if(m_fContextDir.GetCheck())
- {
- if(ERROR_SUCCESS == key.Create(HKEY_CLASSES_ROOT, _T("Directory\\shell\\mplayerc.enqueue")))
- {
+ if(m_fContextDir.GetCheck()) {
+ if(ERROR_SUCCESS == key.Create(HKEY_CLASSES_ROOT, _T("Directory\\shell\\mplayerc.enqueue"))) {
key.SetStringValue(NULL, ResStr(IDS_ADD_TO_PLAYLIST));
}
- if(ERROR_SUCCESS == key.Create(HKEY_CLASSES_ROOT, _T("Directory\\shell\\mplayerc.enqueue\\command")))
- {
+ if(ERROR_SUCCESS == key.Create(HKEY_CLASSES_ROOT, _T("Directory\\shell\\mplayerc.enqueue\\command"))) {
key.SetStringValue(NULL, GetEnqueueCommand());
}
- if(ERROR_SUCCESS == key.Create(HKEY_CLASSES_ROOT, _T("Directory\\shell\\mplayerc.play")))
- {
+ if(ERROR_SUCCESS == key.Create(HKEY_CLASSES_ROOT, _T("Directory\\shell\\mplayerc.play"))) {
key.SetStringValue(NULL, ResStr(IDS_OPEN_WITH_MPC));
}
- if(ERROR_SUCCESS == key.Create(HKEY_CLASSES_ROOT, _T("Directory\\shell\\mplayerc.play\\command")))
- {
+ if(ERROR_SUCCESS == key.Create(HKEY_CLASSES_ROOT, _T("Directory\\shell\\mplayerc.play\\command"))) {
key.SetStringValue(NULL, GetOpenCommand());
}
- }
- else
- {
+ } else {
key.Attach(HKEY_CLASSES_ROOT);
key.RecurseDeleteKey(_T("Directory\\shell\\mplayerc.enqueue"));
key.RecurseDeleteKey(_T("Directory\\shell\\mplayerc.play"));
@@ -810,16 +844,13 @@ void CPPageFormats::OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult) {
LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
- if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem == COL_CATEGORY)
- {
+ if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem == COL_CATEGORY) {
CRect r;
m_list.GetItemRect(lpnmlv->iItem, r, LVIR_ICON);
- if(r.PtInRect(lpnmlv->ptAction))
- {
- if (m_bInsufficientPrivileges)
+ if(r.PtInRect(lpnmlv->ptAction)) {
+ if (m_bInsufficientPrivileges) {
MessageBox (ResStr (IDS_CANNOT_CHANGE_FORMAT));
- else
- {
+ } else {
SetChecked(lpnmlv->iItem, (GetChecked(lpnmlv->iItem)&1) == 0 ? 1 : 0);
SetModified();
}
@@ -834,8 +865,7 @@ void CPPageFormats::OnLvnItemchangedList1(NMHDR *pNMHDR, LRESULT *pResult) LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
if(pNMLV->iItem >= 0 && pNMLV->iSubItem == COL_CATEGORY
- && (pNMLV->uChanged&LVIF_STATE) && (pNMLV->uNewState&LVIS_SELECTED))
- {
+ && (pNMLV->uChanged&LVIF_STATE) && (pNMLV->uNewState&LVIS_SELECTED)) {
m_exts = AfxGetAppSettings().m_Formats[(int)m_list.GetItemData(pNMLV->iItem)].GetExtsWithPeriod();
UpdateData(FALSE);
}
@@ -850,11 +880,11 @@ void CPPageFormats::OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = FALSE;
- if(pItem->iItem < 0)
+ if(pItem->iItem < 0) {
return;
+ }
- if(pItem->iSubItem == COL_ENGINE)
- {
+ if(pItem->iSubItem == COL_ENGINE) {
*pResult = TRUE;
}
}
@@ -866,16 +896,16 @@ void CPPageFormats::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = FALSE;
- if(pItem->iItem < 0)
+ if(pItem->iItem < 0) {
return;
+ }
CMediaFormatCategory& mfc = AfxGetAppSettings().m_Formats[m_list.GetItemData(pItem->iItem)];
CAtlList<CString> sl;
int nSel = -1;
- if(pItem->iSubItem == COL_ENGINE)
- {
+ if(pItem->iSubItem == COL_ENGINE) {
sl.AddTail(_T("DirectShow"));
sl.AddTail(_T("RealMedia"));
sl.AddTail(_T("QuickTime"));
@@ -896,29 +926,30 @@ void CPPageFormats::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = FALSE;
- if(!m_list.m_fInPlaceDirty)
+ if(!m_list.m_fInPlaceDirty) {
return;
+ }
- if(pItem->iItem < 0)
+ if(pItem->iItem < 0) {
return;
+ }
CMediaFormatCategory& mfc = AfxGetAppSettings().m_Formats[m_list.GetItemData(pItem->iItem)];
- if(pItem->iSubItem == COL_ENGINE && pItem->lParam >= 0)
- {
+ if(pItem->iSubItem == COL_ENGINE && pItem->lParam >= 0) {
mfc.SetEngineType((engine_t)pItem->lParam);
m_list.SetItemText(pItem->iItem, pItem->iSubItem, pItem->pszText);
*pResult = TRUE;
}
- if(*pResult)
+ if(*pResult) {
SetModified();
+ }
}
void CPPageFormats::OnBnClickedButton1()
{
- for(int i = 0, j = m_list.GetItemCount(); i < j; i++)
- {
+ for(int i = 0, j = m_list.GetItemCount(); i < j; i++) {
SetChecked(i, 1);
}
@@ -934,10 +965,8 @@ void CPPageFormats::OnBnClickedButton14() {
CMediaFormats& mf = AfxGetAppSettings().m_Formats;
- for(int i = 0, j = m_list.GetItemCount(); i < j; i++)
- {
- if(!mf[m_list.GetItemData(i)].GetLabel().CompareNoCase(ResStr(IDS_AG_PLAYLIST_FILE)))
- {
+ for(int i = 0, j = m_list.GetItemCount(); i < j; i++) {
+ if(!mf[m_list.GetItemData(i)].GetLabel().CompareNoCase(ResStr(IDS_AG_PLAYLIST_FILE))) {
SetChecked(i, 0);
continue;
}
@@ -956,8 +985,7 @@ void CPPageFormats::OnBnClickedButton13() {
CMediaFormats& mf = AfxGetAppSettings().m_Formats;
- for(int i = 0, j = m_list.GetItemCount(); i < j; i++)
- {
+ for(int i = 0, j = m_list.GetItemCount(); i < j; i++) {
SetChecked(i, mf[(int)m_list.GetItemData(i)].IsAudioOnly()?1:0);
}
@@ -979,14 +1007,17 @@ void CPPageFormats::OnBnVistaModify() AfxGetMyApp()->RunAsAdministrator (strApp, strCmd, true);
- for(int i = 0; i < m_list.GetItemCount(); i++)
+ for(int i = 0; i < m_list.GetItemCount(); i++) {
SetListItemState(i);
+ }
}
void CPPageFormats::OnBnClickedButton12()
{
int i = m_list.GetSelectionMark();
- if(i < 0) return;
+ if(i < 0) {
+ return;
+ }
i = (int)m_list.GetItemData(i);
CMediaFormats& mf = AfxGetAppSettings().m_Formats;
mf[i].RestoreDefaultExts();
@@ -1001,7 +1032,9 @@ void CPPageFormats::OnBnClickedButton11() {
UpdateData();
int i = m_list.GetSelectionMark();
- if(i < 0) return;
+ if(i < 0) {
+ return;
+ }
i = (int)m_list.GetItemData(i);
CMediaFormats& mf = AfxGetAppSettings().m_Formats;
mf[i].SetExts(m_exts);
@@ -1015,8 +1048,7 @@ void CPPageFormats::OnBnClickedButton11() void CPPageFormats::OnUpdateButtonDefault(CCmdUI* pCmdUI)
{
int i = m_list.GetSelectionMark();
- if(i < 0)
- {
+ if(i < 0) {
pCmdUI->Enable(FALSE);
return;
}
@@ -1033,8 +1065,7 @@ void CPPageFormats::OnUpdateButtonDefault(CCmdUI* pCmdUI) void CPPageFormats::OnUpdateButtonSet(CCmdUI* pCmdUI)
{
int i = m_list.GetSelectionMark();
- if(i < 0)
- {
+ if(i < 0) {
pCmdUI->Enable(FALSE);
return;
}
diff --git a/src/apps/mplayerc/PPageFormats.h b/src/apps/mplayerc/PPageFormats.h index 2e51b1302..10438a33c 100644 --- a/src/apps/mplayerc/PPageFormats.h +++ b/src/apps/mplayerc/PPageFormats.h @@ -69,7 +69,7 @@ public: int m_iRtspHandler;
BOOL m_fRtspFileExtFirst;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGEFORMATS };
protected:
diff --git a/src/apps/mplayerc/PPageFullscreen.cpp b/src/apps/mplayerc/PPageFullscreen.cpp index b74adf5b8..7f30215d3 100644 --- a/src/apps/mplayerc/PPageFullscreen.cpp +++ b/src/apps/mplayerc/PPageFullscreen.cpp @@ -110,18 +110,15 @@ BOOL CPPageFullscreen::OnInitDialog() m_iMonitorTypeCtrl.AddString(ResStr(IDS_FULLSCREENMONITOR_CURRENT));
m_MonitorDisplayNames.Add(_T("Current"));
- if(m_f_hmonitor == _T("Current"))
- {
+ if(m_f_hmonitor == _T("Current")) {
m_iMonitorType = m_iMonitorTypeCtrl.GetCount()-1;
}
- for ( int i = 0; i < monitors.GetCount(); i++ )
- {
+ for ( int i = 0; i < monitors.GetCount(); i++ ) {
monitor = monitors.GetMonitor( i );
monitor.GetName(str);
- if(monitor.IsMonitor())
- {
+ if(monitor.IsMonitor()) {
DISPLAY_DEVICE displayDevice;
ZeroMemory(&displayDevice, sizeof(displayDevice));
displayDevice.cb = sizeof(displayDevice);
@@ -130,19 +127,15 @@ BOOL CPPageFullscreen::OnInitDialog() m_iMonitorTypeCtrl.AddString(str+_T(" - ")+displayDevice.DeviceString);
m_MonitorDisplayNames.Add(str);
- if(m_f_hmonitor == str && m_iMonitorType == 0)
- {
+ if(m_f_hmonitor == str && m_iMonitorType == 0) {
m_iMonitorType = m_iMonitorTypeCtrl.GetCount()-1;
}
}
}
- if(m_iMonitorTypeCtrl.GetCount() > 2)
- {
+ if(m_iMonitorTypeCtrl.GetCount() > 2) {
GetDlgItem(IDC_COMBO1)->EnableWindow(TRUE);
- }
- else
- {
+ } else {
m_iMonitorType = 0;
GetDlgItem(IDC_COMBO1)->EnableWindow(FALSE);
}
@@ -167,20 +160,25 @@ BOOL CPPageFullscreen::OnApply() int iSel_29 = m_dispmode29d97combo.GetCurSel();
m_AutoChangeFullscrRes.bEnabled = !!m_fSetFullscreenRes;
- if (m_AutoChangeFullscrRes.bEnabled)
- {
- if(iSel_24 >= 0 && iSel_24 < m_dms.GetCount())
+ if (m_AutoChangeFullscrRes.bEnabled) {
+ if(iSel_24 >= 0 && iSel_24 < m_dms.GetCount()) {
m_AutoChangeFullscrRes.dmFullscreenRes24Hz = m_dms[m_dispmode24combo.GetCurSel()];
- if(iSel_25 >= 0 && iSel_25 < m_dms.GetCount())
+ }
+ if(iSel_25 >= 0 && iSel_25 < m_dms.GetCount()) {
m_AutoChangeFullscrRes.dmFullscreenRes25Hz = m_dms[m_dispmode25combo.GetCurSel()];
- if(iSel_30 >= 0 && iSel_30 < m_dms.GetCount())
+ }
+ if(iSel_30 >= 0 && iSel_30 < m_dms.GetCount()) {
m_AutoChangeFullscrRes.dmFullscreenRes30Hz = m_dms[m_dispmode30combo.GetCurSel()];
- if(iSel_Other >= 0 && iSel_Other < m_dms.GetCount())
+ }
+ if(iSel_Other >= 0 && iSel_Other < m_dms.GetCount()) {
m_AutoChangeFullscrRes.dmFullscreenResOther = m_dms[m_dispmodeOthercombo.GetCurSel()];
- if(iSel_23 >= 0 && iSel_23 < m_dms.GetCount())
+ }
+ if(iSel_23 >= 0 && iSel_23 < m_dms.GetCount()) {
m_AutoChangeFullscrRes.dmFullscreenRes23d976Hz = m_dms[m_dispmode23d976combo.GetCurSel()];
- if(iSel_29 >= 0 && iSel_29 < m_dms.GetCount())
+ }
+ if(iSel_29 >= 0 && iSel_29 < m_dms.GetCount()) {
m_AutoChangeFullscrRes.dmFullscreenRes29d97Hz = m_dms[m_dispmode29d97combo.GetCurSel()];
+ }
}
m_AutoChangeFullscrRes.bApplyDefault = m_fSetDefault;
s.AutoChangeFullscrRes = m_AutoChangeFullscrRes;
@@ -239,7 +237,9 @@ void CPPageFullscreen::OnUpdateFullScrCombo() {
CMonitors monitors;
m_f_hmonitor = m_MonitorDisplayNames[m_iMonitorTypeCtrl.GetCurSel()];
- if(AfxGetAppSettings().strFullScreenMonitor != m_f_hmonitor) m_AutoChangeFullscrRes.bEnabled = false;
+ if(AfxGetAppSettings().strFullScreenMonitor != m_f_hmonitor) {
+ m_AutoChangeFullscrRes.bEnabled = false;
+ }
ModesUpdate();
SetModified();
}
@@ -263,8 +263,7 @@ void CPPageFullscreen::ModesUpdate() dmtoset23 = m_AutoChangeFullscrRes.dmFullscreenRes23d976Hz,
dmtoset29 = m_AutoChangeFullscrRes.dmFullscreenRes29d97Hz;
- if(!m_AutoChangeFullscrRes.bEnabled)
- {
+ if(!m_AutoChangeFullscrRes.bEnabled) {
GetCurDispMode(dmtoset24, m_f_hmonitor);
dmtoset29 = dmtoset23 = dmtosetOther = dmtoset30 = dmtoset25 = dmtoset24;
}
@@ -278,20 +277,31 @@ void CPPageFullscreen::ModesUpdate() ComboBox_ResetContent(m_dispmode29d97combo);
m_dms.RemoveAll();
- for(int i = 0, j = 0, ModeExist = true; ; i++)
- {
+ for(int i = 0, j = 0, ModeExist = true; ; i++) {
ModeExist = GetDispMode(i, dm, m_f_hmonitor);
- if (!ModeExist) break;
- if(dm.bpp <= 8) continue;
+ if (!ModeExist) {
+ break;
+ }
+ if(dm.bpp <= 8) {
+ continue;
+ }
//skip doubles (check previous only)
if (j>0 && (dm.bpp == m_dms[j-1].bpp && dm.dmDisplayFlags == m_dms[j-1].dmDisplayFlags
&& dm.freq == m_dms[j-1].freq && dm.fValid == m_dms[j-1].fValid
- && dm.size == m_dms[j-1].size)) continue;
+ && dm.size == m_dms[j-1].size)) {
+ continue;
+ }
m_dms.Add(dm);
str.Format(_T("%dx%d %dbpp %d") + ResStr(IDS_HZ), dm.size.cx, dm.size.cy, dm.bpp, dm.freq);
- if (dm.dmDisplayFlags == DM_INTERLACED) str+=_T(" ")+ ResStr(IDS_INTERLACED);
- if (dm.freq == 23) str+=_T(" (23.976)");
- if (dm.freq == 59) str+=_T(" (NTSC)");
+ if (dm.dmDisplayFlags == DM_INTERLACED) {
+ str+=_T(" ")+ ResStr(IDS_INTERLACED);
+ }
+ if (dm.freq == 23) {
+ str+=_T(" (23.976)");
+ }
+ if (dm.freq == 59) {
+ str+=_T(" (NTSC)");
+ }
m_dispmode24combo.AddString(str);
m_dispmode25combo.AddString(str);
@@ -301,17 +311,29 @@ void CPPageFullscreen::ModesUpdate() m_dispmode29d97combo.AddString(str);
if(iSel_24 < 0 && dmtoset24.fValid && dm.size == dmtoset24.size
- && dm.bpp == dmtoset24.bpp && dm.freq == dmtoset24.freq) iSel_24 = j;
+ && dm.bpp == dmtoset24.bpp && dm.freq == dmtoset24.freq) {
+ iSel_24 = j;
+ }
if(iSel_25 < 0 && dmtoset25.fValid && dm.size == dmtoset25.size
- && dm.bpp == dmtoset25.bpp && dm.freq == dmtoset25.freq) iSel_25 = j;
+ && dm.bpp == dmtoset25.bpp && dm.freq == dmtoset25.freq) {
+ iSel_25 = j;
+ }
if(iSel_30 < 0 && dmtoset30.fValid && dm.size == dmtoset30.size
- && dm.bpp == dmtoset30.bpp && dm.freq == dmtoset30.freq) iSel_30 = j;
+ && dm.bpp == dmtoset30.bpp && dm.freq == dmtoset30.freq) {
+ iSel_30 = j;
+ }
if(iSel_Other < 0 && dmtosetOther.fValid && dm.size == dmtosetOther.size
- && dm.bpp == dmtosetOther.bpp && dm.freq == dmtosetOther.freq) iSel_Other = j;
+ && dm.bpp == dmtosetOther.bpp && dm.freq == dmtosetOther.freq) {
+ iSel_Other = j;
+ }
if(iSel_23 < 0 && dmtoset23.fValid && dm.size == dmtoset23.size
- && dm.bpp == dmtoset23.bpp && dm.freq == dmtoset23.freq) iSel_23 = j;
+ && dm.bpp == dmtoset23.bpp && dm.freq == dmtoset23.freq) {
+ iSel_23 = j;
+ }
if(iSel_29 < 0 && dmtoset29.fValid && dm.size == dmtoset29.size
- && dm.bpp == dmtoset29.bpp && dm.freq == dmtoset29.freq) iSel_29 = j;
+ && dm.bpp == dmtoset29.bpp && dm.freq == dmtoset29.freq) {
+ iSel_29 = j;
+ }
j++;
}
m_dispmode24combo.SetCurSel(iSel_24);
diff --git a/src/apps/mplayerc/PPageFullscreen.h b/src/apps/mplayerc/PPageFullscreen.h index 8edc45c9d..7710db0fa 100644 --- a/src/apps/mplayerc/PPageFullscreen.h +++ b/src/apps/mplayerc/PPageFullscreen.h @@ -31,7 +31,7 @@ class CPPageFullscreen : public CPPageBase {
DECLARE_DYNAMIC(CPPageFullscreen)
-// private:
+ // private:
CAtlArray<dispmode> m_dms;
CStringArray m_MonitorDisplayNames;
@@ -60,7 +60,7 @@ public: CSpinButtonCtrl m_nTimeOutCtrl;
BOOL m_fRestoreResAfterExit;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGEFULLSCREEN };
protected:
diff --git a/src/apps/mplayerc/PPageInternalFilters.cpp b/src/apps/mplayerc/PPageInternalFilters.cpp index e4efd4037..96bb29689 100644 --- a/src/apps/mplayerc/PPageInternalFilters.cpp +++ b/src/apps/mplayerc/PPageInternalFilters.cpp @@ -29,16 +29,14 @@ #include "internal_filter_config.h"
-static struct filter_t
-{
+static struct filter_t {
LPCTSTR label;
int type;
int flag;
UINT nHintID;
CUnknown* (WINAPI * CreateInstance)(LPUNKNOWN lpunk, HRESULT* phr);
}
-s_filters[] =
-{
+s_filters[] = {
#if INTERNAL_SOURCEFILTER_AVI
{_T("AVI"), SOURCE_FILTER, SRC_AVI, IDS_SRC_AVI, NULL},
#endif
@@ -204,7 +202,9 @@ INT_PTR CPPageInternalFiltersListBox::OnToolHitTest(CPoint point, TOOLINFO* pTI) {
BOOL b = FALSE;
int row = ItemFromPoint(point, b);
- if(row < 0) return -1;
+ if(row < 0) {
+ return -1;
+ }
CRect r;
GetItemRect(row, r);
@@ -227,7 +227,9 @@ BOOL CPPageInternalFiltersListBox::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESU TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
filter_t* f = (filter_t*)GetItemDataPtr(pNMHDR->idFrom);
- if(f->nHintID == 0) return FALSE;
+ if(f->nHintID == 0) {
+ return FALSE;
+ }
::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, (LPARAM)(INT)1000);
@@ -235,8 +237,9 @@ BOOL CPPageInternalFiltersListBox::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESU m_strTipTextW = CString(MAKEINTRESOURCE(f->nHintID));
- if(pNMHDR->code == TTN_NEEDTEXTW) //?possible check is not needed
+ if(pNMHDR->code == TTN_NEEDTEXTW) { //?possible check is not needed
pTTTW->lpszText = (LPWSTR)(LPCWSTR)m_strTipTextW;
+ }
*pResult = 0;
@@ -249,10 +252,8 @@ void CPPageInternalFiltersListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) CFont* pOldFont = NULL;
- if((lpDrawItemStruct->itemData != 0) && ((filter_t*)lpDrawItemStruct->itemData)->CreateInstance)
- {
- if(!(HFONT)m_bold)
- {
+ if((lpDrawItemStruct->itemData != 0) && ((filter_t*)lpDrawItemStruct->itemData)->CreateInstance) {
+ if(!(HFONT)m_bold) {
CFont* pFont = pDC->GetCurrentFont();
LOGFONT lf;
@@ -262,16 +263,14 @@ void CPPageInternalFiltersListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) m_bold.CreateFontIndirect(&lf);
}
- if((HFONT)m_bold)
- {
+ if((HFONT)m_bold) {
pOldFont = pDC->SelectObject(&m_bold);
}
}
__super::DrawItem(lpDrawItemStruct);
- if(pOldFont)
- {
+ if(pOldFont) {
pDC->SelectObject(pOldFont);
}
}
@@ -283,8 +282,7 @@ void CPPageInternalFiltersListBox::OnRButtonDown(UINT nFlags, CPoint point) CMenu m;
m.CreatePopupMenu();
- enum
- {
+ enum {
ENABLEALL=1,
DISABLEALL,
ENABLEFFDSHOW,
@@ -295,8 +293,7 @@ void CPPageInternalFiltersListBox::OnRButtonDown(UINT nFlags, CPoint point) m.AppendMenu(MF_STRING|MF_ENABLED, ENABLEALL, ResStr(IDS_ENABLE_ALL_FILTERS));
m.AppendMenu(MF_STRING|MF_ENABLED, DISABLEALL, ResStr(IDS_DISABLE_ALL_FILTERS));
- if (m_n == 1)
- {
+ if (m_n == 1) {
m.AppendMenu(MF_SEPARATOR);
m.AppendMenu(MF_STRING|MF_ENABLED, ENABLEFFDSHOW, ResStr(IDS_ENABLE_FFMPEG_FILTERS));
m.AppendMenu(MF_STRING|MF_ENABLED, DISABLEFFDSHOW, ResStr(IDS_DISABLE_FFMPEG_FILTERS));
@@ -310,52 +307,56 @@ void CPPageInternalFiltersListBox::OnRButtonDown(UINT nFlags, CPoint point) UINT id = m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this);
- if (id == 0)
+ if (id == 0) {
return;
+ }
int Index = 0;
- for(int i = 0; i < countof(s_filters); i++)
- {
- switch(s_filters[i].type)
- {
- case 0: // source filter
- if (m_n == 1)
- continue;
- break;
- case 1: // decoder
- case 2: // dxva decoder
- case 3: // ffmpeg decoder
- if (m_n == 0)
+ for(int i = 0; i < countof(s_filters); i++) {
+ switch(s_filters[i].type) {
+ case 0: // source filter
+ if (m_n == 1) {
+ continue;
+ }
+ break;
+ case 1: // decoder
+ case 2: // dxva decoder
+ case 3: // ffmpeg decoder
+ if (m_n == 0) {
+ continue;
+ }
+ break;
+ default:
continue;
- break;
- default:
- continue;
}
- switch(id)
- {
- case ENABLEALL:
- SetCheck(Index, TRUE);
- break;
- case DISABLEALL:
- SetCheck(Index, FALSE);
- break;
- case ENABLEFFDSHOW:
- if(s_filters[i].type == 3)
- SetCheck(Index, TRUE);
- break;
- case DISABLEFFDSHOW:
- if(s_filters[i].type == 3)
- SetCheck(Index, FALSE);
- break;
- case ENABLEDXVA:
- if(s_filters[i].type == 2)
+ switch(id) {
+ case ENABLEALL:
SetCheck(Index, TRUE);
- break;
- case DISABLEDXVA:
- if(s_filters[i].type == 2)
+ break;
+ case DISABLEALL:
SetCheck(Index, FALSE);
- break;
+ break;
+ case ENABLEFFDSHOW:
+ if(s_filters[i].type == 3) {
+ SetCheck(Index, TRUE);
+ }
+ break;
+ case DISABLEFFDSHOW:
+ if(s_filters[i].type == 3) {
+ SetCheck(Index, FALSE);
+ }
+ break;
+ case ENABLEDXVA:
+ if(s_filters[i].type == 2) {
+ SetCheck(Index, TRUE);
+ }
+ break;
+ case DISABLEDXVA:
+ if(s_filters[i].type == 2) {
+ SetCheck(Index, FALSE);
+ }
+ break;
}
Index++;
}
@@ -396,35 +397,32 @@ BOOL CPPageInternalFilters::OnInitDialog() AppSettings& s = AfxGetAppSettings();
- for(int i = 0; i < countof(s_filters)-1; i++)
- {
+ for(int i = 0; i < countof(s_filters)-1; i++) {
CCheckListBox* l;
bool checked;
- switch(s_filters[i].type)
- {
- case SOURCE_FILTER: // source filter
- l = &m_listSrc;
- checked = s.SrcFilters[s_filters[i].flag];
- break;
- case DECODER: // decoder
- l = &m_listTra;
- checked = s.TraFilters[s_filters[i].flag];
- break;
- case DXVA_DECODER: // dxva decoder
- l = &m_listTra;
- checked = s.DXVAFilters[s_filters[i].flag];
- break;
- case FFMPEG_DECODER: // ffmpeg decoder
- l = &m_listTra;
- checked = s.FFmpegFilters[s_filters[i].flag];
- break;
- default:
- l = NULL;
+ switch(s_filters[i].type) {
+ case SOURCE_FILTER: // source filter
+ l = &m_listSrc;
+ checked = s.SrcFilters[s_filters[i].flag];
+ break;
+ case DECODER: // decoder
+ l = &m_listTra;
+ checked = s.TraFilters[s_filters[i].flag];
+ break;
+ case DXVA_DECODER: // dxva decoder
+ l = &m_listTra;
+ checked = s.DXVAFilters[s_filters[i].flag];
+ break;
+ case FFMPEG_DECODER: // ffmpeg decoder
+ l = &m_listTra;
+ checked = s.FFmpegFilters[s_filters[i].flag];
+ break;
+ default:
+ l = NULL;
}
- if (l)
- {
+ if (l) {
int Index = l->AddString(s_filters[i].label);
l->SetCheck(Index, checked);
l->SetItemDataPtr(Index, &s_filters[i]);
@@ -444,26 +442,23 @@ BOOL CPPageInternalFilters::OnApply() AppSettings& s = AfxGetAppSettings();
CPPageInternalFiltersListBox* list = &m_listSrc;
- for (int l=0; l<2; l++)
- {
- for(int i = 0; i < list->GetCount(); i++)
- {
+ for (int l=0; l<2; l++) {
+ for(int i = 0; i < list->GetCount(); i++) {
filter_t* f = (filter_t*) list->GetItemDataPtr(i);
- switch(f->type)
- {
- case SOURCE_FILTER:
- s.SrcFilters[f->flag] = list->GetCheck(i);
- break;
- case DECODER:
- s.TraFilters[f->flag] = list->GetCheck(i);
- break;
- case DXVA_DECODER:
- s.DXVAFilters[f->flag] = list->GetCheck(i);
- break;
- case FFMPEG_DECODER:
- s.FFmpegFilters[f->flag] = list->GetCheck(i);
- break;
+ switch(f->type) {
+ case SOURCE_FILTER:
+ s.SrcFilters[f->flag] = list->GetCheck(i);
+ break;
+ case DECODER:
+ s.TraFilters[f->flag] = list->GetCheck(i);
+ break;
+ case DXVA_DECODER:
+ s.DXVAFilters[f->flag] = list->GetCheck(i);
+ break;
+ case FFMPEG_DECODER:
+ s.FFmpegFilters[f->flag] = list->GetCheck(i);
+ break;
}
}
list = &m_listTra;
@@ -475,21 +470,25 @@ BOOL CPPageInternalFilters::OnApply() void CPPageInternalFilters::ShowPPage(CPPageInternalFiltersListBox& l)
{
int i = l.GetCurSel();
- if(i < 0) return;
+ if(i < 0) {
+ return;
+ }
filter_t* f = (filter_t*)l.GetItemDataPtr(i);
- if(!f || !f->CreateInstance) return;
+ if(!f || !f->CreateInstance) {
+ return;
+ }
HRESULT hr;
CUnknown* pObj = f->CreateInstance(NULL, &hr);
- if(!pObj) return;
+ if(!pObj) {
+ return;
+ }
CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pObj;
- if(SUCCEEDED(hr))
- {
- if(CComQIPtr<ISpecifyPropertyPages> pSPP = pUnk)
- {
+ if(SUCCEEDED(hr)) {
+ if(CComQIPtr<ISpecifyPropertyPages> pSPP = pUnk) {
CComPropertySheet ps(ResStr(IDS_PROPSHEET_PROPERTIES), this);
ps.AddPages(pSPP);
ps.DoModal();
diff --git a/src/apps/mplayerc/PPageInternalFilters.h b/src/apps/mplayerc/PPageInternalFilters.h index abe3d54a0..429aa4057 100644 --- a/src/apps/mplayerc/PPageInternalFilters.h +++ b/src/apps/mplayerc/PPageInternalFilters.h @@ -59,7 +59,7 @@ public: CPPageInternalFilters();
virtual ~CPPageInternalFilters();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGEINTERNALFILTERS };
CPPageInternalFiltersListBox m_listSrc;
CPPageInternalFiltersListBox m_listTra;
diff --git a/src/apps/mplayerc/PPageLogo.cpp b/src/apps/mplayerc/PPageLogo.cpp index e8f03102c..e7821089d 100644 --- a/src/apps/mplayerc/PPageLogo.cpp +++ b/src/apps/mplayerc/PPageLogo.cpp @@ -78,17 +78,18 @@ BOOL CPPageLogo::OnInitDialog() UpdateData(FALSE);
m_logoidpos = m_logoids.GetHeadPosition();
- for(POSITION pos = m_logoids.GetHeadPosition(); pos; m_logoids.GetNext(pos))
- {
- if(m_logoids.GetAt(pos) == s.nLogoId)
- {
+ for(POSITION pos = m_logoids.GetHeadPosition(); pos; m_logoids.GetNext(pos)) {
+ if(m_logoids.GetAt(pos) == s.nLogoId) {
m_logoidpos = pos;
break;
}
}
- if(!m_intext) OnBnClickedRadio1();
- else OnBnClickedRadio2();
+ if(!m_intext) {
+ OnBnClickedRadio1();
+ } else {
+ OnBnClickedRadio2();
+ }
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
@@ -145,15 +146,16 @@ void CPPageLogo::OnDeltaposSpin1(NMHDR *pNMHDR, LRESULT *pResult) {
LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
- if(pNMUpDown->iDelta < 0)
- {
+ if(pNMUpDown->iDelta < 0) {
m_logoids.GetNext(m_logoidpos);
- if(!m_logoidpos) m_logoidpos = m_logoids.GetHeadPosition();
- }
- else
- {
+ if(!m_logoidpos) {
+ m_logoidpos = m_logoids.GetHeadPosition();
+ }
+ } else {
m_logoids.GetPrev(m_logoidpos);
- if(!m_logoidpos) m_logoidpos = m_logoids.GetTailPosition();
+ if(!m_logoidpos) {
+ m_logoidpos = m_logoids.GetTailPosition();
+ }
}
GetDataFromRes();
@@ -170,8 +172,7 @@ void CPPageLogo::OnBnClickedButton2() _T("Images (*.bmp;*.gif;*.jpg;*.png)|*.bmp;*.gif;*.jpg;*.png|All files (*.*)|*.*||"),
this, 0);
- if(dlg.DoModal() == IDOK)
- {
+ if(dlg.DoModal() == IDOK) {
m_logofn = dlg.GetPathName();
UpdateData(FALSE);
OnBnClickedRadio2();
@@ -184,10 +185,11 @@ void CPPageLogo::GetDataFromRes() m_logobm.Destroy();
UINT id = m_logoids.GetAt(m_logoidpos);
- if(IDF_LOGO0 != id)
- {
+ if(IDF_LOGO0 != id) {
m_logobm.LoadFromResource(id);
- if(!m_author.LoadString(id)) m_author = ResStr(IDS_LOGO_AUTHOR);
+ if(!m_author.LoadString(id)) {
+ m_author = ResStr(IDS_LOGO_AUTHOR);
+ }
}
m_logopreview.SetBitmap(m_logobm);
}
diff --git a/src/apps/mplayerc/PPageLogo.h b/src/apps/mplayerc/PPageLogo.h index 7dc37ece8..461be1a25 100644 --- a/src/apps/mplayerc/PPageLogo.h +++ b/src/apps/mplayerc/PPageLogo.h @@ -42,7 +42,7 @@ public: CPPageLogo();
virtual ~CPPageLogo();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGELOGO };
int m_intext;
CString m_logofn;
diff --git a/src/apps/mplayerc/PPageOutput.cpp b/src/apps/mplayerc/PPageOutput.cpp index b5548c0ef..be8da7d88 100644 --- a/src/apps/mplayerc/PPageOutput.cpp +++ b/src/apps/mplayerc/PPageOutput.cpp @@ -39,7 +39,7 @@ CPPageOutput::CPPageOutput() , m_iQTVideoRendererType(0)
, m_iAPSurfaceUsage(0)
, m_iAudioRendererType(0)
-// , m_fVMRSyncFix(FALSE)
+ // , m_fVMRSyncFix(FALSE)
, m_iDX9Resizer(0)
, m_fVMR9MixerMode(FALSE)
, m_fVMR9MixerYUV(FALSE)
@@ -62,11 +62,11 @@ void CPPageOutput::DoDataExchange(CDataExchange* pDX) DDX_Radio(pDX, IDC_DSSYSDEF, m_iDSVideoRendererType);
DDX_Radio(pDX, IDC_RMSYSDEF, m_iRMVideoRendererType);
DDX_Radio(pDX, IDC_QTSYSDEF, m_iQTVideoRendererType);
-// DDX_Radio(pDX, IDC_REGULARSURF, m_iAPSurfaceUsage);
+ // DDX_Radio(pDX, IDC_REGULARSURF, m_iAPSurfaceUsage);
DDX_CBIndex(pDX, IDC_DX_SURFACE, m_iAPSurfaceUsage);
DDX_CBIndex(pDX, IDC_COMBO1, m_iAudioRendererType);
DDX_Control(pDX, IDC_COMBO1, m_iAudioRendererTypeCtrl);
-// DDX_Check(pDX, IDC_CHECK1, m_fVMRSyncFix);
+ // DDX_Check(pDX, IDC_CHECK1, m_fVMRSyncFix);
DDX_CBIndex(pDX, IDC_DX9RESIZER_COMBO, m_iDX9Resizer);
DDX_Check(pDX, IDC_DSVMR9LOADMIXER, m_fVMR9MixerMode);
DDX_Check(pDX, IDC_DSVMR9YUVMIXER, m_fVMR9MixerYUV);
@@ -91,8 +91,7 @@ END_MESSAGE_MAP() void CPPageOutput::DisableRadioButton(UINT nID, UINT nDefID)
{
- if(IsDlgButtonChecked(nID))
- {
+ if(IsDlgButtonChecked(nID)) {
CheckDlgButton(nID, BST_UNCHECKED);
CheckDlgButton(nDefID, BST_CHECKED);
}
@@ -115,7 +114,7 @@ BOOL CPPageOutput::OnInitDialog() m_iRMVideoRendererType = s.iRMVideoRendererType;
m_iQTVideoRendererType = s.iQTVideoRendererType;
m_iAPSurfaceUsage = renderersSettings.iAPSurfaceUsage;
-// m_fVMRSyncFix = renderersSettings.fVMRSyncFix;
+ // m_fVMRSyncFix = renderersSettings.fVMRSyncFix;
m_iDX9Resizer = renderersSettings.iDX9Resizer;
m_fVMR9MixerMode = renderersSettings.fVMR9MixerMode;
m_fVMR9MixerYUV = renderersSettings.fVMR9MixerYUV;
@@ -131,11 +130,11 @@ BOOL CPPageOutput::OnInitDialog() int i=2;
CString Cbstr;
- BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker)
- {
+ BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker) {
LPOLESTR olestr = NULL;
- if(FAILED(pMoniker->GetDisplayName(0, 0, &olestr)))
+ if(FAILED(pMoniker->GetDisplayName(0, 0, &olestr))) {
continue;
+ }
CStringW str(olestr);
CoTaskMemFree(olestr);
@@ -143,33 +142,27 @@ BOOL CPPageOutput::OnInitDialog() m_AudioRendererDisplayNames.Add(CString(str));
CComPtr<IPropertyBag> pPB;
- if(SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
- {
+ if(SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB))) {
CComVariant var;
pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL);
CString fstr(var.bstrVal);
var.Clear();
- if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL)))
- {
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL))) {
BSTR* pbstr;
- if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pbstr)))
- {
+ if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pbstr))) {
fstr.Format(_T("%s (%08x)"), CString(fstr), *((DWORD*)pbstr + 1));
SafeArrayUnaccessData(var.parray);
}
}
Cbstr.Format(_T("%d: %s"), i, fstr);
- }
- else
- {
+ } else {
Cbstr.Format(_T("%d: %s"), i, CString(str));
}
m_iAudioRendererTypeCtrl.AddString(Cbstr);
- if(s.strAudioRendererDisplayName == str && m_iAudioRendererType == 0)
- {
+ if(s.strAudioRendererDisplayName == str && m_iAudioRendererType == 0) {
m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
}
i++;
@@ -179,28 +172,30 @@ BOOL CPPageOutput::OnInitDialog() Cbstr.Format(_T("%d: %s"), i++, AUDRNDT_NULL_COMP);
m_AudioRendererDisplayNames.Add(AUDRNDT_NULL_COMP);
m_iAudioRendererTypeCtrl.AddString(Cbstr);
- if(s.strAudioRendererDisplayName == AUDRNDT_NULL_COMP && m_iAudioRendererType == 0)
+ if(s.strAudioRendererDisplayName == AUDRNDT_NULL_COMP && m_iAudioRendererType == 0) {
m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
+ }
Cbstr.Format(_T("%d: %s"), i++, AUDRNDT_NULL_UNCOMP);
m_AudioRendererDisplayNames.Add(AUDRNDT_NULL_UNCOMP);
m_iAudioRendererTypeCtrl.AddString(Cbstr);
- if(s.strAudioRendererDisplayName == AUDRNDT_NULL_UNCOMP && m_iAudioRendererType == 0)
+ if(s.strAudioRendererDisplayName == AUDRNDT_NULL_UNCOMP && m_iAudioRendererType == 0) {
m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
+ }
Cbstr.Format(_T("%d: %s"), i++, AUDRNDT_MPC);
m_AudioRendererDisplayNames.Add(AUDRNDT_MPC);
m_iAudioRendererTypeCtrl.AddString(Cbstr);
- if(s.strAudioRendererDisplayName == AUDRNDT_MPC && m_iAudioRendererType == 0)
+ if(s.strAudioRendererDisplayName == AUDRNDT_MPC && m_iAudioRendererType == 0) {
m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
+ }
CorrectComboListWidth(m_iAudioRendererTypeCtrl, GetFont());
//
IDirect3D9* pD3D = Direct3DCreate9(D3D_SDK_VERSION);
- if (pD3D)
- {
+ if (pD3D) {
TCHAR strGUID[50];
CString cstrGUID;
CString d3ddevice_str = _T("");
@@ -208,31 +203,28 @@ BOOL CPPageOutput::OnInitDialog() D3DADAPTER_IDENTIFIER9 adapterIdentifier;
- for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp)
- {
- if (pD3D->GetAdapterIdentifier(adp, 0, &adapterIdentifier) == S_OK)
- {
+ for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
+ if (pD3D->GetAdapterIdentifier(adp, 0, &adapterIdentifier) == S_OK) {
d3ddevice_str = adapterIdentifier.Description;
d3ddevice_str += _T(" - ");
d3ddevice_str += adapterIdentifier.DeviceName;
cstrGUID = _T("");
- if (::StringFromGUID2(adapterIdentifier.DeviceIdentifier, strGUID, 50) > 0)
- {
+ if (::StringFromGUID2(adapterIdentifier.DeviceIdentifier, strGUID, 50) > 0) {
cstrGUID = strGUID;
}
- if((cstrGUID != _T("")))
- {
+ if((cstrGUID != _T(""))) {
boolean m_find = false;
- for(i = 0; (!m_find) && (i < m_D3D9GUIDNames.GetCount()); i++)
- {
- if(m_D3D9GUIDNames.GetAt(i) == cstrGUID) m_find = true;
+ for(i = 0; (!m_find) && (i < m_D3D9GUIDNames.GetCount()); i++) {
+ if(m_D3D9GUIDNames.GetAt(i) == cstrGUID) {
+ m_find = true;
+ }
}
- if(!m_find)
- {
+ if(!m_find) {
m_iD3D9RenderDeviceCtrl.AddString(d3ddevice_str);
m_D3D9GUIDNames.Add(cstrGUID);
- if (renderersSettings.D3D9RenderDevice == cstrGUID)
+ if (renderersSettings.D3D9RenderDevice == cstrGUID) {
m_iD3D9RenderDevice = m_iD3D9RenderDeviceCtrl.GetCount()-1;
+ }
}
}
}
@@ -244,40 +236,34 @@ BOOL CPPageOutput::OnInitDialog() UpdateData(FALSE);
- if(!IsCLSIDRegistered(CLSID_VideoMixingRenderer))
- {
+ if(!IsCLSIDRegistered(CLSID_VideoMixingRenderer)) {
DisableRadioButton(IDC_DSVMR7WIN, IDC_DSSYSDEF);
DisableRadioButton(IDC_DSVMR7REN, IDC_DSSYSDEF);
}
- if(!IsCLSIDRegistered(CLSID_VideoMixingRenderer9))
- {
+ if(!IsCLSIDRegistered(CLSID_VideoMixingRenderer9)) {
DisableRadioButton(IDC_DSVMR9WIN, IDC_DSSYSDEF);
DisableRadioButton(IDC_DSVMR9REN, IDC_DSSYSDEF);
DisableRadioButton(IDC_RMDX9, IDC_RMSYSDEF);
DisableRadioButton(IDC_QTDX9, IDC_QTSYSDEF);
}
- if(!IsCLSIDRegistered(CLSID_EnhancedVideoRenderer))
- {
+ if(!IsCLSIDRegistered(CLSID_EnhancedVideoRenderer)) {
DisableRadioButton(IDC_EVR, IDC_DSSYSDEF);
DisableRadioButton(IDC_EVR_CUSTOM, IDC_DSSYSDEF);
DisableRadioButton(IDC_DSSYNC, IDC_DSSYSDEF); // EVR Sync
}
- if(!IsCLSIDRegistered(CLSID_DXR))
- {
+ if(!IsCLSIDRegistered(CLSID_DXR)) {
DisableRadioButton(IDC_DSDXR, IDC_DSSYSDEF);
}
- if(!IsCLSIDRegistered(CLSID_madVR))
- {
+ if(!IsCLSIDRegistered(CLSID_madVR)) {
DisableRadioButton(IDC_DSMADVR, IDC_DSSYSDEF);
}
// YUV mixing is not compatible with Vista
- if (IsVistaOrAbove())
- {
+ if (IsVistaOrAbove()) {
GetDlgItem(IDC_DSVMR9YUVMIXER)->ShowWindow (SW_HIDE);
}
@@ -287,23 +273,20 @@ BOOL CPPageOutput::OnInitDialog() GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(TRUE);
GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(TRUE);
- if((m_iDSVideoRendererType == 6 || m_iDSVideoRendererType == 11) && (m_iD3D9RenderDeviceCtrl.GetCount() > 1))
- {
+ if((m_iDSVideoRendererType == 6 || m_iDSVideoRendererType == 11) && (m_iD3D9RenderDeviceCtrl.GetCount() > 1)) {
GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(TRUE);
GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(FALSE);
CheckDlgButton(IDC_D3D9DEVICE, BST_UNCHECKED);
- if(m_iD3D9RenderDevice != -1)
- {
+ if(m_iD3D9RenderDevice != -1) {
CheckDlgButton(IDC_D3D9DEVICE, BST_CHECKED);
GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(TRUE);
}
- }
- else
- {
+ } else {
GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(FALSE);
GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(FALSE);
- if(m_iD3D9RenderDevice == -1)
+ if(m_iD3D9RenderDevice == -1) {
CheckDlgButton(IDC_D3D9DEVICE, BST_UNCHECKED);
+ }
}
UpdateData(TRUE);
@@ -324,7 +307,7 @@ BOOL CPPageOutput::OnApply() s.iRMVideoRendererType = m_iRMVideoRendererType;
s.iQTVideoRendererType = m_iQTVideoRendererType;
renderersSettings.iAPSurfaceUsage = m_iAPSurfaceUsage;
-// renderersSettings.fVMRSyncFix = !!m_fVMRSyncFix;
+ // renderersSettings.fVMRSyncFix = !!m_fVMRSyncFix;
renderersSettings.iDX9Resizer = m_iDX9Resizer;
renderersSettings.fVMR9MixerMode = !!m_fVMR9MixerMode;
renderersSettings.fVMR9MixerYUV = !!m_fVMR9MixerYUV;
@@ -334,14 +317,13 @@ BOOL CPPageOutput::OnApply() renderersSettings.fResetDevice = !!m_fResetDevice;
- if (!m_iEvrBuffers.IsEmpty())
- {
+ if (!m_iEvrBuffers.IsEmpty()) {
int Temp = 5;
swscanf(m_iEvrBuffers.GetBuffer(), L"%d", &Temp);
renderersSettings.iEvrBuffers = Temp;
- }
- else
+ } else {
renderersSettings.iEvrBuffers = 5;
+ }
renderersSettings.D3D9RenderDevice = m_fD3D9RenderDevice ? m_D3D9GUIDNames[m_iD3D9RenderDevice] : _T("");
@@ -366,63 +348,59 @@ void CPPageOutput::OnDSRendererChange(UINT nIDbutton) GetDlgItem(IDC_DSVMR9YUVMIXER)->EnableWindow(FALSE);
GetDlgItem(IDC_DSVMR9ALTERNATIVEVSYNC)->EnableWindow(FALSE);
GetDlgItem(IDC_RESETDEVICE)->EnableWindow(FALSE);
-// GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
+ // GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
GetDlgItem(IDC_EVR_BUFFERS)->EnableWindow((nIDbutton - IDC_DSSYSDEF) == 11);
GetDlgItem(IDC_EVR_BUFFERS_TXT)->EnableWindow((nIDbutton - IDC_DSSYSDEF) == 11);
GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(FALSE);
GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(FALSE);
- switch (nIDbutton - IDC_DSSYSDEF)
- {
- case 5 : // VMR7 renderless
- GetDlgItem(IDC_DX_SURFACE)->EnableWindow(TRUE);
- break;
- case 6 : // VMR9 renderless
- if(m_iD3D9RenderDeviceCtrl.GetCount()>1)
- {
- GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(TRUE);
- GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(IsDlgButtonChecked(IDC_D3D9DEVICE));
- }
-
- GetDlgItem(IDC_DSVMR9LOADMIXER)->EnableWindow(TRUE);
- GetDlgItem(IDC_DSVMR9YUVMIXER)->EnableWindow(TRUE);
- GetDlgItem(IDC_DSVMR9ALTERNATIVEVSYNC)->EnableWindow(TRUE);
- GetDlgItem(IDC_RESETDEVICE)->EnableWindow(TRUE);
- case 11 : // EVR custom presenter
- if(m_iD3D9RenderDeviceCtrl.GetCount()>1)
- {
- GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(TRUE);
- GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(IsDlgButtonChecked(IDC_D3D9DEVICE));
- }
+ switch (nIDbutton - IDC_DSSYSDEF) {
+ case 5 : // VMR7 renderless
+ GetDlgItem(IDC_DX_SURFACE)->EnableWindow(TRUE);
+ break;
+ case 6 : // VMR9 renderless
+ if(m_iD3D9RenderDeviceCtrl.GetCount()>1) {
+ GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(TRUE);
+ GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(IsDlgButtonChecked(IDC_D3D9DEVICE));
+ }
- GetDlgItem(IDC_DX9RESIZER_COMBO)->EnableWindow(TRUE);
- GetDlgItem(IDC_FULLSCREEN_MONITOR_CHECK)->EnableWindow(TRUE);
-// GetDlgItem(IDC_CHECK1)->EnableWindow(TRUE); // Lock back buffer
- GetDlgItem(IDC_DSVMR9ALTERNATIVEVSYNC)->EnableWindow(TRUE);
- GetDlgItem(IDC_RESETDEVICE)->EnableWindow(TRUE);
+ GetDlgItem(IDC_DSVMR9LOADMIXER)->EnableWindow(TRUE);
+ GetDlgItem(IDC_DSVMR9YUVMIXER)->EnableWindow(TRUE);
+ GetDlgItem(IDC_DSVMR9ALTERNATIVEVSYNC)->EnableWindow(TRUE);
+ GetDlgItem(IDC_RESETDEVICE)->EnableWindow(TRUE);
+ case 11 : // EVR custom presenter
+ if(m_iD3D9RenderDeviceCtrl.GetCount()>1) {
+ GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(TRUE);
+ GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(IsDlgButtonChecked(IDC_D3D9DEVICE));
+ }
- // Force 3D surface with EVR Custom
- if (nIDbutton - IDC_DSSYSDEF == 11)
- {
+ GetDlgItem(IDC_DX9RESIZER_COMBO)->EnableWindow(TRUE);
+ GetDlgItem(IDC_FULLSCREEN_MONITOR_CHECK)->EnableWindow(TRUE);
+ // GetDlgItem(IDC_CHECK1)->EnableWindow(TRUE); // Lock back buffer
+ GetDlgItem(IDC_DSVMR9ALTERNATIVEVSYNC)->EnableWindow(TRUE);
+ GetDlgItem(IDC_RESETDEVICE)->EnableWindow(TRUE);
+
+ // Force 3D surface with EVR Custom
+ if (nIDbutton - IDC_DSSYSDEF == 11) {
+ GetDlgItem(IDC_DX_SURFACE)->EnableWindow(FALSE);
+ ((CComboBox*)GetDlgItem(IDC_DX_SURFACE))->SetCurSel(2);
+ } else {
+ GetDlgItem(IDC_DX_SURFACE)->EnableWindow(TRUE);
+ }
+ break;
+ case 12 : // madVR
+ GetDlgItem(IDC_FULLSCREEN_MONITOR_CHECK)->EnableWindow(TRUE);
+ break;
+ case 13 : // Sync Renderer
+ GetDlgItem(IDC_EVR_BUFFERS)->EnableWindow(TRUE);
+ GetDlgItem(IDC_EVR_BUFFERS_TXT)->EnableWindow(TRUE);
+ GetDlgItem(IDC_DX9RESIZER_COMBO)->EnableWindow(TRUE);
+ GetDlgItem(IDC_FULLSCREEN_MONITOR_CHECK)->EnableWindow(TRUE);
+ GetDlgItem(IDC_RESETDEVICE)->EnableWindow(TRUE);
GetDlgItem(IDC_DX_SURFACE)->EnableWindow(FALSE);
((CComboBox*)GetDlgItem(IDC_DX_SURFACE))->SetCurSel(2);
- }
- else
- GetDlgItem(IDC_DX_SURFACE)->EnableWindow(TRUE);
- break;
- case 12 : // madVR
- GetDlgItem(IDC_FULLSCREEN_MONITOR_CHECK)->EnableWindow(TRUE);
- break;
- case 13 : // Sync Renderer
- GetDlgItem(IDC_EVR_BUFFERS)->EnableWindow(TRUE);
- GetDlgItem(IDC_EVR_BUFFERS_TXT)->EnableWindow(TRUE);
- GetDlgItem(IDC_DX9RESIZER_COMBO)->EnableWindow(TRUE);
- GetDlgItem(IDC_FULLSCREEN_MONITOR_CHECK)->EnableWindow(TRUE);
- GetDlgItem(IDC_RESETDEVICE)->EnableWindow(TRUE);
- GetDlgItem(IDC_DX_SURFACE)->EnableWindow(FALSE);
- ((CComboBox*)GetDlgItem(IDC_DX_SURFACE))->SetCurSel(2);
- break;
+ break;
}
SetModified();
@@ -432,8 +410,7 @@ void CPPageOutput::OnFullscreenCheck() {
UpdateData();
if (m_fD3DFullscreen &&
- (MessageBox(ResStr(IDS_D3DFS_WARNING), NULL, MB_YESNO) == IDNO))
- {
+ (MessageBox(ResStr(IDS_D3DFS_WARNING), NULL, MB_YESNO) == IDNO)) {
m_fD3DFullscreen = false;
UpdateData(FALSE);
}
diff --git a/src/apps/mplayerc/PPageOutput.h b/src/apps/mplayerc/PPageOutput.h index 635450e2c..45336afdf 100644 --- a/src/apps/mplayerc/PPageOutput.h +++ b/src/apps/mplayerc/PPageOutput.h @@ -44,7 +44,7 @@ public: CPPageOutput();
virtual ~CPPageOutput();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGEOUTPUT };
int m_iDSVideoRendererType;
int m_iRMVideoRendererType;
@@ -52,7 +52,7 @@ public: int m_iAPSurfaceUsage;
int m_iAudioRendererType;
CComboBox m_iAudioRendererTypeCtrl;
-// BOOL m_fVMRSyncFix;
+ // BOOL m_fVMRSyncFix;
int m_iDX9Resizer;
BOOL m_fVMR9MixerMode;
BOOL m_fVMR9MixerYUV;
diff --git a/src/apps/mplayerc/PPagePlayback.cpp b/src/apps/mplayerc/PPagePlayback.cpp index 485a5e6eb..4c2615256 100644 --- a/src/apps/mplayerc/PPagePlayback.cpp +++ b/src/apps/mplayerc/PPagePlayback.cpp @@ -144,8 +144,7 @@ BOOL CPPagePlayback::OnApply() LRESULT CPPagePlayback::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
- if(message == WM_HSCROLL || message == WM_VSCROLL)
- {
+ if(message == WM_HSCROLL || message == WM_VSCROLL) {
SetModified();
}
@@ -154,13 +153,10 @@ LRESULT CPPagePlayback::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam void CPPagePlayback::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
- if(*pScrollBar == m_volumectrl)
- {
+ if(*pScrollBar == m_volumectrl) {
UpdateData();
((CMainFrame*)GetParentFrame())->m_wndToolBar.Volume = m_nVolume; // nice shortcut...
- }
- else if(*pScrollBar == m_balancectrl)
- {
+ } else if(*pScrollBar == m_balancectrl) {
UpdateData();
((CMainFrame*)GetParentFrame())->SetBalance(m_nBalance-100); // see prev note...
}
@@ -197,8 +193,9 @@ BOOL CPPagePlayback::OnSetActive() BOOL CPPagePlayback::OnKillActive()
{
AppSettings& s = AfxGetAppSettings();
- if(s.fRememberZoomLevel)
+ if(s.fRememberZoomLevel) {
s.fRememberWindowSize = false;
+ }
return __super::OnKillActive();
}
\ No newline at end of file diff --git a/src/apps/mplayerc/PPagePlayback.h b/src/apps/mplayerc/PPagePlayback.h index 4232d3140..46a23322c 100644 --- a/src/apps/mplayerc/PPagePlayback.h +++ b/src/apps/mplayerc/PPagePlayback.h @@ -56,7 +56,7 @@ public: CString m_subtitlesLanguageOrder;
CString m_audiosLanguageOrder;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGEPLAYBACK };
protected:
diff --git a/src/apps/mplayerc/PPagePlayer.cpp b/src/apps/mplayerc/PPagePlayer.cpp index 344e106e5..021a75152 100644 --- a/src/apps/mplayerc/PPagePlayer.cpp +++ b/src/apps/mplayerc/PPagePlayer.cpp @@ -139,10 +139,13 @@ BOOL CPPagePlayer::OnApply() s.fRememberDVDPos = m_fRememberDVDPos ? true : false;
s.fRememberFilePos = m_fRememberFilePos ? true : false;
- if(!m_fKeepHistory)
- {
- for(int i = 0; i < s.MRU.GetSize(); i++) s.MRU.Remove(i);
- for(int i = 0; i < s.MRUDub.GetSize(); i++) s.MRUDub.Remove(i);
+ if(!m_fKeepHistory) {
+ for(int i = 0; i < s.MRU.GetSize(); i++) {
+ s.MRU.Remove(i);
+ }
+ for(int i = 0; i < s.MRUDub.GetSize(); i++) {
+ s.MRUDub.Remove(i);
+ }
s.MRU.WriteList();
s.MRUDub.WriteList();
}
@@ -161,8 +164,11 @@ void CPPagePlayer::OnBnClickedCheck8() {
UpdateData();
- if(m_fUseIni) ((CMPlayerCApp*)AfxGetApp())->StoreSettingsToIni();
- else ((CMPlayerCApp*)AfxGetApp())->StoreSettingsToRegistry();
+ if(m_fUseIni) {
+ ((CMPlayerCApp*)AfxGetApp())->StoreSettingsToIni();
+ } else {
+ ((CMPlayerCApp*)AfxGetApp())->StoreSettingsToRegistry();
+ }
SetModified();
}
@@ -193,8 +199,9 @@ BOOL CPPagePlayer::OnSetActive() BOOL CPPagePlayer::OnKillActive()
{
AppSettings& s = AfxGetAppSettings();
- if(s.fRememberWindowSize)
+ if(s.fRememberWindowSize) {
s.fRememberZoomLevel = false;
+ }
return __super::OnKillActive();
}
\ No newline at end of file diff --git a/src/apps/mplayerc/PPagePlayer.h b/src/apps/mplayerc/PPagePlayer.h index 475060b8e..8bfaf6ef1 100644 --- a/src/apps/mplayerc/PPagePlayer.h +++ b/src/apps/mplayerc/PPagePlayer.h @@ -53,7 +53,7 @@ public: BOOL m_fRememberDVDPos;
BOOL m_fRememberFilePos;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGEPLAYER };
protected:
diff --git a/src/apps/mplayerc/PPageSheet.cpp b/src/apps/mplayerc/PPageSheet.cpp index 39d565941..38ed358a0 100644 --- a/src/apps/mplayerc/PPageSheet.cpp +++ b/src/apps/mplayerc/PPageSheet.cpp @@ -62,14 +62,12 @@ CPPageSheet::CPPageSheet(LPCTSTR pszCaption, IFilterGraph* pFG, CWnd* pParentWnd SetTreeViewMode(TRUE, TRUE, FALSE);
- if(!idPage)
+ if(!idPage) {
idPage = AfxGetAppSettings().nLastUsedPage;
- if(idPage)
- {
- for(int i = 0; i < GetPageCount(); i++)
- {
- if(GetPage(i)->m_pPSP->pszTemplate == MAKEINTRESOURCE(idPage))
- {
+ }
+ if(idPage) {
+ for(int i = 0; i < GetPageCount(); i++) {
+ if(GetPage(i)->m_pPSP->pszTemplate == MAKEINTRESOURCE(idPage)) {
SetActivePage(i);
break;
}
@@ -94,14 +92,15 @@ BOOL CPPageSheet::OnInitDialog() {
BOOL bResult = __super::OnInitDialog();
- if(CTreeCtrl* pTree = GetPageTreeControl())
- {
- for(HTREEITEM node = pTree->GetRootItem(); node; node = pTree->GetNextSiblingItem(node))
+ if(CTreeCtrl* pTree = GetPageTreeControl()) {
+ for(HTREEITEM node = pTree->GetRootItem(); node; node = pTree->GetNextSiblingItem(node)) {
pTree->Expand(node, TVE_EXPAND);
+ }
}
- if (m_bLockPage)
+ if (m_bLockPage) {
GetPageTreeControl()->EnableWindow (FALSE);
+ }
return bResult;
}
@@ -132,7 +131,7 @@ END_MESSAGE_MAP() BOOL CTreePropSheetTreeCtrl::PreCreateWindow(CREATESTRUCT& cs)
{
cs.dwExStyle |= WS_EX_CLIENTEDGE;
-// cs.style &= ~TVS_LINESATROOT;
+ // cs.style &= ~TVS_LINESATROOT;
return __super::PreCreateWindow(cs);
}
diff --git a/src/apps/mplayerc/PPageSheet.h b/src/apps/mplayerc/PPageSheet.h index f8b4c78df..48a01edf0 100644 --- a/src/apps/mplayerc/PPageSheet.h +++ b/src/apps/mplayerc/PPageSheet.h @@ -95,8 +95,7 @@ public: virtual ~CPPageSheet();
afx_msg void OnContextMenu(CWnd *pWnd, CPoint point);
- void LockPage()
- {
+ void LockPage() {
m_bLockPage = true;
};
protected:
diff --git a/src/apps/mplayerc/PPageSubMisc.cpp b/src/apps/mplayerc/PPageSubMisc.cpp index 329c0afa4..605a80cbe 100644 --- a/src/apps/mplayerc/PPageSubMisc.cpp +++ b/src/apps/mplayerc/PPageSubMisc.cpp @@ -65,8 +65,9 @@ BOOL CPPageSubMisc::OnInitDialog() m_ISDb = s.strISDb;
m_ISDbCombo.AddString(m_ISDb);
- if(m_ISDb.CompareNoCase(_T("www.opensubtitles.org/isdb")))
+ if(m_ISDb.CompareNoCase(_T("www.opensubtitles.org/isdb"))) {
m_ISDbCombo.AddString(_T("www.opensubtitles.org/isdb"));
+ }
UpdateData(FALSE);
@@ -116,16 +117,11 @@ void CPPageSubMisc::OnBnClickedButton2() ver.Format(_T("ISDb v%d"), ISDb_PROTOCOL_VERSION);
CWebTextFile wtf;
- if(wtf.Open(_T("http://") + ISDb + _T("/test.php")) && wtf.ReadString(str) && str == ver)
- {
+ if(wtf.Open(_T("http://") + ISDb + _T("/test.php")) && wtf.ReadString(str) && str == ver) {
msg = ResStr(IDS_PPSDB_URLCORRECT);
- }
- else if(str.Find(_T("ISDb v")) == 0)
- {
+ } else if(str.Find(_T("ISDb v")) == 0) {
msg = ResStr(IDS_PPSDB_PROTOCOLERR);
- }
- else
- {
+ } else {
msg = ResStr(IDS_PPSDB_BADURL);
}
diff --git a/src/apps/mplayerc/PPageSubMisc.h b/src/apps/mplayerc/PPageSubMisc.h index af10f6238..fedcf77c1 100644 --- a/src/apps/mplayerc/PPageSubMisc.h +++ b/src/apps/mplayerc/PPageSubMisc.h @@ -34,7 +34,7 @@ public: CPPageSubMisc();
virtual ~CPPageSubMisc();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGESUBMISC };
BOOL m_fPrioritizeExternalSubtitles;
BOOL m_fDisableInternalSubtitles;
diff --git a/src/apps/mplayerc/PPageSubStyle.cpp b/src/apps/mplayerc/PPageSubStyle.cpp index ef216bfd3..52ba434de 100644 --- a/src/apps/mplayerc/PPageSubStyle.cpp +++ b/src/apps/mplayerc/PPageSubStyle.cpp @@ -74,8 +74,7 @@ void CPPageSubStyle::AskColor(int i) {
CColorDialog dlg(m_stss.colors[i]);
dlg.m_cc.Flags |= CC_FULLOPEN;
- if(dlg.DoModal() == IDOK)
- {
+ if(dlg.DoModal() == IDOK) {
m_stss.colors[i] = dlg.m_cc.rgbResult;
m_color[i].Invalidate();
}
@@ -147,19 +146,22 @@ BOOL CPPageSubStyle::OnInitDialog() m_font.SetWindowText(m_stss.fontName);
m_iCharset = -1;
- for(int i = 0; i < CharSetLen; i++)
- {
+ for(int i = 0; i < CharSetLen; i++) {
CString str;
str.Format(_T("%s (%d)"), CharSetNames[i], CharSetList[i]);
m_charset.AddString(str);
m_charset.SetItemData(i, CharSetList[i]);
- if(m_stss.charSet == CharSetList[i]) m_iCharset = i;
+ if(m_stss.charSet == CharSetList[i]) {
+ m_iCharset = i;
+ }
}
// TODO: allow floats in these edit boxes
m_spacing = (int)m_stss.fontSpacing;
m_spacingspin.SetRange32(-10000, 10000);
- while(m_stss.fontAngleZ < 0) m_stss.fontAngleZ += 360;
+ while(m_stss.fontAngleZ < 0) {
+ m_stss.fontAngleZ += 360;
+ }
m_angle = (int)fmod(m_stss.fontAngleZ, 360);
m_anglespin.SetRange32(0, 359);
m_scalex = (int)m_stss.fontScaleX;
@@ -181,8 +183,7 @@ BOOL CPPageSubStyle::OnInitDialog() m_marginbottomspin.SetRange32(-10000, 10000);
m_relativeTo = m_stss.relativeTo;
- for(int i = 0; i < 4; i++)
- {
+ for(int i = 0; i < 4; i++) {
m_color[i].SetColorPtr(&m_stss.colors[i]);
m_alpha[i] = 255-m_stss.alpha[i];
m_alphasliders[i].SetRange(0, 255);
@@ -202,7 +203,9 @@ BOOL CPPageSubStyle::OnApply() {
UpdateData();
- if(m_iCharset >= 0) m_stss.charSet = m_charset.GetItemData(m_iCharset);
+ if(m_iCharset >= 0) {
+ m_stss.charSet = m_charset.GetItemData(m_iCharset);
+ }
m_stss.fontSpacing = m_spacing;
m_stss.fontAngleZ = m_angle;
m_stss.fontScaleX = m_scalex;
@@ -216,16 +219,17 @@ BOOL CPPageSubStyle::OnApply() m_stss.marginRect = m_margin;
m_stss.relativeTo = m_relativeTo;
- for(int i = 0; i < 4; i++) m_stss.alpha[i] = 255-m_alpha[i];
+ for(int i = 0; i < 4; i++) {
+ m_stss.alpha[i] = 255-m_alpha[i];
+ }
- if(m_fUseDefaultStyle)
- {
+ if(m_fUseDefaultStyle) {
STSStyle& stss = AfxGetAppSettings().subdefstyle;
- if(!(stss == m_stss))
- {
+ if(!(stss == m_stss)) {
stss = m_stss;
- if(CMainFrame* pFrame = dynamic_cast<CMainFrame*>(AfxGetMainWnd()))
+ if(CMainFrame* pFrame = dynamic_cast<CMainFrame*>(AfxGetMainWnd())) {
pFrame->UpdateSubtitle(false, true);
+ }
}
}
@@ -238,16 +242,15 @@ void CPPageSubStyle::OnBnClickedButton1() lf <<= m_stss;
CFontDialog dlg(&lf, CF_SCREENFONTS|CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|CF_SCALABLEONLY|CF_EFFECTS);
- if(dlg.DoModal() == IDOK)
- {
+ if(dlg.DoModal() == IDOK) {
CString str(lf.lfFaceName);
- if(str.GetLength() > 16) str = str.Left(14) + _T("...");
+ if(str.GetLength() > 16) {
+ str = str.Left(14) + _T("...");
+ }
m_font.SetWindowText(str);
- for(int i = 0, j = m_charset.GetCount(); i < j; i++)
- {
- if(m_charset.GetItemData(i) == lf.lfCharSet)
- {
+ for(int i = 0, j = m_charset.GetCount(); i < j; i++) {
+ if(m_charset.GetItemData(i) == lf.lfCharSet) {
m_charset.SetCurSel(i);
break;
}
@@ -284,19 +287,24 @@ void CPPageSubStyle::OnBnClickedCheck1() UpdateData();
int avg = 0;
- for(int i = 0; i < 4; i++) avg += m_alphasliders[i].GetPos();
+ for(int i = 0; i < 4; i++) {
+ avg += m_alphasliders[i].GetPos();
+ }
avg /= 4;
- for(int i = 0; i < 4; i++) m_alphasliders[i].SetPos(avg);
+ for(int i = 0; i < 4; i++) {
+ m_alphasliders[i].SetPos(avg);
+ }
SetModified();
}
void CPPageSubStyle::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
- if(m_linkalphasliders && pScrollBar)
- {
+ if(m_linkalphasliders && pScrollBar) {
int pos = ((CSliderCtrl*)pScrollBar)->GetPos();
- for(int i = 0; i < 4; i++) m_alphasliders[i].SetPos(pos);
+ for(int i = 0; i < 4; i++) {
+ m_alphasliders[i].SetPos(pos);
+ }
}
SetModified();
diff --git a/src/apps/mplayerc/PPageSubStyle.h b/src/apps/mplayerc/PPageSubStyle.h index e436e8e89..a606254c9 100644 --- a/src/apps/mplayerc/PPageSubStyle.h +++ b/src/apps/mplayerc/PPageSubStyle.h @@ -29,7 +29,7 @@ class CColorStatic : public CStatic
{
-// DECLARE_DYNAMIC(CColorStatic)
+ // DECLARE_DYNAMIC(CColorStatic)
COLORREF* m_pColor;
@@ -37,16 +37,14 @@ public: CColorStatic(CWnd* pParent = NULL) : m_pColor(NULL) {}
virtual ~CColorStatic() {}
- void SetColorPtr(COLORREF* pColor)
- {
+ void SetColorPtr(COLORREF* pColor) {
m_pColor = pColor;
}
-// DECLARE_MESSAGE_MAP()
+ // DECLARE_MESSAGE_MAP()
protected:
- virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
- {
+ virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) {
CRect r;
GetClientRect(r);
CDC::FromHandle(lpDrawItemStruct->hDC)->FillSolidRect(r, m_pColor ? *m_pColor : ::GetSysColor(COLOR_BTNFACE));
@@ -71,12 +69,11 @@ public: virtual ~CPPageSubStyle();
void InitStyle(CString title, STSStyle& stss);
- void GetStyle(STSStyle& stss)
- {
+ void GetStyle(STSStyle& stss) {
stss = m_stss;
}
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGESUBSTYLE };
CButton m_font;
int m_iCharset;
diff --git a/src/apps/mplayerc/PPageSubtitles.cpp b/src/apps/mplayerc/PPageSubtitles.cpp index f504a1e8c..7b35285ac 100644 --- a/src/apps/mplayerc/PPageSubtitles.cpp +++ b/src/apps/mplayerc/PPageSubtitles.cpp @@ -82,42 +82,40 @@ END_MESSAGE_MAP() int TranslateResIn(int _In)
{
- switch (_In)
- {
- case 0:
- return 0;
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- return _In + 4;
- case 6:
- case 7:
- case 8:
- case 9:
- return _In - 5;
+ switch (_In) {
+ case 0:
+ return 0;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ return _In + 4;
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ return _In - 5;
}
return _In;
}
int TranslateResOut(int _In)
{
- switch (_In)
- {
- case 0:
- return 0;
- case 1:
- case 2:
- case 3:
- case 4:
- return _In + 5;
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- return _In - 4;
+ switch (_In) {
+ case 0:
+ return 0;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ return _In + 5;
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ return _In - 4;
}
return _In;
}
@@ -173,8 +171,7 @@ BOOL CPPageSubtitles::OnApply() || s.nSubDelayInterval != m_nSubDelayInterval
|| s.m_RenderersSettings.nSPCMaxRes != TranslateResOut(m_spmaxres.GetCurSel())
|| s.m_RenderersSettings.fSPCPow2Tex != !!m_fSPCPow2Tex
- || s.m_RenderersSettings.fSPCAllowAnimationWhenBuffering != !!m_fSPCAllowAnimationWhenBuffering)
- {
+ || s.m_RenderersSettings.fSPCAllowAnimationWhenBuffering != !!m_fSPCAllowAnimationWhenBuffering) {
s.fOverridePlacement = !!m_fOverridePlacement;
s.nHorPos = m_nHorPos;
s.nVerPos = m_nVerPos;
@@ -184,8 +181,9 @@ BOOL CPPageSubtitles::OnApply() s.m_RenderersSettings.fSPCPow2Tex = !!m_fSPCPow2Tex;
s.m_RenderersSettings.fSPCAllowAnimationWhenBuffering = !!m_fSPCAllowAnimationWhenBuffering;
- if(CMainFrame* pFrame = (CMainFrame*)GetParentFrame())
+ if(CMainFrame* pFrame = (CMainFrame*)GetParentFrame()) {
pFrame->UpdateSubtitle(true);
+ }
}
return __super::OnApply();
@@ -201,8 +199,9 @@ void CPPageSubtitles::OnUpdatePosOverride(CCmdUI* pCmdUI) void CPPageSubtitles::OnSubDelayInterval()
{
// If incorrect number, revert modifications
- if (!UpdateData())
+ if (!UpdateData()) {
UpdateData(FALSE);
+ }
SetModified();
}
diff --git a/src/apps/mplayerc/PPageSubtitles.h b/src/apps/mplayerc/PPageSubtitles.h index 6767fde79..dc3722942 100644 --- a/src/apps/mplayerc/PPageSubtitles.h +++ b/src/apps/mplayerc/PPageSubtitles.h @@ -50,7 +50,7 @@ public: BOOL m_fSPCAllowAnimationWhenBuffering;
int m_nSubDelayInterval;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGESUBTITLES };
protected:
diff --git a/src/apps/mplayerc/PPageSync.cpp b/src/apps/mplayerc/PPageSync.cpp index 3289de72c..fbafbec23 100644 --- a/src/apps/mplayerc/PPageSync.cpp +++ b/src/apps/mplayerc/PPageSync.cpp @@ -62,14 +62,11 @@ BOOL CPPageSync::OnInitDialog() AppSettings& s = AfxGetAppSettings();
CMainFrame * pFrame;
pFrame = (CMainFrame *)(AfxGetApp()->m_pMainWnd);
- if ((s.iDSVideoRendererType == VIDRNDT_DS_SYNC) && (pFrame->GetPlaybackMode() == PM_NONE))
- {
+ if ((s.iDSVideoRendererType == VIDRNDT_DS_SYNC) && (pFrame->GetPlaybackMode() == PM_NONE)) {
GetDlgItem(IDC_SYNCVIDEO)->EnableWindow(TRUE);
GetDlgItem(IDC_SYNCDISPLAY)->EnableWindow(TRUE);
GetDlgItem(IDC_SYNCNEAREST)->EnableWindow(TRUE);
- }
- else
- {
+ } else {
GetDlgItem(IDC_SYNCVIDEO)->EnableWindow(FALSE);
GetDlgItem(IDC_SYNCDISPLAY)->EnableWindow(FALSE);
GetDlgItem(IDC_SYNCNEAREST)->EnableWindow(FALSE);
@@ -96,14 +93,11 @@ BOOL CPPageSync::OnSetActive() AppSettings& s = AfxGetAppSettings();
CMainFrame * pFrame;
pFrame = (CMainFrame *)(AfxGetApp()->m_pMainWnd);
- if ((s.iDSVideoRendererType == VIDRNDT_DS_SYNC) && (pFrame->GetPlaybackMode() == PM_NONE))
- {
+ if ((s.iDSVideoRendererType == VIDRNDT_DS_SYNC) && (pFrame->GetPlaybackMode() == PM_NONE)) {
GetDlgItem(IDC_SYNCVIDEO)->EnableWindow(TRUE);
GetDlgItem(IDC_SYNCDISPLAY)->EnableWindow(TRUE);
GetDlgItem(IDC_SYNCNEAREST)->EnableWindow(TRUE);
- }
- else
- {
+ } else {
GetDlgItem(IDC_SYNCVIDEO)->EnableWindow(FALSE);
GetDlgItem(IDC_SYNCDISPLAY)->EnableWindow(FALSE);
GetDlgItem(IDC_SYNCNEAREST)->EnableWindow(FALSE);
@@ -151,8 +145,7 @@ END_MESSAGE_MAP() void CPPageSync::OnBnClickedSyncVideo()
{
m_bSynchronizeVideo = !m_bSynchronizeVideo;
- if (m_bSynchronizeVideo)
- {
+ if (m_bSynchronizeVideo) {
m_bSynchronizeDisplay = FALSE;
m_bSynchronizeNearest = FALSE;
}
@@ -162,8 +155,7 @@ void CPPageSync::OnBnClickedSyncVideo() void CPPageSync::OnBnClickedSyncDisplay()
{
m_bSynchronizeDisplay = !m_bSynchronizeDisplay;
- if (m_bSynchronizeDisplay)
- {
+ if (m_bSynchronizeDisplay) {
m_bSynchronizeVideo = FALSE;
m_bSynchronizeNearest = FALSE;
}
@@ -173,8 +165,7 @@ void CPPageSync::OnBnClickedSyncDisplay() void CPPageSync::OnBnClickedSyncNearest()
{
m_bSynchronizeNearest = !m_bSynchronizeNearest;
- if (m_bSynchronizeNearest)
- {
+ if (m_bSynchronizeNearest) {
m_bSynchronizeVideo = FALSE;
m_bSynchronizeDisplay = FALSE;
}
diff --git a/src/apps/mplayerc/PPageTweaks.cpp b/src/apps/mplayerc/PPageTweaks.cpp index 4c79b9aab..30af86770 100644 --- a/src/apps/mplayerc/PPageTweaks.cpp +++ b/src/apps/mplayerc/PPageTweaks.cpp @@ -76,7 +76,9 @@ void CPPageTweaks::DoDataExchange(CDataExchange* pDX) int CALLBACK EnumFontProc(ENUMLOGFONT FAR* lf, NEWTEXTMETRIC FAR* tm, int FontType, LPARAM dwData)
{
CAtlArray<CString>* fntl = (CAtlArray<CString>*)dwData;
- if(FontType == TRUETYPE_FONTTYPE) fntl->Add(lf->elfFullName);
+ if(FontType == TRUETYPE_FONTTYPE) {
+ fntl->Add(lf->elfFullName);
+ }
return true;
}
@@ -111,23 +113,26 @@ BOOL CPPageTweaks::OnInitDialog() CAtlArray<CString> fntl;
EnumFontFamilies(dc, NULL,(FONTENUMPROC)EnumFontProc, (LPARAM)&fntl);
DeleteDC(dc);
- for (int i=0; i< fntl.GetCount(); i++)
- {
- if (i>0 && fntl[i-1] == fntl[i]) continue;
+ for (int i=0; i< fntl.GetCount(); i++) {
+ if (i>0 && fntl[i-1] == fntl[i]) {
+ continue;
+ }
m_FontType.AddString(fntl[i]);
}
- for (int i=0; i< m_FontType.GetCount(); i++)
- {
+ for (int i=0; i< m_FontType.GetCount(); i++) {
m_FontType.GetLBText(i,str);
- if (m_OSD_Font == str) iSel=i;
+ if (m_OSD_Font == str) {
+ iSel=i;
+ }
}
m_FontType.SetCurSel(iSel);
- for (int i=10; i<26; i++)
- {
+ for (int i=10; i<26; i++) {
str.Format(_T("%d"), i);
m_FontSize.AddString(str);
- if (m_OSD_Size == i) iSel=i;
+ if (m_OSD_Size == i) {
+ iSel=i;
+ }
}
m_FontSize.SetCurSel(iSel-10);
@@ -158,7 +163,9 @@ BOOL CPPageTweaks::OnApply() m_FontType.GetLBText(m_FontType.GetCurSel(),s.strOSDFont);
CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
- if(m_fUseWin7TaskBar) pFrame->CreateThumbnailToolbar();
+ if(m_fUseWin7TaskBar) {
+ pFrame->CreateThumbnailToolbar();
+ }
pFrame->UpdateThumbarButton();
return __super::OnApply();
diff --git a/src/apps/mplayerc/PPageTweaks.h b/src/apps/mplayerc/PPageTweaks.h index 239f234ca..21f919183 100644 --- a/src/apps/mplayerc/PPageTweaks.h +++ b/src/apps/mplayerc/PPageTweaks.h @@ -44,7 +44,7 @@ public: BOOL m_fUseWMASFReader;
CButton m_fUseWMASFReaderCtrl;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGETWEAKS };
int m_nJumpDistS;
int m_nJumpDistM;
diff --git a/src/apps/mplayerc/PPageWebServer.cpp b/src/apps/mplayerc/PPageWebServer.cpp index 0b3ba27bf..3586c5f6b 100644 --- a/src/apps/mplayerc/PPageWebServer.cpp +++ b/src/apps/mplayerc/PPageWebServer.cpp @@ -67,18 +67,14 @@ void CPPageWebServer::DoDataExchange(CDataExchange* pDX) BOOL CPPageWebServer::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_LBUTTONDOWN && pMsg->hwnd == m_launch.m_hWnd)
- {
+ if(pMsg->message == WM_LBUTTONDOWN && pMsg->hwnd == m_launch.m_hWnd) {
UpdateData();
AppSettings& s = AfxGetAppSettings();
- if(CMainFrame* pWnd = (CMainFrame*)AfxGetMainWnd())
- {
- if(m_fEnableWebServer)
- {
- if(s.nWebServerPort != m_nWebServerPort)
- {
+ if(CMainFrame* pWnd = (CMainFrame*)AfxGetMainWnd()) {
+ if(m_fEnableWebServer) {
+ if(s.nWebServerPort != m_nWebServerPort) {
AfxMessageBox(_T("Press apply first, before testing the new settings!"), MB_OK);
return TRUE;
}
@@ -121,7 +117,9 @@ BOOL CPPageWebServer::OnApply() AppSettings& s = AfxGetAppSettings();
CString NewWebRoot = m_WebRoot;
- if(!m_fWebRoot) NewWebRoot = _T("*") + NewWebRoot;
+ if(!m_fWebRoot) {
+ NewWebRoot = _T("*") + NewWebRoot;
+ }
bool fRestart = s.nWebServerPort != m_nWebServerPort
|| s.strWebRoot != NewWebRoot || s.strWebServerCGI != m_WebServerCGI;
@@ -135,15 +133,13 @@ BOOL CPPageWebServer::OnApply() s.strWebDefIndex = m_WebDefIndex;
s.strWebServerCGI = m_WebServerCGI;
- if(CMainFrame* pWnd = (CMainFrame*)AfxGetMainWnd())
- {
- if(m_fEnableWebServer)
- {
- if(fRestart) pWnd->StopWebServer();
+ if(CMainFrame* pWnd = (CMainFrame*)AfxGetMainWnd()) {
+ if(m_fEnableWebServer) {
+ if(fRestart) {
+ pWnd->StopWebServer();
+ }
pWnd->StartWebServer(m_nWebServerPort);
- }
- else
- {
+ } else {
pWnd->StopWebServer();
}
}
@@ -174,8 +170,9 @@ CString CPPageWebServer::GetCurWebRoot() static int __stdcall BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
- if(uMsg == BFFM_INITIALIZED && lpData)
+ if(uMsg == BFFM_INITIALIZED && lpData) {
::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData);
+ }
return 0;
}
@@ -194,8 +191,7 @@ bool CPPageWebServer::PickDir(CString& dir) bi.iImage = 0;
LPITEMIDLIST iil = SHBrowseForFolder(&bi);
- if(iil)
- {
+ if(iil) {
SHGetPathFromIDList(iil, buff);
dir = buff;
return true;
@@ -229,11 +225,11 @@ void CPPageWebServer::OnEnChangeEdit1() void CPPageWebServer::OnBnClickedButton1()
{
CString dir = GetCurWebRoot();
- if(PickDir(dir))
- {
+ if(PickDir(dir)) {
CPath path;
- if(path.RelativePathTo(GetMPCDir(), FILE_ATTRIBUTE_DIRECTORY, dir, FILE_ATTRIBUTE_DIRECTORY))
+ if(path.RelativePathTo(GetMPCDir(), FILE_ATTRIBUTE_DIRECTORY, dir, FILE_ATTRIBUTE_DIRECTORY)) {
dir = (LPCTSTR)path;
+ }
m_WebRoot = dir;
UpdateData(FALSE);
}
@@ -242,8 +238,7 @@ void CPPageWebServer::OnBnClickedButton1() void CPPageWebServer::OnBnClickedButton2()
{
CString dir;
- if(PickDir(dir))
- {
+ if(PickDir(dir)) {
dir += _T("\\");
CWebServer::Deploy(dir);
}
diff --git a/src/apps/mplayerc/PPageWebServer.h b/src/apps/mplayerc/PPageWebServer.h index 80271add5..88494b209 100644 --- a/src/apps/mplayerc/PPageWebServer.h +++ b/src/apps/mplayerc/PPageWebServer.h @@ -43,7 +43,7 @@ public: CPPageWebServer();
virtual ~CPPageWebServer();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PPAGEWEBSERVER };
BOOL m_fEnableWebServer;
int m_nWebServerPort;
diff --git a/src/apps/mplayerc/PlayerCaptureBar.cpp b/src/apps/mplayerc/PlayerCaptureBar.cpp index be5c1feab..07b3301f7 100644 --- a/src/apps/mplayerc/PlayerCaptureBar.cpp +++ b/src/apps/mplayerc/PlayerCaptureBar.cpp @@ -40,8 +40,9 @@ CPlayerCaptureBar::~CPlayerCaptureBar() BOOL CPlayerCaptureBar::Create(CWnd* pParentWnd)
{
- if(!baseCPlayerCaptureBar::Create(_T("Capture Settings"), pParentWnd, ID_VIEW_CAPTURE))
+ if(!baseCPlayerCaptureBar::Create(_T("Capture Settings"), pParentWnd, ID_VIEW_CAPTURE)) {
return FALSE;
+ }
m_capdlg.Create(this);
m_capdlg.ShowWindow(SW_SHOWNORMAL);
@@ -59,10 +60,10 @@ BOOL CPlayerCaptureBar::Create(CWnd* pParentWnd) BOOL CPlayerCaptureBar::PreTranslateMessage(MSG* pMsg)
{
- if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
- {
- if(IsDialogMessage(pMsg))
+ if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) {
+ if(IsDialogMessage(pMsg)) {
return TRUE;
+ }
}
return __super::PreTranslateMessage(pMsg);
diff --git a/src/apps/mplayerc/PlayerCaptureDialog.cpp b/src/apps/mplayerc/PlayerCaptureDialog.cpp index 1082cc71e..768741ded 100644 --- a/src/apps/mplayerc/PlayerCaptureDialog.cpp +++ b/src/apps/mplayerc/PlayerCaptureDialog.cpp @@ -36,19 +36,21 @@ static bool LoadMediaType(CStringW DisplayName, AM_MEDIA_TYPE** ppmt) {
bool fRet = false;
- if(!ppmt) return(fRet);
+ if(!ppmt) {
+ return(fRet);
+ }
*ppmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
- if(!*ppmt) return(fRet);
+ if(!*ppmt) {
+ return(fRet);
+ }
memset(*ppmt, 0, sizeof(AM_MEDIA_TYPE));
BYTE* pData;
UINT len;
- if(AfxGetApp()->GetProfileBinary(IDS_RS_CAPTURE _T("\\") + CString(DisplayName), _T("MediaType"), &pData, &len))
- {
- if ( len != sizeof(AM_MEDIA_TYPE) )
- {
+ if(AfxGetApp()->GetProfileBinary(IDS_RS_CAPTURE _T("\\") + CString(DisplayName), _T("MediaType"), &pData, &len)) {
+ if ( len != sizeof(AM_MEDIA_TYPE) ) {
delete [] pData;
return(fRet);
}
@@ -60,10 +62,8 @@ static bool LoadMediaType(CStringW DisplayName, AM_MEDIA_TYPE** ppmt) fRet = true;
- if(AfxGetApp()->GetProfileBinary(IDS_RS_CAPTURE _T("\\") + CString(DisplayName), _T("Format"), &pData, &len))
- {
- if ( !len )
- {
+ if(AfxGetApp()->GetProfileBinary(IDS_RS_CAPTURE _T("\\") + CString(DisplayName), _T("Format"), &pData, &len)) {
+ if ( !len ) {
delete [] pData;
return(fRet);
}
@@ -80,7 +80,9 @@ static bool LoadMediaType(CStringW DisplayName, AM_MEDIA_TYPE** ppmt) static void SaveMediaType(CStringW DisplayName, AM_MEDIA_TYPE* pmt)
{
- if(DisplayName.IsEmpty() || !pmt) return;
+ if(DisplayName.IsEmpty() || !pmt) {
+ return;
+ }
AfxGetApp()->WriteProfileBinary(IDS_RS_CAPTURE _T("\\") + CString(DisplayName), _T("MediaType"), (BYTE*)pmt, sizeof(AM_MEDIA_TYPE));
AfxGetApp()->WriteProfileBinary(IDS_RS_CAPTURE _T("\\") + CString(DisplayName), _T("Format"), pmt->pbFormat, pmt->cbFormat);
@@ -89,23 +91,28 @@ static void SaveMediaType(CStringW DisplayName, AM_MEDIA_TYPE* pmt) static void LoadDefaultCodec(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& cat)
{
int len = box.GetCount();
- if(len >= 0) box.SetCurSel(0);
+ if(len >= 0) {
+ box.SetCurSel(0);
+ }
- if(cat == GUID_NULL) return;
+ if(cat == GUID_NULL) {
+ return;
+ }
CString DisplayName = AfxGetApp()->GetProfileString(IDS_RS_CAPTURE _T("\\") + CStringFromGUID(cat), _T("DisplayName"));
- for(int i = 0; i < len; i++)
- {
+ for(int i = 0; i < len; i++) {
int iSel = box.GetItemData(i);
- if(iSel < 0) continue;
+ if(iSel < 0) {
+ continue;
+ }
Codec& c = codecs[iSel];
- if(DisplayName == c.DisplayName)
- {
+ if(DisplayName == c.DisplayName) {
box.SetCurSel(i);
- if(!c.pBF)
+ if(!c.pBF) {
c.pMoniker->BindToObject(NULL, NULL, __uuidof(IBaseFilter), (void**)&c.pBF);
+ }
break;
}
}
@@ -113,16 +120,22 @@ static void LoadDefaultCodec(CAtlArray<Codec>& codecs, CComboBox& box, const GUI static void SaveDefaultCodec(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& cat)
{
- if(cat == GUID_NULL) return;
+ if(cat == GUID_NULL) {
+ return;
+ }
CString guid = CStringFromGUID(cat);
AfxGetApp()->WriteProfileString(IDS_RS_CAPTURE _T("\\") + guid, NULL, NULL);
int iSel = box.GetCurSel();
- if(iSel < 0) return;
+ if(iSel < 0) {
+ return;
+ }
iSel = box.GetItemData(iSel);
- if(iSel < 0) return;
+ if(iSel < 0) {
+ return;
+ }
Codec& codec = codecs[iSel];
@@ -133,7 +146,9 @@ static void SetupDefaultCaps(AM_MEDIA_TYPE* pmt, VIDEO_STREAM_CONFIG_CAPS& caps) {
memset(&caps, 0, sizeof(caps));
- if(!pmt) return;
+ if(!pmt) {
+ return;
+ }
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->pbFormat;
UNUSED_ALWAYS(vih);
@@ -166,7 +181,9 @@ static void SetupDefaultCaps(AM_MEDIA_TYPE* pmt, AUDIO_STREAM_CONFIG_CAPS& caps) {
memset(&caps, 0, sizeof(caps));
- if(!pmt) return;
+ if(!pmt) {
+ return;
+ }
WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->pbFormat;
@@ -188,39 +205,38 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo type.EnableWindow(FALSE);
dim.EnableWindow(FALSE);
- if(!pAMSC) return;
+ if(!pAMSC) {
+ return;
+ }
AM_MEDIA_TYPE* pcurmt = NULL;
pAMSC->GetFormat(&pcurmt);
int iCount = 0, iSize;
if(SUCCEEDED(pAMSC->GetNumberOfCapabilities(&iCount, &iSize))
- && iSize == sizeof(T) && iCount > 0)
- {
- for(int i = 0; i < iCount; i++)
- {
+ && iSize == sizeof(T) && iCount > 0) {
+ for(int i = 0; i < iCount; i++) {
T caps;
AM_MEDIA_TYPE* pmt = NULL;
- if(SUCCEEDED(pAMSC->GetStreamCaps(i, &pmt, (BYTE*)&caps)))
- {
+ if(SUCCEEDED(pAMSC->GetStreamCaps(i, &pmt, (BYTE*)&caps))) {
tfa.AddFormat(pmt, caps);
}
}
- if(iSize == sizeof(VIDEO_STREAM_CONFIG_CAPS))
- {
- for(int i = 0, cnt = tfa.GetCount(); i < cnt; i++)
- {
- if(tfa[i]->GetCount() != 1) continue;
+ if(iSize == sizeof(VIDEO_STREAM_CONFIG_CAPS)) {
+ for(int i = 0, cnt = tfa.GetCount(); i < cnt; i++) {
+ if(tfa[i]->GetCount() != 1) {
+ continue;
+ }
CFormatElem<T>* pfe = tfa[i]->GetAt(0);
if(pfe->mt.formattype != FORMAT_VideoInfo
- && pfe->mt.formattype != FORMAT_VideoInfo2)
+ && pfe->mt.formattype != FORMAT_VideoInfo2) {
continue;
+ }
- static SIZE presets[] =
- {
+ static SIZE presets[] = {
{160, 120}, {192, 144},
{320, 240}, {384, 288},
{480, 240}, {512, 288},
@@ -239,8 +255,7 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo BITMAPINFOHEADER bihCur;
ExtractBIH(&pfe->mt, &bihCur);
- for(int j = 0; j < countof(presets); j++)
- {
+ for(int j = 0; j < countof(presets); j++) {
if(presets[j].cx == bihCur.biWidth
&& presets[j].cy == abs(bihCur.biHeight)
|| presets[j].cx < pcaps->MinOutputSize.cx
@@ -248,15 +263,17 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo || presets[j].cy < pcaps->MinOutputSize.cy
|| presets[j].cy > pcaps->MaxOutputSize.cy
|| presets[j].cx % pcaps->OutputGranularityX
- || presets[j].cy % pcaps->OutputGranularityY)
+ || presets[j].cy % pcaps->OutputGranularityY) {
continue;
+ }
CMediaType mt = pfe->mt;
- if(mt.formattype == FORMAT_VideoInfo)
- {
+ if(mt.formattype == FORMAT_VideoInfo) {
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.pbFormat;
- if(!vih->bmiHeader.biHeight) vih->bmiHeader.biHeight = 1;
+ if(!vih->bmiHeader.biHeight) {
+ vih->bmiHeader.biHeight = 1;
+ }
vih->bmiHeader.biWidth = presets[j].cx;
vih->bmiHeader.biHeight = presets[j].cy*(vih->bmiHeader.biHeight/vih->bmiHeader.biHeight);
vih->bmiHeader.biSizeImage = presets[j].cx*presets[j].cy*vih->bmiHeader.biBitCount>>3;
@@ -265,8 +282,7 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo CopyMediaType(pmt, &mt);
tfa.AddFormat(pmt, pcaps, sizeof(*pcaps));
- if(presets[j].cx*3 != presets[j].cy*4)
- {
+ if(presets[j].cx*3 != presets[j].cy*4) {
int extra = mt.cbFormat - sizeof(VIDEOINFOHEADER);
int bmiHeaderSize = sizeof(vih->bmiHeader) + extra;
BYTE* pbmiHeader = DNew BYTE[bmiHeaderSize];
@@ -284,11 +300,11 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo CopyMediaType(pmt, &mt);
tfa.AddFormat(pmt, pcaps, sizeof(*pcaps));
}
- }
- else if(mt.formattype == FORMAT_VideoInfo2)
- {
+ } else if(mt.formattype == FORMAT_VideoInfo2) {
VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mt.pbFormat;
- if(!vih2->bmiHeader.biHeight) vih2->bmiHeader.biHeight = 1;
+ if(!vih2->bmiHeader.biHeight) {
+ vih2->bmiHeader.biHeight = 1;
+ }
vih2->bmiHeader.biWidth = presets[j].cx;
vih2->bmiHeader.biHeight = presets[j].cy*(vih2->bmiHeader.biHeight/vih2->bmiHeader.biHeight);
vih2->bmiHeader.biSizeImage = presets[j].cx*presets[j].cy*vih2->bmiHeader.biBitCount>>3;
@@ -304,26 +320,23 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo }
}
- if(tfa.GetCount() == 0)
- {
- if(pcurmt && (pcurmt->majortype == MEDIATYPE_Video || pcurmt->majortype == MEDIATYPE_Audio))
- {
+ if(tfa.GetCount() == 0) {
+ if(pcurmt && (pcurmt->majortype == MEDIATYPE_Video || pcurmt->majortype == MEDIATYPE_Audio)) {
AM_MEDIA_TYPE* pmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
CopyMediaType(pmt, pcurmt);
T caps;
SetupDefaultCaps(pmt, caps);
tfa.AddFormat(pmt, caps);
- }
- else
- {
+ } else {
mt.majortype = GUID_NULL;
- if(pcurmt) DeleteMediaType(pcurmt);
+ if(pcurmt) {
+ DeleteMediaType(pcurmt);
+ }
return;
}
}
- for(int i = 0; i < (int)tfa.GetCount(); i++)
- {
+ for(int i = 0; i < (int)tfa.GetCount(); i++) {
CFormat<T>* pf = tfa[i];
int j = type.AddString(pf->name);
type.SetItemData(j, (DWORD_PTR)pf);
@@ -332,39 +345,44 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo CFormat<T>* pf = NULL;
CFormatElem<T>* pfe = NULL;
- if(!pcurmt)
- {
+ if(!pcurmt) {
pf = tfa[0];
pfe = pf->GetAt(0);
- }
- else if(!tfa.FindFormat(pcurmt, NULL, &pf, &pfe) && !tfa.FindFormat(pcurmt, &pf))
- {
- if(pcurmt) DeleteMediaType(pcurmt);
+ } else if(!tfa.FindFormat(pcurmt, NULL, &pf, &pfe) && !tfa.FindFormat(pcurmt, &pf)) {
+ if(pcurmt) {
+ DeleteMediaType(pcurmt);
+ }
return;
}
- for(int i = 0; i < (int)pf->GetCount(); i++)
- {
+ for(int i = 0; i < (int)pf->GetCount(); i++) {
CFormatElem<T>* pfe = pf->GetAt(i);
int j = dim.AddString(tfa.MakeDimensionName(pfe));
dim.SetItemData(j, (DWORD_PTR)pfe);
}
int iType = type.SetCurSel(type.FindStringExact(0, pf->name));
- if(iType < 0 && type.GetCount()) type.SetCurSel(0);
+ if(iType < 0 && type.GetCount()) {
+ type.SetCurSel(0);
+ }
int iDim = dim.SetCurSel(dim.FindStringExact(0, tfa.MakeDimensionName(pfe)));
-// if(iDim < 0 && dim.GetCount()) dim.SetCurSel(iDim = 0);
+ // if(iDim < 0 && dim.GetCount()) dim.SetCurSel(iDim = 0);
CorrectComboListWidth(type, type.GetParent()->GetFont());
CorrectComboListWidth(dim, dim.GetParent()->GetFont());
- if(iDim >= 0) mt = ((CFormatElem<T>*)dim.GetItemData(iDim))->mt;
- else if(pcurmt) mt = *pcurmt;
+ if(iDim >= 0) {
+ mt = ((CFormatElem<T>*)dim.GetItemData(iDim))->mt;
+ } else if(pcurmt) {
+ mt = *pcurmt;
+ }
type.EnableWindow(type.GetCount() > 0);
dim.EnableWindow(dim.GetCount() > 0);
- if(pcurmt) DeleteMediaType(pcurmt);
+ if(pcurmt) {
+ DeleteMediaType(pcurmt);
+ }
}
template<class T>
@@ -377,12 +395,13 @@ static bool SetupDimension(CFormatArray<T>& tfa, CComboBox& type, CComboBox& dim dim.EnableWindow(FALSE);
int iSel = type.GetCurSel();
- if(iSel < 0) return(false);
+ if(iSel < 0) {
+ return(false);
+ }
CFormat<T>* pf = (CFormat<T>*)type.GetItemData(iSel);
- for(int i = 0; i < (int)pf->GetCount(); i++)
- {
+ for(int i = 0; i < (int)pf->GetCount(); i++) {
CFormatElem<T>* pfe = pf->GetAt(i);
dim.SetItemData(dim.AddString(tfa.MakeDimensionName(pfe)), (DWORD_PTR)pfe);
}
@@ -403,8 +422,7 @@ static void InitCodecList(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& box.SetItemData(box.AddString(_T("Uncompressed")), (DWORD_PTR)-1);
- BeginEnumSysDev(cat, pMoniker)
- {
+ BeginEnumSysDev(cat, pMoniker) {
Codec c;
c.pMoniker = pMoniker;
@@ -416,8 +434,9 @@ static void InitCodecList(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& c.pBF = pBF;
*/
LPOLESTR strName = NULL;
- if(FAILED(pMoniker->GetDisplayName(NULL, NULL, &strName)))
+ if(FAILED(pMoniker->GetDisplayName(NULL, NULL, &strName))) {
continue;
+ }
c.DisplayName = strName;
CoTaskMemFree(strName);
@@ -426,18 +445,20 @@ static void InitCodecList(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB);
CComVariant var;
- if(FAILED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
+ if(FAILED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL))) {
continue;
+ }
c.FriendlyName = var.bstrVal;
CStringW str = CStringW(c.DisplayName).MakeLower();
- if(str.Find(L"@device:dmo:") == 0)
+ if(str.Find(L"@device:dmo:") == 0) {
c.FriendlyName = _T("(DMO) ") + c.FriendlyName;
- else if(str.Find(L"@device:sw:") == 0)
+ } else if(str.Find(L"@device:sw:") == 0) {
c.FriendlyName = _T("(DS) ") + c.FriendlyName;
- else if(str.Find(L"@device:cm:") == 0)
+ } else if(str.Find(L"@device:cm:") == 0) {
c.FriendlyName = _T("(VfW) ") + c.FriendlyName;
+ }
box.SetItemData(
box.AddString(c.FriendlyName),
@@ -455,24 +476,25 @@ static void InitCodecList(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& static int ShowPPage(CAtlArray<Codec>& codecs, CComboBox& box, HWND hWnd = NULL)
{
int iSel = box.GetCurSel();
- if(iSel < 0) return(-1);
+ if(iSel < 0) {
+ return(-1);
+ }
iSel = box.GetItemData(iSel);
- if(iSel < 0) return(-1);
+ if(iSel < 0) {
+ return(-1);
+ }
Codec& c = codecs[iSel];
- if(!c.pBF)
- {
+ if(!c.pBF) {
c.pMoniker->BindToObject(NULL, NULL, __uuidof(IBaseFilter), (void**)&c.pBF);
}
- if(CComQIPtr<ISpecifyPropertyPages> pSPP = c.pBF)
- {
+ if(CComQIPtr<ISpecifyPropertyPages> pSPP = c.pBF) {
CAUUID caGUID;
caGUID.pElems = NULL;
- if(SUCCEEDED(pSPP->GetPages(&caGUID)))
- {
+ if(SUCCEEDED(pSPP->GetPages(&caGUID))) {
IUnknown* lpUnk = NULL;
pSPP.QueryInterface(&lpUnk);
OleCreatePropertyFrame(
@@ -482,13 +504,14 @@ static int ShowPPage(CAtlArray<Codec>& codecs, CComboBox& box, HWND hWnd = NULL) 0, 0, NULL);
lpUnk->Release();
- if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
+ if(caGUID.pElems) {
+ CoTaskMemFree(caGUID.pElems);
+ }
}
- }
- else if(CComQIPtr<IAMVfwCompressDialogs> pAMVfWCD = c.pBF)
- {
- if(pAMVfWCD->ShowDialog(VfwCompressDialog_QueryConfig, NULL) == S_OK)
+ } else if(CComQIPtr<IAMVfwCompressDialogs> pAMVfWCD = c.pBF) {
+ if(pAMVfWCD->ShowDialog(VfwCompressDialog_QueryConfig, NULL) == S_OK) {
pAMVfWCD->ShowDialog(VfwCompressDialog_Config, hWnd);
+ }
}
return(iSel);
@@ -522,8 +545,9 @@ CPlayerCaptureDialog::~CPlayerCaptureDialog() BOOL CPlayerCaptureDialog::Create(CWnd* pParent)
{
- if(!__super::Create(IDD, pParent))
+ if(!__super::Create(IDD, pParent)) {
return FALSE;
+ }
EmptyVideo();
EmptyAudio();
@@ -571,13 +595,10 @@ void CPlayerCaptureDialog::DoDataExchange(CDataExchange* pDX) BOOL CPlayerCaptureDialog::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN)
- {
- if(pMsg->wParam == VK_RETURN)
- {
+ if(pMsg->message == WM_KEYDOWN) {
+ if(pMsg->wParam == VK_RETURN) {
CWnd* pFocused = GetFocus();
- if(pFocused && pFocused->m_hWnd == m_vidfpsedit.m_hWnd)
- {
+ if(pFocused && pFocused->m_hWnd == m_vidfpsedit.m_hWnd) {
UpdateGraph();
}
}
@@ -591,8 +612,7 @@ void CPlayerCaptureDialog::EmptyVideo() {
// first save channel from previous session
- if(m_pAMTuner && !m_VidDisplayName.IsEmpty())
- {
+ if(m_pAMTuner && !m_VidDisplayName.IsEmpty()) {
long lChannel = 0, lVivSub = 0, lAudSub = 0;
m_pAMTuner->get_Channel(&lChannel, &lVivSub, &lAudSub);
AfxGetApp()->WriteProfileInt(IDS_RS_CAPTURE _T("\\") + CString(m_VidDisplayName), _T("Channel"), lChannel);
@@ -606,8 +626,7 @@ void CPlayerCaptureDialog::EmptyVideo() m_pAMTuner = NULL;
m_pAMVSC = NULL;
- if(IsWindow(m_hWnd))
- {
+ if(IsWindow(m_hWnd)) {
m_vidinput.ResetContent();
m_vidinput.EnableWindow(FALSE);
m_vidtype.ResetContent();
@@ -632,8 +651,7 @@ void CPlayerCaptureDialog::EmptyAudio() m_pAMASC = NULL;
m_pAMAIM.RemoveAll();
- if(IsWindow(m_hWnd))
- {
+ if(IsWindow(m_hWnd)) {
m_audinput.ResetContent();
m_audinput.EnableWindow(FALSE);
m_audtype.ResetContent();
@@ -652,11 +670,12 @@ void CPlayerCaptureDialog::UpdateMediaTypes() CString fps;
m_vidfpsedit.GetWindowText(fps);
- if(!fps.IsEmpty())
- {
+ if(!fps.IsEmpty()) {
float ffps;
_stscanf_s(fps, _T("%f"), &ffps);
- if(ffps > 0) m_vidfps = ffps;
+ if(ffps > 0) {
+ m_vidfps = ffps;
+ }
}
// video
@@ -666,33 +685,28 @@ void CPlayerCaptureDialog::UpdateMediaTypes() VIDEO_STREAM_CONFIG_CAPS* pcaps = NULL;
int i = m_viddimension.GetCurSel();
- if(i >= 0)
- {
+ if(i >= 0) {
pmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
CopyMediaType(pmt, &((CVidFormatElem*)m_viddimension.GetItemData(i))->mt);
pcaps = &((CVidFormatElem*)m_viddimension.GetItemData(i))->caps;
- }
- else if(m_pAMVSC)
- {
+ } else if(m_pAMVSC) {
m_pAMVSC->GetFormat(&pmt);
}
- if(pmt)
- {
- if(m_vidfps > 0)
- {
+ if(pmt) {
+ if(m_vidfps > 0) {
REFERENCE_TIME atpf = (REFERENCE_TIME)(10000000.0 / m_vidfps);
- if(pcaps)
- {
+ if(pcaps) {
// FIXME: some drivers do not set the interval right and they still accept the preferable but unfortunately out-of-range fps
-// atpf = min(max(atpf, pcaps->MinFrameInterval), pcaps->MaxFrameInterval);
+ // atpf = min(max(atpf, pcaps->MinFrameInterval), pcaps->MaxFrameInterval);
}
- if(pmt->formattype == FORMAT_VideoInfo)
+ if(pmt->formattype == FORMAT_VideoInfo) {
((VIDEOINFOHEADER*)pmt->pbFormat)->AvgTimePerFrame = atpf;
- else if(pmt->formattype == FORMAT_VideoInfo2)
+ } else if(pmt->formattype == FORMAT_VideoInfo2) {
((VIDEOINFOHEADER2*)pmt->pbFormat)->AvgTimePerFrame = atpf;
+ }
}
BITMAPINFOHEADER* bih = (pmt->formattype == FORMAT_VideoInfo)
@@ -718,18 +732,14 @@ void CPlayerCaptureDialog::UpdateMediaTypes() AM_MEDIA_TYPE* pmt = NULL;
int i = m_auddimension.GetCurSel();
- if(i >= 0)
- {
+ if(i >= 0) {
pmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
CopyMediaType(pmt, &((CAudFormatElem*)m_auddimension.GetItemData(i))->mt);
- }
- else if(m_pAMASC)
- {
+ } else if(m_pAMASC) {
m_pAMASC->GetFormat(&pmt);
}
- if(pmt)
- {
+ if(pmt) {
SaveMediaType(m_AudDisplayName, pmt);
m_mta = *pmt;
@@ -741,16 +751,24 @@ void CPlayerCaptureDialog::UpdateMediaTypes() void CPlayerCaptureDialog::UpdateUserDefinableControls()
{
int iSel = m_viddimension.GetCurSel();
- if(iSel < 0) return;
+ if(iSel < 0) {
+ return;
+ }
CVidFormatElem* pvfe = (CVidFormatElem*)m_viddimension.GetItemData(iSel);
- if(!pvfe) return;
+ if(!pvfe) {
+ return;
+ }
- if(!m_pAMVSC) return;
+ if(!m_pAMVSC) {
+ return;
+ }
AM_MEDIA_TYPE* pmt = NULL;
m_pAMVSC->GetFormat(&pmt);
- if(!pmt) return;
+ if(!pmt) {
+ return;
+ }
BITMAPINFOHEADER* bih = (pmt->formattype == FORMAT_VideoInfo)
? &((VIDEOINFOHEADER*)pmt->pbFormat)->bmiHeader
@@ -758,7 +776,9 @@ void CPlayerCaptureDialog::UpdateUserDefinableControls() ? &((VIDEOINFOHEADER2*)pmt->pbFormat)->bmiHeader
: NULL;
- if(!bih) return;
+ if(!bih) {
+ return;
+ }
UDACCEL ua[3] = {{0,0},{2,0},{4,0}};
@@ -794,37 +814,41 @@ void CPlayerCaptureDialog::UpdateUserDefinableControls() void CPlayerCaptureDialog::UpdateVideoCodec()
{
int iSel = m_vidcodec.GetCurSel();
- if(iSel >= 0) iSel = m_vidcodec.GetItemData(iSel);
+ if(iSel >= 0) {
+ iSel = m_vidcodec.GetItemData(iSel);
+ }
m_pVidEnc = iSel < 0 ? NULL : m_pVidEncArray[iSel].pBF;
m_pVidEncMoniker = iSel < 0 ? NULL : m_pVidEncArray[iSel].pMoniker;
-// CString DisplayName = iSel < 0 ? _T("") : CString(m_pVidEncArray[iSel].DisplayName.m_str);
+ // CString DisplayName = iSel < 0 ? _T("") : CString(m_pVidEncArray[iSel].DisplayName.m_str);
CComQIPtr<IAMStreamConfig> pAMSC = GetFirstPin(m_pVidEnc, PINDIR_OUTPUT);
SetupMediaTypes(pAMSC, m_vcfa, m_vidcodectype, m_vidcodecdimension, m_mtcv);
SaveDefaultCodec(m_pVidEncArray, m_vidcodec, CLSID_VideoCompressorCategory);
-// SaveMediaType(DisplayName, &m_mtcv);
+ // SaveMediaType(DisplayName, &m_mtcv);
}
void CPlayerCaptureDialog::UpdateAudioCodec()
{
int iSel = m_audcodec.GetCurSel();
- if(iSel >= 0) iSel = m_audcodec.GetItemData(iSel);
+ if(iSel >= 0) {
+ iSel = m_audcodec.GetItemData(iSel);
+ }
m_pAudEnc = iSel < 0 ? NULL : m_pAudEncArray[iSel].pBF;
m_pAudEncMoniker = iSel < 0 ? NULL : m_pAudEncArray[iSel].pMoniker;
-// CString DisplayName = iSel < 0 ? _T("") : CString(m_pAudEncArray[iSel].DisplayName.m_str);
+ // CString DisplayName = iSel < 0 ? _T("") : CString(m_pAudEncArray[iSel].DisplayName.m_str);
CComQIPtr<IAMStreamConfig> pAMSC = GetFirstPin(m_pAudEnc, PINDIR_OUTPUT);
SetupMediaTypes(pAMSC, m_acfa, m_audcodectype, m_audcodecdimension, m_mtca);
SaveDefaultCodec(m_pAudEncArray, m_audcodec, CLSID_AudioCompressorCategory);
-// SaveMediaType(DisplayName, &m_mtca);
+ // SaveMediaType(DisplayName, &m_mtca);
}
void CPlayerCaptureDialog::UpdateMuxer()
@@ -836,13 +860,21 @@ void CPlayerCaptureDialog::UpdateMuxer() HRESULT hr;
- if(m_muxtype == 0) m_pMux.CoCreateInstance(CLSID_AviDest);
- else if(m_muxtype == 1) m_pMux.CoCreateInstance(CLSID_OggMux);
- else if(m_muxtype == 2) m_pMux = DNew CMatroskaMuxerFilter(NULL, &hr);
- else if(m_muxtype == 3) m_pMux = DNew CDSMMuxerFilter(NULL, &hr);
- else return;
+ if(m_muxtype == 0) {
+ m_pMux.CoCreateInstance(CLSID_AviDest);
+ } else if(m_muxtype == 1) {
+ m_pMux.CoCreateInstance(CLSID_OggMux);
+ } else if(m_muxtype == 2) {
+ m_pMux = DNew CMatroskaMuxerFilter(NULL, &hr);
+ } else if(m_muxtype == 3) {
+ m_pMux = DNew CDSMMuxerFilter(NULL, &hr);
+ } else {
+ return;
+ }
- if(m_fSepAudio) m_pAudMux = DNew CWavDestFilter(NULL, &hr);
+ if(m_fSepAudio) {
+ m_pAudMux = DNew CWavDestFilter(NULL, &hr);
+ }
}
void CPlayerCaptureDialog::UpdateOutputControls()
@@ -858,7 +890,7 @@ void CPlayerCaptureDialog::UpdateGraph() {
UpdateMediaTypes();
-// UpdateMuxer();
+ // UpdateMuxer();
((CMainFrame*)AfxGetMainWnd())->BuildGraphVideoAudio(m_fVidPreview, false, m_fAudPreview, false);
@@ -867,28 +899,26 @@ void CPlayerCaptureDialog::UpdateGraph() void CPlayerCaptureDialog::EnableControls(CWnd* pWnd, bool fEnable)
{
- if(fEnable)
- {
- for(CWnd* pChild = pWnd->GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
- {
+ if(fEnable) {
+ for(CWnd* pChild = pWnd->GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) {
BOOL fEnabled;
- if(m_wndenabledmap.Lookup(pChild->m_hWnd, fEnabled))
+ if(m_wndenabledmap.Lookup(pChild->m_hWnd, fEnabled)) {
pChild->EnableWindow(fEnabled);
+ }
EnableControls(pChild, fEnable);
}
- if(pWnd->m_hWnd == m_hWnd)
+ if(pWnd->m_hWnd == m_hWnd) {
m_wndenabledmap.RemoveAll();
+ }
m_recordbtn.SetWindowText(_T("Record"));
- }
- else
- {
- if(pWnd->m_hWnd == m_hWnd)
+ } else {
+ if(pWnd->m_hWnd == m_hWnd) {
m_wndenabledmap.RemoveAll();
+ }
- for(CWnd* pChild = pWnd->GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
- {
+ for(CWnd* pChild = pWnd->GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) {
m_wndenabledmap[pChild->m_hWnd] = pChild->IsWindowEnabled();
pChild->EnableWindow(FALSE);
EnableControls(pChild, fEnable);
@@ -907,68 +937,66 @@ void CPlayerCaptureDialog::SetupVideoControls( // crossbar
- if(m_pAMXB = pAMXB)
- {
+ if(m_pAMXB = pAMXB) {
long OutputPinCount, InputPinCount;
- if(SUCCEEDED(pAMXB->get_PinCounts(&OutputPinCount, &InputPinCount)))
- {
- for(int i = 0; i < InputPinCount; i++)
- {
+ if(SUCCEEDED(pAMXB->get_PinCounts(&OutputPinCount, &InputPinCount))) {
+ for(int i = 0; i < InputPinCount; i++) {
long PinIndexRelated, PhysicalType;
- if(FAILED(pAMXB->get_CrossbarPinInfo(TRUE, i, &PinIndexRelated, &PhysicalType)))
+ if(FAILED(pAMXB->get_CrossbarPinInfo(TRUE, i, &PinIndexRelated, &PhysicalType))) {
continue;
+ }
- if(PhysicalType >= PhysConn_Audio_Tuner)
+ if(PhysicalType >= PhysConn_Audio_Tuner) {
continue;
+ }
CString str;
- switch(PhysicalType)
- {
- case PhysConn_Video_Tuner:
- str = _T("Tuner");
- break;
- case PhysConn_Video_Composite:
- str = _T("Composite");
- break;
- case PhysConn_Video_SVideo:
- str = _T("SVideo");
- break;
- case PhysConn_Video_RGB:
- str = _T("RGB");
- break;
- case PhysConn_Video_YRYBY:
- str = _T("YRYBY");
- break;
- case PhysConn_Video_SerialDigital:
- str = _T("SerialDigital");
- break;
- case PhysConn_Video_ParallelDigital:
- str = _T("ParallelDigital");
- break;
- case PhysConn_Video_SCSI:
- str = _T("SCSI");
- break;
- case PhysConn_Video_AUX:
- str = _T("AUX");
- break;
- case PhysConn_Video_1394:
- str = _T("1394");
- break;
- case PhysConn_Video_USB:
- str = _T("USB");
- break;
- case PhysConn_Video_VideoDecoder:
- str = _T("VideoDecoder");
- break;
- case PhysConn_Video_VideoEncoder:
- str = _T("VideoEncoder");
- break;
- case PhysConn_Video_SCART:
- str = _T("SCART");
- break;
- default:
- str.Format(_T("PhysicalType %d"), PhysicalType);
- break;
+ switch(PhysicalType) {
+ case PhysConn_Video_Tuner:
+ str = _T("Tuner");
+ break;
+ case PhysConn_Video_Composite:
+ str = _T("Composite");
+ break;
+ case PhysConn_Video_SVideo:
+ str = _T("SVideo");
+ break;
+ case PhysConn_Video_RGB:
+ str = _T("RGB");
+ break;
+ case PhysConn_Video_YRYBY:
+ str = _T("YRYBY");
+ break;
+ case PhysConn_Video_SerialDigital:
+ str = _T("SerialDigital");
+ break;
+ case PhysConn_Video_ParallelDigital:
+ str = _T("ParallelDigital");
+ break;
+ case PhysConn_Video_SCSI:
+ str = _T("SCSI");
+ break;
+ case PhysConn_Video_AUX:
+ str = _T("AUX");
+ break;
+ case PhysConn_Video_1394:
+ str = _T("1394");
+ break;
+ case PhysConn_Video_USB:
+ str = _T("USB");
+ break;
+ case PhysConn_Video_VideoDecoder:
+ str = _T("VideoDecoder");
+ break;
+ case PhysConn_Video_VideoEncoder:
+ str = _T("VideoEncoder");
+ break;
+ case PhysConn_Video_SCART:
+ str = _T("SCART");
+ break;
+ default:
+ str.Format(_T("PhysicalType %d"), PhysicalType);
+ break;
}
m_vidinput.SetItemData(m_vidinput.AddString(str), i);
@@ -976,22 +1004,16 @@ void CPlayerCaptureDialog::SetupVideoControls( }
}
- if(m_vidinput.GetCount() > 0)
- {
+ if(m_vidinput.GetCount() > 0) {
m_vidinput.EnableWindow(TRUE);
long OutputPinCount, InputPinCount;
- if(SUCCEEDED(pAMXB->get_PinCounts(&OutputPinCount, &InputPinCount)))
- {
- for(int i = 0; i < OutputPinCount; i++)
- {
+ if(SUCCEEDED(pAMXB->get_PinCounts(&OutputPinCount, &InputPinCount))) {
+ for(int i = 0; i < OutputPinCount; i++) {
long InputPinIndex;
- if(S_OK == pAMXB->get_IsRoutedTo(i, &InputPinIndex))
- {
- for(int j = 0; j < m_vidinput.GetCount(); j++)
- {
- if(m_vidinput.GetItemData(j) == (DWORD_PTR)InputPinIndex)
- {
+ if(S_OK == pAMXB->get_IsRoutedTo(i, &InputPinIndex)) {
+ for(int j = 0; j < m_vidinput.GetCount(); j++) {
+ if(m_vidinput.GetItemData(j) == (DWORD_PTR)InputPinIndex) {
m_vidinput.SetCurSel(j);
i = OutputPinCount;
break;
@@ -1005,20 +1027,17 @@ void CPlayerCaptureDialog::SetupVideoControls( // tuner
- if(m_pAMTuner = pAMTuner)
- {
+ if(m_pAMTuner = pAMTuner) {
// TODO:...
}
// streamconfig
- if(m_pAMVSC = pAMSC)
- {
+ if(m_pAMVSC = pAMSC) {
m_VidDisplayName = DisplayName;
AM_MEDIA_TYPE* pmt;
- if(LoadMediaType(DisplayName, &pmt))
- {
+ if(LoadMediaType(DisplayName, &pmt)) {
pAMSC->SetFormat(pmt);
DeleteMediaType(pmt);
}
@@ -1026,8 +1045,7 @@ void CPlayerCaptureDialog::SetupVideoControls( SetupMediaTypes(pAMSC, m_vfa, m_vidtype, m_viddimension, m_mtv);
}
- if(m_vidtype.GetCount() > 0)
- {
+ if(m_vidtype.GetCount() > 0) {
m_vidfpsedit.EnableWindow(TRUE);
m_vidhor.EnableWindow(TRUE);
m_vidver.EnableWindow(TRUE);
@@ -1054,17 +1072,18 @@ void CPlayerCaptureDialog::SetupVideoControls( {
EmptyVideo();
- if(m_pAMVfwCD = pAMVfwCD)
- {
- if(S_OK == m_pAMVfwCD->HasDialog(VfwCaptureDialog_Source))
+ if(m_pAMVfwCD = pAMVfwCD) {
+ if(S_OK == m_pAMVfwCD->HasDialog(VfwCaptureDialog_Source)) {
m_vidinput.SetItemData(m_vidinput.AddString(_T("Source")), (DWORD_PTR)VfwCaptureDialog_Source);
- if(S_OK == m_pAMVfwCD->HasDialog(VfwCaptureDialog_Format))
+ }
+ if(S_OK == m_pAMVfwCD->HasDialog(VfwCaptureDialog_Format)) {
m_vidinput.SetItemData(m_vidinput.AddString(_T("Format")), (DWORD_PTR)VfwCaptureDialog_Format);
- if(S_OK == m_pAMVfwCD->HasDialog(VfwCaptureDialog_Display))
+ }
+ if(S_OK == m_pAMVfwCD->HasDialog(VfwCaptureDialog_Display)) {
m_vidinput.SetItemData(m_vidinput.AddString(_T("Display")), (DWORD_PTR)VfwCaptureDialog_Display);
+ }
- if(m_vidinput.GetCount() > 0)
- {
+ if(m_vidinput.GetCount() > 0) {
m_vidinput.EnableWindow(TRUE);
m_vidinput.SetCurSel(0);
}
@@ -1072,13 +1091,11 @@ void CPlayerCaptureDialog::SetupVideoControls( // streamconfig
- if(m_pAMVSC = pAMSC)
- {
+ if(m_pAMVSC = pAMSC) {
m_VidDisplayName = DisplayName;
AM_MEDIA_TYPE* pmt;
- if(LoadMediaType(DisplayName, &pmt))
- {
+ if(LoadMediaType(DisplayName, &pmt)) {
pAMSC->SetFormat(pmt);
DeleteMediaType(pmt);
}
@@ -1086,8 +1103,7 @@ void CPlayerCaptureDialog::SetupVideoControls( SetupMediaTypes(pAMSC, m_vfa, m_vidtype, m_viddimension, m_mtv);
}
- if(m_vidtype.GetCount() > 0)
- {
+ if(m_vidtype.GetCount() > 0) {
m_vidfpsedit.EnableWindow(TRUE);
m_vidhor.EnableWindow(TRUE);
m_vidver.EnableWindow(TRUE);
@@ -1116,28 +1132,24 @@ void CPlayerCaptureDialog::SetupAudioControls( // input selection
- if(pAMAIM.GetCount() > 0)
- {
+ if(pAMAIM.GetCount() > 0) {
m_pAMAIM.Copy(pAMAIM);
int iSel = -1;
- for(int i = 0; i < (int)m_pAMAIM.GetCount(); i++)
- {
+ for(int i = 0; i < (int)m_pAMAIM.GetCount(); i++) {
CComQIPtr<IPin> pPin = m_pAMAIM[i];
m_audinput.SetItemData(m_audinput.AddString(CString(GetPinName(pPin))), (DWORD_PTR)i);
BOOL fEnable;
- if(SUCCEEDED(m_pAMAIM[i]->get_Enable(&fEnable)) && fEnable)
+ if(SUCCEEDED(m_pAMAIM[i]->get_Enable(&fEnable)) && fEnable) {
iSel = i;
+ }
}
- if(m_audinput.GetCount() > 0)
- {
- for(int i = 0; i < m_audinput.GetCount(); i++)
- {
- if(m_audinput.GetItemData(i) == (DWORD_PTR)iSel)
- {
+ if(m_audinput.GetCount() > 0) {
+ for(int i = 0; i < m_audinput.GetCount(); i++) {
+ if(m_audinput.GetItemData(i) == (DWORD_PTR)iSel) {
m_audinput.SetCurSel(i);
break;
}
@@ -1149,13 +1161,11 @@ void CPlayerCaptureDialog::SetupAudioControls( // stream config
- if(m_pAMASC = pAMSC)
- {
+ if(m_pAMASC = pAMSC) {
m_AudDisplayName = DisplayName;
AM_MEDIA_TYPE* pmt;
- if(LoadMediaType(DisplayName, &pmt))
- {
+ if(LoadMediaType(DisplayName, &pmt)) {
pAMSC->SetFormat(pmt);
DeleteMediaType(pmt);
}
@@ -1163,7 +1173,7 @@ void CPlayerCaptureDialog::SetupAudioControls( SetupMediaTypes(pAMSC, m_afa, m_audtype, m_auddimension, m_mta);
}
-// if(m_audtype.GetCount() > 0)
+ // if(m_audtype.GetCount() > 0)
{
m_audoutput.EnableWindow(TRUE);
m_audpreview.EnableWindow(TRUE);
@@ -1179,9 +1189,13 @@ void CPlayerCaptureDialog::SetupAudioControls( bool CPlayerCaptureDialog::IsTunerActive()
{
int iSel = m_vidinput.GetCurSel();
- if(iSel < 0) return(false);
+ if(iSel < 0) {
+ return(false);
+ }
iSel = m_vidinput.GetItemData(iSel);
- if(iSel < 0) return(false);
+ if(iSel < 0) {
+ return(false);
+ }
long PinIndexRelated, PhysicalType;
return(m_pAMXB
@@ -1191,12 +1205,12 @@ bool CPlayerCaptureDialog::IsTunerActive() bool CPlayerCaptureDialog::SetVideoInput(int input)
{
- if(!m_pAMXB || input < 0) return false;
+ if(!m_pAMXB || input < 0) {
+ return false;
+ }
- for(int i = 0; i < m_vidinput.GetCount(); i++)
- {
- if(m_vidinput.GetItemData(i) == (DWORD_PTR)input)
- {
+ for(int i = 0; i < m_vidinput.GetCount(); i++) {
+ if(m_vidinput.GetItemData(i) == (DWORD_PTR)input) {
m_vidinput.SetCurSel(i);
OnVideoInput();
return true;
@@ -1208,19 +1222,21 @@ bool CPlayerCaptureDialog::SetVideoInput(int input) bool CPlayerCaptureDialog::SetVideoChannel(int channel)
{
- if(!m_pAMTuner || channel < 0) return false;
+ if(!m_pAMTuner || channel < 0) {
+ return false;
+ }
return SUCCEEDED(m_pAMTuner->put_Channel(channel, AMTUNER_SUBCHAN_DEFAULT, AMTUNER_SUBCHAN_DEFAULT));
}
bool CPlayerCaptureDialog::SetAudioInput(int input)
{
- if(input < 0) return false;
+ if(input < 0) {
+ return false;
+ }
- for(int i = 0; i < m_audinput.GetCount(); i++)
- {
- if(m_audinput.GetItemData(i) == (DWORD_PTR)input)
- {
+ for(int i = 0; i < m_audinput.GetCount(); i++) {
+ if(m_audinput.GetItemData(i) == (DWORD_PTR)input) {
m_audinput.SetCurSel(i);
OnAudioInput();
return true;
@@ -1233,7 +1249,9 @@ bool CPlayerCaptureDialog::SetAudioInput(int input) int CPlayerCaptureDialog::GetVideoInput()
{
int i = m_vidinput.GetCurSel();
- if(i < 0) return -1;
+ if(i < 0) {
+ return -1;
+ }
return m_vidinput.GetItemData(i);
}
@@ -1246,7 +1264,9 @@ int CPlayerCaptureDialog::GetVideoChannel() int CPlayerCaptureDialog::GetAudioInput()
{
int i = m_audinput.GetCurSel();
- if(i < 0) return -1;
+ if(i < 0) {
+ return -1;
+ }
return m_audinput.GetItemData(i);
}
@@ -1308,7 +1328,7 @@ BOOL CPlayerCaptureDialog::OnInitDialog() m_muxctrl.AddString(_T("Matroska"));
m_muxctrl.AddString(_T("DirectShow Media"));
-// UpdateMuxer();
+ // UpdateMuxer();
UpdateData(FALSE);
@@ -1336,73 +1356,75 @@ void CPlayerCaptureDialog::OnDestroy() void CPlayerCaptureDialog::OnVideoInput()
{
int iSel = m_vidinput.GetCurSel();
- if(iSel < 0) return;
+ if(iSel < 0) {
+ return;
+ }
iSel = m_vidinput.GetItemData(iSel);
- if(iSel < 0) return;
+ if(iSel < 0) {
+ return;
+ }
- if(m_pAMXB)
- {
+ if(m_pAMXB) {
long PinIndexRelated, PhysicalType;
- if(FAILED(m_pAMXB->get_CrossbarPinInfo(TRUE, iSel, &PinIndexRelated, &PhysicalType)))
+ if(FAILED(m_pAMXB->get_CrossbarPinInfo(TRUE, iSel, &PinIndexRelated, &PhysicalType))) {
return;
+ }
long OutputPinCount, InputPinCount;
- if(FAILED(m_pAMXB->get_PinCounts(&OutputPinCount, &InputPinCount)))
+ if(FAILED(m_pAMXB->get_PinCounts(&OutputPinCount, &InputPinCount))) {
return;
+ }
- for(int i = 0; i < OutputPinCount; i++)
- {
- if(S_OK == m_pAMXB->CanRoute(i, iSel))
- {
+ for(int i = 0; i < OutputPinCount; i++) {
+ if(S_OK == m_pAMXB->CanRoute(i, iSel)) {
m_pAMXB->Route(i, iSel);
break;
}
}
- if(PinIndexRelated >= 0)
- {
- for(int i = 0; i < OutputPinCount; i++)
- {
- if(S_OK == m_pAMXB->CanRoute(i, PinIndexRelated))
- {
+ if(PinIndexRelated >= 0) {
+ for(int i = 0; i < OutputPinCount; i++) {
+ if(S_OK == m_pAMXB->CanRoute(i, PinIndexRelated)) {
m_pAMXB->Route(i, PinIndexRelated);
break;
}
}
}
- }
- else if(m_pAMVfwCD)
- {
- if(S_OK == m_pAMVfwCD->HasDialog(iSel))
- {
+ } else if(m_pAMVfwCD) {
+ if(S_OK == m_pAMVfwCD->HasDialog(iSel)) {
HRESULT hr = m_pAMVfwCD->ShowDialog(iSel, m_hWnd);
- if(VFW_E_NOT_STOPPED == hr)
- {
+ if(VFW_E_NOT_STOPPED == hr) {
((CMainFrame*)AfxGetMainWnd())->SendMessage(WM_COMMAND, ID_PLAY_STOP);
hr = m_pAMVfwCD->ShowDialog(iSel, m_hWnd);
((CMainFrame*)AfxGetMainWnd())->SendMessage(WM_COMMAND, ID_PLAY_PLAY);
}
- if(VFW_E_CANNOT_CONNECT == hr)
+ if(VFW_E_CANNOT_CONNECT == hr) {
UpdateGraph();
+ }
}
}
}
void CPlayerCaptureDialog::OnVideoType()
{
- if(SetupDimension(m_vfa, m_vidtype, m_viddimension))
+ if(SetupDimension(m_vfa, m_vidtype, m_viddimension)) {
OnVideoDimension();
+ }
}
void CPlayerCaptureDialog::OnVideoDimension()
{
int iSel = m_viddimension.GetCurSel();
- if(iSel < 0) return;
+ if(iSel < 0) {
+ return;
+ }
CVidFormatElem* pvfe = (CVidFormatElem*)m_viddimension.GetItemData(iSel);
- if(!pvfe) return;
+ if(!pvfe) {
+ return;
+ }
BITMAPINFOHEADER* bih = (pvfe->mt.formattype == FORMAT_VideoInfo)
? &((VIDEOINFOHEADER*)pvfe->mt.pbFormat)->bmiHeader
@@ -1430,16 +1452,16 @@ void CPlayerCaptureDialog::OnAudioInput() {
int iSel = m_audinput.GetCurSel();
- for(int i = 0; i < (int)m_pAMAIM.GetCount(); i++)
- {
+ for(int i = 0; i < (int)m_pAMAIM.GetCount(); i++) {
m_pAMAIM[m_audinput.GetItemData(i)]->put_Enable(i == iSel ? TRUE : FALSE);
}
}
void CPlayerCaptureDialog::OnAudioType()
{
- if(SetupDimension(m_afa, m_audtype, m_auddimension))
+ if(SetupDimension(m_afa, m_audtype, m_auddimension)) {
OnAudioDimension();
+ }
}
void CPlayerCaptureDialog::OnAudioDimension()
@@ -1460,15 +1482,15 @@ void CPlayerCaptureDialog::OnVideoCodec() void CPlayerCaptureDialog::OnVideoCodecType()
{
- if(SetupDimension(m_vcfa, m_vidcodectype, m_vidcodecdimension))
+ if(SetupDimension(m_vcfa, m_vidcodectype, m_vidcodecdimension)) {
OnVideoCodecDimension();
+ }
}
void CPlayerCaptureDialog::OnVideoCodecDimension()
{
int i = m_vidcodecdimension.GetCurSel();
- if(i >= 0)
- {
+ if(i >= 0) {
m_mtcv = ((CVidFormatElem*)m_vidcodecdimension.GetItemData(i))->mt;
// we have to recreate the encoder, otherwise it will accept the new media type for only the first time
@@ -1490,15 +1512,15 @@ void CPlayerCaptureDialog::OnAudioCodec() void CPlayerCaptureDialog::OnAudioCodecType()
{
- if(SetupDimension(m_acfa, m_audcodectype, m_audcodecdimension))
+ if(SetupDimension(m_acfa, m_audcodectype, m_audcodecdimension)) {
OnAudioCodecDimension();
+ }
}
void CPlayerCaptureDialog::OnAudioCodecDimension()
{
int i = m_audcodecdimension.GetCurSel();
- if(i >= 0)
- {
+ if(i >= 0) {
m_mtca = ((CAudFormatElem*)m_audcodecdimension.GetItemData(i))->mt;
// we have to recreate the encoder, otherwise it will accept the new media type for only the first time
@@ -1518,21 +1540,28 @@ void CPlayerCaptureDialog::OnOpenFile() OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
_T("Media files (*.avi,*.ogm,*.mkv,*.dsm)|*.avi;*.ogm;*.mkv;*.dsm|"), this, 0);
- if(fd.DoModal() == IDOK)
- {
+ if(fd.DoModal() == IDOK) {
CString str = fd.GetPathName();
CString ext = str.Mid(str.ReverseFind('.')+1).MakeLower();
- if(ext == _T("avi")) m_muxtype = 0;
- else if(ext == _T("ogm")) m_muxtype = 1;
- else if(ext == _T("mkv")) m_muxtype = 2;
- else if(ext == _T("dsm")) m_muxtype = 3;
- else
- {
- if(m_muxtype == 0) str += _T(".avi");
- else if(m_muxtype == 1) str += _T(".ogm");
- else if(m_muxtype == 2) str += _T(".mkv");
- else if(m_muxtype == 3) str += _T(".dsm");
+ if(ext == _T("avi")) {
+ m_muxtype = 0;
+ } else if(ext == _T("ogm")) {
+ m_muxtype = 1;
+ } else if(ext == _T("mkv")) {
+ m_muxtype = 2;
+ } else if(ext == _T("dsm")) {
+ m_muxtype = 3;
+ } else {
+ if(m_muxtype == 0) {
+ str += _T(".avi");
+ } else if(m_muxtype == 1) {
+ str += _T(".ogm");
+ } else if(m_muxtype == 2) {
+ str += _T(".mkv");
+ } else if(m_muxtype == 3) {
+ str += _T(".dsm");
+ }
}
m_file = str;
@@ -1548,19 +1577,17 @@ void CPlayerCaptureDialog::OnRecord() UpdateData();
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
- if(!pFrame) return;
+ if(!pFrame) {
+ return;
+ }
- if(!pFrame->m_fCapturing)
- {
+ if(!pFrame->m_fCapturing) {
UpdateMuxer();
CComQIPtr<IFileSinkFilter2> pFSF = m_pMux;
- if(pFSF)
- {
+ if(pFSF) {
m_pDst = m_pMux;
- }
- else
- {
+ } else {
m_pDst = NULL;
m_pDst.CoCreateInstance(CLSID_FileWriter);
pFSF = m_pDst;
@@ -1568,24 +1595,19 @@ void CPlayerCaptureDialog::OnRecord() if(!pFSF
|| FAILED(pFSF->SetFileName(CStringW(m_file), NULL))
- || FAILED(pFSF->SetMode(AM_FILE_OVERWRITE)))
- {
+ || FAILED(pFSF->SetMode(AM_FILE_OVERWRITE))) {
AfxMessageBox(_T("Error initializing the output file"));
return;
}
CString audfn = m_file.Left(m_file.ReverseFind('.')+1);
- if(m_fSepAudio && m_fAudOutput && m_pAudMux && !audfn.IsEmpty())
- {
+ if(m_fSepAudio && m_fAudOutput && m_pAudMux && !audfn.IsEmpty()) {
audfn += _T("wav");
CComQIPtr<IFileSinkFilter2> pFSF = m_pAudMux;
- if(pFSF)
- {
+ if(pFSF) {
m_pAudDst = m_pAudMux;
- }
- else
- {
+ } else {
m_pAudDst = NULL;
m_pAudDst.CoCreateInstance(CLSID_FileWriter);
pFSF = m_pAudDst;
@@ -1593,23 +1615,20 @@ void CPlayerCaptureDialog::OnRecord() if(!pFSF
|| FAILED(pFSF->SetFileName(CStringW(audfn), NULL))
- || FAILED(pFSF->SetMode(AM_FILE_OVERWRITE)))
- {
+ || FAILED(pFSF->SetMode(AM_FILE_OVERWRITE))) {
AfxMessageBox(_T("Error initializing the audio output file"));
return;
}
}
m_pVidBuffer = m_fVidOutput && m_nVidBuffers > 0 && m_muxtype != 2 && m_muxtype != 3 ? DNew CBufferFilter(NULL, NULL) : NULL;
- if(CComQIPtr<IBufferFilter> pVB = m_pVidBuffer)
- {
+ if(CComQIPtr<IBufferFilter> pVB = m_pVidBuffer) {
pVB->SetBuffers(m_nVidBuffers);
pVB->SetPriority(THREAD_PRIORITY_NORMAL);
}
m_pAudBuffer = m_fAudOutput && m_nAudBuffers > 0 && m_muxtype != 2 && m_muxtype != 3 ? DNew CBufferFilter(NULL, NULL) : NULL;
- if(CComQIPtr<IBufferFilter> pAB = m_pAudBuffer)
- {
+ if(CComQIPtr<IBufferFilter> pAB = m_pAudBuffer) {
pAB->SetBuffers(m_nAudBuffers);
pAB->SetPriority(THREAD_PRIORITY_ABOVE_NORMAL);
}
@@ -1619,9 +1638,7 @@ void CPlayerCaptureDialog::OnRecord() pFrame->StartCapture();
SetTimer(1, 100, NULL);
- }
- else
- {
+ } else {
KillTimer(1);
pFrame->StopCapture();
@@ -1657,14 +1674,11 @@ void CPlayerCaptureDialog::OnEnChangeEdit12() void CPlayerCaptureDialog::OnTimer(UINT_PTR nIDEvent)
{
- if(nIDEvent == 1)
- {
- if(((CMainFrame*)AfxGetMainWnd())->m_fCapturing)
- {
+ if(nIDEvent == 1) {
+ if(((CMainFrame*)AfxGetMainWnd())->m_fCapturing) {
ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes;
if(GetDiskFreeSpaceEx(m_file.Left(m_file.ReverseFind('\\')+1), &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes)
- && FreeBytesAvailable.QuadPart < 1024i64*1024*10)
- {
+ && FreeBytesAvailable.QuadPart < 1024i64*1024*10) {
OnRecord();
}
}
@@ -1681,7 +1695,7 @@ void CPlayerCaptureDialog::OnBnClickedVidAudPreview() void CPlayerCaptureDialog::OnBnClickedCheck7()
{
-// UpdateMuxer();
+ // UpdateMuxer();
}
void CPlayerCaptureDialog::OnCbnSelchangeCombo14()
@@ -1690,14 +1704,15 @@ void CPlayerCaptureDialog::OnCbnSelchangeCombo14() CString ext = m_file.Mid(m_file.ReverseFind('.')+1).MakeLower();
- if(m_muxtype == 0 && ext != _T("avi"))
+ if(m_muxtype == 0 && ext != _T("avi")) {
m_file = m_file.Left(m_file.GetLength()-4) + _T(".avi");
- else if(m_muxtype == 1 && ext != _T("ogm"))
+ } else if(m_muxtype == 1 && ext != _T("ogm")) {
m_file = m_file.Left(m_file.GetLength()-4) + _T(".ogm");
- else if(m_muxtype == 2 && ext != _T("mkv"))
+ } else if(m_muxtype == 2 && ext != _T("mkv")) {
m_file = m_file.Left(m_file.GetLength()-4) + _T(".mkv");
- else if(m_muxtype == 3 && ext != _T("dsm"))
+ } else if(m_muxtype == 3 && ext != _T("dsm")) {
m_file = m_file.Left(m_file.GetLength()-4) + _T(".dsm");
+ }
UpdateData(FALSE);
diff --git a/src/apps/mplayerc/PlayerCaptureDialog.h b/src/apps/mplayerc/PlayerCaptureDialog.h index 81abf677d..046953cf8 100644 --- a/src/apps/mplayerc/PlayerCaptureDialog.h +++ b/src/apps/mplayerc/PlayerCaptureDialog.h @@ -44,8 +44,7 @@ class CFormat : public CAutoPtrArray<CFormatElem<T> > {
public:
CString name;
- CFormat(CString name = _T(""))
- {
+ CFormat(CString name = _T("")) {
this->name = name;
}
virtual ~CFormat() {}
@@ -57,16 +56,14 @@ class CFormatArray : public CAutoPtrArray<CFormat<T> > public:
virtual ~CFormatArray() {}
- CFormat<T>* Find(CString name, bool fCreate = false)
- {
- for(int i = 0; i < (int)GetCount(); i++)
- {
- if(GetAt(i)->name == name)
+ CFormat<T>* Find(CString name, bool fCreate = false) {
+ for(int i = 0; i < (int)GetCount(); i++) {
+ if(GetAt(i)->name == name) {
return(GetAt(i));
+ }
}
- if(fCreate)
- {
+ if(fCreate) {
CAutoPtr<CFormat<T> > pf(DNew CFormat<T>(name));
CFormat<T>* tmp = pf;
Add(pf);
@@ -76,19 +73,19 @@ public: return(NULL);
}
- bool FindFormat(AM_MEDIA_TYPE* pmt, CFormat<T>** ppf)
- {
- if(!pmt) return(false);
+ bool FindFormat(AM_MEDIA_TYPE* pmt, CFormat<T>** ppf) {
+ if(!pmt) {
+ return(false);
+ }
- for(int i = 0; i < (int)GetCount(); i++)
- {
+ for(int i = 0; i < (int)GetCount(); i++) {
CFormat<T>* pf = GetAt(i);
- for(int j = 0; j < (int)pf->GetCount(); j++)
- {
+ for(int j = 0; j < (int)pf->GetCount(); j++) {
CFormatElem<T>* pfe = pf->GetAt(j);
- if(!pmt || (pfe->mt.majortype == pmt->majortype && pfe->mt.subtype == pmt->subtype))
- {
- if(ppf) *ppf = pf;
+ if(!pmt || (pfe->mt.majortype == pmt->majortype && pfe->mt.subtype == pmt->subtype)) {
+ if(ppf) {
+ *ppf = pf;
+ }
return(true);
}
}
@@ -97,20 +94,22 @@ public: return(false);
}
- bool FindFormat(AM_MEDIA_TYPE* pmt, T* pcaps, CFormat<T>** ppf, CFormatElem<T>** ppfe)
- {
- if(!pmt && !pcaps) return(false);
+ bool FindFormat(AM_MEDIA_TYPE* pmt, T* pcaps, CFormat<T>** ppf, CFormatElem<T>** ppfe) {
+ if(!pmt && !pcaps) {
+ return(false);
+ }
- for(int i = 0; i < (int)GetCount(); i++)
- {
+ for(int i = 0; i < (int)GetCount(); i++) {
CFormat<T>* pf = GetAt(i);
- for(int j = 0; j < (int)pf->GetCount(); j++)
- {
+ for(int j = 0; j < (int)pf->GetCount(); j++) {
CFormatElem<T>* pfe = pf->GetAt(j);
- if((!pmt || pfe->mt == *pmt) && (!pcaps || !memcmp(pcaps, &pfe->caps, sizeof(T))))
- {
- if(ppf) *ppf = pf;
- if(ppfe) *ppfe = pfe;
+ if((!pmt || pfe->mt == *pmt) && (!pcaps || !memcmp(pcaps, &pfe->caps, sizeof(T)))) {
+ if(ppf) {
+ *ppf = pf;
+ }
+ if(ppfe) {
+ *ppfe = pfe;
+ }
return(true);
}
}
@@ -119,20 +118,19 @@ public: return(false);
}
- bool AddFormat(AM_MEDIA_TYPE* pmt, T caps)
- {
- if(!pmt) return(false);
+ bool AddFormat(AM_MEDIA_TYPE* pmt, T caps) {
+ if(!pmt) {
+ return(false);
+ }
- if(FindFormat(pmt, NULL, NULL, NULL))
- {
+ if(FindFormat(pmt, NULL, NULL, NULL)) {
DeleteMediaType(pmt);
return(false);
}
-// if(pmt->formattype == FORMAT_VideoInfo2) {DeleteMediaType(pmt); return(false);} // TODO
+ // if(pmt->formattype == FORMAT_VideoInfo2) {DeleteMediaType(pmt); return(false);} // TODO
CFormat<T>* pf = Find(MakeFormatName(pmt), true);
- if(!pf)
- {
+ if(!pf) {
DeleteMediaType(pmt);
return(false);
}
@@ -145,9 +143,10 @@ public: return(true);
}
- bool AddFormat(AM_MEDIA_TYPE* pmt, void* pcaps, int size)
- {
- if(!pcaps) return false;
+ bool AddFormat(AM_MEDIA_TYPE* pmt, void* pcaps, int size) {
+ if(!pcaps) {
+ return false;
+ }
ASSERT(size == sizeof(T));
return AddFormat(pmt, *(T*)pcaps);
}
@@ -162,11 +161,12 @@ typedef CFormat<VIDEO_STREAM_CONFIG_CAPS> CVidFormat; class CVidFormatArray : public CFormatArray<VIDEO_STREAM_CONFIG_CAPS>
{
public:
- CString MakeFormatName(AM_MEDIA_TYPE* pmt)
- {
+ CString MakeFormatName(AM_MEDIA_TYPE* pmt) {
CString str(_T("Default"));
- if(!pmt) return(str);
+ if(!pmt) {
+ return(str);
+ }
BITMAPINFOHEADER* bih = (pmt->formattype == FORMAT_VideoInfo)
? &((VIDEOINFOHEADER*)pmt->pbFormat)->bmiHeader
@@ -174,16 +174,14 @@ public: ? &((VIDEOINFOHEADER2*)pmt->pbFormat)->bmiHeader
: NULL;
- if(!bih)
- {
+ if(!bih) {
// it may have a fourcc in the mediasubtype, let's check that
WCHAR guid[100];
memset(guid, 0, 100*sizeof(WCHAR));
StringFromGUID2(pmt->subtype, guid, 100);
- if(CStringW(guid).MakeUpper().Find(L"0000-0010-8000-00AA00389B71") >= 0)
- {
+ if(CStringW(guid).MakeUpper().Find(L"0000-0010-8000-00AA00389B71") >= 0) {
str.Format(_T("%c%c%c%c"),
(TCHAR)((pmt->subtype.Data1>>0)&0xff), (TCHAR)((pmt->subtype.Data1>>8)&0xff),
(TCHAR)((pmt->subtype.Data1>>16)&0xff), (TCHAR)((pmt->subtype.Data1>>24)&0xff));
@@ -192,41 +190,41 @@ public: return(str);
}
- switch(bih->biCompression)
- {
- case BI_RGB:
- str.Format(_T("RGB%d"), bih->biBitCount);
- break;
- case BI_RLE8:
- str = _T("RLE8");
- break;
- case BI_RLE4:
- str = _T("RLE4");
- break;
- case BI_BITFIELDS:
- str.Format(_T("BITF%d"), bih->biBitCount);
- break;
- case BI_JPEG:
- str = _T("JPEG");
- break;
- case BI_PNG:
- str = _T("PNG");
- break;
- default:
- str.Format(_T("%c%c%c%c"),
- (TCHAR)((bih->biCompression>>0)&0xff), (TCHAR)((bih->biCompression>>8)&0xff),
- (TCHAR)((bih->biCompression>>16)&0xff), (TCHAR)((bih->biCompression>>24)&0xff));
- break;
+ switch(bih->biCompression) {
+ case BI_RGB:
+ str.Format(_T("RGB%d"), bih->biBitCount);
+ break;
+ case BI_RLE8:
+ str = _T("RLE8");
+ break;
+ case BI_RLE4:
+ str = _T("RLE4");
+ break;
+ case BI_BITFIELDS:
+ str.Format(_T("BITF%d"), bih->biBitCount);
+ break;
+ case BI_JPEG:
+ str = _T("JPEG");
+ break;
+ case BI_PNG:
+ str = _T("PNG");
+ break;
+ default:
+ str.Format(_T("%c%c%c%c"),
+ (TCHAR)((bih->biCompression>>0)&0xff), (TCHAR)((bih->biCompression>>8)&0xff),
+ (TCHAR)((bih->biCompression>>16)&0xff), (TCHAR)((bih->biCompression>>24)&0xff));
+ break;
}
return(str);
}
- CString MakeDimensionName(CVidFormatElem* pfe)
- {
+ CString MakeDimensionName(CVidFormatElem* pfe) {
CString str(_T("Default"));
- if(!pfe) return(str);
+ if(!pfe) {
+ return(str);
+ }
BITMAPINFOHEADER* bih = (pfe->mt.formattype == FORMAT_VideoInfo)
? &((VIDEOINFOHEADER*)pfe->mt.pbFormat)->bmiHeader
@@ -234,12 +232,13 @@ public: ? &((VIDEOINFOHEADER2*)pfe->mt.pbFormat)->bmiHeader
: NULL;
- if(bih == NULL) return(str);
+ if(bih == NULL) {
+ return(str);
+ }
str.Format(_T("%dx%d %.2f"), bih->biWidth, bih->biHeight, (float)10000000/((VIDEOINFOHEADER*)pfe->mt.pbFormat)->AvgTimePerFrame);
- if(pfe->mt.formattype == FORMAT_VideoInfo2)
- {
+ if(pfe->mt.formattype == FORMAT_VideoInfo2) {
VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)pfe->mt.pbFormat;
CString str2;
str2.Format(_T(" i%02x %d:%d"), vih2->dwInterlaceFlags, vih2->dwPictAspectRatioX, vih2->dwPictAspectRatioY);
@@ -256,54 +255,55 @@ typedef CFormat<AUDIO_STREAM_CONFIG_CAPS> CAudFormat; class CAudFormatArray : public CFormatArray<AUDIO_STREAM_CONFIG_CAPS>
{
public:
- CString MakeFormatName(AM_MEDIA_TYPE* pmt)
- {
+ CString MakeFormatName(AM_MEDIA_TYPE* pmt) {
CString str(_T("Unknown"));
- if(!pmt) return(str);
+ if(!pmt) {
+ return(str);
+ }
WAVEFORMATEX* wfe = (pmt->formattype == FORMAT_WaveFormatEx)
? (WAVEFORMATEX*)pmt->pbFormat
: NULL;
- if(!wfe)
- {
+ if(!wfe) {
WCHAR guid[100];
memset(guid, 0, 100*sizeof(WCHAR));
StringFromGUID2(pmt->subtype, guid, 100);
- if(CStringW(guid).MakeUpper().Find(L"0000-0010-8000-00AA00389B71") >= 0)
- {
+ if(CStringW(guid).MakeUpper().Find(L"0000-0010-8000-00AA00389B71") >= 0) {
str.Format(_T("0x%04x"), pmt->subtype.Data1);
}
return(str);
}
- switch(wfe->wFormatTag)
- {
- case 1:
- str = _T("PCM ");
- break;
- default:
- str.Format(_T("0x%03x "), wfe->wFormatTag);
- break;
+ switch(wfe->wFormatTag) {
+ case 1:
+ str = _T("PCM ");
+ break;
+ default:
+ str.Format(_T("0x%03x "), wfe->wFormatTag);
+ break;
}
return(str);
}
- CString MakeDimensionName(CAudFormatElem* pfe)
- {
+ CString MakeDimensionName(CAudFormatElem* pfe) {
CString str(_T("Unknown"));
- if(!pfe) return(str);
+ if(!pfe) {
+ return(str);
+ }
WAVEFORMATEX* wfe = (pfe->mt.formattype == FORMAT_WaveFormatEx)
? (WAVEFORMATEX*)pfe->mt.pbFormat
: NULL;
- if(!wfe) return(str);
+ if(!wfe) {
+ return(str);
+ }
str.Empty();
CString str2;
@@ -314,18 +314,17 @@ public: str2.Format(_T("%dbps "), wfe->wBitsPerSample);
str += str2;
- switch(wfe->nChannels)
- {
- case 1:
- str += _T("mono ");
- break;
- case 2:
- str += _T("stereo ");
- break;
- default:
- str2.Format(_T("%d channels "), wfe->nChannels);
- str += str2;
- break;
+ switch(wfe->nChannels) {
+ case 1:
+ str += _T("mono ");
+ break;
+ case 2:
+ str += _T("stereo ");
+ break;
+ default:
+ str2.Format(_T("%d channels "), wfe->nChannels);
+ str += str2;
+ break;
}
str2.Format(_T("%3dkbps "), wfe->nAvgBytesPerSec*8/1000);
@@ -337,8 +336,7 @@ public: //
-typedef struct
-{
+typedef struct {
CComPtr<IMoniker> pMoniker;
CComPtr<IBaseFilter> pBF;
CString FriendlyName;
@@ -398,7 +396,7 @@ public: BOOL Create(CWnd* pParent = NULL);
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_CAPTURE_DLG };
CComboBox m_vidinput;
diff --git a/src/apps/mplayerc/PlayerInfoBar.cpp b/src/apps/mplayerc/PlayerInfoBar.cpp index 66d9d80c2..db31eb165 100644 --- a/src/apps/mplayerc/PlayerInfoBar.cpp +++ b/src/apps/mplayerc/PlayerInfoBar.cpp @@ -40,20 +40,19 @@ CPlayerInfoBar::~CPlayerInfoBar() void CPlayerInfoBar::SetLine(CString label, CString info)
{
- if(info.IsEmpty())
- {
+ if(info.IsEmpty()) {
RemoveLine(label);
return;
}
- for(size_t idx = 0; idx < m_label.GetCount(); idx++)
- {
+ for(size_t idx = 0; idx < m_label.GetCount(); idx++) {
CString tmp;
m_label[idx]->GetWindowText(tmp);
- if(label == tmp)
- {
+ if(label == tmp) {
m_info[idx]->GetWindowText(tmp);
- if(info != tmp) m_info[idx]->SetWindowText(info);
+ if(info != tmp) {
+ m_info[idx]->SetWindowText(info);
+ }
return;
}
}
@@ -73,12 +72,10 @@ void CPlayerInfoBar::GetLine(CString label, CString& info) {
info.Empty();
- for(size_t idx = 0; idx < m_label.GetCount(); idx++)
- {
+ for(size_t idx = 0; idx < m_label.GetCount(); idx++) {
CString tmp;
m_label[idx]->GetWindowText(tmp);
- if(label == tmp)
- {
+ if(label == tmp) {
m_info[idx]->GetWindowText(tmp);
info = tmp;
return;
@@ -88,12 +85,10 @@ void CPlayerInfoBar::GetLine(CString label, CString& info) void CPlayerInfoBar::RemoveLine(CString label)
{
- for(size_t i = 0; i < m_label.GetCount(); i++)
- {
+ for(size_t i = 0; i < m_label.GetCount(); i++) {
CString tmp;
m_label[i]->GetWindowText(tmp);
- if(label == tmp)
- {
+ if(label == tmp) {
m_label.RemoveAt(i);
m_info.RemoveAt(i);
break;
@@ -118,8 +113,9 @@ BOOL CPlayerInfoBar::Create(CWnd* pParentWnd) BOOL CPlayerInfoBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CDialogBar::PreCreateWindow(cs))
+ if(!CDialogBar::PreCreateWindow(cs)) {
return FALSE;
+ }
m_dwStyle &= ~CBRS_BORDER_TOP;
m_dwStyle &= ~CBRS_BORDER_BOTTOM;
@@ -142,8 +138,7 @@ void CPlayerInfoBar::Relayout() int w = m_nFirstColWidth, h = 17, y = 2;
- for(size_t i = 0; i < m_label.GetCount(); i++)
- {
+ for(size_t i = 0; i < m_label.GetCount(); i++) {
CDC* pDC = m_label[i]->GetDC();
CString str;
m_label[i]->GetWindowText(str);
@@ -151,8 +146,7 @@ void CPlayerInfoBar::Relayout() m_label[i]->ReleaseDC(pDC);
}
- for(size_t i = 0; i < m_label.GetCount(); i++, y += h)
- {
+ for(size_t i = 0; i < m_label.GetCount(); i++, y += h) {
m_label[i]->MoveWindow(1, y, w - 10, h);
m_info[i]->MoveWindow(w + 10, y, r.Width()-(w+10)-1, h);
}
@@ -170,8 +164,7 @@ END_MESSAGE_MAP() BOOL CPlayerInfoBar::OnEraseBkgnd(CDC* pDC)
{
- for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
- {
+ for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) {
CRect r;
pChild->GetClientRect(&r);
pChild->MapWindowPoints(this, &r);
@@ -183,11 +176,13 @@ BOOL CPlayerInfoBar::OnEraseBkgnd(CDC* pDC) CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
- if(pFrame->m_pLastBar != this || pFrame->m_fFullScreen)
+ if(pFrame->m_pLastBar != this || pFrame->m_fFullScreen) {
r.InflateRect(0, 0, 0, 1);
+ }
- if(pFrame->m_fFullScreen)
+ if(pFrame->m_fFullScreen) {
r.InflateRect(1, 0, 1, 0);
+ }
pDC->Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
@@ -210,8 +205,7 @@ void CPlayerInfoBar::OnSize(UINT nType, int cx, int cy) void CPlayerInfoBar::OnLButtonDown(UINT nFlags, CPoint point)
{
CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
- if(!pFrame->m_fFullScreen)
- {
+ if(!pFrame->m_fFullScreen) {
MapWindowPoints(pFrame, &point, 1);
pFrame->PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
}
diff --git a/src/apps/mplayerc/PlayerListCtrl.cpp b/src/apps/mplayerc/PlayerListCtrl.cpp index 6e93c2d38..c1c6fdce7 100644 --- a/src/apps/mplayerc/PlayerListCtrl.cpp +++ b/src/apps/mplayerc/PlayerListCtrl.cpp @@ -54,13 +54,11 @@ END_MESSAGE_MAP() BOOL CInPlaceEdit::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN)
- {
+ if(pMsg->message == WM_KEYDOWN) {
if(pMsg->wParam == VK_RETURN
|| pMsg->wParam == VK_DELETE
|| pMsg->wParam == VK_ESCAPE
- || GetKeyState(VK_CONTROL))
- {
+ || GetKeyState(VK_CONTROL)) {
::TranslateMessage(pMsg);
::DispatchMessage(pMsg);
return TRUE; // DO NOT process further
@@ -101,9 +99,10 @@ void CInPlaceEdit::OnNcDestroy() void CInPlaceEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
- if(nChar == VK_ESCAPE || nChar == VK_RETURN)
- {
- if(nChar == VK_ESCAPE) m_bESC = TRUE;
+ if(nChar == VK_ESCAPE || nChar == VK_RETURN) {
+ if(nChar == VK_ESCAPE) {
+ m_bESC = TRUE;
+ }
GetParent()->SetFocus();
return;
}
@@ -113,8 +112,9 @@ void CInPlaceEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) int CInPlaceEdit::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if(CEdit::OnCreate(lpCreateStruct) == -1)
+ if(CEdit::OnCreate(lpCreateStruct) == -1) {
return -1;
+ }
// Set the proper font
CFont* font = GetParent()->GetFont();
@@ -157,15 +157,17 @@ END_MESSAGE_MAP() int CInPlaceComboBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if (CComboBox::OnCreate(lpCreateStruct) == -1)
+ if (CComboBox::OnCreate(lpCreateStruct) == -1) {
return -1;
+ }
// Set the proper font
CFont* font = GetParent()->GetFont();
SetFont(font);
- for(POSITION pos = m_lstItems.GetHeadPosition(); pos != NULL;)
+ for(POSITION pos = m_lstItems.GetHeadPosition(); pos != NULL;) {
AddString((LPCTSTR)(m_lstItems.GetNext(pos)));
+ }
SetFocus();
SetCurSel(m_nSel);
@@ -174,11 +176,9 @@ int CInPlaceComboBox::OnCreate(LPCREATESTRUCT lpCreateStruct) BOOL CInPlaceComboBox::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN)
- {
+ if(pMsg->message == WM_KEYDOWN) {
if(pMsg->wParam == VK_RETURN
- || pMsg->wParam == VK_ESCAPE)
- {
+ || pMsg->wParam == VK_ESCAPE) {
::TranslateMessage(pMsg);
::DispatchMessage(pMsg);
return TRUE; // DO NOT process further
@@ -212,9 +212,10 @@ void CInPlaceComboBox::OnKillFocus(CWnd* pNewWnd) void CInPlaceComboBox::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
- if(nChar == VK_ESCAPE || nChar == VK_RETURN)
- {
- if(nChar == VK_ESCAPE) m_bESC = TRUE;
+ if(nChar == VK_ESCAPE || nChar == VK_RETURN) {
+ if(nChar == VK_ESCAPE) {
+ m_bESC = TRUE;
+ }
GetParent()->SetFocus();
return;
}
@@ -264,15 +265,15 @@ END_MESSAGE_MAP() int CInPlaceListBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if(CListBox::OnCreate(lpCreateStruct) == -1)
+ if(CListBox::OnCreate(lpCreateStruct) == -1) {
return -1;
+ }
// Set the proper font
CFont* font = GetParent()->GetFont();
SetFont(font);
- for(POSITION pos = m_lstItems.GetHeadPosition(); pos != NULL;)
- {
+ for(POSITION pos = m_lstItems.GetHeadPosition(); pos != NULL;) {
AddString( (LPCTSTR) (m_lstItems.GetNext( pos )) );
}
SetCurSel( m_nSel );
@@ -282,11 +283,9 @@ int CInPlaceListBox::OnCreate(LPCREATESTRUCT lpCreateStruct) BOOL CInPlaceListBox::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN)
- {
+ if(pMsg->message == WM_KEYDOWN) {
if(pMsg->wParam == VK_RETURN
- || pMsg->wParam == VK_ESCAPE)
- {
+ || pMsg->wParam == VK_ESCAPE) {
::TranslateMessage(pMsg);
::DispatchMessage(pMsg);
return TRUE; // DO NOT process further
@@ -320,9 +319,10 @@ void CInPlaceListBox::OnKillFocus(CWnd* pNewWnd) void CInPlaceListBox::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
- if(nChar == VK_ESCAPE || nChar == VK_RETURN)
- {
- if(nChar == VK_ESCAPE) m_bESC = TRUE;
+ if(nChar == VK_ESCAPE || nChar == VK_RETURN) {
+ if(nChar == VK_ESCAPE) {
+ m_bESC = TRUE;
+ }
GetParent()->SetFocus();
return;
}
@@ -361,29 +361,30 @@ void CPlayerListCtrl::PreSubclassWindow() int CPlayerListCtrl::HitTestEx(CPoint& point, int* col) const
{
- if(col) *col = 0;
+ if(col) {
+ *col = 0;
+ }
int row = HitTest(CPoint(0, point.y), NULL);
- if((GetWindowLong(m_hWnd, GWL_STYLE) & LVS_TYPEMASK) != LVS_REPORT)
+ if((GetWindowLong(m_hWnd, GWL_STYLE) & LVS_TYPEMASK) != LVS_REPORT) {
return row;
+ }
int nColumnCount = ((CHeaderCtrl*)GetDlgItem(0))->GetItemCount();
- for(int top = GetTopIndex(), bottom = GetBottomIndex(); top <= bottom; top++)
- {
+ for(int top = GetTopIndex(), bottom = GetBottomIndex(); top <= bottom; top++) {
CRect r;
GetItemRect(top, &r, LVIR_BOUNDS);
- if(r.top <= point.y && point.y < r.bottom)
- {
- for(int colnum = 0; colnum < nColumnCount; colnum++)
- {
+ if(r.top <= point.y && point.y < r.bottom) {
+ for(int colnum = 0; colnum < nColumnCount; colnum++) {
int colwidth = GetColumnWidth(colnum);
- if(point.x >= r.left && point.x <= (r.left + colwidth))
- {
- if(col) *col = colnum;
+ if(point.x >= r.left && point.x <= (r.left + colwidth)) {
+ if(col) {
+ *col = colnum;
+ }
return top;
}
@@ -402,17 +403,15 @@ int CPlayerListCtrl::GetBottomIndex() const int nBottomIndex = GetTopIndex() + GetCountPerPage() - 1;
- if(nBottomIndex >= GetItemCount())
- {
+ if(nBottomIndex >= GetItemCount()) {
nBottomIndex = GetItemCount() - 1;
- }
- else if(nBottomIndex < GetItemCount())
- {
+ } else if(nBottomIndex < GetItemCount()) {
CRect br;
GetItemRect(nBottomIndex, br, LVIR_BOUNDS);
- if(br.bottom < r.bottom)
+ if(br.bottom < r.bottom) {
nBottomIndex++;
+ }
}
return(nBottomIndex);
@@ -420,8 +419,9 @@ int CPlayerListCtrl::GetBottomIndex() const CImageList* CPlayerListCtrl::CreateDragImageEx(LPPOINT lpPoint)
{
- if(GetSelectedCount() <= 0)
+ if(GetSelectedCount() <= 0) {
return NULL;
+ }
CRect cSingleRect, cCompleteRect(0, 0, 0, 0);
GetClientRect(cSingleRect);
@@ -433,16 +433,19 @@ CImageList* CPlayerListCtrl::CreateDragImageEx(LPPOINT lpPoint) // Determine the size of the drag image (limited for
// rows visible and Client width)
- while((nIndex = GetNextItem(nIndex, LVNI_SELECTED)) != -1 && nIndex <= nBottomIndex)
- {
+ while((nIndex = GetNextItem(nIndex, LVNI_SELECTED)) != -1 && nIndex <= nBottomIndex) {
GetItemRect(nIndex, cSingleRect, LVIR_BOUNDS);
/*
CRect r;
GetItemRect(nIndex, r, LVIR_LABEL);
cSingleRect.left = r.left;
*/
- if(cSingleRect.left < 0) cSingleRect.left = 0;
- if(cSingleRect.right > nWidth) cSingleRect.right = nWidth;
+ if(cSingleRect.left < 0) {
+ cSingleRect.left = 0;
+ }
+ if(cSingleRect.right > nWidth) {
+ cSingleRect.right = nWidth;
+ }
cCompleteRect |= cSingleRect;
}
@@ -454,11 +457,13 @@ CImageList* CPlayerListCtrl::CreateDragImageEx(LPPOINT lpPoint) CDC cMemDC;
CBitmap cBitmap;
- if(!cMemDC.CreateCompatibleDC(&cDc))
+ if(!cMemDC.CreateCompatibleDC(&cDc)) {
return NULL;
+ }
- if(!cBitmap.CreateCompatibleBitmap(&cDc, cCompleteRect.Width(), cCompleteRect.Height()))
+ if(!cBitmap.CreateCompatibleBitmap(&cDc, cCompleteRect.Width(), cCompleteRect.Height())) {
return NULL;
+ }
CBitmap* pOldMemDCBitmap = cMemDC.SelectObject(&cBitmap);
// Here green is used as mask color
@@ -466,13 +471,11 @@ CImageList* CPlayerListCtrl::CreateDragImageEx(LPPOINT lpPoint) // Paint each DragImage in the DC
nIndex = GetTopIndex() - 1;
- while((nIndex = GetNextItem(nIndex, LVNI_SELECTED)) != -1 && nIndex <= nBottomIndex)
- {
+ while((nIndex = GetNextItem(nIndex, LVNI_SELECTED)) != -1 && nIndex <= nBottomIndex) {
CPoint pt;
CImageList* pSingleImageList = CreateDragImage(nIndex, &pt);
- if(pSingleImageList)
- {
+ if(pSingleImageList) {
GetItemRect(nIndex, cSingleRect, LVIR_BOUNDS);
pSingleImageList->Draw(&cMemDC,
@@ -504,8 +507,7 @@ CImageList* CPlayerListCtrl::CreateDragImageEx(LPPOINT lpPoint) // Find the offset of the current mouse cursor to the image list
// this we can use in BeginDrag()
//
- if(lpPoint)
- {
+ if(lpPoint) {
lpPoint->x = cCompleteRect.left;
lpPoint->y = cCompleteRect.top;
}
@@ -515,20 +517,25 @@ CImageList* CPlayerListCtrl::CreateDragImageEx(LPPOINT lpPoint) bool CPlayerListCtrl::PrepareInPlaceControl(int nRow, int nCol, CRect& rect)
{
- if(!EnsureVisible(nRow, TRUE)) return(false);
+ if(!EnsureVisible(nRow, TRUE)) {
+ return(false);
+ }
int nColumnCount = ((CHeaderCtrl*)GetDlgItem(0))->GetItemCount();
- if(nCol >= nColumnCount || GetColumnWidth(nCol) < 5) return(false);
+ if(nCol >= nColumnCount || GetColumnWidth(nCol) < 5) {
+ return(false);
+ }
int offset = 0;
- for(int i = 0; i < nCol; i++) offset += GetColumnWidth(i);
+ for(int i = 0; i < nCol; i++) {
+ offset += GetColumnWidth(i);
+ }
GetItemRect(nRow, &rect, LVIR_BOUNDS);
CRect rcClient;
GetClientRect(&rcClient);
- if(offset + rect.left < 0 || offset + rect.left > rcClient.right)
- {
+ if(offset + rect.left < 0 || offset + rect.left > rcClient.right) {
CSize size(offset + rect.left, 0);
Scroll(size);
rect.left -= size.cx;
@@ -536,12 +543,13 @@ bool CPlayerListCtrl::PrepareInPlaceControl(int nRow, int nCol, CRect& rect) rect.left += offset;
rect.right = rect.left + GetColumnWidth(nCol);
- if(rect.right > rcClient.right) rect.right = rcClient.right;
+ if(rect.right > rcClient.right) {
+ rect.right = rcClient.right;
+ }
rect.DeflateRect(1, 0, 0, 1);
- if(nCol == 0)
- {
+ if(nCol == 0) {
CRect r;
GetItemRect(nRow, r, LVIR_LABEL);
rect.left = r.left-1;
@@ -553,8 +561,9 @@ bool CPlayerListCtrl::PrepareInPlaceControl(int nRow, int nCol, CRect& rect) CEdit* CPlayerListCtrl::ShowInPlaceEdit(int nItem, int nCol)
{
CRect rect;
- if(!PrepareInPlaceControl(nItem, nCol, rect))
+ if(!PrepareInPlaceControl(nItem, nCol, rect)) {
return(NULL);
+ }
DWORD dwStyle = /*WS_BORDER|*/WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL;
@@ -576,8 +585,9 @@ CEdit* CPlayerListCtrl::ShowInPlaceEdit(int nItem, int nCol) CComboBox* CPlayerListCtrl::ShowInPlaceComboBox(int nItem, int nCol, CAtlList<CString>& lstItems, int nSel, bool bShowDropDown)
{
CRect rect;
- if(!PrepareInPlaceControl(nItem, nCol, rect))
+ if(!PrepareInPlaceControl(nItem, nCol, rect)) {
return(NULL);
+ }
DWORD dwStyle = /*WS_BORDER|*/WS_CHILD|WS_VISIBLE|WS_VSCROLL/*|WS_HSCROLL*/
|CBS_DROPDOWNLIST|CBS_DISABLENOSCROLL/*|CBS_NOINTEGRALHEIGHT*/;
@@ -587,10 +597,13 @@ CComboBox* CPlayerListCtrl::ShowInPlaceComboBox(int nItem, int nCol, CAtlList<CS CorrectComboListWidth(*pComboBox, GetFont());
int width = GetColumnWidth(nCol);
- if(pComboBox->GetDroppedWidth() < width)
+ if(pComboBox->GetDroppedWidth() < width) {
pComboBox->SetDroppedWidth(width);
+ }
- if (bShowDropDown) pComboBox->ShowDropDown();
+ if (bShowDropDown) {
+ pComboBox->ShowDropDown();
+ }
m_fInPlaceDirty = false;
@@ -600,8 +613,9 @@ CComboBox* CPlayerListCtrl::ShowInPlaceComboBox(int nItem, int nCol, CAtlList<CS CListBox* CPlayerListCtrl::ShowInPlaceListBox(int nItem, int nCol, CAtlList<CString>& lstItems, int nSel)
{
CRect rect;
- if(!PrepareInPlaceControl(nItem, nCol, rect))
+ if(!PrepareInPlaceControl(nItem, nCol, rect)) {
return(NULL);
+ }
DWORD dwStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|WS_VSCROLL/*|WS_HSCROLL*/|LBS_NOTIFY;
CListBox* pListBox = DNew CInPlaceListBox(nItem, nCol, lstItems, nSel);
@@ -617,10 +631,11 @@ CListBox* CPlayerListCtrl::ShowInPlaceListBox(int nItem, int nCol, CAtlList<CStr pDC->SelectObject(pWndFont);
int width = GetColumnWidth(nCol);
POSITION pos = lstItems.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
int w = pDC->GetTextExtent(lstItems.GetNext(pos)).cx + 16;
- if(width < w) width = w;
+ if(width < w) {
+ width = w;
+ }
}
ReleaseDC(pDC);
@@ -660,19 +675,25 @@ END_MESSAGE_MAP() void CPlayerListCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
- if(GetFocus() != this) SetFocus();
+ if(GetFocus() != this) {
+ SetFocus();
+ }
CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
}
void CPlayerListCtrl::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
- if(GetFocus() != this) SetFocus();
+ if(GetFocus() != this) {
+ SetFocus();
+ }
CListCtrl::OnHScroll(nSBCode, nPos, pScrollBar);
}
BOOL CPlayerListCtrl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
- if(GetFocus() != this) SetFocus();
+ if(GetFocus() != this) {
+ SetFocus();
+ }
return CListCtrl::OnMouseWheel(nFlags, zDelta, pt);
}
@@ -680,18 +701,17 @@ void CPlayerListCtrl::OnLButtonDown(UINT nFlags, CPoint point) {
CListCtrl::OnLButtonDown(nFlags, point);
- if(GetFocus() != this) SetFocus();
+ if(GetFocus() != this) {
+ SetFocus();
+ }
KillTimer(1);
int m_nItemClickedNow, m_nSubItemClickedNow;
- if((m_nItemClickedNow = HitTestEx(point, &m_nSubItemClickedNow)) < 0)
- {
+ if((m_nItemClickedNow = HitTestEx(point, &m_nSubItemClickedNow)) < 0) {
m_nItemClicked = -1;
- }
- else if(m_nItemClicked == m_nItemClickedNow /*&& m_nSubItemClicked == m_nSubItemClickedNow*/)
- {
+ } else if(m_nItemClicked == m_nItemClickedNow /*&& m_nSubItemClicked == m_nSubItemClickedNow*/) {
m_nSubItemClicked = m_nSubItemClickedNow;
LV_DISPINFO dispinfo;
@@ -701,21 +721,15 @@ void CPlayerListCtrl::OnLButtonDown(UINT nFlags, CPoint point) dispinfo.item.mask = 0;
dispinfo.item.iItem = m_nItemClicked;
dispinfo.item.iSubItem = m_nSubItemClicked;
- if(GetParent()->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&dispinfo))
- {
- if(m_tStartEditingDelay > 0)
- {
+ if(GetParent()->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&dispinfo)) {
+ if(m_tStartEditingDelay > 0) {
SetTimer(1, m_tStartEditingDelay, NULL);
- }
- else
- {
+ } else {
dispinfo.hdr.code = LVN_DOLABELEDIT;
GetParent()->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&dispinfo);
}
}
- }
- else
- {
+ } else {
m_nItemClicked = m_nItemClickedNow;
m_nSubItemClicked = m_nSubItemClickedNow;
@@ -725,13 +739,11 @@ void CPlayerListCtrl::OnLButtonDown(UINT nFlags, CPoint point) void CPlayerListCtrl::OnTimer(UINT_PTR nIDEvent)
{
- if(nIDEvent == 1)
- {
+ if(nIDEvent == 1) {
KillTimer(1);
UINT flag = LVIS_FOCUSED;
- if((GetItemState(m_nItemClicked, flag) & flag) == flag && m_nSubItemClicked >= 0)
- {
+ if((GetItemState(m_nItemClicked, flag) & flag) == flag && m_nSubItemClicked >= 0) {
LV_DISPINFO dispinfo;
dispinfo.hdr.hwndFrom = m_hWnd;
dispinfo.hdr.idFrom = GetDlgCtrlID();
@@ -810,7 +822,7 @@ BOOL CPlayerListCtrl::OnHdnItemchanging(UINT id, NMHDR* pNMHDR, LRESULT* pResult {
LPNMHEADER phdr = reinterpret_cast<LPNMHEADER>(pNMHDR);
UNUSED_ALWAYS(phdr);
-// SetFocus();
+ // SetFocus();
*pResult = 0;
return FALSE;
}
@@ -819,8 +831,9 @@ INT_PTR CPlayerListCtrl::OnToolHitTest(CPoint point, TOOLINFO* pTI) const {
int col;
int row = HitTestEx(point, &col);
- if(row == -1)
+ if(row == -1) {
return -1;
+ }
CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
int nColumnCount = pHeader->GetItemCount();
@@ -828,12 +841,10 @@ INT_PTR CPlayerListCtrl::OnToolHitTest(CPoint point, TOOLINFO* pTI) const CRect rect;
GetItemRect(row, &rect, LVIR_BOUNDS);
- for(int colnum = 0; colnum < nColumnCount; colnum++)
- {
+ for(int colnum = 0; colnum < nColumnCount; colnum++) {
int colwidth = GetColumnWidth(colnum);
- if(colnum == col)
- {
+ if(colnum == col) {
rect.right = rect.left + colwidth;
break;
}
@@ -855,17 +866,18 @@ BOOL CPlayerListCtrl::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult) UINT nID = pNMHDR->idFrom;
- if (pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
- {
+ if (pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND)) {
// idFrom is actually the HWND of the tool
nID = ::GetDlgCtrlID((HWND)nID);
}
- if(nID == 0) // Notification in NT from automatically
- return FALSE; // created tooltip
+ if(nID == 0) { // Notification in NT from automatically
+ return FALSE; // created tooltip
+ }
- if(pNMHDR->code == TTN_NEEDTEXTW) //?possible check is not needed
+ if(pNMHDR->code == TTN_NEEDTEXTW) { //?possible check is not needed
pTTTW->lParam = (LPARAM)m_hWnd;
+ }
*pResult = 0;
diff --git a/src/apps/mplayerc/PlayerNavigationBar.cpp b/src/apps/mplayerc/PlayerNavigationBar.cpp index 921b61fc4..c8e1710a0 100644 --- a/src/apps/mplayerc/PlayerNavigationBar.cpp +++ b/src/apps/mplayerc/PlayerNavigationBar.cpp @@ -40,8 +40,9 @@ CPlayerNavigationBar::~CPlayerNavigationBar() BOOL CPlayerNavigationBar::Create(CWnd* pParentWnd)
{
- if(!baseCPlayerNavigationBar::Create(_T("Navigation bar"), pParentWnd, ID_VIEW_NAVIGATION))
+ if(!baseCPlayerNavigationBar::Create(_T("Navigation bar"), pParentWnd, ID_VIEW_NAVIGATION)) {
return FALSE;
+ }
m_pParent = pParentWnd;
m_navdlg.Create(this);
@@ -60,10 +61,10 @@ BOOL CPlayerNavigationBar::Create(CWnd* pParentWnd) BOOL CPlayerNavigationBar::PreTranslateMessage(MSG* pMsg)
{
- if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
- {
- if(IsDialogMessage(pMsg))
+ if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) {
+ if(IsDialogMessage(pMsg)) {
return TRUE;
+ }
}
return __super::PreTranslateMessage(pMsg);
@@ -80,8 +81,7 @@ void CPlayerNavigationBar::OnSize(UINT nType, int cx, int cy) {
__super::OnSize(nType, cx, cy);
- if(::IsWindow(m_navdlg.m_hWnd))
- {
+ if(::IsWindow(m_navdlg.m_hWnd)) {
CRect r;
GetClientRect(r);
m_navdlg.MoveWindow(r);
@@ -113,8 +113,9 @@ void CPlayerNavigationBar::OnNcLButtonUp(UINT nHitTest, CPoint point) {
__super::OnNcLButtonUp(nHitTest, point);
- if (nHitTest == HTCLOSE)
+ if (nHitTest == HTCLOSE) {
AfxGetAppSettings().fHideNavigation = true;
+ }
}
diff --git a/src/apps/mplayerc/PlayerNavigationDialog.cpp b/src/apps/mplayerc/PlayerNavigationDialog.cpp index 6e4a84c73..9e731371b 100644 --- a/src/apps/mplayerc/PlayerNavigationDialog.cpp +++ b/src/apps/mplayerc/PlayerNavigationDialog.cpp @@ -43,8 +43,9 @@ CPlayerNavigationDialog::~CPlayerNavigationDialog() BOOL CPlayerNavigationDialog::Create(CWnd* pParent)
{
- if(!__super::Create(IDD, pParent))
+ if(!__super::Create(IDD, pParent)) {
return FALSE;
+ }
m_pParent = pParent;
return TRUE;
}
@@ -62,13 +63,12 @@ void CPlayerNavigationDialog::DoDataExchange(CDataExchange* pDX) BOOL CPlayerNavigationDialog::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN)
- {
- if(pMsg->wParam == VK_RETURN)
- {
+ if(pMsg->message == WM_KEYDOWN) {
+ if(pMsg->wParam == VK_RETURN) {
CWnd* pFocused = GetFocus();
- if (pFocused && pFocused->m_hWnd == m_ChannelList.m_hWnd)
+ if (pFocused && pFocused->m_hWnd == m_ChannelList.m_hWnd) {
return TRUE;
+ }
}
}
return __super::PreTranslateMessage(pMsg);
@@ -119,15 +119,12 @@ void CPlayerNavigationDialog::SetupAudioSwitcherSubMenu(CDVBChannel* pChannel) int nCurrentChannel;
AppSettings& s = AfxGetAppSettings();
- if (!pChannel)
- {
+ if (!pChannel) {
nCurrentChannel = s.nDVBLastChannel;
POSITION pos = s.m_DVBChannels.GetHeadPosition();
- while (pos && !bFound)
- {
+ while (pos && !bFound) {
pChannel = &s.m_DVBChannels.GetNext(pos);
- if (nCurrentChannel == pChannel->GetPrefNumber())
- {
+ if (nCurrentChannel == pChannel->GetPrefNumber()) {
bFound = TRUE;
break;
}
@@ -136,8 +133,7 @@ void CPlayerNavigationDialog::SetupAudioSwitcherSubMenu(CDVBChannel* pChannel) m_ButtonInfo.EnableWindow(pChannel->GetNowNextFlag());
m_ComboAudio.ResetContent();
- for (int i=0; i < pChannel->GetAudioCount(); i++)
- {
+ for (int i=0; i < pChannel->GetAudioCount(); i++) {
m_ComboAudio.AddString(pChannel->GetAudio(i)->Language);
m_audios[i].PID = pChannel->GetAudio(i)-> PID;
m_audios[i].Type = pChannel->GetAudio(i)->Type;
@@ -154,24 +150,21 @@ void CPlayerNavigationDialog::UpdateElementList() int nCurrentChannel;
AppSettings& s = AfxGetAppSettings();
- if (s.iDefaultCaptureDevice == 1)
- {
+ if (s.iDefaultCaptureDevice == 1) {
m_ChannelList.ResetContent();
nCurrentChannel = s.nDVBLastChannel;
POSITION pos = s.m_DVBChannels.GetHeadPosition();
- while (pos)
- {
+ while (pos) {
CDVBChannel& Channel = s.m_DVBChannels.GetNext(pos);
if ((m_bTVStations && (Channel.GetVideoPID() != 0)) ||
- (!m_bTVStations && (Channel.GetAudioCount() > 0)) && (Channel.GetVideoPID() == 0))
- {
+ (!m_bTVStations && (Channel.GetAudioCount() > 0)) && (Channel.GetVideoPID() == 0)) {
nItem = m_ChannelList.AddString (Channel.GetName());
- if (nItem < MAX_CHANNELS_ALLOWED)
+ if (nItem < MAX_CHANNELS_ALLOWED) {
p_nItems [nItem] = Channel.GetPrefNumber();
- if (nCurrentChannel == Channel.GetPrefNumber())
- {
+ }
+ if (nCurrentChannel == Channel.GetPrefNumber()) {
m_ChannelList.SetCurSel(nItem);
SetupAudioSwitcherSubMenu(&Channel);
}
@@ -183,10 +176,8 @@ void CPlayerNavigationDialog::UpdateElementList() void CPlayerNavigationDialog::UpdatePos(int nID)
{
- for (int i=0; i < MAX_CHANNELS_ALLOWED; i++)
- {
- if (p_nItems [i] == nID)
- {
+ for (int i=0; i < MAX_CHANNELS_ALLOWED; i++) {
+ if (p_nItems [i] == nID) {
m_ChannelList.SetCurSel(i);
break;
}
@@ -231,8 +222,9 @@ void CPlayerNavigationDialog::OnTvRadioStations() {
m_bTVStations = !m_bTVStations;
UpdateElementList();
- if (m_bTVStations)
+ if (m_bTVStations) {
m_ButtonFilterStations.SetWindowText(ResStr(IDS_DVB_TVNAV_SEERADIO));
- else
+ } else {
m_ButtonFilterStations.SetWindowText(ResStr(IDS_DVB_TVNAV_SEETV));
+ }
}
diff --git a/src/apps/mplayerc/PlayerNavigationDialog.h b/src/apps/mplayerc/PlayerNavigationDialog.h index 119db4377..7bea5ac9c 100644 --- a/src/apps/mplayerc/PlayerNavigationDialog.h +++ b/src/apps/mplayerc/PlayerNavigationDialog.h @@ -47,7 +47,7 @@ public: DVBStreamInfo m_audios[DVB_MAX_AUDIO];
bool m_bTVStations;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_NAVIGATION_DLG };
CListBox m_ChannelList;
@@ -56,7 +56,7 @@ public: CButton m_ButtonScan;
CButton m_ButtonFilterStations;
CWnd* m_pParent;
-// CMenu m_subtitles, m_audios;
+ // CMenu m_subtitles, m_audios;
protected:
diff --git a/src/apps/mplayerc/PlayerPlaylistBar.cpp b/src/apps/mplayerc/PlayerPlaylistBar.cpp index ab37cf40e..29d03f51e 100644 --- a/src/apps/mplayerc/PlayerPlaylistBar.cpp +++ b/src/apps/mplayerc/PlayerPlaylistBar.cpp @@ -47,8 +47,9 @@ CPlayerPlaylistBar::~CPlayerPlaylistBar() BOOL CPlayerPlaylistBar::Create(CWnd* pParentWnd)
{
- if(!CSizingControlBarG::Create(_T("Playlist"), pParentWnd, ID_VIEW_PLAYLIST))
+ if(!CSizingControlBarG::Create(_T("Playlist"), pParentWnd, ID_VIEW_PLAYLIST)) {
return FALSE;
+ }
m_list.CreateEx(
WS_EX_DLGMODALFRAME|WS_EX_CLIENTEDGE,
@@ -78,8 +79,9 @@ BOOL CPlayerPlaylistBar::Create(CWnd* pParentWnd) BOOL CPlayerPlaylistBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CSizingControlBarG::PreCreateWindow(cs))
+ if(!CSizingControlBarG::PreCreateWindow(cs)) {
return FALSE;
+ }
cs.dwExStyle |= WS_EX_ACCEPTFILES;
@@ -88,16 +90,15 @@ BOOL CPlayerPlaylistBar::PreCreateWindow(CREATESTRUCT& cs) BOOL CPlayerPlaylistBar::PreTranslateMessage(MSG* pMsg)
{
- if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
- {
- if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE)
- {
+ if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) {
+ if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) {
GetParentFrame()->ShowControlBar(this, FALSE, TRUE);
return TRUE;
}
- if(IsDialogMessage(pMsg))
+ if(IsDialogMessage(pMsg)) {
return TRUE;
+ }
}
return CSizingControlBarG::PreTranslateMessage(pMsg);
@@ -115,19 +116,20 @@ void CPlayerPlaylistBar::AddItem(CAtlList<CString>& fns, CAtlList<CString>* subs CPlaylistItem pli;
POSITION pos = fns.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CString fn = fns.GetNext(pos);
- if(!fn.Trim().IsEmpty()) pli.m_fns.AddTail(fn);
+ if(!fn.Trim().IsEmpty()) {
+ pli.m_fns.AddTail(fn);
+ }
}
- if(subs)
- {
+ if(subs) {
POSITION pos = subs->GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CString fn = subs->GetNext(pos);
- if(!fn.Trim().IsEmpty()) pli.m_subs.AddTail(fn);
+ if(!fn.Trim().IsEmpty()) {
+ pli.m_subs.AddTail(fn);
+ }
}
}
@@ -138,8 +140,9 @@ void CPlayerPlaylistBar::AddItem(CAtlList<CString>& fns, CAtlList<CString>* subs static bool SearchFiles(CString mask, CAtlList<CString>& sl)
{
- if(mask.Find(_T("://")) >= 0)
+ if(mask.Find(_T("://")) >= 0) {
return(false);
+ }
mask.Trim();
sl.RemoveAll();
@@ -149,46 +152,42 @@ static bool SearchFiles(CString mask, CAtlList<CString>& sl) WIN32_FILE_ATTRIBUTE_DATA fad;
bool fFilterKnownExts = (GetFileAttributesEx(mask, GetFileExInfoStandard, &fad)
&& (fad.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY));
- if (fFilterKnownExts)
+ if (fFilterKnownExts) {
mask = CString(mask).TrimRight(_T("\\/")) + _T("\\*.*");
+ }
{
CString dir = mask.Left(max(mask.ReverseFind('\\'), mask.ReverseFind('/'))+1);
WIN32_FIND_DATA fd;
HANDLE h = FindFirstFile(mask, &fd);
- if(h != INVALID_HANDLE_VALUE)
- {
- do
- {
- if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) continue;
+ if(h != INVALID_HANDLE_VALUE) {
+ do {
+ if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
+ continue;
+ }
CString fn = fd.cFileName;
//CString ext = fn.Mid(fn.ReverseFind('.')+1).MakeLower();
CString ext = fn.Mid(fn.ReverseFind('.')).MakeLower();
CString path = dir + fd.cFileName;
- if(!fFilterKnownExts || mf.FindExt(ext))
- {
- for(int i = 0; i < mf.GetCount(); i++)
- {
+ if(!fFilterKnownExts || mf.FindExt(ext)) {
+ for(int i = 0; i < mf.GetCount(); i++) {
CMediaFormatCategory& mfc = mf.GetAt(i);
/* playlist files are skipped when playing the contents of an entire directory */
- if((mfc.FindExt(ext)) && (mf[i].GetLabel().CompareNoCase(ResStr(IDS_AG_PLAYLIST_FILE)) != 0))
- {
+ if((mfc.FindExt(ext)) && (mf[i].GetLabel().CompareNoCase(ResStr(IDS_AG_PLAYLIST_FILE)) != 0)) {
sl.AddTail(path);
break;
}
}
}
- }
- while(FindNextFile(h, &fd));
+ } while(FindNextFile(h, &fd));
FindClose(h);
- if(sl.GetCount() == 0 && mask.Find(_T(":\\")) == 1)
- {
+ if(sl.GetCount() == 0 && mask.Find(_T(":\\")) == 1) {
GetCDROMType(mask[0], sl);
}
}
@@ -215,15 +214,15 @@ void CPlayerPlaylistBar::ResolveLinkFiles( CAtlList<CString> &fns ) CComQIPtr<IPersistFile> pPF = pSL;
POSITION pos = fns.GetHeadPosition();
- while(pSL && pPF && pos)
- {
+ while(pSL && pPF && pos) {
CString& fn = fns.GetNext(pos);
TCHAR buff[_MAX_PATH];
if(CPath(fn).GetExtension().MakeLower() != _T(".lnk")
|| FAILED(pPF->Load(CStringW(fn), STGM_READ))
|| FAILED(pSL->Resolve(NULL, SLR_ANY_MATCH|SLR_NO_UI))
- || FAILED(pSL->GetPath(buff, countof(buff), NULL, 0)))
+ || FAILED(pSL->GetPath(buff, countof(buff), NULL, 0))) {
continue;
+ }
fn = buff;
}
@@ -231,35 +230,38 @@ void CPlayerPlaylistBar::ResolveLinkFiles( CAtlList<CString> &fns ) void CPlayerPlaylistBar::ParsePlayList(CAtlList<CString>& fns, CAtlList<CString>* subs)
{
- if(fns.IsEmpty()) return;
+ if(fns.IsEmpty()) {
+ return;
+ }
ResolveLinkFiles(fns);
CAtlList<CString> sl;
- if(SearchFiles(fns.GetHead(), sl))
- {
- if(sl.GetCount() > 1) subs = NULL;
+ if(SearchFiles(fns.GetHead(), sl)) {
+ if(sl.GetCount() > 1) {
+ subs = NULL;
+ }
POSITION pos = sl.GetHeadPosition();
- while(pos) ParsePlayList(sl.GetNext(pos), subs);
+ while(pos) {
+ ParsePlayList(sl.GetNext(pos), subs);
+ }
return;
}
CAtlList<CString> redir;
CStringA ct = GetContentType(fns.GetHead(), &redir);
- if(!redir.IsEmpty())
- {
+ if(!redir.IsEmpty()) {
POSITION pos = redir.GetHeadPosition();
- while(pos) ParsePlayList(sl.GetNext(pos), subs);
+ while(pos) {
+ ParsePlayList(sl.GetNext(pos), subs);
+ }
return;
}
- if(ct == "application/x-mpc-playlist")
- {
+ if(ct == "application/x-mpc-playlist") {
ParseMPCPlayList(fns.GetHead());
return;
- }
- else if(ct == "application/x-bdmv-playlist")
- {
+ } else if(ct == "application/x-bdmv-playlist") {
ParseBDMVPlayList(fns.GetHead());
return;
}
@@ -274,7 +276,9 @@ static int s_int_comp(const void* i1, const void* i2) static CString CombinePath(CPath p, CString fn)
{
- if(fn.Find(':') >= 0 || fn.Find(_T("\\")) == 0) return fn;
+ if(fn.Find(':') >= 0 || fn.Find(_T("\\")) == 0) {
+ return fn;
+ }
p.Append(CPath(fn));
return (LPCTSTR)p;
}
@@ -289,8 +293,7 @@ bool CPlayerPlaylistBar::ParseBDMVPlayList(CString fn) Path.RemoveFileSpec();
Path.RemoveFileSpec();
- if (SUCCEEDED (ClipInfo.FindMainMovie (Path + L"\\", strPlaylistFile, MainPlaylist)))
- {
+ if (SUCCEEDED (ClipInfo.FindMainMovie (Path + L"\\", strPlaylistFile, MainPlaylist))) {
CAtlList<CString> strFiles;
strFiles.AddHead (strPlaylistFile);
Append(strFiles, MainPlaylist.GetCount()>1, NULL);
@@ -306,62 +309,65 @@ bool CPlayerPlaylistBar::ParseMPCPlayList(CString fn) CAtlArray<int> idx;
CWebTextFile f;
- if(!f.Open(fn) || !f.ReadString(str) || str != _T("MPCPLAYLIST"))
+ if(!f.Open(fn) || !f.ReadString(str) || str != _T("MPCPLAYLIST")) {
return false;
+ }
- if(f.GetEncoding() == CTextFile::ASCII)
+ if(f.GetEncoding() == CTextFile::ASCII) {
f.SetEncoding(CTextFile::ANSI);
+ }
CPath base(fn);
base.RemoveFileSpec();
- while(f.ReadString(str))
- {
+ while(f.ReadString(str)) {
CAtlList<CString> sl;
Explode(str, sl, ',', 3);
- if(sl.GetCount() != 3) continue;
+ if(sl.GetCount() != 3) {
+ continue;
+ }
- if(int i = _ttoi(sl.RemoveHead()))
- {
+ if(int i = _ttoi(sl.RemoveHead())) {
CString key = sl.RemoveHead();
CString value = sl.RemoveHead();
- if(key == _T("type"))
- {
+ if(key == _T("type")) {
pli[i].m_type = (CPlaylistItem::type_t)_ttol(value);
idx.Add(i);
- }
- else if(key == _T("label")) pli[i].m_label = value;
- else if(key == _T("filename"))
- {
+ } else if(key == _T("label")) {
+ pli[i].m_label = value;
+ } else if(key == _T("filename")) {
value = CombinePath(base, value);
pli[i].m_fns.AddTail(value);
- }
- else if(key == _T("subtitle"))
- {
+ } else if(key == _T("subtitle")) {
value = CombinePath(base, value);
pli[i].m_subs.AddTail(value);
- }
- else if(key == _T("video"))
- {
- while(pli[i].m_fns.GetCount() < 2) pli[i].m_fns.AddTail(_T(""));
+ } else if(key == _T("video")) {
+ while(pli[i].m_fns.GetCount() < 2) {
+ pli[i].m_fns.AddTail(_T(""));
+ }
pli[i].m_fns.GetHead() = value;
- }
- else if(key == _T("audio"))
- {
- while(pli[i].m_fns.GetCount() < 2) pli[i].m_fns.AddTail(_T(""));
+ } else if(key == _T("audio")) {
+ while(pli[i].m_fns.GetCount() < 2) {
+ pli[i].m_fns.AddTail(_T(""));
+ }
pli[i].m_fns.GetTail() = value;
+ } else if(key == _T("vinput")) {
+ pli[i].m_vinput = _ttol(value);
+ } else if(key == _T("vchannel")) {
+ pli[i].m_vchannel = _ttol(value);
+ } else if(key == _T("ainput")) {
+ pli[i].m_ainput = _ttol(value);
+ } else if(key == _T("country")) {
+ pli[i].m_country = _ttol(value);
}
- else if(key == _T("vinput")) pli[i].m_vinput = _ttol(value);
- else if(key == _T("vchannel")) pli[i].m_vchannel = _ttol(value);
- else if(key == _T("ainput")) pli[i].m_ainput = _ttol(value);
- else if(key == _T("country")) pli[i].m_country = _ttol(value);
}
}
qsort(idx.GetData(), idx.GetCount(), sizeof(int), s_int_comp);
- for(int i = 0; i < idx.GetCount(); i++)
+ for(int i = 0; i < idx.GetCount(); i++) {
m_pl.AddTail(pli[idx[i]]);
+ }
return pli.GetCount() > 0;
}
@@ -369,14 +375,14 @@ bool CPlayerPlaylistBar::ParseMPCPlayList(CString fn) bool CPlayerPlaylistBar::SaveMPCPlayList(CString fn, CTextFile::enc e, bool fRemovePath)
{
CTextFile f;
- if(!f.Save(fn, e))
+ if(!f.Save(fn, e)) {
return false;
+ }
f.WriteString(_T("MPCPLAYLIST\n"));
POSITION pos = m_pl.GetHeadPosition(), pos2;
- for(int i = 1; pos; i++)
- {
+ for(int i = 1; pos; i++) {
CPlaylistItem& pli = m_pl.GetNext(pos);
CString idx;
@@ -386,17 +392,15 @@ bool CPlayerPlaylistBar::SaveMPCPlayList(CString fn, CTextFile::enc e, bool fRem str.Format(_T("%d,type,%d"), i, pli.m_type);
f.WriteString(str + _T("\n"));
- if(!pli.m_label.IsEmpty())
+ if(!pli.m_label.IsEmpty()) {
f.WriteString(idx + _T(",label,") + pli.m_label + _T("\n"));
+ }
- if(pli.m_type == CPlaylistItem::file)
- {
+ if(pli.m_type == CPlaylistItem::file) {
pos2 = pli.m_fns.GetHeadPosition();
- while(pos2)
- {
+ while(pos2) {
CString fn = pli.m_fns.GetNext(pos2);
- if(fRemovePath)
- {
+ if(fRemovePath) {
CPath p(fn);
p.StripPath();
fn = (LPCTSTR)p;
@@ -405,20 +409,16 @@ bool CPlayerPlaylistBar::SaveMPCPlayList(CString fn, CTextFile::enc e, bool fRem }
pos2 = pli.m_subs.GetHeadPosition();
- while(pos2)
- {
+ while(pos2) {
CString fn = pli.m_subs.GetNext(pos2);
- if(fRemovePath)
- {
+ if(fRemovePath) {
CPath p(fn);
p.StripPath();
fn = (LPCTSTR)p;
}
f.WriteString(idx + _T(",subtitle,") + fn + _T("\n"));
}
- }
- else if(pli.m_type == CPlaylistItem::device && pli.m_fns.GetCount() == 2)
- {
+ } else if(pli.m_type == CPlaylistItem::device && pli.m_fns.GetCount() == 2) {
f.WriteString(idx + _T(",video,") + pli.m_fns.GetHead() + _T("\n"));
f.WriteString(idx + _T(",audio,") + pli.m_fns.GetTail() + _T("\n"));
str.Format(_T("%d,vinput,%d"), i, pli.m_vinput);
@@ -457,14 +457,13 @@ void CPlayerPlaylistBar::Open(CAtlList<CString>& fns, bool fMulti, CAtlList<CStr void CPlayerPlaylistBar::Append(CAtlList<CString>& fns, bool fMulti, CAtlList<CString>* subs)
{
- if(fMulti)
- {
+ if(fMulti) {
ASSERT(subs == NULL || subs->GetCount() == 0);
POSITION pos = fns.GetHeadPosition();
- while(pos) ParsePlayList(fns.GetNext(pos), NULL);
- }
- else
- {
+ while(pos) {
+ ParsePlayList(fns.GetNext(pos), NULL);
+ }
+ } else {
ParsePlayList(fns, subs);
}
@@ -490,8 +489,12 @@ void CPlayerPlaylistBar::Append(CStringW vdn, CStringW adn, int vinput, int vcha CAtlList<CStringW> sl;
CStringW vfn = GetFriendlyName(vdn);
CStringW afn = GetFriendlyName(adn);
- if(!vfn.IsEmpty()) sl.AddTail(vfn);
- if(!afn.IsEmpty()) sl.AddTail(afn);
+ if(!vfn.IsEmpty()) {
+ sl.AddTail(vfn);
+ }
+ if(!afn.IsEmpty()) {
+ sl.AddTail(afn);
+ }
CStringW label = Implode(sl, '|');
label.Replace(L"|", L" - ");
pli.m_label = CString(label);
@@ -506,8 +509,7 @@ void CPlayerPlaylistBar::SetupList() m_list.DeleteAllItems();
POSITION pos = m_pl.GetHeadPosition();
- for(int i = 0; pos; i++)
- {
+ for(int i = 0; pos; i++) {
CPlaylistItem& pli = m_pl.GetAt(pos);
m_list.SetItemData(m_list.InsertItem(i, pli.GetLabel()), (DWORD_PTR)pos);
m_list.SetItemText(i, COL_TIME, pli.GetLabel(1));
@@ -518,8 +520,7 @@ void CPlayerPlaylistBar::SetupList() void CPlayerPlaylistBar::UpdateList()
{
POSITION pos = m_pl.GetHeadPosition();
- for(int i = 0, j = m_list.GetItemCount(); pos && i < j; i++)
- {
+ for(int i = 0, j = m_list.GetItemCount(); pos && i < j; i++) {
CPlaylistItem& pli = m_pl.GetAt(pos);
m_list.SetItemData(i, (DWORD_PTR)pos);
m_list.SetItemText(i, COL_NAME, pli.GetLabel(0));
@@ -531,7 +532,9 @@ void CPlayerPlaylistBar::UpdateList() void CPlayerPlaylistBar::EnsureVisible(POSITION pos)
{
int i = FindItem(m_pl.GetPos());
- if(i < 0) return;
+ if(i < 0) {
+ return;
+ }
m_list.EnsureVisible(i, TRUE);
m_list.Invalidate();
}
@@ -539,14 +542,17 @@ void CPlayerPlaylistBar::EnsureVisible(POSITION pos) int CPlayerPlaylistBar::FindItem(POSITION pos)
{
for(int i = 0; i < m_list.GetItemCount(); i++)
- if((POSITION)m_list.GetItemData(i) == pos)
+ if((POSITION)m_list.GetItemData(i) == pos) {
return(i);
+ }
return(-1);
}
POSITION CPlayerPlaylistBar::FindPos(int i)
{
- if(i < 0) return(NULL);
+ if(i < 0) {
+ return(NULL);
+ }
return((POSITION)m_list.GetItemData(i));
}
@@ -572,14 +578,18 @@ bool CPlayerPlaylistBar::IsAtEnd() bool CPlayerPlaylistBar::GetCur(CPlaylistItem& pli)
{
- if(!m_pl.GetPos()) return(false);
+ if(!m_pl.GetPos()) {
+ return(false);
+ }
pli = m_pl.GetAt(m_pl.GetPos());
return(true);
}
CPlaylistItem* CPlayerPlaylistBar::GetCur()
{
- if(!m_pl.GetPos()) return NULL;
+ if(!m_pl.GetPos()) {
+ return NULL;
+ }
return &m_pl.GetAt(m_pl.GetPos());
}
@@ -587,15 +597,18 @@ CString CPlayerPlaylistBar::GetCurFileName() {
CString fn;
CPlaylistItem* pli = GetCur();
- if(pli && !pli->m_fns.IsEmpty())
+ if(pli && !pli->m_fns.IsEmpty()) {
fn = pli->m_fns.GetHead();
+ }
return(fn);
}
void CPlayerPlaylistBar::SetNext()
{
POSITION pos = m_pl.GetPos(), org = pos;
- while(m_pl.GetNextWrap(pos).m_fInvalid && pos != org);
+ while(m_pl.GetNextWrap(pos).m_fInvalid && pos != org) {
+ ;
+ }
UpdateList();
m_pl.SetPos(pos);
EnsureVisible(pos);
@@ -604,7 +617,9 @@ void CPlayerPlaylistBar::SetNext() void CPlayerPlaylistBar::SetPrev()
{
POSITION pos = m_pl.GetPos(), org = pos;
- while(m_pl.GetPrevWrap(pos).m_fInvalid && pos != org);
+ while(m_pl.GetPrevWrap(pos).m_fInvalid && pos != org) {
+ ;
+ }
m_pl.SetPos(pos);
EnsureVisible(pos);
}
@@ -612,13 +627,14 @@ void CPlayerPlaylistBar::SetPrev() void CPlayerPlaylistBar::SetFirstSelected()
{
POSITION pos = m_list.GetFirstSelectedItemPosition();
- if(pos)
+ if(pos) {
pos = FindPos(m_list.GetNextSelectedItem(pos));
- else
- {
+ } else {
pos = m_pl.GetTailPosition();
POSITION org = pos;
- while(m_pl.GetNextWrap(pos).m_fInvalid && pos != org);
+ while(m_pl.GetNextWrap(pos).m_fInvalid && pos != org) {
+ ;
+ }
}
UpdateList();
m_pl.SetPos(pos);
@@ -628,7 +644,9 @@ void CPlayerPlaylistBar::SetFirstSelected() void CPlayerPlaylistBar::SetFirst()
{
POSITION pos = m_pl.GetTailPosition(), org = pos;
- while(m_pl.GetNextWrap(pos).m_fInvalid && pos != org);
+ while(m_pl.GetNextWrap(pos).m_fInvalid && pos != org) {
+ ;
+ }
UpdateList();
m_pl.SetPos(pos);
EnsureVisible(pos);
@@ -637,7 +655,9 @@ void CPlayerPlaylistBar::SetFirst() void CPlayerPlaylistBar::SetLast()
{
POSITION pos = m_pl.GetHeadPosition(), org = pos;
- while(m_pl.GetPrevWrap(pos).m_fInvalid && pos != org);
+ while(m_pl.GetPrevWrap(pos).m_fInvalid && pos != org) {
+ ;
+ }
m_pl.SetPos(pos);
EnsureVisible(pos);
}
@@ -645,11 +665,9 @@ void CPlayerPlaylistBar::SetLast() void CPlayerPlaylistBar::SetCurValid(bool fValid)
{
POSITION pos = m_pl.GetPos();
- if(pos)
- {
+ if(pos) {
m_pl.GetAt(pos).m_fInvalid = !fValid;
- if(!fValid)
- {
+ if(!fValid) {
int i = FindItem(pos);
m_list.RedrawItems(i, i);
}
@@ -659,8 +677,7 @@ void CPlayerPlaylistBar::SetCurValid(bool fValid) void CPlayerPlaylistBar::SetCurTime(REFERENCE_TIME rt)
{
POSITION pos = m_pl.GetPos();
- if(pos)
- {
+ if(pos) {
CPlaylistItem& pli = m_pl.GetAt(pos);
pli.m_duration = rt;
m_list.SetItemText(FindItem(pos), COL_TIME, pli.GetLabel(1));
@@ -670,41 +687,36 @@ void CPlayerPlaylistBar::SetCurTime(REFERENCE_TIME rt) OpenMediaData* CPlayerPlaylistBar::GetCurOMD(REFERENCE_TIME rtStart)
{
CPlaylistItem* pli = GetCur();
- if(pli == NULL)
+ if(pli == NULL) {
return NULL;
+ }
pli->AutoLoadFiles();
CString fn = CString(pli->m_fns.GetHead()).MakeLower();
if(fn.Find(_T("video_ts.ifo")) >= 0
- || fn.Find(_T(".ratdvd")) >= 0)
- {
- if(OpenDVDData* p = DNew OpenDVDData())
- {
+ || fn.Find(_T(".ratdvd")) >= 0) {
+ if(OpenDVDData* p = DNew OpenDVDData()) {
p->path = pli->m_fns.GetHead();
p->subs.AddTailList(&pli->m_subs);
return p;
}
}
- if(pli->m_type == CPlaylistItem::device)
- {
- if(OpenDeviceData* p = DNew OpenDeviceData())
- {
+ if(pli->m_type == CPlaylistItem::device) {
+ if(OpenDeviceData* p = DNew OpenDeviceData()) {
POSITION pos = pli->m_fns.GetHeadPosition();
- for(int i = 0; i < countof(p->DisplayName) && pos; i++)
+ for(int i = 0; i < countof(p->DisplayName) && pos; i++) {
p->DisplayName[i] = pli->m_fns.GetNext(pos);
+ }
p->vinput = pli->m_vinput;
p->vchannel = pli->m_vchannel;
p->ainput = pli->m_ainput;
return p;
}
- }
- else
- {
- if(OpenFileData* p = DNew OpenFileData())
- {
+ } else {
+ if(OpenFileData* p = DNew OpenFileData()) {
p->fns.AddTailList(&pli->m_fns);
p->subs.AddTailList(&pli->m_subs);
p->rtStart = rtStart;
@@ -717,14 +729,13 @@ OpenMediaData* CPlayerPlaylistBar::GetCurOMD(REFERENCE_TIME rtStart) bool CPlayerPlaylistBar::SelectFileInPlaylist(LPCTSTR filename)
{
- if (!filename)
+ if (!filename) {
return false;
+ }
POSITION pos = m_pl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CPlaylistItem& pli = m_pl.GetAt(pos);
- if (pli.FindFile(filename))
- {
+ if (pli.FindFile(filename)) {
m_pl.SetPos(pos);
EnsureVisible(pos);
return true;
@@ -738,20 +749,16 @@ void CPlayerPlaylistBar::LoadPlaylist(LPCTSTR filename) {
CString base;
- if(AfxGetMyApp()->GetAppSavePath(base))
- {
+ if(AfxGetMyApp()->GetAppSavePath(base)) {
CPath p;
p.Combine(base, _T("default.mpcpl"));
if(p.FileExists()) {
- if(AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("RememberPlaylistItems"), TRUE))
- {
+ if(AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("RememberPlaylistItems"), TRUE)) {
ParseMPCPlayList(p);
Refresh();
SelectFileInPlaylist(filename);
- }
- else
- {
+ } else {
::DeleteFile(p);
}
}
@@ -766,15 +773,14 @@ void CPlayerPlaylistBar::SavePlaylist() CPath p;
p.Combine(base, _T("default.mpcpl"));
- if(AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("RememberPlaylistItems"), TRUE))
- {
+ if(AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("RememberPlaylistItems"), TRUE)) {
// Only create this folder when needed
- if(!::PathFileExists(base))
+ if(!::PathFileExists(base)) {
::CreateDirectory(base, NULL);
+ }
SaveMPCPlayList(p, CTextFile::UTF8, false);
- }
- else if(p.FileExists()) {
+ } else if(p.FileExists()) {
::DeleteFile(p);
}
}
@@ -784,7 +790,7 @@ BEGIN_MESSAGE_MAP(CPlayerPlaylistBar, CSizingControlBarG) ON_WM_SIZE()
ON_NOTIFY(LVN_KEYDOWN, IDC_PLAYLIST, OnLvnKeyDown)
ON_NOTIFY(NM_DBLCLK, IDC_PLAYLIST, OnNMDblclkList)
-// ON_NOTIFY(NM_CUSTOMDRAW, IDC_PLAYLIST, OnCustomdrawList)
+ // ON_NOTIFY(NM_CUSTOMDRAW, IDC_PLAYLIST, OnCustomdrawList)
ON_WM_DRAWITEM()
ON_COMMAND_EX(ID_FILE_CLOSEPLAYLIST, OnFileClosePlaylist)
ON_COMMAND_EX(ID_PLAY_PLAY, OnPlayPlay)
@@ -803,8 +809,7 @@ END_MESSAGE_MAP() void CPlayerPlaylistBar::ResizeListColumn()
{
- if(::IsWindow(m_list.m_hWnd))
- {
+ if(::IsWindow(m_list.m_hWnd)) {
CRect r;
GetClientRect(r);
r.DeflateRect(2, 2);
@@ -831,15 +836,17 @@ void CPlayerPlaylistBar::OnLvnKeyDown(NMHDR* pNMHDR, LRESULT* pResult) CList<int> items;
POSITION pos = m_list.GetFirstSelectedItemPosition();
- while(pos) items.AddHead(m_list.GetNextSelectedItem(pos));
+ while(pos) {
+ items.AddHead(m_list.GetNextSelectedItem(pos));
+ }
- if(pLVKeyDown->wVKey == VK_DELETE && items.GetCount() > 0)
- {
+ if(pLVKeyDown->wVKey == VK_DELETE && items.GetCount() > 0) {
pos = items.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
int i = items.GetNext(pos);
- if(m_pl.RemoveAt(FindPos(i))) ((CMainFrame*)AfxGetMainWnd())->CloseMedia();
+ if(m_pl.RemoveAt(FindPos(i))) {
+ ((CMainFrame*)AfxGetMainWnd())->CloseMedia();
+ }
m_list.DeleteItem(i);
}
@@ -851,9 +858,7 @@ void CPlayerPlaylistBar::OnLvnKeyDown(NMHDR* pNMHDR, LRESULT* pResult) ResizeListColumn();
*pResult = TRUE;
- }
- else if(pLVKeyDown->wVKey == VK_SPACE && items.GetCount() == 1)
- {
+ } else if(pLVKeyDown->wVKey == VK_SPACE && items.GetCount() == 1) {
m_pl.SetPos(FindPos(items.GetHead()));
((CMainFrame*)AfxGetMainWnd())->OpenCurPlaylistItem();
@@ -866,11 +871,12 @@ void CPlayerPlaylistBar::OnNMDblclkList(NMHDR* pNMHDR, LRESULT* pResult) {
LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
- if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0)
- {
+ if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0) {
AppSettings& s = AfxGetAppSettings();
FILE_POSITION* FilePosition = s.CurrentFilePosition();
- if (FilePosition) FilePosition->llPosition = 0;
+ if (FilePosition) {
+ FilePosition->llPosition = 0;
+ }
m_pl.SetPos(FindPos(lpnmlv->iItem));
m_list.Invalidate();
@@ -923,7 +929,9 @@ void CPlayerPlaylistBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult) void CPlayerPlaylistBar::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
- if(nIDCtl != IDC_PLAYLIST) return;
+ if(nIDCtl != IDC_PLAYLIST) {
+ return;
+ }
int nItem = lpDrawItemStruct->itemID;
CRect rcItem = lpDrawItemStruct->rcItem;
@@ -933,27 +941,24 @@ void CPlayerPlaylistBar::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruc CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
- if(!!m_list.GetItemState(nItem, LVIS_SELECTED))
- {
+ if(!!m_list.GetItemState(nItem, LVIS_SELECTED)) {
FillRect(pDC->m_hDC, rcItem, CBrush(0xf1dacc));
FrameRect(pDC->m_hDC, rcItem, CBrush(0xc56a31));
- }
- else
- {
+ } else {
FillRect(pDC->m_hDC, rcItem, CBrush(GetSysColor(COLOR_WINDOW)));
}
COLORREF textcolor = fSelected?0xff:0;
- if(pli.m_fInvalid) textcolor |= 0xA0A0A0;
+ if(pli.m_fInvalid) {
+ textcolor |= 0xA0A0A0;
+ }
CString time = !pli.m_fInvalid ? m_list.GetItemText(nItem, COL_TIME) : _T("Invalid");
CSize timesize(0, 0);
CPoint timept(rcItem.right, 0);
- if(time.GetLength() > 0)
- {
+ if(time.GetLength() > 0) {
timesize = pDC->GetTextExtent(time);
- if((3+timesize.cx+3) < rcItem.Width()/2)
- {
+ if((3+timesize.cx+3) < rcItem.Width()/2) {
timept = CPoint(rcItem.right-(3+timesize.cx+3), (rcItem.top+rcItem.bottom-timesize.cy)/2);
pDC->SetTextColor(textcolor);
@@ -965,14 +970,12 @@ void CPlayerPlaylistBar::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruc fmt.Format(_T("%%0%dd. %%s"), (int)log10(0.1+m_pl.GetCount())+1);
file.Format(fmt, nItem+1, m_list.GetItemText(nItem, COL_NAME));
CSize filesize = pDC->GetTextExtent(file);
- while(3+filesize.cx+6 > timept.x && file.GetLength() > 3)
- {
+ while(3+filesize.cx+6 > timept.x && file.GetLength() > 3) {
file = file.Left(file.GetLength()-4) + _T("...");
filesize = pDC->GetTextExtent(file);
}
- if(file.GetLength() > 3)
- {
+ if(file.GetLength() > 3) {
pDC->SetTextColor(textcolor);
pDC->TextOut(rcItem.left+3, (rcItem.top+rcItem.bottom-filesize.cy)/2, file);
}
@@ -997,8 +1000,7 @@ void CPlayerPlaylistBar::OnDropFiles(HDROP hDropInfo) CAtlList<CString> sl;
UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
- for(UINT iFile = 0; iFile < nFiles; iFile++)
- {
+ for(UINT iFile = 0; iFile < nFiles; iFile++) {
TCHAR szFileName[_MAX_PATH];
::DragQueryFile(hDropInfo, iFile, szFileName, _MAX_PATH);
sl.AddTail(szFileName);
@@ -1030,8 +1032,7 @@ void CPlayerPlaylistBar::OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult) void CPlayerPlaylistBar::OnMouseMove(UINT nFlags, CPoint point)
{
- if(m_bDragging)
- {
+ if(m_bDragging) {
m_ptDropPoint = point;
ClientToScreen(&m_ptDropPoint);
@@ -1047,15 +1048,17 @@ void CPlayerPlaylistBar::OnMouseMove(UINT nFlags, CPoint point) int iTopItem = m_list.GetTopIndex();
int iBottomItem = m_list.GetBottomIndex();
- if(iOverItem == iTopItem && iTopItem != 0) // top of list
+ if(iOverItem == iTopItem && iTopItem != 0) { // top of list
SetTimer(1, 100, NULL);
- else
+ } else {
KillTimer(1);
+ }
- if(iOverItem >= iBottomItem && iBottomItem != (m_list.GetItemCount() - 1)) // bottom of list
+ if(iOverItem >= iBottomItem && iBottomItem != (m_list.GetItemCount() - 1)) { // bottom of list
SetTimer(2, 100, NULL);
- else
+ } else {
KillTimer(2);
+ }
}
}
@@ -1067,21 +1070,21 @@ void CPlayerPlaylistBar::OnTimer(UINT_PTR nIDEvent) int iTopItem = m_list.GetTopIndex();
int iBottomItem = iTopItem + m_list.GetCountPerPage() - 1;
- if(m_bDragging)
- {
+ if(m_bDragging) {
m_pDragImage->DragShowNolock(FALSE);
- if(nIDEvent == 1)
- {
+ if(nIDEvent == 1) {
m_list.EnsureVisible(iTopItem - 1, false);
m_list.UpdateWindow();
- if(m_list.GetTopIndex() == 0) KillTimer(1);
- }
- else if(nIDEvent == 2)
- {
+ if(m_list.GetTopIndex() == 0) {
+ KillTimer(1);
+ }
+ } else if(nIDEvent == 2) {
m_list.EnsureVisible(iBottomItem + 1, false);
m_list.UpdateWindow();
- if(m_list.GetBottomIndex() == (m_list.GetItemCount() - 1)) KillTimer(2);
+ if(m_list.GetBottomIndex() == (m_list.GetItemCount() - 1)) {
+ KillTimer(2);
+ }
}
m_pDragImage->DragShowNolock(TRUE);
@@ -1092,8 +1095,7 @@ void CPlayerPlaylistBar::OnTimer(UINT_PTR nIDEvent) void CPlayerPlaylistBar::OnLButtonUp(UINT nFlags, CPoint point)
{
- if(m_bDragging)
- {
+ if(m_bDragging) {
::ReleaseCapture();
m_bDragging = FALSE;
@@ -1109,8 +1111,9 @@ void CPlayerPlaylistBar::OnLButtonUp(UINT nFlags, CPoint point) CPoint pt(point);
ClientToScreen(&pt);
- if(WindowFromPoint(pt) == &m_list)
+ if(WindowFromPoint(pt) == &m_list) {
DropItemOnList();
+ }
}
ModifyStyle(0, WS_EX_ACCEPTFILES);
@@ -1133,7 +1136,9 @@ void CPlayerPlaylistBar::DropItemOnList() lvi.cchTextMax = _MAX_PATH;
m_list.GetItem(&lvi);
- if(m_nDropIndex < 0) m_nDropIndex = m_list.GetItemCount();
+ if(m_nDropIndex < 0) {
+ m_nDropIndex = m_list.GetItemCount();
+ }
lvi.iItem = m_nDropIndex;
m_list.InsertItem(&lvi);
@@ -1142,9 +1147,10 @@ void CPlayerPlaylistBar::DropItemOnList() lvi.mask = LVIF_TEXT;
lvi.iItem = m_nDropIndex;
//INDEX OF DRAGGED ITEM WILL CHANGE IF ITEM IS DROPPED ABOVE ITSELF
- if(m_nDropIndex < m_nDragIndex) m_nDragIndex++;
- for(int col=1; col < nColumnCount; col++)
- {
+ if(m_nDropIndex < m_nDragIndex) {
+ m_nDragIndex++;
+ }
+ for(int col=1; col < nColumnCount; col++) {
_tcscpy(lvi.pszText, (LPCTSTR)(m_list.GetItemText(m_nDragIndex, col)));
lvi.iSubItem = col;
m_list.SetItem(&lvi);
@@ -1154,20 +1160,22 @@ void CPlayerPlaylistBar::DropItemOnList() CList<CPlaylistItem> tmp;
UINT id = (UINT)-1;
- for(int i = 0; i < m_list.GetItemCount(); i++)
- {
+ for(int i = 0; i < m_list.GetItemCount(); i++) {
POSITION pos = (POSITION)m_list.GetItemData(i);
CPlaylistItem& pli = m_pl.GetAt(pos);
tmp.AddTail(pli);
- if(pos == m_pl.GetPos()) id = pli.m_id;
+ if(pos == m_pl.GetPos()) {
+ id = pli.m_id;
+ }
}
m_pl.RemoveAll();
POSITION pos = tmp.GetHeadPosition();
- for(int i = 0; pos; i++)
- {
+ for(int i = 0; pos; i++) {
CPlaylistItem& pli = tmp.GetNext(pos);
m_pl.AddTail(pli);
- if(pli.m_id == id) m_pl.SetPos(m_pl.GetTailPosition());
+ if(pli.m_id == id) {
+ m_pl.SetPos(m_pl.GetTailPosition());
+ }
m_list.SetItemData(i, (DWORD_PTR)m_pl.GetTailPosition());
}
@@ -1178,47 +1186,52 @@ BOOL CPlayerPlaylistBar::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResul {
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
- if (pNMHDR->code == TTN_NEEDTEXTW && (HWND)pTTTW->lParam != m_list.m_hWnd)
+ if (pNMHDR->code == TTN_NEEDTEXTW && (HWND)pTTTW->lParam != m_list.m_hWnd) {
return FALSE;
+ }
int row = ((pNMHDR->idFrom-1) >> 10) & 0x3fffff;
int col = (pNMHDR->idFrom-1) & 0x3ff;
- if(row < 0 || row >= m_pl.GetCount())
+ if(row < 0 || row >= m_pl.GetCount()) {
return FALSE;
+ }
CPlaylistItem& pli = m_pl.GetAt(FindPos(row));
CString strTipText;
- if(col == COL_NAME)
- {
+ if(col == COL_NAME) {
POSITION pos = pli.m_fns.GetHeadPosition();
- while(pos) strTipText += _T("\n") + pli.m_fns.GetNext(pos);
+ while(pos) {
+ strTipText += _T("\n") + pli.m_fns.GetNext(pos);
+ }
strTipText.Trim();
- if(pli.m_type == CPlaylistItem::device)
- {
+ if(pli.m_type == CPlaylistItem::device) {
CString str;
str.Format(_T("Video Input %d"), pli.m_vinput);
- if(pli.m_vinput >= 0) strTipText += _T("\n") + str;
+ if(pli.m_vinput >= 0) {
+ strTipText += _T("\n") + str;
+ }
str.Format(_T("Video Channel %d"), pli.m_vchannel);
- if(pli.m_vchannel >= 0) strTipText += _T("\n") + str;
+ if(pli.m_vchannel >= 0) {
+ strTipText += _T("\n") + str;
+ }
str.Format(_T("Audio Input %d"), pli.m_ainput);
- if(pli.m_ainput >= 0) strTipText += _T("\n") + str;
+ if(pli.m_ainput >= 0) {
+ strTipText += _T("\n") + str;
+ }
}
::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, (LPARAM)(INT)1000);
- }
- else if(col == COL_TIME)
- {
+ } else if(col == COL_TIME) {
return FALSE;
}
static CStringW m_strTipTextW;
- if(pNMHDR->code == TTN_NEEDTEXTW) //?possible check is not needed
- {
+ if(pNMHDR->code == TTN_NEEDTEXTW) { //?possible check is not needed
m_strTipTextW = strTipText;
pTTTW->lpszText = (LPWSTR)(LPCWSTR)m_strTipTextW;
}
@@ -1236,21 +1249,22 @@ void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p) m_list.SubItemHitTest(&lvhti);
POSITION pos = FindPos(lvhti.iItem);
-// bool fSelected = (pos == m_pl.GetPos());
+ // bool fSelected = (pos == m_pl.GetPos());
bool fOnItem = !!(lvhti.flags&LVHT_ONITEM);
CMenu m;
m.CreatePopupMenu();
- enum
- {
+ enum {
M_OPEN=1, M_ADD, M_REMOVE, M_CLIPBOARD, M_SAVEAS,
M_SORTBYNAME, M_SORTBYPATH, M_RANDOMIZE, M_SORTBYID,
M_REMEMBERPLAYLIST, M_SHUFFLE, M_HIDEFULLSCREEN
};
m.AppendMenu(MF_STRING|(!fOnItem?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_OPEN, ResStr(IDS_PLAYLIST_OPEN));
- if(((CMainFrame*)AfxGetMainWnd())->GetPlaybackMode() == PM_CAPTURE) m.AppendMenu(MF_STRING|MF_ENABLED, M_ADD, ResStr(IDS_PLAYLIST_ADD));
+ if(((CMainFrame*)AfxGetMainWnd())->GetPlaybackMode() == PM_CAPTURE) {
+ m.AppendMenu(MF_STRING|MF_ENABLED, M_ADD, ResStr(IDS_PLAYLIST_ADD));
+ }
m.AppendMenu(MF_STRING|(/*fSelected||*/!fOnItem?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_REMOVE, ResStr(IDS_PLAYLIST_REMOVE));
m.AppendMenu(MF_SEPARATOR);
m.AppendMenu(MF_STRING|(!fOnItem?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_CLIPBOARD, ResStr(IDS_PLAYLIST_COPYTOCLIPBOARD));
@@ -1269,224 +1283,219 @@ void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p) CMainFrame* pMainFrm = (CMainFrame*)AfxGetMainWnd();
int nID = (int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this);
- switch(nID)
- {
- case M_OPEN:
- m_pl.SetPos(pos);
- m_list.Invalidate();
- pMainFrm->OpenCurPlaylistItem();
- break;
- case M_ADD:
- pMainFrm->AddCurDevToPlaylist();
- m_pl.SetPos(m_pl.GetTailPosition());
- break;
- case M_REMOVE:
- if(m_pl.RemoveAt(pos)) pMainFrm->CloseMedia();
- m_list.DeleteItem(lvhti.iItem);
- SavePlaylist();
- break;
- case M_SORTBYID:
- m_pl.SortById();
- SetupList();
- SavePlaylist();
- break;
- case M_SORTBYNAME:
- m_pl.SortByName();
- SetupList();
- SavePlaylist();
- break;
- case M_SORTBYPATH:
- m_pl.SortByPath();
- SetupList();
- SavePlaylist();
- break;
- case M_RANDOMIZE:
- m_pl.Randomize();
- SetupList();
- SavePlaylist();
- break;
- case M_CLIPBOARD:
- if(OpenClipboard() && EmptyClipboard())
- {
- CString str;
+ switch(nID) {
+ case M_OPEN:
+ m_pl.SetPos(pos);
+ m_list.Invalidate();
+ pMainFrm->OpenCurPlaylistItem();
+ break;
+ case M_ADD:
+ pMainFrm->AddCurDevToPlaylist();
+ m_pl.SetPos(m_pl.GetTailPosition());
+ break;
+ case M_REMOVE:
+ if(m_pl.RemoveAt(pos)) {
+ pMainFrm->CloseMedia();
+ }
+ m_list.DeleteItem(lvhti.iItem);
+ SavePlaylist();
+ break;
+ case M_SORTBYID:
+ m_pl.SortById();
+ SetupList();
+ SavePlaylist();
+ break;
+ case M_SORTBYNAME:
+ m_pl.SortByName();
+ SetupList();
+ SavePlaylist();
+ break;
+ case M_SORTBYPATH:
+ m_pl.SortByPath();
+ SetupList();
+ SavePlaylist();
+ break;
+ case M_RANDOMIZE:
+ m_pl.Randomize();
+ SetupList();
+ SavePlaylist();
+ break;
+ case M_CLIPBOARD:
+ if(OpenClipboard() && EmptyClipboard()) {
+ CString str;
+
+ CPlaylistItem& pli = m_pl.GetAt(pos);
+ POSITION pos = pli.m_fns.GetHeadPosition();
+ while(pos) {
+ str += _T("\r\n") + pli.m_fns.GetNext(pos);
+ }
+ str.Trim();
- CPlaylistItem& pli = m_pl.GetAt(pos);
- POSITION pos = pli.m_fns.GetHeadPosition();
- while(pos) str += _T("\r\n") + pli.m_fns.GetNext(pos);
- str.Trim();
-
- if(HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, (str.GetLength()+1)*sizeof(TCHAR)))
- {
- if(TCHAR* s = (TCHAR*)GlobalLock(h))
- {
- _tcscpy(s, str);
- GlobalUnlock(h);
+ if(HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, (str.GetLength()+1)*sizeof(TCHAR))) {
+ if(TCHAR* s = (TCHAR*)GlobalLock(h)) {
+ _tcscpy(s, str);
+ GlobalUnlock(h);
#ifdef UNICODE
- SetClipboardData(CF_UNICODETEXT, h);
+ SetClipboardData(CF_UNICODETEXT, h);
#else
- SetClipboardData(CF_TEXT, h);
+ SetClipboardData(CF_TEXT, h);
#endif
+ }
}
+ CloseClipboard();
}
- CloseClipboard();
- }
- break;
- case M_SAVEAS:
- {
- CSaveTextFileDialog fd(
- CTextFile::ASCII, NULL, NULL,
- _T("Media Player Classic playlist (*.mpcpl)|*.mpcpl|Playlist (*.pls)|*.pls|Winamp playlist (*.m3u)|*.m3u|Windows Media playlist (*.asx)|*.asx||"),
- this);
-
- if(fd.DoModal() != IDOK)
break;
+ case M_SAVEAS: {
+ CSaveTextFileDialog fd(
+ CTextFile::ASCII, NULL, NULL,
+ _T("Media Player Classic playlist (*.mpcpl)|*.mpcpl|Playlist (*.pls)|*.pls|Winamp playlist (*.m3u)|*.m3u|Windows Media playlist (*.asx)|*.asx||"),
+ this);
- CTextFile::enc encoding = (CTextFile::enc)fd.GetEncoding();
- if(encoding == CTextFile::ASCII) encoding = CTextFile::ANSI;
-
- int idx = fd.m_pOFN->nFilterIndex;
+ if(fd.DoModal() != IDOK) {
+ break;
+ }
- CPath path(fd.GetPathName());
+ CTextFile::enc encoding = (CTextFile::enc)fd.GetEncoding();
+ if(encoding == CTextFile::ASCII) {
+ encoding = CTextFile::ANSI;
+ }
- switch(idx)
- {
- case 1:
- path.AddExtension(_T(".mpcpl"));
- break;
- case 2:
- path.AddExtension(_T(".pls"));
- break;
- case 3:
- path.AddExtension(_T(".m3u"));
- break;
- case 4:
- path.AddExtension(_T(".asx"));
- break;
- default:
- break;
- }
+ int idx = fd.m_pOFN->nFilterIndex;
+
+ CPath path(fd.GetPathName());
+
+ switch(idx) {
+ case 1:
+ path.AddExtension(_T(".mpcpl"));
+ break;
+ case 2:
+ path.AddExtension(_T(".pls"));
+ break;
+ case 3:
+ path.AddExtension(_T(".m3u"));
+ break;
+ case 4:
+ path.AddExtension(_T(".asx"));
+ break;
+ default:
+ break;
+ }
- bool fRemovePath = true;
+ bool fRemovePath = true;
- CPath p(path);
- p.RemoveFileSpec();
- CString base = (LPCTSTR)p;
+ CPath p(path);
+ p.RemoveFileSpec();
+ CString base = (LPCTSTR)p;
- pos = m_pl.GetHeadPosition();
- while(pos && fRemovePath)
- {
- CPlaylistItem& pli = m_pl.GetNext(pos);
+ pos = m_pl.GetHeadPosition();
+ while(pos && fRemovePath) {
+ CPlaylistItem& pli = m_pl.GetNext(pos);
- if(pli.m_type != CPlaylistItem::file) fRemovePath = false;
- else
- {
- POSITION pos;
+ if(pli.m_type != CPlaylistItem::file) {
+ fRemovePath = false;
+ } else {
+ POSITION pos;
- pos = pli.m_fns.GetHeadPosition();
- while(pos && fRemovePath)
- {
- CString fn = pli.m_fns.GetNext(pos);
+ pos = pli.m_fns.GetHeadPosition();
+ while(pos && fRemovePath) {
+ CString fn = pli.m_fns.GetNext(pos);
- CPath p(fn);
- p.RemoveFileSpec();
- if(base != (LPCTSTR)p) fRemovePath = false;
- }
+ CPath p(fn);
+ p.RemoveFileSpec();
+ if(base != (LPCTSTR)p) {
+ fRemovePath = false;
+ }
+ }
- pos = pli.m_subs.GetHeadPosition();
- while(pos && fRemovePath)
- {
- CString fn = pli.m_subs.GetNext(pos);
+ pos = pli.m_subs.GetHeadPosition();
+ while(pos && fRemovePath) {
+ CString fn = pli.m_subs.GetNext(pos);
- CPath p(fn);
- p.RemoveFileSpec();
- if(base != (LPCTSTR)p) fRemovePath = false;
+ CPath p(fn);
+ p.RemoveFileSpec();
+ if(base != (LPCTSTR)p) {
+ fRemovePath = false;
+ }
+ }
}
}
- }
-
- if(idx == 1)
- {
- SaveMPCPlayList(path, encoding, fRemovePath);
- break;
- }
- CTextFile f;
- if(!f.Save(path, encoding))
- break;
+ if(idx == 1) {
+ SaveMPCPlayList(path, encoding, fRemovePath);
+ break;
+ }
- if (idx == 2)
- {
- f.WriteString(_T("[playlist]\n"));
- }
- else if (idx == 4)
- {
- f.WriteString(_T("<ASX version = \"3.0\">\n"));
- }
+ CTextFile f;
+ if(!f.Save(path, encoding)) {
+ break;
+ }
- pos = m_pl.GetHeadPosition();
- CString str;
- int i;
- for(i = 0; pos; i++)
- {
- CPlaylistItem& pli = m_pl.GetNext(pos);
+ if (idx == 2) {
+ f.WriteString(_T("[playlist]\n"));
+ } else if (idx == 4) {
+ f.WriteString(_T("<ASX version = \"3.0\">\n"));
+ }
- if(pli.m_type != CPlaylistItem::file)
- continue;
+ pos = m_pl.GetHeadPosition();
+ CString str;
+ int i;
+ for(i = 0; pos; i++) {
+ CPlaylistItem& pli = m_pl.GetNext(pos);
- CString fn = pli.m_fns.GetHead();
+ if(pli.m_type != CPlaylistItem::file) {
+ continue;
+ }
-/*
- if(fRemovePath)
- {
- CPath p(path);
- p.StripPath();
- fn = (LPCTSTR)p;
+ CString fn = pli.m_fns.GetHead();
+
+ /*
+ if(fRemovePath)
+ {
+ CPath p(path);
+ p.StripPath();
+ fn = (LPCTSTR)p;
+ }
+ */
+
+ switch(idx) {
+ case 2:
+ str.Format(_T("File%d=%s\n"), i+1, fn);
+ break;
+ case 3:
+ str.Format(_T("%s\n"), fn);
+ break;
+ case 4:
+ str.Format(_T("<Entry><Ref href = \"%s\"/></Entry>\n"), fn);
+ break;
+ default:
+ break;
+ }
+ f.WriteString(str);
}
-*/
- switch(idx)
- {
- case 2:
- str.Format(_T("File%d=%s\n"), i+1, fn);
- break;
- case 3:
- str.Format(_T("%s\n"), fn);
- break;
- case 4:
- str.Format(_T("<Entry><Ref href = \"%s\"/></Entry>\n"), fn);
- break;
- default:
- break;
+ if (idx == 2) {
+ str.Format(_T("NumberOfEntries=%d\n"), i);
+ f.WriteString(str);
+ f.WriteString(_T("Version=2\n"));
+ } else if (idx == 4) {
+ f.WriteString(_T("</ASX>\n"));
}
- f.WriteString(str);
}
-
- if (idx == 2)
- {
- str.Format(_T("NumberOfEntries=%d\n"), i);
- f.WriteString(str);
- f.WriteString(_T("Version=2\n"));
- }
- else if (idx == 4)
- {
- f.WriteString(_T("</ASX>\n"));
- }
- }
- break;
- case M_REMEMBERPLAYLIST:
- AfxGetApp()->WriteProfileInt(IDS_R_SETTINGS, _T("RememberPlaylistItems"),
- !AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("RememberPlaylistItems"), TRUE));
- break;
- case M_SHUFFLE:
- AfxGetApp()->WriteProfileInt(IDS_R_SETTINGS, _T("ShufflePlaylistItems"),
- !AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("ShufflePlaylistItems"), FALSE));
- break;
- case M_HIDEFULLSCREEN:
- AfxGetApp()->WriteProfileInt(IDS_R_SETTINGS, _T("HidePlaylistFullScreen"),
- !AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("HidePlaylistFullScreen"), FALSE));
- break;
- default:
break;
+ case M_REMEMBERPLAYLIST:
+ AfxGetApp()->WriteProfileInt(IDS_R_SETTINGS, _T("RememberPlaylistItems"),
+ !AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("RememberPlaylistItems"), TRUE));
+ break;
+ case M_SHUFFLE:
+ AfxGetApp()->WriteProfileInt(IDS_R_SETTINGS, _T("ShufflePlaylistItems"),
+ !AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("ShufflePlaylistItems"), FALSE));
+ break;
+ case M_HIDEFULLSCREEN:
+ AfxGetApp()->WriteProfileInt(IDS_R_SETTINGS, _T("HidePlaylistFullScreen"),
+ !AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("HidePlaylistFullScreen"), FALSE));
+ break;
+ default:
+ break;
}
}
@@ -1494,8 +1503,7 @@ void CPlayerPlaylistBar::OnLvnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) {
NMLVDISPINFO* pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
- if(pDispInfo->item.iItem >= 0 && pDispInfo->item.pszText)
- {
+ if(pDispInfo->item.iItem >= 0 && pDispInfo->item.pszText) {
CPlaylistItem& pli = m_pl.GetAt((POSITION)m_list.GetItemData(pDispInfo->item.iItem));
pli.m_label = pDispInfo->item.pszText;
m_list.SetItemText(pDispInfo->item.iItem, 0, pDispInfo->item.pszText);
diff --git a/src/apps/mplayerc/PlayerPlaylistBar.h b/src/apps/mplayerc/PlayerPlaylistBar.h index a2eb40f62..56480eeb4 100644 --- a/src/apps/mplayerc/PlayerPlaylistBar.h +++ b/src/apps/mplayerc/PlayerPlaylistBar.h @@ -117,7 +117,7 @@ public: afx_msg void OnLvnKeyDown(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnNMDblclkList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnLvnKeydownList(NMHDR* pNMHDR, LRESULT* pResult);
-// afx_msg void OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult);
+ // afx_msg void OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
afx_msg BOOL OnFileClosePlaylist(UINT nID);
afx_msg BOOL OnPlayPlay(UINT nID);
diff --git a/src/apps/mplayerc/PlayerSeekBar.cpp b/src/apps/mplayerc/PlayerSeekBar.cpp index 93ca04c90..416307963 100644 --- a/src/apps/mplayerc/PlayerSeekBar.cpp +++ b/src/apps/mplayerc/PlayerSeekBar.cpp @@ -43,16 +43,18 @@ CPlayerSeekBar::~CPlayerSeekBar() BOOL CPlayerSeekBar::Create(CWnd* pParentWnd)
{
- if(!CDialogBar::Create(pParentWnd, IDD_PLAYERSEEKBAR, WS_CHILD|WS_VISIBLE|CBRS_ALIGN_BOTTOM, IDD_PLAYERSEEKBAR))
+ if(!CDialogBar::Create(pParentWnd, IDD_PLAYERSEEKBAR, WS_CHILD|WS_VISIBLE|CBRS_ALIGN_BOTTOM, IDD_PLAYERSEEKBAR)) {
return FALSE;
+ }
return TRUE;
}
BOOL CPlayerSeekBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CDialogBar::PreCreateWindow(cs))
+ if(!CDialogBar::PreCreateWindow(cs)) {
return FALSE;
+ }
m_dwStyle &= ~CBRS_BORDER_TOP;
m_dwStyle &= ~CBRS_BORDER_BOTTOM;
@@ -75,10 +77,14 @@ void CPlayerSeekBar::GetRange(__int64& start, __int64& stop) void CPlayerSeekBar::SetRange(__int64 start, __int64 stop)
{
- if(start > stop) start ^= stop, stop ^= start, start ^= stop;
+ if(start > stop) {
+ start ^= stop, stop ^= start, start ^= stop;
+ }
m_start = start;
m_stop = stop;
- if(m_pos < m_start || m_pos >= m_stop) SetPos(m_start);
+ if(m_pos < m_start || m_pos >= m_stop) {
+ SetPos(m_start);
+ }
}
__int64 CPlayerSeekBar::GetPos()
@@ -94,27 +100,31 @@ __int64 CPlayerSeekBar::GetPosReal() void CPlayerSeekBar::SetPos(__int64 pos)
{
CWnd* w = GetCapture();
- if(w && w->m_hWnd == m_hWnd) return;
+ if(w && w->m_hWnd == m_hWnd) {
+ return;
+ }
SetPosInternal(pos);
}
void CPlayerSeekBar::SetPosInternal(__int64 pos)
{
- if(m_pos == pos) return;
+ if(m_pos == pos) {
+ return;
+ }
CRect before = GetThumbRect();
m_pos = min(max(pos, m_start), m_stop);
m_posreal = pos;
CRect after = GetThumbRect();
- if(before != after)
- {
+ if(before != after) {
InvalidateRect(before | after);
CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
- if((AfxGetAppSettings().fUseWin7TaskBar)&&(pFrame->m_pTaskbarList))
+ if((AfxGetAppSettings().fUseWin7TaskBar)&&(pFrame->m_pTaskbarList)) {
pFrame->m_pTaskbarList->SetProgressValue ( pFrame->m_hWnd, pos, m_stop );
+ }
}
}
@@ -129,7 +139,7 @@ CRect CPlayerSeekBar::GetChannelRect() CRect CPlayerSeekBar::GetThumbRect()
{
-// bool fEnabled = m_fEnabled || m_start >= m_stop;
+ // bool fEnabled = m_fEnabled || m_start >= m_stop;
CRect r = GetChannelRect();
@@ -156,15 +166,19 @@ void CPlayerSeekBar::MoveThumb(CPoint point) {
CRect r = GetChannelRect();
- if(r.left >= r.right) return;
+ if(r.left >= r.right) {
+ return;
+ }
- if(point.x < r.left) SetPos(m_start);
- else if(point.x >= r.right) SetPos(m_stop);
- else
- {
+ if(point.x < r.left) {
+ SetPos(m_start);
+ } else if(point.x >= r.right) {
+ SetPos(m_stop);
+ } else {
__int64 w = r.right - r.left;
- if(m_start < m_stop)
+ if(m_start < m_stop) {
SetPosInternal(m_start + ((m_stop - m_start) * (point.x - r.left) + (w/2)) / w);
+ }
}
}
@@ -215,8 +229,7 @@ void CPlayerSeekBar::OnPaint() r.DeflateRect(1, 1, 0, 0);
dc.Draw3dRect(&r, shadow, bkg);
- if(fEnabled)
- {
+ if(fEnabled) {
r.DeflateRect(1, 1, 1, 2);
CPen white(PS_INSIDEFRAME, 1, white);
CPen* old = dc.SelectObject(&white);
@@ -272,8 +285,7 @@ void CPlayerSeekBar::OnSize(UINT nType, int cx, int cy) void CPlayerSeekBar::OnLButtonDown(UINT nFlags, CPoint point)
{
- if(m_fEnabled && (GetChannelRect() | GetThumbRect()).PtInRect(point))
- {
+ if(m_fEnabled && (GetChannelRect() | GetThumbRect()).PtInRect(point)) {
SetCapture();
MoveThumb(point);
GetParent()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)m_pos, SB_THUMBPOSITION), (LPARAM)m_hWnd);
@@ -292,8 +304,7 @@ void CPlayerSeekBar::OnLButtonUp(UINT nFlags, CPoint point) void CPlayerSeekBar::OnMouseMove(UINT nFlags, CPoint point)
{
CWnd* w = GetCapture();
- if(w && w->m_hWnd == m_hWnd && (nFlags & MK_LBUTTON))
- {
+ if(w && w->m_hWnd == m_hWnd && (nFlags & MK_LBUTTON)) {
MoveThumb(point);
GetParent()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)m_pos, SB_THUMBTRACK), (LPARAM)m_hWnd);
}
diff --git a/src/apps/mplayerc/PlayerSeekBar.h b/src/apps/mplayerc/PlayerSeekBar.h index c59463b45..260198b8d 100644 --- a/src/apps/mplayerc/PlayerSeekBar.h +++ b/src/apps/mplayerc/PlayerSeekBar.h @@ -52,14 +52,14 @@ public: void SetPos(__int64 pos);
-// Overrides
+ // Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPlayerSeekBar)
virtual BOOL Create(CWnd* pParentWnd);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
-// Generated message map functions
+ // Generated message map functions
protected:
//{{AFX_MSG(CPlayerSeekBar)
afx_msg void OnPaint();
diff --git a/src/apps/mplayerc/PlayerShaderEditorBar.cpp b/src/apps/mplayerc/PlayerShaderEditorBar.cpp index 53b0a0b01..79d2c397e 100644 --- a/src/apps/mplayerc/PlayerShaderEditorBar.cpp +++ b/src/apps/mplayerc/PlayerShaderEditorBar.cpp @@ -38,8 +38,9 @@ CPlayerShaderEditorBar::~CPlayerShaderEditorBar() BOOL CPlayerShaderEditorBar::Create(CWnd* pParentWnd)
{
- if(!__super::Create(_T("Shader Editor"), pParentWnd, ID_VIEW_SHADEREDITOR))
+ if(!__super::Create(_T("Shader Editor"), pParentWnd, ID_VIEW_SHADEREDITOR)) {
return FALSE;
+ }
m_dlg.Create(this);
m_dlg.ShowWindow(SW_SHOWNORMAL);
@@ -56,16 +57,15 @@ BOOL CPlayerShaderEditorBar::Create(CWnd* pParentWnd) BOOL CPlayerShaderEditorBar::PreTranslateMessage(MSG* pMsg)
{
- if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
- {
- if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE)
- {
+ if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) {
+ if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) {
GetParentFrame()->ShowControlBar(this, FALSE, TRUE);
return TRUE;
}
- if(IsDialogMessage(pMsg))
+ if(IsDialogMessage(pMsg)) {
return TRUE;
+ }
}
return __super::PreTranslateMessage(pMsg);
@@ -81,8 +81,7 @@ void CPlayerShaderEditorBar::OnSize(UINT nType, int cx, int cy) {
__super::OnSize(nType, cx, cy);
- if(::IsWindow(m_dlg.m_hWnd))
- {
+ if(::IsWindow(m_dlg.m_hWnd)) {
CRect r;
GetClientRect(r);
m_dlg.MoveWindow(r);
diff --git a/src/apps/mplayerc/PlayerStatusBar.cpp b/src/apps/mplayerc/PlayerStatusBar.cpp index 45926481e..6370d21f1 100644 --- a/src/apps/mplayerc/PlayerStatusBar.cpp +++ b/src/apps/mplayerc/PlayerStatusBar.cpp @@ -42,7 +42,9 @@ CPlayerStatusBar::CPlayerStatusBar() CPlayerStatusBar::~CPlayerStatusBar()
{
- if(m_hIcon) DestroyIcon(m_hIcon);
+ if(m_hIcon) {
+ DestroyIcon(m_hIcon);
+ }
}
BOOL CPlayerStatusBar::Create(CWnd* pParentWnd)
@@ -52,8 +54,9 @@ BOOL CPlayerStatusBar::Create(CWnd* pParentWnd) BOOL CPlayerStatusBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CDialogBar::PreCreateWindow(cs))
+ if(!CDialogBar::PreCreateWindow(cs)) {
return FALSE;
+ }
m_dwStyle &= ~CBRS_BORDER_TOP;
m_dwStyle &= ~CBRS_BORDER_BOTTOM;
@@ -63,8 +66,9 @@ BOOL CPlayerStatusBar::PreCreateWindow(CREATESTRUCT& cs) int CPlayerStatusBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if(CDialogBar::OnCreate(lpCreateStruct) == -1)
+ if(CDialogBar::OnCreate(lpCreateStruct) == -1) {
return -1;
+ }
CRect r;
r.SetRectEmpty();
@@ -89,7 +93,9 @@ void CPlayerStatusBar::Relayout() {
BITMAP bm;
memset(&bm, 0, sizeof(bm));
- if(m_bm.m_hObject) m_bm.GetBitmap(&bm);
+ if(m_bm.m_hObject) {
+ m_bm.GetBitmap(&bm);
+ }
CRect r, r2;
GetClientRect(r);
@@ -99,8 +105,7 @@ void CPlayerStatusBar::Relayout() CString str;
m_time.GetWindowText(str);
- if(CDC* pDC = m_time.GetDC())
- {
+ if(CDC* pDC = m_time.GetDC()) {
CFont* pOld = pDC->SelectObject(&m_time.GetFont());
div = r.right - pDC->GetTextExtent(str).cx;
pDC->SelectObject(pOld);
@@ -134,10 +139,16 @@ void CPlayerStatusBar::Clear() void CPlayerStatusBar::SetStatusBitmap(UINT id)
{
- if(m_bmid == id) return;
+ if(m_bmid == id) {
+ return;
+ }
- if(m_bm.m_hObject) m_bm.DeleteObject();
- if(id) m_bm.LoadBitmap(id);
+ if(m_bm.m_hObject) {
+ m_bm.DeleteObject();
+ }
+ if(id) {
+ m_bm.LoadBitmap(id);
+ }
m_bmid = id;
Relayout();
@@ -145,9 +156,13 @@ void CPlayerStatusBar::SetStatusBitmap(UINT id) void CPlayerStatusBar::SetStatusTypeIcon(HICON hIcon)
{
- if(m_hIcon == hIcon) return;
+ if(m_hIcon == hIcon) {
+ return;
+ }
- if(m_hIcon) DestroyIcon(m_hIcon);
+ if(m_hIcon) {
+ DestroyIcon(m_hIcon);
+ }
m_type.SetIcon(m_hIcon = hIcon);
Relayout();
@@ -172,7 +187,9 @@ void CPlayerStatusBar::SetStatusTimer(CString str) {
CString tmp;
m_time.GetWindowText(tmp);
- if(tmp == str) return;
+ if(tmp == str) {
+ return;
+ }
str.Trim();
m_time.SetWindowText(str);
@@ -188,32 +205,30 @@ void CPlayerStatusBar::SetStatusTimer(REFERENCE_TIME rtNow, REFERENCE_TIME rtDur CString str;
CString posstr, durstr;
- if(*pTimeFormat == TIME_FORMAT_MEDIA_TIME)
- {
+ if(*pTimeFormat == TIME_FORMAT_MEDIA_TIME) {
DVD_HMSF_TIMECODE tcNow = RT2HMSF(rtNow);
DVD_HMSF_TIMECODE tcDur = RT2HMSF(rtDur);
- if(tcDur.bHours > 0 || (rtNow >= rtDur && tcNow.bHours > 0))
+ if(tcDur.bHours > 0 || (rtNow >= rtDur && tcNow.bHours > 0)) {
posstr.Format(_T("%02d:%02d:%02d"), tcNow.bHours, tcNow.bMinutes, tcNow.bSeconds);
- else
+ } else {
posstr.Format(_T("%02d:%02d"), tcNow.bMinutes, tcNow.bSeconds);
+ }
- if(tcDur.bHours > 0)
+ if(tcDur.bHours > 0) {
durstr.Format(_T("%02d:%02d:%02d"), tcDur.bHours, tcDur.bMinutes, tcDur.bSeconds);
- else
+ } else {
durstr.Format(_T("%02d:%02d"), tcDur.bMinutes, tcDur.bSeconds);
+ }
- if(fHighPrecision)
- {
+ if(fHighPrecision) {
str.Format(_T("%s.%03d"), posstr, (rtNow/10000)%1000);
posstr = str;
str.Format(_T("%s.%03d"), durstr, (rtDur/10000)%1000);
durstr = str;
str.Empty();
}
- }
- else if(*pTimeFormat == TIME_FORMAT_FRAME)
- {
+ } else if(*pTimeFormat == TIME_FORMAT_FRAME) {
posstr.Format(_T("%I64d"), rtNow);
durstr.Format(_T("%I64d"), rtDur);
}
@@ -246,9 +261,10 @@ END_MESSAGE_MAP() BOOL CPlayerStatusBar::OnEraseBkgnd(CDC* pDC)
{
- for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
- {
- if(!pChild->IsWindowVisible()) continue;
+ for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) {
+ if(!pChild->IsWindowVisible()) {
+ continue;
+ }
CRect r;
pChild->GetClientRect(&r);
@@ -261,11 +277,13 @@ BOOL CPlayerStatusBar::OnEraseBkgnd(CDC* pDC) CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
- if(pFrame->m_pLastBar != this || pFrame->m_fFullScreen)
+ if(pFrame->m_pLastBar != this || pFrame->m_fFullScreen) {
r.InflateRect(0, 0, 0, 1);
+ }
- if(pFrame->m_fFullScreen)
+ if(pFrame->m_fFullScreen) {
r.InflateRect(1, 0, 1, 0);
+ }
pDC->Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
@@ -282,8 +300,7 @@ void CPlayerStatusBar::OnPaint() CRect r;
- if(m_bm.m_hObject)
- {
+ if(m_bm.m_hObject) {
BITMAP bm;
m_bm.GetBitmap(&bm);
CDC memdc;
@@ -320,15 +337,14 @@ void CPlayerStatusBar::OnLButtonDown(UINT nFlags, CPoint point) wp.length = sizeof(wp);
pFrame->GetWindowPlacement(&wp);
- if(!pFrame->m_fFullScreen && wp.showCmd != SW_SHOWMAXIMIZED)
- {
+ if(!pFrame->m_fFullScreen && wp.showCmd != SW_SHOWMAXIMIZED) {
CRect r;
GetClientRect(r);
CPoint p = point;
MapWindowPoints(pFrame, &point, 1);
pFrame->PostMessage(WM_NCLBUTTONDOWN,
-// (p.x+p.y >= r.Width()) ? HTBOTTOMRIGHT : HTCAPTION,
+ // (p.x+p.y >= r.Width()) ? HTBOTTOMRIGHT : HTCAPTION,
(p.x >= r.Width()-r.Height() && !pFrame->IsCaptionMenuHidden()) ? HTBOTTOMRIGHT :
HTCAPTION,
MAKELPARAM(point.x, point.y));
@@ -343,16 +359,14 @@ BOOL CPlayerStatusBar::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) wp.length = sizeof(wp);
pFrame->GetWindowPlacement(&wp);
- if(!pFrame->m_fFullScreen && wp.showCmd != SW_SHOWMAXIMIZED)
- {
+ if(!pFrame->m_fFullScreen && wp.showCmd != SW_SHOWMAXIMIZED) {
CRect r;
GetClientRect(r);
CPoint p;
GetCursorPos(&p);
ScreenToClient(&p);
-// if(p.x+p.y >= r.Width())
- if(p.x >= r.Width()-r.Height() && !pFrame->IsCaptionMenuHidden())
- {
+ // if(p.x+p.y >= r.Width())
+ if(p.x >= r.Width()-r.Height() && !pFrame->IsCaptionMenuHidden()) {
SetCursor(LoadCursor(NULL, IDC_SIZENWSE));
return TRUE;
}
@@ -365,8 +379,7 @@ HBRUSH CPlayerStatusBar::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) {
HBRUSH hbr = CDialogBar::OnCtlColor(pDC, pWnd, nCtlColor);
- if(*pWnd == m_type)
- {
+ if(*pWnd == m_type) {
hbr = GetStockBrush(BLACK_BRUSH);
}
diff --git a/src/apps/mplayerc/PlayerStatusBar.h b/src/apps/mplayerc/PlayerStatusBar.h index c4fa89a34..bf1783a73 100644 --- a/src/apps/mplayerc/PlayerStatusBar.h +++ b/src/apps/mplayerc/PlayerStatusBar.h @@ -55,7 +55,7 @@ public: CString GetStatusTimer();
void ShowTimer(bool fShow);
-// Overrides
+ // Overrides
virtual BOOL Create(CWnd* pParentWnd);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
diff --git a/src/apps/mplayerc/PlayerSubresyncBar.cpp b/src/apps/mplayerc/PlayerSubresyncBar.cpp index 94412fc94..77d3ee306 100644 --- a/src/apps/mplayerc/PlayerSubresyncBar.cpp +++ b/src/apps/mplayerc/PlayerSubresyncBar.cpp @@ -43,8 +43,9 @@ CPlayerSubresyncBar::~CPlayerSubresyncBar() BOOL CPlayerSubresyncBar::Create(CWnd* pParentWnd, CCritSec* pSubLock)
{
- if(!CSizingControlBarG::Create(_T("Subresync"), pParentWnd, ID_VIEW_SUBRESYNC))
+ if(!CSizingControlBarG::Create(_T("Subresync"), pParentWnd, ID_VIEW_SUBRESYNC)) {
return FALSE;
+ }
m_pSubLock = pSubLock;
@@ -60,24 +61,24 @@ BOOL CPlayerSubresyncBar::Create(CWnd* pParentWnd, CCritSec* pSubLock) BOOL CPlayerSubresyncBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CSizingControlBarG::PreCreateWindow(cs))
+ if(!CSizingControlBarG::PreCreateWindow(cs)) {
return FALSE;
+ }
return TRUE;
}
BOOL CPlayerSubresyncBar::PreTranslateMessage(MSG* pMsg)
{
- if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
- {
- if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE)
- {
+ if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) {
+ if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) {
GetParentFrame()->ShowControlBar(this, FALSE, TRUE);
return TRUE;
}
- if(IsShortCut(pMsg) || IsDialogMessage(pMsg))
+ if(IsShortCut(pMsg) || IsDialogMessage(pMsg)) {
return TRUE;
+ }
}
return CSizingControlBarG::PreTranslateMessage(pMsg);
@@ -89,12 +90,13 @@ void CPlayerSubresyncBar::SetTime(__int64 rt) int curSegment;
- if(!m_sts.SearchSubs((int)(rt/10000), 25, &curSegment))
- {
+ if(!m_sts.SearchSubs((int)(rt/10000), 25, &curSegment)) {
curSegment = -1;
}
- if(m_lastSegment != curSegment) m_list.Invalidate();
+ if(m_lastSegment != curSegment) {
+ m_list.Invalidate();
+ }
m_lastSegment = curSegment;
}
@@ -108,13 +110,14 @@ void CPlayerSubresyncBar::SetSubtitle(ISubStream* pSubStream, double fps) ResetSubtitle();
- if(!m_pSubStream) return;
+ if(!m_pSubStream) {
+ return;
+ }
CLSID clsid;
m_pSubStream->GetClassID(&clsid);
- if(clsid == __uuidof(CVobSubFile))
- {
+ if(clsid == __uuidof(CVobSubFile)) {
CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)m_pSubStream;
m_mode = VOBSUB;
@@ -122,8 +125,7 @@ void CPlayerSubresyncBar::SetSubtitle(ISubStream* pSubStream, double fps) _ASSERT(pVSF->m_iLang >= 0);
CAtlArray<CVobSubFile::SubPos>& sp = pVSF->m_langs[pVSF->m_iLang].subpos;
- for(int i = 0, j = sp.GetCount(); i < j; i++)
- {
+ for(int i = 0, j = sp.GetCount(); i < j; i++) {
CString str;
str.Format(_T("%d,%d,%d,%d"), sp[i].vobid, sp[i].cellid, sp[i].fForced, i);
m_sts.Add(TToW(str), false, (int)sp[i].start, (int)sp[i].stop);
@@ -133,7 +135,9 @@ void CPlayerSubresyncBar::SetSubtitle(ISubStream* pSubStream, double fps) pVSF->m_fOnlyShowForcedSubs = false;
- for(int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) m_list.DeleteColumn(0);
+ for(int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) {
+ m_list.DeleteColumn(0);
+ }
m_list.InsertColumn(COL_START, _T("Time"), LVCFMT_LEFT, 80);
m_list.InsertColumn(COL_END, _T("End"), LVCFMT_LEFT, 80);
m_list.InsertColumn(COL_PREVSTART, _T("Preview"), LVCFMT_LEFT, 80);
@@ -141,9 +145,7 @@ void CPlayerSubresyncBar::SetSubtitle(ISubStream* pSubStream, double fps) m_list.InsertColumn(COL_VOBID, _T("Vob ID"), LVCFMT_CENTER, 60);
m_list.InsertColumn(COL_CELLID, _T("Cell ID"), LVCFMT_CENTER, 60);
m_list.InsertColumn(COL_FORCED, _T("Forced"), LVCFMT_CENTER, 60);
- }
- else if(clsid == __uuidof(CRenderedTextSubtitle))
- {
+ } else if(clsid == __uuidof(CRenderedTextSubtitle)) {
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
m_mode = TEXTSUB;
@@ -153,8 +155,7 @@ void CPlayerSubresyncBar::SetSubtitle(ISubStream* pSubStream, double fps) m_sts.Sort(true); /*!!m_fUnlink*/
#ifndef UNICODE
- if(!m_sts.IsEntryUnicode(0))
- {
+ if(!m_sts.IsEntryUnicode(0)) {
CFont* f = m_list.GetFont();
LOGFONT lf;
f->GetLogFont(&lf);
@@ -164,8 +165,9 @@ void CPlayerSubresyncBar::SetSubtitle(ISubStream* pSubStream, double fps) m_list.SetFont(&m_font);
}
#endif
- for(int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++)
+ for(int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) {
m_list.DeleteColumn(0);
+ }
m_list.InsertColumn(COL_START, _T("Time"), LVCFMT_LEFT, 90);
m_list.InsertColumn(COL_END, _T("End"), LVCFMT_LEFT, 4);
m_list.InsertColumn(COL_PREVSTART, _T("Preview"), LVCFMT_LEFT, 80);
@@ -182,8 +184,7 @@ void CPlayerSubresyncBar::SetSubtitle(ISubStream* pSubStream, double fps) m_subtimes.SetCount(m_sts.GetCount());
- for(int i = 0, j = m_sts.GetCount(); i < j; i++)
- {
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++) {
m_subtimes[i].orgstart = m_sts[i].start;
m_subtimes[i].orgend = m_sts[i].end;
}
@@ -195,14 +196,12 @@ void CPlayerSubresyncBar::ResetSubtitle() {
m_list.DeleteAllItems();
- if(m_mode == VOBSUB || m_mode == TEXTSUB)
- {
+ if(m_mode == VOBSUB || m_mode == TEXTSUB) {
TCHAR buff[32];
int prevstart = INT_MIN;
- for(int i = 0, j = m_sts.GetCount(); i < j; i++)
- {
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++) {
m_subtimes[i].newstart = m_subtimes[i].orgstart;
m_subtimes[i].newend = m_subtimes[i].orgend;
FormatTime(i, buff, 0, false);
@@ -210,8 +209,9 @@ void CPlayerSubresyncBar::ResetSubtitle() FormatTime(i, buff, 0, true);
m_list.SetItemText(i, COL_END, buff);
- if(prevstart > m_subtimes[i].orgstart)
+ if(prevstart > m_subtimes[i].orgstart) {
m_list.SetItemData(i, (DWORD_PTR)TSEP);
+ }
prevstart = m_subtimes[i].orgstart;
SetCheck(i, false, false);
@@ -229,13 +229,14 @@ void CPlayerSubresyncBar::ResetSubtitle() void CPlayerSubresyncBar::SaveSubtitle()
{
CMainFrame* pFrame = ((CMainFrame*)AfxGetMainWnd());
- if(!pFrame) return;
+ if(!pFrame) {
+ return;
+ }
CLSID clsid;
m_pSubStream->GetClassID(&clsid);
- if(clsid == __uuidof(CVobSubFile) && m_mode == VOBSUB)
- {
+ if(clsid == __uuidof(CVobSubFile) && m_mode == VOBSUB) {
CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)m_pSubStream;
CAutoLock cAutoLock(m_pSubLock);
@@ -243,30 +244,26 @@ void CPlayerSubresyncBar::SaveSubtitle() _ASSERT(pVSF->m_iLang >= 0);
CAtlArray<CVobSubFile::SubPos>& sp = pVSF->m_langs[pVSF->m_iLang].subpos;
- for(int i = 0, j = sp.GetCount(); i < j; i++)
- {
+ for(int i = 0, j = sp.GetCount(); i < j; i++) {
sp[i].fValid = false;
}
- for(int i = 0, j = m_sts.GetCount(); i < j; i++)
- {
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++) {
int vobid, cellid, forced, spnum, c;
- if(_stscanf(m_sts.GetStr(i), _T("%d%c%d%c%d%c%d"), &vobid, &c, &cellid, &c, &forced, &c, &spnum) != 7) continue;
+ if(_stscanf(m_sts.GetStr(i), _T("%d%c%d%c%d%c%d"), &vobid, &c, &cellid, &c, &forced, &c, &spnum) != 7) {
+ continue;
+ }
sp[spnum].start = m_sts[i].start;
sp[spnum].stop = m_sts[i].end;
sp[spnum].fValid = true;
}
- }
- else if(clsid == __uuidof(CRenderedTextSubtitle) && m_mode == TEXTSUB)
- {
+ } else if(clsid == __uuidof(CRenderedTextSubtitle) && m_mode == TEXTSUB) {
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
CAutoLock cAutoLock(m_pSubLock);
pRTS->Copy(m_sts);
- }
- else
- {
+ } else {
return;
}
@@ -275,58 +272,47 @@ void CPlayerSubresyncBar::SaveSubtitle() void CPlayerSubresyncBar::UpdatePreview()
{
- if(m_mode == VOBSUB || m_mode == TEXTSUB)
- {
- if(0/*m_fUnlink*/)
- {
- for(int i = 0, j = m_sts.GetCount(); i < j; i++)
- {
+ if(m_mode == VOBSUB || m_mode == TEXTSUB) {
+ if(0/*m_fUnlink*/) {
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++) {
bool fStartMod, fEndMod, fStartAdj, fEndAdj;
GetCheck(i, fStartMod, fEndMod, fStartAdj, fEndAdj);
m_sts[i].start = (fStartMod||fStartAdj) ? m_subtimes[i].newstart : m_subtimes[i].orgstart;
m_sts[i].end = (fEndMod||fEndAdj) ? m_subtimes[i].newend : m_subtimes[i].orgend;
}
- }
- else
- {
+ } else {
CAtlArray<int> schk;
- for(int i = 0, j = m_sts.GetCount(); i < j;)
- {
+ for(int i = 0, j = m_sts.GetCount(); i < j;) {
schk.RemoveAll();
int start = i, end;
- for(end = i; end < j; end++)
- {
+ for(end = i; end < j; end++) {
int data = (int)m_list.GetItemData(end);
- if((data&TSEP) && end > i) break;
- if(data&(TSMOD|TSADJ))
+ if((data&TSEP) && end > i) {
+ break;
+ }
+ if(data&(TSMOD|TSADJ)) {
schk.Add(end);
+ }
}
- if(schk.GetCount() == 0)
- {
- for(; start < end; start++)
- {
+ if(schk.GetCount() == 0) {
+ for(; start < end; start++) {
m_sts[start].start = m_subtimes[start].orgstart;
m_sts[start].end = m_subtimes[start].orgend;
}
- }
- else if(schk.GetCount() == 1)
- {
+ } else if(schk.GetCount() == 1) {
int k = schk[0];
int dt = m_subtimes[k].newstart - m_subtimes[k].orgstart;
- for(; start < end; start++)
- {
+ for(; start < end; start++) {
m_sts[start].start = m_subtimes[start].orgstart + dt;
m_sts[start].end = (m_list.GetItemData(start)&TEMOD)
? m_subtimes[start].newend
: (m_subtimes[start].orgend + dt);
}
- }
- else if(schk.GetCount() >= 2)
- {
+ } else if(schk.GetCount() >= 2) {
int i0 = 0;
int i1 = 0;
int ti0 = 0;
@@ -334,18 +320,16 @@ void CPlayerSubresyncBar::UpdatePreview() double m = 0;
int k, l;
- for(k = 0, l = schk.GetCount()-1; k < l; k++)
- {
+ for(k = 0, l = schk.GetCount()-1; k < l; k++) {
i0 = schk[k];
i1 = schk[k+1];
ti0 = m_subtimes[i0].orgstart;
ds = m_subtimes[i1].orgstart - ti0;
- if (ds == 0)
+ if (ds == 0) {
SetSTS0(start, i1, ti0);
- else
- {
+ } else {
m = double(m_subtimes[i1].newstart - m_subtimes[i0].newstart) / ds;
SetSTS1(start, i1, ti0, m, i0);
}
@@ -353,10 +337,11 @@ void CPlayerSubresyncBar::UpdatePreview() }
ASSERT(k > 0);
- if (ds == 0)
+ if (ds == 0) {
SetSTS0(start, end, ti0);
- else
+ } else {
SetSTS1(start, end, ti0, m, i0);
+ }
}
i = end;
@@ -365,8 +350,7 @@ void CPlayerSubresyncBar::UpdatePreview() m_sts.CreateSegments();
- for(int i = 0, j = m_sts.GetCount(); i < j; i++)
- {
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++) {
TCHAR buff[32];
FormatTime(i, buff, 2, false);
m_list.SetItemText(i, COL_PREVSTART, buff);
@@ -374,8 +358,7 @@ void CPlayerSubresyncBar::UpdatePreview() m_list.SetItemText(i, COL_PREVEND, buff);
}
- if(IsWindowVisible())
- {
+ if(IsWindowVisible()) {
SaveSubtitle();
}
}
@@ -383,33 +366,32 @@ void CPlayerSubresyncBar::UpdatePreview() void CPlayerSubresyncBar::SetSTS0( int &start, int end, int ti0 )
{
- for(; start < end; start++)
- {
+ for(; start < end; start++) {
m_sts[start].start = ti0;
int endpos;
- if (m_list.GetItemData(start)&TEMOD)
+ if (m_list.GetItemData(start)&TEMOD) {
endpos = m_subtimes[start].newend;
- else
+ } else {
endpos = ti0 + m_subtimes[start].orgend - m_subtimes[start].orgstart;
+ }
m_sts[start].end = endpos;
}
}
void CPlayerSubresyncBar::SetSTS1( int &start, int end, int ti0, double m, int i0 )
{
- for(; start < end; start++)
- {
+ for(; start < end; start++) {
m_sts[start].start = int((m_subtimes[start].orgstart - ti0)*m + m_subtimes[i0].newstart);
int endpos;
- if (m_list.GetItemData(start)&TEMOD)
+ if (m_list.GetItemData(start)&TEMOD) {
endpos = m_subtimes[start].newend;
- else
- {
+ } else {
int diff = m_subtimes[start].orgend - m_subtimes[start].orgstart;
- if (m_mode == VOBSUB)
+ if (m_mode == VOBSUB) {
endpos = m_sts[start].start + diff;
- else
+ } else {
endpos = m_sts[start].start + int(diff*m);
+ }
}
m_sts[start].end = endpos;
}
@@ -419,10 +401,8 @@ void CPlayerSubresyncBar::UpdateStrings() {
CString str;
- if(m_mode == TEXTSUB)
- {
- for(int i = 0, j = m_sts.GetCount(); i < j; i++)
- {
+ if(m_mode == TEXTSUB) {
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++) {
STSStyle stss;
m_sts.GetStyle(i, stss);
@@ -437,18 +417,23 @@ void CPlayerSubresyncBar::UpdateStrings() m_list.SetItemText(i, COL_ACTOR, m_sts[i].actor);
m_list.SetItemText(i, COL_EFFECT, m_sts[i].effect);
}
- }
- else if(m_mode == VOBSUB)
- {
- for(int i = 0, j = m_sts.GetCount(); i < j; i++)
- {
+ } else if(m_mode == VOBSUB) {
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++) {
int vobid, cellid, forced, c;
- if(_stscanf(m_sts.GetStr(i), _T("%d%c%d%c%d"), &vobid, &c, &cellid, &c, &forced) != 5) continue;
- if(vobid < 0) str = _T("-");
- else str.Format(_T("%d"), vobid);
+ if(_stscanf(m_sts.GetStr(i), _T("%d%c%d%c%d"), &vobid, &c, &cellid, &c, &forced) != 5) {
+ continue;
+ }
+ if(vobid < 0) {
+ str = _T("-");
+ } else {
+ str.Format(_T("%d"), vobid);
+ }
m_list.SetItemText(i, COL_VOBID, str);
- if(cellid < 0) str = _T("-");
- else str.Format(_T("%d"), cellid);
+ if(cellid < 0) {
+ str = _T("-");
+ } else {
+ str.Format(_T("%d"), cellid);
+ }
m_list.SetItemText(i, COL_CELLID, str);
str = forced?_T("Yes"):_T("");
m_list.SetItemText(i, COL_FORCED, str);
@@ -458,8 +443,7 @@ void CPlayerSubresyncBar::UpdateStrings() void CPlayerSubresyncBar::GetCheck(int iItem, bool& fStartMod, bool& fEndMod, bool& fStartAdj, bool& fEndAdj)
{
- if(0 <= iItem && iItem < m_sts.GetCount())
- {
+ if(0 <= iItem && iItem < m_sts.GetCount()) {
int nCheck = (int)m_list.GetItemData(iItem);
fStartMod = !!(nCheck&TSMOD);
fEndMod = !!(nCheck&TEMOD);
@@ -470,16 +454,21 @@ void CPlayerSubresyncBar::GetCheck(int iItem, bool& fStartMod, bool& fEndMod, bo void CPlayerSubresyncBar::SetCheck(int iItem, bool fStart, bool fEnd)
{
- if(0 <= iItem && iItem < m_sts.GetCount())
- {
+ if(0 <= iItem && iItem < m_sts.GetCount()) {
SubTime& st = m_subtimes[iItem];
int nCheck = (int)m_list.GetItemData(iItem) & TSEP;
- if(fStart) nCheck |= TSMOD;
- else if(abs(st.orgstart-st.newstart)) nCheck |= TSADJ;
- if(fEnd) nCheck |= TEMOD;
- else if(abs(st.orgend-st.newend)) nCheck |= TEADJ;
+ if(fStart) {
+ nCheck |= TSMOD;
+ } else if(abs(st.orgstart-st.newstart)) {
+ nCheck |= TSADJ;
+ }
+ if(fEnd) {
+ nCheck |= TEMOD;
+ } else if(abs(st.orgend-st.newend)) {
+ nCheck |= TEADJ;
+ }
m_list.SetItemData(iItem, (DWORD)nCheck);
@@ -500,13 +489,16 @@ bool CPlayerSubresyncBar::ModStart(int iItem, int t, bool fReset) SubTime& st = m_subtimes[iItem];
-// if(fStartMod || fStartAdj || st.orgstart != t || fReset)
+ // if(fStartMod || fStartAdj || st.orgstart != t || fReset)
{
fRet = (st.newstart != t);
st.newstart = t;
- if(!fEndMod) st.newend = st.newstart + (st.orgend - st.orgstart);
- else if(fReset) st.newstart = st.newend - (st.orgend - st.orgstart);
+ if(!fEndMod) {
+ st.newend = st.newstart + (st.orgend - st.orgstart);
+ } else if(fReset) {
+ st.newstart = st.newend - (st.orgend - st.orgstart);
+ }
SetCheck(iItem, !fReset, fEndMod);
}
@@ -523,13 +515,16 @@ bool CPlayerSubresyncBar::ModEnd(int iItem, int t, bool fReset) SubTime& st = m_subtimes[iItem];
-// if(fEndMod || fEndAdj || st.orgend != t || fReset)
+ // if(fEndMod || fEndAdj || st.orgend != t || fReset)
{
fRet = (st.newend != t);
st.newend = t;
- if(!fStartMod) st.newstart = st.newend - (st.orgend - st.orgstart);
- else if(fReset) st.newend = st.newstart + (st.orgend - st.orgstart);
+ if(!fStartMod) {
+ st.newstart = st.newend - (st.orgend - st.orgstart);
+ } else if(fReset) {
+ st.newend = st.newstart + (st.orgend - st.orgstart);
+ }
SetCheck(iItem, fStartMod, !fReset);
}
@@ -575,8 +570,7 @@ void CPlayerSubresyncBar::OnSize(UINT nType, int cx, int cy) {
CSizingControlBarG::OnSize(nType, cx, cy);
- if(::IsWindow(m_list.m_hWnd))
- {
+ if(::IsWindow(m_list.m_hWnd)) {
CRect r;
GetClientRect(r);
r.DeflateRect(2, 2);
@@ -590,7 +584,9 @@ static bool ParseTime(CString str, int& ret, bool fWarn = true) TCHAR c;
str.Trim();
- if(str.GetLength() > 0 && str[0] == '-') sign = -1;
+ if(str.GetLength() > 0 && str[0] == '-') {
+ sign = -1;
+ }
int n = _stscanf(str, _T("%d%c%d%c%d%c%d"), &h, &c, &m, &c, &s, &c, &ms);
@@ -600,13 +596,14 @@ static bool ParseTime(CString str, int& ret, bool fWarn = true) && 0 <= h && h < 24
&& 0 <= m && m < 60
&& 0 <= s && s < 60
- && 0 <= ms && ms < 1000)
- {
+ && 0 <= ms && ms < 1000) {
ret = sign*(h*60*60*1000+m*60*1000+s*1000+ms);
return(true);
}
- if(fWarn) AfxMessageBox(_T("The correct time format is [-]hh:mm:ss.ms\n(e.g. 01:23:45.678)"));
+ if(fWarn) {
+ AfxMessageBox(_T("The correct time format is [-]hh:mm:ss.ms\n(e.g. 01:23:45.678)"));
+ }
return(false);
}
@@ -617,18 +614,14 @@ void CPlayerSubresyncBar::OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = FALSE;
- if(pItem->iItem >= 0)
- {
+ if(pItem->iItem >= 0) {
if((pItem->iSubItem == COL_START || pItem->iSubItem == COL_END || pItem->iSubItem == COL_TEXT
|| pItem->iSubItem == COL_STYLE || pItem->iSubItem == COL_LAYER
|| pItem->iSubItem == COL_ACTOR || pItem->iSubItem == COL_EFFECT)
- && m_mode == TEXTSUB)
- {
+ && m_mode == TEXTSUB) {
*pResult = TRUE;
- }
- else if((pItem->iSubItem == COL_START)
- && m_mode == VOBSUB)
- {
+ } else if((pItem->iSubItem == COL_START)
+ && m_mode == VOBSUB) {
*pResult = TRUE;
}
}
@@ -641,19 +634,15 @@ void CPlayerSubresyncBar::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = FALSE;
- if(pItem->iItem >= 0)
- {
+ if(pItem->iItem >= 0) {
if((pItem->iSubItem == COL_START || pItem->iSubItem == COL_END || pItem->iSubItem == COL_TEXT
|| pItem->iSubItem == COL_STYLE || pItem->iSubItem == COL_LAYER
|| pItem->iSubItem == COL_ACTOR || pItem->iSubItem == COL_EFFECT)
- && m_mode == TEXTSUB)
- {
+ && m_mode == TEXTSUB) {
m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
*pResult = TRUE;
- }
- else if((pItem->iSubItem == COL_START)
- && m_mode == VOBSUB)
- {
+ } else if((pItem->iSubItem == COL_START)
+ && m_mode == VOBSUB) {
m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
*pResult = TRUE;
}
@@ -667,115 +656,100 @@ void CPlayerSubresyncBar::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = FALSE;
- if(!m_list.m_fInPlaceDirty)
+ if(!m_list.m_fInPlaceDirty) {
return;
+ }
bool fNeedsUpdate = false;
- if(pItem->iItem >= 0 && pItem->pszText && (m_mode == VOBSUB || m_mode == TEXTSUB))
- {
- switch(pItem->iSubItem)
- {
- case COL_START:
- {
- int t;
- if(ParseTime(pItem->pszText, t))
- {
- fNeedsUpdate = ModStart(pItem->iItem, t);
-
- *pResult = TRUE;
- }
- }
- break;
- case COL_END:
- if(m_mode == TEXTSUB)
- {
+ if(pItem->iItem >= 0 && pItem->pszText && (m_mode == VOBSUB || m_mode == TEXTSUB)) {
+ switch(pItem->iSubItem) {
+ case COL_START: {
int t;
- if(ParseTime(pItem->pszText, t))
- {
- fNeedsUpdate = ModEnd(pItem->iItem, t);
+ if(ParseTime(pItem->pszText, t)) {
+ fNeedsUpdate = ModStart(pItem->iItem, t);
*pResult = TRUE;
}
}
break;
- case COL_TEXT:
- if(m_mode == TEXTSUB)
- {
- CString str = m_sts.GetStr(pItem->iItem, true);
+ case COL_END:
+ if(m_mode == TEXTSUB) {
+ int t;
+ if(ParseTime(pItem->pszText, t)) {
+ fNeedsUpdate = ModEnd(pItem->iItem, t);
- if(str != pItem->pszText)
- {
- fNeedsUpdate = true;
- m_sts.SetStr(pItem->iItem, CString(pItem->pszText), true);
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, m_sts.GetStr(pItem->iItem, true));
+ *pResult = TRUE;
+ }
}
- }
- break;
- case COL_STYLE:
- if(m_mode == TEXTSUB)
- {
- CString str(pItem->pszText);
- str.Trim();
+ break;
+ case COL_TEXT:
+ if(m_mode == TEXTSUB) {
+ CString str = m_sts.GetStr(pItem->iItem, true);
- if(!str.IsEmpty() && m_sts[pItem->iItem].style != str)
- {
- fNeedsUpdate = true;
+ if(str != pItem->pszText) {
+ fNeedsUpdate = true;
+ m_sts.SetStr(pItem->iItem, CString(pItem->pszText), true);
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, m_sts.GetStr(pItem->iItem, true));
+ }
+ }
+ break;
+ case COL_STYLE:
+ if(m_mode == TEXTSUB) {
+ CString str(pItem->pszText);
+ str.Trim();
- if(!m_sts.m_styles.Lookup(str))
- m_sts.AddStyle(str, DNew STSStyle());
+ if(!str.IsEmpty() && m_sts[pItem->iItem].style != str) {
+ fNeedsUpdate = true;
- m_sts[pItem->iItem].style = str;
+ if(!m_sts.m_styles.Lookup(str)) {
+ m_sts.AddStyle(str, DNew STSStyle());
+ }
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, pItem->pszText);
+ m_sts[pItem->iItem].style = str;
+
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, pItem->pszText);
+ }
}
- }
- break;
- case COL_LAYER:
- if(m_mode == TEXTSUB)
- {
- int l;
- if(_stscanf_s(pItem->pszText, _T("%d"), &l) == 1)
- {
- fNeedsUpdate = true;
- m_sts[pItem->iItem].layer = l;
- CString str;
- str.Format(_T("%d"), l);
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ break;
+ case COL_LAYER:
+ if(m_mode == TEXTSUB) {
+ int l;
+ if(_stscanf_s(pItem->pszText, _T("%d"), &l) == 1) {
+ fNeedsUpdate = true;
+ m_sts[pItem->iItem].layer = l;
+ CString str;
+ str.Format(_T("%d"), l);
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ }
}
- }
- break;
- case COL_ACTOR:
- if(m_mode == TEXTSUB)
- {
- CString str(pItem->pszText);
- str.Trim();
- if(!str.IsEmpty())
- {
- fNeedsUpdate = true;
- m_sts[pItem->iItem].actor = str;
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ break;
+ case COL_ACTOR:
+ if(m_mode == TEXTSUB) {
+ CString str(pItem->pszText);
+ str.Trim();
+ if(!str.IsEmpty()) {
+ fNeedsUpdate = true;
+ m_sts[pItem->iItem].actor = str;
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ }
}
- }
- break;
- case COL_EFFECT:
- if(m_mode == TEXTSUB)
- {
- CString str(pItem->pszText);
- str.Trim();
- if(!str.IsEmpty())
- {
- fNeedsUpdate = true;
- m_sts[pItem->iItem].effect = str;
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ break;
+ case COL_EFFECT:
+ if(m_mode == TEXTSUB) {
+ CString str(pItem->pszText);
+ str.Trim();
+ if(!str.IsEmpty()) {
+ fNeedsUpdate = true;
+ m_sts[pItem->iItem].effect = str;
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ }
}
- }
- break;
+ break;
}
}
- if(fNeedsUpdate)
- {
+ if(fNeedsUpdate) {
UpdatePreview();
}
}
@@ -789,10 +763,8 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult) {
LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
- if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0)
- {
- enum
- {
+ if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0) {
+ enum {
TOGSEP=1,
DUPITEM, DELITEM,
RESETS, SETOS, SETCS, RESETE, SETOE, SETCE,
@@ -810,134 +782,123 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult) CMenu m;
m.CreatePopupMenu();
- if(m_mode == VOBSUB || m_mode == TEXTSUB)
- {
+ if(m_mode == VOBSUB || m_mode == TEXTSUB) {
m.AppendMenu(MF_STRING|MF_ENABLED, TOGSEP, ResStr(IDS_SUBRESYNC_SEPARATOR));
m.AppendMenu(MF_SEPARATOR);
- if(m_mode == TEXTSUB) m.AppendMenu(MF_STRING|MF_ENABLED, DUPITEM, ResStr(IDS_SUBRESYNC_DUPLICATE));
+ if(m_mode == TEXTSUB) {
+ m.AppendMenu(MF_STRING|MF_ENABLED, DUPITEM, ResStr(IDS_SUBRESYNC_DUPLICATE));
+ }
m.AppendMenu(MF_STRING|MF_ENABLED, DELITEM, ResStr(IDS_SUBRESYNC_DELETE));
}
- switch(lpnmlv->iSubItem)
- {
- case COL_START:
- if(m_mode == VOBSUB || m_mode == TEXTSUB)
- {
- m.AppendMenu(MF_SEPARATOR);
- m.AppendMenu(MF_STRING|MF_ENABLED, RESETS, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF1"));
- m.AppendMenu(MF_STRING|MF_ENABLED, SETOS, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF3"));
- m.AppendMenu(MF_STRING|MF_ENABLED, SETCS, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF5"));
- }
- break;
- case COL_END:
- if(m_mode == TEXTSUB)
- {
- m.AppendMenu(MF_SEPARATOR);
- m.AppendMenu(MF_STRING|MF_ENABLED, RESETE, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF2"));
- m.AppendMenu(MF_STRING|MF_ENABLED, SETOE, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF4"));
- m.AppendMenu(MF_STRING|MF_ENABLED, SETCE, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF6"));
- }
- break;
- case COL_STYLE:
- if(m_mode == TEXTSUB)
- {
- m.AppendMenu(MF_SEPARATOR);
-
- int id = STYLEFIRST;
-
- POSITION pos = m_sts.m_styles.GetStartPosition();
- while(pos && id <= STYLELAST)
- {
- CString key;
- STSStyle* val;
- m_sts.m_styles.GetNextAssoc(pos, key, val);
- styles.Add(key);
- m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
+ switch(lpnmlv->iSubItem) {
+ case COL_START:
+ if(m_mode == VOBSUB || m_mode == TEXTSUB) {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, RESETS, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF1"));
+ m.AppendMenu(MF_STRING|MF_ENABLED, SETOS, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF3"));
+ m.AppendMenu(MF_STRING|MF_ENABLED, SETCS, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF5"));
}
-
- if(id > STYLEFIRST && m_list.GetSelectedCount() == 1)
- {
+ break;
+ case COL_END:
+ if(m_mode == TEXTSUB) {
m.AppendMenu(MF_SEPARATOR);
- m.AppendMenu(MF_STRING|MF_ENABLED, STYLEEDIT, ResStr(IDS_SUBRESYNC_EDIT));
+ m.AppendMenu(MF_STRING|MF_ENABLED, RESETE, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF2"));
+ m.AppendMenu(MF_STRING|MF_ENABLED, SETOE, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF4"));
+ m.AppendMenu(MF_STRING|MF_ENABLED, SETCE, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF6"));
}
- }
- break;
- case COL_UNICODE:
- if(m_mode == TEXTSUB)
- {
- m.AppendMenu(MF_SEPARATOR);
- m.AppendMenu(MF_STRING|MF_ENABLED, UNICODEYES, ResStr(IDS_SUBRESYNC_YES));
- m.AppendMenu(MF_STRING|MF_ENABLED, UNICODENO, ResStr(IDS_SUBRESYNC_NO));
- }
- break;
- case COL_LAYER:
- if(m_mode == TEXTSUB)
- {
- m.AppendMenu(MF_SEPARATOR);
- m.AppendMenu(MF_STRING|MF_ENABLED, LAYERDEC, ResStr(IDS_SUBRESYNC_DECREASE));
- m.AppendMenu(MF_STRING|MF_ENABLED, LAYERINC, ResStr(IDS_SUBRESYNC_INCREASE));
- }
- break;
- case COL_ACTOR:
- if(m_mode == TEXTSUB)
- {
- CMapStringToPtr actormap;
+ break;
+ case COL_STYLE:
+ if(m_mode == TEXTSUB) {
+ m.AppendMenu(MF_SEPARATOR);
- for(int i = 0, j = m_sts.GetCount(); i < j; i++)
- actormap[m_sts[i].actor] = NULL;
+ int id = STYLEFIRST;
- actormap.RemoveKey(_T(""));
+ POSITION pos = m_sts.m_styles.GetStartPosition();
+ while(pos && id <= STYLELAST) {
+ CString key;
+ STSStyle* val;
+ m_sts.m_styles.GetNextAssoc(pos, key, val);
+ styles.Add(key);
+ m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
+ }
- if(actormap.GetCount() > 0)
- {
+ if(id > STYLEFIRST && m_list.GetSelectedCount() == 1) {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, STYLEEDIT, ResStr(IDS_SUBRESYNC_EDIT));
+ }
+ }
+ break;
+ case COL_UNICODE:
+ if(m_mode == TEXTSUB) {
m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, UNICODEYES, ResStr(IDS_SUBRESYNC_YES));
+ m.AppendMenu(MF_STRING|MF_ENABLED, UNICODENO, ResStr(IDS_SUBRESYNC_NO));
+ }
+ break;
+ case COL_LAYER:
+ if(m_mode == TEXTSUB) {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, LAYERDEC, ResStr(IDS_SUBRESYNC_DECREASE));
+ m.AppendMenu(MF_STRING|MF_ENABLED, LAYERINC, ResStr(IDS_SUBRESYNC_INCREASE));
+ }
+ break;
+ case COL_ACTOR:
+ if(m_mode == TEXTSUB) {
+ CMapStringToPtr actormap;
- int id = ACTORFIRST;
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++) {
+ actormap[m_sts[i].actor] = NULL;
+ }
- POSITION pos = actormap.GetStartPosition();
- while(pos && id <= ACTORLAST)
- {
- CString key;
- void* val;
- actormap.GetNextAssoc(pos, key, val);
+ actormap.RemoveKey(_T(""));
- actors.Add(key);
+ if(actormap.GetCount() > 0) {
+ m.AppendMenu(MF_SEPARATOR);
- m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
+ int id = ACTORFIRST;
+
+ POSITION pos = actormap.GetStartPosition();
+ while(pos && id <= ACTORLAST) {
+ CString key;
+ void* val;
+ actormap.GetNextAssoc(pos, key, val);
+
+ actors.Add(key);
+
+ m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
+ }
}
}
- }
- break;
- case COL_EFFECT:
- if(m_mode == TEXTSUB)
- {
- CMapStringToPtr effectmap;
+ break;
+ case COL_EFFECT:
+ if(m_mode == TEXTSUB) {
+ CMapStringToPtr effectmap;
- for(int i = 0, j = m_sts.GetCount(); i < j; i++)
- effectmap[m_sts[i].effect] = NULL;
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++) {
+ effectmap[m_sts[i].effect] = NULL;
+ }
- effectmap.RemoveKey(_T(""));
+ effectmap.RemoveKey(_T(""));
- if(effectmap.GetCount() > 0)
- {
- m.AppendMenu(MF_SEPARATOR);
+ if(effectmap.GetCount() > 0) {
+ m.AppendMenu(MF_SEPARATOR);
- int id = EFFECTFIRST;
+ int id = EFFECTFIRST;
- POSITION pos = effectmap.GetStartPosition();
- while(pos && id <= EFFECTLAST)
- {
- CString key;
- void* val;
- effectmap.GetNextAssoc(pos, key, val);
+ POSITION pos = effectmap.GetStartPosition();
+ while(pos && id <= EFFECTLAST) {
+ CString key;
+ void* val;
+ effectmap.GetNextAssoc(pos, key, val);
- effects.Add(key);
+ effects.Add(key);
- m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
+ m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
+ }
}
}
- }
- break;
+ break;
}
CPoint p = lpnmlv->ptAction;
@@ -948,197 +909,193 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult) bool fNeedsUpdate = false;
POSITION pos = m_list.GetFirstSelectedItemPosition();
- while(pos)
- {
+ while(pos) {
int iItem = m_list.GetNextSelectedItem(pos);
SubTime& st = m_subtimes[iItem];
- switch(id)
- {
- case TOGSEP:
- m_list.SetItemData(iItem, m_list.GetItemData(iItem)^TSEP);
- m_list.Invalidate();
- fNeedsUpdate = true;
- break;
- case DUPITEM:
- {
- CUIntArray items;
- pos = m_list.GetFirstSelectedItemPosition();
- while(pos) items.Add(m_list.GetNextSelectedItem(pos));
-
- qsort(items.GetData(), items.GetCount(), sizeof(UINT), uintcomp);
+ switch(id) {
+ case TOGSEP:
+ m_list.SetItemData(iItem, m_list.GetItemData(iItem)^TSEP);
+ m_list.Invalidate();
+ fNeedsUpdate = true;
+ break;
+ case DUPITEM: {
+ CUIntArray items;
+ pos = m_list.GetFirstSelectedItemPosition();
+ while(pos) {
+ items.Add(m_list.GetNextSelectedItem(pos));
+ }
- for(int i = 0; i < items.GetCount(); i++)
- {
- iItem = items[i];
+ qsort(items.GetData(), items.GetCount(), sizeof(UINT), uintcomp);
- STSEntry stse = m_sts[iItem];
- m_sts.InsertAt(iItem+1, stse);
+ for(int i = 0; i < items.GetCount(); i++) {
+ iItem = items[i];
- SubTime st = m_subtimes[iItem];
- m_subtimes.InsertAt(iItem+1, st);
+ STSEntry stse = m_sts[iItem];
+ m_sts.InsertAt(iItem+1, stse);
- CHeaderCtrl* pHeader = (CHeaderCtrl*)m_list.GetDlgItem(0);
- int nColumnCount = pHeader->GetItemCount();
+ SubTime st = m_subtimes[iItem];
+ m_subtimes.InsertAt(iItem+1, st);
- CStringArray sa;
- sa.SetSize(nColumnCount);
- for(int col = 0; col < nColumnCount; col++)
- sa[col] = m_list.GetItemText(iItem, col);
+ CHeaderCtrl* pHeader = (CHeaderCtrl*)m_list.GetDlgItem(0);
+ int nColumnCount = pHeader->GetItemCount();
- DWORD data = m_list.GetItemData(iItem);
- m_list.InsertItem(iItem+1, sa[0]);
- m_list.SetItemData(iItem+1, data);
- for(int col = 1; col < nColumnCount; col++)
- m_list.SetItemText(iItem+1, col, sa[col]);
- }
- }
+ CStringArray sa;
+ sa.SetSize(nColumnCount);
+ for(int col = 0; col < nColumnCount; col++) {
+ sa[col] = m_list.GetItemText(iItem, col);
+ }
- fNeedsUpdate = true;
- break;
- case DELITEM:
- {
- CUIntArray items;
- pos = m_list.GetFirstSelectedItemPosition();
- while(pos) items.Add(m_list.GetNextSelectedItem(pos));
-
- qsort(items.GetData(), items.GetCount(), sizeof(UINT), uintcomp);
-
- for(int i = 0; i < items.GetCount(); i++)
- {
- iItem = items[i];
- m_sts.RemoveAt(iItem);
- m_subtimes.RemoveAt(iItem);
- m_list.DeleteItem(iItem);
+ DWORD data = m_list.GetItemData(iItem);
+ m_list.InsertItem(iItem+1, sa[0]);
+ m_list.SetItemData(iItem+1, data);
+ for(int col = 1; col < nColumnCount; col++) {
+ m_list.SetItemText(iItem+1, col, sa[col]);
+ }
+ }
}
- iItem = items[items.GetCount()-1];
- if(iItem >= m_list.GetItemCount()) iItem = m_list.GetItemCount()-1;
-
- m_list.SetSelectionMark(iItem);
- }
- fNeedsUpdate = true;
- break;
- case RESETS: /*if(*/
- ModStart(iItem, st.orgstart, true);/*)*/
- fNeedsUpdate = true;
- break;
- case SETOS: /*if(*/
- ModStart(iItem, st.orgstart);/*)*/
- fNeedsUpdate = true;
- break;
- case SETCS: /*if(*/
- ModStart(iItem, (int)(m_rt/10000));/*)*/
- fNeedsUpdate = true;
- break;
- case RESETE: /*if(*/
- ModEnd(iItem, st.orgend, true);/*)*/
- fNeedsUpdate = true;
- break;
- case SETOE: /*if(*/
- ModEnd(iItem, st.orgend);/*)*/
- fNeedsUpdate = true;
- break;
- case SETCE: /*if(*/
- ModEnd(iItem, (int)(m_rt/10000));/*)*/
fNeedsUpdate = true;
break;
- default:
- if(STYLEFIRST <= id && id <= STYLELAST)
- {
- CString s = styles[id - STYLEFIRST];
- if(m_sts[iItem].style != s) fNeedsUpdate = true;
- m_sts[iItem].style = s;
- m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
- }
- else if(id == STYLEEDIT)
- {
- CAutoPtrArray<CPPageSubStyle> pages;
- CAtlArray<STSStyle*> styles;
-
- STSStyle* stss = m_sts.GetStyle(iItem);
- int iSelPage = 0;
+ case DELITEM: {
+ CUIntArray items;
+ pos = m_list.GetFirstSelectedItemPosition();
+ while(pos) {
+ items.Add(m_list.GetNextSelectedItem(pos));
+ }
- POSITION pos = m_sts.m_styles.GetStartPosition();
- for(int i = 0; pos; i++)
- {
- CString key;
- STSStyle* val;
- m_sts.m_styles.GetNextAssoc(pos, key, val);
+ qsort(items.GetData(), items.GetCount(), sizeof(UINT), uintcomp);
- CAutoPtr<CPPageSubStyle> page(DNew CPPageSubStyle());
- page->InitStyle(key, *val);
- pages.Add(page);
- styles.Add(val);
+ for(int i = 0; i < items.GetCount(); i++) {
+ iItem = items[i];
+ m_sts.RemoveAt(iItem);
+ m_subtimes.RemoveAt(iItem);
+ m_list.DeleteItem(iItem);
+ }
- if(stss == val)
- iSelPage = i;
+ iItem = items[items.GetCount()-1];
+ if(iItem >= m_list.GetItemCount()) {
+ iItem = m_list.GetItemCount()-1;
}
- CPropertySheet dlg(_T("Styles..."), this, iSelPage);
- for(int i = 0; i < (int)pages.GetCount(); i++) dlg.AddPage(pages[i]);
-
- if(dlg.DoModal() == IDOK)
- {
- for(int j = 0; j < (int)pages.GetCount(); j++)
- {
- stss = styles[j];
- pages[j]->GetStyle(*stss);
-
- for(int i = 0; i < m_sts.GetCount(); i++)
- {
- if(m_sts.GetStyle(i) == stss)
- {
- CString str;
- m_list.SetItemText(i, COL_TEXT, m_sts.GetStr(i, true));
- m_list.SetItemText(i, COL_FONT, stss->fontName);
- str.Format(_T("%d"), stss->charSet);
- m_list.SetItemText(i, COL_CHARSET, str);
- str.Format(_T("%d"), m_sts[i].layer);
- }
+ m_list.SetSelectionMark(iItem);
+ }
+ fNeedsUpdate = true;
+ break;
+ case RESETS: /*if(*/
+ ModStart(iItem, st.orgstart, true);/*)*/
+ fNeedsUpdate = true;
+ break;
+ case SETOS: /*if(*/
+ ModStart(iItem, st.orgstart);/*)*/
+ fNeedsUpdate = true;
+ break;
+ case SETCS: /*if(*/
+ ModStart(iItem, (int)(m_rt/10000));/*)*/
+ fNeedsUpdate = true;
+ break;
+ case RESETE: /*if(*/
+ ModEnd(iItem, st.orgend, true);/*)*/
+ fNeedsUpdate = true;
+ break;
+ case SETOE: /*if(*/
+ ModEnd(iItem, st.orgend);/*)*/
+ fNeedsUpdate = true;
+ break;
+ case SETCE: /*if(*/
+ ModEnd(iItem, (int)(m_rt/10000));/*)*/
+ fNeedsUpdate = true;
+ break;
+ default:
+ if(STYLEFIRST <= id && id <= STYLELAST) {
+ CString s = styles[id - STYLEFIRST];
+ if(m_sts[iItem].style != s) {
+ fNeedsUpdate = true;
+ }
+ m_sts[iItem].style = s;
+ m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
+ } else if(id == STYLEEDIT) {
+ CAutoPtrArray<CPPageSubStyle> pages;
+ CAtlArray<STSStyle*> styles;
+
+ STSStyle* stss = m_sts.GetStyle(iItem);
+ int iSelPage = 0;
+
+ POSITION pos = m_sts.m_styles.GetStartPosition();
+ for(int i = 0; pos; i++) {
+ CString key;
+ STSStyle* val;
+ m_sts.m_styles.GetNextAssoc(pos, key, val);
+
+ CAutoPtr<CPPageSubStyle> page(DNew CPPageSubStyle());
+ page->InitStyle(key, *val);
+ pages.Add(page);
+ styles.Add(val);
+
+ if(stss == val) {
+ iSelPage = i;
}
}
+ CPropertySheet dlg(_T("Styles..."), this, iSelPage);
+ for(int i = 0; i < (int)pages.GetCount(); i++) {
+ dlg.AddPage(pages[i]);
+ }
+
+ if(dlg.DoModal() == IDOK) {
+ for(int j = 0; j < (int)pages.GetCount(); j++) {
+ stss = styles[j];
+ pages[j]->GetStyle(*stss);
+
+ for(int i = 0; i < m_sts.GetCount(); i++) {
+ if(m_sts.GetStyle(i) == stss) {
+ CString str;
+ m_list.SetItemText(i, COL_TEXT, m_sts.GetStr(i, true));
+ m_list.SetItemText(i, COL_FONT, stss->fontName);
+ str.Format(_T("%d"), stss->charSet);
+ m_list.SetItemText(i, COL_CHARSET, str);
+ str.Format(_T("%d"), m_sts[i].layer);
+ }
+ }
+ }
+
+ fNeedsUpdate = true;
+ }
+ } else if(id == UNICODEYES || id == UNICODENO) {
+ m_sts.ConvertUnicode(iItem, id == UNICODEYES);
+ m_list.SetItemText(iItem, COL_TEXT, m_sts.GetStr(iItem, true));
+ m_list.SetItemText(iItem, COL_UNICODE, m_sts.IsEntryUnicode(iItem) ? _T("yes") : _T("no"));
fNeedsUpdate = true;
+ } else if(id == LAYERDEC || id == LAYERINC) {
+ int d = (id == LAYERDEC) ? -1 : (id == LAYERINC) ? +1 : 0;
+ if(d != 0) {
+ fNeedsUpdate = true;
+ }
+ m_sts[iItem].layer += d;
+ CString s;
+ s.Format(_T("%d"), m_sts[iItem].layer);
+ m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
+ } else if(ACTORFIRST <= id && id <= ACTORLAST) {
+ CString s = actors[id - ACTORFIRST];
+ if(m_sts[iItem].actor != s) {
+ fNeedsUpdate = true;
+ }
+ m_sts[iItem].actor = s;
+ m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
+ } else if(EFFECTFIRST <= id && id <= EFFECTLAST) {
+ CString s = effects[id - EFFECTFIRST];
+ if(m_sts[iItem].effect != s) {
+ fNeedsUpdate = true;
+ }
+ m_sts[iItem].effect = s;
+ m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
}
- }
- else if(id == UNICODEYES || id == UNICODENO)
- {
- m_sts.ConvertUnicode(iItem, id == UNICODEYES);
- m_list.SetItemText(iItem, COL_TEXT, m_sts.GetStr(iItem, true));
- m_list.SetItemText(iItem, COL_UNICODE, m_sts.IsEntryUnicode(iItem) ? _T("yes") : _T("no"));
- fNeedsUpdate = true;
- }
- else if(id == LAYERDEC || id == LAYERINC)
- {
- int d = (id == LAYERDEC) ? -1 : (id == LAYERINC) ? +1 : 0;
- if(d != 0) fNeedsUpdate = true;
- m_sts[iItem].layer += d;
- CString s;
- s.Format(_T("%d"), m_sts[iItem].layer);
- m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
- }
- else if(ACTORFIRST <= id && id <= ACTORLAST)
- {
- CString s = actors[id - ACTORFIRST];
- if(m_sts[iItem].actor != s) fNeedsUpdate = true;
- m_sts[iItem].actor = s;
- m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
- }
- else if(EFFECTFIRST <= id && id <= EFFECTLAST)
- {
- CString s = effects[id - EFFECTFIRST];
- if(m_sts[iItem].effect != s) fNeedsUpdate = true;
- m_sts[iItem].effect = s;
- m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
- }
- break;
+ break;
}
}
- if(fNeedsUpdate)
- {
+ if(fNeedsUpdate) {
UpdatePreview();
}
}
@@ -1150,13 +1107,12 @@ void CPlayerSubresyncBar::OnNMDblclkList(NMHDR* pNMHDR, LRESULT* pResult) {
LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
- if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0 && (m_mode == VOBSUB || m_mode == TEXTSUB))
- {
- if(CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd())
- {
+ if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0 && (m_mode == VOBSUB || m_mode == TEXTSUB)) {
+ if(CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd()) {
int t = 0;
- if(!ParseTime(m_list.GetItemText(lpnmlv->iItem, lpnmlv->iSubItem), t, false))
+ if(!ParseTime(m_list.GetItemText(lpnmlv->iItem, lpnmlv->iSubItem), t, false)) {
t = m_sts[lpnmlv->iItem].start;
+ }
REFERENCE_TIME rt =
lpnmlv->iSubItem == COL_START ? ((REFERENCE_TIME)t*10000) :
@@ -1189,71 +1145,55 @@ void CPlayerSubresyncBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = CDRF_DODEFAULT;
- if(CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
- {
+ if(CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage) {
m_itemGroups.SetSize(m_list.GetItemCount());
m_totalGroups = 0;
- for(int i = 0, j = m_list.GetItemCount(); i < j; i++)
- {
- if(m_list.GetItemData(i)&TSEP) m_totalGroups++;
+ for(int i = 0, j = m_list.GetItemCount(); i < j; i++) {
+ if(m_list.GetItemData(i)&TSEP) {
+ m_totalGroups++;
+ }
m_itemGroups[i] = m_totalGroups;
}
*pResult = CDRF_NOTIFYPOSTPAINT|CDRF_NOTIFYITEMDRAW;
- }
- else if(CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
- {
+ } else if(CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage) {
pLVCD->nmcd.uItemState &= ~CDIS_FOCUS;
*pResult = CDRF_NOTIFYPOSTPAINT|CDRF_NOTIFYSUBITEMDRAW;
- }
- else if((CDDS_ITEMPREPAINT|CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage)
- {
+ } else if((CDDS_ITEMPREPAINT|CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage) {
COLORREF clrText;
COLORREF clrTextBk;
if((pLVCD->iSubItem == COL_START || pLVCD->iSubItem == COL_END || pLVCD->iSubItem == COL_TEXT || pLVCD->iSubItem == COL_STYLE
|| pLVCD->iSubItem == COL_LAYER || pLVCD->iSubItem == COL_ACTOR || pLVCD->iSubItem == COL_EFFECT)
- && m_mode == TEXTSUB)
- {
+ && m_mode == TEXTSUB) {
clrText = 0;
- }
- else if((pLVCD->iSubItem == COL_START)
- && m_mode == VOBSUB)
- {
+ } else if((pLVCD->iSubItem == COL_START)
+ && m_mode == VOBSUB) {
clrText = 0;
- }
- else
- {
+ } else {
clrText = 0x606060;
}
clrTextBk = 0xffffff;
-// if(m_totalGroups > 0)
+ // if(m_totalGroups > 0)
clrTextBk -= ((m_itemGroups[pLVCD->nmcd.dwItemSpec]&1) ? 0x100010 : 0x200020);
- if(m_sts[pLVCD->nmcd.dwItemSpec].start <= m_rt/10000 && m_rt/10000 < m_sts[pLVCD->nmcd.dwItemSpec].end)
- {
+ if(m_sts[pLVCD->nmcd.dwItemSpec].start <= m_rt/10000 && m_rt/10000 < m_sts[pLVCD->nmcd.dwItemSpec].end) {
clrText |= 0xFF;
}
int nCheck = (int)m_list.GetItemData(pLVCD->nmcd.dwItemSpec);
- if((nCheck&1) && (pLVCD->iSubItem == COL_START || pLVCD->iSubItem == COL_PREVSTART))
- {
+ if((nCheck&1) && (pLVCD->iSubItem == COL_START || pLVCD->iSubItem == COL_PREVSTART)) {
clrTextBk = 0xffddbb;
- }
- else if((nCheck&4) && (/*pLVCD->iSubItem == COL_START ||*/ pLVCD->iSubItem == COL_PREVSTART))
- {
+ } else if((nCheck&4) && (/*pLVCD->iSubItem == COL_START ||*/ pLVCD->iSubItem == COL_PREVSTART)) {
clrTextBk = 0xffeedd;
}
- if((nCheck&2) && (pLVCD->iSubItem == COL_END || pLVCD->iSubItem == COL_PREVEND))
- {
+ if((nCheck&2) && (pLVCD->iSubItem == COL_END || pLVCD->iSubItem == COL_PREVEND)) {
clrTextBk = 0xffddbb;
- }
- else if((nCheck&8) && (/*pLVCD->iSubItem == COL_END ||*/ pLVCD->iSubItem == COL_PREVEND))
- {
+ } else if((nCheck&8) && (/*pLVCD->iSubItem == COL_END ||*/ pLVCD->iSubItem == COL_PREVEND)) {
clrTextBk = 0xffeedd;
}
@@ -1261,13 +1201,9 @@ void CPlayerSubresyncBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult) pLVCD->clrTextBk = clrTextBk;
*pResult = CDRF_NOTIFYPOSTPAINT;
- }
- else if((CDDS_ITEMPOSTPAINT|CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage)
- {
-// *pResult = CDRF_DODEFAULT;
- }
- else if(CDDS_ITEMPOSTPAINT == pLVCD->nmcd.dwDrawStage)
- {
+ } else if((CDDS_ITEMPOSTPAINT|CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage) {
+ // *pResult = CDRF_DODEFAULT;
+ } else if(CDDS_ITEMPOSTPAINT == pLVCD->nmcd.dwDrawStage) {
int nItem = static_cast<int>(pLVCD->nmcd.dwItemSpec);
LVITEM rItem;
@@ -1301,8 +1237,7 @@ void CPlayerSubresyncBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult) // Get the column offset
int offset = rcItem.left;
- for(int i = 0; i < nColumnCount; i++)
- {
+ for(int i = 0; i < nColumnCount; i++) {
offset += m_list.GetColumnWidth(i);
pDC->MoveTo(CPoint(offset, rcItem.top));
pDC->LineTo(CPoint(offset, rcItem.bottom));
@@ -1313,62 +1248,55 @@ void CPlayerSubresyncBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = CDRF_SKIPDEFAULT;
}
- }
- else if(CDDS_POSTPAINT == pLVCD->nmcd.dwDrawStage)
- {
+ } else if(CDDS_POSTPAINT == pLVCD->nmcd.dwDrawStage) {
}
}
bool CPlayerSubresyncBar::IsShortCut(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN && VK_F1 <= pMsg->wParam && pMsg->wParam <= VK_F6)
- {
+ if(pMsg->message == WM_KEYDOWN && VK_F1 <= pMsg->wParam && pMsg->wParam <= VK_F6) {
int iItem = -1;
bool fNeedsUpdate = false;
bool fStep = false;
POSITION pos = m_list.GetFirstSelectedItemPosition();
- while(pos)
- {
+ while(pos) {
iItem = m_list.GetNextSelectedItem(pos);
SubTime& st = m_subtimes[iItem];
- switch(pMsg->wParam)
- {
- case VK_F1: /*if(*/
- ModStart(iItem, st.orgstart, true);/*)*/
- fNeedsUpdate = true;
- break;
- case VK_F3: /*if(*/
- ModStart(iItem, st.orgstart);/*)*/
- fNeedsUpdate = true;
- break;
- case VK_F5: /*if(*/
- ModStart(iItem, (int)(m_rt/10000));/*)*/
- fNeedsUpdate = true;
- break;
- case VK_F2: /*if(*/
- ModEnd(iItem, st.orgend, true);/*)*/
- fNeedsUpdate = true;
- break;
- case VK_F4: /*if(*/
- ModEnd(iItem, st.orgend);/*)*/
- fNeedsUpdate = true;
- break;
- case VK_F6: /*if(*/
- ModEnd(iItem, (int)(m_rt/10000));/*)*/
- fNeedsUpdate = fStep = true;
- break;
+ switch(pMsg->wParam) {
+ case VK_F1: /*if(*/
+ ModStart(iItem, st.orgstart, true);/*)*/
+ fNeedsUpdate = true;
+ break;
+ case VK_F3: /*if(*/
+ ModStart(iItem, st.orgstart);/*)*/
+ fNeedsUpdate = true;
+ break;
+ case VK_F5: /*if(*/
+ ModStart(iItem, (int)(m_rt/10000));/*)*/
+ fNeedsUpdate = true;
+ break;
+ case VK_F2: /*if(*/
+ ModEnd(iItem, st.orgend, true);/*)*/
+ fNeedsUpdate = true;
+ break;
+ case VK_F4: /*if(*/
+ ModEnd(iItem, st.orgend);/*)*/
+ fNeedsUpdate = true;
+ break;
+ case VK_F6: /*if(*/
+ ModEnd(iItem, (int)(m_rt/10000));/*)*/
+ fNeedsUpdate = fStep = true;
+ break;
}
}
- if(fNeedsUpdate)
- {
- if(fStep && m_list.GetSelectedCount() == 1 && iItem < m_list.GetItemCount()-1)
- {
+ if(fNeedsUpdate) {
+ if(fStep && m_list.GetSelectedCount() == 1 && iItem < m_list.GetItemCount()-1) {
m_list.SetItemState(iItem, 0, LVIS_SELECTED);
m_list.SetItemState(iItem+1, LVIS_SELECTED, LVIS_SELECTED);
m_list.SetSelectionMark(iItem+1);
@@ -1389,22 +1317,18 @@ int CPlayerSubresyncBar::FindNearestSub(__int64& rtPos, bool bForward) {
long lCurTime = rtPos / 10000 + (bForward ? 1 : -1);
- if (m_subtimes.GetCount() == 0)
- {
+ if (m_subtimes.GetCount() == 0) {
rtPos = max (0, rtPos + (bForward ? 1 : -1) * 50000000);
return -2;
}
- if (lCurTime < m_subtimes[0].newstart)
- {
+ if (lCurTime < m_subtimes[0].newstart) {
rtPos = m_subtimes[0].newstart * 10000;
return 0;
}
- for(int i = 1, j = m_sts.GetCount(); i < j; i++)
- {
- if ((lCurTime >= m_subtimes[i-1].newstart) && (lCurTime < m_subtimes[i].newstart))
- {
+ for(int i = 1, j = m_sts.GetCount(); i < j; i++) {
+ if ((lCurTime >= m_subtimes[i-1].newstart) && (lCurTime < m_subtimes[i].newstart)) {
rtPos = bForward ? (__int64)m_subtimes[i].newstart * 10000 : (__int64)m_subtimes[i-1].newstart * 10000;
return bForward ? i : i-1;
}
@@ -1418,10 +1342,8 @@ bool CPlayerSubresyncBar::ShiftSubtitle(int nItem, long lValue, __int64& rtPos) {
bool bRet = false;
- if ((nItem == 0) || (m_subtimes[nItem-1].newend < m_subtimes[nItem].newstart + lValue))
- {
- for (int i= nItem; i<m_sts.GetCount(); i++)
- {
+ if ((nItem == 0) || (m_subtimes[nItem-1].newend < m_subtimes[nItem].newstart + lValue)) {
+ for (int i= nItem; i<m_sts.GetCount(); i++) {
m_subtimes[i].newstart += lValue;
m_subtimes[i].newend += lValue;
m_subtimes[i].orgstart += lValue;
diff --git a/src/apps/mplayerc/PlayerSubresyncBar.h b/src/apps/mplayerc/PlayerSubresyncBar.h index 050c50ff0..1369c9824 100644 --- a/src/apps/mplayerc/PlayerSubresyncBar.h +++ b/src/apps/mplayerc/PlayerSubresyncBar.h @@ -46,8 +46,7 @@ private: int m_lastSegment;
__int64 m_rt;
- enum
- {
+ enum {
// TEXTSUB
COL_START=0, COL_END, COL_PREVSTART, COL_PREVEND, COL_TEXT, COL_STYLE, COL_FONT, COL_CHARSET, COL_UNICODE, COL_LAYER, COL_ACTOR, COL_EFFECT,
// VOBSUB
@@ -59,13 +58,12 @@ private: bool m_fUnlink;
- typedef struct
- {
+ typedef struct {
int orgstart, newstart, orgend, newend;
} SubTime;
CAtlArray<SubTime> m_subtimes;
-// CRenderedTextSubtitle m_sts;
+ // CRenderedTextSubtitle m_sts;
CSimpleTextSubtitle m_sts;
int GetStartTime(int iItem), GetEndTime(int iItem);
diff --git a/src/apps/mplayerc/PlayerToolBar.cpp b/src/apps/mplayerc/PlayerToolBar.cpp index 4c6ba5a90..651df397a 100644 --- a/src/apps/mplayerc/PlayerToolBar.cpp +++ b/src/apps/mplayerc/PlayerToolBar.cpp @@ -47,10 +47,12 @@ BOOL CPlayerToolBar::Create(CWnd* pParentWnd) {
if(!__super::CreateEx(pParentWnd,
TBSTYLE_FLAT|TBSTYLE_TRANSPARENT|TBSTYLE_AUTOSIZE,
- WS_CHILD|WS_VISIBLE|CBRS_ALIGN_BOTTOM|CBRS_TOOLTIPS, CRect(2,2,0,3)))
+ WS_CHILD|WS_VISIBLE|CBRS_ALIGN_BOTTOM|CBRS_TOOLTIPS, CRect(2,2,0,3))) {
return FALSE;
- if(!LoadToolBar(IDB_PLAYERTOOLBAR))
+ }
+ if(!LoadToolBar(IDB_PLAYERTOOLBAR)) {
return FALSE;
+ }
GetToolBarCtrl().SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);
@@ -60,8 +62,7 @@ BOOL CPlayerToolBar::Create(CWnd* pParentWnd) SetMute(AfxGetAppSettings().fMute);
- UINT styles[] =
- {
+ UINT styles[] = {
TBBS_CHECKGROUP, TBBS_CHECKGROUP, TBBS_CHECKGROUP,
TBBS_SEPARATOR,
TBBS_BUTTON, TBBS_BUTTON, TBBS_BUTTON, TBBS_BUTTON,
@@ -73,17 +74,18 @@ BOOL CPlayerToolBar::Create(CWnd* pParentWnd) /*TBBS_SEPARATOR,*/
};
- for(int i = 0; i < countof(styles); i++)
+ for(int i = 0; i < countof(styles); i++) {
SetButtonStyle(i, styles[i]|TBBS_DISABLED);
+ }
m_volctrl.Create(this);
- if(AfxGetAppSettings().fDisableXPToolbars)
- {
- if(HMODULE h = LoadLibrary(_T("uxtheme.dll")))
- {
+ if(AfxGetAppSettings().fDisableXPToolbars) {
+ if(HMODULE h = LoadLibrary(_T("uxtheme.dll"))) {
SetWindowThemeFunct f = (SetWindowThemeFunct)GetProcAddress(h, "SetWindowTheme");
- if(f) f(m_hWnd, L" ", L" ");
+ if(f) {
+ f(m_hWnd, L" ", L" ");
+ }
FreeLibrary(h);
}
}
@@ -91,14 +93,12 @@ BOOL CPlayerToolBar::Create(CWnd* pParentWnd) // quick and dirty code from foxx1337; will leak, but don't care yet
m_nButtonHeight = 16; // hardcoded from MainFrm.cpp - DEFCLIENTW; min width should be 9 * button width + 60 + 91
HBITMAP hBmp = static_cast<HBITMAP>(::LoadImage(NULL, _T("toolbar.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION));
- if(NULL != hBmp)
- {
+ if(NULL != hBmp) {
CBitmap *bmp = new CBitmap();
bmp->Attach(hBmp);
BITMAP bitmapBmp;
bmp->GetBitmap(&bitmapBmp);
- if(bitmapBmp.bmWidth == bitmapBmp.bmHeight * 15)
- {
+ if(bitmapBmp.bmWidth == bitmapBmp.bmHeight * 15) {
// the manual specifies that sizeButton should be sizeImage inflated by (7, 6)
SetSizes(CSize(bitmapBmp.bmHeight + 7, bitmapBmp.bmHeight + 6), CSize(bitmapBmp.bmHeight, bitmapBmp.bmHeight));
@@ -110,13 +110,10 @@ BOOL CPlayerToolBar::Create(CWnd* pParentWnd) GetDIBits(dc, hBmp, 0, 0, NULL, reinterpret_cast<BITMAPINFO*>(&bih), DIB_RGB_COLORS);
int fileDepth = bih.biBitCount;
CImageList *imageList = new CImageList();
- if(32 == fileDepth)
- {
+ if(32 == fileDepth) {
imageList->Create(bitmapBmp.bmHeight, bitmapBmp.bmHeight, ILC_COLOR32 | ILC_MASK, 1, 0);
imageList->Add(bmp, static_cast<CBitmap*>(0)); // alpha is the mask
- }
- else
- {
+ } else {
imageList->Create(bitmapBmp.bmHeight, bitmapBmp.bmHeight, ILC_COLOR24 | ILC_MASK, 1, 0);
imageList->Add(bmp, RGB(255, 0, 255));
}
@@ -132,19 +129,22 @@ BOOL CPlayerToolBar::Create(CWnd* pParentWnd) BOOL CPlayerToolBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!__super::PreCreateWindow(cs))
+ if(!__super::PreCreateWindow(cs)) {
return FALSE;
+ }
m_dwStyle &= ~CBRS_BORDER_TOP;
m_dwStyle &= ~CBRS_BORDER_BOTTOM;
-// m_dwStyle |= CBRS_SIZE_FIXED;
+ // m_dwStyle |= CBRS_SIZE_FIXED;
return TRUE;
}
void CPlayerToolBar::ArrangeControls()
{
- if(!::IsWindow(m_volctrl.m_hWnd)) return;
+ if(!::IsWindow(m_volctrl.m_hWnd)) {
+ return;
+ }
CRect r;
GetClientRect(&r);
@@ -203,10 +203,10 @@ int CPlayerToolBar::GetMinWidth() void CPlayerToolBar::SetVolume(int volume)
{
-/*
- volume = (int)pow(10, ((double)volume)/5000+2);
- volume = max(min(volume, 100), 1);
-*/
+ /*
+ volume = (int)pow(10, ((double)volume)/5000+2);
+ volume = max(min(volume, 100), 1);
+ */
m_volctrl.SetPosInternal(volume);
}
@@ -227,8 +227,9 @@ END_MESSAGE_MAP() void CPlayerToolBar::OnPaint()
{
- if(m_bDelayedButtonLayout)
+ if(m_bDelayedButtonLayout) {
Layout();
+ }
CPaintDC dc(this); // device context for painting
@@ -301,12 +302,12 @@ void CPlayerToolBar::OnMouseMove(UINT nFlags, CPoint point) {
int i = getHitButtonIdx(point);
- if((i==-1) || (GetButtonStyle(i)&(TBBS_SEPARATOR|TBBS_DISABLED)))
+ if((i==-1) || (GetButtonStyle(i)&(TBBS_SEPARATOR|TBBS_DISABLED))) {
;
- else
- {
- if((i>11) || ((i<10) && ((CMainFrame*)GetParentFrame())->IsSomethingLoaded()))
+ } else {
+ if((i>11) || ((i<10) && ((CMainFrame*)GetParentFrame())->IsSomethingLoaded())) {
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_HAND));
+ }
}
__super::OnMouseMove(nFlags, point);
}
@@ -316,18 +317,15 @@ void CPlayerToolBar::OnLButtonDown(UINT nFlags, CPoint point) int i = getHitButtonIdx(point);
CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
- if((i==-1) || (GetButtonStyle(i)&(TBBS_SEPARATOR|TBBS_DISABLED)))
- {
- if(!pFrame->m_fFullScreen)
- {
+ if((i==-1) || (GetButtonStyle(i)&(TBBS_SEPARATOR|TBBS_DISABLED))) {
+ if(!pFrame->m_fFullScreen) {
MapWindowPoints(pFrame, &point, 1);
pFrame->PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
}
- }
- else
- {
- if((i>11) || ((i<10) && pFrame->IsSomethingLoaded()))
+ } else {
+ if((i>11) || ((i<10) && pFrame->IsSomethingLoaded())) {
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_HAND));
+ }
__super::OnLButtonDown(nFlags, point);
}
@@ -338,12 +336,10 @@ int CPlayerToolBar::getHitButtonIdx(CPoint point) int hit = -1; // -1 means not on any buttons, mute button is 12/13, others < 10, 11 is empty space between
CRect r;
- for(int i = 0, j = GetToolBarCtrl().GetButtonCount(); i < j; i++)
- {
+ for(int i = 0, j = GetToolBarCtrl().GetButtonCount(); i < j; i++) {
GetItemRect(i, r);
- if(r.PtInRect(point))
- {
+ if(r.PtInRect(point)) {
hit = i;
break;
}
diff --git a/src/apps/mplayerc/PlayerToolBar.h b/src/apps/mplayerc/PlayerToolBar.h index 0a41ae84c..755256ae5 100644 --- a/src/apps/mplayerc/PlayerToolBar.h +++ b/src/apps/mplayerc/PlayerToolBar.h @@ -51,14 +51,14 @@ public: CVolumeCtrl m_volctrl;
-// Overrides
+ // Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPlayerToolBar)
virtual BOOL Create(CWnd* pParentWnd);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
-// Generated message map functions
+ // Generated message map functions
protected:
//{{AFX_MSG(CPlayerToolBar)
afx_msg void OnPaint();
diff --git a/src/apps/mplayerc/Playlist.cpp b/src/apps/mplayerc/Playlist.cpp index c83b1acb4..8e73ba62f 100644 --- a/src/apps/mplayerc/Playlist.cpp +++ b/src/apps/mplayerc/Playlist.cpp @@ -76,10 +76,10 @@ CPlaylistItem& CPlaylistItem::operator = (const CPlaylistItem& pli) POSITION CPlaylistItem::FindFile(LPCTSTR path)
{
POSITION pos = m_fns.GetHeadPosition();
- while(pos)
- {
- if (m_fns.GetAt(pos).CompareNoCase(path) == 0)
+ while(pos) {
+ if (m_fns.GetAt(pos).CompareNoCase(path) == 0) {
return pos;
+ }
m_fns.GetNext(pos);
}
return(NULL);
@@ -97,21 +97,21 @@ CString CPlaylistItem::GetLabel(int i) {
CString str;
- if(i == 0)
- {
- if(!m_label.IsEmpty()) str = m_label;
- else if(!m_fns.IsEmpty()) str = StripPath(m_fns.GetHead());
- }
- else if(i == 1)
- {
- if(m_fInvalid) return _T("Invalid");
+ if(i == 0) {
+ if(!m_label.IsEmpty()) {
+ str = m_label;
+ } else if(!m_fns.IsEmpty()) {
+ str = StripPath(m_fns.GetHead());
+ }
+ } else if(i == 1) {
+ if(m_fInvalid) {
+ return _T("Invalid");
+ }
- if(m_type == file)
- {
+ if(m_type == file) {
REFERENCE_TIME rt = m_duration;
- if(rt > 0)
- {
+ if(rt > 0) {
rt /= 10000000;
int ss = int(rt%60);
rt /= 60;
@@ -121,9 +121,7 @@ CString CPlaylistItem::GetLabel(int i) str.Format(_T("%02d:%02d:%02d"), hh, mm, ss);
}
- }
- else if(m_type == device)
- {
+ } else if(m_type == device) {
// TODO
}
@@ -136,51 +134,49 @@ bool FindFileInList(CAtlList<CString>& sl, CString fn) {
bool fFound = false;
POSITION pos = sl.GetHeadPosition();
- while(pos && !fFound)
- {
- if(!sl.GetNext(pos).CompareNoCase(fn)) fFound = true;
+ while(pos && !fFound) {
+ if(!sl.GetNext(pos).CompareNoCase(fn)) {
+ fFound = true;
+ }
}
return(fFound);
}
void CPlaylistItem::AutoLoadFiles()
{
- if(m_fns.IsEmpty()) return;
+ if(m_fns.IsEmpty()) {
+ return;
+ }
CString fn = m_fns.GetHead();
- if(AfxGetAppSettings().fAutoloadAudio && fn.Find(_T("://")) < 0)
- {
+ if(AfxGetAppSettings().fAutoloadAudio && fn.Find(_T("://")) < 0) {
int i = fn.ReverseFind('.');
- if(i > 0)
- {
+ if(i > 0) {
CMediaFormats& mf = AfxGetAppSettings().m_Formats;
CString ext = fn.Mid(i+1).MakeLower();
- if(!mf.FindExt(ext, true))
- {
+ if(!mf.FindExt(ext, true)) {
CString path = fn;
path.Replace('/', '\\');
path = path.Left(path.ReverseFind('\\')+1);
WIN32_FIND_DATA fd = {0};
HANDLE hFind = FindFirstFile(fn.Left(i) + _T("*.*"), &fd);
- if(hFind != INVALID_HANDLE_VALUE)
- {
- do
- {
- if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) continue;
+ if(hFind != INVALID_HANDLE_VALUE) {
+ do {
+ if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
+ continue;
+ }
CString fullpath = path + fd.cFileName;
CString ext2 = fullpath.Mid(fullpath.ReverseFind('.')+1).MakeLower();
if(!FindFileInList(m_fns, fullpath) && ext != ext2
- && mf.FindExt(ext2, true) && mf.IsUsingEngine(fullpath, DirectShow))
- {
+ && mf.FindExt(ext2, true) && mf.IsUsingEngine(fullpath, DirectShow)) {
m_fns.AddTail(fullpath);
}
- }
- while(FindNextFile(hFind, &fd));
+ } while(FindNextFile(hFind, &fd));
FindClose(hFind);
}
@@ -188,15 +184,13 @@ void CPlaylistItem::AutoLoadFiles() }
}
- if(AfxGetAppSettings().fAutoloadSubtitles)
- {
+ if(AfxGetAppSettings().fAutoloadSubtitles) {
CString& pathList = AfxGetAppSettings().strSubtitlePaths;
CAtlArray<CString> paths;
int pos = 0;
- do
- {
+ do {
CString path = pathList.Tokenize(_T(";"), pos);
paths.Add(path);
} while(pos != -1);
@@ -206,17 +200,19 @@ void CPlaylistItem::AutoLoadFiles() int l = fn.GetLength(), l2 = l;
l2 = dir.ReverseFind('.');
l = dir.ReverseFind('/') + 1;
- if(l2 < l) l2 = l;
+ if(l2 < l) {
+ l2 = l;
+ }
CString title = dir.Mid(l, l2-l);
paths.Add(title.GetString());
CAtlArray<SubFile> ret;
GetSubFileNames(fn, paths, ret);
- for(int i = 0; i < ret.GetCount(); i++)
- {
- if(!FindFileInList(m_subs, ret[i].fn))
+ for(int i = 0; i < ret.GetCount(); i++) {
+ if(!FindFileInList(m_subs, ret[i].fn)) {
m_subs.AddTail(ret[i].fn);
+ }
}
}
}
@@ -242,11 +238,9 @@ void CPlaylist::RemoveAll() bool CPlaylist::RemoveAt(POSITION pos)
{
- if(pos)
- {
+ if(pos) {
__super::RemoveAt(pos);
- if(m_pos == pos)
- {
+ if(m_pos == pos) {
m_pos = NULL;
return(true);
}
@@ -255,8 +249,7 @@ bool CPlaylist::RemoveAt(POSITION pos) return(false);
}
-typedef struct
-{
+typedef struct {
UINT n;
POSITION pos;
} plsort_t;
@@ -268,8 +261,7 @@ static int compare(const void* arg1, const void* arg2) return a1 > a2 ? 1 : a1 < a2 ? -1 : 0;
}
-typedef struct
-{
+typedef struct {
LPCTSTR str;
POSITION pos;
} plsort2_t;
@@ -284,14 +276,16 @@ void CPlaylist::SortById() CAtlArray<plsort_t> a;
a.SetCount(GetCount());
POSITION pos = GetHeadPosition();
- for(int i = 0; pos; i++, GetNext(pos))
+ for(int i = 0; pos; i++, GetNext(pos)) {
a[i].n = GetAt(pos).m_id, a[i].pos = pos;
+ }
qsort(a.GetData(), a.GetCount(), sizeof(plsort_t), compare);
- for(int i = 0; i < a.GetCount(); i++)
- {
+ for(int i = 0; i < a.GetCount(); i++) {
AddTail(GetAt(a[i].pos));
__super::RemoveAt(a[i].pos);
- if(m_pos == a[i].pos) m_pos = GetTailPosition();
+ if(m_pos == a[i].pos) {
+ m_pos = GetTailPosition();
+ }
}
}
@@ -300,18 +294,18 @@ void CPlaylist::SortByName() CAtlArray<plsort2_t> a;
a.SetCount(GetCount());
POSITION pos = GetHeadPosition();
- for(int i = 0; pos; i++, GetNext(pos))
- {
+ for(int i = 0; pos; i++, GetNext(pos)) {
CString& fn = GetAt(pos).m_fns.GetHead();
a[i].str = (LPCTSTR)fn + max(fn.ReverseFind('/'), fn.ReverseFind('\\')) + 1;
a[i].pos = pos;
}
qsort(a.GetData(), a.GetCount(), sizeof(plsort2_t), compare2);
- for(int i = 0; i < a.GetCount(); i++)
- {
+ for(int i = 0; i < a.GetCount(); i++) {
AddTail(GetAt(a[i].pos));
__super::RemoveAt(a[i].pos);
- if(m_pos == a[i].pos) m_pos = GetTailPosition();
+ if(m_pos == a[i].pos) {
+ m_pos = GetTailPosition();
+ }
}
}
@@ -320,14 +314,16 @@ void CPlaylist::SortByPath() CAtlArray<plsort2_t> a;
a.SetCount(GetCount());
POSITION pos = GetHeadPosition();
- for(int i = 0; pos; i++, GetNext(pos))
+ for(int i = 0; pos; i++, GetNext(pos)) {
a[i].str = GetAt(pos).m_fns.GetHead(), a[i].pos = pos;
+ }
qsort(a.GetData(), a.GetCount(), sizeof(plsort2_t), compare2);
- for(int i = 0; i < a.GetCount(); i++)
- {
+ for(int i = 0; i < a.GetCount(); i++) {
AddTail(GetAt(a[i].pos));
__super::RemoveAt(a[i].pos);
- if(m_pos == a[i].pos) m_pos = GetTailPosition();
+ if(m_pos == a[i].pos) {
+ m_pos = GetTailPosition();
+ }
}
}
@@ -337,16 +333,17 @@ void CPlaylist::Randomize() a.SetCount(GetCount());
srand((unsigned int)time(NULL));
POSITION pos = GetHeadPosition();
- for(int i = 0; pos; i++, GetNext(pos))
+ for(int i = 0; pos; i++, GetNext(pos)) {
a[i].n = rand(), a[i].pos = pos;
+ }
qsort(a.GetData(), a.GetCount(), sizeof(plsort_t), compare);
CList<CPlaylistItem> pl;
- for(int i = 0; i < a.GetCount(); i++)
- {
+ for(int i = 0; i < a.GetCount(); i++) {
AddTail(GetAt(a[i].pos));
__super::RemoveAt(a[i].pos);
- if(m_pos == a[i].pos)
+ if(m_pos == a[i].pos) {
m_pos = GetTailPosition();
+ }
}
}
@@ -374,8 +371,9 @@ POSITION CPlaylist::Shuffle() a.SetCount(count = GetCount());
POSITION pos = GetHeadPosition();
- for(INT_PTR i = 0; pos; i++, GetNext(pos))
- a[i].pos = pos; // initialize position array
+ for(INT_PTR i = 0; pos; i++, GetNext(pos)) {
+ a[i].pos = pos; // initialize position array
+ }
//Use Fisher-Yates shuffle algorithm
srand((unsigned)time(NULL));
@@ -392,14 +390,13 @@ POSITION CPlaylist::Shuffle() CPlaylistItem& CPlaylist::GetNextWrap(POSITION& pos)
{
- if(AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("ShufflePlaylistItems"), FALSE) && GetCount() > 2)
- {
+ if(AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("ShufflePlaylistItems"), FALSE) && GetCount() > 2) {
pos = Shuffle();
- }
- else
- {
+ } else {
GetNext(pos);
- if(!pos) pos = GetHeadPosition();
+ if(!pos) {
+ pos = GetHeadPosition();
+ }
}
return(GetAt(pos));
@@ -408,6 +405,8 @@ CPlaylistItem& CPlaylist::GetNextWrap(POSITION& pos) CPlaylistItem& CPlaylist::GetPrevWrap(POSITION& pos)
{
GetPrev(pos);
- if(!pos) pos = GetTailPosition();
+ if(!pos) {
+ pos = GetTailPosition();
+ }
return(GetAt(pos));
}
diff --git a/src/apps/mplayerc/PnSPresetsDlg.cpp b/src/apps/mplayerc/PnSPresetsDlg.cpp index eb8689020..17ee7423e 100644 --- a/src/apps/mplayerc/PnSPresetsDlg.cpp +++ b/src/apps/mplayerc/PnSPresetsDlg.cpp @@ -54,16 +54,14 @@ BOOL CPnSPresetsDlg::OnInitDialog() {
__super::OnInitDialog();
- for(int i = 0, j = m_pnspresets.GetCount(); i < j; i++)
- {
+ for(int i = 0, j = m_pnspresets.GetCount(); i < j; i++) {
CString label;
double PosX, PosY, ZoomX, ZoomY;
StringToParams(m_pnspresets[i], label, PosX, PosY, ZoomX, ZoomY);
m_list.AddString(label);
- if(i == 0)
- {
+ if(i == 0) {
m_list.SetCurSel(0);
OnLbnSelchangeList1();
}
@@ -78,33 +76,30 @@ void CPnSPresetsDlg::StringToParams(CString str, CString& label, double& PosX, d {
int i = 0, j = 0;
- for(CString token = str.Tokenize(_T(","), i); !token.IsEmpty(); token = str.Tokenize(_T(","), i), j++)
- {
- if(j == 0)
- {
+ for(CString token = str.Tokenize(_T(","), i); !token.IsEmpty(); token = str.Tokenize(_T(","), i), j++) {
+ if(j == 0) {
label = token;
- }
- else
- {
+ } else {
float f = 0;
- if(_stscanf_s(token, _T("%f"), &f) != 1) continue;
-
- switch(j)
- {
- case 1:
- PosX = f;
- break;
- case 2:
- PosY = f;
- break;
- case 3:
- ZoomX = f;
- break;
- case 4:
- ZoomY = f;
- break;
- default:
- break;
+ if(_stscanf_s(token, _T("%f"), &f) != 1) {
+ continue;
+ }
+
+ switch(j) {
+ case 1:
+ PosX = f;
+ break;
+ case 2:
+ PosY = f;
+ break;
+ case 3:
+ ZoomX = f;
+ break;
+ case 4:
+ ZoomY = f;
+ break;
+ default:
+ break;
}
}
}
@@ -136,17 +131,14 @@ END_MESSAGE_MAP() void CPnSPresetsDlg::OnLbnSelchangeList1()
{
int i = m_list.GetCurSel();
- if(i >= 0 && i < m_pnspresets.GetCount())
- {
+ if(i >= 0 && i < m_pnspresets.GetCount()) {
double PosX, PosY, ZoomX, ZoomY;
StringToParams(m_pnspresets[i], m_label, PosX, PosY, ZoomX, ZoomY);
m_PosX = PosX;
m_PosY = PosY;
m_ZoomX = ZoomX;
m_ZoomY = ZoomY;
- }
- else
- {
+ } else {
m_label.Empty();
m_PosX.SetWindowText(_T(""));
m_PosY.SetWindowText(_T(""));
@@ -168,7 +160,9 @@ void CPnSPresetsDlg::OnUpdateButton2(CCmdUI* pCmdUI) {
CString str;
int len = m_list.GetCount();
- if(len > 0) m_list.GetText(len-1, str);
+ if(len > 0) {
+ m_list.GetText(len-1, str);
+ }
pCmdUI->Enable(str != _T("New"));
}
@@ -177,7 +171,9 @@ void CPnSPresetsDlg::OnBnClickedButton6() // del int i = m_list.GetCurSel();
m_list.DeleteString(i);
m_pnspresets.RemoveAt(i);
- if(i == m_list.GetCount()) i--;
+ if(i == m_list.GetCount()) {
+ i--;
+ }
m_list.SetCurSel(i);
OnLbnSelchangeList1();
}
@@ -251,8 +247,9 @@ void CPnSPresetsDlg::OnUpdateButton1(CCmdUI* pCmdUI) void CPnSPresetsDlg::OnOK()
{
- if(m_list.GetCurSel() >= 0)
+ if(m_list.GetCurSel() >= 0) {
OnBnClickedButton1();
+ }
__super::OnOK();
}
diff --git a/src/apps/mplayerc/PnSPresetsDlg.h b/src/apps/mplayerc/PnSPresetsDlg.h index f4308b09c..bb21a8a1f 100644 --- a/src/apps/mplayerc/PnSPresetsDlg.h +++ b/src/apps/mplayerc/PnSPresetsDlg.h @@ -42,7 +42,7 @@ public: CStringArray m_pnspresets;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_PNSPRESET_DLG };
CFloatEdit m_PosX;
CFloatEdit m_PosY;
diff --git a/src/apps/mplayerc/QuicktimeGraph.cpp b/src/apps/mplayerc/QuicktimeGraph.cpp index dff3cac43..740041cb5 100644 --- a/src/apps/mplayerc/QuicktimeGraph.cpp +++ b/src/apps/mplayerc/QuicktimeGraph.cpp @@ -50,40 +50,35 @@ CQuicktimeGraph::CQuicktimeGraph(HWND hWndParent, HRESULT& hr) AppSettings& s = AfxGetAppSettings();
- if(s.iQTVideoRendererType == VIDRNDT_QT_DX7)
- {
- if(SUCCEEDED(CreateAP7(CLSID_QT7AllocatorPresenter, hWndParent, &m_pQTAP)))
+ if(s.iQTVideoRendererType == VIDRNDT_QT_DX7) {
+ if(SUCCEEDED(CreateAP7(CLSID_QT7AllocatorPresenter, hWndParent, &m_pQTAP))) {
dwStyle &= ~WS_VISIBLE;
- }
- else if(s.iQTVideoRendererType == VIDRNDT_QT_DX9)
- {
+ }
+ } else if(s.iQTVideoRendererType == VIDRNDT_QT_DX9) {
bool bFullscreen = (AfxGetApp()->m_pMainWnd != NULL) && (((CMainFrame*)AfxGetApp()->m_pMainWnd)->IsD3DFullScreenMode());
- if(SUCCEEDED(CreateAP9(CLSID_QT9AllocatorPresenter, hWndParent, bFullscreen, &m_pQTAP)))
+ if(SUCCEEDED(CreateAP9(CLSID_QT9AllocatorPresenter, hWndParent, bFullscreen, &m_pQTAP))) {
dwStyle &= ~WS_VISIBLE;
+ }
}
m_fQtInitialized = false;
- if(InitializeQTML(0) != 0)
- {
+ if(InitializeQTML(0) != 0) {
hr = E_FAIL;
return;
}
- if(EnterMovies() != 0)
- {
+ if(EnterMovies() != 0) {
TerminateQTML();
hr = E_FAIL;
return;
}
m_fQtInitialized = true;
- if(!m_wndWindowFrame.CreateEx(WS_EX_NOPARENTNOTIFY, NULL, NULL, dwStyle, CRect(0, 0, 0, 0), CWnd::FromHandle(hWndParent), 0))
- {
+ if(!m_wndWindowFrame.CreateEx(WS_EX_NOPARENTNOTIFY, NULL, NULL, dwStyle, CRect(0, 0, 0, 0), CWnd::FromHandle(hWndParent), 0)) {
hr = E_FAIL;
return;
}
- if(!m_wndDestFrame.Create(NULL, NULL, dwStyle, CRect(0, 0, 0, 0), &m_wndWindowFrame, 0))
- {
+ if(!m_wndDestFrame.Create(NULL, NULL, dwStyle, CRect(0, 0, 0, 0), &m_wndWindowFrame, 0)) {
hr = E_FAIL;
return;
}
@@ -94,8 +89,7 @@ CQuicktimeGraph::~CQuicktimeGraph() m_wndDestFrame.DestroyWindow();
m_wndWindowFrame.DestroyWindow();
- if(m_fQtInitialized)
- {
+ if(m_fQtInitialized) {
ExitMovies();
TerminateQTML();
}
@@ -116,21 +110,17 @@ STDMETHODIMP CQuicktimeGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPla {
bool fRet = m_wndDestFrame.OpenMovie(CString(lpcwstrFile));
- if(fRet)
- {
- for(int i = 1, cnt = GetMovieTrackCount(m_wndDestFrame.theMovie); i <= cnt; i++)
- {
+ if(fRet) {
+ for(int i = 1, cnt = GetMovieTrackCount(m_wndDestFrame.theMovie); i <= cnt; i++) {
Track aTrack = GetMovieIndTrack(m_wndDestFrame.theMovie, i);
Media aMedia = GetTrackMedia(aTrack);
OSType aTrackType;
GetMediaHandlerDescription(aMedia, &aTrackType, 0, 0);
- if(aTrackType == SoundMediaType)
- {
+ if(aTrackType == SoundMediaType) {
SampleDescriptionHandle aDesc = (SampleDescriptionHandle)NewHandle(sizeof(aDesc));
GetMediaSampleDescription(aMedia, 1, aDesc);
- if(GetMoviesError() == noErr)
- {
+ if(GetMoviesError() == noErr) {
SoundDescription& desc = **(SoundDescriptionHandle)aDesc;
NotifyEvent(EC_BG_AUDIO_CHANGED, desc.numChannels, 0);
i = cnt;
@@ -172,10 +162,14 @@ STDMETHODIMP CQuicktimeGraph::GetDuration(LONGLONG* pDuration) *pDuration = 0;
- if(!m_wndDestFrame.theMovie) return E_UNEXPECTED;
+ if(!m_wndDestFrame.theMovie) {
+ return E_UNEXPECTED;
+ }
TimeScale ts = GetMovieTimeScale(m_wndDestFrame.theMovie);
- if(ts == 0) return E_FAIL;
+ if(ts == 0) {
+ return E_FAIL;
+ }
*pDuration = 10000i64*GetMovieDuration(m_wndDestFrame.theMovie)/ts*1000;
@@ -187,10 +181,14 @@ STDMETHODIMP CQuicktimeGraph::GetCurrentPosition(LONGLONG* pCurrent) *pCurrent = 0;
- if(!m_wndDestFrame.theMovie) return E_UNEXPECTED;
+ if(!m_wndDestFrame.theMovie) {
+ return E_UNEXPECTED;
+ }
TimeScale ts = GetMovieTimeScale(m_wndDestFrame.theMovie);
- if(ts == 0) return E_FAIL;
+ if(ts == 0) {
+ return E_FAIL;
+ }
TimeRecord tr;
*pCurrent = 10000i64*GetMovieTime(m_wndDestFrame.theMovie, &tr)/ts*1000;
@@ -201,17 +199,22 @@ STDMETHODIMP CQuicktimeGraph::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFl {
CheckPointer(pCurrent, E_POINTER);
- if(!(dwCurrentFlags&AM_SEEKING_AbsolutePositioning)) return E_INVALIDARG;
+ if(!(dwCurrentFlags&AM_SEEKING_AbsolutePositioning)) {
+ return E_INVALIDARG;
+ }
- if(!m_wndDestFrame.theMovie) return E_UNEXPECTED;
+ if(!m_wndDestFrame.theMovie) {
+ return E_UNEXPECTED;
+ }
TimeScale ts = GetMovieTimeScale(m_wndDestFrame.theMovie);
- if(ts == 0) return E_FAIL;
+ if(ts == 0) {
+ return E_FAIL;
+ }
SetMovieTimeValue(m_wndDestFrame.theMovie, (TimeValue)(*pCurrent*ts/1000/10000i64));
- if(!m_wndDestFrame.theMC)
- {
+ if(!m_wndDestFrame.theMC) {
UpdateMovie(m_wndDestFrame.theMovie);
MoviesTask(m_wndDestFrame.theMovie, 0L);
}
@@ -232,8 +235,9 @@ STDMETHODIMP CQuicktimeGraph::GetRate(double* pdRate) // IVideoWindow
STDMETHODIMP CQuicktimeGraph::SetWindowPosition(long Left, long Top, long Width, long Height)
{
- if(IsWindow(m_wndWindowFrame.m_hWnd))
+ if(IsWindow(m_wndWindowFrame.m_hWnd)) {
m_wndWindowFrame.MoveWindow(Left, Top, Width, Height);
+ }
return S_OK;
}
@@ -241,12 +245,10 @@ STDMETHODIMP CQuicktimeGraph::SetWindowPosition(long Left, long Top, long Width, // IBasicVideo
STDMETHODIMP CQuicktimeGraph::SetDestinationPosition(long Left, long Top, long Width, long Height)// {return E_NOTIMPL;}
{
- if(!m_pQTAP && IsWindow(m_wndDestFrame.m_hWnd))
- {
+ if(!m_pQTAP && IsWindow(m_wndDestFrame.m_hWnd)) {
m_wndDestFrame.MoveWindow(Left, Top, Width, Height);
- if(m_wndDestFrame.theMC)
- {
+ if(m_wndDestFrame.theMC) {
Rect bounds = {0,0,(short)Height,(short)Width};
MCPositionController(m_wndDestFrame.theMC, &bounds, NULL, mcTopLeftMovie|mcScaleMovieToFit);
}
@@ -256,7 +258,9 @@ STDMETHODIMP CQuicktimeGraph::SetDestinationPosition(long Left, long Top, long W }
STDMETHODIMP CQuicktimeGraph::GetVideoSize(long* pWidth, long* pHeight)
{
- if(!pWidth || !pHeight) return E_POINTER;
+ if(!pWidth || !pHeight) {
+ return E_POINTER;
+ }
*pWidth = m_wndDestFrame.m_size.cx;
*pHeight = m_wndDestFrame.m_size.cy;
@@ -267,8 +271,7 @@ STDMETHODIMP CQuicktimeGraph::GetVideoSize(long* pWidth, long* pHeight) // IBasicAudio
STDMETHODIMP CQuicktimeGraph::put_Volume(long lVolume)
{
- if(m_wndDestFrame.theMovie)
- {
+ if(m_wndDestFrame.theMovie) {
lVolume = (lVolume == -10000) ? 0 : (int)pow(10.0, (double)lVolume/4152.41 + 2.41);
SetMovieVolume(m_wndDestFrame.theMovie, (short)max(min(lVolume, 256), 0));
return S_OK;
@@ -280,8 +283,7 @@ STDMETHODIMP CQuicktimeGraph::get_Volume(long* plVolume) {
CheckPointer(plVolume, E_POINTER);
- if(m_wndDestFrame.theMovie)
- {
+ if(m_wndDestFrame.theMovie) {
long lVolume = (long)GetMovieVolume(m_wndDestFrame.theMovie);
*plVolume = (int)((log10(1.0*lVolume)-2.41)*4152.41);
*plVolume = max(min(*plVolume, 0), -10000);
@@ -294,9 +296,15 @@ STDMETHODIMP CQuicktimeGraph::get_Volume(long* plVolume) // IVideoFrameStep
STDMETHODIMP CQuicktimeGraph::Step(DWORD dwFrames, IUnknown* pStepObject)
{
- if(pStepObject) return E_INVALIDARG;
- if(dwFrames == 0) return S_OK;
- if(!m_wndDestFrame.theMovie) return E_UNEXPECTED;
+ if(pStepObject) {
+ return E_INVALIDARG;
+ }
+ if(dwFrames == 0) {
+ return S_OK;
+ }
+ if(!m_wndDestFrame.theMovie) {
+ return E_UNEXPECTED;
+ }
// w/o m_wndDestFrame.theMC
@@ -304,21 +312,25 @@ STDMETHODIMP CQuicktimeGraph::Step(DWORD dwFrames, IUnknown* pStepObject) TimeValue myCurrTime = GetMovieTime(m_wndDestFrame.theMovie, NULL);
Fixed theRate = (int)dwFrames > 0 ? 0x00010000 : 0xffff0000;
- for(int nSteps = abs((int)dwFrames); nSteps > 0; nSteps--)
- {
+ for(int nSteps = abs((int)dwFrames); nSteps > 0; nSteps--) {
TimeValue myNextTime;
GetMovieNextInterestingTime(m_wndDestFrame.theMovie, nextTimeStep, 1, myTypes, myCurrTime, theRate, &myNextTime, NULL);
- if(GetMoviesError() != noErr) return E_FAIL;
+ if(GetMoviesError() != noErr) {
+ return E_FAIL;
+ }
myCurrTime = myNextTime;
}
- if(myCurrTime >= 0 && myCurrTime < GetMovieDuration(m_wndDestFrame.theMovie))
- {
+ if(myCurrTime >= 0 && myCurrTime < GetMovieDuration(m_wndDestFrame.theMovie)) {
SetMovieTimeValue(m_wndDestFrame.theMovie, myCurrTime);
- if(GetMoviesError() != noErr) return E_FAIL;
+ if(GetMoviesError() != noErr) {
+ return E_FAIL;
+ }
// the rest is not needed when we also have m_wndDestFrame.theMC:
UpdateMovie(m_wndDestFrame.theMovie);
- if(GetMoviesError() != noErr) return E_FAIL;
+ if(GetMoviesError() != noErr) {
+ return E_FAIL;
+ }
MoviesTask(m_wndDestFrame.theMovie, 0L);
}
@@ -367,8 +379,9 @@ CQuicktimeWindow::CQuicktimeWindow(CQuicktimeGraph* pGraph) void CQuicktimeWindow::ProcessMovieEvent(unsigned int message, unsigned int wParam, long lParam)
{
if(message >= WM_MOUSEFIRST && message <= WM_MOUSELAST
- || message >= WM_KEYFIRST && message <= WM_KEYLAST)
+ || message >= WM_KEYFIRST && message <= WM_KEYLAST) {
return;
+ }
// Convert the Windows event to a QTML event
MSG theMsg;
@@ -392,14 +405,11 @@ void CQuicktimeWindow::ProcessMovieEvent(unsigned int message, unsigned int wPar LRESULT CQuicktimeWindow::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
- if(message == WM_ERASEBKGND)
- {
+ if(message == WM_ERASEBKGND) {
LRESULT theResult = __super::WindowProc(message, wParam, lParam);
ProcessMovieEvent(message, wParam, lParam);
return theResult;
- }
- else
- {
+ } else {
ProcessMovieEvent(message, wParam, lParam);
return __super::WindowProc(message, wParam, lParam);
}
@@ -408,13 +418,16 @@ LRESULT CQuicktimeWindow::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) OSErr CQuicktimeWindow::MyMovieDrawingCompleteProc(Movie theMovie, long refCon)
{
CQuicktimeWindow* pQW = (CQuicktimeWindow*)refCon;
- if(!pQW) return noErr;
+ if(!pQW) {
+ return noErr;
+ }
CQuicktimeGraph* pGraph = pQW->m_pGraph;
- if(!pGraph) return noErr;
+ if(!pGraph) {
+ return noErr;
+ }
- if(CComQIPtr<IQTVideoSurface> pQTVS = (IUnknown*)(INonDelegatingUnknown*)pGraph)
- {
+ if(CComQIPtr<IQTVideoSurface> pQTVS = (IUnknown*)(INonDelegatingUnknown*)pGraph) {
BITMAP bm;
pQW->m_bm.GetObject(sizeof(bm), &bm);
bm.bmWidth = pQW->m_size.cx;
@@ -435,19 +448,18 @@ bool CQuicktimeWindow::OpenMovie(CString fn) CComQIPtr<IQTVideoSurface> pQTVS = (IUnknown*)(INonDelegatingUnknown*)m_pGraph;
- if(!pQTVS)
- {
+ if(!pQTVS) {
// Set the port
SetGWorld((CGrafPtr)GetHWNDPort(m_hWnd), NULL);
}
- if(fn.Find(_T("://")) > 0)
- {
+ if(fn.Find(_T("://")) > 0) {
Handle myHandle = NULL;
Size mySize = fn.GetLength()+1;
myHandle = NewHandleClear(mySize);
- if(!myHandle)
+ if(!myHandle) {
return(false);
+ }
BlockMove((LPSTR)(LPCSTR)CStringA(fn), *myHandle, mySize);
@@ -455,12 +467,13 @@ bool CQuicktimeWindow::OpenMovie(CString fn) DisposeHandle(myHandle);
- if(err != noErr) return(false);
- }
- else
- {
- if(!(fn.GetLength() > 0 && fn.GetLength() < 255))
+ if(err != noErr) {
+ return(false);
+ }
+ } else {
+ if(!(fn.GetLength() > 0 && fn.GetLength() < 255)) {
return(false);
+ }
CHAR buff[_MAX_PATH] = {0, 0};
#ifdef UNICODE
@@ -477,12 +490,13 @@ bool CQuicktimeWindow::OpenMovie(CString fn) // Open the movie file
short movieResFile;
OSErr err = OpenMovieFile(&sfFile, &movieResFile, fsRdPerm);
- if(err == noErr)
- {
+ if(err == noErr) {
err = NewMovieFromFile(&theMovie, movieResFile, 0, 0, newMovieActive, 0);
CloseMovieFile(movieResFile);
}
- if(err != noErr) return(false);
+ if(err != noErr) {
+ return(false);
+ }
}
Rect rect;
@@ -494,23 +508,18 @@ bool CQuicktimeWindow::OpenMovie(CString fn) Rect nrect;
GetMovieNaturalBoundsRect(theMovie, &nrect);
- if(!pQTVS)
- {
+ if(!pQTVS) {
theMC = NewMovieController(theMovie, &rect, mcTopLeftMovie|mcNotVisible);
- }
- else if(m_size.cx > 0 && m_size.cy > 0)
- {
+ } else if(m_size.cx > 0 && m_size.cy > 0) {
SetMovieDrawingCompleteProc(theMovie,
movieDrawingCallWhenChanged,//|movieDrawingCallAlways,
MyMovieDrawingCompleteProc, (long)this);
- if(CDC* pDC = GetDC())
- {
+ if(CDC* pDC = GetDC()) {
m_dc.CreateCompatibleDC(pDC);
ReleaseDC(pDC);
- struct
- {
+ struct {
BITMAPINFOHEADER bmiHeader;
long bmiColors[256];
} bmi;
@@ -550,22 +559,29 @@ bool CQuicktimeWindow::OpenMovie(CString fn) void CQuicktimeWindow::CloseMovie()
{
- if(theMC) DisposeMovieController(theMC), theMC = NULL;
- if(theMovie) DisposeMovie(theMovie), theMovie = NULL;
+ if(theMC) {
+ DisposeMovieController(theMC), theMC = NULL;
+ }
+ if(theMovie) {
+ DisposeMovie(theMovie), theMovie = NULL;
+ }
m_size.SetSize(0, 0);
m_fs = State_Stopped;
- if(m_offscreenGWorld) DisposeGWorld(m_offscreenGWorld), m_offscreenGWorld = NULL;
+ if(m_offscreenGWorld) {
+ DisposeGWorld(m_offscreenGWorld), m_offscreenGWorld = NULL;
+ }
m_dc.DeleteDC();
m_bm.DeleteObject();
}
void CQuicktimeWindow::Run()
{
- if(theMovie)
- {
+ if(theMovie) {
StartMovie(theMovie);
- if(!m_idEndPoller) m_idEndPoller = SetTimer(1, 10, NULL); // 10ms -> 100fps max
+ if(!m_idEndPoller) {
+ m_idEndPoller = SetTimer(1, 10, NULL); // 10ms -> 100fps max
+ }
}
m_fs = State_Running;
@@ -573,10 +589,11 @@ void CQuicktimeWindow::Run() void CQuicktimeWindow::Pause()
{
- if(theMovie)
- {
+ if(theMovie) {
StopMovie(theMovie);
- if(m_idEndPoller) KillTimer(m_idEndPoller), m_idEndPoller = 0;
+ if(m_idEndPoller) {
+ KillTimer(m_idEndPoller), m_idEndPoller = 0;
+ }
}
m_fs = State_Paused;
@@ -584,11 +601,12 @@ void CQuicktimeWindow::Pause() void CQuicktimeWindow::Stop()
{
- if(theMovie)
- {
+ if(theMovie) {
StopMovie(theMovie);
GoToBeginningOfMovie(theMovie);
- if(m_idEndPoller) KillTimer(m_idEndPoller), m_idEndPoller = 0;
+ if(m_idEndPoller) {
+ KillTimer(m_idEndPoller), m_idEndPoller = 0;
+ }
}
m_fs = State_Stopped;
@@ -608,13 +626,13 @@ END_MESSAGE_MAP() int CQuicktimeWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if(__super::OnCreate(lpCreateStruct) == -1)
+ if(__super::OnCreate(lpCreateStruct) == -1) {
return -1;
+ }
CComQIPtr<IQTVideoSurface> pQTVS = (IUnknown*)(INonDelegatingUnknown*)m_pGraph;
- if(!pQTVS)
- {
+ if(!pQTVS) {
// Create GrafPort <-> HWND association
CreatePortAssociation(m_hWnd, NULL, 0);
}
@@ -631,12 +649,12 @@ void CQuicktimeWindow::OnDestroy() CComQIPtr<IQTVideoSurface> pQTVS = (IUnknown*)(INonDelegatingUnknown*)m_pGraph;
- if(!pQTVS)
- {
+ if(!pQTVS) {
// Destroy the view's GrafPort <-> HWND association
if(m_hWnd)
- if(CGrafPtr windowPort = (CGrafPtr)GetHWNDPort(m_hWnd))
+ if(CGrafPtr windowPort = (CGrafPtr)GetHWNDPort(m_hWnd)) {
DestroyPortAssociation(windowPort);
+ }
}
}
@@ -647,15 +665,11 @@ BOOL CQuicktimeWindow::OnEraseBkgnd(CDC* pDC) void CQuicktimeWindow::OnTimer(UINT_PTR nIDEvent)
{
- if(nIDEvent == m_idEndPoller && theMovie)
- {
- if(IsMovieDone(theMovie))
- {
+ if(nIDEvent == m_idEndPoller && theMovie) {
+ if(IsMovieDone(theMovie)) {
Pause();
m_pGraph->NotifyEvent(EC_COMPLETE);
- }
- else if(CComQIPtr<IQTVideoSurface> pQTVS = (IUnknown*)(INonDelegatingUnknown*)m_pGraph)
- {
+ } else if(CComQIPtr<IQTVideoSurface> pQTVS = (IUnknown*)(INonDelegatingUnknown*)m_pGraph) {
MoviesTask(theMovie, 0);
/*
long duration = 0, scale = 1000;
diff --git a/src/apps/mplayerc/QuicktimeGraph.h b/src/apps/mplayerc/QuicktimeGraph.h index 8cf9517be..412fe3a30 100644 --- a/src/apps/mplayerc/QuicktimeGraph.h +++ b/src/apps/mplayerc/QuicktimeGraph.h @@ -30,98 +30,98 @@ namespace DSObjects
{
-class CQuicktimeGraph;
+ class CQuicktimeGraph;
-class CQuicktimeWindow : public CPlayerWindow
-{
- CDC m_dc;
- CBitmap m_bm;
- QT::GWorldPtr m_offscreenGWorld;
+ class CQuicktimeWindow : public CPlayerWindow
+ {
+ CDC m_dc;
+ CBitmap m_bm;
+ QT::GWorldPtr m_offscreenGWorld;
- CQuicktimeGraph* m_pGraph;
- FILTER_STATE m_fs;
- UINT m_idEndPoller;
+ CQuicktimeGraph* m_pGraph;
+ FILTER_STATE m_fs;
+ UINT m_idEndPoller;
- static QT::OSErr MyMovieDrawingCompleteProc(QT::Movie theMovie, long refCon);
+ static QT::OSErr MyMovieDrawingCompleteProc(QT::Movie theMovie, long refCon);
- void ProcessMovieEvent(unsigned int message, unsigned int wParam, long lParam);
+ void ProcessMovieEvent(unsigned int message, unsigned int wParam, long lParam);
-protected:
- virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+ protected:
+ virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
-public:
- CQuicktimeWindow(CQuicktimeGraph* pGraph);
+ public:
+ CQuicktimeWindow(CQuicktimeGraph* pGraph);
- bool OpenMovie(CString fn);
- void CloseMovie();
+ bool OpenMovie(CString fn);
+ void CloseMovie();
- void Run(), Pause(), Stop();
- FILTER_STATE GetState();
+ void Run(), Pause(), Stop();
+ FILTER_STATE GetState();
- QT::Movie theMovie;
- QT::MovieController theMC;
- CSize m_size;
+ QT::Movie theMovie;
+ QT::MovieController theMC;
+ CSize m_size;
-public:
- DECLARE_MESSAGE_MAP()
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- afx_msg void OnDestroy();
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
- afx_msg void OnTimer(UINT_PTR nIDEvent);
-};
+ public:
+ DECLARE_MESSAGE_MAP()
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg void OnDestroy();
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ afx_msg void OnTimer(UINT_PTR nIDEvent);
+ };
-class CQuicktimeGraph : public CBaseGraph, public IVideoFrameStep
-{
-protected:
- bool m_fQtInitialized;
+ class CQuicktimeGraph : public CBaseGraph, public IVideoFrameStep
+ {
+ protected:
+ bool m_fQtInitialized;
- CPlayerWindow m_wndWindowFrame;
- CQuicktimeWindow m_wndDestFrame;
+ CPlayerWindow m_wndWindowFrame;
+ CQuicktimeWindow m_wndDestFrame;
- CComPtr<ISubPicAllocatorPresenter> m_pQTAP;
+ CComPtr<ISubPicAllocatorPresenter> m_pQTAP;
-public:
- CQuicktimeGraph(HWND hParent, HRESULT& hr);
- virtual ~CQuicktimeGraph();
+ public:
+ CQuicktimeGraph(HWND hParent, HRESULT& hr);
+ virtual ~CQuicktimeGraph();
- DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
-protected:
- // IGraphBuilder
- STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
+ protected:
+ // IGraphBuilder
+ STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
- // IMediaControl
- STDMETHODIMP Run();
- STDMETHODIMP Pause();
- STDMETHODIMP Stop();
- STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
+ // IMediaControl
+ STDMETHODIMP Run();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Stop();
+ STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
- // IMediaSeeking
- STDMETHODIMP GetDuration(LONGLONG* pDuration);
- STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
- STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
- STDMETHODIMP SetRate(double dRate);
- STDMETHODIMP GetRate(double* pdRate);
+ // IMediaSeeking
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
- // IVideoWindow
- STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
+ // IVideoWindow
+ STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
- // IBasicVideo
- STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
- STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
+ // IBasicVideo
+ STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
+ STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
- // IBasicAudio
- STDMETHODIMP put_Volume(long lVolume);
- STDMETHODIMP get_Volume(long* plVolume);
+ // IBasicAudio
+ STDMETHODIMP put_Volume(long lVolume);
+ STDMETHODIMP get_Volume(long* plVolume);
- // IVideoFrameStep
- STDMETHODIMP Step(DWORD dwFrames, IUnknown* pStepObject);
- STDMETHODIMP CanStep(long bMultiple, IUnknown* pStepObject);
- STDMETHODIMP CancelStep();
+ // IVideoFrameStep
+ STDMETHODIMP Step(DWORD dwFrames, IUnknown* pStepObject);
+ STDMETHODIMP CanStep(long bMultiple, IUnknown* pStepObject);
+ STDMETHODIMP CancelStep();
- // IGraphEngine
- STDMETHODIMP_(engine_t) GetEngine();
-};
+ // IGraphEngine
+ STDMETHODIMP_(engine_t) GetEngine();
+ };
}
diff --git a/src/apps/mplayerc/RealMediaGraph.cpp b/src/apps/mplayerc/RealMediaGraph.cpp index dab8c9773..f67479313 100644 --- a/src/apps/mplayerc/RealMediaGraph.cpp +++ b/src/apps/mplayerc/RealMediaGraph.cpp @@ -62,86 +62,98 @@ bool CRealMediaPlayer::Init() CRegKey key;
- if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, prefs + _T("\\DT_Common"), KEY_READ))
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, prefs + _T("\\DT_Common"), KEY_READ)) {
return(false);
+ }
TCHAR buff[_MAX_PATH];
ULONG len = sizeof(buff)/sizeof(buff[0]);
- if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len))
+ if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len)) {
return(false);
+ }
key.Close();
m_hRealMediaCore = LoadLibrary(CString(buff) + _T("pnen3260.dll"));
- if(!m_hRealMediaCore)
+ if(!m_hRealMediaCore) {
return(false);
+ }
m_fpCreateEngine = (FPRMCREATEENGINE)GetProcAddress(m_hRealMediaCore, "CreateEngine");
m_fpCloseEngine = (FPRMCLOSEENGINE)GetProcAddress(m_hRealMediaCore, "CloseEngine");
m_fpSetDLLAccessPath = (FPRMSETDLLACCESSPATH)GetProcAddress(m_hRealMediaCore, "SetDLLAccessPath");
- if(!m_fpCreateEngine || !m_fpCloseEngine || !m_fpSetDLLAccessPath)
+ if(!m_fpCreateEngine || !m_fpCloseEngine || !m_fpSetDLLAccessPath) {
return(false);
+ }
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, prefs, KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, prefs, KEY_READ)) {
CString dllpaths;
len = sizeof(buff)/sizeof(buff[0]);
- for(int i = 0; ERROR_SUCCESS == key.EnumKey(i, buff, &len); i++,len = sizeof(buff)/sizeof(buff[0]))
- {
+ for(int i = 0; ERROR_SUCCESS == key.EnumKey(i, buff, &len); i++,len = sizeof(buff)/sizeof(buff[0])) {
CRegKey key2;
TCHAR buff2[_MAX_PATH];
ULONG len2 = sizeof(buff2)/sizeof(buff2[0]);
if(ERROR_SUCCESS != key2.Open(HKEY_CLASSES_ROOT, prefs + _T("\\") + buff, KEY_READ)
- || ERROR_SUCCESS != key2.QueryStringValue(NULL, buff2, &len2))
+ || ERROR_SUCCESS != key2.QueryStringValue(NULL, buff2, &len2)) {
continue;
+ }
dllpaths += CString(buff) + '=' + buff2 + '|';
}
key.Close();
- if(!dllpaths.IsEmpty())
- {
+ if(!dllpaths.IsEmpty()) {
char* s = DNew char[dllpaths.GetLength()+1];
strcpy(s, CStringA(dllpaths));
- for(int i = 0, j = strlen(s); i < j; i++)
- {
- if(s[i] == '|') s[i] = '\0';
+ for(int i = 0, j = strlen(s); i < j; i++) {
+ if(s[i] == '|') {
+ s[i] = '\0';
+ }
}
m_fpSetDLLAccessPath(s);
delete [] s;
}
}
- if(PNR_OK != m_fpCreateEngine(&m_pEngine))
+ if(PNR_OK != m_fpCreateEngine(&m_pEngine)) {
return(false);
+ }
- if(PNR_OK != m_pEngine->CreatePlayer(*&m_pPlayer))
+ if(PNR_OK != m_pEngine->CreatePlayer(*&m_pPlayer)) {
return(false);
+ }
- if(!(m_pSiteManager = m_pPlayer) || !(m_pCommonClassFactory = m_pPlayer))
+ if(!(m_pSiteManager = m_pPlayer) || !(m_pCommonClassFactory = m_pPlayer)) {
return(false);
+ }
m_pAudioPlayer = m_pPlayer;
m_pAudioPlayer->AddPostMixHook(static_cast<IRMAAudioHook*>(this), FALSE, FALSE);
-// m_pVolume = m_pAudioPlayer->GetDeviceVolume();
+ // m_pVolume = m_pAudioPlayer->GetDeviceVolume();
m_pVolume = m_pAudioPlayer->GetAudioVolume();
// IRMAVolume::SetVolume has a huge latency when used via GetAudioVolume,
// but by lowering this audio pushdown thing it can get better
CComQIPtr<IRMAAudioPushdown, &IID_IRMAAudioPushdown> pAP = m_pAudioPlayer;
- if(pAP) pAP->SetAudioPushdown(300); // 100ms makes the playback sound choppy, 200ms looks ok, but for safety we set this to 300ms... :P
+ if(pAP) {
+ pAP->SetAudioPushdown(300); // 100ms makes the playback sound choppy, 200ms looks ok, but for safety we set this to 300ms... :P
+ }
CComQIPtr<IRMAErrorSinkControl, &IID_IRMAErrorSinkControl> pErrorSinkControl = m_pPlayer;
- if(pErrorSinkControl) pErrorSinkControl->AddErrorSink(static_cast<IRMAErrorSink*>(this), PNLOG_EMERG, PNLOG_INFO);
+ if(pErrorSinkControl) {
+ pErrorSinkControl->AddErrorSink(static_cast<IRMAErrorSink*>(this), PNLOG_EMERG, PNLOG_INFO);
+ }
- if(PNR_OK != m_pPlayer->AddAdviseSink(static_cast<IRMAClientAdviseSink*>(this)))
+ if(PNR_OK != m_pPlayer->AddAdviseSink(static_cast<IRMAClientAdviseSink*>(this))) {
return(false);
+ }
- if(PNR_OK != m_pPlayer->SetClientContext((IUnknown*)(INonDelegatingUnknown*)(this)))
+ if(PNR_OK != m_pPlayer->SetClientContext((IUnknown*)(INonDelegatingUnknown*)(this))) {
return(false);
+ }
// TODO
/*
@@ -175,12 +187,13 @@ bool CRealMediaPlayer::Init() void CRealMediaPlayer::Deinit()
{
- if(m_pPlayer)
- {
+ if(m_pPlayer) {
m_pPlayer->Stop();
CComQIPtr<IRMAErrorSinkControl, &IID_IRMAErrorSinkControl> pErrorSinkControl = m_pPlayer;
- if(pErrorSinkControl) pErrorSinkControl->RemoveErrorSink(static_cast<IRMAErrorSink*>(this));
+ if(pErrorSinkControl) {
+ pErrorSinkControl->RemoveErrorSink(static_cast<IRMAErrorSink*>(this));
+ }
m_pPlayer->RemoveAdviseSink(static_cast<IRMAClientAdviseSink*>(this));
@@ -196,14 +209,12 @@ void CRealMediaPlayer::Deinit() m_pPlayer = NULL;
}
- if(m_pEngine)
- {
+ if(m_pEngine) {
m_fpCloseEngine(m_pEngine);
m_pEngine.Detach();
}
- if(m_hRealMediaCore)
- {
+ if(m_hRealMediaCore) {
FreeLibrary(m_hRealMediaCore);
m_hRealMediaCore = NULL;
}
@@ -227,11 +238,11 @@ char* AllocateErrorMessage(const char* msg) {
char* errmsg = NULL;
int len = strlen(msg);
- if(len > 0)
- {
+ if(len > 0) {
errmsg = (char*)CoTaskMemAlloc(len+1);
- if (errmsg)
+ if (errmsg) {
strcpy(errmsg, msg);
+ }
}
return errmsg;
}
@@ -241,20 +252,16 @@ STDMETHODIMP CRealMediaPlayer::ErrorOccurred(const UINT8 unSeverity, const UINT3 {
char* errmsg = NULL;
- if(unSeverity < 5)
- {
- if(CComQIPtr<IRMAErrorMessages, &IID_IRMAErrorMessages> pErrorMessages = m_pPlayer)
- {
+ if(unSeverity < 5) {
+ if(CComQIPtr<IRMAErrorMessages, &IID_IRMAErrorMessages> pErrorMessages = m_pPlayer) {
CComPtr<IRMABuffer> pBuffer = pErrorMessages->GetErrorText(ulRMACode);
- if(pBuffer)
- {
+ if(pBuffer) {
char* buff = (char*)pBuffer->GetBuffer();
errmsg = AllocateErrorMessage(buff);
}
}
- if(!errmsg)
- {
+ if(!errmsg) {
errmsg = AllocateErrorMessage("RealMedia error");
TRACE("RealMedia error\n");
}
@@ -299,8 +306,9 @@ STDMETHODIMP CRealMediaPlayer::OnStop() {
m_nCurrent = 0;
m_State = State_Stopped;
- if(m_UserState != State_Stopped)
+ if(m_UserState != State_Stopped) {
m_pRMG->NotifyEvent(EC_COMPLETE);
+ }
return PNR_OK;
}
STDMETHODIMP CRealMediaPlayer::OnPause(UINT32 ulTime)
@@ -328,8 +336,7 @@ STDMETHODIMP CRealMediaPlayer::HandleAuthenticationRequest(IRMAAuthenticationMan {
CAuthDlg dlg;
- if(dlg.DoModal() == IDOK)
- {
+ if(dlg.DoModal() == IDOK) {
pResponse->AuthenticationRequestDone(
PNR_OK, CStringA(dlg.m_username), CStringA(dlg.m_password));
return PNR_OK;
@@ -341,39 +348,42 @@ STDMETHODIMP CRealMediaPlayer::HandleAuthenticationRequest(IRMAAuthenticationMan // IRMASiteSupplier
STDMETHODIMP CRealMediaPlayer::SitesNeeded(UINT32 uRequestID, IRMAValues* pProps)
{
- if(!pProps) return PNR_INVALID_PARAMETER;
+ if(!pProps) {
+ return PNR_INVALID_PARAMETER;
+ }
- if(m_pTheSite || m_pTheSite2 || !m_hWndParent) return PNR_UNEXPECTED;
+ if(m_pTheSite || m_pTheSite2 || !m_hWndParent) {
+ return PNR_UNEXPECTED;
+ }
HRESULT hr = PNR_OK;
- if(!CreateSite(&m_pTheSite))
+ if(!CreateSite(&m_pTheSite)) {
return E_FAIL;
+ }
ULONG refc = ((IRMASite*)m_pTheSite)->AddRef();
refc = ((IRMASite*)m_pTheSite)->Release();
- if(!(m_pTheSite2 = m_pTheSite))
+ if(!(m_pTheSite2 = m_pTheSite)) {
return E_NOINTERFACE;
+ }
CComQIPtr<IRMAValues, &IID_IRMAValues> pSiteProps = m_pTheSite;
- if(!pSiteProps)
+ if(!pSiteProps) {
return E_NOINTERFACE;
+ }
IRMABuffer* pValue;
// no idea what these supposed to do... but they were in the example
hr = pProps->GetPropertyCString("playto", pValue);
- if(PNR_OK == hr)
- {
+ if(PNR_OK == hr) {
pSiteProps->SetPropertyCString("channel", pValue);
pValue->Release();
- }
- else
- {
+ } else {
hr = pProps->GetPropertyCString("name", pValue);
- if(PNR_OK == hr)
- {
+ if(PNR_OK == hr) {
pSiteProps->SetPropertyCString("LayoutGroup", pValue);
pValue->Release();
}
@@ -382,8 +392,9 @@ STDMETHODIMP CRealMediaPlayer::SitesNeeded(UINT32 uRequestID, IRMAValues* pProps m_pTheSite2->AddPassiveSiteWatcher(static_cast<IRMAPassiveSiteWatcher*>(this));
hr = m_pSiteManager->AddSite(m_pTheSite);
- if(PNR_OK != hr)
+ if(PNR_OK != hr) {
return hr;
+ }
m_CreatedSites[uRequestID] = m_pTheSite;
@@ -393,8 +404,9 @@ STDMETHODIMP CRealMediaPlayer::SitesNeeded(UINT32 uRequestID, IRMAValues* pProps STDMETHODIMP CRealMediaPlayer::SitesNotNeeded(UINT32 uRequestID)
{
IRMASite* pSite;
- if(!m_CreatedSites.Lookup(uRequestID, pSite))
+ if(!m_CreatedSites.Lookup(uRequestID, pSite)) {
return PNR_INVALID_PARAMETER;
+ }
m_CreatedSites.RemoveKey(uRequestID);
@@ -415,8 +427,7 @@ STDMETHODIMP CRealMediaPlayer::BeginChangeLayout() }
STDMETHODIMP CRealMediaPlayer::DoneChangeLayout()
{
- if(m_fVideoSizeChanged)
- {
+ if(m_fVideoSizeChanged) {
m_pRMG->NotifyEvent(EC_VIDEO_SIZE_CHANGED, MAKELPARAM(m_VideoSize.cx, m_VideoSize.cy), 0);
m_fVideoSizeChanged = false;
}
@@ -431,8 +442,7 @@ STDMETHODIMP CRealMediaPlayer::PositionChanged(PNxPoint* pos) }
STDMETHODIMP CRealMediaPlayer::SizeChanged(PNxSize* size)
{
- if(m_VideoSize.cx == 0 || m_VideoSize.cy == 0)
- {
+ if(m_VideoSize.cx == 0 || m_VideoSize.cy == 0) {
m_fVideoSizeChanged = true;
m_VideoSize.cx = size->cx;
m_VideoSize.cy = size->cy;
@@ -459,12 +469,14 @@ CRealMediaPlayerWindowed::CRealMediaPlayerWindowed(HWND hWndParent, CRealMediaGr : CRealMediaPlayer(hWndParent, pRMG)
{
if(!m_wndWindowFrame.CreateEx(WS_EX_NOPARENTNOTIFY, NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_VISIBLE,
- CRect(0, 0, 0, 0), CWnd::FromHandle(m_hWndParent), 0, NULL))
+ CRect(0, 0, 0, 0), CWnd::FromHandle(m_hWndParent), 0, NULL)) {
return;
+ }
if(!m_wndDestFrame.Create(NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
- CRect(0, 0, 0, 0), &m_wndWindowFrame, 0, NULL))
+ CRect(0, 0, 0, 0), &m_wndWindowFrame, 0, NULL)) {
return;
+ }
}
CRealMediaPlayerWindowed::~CRealMediaPlayerWindowed()
@@ -475,17 +487,18 @@ CRealMediaPlayerWindowed::~CRealMediaPlayerWindowed() void CRealMediaPlayerWindowed::SetWindowRect(CRect r)
{
- if(IsWindow(m_wndWindowFrame.m_hWnd))
+ if(IsWindow(m_wndWindowFrame.m_hWnd)) {
m_wndWindowFrame.MoveWindow(r);
+ }
}
void CRealMediaPlayerWindowed::SetDestRect(CRect r)
{
- if(IsWindow(m_wndDestFrame.m_hWnd))
+ if(IsWindow(m_wndDestFrame.m_hWnd)) {
m_wndDestFrame.MoveWindow(r);
+ }
- if(m_pTheSite)
- {
+ if(m_pTheSite) {
PNxSize s = {r.Width(), r.Height()};
m_pTheSite->SetSize(s);
}
@@ -493,17 +506,22 @@ void CRealMediaPlayerWindowed::SetDestRect(CRect r) bool CRealMediaPlayerWindowed::CreateSite(IRMASite** ppSite)
{
- if(!ppSite)
+ if(!ppSite) {
return(false);
+ }
CComPtr<IRMASiteWindowed> pSiteWindowed;
- if(PNR_OK != m_pCommonClassFactory->CreateInstance(CLSID_IRMASiteWindowed, (void**)&pSiteWindowed))
+ if(PNR_OK != m_pCommonClassFactory->CreateInstance(CLSID_IRMASiteWindowed, (void**)&pSiteWindowed)) {
return(false);
+ }
DWORD style = WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN;
- if(!AfxGetAppSettings().fIntRealMedia) style |= WS_DISABLED;
- if(PNR_OK != pSiteWindowed->Create(m_wndDestFrame.m_hWnd, style))
+ if(!AfxGetAppSettings().fIntRealMedia) {
+ style |= WS_DISABLED;
+ }
+ if(PNR_OK != pSiteWindowed->Create(m_wndDestFrame.m_hWnd, style)) {
return(false);
+ }
*ppSite = CComQIPtr<IRMASite, &IID_IRMASite>(pSiteWindowed).Detach();
return !!(*ppSite);
@@ -511,8 +529,9 @@ bool CRealMediaPlayerWindowed::CreateSite(IRMASite** ppSite) void CRealMediaPlayerWindowed::DestroySite(IRMASite* pSite)
{
- if(CComQIPtr<IRMASiteWindowed, &IID_IRMASiteWindowed> pRMASiteWindowed = pSite)
+ if(CComQIPtr<IRMASiteWindowed, &IID_IRMASiteWindowed> pRMASiteWindowed = pSite) {
pRMASiteWindowed->Destroy();
+ }
}
//
// CRealMediaPlayerWindowless
@@ -524,17 +543,18 @@ CRealMediaPlayerWindowless::CRealMediaPlayerWindowless(HWND hWndParent, CRealMed AppSettings& s = AfxGetAppSettings();
bool bFullscreen = (AfxGetApp()->m_pMainWnd != NULL) && (((CMainFrame*)AfxGetApp()->m_pMainWnd)->IsD3DFullScreenMode());
- switch(s.iRMVideoRendererType)
- {
- default:
- case VIDRNDT_RM_DX7:
- if(FAILED(CreateAP7(CLSID_RM7AllocatorPresenter, hWndParent, &m_pRMAP)))
- return;
- break;
- case VIDRNDT_RM_DX9:
- if(FAILED(CreateAP9(CLSID_RM9AllocatorPresenter, hWndParent, bFullscreen, &m_pRMAP)))
- return;
- break;
+ switch(s.iRMVideoRendererType) {
+ default:
+ case VIDRNDT_RM_DX7:
+ if(FAILED(CreateAP7(CLSID_RM7AllocatorPresenter, hWndParent, &m_pRMAP))) {
+ return;
+ }
+ break;
+ case VIDRNDT_RM_DX9:
+ if(FAILED(CreateAP9(CLSID_RM9AllocatorPresenter, hWndParent, bFullscreen, &m_pRMAP))) {
+ return;
+ }
+ break;
}
}
@@ -553,8 +573,9 @@ STDMETHODIMP CRealMediaPlayerWindowless::NonDelegatingQueryInterface(REFIID riid bool CRealMediaPlayerWindowless::CreateSite(IRMASite** ppSite)
{
- if(!ppSite || !m_pRMAP)
+ if(!ppSite || !m_pRMAP) {
return(false);
+ }
HRESULT hr = S_OK;
@@ -562,8 +583,9 @@ bool CRealMediaPlayerWindowless::CreateSite(IRMASite** ppSite) CComPtr<IRMASiteWindowless> pSiteWindowless;
pSiteWindowless = (IRMASiteWindowless*)(pWMWlS = DNew CRealMediaWindowlessSite(hr, m_pPlayer, NULL, NULL));
- if(FAILED(hr))
+ if(FAILED(hr)) {
return(false);
+ }
pWMWlS->SetBltService(CComQIPtr<IRMAVideoSurface, &IID_IRMAVideoSurface>(m_pRMAP));
@@ -577,8 +599,7 @@ void CRealMediaPlayerWindowless::DestroySite(IRMASite* pSite) STDMETHODIMP CRealMediaPlayerWindowless::SizeChanged(PNxSize* size)
{
- if(CComQIPtr<IRMAVideoSurface, &IID_IRMAVideoSurface> pRMAVS = m_pRMAP)
- {
+ if(CComQIPtr<IRMAVideoSurface, &IID_IRMAVideoSurface> pRMAVS = m_pRMAP) {
RMABitmapInfoHeader BitmapInfo;
memset(&BitmapInfo, 0, sizeof(BitmapInfo));
BitmapInfo.biWidth = size->cx;
@@ -601,14 +622,12 @@ CRealMediaGraph::CRealMediaGraph(HWND hWndParent, HRESULT& hr) ? (CRealMediaPlayer*)DNew CRealMediaPlayerWindowed(hWndParent, this)
: (CRealMediaPlayer*)DNew CRealMediaPlayerWindowless(hWndParent, this);
- if(!m_pRMP)
- {
+ if(!m_pRMP) {
hr = E_OUTOFMEMORY;
return;
}
- if(!m_pRMP->Init())
- {
+ if(!m_pRMP->Init()) {
delete m_pRMP, m_pRMP = NULL;
hr = E_FAIL;
return;
@@ -619,8 +638,7 @@ CRealMediaGraph::CRealMediaGraph(HWND hWndParent, HRESULT& hr) CRealMediaGraph::~CRealMediaGraph()
{
- if(m_pRMP)
- {
+ if(m_pRMP) {
m_pRMP->Deinit();
m_pRMP->Release();
m_pRMP = NULL;
@@ -645,14 +663,17 @@ STDMETHODIMP CRealMediaGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPla WideCharToMultiByte(GetACP(), 0, lpcwstrFile, -1, buff, _MAX_PATH, 0, 0);
CStringA fn(buff);
- if(fn.Find("://") < 0) fn = "file://" + fn;
+ if(fn.Find("://") < 0) {
+ fn = "file://" + fn;
+ }
m_pRMP->m_unPercentComplete = 100;
ClearMessageQueue();
- if(PNR_OK != m_pRMP->m_pPlayer->OpenURL(fn))
+ if(PNR_OK != m_pRMP->m_pPlayer->OpenURL(fn)) {
return E_FAIL;
+ }
m_pRMP->m_pPlayer->Pause()/*Stop()*/; // please, don't start just yet
@@ -662,8 +683,9 @@ STDMETHODIMP CRealMediaGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPla // IMediaControl
STDMETHODIMP CRealMediaGraph::Run()
{
- if(m_pRMP->m_pPlayer->IsDone())
+ if(m_pRMP->m_pPlayer->IsDone()) {
RenderFile(m_fn, NULL);
+ }
m_pRMP->m_UserState = State_Running;
return (PNR_OK == m_pRMP->m_pPlayer->Begin()) ? S_OK : E_FAIL;
@@ -701,8 +723,9 @@ STDMETHODIMP CRealMediaGraph::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFl // IVideoWindow
STDMETHODIMP CRealMediaGraph::SetWindowPosition(long Left, long Top, long Width, long Height)
{
- if(m_pRMP)
+ if(m_pRMP) {
m_pRMP->SetWindowRect(CRect(CPoint(Left, Top), CSize(Width, Height)));
+ }
return S_OK;
}
@@ -715,7 +738,9 @@ STDMETHODIMP CRealMediaGraph::SetDestinationPosition(long Left, long Top, long W }
STDMETHODIMP CRealMediaGraph::GetVideoSize(long* pWidth, long* pHeight)
{
- if(!pWidth || !pHeight) return E_POINTER;
+ if(!pWidth || !pHeight) {
+ return E_POINTER;
+ }
*pWidth = m_pRMP->GetVideoSize().cx;
*pHeight = m_pRMP->GetVideoSize().cy;
return S_OK;
@@ -724,7 +749,9 @@ STDMETHODIMP CRealMediaGraph::GetVideoSize(long* pWidth, long* pHeight) // IBasicAudio
STDMETHODIMP CRealMediaGraph::put_Volume(long lVolume)
{
- if(!m_pRMP->m_pVolume) return E_UNEXPECTED;
+ if(!m_pRMP->m_pVolume) {
+ return E_UNEXPECTED;
+ }
UINT16 volume = (lVolume == -10000) ? 0 : (int)pow(10.0, ((double)lVolume)/5000+2);
volume = max(min(volume, 100), 0);
@@ -733,7 +760,9 @@ STDMETHODIMP CRealMediaGraph::put_Volume(long lVolume) }
STDMETHODIMP CRealMediaGraph::get_Volume(long* plVolume)
{
- if(!m_pRMP->m_pVolume) return E_UNEXPECTED;
+ if(!m_pRMP->m_pVolume) {
+ return E_UNEXPECTED;
+ }
CheckPointer(plVolume, E_POINTER);
diff --git a/src/apps/mplayerc/RealMediaGraph.h b/src/apps/mplayerc/RealMediaGraph.h index db7bbf332..e097dd478 100644 --- a/src/apps/mplayerc/RealMediaGraph.h +++ b/src/apps/mplayerc/RealMediaGraph.h @@ -49,186 +49,185 @@ namespace DSObjects
{
-class CRealMediaGraph;
+ class CRealMediaGraph;
-class CRealMediaPlayer
- : public CUnknown
- , public IRMAErrorSink
- , public IRMAClientAdviseSink
- , public IRMAAuthenticationManager
- , public IRMASiteSupplier
- , public IRMAPassiveSiteWatcher
- , public IRMAAudioHook
+ class CRealMediaPlayer
+ : public CUnknown
+ , public IRMAErrorSink
+ , public IRMAClientAdviseSink
+ , public IRMAAuthenticationManager
+ , public IRMASiteSupplier
+ , public IRMAPassiveSiteWatcher
+ , public IRMAAudioHook
-{
-protected:
- friend class CRealMediaGraph;
- CRealMediaGraph* m_pRMG; // IMPORTANT: do not ever AddRef on this from here
-
- HWND m_hWndParent;
- CSize m_VideoSize;
- bool m_fVideoSizeChanged;
-
- //
-
- DWORD m_wndStyle;
- CPlayerWindow m_wndWindowFrame, m_wndDestFrame;
-
- //
-
- FPRMCREATEENGINE m_fpCreateEngine;
- FPRMCLOSEENGINE m_fpCloseEngine;
- FPRMSETDLLACCESSPATH m_fpSetDLLAccessPath;
- HMODULE m_hRealMediaCore;
-
- CComPtr<IRMAClientEngine> m_pEngine;
- CComPtr<IRMAPlayer> m_pPlayer;
- CComQIPtr<IRMAAudioPlayer, &IID_IRMAAudioPlayer> m_pAudioPlayer;
- CComPtr<IRMAVolume> m_pVolume;
- CComQIPtr<IRMASiteManager, &IID_IRMASiteManager> m_pSiteManager;
- CComQIPtr<IRMACommonClassFactory, &IID_IRMACommonClassFactory> m_pCommonClassFactory;
-
- CComQIPtr<IRMASite, &IID_IRMASite> m_pTheSite;
- CComQIPtr<IRMASite2, &IID_IRMASite2> m_pTheSite2;
- CMap<UINT32, UINT32&, IRMASite*, IRMASite*&> m_CreatedSites;
-
- //
-
- OAFilterState m_State, m_UserState;
- REFERENCE_TIME m_nCurrent, m_nDuration;
-
- UINT16 m_unPercentComplete;
-
- //
-
-public:
- CRealMediaPlayer(HWND hWndParent, CRealMediaGraph* pRMG);
- virtual ~CRealMediaPlayer();
-
- DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
-
- bool Init();
- void Deinit();
-
- virtual CSize GetVideoSize()
{
- return(m_VideoSize);
- }
- virtual void SetWindowRect(CRect r) {}
- virtual void SetDestRect(CRect r) {}
- virtual bool CreateSite(IRMASite** pSite) = 0;
- virtual void DestroySite(IRMASite* pSite) = 0;
-
- // IRMAErrorSink
- STDMETHODIMP ErrorOccurred(const UINT8 unSeverity, const UINT32 ulRMACode, const UINT32 ulUserCode, const char* pUserString, const char* pMoreInfoURL);
-
- // IRMAClientAdviseSink
- STDMETHODIMP OnPosLength(UINT32 ulPosition, UINT32 ulLength);
- STDMETHODIMP OnPresentationOpened();
- STDMETHODIMP OnPresentationClosed();
- STDMETHODIMP OnStatisticsChanged();
- STDMETHODIMP OnPreSeek(UINT32 ulOldTime, UINT32 ulNewTime);
- STDMETHODIMP OnPostSeek(UINT32 ulOldTime, UINT32 ulNewTime);
- STDMETHODIMP OnStop();
- STDMETHODIMP OnPause(UINT32 ulTime);
- STDMETHODIMP OnBegin(UINT32 ulTime);
- STDMETHODIMP OnBuffering(UINT32 ulFlags, UINT16 unPercentComplete);
- STDMETHODIMP OnContacting(const char* pHostName);
-
- // IRMAAuthenticationManager
- STDMETHODIMP HandleAuthenticationRequest(IRMAAuthenticationManagerResponse* pResponse);
-
- // IRMASiteSupplier
- STDMETHODIMP SitesNeeded(UINT32 uRequestID, IRMAValues* pSiteProps);
- STDMETHODIMP SitesNotNeeded(UINT32 uRequestID);
- STDMETHODIMP BeginChangeLayout();
- STDMETHODIMP DoneChangeLayout();
-
- // IRMAPassiveSiteWatcher
- STDMETHODIMP PositionChanged(PNxPoint* pos);
- STDMETHODIMP SizeChanged(PNxSize* size);
-
- // IRMAAudioHook
- STDMETHODIMP OnBuffer(RMAAudioData* pAudioInData, RMAAudioData* pAudioOutData);
- STDMETHODIMP OnInit(RMAAudioFormat* pFormat);
-};
-
-class CRealMediaPlayerWindowed
- : public CRealMediaPlayer
-{
-public:
- CRealMediaPlayerWindowed(HWND hWndParent, CRealMediaGraph* pRMG);
- virtual ~CRealMediaPlayerWindowed();
+ protected:
+ friend class CRealMediaGraph;
+ CRealMediaGraph* m_pRMG; // IMPORTANT: do not ever AddRef on this from here
+
+ HWND m_hWndParent;
+ CSize m_VideoSize;
+ bool m_fVideoSizeChanged;
+
+ //
+
+ DWORD m_wndStyle;
+ CPlayerWindow m_wndWindowFrame, m_wndDestFrame;
+
+ //
+
+ FPRMCREATEENGINE m_fpCreateEngine;
+ FPRMCLOSEENGINE m_fpCloseEngine;
+ FPRMSETDLLACCESSPATH m_fpSetDLLAccessPath;
+ HMODULE m_hRealMediaCore;
+
+ CComPtr<IRMAClientEngine> m_pEngine;
+ CComPtr<IRMAPlayer> m_pPlayer;
+ CComQIPtr<IRMAAudioPlayer, &IID_IRMAAudioPlayer> m_pAudioPlayer;
+ CComPtr<IRMAVolume> m_pVolume;
+ CComQIPtr<IRMASiteManager, &IID_IRMASiteManager> m_pSiteManager;
+ CComQIPtr<IRMACommonClassFactory, &IID_IRMACommonClassFactory> m_pCommonClassFactory;
+
+ CComQIPtr<IRMASite, &IID_IRMASite> m_pTheSite;
+ CComQIPtr<IRMASite2, &IID_IRMASite2> m_pTheSite2;
+ CMap<UINT32, UINT32&, IRMASite*, IRMASite*&> m_CreatedSites;
+
+ //
+
+ OAFilterState m_State, m_UserState;
+ REFERENCE_TIME m_nCurrent, m_nDuration;
+
+ UINT16 m_unPercentComplete;
+
+ //
+
+ public:
+ CRealMediaPlayer(HWND hWndParent, CRealMediaGraph* pRMG);
+ virtual ~CRealMediaPlayer();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ bool Init();
+ void Deinit();
+
+ virtual CSize GetVideoSize() {
+ return(m_VideoSize);
+ }
+ virtual void SetWindowRect(CRect r) {}
+ virtual void SetDestRect(CRect r) {}
+ virtual bool CreateSite(IRMASite** pSite) = 0;
+ virtual void DestroySite(IRMASite* pSite) = 0;
+
+ // IRMAErrorSink
+ STDMETHODIMP ErrorOccurred(const UINT8 unSeverity, const UINT32 ulRMACode, const UINT32 ulUserCode, const char* pUserString, const char* pMoreInfoURL);
+
+ // IRMAClientAdviseSink
+ STDMETHODIMP OnPosLength(UINT32 ulPosition, UINT32 ulLength);
+ STDMETHODIMP OnPresentationOpened();
+ STDMETHODIMP OnPresentationClosed();
+ STDMETHODIMP OnStatisticsChanged();
+ STDMETHODIMP OnPreSeek(UINT32 ulOldTime, UINT32 ulNewTime);
+ STDMETHODIMP OnPostSeek(UINT32 ulOldTime, UINT32 ulNewTime);
+ STDMETHODIMP OnStop();
+ STDMETHODIMP OnPause(UINT32 ulTime);
+ STDMETHODIMP OnBegin(UINT32 ulTime);
+ STDMETHODIMP OnBuffering(UINT32 ulFlags, UINT16 unPercentComplete);
+ STDMETHODIMP OnContacting(const char* pHostName);
+
+ // IRMAAuthenticationManager
+ STDMETHODIMP HandleAuthenticationRequest(IRMAAuthenticationManagerResponse* pResponse);
+
+ // IRMASiteSupplier
+ STDMETHODIMP SitesNeeded(UINT32 uRequestID, IRMAValues* pSiteProps);
+ STDMETHODIMP SitesNotNeeded(UINT32 uRequestID);
+ STDMETHODIMP BeginChangeLayout();
+ STDMETHODIMP DoneChangeLayout();
+
+ // IRMAPassiveSiteWatcher
+ STDMETHODIMP PositionChanged(PNxPoint* pos);
+ STDMETHODIMP SizeChanged(PNxSize* size);
+
+ // IRMAAudioHook
+ STDMETHODIMP OnBuffer(RMAAudioData* pAudioInData, RMAAudioData* pAudioOutData);
+ STDMETHODIMP OnInit(RMAAudioFormat* pFormat);
+ };
+
+ class CRealMediaPlayerWindowed
+ : public CRealMediaPlayer
+ {
+ public:
+ CRealMediaPlayerWindowed(HWND hWndParent, CRealMediaGraph* pRMG);
+ virtual ~CRealMediaPlayerWindowed();
- void SetWindowRect(CRect r);
- void SetDestRect(CRect r);
+ void SetWindowRect(CRect r);
+ void SetDestRect(CRect r);
- bool CreateSite(IRMASite** pSite);
- void DestroySite(IRMASite* pSite);
-};
+ bool CreateSite(IRMASite** pSite);
+ void DestroySite(IRMASite* pSite);
+ };
-class CRealMediaPlayerWindowless
- : public CRealMediaPlayer
-{
- CComPtr<ISubPicAllocatorPresenter> m_pRMAP;
+ class CRealMediaPlayerWindowless
+ : public CRealMediaPlayer
+ {
+ CComPtr<ISubPicAllocatorPresenter> m_pRMAP;
-public:
- CRealMediaPlayerWindowless(HWND hWndParent, CRealMediaGraph* pRMG);
- virtual ~CRealMediaPlayerWindowless();
+ public:
+ CRealMediaPlayerWindowless(HWND hWndParent, CRealMediaGraph* pRMG);
+ virtual ~CRealMediaPlayerWindowless();
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- bool CreateSite(IRMASite** pSite);
- void DestroySite(IRMASite* pSite);
+ bool CreateSite(IRMASite** pSite);
+ void DestroySite(IRMASite* pSite);
- STDMETHODIMP SizeChanged(PNxSize* size);
-};
+ STDMETHODIMP SizeChanged(PNxSize* size);
+ };
-class CRealMediaGraph : public CBaseGraph
-{
- CRealMediaPlayer* m_pRMP; // TODO: access m_pRMP through a private interface
+ class CRealMediaGraph : public CBaseGraph
+ {
+ CRealMediaPlayer* m_pRMP; // TODO: access m_pRMP through a private interface
- CStringW m_fn;
+ CStringW m_fn;
-public:
- CRealMediaGraph(HWND hWndParent, HRESULT& hr); // in windowless mode IVideoWindow::* will return E_NOTIMPL, use ISubPicAllocatorPresenter instead
- virtual ~CRealMediaGraph();
+ public:
+ CRealMediaGraph(HWND hWndParent, HRESULT& hr); // in windowless mode IVideoWindow::* will return E_NOTIMPL, use ISubPicAllocatorPresenter instead
+ virtual ~CRealMediaGraph();
- DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
-protected:
- // IGraphBuilder
- STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
+ protected:
+ // IGraphBuilder
+ STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
- // IMediaControl
- STDMETHODIMP Run();
- STDMETHODIMP Pause();
- STDMETHODIMP Stop();
- STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
+ // IMediaControl
+ STDMETHODIMP Run();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Stop();
+ STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
- // IMediaSeeking
- STDMETHODIMP GetDuration(LONGLONG* pDuration);
- STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
- STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ // IMediaSeeking
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
- // IVideoWindow
- STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
+ // IVideoWindow
+ STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
- // IBasicVideo
- STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
- STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
+ // IBasicVideo
+ STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
+ STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
- // IBasicAudio
- STDMETHODIMP put_Volume(long lVolume);
- STDMETHODIMP get_Volume(long* plVolume);
+ // IBasicAudio
+ STDMETHODIMP put_Volume(long lVolume);
+ STDMETHODIMP get_Volume(long* plVolume);
- // IAMOpenProgress
- STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
+ // IAMOpenProgress
+ STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
- // IGraphEngine
- STDMETHODIMP_(engine_t) GetEngine();
-};
+ // IGraphEngine
+ STDMETHODIMP_(engine_t) GetEngine();
+ };
}
diff --git a/src/apps/mplayerc/RealMediaWindowlessSite.cpp b/src/apps/mplayerc/RealMediaWindowlessSite.cpp index 8950253d6..7fe4085bb 100644 --- a/src/apps/mplayerc/RealMediaWindowlessSite.cpp +++ b/src/apps/mplayerc/RealMediaWindowlessSite.cpp @@ -49,14 +49,12 @@ void DSObjects::ExtractRects(REGION* pRegion) pRegion->extents.right = lpRgnData->rdh.rcBound.right;
pRegion->extents.bottom = lpRgnData->rdh.rcBound.bottom;
- if(lpRgnData->rdh.nCount)
- {
+ if(lpRgnData->rdh.nCount) {
pRegion->rects = DNew PNxRect[lpRgnData->rdh.nCount];
// now extract the information.
- for(int j = 0; j < (int) lpRgnData->rdh.nCount; j++)
- {
+ for(int j = 0; j < (int) lpRgnData->rdh.nCount; j++) {
RECT* pRect = (RECT*)lpRgnData->Buffer;
pRegion->rects[j].left = pRect[j].left;
pRegion->rects[j].top = pRect[j].top;
@@ -125,8 +123,7 @@ CRealMediaWindowlessSite::CRealMediaWindowlessSite(HRESULT& hr, IUnknown* pConte hr = S_OK;
- if(!m_pContext || !m_pCCF)
- {
+ if(!m_pContext || !m_pCCF) {
hr = E_POINTER;
return;
}
@@ -137,7 +134,9 @@ CRealMediaWindowlessSite::CRealMediaWindowlessSite(HRESULT& hr, IUnknown* pConte CRealMediaWindowlessSite::~CRealMediaWindowlessSite()
{
POSITION pos = m_pChildren.GetHeadPosition();
- while(pos) DestroyChild(m_pChildren.GetNext(pos));
+ while(pos) {
+ DestroyChild(m_pChildren.GetNext(pos));
+ }
RMADestroyRegion(m_pRegion);
RMADestroyRegion(m_pRegionWithoutChildren);
@@ -161,8 +160,9 @@ void CRealMediaWindowlessSite::GetTopLeft(PNxPoint* pPoint) pPoint->x += m_position.x;
pPoint->y += m_position.y;
- if(m_pParentSite)
+ if(m_pParentSite) {
m_pParentSite->GetTopLeft(pPoint);
+ }
}
REGION* CRealMediaWindowlessSite::GetRegion()
@@ -174,8 +174,11 @@ REGION* CRealMediaWindowlessSite::GetRegion() void CRealMediaWindowlessSite::RecomputeRegion()
{
- if(m_pParentSite) m_pParentSite->RecomputeRegion();
- else InternalRecomputeRegion();
+ if(m_pParentSite) {
+ m_pParentSite->RecomputeRegion();
+ } else {
+ InternalRecomputeRegion();
+ }
}
void CRealMediaWindowlessSite::InternalRecomputeRegion()
@@ -183,10 +186,11 @@ void CRealMediaWindowlessSite::InternalRecomputeRegion() ComputeRegion();
POSITION pos = m_pChildren.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CRealMediaWindowlessSite* pSite = (CRealMediaWindowlessSite*)(IRMASite*)m_pChildren.GetNext(pos);
- if(pSite) pSite->InternalRecomputeRegion();
+ if(pSite) {
+ pSite->InternalRecomputeRegion();
+ }
}
}
@@ -194,40 +198,33 @@ void CRealMediaWindowlessSite::ComputeRegion() {
REGION* pTempRegion = NULL;
- if(m_pRegion)
- {
+ if(m_pRegion) {
pTempRegion = RMACreateRegion();
RMAUnionRegion(pTempRegion, m_pRegion, pTempRegion);
RMADestroyRegion(m_pRegion);
}
- if(m_pRegionWithoutChildren)
- {
+ if(m_pRegionWithoutChildren) {
RMADestroyRegion(m_pRegionWithoutChildren);
}
PNxPoint topleft = {0,0};
GetTopLeft(&topleft);
- if(IsSiteVisible())
- {
+ if(IsSiteVisible()) {
m_pRegionWithoutChildren = RMACreateRectRegion(topleft.x, topleft.y, topleft.x + m_size.cx, topleft.y + m_size.cy);
- if(m_pParentSite)
- {
+ if(m_pParentSite) {
RMAIntersectRegion(m_pRegionWithoutChildren, m_pParentSite->m_pRegionWithoutChildren, m_pRegionWithoutChildren);
POSITION pos = m_pParentSite->m_pChildren.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CRealMediaWindowlessSite* pSiblingSite = (CRealMediaWindowlessSite*)(IRMASite*)m_pParentSite->m_pChildren.GetNext(pos);
- if(pSiblingSite != this)
- {
+ if(pSiblingSite != this) {
INT32 zOrder;
pSiblingSite->GetZOrder(zOrder);
- if(zOrder > m_lZOrder && pSiblingSite->IsSiteVisible())
- {
+ if(zOrder > m_lZOrder && pSiblingSite->IsSiteVisible()) {
pSiblingSite->SubtractSite(m_pRegionWithoutChildren);
}
}
@@ -238,20 +235,18 @@ void CRealMediaWindowlessSite::ComputeRegion() RMAUnionRegion(m_pRegion, m_pRegionWithoutChildren, m_pRegion);
POSITION pos = m_pChildren.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CRealMediaWindowlessSite* pChildSite = (CRealMediaWindowlessSite*)(IRMASite*)m_pChildren.GetNext(pos);
- if(pChildSite->IsSiteVisible()) pChildSite->SubtractSite(m_pRegion);
+ if(pChildSite->IsSiteVisible()) {
+ pChildSite->SubtractSite(m_pRegion);
+ }
}
- }
- else
- {
+ } else {
m_pRegionWithoutChildren = RMACreateRectRegion(0,0,0,0);
m_pRegion = RMACreateRectRegion(0,0,0,0);
}
- if(pTempRegion && !RMAEqualRegion(m_pRegion, pTempRegion))
- {
+ if(pTempRegion && !RMAEqualRegion(m_pRegion, pTempRegion)) {
ForceRedraw();
}
@@ -273,32 +268,23 @@ void CRealMediaWindowlessSite::SubtractSite(REGION* pRegion) void CRealMediaWindowlessSite::UpdateZOrder(CRealMediaWindowlessSite* pUpdatedChildSite, INT32 lOldZOrder, INT32 lNewZOrder)
{
POSITION pos = m_pChildren.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CRealMediaWindowlessSite* pSite = (CRealMediaWindowlessSite*)(IRMASite*)m_pChildren.GetNext(pos);
INT32 lItsOldZOrder;
pSite->GetZOrder(lItsOldZOrder);
- if(pSite != pUpdatedChildSite)
- {
- if(lOldZOrder < lNewZOrder)
- {
- if(lItsOldZOrder >= lOldZOrder && lItsOldZOrder < lNewZOrder)
- {
+ if(pSite != pUpdatedChildSite) {
+ if(lOldZOrder < lNewZOrder) {
+ if(lItsOldZOrder >= lOldZOrder && lItsOldZOrder < lNewZOrder) {
pSite->SetInternalZOrder(lItsOldZOrder-1);
}
- }
- else
- {
- if(lItsOldZOrder >= lNewZOrder && lItsOldZOrder < lOldZOrder)
- {
+ } else {
+ if(lItsOldZOrder >= lNewZOrder && lItsOldZOrder < lOldZOrder) {
pSite->SetInternalZOrder(lItsOldZOrder+1);
}
}
- }
- else
- {
+ } else {
pSite->SetInternalZOrder(lNewZOrder);
}
}
@@ -327,13 +313,17 @@ STDMETHODIMP CRealMediaWindowlessSite::AttachUser(IRMASiteUser* /*IN*/ pUser) {
HRESULT hr = PNR_FAIL;
- if(m_pUser) return PNR_UNEXPECTED;
+ if(m_pUser) {
+ return PNR_UNEXPECTED;
+ }
- if(CComQIPtr<IRMASite, &IID_IRMASite> pOuterSite = GetOwner())
+ if(CComQIPtr<IRMASite, &IID_IRMASite> pOuterSite = GetOwner()) {
hr = pUser->AttachSite(pOuterSite);
+ }
- if(PNR_OK == hr)
+ if(PNR_OK == hr) {
m_pUser = pUser;
+ }
return hr;
}
@@ -342,12 +332,15 @@ STDMETHODIMP CRealMediaWindowlessSite::DetachUser() {
HRESULT hr = PNR_OK;
- if(!m_pUser) return PNR_UNEXPECTED;
+ if(!m_pUser) {
+ return PNR_UNEXPECTED;
+ }
hr = m_pUser->DetachSite();
- if(PNR_OK == hr)
+ if(PNR_OK == hr) {
m_pUser = NULL;
+ }
return hr;
}
@@ -356,7 +349,9 @@ STDMETHODIMP CRealMediaWindowlessSite::GetUser(REF(IRMASiteUser*) /*OUT*/ pUser) {
HRESULT hr = PNR_OK;
- if(!m_pUser) return PNR_UNEXPECTED;
+ if(!m_pUser) {
+ return PNR_UNEXPECTED;
+ }
(pUser = m_pUser)->AddRef();
@@ -370,8 +365,9 @@ STDMETHODIMP CRealMediaWindowlessSite::CreateChild(REF(IRMASite*) /*OUT*/ pChild CComPtr<IRMASite> pSite =
(IRMASite*)DNew CRealMediaWindowlessSite(hr, m_pContext, this);
- if(FAILED(hr) || !pSite)
+ if(FAILED(hr) || !pSite) {
return E_FAIL;
+ }
pChildSite = pSite.Detach();
@@ -382,8 +378,7 @@ STDMETHODIMP CRealMediaWindowlessSite::CreateChild(REF(IRMASite*) /*OUT*/ pChild STDMETHODIMP CRealMediaWindowlessSite::DestroyChild(IRMASite* /*IN*/ pChildSite)
{
- if(POSITION pos = m_pChildren.Find(pChildSite))
- {
+ if(POSITION pos = m_pChildren.Find(pChildSite)) {
m_pChildren.RemoveAt(pos);
return PNR_OK;
}
@@ -393,17 +388,22 @@ STDMETHODIMP CRealMediaWindowlessSite::DestroyChild(IRMASite* /*IN*/ pChildSite) STDMETHODIMP CRealMediaWindowlessSite::AttachWatcher(IRMASiteWatcher* /*IN*/ pWatcher)
{
- if(m_pWatcher) return PNR_UNEXPECTED;
+ if(m_pWatcher) {
+ return PNR_UNEXPECTED;
+ }
- if(m_pWatcher = pWatcher)
+ if(m_pWatcher = pWatcher) {
m_pWatcher->AttachSite((IRMASite*)this);
+ }
return PNR_OK;
}
STDMETHODIMP CRealMediaWindowlessSite::DetachWatcher()
{
- if(!m_pWatcher) return PNR_UNEXPECTED;
+ if(!m_pWatcher) {
+ return PNR_UNEXPECTED;
+ }
m_pWatcher->DetachSite();
m_pWatcher = NULL;
@@ -415,17 +415,17 @@ STDMETHODIMP CRealMediaWindowlessSite::SetPosition(PNxPoint position) {
HRESULT hr = PNR_OK;
- if(m_pWatcher)
- {
+ if(m_pWatcher) {
hr = m_pWatcher->ChangingPosition(m_position, position);
}
- if(PNR_OK == hr)
- {
+ if(PNR_OK == hr) {
m_position = position;
POSITION pos = m_pPassiveWatchers.GetHeadPosition();
- while(pos) m_pPassiveWatchers.GetNext(pos)->PositionChanged(&position);
+ while(pos) {
+ m_pPassiveWatchers.GetNext(pos)->PositionChanged(&position);
+ }
RecomputeRegion();
}
@@ -443,17 +443,17 @@ STDMETHODIMP CRealMediaWindowlessSite::SetSize(PNxSize size) {
HRESULT hr = PNR_OK;
- if(m_pWatcher)
- {
+ if(m_pWatcher) {
hr = m_pWatcher->ChangingSize(m_size, size);
}
- if(PNR_OK == hr && size.cx != 0 && size.cy != 0)
- {
+ if(PNR_OK == hr && size.cx != 0 && size.cy != 0) {
m_size = size;
POSITION pos = m_pPassiveWatchers.GetHeadPosition();
- while(pos) m_pPassiveWatchers.GetNext(pos)->SizeChanged(&size);
+ while(pos) {
+ m_pPassiveWatchers.GetNext(pos)->SizeChanged(&size);
+ }
RecomputeRegion();
}
@@ -482,8 +482,7 @@ STDMETHODIMP CRealMediaWindowlessSite::DamageRegion(PNxRegion region) STDMETHODIMP CRealMediaWindowlessSite::ForceRedraw()
{
// make sure we have a visible window and are not re-entering and we have damage
- if(!m_fInRedraw && m_fDamaged && m_fIsVisible)
- {
+ if(!m_fInRedraw && m_fDamaged && m_fIsVisible) {
m_fInRedraw = TRUE;
PNxEvent event = {RMA_SURFACE_UPDATE, NULL, (IRMAVideoSurface*)this, NULL, 0, 0};
@@ -513,19 +512,25 @@ STDMETHODIMP CRealMediaWindowlessSite::ShowSite(BOOL bShow) STDMETHODIMP_(BOOL) CRealMediaWindowlessSite::IsSiteVisible()
{
BOOL fIsVisible = m_fIsVisible;
- if(m_pParentSite) fIsVisible = fIsVisible && m_pParentSite->IsSiteVisible();
+ if(m_pParentSite) {
+ fIsVisible = fIsVisible && m_pParentSite->IsSiteVisible();
+ }
return fIsVisible;
}
STDMETHODIMP CRealMediaWindowlessSite::SetZOrder(INT32 lZOrder)
{
- if(!m_pParentSite) return PNR_UNEXPECTED;
+ if(!m_pParentSite) {
+ return PNR_UNEXPECTED;
+ }
- if(lZOrder == -1 || lZOrder >= (INT32)m_pParentSite->GetNumberOfChildSites())
+ if(lZOrder == -1 || lZOrder >= (INT32)m_pParentSite->GetNumberOfChildSites()) {
lZOrder = m_pParentSite->GetNumberOfChildSites() - 1;
+ }
- if(m_lZOrder != lZOrder)
+ if(m_lZOrder != lZOrder) {
m_pParentSite->UpdateZOrder(this, m_lZOrder, lZOrder);
+ }
m_lZOrder = lZOrder;
@@ -534,14 +539,18 @@ STDMETHODIMP CRealMediaWindowlessSite::SetZOrder(INT32 lZOrder) STDMETHODIMP CRealMediaWindowlessSite::GetZOrder(REF(INT32) lZOrder)
{
- if(!m_pParentSite) return PNR_UNEXPECTED;
+ if(!m_pParentSite) {
+ return PNR_UNEXPECTED;
+ }
lZOrder = m_lZOrder;
return PNR_OK;
}
STDMETHODIMP CRealMediaWindowlessSite::MoveSiteToTop()
{
- if(!m_pParentSite) return PNR_UNEXPECTED;
+ if(!m_pParentSite) {
+ return PNR_UNEXPECTED;
+ }
return PNR_NOTIMPL;
}
@@ -564,8 +573,7 @@ STDMETHODIMP CRealMediaWindowlessSite::AddPassiveSiteWatcher(IRMAPassiveSiteWatc STDMETHODIMP CRealMediaWindowlessSite::RemovePassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher)
{
- if(POSITION pos = m_pPassiveWatchers.Find(pWatcher))
- {
+ if(POSITION pos = m_pPassiveWatchers.Find(pWatcher)) {
m_pPassiveWatchers.RemoveAt(pos);
return PNR_OK;
}
@@ -594,14 +602,10 @@ bool CRealMediaWindowlessSite::GetBltService(IRMAVideoSurface** ppBltService) {
bool fRet = false;
- if(ppBltService)
- {
- if(m_pParentSite)
- {
+ if(ppBltService) {
+ if(m_pParentSite) {
fRet = m_pParentSite->GetBltService(ppBltService);
- }
- else if(m_pBltService)
- {
+ } else if(m_pBltService) {
(*ppBltService = m_pBltService)->AddRef();
fRet = true;
}
@@ -625,8 +629,7 @@ STDMETHODIMP CRealMediaWindowlessSite::Blt(UCHAR* /*IN*/ pImageData, RMABitmapIn STDMETHODIMP CRealMediaWindowlessSite::BeginOptimizedBlt(RMABitmapInfoHeader* /*IN*/ pBitmapInfo)
{
- if(memcmp(&m_bitmapInfo, pBitmapInfo, sizeof(RMABitmapInfoHeader)))
- {
+ if(memcmp(&m_bitmapInfo, pBitmapInfo, sizeof(RMABitmapInfoHeader))) {
memcpy(&m_bitmapInfo, pBitmapInfo, sizeof(RMABitmapInfoHeader));
// format of image has changed somehow.
@@ -655,8 +658,9 @@ STDMETHODIMP CRealMediaWindowlessSite::OptimizedBlt(UCHAR* /*IN*/ pImageBits, RE REGION* pRegion = GetRegion();
- if(!pBltService || !pRegion)
+ if(!pBltService || !pRegion) {
return PNR_UNEXPECTED;
+ }
PNxPoint origin;
memset(&origin, 0, sizeof(PNxPoint));
@@ -667,8 +671,7 @@ STDMETHODIMP CRealMediaWindowlessSite::OptimizedBlt(UCHAR* /*IN*/ pImageBits, RE adjustedDestRect.right = rDestRect.right + origin.x;
adjustedDestRect.bottom = rDestRect.bottom + origin.y;
- for(int i = 0; i < pRegion->numRects; i++)
- {
+ for(int i = 0; i < pRegion->numRects; i++) {
PNxRect* pRect = pRegion->rects+i;
// intersect the dest rect with the rect from the
@@ -708,8 +711,9 @@ STDMETHODIMP CRealMediaWindowlessSite::GetPreferredFormat(REF(RMA_COMPRESSION_TY {
CComPtr<IRMAVideoSurface> pBltService;
GetBltService(&pBltService);
- if(!pBltService)
+ if(!pBltService) {
return PNR_UNEXPECTED;
+ }
return pBltService->GetPreferredFormat(ulType);
}
diff --git a/src/apps/mplayerc/RealMediaWindowlessSite.h b/src/apps/mplayerc/RealMediaWindowlessSite.h index e508b7b30..38b4261f8 100644 --- a/src/apps/mplayerc/RealMediaWindowlessSite.h +++ b/src/apps/mplayerc/RealMediaWindowlessSite.h @@ -45,176 +45,175 @@ namespace DSObjects
{
-struct REGION
-{
- REGION() : rects(0), pOSRegion(0) {}
- long size;
- long numRects;
- PNxRect* rects;
- PNxRect extents;
- void* pOSRegion;
-};
-
-void ExtractRects(REGION* pRegion);
-REGION* RMACreateRectRegion(int left, int top, int right, int bottom);
-void RMASubtractRegion(REGION* regM, REGION* regS, REGION* regD);
-void RMAUnionRegion(REGION* reg1, REGION* reg2, REGION* regD);
-void RMAIntersectRegion(REGION* reg1, REGION* reg2, REGION* regD);
-BOOL RMAEqualRegion(REGION* reg1, REGION* reg2);
-void RMADestroyRegion(REGION* reg);
-REGION* RMACreateRegion();
-
-class CRealMediaWindowlessSite;
-
-//
-// CRealMediaVideoSurface
-//
-
-class CRealMediaWindowlessSite;
-
-class CRealMediaVideoSurface
- : public CUnknown
- , public IRMAVideoSurface
-{
- void IntersectRect(PNxRect* pRect, PNxRect* pBox, PNxRect* pRetVal);
-
-protected:
- CComPtr<IUnknown> m_pContext;
- CRealMediaWindowlessSite* m_pSiteWindowless;
- RMABitmapInfoHeader m_bitmapInfo;
- RMABitmapInfoHeader m_lastBitmapInfo;
-
-public:
- CRealMediaVideoSurface(IUnknown* pContext, CRealMediaWindowlessSite* pSiteWindowless);
- virtual ~CRealMediaVideoSurface();
-
- DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
-
- // IRMAVideoSurface
-
- STDMETHODIMP Blt(UCHAR* /*IN*/ pImageData, RMABitmapInfoHeader* /*IN*/ pBitmapInfo, REF(PNxRect) /*IN*/ inDestRect, REF(PNxRect) /*IN*/ inSrcRect);
- STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* /*IN*/ pBitmapInfo);
- STDMETHODIMP OptimizedBlt(UCHAR* /*IN*/ pImageBits, REF(PNxRect) /*IN*/ rDestRect, REF(PNxRect) /*IN*/ rSrcRect);
- STDMETHODIMP EndOptimizedBlt();
- STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
- STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
-};
-
-//
-// CRealMediaWindowlessSite
-//
-
-class CRealMediaWindowlessSite
- : public CUnknown
- , public IRMASite
- , public IRMASite2
- , public IRMASiteWindowless
- , public IRMAVideoSurface
-{
- CComQIPtr<IRMACommonClassFactory, &IID_IRMACommonClassFactory> m_pCCF;
- CComPtr<IUnknown> m_pContext;
- CComPtr<IRMAValues> m_pValues;
+ struct REGION {
+ REGION() : rects(0), pOSRegion(0) {}
+ long size;
+ long numRects;
+ PNxRect* rects;
+ PNxRect extents;
+ void* pOSRegion;
+ };
+
+ void ExtractRects(REGION* pRegion);
+ REGION* RMACreateRectRegion(int left, int top, int right, int bottom);
+ void RMASubtractRegion(REGION* regM, REGION* regS, REGION* regD);
+ void RMAUnionRegion(REGION* reg1, REGION* reg2, REGION* regD);
+ void RMAIntersectRegion(REGION* reg1, REGION* reg2, REGION* regD);
+ BOOL RMAEqualRegion(REGION* reg1, REGION* reg2);
+ void RMADestroyRegion(REGION* reg);
+ REGION* RMACreateRegion();
+
+ class CRealMediaWindowlessSite;
+
+ //
+ // CRealMediaVideoSurface
+ //
+
+ class CRealMediaWindowlessSite;
+
+ class CRealMediaVideoSurface
+ : public CUnknown
+ , public IRMAVideoSurface
+ {
+ void IntersectRect(PNxRect* pRect, PNxRect* pBox, PNxRect* pRetVal);
- CComPtr<IRMASiteUser> m_pUser;
+ protected:
+ CComPtr<IUnknown> m_pContext;
+ CRealMediaWindowlessSite* m_pSiteWindowless;
+ RMABitmapInfoHeader m_bitmapInfo;
+ RMABitmapInfoHeader m_lastBitmapInfo;
- CRealMediaWindowlessSite* m_pParentSite;
- CInterfaceList<IRMASite, &IID_IRMASite> m_pChildren;
+ public:
+ CRealMediaVideoSurface(IUnknown* pContext, CRealMediaWindowlessSite* pSiteWindowless);
+ virtual ~CRealMediaVideoSurface();
- CComPtr<IRMASiteWatcher> m_pWatcher;
- CInterfaceList<IRMAPassiveSiteWatcher, &IID_IRMAPassiveSiteWatcher> m_pPassiveWatchers;
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- PNxSize m_size;
- PNxPoint m_position;
- bool m_fDamaged, m_fInRedraw, m_fIsVisible;
- INT32 m_lZOrder;
+ // IRMAVideoSurface
+ STDMETHODIMP Blt(UCHAR* /*IN*/ pImageData, RMABitmapInfoHeader* /*IN*/ pBitmapInfo, REF(PNxRect) /*IN*/ inDestRect, REF(PNxRect) /*IN*/ inSrcRect);
+ STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* /*IN*/ pBitmapInfo);
+ STDMETHODIMP OptimizedBlt(UCHAR* /*IN*/ pImageBits, REF(PNxRect) /*IN*/ rDestRect, REF(PNxRect) /*IN*/ rSrcRect);
+ STDMETHODIMP EndOptimizedBlt();
+ STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
+ STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
+ };
+
+ //
+ // CRealMediaWindowlessSite
//
- REGION* m_pRegion;
- REGION* m_pRegionWithoutChildren;
+ class CRealMediaWindowlessSite
+ : public CUnknown
+ , public IRMASite
+ , public IRMASite2
+ , public IRMASiteWindowless
+ , public IRMAVideoSurface
+ {
+ CComQIPtr<IRMACommonClassFactory, &IID_IRMACommonClassFactory> m_pCCF;
+ CComPtr<IUnknown> m_pContext;
+ CComPtr<IRMAValues> m_pValues;
+
+ CComPtr<IRMASiteUser> m_pUser;
+
+ CRealMediaWindowlessSite* m_pParentSite;
+ CInterfaceList<IRMASite, &IID_IRMASite> m_pChildren;
+
+ CComPtr<IRMASiteWatcher> m_pWatcher;
+ CInterfaceList<IRMAPassiveSiteWatcher, &IID_IRMAPassiveSiteWatcher> m_pPassiveWatchers;
+
+ PNxSize m_size;
+ PNxPoint m_position;
+ bool m_fDamaged, m_fInRedraw, m_fIsVisible;
+ INT32 m_lZOrder;
+
+ //
+
+ REGION* m_pRegion;
+ REGION* m_pRegionWithoutChildren;
- void RecomputeRegion();
- void InternalRecomputeRegion();
- void ComputeRegion();
- void SubtractSite(REGION* pRegion);
+ void RecomputeRegion();
+ void InternalRecomputeRegion();
+ void ComputeRegion();
+ void SubtractSite(REGION* pRegion);
- void UpdateZOrder(CRealMediaWindowlessSite* pUpdatedChildSite, INT32 lOldZOrder, INT32 lNewZOrder);
- void SetInternalZOrder(INT32 lZOrder);
+ void UpdateZOrder(CRealMediaWindowlessSite* pUpdatedChildSite, INT32 lOldZOrder, INT32 lNewZOrder);
+ void SetInternalZOrder(INT32 lZOrder);
-public:
- CRealMediaWindowlessSite(HRESULT& hr, IUnknown* pContext, CRealMediaWindowlessSite* pParentSite = NULL, IUnknown* pUnkOuter = NULL);
- virtual ~CRealMediaWindowlessSite();
+ public:
+ CRealMediaWindowlessSite(HRESULT& hr, IUnknown* pContext, CRealMediaWindowlessSite* pParentSite = NULL, IUnknown* pUnkOuter = NULL);
+ virtual ~CRealMediaWindowlessSite();
- DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- void GetTopLeft(PNxPoint* pPoint);
- REGION* GetRegion();
+ void GetTopLeft(PNxPoint* pPoint);
+ REGION* GetRegion();
- // IRMASiteWindowless
+ // IRMASiteWindowless
- STDMETHODIMP EventOccurred(PNxEvent* /*IN*/ pEvent);
- STDMETHODIMP_(PNxWindow*) GetParentWindow();
+ STDMETHODIMP EventOccurred(PNxEvent* /*IN*/ pEvent);
+ STDMETHODIMP_(PNxWindow*) GetParentWindow();
- // IRMASite
+ // IRMASite
- STDMETHODIMP AttachUser(IRMASiteUser* /*IN*/ pUser);
- STDMETHODIMP DetachUser();
- STDMETHODIMP GetUser(REF(IRMASiteUser*) /*OUT*/ pUser);
+ STDMETHODIMP AttachUser(IRMASiteUser* /*IN*/ pUser);
+ STDMETHODIMP DetachUser();
+ STDMETHODIMP GetUser(REF(IRMASiteUser*) /*OUT*/ pUser);
- STDMETHODIMP CreateChild(REF(IRMASite*) /*OUT*/ pChildSite);
- STDMETHODIMP DestroyChild(IRMASite* /*IN*/ pChildSite);
+ STDMETHODIMP CreateChild(REF(IRMASite*) /*OUT*/ pChildSite);
+ STDMETHODIMP DestroyChild(IRMASite* /*IN*/ pChildSite);
- STDMETHODIMP AttachWatcher(IRMASiteWatcher* /*IN*/ pWatcher);
- STDMETHODIMP DetachWatcher();
+ STDMETHODIMP AttachWatcher(IRMASiteWatcher* /*IN*/ pWatcher);
+ STDMETHODIMP DetachWatcher();
- STDMETHODIMP SetPosition(PNxPoint position);
- STDMETHODIMP GetPosition(REF(PNxPoint) position);
- STDMETHODIMP SetSize(PNxSize size);
- STDMETHODIMP GetSize(REF(PNxSize) size);
+ STDMETHODIMP SetPosition(PNxPoint position);
+ STDMETHODIMP GetPosition(REF(PNxPoint) position);
+ STDMETHODIMP SetSize(PNxSize size);
+ STDMETHODIMP GetSize(REF(PNxSize) size);
- STDMETHODIMP DamageRect(PNxRect rect);
- STDMETHODIMP DamageRegion(PNxRegion region);
- STDMETHODIMP ForceRedraw();
+ STDMETHODIMP DamageRect(PNxRect rect);
+ STDMETHODIMP DamageRegion(PNxRegion region);
+ STDMETHODIMP ForceRedraw();
- // IRMASite2
+ // IRMASite2
- STDMETHODIMP UpdateSiteWindow(PNxWindow* /*IN*/ pWindow);
- STDMETHODIMP ShowSite(BOOL bShow);
- STDMETHODIMP_(BOOL) IsSiteVisible();
- STDMETHODIMP SetZOrder(INT32 lZOrder);
- STDMETHODIMP GetZOrder(REF(INT32) lZOrder);
- STDMETHODIMP MoveSiteToTop();
- STDMETHODIMP GetVideoSurface(REF(IRMAVideoSurface*) pSurface);
- STDMETHODIMP_(UINT32) GetNumberOfChildSites();
+ STDMETHODIMP UpdateSiteWindow(PNxWindow* /*IN*/ pWindow);
+ STDMETHODIMP ShowSite(BOOL bShow);
+ STDMETHODIMP_(BOOL) IsSiteVisible();
+ STDMETHODIMP SetZOrder(INT32 lZOrder);
+ STDMETHODIMP GetZOrder(REF(INT32) lZOrder);
+ STDMETHODIMP MoveSiteToTop();
+ STDMETHODIMP GetVideoSurface(REF(IRMAVideoSurface*) pSurface);
+ STDMETHODIMP_(UINT32) GetNumberOfChildSites();
- STDMETHODIMP AddPassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher);
- STDMETHODIMP RemovePassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher);
+ STDMETHODIMP AddPassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher);
+ STDMETHODIMP RemovePassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher);
- STDMETHODIMP SetCursor(PNxCursor cursor, REF(PNxCursor) oldCursor);
+ STDMETHODIMP SetCursor(PNxCursor cursor, REF(PNxCursor) oldCursor);
-private:
- void IntersectRect(PNxRect* pRect, PNxRect* pBox, PNxRect* pRetVal);
+ private:
+ void IntersectRect(PNxRect* pRect, PNxRect* pBox, PNxRect* pRetVal);
-protected:
- RMABitmapInfoHeader m_bitmapInfo;
- RMABitmapInfoHeader m_lastBitmapInfo;
+ protected:
+ RMABitmapInfoHeader m_bitmapInfo;
+ RMABitmapInfoHeader m_lastBitmapInfo;
- CComPtr<IRMAVideoSurface> m_pBltService;
+ CComPtr<IRMAVideoSurface> m_pBltService;
-public:
- bool GetBltService(IRMAVideoSurface** ppBltService);
- void SetBltService(IRMAVideoSurface* ppBltService);
+ public:
+ bool GetBltService(IRMAVideoSurface** ppBltService);
+ void SetBltService(IRMAVideoSurface* ppBltService);
- // IRMAVideoSurface
+ // IRMAVideoSurface
- STDMETHODIMP Blt(UCHAR* /*IN*/ pImageData, RMABitmapInfoHeader* /*IN*/ pBitmapInfo, REF(PNxRect) /*IN*/ inDestRect, REF(PNxRect) /*IN*/ inSrcRect);
- STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* /*IN*/ pBitmapInfo);
- STDMETHODIMP OptimizedBlt(UCHAR* /*IN*/ pImageBits, REF(PNxRect) /*IN*/ rDestRect, REF(PNxRect) /*IN*/ rSrcRect);
- STDMETHODIMP EndOptimizedBlt();
- STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
- STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
-};
+ STDMETHODIMP Blt(UCHAR* /*IN*/ pImageData, RMABitmapInfoHeader* /*IN*/ pBitmapInfo, REF(PNxRect) /*IN*/ inDestRect, REF(PNxRect) /*IN*/ inSrcRect);
+ STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* /*IN*/ pBitmapInfo);
+ STDMETHODIMP OptimizedBlt(UCHAR* /*IN*/ pImageBits, REF(PNxRect) /*IN*/ rDestRect, REF(PNxRect) /*IN*/ rSrcRect);
+ STDMETHODIMP EndOptimizedBlt();
+ STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
+ STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
+ };
}
diff --git a/src/apps/mplayerc/RegFilterChooserDlg.cpp b/src/apps/mplayerc/RegFilterChooserDlg.cpp index 28cf69f22..39bffd8d0 100644 --- a/src/apps/mplayerc/RegFilterChooserDlg.cpp +++ b/src/apps/mplayerc/RegFilterChooserDlg.cpp @@ -40,7 +40,9 @@ CRegFilterChooserDlg::CRegFilterChooserDlg(CWnd* pParent /*=NULL*/) CRegFilterChooserDlg::~CRegFilterChooserDlg()
{
POSITION pos = m_filters.GetHeadPosition();
- while(pos) delete m_filters.GetNext(pos);
+ while(pos) {
+ delete m_filters.GetNext(pos);
+ }
}
void CRegFilterChooserDlg::DoDataExchange(CDataExchange* pDX)
@@ -52,11 +54,9 @@ void CRegFilterChooserDlg::DoDataExchange(CDataExchange* pDX) void CRegFilterChooserDlg::AddToList(IMoniker* pMoniker)
{
CComPtr<IPropertyBag> pPB;
- if(SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
- {
+ if(SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB))) {
CComVariant var;
- if(SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
- {
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL))) {
m_list.SetItemData(
m_list.InsertItem(-1, CString(CStringW(var.bstrVal))),
(DWORD_PTR)m_monikers.AddTail(pMoniker));
@@ -81,20 +81,17 @@ BOOL CRegFilterChooserDlg::OnInitDialog() {
__super::OnInitDialog();
- BeginEnumSysDev(CLSID_LegacyAmFilterCategory, pMoniker)
- {
+ BeginEnumSysDev(CLSID_LegacyAmFilterCategory, pMoniker) {
AddToList(pMoniker);
}
EndEnumSysDev
- BeginEnumSysDev(DMOCATEGORY_VIDEO_EFFECT, pMoniker)
- {
+ BeginEnumSysDev(DMOCATEGORY_VIDEO_EFFECT, pMoniker) {
AddToList(pMoniker);
}
EndEnumSysDev
- BeginEnumSysDev(DMOCATEGORY_AUDIO_EFFECT, pMoniker)
- {
+ BeginEnumSysDev(DMOCATEGORY_AUDIO_EFFECT, pMoniker) {
AddToList(pMoniker);
}
EndEnumSysDev
@@ -125,10 +122,13 @@ void CRegFilterChooserDlg::OnBnClickedOk() CComPtr<IMoniker> pMoniker;
POSITION pos = m_list.GetFirstSelectedItemPosition();
- if(pos) pos = (POSITION)m_list.GetItemData(m_list.GetNextSelectedItem(pos));
- if(pos) pMoniker = m_monikers.GetAt(pos);
- if(pMoniker)
- {
+ if(pos) {
+ pos = (POSITION)m_list.GetItemData(m_list.GetNextSelectedItem(pos));
+ }
+ if(pos) {
+ pMoniker = m_monikers.GetAt(pos);
+ }
+ if(pMoniker) {
CFGFilterRegistry fgf(pMoniker);
FilterOverride* f = DNew FilterOverride;
f->fDisabled = false;
@@ -151,8 +151,7 @@ void CRegFilterChooserDlg::OnBnClickedButton1() OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY,
_T("DirectShow Filters (*.dll,*.ax)|*.dll;*.ax|"), this, 0);
- if(dlg.DoModal() == IDOK)
- {
+ if(dlg.DoModal() == IDOK) {
CFilterMapper2 fm2(false);
fm2.Register(dlg.GetPathName());
m_filters.AddTail(&fm2.m_filters);
@@ -164,8 +163,7 @@ void CRegFilterChooserDlg::OnBnClickedButton1() void CRegFilterChooserDlg::OnNMDblclkList2(NMHDR *pNMHDR, LRESULT *pResult)
{
- if(m_list.GetFirstSelectedItemPosition())
- {
+ if(m_list.GetFirstSelectedItemPosition()) {
OnBnClickedOk();
}
diff --git a/src/apps/mplayerc/RegFilterChooserDlg.h b/src/apps/mplayerc/RegFilterChooserDlg.h index 6128c8a16..20433e806 100644 --- a/src/apps/mplayerc/RegFilterChooserDlg.h +++ b/src/apps/mplayerc/RegFilterChooserDlg.h @@ -30,7 +30,7 @@ class CRegFilterChooserDlg : public CResizableDialog
{
-// DECLARE_DYNAMIC(CRegFilterChooserDlg)
+ // DECLARE_DYNAMIC(CRegFilterChooserDlg)
CInterfaceList<IMoniker> m_monikers;
void AddToList(IMoniker* pMoniker);
@@ -41,7 +41,7 @@ public: CList<FilterOverride*> m_filters;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_ADDREGFILTER };
CListCtrl m_list;
diff --git a/src/apps/mplayerc/SaveDlg.cpp b/src/apps/mplayerc/SaveDlg.cpp index 5c5541008..7e0c909a4 100644 --- a/src/apps/mplayerc/SaveDlg.cpp +++ b/src/apps/mplayerc/SaveDlg.cpp @@ -68,16 +68,19 @@ BOOL CSaveDlg::OnInitDialog() 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);
+ 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);
if(FAILED(pGB.CoCreateInstance(CLSID_FilterGraph)) || !(pMC = pGB) || !(pME = pGB) || !(pMS = pGB)
- || FAILED(pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0)))
- {
+ || FAILED(pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0))) {
m_report.SetWindowText(_T("Error"));
return FALSE;
}
@@ -88,34 +91,32 @@ BOOL CSaveDlg::OnInitDialog() CComPtr<IFileSourceFilter> pReader;
#if INTERNAL_SOURCEFILTER_CDDA
- if(!pReader && m_in.Mid(m_in.ReverseFind('.')+1).MakeLower() == _T("cda"))
- {
+ 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)))
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL))) {
pReader.Release();
+ }
}
#endif
#if INTERNAL_SOURCEFILTER_CDXA
- if(!pReader)
- {
+ if(!pReader) {
hr = S_OK;
CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CCDXAReader(NULL, &hr);
- if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL))) {
pReader.Release();
+ }
}
#endif
#if INTERNAL_SOURCEFILTER_VTS
- if(!pReader /*&& ext == _T("ifo")*/)
- {
+ 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)))
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL))) {
pReader.Release();
- else
- {
+ } else {
CPath pout(m_out);
pout.RenameExtension(_T(".ifo"));
CopyFile(m_in, pout, FALSE);
@@ -123,25 +124,22 @@ BOOL CSaveDlg::OnInitDialog() }
#endif
- if(!pReader)
- {
+ if(!pReader) {
hr = S_OK;
CComPtr<IUnknown> pUnk;
pUnk.CoCreateInstance(CLSID_AsyncReader);
- if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL))) {
pReader.Release();
+ }
}
- if(!pReader)
- {
+ 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
- {
+ 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)))
- {
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(hr = pReader->Load(fnw, NULL))) {
pReader.Release();
pGB->RemoveFilter(pSrc);
}
@@ -149,15 +147,13 @@ BOOL CSaveDlg::OnInitDialog() }
CComQIPtr<IBaseFilter> pSrc = pReader;
- if(FAILED(pGB->AddFilter(pSrc, fnw)))
- {
+ 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")))
- {
+ if(FAILED(pGB->AddFilter(pMid, L"StreamDriveThru"))) {
m_report.SetWindowText(_T("Error"));
return FALSE;
}
@@ -167,8 +163,7 @@ BOOL CSaveDlg::OnInitDialog() CComQIPtr<IFileSinkFilter2> pFSF = pDst;
pFSF->SetFileName(CStringW(m_out), NULL);
pFSF->SetMode(AM_FILE_OVERWRITE);
- if(FAILED(pGB->AddFilter(pDst, L"File Writer")))
- {
+ if(FAILED(pGB->AddFilter(pDst, L"File Writer"))) {
m_report.SetWindowText(_T("Error"));
return FALSE;
}
@@ -193,7 +188,9 @@ BOOL CSaveDlg::OnInitDialog() void CSaveDlg::OnBnClickedCancel()
{
- if(pMC) pMC->Stop();
+ if(pMC) {
+ pMC->Stop();
+ }
OnCancel();
}
@@ -201,17 +198,13 @@ void CSaveDlg::OnBnClickedCancel() LRESULT CSaveDlg::OnGraphNotify(WPARAM wParam, LPARAM lParam)
{
LONG evCode, evParam1, evParam2;
- while(pME && SUCCEEDED(pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0)))
- {
+ 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)
- {
+ if(EC_COMPLETE == evCode) {
EndDialog(IDOK);
- }
- else if(EC_ERRORABORT == evCode)
- {
+ } else if(EC_ERRORABORT == evCode) {
TRACE(_T("CSaveDlg::OnGraphNotify / EC_ERRORABORT, hr = %08x\n"), (HRESULT)evParam1);
m_report.SetWindowText(_T("Copying unexpectedly terminated!"));
}
@@ -222,10 +215,8 @@ LRESULT CSaveDlg::OnGraphNotify(WPARAM wParam, LPARAM lParam) void CSaveDlg::OnTimer(UINT_PTR nIDEvent)
{
- if(nIDEvent == m_nIDTimerEvent && pGB)
- {
- if(pMS)
- {
+ if(nIDEvent == m_nIDTimerEvent && pGB) {
+ if(pMS) {
CString str;
REFERENCE_TIME pos = 0, dur = 0;
pMS->GetCurrentPosition(&pos);
diff --git a/src/apps/mplayerc/SaveDlg.h b/src/apps/mplayerc/SaveDlg.h index a27536ae0..247f198d5 100644 --- a/src/apps/mplayerc/SaveDlg.h +++ b/src/apps/mplayerc/SaveDlg.h @@ -45,7 +45,7 @@ public: CSaveDlg(CString in, CString out, CWnd* pParent = NULL); // standard constructor
virtual ~CSaveDlg();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_SAVE_DLG };
CAnimateCtrl m_anim;
CProgressCtrl m_progress;
diff --git a/src/apps/mplayerc/SaveTextFileDialog.cpp b/src/apps/mplayerc/SaveTextFileDialog.cpp index bde35c6dd..791de60f8 100644 --- a/src/apps/mplayerc/SaveTextFileDialog.cpp +++ b/src/apps/mplayerc/SaveTextFileDialog.cpp @@ -38,12 +38,9 @@ CSaveTextFileDialog::CSaveTextFileDialog( lpszFilter, pParentWnd, 0, FALSE),
m_e(e)
{
- if(m_ofn.lStructSize == sizeof(OPENFILENAME))
- {
+ if(m_ofn.lStructSize == sizeof(OPENFILENAME)) {
SetTemplate(0, IDD_SAVETEXTFILEDIALOGTEMPL);
- }
- else /*if(m_ofn.lStructSize == OPENFILENAME_SIZE_VERSION_400)*/
- {
+ } else { /*if(m_ofn.lStructSize == OPENFILENAME_SIZE_VERSION_400)*/
SetTemplate(0, IDD_SAVETEXTFILEDIALOGTEMPL_400);
}
}
@@ -67,21 +64,20 @@ BOOL CSaveTextFileDialog::OnInitDialog() m_encoding.SetItemData(m_encoding.AddString(_T("Unicode 16-BE")), CTextFile::BE16);
m_encoding.SetItemData(m_encoding.AddString(_T("UTF-8")), CTextFile::UTF8);
- switch(m_e)
- {
- default:
- case CTextFile::ASCII:
- m_encoding.SetCurSel(0);
- break;
- case CTextFile::LE16:
- m_encoding.SetCurSel(1);
- break;
- case CTextFile::BE16:
- m_encoding.SetCurSel(2);
- break;
- case CTextFile::UTF8:
- m_encoding.SetCurSel(3);
- break;
+ switch(m_e) {
+ default:
+ case CTextFile::ASCII:
+ m_encoding.SetCurSel(0);
+ break;
+ case CTextFile::LE16:
+ m_encoding.SetCurSel(1);
+ break;
+ case CTextFile::BE16:
+ m_encoding.SetCurSel(2);
+ break;
+ case CTextFile::UTF8:
+ m_encoding.SetCurSel(3);
+ break;
}
return TRUE; // return TRUE unless you set the focus to a control
diff --git a/src/apps/mplayerc/SaveTextFileDialog.h b/src/apps/mplayerc/SaveTextFileDialog.h index 1c0325bcc..29ad8b56c 100644 --- a/src/apps/mplayerc/SaveTextFileDialog.h +++ b/src/apps/mplayerc/SaveTextFileDialog.h @@ -44,8 +44,7 @@ public: CComboBox m_encoding;
- CTextFile::enc GetEncoding()
- {
+ CTextFile::enc GetEncoding() {
return(m_e);
}
diff --git a/src/apps/mplayerc/SaveThumbnailsDialog.cpp b/src/apps/mplayerc/SaveThumbnailsDialog.cpp index 62ff7356d..8634ebd04 100644 --- a/src/apps/mplayerc/SaveThumbnailsDialog.cpp +++ b/src/apps/mplayerc/SaveThumbnailsDialog.cpp @@ -38,12 +38,9 @@ CSaveThumbnailsDialog::CSaveThumbnailsDialog( lpszFilter, pParentWnd, 0, FALSE),
m_rows(rows), m_cols(cols), m_width(width)
{
- if(m_ofn.lStructSize == sizeof(OPENFILENAME))
- {
+ if(m_ofn.lStructSize == sizeof(OPENFILENAME)) {
SetTemplate(0, IDD_SAVETHUMBSDIALOGTEMPL);
- }
- else /*if(m_ofn.lStructSize == OPENFILENAME_SIZE_VERSION_400)*/
- {
+ } else { /*if(m_ofn.lStructSize == OPENFILENAME_SIZE_VERSION_400)*/
SetTemplate(0, IDD_SAVETHUMBSDIALOGTEMPL_400);
}
}
diff --git a/src/apps/mplayerc/SelectMediaType.cpp b/src/apps/mplayerc/SelectMediaType.cpp index 192dc1d1f..fe4de822c 100644 --- a/src/apps/mplayerc/SelectMediaType.cpp +++ b/src/apps/mplayerc/SelectMediaType.cpp @@ -61,8 +61,7 @@ BOOL CSelectMediaType::OnInitDialog() {
CCmdUIDialog::OnInitDialog();
- for(int i = 0; i < m_guids.GetCount(); i++)
- {
+ for(int i = 0; i < m_guids.GetCount(); i++) {
m_guidsctrl.AddString(GetMediaTypeName(m_guids[i]));
}
@@ -74,8 +73,7 @@ void CSelectMediaType::OnCbnEditchangeCombo1() {
UpdateData();
int i = m_guidsctrl.FindStringExact(0, m_guidstr);
- if(i >= 0)
- {
+ if(i >= 0) {
DWORD sel = m_guidsctrl.GetEditSel();
m_guidsctrl.SetCurSel(i);
m_guidsctrl.SetEditSel(sel,sel);
diff --git a/src/apps/mplayerc/SelectMediaType.h b/src/apps/mplayerc/SelectMediaType.h index f87e38e6e..3b64b6e7e 100644 --- a/src/apps/mplayerc/SelectMediaType.h +++ b/src/apps/mplayerc/SelectMediaType.h @@ -41,7 +41,7 @@ public: GUID m_guid;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_SELECTMEDIATYPE };
CString m_guidstr;
CComboBox m_guidsctrl;
diff --git a/src/apps/mplayerc/ShaderAutoCompleteDlg.cpp b/src/apps/mplayerc/ShaderAutoCompleteDlg.cpp index d8565597a..b0b9eb9e9 100644 --- a/src/apps/mplayerc/ShaderAutoCompleteDlg.cpp +++ b/src/apps/mplayerc/ShaderAutoCompleteDlg.cpp @@ -170,15 +170,18 @@ void CShaderAutoCompleteDlg::OnLbnSelchangeList1() ::SendMessage(m_hToolTipWnd, TTM_TRACKACTIVATE, FALSE, (LPARAM)&m_ti);
int i = m_list.GetCurSel();
- if(i < 0) return;
+ if(i < 0) {
+ return;
+ }
- if(POSITION pos = (POSITION)m_list.GetItemData(i))
- {
+ if(POSITION pos = (POSITION)m_list.GetItemData(i)) {
CString str, desc;
m_inst.GetNextAssoc(pos, str, desc);
CAtlList<CString> sl;
Explode(desc, sl, '|', 2);
- if(sl.GetCount() != 2) return;
+ if(sl.GetCount() != 2) {
+ return;
+ }
_tcscpy(m_ti.lpszText, sl.RemoveTail());
CRect r;
GetWindowRect(r);
@@ -192,8 +195,7 @@ void CShaderAutoCompleteDlg::OnShowWindow(BOOL bShow, UINT nStatus) {
CResizableDialog::OnShowWindow(bShow, nStatus);
- if(!bShow)
- {
+ if(!bShow) {
::SendMessage(m_hToolTipWnd, TTM_TRACKACTIVATE, FALSE, (LPARAM)&m_ti);
}
}
diff --git a/src/apps/mplayerc/ShaderAutoCompleteDlg.h b/src/apps/mplayerc/ShaderAutoCompleteDlg.h index 14eda44e1..392572e81 100644 --- a/src/apps/mplayerc/ShaderAutoCompleteDlg.h +++ b/src/apps/mplayerc/ShaderAutoCompleteDlg.h @@ -40,7 +40,7 @@ public: CMap<CString, LPCTSTR, CString, CString> m_inst;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_SHADERAUTOCOMPLETE_DLG };
protected:
diff --git a/src/apps/mplayerc/ShaderCombineDlg.cpp b/src/apps/mplayerc/ShaderCombineDlg.cpp index 02f684e61..550c5379d 100644 --- a/src/apps/mplayerc/ShaderCombineDlg.cpp +++ b/src/apps/mplayerc/ShaderCombineDlg.cpp @@ -71,20 +71,29 @@ BOOL CShaderCombineDlg::OnInitDialog() AppSettings& s = AfxGetAppSettings();
CString str;
- if (m_bScreenSpace)
+ if (m_bScreenSpace) {
str = s.strShadercombineScreenSpace.Trim();
- else
+ } else {
str = s.strShadercombine.Trim();
+ }
CAtlList<CString> sl;
- if(!str.IsEmpty()) Explode(str, sl, '|');
+ if(!str.IsEmpty()) {
+ Explode(str, sl, '|');
+ }
POSITION pos = sl.GetHeadPosition();
- while(pos) m_list.AddString(sl.GetNext(pos));
+ while(pos) {
+ m_list.AddString(sl.GetNext(pos));
+ }
pos = s.m_shaders.GetHeadPosition();
- while(pos) m_combo.AddString(s.m_shaders.GetNext(pos).label);
- if(m_combo.GetCount()) m_combo.SetCurSel(0);
+ while(pos) {
+ m_combo.AddString(s.m_shaders.GetNext(pos).label);
+ }
+ if(m_combo.GetCount()) {
+ m_combo.SetCurSel(0);
+ }
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
@@ -96,18 +105,18 @@ void CShaderCombineDlg::OnOK() CAtlList<CString> sl;
- for(int i = 0, j = m_list.GetCount(); i < j; i++)
- {
+ for(int i = 0, j = m_list.GetCount(); i < j; i++) {
CString label;
m_list.GetText(i, label);
sl.AddTail(label);
m_labels.AddTail(label);
}
- if (m_bScreenSpace)
+ if (m_bScreenSpace) {
AfxGetAppSettings().strShadercombineScreenSpace = Implode(sl, '|');
- else
+ } else {
AfxGetAppSettings().strShadercombine = Implode(sl, '|');
+ }
__super::OnOK();
}
@@ -115,7 +124,9 @@ void CShaderCombineDlg::OnOK() void CShaderCombineDlg::OnBnClickedButton12()
{
int i = m_combo.GetCurSel();
- if(i < 0) return;
+ if(i < 0) {
+ return;
+ }
CString label;
m_combo.GetLBText(i, label);
@@ -125,17 +136,25 @@ void CShaderCombineDlg::OnBnClickedButton12() void CShaderCombineDlg::OnBnClickedButton13()
{
int i = m_list.GetCurSel();
- if(i < 0) return;
+ if(i < 0) {
+ return;
+ }
m_list.DeleteString(i);
- if(i == m_list.GetCount()) i--;
- if(i >= 0) m_list.SetCurSel(i);
+ if(i == m_list.GetCount()) {
+ i--;
+ }
+ if(i >= 0) {
+ m_list.SetCurSel(i);
+ }
}
void CShaderCombineDlg::OnBnClickedButton1()
{
int i = m_list.GetCurSel();
- if(i < 1) return;
+ if(i < 1) {
+ return;
+ }
CString label;
m_list.GetText(i, label);
@@ -148,12 +167,17 @@ void CShaderCombineDlg::OnBnClickedButton1() void CShaderCombineDlg::OnBnClickedButton11()
{
int i = m_list.GetCurSel();
- if(i < 0 || i >= m_list.GetCount()-1) return;
+ if(i < 0 || i >= m_list.GetCount()-1) {
+ return;
+ }
CString label;
m_list.GetText(i, label);
m_list.DeleteString(i);
- if(++i == m_list.GetCount()) m_list.AddString(label);
- else m_list.InsertString(i, label);
+ if(++i == m_list.GetCount()) {
+ m_list.AddString(label);
+ } else {
+ m_list.InsertString(i, label);
+ }
m_list.SetCurSel(i);
}
diff --git a/src/apps/mplayerc/ShaderCombineDlg.h b/src/apps/mplayerc/ShaderCombineDlg.h index c91c985de..90cab7fc3 100644 --- a/src/apps/mplayerc/ShaderCombineDlg.h +++ b/src/apps/mplayerc/ShaderCombineDlg.h @@ -37,7 +37,7 @@ public: CShaderCombineDlg(CAtlList<CString>& labels, CWnd* pParent, bool bScreenSpace); // standard constructor
virtual ~CShaderCombineDlg();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_SHADERCOMBINE_DLG };
protected:
diff --git a/src/apps/mplayerc/ShaderEditorDlg.cpp b/src/apps/mplayerc/ShaderEditorDlg.cpp index ecdd68253..1bbdbdc47 100644 --- a/src/apps/mplayerc/ShaderEditorDlg.cpp +++ b/src/apps/mplayerc/ShaderEditorDlg.cpp @@ -39,10 +39,10 @@ END_MESSAGE_MAP() HBRUSH CShaderLabelComboBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
- if(nCtlColor == CTLCOLOR_EDIT)
- {
- if(m_edit.GetSafeHwnd() == NULL)
+ if(nCtlColor == CTLCOLOR_EDIT) {
+ if(m_edit.GetSafeHwnd() == NULL) {
m_edit.SubclassWindow(pWnd->GetSafeHwnd());
+ }
}
return __super::OnCtlColor(pDC, pWnd, nCtlColor);
@@ -50,8 +50,9 @@ HBRUSH CShaderLabelComboBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) void CShaderLabelComboBox::OnDestroy()
{
- if(m_edit.GetSafeHwnd() != NULL)
+ if(m_edit.GetSafeHwnd() != NULL) {
m_edit.UnsubclassWindow();
+ }
__super::OnDestroy();
}
@@ -77,35 +78,32 @@ BOOL CShaderEdit::PreTranslateMessage(MSG* pMsg) && pMsg->message == WM_KEYDOWN
&& (pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN
|| pMsg->wParam == VK_PRIOR || pMsg->wParam == VK_NEXT
- || pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE))
- {
+ || pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE)) {
int i = m_acdlg.m_list.GetCurSel();
- if(pMsg->wParam == VK_RETURN && i >= 0)
- {
+ if(pMsg->wParam == VK_RETURN && i >= 0) {
CString str;
m_acdlg.m_list.GetText(i, str);
i = str.Find('(')+1;
- if(i > 0) str = str.Left(i);
+ if(i > 0) {
+ str = str.Left(i);
+ }
int nStartChar = 0, nEndChar = -1;
GetSel(nStartChar, nEndChar);
CString text;
GetWindowText(text);
- while(nStartChar > 0 && _istalnum(text.GetAt(nStartChar-1)))
+ while(nStartChar > 0 && _istalnum(text.GetAt(nStartChar-1))) {
nStartChar--;
+ }
SetSel(nStartChar, nEndChar);
ReplaceSel(str, TRUE);
- }
- else if(pMsg->wParam == VK_ESCAPE)
- {
+ } else if(pMsg->wParam == VK_ESCAPE) {
m_acdlg.ShowWindow(SW_HIDE);
return GetParent()->PreTranslateMessage(pMsg);
- }
- else
- {
+ } else {
m_acdlg.m_list.SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
}
@@ -123,8 +121,7 @@ END_MESSAGE_MAP() void CShaderEdit::OnUpdate()
{
- if(m_nIDEvent == (UINT_PTR)-1)
- {
+ if(m_nIDEvent == (UINT_PTR)-1) {
m_nIDEvent = SetTimer(1, 100, NULL);
}
@@ -132,15 +129,14 @@ void CShaderEdit::OnUpdate() int nStartChar = 0, nEndChar = -1;
GetSel(nStartChar, nEndChar);
- if(nStartChar == nEndChar)
- {
+ if(nStartChar == nEndChar) {
GetWindowText(text);
- while(nStartChar > 0 && _istalnum(text.GetAt(nStartChar-1)))
+ while(nStartChar > 0 && _istalnum(text.GetAt(nStartChar-1))) {
nStartChar--;
+ }
}
- if(nStartChar < nEndChar)
- {
+ if(nStartChar < nEndChar) {
text = text.Mid(nStartChar, nEndChar - nStartChar);
text.TrimRight('(');
text.MakeLower();
@@ -149,16 +145,16 @@ void CShaderEdit::OnUpdate() CString key, value;
POSITION pos = m_acdlg.m_inst.GetStartPosition();
- while(pos)
- {
+ while(pos) {
POSITION cur = pos;
m_acdlg.m_inst.GetNextAssoc(pos, key, value);
- if(key.Find(text) == 0)
- {
+ if(key.Find(text) == 0) {
CAtlList<CString> sl;
Explode(value, sl, '|', 2);
- if(sl.GetCount() != 2) continue;
+ if(sl.GetCount() != 2) {
+ continue;
+ }
CString name = sl.RemoveHead();
CString description = sl.RemoveHead();
int i = m_acdlg.m_list.AddString(name);
@@ -166,8 +162,7 @@ void CShaderEdit::OnUpdate() }
}
- if(m_acdlg.m_list.GetCount() > 0)
- {
+ if(m_acdlg.m_list.GetCount() > 0) {
int lineheight = GetLineHeight();
CPoint p = PosFromChar(nStartChar);
@@ -200,12 +195,12 @@ void CShaderEdit::OnKillFocus(CWnd* pNewWnd) void CShaderEdit::OnTimer(UINT_PTR nIDEvent)
{
- if(m_nIDEvent == nIDEvent)
- {
+ if(m_nIDEvent == nIDEvent) {
int nStartChar = 0, nEndChar = -1;
GetSel(nStartChar, nEndChar);
- if(nStartChar != nEndChar || m_nEndChar != nEndChar)
+ if(nStartChar != nEndChar || m_nEndChar != nEndChar) {
m_acdlg.ShowWindow(SW_HIDE);
+ }
}
__super::OnTimer(nIDEvent);
@@ -228,8 +223,9 @@ CShaderEditorDlg::~CShaderEditorDlg() BOOL CShaderEditorDlg::Create(CWnd* pParent)
{
- if(!__super::Create(IDD, pParent))
+ if(!__super::Create(IDD, pParent)) {
return FALSE;
+ }
AddAnchor(IDC_COMBO1, TOP_LEFT, TOP_RIGHT);
AddAnchor(IDC_COMBO2, TOP_RIGHT);
@@ -252,8 +248,7 @@ BOOL CShaderEditorDlg::Create(CWnd* pParent) m_targets.AddString(_T("ps_3_sw"));
POSITION pos = AfxGetAppSettings().m_shaders.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
const AppSettings::Shader& s = AfxGetAppSettings().m_shaders.GetNext(pos);
m_labels.SetItemDataPtr(m_labels.AddString(s.label), (void*)&s);
}
@@ -302,22 +297,19 @@ END_MESSAGE_MAP() BOOL CShaderEditorDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN
- && pMsg->hwnd == m_labels.m_edit.GetSafeHwnd())
- {
+ && pMsg->hwnd == m_labels.m_edit.GetSafeHwnd()) {
OnCbnSelchangeCombo1();
return TRUE;
- }
- else if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB
- && pMsg->hwnd == m_srcdata.GetSafeHwnd())
- {
+ } else if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB
+ && pMsg->hwnd == m_srcdata.GetSafeHwnd()) {
int nStartChar, nEndChar;
m_srcdata.GetSel(nStartChar, nEndChar);
- if(nStartChar == nEndChar) m_srcdata.ReplaceSel(_T("\t"));
+ if(nStartChar == nEndChar) {
+ m_srcdata.ReplaceSel(_T("\t"));
+ }
return TRUE;
- }
- else if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE)
- {
+ } else if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) {
return GetParent()->PreTranslateMessage(pMsg);
}
@@ -328,13 +320,14 @@ void CShaderEditorDlg::OnCbnSelchangeCombo1() {
int i = m_labels.GetCurSel();
- if(i < 0)
- {
+ if(i < 0) {
CString label;
m_labels.GetWindowText(label);
label.Trim();
- if(label.IsEmpty()) return;
+ if(label.IsEmpty()) {
+ return;
+ }
CStringA srcdata;
LoadResource(IDF_SHADER_EMPTY, srcdata, _T("FILE"));
@@ -364,21 +357,24 @@ void CShaderEditorDlg::OnCbnSelchangeCombo1() void CShaderEditorDlg::OnBnClickedButton2()
{
- if(!m_pShader) return;
+ if(!m_pShader) {
+ return;
+ }
- if(IDYES != AfxMessageBox(ResStr(IDS_SHADEREDITORDLG_0), MB_YESNO))
+ if(IDYES != AfxMessageBox(ResStr(IDS_SHADEREDITORDLG_0), MB_YESNO)) {
return;
+ }
AppSettings& s = AfxGetAppSettings();
- for(POSITION pos = s.m_shaders.GetHeadPosition(); pos; s.m_shaders.GetNext(pos))
- {
- if(m_pShader == &s.m_shaders.GetAt(pos))
- {
+ for(POSITION pos = s.m_shaders.GetHeadPosition(); pos; s.m_shaders.GetNext(pos)) {
+ if(m_pShader == &s.m_shaders.GetAt(pos)) {
m_pShader = NULL;
s.m_shaders.RemoveAt(pos);
int i = m_labels.GetCurSel();
- if(i >= 0) m_labels.DeleteString(i);
+ if(i >= 0) {
+ m_labels.DeleteString(i);
+ }
m_labels.SetWindowText(_T(""));
m_targets.SetWindowText(_T(""));
m_srcdata.SetWindowText(_T(""));
@@ -391,8 +387,7 @@ void CShaderEditorDlg::OnBnClickedButton2() void CShaderEditorDlg::OnTimer(UINT_PTR nIDEvent)
{
- if(nIDEvent == m_nIDEventShader && IsWindowVisible() && m_pShader)
- {
+ if(nIDEvent == m_nIDEventShader && IsWindowVisible() && m_pShader) {
CString srcdata;
m_srcdata.GetWindowText(srcdata);
srcdata.Replace(_T("\r"), _T(""));
@@ -402,20 +397,20 @@ void CShaderEditorDlg::OnTimer(UINT_PTR nIDEvent) m_targets.GetWindowText(target);
target.Trim();
- if(!srcdata.IsEmpty() && !target.IsEmpty() && (m_pShader->srcdata != srcdata || m_pShader->target != target))
- {
+ if(!srcdata.IsEmpty() && !target.IsEmpty() && (m_pShader->srcdata != srcdata || m_pShader->target != target)) {
KillTimer(m_nIDEventShader);
m_pShader->srcdata = srcdata;
m_pShader->target = target;
- if(!m_pPSC) m_pPSC = DNew CPixelShaderCompiler(NULL);
+ if(!m_pPSC) {
+ m_pPSC = DNew CPixelShaderCompiler(NULL);
+ }
CString disasm, errmsg;
HRESULT hr = m_pPSC->CompileShader(CStringA(srcdata), "main", CStringA(target), D3DXSHADER_DEBUG, NULL, &disasm, &errmsg);
- if(SUCCEEDED(hr))
- {
+ if(SUCCEEDED(hr)) {
errmsg = _T("D3DXCompileShader succeeded\n");
errmsg += _T("\n");
errmsg += disasm;
@@ -438,8 +433,7 @@ void CShaderEditorDlg::OnTimer(UINT_PTR nIDEvent) void CShaderEditorDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
- if(HitTestSplitter(point))
- {
+ if(HitTestSplitter(point)) {
m_fSplitterGrabbed = true;
SetCapture();
}
@@ -449,8 +443,7 @@ void CShaderEditorDlg::OnLButtonDown(UINT nFlags, CPoint point) void CShaderEditorDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
- if(m_fSplitterGrabbed)
- {
+ if(m_fSplitterGrabbed) {
ReleaseCapture();
m_fSplitterGrabbed = false;
}
@@ -460,8 +453,7 @@ void CShaderEditorDlg::OnLButtonUp(UINT nFlags, CPoint point) void CShaderEditorDlg::OnMouseMove(UINT nFlags, CPoint point)
{
- if(m_fSplitterGrabbed)
- {
+ if(m_fSplitterGrabbed) {
CRect r, rs, ro;
GetClientRect(&r);
m_srcdata.GetWindowRect(&rs);
@@ -493,8 +485,7 @@ BOOL CShaderEditorDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) CPoint p;
GetCursorPos(&p);
ScreenToClient(&p);
- if(HitTestSplitter(p))
- {
+ if(HitTestSplitter(p)) {
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZENS));
return TRUE;
}
diff --git a/src/apps/mplayerc/ShaderEditorDlg.h b/src/apps/mplayerc/ShaderEditorDlg.h index 41fdbe0a2..2775a4097 100644 --- a/src/apps/mplayerc/ShaderEditorDlg.h +++ b/src/apps/mplayerc/ShaderEditorDlg.h @@ -79,7 +79,7 @@ public: BOOL Create(CWnd* pParent = NULL);
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_SHADEREDITOR_DLG };
CShaderLabelComboBox m_labels;
CComboBox m_targets;
diff --git a/src/apps/mplayerc/ShockwaveGraph.cpp b/src/apps/mplayerc/ShockwaveGraph.cpp index 938c4c782..a8e8632fd 100644 --- a/src/apps/mplayerc/ShockwaveGraph.cpp +++ b/src/apps/mplayerc/ShockwaveGraph.cpp @@ -34,15 +34,13 @@ CShockwaveGraph::CShockwaveGraph(HWND hParent, HRESULT& hr) hr = S_OK;
if(!m_wndWindowFrame.Create(NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
- CRect(0, 0, 0, 0), CWnd::FromHandle(hParent), 0, NULL))
- {
+ CRect(0, 0, 0, 0), CWnd::FromHandle(hParent), 0, NULL)) {
hr = E_FAIL;
return;
}
if(!m_wndDestFrame.Create(NULL, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,
- CRect(0, 0, 0, 0), &m_wndWindowFrame, 0))
- {
+ CRect(0, 0, 0, 0), &m_wndWindowFrame, 0)) {
hr = E_FAIL;
return;
}
@@ -58,12 +56,9 @@ CShockwaveGraph::~CShockwaveGraph() // IGraphBuilder
STDMETHODIMP CShockwaveGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList)
{
- try
- {
+ try {
m_wndDestFrame.LoadMovie(0, CString(lpcwstrFile));
- }
- catch(CException* e)
- {
+ } catch(CException* e) {
e->Delete();
return E_FAIL;
}
@@ -73,32 +68,30 @@ STDMETHODIMP CShockwaveGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPla // IMediaControl
STDMETHODIMP CShockwaveGraph::Run()
{
- try
- {
+ try {
// XXX - Does the following line have some side effect
// or is the variable unused?
long scale_mode = this->m_wndDestFrame.get_ScaleMode();
- if(m_fs != State_Running) m_wndDestFrame.Play();
- }
- catch(CException* e)
- {
+ if(m_fs != State_Running) {
+ m_wndDestFrame.Play();
+ }
+ } catch(CException* e) {
e->Delete();
return E_FAIL;
}
m_fs = State_Running;
m_wndWindowFrame.EnableWindow();
-// m_wndDestFrame.EnableWindow();
+ // m_wndDestFrame.EnableWindow();
return S_OK;
}
STDMETHODIMP CShockwaveGraph::Pause()
{
- try
- {
- if(m_fs == State_Running) m_wndDestFrame.Stop();
- }
- catch(CException* e)
- {
+ try {
+ if(m_fs == State_Running) {
+ m_wndDestFrame.Stop();
+ }
+ } catch(CException* e) {
e->Delete();
return E_FAIL;
}
@@ -107,12 +100,9 @@ STDMETHODIMP CShockwaveGraph::Pause() }
STDMETHODIMP CShockwaveGraph::Stop()
{
- try
- {
+ try {
m_wndDestFrame.Stop();
- }
- catch(CException* e)
- {
+ } catch(CException* e) {
e->Delete();
return E_FAIL;
}
@@ -123,16 +113,16 @@ STDMETHODIMP CShockwaveGraph::GetState(LONG msTimeout, OAFilterState* pfs) {
OAFilterState fs = m_fs;
- try
- {
- if(m_wndDestFrame.IsPlaying() && m_fs == State_Stopped) m_fs = State_Running;
- else if(!m_wndDestFrame.IsPlaying() && m_fs == State_Running) m_fs = State_Stopped;
+ try {
+ if(m_wndDestFrame.IsPlaying() && m_fs == State_Stopped) {
+ m_fs = State_Running;
+ } else if(!m_wndDestFrame.IsPlaying() && m_fs == State_Running) {
+ m_fs = State_Stopped;
+ }
fs = m_fs;
// HACK : Make sure that the movie is running in "show all".
m_wndDestFrame.SendMessage( WM_COMMAND, MAKEWPARAM(20034, 0), 0 );
- }
- catch(CException* e)
- {
+ } catch(CException* e) {
e->Delete();
return E_FAIL;
}
@@ -153,12 +143,11 @@ STDMETHODIMP CShockwaveGraph::GetDuration(LONGLONG* pDuration) {
CheckPointer(pDuration, E_POINTER);
*pDuration = 0;
- try
- {
- if(m_wndDestFrame.get_ReadyState() >= READYSTATE_COMPLETE) *pDuration = m_wndDestFrame.get_TotalFrames();
- }
- catch(CException* e)
- {
+ try {
+ if(m_wndDestFrame.get_ReadyState() >= READYSTATE_COMPLETE) {
+ *pDuration = m_wndDestFrame.get_TotalFrames();
+ }
+ } catch(CException* e) {
e->Delete();
return E_FAIL;
}
@@ -168,12 +157,11 @@ STDMETHODIMP CShockwaveGraph::GetCurrentPosition(LONGLONG* pCurrent) {
CheckPointer(pCurrent, E_POINTER);
*pCurrent = 0;
- try
- {
- if(m_wndDestFrame.get_ReadyState() >= READYSTATE_COMPLETE) *pCurrent = m_wndDestFrame.get_FrameNum();
- }
- catch(CException* e)
- {
+ try {
+ if(m_wndDestFrame.get_ReadyState() >= READYSTATE_COMPLETE) {
+ *pCurrent = m_wndDestFrame.get_FrameNum();
+ }
+ } catch(CException* e) {
e->Delete();
return E_FAIL;
}
@@ -181,14 +169,14 @@ STDMETHODIMP CShockwaveGraph::GetCurrentPosition(LONGLONG* pCurrent) }
STDMETHODIMP CShockwaveGraph::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
{
- if(dwCurrentFlags&AM_SEEKING_AbsolutePositioning)
- {
+ if(dwCurrentFlags&AM_SEEKING_AbsolutePositioning) {
m_wndDestFrame.put_FrameNum(*pCurrent);
- if(m_fs == State_Running && !m_wndDestFrame.IsPlaying())
+ if(m_fs == State_Running && !m_wndDestFrame.IsPlaying()) {
m_wndDestFrame.Play();
- else if((m_fs == State_Paused || m_fs == State_Stopped) && m_wndDestFrame.IsPlaying())
+ } else if((m_fs == State_Paused || m_fs == State_Stopped) && m_wndDestFrame.IsPlaying()) {
m_wndDestFrame.Stop();
+ }
m_wndDestFrame.put_Quality(1); // 0=Low, 1=High, 2=AutoLow, 3=AutoHigh
@@ -201,8 +189,9 @@ STDMETHODIMP CShockwaveGraph::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFl // IVideoWindow
STDMETHODIMP CShockwaveGraph::put_Visible(long Visible)
{
- if(IsWindow(m_wndDestFrame.m_hWnd))
+ if(IsWindow(m_wndDestFrame.m_hWnd)) {
m_wndDestFrame.ShowWindow(Visible == OATRUE ? SW_SHOWNORMAL : SW_HIDE);
+ }
return S_OK;
}
STDMETHODIMP CShockwaveGraph::get_Visible(long* pVisible)
@@ -211,8 +200,9 @@ return pVisible ? *pVisible = (m_wndDestFrame.IsWindowVisible() ? OATRUE : OAFAL }
STDMETHODIMP CShockwaveGraph::SetWindowPosition(long Left, long Top, long Width, long Height)
{
- if(IsWindow(m_wndWindowFrame.m_hWnd))
+ if(IsWindow(m_wndWindowFrame.m_hWnd)) {
m_wndWindowFrame.MoveWindow(Left, Top, Width, Height);
+ }
return S_OK;
}
@@ -220,24 +210,24 @@ STDMETHODIMP CShockwaveGraph::SetWindowPosition(long Left, long Top, long Width, // IBasicVideo
STDMETHODIMP CShockwaveGraph::SetDestinationPosition(long Left, long Top, long Width, long Height)// {return E_NOTIMPL;}
{
- if(IsWindow(m_wndDestFrame.m_hWnd))
+ if(IsWindow(m_wndDestFrame.m_hWnd)) {
m_wndDestFrame.MoveWindow(Left, Top, Width, Height);
+ }
return S_OK;
}
STDMETHODIMP CShockwaveGraph::GetVideoSize(long* pWidth, long* pHeight)
{
- if(!pWidth || !pHeight) return E_POINTER;
+ if(!pWidth || !pHeight) {
+ return E_POINTER;
+ }
CRect r;
m_wndWindowFrame.GetWindowRect(r);
- if(!r.IsRectEmpty())
- {
+ if(!r.IsRectEmpty()) {
*pWidth = r.Width();
*pHeight = r.Height();
- }
- else
- {
+ } else {
// no call exists to determine these...
*pWidth = 384;//m_wndDestFrame.get_;
*pHeight = 288;
diff --git a/src/apps/mplayerc/ShockwaveGraph.h b/src/apps/mplayerc/ShockwaveGraph.h index 4cfabc639..276c87347 100644 --- a/src/apps/mplayerc/ShockwaveGraph.h +++ b/src/apps/mplayerc/ShockwaveGraph.h @@ -30,52 +30,52 @@ namespace DSObjects
{
-class CShockwaveGraph : public CBaseGraph
-{
- CPlayerWindow m_wndWindowFrame;
- CShockwaveFlash m_wndDestFrame;
-
- FILTER_STATE m_fs;
-
-public:
- CShockwaveGraph(HWND hParent, HRESULT& hr);
- virtual ~CShockwaveGraph();
-
-protected:
- // IGraphBuilder
- STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
-
- // IMediaControl
- STDMETHODIMP Run();
- STDMETHODIMP Pause();
- STDMETHODIMP Stop();
- STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
-
- // IMediaSeeking
- STDMETHODIMP IsFormatSupported(const GUID* pFormat);
- STDMETHODIMP GetTimeFormat(GUID* pFormat);
- STDMETHODIMP GetDuration(LONGLONG* pDuration);
- STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
- STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
-
- // IVideoWindow
- STDMETHODIMP put_Visible(long Visible);
- STDMETHODIMP get_Visible(long* pVisible);
- STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
-
- // IBasicVideo
- STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
- STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
-
- // IBasicAudio
- STDMETHODIMP put_Volume(long lVolume);
- STDMETHODIMP get_Volume(long* plVolume);
-
- // IAMOpenProgress
- STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
-
- // IGraphEngine
- STDMETHODIMP_(engine_t) GetEngine();
-};
+ class CShockwaveGraph : public CBaseGraph
+ {
+ CPlayerWindow m_wndWindowFrame;
+ CShockwaveFlash m_wndDestFrame;
+
+ FILTER_STATE m_fs;
+
+ public:
+ CShockwaveGraph(HWND hParent, HRESULT& hr);
+ virtual ~CShockwaveGraph();
+
+ protected:
+ // IGraphBuilder
+ STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
+
+ // IMediaControl
+ STDMETHODIMP Run();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Stop();
+ STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
+
+ // IMediaSeeking
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+
+ // IVideoWindow
+ STDMETHODIMP put_Visible(long Visible);
+ STDMETHODIMP get_Visible(long* pVisible);
+ STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
+
+ // IBasicVideo
+ STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
+ STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
+
+ // IBasicAudio
+ STDMETHODIMP put_Volume(long lVolume);
+ STDMETHODIMP get_Volume(long* plVolume);
+
+ // IAMOpenProgress
+ STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
+
+ // IGraphEngine
+ STDMETHODIMP_(engine_t) GetEngine();
+ };
}
diff --git a/src/apps/mplayerc/StaticLink.cpp b/src/apps/mplayerc/StaticLink.cpp index 5601ce9bc..75a802c58 100644 --- a/src/apps/mplayerc/StaticLink.cpp +++ b/src/apps/mplayerc/StaticLink.cpp @@ -75,12 +75,10 @@ HBRUSH CStaticLink::CtlColor(CDC* pDC, UINT nCtlColor) DWORD dwStyle = GetStyle();
HBRUSH hbr = NULL;
- if ((dwStyle & 0xFF) <= SS_RIGHT)
- {
+ if ((dwStyle & 0xFF) <= SS_RIGHT) {
// this is a text control: set up font and colors
- if (!(HFONT)m_font)
- {
+ if (!(HFONT)m_font) {
// first time init: create font
LOGFONT lf;
GetFont()->GetObject(sizeof(lf), &lf);
@@ -104,25 +102,22 @@ HBRUSH CStaticLink::CtlColor(CDC* pDC, UINT nCtlColor) //
void CStaticLink::OnLButtonDown(UINT nFlags, CPoint point)
{
- if (m_link.IsEmpty())
- {
+ if (m_link.IsEmpty()) {
// no link: try to load from resource string or window text
m_link.LoadString(GetDlgCtrlID()) || (GetWindowText(m_link),1);
- if (m_link.IsEmpty())
+ if (m_link.IsEmpty()) {
return;
+ }
}
// Call ShellExecute to run the file.
// For an URL, this means opening it in the browser.
//
HINSTANCE h = m_link.Navigate();
- if ((UINT)h > 32) // success!
- {
+ if ((UINT)h > 32) { // success!
m_color = g_colorVisited; // change color
Invalidate(); // repaint
- }
- else
- {
+ } else {
MessageBeep(0); // unable to execute file!
TRACE(_T("*** WARNING: CStaticLink: unable to navigate link %s\n"),
(LPCTSTR)m_link);
@@ -137,18 +132,15 @@ void CStaticLink::OnLButtonDown(UINT nFlags, CPoint point) //
BOOL CStaticLink::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
- if (g_hCursorLink == NULL)
- {
+ if (g_hCursorLink == NULL) {
static BOOL bTriedOnce = FALSE;
- if (!bTriedOnce)
- {
+ if (!bTriedOnce) {
CString windir;
GetWindowsDirectory(windir.GetBuffer(_MAX_PATH), _MAX_PATH);
windir.ReleaseBuffer();
windir += _T("\\winhlp32.exe");
HMODULE hModule = LoadLibrary(windir);
- if (hModule)
- {
+ if (hModule) {
g_hCursorLink =
CopyCursor(::LoadCursor(hModule, MAKEINTRESOURCE(106)));
}
@@ -156,8 +148,7 @@ BOOL CStaticLink::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) bTriedOnce = TRUE;
}
}
- if (g_hCursorLink)
- {
+ if (g_hCursorLink) {
::SetCursor(g_hCursorLink);
return TRUE;
}
@@ -174,6 +165,7 @@ BOOL CStaticLink::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) //
void CStaticLink::PostNcDestroy()
{
- if (m_bDeleteOnDestroy)
+ if (m_bDeleteOnDestroy) {
delete this;
+ }
}
diff --git a/src/apps/mplayerc/StaticLink.h b/src/apps/mplayerc/StaticLink.h index a887b890f..d02195eb6 100644 --- a/src/apps/mplayerc/StaticLink.h +++ b/src/apps/mplayerc/StaticLink.h @@ -30,17 +30,14 @@ class CHyperlink : public CString public:
CHyperlink(LPCTSTR lpLink = NULL) : CString(lpLink) { }
~CHyperlink() { }
- const CHyperlink& operator=(LPCTSTR lpsz)
- {
+ const CHyperlink& operator=(LPCTSTR lpsz) {
CString::operator=(lpsz);
return *this;
}
- operator LPCTSTR()
- {
+ operator LPCTSTR() {
return CString::operator LPCTSTR();
}
- /*virtual*/ HINSTANCE Navigate()
- {
+ /*virtual*/ HINSTANCE Navigate() {
return IsEmpty() ? NULL :
ShellExecute(0, _T("open"), *this, 0, 0, SW_SHOWNORMAL);
}
diff --git a/src/apps/mplayerc/StatusLabel.cpp b/src/apps/mplayerc/StatusLabel.cpp index 8cf0ae84a..2129107af 100644 --- a/src/apps/mplayerc/StatusLabel.cpp +++ b/src/apps/mplayerc/StatusLabel.cpp @@ -74,8 +74,7 @@ void CStatusLabel::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) CPoint p = CPoint(m_fRightAlign ? r.Width() - size.cx : 0, (r.Height()-size.cy)/2);
if(m_fAddEllipses)
- while(size.cx > r.Width()-3 && str.GetLength() > 3)
- {
+ while(size.cx > r.Width()-3 && str.GetLength() > 3) {
str = str.Left(str.GetLength()-4) + _T("...");
size = dc.GetTextExtent(str);
}
diff --git a/src/apps/mplayerc/StatusLabel.h b/src/apps/mplayerc/StatusLabel.h index 4de3714f7..15e77e117 100644 --- a/src/apps/mplayerc/StatusLabel.h +++ b/src/apps/mplayerc/StatusLabel.h @@ -37,8 +37,7 @@ public: CStatusLabel(bool fRightAlign, bool fAddEllipses);
virtual ~CStatusLabel();
- CFont& GetFont()
- {
+ CFont& GetFont() {
return m_font;
}
diff --git a/src/apps/mplayerc/SubtitleDlDlg.cpp b/src/apps/mplayerc/SubtitleDlDlg.cpp index 115951cd8..8f63b8296 100644 --- a/src/apps/mplayerc/SubtitleDlDlg.cpp +++ b/src/apps/mplayerc/SubtitleDlDlg.cpp @@ -101,8 +101,7 @@ BOOL CSubtitleDlDlg::OnInitDialog() int i = 0;
POSITION pos = m_movies.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
isdb_movie& m = m_movies.GetNext(pos);
CStringA titlesA = Implode(m.titles, '|');
@@ -110,8 +109,7 @@ BOOL CSubtitleDlDlg::OnInitDialog() CString titles = UTF8To16(titlesA);
POSITION pos2 = m.subs.GetHeadPosition();
- while(pos2)
- {
+ while(pos2) {
isdb_subtitle& s = m.subs.GetNext(pos2);
CString name = UTF8To16(s.name);
CString language = s.language;
@@ -138,8 +136,9 @@ BOOL CSubtitleDlDlg::OnInitDialog() void CSubtitleDlDlg::OnOK()
{
for(int i = 0; i < m_list.GetItemCount(); i++)
- if(GetChecked(i))
+ if(GetChecked(i)) {
m_selsubs.AddTail(*(isdb_subtitle*)m_list.GetItemData(i));
+ }
m_fReplaceSubs = IsDlgButtonChecked(IDC_CHECK1) == BST_CHECKED;
@@ -150,12 +149,10 @@ void CSubtitleDlDlg::OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult) {
LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
- if(lpnmlv->iItem >= 0)
- {
+ if(lpnmlv->iItem >= 0) {
CRect r;
m_list.GetItemRect(lpnmlv->iItem, r, LVIR_ICON);
- if(r.PtInRect(lpnmlv->ptAction))
- {
+ if(r.PtInRect(lpnmlv->ptAction)) {
SetChecked(lpnmlv->iItem, (GetChecked(lpnmlv->iItem)&1) == 0 ? 1 : 0);
}
}
@@ -166,8 +163,9 @@ void CSubtitleDlDlg::OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult) void CSubtitleDlDlg::OnUpdateOk(CCmdUI* pCmdUI)
{
bool fEnable = false;
- for(int i = 0; !fEnable && i < m_list.GetItemCount(); i++)
+ for(int i = 0; !fEnable && i < m_list.GetItemCount(); i++) {
fEnable = !!GetChecked(i);
+ }
pCmdUI->Enable(fEnable);
}
diff --git a/src/apps/mplayerc/SubtitleDlDlg.h b/src/apps/mplayerc/SubtitleDlDlg.h index 606111d52..075bb8985 100644 --- a/src/apps/mplayerc/SubtitleDlDlg.h +++ b/src/apps/mplayerc/SubtitleDlDlg.h @@ -31,7 +31,7 @@ class CSubtitleDlDlg : public CResizableDialog
{
-// DECLARE_DYNAMIC(CSubtitleDlDlg)
+ // DECLARE_DYNAMIC(CSubtitleDlDlg)
private:
CList<isdb_movie> m_movies;
@@ -49,7 +49,7 @@ public: bool m_fReplaceSubs;
CList<isdb_subtitle> m_selsubs;
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_SUBTITLEDL_DLG };
CListCtrl m_list;
diff --git a/src/apps/mplayerc/TextPassThruFilter.cpp b/src/apps/mplayerc/TextPassThruFilter.cpp index a334392d3..b9ef84e86 100644 --- a/src/apps/mplayerc/TextPassThruFilter.cpp +++ b/src/apps/mplayerc/TextPassThruFilter.cpp @@ -41,22 +41,20 @@ class CTextPassThruInputPin : public CSubtitleInputPin CComPtr<ISubStream> m_pSubStreamOld;
protected:
- void AddSubStream(ISubStream* pSubStream)
- {
- if(m_pSubStreamOld)
- {
- if(pSubStream) m_pTPTFilter->m_pMainFrame->ReplaceSubtitle(m_pSubStreamOld, pSubStream);
+ void AddSubStream(ISubStream* pSubStream) {
+ if(m_pSubStreamOld) {
+ if(pSubStream) {
+ m_pTPTFilter->m_pMainFrame->ReplaceSubtitle(m_pSubStreamOld, pSubStream);
+ }
m_pSubStreamOld = NULL;
}
}
- void RemoveSubStream(ISubStream* pSubStream)
- {
+ void RemoveSubStream(ISubStream* pSubStream) {
m_pSubStreamOld = pSubStream;
}
- void InvalidateSubtitle(REFERENCE_TIME rtStart, ISubStream* pSubStream)
- {
+ void InvalidateSubtitle(REFERENCE_TIME rtStart, ISubStream* pSubStream) {
m_pTPTFilter->m_pMainFrame->InvalidateSubtitle((DWORD_PTR)pSubStream, rtStart);
}
@@ -85,8 +83,7 @@ public: HRESULT CheckMediaType(const CMediaType* mtOut);
HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
HRESULT GetMediaType(int iPosition, CMediaType* pmt);
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q)
- {
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q) {
return S_OK;
}
};
@@ -102,42 +99,54 @@ CTextPassThruInputPin::CTextPassThruInputPin(CTextPassThruFilter* pTPTFilter, CC STDMETHODIMP CTextPassThruInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
HRESULT hr = __super::NewSegment(tStart, tStop, dRate);
- if(FAILED(hr)) return hr;
+ if(FAILED(hr)) {
+ return hr;
+ }
return m_pTPTFilter->m_pOutput->DeliverNewSegment(tStart, tStop, dRate);
}
STDMETHODIMP CTextPassThruInputPin::Receive(IMediaSample* pSample)
{
HRESULT hr = __super::Receive(pSample);
- if(FAILED(hr)) return hr;
+ if(FAILED(hr)) {
+ return hr;
+ }
return m_pTPTFilter->m_pOutput->Deliver(pSample);
}
STDMETHODIMP CTextPassThruInputPin::EndOfStream()
{
HRESULT hr = __super::EndOfStream();
- if(FAILED(hr)) return hr;
+ if(FAILED(hr)) {
+ return hr;
+ }
return m_pTPTFilter->m_pOutput->DeliverEndOfStream();
}
STDMETHODIMP CTextPassThruInputPin::BeginFlush()
{
HRESULT hr = __super::BeginFlush();
- if(FAILED(hr)) return hr;
+ if(FAILED(hr)) {
+ return hr;
+ }
return m_pTPTFilter->m_pOutput->DeliverBeginFlush();
}
STDMETHODIMP CTextPassThruInputPin::EndFlush()
{
HRESULT hr = __super::EndFlush();
- if(FAILED(hr)) return hr;
+ if(FAILED(hr)) {
+ return hr;
+ }
return m_pTPTFilter->m_pOutput->DeliverEndFlush();
}
HRESULT CTextPassThruInputPin::CompleteConnect(IPin* pReceivePin)
{
HRESULT hr = __super::CompleteConnect(pReceivePin);
- if(FAILED(hr) || !m_pTPTFilter->m_pOutput->IsConnected()) return hr;
+ if(FAILED(hr) || !m_pTPTFilter->m_pOutput->IsConnected()) {
+ return hr;
+ }
return m_pTPTFilter->ReconnectPin(m_pTPTFilter->m_pOutput, &m_mt);
}
@@ -159,19 +168,23 @@ HRESULT CTextPassThruOutputPin::CheckMediaType(const CMediaType* mtOut) HRESULT CTextPassThruOutputPin::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pTPTFilter->m_pInput->IsConnected() == FALSE)
+ if(m_pTPTFilter->m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
+ }
CComPtr<IMemAllocator> pAllocatorIn;
m_pTPTFilter->m_pInput->GetAllocator(&pAllocatorIn);
- if(!pAllocatorIn) return E_UNEXPECTED;
+ if(!pAllocatorIn) {
+ return E_UNEXPECTED;
+ }
pAllocatorIn->GetProperties(pProperties);
HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
+ }
return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
? E_FAIL
@@ -180,11 +193,16 @@ HRESULT CTextPassThruOutputPin::DecideBufferSize(IMemAllocator* pAllocator, ALLO HRESULT CTextPassThruOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
- if(m_pTPTFilter->m_pInput->IsConnected() == FALSE)
+ if(m_pTPTFilter->m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
+ }
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+ if(iPosition < 0) {
+ return E_INVALIDARG;
+ }
+ if(iPosition > 0) {
+ return VFW_S_NO_MORE_ITEMS;
+ }
m_pTPTFilter->m_pInput->ConnectionMediaType(pmt);
@@ -214,10 +232,8 @@ CTextPassThruFilter::~CTextPassThruFilter() STDMETHODIMP CTextPassThruFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- if(m_pInput && riid == __uuidof(ISubStream))
- {
- if(CComPtr<ISubStream> pSubStream = m_pInput->GetSubStream())
- {
+ if(m_pInput && riid == __uuidof(ISubStream)) {
+ if(CComPtr<ISubStream> pSubStream = m_pInput->GetSubStream()) {
*ppv = pSubStream.Detach();
return S_OK;
}
@@ -233,7 +249,10 @@ int CTextPassThruFilter::GetPinCount() CBasePin* CTextPassThruFilter::GetPin(int n)
{
- if(n == 0) return m_pInput;
- else if(n == 1) return m_pOutput;
+ if(n == 0) {
+ return m_pInput;
+ } else if(n == 1) {
+ return m_pOutput;
+ }
return NULL;
}
diff --git a/src/apps/mplayerc/TunerScanDlg.cpp b/src/apps/mplayerc/TunerScanDlg.cpp index a70a9ca91..24c19617c 100644 --- a/src/apps/mplayerc/TunerScanDlg.cpp +++ b/src/apps/mplayerc/TunerScanDlg.cpp @@ -29,8 +29,7 @@ #include "TunerScanDlg.h"
#include "DVBChannel.h"
-enum TSC_COLUMN
-{
+enum TSC_COLUMN {
TSCC_NUMBER,
TSCC_NAME,
TSCC_FREQUENCY,
@@ -119,8 +118,7 @@ void CTunerScanDlg::OnBnClickedSave() AppSettings& s = AfxGetAppSettings();
s.m_DVBChannels.RemoveAll();
- for (int i=0; i <m_ChannelList.GetItemCount(); i++)
- {
+ for (int i=0; i <m_ChannelList.GetItemCount(); i++) {
CDVBChannel Channel;
Channel.FromString (m_ChannelList.GetItemText (i, TSCC_CHANNEL));
Channel.SetPrefNumber(i);
@@ -132,8 +130,7 @@ void CTunerScanDlg::OnBnClickedSave() void CTunerScanDlg::OnBnClickedStart()
{
- if (!m_bInProgress)
- {
+ if (!m_bInProgress) {
UpdateData(true);
CAutoPtr<TunerScanData> pTSD (DNew TunerScanData);
pTSD->Hwnd = m_hWnd;
@@ -147,15 +144,16 @@ void CTunerScanDlg::OnBnClickedStart() ((CMainFrame*)AfxGetMainWnd())->StartTunerScan (pTSD);
SetProgress (true);
- }
- else
+ } else {
((CMainFrame*)AfxGetMainWnd())->StopTunerScan();
+ }
}
void CTunerScanDlg::OnBnClickedCancel()
{
- if (m_bInProgress)
+ if (m_bInProgress) {
((CMainFrame*)AfxGetMainWnd())->StopTunerScan();
+ }
OnCancel();
}
@@ -194,20 +192,18 @@ LRESULT CTunerScanDlg::OnNewChannel(WPARAM wParam, LPARAM lParam) int nChannelNumber;
Channel.FromString ((LPCTSTR) lParam);
- if (!m_bIgnoreEncryptedChannels || !Channel.IsEncrypted())
- {
- if (Channel.GetOriginNumber() != 0) // LCN is available
- {
+ if (!m_bIgnoreEncryptedChannels || !Channel.IsEncrypted()) {
+ if (Channel.GetOriginNumber() != 0) { // LCN is available
nChannelNumber = Channel.GetOriginNumber();
// Insert new channel so that channels are sorted by their logical number
- for (nItem=0; nItem<m_ChannelList.GetItemCount(); nItem++)
- {
- if (m_ChannelList.GetItemData(nItem) > nChannelNumber)
+ for (nItem=0; nItem<m_ChannelList.GetItemCount(); nItem++) {
+ if (m_ChannelList.GetItemData(nItem) > nChannelNumber) {
break;
+ }
}
- }
- else
+ } else {
nChannelNumber = nItem = m_ChannelList.GetItemCount();
+ }
strTemp.Format(_T("%d"), nChannelNumber);
nItem = m_ChannelList.InsertItem (nItem, strTemp);
@@ -231,13 +227,10 @@ LRESULT CTunerScanDlg::OnNewChannel(WPARAM wParam, LPARAM lParam) void CTunerScanDlg::SetProgress (bool bState)
{
- if (bState)
- {
+ if (bState) {
m_btnStart.SetWindowTextW(_T("Stop"));
m_btnSave.EnableWindow(FALSE);
- }
- else
- {
+ } else {
m_btnStart.SetWindowTextW(_T("Start"));
m_Progress.SetPos (0);
m_btnSave.EnableWindow(TRUE);
diff --git a/src/apps/mplayerc/TunerScanDlg.h b/src/apps/mplayerc/TunerScanDlg.h index ac00b0deb..106a2f4c5 100644 --- a/src/apps/mplayerc/TunerScanDlg.h +++ b/src/apps/mplayerc/TunerScanDlg.h @@ -35,7 +35,7 @@ public: CTunerScanDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CTunerScanDlg();
-// Dialog Data
+ // Dialog Data
enum { IDD = IDD_TUNER_SCAN };
protected:
diff --git a/src/apps/mplayerc/VMROSD.cpp b/src/apps/mplayerc/VMROSD.cpp index 5d803a3f7..8339dc57a 100644 --- a/src/apps/mplayerc/VMROSD.cpp +++ b/src/apps/mplayerc/VMROSD.cpp @@ -66,10 +66,8 @@ CVMROSD::~CVMROSD(void) void CVMROSD::OnSize(UINT nType, int cx, int cy)
{
- if (m_pWnd && (m_pVMB || m_pMFVMB))
- {
- if (m_bSeekBarVisible)
- {
+ if (m_pWnd && (m_pVMB || m_pMFVMB)) {
+ if (m_bSeekBarVisible) {
m_bCursorMoving = false;
m_bSeekBarVisible = false;
Invalidate();
@@ -90,8 +88,7 @@ void CVMROSD::UpdateBitmap() m_MemDC.DeleteDC();
memset(&m_BitmapInfo, 0, sizeof(m_BitmapInfo));
- if (m_MemDC.CreateCompatibleDC (&dc))
- {
+ if (m_MemDC.CreateCompatibleDC (&dc)) {
BITMAPINFO bmi = {0};
HBITMAP hbmpRender;
@@ -106,11 +103,9 @@ void CVMROSD::UpdateBitmap() hbmpRender = CreateDIBSection( m_MemDC, &bmi, DIB_RGB_COLORS, NULL, NULL, NULL );
m_MemDC.SelectObject (hbmpRender);
- if (::GetObject(hbmpRender, sizeof(BITMAP), &m_BitmapInfo) != 0)
- {
+ if (::GetObject(hbmpRender, sizeof(BITMAP), &m_BitmapInfo) != 0) {
// Configure the VMR's bitmap structure
- if (m_pVMB)
- {
+ if (m_pVMB) {
ZeroMemory(&m_VMR9AlphaBitmap, sizeof(m_VMR9AlphaBitmap) );
m_VMR9AlphaBitmap.dwFlags = VMRBITMAP_HDC | VMRBITMAP_SRCCOLORKEY;
m_VMR9AlphaBitmap.hdc = m_MemDC;
@@ -121,9 +116,7 @@ void CVMROSD::UpdateBitmap() m_VMR9AlphaBitmap.rDest.bottom = 1.0;
m_VMR9AlphaBitmap.fAlpha = 1.0;
m_VMR9AlphaBitmap.clrSrcKey = m_Color[OSD_TRANSPARENT];
- }
- else if (m_pMFVMB)
- {
+ } else if (m_pMFVMB) {
ZeroMemory(&m_MFVideoAlphaBitmap, sizeof(m_MFVideoAlphaBitmap) );
m_MFVideoAlphaBitmap.params.dwFlags = MFVideoAlphaBitmap_SrcColorKey;
m_MFVideoAlphaBitmap.params.clrSrcKey = m_Color[OSD_TRANSPARENT];
@@ -137,8 +130,9 @@ void CVMROSD::UpdateBitmap() m_MemDC.SetBkMode(TRANSPARENT);
}
- if(m_MainFont.GetSafeHandle())
+ if(m_MainFont.GetSafeHandle()) {
m_MemDC.SelectObject(m_MainFont);
+ }
DeleteObject(hbmpRender);
}
@@ -165,15 +159,18 @@ void CVMROSD::Start (CWnd* pWnd, IMFVideoMixerBitmap* pMFVMB) void CVMROSD::Stop()
{
- if(m_pVMB) m_pVMB.Release();
- if(m_pMFVMB) m_pMFVMB.Release();
+ if(m_pVMB) {
+ m_pVMB.Release();
+ }
+ if(m_pMFVMB) {
+ m_pMFVMB.Release();
+ }
m_pWnd = NULL;
}
void CVMROSD::CalcRect()
{
- if (m_pWnd)
- {
+ if (m_pWnd) {
m_pWnd->GetClientRect(&m_rectWnd);
m_rectSeekBar.left = m_rectWnd.left + 10;
@@ -190,15 +187,17 @@ void CVMROSD::CalcRect() void CVMROSD::DrawRect(CRect* rect, CBrush* pBrush, CPen* pPen)
{
- if (pPen)
+ if (pPen) {
m_MemDC.SelectObject (pPen);
- else
+ } else {
m_MemDC.SelectStockObject(NULL_PEN);
+ }
- if (pBrush)
+ if (pBrush) {
m_MemDC.SelectObject (pBrush);
- else
+ } else {
m_MemDC.SelectStockObject(HOLLOW_BRUSH);
+ }
m_MemDC.Rectangle (rect);
}
@@ -210,10 +209,11 @@ void CVMROSD::DrawSlider(CRect* rect, __int64 llMin, __int64 llMax, __int64 llPo m_rectBar.top = rect->top + (rect->Height() - SLIDER_BAR_HEIGHT) / 2;
m_rectBar.bottom = m_rectBar.top + SLIDER_BAR_HEIGHT;
- if (llMax == llMin)
+ if (llMax == llMin) {
m_rectCursor.left = m_rectBar.left;
- else
+ } else {
m_rectCursor.left = m_rectBar.left + (long)((m_rectBar.Width() - SLIDER_CURSOR_WIDTH) * llPos / (llMax-llMin));
+ }
m_rectCursor.right = m_rectCursor.left + SLIDER_CURSOR_WIDTH;
m_rectCursor.top = rect->top + (rect->Height() - SLIDER_CURSOR_HEIGHT) / 2;
m_rectCursor.bottom = m_rectCursor.top + SLIDER_CURSOR_HEIGHT;
@@ -226,29 +226,27 @@ void CVMROSD::DrawSlider(CRect* rect, __int64 llMin, __int64 llMax, __int64 llPo void CVMROSD::DrawMessage()
{
- if (m_BitmapInfo.bmWidth*m_BitmapInfo.bmHeight*(m_BitmapInfo.bmBitsPixel/8) == 0)
+ if (m_BitmapInfo.bmWidth*m_BitmapInfo.bmHeight*(m_BitmapInfo.bmBitsPixel/8) == 0) {
return;
- if (m_nMessagePos != OSD_NOMESSAGE)
- {
+ }
+ if (m_nMessagePos != OSD_NOMESSAGE) {
CRect rectText (0,0,0,0);
CRect rectMessages;
m_MemDC.DrawText (m_strMessage, &rectText, DT_CALCRECT);
rectText.InflateRect(20, 10);
- switch (m_nMessagePos)
- {
- case OSD_TOPLEFT :
- rectMessages = CRect (10, 10, min((rectText.right + 10),(m_rectWnd.right - 10)), (rectText.bottom + 10));
- break;
- case OSD_TOPRIGHT :
- default :
- rectMessages = CRect (max(10,m_rectWnd.right-10-rectText.Width()), 10, m_rectWnd.right-10, rectText.bottom + 10);
- break;
+ switch (m_nMessagePos) {
+ case OSD_TOPLEFT :
+ rectMessages = CRect (10, 10, min((rectText.right + 10),(m_rectWnd.right - 10)), (rectText.bottom + 10));
+ break;
+ case OSD_TOPRIGHT :
+ default :
+ rectMessages = CRect (max(10,m_rectWnd.right-10-rectText.Width()), 10, m_rectWnd.right-10, rectText.bottom + 10);
+ break;
}
DrawRect (&rectMessages, &m_brushBack, &m_penBorder);
DWORD uFormat = DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_NOPREFIX;
- if(rectText.right > (m_rectWnd.right - 20))
- {
+ if(rectText.right > (m_rectWnd.right - 20)) {
m_strMessage = _T(" ") + m_strMessage;
uFormat = uFormat|DT_END_ELLIPSIS;
}
@@ -258,18 +256,17 @@ void CVMROSD::DrawMessage() void CVMROSD::DrawDebug()
{
- if ( !m_debugMessages.IsEmpty() )
- {
+ if ( !m_debugMessages.IsEmpty() ) {
CString msg, tmp;
POSITION pos;
pos = m_debugMessages.GetHeadPosition();
msg.Format(_T("%s"), m_debugMessages.GetNext(pos));
- while(pos)
- {
+ while(pos) {
tmp = m_debugMessages.GetNext(pos);
- if ( !tmp.IsEmpty() )
+ if ( !tmp.IsEmpty() ) {
msg.AppendFormat(_T("\r\n%s"), tmp);
+ }
}
CRect rectText(0,0,0,0);
@@ -291,21 +288,21 @@ void CVMROSD::DrawDebug() void CVMROSD::Invalidate()
{
CAutoLock Lock(&m_Lock);
- if (m_BitmapInfo.bmWidth*m_BitmapInfo.bmHeight*(m_BitmapInfo.bmBitsPixel/8) == 0)
+ if (m_BitmapInfo.bmWidth*m_BitmapInfo.bmHeight*(m_BitmapInfo.bmBitsPixel/8) == 0) {
return;
+ }
memsetd(m_BitmapInfo.bmBits, 0xff000000, m_BitmapInfo.bmWidth*m_BitmapInfo.bmHeight*(m_BitmapInfo.bmBitsPixel/8));
- if (m_bSeekBarVisible) DrawSlider(&m_rectSeekBar, m_llSeekMin, m_llSeekMax, m_llSeekPos);
+ if (m_bSeekBarVisible) {
+ DrawSlider(&m_rectSeekBar, m_llSeekMin, m_llSeekMax, m_llSeekPos);
+ }
DrawMessage();
DrawDebug();
- if (m_pVMB)
- {
+ if (m_pVMB) {
m_VMR9AlphaBitmap.dwFlags &= ~VMRBITMAP_DISABLE;
m_pVMB->SetAlphaBitmap(&m_VMR9AlphaBitmap);
- }
- else if (m_pMFVMB)
- {
+ } else if (m_pMFVMB) {
m_pMFVMB->SetAlphaBitmap (&m_MFVideoAlphaBitmap);
}
}
@@ -316,39 +313,33 @@ void CVMROSD::UpdateSeekBarPos(CPoint point) m_llSeekPos = max (m_llSeekPos, m_llSeekMin);
m_llSeekPos = min (m_llSeekPos, m_llSeekMax);
- if (m_pWnd)
+ if (m_pWnd) {
AfxGetApp()->GetMainWnd()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)m_llSeekPos, SB_THUMBTRACK), (LPARAM)m_pWnd->m_hWnd);
+ }
}
bool CVMROSD::OnMouseMove(UINT nFlags, CPoint point)
{
bool bRet = false;
- if (m_pVMB || m_pMFVMB)
- {
- if (m_bCursorMoving)
- {
+ if (m_pVMB || m_pMFVMB) {
+ if (m_bCursorMoving) {
UpdateSeekBarPos(point);
Invalidate();
- }
- else if (!m_bSeekBarVisible && AfxGetAppSettings().IsD3DFullscreen() && m_rectSeekBar.PtInRect(point))
- {
+ } else if (!m_bSeekBarVisible && AfxGetAppSettings().IsD3DFullscreen() && m_rectSeekBar.PtInRect(point)) {
m_bSeekBarVisible = true;
Invalidate();
- }
- else if (m_bSeekBarVisible && !m_rectSeekBar.PtInRect(point))
- {
+ } else if (m_bSeekBarVisible && !m_rectSeekBar.PtInRect(point)) {
m_bSeekBarVisible = false;
// Add new timer for removing any messages
- if (m_pWnd)
- {
+ if (m_pWnd) {
KillTimer(m_pWnd->m_hWnd, (long)this);
SetTimer(m_pWnd->m_hWnd, (long)this, 1000, (TIMERPROC)TimerFunc);
}
Invalidate();
- }
- else
+ } else {
bRet = false;
+ }
}
return bRet;
@@ -357,15 +348,11 @@ bool CVMROSD::OnMouseMove(UINT nFlags, CPoint point) bool CVMROSD::OnLButtonDown(UINT nFlags, CPoint point)
{
bool bRet = false;
- if (m_pVMB || m_pMFVMB)
- {
- if (m_rectCursor.PtInRect (point))
- {
+ if (m_pVMB || m_pMFVMB) {
+ if (m_rectCursor.PtInRect (point)) {
m_bCursorMoving = true;
bRet = true;
- }
- else if (m_rectSeekBar.PtInRect(point))
- {
+ } else if (m_rectSeekBar.PtInRect(point)) {
bRet = true;
UpdateSeekBarPos(point);
Invalidate();
@@ -379,8 +366,7 @@ bool CVMROSD::OnLButtonUp(UINT nFlags, CPoint point) {
bool bRet = false;
- if (m_pVMB || m_pMFVMB)
- {
+ if (m_pVMB || m_pMFVMB) {
m_bCursorMoving = false;
bRet = (m_rectCursor.PtInRect (point) || m_rectSeekBar.PtInRect(point));
@@ -413,8 +399,7 @@ void CVMROSD::GetRange(__int64& start, __int64& stop) void CVMROSD::TimerFunc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime)
{
CVMROSD* pVMROSD = (CVMROSD*) nIDEvent;
- if (pVMROSD)
- {
+ if (pVMROSD) {
pVMROSD->ClearMessage();
}
KillTimer(hWnd, nIDEvent);
@@ -423,61 +408,65 @@ void CVMROSD::TimerFunc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime) void CVMROSD::ClearMessage()
{
CAutoLock Lock(&m_Lock);
- if (m_bSeekBarVisible)
+ if (m_bSeekBarVisible) {
return;
- if (m_pVMB)
- {
+ }
+ if (m_pVMB) {
DWORD dwBackup = (m_VMR9AlphaBitmap.dwFlags | VMRBITMAP_DISABLE);
m_VMR9AlphaBitmap.dwFlags = VMRBITMAP_DISABLE;
m_nMessagePos = OSD_NOMESSAGE;
m_pVMB->SetAlphaBitmap(&m_VMR9AlphaBitmap);
m_VMR9AlphaBitmap.dwFlags = dwBackup;
- }
- else if (m_pMFVMB)
- {
+ } else if (m_pMFVMB) {
m_pMFVMB->ClearAlphaBitmap();
}
}
void CVMROSD::DisplayMessage (OSD_MESSAGEPOS nPos, LPCTSTR strMsg, int nDuration, int FontSize, CString OSD_Font)
{
- if (m_pVMB || m_pMFVMB)
- {
- if ( nPos != OSD_DEBUG )
- {
+ if (m_pVMB || m_pMFVMB) {
+ if ( nPos != OSD_DEBUG ) {
m_nMessagePos = nPos;
m_strMessage = strMsg;
- }
- else
- {
+ } else {
m_debugMessages.AddTail(strMsg);
- if ( m_debugMessages.GetCount() > 20 )
+ if ( m_debugMessages.GetCount() > 20 ) {
m_debugMessages.RemoveHead();
+ }
nDuration = -1;
}
int temp_m_FontSize = m_FontSize;
CString temp_m_OSD_Font = m_OSD_Font;
- if (FontSize == 0) m_FontSize = AfxGetAppSettings().nOSDSize;
- else m_FontSize = FontSize;
- if (m_FontSize<10 || m_FontSize>26) m_FontSize=20;
- if (OSD_Font == _T("")) m_OSD_Font = AfxGetAppSettings().strOSDFont;
- else m_OSD_Font = OSD_Font;
+ if (FontSize == 0) {
+ m_FontSize = AfxGetAppSettings().nOSDSize;
+ } else {
+ m_FontSize = FontSize;
+ }
+ if (m_FontSize<10 || m_FontSize>26) {
+ m_FontSize=20;
+ }
+ if (OSD_Font == _T("")) {
+ m_OSD_Font = AfxGetAppSettings().strOSDFont;
+ } else {
+ m_OSD_Font = OSD_Font;
+ }
- if((temp_m_FontSize != m_FontSize) || (temp_m_OSD_Font != m_OSD_Font))
- {
- if(m_MainFont.GetSafeHandle())
+ if((temp_m_FontSize != m_FontSize) || (temp_m_OSD_Font != m_OSD_Font)) {
+ if(m_MainFont.GetSafeHandle()) {
m_MainFont.DeleteObject();
+ }
m_MainFont.CreatePointFont(m_FontSize*10, m_OSD_Font);
m_MemDC.SelectObject(m_MainFont);
}
- if (m_pWnd)
- {
+ if (m_pWnd) {
KillTimer(m_pWnd->m_hWnd, (long)this);
- if (nDuration != -1) SetTimer(m_pWnd->m_hWnd, (long)this, nDuration, (TIMERPROC)TimerFunc);
+ if (nDuration != -1) {
+ SetTimer(m_pWnd->m_hWnd, (long)this, nDuration, (TIMERPROC)TimerFunc);
+ }
}
Invalidate();
}
diff --git a/src/apps/mplayerc/VMROSD.h b/src/apps/mplayerc/VMROSD.h index a2f538a8d..802187ce4 100644 --- a/src/apps/mplayerc/VMROSD.h +++ b/src/apps/mplayerc/VMROSD.h @@ -28,8 +28,7 @@ #include <evr9.h>
-typedef enum
-{
+typedef enum {
OSD_TRANSPARENT,
OSD_BACKGROUND,
OSD_BORDER,
@@ -40,8 +39,7 @@ typedef enum OSD_LAST
} OSD_COLORS;
-typedef enum
-{
+typedef enum {
OSD_NOMESSAGE,
OSD_TOPLEFT,
OSD_TOPRIGHT,
diff --git a/src/apps/mplayerc/VolumeCtrl.cpp b/src/apps/mplayerc/VolumeCtrl.cpp index 3b0a7d293..2a0580522 100644 --- a/src/apps/mplayerc/VolumeCtrl.cpp +++ b/src/apps/mplayerc/VolumeCtrl.cpp @@ -39,8 +39,9 @@ CVolumeCtrl::~CVolumeCtrl() bool CVolumeCtrl::Create(CWnd* pParentWnd)
{
- if(!CSliderCtrl::Create(WS_CHILD|WS_VISIBLE|TBS_NOTICKS|TBS_HORZ, CRect(0,0,0,0), pParentWnd, IDC_SLIDER1))
+ if(!CSliderCtrl::Create(WS_CHILD|WS_VISIBLE|TBS_NOTICKS|TBS_HORZ, CRect(0,0,0,0), pParentWnd, IDC_SLIDER1)) {
return(false);
+ }
SetRange(1, 100);
SetPosInternal(AfxGetAppSettings().nVolume);
@@ -84,57 +85,53 @@ void CVolumeCtrl::OnNMCustomdraw(NMHDR* pNMHDR, LRESULT* pResult) LRESULT lr = CDRF_DODEFAULT;
if(m_fSelfDrawn)
- switch(pNMCD->dwDrawStage)
- {
- case CDDS_PREPAINT:
- lr = CDRF_NOTIFYITEMDRAW;
- break;
-
- case CDDS_ITEMPREPAINT:
- if(pNMCD->dwItemSpec == TBCD_CHANNEL)
- {
- CDC dc;
- dc.Attach(pNMCD->hdc);
-
- CRect r;
- GetClientRect(r);
- r.DeflateRect(8, 4, 10, 6);
- CopyRect(&pNMCD->rc, &r);
- CPen shadow(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
- CPen light(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
- CPen* old = dc.SelectObject(&light);
- dc.MoveTo(pNMCD->rc.right, pNMCD->rc.top);
- dc.LineTo(pNMCD->rc.right, pNMCD->rc.bottom);
- dc.LineTo(pNMCD->rc.left, pNMCD->rc.bottom);
- dc.SelectObject(&shadow);
- dc.LineTo(pNMCD->rc.right, pNMCD->rc.top);
- dc.SelectObject(old);
-
- dc.Detach();
- lr = CDRF_SKIPDEFAULT;
- }
- else if(pNMCD->dwItemSpec == TBCD_THUMB)
- {
- CDC dc;
- dc.Attach(pNMCD->hdc);
- pNMCD->rc.bottom--;
- CRect r(pNMCD->rc);
- r.DeflateRect(0, 0, 1, 0);
-
- COLORREF shadow = GetSysColor(COLOR_3DSHADOW);
- COLORREF light = GetSysColor(COLOR_3DHILIGHT);
- dc.Draw3dRect(&r, light, 0);
- r.DeflateRect(0, 0, 1, 1);
- dc.Draw3dRect(&r, light, shadow);
- r.DeflateRect(1, 1, 1, 1);
- dc.FillSolidRect(&r, GetSysColor(COLOR_BTNFACE));
- dc.SetPixel(r.left+7, r.top-1, GetSysColor(COLOR_BTNFACE));
-
- dc.Detach();
- lr = CDRF_SKIPDEFAULT;
- }
-
- break;
+ switch(pNMCD->dwDrawStage) {
+ case CDDS_PREPAINT:
+ lr = CDRF_NOTIFYITEMDRAW;
+ break;
+
+ case CDDS_ITEMPREPAINT:
+ if(pNMCD->dwItemSpec == TBCD_CHANNEL) {
+ CDC dc;
+ dc.Attach(pNMCD->hdc);
+
+ CRect r;
+ GetClientRect(r);
+ r.DeflateRect(8, 4, 10, 6);
+ CopyRect(&pNMCD->rc, &r);
+ CPen shadow(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
+ CPen light(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
+ CPen* old = dc.SelectObject(&light);
+ dc.MoveTo(pNMCD->rc.right, pNMCD->rc.top);
+ dc.LineTo(pNMCD->rc.right, pNMCD->rc.bottom);
+ dc.LineTo(pNMCD->rc.left, pNMCD->rc.bottom);
+ dc.SelectObject(&shadow);
+ dc.LineTo(pNMCD->rc.right, pNMCD->rc.top);
+ dc.SelectObject(old);
+
+ dc.Detach();
+ lr = CDRF_SKIPDEFAULT;
+ } else if(pNMCD->dwItemSpec == TBCD_THUMB) {
+ CDC dc;
+ dc.Attach(pNMCD->hdc);
+ pNMCD->rc.bottom--;
+ CRect r(pNMCD->rc);
+ r.DeflateRect(0, 0, 1, 0);
+
+ COLORREF shadow = GetSysColor(COLOR_3DSHADOW);
+ COLORREF light = GetSysColor(COLOR_3DHILIGHT);
+ dc.Draw3dRect(&r, light, 0);
+ r.DeflateRect(0, 0, 1, 1);
+ dc.Draw3dRect(&r, light, shadow);
+ r.DeflateRect(1, 1, 1, 1);
+ dc.FillSolidRect(&r, GetSysColor(COLOR_BTNFACE));
+ dc.SetPixel(r.left+7, r.top-1, GetSysColor(COLOR_BTNFACE));
+
+ dc.Detach();
+ lr = CDRF_SKIPDEFAULT;
+ }
+
+ break;
};
pNMCD->uItemState &= ~CDIS_FOCUS;
@@ -147,7 +144,9 @@ void CVolumeCtrl::OnLButtonDown(UINT nFlags, CPoint point) CRect r;
GetChannelRect(&r);
- if(r.left >= r.right) return;
+ if(r.left >= r.right) {
+ return;
+ }
int start, stop;
GetRange(start, stop);
@@ -155,13 +154,15 @@ void CVolumeCtrl::OnLButtonDown(UINT nFlags, CPoint point) r.left += 3;
r.right -= 4;
- if(point.x < r.left) SetPos(start);
- else if(point.x >= r.right) SetPos(stop);
- else
- {
+ if(point.x < r.left) {
+ SetPos(start);
+ } else if(point.x >= r.right) {
+ SetPos(stop);
+ } else {
int w = r.right - r.left;
- if(start < stop)
+ if(start < stop) {
SetPosInternal(start + ((stop - start) * (point.x - r.left) + (w/2)) / w);
+ }
}
CSliderCtrl::OnLButtonDown(nFlags, point);
@@ -179,8 +180,9 @@ void CVolumeCtrl::HScroll(UINT nSBCode, UINT nPos) AfxGetAppSettings().nVolume = GetPos();
CFrameWnd* pFrame = GetParentFrame();
- if(pFrame && pFrame != GetParent())
+ if(pFrame && pFrame != GetParent()) {
pFrame->PostMessage(WM_HSCROLL, MAKEWPARAM((short)nPos, nSBCode), (LPARAM)m_hWnd);
+ }
}
BOOL CVolumeCtrl::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
diff --git a/src/apps/mplayerc/WebClientSocket.cpp b/src/apps/mplayerc/WebClientSocket.cpp index 517f789ec..62f9b1bf2 100644 --- a/src/apps/mplayerc/WebClientSocket.cpp +++ b/src/apps/mplayerc/WebClientSocket.cpp @@ -42,9 +42,10 @@ CWebClientSocket::~CWebClientSocket() bool CWebClientSocket::SetCookie(CString name, CString value, __time64_t expire, CString path, CString domain)
{
- if(name.IsEmpty()) return(false);
- if(value.IsEmpty())
- {
+ if(name.IsEmpty()) {
+ return(false);
+ }
+ if(value.IsEmpty()) {
m_cookie.RemoveKey(name);
return true;
}
@@ -54,8 +55,7 @@ bool CWebClientSocket::SetCookie(CString name, CString value, __time64_t expire, m_cookieattribs[name].path = path;
m_cookieattribs[name].domain = domain;
- if(expire >= 0)
- {
+ if(expire >= 0) {
CTime t(expire);
SYSTEMTIME st;
t.GetAsSystemTime(st);
@@ -84,9 +84,10 @@ void CWebClientSocket::Clear() void CWebClientSocket::Header()
{
- if(m_cmd.IsEmpty())
- {
- if(m_hdr.IsEmpty()) return;
+ if(m_cmd.IsEmpty()) {
+ if(m_hdr.IsEmpty()) {
+ return;
+ }
CAtlList<CString> lines;
Explode(m_hdr, lines, '\n');
@@ -100,29 +101,26 @@ void CWebClientSocket::Header() ASSERT(sl.GetCount() == 0);
POSITION pos = lines.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
Explode(lines.GetNext(pos), sl, ':', 2);
- if(sl.GetCount() == 2)
+ if(sl.GetCount() == 2) {
m_hdrlines[sl.GetHead().MakeLower()] = sl.GetTail();
+ }
}
}
// remember new cookies
POSITION pos = m_hdrlines.GetStartPosition();
- while(pos)
- {
+ while(pos) {
CString key, value;
m_hdrlines.GetNextAssoc(pos, key, value);
- if(key == _T("cookie"))
- {
+ if(key == _T("cookie")) {
CAtlList<CString> sl;
Explode(value, sl, ';');
POSITION pos2 = sl.GetHeadPosition();
- while(pos2)
- {
+ while(pos2) {
CAtlList<CString> sl2;
Explode(sl.GetNext(pos2), sl2, '=', 2);
m_cookie[sl2.GetHead()] = sl2.GetCount() == 2 ? sl2.GetTail() : _T("");
@@ -132,24 +130,19 @@ void CWebClientSocket::Header() // start new session
- if(!m_cookie.Lookup(_T("MPCSESSIONID"), m_sessid))
- {
+ if(!m_cookie.Lookup(_T("MPCSESSIONID"), m_sessid)) {
srand((unsigned int)time(NULL));
m_sessid.Format(_T("%08x"), rand()*0x12345678);
SetCookie(_T("MPCSESSIONID"), m_sessid);
- }
- else
- {
+ } else {
// TODO: load session
}
CStringA reshdr, resbody;
- if(m_cmd == _T("POST"))
- {
+ if(m_cmd == _T("POST")) {
CString str;
- if(m_hdrlines.Lookup(_T("content-length"), str))
- {
+ if(m_hdrlines.Lookup(_T("content-length"), str)) {
int len = _tcstol(str, NULL, 10);
str.Empty();
@@ -158,20 +151,18 @@ void CWebClientSocket::Header() int timeout = 1000;
- do
- {
- for(; len > 0 && (err = Receive(&c, 1)) > 0; len--)
- {
+ do {
+ for(; len > 0 && (err = Receive(&c, 1)) > 0; len--) {
m_data += c;
- if(c == '\r') continue;
+ if(c == '\r') {
+ continue;
+ }
str += c;
- if(c == '\n' || len == 1)
- {
+ if(c == '\n' || len == 1) {
CAtlList<CString> sl;
Explode(AToT(UrlDecode(TToA(str))), sl, '&'); // FIXME
POSITION pos = sl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CAtlList<CString> sl2;
Explode(sl.GetNext(pos), sl2, '=', 2);
m_post[sl2.GetHead().MakeLower()] = sl2.GetCount() == 2 ? sl2.GetTail() : _T("");
@@ -180,10 +171,10 @@ void CWebClientSocket::Header() }
}
- if(err == SOCKET_ERROR)
+ if(err == SOCKET_ERROR) {
Sleep(1);
- }
- while(err == SOCKET_ERROR && GetLastError() == WSAEWOULDBLOCK
+ }
+ } while(err == SOCKET_ERROR && GetLastError() == WSAEWOULDBLOCK
&& timeout-- > 0); // FIXME: this is just a dirty fix now
// FIXME: with IE it will only work if I read +2 bytes (?), btw Receive will just return -1
@@ -192,23 +183,20 @@ void CWebClientSocket::Header() }
}
- if(m_cmd == _T("GET") || m_cmd == _T("HEAD") || m_cmd == _T("POST"))
- {
+ if(m_cmd == _T("GET") || m_cmd == _T("HEAD") || m_cmd == _T("POST")) {
CAtlList<CString> sl;
Explode(m_path, sl, '?', 2);
m_path = sl.RemoveHead();
m_query.Empty();
- if(!sl.IsEmpty())
- {
+ if(!sl.IsEmpty()) {
m_query = sl.GetTail();
Explode(Explode(m_query, sl, '#', 2), sl, '&'); // oh yeah
// Explode(AToT(UrlDecode(TToA(Explode(m_query, sl, '#', 2)))), sl, '&'); // oh yeah
POSITION pos = sl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CAtlList<CString> sl2;
Explode(AToT(UrlDecode(TToA(sl.GetNext(pos)))), sl2, '=', 2);
// Explode(sl.GetNext(pos), sl2, '=', 2);
@@ -221,51 +209,49 @@ void CWebClientSocket::Header() CString key, value;
POSITION pos;
pos = m_get.GetStartPosition();
- while(pos)
- {
+ while(pos) {
m_get.GetNextAssoc(pos, key, value);
m_request[key] = value;
}
pos = m_post.GetStartPosition();
- while(pos)
- {
+ while(pos) {
m_post.GetNextAssoc(pos, key, value);
m_request[key] = value;
}
pos = m_cookie.GetStartPosition();
- while(pos)
- {
+ while(pos) {
m_cookie.GetNextAssoc(pos, key, value);
m_request[key] = value;
}
}
m_pWebServer->OnRequest(this, reshdr, resbody);
- }
- else
- {
+ } else {
reshdr = "HTTP/1.0 400 Bad Request\r\n";
}
- if(!reshdr.IsEmpty())
- {
+ if(!reshdr.IsEmpty()) {
// cookies
{
POSITION pos = m_cookie.GetStartPosition();
- while(pos)
- {
+ while(pos) {
CString key, value;
m_cookie.GetNextAssoc(pos, key, value);
reshdr += "Set-Cookie: " + key + "=" + value;
POSITION pos2 = m_cookieattribs.GetStartPosition();
- while(pos2)
- {
+ while(pos2) {
CString key;
cookie_attribs value;
m_cookieattribs.GetNextAssoc(pos2, key, value);
- if(!value.path.IsEmpty()) reshdr += " path=" + value.path;
- if(!value.expire.IsEmpty()) reshdr += " expire=" + value.expire;
- if(!value.domain.IsEmpty()) reshdr += " domain=" + value.domain;
+ if(!value.path.IsEmpty()) {
+ reshdr += " path=" + value.path;
+ }
+ if(!value.expire.IsEmpty()) {
+ reshdr += " expire=" + value.expire;
+ }
+ if(!value.domain.IsEmpty()) {
+ reshdr += " domain=" + value.domain;
+ }
}
reshdr += "\r\n";
}
@@ -278,8 +264,7 @@ void CWebClientSocket::Header() Send(reshdr, reshdr.GetLength());
- if(m_cmd != _T("HEAD") && reshdr.Find("HTTP/1.0 200 OK") == 0 && !resbody.IsEmpty())
- {
+ if(m_cmd != _T("HEAD") && reshdr.Find("HTTP/1.0 200 OK") == 0 && !resbody.IsEmpty()) {
Send(resbody, resbody.GetLength());
}
@@ -298,17 +283,17 @@ void CWebClientSocket::Header() void CWebClientSocket::OnReceive(int nErrorCode)
{
- if(nErrorCode == 0)
- {
+ if(nErrorCode == 0) {
char c;
- while(Receive(&c, 1) > 0)
- {
- if(c == '\r') continue;
- else m_hdr += c;
+ while(Receive(&c, 1) > 0) {
+ if(c == '\r') {
+ continue;
+ } else {
+ m_hdr += c;
+ }
int len = m_hdr.GetLength();
- if(len >= 2 && m_hdr[len-2] == '\n' && m_hdr[len-1] == '\n')
- {
+ if(len >= 2 && m_hdr[len-2] == '\n' && m_hdr[len-1] == '\n') {
Header();
return;
}
@@ -330,40 +315,34 @@ void CWebClientSocket::OnClose(int nErrorCode) bool CWebClientSocket::OnCommand(CStringA& hdr, CStringA& body, CStringA& mime)
{
CString arg;
- if(m_request.Lookup(_T("wm_command"), arg))
- {
+ if(m_request.Lookup(_T("wm_command"), arg)) {
int id = _ttol(arg);
- if(id > 0)
- {
- if(id == ID_FILE_EXIT) m_pMainFrame->PostMessage(WM_COMMAND, id);
- else m_pMainFrame->SendMessage(WM_COMMAND, id);
- }
- else
- {
- if(arg == CMD_SETPOS && m_request.Lookup(_T("position"), arg))
- {
+ if(id > 0) {
+ if(id == ID_FILE_EXIT) {
+ m_pMainFrame->PostMessage(WM_COMMAND, id);
+ } else {
+ m_pMainFrame->SendMessage(WM_COMMAND, id);
+ }
+ } else {
+ if(arg == CMD_SETPOS && m_request.Lookup(_T("position"), arg)) {
int h, m, s, ms = 0;
TCHAR c;
- if(_stscanf(arg, _T("%d%c%d%c%d%c%d"), &h, &c, &m, &c, &s, &c, &ms) >= 5)
- {
+ if(_stscanf(arg, _T("%d%c%d%c%d%c%d"), &h, &c, &m, &c, &s, &c, &ms) >= 5) {
REFERENCE_TIME rtPos = 10000i64*(((h*60+m)*60+s)*1000+ms);
m_pMainFrame->SeekTo(rtPos);
- for(int retries = 20; retries-- > 0; Sleep(50))
- {
- if(abs((int)((rtPos - m_pMainFrame->GetPos())/10000)) < 100)
+ for(int retries = 20; retries-- > 0; Sleep(50)) {
+ if(abs((int)((rtPos - m_pMainFrame->GetPos())/10000)) < 100) {
break;
+ }
}
}
- }
- else if(arg == CMD_SETPOS && m_request.Lookup(_T("percent"), arg))
- {
+ } else if(arg == CMD_SETPOS && m_request.Lookup(_T("percent"), arg)) {
float percent = 0;
- if(_stscanf_s(arg, _T("%f"), &percent) == 1)
+ if(_stscanf_s(arg, _T("%f"), &percent) == 1) {
m_pMainFrame->SeekTo((REFERENCE_TIME)(percent / 100 * m_pMainFrame->GetDur()));
- }
- else if(arg == CMD_SETVOLUME && m_request.Lookup(_T("volume"), arg))
- {
+ }
+ } else if(arg == CMD_SETVOLUME && m_request.Lookup(_T("volume"), arg)) {
int volume = _tcstol(arg, NULL, 10);
m_pMainFrame->m_wndToolBar.Volume = min(max(volume, 1), 100);
m_pMainFrame->OnPlayVolume(0);
@@ -372,8 +351,9 @@ bool CWebClientSocket::OnCommand(CStringA& hdr, CStringA& body, CStringA& mime) }
CString ref;
- if(!m_hdrlines.Lookup(_T("referer"), ref))
+ if(!m_hdrlines.Lookup(_T("referer"), ref)) {
return true;
+ }
hdr =
"HTTP/1.0 302 Found\r\n"
@@ -390,8 +370,7 @@ bool CWebClientSocket::OnIndex(CStringA& hdr, CStringA& body, CStringA& mime) AppSettings& s = AfxGetAppSettings();
POSITION pos = s.wmcmds.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
wmcmd& wc = s.wmcmds.GetNext(pos);
CStringA str;
str.Format("%d", wc.cmd);
@@ -409,19 +388,18 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime) {
CAtlList<CStringA> rootdrives;
for(TCHAR drive[] = _T("A:"); drive[0] <= 'Z'; drive[0]++)
- if(GetDriveType(drive) != DRIVE_NO_ROOT_DIR)
+ if(GetDriveType(drive) != DRIVE_NO_ROOT_DIR) {
rootdrives.AddTail(CStringA(drive) + '\\');
+ }
// process GET
CString path;
CFileStatus fs;
- if(m_get.Lookup(_T("path"), path))
- {
+ if(m_get.Lookup(_T("path"), path)) {
path = WToT(UTF8To16(TToA(path)));
- if(CFileGetStatus(path, fs) && !(fs.m_attribute&CFile::directory))
- {
+ if(CFileGetStatus(path, fs) && !(fs.m_attribute&CFile::directory)) {
// TODO: make a new message for just opening files, this is a bit overkill now...
CAtlList<CString> cmdln;
@@ -429,28 +407,26 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime) cmdln.AddTail(path);
CString focus;
- if(m_get.Lookup(_T("focus"), focus) && !focus.CompareNoCase(_T("no")))
+ if(m_get.Lookup(_T("focus"), focus) && !focus.CompareNoCase(_T("no"))) {
cmdln.AddTail(_T("/nofocus"));
+ }
int len = 0;
POSITION pos = cmdln.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CString& str = cmdln.GetNext(pos);
len += (str.GetLength()+1)*sizeof(TCHAR);
}
CAutoVectorPtr<BYTE> buff;
- if(buff.Allocate(4+len))
- {
+ if(buff.Allocate(4+len)) {
BYTE* p = buff;
*(DWORD*)p = cmdln.GetCount();
p += sizeof(DWORD);
POSITION pos = cmdln.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CString& str = cmdln.GetNext(pos);
len = (str.GetLength()+1)*sizeof(TCHAR);
memcpy(p, (LPCTSTR)str, len);
@@ -468,25 +444,22 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime) p.RemoveFileSpec();
path = (LPCTSTR)p;
}
- }
- else
- {
+ } else {
path = m_pMainFrame->m_wndPlaylistBar.GetCurFileName();
- if(CFileGetStatus(path, fs) && !(fs.m_attribute&CFile::directory))
- {
+ if(CFileGetStatus(path, fs) && !(fs.m_attribute&CFile::directory)) {
CPath p(path);
p.RemoveFileSpec();
path = (LPCTSTR)p;
}
}
- if(path.Find(_T("://")) >= 0)
+ if(path.Find(_T("://")) >= 0) {
path.Empty();
+ }
if(CFileGetStatus(path, fs) && (fs.m_attribute&CFile::directory)
- || path.Find(_T("\\")) == 0) // FIXME
- {
+ || path.Find(_T("\\")) == 0) { // FIXME
CPath p(path);
p.Canonicalize();
p.MakePretty();
@@ -496,11 +469,9 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime) CStringA files;
- if(path.IsEmpty())
- {
+ if(path.IsEmpty()) {
POSITION pos = rootdrives.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CStringA& drive = rootdrives.GetNext(pos);
files += "<tr class=\"dir\">\r\n";
@@ -513,13 +484,10 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime) }
path = "Root";
- }
- else
- {
+ } else {
CString parent;
- if(path.GetLength() > 3)
- {
+ if(path.GetLength() > 3) {
CPath p(path + "..");
p.Canonicalize();
p.AddBackslash();
@@ -537,12 +505,11 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime) WIN32_FIND_DATA fd = {0};
HANDLE hFind = FindFirstFile(path + "*.*", &fd);
- if(hFind != INVALID_HANDLE_VALUE)
- {
- do
- {
- if(!(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) || fd.cFileName[0] == '.')
+ if(hFind != INVALID_HANDLE_VALUE) {
+ do {
+ if(!(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) || fd.cFileName[0] == '.') {
continue;
+ }
CString fullpath = path + fd.cFileName;
@@ -553,23 +520,23 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime) "<td class=\"dirsize\"> </td>\r\n"
"<td class=\"dirdate\"><nobr>" + CStringA(CTime(fd.ftLastWriteTime).Format(_T("%Y.%m.%d %H:%M"))) + "</nobr></td>";
files += "</tr>\r\n";
- }
- while(FindNextFile(hFind, &fd));
+ } while(FindNextFile(hFind, &fd));
FindClose(hFind);
}
hFind = FindFirstFile(path + "*.*", &fd);
- if(hFind != INVALID_HANDLE_VALUE)
- {
- do
- {
- if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
+ if(hFind != INVALID_HANDLE_VALUE) {
+ do {
+ if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
continue;
+ }
CString fullpath = path + fd.cFileName;
TCHAR *ext = _tcsrchr(fd.cFileName, '.');
- if (ext != NULL) ext++;
+ if (ext != NULL) {
+ ext++;
+ }
CStringA size;
size.Format("%I64dK", ((UINT64)fd.nFileSizeHigh<<22)|(fd.nFileSizeLow>>10));
@@ -577,18 +544,18 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime) CString type(_T(" "));
LoadType(fullpath, type);
- if (ext != NULL)
+ if (ext != NULL) {
files += "<tr class=\"" + UTF8(ext) + "\">\r\n";
- else
+ } else {
files += "<tr class=\"noext\">\r\n";
+ }
files +=
"<td class=\"filename\"><a href=\"[path]?path=" + UTF8Arg(fullpath) + "\">" + UTF8(fd.cFileName) + "</a></td>"
"<td class=\"filetype\"><nobr>" + UTF8(type) + "</nobr></td>"
"<td class=\"filesize\" align=\"right\"><nobr>" + size + "</nobr></td>\r\n"
"<td class=\"filedate\"><nobr>" + CStringA(CTime(fd.ftLastWriteTime).Format(_T("%Y.%m.%d %H:%M"))) + "</nobr></td>";
files += "</tr>\r\n";
- }
- while(FindNextFile(hFind, &fd));
+ } while(FindNextFile(hFind, &fd));
FindClose(hFind);
}
@@ -607,8 +574,7 @@ bool CWebClientSocket::OnControls(CStringA& hdr, CStringA& body, CStringA& mime) CString path = m_pMainFrame->m_wndPlaylistBar.GetCurFileName();
CString dir;
- if(!path.IsEmpty())
- {
+ if(!path.IsEmpty()) {
CPath p(path);
p.RemoveFileSpec();
dir = (LPCTSTR)p;
@@ -618,20 +584,19 @@ bool CWebClientSocket::OnControls(CStringA& hdr, CStringA& body, CStringA& mime) CString state;
state.Format(_T("%d"), fs);
CString statestring;
- switch(fs)
- {
- case State_Stopped:
- statestring = ResStr(IDS_CONTROLS_STOPPED);
- break;
- case State_Paused:
- statestring = ResStr(IDS_CONTROLS_PAUSED);
- break;
- case State_Running:
- statestring = ResStr(IDS_CONTROLS_PLAYING);
- break;
- default:
- statestring = _T("n/a");
- break;
+ switch(fs) {
+ case State_Stopped:
+ statestring = ResStr(IDS_CONTROLS_STOPPED);
+ break;
+ case State_Paused:
+ statestring = ResStr(IDS_CONTROLS_PAUSED);
+ break;
+ case State_Running:
+ statestring = ResStr(IDS_CONTROLS_PLAYING);
+ break;
+ default:
+ statestring = _T("n/a");
+ break;
}
int pos = (int)(m_pMainFrame->GetPos()/10000);
@@ -642,8 +607,8 @@ bool CWebClientSocket::OnControls(CStringA& hdr, CStringA& body, CStringA& mime) duration.Format(_T("%d"), dur);
CString positionstring, durationstring, playbackrate;
-// positionstring.Format(_T("%02d:%02d:%02d.%03d"), (pos/3600000), (pos/60000)%60, (pos/1000)%60, pos%1000);
-// durationstring.Format(_T("%02d:%02d:%02d.%03d"), (dur/3600000), (dur/60000)%60, (dur/1000)%60, dur%1000);
+ // positionstring.Format(_T("%02d:%02d:%02d.%03d"), (pos/3600000), (pos/60000)%60, (pos/1000)%60, pos%1000);
+ // durationstring.Format(_T("%02d:%02d:%02d.%03d"), (dur/3600000), (dur/60000)%60, (dur/1000)%60, dur%1000);
positionstring.Format(_T("%02d:%02d:%02d"), (pos/3600000), (pos/60000)%60, (pos/1000)%60);
durationstring.Format(_T("%02d:%02d:%02d"), (dur/3600000), (dur/60000)%60, (dur/1000)%60);
playbackrate = _T("1"); // TODO
@@ -693,20 +658,19 @@ bool CWebClientSocket::OnStatus(CStringA& hdr, CStringA& body, CStringA& mime) CString status;// = m_pMainFrame->GetStatusMessage();
OAFilterState fs = m_pMainFrame->GetMediaState();
- switch (fs)
- {
- case State_Stopped:
- status = ResStr(IDS_CONTROLS_STOPPED);
- break;
- case State_Paused:
- status = ResStr(IDS_CONTROLS_PAUSED);
- break;
- case State_Running:
- status = ResStr(IDS_CONTROLS_PLAYING);
- break;
- default:
- status = _T("n/a");
- break;
+ switch (fs) {
+ case State_Stopped:
+ status = ResStr(IDS_CONTROLS_STOPPED);
+ break;
+ case State_Paused:
+ status = ResStr(IDS_CONTROLS_PAUSED);
+ break;
+ case State_Running:
+ status = ResStr(IDS_CONTROLS_PLAYING);
+ break;
+ default:
+ status = _T("n/a");
+ break;
}
int pos = (int)(m_pMainFrame->GetPos()/10000);
@@ -751,10 +715,8 @@ bool CWebClientSocket::OnSnapShotJpeg(CStringA& hdr, CStringA& body, CStringA& m BYTE* pData = NULL;
long size = 0;
CAtlArray<BYTE> jpeg;
- if(m_pMainFrame->GetDIB(&pData, size, true))
- {
- if(CJpegEncoderMem().Encode(pData, jpeg))
- {
+ if(m_pMainFrame->GetDIB(&pData, size, true)) {
+ if(CJpegEncoderMem().Encode(pData, jpeg)) {
hdr +=
"Expires: Thu, 19 Nov 1981 08:52:00 GMT\r\n"
"Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\r\n"
@@ -773,18 +735,21 @@ bool CWebClientSocket::OnSnapShotJpeg(CStringA& hdr, CStringA& body, CStringA& m bool CWebClientSocket::OnConvRes(CStringA& hdr, CStringA& body, CStringA& mime)
{
CString id;
- if(!m_get.Lookup(_T("id"), id))
+ if(!m_get.Lookup(_T("id"), id)) {
return false;
+ }
DWORD key = 0;
- if(1 != _stscanf_s(id, _T("%x"), &key) || key == 0)
+ if(1 != _stscanf_s(id, _T("%x"), &key) || key == 0) {
return false;
+ }
CAutoLock cAutoLock(&CDSMResource::m_csResources);
CDSMResource* res = NULL;
- if(!CDSMResource::m_resources.Lookup(key, res) || !res)
+ if(!CDSMResource::m_resources.Lookup(key, res) || !res) {
return false;
+ }
body = CStringA((const char*)res->data.GetData(), res->data.GetCount());
mime = CString(res->mime);
diff --git a/src/apps/mplayerc/WebClientSocket.h b/src/apps/mplayerc/WebClientSocket.h index 15ab6a4c3..041aa2492 100644 --- a/src/apps/mplayerc/WebClientSocket.h +++ b/src/apps/mplayerc/WebClientSocket.h @@ -32,8 +32,7 @@ class CWebClientSocket : public CAsyncSocket CString m_hdr;
- struct cookie_attribs
- {
+ struct cookie_attribs {
CString path, expire, domain;
};
CAtlStringMap<cookie_attribs> m_cookieattribs;
diff --git a/src/apps/mplayerc/WebServer.cpp b/src/apps/mplayerc/WebServer.cpp index 3859340ec..aeac3fad8 100644 --- a/src/apps/mplayerc/WebServer.cpp +++ b/src/apps/mplayerc/WebServer.cpp @@ -39,8 +39,7 @@ CWebServer::CWebServer(CMainFrame* pMainFrame, int nPort) : m_pMainFrame(pMainFrame)
, m_nPort(nPort)
{
- if(m_internalpages.IsEmpty())
- {
+ if(m_internalpages.IsEmpty()) {
m_internalpages[_T("/")] = &CWebClientSocket::OnIndex;
m_internalpages[_T("/index.html")] = &CWebClientSocket::OnIndex;
m_internalpages[_T("/browser.html")] = &CWebClientSocket::OnBrowser;
@@ -53,8 +52,7 @@ CWebServer::CWebServer(CMainFrame* pMainFrame, int nPort) m_internalpages[_T("/convres.html")] = &CWebClientSocket::OnConvRes;
}
- if(m_downloads.IsEmpty())
- {
+ if(m_downloads.IsEmpty()) {
m_downloads[_T("/default.css")] = IDF_DEFAULT_CSS;
m_downloads[_T("/vbg.gif")] = IDF_VBR_GIF;
m_downloads[_T("/vbs.gif")] = IDF_VBS_GIF;
@@ -92,18 +90,17 @@ CWebServer::CWebServer(CMainFrame* pMainFrame, int nPort) CRegKey key;
CString str(_T("MIME\\Database\\Content Type"));
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, str, KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, str, KEY_READ)) {
TCHAR buff[256];
DWORD len = countof(buff);
- for(int i = 0; ERROR_SUCCESS == key.EnumKey(i, buff, &len); i++, len = countof(buff))
- {
+ for(int i = 0; ERROR_SUCCESS == key.EnumKey(i, buff, &len); i++, len = countof(buff)) {
CRegKey mime;
TCHAR ext[64];
ULONG len = countof(ext);
if(ERROR_SUCCESS == mime.Open(HKEY_CLASSES_ROOT, str + _T("\\") + buff, KEY_READ)
- && ERROR_SUCCESS == mime.QueryStringValue(_T("Extension"), ext, &len))
+ && ERROR_SUCCESS == mime.QueryStringValue(_T("Extension"), ext, &len)) {
m_mimes[CStringA(ext).MakeLower()] = CStringA(buff).MakeLower();
+ }
}
}
@@ -124,20 +121,26 @@ CWebServer::CWebServer(CMainFrame* pMainFrame, int nPort) WebRoot.Replace('/', '\\');
WebRoot.Trim();
CPath p(WebRoot);
- if(WebRoot.Find(_T(":\\")) < 0 && WebRoot.Find(_T("\\\\")) < 0) m_webroot.Append(WebRoot);
- else m_webroot = p;
+ if(WebRoot.Find(_T(":\\")) < 0 && WebRoot.Find(_T("\\\\")) < 0) {
+ m_webroot.Append(WebRoot);
+ } else {
+ m_webroot = p;
+ }
m_webroot.Canonicalize();
m_webroot.MakePretty();
- if(!m_webroot.IsDirectory()) m_webroot = CPath();
+ if(!m_webroot.IsDirectory()) {
+ m_webroot = CPath();
+ }
CAtlList<CString> sl;
Explode(AfxGetAppSettings().strWebServerCGI, sl, ';');
POSITION pos = sl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CAtlList<CString> sl2;
CString ext = Explode(sl.GetNext(pos), sl2, '=', 2);
- if(sl2.GetCount() < 2) continue;
+ if(sl2.GetCount() < 2) {
+ continue;
+ }
m_cgi[ext] = sl2.GetTail();
}
@@ -147,11 +150,11 @@ CWebServer::CWebServer(CMainFrame* pMainFrame, int nPort) CWebServer::~CWebServer()
{
- if(m_hThread != NULL)
- {
+ if(m_hThread != NULL) {
PostThreadMessage(m_ThreadId, WM_QUIT, 0, 0);
- if (WaitForSingleObject(m_hThread, 10000) == WAIT_TIMEOUT)
+ if (WaitForSingleObject(m_hThread, 10000) == WAIT_TIMEOUT) {
TerminateThread (m_hThread, 0xDEAD);
+ }
EXECUTE_ASSERT(CloseHandle(m_hThread));
}
}
@@ -163,14 +166,14 @@ DWORD WINAPI CWebServer::StaticThreadProc(LPVOID lpParam) DWORD CWebServer::ThreadProc()
{
- if(!AfxSocketInit(NULL))
+ if(!AfxSocketInit(NULL)) {
return (DWORD)-1;
+ }
CWebServerSocket s(this, m_nPort);
MSG msg;
- while((int)GetMessage(&msg, NULL, 0, 0) > 0)
- {
+ while((int)GetMessage(&msg, NULL, 0, 0) > 0) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -180,8 +183,7 @@ DWORD CWebServer::ThreadProc() static void PutFileContents(LPCTSTR fn, const CStringA& data)
{
- if(FILE* f = _tfopen(fn, _T("wb")))
- {
+ if(FILE* f = _tfopen(fn, _T("wb"))) {
fwrite((LPCSTR)data, 1, data.GetLength(), f);
fclose(f);
}
@@ -190,27 +192,36 @@ static void PutFileContents(LPCTSTR fn, const CStringA& data) void CWebServer::Deploy(CString dir)
{
CStringA data;
- if(LoadResource(IDR_HTML_INDEX, data, RT_HTML)) PutFileContents(dir + _T("index.html"), data);
- if(LoadResource(IDR_HTML_BROWSER, data, RT_HTML)) PutFileContents(dir + _T("browser.html"), data);
- if(LoadResource(IDR_HTML_CONTROLS, data, RT_HTML)) PutFileContents(dir + _T("controls.html"), data);
- if(LoadResource(IDR_HTML_404, data, RT_HTML)) PutFileContents(dir + _T("404.html"), data);
- if(LoadResource(IDR_HTML_PLAYER, data, RT_HTML)) PutFileContents(dir + _T("player.html"), data);
+ if(LoadResource(IDR_HTML_INDEX, data, RT_HTML)) {
+ PutFileContents(dir + _T("index.html"), data);
+ }
+ if(LoadResource(IDR_HTML_BROWSER, data, RT_HTML)) {
+ PutFileContents(dir + _T("browser.html"), data);
+ }
+ if(LoadResource(IDR_HTML_CONTROLS, data, RT_HTML)) {
+ PutFileContents(dir + _T("controls.html"), data);
+ }
+ if(LoadResource(IDR_HTML_404, data, RT_HTML)) {
+ PutFileContents(dir + _T("404.html"), data);
+ }
+ if(LoadResource(IDR_HTML_PLAYER, data, RT_HTML)) {
+ PutFileContents(dir + _T("player.html"), data);
+ }
POSITION pos = m_downloads.GetStartPosition();
- while(pos)
- {
+ while(pos) {
CString fn;
UINT id;
m_downloads.GetNextAssoc(pos, fn, id);
- if(LoadResource(id, data, _T("FILE")))
+ if(LoadResource(id, data, _T("FILE"))) {
PutFileContents(dir + fn, data);
+ }
}
}
bool CWebServer::ToLocalPath(CString& path, CString& redir)
{
- if(!path.IsEmpty() && m_webroot.IsDirectory())
- {
+ if(!path.IsEmpty() && m_webroot.IsDirectory()) {
CString str = path;
str.Replace('/', '\\');
str.TrimLeft('\\');
@@ -219,29 +230,27 @@ bool CWebServer::ToLocalPath(CString& path, CString& redir) p.Combine(m_webroot, str);
p.Canonicalize();
- if(p.IsDirectory())
- {
+ if(p.IsDirectory()) {
CAtlList<CString> sl;
Explode(AfxGetAppSettings().strWebDefIndex, sl, ';');
POSITION pos = sl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
str = sl.GetNext(pos);
CPath p2 = p;
p2.Append(str);
- if(p2.FileExists())
- {
+ if(p2.FileExists()) {
p = p2;
redir = path;
- if(redir.GetAt(redir.GetLength()-1) != '/') redir += '/';
+ if(redir.GetAt(redir.GetLength()-1) != '/') {
+ redir += '/';
+ }
redir += str;
break;
}
}
}
- if(_tcslen(p) > _tcslen(m_webroot) && p.FileExists())
- {
+ if(_tcslen(p) > _tcslen(m_webroot) && p.FileExists()) {
path = (LPCTSTR)p;
return true;
}
@@ -253,10 +262,8 @@ bool CWebServer::ToLocalPath(CString& path, CString& redir) bool CWebServer::LoadPage(UINT resid, CStringA& str, CString path)
{
CString redir;
- if(ToLocalPath(path, redir))
- {
- if(FILE* f = _tfopen(path, _T("rb")))
- {
+ if(ToLocalPath(path, redir)) {
+ if(FILE* f = _tfopen(path, _T("rb"))) {
fseek(f, 0, 2);
char* buff = str.GetBufferSetLength(ftell(f));
fseek(f, 0, 0);
@@ -272,12 +279,10 @@ bool CWebServer::LoadPage(UINT resid, CStringA& str, CString path) void CWebServer::OnAccept(CWebServerSocket* pServer)
{
CAutoPtr<CWebClientSocket> p(DNew CWebClientSocket(this, m_pMainFrame));
- if(pServer->Accept(*p))
- {
+ if(pServer->Accept(*p)) {
CString name;
UINT port;
- if(AfxGetAppSettings().fWebServerLocalhostOnly && p->GetPeerName(name, port) && name != _T("127.0.0.1"))
- {
+ if(AfxGetAppSettings().fWebServerLocalhostOnly && p->GetPeerName(name, port) && name != _T("127.0.0.1")) {
p->Close();
return;
}
@@ -289,11 +294,9 @@ void CWebServer::OnAccept(CWebServerSocket* pServer) void CWebServer::OnClose(CWebClientSocket* pClient)
{
POSITION pos = m_clients.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
POSITION cur = pos;
- if(m_clients.GetNext(pos) == pClient)
- {
+ if(m_clients.GetNext(pos) == pClient) {
m_clients.RemoveAt(cur);
break;
}
@@ -305,38 +308,37 @@ void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& b CPath p(pClient->m_path);
CStringA ext = p.GetExtension().MakeLower();
CStringA mime;
- if(ext.IsEmpty()) mime = "text/html";
- else m_mimes.Lookup(ext, mime);
+ if(ext.IsEmpty()) {
+ mime = "text/html";
+ } else {
+ m_mimes.Lookup(ext, mime);
+ }
hdr = "HTTP/1.0 200 OK\r\n";
bool fHandled = false, fCGI = false;
- if(!fHandled && m_webroot.IsDirectory())
- {
+ if(!fHandled && m_webroot.IsDirectory()) {
CStringA tmphdr;
fHandled = fCGI = CallCGI(pClient, tmphdr, body, mime);
- if(fHandled)
- {
+ if(fHandled) {
tmphdr.Replace("\r\n", "\n");
CAtlList<CStringA> hdrlines;
ExplodeMin(tmphdr, hdrlines, '\n');
POSITION pos = hdrlines.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
POSITION cur = pos;
CAtlList<CStringA> sl;
CStringA key = Explode(hdrlines.GetNext(pos), sl, ':', 2);
- if(sl.GetCount() < 2) continue;
+ if(sl.GetCount() < 2) {
+ continue;
+ }
key.Trim().MakeLower();
- if(key == "content-type")
- {
+ if(key == "content-type") {
mime = sl.GetTail().Trim();
hdrlines.RemoveAt(cur);
- }
- else if(key == "content-length")
- {
+ } else if(key == "content-length") {
hdrlines.RemoveAt(cur);
}
}
@@ -347,15 +349,17 @@ void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& b }
RequestHandler rh = NULL;
- if(!fHandled && m_internalpages.Lookup(pClient->m_path, rh) && (pClient->*rh)(hdr, body, mime))
- {
- if(mime.IsEmpty()) mime = "text/html";
+ if(!fHandled && m_internalpages.Lookup(pClient->m_path, rh) && (pClient->*rh)(hdr, body, mime)) {
+ if(mime.IsEmpty()) {
+ mime = "text/html";
+ }
CString redir;
if(pClient->m_get.Lookup(_T("redir"), redir)
- || pClient->m_post.Lookup(_T("redir"), redir))
- {
- if(redir.IsEmpty()) redir = '/';
+ || pClient->m_post.Lookup(_T("redir"), redir)) {
+ if(redir.IsEmpty()) {
+ redir = '/';
+ }
hdr =
"HTTP/1.0 302 Found\r\n"
@@ -366,44 +370,40 @@ void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& b fHandled = true;
}
- if(!fHandled && m_webroot.IsDirectory())
- {
+ if(!fHandled && m_webroot.IsDirectory()) {
fHandled = LoadPage(0, body, pClient->m_path);
}
UINT resid;
CStringA res;
- if(!fHandled && m_downloads.Lookup(pClient->m_path, resid) && LoadResource(resid, res, _T("FILE")))
- {
- if(mime.IsEmpty()) mime = "application/octet-stream";
+ if(!fHandled && m_downloads.Lookup(pClient->m_path, resid) && LoadResource(resid, res, _T("FILE"))) {
+ if(mime.IsEmpty()) {
+ mime = "application/octet-stream";
+ }
memcpy(body.GetBufferSetLength(res.GetLength()), res.GetBuffer(), res.GetLength());
fHandled = true;
}
- if(!fHandled)
- {
+ if(!fHandled) {
hdr = mime == "text/html"
? "HTTP/1.0 301 Moved Permanently\r\n" "Location: /404.html\r\n"
: "HTTP/1.0 404 Not Found\r\n";
return;
}
- if(mime == "text/html" && !fCGI)
- {
+ if(mime == "text/html" && !fCGI) {
hdr +=
"Expires: Thu, 19 Nov 1981 08:52:00 GMT\r\n"
"Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\r\n"
"Pragma: no-cache\r\n";
CStringA debug;
- if(AfxGetAppSettings().fWebServerPrintDebugInfo)
- {
+ if(AfxGetAppSettings().fWebServerPrintDebugInfo) {
debug += "<hr>\r\n";
CString key, value;
POSITION pos;
pos = pClient->m_hdrlines.GetStartPosition();
- while(pos)
- {
+ while(pos) {
pClient->m_hdrlines.GetNextAssoc(pos, key, value);
debug += "HEADER[" + key + "] = " + value + "<br>\r\n";
}
@@ -411,26 +411,22 @@ void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& b debug += "path: " + pClient->m_path + "<br>\r\n";
debug += "ver: " + pClient->m_ver + "<br>\r\n";
pos = pClient->m_get.GetStartPosition();
- while(pos)
- {
+ while(pos) {
pClient->m_get.GetNextAssoc(pos, key, value);
debug += "GET[" + key + "] = " + value + "<br>\r\n";
}
pos = pClient->m_post.GetStartPosition();
- while(pos)
- {
+ while(pos) {
pClient->m_post.GetNextAssoc(pos, key, value);
debug += "POST[" + key + "] = " + value + "<br>\r\n";
}
pos = pClient->m_cookie.GetStartPosition();
- while(pos)
- {
+ while(pos) {
pClient->m_cookie.GetNextAssoc(pos, key, value);
debug += "COOKIE[" + key + "] = " + value + "<br>\r\n";
}
pos = pClient->m_request.GetStartPosition();
- while(pos)
- {
+ while(pos) {
pClient->m_request.GetNextAssoc(pos, key, value);
debug += "REQUEST[" + key + "] = " + value + "<br>\r\n";
}
@@ -450,31 +446,33 @@ void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& b // gzip
if(AfxGetAppSettings().fWebServerUseCompression && hdr.Find("Content-Encoding:") < 0)
- do
- {
+ do {
CString accept_encoding;
pClient->m_hdrlines.Lookup(_T("accept-encoding"), accept_encoding);
accept_encoding.MakeLower();
CAtlList<CString> sl;
ExplodeMin(accept_encoding, sl, ',');
- if(!sl.Find(_T("gzip"))) break;
+ if(!sl.Find(_T("gzip"))) {
+ break;
+ }
CHAR path[_MAX_PATH], fn[_MAX_PATH];
- if(!GetTempPathA(_MAX_PATH, path) || !GetTempFileNameA(path, "mpc_gz", 0, fn))
+ if(!GetTempPathA(_MAX_PATH, path) || !GetTempFileNameA(path, "mpc_gz", 0, fn)) {
break;
+ }
gzFile gf = gzopen(fn, "wb9");
- if(!gf || gzwrite(gf, (LPVOID)(LPCSTR)body, body.GetLength()) != body.GetLength())
- {
- if(gf) gzclose(gf);
+ if(!gf || gzwrite(gf, (LPVOID)(LPCSTR)body, body.GetLength()) != body.GetLength()) {
+ if(gf) {
+ gzclose(gf);
+ }
DeleteFileA(fn);
break;
}
gzclose(gf);
FILE* f = fopen(fn, "rb");
- if(!f)
- {
+ if(!f) {
DeleteFileA(fn);
break;
}
@@ -487,8 +485,7 @@ void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& b DeleteFileA(fn);
hdr += "Content-Encoding: gzip\r\n";
- }
- while(0);
+ } while(0);
CStringA content;
content.Format(
@@ -501,22 +498,26 @@ void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& b static DWORD WINAPI KillCGI(LPVOID lParam)
{
HANDLE hProcess = (HANDLE)lParam;
- if(WaitForSingleObject(hProcess, 30000) == WAIT_TIMEOUT)
+ if(WaitForSingleObject(hProcess, 30000) == WAIT_TIMEOUT) {
TerminateProcess(hProcess, 0);
+ }
return 0;
}
bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& body, CStringA& mime)
{
CString path = pClient->m_path, redir = path;
- if(!ToLocalPath(path, redir)) return false;
+ if(!ToLocalPath(path, redir)) {
+ return false;
+ }
CString ext = CPath(path).GetExtension().MakeLower();
CPath dir(path);
dir.RemoveFileSpec();
CString cgi;
- if(!m_cgi.Lookup(ext, cgi) || !CPath(cgi).FileExists())
+ if(!m_cgi.Lookup(ext, cgi) || !CPath(cgi).FileExists()) {
return false;
+ }
HANDLE hProcess = GetCurrentProcess();
HANDLE hChildStdinRd, hChildStdinWr, hChildStdinWrDup = NULL;
@@ -527,15 +528,13 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod saAttr.nLength = sizeof(saAttr);
saAttr.bInheritHandle = TRUE;
- if(CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0))
- {
+ if(CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0)) {
BOOL fSuccess = DuplicateHandle(hProcess, hChildStdoutRd, hProcess, &hChildStdoutRdDup, 0, FALSE, DUPLICATE_SAME_ACCESS);
UNUSED_ALWAYS(fSuccess);
CloseHandle(hChildStdoutRd);
}
- if(CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, 0))
- {
+ if(CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, 0)) {
BOOL fSuccess = DuplicateHandle(hProcess, hChildStdinWr, hProcess, &hChildStdinWrDup, 0, FALSE, DUPLICATE_SAME_ACCESS);
UNUSED_ALWAYS(fSuccess);
CloseHandle(hChildStdinWr);
@@ -556,14 +555,14 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod CStringA envstr;
LPVOID lpvEnv = GetEnvironmentStrings();
- if(lpvEnv)
- {
+ if(lpvEnv) {
CString str;
CAtlList<CString> env;
for(LPTSTR lpszVariable = (LPTSTR)lpvEnv; *lpszVariable; lpszVariable += _tcslen(lpszVariable)+1)
- if(lpszVariable != (LPTSTR)lpvEnv)
+ if(lpszVariable != (LPTSTR)lpvEnv) {
env.AddTail(lpszVariable);
+ }
env.AddTail(_T("GATEWAY_INTERFACE=CGI/1.1"));
env.AddTail(_T("SERVER_SOFTWARE=Media Player Classic/6.4.x.y"));
@@ -574,14 +573,15 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod env.AddTail(_T("SCRIPT_NAME=") + redir);
env.AddTail(_T("QUERY_STRING=") + pClient->m_query);
- if(pClient->m_hdrlines.Lookup(_T("content-type"), str))
+ if(pClient->m_hdrlines.Lookup(_T("content-type"), str)) {
env.AddTail(_T("CONTENT_TYPE=") + str);
- if(pClient->m_hdrlines.Lookup(_T("content-length"), str))
+ }
+ if(pClient->m_hdrlines.Lookup(_T("content-length"), str)) {
env.AddTail(_T("CONTENT_LENGTH=") + str);
+ }
POSITION pos = pClient->m_hdrlines.GetStartPosition();
- while(pos)
- {
+ while(pos) {
CString key = pClient->m_hdrlines.GetKeyAt(pos);
CString value = pClient->m_hdrlines.GetNextValue(pos);
key.Replace(_T("-"), _T("_"));
@@ -592,16 +592,14 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod CString name;
UINT port;
- if(pClient->GetPeerName(name, port))
- {
+ if(pClient->GetPeerName(name, port)) {
str.Format(_T("%d"), port);
env.AddTail(_T("REMOTE_ADDR=")+name);
env.AddTail(_T("REMOTE_HOST=")+name);
env.AddTail(_T("REMOTE_PORT=")+str);
}
- if(pClient->GetSockName(name, port))
- {
+ if(pClient->GetSockName(name, port)) {
str.Format(_T("%d"), port);
env.AddTail(_T("SERVER_NAME=")+name);
env.AddTail(_T("SERVER_PORT=")+str);
@@ -622,8 +620,7 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod if(CreateProcess(
NULL, cmdln, NULL, NULL, TRUE, 0,
envstr.GetLength() ? (LPVOID)(LPCSTR)envstr : NULL,
- dir, &siStartInfo, &piProcInfo))
- {
+ dir, &siStartInfo, &piProcInfo)) {
DWORD ThreadId;
CreateThread(NULL, 0, KillCGI, (LPVOID)piProcInfo.hProcess, 0, &ThreadId);
@@ -632,8 +629,9 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod int i = 0, len = pClient->m_data.GetLength();
for(; i < len; i += dwWritten)
- if(!WriteFile(hChildStdinWrDup, (LPCSTR)pClient->m_data + i, min(len - i, BUFFSIZE), &dwWritten, NULL))
+ if(!WriteFile(hChildStdinWrDup, (LPCSTR)pClient->m_data + i, min(len - i, BUFFSIZE), &dwWritten, NULL)) {
break;
+ }
CloseHandle(hChildStdinWrDup);
CloseHandle(hChildStdoutWr);
@@ -641,15 +639,13 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod body.Empty();
CStringA buff;
- while(i == len && ReadFile(hChildStdoutRdDup, buff.GetBuffer(BUFFSIZE), BUFFSIZE, &dwRead, NULL) && dwRead)
- {
+ while(i == len && ReadFile(hChildStdoutRdDup, buff.GetBuffer(BUFFSIZE), BUFFSIZE, &dwRead, NULL) && dwRead) {
buff.ReleaseBufferSetLength(dwRead);
body += buff;
}
int hdrend = body.Find("\r\n\r\n");
- if(hdrend >= 0)
- {
+ if(hdrend >= 0) {
hdr = body.Left(hdrend+2);
body = body.Mid(hdrend+4);
}
@@ -659,9 +655,7 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod CloseHandle(piProcInfo.hProcess);
CloseHandle(piProcInfo.hThread);
- }
- else
- {
+ } else {
body = _T("CGI Error");
}
diff --git a/src/apps/mplayerc/WebServerSocket.cpp b/src/apps/mplayerc/WebServerSocket.cpp index 726f1681d..4810aa6c5 100644 --- a/src/apps/mplayerc/WebServerSocket.cpp +++ b/src/apps/mplayerc/WebServerSocket.cpp @@ -38,8 +38,9 @@ CWebServerSocket::~CWebServerSocket() void CWebServerSocket::OnAccept(int nErrorCode)
{
- if(nErrorCode == 0 && m_pWebServer)
+ if(nErrorCode == 0 && m_pWebServer) {
m_pWebServer->OnAccept(this);
+ }
__super::OnAccept(nErrorCode);
}
diff --git a/src/apps/mplayerc/jpeg.cpp b/src/apps/mplayerc/jpeg.cpp index fa5cfe321..bcb32c098 100644 --- a/src/apps/mplayerc/jpeg.cpp +++ b/src/apps/mplayerc/jpeg.cpp @@ -29,17 +29,20 @@ bool CJpegEncoder::PutBit(int b, int n)
{
- if(n > 24 || n <= 0) return(false);
+ if(n > 24 || n <= 0) {
+ return(false);
+ }
m_bbuff <<= n;
m_bbuff |= b & ((1 << n) - 1);
m_bwidth += n;
- while(m_bwidth >= 8)
- {
+ while(m_bwidth >= 8) {
BYTE c = (BYTE)(m_bbuff >> (m_bwidth - 8));
PutByte(c);
- if(c == 0xff) PutByte(0);
+ if(c == 0xff) {
+ PutByte(0);
+ }
m_bwidth -= 8;
}
@@ -48,11 +51,12 @@ bool CJpegEncoder::PutBit(int b, int n) void CJpegEncoder::Flush()
{
- if(m_bwidth > 0)
- {
+ if(m_bwidth > 0) {
BYTE c = m_bbuff << (8 - m_bwidth);
PutByte(c);
- if(c == 0xff) PutByte(0);
+ if(c == 0xff) {
+ PutByte(0);
+ }
}
m_bbuff = m_bwidth = 0;
@@ -62,11 +66,17 @@ void CJpegEncoder::Flush() int CJpegEncoder::GetBitWidth(short q)
{
- if(q == 0) return(0);
- if(q < 0) q = -q;
+ if(q == 0) {
+ return(0);
+ }
+ if(q < 0) {
+ q = -q;
+ }
int width = 15;
- for(; !(q&0x4000); q <<= 1, width--);
+ for(; !(q&0x4000); q <<= 1, width--) {
+ ;
+ }
return(width);
}
@@ -87,8 +97,7 @@ void CJpegEncoder::WriteDQT() PutByte(size>>8);
PutByte(size&0xff);
- for(int c = 0; c < 2; c++)
- {
+ for(int c = 0; c < 2; c++) {
PutByte(c);
PutBytes(quanttbl[c], 64);
}
@@ -136,11 +145,15 @@ void CJpegEncoder::WriteDHT() PutByte(0x00); // tbl class (DC) | tbl id
PutBytes(DCVLC_NumByLength[0], 16);
- for(int i = 0; i < 12; i++) PutByte(i);
+ for(int i = 0; i < 12; i++) {
+ PutByte(i);
+ }
PutByte(0x01); // tbl class (DC) | tbl id
PutBytes(DCVLC_NumByLength[1], 16);
- for(int i = 0; i < 12; i++) PutByte(i);
+ for(int i = 0; i < 12; i++) {
+ PutByte(i);
+ }
PutByte(0x10); // tbl class (AC) | tbl id
PutBytes(ACVLC_NumByLength[0], 16);
@@ -186,29 +199,26 @@ void CJpegEncoder::WriteSOS() for(int v = 0; v < 8; v++)
for(int u = 0; u < 8; u++)
for(int j = 0; j < 8; j++)
- for(int i = 0; i < 8; i++)
+ for(int i = 0; i < 8; i++) {
cosuv[v][u][j][i] = (float)(cos((2*i+1)*u*PI/16) * cos((2*j+1)*v*PI/16));
+ }
int prevDC[3] = {0, 0, 0};
- for(int y = 0; y < m_h; y += 8)
- {
+ for(int y = 0; y < m_h; y += 8) {
int jj = min(m_h - y, 8);
- for(int x = 0; x < m_w; x += 8)
- {
+ for(int x = 0; x < m_w; x += 8) {
int ii = min(m_w - x, 8);
- for(int c = 0; c < ColorComponents; c++)
- {
+ for(int c = 0; c < ColorComponents; c++) {
int cc = !!c;
int ACs = 0;
static short block[64];
- for(int zigzag = 0; zigzag < 64; zigzag++)
- {
+ for(int zigzag = 0; zigzag < 64; zigzag++) {
BYTE u = zigzagU[zigzag];
BYTE v = zigzagV[zigzag];
@@ -218,11 +228,11 @@ void CJpegEncoder::WriteSOS() for(int i = 0; i < ii; i++)
F += (signed char)m_p[((y+j)*m_w + (x+i))*4 + c] * cosuv[v][u][j][i];
*/
- for(int j = 0; j < jj; j++)
- {
+ for(int j = 0; j < jj; j++) {
signed char* p = (signed char*)&m_p[((y+j)*m_w + x)*4 + c];
- for(int i = 0; i < ii; i++, p += 4)
+ for(int i = 0; i < ii; i++, p += 4) {
F += *p * cosuv[v][u][j][i];
+ }
}
float cu = !u ? invsq2 : 1.0f;
@@ -237,37 +247,40 @@ void CJpegEncoder::WriteSOS() int size = GetBitWidth(DC);
PutBit(DCVLC[cc][size], DCVLC_Size[cc][size]);
- if(DC < 0) DC = DC - 1;
+ if(DC < 0) {
+ DC = DC - 1;
+ }
PutBit(DC, size);
int j;
- for(j = 64; j > 1 && !block[j-1]; j--);
+ for(j = 64; j > 1 && !block[j-1]; j--) {
+ ;
+ }
- for(int i = 1; i < j; i++)
- {
+ for(int i = 1; i < j; i++) {
short AC = block[i];
- if(AC == 0)
- {
- if(++ACs == 16)
- {
+ if(AC == 0) {
+ if(++ACs == 16) {
PutBit(ACVLC[cc][15][0], ACVLC_Size[cc][15][0]);
ACs = 0;
}
- }
- else
- {
+ } else {
int size = GetBitWidth(AC);
PutBit(ACVLC[cc][ACs][size], ACVLC_Size[cc][ACs][size]);
- if(AC < 0) AC--;
+ if(AC < 0) {
+ AC--;
+ }
PutBit(AC, size);
ACs = 0;
}
}
- if(j < 64) PutBit(ACVLC[cc][0][0], ACVLC_Size[cc][0][0]);
+ if(j < 64) {
+ PutBit(ACVLC[cc][0][0], ACVLC_Size[cc][0][0]);
+ }
}
}
}
@@ -295,18 +308,21 @@ bool CJpegEncoder::Encode(const BYTE* dib) int bpp = bi->bmiHeader.biBitCount;
- if(bpp != 16 && bpp != 24 && bpp != 32) // 16 & 24 not tested!!! there may be some alignment problems when the row size is not 4*something in bytes
+ if(bpp != 16 && bpp != 24 && bpp != 32) { // 16 & 24 not tested!!! there may be some alignment problems when the row size is not 4*something in bytes
return false;
+ }
m_w = bi->bmiHeader.biWidth;
m_h = abs(bi->bmiHeader.biHeight);
m_p = DNew BYTE[m_w*m_h*4];
const BYTE* src = dib + sizeof(bi->bmiHeader);
- if(bi->bmiHeader.biBitCount <= 8)
- {
- if(bi->bmiHeader.biClrUsed) src += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]);
- else src += (1 << bi->bmiHeader.biBitCount) * DWORD(sizeof(bi->bmiColors[0]));
+ if(bi->bmiHeader.biBitCount <= 8) {
+ if(bi->bmiHeader.biClrUsed) {
+ src += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]);
+ } else {
+ src += (1 << bi->bmiHeader.biBitCount) * DWORD(sizeof(bi->bmiColors[0]));
+ }
}
int srcpitch = m_w*(bpp>>3);
@@ -318,8 +334,7 @@ bool CJpegEncoder::Encode(const BYTE* dib) (BYTE*)src + srcpitch*(m_h-1), -srcpitch, bpp);
BYTE* p = m_p;
- for(BYTE* e = p + m_h*dstpitch; p < e; p += 4)
- {
+ for(BYTE* e = p + m_h*dstpitch; p < e; p += 4) {
int r = p[2], g = p[1], b = p[0];
p[0] = (BYTE)min(max(0.2990*r+0.5870*g+0.1140*b, 0), 255) - 128;
@@ -327,11 +342,11 @@ bool CJpegEncoder::Encode(const BYTE* dib) p[2] = (BYTE)min(max(0.5000*r-0.4187*g-0.0813*b + 128, 0), 255) - 128;
}
- if(quanttbl[0][0] == 16)
- {
+ if(quanttbl[0][0] == 16) {
for(int i = 0; i < countof(quanttbl); i++)
- for(int j = 0; j < countof(quanttbl[0]); j++)
- quanttbl[i][j] >>= 2; // the default quantization table contains a little too large values
+ for(int j = 0; j < countof(quanttbl[0]); j++) {
+ quanttbl[i][j] >>= 2; // the default quantization table contains a little too large values
+ }
}
WriteSOI();
@@ -367,8 +382,9 @@ bool CJpegEncoderFile::PutBytes(const void* pData, size_t len) bool CJpegEncoderFile::Encode(const BYTE* dib)
{
m_file = _tfopen(m_fn, _T("wb"));
- if(!m_file)
+ if(!m_file) {
return false;
+ }
bool ret = __super::Encode(dib);
fclose(m_file);
m_file = NULL;
diff --git a/src/apps/mplayerc/jpeg_tables.h b/src/apps/mplayerc/jpeg_tables.h index f7b208c72..e93974720 100644 --- a/src/apps/mplayerc/jpeg_tables.h +++ b/src/apps/mplayerc/jpeg_tables.h @@ -25,8 +25,7 @@ /* Tables */
-static unsigned char quanttbl[2][64] =
-{
+static unsigned char quanttbl[2][64] = {
{
16,
11, 12,
@@ -63,8 +62,7 @@ static unsigned char quanttbl[2][64] = }
};
-static unsigned char zigzagU[64] =
-{
+static unsigned char zigzagU[64] = {
0,
1, 0,
0, 1, 2,
@@ -82,8 +80,7 @@ static unsigned char zigzagU[64] = 7,
};
-static unsigned char zigzagV[64] =
-{
+static unsigned char zigzagV[64] = {
0,
0, 1,
2, 1, 0,
@@ -101,26 +98,22 @@ static unsigned char zigzagV[64] = 7,
};
-static unsigned short DCVLC[2][12] =
-{
+static unsigned short DCVLC[2][12] = {
{0, 2, 3, 4, 5, 6, 14, 30, 62, 126, 254, 510},
{0, 1, 2, 6, 14, 30, 62, 126, 254, 510, 1022, 2046}
};
-static unsigned char DCVLC_Size[2][12] =
-{
+static unsigned char DCVLC_Size[2][12] = {
{2, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9},
{2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
};
-static unsigned char DCVLC_NumByLength[2][16] =
-{
+static unsigned char DCVLC_NumByLength[2][16] = {
{0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
};
-static unsigned short ACVLC[2][16][11] =
-{
+static unsigned short ACVLC[2][16][11] = {
{
{10, 0, 1, 4, 11, 26, 120, 248, 1014, 65410, 65410},
{0, 12, 27, 121, 502, 2038, 65412, 65413, 65414, 65415, 65416},
@@ -159,8 +152,7 @@ static unsigned short ACVLC[2][16][11] = }
};
-static unsigned char ACVLC_Size[2][16][11] =
-{
+static unsigned char ACVLC_Size[2][16][11] = {
{
{4, 2, 2, 3, 4, 5, 7, 8, 10, 16, 16},
{0, 4, 5, 7, 9, 11, 16, 16, 16, 16, 16},
@@ -199,14 +191,12 @@ static unsigned char ACVLC_Size[2][16][11] = }
};
-static unsigned char ACVLC_NumByLength[2][16] =
-{
+static unsigned char ACVLC_NumByLength[2][16] = {
{0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125},
{0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119}
};
-static unsigned char ACVLC_Data[2][162] =
-{
+static unsigned char ACVLC_Data[2][162] = {
{
0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
diff --git a/src/apps/mplayerc/libpng.c b/src/apps/mplayerc/libpng.c index ad2c6cca7..56058d407 100644 --- a/src/apps/mplayerc/libpng.c +++ b/src/apps/mplayerc/libpng.c @@ -30,7 +30,9 @@ static void read_data_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
struct png_t* png = (struct png_t*)png_get_progressive_ptr(png_ptr);
- if(png->pos + length > png->size) png_error(png_ptr, "Read Error");
+ if(png->pos + length > png->size) {
+ png_error(png_ptr, "Read Error");
+ }
memcpy(data, &png->data[png->pos], length);
png->pos += length;
}
@@ -45,34 +47,33 @@ unsigned char* DecompressPNG(struct png_t* png, int* w, int* h) unsigned char* row;
unsigned int x, y, c;
- if(png_sig_cmp(png->data, 0, 8) != 0)
+ if(png_sig_cmp(png->data, 0, 8) != 0) {
return NULL;
+ }
png->pos = 8;
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
// (png_voidp)user_error_ptr, user_error_fn, user_warning_fn);
- if(!png_ptr)
+ if(!png_ptr) {
return NULL;
+ }
png_set_read_fn(png_ptr, (png_voidp)png, read_data_fn);
info_ptr = png_create_info_struct(png_ptr);
- if(!info_ptr)
- {
+ if(!info_ptr) {
png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
return NULL;
}
end_info = png_create_info_struct(png_ptr);
- if(!end_info)
- {
+ if(!end_info) {
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
return NULL;
}
- if(setjmp(png_jmpbuf(png_ptr)))
- {
+ if(setjmp(png_jmpbuf(png_ptr))) {
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
return NULL;
}
@@ -88,8 +89,7 @@ unsigned char* DecompressPNG(struct png_t* png, int* w, int* h) PNG_TRANSFORM_BGR,
NULL);
- if(png_get_channels(png_ptr, info_ptr) != 3)
- {
+ if(png_get_channels(png_ptr, info_ptr) != 3) {
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
return NULL;
}
@@ -99,14 +99,11 @@ unsigned char* DecompressPNG(struct png_t* png, int* w, int* h) *w = info_ptr->width;
*h = info_ptr->height;
- for(y = 0; y < info_ptr->height; y++)
- {
+ for(y = 0; y < info_ptr->height; y++) {
row = &pic[y * info_ptr->width * 4];
- for(x = 0; x < info_ptr->width*3; row += 4)
- {
- for(c = 0; c < 3; c++)
- {
+ for(x = 0; x < info_ptr->width*3; row += 4) {
+ for(c = 0; c < 3; c++) {
row[c] = info_ptr->row_pointers[y][x++];
}
}
diff --git a/src/apps/mplayerc/libpng.h b/src/apps/mplayerc/libpng.h index bd306944e..7a5cf8aaa 100644 --- a/src/apps/mplayerc/libpng.h +++ b/src/apps/mplayerc/libpng.h @@ -23,8 +23,7 @@ #pragma once
-struct png_t
-{
+struct png_t {
unsigned char* data;
unsigned int size, pos;
};
@@ -39,23 +38,20 @@ extern "C" unsigned char* DecompressPNG(struct png_t* png, int* w, int* h); class CMPCPngImage : public CImage
{
public:
- bool LoadFromResource(UINT id)
- {
+ bool LoadFromResource(UINT id) {
bool ret = false;
CStringA str;
- if(LoadResource(id, str, _T("FILE")))
- {
+ if(LoadResource(id, str, _T("FILE"))) {
struct png_t png;
png.data = (unsigned char*)(LPCSTR)str;
png.size = str.GetLength();
int w, h;
- if(BYTE* p = DecompressPNG(&png, &w, &h))
- {
- if(Create(w, -h, 32))
- {
- for(int y = 0; y < h; y++)
+ if(BYTE* p = DecompressPNG(&png, &w, &h)) {
+ if(Create(w, -h, 32)) {
+ for(int y = 0; y < h; y++) {
memcpy(GetPixelAddress(0, y), &p[w*4*y], w*4);
+ }
ret = true;
}
diff --git a/src/apps/mplayerc/mpciconlib/mpciconlib.cpp b/src/apps/mplayerc/mpciconlib/mpciconlib.cpp index 58b01fff9..4c422c672 100644 --- a/src/apps/mplayerc/mpciconlib/mpciconlib.cpp +++ b/src/apps/mplayerc/mpciconlib/mpciconlib.cpp @@ -10,106 +10,207 @@ int get_icon_index(CString ext) {
int iconindex = -1;
- if(ext.CompareNoCase(_T(".3g2")) == 0) iconindex = IDI_MP4_ICON;
- else if(ext.CompareNoCase(_T(".3gp")) == 0) iconindex = IDI_MP4_ICON;
- else if(ext.CompareNoCase(_T(".3gp2")) == 0) iconindex = IDI_MP4_ICON;
- else if(ext.CompareNoCase(_T(".3gpp")) == 0) iconindex = IDI_MP4_ICON;
- else if(ext.CompareNoCase(_T(".aac")) == 0) iconindex = IDI_AAC_ICON;
- else if(ext.CompareNoCase(_T(".ac3")) == 0) iconindex = IDI_DVDA_ICON;
- else if(ext.CompareNoCase(_T(".aif")) == 0) iconindex = IDI_AIFF_ICON;
- else if(ext.CompareNoCase(_T(".aifc")) == 0) iconindex = IDI_AIFF_ICON;
- else if(ext.CompareNoCase(_T(".aiff")) == 0) iconindex = IDI_AIFF_ICON;
- else if(ext.CompareNoCase(_T(".alac")) == 0) iconindex = IDI_ALAC_ICON;
- else if(ext.CompareNoCase(_T(".amr")) == 0) iconindex = IDI_OTHER_ICON;
- else if(ext.CompareNoCase(_T(".amv")) == 0) iconindex = IDI_OTHER_ICON;
- else if(ext.CompareNoCase(_T(".ape")) == 0) iconindex = IDI_NONE;
- else if(ext.CompareNoCase(_T(".asf")) == 0) iconindex = IDI_WMV_ICON;
- else if(ext.CompareNoCase(_T(".asx")) == 0) iconindex = IDI_PLC_ICON;
- else if(ext.CompareNoCase(_T(".au")) == 0) iconindex = IDI_AU_ICON;
- else if(ext.CompareNoCase(_T(".avi")) == 0) iconindex = IDI_AVI_ICON;
- else if(ext.CompareNoCase(_T(".bik")) == 0) iconindex = IDI_BIK_ICON;
- else if(ext.CompareNoCase(_T(".cda")) == 0) iconindex = IDI_CDA_ICON;
- else if(ext.CompareNoCase(_T(".d2v")) == 0) iconindex = IDI_D2V_ICON;
- else if(ext.CompareNoCase(_T(".divx")) == 0) iconindex = IDI_AVI_ICON;
- else if(ext.CompareNoCase(_T(".dsa")) == 0) iconindex = IDI_DSM_ICON;
- else if(ext.CompareNoCase(_T(".dsm")) == 0) iconindex = IDI_DSM_ICON;
- else if(ext.CompareNoCase(_T(".dss")) == 0) iconindex = IDI_DSM_ICON;
- else if(ext.CompareNoCase(_T(".dsv")) == 0) iconindex = IDI_DSM_ICON;
- else if(ext.CompareNoCase(_T(".dts")) == 0) iconindex = IDI_DVDA_ICON;
- else if(ext.CompareNoCase(_T(".evo")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".flac")) == 0) iconindex = IDI_FLAC_ICON;
- else if(ext.CompareNoCase(_T(".flic")) == 0) iconindex = IDI_FLIC_ICON;
- else if(ext.CompareNoCase(_T(".flv")) == 0) iconindex = IDI_FLV_ICON;
- else if(ext.CompareNoCase(_T(".iflv")) == 0) iconindex = IDI_FLV_ICON;
- else if(ext.CompareNoCase(_T(".f4v")) == 0) iconindex = IDI_FLV_ICON;
- else if(ext.CompareNoCase(_T(".hdmov")) == 0) iconindex = IDI_MP4_ICON;
- else if(ext.CompareNoCase(_T(".ifo")) == 0) iconindex = IDI_DVDF_ICON;
- else if(ext.CompareNoCase(_T(".ivf")) == 0) iconindex = IDI_IVF_ICON;
- else if(ext.CompareNoCase(_T(".m1a")) == 0) iconindex = IDI_MPA_ICON;
- else if(ext.CompareNoCase(_T(".m1v")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".m2a")) == 0) iconindex = IDI_MPA_ICON;
- else if(ext.CompareNoCase(_T(".m2t")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".m2ts")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".m2v")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".m3u")) == 0) iconindex = IDI_PLC_ICON;
- else if(ext.CompareNoCase(_T(".bdmv")) == 0) iconindex = IDI_PLC_ICON;
- else if(ext.CompareNoCase(_T(".m4a")) == 0) iconindex = IDI_AAC_ICON;
- else if(ext.CompareNoCase(_T(".m4b")) == 0) iconindex = IDI_AAC_ICON;
- else if(ext.CompareNoCase(_T(".m4v")) == 0) iconindex = IDI_MP4_ICON;
- else if(ext.CompareNoCase(_T(".mid")) == 0) iconindex = IDI_MID_ICON;
- else if(ext.CompareNoCase(_T(".midi")) == 0) iconindex = IDI_MID_ICON;
- else if(ext.CompareNoCase(_T(".mka")) == 0) iconindex = IDI_MKA_ICON;
- else if(ext.CompareNoCase(_T(".mkv")) == 0) iconindex = IDI_MKV_ICON;
- else if(ext.CompareNoCase(_T(".mov")) == 0) iconindex = IDI_MOV_ICON;
- else if(ext.CompareNoCase(_T(".mp2")) == 0) iconindex = IDI_MPC_ICON;
- else if(ext.CompareNoCase(_T(".mp2v")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".mp3")) == 0) iconindex = IDI_MP3_ICON;
- else if(ext.CompareNoCase(_T(".mp4")) == 0) iconindex = IDI_MP4_ICON;
- else if(ext.CompareNoCase(_T(".mpa")) == 0) iconindex = IDI_MPA_ICON;
- else if(ext.CompareNoCase(_T(".mpc")) == 0) iconindex = IDI_MPC_ICON;
- else if(ext.CompareNoCase(_T(".mpcpl")) == 0) iconindex = IDI_PLC_ICON;
- else if(ext.CompareNoCase(_T(".mpe")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".mpeg")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".mpg")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".mpv2")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".mts")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".oga")) == 0) iconindex = IDI_OGG_ICON;
- else if(ext.CompareNoCase(_T(".ogg")) == 0) iconindex = IDI_OGG_ICON;
- else if(ext.CompareNoCase(_T(".ogm")) == 0) iconindex = IDI_OGM_ICON;
- else if(ext.CompareNoCase(_T(".ogv")) == 0) iconindex = IDI_OGM_ICON;
- else if(ext.CompareNoCase(_T(".pls")) == 0) iconindex = IDI_PLC_ICON;
- else if(ext.CompareNoCase(_T(".pva")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".pss")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".qt")) == 0) iconindex = IDI_MOV_ICON;
- else if(ext.CompareNoCase(_T(".ra")) == 0) iconindex = IDI_RA_ICON;
- else if(ext.CompareNoCase(_T(".ram")) == 0) iconindex = IDI_RM_ICON;
- else if(ext.CompareNoCase(_T(".ratdvd")) == 0) iconindex = IDI_RATDVD_ICON;
- else if(ext.CompareNoCase(_T(".rm")) == 0) iconindex = IDI_RM_ICON;
- else if(ext.CompareNoCase(_T(".rmi")) == 0) iconindex = IDI_MID_ICON;
- else if(ext.CompareNoCase(_T(".rmm")) == 0) iconindex = IDI_RM_ICON;
- else if(ext.CompareNoCase(_T(".rmvb")) == 0) iconindex = IDI_RM_ICON;
- else if(ext.CompareNoCase(_T(".rp")) == 0) iconindex = IDI_RT_ICON;
- else if(ext.CompareNoCase(_T(".rpm")) == 0) iconindex = IDI_RM_ICON;
- else if(ext.CompareNoCase(_T(".rt")) == 0) iconindex = IDI_RT_ICON;
- else if(ext.CompareNoCase(_T(".smi")) == 0) iconindex = IDI_RM_ICON;
- else if(ext.CompareNoCase(_T(".smil")) == 0) iconindex = IDI_RM_ICON;
- else if(ext.CompareNoCase(_T(".smk")) == 0) iconindex = IDI_OTHER_ICON;
- else if(ext.CompareNoCase(_T(".snd")) == 0) iconindex = IDI_AU_ICON;
- else if(ext.CompareNoCase(_T(".tp")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".tpr")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".ts")) == 0) iconindex = IDI_MPG_ICON;
- else if(ext.CompareNoCase(_T(".vob")) == 0) iconindex = IDI_DVDF_ICON;
- else if(ext.CompareNoCase(_T(".vp6")) == 0) iconindex = IDI_OTHER_ICON;
- else if(ext.CompareNoCase(_T(".wav")) == 0) iconindex = IDI_WAV_ICON;
- else if(ext.CompareNoCase(_T(".wax")) == 0) iconindex = IDI_PLC_ICON;
- else if(ext.CompareNoCase(_T(".webm")) == 0) iconindex = IDI_OTHER_ICON;
- else if(ext.CompareNoCase(_T(".wm")) == 0) iconindex = IDI_WMV_ICON;
- else if(ext.CompareNoCase(_T(".wma")) == 0) iconindex = IDI_WMA_ICON;
- else if(ext.CompareNoCase(_T(".wmp")) == 0) iconindex = IDI_WMV_ICON;
- else if(ext.CompareNoCase(_T(".wmv")) == 0) iconindex = IDI_WMV_ICON;
- else if(ext.CompareNoCase(_T(".wmx")) == 0) iconindex = IDI_PLC_ICON;
- else if(ext.CompareNoCase(_T(".wv")) == 0) iconindex = IDI_NONE;
- else if(ext.CompareNoCase(_T(".wvx")) == 0) iconindex = IDI_PLC_ICON;
+ if(ext.CompareNoCase(_T(".3g2")) == 0) {
+ iconindex = IDI_MP4_ICON;
+ } else if(ext.CompareNoCase(_T(".3gp")) == 0) {
+ iconindex = IDI_MP4_ICON;
+ } else if(ext.CompareNoCase(_T(".3gp2")) == 0) {
+ iconindex = IDI_MP4_ICON;
+ } else if(ext.CompareNoCase(_T(".3gpp")) == 0) {
+ iconindex = IDI_MP4_ICON;
+ } else if(ext.CompareNoCase(_T(".aac")) == 0) {
+ iconindex = IDI_AAC_ICON;
+ } else if(ext.CompareNoCase(_T(".ac3")) == 0) {
+ iconindex = IDI_DVDA_ICON;
+ } else if(ext.CompareNoCase(_T(".aif")) == 0) {
+ iconindex = IDI_AIFF_ICON;
+ } else if(ext.CompareNoCase(_T(".aifc")) == 0) {
+ iconindex = IDI_AIFF_ICON;
+ } else if(ext.CompareNoCase(_T(".aiff")) == 0) {
+ iconindex = IDI_AIFF_ICON;
+ } else if(ext.CompareNoCase(_T(".alac")) == 0) {
+ iconindex = IDI_ALAC_ICON;
+ } else if(ext.CompareNoCase(_T(".amr")) == 0) {
+ iconindex = IDI_OTHER_ICON;
+ } else if(ext.CompareNoCase(_T(".amv")) == 0) {
+ iconindex = IDI_OTHER_ICON;
+ } else if(ext.CompareNoCase(_T(".ape")) == 0) {
+ iconindex = IDI_NONE;
+ } else if(ext.CompareNoCase(_T(".asf")) == 0) {
+ iconindex = IDI_WMV_ICON;
+ } else if(ext.CompareNoCase(_T(".asx")) == 0) {
+ iconindex = IDI_PLC_ICON;
+ } else if(ext.CompareNoCase(_T(".au")) == 0) {
+ iconindex = IDI_AU_ICON;
+ } else if(ext.CompareNoCase(_T(".avi")) == 0) {
+ iconindex = IDI_AVI_ICON;
+ } else if(ext.CompareNoCase(_T(".bik")) == 0) {
+ iconindex = IDI_BIK_ICON;
+ } else if(ext.CompareNoCase(_T(".cda")) == 0) {
+ iconindex = IDI_CDA_ICON;
+ } else if(ext.CompareNoCase(_T(".d2v")) == 0) {
+ iconindex = IDI_D2V_ICON;
+ } else if(ext.CompareNoCase(_T(".divx")) == 0) {
+ iconindex = IDI_AVI_ICON;
+ } else if(ext.CompareNoCase(_T(".dsa")) == 0) {
+ iconindex = IDI_DSM_ICON;
+ } else if(ext.CompareNoCase(_T(".dsm")) == 0) {
+ iconindex = IDI_DSM_ICON;
+ } else if(ext.CompareNoCase(_T(".dss")) == 0) {
+ iconindex = IDI_DSM_ICON;
+ } else if(ext.CompareNoCase(_T(".dsv")) == 0) {
+ iconindex = IDI_DSM_ICON;
+ } else if(ext.CompareNoCase(_T(".dts")) == 0) {
+ iconindex = IDI_DVDA_ICON;
+ } else if(ext.CompareNoCase(_T(".evo")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".flac")) == 0) {
+ iconindex = IDI_FLAC_ICON;
+ } else if(ext.CompareNoCase(_T(".flic")) == 0) {
+ iconindex = IDI_FLIC_ICON;
+ } else if(ext.CompareNoCase(_T(".flv")) == 0) {
+ iconindex = IDI_FLV_ICON;
+ } else if(ext.CompareNoCase(_T(".iflv")) == 0) {
+ iconindex = IDI_FLV_ICON;
+ } else if(ext.CompareNoCase(_T(".f4v")) == 0) {
+ iconindex = IDI_FLV_ICON;
+ } else if(ext.CompareNoCase(_T(".hdmov")) == 0) {
+ iconindex = IDI_MP4_ICON;
+ } else if(ext.CompareNoCase(_T(".ifo")) == 0) {
+ iconindex = IDI_DVDF_ICON;
+ } else if(ext.CompareNoCase(_T(".ivf")) == 0) {
+ iconindex = IDI_IVF_ICON;
+ } else if(ext.CompareNoCase(_T(".m1a")) == 0) {
+ iconindex = IDI_MPA_ICON;
+ } else if(ext.CompareNoCase(_T(".m1v")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".m2a")) == 0) {
+ iconindex = IDI_MPA_ICON;
+ } else if(ext.CompareNoCase(_T(".m2t")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".m2ts")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".m2v")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".m3u")) == 0) {
+ iconindex = IDI_PLC_ICON;
+ } else if(ext.CompareNoCase(_T(".bdmv")) == 0) {
+ iconindex = IDI_PLC_ICON;
+ } else if(ext.CompareNoCase(_T(".m4a")) == 0) {
+ iconindex = IDI_AAC_ICON;
+ } else if(ext.CompareNoCase(_T(".m4b")) == 0) {
+ iconindex = IDI_AAC_ICON;
+ } else if(ext.CompareNoCase(_T(".m4v")) == 0) {
+ iconindex = IDI_MP4_ICON;
+ } else if(ext.CompareNoCase(_T(".mid")) == 0) {
+ iconindex = IDI_MID_ICON;
+ } else if(ext.CompareNoCase(_T(".midi")) == 0) {
+ iconindex = IDI_MID_ICON;
+ } else if(ext.CompareNoCase(_T(".mka")) == 0) {
+ iconindex = IDI_MKA_ICON;
+ } else if(ext.CompareNoCase(_T(".mkv")) == 0) {
+ iconindex = IDI_MKV_ICON;
+ } else if(ext.CompareNoCase(_T(".mov")) == 0) {
+ iconindex = IDI_MOV_ICON;
+ } else if(ext.CompareNoCase(_T(".mp2")) == 0) {
+ iconindex = IDI_MPC_ICON;
+ } else if(ext.CompareNoCase(_T(".mp2v")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".mp3")) == 0) {
+ iconindex = IDI_MP3_ICON;
+ } else if(ext.CompareNoCase(_T(".mp4")) == 0) {
+ iconindex = IDI_MP4_ICON;
+ } else if(ext.CompareNoCase(_T(".mpa")) == 0) {
+ iconindex = IDI_MPA_ICON;
+ } else if(ext.CompareNoCase(_T(".mpc")) == 0) {
+ iconindex = IDI_MPC_ICON;
+ } else if(ext.CompareNoCase(_T(".mpcpl")) == 0) {
+ iconindex = IDI_PLC_ICON;
+ } else if(ext.CompareNoCase(_T(".mpe")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".mpeg")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".mpg")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".mpv2")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".mts")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".oga")) == 0) {
+ iconindex = IDI_OGG_ICON;
+ } else if(ext.CompareNoCase(_T(".ogg")) == 0) {
+ iconindex = IDI_OGG_ICON;
+ } else if(ext.CompareNoCase(_T(".ogm")) == 0) {
+ iconindex = IDI_OGM_ICON;
+ } else if(ext.CompareNoCase(_T(".ogv")) == 0) {
+ iconindex = IDI_OGM_ICON;
+ } else if(ext.CompareNoCase(_T(".pls")) == 0) {
+ iconindex = IDI_PLC_ICON;
+ } else if(ext.CompareNoCase(_T(".pva")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".pss")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".qt")) == 0) {
+ iconindex = IDI_MOV_ICON;
+ } else if(ext.CompareNoCase(_T(".ra")) == 0) {
+ iconindex = IDI_RA_ICON;
+ } else if(ext.CompareNoCase(_T(".ram")) == 0) {
+ iconindex = IDI_RM_ICON;
+ } else if(ext.CompareNoCase(_T(".ratdvd")) == 0) {
+ iconindex = IDI_RATDVD_ICON;
+ } else if(ext.CompareNoCase(_T(".rm")) == 0) {
+ iconindex = IDI_RM_ICON;
+ } else if(ext.CompareNoCase(_T(".rmi")) == 0) {
+ iconindex = IDI_MID_ICON;
+ } else if(ext.CompareNoCase(_T(".rmm")) == 0) {
+ iconindex = IDI_RM_ICON;
+ } else if(ext.CompareNoCase(_T(".rmvb")) == 0) {
+ iconindex = IDI_RM_ICON;
+ } else if(ext.CompareNoCase(_T(".rp")) == 0) {
+ iconindex = IDI_RT_ICON;
+ } else if(ext.CompareNoCase(_T(".rpm")) == 0) {
+ iconindex = IDI_RM_ICON;
+ } else if(ext.CompareNoCase(_T(".rt")) == 0) {
+ iconindex = IDI_RT_ICON;
+ } else if(ext.CompareNoCase(_T(".smi")) == 0) {
+ iconindex = IDI_RM_ICON;
+ } else if(ext.CompareNoCase(_T(".smil")) == 0) {
+ iconindex = IDI_RM_ICON;
+ } else if(ext.CompareNoCase(_T(".smk")) == 0) {
+ iconindex = IDI_OTHER_ICON;
+ } else if(ext.CompareNoCase(_T(".snd")) == 0) {
+ iconindex = IDI_AU_ICON;
+ } else if(ext.CompareNoCase(_T(".tp")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".tpr")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".ts")) == 0) {
+ iconindex = IDI_MPG_ICON;
+ } else if(ext.CompareNoCase(_T(".vob")) == 0) {
+ iconindex = IDI_DVDF_ICON;
+ } else if(ext.CompareNoCase(_T(".vp6")) == 0) {
+ iconindex = IDI_OTHER_ICON;
+ } else if(ext.CompareNoCase(_T(".wav")) == 0) {
+ iconindex = IDI_WAV_ICON;
+ } else if(ext.CompareNoCase(_T(".wax")) == 0) {
+ iconindex = IDI_PLC_ICON;
+ } else if(ext.CompareNoCase(_T(".webm")) == 0) {
+ iconindex = IDI_OTHER_ICON;
+ } else if(ext.CompareNoCase(_T(".wm")) == 0) {
+ iconindex = IDI_WMV_ICON;
+ } else if(ext.CompareNoCase(_T(".wma")) == 0) {
+ iconindex = IDI_WMA_ICON;
+ } else if(ext.CompareNoCase(_T(".wmp")) == 0) {
+ iconindex = IDI_WMV_ICON;
+ } else if(ext.CompareNoCase(_T(".wmv")) == 0) {
+ iconindex = IDI_WMV_ICON;
+ } else if(ext.CompareNoCase(_T(".wmx")) == 0) {
+ iconindex = IDI_PLC_ICON;
+ } else if(ext.CompareNoCase(_T(".wv")) == 0) {
+ iconindex = IDI_NONE;
+ } else if(ext.CompareNoCase(_T(".wvx")) == 0) {
+ iconindex = IDI_PLC_ICON;
+ }
return iconindex;
}
diff --git a/src/apps/mplayerc/mplayerc.cpp b/src/apps/mplayerc/mplayerc.cpp index 5d1539688..f7a789c97 100644 --- a/src/apps/mplayerc/mplayerc.cpp +++ b/src/apps/mplayerc/mplayerc.cpp @@ -40,19 +40,22 @@ extern "C" { void CorrectComboListWidth(CComboBox& box, CFont* pWndFont)
{
int cnt = box.GetCount();
- if(cnt <= 0) return;
+ if(cnt <= 0) {
+ return;
+ }
CDC* pDC = box.GetDC();
pDC->SelectObject(pWndFont);
int maxw = box.GetDroppedWidth();
- for(int i = 0; i < cnt; i++)
- {
+ for(int i = 0; i < cnt; i++) {
CString str;
box.GetLBText(i, str);
int w = pDC->GetTextExtent(str).cx + 22;
- if(maxw < w) maxw = w;
+ if(maxw < w) {
+ maxw = w;
+ }
}
box.ReleaseDC(pDC);
@@ -62,60 +65,68 @@ void CorrectComboListWidth(CComboBox& box, CFont* pWndFont) HICON LoadIcon(CString fn, bool fSmall)
{
- if(fn.IsEmpty()) return(NULL);
+ if(fn.IsEmpty()) {
+ return(NULL);
+ }
CString ext = fn.Left(fn.Find(_T("://"))+1).TrimRight(':');
- if(ext.IsEmpty() || !ext.CompareNoCase(_T("file")))
+ if(ext.IsEmpty() || !ext.CompareNoCase(_T("file"))) {
ext = _T(".") + fn.Mid(fn.ReverseFind('.')+1);
+ }
CSize size(fSmall?16:32,fSmall?16:32);
- if(!ext.CompareNoCase(_T(".ifo")))
- {
- if(HICON hIcon = (HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_DVD), IMAGE_ICON, size.cx, size.cy, 0))
+ if(!ext.CompareNoCase(_T(".ifo"))) {
+ if(HICON hIcon = (HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_DVD), IMAGE_ICON, size.cx, size.cy, 0)) {
return(hIcon);
+ }
}
- if(!ext.CompareNoCase(_T(".cda")))
- {
- if(HICON hIcon = (HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_AUDIOCD), IMAGE_ICON, size.cx, size.cy, 0))
+ if(!ext.CompareNoCase(_T(".cda"))) {
+ if(HICON hIcon = (HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_AUDIOCD), IMAGE_ICON, size.cx, size.cy, 0)) {
return(hIcon);
+ }
}
- do
- {
+ do {
CRegKey key;
TCHAR buff[256];
ULONG len;
- if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext + _T("\\DefaultIcon"), KEY_READ))
- {
- if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext, KEY_READ))
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext + _T("\\DefaultIcon"), KEY_READ)) {
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext, KEY_READ)) {
break;
+ }
len = sizeof(buff)/sizeof(buff[0]);
memset(buff, 0, sizeof(buff));
- if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len) || (ext = buff).Trim().IsEmpty())
+ if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len) || (ext = buff).Trim().IsEmpty()) {
break;
+ }
- if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext + _T("\\DefaultIcon"), KEY_READ))
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext + _T("\\DefaultIcon"), KEY_READ)) {
break;
+ }
}
CString icon;
len = sizeof(buff)/sizeof(buff[0]);
memset(buff, 0, sizeof(buff));
- if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len) || (icon = buff).Trim().IsEmpty())
+ if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len) || (icon = buff).Trim().IsEmpty()) {
break;
+ }
int i = icon.ReverseFind(',');
- if(i < 0) break;
+ if(i < 0) {
+ break;
+ }
int id = 0;
- if(_stscanf_s(icon.Mid(i+1), _T("%d"), &id) != 1)
+ if(_stscanf_s(icon.Mid(i+1), _T("%d"), &id) != 1) {
break;
+ }
icon = icon.Left(i);
@@ -124,9 +135,10 @@ HICON LoadIcon(CString fn, bool fSmall) ? ExtractIconEx(icon, id, NULL, &hIcon, 1)
: ExtractIconEx(icon, id, &hIcon, NULL, 1);
UNUSED_ALWAYS(cnt);
- if(hIcon) return hIcon;
- }
- while(0);
+ if(hIcon) {
+ return hIcon;
+ }
+ } while(0);
return((HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_UNKNOWN), IMAGE_ICON, size.cx, size.cy, 0));
}
@@ -138,35 +150,43 @@ bool LoadType(CString fn, CString& type) TCHAR buff[256];
ULONG len;
- if(fn.IsEmpty()) return(NULL);
+ if(fn.IsEmpty()) {
+ return(NULL);
+ }
CString ext = fn.Left(fn.Find(_T("://"))+1).TrimRight(':');
- if(ext.IsEmpty() || !ext.CompareNoCase(_T("file")))
+ if(ext.IsEmpty() || !ext.CompareNoCase(_T("file"))) {
ext = _T(".") + fn.Mid(fn.ReverseFind('.')+1);
+ }
CString tmp = _T("");
CString mplayerc_ext = _T("mplayerc") + ext;
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, mplayerc_ext))
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, mplayerc_ext)) {
tmp = mplayerc_ext;
+ }
- if((tmp == _T("")) && (ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext)))
+ if((tmp == _T("")) && (ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext))) {
return(false);
+ }
- if(tmp == _T("")) tmp = ext;
+ if(tmp == _T("")) {
+ tmp = ext;
+ }
- while(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, tmp))
- {
+ while(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, tmp)) {
len = sizeof(buff)/sizeof(buff[0]);
memset(buff, 0, sizeof(buff));
- if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len))
+ if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len)) {
break;
+ }
CString str(buff);
str.Trim();
- if(str.IsEmpty() || str == tmp)
+ if(str.IsEmpty() || str == tmp) {
break;
+ }
tmp = str;
}
@@ -180,11 +200,17 @@ bool LoadResource(UINT resid, CStringA& str, LPCTSTR restype) {
str.Empty();
HRSRC hrsrc = FindResource(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(resid), restype);
- if(!hrsrc) return(false);
+ if(!hrsrc) {
+ return(false);
+ }
HGLOBAL hGlobal = LoadResource(AfxGetApp()->m_hInstance, hrsrc);
- if(!hGlobal) return(false);
+ if(!hGlobal) {
+ return(false);
+ }
DWORD size = SizeofResource(AfxGetApp()->m_hInstance, hrsrc);
- if(!size) return(false);
+ if(!size) {
+ return(false);
+ }
memcpy(str.GetBufferSetLength(size), LockResource(hGlobal), size);
return(true);
}
@@ -199,7 +225,7 @@ class CAboutDlg : public CDialog public:
CAboutDlg();
-// Dialog Data
+ // Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
@@ -210,15 +236,14 @@ protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
-// Implementation
+ // Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
- virtual BOOL OnInitDialog()
- {
+ virtual BOOL OnInitDialog() {
USES_CONVERSION;
UpdateData();
@@ -349,10 +374,11 @@ void CMPlayerCApp::ShowCmdlnSwitches() const {
CString s;
- if(m_s.nCLSwitches&CLSW_UNRECOGNIZEDSWITCH)
- {
+ if(m_s.nCLSwitches&CLSW_UNRECOGNIZEDSWITCH) {
CAtlList<CString> sl;
- for(int i = 0; i < __argc; i++) sl.AddTail(__targv[i]);
+ for(int i = 0; i < __argc; i++) {
+ sl.AddTail(__targv[i]);
+ }
s += ResStr(IDS_UNKNOWN_SWITCH) + Implode(sl, ' ') + _T("\n\n");
}
@@ -371,12 +397,12 @@ HWND g_hWnd = NULL; bool CMPlayerCApp::StoreSettingsToIni()
{
CString ini = GetIniPath();
-/*
- FILE* f;
- if(!(f = _tfopen(ini, _T("r+"))) && !(f = _tfopen(ini, _T("w"))))
- return StoreSettingsToRegistry();
- fclose(f);
-*/
+ /*
+ FILE* f;
+ if(!(f = _tfopen(ini, _T("r+"))) && !(f = _tfopen(ini, _T("w"))))
+ return StoreSettingsToRegistry();
+ fclose(f);
+ */
free((void*)m_pszRegistryKey);
m_pszRegistryKey = NULL;
free((void*)m_pszProfileName);
@@ -438,24 +464,22 @@ bool CMPlayerCApp::GetAppSavePath(CString& path) {
path.Empty();
- if(IsIniValid()) // If settings ini file found, store stuff in the same folder as the exe file
- {
+ if(IsIniValid()) { // If settings ini file found, store stuff in the same folder as the exe file
GetModuleFileName(AfxGetInstanceHandle(), path.GetBuffer(_MAX_PATH), _MAX_PATH);
path.ReleaseBuffer();
path = path.Left(path.ReverseFind('\\'));
- }
- else
- {
+ } else {
CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"), KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"), KEY_READ)) {
ULONG len = _MAX_PATH;
- if(ERROR_SUCCESS == key.QueryStringValue(_T("AppData"), path.GetBuffer(_MAX_PATH), &len))
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("AppData"), path.GetBuffer(_MAX_PATH), &len)) {
path.ReleaseBufferSetLength(len);
+ }
}
- if(path.IsEmpty())
+ if(path.IsEmpty()) {
return(false);
+ }
CPath p;
p.Combine(path, _T("Media Player Classic"));
@@ -469,17 +493,17 @@ bool CMPlayerCApp::GetAppSavePath(CString& path) void CMPlayerCApp::PreProcessCommandLine()
{
m_cmdln.RemoveAll();
- for(int i = 1; i < __argc; i++)
- {
+ for(int i = 1; i < __argc; i++) {
CString str = CString(__targv[i]).Trim(_T(" \""));
- if(str[0] != '/' && str[0] != '-' && str.Find(_T(":")) < 0)
- {
+ if(str[0] != '/' && str[0] != '-' && str.Find(_T(":")) < 0) {
LPTSTR p = NULL;
CString str2;
str2.ReleaseBuffer(GetFullPathName(str, _MAX_PATH, str2.GetBuffer(_MAX_PATH), &p));
CFileStatus fs;
- if(!str2.IsEmpty() && CFileGetStatus(str2, fs)) str = str2;
+ if(!str2.IsEmpty() && CFileGetStatus(str2, fs)) {
+ str = str2;
+ }
}
m_cmdln.AddTail(str);
@@ -488,17 +512,21 @@ void CMPlayerCApp::PreProcessCommandLine() void CMPlayerCApp::SendCommandLine(HWND hWnd)
{
- if(m_cmdln.IsEmpty())
+ if(m_cmdln.IsEmpty()) {
return;
+ }
int bufflen = sizeof(DWORD);
POSITION pos = m_cmdln.GetHeadPosition();
- while(pos) bufflen += (m_cmdln.GetNext(pos).GetLength()+1)*sizeof(TCHAR);
+ while(pos) {
+ bufflen += (m_cmdln.GetNext(pos).GetLength()+1)*sizeof(TCHAR);
+ }
CAutoVectorPtr<BYTE> buff;
- if(!buff.Allocate(bufflen))
+ if(!buff.Allocate(bufflen)) {
return;
+ }
BYTE* p = buff;
@@ -506,8 +534,7 @@ void CMPlayerCApp::SendCommandLine(HWND hWnd) p += sizeof(DWORD);
pos = m_cmdln.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CString s = m_cmdln.GetNext(pos);
int len = (s.GetLength()+1)*sizeof(TCHAR);
memcpy(p, s, len);
@@ -604,8 +631,7 @@ NTSTATUS WINAPI Mine_NtQueryInformationProcess(HANDLE ProcessHandle, PROCESSINFO nRet = Real_NtQueryInformationProcess(ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength, ReturnLength);
- if (ProcessInformationClass == ProcessBasicInformation)
- {
+ if (ProcessInformationClass == ProcessBasicInformation) {
PROCESS_BASIC_INFORMATION* pbi = (PROCESS_BASIC_INFORMATION*)ProcessInformation;
PEB_NT* pPEB;
PEB_NT PEB;
@@ -614,9 +640,7 @@ NTSTATUS WINAPI Mine_NtQueryInformationProcess(HANDLE ProcessHandle, PROCESSINFO ReadProcessMemory(ProcessHandle, pPEB, &PEB, sizeof(PEB), NULL);
PEB.BeingDebugged = 0;
WriteProcessMemory(ProcessHandle, pPEB, &PEB, sizeof(PEB), NULL);
- }
- else if (ProcessInformationClass == 7) // ProcessDebugPort
- {
+ } else if (ProcessInformationClass == 7) { // ProcessDebugPort
BOOL* pDebugPort = (BOOL*)ProcessInformation;
*pDebugPort = FALSE;
}
@@ -626,24 +650,18 @@ NTSTATUS WINAPI Mine_NtQueryInformationProcess(HANDLE ProcessHandle, PROCESSINFO LONG WINAPI Mine_ChangeDisplaySettingsEx(LONG ret, DWORD dwFlags, LPVOID lParam)
{
- if(dwFlags&CDS_VIDEOPARAMETERS)
- {
+ if(dwFlags&CDS_VIDEOPARAMETERS) {
VIDEOPARAMETERS* vp = (VIDEOPARAMETERS*)lParam;
if(vp->Guid == GUIDFromCString(_T("{02C62061-1097-11d1-920F-00A024DF156E}"))
- && (vp->dwFlags&VP_FLAGS_COPYPROTECT))
- {
- if(vp->dwCommand == VP_COMMAND_GET)
- {
+ && (vp->dwFlags&VP_FLAGS_COPYPROTECT)) {
+ if(vp->dwCommand == VP_COMMAND_GET) {
if((vp->dwTVStandard&VP_TV_STANDARD_WIN_VGA)
- && vp->dwTVStandard != VP_TV_STANDARD_WIN_VGA)
- {
+ && vp->dwTVStandard != VP_TV_STANDARD_WIN_VGA) {
TRACE(_T("Ooops, tv-out enabled? macrovision checks suck..."));
vp->dwTVStandard = VP_TV_STANDARD_WIN_VGA;
}
- }
- else if(vp->dwCommand == VP_COMMAND_SET)
- {
+ } else if(vp->dwCommand == VP_COMMAND_SET) {
TRACE(_T("Ooops, as I already told ya, no need for any macrovision bs here"));
return 0;
}
@@ -686,15 +704,16 @@ BOOL CreateFakeVideoTS(LPCWSTR strIFOPath, LPWSTR strFakeFile, size_t nFakeFileS WCHAR strExt[_MAX_EXT];
CIfo Ifo;
- if (!GetTempPathW(_MAX_PATH, szTempPath)) return FALSE;
+ if (!GetTempPathW(_MAX_PATH, szTempPath)) {
+ return FALSE;
+ }
_wsplitpath_s (strIFOPath, NULL, 0, NULL, 0, strFileName, countof(strFileName), strExt, countof(strExt));
_snwprintf_s (strFakeFile, nFakeFileSize, _TRUNCATE, L"%sMPC%s%s", szTempPath, strFileName, strExt);
if (Ifo.OpenFile (strIFOPath) &&
Ifo.RemoveUOPs() &&
- Ifo.SaveFile (strFakeFile))
- {
+ Ifo.SaveFile (strFakeFile)) {
bRet = TRUE;
}
@@ -709,16 +728,15 @@ HANDLE WINAPI Mine_CreateFileW(LPCWSTR p1, DWORD p2, DWORD p3, LPSECURITY_ATTRIB p3 |= FILE_SHARE_WRITE;
- if (nLen>=4 && _wcsicmp (p1 + nLen-4, L".ifo") == 0)
- {
- if (CreateFakeVideoTS(p1, strFakeFile, countof(strFakeFile)))
- {
+ if (nLen>=4 && _wcsicmp (p1 + nLen-4, L".ifo") == 0) {
+ if (CreateFakeVideoTS(p1, strFakeFile, countof(strFakeFile))) {
hFile = Real_CreateFileW(strFakeFile, p2, p3, p4, p5, p6, p7);
}
}
- if (hFile == INVALID_HANDLE_VALUE)
+ if (hFile == INVALID_HANDLE_VALUE) {
hFile = Real_CreateFileW(p1, p2, p3, p4, p5, p6, p7);
+ }
return hFile;
}
@@ -726,8 +744,9 @@ HANDLE WINAPI Mine_CreateFileW(LPCWSTR p1, DWORD p2, DWORD p3, LPSECURITY_ATTRIB MMRESULT WINAPI Mine_mixerSetControlDetails(HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails)
{
- if(fdwDetails == (MIXER_OBJECTF_HMIXER|MIXER_SETCONTROLDETAILSF_VALUE))
- return MMSYSERR_NOERROR; // don't touch the mixer, kthx
+ if(fdwDetails == (MIXER_OBJECTF_HMIXER|MIXER_SETCONTROLDETAILSF_VALUE)) {
+ return MMSYSERR_NOERROR; // don't touch the mixer, kthx
+ }
return Real_mixerSetControlDetails(hmxobj, pmxcd, fdwDetails);
}
@@ -736,8 +755,7 @@ BOOL WINAPI Mine_DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID l BOOL ret = Real_DeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped);
if(IOCTL_DVD_GET_REGION == dwIoControlCode && lpOutBuffer
- && lpBytesReturned && *lpBytesReturned == sizeof(DVD_REGION))
- {
+ && lpBytesReturned && *lpBytesReturned == sizeof(DVD_REGION)) {
DVD_REGION* pDVDRegion = (DVD_REGION*)lpOutBuffer;
pDVDRegion->SystemRegion = ~pDVDRegion->RegionData;
}
@@ -754,12 +772,11 @@ BOOL WINAPI Mine_DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID l class ssftest
{
public:
- ssftest()
- {
+ ssftest() {
Sleep(10000);
MessageBeep((UINT)-1);
-// 8; //
+ // 8; //
SubPicDesc spd;
spd.w = 640;
spd.h = 480;
@@ -782,8 +799,7 @@ public: s.Render(spd, 10000i64*i, 25, bbox);
}
*/
- try
- {
+ try {
ssf::CRenderer s(&csLock);
s.Open(_T("../../Subtitles/libssf/demo/demo.ssf"));
@@ -796,9 +812,7 @@ public: bbox.SetRectEmpty();
s.Render(spd, 10000i64*i, 25, bbox);
}
- }
- catch(ssf::Exception& e)
- {
+ } catch(ssf::Exception& e) {
UNREFERENCED_PARAMETER(e);
TRACE(_T("%s\n"), e.ToString());
ASSERT(0);
@@ -811,9 +825,12 @@ public: };
#endif
-BOOL SetHeapOptions() {
+BOOL SetHeapOptions()
+{
HMODULE hLib = LoadLibrary(L"kernel32.dll");
- if (hLib == NULL) return FALSE;
+ if (hLib == NULL) {
+ return FALSE;
+ }
typedef BOOL (WINAPI *HSI)
(HANDLE, HEAP_INFORMATION_CLASS ,PVOID, SIZE_T);
@@ -830,7 +847,9 @@ BOOL SetHeapOptions() { BOOL fRet = (pHsi)(NULL,HeapEnableTerminationOnCorruption,NULL,0)
? TRUE
: FALSE;
- if (hLib) FreeLibrary(hLib);
+ if (hLib) {
+ FreeLibrary(hLib);
+ }
return fRet;
}
@@ -846,23 +865,19 @@ BOOL CMPlayerCApp::InitInstance() #ifdef GOTHTRACE
// Used for tracing when debugger can't be used, e.g. when using some commercial decoders
// Print traces usint _tprintf()
- if (AllocConsole())
- {
+ if (AllocConsole()) {
FILE * foo; // Not used
freopen_s(&foo, "conin$", "r", stdin); // Redirect stdin etc. to console
freopen_s(&foo, "conout$", "w", stdout);
freopen_s(&foo, "conout$", "w", stderr);
- }
- else
+ } else {
AfxMessageBox(_T("Could not create console"));
+ }
#endif
- if(SetHeapOptions())
- {
+ if(SetHeapOptions()) {
TRACE(_T("Terminate on corruption enabled\n"));
- }
- else
- {
+ } else {
CString heap_err;
heap_err.Format(_T("Terminate on corruption error = %d\n"), GetLastError());
TRACE(heap_err);
@@ -883,12 +898,12 @@ BOOL CMPlayerCApp::InitInstance() HMODULE hNTDLL = LoadLibrary (_T("ntdll.dll"));
UNUSED_ALWAYS(hNTDLL);
#ifndef _DEBUG // Disable NtQueryInformationProcess in debug (prevent VS debugger to stop on crash address)
- if (hNTDLL)
- {
+ if (hNTDLL) {
Real_NtQueryInformationProcess = (FUNC_NTQUERYINFORMATIONPROCESS)GetProcAddress (hNTDLL, "NtQueryInformationProcess");
- if (Real_NtQueryInformationProcess)
+ if (Real_NtQueryInformationProcess) {
DetourAttach(&(PVOID&)Real_NtQueryInformationProcess, (PVOID)Mine_NtQueryInformationProcess);
+ }
}
#endif
@@ -898,8 +913,7 @@ BOOL CMPlayerCApp::InitInstance() ASSERT (lError == NOERROR);
HRESULT hr;
- if(FAILED(hr = OleInitialize(0)))
- {
+ if(FAILED(hr = OleInitialize(0))) {
AfxMessageBox(_T("OleInitialize failed!"));
return FALSE;
}
@@ -915,57 +929,52 @@ BOOL CMPlayerCApp::InitInstance() wndcls.lpszMenuName = NULL;
wndcls.lpszClassName = MPC_WND_CLASS_NAME;
- if(!AfxRegisterClass(&wndcls))
- {
+ if(!AfxRegisterClass(&wndcls)) {
AfxMessageBox(_T("MainFrm class registration failed!"));
return FALSE;
}
- if(!AfxSocketInit(NULL))
- {
+ if(!AfxSocketInit(NULL)) {
AfxMessageBox(_T("AfxSocketInit failed!"));
return FALSE;
}
PreProcessCommandLine();
- if(IsIniValid())
+ if(IsIniValid()) {
StoreSettingsToIni();
- else
+ } else {
StoreSettingsToRegistry();
+ }
m_s.ParseCommandLine(m_cmdln);
- if(m_s.nCLSwitches&(CLSW_HELP|CLSW_UNRECOGNIZEDSWITCH))
- {
+ if(m_s.nCLSwitches&(CLSW_HELP|CLSW_UNRECOGNIZEDSWITCH)) {
m_s.UpdateData(false);
ShowCmdlnSwitches();
return FALSE;
}
- if((m_s.nCLSwitches&CLSW_CLOSE) && m_s.slFiles.IsEmpty())
- {
+ if((m_s.nCLSwitches&CLSW_CLOSE) && m_s.slFiles.IsEmpty()) {
return FALSE;
}
m_s.UpdateData(false);
- if((m_s.nCLSwitches&CLSW_REGEXTVID) || (m_s.nCLSwitches&CLSW_REGEXTAUD))
- {
+ if((m_s.nCLSwitches&CLSW_REGEXTVID) || (m_s.nCLSwitches&CLSW_REGEXTAUD)) {
CMediaFormats& mf = m_s.m_Formats;
- for(int i = 0; i < (int)mf.GetCount(); i++)
- {
- if(!mf[i].GetLabel().CompareNoCase(ResStr(IDS_AG_PLAYLIST_FILE))) continue;
+ for(int i = 0; i < (int)mf.GetCount(); i++) {
+ if(!mf[i].GetLabel().CompareNoCase(ResStr(IDS_AG_PLAYLIST_FILE))) {
+ continue;
+ }
bool fAudioOnly = mf[i].IsAudioOnly();
int j = 0;
CString str = mf[i].GetExtsWithPeriod();
- for(CString ext = str.Tokenize(_T(" "), j); !ext.IsEmpty(); ext = str.Tokenize(_T(" "), j))
- {
- if(((m_s.nCLSwitches&CLSW_REGEXTVID) && !fAudioOnly) || ((m_s.nCLSwitches&CLSW_REGEXTAUD) && fAudioOnly))
- {
+ for(CString ext = str.Tokenize(_T(" "), j); !ext.IsEmpty(); ext = str.Tokenize(_T(" "), j)) {
+ if(((m_s.nCLSwitches&CLSW_REGEXTVID) && !fAudioOnly) || ((m_s.nCLSwitches&CLSW_REGEXTAUD) && fAudioOnly)) {
CPPageFormats::RegisterExt(ext, mf[i].GetLabel(), true);
}
}
@@ -975,16 +984,13 @@ BOOL CMPlayerCApp::InitInstance() return FALSE;
}
- if((m_s.nCLSwitches&CLSW_UNREGEXT))
- {
+ if((m_s.nCLSwitches&CLSW_UNREGEXT)) {
CMediaFormats& mf = m_s.m_Formats;
- for(int i = 0; i < (int)mf.GetCount(); i++)
- {
+ for(int i = 0; i < (int)mf.GetCount(); i++) {
int j = 0;
CString str = mf[i].GetExtsWithPeriod();
- for(CString ext = str.Tokenize(_T(" "), j); !ext.IsEmpty(); ext = str.Tokenize(_T(" "), j))
- {
+ for(CString ext = str.Tokenize(_T(" "), j); !ext.IsEmpty(); ext = str.Tokenize(_T(" "), j)) {
CPPageFormats::RegisterExt(ext, mf[i].GetLabel(), false);
}
}
@@ -994,20 +1000,17 @@ BOOL CMPlayerCApp::InitInstance() }
// Enable to open options with administrator privilege (for Vista UAC)
- if (m_s.nCLSwitches & CLSW_ADMINOPTION)
- {
- switch (m_s.iAdminOption)
- {
- case CPPageFormats::IDD :
- {
- CPPageSheet options(ResStr(IDS_OPTIONS_CAPTION), NULL, NULL, m_s.iAdminOption);
- options.LockPage();
- options.DoModal();
- }
- break;
+ if (m_s.nCLSwitches & CLSW_ADMINOPTION) {
+ switch (m_s.iAdminOption) {
+ case CPPageFormats::IDD : {
+ CPPageSheet options(ResStr(IDS_OPTIONS_CAPTION), NULL, NULL, m_s.iAdminOption);
+ options.LockPage();
+ options.DoModal();
+ }
+ break;
- default :
- ASSERT (FALSE);
+ default :
+ ASSERT (FALSE);
}
return FALSE;
}
@@ -1016,21 +1019,19 @@ BOOL CMPlayerCApp::InitInstance() if(GetLastError() == ERROR_ALREADY_EXISTS
&& (!(m_s.fAllowMultipleInst || (m_s.nCLSwitches&CLSW_NEW) || m_cmdln.IsEmpty())
- || (m_s.nCLSwitches&CLSW_ADD)))
- {
+ || (m_s.nCLSwitches&CLSW_ADD))) {
int wait_count = 0;
HWND hWnd = ::FindWindow(MPC_WND_CLASS_NAME, NULL);
- while(!hWnd && (wait_count++<200))
- {
+ while(!hWnd && (wait_count++<200)) {
Sleep(100);
hWnd = ::FindWindow(MPC_WND_CLASS_NAME, NULL);
}
- if(hWnd && (wait_count<200))
- {
+ if(hWnd && (wait_count<200)) {
SetForegroundWindow(hWnd);
- if(!(m_s.nCLSwitches&CLSW_MINIMIZED) && IsIconic(hWnd))
+ if(!(m_s.nCLSwitches&CLSW_MINIMIZED) && IsIconic(hWnd)) {
ShowWindow(hWnd, SW_RESTORE);
+ }
SendCommandLine(hWnd);
@@ -1040,15 +1041,13 @@ BOOL CMPlayerCApp::InitInstance() AfxGetMyApp()->m_AudioRendererDisplayName_CL = _T("");
- if(!__super::InitInstance())
- {
+ if(!__super::InitInstance()) {
AfxMessageBox(_T("InitInstance failed!"));
return FALSE;
}
CRegKey key;
- if(ERROR_SUCCESS == key.Create(HKEY_LOCAL_MACHINE, _T("Software\\Gabest\\Media Player Classic")))
- {
+ if(ERROR_SUCCESS == key.Create(HKEY_LOCAL_MACHINE, _T("Software\\Gabest\\Media Player Classic"))) {
CString path;
GetModuleFileName(AfxGetInstanceHandle(), path.GetBuffer(_MAX_PATH), _MAX_PATH);
path.ReleaseBuffer();
@@ -1059,8 +1058,7 @@ BOOL CMPlayerCApp::InitInstance() CMainFrame* pFrame = DNew CMainFrame;
m_pMainWnd = pFrame;
- if ( !pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW|FWS_ADDTOTITLE, NULL, NULL) )
- {
+ if ( !pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW|FWS_ADDTOTITLE, NULL, NULL) ) {
AfxMessageBox(_T("CMainFrame::LoadFrame failed!"));
return FALSE;
}
@@ -1072,9 +1070,13 @@ BOOL CMPlayerCApp::InitInstance() pFrame->UpdateWindow();
pFrame->m_hAccelTable = m_s.hAccel;
m_s.WinLircClient.SetHWND(m_pMainWnd->m_hWnd);
- if(m_s.fWinLirc) m_s.WinLircClient.Connect(m_s.strWinLircAddr);
+ if(m_s.fWinLirc) {
+ m_s.WinLircClient.Connect(m_s.strWinLircAddr);
+ }
m_s.UIceClient.SetHWND(m_pMainWnd->m_hWnd);
- if(m_s.fUIce) m_s.UIceClient.Connect(m_s.strUIceAddr);
+ if(m_s.fUIce) {
+ m_s.UIceClient.Connect(m_s.strUIceAddr);
+ }
SendCommandLine(m_pMainWnd->m_hWnd);
RegisterHotkeys();
@@ -1092,14 +1094,11 @@ UINT CMPlayerCApp::GetRemoteControlCodeMicrosoft(UINT nInputcode, HRAWINPUT hRaw // Support for MCE remote control
GetRawInputData(hRawInput, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER));
- if (dwSize > 0)
- {
+ if (dwSize > 0) {
pRawBuffer = DNew BYTE[dwSize];
- if (GetRawInputData(hRawInput, RID_INPUT, pRawBuffer, &dwSize, sizeof(RAWINPUTHEADER)) != -1)
- {
+ if (GetRawInputData(hRawInput, RID_INPUT, pRawBuffer, &dwSize, sizeof(RAWINPUTHEADER)) != -1) {
RAWINPUT* raw = (RAWINPUT*) pRawBuffer;
- if(raw->header.dwType == RIM_TYPEHID)
- {
+ if(raw->header.dwType == RIM_TYPEHID) {
nMceCmd = 0x10000 + (raw->data.hid.bRawData[1] | raw->data.hid.bRawData[2] << 8);
}
}
@@ -1116,49 +1115,45 @@ UINT CMPlayerCApp::GetRemoteControlCodeSRM7500(UINT nInputcode, HRAWINPUT hRawIn UINT nMceCmd = 0;
GetRawInputData(hRawInput, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER));
- if (dwSize > 21)
- {
+ if (dwSize > 21) {
pRawBuffer = DNew BYTE[dwSize];
- if (GetRawInputData(hRawInput, RID_INPUT, pRawBuffer, &dwSize, sizeof(RAWINPUTHEADER)) != -1)
- {
+ if (GetRawInputData(hRawInput, RID_INPUT, pRawBuffer, &dwSize, sizeof(RAWINPUTHEADER)) != -1) {
RAWINPUT* raw = (RAWINPUT*) pRawBuffer;
// data.hid.bRawData[21] set to one when key is pressed
- if(raw->header.dwType == RIM_TYPEHID && raw->data.hid.bRawData[21] == 1)
- {
+ if(raw->header.dwType == RIM_TYPEHID && raw->data.hid.bRawData[21] == 1) {
// data.hid.bRawData[21] has keycode
- switch (raw->data.hid.bRawData[20])
- {
- case 0x0033 :
- nMceCmd = MCE_DETAILS;
- break;
- case 0x0022 :
- nMceCmd = MCE_GUIDE;
- break;
- case 0x0036 :
- nMceCmd = MCE_MYTV;
- break;
- case 0x0026 :
- nMceCmd = MCE_RECORDEDTV;
- break;
- case 0x0005 :
- nMceCmd = MCE_RED;
- break;
- case 0x0002 :
- nMceCmd = MCE_GREEN;
- break;
- case 0x0045 :
- nMceCmd = MCE_YELLOW;
- break;
- case 0x0046 :
- nMceCmd = MCE_BLUE;
- break;
- case 0x000A :
- nMceCmd = MCE_MEDIA_PREVIOUSTRACK;
- break;
- case 0x004A :
- nMceCmd = MCE_MEDIA_NEXTTRACK;
- break;
+ switch (raw->data.hid.bRawData[20]) {
+ case 0x0033 :
+ nMceCmd = MCE_DETAILS;
+ break;
+ case 0x0022 :
+ nMceCmd = MCE_GUIDE;
+ break;
+ case 0x0036 :
+ nMceCmd = MCE_MYTV;
+ break;
+ case 0x0026 :
+ nMceCmd = MCE_RECORDEDTV;
+ break;
+ case 0x0005 :
+ nMceCmd = MCE_RED;
+ break;
+ case 0x0002 :
+ nMceCmd = MCE_GREEN;
+ break;
+ case 0x0045 :
+ nMceCmd = MCE_YELLOW;
+ break;
+ case 0x0046 :
+ nMceCmd = MCE_BLUE;
+ break;
+ case 0x000A :
+ nMceCmd = MCE_MEDIA_PREVIOUSTRACK;
+ break;
+ case 0x004A :
+ nMceCmd = MCE_MEDIA_NEXTTRACK;
+ break;
}
}
}
@@ -1173,8 +1168,7 @@ void CMPlayerCApp::RegisterHotkeys() RAWINPUTDEVICELIST InputDeviceList[50];
UINT nInputDeviceCount = countof(InputDeviceList);
RID_DEVICE_INFO DevInfo;
- RAWINPUTDEVICE MCEInputDevice[] =
- {
+ RAWINPUTDEVICE MCEInputDevice[] = {
// usUsagePage usUsage dwFlags hwndTarget
{ 0xFFBC, 0x88, 0, NULL},
{ 0x000C, 0x01, 0, NULL},
@@ -1182,18 +1176,16 @@ void CMPlayerCApp::RegisterHotkeys() };
// Register MCE Remote Control raw input
- for (int i=0; i<countof(MCEInputDevice); i++)
+ for (int i=0; i<countof(MCEInputDevice); i++) {
MCEInputDevice[i].hwndTarget = m_pMainWnd->m_hWnd;
+ }
nInputDeviceCount = GetRawInputDeviceList (InputDeviceList, &nInputDeviceCount, sizeof(RAWINPUTDEVICELIST));
- for (int i=0; i<nInputDeviceCount; i++)
- {
+ for (int i=0; i<nInputDeviceCount; i++) {
UINT nTemp = sizeof(DevInfo);
- if (GetRawInputDeviceInfo (InputDeviceList[i].hDevice, RIDI_DEVICEINFO, &DevInfo, &nTemp)>0)
- {
+ if (GetRawInputDeviceInfo (InputDeviceList[i].hDevice, RIDI_DEVICEINFO, &DevInfo, &nTemp)>0) {
if (DevInfo.hid.dwVendorId == 0x00000471 && // Philips HID vendor id
- DevInfo.hid.dwProductId == 0x00000617) // IEEE802.15.4 RF Dongle (SRM 7500)
- {
+ DevInfo.hid.dwProductId == 0x00000617) { // IEEE802.15.4 RF Dongle (SRM 7500)
MCEInputDevice[0].usUsagePage = DevInfo.hid.usUsagePage;
MCEInputDevice[0].usUsage = DevInfo.hid.usUsage;
GetRemoteControlCode = GetRemoteControlCodeSRM7500;
@@ -1205,74 +1197,71 @@ void CMPlayerCApp::RegisterHotkeys() RegisterRawInputDevices (MCEInputDevice, countof(MCEInputDevice), sizeof(RAWINPUTDEVICE));
- if (m_s.fGlobalMedia)
- {
+ if (m_s.fGlobalMedia) {
POSITION pos = m_s.wmcmds.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
wmcmd& wc = m_s.wmcmds.GetNext(pos);
- if (wc.appcmd != 0)
+ if (wc.appcmd != 0) {
RegisterHotKey(m_pMainWnd->m_hWnd, wc.appcmd, 0, GetVKFromAppCommand (wc.appcmd));
+ }
}
}
}
void CMPlayerCApp::UnregisterHotkeys()
{
- if (m_s.fGlobalMedia)
- {
+ if (m_s.fGlobalMedia) {
POSITION pos = m_s.wmcmds.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
wmcmd& wc = m_s.wmcmds.GetNext(pos);
- if (wc.appcmd != 0)
+ if (wc.appcmd != 0) {
UnregisterHotKey(m_pMainWnd->m_hWnd, wc.appcmd);
+ }
}
}
}
UINT CMPlayerCApp::GetVKFromAppCommand(UINT nAppCommand)
{
- switch (nAppCommand)
- {
- case APPCOMMAND_BROWSER_BACKWARD :
- return VK_BROWSER_BACK;
- case APPCOMMAND_BROWSER_FORWARD :
- return VK_BROWSER_FORWARD;
- case APPCOMMAND_BROWSER_REFRESH :
- return VK_BROWSER_REFRESH;
- case APPCOMMAND_BROWSER_STOP :
- return VK_BROWSER_STOP;
- case APPCOMMAND_BROWSER_SEARCH :
- return VK_BROWSER_SEARCH;
- case APPCOMMAND_BROWSER_FAVORITES :
- return VK_BROWSER_FAVORITES;
- case APPCOMMAND_BROWSER_HOME :
- return VK_BROWSER_HOME;
- case APPCOMMAND_VOLUME_MUTE :
- return VK_VOLUME_MUTE;
- case APPCOMMAND_VOLUME_DOWN :
- return VK_VOLUME_DOWN;
- case APPCOMMAND_VOLUME_UP :
- return VK_VOLUME_UP;
- case APPCOMMAND_MEDIA_NEXTTRACK :
- return VK_MEDIA_NEXT_TRACK;
- case APPCOMMAND_MEDIA_PREVIOUSTRACK :
- return VK_MEDIA_PREV_TRACK;
- case APPCOMMAND_MEDIA_STOP :
- return VK_MEDIA_STOP;
- case APPCOMMAND_MEDIA_PLAY_PAUSE :
- return VK_MEDIA_PLAY_PAUSE;
- case APPCOMMAND_LAUNCH_MAIL :
- return VK_LAUNCH_MAIL;
- case APPCOMMAND_LAUNCH_MEDIA_SELECT :
- return VK_LAUNCH_MEDIA_SELECT;
- case APPCOMMAND_LAUNCH_APP1 :
- return VK_LAUNCH_APP1;
- case APPCOMMAND_LAUNCH_APP2 :
- return VK_LAUNCH_APP2;
+ switch (nAppCommand) {
+ case APPCOMMAND_BROWSER_BACKWARD :
+ return VK_BROWSER_BACK;
+ case APPCOMMAND_BROWSER_FORWARD :
+ return VK_BROWSER_FORWARD;
+ case APPCOMMAND_BROWSER_REFRESH :
+ return VK_BROWSER_REFRESH;
+ case APPCOMMAND_BROWSER_STOP :
+ return VK_BROWSER_STOP;
+ case APPCOMMAND_BROWSER_SEARCH :
+ return VK_BROWSER_SEARCH;
+ case APPCOMMAND_BROWSER_FAVORITES :
+ return VK_BROWSER_FAVORITES;
+ case APPCOMMAND_BROWSER_HOME :
+ return VK_BROWSER_HOME;
+ case APPCOMMAND_VOLUME_MUTE :
+ return VK_VOLUME_MUTE;
+ case APPCOMMAND_VOLUME_DOWN :
+ return VK_VOLUME_DOWN;
+ case APPCOMMAND_VOLUME_UP :
+ return VK_VOLUME_UP;
+ case APPCOMMAND_MEDIA_NEXTTRACK :
+ return VK_MEDIA_NEXT_TRACK;
+ case APPCOMMAND_MEDIA_PREVIOUSTRACK :
+ return VK_MEDIA_PREV_TRACK;
+ case APPCOMMAND_MEDIA_STOP :
+ return VK_MEDIA_STOP;
+ case APPCOMMAND_MEDIA_PLAY_PAUSE :
+ return VK_MEDIA_PLAY_PAUSE;
+ case APPCOMMAND_LAUNCH_MAIL :
+ return VK_LAUNCH_MAIL;
+ case APPCOMMAND_LAUNCH_MEDIA_SELECT :
+ return VK_LAUNCH_MEDIA_SELECT;
+ case APPCOMMAND_LAUNCH_APP1 :
+ return VK_LAUNCH_APP1;
+ case APPCOMMAND_LAUNCH_APP2 :
+ return VK_LAUNCH_APP2;
}
return 0;
@@ -1321,14 +1310,12 @@ void CRemoteCtrlClient::Connect(CString addr) {
CAutoLock cAutoLock(&m_csLock);
- if(m_nStatus == CONNECTING && m_addr == addr)
- {
+ if(m_nStatus == CONNECTING && m_addr == addr) {
TRACE(_T("CRemoteCtrlClient (Connect): already connecting to %s\n"), addr);
return;
}
- if(m_nStatus == CONNECTED && m_addr == addr)
- {
+ if(m_nStatus == CONNECTED && m_addr == addr) {
TRACE(_T("CRemoteCtrlClient (Connect): already connected to %s\n"), addr);
return;
}
@@ -1362,8 +1349,7 @@ void CRemoteCtrlClient::OnClose(int nErrorCode) {
CAutoLock cAutoLock(&m_csLock);
- if(m_hSocket != INVALID_SOCKET && m_nStatus == CONNECTED)
- {
+ if(m_hSocket != INVALID_SOCKET && m_nStatus == CONNECTED) {
TRACE(_T("CRemoteCtrlClient (OnClose): connection lost\n"));
}
@@ -1374,11 +1360,15 @@ void CRemoteCtrlClient::OnClose(int nErrorCode) void CRemoteCtrlClient::OnReceive(int nErrorCode)
{
- if(nErrorCode != 0 || !m_pWnd) return;
+ if(nErrorCode != 0 || !m_pWnd) {
+ return;
+ }
CStringA str;
int ret = Receive(str.GetBuffer(256), 255, 0);
- if(ret <= 0) return;
+ if(ret <= 0) {
+ return;
+ }
str.ReleaseBuffer(ret);
TRACE(_T("CRemoteCtrlClient (OnReceive): %s\n"), CString(str));
@@ -1391,20 +1381,20 @@ void CRemoteCtrlClient::OnReceive(int nErrorCode) void CRemoteCtrlClient::ExecuteCommand(CStringA cmd, int repcnt)
{
cmd.Trim();
- if(cmd.IsEmpty()) return;
+ if(cmd.IsEmpty()) {
+ return;
+ }
cmd.Replace(' ', '_');
CAppSettings& s = AfxGetAppSettings();
POSITION pos = s.wmcmds.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
wmcmd wc = s.wmcmds.GetNext(pos);
CStringA name = TToA(wc.GetName());
name.Replace(' ', '_');
if((repcnt == 0 && wc.rmrepcnt == 0 || wc.rmrepcnt > 0 && (repcnt%wc.rmrepcnt) == 0)
- && (!name.CompareNoCase(cmd) || !wc.rmcmd.CompareNoCase(cmd) || wc.cmd == (WORD)strtol(cmd, NULL, 10)))
- {
+ && (!name.CompareNoCase(cmd) || !wc.rmcmd.CompareNoCase(cmd) || wc.cmd == (WORD)strtol(cmd, NULL, 10))) {
CAutoLock cAutoLock(&m_csLock);
TRACE(_T("CRemoteCtrlClient (calling command): %s\n"), wc.GetName());
m_pWnd->SendMessage(WM_COMMAND, wc.cmd);
@@ -1426,12 +1416,12 @@ void CWinLircClient::OnCommand(CStringA str) int i = 0, j = 0, repcnt = 0;
for(CStringA token = str.Tokenize(" ", i);
!token.IsEmpty();
- token = str.Tokenize(" ", i), j++)
- {
- if(j == 1)
+ token = str.Tokenize(" ", i), j++) {
+ if(j == 1) {
repcnt = strtol(token, NULL, 16);
- else if(j == 2)
+ } else if(j == 2) {
ExecuteCommand(token, repcnt);
+ }
}
}
@@ -1449,12 +1439,12 @@ void CUIceClient::OnCommand(CStringA str) int i = 0, j = 0;
for(CStringA token = str.Tokenize("|", i);
!token.IsEmpty();
- token = str.Tokenize("|", i), j++)
- {
- if(j == 0)
+ token = str.Tokenize("|", i), j++) {
+ if(j == 0) {
cmd = token;
- else if(j == 1)
+ } else if(j == 1) {
ExecuteCommand(cmd, strtol(token, NULL, 16));
+ }
}
}
@@ -1468,16 +1458,14 @@ void GetCurDispMode(dispmode& dm, CString& DisplayName) {
HDC hDC;
CString DisplayName1 = DisplayName;
- if ((DisplayName == _T("Current")) || (DisplayName == _T("")))
- {
+ if ((DisplayName == _T("Current")) || (DisplayName == _T(""))) {
CMonitor monitor;
CMonitors monitors;
monitor = monitors.GetNearestMonitor(AfxGetApp()->m_pMainWnd);
monitor.GetName(DisplayName1);
}
hDC = CreateDC(DisplayName1, NULL, NULL, NULL);
- if(hDC)
- {
+ if(hDC) {
dm.fValid = true;
dm.size = CSize(GetDeviceCaps(hDC, HORZRES), GetDeviceCaps(hDC, VERTRES));
dm.bpp = GetDeviceCaps(hDC, BITSPIXEL);
@@ -1491,15 +1479,15 @@ bool GetDispMode(int i, dispmode& dm, CString& DisplayName) DEVMODE devmode;
CString DisplayName1 = DisplayName;
devmode.dmSize = sizeof(DEVMODE);
- if ((DisplayName == _T("Current")) || (DisplayName == _T("")))
- {
+ if ((DisplayName == _T("Current")) || (DisplayName == _T(""))) {
CMonitor monitor;
CMonitors monitors;
monitor = monitors.GetNearestMonitor(AfxGetApp()->m_pMainWnd);
monitor.GetName(DisplayName1);
}
- if(!EnumDisplaySettings(DisplayName1, i, &devmode))
+ if(!EnumDisplaySettings(DisplayName1, i, &devmode)) {
return(false);
+ }
dm.fValid = true;
dm.size = CSize(devmode.dmPelsWidth, devmode.dmPelsHeight);
dm.bpp = devmode.dmBitsPerPel;
@@ -1512,9 +1500,13 @@ void SetDispMode(dispmode& dm, CString& DisplayName) {
dispmode dm1;
GetCurDispMode(dm1, DisplayName);
- if ((dm.size == dm1.size) && (dm.bpp == dm1.bpp) && (dm.freq == dm1.freq)) return;
+ if ((dm.size == dm1.size) && (dm.bpp == dm1.bpp) && (dm.freq == dm1.freq)) {
+ return;
+ }
- if(!dm.fValid) return;
+ if(!dm.fValid) {
+ return;
+ }
DEVMODE dmScreenSettings;
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
@@ -1525,17 +1517,17 @@ void SetDispMode(dispmode& dm, CString& DisplayName) dmScreenSettings.dmDisplayFlags = dm.dmDisplayFlags;
dmScreenSettings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY | DM_DISPLAYFLAGS;
CString DisplayName1 = DisplayName;
- if ((DisplayName == _T("Current")) || (DisplayName == _T("")))
- {
+ if ((DisplayName == _T("Current")) || (DisplayName == _T(""))) {
CMonitor monitor;
CMonitors monitors;
monitor = monitors.GetNearestMonitor(AfxGetApp()->m_pMainWnd);
monitor.GetName(DisplayName1);
}
- if(AfxGetAppSettings().fRestoreResAfterExit)
+ if(AfxGetAppSettings().fRestoreResAfterExit) {
ChangeDisplaySettingsEx(DisplayName1, &dmScreenSettings, NULL, CDS_FULLSCREEN, NULL);
- else
+ } else {
ChangeDisplaySettingsEx(DisplayName1, &dmScreenSettings, NULL, NULL, NULL);
+ }
}
void SetAudioRenderer(int AudioDevNo)
@@ -1545,11 +1537,11 @@ void SetAudioRenderer(int AudioDevNo) m_AudioRendererDisplayNames.Add(_T(""));
int i=2;
- BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker)
- {
+ BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker) {
LPOLESTR olestr = NULL;
- if(FAILED(pMoniker->GetDisplayName(0, 0, &olestr)))
+ if(FAILED(pMoniker->GetDisplayName(0, 0, &olestr))) {
continue;
+ }
CStringW str(olestr);
CoTaskMemFree(olestr);
m_AudioRendererDisplayNames.Add(CString(str));
@@ -1561,8 +1553,9 @@ void SetAudioRenderer(int AudioDevNo) m_AudioRendererDisplayNames.Add(AUDRNDT_NULL_UNCOMP);
m_AudioRendererDisplayNames.Add(AUDRNDT_MPC);
i+=3;
- if (AudioDevNo>=1 && AudioDevNo<=i)
+ if (AudioDevNo>=1 && AudioDevNo<=i) {
AfxGetMyApp()->m_AudioRendererDisplayName_CL = m_AudioRendererDisplayNames[AudioDevNo-1];
+ }
}
void SetHandCursor(HWND m_hWnd, UINT nID)
@@ -1581,15 +1574,13 @@ typedef CAtlREMatchContext<CAtlRECharTraits> CAtlREMatchContextT; bool FindRedir(CUrl& src, CString ct, CString& body, CAtlList<CString>& urls, CAutoPtrList<CAtlRegExpT>& res)
{
POSITION pos = res.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CAtlRegExpT* re = res.GetNext(pos);
CAtlREMatchContextT mc;
const CAtlREMatchContextT::RECHAR* s = (LPCTSTR)body;
const CAtlREMatchContextT::RECHAR* e = NULL;
- for(; s && re->Match(s, &mc, &e); s = e)
- {
+ for(; s && re->Match(s, &mc, &e); s = e) {
const CAtlREMatchContextT::RECHAR* szStart = 0;
const CAtlREMatchContextT::RECHAR* szEnd = 0;
mc.GetMatch(0, &szStart, &szEnd);
@@ -1598,18 +1589,17 @@ bool FindRedir(CUrl& src, CString ct, CString& body, CAtlList<CString>& urls, CA url.Format(_T("%.*s"), szEnd - szStart, szStart);
url.Trim();
- if(url.CompareNoCase(_T("asf path")) == 0) continue;
+ if(url.CompareNoCase(_T("asf path")) == 0) {
+ continue;
+ }
CUrl dst;
dst.CrackUrl(CString(url));
if(_tcsicmp(src.GetSchemeName(), dst.GetSchemeName())
|| _tcsicmp(src.GetHostName(), dst.GetHostName())
- || _tcsicmp(src.GetUrlPath(), dst.GetUrlPath()))
- {
+ || _tcsicmp(src.GetUrlPath(), dst.GetUrlPath())) {
urls.AddTail(url);
- }
- else
- {
+ } else {
// recursive
urls.RemoveAll();
break;
@@ -1625,20 +1615,20 @@ bool FindRedir(CString& fn, CString ct, CAtlList<CString>& fns, CAutoPtrList<CAt CString body;
CTextFile f(CTextFile::ANSI);
- if(f.Open(fn)) for(CString tmp; f.ReadString(tmp); body += tmp + '\n');
+ if(f.Open(fn)) for(CString tmp; f.ReadString(tmp); body += tmp + '\n') {
+ ;
+ }
CString dir = fn.Left(max(fn.ReverseFind('/'), fn.ReverseFind('\\'))+1); // "ReverseFindOneOf"
POSITION pos = res.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CAtlRegExpT* re = res.GetNext(pos);
CAtlREMatchContextT mc;
const CAtlREMatchContextT::RECHAR* s = (LPCTSTR)body;
const CAtlREMatchContextT::RECHAR* e = NULL;
- for(; s && re->Match(s, &mc, &e); s = e)
- {
+ for(; s && re->Match(s, &mc, &e); s = e) {
const CAtlREMatchContextT::RECHAR* szStart = 0;
const CAtlREMatchContextT::RECHAR* szEnd = 0;
mc.GetMatch(0, &szStart, &szEnd);
@@ -1647,18 +1637,22 @@ bool FindRedir(CString& fn, CString ct, CAtlList<CString>& fns, CAutoPtrList<CAt fn2.Format(_T("%.*s"), szEnd - szStart, szStart);
fn2.Trim();
- if(!fn2.CompareNoCase(_T("asf path"))) continue;
- if(fn2.Find(_T("EXTM3U")) == 0 || fn2.Find(_T("#EXTINF")) == 0) continue;
+ if(!fn2.CompareNoCase(_T("asf path"))) {
+ continue;
+ }
+ if(fn2.Find(_T("EXTM3U")) == 0 || fn2.Find(_T("#EXTINF")) == 0) {
+ continue;
+ }
- if(fn2.Find(_T(":")) < 0 && fn2.Find(_T("\\\\")) != 0 && fn2.Find(_T("//")) != 0)
- {
+ if(fn2.Find(_T(":")) < 0 && fn2.Find(_T("\\\\")) != 0 && fn2.Find(_T("//")) != 0) {
CPath p;
p.Combine(dir, fn2);
fn2 = (LPCTSTR)p;
}
- if(!fn2.CompareNoCase(fn))
+ if(!fn2.CompareNoCase(fn)) {
continue;
+ }
fns.AddTail(fn2);
}
@@ -1672,18 +1666,20 @@ CStringA GetContentType(CString fn, CAtlList<CString>* redir) CUrl url;
CString ct, body;
- if(fn.Find(_T("://")) >= 0)
- {
+ if(fn.Find(_T("://")) >= 0) {
url.CrackUrl(fn);
- if(_tcsicmp(url.GetSchemeName(), _T("pnm")) == 0)
+ if(_tcsicmp(url.GetSchemeName(), _T("pnm")) == 0) {
return "audio/x-pn-realaudio";
+ }
- if(_tcsicmp(url.GetSchemeName(), _T("mms")) == 0)
+ if(_tcsicmp(url.GetSchemeName(), _T("mms")) == 0) {
return "video/x-ms-asf";
+ }
- if(_tcsicmp(url.GetSchemeName(), _T("http")) != 0)
+ if(_tcsicmp(url.GetSchemeName(), _T("http")) != 0) {
return "";
+ }
DWORD ProxyEnable = 0;
CString ProxyServer;
@@ -1693,21 +1689,17 @@ CStringA GetContentType(CString fn, CAtlList<CString>* redir) CRegKey key;
if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), KEY_READ)
&& ERROR_SUCCESS == key.QueryDWORDValue(_T("ProxyEnable"), ProxyEnable) && ProxyEnable
- && ERROR_SUCCESS == key.QueryStringValue(_T("ProxyServer"), ProxyServer.GetBufferSetLength(256), &len))
- {
+ && ERROR_SUCCESS == key.QueryStringValue(_T("ProxyServer"), ProxyServer.GetBufferSetLength(256), &len)) {
ProxyServer.ReleaseBufferSetLength(len);
CAtlList<CString> sl;
ProxyServer = Explode(ProxyServer, sl, ';');
- if(sl.GetCount() > 1)
- {
+ if(sl.GetCount() > 1) {
POSITION pos = sl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CAtlList<CString> sl2;
if(!Explode(sl.GetNext(pos), sl2, '=', 2).CompareNoCase(_T("http"))
- && sl2.GetCount() == 2)
- {
+ && sl2.GetCount() == 2) {
ProxyServer = sl2.GetTail();
break;
}
@@ -1715,19 +1707,22 @@ CStringA GetContentType(CString fn, CAtlList<CString>* redir) }
ProxyServer = Explode(ProxyServer, sl, ':');
- if(sl.GetCount() > 1) ProxyPort = _tcstol(sl.GetTail(), NULL, 10);
+ if(sl.GetCount() > 1) {
+ ProxyPort = _tcstol(sl.GetTail(), NULL, 10);
+ }
}
CSocket s;
s.Create();
if(s.Connect(
ProxyEnable ? ProxyServer : url.GetHostName(),
- ProxyEnable ? ProxyPort : url.GetPortNumber()))
- {
+ ProxyEnable ? ProxyPort : url.GetPortNumber())) {
CStringA host = CStringA(url.GetHostName());
CStringA path = CStringA(url.GetUrlPath()) + CStringA(url.GetExtraInfo());
- if(ProxyEnable) path = "http://" + host + path;
+ if(ProxyEnable) {
+ path = "http://" + host + path;
+ }
CStringA hdr;
hdr.Format(
@@ -1737,89 +1732,100 @@ CStringA GetContentType(CString fn, CAtlList<CString>* redir) "Accept: */*\r\n"
"\r\n", path, host);
-// MessageBox(NULL, CString(hdr), _T("Sending..."), MB_OK);
+ // MessageBox(NULL, CString(hdr), _T("Sending..."), MB_OK);
- if(s.Send((LPCSTR)hdr, hdr.GetLength()) < hdr.GetLength()) return "";
+ if(s.Send((LPCSTR)hdr, hdr.GetLength()) < hdr.GetLength()) {
+ return "";
+ }
hdr.Empty();
- while(1)
- {
+ while(1) {
CStringA str;
str.ReleaseBuffer(s.Receive(str.GetBuffer(256), 256)); // SOCKET_ERROR == -1, also suitable for ReleaseBuffer
- if(str.IsEmpty()) break;
+ if(str.IsEmpty()) {
+ break;
+ }
hdr += str;
int hdrend = hdr.Find("\r\n\r\n");
- if(hdrend >= 0)
- {
+ if(hdrend >= 0) {
body = hdr.Mid(hdrend+4);
hdr = hdr.Left(hdrend);
break;
}
}
-// MessageBox(NULL, CString(hdr), _T("Received..."), MB_OK);
+ // MessageBox(NULL, CString(hdr), _T("Received..."), MB_OK);
CAtlList<CStringA> sl;
Explode(hdr, sl, '\n');
POSITION pos = sl.GetHeadPosition();
- while(pos)
- {
+ while(pos) {
CStringA& hdrline = sl.GetNext(pos);
CAtlList<CStringA> sl2;
Explode(hdrline, sl2, ':', 2);
CStringA field = sl2.RemoveHead().MakeLower();
- if(field == "location" && !sl2.IsEmpty())
+ if(field == "location" && !sl2.IsEmpty()) {
return GetContentType(CString(sl2.GetHead()), redir);
- if(field == "content-type" && !sl2.IsEmpty())
+ }
+ if(field == "content-type" && !sl2.IsEmpty()) {
ct = sl2.GetHead();
+ }
}
- while(body.GetLength() < 256)
- {
+ while(body.GetLength() < 256) {
CStringA str;
str.ReleaseBuffer(s.Receive(str.GetBuffer(256), 256)); // SOCKET_ERROR == -1, also suitable for ReleaseBuffer
- if(str.IsEmpty()) break;
+ if(str.IsEmpty()) {
+ break;
+ }
body += str;
}
- if(body.GetLength() >= 8)
- {
+ if(body.GetLength() >= 8) {
CStringA str = TToA(body);
- if(!strncmp((LPCSTR)str, ".ra", 3))
+ if(!strncmp((LPCSTR)str, ".ra", 3)) {
return "audio/x-pn-realaudio";
- if(!strncmp((LPCSTR)str, ".RMF", 4))
+ }
+ if(!strncmp((LPCSTR)str, ".RMF", 4)) {
return "audio/x-pn-realaudio";
- if(*(DWORD*)(LPCSTR)str == 0x75b22630)
+ }
+ if(*(DWORD*)(LPCSTR)str == 0x75b22630) {
return "video/x-ms-wmv";
- if(!strncmp((LPCSTR)str+4, "moov", 4))
+ }
+ if(!strncmp((LPCSTR)str+4, "moov", 4)) {
return "video/quicktime";
+ }
}
- if(redir && (ct == _T("audio/x-scpls") || ct == _T("audio/x-mpegurl")))
- {
- while(body.GetLength() < 4*1024) // should be enough for a playlist...
- {
+ if(redir && (ct == _T("audio/x-scpls") || ct == _T("audio/x-mpegurl"))) {
+ while(body.GetLength() < 4*1024) { // should be enough for a playlist...
CStringA str;
str.ReleaseBuffer(s.Receive(str.GetBuffer(256), 256)); // SOCKET_ERROR == -1, also suitable for ReleaseBuffer
- if(str.IsEmpty()) break;
+ if(str.IsEmpty()) {
+ break;
+ }
body += str;
}
}
}
- }
- else if(!fn.IsEmpty())
- {
+ } else if(!fn.IsEmpty()) {
CPath p(fn);
CString ext = p.GetExtension().MakeLower();
- if(ext == _T(".asx")) ct = _T("video/x-ms-asf");
- else if(ext == _T(".pls")) ct = _T("audio/x-scpls");
- else if(ext == _T(".m3u")) ct = _T("audio/x-mpegurl");
- else if(ext == _T(".qtl")) ct = _T("application/x-quicktimeplayer");
- else if(ext == _T(".mpcpl")) ct = _T("application/x-mpc-playlist");
- else if(ext == _T(".bdmv")) ct = _T("application/x-bdmv-playlist");
-
- if(FILE* f = _tfopen(fn, _T("rb")))
- {
+ if(ext == _T(".asx")) {
+ ct = _T("video/x-ms-asf");
+ } else if(ext == _T(".pls")) {
+ ct = _T("audio/x-scpls");
+ } else if(ext == _T(".m3u")) {
+ ct = _T("audio/x-mpegurl");
+ } else if(ext == _T(".qtl")) {
+ ct = _T("application/x-quicktimeplayer");
+ } else if(ext == _T(".mpcpl")) {
+ ct = _T("application/x-mpc-playlist");
+ } else if(ext == _T(".bdmv")) {
+ ct = _T("application/x-bdmv-playlist");
+ }
+
+ if(FILE* f = _tfopen(fn, _T("rb"))) {
CStringA str;
str.ReleaseBufferSetLength(fread(str.GetBuffer(10240), 1, 10240, f));
body = AToT(str);
@@ -1827,59 +1833,59 @@ CStringA GetContentType(CString fn, CAtlList<CString>* redir) }
}
- if(body.GetLength() >= 4) // here only those which cannot be opened through dshow
- {
+ if(body.GetLength() >= 4) { // here only those which cannot be opened through dshow
CStringA str = TToA(body);
- if(!strncmp((LPCSTR)str, ".ra", 3))
+ if(!strncmp((LPCSTR)str, ".ra", 3)) {
return "audio/x-pn-realaudio";
- if(!strncmp((LPCSTR)str, "FWS", 3))
+ }
+ if(!strncmp((LPCSTR)str, "FWS", 3)) {
return "application/x-shockwave-flash";
+ }
}
- if(redir && !ct.IsEmpty())
- {
+ if(redir && !ct.IsEmpty()) {
CAutoPtrList<CAtlRegExpT> res;
CAutoPtr<CAtlRegExpT> re;
- if(ct == _T("video/x-ms-asf"))
- {
+ if(ct == _T("video/x-ms-asf")) {
// ...://..."/>
re.Attach(DNew CAtlRegExpT());
- if(re && REPARSE_ERROR_OK == re->Parse(_T("{[a-zA-Z]+://[^\n\">]*}"), FALSE))
+ if(re && REPARSE_ERROR_OK == re->Parse(_T("{[a-zA-Z]+://[^\n\">]*}"), FALSE)) {
res.AddTail(re);
+ }
// Ref#n= ...://...\n
re.Attach(DNew CAtlRegExpT());
- if(re && REPARSE_ERROR_OK == re->Parse(_T("Ref\\z\\b*=\\b*[\"]*{([a-zA-Z]+://[^\n\"]+}"), FALSE))
+ if(re && REPARSE_ERROR_OK == re->Parse(_T("Ref\\z\\b*=\\b*[\"]*{([a-zA-Z]+://[^\n\"]+}"), FALSE)) {
res.AddTail(re);
- }
- else if(ct == _T("audio/x-scpls"))
- {
+ }
+ } else if(ct == _T("audio/x-scpls")) {
// File1=...\n
re.Attach(DNew CAtlRegExp<>());
- if(re && REPARSE_ERROR_OK == re->Parse(_T("file\\z\\b*=\\b*[\"]*{[^\n\"]+}"), FALSE))
+ if(re && REPARSE_ERROR_OK == re->Parse(_T("file\\z\\b*=\\b*[\"]*{[^\n\"]+}"), FALSE)) {
res.AddTail(re);
- }
- else if(ct == _T("audio/x-mpegurl"))
- {
+ }
+ } else if(ct == _T("audio/x-mpegurl")) {
// #comment
// ...
re.Attach(DNew CAtlRegExp<>());
- if(re && REPARSE_ERROR_OK == re->Parse(_T("{[^#][^\n]+}"), FALSE))
+ if(re && REPARSE_ERROR_OK == re->Parse(_T("{[^#][^\n]+}"), FALSE)) {
res.AddTail(re);
- }
- else if(ct == _T("audio/x-pn-realaudio"))
- {
+ }
+ } else if(ct == _T("audio/x-pn-realaudio")) {
// rtsp://...
re.Attach(DNew CAtlRegExp<>());
- if(re && REPARSE_ERROR_OK == re->Parse(_T("{rtsp://[^\n]+}"), FALSE))
+ if(re && REPARSE_ERROR_OK == re->Parse(_T("{rtsp://[^\n]+}"), FALSE)) {
res.AddTail(re);
+ }
}
- if(!body.IsEmpty())
- {
- if(fn.Find(_T("://")) >= 0) FindRedir(url, ct, body, *redir, res);
- else FindRedir(fn, ct, *redir, res);
+ if(!body.IsEmpty()) {
+ if(fn.Find(_T("://")) >= 0) {
+ FindRedir(url, ct, body, *redir, res);
+ } else {
+ FindRedir(fn, ct, *redir, res);
+ }
}
}
@@ -1888,16 +1894,15 @@ CStringA GetContentType(CString fn, CAtlList<CString>* redir) COLORPROPERTY_RANGE* CMPlayerCApp::GetColorControl(ControlType nFlag)
{
- switch (nFlag)
- {
- case Brightness :
- return &m_ColorControl[0];
- case Contrast :
- return &m_ColorControl[1];
- case Hue :
- return &m_ColorControl[2];
- case Saturation :
- return &m_ColorControl[3];
+ switch (nFlag) {
+ case Brightness :
+ return &m_ColorControl[0];
+ case Contrast :
+ return &m_ColorControl[1];
+ case Hue :
+ return &m_ColorControl[2];
+ case Saturation :
+ return &m_ColorControl[3];
}
return NULL;
}
@@ -1905,102 +1910,100 @@ COLORPROPERTY_RANGE* CMPlayerCApp::GetColorControl(ControlType nFlag) LPCTSTR CMPlayerCApp::GetSatelliteDll(int nLanguage)
{
- switch (nLanguage)
- {
- case 1: // French
- return _T("mpcresources.fr.dll");
- case 2: // German
- return _T("mpcresources.de.dll");
- case 3: // Russian
- return _T("mpcresources.ru.dll");
- case 4: // Turkish
- return _T("mpcresources.tr.dll");
- case 5: // Czech
- return _T("mpcresources.cz.dll");
- case 6: // Spanish
- return _T("mpcresources.es.dll");
- case 7: // Hungarian
- return _T("mpcresources.hu.dll");
- case 8: // Korean
- return _T("mpcresources.kr.dll");
- case 9: // Polish
- return _T("mpcresources.pl.dll");
- case 10: // Ukrainian
- return _T("mpcresources.ua.dll");
- case 11: // Italian
- return _T("mpcresources.it.dll");
- case 12 : // Slovak
- return _T("mpcresources.sk.dll");
- case 13 : // Chinese (Simplified)
- return _T("mpcresources.sc.dll");
- case 14 : // Chinese (Traditional)
- return _T("mpcresources.tc.dll");
- case 15 : // Belarusian
- return _T("mpcresources.by.dll");
- case 16 : // Swedish
- return _T("mpcresources.sv.dll");
- case 17 : // Portuguese (Brasil)
- return _T("mpcresources.br.dll");
- case 18 : // Dutch
- return _T("mpcresources.nl.dll");
- case 19 : // Catalan
- return _T("mpcresources.ca.dll");
- case 20 : // Japanese
- return _T("mpcresources.ja.dll");
- case 21 : // Armenian
- return _T("mpcresources.hy.dll");
+ switch (nLanguage) {
+ case 1: // French
+ return _T("mpcresources.fr.dll");
+ case 2: // German
+ return _T("mpcresources.de.dll");
+ case 3: // Russian
+ return _T("mpcresources.ru.dll");
+ case 4: // Turkish
+ return _T("mpcresources.tr.dll");
+ case 5: // Czech
+ return _T("mpcresources.cz.dll");
+ case 6: // Spanish
+ return _T("mpcresources.es.dll");
+ case 7: // Hungarian
+ return _T("mpcresources.hu.dll");
+ case 8: // Korean
+ return _T("mpcresources.kr.dll");
+ case 9: // Polish
+ return _T("mpcresources.pl.dll");
+ case 10: // Ukrainian
+ return _T("mpcresources.ua.dll");
+ case 11: // Italian
+ return _T("mpcresources.it.dll");
+ case 12 : // Slovak
+ return _T("mpcresources.sk.dll");
+ case 13 : // Chinese (Simplified)
+ return _T("mpcresources.sc.dll");
+ case 14 : // Chinese (Traditional)
+ return _T("mpcresources.tc.dll");
+ case 15 : // Belarusian
+ return _T("mpcresources.by.dll");
+ case 16 : // Swedish
+ return _T("mpcresources.sv.dll");
+ case 17 : // Portuguese (Brasil)
+ return _T("mpcresources.br.dll");
+ case 18 : // Dutch
+ return _T("mpcresources.nl.dll");
+ case 19 : // Catalan
+ return _T("mpcresources.ca.dll");
+ case 20 : // Japanese
+ return _T("mpcresources.ja.dll");
+ case 21 : // Armenian
+ return _T("mpcresources.hy.dll");
}
return NULL;
}
int CMPlayerCApp::GetDefLanguage()
{
- switch (GetUserDefaultUILanguage())
- {
- case 1036: // French
- return 1;
- case 1031: // German
- return 2;
- case 1049: // Russian
- return 3;
- case 1055: // Turkish
- return 4;
- case 1029: // Czech
- return 5;
- case 1034: // Spanish
- return 6;
- case 1038: // Hungarian
- return 7;
- case 1042: // Korean
- return 8;
- case 1045: // Polish
- return 9;
- case 1058: // Ukrainian
- return 10;
- case 1040: // Italian
- return 11;
- case 1051 : // Slovak
- return 12;
- case 2052 : // Chinese (simplified)
- return 13;
- case 3076 : // Chinese (traditional)
- return 14;
- case 1059 : // Belarusian
- return 15;
- case 1053 : // Swedish
- return 16;
- case 1046 : // Portuguese (brasil)
- return 17;
- case 1043 : // Dutch
- return 18;
- case 1027 : // Catalan
- return 19;
- case 1041 : // Japanese
- return 20;
- case 1067 : // Armenian
- return 21;
- default:
- return 0;
+ switch (GetUserDefaultUILanguage()) {
+ case 1036: // French
+ return 1;
+ case 1031: // German
+ return 2;
+ case 1049: // Russian
+ return 3;
+ case 1055: // Turkish
+ return 4;
+ case 1029: // Czech
+ return 5;
+ case 1034: // Spanish
+ return 6;
+ case 1038: // Hungarian
+ return 7;
+ case 1042: // Korean
+ return 8;
+ case 1045: // Polish
+ return 9;
+ case 1058: // Ukrainian
+ return 10;
+ case 1040: // Italian
+ return 11;
+ case 1051 : // Slovak
+ return 12;
+ case 2052 : // Chinese (simplified)
+ return 13;
+ case 3076 : // Chinese (traditional)
+ return 14;
+ case 1059 : // Belarusian
+ return 15;
+ case 1053 : // Swedish
+ return 16;
+ case 1046 : // Portuguese (brasil)
+ return 17;
+ case 1043 : // Dutch
+ return 18;
+ case 1027 : // Catalan
+ return 19;
+ case 1041 : // Japanese
+ return 20;
+ case 1067 : // Armenian
+ return 21;
+ default:
+ return 0;
}
}
@@ -2011,13 +2014,11 @@ void CMPlayerCApp::SetLanguage (int nLanguage) LPCTSTR strSatellite;
strSatellite = GetSatelliteDll( nLanguage );
- if ( strSatellite )
- {
+ if ( strSatellite ) {
CFileVersionInfo Version;
CString strSatVersion;
- if ( Version.Create(strSatellite) )
- {
+ if ( Version.Create(strSatellite) ) {
strSatVersion = Version.GetFileVersionEx();
CString needVersion = L"";
@@ -2026,13 +2027,10 @@ void CMPlayerCApp::SetLanguage (int nLanguage) needVersion += MAKE_STR(MPC_VERSION_MINOR);
needVersion += L".0.0";
- if ( strSatVersion == needVersion )
- {
+ if ( strSatVersion == needVersion ) {
hMod = LoadLibrary( strSatellite );
s.iLanguage = nLanguage;
- }
- else
- {
+ } else {
// This message should stay in English!
MessageBox(NULL, _T("Your language pack will not work with this version. Please download a compatible one from the MPC-HC homepage."),
_T("Media Player Classic - Home Cinema"), MB_OK);
@@ -2040,13 +2038,11 @@ void CMPlayerCApp::SetLanguage (int nLanguage) }
}
- if ( hMod == NULL )
- {
+ if ( hMod == NULL ) {
hMod = AfxGetApp()->m_hInstance;
s.iLanguage = 0;
}
- if (AfxGetResourceHandle() != AfxGetApp()->m_hInstance)
- {
+ if (AfxGetResourceHandle() != AfxGetApp()->m_hInstance) {
FreeLibrary(AfxGetResourceHandle());
}
AfxSetResourceHandle( hMod );
@@ -2056,8 +2052,7 @@ bool CMPlayerCApp::IsVSFilterInstalled() {
bool result = false;
CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{9852A670-F845-491B-9BE6-EBD841B8A613}"), KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{9852A670-F845-491B-9BE6-EBD841B8A613}"), KEY_READ)) {
result = true;
}
@@ -2068,8 +2063,7 @@ bool CMPlayerCApp::HasEVR() {
bool result = false;
CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{FA10746C-9B63-4B6C-BC49-FC300EA5F256}"), KEY_READ))
- {
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{FA10746C-9B63-4B6C-BC49-FC300EA5F256}"), KEY_READ)) {
result = true;
}
@@ -2087,8 +2081,7 @@ HRESULT CMPlayerCApp::GetElevationType(TOKEN_ELEVATION_TYPE* ptet ) if ( !::OpenProcessToken(
::GetCurrentProcess(),
TOKEN_QUERY,
- &hToken ) )
- {
+ &hToken ) ) {
ASSERT( FALSE );
return hResult;
}
@@ -2100,12 +2093,9 @@ HRESULT CMPlayerCApp::GetElevationType(TOKEN_ELEVATION_TYPE* ptet ) TokenElevationType,
ptet,
sizeof( *ptet ),
- &dwReturnLength ) )
- {
+ &dwReturnLength ) ) {
ASSERT( FALSE );
- }
- else
- {
+ } else {
ASSERT( dwReturnLength == sizeof( *ptet ) );
hResult = S_OK;
}
@@ -2128,8 +2118,9 @@ void CMPlayerCApp::RunAsAdministrator(LPCTSTR strCommand, LPCTSTR strArgs, bool ShellExecuteEx(&execinfo);
- if (bWaitProcess)
+ if (bWaitProcess) {
WaitForSingleObject(execinfo.hProcess, INFINITE);
+ }
}
void CAboutDlg::OnHomepage(NMHDR *pNMHDR, LRESULT *pResult)
diff --git a/src/apps/mplayerc/mplayerc.h b/src/apps/mplayerc/mplayerc.h index e3c91ba27..26ceec131 100644 --- a/src/apps/mplayerc/mplayerc.h +++ b/src/apps/mplayerc/mplayerc.h @@ -38,8 +38,7 @@ //define the default logo we use
#define DEF_LOGO IDF_LOGO3
-enum
-{
+enum {
WM_GRAPHNOTIFY = WM_RESET_DEVICE+1,
WM_RESUMEFROMSTATE,
WM_TUNER_SCAN_PROGRESS,
@@ -62,16 +61,14 @@ extern "C" BOOL IsVistaOrAbove(); /////////////////////////////////////////////////////////////////////////////
// Casimir666
//
-typedef enum
-{
+typedef enum {
Brightness = 0x1,
Contrast = 0x2,
Hue = 0x4,
Saturation = 0x8,
} ControlType;
-typedef struct // _VMR9ProcAmpControlRange
-{
+typedef struct { // _VMR9ProcAmpControlRange
DWORD dwSize;
DWORD dwProperty;
float MinValue;
@@ -141,7 +138,7 @@ public: void RegisterHotkeys();
void UnregisterHotkeys();
-// Overrides
+ // Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMPlayerCApp)
public:
@@ -149,7 +146,7 @@ public: virtual int ExitInstance();
//}}AFX_VIRTUAL
-// Implementation
+ // Implementation
public:
DECLARE_MESSAGE_MAP()
|