Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2011-06-11 18:01:01 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2011-06-11 18:01:01 +0400
commit9d042ba4e8c0ee43a173134aa755317b5f3e3629 (patch)
tree90deb44b77175b37cdb43d3c8b13fdf9b85005a5 /src
parentf095f67e37e1f8af40e2e5d796f746bff2ef63b0 (diff)
legacy branch: merge r3126-r3207 from trunk
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/branches/legacy@3208 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src')
-rw-r--r--src/DSUtil/DSUtil.cpp45
-rw-r--r--src/DSUtil/DSUtil.h1
-rw-r--r--src/DSUtil/DSUtil.vcproj1
-rw-r--r--src/DSUtil/DSUtil.vcxproj4
-rw-r--r--src/DSUtil/H264Nalu.cpp22
-rw-r--r--src/DSUtil/H264Nalu.h3
-rw-r--r--src/DSUtil/MediaTypeEx.cpp1
-rw-r--r--src/DSUtil/Mpeg2Def.h2
-rw-r--r--src/DSUtil/stdafx.h6
-rw-r--r--src/apps/MPCTestAPI/HScrollListBox.cpp170
-rw-r--r--src/apps/MPCTestAPI/HScrollListBox.h62
-rw-r--r--src/apps/MPCTestAPI/MPCTestAPI.rc25
-rw-r--r--src/apps/MPCTestAPI/MPCTestAPI.vcproj16
-rw-r--r--src/apps/MPCTestAPI/MPCTestAPI.vcxproj9
-rw-r--r--src/apps/MPCTestAPI/MPCTestAPI.vcxproj.filters9
-rw-r--r--src/apps/MPCTestAPI/MPCTestAPIDlg.cpp68
-rw-r--r--src/apps/MPCTestAPI/MPCTestAPIDlg.h3
-rw-r--r--src/apps/mplayerc/AppSettings.cpp225
-rw-r--r--src/apps/mplayerc/AppSettings.h2
-rw-r--r--src/apps/mplayerc/AuthDlg.cpp22
-rw-r--r--src/apps/mplayerc/BaseGraph.cpp28
-rw-r--r--src/apps/mplayerc/CShockwaveFlash.h4
-rw-r--r--src/apps/mplayerc/Changelog.txt659
-rw-r--r--src/apps/mplayerc/Changelog_old.txt636
-rw-r--r--src/apps/mplayerc/ChildView.cpp68
-rw-r--r--src/apps/mplayerc/ComPropertyPage.cpp6
-rw-r--r--src/apps/mplayerc/ComPropertySheet.cpp46
-rw-r--r--src/apps/mplayerc/ComPropertySheet.h2
-rw-r--r--src/apps/mplayerc/DVBChannel.cpp10
-rw-r--r--src/apps/mplayerc/DeinterlacerFilter.cpp28
-rw-r--r--src/apps/mplayerc/EditListEditor.cpp58
-rw-r--r--src/apps/mplayerc/FGFilter.cpp172
-rw-r--r--src/apps/mplayerc/FGFilter.h2
-rw-r--r--src/apps/mplayerc/FGManager.cpp451
-rw-r--r--src/apps/mplayerc/FGManagerBDA.cpp76
-rw-r--r--src/apps/mplayerc/FGManagerBDA.h3
-rw-r--r--src/apps/mplayerc/FakeFilterMapper2.cpp189
-rw-r--r--src/apps/mplayerc/FavoriteOrganizeDlg.cpp34
-rw-r--r--src/apps/mplayerc/FileDropTarget.cpp4
-rw-r--r--src/apps/mplayerc/FloatEdit.cpp22
-rw-r--r--src/apps/mplayerc/FullscreenWnd.cpp4
-rw-r--r--src/apps/mplayerc/GoToDlg.cpp32
-rw-r--r--src/apps/mplayerc/ISDb.cpp18
-rw-r--r--src/apps/mplayerc/ISDb.h4
-rw-r--r--src/apps/mplayerc/KeyProvider.cpp6
-rw-r--r--src/apps/mplayerc/LcdSupport.cpp4
-rw-r--r--src/apps/mplayerc/MainFrm.cpp3988
-rw-r--r--src/apps/mplayerc/MainFrm.h7
-rw-r--r--src/apps/mplayerc/MediaFormats.cpp62
-rw-r--r--src/apps/mplayerc/MediaTypesDlg.cpp22
-rw-r--r--src/apps/mplayerc/MpcApi.h7
-rw-r--r--src/apps/mplayerc/Mpeg2SectionData.cpp2
-rw-r--r--src/apps/mplayerc/OpenDirHelper.cpp18
-rw-r--r--src/apps/mplayerc/OpenDlg.cpp50
-rw-r--r--src/apps/mplayerc/OpenFileDlg.cpp22
-rw-r--r--src/apps/mplayerc/PPageAccelTbl.cpp108
-rw-r--r--src/apps/mplayerc/PPageAudioSwitcher.cpp44
-rw-r--r--src/apps/mplayerc/PPageBase.cpp14
-rw-r--r--src/apps/mplayerc/PPageCapture.cpp34
-rw-r--r--src/apps/mplayerc/PPageCasimir.cpp10
-rw-r--r--src/apps/mplayerc/PPageDVD.cpp10
-rw-r--r--src/apps/mplayerc/PPageExternalFilters.cpp124
-rw-r--r--src/apps/mplayerc/PPageFileInfoClip.cpp30
-rw-r--r--src/apps/mplayerc/PPageFileInfoDetails.cpp68
-rw-r--r--src/apps/mplayerc/PPageFileInfoRes.cpp22
-rw-r--r--src/apps/mplayerc/PPageFileInfoSheet.cpp8
-rw-r--r--src/apps/mplayerc/PPageFileMediaInfo.cpp18
-rw-r--r--src/apps/mplayerc/PPageFormats.cpp216
-rw-r--r--src/apps/mplayerc/PPageFullscreen.cpp42
-rw-r--r--src/apps/mplayerc/PPageInternalFilters.cpp46
-rw-r--r--src/apps/mplayerc/PPageLogo.cpp18
-rw-r--r--src/apps/mplayerc/PPageOutput.cpp48
-rw-r--r--src/apps/mplayerc/PPagePlayback.cpp27
-rw-r--r--src/apps/mplayerc/PPagePlayer.cpp12
-rw-r--r--src/apps/mplayerc/PPageSheet.cpp14
-rw-r--r--src/apps/mplayerc/PPageSubMisc.cpp8
-rw-r--r--src/apps/mplayerc/PPageSubStyle.cpp38
-rw-r--r--src/apps/mplayerc/PPageSubtitles.cpp6
-rw-r--r--src/apps/mplayerc/PPageTweaks.cpp4
-rw-r--r--src/apps/mplayerc/PPageWebServer.cpp28
-rw-r--r--src/apps/mplayerc/PlayerCaptureBar.cpp8
-rw-r--r--src/apps/mplayerc/PlayerCaptureDialog.cpp382
-rw-r--r--src/apps/mplayerc/PlayerCaptureDialog.h68
-rw-r--r--src/apps/mplayerc/PlayerInfoBar.cpp32
-rw-r--r--src/apps/mplayerc/PlayerListCtrl.cpp126
-rw-r--r--src/apps/mplayerc/PlayerNavigationBar.cpp11
-rw-r--r--src/apps/mplayerc/PlayerNavigationDialog.cpp8
-rw-r--r--src/apps/mplayerc/PlayerPlaylistBar.cpp341
-rw-r--r--src/apps/mplayerc/PlayerPlaylistBar.h2
-rw-r--r--src/apps/mplayerc/PlayerSeekBar.cpp186
-rw-r--r--src/apps/mplayerc/PlayerSeekBar.h18
-rw-r--r--src/apps/mplayerc/PlayerShaderEditorBar.cpp12
-rw-r--r--src/apps/mplayerc/PlayerStatusBar.cpp56
-rw-r--r--src/apps/mplayerc/PlayerSubresyncBar.cpp352
-rw-r--r--src/apps/mplayerc/PlayerToolBar.cpp42
-rw-r--r--src/apps/mplayerc/Playlist.cpp92
-rw-r--r--src/apps/mplayerc/Playlist.h2
-rw-r--r--src/apps/mplayerc/PnSPresetsDlg.cpp24
-rw-r--r--src/apps/mplayerc/QuicktimeGraph.cpp134
-rw-r--r--src/apps/mplayerc/RealMediaGraph.cpp140
-rw-r--r--src/apps/mplayerc/RealMediaWindowlessSite.cpp118
-rw-r--r--src/apps/mplayerc/RegFilterChooserDlg.cpp16
-rw-r--r--src/apps/mplayerc/SaveDlg.cpp50
-rw-r--r--src/apps/mplayerc/SaveTextFileDialog.cpp6
-rw-r--r--src/apps/mplayerc/SaveThumbnailsDialog.cpp4
-rw-r--r--src/apps/mplayerc/SelectMediaType.cpp6
-rw-r--r--src/apps/mplayerc/ShaderAutoCompleteDlg.cpp10
-rw-r--r--src/apps/mplayerc/ShaderCombineDlg.cpp26
-rw-r--r--src/apps/mplayerc/ShaderEditorDlg.cpp82
-rw-r--r--src/apps/mplayerc/ShockwaveGraph.cpp36
-rw-r--r--src/apps/mplayerc/StatusLabel.cpp10
-rw-r--r--src/apps/mplayerc/SubtitleDlDlg.cpp71
-rw-r--r--src/apps/mplayerc/TextPassThruFilter.cpp38
-rw-r--r--src/apps/mplayerc/VMROSD.cpp33
-rw-r--r--src/apps/mplayerc/VMROSD.h3
-rw-r--r--src/apps/mplayerc/VolumeCtrl.cpp22
-rw-r--r--src/apps/mplayerc/WebClientSocket.cpp308
-rw-r--r--src/apps/mplayerc/WebClientSocket.h16
-rw-r--r--src/apps/mplayerc/WebServer.cpp204
-rw-r--r--src/apps/mplayerc/WebServerSocket.cpp4
-rw-r--r--src/apps/mplayerc/jpeg.cpp78
-rw-r--r--src/apps/mplayerc/libpng.c20
-rw-r--r--src/apps/mplayerc/libpng.h10
-rw-r--r--src/apps/mplayerc/mpciconlib/mpciconlib.h2
-rw-r--r--src/apps/mplayerc/mpcresources/common.pl4
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.br.rcbin349946 -> 358026 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.by.rcbin344444 -> 352530 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.ca.rcbin348258 -> 356290 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.cz.rcbin344958 -> 353028 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.de.rcbin346754 -> 354882 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.es.rcbin350304 -> 358300 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.fr.rcbin350406 -> 358502 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.hu.rcbin350774 -> 358794 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.hy.rcbin344508 -> 352448 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.it.rcbin346770 -> 354892 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.ja.rcbin319880 -> 328132 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.kr.rcbin317098 -> 325434 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.nl.rcbin344944 -> 352976 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.pl.rcbin354536 -> 362678 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.ru.rcbin346676 -> 354752 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.sc.rcbin310442 -> 318788 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.sk.rcbin347282 -> 355564 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.sv.rcbin342544 -> 350640 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.tc.rcbin312442 -> 320656 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.tr.rcbin343218 -> 351294 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/mplayerc.ua.rcbin344934 -> 353098 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/rcfile.pl16
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.br.rc.txtbin142276 -> 149488 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.by.rc.txtbin137128 -> 144442 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.ca.rc.txtbin140470 -> 147666 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.cz.rc.txtbin137390 -> 144668 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.de.rc.txtbin139028 -> 146288 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.es.rc.txtbin142866 -> 150008 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.fr.rc.txtbin143846 -> 151056 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.hu.rc.txtbin143732 -> 150970 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.hy.rc.txtbin135126 -> 142256 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.it.rc.txtbin138420 -> 145706 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.ja.rc.txtbin107194 -> 114750 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.kr.rc.txtbin104408 -> 112076 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.nl.rc.txtbin136902 -> 144118 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.pl.rc.txtbin147854 -> 155218 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.rc.txtbin130218 -> 137522 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.ru.rc.txtbin139478 -> 146794 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.sc.rc.txtbin96510 -> 104226 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.sk.rc.txtbin140840 -> 148146 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.sv.rc.txtbin133738 -> 141026 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.tc.rc.txtbin97862 -> 105442 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.tr.rc.txtbin134984 -> 142306 bytes
-rw-r--r--src/apps/mplayerc/mpcresources/text/mplayerc.ua.rc.txtbin137592 -> 145006 bytes
-rw-r--r--src/apps/mplayerc/mplayerc.cpp359
-rw-r--r--src/apps/mplayerc/mplayerc.rcbin337916 -> 346030 bytes
-rw-r--r--src/apps/mplayerc/res/shaders/BT601BT709.psh5
-rw-r--r--src/apps/mplayerc/res/shaders/EdgeSharpen.psh101
-rw-r--r--src/apps/mplayerc/res/shaders/SharpenComplex.psh9
-rw-r--r--src/apps/mplayerc/res/shaders/SharpenComplex2.psh17
-rw-r--r--src/apps/mplayerc/res/shaders/YV12ChromaUpsampling.psh49
-rw-r--r--src/apps/mplayerc/res/shaders/contour.psh14
-rw-r--r--src/apps/mplayerc/res/shaders/deinterlace (blend).psh7
-rw-r--r--src/apps/mplayerc/res/shaders/denoise.psh18
-rw-r--r--src/apps/mplayerc/res/shaders/emboss.psh9
-rw-r--r--src/apps/mplayerc/res/shaders/empty.psh5
-rw-r--r--src/apps/mplayerc/res/shaders/final.psh3
-rw-r--r--src/apps/mplayerc/res/shaders/grayscale.psh5
-rw-r--r--src/apps/mplayerc/res/shaders/invert.psh5
-rw-r--r--src/apps/mplayerc/res/shaders/letterbox.psh12
-rw-r--r--src/apps/mplayerc/res/shaders/levels.psh3
-rw-r--r--src/apps/mplayerc/res/shaders/levels2.psh5
-rw-r--r--src/apps/mplayerc/res/shaders/levels3.psh3
-rw-r--r--src/apps/mplayerc/res/shaders/nightvision.psh3
-rw-r--r--src/apps/mplayerc/res/shaders/procamp.psh18
-rw-r--r--src/apps/mplayerc/res/shaders/resizer.psh44
-rw-r--r--src/apps/mplayerc/res/shaders/sharpen.psh47
-rw-r--r--src/apps/mplayerc/res/shaders/sphere.psh34
-rw-r--r--src/apps/mplayerc/res/shaders/spotlight.psh5
-rw-r--r--src/apps/mplayerc/res/shaders/wave.psh12
-rw-r--r--src/apps/mplayerc/res/web/controls.html10
-rw-r--r--src/apps/mplayerc/res/web/index.html2
-rw-r--r--src/apps/mplayerc/res/web/player.html66
-rw-r--r--src/apps/mplayerc/resource.hbin120904 -> 126328 bytes
-rw-r--r--src/common.props29
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp237
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitterFileEx.h9
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp51
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.h5
-rw-r--r--src/filters/parser/MP4Splitter/MP4Splitter.cpp51
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitter.cpp167
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitterFile.cpp229
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitterFile.h18
-rw-r--r--src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp13
-rw-r--r--src/filters/renderer/VideoRenderers/IPinHook.cpp2
-rw-r--r--src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp36
-rw-r--r--src/filters/source/DTSAC3Source/DTSAC3Source.cpp37
-rw-r--r--src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp4
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg_x64/buildmingwlibs.sh8
-rw-r--r--src/filters/transform/MpaDecFilter/MpaDecFilter.cpp50
-rw-r--r--src/thirdparty/lcms2/AUTHORS3
-rw-r--r--src/thirdparty/lcms2/COPYING2
-rw-r--r--src/thirdparty/lcms2/ChangeLog8
-rw-r--r--src/thirdparty/lcms2/include/lcms2.h34
-rw-r--r--src/thirdparty/lcms2/src/cmsio0.c12
-rw-r--r--src/thirdparty/lcms2/src/cmsio1.c3
-rw-r--r--src/thirdparty/lcms2/src/cmsnamed.c367
-rw-r--r--src/thirdparty/lcms2/src/cmstypes.c433
-rw-r--r--src/thirdparty/mfc/winmdi.cpp15
224 files changed, 7847 insertions, 6512 deletions
diff --git a/src/DSUtil/DSUtil.cpp b/src/DSUtil/DSUtil.cpp
index 197ce5d8e..f963fd49a 100644
--- a/src/DSUtil/DSUtil.cpp
+++ b/src/DSUtil/DSUtil.cpp
@@ -2670,4 +2670,47 @@ void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName)
}
__except(EXCEPTION_CONTINUE_EXECUTION) {
}
-} \ No newline at end of file
+}
+
+void HexDump(CString fileName, BYTE* buf, int size)
+{
+ if(size<=0)
+ return;
+
+ CString dump_str;
+ dump_str.Format(_T("Dump size = %d\n"), size);
+ int len, i, j, c;
+
+ for(i=0;i<size;i+=16) {
+ len = size - i;
+ if (len > 16)
+ len = 16;
+ dump_str.AppendFormat(_T("%08x "), i);
+ for(j=0;j<16;j++) {
+ if (j < len)
+ dump_str.AppendFormat(_T(" %02x"), buf[i+j]);
+ else
+ dump_str.AppendFormat(_T(" "));
+ }
+ dump_str.Append(_T(" "));
+ for(j=0;j<len;j++) {
+ c = buf[i+j];
+ if (c < ' ' || c > '~')
+ c = '.';
+ dump_str.AppendFormat(_T("%c"), c);
+ }
+ dump_str.Append(_T("\n"));
+ }
+ dump_str.Append(_T("\n"));
+
+ if(!fileName.IsEmpty()) {
+ CStdioFile file;
+ if(file.Open(fileName, CFile::modeCreate|CFile::modeWrite)) {
+ file.WriteString(dump_str);
+ file.Close();
+ }
+ }
+ else {
+ TRACE(dump_str);
+ }
+}
diff --git a/src/DSUtil/DSUtil.h b/src/DSUtil/DSUtil.h
index f01c18be0..8c168f5a9 100644
--- a/src/DSUtil/DSUtil.h
+++ b/src/DSUtil/DSUtil.h
@@ -122,6 +122,7 @@ extern DWORD YCrCbToRGB_Rec709(BYTE A, BYTE Y, BYTE Cr, BYTE Cb);
extern void TraceFilterInfo(IBaseFilter* pBF);
extern void TracePinInfo(IPin* pPin);
extern void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName);
+extern void HexDump(CString fName, BYTE* buf, int size);
class CPinInfo : public PIN_INFO
{
diff --git a/src/DSUtil/DSUtil.vcproj b/src/DSUtil/DSUtil.vcproj
index a0b253d39..c0820fc9d 100644
--- a/src/DSUtil/DSUtil.vcproj
+++ b/src/DSUtil/DSUtil.vcproj
@@ -145,7 +145,6 @@
/>
<Tool
Name="VCCustomBuildTool"
- CommandLine=""
/>
<Tool
Name="VCXMLDataGeneratorTool"
diff --git a/src/DSUtil/DSUtil.vcxproj b/src/DSUtil/DSUtil.vcxproj
index edca440cb..132a91020 100644
--- a/src/DSUtil/DSUtil.vcxproj
+++ b/src/DSUtil/DSUtil.vcxproj
@@ -92,10 +92,6 @@
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <CustomBuildStep>
- <Command>
- </Command>
- </CustomBuildStep>
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;..\filters\BaseClasses;$(DXSDK_DIR)Include;..\thirdparty\VirtualDub\h;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
diff --git a/src/DSUtil/H264Nalu.cpp b/src/DSUtil/H264Nalu.cpp
index 0d54c59fc..927795da7 100644
--- a/src/DSUtil/H264Nalu.cpp
+++ b/src/DSUtil/H264Nalu.cpp
@@ -35,9 +35,9 @@ void CH264Nalu::SetBuffer(BYTE* pBuffer, int nSize, int nNALSize)
m_nNALDataPos = 0;
}
-bool CH264Nalu::MoveToNextStartcode()
+bool CH264Nalu::MoveToNextAnnexBStartcode()
{
- int nBuffEnd = (m_nNextRTP > 0) ? min (m_nNextRTP, m_nSize-4) : m_nSize-4;
+ int nBuffEnd = m_nSize - 4;
for (int i=m_nCurPos; i<nBuffEnd; i++) {
if ((*((DWORD*)(m_pBuffer+i)) & 0x00FFFFFF) == 0x00010000) {
@@ -47,10 +47,16 @@ bool CH264Nalu::MoveToNextStartcode()
}
}
- if ((m_nNALSize != 0) && (m_nNextRTP < m_nSize)) {
- m_nCurPos = m_nNextRTP;
- return true;
- }
+ m_nCurPos = m_nSize;
+ return false;
+}
+
+bool CH264Nalu::MoveToNextRTPStartcode()
+{
+ if (m_nNextRTP < m_nSize) {
+ m_nCurPos = m_nNextRTP;
+ return true;
+ }
m_nCurPos = m_nSize;
return false;
@@ -71,7 +77,7 @@ bool CH264Nalu::ReadNext()
nTemp = (nTemp << 8) + m_pBuffer[m_nCurPos++];
}
m_nNextRTP += nTemp + m_nNALSize;
- MoveToNextStartcode();
+ MoveToNextRTPStartcode();
} else {
// Remove trailing bits
while (m_pBuffer[m_nCurPos]==0x00 && ((*((DWORD*)(m_pBuffer+m_nCurPos)) & 0x00FFFFFF) != 0x00010000)) {
@@ -82,7 +88,7 @@ bool CH264Nalu::ReadNext()
m_nNALStartPos = m_nCurPos;
m_nCurPos += 3;
m_nNALDataPos = m_nCurPos;
- MoveToNextStartcode();
+ MoveToNextAnnexBStartcode();
}
forbidden_bit = (m_pBuffer[m_nNALDataPos]>>7) & 1;
diff --git a/src/DSUtil/H264Nalu.h b/src/DSUtil/H264Nalu.h
index 6f3a67f5e..905a3462b 100644
--- a/src/DSUtil/H264Nalu.h
+++ b/src/DSUtil/H264Nalu.h
@@ -56,7 +56,8 @@ private :
int m_nSize;
int m_nNALSize;
- bool MoveToNextStartcode();
+ bool MoveToNextAnnexBStartcode();
+ bool MoveToNextRTPStartcode();
public :
NALU_TYPE GetType() const {
diff --git a/src/DSUtil/MediaTypeEx.cpp b/src/DSUtil/MediaTypeEx.cpp
index 4cd6dcef2..ee0abb5e0 100644
--- a/src/DSUtil/MediaTypeEx.cpp
+++ b/src/DSUtil/MediaTypeEx.cpp
@@ -304,6 +304,7 @@ CString CMediaTypeEx::GetAudioCodecName(const GUID& subtype, WORD wFormatTag)
names[WAVE_FORMAT_DOLBY_AC3] = _T("Dolby AC3");
names[WAVE_FORMAT_DVD_DTS] = _T("DTS");
names[WAVE_FORMAT_AAC] = _T("AAC");
+ names[WAVE_FORMAT_LATM_AAC] = _T("AAC(LATM)");
names[WAVE_FORMAT_FLAC] = _T("FLAC");
names[WAVE_FORMAT_TTA1] = _T("TTA");
names[WAVE_FORMAT_14_4] = _T("RealAudio 14.4");
diff --git a/src/DSUtil/Mpeg2Def.h b/src/DSUtil/Mpeg2Def.h
index cdb855872..803f8f199 100644
--- a/src/DSUtil/Mpeg2Def.h
+++ b/src/DSUtil/Mpeg2Def.h
@@ -41,7 +41,7 @@ enum PES_STREAM_TYPE {
PES_0e = 0x0e, // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 auxiliary
PES_0f = 0x0f, // ISO/IEC 13818-7 Audio with ADTS transport syntax
PES_10 = 0x10, // ISO/IEC 14496-2 Visual
- PES_11 = 0x11, // ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1
+ AUDIO_STREAM_AAC_LATM = 0x11, // ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1
PES_12 = 0x12, // ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets
PES_13 = 0x13, // ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC14496_sections.
PES_14 = 0x14, // ISO/IEC 13818-6 Synchronized Download Protocol
diff --git a/src/DSUtil/stdafx.h b/src/DSUtil/stdafx.h
index 9177780b0..87ebe7ce9 100644
--- a/src/DSUtil/stdafx.h
+++ b/src/DSUtil/stdafx.h
@@ -19,9 +19,9 @@
#pragma once
#include "SharedInclude.h"
-#include "../../../../include/stdafx_common.h"
-#include "../../../../include/stdafx_common_afx.h"
-#include "../../../../include/stdafx_common_dshow.h"
+#include "../../include/stdafx_common.h"
+#include "../../include/stdafx_common_afx.h"
+#include "../../include/stdafx_common_dshow.h"
#include <atlcoll.h>
#include <atlpath.h>
diff --git a/src/apps/MPCTestAPI/HScrollListBox.cpp b/src/apps/MPCTestAPI/HScrollListBox.cpp
new file mode 100644
index 000000000..99cb55a16
--- /dev/null
+++ b/src/apps/MPCTestAPI/HScrollListBox.cpp
@@ -0,0 +1,170 @@
+/////////////////////////////////////////////////////////////////////////////
+// HScrollListBox.cpp : implementation file
+//
+// Copyright (c) 2002, Nebula Technologies, Inc.
+// www.nebutech.com
+//
+// Nebula Technologies, Inc. grants you a royalty free
+// license to use, modify and distribute this code
+// provided that this copyright notice appears on all
+// copies. This code is provided "AS IS," without a
+// warranty of any kind.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "HScrollListBox.h"
+
+/////////////////////////////////////////////////////////////////////////////
+BEGIN_MESSAGE_MAP(CHScrollListBox, CListBox)
+ //{{AFX_MSG_MAP(CHScrollListBox)
+ // NOTE - the ClassWizard will add and remove mapping macros here.
+ //}}AFX_MSG_MAP
+ ON_MESSAGE(LB_ADDSTRING, OnAddString)
+ ON_MESSAGE(LB_INSERTSTRING, OnInsertString)
+ ON_MESSAGE(LB_DELETESTRING, OnDeleteString)
+ ON_MESSAGE(LB_DIR, OnDir)
+ ON_MESSAGE(LB_RESETCONTENT, OnResetContent)
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CHScrollListBox
+/////////////////////////////////////////////////////////////////////////////
+CHScrollListBox::CHScrollListBox()
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////
+CHScrollListBox::~CHScrollListBox()
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////
+void CHScrollListBox::PreSubclassWindow()
+{
+ CListBox::PreSubclassWindow();
+
+#ifdef _DEBUG
+ // NOTE: this list box is designed to work as a single column, system-drawn
+ // list box. The asserts below will ensure of that.
+ DWORD dwStyle = GetStyle();
+ ASSERT((dwStyle & LBS_MULTICOLUMN) == 0);
+ ASSERT((dwStyle & LBS_OWNERDRAWFIXED) == 0);
+ ASSERT((dwStyle & LBS_OWNERDRAWVARIABLE) == 0);
+#endif
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CHScrollListBox message handlers
+///////////////////////////////////////////////////////////////////////////////
+int CHScrollListBox::GetTextLen(LPCTSTR lpszText)
+{
+ ASSERT(AfxIsValidString(lpszText));
+
+ CDC *pDC = GetDC();
+ ASSERT(pDC);
+
+ CSize size;
+ CFont* pOldFont = pDC->SelectObject(GetFont());
+ if ((GetStyle() & LBS_USETABSTOPS) == 0) {
+ size = pDC->GetTextExtent(lpszText, (int) _tcslen(lpszText));
+ size.cx += 3;
+ } else {
+ // Expand tabs as well
+ size = pDC->GetTabbedTextExtent(lpszText, (int) _tcslen(lpszText), 0, NULL);
+ size.cx += 2;
+ }
+ pDC->SelectObject(pOldFont);
+ ReleaseDC(pDC);
+
+ return size.cx;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void CHScrollListBox::ResetHExtent()
+{
+ if (GetCount() == 0) {
+ SetHorizontalExtent(0);
+ return;
+ }
+
+ CWaitCursor cwc;
+ int iMaxHExtent = 0;
+ for (int i = 0; i < GetCount(); i++) {
+ CString csText;
+ GetText(i, csText);
+ int iExt = GetTextLen(csText);
+ if (iExt > iMaxHExtent) {
+ iMaxHExtent = iExt;
+ }
+ }
+ SetHorizontalExtent(iMaxHExtent);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void CHScrollListBox::SetNewHExtent(LPCTSTR lpszNewString)
+{
+ int iExt = GetTextLen(lpszNewString);
+ if (iExt > GetHorizontalExtent()) {
+ SetHorizontalExtent(iExt);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// OnAddString: wParam - none, lParam - string, returns - int
+///////////////////////////////////////////////////////////////////////////////
+LRESULT CHScrollListBox::OnAddString(WPARAM /*wParam*/, LPARAM lParam)
+{
+ LRESULT lResult = Default();
+ if (!((lResult == LB_ERR) || (lResult == LB_ERRSPACE))) {
+ SetNewHExtent((LPCTSTR) lParam);
+ }
+ return lResult;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// OnInsertString: wParam - index, lParam - string, returns - int
+///////////////////////////////////////////////////////////////////////////////
+LRESULT CHScrollListBox::OnInsertString(WPARAM /*wParam*/, LPARAM lParam)
+{
+ LRESULT lResult = Default();
+ if (!((lResult == LB_ERR) || (lResult == LB_ERRSPACE))) {
+ SetNewHExtent((LPCTSTR) lParam);
+ }
+ return lResult;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// OnDeleteString: wParam - index, lParam - none, returns - int
+///////////////////////////////////////////////////////////////////////////////
+LRESULT CHScrollListBox::OnDeleteString(WPARAM /*wParam*/, LPARAM /*lParam*/)
+{
+ LRESULT lResult = Default();
+ if (!((lResult == LB_ERR) || (lResult == LB_ERRSPACE))) {
+ ResetHExtent();
+ }
+ return lResult;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// OnDir: wParam - attr, lParam - wildcard, returns - int
+///////////////////////////////////////////////////////////////////////////////
+LRESULT CHScrollListBox::OnDir(WPARAM /*wParam*/, LPARAM /*lParam*/)
+{
+ LRESULT lResult = Default();
+ if (!((lResult == LB_ERR) || (lResult == LB_ERRSPACE))) {
+ ResetHExtent();
+ }
+ return lResult;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// OnResetContent: wParam - none, lParam - none, returns - int
+///////////////////////////////////////////////////////////////////////////////
+LRESULT CHScrollListBox::OnResetContent(WPARAM /*wParam*/, LPARAM /*lParam*/)
+{
+ LRESULT lResult = Default();
+ SetHorizontalExtent(0);
+ return lResult;
+}
+
diff --git a/src/apps/MPCTestAPI/HScrollListBox.h b/src/apps/MPCTestAPI/HScrollListBox.h
new file mode 100644
index 000000000..ca69c595b
--- /dev/null
+++ b/src/apps/MPCTestAPI/HScrollListBox.h
@@ -0,0 +1,62 @@
+/////////////////////////////////////////////////////////////////////////////
+// HScrollListBox.h : header file
+//
+// Copyright (c) 2002, Nebula Technologies, Inc.
+// www.nebutech.com
+//
+// Nebula Technologies, Inc. grants you a royalty free
+// license to use, modify and distribute this code
+// provided that this copyright notice appears on all
+// copies. This code is provided "AS IS," without a
+// warranty of any kind.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+/////////////////////////////////////////////////////////////////////////////
+// CHScrollListBox window
+/////////////////////////////////////////////////////////////////////////////
+class CHScrollListBox : public CListBox
+{
+ // Construction
+public:
+ CHScrollListBox();
+
+ // Attributes
+public:
+
+ // Operations
+public:
+
+ // Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CHScrollListBox)
+protected:
+ virtual void PreSubclassWindow();
+ //}}AFX_VIRTUAL
+
+ // Implementation
+public:
+ virtual ~CHScrollListBox();
+
+ // Generated message map functions
+protected:
+ //{{AFX_MSG(CHScrollListBox)
+ // NOTE - the ClassWizard will add and remove member functions here.
+ //}}AFX_MSG
+
+ afx_msg LRESULT OnAddString(WPARAM wParam, LPARAM lParam); // wParam - none, lParam - string, returns - int
+ afx_msg LRESULT OnInsertString(WPARAM wParam, LPARAM lParam); // wParam - index, lParam - string, returns - int
+ afx_msg LRESULT OnDeleteString(WPARAM wParam, LPARAM lParam); // wParam - index, lParam - none, returns - int
+ afx_msg LRESULT OnResetContent(WPARAM wParam, LPARAM lParam); // wParam - none, lParam - none, returns - int
+ afx_msg LRESULT OnDir(WPARAM wParam, LPARAM lParam); // wParam - attr, lParam - wildcard, returns - int
+
+ DECLARE_MESSAGE_MAP()
+
+private:
+ void ResetHExtent();
+ void SetNewHExtent(LPCTSTR lpszNewString);
+ int GetTextLen(LPCTSTR lpszText);
+
+};
diff --git a/src/apps/MPCTestAPI/MPCTestAPI.rc b/src/apps/MPCTestAPI/MPCTestAPI.rc
index 82841cd92..10dd3c9ee 100644
--- a/src/apps/MPCTestAPI/MPCTestAPI.rc
+++ b/src/apps/MPCTestAPI/MPCTestAPI.rc
@@ -7,7 +7,8 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
-#include "afxres.h"
+#include "afxres.h"
+
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -60,11 +61,20 @@ IDR_RT_MANIFEST RT_MANIFEST "res\\MPCTestAPI.exe.manifest"
/////////////////////////////////////////////////////////////////////////////
//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON "res\\RegisterCopyData.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Dialog
//
IDD_ABOUTBOX DIALOGEX 0, 0, 244, 57
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION
CAPTION "About MPC-HC Test API"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
@@ -82,7 +92,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
PUSHBUTTON "Start MPC-HC",IDC_BUTTON_FINDWINDOW,457,7,57,18
EDITTEXT IDC_EDIT1,7,7,434,14,ES_AUTOHSCROLL
- LISTBOX IDC_LOGLIST,7,89,507,310,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+ LISTBOX IDC_LOGLIST,7,89,507,310,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
LTEXT "Messages from MPC-HC",IDC_STATIC,7,74,507,10
EDITTEXT IDC_EDIT2,154,41,287,14,ES_AUTOHSCROLL
PUSHBUTTON "Send command",IDC_BUTTON_SENDCOMMAND,457,39,57,18
@@ -225,15 +235,6 @@ END
/////////////////////////////////////////////////////////////////////////////
//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDR_MAINFRAME ICON "res\\RegisterCopyData.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
// String Table
//
diff --git a/src/apps/MPCTestAPI/MPCTestAPI.vcproj b/src/apps/MPCTestAPI/MPCTestAPI.vcproj
index 02d2c9da0..fcd89717d 100644
--- a/src/apps/MPCTestAPI/MPCTestAPI.vcproj
+++ b/src/apps/MPCTestAPI/MPCTestAPI.vcproj
@@ -307,6 +307,10 @@
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
+ RelativePath=".\HScrollListBox.cpp"
+ >
+ </File>
+ <File
RelativePath=".\MPCTestAPI.cpp"
>
</File>
@@ -356,6 +360,14 @@
Filter="h;hpp;hxx;hm;inl"
>
<File
+ RelativePath=".\HScrollListBox.h"
+ >
+ </File>
+ <File
+ RelativePath="..\mplayerc\MpcApi.h"
+ >
+ </File>
+ <File
RelativePath=".\MPCTestAPI.h"
>
</File>
@@ -381,10 +393,6 @@
>
</File>
<File
- RelativePath=".\res\MPCTestAPI.rc2"
- >
- </File>
- <File
RelativePath=".\res\RegisterCopyData.ico"
>
</File>
diff --git a/src/apps/MPCTestAPI/MPCTestAPI.vcxproj b/src/apps/MPCTestAPI/MPCTestAPI.vcxproj
index 21e73e6b6..8b6aa49de 100644
--- a/src/apps/MPCTestAPI/MPCTestAPI.vcxproj
+++ b/src/apps/MPCTestAPI/MPCTestAPI.vcxproj
@@ -82,6 +82,8 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level4</WarningLevel>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -95,6 +97,8 @@
<ClCompile>
<PreprocessorDefinitions>_WIN64;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <WarningLevel>Level4</WarningLevel>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -107,6 +111,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level4</WarningLevel>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -120,6 +125,7 @@
<ClCompile>
<PreprocessorDefinitions>_WIN64;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
+ <WarningLevel>Level4</WarningLevel>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -133,6 +139,7 @@
<ClCompile Include="..\..\thirdparty\mfc\afxctrlcontainer.cpp" />
<ClCompile Include="..\..\thirdparty\mfc\afxglobals.cpp" />
<ClCompile Include="..\..\thirdparty\mfc\winmdi.cpp" />
+ <ClCompile Include="HScrollListBox.cpp" />
<ClCompile Include="MPCTestAPI.cpp">
</ClCompile>
<ClCompile Include="MPCTestAPIDlg.cpp">
@@ -149,6 +156,8 @@
</ResourceCompile>
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="..\mplayerc\MpcApi.h" />
+ <ClInclude Include="HScrollListBox.h" />
<ClInclude Include="MPCTestAPI.h" />
<ClInclude Include="MPCTestAPIDlg.h" />
<ClInclude Include="resource.h" />
diff --git a/src/apps/MPCTestAPI/MPCTestAPI.vcxproj.filters b/src/apps/MPCTestAPI/MPCTestAPI.vcxproj.filters
index 4fff7a1e9..3b7a6bffd 100644
--- a/src/apps/MPCTestAPI/MPCTestAPI.vcxproj.filters
+++ b/src/apps/MPCTestAPI/MPCTestAPI.vcxproj.filters
@@ -33,6 +33,9 @@
<ClCompile Include="..\..\thirdparty\mfc\winmdi.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="HScrollListBox.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="MPCTestAPI.h">
@@ -47,6 +50,12 @@
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\mplayerc\MpcApi.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="HScrollListBox.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MPCTestAPI.rc">
diff --git a/src/apps/MPCTestAPI/MPCTestAPIDlg.cpp b/src/apps/MPCTestAPI/MPCTestAPIDlg.cpp
index 51c54593f..bf04c7ec6 100644
--- a/src/apps/MPCTestAPI/MPCTestAPIDlg.cpp
+++ b/src/apps/MPCTestAPI/MPCTestAPIDlg.cpp
@@ -95,6 +95,7 @@ CRegisterCopyDataDlg::CRegisterCopyDataDlg(CWnd* pParent /*=NULL*/)
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
+
void CRegisterCopyDataDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
@@ -102,7 +103,7 @@ void CRegisterCopyDataDlg::DoDataExchange(CDataExchange* pDX)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
DDX_Text(pDX, IDC_EDIT1, m_strMPCPath);
- DDX_Control(pDX, IDC_LOGLIST, m_lbLog);
+ DDX_Control(pDX, IDC_LOGLIST, m_listBox);
DDX_Text(pDX, IDC_EDIT2, m_txtCommand);
DDX_CBIndex(pDX, IDC_COMBO1, m_nCommandType);
}
@@ -118,6 +119,7 @@ BEGIN_MESSAGE_MAP(CRegisterCopyDataDlg, CDialog)
ON_BN_CLICKED(IDC_BUTTON_SENDCOMMAND, &CRegisterCopyDataDlg::OnBnClickedButtonSendcommand)
END_MESSAGE_MAP()
+
/////////////////////////////////////////////////////////////////////////////
// CRegisterCopyDataDlg message handlers
@@ -148,41 +150,35 @@ BOOL CRegisterCopyDataDlg::OnInitDialog()
// TODO: Add extra initialization here
#if (_MSC_VER == 1600)
-#if defined (_DEBUG)
-#if defined (_WIN64)
- m_strMPCPath = _T("..\\..\\..\\..\\..\\bin10\\mpc-hc_x64_Debug\\mpc-hc.exe");
-#else
- m_strMPCPath = _T("..\\..\\..\\..\\..\\bin10\\mpc-hc_x86_Debug\\mpc-hc.exe");
-#endif // _WIN64
-#else
+ m_strMPCPath = _T("..\\..\\..\\..\\..\\bin10\\");
+#elif (_MSC_VER < 1600)
+ m_strMPCPath = _T("..\\..\\..\\..\\..\\bin\\");
+#endif // _MSC_VER == 1600
+
#if defined (_WIN64)
- m_strMPCPath = _T("..\\..\\..\\..\\..\\bin10\\mpc-hc_x64\\mpc-hc.exe");
+ m_strMPCPath += _T("mpc-hc_x64");
#else
- m_strMPCPath = _T("..\\..\\..\\..\\..\\bin10\\mpc-hc_x86\\mpc-hc.exe");
+ m_strMPCPath += _T("mpc-hc_x86");
#endif // _WIN64
-#endif // _DEBUG
-#elif (_MSC_VER < 1600)
#if defined (_DEBUG)
-#if defined (_WIN64)
- m_strMPCPath = _T("..\\..\\..\\..\\..\\bin\\mpc-hc_x64_Debug\\mpc-hc.exe");
-#else
- m_strMPCPath = _T("..\\..\\..\\..\\..\\bin\\mpc-hc_x86_Debug\\mpc-hc.exe");
-#endif // _WIN64
+ m_strMPCPath += _T("_Debug\\");
#else
+ m_strMPCPath += _T("\\");
+#endif // _DEBUG
+
#if defined (_WIN64)
- m_strMPCPath = _T("..\\..\\..\\..\\..\\bin\\mpc-hc_x64\\mpc-hc.exe");
+ m_strMPCPath += _T("mpc-hc64.exe");
#else
- m_strMPCPath = _T("..\\..\\..\\..\\..\\bin\\mpc-hc_x86\\mpc-hc.exe");
+ m_strMPCPath += _T("mpc-hc.exe");
#endif // _WIN64
-#endif // _DEBUG
-#endif // _MSC_VER == 1600
UpdateData(FALSE);
- return TRUE; // return TRUE unless you set the focus to a control
+ return TRUE; // return TRUE unless you set the focus to a control
}
+
void CRegisterCopyDataDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX) {
@@ -202,7 +198,7 @@ void CRegisterCopyDataDlg::OnPaint()
if (IsIconic()) {
CPaintDC dc(this); // device context for painting
- SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
+ SendMessage(WM_ICONERASEBKGND, (WPARAM)dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
@@ -219,6 +215,7 @@ void CRegisterCopyDataDlg::OnPaint()
}
}
+
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CRegisterCopyDataDlg::OnQueryDragIcon()
@@ -227,14 +224,13 @@ HCURSOR CRegisterCopyDataDlg::OnQueryDragIcon()
}
-
void CRegisterCopyDataDlg::OnButtonFindwindow()
{
- CString strExec;
- STARTUPINFO StartupInfo;
- PROCESS_INFORMATION ProcessInfo;
+ CString strExec;
+ STARTUPINFO StartupInfo;
+ PROCESS_INFORMATION ProcessInfo;
- strExec.Format (_T("%s /slave %d"), m_strMPCPath, GetSafeHwnd());
+ strExec.Format (_T("%s /slave %d"), m_strMPCPath, GetSafeHwnd());
UpdateData(TRUE);
memset (&StartupInfo, 0, sizeof(StartupInfo));
@@ -244,41 +240,35 @@ void CRegisterCopyDataDlg::OnButtonFindwindow()
}
-struct MyStruct {
- int nNum;
- TCHAR szData[256];
-
-};
void CRegisterCopyDataDlg::Senddata(MPCAPI_COMMAND nCmd, LPCTSTR strCommand)
{
if (m_hWndMPC) {
COPYDATASTRUCT MyCDS;
- MyCDS.dwData = nCmd;
- MyCDS.cbData = (_tcslen (strCommand) + 1) * sizeof(TCHAR);
- MyCDS.lpData = (LPVOID) strCommand;
+ MyCDS.dwData = nCmd;
+ MyCDS.cbData = (DWORD)(_tcslen (strCommand) + 1) * sizeof(TCHAR);
+ MyCDS.lpData = (LPVOID) strCommand;
::SendMessage (m_hWndMPC, WM_COPYDATA, (WPARAM)GetSafeHwnd(), (LPARAM)&MyCDS);
}
}
+
BOOL CRegisterCopyDataDlg::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct)
{
CString strMsg;
- MyStruct *tcsBuff=(MyStruct*)(pCopyDataStruct->lpData);
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);
+ m_listBox.InsertString (0, strMsg);
return CDialog::OnCopyData(pWnd, pCopyDataStruct);
}
-
void CRegisterCopyDataDlg::OnBnClickedButtonSendcommand()
{
CString strEmpty (_T(""));
diff --git a/src/apps/MPCTestAPI/MPCTestAPIDlg.h b/src/apps/MPCTestAPI/MPCTestAPIDlg.h
index 0a23c2f72..e99deccff 100644
--- a/src/apps/MPCTestAPI/MPCTestAPIDlg.h
+++ b/src/apps/MPCTestAPI/MPCTestAPIDlg.h
@@ -3,6 +3,7 @@
#pragma once
#include "../mplayerc/MpcApi.h"
+#include "HScrollListBox.h"
/////////////////////////////////////////////////////////////////////////////
@@ -44,7 +45,7 @@ protected:
DECLARE_MESSAGE_MAP()
public:
CString m_strMPCPath;
- CListBox m_lbLog;
+ CHScrollListBox m_listBox;
CString m_txtCommand;
int m_nCommandType;
afx_msg void OnBnClickedButtonSendcommand();
diff --git a/src/apps/mplayerc/AppSettings.cpp b/src/apps/mplayerc/AppSettings.cpp
index c9d91569e..8a325ce37 100644
--- a/src/apps/mplayerc/AppSettings.cpp
+++ b/src/apps/mplayerc/AppSettings.cpp
@@ -342,8 +342,8 @@ void CAppSettings::CreateCommands()
ADDCMD((ID_DVD_SUB_ONOFF, 0, FVIRTKEY|FNOINVERT, IDS_MPLAYERC_97));
ADDCMD((ID_VIEW_TEARING_TEST, 'T', FVIRTKEY|FCONTROL|FNOINVERT, IDS_AG_TEARING_TEST));
ADDCMD((ID_VIEW_REMAINING_TIME, 'I', FVIRTKEY|FCONTROL|FNOINVERT, IDS_MPLAYERC_98));
- ADDCMD((ID_SHADER_TOGGLE, 'P', FVIRTKEY|FCONTROL|FNOINVERT, IDS_AT_TOGGLE_SHADER));
- ADDCMD((ID_SHADER_TOGGLESCREENSPACE, 'P', FVIRTKEY|FCONTROL|FALT|FNOINVERT, IDS_AT_TOGGLE_SHADERSCREENSPACE));
+ ADDCMD((ID_SHADERS_TOGGLE, 'P', FVIRTKEY|FCONTROL|FNOINVERT, IDS_AT_TOGGLE_SHADER));
+ ADDCMD((ID_SHADERS_TOGGLE_SCREENSPACE, 'P', FVIRTKEY|FCONTROL|FALT|FNOINVERT, IDS_AT_TOGGLE_SHADERSCREENSPACE));
ADDCMD((ID_D3DFULLSCREEN_TOGGLE, 'F', FVIRTKEY|FCONTROL|FNOINVERT, IDS_MPLAYERC_99));
ADDCMD((ID_GOTO_PREV_SUB, 'Y', FVIRTKEY|FNOINVERT, IDS_MPLAYERC_100, APPCOMMAND_BROWSER_BACKWARD));
ADDCMD((ID_GOTO_NEXT_SUB, 'U', FVIRTKEY|FNOINVERT, IDS_MPLAYERC_101, APPCOMMAND_BROWSER_FORWARD));
@@ -372,27 +372,28 @@ 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 if (iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS ||
iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM ||
iDSVideoRendererType == VIDRNDT_DS_MADVR ||
iDSVideoRendererType == VIDRNDT_DS_SYNC) {
return fD3DFullscreen;
- } else
+ } else {
return false;
+ }
}
CString CAppSettings::SelectedAudioRenderer() const
{
CString strResult;
- if(AfxGetMyApp()->m_AudioRendererDisplayName_CL != _T("")) {
+ if (AfxGetMyApp()->m_AudioRendererDisplayName_CL != _T("")) {
strResult = AfxGetMyApp()->m_AudioRendererDisplayName_CL;
} else {
strResult = AfxGetAppSettings().strAudioRendererDisplayName;
@@ -497,8 +498,8 @@ void CAppSettings::UpdateData(bool fSave)
UINT len;
BYTE* ptr = NULL;
- if(fSave) {
- if(!fInitialized) {
+ if (fSave) {
+ if (!fInitialized) {
return;
}
@@ -685,22 +686,22 @@ 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) {
+ 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;
}
@@ -709,22 +710,22 @@ void CAppSettings::UpdateData(bool fSave)
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)));
@@ -740,7 +741,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]);
@@ -748,9 +749,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;
@@ -830,10 +831,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;
@@ -844,21 +845,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) {
+ 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);
@@ -972,7 +973,7 @@ void CAppSettings::UpdateData(bool fSave)
{
CString temp = pApp->GetProfileString(IDS_R_SETTINGS, IDS_RS_SPLOGFONT, _T(""));
subdefstyle <<= temp;
- if(temp == _T("")) {
+ if (temp == _T("")) {
subdefstyle.relativeTo = 1; //default "Position subtitles relative to the video frame" option is checked
}
}
@@ -997,8 +998,8 @@ void CAppSettings::UpdateData(bool fSave)
memcpy( pSpeakerToChannelMap, ptr, sizeof(pSpeakerToChannelMap) );
} else {
memset(pSpeakerToChannelMap, 0, sizeof(pSpeakerToChannelMap));
- for(int j = 0; j < 18; j++)
- for(int i = 0; i <= j; i++) {
+ for (int j = 0; j < 18; j++)
+ for (int i = 0; i <= j; i++) {
pSpeakerToChannelMap[j][i] = 1<<i;
}
@@ -1033,7 +1034,7 @@ void CAppSettings::UpdateData(bool fSave)
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);
@@ -1042,11 +1043,11 @@ 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(""));
@@ -1057,29 +1058,29 @@ void CAppSettings::UpdateData(bool fSave)
}
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()) {
+ 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()) {
+ if (guid.IsEmpty()) {
break;
}
f->guids.AddTail(GUIDFromCString(guid));
}
f->iLoadType = (int)pApp->GetProfileInt(key, _T("LoadType"), -1);
- if(f->iLoadType < 0) {
+ if (f->iLoadType < 0) {
break;
}
@@ -1096,16 +1097,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()) {
+ 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;
@@ -1121,28 +1122,28 @@ 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()) {
+ 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) {
+ if (n >= 6) {
wc.mouse = (UINT)mouse;
}
- if(n >= 7) {
+ if (n >= 7) {
wc.appcmd = (UINT)appcmd;
}
wc.rmcmd = CStringA(buff).Trim('\"');
@@ -1153,7 +1154,7 @@ void CAppSettings::UpdateData(bool fSave)
CAtlArray<ACCEL> pAccel;
pAccel.SetCount(wmcmds.GetCount());
POSITION pos = wmcmds.GetHeadPosition();
- for(int i = 0; pos; i++) {
+ for (int i = 0; pos; i++) {
pAccel[i] = wmcmds.GetNext(pos);
}
hAccel = CreateAcceleratorTable(pAccel.GetData(), pAccel.GetCount());
@@ -1212,11 +1213,11 @@ void CAppSettings::UpdateData(bool fSave)
CRegKey key;
// grrrrr
- // if(!SHGetSpecialFolderPath(NULL, MyPictures.GetBufferSetLength(_MAX_PATH), CSIDL_MYPICTURES, TRUE)) MyPictures.Empty();
+ // 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)) {
+ if (ERROR_SUCCESS == key.QueryStringValue(_T("My Pictures"), MyPictures.GetBuffer(_MAX_PATH), &len)) {
MyPictures.ReleaseBufferSetLength(len);
} else {
MyPictures.Empty();
@@ -1260,17 +1261,17 @@ 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()) {
+ if (label.IsEmpty()) {
break;
}
- if(sl.GetCount() < 3) {
+ if (sl.GetCount() < 3) {
continue;
}
@@ -1286,11 +1287,11 @@ 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;
@@ -1346,7 +1347,7 @@ 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;
@@ -1398,7 +1399,7 @@ void CAppSettings::UpdateData(bool fSave)
strShadercombine = pApp->GetProfileString(_T("Shaders"), _T("Combine"), _T(""));
strShadercombineScreenSpace = pApp->GetProfileString(_T("Shaders"), _T("CombineScreenSpace"), _T(""));
- if(fLaunchfullscreen) {
+ if (fLaunchfullscreen) {
nCLSwitches |= CLSW_FULLSCREEN;
}
@@ -1411,7 +1412,7 @@ 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_DX9_RESIZER, r.iDX9Resizer);
@@ -1502,16 +1503,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;
}
@@ -1595,7 +1596,7 @@ __int64 CAppSettings::ConvertTimeToMSec(CString& time) const
void CAppSettings::ExtractDVDStartPos(CString& strParam)
{
int i = 0, j = 0;
- for(CString token = strParam.Tokenize(_T("#"), i);
+ for (CString token = strParam.Tokenize(_T("#"), i);
j < 3 && !token.IsEmpty();
token = strParam.Tokenize(_T("#"), i), j++) {
switch (j) {
@@ -1634,107 +1635,107 @@ void CAppSettings::ParseCommandLine(CAtlList<CString>& cmdln)
strPnSPreset.Empty();
POSITION pos = cmdln.GetHeadPosition();
- while(pos) {
+ while (pos) {
CString param = cmdln.GetNext(pos);
- if(param.IsEmpty()) {
+ 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")) {
+ if (sw == _T("open")) {
nCLSwitches |= CLSW_OPEN;
- } else if(sw == _T("play")) {
+ } else if (sw == _T("play")) {
nCLSwitches |= CLSW_PLAY;
- } else if(sw == _T("fullscreen")) {
+ } else if (sw == _T("fullscreen")) {
nCLSwitches |= CLSW_FULLSCREEN;
- } else if(sw == _T("minimized")) {
+ } else if (sw == _T("minimized")) {
nCLSwitches |= CLSW_MINIMIZED;
- } else if(sw == _T("new")) {
+ } else if (sw == _T("new")) {
nCLSwitches |= CLSW_NEW;
- } else if(sw == _T("help") || sw == _T("h") || sw == _T("?")) {
+ } else if (sw == _T("help") || sw == _T("h") || sw == _T("?")) {
nCLSwitches |= CLSW_HELP;
- } else if(sw == _T("dub") && pos) {
+ } else if (sw == _T("dub") && pos) {
slDubs.AddTail(cmdln.GetNext(pos));
- } else if(sw == _T("dubdelay") && pos) {
+ } else if (sw == _T("dubdelay") && pos) {
CString strFile = cmdln.GetNext(pos);
int nPos = strFile.Find (_T("DELAY"));
if (nPos != -1) {
rtShift = 10000 * _tstol(strFile.Mid(nPos + 6));
}
slDubs.AddTail(strFile);
- } else if(sw == _T("sub") && pos) {
+ } else if (sw == _T("sub") && pos) {
slSubs.AddTail(cmdln.GetNext(pos));
- } else if(sw == _T("filter") && pos) {
+ } else if (sw == _T("filter") && pos) {
slFilters.AddTail(cmdln.GetNext(pos));
- } else if(sw == _T("dvd")) {
+ } else if (sw == _T("dvd")) {
nCLSwitches |= CLSW_DVD;
- } else if(sw == _T("dvdpos")) {
+ } else if (sw == _T("dvdpos")) {
ExtractDVDStartPos(cmdln.GetNext(pos));
- } else if(sw == _T("cd")) {
+ } else if (sw == _T("cd")) {
nCLSwitches |= CLSW_CD;
- } else if(sw == _T("add")) {
+ } else if (sw == _T("add")) {
nCLSwitches |= CLSW_ADD;
- } else if(sw == _T("regvid")) {
+ } else if (sw == _T("regvid")) {
nCLSwitches |= CLSW_REGEXTVID;
- } else if(sw == _T("regaud")) {
+ } else if (sw == _T("regaud")) {
nCLSwitches |= CLSW_REGEXTAUD;
- } else if(sw == _T("unregall")) {
+ } else if (sw == _T("unregall")) {
nCLSwitches |= CLSW_UNREGEXT;
- } else if(sw == _T("unregvid")) {
+ } else if (sw == _T("unregvid")) {
nCLSwitches |= CLSW_UNREGEXT; /* keep for compatibility with old versions */
- } else if(sw == _T("unregaud")) {
+ } else if (sw == _T("unregaud")) {
nCLSwitches |= CLSW_UNREGEXT; /* keep for compatibility with old versions */
- } else if(sw == _T("start") && pos) {
+ } 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")) {
+ } else if (sw == _T("nofocus")) {
nCLSwitches |= CLSW_NOFOCUS;
- } else if(sw == _T("close")) {
+ } else if (sw == _T("close")) {
nCLSwitches |= CLSW_CLOSE;
- } else if(sw == _T("standby")) {
+ } else if (sw == _T("standby")) {
nCLSwitches |= CLSW_STANDBY;
- } else if(sw == _T("hibernate")) {
+ } else if (sw == _T("hibernate")) {
nCLSwitches |= CLSW_HIBERNATE;
- } else if(sw == _T("shutdown")) {
+ } else if (sw == _T("shutdown")) {
nCLSwitches |= CLSW_SHUTDOWN;
- } else if(sw == _T("logoff")) {
+ } else if (sw == _T("logoff")) {
nCLSwitches |= CLSW_LOGOFF;
- } else if(sw == _T("d3dfs")) {
+ } else if (sw == _T("d3dfs")) {
nCLSwitches |= CLSW_D3DFULLSCREEN;
- } else if(sw == _T("adminoption")) {
+ } 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")) {
+ } else if (sw == _T("pns")) {
strPnSPreset = cmdln.GetNext(pos);
- } else if(sw == _T("webport") && pos) {
+ } else if (sw == _T("webport") && pos) {
int tmpport = _tcstol(cmdln.GetNext(pos), NULL, 10);
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;
@@ -1751,7 +1752,7 @@ void CAppSettings::GetFav(favtype ft, CAtlList<CString>& sl)
CString root;
- switch(ft) {
+ switch (ft) {
case FAV_FILE:
root = IDS_R_FAVFILES;
break;
@@ -1765,11 +1766,11 @@ void CAppSettings::GetFav(favtype ft, CAtlList<CString>& sl)
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()) {
+ if (s.IsEmpty()) {
break;
}
sl.AddTail(s);
@@ -1780,7 +1781,7 @@ void CAppSettings::SetFav(favtype ft, CAtlList<CString>& sl)
{
CString root;
- switch(ft) {
+ switch (ft) {
case FAV_FILE:
root = IDS_R_FAVFILES;
break;
@@ -1798,7 +1799,7 @@ void CAppSettings::SetFav(favtype ft, CAtlList<CString>& sl)
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));
@@ -1809,7 +1810,7 @@ void CAppSettings::AddFav(favtype ft, CString s)
{
CAtlList<CString> sl;
GetFav(ft, sl);
- if(sl.Find(s)) {
+ if (sl.Find(s)) {
return;
}
sl.AddTail(s);
@@ -1848,7 +1849,7 @@ 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;
}
@@ -1856,7 +1857,7 @@ void CAppSettings::CRecentFileAndURLList::Add(LPCTSTR lpszPathName)
// fully qualify the path name
TCHAR szTemp[1024];
- if(fURL) {
+ if (fURL) {
_tcscpy_s(szTemp, lpszPathName);
} else {
AfxFullPath(szTemp, lpszPathName);
@@ -1865,7 +1866,7 @@ void CAppSettings::CRecentFileAndURLList::Add(LPCTSTR lpszPathName)
// update the MRU list, if an existing MRU string matches file name
int iMRU;
for (iMRU = 0; iMRU < m_nSize-1; iMRU++) {
- if((fURL && !_tcscmp(m_arrNames[iMRU], szTemp))
+ if ((fURL && !_tcscmp(m_arrNames[iMRU], szTemp))
|| AfxComparePath(m_arrNames[iMRU], szTemp)) {
break; // iMRU will point to matching entry
}
diff --git a/src/apps/mplayerc/AppSettings.h b/src/apps/mplayerc/AppSettings.h
index 300c2def9..f31b61d5e 100644
--- a/src/apps/mplayerc/AppSettings.h
+++ b/src/apps/mplayerc/AppSettings.h
@@ -76,7 +76,7 @@ enum {
MODE_SHOWCAPTIONMENU,
MODE_HIDEMENU,
MODE_FRAMEONLY,
- MODE_BORDERLESS,
+ MODE_BORDERLESS,
MODE_COUNT
}; // flags for Caption & Menu Mode
diff --git a/src/apps/mplayerc/AuthDlg.cpp b/src/apps/mplayerc/AuthDlg.cpp
index 29feb12c6..38c234042 100644
--- a/src/apps/mplayerc/AuthDlg.cpp
+++ b/src/apps/mplayerc/AuthDlg.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -53,7 +53,7 @@ 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;
@@ -75,16 +75,16 @@ 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(
+ if (ERROR_SUCCESS == RegEnumValue(
hSecKey, i++, username, &unlen, 0, &type, (BYTE*)password, &pwlen)) {
m_logins[username] = DEncrypt(password);
m_usernamectrl.AddString(username);
@@ -101,13 +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());
}
@@ -124,7 +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(""));
}
@@ -139,7 +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);
@@ -151,7 +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/BaseGraph.cpp b/src/apps/mplayerc/BaseGraph.cpp
index 3f3c27c3c..e806700d9 100644
--- a/src/apps/mplayerc/BaseGraph.cpp
+++ b/src/apps/mplayerc/BaseGraph.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -32,7 +32,7 @@
BOOL CPlayerWindow::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CWnd::PreCreateWindow(cs)) {
+ if (!CWnd::PreCreateWindow(cs)) {
return FALSE;
}
@@ -49,8 +49,8 @@ END_MESSAGE_MAP()
BOOL CPlayerWindow::OnEraseBkgnd(CDC* pDC)
{
- for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) {
- if(!pChild->IsWindowVisible()) {
+ for (CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) {
+ if (!pChild->IsWindowVisible()) {
continue;
}
@@ -103,7 +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);
}
@@ -112,7 +112,7 @@ void CBaseGraph::ClearMessageQueue()
void CBaseGraph::NotifyEvent(long lEventCode, LONG_PTR lParam1, LONG_PTR lParam2)
{
- if(!m_hNotifyWnd) {
+ if (!m_hNotifyWnd) {
return;
}
@@ -305,18 +305,18 @@ STDMETHODIMP CBaseGraph::GetEventHandle(OAEVENT* hEvent)
}
STDMETHODIMP CBaseGraph::GetEvent(long* lEventCode, LONG_PTR* lParam1, LONG_PTR* lParam2, long msTimeout)
{
- if(m_msgqueue.IsEmpty()) {
+ if (m_msgqueue.IsEmpty()) {
return E_FAIL;
}
GMSG msg = m_msgqueue.RemoveHead();
- if(lEventCode) {
+ if (lEventCode) {
*lEventCode = msg.m_lEventCode;
}
- if(lParam1) {
+ if (lParam1) {
*lParam1 = msg.m_lParam1;
}
- if(lParam2) {
+ if (lParam2) {
*lParam2 = msg.m_lParam2;
}
@@ -336,8 +336,8 @@ STDMETHODIMP CBaseGraph::RestoreDefaultHandling(long lEvCode)
}
STDMETHODIMP CBaseGraph::FreeEventParams(long lEvCode, LONG_PTR lParam1, LONG_PTR lParam2)
{
- if(EC_BG_ERROR == lEvCode) {
- if(lParam1) {
+ if (EC_BG_ERROR == lEvCode) {
+ if (lParam1) {
CoTaskMemFree((void*)lParam1);
}
}
@@ -352,7 +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;
}
@@ -377,7 +377,7 @@ STDMETHODIMP CBaseGraph::CheckCapabilities(DWORD* pCapabilities)
{
CheckPointer(pCapabilities, E_POINTER);
- if(*pCapabilities == 0) {
+ if (*pCapabilities == 0) {
return S_OK;
}
diff --git a/src/apps/mplayerc/CShockwaveFlash.h b/src/apps/mplayerc/CShockwaveFlash.h
index 5d722a53f..aac5998e4 100644
--- a/src/apps/mplayerc/CShockwaveFlash.h
+++ b/src/apps/mplayerc/CShockwaveFlash.h
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -33,7 +33,7 @@ protected:
public:
CLSID const& GetClsid() {
static CLSID const clsid
- = { 0xD27CDB6E, 0xAE6D, 0x11CF, { 0x96, 0xB8, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } };
+ = { 0xD27CDB6E, 0xAE6D, 0x11CF, { 0x96, 0xB8, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
diff --git a/src/apps/mplayerc/Changelog.txt b/src/apps/mplayerc/Changelog.txt
index 7ef9175b5..f8c485f35 100644
--- a/src/apps/mplayerc/Changelog.txt
+++ b/src/apps/mplayerc/Changelog.txt
@@ -2,14 +2,21 @@ next version - not yet released
==============================
NEW : Added optional fp32 (full float point) processing, fp16 is now half float point
NEW : Support for BluRay chapters
+ NEW : Ticket #1216, Added a "Clear" option to the playlist context menu
NEW : Ticket #1224, Added OSD messages when changing the audio boost and the audio balance
+ NEW : Ticket #1350, Added a time tooltip for the seek bar
+ NEW : Ticket #1377, Keep the same playback speed for all the items of the playlist
+ NEW : Ticket #1382, Added an OSD message when taking a screenshot
CHANGED: The filters' settings are now saved in
[HKCU\Software\Gabest\Media Player Classic\Filters]
+ CHANGED: Improved the OSD message when changing the playback speed
+ CHANGED: Changed the cursor for the seek bar: the hand cursor will be used only
+ when hovering the position marker
CHANGED: Updated libpng to v1.5.2
CHANGED: Updated MediaInfoLib to v0.7.44
CHANGED: Updated ZenLib to v0.4.19
CHANGED: Updated SoundTouch to v1.5.1pre r104
- CHANGED: Updated Little CMS to v2.2a
+ CHANGED: Updated Little CMS to v2.2
FIXED : Ticket #285, Ambarella AVC not correctly splitted by MPC-HC's internal
MP4/MOV source filter
FIXED : Ticket #384, disable Relative drive
@@ -26,10 +33,22 @@ next version - not yet released
other way, scroll/button down will decrease the value.
FIXED : Ticket #1029, MPEG-2 Profile detected incorrectly with MPEG splitter
FIXED : Ticket #1032, MPC-HC64 does not work with Flash 64-bit
+ FIXED : Ticket #1059, Don't add files to Windows recent files list when "keep
+ history of recently opened files" is unchecked.
FIXED : Ticket #1128, Thumbnails wider than 2048p
FIXED : Ticket #1157, The mute button had no effect if triggered during startup
+ FIXED : Ticket #1178, Fix OSD messages when toggling "Screen Space Pixel Shader" on/off
+ FIXED : Ticket #1212, Playing "Recent File" clears playlist, even though playlist
+ contains file
FIXED : Ticket #1220, MPC fails to play specific MKV files
+ FIXED : Ticket #1251, If the window is maximized, it will stay maximized when removing
+ the caption or the menus. The video frame will be extended rather than reducing
+ the size of the window.
FIXED : Ticket #1321, IMpegSplitterFilter uses CString - should be WCHAR or BSTR instead
+ FIXED : Ticket #1383, Fix OSD positioning: messages displayed at the top-right of the window
+ before going fullscreen were incorrectly positioned after switching to fullscreen
+ FIXED : DVB, Channel switching for H-264 services is more stable now
+ FIXED : Some OSD messages were not translatable
v1.5.1.2903 - 29 February 2011
@@ -37,639 +56,5 @@ v1.5.1.2903 - 29 February 2011
FIXED : Crash on Sandy Bridge processor
-v1.5.0.2827 - 31 January 2011
-==============================
- NEW : Added new options to always default to external subtitles, ignore
- embedded subtitles and to set the autoload subtitle paths
- NEW : Added support for "in24", "fl64", 8-bit "sowt", "IMA4" and "NONE"
- audio (old QuickTime PCM)
- NEW : Added support for "in24", "in32", "fl32", "fl64"
- (both big-endian and little-endian) in .mov files
- NEW : Ticket #784, Enable ctrl+A in the MediaInfo window
- NEW : [DVB] LCN support, added EPG current event information, offset parameter for
- scanning channels, added channel encryption detection for DVB-t during scan
- NEW : Added ignore encrypted channels checkbox during DVB scan
- NEW : Armenian translation
- CHANGED: Updated FFmpeg
- CHANGED: Updated MediaInfoLib to v0.7.39
- CHANGED: Updated ZenLib to v0.4.17
- CHANGED: Updated Little CMS to v2.1
- CHANGED: Updated libpng to v1.4.5
- CHANGED: Updated libogg to v1.2.2
- CHANGED: Updated libvorbis to v1.3.2
- CHANGED: Cleaned up and optimized code for QT PCM, small corrections in MP4Splitter
- CHANGED: DVB: the current channel audio stream is memorized and selected by default
- each time the channel is switched back
- CHANGED: Removed DSM Converter (use the legay branch if you need this feature)
- CHANGED: Removed RoQ splitter/decoder (same as above)
- FIXED : Ticket #52, [playlist] shuffle is broken
- FIXED : Ticket #78, ESC key cannot be assigned to other actions
- FIXED : Ticket #293, giving "remember last window size" a meaning
- FIXED : Ticket #564, EVR Sync enabled when it shouldn't be
- FIXED : Ticket #627, Don't create the "AppData\Roaming\Media Player Classic"
- folder if the "Remember items" in playlist is disabled
- FIXED : Ticket #628, Enable ctrl+A in Player-->Keys page
- FIXED : Ticket #647, Weird "keys" listed
- FIXED : Ticket #650, Non-media entry in playlist halts playback
- FIXED : Ticket #651, Make EVR CP stats graph smaller
- FIXED : Ticket #652, Escape key on certain form causes form to collapse
- FIXED : Ticket #655, Crash with some BBC-HD samples
- FIXED : Ticket #678, Remember last window size NOT working and mpc-hc.ini
- FIXED : Ticket #698, VMR-9 (Renderless) + pixel shaders crashes
- FIXED : Ticket #699, fix EAC3 mediatype and string
- FIXED : Ticket #712, Audio renderer menu problem with Haali splitter after r2339
- FIXED : Ticket #724, Frequency range and bandwidth value are currently
- not taken into account when doing a scan
- FIXED : Ticket #753, DVB-T, internal MPEG-2 filter & wrong aspect ratio
- FIXED : Ticket #775, Default options of DVD/OGM Preferred language should be
- "Default" not "English"
- FIXED : Ticket #776, Mouse pointer hovering over window/video should be normal,
- not hand
- FIXED : Ticket #778, Playlist interface problem
- FIXED : Ticket #782, VMR-7 & 9 filter names misspelled
- FIXED : Ticket #791, Change the cursor behavior
- FIXED : Ticket #796, MPC HC window doesn't stay snapped to desktop corners
- FIXED : Ticket #809, Resize-arrows no longer appear with caption hidden
- FIXED : Ticket #889, [DVB] <enter> keypress in channel list makes whole pane grey
- FIXED : Ticket #891, [DVB] clicking empty slot in channel list causes small playback
- hiccup
- FIXED : Ticket #895, [DVB] some characters don't show in EPG OSD
- FIXED : DVB Screen sizing: takes into account the TV Navigation panel
- FIXED : Workaround to avoid madVR renderer freezing when switching DVB channels
- FIXED : Bandwidth value was hardcoded to 8MHz when doing a scan or switching channels.
- The value entered in scan is now saved in the configuration
-
-
-v1.4.2824.0 - 9 January 2011
-==============================
- FIXED : Crash on Sandy Bridge processor
- FIXED : Freeze on fast forward with H264 decoder
-
-
-v1.4.2499.0 - 7 September 2010
-==============================
- NEW : Seamless playback support for multi files BRD
- NEW : Support for Windows 7 taskbar and thumbnails features
- NEW : Added Catalan, Dutch and Japanese translations
- NEW : VSFilter x64 is available
- NEW : Added internal VP8 Decoder
- NEW : MPC-HC can be compiled with MSVC2010 and Intel C++ Compiler
- NEW : Support for MCE remote control (values added in AppCommand column in
- "Options/Player/Keys")
- NEW : Support of Broadcom Video decoder for VC1, H.264 and MPEG-2
- (hardware acceleration)
- NEW : Support for DVB subtitles
- NEW : Open files to Recent Documents
- NEW : AUTO HDMI MODE 1080p/24 support for fullscreen mode
- NEW : Ticket #46, add number to AudioDevice list
- NEW : Sync Renderer dialogs
- NEW : Real Video decoder in MPCVideoDecoder
- NEW : Support interlaced mode in fullscreen resolution list
- NEW : Auto change fullscreen resolution for different video content
- NEW : Fullscreen Options page
- NEW : Video decoder, options for DXVA Compatibility check
- NEW : Support for MPEG-2 bitstreaming in the DXVA decoder
- NEW : Full screen resolution - support for native 23.976 and 29.97 mode
- (Vista and above only)
- NEW : Auto resolution change for DVD
- NEW : Always Exit after playback option
- NEW : Support for SRM7500 remote control
- NEW : New panel for switching DVB channels, audio and tuner scan
- accessible through View-->Navigation menu when in Capture mode
- NEW : Automatically play next files in a folder
- NEW : Implemented 'Quick add favorite' shortcut (default: Shift + Q)
- will use current settings from 'Add Favorite' dialog
- NEW : Select D3D device for render, including DXVA if two or more video
- adapters are in the system (EVR Custom & VMR9-Renderless only)
- NEW : Statistics - added render device
- NEW : Ability to select OSD font & size
- NEW : Option "Don't use 'search in folder' on commands 'Skip back/forward'
- when only one item in playlist"
- NEW : H.264 L5.1 DXVA support for ATI cards with drivers > v8.14.1.6105
- (Catalyst 10.4)
- NEW : MPCVideoDecoder, disable DXVA (H.264) for SD video (width < 1280)
- NEW : Improved DXVA compatibility check
- NEW : Implemented drag and drop folders with sub-folders
- NEW : Support for MPEG-1/Layer1 audio stream in the Matroska splitter
- NEW : Command to switch video frame mode (key 'P')
- NEW : Video frame options like in TV: Zoom 1 and Zoom 2
- NEW : Auto saving position every 30 seconds
- NEW : Added internal filters context menu (disable/enable)
- NEW : Command to reopen file (Ctrl+E)
- NEW : Support for PGS in Matroska
- NEW : Open root BD movie from command line & shell context menu
- NEW : OSD messages added when switching audio stream or subtitles
- NEW : OSD on Jump Forward/Backward (keyframe)
- NEW : OSD when open DVD/BD
- NEW : OSD for jump to chapter in file
- NEW : Detect system UI language and set interface language at first run
- NEW : Full ICC color management (Little CMS v2.1a library added)
- NEW : Full floating point processing (FP16 temporary textures)
- NEW : High-quality dithering (color management, full floating point
- processing, 10-bit -> 8-bit)
- NEW : Option to force 10-bit EVR mixer input (probably hackish,
- but in many cases it seems to work)
- NEW : Added MediaInfoLib (v0.7.35) (no need for MediaInfo.dll anymore)
- NEW : Added support for MPEG-2_VLD DXVA for Intel G31/33
- (and maybe other Intel) chipset
- CHANGED: Updated UnrarDll. It is now possible to use the 64bit UnrarDll
- with the 64bit MPC-HC
- CHANGED: Updated Detours to v2.1 build 216
- CHANGED: Updated Bento4 to v1.2.3.0
- CHANGED: Updated libpng to v1.4.3
- CHANGED: Updated SoundTouch to v1.5.0
- CHANGED: Updated zlib to v1.2.5
- CHANGED: Updated libogg to v1.2.0
- CHANGED: Updated libvorbis to v1.3.1
- CHANGED: Updated PNGDIB to v3.1.0
- CHANGED: Updated sizecbar to v2.45
- CHANGED: Better support for madVR
- CHANGED: Updated Hungarian, Russian, Polish, Slovak, Portuguese, Ukrainian,
- Spanish, Swedish, Czech, Traditional Chinese, German, Italian, Turkish
- and Hungarian translations
- CHANGED: Updated FFmpeg
- CHANGED: Updated installer script
- CHANGED: "DirectShow Audio" label on playback->output now says "Audio Renderer"
- CHANGED: Ticket #27: Allow screensaver to activate when audio only
- (sleep is still stopped)
- CHANGED: Add open file to Recent Document only if "Keep history of recently
- opened files" is checked
- CHANGED: Select and change resolution for selected fullscreen monitor
- CHANGED: Improve options for fullscreen monitor and resolution
- CHANGED: Open DVD root folder (include VIDEO_TS) from explorer context menu
- CHANGED: Many internal code improvements for more stability
- CHANGED: Improved playlist
- CHANGED: Improved subtitle handling
- CHANGED: Rewritten DVXA check for better readability
- CHANGED: Disabled internal H.264 (AVC) decoder for interlaced files
- (bad supported by FFmpeg)
- CHANGED: Show filename in OSD at open, instead "Pause/Play"
- CHANGED: Add 'x64' suffix in Title and in the About dialog for the x64 build
- CHANGED: OSD file name at open show delay up to 3 sec.
- CHANGED: Core rendering code in the DX9AllocatorPresenter class is moved
- to a new class: DX9RenderingEngine
- CHANGED: "10 bit RGB" option changed to "10-bit RGB Output", does not affect
- internal processing anymore
- CHANGED: Removed unnecessary temporary texture allocations
- CHANGED: Removed old player logos and added a new one
- FIXED : Name of MPC-HC in title bar (Bug #2826963)
- FIXED : Web interface status.html not showing status/media state when
- Status bar is turned off (Bug #2025675)
- FIXED : Ticket #12, crash/hang after standby, hibernate, UAC or CTRL+ALT+DEL
- FIXED : Ticket #74, [MP4] AAC sound stops playing
- FIXED : Ticket #116, issue with some MPEG (mono) audio playback
- FIXED : Ticket #120, Inner PCM inside QT .mov is supported now
- FIXED : Ticket #150, issue with playback AMR sound
- FIXED : Ticket #161 and #414, "no audio capture device"
- FIXED : Ticket #163, Crash with RealMedia
- FIXED : Ticket #237, DVB channels are all saved as number 0 when tuning
- FIXED : Ticket #242, No PCM sowt audio in MOV
- FIXED : Ticket #258, speaker configuration in Audio Switcher isn't stored
- FIXED : Ticket #281, [CAPTURE] No video decoding when capturing from DVB-T
- card with internal MPEG2 DVXA Decoder enabled
- FIXED : Ticket #282, Auto-zoom function problem
- FIXED : Ticket #295, SSA/ASS and other save subtitle formats problem
- FIXED : Ticket #300, Regression when hiding Caption and Menubar
- FIXED : Ticket #333, Missing tracks when playing a TS file
- FIXED : Ticket #363, #563, Can't open some mp3
- FIXED : Ticket #385, no chapters with MP4Splitter
- FIXED : Ticket #455, Bug with PGS subtitles
- FIXED : Ticket #456, Problem with auto-loading subtitles fixed
- FIXED : Ticket #465, MPEG/TS splitter can't recognize some video track
- FIXED : Ticket #477, Internal audio switcher
- FIXED : Ticket #489, MPC-HC API improvements
- FIXED : Ticket #502, Problem with D3D9Ex
- FIXED : Ticket #513, .rmvb interlaced decoding
- FIXED : Ticket #511, Subtitle renderer crash fixed
- FIXED : Ticket #528, Unable to scan for dvb-t
- FIXED : Ticket #536, [MKV] Default values of the specification should be
- strictly followed
- FIXED : Ticket #576, Next AR Preset Issue
- FIXED : Ticket #578, VSFilter crash fix with certain malformed drawing lines
- FIXED : Ticket #599, ignores /audiorender option
- FIXED : Ticket #601, BD movie length detect wrong
- FIXED : Ticket #660, Pressing left arrow under Options->Logo causes right
- arrow to disappear
- FIXED : Ticket #661, Ctrl+C / File->Close form size discrepancy
- FIXED : Ticket #672, DVB-T - image problems after changing from TV channel
- to radio & back
- FIXED : Ticket #677, Wrong colors using Color Management
- FIXED : Ticket #679, add color management status in EVR CP graph settings
- FIXED : Ticket #680, "Don't hide controls in full screen" does not work
- unless you move the mouse
- FIXED : Ticket #694, DLL preloading vulnerability
- FIXED : Ticket #696, [GUI] use options dialog causes main window elements
- to disappear
- FIXED : Ticket #714, MPEG2 detected as H264
- FIXED : Ticket #717, Fullscreen controls are not displayed until mouse is moved
- FIXED : Opening multiple files via Explorer context menu
- FIXED : Memory leak in libavcodec
- FIXED : Memory leak in DXVA decoder
- FIXED : Playback of some broken avi files
- FIXED : Fix VCD playback
- FIXED : Better detection of "Used For Reference Flags" (fixes some broken
- DXVA samples)
- FIXED : Screensaver activating during video playback on XP
- FIXED : Audio language detection for HDMV (broken by seamless playback feature)
- FIXED : Bug with prevent sleep mode
- FIXED : Bug in "Open File" dialog & "Add to Playlist" checked
- FIXED : Default (center) window position after file close
- FIXED : Issue with a switch to fullscreen mode
- FIXED : FavoriteAdd dialog
- FIXED : Possible buffer overflows
- FIXED : Bug with launch in fullscreen
- FIXED : Incorrect decoding with MPEG-2 bitstream decoder on video with
- alternative scan
- FIXED : Seeking problem with MPEG files
- FIXED : Don't show OSD message when auto play is disabled
- FIXED : Checking for duplicates in display modes
- FIXED : Correct state when done playback (rewind fix)
- FIXED : Incorrect minimal window height calculation when caption is on
- FIXED : Search in dir function
- FIXED : Play video from network share
- FIXED : Incorrect position (desktop) after fullscreen when playing multiple
- files on multi-monitor systems
- FIXED : Playback issue for some H.264 media files captured from digital cameras
- FIXED : Various DVB-T fixes
- FIXED : DXVA regression: black video with some files
- FIXED : Crash in Matroska splitter with unknown streams
- FIXED : OSD shown wrong (previous) audio stream on change
- FIXED : Improved DVD resume
- FIXED : Crash with some VOB subtitles
- FIXED : Undetected H.264 video streams in MPEG splitter
- FIXED : Incorrect identification of the video stream in MPEG splitter
- (H.264 instead of MPEG-2)
- FIXED : Logical/numeric sorting in Playlist, "Play next in the folder"
- FIXED : OSD on open BD
- FIXED : MPEGSplitter - could not read some MPEG files
- FIXED : Crashes with MSVC2010 builds
- FIXED : The EVR mixer output media subtype matches the surface format
- (as a consequence, it's always RGB)
- FIXED : Incorrect length detection of MPEG, DVD (.ifo)
-
-
-v1.3.1249.0 - 26 August 2009
-============================
- NEW : Support for FLAC audio streams
- NEW : Support for Dolby Digital+ (EAC3) and Dolby true HD (MLP)
- NEW : Nellymoser audio decoder
- NEW : Belarusian, Brazilian and Swedish translation
- NEW : New shader "Sharpen Complex 2" (required hardware compatible with
- pixel shader 2.A)
- NEW : Support for madVR video renderer (http://madshi.net/madVR.zip)
- NEW : Additional information on video using MediaInfo
- (DLL can be download from http://mediainfo.sourceforge.net
- and placed in MPC-HC directory)
- NEW : Internal DXVA decoder support for H.264 with Intel G45
- (thanks to the people who helped me at Intel Corp.)
- CHANGED: Add support of interlaced flags in software mode for MPCVideoDecoder
- filter
- CHANGED: D3DFullScreen mode now takes into account the monitor to full-screen
- mode in options, if monitor is not specified on the command line
- CHANGED: Auto-hide playlist on fullscreen (feature request #2219561)
- CHANGED: Detours library updated to v2.1
- CHANGED: Support for AC3 in MP4 splitter
- CHANGED: Support for EAC3 in Matroska splitter
- CHANGED: Hotkeys added to support more remote control keys
- CHANGED: Support for Theora in Matroska internal splitter
- CHANGED: libvorbis updated to v1.2.3
- CHANGED: libogg updated to v1.1.4
- CHANGED: Improved streaming performances
- CHANGED: Prevent display or computer to sleep during playback
- CHANGED: FAAD library updated to rev 2.2.7
- CHANGED: libpng updated to release 1.2.38 (fix security bug)
- CHANGED: Playlist file is now saved in the MPC-HC folder (patch # 2671496)
- CHANGED: frame by frame modify to support step frame back functionality
- (except for VMR9)
- CHANGED: support for AC3 in MP4 files created with Nero Digital
- CHANGED: EVR Custom and VMR9 Renderless revamped (Beliyaal),
- better synchronization, remove tearing in windowed mode,
- support for dialog box in DirectX exclusive mode, ...
- FIXED : Support for Theora stream in Ogg internal splitter
- FIXED : Save thumbnails crash in x64
- FIXED : Bugs on presentation graphics
- (missing subtitles, better synchronization)
- FIXED : Audio change on M2TS files reset the selected subtitle
- FIXED : Switch to "Minimal view" reset main menu language to English
- FIXED : Bug in MPEG splitter for VC1
- FIXED : Maximum texture resolution to "Desktop" not working with Haali
- renderer (Bug #2456735)
- FIXED : Better synchronization with EVR Custom to improve playback smoothness
- FIXED : 24 bits LPCM not properly play
- FIXED : Possible deadlock with Reclock
- FIXED : Support of framestep backward, even if the codec didn't support it
- natively (bug #2600542)
- FIXED : DXVA decoder support multiple graphics cards
- (PCI vendor id detection on the fly)
- FIXED : Incorrect aspect ratio for some H.264 files with DXVA1 decoder
- (extended SAR)
- FIXED : H.264 files with 16 reference frames freeze during playback
- (bug #2795785 and #2784256)
- FIXED : AVI with H.264 not decoded properly (bug #2794854)
- FIXED : Revamped DXVA H.264 decoder based on new insights, fixing black screen
- macroblock, support for AVI, ...
- FIXED : Incorrect playback for padded DTS
- FIXED : Hang when moving player between monitors
-
-
-v1.2.908.0 - 30 November 2008
-=============================
- NEW : support Multi-Monitor configuration, select Monitor for full-screen
- playback
- NEW : a minidump file is created when MPC-HC crashes
- NEW : Simplified Chinese & Traditional Chinese translations
- NEW : Pixel shader to convert BT601 -> BT701 (request #1911511)
- NEW : YV12 Chroma Upsampling pixel shader added
- (http://forum.doom9.org/showthread.php?p=1184975#post1184975)
- NEW : Recursively adding directories to the Playlist
- (feature request #2013805), add as New Menu item
- NEW : Support for M2TS presentation graphics streams
- (only for EVR Custom and VMR9 Renderless)
- NEW : Command line switches "/startpos hh:mm:ss.ff", "/dvdpos title#chapter"
- and "/dvdpos title#hh:mm:ss.ff" to start playback to position
- NEW : Different icons for each format associated with MPC-HC
- NEW : support H.264 and AAC in FLV splitter
- CHANGED: Add VIRTKEY for "Save Thumbnails" (request #1964399)
- CHANGED: Store the settings for the internal DXVA/FFmpeg decoders
- in a different value than the other internal decoders. This makes
- the settings better interchangeable with older MPC-HC builds.
- Also gives more room in the bitvector for adding more decoders
- in the future (FFmpeg based)
- CHANGED: PAR correction option (for anamorphic video)in VSFilter
- and RealText support
- CHANGED: Updated liba52 & libdts libraries
- CHANGED: The x64 version of MPCVideodec is now built using GCC/MinGW64
- (improves performance)
- CHANGED: GUI option for Explorer Context menu->Files (see Formats Page)
- CHANGED: GUI option for Explorer Context menu->Directory (see Formats Page)
- CHANGED: Open directory (shell context menu or MPC-HC menu) -
- load only enqueues audio/video files, those with file extensions
- from the Formats page in MPC-HC options
- CHANGED: Replaced command line switches /unregvid and /unregaud with
- a new switch /unregall. This cleans up all file associations,
- including image/playlist formats
- CHANGED: Change in VideoDecoder Settings for rev.681 (read AR from stream)
- CHANGED: Open DVD detect and open Blu-Ray main movie
- CHANGED: EAC3 support in MPEG splitter
- CHANGED: Number of files and DVD position increase from 5 to 20 (req #1819709)
- CHANGED: Bypass of UOPs for DVD (req #1811508). This feature didn't work
- for the x64 build
- CHANGED: libpng updated to release 1.2.32 (fixes a memory leak)
- FIXED : Chapter message improperly displayed in status bar (for file only)
- FIXED : Crash with CoreAVC when changing "preferred decoder" setting
- during playback
- FIXED : Missing checkmarks on "tearing test" and "display stats" options
- (bug #2010857)
- FIXED : Save image/thumbnail not working with EVR (bug #2010681)
- FIXED : Workaround to prevent GraphEdit crash when MPCVideoDec.ax
- was registered.
- (when opening menu "Graph/Insert filter/Direct show filters")
- FIXED : Fix rare seeking issue with VobSub in VSFilter
- FIXED : Subtitle style not save in settings
- FIXED : random freeze when using MPC-HC, VSFilter and Haali renderer
- at the same time
- FIXED : shortcuts with MEDIA_PLAY, MEDIA_PAUSE not working with some
- remote controls
- FIXED : shortcuts label in "Option / Key" dialog box is now localized
- FIXED : MPC-HC file association cleanup bug (rev.731), these commands
- are not working: mplayerc /unregvid, mplayerc /unregaud
- FIXED : Freeze when playing MPEG-2 or Xvid file
- FIXED : Remember position not working with some DVDs
- FIXED : DXVA decoder now support H.264 interlaced video
- FIXED : Crash/black screen with DXVA decoder with some ATI cards
- FIXED : Incorrect aspect ratio with some H.264 files (extended SAR)
-
-
-v1.1.604.0 - 28 June 2008
-=========================
- NEW : Subtitle delay support (this one does not modify the subtitle file)
- NEW : Polish, Ukrainian, Italian & Slovak translations
- NEW : Support for M2TS files with H.264, VC1, AC3, DTS, LPCM
- NEW : MPEG-2 support for x64 edition
- CHANGED: Improved support for audio and subtitle switching with the
- internal MPEG splitter
- CHANGED: Size shrink for the translation DLLs
- CHANGED: New property page for "MPC - Video decoder" standalone filter
- to select activated codecs
- CHANGED: Option added in "MPC - Video Decoder" property page to disable
- FFmpeg software decoding (to use other decoder instead)
- CHANGED: Added file extensions EVO, M2TS and M4A in option / format
- CHANGED: Force using 3D surface with EVR Custom Presenter
- CHANGED: x64 executable is now named mplayerc64.exe
- FIXED : Sorenson video was not played when DXVA was activated
- FIXED : Minimum EVR buffer set to 3 (instead of 1)
- FIXED : Better subtitle synchronization with EVR Custom Presenter
- (delay due to buffering remove)
- FIXED : DXVA compatibility improved with some NVIDIA cards
- FIXED : Reported subtitle fixes from Guliverkli2
- FIXED : Incorrect colors with DXVA internal decoder for H.264 files
- with multiple PPS / SPS settings
- FIXED : Broken FLV playback
- FIXED : EVR Custom Presenter incompatibility with Microsoft MPEG-2
- and CyberLink decoder
- FIXED : DXVA decoding bugs for some H.264 files
- FIXED : Memory leak in the DXVA decoder (bug #1962448)
- FIXED : Crash on stop/play with the DXVA decoder
- FIXED : Random crash with EVR Custom Presenter
- FIXED : Macroblocks with NVIDIA card
- (appear on H.264 streams with custom quantization matrix)
- FIXED : Access violation using VSFilter as AviSynth plugin
- FIXED : Some H.264 streams was not recognized by internal MPEG splitter
- (PPS and SPS present on different packets)
- FIXED : Black screen when OSD or subtitles was displayed in x64 release
- FIXED : Wrong Aspect Ratio when using "Save thumbnails" with EVR CP
-
-
-v1.1.0.0 - 6 March 2008
-=======================
- NEW : Custom presenter now support DXVA2, and display hardware acceleration
- mode in Jitter test information
- NEW : Internal video decoder based on FFmpeg for Flash video
- (FLV4, VP5, VP6), AMV, MPEG4, SQV, Theora, VC1, XVID, and DivX
- NEW : Internal video decoder H.264 with DXVA 1 acceleration
- (using VMR9 or overlay on XP) and DXVA2 (using EVR on Vista)
- NEW : Korean translation
- CHANGED: FAAD library updated to 2.6
- CHANGED: Standalone filter renamed to be prefixed by "MPC - xxx"
- CHANGED: CSS classes added in WebServer (request #1885296)
- FIXED : Incorrect colors on video when using YUV mixing
- and "VMR Color controls"
- FIXED : PN31 driver installation was not working
- FIXED : MPC-HC graph manager now use the same filter priority as WMP
- and GraphEdit (clsid's patch)
- FIXED : MPC-HC is now recognized as an application by SUMo
- (http://www.kcsoftwares.com/index.php?sumo)
- FIXED : Ghost horizontal and vertical lines with Pixel Shader resizer
- (especially on ATI graphics card)
- FIXED : Crash in FLV splitter with file containing 0 bytes packets
- FIXED : Button "Video" in format property page didn't select images anymore
- FIXED : No sound in some FLV video with Nellymoser audio track
- FIXED : Multimedia keys (mute, vol+-, ...)
- was captured by MPC-HC even if option "global media keys" was off
- FIXED : YUV mixing is now disable with Vista
- (not supported by Vista VMR9, and cause black screen)
-
-
-v1.0.11.0 - 14 October 2007
-===========================
- NEW : Command Line Option "/dubdelay" applies a positive or negative
- audio delay of ???ms, if filename contains "DELAY ???ms"
- (internal Audio Switcher required)
- NEW : Russian, Turkish, Czech, Spanish and Hungarian translations
- NEW : Internal AVI splitter support AMV files
- (need an ffdshow update to decode)
- CHANGED: File type association. MPC-HC is now recognized as a registered media
- player application. File type registration now compatible with UAC (Vista)
- CHANGED: Matroska internal subtitles are not loaded
- if "auto-load subtitles" option is off
- CHANGED: Allow DirectShow to use a disabled internal source
- and transform filters when no other suitable filter is available
- FIXED : Subtitle popup menu not working in French
- FIXED : "Remember file position" option is not working properly
- in playlist mode
- FIXED : Crash when opening "Navigation" menu while playing DVD
- (German locale only)
- FIXED : Memory leak with window resize
- FIXED : Many GUI related things
- FIXED : Crash when opening zero byte length MP3 files
- FIXED : Crash when using "Save thumbnails" with number of row or column
- greater than 8 (now internally limited to 8)
-
-
-v1.0.10.0 - 15 September 2007
-=============================
- CHANGED: Latest clsid's patches (Bento4 0.9.3, FAAD2 2.6b, dtsdec 0.0.2,
- libmad 0.15.1b, zlib 1.2.3, MPEG decoder: progressive frames fix,
- MPEG decoder: DSUtil interlaced fix v2)
- CHANGED: libpng 1.2.20
- NEW : Command Line Option "/d3dfs" to start MPC-HC in D3D Fullscreen mode
- NEW : Logitech LCD support (e.g. G15 keyboard)
- CHANGED: Remember File and DVD position works only when "Keep history"
- is active (preserve privacy issue)
- CHANGED: Kick off Screen Saver from Power Options only while video is playing
- (Vista)
- NEW : Build for x64 platforms
- NEW : Multilingual support for English, French and German
- CHANGED: DirectX SDK updated to August 2007 (v35)
- FIXED : Wrong Aspect Ratio with EVR CP (definitely i hope :-)
- FIXED : Internal MPEG-2 Decoder was not working with EVR and EVR CP
- FIXED : Audio sync problems with Blu-Ray/HD DVD DTS files
- [wrong AvgTimePerFrame calculation for DTS and AC3 (madshi)]
- FIXED : OSD was not working when D3DX9_XX dll was not present
- (random pixels shown in top of video)
- FIXED : Mouse now working in DVD menu with EVR Custom Presenter (Vista)
- FIXED : FLV Splitter when video does not start with keyframe
- FIXED : Vulnerability CAL-20070912-1 in AVI Source Filter
- (arbitrary code execute with users privileges)
- FIXED : Vulnerability in FLI internal source filter
-
-
-v1.0.9.0 - 14 July 2007
-=======================
- CHANGED: OSD improved for EVR Custom Presenter
- FIXED : EVR Custom Presenter rendering thread stability
- FIXED : EVR Custom Presenter doesn't need mfplat.dll anymore
- (the dll is installed with WMP 11)
- NEW : Exit Option in popup menu
- FIXED : Use same registry key like original Gabest Media Player Classic
- FIXED : Freeze when playing audio only file with EVR Custom Presenter
- FIXED : Wrong Aspect Ratio with anamorphic video using EVR Custom Presenter
- FIXED : When Video pause, frame stepping with EVR Custom Presenter started
- video playback at normal speed
- FIXED : Save thumbnail with EVR Custom Presenter froze MPC-HC
- FIXED : FLV splitter did not read width and height out of metadata
- (thanks to Chobits for this fix)
- FIXED : If more than one subtitle text rows shown, the background
- ("Outline" color) vertically overlapped the other one
-
-
-v1.0.8.0 - 31 May 2007
-======================
- NEW : Kick off Screen Saver from Power Options, only when MPC-HC has focus
- (Vista)
- FIXED : Jitter test was not displayed with some files
- FIXED : Crash if statistics should be displayed, when d3dx9_29.dll
- was not present
- FIXED : Possible crash when closing file, while OSD was displayed
- FIXED : DVD menu freeze with EVR CP and NVIDIA Pure Video decoder (Win XP)
- FIXED : Mouse-click to play not working at the bottom of video
- FIXED : MKV internal subtitles were not displayed from time to time
- FIXED : Video disappeared when moving MPC-HC to other screen
- with EVR Custom Presenter on dual display
-
-
-v1.0.7.0 - 27 May 2007
-======================
- NEW : "EVR Custom Presenter" mode added as output renderer. In this mode
- EVR supports internal MPC-HC subtitles, D3D Fullscreen, tearing test
- and Pixels Shaders
- NEW : Statistics option currently displays the jitter curve
- (Ctrl + J to activate) for VMR9 Renderless and EVR Custom Presenter
- CHANGED: Output property page, options now are disabled when not supported
- by the selected renderer
- FIXED : Mouse cursor invisible in Fullscreen mode
- FIXED : Mouse-click to play was not working with some renderers
- FIXED : A one pixel width rectangle was not displayed around the video window
- (refresh problem)
- FIXED : Crash when switching from VMR9 Renderless to VRM7 Renderless (Vista)
-
-
-v1.0.6.0 - 07 May 2007
-======================
- NEW : VP62 codec internal filter re-activated
- NEW : MPEG4 splitter internal filter re-activated
- CHANGED: _xxl patches included (VP62 codec internal filter, MPEG4 splitter
- internal filter)
- FIXED : Window "flashing" during resize, after video loaded
-
-
-v1.0.5.0 - 05 May 2007
-======================
- NEW : MPC-HC is now Vista ready, added Enhanced Video Renderer (EVR) with OSD support
- NEW : Shuttle PN31 Remote Control support
- NEW : Subtitle synchronization with keyboard shortcuts or remote control
- FIXED : Fixed bug at internal filter property page
-
-
-v1.0.4.0 - 09 May 2006
-======================
- CHANGED: OSD improvement
- NEW : Remaining time displayed (Ctrl + I or "Remaining_Time" with WinLIRC)
- NEW : OSD Fast forward / rewind speed display
- CHANGED: OSD FF/Rew for DVD playback: slow forward replaced by rewind,
- no more predefined speed limits (feature depends on MPEG-2 decoder
- capabilities)
- FIXED : Taskbar Display bug in D3D Fullscreen mode
- FIXED : Mouse cursor invisible in D3D Fullscreen mode
-
-
-v1.0.3.0 - 02 May 2006
-======================
- NEW : YUV mixer mode for VMR9
- NEW : OSD for VMR9 output for languages selection
- NEW : "DVD Menu Activate" can also be used to start playback
- (useful when using remote control via WinLIRC)
- FIXED : Aspect Ratio bug in D3D Fullscreen mode
-
-
-v1.0.2.0 - 23 April 2006
-========================
- CHANGED: D3D Fullscreen mode improved
- FIXED : VMR9 Color control bug
-
-
-v1.0.1.0 - 09 April 2006
-========================
- NEW : DVD open dialog now allows selecting the source folder or drive
- NEW : Possibility to save video position for the last 5 DVDs and/or files
- to resume playback at this position when MPC-HC is restarted
- NEW : Shortcut to inhibit Pixel Shaders (Ctrl + P). Only additional
- Pixel Shaders effects are concerned (always used if resize active)
-
-
-v1.0.0.0 - 29 March 2006
-========================
- NEW : Color control option for VMR renderer
- NEW : Automatically reload Pixel Shaders at startup
- NEW : Tearing test function (Ctrl+T): displays 2 moving bars
- (useful to also show judder)
+For the older changes see:
+http://mpc-hc.svn.sourceforge.net/viewvc/mpc-hc/trunk/src/apps/mplayerc/Changelog_old.txt
diff --git a/src/apps/mplayerc/Changelog_old.txt b/src/apps/mplayerc/Changelog_old.txt
new file mode 100644
index 000000000..9827d1644
--- /dev/null
+++ b/src/apps/mplayerc/Changelog_old.txt
@@ -0,0 +1,636 @@
+v1.5.0.2827 - 31 January 2011
+==============================
+ NEW : Added new options to always default to external subtitles, ignore
+ embedded subtitles and to set the autoload subtitle paths
+ NEW : Added support for "in24", "fl64", 8-bit "sowt", "IMA4" and "NONE"
+ audio (old QuickTime PCM)
+ NEW : Added support for "in24", "in32", "fl32", "fl64"
+ (both big-endian and little-endian) in .mov files
+ NEW : Ticket #784, Enable ctrl+A in the MediaInfo window
+ NEW : [DVB] LCN support, added EPG current event information, offset parameter for
+ scanning channels, added channel encryption detection for DVB-t during scan
+ NEW : Added ignore encrypted channels checkbox during DVB scan
+ NEW : Armenian translation
+ CHANGED: Updated FFmpeg
+ CHANGED: Updated MediaInfoLib to v0.7.39
+ CHANGED: Updated ZenLib to v0.4.17
+ CHANGED: Updated Little CMS to v2.1
+ CHANGED: Updated libpng to v1.4.5
+ CHANGED: Updated libogg to v1.2.2
+ CHANGED: Updated libvorbis to v1.3.2
+ CHANGED: Cleaned up and optimized code for QT PCM, small corrections in MP4Splitter
+ CHANGED: DVB: the current channel audio stream is memorized and selected by default
+ each time the channel is switched back
+ CHANGED: Removed DSM Converter (use the legacy branch if you need this feature)
+ CHANGED: Removed RoQ splitter/decoder (same as above)
+ FIXED : Ticket #52, [playlist] shuffle is broken
+ FIXED : Ticket #78, ESC key cannot be assigned to other actions
+ FIXED : Ticket #293, giving "remember last window size" a meaning
+ FIXED : Ticket #564, EVR Sync enabled when it shouldn't be
+ FIXED : Ticket #627, Don't create the "AppData\Roaming\Media Player Classic"
+ folder if the "Remember items" in playlist is disabled
+ FIXED : Ticket #628, Enable ctrl+A in Player-->Keys page
+ FIXED : Ticket #647, Weird "keys" listed
+ FIXED : Ticket #650, Non-media entry in playlist halts playback
+ FIXED : Ticket #651, Make EVR CP stats graph smaller
+ FIXED : Ticket #652, Escape key on certain form causes form to collapse
+ FIXED : Ticket #655, Crash with some BBC-HD samples
+ FIXED : Ticket #678, Remember last window size NOT working and mpc-hc.ini
+ FIXED : Ticket #698, VMR-9 (Renderless) + pixel shaders crashes
+ FIXED : Ticket #699, fix EAC3 mediatype and string
+ FIXED : Ticket #712, Audio renderer menu problem with Haali splitter after r2339
+ FIXED : Ticket #724, Frequency range and bandwidth value are currently
+ not taken into account when doing a scan
+ FIXED : Ticket #753, DVB-T, internal MPEG-2 filter & wrong aspect ratio
+ FIXED : Ticket #775, Default options of DVD/OGM Preferred language should be
+ "Default" not "English"
+ FIXED : Ticket #776, Mouse pointer hovering over window/video should be normal,
+ not hand
+ FIXED : Ticket #778, Playlist interface problem
+ FIXED : Ticket #782, VMR-7 & 9 filter names misspelled
+ FIXED : Ticket #791, Change the cursor behavior
+ FIXED : Ticket #796, MPC HC window doesn't stay snapped to desktop corners
+ FIXED : Ticket #809, Resize-arrows no longer appear with caption hidden
+ FIXED : Ticket #889, [DVB] <enter> keypress in channel list makes whole pane gray
+ FIXED : Ticket #891, [DVB] clicking empty slot in channel list causes small playback
+ hiccup
+ FIXED : Ticket #895, [DVB] some characters don't show in EPG OSD
+ FIXED : DVB Screen sizing: takes into account the TV Navigation panel
+ FIXED : Workaround to avoid madVR renderer freezing when switching DVB channels
+ FIXED : Bandwidth value was hardcoded to 8MHz when doing a scan or switching channels.
+ The value entered in scan is now saved in the configuration
+
+
+v1.4.2824.0 - 9 January 2011
+==============================
+ FIXED : Crash on Sandy Bridge processor
+ FIXED : Freeze on fast forward with H264 decoder
+
+
+v1.4.2499.0 - 7 September 2010
+==============================
+ NEW : Seamless playback support for multi files BRD
+ NEW : Support for Windows 7 taskbar and thumbnails features
+ NEW : Added Catalan, Dutch and Japanese translations
+ NEW : VSFilter x64 is available
+ NEW : Added internal VP8 Decoder
+ NEW : MPC-HC can be compiled with MSVC2010 and Intel C++ Compiler
+ NEW : Support for MCE remote control (values added in AppCommand column in
+ "Options/Player/Keys")
+ NEW : Support of Broadcom Video decoder for VC1, H.264 and MPEG-2
+ (hardware acceleration)
+ NEW : Support for DVB subtitles
+ NEW : Open files to Recent Documents
+ NEW : AUTO HDMI MODE 1080p/24 support for fullscreen mode
+ NEW : Ticket #46, add number to AudioDevice list
+ NEW : Sync Renderer dialogs
+ NEW : Real Video decoder in MPCVideoDecoder
+ NEW : Support interlaced mode in fullscreen resolution list
+ NEW : Auto change fullscreen resolution for different video content
+ NEW : Fullscreen Options page
+ NEW : Video decoder, options for DXVA Compatibility check
+ NEW : Support for MPEG-2 bitstreaming in the DXVA decoder
+ NEW : Full screen resolution - support for native 23.976 and 29.97 mode
+ (Vista and above only)
+ NEW : Auto resolution change for DVD
+ NEW : Always Exit after playback option
+ NEW : Support for SRM7500 remote control
+ NEW : New panel for switching DVB channels, audio and tuner scan
+ accessible through View-->Navigation menu when in Capture mode
+ NEW : Automatically play next files in a folder
+ NEW : Implemented 'Quick add favorite' shortcut (default: Shift + Q)
+ will use current settings from 'Add Favorite' dialog
+ NEW : Select D3D device for render, including DXVA if two or more video
+ adapters are in the system (EVR Custom & VMR9-Renderless only)
+ NEW : Statistics - added render device
+ NEW : Ability to select OSD font & size
+ NEW : Option "Don't use 'search in folder' on commands 'Skip back/forward'
+ when only one item in playlist"
+ NEW : H.264 L5.1 DXVA support for ATI cards with drivers > v8.14.1.6105
+ (Catalyst 10.4)
+ NEW : MPCVideoDecoder, disable DXVA (H.264) for SD video (width < 1280)
+ NEW : Improved DXVA compatibility check
+ NEW : Implemented drag and drop folders with sub-folders
+ NEW : Support for MPEG-1/Layer1 audio stream in the Matroska splitter
+ NEW : Command to switch video frame mode (key 'P')
+ NEW : Video frame options like in TV: Zoom 1 and Zoom 2
+ NEW : Auto saving position every 30 seconds
+ NEW : Added internal filters context menu (disable/enable)
+ NEW : Command to reopen file (Ctrl+E)
+ NEW : Support for PGS in Matroska
+ NEW : Open root BD movie from command line & shell context menu
+ NEW : OSD messages added when switching audio stream or subtitles
+ NEW : OSD on Jump Forward/Backward (keyframe)
+ NEW : OSD when open DVD/BD
+ NEW : OSD for jump to chapter in file
+ NEW : Detect system UI language and set interface language at first run
+ NEW : Full ICC color management (Little CMS v2.1a library added)
+ NEW : Full floating point processing (FP16 temporary textures)
+ NEW : High-quality dithering (color management, full floating point
+ processing, 10-bit -> 8-bit)
+ NEW : Option to force 10-bit EVR mixer input (probably hackish,
+ but in many cases it seems to work)
+ NEW : Added MediaInfoLib (v0.7.35) (no need for MediaInfo.dll anymore)
+ NEW : Added support for MPEG-2_VLD DXVA for Intel G31/33
+ (and maybe other Intel) chipset
+ CHANGED: Updated UnrarDll. It is now possible to use the 64bit UnrarDll
+ with the 64bit MPC-HC
+ CHANGED: Updated Detours to v2.1 build 216
+ CHANGED: Updated Bento4 to v1.2.3.0
+ CHANGED: Updated libpng to v1.4.3
+ CHANGED: Updated SoundTouch to v1.5.0
+ CHANGED: Updated zlib to v1.2.5
+ CHANGED: Updated libogg to v1.2.0
+ CHANGED: Updated libvorbis to v1.3.1
+ CHANGED: Updated PNGDIB to v3.1.0
+ CHANGED: Updated sizecbar to v2.45
+ CHANGED: Better support for madVR
+ CHANGED: Updated Hungarian, Russian, Polish, Slovak, Portuguese, Ukrainian,
+ Spanish, Swedish, Czech, Traditional Chinese, German, Italian, Turkish
+ and Hungarian translations
+ CHANGED: Updated FFmpeg
+ CHANGED: Updated installer script
+ CHANGED: "DirectShow Audio" label on playback->output now says "Audio Renderer"
+ CHANGED: Ticket #27: Allow screensaver to activate when audio only
+ (sleep is still stopped)
+ CHANGED: Add open file to Recent Document only if "Keep history of recently
+ opened files" is checked
+ CHANGED: Select and change resolution for selected fullscreen monitor
+ CHANGED: Improve options for fullscreen monitor and resolution
+ CHANGED: Open DVD root folder (include VIDEO_TS) from explorer context menu
+ CHANGED: Many internal code improvements for more stability
+ CHANGED: Improved playlist
+ CHANGED: Improved subtitle handling
+ CHANGED: Rewritten DVXA check for better readability
+ CHANGED: Disabled internal H.264 (AVC) decoder for interlaced files
+ (bad supported by FFmpeg)
+ CHANGED: Show filename in OSD at open, instead "Pause/Play"
+ CHANGED: Add 'x64' suffix in Title and in the About dialog for the x64 build
+ CHANGED: OSD file name at open show delay up to 3 sec.
+ CHANGED: Core rendering code in the DX9AllocatorPresenter class is moved
+ to a new class: DX9RenderingEngine
+ CHANGED: "10 bit RGB" option changed to "10-bit RGB Output", does not affect
+ internal processing anymore
+ CHANGED: Removed unnecessary temporary texture allocations
+ CHANGED: Removed old player logos and added a new one
+ FIXED : Name of MPC-HC in title bar (Bug #2826963)
+ FIXED : Web interface status.html not showing status/media state when
+ Status bar is turned off (Bug #2025675)
+ FIXED : Ticket #12, crash/hang after standby, hibernate, UAC or CTRL+ALT+DEL
+ FIXED : Ticket #74, [MP4] AAC sound stops playing
+ FIXED : Ticket #116, issue with some MPEG (mono) audio playback
+ FIXED : Ticket #120, Inner PCM inside QT .mov is supported now
+ FIXED : Ticket #150, issue with playback AMR sound
+ FIXED : Ticket #161 and #414, "no audio capture device"
+ FIXED : Ticket #163, Crash with RealMedia
+ FIXED : Ticket #237, DVB channels are all saved as number 0 when tuning
+ FIXED : Ticket #242, No PCM sowt audio in MOV
+ FIXED : Ticket #258, speaker configuration in Audio Switcher isn't stored
+ FIXED : Ticket #281, [CAPTURE] No video decoding when capturing from DVB-T
+ card with internal MPEG2 DVXA Decoder enabled
+ FIXED : Ticket #282, Auto-zoom function problem
+ FIXED : Ticket #295, SSA/ASS and other save subtitle formats problem
+ FIXED : Ticket #300, Regression when hiding Caption and Menubar
+ FIXED : Ticket #333, Missing tracks when playing a TS file
+ FIXED : Ticket #363, #563, Can't open some mp3
+ FIXED : Ticket #385, no chapters with MP4Splitter
+ FIXED : Ticket #455, Bug with PGS subtitles
+ FIXED : Ticket #456, Problem with auto-loading subtitles fixed
+ FIXED : Ticket #465, MPEG/TS splitter can't recognize some video track
+ FIXED : Ticket #477, Internal audio switcher
+ FIXED : Ticket #489, MPC-HC API improvements
+ FIXED : Ticket #502, Problem with D3D9Ex
+ FIXED : Ticket #513, .rmvb interlaced decoding
+ FIXED : Ticket #511, Subtitle renderer crash fixed
+ FIXED : Ticket #528, Unable to scan for dvb-t
+ FIXED : Ticket #536, [MKV] Default values of the specification should be
+ strictly followed
+ FIXED : Ticket #576, Next AR Preset Issue
+ FIXED : Ticket #578, VSFilter crash fix with certain malformed drawing lines
+ FIXED : Ticket #599, ignores /audiorender option
+ FIXED : Ticket #601, BD movie length detect wrong
+ FIXED : Ticket #660, Pressing left arrow under Options->Logo causes right
+ arrow to disappear
+ FIXED : Ticket #661, Ctrl+C / File->Close form size discrepancy
+ FIXED : Ticket #672, DVB-T - image problems after changing from TV channel
+ to radio & back
+ FIXED : Ticket #677, Wrong colors using Color Management
+ FIXED : Ticket #679, add color management status in EVR CP graph settings
+ FIXED : Ticket #680, "Don't hide controls in full screen" does not work
+ unless you move the mouse
+ FIXED : Ticket #694, DLL preloading vulnerability
+ FIXED : Ticket #696, [GUI] use options dialog causes main window elements
+ to disappear
+ FIXED : Ticket #714, MPEG2 detected as H264
+ FIXED : Ticket #717, Fullscreen controls are not displayed until mouse is moved
+ FIXED : Opening multiple files via Explorer context menu
+ FIXED : Memory leak in libavcodec
+ FIXED : Memory leak in DXVA decoder
+ FIXED : Playback of some broken avi files
+ FIXED : Fix VCD playback
+ FIXED : Better detection of "Used For Reference Flags" (fixes some broken
+ DXVA samples)
+ FIXED : Screensaver activating during video playback on XP
+ FIXED : Audio language detection for HDMV (broken by seamless playback feature)
+ FIXED : Bug with prevent sleep mode
+ FIXED : Bug in "Open File" dialog & "Add to Playlist" checked
+ FIXED : Default (center) window position after file close
+ FIXED : Issue with a switch to fullscreen mode
+ FIXED : FavoriteAdd dialog
+ FIXED : Possible buffer overflows
+ FIXED : Bug with launch in fullscreen
+ FIXED : Incorrect decoding with MPEG-2 bitstream decoder on video with
+ alternative scan
+ FIXED : Seeking problem with MPEG files
+ FIXED : Don't show OSD message when auto play is disabled
+ FIXED : Checking for duplicates in display modes
+ FIXED : Correct state when done playback (rewind fix)
+ FIXED : Incorrect minimal window height calculation when caption is on
+ FIXED : Search in dir function
+ FIXED : Play video from network share
+ FIXED : Incorrect position (desktop) after fullscreen when playing multiple
+ files on multi-monitor systems
+ FIXED : Playback issue for some H.264 media files captured from digital cameras
+ FIXED : Various DVB-T fixes
+ FIXED : DXVA regression: black video with some files
+ FIXED : Crash in Matroska splitter with unknown streams
+ FIXED : OSD shown wrong (previous) audio stream on change
+ FIXED : Improved DVD resume
+ FIXED : Crash with some VOB subtitles
+ FIXED : Undetected H.264 video streams in MPEG splitter
+ FIXED : Incorrect identification of the video stream in MPEG splitter
+ (H.264 instead of MPEG-2)
+ FIXED : Logical/numeric sorting in Playlist, "Play next in the folder"
+ FIXED : OSD on open BD
+ FIXED : MPEGSplitter - could not read some MPEG files
+ FIXED : Crashes with MSVC2010 builds
+ FIXED : The EVR mixer output media subtype matches the surface format
+ (as a consequence, it's always RGB)
+ FIXED : Incorrect length detection of MPEG, DVD (.ifo)
+
+
+v1.3.1249.0 - 26 August 2009
+============================
+ NEW : Support for FLAC audio streams
+ NEW : Support for Dolby Digital+ (EAC3) and Dolby true HD (MLP)
+ NEW : Nellymoser audio decoder
+ NEW : Belarusian, Brazilian and Swedish translation
+ NEW : New shader "Sharpen Complex 2" (required hardware compatible with
+ pixel shader 2.A)
+ NEW : Support for madVR video renderer (http://madshi.net/madVR.zip)
+ NEW : Additional information on video using MediaInfo
+ (DLL can be download from http://mediainfo.sourceforge.net
+ and placed in MPC-HC directory)
+ NEW : Internal DXVA decoder support for H.264 with Intel G45
+ (thanks to the people who helped me at Intel Corp.)
+ CHANGED: Add support of interlaced flags in software mode for MPCVideoDecoder
+ filter
+ CHANGED: D3DFullScreen mode now takes into account the monitor to full-screen
+ mode in options, if monitor is not specified on the command line
+ CHANGED: Auto-hide playlist on fullscreen (feature request #2219561)
+ CHANGED: Detours library updated to v2.1
+ CHANGED: Support for AC3 in MP4 splitter
+ CHANGED: Support for EAC3 in Matroska splitter
+ CHANGED: Hotkeys added to support more remote control keys
+ CHANGED: Support for Theora in Matroska internal splitter
+ CHANGED: libvorbis updated to v1.2.3
+ CHANGED: libogg updated to v1.1.4
+ CHANGED: Improved streaming performances
+ CHANGED: Prevent display or computer to sleep during playback
+ CHANGED: FAAD library updated to rev 2.2.7
+ CHANGED: libpng updated to release 1.2.38 (fix security bug)
+ CHANGED: Playlist file is now saved in the MPC-HC folder (patch # 2671496)
+ CHANGED: frame by frame modify to support step frame back functionality
+ (except for VMR9)
+ CHANGED: support for AC3 in MP4 files created with Nero Digital
+ CHANGED: EVR Custom and VMR9 Renderless revamped (Beliyaal),
+ better synchronization, remove tearing in windowed mode,
+ support for dialog box in DirectX exclusive mode, ...
+ FIXED : Support for Theora stream in Ogg internal splitter
+ FIXED : Save thumbnails crash in x64
+ FIXED : Bugs on presentation graphics
+ (missing subtitles, better synchronization)
+ FIXED : Audio change on M2TS files reset the selected subtitle
+ FIXED : Switch to "Minimal view" reset main menu language to English
+ FIXED : Bug in MPEG splitter for VC1
+ FIXED : Maximum texture resolution to "Desktop" not working with Haali
+ renderer (Bug #2456735)
+ FIXED : Better synchronization with EVR Custom to improve playback smoothness
+ FIXED : 24 bits LPCM not properly play
+ FIXED : Possible deadlock with Reclock
+ FIXED : Support of framestep backward, even if the codec didn't support it
+ natively (bug #2600542)
+ FIXED : DXVA decoder support multiple graphics cards
+ (PCI vendor id detection on the fly)
+ FIXED : Incorrect aspect ratio for some H.264 files with DXVA1 decoder
+ (extended SAR)
+ FIXED : H.264 files with 16 reference frames freeze during playback
+ (bug #2795785 and #2784256)
+ FIXED : AVI with H.264 not decoded properly (bug #2794854)
+ FIXED : Revamped DXVA H.264 decoder based on new insights, fixing black screen
+ macroblock, support for AVI, ...
+ FIXED : Incorrect playback for padded DTS
+ FIXED : Hang when moving player between monitors
+
+
+v1.2.908.0 - 30 November 2008
+=============================
+ NEW : support Multi-Monitor configuration, select Monitor for full-screen
+ playback
+ NEW : a minidump file is created when MPC-HC crashes
+ NEW : Simplified Chinese & Traditional Chinese translations
+ NEW : Pixel shader to convert BT601 -> BT701 (request #1911511)
+ NEW : YV12 Chroma Upsampling pixel shader added
+ (http://forum.doom9.org/showthread.php?p=1184975#post1184975)
+ NEW : Recursively adding directories to the Playlist
+ (feature request #2013805), add as New Menu item
+ NEW : Support for M2TS presentation graphics streams
+ (only for EVR Custom and VMR9 Renderless)
+ NEW : Command line switches "/startpos hh:mm:ss.ff", "/dvdpos title#chapter"
+ and "/dvdpos title#hh:mm:ss.ff" to start playback to position
+ NEW : Different icons for each format associated with MPC-HC
+ NEW : support H.264 and AAC in FLV splitter
+ CHANGED: Add VIRTKEY for "Save Thumbnails" (request #1964399)
+ CHANGED: Store the settings for the internal DXVA/FFmpeg decoders
+ in a different value than the other internal decoders. This makes
+ the settings better interchangeable with older MPC-HC builds.
+ Also gives more room in the bitvector for adding more decoders
+ in the future (FFmpeg based)
+ CHANGED: PAR correction option (for anamorphic video)in VSFilter
+ and RealText support
+ CHANGED: Updated liba52 & libdts libraries
+ CHANGED: The x64 version of MPCVideodec is now built using GCC/MinGW64
+ (improves performance)
+ CHANGED: GUI option for Explorer Context menu->Files (see Formats Page)
+ CHANGED: GUI option for Explorer Context menu->Directory (see Formats Page)
+ CHANGED: Open directory (shell context menu or MPC-HC menu) -
+ load only enqueues audio/video files, those with file extensions
+ from the Formats page in MPC-HC options
+ CHANGED: Replaced command line switches /unregvid and /unregaud with
+ a new switch /unregall. This cleans up all file associations,
+ including image/playlist formats
+ CHANGED: Change in VideoDecoder Settings for rev.681 (read AR from stream)
+ CHANGED: Open DVD detect and open Blu-Ray main movie
+ CHANGED: EAC3 support in MPEG splitter
+ CHANGED: Number of files and DVD position increase from 5 to 20 (req #1819709)
+ CHANGED: Bypass of UOPs for DVD (req #1811508). This feature didn't work
+ for the x64 build
+ CHANGED: libpng updated to release 1.2.32 (fixes a memory leak)
+ FIXED : Chapter message improperly displayed in status bar (for file only)
+ FIXED : Crash with CoreAVC when changing "preferred decoder" setting
+ during playback
+ FIXED : Missing checkmarks on "tearing test" and "display stats" options
+ (bug #2010857)
+ FIXED : Save image/thumbnail not working with EVR (bug #2010681)
+ FIXED : Workaround to prevent GraphEdit crash when MPCVideoDec.ax
+ was registered.
+ (when opening menu "Graph/Insert filter/Direct show filters")
+ FIXED : Fix rare seeking issue with VobSub in VSFilter
+ FIXED : Subtitle style not save in settings
+ FIXED : random freeze when using MPC-HC, VSFilter and Haali renderer
+ at the same time
+ FIXED : shortcuts with MEDIA_PLAY, MEDIA_PAUSE not working with some
+ remote controls
+ FIXED : shortcuts label in "Option / Key" dialog box is now localized
+ FIXED : MPC-HC file association cleanup bug (rev.731), these commands
+ are not working: mplayerc /unregvid, mplayerc /unregaud
+ FIXED : Freeze when playing MPEG-2 or Xvid file
+ FIXED : Remember position not working with some DVDs
+ FIXED : DXVA decoder now support H.264 interlaced video
+ FIXED : Crash/black screen with DXVA decoder with some ATI cards
+ FIXED : Incorrect aspect ratio with some H.264 files (extended SAR)
+
+
+v1.1.604.0 - 28 June 2008
+=========================
+ NEW : Subtitle delay support (this one does not modify the subtitle file)
+ NEW : Polish, Ukrainian, Italian & Slovak translations
+ NEW : Support for M2TS files with H.264, VC1, AC3, DTS, LPCM
+ NEW : MPEG-2 support for x64 edition
+ CHANGED: Improved support for audio and subtitle switching with the
+ internal MPEG splitter
+ CHANGED: Size shrink for the translation DLLs
+ CHANGED: New property page for "MPC - Video decoder" standalone filter
+ to select activated codecs
+ CHANGED: Option added in "MPC - Video Decoder" property page to disable
+ FFmpeg software decoding (to use other decoder instead)
+ CHANGED: Added file extensions EVO, M2TS and M4A in option / format
+ CHANGED: Force using 3D surface with EVR Custom Presenter
+ CHANGED: x64 executable is now named mplayerc64.exe
+ FIXED : Sorenson video was not played when DXVA was activated
+ FIXED : Minimum EVR buffer set to 3 (instead of 1)
+ FIXED : Better subtitle synchronization with EVR Custom Presenter
+ (delay due to buffering remove)
+ FIXED : DXVA compatibility improved with some NVIDIA cards
+ FIXED : Reported subtitle fixes from Guliverkli2
+ FIXED : Incorrect colors with DXVA internal decoder for H.264 files
+ with multiple PPS / SPS settings
+ FIXED : Broken FLV playback
+ FIXED : EVR Custom Presenter incompatibility with Microsoft MPEG-2
+ and CyberLink decoder
+ FIXED : DXVA decoding bugs for some H.264 files
+ FIXED : Memory leak in the DXVA decoder (bug #1962448)
+ FIXED : Crash on stop/play with the DXVA decoder
+ FIXED : Random crash with EVR Custom Presenter
+ FIXED : Macroblocks with NVIDIA card
+ (appear on H.264 streams with custom quantization matrix)
+ FIXED : Access violation using VSFilter as AviSynth plugin
+ FIXED : Some H.264 streams was not recognized by internal MPEG splitter
+ (PPS and SPS present on different packets)
+ FIXED : Black screen when OSD or subtitles was displayed in x64 release
+ FIXED : Wrong Aspect Ratio when using "Save thumbnails" with EVR CP
+
+
+v1.1.0.0 - 6 March 2008
+=======================
+ NEW : Custom presenter now support DXVA2, and display hardware acceleration
+ mode in Jitter test information
+ NEW : Internal video decoder based on FFmpeg for Flash video
+ (FLV4, VP5, VP6), AMV, MPEG4, SQV, Theora, VC1, XVID, and DivX
+ NEW : Internal video decoder H.264 with DXVA 1 acceleration
+ (using VMR9 or overlay on XP) and DXVA2 (using EVR on Vista)
+ NEW : Korean translation
+ CHANGED: FAAD library updated to 2.6
+ CHANGED: Standalone filter renamed to be prefixed by "MPC - xxx"
+ CHANGED: CSS classes added in WebServer (request #1885296)
+ FIXED : Incorrect colors on video when using YUV mixing
+ and "VMR Color controls"
+ FIXED : PN31 driver installation was not working
+ FIXED : MPC-HC graph manager now use the same filter priority as WMP
+ and GraphEdit (clsid's patch)
+ FIXED : MPC-HC is now recognized as an application by SUMo
+ (http://www.kcsoftwares.com/index.php?sumo)
+ FIXED : Ghost horizontal and vertical lines with Pixel Shader resizer
+ (especially on ATI graphics card)
+ FIXED : Crash in FLV splitter with file containing 0 bytes packets
+ FIXED : Button "Video" in format property page didn't select images anymore
+ FIXED : No sound in some FLV video with Nellymoser audio track
+ FIXED : Multimedia keys (mute, vol+-, ...)
+ was captured by MPC-HC even if option "global media keys" was off
+ FIXED : YUV mixing is now disable with Vista
+ (not supported by Vista VMR9, and cause black screen)
+
+
+v1.0.11.0 - 14 October 2007
+===========================
+ NEW : Command Line Option "/dubdelay" applies a positive or negative
+ audio delay of ???ms, if filename contains "DELAY ???ms"
+ (internal Audio Switcher required)
+ NEW : Russian, Turkish, Czech, Spanish and Hungarian translations
+ NEW : Internal AVI splitter support AMV files
+ (need an ffdshow update to decode)
+ CHANGED: File type association. MPC-HC is now recognized as a registered media
+ player application. File type registration now compatible with UAC (Vista)
+ CHANGED: Matroska internal subtitles are not loaded
+ if "auto-load subtitles" option is off
+ CHANGED: Allow DirectShow to use a disabled internal source
+ and transform filters when no other suitable filter is available
+ FIXED : Subtitle popup menu not working in French
+ FIXED : "Remember file position" option is not working properly
+ in playlist mode
+ FIXED : Crash when opening "Navigation" menu while playing DVD
+ (German locale only)
+ FIXED : Memory leak with window resize
+ FIXED : Many GUI related things
+ FIXED : Crash when opening zero byte length MP3 files
+ FIXED : Crash when using "Save thumbnails" with number of row or column
+ greater than 8 (now internally limited to 8)
+
+
+v1.0.10.0 - 15 September 2007
+=============================
+ CHANGED: Latest clsid's patches (Bento4 0.9.3, FAAD2 2.6b, dtsdec 0.0.2,
+ libmad 0.15.1b, zlib 1.2.3, MPEG decoder: progressive frames fix,
+ MPEG decoder: DSUtil interlaced fix v2)
+ CHANGED: libpng 1.2.20
+ NEW : Command Line Option "/d3dfs" to start MPC-HC in D3D Fullscreen mode
+ NEW : Logitech LCD support (e.g. G15 keyboard)
+ CHANGED: Remember File and DVD position works only when "Keep history"
+ is active (preserve privacy issue)
+ CHANGED: Kick off Screen Saver from Power Options only while video is playing
+ (Vista)
+ NEW : Build for x64 platforms
+ NEW : Multilingual support for English, French and German
+ CHANGED: DirectX SDK updated to August 2007 (v35)
+ FIXED : Wrong Aspect Ratio with EVR CP (definitely i hope :-)
+ FIXED : Internal MPEG-2 Decoder was not working with EVR and EVR CP
+ FIXED : Audio sync problems with Blu-Ray/HD DVD DTS files
+ [wrong AvgTimePerFrame calculation for DTS and AC3 (madshi)]
+ FIXED : OSD was not working when D3DX9_XX dll was not present
+ (random pixels shown in top of video)
+ FIXED : Mouse now working in DVD menu with EVR Custom Presenter (Vista)
+ FIXED : FLV Splitter when video does not start with keyframe
+ FIXED : Vulnerability CAL-20070912-1 in AVI Source Filter
+ (arbitrary code execute with users privileges)
+ FIXED : Vulnerability in FLI internal source filter
+
+
+v1.0.9.0 - 14 July 2007
+=======================
+ CHANGED: OSD improved for EVR Custom Presenter
+ FIXED : EVR Custom Presenter rendering thread stability
+ FIXED : EVR Custom Presenter doesn't need mfplat.dll anymore
+ (the dll is installed with WMP 11)
+ NEW : Exit Option in popup menu
+ FIXED : Use same registry key like original Gabest Media Player Classic
+ FIXED : Freeze when playing audio only file with EVR Custom Presenter
+ FIXED : Wrong Aspect Ratio with anamorphic video using EVR Custom Presenter
+ FIXED : When Video pause, frame stepping with EVR Custom Presenter started
+ video playback at normal speed
+ FIXED : Save thumbnail with EVR Custom Presenter froze MPC-HC
+ FIXED : FLV splitter did not read width and height out of metadata
+ (thanks to Chobits for this fix)
+ FIXED : If more than one subtitle text rows shown, the background
+ ("Outline" color) vertically overlapped the other one
+
+
+v1.0.8.0 - 31 May 2007
+======================
+ NEW : Kick off Screen Saver from Power Options, only when MPC-HC has focus
+ (Vista)
+ FIXED : Jitter test was not displayed with some files
+ FIXED : Crash if statistics should be displayed, when d3dx9_29.dll
+ was not present
+ FIXED : Possible crash when closing file, while OSD was displayed
+ FIXED : DVD menu freeze with EVR CP and NVIDIA Pure Video decoder (Win XP)
+ FIXED : Mouse-click to play not working at the bottom of video
+ FIXED : MKV internal subtitles were not displayed from time to time
+ FIXED : Video disappeared when moving MPC-HC to other screen
+ with EVR Custom Presenter on dual display
+
+
+v1.0.7.0 - 27 May 2007
+======================
+ NEW : "EVR Custom Presenter" mode added as output renderer. In this mode
+ EVR supports internal MPC-HC subtitles, D3D Fullscreen, tearing test
+ and Pixels Shaders
+ NEW : Statistics option currently displays the jitter curve
+ (Ctrl + J to activate) for VMR9 Renderless and EVR Custom Presenter
+ CHANGED: Output property page, options now are disabled when not supported
+ by the selected renderer
+ FIXED : Mouse cursor invisible in Fullscreen mode
+ FIXED : Mouse-click to play was not working with some renderers
+ FIXED : A one pixel width rectangle was not displayed around the video window
+ (refresh problem)
+ FIXED : Crash when switching from VMR9 Renderless to VRM7 Renderless (Vista)
+
+
+v1.0.6.0 - 07 May 2007
+======================
+ NEW : VP62 codec internal filter re-activated
+ NEW : MPEG4 splitter internal filter re-activated
+ CHANGED: _xxl patches included (VP62 codec internal filter, MPEG4 splitter
+ internal filter)
+ FIXED : Window "flashing" during resize, after video loaded
+
+
+v1.0.5.0 - 05 May 2007
+======================
+ NEW : MPC-HC is now Vista ready, added Enhanced Video Renderer (EVR) with OSD support
+ NEW : Shuttle PN31 Remote Control support
+ NEW : Subtitle synchronization with keyboard shortcuts or remote control
+ FIXED : Fixed bug at internal filter property page
+
+
+v1.0.4.0 - 09 May 2006
+======================
+ CHANGED: OSD improvement
+ NEW : Remaining time displayed (Ctrl + I or "Remaining_Time" with WinLIRC)
+ NEW : OSD Fast forward / rewind speed display
+ CHANGED: OSD FF/Rew for DVD playback: slow forward replaced by rewind,
+ no more predefined speed limits (feature depends on MPEG-2 decoder
+ capabilities)
+ FIXED : Taskbar Display bug in D3D Fullscreen mode
+ FIXED : Mouse cursor invisible in D3D Fullscreen mode
+
+
+v1.0.3.0 - 02 May 2006
+======================
+ NEW : YUV mixer mode for VMR9
+ NEW : OSD for VMR9 output for languages selection
+ NEW : "DVD Menu Activate" can also be used to start playback
+ (useful when using remote control via WinLIRC)
+ FIXED : Aspect Ratio bug in D3D Fullscreen mode
+
+
+v1.0.2.0 - 23 April 2006
+========================
+ CHANGED: D3D Fullscreen mode improved
+ FIXED : VMR9 Color control bug
+
+
+v1.0.1.0 - 09 April 2006
+========================
+ NEW : DVD open dialog now allows selecting the source folder or drive
+ NEW : Possibility to save video position for the last 5 DVDs and/or files
+ to resume playback at this position when MPC-HC is restarted
+ NEW : Shortcut to inhibit Pixel Shaders (Ctrl + P). Only additional
+ Pixel Shaders effects are concerned (always used if resize active)
+
+
+v1.0.0.0 - 29 March 2006
+========================
+ NEW : Color control option for VMR renderer
+ NEW : Automatically reload Pixel Shaders at startup
+ NEW : Tearing test function (Ctrl+T): displays 2 moving bars
+ (useful to also show judder)
diff --git a/src/apps/mplayerc/ChildView.cpp b/src/apps/mplayerc/ChildView.cpp
index 597cacee9..8af6c27de 100644
--- a/src/apps/mplayerc/ChildView.cpp
+++ b/src/apps/mplayerc/ChildView.cpp
@@ -45,7 +45,7 @@ CChildView::~CChildView()
BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CWnd::PreCreateWindow(cs)) {
+ if (!CWnd::PreCreateWindow(cs)) {
return FALSE;
}
@@ -58,7 +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);
@@ -67,11 +67,11 @@ BOOL CChildView::PreTranslateMessage(MSG* pMsg)
bool fInteractiveVideo = ((CMainFrame*)AfxGetMainWnd())->IsInteractiveVideo();
/*
- if(fInteractiveVideo)
+ if (fInteractiveVideo)
{
- if(pMsg->message == WM_LBUTTONDOWN)
+ if (pMsg->message == WM_LBUTTONDOWN)
{
- if((pMsg->time - m_lastlmdowntime) <= GetDoubleClickTime()
+ 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))
{
@@ -85,20 +85,20 @@ BOOL CChildView::PreTranslateMessage(MSG* pMsg)
m_lastlmdownpoint = pMsg->pt;
}
}
- else if(pMsg->message == WM_LBUTTONDBLCLK)
+ 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)
+ if ((pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONUP || pMsg->message == WM_MOUSEMOVE)
&& fInteractiveVideo) {
- if(pMsg->message == WM_MOUSEMOVE) {
+ 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));
}
@@ -127,11 +127,11 @@ 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
@@ -140,7 +140,7 @@ void CChildView::LoadLogo()
}
}
- if(m_hWnd) {
+ if (m_hWnd) {
Invalidate();
}
}
@@ -148,7 +148,7 @@ void CChildView::LoadLogo()
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;
@@ -191,9 +191,9 @@ 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);
@@ -229,22 +229,22 @@ void CChildView::OnSize(UINT nType, int cx, int cy)
BOOL CChildView::OnPlayPlayPauseStop(UINT nID)
{
- if(nID == ID_PLAY_STOP) {
+ if (nID == ID_PLAY_STOP) {
SetVideoRect();
}
CString osd = ResStr(nID);
int i = osd.Find(_T("\n"));
- if(i > 0) {
+ if (i > 0) {
osd.Delete(i, osd.GetLength()-i);
}
CRect r1;
((CMainFrame*)AfxGetMainWnd())->GetClientRect(&r1);
- if((!r1.Width()) || (!r1.Height())) {
+ 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;
@@ -252,11 +252,11 @@ BOOL CChildView::OnPlayPlayPauseStop(UINT nID)
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;
}
@@ -269,7 +269,7 @@ LRESULT CChildView::OnNcHitTest(CPoint point)
CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
bool fLeftMouseBtnUnassigned = !assignedToCmd(wmcmd::LDOWN);
- if(!pFrame->m_fFullScreen && (pFrame->IsCaptionHidden() || fLeftMouseBtnUnassigned)) {
+ if (!pFrame->m_fFullScreen && (pFrame->IsCaptionHidden() || fLeftMouseBtnUnassigned)) {
CRect rcClient, rcFrame;
GetWindowRect(&rcFrame);
rcClient = rcFrame;
@@ -279,26 +279,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 {
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 {
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;
}
}
@@ -310,9 +310,9 @@ void CChildView::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
bool fLeftMouseBtnUnassigned = !assignedToCmd(wmcmd::LDOWN);
- if(!pFrame->m_fFullScreen && (pFrame->IsCaptionHidden() || fLeftMouseBtnUnassigned)) {
+ if (!pFrame->m_fFullScreen && (pFrame->IsCaptionHidden() || fLeftMouseBtnUnassigned)) {
BYTE bFlag = 0;
- switch(nHitTest) {
+ switch (nHitTest) {
case HTTOP:
bFlag = WMSZ_TOP;
break;
@@ -338,7 +338,7 @@ void CChildView::OnNcLButtonDown(UINT nHitTest, CPoint point)
bFlag = WMSZ_BOTTOMRIGHT;
break;
}
- if(bFlag) {
+ if (bFlag) {
pFrame->PostMessage(WM_SYSCOMMAND, (SC_SIZE | bFlag), (LPARAM)POINTTOPOINTS(point));
} else {
CWnd::OnNcLButtonDown(nHitTest, point);
diff --git a/src/apps/mplayerc/ComPropertyPage.cpp b/src/apps/mplayerc/ComPropertyPage.cpp
index 90519a5a3..d66ff6873 100644
--- a/src/apps/mplayerc/ComPropertyPage.cpp
+++ b/src/apps/mplayerc/ComPropertyPage.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -75,7 +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);
}
@@ -100,7 +100,7 @@ END_MESSAGE_MAP()
void CComPropertyPage::OnOK()
{
- if(S_OK == m_pPage->IsPageDirty()) {
+ if (S_OK == m_pPage->IsPageDirty()) {
m_pPage->Apply();
}
SetModified(FALSE);
diff --git a/src/apps/mplayerc/ComPropertySheet.cpp b/src/apps/mplayerc/ComPropertySheet.cpp
index dc9c47fe8..cfd066c1b 100644
--- a/src/apps/mplayerc/ComPropertySheet.cpp
+++ b/src/apps/mplayerc/ComPropertySheet.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -46,11 +46,11 @@ public:
// IPropertyPageSite
STDMETHODIMP OnStatusChange(DWORD flags) {
- if(m_pPPD) {
- if(flags&PROPPAGESTATUS_DIRTY) {
+ if (m_pPPD) {
+ if (flags&PROPPAGESTATUS_DIRTY) {
m_pPPD->OnSetDirty(true);
}
- if(flags&PROPPAGESTATUS_CLEAN) {
+ if (flags&PROPPAGESTATUS_CLEAN) {
m_pPPD->OnSetDirty(false);
}
}
@@ -92,18 +92,18 @@ CComPropertySheet::~CComPropertySheet()
int CComPropertySheet::AddPages(ISpecifyPropertyPages* pSPP)
{
- if(!pSPP) {
+ 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);
}
@@ -113,31 +113,31 @@ 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) {
+ if (caGUID.pElems) {
CoTaskMemFree(caGUID.pElems);
}
lpUnk->Release();
@@ -147,7 +147,7 @@ int CComPropertySheet::AddPages(ISpecifyPropertyPages* pSPP)
bool CComPropertySheet::AddPage(IPropertyPage* pPage, IUnknown* pUnk)
{
- if(!pPage || !pUnk) {
+ if (!pPage || !pUnk) {
return false;
}
@@ -167,7 +167,7 @@ bool CComPropertySheet::AddPage(IPropertyPage* pPage, IUnknown* pUnk)
void CComPropertySheet::OnActivated(CPropertyPage* pPage)
{
- if(!pPage) {
+ if (!pPage) {
return;
}
@@ -184,12 +184,12 @@ 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)) {
+ for (CWnd* pGrandChild = pChild->GetWindow(GW_CHILD); pGrandChild; pGrandChild = pGrandChild->GetNextWindow()) {
+ if (!(pGrandChild->GetStyle()&WS_VISIBLE)) {
continue;
}
@@ -212,8 +212,8 @@ 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;
@@ -223,8 +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()));
diff --git a/src/apps/mplayerc/ComPropertySheet.h b/src/apps/mplayerc/ComPropertySheet.h
index f96044980..65a8a65fb 100644
--- a/src/apps/mplayerc/ComPropertySheet.h
+++ b/src/apps/mplayerc/ComPropertySheet.h
@@ -53,7 +53,7 @@ public:
// IComPropertyPageDirty
void OnSetDirty(bool fDirty) {
- if(CPropertyPage* p = GetActivePage()) {
+ if (CPropertyPage* p = GetActivePage()) {
p->SetModified(fDirty);
}
}
diff --git a/src/apps/mplayerc/DVBChannel.cpp b/src/apps/mplayerc/DVBChannel.cpp
index 6a0d8bff4..f1984e34a 100644
--- a/src/apps/mplayerc/DVBChannel.cpp
+++ b/src/apps/mplayerc/DVBChannel.cpp
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -77,14 +77,14 @@ void CDVBChannel::FromString(CString strValue)
}
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));
@@ -115,11 +115,11 @@ 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);
}
diff --git a/src/apps/mplayerc/DeinterlacerFilter.cpp b/src/apps/mplayerc/DeinterlacerFilter.cpp
index a6e531828..65b2173c2 100644
--- a/src/apps/mplayerc/DeinterlacerFilter.cpp
+++ b/src/apps/mplayerc/DeinterlacerFilter.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -30,7 +30,7 @@
CDeinterlacerFilter::CDeinterlacerFilter(LPUNKNOWN punk, HRESULT* phr)
: CTransformFilter(NAME("CDeinterlacerFilter"), punk, __uuidof(CDeinterlacerFilter))
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
}
@@ -43,7 +43,7 @@ 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;
}
@@ -63,19 +63,19 @@ 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;
}
@@ -95,14 +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,7 @@ HRESULT CDeinterlacerFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
HRESULT CDeinterlacerFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
@@ -137,7 +137,7 @@ 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;
}
@@ -148,13 +148,13 @@ HRESULT CDeinterlacerFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCAT
HRESULT CDeinterlacerFilter::GetMediaType(int iPosition, CMediaType* pmt)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
*pmt = m_pInput->CurrentMediaType();
diff --git a/src/apps/mplayerc/EditListEditor.cpp b/src/apps/mplayerc/EditListEditor.cpp
index 061630170..6eeaf3fb8 100644
--- a/src/apps/mplayerc/EditListEditor.cpp
+++ b/src/apps/mplayerc/EditListEditor.cpp
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -110,7 +110,7 @@ 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;
}
@@ -151,7 +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);
@@ -186,7 +186,7 @@ void CEditListEditor::SaveEditListToFile()
}
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()) {
@@ -260,7 +260,7 @@ void CEditListEditor::OpenFile(LPCTSTR lpFileName)
CStdioFile NameFile;
CString str;
if (NameFile.Open (_T("EditListNames.txt"), CFile::modeRead)) {
- while(NameFile.ReadString(str)) {
+ while (NameFile.ReadString(str)) {
m_NameList.Add(str);
}
NameFile.Close();
@@ -345,7 +345,7 @@ POSITION CEditListEditor::InsertClip(POSITION pos, CClip& NewClip)
void CEditListEditor::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
- if(nIDCtl != IDC_EDITLIST) {
+ if (nIDCtl != IDC_EDITLIST) {
return;
}
@@ -361,7 +361,7 @@ 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 {
@@ -369,7 +369,7 @@ void CEditListEditor::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
}
COLORREF textcolor = RGB(0,0,0);
- if(!CurClip.HaveIn() || !CurClip.HaveOut()) {
+ if (!CurClip.HaveIn() || !CurClip.HaveOut()) {
textcolor = RGB(255,0,0);
}
@@ -399,7 +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);
}
}
@@ -410,11 +410,11 @@ 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) {
@@ -452,7 +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);
@@ -468,13 +468,13 @@ 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 {
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 {
KillTimer(2);
@@ -490,19 +490,19 @@ 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) {
+ if (m_list.GetTopIndex() == 0) {
KillTimer(1);
}
- } else if(nIDEvent == 2) {
+ } else if (nIDEvent == 2) {
m_list.EnsureVisible(iBottomItem + 1, false);
m_list.UpdateWindow();
- if(m_list.GetBottomIndex() == (m_list.GetItemCount() - 1)) {
+ if (m_list.GetBottomIndex() == (m_list.GetItemCount() - 1)) {
KillTimer(2);
}
}
@@ -515,7 +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;
@@ -531,7 +531,7 @@ void CEditListEditor::OnLButtonUp(UINT nFlags, CPoint point)
CPoint pt(point);
ClientToScreen(&pt);
- if(WindowFromPoint(pt) == &m_list) {
+ if (WindowFromPoint(pt) == &m_list) {
DropItemOnList();
}
}
@@ -564,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;
}
}
@@ -580,7 +580,7 @@ void CEditListEditor::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
*pResult = FALSE;
- if(pItem->iItem < 0) {
+ if (pItem->iItem < 0) {
return;
}
@@ -605,17 +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);
@@ -627,7 +627,7 @@ 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) {
@@ -648,7 +648,7 @@ void CEditListEditor::FillCombo(LPCTSTR strFileName, CComboBox& Combo, bool bAll
Combo.AddString(_T(""));
}
- while(NameFile.ReadString(str)) {
+ while (NameFile.ReadString(str)) {
Combo.AddString(str);
}
NameFile.Close();
diff --git a/src/apps/mplayerc/FGFilter.cpp b/src/apps/mplayerc/FGFilter.cpp
index 72623e3b7..b46e9795e 100644
--- a/src/apps/mplayerc/FGFilter.cpp
+++ b/src/apps/mplayerc/FGFilter.cpp
@@ -62,22 +62,22 @@ 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) {
- if(majortype == types[i] && majortype != GUID_NULL
+ 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) {
return true;
}
} else {
- if((majortype == GUID_NULL || types[i] == GUID_NULL || majortype == types[i])
+ if ((majortype == GUID_NULL || types[i] == GUID_NULL || majortype == types[i])
&& (subtype == GUID_NULL || types[i+1] == GUID_NULL || subtype == types[i+1])) {
return true;
}
@@ -96,12 +96,12 @@ CFGFilterRegistry::CFGFilterRegistry(IMoniker* pMoniker, UINT64 merit)
: CFGFilter(GUID_NULL, L"", merit)
, m_pMoniker(pMoniker)
{
- if(!m_pMoniker) {
+ if (!m_pMoniker) {
return;
}
LPOLESTR str = NULL;
- if(FAILED(m_pMoniker->GetDisplayName(0, 0, &str))) {
+ if (FAILED(m_pMoniker->GetDisplayName(0, 0, &str))) {
return;
}
m_DisplayName = m_name = str;
@@ -109,7 +109,7 @@ CFGFilterRegistry::CFGFilterRegistry(IMoniker* pMoniker, UINT64 merit)
QueryProperties();
- if(merit != MERIT64_DO_USE) {
+ if (merit != MERIT64_DO_USE) {
m_merit.val = merit;
}
}
@@ -118,7 +118,7 @@ CFGFilterRegistry::CFGFilterRegistry(CStringW DisplayName, UINT64 merit)
: CFGFilter(GUID_NULL, L"", merit)
, m_DisplayName(DisplayName)
{
- if(m_DisplayName.IsEmpty()) {
+ if (m_DisplayName.IsEmpty()) {
return;
}
@@ -126,13 +126,13 @@ CFGFilterRegistry::CFGFilterRegistry(CStringW DisplayName, UINT64 merit)
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;
}
QueryProperties();
- if(merit != MERIT64_DO_USE) {
+ if (merit != MERIT64_DO_USE) {
m_merit.val = merit;
}
}
@@ -141,21 +141,21 @@ void CFGFilterRegistry::QueryProperties()
{
ASSERT(m_pMoniker);
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);
}
@@ -168,7 +168,7 @@ void CFGFilterRegistry::QueryProperties()
CFGFilterRegistry::CFGFilterRegistry(const CLSID& clsid, UINT64 merit)
: CFGFilter(clsid, L"", merit)
{
- if(m_clsid == GUID_NULL) {
+ if (m_clsid == GUID_NULL) {
return;
}
@@ -176,11 +176,11 @@ CFGFilterRegistry::CFGFilterRegistry(const CLSID& clsid, UINT64 merit)
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;
}
@@ -191,18 +191,18 @@ 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;
}
@@ -211,20 +211,20 @@ CFGFilterRegistry::CFGFilterRegistry(const CLSID& clsid, UINT64 merit)
}
}
- 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);
}
}
@@ -233,7 +233,7 @@ CFGFilterRegistry::CFGFilterRegistry(const CLSID& clsid, UINT64 merit)
}
}
- if(merit != MERIT64_DO_USE) {
+ if (merit != MERIT64_DO_USE) {
m_merit.val = merit;
}
}
@@ -244,14 +244,14 @@ 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;
}
@@ -275,20 +275,20 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len)
CComPtr<IAMFilterData> pFD;
BYTE* ptr = NULL;
- if(SUCCEEDED(pFD.CoCreateInstance(CLSID_FilterMapper2))
+ if (SUCCEEDED(pFD.CoCreateInstance(CLSID_FilterMapper2))
&& 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;
}
@@ -296,14 +296,14 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len)
AddType(*rpt.clsMajorType, *rpt.clsMinorType);
}
}
- } else if(prf->dwVersion == 2) {
- for(UINT i = 0; i < prf->cPins2; i++) {
- if(prf->rgPins2[i].dwFlags&REG_PINFLAG_B_OUTPUT) {
+ } else if (prf->dwVersion == 2) {
+ for (UINT i = 0; i < prf->cPins2; i++) {
+ if (prf->rgPins2[i].dwFlags&REG_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;
}
@@ -317,10 +317,10 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len)
} else {
BYTE* base = p;
-#define ChkLen(size) if(p - base + size > (int)len) return;
+#define ChkLen(size) if (p - base + size > (int)len) return;
ChkLen(4)
- if(*(DWORD*)p != 0x00000002) {
+ if (*(DWORD*)p != 0x00000002) {
return; // only version 2 supported, no samples found for 1
}
p += 4;
@@ -334,7 +334,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++;
@@ -359,7 +359,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++;
@@ -379,7 +379,7 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len)
p += 4;
ChkLen(8)
- if(*(DWORD*)p < (p-base+8) || *(DWORD*)p >= len
+ if (*(DWORD*)p < (p-base+8) || *(DWORD*)p >= len
|| *(DWORD*)(p+4) < (p-base+8) || *(DWORD*)(p+4) >= len) {
p += 8;
continue;
@@ -388,7 +388,7 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len)
GUID majortype, subtype;
memcpy(&majortype, &base[*(DWORD*)p], sizeof(GUID));
p += 4;
- if(!fOutput) {
+ if (!fOutput) {
AddType(majortype, subtype);
}
}
@@ -436,28 +436,28 @@ HRESULT CFGFilterVideoRenderer::Create(IBaseFilter** ppBF, CInterfaceList<IUnkno
CComPtr<ISubPicAllocatorPresenter> pCAP;
- if(m_clsid == CLSID_VMR7AllocatorPresenter
+ if (m_clsid == CLSID_VMR7AllocatorPresenter
|| m_clsid == CLSID_VMR9AllocatorPresenter
|| m_clsid == CLSID_DXRAllocatorPresenter
|| m_clsid == CLSID_madVRAllocatorPresenter
|| m_clsid == CLSID_EVRAllocatorPresenter
|| m_clsid == CLSID_SyncAllocatorPresenter) {
bool bFullscreen = (AfxGetApp()->m_pMainWnd != NULL) && (((CMainFrame*)AfxGetApp()->m_pMainWnd)->IsD3DFullScreenMode());
- if(SUCCEEDED(CreateAP7(m_clsid, m_hWnd, &pCAP))
+ 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))) {
CComPtr<IUnknown> pRenderer;
- if(SUCCEEDED(hr = pCAP->CreateRenderer(&pRenderer))) {
+ if (SUCCEEDED(hr = pCAP->CreateRenderer(&pRenderer))) {
*ppBF = CComQIPtr<IBaseFilter>(pRenderer).Detach();
pUnks.AddTail(pCAP);
}
}
} else {
CComPtr<IBaseFilter> pBF;
- if(SUCCEEDED(pBF.CoCreateInstance(m_clsid))) {
+ if (SUCCEEDED(pBF.CoCreateInstance(m_clsid))) {
BeginEnumPins(pBF, pEP, pPin) {
- if(CComQIPtr<IMixerPinConfig, &IID_IMixerPinConfig> pMPC = pPin) {
+ if (CComQIPtr<IMixerPinConfig, &IID_IMixerPinConfig> pMPC = pPin) {
pUnks.AddTail(pMPC);
break;
}
@@ -468,7 +468,7 @@ HRESULT CFGFilterVideoRenderer::Create(IBaseFilter** ppBF, CInterfaceList<IUnkno
}
}
- if(!*ppBF) {
+ if (!*ppBF) {
hr = E_FAIL;
}
@@ -490,9 +490,9 @@ CFGFilterList::~CFGFilterList()
void CFGFilterList::RemoveAll()
{
- while(!m_filters.IsEmpty()) {
+ while (!m_filters.IsEmpty()) {
const filter_t& f = m_filters.RemoveHead();
- if(f.autodelete) {
+ if (f.autodelete) {
delete f.pFGF;
}
}
@@ -502,23 +502,23 @@ 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) {
+ if (group != f2.group) {
continue;
}
- if(CFGFilterRegistry* f2r = dynamic_cast<CFGFilterRegistry*>(f2.pFGF)) {
- if(f1r->GetMoniker() && f2r->GetMoniker() && S_OK == f1r->GetMoniker()->IsEqual(f2r->GetMoniker())
+ 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()) {
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) {
+ if (autodelete) {
delete pFGF;
}
return;
@@ -528,13 +528,13 @@ 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) {
+ if (autodelete) {
delete pFGF;
}
return;
@@ -553,16 +553,16 @@ 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++) {
+ 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) {
+ for (size_t i = 0; i < sort.GetCount(); i++)
+ if (sort[i].pFGF->GetMerit() >= MERIT64_DO_USE) {
m_sortedfilters.AddTail(sort[i].pFGF);
}
}
@@ -571,7 +571,7 @@ POSITION CFGFilterList::GetHeadPosition()
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()));
}
@@ -590,43 +590,43 @@ 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) {
+ if (fa->group < fb->group) {
return -1;
}
- if(fa->group > fb->group) {
+ 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) {
+ if (fgfa && !fgfb) {
return -1;
}
- if(!fgfa && fgfb) {
+ if (!fgfa && fgfb) {
return +1;
}
}
- if(fa->pFGF->GetMerit() > fb->pFGF->GetMerit()) {
+ if (fa->pFGF->GetMerit() > fb->pFGF->GetMerit()) {
return -1;
}
- if(fa->pFGF->GetMerit() < fb->pFGF->GetMerit()) {
+ if (fa->pFGF->GetMerit() < fb->pFGF->GetMerit()) {
return +1;
}
- if(fa->exactmatch && !fb->exactmatch) {
+ if (fa->exactmatch && !fb->exactmatch) {
return -1;
}
- if(!fa->exactmatch && fb->exactmatch) {
+ if (!fa->exactmatch && fb->exactmatch) {
return +1;
}
- if(fa->index < fb->index) {
+ if (fa->index < fb->index) {
return -1;
}
- if(fa->index > fb->index) {
+ if (fa->index > fb->index) {
return +1;
}
diff --git a/src/apps/mplayerc/FGFilter.h b/src/apps/mplayerc/FGFilter.h
index 7a4d89c8b..2eba643ad 100644
--- a/src/apps/mplayerc/FGFilter.h
+++ b/src/apps/mplayerc/FGFilter.h
@@ -109,7 +109,7 @@ public:
HRESULT hr = S_OK;
CComPtr<IBaseFilter> pBF = DNew T(NULL, &hr);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
diff --git a/src/apps/mplayerc/FGManager.cpp b/src/apps/mplayerc/FGManager.cpp
index 9583f20a6..b89f57dd4 100644
--- a/src/apps/mplayerc/FGManager.cpp
+++ b/src/apps/mplayerc/FGManager.cpp
@@ -55,13 +55,13 @@ CFGManager::CFGManager(LPCTSTR pName, LPUNKNOWN pUnk)
CFGManager::~CFGManager()
{
CAutoLock cAutoLock(this);
- while(!m_source.IsEmpty()) {
+ while (!m_source.IsEmpty()) {
delete m_source.RemoveHead();
}
- while(!m_transform.IsEmpty()) {
+ while (!m_transform.IsEmpty()) {
delete m_transform.RemoveHead();
}
- while(!m_override.IsEmpty()) {
+ while (!m_override.IsEmpty()) {
delete m_override.RemoveHead();
}
m_pUnks.RemoveAll();
@@ -98,13 +98,13 @@ 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) {
+ if (p1.filter != p2.filter) {
return true;
- } else if(p1.pin != p2.pin) {
+ } else if (p1.pin != p2.pin) {
return false;
}
}
@@ -119,7 +119,7 @@ bool CFGManager::CheckBytes(HANDLE hFile, CString chkbytes)
CAtlList<CString> sl;
Explode(chkbytes, sl, ',');
- if(sl.GetCount() < 4) {
+ if (sl.GetCount() < 4) {
return false;
}
@@ -128,7 +128,7 @@ bool CFGManager::CheckBytes(HANDLE hFile, CString chkbytes)
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();
@@ -136,7 +136,7 @@ bool CFGManager::CheckBytes(HANDLE hFile, CString chkbytes)
long cb = _ttol(cbstr);
- if(offsetstr.IsEmpty() || cbstr.IsEmpty()
+ if (offsetstr.IsEmpty() || cbstr.IsEmpty()
|| valstr.IsEmpty() || (valstr.GetLength() & 1)
|| cb*2 != valstr.GetLength()) {
return false;
@@ -144,13 +144,13 @@ bool CFGManager::CheckBytes(HANDLE hFile, CString chkbytes)
LARGE_INTEGER offset;
offset.QuadPart = _ttoi64(offsetstr);
- if(offset.QuadPart < 0) {
+ 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';
}
@@ -158,10 +158,10 @@ bool CFGManager::CheckBytes(HANDLE hFile, CString chkbytes)
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;
}
}
@@ -174,7 +174,7 @@ CFGFilter *LookupFilterRegistry(const GUID &guid, CAtlList<CFGFilter*> &list, UI
{
POSITION pos = list.GetHeadPosition();
CFGFilter *pFilter = NULL;
- while(pos) {
+ while (pos) {
CFGFilter* pFGF = list.GetNext(pos);
if (pFGF->GetCLSID() == guid) {
pFilter = pFGF;
@@ -202,30 +202,30 @@ 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(LookupFilterRegistry(CLSID_StreamBufferSource, m_override, 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);
}
}
@@ -233,12 +233,12 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl
// 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;
}
@@ -246,13 +246,13 @@ 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);
}
}
@@ -262,29 +262,29 @@ 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(LookupFilterRegistry(GUIDFromCString(buff), m_override), 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(LookupFilterRegistry(GUIDFromCString(buff), m_override), 5);
}
}
@@ -294,28 +294,28 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl
// 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;
}
@@ -323,10 +323,10 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl
len = countof(buff);
len2 = sizeof(buff2);
- for(DWORD k = 0, type;
+ 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))) {
+ if (CheckBytes(hFile, CString(buff))) {
CFGFilter* pFGF = LookupFilterRegistry(clsid, m_override);
pFGF->AddType(majortype, subtype);
fl.Insert(pFGF, 9);
@@ -340,26 +340,26 @@ 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);
}
@@ -370,7 +370,7 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl
}
}
- if(hFile != INVALID_HANDLE_VALUE) {
+ if (hFile != INVALID_HANDLE_VALUE) {
CloseHandle(hFile);
}
@@ -394,16 +394,16 @@ 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) {
+ if (!pFSF) {
return E_NOINTERFACE;
}
- if(FAILED(hr = AddFilter(pBF, lpcwstrFilterName))) {
+ if (FAILED(hr = AddFilter(pBF, lpcwstrFilterName))) {
return hr;
}
@@ -411,14 +411,14 @@ HRESULT CFGManager::AddSourceFilter(CFGFilter* pFGF, LPCWSTR lpcwstrFileName, LP
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;
}
@@ -432,7 +432,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);
@@ -453,7 +453,7 @@ HRESULT CFGManager::AddSourceFilter(CFGFilter* pFGF, LPCWSTR lpcwstrFileName, LP
STDMETHODIMP CFGManager::AddFilter(IBaseFilter* pFilter, LPCWSTR pName)
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -461,7 +461,7 @@ STDMETHODIMP CFGManager::AddFilter(IBaseFilter* pFilter, LPCWSTR pName)
HRESULT hr;
- if(FAILED(hr = CComQIPtr<IFilterGraph2>(m_pUnkInner)->AddFilter(pFilter, pName))) {
+ if (FAILED(hr = CComQIPtr<IFilterGraph2>(m_pUnkInner)->AddFilter(pFilter, pName))) {
return hr;
}
@@ -474,7 +474,7 @@ STDMETHODIMP CFGManager::AddFilter(IBaseFilter* pFilter, LPCWSTR pName)
STDMETHODIMP CFGManager::RemoveFilter(IBaseFilter* pFilter)
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -485,7 +485,7 @@ STDMETHODIMP CFGManager::RemoveFilter(IBaseFilter* pFilter)
STDMETHODIMP CFGManager::EnumFilters(IEnumFilters** ppEnum)
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -497,7 +497,7 @@ STDMETHODIMP CFGManager::EnumFilters(IEnumFilters** ppEnum)
STDMETHODIMP CFGManager::FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter)
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -508,7 +508,7 @@ STDMETHODIMP CFGManager::FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter)
STDMETHODIMP CFGManager::ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MEDIA_TYPE* pmt)
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -518,11 +518,11 @@ 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) {
+ 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) {
+ if (clsid!=CLSID_Proxy && GetCLSID(pBFUS) == clsid) {
return VFW_E_CANNOT_CONNECT;
}
}
@@ -532,7 +532,7 @@ STDMETHODIMP CFGManager::ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MED
STDMETHODIMP CFGManager::Reconnect(IPin* ppin)
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -543,7 +543,7 @@ STDMETHODIMP CFGManager::Reconnect(IPin* ppin)
STDMETHODIMP CFGManager::Disconnect(IPin* ppin)
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -554,7 +554,7 @@ STDMETHODIMP CFGManager::Disconnect(IPin* ppin)
STDMETHODIMP CFGManager::SetDefaultSyncSource()
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -578,29 +578,29 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender)
HRESULT hr;
- if(S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT)
+ if (S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT)
|| pPinIn && S_OK != IsPinDirection(pPinIn, PINDIR_INPUT)) {
return VFW_E_INVALID_DIRECTION;
}
- if(S_OK == IsPinConnected(pPinOut)
+ if (S_OK == IsPinConnected(pPinOut)
|| 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 {
// 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;
}
@@ -610,9 +610,9 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender)
// 2. Try cached filters
- if(CComQIPtr<IGraphConfig> pGC = (IGraphBuilder2*)this) {
+ if (CComQIPtr<IGraphConfig> pGC = (IGraphBuilder2*)this) {
BeginEnumCachedFilters(pGC, pEF, pBF) {
- if(pPinIn && GetFilterFromPin(pPinIn) == pBF) {
+ if (pPinIn && GetFilterFromPin(pPinIn) == pBF) {
continue;
}
@@ -620,12 +620,12 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender)
// does RemoveFilterFromCache call AddFilter like AddFilterToCache calls RemoveFilter ?
- if(SUCCEEDED(hr = ConnectFilterDirect(pPinOut, pBF, NULL))) {
- if(!IsStreamEnd(pBF)) {
+ 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;
}
}
@@ -641,13 +641,13 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender)
CInterfaceList<IBaseFilter> pBFs;
BeginEnumFilters(this, pEF, pBF) {
- if(pPinIn && GetFilterFromPin(pPinIn) == pBF
+ if (pPinIn && GetFilterFromPin(pPinIn) == pBF
|| GetFilterFromPin(pPinOut) == pBF) {
continue;
}
// HACK: ffdshow - audio capture filter
- if(GetCLSID(pPinOut) == GUIDFromCString(_T("{04FE9017-F873-410E-871E-AB91661A4EF7}"))
+ if (GetCLSID(pPinOut) == GUIDFromCString(_T("{04FE9017-F873-410E-871E-AB91661A4EF7}"))
&& GetCLSID(pBF) == GUIDFromCString(_T("{E30629D2-27E5-11CE-875D-00608CB78066}"))) {
continue;
}
@@ -657,15 +657,15 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool bContinueRender)
EndEnumFilters;
POSITION pos = pBFs.GetHeadPosition();
- while(pos) {
+ while (pos) {
IBaseFilter* pBF = pBFs.GetNext(pos);
- if(SUCCEEDED(hr = ConnectFilterDirect(pPinOut, pBF, NULL))) {
- if(!IsStreamEnd(pBF)) {
+ 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;
}
}
@@ -683,70 +683,77 @@ 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;
- if(types.GetCount() > 0
+ if (types.GetCount() > 0
&& 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) {
+ 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);
+ // Checks if madVR is already in the graph to avoid two instances at the same time
+ CComPtr<IBaseFilter> pBFmadVR;
+ FindFilterByName(_T("madVR Renderer"), &pBFmadVR);
+ if ( pBFmadVR && (pFGF->GetName() == _T("madVR Renderer"))) {
+ continue;
+ }
+
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;
}
hr = ConnectFilterDirect(pPinOut, pBF, NULL);
/*
- if(FAILED(hr))
+ if (FAILED(hr))
{
- if(types.GetCount() >= 2 && types[0] == MEDIATYPE_Stream && types[1] != GUID_NULL)
+ if (types.GetCount() >= 2 && types[0] == MEDIATYPE_Stream && types[1] != GUID_NULL)
{
CMediaType mt;
mt.majortype = types[0];
mt.subtype = types[1];
mt.formattype = FORMAT_None;
- if(FAILED(hr)) hr = ConnectFilterDirect(pPinOut, pBF, &mt);
+ if (FAILED(hr)) hr = ConnectFilterDirect(pPinOut, pBF, &mt);
mt.formattype = GUID_NULL;
- if(FAILED(hr)) hr = ConnectFilterDirect(pPinOut, pBF, &mt);
+ if (FAILED(hr)) hr = ConnectFilterDirect(pPinOut, pBF, &mt);
}
}
*/
- if(SUCCEEDED(hr)) {
- if(!IsStreamEnd(pBF)) {
+ if (SUCCEEDED(hr)) {
+ if (!IsStreamEnd(pBF)) {
fDeadEnd = false;
}
@@ -754,35 +761,35 @@ HRESULT CFGManager::Connect(IPin* pPinOut, IPin* pPinIn, bool 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))) {
@@ -809,18 +816,18 @@ 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) {
+ 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);
}
}
@@ -847,14 +854,14 @@ STDMETHODIMP CFGManager::RenderFile(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrPlay
/*
CComPtr<IBaseFilter> pBF;
- if(FAILED(hr = AddSourceFilter(lpcwstrFile, lpcwstrFile, &pBF)))
+ if (FAILED(hr = AddSourceFilter(lpcwstrFile, lpcwstrFile, &pBF)))
return hr;
return ConnectFilter(pBF, NULL);
*/
CFGFilterList fl;
- if(FAILED(hr = EnumSourceFilters(lpcwstrFileName, fl))) {
+ if (FAILED(hr = EnumSourceFilters(lpcwstrFileName, fl))) {
return hr;
}
@@ -863,14 +870,14 @@ STDMETHODIMP CFGManager::RenderFile(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrPlay
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;
}
@@ -893,13 +900,13 @@ 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;
}
}
@@ -909,7 +916,7 @@ STDMETHODIMP CFGManager::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwst
STDMETHODIMP CFGManager::SetLogFile(DWORD_PTR hFile)
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -920,7 +927,7 @@ STDMETHODIMP CFGManager::SetLogFile(DWORD_PTR hFile)
STDMETHODIMP CFGManager::Abort()
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -931,7 +938,7 @@ STDMETHODIMP CFGManager::Abort()
STDMETHODIMP CFGManager::ShouldOperationContinue()
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -944,7 +951,7 @@ STDMETHODIMP CFGManager::ShouldOperationContinue()
STDMETHODIMP CFGManager::AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx* pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter)
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -955,7 +962,7 @@ STDMETHODIMP CFGManager::AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx*
STDMETHODIMP CFGManager::ReconnectEx(IPin* ppin, const AM_MEDIA_TYPE* pmt)
{
- if(!m_pUnkInner) {
+ if (!m_pUnkInner) {
return E_UNEXPECTED;
}
@@ -971,25 +978,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) {
+ if (CComQIPtr<IAMFilterMiscFlags> pAMMF = pBF) {
+ if (pAMMF->GetMiscFlags() & AM_FILTER_MISC_FLAGS_IS_RENDERER) {
pBFs.AddTail(pBF);
}
} 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;
}
@@ -999,8 +1006,8 @@ 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;
}
}
@@ -1020,7 +1027,7 @@ 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;
}
@@ -1043,23 +1050,23 @@ 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) {
- if(GetPinName(pPin)[0] != '~'
+ if (GetPinName(pPin)[0] != '~'
&& S_OK == IsPinDirection(pPin, PINDIR_OUTPUT)
&& S_OK != IsPinConnected(pPin)) {
m_streampath.Append(pBF, pPin);
HRESULT hr = Connect(pPin, pPinIn);
- if(SUCCEEDED(hr)) {
- for(int i = m_deadends.GetCount()-1; i >= 0; i--)
- if(m_deadends[i]->Compare(m_streampath)) {
+ if (SUCCEEDED(hr)) {
+ for (int i = m_deadends.GetCount()-1; i >= 0; i--)
+ if (m_deadends[i]->Compare(m_streampath)) {
m_deadends.RemoveAt(i);
}
@@ -1070,7 +1077,7 @@ STDMETHODIMP CFGManager::ConnectFilter(IBaseFilter* pBF, IPin* pPinIn)
m_streampath.RemoveTail();
- if(SUCCEEDED(hr) && pPinIn) {
+ if (SUCCEEDED(hr) && pPinIn) {
return S_OK;
}
}
@@ -1090,16 +1097,16 @@ 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) {
- if(GetPinName(pPin)[0] != '~'
+ if (GetPinName(pPin)[0] != '~'
&& S_OK == IsPinDirection(pPin, PINDIR_INPUT)
&& S_OK != IsPinConnected(pPin)) {
HRESULT hr = Connect(pPinOut, pPin);
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
return hr;
}
}
@@ -1116,16 +1123,16 @@ 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) {
- if(GetPinName(pPin)[0] != '~'
+ if (GetPinName(pPin)[0] != '~'
&& S_OK == IsPinDirection(pPin, PINDIR_INPUT)
&& S_OK != IsPinConnected(pPin)) {
HRESULT hr = ConnectDirect(pPinOut, pPin, pmt);
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
return hr;
}
}
@@ -1139,16 +1146,16 @@ STDMETHODIMP CFGManager::NukeDownstream(IUnknown* pUnk)
{
CAutoLock cAutoLock(this);
- if(CComQIPtr<IBaseFilter> pBF = pUnk) {
+ 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)
+ if (S_OK == IsPinDirection(pPin, PINDIR_OUTPUT)
&& SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo) {
- if(CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo)) {
+ if (CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo)) {
NukeDownstream(pBF);
Disconnect(pPinTo);
Disconnect(pPin);
@@ -1168,9 +1175,9 @@ 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) {
+ 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;
@@ -1186,7 +1193,7 @@ STDMETHODIMP CFGManager::AddToROT()
HRESULT hr;
- if(m_dwRegister) {
+ if (m_dwRegister) {
return S_FALSE;
}
@@ -1194,7 +1201,7 @@ STDMETHODIMP CFGManager::AddToROT()
CComPtr<IMoniker> pMoniker;
WCHAR wsz[256];
swprintf(wsz, L"FilterGraph %08p pid %08x (MPC)", (DWORD_PTR)this, GetCurrentProcessId());
- if(SUCCEEDED(hr = GetRunningObjectTable(0, &pROT))
+ if (SUCCEEDED(hr = GetRunningObjectTable(0, &pROT))
&& SUCCEEDED(hr = CreateItemMoniker(L"!", wsz, &pMoniker))) {
hr = pROT->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE, (IGraphBuilder2*)this, pMoniker, &m_dwRegister);
}
@@ -1208,12 +1215,12 @@ STDMETHODIMP CFGManager::RemoveFromROT()
HRESULT hr;
- if(!m_dwRegister) {
+ if (!m_dwRegister) {
return S_FALSE;
}
CComPtr<IRunningObjectTable> pROT;
- if(SUCCEEDED(hr = GetRunningObjectTable(0, &pROT))
+ if (SUCCEEDED(hr = GetRunningObjectTable(0, &pROT))
&& SUCCEEDED(hr = pROT->Revoke(m_dwRegister))) {
m_dwRegister = 0;
}
@@ -1234,7 +1241,7 @@ STDMETHODIMP CFGManager::GetDeadEnd(int iIndex, CAtlList<CStringW>& path, CAtlLi
{
CAutoLock cAutoLock(this);
- if(iIndex < 0 || iIndex >= m_deadends.GetCount()) {
+ if (iIndex < 0 || iIndex >= m_deadends.GetCount()) {
return E_FAIL;
}
@@ -1242,7 +1249,7 @@ STDMETHODIMP CFGManager::GetDeadEnd(int iIndex, CAtlList<CStringW>& path, CAtlLi
mts.RemoveAll();
POSITION pos = m_deadends[iIndex]->GetHeadPosition();
- while(pos) {
+ while (pos) {
const path_t& p = m_deadends[iIndex]->GetNext(pos);
CStringW str;
@@ -1275,7 +1282,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);
@@ -1283,7 +1290,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk)
#endif
#if INTERNAL_SOURCEFILTER_UDP
- // if(src[SRC_UDP])
+ // if (src[SRC_UDP])
{
pFGF = DNew CFGFilterInternal<CUDPReader>();
pFGF->m_protocols.AddTail(_T("udp"));
@@ -1292,7 +1299,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"));
@@ -1301,7 +1308,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
@@ -1315,7 +1322,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);
@@ -1323,7 +1330,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);
@@ -1331,7 +1338,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);
@@ -1339,7 +1346,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);
@@ -1347,7 +1354,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"));
@@ -1358,7 +1365,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"));
@@ -1367,7 +1374,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);
@@ -1375,7 +1382,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);
@@ -1383,7 +1390,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);
@@ -1394,7 +1401,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk)
// TODOX64 : fix DVSource internal filter
#ifndef _WIN64
__if_exists(CD2VSource) {
- if(src[SRC_D2V]) {
+ if (src[SRC_D2V]) {
pFGF = DNew CFGFilterInternal<CD2VSource>();
pFGF->m_chkbytes.AddTail(_T("0,18,,4456443241564950726F6A65637446696C65"));
pFGF->m_extensions.AddTail(_T(".d2v"));
@@ -1414,7 +1421,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);
@@ -1446,7 +1453,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"));
@@ -1461,7 +1468,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"));
@@ -1473,7 +1480,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"));
@@ -1481,7 +1488,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"));
@@ -1497,7 +1504,7 @@ 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 {
pFGF = DNew CFGFilterInternal<CMatroskaSplitterFilter>(L"Matroska Splitter (low merit)", MERIT64_DO_USE);
@@ -1508,7 +1515,7 @@ 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 {
pFGF = DNew CFGFilterInternal<CRealMediaSplitterFilter>(L"RealMedia Splitter (low merit)", MERIT64_DO_USE);
@@ -1519,7 +1526,7 @@ 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 {
pFGF = DNew CFGFilterInternal<CAviSplitterFilter>(L"Avi Splitter (low merit)", MERIT64_DO_USE);
@@ -1544,7 +1551,7 @@ 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 {
pFGF = DNew CFGFilterInternal<COggSplitterFilter>(L"Ogg Splitter (low merit)", MERIT64_DO_USE);
@@ -1572,7 +1579,7 @@ 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 {
pFGF = DNew CFGFilterInternal<CMpegSplitterFilter>(L"Mpeg Splitter (low merit)", MERIT64_DO_USE);
@@ -1603,7 +1610,7 @@ 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 {
pFGF = DNew CFGFilterInternal<CMpaSplitterFilter>(L"Mpa Splitter (low merit)", MERIT64_DO_USE);
@@ -1614,7 +1621,7 @@ 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 {
pFGF = DNew CFGFilterInternal<CDSMSplitterFilter>(L"DSM Splitter (low merit)", MERIT64_DO_USE);
@@ -1625,7 +1632,7 @@ 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 {
pFGF = DNew CFGFilterInternal<CMP4SplitterFilter>(L"MP4 Splitter (low merit)", MERIT64_DO_USE);
@@ -1636,7 +1643,7 @@ 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 {
pFGF = DNew CFGFilterInternal<CFLVSplitterFilter>(L"FLV Splitter (low merit)", MERIT64_DO_USE);
@@ -1708,6 +1715,8 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk)
pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_DOLBY_AC3);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_DOLBY_AC3);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_WAVE_DOLBY_AC3);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_DOLBY_TRUEHD);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_DOLBY_DDPLUS);
m_transform.AddTail(pFGF);
#endif
@@ -2254,7 +2263,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
@@ -2292,7 +2301,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk)
CString clsid = _T("{B38C58A0-1809-11D6-A458-EDAE78F1DF12}");
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\") + clsid + _T("\\InprocServer32"), KEY_READ)
+ 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) {
m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(clsid), MERIT64_DO_NOT_USE));
@@ -2308,8 +2317,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 || s.iDSVideoRendererType == VIDRNDT_DS_MADVR) {
+ 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 || s.iDSVideoRendererType == VIDRNDT_DS_MADVR) {
m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{9852A670-F845-491B-9BE6-EBD841B8A613}")), MERIT64_DO_NOT_USE));
}
}
@@ -2319,14 +2328,14 @@ 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")) {
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;
}
@@ -2339,13 +2348,13 @@ 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);
}
@@ -2386,20 +2395,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);
@@ -2424,14 +2433,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) {
+ 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) {
CFGFilterRegistry f(pMoniker);
m_vrmerit = max(m_vrmerit, f.GetMerit());
}
@@ -2440,14 +2449,14 @@ 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) {
+ 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) {
CFGFilterRegistry f(pMoniker);
m_armerit = max(m_armerit, f.GetMerit());
}
@@ -2464,7 +2473,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);
@@ -2475,7 +2484,7 @@ CFGManagerPlayer::CFGManagerPlayer(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd)
// Renderers
- switch(s.iDSVideoRendererType) {
+ switch (s.iDSVideoRendererType) {
case VIDRNDT_DS_OLDRENDERER:
m_transform.AddTail(DNew CFGFilterRegistry(CLSID_VideoRenderer, m_vrmerit));
break;
@@ -2522,19 +2531,19 @@ CFGManagerPlayer::CFGManagerPlayer(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd)
}
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);
@@ -2545,10 +2554,10 @@ 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;
}
}
@@ -2566,7 +2575,7 @@ 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));
}
@@ -2580,8 +2589,8 @@ class CResetDVD : public CDVDSession
{
public:
CResetDVD(LPCTSTR path) {
- if(Open(path)) {
- if(BeginSession()) {
+ if (Open(path)) {
+ if (BeginSession()) {
Authenticate(); /*GetDiscKey();*/
EndSession();
}
@@ -2597,7 +2606,7 @@ 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;
}
@@ -2620,7 +2629,7 @@ STDMETHODIMP CFGManagerDVD::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpc
GUID clsid = ext == L".ratdvd" ? GUIDFromCString(_T("{482d10b6-376e-4411-8a17-833800A065DB}")) : CLSID_DVDNavigator;
CComPtr<IBaseFilter> pBF;
- if(FAILED(hr = pBF.CoCreateInstance(clsid))
+ if (FAILED(hr = pBF.CoCreateInstance(clsid))
|| FAILED(hr = AddFilter(pBF, L"DVD Navigator"))) {
return VFW_E_CANNOT_LOAD_SOURCE_FILTER;
}
@@ -2628,13 +2637,13 @@ STDMETHODIMP CFGManagerDVD::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpc
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;
- if((!fn.IsEmpty()
+ if ((!fn.IsEmpty()
&& FAILED(hr = pDVDC->SetDVDDirectory(fn))
&& FAILED(hr = pDVDC->SetDVDDirectory(fn + L"VIDEO_TS"))
&& FAILED(hr = pDVDC->SetDVDDirectory(fn + L"\\VIDEO_TS")))
@@ -2645,7 +2654,7 @@ STDMETHODIMP CFGManagerDVD::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpc
pDVDC->SetOption(DVD_ResetOnStop, FALSE);
pDVDC->SetOption(DVD_HMSF_TimeCodeEvents, TRUE);
- if(clsid == CLSID_DVDNavigator) {
+ if (clsid == CLSID_DVDNavigator) {
CResetDVD(CString(buff));
}
diff --git a/src/apps/mplayerc/FGManagerBDA.cpp b/src/apps/mplayerc/FGManagerBDA.cpp
index 2d0ee5b81..a57746431 100644
--- a/src/apps/mplayerc/FGManagerBDA.cpp
+++ b/src/apps/mplayerc/FGManagerBDA.cpp
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -270,9 +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;
@@ -357,14 +357,14 @@ HRESULT CFGManagerBDA::SearchIBDATopology(const CComPtr<IBaseFilter>& pTuner, RE
-HRESULT CFGManagerBDA::ConnectFilters(IBaseFilter* pOutFiter, IBaseFilter* pInFilter)
+HRESULT CFGManagerBDA::ConnectFilters(IBaseFilter* pOutFilter, IBaseFilter* pInFilter)
{
HRESULT hr = VFW_E_CANNOT_CONNECT;
- BeginEnumPins(pOutFiter, pEP, pOutPin) {
- if(S_OK == IsPinDirection(pOutPin, PINDIR_OUTPUT)
+ BeginEnumPins(pOutFilter, pEP, pOutPin) {
+ if (S_OK == IsPinDirection(pOutPin, PINDIR_OUTPUT)
&& S_OK != IsPinConnected(pOutPin)) {
BeginEnumPins(pInFilter, pEP, pInPin) {
- if(S_OK == IsPinDirection(pInPin, PINDIR_INPUT)
+ if (S_OK == IsPinDirection(pInPin, PINDIR_INPUT)
&& S_OK != IsPinConnected(pInPin)) {
hr = this->ConnectDirect(pOutPin, pInPin, NULL);
@@ -406,26 +406,22 @@ 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))) {
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))) {
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))) {
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))) {
AfxMessageBox(_T("BDA Error: could not connect Tuner and Receiver."), MB_OK);
TRACE("BDA : Tuner <-> Receiver"" :0x%08x\n",hr);
@@ -435,13 +431,11 @@ 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))) {
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))) {
AfxMessageBox(_T("BDA Error: IBDA_SignalStatistics topology."), MB_OK);
TRACE("BDA : IBDA_SignalStatistics topology"" :0x%08x\n",hr);
@@ -449,14 +443,12 @@ STDMETHODIMP CFGManagerBDA::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayL
}
// Create Mpeg2 demux
- // 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))) {
AfxMessageBox(_T("BDA Error: could not connect Network <-> Tuner/Receiver."), MB_OK);
TRACE("BDA : Network <-> Tuner/Receiver"" :0x%08x\n",hr);
@@ -465,13 +457,11 @@ 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))) {
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))) {
AfxMessageBox(_T("BDA Error: IBDA_SignalStatistics topology."), MB_OK);
TRACE("BDA : IBDA_SignalStatistics topology"" :0x%08x\n",hr);
@@ -480,7 +470,6 @@ 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))) {
AfxMessageBox(_T("BDA Error: could not create Demux."), MB_OK);
TRACE("BDA : Microsoft demux creation"" :0x%08x\n",hr);
@@ -553,7 +542,7 @@ 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()) {
::SendMessage (hWnd, WM_TUNER_NEW_CHANNEL, 0, (LPARAM)(LPCTSTR)Channel.ToString());
@@ -641,46 +630,46 @@ STDMETHODIMP CFGManagerBDA::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFl
if (lIndex>=0 && lIndex < pChannel->GetAudioCount()) {
pCurrentStream = &m_DVBStreams[m_nCurAudioType];
pStreamInfo = pChannel->GetAudio(lIndex);
- if(pStreamInfo) {
+ if (pStreamInfo) {
pStream = &m_DVBStreams[pStreamInfo->Type];
}
- if(pdwGroup) {
+ 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) {
+ if (pStreamInfo) {
pStream = &m_DVBStreams[pStreamInfo->Type];
}
- if(pdwGroup) {
+ if (pdwGroup) {
*pdwGroup = 2; // Subtitle group
}
}
if (pStreamInfo && pStream && pCurrentStream) {
- if(ppmt) {
+ if (ppmt) {
*ppmt = CreateMediaType(pStream->GetMediaType());
}
- if(pdwFlags) {
+ if (pdwFlags) {
*pdwFlags = (pCurrentStream->GetMappedPID() == pStreamInfo->PID) ? AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE : 0;
}
- if(plcid) {
+ if (plcid) {
*plcid = pStreamInfo->GetLCID();
}
- if(ppObject) {
+ if (ppObject) {
*ppObject = NULL;
}
- if(ppUnk) {
+ if (ppUnk) {
*ppUnk = NULL;
}
- if(ppszName) {
+ if (ppszName) {
CStringW str;
str = StreamTypeToName(pStreamInfo->PesType);
*ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength()+1)*sizeof(WCHAR));
- if(*ppszName == NULL) {
+ if (*ppszName == NULL) {
return E_OUTOFMEMORY;
}
wcscpy_s(*ppszName, str.GetLength()+1, str);
@@ -738,13 +727,6 @@ HRESULT CFGManagerBDA::CreateMicrosoftDemux(IBaseFilter* pReceiver, CComPtr<IBas
CheckNoLog (pDemux->CreateOutputPin ((AM_MEDIA_TYPE*)Stream.GetMediaType(), Stream.GetName(), &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) {
CheckNoLog (Connect (pPin, NULL, true));
Stream.SetPin (pPin);
@@ -754,7 +736,9 @@ HRESULT CFGManagerBDA::CreateMicrosoftDemux(IBaseFilter* pReceiver, CComPtr<IBas
Stream.SetPin (pPin);
LOG (_T("Filter connected to Demux for media type %d."),nType);
}
-
+ if (nType == DVB_H264) {
+ m_pPin_h264 = pPin; // Demux h264 output pin
+ }
}
}
@@ -782,6 +766,18 @@ HRESULT CFGManagerBDA::SetChannelInternal (CDVBChannel* pChannel)
SwitchStream (m_nCurAudioType, pChannel->GetDefaultAudioType());
+ // Re-connection needed for H264 to allow different formats of H264 channels
+ // Makes possible switching between H264 channels of different resolutions
+ // and/or between interlaced and progressive.
+
+ if (m_nCurVideoType == DVB_H264) {
+ CComPtr<IPin> pInPin;
+ m_pPin_h264->ConnectedTo(&pInPin);
+ m_pPin_h264->Disconnect();
+ pInPin->Disconnect();
+ ConnectDirect(m_pPin_h264, pInPin, NULL);
+ }
+
CheckNoLog (SetFrequency (pChannel->GetFrequency()));
if (pChannel->GetVideoPID() != 0) {
CheckNoLog (m_DVBStreams[m_nCurVideoType].Map (pChannel->GetVideoPID()));
@@ -808,7 +804,7 @@ HRESULT CFGManagerBDA::SetChannelInternal (CDVBChannel* pChannel)
HRESULT CFGManagerBDA::SwitchStream (DVB_STREAM_TYPE& nOldType, DVB_STREAM_TYPE nNewType)
{
- if (nNewType != nOldType) {
+ if ((nNewType != nOldType) || (nNewType == DVB_H264)) {
CComPtr<IBaseFilter> pFGOld = m_DVBStreams[nOldType].GetFilter();
CComPtr<IBaseFilter> pFGNew = m_DVBStreams[nNewType].GetFilter();
CComPtr<IPin> pOldOut = GetFirstPin (pFGOld, PINDIR_OUTPUT);
@@ -821,7 +817,7 @@ HRESULT CFGManagerBDA::SwitchStream (DVB_STREAM_TYPE& nOldType, DVB_STREAM_TYPE
pOldOut->ConnectedTo(&pInPin);
Disconnect (pOldOut);
Disconnect (pInPin);
- Connect (pNewOut, pInPin, false);
+ ConnectDirect(pNewOut, pInPin, NULL);
nOldType = nNewType;
}
return S_OK;
diff --git a/src/apps/mplayerc/FGManagerBDA.h b/src/apps/mplayerc/FGManagerBDA.h
index 12804ffb3..ea4367506 100644
--- a/src/apps/mplayerc/FGManagerBDA.h
+++ b/src/apps/mplayerc/FGManagerBDA.h
@@ -155,6 +155,7 @@ private :
DVB_STREAM_TYPE m_nCurAudioType;
CString m_BDANetworkProvider;
bool m_fHideWindow;
+ CComPtr<IPin> m_pPin_h264;
HRESULT CreateKSFilter(IBaseFilter** ppBF, CLSID KSCategory, CStringW& DisplayName);
HRESULT ConnectFilters(IBaseFilter* pOutFiter, IBaseFilter* pInFilter);
@@ -196,7 +197,7 @@ static void LOG(LPCTSTR fmt, ...)
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 e44b2b34b..79499dd30 100644
--- a/src/apps/mplayerc/FakeFilterMapper2.cpp
+++ b/src/apps/mplayerc/FakeFilterMapper2.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -37,7 +37,7 @@ HRESULT (__stdcall * Real_CoCreateInstance)(CONST IID& a0,
DWORD a2,
CONST IID& a3,
LPVOID* a4)
-= CoCreateInstance;
+ = CoCreateInstance;
LONG (WINAPI * Real_RegCreateKeyExA)(HKEY a0,
LPCSTR a1,
@@ -48,7 +48,7 @@ LONG (WINAPI * Real_RegCreateKeyExA)(HKEY a0,
LPSECURITY_ATTRIBUTES a6,
PHKEY a7,
LPDWORD a8)
-= RegCreateKeyExA;
+ = RegCreateKeyExA;
LONG (WINAPI * Real_RegCreateKeyExW)(HKEY a0,
LPCWSTR a1,
@@ -59,24 +59,24 @@ LONG (WINAPI * Real_RegCreateKeyExW)(HKEY a0,
LPSECURITY_ATTRIBUTES a6,
PHKEY a7,
LPDWORD a8)
-= RegCreateKeyExW;
+ = RegCreateKeyExW;
LONG (WINAPI * Real_RegDeleteKeyA)(HKEY a0,
LPCSTR a1)
-= RegDeleteKeyA;
+ = RegDeleteKeyA;
LONG (WINAPI * Real_RegDeleteKeyW)(HKEY a0,
LPCWSTR a1)
-= RegDeleteKeyW;
+ = RegDeleteKeyW;
LONG (WINAPI * Real_RegDeleteValueA)(HKEY a0,
LPCSTR a1)
-= RegDeleteValueA;
+ = RegDeleteValueA;
LONG (WINAPI * Real_RegDeleteValueW)(HKEY a0,
LPCWSTR a1)
-= RegDeleteValueW;
+ = RegDeleteValueW;
LONG (WINAPI * Real_RegEnumKeyExA)(HKEY a0,
DWORD a1,
@@ -86,7 +86,7 @@ LONG (WINAPI * Real_RegEnumKeyExA)(HKEY a0,
LPSTR a5,
LPDWORD a6,
struct _FILETIME* a7)
-= RegEnumKeyExA;
+ = RegEnumKeyExA;
LONG (WINAPI * Real_RegEnumKeyExW)(HKEY a0,
DWORD a1,
@@ -96,7 +96,7 @@ LONG (WINAPI * Real_RegEnumKeyExW)(HKEY a0,
LPWSTR a5,
LPDWORD a6,
struct _FILETIME* a7)
-= RegEnumKeyExW;
+ = RegEnumKeyExW;
LONG (WINAPI * Real_RegEnumValueA)(HKEY a0,
DWORD a1,
@@ -106,7 +106,7 @@ LONG (WINAPI * Real_RegEnumValueA)(HKEY a0,
LPDWORD a5,
LPBYTE a6,
LPDWORD a7)
-= RegEnumValueA;
+ = RegEnumValueA;
LONG (WINAPI * Real_RegEnumValueW)(HKEY a0,
DWORD a1,
@@ -116,21 +116,21 @@ LONG (WINAPI * Real_RegEnumValueW)(HKEY a0,
LPDWORD a5,
LPBYTE a6,
LPDWORD a7)
-= RegEnumValueW;
+ = RegEnumValueW;
LONG (WINAPI * Real_RegOpenKeyExA)(HKEY a0,
LPCSTR a1,
DWORD a2,
REGSAM a3,
PHKEY a4)
-= RegOpenKeyExA;
+ = RegOpenKeyExA;
LONG (WINAPI * Real_RegOpenKeyExW)(HKEY a0,
LPCWSTR a1,
DWORD a2,
REGSAM a3,
PHKEY a4)
-= RegOpenKeyExW;
+ = RegOpenKeyExW;
LONG (WINAPI * Real_RegQueryInfoKeyA)(HKEY a0,
LPSTR a1,
@@ -144,7 +144,7 @@ LONG (WINAPI * Real_RegQueryInfoKeyA)(HKEY a0,
LPDWORD a9,
LPDWORD a10,
struct _FILETIME* a11)
-= RegQueryInfoKeyA;
+ = RegQueryInfoKeyA;
LONG (WINAPI * Real_RegQueryInfoKeyW)(HKEY a0,
LPWSTR a1,
@@ -158,7 +158,7 @@ LONG (WINAPI * Real_RegQueryInfoKeyW)(HKEY a0,
LPDWORD a9,
LPDWORD a10,
struct _FILETIME* a11)
-= RegQueryInfoKeyW;
+ = RegQueryInfoKeyW;
LONG (WINAPI * Real_RegQueryValueExA)(HKEY a0,
LPCSTR a1,
@@ -166,7 +166,7 @@ LONG (WINAPI * Real_RegQueryValueExA)(HKEY a0,
LPDWORD a3,
LPBYTE a4,
LPDWORD a5)
-= RegQueryValueExA;
+ = RegQueryValueExA;
LONG (WINAPI * Real_RegQueryValueExW)(HKEY a0,
LPCWSTR a1,
@@ -174,7 +174,7 @@ LONG (WINAPI * Real_RegQueryValueExW)(HKEY a0,
LPDWORD a3,
LPBYTE a4,
LPDWORD a5)
-= RegQueryValueExW;
+ = RegQueryValueExW;
LONG (WINAPI * Real_RegSetValueExA)(HKEY a0,
LPCSTR a1,
@@ -182,7 +182,7 @@ LONG (WINAPI * Real_RegSetValueExA)(HKEY a0,
DWORD a3,
const BYTE* a4,
DWORD a5)
-= RegSetValueExA;
+ = RegSetValueExA;
LONG (WINAPI * Real_RegSetValueExW)(HKEY a0,
LPCWSTR a1,
@@ -190,62 +190,62 @@ LONG (WINAPI * Real_RegSetValueExW)(HKEY a0,
DWORD a3,
const BYTE* a4,
DWORD a5)
-= RegSetValueExW;
+ = RegSetValueExW;
LONG (WINAPI * Real_RegCloseKey)(HKEY a0)
-= RegCloseKey;
+ = RegCloseKey;
LONG (WINAPI * Real_RegFlushKey)(HKEY a0)
-= RegFlushKey;
+ = RegFlushKey;
LONG (WINAPI * Real_RegCreateKeyA)(HKEY a0, LPCSTR a1, PHKEY a2)
-= RegCreateKeyA;
+ = RegCreateKeyA;
LONG (WINAPI * Real_RegCreateKeyW)(HKEY a0, LPCWSTR a1, PHKEY a2)
-= RegCreateKeyW;
+ = RegCreateKeyW;
LONG (WINAPI * Real_RegOpenKeyA)(HKEY a0, LPCSTR a1, PHKEY a2)
-= RegOpenKeyA;
+ = RegOpenKeyA;
LONG (WINAPI * Real_RegOpenKeyW)(HKEY a0, LPCWSTR a1, PHKEY a2)
-= RegOpenKeyW;
+ = RegOpenKeyW;
LONG (WINAPI * Real_RegQueryValueA)(HKEY a0, LPCSTR a1, LPSTR a2, PLONG a3)
-= RegQueryValueA;
+ = RegQueryValueA;
LONG (WINAPI * Real_RegQueryValueW)(HKEY a0, LPCWSTR a1, LPWSTR a2, PLONG a3)
-= RegQueryValueW;
+ = RegQueryValueW;
LONG (WINAPI * Real_RegSetValueW)(HKEY a0, LPCWSTR a1, DWORD a2, LPCWSTR a3, DWORD a4)
-= RegSetValueW;
+ = RegSetValueW;
LONG (WINAPI * Real_RegSetValueA)(HKEY a0, LPCSTR a1, DWORD a2, LPCSTR a3, DWORD a4)
-= RegSetValueA;
+ = RegSetValueA;
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) {
+ 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;
@@ -256,7 +256,7 @@ HRESULT WINAPI Mine_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter,
}
/* else
{
- if(rclsid == CLSID_FilterMapper2)
+ if (rclsid == CLSID_FilterMapper2)
{
CFilterMapper2* pFM2 = DNew CFilterMapper2(true, false, pUnkOuter);
CComPtr<IUnknown> pUnk = (IUnknown*)pFM2;
@@ -264,15 +264,15 @@ HRESULT WINAPI Mine_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter,
}
}
*/
- if(!pUnkOuter)
- if(rclsid == CLSID_VideoMixingRenderer || rclsid == CLSID_VideoMixingRenderer9
+ 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?)
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);
}
@@ -285,21 +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;
}
@@ -307,7 +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;
}
@@ -315,7 +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;
}
@@ -323,7 +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;
}
@@ -331,63 +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;
}
@@ -395,7 +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;
}
@@ -403,7 +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;
}
@@ -411,7 +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;
}
@@ -419,21 +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;
}
@@ -441,7 +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;
}
@@ -449,7 +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;
}
@@ -457,7 +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;
}
@@ -465,28 +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);
@@ -502,7 +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);
@@ -548,7 +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;
}
@@ -557,14 +557,14 @@ CFilterMapper2::CFilterMapper2(bool fRefCounted, bool fAllowUnreg, LPUNKNOWN pUn
CFilterMapper2::~CFilterMapper2()
{
POSITION pos = m_filters.GetHeadPosition();
- while(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);
}
@@ -577,15 +577,10 @@ STDMETHODIMP CFilterMapper2::NonDelegatingQueryInterface(REFIID riid, void** ppv
void CFilterMapper2::Register(CString path)
{
- // Add Filters directory into dll path, in case it needs some dlls from there..
- TCHAR buffer[512] = TEXT("");
- _tcscpy(buffer, path);
- PathRemoveFileSpec(buffer);
- SetDllDirectory(buffer);
// Load filter
- if(HMODULE h = LoadLibrary(path)) {
+ if (HMODULE h = LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_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;
@@ -603,9 +598,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);
}
@@ -614,9 +609,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;
@@ -627,8 +622,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;
@@ -637,30 +632,30 @@ 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) {
+ if (rgPin.bOutput) {
continue;
}
- for(UINT i = 0; i < rgPin.nMediaTypes; i++) {
- if(!rgPin.lpMediaType[i].clsMajorType || !rgPin.lpMediaType[i].clsMinorType) {
+ 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&REG_PINFLAG_B_OUTPUT) {
+ if (rgPin.dwFlags&REG_PINFLAG_B_OUTPUT) {
continue;
}
- for(UINT i = 0; i < rgPin.nMediaTypes; i++) {
- if(!rgPin.lpMediaType[i].clsMajorType || !rgPin.lpMediaType[i].clsMinorType) {
+ 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);
@@ -675,7 +670,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);
}
@@ -686,7 +681,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/FavoriteOrganizeDlg.cpp b/src/apps/mplayerc/FavoriteOrganizeDlg.cpp
index ca83c1315..a9441f599 100644
--- a/src/apps/mplayerc/FavoriteOrganizeDlg.cpp
+++ b/src/apps/mplayerc/FavoriteOrganizeDlg.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -42,10 +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));
@@ -58,11 +58,11 @@ void CFavoriteOrganizeDlg::SetupList(bool fSave)
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) {
+ if (i >= 0) {
s = s.Left(i);
}
m_list.SetItemData(m_list.InsertItem(m_list.GetItemCount(), s), (DWORD_PTR)tmp);
@@ -145,7 +145,7 @@ void CFavoriteOrganizeDlg::OnTcnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
void CFavoriteOrganizeDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
- if(nIDCtl != IDC_LIST2) {
+ if (nIDCtl != IDC_LIST2) {
return;
}
@@ -154,7 +154,7 @@ void CFavoriteOrganizeDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStr
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 {
@@ -171,7 +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));
}
@@ -180,7 +180,7 @@ 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;
@@ -188,9 +188,9 @@ void CFavoriteOrganizeDlg::OnLvnEndlabeleditList2(NMHDR* pNMHDR, LRESULT* pResul
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()) {
+ if (nItem < 0 || nItem >= m_list.GetItemCount()) {
return;
}
@@ -205,9 +205,9 @@ 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) {
+ if (nItem <= 0) {
return;
}
@@ -227,9 +227,9 @@ 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) {
+ if (nItem < 0 || nItem >= m_list.GetItemCount()-1) {
return;
}
@@ -269,7 +269,7 @@ 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);
}
}
@@ -278,7 +278,7 @@ 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/FileDropTarget.cpp b/src/apps/mplayerc/FileDropTarget.cpp
index 0dacf127f..998233003 100644
--- a/src/apps/mplayerc/FileDropTarget.cpp
+++ b/src/apps/mplayerc/FileDropTarget.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -61,7 +61,7 @@ DROPEFFECT CFileDropTarget::OnDropEx(CWnd* pWnd, COleDataObject* pDataObject, DR
void CFileDropTarget::OnDragLeave(CWnd* pWnd)
{
- if(m_pDropTarget) {
+ if (m_pDropTarget) {
m_pDropTarget->OnDragLeave();
}
}
diff --git a/src/apps/mplayerc/FloatEdit.cpp b/src/apps/mplayerc/FloatEdit.cpp
index b3dbedddc..0aafb69c7 100644
--- a/src/apps/mplayerc/FloatEdit.cpp
+++ b/src/apps/mplayerc/FloatEdit.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -58,21 +58,21 @@ 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;
}
@@ -89,25 +89,25 @@ 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;
}
@@ -147,7 +147,7 @@ END_MESSAGE_MAP()
void CHexEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
- if(!(nChar >= 'A' && nChar <= 'F' || nChar >= 'a' && nChar <= 'f'
+ if (!(nChar >= 'A' && nChar <= 'F' || nChar >= 'a' && nChar <= 'f'
|| nChar >= '0' && nChar <= '9' || nChar == '\b')) {
return;
}
@@ -158,11 +158,11 @@ 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;
}
diff --git a/src/apps/mplayerc/FullscreenWnd.cpp b/src/apps/mplayerc/FullscreenWnd.cpp
index 7127a4924..e31a8ffdb 100644
--- a/src/apps/mplayerc/FullscreenWnd.cpp
+++ b/src/apps/mplayerc/FullscreenWnd.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -93,7 +93,7 @@ BOOL CFullscreenWnd::PreTranslateMessage(MSG* pMsg)
BOOL CFullscreenWnd::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CWnd::PreCreateWindow(cs)) {
+ if (!CWnd::PreCreateWindow(cs)) {
return FALSE;
}
diff --git a/src/apps/mplayerc/GoToDlg.cpp b/src/apps/mplayerc/GoToDlg.cpp
index 169f2cc08..4d898c579 100644
--- a/src/apps/mplayerc/GoToDlg.cpp
+++ b/src/apps/mplayerc/GoToDlg.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -38,9 +38,9 @@ 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) {
+ if (_stscanf_s(str, _T("%f"), &m_fps) != 1) {
m_fps = 0;
}
}
@@ -63,17 +63,17 @@ 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)) {
+ switch (AfxGetApp()->GetProfileInt(IDS_R_SETTINGS, _T("gotoluf"), 0)) {
default:
case 0:
m_timeedit.SetFocus();
@@ -112,17 +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;
}
@@ -154,11 +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;
@@ -166,7 +166,7 @@ void CGoToDlg::OnBnClickedOk2()
frame = _tcstol(szStart, (TCHAR**)&szStart, 10);
mc.GetMatch(1, &szStart, &szEnd);
- if(_stscanf_s(szStart, _T("%f"), &fps) != 1) {
+ if (_stscanf_s(szStart, _T("%f"), &fps) != 1) {
fps = 0;
} else {
AfxGetApp()->WriteProfileString(IDS_R_SETTINGS, _T("fps"), szStart);
@@ -176,7 +176,7 @@ void CGoToDlg::OnBnClickedOk2()
return;
}
- if(fps == 0) {
+ if (fps == 0) {
AfxMessageBox(_T("Error parsing entered frame rate!"));
return;
}
@@ -191,10 +191,10 @@ void CGoToDlg::OnBnClickedOk2()
BOOL CGoToDlg::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) {
- if(*GetFocus() == m_timeedit) {
+ if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) {
+ if (*GetFocus() == m_timeedit) {
OnBnClickedOk1();
- } else if(*GetFocus() == m_frameedit) {
+ } else if (*GetFocus() == m_frameedit) {
OnBnClickedOk2();
}
diff --git a/src/apps/mplayerc/ISDb.cpp b/src/apps/mplayerc/ISDb.cpp
index f05aa1d8d..c4f21b5ae 100644
--- a/src/apps/mplayerc/ISDb.cpp
+++ b/src/apps/mplayerc/ISDb.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -30,7 +30,7 @@ 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;
}
@@ -41,11 +41,11 @@ 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++) {
;
}
@@ -57,14 +57,14 @@ 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;
}
@@ -80,7 +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;
@@ -103,7 +103,7 @@ bool OpenUrl(CInternetSession& is, CString url, CStringA& str)
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)) {
;
}
diff --git a/src/apps/mplayerc/ISDb.h b/src/apps/mplayerc/ISDb.h
index 3173380bc..9fe50988f 100644
--- a/src/apps/mplayerc/ISDb.h
+++ b/src/apps/mplayerc/ISDb.h
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -50,7 +50,7 @@ struct isdb_movie {
subs.RemoveAll();
}
isdb_movie& operator = (const struct isdb_movie& m) {
- if(this != &m) {
+ if (this != &m) {
titles.RemoveAll();
titles.AddTailList(&m.titles);
subs.RemoveAll();
diff --git a/src/apps/mplayerc/KeyProvider.cpp b/src/apps/mplayerc/KeyProvider.cpp
index 36b38b3df..f1556a7e3 100644
--- a/src/apps/mplayerc/KeyProvider.cpp
+++ b/src/apps/mplayerc/KeyProvider.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -41,11 +41,11 @@ STDMETHODIMP CKeyProvider::NonDelegatingQueryInterface(REFIID riid, void** ppv)
STDMETHODIMP CKeyProvider::QueryService(REFIID siid, REFIID riid, void **ppv)
{
/*
- if(siid == __uuidof(IWMReader) && riid == IID_IUnknown)
+ if (siid == __uuidof(IWMReader) && riid == IID_IUnknown)
{
CComPtr<IUnknown> punkCert;
HRESULT hr = WMCreateCertificate(&punkCert);
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
*ppv = (void*)punkCert.Detach();
return hr;
}
diff --git a/src/apps/mplayerc/LcdSupport.cpp b/src/apps/mplayerc/LcdSupport.cpp
index b67d1cb83..81974d819 100644
--- a/src/apps/mplayerc/LcdSupport.cpp
+++ b/src/apps/mplayerc/LcdSupport.cpp
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -157,7 +157,7 @@ HRESULT CLCDMyManager::Initialize()
void CLCDMyManager::OnLCDButtonUp(int nButton)
{
- switch(nButton) {
+ switch (nButton) {
case LGLCDBUTTON_BUTTON0: {
/* LOGFONT lf;
HFONT hFont = m_Text1.GetFont();
diff --git a/src/apps/mplayerc/MainFrm.cpp b/src/apps/mplayerc/MainFrm.cpp
index 3a48cee83..2c105785d 100644
--- a/src/apps/mplayerc/MainFrm.cpp
+++ b/src/apps/mplayerc/MainFrm.cpp
@@ -131,22 +131,22 @@ public:
OAFilterState __fs = GetMediaState(); \
\
REFERENCE_TIME __rt = 0; \
- if(m_iMediaLoadState == MLS_LOADED) __rt = GetPos(); \
+ if (m_iMediaLoadState == MLS_LOADED) __rt = GetPos(); \
\
- if(__fs != State_Stopped) \
+ if (__fs != State_Stopped) \
SendMessage(WM_COMMAND, ID_PLAY_STOP); \
#define RestoreMediaState \
- if(m_iMediaLoadState == MLS_LOADED) \
+ if (m_iMediaLoadState == MLS_LOADED) \
{ \
SeekTo(__rt); \
\
- if(__fs == State_Stopped) \
+ if (__fs == State_Stopped) \
SendMessage(WM_COMMAND, ID_PLAY_STOP); \
- else if(__fs == State_Paused) \
+ else if (__fs == State_Paused) \
SendMessage(WM_COMMAND, ID_PLAY_PAUSE); \
- else if(__fs == State_Running) \
+ else if (__fs == State_Running) \
SendMessage(WM_COMMAND, ID_PLAY_PLAY); \
} \
@@ -416,10 +416,10 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_COMMAND(ID_VIEW_VSYNCOFFSET_INCREASE, OnViewVSyncOffsetIncrease)
ON_COMMAND(ID_VIEW_VSYNCOFFSET_DECREASE, OnViewVSyncOffsetDecrease)
- ON_UPDATE_COMMAND_UI(ID_SHADER_TOGGLE, OnUpdateShaderToggle)
- ON_COMMAND(ID_SHADER_TOGGLE, OnShaderToggle)
- ON_UPDATE_COMMAND_UI(ID_SHADER_TOGGLESCREENSPACE, OnUpdateShaderToggleScreenSpace)
- ON_COMMAND(ID_SHADER_TOGGLESCREENSPACE, OnShaderToggleScreenSpace)
+ ON_UPDATE_COMMAND_UI(ID_SHADERS_TOGGLE, OnUpdateShaderToggle)
+ ON_COMMAND(ID_SHADERS_TOGGLE, OnShaderToggle)
+ ON_UPDATE_COMMAND_UI(ID_SHADERS_TOGGLE_SCREENSPACE, OnUpdateShaderToggleScreenSpace)
+ ON_COMMAND(ID_SHADERS_TOGGLE_SCREENSPACE, OnShaderToggleScreenSpace)
ON_UPDATE_COMMAND_UI(ID_VIEW_REMAINING_TIME, OnUpdateViewRemainingTime)
ON_COMMAND(ID_VIEW_REMAINING_TIME, OnViewRemainingTime)
ON_COMMAND(ID_D3DFULLSCREEN_TOGGLE, OnD3DFullscreenToggle)
@@ -514,13 +514,15 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
// Navigation pannel
ON_COMMAND(ID_VIEW_NAVIGATION, OnViewNavigation)
ON_UPDATE_COMMAND_UI(ID_VIEW_NAVIGATION, OnUpdateViewNavigation)
+
+ ON_WM_WTSSESSION_CHANGE()
END_MESSAGE_MAP()
#ifdef _DEBUG
const TCHAR *GetEventString(LONG evCode)
{
#define UNPACK_VALUE(VALUE) case VALUE: return _T( #VALUE );
- switch(evCode) {
+ switch (evCode) {
UNPACK_VALUE(EC_COMPLETE);
UNPACK_VALUE(EC_USERABORT);
UNPACK_VALUE(EC_ERRORABORT);
@@ -601,6 +603,7 @@ CMainFrame::CMainFrame() :
m_iMediaLoadState(MLS_CLOSED),
m_iPlaybackMode(PM_NONE),
m_iSpeedLevel(0),
+ m_dSpeedRate(1.0),
m_rtDurationOverride(-1),
m_fFullScreen(false),
m_fFirstFSAfterLaunchOnFS(false),
@@ -649,18 +652,16 @@ CMainFrame::~CMainFrame()
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);
- GetMenu()->ModifyMenu(ID_FAVORITES, MF_BYCOMMAND|MF_STRING, IDR_MAINFRAME, ResStr(IDS_FAVORITES_POPUP));
-
// 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)) {
+ if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
+ CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL)) {
TRACE0("Failed to create view window\n");
return -1;
}
@@ -668,19 +669,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
}
@@ -751,14 +752,14 @@ 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);
}
}
@@ -803,11 +804,15 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
SendAPICommand (CMD_CONNECT, L"%d", GetSafeHwnd());
+ WTSRegisterSessionNotification();
+
return 0;
}
void CMainFrame::OnDestroy()
{
+ WTSUnRegisterSessionNotification();
+
ShowTrayIcon( false );
m_fileDropTarget.Revoke();
@@ -815,7 +820,7 @@ void CMainFrame::OnDestroy()
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 );
}
@@ -840,7 +845,7 @@ void CMainFrame::OnClose()
CString strList = "";
pos = m_shaderlabels.GetHeadPosition();
- while(pos) {
+ while (pos) {
strList += m_shaderlabels.GetAt (pos) + "|";
m_dockingbars.GetNext(pos);
}
@@ -851,7 +856,7 @@ void CMainFrame::OnClose()
CString strList = "";
pos = m_shaderlabelsScreenSpace.GetHeadPosition();
- while(pos) {
+ while (pos) {
strList += m_shaderlabelsScreenSpace.GetAt (pos) + "|";
m_dockingbars.GetNext(pos);
}
@@ -889,11 +894,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();
@@ -901,7 +906,7 @@ 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 {
m_wndPlaylistBar.Open(sl, true);
@@ -935,8 +940,8 @@ 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();
}
}
@@ -945,13 +950,13 @@ LPCTSTR CMainFrame::GetRecentFile()
void CMainFrame::LoadControlBar(CControlBar* pBar, UINT defDockBarID)
{
- if(!pBar) {
+ if (!pBar) {
return;
}
CString str;
pBar->GetWindowText(str);
- if(str.IsEmpty()) {
+ if (str.IsEmpty()) {
return;
}
CString section = _T("ToolBars\\") + str;
@@ -960,7 +965,7 @@ void CMainFrame::LoadControlBar(CControlBar* pBar, UINT defDockBarID)
UINT nID = pApp->GetProfileInt(section, _T("DockState"), defDockBarID);
- if(nID != AFX_IDW_DOCKBAR_FLOAT) {
+ if (nID != AFX_IDW_DOCKBAR_FLOAT) {
DockControlBar(pBar, nID);
}
@@ -974,7 +979,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);
}
@@ -988,34 +993,34 @@ 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()) {
+ 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) {
+ if (p.x < m_rcDesktop.left) {
p.x = m_rcDesktop.left;
}
- if(p.y < m_rcDesktop.top) {
+ if (p.y < m_rcDesktop.top) {
p.y = m_rcDesktop.top;
}
- if(p.x >= m_rcDesktop.right) {
+ if (p.x >= m_rcDesktop.right) {
p.x = m_rcDesktop.right-1;
}
- if(p.y >= m_rcDesktop.bottom) {
+ if (p.y >= m_rcDesktop.bottom) {
p.y = m_rcDesktop.bottom-1;
}
FloatControlBar(pBar, p);
@@ -1028,25 +1033,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()) {
+ 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);
@@ -1067,11 +1072,11 @@ 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) {
+ switch ((UINT)lParam) {
case WM_LBUTTONDOWN:
ShowWindow(SW_SHOW);
MoveVideoWindow();
@@ -1120,8 +1125,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,14 +1136,14 @@ void CMainFrame::ShowTrayIcon(bool fShow)
m_fTrayIcon = true;
}
} else {
- if(m_fTrayIcon) {
+ if (m_fTrayIcon) {
Shell_NotifyIcon(NIM_DELETE, &tnid);
m_fTrayIcon = false;
}
}
- if(bWasVisible) {
+ if (bWasVisible) {
ShowWindow(SW_SHOW);
}
}
@@ -1156,7 +1161,7 @@ void CMainFrame::SetTrayTip(CString str)
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!__super::PreCreateWindow(cs)) {
+ if (!__super::PreCreateWindow(cs)) {
return FALSE;
}
@@ -1169,29 +1174,29 @@ BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN) {
- /* if(m_fShockwaveGraph
+ 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 = !assignedToCmd(VK_ESCAPE, 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(IsCaptionHidden()) {
+ } else if (IsCaptionHidden()) {
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;
}
@@ -1204,6 +1209,8 @@ void CMainFrame::RecalcLayout(BOOL bNotify)
{
__super::RecalcLayout(bNotify);
+ m_wndSeekBar.HideToolTip();
+
CRect r;
GetWindowRect(&r);
MINMAXINFO mmi;
@@ -1236,7 +1243,7 @@ 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();
}
}
@@ -1244,20 +1251,20 @@ void CMainFrame::OnSetFocus(CWnd* pOldWnd)
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;
}
}
@@ -1286,14 +1293,15 @@ void CMainFrame::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
}
}
if ( IsWindow(m_wndToolBar.m_hWnd) && m_wndToolBar.IsVisible() ) {
- lpMMI->ptMinTrackSize.x = max( m_wndToolBar.GetMinWidth(), lpMMI->ptMinTrackSize.x );
+ lpMMI->ptMinTrackSize.x = max( m_wndToolBar.GetMinWidth(), lpMMI->ptMinTrackSize.x );
}
-
+
lpMMI->ptMinTrackSize.y = 0;
if ( style & WS_CAPTION ) {
lpMMI->ptMinTrackSize.y += GetSystemMetrics( SM_CYCAPTION );
- if(s.iCaptionMenuMode == MODE_SHOWCAPTIONMENU)
- lpMMI->ptMinTrackSize.y += GetSystemMetrics( SM_CYMENU ); //(mbi.rcBar.bottom - mbi.rcBar.top);
+ if (s.iCaptionMenuMode == MODE_SHOWCAPTIONMENU) {
+ lpMMI->ptMinTrackSize.y += GetSystemMetrics( SM_CYMENU ); //(mbi.rcBar.bottom - mbi.rcBar.top);
+ }
//else MODE_HIDEMENU
}
@@ -1318,7 +1326,9 @@ void CMainFrame::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
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 (lpMMI->ptMinTrackSize.y<16) lpMMI->ptMinTrackSize.y = 16;
+ if (lpMMI->ptMinTrackSize.y<16) {
+ lpMMI->ptMinTrackSize.y = 16;
+ }
__super::OnGetMinMaxInfo( lpMMI );
}
@@ -1332,7 +1342,7 @@ 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);
}
}
@@ -1341,7 +1351,7 @@ 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;
@@ -1351,19 +1361,19 @@ 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;
}
}
@@ -1375,13 +1385,13 @@ 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;
@@ -1396,7 +1406,7 @@ void CMainFrame::OnSizing(UINT fwSide, LPRECT pRect)
bool fCtrl = !!(GetAsyncKeyState(VK_CONTROL)&0x80000000);
- if(m_iMediaLoadState != MLS_LOADED || m_fFullScreen
+ if (m_iMediaLoadState != MLS_LOADED || m_fFullScreen
|| s.iDefaultVideoSize == DVS_STRETCH
|| (fCtrl == s.fLimitWindowProportions)) { // remember that fCtrl is initialized with !!whatever(), same with fLimitWindowProportions
return;
@@ -1406,7 +1416,7 @@ void CMainFrame::OnSizing(UINT fwSide, LPRECT pRect)
CSize vsize = GetVideoSize();
CSize fsize(0, 0);
- if(!vsize.cx || !vsize.cy) {
+ if (!vsize.cx || !vsize.cy) {
return;
}
@@ -1426,8 +1436,9 @@ void CMainFrame::OnSizing(UINT fwSide, LPRECT pRect)
if ( style & WS_CAPTION ) {
fsize.cy += GetSystemMetrics( SM_CYCAPTION );
- if(s.iCaptionMenuMode == MODE_SHOWCAPTIONMENU)
- fsize.cy += GetSystemMetrics( SM_CYMENU ); //mbi.rcBar.bottom - mbi.rcBar.top;
+ if (s.iCaptionMenuMode == MODE_SHOWCAPTIONMENU) {
+ fsize.cy += GetSystemMetrics( SM_CYMENU ); //mbi.rcBar.bottom - mbi.rcBar.top;
+ }
//else MODE_HIDEMENU
}
if ( style & WS_THICKFRAME ) {
@@ -1466,13 +1477,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;
}
}
@@ -1481,7 +1492,7 @@ void CMainFrame::OnDisplayChange() // untested, not sure if it's working...
{
TRACE(_T("*** CMainFrame::OnDisplayChange()\n"));
/*
- if(m_iMediaLoadState == MLS_LOADED && m_pCAP)
+ if (m_iMediaLoadState == MLS_LOADED && m_pCAP)
m_pCAP->OnDisplayChange();
*/
@@ -1504,9 +1515,9 @@ void CMainFrame::OnDisplayChange() // untested, not sure if it's working...
MoveVideoWindow();
}
}
-
- if(m_iMediaLoadState == MLS_LOADED) {
- if(m_pGraphThread) {
+
+ if (m_iMediaLoadState == MLS_LOADED) {
+ if (m_pGraphThread) {
m_pGraphThread->PostThreadMessage(CGraphThread::TM_DISPLAY_CHANGE, 0, 0);
} else {
DisplayChange();
@@ -1522,7 +1533,7 @@ void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
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;
}
@@ -1534,21 +1545,22 @@ void CMainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID)
{
__super::OnActivateApp(bActive, dwThreadID);
- if(AfxGetAppSettings().iOnTop)
+ if (AfxGetAppSettings().iOnTop) {
return;
+ }
MONITORINFO mi;
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))) {
+ if (hMonitor1 && hMonitor2 && ((hMonitor1 != hMonitor2) || (monitors.GetCount()>1))) {
fExitFullscreen = false;
}
@@ -1557,17 +1569,17 @@ void CMainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID)
CString module;
- if(GetVersion()&0x80000000) {
+ if (GetVersion()&0x80000000) {
module.ReleaseBufferSetLength(GetWindowModuleFileName(pWnd->m_hWnd, module.GetBuffer(_MAX_PATH), _MAX_PATH));
} 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));
}
@@ -1585,7 +1597,7 @@ void CMainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID)
SendStatusMessage(str, 5000);
}
- if(fExitFullscreen) {
+ if (fExitFullscreen) {
OnViewFullscreen();
}
}
@@ -1596,7 +1608,7 @@ LRESULT CMainFrame::OnAppCommand(WPARAM wParam, LPARAM lParam)
UINT cmd = GET_APPCOMMAND_LPARAM(lParam);
UINT uDevice = GET_DEVICE_LPARAM(lParam);
- if(uDevice != FAPPCOMMAND_OEM ||
+ 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 ) {
@@ -1605,14 +1617,14 @@ LRESULT CMainFrame::OnAppCommand(WPARAM wParam, LPARAM lParam)
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) {
+ if (fRet) {
return TRUE;
}
}
@@ -1649,9 +1661,9 @@ void CMainFrame::OnRawInput(UINT nInputcode, HRAWINPUT hRawInput)
case MCE_MEDIA_NEXTTRACK :
case MCE_MEDIA_PREVIOUSTRACK :
POSITION pos = s.wmcmds.GetHeadPosition();
- while(pos) {
+ while (pos) {
wmcmd& wc = s.wmcmds.GetNext(pos);
- if(wc.appcmd == nMceCmd) {
+ if (wc.appcmd == nMceCmd) {
SendMessage(WM_COMMAND, wc.cmd);
break;
}
@@ -1668,7 +1680,7 @@ LRESULT CMainFrame::OnHotKey(WPARAM wParam, LPARAM lParam)
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)) {
fRet = TRUE;
@@ -1686,10 +1698,10 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
{
switch (nIDEvent) {
case TIMER_STREAMPOSPOLLER:
- if(m_iMediaLoadState == MLS_LOADED) {
+ if (m_iMediaLoadState == MLS_LOADED) {
REFERENCE_TIME rtNow = 0, rtDur = 0;
- if(GetPlaybackMode() == PM_FILE) {
+ if (GetPlaybackMode() == PM_FILE) {
pMS->GetCurrentPosition(&rtNow);
pMS->GetDuration(&rtDur);
@@ -1706,7 +1718,7 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
m_lSubtitleShift = 0;
}
- if(!m_fEndOfStream) {
+ if (!m_fEndOfStream) {
AppSettings& s = AfxGetAppSettings();
FILE_POSITION* FilePosition = s.CurrentFilePosition();
if (FilePosition) {
@@ -1716,7 +1728,7 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
QueryPerformanceCounter(&time);
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
- if((time.QuadPart - m_LastSaveTime.QuadPart) >= 30 * freq.QuadPart) { // save every half of minute
+ if ((time.QuadPart - m_LastSaveTime.QuadPart) >= 30 * freq.QuadPart) { // save every half of minute
m_LastSaveTime = time;
if (s.fKeepHistory && s.fRememberFilePos) {
s.SaveCurrentFilePosition();
@@ -1725,7 +1737,7 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
}
}
- if(m_rtDurationOverride >= 0) {
+ if (m_rtDurationOverride >= 0) {
rtDur = m_rtDurationOverride;
}
@@ -1737,16 +1749,16 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
m_OSD.SetPos (rtNow);
m_Lcd.SetMediaRange(0, rtDur);
m_Lcd.SetMediaPos(rtNow);
- } else if(GetPlaybackMode() == PM_CAPTURE) {
+ } else if (GetPlaybackMode() == PM_CAPTURE) {
pMS->GetCurrentPosition(&rtNow);
- if(m_fCapturing && m_wndCaptureBar.m_capdlg.m_pMux) {
+ if (m_fCapturing && m_wndCaptureBar.m_capdlg.m_pMux) {
CComQIPtr<IMediaSeeking> pMuxMS = m_wndCaptureBar.m_capdlg.m_pMux;
- if(!pMuxMS || FAILED(pMuxMS->GetCurrentPosition(&rtNow))) {
+ if (!pMuxMS || FAILED(pMuxMS->GetCurrentPosition(&rtNow))) {
rtNow = 0;
}
}
- if(m_rtDurationOverride >= 0) {
+ if (m_rtDurationOverride >= 0) {
rtDur = m_rtDurationOverride;
}
@@ -1759,9 +1771,9 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
m_Lcd.SetMediaRange(0, rtDur);
m_Lcd.SetMediaPos(rtNow);
/*
- if(m_fCapturing)
+ if (m_fCapturing)
{
- if(rtNow > 10000i64*1000*60*60*3)
+ if (rtNow > 10000i64*1000*60*60*3)
{
m_wndCaptureBar.m_capdlg.OnRecord();
}
@@ -1769,7 +1781,7 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
*/
}
- if(m_pCAP && GetPlaybackMode() != PM_FILE) {
+ if (m_pCAP && GetPlaybackMode() != PM_FILE) {
g_bExternalSubtitleTime = true;
if (pDVDI) {
DVD_PLAYBACK_LOCATION2 Location;
@@ -1802,11 +1814,11 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
GUID tf;
pMS->GetTimeFormat(&tf);
- if(GetPlaybackMode() == PM_CAPTURE && !m_fCapturing) {
+ if (GetPlaybackMode() == PM_CAPTURE && !m_fCapturing) {
CString str = _T("Live");
long lChannel = 0, lVivSub = 0, lAudSub = 0;
- if(pAMTuner
+ if (pAMTuner
&& m_wndCaptureBar.m_capdlg.IsTunerActive()
&& SUCCEEDED(pAMTuner->get_Channel(&lChannel, &lVivSub, &lAudSub))) {
CString ch;
@@ -1825,7 +1837,7 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
m_wndSubresyncBar.SetTime(pos);
- if(m_pCAP && GetMediaState() == State_Paused) {
+ if (m_pCAP && GetMediaState() == State_Paused) {
m_pCAP->Paint(false);
}
}
@@ -1839,8 +1851,8 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
bool fCursorOutside = !r.PtInRect(p);
CWnd* pWnd = WindowFromPoint(p);
- if(pWnd && (m_wndView == *pWnd || m_wndView.IsChild(pWnd) || fCursorOutside)) {
- if(AfxGetAppSettings().nShowBarsWhenFullScreenTimeOut >= 0) {
+ if (pWnd && (m_wndView == *pWnd || m_wndView.IsChild(pWnd) || fCursorOutside)) {
+ if (AfxGetAppSettings().nShowBarsWhenFullScreenTimeOut >= 0) {
ShowControls(CS_NONE, false);
}
}
@@ -1862,7 +1874,7 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
KillTimer(TIMER_FULLSCREENMOUSEHIDER);
} else {
CWnd* pWnd = WindowFromPoint(p);
- if(pWnd && (m_wndView == *pWnd || m_wndView.IsChild(pWnd) || fCursorOutside)) {
+ if (pWnd && (m_wndView == *pWnd || m_wndView.IsChild(pWnd) || fCursorOutside)) {
m_fHideCursor = true;
SetCursor(NULL);
}
@@ -1870,24 +1882,79 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
}
break;
case TIMER_STATS: {
- if(pQP) {
+ if (pQP) {
CString rate;
- if(m_iSpeedLevel >= -11 && m_iSpeedLevel <= 3 && m_iSpeedLevel != -4) {
+ 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) {
+ if (m_iSpeedLevel < -4) {
rate = _T("-") + rate;
}
- if(!rate.IsEmpty()) {
+ if (!rate.IsEmpty()) {
rate = _T("(") + rate + _T("X)");
}
}
CString info;
- int val;
-
- pQP->get_AvgFrameRate(&val);
- info.Format(_T("%d.%02d %s"), val/100, val%100, rate);
+ int val = 0;
+
+ /*
+ Reproduce:
+ 1. Start a video
+ 2. Pause video
+ 3. Hibernate computer
+ 4. Start computer again
+ MPC-HC window should now be hung
+
+ Stack dump from a Windows 7 64-bit machine:
+ Thread 1:
+ ntdll_77d30000!ZwWaitForSingleObject+0x15
+ ntdll_77d30000!RtlpWaitOnCriticalSection+0x13e
+ ntdll_77d30000!RtlEnterCriticalSection+0x150
+ QUARTZ!CBlockLock<CKsOpmLib>::CBlockLock<CKsOpmLib>+0x14 <- Lock
+ QUARTZ!CImageSync::get_AvgFrameRate+0x24
+ QUARTZ!CVMRFilter::get_AvgFrameRate+0x31
+ mpc_hc!CMainFrame::OnTimer+0xb80
+ mpc_hc!CWnd::OnWndMsg+0x3e8
+ mpc_hc!CWnd::WindowProc+0x24
+ mpc_hc!CMainFrame::WindowProc+0x15e
+ mpc_hc!AfxCallWndProc+0xac
+ mpc_hc!AfxWndProc+0x36
+ USER32!InternalCallWinProc+0x23
+ USER32!UserCallWinProcCheckWow+0x109
+ USER32!DispatchMessageWorker+0x3bc
+ USER32!DispatchMessageW+0xf
+ mpc_hc!AfxInternalPumpMessage+0x40
+ mpc_hc!CWinThread::Run+0x5b
+ mpc_hc!AfxWinMain+0x69
+ mpc_hc!__tmainCRTStartup+0x11a
+
+ Thread 2:
+ ntdll_77d30000!ZwWaitForSingleObject+0x15
+ ntdll_77d30000!RtlpWaitOnCriticalSection+0x13e
+ ntdll_77d30000!RtlEnterCriticalSection+0x150
+ QUARTZ!CBlockLock<CKsOpmLib>::CBlockLock<CKsOpmLib>+0x14 <- Lock
+ QUARTZ!VMR9::CVMRFilter::NonDelegatingQueryInterface+0x1b
+ mpc_hc!DSObjects::COuterVMR9::NonDelegatingQueryInterface+0x5b
+ mpc_hc!CMacrovisionKicker::NonDelegatingQueryInterface+0xdc
+ QUARTZ!CImageSync::QueryInterface+0x16
+ QUARTZ!VMR9::CVMRFilter::CIImageSyncNotifyEvent::QueryInterface+0x19
+ mpc_hc!DSObjects::CVMR9AllocatorPresenter::PresentImage+0xa9
+ QUARTZ!VMR9::CVMRFilter::CIVMRImagePresenter::PresentImage+0x2c
+ QUARTZ!VMR9::CImageSync::DoRenderSample+0xd5
+ QUARTZ!VMR9::CImageSync::ReceiveWorker+0xad
+ QUARTZ!VMR9::CImageSync::Receive+0x46
+ QUARTZ!VMR9::CVideoMixer::CompositeTheStreamsTogether+0x24f
+ QUARTZ!VMR9::CVideoMixer::MixerThread+0x184
+ QUARTZ!VMR9::CVideoMixer::MixerThreadProc+0xd
+ KERNEL32!BaseThreadInitThunk+0xe
+ ntdll_77d30000!__RtlUserThreadStart+0x70
+ ntdll_77d30000!_RtlUserThreadStart+0x1b
+
+ There can be a bug in QUARTZ or more likely mpc-hc is doing something wrong
+ */
+ pQP->get_AvgFrameRate(&val); // We hang here due to a lock that never gets released.
+ info.Format(_T("%d.%02d %s"), val / 100, val % 100, rate);
m_wndStatsBar.SetLine(ResStr(IDS_AG_FRAMERATE), info);
int avg, dev;
@@ -1907,19 +1974,19 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
m_wndStatsBar.SetLine(_T("Jitter"), info);
}
- if(pBI) {
+ if (pBI) {
CAtlList<CString> sl;
- for(int i = 0, j = pBI->GetCount(); i < j; i++) {
+ for (int i = 0, j = pBI->GetCount(); i < j; i++) {
int samples, size;
- if(S_OK == pBI->GetStatus(i, 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()) {
+ if (!sl.IsEmpty()) {
CString str;
str.Format(_T("%s (p%d)"), Implode(sl, ' '), pBI->GetPriority());
@@ -1931,28 +1998,28 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
BeginEnumFilters(pGB, pEF, pBF) {
BeginEnumPins(pBF, pEP, pPin) {
- if(CComQIPtr<IBitRateInfo> pBRI = pPin) {
+ if (CComQIPtr<IBitRateInfo> pBRI = pPin) {
pBRIs.AddTail(pBRI);
}
}
EndEnumPins;
- if(!pBRIs.IsEmpty()) {
+ if (!pBRIs.IsEmpty()) {
CAtlList<CString> sl;
POSITION pos = pBRIs.GetHeadPosition();
- for(int i = 0; pos; i++) {
+ for (int i = 0; pos; i++) {
IBitRateInfo* pBRI = pBRIs.GetNext(pos);
DWORD cur = pBRI->GetCurrentBitRate() / 1000;
DWORD avg = pBRI->GetAverageBitRate() / 1000;
- if(avg == 0) {
+ if (avg == 0) {
continue;
}
CString str;
- if(cur != avg) {
+ if (cur != avg) {
str.Format(_T("[%d]: %d/%d Kb/s"), i, avg, cur);
} else {
str.Format(_T("[%d]: %d Kb/s"), i, avg);
@@ -1960,7 +2027,7 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
sl.AddTail(str);
}
- if(!sl.IsEmpty()) {
+ if (!sl.IsEmpty()) {
m_wndStatsBar.SetLine(_T("Bitrate"), Implode(sl, ' ') + _T(" (avg/cur)"));
}
@@ -1969,11 +2036,11 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
}
EndEnumFilters;
- if(GetPlaybackMode() == PM_FILE) {
+ if (GetPlaybackMode() == PM_FILE) {
SetupChapters();
}
- if(GetPlaybackMode() == PM_DVD) { // we also use this timer to update the info panel for DVD playback
+ if (GetPlaybackMode() == PM_DVD) { // we also use this timer to update the info panel for DVD playback
ULONG ulAvailable, ulCurrent;
// Location
@@ -1986,7 +2053,7 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
ULONG ulNumOfTitles;
ULONG ulNumOfChapters;
- if(SUCCEEDED(pDVDI->GetCurrentLocation(&loc))
+ if (SUCCEEDED(pDVDI->GetCurrentLocation(&loc))
&& SUCCEEDED(pDVDI->GetNumberOfChapters(loc.TitleNum, &ulNumOfChapters))
&& SUCCEEDED(pDVDI->GetDVDVolumeInfo(&ulNumOfVolumes, &ulVolume, &Side, &ulNumOfTitles))) {
Location.Format(ResStr(IDS_MAINFRM_9),
@@ -2018,7 +2085,7 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
DVD_VideoAttributes VATR;
- if(SUCCEEDED(pDVDI->GetCurrentAngle(&ulAvailable, &ulCurrent))
+ if (SUCCEEDED(pDVDI->GetCurrentAngle(&ulAvailable, &ulCurrent))
&& SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR))) {
Video.Format(ResStr(IDS_MAINFRM_10),
ulAvailable, ulCurrent,
@@ -2034,13 +2101,13 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
DVD_AudioAttributes AATR;
- if(SUCCEEDED(pDVDI->GetCurrentAudio(&ulAvailable, &ulCurrent))
+ 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));
- switch(AATR.LanguageExtension) {
+ switch (AATR.LanguageExtension) {
case DVD_AUD_EXT_NotSpecified:
default:
break;
@@ -2083,13 +2150,13 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
BOOL bIsDisabled;
DVD_SubpictureAttributes SATR;
- if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulAvailable, &ulCurrent, &bIsDisabled))
+ 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));
- switch(SATR.LanguageExtension) {
+ switch (SATR.LanguageExtension) {
case DVD_SP_EXT_NotSpecified:
default:
break;
@@ -2125,7 +2192,7 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
break;
}
- if(bIsDisabled) {
+ if (bIsDisabled) {
lang = _T("-");
}
@@ -2136,15 +2203,15 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_SUBTITLES), Subtitles);
}
- if(GetMediaState() == State_Running && !m_fAudioOnly) {
+ if (GetMediaState() == State_Running && !m_fAudioOnly) {
UINT fSaverActive = 0;
- if(SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, (PVOID)&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)) {
+ 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);
}
@@ -2171,7 +2238,7 @@ 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);
}
@@ -2186,7 +2253,7 @@ static bool SetShutdownPrivilege()
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
- if(GetLastError() != ERROR_SUCCESS) {
+ if (GetLastError() != ERROR_SUCCESS) {
return false;
}
@@ -2199,29 +2266,29 @@ 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) {
+ if (!fExit) {
return false;
}
@@ -2246,21 +2313,21 @@ bool CMainFrame::GraphEventComplete( )
}
}
- 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 {
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);
}
}
@@ -2270,7 +2337,7 @@ bool CMainFrame::GraphEventComplete( )
NextMediaExist = SearchInDir(true);
}
if (!s.fNextInDirAfterPlayback || !(NextMediaExist>1)) {
- if(s.fRewind) {
+ if (s.fRewind) {
SendMessage(WM_COMMAND, ID_PLAY_STOP);
} else {
m_fEndOfStream = true;
@@ -2278,7 +2345,7 @@ bool CMainFrame::GraphEventComplete( )
}
m_OSD.ClearMessage();
- if(m_fFullScreen && s.fExitFullScreenAtTheEnd) {
+ if (m_fFullScreen && s.fExitFullScreenAtTheEnd) {
OnViewFullscreen();
}
}
@@ -2287,25 +2354,25 @@ bool CMainFrame::GraphEventComplete( )
// 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) {
+ if (m_fFullScreen && s.fExitFullScreenAtTheEnd) {
OnViewFullscreen();
}
- if(s.fRewind) {
+ if (s.fRewind) {
s.nCLSwitches |= CLSW_OPEN; // HACK
PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD);
} else {
@@ -2328,14 +2395,14 @@ 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);
}
}
@@ -2346,7 +2413,7 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
hr = pME->FreeEventParams(evCode, evParam1, evParam2);
- switch(evCode) {
+ switch (evCode) {
case EC_COMPLETE:
if (!GraphEventComplete()) {
return hr;
@@ -2361,14 +2428,14 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
m_fBuffering = ((HRESULT)evParam1 != S_OK);
break;
case EC_STEP_COMPLETE:
- if(m_fFrameSteppingActive) {
+ if (m_fFrameSteppingActive) {
m_nStepForwardCount++;
m_fFrameSteppingActive = false;
pBA->put_Volume(m_VolumeBeforeFrameStepping);
}
break;
case EC_DEVICE_LOST:
- if(GetPlaybackMode() == PM_CAPTURE && evParam2 == 0) {
+ if (GetPlaybackMode() == PM_CAPTURE && evParam2 == 0) {
CComQIPtr<IBaseFilter> pBF = (IUnknown*)evParam1;
if (!pVidCap && pVidCap == pBF || !pAudCap && pAudCap == pBF) {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
@@ -2382,12 +2449,12 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
DvdPos->lTitle = (DWORD)evParam1;
}
- if(GetPlaybackMode() == PM_FILE) {
+ if (GetPlaybackMode() == PM_FILE) {
SetupChapters();
- } else if(GetPlaybackMode() == PM_DVD) {
+ } else if (GetPlaybackMode() == PM_DVD) {
m_iDVDTitle = (DWORD)evParam1;
- if(m_iDVDDomain == DVD_DOMAIN_Title) {
+ if (m_iDVDDomain == DVD_DOMAIN_Title) {
CString Domain;
Domain.Format(ResStr(IDS_AG_TITLE), m_iDVDTitle);
m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain);
@@ -2400,7 +2467,7 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
CString Domain('-');
- switch(m_iDVDDomain) {
+ switch (m_iDVDDomain) {
case DVD_DOMAIN_FirstPlay:
ULONGLONG llDVDGuid;
@@ -2568,7 +2635,7 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
DVD_HMSF_TIMECODE tcDur;
ULONG ulFlags;
- if(SUCCEEDED(pDVDI->GetTotalTitleTime(&tcDur, &ulFlags))) {
+ if (SUCCEEDED(pDVDI->GetTotalTitleTime(&tcDur, &ulFlags))) {
rtDur = HMSF2RT(tcDur, fps);
}
@@ -2590,7 +2657,7 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
m_OSD.SetPos(rtNow);
m_Lcd.SetMediaPos(rtNow);
- if(m_pSubClock) {
+ if (m_pSubClock) {
m_pSubClock->SetTime(rtNow);
}
}
@@ -2600,7 +2667,7 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
CString err;
- switch(evParam1) {
+ switch (evParam1) {
case DVD_ERROR_Unexpected:
default:
err = ResStr(IDS_MAINFRM_16);
@@ -2646,7 +2713,7 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
CSize size(evParam1);
m_fAudioOnly = (size.cx <= 0 || size.cy <= 0);
- if(s.fRememberZoomLevel
+ if (s.fRememberZoomLevel
&& !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED)) {
ZoomVideoWindow();
} else {
@@ -2661,7 +2728,7 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
}
break;
case EC_BG_AUDIO_CHANGED:
- if(m_fCustomGraph) {
+ if (m_fCustomGraph) {
int nAudioChannels = evParam1;
m_wndStatusBar.SetStatusBitmap(nAudioChannels == 1 ? IDB_MONO
@@ -2670,7 +2737,7 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
}
break;
case EC_BG_ERROR:
- if(m_fCustomGraph) {
+ if (m_fCustomGraph) {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
m_closingmsg = !str.IsEmpty() ? str : _T("Unspecified graph error");
m_wndPlaylistBar.SetCurValid(false);
@@ -2678,7 +2745,7 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
}
break;
case EC_DVD_PLAYBACK_RATE_CHANGE:
- if(m_fCustomGraph && s.AutoChangeFullscrRes.bEnabled &&
+ if (m_fCustomGraph && s.AutoChangeFullscrRes.bEnabled &&
m_fFullScreen && m_iDVDDomain == DVD_DOMAIN_Title) {
AutoChangeMonitorMode();
}
@@ -2693,7 +2760,7 @@ LRESULT CMainFrame::OnResetDevice( WPARAM wParam, LPARAM lParam )
{
OAFilterState fs = State_Stopped;
pMC->GetState(0, &fs);
- if(fs == State_Running) {
+ if (fs == State_Running) {
pMC->Pause();
}
@@ -2706,7 +2773,7 @@ LRESULT CMainFrame::OnResetDevice( WPARAM wParam, LPARAM lParam )
ResetDevice();
}
- if(fs == State_Running) {
+ if (fs == State_Running) {
pMC->Run();
}
return S_OK;
@@ -2722,15 +2789,15 @@ LRESULT CMainFrame::OnResumeFromState(WPARAM wParam, LPARAM lParam)
{
int iPlaybackMode = (int)wParam;
- if(iPlaybackMode == PM_FILE) {
- SeekTo(10000i64*int(lParam));
- } else if(iPlaybackMode == PM_DVD) {
+ if (iPlaybackMode == PM_FILE) {
+ SeekTo(10000i64*int(lParam), false);
+ } else if (iPlaybackMode == PM_DVD) {
CComPtr<IDvdState> pDvdState;
pDvdState.Attach((IDvdState*)lParam);
- if(pDVDC) {
+ if (pDVDC) {
pDVDC->SetState(pDvdState, DVD_CMD_FLAG_Block, NULL);
}
- } else if(iPlaybackMode == PM_CAPTURE) {
+ } else if (iPlaybackMode == PM_CAPTURE) {
// not implemented
} else {
ASSERT(0);
@@ -2752,14 +2819,14 @@ BOOL CMainFrame::OnButton(UINT id, UINT nFlags, CPoint point)
m_wndView.MapWindowPoints(this, &r);
}
- if(id != wmcmd::WDOWN && id != wmcmd::WUP && !r.PtInRect(point)) {
+ if (id != wmcmd::WDOWN && id != wmcmd::WUP && !r.PtInRect(point)) {
return FALSE;
}
BOOL ret = FALSE;
WORD cmd = assignedToCmd(id);
- if(cmd) {
+ if (cmd) {
SendMessage(WM_COMMAND, cmd);
ret = TRUE;
}
@@ -2776,24 +2843,24 @@ void CMainFrame::OnLButtonDown(UINT nFlags, CPoint point)
bool fClicked = false;
- if(GetPlaybackMode() == PM_DVD) {
+ if (GetPlaybackMode() == PM_DVD) {
CPoint p = point - m_wndView.GetVideoRect().TopLeft();
- if(SUCCEEDED(pDVDC->ActivateAtPosition(p))
+ if (SUCCEEDED(pDVDC->ActivateAtPosition(p))
|| m_iDVDDomain == DVD_DOMAIN_VideoManagerMenu
|| m_iDVDDomain == DVD_DOMAIN_VideoTitleSetMenu) {
fClicked = true;
}
}
- if(!fClicked) {
+ if (!fClicked) {
bool fLeftMouseBtnUnassigned = !assignedToCmd(wmcmd::LDOWN);
- if(!m_fFullScreen && ((IsCaptionHidden() && AfxGetAppSettings().nCS<=CS_SEEKBAR) || fLeftMouseBtnUnassigned)) {
+ if (!m_fFullScreen && ((IsCaptionHidden() && AfxGetAppSettings().nCS<=CS_SEEKBAR) || fLeftMouseBtnUnassigned)) {
PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
} else {
s_fLDown = true;
- if(OnButton(wmcmd::LDOWN, nFlags, point)) {
+ if (OnButton(wmcmd::LDOWN, nFlags, point)) {
return;
}
}
@@ -2806,7 +2873,7 @@ 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 (!OnButton(wmcmd::LUP, nFlags, point)) {
__super::OnLButtonUp(nFlags, point);
}
}
@@ -2814,11 +2881,11 @@ void CMainFrame::OnLButtonUp(UINT nFlags, CPoint 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);
}
}
@@ -2826,14 +2893,14 @@ void CMainFrame::OnLButtonDblClk(UINT nFlags, CPoint 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);
}
}
@@ -2841,21 +2908,21 @@ void CMainFrame::OnMButtonUp(UINT nFlags, CPoint 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);
}
}
@@ -2863,7 +2930,7 @@ void CMainFrame::OnRButtonUp(UINT nFlags, CPoint 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);
}
}
@@ -2912,7 +2979,7 @@ void CMainFrame::OnMouseMove(UINT nFlags, CPoint point)
}
if (!m_OSD.OnMouseMove (nFlags, point)) {
- if(GetPlaybackMode() == PM_DVD) {
+ if (GetPlaybackMode() == PM_DVD) {
CPoint vp = point - m_wndView.GetVideoRect().TopLeft();
pDVDC->SelectAtPosition(vp);
}
@@ -2929,12 +2996,12 @@ void CMainFrame::OnMouseMove(UINT nFlags, CPoint point)
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) {
m_wndNavigationBar.m_navdlg.UpdateElementList();
@@ -2944,23 +3011,23 @@ 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) {
+ if (s.nCS&i) {
r.top -= size.cy;
}
}
// HACK: the controls would cover the menu too early hiding some buttons
- if(GetPlaybackMode() == PM_DVD
+ if (GetPlaybackMode() == PM_DVD
&& (m_iDVDDomain == DVD_DOMAIN_VideoManagerMenu
|| m_iDVDDomain == DVD_DOMAIN_VideoTitleSetMenu)) {
r.top = r.bottom - 10;
@@ -2968,12 +3035,12 @@ void CMainFrame::OnMouseMove(UINT nFlags, CPoint point)
m_fHideCursor = false;
- if(r.PtInRect(point)) {
- if(s.fShowBarsWhenFullScreen) {
+ if (r.PtInRect(point)) {
+ if (s.fShowBarsWhenFullScreen) {
ShowControls(s.nCS);
}
} else {
- if(s.fShowBarsWhenFullScreen) {
+ if (s.fShowBarsWhenFullScreen) {
ShowControls(CS_NONE, false);
}
}
@@ -2988,13 +3055,13 @@ 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) {
+ if (s.fShowBarsWhenFullScreen) {
m_wndNavigationBar.ShowControls(this, FALSE);
}
}
@@ -3003,7 +3070,7 @@ void CMainFrame::OnMouseMove(UINT nFlags, CPoint point)
SetTimer(TIMER_FULLSCREENMOUSEHIDER, 2000, NULL);
} else {
m_fHideCursor = false;
- if(s.fShowBarsWhenFullScreen) {
+ if (s.fShowBarsWhenFullScreen) {
ShowControls(s.nCS);
}
@@ -3027,12 +3094,13 @@ LRESULT CMainFrame::OnNcHitTest(CPoint point)
void CMainFrame::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
bool Shift_State = !!(::GetKeyState(VK_SHIFT)&0x8000);
- if(AfxGetAppSettings().fFastSeek)
+ if (AfxGetAppSettings().fFastSeek) {
Shift_State = !Shift_State;
+ }
- 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(), Shift_State);
} else if (m_pVideoWnd == m_pVideoWnd) {
SeekTo(m_OSD.GetPos(), Shift_State);
@@ -3048,24 +3116,33 @@ 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++) {
+#ifdef _DEBUG
CString str;
pMenu->GetMenuString(i, str, MF_BYPOSITION);
+ str.Remove('&');
+#endif
+ UINT itemID = pMenu->GetMenuItemID(i);
+ if (itemID == 0xFFFFFFFF) {
+ mii.fMask = MIIM_ID;
+ pMenu->GetMenuItemInfo(i, &mii, TRUE);
+ itemID = mii.wID;
+ }
CMenu* pSubMenu = NULL;
- if(str == ResStr(IDS_FAVORITES_POPUP)) {
+ if(itemID == ID_FAVORITES) {
SetupFavoritesSubMenu();
pSubMenu = &m_favorites;
- }
- if(str == ResStr(IDS_RECENT_FILES_POPUP)) {
+ }/*else if(itemID == ID_RECENT_FILES) {
SetupRecentFilesSubMenu();
pSubMenu = &m_recentfiles;
- }
+ }*/
- if(pSubMenu) {
- mii.fMask = MIIM_STATE|MIIM_SUBMENU;
+ if (pSubMenu) {
+ mii.fMask = MIIM_STATE|MIIM_SUBMENU|MIIM_ID;
mii.fType = MF_POPUP;
+ mii.wID = itemID; // save ID after set popup type
mii.hSubMenu = pSubMenu->m_hMenu;
mii.fState = (pSubMenu->GetMenuItemCount() > 0 ? MF_ENABLED : (MF_DISABLED|MF_GRAYED));
pMenu->SetMenuItemInfo(i, &mii, TRUE);
@@ -3077,116 +3154,97 @@ void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
{
__super::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
- static CAtlStringMap<UINT> transl;
-
- //if(transl.IsEmpty())
- {
- transl[ResStr(IDS_AG_NAVIGATE)] = IDS_NAVIGATE_POPUP;
- transl[ResStr(IDS_AG_OPEN_DISC)] = IDS_OPENCDROM_POPUP;
- transl[ResStr(IDS_AG_FILTERS)] = IDS_FILTERS_POPUP;
- transl[_T("Audio")] = IDS_AUDIO_POPUP;
- transl[ResStr(IDS_AG_SUBTITLES)] = IDS_SUBTITLES_POPUP;
- transl[ResStr(IDS_MAINFRM_28)] = IDS_AUDIOLANGUAGE_POPUP;
- transl[ResStr(IDS_MAINFRM_29)] = IDS_SUBTITLELANGUAGE_POPUP;
- transl[ResStr(IDS_AG_VIDEO_ANGLE)] = IDS_VIDEOANGLE_POPUP;
- transl[ResStr(IDS_AG_JUMP_TO)] = IDS_JUMPTO_POPUP;
- transl[ResStr(IDS_AG_FAVORITES)] = IDS_FAVORITES_POPUP;
- transl[ResStr(IDS_AG_SHADERS)] = IDS_SHADER_POPUP;
- transl[ResStr(IDS_AG_VIDEO_FRAME)] = IDS_VIDEOFRAME_POPUP;
- transl[ResStr(IDS_AG_PANSCAN)] = IDS_PANSCAN_POPUP;
- transl[ResStr(IDS_AG_ASPECT_RATIO)] = IDS_ASPECTRATIO_POPUP;
- transl[_T("Zoom")] = IDS_ZOOM_POPUP;
- //transl[ResStr(IDS_RECENT_FILES_POPUP)] = IDS_RECENT_FILES_POPUP;
- }
-
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++) {
+#ifdef _DEBUG
CString str;
pPopupMenu->GetMenuString(i, str, MF_BYPOSITION);
+ str.Remove('&');
+#endif
+ UINT firstSubItemID = 0;
+ CMenu* sm = pPopupMenu->GetSubMenu(i);
+ if (sm) firstSubItemID= sm->GetMenuItemID(0);
- CString lookupstr = str;
- lookupstr.Remove('&');
-
- CMenu* pSubMenu = NULL;
-
- UINT id;
- if(transl.Lookup(lookupstr, id)) {
- str = ResStr(id);
- // pPopupMenu->ModifyMenu(i, MF_BYPOSITION|MF_STRING, 0, str);
- MENUITEMINFO mii;
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_STRING;
- mii.dwTypeData = (LPTSTR)(LPCTSTR)str;
- pPopupMenu->SetMenuItemInfo(i, &mii, TRUE);
- }
-
- if(str == ResStr(IDS_NAVIGATE_POPUP)) {
+ if(firstSubItemID == ID_NAVIGATE_SKIPBACK) { // is "Navigate" submenu {
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)) {
+ continue;
+ }
+ if(firstSubItemID == ID_VIEW_VF_HALF // is "Video Frame" submenu
+ || firstSubItemID == ID_VIEW_INCSIZE // is "Pan&Scan" submenu
+ || firstSubItemID == ID_ASPECTRATIO_SOURCE // is "Override Aspect Ratio" submenu
+ || firstSubItemID == ID_VIEW_ZOOM_50) { // is "Zoom" submenu
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)) {
- SetupOpenCDSubMenu();
- pSubMenu = &m_opencds;
- } else if(str == ResStr(IDS_FILTERS_POPUP)) {
+ continue;
+ }
+
+ UINT itemID = pPopupMenu->GetMenuItemID(i);
+ if (itemID == 0xFFFFFFFF) {
+ mii.fMask = MIIM_ID;
+ pPopupMenu->GetMenuItemInfo(i, &mii, TRUE);
+ itemID = mii.wID;
+ }
+ CMenu* pSubMenu = NULL;
+
+ if(itemID == ID_FILE_OPENDISC32774) {
+ SetupOpenCDSubMenu();
+ pSubMenu = &m_opencds;
+ } else if(itemID == ID_FILTERS) {
SetupFiltersSubMenu();
pSubMenu = &m_filters;
- } else if(str == ResStr(IDS_AUDIO_POPUP)) {
+ } else if(itemID == ID_AUDIOS) {
SetupAudioSwitcherSubMenu();
pSubMenu = &m_audios;
- } else if(str == ResStr(IDS_SUBTITLES_POPUP)) {
+ } else if(itemID == ID_SUBTITLES) {
SetupSubtitlesSubMenu();
pSubMenu = &m_subtitles;
- } else if(str == ResStr(IDS_AUDIOLANGUAGE_POPUP)) {
+ } else if(itemID == ID_AUDIOLANGUAGE) {
SetupNavAudioSubMenu();
pSubMenu = &m_navaudio;
- } else if(str == ResStr(IDS_SUBTITLELANGUAGE_POPUP)) {
+ } else if(itemID == ID_SUBTITLELANGUAGE) {
SetupNavSubtitleSubMenu();
pSubMenu = &m_navsubtitle;
- } else if(str == ResStr(IDS_VIDEOANGLE_POPUP)) {
+ } else if(itemID == ID_VIDEOANGLE) {
SetupNavAngleSubMenu();
pSubMenu = &m_navangle;
- } else if(str == ResStr(IDS_JUMPTO_POPUP)) {
+ } else if(itemID == ID_JUMPTO) {
SetupNavChaptersSubMenu();
pSubMenu = &m_navchapters;
- } else if(str == ResStr(IDS_FAVORITES_POPUP)) {
+ } else if(itemID == ID_FAVORITES) {
SetupFavoritesSubMenu();
pSubMenu = &m_favorites;
- } else if(str == ResStr(IDS_RECENT_FILES_POPUP)) {
+ } else if(itemID == ID_RECENT_FILES) {
SetupRecentFilesSubMenu();
pSubMenu = &m_recentfiles;
- } else if(str == ResStr(IDS_SHADER_POPUP)) {
+ } else if(itemID == ID_SHADERS) {
SetupShadersSubMenu();
pSubMenu = &m_shaders;
}
- if(pSubMenu) {
- mii.fMask = MIIM_STATE|MIIM_SUBMENU;
+ if (pSubMenu) {
+ mii.fMask = MIIM_STATE|MIIM_SUBMENU|MIIM_ID;
mii.fType = MF_POPUP;
+ mii.wID = itemID; // save ID after set popup type
mii.hSubMenu = pSubMenu->m_hMenu;
mii.fState = (pSubMenu->GetMenuItemCount() > 0 ? MF_ENABLED : (MF_DISABLED|MF_GRAYED));
pPopupMenu->SetMenuItemInfo(i, &mii, TRUE);
+ //continue;
}
}
//
- 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
+ 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) {
@@ -3196,16 +3254,16 @@ void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
CString str;
pPopupMenu->GetMenuString(i, str, MF_BYPOSITION);
int k = str.Find('\t');
- if(k > 0) {
+ if (k > 0) {
str = str.Left(k);
}
CString key = CPPageAccelTbl::MakeAccelShortcutLabel(nID);
- if(!key.IsEmpty()) {
+ if (!key.IsEmpty()) {
str += _T("\t") + key;
}
- if(key.IsEmpty() && i < 0) {
+ if (key.IsEmpty() && i < 0) {
continue;
}
@@ -3225,33 +3283,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) {
+ 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);
@@ -3261,7 +3319,7 @@ void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
BOOL CMainFrame::OnMenu(CMenu* pMenu)
{
- if(!pMenu) {
+ if (!pMenu) {
return FALSE;
}
AppSettings& s = AfxGetAppSettings();
@@ -3284,7 +3342,7 @@ BOOL CMainFrame::OnMenu(CMenu* pMenu)
void CMainFrame::OnMenuPlayerShort()
{
- if(IsMenuHidden() || m_pFullscreenWnd->IsWindow()) {
+ if (IsMenuHidden() || m_pFullscreenWnd->IsWindow()) {
OnMenu(m_popupmain.GetSubMenu(0));
} else {
OnMenu(m_popup.GetSubMenu(0));
@@ -3304,26 +3362,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)) {
+ if ((AfxGetAppSettings().fUseWin7TaskBar) && (m_pTaskbarList)) {
m_pTaskbarList->SetProgressState(m_hWnd, TBPF_INDETERMINATE);
}
- } else if(m_iMediaLoadState == MLS_LOADED) {
+ } 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;
@@ -3331,20 +3389,20 @@ 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;
@@ -3354,36 +3412,36 @@ void CMainFrame::OnUpdatePlayerStatus(CCmdUI* pCmdUI)
}
ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes;
- if(GetDiskFreeSpaceEx(
+ if (GetDiskFreeSpaceEx(
m_wndCaptureBar.m_capdlg.m_file.Left(m_wndCaptureBar.m_capdlg.m_file.ReverseFind('\\')+1),
&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
+ if (m_wndCaptureBar.m_capdlg.m_pVidBuffer
|| 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();
}
@@ -3392,11 +3450,11 @@ void CMainFrame::OnUpdatePlayerStatus(CCmdUI* pCmdUI)
msg += str;
}
}
- } else if(m_fBuffering) {
+ } else if (m_fBuffering) {
BeginEnumFilters(pGB, pEF, pBF) {
- if(CComQIPtr<IAMNetworkStatus, &IID_IAMNetworkStatus> pAMNS = 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;
@@ -3407,13 +3465,13 @@ 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();
}
}
@@ -3425,16 +3483,16 @@ 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)) {
+ if ((AfxGetAppSettings().fUseWin7TaskBar) && (m_pTaskbarList)) {
m_pTaskbarList->SetProgressState(m_hWnd, TBPF_INDETERMINATE);
}
} else {
@@ -3458,7 +3516,7 @@ 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);
@@ -3466,7 +3524,7 @@ void CMainFrame::OnFilePostOpenmedia()
m_nCurSubtitle = -1;
m_lSubtitleShift = 0;
- if(m_pCAP) {
+ if (m_pCAP) {
m_pCAP->SetSubtitleDelay(0);
}
@@ -3484,7 +3542,7 @@ void CMainFrame::OnFilePostOpenmedia()
GetWindowPlacement(&wp);
// Workaround to avoid MadVR freezing when switching channels in PM_CAPTURE mode:
- if(IsWindowVisible() && s.fRememberZoomLevel
+ if (IsWindowVisible() && s.fRememberZoomLevel
&& !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED)
&& GetPlaybackMode() == PM_CAPTURE && s.iDSVideoRendererType == VIDRNDT_DS_MADVR) {
ShowWindow(SW_MAXIMIZE);
@@ -3493,19 +3551,19 @@ void CMainFrame::OnFilePostOpenmedia()
// restore magnification
- if(IsWindowVisible() && s.fRememberZoomLevel
+ if (IsWindowVisible() && s.fRememberZoomLevel
&& !(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) {
+ if (s.strPnSPreset == label) {
OnViewPanNScanPresets(i+ID_PANNSCAN_PRESETS_START);
}
}
@@ -3540,12 +3598,12 @@ void CMainFrame::OnFilePostClosemedia()
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>());
@@ -3580,7 +3638,7 @@ void CMainFrame::OnUpdateFilePostClosemedia(CCmdUI* pCmdUI)
void CMainFrame::OnBossKey()
{
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
- if(m_fFullScreen) {
+ if (m_fFullScreen) {
SendMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
}
SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, -1);
@@ -3590,55 +3648,55 @@ void CMainFrame::OnStreamAudio(UINT nID)
{
nID -= ID_STREAM_AUDIO_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) {
+ if (m_iMediaLoadState != MLS_LOADED) {
return;
}
CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
- if(!pSS) {
+ 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) {
+ if (pmt) {
DeleteMediaType(pmt);
}
- if(pszName) {
+ 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) {
+ if (pmt) {
DeleteMediaType(pmt);
}
- if(pszName) {
+ if (pszName) {
CoTaskMemFree(pszName);
}
}
break;
}
}
- } else if(GetPlaybackMode() == PM_FILE) {
+ } else if (GetPlaybackMode() == PM_FILE) {
SendMessage(WM_COMMAND, ID_OGM_AUDIO_NEXT+nID);
- } else if(GetPlaybackMode() == PM_DVD) {
+ } else if (GetPlaybackMode() == PM_DVD) {
SendMessage(WM_COMMAND, ID_DVD_AUDIO_NEXT+nID);
}
}
@@ -3646,41 +3704,41 @@ void CMainFrame::OnStreamAudio(UINT nID)
void CMainFrame::OnStreamSub(UINT nID)
{
nID -= ID_STREAM_SUB_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) {
+ if (m_iMediaLoadState != MLS_LOADED) {
return;
}
int cnt = 0;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos) {
+ 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) {
+ } else if (GetPlaybackMode() == PM_FILE) {
SendMessage(WM_COMMAND, ID_OGM_SUB_NEXT+nID);
- } else if(GetPlaybackMode() == PM_DVD) {
+ } else if (GetPlaybackMode() == PM_DVD) {
SendMessage(WM_COMMAND, ID_DVD_SUB_NEXT+nID);
}
}
void CMainFrame::OnStreamSubOnOff()
{
- if(m_iMediaLoadState != MLS_LOADED) {
+ if (m_iMediaLoadState != MLS_LOADED) {
return;
}
int cnt = 0;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos) {
+ while (pos) {
cnt += m_pSubStreams.GetNext(pos)->GetStreamCount();
}
- if(cnt > 0) {
+ if (cnt > 0) {
if (m_iSubtitleSel == -1) {
m_iSubtitleSel = 0;
} else {
@@ -3689,7 +3747,7 @@ void CMainFrame::OnStreamSubOnOff()
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);
}
}
@@ -3698,12 +3756,12 @@ void CMainFrame::OnOgmAudio(UINT nID)
{
nID -= ID_OGM_AUDIO_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) {
+ if (m_iMediaLoadState != MLS_LOADED) {
return;
}
CComQIPtr<IAMStreamSelect> pSS = FindSourceSelectableFilter();
- if(!pSS) {
+ if (!pSS) {
return;
}
@@ -3711,35 +3769,35 @@ void CMainFrame::OnOgmAudio(UINT nID)
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) {
+ if (pmt) {
DeleteMediaType(pmt);
}
- if(pszName) {
+ 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);
@@ -3749,20 +3807,20 @@ 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) {
+ 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) {
+ if (pmt) {
DeleteMediaType(pmt);
}
- if(pszName) {
+ if (pszName) {
CoTaskMemFree(pszName);
}
}
@@ -3774,12 +3832,12 @@ void CMainFrame::OnOgmSub(UINT nID)
{
nID -= ID_OGM_SUB_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) {
+ if (m_iMediaLoadState != MLS_LOADED) {
return;
}
CComQIPtr<IAMStreamSelect> pSS = FindSourceSelectableFilter();
- if(!pSS) {
+ if (!pSS) {
return;
}
@@ -3787,35 +3845,35 @@ void CMainFrame::OnOgmSub(UINT nID)
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) {
+ if (pmt) {
DeleteMediaType(pmt);
}
- if(pszName) {
+ 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);
@@ -3824,7 +3882,7 @@ 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) {
@@ -3836,10 +3894,10 @@ void CMainFrame::OnOgmSub(UINT nID)
strMessage.Format (ResStr(IDS_MAINFRM_45), lang, _T(""));
m_OSD.DisplayMessage (OSD_TOPLEFT, strMessage);
- if(pmt) {
+ if (pmt) {
DeleteMediaType(pmt);
}
- if(pszName) {
+ if (pszName) {
CoTaskMemFree(pszName);
}
}
@@ -3851,17 +3909,17 @@ void CMainFrame::OnDvdAngle(UINT nID)
{
nID -= ID_DVD_ANGLE_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) {
+ 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) {
+ if (ulCurrentAngle > ulAnglesAvailable) {
ulCurrentAngle = 1;
- } else if(ulCurrentAngle < 1) {
+ } else if (ulCurrentAngle < 1) {
ulCurrentAngle = ulAnglesAvailable;
}
pDVDC->SelectAngle(ulCurrentAngle, DVD_CMD_FLAG_Block, NULL);
@@ -3874,13 +3932,13 @@ void CMainFrame::OnDvdAudio(UINT nID)
HRESULT hr;
nID -= ID_DVD_AUDIO_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) {
+ 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;
@@ -3902,14 +3960,14 @@ void CMainFrame::OnDvdSub(UINT nID)
HRESULT hr;
nID -= ID_DVD_SUB_NEXT;
- if(m_iMediaLoadState != MLS_LOADED) {
+ 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))
&& ulStreamsAvailable > 1) {
// UINT nNextStream = (ulCurrentStream+(nID==0?1:ulStreamsAvailable-1))%ulStreamsAvailable;
int nNextStream;
@@ -3928,7 +3986,7 @@ void CMainFrame::OnDvdSub(UINT nID)
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);
@@ -3943,14 +4001,14 @@ void CMainFrame::OnDvdSub(UINT nID)
void CMainFrame::OnDvdSubOnOff()
{
- if(m_iMediaLoadState != MLS_LOADED) {
+ 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);
}
}
@@ -3964,30 +4022,36 @@ void CMainFrame::OnDvdSubOnOff()
void CMainFrame::OnFileOpenQuick()
{
- if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar)) {
+ if (m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar)) {
return;
}
+ AppSettings& s = AfxGetAppSettings();
+
CString filter;
CAtlArray<CString> mask;
- AfxGetAppSettings().m_Formats.GetFilter(filter, mask);
- COpenFileDlg fd(mask, true, NULL, NULL,
- OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLEINCLUDENOTIFY|OFN_NOCHANGEDIR,
- filter, GetModalParent());
- if(fd.DoModal() != IDOK) {
+ s.m_Formats.GetFilter(filter, mask);
+
+ DWORD dwFlags = OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLEINCLUDENOTIFY|OFN_NOCHANGEDIR;
+ if (!s.fKeepHistory) {
+ dwFlags |= OFN_DONTADDTORECENT;
+ }
+
+ COpenFileDlg fd(mask, true, NULL, NULL, dwFlags, filter, GetModalParent());
+ if (fd.DoModal() != IDOK) {
return;
}
CAtlList<CString> fns;
POSITION pos = fd.GetStartPosition();
- while(pos) {
+ while (pos) {
fns.AddTail(fd.GetNextPathName(pos));
}
bool fMultipleFiles = false;
- if(fns.GetCount() > 1
+ if (fns.GetCount() > 1
|| fns.GetCount() == 1
&& (fns.GetHead()[fns.GetHead().GetLength()-1] == '\\'
|| fns.GetHead()[fns.GetHead().GetLength()-1] == '*')) {
@@ -4001,7 +4065,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);
}
@@ -4010,30 +4074,30 @@ void CMainFrame::OnFileOpenQuick()
void CMainFrame::OnFileOpenmedia()
{
- if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar) || m_pFullscreenWnd->IsWindow()) {
+ if (m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar) || m_pFullscreenWnd->IsWindow()) {
return;
}
COpenDlg dlg;
- if(dlg.DoModal() != IDOK || dlg.m_fns.GetCount() == 0) {
+ 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);
}
@@ -4062,11 +4126,11 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS)
}
/*
- if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar))
+ if (m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar))
return FALSE;
*/
- if(pCDS->dwData != 0x6ABE51 || pCDS->cbData < sizeof(DWORD)) {
+ if (pCDS->dwData != 0x6ABE51 || pCDS->cbData < sizeof(DWORD)) {
return FALSE;
}
@@ -4076,9 +4140,9 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS)
CAtlList<CString> cmdln;
- while(len-- > 0) {
+ while (len-- > 0) {
CString str;
- while(pBuff < pBuffEnd && *pBuff) {
+ while (pBuff < pBuffEnd && *pBuff) {
str += *pBuff++;
}
pBuff++;
@@ -4087,12 +4151,12 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS)
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);
@@ -4102,36 +4166,36 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS)
WIN32_FIND_DATA fd = {0};
HANDLE hFind = FindFirstFile(fullpath, &fd);
- if(hFind != INVALID_HANDLE_VALUE) {
+ if (hFind != INVALID_HANDLE_VALUE) {
do {
- if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
+ 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);
}
@@ -4139,23 +4203,23 @@ 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 {
CString dir;
@@ -4163,19 +4227,19 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS)
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) {
+ if (!fMulti) {
sl.AddTailList(&s.slDubs);
}
@@ -4183,7 +4247,7 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS)
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;
@@ -4191,26 +4255,26 @@ 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)) {
+ 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();
}
@@ -4229,7 +4293,7 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS)
s.nCLSwitches = CLSW_NONE;
}
- if(fSetForegroundWindow && !(s.nCLSwitches&CLSW_NOFOCUS)) {
+ if (fSetForegroundWindow && !(s.nCLSwitches&CLSW_NOFOCUS)) {
SetForegroundWindow();
}
@@ -4240,7 +4304,7 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS)
int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData)
{
- switch(uMsg) {
+ switch (uMsg) {
case BFFM_INITIALIZED:
//Initial directory is set here
SendMessage(hwnd, BFFM_SETSELECTION, TRUE,(LPARAM)(LPCTSTR)AfxGetAppSettings().strDVDPath);
@@ -4266,14 +4330,14 @@ void CMainFrame::OnFileOpendvd()
ShowWindow(SW_SHOW);
CAutoPtr<OpenDVDData> p(DNew OpenDVDData());
- if(p)
+ if (p)
{
AppSettings& s = AfxGetAppSettings();
- if(s.fUseDVDPath && !s.strDVDPath.IsEmpty())
+ if (s.fUseDVDPath && !s.strDVDPath.IsEmpty())
{
p->path = s.strDVDPath;
p->path.Replace('/', '\\');
- if(p->path[p->path.GetLength()-1] != '\\') p->path += '\\';
+ if (p->path[p->path.GetLength()-1] != '\\') p->path += '\\';
}
}
OpenMedia(p);*/
@@ -4294,7 +4358,7 @@ void CMainFrame::OnFileOpendvd()
static LPITEMIDLIST iil;
iil = SHBrowseForFolder(&bi);
- if(iil) {
+ if (iil) {
CHdmvClipInfo ClipInfo;
CString strPlaylistFile;
CAtlList<CHdmvClipInfo::PlaylistItem> MainPlaylist;
@@ -4310,7 +4374,7 @@ void CMainFrame::OnFileOpendvd()
CAutoPtr<OpenDVDData> p(DNew OpenDVDData());
p->path = path;
p->path.Replace('/', '\\');
- if(p->path[p->path.GetLength()-1] != '\\') {
+ if (p->path[p->path.GetLength()-1] != '\\') {
p->path += '\\';
}
@@ -4323,7 +4387,7 @@ void CMainFrame::OnFileOpendevice()
{
AppSettings& s = AfxGetAppSettings();
- if(m_iMediaLoadState == MLS_LOADING) {
+ if (m_iMediaLoadState == MLS_LOADING) {
return;
}
@@ -4335,7 +4399,7 @@ 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;
}
@@ -4351,10 +4415,10 @@ 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)) {
+ switch (GetCDROMType(drive, sl)) {
case CDROM_Audio:
case CDROM_VideoCD:
case CDROM_DVDVideo:
@@ -4364,7 +4428,7 @@ void CMainFrame::OnFileOpenCD(UINT nID)
break;
}
- if(nID == 0) {
+ if (nID == 0) {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
SetForegroundWindow();
@@ -4387,7 +4451,7 @@ void CMainFrame::OnDropFiles(HDROP hDropInfo)
{
SetForegroundWindow();
- if(m_wndPlaylistBar.IsWindowVisible()) {
+ if (m_wndPlaylistBar.IsWindowVisible()) {
m_wndPlaylistBar.OnDropFiles(hDropInfo);
return;
}
@@ -4396,16 +4460,16 @@ 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] != '\\') {
+ if (hFind != INVALID_HANDLE_VALUE) {
+ if (fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
+ if (fn[fn.GetLength()-1] != '\\') {
fn += '\\';
}
COpenDirHelper::RecurseAddDir(fn, &sl);
@@ -4416,13 +4480,13 @@ void CMainFrame::OnDropFiles(HDROP hDropInfo)
::DragFinish(hDropInfo);
- if(sl.IsEmpty()) {
+ 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();
@@ -4439,11 +4503,11 @@ 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")) {
+ if (ext == _T(".cda")) {
out = out.Left(out.GetLength()-4) + _T(".wav");
- } else if(ext == _T(".ifo")) {
+ } else if (ext == _T(".ifo")) {
out = out.Left(out.GetLength()-4) + _T(".vob");
}
} else {
@@ -4453,32 +4517,32 @@ void CMainFrame::OnFileSaveAs()
CFileDialog fd(FALSE, 0, out,
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST|OFN_NOCHANGEDIR,
ResStr(IDS_MAINFRM_48), GetModalParent(), 0);
- if(fd.DoModal() != IDOK || !in.CompareNoCase(fd.GetPathName())) {
+ if (fd.DoModal() != IDOK || !in.CompareNoCase(fd.GetPathName())) {
return;
}
CPath p(fd.GetPathName());
- if(!ext.IsEmpty()) {
+ if (!ext.IsEmpty()) {
p.AddExtension(ext);
}
OAFilterState fs = State_Stopped;
pMC->GetState(0, &fs);
- if(fs == State_Running) {
+ if (fs == State_Running) {
pMC->Pause();
}
CSaveDlg dlg(in, p);
dlg.DoModal();
- if(fs == State_Running) {
+ 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;
}
@@ -4486,12 +4550,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;
}
@@ -4501,7 +4565,7 @@ void CMainFrame::OnUpdateFileSaveAs(CCmdUI* pCmdUI)
bool CMainFrame::GetDIB(BYTE** ppData, long& size, bool fSilent)
{
- if(!ppData) {
+ if (!ppData) {
return false;
}
@@ -4512,11 +4576,11 @@ bool CMainFrame::GetDIB(BYTE** ppData, long& size, bool fSilent)
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
}
@@ -4525,33 +4589,33 @@ bool CMainFrame::GetDIB(BYTE** ppData, long& size, bool fSilent)
CString errmsg;
do {
- if(m_pCAP) {
+ 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)) {
+ 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)) {
+ if (SUCCEEDED(hr)) {
break;
}
Sleep(1);
retry++;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
errmsg.Format(ResStr(IDS_MAINFRM_49), hr);
break;
}
@@ -4563,14 +4627,14 @@ bool CMainFrame::GetDIB(BYTE** ppData, long& size, bool fSilent)
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)) {
+ if (!(*ppData)) {
return false;
}
memcpy_s (*ppData, size, &bih, sizeof(BITMAPINFOHEADER));
@@ -4578,36 +4642,36 @@ bool CMainFrame::GetDIB(BYTE** ppData, long& size, bool fSilent)
CoTaskMemFree (pDib);
} 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)) {
+ 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;
@@ -4625,8 +4689,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;
@@ -4635,8 +4699,8 @@ 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) {
+ 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]));
@@ -4650,7 +4714,7 @@ void CMainFrame::SaveDIB(LPCTSTR fn, BYTE* pData, long size)
} 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;
@@ -4666,8 +4730,8 @@ 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) {
+ 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]));
@@ -4682,18 +4746,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());
@@ -4701,6 +4765,7 @@ void CMainFrame::SaveDIB(LPCTSTR fn, BYTE* pData, long size)
}
SendStatusMessage((LPCTSTR)p, 3000);
+ m_OSD.DisplayMessage(OSD_TOPLEFT, ResStr(IDS_OSD_IMAGE_SAVED)+fn, 3000, 15);
}
void CMainFrame::SaveImage(LPCTSTR fn)
@@ -4708,7 +4773,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;
}
@@ -4716,14 +4781,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;
}
@@ -4737,7 +4802,7 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn)
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 {
@@ -4745,19 +4810,19 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn)
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);
}
@@ -4777,7 +4842,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;
}
@@ -4803,8 +4868,8 @@ 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 y = 0; y < spd.h; y++, p += spd.pitch)
+ for (int x = 0; x < spd.w; x++) {
((DWORD*)p)[x] = 0x010101 * (0xe0 + 0x08*y/spd.h + 0x18*(spd.w-x)/spd.w);
}
}
@@ -4812,7 +4877,7 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn)
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);
@@ -4823,7 +4888,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;
@@ -4832,11 +4897,11 @@ 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) {
+ if (EC_STEP_COMPLETE == evCode) {
hGraphEvent = NULL;
}
}
@@ -4871,13 +4936,13 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn)
BYTE* pData = NULL;
long size = 0;
- if(!GetDIB(&pData, size)) {
+ 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);
@@ -4889,7 +4954,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;
}
@@ -4897,7 +4962,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;
@@ -4905,7 +4970,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;
@@ -4956,7 +5021,7 @@ 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;
@@ -4967,7 +5032,7 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn)
}
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);
}
@@ -4996,23 +5061,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) {
+ 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) {
+ 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) {
+ 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;
}
@@ -5025,7 +5090,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();
@@ -5033,7 +5098,7 @@ 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 {
posstr.Format(_T("%02d.%02d"), tcNow.bMinutes, tcNow.bSeconds);
@@ -5048,18 +5113,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.Format(_T("snapshot_dvd_%s"), GetVidPos());
}
psrc.Combine(s.strSnapShotPath, MakeSnapshotFileName(prefix));
@@ -5068,21 +5133,21 @@ void CMainFrame::OnFileSaveImage()
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST|OFN_NOCHANGEDIR,
_T("BMP - Windows Bitmap (*.bmp)|*.bmp|JPG - JPEG Image (*.jpg)|*.jpg|PNG - Portable Network Graphics (*.png)|*.png||"), GetModalParent(), 0);
- if(s.strSnapShotExt == _T(".bmp")) {
+ if (s.strSnapShotExt == _T(".bmp")) {
fd.m_pOFN->nFilterIndex = 1;
- } else if(s.strSnapShotExt == _T(".jpg")) {
+ } else if (s.strSnapShotExt == _T(".jpg")) {
fd.m_pOFN->nFilterIndex = 2;
- } else if(s.strSnapShotExt == _T(".png")) {
+ } else if (s.strSnapShotExt == _T(".png")) {
fd.m_pOFN->nFilterIndex = 3;
}
- if(fd.DoModal() != IDOK) {
+ if (fd.DoModal() != IDOK) {
return;
}
- if(fd.m_pOFN->nFilterIndex == 1) {
+ if (fd.m_pOFN->nFilterIndex == 1) {
s.strSnapShotExt = _T(".bmp");
- } else if(fd.m_pOFN->nFilterIndex == 2) {
+ } else if (fd.m_pOFN->nFilterIndex == 2) {
s.strSnapShotExt = _T(".jpg");
} else {
fd.m_pOFN->nFilterIndex = 3;
@@ -5090,7 +5155,7 @@ void CMainFrame::OnFileSaveImage()
}
CPath pdst(fd.GetPathName());
- if(pdst.GetExtension().MakeLower() != s.strSnapShotExt) {
+ if (pdst.GetExtension().MakeLower() != s.strSnapShotExt) {
pdst.RenameExtension(s.strSnapShotExt);
}
CString path = (LPCTSTR)pdst;
@@ -5105,16 +5170,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());
}
@@ -5134,13 +5199,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);
@@ -5152,21 +5217,21 @@ 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")) {
+ if (s.strSnapShotExt == _T(".bmp")) {
fd.m_pOFN->nFilterIndex = 1;
- } else if(s.strSnapShotExt == _T(".jpg")) {
+ } else if (s.strSnapShotExt == _T(".jpg")) {
fd.m_pOFN->nFilterIndex = 2;
- } else if(s.strSnapShotExt == _T(".png")) {
+ } else if (s.strSnapShotExt == _T(".png")) {
fd.m_pOFN->nFilterIndex = 3;
}
- if(fd.DoModal() != IDOK) {
+ if (fd.DoModal() != IDOK) {
return;
}
- if(fd.m_pOFN->nFilterIndex == 1) {
+ if (fd.m_pOFN->nFilterIndex == 1) {
s.strSnapShotExt = _T(".bmp");
- } else if(fd.m_pOFN->nFilterIndex == 2) {
+ } else if (fd.m_pOFN->nFilterIndex == 2) {
s.strSnapShotExt = _T(".jpg");
} else {
fd.m_pOFN->nFilterIndex = 3;
@@ -5178,7 +5243,7 @@ void CMainFrame::OnFileSaveThumbnails()
s.iThumbWidth = fd.m_width;
CPath pdst(fd.GetPathName());
- if(pdst.GetExtension().MakeLower() != s.strSnapShotExt) {
+ if (pdst.GetExtension().MakeLower() != s.strSnapShotExt) {
pdst.RenameExtension(s.strSnapShotExt);
}
CString path = (LPCTSTR)pdst;
@@ -5207,7 +5272,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)+
@@ -5225,12 +5290,12 @@ void CMainFrame::OnFileLoadsubtitle()
OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY|OFN_NOCHANGEDIR,
szFilter, GetModalParent(), 0);
- if(fd.DoModal() != IDOK) {
+ if (fd.DoModal() != IDOK) {
return;
}
ISubStream *pSubStream = NULL;
- if(LoadSubtitle(fd.GetPathName(), &pSubStream)) {
+ if (LoadSubtitle(fd.GetPathName(), &pSubStream)) {
SetSubtitle(pSubStream); // the subtitle at the insert position according to LoadSubtitle()
}
}
@@ -5245,24 +5310,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
@@ -5271,13 +5336,13 @@ void CMainFrame::OnFileSavesubtitle()
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST|OFN_NOCHANGEDIR,
_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;
@@ -5293,7 +5358,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());
}
@@ -5344,7 +5409,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;
}
@@ -5360,7 +5425,7 @@ void CMainFrame::OnFileISDBDownload()
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;
}
@@ -5374,74 +5439,74 @@ 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") {
+ if (param == "ticket") {
ticket = value;
- } else if(param == "movie") {
+ } 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") {
+ } else if (param == "name") {
sub.name = value;
- } else if(param == "discs") {
+ } else if (param == "discs") {
sub.discs = atoi(value);
- } else if(param == "disc_no") {
+ } else if (param == "disc_no") {
sub.disc_no = atoi(value);
- } else if(param == "format") {
+ } else if (param == "format") {
sub.format = value;
- } else if(param == "iso639_2") {
+ } else if (param == "iso639_2") {
sub.iso639_2 = value;
- } else if(param == "language") {
+ } else if (param == "language") {
sub.language = value;
- } else if(param == "nick") {
+ } else if (param == "nick") {
sub.nick = value;
- } else if(param == "email") {
+ } else if (param == "email") {
sub.email = value;
- } else if(param == "" && value == "endsubtitle") {
+ } 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") {
+ } 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) {
+ if (!pSubStreamToSet) {
pSubStreamToSet = pSubStream;
}
}
}
}
- if(pSubStreamToSet) {
+ if (pSubStreamToSet) {
SetSubtitle(pSubStreamToSet);
}
}
@@ -5871,9 +5936,8 @@ void CMainFrame::OnViewVSync()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9VSync = !s.m_RenderSettings.iVMR9VSync;
s.UpdateData(true);
- CString Format;
- Format.Format(L"VSync: %s", s.m_RenderSettings.iVMR9VSync? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iVMR9VSync ? ResStr(IDS_OSD_RS_VSYNC_ON) : ResStr(IDS_OSD_RS_VSYNC_OFF));
}
void CMainFrame::OnViewVSyncAccurate()
@@ -5881,9 +5945,8 @@ void CMainFrame::OnViewVSyncAccurate()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9VSyncAccurate = !s.m_RenderSettings.iVMR9VSyncAccurate;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Accurate VSync: %s", s.m_RenderSettings.iVMR9VSyncAccurate? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iVMR9VSyncAccurate ? ResStr(IDS_OSD_RS_ACCURATE_VSYNC_ON) : ResStr(IDS_OSD_RS_ACCURATE_VSYNC_OFF));
}
void CMainFrame::OnViewSynchronizeVideo()
@@ -5899,9 +5962,8 @@ void CMainFrame::OnViewSynchronizeVideo()
}
s.UpdateData(true);
- CString Format;
- Format.Format(L"Synchronize Video to Display: %s", s.m_RenderSettings.bSynchronizeVideo? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.bSynchronizeVideo ? ResStr(IDS_OSD_RS_SYNC_TO_DISPLAY_ON) : ResStr(IDS_OSD_RS_SYNC_TO_DISPLAY_ON));
}
void CMainFrame::OnViewSynchronizeDisplay()
@@ -5917,9 +5979,8 @@ void CMainFrame::OnViewSynchronizeDisplay()
}
s.UpdateData(true);
- CString Format;
- Format.Format(L"Synchronize Display to Video: %s", s.m_RenderSettings.bSynchronizeDisplay? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.bSynchronizeDisplay ? ResStr(IDS_OSD_RS_SYNC_TO_VIDEO_ON) : ResStr(IDS_OSD_RS_SYNC_TO_VIDEO_ON));
}
void CMainFrame::OnViewSynchronizeNearest()
@@ -5935,9 +5996,8 @@ void CMainFrame::OnViewSynchronizeNearest()
}
s.UpdateData(true);
- CString Format;
- Format.Format(L"Present at Nearest VSync: %s", s.m_RenderSettings.bSynchronizeNearest? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.bSynchronizeNearest ? ResStr(IDS_OSD_RS_PRESENT_NEAREST_ON) : ResStr(IDS_OSD_RS_PRESENT_NEAREST_OFF));
}
void CMainFrame::OnViewColorManagementEnable()
@@ -5945,9 +6005,8 @@ void CMainFrame::OnViewColorManagementEnable()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9ColorManagementEnable = !s.m_RenderSettings.iVMR9ColorManagementEnable;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Color Management: %s", s.m_RenderSettings.iVMR9ColorManagementEnable? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iVMR9ColorManagementEnable ? ResStr(IDS_OSD_RS_COLOR_MANAGEMENT_ON) : ResStr(IDS_OSD_RS_COLOR_MANAGEMENT_ON));
}
void CMainFrame::OnViewColorManagementInputAuto()
@@ -5955,9 +6014,7 @@ void CMainFrame::OnViewColorManagementInputAuto()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9ColorManagementInput = VIDEO_SYSTEM_UNKNOWN;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Input Type: Auto-Detect");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_INPUT_TYPE_AUTO));
}
void CMainFrame::OnViewColorManagementInputHDTV()
@@ -5965,9 +6022,7 @@ void CMainFrame::OnViewColorManagementInputHDTV()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9ColorManagementInput = VIDEO_SYSTEM_HDTV;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Input Type: HDTV");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_INPUT_TYPE_HDTV));
}
void CMainFrame::OnViewColorManagementInputSDTV_NTSC()
@@ -5975,9 +6030,7 @@ void CMainFrame::OnViewColorManagementInputSDTV_NTSC()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9ColorManagementInput = VIDEO_SYSTEM_SDTV_NTSC;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Input Type: SDTV NTSC");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_INPUT_TYPE_SD_NTSC));
}
void CMainFrame::OnViewColorManagementInputSDTV_PAL()
@@ -5985,9 +6038,7 @@ void CMainFrame::OnViewColorManagementInputSDTV_PAL()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9ColorManagementInput = VIDEO_SYSTEM_SDTV_PAL;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Input Type: SDTV PAL");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_INPUT_TYPE_SD_PAL));
}
void CMainFrame::OnViewColorManagementAmbientLightBright()
@@ -5995,9 +6046,7 @@ void CMainFrame::OnViewColorManagementAmbientLightBright()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9ColorManagementAmbientLight = AMBIENT_LIGHT_BRIGHT;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Ambient Light: Bright (2.2 Gamma)");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_AMBIENT_LIGHT_BRIGHT));
}
void CMainFrame::OnViewColorManagementAmbientLightDim()
@@ -6005,9 +6054,7 @@ void CMainFrame::OnViewColorManagementAmbientLightDim()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9ColorManagementAmbientLight = AMBIENT_LIGHT_DIM;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Ambient Light: Dim (2.35 Gamma)");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_AMBIENT_LIGHT_DIM));
}
void CMainFrame::OnViewColorManagementAmbientLightDark()
@@ -6015,9 +6062,7 @@ void CMainFrame::OnViewColorManagementAmbientLightDark()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9ColorManagementAmbientLight = AMBIENT_LIGHT_DARK;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Ambient Light: Dark (2.4 Gamma)");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_AMBIENT_LIGHT_DARK));
}
void CMainFrame::OnViewColorManagementIntentPerceptual()
@@ -6025,9 +6070,7 @@ void CMainFrame::OnViewColorManagementIntentPerceptual()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9ColorManagementIntent = COLOR_RENDERING_INTENT_PERCEPTUAL;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Rendering Intent: Perceptual");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_REND_INTENT_PERCEPT));
}
void CMainFrame::OnViewColorManagementIntentRelativeColorimetric()
@@ -6035,9 +6078,7 @@ void CMainFrame::OnViewColorManagementIntentRelativeColorimetric()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9ColorManagementIntent = COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Rendering Intent: Relative Colorimetric");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_REND_INTENT_RELATIVE));
}
void CMainFrame::OnViewColorManagementIntentSaturation()
@@ -6045,9 +6086,7 @@ void CMainFrame::OnViewColorManagementIntentSaturation()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9ColorManagementIntent = COLOR_RENDERING_INTENT_SATURATION;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Rendering Intent: Saturation");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_REND_INTENT_SATUR));
}
void CMainFrame::OnViewColorManagementIntentAbsoluteColorimetric()
@@ -6055,9 +6094,7 @@ void CMainFrame::OnViewColorManagementIntentAbsoluteColorimetric()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9ColorManagementIntent = COLOR_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Rendering Intent: Absolute Colorimetric");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_REND_INTENT_ABSOLUTE));
}
void CMainFrame::OnViewEVROutputRange_0_255()
@@ -6065,9 +6102,9 @@ void CMainFrame::OnViewEVROutputRange_0_255()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iEVROutputRange = 0;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Output Range: 0 - 255");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ CString strOSD;
+ strOSD.Format(ResStr(IDS_OSD_RS_OUTPUT_RANGE), "0 - 255");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, strOSD);
}
void CMainFrame::OnViewEVROutputRange_16_235()
@@ -6075,9 +6112,9 @@ void CMainFrame::OnViewEVROutputRange_16_235()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iEVROutputRange = 1;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Output Range: 16 - 235");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ CString strOSD;
+ strOSD.Format(ResStr(IDS_OSD_RS_OUTPUT_RANGE), "16 - 235");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, strOSD);
}
void CMainFrame::OnViewFlushGPUBeforeVSync()
@@ -6085,9 +6122,8 @@ void CMainFrame::OnViewFlushGPUBeforeVSync()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMRFlushGPUBeforeVSync = !s.m_RenderSettings.iVMRFlushGPUBeforeVSync;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Flush GPU before VSync: %s", s.m_RenderSettings.iVMRFlushGPUBeforeVSync? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iVMRFlushGPUBeforeVSync ? ResStr(IDS_OSD_RS_FLUSH_BEF_VSYNC_ON) : ResStr(IDS_OSD_RS_FLUSH_BEF_VSYNC_OFF));
}
void CMainFrame::OnViewFlushGPUAfterVSync()
@@ -6095,9 +6131,8 @@ void CMainFrame::OnViewFlushGPUAfterVSync()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMRFlushGPUAfterPresent = !s.m_RenderSettings.iVMRFlushGPUAfterPresent;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Flush GPU after Present: %s", s.m_RenderSettings.iVMRFlushGPUAfterPresent? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iVMRFlushGPUAfterPresent ? ResStr(IDS_OSD_RS_FLUSH_AFT_PRES_ON) : ResStr(IDS_OSD_RS_FLUSH_AFT_PRES_OFF));
}
void CMainFrame::OnViewFlushGPUWait()
@@ -6105,9 +6140,8 @@ void CMainFrame::OnViewFlushGPUWait()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMRFlushGPUWait = !s.m_RenderSettings.iVMRFlushGPUWait;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Wait for GPU Flush: %s", s.m_RenderSettings.iVMRFlushGPUWait? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iVMRFlushGPUWait ? ResStr(IDS_OSD_RS_WAIT_ON) : ResStr(IDS_OSD_RS_WAIT_OFF));
}
void CMainFrame::OnViewD3DFullScreen()
@@ -6115,9 +6149,8 @@ void CMainFrame::OnViewD3DFullScreen()
AppSettings& s = AfxGetAppSettings();
s.fD3DFullscreen = !s.fD3DFullscreen;
s.UpdateData(true);
- CString Format;
- Format.Format(L"D3D Fullscreen (Requires restart): %s", s.fD3DFullscreen? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.fD3DFullscreen ? ResStr(IDS_OSD_RS_D3D_FULLSCREEN_ON) : ResStr(IDS_OSD_RS_D3D_FULLSCREEN_OFF));
}
void CMainFrame::OnViewDisableDesktopComposition()
@@ -6125,9 +6158,8 @@ void CMainFrame::OnViewDisableDesktopComposition()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMRDisableDesktopComposition = !s.m_RenderSettings.iVMRDisableDesktopComposition;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Disable desktop composition: %s", s.m_RenderSettings.iVMRDisableDesktopComposition? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iVMRDisableDesktopComposition ? ResStr(IDS_OSD_RS_NO_DESKTOP_COMP_ON) : ResStr(IDS_OSD_RS_NO_DESKTOP_COMP_OFF));
}
void CMainFrame::OnViewAlternativeVSync()
@@ -6135,9 +6167,8 @@ void CMainFrame::OnViewAlternativeVSync()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.fVMR9AlterativeVSync = !s.m_RenderSettings.fVMR9AlterativeVSync;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Alternative VSync: %s", s.m_RenderSettings.fVMR9AlterativeVSync? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.fVMR9AlterativeVSync ? ResStr(IDS_OSD_RS_ALT_VSYNC_ON) : ResStr(IDS_OSD_RS_ALT_VSYNC_OFF));
}
void CMainFrame::OnViewResetDefault()
@@ -6145,9 +6176,7 @@ void CMainFrame::OnViewResetDefault()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.SetDefault();
s.UpdateData(true);
- CString Format;
- Format.Format(L"Renderer settings reset to default");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_RESET_DEFAULT));
}
void CMainFrame::OnViewResetOptimal()
@@ -6155,9 +6184,7 @@ void CMainFrame::OnViewResetOptimal()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.SetOptimal();
s.UpdateData(true);
- CString Format;
- Format.Format(L"Renderer settings reset to optimal");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, ResStr(IDS_OSD_RS_RESET_OPTIMAL));
}
void CMainFrame::OnViewFullscreenGUISupport()
@@ -6165,9 +6192,8 @@ void CMainFrame::OnViewFullscreenGUISupport()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9FullscreenGUISupport = !s.m_RenderSettings.iVMR9FullscreenGUISupport;
s.UpdateData(true);
- CString Format;
- Format.Format(L"D3D Fullscreen GUI Support: %s", s.m_RenderSettings.iVMR9FullscreenGUISupport? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iVMR9FullscreenGUISupport ? ResStr(IDS_OSD_RS_D3D_FS_GUI_SUPP_ON) : ResStr(IDS_OSD_RS_D3D_FS_GUI_SUPP_OFF));
}
void CMainFrame::OnViewHighColorResolution()
@@ -6175,9 +6201,8 @@ void CMainFrame::OnViewHighColorResolution()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iEVRHighColorResolution = !s.m_RenderSettings.iEVRHighColorResolution;
s.UpdateData(true);
- CString Format;
- Format.Format(L"10-bit RGB Output: %s", s.m_RenderSettings.iEVRHighColorResolution? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iEVRHighColorResolution ? ResStr(IDS_OSD_RS_10BIT_RBG_OUT_ON) : ResStr(IDS_OSD_RS_10BIT_RBG_OUT_OFF));
}
void CMainFrame::OnViewForceInputHighColorResolution()
@@ -6185,31 +6210,32 @@ void CMainFrame::OnViewForceInputHighColorResolution()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iEVRForceInputHighColorResolution = !s.m_RenderSettings.iEVRForceInputHighColorResolution;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Force 10-bit RGB Input: %s", s.m_RenderSettings.iEVRForceInputHighColorResolution? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iEVRForceInputHighColorResolution ? ResStr(IDS_OSD_RS_10BIT_RBG_IN_ON) : ResStr(IDS_OSD_RS_10BIT_RBG_IN_OFF));
}
void CMainFrame::OnViewFullFloatingPointProcessing()
{
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9FullFloatingPointProcessing = !s.m_RenderSettings.iVMR9FullFloatingPointProcessing;
- if(s.m_RenderSettings.iVMR9FullFloatingPointProcessing) s.m_RenderSettings.iVMR9HalfFloatingPointProcessing = false;
+ if (s.m_RenderSettings.iVMR9FullFloatingPointProcessing) {
+ s.m_RenderSettings.iVMR9HalfFloatingPointProcessing = false;
+ }
s.UpdateData(true);
- CString Format;
- Format.Format(L"Full Floating Point Processing: %s", s.m_RenderSettings.iVMR9FullFloatingPointProcessing? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iVMR9FullFloatingPointProcessing ? ResStr(IDS_OSD_RS_FULL_FP_PROCESS_ON) : ResStr(IDS_OSD_RS_FULL_FP_PROCESS_OFF));
}
void CMainFrame::OnViewHalfFloatingPointProcessing()
{
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iVMR9HalfFloatingPointProcessing = !s.m_RenderSettings.iVMR9HalfFloatingPointProcessing;
- if(s.m_RenderSettings.iVMR9HalfFloatingPointProcessing) s.m_RenderSettings.iVMR9FullFloatingPointProcessing = false;
+ if (s.m_RenderSettings.iVMR9HalfFloatingPointProcessing) {
+ s.m_RenderSettings.iVMR9FullFloatingPointProcessing = false;
+ }
s.UpdateData(true);
- CString Format;
- Format.Format(L"Half Floating Point Processing: %s", s.m_RenderSettings.iVMR9HalfFloatingPointProcessing? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iVMR9HalfFloatingPointProcessing ? ResStr(IDS_OSD_RS_HALF_FP_PROCESS_ON) : ResStr(IDS_OSD_RS_HALF_FP_PROCESS_OFF));
}
void CMainFrame::OnViewEnableFrameTimeCorrection()
@@ -6217,41 +6243,40 @@ void CMainFrame::OnViewEnableFrameTimeCorrection()
CRenderersSettings& s = AfxGetAppSettings().m_RenderersSettings;
s.m_RenderSettings.iEVREnableFrameTimeCorrection = !s.m_RenderSettings.iEVREnableFrameTimeCorrection;
s.UpdateData(true);
- CString Format;
- Format.Format(L"Frame Time Correction: %s", s.m_RenderSettings.iEVREnableFrameTimeCorrection? L"On":L"Off");
- m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT,
+ s.m_RenderSettings.iEVREnableFrameTimeCorrection ? ResStr(IDS_OSD_RS_FT_CORRECTION_ON) : ResStr(IDS_OSD_RS_FT_CORRECTION_OFF));
}
void CMainFrame::OnViewVSyncOffsetIncrease()
{
AppSettings& s = AfxGetAppSettings();
CRenderersSettings& r = s.m_RenderersSettings;
- CString Format;
+ CString strOSD;
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);
+ strOSD.Format(ResStr(IDS_OSD_RS_TARGET_VSYNC_OFFSET), r.m_RenderSettings.fTargetSyncOffset);
} else {
++r.m_RenderSettings.iVMR9VSyncOffset;
- Format.Format(L"VSync Offset: %d", r.m_RenderSettings.iVMR9VSyncOffset);
+ strOSD.Format(ResStr(IDS_OSD_RS_VSYNC_OFFSET), r.m_RenderSettings.iVMR9VSyncOffset);
}
r.UpdateData(true);
- m_OSD.DisplayMessage(OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, strOSD);
}
void CMainFrame::OnViewVSyncOffsetDecrease()
{
AppSettings& s = AfxGetAppSettings();
CRenderersSettings& r = s.m_RenderersSettings;
- CString Format;
+ CString strOSD;
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);
+ strOSD.Format(ResStr(IDS_OSD_RS_TARGET_VSYNC_OFFSET), r.m_RenderSettings.fTargetSyncOffset);
} else {
--r.m_RenderSettings.iVMR9VSyncOffset;
- Format.Format(L"VSync Offset: %d", r.m_RenderSettings.iVMR9VSyncOffset);
+ strOSD.Format(ResStr(IDS_OSD_RS_VSYNC_OFFSET), r.m_RenderSettings.iVMR9VSyncOffset);
}
r.UpdateData(true);
- m_OSD.DisplayMessage(OSD_TOPRIGHT, Format);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, strOSD);
}
void CMainFrame::OnUpdateViewRemainingTime(CCmdUI* pCmdUI)
@@ -6284,7 +6309,7 @@ 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 {
@@ -6293,13 +6318,12 @@ void CMainFrame::OnShaderToggle()
}
m_OSD.DisplayMessage (OSD_TOPRIGHT, ResStr(IDS_MAINFRM_66));
}
-
}
void CMainFrame::OnShaderToggleScreenSpace()
{
m_bToggleShaderScreenSpace = !m_bToggleShaderScreenSpace;
- if (!m_bToggleShaderScreenSpace) {
+ if (m_bToggleShaderScreenSpace) {
SetShaders();
m_OSD.DisplayMessage (OSD_TOPRIGHT, ResStr(IDS_MAINFRM_PPONSCR));
} else {
@@ -6308,7 +6332,6 @@ void CMainFrame::OnShaderToggleScreenSpace()
}
m_OSD.DisplayMessage (OSD_TOPRIGHT, ResStr(IDS_MAINFRM_PPOFFSCR));
}
-
}
void CMainFrame::OnD3DFullscreenToggle()
@@ -6317,7 +6340,7 @@ void CMainFrame::OnD3DFullscreenToggle()
LPCTSTR strMsg;
s.fD3DFullscreen = !s.fD3DFullscreen;
- strMsg = s.fD3DFullscreen ? ResStr(IDS_MAINFRM_67) : _T("D3D Fullscreen off");
+ strMsg = s.fD3DFullscreen ? ResStr(IDS_OSD_RS_D3D_FULLSCREEN_ON) : ResStr(IDS_OSD_RS_D3D_FULLSCREEN_OFF);
if (m_iMediaLoadState == MLS_CLOSED) {
m_closingmsg = strMsg;
@@ -6350,12 +6373,13 @@ void CMainFrame::OnViewCaptionmenu()
}
DWORD dwRemove = 0, dwAdd = 0;
+ DWORD dwFlags = SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER;
HMENU hMenu = NULL;
CRect wr;
GetWindowRect( &wr );
- switch(s.iCaptionMenuMode) {
+ switch (s.iCaptionMenuMode) {
case MODE_SHOWCAPTIONMENU: // borderless -> normal
dwAdd = WS_CAPTION | WS_THICKFRAME;
hMenu = m_hMenuDefault;
@@ -6383,8 +6407,11 @@ void CMainFrame::OnViewCaptionmenu()
ModifyStyle(dwRemove, dwAdd, SWP_NOZORDER);
::SetMenu(m_hWnd, hMenu);
- // NOTE: r.left and r.top are ignored due to SWP_NOMOVE flag
- SetWindowPos(NULL, wr.left, wr.top, wr.Width(), wr.Height(), SWP_FRAMECHANGED|/*SWP_NOSIZE|*/SWP_NOMOVE|SWP_NOZORDER);
+ if (IsZoomed()) { // If the window is maximized, we want it to stay maximized.
+ dwFlags |= SWP_NOSIZE;
+ }
+ // NOTE: wr.left and wr.top are ignored due to SWP_NOMOVE flag
+ SetWindowPos(NULL, wr.left, wr.top, wr.Width(), wr.Height(), dwFlags);
MoveVideoWindow();
}
@@ -6444,7 +6471,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);
@@ -6459,7 +6486,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);
@@ -6474,7 +6501,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);
@@ -6489,7 +6516,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();
}
}
@@ -6540,7 +6567,7 @@ 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);
@@ -6552,7 +6579,7 @@ 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);
@@ -6564,7 +6591,7 @@ 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);
@@ -6632,7 +6659,7 @@ void CMainFrame::OnViewSwitchVideoFrame()
} else {
vs++;
}
- switch(vs) { // TODO: Read messages from resource file
+ switch (vs) { // TODO: Read messages from resource file
case DVS_STRETCH:
m_OSD.DisplayMessage (OSD_TOPLEFT, ResStr(IDS_STRETCH_TO_WINDOW));
break;
@@ -6681,14 +6708,14 @@ void CMainFrame::OnUpdateViewCompMonDeskARDiff(CCmdUI* pCmdUI)
void CMainFrame::OnViewPanNScan(UINT nID)
{
- if(m_iMediaLoadState != MLS_LOADED) {
+ if (m_iMediaLoadState != MLS_LOADED) {
return;
}
int x = 0, y = 0;
int dx = 0, dy = 0;
- switch(nID) {
+ switch (nID) {
case ID_VIEW_RESET:
m_ZoomX = m_ZoomY = 1.0;
m_PosX = m_PosY = 0.5;
@@ -6745,29 +6772,29 @@ void CMainFrame::OnViewPanNScan(UINT nID)
break;
}
- if(x > 0 && m_ZoomX < 3) {
+ if (x > 0 && m_ZoomX < 3) {
m_ZoomX *= 1.02;
}
- if(x < 0 && m_ZoomX > 0.2) {
+ if (x < 0 && m_ZoomX > 0.2) {
m_ZoomX /= 1.02;
}
- if(y > 0 && m_ZoomY < 3) {
+ if (y > 0 && m_ZoomY < 3) {
m_ZoomY *= 1.02;
}
- if(y < 0 && m_ZoomY > 0.2) {
+ if (y < 0 && m_ZoomY > 0.2) {
m_ZoomY /= 1.02;
}
- if(dx < 0 && m_PosX > 0) {
+ if (dx < 0 && m_PosX > 0) {
m_PosX = max(m_PosX - 0.005*m_ZoomX, 0);
}
- if(dx > 0 && m_PosX < 1) {
+ if (dx > 0 && m_PosX < 1) {
m_PosX = min(m_PosX + 0.005*m_ZoomX, 1);
}
- if(dy < 0 && m_PosY > 0) {
+ if (dy < 0 && m_PosY > 0) {
m_PosY = max(m_PosY - 0.005*m_ZoomY, 0);
}
- if(dy > 0 && m_PosY < 1) {
+ if (dy > 0 && m_PosY < 1) {
m_PosY = min(m_PosY + 0.005*m_ZoomY, 1);
}
@@ -6781,7 +6808,7 @@ void CMainFrame::OnUpdateViewPanNScan(CCmdUI* pCmdUI)
void CMainFrame::OnViewPanNScanPresets(UINT nID)
{
- if(m_iMediaLoadState != MLS_LOADED) {
+ if (m_iMediaLoadState != MLS_LOADED) {
return;
}
@@ -6789,10 +6816,10 @@ void CMainFrame::OnViewPanNScanPresets(UINT nID)
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);
}
@@ -6807,13 +6834,13 @@ 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) {
+ if (_stscanf_s(token, _T("%f"), &f) != 1) {
continue;
}
- switch(j) {
+ switch (j) {
case 0:
break;
case 1:
@@ -6833,7 +6860,7 @@ void CMainFrame::OnViewPanNScanPresets(UINT nID)
}
}
- if(j != 5) {
+ if (j != 5) {
return;
}
@@ -6854,11 +6881,11 @@ void CMainFrame::OnUpdateViewPanNScanPresets(CCmdUI* pCmdUI)
void CMainFrame::OnViewRotate(UINT nID)
{
- if(!m_pCAP) {
+ if (!m_pCAP) {
return;
}
- switch(nID) {
+ switch (nID) {
case ID_PANSCAN_ROTATEXP:
m_AngleX += 2;
break;
@@ -6903,7 +6930,7 @@ void CMainFrame::OnViewAspectRatio(UINT nID)
ar = s_ar[nID - ID_ASPECTRATIO_START];
CString info;
- if(ar.cx && ar.cy) {
+ if (ar.cx && ar.cy) {
info.Format(ResStr(IDS_MAINFRM_68), ar.cx, ar.cy);
} else {
info.Format(ResStr(IDS_MAINFRM_69));
@@ -6927,8 +6954,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;
}
@@ -6940,7 +6967,7 @@ 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);
@@ -6962,31 +6989,32 @@ 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) {
+ if (m_iMediaLoadState == MLS_LOADED) {
+ if (GetMediaState() == State_Stopped) {
m_iSpeedLevel = 0;
+ m_dSpeedRate = 1.0;
}
- if(GetPlaybackMode() == PM_FILE) {
- m_iSpeedLevel = 0;
- if(m_fEndOfStream) {
+ if (GetPlaybackMode() == PM_FILE) {
+ if (m_fEndOfStream) {
SendMessage(WM_COMMAND, ID_PLAY_STOP);
}
- pMS->SetRate (1.0);
+ pMS->SetRate(m_dSpeedRate);
pMC->Run();
- } else if(GetPlaybackMode() == PM_DVD) {
+ } else if (GetPlaybackMode() == PM_DVD) {
double dRate = 1.0;
m_iSpeedLevel = 0;
+ m_dSpeedRate = 1.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) {
@@ -6999,7 +7027,7 @@ void CMainFrame::OnPlayPlay()
}
SetTimersPlay();
- if(m_fFrameSteppingActive) { // FIXME
+ if (m_fFrameSteppingActive) { // FIXME
m_fFrameSteppingActive = false;
pBA->put_Volume(m_VolumeBeforeFrameStepping);
} else {
@@ -7013,23 +7041,24 @@ void CMainFrame::OnPlayPlay()
m_Lcd.SetStatusMessage(ResStr(IDS_CONTROLS_PLAYING), 3000);
SetPlayState (PS_PLAY);
+ OnTimer(TIMER_STREAMPOSPOLLER);
+
m_OpenFile = false;
}
void CMainFrame::OnPlayPauseI()
{
- if(m_iMediaLoadState == MLS_LOADED) {
- //SetAlwaysOnTop(AfxGetAppSettings().iOnTop);
+ if (m_iMediaLoadState == MLS_LOADED) {
- 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();
}
- SetTimersPlay();
+ KillTimer(TIMER_STATS);
SetAlwaysOnTop(AfxGetAppSettings().iOnTop);
}
@@ -7042,7 +7071,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();
}
@@ -7053,17 +7082,17 @@ void CMainFrame::OnPlayPause()
void CMainFrame::OnPlayPlaypause()
{
OAFilterState fs = GetMediaState();
- if(fs == State_Running) {
+ if (fs == State_Running) {
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
- } else if(fs == State_Stopped || fs == State_Paused) {
+ } 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();
@@ -7076,10 +7105,10 @@ void CMainFrame::OnPlayStop()
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);
}
@@ -7087,17 +7116,18 @@ 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;
+ m_dSpeedRate = 1.0;
- if(m_fFrameSteppingActive) { // FIXME
+ if (m_fFrameSteppingActive) { // FIXME
m_fFrameSteppingActive = false;
pBA->put_Volume(m_VolumeBeforeFrameStepping);
}
@@ -7107,11 +7137,11 @@ 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;
@@ -7139,22 +7169,22 @@ 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) {
+ 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) {
+ } else if (m_fCapturing) {
fEnable = false;
- } else if(m_fLiveWM && pCmdUI->m_nID == ID_PLAY_PAUSE) {
+ } else if (m_fLiveWM && pCmdUI->m_nID == ID_PLAY_PAUSE) {
fEnable = false;
}
- } else if(GetPlaybackMode() == PM_DVD) {
+ } 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) {
+ if (fs == State_Stopped && pCmdUI->m_nID == ID_PLAY_PAUSE) {
fEnable = false;
}
}
@@ -7169,14 +7199,14 @@ 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);
}
@@ -7192,22 +7222,22 @@ 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) {
+ if (nID == ID_PLAY_FRAMESTEP) {
rt++;
- } else if(nID == ID_PLAY_FRAMESTEPCANCEL) {
+ } 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) {
+ if (GetMediaState() != State_Paused) {
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
}
@@ -7217,9 +7247,9 @@ void CMainFrame::OnPlayFramestep(UINT nID)
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;
}
}
@@ -7235,9 +7265,9 @@ void CMainFrame::OnPlayFramestep(UINT nID)
} 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);
@@ -7248,17 +7278,17 @@ void CMainFrame::OnUpdatePlayFramestep(CCmdUI* pCmdUI)
{
bool fEnable = false;
- if(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly &&
+ 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)) {
+ 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;
}
}
@@ -7279,12 +7309,12 @@ void CMainFrame::OnPlaySeek(UINT nID)
nID == ID_PLAY_SEEKFORWARDLARGE ? +10000i64*s.nJumpDistL :
0;
- if(!dt) {
+ if (!dt) {
return;
}
// HACK: the custom graph should support frame based seeking instead
- if(m_fShockwaveGraph) {
+ if (m_fShockwaveGraph) {
dt /= 10000i64*100;
}
@@ -7309,25 +7339,25 @@ 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]) {
+ 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) {
+ if (j == mid) {
mid--;
}
j = mid;
- } else if(val > midt) {
+ } else if (val > midt) {
ret = mid;
- if(i == mid) {
+ if (i == mid) {
mid++;
}
i = mid;
@@ -7339,10 +7369,10 @@ 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);
}
@@ -7352,7 +7382,7 @@ void CMainFrame::OnPlaySeekKey(UINT nID)
int dec = 1;
int i = rangebsearch(rtCurrent, m_kfs);
- if(i > 0) {
+ if (i > 0) {
dec = (UINT)max(min(rtCurrent - m_kfs[i-1], 10000000), 0);
}
@@ -7362,9 +7392,9 @@ 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 {
return;
@@ -7390,11 +7420,11 @@ 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)) {
+ if (GetPlaybackMode() == PM_DVD && (m_iDVDDomain != DVD_DOMAIN_Title || fs != State_Running)) {
fEnable = false;
- } else if(GetPlaybackMode() == PM_CAPTURE) {
+ } else if (GetPlaybackMode() == PM_CAPTURE) {
fEnable = false;
}
}
@@ -7409,25 +7439,25 @@ void CMainFrame::OnPlayGoto()
}
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) {
+ if (atpf > 0) {
break;
}
BeginEnumPins(pBF, pEP, pPin) {
- if(atpf > 0) {
+ 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;
}
}
@@ -7437,7 +7467,7 @@ 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) {
+ if (IDOK != dlg.DoModal() || dlg.m_time < 0) {
return;
}
@@ -7448,11 +7478,11 @@ 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) {
+ if (GetPlaybackMode() == PM_DVD && m_iDVDDomain != DVD_DOMAIN_Title) {
fEnable = false;
- } else if(GetPlaybackMode() == PM_CAPTURE) {
+ } else if (GetPlaybackMode() == PM_CAPTURE) {
fEnable = false;
}
}
@@ -7462,12 +7492,12 @@ 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);
}
@@ -7481,20 +7511,20 @@ void CMainFrame::OnPlayChangeRate(UINT nID)
// long lSignalStrength;
do {
- if(nID == ID_PLAY_DECRATE) {
+ if (nID == ID_PLAY_DECRATE) {
lChannel--;
- } else if(nID == ID_PLAY_INCRATE) {
+ } 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;
}
@@ -7502,7 +7532,7 @@ void CMainFrame::OnPlayChangeRate(UINT nID)
pAMTuner->AutoTune(lChannel, &flFoundSignal);
pAMTuner->get_VideoFrequency(&lFreqNew);
- } while(FALSE);
+ } while (FALSE);
/* SUCCEEDED(pAMTuner->SignalPresent(&lSignalStrength))
&& (lSignalStrength != AMTUNER_SIGNALPRESENT || lFreqNew == lFreqOrg));*/
@@ -7510,9 +7540,9 @@ void CMainFrame::OnPlayChangeRate(UINT nID)
int iNewSpeedLevel;
// Cap the max FFWD and RWD rates to 128x.
- if(nID == ID_PLAY_INCRATE) {
+ if (nID == ID_PLAY_INCRATE) {
iNewSpeedLevel = (m_iSpeedLevel < 7 ? m_iSpeedLevel+1 : 7);
- } else if(nID == ID_PLAY_DECRATE) {
+ } else if (nID == ID_PLAY_DECRATE) {
iNewSpeedLevel = (m_iSpeedLevel > -7 ? m_iSpeedLevel-1 : -7);
} else {
return;
@@ -7520,46 +7550,43 @@ void CMainFrame::OnPlayChangeRate(UINT nID)
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) {
+ 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) {
+ 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 {
hr = pDVDC->PlayBackwards(dRate, DVD_CMD_FLAG_Block, NULL);
}
}
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
CString strMessage;
m_iSpeedLevel = iNewSpeedLevel;
+ m_dSpeedRate = dRate;
- if (dRate == 1.0) {
- m_OSD.DisplayMessage (OSD_TOPRIGHT, _T("Play"));
- } else {
- strMessage.Format (_T("%s x %.01f"), (iNewSpeedLevel > 0)?_T(">"):_T("<"), fabs(dRate));
- m_OSD.DisplayMessage (OSD_TOPRIGHT, strMessage);
- }
+ strMessage.Format(ResStr(IDS_OSD_SPEED), (iNewSpeedLevel < 0 && GetPlaybackMode() == PM_DVD) ? -dRate : dRate);
+ m_OSD.DisplayMessage(OSD_TOPRIGHT, strMessage);
}
}
@@ -7570,23 +7597,23 @@ 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) {
+ if (fInc && m_iSpeedLevel >= 7) {
fEnable = false;
- } else if(!fInc && GetPlaybackMode() == PM_FILE && m_iSpeedLevel <= -4) {
+ } else if (!fInc && GetPlaybackMode() == PM_FILE && m_iSpeedLevel <= -4) {
fEnable = false;
- } else if(!fInc && GetPlaybackMode() == PM_DVD && m_iSpeedLevel <= -11) {
+ } else if (!fInc && GetPlaybackMode() == PM_DVD && m_iSpeedLevel <= -11) {
fEnable = false;
- } else if(GetPlaybackMode() == PM_DVD && m_iDVDDomain != DVD_DOMAIN_Title) {
+ } else if (GetPlaybackMode() == PM_DVD && m_iDVDDomain != DVD_DOMAIN_Title) {
fEnable = false;
- } else if(m_fRealMediaGraph || m_fShockwaveGraph) {
+ } else if (m_fRealMediaGraph || m_fShockwaveGraph) {
fEnable = false;
- } else if(GetPlaybackMode() == PM_CAPTURE && (!m_wndCaptureBar.m_capdlg.IsTunerActive() || m_fCapturing)) {
+ } else if (GetPlaybackMode() == PM_CAPTURE && (!m_wndCaptureBar.m_capdlg.IsTunerActive() || m_fCapturing)) {
fEnable = false;
- } else if(m_fLiveWM) {
+ } else if (m_fLiveWM) {
fEnable = false;
}
}
@@ -7596,24 +7623,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;
+ m_dSpeedRate = 1.0;
}
}
@@ -7625,7 +7653,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;
@@ -7637,7 +7665,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;
@@ -7649,7 +7677,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 :
@@ -7673,17 +7701,17 @@ void CMainFrame::OnPlayFilters(UINT nID)
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();
}
@@ -7695,48 +7723,30 @@ void CMainFrame::OnUpdatePlayFilters(CCmdUI* pCmdUI)
}
enum {
- ID_SHADERS_OFF = ID_SHADERS_START,
- ID_SHADERS_COMBINE,
- ID_SHADERS_EDIT,
- ID_SHADERS_STARTSCR,
- ID_SHADERS_OFFSCR = ID_SHADERS_STARTSCR,
- ID_SHADERS_COMBINESCR,
- ID_SHADERS_ENDSCR,
- ID_SHADERS_DYNAMIC = ID_SHADERS_ENDSCR,
+ ID_SHADERS_SELECT = ID_SHADERS_START,
+ ID_SHADERS_SELECT_SCREENSPACE,
+ ID_SHADERS_EDIT
};
void CMainFrame::OnPlayShaders(UINT nID)
{
- if(nID == ID_SHADERS_EDIT) {
+ if (nID == ID_SHADERS_EDIT) {
ShowControlBar(&m_wndShaderEditorBar, TRUE, TRUE);
return;
}
- if(!m_pCAP) {
+ if (!m_pCAP) {
return;
}
- if(nID == ID_SHADERS_OFF) {
- m_shaderlabels.RemoveAll();
- } else if(nID == ID_SHADERS_OFFSCR) {
- m_shaderlabelsScreenSpace.RemoveAll();
- } else if(nID == ID_SHADERS_COMBINE) {
- if(IDOK != CShaderCombineDlg(m_shaderlabels, GetModalParent(), false).DoModal()) {
+ if (nID == ID_SHADERS_SELECT) {
+ 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_SELECT_SCREENSPACE) {
+ if (IDOK != CShaderCombineDlg(m_shaderlabelsScreenSpace, GetModalParent(), true).DoModal()) {
return;
}
- } else if(nID >= ID_SHADERS_DYNAMIC) {
- MENUITEMINFO mii;
- memset(&mii, 0, sizeof(mii));
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_DATA;
- m_shaders.GetMenuItemInfo(nID, &mii);
-
- m_shaderlabels.RemoveAll();
- m_shaderlabels.AddTail(((const AppSettings::Shader*)mii.dwItemData)->label);
}
SetShaders();
@@ -7744,41 +7754,13 @@ 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 ) {
- pCmdUI->Enable(!!m_pCAP2);
- } else {
+ switch (pCmdUI->m_nID) {
+ case ID_SHADERS_SELECT:
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);
-
- pCmdUI->SetRadio(m_shaderlabels.GetCount() == 1
- && m_shaderlabels.GetHead() == ((AppSettings::Shader*)mii.dwItemData)->label);
- }
break;
- }
+ case ID_SHADERS_SELECT_SCREENSPACE:
+ pCmdUI->Enable(!!m_pCAP2);
+ break;
}
}
@@ -7787,13 +7769,13 @@ void CMainFrame::OnPlayAudio(UINT nID)
int i = (int)nID - (1 + ID_AUDIO_SUBITEM_START);
CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
- if(!pSS) {
+ 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);
}
@@ -7805,23 +7787,23 @@ void CMainFrame::OnUpdatePlayAudio(CCmdUI* pCmdUI)
int i = (int)nID - (1 + ID_AUDIO_SUBITEM_START);
CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
- if(!pSS) {
+ if (!pSS) {
pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB);
}
- /*if(i == -1)
+ /*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) {
+ if (SUCCEEDED(pSS->Info(i, NULL, &flags, NULL, NULL, NULL, NULL, NULL))) {
+ if (flags&AMSTREAMSELECTINFO_EXCLUSIVE) {
pCmdUI->SetRadio(TRUE);
- } else if(flags&AMSTREAMSELECTINFO_ENABLED) {
+ } else if (flags&AMSTREAMSELECTINFO_ENABLED) {
pCmdUI->SetCheck(TRUE);
} else {
pCmdUI->SetCheck(FALSE);
@@ -7836,31 +7818,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);
@@ -7873,16 +7855,16 @@ void CMainFrame::OnPlaySubtitles(UINT nID)
CString m_style = ResStr(IDS_SUBTITLES_STYLES);
int i = m_style.Find(_T("&"));
- if(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);
@@ -7894,23 +7876,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) {
+ 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();
@@ -7926,23 +7908,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;
}
@@ -7950,15 +7932,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));
}
}
@@ -7968,10 +7950,10 @@ 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]) {
+ while (i > 0 && pAMSS == m_ssarray[i-1]) {
i--;
}
- if(FAILED(pAMSS->Enable(nID-i, AMSTREAMSELECTENABLE_ENABLE))) {
+ if (FAILED(pAMSS->Enable(nID-i, AMSTREAMSELECTENABLE_ENABLE))) {
MessageBeep((UINT)-1);
}
@@ -7984,14 +7966,14 @@ 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]) {
+ 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) {
+ if (flags&AMSTREAMSELECTINFO_EXCLUSIVE) {
pCmdUI->SetRadio(TRUE);
- } else if(flags&AMSTREAMSELECTINFO_ENABLED) {
+ } else if (flags&AMSTREAMSELECTINFO_ENABLED) {
pCmdUI->SetCheck(TRUE);
} else {
pCmdUI->SetCheck(FALSE);
@@ -8000,12 +7982,12 @@ void CMainFrame::OnUpdatePlayLanguage(CCmdUI* pCmdUI)
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 {
strVolume.Format(ResStr(IDS_VOLUME_OSD), m_wndToolBar.m_volctrl.GetPos());
@@ -8022,7 +8004,7 @@ void CMainFrame::OnPlayVolumeBoost(UINT nID)
int i = (int)(s.dAudioBoost_dB*10+0.1);
- switch(nID) {
+ switch (nID) {
case ID_VOLUME_BOOST_INC:
i = min(i+10, 100);
break;
@@ -8048,7 +8030,7 @@ void CMainFrame::SetVolumeBoost(float fAudioBoost_dB)
s.dAudioBoost_dB = fAudioBoost_dB;
strBoost.Format(ResStr(IDS_BOOST_OSD), s.dAudioBoost_dB);
- 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);
@@ -8068,7 +8050,7 @@ void CMainFrame::OnAfterplayback(UINT nID)
s.nCLSwitches &= ~CLSW_AFTERPLAYBACK_MASK;
- switch(nID) {
+ switch (nID) {
case ID_AFTERPLAYBACK_NEXT :
s.fNextInDirAfterPlayback = true;
s.fExitAfterPlayback = false;
@@ -8105,7 +8087,7 @@ void CMainFrame::OnUpdateAfterplayback(CCmdUI* pCmdUI)
bool fChecked = false;
- switch(pCmdUI->m_nID) {
+ switch (pCmdUI->m_nID) {
case ID_AFTERPLAYBACK_EXIT:
fChecked = !!s.fExitAfterPlayback;
break;
@@ -8138,14 +8120,14 @@ void CMainFrame::OnUpdateAfterplayback(CCmdUI* pCmdUI)
// navigate
void CMainFrame::OnNavigateSkip(UINT nID)
{
- if(GetPlaybackMode() == PM_FILE) {
- if(GetPlaybackMode() == PM_FILE) {
+ if (GetPlaybackMode() == PM_FILE) {
+ if (GetPlaybackMode() == PM_FILE) {
SetupChapters();
}
flast_nID = nID;
- if(DWORD nChapters = m_pCB->ChapGetCount()) {
+ if (DWORD nChapters = m_pCB->ChapGetCount()) {
REFERENCE_TIME rtCur;
pMS->GetCurrentPosition(&rtCur);
@@ -8153,18 +8135,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) {
+ 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);
@@ -8178,27 +8160,28 @@ 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 (nID == ID_NAVIGATE_SKIPBACK) {
if (!SearchInDir(false)) {
m_OSD.DisplayMessage(OSD_TOPLEFT, ResStr(IDS_FIRST_IN_FOLDER));
}
- } else if(nID == ID_NAVIGATE_SKIPFORWARD) {
+ } 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;
+ m_dSpeedRate = 1.0;
- if(GetMediaState() != State_Running) {
+ if (GetMediaState() != State_Running) {
SendMessage(WM_COMMAND, ID_PLAY_PLAY);
}
@@ -8213,8 +8196,8 @@ 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 {
@@ -8232,15 +8215,15 @@ void CMainFrame::OnNavigateSkip(UINT nID)
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 {
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);
@@ -8248,7 +8231,7 @@ void CMainFrame::OnNavigateSkip(UINT nID)
m_wndSeekBar.GetRange(start, stop);
CString m_strOSD;
- if(stop>0)
+ 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 {
@@ -8259,12 +8242,12 @@ void CMainFrame::OnNavigateSkip(UINT nID)
}
/*
- if(nID == ID_NAVIGATE_SKIPBACK)
+ if (nID == ID_NAVIGATE_SKIPBACK)
pDVDC->PlayPrevChapter(DVD_CMD_FLAG_Block, NULL);
- else if(nID == ID_NAVIGATE_SKIPFORWARD)
+ else if (nID == ID_NAVIGATE_SKIPFORWARD)
pDVDC->PlayNextChapter(DVD_CMD_FLAG_Block, NULL);
*/
- } else if(GetPlaybackMode() == PM_CAPTURE) {
+ } else if (GetPlaybackMode() == PM_CAPTURE) {
if (AfxGetAppSettings().iDefaultCaptureDevice == 1) {
CComQIPtr<IBDATuner> pTun = pGB;
if (pTun) {
@@ -8273,13 +8256,13 @@ void CMainFrame::OnNavigateSkip(UINT nID)
nCurrentChannel = s.nDVBLastChannel;
- if(nID == ID_NAVIGATE_SKIPBACK) {
+ if (nID == ID_NAVIGATE_SKIPBACK) {
pTun->SetChannel (nCurrentChannel - 1);
DisplayCurrentChannelOSD();
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()) {
@@ -8296,7 +8279,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
@@ -8309,14 +8292,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) {
+ if (nID == ID_NAVIGATE_SKIPBACKPLITEM) {
m_wndPlaylistBar.SetPrev();
- } else if(nID == ID_NAVIGATE_SKIPFORWARDPLITEM) {
+ } else if (nID == ID_NAVIGATE_SKIPFORWARDPLITEM) {
m_wndPlaylistBar.SetNext();
}
@@ -8335,13 +8318,14 @@ 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;
+ m_dSpeedRate = 1.0;
- if(GetMediaState() != State_Running) {
+ if (GetMediaState() != State_Running) {
SendMessage(WM_COMMAND, ID_PLAY_PLAY);
}
@@ -8353,7 +8337,7 @@ void CMainFrame::OnUpdateNavigateMenu(CCmdUI* pCmdUI)
UINT nID = pCmdUI->m_nID - ID_NAVIGATE_TITLEMENU;
ULONG ulUOPs;
- if(m_iMediaLoadState != MLS_LOADED || GetPlaybackMode() != PM_DVD
+ if (m_iMediaLoadState != MLS_LOADED || GetPlaybackMode() != PM_DVD
|| FAILED(pDVDI->GetCurrentUOPS(&ulUOPs))) {
pCmdUI->Enable(FALSE);
return;
@@ -8366,24 +8350,24 @@ 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 {
@@ -8397,9 +8381,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);
}
}
@@ -8408,11 +8392,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);
@@ -8427,12 +8411,12 @@ void CMainFrame::OnNavigateChapters(UINT nID)
nID -= m_pCB->ChapGetCount();
- if((int)nID >= 0 && (int)nID < m_wndPlaylistBar.GetCount()
+ if ((int)nID >= 0 && (int)nID < m_wndPlaylistBar.GetCount()
&& 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;
@@ -8446,18 +8430,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 {
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);
@@ -8465,7 +8449,7 @@ void CMainFrame::OnNavigateChapters(UINT nID)
m_wndSeekBar.GetRange(start, stop);
CString m_strOSD;
- if(stop>0)
+ 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 {
@@ -8474,7 +8458,7 @@ void CMainFrame::OnNavigateChapters(UINT nID)
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) {
@@ -8496,8 +8480,8 @@ void CMainFrame::OnNavigateMenuItem(UINT nID)
{
nID -= ID_NAVIGATE_MENU_LEFT;
- if(GetPlaybackMode() == PM_DVD) {
- switch(nID) {
+ if (GetPlaybackMode() == PM_DVD) {
+ switch (nID) {
case 0:
pDVDC->SelectRelativeButton(DVD_Relative_Left);
break;
@@ -8575,7 +8559,7 @@ public:
__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) {
+ if (pcbRead) {
*pcbRead = (ULONG)cbRead;
}
m_pos += cbRead;
@@ -8584,10 +8568,10 @@ public:
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) {
+ if (pcbWritten) {
*pcbWritten = cbWritten;
}
return S_OK;
@@ -8628,23 +8612,23 @@ void CMainFrame::OnFavoritesAdd()
{
AppSettings& s = AfxGetAppSettings();
- if(GetPlaybackMode() == PM_FILE) {
+ if (GetPlaybackMode() == PM_FILE) {
CString fn = m_wndPlaylistBar.GetCurFileName();
- if(fn.IsEmpty()) {
+ if (fn.IsEmpty()) {
return;
}
CString desc = fn;
desc.Replace('\\', '/');
int i = desc.Find(_T("://")), j = desc.Find(_T("?")), k = desc.ReverseFind('/');
- if(i >= 0) {
+ if (i >= 0) {
desc = j >= 0 ? desc.Left(j) : desc;
- } else if(k >= 0) {
+ } else if (k >= 0) {
desc = desc.Mid(k+1);
}
CFavoriteAddDlg dlg(desc, fn);
- if(dlg.DoModal() != IDOK) {
+ if (dlg.DoModal() != IDOK) {
return;
}
@@ -8654,7 +8638,7 @@ void CMainFrame::OnFavoritesAdd()
// RememberPos
CString pos(_T("0"));
- if(dlg.m_bRememberPos) {
+ if (dlg.m_bRememberPos) {
pos.Format(_T("%I64d"), GetPos());
}
@@ -8670,15 +8654,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) {
+ 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);
@@ -8692,7 +8676,7 @@ void CMainFrame::OnFavoritesAdd()
Location.TimeCode.bHours, Location.TimeCode.bMinutes, Location.TimeCode.bSeconds);
CFavoriteAddDlg dlg(fn, desc);
- if(dlg.DoModal() != IDOK) {
+ if (dlg.DoModal() != IDOK) {
return;
}
@@ -8702,13 +8686,13 @@ void CMainFrame::OnFavoritesAdd()
// RememberPos
CString pos(_T("0"));
- if(dlg.m_bRememberPos) {
+ if (dlg.m_bRememberPos) {
CDVDStateStream stream;
stream.AddRef();
CComPtr<IDvdState> pStateData;
CComQIPtr<IPersistStream> pPersistStream;
- if(SUCCEEDED(pDVDI->GetState(&pStateData))
+ if (SUCCEEDED(pDVDI->GetState(&pStateData))
&& (pPersistStream = pStateData)
&& SUCCEEDED(OleSaveToStream(pPersistStream, (IStream*)&stream))) {
pos = BinToCString(stream.m_data.GetData(), stream.m_data.GetCount());
@@ -8723,7 +8707,7 @@ void CMainFrame::OnFavoritesAdd()
str += fn;
s.AddFav(FAV_DVD, str);
- } else if(GetPlaybackMode() == PM_CAPTURE) {
+ } else if (GetPlaybackMode() == PM_CAPTURE) {
// TODO
}
}
@@ -8738,23 +8722,23 @@ void CMainFrame::OnFavoritesQuickAddFavorite()
{
AppSettings& s = AfxGetAppSettings();
- if(GetPlaybackMode() == PM_FILE) {
+ if (GetPlaybackMode() == PM_FILE) {
CString fn = m_wndPlaylistBar.GetCurFileName();
- if(fn.IsEmpty()) {
+ if (fn.IsEmpty()) {
return;
}
CString desc = fn;
desc.Replace('\\', '/');
int i = desc.Find(_T("://")), j = desc.Find(_T("?")), k = desc.ReverseFind('/');
- if(i >= 0) {
+ if (i >= 0) {
desc = j >= 0 ? desc.Left(j) : desc;
- } else if(k >= 0) {
+ } else if (k >= 0) {
desc = desc.Mid(k+1);
}
CString fn_with_pos(desc);
- if(s.bFavRememberPos) {
+ if (s.bFavRememberPos) {
fn_with_pos.Format(_T("%s_%s"), desc, GetVidPos()); // Add file position (time format) so it will be easier to organize later
}
@@ -8764,7 +8748,7 @@ void CMainFrame::OnFavoritesQuickAddFavorite()
// RememberPos
CString pos(_T("0"));
- if(s.bFavRememberPos) {
+ if (s.bFavRememberPos) {
pos.Format(_T("%I64d"), GetPos());
}
@@ -8780,15 +8764,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) {
+ 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);
@@ -8807,13 +8791,13 @@ void CMainFrame::OnFavoritesQuickAddFavorite()
// RememberPos
CString pos(_T("0"));
- if(s.bFavRememberPos) {
+ if (s.bFavRememberPos) {
CDVDStateStream stream;
stream.AddRef();
CComPtr<IDvdState> pStateData;
CComQIPtr<IPersistStream> pPersistStream;
- if(SUCCEEDED(pDVDI->GetState(&pStateData))
+ if (SUCCEEDED(pDVDI->GetState(&pStateData))
&& (pPersistStream = pStateData)
&& SUCCEEDED(OleSaveToStream(pPersistStream, (IStream*)&stream))) {
pos = BinToCString(stream.m_data.GetData(), stream.m_data.GetCount());
@@ -8828,7 +8812,7 @@ void CMainFrame::OnFavoritesQuickAddFavorite()
str += fn;
s.AddFav(FAV_DVD, str);
- } else if(GetPlaybackMode() == PM_CAPTURE) {
+ } else if (GetPlaybackMode() == PM_CAPTURE) {
// TODO
}
}
@@ -8846,16 +8830,16 @@ 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++) {
+ for (int i = 0; i < s.MRU.GetSize(); i++) {
s.MRU[i] = _T("");
}
- for(int i = 0; i < s.MRUDub.GetSize(); i++) {
+ for (int i = 0; i < s.MRUDub.GetSize(); i++) {
s.MRUDub[i] = _T("");
}
s.MRU.WriteList();
@@ -8874,20 +8858,20 @@ 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;
int i = 0, j = 0;
- for(CString s1 = sl.GetAt(pos), s2 = s1.Tokenize(_T(";"), i);
+ for (CString s1 = sl.GetAt(pos), s2 = s1.Tokenize(_T(";"), i);
!s2.IsEmpty();
s2 = s1.Tokenize(_T(";"), i), j++) {
- if(j == 0) {
+ if (j == 0) {
; // desc / name
- } else if(j == 1) {
+ } else if (j == 1) {
_stscanf_s(s2, _T("%I64d"), &rtStart); // pos
- } else if(j == 2) {
+ } else if (j == 2) {
_stscanf_s(s2, _T("%d"), &bRelativeDrive); // relative drive
} else {
fns.AddTail(s2); // paths
@@ -8943,9 +8927,11 @@ void CMainFrame::OnRecentFile(UINT nID)
nID -= ID_RECENT_FILE_START;
CString str;
m_recentfiles.GetMenuString(nID+2, str, MF_BYPOSITION);
- CAtlList<CString> fns;
- fns.AddTail(str);
- m_wndPlaylistBar.Open(fns, false);
+ if (!m_wndPlaylistBar.SelectFileInPlaylist(str)) {
+ CAtlList<CString> fns;
+ fns.AddTail(str);
+ m_wndPlaylistBar.Open(fns, false);
+ }
OpenCurPlaylistItem(0);
}
@@ -8962,21 +8948,21 @@ 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;
stream.AddRef();
int i = 0, j = 0;
- for(CString s1 = sl.GetAt(pos), s2 = s1.Tokenize(_T(";"), i);
+ for (CString s1 = sl.GetAt(pos), s2 = s1.Tokenize(_T(";"), i);
!s2.IsEmpty();
s2 = s1.Tokenize(_T(";"), i), j++) {
- if(j == 0) {
+ if (j == 0) {
; // desc
- } else if(j == 1 && s2 != _T("0")) { // state
+ } else if (j == 1 && s2 != _T("0")) { // state
CStringToBin(s2, stream.m_data);
- } else if(j == 2) {
+ } else if (j == 2) {
fn = s2; // path
}
}
@@ -8988,7 +8974,7 @@ void CMainFrame::OnFavoritesDVD(UINT nID)
UNUSED_ALWAYS(hr);
CAutoPtr<OpenDVDData> p(DNew OpenDVDData());
- if(p) {
+ if (p) {
p->path = fn;
p->pDvdState = pDvdState;
}
@@ -9033,7 +9019,7 @@ void CMainFrame::OnHelpToolbarImages()
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);
}
}
@@ -9053,10 +9039,10 @@ 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 {
@@ -9068,7 +9054,7 @@ 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;
}
@@ -9079,26 +9065,27 @@ void CMainFrame::SetDefaultWindowRect(int iMonitor)
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);
- if(s.iCaptionMenuMode == MODE_SHOWCAPTIONMENU)
+ if (s.iCaptionMenuMode == MODE_SHOWCAPTIONMENU) {
h += GetSystemMetrics(SM_CYMENU);
+ }
//else MODE_HIDEMENU
}
}
bool inmonitor = false;
- if(s.fRememberWindowPos) {
+ if (s.fRememberWindowPos) {
CMonitor monitor;
CMonitors monitors;
POINT ptA;
ptA.x = s.rcLastWindowPos.TopLeft().x;
ptA.y = s.rcLastWindowPos.TopLeft().y;
inmonitor = (ptA.x<0 || ptA.y<0);
- if(!inmonitor) {
+ if (!inmonitor) {
for ( int i = 0; i < monitors.GetCount(); i++ ) {
monitor = monitors.GetMonitor( i );
- if(monitor.IsOnMonitor(ptA)) {
+ if (monitor.IsOnMonitor(ptA)) {
inmonitor = true;
break;
}
@@ -9106,17 +9093,17 @@ void CMainFrame::SetDefaultWindowRect(int iMonitor)
}
}
- if(s.fRememberWindowPos && inmonitor) {
+ if (s.fRememberWindowPos && inmonitor) {
x = s.rcLastWindowPos.TopLeft().x;
y = s.rcLastWindowPos.TopLeft().y;
} 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()) {
+ if (iMonitor < ml.GetCount()) {
hMonitor = ml[iMonitor];
}
}
@@ -9133,30 +9120,31 @@ void CMainFrame::SetDefaultWindowRect(int iMonitor)
MoveWindow(x, y, w, h);
if (s.iCaptionMenuMode!=MODE_SHOWCAPTIONMENU) {
- if (s.iCaptionMenuMode==MODE_FRAMEONLY)
+ if (s.iCaptionMenuMode==MODE_FRAMEONLY) {
ModifyStyle(WS_CAPTION, 0, SWP_NOZORDER);
- else if (s.iCaptionMenuMode==MODE_BORDERLESS)
+ } else if (s.iCaptionMenuMode==MODE_BORDERLESS) {
ModifyStyle(WS_CAPTION | WS_THICKFRAME, 0, SWP_NOZORDER);
+ }
::SetMenu(m_hWnd, NULL);
SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER);
}
- if(!s.fRememberWindowPos) {
+ 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);
}
@@ -9173,12 +9161,12 @@ void CMainFrame::RestoreDefaultWindowRect()
WINDOWPLACEMENT wp;
GetWindowPlacement(&wp);
- if(!m_fFullScreen && wp.showCmd != SW_SHOWMAXIMIZED && wp.showCmd != SW_SHOWMINIMIZED
+ if (!m_fFullScreen && wp.showCmd != SW_SHOWMAXIMIZED && wp.showCmd != SW_SHOWMINIMIZED
// && (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 {
@@ -9196,15 +9184,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);
- if(s.iCaptionMenuMode == MODE_SHOWCAPTIONMENU)
+ if (s.iCaptionMenuMode == MODE_SHOWCAPTIONMENU) {
h += GetSystemMetrics(SM_CYMENU);
+ }
//else MODE_HIDEMENU
}
}
- if(s.fRememberWindowPos) {
+ if (s.fRememberWindowPos) {
x = s.rcLastWindowPos.TopLeft().x;
y = s.rcLastWindowPos.TopLeft().y;
} else {
@@ -9217,7 +9206,7 @@ void CMainFrame::RestoreDefaultWindowRect()
MoveWindow(x, y, w, h);
- if(!s.fRememberWindowPos) {
+ if (!s.fRememberWindowPos) {
CenterWindow();
}
}
@@ -9226,7 +9215,7 @@ void CMainFrame::RestoreDefaultWindowRect()
OAFilterState CMainFrame::GetMediaState()
{
OAFilterState ret = -1;
- if(m_iMediaLoadState == MLS_LOADED) {
+ if (m_iMediaLoadState == MLS_LOADED) {
pMC->GetState(0, &ret);
}
return(ret);
@@ -9246,7 +9235,7 @@ 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;
}
@@ -9254,7 +9243,7 @@ CSize CMainFrame::GetVideoSize()
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 {
@@ -9264,23 +9253,23 @@ CSize CMainFrame::GetVideoSize()
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) {
+ if (ar.cx && ar.cy) {
arxy = ar;
}
@@ -9288,20 +9277,20 @@ CSize CMainFrame::GetVideoSize()
? wh
: CSize(MulDiv(wh.cy, arxy.cx, arxy.cy), wh.cy);
- if(fCompMonDeskARDiff)
- if(HDC hDC = ::GetDC(0)) {
+ if (fCompMonDeskARDiff)
+ 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);
}
}
@@ -9314,7 +9303,9 @@ CSize CMainFrame::GetVideoSize()
void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasTo)
{
- if(m_pFullscreenWnd->IsWindow()) return;
+ if (m_pFullscreenWnd->IsWindow()) {
+ return;
+ }
AppSettings& s = AfxGetAppSettings();
CRect r;
@@ -9330,48 +9321,48 @@ 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(s.bHidePlaylistFullScreen && m_PlayListBarVisible) {
+ if (s.bHidePlaylistFullScreen && m_PlayListBarVisible) {
ShowControlBar(&m_wndPlaylistBar, !m_PlayListBarVisible, TRUE);
}
- if(!m_fFirstFSAfterLaunchOnFS) {
+ if (!m_fFirstFSAfterLaunchOnFS) {
GetWindowRect(&m_lastWindowRect);
}
- if(s.AutoChangeFullscrRes.bEnabled && fSwitchScreenResWhenHasTo && (GetPlaybackMode() != PM_NONE)) {
+ 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++ ) {
monitor = monitors.GetMonitor( i );
monitor.GetName(str);
- if((monitor.IsMonitor()) && (s.strFullScreenMonitor == str)) {
+ if ((monitor.IsMonitor()) && (s.strFullScreenMonitor == str)) {
hm = monitor;
break;
}
}
- if(!hm) {
+ if (!hm) {
hm = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
}
}
dwRemove = WS_CAPTION|WS_THICKFRAME;
GetMonitorInfo(hm, &mi);
- if(fToNearest) {
+ if (fToNearest) {
r = mi.rcMonitor;
} else {
GetDesktopWindow()->GetWindowRect(&r);
}
hMenu = NULL;
} else {
- if(s.AutoChangeFullscrRes.bEnabled && s.AutoChangeFullscrRes.bApplyDefault) {
+ if (s.AutoChangeFullscrRes.bEnabled && s.AutoChangeFullscrRes.bApplyDefault) {
SetDispMode(s.AutoChangeFullscrRes.dmFullscreenResOther, s.strFullScreenMonitor);
}
@@ -9381,7 +9372,7 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT
}
hMenu = (s.iCaptionMenuMode==MODE_SHOWCAPTIONMENU) ? m_hMenuDefault: NULL;
- if(s.bHidePlaylistFullScreen) {
+ if (s.bHidePlaylistFullScreen) {
ShowControlBar(&m_wndPlaylistBar, m_PlayListBarVisible, TRUE);
}
}
@@ -9402,35 +9393,35 @@ 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);
- if((m_Change_Monitor) && (!m_bToggleShader)) {
+ if ((m_Change_Monitor) && (!m_bToggleShader)) {
if (m_pCAP) {
m_pCAP->SetPixelShader(NULL, NULL);
}
}
- if((m_Change_Monitor) && (!m_bToggleShaderScreenSpace)) {
+ if (m_Change_Monitor && m_bToggleShaderScreenSpace) {
if (m_pCAP2) {
- m_pCAP2->SetPixelShader2(NULL, NULL, 1);
+ m_pCAP2->SetPixelShader2(NULL, NULL, true);
}
}
} else {
- if((m_Change_Monitor) && (!m_bToggleShader)) {
+ 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);
}
@@ -9439,8 +9430,8 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT
ShowControlBar(&m_wndNavigationBar, false, TRUE);
}
- if(s.fPreventMinimize) {
- if(hm != hm_cur) {
+ if (s.fPreventMinimize) {
+ if (hm != hm_cur) {
ModifyStyle(WS_MINIMIZEBOX, 0, SWP_NOZORDER);
}
}
@@ -9457,10 +9448,14 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT
m_fAudioOnly = fAudioOnly;
+ // Temporarily hide the OSD message if there is one, it will
+ // be restored after. This avoid positioning problems.
+ m_OSD.HideMessage(true);
+
if (m_fFirstFSAfterLaunchOnFS) { //Play started in Fullscreen
- if(s.fRememberWindowSize || s.fRememberWindowPos) {
+ 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;
@@ -9468,25 +9463,25 @@ 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) {
+ 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) {
+ if (m_LastWindow_HM != hm_cur) {
ShowWindow(SW_SHOW);
}
}
@@ -9497,7 +9492,9 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT
MoveVideoWindow();
- if((m_Change_Monitor) && (!m_bToggleShader || !m_bToggleShaderScreenSpace)) { // Enabled shader ...
+ m_OSD.HideMessage(false);
+
+ if ((m_Change_Monitor) && (!m_bToggleShader || !m_bToggleShaderScreenSpace)) { // Enabled shader ...
SetShaders();
}
}
@@ -9516,7 +9513,7 @@ void CMainFrame::AutoChangeMonitorMode()
BeginEnumPins(pBF, pEP, pPin) {
CMediaTypeEx mt;
PIN_DIRECTION dir;
- if(FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_OUTPUT
+ if (FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_OUTPUT
|| FAILED(pPin->ConnectionMediaType(&mt))) {
continue;
}
@@ -9570,11 +9567,11 @@ void CMainFrame::AutoChangeMonitorMode()
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()) {
m_pFullscreenWnd->GetClientRect(&wr);
- } else if(!m_fFullScreen) {
+ } else if (!m_fFullScreen) {
m_wndView.GetClientRect(&wr);
} else {
GetWindowRect(&wr);
@@ -9588,7 +9585,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;
@@ -9602,14 +9599,14 @@ void CMainFrame::MoveVideoWindow(bool fShowStats)
int w = ws.cx;
int h = ws.cy;
- if(!m_fShockwaveGraph) { //&& !m_fQuicktimeGraph)
- if(iDefaultVideoSize == DVS_FROMINSIDE || iDefaultVideoSize == DVS_FROMOUTSIDE ||
+ if (!m_fShockwaveGraph) { //&& !m_fQuicktimeGraph)
+ if (iDefaultVideoSize == DVS_FROMINSIDE || iDefaultVideoSize == DVS_FROMOUTSIDE ||
iDefaultVideoSize == DVS_ZOOM1 || iDefaultVideoSize == DVS_ZOOM2) {
int dh = ws.cy;
int dw = MulDiv(dh, arxy.cx, arxy.cy);
int i = 0;
- switch(iDefaultVideoSize) {
+ switch (iDefaultVideoSize) {
case DVS_ZOOM1:
i = 1;
break;
@@ -9622,9 +9619,9 @@ void CMainFrame::MoveVideoWindow(bool fShowStats)
}
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;
}
@@ -9655,7 +9652,7 @@ 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 {
@@ -9671,7 +9668,7 @@ void CMainFrame::MoveVideoWindow(bool fShowStats)
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);
@@ -9688,7 +9685,7 @@ void CMainFrame::HideVideoWindow(bool fHide)
CRect wr;
if (m_pFullscreenWnd->IsWindow()) {
m_pFullscreenWnd->GetClientRect(&wr);
- } else if(!m_fFullScreen) {
+ } else if (!m_fFullScreen) {
m_wndView.GetClientRect(&wr);
} else {
GetWindowRect(&wr);
@@ -9700,7 +9697,7 @@ void CMainFrame::HideVideoWindow(bool fHide)
}
CRect vr = CRect(0,0,0,0);
- if(m_pCAP) {
+ if (m_pCAP) {
if (fHide) {
m_pCAP->SetPosition(wr, vr); //hide
} else {
@@ -9712,13 +9709,13 @@ void CMainFrame::HideVideoWindow(bool fHide)
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 :
@@ -9727,7 +9724,7 @@ void CMainFrame::ZoomVideoWindow(bool snap, double scale)
1.0;
}
- if(m_fFullScreen) {
+ if (m_fFullScreen) {
OnViewFullscreen();
}
@@ -9738,7 +9735,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);
@@ -9760,8 +9757,9 @@ void CMainFrame::ZoomVideoWindow(bool snap, double scale)
if ( style & WS_CAPTION ) {
h += GetSystemMetrics( SM_CYCAPTION );
- if(s.iCaptionMenuMode == MODE_SHOWCAPTIONMENU)
+ if (s.iCaptionMenuMode == MODE_SHOWCAPTIONMENU) {
h += GetSystemMetrics( SM_CYMENU );
+ }
//else MODE_HIDEMENU
}
@@ -9784,22 +9782,22 @@ 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
+ if (snap && s.fSnapToDesktopEdges) { // check if snapped to edges
isSnapped = (r.left == mi.rcWork.left) || (r.top == mi.rcWork.top)
|| (r.right == mi.rcWork.right) || (r.bottom == mi.rcWork.bottom);
}
- if(isSnapped) { // prefer left, top snap to right, bottom snap
- if(r.left == mi.rcWork.left) {}
- else if(r.right == mi.rcWork.right) {
+ if (isSnapped) { // prefer left, top snap to right, bottom snap
+ if (r.left == mi.rcWork.left) {}
+ 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) {
+ if (r.top == mi.rcWork.top) {}
+ else if (r.bottom == mi.rcWork.bottom) {
r.top = r.bottom - h;
}
} else { // center window
@@ -9812,20 +9810,20 @@ void CMainFrame::ZoomVideoWindow(bool snap, double scale)
r.right = r.left + w;
r.bottom = r.top + h;
- if(r.right > mi.rcWork.right) {
+ if (r.right > mi.rcWork.right) {
r.OffsetRect(mi.rcWork.right-r.right, 0);
}
- if(r.left < mi.rcWork.left) {
+ if (r.left < mi.rcWork.left) {
r.OffsetRect(mi.rcWork.left-r.left, 0);
}
- if(r.bottom > mi.rcWork.bottom) {
+ if (r.bottom > mi.rcWork.bottom) {
r.OffsetRect(0, mi.rcWork.bottom-r.bottom);
}
- if(r.top < mi.rcWork.top) {
+ 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);
}
@@ -9836,7 +9834,7 @@ void CMainFrame::ZoomVideoWindow(bool snap, double scale)
double CMainFrame::GetZoomAutoFitScale()
{
- if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly) {
+ if (m_iMediaLoadState != MLS_LOADED || m_fAudioOnly) {
return 1.0;
}
@@ -9850,14 +9848,14 @@ double CMainFrame::GetZoomAutoFitScale()
void CMainFrame::RepaintVideo()
{
- if(m_pCAP) {
+ if (m_pCAP) {
m_pCAP->Paint(false);
}
}
void CMainFrame::SetShaders()
{
- if(!m_pCAP) {
+ if (!m_pCAP) {
return;
}
@@ -9866,7 +9864,7 @@ void CMainFrame::SetShaders()
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;
}
@@ -9877,10 +9875,10 @@ void CMainFrame::SetShaders()
}
for (int i = 0; i < 2; ++i) {
- if (i == 0 && m_bToggleShader) {
+ if (i == 0 && !m_bToggleShader) {
continue;
}
- if (i == 1 && m_bToggleShaderScreenSpace) {
+ if (i == 1 && !m_bToggleShaderScreenSpace) {
continue;
}
CAtlList<CString> labels;
@@ -9896,9 +9894,9 @@ void CMainFrame::SetShaders()
}
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;
@@ -9909,7 +9907,7 @@ void CMainFrame::SetShaders()
hr = m_pCAP2->SetPixelShader2(srcdata, target, true);
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pCAP->SetPixelShader(NULL, NULL);
if (m_pCAP2) {
m_pCAP2->SetPixelShader2(NULL, NULL, true);
@@ -9922,7 +9920,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);
@@ -9932,29 +9930,29 @@ void CMainFrame::SetShaders()
void CMainFrame::UpdateShaders(CString label)
{
- if(!m_pCAP) {
+ 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) {
+ if (fUpdate) {
SetShaders();
}
@@ -9966,22 +9964,24 @@ void CMainFrame::SetBalance(int balance)
int sign = balance>0?-1:1; // -1: invert sign for more right channel
int balance_dB;
- if (balance > -100 && balance < 100)
+ if (balance > -100 && balance < 100) {
balance_dB = sign*(int)(100*20*log10(1-abs(balance)/100.0f));
- else
- balance_dB = sign*(-10000);// -10000: only left, 10000: only right
+ } else {
+ balance_dB = sign*(-10000); // -10000: only left, 10000: only right
+ }
- if(m_iMediaLoadState == MLS_LOADED) {
+ if (m_iMediaLoadState == MLS_LOADED) {
CString strBalance, strBalanceOSD;
pBA->put_Balance(balance_dB);
- if (balance == 0)
+ if (balance == 0) {
strBalance = L"L = R";
- else if (balance < 0)
+ } else if (balance < 0) {
strBalance.Format(L"L +%d%%", -balance);
- else //if (m_nBalance > 0)
+ } else { //if (m_nBalance > 0)
strBalance.Format(L"R +%d%%", balance);
+ }
strBalanceOSD.Format(ResStr(IDS_BALANCE_OSD), strBalance);
m_OSD.DisplayMessage(OSD_TOPLEFT, strBalanceOSD);
@@ -9990,18 +9990,18 @@ void CMainFrame::SetBalance(int balance)
void CMainFrame::SetupIViAudReg()
{
- if(!AfxGetAppSettings().fAutoSpeakerConf) {
+ if (!AfxGetAppSettings().fAutoSpeakerConf) {
return;
}
DWORD spc = 0, defchnum = 0;
- if(AfxGetAppSettings().fAutoSpeakerConf) {
+ if (AfxGetAppSettings().fAutoSpeakerConf) {
CComPtr<IDirectSound> pDS;
- if(SUCCEEDED(DirectSoundCreate(NULL, &pDS, NULL))
+ if (SUCCEEDED(DirectSoundCreate(NULL, &pDS, NULL))
&& SUCCEEDED(pDS->SetCooperativeLevel(m_hWnd, DSSCL_NORMAL))) {
- if(SUCCEEDED(pDS->GetSpeakerConfig(&spc))) {
- switch(spc) {
+ if (SUCCEEDED(pDS->GetSpeakerConfig(&spc))) {
+ switch (spc) {
case DSSPEAKER_DIRECTOUT:
defchnum = 6;
break;
@@ -10035,12 +10035,12 @@ void CMainFrame::SetupIViAudReg()
}
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))) {
+ 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 (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);
}
}
@@ -10053,7 +10053,7 @@ 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) {
return false;
@@ -10084,73 +10084,73 @@ void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD)
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) {
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;
- } 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;
}
}
@@ -10159,12 +10159,12 @@ void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD)
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)) {
+ } else if (OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD)) {
if (s.iDefaultCaptureDevice == 1) {
pGB = DNew CFGManagerBDA(_T("CFGManagerBDA"), NULL, m_pVideoWnd->m_hWnd);
} else {
@@ -10172,7 +10172,7 @@ void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD)
}
}
- if(!pGB) {
+ if (!pGB) {
throw ResStr(IDS_MAINFRM_80);
}
@@ -10186,19 +10186,19 @@ void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD)
pBA = pGB; // audio
pFS = pGB;
- if(!(pMC && pME && pMS)
+ if (!(pMC && pME && pMS)
|| !(pVW && pBV)
|| !(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);
}
@@ -10217,7 +10217,7 @@ CWnd *CMainFrame::GetModalParent()
void CMainFrame::OpenFile(OpenFileData* pOFD)
{
- if(pOFD->fns.IsEmpty()) {
+ if (pOFD->fns.IsEmpty()) {
throw ResStr(IDS_MAINFRM_81);
}
@@ -10226,11 +10226,11 @@ void CMainFrame::OpenFile(OpenFileData* pOFD)
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;
}
@@ -10244,18 +10244,18 @@ void CMainFrame::OpenFile(OpenFileData* pOFD)
}
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()) {
+ if (pGBDE && pGBDE->GetCount()) {
CMediaTypesDlg(pGBDE, GetModalParent()).DoModal();
}
}
CString err;
- switch(hr) {
+ switch (hr) {
case E_ABORT:
err = ResStr(IDS_MAINFRM_82);
break;
@@ -10297,7 +10297,7 @@ void CMainFrame::OpenFile(OpenFileData* pOFD)
}
}
- if(s.fKeepHistory) {
+ if (s.fKeepHistory) {
CRecentFileList* pMRU = fFirst ? &s.MRU : &s.MRUDub;
pMRU->ReadList();
pMRU->Add(fn);
@@ -10305,33 +10305,33 @@ void CMainFrame::OpenFile(OpenFileData* pOFD)
SHAddToRecentDocs(SHARD_PATH, fn);
}
- if(fFirst) {
+ if (fFirst) {
pOFD->title = fn;
}
fFirst = false;
- if(m_fCustomGraph) {
+ if (m_fCustomGraph) {
break;
}
}
- if(s.fReportFailedPins) {
+ if (s.fReportFailedPins) {
CComQIPtr<IGraphBuilderDeadEnd> pGBDE = pGB;
- if(pGBDE && pGBDE->GetCount()) {
+ if (pGBDE && pGBDE->GetCount()) {
CMediaTypesDlg(pGBDE, GetModalParent()).DoModal();
}
}
- if(!(pAMOP = pGB)) {
+ if (!(pAMOP = pGB)) {
BeginEnumFilters(pGB, pEF, pBF)
- if(pAMOP = pBF) {
+ if (pAMOP = pBF) {
break;
}
EndEnumFilters;
}
- if(FindFilter(__uuidof(CShoutcastSource), pGB)) {
+ if (FindFilter(__uuidof(CShoutcastSource), pGB)) {
m_fUpdateInfoBar = true;
}
@@ -10339,14 +10339,14 @@ void CMainFrame::OpenFile(OpenFileData* pOFD)
CComQIPtr<IKeyFrameInfo> pKFI;
BeginEnumFilters(pGB, pEF, pBF)
- if(pKFI = pBF) {
+ 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();
}
}
@@ -10368,45 +10368,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) {
+ 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) {
+ if (!pCI) {
continue;
}
CHAR iso6391[3];
::GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, iso6391, 3);
CStringA iso6392 = ISO6391To6392(iso6391);
- if(iso6392.GetLength() < 3) {
+ 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;
@@ -10417,24 +10417,24 @@ 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) {
+ 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;
}
@@ -10445,32 +10445,32 @@ 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()) {
+ 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;
}
@@ -10478,7 +10478,7 @@ void CMainFrame::SetupChapters()
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;
}
@@ -10498,37 +10498,37 @@ void CMainFrame::OpenDVD(OpenDVDData* pODD)
AppSettings& s = AfxGetAppSettings();
- if(s.fReportFailedPins) {
+ if (s.fReportFailedPins) {
CComQIPtr<IGraphBuilderDeadEnd> pGBDE = pGB;
- if(pGBDE && pGBDE->GetCount()) {
+ if (pGBDE && pGBDE->GetCount()) {
CMediaTypesDlg(pGBDE, GetModalParent()).DoModal();
}
}
BeginEnumFilters(pGB, pEF, pBF) {
- if((pDVDC = pBF) && (pDVDI = 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));
}
@@ -10536,13 +10536,13 @@ void CMainFrame::OpenDVD(OpenDVDData* pODD)
pDVDC->SetOption(DVD_ResetOnStop, FALSE);
pDVDC->SetOption(DVD_HMSF_TimeCodeEvents, TRUE);
- if(s.idMenuLang) {
+ if (s.idMenuLang) {
pDVDC->SelectDefaultMenuLanguage(s.idMenuLang);
}
- if(s.idAudioLang) {
+ if (s.idAudioLang) {
pDVDC->SelectDefaultAudioLanguage(s.idAudioLang, DVD_AUD_EXT_NotSpecified);
}
- if(s.idSubtitlesLang) {
+ if (s.idSubtitlesLang) {
pDVDC->SelectDefaultSubpictureLanguage(s.idSubtitlesLang, DVD_SP_EXT_NotSpecified);
}
@@ -10568,21 +10568,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);
}
@@ -10590,7 +10590,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);
}
@@ -10598,53 +10598,53 @@ 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(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap))
+ 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))) {
TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture"));
}
- if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Interleaved, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCPrev))
+ 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))) {
TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture"));
}
- if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, pVidCap, IID_IAMStreamConfig, (void **)&pAMASC))
+ 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))) {
TRACE(_T("Warning: No IAMStreamConfig interface for vidcap"));
} else {
pAudCap = pVidCap;
}
} else {
- if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap))) {
+ 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)
+ if (pAMVSCCap)
{
//DumpStreamConfig(_T("c:\\mpclog.txt"), pAMVSCCap);
CComQIPtr<IAMVfwCaptureDialogs> pVfwCD = pVidCap;
- if(!pAMXBar && pVfwCD)
+ if (!pAMXBar && pVfwCD)
{
m_wndCaptureBar.m_capdlg.SetupVideoControls(viddispname, pAMVSCCap, pVfwCD);
}
@@ -10656,35 +10656,35 @@ 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) {
+ if (vchannel < 0) {
vchannel = AfxGetApp()->GetProfileInt(_T("Capture\\") + CString(m_VidDispName), _T("Channel"), -1);
}
- if(vchannel >= 0) {
+ if (vchannel >= 0) {
OAFilterState fs = State_Stopped;
pMC->GetState(0, &fs);
- if(fs == State_Running) {
+ if (fs == State_Running) {
pMC->Pause();
}
pAMTuner->put_Channel(vchannel, AMTUNER_SUBCHAN_DEFAULT, AMTUNER_SUBCHAN_DEFAULT);
- if(fs == State_Running) {
+ 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))
+ 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))) {
TRACE(_T("Warning: No IAMStreamConfig interface for vidcap"));
}
@@ -10694,22 +10694,22 @@ void CMainFrame::OpenCapture(OpenDeviceData* pODD)
BeginEnumPins(pAudCap, pEP, pPin)
{
PIN_DIRECTION dir;
- if(FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_INPUT)
+ if (FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_INPUT)
continue;
- if(CComQIPtr<IAMAudioInputMixer> pAIM = pPin)
+ if (CComQIPtr<IAMAudioInputMixer> pAIM = pPin)
pAMAIM.Add(pAIM);
}
EndEnumPins;
- if(pAMASC)
+ if (pAMASC)
{
m_wndCaptureBar.m_capdlg.SetupAudioControls(auddispname, pAMASC, pAMAIM);
}
*/
}
- if(!(pVidCap || pAudCap)) {
+ if (!(pVidCap || pAudCap)) {
throw ResStr(IDS_MAINFRM_108);
}
@@ -10720,14 +10720,14 @@ 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();
}
}
@@ -10757,14 +10757,14 @@ void CMainFrame::OpenCustomizeGraph()
}
}
- if(GetPlaybackMode() == PM_DVD) {
+ if (GetPlaybackMode() == PM_DVD) {
BeginEnumFilters(pGB, pEF, pBF) {
- if(CComQIPtr<IDirectVobSub2> pDVS2 = pBF) {
+ if (CComQIPtr<IDirectVobSub2> pDVS2 = pBF) {
// pDVS2->AdviseSubClock(m_pSubClock = DNew CSubClock);
// break;
// TODO: test multiple dvobsub instances with one clock
- if(!m_pSubClock) {
+ if (!m_pSubClock) {
m_pSubClock = DNew CSubClock;
}
pDVS2->AdviseSubClock(m_pSubClock);
@@ -10774,49 +10774,49 @@ void CMainFrame::OpenCustomizeGraph()
}
BeginEnumFilters(pGB, pEF, pBF) {
- if(GetCLSID(pBF) == CLSID_OggSplitter) {
- if(CComQIPtr<IAMStreamSelect> pSS = pBF) {
+ if (GetCLSID(pBF) == CLSID_OggSplitter) {
+ if (CComQIPtr<IAMStreamSelect> pSS = pBF) {
LCID idAudio = s.idAudioLang;
- if(!idAudio) {
+ if (!idAudio) {
idAudio = GetUserDefaultLCID();
}
LCID idSub = s.idSubtitlesLang;
- if(!idSub) {
+ 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...
+ 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))) {
+ 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...
+ 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))) {
+ if (SUCCEEDED(pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE))) {
idSub = (LCID)-1;
}
}
- if(pmt) {
+ if (pmt) {
DeleteMediaType(pmt);
}
- if(pszName) {
+ if (pszName) {
CoTaskMemFree(pszName);
}
}
@@ -10835,29 +10835,29 @@ void CMainFrame::OpenSetupVideo()
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 {
{
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) {
+ 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;
}
@@ -10865,7 +10865,7 @@ void CMainFrame::OpenSetupVideo()
pVW->get_Height(&h);
}
- if(w > 0 && h > 0) {
+ if (w > 0 && h > 0) {
m_fAudioOnly = false;
break;
}
@@ -10874,11 +10874,11 @@ void CMainFrame::OpenSetupVideo()
}
}
- if(m_fShockwaveGraph) {
+ if (m_fShockwaveGraph) {
m_fAudioOnly = false;
}
- if(m_pCAP) {
+ if (m_pCAP) {
SetShaders();
}
// else
@@ -10889,7 +10889,7 @@ 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()) {
+ for (CWnd* pWnd = m_wndView.GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
pWnd->EnableWindow(FALSE); // little trick to let WM_SETCURSOR thru
}
}
@@ -10907,10 +10907,11 @@ void CMainFrame::OpenSetupAudio()
int balance = AfxGetAppSettings().nBalance;
int sign = balance>0?-1:1; // -1: invert sign for more right channel
- if (balance > -100 && balance < 100)
+ if (balance > -100 && balance < 100) {
balance = sign*(int)(100*20*log10(1-abs(balance)/100.0f));
- else
- balance = sign*(-10000);// -10000: only left, 10000: only right
+ } else {
+ balance = sign*(-10000); // -10000: only left, 10000: only right
+ }
pBA->put_Balance(balance);
}
@@ -10923,22 +10924,22 @@ 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 {
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) {
+ if (CComQIPtr<IAMAudioInputMixer> pAIM = pPin) {
pAMAIM.Add(pAIM);
}
}
@@ -10955,54 +10956,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) {
+ 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()) {
+ 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()) {
+ 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()) {
+ 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()) {
+ 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()) {
+ 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);
@@ -11018,7 +11019,7 @@ void CMainFrame::OpenSetupStatsBar()
CString info('-');
BeginEnumFilters(pGB, pEF, pBF) {
- if(!pQP && (pQP = 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);
@@ -11028,7 +11029,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();
@@ -11043,24 +11044,24 @@ void CMainFrame::OpenSetupStatusBar()
//
- if(!m_fCustomGraph) {
+ if (!m_fCustomGraph) {
UINT id = IDB_NOAUDIO;
BeginEnumFilters(pGB, pEF, pBF) {
CComQIPtr<IBasicAudio> pBA = pBF;
- if(!pBA) {
+ if (!pBA) {
continue;
}
BeginEnumPins(pBF, pEP, pPin) {
- if(S_OK == pGB->IsPinDirection(pPin, PINDIR_INPUT)
+ if (S_OK == pGB->IsPinDirection(pPin, PINDIR_INPUT)
&& 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) {
+ if (mt.majortype == MEDIATYPE_Audio && mt.formattype == FORMAT_WaveFormatEx) {
+ switch (((WAVEFORMATEX*)mt.pbFormat)->nChannels) {
case 1:
id = IDB_MONO;
break;
@@ -11070,7 +11071,7 @@ void CMainFrame::OpenSetupStatusBar()
break;
}
break;
- } else if(mt.majortype == MEDIATYPE_Midi) {
+ } else if (mt.majortype == MEDIATYPE_Midi) {
id = NULL;
break;
}
@@ -11078,7 +11079,7 @@ void CMainFrame::OpenSetupStatusBar()
}
EndEnumPins;
- if(id != IDB_NOAUDIO) {
+ if (id != IDB_NOAUDIO) {
break;
}
}
@@ -11091,13 +11092,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
}
@@ -11112,19 +11113,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()) {
+ if (!fn2.IsEmpty()) {
fn = fn2;
}
- if(s.fTitleBarTextTitle) {
+ if (s.fTitleBarTextTitle) {
BeginEnumFilters(pGB, pEF, pBF) {
- if(CComQIPtr<IAMMediaContent, &IID_IAMMediaContent> pAMMC = 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;
}
@@ -11132,9 +11133,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");
}
}
@@ -11150,13 +11151,13 @@ 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);
@@ -11167,17 +11168,17 @@ 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;
@@ -11189,11 +11190,11 @@ 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 {
m_iAudioStreams.InsertBefore(prevPos, i);
@@ -11201,7 +11202,7 @@ void CMainFrame::InsertAudioStream(const CComQIPtr<IAMStreamSelect> &pSS, int i)
processed = true;
}
}
- if(!processed) {
+ if (!processed) {
m_iAudioStreams.AddTail(i);
}
}
@@ -11209,20 +11210,20 @@ void CMainFrame::InsertAudioStream(const CComQIPtr<IAMStreamSelect> &pSS, int 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) {
+ if (m_iMediaLoadState != MLS_LOADED) {
return;
}
m_iAudioStreams.RemoveAll();
CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
- if(!pSS) {
+ 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);
}
}
@@ -11232,7 +11233,7 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD)
{
AppSettings& s = AfxGetAppSettings();
- if(m_iMediaLoadState != MLS_CLOSED) {
+ if (m_iMediaLoadState != MLS_CLOSED) {
ASSERT(0);
return(false);
}
@@ -11240,7 +11241,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);
}
@@ -11261,24 +11262,24 @@ 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 {
@@ -11288,7 +11289,7 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD)
}
}
- if(ret != IDOK) {
+ if (ret != IDOK) {
return(false);
}
}
@@ -11309,27 +11310,27 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD)
CComPtr<IVMRMixerBitmap9> pVMB;
CComPtr<IMFVideoMixerBitmap> pMFVMB;
CComPtr<IMadVRTextOsd> pMVTO;
- if(m_fOpeningAborted) {
+ if (m_fOpeningAborted) {
throw aborted;
}
OpenCreateGraphObject(pOMD);
- if(m_fOpeningAborted) {
+ if (m_fOpeningAborted) {
throw aborted;
}
SetupIViAudReg();
- if(m_fOpeningAborted) {
+ if (m_fOpeningAborted) {
throw aborted;
}
- if(pFileData) {
+ if (pFileData) {
OpenFile(pFileData);
- } else if(pDVDData) {
+ } else if (pDVDData) {
OpenDVD(pDVDData);
- } else if(pDeviceData) {
+ } else if (pDeviceData) {
if (s.iDefaultCaptureDevice == 1) {
HRESULT hr = OpenBDAGraph();
if FAILED(hr) {
@@ -11376,32 +11377,32 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD)
m_pMFVDC->SetVideoPosition(NULL, &Rect);
}
- if(m_fOpeningAborted) {
+ if (m_fOpeningAborted) {
throw aborted;
}
OpenCustomizeGraph();
- if(m_fOpeningAborted) {
+ if (m_fOpeningAborted) {
throw aborted;
}
OpenSetupVideo();
- if(m_fOpeningAborted) {
+ if (m_fOpeningAborted) {
throw aborted;
}
OpenSetupAudio();
- if(m_fOpeningAborted) {
+ 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
@@ -11409,23 +11410,23 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD)
}
POSITION pos = pOMD->subs.GetHeadPosition();
- while(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;
}
}
@@ -11435,7 +11436,7 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD)
}
}
- if(m_fOpeningAborted) {
+ if (m_fOpeningAborted) {
throw aborted;
}
@@ -11445,19 +11446,19 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD)
m_wndEditListEditor.OpenFile(pOMD->title);
}
- if(pFileData) {
+ if (pFileData) {
m_OpenFile = true;
}
- if(::GetCurrentThreadId() == AfxGetApp()->m_nThreadID) {
+ if (::GetCurrentThreadId() == AfxGetApp()->m_nThreadID) {
OnFilePostOpenmedia();
} else {
PostMessage(WM_COMMAND, ID_FILE_POST_OPENMEDIA);
}
- while(m_iMediaLoadState != MLS_LOADED
+ while (m_iMediaLoadState != MLS_LOADED
&& m_iMediaLoadState != MLS_CLOSING // FIXME
- ) {
+ ) {
Sleep(50);
}
@@ -11467,27 +11468,27 @@ 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) {
+ 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) {
+ } 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) {
+ } else if (pDeviceData) {
m_wndCaptureBar.m_capdlg.SetVideoInput(pDeviceData->vinput);
m_wndCaptureBar.m_capdlg.SetVideoChannel(pDeviceData->vchannel);
m_wndCaptureBar.m_capdlg.SetAudioInput(pDeviceData->ainput);
@@ -11500,15 +11501,15 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD)
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);
- if(m_wndPlaylistBar.GetCount() > 1) {
- if(flast_nID == ID_NAVIGATE_SKIPBACK) {
+ if (m_wndPlaylistBar.GetCount() > 1) {
+ if (flast_nID == ID_NAVIGATE_SKIPBACK) {
m_wndPlaylistBar.SetPrev();
} else {
m_wndPlaylistBar.SetNext();
@@ -11543,34 +11544,33 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD)
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 {
m_strOSD = ResStr(ID_PLAY_PLAY);
int i = m_strOSD.Find(_T("\n"));
- if(i > 0) {
+ 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) {
+ if (i > 0) {
m_strOSD.Delete(i, m_strOSD.GetLength()-i);
}
m_strOSD += _T(" DVD");
}
- if(m_strOSD != _T("")) {
+ if (m_strOSD != _T("")) {
Sleep(500);
m_OSD.DisplayMessage(OSD_TOPLEFT, m_strOSD, 3000);
}
-
return(err.IsEmpty());
}
@@ -11581,7 +11581,6 @@ void CMainFrame::CloseMediaPrivate()
OnPlayStop(); // SendMessage(WM_COMMAND, ID_PLAY_STOP);
SetPlaybackMode(PM_NONE);
- m_iSpeedLevel = 0;
m_fLiveWM = false;
@@ -11593,8 +11592,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;
@@ -11627,7 +11626,7 @@ void CMainFrame::CloseMediaPrivate()
pBV.Release();
pBA.Release();
- if(pGB) {
+ if (pGB) {
pGB->RemoveFromROT();
pGB.Release();
}
@@ -11680,30 +11679,30 @@ int CMainFrame::SearchInDir(bool DirForward)
CString mask = dir + _T("*.*");
WIN32_FIND_DATA fd;
HANDLE h = FindFirstFile(mask, &fd);
- if(h != INVALID_HANDLE_VALUE) {
+ if (h != INVALID_HANDLE_VALUE) {
do {
- if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
+ 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) {
+ 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);
}
@@ -11729,7 +11728,7 @@ int CMainFrame::SearchInDir(bool DirForward)
void CMainFrame::DoTunerScan(TunerScanData* pTSD)
{
- if(GetPlaybackMode() == PM_CAPTURE) {
+ if (GetPlaybackMode() == PM_CAPTURE) {
CComQIPtr<IBDATuner> pTun = pGB;
if (pTun) {
BOOLEAN bPresent;
@@ -11742,7 +11741,7 @@ 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++) {
pTun->SetFrequency (ulFrequency + lOffsets[nOffsetPos]);
@@ -11772,28 +11771,28 @@ 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) {
+ if (i >= 0) {
fn = fn.Left(i);
}
}
@@ -11803,10 +11802,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();
}
@@ -11820,7 +11819,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";
@@ -11832,7 +11831,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);
}
@@ -11842,27 +11841,27 @@ 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) {
+ 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);
}
@@ -11881,41 +11880,41 @@ void CMainFrame::SetupOpenCDSubMenu()
{
CMenu* pSub = &m_opencds;
- if(!IsMenu(pSub->m_hMenu)) {
+ if (!IsMenu(pSub->m_hMenu)) {
pSub->CreatePopupMenu();
- } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ } else while (pSub->RemoveMenu(0, MF_BYPOSITION)) {
;
}
- if(m_iMediaLoadState == MLS_LOADING) {
+ if (m_iMediaLoadState == MLS_LOADING) {
return;
}
- if(AfxGetAppSettings().fHideCDROMsSubMenu) {
+ 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)) {
+ switch (GetCDROMType(drive, files)) {
case CDROM_Audio:
- if(label.IsEmpty()) {
+ if (label.IsEmpty()) {
label = _T("Audio CD");
}
str.Format(_T("%s (%c:)"), label, drive);
break;
case CDROM_VideoCD:
- if(label.IsEmpty()) {
+ if (label.IsEmpty()) {
label = _T("(S)VCD");
}
str.Format(_T("%s (%c:)"), label, drive);
break;
case CDROM_DVDVideo:
- if(label.IsEmpty()) {
+ if (label.IsEmpty()) {
label = _T("DVD Video");
}
str.Format(_T("%s (%c:)"), label, drive);
@@ -11924,7 +11923,7 @@ void CMainFrame::SetupOpenCDSubMenu()
break;
}
- if(!str.IsEmpty()) {
+ if (!str.IsEmpty()) {
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, str);
}
}
@@ -11934,9 +11933,9 @@ void CMainFrame::SetupFiltersSubMenu()
{
CMenu* pSub = &m_filters;
- if(!IsMenu(pSub->m_hMenu)) {
+ if (!IsMenu(pSub->m_hMenu)) {
pSub->CreatePopupMenu();
- } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ } else while (pSub->RemoveMenu(0, MF_BYPOSITION)) {
;
}
@@ -11945,24 +11944,24 @@ void CMainFrame::SetupFiltersSubMenu()
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) {
CString name(GetFilterName(pBF));
- if(name.GetLength() >= 43) {
+ 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) {
+ switch (c) {
case BI_RGB:
name += _T(" (RGB)");
break;
@@ -11981,15 +11980,15 @@ void CMainFrame::SetupFiltersSubMenu()
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;
}
@@ -12001,17 +12000,17 @@ void CMainFrame::SetupFiltersSubMenu()
CComQIPtr<ISpecifyPropertyPages> pSPP = pBF;
- /* if(pSPP)
+ /* if (pSPP)
{
CAUUID caGUID;
caGUID.pElems = NULL;
- if(SUCCEEDED(pSPP->GetPages(&caGUID)) && caGUID.cElems > 0)
+ if (SUCCEEDED(pSPP->GetPages(&caGUID)) && caGUID.cElems > 0)
{
*/
m_pparray.Add(pBF);
pSubSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ids, ResStr(IDS_MAINFRM_116));
/*
- if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
+ if (caGUID.pElems) CoTaskMemFree(caGUID.pElems);
*/
nPPages++;
/* }
@@ -12021,14 +12020,14 @@ void CMainFrame::SetupFiltersSubMenu()
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) {
+ if (caGUID.pElems) {
CoTaskMemFree(caGUID.pElems);
}
@@ -12039,7 +12038,7 @@ void CMainFrame::SetupFiltersSubMenu()
EndEnumPins;
CComQIPtr<IAMStreamSelect> pSS = pBF;
- if(pSS) {
+ if (pSS) {
DWORD nStreams = 0;
DWORD flags = (DWORD)-1;
DWORD group = (DWORD)-1;
@@ -12050,29 +12049,29 @@ void CMainFrame::SetupFiltersSubMenu()
pSS->Count(&nStreams);
- if(nStreams > 0 && nPPages > 0) {
+ 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));
@@ -12086,17 +12085,17 @@ void CMainFrame::SetupFiltersSubMenu()
CoTaskMemFree(wname);
}
- if(nStreams == 0) {
+ if (nStreams == 0) {
pSS.Release();
}
}
- if(nPPages == 1 && !pSS) {
+ if (nPPages == 1 && !pSS) {
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ids, name);
} 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;
@@ -12120,31 +12119,31 @@ void CMainFrame::SetupAudioSwitcherSubMenu()
{
CMenu* pSub = &m_audios;
- if(!IsMenu(pSub->m_hMenu)) {
+ if (!IsMenu(pSub->m_hMenu)) {
pSub->CreatePopupMenu();
- } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ } 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) {
+ 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;
}
@@ -12164,13 +12163,13 @@ void CMainFrame::SetupSubtitlesSubMenu()
{
CMenu* pSub = &m_subtitles;
- if(!IsMenu(pSub->m_hMenu)) {
+ if (!IsMenu(pSub->m_hMenu)) {
pSub->CreatePopupMenu();
- } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ } 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;
}
@@ -12178,7 +12177,7 @@ void CMainFrame::SetupSubtitlesSubMenu()
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));
@@ -12189,15 +12188,15 @@ void CMainFrame::SetupSubtitlesSubMenu()
pSub->AppendMenu(MF_SEPARATOR);
}
- while(pos) {
+ while (pos) {
CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
- if(!pSubStream) {
+ 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("&&"));
@@ -12209,12 +12208,12 @@ void CMainFrame::SetupSubtitlesSubMenu()
}
// 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);
}
}
@@ -12225,55 +12224,55 @@ void CMainFrame::SetupNavAudioSubMenu()
{
CMenu* pSub = &m_navaudio;
- if(!IsMenu(pSub->m_hMenu)) {
+ if (!IsMenu(pSub->m_hMenu)) {
pSub->CreatePopupMenu();
- } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ } else while (pSub->RemoveMenu(0, MF_BYPOSITION)) {
;
}
- if(m_iMediaLoadState != MLS_LOADED) {
+ 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) {
+ if (Language == DefLanguage) {
flags |= MF_DEFAULT;
}
- if(i == ulCurrentStream) {
+ 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) {
+ if (SUCCEEDED(pDVDI->GetAudioAttributes(i, &ATR))) {
+ switch (ATR.LanguageExtension) {
case DVD_AUD_EXT_NotSpecified:
default:
break;
@@ -12293,7 +12292,7 @@ void CMainFrame::SetupNavAudioSubMenu()
CString format = GetDVDAudioFormatName(ATR);
- if(!format.IsEmpty()) {
+ if (!format.IsEmpty()) {
str.Format(ResStr(IDS_MAINFRM_11),
CString(str),
format,
@@ -12315,60 +12314,60 @@ void CMainFrame::SetupNavSubtitleSubMenu()
{
CMenu* pSub = &m_navsubtitle;
- if(!IsMenu(pSub->m_hMenu)) {
+ if (!IsMenu(pSub->m_hMenu)) {
pSub->CreatePopupMenu();
- } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ } else while (pSub->RemoveMenu(0, MF_BYPOSITION)) {
;
}
- if(m_iMediaLoadState != MLS_LOADED) {
+ 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))
+ if (FAILED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled))
|| 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) {
+ if (Language == DefLanguage) {
flags |= MF_DEFAULT;
}
- if(i == ulCurrentStream) {
+ 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) {
+ if (SUCCEEDED(pDVDI->GetSubpictureAttributes(i, &ATR))) {
+ switch (ATR.LanguageExtension) {
case DVD_SP_EXT_NotSpecified:
default:
break;
@@ -12416,33 +12415,33 @@ void CMainFrame::SetupNavAngleSubMenu()
{
CMenu* pSub = &m_navangle;
- if(!IsMenu(pSub->m_hMenu)) {
+ if (!IsMenu(pSub->m_hMenu)) {
pSub->CreatePopupMenu();
- } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ } else while (pSub->RemoveMenu(0, MF_BYPOSITION)) {
;
}
- if(m_iMediaLoadState != MLS_LOADED) {
+ 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) {
+ 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) {
+ if (i == ulCurrentStream) {
flags |= MF_CHECKED;
}
@@ -12458,28 +12457,28 @@ void CMainFrame::SetupNavChaptersSubMenu()
{
CMenu* pSub = &m_navchapters;
- if(!IsMenu(pSub->m_hMenu)) {
+ if (!IsMenu(pSub->m_hMenu)) {
pSub->CreatePopupMenu();
- } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ } 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;
}
@@ -12495,23 +12494,23 @@ void CMainFrame::SetupNavChaptersSubMenu()
name.Replace(_T("\t"), _T(" "));
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
- if(i == j) {
+ if (i == j) {
flags |= MF_CHECKED;
}
- if(id != ID_NAVIGATE_CHAP_SUBITEM_START && i == 0) {
+ 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()) {
+ if (pos == m_wndPlaylistBar.m_pl.GetPos()) {
flags |= MF_CHECKED;
}
- if(id != ID_NAVIGATE_CHAP_SUBITEM_START && pos == m_wndPlaylistBar.m_pl.GetHeadPosition()) {
+ 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);
@@ -12520,7 +12519,7 @@ void CMainFrame::SetupNavChaptersSubMenu()
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;
@@ -12535,12 +12534,12 @@ 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) {
+ if (i == Location.TitleNum) {
flags |= MF_CHECKED;
}
- if(ulUOPs&UOP_FLAG_Play_Title) {
+ if (ulUOPs&UOP_FLAG_Play_Title) {
flags |= MF_DISABLED|MF_GRAYED;
}
@@ -12550,15 +12549,15 @@ 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) {
+ if (i == Location.ChapterNum) {
flags |= MF_CHECKED;
}
- if(ulUOPs&UOP_FLAG_Play_Chapter) {
+ if (ulUOPs&UOP_FLAG_Play_Chapter) {
flags |= MF_DISABLED|MF_GRAYED;
}
- if(i == 1) {
+ if (i == 1) {
flags |= MF_MENUBARBREAK;
}
@@ -12567,7 +12566,7 @@ void CMainFrame::SetupNavChaptersSubMenu()
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();
@@ -12588,25 +12587,25 @@ IBaseFilter* CMainFrame::FindSourceSelectableFilter()
IBaseFilter* pSF = NULL;
pSF = FindFilter(CLSID_OggSplitter, pGB);
- if(!pSF) {
+ if (!pSF) {
pSF = FindFilter(L"{171252A0-8820-4AFE-9DF8-5C92B2D66B04}", pGB); // LAV Splitter
}
- if(!pSF) {
+ if (!pSF) {
pSF = FindFilter(L"{B98D13E7-55DB-4385-A33D-09FD1BA26338}", pGB); // LAV Splitter Source
}
- if(!pSF) {
+ if (!pSF) {
pSF = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGB);
}
- if(!pSF) {
+ if (!pSF) {
pSF = FindFilter(L"{529A00DB-0C43-4f5b-8EF2-05004CBE0C6F}", pGB); // AV Splitter
}
- if(!pSF) {
+ if (!pSF) {
pSF = FindFilter(L"{D8980E15-E1F6-4916-A10F-D7EB4E9E10B8}", pGB); // AV Source
}
- if(!pSF) {
+ if (!pSF) {
pSF = FindFilter(__uuidof(CMpegSplitterFilter), pGB);
}
- if(!pSF) {
+ if (!pSF) {
pSF = FindFilter(__uuidof(CMpegSourceFilter), pGB);
}
@@ -12621,23 +12620,23 @@ void CMainFrame::SetupNavStreamSelectSubMenu(CMenu* pSub, UINT id, DWORD dwSelGr
if (!pSS) {
pSS = pGB;
}
- if(!pSS) {
+ 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))
+ if (FAILED(pSS->Info(i, NULL, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))
|| !pszName) {
continue;
}
@@ -12645,25 +12644,25 @@ void CMainFrame::SetupNavStreamSelectSubMenu(CMenu* pSub, UINT id, DWORD dwSelGr
CString name(pszName);
CString lcname = CString(name).MakeLower();
- if(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) {
+ if (lcid == 0) {
str.Format(ResStr(IDS_AG_UNKNOWN), id - baseid);
} else {
int len = GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, str.GetBuffer(64), 64);
@@ -12672,15 +12671,15 @@ void CMainFrame::SetupNavStreamSelectSubMenu(CMenu* pSub, UINT id, DWORD dwSelGr
CString lcstr = CString(str).MakeLower();
- if(str.IsEmpty() || lcname.Find(lcstr) >= 0) {
+ if (str.IsEmpty() || lcname.Find(lcstr) >= 0) {
str = name;
- } else if(!name.IsEmpty()) {
+ } else if (!name.IsEmpty()) {
str = CString(name) + _T(" (") + str + _T(")");
}
}
UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
- if(dwFlags) {
+ if (dwFlags) {
flags |= MF_CHECKED;
}
@@ -12695,34 +12694,34 @@ void CMainFrame::OnNavStreamSelectSubMenu(UINT id, DWORD dwSelGroup)
if (!pSS) {
pSS = pGB;
}
- if(!pSS) {
+ 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))
+ if (FAILED(pSS->Info(i, NULL, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))
|| !pszName) {
continue;
}
- if(pszName) {
+ if (pszName) {
CoTaskMemFree(pszName);
}
- if(dwGroup != dwSelGroup) {
+ if (dwGroup != dwSelGroup) {
continue;
}
- if(id == 0) {
+ if (id == 0) {
pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE);
break;
}
@@ -12735,9 +12734,9 @@ void CMainFrame::SetupRecentFilesSubMenu()
{
CMenu* pSub = &m_recentfiles;
- if(!IsMenu(pSub->m_hMenu)) {
+ if (!IsMenu(pSub->m_hMenu)) {
pSub->CreatePopupMenu();
- } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ } else while (pSub->RemoveMenu(0, MF_BYPOSITION)) {
;
}
@@ -12746,20 +12745,20 @@ void CMainFrame::SetupRecentFilesSubMenu()
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++;
@@ -12770,9 +12769,9 @@ void CMainFrame::SetupFavoritesSubMenu()
{
CMenu* pSub = &m_favorites;
- if(!IsMenu(pSub->m_hMenu)) {
+ if (!IsMenu(pSub->m_hMenu)) {
pSub->CreatePopupMenu();
- } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ } else while (pSub->RemoveMenu(0, MF_BYPOSITION)) {
;
}
@@ -12789,7 +12788,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 f_str = sl.GetNext(pos);
@@ -12800,15 +12799,15 @@ void CMainFrame::SetupFavoritesSubMenu()
Explode(f_str, sl, ';', 3);
f_str = sl.RemoveHead();
-
+
CString str;
- 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("[%02d:%02d:%02d]"), hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds);
bPositionDataPresent = true;
@@ -12820,24 +12819,24 @@ void CMainFrame::SetupFavoritesSubMenu()
BOOL bRelativeDrive = FALSE;
if ( _stscanf_s(sl.GetHead(), _T("%d"), &bRelativeDrive) == 1 ) {
- if(bRelativeDrive) {
+ if (bRelativeDrive) {
str.Format(_T("[RD]%s"), CString(str));
- }
+ }
}
}
- if(!str.IsEmpty()) {
+ if (!str.IsEmpty()) {
f_str.Format(_T("%s\t%.14s"), CString(f_str), CString(str));
}
}
- if(!f_str.IsEmpty()) {
+ if (!f_str.IsEmpty()) {
pSub->AppendMenu(flags, id, f_str);
}
id++;
}
- if(id > ID_FAVORITES_FILE_START) {
+ if (id > ID_FAVORITES_FILE_START) {
pSub->InsertMenu(nLastGroupStart, MF_SEPARATOR|MF_ENABLED|MF_BYPOSITION);
}
@@ -12848,7 +12847,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);
@@ -12859,18 +12858,18 @@ 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);
}
@@ -12881,7 +12880,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);
@@ -12892,7 +12891,7 @@ void CMainFrame::SetupFavoritesSubMenu()
str = sl.RemoveHead();
- if(!str.IsEmpty()) {
+ if (!str.IsEmpty()) {
pSub->AppendMenu(flags, id, str);
}
@@ -12905,42 +12904,19 @@ void CMainFrame::SetupShadersSubMenu()
{
CMenu* pSub = &m_shaders;
- if(!IsMenu(pSub->m_hMenu)) {
+ if (!IsMenu(pSub->m_hMenu)) {
pSub->CreatePopupMenu();
- } else while(pSub->RemoveMenu(0, MF_BYPOSITION)) {
+ } 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()) {
- 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));
- pSub->AppendMenu(MF_SEPARATOR);
- pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_OFFSCR, ResStr(IDS_SHADER_OFFSCREENSPACE));
- pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_COMBINESCR, ResStr(IDS_SHADER_COMBINESCREENSPACE));
- pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADER_TOGGLESCREENSPACE, ResStr(IDS_SHADER_TOGGLESCREENSPACE));
- pSub->AppendMenu(MF_SEPARATOR);
-
- UINT id = ID_SHADERS_DYNAMIC;
-
- MENUITEMINFO mii;
- memset(&mii, 0, sizeof(mii));
- mii.cbSize = sizeof(mii);
- mii.fMask |= MIIM_DATA;
-
- while(pos) {
- const AppSettings::Shader& s = AfxGetAppSettings().m_shaders.GetNext(pos);
- CString label = s.label;
- label.Replace(_T("&"), _T("&&"));
- pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id, label);
- mii.dwItemData = (ULONG_PTR)&s;
- pSub->SetMenuItemInfo(id, &mii);
- id++;
- }
- }
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_TOGGLE, ResStr(IDS_SHADERS_TOGGLE));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_SELECT, ResStr(IDS_SHADERS_SELECT));
+ pSub->AppendMenu(MF_SEPARATOR);
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_TOGGLE_SCREENSPACE, ResStr(IDS_SHADERS_TOGGLE_SCREENSPACE));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_SELECT_SCREENSPACE, ResStr(IDS_SHADERS_SELECT_SCREENSPACE));
+ pSub->AppendMenu(MF_SEPARATOR);
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_EDIT, ResStr(IDS_SHADERS_EDIT));
}
/////////////
@@ -12953,18 +12929,18 @@ 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) {
+ if (nCS&i) {
m_pLastBar = pNext;
}
CSize s = pNext->CalcFixedLayout(FALSE, TRUE);
- if(nCSprev&i) {
+ if (nCSprev&i) {
hbefore += s.cy;
}
- if(nCS&i) {
+ if (nCS&i) {
hafter += s.cy;
}
}
@@ -12973,13 +12949,13 @@ void CMainFrame::ShowControls(int nCS, bool fSave)
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;
}
@@ -12990,19 +12966,19 @@ 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)) {
+ } 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);
}
@@ -13014,13 +12990,13 @@ 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);
@@ -13031,17 +13007,17 @@ 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;
@@ -13053,11 +13029,11 @@ 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 {
newPos = subStreams->InsertBefore(prevPos, theSubStream);
@@ -13065,13 +13041,13 @@ ISubStream *InsertSubStream(CInterfaceList<ISubStream> *subStreams, const CComPt
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);
@@ -13080,14 +13056,14 @@ ISubStream *InsertSubStream(CInterfaceList<ISubStream> *subStreams, const CComPt
void CMainFrame::AddTextPassThruFilter()
{
BeginEnumFilters(pGB, pEF, pBF) {
- if(!IsSplitter(pBF)) {
+ if (!IsSplitter(pBF)) {
continue;
}
BeginEnumPins(pBF, pEP, pPin) {
CComPtr<IPin> pPinTo;
AM_MEDIA_TYPE mt;
- if(FAILED(pPin->ConnectedTo(&pPinTo)) || !pPinTo
+ if (FAILED(pPin->ConnectedTo(&pPinTo)) || !pPinTo
|| FAILED(pPin->ConnectionMediaType(&mt))
|| mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle) {
continue;
@@ -13096,7 +13072,7 @@ void CMainFrame::AddTextPassThruFilter()
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;
}
@@ -13105,7 +13081,7 @@ void CMainFrame::AddTextPassThruFilter()
hr = pPinTo->Disconnect();
hr = pPin->Disconnect();
- if(FAILED(hr = pGB->ConnectDirect(pPin, GetFirstPin(pTPTF, PINDIR_INPUT), NULL))
+ if (FAILED(hr = pGB->ConnectDirect(pPin, GetFirstPin(pTPTF, PINDIR_INPUT), NULL))
|| FAILED(hr = pGB->ConnectDirect(GetFirstPin(pTPTF, PINDIR_OUTPUT), pPinTo, NULL))) {
hr = pGB->ConnectDirect(pPin, pPinTo, NULL);
} else {
@@ -13123,16 +13099,16 @@ bool CMainFrame::LoadSubtitle(CString fn, ISubStream **actualStream)
// TMP: maybe this will catch something for those who get a runtime error dialog when opening subtitles from cds
try {
- if(!pSubStream) {
+ 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();
}
}
@@ -13140,10 +13116,10 @@ bool CMainFrame::LoadSubtitle(CString fn, ISubStream **actualStream)
e->Delete();
}
- if(pSubStream) {
+ if (pSubStream) {
//m_pSubStreams.AddTail(pSubStream);
ISubStream *r = InsertSubStream(&m_pSubStreams, pSubStream);
- if(actualStream != NULL) {
+ if (actualStream != NULL) {
*actualStream = r;
}
}
@@ -13153,24 +13129,24 @@ bool CMainFrame::LoadSubtitle(CString fn, ISubStream **actualStream)
void CMainFrame::UpdateSubtitle(bool fDisplayMessage, bool fApplyDefStyle)
{
- if(!m_pCAP) {
+ 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) {
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);
@@ -13193,31 +13169,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;
@@ -13231,7 +13207,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);
}
@@ -13242,18 +13218,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;
}
@@ -13266,7 +13242,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());
}
@@ -13275,9 +13251,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;
@@ -13287,8 +13263,8 @@ 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);
}
}
@@ -13297,7 +13273,7 @@ void CMainFrame::InvalidateSubtitle(DWORD_PTR nSubtitleId, REFERENCE_TIME rtInva
void CMainFrame::ReloadSubtitle()
{
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_pSubStreams.GetNext(pos)->Reload();
}
UpdateSubtitle();
@@ -13305,12 +13281,12 @@ void CMainFrame::ReloadSubtitle()
void CMainFrame::SetSubtitleTrackIdx(int index)
{
- if(m_iMediaLoadState == MLS_LOADED) {
+ if (m_iMediaLoadState == MLS_LOADED) {
if (index < 0) {
m_iSubtitleSel ^= 0x80000000;
} else {
POSITION pos = m_pSubStreams.FindIndex(index);
- if(pos) {
+ if (pos) {
m_iSubtitleSel = index;
}
}
@@ -13321,16 +13297,16 @@ 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) {
+ 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 (pSS && SUCCEEDED(pSS->Count(&cStreams)))
+ if ((index >= 0) && (index < ((int)cStreams))) {
pSS->Enable(index, dwFlags);
}
}
@@ -13352,49 +13328,51 @@ void CMainFrame::SeekTo(REFERENCE_TIME rtPos, bool fSeekToKeyFrame)
{
OAFilterState fs = GetMediaState();
- if(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;
pMS->GetTimeFormat(&tf);
- if(rtPos > stop && stop != 100) rtPos = stop;
+ if (rtPos > stop) {
+ rtPos = stop;
+ }
m_wndStatusBar.SetStatusTimer(rtPos, stop, !!m_wndSubresyncBar.IsWindowVisible(), &tf);
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)
+ // if (fs != State_Running)
// SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
- } else if(GetPlaybackMode() == PM_CAPTURE) {
+ } else if (GetPlaybackMode() == PM_CAPTURE) {
TRACE(_T("Warning (CMainFrame::SeekTo): Trying to seek in capture mode"));
}
m_fEndOfStream = false;
@@ -13404,28 +13382,28 @@ void CMainFrame::SeekTo(REFERENCE_TIME rtPos, bool fSeekToKeyFrame)
void CMainFrame::CleanGraph()
{
- if(!pGB) {
+ if (!pGB) {
return;
}
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);
@@ -13440,7 +13418,7 @@ void CMainFrame::CleanGraph()
static void SetLatency(IBaseFilter* pBF, int cbBuffer)
{
BeginEnumPins(pBF, pEP, pPin) {
- if(CComQIPtr<IAMBufferNegotiation> pAMBN = pPin) {
+ if (CComQIPtr<IAMBufferNegotiation> pAMBN = pPin) {
ALLOCATOR_PROPERTIES ap;
ap.cbAlign = -1; // -1 means no preference.
ap.cbBuffer = cbBuffer;
@@ -13458,7 +13436,7 @@ HRESULT CMainFrame::BuildCapture(IPin* pPin, IBaseFilter* pBF[3], const GUID& ma
IBaseFilter* pEnc = pBF[1];
IBaseFilter* pMux = pBF[2];
- if(!pPin || !pMux) {
+ if (!pPin || !pMux) {
return E_FAIL;
}
@@ -13467,29 +13445,29 @@ HRESULT CMainFrame::BuildCapture(IPin* pPin, IBaseFilter* pBF[3], const GUID& ma
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) {
+ if (majortype == MEDIATYPE_Video) {
prefix = L"Video ";
- } else if(majortype == MEDIATYPE_Audio) {
+ } 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);
@@ -13498,16 +13476,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);
@@ -13515,10 +13493,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);
@@ -13528,10 +13506,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);
@@ -13554,9 +13532,9 @@ 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
+ 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))) {
CComPtr<IBaseFilter> pDVSplitter;
hr = pDVSplitter.CoCreateInstance(CLSID_DVSplitter);
@@ -13576,7 +13554,7 @@ 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 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);
@@ -13592,11 +13570,11 @@ 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 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);
@@ -13617,7 +13595,7 @@ bool CMainFrame::BuildToCapturePreviewPin(
bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPreview, bool fACapture)
{
- if(!pCGB) {
+ if (!pCGB) {
return(false);
}
@@ -13630,13 +13608,13 @@ bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPrevi
CleanGraph();
- if(pAMVSCCap) {
+ if (pAMVSCCap) {
hr = pAMVSCCap->SetFormat(&m_wndCaptureBar.m_capdlg.m_mtv);
}
- if(pAMVSCPrev) {
+ if (pAMVSCPrev) {
hr = pAMVSCPrev->SetFormat(&m_wndCaptureBar.m_capdlg.m_mtv);
}
- if(pAMASC) {
+ if (pAMASC) {
hr = pAMASC->SetFormat(&m_wndCaptureBar.m_capdlg.m_mta);
}
@@ -13652,12 +13630,12 @@ 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) {
+ if (pMux != pAudMux && fACapture) {
SetLatency(pAudCap, -1);
- } else if(pmt->pbFormat) {
+ } else if (pmt->pbFormat) {
SetLatency(pAudCap, ((WAVEFORMATEX*)pmt->pbFormat)->nAvgBytesPerSec * ms / 1000);
}
}
@@ -13665,17 +13643,17 @@ bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPrevi
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);
@@ -13683,7 +13661,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);
@@ -13693,34 +13671,34 @@ 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);
@@ -13728,9 +13706,9 @@ bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPrevi
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);
}
@@ -13738,7 +13716,7 @@ bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPrevi
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);
}
@@ -13761,11 +13739,11 @@ bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPrevi
bool CMainFrame::StartCapture()
{
- if(!pCGB || m_fCapturing) {
+ if (!pCGB || m_fCapturing) {
return(false);
}
- if(!m_wndCaptureBar.m_capdlg.m_pMux && !m_wndCaptureBar.m_capdlg.m_pDst) {
+ if (!m_wndCaptureBar.m_capdlg.m_pMux && !m_wndCaptureBar.m_capdlg.m_pDst) {
return(false);
}
@@ -13791,11 +13769,11 @@ bool CMainFrame::StartCapture()
bool CMainFrame::StopCapture()
{
- if(!pCGB || !m_fCapturing) {
+ if (!pCGB || !m_fCapturing) {
return(false);
}
- if(!m_wndCaptureBar.m_capdlg.m_pMux && !m_wndCaptureBar.m_capdlg.m_pDst) {
+ if (!m_wndCaptureBar.m_capdlg.m_pMux && !m_wndCaptureBar.m_capdlg.m_pDst) {
return(false);
}
@@ -13827,9 +13805,9 @@ 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);
}
@@ -13844,14 +13822,14 @@ 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();
}
}
@@ -13868,7 +13846,7 @@ void CMainFrame::SendStatusMessage(CString msg, int nTimeOut)
KillTimer(TIMER_STATUSERASER);
m_playingmsg.Empty();
- if(nTimeOut <= 0) {
+ if (nTimeOut <= 0) {
return;
}
@@ -13879,27 +13857,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)) {
+ if (!m_wndPlaylistBar.GetCur(pli)) {
m_wndPlaylistBar.SetFirstSelected();
}
- if(!m_wndPlaylistBar.GetCur(pli)) {
+ if (!m_wndPlaylistBar.GetCur(pli)) {
return;
}
CAutoPtr<OpenMediaData> p(m_wndPlaylistBar.GetCurOMD(rtStart));
- if(p) {
+ if (p) {
OpenMedia(p);
}
}
void CMainFrame::AddCurDevToPlaylist()
{
- if(GetPlaybackMode() == PM_CAPTURE) {
+ if (GetPlaybackMode() == PM_CAPTURE) {
m_wndPlaylistBar.Append(
m_VidDispName,
m_AudDispName,
@@ -13913,8 +13891,8 @@ void CMainFrame::AddCurDevToPlaylist()
void CMainFrame::OpenMedia(CAutoPtr<OpenMediaData> pOMD)
{
// shortcut
- if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD.m_p)) {
- if(m_iMediaLoadState == MLS_LOADED && pAMTuner
+ 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_wndCaptureBar.m_capdlg.SetVideoInput(p->vinput);
m_wndCaptureBar.m_capdlg.SetVideoChannel(p->vchannel);
@@ -13925,7 +13903,7 @@ void CMainFrame::OpenMedia(CAutoPtr<OpenMediaData> pOMD)
}
}
- if(m_iMediaLoadState != MLS_CLOSED) {
+ if (m_iMediaLoadState != MLS_CLOSED) {
CloseMedia();
}
@@ -13934,21 +13912,21 @@ void CMainFrame::OpenMedia(CAutoPtr<OpenMediaData> pOMD)
AppSettings& s = AfxGetAppSettings();
bool fUseThread = m_pGraphThread && AfxGetAppSettings().fEnableWorkerThreadForOpening
- // don't use a worker thread in D3DFullscreen mode except madVR
- && (!AfxGetAppSettings().IsD3DFullscreen() || AfxGetAppSettings().iDSVideoRendererType==VIDRNDT_DS_MADVR);
+ // don't use a worker thread in D3DFullscreen mode except madVR
+ && (!AfxGetAppSettings().IsD3DFullscreen() || AfxGetAppSettings().iDSVideoRendererType==VIDRNDT_DS_MADVR);
- 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*/) {
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 {
@@ -13975,21 +13953,21 @@ bool CMainFrame::DisplayChange()
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) {
+ 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);
@@ -14011,7 +13989,7 @@ 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
@@ -14028,7 +14006,7 @@ void CMainFrame::CloseMedia()
void CMainFrame::StartTunerScan(CAutoPtr<TunerScanData> pTSD)
{
- if(m_pGraphThread) {
+ if (m_pGraphThread) {
m_pGraphThread->PostThreadMessage(CGraphThread::TM_TUNER_SCAN, 0, (LPARAM)pTSD.Detach());
} else {
DoTunerScan(pTSD);
@@ -14056,7 +14034,7 @@ void CMainFrame::DisplayCurrentChannelOSD()
}
NowNext.cPresent.Insert(0,_T(" "));
osd = pChannel->GetName()+ NowNext.cPresent;
- if(i > 0) {
+ if (i > 0) {
osd.Delete(i, osd.GetLength()-i);
}
m_OSD.DisplayMessage(OSD_TOPLEFT, osd ,3500);
@@ -14079,7 +14057,7 @@ void CMainFrame::DisplayCurrentChannelInfo()
osd = NowNext.cPresent + _T(". ") + NowNext.StartTime + _T(" - ") + NowNext.Duration + _T(". ") + NowNext.SummaryDesc +_T(" ");
int i = osd.Find(_T("\n"));
- if(i > 0) {
+ if (i > 0) {
osd.Delete(i, osd.GetLength()-i);
}
m_OSD.DisplayMessage(OSD_TOPLEFT, osd ,8000, 12);
@@ -14117,7 +14095,7 @@ END_MESSAGE_MAP()
void CGraphThread::OnExit(WPARAM wParam, LPARAM lParam)
{
PostQuitMessage(0);
- if(CAMEvent* e = (CAMEvent*)lParam) {
+ if (CAMEvent* e = (CAMEvent*)lParam) {
e->Set();
}
}
@@ -14125,7 +14103,7 @@ void CGraphThread::OnExit(WPARAM wParam, LPARAM lParam)
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);
}
@@ -14133,31 +14111,31 @@ void CGraphThread::OnOpen(WPARAM wParam, LPARAM lParam)
void CGraphThread::OnClose(WPARAM wParam, LPARAM lParam)
{
- if(m_pMainFrame) {
+ if (m_pMainFrame) {
m_pMainFrame->CloseMediaPrivate();
}
- if(CAMEvent* e = (CAMEvent*)lParam) {
+ 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(CAMEvent* e = (CAMEvent*)lParam) {
+ 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);
}
@@ -14165,7 +14143,7 @@ void CGraphThread::OnTunerScan(WPARAM wParam, LPARAM lParam)
void CGraphThread::OnDisplayChange(WPARAM wParam, LPARAM lParam)
{
- if(m_pMainFrame) {
+ if (m_pMainFrame) {
m_pMainFrame->DisplayChange();
}
}
@@ -14187,7 +14165,7 @@ void CMainFrame::SetPlayState(MPC_PLAYSTATE iState)
}
// 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 {
SetThreadExecutionState (iState == PS_PLAY ? ES_CONTINUOUS | ES_SYSTEM_REQUIRED : ES_CONTINUOUS);
@@ -14216,20 +14194,20 @@ 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++ ) {
monitor = monitors.GetMonitor( i );
monitor.GetName(str);
- if((monitor.IsMonitor()) && (s.strFullScreenMonitor == str)) {
+ if ((monitor.IsMonitor()) && (s.strFullScreenMonitor == str)) {
hMonitor = monitor;
break;
}
}
- if(!hMonitor) {
+ if (!hMonitor) {
hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
}
}
@@ -14272,7 +14250,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;
@@ -14286,7 +14264,7 @@ void CMainFrame::SetVMR9ColorControl(float dBrightness, float dContrast, float d
LPCTSTR CMainFrame::GetDVDAudioFormatName (DVD_AudioAttributes& ATR) const
{
- switch(ATR.AudioFormat) {
+ switch (ATR.AudioFormat) {
case DVD_AudioFormat_AC3:
return _T("AC3");
case DVD_AudioFormat_MPEG1:
@@ -14341,7 +14319,7 @@ afx_msg void CMainFrame::OnShiftSubtitle(UINT nID)
afx_msg void CMainFrame::OnSubtitleDelay(UINT nID)
{
- if(m_pCAP) {
+ if (m_pCAP) {
if (m_pSubStreams.IsEmpty()) {
SendStatusMessage(ResStr(IDS_SUBTITLES_ERROR), 3000);
return;
@@ -14350,7 +14328,7 @@ 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 {
newDelay = oldDelay+AfxGetAppSettings().nSubDelayInterval;
@@ -14457,11 +14435,11 @@ void CMainFrame::ProcessAPICommand(COPYDATASTRUCT* pCDS)
// 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) {
+ if (!m_fAudioOnly) {
SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
}
SeekTo(rtPos);
- 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);
@@ -14492,6 +14470,9 @@ void CMainFrame::ProcessAPICommand(COPYDATASTRUCT* pCDS)
case CMD_GETCURRENTPOSITION :
SendCurrentPositionToApi();
break;
+ case CMD_GETNOWPLAYING:
+ SendNowPlayingToApi();
+ break;
case CMD_JUMPOFNSECONDS :
JumpOfNSeconds(_wtoi((LPCWSTR)pCDS->lpData));
break;
@@ -14551,53 +14532,80 @@ 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;
long lDuration = 0;
REFERENCE_TIME rtDur;
- m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_TITLE), title);
- m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_AUTHOR), author);
- m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_DESCRIPTION), description);
+ if (GetPlaybackMode() == PM_FILE) {
+ m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_TITLE), title);
+ m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_AUTHOR), author);
+ m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_DESCRIPTION), description);
+
+ m_wndPlaylistBar.GetCur(pli);
+ if (!pli.m_fns.IsEmpty()) {
+ label = !pli.m_label.IsEmpty() ? pli.m_label : pli.m_fns.GetHead();
- m_wndPlaylistBar.GetCur(pli);
- if(!pli.m_fns.IsEmpty()) {
- label = !pli.m_label.IsEmpty() ? pli.m_label : pli.m_fns.GetHead();
- if(GetPlaybackMode() == PM_FILE) {
pMS->GetDuration(&rtDur);
DVD_HMSF_TIMECODE tcDur = RT2HMSF(rtDur);
lDuration = tcDur.bHours*60*60 + tcDur.bMinutes*60 + tcDur.bSeconds;
}
- /*CString label = !pli.m_label.IsEmpty() ? pli.m_label : pli.m_fns.GetHead();
+ }
+ else if (GetPlaybackMode() == PM_DVD) {
+ DVD_DOMAIN DVDDomain;
+ ULONG ulNumOfChapters = 0;
+ DVD_PLAYBACK_LOCATION2 Location;
- if(GetPlaybackMode() == PM_FILE)
- {
- CString fn = label;
- if(fn.Find(_T("://")) >= 0) {int i = fn.Find('?'); if(i >= 0) fn = fn.Left(i);}
- CPath path(fn);
- path.StripPath();
- path.MakePretty();
- path.RemoveExtension();
- title = (LPCTSTR)path;
- author.Empty();
- }
- else if(GetPlaybackMode() == PM_CAPTURE)
- {
- title = label != pli.m_fns.GetHead() ? label : _T("Live");
- author.Empty();
+ // Get current DVD Domain
+ if (SUCCEEDED(pDVDI->GetCurrentDomain(&DVDDomain))) {
+ switch (DVDDomain) {
+ case DVD_DOMAIN_Stop:
+ title = _T("DVD - Stopped");
+ break;
+ case DVD_DOMAIN_FirstPlay:
+ title = _T("DVD - FirstPlay");
+ break;
+ case DVD_DOMAIN_VideoManagerMenu:
+ title = _T("DVD - RootMenu");
+ break;
+ case DVD_DOMAIN_VideoTitleSetMenu:
+ title = _T("DVD - TitleMenu");
+ break;
+ case DVD_DOMAIN_Title:
+ title = _T("DVD - Title");
+ break;
+ }
+
+ // get title information
+ if (DVDDomain == DVD_DOMAIN_Title) {
+ // get current location (title number & chapter)
+ if (SUCCEEDED(pDVDI->GetCurrentLocation(&Location))) {
+ // get number of chapters in current title
+ pDVDI->GetNumberOfChapters(Location.TitleNum, &ulNumOfChapters);
+ }
+
+ // get total time of title
+ DVD_HMSF_TIMECODE tcDur;
+ ULONG ulFlags;
+ if (SUCCEEDED(pDVDI->GetTotalTitleTime(&tcDur, &ulFlags))) {
+ // calculate duration in seconds
+ lDuration = tcDur.bHours*60*60 + tcDur.bMinutes*60 + tcDur.bSeconds;
+ }
+
+ // build string
+ // DVD - xxxxx|currenttitle|numberofchapters|currentchapter|titleduration
+ author.Format(L"%d", Location.TitleNum);
+ description.Format(L"%d", ulNumOfChapters);
+ label.Format(L"%d", Location.ChapterNum);
+ }
}
- else if(GetPlaybackMode() == PM_DVD)
- {
- title = _T("DVD");
- author.Empty();
- }*/
}
title.Replace(L"|", L"\\|");
@@ -14606,9 +14614,9 @@ void CMainFrame::SendNowPlayingToApi()
label.Replace(L"|", L"\\|");
CStringW buff;
- buff.Format (L"%s|%s|%s|%s|%d", title, author, description, label, lDuration);
+ buff.Format(L"%s|%s|%s|%s|%d", title, author, description, label, lDuration);
- SendAPICommand (CMD_NOWPLAYING, buff);
+ SendAPICommand(CMD_NOWPLAYING, buff);
SendSubtitleTracksToApi();
SendAudioTracksToApi();
}
@@ -14620,14 +14628,14 @@ void CMainFrame::SendSubtitleTracksToApi()
CStringW strSubs;
POSITION pos = m_pSubStreams.GetHeadPosition();
- if(m_iMediaLoadState == MLS_LOADED) {
+ if (m_iMediaLoadState == MLS_LOADED) {
if (pos) {
- while(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()) {
strSubs.Append (L"|");
@@ -14638,8 +14646,8 @@ void CMainFrame::SendSubtitleTracksToApi()
}
}
}
- if(AfxGetAppSettings().fEnableSubtitles) {
- if(m_iSubtitleSel >= 0) {
+ if (AfxGetAppSettings().fEnableSubtitles) {
+ if (m_iSubtitleSel >= 0) {
strSubs.AppendFormat(L"|%i", m_iSubtitleSel);
} else {
strSubs.Append(L"|-1");
@@ -14661,25 +14669,25 @@ void CMainFrame::SendAudioTracksToApi()
{
CStringW strAudios;
- if(m_iMediaLoadState == MLS_LOADED) {
+ if (m_iMediaLoadState == MLS_LOADED) {
CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
- if(!pSS) {
+ 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);
@@ -14688,10 +14696,10 @@ void CMainFrame::SendAudioTracksToApi()
}
name.Replace(L"|", L"\\|");
strAudios.AppendFormat(L"%s", name);
- if(pmt) {
+ if (pmt) {
DeleteMediaType(pmt);
}
- if(pszName) {
+ if (pszName) {
CoTaskMemFree(pszName);
}
}
@@ -14714,12 +14722,12 @@ 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()) {
strPlaylist.Append (L"|");
@@ -14740,19 +14748,26 @@ void CMainFrame::SendPlaylistToApi()
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;
+ DVD_PLAYBACK_LOCATION2 Location;
- 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;
}
+ else if(m_iPlaybackMode == PM_DVD) {
+ // get current location while playing disc, will return 0, if at a menu
+ if (pDVDI->GetCurrentLocation(&Location) == S_OK) {
+ lPosition = Location.TimeCode.bHours*60*60 + Location.TimeCode.bMinutes*60 + Location.TimeCode.bSeconds;
+ }
+ }
CStringW buff;
buff.Format (L"%d", lPosition);
@@ -14768,11 +14783,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;
@@ -14786,11 +14801,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) {
+ 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);
@@ -14809,38 +14824,38 @@ void CMainFrame::JumpOfNSeconds(int nSeconds)
// int DefSubtitleLanguageIndex[2] = {-1, -1};
// LCID Language = MAKELCID( MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT);
//
-// if((m_iMediaLoadState == MLS_LOADING) || (m_iMediaLoadState == MLS_LOADED))
+// if ((m_iMediaLoadState == MLS_LOADING) || (m_iMediaLoadState == MLS_LOADED))
// {
-// if(GetPlaybackMode() == PM_FILE)
+// if (GetPlaybackMode() == PM_FILE)
// {
// 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)))
// {
-// 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;
// }
// }
//
// POSITION pos = m_pSubStreams.GetHeadPosition();
-// 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, &Language)))
+// if (SUCCEEDED(pSubStream->GetStreamInfo(i, &pName, &Language)))
// {
// if (DefAudioLanguageLcid[0] == Language) DefSubtitleLanguageIndex[0] = i;
// if (DefSubtitleLanguageLcid[1] == Language) DefSubtitleLanguageIndex[1] = i;
@@ -14849,17 +14864,17 @@ void CMainFrame::JumpOfNSeconds(int nSeconds)
// }
// }
// }
-// else if(GetPlaybackMode() == PM_DVD)
+// else if (GetPlaybackMode() == PM_DVD)
// {
// ULONG ulStreamsAvailable, ulCurrentStream;
// BOOL bIsDisabled;
//
-// if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled)))
+// if (SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled)))
// {
-// for(ULONG i = 0; i < ulStreamsAvailable; i++)
+// for (ULONG i = 0; i < ulStreamsAvailable; i++)
// {
// DVD_SubpictureAttributes ATR;
-// if(SUCCEEDED(pDVDI->GetSubpictureLanguage(i, &Language)))
+// if (SUCCEEDED(pDVDI->GetSubpictureLanguage(i, &Language)))
// {
// // Auto select forced subtitle
// if ((DefAudioLanguageLcid[0] == Language) && (ATR.LanguageExtension == DVD_SP_EXT_Forced))
@@ -14870,11 +14885,11 @@ void CMainFrame::JumpOfNSeconds(int nSeconds)
// }
// }
//
-// if(SUCCEEDED(pDVDI->GetCurrentAudio(&ulStreamsAvailable, &ulCurrentStream)))
+// if (SUCCEEDED(pDVDI->GetCurrentAudio(&ulStreamsAvailable, &ulCurrentStream)))
// {
-// for(ULONG i = 0; i < ulStreamsAvailable; i++)
+// for (ULONG i = 0; i < ulStreamsAvailable; i++)
// {
-// if(SUCCEEDED(pDVDI->GetAudioLanguage(i, &Language)))
+// if (SUCCEEDED(pDVDI->GetAudioLanguage(i, &Language)))
// {
// if (DefAudioLanguageLcid[0] == Language) DefAudioLanguageIndex[0] = i;
// if (DefAudioLanguageLcid[1] == Language) DefAudioLanguageIndex[1] = i;
@@ -14902,7 +14917,7 @@ void CMainFrame::JumpOfNSeconds(int nSeconds)
void CMainFrame::OnFileOpendirectory()
{
- if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar)) {
+ if (m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar)) {
return;
}
@@ -14930,22 +14945,22 @@ 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] != '\\') {
+ if (_path[_path.GetLength()-1] != '\\') {
_path += '\\';
}
s.strLastOpenDir = _path;
CAtlList<CString> sl;
sl.AddTail(_path);
- if(COpenDirHelper::m_incl_subdir) {
+ if (COpenDirHelper::m_incl_subdir) {
COpenDirHelper::RecurseAddDir(_path, &sl);
}
- if(m_wndPlaylistBar.IsWindowVisible()) {
+ if (m_wndPlaylistBar.IsWindowVisible()) {
m_wndPlaylistBar.Append(sl, true);
} else {
m_wndPlaylistBar.Open(sl, true);
@@ -14958,7 +14973,7 @@ void CMainFrame::OnFileOpendirectory()
HRESULT CMainFrame::CreateThumbnailToolbar()
{
- if(!AfxGetAppSettings().fUseWin7TaskBar) {
+ if (!AfxGetAppSettings().fUseWin7TaskBar) {
return E_FAIL;
}
@@ -14968,7 +14983,7 @@ HRESULT CMainFrame::CreateThumbnailToolbar()
return E_FAIL;
}
- if(m_pTaskbarList) {
+ if (m_pTaskbarList) {
m_pTaskbarList->Release();
}
HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&m_pTaskbarList));
@@ -15212,9 +15227,9 @@ 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) {
+ switch (wmId) {
case IDTB_BUTTON1:
SendMessage(WM_COMMAND, ID_PLAY_STOP);
break;
@@ -15234,7 +15249,7 @@ LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
case IDTB_BUTTON5:
WINDOWPLACEMENT wp;
GetWindowPlacement(&wp);
- if(wp.showCmd == SW_SHOWMINIMIZED) {
+ if (wp.showCmd == SW_SHOWMINIMIZED) {
SendMessage(WM_SYSCOMMAND, SC_RESTORE, -1);
}
SetForegroundWindow();
@@ -15280,3 +15295,70 @@ UINT CMainFrame::OnPowerBroadcast(UINT nPowerEvent, UINT nEventData)
return __super::OnPowerBroadcast(nPowerEvent, nEventData);
}
+
+#define NOTIFY_FOR_THIS_SESSION 0
+
+void CMainFrame::OnSessionChange(UINT nSessionState, UINT nId)
+{
+ static BOOL bWasPausedBeforeSessionChange;
+
+ switch(nSessionState)
+ {
+ case WTS_SESSION_LOCK:
+ TRACE(_T("OnSessionChange - Lock session\n"));
+
+ bWasPausedBeforeSessionChange = FALSE;
+ if (GetMediaState() == State_Running && !m_fAudioOnly) {
+ bWasPausedBeforeSessionChange = TRUE;
+ SendMessage( WM_COMMAND, ID_PLAY_PAUSE );
+ }
+ break;
+ case WTS_SESSION_UNLOCK:
+ TRACE(_T("OnSessionChange - UnLock session\n"));
+
+ if(bWasPausedBeforeSessionChange) {
+ SendMessage( WM_COMMAND, ID_PLAY_PLAY );
+ }
+ break;
+ }
+}
+
+void CMainFrame::WTSRegisterSessionNotification()
+{
+ typedef BOOL (WINAPI *WTSREGISTERSESSIONNOTIFICATION)(HWND, DWORD);
+ HINSTANCE hWtsLib = LoadLibrary( _T("wtsapi32.dll") );
+
+ if ( hWtsLib )
+ {
+ WTSREGISTERSESSIONNOTIFICATION fnWtsRegisterSessionNotification;
+
+ fnWtsRegisterSessionNotification = (WTSREGISTERSESSIONNOTIFICATION)GetProcAddress(hWtsLib, "WTSRegisterSessionNotification");
+
+ if( fnWtsRegisterSessionNotification ) {
+ fnWtsRegisterSessionNotification(m_hWnd, NOTIFY_FOR_THIS_SESSION);
+ }
+
+ FreeLibrary( hWtsLib );
+ hWtsLib = NULL;
+ }
+}
+
+void CMainFrame::WTSUnRegisterSessionNotification()
+{
+ typedef BOOL (WINAPI *WTSUNREGISTERSESSIONNOTIFICATION)(HWND);
+ HINSTANCE hWtsLib = LoadLibrary( _T("wtsapi32.dll") );
+
+ if( hWtsLib )
+ {
+ WTSUNREGISTERSESSIONNOTIFICATION fnWtsUnRegisterSessionNotification;
+
+ fnWtsUnRegisterSessionNotification = (WTSUNREGISTERSESSIONNOTIFICATION)GetProcAddress(hWtsLib, "WTSUnRegisterSessionNotification");
+
+ if( fnWtsUnRegisterSessionNotification ) {
+ fnWtsUnRegisterSessionNotification( m_hWnd );
+ }
+
+ FreeLibrary( hWtsLib );
+ hWtsLib = NULL;
+ }
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/MainFrm.h b/src/apps/mplayerc/MainFrm.h
index 2f9756765..c104afc49 100644
--- a/src/apps/mplayerc/MainFrm.h
+++ b/src/apps/mplayerc/MainFrm.h
@@ -221,7 +221,7 @@ class CMainFrame : public CFrameWnd, public CDropTarget
CCritSec m_csSubLock;
CInterfaceList<ISubStream> m_pSubStreams;
CAtlList<int> m_iAudioStreams; // foxX uses this to keep a mapping of audio streams, in which they're ordered based by language user preference
- int m_iSubtitleSel; // if(m_iSubtitleSel&(1<<31)): disabled
+ int m_iSubtitleSel; // if (m_iSubtitleSel&(1<<31)): disabled
DWORD_PTR m_nSubtitleId;
friend class CTextPassThruFilter;
@@ -397,6 +397,7 @@ protected:
DVD_DOMAIN m_iDVDDomain;
DWORD m_iDVDTitle;
int m_iSpeedLevel;
+ double m_dSpeedRate;
double m_ZoomX, m_ZoomY, m_PosX, m_PosY;
int m_AngleX, m_AngleY, m_AngleZ;
@@ -943,6 +944,10 @@ protected:
ULONG_PTR m_gdiplusToken;
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+
+ void CMainFrame::WTSRegisterSessionNotification();
+ void CMainFrame::WTSUnRegisterSessionNotification();
public:
afx_msg UINT OnPowerBroadcast(UINT nPowerEvent, UINT nEventData);
+ afx_msg void OnSessionChange(UINT nSessionState, UINT nId);
};
diff --git a/src/apps/mplayerc/MediaFormats.cpp b/src/apps/mplayerc/MediaFormats.cpp
index d601afc20..6f84e2d16 100644
--- a/src/apps/mplayerc/MediaFormats.cpp
+++ b/src/apps/mplayerc/MediaFormats.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -54,7 +54,7 @@ CMediaFormatCategory::CMediaFormatCategory(
m_label = label;
ExplodeMin(exts, m_exts, ' ');
POSITION pos = m_exts.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_exts.GetNext(pos).TrimLeft('.');
}
@@ -70,7 +70,7 @@ CMediaFormatCategory::~CMediaFormatCategory()
void CMediaFormatCategory::UpdateData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
AfxGetApp()->WriteProfileString(_T("FileFormats"), m_label, GetExts(true));
} else {
SetExts(AfxGetApp()->GetProfileString(_T("FileFormats"), m_label, GetExts(true)));
@@ -84,7 +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();
@@ -114,10 +114,10 @@ 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 {
@@ -130,7 +130,7 @@ CString CMediaFormatCategory::GetFilter()
{
CString filter;
POSITION pos = m_exts.GetHeadPosition();
- while(pos) {
+ while (pos) {
filter += _T("*.") + m_exts.GetNext(pos) + _T(";");
}
filter.TrimRight(_T(";")); // cheap...
@@ -140,7 +140,7 @@ CString CMediaFormatCategory::GetFilter()
CString CMediaFormatCategory::GetExts(bool fAppendEngine)
{
CString exts = Implode(m_exts, ' ');
- if(fAppendEngine) {
+ if (fAppendEngine) {
exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine);
}
return(exts);
@@ -150,11 +150,11 @@ CString CMediaFormatCategory::GetExtsWithPeriod(bool fAppendEngine)
{
CString exts;
POSITION pos = m_exts.GetHeadPosition();
- while(pos) {
+ while (pos) {
exts += _T(".") + m_exts.GetNext(pos) + _T(" ");
}
exts.TrimRight(_T(" ")); // cheap...
- if(fAppendEngine) {
+ if (fAppendEngine) {
exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine);
}
return(exts);
@@ -164,11 +164,11 @@ CString CMediaFormatCategory::GetBackupExtsWithPeriod(bool fAppendEngine)
{
CString exts;
POSITION pos = m_backupexts.GetHeadPosition();
- while(pos) {
+ while (pos) {
exts += _T(".") + m_backupexts.GetNext(pos) + _T(" ");
}
exts.TrimRight(_T(" ")); // cheap...
- if(fAppendEngine) {
+ if (fAppendEngine) {
exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine);
}
return(exts);
@@ -188,7 +188,7 @@ 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);
@@ -263,7 +263,7 @@ 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);
}
}
@@ -289,31 +289,31 @@ 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;
}
@@ -324,10 +324,10 @@ 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);
}
}
@@ -343,7 +343,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;
@@ -352,7 +352,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());
@@ -370,9 +370,9 @@ 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) {
+ if (!mfc.IsAudioOnly() || mfc.GetEngineType() != DirectShow) {
continue;
}
strTemp = GetAt(i).GetFilter() + _T(";");
@@ -384,9 +384,9 @@ 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) {
+ if (!mfc.IsAudioOnly() || mfc.GetEngineType() != DirectShow) {
continue;
}
filter += mfc.GetLabel() + _T("|") + GetAt(i).GetFilter() + _T("|");
diff --git a/src/apps/mplayerc/MediaTypesDlg.cpp b/src/apps/mplayerc/MediaTypesDlg.cpp
index 9512ef25f..330c3f203 100644
--- a/src/apps/mplayerc/MediaTypesDlg.cpp
+++ b/src/apps/mplayerc/MediaTypesDlg.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -61,9 +61,9 @@ void CMediaTypesDlg::AddLine(CString str)
void CMediaTypesDlg::AddMediaType(AM_MEDIA_TYPE* pmt)
{
m_subtype = pmt->subtype;
- if(pmt->majortype == MEDIATYPE_Video) {
+ if (pmt->majortype == MEDIATYPE_Video) {
m_type = VIDEO;
- } else if(pmt->majortype == MEDIATYPE_Audio) {
+ } else if (pmt->majortype == MEDIATYPE_Audio) {
m_type = AUDIO;
} else {
m_type = UNKNOWN;
@@ -72,7 +72,7 @@ void CMediaTypesDlg::AddMediaType(AM_MEDIA_TYPE* pmt)
CAtlList<CString> sl;
CMediaTypeEx(*pmt).Dump(sl);
POSITION pos = sl.GetHeadPosition();
- while(pos) {
+ while (pos) {
AddLine(sl.GetNext(pos) + '\n');
}
}
@@ -91,8 +91,8 @@ 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()) {
+ 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);
@@ -118,27 +118,27 @@ void CMediaTypesDlg::OnCbnSelchangeCombo1()
m_report.SetWindowText(_T(""));
int i = m_pins.GetCurSel();
- if(i < 0) {
+ 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) {
+ 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/MpcApi.h b/src/apps/mplayerc/MpcApi.h
index b858cf9e6..74dea7365 100644
--- a/src/apps/mplayerc/MpcApi.h
+++ b/src/apps/mplayerc/MpcApi.h
@@ -37,9 +37,14 @@
// separated by |
// If a string contains a |, it will be escaped with a \ so a \| is not a separator
//
-// Ex : When a file is openned, mpc-hc send to host the "now playing" notification :
+// Ex : When a file is opened, mpc-hc send to host the "now playing" notification :
// - dwData : CMD_NOWPLAYING
// - lpData : title|author|description|filename|duration
+//
+// Ex : When a DVD is playing, use CMD_GETNOWPLAYING to get:
+// - dwData : CMD_NOWPLAYING
+// - lpData : dvddomain|titlenumber|numberofchapters|currentchapter|titleduration
+// dvddomains : DVD - Stopped, DVD - FirstPlay, DVD - RootMenu, DVD - TitleMenu, DVD - Title
#pragma once
diff --git a/src/apps/mplayerc/Mpeg2SectionData.cpp b/src/apps/mplayerc/Mpeg2SectionData.cpp
index 9460cd87f..8a415796e 100644
--- a/src/apps/mplayerc/Mpeg2SectionData.cpp
+++ b/src/apps/mplayerc/Mpeg2SectionData.cpp
@@ -90,7 +90,7 @@ CString CMpeg2DataParser::ConvertString (BYTE* pBuffer, int nLength)
}
nDestSize = MultiByteToWideChar (cp, MB_PRECOMPOSED, (LPCSTR)pBuffer, nLength, NULL, 0);
- if(nDestSize < 0) {
+ if (nDestSize < 0) {
return strResult;
}
diff --git a/src/apps/mplayerc/OpenDirHelper.cpp b/src/apps/mplayerc/OpenDirHelper.cpp
index 170565e2c..727347521 100644
--- a/src/apps/mplayerc/OpenDirHelper.cpp
+++ b/src/apps/mplayerc/OpenDirHelper.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -45,7 +45,7 @@ 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)) {
+ if (!hfOld && (hfOld!=hf)) {
DeleteObject(hfOld); //if the old font is not system font or the same as newfont, release it.
}
ReleaseDC(hwnd,hdc);
@@ -55,8 +55,8 @@ 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 {
m_incl_subdir = TRUE;
@@ -70,7 +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;
@@ -117,12 +117,12 @@ void COpenDirHelper::RecurseAddDir(CString path, CAtlList<CString>* sl)
WIN32_FIND_DATA fd = {0};
HANDLE hFind = FindFirstFile(path + _T("*.*"), &fd);
- if(hFind != INVALID_HANDLE_VALUE) {
+ 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] != '\\') {
+ if (fullpath[fullpath.GetLength()-1] != '\\') {
fullpath += '\\';
}
sl->AddTail(fullpath);
@@ -130,7 +130,7 @@ void COpenDirHelper::RecurseAddDir(CString path, CAtlList<CString>* sl)
} else {
continue;
}
- } while(FindNextFile(hFind, &fd));
+ } while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
}
diff --git a/src/apps/mplayerc/OpenDlg.cpp b/src/apps/mplayerc/OpenDlg.cpp
index 5c904d6c3..4f45785dc 100644
--- a/src/apps/mplayerc/OpenDlg.cpp
+++ b/src/apps/mplayerc/OpenDlg.cpp
@@ -74,8 +74,8 @@ BOOL COpenDlg::OnInitDialog()
CRecentFileList& MRU = AfxGetAppSettings().MRU;
MRU.ReadList();
m_mrucombo.ResetContent();
- for(int i = 0; i < MRU.GetSize(); i++)
- if(!MRU[i].IsEmpty()) {
+ for (int i = 0; i < MRU.GetSize(); i++)
+ if (!MRU[i].IsEmpty()) {
m_mrucombo.AddString(MRU[i]);
}
CorrectComboListWidth(m_mrucombo, GetFont());
@@ -83,13 +83,13 @@ BOOL COpenDlg::OnInitDialog()
CRecentFileList& MRUDub = AfxGetAppSettings().MRUDub;
MRUDub.ReadList();
m_mrucombo2.ResetContent();
- for(int i = 0; i < MRUDub.GetSize(); i++)
- if(!MRUDub[i].IsEmpty()) {
+ for (int i = 0; i < MRUDub.GetSize(); i++)
+ if (!MRUDub[i].IsEmpty()) {
m_mrucombo2.AddString(MRUDub[i]);
}
CorrectComboListWidth(m_mrucombo2, GetFont());
- if(m_mrucombo.GetCount() > 0) {
+ if (m_mrucombo.GetCount() > 0) {
m_mrucombo.SetCurSel(0);
}
@@ -123,33 +123,38 @@ void COpenDlg::OnBnClickedBrowsebutton()
{
UpdateData();
+ AppSettings& s = AfxGetAppSettings();
+
CString filter;
CAtlArray<CString> mask;
- AfxGetAppSettings().m_Formats.GetFilter(filter, mask);
+ s.m_Formats.GetFilter(filter, mask);
+
+ DWORD dwFlags = OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLEINCLUDENOTIFY|OFN_NOCHANGEDIR;
+ if (!s.fKeepHistory) {
+ dwFlags |= OFN_DONTADDTORECENT;
+ }
- COpenFileDlg fd(mask, true, NULL, m_path,
- OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLEINCLUDENOTIFY|OFN_NOCHANGEDIR,
- filter, this);
- if(fd.DoModal() != IDOK) {
+ COpenFileDlg fd(mask, true, NULL, m_path, dwFlags, filter, this);
+ 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();
- while(insertpos && GetFileName(str).CompareNoCase(GetFileName(m_fns.GetAt(insertpos))) <= 0)
+ while (insertpos && GetFileName(str).CompareNoCase(GetFileName(m_fns.GetAt(insertpos))) <= 0)
m_fns.GetPrev(insertpos);
- if(!insertpos) m_fns.AddHead(str);
+ if (!insertpos) m_fns.AddHead(str);
else m_fns.InsertAfter(insertpos, str);
*/
m_fns.AddTail(fd.GetNextPathName(pos));
}
- if(m_fns.GetCount() > 1
+ 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] == '*')) {
@@ -165,15 +170,20 @@ void COpenDlg::OnBnClickedBrowsebutton2()
{
UpdateData();
+ AppSettings& s = AfxGetAppSettings();
+
CString filter;
CAtlArray<CString> mask;
- AfxGetAppSettings().m_Formats.GetAudioFilter(filter, mask);
+ s.m_Formats.GetAudioFilter(filter, mask);
+
+ DWORD dwFlags = OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ENABLEINCLUDENOTIFY|OFN_NOCHANGEDIR;
+ if (!s.fKeepHistory) {
+ dwFlags |= OFN_DONTADDTORECENT;
+ }
- COpenFileDlg fd(mask, false, NULL, m_path2,
- OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ENABLEINCLUDENOTIFY|OFN_NOCHANGEDIR,
- filter, this);
+ COpenFileDlg fd(mask, false, NULL, m_path2, dwFlags, filter, this);
- if(fd.DoModal() != IDOK) {
+ if (fd.DoModal() != IDOK) {
return;
}
@@ -186,7 +196,7 @@ void COpenDlg::OnBnClickedOk()
m_fns.RemoveAll();
m_fns.AddTail(m_path);
- if(m_mrucombo2.IsWindowEnabled()) {
+ if (m_mrucombo2.IsWindowEnabled()) {
m_fns.AddTail(m_path2);
}
diff --git a/src/apps/mplayerc/OpenFileDlg.cpp b/src/apps/mplayerc/OpenFileDlg.cpp
index bb471d95d..085f6ab5c 100644
--- a/src/apps/mplayerc/OpenFileDlg.cpp
+++ b/src/apps/mplayerc/OpenFileDlg.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -63,12 +63,12 @@ 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
+ if (message == WM_COMMAND && HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDOK
&& 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__);
}
}
@@ -89,7 +89,7 @@ BOOL COpenFileDlg::OnInitDialog()
void COpenFileDlg::OnDestroy()
{
int i = GetPathName().Find(__DUMMY__);
- if(i >= 0) {
+ if (i >= 0) {
m_pOFN->lpstrFile[i] = m_pOFN->lpstrFile[i+1] = 0;
}
@@ -107,9 +107,9 @@ BOOL COpenFileDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
return TRUE;
}
- switch(pNotify->hdr.code) {
+ switch (pNotify->hdr.code) {
case CDN_INCLUDEITEM:
- if(OnIncludeItem((OFNOTIFYEX*)lParam, pResult)) {
+ if (OnIncludeItem((OFNOTIFYEX*)lParam, pResult)) {
return TRUE;
}
break;
@@ -121,13 +121,13 @@ 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) {
+ if (S_OK != hr) {
return FALSE;
}
- switch(s.uType) {
+ switch (s.uType) {
case STRRET_CSTR:
_tcscpy(buff, CString(s.cStr));
break;
@@ -143,12 +143,12 @@ BOOL COpenFileDlg::OnIncludeItem(OFNOTIFYEX* pOFNEx, LRESULT* pResult)
CString fn(buff);
/*
WIN32_FILE_ATTRIBUTE_DATA fad;
- if(GetFileAttributesEx(fn, GetFileExInfoStandard, &fad)
+ if (GetFileAttributesEx(fn, GetFileExInfoStandard, &fad)
&& (fad.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
return FALSE;
*/
int i = fn.ReverseFind('.'), j = fn.ReverseFind('\\');
- if(i < 0 || i < j) {
+ if (i < 0 || i < j) {
return FALSE;
}
diff --git a/src/apps/mplayerc/PPageAccelTbl.cpp b/src/apps/mplayerc/PPageAccelTbl.cpp
index c1e41aba6..f73728256 100644
--- a/src/apps/mplayerc/PPageAccelTbl.cpp
+++ b/src/apps/mplayerc/PPageAccelTbl.cpp
@@ -131,7 +131,7 @@ CPPageAccelTbl::~CPPageAccelTbl()
BOOL CPPageAccelTbl::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN
+ if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN
&& (pMsg->hwnd == m_WinLircEdit.m_hWnd || pMsg->hwnd == m_UIceEdit.m_hWnd)) {
OnApply();
return TRUE;
@@ -143,7 +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);
@@ -174,25 +174,25 @@ void CPPageAccelTbl::SetupList()
CString CPPageAccelTbl::MakeAccelModLabel(BYTE fVirt)
{
CString str;
- if(fVirt&FCONTROL) {
- if(!str.IsEmpty()) {
+ if (fVirt&FCONTROL) {
+ if (!str.IsEmpty()) {
str += _T(" + ");
}
str += _T("Ctrl");
}
- if(fVirt&FALT) {
- if(!str.IsEmpty()) {
+ if (fVirt&FALT) {
+ if (!str.IsEmpty()) {
str += _T(" + ");
}
str += _T("Alt");
}
- if(fVirt&FSHIFT) {
- if(!str.IsEmpty()) {
+ if (fVirt&FSHIFT) {
+ if (!str.IsEmpty()) {
str += _T(" + ");
}
str += _T("Shift");
}
- if(str.IsEmpty()) {
+ if (str.IsEmpty()) {
str = ResStr(IDS_AG_NONE);
}
return(str);
@@ -203,7 +203,7 @@ CString CPPageAccelTbl::MakeAccelVkeyLabel(WORD key, bool fVirtKey)
// Reference page for Virtual-Key Codes: http://msdn.microsoft.com/en-us/library/ms645540
CString str;
- switch(key) {
+ switch (key) {
case VK_LBUTTON:
str = _T("VK_LBUTTON");
break;
@@ -748,7 +748,7 @@ CString CPPageAccelTbl::MakeAccelVkeyLabel(WORD key, bool fVirtKey)
str = _T("Multimedia keys");
break;
default:
- // if('0' <= key && key <= '9' || 'A' <= key && key <= 'Z')
+ // if ('0' <= key && key <= '9' || 'A' <= key && key <= 'Z')
str.Format(_T("%c"), (TCHAR)key);
break;
}
@@ -760,9 +760,9 @@ 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));
}
}
@@ -775,7 +775,7 @@ CString CPPageAccelTbl::MakeAccelShortcutLabel(ACCEL& a)
// Reference page for Virtual-Key Codes: http://msdn.microsoft.com/en-us/library/ms645540
CString str;
- switch(a.key) {
+ switch (a.key) {
case VK_LBUTTON:
str = _T("LBtn");
break;
@@ -1320,12 +1320,12 @@ CString CPPageAccelTbl::MakeAccelShortcutLabel(ACCEL& a)
str = _T("Multimedia keys");
break;
default:
- // if('0' <= a.key && a.key <= '9' || 'A' <= a.key && a.key <= 'Z')
+ // 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;
}
@@ -1337,7 +1337,7 @@ CString CPPageAccelTbl::MakeAccelShortcutLabel(ACCEL& a)
CString CPPageAccelTbl::MakeMouseButtonLabel(UINT mouse)
{
CString ret;
- switch(mouse) {
+ switch (mouse) {
case wmcmd::NONE:
default:
ret = ResStr(IDS_AG_NONE);
@@ -1435,11 +1435,11 @@ END_MESSAGE_MAP()
static WNDPROC OldControlProc;
static LRESULT CALLBACK ControlProc(HWND control, UINT message, WPARAM wParam, LPARAM lParam)
{
- if(message == WM_KEYDOWN) {
+ if (message == WM_KEYDOWN) {
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);
}
@@ -1477,7 +1477,7 @@ 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++) {
+ 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);
@@ -1491,7 +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);
@@ -1525,10 +1525,10 @@ BOOL CPPageAccelTbl::OnApply()
CAtlArray<ACCEL> pAccel;
pAccel.SetCount(m_wmcmds.GetCount());
POSITION pos = m_wmcmds.GetHeadPosition();
- for(int i = 0; pos; i++) {
+ for (int i = 0; pos; i++) {
pAccel[i] = m_wmcmds.GetNext(pos);
}
- if(s.hAccel) {
+ if (s.hAccel) {
DestroyAcceleratorTable(s.hAccel);
}
s.hAccel = CreateAcceleratorTable(pAccel.GetData(), pAccel.GetCount());
@@ -1537,12 +1537,12 @@ BOOL CPPageAccelTbl::OnApply()
s.fWinLirc = !!m_fWinLirc;
s.strWinLircAddr = m_WinLircAddr;
- if(s.fWinLirc) {
+ if (s.fWinLirc) {
s.WinLircClient.Connect(m_WinLircAddr);
}
s.fUIce = !!m_fUIce;
s.strUIceAddr = m_UIceAddr;
- if(s.fUIce) {
+ if (s.fUIce) {
s.UIceClient.Connect(m_UIceAddr);
}
s.fGlobalMedia = !!m_fGlobalMedia;
@@ -1556,7 +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);
}
}
@@ -1566,11 +1566,11 @@ void CPPageAccelTbl::OnBnClickedButton2()
m_list.SetFocus();
POSITION pos = m_list.GetFirstSelectedItemPosition();
- if(!pos) {
+ 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);
@@ -1589,11 +1589,11 @@ 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
+ 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) {
*pResult = TRUE;
@@ -1607,7 +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;
}
@@ -1620,11 +1620,11 @@ void CPPageAccelTbl::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
CAtlList<CString> sl;
int nSel = -1;
- switch(pItem->iSubItem) {
+ switch (pItem->iSubItem) {
case COL_MOD:
- for(int i = 0; i < countof(s_mods); i++) {
+ for (int i = 0; i < countof(s_mods); i++) {
sl.AddTail(MakeAccelModLabel(s_mods[i]));
- if((a.fVirt&~3) == s_mods[i]) {
+ if ((a.fVirt&~3) == s_mods[i]) {
nSel = i;
}
}
@@ -1632,9 +1632,9 @@ void CPPageAccelTbl::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
break;
case COL_KEY:
- for(int i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
sl.AddTail(MakeAccelVkeyLabel(i, a.fVirt&FVIRTKEY));
- if(a.key == i) {
+ if (a.key == i) {
nSel = i;
}
}
@@ -1650,9 +1650,9 @@ void CPPageAccelTbl::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
break;
case COL_MOUSE:
- for(UINT i = 0; i < wmcmd::LAST; i++) {
+ for (UINT i = 0; i < wmcmd::LAST; i++) {
sl.AddTail(MakeMouseButtonLabel(i));
- if(wc.mouse == i) {
+ if (wc.mouse == i) {
nSel = i;
}
}
@@ -1660,9 +1660,9 @@ void CPPageAccelTbl::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
break;
case COL_APPCMD:
- for(int i = 0; i < countof(g_CommandList); i++) {
+ for (int i = 0; i < countof(g_CommandList); i++) {
sl.AddTail(g_CommandList[i].cmdname);
- if(wc.appcmd == g_CommandList[i].appcmd) {
+ if (wc.appcmd == g_CommandList[i].appcmd) {
nSel = i;
}
}
@@ -1688,19 +1688,19 @@ 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) {
+ switch (pItem->iSubItem) {
case COL_MOD:
- if(pItem->lParam >= 0 && pItem->lParam < countof(s_mods)) {
+ 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;
@@ -1708,7 +1708,7 @@ void CPPageAccelTbl::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
break;
case COL_KEY: {
int i = pItem->lParam;
- if(i >= 0 && i < 256) {
+ if (i >= 0 && i < 256) {
wc.key = (WORD)i;
m_list.SetItemText(pItem->iItem, COL_KEY, pItem->pszText);
*pResult = TRUE;
@@ -1717,7 +1717,7 @@ void CPPageAccelTbl::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
break;
case COL_TYPE: {
int i = pItem->lParam;
- if(i >= 0 && i < 2) {
+ 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"));
@@ -1727,7 +1727,7 @@ void CPPageAccelTbl::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
break;
case COL_APPCMD: {
int i = pItem->lParam;
- if(i >= 0 && i < countof(g_CommandList)) {
+ if (i >= 0 && i < countof(g_CommandList)) {
wc.appcmd = g_CommandList[i].appcmd;
m_list.SetItemText(pItem->iItem, COL_APPCMD, pItem->pszText);
*pResult = TRUE;
@@ -1753,7 +1753,7 @@ void CPPageAccelTbl::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
break;
}
- if(*pResult) {
+ if (*pResult) {
SetModified();
}
}
@@ -1763,7 +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);
@@ -1771,7 +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);
@@ -1790,15 +1790,15 @@ 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);
}
diff --git a/src/apps/mplayerc/PPageAudioSwitcher.cpp b/src/apps/mplayerc/PPageAudioSwitcher.cpp
index b51470915..373d861c2 100644
--- a/src/apps/mplayerc/PPageAudioSwitcher.cpp
+++ b/src/apps/mplayerc/PPageAudioSwitcher.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -117,14 +117,14 @@ 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();
}
@@ -150,7 +150,7 @@ 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);
@@ -184,7 +184,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);
@@ -200,13 +200,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();
}
}
@@ -216,7 +216,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();
@@ -227,11 +227,11 @@ void CPPageAudioSwitcher::OnEnChangeEdit1()
void CPPageAudioSwitcher::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
- if(nIDCtl != IDC_LIST1) {
+ if (nIDCtl != IDC_LIST1) {
return;
}
- // if(lpDrawItemStruct->itemID == 0)
+ // if (lpDrawItemStruct->itemID == 0)
// UpdateData();
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
@@ -247,7 +247,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);
@@ -257,10 +257,10 @@ 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 {
@@ -270,19 +270,19 @@ void CPPageAudioSwitcher::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStru
} 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))) {
+ 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);
@@ -297,7 +297,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,7 +327,7 @@ void CPPageAudioSwitcher::OnUpdateChannelMapping(CCmdUI* pCmdUI)
void CPPageAudioSwitcher::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
- if(*pScrollBar == m_AudioBoostCtrl) {
+ if (*pScrollBar == m_AudioBoostCtrl) {
UpdateData();
((CMainFrame*)GetParentFrame())->SetVolumeBoost(m_AudioBoostPos/10.0); // nice shortcut...
}
@@ -347,7 +347,7 @@ BOOL CPPageAudioSwitcher::OnToolTipNotify(UINT id, NMHDR * pNMHDR, LRESULT * pRe
nID = ::GetDlgCtrlID((HWND)nID);
}
- if(nID == 0) {
+ if (nID == 0) {
return FALSE;
}
@@ -355,7 +355,7 @@ BOOL CPPageAudioSwitcher::OnToolTipNotify(UINT id, NMHDR * pNMHDR, LRESULT * pRe
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;
}
diff --git a/src/apps/mplayerc/PPageBase.cpp b/src/apps/mplayerc/PPageBase.cpp
index de49f2931..e58b539a8 100644
--- a/src/apps/mplayerc/PPageBase.cpp
+++ b/src/apps/mplayerc/PPageBase.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -49,9 +49,9 @@ 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);
}
}
@@ -59,17 +59,17 @@ void CPPageBase::CreateToolTip()
BOOL CPPageBase::PreTranslateMessage(MSG* pMsg)
{
- if(IsWindow(m_wndToolTip))
- if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST) {
+ if (IsWindow(m_wndToolTip))
+ if (pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST) {
MSG msg;
memcpy(&msg, pMsg, sizeof(MSG));
- for(HWND hWndParent = ::GetParent(msg.hwnd);
+ for (HWND hWndParent = ::GetParent(msg.hwnd);
hWndParent && hWndParent != m_hWnd;
hWndParent = ::GetParent(hWndParent)) {
msg.hwnd = hWndParent;
}
- if(msg.hwnd) {
+ if (msg.hwnd) {
m_wndToolTip.RelayEvent(&msg);
}
}
diff --git a/src/apps/mplayerc/PPageCapture.cpp b/src/apps/mplayerc/PPageCapture.cpp
index 17d1ede17..22ae4d016 100644
--- a/src/apps/mplayerc/PPageCapture.cpp
+++ b/src/apps/mplayerc/PPageCapture.cpp
@@ -354,9 +354,9 @@ 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)) {
+ if (s.strAnalogVideo == CString(strName)) {
iSel = i;
}
CoTaskMemFree(strName);
@@ -367,12 +367,12 @@ void CPPageCapture::FindAnalogDevices()
{
int i = m_cbAnalogAudio.AddString(_T("<Video Capture Device>"));
m_audnames.Add(_T(""));
- if(s.strAnalogAudio.IsEmpty()) {
+ if (s.strAnalogAudio.IsEmpty()) {
iSel = i;
}
}
- if(m_cbAnalogVideo.GetCount()) {
+ if (m_cbAnalogVideo.GetCount()) {
m_cbAnalogVideo.SetCurSel(iSel);
}
@@ -387,24 +387,24 @@ 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)) {
+ 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) {
+ switch (s_countrycodes[j].standard) {
case AnalogVideo_NTSC_M:
standard = _T("NTSC M");
break;
@@ -472,12 +472,12 @@ void CPPageCapture::FindAnalogDevices()
int i = m_cbAnalogCountry.AddString(str);
m_cbAnalogCountry.SetItemDataPtr(i, &s_countrycodes[j]);
- if(s.iAnalogCountry == s_countrycodes[j].code) {
+ if (s.iAnalogCountry == s_countrycodes[j].code) {
iSel = i;
}
}
- if(m_cbAnalogCountry.GetCount()) {
+ if (m_cbAnalogCountry.GetCount()) {
m_cbAnalogCountry.SetCurSel(iSel);
}
}
@@ -496,7 +496,7 @@ 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;
@@ -505,7 +505,7 @@ void CPPageCapture::FindDigitalDevices()
}
}
EndEnumSysDev
- if(m_cbDigitalNetworkProvider.GetCount()) {
+ if (m_cbDigitalNetworkProvider.GetCount()) {
m_cbDigitalNetworkProvider.SetCurSel(iSel);
}
@@ -520,7 +520,7 @@ 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;
@@ -529,7 +529,7 @@ void CPPageCapture::FindDigitalDevices()
}
}
EndEnumSysDev
- if(m_cbDigitalTuner.GetCount()) {
+ if (m_cbDigitalTuner.GetCount()) {
m_cbDigitalTuner.SetCurSel(iSel);
}
@@ -543,7 +543,7 @@ 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;
@@ -552,7 +552,7 @@ void CPPageCapture::FindDigitalDevices()
}
}
EndEnumSysDev
- if(m_cbDigitalReceiver.GetCount()) {
+ if (m_cbDigitalReceiver.GetCount()) {
m_cbDigitalReceiver.SetCurSel(iSel);
}
}
diff --git a/src/apps/mplayerc/PPageCasimir.cpp b/src/apps/mplayerc/PPageCasimir.cpp
index 49760cc1d..c52c54579 100644
--- a/src/apps/mplayerc/PPageCasimir.cpp
+++ b/src/apps/mplayerc/PPageCasimir.cpp
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -126,16 +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/PPageDVD.cpp b/src/apps/mplayerc/PPageDVD.cpp
index 33adb2695..f13c81a1b 100644
--- a/src/apps/mplayerc/PPageDVD.cpp
+++ b/src/apps/mplayerc/PPageDVD.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -210,8 +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;
@@ -247,7 +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);
}
@@ -289,7 +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/PPageExternalFilters.cpp b/src/apps/mplayerc/PPageExternalFilters.cpp
index 672037df3..e5e61b990 100644
--- a/src/apps/mplayerc/PPageExternalFilters.cpp
+++ b/src/apps/mplayerc/PPageExternalFilters.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -60,7 +60,7 @@ void CPPageExternalFilters::DoDataExchange(CDataExchange* pDX)
void CPPageExternalFilters::StepUp(CCheckListBox& list)
{
int i = list.GetCurSel();
- if(i < 1) {
+ if (i < 1) {
return;
}
@@ -79,7 +79,7 @@ void CPPageExternalFilters::StepUp(CCheckListBox& list)
void CPPageExternalFilters::StepDown(CCheckListBox& list)
{
int i = list.GetCurSel();
- if(i < 0 || i >= list.GetCount()-1) {
+ if (i < 0 || i >= list.GetCount()-1) {
return;
}
@@ -291,22 +291,22 @@ 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()) {
+ if (name.IsEmpty()) {
name = f->name + _T(" <not registered>");
}
- } else if(f->type == FilterOverride::EXTERNAL) {
+ } else if (f->type == FilterOverride::EXTERNAL) {
name = f->name;
- if(f->fTemporary) {
+ if (f->fTemporary) {
name += _T(" <temporary>");
}
- if(!CPath(MakeFullPath(f->path)).FileExists()) {
+ if (!CPath(MakeFullPath(f->path)).FileExists()) {
name += _T(" <not found!>");
}
}
@@ -330,8 +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);
@@ -343,7 +343,7 @@ 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 {
pCmdUI->Enable(FALSE);
@@ -380,15 +380,15 @@ 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()) {
+ if (f->type == FilterOverride::EXTERNAL) {
+ if (!CPath(MakeFullPath(f->path)).FileExists()) {
name += _T(" <not found!>");
}
}
@@ -397,7 +397,7 @@ void CPPageExternalFilters::OnAddRegistered()
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();
}
@@ -411,7 +411,7 @@ 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()) {
+ if (i >= m_filters.GetCount()) {
i--;
}
m_filters.SetCurSel(i);
@@ -430,26 +430,26 @@ 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"");
}
@@ -462,7 +462,7 @@ void CPPageExternalFilters::OnLbnDblclkFilter()
void CPPageExternalFilters::OnAddMajorType()
{
FilterOverride* f = GetCurFilter();
- if(!f) {
+ if (!f) {
return;
}
@@ -470,10 +470,10 @@ void CPPageExternalFilters::OnAddMajorType()
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;
}
@@ -498,17 +498,17 @@ void CPPageExternalFilters::OnAddMajorType()
void CPPageExternalFilters::OnAddSubType()
{
FilterOverride* f = GetCurFilter();
- if(!f) {
+ if (!f) {
return;
}
HTREEITEM node = m_tree.GetSelectedItem();
- if(!node) {
+ if (!node) {
return;
}
HTREEITEM child = m_tree.GetChildItem(node);
- if(!child) {
+ if (!child) {
return;
}
@@ -519,11 +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;
}
@@ -542,16 +542,16 @@ void CPPageExternalFilters::OnAddSubType()
void CPPageExternalFilters::OnDeleteType()
{
- if(FilterOverride* f = GetCurFilter()) {
+ if (FilterOverride* f = GetCurFilter()) {
HTREEITEM node = m_tree.GetSelectedItem();
- if(!node) {
+ 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;
@@ -574,7 +574,7 @@ 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);
@@ -588,7 +588,7 @@ void CPPageExternalFilters::OnDeleteType()
void CPPageExternalFilters::OnResetTypes()
{
- if(FilterOverride* f = GetCurFilter()) {
+ if (FilterOverride* f = GetCurFilter()) {
f->guids.RemoveAll();
f->guids.AddTailList(&f->backup);
@@ -599,8 +599,8 @@ void CPPageExternalFilters::OnResetTypes()
void CPPageExternalFilters::OnLbnSelchangeList1()
{
- if(FilterOverride* f = GetCurFilter()) {
- if(m_pLastSelFilter == f) {
+ if (FilterOverride* f = GetCurFilter()) {
+ if (m_pLastSelFilter == f) {
return;
}
m_pLastSelFilter = f;
@@ -610,15 +610,15 @@ void CPPageExternalFilters::OnLbnSelchangeList1()
m_dwMerit = f->dwMerit;
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)) {
+ if (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));
@@ -626,7 +626,7 @@ void CPPageExternalFilters::OnLbnSelchangeList1()
HTREEITEM node = NULL;
void* val = NULL;
- if(map.Lookup(major, val)) {
+ if (map.Lookup(major, val)) {
node = (HTREEITEM)val;
} else {
map[major] = node = m_tree.InsertItem(major);
@@ -639,7 +639,7 @@ 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);
}
@@ -658,7 +658,7 @@ void CPPageExternalFilters::OnLbnSelchangeList1()
void CPPageExternalFilters::OnBnClickedRadio()
{
UpdateData();
- if(FilterOverride* f = GetCurFilter()) {
+ if (FilterOverride* f = GetCurFilter()) {
f->iLoadType = m_iLoadType;
}
}
@@ -666,9 +666,9 @@ void CPPageExternalFilters::OnBnClickedRadio()
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;
}
}
@@ -678,19 +678,19 @@ void CPPageExternalFilters::OnNMDblclkTree2(NMHDR *pNMHDR, LRESULT *pResult)
{
*pResult = 0;
- if(FilterOverride* f = GetCurFilter()) {
+ if (FilterOverride* f = GetCurFilter()) {
HTREEITEM node = m_tree.GetSelectedItem();
- if(!node) {
+ if (!node) {
return;
}
POSITION pos = (POSITION)m_tree.GetItemData(node);
- if(!pos) {
+ if (!pos) {
return;
}
f->guids.GetNext(pos);
- if(!pos) {
+ if (!pos) {
return;
}
@@ -698,7 +698,7 @@ void CPPageExternalFilters::OnNMDblclkTree2(NMHDR *pNMHDR, LRESULT *pResult)
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,21 +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/PPageFileInfoClip.cpp b/src/apps/mplayerc/PPageFileInfoClip.cpp
index 357e88a84..1266b22b4 100644
--- a/src/apps/mplayerc/PPageFileInfoClip.cpp
+++ b/src/apps/mplayerc/PPageFileInfoClip.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -47,7 +47,7 @@ CPPageFileInfoClip::CPPageFileInfoClip(CString fn, IFilterGraph* pFG)
CPPageFileInfoClip::~CPPageFileInfoClip()
{
- if(m_hIcon) {
+ if (m_hIcon) {
DestroyIcon(m_hIcon);
}
}
@@ -75,13 +75,13 @@ BOOL CPPageFileInfoClip::OnInitDialog()
{
__super::OnInitDialog();
- if(m_fn == _T("")) {
+ 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);
}
@@ -92,46 +92,46 @@ 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) {
+ 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) {
+ if (!fEmpty) {
break;
}
}
diff --git a/src/apps/mplayerc/PPageFileInfoDetails.cpp b/src/apps/mplayerc/PPageFileInfoDetails.cpp
index 23fa18487..e2eb793f1 100644
--- a/src/apps/mplayerc/PPageFileInfoDetails.cpp
+++ b/src/apps/mplayerc/PPageFileInfoDetails.cpp
@@ -50,7 +50,7 @@ CPPageFileInfoDetails::CPPageFileInfoDetails(CString fn, IFilterGraph* pFG, ISub
CPPageFileInfoDetails::~CPPageFileInfoDetails()
{
- if(m_hIcon) {
+ if (m_hIcon) {
DestroyIcon(m_hIcon);
}
}
@@ -76,8 +76,8 @@ END_MESSAGE_MAP()
static bool GetProperty(IFilterGraph* pFG, LPCOLESTR propName, VARIANT* vt)
{
BeginEnumFilters(pFG, pEF, pBF) {
- if(CComQIPtr<IPropertyBag> pPB = pBF)
- if(SUCCEEDED(pPB->Read(propName, vt, NULL))) {
+ if (CComQIPtr<IPropertyBag> pPB = pBF)
+ if (SUCCEEDED(pPB->Read(propName, vt, NULL))) {
return true;
}
}
@@ -103,13 +103,13 @@ BOOL CPPageFileInfoDetails::OnInitDialog()
{
__super::OnInitDialog();
- if(m_fn == _T("")) {
+ 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);
}
@@ -120,22 +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);
@@ -149,7 +149,7 @@ 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;
@@ -158,14 +158,14 @@ BOOL CPPageFileInfoDetails::OnInitDialog()
StrFormatByteSizeW(size, szFileSize, sizeof(szFileSize));
m_size.Format(_T("%s (%I64d bytes)"), szFileSize, 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),
@@ -174,13 +174,13 @@ 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) {
+ 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 {
@@ -188,18 +188,18 @@ BOOL CPPageFileInfoDetails::OnInitDialog()
}
}
- if(wh.cx == 0 && wh.cy == 0) {
+ if (wh.cx == 0 && wh.cy == 0) {
BeginEnumFilters(m_pFG, pEF, pBF) {
- if(CComQIPtr<IBasicVideo> pBV = 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;
}
@@ -208,15 +208,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) {
+ 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;
@@ -245,19 +245,19 @@ void CPPageFileInfoDetails::InitEncoding()
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;
}
}
@@ -266,14 +266,14 @@ void CPPageFileInfoDetails::InitEncoding()
BeginEnumPins(pBF, pEP, pPin) {
CMediaTypeEx mt;
PIN_DIRECTION dir;
- if(FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_OUTPUT
+ if (FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_OUTPUT
|| 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/PPageFileInfoRes.cpp b/src/apps/mplayerc/PPageFileInfoRes.cpp
index 9ca363825..93679a2dd 100644
--- a/src/apps/mplayerc/PPageFileInfoRes.cpp
+++ b/src/apps/mplayerc/PPageFileInfoRes.cpp
@@ -39,7 +39,7 @@ CPPageFileInfoRes::CPPageFileInfoRes(CString fn, IFilterGraph* pFG)
CPPageFileInfoRes::~CPPageFileInfoRes()
{
- if(m_hIcon) {
+ if (m_hIcon) {
DestroyIcon(m_hIcon);
}
}
@@ -65,13 +65,13 @@ 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);
}
@@ -81,13 +81,13 @@ BOOL CPPageFileInfoRes::OnInitDialog()
m_list.InsertColumn(1, _T("Mime Type"), LVCFMT_LEFT, 127);
BeginEnumFilters(m_pFG, pEF, pBF) {
- if(CComQIPtr<IDSMResourceBag> pRB = pBF)
- if(pRB && pRB->ResGetCount() > 0) {
- for(DWORD i = 0; i < pRB->ResGetCount(); i++) {
+ if (CComQIPtr<IDSMResourceBag> pRB = pBF)
+ 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,7 +114,7 @@ BOOL CPPageFileInfoRes::OnInitDialog()
void CPPageFileInfoRes::OnSaveAs()
{
int i = m_list.GetSelectionMark();
- if(i < 0) {
+ if (i < 0) {
return;
}
@@ -123,8 +123,8 @@ void CPPageFileInfoRes::OnSaveAs()
CFileDialog fd(FALSE, NULL, CString(r.name),
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_NOCHANGEDIR,
_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,7 @@ void CPPageFileInfoRes::OnUpdateSaveAs(CCmdUI* pCmdUI)
void CPPageFileInfoRes::OnNMDblclkList1(NMHDR *pNMHDR, LRESULT *pResult)
{
int i = m_list.GetSelectionMark();
- if(i < 0) {
+ if (i < 0) {
return;
}
diff --git a/src/apps/mplayerc/PPageFileInfoSheet.cpp b/src/apps/mplayerc/PPageFileInfoSheet.cpp
index 632f314a8..6e0ed5e3d 100644
--- a/src/apps/mplayerc/PPageFileInfoSheet.cpp
+++ b/src/apps/mplayerc/PPageFileInfoSheet.cpp
@@ -42,8 +42,8 @@ CPPageFileInfoSheet::CPPageFileInfoSheet(CString fn, CMainFrame* pMainFrame, CWn
AddPage(&m_clip);
BeginEnumFilters(pMainFrame->pGB, pEF, pBF) {
- if(CComQIPtr<IDSMResourceBag> pRB = pBF)
- if(pRB && pRB->ResGetCount() > 0) {
+ if (CComQIPtr<IDSMResourceBag> pRB = pBF)
+ if (pRB && pRB->ResGetCount() > 0) {
AddPage(&m_res);
break;
}
@@ -73,7 +73,7 @@ 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");
@@ -105,7 +105,7 @@ void CPPageFileInfoSheet::OnSaveAs()
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 285109d20..50faf9b85 100644
--- a/src/apps/mplayerc/PPageFileMediaInfo.cpp
+++ b/src/apps/mplayerc/PPageFileMediaInfo.cpp
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -68,7 +68,7 @@ END_MESSAGE_MAP()
static WNDPROC OldControlProc;
static LRESULT CALLBACK ControlProc(HWND control, UINT message, WPARAM wParam, LPARAM lParam)
{
- if(message == WM_KEYDOWN) {
+ if (message == WM_KEYDOWN) {
if ((LOWORD(wParam)== 'A' || LOWORD(wParam) == 'a')
&&(GetKeyState(VK_CONTROL) < 0)) {
CEdit *pEdit = (CEdit*)CWnd::FromHandle(control);
@@ -84,20 +84,20 @@ BOOL CPPageFileMediaInfo::OnInitDialog()
{
__super::OnInitDialog();
- if(!m_pCFont) {
+ if (!m_pCFont) {
m_pCFont = DNew CFont;
}
- if(!m_pCFont) {
+ if (!m_pCFont) {
return TRUE;
}
- if(m_fn == _T("")) {
+ 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,7 @@ BOOL CPPageFileMediaInfo::OnInitDialog()
MI.Option(_T("Complete"));
MI_Text = MI.Inform().c_str();
MI.Close();
- if(!MI_Text.Find(_T("Unable to load"))) {
+ if (!MI_Text.Find(_T("Unable to load"))) {
MI_Text = _T("");
}
@@ -142,7 +142,7 @@ 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 {
GetParent()->GetDlgItem(IDC_BUTTON_MI)->ShowWindow(SW_HIDE);
diff --git a/src/apps/mplayerc/PPageFormats.cpp b/src/apps/mplayerc/PPageFormats.cpp
index e4cb26116..d0cafb930 100644
--- a/src/apps/mplayerc/PPageFormats.cpp
+++ b/src/apps/mplayerc/PPageFormats.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -109,7 +109,7 @@ 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("");
}
@@ -122,7 +122,7 @@ 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("");
}
@@ -155,22 +155,22 @@ bool CPPageFormats::IsRegistered(CString ext)
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)) {
f_setContextFiles = (strCommand.CompareNoCase(CString(buff)) == 0);
@@ -185,7 +185,7 @@ bool CPPageFormats::IsRegistered(CString ext)
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)) {
bIsDefault = (strCommand.CompareNoCase(CString(buff)) == 0);
@@ -224,9 +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);
@@ -241,8 +241,8 @@ 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);
@@ -253,26 +253,26 @@ 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)) {
+ if (ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID)) {
return(false);
}
- if(ERROR_SUCCESS != key.SetStringValue(NULL, strLabel)) {
+ 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"))) {
+ 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))) {
+ 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"))) {
+ if (ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\enqueue\\command"))) {
return(false);
}
- if(bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, GetEnqueueCommand()))) {
+ if (bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, GetEnqueueCommand()))) {
return(false);
}
} else {
@@ -282,61 +282,61 @@ bool CPPageFormats::RegisterExt(CString ext, CString strLabel, bool fRegister)
}
// Play option
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open"))) {
+ 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))) {
+ if (f_setContextFiles) {
+ if (ERROR_SUCCESS != key.SetStringValue(NULL, ResStr(IDS_OPEN_WITH_MPC))) {
return(false);
}
} else {
- if(ERROR_SUCCESS != key.SetStringValue(NULL, _T(""))) {
+ if (ERROR_SUCCESS != key.SetStringValue(NULL, _T(""))) {
return(false);
}
}
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open\\command"))) {
+ if (ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open\\command"))) {
return(false);
}
- if(bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, GetOpenCommand()))) {
+ if (bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, GetOpenCommand()))) {
return(false);
}
- if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE, g_strRegisteredKey + _T("\\FileAssociations"))) {
+ if (ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE, g_strRegisteredKey + _T("\\FileAssociations"))) {
return(false);
}
- if(ERROR_SUCCESS != key.SetStringValue(ext, strProgID)) {
+ 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"))) {
+ if (ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\DefaultIcon"))) {
return(false);
}
- if(bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, AppIcon))) {
+ if (bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, AppIcon))) {
return(false);
}
} else {
@@ -344,7 +344,7 @@ bool CPPageFormats::RegisterExt(CString ext, CString strLabel, bool fRegister)
key.RecurseDeleteKey(strProgID + _T("\\DefaultIcon"));
}
- if(fRegister != IsRegistered(ext)) {
+ if (fRegister != IsRegistered(ext)) {
SetFileAssociation (ext, strProgID, fRegister);
}
@@ -364,33 +364,33 @@ static struct {
void CPPageFormats::AddAutoPlayToRegistry(autoplay_t ap, bool fRegister)
{
TCHAR buff[_MAX_PATH];
- if(::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH) == 0) {
+ if (::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH) == 0) {
return;
}
CString exe = buff;
int i = (int)ap;
- if(i < 0 || i >= countof(handlers)) {
+ if (i < 0 || i >= countof(handlers)) {
return;
}
CRegKey key;
- if(fRegister) {
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, _T("MediaPlayerClassic.Autorun"))) {
+ 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"))) {
+ if (ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT,
+ 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"))) {
+ if (ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE,
+ CString(CStringA("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\Handlers\\MPCPlay") + handlers[i].verb + "OnArrival"))) {
return;
}
key.SetStringValue(_T("Action"), ResStr(handlers[i].action));
@@ -400,15 +400,15 @@ void CPPageFormats::AddAutoPlayToRegistry(autoplay_t ap, bool fRegister)
key.SetStringValue(_T("DefaultIcon"), exe + _T(",0"));
key.Close();
- if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE,
- CString(CStringA("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\EventHandlers\\Play") + handlers[i].verb + "OnArrival"))) {
+ if (ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE,
+ 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 {
- if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE,
- CString(CStringA("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\EventHandlers\\Play") + handlers[i].verb + "OnArrival"))) {
+ if (ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE,
+ CString(CStringA("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\EventHandlers\\Play") + handlers[i].verb + "OnArrival"))) {
return;
}
key.DeleteValue(CString(CStringA("MPCPlay") + handlers[i].verb + "OnArrival"));
@@ -420,41 +420,41 @@ bool CPPageFormats::IsAutoPlayRegistered(autoplay_t ap)
{
ULONG len;
TCHAR buff[_MAX_PATH];
- if(::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH) == 0) {
+ if (::GetModuleFileName(AfxGetInstanceHandle(), buff, _MAX_PATH) == 0) {
return(false);
}
CString exe = buff;
int i = (int)ap;
- if(i < 0 || i >= countof(handlers)) {
+ 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)) {
+ 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);
}
len = countof(buff);
- if(ERROR_SUCCESS != key.QueryStringValue(
+ if (ERROR_SUCCESS != key.QueryStringValue(
CString(_T("MPCPlay")) + handlers[i].verb + _T("OnArrival"),
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)) {
+ if (ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT,
+ CString(CStringA("MediaPlayerClassic.Autorun\\Shell\\Play") + handlers[i].verb + "\\Command"),
+ 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();
@@ -464,7 +464,7 @@ bool CPPageFormats::IsAutoPlayRegistered(autoplay_t ap)
void CPPageFormats::SetListItemState(int nItem)
{
- if(nItem < 0) {
+ if (nItem < 0) {
return;
}
@@ -476,7 +476,7 @@ void CPPageFormats::SetListItemState(int nItem)
int cnt = 0;
POSITION pos = exts.GetHeadPosition();
- while(pos) if(IsRegistered(exts.GetNext(pos))) {
+ while (pos) if (IsRegistered(exts.GetNext(pos))) {
cnt++;
}
@@ -518,7 +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());
@@ -549,7 +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);
@@ -590,7 +590,7 @@ 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)) {
fContextDir = (strCommand.CompareNoCase(CString(buff)) == 0);
@@ -628,14 +628,14 @@ BOOL CPPageFormats::SetFileAssociation(CString strExt, CString strProgID, bool f
CString strNewApp;
if (fRegister) {
// Create non existing file type
- if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strExt)) {
+ 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 (ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID)) {
return(false);
}
@@ -647,7 +647,7 @@ BOOL CPPageFormats::SetFileAssociation(CString strExt, CString strProgID, bool f
{
len = sizeof(buff);
memset(buff, 0, len);
- if(ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && !CString(buff).Trim().IsEmpty())
+ if (ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && !CString(buff).Trim().IsEmpty())
{
if (ERROR_SUCCESS == key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\DefaultIcon")))
key.SetStringValue (NULL, buff);
@@ -658,11 +658,11 @@ BOOL CPPageFormats::SetFileAssociation(CString strExt, CString strProgID, bool f
}
strNewApp = g_strRegisteredAppName;
} else {
- if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, strProgID)) {
+ 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;
}
@@ -674,16 +674,16 @@ BOOL CPPageFormats::SetFileAssociation(CString strExt, CString strProgID, bool f
// The 2000/XP way
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)) {
+ if (ERROR_SUCCESS != key.SetStringValue(NULL, strProgID)) {
return(false);
}
@@ -695,14 +695,14 @@ BOOL CPPageFormats::SetFileAssociation(CString strExt, CString strProgID, bool f
{
len = sizeof(buff);
memset(buff, 0, len);
- if(ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && !CString(buff).Trim().IsEmpty())
+ if (ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && !CString(buff).Trim().IsEmpty())
extOldIcon = buff;
}
}
*/
// 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);
@@ -715,15 +715,15 @@ BOOL CPPageFormats::SetFileAssociation(CString strExt, CString strProgID, bool f
// 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);
@@ -741,10 +741,10 @@ BOOL CPPageFormats::OnApply()
{
int i = m_list.GetSelectionMark();
- if(i >= 0) {
+ if (i >= 0) {
i = (int)m_list.GetItemData(i);
}
- if(i >= 0) {
+ if (i >= 0) {
CMediaFormats& mf = AfxGetAppSettings().m_Formats;
mf[i].SetExts(m_exts);
m_exts = mf[i].GetExtsWithPeriod();
@@ -757,7 +757,7 @@ 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");
@@ -767,10 +767,10 @@ BOOL CPPageFormats::OnApply()
// 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);
}
@@ -784,9 +784,9 @@ 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) {
+ if (iChecked == 2) {
continue;
}
@@ -794,26 +794,26 @@ BOOL CPPageFormats::OnApply()
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 {
@@ -844,10 +844,10 @@ 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 (r.PtInRect(lpnmlv->ptAction)) {
if (m_bInsufficientPrivileges) {
MessageBox (ResStr (IDS_CANNOT_CHANGE_FORMAT));
} else {
@@ -864,7 +864,7 @@ void CPPageFormats::OnLvnItemchangedList1(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
- if(pNMLV->iItem >= 0 && pNMLV->iSubItem == COL_CATEGORY
+ if (pNMLV->iItem >= 0 && pNMLV->iSubItem == COL_CATEGORY
&& (pNMLV->uChanged&LVIF_STATE) && (pNMLV->uNewState&LVIS_SELECTED)) {
m_exts = AfxGetAppSettings().m_Formats[(int)m_list.GetItemData(pNMLV->iItem)].GetExtsWithPeriod();
UpdateData(FALSE);
@@ -880,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;
}
}
@@ -896,7 +896,7 @@ void CPPageFormats::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
*pResult = FALSE;
- if(pItem->iItem < 0) {
+ if (pItem->iItem < 0) {
return;
}
@@ -905,7 +905,7 @@ void CPPageFormats::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
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"));
@@ -926,30 +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);
}
@@ -965,8 +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;
}
@@ -985,7 +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);
}
@@ -1007,7 +1007,7 @@ 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);
}
}
@@ -1015,7 +1015,7 @@ void CPPageFormats::OnBnVistaModify()
void CPPageFormats::OnBnClickedButton12()
{
int i = m_list.GetSelectionMark();
- if(i < 0) {
+ if (i < 0) {
return;
}
i = (int)m_list.GetItemData(i);
@@ -1032,7 +1032,7 @@ void CPPageFormats::OnBnClickedButton11()
{
UpdateData();
int i = m_list.GetSelectionMark();
- if(i < 0) {
+ if (i < 0) {
return;
}
i = (int)m_list.GetItemData(i);
@@ -1048,7 +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;
}
@@ -1065,7 +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/PPageFullscreen.cpp b/src/apps/mplayerc/PPageFullscreen.cpp
index 670151bdb..40365d3fc 100644
--- a/src/apps/mplayerc/PPageFullscreen.cpp
+++ b/src/apps/mplayerc/PPageFullscreen.cpp
@@ -110,7 +110,7 @@ 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;
}
@@ -118,7 +118,7 @@ BOOL CPPageFullscreen::OnInitDialog()
monitor = monitors.GetMonitor( i );
monitor.GetName(str);
- if(monitor.IsMonitor()) {
+ if (monitor.IsMonitor()) {
DISPLAY_DEVICE displayDevice;
ZeroMemory(&displayDevice, sizeof(displayDevice));
displayDevice.cb = sizeof(displayDevice);
@@ -127,13 +127,13 @@ 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 {
m_iMonitorType = 0;
@@ -161,22 +161,22 @@ BOOL CPPageFullscreen::OnApply()
m_AutoChangeFullscrRes.bEnabled = !!m_fSetFullscreenRes;
if (m_AutoChangeFullscrRes.bEnabled) {
- if(iSel_24 >= 0 && iSel_24 < m_dms.GetCount()) {
+ 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()];
}
}
@@ -237,7 +237,7 @@ void CPPageFullscreen::OnUpdateFullScrCombo()
{
CMonitors monitors;
m_f_hmonitor = m_MonitorDisplayNames[m_iMonitorTypeCtrl.GetCurSel()];
- if(AfxGetAppSettings().strFullScreenMonitor != m_f_hmonitor) {
+ if (AfxGetAppSettings().strFullScreenMonitor != m_f_hmonitor) {
m_AutoChangeFullscrRes.bEnabled = false;
}
ModesUpdate();
@@ -263,7 +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;
}
@@ -277,12 +277,14 @@ 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 != 32) continue; // skip non 32bpp mode
+ if (dm.bpp != 32) {
+ continue; // skip non 32bpp mode
+ }
//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
@@ -308,27 +310,27 @@ void CPPageFullscreen::ModesUpdate()
m_dispmode23d976combo.AddString(str);
m_dispmode29d97combo.AddString(str);
- if(iSel_24 < 0 && dmtoset24.fValid && dm.size == dmtoset24.size
+ if (iSel_24 < 0 && dmtoset24.fValid && dm.size == dmtoset24.size
&& dm.bpp == dmtoset24.bpp && dm.freq == dmtoset24.freq) {
iSel_24 = j;
}
- if(iSel_25 < 0 && dmtoset25.fValid && dm.size == dmtoset25.size
+ if (iSel_25 < 0 && dmtoset25.fValid && dm.size == dmtoset25.size
&& dm.bpp == dmtoset25.bpp && dm.freq == dmtoset25.freq) {
iSel_25 = j;
}
- if(iSel_30 < 0 && dmtoset30.fValid && dm.size == dmtoset30.size
+ if (iSel_30 < 0 && dmtoset30.fValid && dm.size == dmtoset30.size
&& dm.bpp == dmtoset30.bpp && dm.freq == dmtoset30.freq) {
iSel_30 = j;
}
- if(iSel_Other < 0 && dmtosetOther.fValid && dm.size == dmtosetOther.size
+ if (iSel_Other < 0 && dmtosetOther.fValid && dm.size == dmtosetOther.size
&& dm.bpp == dmtosetOther.bpp && dm.freq == dmtosetOther.freq) {
iSel_Other = j;
}
- if(iSel_23 < 0 && dmtoset23.fValid && dm.size == dmtoset23.size
+ if (iSel_23 < 0 && dmtoset23.fValid && dm.size == dmtoset23.size
&& dm.bpp == dmtoset23.bpp && dm.freq == dmtoset23.freq) {
iSel_23 = j;
}
- if(iSel_29 < 0 && dmtoset29.fValid && dm.size == dmtoset29.size
+ if (iSel_29 < 0 && dmtoset29.fValid && dm.size == dmtoset29.size
&& dm.bpp == dmtoset29.bpp && dm.freq == dmtoset29.freq) {
iSel_29 = j;
}
diff --git a/src/apps/mplayerc/PPageInternalFilters.cpp b/src/apps/mplayerc/PPageInternalFilters.cpp
index e9a133b77..15d177b0a 100644
--- a/src/apps/mplayerc/PPageInternalFilters.cpp
+++ b/src/apps/mplayerc/PPageInternalFilters.cpp
@@ -214,7 +214,7 @@ INT_PTR CPPageInternalFiltersListBox::OnToolHitTest(CPoint point, TOOLINFO* pTI)
{
BOOL b = FALSE;
int row = ItemFromPoint(point, b);
- if(row < 0) {
+ if (row < 0) {
return -1;
}
@@ -239,7 +239,7 @@ BOOL CPPageInternalFiltersListBox::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESU
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
filter_t* f = (filter_t*)GetItemDataPtr(pNMHDR->idFrom);
- if(f->nHintID == 0) {
+ if (f->nHintID == 0) {
return FALSE;
}
@@ -249,7 +249,7 @@ 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;
}
@@ -264,8 +264,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;
@@ -275,14 +275,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);
}
}
@@ -324,8 +324,8 @@ void CPPageInternalFiltersListBox::OnRButtonDown(UINT nFlags, CPoint point)
}
int Index = 0;
- for(int i = 0; i < countof(s_filters); i++) {
- switch(s_filters[i].type) {
+ for (int i = 0; i < countof(s_filters); i++) {
+ switch (s_filters[i].type) {
case 0: // source filter
if (m_n == 1) {
continue;
@@ -342,7 +342,7 @@ void CPPageInternalFiltersListBox::OnRButtonDown(UINT nFlags, CPoint point)
continue;
}
- switch(id) {
+ switch (id) {
case ENABLEALL:
SetCheck(Index, TRUE);
break;
@@ -350,22 +350,22 @@ void CPPageInternalFiltersListBox::OnRButtonDown(UINT nFlags, CPoint point)
SetCheck(Index, FALSE);
break;
case ENABLEFFDSHOW:
- if(s_filters[i].type == 3) {
+ if (s_filters[i].type == 3) {
SetCheck(Index, TRUE);
}
break;
case DISABLEFFDSHOW:
- if(s_filters[i].type == 3) {
+ if (s_filters[i].type == 3) {
SetCheck(Index, FALSE);
}
break;
case ENABLEDXVA:
- if(s_filters[i].type == 2) {
+ if (s_filters[i].type == 2) {
SetCheck(Index, TRUE);
}
break;
case DISABLEDXVA:
- if(s_filters[i].type == 2) {
+ if (s_filters[i].type == 2) {
SetCheck(Index, FALSE);
}
break;
@@ -409,11 +409,11 @@ 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) {
+ switch (s_filters[i].type) {
case SOURCE_FILTER: // source filter
l = &m_listSrc;
checked = s.SrcFilters[s_filters[i].flag];
@@ -456,10 +456,10 @@ BOOL CPPageInternalFilters::OnApply()
CPPageInternalFiltersListBox* list = &m_listSrc;
for (int l=0; l<2; l++) {
- for(int i = 0; i < list->GetCount(); i++) {
+ for (int i = 0; i < list->GetCount(); i++) {
filter_t* f = (filter_t*) list->GetItemDataPtr(i);
- switch(f->type) {
+ switch (f->type) {
case SOURCE_FILTER:
s.SrcFilters[f->flag] = list->GetCheck(i);
break;
@@ -483,25 +483,25 @@ BOOL CPPageInternalFilters::OnApply()
void CPPageInternalFilters::ShowPPage(CPPageInternalFiltersListBox& l)
{
int i = l.GetCurSel();
- if(i < 0) {
+ if (i < 0) {
return;
}
filter_t* f = (filter_t*)l.GetItemDataPtr(i);
- if(!f || !f->CreateInstance) {
+ if (!f || !f->CreateInstance) {
return;
}
HRESULT hr;
CUnknown* pObj = f->CreateInstance(NULL, &hr);
- if(!pObj) {
+ 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/PPageLogo.cpp b/src/apps/mplayerc/PPageLogo.cpp
index f4cd2fa14..9b47fdc68 100644
--- a/src/apps/mplayerc/PPageLogo.cpp
+++ b/src/apps/mplayerc/PPageLogo.cpp
@@ -78,14 +78,14 @@ 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) {
+ if (!m_intext) {
OnBnClickedRadio1();
} else {
OnBnClickedRadio2();
@@ -146,14 +146,14 @@ 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) {
+ if (!m_logoidpos) {
m_logoidpos = m_logoids.GetHeadPosition();
}
} else {
m_logoids.GetPrev(m_logoidpos);
- if(!m_logoidpos) {
+ if (!m_logoidpos) {
m_logoidpos = m_logoids.GetTailPosition();
}
}
@@ -172,7 +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();
@@ -185,9 +185,9 @@ 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)) {
+ if (!m_author.LoadString(id)) {
m_author = ResStr(IDS_LOGO_AUTHOR);
}
}
diff --git a/src/apps/mplayerc/PPageOutput.cpp b/src/apps/mplayerc/PPageOutput.cpp
index 08fe12956..8c09615c8 100644
--- a/src/apps/mplayerc/PPageOutput.cpp
+++ b/src/apps/mplayerc/PPageOutput.cpp
@@ -91,7 +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);
}
@@ -132,7 +132,7 @@ BOOL CPPageOutput::OnInitDialog()
BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker) {
LPOLESTR olestr = NULL;
- if(FAILED(pMoniker->GetDisplayName(0, 0, &olestr))) {
+ if (FAILED(pMoniker->GetDisplayName(0, 0, &olestr))) {
continue;
}
@@ -142,16 +142,16 @@ 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);
}
@@ -162,7 +162,7 @@ BOOL CPPageOutput::OnInitDialog()
}
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++;
@@ -172,21 +172,21 @@ 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;
}
@@ -203,7 +203,7 @@ BOOL CPPageOutput::OnInitDialog()
D3DADAPTER_IDENTIFIER9 adapterIdentifier;
- for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
+ 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(" - ");
@@ -212,14 +212,14 @@ BOOL CPPageOutput::OnInitDialog()
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) {
+ 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) {
@@ -236,29 +236,29 @@ 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);
}
@@ -273,18 +273,18 @@ 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 {
GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(FALSE);
GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(FALSE);
- if(m_iD3D9RenderDevice == -1) {
+ if (m_iD3D9RenderDevice == -1) {
CheckDlgButton(IDC_D3D9DEVICE, BST_UNCHECKED);
}
}
@@ -360,7 +360,7 @@ void CPPageOutput::OnDSRendererChange(UINT nIDbutton)
GetDlgItem(IDC_DX_SURFACE)->EnableWindow(TRUE);
break;
case 6 : // VMR9 renderless
- if(m_iD3D9RenderDeviceCtrl.GetCount()>1) {
+ if (m_iD3D9RenderDeviceCtrl.GetCount()>1) {
GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(TRUE);
GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(IsDlgButtonChecked(IDC_D3D9DEVICE));
}
@@ -370,7 +370,7 @@ void CPPageOutput::OnDSRendererChange(UINT nIDbutton)
GetDlgItem(IDC_DSVMR9ALTERNATIVEVSYNC)->EnableWindow(TRUE);
GetDlgItem(IDC_RESETDEVICE)->EnableWindow(TRUE);
case 11 : // EVR custom presenter
- if(m_iD3D9RenderDeviceCtrl.GetCount()>1) {
+ if (m_iD3D9RenderDeviceCtrl.GetCount()>1) {
GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(TRUE);
GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(IsDlgButtonChecked(IDC_D3D9DEVICE));
}
diff --git a/src/apps/mplayerc/PPagePlayback.cpp b/src/apps/mplayerc/PPagePlayback.cpp
index cac28e157..bbf0c780c 100644
--- a/src/apps/mplayerc/PPagePlayback.cpp
+++ b/src/apps/mplayerc/PPagePlayback.cpp
@@ -149,7 +149,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();
}
@@ -158,10 +158,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); // see prev note...
}
@@ -204,24 +204,27 @@ BOOL CPPagePlayback::OnToolTipNotify(UINT id, NMHDR * pNMHDR, LRESULT * pResult)
nID = ::GetDlgCtrlID((HWND)nID);
}
- if(nID == 0) return FALSE;
+ if (nID == 0) {
+ return FALSE;
+ }
static CStringW m_strTipTextW;
if (nID == IDC_SLIDER1) {
m_strTipTextW.Format(L"%d%%", m_nVolume);
- }
- else if (nID == IDC_SLIDER2) {
- if (m_nBalance == 0)
+ } else if (nID == IDC_SLIDER2) {
+ if (m_nBalance == 0) {
m_strTipTextW = L"L = R";
- else if (m_nBalance < 0)
+ } else if (m_nBalance < 0) {
m_strTipTextW.Format(L"L +%d%%", -m_nBalance);
- else //if (m_nBalance > 0)
+ } else { //if (m_nBalance > 0)
m_strTipTextW.Format(L"R +%d%%", m_nBalance);
+ }
+ } else {
+ return FALSE;
}
- else return FALSE;
- 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;
}
@@ -242,7 +245,7 @@ BOOL CPPagePlayback::OnSetActive()
BOOL CPPagePlayback::OnKillActive()
{
AppSettings& s = AfxGetAppSettings();
- if(s.fRememberZoomLevel) {
+ if (s.fRememberZoomLevel) {
s.fRememberWindowSize = false;
}
diff --git a/src/apps/mplayerc/PPagePlayer.cpp b/src/apps/mplayerc/PPagePlayer.cpp
index 021a75152..4d853ed81 100644
--- a/src/apps/mplayerc/PPagePlayer.cpp
+++ b/src/apps/mplayerc/PPagePlayer.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -139,11 +139,11 @@ 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++) {
+ 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++) {
+ for (int i = 0; i < s.MRUDub.GetSize(); i++) {
s.MRUDub.Remove(i);
}
s.MRU.WriteList();
@@ -164,7 +164,7 @@ void CPPagePlayer::OnBnClickedCheck8()
{
UpdateData();
- if(m_fUseIni) {
+ if (m_fUseIni) {
((CMPlayerCApp*)AfxGetApp())->StoreSettingsToIni();
} else {
((CMPlayerCApp*)AfxGetApp())->StoreSettingsToRegistry();
@@ -199,7 +199,7 @@ BOOL CPPagePlayer::OnSetActive()
BOOL CPPagePlayer::OnKillActive()
{
AppSettings& s = AfxGetAppSettings();
- if(s.fRememberWindowSize) {
+ if (s.fRememberWindowSize) {
s.fRememberZoomLevel = false;
}
diff --git a/src/apps/mplayerc/PPageSheet.cpp b/src/apps/mplayerc/PPageSheet.cpp
index 38ed358a0..b7a463e47 100644
--- a/src/apps/mplayerc/PPageSheet.cpp
+++ b/src/apps/mplayerc/PPageSheet.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -62,12 +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;
}
@@ -92,8 +92,8 @@ 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);
}
}
diff --git a/src/apps/mplayerc/PPageSubMisc.cpp b/src/apps/mplayerc/PPageSubMisc.cpp
index 605a80cbe..bebd47088 100644
--- a/src/apps/mplayerc/PPageSubMisc.cpp
+++ b/src/apps/mplayerc/PPageSubMisc.cpp
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -65,7 +65,7 @@ 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"));
}
@@ -117,9 +117,9 @@ 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 {
msg = ResStr(IDS_PPSDB_BADURL);
diff --git a/src/apps/mplayerc/PPageSubStyle.cpp b/src/apps/mplayerc/PPageSubStyle.cpp
index 52ba434de..205650ef3 100644
--- a/src/apps/mplayerc/PPageSubStyle.cpp
+++ b/src/apps/mplayerc/PPageSubStyle.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -74,7 +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();
}
@@ -146,12 +146,12 @@ 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]) {
+ if (m_stss.charSet == CharSetList[i]) {
m_iCharset = i;
}
}
@@ -159,7 +159,7 @@ BOOL CPPageSubStyle::OnInitDialog()
// TODO: allow floats in these edit boxes
m_spacing = (int)m_stss.fontSpacing;
m_spacingspin.SetRange32(-10000, 10000);
- while(m_stss.fontAngleZ < 0) {
+ while (m_stss.fontAngleZ < 0) {
m_stss.fontAngleZ += 360;
}
m_angle = (int)fmod(m_stss.fontAngleZ, 360);
@@ -183,7 +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);
@@ -203,7 +203,7 @@ BOOL CPPageSubStyle::OnApply()
{
UpdateData();
- if(m_iCharset >= 0) {
+ if (m_iCharset >= 0) {
m_stss.charSet = m_charset.GetItemData(m_iCharset);
}
m_stss.fontSpacing = m_spacing;
@@ -219,15 +219,15 @@ BOOL CPPageSubStyle::OnApply()
m_stss.marginRect = m_margin;
m_stss.relativeTo = m_relativeTo;
- for(int i = 0; i < 4; 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);
}
}
@@ -242,15 +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) {
+ 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;
}
@@ -287,11 +287,11 @@ void CPPageSubStyle::OnBnClickedCheck1()
UpdateData();
int avg = 0;
- for(int i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
avg += m_alphasliders[i].GetPos();
}
avg /= 4;
- for(int i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
m_alphasliders[i].SetPos(avg);
}
@@ -300,9 +300,9 @@ void CPPageSubStyle::OnBnClickedCheck1()
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++) {
+ for (int i = 0; i < 4; i++) {
m_alphasliders[i].SetPos(pos);
}
}
diff --git a/src/apps/mplayerc/PPageSubtitles.cpp b/src/apps/mplayerc/PPageSubtitles.cpp
index 7b35285ac..dfd7ba08a 100644
--- a/src/apps/mplayerc/PPageSubtitles.cpp
+++ b/src/apps/mplayerc/PPageSubtitles.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -164,7 +164,7 @@ BOOL CPPageSubtitles::OnApply()
AppSettings& s = AfxGetAppSettings();
- if(s.fOverridePlacement != !!m_fOverridePlacement
+ if (s.fOverridePlacement != !!m_fOverridePlacement
|| s.nHorPos != m_nHorPos
|| s.nVerPos != m_nVerPos
|| s.m_RenderersSettings.nSPCSize != m_nSPCSize
@@ -181,7 +181,7 @@ 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);
}
}
diff --git a/src/apps/mplayerc/PPageTweaks.cpp b/src/apps/mplayerc/PPageTweaks.cpp
index 4c82ba797..b81f441c1 100644
--- a/src/apps/mplayerc/PPageTweaks.cpp
+++ b/src/apps/mplayerc/PPageTweaks.cpp
@@ -77,7 +77,7 @@ 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) {
+ if (FontType == TRUETYPE_FONTTYPE) {
fntl->Add(lf->elfFullName);
}
return true;
@@ -168,7 +168,7 @@ BOOL CPPageTweaks::OnApply()
s.fFastSeek = !!m_fFastSeek;
CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
- if(m_fUseWin7TaskBar) {
+ if (m_fUseWin7TaskBar) {
pFrame->CreateThumbnailToolbar();
}
pFrame->UpdateThumbarButton();
diff --git a/src/apps/mplayerc/PPageWebServer.cpp b/src/apps/mplayerc/PPageWebServer.cpp
index 3586c5f6b..9543efd96 100644
--- a/src/apps/mplayerc/PPageWebServer.cpp
+++ b/src/apps/mplayerc/PPageWebServer.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -67,14 +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;
}
@@ -117,7 +117,7 @@ BOOL CPPageWebServer::OnApply()
AppSettings& s = AfxGetAppSettings();
CString NewWebRoot = m_WebRoot;
- if(!m_fWebRoot) {
+ if (!m_fWebRoot) {
NewWebRoot = _T("*") + NewWebRoot;
}
@@ -133,9 +133,9 @@ BOOL CPPageWebServer::OnApply()
s.strWebDefIndex = m_WebDefIndex;
s.strWebServerCGI = m_WebServerCGI;
- if(CMainFrame* pWnd = (CMainFrame*)AfxGetMainWnd()) {
- if(m_fEnableWebServer) {
- if(fRestart) {
+ if (CMainFrame* pWnd = (CMainFrame*)AfxGetMainWnd()) {
+ if (m_fEnableWebServer) {
+ if (fRestart) {
pWnd->StopWebServer();
}
pWnd->StartWebServer(m_nWebServerPort);
@@ -170,7 +170,7 @@ 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;
@@ -191,7 +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;
@@ -225,9 +225,9 @@ 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;
@@ -238,7 +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/PlayerCaptureBar.cpp b/src/apps/mplayerc/PlayerCaptureBar.cpp
index 07b3301f7..9ecd6aa0a 100644
--- a/src/apps/mplayerc/PlayerCaptureBar.cpp
+++ b/src/apps/mplayerc/PlayerCaptureBar.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -40,7 +40,7 @@ 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;
}
@@ -60,8 +60,8 @@ 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;
}
}
diff --git a/src/apps/mplayerc/PlayerCaptureDialog.cpp b/src/apps/mplayerc/PlayerCaptureDialog.cpp
index 713ed6374..5b1cd4bda 100644
--- a/src/apps/mplayerc/PlayerCaptureDialog.cpp
+++ b/src/apps/mplayerc/PlayerCaptureDialog.cpp
@@ -36,12 +36,12 @@ static bool LoadMediaType(CStringW DisplayName, AM_MEDIA_TYPE** ppmt)
{
bool fRet = false;
- if(!ppmt) {
+ if (!ppmt) {
return(fRet);
}
*ppmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
- if(!*ppmt) {
+ if (!*ppmt) {
return(fRet);
}
@@ -49,7 +49,7 @@ static bool LoadMediaType(CStringW DisplayName, AM_MEDIA_TYPE** ppmt)
BYTE* pData;
UINT len;
- if(AfxGetApp()->GetProfileBinary(IDS_RS_CAPTURE _T("\\") + CString(DisplayName), _T("MediaType"), &pData, &len)) {
+ if (AfxGetApp()->GetProfileBinary(IDS_RS_CAPTURE _T("\\") + CString(DisplayName), _T("MediaType"), &pData, &len)) {
if ( len != sizeof(AM_MEDIA_TYPE) ) {
delete [] pData;
return(fRet);
@@ -62,7 +62,7 @@ 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 (AfxGetApp()->GetProfileBinary(IDS_RS_CAPTURE _T("\\") + CString(DisplayName), _T("Format"), &pData, &len)) {
if ( !len ) {
delete [] pData;
return(fRet);
@@ -80,7 +80,7 @@ static bool LoadMediaType(CStringW DisplayName, AM_MEDIA_TYPE** ppmt)
static void SaveMediaType(CStringW DisplayName, AM_MEDIA_TYPE* pmt)
{
- if(DisplayName.IsEmpty() || !pmt) {
+ if (DisplayName.IsEmpty() || !pmt) {
return;
}
@@ -91,26 +91,26 @@ 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) {
+ if (len >= 0) {
box.SetCurSel(0);
}
- if(cat == GUID_NULL) {
+ 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) {
+ 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;
@@ -120,7 +120,7 @@ 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) {
+ if (cat == GUID_NULL) {
return;
}
@@ -129,11 +129,11 @@ static void SaveDefaultCodec(CAtlArray<Codec>& codecs, CComboBox& box, const GUI
AfxGetApp()->WriteProfileString(IDS_RS_CAPTURE _T("\\") + guid, NULL, NULL);
int iSel = box.GetCurSel();
- if(iSel < 0) {
+ if (iSel < 0) {
return;
}
iSel = box.GetItemData(iSel);
- if(iSel < 0) {
+ if (iSel < 0) {
return;
}
@@ -146,7 +146,7 @@ static void SetupDefaultCaps(AM_MEDIA_TYPE* pmt, VIDEO_STREAM_CONFIG_CAPS& caps)
{
memset(&caps, 0, sizeof(caps));
- if(!pmt) {
+ if (!pmt) {
return;
}
@@ -181,7 +181,7 @@ static void SetupDefaultCaps(AM_MEDIA_TYPE* pmt, AUDIO_STREAM_CONFIG_CAPS& caps)
{
memset(&caps, 0, sizeof(caps));
- if(!pmt) {
+ if (!pmt) {
return;
}
@@ -205,7 +205,7 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo
type.EnableWindow(FALSE);
dim.EnableWindow(FALSE);
- if(!pAMSC) {
+ if (!pAMSC) {
return;
}
@@ -213,25 +213,25 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo
pAMSC->GetFormat(&pcurmt);
int iCount = 0, iSize;
- if(SUCCEEDED(pAMSC->GetNumberOfCapabilities(&iCount, &iSize))
+ if (SUCCEEDED(pAMSC->GetNumberOfCapabilities(&iCount, &iSize))
&& iSize == sizeof(T) && iCount > 0) {
- for(int i = 0; i < iCount; i++) {
+ 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) {
+ 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
+ if (pfe->mt.formattype != FORMAT_VideoInfo
&& pfe->mt.formattype != FORMAT_VideoInfo2) {
continue;
}
@@ -255,8 +255,8 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo
BITMAPINFOHEADER bihCur;
ExtractBIH(&pfe->mt, &bihCur);
- for(int j = 0; j < countof(presets); j++) {
- if(presets[j].cx == bihCur.biWidth
+ 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
|| presets[j].cx > pcaps->MaxOutputSize.cx
@@ -269,9 +269,9 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo
CMediaType mt = pfe->mt;
- if(mt.formattype == FORMAT_VideoInfo) {
+ if (mt.formattype == FORMAT_VideoInfo) {
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.pbFormat;
- if(!vih->bmiHeader.biHeight) {
+ if (!vih->bmiHeader.biHeight) {
vih->bmiHeader.biHeight = 1;
}
vih->bmiHeader.biWidth = presets[j].cx;
@@ -282,7 +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];
@@ -300,9 +300,9 @@ 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) {
+ if (!vih2->bmiHeader.biHeight) {
vih2->bmiHeader.biHeight = 1;
}
vih2->bmiHeader.biWidth = presets[j].cx;
@@ -320,8 +320,8 @@ 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;
@@ -329,14 +329,14 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo
tfa.AddFormat(pmt, caps);
} else {
mt.majortype = GUID_NULL;
- if(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);
@@ -345,42 +345,42 @@ 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) {
+ } 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()) {
+ 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) {
+ if (iDim >= 0) {
mt = ((CFormatElem<T>*)dim.GetItemData(iDim))->mt;
- } else if(pcurmt) {
+ } else if (pcurmt) {
mt = *pcurmt;
}
type.EnableWindow(type.GetCount() > 0);
dim.EnableWindow(dim.GetCount() > 0);
- if(pcurmt) {
+ if (pcurmt) {
DeleteMediaType(pcurmt);
}
}
@@ -395,13 +395,13 @@ static bool SetupDimension(CFormatArray<T>& tfa, CComboBox& type, CComboBox& dim
dim.EnableWindow(FALSE);
int iSel = type.GetCurSel();
- if(iSel < 0) {
+ 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);
}
@@ -428,13 +428,13 @@ static void InitCodecList(CAtlArray<Codec>& codecs, CComboBox& box, const GUID&
c.pMoniker = pMoniker;
/*
CComPtr<IBaseFilter> pBF;
- if(FAILED(pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&pBF)) || !pBF)
+ if (FAILED(pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&pBF)) || !pBF)
continue;
c.pBF = pBF;
*/
LPOLESTR strName = NULL;
- if(FAILED(pMoniker->GetDisplayName(NULL, NULL, &strName))) {
+ if (FAILED(pMoniker->GetDisplayName(NULL, NULL, &strName))) {
continue;
}
@@ -445,18 +445,18 @@ 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;
}
@@ -476,25 +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) {
+ if (iSel < 0) {
return(-1);
}
iSel = box.GetItemData(iSel);
- if(iSel < 0) {
+ 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(
@@ -504,12 +504,12 @@ static int ShowPPage(CAtlArray<Codec>& codecs, CComboBox& box, HWND hWnd = NULL)
0, 0, NULL);
lpUnk->Release();
- if(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);
}
}
@@ -545,7 +545,7 @@ CPlayerCaptureDialog::~CPlayerCaptureDialog()
BOOL CPlayerCaptureDialog::Create(CWnd* pParent)
{
- if(!__super::Create(IDD, pParent)) {
+ if (!__super::Create(IDD, pParent)) {
return FALSE;
}
@@ -595,10 +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();
}
}
@@ -612,7 +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);
@@ -626,7 +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();
@@ -651,7 +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();
@@ -670,10 +670,10 @@ 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) {
+ if (ffps > 0) {
m_vidfps = ffps;
}
}
@@ -685,26 +685,26 @@ 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);
}
- 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;
}
}
@@ -732,14 +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;
@@ -751,22 +751,22 @@ void CPlayerCaptureDialog::UpdateMediaTypes()
void CPlayerCaptureDialog::UpdateUserDefinableControls()
{
int iSel = m_viddimension.GetCurSel();
- if(iSel < 0) {
+ if (iSel < 0) {
return;
}
CVidFormatElem* pvfe = (CVidFormatElem*)m_viddimension.GetItemData(iSel);
- if(!pvfe) {
+ if (!pvfe) {
return;
}
- if(!m_pAMVSC) {
+ if (!m_pAMVSC) {
return;
}
AM_MEDIA_TYPE* pmt = NULL;
m_pAMVSC->GetFormat(&pmt);
- if(!pmt) {
+ if (!pmt) {
return;
}
@@ -776,7 +776,7 @@ void CPlayerCaptureDialog::UpdateUserDefinableControls()
? &((VIDEOINFOHEADER2*)pmt->pbFormat)->bmiHeader
: NULL;
- if(!bih) {
+ if (!bih) {
return;
}
@@ -787,7 +787,7 @@ void CPlayerCaptureDialog::UpdateUserDefinableControls()
UNUSED_ALWAYS(h);
m_vidhor.SetRange((short)pvfe->caps.MinOutputSize.cx, (short)pvfe->caps.MaxOutputSize.cx);
- /* if(bih->biCompression == mmioFOURCC('Y','U','Y','2')) // FIXME: bt8x8 drivers seem to crop the right side in yuv2 mode if the width is not dividable by 64
+ /* if (bih->biCompression == mmioFOURCC('Y','U','Y','2')) // FIXME: bt8x8 drivers seem to crop the right side in yuv2 mode if the width is not dividable by 64
pvfe->caps.OutputGranularityX = 64;
*/
ua[0].nInc = pvfe->caps.OutputGranularityX;
@@ -814,7 +814,7 @@ void CPlayerCaptureDialog::UpdateUserDefinableControls()
void CPlayerCaptureDialog::UpdateVideoCodec()
{
int iSel = m_vidcodec.GetCurSel();
- if(iSel >= 0) {
+ if (iSel >= 0) {
iSel = m_vidcodec.GetItemData(iSel);
}
@@ -834,7 +834,7 @@ void CPlayerCaptureDialog::UpdateVideoCodec()
void CPlayerCaptureDialog::UpdateAudioCodec()
{
int iSel = m_audcodec.GetCurSel();
- if(iSel >= 0) {
+ if (iSel >= 0) {
iSel = m_audcodec.GetItemData(iSel);
}
@@ -860,19 +860,19 @@ void CPlayerCaptureDialog::UpdateMuxer()
HRESULT hr;
- if(m_muxtype == 0) {
+ if (m_muxtype == 0) {
m_pMux.CoCreateInstance(CLSID_AviDest);
- } else if(m_muxtype == 1) {
+ } else if (m_muxtype == 1) {
m_pMux.CoCreateInstance(CLSID_OggMux);
- } else if(m_muxtype == 2) {
+ } else if (m_muxtype == 2) {
m_pMux = DNew CMatroskaMuxerFilter(NULL, &hr);
- } else if(m_muxtype == 3) {
+ } else if (m_muxtype == 3) {
m_pMux = DNew CDSMMuxerFilter(NULL, &hr);
} else {
return;
}
- if(m_fSepAudio) {
+ if (m_fSepAudio) {
m_pAudMux = DNew CWavDestFilter(NULL, &hr);
}
}
@@ -899,26 +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) {
+ 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);
@@ -937,21 +937,21 @@ 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) {
+ switch (PhysicalType) {
case PhysConn_Video_Tuner:
str = _T("Tuner");
break;
@@ -1004,16 +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;
@@ -1027,17 +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);
}
@@ -1045,7 +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);
@@ -1072,18 +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);
}
@@ -1091,11 +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);
}
@@ -1103,7 +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);
@@ -1132,24 +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;
}
@@ -1161,11 +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);
}
@@ -1173,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);
@@ -1189,11 +1189,11 @@ void CPlayerCaptureDialog::SetupAudioControls(
bool CPlayerCaptureDialog::IsTunerActive()
{
int iSel = m_vidinput.GetCurSel();
- if(iSel < 0) {
+ if (iSel < 0) {
return(false);
}
iSel = m_vidinput.GetItemData(iSel);
- if(iSel < 0) {
+ if (iSel < 0) {
return(false);
}
@@ -1205,12 +1205,12 @@ bool CPlayerCaptureDialog::IsTunerActive()
bool CPlayerCaptureDialog::SetVideoInput(int input)
{
- if(!m_pAMXB || input < 0) {
+ 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;
@@ -1222,7 +1222,7 @@ bool CPlayerCaptureDialog::SetVideoInput(int input)
bool CPlayerCaptureDialog::SetVideoChannel(int channel)
{
- if(!m_pAMTuner || channel < 0) {
+ if (!m_pAMTuner || channel < 0) {
return false;
}
@@ -1231,12 +1231,12 @@ bool CPlayerCaptureDialog::SetVideoChannel(int channel)
bool CPlayerCaptureDialog::SetAudioInput(int input)
{
- if(input < 0) {
+ 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;
@@ -1249,7 +1249,7 @@ bool CPlayerCaptureDialog::SetAudioInput(int input)
int CPlayerCaptureDialog::GetVideoInput()
{
int i = m_vidinput.GetCurSel();
- if(i < 0) {
+ if (i < 0) {
return -1;
}
return m_vidinput.GetItemData(i);
@@ -1264,7 +1264,7 @@ int CPlayerCaptureDialog::GetVideoChannel()
int CPlayerCaptureDialog::GetAudioInput()
{
int i = m_audinput.GetCurSel();
- if(i < 0) {
+ if (i < 0) {
return -1;
}
return m_audinput.GetItemData(i);
@@ -1356,51 +1356,51 @@ void CPlayerCaptureDialog::OnDestroy()
void CPlayerCaptureDialog::OnVideoInput()
{
int iSel = m_vidinput.GetCurSel();
- if(iSel < 0) {
+ if (iSel < 0) {
return;
}
iSel = m_vidinput.GetItemData(iSel);
- if(iSel < 0) {
+ 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();
}
}
@@ -1409,7 +1409,7 @@ void CPlayerCaptureDialog::OnVideoInput()
void CPlayerCaptureDialog::OnVideoType()
{
- if(SetupDimension(m_vfa, m_vidtype, m_viddimension)) {
+ if (SetupDimension(m_vfa, m_vidtype, m_viddimension)) {
OnVideoDimension();
}
}
@@ -1417,12 +1417,12 @@ void CPlayerCaptureDialog::OnVideoType()
void CPlayerCaptureDialog::OnVideoDimension()
{
int iSel = m_viddimension.GetCurSel();
- if(iSel < 0) {
+ if (iSel < 0) {
return;
}
CVidFormatElem* pvfe = (CVidFormatElem*)m_viddimension.GetItemData(iSel);
- if(!pvfe) {
+ if (!pvfe) {
return;
}
@@ -1452,14 +1452,14 @@ 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();
}
}
@@ -1482,7 +1482,7 @@ void CPlayerCaptureDialog::OnVideoCodec()
void CPlayerCaptureDialog::OnVideoCodecType()
{
- if(SetupDimension(m_vcfa, m_vidcodectype, m_vidcodecdimension)) {
+ if (SetupDimension(m_vcfa, m_vidcodectype, m_vidcodecdimension)) {
OnVideoCodecDimension();
}
}
@@ -1490,7 +1490,7 @@ void CPlayerCaptureDialog::OnVideoCodecType()
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
@@ -1512,7 +1512,7 @@ void CPlayerCaptureDialog::OnAudioCodec()
void CPlayerCaptureDialog::OnAudioCodecType()
{
- if(SetupDimension(m_acfa, m_audcodectype, m_audcodecdimension)) {
+ if (SetupDimension(m_acfa, m_audcodectype, m_audcodecdimension)) {
OnAudioCodecDimension();
}
}
@@ -1520,7 +1520,7 @@ void CPlayerCaptureDialog::OnAudioCodecType()
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
@@ -1540,26 +1540,26 @@ void CPlayerCaptureDialog::OnOpenFile()
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_NOCHANGEDIR,
_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")) {
+ if (ext == _T("avi")) {
m_muxtype = 0;
- } else if(ext == _T("ogm")) {
+ } else if (ext == _T("ogm")) {
m_muxtype = 1;
- } else if(ext == _T("mkv")) {
+ } else if (ext == _T("mkv")) {
m_muxtype = 2;
- } else if(ext == _T("dsm")) {
+ } else if (ext == _T("dsm")) {
m_muxtype = 3;
} else {
- if(m_muxtype == 0) {
+ if (m_muxtype == 0) {
str += _T(".avi");
- } else if(m_muxtype == 1) {
+ } else if (m_muxtype == 1) {
str += _T(".ogm");
- } else if(m_muxtype == 2) {
+ } else if (m_muxtype == 2) {
str += _T(".mkv");
- } else if(m_muxtype == 3) {
+ } else if (m_muxtype == 3) {
str += _T(".dsm");
}
}
@@ -1577,15 +1577,15 @@ void CPlayerCaptureDialog::OnRecord()
UpdateData();
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
- if(!pFrame) {
+ 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 {
m_pDst = NULL;
@@ -1593,7 +1593,7 @@ void CPlayerCaptureDialog::OnRecord()
pFSF = m_pDst;
}
- if(!pFSF
+ if (!pFSF
|| FAILED(pFSF->SetFileName(CStringW(m_file), NULL))
|| FAILED(pFSF->SetMode(AM_FILE_OVERWRITE))) {
AfxMessageBox(_T("Error initializing the output file"));
@@ -1601,11 +1601,11 @@ void CPlayerCaptureDialog::OnRecord()
}
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 {
m_pAudDst = NULL;
@@ -1613,7 +1613,7 @@ void CPlayerCaptureDialog::OnRecord()
pFSF = m_pAudDst;
}
- if(!pFSF
+ if (!pFSF
|| FAILED(pFSF->SetFileName(CStringW(audfn), NULL))
|| FAILED(pFSF->SetMode(AM_FILE_OVERWRITE))) {
AfxMessageBox(_T("Error initializing the audio output file"));
@@ -1622,13 +1622,13 @@ void CPlayerCaptureDialog::OnRecord()
}
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);
}
@@ -1644,7 +1644,7 @@ void CPlayerCaptureDialog::OnRecord()
pFrame->StopCapture();
/*
{
- if(FILE* f = _tfopen(m_file, _T("rb+")))
+ if (FILE* f = _tfopen(m_file, _T("rb+")))
{
fseek(f, 0x20, SEEK_SET);
unsigned short mspf = (unsigned short)(((VIDEOINFOHEADER*)m_mtv.pbFormat)->AvgTimePerFrame / 10);
@@ -1674,10 +1674,10 @@ 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)
+ if (GetDiskFreeSpaceEx(m_file.Left(m_file.ReverseFind('\\')+1), &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes)
&& FreeBytesAvailable.QuadPart < 1024i64*1024*10) {
OnRecord();
}
@@ -1704,13 +1704,13 @@ 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");
}
diff --git a/src/apps/mplayerc/PlayerCaptureDialog.h b/src/apps/mplayerc/PlayerCaptureDialog.h
index cab61cc2c..fd8932986 100644
--- a/src/apps/mplayerc/PlayerCaptureDialog.h
+++ b/src/apps/mplayerc/PlayerCaptureDialog.h
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -57,13 +57,13 @@ public:
virtual ~CFormatArray() {}
CFormat<T>* Find(CString name, bool fCreate = false) {
- for(size_t i = 0; i < GetCount(); ++i) {
- if(GetAt(i)->name == name) {
+ for (size_t i = 0; i < 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);
@@ -74,16 +74,16 @@ public:
}
bool FindFormat(AM_MEDIA_TYPE* pmt, CFormat<T>** ppf) {
- if(!pmt) {
+ if (!pmt) {
return(false);
}
- for(size_t i = 0; i < GetCount(); ++i) {
+ for (size_t i = 0; i < GetCount(); ++i) {
CFormat<T>* pf = GetAt(i);
- for(size_t j = 0; j < pf->GetCount(); ++j) {
+ for (size_t j = 0; j < pf->GetCount(); ++j) {
CFormatElem<T>* pfe = pf->GetAt(j);
- if(!pmt || (pfe->mt.majortype == pmt->majortype && pfe->mt.subtype == pmt->subtype)) {
- if(ppf) {
+ if (!pmt || (pfe->mt.majortype == pmt->majortype && pfe->mt.subtype == pmt->subtype)) {
+ if (ppf) {
*ppf = pf;
}
return(true);
@@ -95,19 +95,19 @@ public:
}
bool FindFormat(AM_MEDIA_TYPE* pmt, T* pcaps, CFormat<T>** ppf, CFormatElem<T>** ppfe) {
- if(!pmt && !pcaps) {
+ if (!pmt && !pcaps) {
return(false);
}
- for(size_t i = 0; i < GetCount(); ++i) {
+ for (size_t i = 0; i < GetCount(); ++i) {
CFormat<T>* pf = GetAt(i);
- for(size_t j = 0; j < pf->GetCount(); ++j) {
+ for (size_t j = 0; j < pf->GetCount(); ++j) {
CFormatElem<T>* pfe = pf->GetAt(j);
- if((!pmt || pfe->mt == *pmt) && (!pcaps || !memcmp(pcaps, &pfe->caps, sizeof(T)))) {
- if(ppf) {
+ if ((!pmt || pfe->mt == *pmt) && (!pcaps || !memcmp(pcaps, &pfe->caps, sizeof(T)))) {
+ if (ppf) {
*ppf = pf;
}
- if(ppfe) {
+ if (ppfe) {
*ppfe = pfe;
}
return(true);
@@ -119,18 +119,18 @@ public:
}
bool AddFormat(AM_MEDIA_TYPE* pmt, T caps) {
- if(!pmt) {
+ 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);
}
@@ -144,7 +144,7 @@ public:
}
bool AddFormat(AM_MEDIA_TYPE* pmt, void* pcaps, int size) {
- if(!pcaps) {
+ if (!pcaps) {
return false;
}
ASSERT(size == sizeof(T));
@@ -164,7 +164,7 @@ public:
CString MakeFormatName(AM_MEDIA_TYPE* pmt) {
CString str(_T("Default"));
- if(!pmt) {
+ if (!pmt) {
return(str);
}
@@ -174,14 +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));
@@ -190,7 +190,7 @@ public:
return(str);
}
- switch(bih->biCompression) {
+ switch (bih->biCompression) {
case BI_RGB:
str.Format(_T("RGB%d"), bih->biBitCount);
break;
@@ -222,7 +222,7 @@ public:
CString MakeDimensionName(CVidFormatElem* pfe) {
CString str(_T("Default"));
- if(!pfe) {
+ if (!pfe) {
return(str);
}
@@ -232,13 +232,13 @@ public:
? &((VIDEOINFOHEADER2*)pfe->mt.pbFormat)->bmiHeader
: NULL;
- if(bih == NULL) {
+ 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);
@@ -258,7 +258,7 @@ public:
CString MakeFormatName(AM_MEDIA_TYPE* pmt) {
CString str(_T("Unknown"));
- if(!pmt) {
+ if (!pmt) {
return(str);
}
@@ -266,19 +266,19 @@ public:
? (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) {
+ switch (wfe->wFormatTag) {
case 1:
str = _T("PCM ");
break;
@@ -293,7 +293,7 @@ public:
CString MakeDimensionName(CAudFormatElem* pfe) {
CString str(_T("Unknown"));
- if(!pfe) {
+ if (!pfe) {
return(str);
}
@@ -301,7 +301,7 @@ public:
? (WAVEFORMATEX*)pfe->mt.pbFormat
: NULL;
- if(!wfe) {
+ if (!wfe) {
return(str);
}
@@ -314,7 +314,7 @@ public:
str2.Format(_T("%dbps "), wfe->wBitsPerSample);
str += str2;
- switch(wfe->nChannels) {
+ switch (wfe->nChannels) {
case 1:
str += _T("mono ");
break;
diff --git a/src/apps/mplayerc/PlayerInfoBar.cpp b/src/apps/mplayerc/PlayerInfoBar.cpp
index db31eb165..3595a298e 100644
--- a/src/apps/mplayerc/PlayerInfoBar.cpp
+++ b/src/apps/mplayerc/PlayerInfoBar.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -40,17 +40,17 @@ 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) {
+ if (info != tmp) {
m_info[idx]->SetWindowText(info);
}
return;
@@ -72,10 +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;
@@ -85,10 +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;
@@ -113,7 +113,7 @@ BOOL CPlayerInfoBar::Create(CWnd* pParentWnd)
BOOL CPlayerInfoBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CDialogBar::PreCreateWindow(cs)) {
+ if (!CDialogBar::PreCreateWindow(cs)) {
return FALSE;
}
@@ -138,7 +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);
@@ -146,7 +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);
}
@@ -164,7 +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);
@@ -176,11 +176,11 @@ 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);
}
@@ -205,7 +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 c1c6fdce7..90a7dd2f9 100644
--- a/src/apps/mplayerc/PlayerListCtrl.cpp
+++ b/src/apps/mplayerc/PlayerListCtrl.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -54,8 +54,8 @@ END_MESSAGE_MAP()
BOOL CInPlaceEdit::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN) {
- if(pMsg->wParam == VK_RETURN
+ if (pMsg->message == WM_KEYDOWN) {
+ if (pMsg->wParam == VK_RETURN
|| pMsg->wParam == VK_DELETE
|| pMsg->wParam == VK_ESCAPE
|| GetKeyState(VK_CONTROL)) {
@@ -99,8 +99,8 @@ void CInPlaceEdit::OnNcDestroy()
void CInPlaceEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
- if(nChar == VK_ESCAPE || nChar == VK_RETURN) {
- if(nChar == VK_ESCAPE) {
+ if (nChar == VK_ESCAPE || nChar == VK_RETURN) {
+ if (nChar == VK_ESCAPE) {
m_bESC = TRUE;
}
GetParent()->SetFocus();
@@ -112,7 +112,7 @@ 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;
}
@@ -165,7 +165,7 @@ int CInPlaceComboBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
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)));
}
@@ -176,8 +176,8 @@ int CInPlaceComboBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
BOOL CInPlaceComboBox::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN) {
- if(pMsg->wParam == VK_RETURN
+ if (pMsg->message == WM_KEYDOWN) {
+ if (pMsg->wParam == VK_RETURN
|| pMsg->wParam == VK_ESCAPE) {
::TranslateMessage(pMsg);
::DispatchMessage(pMsg);
@@ -212,8 +212,8 @@ 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) {
+ if (nChar == VK_ESCAPE || nChar == VK_RETURN) {
+ if (nChar == VK_ESCAPE) {
m_bESC = TRUE;
}
GetParent()->SetFocus();
@@ -265,7 +265,7 @@ END_MESSAGE_MAP()
int CInPlaceListBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if(CListBox::OnCreate(lpCreateStruct) == -1) {
+ if (CListBox::OnCreate(lpCreateStruct) == -1) {
return -1;
}
@@ -273,7 +273,7 @@ int CInPlaceListBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
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 );
@@ -283,8 +283,8 @@ int CInPlaceListBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
BOOL CInPlaceListBox::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN) {
- if(pMsg->wParam == VK_RETURN
+ if (pMsg->message == WM_KEYDOWN) {
+ if (pMsg->wParam == VK_RETURN
|| pMsg->wParam == VK_ESCAPE) {
::TranslateMessage(pMsg);
::DispatchMessage(pMsg);
@@ -319,8 +319,8 @@ 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) {
+ if (nChar == VK_ESCAPE || nChar == VK_RETURN) {
+ if (nChar == VK_ESCAPE) {
m_bESC = TRUE;
}
GetParent()->SetFocus();
@@ -361,28 +361,28 @@ void CPlayerListCtrl::PreSubclassWindow()
int CPlayerListCtrl::HitTestEx(CPoint& point, int* col) const
{
- if(col) {
+ 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) {
+ if (point.x >= r.left && point.x <= (r.left + colwidth)) {
+ if (col) {
*col = colnum;
}
return top;
@@ -403,13 +403,13 @@ 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++;
}
}
@@ -419,7 +419,7 @@ int CPlayerListCtrl::GetBottomIndex() const
CImageList* CPlayerListCtrl::CreateDragImageEx(LPPOINT lpPoint)
{
- if(GetSelectedCount() <= 0) {
+ if (GetSelectedCount() <= 0) {
return NULL;
}
@@ -433,17 +433,17 @@ 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) {
+ if (cSingleRect.left < 0) {
cSingleRect.left = 0;
}
- if(cSingleRect.right > nWidth) {
+ if (cSingleRect.right > nWidth) {
cSingleRect.right = nWidth;
}
@@ -457,11 +457,11 @@ 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;
}
@@ -471,11 +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,
@@ -507,7 +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;
}
@@ -517,17 +517,17 @@ CImageList* CPlayerListCtrl::CreateDragImageEx(LPPOINT lpPoint)
bool CPlayerListCtrl::PrepareInPlaceControl(int nRow, int nCol, CRect& rect)
{
- if(!EnsureVisible(nRow, TRUE)) {
+ if (!EnsureVisible(nRow, TRUE)) {
return(false);
}
int nColumnCount = ((CHeaderCtrl*)GetDlgItem(0))->GetItemCount();
- if(nCol >= nColumnCount || GetColumnWidth(nCol) < 5) {
+ if (nCol >= nColumnCount || GetColumnWidth(nCol) < 5) {
return(false);
}
int offset = 0;
- for(int i = 0; i < nCol; i++) {
+ for (int i = 0; i < nCol; i++) {
offset += GetColumnWidth(i);
}
@@ -535,7 +535,7 @@ bool CPlayerListCtrl::PrepareInPlaceControl(int nRow, int nCol, CRect& rect)
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;
@@ -543,13 +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) {
+ 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;
@@ -561,7 +561,7 @@ 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);
}
@@ -585,7 +585,7 @@ 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);
}
@@ -597,7 +597,7 @@ 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);
}
@@ -613,7 +613,7 @@ 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);
}
@@ -631,9 +631,9 @@ 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) {
+ if (width < w) {
width = w;
}
}
@@ -675,7 +675,7 @@ END_MESSAGE_MAP()
void CPlayerListCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
- if(GetFocus() != this) {
+ if (GetFocus() != this) {
SetFocus();
}
CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
@@ -683,7 +683,7 @@ void CPlayerListCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
void CPlayerListCtrl::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
- if(GetFocus() != this) {
+ if (GetFocus() != this) {
SetFocus();
}
CListCtrl::OnHScroll(nSBCode, nPos, pScrollBar);
@@ -691,7 +691,7 @@ void CPlayerListCtrl::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
BOOL CPlayerListCtrl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
- if(GetFocus() != this) {
+ if (GetFocus() != this) {
SetFocus();
}
return CListCtrl::OnMouseWheel(nFlags, zDelta, pt);
@@ -701,7 +701,7 @@ void CPlayerListCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
CListCtrl::OnLButtonDown(nFlags, point);
- if(GetFocus() != this) {
+ if (GetFocus() != this) {
SetFocus();
}
@@ -709,9 +709,9 @@ void CPlayerListCtrl::OnLButtonDown(UINT nFlags, CPoint point)
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;
@@ -721,8 +721,8 @@ 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 {
dispinfo.hdr.code = LVN_DOLABELEDIT;
@@ -739,11 +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();
@@ -831,7 +831,7 @@ INT_PTR CPlayerListCtrl::OnToolHitTest(CPoint point, TOOLINFO* pTI) const
{
int col;
int row = HitTestEx(point, &col);
- if(row == -1) {
+ if (row == -1) {
return -1;
}
@@ -841,10 +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;
}
@@ -871,11 +871,11 @@ BOOL CPlayerListCtrl::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
nID = ::GetDlgCtrlID((HWND)nID);
}
- if(nID == 0) { // Notification in NT from automatically
+ 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;
}
diff --git a/src/apps/mplayerc/PlayerNavigationBar.cpp b/src/apps/mplayerc/PlayerNavigationBar.cpp
index 13b8c383b..1f7cc5bf7 100644
--- a/src/apps/mplayerc/PlayerNavigationBar.cpp
+++ b/src/apps/mplayerc/PlayerNavigationBar.cpp
@@ -40,7 +40,7 @@ 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;
}
@@ -61,8 +61,8 @@ 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;
}
}
@@ -81,7 +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, rectComboAudio, rectButtonInfo, rectButtonScan;
LONG totalsize, separation, sizeComboAudio, sizeButtonInfo, sizeButtonScan;
GetClientRect(r);
@@ -97,8 +97,9 @@ void CPlayerNavigationBar::OnSize(UINT nType, int cx, int cy)
sizeButtonScan = rectButtonScan.right - rectButtonScan.left;
totalsize = r.right - r.left;
separation = (totalsize - sizeComboAudio - sizeButtonInfo - sizeButtonScan) / 2;
- if (separation < 0)
+ if (separation < 0) {
separation = 0;
+ }
m_navdlg.m_ComboAudio.SetWindowPos(NULL, r.left, r.bottom+6, 0,0, SWP_NOSIZE | SWP_NOZORDER);
m_navdlg.m_ButtonInfo.SetWindowPos(NULL, r.left + sizeComboAudio + separation, r.bottom +5, 0,0, SWP_NOSIZE | SWP_NOZORDER);
m_navdlg.m_ButtonScan.SetWindowPos(NULL, r.left + sizeComboAudio + sizeButtonInfo + 2 * separation, r.bottom +5, 0,0, SWP_NOSIZE | SWP_NOZORDER);
diff --git a/src/apps/mplayerc/PlayerNavigationDialog.cpp b/src/apps/mplayerc/PlayerNavigationDialog.cpp
index 9e731371b..4f1cea984 100644
--- a/src/apps/mplayerc/PlayerNavigationDialog.cpp
+++ b/src/apps/mplayerc/PlayerNavigationDialog.cpp
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -43,7 +43,7 @@ CPlayerNavigationDialog::~CPlayerNavigationDialog()
BOOL CPlayerNavigationDialog::Create(CWnd* pParent)
{
- if(!__super::Create(IDD, pParent)) {
+ if (!__super::Create(IDD, pParent)) {
return FALSE;
}
m_pParent = pParent;
@@ -63,8 +63,8 @@ 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) {
return TRUE;
diff --git a/src/apps/mplayerc/PlayerPlaylistBar.cpp b/src/apps/mplayerc/PlayerPlaylistBar.cpp
index aa3207efe..56427c0e8 100644
--- a/src/apps/mplayerc/PlayerPlaylistBar.cpp
+++ b/src/apps/mplayerc/PlayerPlaylistBar.cpp
@@ -48,7 +48,7 @@ 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;
}
@@ -80,7 +80,7 @@ BOOL CPlayerPlaylistBar::Create(CWnd* pParentWnd)
BOOL CPlayerPlaylistBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CSizingControlBarG::PreCreateWindow(cs)) {
+ if (!CSizingControlBarG::PreCreateWindow(cs)) {
return FALSE;
}
@@ -91,13 +91,13 @@ 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;
}
}
@@ -117,18 +117,18 @@ 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()) {
+ 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()) {
+ if (!fn.Trim().IsEmpty()) {
pli.m_subs.AddTail(fn);
}
}
@@ -141,7 +141,7 @@ 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);
}
@@ -162,9 +162,9 @@ static bool SearchFiles(CString mask, CAtlList<CString>& sl)
WIN32_FIND_DATA fd;
HANDLE h = FindFirstFile(mask, &fd);
- if(h != INVALID_HANDLE_VALUE) {
+ if (h != INVALID_HANDLE_VALUE) {
do {
- if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
+ if (fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
continue;
}
@@ -173,22 +173,22 @@ static bool SearchFiles(CString mask, CAtlList<CString>& sl)
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,10 +215,10 @@ 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")
+ 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))) {
@@ -231,21 +231,21 @@ void CPlayerPlaylistBar::ResolveLinkFiles( CAtlList<CString> &fns )
void CPlayerPlaylistBar::ParsePlayList(CAtlList<CString>& fns, CAtlList<CString>* subs)
{
- if(fns.IsEmpty()) {
+ if (fns.IsEmpty()) {
return;
}
- AppSettings& s = AfxGetAppSettings();
+ AppSettings& s = AfxGetAppSettings();
ResolveLinkFiles(fns);
CAtlList<CString> sl;
- if(SearchFiles(fns.GetHead(), sl)) {
- if(sl.GetCount() > 1) {
+ if (SearchFiles(fns.GetHead(), sl)) {
+ if (sl.GetCount() > 1) {
subs = NULL;
}
POSITION pos = sl.GetHeadPosition();
- while(pos) {
+ while (pos) {
ParsePlayList(sl.GetNext(pos), subs);
}
return;
@@ -253,20 +253,20 @@ void CPlayerPlaylistBar::ParsePlayList(CAtlList<CString>& fns, CAtlList<CString>
CAtlList<CString> redir;
CStringA ct = GetContentType(fns.GetHead(), &redir);
- if(!redir.IsEmpty()) {
+ if (!redir.IsEmpty()) {
POSITION pos = redir.GetHeadPosition();
- while(pos) {
+ 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 INTERNAL_SOURCEFILTER_MPEG
- if(ct == "application/x-bdmv-playlist" && s.SrcFilters[SRC_MPEG]) {
+ if (ct == "application/x-bdmv-playlist" && s.SrcFilters[SRC_MPEG]) {
ParseBDMVPlayList(fns.GetHead());
return;
}
@@ -283,7 +283,7 @@ 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) {
+ if (fn.Find(':') >= 0 || fn.Find(_T("\\")) == 0) {
return fn;
}
p.Append(CPath(fn));
@@ -316,63 +316,63 @@ 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) {
+ 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")) {
+ } else if (key == _T("label")) {
pli[i].m_label = value;
- } else if(key == _T("filename")) {
+ } 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) {
+ } 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) {
+ } 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")) {
+ } else if (key == _T("vinput")) {
pli[i].m_vinput = _ttol(value);
- } else if(key == _T("vchannel")) {
+ } else if (key == _T("vchannel")) {
pli[i].m_vchannel = _ttol(value);
- } else if(key == _T("ainput")) {
+ } else if (key == _T("ainput")) {
pli[i].m_ainput = _ttol(value);
- } else if(key == _T("country")) {
+ } 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]]);
}
@@ -382,14 +382,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;
@@ -399,15 +399,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;
@@ -416,16 +416,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);
@@ -448,11 +448,13 @@ void CPlayerPlaylistBar::Refresh()
ResizeListColumn();
}
-void CPlayerPlaylistBar::Empty()
+bool CPlayerPlaylistBar::Empty()
{
- m_pl.RemoveAll();
+ bool bWasPlaying = m_pl.RemoveAll();
m_list.DeleteAllItems();
SavePlaylist();
+
+ return bWasPlaying;
}
void CPlayerPlaylistBar::Open(CAtlList<CString>& fns, bool fMulti, CAtlList<CString>* subs)
@@ -464,10 +466,10 @@ 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) {
+ while (pos) {
ParsePlayList(fns.GetNext(pos), NULL);
}
} else {
@@ -496,10 +498,10 @@ 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()) {
+ if (!vfn.IsEmpty()) {
sl.AddTail(vfn);
}
- if(!afn.IsEmpty()) {
+ if (!afn.IsEmpty()) {
sl.AddTail(afn);
}
CStringW label = Implode(sl, '|');
@@ -516,7 +518,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));
@@ -527,7 +529,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));
@@ -539,7 +541,7 @@ void CPlayerPlaylistBar::UpdateList()
void CPlayerPlaylistBar::EnsureVisible(POSITION pos)
{
int i = FindItem(m_pl.GetPos());
- if(i < 0) {
+ if (i < 0) {
return;
}
m_list.EnsureVisible(i, TRUE);
@@ -548,8 +550,8 @@ 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) {
+ for (int i = 0; i < m_list.GetItemCount(); i++)
+ if ((POSITION)m_list.GetItemData(i) == pos) {
return(i);
}
return(-1);
@@ -557,7 +559,7 @@ int CPlayerPlaylistBar::FindItem(POSITION pos)
POSITION CPlayerPlaylistBar::FindPos(int i)
{
- if(i < 0) {
+ if (i < 0) {
return(NULL);
}
return((POSITION)m_list.GetItemData(i));
@@ -585,7 +587,7 @@ bool CPlayerPlaylistBar::IsAtEnd()
bool CPlayerPlaylistBar::GetCur(CPlaylistItem& pli)
{
- if(!m_pl.GetPos()) {
+ if (!m_pl.GetPos()) {
return(false);
}
pli = m_pl.GetAt(m_pl.GetPos());
@@ -594,7 +596,7 @@ bool CPlayerPlaylistBar::GetCur(CPlaylistItem& pli)
CPlaylistItem* CPlayerPlaylistBar::GetCur()
{
- if(!m_pl.GetPos()) {
+ if (!m_pl.GetPos()) {
return NULL;
}
return &m_pl.GetAt(m_pl.GetPos());
@@ -604,7 +606,7 @@ 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);
@@ -613,7 +615,7 @@ CString CPlayerPlaylistBar::GetCurFileName()
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();
@@ -624,7 +626,7 @@ 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);
@@ -634,12 +636,12 @@ void CPlayerPlaylistBar::SetPrev()
void CPlayerPlaylistBar::SetFirstSelected()
{
POSITION pos = m_list.GetFirstSelectedItemPosition();
- if(pos) {
+ if (pos) {
pos = FindPos(m_list.GetNextSelectedItem(pos));
} 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) {
;
}
}
@@ -651,7 +653,7 @@ 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();
@@ -662,7 +664,7 @@ 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);
@@ -672,9 +674,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);
}
@@ -684,7 +686,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));
@@ -694,7 +696,7 @@ void CPlayerPlaylistBar::SetCurTime(REFERENCE_TIME rt)
OpenMediaData* CPlayerPlaylistBar::GetCurOMD(REFERENCE_TIME rtStart)
{
CPlaylistItem* pli = GetCur();
- if(pli == NULL) {
+ if (pli == NULL) {
return NULL;
}
@@ -702,19 +704,19 @@ OpenMediaData* CPlayerPlaylistBar::GetCurOMD(REFERENCE_TIME rtStart)
CString fn = CString(pli->m_fns.GetHead()).MakeLower();
- if(fn.Find(_T("video_ts.ifo")) >= 0
+ if (fn.Find(_T("video_ts.ifo")) >= 0
|| fn.Find(_T(".ratdvd")) >= 0) {
- if(OpenDVDData* p = DNew OpenDVDData()) {
+ 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;
@@ -723,7 +725,7 @@ OpenMediaData* CPlayerPlaylistBar::GetCurOMD(REFERENCE_TIME rtStart)
return p;
}
} else {
- if(OpenFileData* p = DNew OpenFileData()) {
+ if (OpenFileData* p = DNew OpenFileData()) {
p->fns.AddTailList(&pli->m_fns);
p->subs.AddTailList(&pli->m_subs);
p->rtStart = rtStart;
@@ -740,7 +742,7 @@ bool CPlayerPlaylistBar::SelectFileInPlaylist(LPCTSTR filename)
return false;
}
POSITION pos = m_pl.GetHeadPosition();
- while(pos) {
+ while (pos) {
CPlaylistItem& pli = m_pl.GetAt(pos);
if (pli.FindFile(filename)) {
m_pl.SetPos(pos);
@@ -756,12 +758,12 @@ 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(AfxGetAppSettings().bRememberPlaylistItems) {
+ if (p.FileExists()) {
+ if (AfxGetAppSettings().bRememberPlaylistItems) {
ParseMPCPlayList(p);
Refresh();
SelectFileInPlaylist(filename);
@@ -776,18 +778,18 @@ void CPlayerPlaylistBar::SavePlaylist()
{
CString base;
- if(AfxGetMyApp()->GetAppSavePath(base)) {
+ if (AfxGetMyApp()->GetAppSavePath(base)) {
CPath p;
p.Combine(base, _T("default.mpcpl"));
- if(AfxGetAppSettings().bRememberPlaylistItems) {
+ if (AfxGetAppSettings().bRememberPlaylistItems) {
// 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);
}
}
@@ -816,7 +818,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);
@@ -843,15 +845,15 @@ void CPlayerPlaylistBar::OnLvnKeyDown(NMHDR* pNMHDR, LRESULT* pResult)
CList<int> items;
POSITION pos = m_list.GetFirstSelectedItemPosition();
- while(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))) {
+ if (m_pl.RemoveAt(FindPos(i))) {
((CMainFrame*)AfxGetMainWnd())->CloseMedia();
}
m_list.DeleteItem(i);
@@ -865,7 +867,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();
@@ -878,7 +880,7 @@ 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) {
@@ -899,11 +901,11 @@ void CPlayerPlaylistBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
*pResult = CDRF_DODEFAULT;
- if(CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
+ if (CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
{
*pResult = CDRF_NOTIFYPOSTPAINT|CDRF_NOTIFYITEMDRAW;
}
- else if(CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
+ else if (CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
{
pLVCD->nmcd.uItemState &= ~CDIS_SELECTED;
pLVCD->nmcd.uItemState &= ~CDIS_FOCUS;
@@ -913,11 +915,11 @@ void CPlayerPlaylistBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
*pResult = CDRF_NOTIFYPOSTPAINT;
}
- else if(CDDS_ITEMPOSTPAINT == pLVCD->nmcd.dwDrawStage)
+ else if (CDDS_ITEMPOSTPAINT == pLVCD->nmcd.dwDrawStage)
{
int nItem = static_cast<int>(pLVCD->nmcd.dwItemSpec);
- if(m_list.GetItemState(pLVCD->nmcd.dwItemSpec, LVIS_SELECTED))
+ if (m_list.GetItemState(pLVCD->nmcd.dwItemSpec, LVIS_SELECTED))
{
CRect r, r2;
m_list.GetItemRect(nItem, &r, LVIR_BOUNDS);
@@ -928,7 +930,7 @@ void CPlayerPlaylistBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
*pResult = CDRF_SKIPDEFAULT;
}
- else if(CDDS_POSTPAINT == pLVCD->nmcd.dwDrawStage)
+ else if (CDDS_POSTPAINT == pLVCD->nmcd.dwDrawStage)
{
}
}
@@ -936,7 +938,7 @@ void CPlayerPlaylistBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
void CPlayerPlaylistBar::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
- if(nIDCtl != IDC_PLAYLIST) {
+ if (nIDCtl != IDC_PLAYLIST) {
return;
}
@@ -948,7 +950,7 @@ 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 {
@@ -956,16 +958,16 @@ void CPlayerPlaylistBar::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruc
}
COLORREF textcolor = fSelected?0xff:0;
- if(pli.m_fInvalid) {
+ 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);
@@ -977,12 +979,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);
}
@@ -1007,7 +1009,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);
@@ -1039,7 +1041,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);
@@ -1055,13 +1057,13 @@ 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 {
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 {
KillTimer(2);
@@ -1077,19 +1079,19 @@ 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) {
+ if (m_list.GetTopIndex() == 0) {
KillTimer(1);
}
- } else if(nIDEvent == 2) {
+ } else if (nIDEvent == 2) {
m_list.EnsureVisible(iBottomItem + 1, false);
m_list.UpdateWindow();
- if(m_list.GetBottomIndex() == (m_list.GetItemCount() - 1)) {
+ if (m_list.GetBottomIndex() == (m_list.GetItemCount() - 1)) {
KillTimer(2);
}
}
@@ -1102,7 +1104,7 @@ void CPlayerPlaylistBar::OnTimer(UINT_PTR nIDEvent)
void CPlayerPlaylistBar::OnLButtonUp(UINT nFlags, CPoint point)
{
- if(m_bDragging) {
+ if (m_bDragging) {
::ReleaseCapture();
m_bDragging = FALSE;
@@ -1118,7 +1120,7 @@ void CPlayerPlaylistBar::OnLButtonUp(UINT nFlags, CPoint point)
CPoint pt(point);
ClientToScreen(&pt);
- if(WindowFromPoint(pt) == &m_list) {
+ if (WindowFromPoint(pt) == &m_list) {
DropItemOnList();
}
}
@@ -1143,7 +1145,7 @@ void CPlayerPlaylistBar::DropItemOnList()
lvi.cchTextMax = _MAX_PATH;
m_list.GetItem(&lvi);
- if(m_nDropIndex < 0) {
+ if (m_nDropIndex < 0) {
m_nDropIndex = m_list.GetItemCount();
}
lvi.iItem = m_nDropIndex;
@@ -1154,10 +1156,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) {
+ if (m_nDropIndex < m_nDragIndex) {
m_nDragIndex++;
}
- for(int col=1; col < nColumnCount; col++) {
+ for (int col=1; col < nColumnCount; col++) {
_tcscpy(lvi.pszText, (LPCTSTR)(m_list.GetItemText(m_nDragIndex, col)));
lvi.iSubItem = col;
m_list.SetItem(&lvi);
@@ -1167,20 +1169,20 @@ 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()) {
+ 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) {
+ if (pli.m_id == id) {
m_pl.SetPos(m_pl.GetTailPosition());
}
m_list.SetItemData(i, (DWORD_PTR)m_pl.GetTailPosition());
@@ -1200,7 +1202,7 @@ BOOL CPlayerPlaylistBar::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResul
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;
}
@@ -1208,37 +1210,37 @@ BOOL CPlayerPlaylistBar::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResul
CString strTipText;
- if(col == COL_NAME) {
+ if (col == COL_NAME) {
POSITION pos = pli.m_fns.GetHeadPosition();
- while(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) {
+ if (pli.m_vinput >= 0) {
strTipText += _T("\n") + str;
}
str.Format(_T("Video Channel %d"), pli.m_vchannel);
- if(pli.m_vchannel >= 0) {
+ if (pli.m_vchannel >= 0) {
strTipText += _T("\n") + str;
}
str.Format(_T("Audio Input %d"), pli.m_ainput);
- if(pli.m_ainput >= 0) {
+ 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;
}
@@ -1263,7 +1265,7 @@ void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p)
m.CreatePopupMenu();
enum {
- M_OPEN=1, M_ADD, M_REMOVE, M_CLIPBOARD, M_SAVEAS,
+ M_OPEN=1, M_ADD, M_REMOVE, M_CLEAR, M_CLIPBOARD, M_SAVEAS,
M_SORTBYNAME, M_SORTBYPATH, M_RANDOMIZE, M_SORTBYID,
M_REMEMBERPLAYLIST, M_SHUFFLE, M_HIDEFULLSCREEN
};
@@ -1271,11 +1273,13 @@ void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p)
AppSettings& s = AfxGetAppSettings();
m.AppendMenu(MF_STRING|(!fOnItem?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_OPEN, ResStr(IDS_PLAYLIST_OPEN));
- if(((CMainFrame*)AfxGetMainWnd())->GetPlaybackMode() == PM_CAPTURE) {
+ 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|(!m_pl.GetCount()?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_CLEAR, ResStr(IDS_PLAYLIST_CLEAR));
+ m.AppendMenu(MF_SEPARATOR);
m.AppendMenu(MF_STRING|(!fOnItem?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_CLIPBOARD, ResStr(IDS_PLAYLIST_COPYTOCLIPBOARD));
m.AppendMenu(MF_STRING|(!m_pl.GetCount()?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_SAVEAS, ResStr(IDS_PLAYLIST_SAVEAS));
m.AppendMenu(MF_SEPARATOR);
@@ -1292,7 +1296,7 @@ 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) {
+ switch (nID) {
case M_OPEN:
m_pl.SetPos(pos);
m_list.Invalidate();
@@ -1303,12 +1307,17 @@ void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p)
m_pl.SetPos(m_pl.GetTailPosition());
break;
case M_REMOVE:
- if(m_pl.RemoveAt(pos)) {
+ if (m_pl.RemoveAt(pos)) {
pMainFrm->CloseMedia();
}
m_list.DeleteItem(lvhti.iItem);
SavePlaylist();
break;
+ case M_CLEAR:
+ if (Empty()) {
+ pMainFrm->CloseMedia();
+ }
+ break;
case M_SORTBYID:
m_pl.SortById();
SetupList();
@@ -1330,18 +1339,18 @@ void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p)
SavePlaylist();
break;
case M_CLIPBOARD:
- if(OpenClipboard() && EmptyClipboard()) {
+ if (OpenClipboard() && EmptyClipboard()) {
CString str;
CPlaylistItem& pli = m_pl.GetAt(pos);
POSITION pos = pli.m_fns.GetHeadPosition();
- while(pos) {
+ 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)) {
+ if (HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, (str.GetLength()+1)*sizeof(TCHAR))) {
+ if (TCHAR* s = (TCHAR*)GlobalLock(h)) {
_tcscpy(s, str);
GlobalUnlock(h);
#ifdef UNICODE
@@ -1360,12 +1369,12 @@ void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p)
_T("Media Player Classic playlist (*.mpcpl)|*.mpcpl|Playlist (*.pls)|*.pls|Winamp playlist (*.m3u)|*.m3u|Windows Media playlist (*.asx)|*.asx||"),
this);
- if(fd.DoModal() != IDOK) {
+ if (fd.DoModal() != IDOK) {
break;
}
CTextFile::enc encoding = (CTextFile::enc)fd.GetEncoding();
- if(encoding == CTextFile::ASCII) {
+ if (encoding == CTextFile::ASCII) {
encoding = CTextFile::ANSI;
}
@@ -1373,7 +1382,7 @@ void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p)
CPath path(fd.GetPathName());
- switch(idx) {
+ switch (idx) {
case 1:
path.AddExtension(_T(".mpcpl"));
break;
@@ -1397,45 +1406,45 @@ void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p)
CString base = (LPCTSTR)p;
pos = m_pl.GetHeadPosition();
- while(pos && fRemovePath) {
+ while (pos && fRemovePath) {
CPlaylistItem& pli = m_pl.GetNext(pos);
- if(pli.m_type != CPlaylistItem::file) {
+ if (pli.m_type != CPlaylistItem::file) {
fRemovePath = false;
} else {
POSITION pos;
pos = pli.m_fns.GetHeadPosition();
- while(pos && fRemovePath) {
+ while (pos && fRemovePath) {
CString fn = pli.m_fns.GetNext(pos);
CPath p(fn);
p.RemoveFileSpec();
- if(base != (LPCTSTR)p) {
+ if (base != (LPCTSTR)p) {
fRemovePath = false;
}
}
pos = pli.m_subs.GetHeadPosition();
- while(pos && fRemovePath) {
+ while (pos && fRemovePath) {
CString fn = pli.m_subs.GetNext(pos);
CPath p(fn);
p.RemoveFileSpec();
- if(base != (LPCTSTR)p) {
+ if (base != (LPCTSTR)p) {
fRemovePath = false;
}
}
}
}
- if(idx == 1) {
+ if (idx == 1) {
SaveMPCPlayList(path, encoding, fRemovePath);
break;
}
CTextFile f;
- if(!f.Save(path, encoding)) {
+ if (!f.Save(path, encoding)) {
break;
}
@@ -1448,17 +1457,17 @@ void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p)
pos = m_pl.GetHeadPosition();
CString str;
int i;
- for(i = 0; pos; i++) {
+ for (i = 0; pos; i++) {
CPlaylistItem& pli = m_pl.GetNext(pos);
- if(pli.m_type != CPlaylistItem::file) {
+ if (pli.m_type != CPlaylistItem::file) {
continue;
}
CString fn = pli.m_fns.GetHead();
/*
- if(fRemovePath)
+ if (fRemovePath)
{
CPath p(path);
p.StripPath();
@@ -1466,7 +1475,7 @@ void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p)
}
*/
- switch(idx) {
+ switch (idx) {
case 2:
str.Format(_T("File%d=%s\n"), i+1, fn);
break;
@@ -1509,7 +1518,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 56480eeb4..c1bdd8968 100644
--- a/src/apps/mplayerc/PlayerPlaylistBar.h
+++ b/src/apps/mplayerc/PlayerPlaylistBar.h
@@ -91,7 +91,7 @@ public:
void SetCurTime(REFERENCE_TIME rt);
void Refresh();
- void Empty();
+ bool Empty();
void Open(CAtlList<CString>& fns, bool fMulti, CAtlList<CString>* subs = NULL);
void Append(CAtlList<CString>& fns, bool fMulti, CAtlList<CString>* subs = NULL);
diff --git a/src/apps/mplayerc/PlayerSeekBar.cpp b/src/apps/mplayerc/PlayerSeekBar.cpp
index 2a4693f9c..dbf9b026d 100644
--- a/src/apps/mplayerc/PlayerSeekBar.cpp
+++ b/src/apps/mplayerc/PlayerSeekBar.cpp
@@ -33,7 +33,8 @@ IMPLEMENT_DYNAMIC(CPlayerSeekBar, CDialogBar)
CPlayerSeekBar::CPlayerSeekBar() :
m_start(0), m_stop(100), m_pos(0), m_posreal(0),
- m_fEnabled(false)
+ m_fEnabled(false),
+ m_tooltipState(TOOLTIP_HIDDEN), m_tooltipLastPos(-1), m_tooltipTimer(1)
{
}
@@ -43,16 +44,34 @@ 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;
}
+ m_tooltip.Create(this, TTS_NOPREFIX | TTS_ALWAYSTIP);
+
+ m_tooltip.SetMaxTipWidth(SHRT_MAX);
+ // SetDelayTime seems to be ignored but we set it anyway for safety.
+ m_tooltip.SetDelayTime(TTDT_AUTOPOP, SHRT_MAX);
+ m_tooltip.SetDelayTime(TTDT_INITIAL, 0);
+ m_tooltip.SetDelayTime(TTDT_RESHOW, 0);
+
+ memset(&m_ti, 0, sizeof(TOOLINFO));
+ m_ti.cbSize = sizeof(TOOLINFO);
+ m_ti.uFlags = TTF_IDISHWND | TTF_TRACK | TTF_ABSOLUTE;
+ m_ti.hwnd = m_hWnd;
+ m_ti.hinst = AfxGetInstanceHandle();
+ m_ti.lpszText = NULL;
+ m_ti.uId = (UINT)m_hWnd;
+
+ m_tooltip.SendMessage(TTM_ADDTOOL, 0, (LPARAM)&m_ti);
+
return TRUE;
}
BOOL CPlayerSeekBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CDialogBar::PreCreateWindow(cs)) {
+ if (!CDialogBar::PreCreateWindow(cs)) {
return FALSE;
}
@@ -77,12 +96,12 @@ void CPlayerSeekBar::GetRange(__int64& start, __int64& stop)
void CPlayerSeekBar::SetRange(__int64 start, __int64 stop)
{
- if(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) {
+ if (m_pos < m_start || m_pos >= m_stop) {
SetPos(m_start);
}
}
@@ -100,7 +119,7 @@ __int64 CPlayerSeekBar::GetPosReal()
void CPlayerSeekBar::SetPos(__int64 pos)
{
CWnd* w = GetCapture();
- if(w && w->m_hWnd == m_hWnd) {
+ if (w && w->m_hWnd == m_hWnd) {
return;
}
@@ -109,7 +128,7 @@ void CPlayerSeekBar::SetPos(__int64 pos)
void CPlayerSeekBar::SetPosInternal(__int64 pos)
{
- if(m_pos == pos) {
+ if (m_pos == pos) {
return;
}
@@ -118,11 +137,11 @@ void CPlayerSeekBar::SetPosInternal(__int64 pos)
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 );
}
}
@@ -162,24 +181,35 @@ CRect CPlayerSeekBar::GetInnerThumbRect()
return(r);
}
-void CPlayerSeekBar::MoveThumb(CPoint point)
+__int64 CPlayerSeekBar::CalculatePosition(CPoint point)
{
+ __int64 pos = -1;
CRect r = GetChannelRect();
- if(r.left >= r.right) {
- return;
+ if (r.left >= r.right) {
+ pos = -1;
}
-
- if(point.x < r.left) {
- SetPos(m_start);
- } else if(point.x >= r.right) {
- SetPos(m_stop);
+ else if (point.x < r.left) {
+ pos = m_start;
+ } else if (point.x >= r.right) {
+ pos = m_stop;
} else {
__int64 w = r.right - r.left;
- if(m_start < m_stop) {
- SetPosInternal(m_start + ((m_stop - m_start) * (point.x - r.left) + (w/2)) / w);
+ if (m_start < m_stop) {
+ pos = m_start + ((m_stop - m_start) * (point.x - r.left) + (w/2)) / w;
}
}
+
+ return pos;
+}
+
+void CPlayerSeekBar::MoveThumb(CPoint point)
+{
+ __int64 pos = CalculatePosition(point);
+
+ if (pos >= 0) {
+ SetPosInternal(pos);
+ }
}
BEGIN_MESSAGE_MAP(CPlayerSeekBar, CDialogBar)
@@ -191,6 +221,7 @@ BEGIN_MESSAGE_MAP(CPlayerSeekBar, CDialogBar)
ON_WM_MOUSEMOVE()
ON_WM_ERASEBKGND()
ON_WM_SETCURSOR()
+ ON_WM_TIMER()
//}}AFX_MSG_MAP
ON_COMMAND_EX(ID_PLAY_STOP, OnPlayStop)
END_MESSAGE_MAP()
@@ -229,7 +260,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);
@@ -278,6 +309,8 @@ void CPlayerSeekBar::OnPaint()
void CPlayerSeekBar::OnSize(UINT nType, int cx, int cy)
{
+ HideToolTip();
+
CDialogBar::OnSize(nType, cx, cy);
Invalidate();
@@ -285,13 +318,13 @@ 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);
} else {
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));
}
@@ -307,17 +340,80 @@ void CPlayerSeekBar::OnLButtonUp(UINT nFlags, CPoint point)
CDialogBar::OnLButtonUp(nFlags, point);
}
+void CPlayerSeekBar::UpdateTooltip(CPoint point)
+{
+ m_tooltipPos = CalculatePosition(point);
+
+ if (m_fEnabled && m_start < m_stop && (GetChannelRect() | GetThumbRect()).PtInRect(point)) {
+ if (m_tooltipState == TOOLTIP_HIDDEN && m_tooltipPos != m_tooltipLastPos) {
+ // Request notification when the mouse leaves.
+ TRACKMOUSEEVENT tme = { sizeof(TRACKMOUSEEVENT) };
+ tme.hwndTrack = m_hWnd;
+ tme.dwFlags = TME_LEAVE;
+ TrackMouseEvent(&tme);
+
+ m_tooltipState = TOOLTIP_TRIGGERED;
+ m_tooltipTimer = SetTimer(m_tooltipTimer, SHOW_DELAY, NULL);
+ }
+ } else {
+ HideToolTip();
+ }
+
+ if (m_tooltipState == TOOLTIP_VISIBLE && m_tooltipPos != m_tooltipLastPos) {
+ DVD_HMSF_TIMECODE tcNow = RT2HMSF(m_tooltipPos);
+
+ if (tcNow.bHours > 0) {
+ m_tooltipText.Format(_T("%02d:%02d:%02d"), tcNow.bHours, tcNow.bMinutes, tcNow.bSeconds);
+ } else {
+ m_tooltipText.Format(_T("%02d:%02d"), tcNow.bMinutes, tcNow.bSeconds);
+ }
+
+ point.y = GetChannelRect().TopLeft().y;
+ ClientToScreen(&point);
+ static CRect r;
+ m_tooltip.GetWindowRect(&r);
+ m_tooltip.SendMessage(TTM_TRACKPOSITION, 0, (LPARAM)MAKELPARAM(point.x -(r.Width() / 2), point.y - 30));
+ m_ti.lpszText = (LPTSTR)(LPCTSTR)m_tooltipText;
+ m_tooltip.SendMessage(TTM_SETTOOLINFO, 0, (LPARAM)&m_ti);
+ m_tooltipLastPos = m_tooltipPos;
+ // Reset the timer
+ m_tooltipTimer = SetTimer(m_tooltipTimer, AUTOPOP_DELAY, NULL);
+ }
+}
+
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);
}
+ UpdateTooltip(point);
+
CDialogBar::OnMouseMove(nFlags, point);
}
+LRESULT CPlayerSeekBar::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if (message == WM_MOUSELEAVE) {
+ HideToolTip();
+ }
+
+ return CWnd::WindowProc(message, wParam, lParam);
+}
+
+BOOL CPlayerSeekBar::PreTranslateMessage(MSG* pMsg)
+{
+ POINT ptWnd(pMsg->pt);
+ this->ScreenToClient(&ptWnd);
+ if (m_fEnabled && m_start < m_stop && (GetChannelRect() | GetThumbRect()).PtInRect(ptWnd)) {
+ m_tooltip.RelayEvent(pMsg);
+ }
+
+ return CDialogBar::PreTranslateMessage(pMsg);
+}
+
BOOL CPlayerSeekBar::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
@@ -325,9 +421,11 @@ BOOL CPlayerSeekBar::OnEraseBkgnd(CDC* pDC)
BOOL CPlayerSeekBar::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
- bool fEnabled = m_fEnabled && m_start < m_stop;
+ static CPoint point;
+ GetCursorPos(&point);
+ ScreenToClient(&point);
- if(fEnabled) {
+ if (m_fEnabled && m_start < m_stop && GetThumbRect().PtInRect(point)) {
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_HAND));
return TRUE;
}
@@ -339,3 +437,41 @@ BOOL CPlayerSeekBar::OnPlayStop(UINT nID)
SetPos(0);
return FALSE;
}
+
+void CPlayerSeekBar::OnTimer(UINT_PTR nIDEvent)
+{
+ if (nIDEvent == m_tooltipTimer) {
+ switch (m_tooltipState) {
+ case TOOLTIP_TRIGGERED:
+ {
+ CPoint point;
+
+ GetCursorPos(&point);
+ ScreenToClient(&point);
+
+ if (m_fEnabled && m_start < m_stop && (GetChannelRect() | GetThumbRect()).PtInRect(point)) {
+ m_tooltipTimer = SetTimer(m_tooltipTimer, AUTOPOP_DELAY, NULL);
+ m_tooltipState = TOOLTIP_VISIBLE;
+ UpdateTooltip(point);
+ m_tooltip.SendMessage(TTM_TRACKACTIVATE, TRUE, (LPARAM)&m_ti);
+ }
+ }
+ break;
+ case TOOLTIP_VISIBLE:
+ HideToolTip();
+ break;
+ }
+
+ }
+
+ CWnd::OnTimer(nIDEvent);
+}
+
+void CPlayerSeekBar::HideToolTip()
+{
+ if (m_tooltipState > TOOLTIP_HIDDEN) {
+ KillTimer(m_tooltipTimer);
+ m_tooltip.SendMessage(TTM_TRACKACTIVATE, FALSE, (LPARAM)&m_ti);
+ m_tooltipState = TOOLTIP_HIDDEN;
+ }
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/PlayerSeekBar.h b/src/apps/mplayerc/PlayerSeekBar.h
index 260198b8d..3423054e2 100644
--- a/src/apps/mplayerc/PlayerSeekBar.h
+++ b/src/apps/mplayerc/PlayerSeekBar.h
@@ -23,6 +23,9 @@
#pragma once
+#define SHOW_DELAY 100
+#define AUTOPOP_DELAY 1000
+
// CPlayerSeekBar
class CPlayerSeekBar : public CDialogBar
@@ -30,12 +33,23 @@ class CPlayerSeekBar : public CDialogBar
DECLARE_DYNAMIC(CPlayerSeekBar)
private:
+ enum tooltip_state_t { TOOLTIP_HIDDEN, TOOLTIP_TRIGGERED, TOOLTIP_VISIBLE };
+
__int64 m_start, m_stop, m_pos, m_posreal;
bool m_fEnabled;
+ CToolTipCtrl m_tooltip;
+ TOOLINFO m_ti;
+ tooltip_state_t m_tooltipState;
+ __int64 m_tooltipPos, m_tooltipLastPos;
+ CString m_tooltipText;
+ UINT_PTR m_tooltipTimer;
void MoveThumb(CPoint point);
+ __int64 CalculatePosition(CPoint point);
void SetPosInternal(__int64 pos);
+ void UpdateTooltip(CPoint point);
+
CRect GetChannelRect();
CRect GetThumbRect();
CRect GetInnerThumbRect();
@@ -51,12 +65,14 @@ public:
__int64 GetPos(), GetPosReal();
void SetPos(__int64 pos);
+ void HideToolTip();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPlayerSeekBar)
virtual BOOL Create(CWnd* pParentWnd);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Generated message map functions
@@ -67,8 +83,10 @@ protected:
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+ afx_msg LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+ afx_msg void OnTimer(UINT_PTR nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
diff --git a/src/apps/mplayerc/PlayerShaderEditorBar.cpp b/src/apps/mplayerc/PlayerShaderEditorBar.cpp
index 79d2c397e..9e18e1cf8 100644
--- a/src/apps/mplayerc/PlayerShaderEditorBar.cpp
+++ b/src/apps/mplayerc/PlayerShaderEditorBar.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -38,7 +38,7 @@ 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;
}
@@ -57,13 +57,13 @@ 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;
}
}
@@ -81,7 +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 fda6816c4..702c193c3 100644
--- a/src/apps/mplayerc/PlayerStatusBar.cpp
+++ b/src/apps/mplayerc/PlayerStatusBar.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -42,7 +42,7 @@ CPlayerStatusBar::CPlayerStatusBar()
CPlayerStatusBar::~CPlayerStatusBar()
{
- if(m_hIcon) {
+ if (m_hIcon) {
DestroyIcon(m_hIcon);
}
}
@@ -54,7 +54,7 @@ BOOL CPlayerStatusBar::Create(CWnd* pParentWnd)
BOOL CPlayerStatusBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CDialogBar::PreCreateWindow(cs)) {
+ if (!CDialogBar::PreCreateWindow(cs)) {
return FALSE;
}
@@ -66,7 +66,7 @@ BOOL CPlayerStatusBar::PreCreateWindow(CREATESTRUCT& cs)
int CPlayerStatusBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if(CDialogBar::OnCreate(lpCreateStruct) == -1) {
+ if (CDialogBar::OnCreate(lpCreateStruct) == -1) {
return -1;
}
@@ -93,7 +93,7 @@ void CPlayerStatusBar::Relayout()
{
BITMAP bm;
memset(&bm, 0, sizeof(bm));
- if(m_bm.m_hObject) {
+ if (m_bm.m_hObject) {
m_bm.GetBitmap(&bm);
}
@@ -105,7 +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);
@@ -139,14 +139,14 @@ void CPlayerStatusBar::Clear()
void CPlayerStatusBar::SetStatusBitmap(UINT id)
{
- if(m_bmid == id) {
+ if (m_bmid == id) {
return;
}
- if(m_bm.m_hObject) {
+ if (m_bm.m_hObject) {
m_bm.DeleteObject();
}
- if(id) {
+ if (id) {
m_bm.LoadBitmap(id);
}
m_bmid = id;
@@ -156,11 +156,11 @@ void CPlayerStatusBar::SetStatusBitmap(UINT id)
void CPlayerStatusBar::SetStatusTypeIcon(HICON hIcon)
{
- if(m_hIcon == hIcon) {
+ if (m_hIcon == hIcon) {
return;
}
- if(m_hIcon) {
+ if (m_hIcon) {
DestroyIcon(m_hIcon);
}
m_type.SetIcon(m_hIcon = hIcon);
@@ -187,7 +187,7 @@ void CPlayerStatusBar::SetStatusTimer(CString str)
{
CString tmp;
m_time.GetWindowText(tmp);
- if(tmp == str) {
+ if (tmp == str) {
return;
}
@@ -205,30 +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 {
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 {
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);
}
@@ -261,8 +261,8 @@ END_MESSAGE_MAP()
BOOL CPlayerStatusBar::OnEraseBkgnd(CDC* pDC)
{
- for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) {
- if(!pChild->IsWindowVisible()) {
+ for (CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) {
+ if (!pChild->IsWindowVisible()) {
continue;
}
@@ -277,11 +277,11 @@ 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);
}
@@ -300,7 +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;
@@ -312,7 +312,7 @@ void CPlayerStatusBar::OnPaint()
//
}
/*
- if(m_hIcon)
+ if (m_hIcon)
{
GetClientRect(&r);
r.SetRect(6, r.top+4, 22-1, r.bottom-4-1);
@@ -337,7 +337,7 @@ 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;
@@ -359,14 +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->IsCaptionHidden()) {
+ // if (p.x+p.y >= r.Width())
+ if (p.x >= r.Width()-r.Height() && !pFrame->IsCaptionHidden()) {
SetCursor(LoadCursor(NULL, IDC_SIZENWSE));
return TRUE;
}
@@ -379,7 +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/PlayerSubresyncBar.cpp b/src/apps/mplayerc/PlayerSubresyncBar.cpp
index 77d3ee306..c030e6a55 100644
--- a/src/apps/mplayerc/PlayerSubresyncBar.cpp
+++ b/src/apps/mplayerc/PlayerSubresyncBar.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -43,7 +43,7 @@ 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;
}
@@ -61,7 +61,7 @@ BOOL CPlayerSubresyncBar::Create(CWnd* pParentWnd, CCritSec* pSubLock)
BOOL CPlayerSubresyncBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CSizingControlBarG::PreCreateWindow(cs)) {
+ if (!CSizingControlBarG::PreCreateWindow(cs)) {
return FALSE;
}
@@ -70,13 +70,13 @@ BOOL CPlayerSubresyncBar::PreCreateWindow(CREATESTRUCT& cs)
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;
}
}
@@ -90,11 +90,11 @@ 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) {
+ if (m_lastSegment != curSegment) {
m_list.Invalidate();
}
m_lastSegment = curSegment;
@@ -110,14 +110,14 @@ void CPlayerSubresyncBar::SetSubtitle(ISubStream* pSubStream, double fps)
ResetSubtitle();
- if(!m_pSubStream) {
+ 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;
@@ -125,7 +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);
@@ -135,7 +135,7 @@ void CPlayerSubresyncBar::SetSubtitle(ISubStream* pSubStream, double fps)
pVSF->m_fOnlyShowForcedSubs = false;
- 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, 80);
@@ -145,7 +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;
@@ -155,7 +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);
@@ -165,7 +165,7 @@ 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);
@@ -184,7 +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;
}
@@ -196,12 +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);
@@ -209,7 +209,7 @@ 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;
@@ -229,14 +229,14 @@ void CPlayerSubresyncBar::ResetSubtitle()
void CPlayerSubresyncBar::SaveSubtitle()
{
CMainFrame* pFrame = ((CMainFrame*)AfxGetMainWnd());
- if(!pFrame) {
+ 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);
@@ -244,20 +244,20 @@ 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) {
+ 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);
@@ -272,9 +272,9 @@ 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;
@@ -283,36 +283,36 @@ void CPlayerSubresyncBar::UpdatePreview()
} 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) {
+ if ((data&TSEP) && end > i) {
break;
}
- if(data&(TSMOD|TSADJ)) {
+ 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;
@@ -320,7 +320,7 @@ 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];
@@ -350,7 +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);
@@ -358,7 +358,7 @@ void CPlayerSubresyncBar::UpdatePreview()
m_list.SetItemText(i, COL_PREVEND, buff);
}
- if(IsWindowVisible()) {
+ if (IsWindowVisible()) {
SaveSubtitle();
}
}
@@ -366,7 +366,7 @@ 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) {
@@ -380,7 +380,7 @@ void CPlayerSubresyncBar::SetSTS0( int &start, int end, int ti0 )
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) {
@@ -401,8 +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);
@@ -417,19 +417,19 @@ 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) {
+ if (_stscanf(m_sts.GetStr(i), _T("%d%c%d%c%d"), &vobid, &c, &cellid, &c, &forced) != 5) {
continue;
}
- if(vobid < 0) {
+ if (vobid < 0) {
str = _T("-");
} else {
str.Format(_T("%d"), vobid);
}
m_list.SetItemText(i, COL_VOBID, str);
- if(cellid < 0) {
+ if (cellid < 0) {
str = _T("-");
} else {
str.Format(_T("%d"), cellid);
@@ -443,7 +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);
@@ -454,19 +454,19 @@ 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) {
+ if (fStart) {
nCheck |= TSMOD;
- } else if(abs(st.orgstart-st.newstart)) {
+ } else if (abs(st.orgstart-st.newstart)) {
nCheck |= TSADJ;
}
- if(fEnd) {
+ if (fEnd) {
nCheck |= TEMOD;
- } else if(abs(st.orgend-st.newend)) {
+ } else if (abs(st.orgend-st.newend)) {
nCheck |= TEADJ;
}
@@ -489,14 +489,14 @@ 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) {
+ if (!fEndMod) {
st.newend = st.newstart + (st.orgend - st.orgstart);
- } else if(fReset) {
+ } else if (fReset) {
st.newstart = st.newend - (st.orgend - st.orgstart);
}
@@ -515,14 +515,14 @@ 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) {
+ if (!fStartMod) {
st.newstart = st.newend - (st.orgend - st.orgstart);
- } else if(fReset) {
+ } else if (fReset) {
st.newend = st.newstart + (st.orgend - st.orgstart);
}
@@ -570,7 +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);
@@ -584,7 +584,7 @@ static bool ParseTime(CString str, int& ret, bool fWarn = true)
TCHAR c;
str.Trim();
- if(str.GetLength() > 0 && str[0] == '-') {
+ if (str.GetLength() > 0 && str[0] == '-') {
sign = -1;
}
@@ -592,7 +592,7 @@ static bool ParseTime(CString str, int& ret, bool fWarn = true)
h = abs(h);
- if(n == 7
+ if (n == 7
&& 0 <= h && h < 24
&& 0 <= m && m < 60
&& 0 <= s && s < 60
@@ -601,7 +601,7 @@ static bool ParseTime(CString str, int& ret, bool fWarn = true)
return(true);
}
- if(fWarn) {
+ if (fWarn) {
AfxMessageBox(_T("The correct time format is [-]hh:mm:ss.ms\n(e.g. 01:23:45.678)"));
}
return(false);
@@ -614,14 +614,14 @@ void CPlayerSubresyncBar::OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
*pResult = FALSE;
- if(pItem->iItem >= 0) {
- if((pItem->iSubItem == COL_START || pItem->iSubItem == COL_END || pItem->iSubItem == COL_TEXT
+ 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) {
*pResult = TRUE;
- } else if((pItem->iSubItem == COL_START)
- && m_mode == VOBSUB) {
+ } else if ((pItem->iSubItem == COL_START)
+ && m_mode == VOBSUB) {
*pResult = TRUE;
}
}
@@ -634,15 +634,15 @@ void CPlayerSubresyncBar::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
*pResult = FALSE;
- if(pItem->iItem >= 0) {
- if((pItem->iSubItem == COL_START || pItem->iSubItem == COL_END || pItem->iSubItem == COL_TEXT
+ 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_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;
}
@@ -656,17 +656,17 @@ 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) {
+ 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)) {
+ if (ParseTime(pItem->pszText, t)) {
fNeedsUpdate = ModStart(pItem->iItem, t);
*pResult = TRUE;
@@ -674,9 +674,9 @@ void CPlayerSubresyncBar::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
}
break;
case COL_END:
- if(m_mode == TEXTSUB) {
+ if (m_mode == TEXTSUB) {
int t;
- if(ParseTime(pItem->pszText, t)) {
+ if (ParseTime(pItem->pszText, t)) {
fNeedsUpdate = ModEnd(pItem->iItem, t);
*pResult = TRUE;
@@ -684,10 +684,10 @@ void CPlayerSubresyncBar::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
}
break;
case COL_TEXT:
- if(m_mode == TEXTSUB) {
+ if (m_mode == TEXTSUB) {
CString str = m_sts.GetStr(pItem->iItem, true);
- if(str != pItem->pszText) {
+ 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));
@@ -695,14 +695,14 @@ void CPlayerSubresyncBar::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
}
break;
case COL_STYLE:
- if(m_mode == TEXTSUB) {
+ if (m_mode == TEXTSUB) {
CString str(pItem->pszText);
str.Trim();
- if(!str.IsEmpty() && m_sts[pItem->iItem].style != str) {
+ if (!str.IsEmpty() && m_sts[pItem->iItem].style != str) {
fNeedsUpdate = true;
- if(!m_sts.m_styles.Lookup(str)) {
+ if (!m_sts.m_styles.Lookup(str)) {
m_sts.AddStyle(str, DNew STSStyle());
}
@@ -713,9 +713,9 @@ void CPlayerSubresyncBar::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
}
break;
case COL_LAYER:
- if(m_mode == TEXTSUB) {
+ if (m_mode == TEXTSUB) {
int l;
- if(_stscanf_s(pItem->pszText, _T("%d"), &l) == 1) {
+ if (_stscanf_s(pItem->pszText, _T("%d"), &l) == 1) {
fNeedsUpdate = true;
m_sts[pItem->iItem].layer = l;
CString str;
@@ -725,10 +725,10 @@ void CPlayerSubresyncBar::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
}
break;
case COL_ACTOR:
- if(m_mode == TEXTSUB) {
+ if (m_mode == TEXTSUB) {
CString str(pItem->pszText);
str.Trim();
- if(!str.IsEmpty()) {
+ if (!str.IsEmpty()) {
fNeedsUpdate = true;
m_sts[pItem->iItem].actor = str;
m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
@@ -736,10 +736,10 @@ void CPlayerSubresyncBar::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
}
break;
case COL_EFFECT:
- if(m_mode == TEXTSUB) {
+ if (m_mode == TEXTSUB) {
CString str(pItem->pszText);
str.Trim();
- if(!str.IsEmpty()) {
+ if (!str.IsEmpty()) {
fNeedsUpdate = true;
m_sts[pItem->iItem].effect = str;
m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
@@ -749,7 +749,7 @@ void CPlayerSubresyncBar::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
}
}
- if(fNeedsUpdate) {
+ if (fNeedsUpdate) {
UpdatePreview();
}
}
@@ -763,7 +763,7 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
- if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0) {
+ if (lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0) {
enum {
TOGSEP=1,
DUPITEM, DELITEM,
@@ -782,18 +782,18 @@ 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) {
+ 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) {
+ switch (lpnmlv->iSubItem) {
case COL_START:
- if(m_mode == VOBSUB || m_mode == TEXTSUB) {
+ 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"));
@@ -801,7 +801,7 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
}
break;
case COL_END:
- if(m_mode == TEXTSUB) {
+ 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"));
@@ -809,13 +809,13 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
}
break;
case COL_STYLE:
- if(m_mode == TEXTSUB) {
+ if (m_mode == TEXTSUB) {
m.AppendMenu(MF_SEPARATOR);
int id = STYLEFIRST;
POSITION pos = m_sts.m_styles.GetStartPosition();
- while(pos && id <= STYLELAST) {
+ while (pos && id <= STYLELAST) {
CString key;
STSStyle* val;
m_sts.m_styles.GetNextAssoc(pos, key, val);
@@ -823,43 +823,43 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
}
- if(id > STYLEFIRST && m_list.GetSelectedCount() == 1) {
+ 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) {
+ 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) {
+ 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) {
+ if (m_mode == TEXTSUB) {
CMapStringToPtr actormap;
- for(int i = 0, j = m_sts.GetCount(); i < j; i++) {
+ for (int i = 0, j = m_sts.GetCount(); i < j; i++) {
actormap[m_sts[i].actor] = NULL;
}
actormap.RemoveKey(_T(""));
- if(actormap.GetCount() > 0) {
+ if (actormap.GetCount() > 0) {
m.AppendMenu(MF_SEPARATOR);
int id = ACTORFIRST;
POSITION pos = actormap.GetStartPosition();
- while(pos && id <= ACTORLAST) {
+ while (pos && id <= ACTORLAST) {
CString key;
void* val;
actormap.GetNextAssoc(pos, key, val);
@@ -872,22 +872,22 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
}
break;
case COL_EFFECT:
- if(m_mode == TEXTSUB) {
+ if (m_mode == TEXTSUB) {
CMapStringToPtr effectmap;
- for(int i = 0, j = m_sts.GetCount(); i < j; i++) {
+ for (int i = 0, j = m_sts.GetCount(); i < j; i++) {
effectmap[m_sts[i].effect] = NULL;
}
effectmap.RemoveKey(_T(""));
- if(effectmap.GetCount() > 0) {
+ if (effectmap.GetCount() > 0) {
m.AppendMenu(MF_SEPARATOR);
int id = EFFECTFIRST;
POSITION pos = effectmap.GetStartPosition();
- while(pos && id <= EFFECTLAST) {
+ while (pos && id <= EFFECTLAST) {
CString key;
void* val;
effectmap.GetNextAssoc(pos, key, val);
@@ -909,12 +909,12 @@ 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) {
+ switch (id) {
case TOGSEP:
m_list.SetItemData(iItem, m_list.GetItemData(iItem)^TSEP);
m_list.Invalidate();
@@ -923,13 +923,13 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
case DUPITEM: {
CUIntArray items;
pos = m_list.GetFirstSelectedItemPosition();
- while(pos) {
+ while (pos) {
items.Add(m_list.GetNextSelectedItem(pos));
}
qsort(items.GetData(), items.GetCount(), sizeof(UINT), uintcomp);
- for(int i = 0; i < items.GetCount(); i++) {
+ for (int i = 0; i < items.GetCount(); i++) {
iItem = items[i];
STSEntry stse = m_sts[iItem];
@@ -943,14 +943,14 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
CStringArray sa;
sa.SetSize(nColumnCount);
- for(int col = 0; col < nColumnCount; col++) {
+ for (int col = 0; col < nColumnCount; col++) {
sa[col] = m_list.GetItemText(iItem, col);
}
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++) {
+ for (int col = 1; col < nColumnCount; col++) {
m_list.SetItemText(iItem+1, col, sa[col]);
}
}
@@ -961,13 +961,13 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
case DELITEM: {
CUIntArray items;
pos = m_list.GetFirstSelectedItemPosition();
- while(pos) {
+ while (pos) {
items.Add(m_list.GetNextSelectedItem(pos));
}
qsort(items.GetData(), items.GetCount(), sizeof(UINT), uintcomp);
- for(int i = 0; i < items.GetCount(); i++) {
+ for (int i = 0; i < items.GetCount(); i++) {
iItem = items[i];
m_sts.RemoveAt(iItem);
m_subtimes.RemoveAt(iItem);
@@ -975,7 +975,7 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
}
iItem = items[items.GetCount()-1];
- if(iItem >= m_list.GetItemCount()) {
+ if (iItem >= m_list.GetItemCount()) {
iItem = m_list.GetItemCount()-1;
}
@@ -983,39 +983,39 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
}
fNeedsUpdate = true;
break;
- case RESETS: /*if(*/
+ case RESETS: /*if (*/
ModStart(iItem, st.orgstart, true);/*)*/
fNeedsUpdate = true;
break;
- case SETOS: /*if(*/
+ case SETOS: /*if (*/
ModStart(iItem, st.orgstart);/*)*/
fNeedsUpdate = true;
break;
- case SETCS: /*if(*/
+ case SETCS: /*if (*/
ModStart(iItem, (int)(m_rt/10000));/*)*/
fNeedsUpdate = true;
break;
- case RESETE: /*if(*/
+ case RESETE: /*if (*/
ModEnd(iItem, st.orgend, true);/*)*/
fNeedsUpdate = true;
break;
- case SETOE: /*if(*/
+ case SETOE: /*if (*/
ModEnd(iItem, st.orgend);/*)*/
fNeedsUpdate = true;
break;
- case SETCE: /*if(*/
+ case SETCE: /*if (*/
ModEnd(iItem, (int)(m_rt/10000));/*)*/
fNeedsUpdate = true;
break;
default:
- if(STYLEFIRST <= id && id <= STYLELAST) {
+ if (STYLEFIRST <= id && id <= STYLELAST) {
CString s = styles[id - STYLEFIRST];
- if(m_sts[iItem].style != s) {
+ if (m_sts[iItem].style != s) {
fNeedsUpdate = true;
}
m_sts[iItem].style = s;
m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
- } else if(id == STYLEEDIT) {
+ } else if (id == STYLEEDIT) {
CAutoPtrArray<CPPageSubStyle> pages;
CAtlArray<STSStyle*> styles;
@@ -1023,7 +1023,7 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
int iSelPage = 0;
POSITION pos = m_sts.m_styles.GetStartPosition();
- for(int i = 0; pos; i++) {
+ for (int i = 0; pos; i++) {
CString key;
STSStyle* val;
m_sts.m_styles.GetNextAssoc(pos, key, val);
@@ -1033,23 +1033,23 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
pages.Add(page);
styles.Add(val);
- if(stss == val) {
+ if (stss == val) {
iSelPage = i;
}
}
CPropertySheet dlg(_T("Styles..."), this, iSelPage);
- 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++) {
stss = styles[j];
pages[j]->GetStyle(*stss);
- for(int i = 0; i < m_sts.GetCount(); i++) {
- if(m_sts.GetStyle(i) == 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);
@@ -1062,30 +1062,30 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
fNeedsUpdate = true;
}
- } else if(id == UNICODEYES || id == UNICODENO) {
+ } 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) {
+ } else if (id == LAYERDEC || id == LAYERINC) {
int d = (id == LAYERDEC) ? -1 : (id == LAYERINC) ? +1 : 0;
- if(d != 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) {
+ } else if (ACTORFIRST <= id && id <= ACTORLAST) {
CString s = actors[id - ACTORFIRST];
- if(m_sts[iItem].actor != s) {
+ 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) {
+ } else if (EFFECTFIRST <= id && id <= EFFECTLAST) {
CString s = effects[id - EFFECTFIRST];
- if(m_sts[iItem].effect != s) {
+ if (m_sts[iItem].effect != s) {
fNeedsUpdate = true;
}
m_sts[iItem].effect = s;
@@ -1095,7 +1095,7 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
}
}
- if(fNeedsUpdate) {
+ if (fNeedsUpdate) {
UpdatePreview();
}
}
@@ -1107,10 +1107,10 @@ 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;
}
@@ -1145,55 +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) {
+ 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
+ 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) {
clrText = 0;
- } else if((pLVCD->iSubItem == COL_START)
- && m_mode == VOBSUB) {
+ } else if ((pLVCD->iSubItem == COL_START)
+ && m_mode == VOBSUB) {
clrText = 0;
} 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;
}
@@ -1201,9 +1201,9 @@ void CPlayerSubresyncBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
pLVCD->clrTextBk = clrTextBk;
*pResult = CDRF_NOTIFYPOSTPAINT;
- } else if((CDDS_ITEMPOSTPAINT|CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage) {
+ } else if ((CDDS_ITEMPOSTPAINT|CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage) {
// *pResult = CDRF_DODEFAULT;
- } else if(CDDS_ITEMPOSTPAINT == pLVCD->nmcd.dwDrawStage) {
+ } else if (CDDS_ITEMPOSTPAINT == pLVCD->nmcd.dwDrawStage) {
int nItem = static_cast<int>(pLVCD->nmcd.dwItemSpec);
LVITEM rItem;
@@ -1237,7 +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));
@@ -1248,55 +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(*/
+ switch (pMsg->wParam) {
+ case VK_F1: /*if (*/
ModStart(iItem, st.orgstart, true);/*)*/
fNeedsUpdate = true;
break;
- case VK_F3: /*if(*/
+ case VK_F3: /*if (*/
ModStart(iItem, st.orgstart);/*)*/
fNeedsUpdate = true;
break;
- case VK_F5: /*if(*/
+ case VK_F5: /*if (*/
ModStart(iItem, (int)(m_rt/10000));/*)*/
fNeedsUpdate = true;
break;
- case VK_F2: /*if(*/
+ case VK_F2: /*if (*/
ModEnd(iItem, st.orgend, true);/*)*/
fNeedsUpdate = true;
break;
- case VK_F4: /*if(*/
+ case VK_F4: /*if (*/
ModEnd(iItem, st.orgend);/*)*/
fNeedsUpdate = true;
break;
- case VK_F6: /*if(*/
+ 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);
@@ -1327,7 +1327,7 @@ int CPlayerSubresyncBar::FindNearestSub(__int64& rtPos, bool bForward)
return 0;
}
- for(int i = 1, j = m_sts.GetCount(); i < j; i++) {
+ 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;
diff --git a/src/apps/mplayerc/PlayerToolBar.cpp b/src/apps/mplayerc/PlayerToolBar.cpp
index 29b4c212d..458fbcfa3 100644
--- a/src/apps/mplayerc/PlayerToolBar.cpp
+++ b/src/apps/mplayerc/PlayerToolBar.cpp
@@ -46,12 +46,12 @@ CPlayerToolBar::~CPlayerToolBar()
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))) {
+ if (!__super::CreateEx(pParentWnd,
+ TBSTYLE_FLAT|TBSTYLE_TRANSPARENT|TBSTYLE_AUTOSIZE,
+ 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;
}
@@ -75,17 +75,17 @@ 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);
m_volctrl.SetRange(0, 100);
- 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) {
+ if (f) {
f(m_hWnd, L" ", L" ");
}
FreeLibrary(h);
@@ -95,12 +95,12 @@ BOOL CPlayerToolBar::Create(CWnd* pParentWnd)
// quick and dirty code from foxx1337; will leak, but don't care yet
m_nButtonHeight = 16; //reset m_nButtonHeight
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));
@@ -112,7 +112,7 @@ 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 {
@@ -131,7 +131,7 @@ BOOL CPlayerToolBar::Create(CWnd* pParentWnd)
BOOL CPlayerToolBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!__super::PreCreateWindow(cs)) {
+ if (!__super::PreCreateWindow(cs)) {
return FALSE;
}
@@ -144,7 +144,7 @@ BOOL CPlayerToolBar::PreCreateWindow(CREATESTRUCT& cs)
void CPlayerToolBar::ArrangeControls()
{
- if(!::IsWindow(m_volctrl.m_hWnd)) {
+ if (!::IsWindow(m_volctrl.m_hWnd)) {
return;
}
@@ -230,7 +230,7 @@ END_MESSAGE_MAP()
void CPlayerToolBar::OnPaint()
{
- if(m_bDelayedButtonLayout) {
+ if (m_bDelayedButtonLayout) {
Layout();
}
@@ -305,10 +305,10 @@ 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())) {
+ if ((i>11) || ((i<10) && ((CMainFrame*)GetParentFrame())->IsSomethingLoaded())) {
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_HAND));
}
}
@@ -320,13 +320,13 @@ 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())) {
+ if ((i>11) || ((i<10) && pFrame->IsSomethingLoaded())) {
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_HAND));
}
@@ -339,10 +339,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/Playlist.cpp b/src/apps/mplayerc/Playlist.cpp
index 99c46c8f8..34f103408 100644
--- a/src/apps/mplayerc/Playlist.cpp
+++ b/src/apps/mplayerc/Playlist.cpp
@@ -55,7 +55,7 @@ CPlaylistItem::CPlaylistItem(const CPlaylistItem& pli)
CPlaylistItem& CPlaylistItem::operator = (const CPlaylistItem& pli)
{
- if(this != &pli) {
+ if (this != &pli) {
m_id = pli.m_id;
m_label = pli.m_label;
m_fns.RemoveAll();
@@ -76,7 +76,7 @@ CPlaylistItem& CPlaylistItem::operator = (const CPlaylistItem& pli)
POSITION CPlaylistItem::FindFile(LPCTSTR path)
{
POSITION pos = m_fns.GetHeadPosition();
- while(pos) {
+ while (pos) {
if (m_fns.GetAt(pos).CompareNoCase(path) == 0) {
return pos;
}
@@ -97,21 +97,21 @@ CString CPlaylistItem::GetLabel(int i)
{
CString str;
- if(i == 0) {
- if(!m_label.IsEmpty()) {
+ if (i == 0) {
+ if (!m_label.IsEmpty()) {
str = m_label;
- } else if(!m_fns.IsEmpty()) {
+ } else if (!m_fns.IsEmpty()) {
str = StripPath(m_fns.GetHead());
}
- } else if(i == 1) {
- if(m_fInvalid) {
+ } 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,7 +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
}
@@ -134,8 +134,8 @@ bool FindFileInList(CAtlList<CString>& sl, CString fn)
{
bool fFound = false;
POSITION pos = sl.GetHeadPosition();
- while(pos && !fFound) {
- if(!sl.GetNext(pos).CompareNoCase(fn)) {
+ while (pos && !fFound) {
+ if (!sl.GetNext(pos).CompareNoCase(fn)) {
fFound = true;
}
}
@@ -144,39 +144,39 @@ bool FindFileInList(CAtlList<CString>& sl, CString fn)
void CPlaylistItem::AutoLoadFiles()
{
- if(m_fns.IsEmpty()) {
+ 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) {
+ if (hFind != INVALID_HANDLE_VALUE) {
do {
- if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
+ 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
+ if (!FindFileInList(m_fns, fullpath) && ext != ext2
&& mf.FindExt(ext2, true) && mf.IsUsingEngine(fullpath, DirectShow)) {
m_fns.AddTail(fullpath);
}
- } while(FindNextFile(hFind, &fd));
+ } while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
@@ -184,7 +184,7 @@ void CPlaylistItem::AutoLoadFiles()
}
}
- if(AfxGetAppSettings().fAutoloadSubtitles) {
+ if (AfxGetAppSettings().fAutoloadSubtitles) {
CString& pathList = AfxGetAppSettings().strSubtitlePaths;
CAtlArray<CString> paths;
@@ -193,14 +193,14 @@ void CPlaylistItem::AutoLoadFiles()
do {
CString path = pathList.Tokenize(_T(";"), pos);
paths.Add(path);
- } while(pos != -1);
+ } while (pos != -1);
CString dir = fn;
dir.Replace('\\', '/');
int l = fn.GetLength(), l2 = l;
l2 = dir.ReverseFind('.');
l = dir.ReverseFind('/') + 1;
- if(l2 < l) {
+ if (l2 < l) {
l2 = l;
}
CString title = dir.Mid(l, l2-l);
@@ -209,8 +209,8 @@ void CPlaylistItem::AutoLoadFiles()
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);
}
}
@@ -230,17 +230,19 @@ CPlaylist::~CPlaylist()
{
}
-void CPlaylist::RemoveAll()
+bool CPlaylist::RemoveAll()
{
__super::RemoveAll();
+ bool bWasPlaying = (m_pos != NULL);
m_pos = NULL;
+ return bWasPlaying;
}
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);
}
@@ -276,14 +278,14 @@ 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) {
+ if (m_pos == a[i].pos) {
m_pos = GetTailPosition();
}
}
@@ -294,16 +296,16 @@ 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) {
+ if (m_pos == a[i].pos) {
m_pos = GetTailPosition();
}
}
@@ -314,14 +316,14 @@ 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) {
+ if (m_pos == a[i].pos) {
m_pos = GetTailPosition();
}
}
@@ -333,15 +335,15 @@ 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();
}
}
@@ -365,13 +367,13 @@ POSITION CPlaylist::Shuffle()
ASSERT(GetCount() > 2);
// insert or remove items in playlist, or index out of bounds then recalculate
- if((count != GetCount()) || (idx >= GetCount())) {
+ if ((count != GetCount()) || (idx >= GetCount())) {
a.RemoveAll();
idx = 0;
a.SetCount(count = GetCount());
POSITION pos = GetHeadPosition();
- for(INT_PTR i = 0; pos; i++, GetNext(pos)) {
+ for (INT_PTR i = 0; pos; i++, GetNext(pos)) {
a[i].pos = pos; // initialize position array
}
@@ -390,11 +392,11 @@ POSITION CPlaylist::Shuffle()
CPlaylistItem& CPlaylist::GetNextWrap(POSITION& pos)
{
- if(AfxGetAppSettings().bShufflePlaylistItems && GetCount() > 2) {
+ if (AfxGetAppSettings().bShufflePlaylistItems && GetCount() > 2) {
pos = Shuffle();
} else {
GetNext(pos);
- if(!pos) {
+ if (!pos) {
pos = GetHeadPosition();
}
}
@@ -405,7 +407,7 @@ CPlaylistItem& CPlaylist::GetNextWrap(POSITION& pos)
CPlaylistItem& CPlaylist::GetPrevWrap(POSITION& pos)
{
GetPrev(pos);
- if(!pos) {
+ if (!pos) {
pos = GetTailPosition();
}
return(GetAt(pos));
diff --git a/src/apps/mplayerc/Playlist.h b/src/apps/mplayerc/Playlist.h
index 2f8ccf456..d4c15a7b7 100644
--- a/src/apps/mplayerc/Playlist.h
+++ b/src/apps/mplayerc/Playlist.h
@@ -65,7 +65,7 @@ public:
CPlaylist();
virtual ~CPlaylist();
- void RemoveAll();
+ bool RemoveAll();
bool RemoveAt(POSITION pos);
void SortById(), SortByName(), SortByPath(), Randomize();
diff --git a/src/apps/mplayerc/PnSPresetsDlg.cpp b/src/apps/mplayerc/PnSPresetsDlg.cpp
index 17ee7423e..4d2429514 100644
--- a/src/apps/mplayerc/PnSPresetsDlg.cpp
+++ b/src/apps/mplayerc/PnSPresetsDlg.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -54,14 +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();
}
@@ -76,16 +76,16 @@ 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 {
float f = 0;
- if(_stscanf_s(token, _T("%f"), &f) != 1) {
+ if (_stscanf_s(token, _T("%f"), &f) != 1) {
continue;
}
- switch(j) {
+ switch (j) {
case 1:
PosX = f;
break;
@@ -131,7 +131,7 @@ 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;
@@ -160,7 +160,7 @@ void CPnSPresetsDlg::OnUpdateButton2(CCmdUI* pCmdUI)
{
CString str;
int len = m_list.GetCount();
- if(len > 0) {
+ if (len > 0) {
m_list.GetText(len-1, str);
}
pCmdUI->Enable(str != _T("New"));
@@ -171,7 +171,7 @@ void CPnSPresetsDlg::OnBnClickedButton6() // del
int i = m_list.GetCurSel();
m_list.DeleteString(i);
m_pnspresets.RemoveAt(i);
- if(i == m_list.GetCount()) {
+ if (i == m_list.GetCount()) {
i--;
}
m_list.SetCurSel(i);
@@ -225,7 +225,7 @@ void CPnSPresetsDlg::OnBnClickedButton1() // set
{
int i = m_list.GetCurSel();
UpdateData();
- /*if(m_label.Remove(',') > 0)
+ /*if (m_label.Remove(',') > 0)
UpdateData(FALSE);*/
m_label.Replace(',', '.'); // Replace any ',' with '.' as ',' is used as tokeniser
m_pnspresets[i] = ParamsToString(m_label, m_PosX, m_PosY, m_ZoomX, m_ZoomY);
@@ -247,7 +247,7 @@ void CPnSPresetsDlg::OnUpdateButton1(CCmdUI* pCmdUI)
void CPnSPresetsDlg::OnOK()
{
- if(m_list.GetCurSel() >= 0) {
+ if (m_list.GetCurSel() >= 0) {
OnBnClickedButton1();
}
diff --git a/src/apps/mplayerc/QuicktimeGraph.cpp b/src/apps/mplayerc/QuicktimeGraph.cpp
index fbe7ce673..eb7472f37 100644
--- a/src/apps/mplayerc/QuicktimeGraph.cpp
+++ b/src/apps/mplayerc/QuicktimeGraph.cpp
@@ -50,35 +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;
}
@@ -89,7 +89,7 @@ CQuicktimeGraph::~CQuicktimeGraph()
m_wndDestFrame.DestroyWindow();
m_wndWindowFrame.DestroyWindow();
- if(m_fQtInitialized) {
+ if (m_fQtInitialized) {
ExitMovies();
TerminateQTML();
}
@@ -110,17 +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;
@@ -162,12 +162,12 @@ STDMETHODIMP CQuicktimeGraph::GetDuration(LONGLONG* pDuration)
*pDuration = 0;
- if(!m_wndDestFrame.theMovie) {
+ if (!m_wndDestFrame.theMovie) {
return E_UNEXPECTED;
}
TimeScale ts = GetMovieTimeScale(m_wndDestFrame.theMovie);
- if(ts == 0) {
+ if (ts == 0) {
return E_FAIL;
}
@@ -181,12 +181,12 @@ STDMETHODIMP CQuicktimeGraph::GetCurrentPosition(LONGLONG* pCurrent)
*pCurrent = 0;
- if(!m_wndDestFrame.theMovie) {
+ if (!m_wndDestFrame.theMovie) {
return E_UNEXPECTED;
}
TimeScale ts = GetMovieTimeScale(m_wndDestFrame.theMovie);
- if(ts == 0) {
+ if (ts == 0) {
return E_FAIL;
}
@@ -199,22 +199,22 @@ STDMETHODIMP CQuicktimeGraph::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFl
{
CheckPointer(pCurrent, E_POINTER);
- if(!(dwCurrentFlags&AM_SEEKING_AbsolutePositioning)) {
+ if (!(dwCurrentFlags&AM_SEEKING_AbsolutePositioning)) {
return E_INVALIDARG;
}
- if(!m_wndDestFrame.theMovie) {
+ if (!m_wndDestFrame.theMovie) {
return E_UNEXPECTED;
}
TimeScale ts = GetMovieTimeScale(m_wndDestFrame.theMovie);
- if(ts == 0) {
+ 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);
}
@@ -235,7 +235,7 @@ 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);
}
@@ -245,10 +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);
}
@@ -258,7 +258,7 @@ STDMETHODIMP CQuicktimeGraph::SetDestinationPosition(long Left, long Top, long W
}
STDMETHODIMP CQuicktimeGraph::GetVideoSize(long* pWidth, long* pHeight)
{
- if(!pWidth || !pHeight) {
+ if (!pWidth || !pHeight) {
return E_POINTER;
}
@@ -271,7 +271,7 @@ STDMETHODIMP CQuicktimeGraph::GetVideoSize(long* pWidth, long* pHeight)
// IBasicAudio
STDMETHODIMP CQuicktimeGraph::put_Volume(long lVolume)
{
- if(m_wndDestFrame.theMovie) {
+ if (m_wndDestFrame.theMovie) {
short volume = (lVolume <= -10000) ? 0 : (short)(pow(10.0, lVolume/4000.0)*256);
volume = max(min(volume, 256), 0);
SetMovieVolume(m_wndDestFrame.theMovie, volume);
@@ -284,7 +284,7 @@ STDMETHODIMP CQuicktimeGraph::get_Volume(long* plVolume)
{
CheckPointer(plVolume, E_POINTER);
- if(m_wndDestFrame.theMovie) {
+ if (m_wndDestFrame.theMovie) {
*plVolume = (long)GetMovieVolume(m_wndDestFrame.theMovie);
*plVolume = (long)(4000*log10(*plVolume/256.0f));
*plVolume = max(min(*plVolume, 0), -10000);
@@ -297,13 +297,13 @@ STDMETHODIMP CQuicktimeGraph::get_Volume(long* plVolume)
// IVideoFrameStep
STDMETHODIMP CQuicktimeGraph::Step(DWORD dwFrames, IUnknown* pStepObject)
{
- if(pStepObject) {
+ if (pStepObject) {
return E_INVALIDARG;
}
- if(dwFrames == 0) {
+ if (dwFrames == 0) {
return S_OK;
}
- if(!m_wndDestFrame.theMovie) {
+ if (!m_wndDestFrame.theMovie) {
return E_UNEXPECTED;
}
@@ -313,23 +313,23 @@ 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) {
+ 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) {
+ 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) {
+ if (GetMoviesError() != noErr) {
return E_FAIL;
}
MoviesTask(m_wndDestFrame.theMovie, 0L);
@@ -379,7 +379,7 @@ CQuicktimeWindow::CQuicktimeWindow(CQuicktimeGraph* pGraph)
void CQuicktimeWindow::ProcessMovieEvent(unsigned int message, unsigned int wParam, long lParam)
{
- if(message >= WM_MOUSEFIRST && message <= WM_MOUSELAST
+ if (message >= WM_MOUSEFIRST && message <= WM_MOUSELAST
|| message >= WM_KEYFIRST && message <= WM_KEYLAST) {
return;
}
@@ -406,7 +406,7 @@ 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;
@@ -419,16 +419,16 @@ LRESULT CQuicktimeWindow::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
OSErr CQuicktimeWindow::MyMovieDrawingCompleteProc(Movie theMovie, long refCon)
{
CQuicktimeWindow* pQW = (CQuicktimeWindow*)refCon;
- if(!pQW) {
+ if (!pQW) {
return noErr;
}
CQuicktimeGraph* pGraph = pQW->m_pGraph;
- if(!pGraph) {
+ 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;
@@ -449,16 +449,16 @@ 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);
}
@@ -468,11 +468,11 @@ bool CQuicktimeWindow::OpenMovie(CString fn)
DisposeHandle(myHandle);
- if(err != noErr) {
+ if (err != noErr) {
return(false);
}
} else {
- if(!(fn.GetLength() > 0 && fn.GetLength() < 255)) {
+ if (!(fn.GetLength() > 0 && fn.GetLength() < 255)) {
return(false);
}
@@ -491,11 +491,11 @@ 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) {
+ if (err != noErr) {
return(false);
}
}
@@ -509,14 +509,14 @@ 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);
@@ -560,16 +560,16 @@ bool CQuicktimeWindow::OpenMovie(CString fn)
void CQuicktimeWindow::CloseMovie()
{
- if(theMC) {
+ if (theMC) {
DisposeMovieController(theMC), theMC = NULL;
}
- if(theMovie) {
+ if (theMovie) {
DisposeMovie(theMovie), theMovie = NULL;
}
m_size.SetSize(0, 0);
m_fs = State_Stopped;
- if(m_offscreenGWorld) {
+ if (m_offscreenGWorld) {
DisposeGWorld(m_offscreenGWorld), m_offscreenGWorld = NULL;
}
m_dc.DeleteDC();
@@ -578,9 +578,9 @@ void CQuicktimeWindow::CloseMovie()
void CQuicktimeWindow::Run()
{
- if(theMovie) {
+ if (theMovie) {
StartMovie(theMovie);
- if(!m_idEndPoller) {
+ if (!m_idEndPoller) {
m_idEndPoller = SetTimer(1, 10, NULL); // 10ms -> 100fps max
}
}
@@ -590,9 +590,9 @@ void CQuicktimeWindow::Run()
void CQuicktimeWindow::Pause()
{
- if(theMovie) {
+ if (theMovie) {
StopMovie(theMovie);
- if(m_idEndPoller) {
+ if (m_idEndPoller) {
KillTimer(m_idEndPoller), m_idEndPoller = 0;
}
}
@@ -602,10 +602,10 @@ void CQuicktimeWindow::Pause()
void CQuicktimeWindow::Stop()
{
- if(theMovie) {
+ if (theMovie) {
StopMovie(theMovie);
GoToBeginningOfMovie(theMovie);
- if(m_idEndPoller) {
+ if (m_idEndPoller) {
KillTimer(m_idEndPoller), m_idEndPoller = 0;
}
}
@@ -627,13 +627,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);
}
@@ -650,10 +650,10 @@ 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 (m_hWnd)
+ if (CGrafPtr windowPort = (CGrafPtr)GetHWNDPort(m_hWnd)) {
DestroyPortAssociation(windowPort);
}
}
@@ -666,11 +666,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/RealMediaGraph.cpp b/src/apps/mplayerc/RealMediaGraph.cpp
index 44ffdd302..46f939f21 100644
--- a/src/apps/mplayerc/RealMediaGraph.cpp
+++ b/src/apps/mplayerc/RealMediaGraph.cpp
@@ -62,20 +62,20 @@ 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);
}
@@ -83,19 +83,19 @@ bool CRealMediaPlayer::Init()
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)
+ if (ERROR_SUCCESS != key2.Open(HKEY_CLASSES_ROOT, prefs + _T("\\") + buff, KEY_READ)
|| ERROR_SUCCESS != key2.QueryStringValue(NULL, buff2, &len2)) {
continue;
}
@@ -105,11 +105,11 @@ bool CRealMediaPlayer::Init()
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] == '|') {
+ for (int i = 0, j = strlen(s); i < j; i++) {
+ if (s[i] == '|') {
s[i] = '\0';
}
}
@@ -118,15 +118,15 @@ bool CRealMediaPlayer::Init()
}
}
- 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);
}
@@ -138,26 +138,26 @@ bool CRealMediaPlayer::Init()
// 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) {
+ 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) {
+ 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
/*
- if(CComQIPtr<IRMAPreferences, &IID_IRMAPreferences> pPrefs = m_pPlayer)
+ if (CComQIPtr<IRMAPreferences, &IID_IRMAPreferences> pPrefs = m_pPlayer)
{
CComPtr<IRMABuffer> pBuffer;
HRESULT hr = pPrefs->ReadPref("HTTPProxyHost", *&pBuffer);
@@ -187,11 +187,11 @@ bool CRealMediaPlayer::Init()
void CRealMediaPlayer::Deinit()
{
- if(m_pPlayer) {
+ if (m_pPlayer) {
m_pPlayer->Stop();
CComQIPtr<IRMAErrorSinkControl, &IID_IRMAErrorSinkControl> pErrorSinkControl = m_pPlayer;
- if(pErrorSinkControl) {
+ if (pErrorSinkControl) {
pErrorSinkControl->RemoveErrorSink(static_cast<IRMAErrorSink*>(this));
}
@@ -209,12 +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;
}
@@ -238,7 +238,7 @@ 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) {
strcpy(errmsg, msg);
@@ -252,16 +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");
}
@@ -306,7 +306,7 @@ 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;
@@ -336,7 +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;
@@ -348,29 +348,29 @@ STDMETHODIMP CRealMediaPlayer::HandleAuthenticationRequest(IRMAAuthenticationMan
// IRMASiteSupplier
STDMETHODIMP CRealMediaPlayer::SitesNeeded(UINT32 uRequestID, IRMAValues* pProps)
{
- if(!pProps) {
+ if (!pProps) {
return PNR_INVALID_PARAMETER;
}
- if(m_pTheSite || m_pTheSite2 || !m_hWndParent) {
+ 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;
}
@@ -378,12 +378,12 @@ STDMETHODIMP CRealMediaPlayer::SitesNeeded(UINT32 uRequestID, IRMAValues* pProps
// 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 {
hr = pProps->GetPropertyCString("name", pValue);
- if(PNR_OK == hr) {
+ if (PNR_OK == hr) {
pSiteProps->SetPropertyCString("LayoutGroup", pValue);
pValue->Release();
}
@@ -392,7 +392,7 @@ 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;
}
@@ -404,7 +404,7 @@ 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;
}
@@ -427,7 +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;
}
@@ -442,7 +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;
@@ -468,13 +468,13 @@ STDMETHODIMP CRealMediaPlayer::OnInit(RMAAudioFormat* pFormat)
CRealMediaPlayerWindowed::CRealMediaPlayerWindowed(HWND hWndParent, CRealMediaGraph* pRMG)
: 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)) {
+ 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)) {
return;
}
- if(!m_wndDestFrame.Create(NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
- CRect(0, 0, 0, 0), &m_wndWindowFrame, 0, NULL)) {
+ if (!m_wndDestFrame.Create(NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
+ CRect(0, 0, 0, 0), &m_wndWindowFrame, 0, NULL)) {
return;
}
}
@@ -487,18 +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);
}
@@ -506,20 +506,20 @@ 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) {
+ if (!AfxGetAppSettings().fIntRealMedia) {
style |= WS_DISABLED;
}
- if(PNR_OK != pSiteWindowed->Create(m_wndDestFrame.m_hWnd, style)) {
+ if (PNR_OK != pSiteWindowed->Create(m_wndDestFrame.m_hWnd, style)) {
return(false);
}
@@ -529,7 +529,7 @@ 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();
}
}
@@ -543,15 +543,15 @@ CRealMediaPlayerWindowless::CRealMediaPlayerWindowless(HWND hWndParent, CRealMed
AppSettings& s = AfxGetAppSettings();
bool bFullscreen = (AfxGetApp()->m_pMainWnd != NULL) && (((CMainFrame*)AfxGetApp()->m_pMainWnd)->IsD3DFullScreenMode());
- switch(s.iRMVideoRendererType) {
+ switch (s.iRMVideoRendererType) {
default:
case VIDRNDT_RM_DX7:
- if(FAILED(CreateAP7(CLSID_RM7AllocatorPresenter, hWndParent, &m_pRMAP))) {
+ if (FAILED(CreateAP7(CLSID_RM7AllocatorPresenter, hWndParent, &m_pRMAP))) {
return;
}
break;
case VIDRNDT_RM_DX9:
- if(FAILED(CreateAP9(CLSID_RM9AllocatorPresenter, hWndParent, bFullscreen, &m_pRMAP))) {
+ if (FAILED(CreateAP9(CLSID_RM9AllocatorPresenter, hWndParent, bFullscreen, &m_pRMAP))) {
return;
}
break;
@@ -573,7 +573,7 @@ STDMETHODIMP CRealMediaPlayerWindowless::NonDelegatingQueryInterface(REFIID riid
bool CRealMediaPlayerWindowless::CreateSite(IRMASite** ppSite)
{
- if(!ppSite || !m_pRMAP) {
+ if (!ppSite || !m_pRMAP) {
return(false);
}
@@ -583,7 +583,7 @@ 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);
}
@@ -599,7 +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;
@@ -622,12 +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;
@@ -638,7 +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;
@@ -663,7 +663,7 @@ STDMETHODIMP CRealMediaGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPla
WideCharToMultiByte(GetACP(), 0, lpcwstrFile, -1, buff, _MAX_PATH, 0, 0);
CStringA fn(buff);
- if(fn.Find("://") < 0) {
+ if (fn.Find("://") < 0) {
fn = "file://" + fn;
}
@@ -671,7 +671,7 @@ STDMETHODIMP CRealMediaGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPla
ClearMessageQueue();
- if(PNR_OK != m_pRMP->m_pPlayer->OpenURL(fn)) {
+ if (PNR_OK != m_pRMP->m_pPlayer->OpenURL(fn)) {
return E_FAIL;
}
@@ -683,7 +683,7 @@ 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);
}
@@ -723,7 +723,7 @@ 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)));
}
@@ -738,7 +738,7 @@ STDMETHODIMP CRealMediaGraph::SetDestinationPosition(long Left, long Top, long W
}
STDMETHODIMP CRealMediaGraph::GetVideoSize(long* pWidth, long* pHeight)
{
- if(!pWidth || !pHeight) {
+ if (!pWidth || !pHeight) {
return E_POINTER;
}
*pWidth = m_pRMP->GetVideoSize().cx;
@@ -749,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 : (UINT16)(pow(10.0, lVolume/4000.0)*100);
volume = max(min(volume, 100), 0);
@@ -758,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/RealMediaWindowlessSite.cpp b/src/apps/mplayerc/RealMediaWindowlessSite.cpp
index 7fe4085bb..14d6b38bc 100644
--- a/src/apps/mplayerc/RealMediaWindowlessSite.cpp
+++ b/src/apps/mplayerc/RealMediaWindowlessSite.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -49,12 +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;
@@ -94,7 +94,7 @@ BOOL DSObjects::RMAEqualRegion(REGION* reg1, REGION* reg2)
}
void DSObjects::RMADestroyRegion(REGION* reg)
{
- if(reg) DeleteObject((HRGN)reg->pOSRegion),
+ if (reg) DeleteObject((HRGN)reg->pOSRegion),
PN_VECTOR_DELETE(reg->rects);
PN_DELETE(reg);
}
@@ -123,7 +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;
}
@@ -134,7 +134,7 @@ CRealMediaWindowlessSite::CRealMediaWindowlessSite(HRESULT& hr, IUnknown* pConte
CRealMediaWindowlessSite::~CRealMediaWindowlessSite()
{
POSITION pos = m_pChildren.GetHeadPosition();
- while(pos) {
+ while (pos) {
DestroyChild(m_pChildren.GetNext(pos));
}
@@ -160,7 +160,7 @@ 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);
}
}
@@ -174,7 +174,7 @@ REGION* CRealMediaWindowlessSite::GetRegion()
void CRealMediaWindowlessSite::RecomputeRegion()
{
- if(m_pParentSite) {
+ if (m_pParentSite) {
m_pParentSite->RecomputeRegion();
} else {
InternalRecomputeRegion();
@@ -186,9 +186,9 @@ void CRealMediaWindowlessSite::InternalRecomputeRegion()
ComputeRegion();
POSITION pos = m_pChildren.GetHeadPosition();
- while(pos) {
+ while (pos) {
CRealMediaWindowlessSite* pSite = (CRealMediaWindowlessSite*)(IRMASite*)m_pChildren.GetNext(pos);
- if(pSite) {
+ if (pSite) {
pSite->InternalRecomputeRegion();
}
}
@@ -198,33 +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);
}
}
@@ -235,9 +235,9 @@ 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()) {
+ if (pChildSite->IsSiteVisible()) {
pChildSite->SubtractSite(m_pRegion);
}
}
@@ -246,7 +246,7 @@ void CRealMediaWindowlessSite::ComputeRegion()
m_pRegion = RMACreateRectRegion(0,0,0,0);
}
- if(pTempRegion && !RMAEqualRegion(m_pRegion, pTempRegion)) {
+ if (pTempRegion && !RMAEqualRegion(m_pRegion, pTempRegion)) {
ForceRedraw();
}
@@ -268,19 +268,19 @@ 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) {
+ if (lItsOldZOrder >= lNewZOrder && lItsOldZOrder < lOldZOrder) {
pSite->SetInternalZOrder(lItsOldZOrder+1);
}
}
@@ -313,15 +313,15 @@ STDMETHODIMP CRealMediaWindowlessSite::AttachUser(IRMASiteUser* /*IN*/ pUser)
{
HRESULT hr = PNR_FAIL;
- if(m_pUser) {
+ 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;
}
@@ -332,13 +332,13 @@ STDMETHODIMP CRealMediaWindowlessSite::DetachUser()
{
HRESULT hr = PNR_OK;
- if(!m_pUser) {
+ if (!m_pUser) {
return PNR_UNEXPECTED;
}
hr = m_pUser->DetachSite();
- if(PNR_OK == hr) {
+ if (PNR_OK == hr) {
m_pUser = NULL;
}
@@ -349,7 +349,7 @@ STDMETHODIMP CRealMediaWindowlessSite::GetUser(REF(IRMASiteUser*) /*OUT*/ pUser)
{
HRESULT hr = PNR_OK;
- if(!m_pUser) {
+ if (!m_pUser) {
return PNR_UNEXPECTED;
}
@@ -365,7 +365,7 @@ 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;
}
@@ -378,7 +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;
}
@@ -388,11 +388,11 @@ STDMETHODIMP CRealMediaWindowlessSite::DestroyChild(IRMASite* /*IN*/ pChildSite)
STDMETHODIMP CRealMediaWindowlessSite::AttachWatcher(IRMASiteWatcher* /*IN*/ pWatcher)
{
- if(m_pWatcher) {
+ if (m_pWatcher) {
return PNR_UNEXPECTED;
}
- if(m_pWatcher = pWatcher) {
+ if (m_pWatcher = pWatcher) {
m_pWatcher->AttachSite((IRMASite*)this);
}
@@ -401,7 +401,7 @@ STDMETHODIMP CRealMediaWindowlessSite::AttachWatcher(IRMASiteWatcher* /*IN*/ pWa
STDMETHODIMP CRealMediaWindowlessSite::DetachWatcher()
{
- if(!m_pWatcher) {
+ if (!m_pWatcher) {
return PNR_UNEXPECTED;
}
@@ -415,15 +415,15 @@ 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) {
+ while (pos) {
m_pPassiveWatchers.GetNext(pos)->PositionChanged(&position);
}
@@ -443,15 +443,15 @@ 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) {
+ while (pos) {
m_pPassiveWatchers.GetNext(pos)->SizeChanged(&size);
}
@@ -482,7 +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};
@@ -512,7 +512,7 @@ STDMETHODIMP CRealMediaWindowlessSite::ShowSite(BOOL bShow)
STDMETHODIMP_(BOOL) CRealMediaWindowlessSite::IsSiteVisible()
{
BOOL fIsVisible = m_fIsVisible;
- if(m_pParentSite) {
+ if (m_pParentSite) {
fIsVisible = fIsVisible && m_pParentSite->IsSiteVisible();
}
return fIsVisible;
@@ -520,15 +520,15 @@ STDMETHODIMP_(BOOL) CRealMediaWindowlessSite::IsSiteVisible()
STDMETHODIMP CRealMediaWindowlessSite::SetZOrder(INT32 lZOrder)
{
- if(!m_pParentSite) {
+ 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);
}
@@ -539,7 +539,7 @@ STDMETHODIMP CRealMediaWindowlessSite::SetZOrder(INT32 lZOrder)
STDMETHODIMP CRealMediaWindowlessSite::GetZOrder(REF(INT32) lZOrder)
{
- if(!m_pParentSite) {
+ if (!m_pParentSite) {
return PNR_UNEXPECTED;
}
lZOrder = m_lZOrder;
@@ -548,7 +548,7 @@ STDMETHODIMP CRealMediaWindowlessSite::GetZOrder(REF(INT32) lZOrder)
STDMETHODIMP CRealMediaWindowlessSite::MoveSiteToTop()
{
- if(!m_pParentSite) {
+ if (!m_pParentSite) {
return PNR_UNEXPECTED;
}
return PNR_NOTIMPL;
@@ -573,7 +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;
}
@@ -602,10 +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;
}
@@ -629,7 +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.
@@ -639,13 +639,13 @@ STDMETHODIMP CRealMediaWindowlessSite::BeginOptimizedBlt(RMABitmapInfoHeader* /*
/*
CComPtr<IRMAVideoSurface> pBltService;
GetBltService(&pBltService);
- if(!pBltService)
+ if (!pBltService)
return PNR_UNEXPECTED;
RMA_COMPRESSION_TYPE ulType = (RMA_COMPRESSION_TYPE)-1;
pBltService->GetPreferredFormat(ulType);
- if(pBitmapInfo->biCompression != ulType)
+ if (pBitmapInfo->biCompression != ulType)
return PNR_UNEXPECTED;
*/
return PNR_OK;
@@ -658,7 +658,7 @@ STDMETHODIMP CRealMediaWindowlessSite::OptimizedBlt(UCHAR* /*IN*/ pImageBits, RE
REGION* pRegion = GetRegion();
- if(!pBltService || !pRegion) {
+ if (!pBltService || !pRegion) {
return PNR_UNEXPECTED;
}
@@ -671,7 +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
@@ -711,7 +711,7 @@ STDMETHODIMP CRealMediaWindowlessSite::GetPreferredFormat(REF(RMA_COMPRESSION_TY
{
CComPtr<IRMAVideoSurface> pBltService;
GetBltService(&pBltService);
- if(!pBltService) {
+ if (!pBltService) {
return PNR_UNEXPECTED;
}
diff --git a/src/apps/mplayerc/RegFilterChooserDlg.cpp b/src/apps/mplayerc/RegFilterChooserDlg.cpp
index d99fb16a3..ae55f3034 100644
--- a/src/apps/mplayerc/RegFilterChooserDlg.cpp
+++ b/src/apps/mplayerc/RegFilterChooserDlg.cpp
@@ -40,7 +40,7 @@ CRegFilterChooserDlg::CRegFilterChooserDlg(CWnd* pParent /*=NULL*/)
CRegFilterChooserDlg::~CRegFilterChooserDlg()
{
POSITION pos = m_filters.GetHeadPosition();
- while(pos) {
+ while (pos) {
delete m_filters.GetNext(pos);
}
}
@@ -54,9 +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));
@@ -122,13 +122,13 @@ void CRegFilterChooserDlg::OnBnClickedOk()
CComPtr<IMoniker> pMoniker;
POSITION pos = m_list.GetFirstSelectedItemPosition();
- if(pos) {
+ if (pos) {
pos = (POSITION)m_list.GetItemData(m_list.GetNextSelectedItem(pos));
}
- if(pos) {
+ if (pos) {
pMoniker = m_monikers.GetAt(pos);
}
- if(pMoniker) {
+ if (pMoniker) {
CFGFilterRegistry fgf(pMoniker);
FilterOverride* f = DNew FilterOverride;
f->fDisabled = false;
@@ -151,7 +151,7 @@ void CRegFilterChooserDlg::OnBnClickedButton1()
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_NOCHANGEDIR,
_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);
@@ -163,7 +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/SaveDlg.cpp b/src/apps/mplayerc/SaveDlg.cpp
index 5d59e0d36..a3c6f0a1d 100644
--- a/src/apps/mplayerc/SaveDlg.cpp
+++ b/src/apps/mplayerc/SaveDlg.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -68,10 +68,10 @@ BOOL CSaveDlg::OnInitDialog()
m_anim.Play(0, (UINT)-1, (UINT)-1);
CString str, in = m_in, out = m_out;
- if(in.GetLength() > 60) {
+ if (in.GetLength() > 60) {
in = in.Left(17) + _T("..") + in.Right(43);
}
- if(out.GetLength() > 60) {
+ if (out.GetLength() > 60) {
out = out.Left(17) + _T("..") + out.Right(43);
}
str.Format(_T("%s\r\n%s"), in, out);
@@ -79,7 +79,7 @@ BOOL CSaveDlg::OnInitDialog()
m_progress.SetRange(0, 100);
- if(FAILED(pGB.CoCreateInstance(CLSID_FilterGraph)) || !(pMC = pGB) || !(pME = pGB) || !(pMS = pGB)
+ if (FAILED(pGB.CoCreateInstance(CLSID_FilterGraph)) || !(pMC = pGB) || !(pME = pGB) || !(pMS = pGB)
|| FAILED(pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0))) {
m_report.SetWindowText(_T("Error"));
return FALSE;
@@ -91,30 +91,30 @@ 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 {
CPath pout(m_out);
@@ -124,22 +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);
}
@@ -147,13 +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;
}
@@ -163,7 +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;
}
@@ -171,7 +171,7 @@ BOOL CSaveDlg::OnInitDialog()
hr = pGB->Connect(
GetFirstPin((pSrc), PINDIR_OUTPUT),
GetFirstPin((pMid), PINDIR_INPUT));
-
+
if (FAILED(hr)) {
m_report.SetWindowText(_T("Error Connect pSrc / pMid"));
return FALSE;
@@ -197,7 +197,7 @@ BOOL CSaveDlg::OnInitDialog()
void CSaveDlg::OnBnClickedCancel()
{
- if(pMC) {
+ if (pMC) {
pMC->Stop();
}
@@ -207,13 +207,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!"));
}
@@ -224,8 +224,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/SaveTextFileDialog.cpp b/src/apps/mplayerc/SaveTextFileDialog.cpp
index 8faafe0f5..bb97d31cf 100644
--- a/src/apps/mplayerc/SaveTextFileDialog.cpp
+++ b/src/apps/mplayerc/SaveTextFileDialog.cpp
@@ -38,9 +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);
}
}
@@ -64,7 +64,7 @@ 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) {
+ switch (m_e) {
default:
case CTextFile::ASCII:
m_encoding.SetCurSel(0);
diff --git a/src/apps/mplayerc/SaveThumbnailsDialog.cpp b/src/apps/mplayerc/SaveThumbnailsDialog.cpp
index ded2ffe6a..81156e59b 100644
--- a/src/apps/mplayerc/SaveThumbnailsDialog.cpp
+++ b/src/apps/mplayerc/SaveThumbnailsDialog.cpp
@@ -38,9 +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 fe4de822c..c585f9199 100644
--- a/src/apps/mplayerc/SelectMediaType.cpp
+++ b/src/apps/mplayerc/SelectMediaType.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -61,7 +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]));
}
@@ -73,7 +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/ShaderAutoCompleteDlg.cpp b/src/apps/mplayerc/ShaderAutoCompleteDlg.cpp
index b0b9eb9e9..ea977957c 100644
--- a/src/apps/mplayerc/ShaderAutoCompleteDlg.cpp
+++ b/src/apps/mplayerc/ShaderAutoCompleteDlg.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -170,16 +170,16 @@ void CShaderAutoCompleteDlg::OnLbnSelchangeList1()
::SendMessage(m_hToolTipWnd, TTM_TRACKACTIVATE, FALSE, (LPARAM)&m_ti);
int i = m_list.GetCurSel();
- if(i < 0) {
+ 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) {
+ if (sl.GetCount() != 2) {
return;
}
_tcscpy(m_ti.lpszText, sl.RemoveTail());
@@ -195,7 +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/ShaderCombineDlg.cpp b/src/apps/mplayerc/ShaderCombineDlg.cpp
index 550c5379d..15322f9c2 100644
--- a/src/apps/mplayerc/ShaderCombineDlg.cpp
+++ b/src/apps/mplayerc/ShaderCombineDlg.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -78,20 +78,20 @@ BOOL CShaderCombineDlg::OnInitDialog()
}
CAtlList<CString> sl;
- if(!str.IsEmpty()) {
+ if (!str.IsEmpty()) {
Explode(str, sl, '|');
}
POSITION pos = sl.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_list.AddString(sl.GetNext(pos));
}
pos = s.m_shaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_combo.AddString(s.m_shaders.GetNext(pos).label);
}
- if(m_combo.GetCount()) {
+ if (m_combo.GetCount()) {
m_combo.SetCurSel(0);
}
@@ -105,7 +105,7 @@ 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);
@@ -124,7 +124,7 @@ void CShaderCombineDlg::OnOK()
void CShaderCombineDlg::OnBnClickedButton12()
{
int i = m_combo.GetCurSel();
- if(i < 0) {
+ if (i < 0) {
return;
}
@@ -136,15 +136,15 @@ void CShaderCombineDlg::OnBnClickedButton12()
void CShaderCombineDlg::OnBnClickedButton13()
{
int i = m_list.GetCurSel();
- if(i < 0) {
+ if (i < 0) {
return;
}
m_list.DeleteString(i);
- if(i == m_list.GetCount()) {
+ if (i == m_list.GetCount()) {
i--;
}
- if(i >= 0) {
+ if (i >= 0) {
m_list.SetCurSel(i);
}
}
@@ -152,7 +152,7 @@ void CShaderCombineDlg::OnBnClickedButton13()
void CShaderCombineDlg::OnBnClickedButton1()
{
int i = m_list.GetCurSel();
- if(i < 1) {
+ if (i < 1) {
return;
}
@@ -167,14 +167,14 @@ void CShaderCombineDlg::OnBnClickedButton1()
void CShaderCombineDlg::OnBnClickedButton11()
{
int i = m_list.GetCurSel();
- if(i < 0 || i >= m_list.GetCount()-1) {
+ 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()) {
+ if (++i == m_list.GetCount()) {
m_list.AddString(label);
} else {
m_list.InsertString(i, label);
diff --git a/src/apps/mplayerc/ShaderEditorDlg.cpp b/src/apps/mplayerc/ShaderEditorDlg.cpp
index d1111e0ef..56e6be8cb 100644
--- a/src/apps/mplayerc/ShaderEditorDlg.cpp
+++ b/src/apps/mplayerc/ShaderEditorDlg.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -39,8 +39,8 @@ 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());
}
}
@@ -50,7 +50,7 @@ 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();
}
@@ -74,18 +74,18 @@ CShaderEdit::~CShaderEdit()
BOOL CShaderEdit::PreTranslateMessage(MSG* pMsg)
{
- if(m_acdlg.IsWindowVisible()
+ if (m_acdlg.IsWindowVisible()
&& 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)) {
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) {
+ if (i > 0) {
str = str.Left(i);
}
@@ -94,13 +94,13 @@ BOOL CShaderEdit::PreTranslateMessage(MSG* pMsg)
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 {
@@ -121,7 +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);
}
@@ -129,14 +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();
@@ -145,14 +145,14 @@ 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) {
+ if (sl.GetCount() != 2) {
continue;
}
CString name = sl.RemoveHead();
@@ -162,7 +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);
@@ -195,10 +195,10 @@ 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);
}
}
@@ -223,7 +223,7 @@ CShaderEditorDlg::~CShaderEditorDlg()
BOOL CShaderEditorDlg::Create(CWnd* pParent)
{
- if(!__super::Create(IDD, pParent)) {
+ if (!__super::Create(IDD, pParent)) {
return FALSE;
}
@@ -244,7 +244,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);
}
@@ -292,20 +292,20 @@ END_MESSAGE_MAP()
BOOL CShaderEditorDlg::PreTranslateMessage(MSG* pMsg)
{
- if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN
+ if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN
&& 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) {
+ 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);
}
@@ -316,12 +316,12 @@ 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()) {
+ if (label.IsEmpty()) {
return;
}
@@ -353,22 +353,22 @@ void CShaderEditorDlg::OnCbnSelchangeCombo1()
void CShaderEditorDlg::OnBnClickedButton2()
{
- if(!m_pShader) {
+ 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) {
+ if (i >= 0) {
m_labels.DeleteString(i);
}
m_labels.SetWindowText(_T(""));
@@ -383,7 +383,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(""));
@@ -393,20 +393,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) {
+ 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;
@@ -429,7 +429,7 @@ void CShaderEditorDlg::OnTimer(UINT_PTR nIDEvent)
void CShaderEditorDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
- if(HitTestSplitter(point)) {
+ if (HitTestSplitter(point)) {
m_fSplitterGrabbed = true;
SetCapture();
}
@@ -439,7 +439,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;
}
@@ -449,7 +449,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);
@@ -481,7 +481,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/ShockwaveGraph.cpp b/src/apps/mplayerc/ShockwaveGraph.cpp
index d7467dbcc..e2e491765 100644
--- a/src/apps/mplayerc/ShockwaveGraph.cpp
+++ b/src/apps/mplayerc/ShockwaveGraph.cpp
@@ -33,14 +33,14 @@ 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)) {
+ if (!m_wndWindowFrame.Create(NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
+ 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)) {
+ if (!m_wndDestFrame.Create(NULL, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,
+ CRect(0, 0, 0, 0), &m_wndWindowFrame, 0)) {
hr = E_FAIL;
return;
}
@@ -73,7 +73,7 @@ STDMETHODIMP CShockwaveGraph::Run()
// or is the variable unused?
/*long scale_mode = */this->m_wndDestFrame.get_ScaleMode();
- if(m_fs != State_Running) {
+ if (m_fs != State_Running) {
m_wndDestFrame.Play();
}
} catch(CException* e) {
@@ -88,7 +88,7 @@ STDMETHODIMP CShockwaveGraph::Run()
STDMETHODIMP CShockwaveGraph::Pause()
{
try {
- if(m_fs == State_Running) {
+ if (m_fs == State_Running) {
m_wndDestFrame.Stop();
}
} catch(CException* e) {
@@ -114,9 +114,9 @@ STDMETHODIMP CShockwaveGraph::GetState(LONG msTimeout, OAFilterState* pfs)
OAFilterState fs = m_fs;
try {
- if(m_wndDestFrame.IsPlaying() && m_fs == State_Stopped) {
+ if (m_wndDestFrame.IsPlaying() && m_fs == State_Stopped) {
m_fs = State_Running;
- } else if(!m_wndDestFrame.IsPlaying() && m_fs == State_Running) {
+ } else if (!m_wndDestFrame.IsPlaying() && m_fs == State_Running) {
m_fs = State_Stopped;
}
fs = m_fs;
@@ -144,7 +144,7 @@ STDMETHODIMP CShockwaveGraph::GetDuration(LONGLONG* pDuration)
CheckPointer(pDuration, E_POINTER);
*pDuration = 0;
try {
- if(m_wndDestFrame.get_ReadyState() >= READYSTATE_COMPLETE) {
+ if (m_wndDestFrame.get_ReadyState() >= READYSTATE_COMPLETE) {
*pDuration = m_wndDestFrame.get_TotalFrames();
}
} catch(CException* e) {
@@ -158,7 +158,7 @@ STDMETHODIMP CShockwaveGraph::GetCurrentPosition(LONGLONG* pCurrent)
CheckPointer(pCurrent, E_POINTER);
*pCurrent = 0;
try {
- if(m_wndDestFrame.get_ReadyState() >= READYSTATE_COMPLETE) {
+ if (m_wndDestFrame.get_ReadyState() >= READYSTATE_COMPLETE) {
*pCurrent = m_wndDestFrame.get_FrameNum();
}
} catch(CException* e) {
@@ -169,12 +169,12 @@ 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();
}
@@ -189,7 +189,7 @@ 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;
@@ -200,7 +200,7 @@ 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);
}
@@ -210,7 +210,7 @@ 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);
}
@@ -218,13 +218,13 @@ STDMETHODIMP CShockwaveGraph::SetDestinationPosition(long Left, long Top, long W
}
STDMETHODIMP CShockwaveGraph::GetVideoSize(long* pWidth, long* pHeight)
{
- if(!pWidth || !pHeight) {
+ 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 {
diff --git a/src/apps/mplayerc/StatusLabel.cpp b/src/apps/mplayerc/StatusLabel.cpp
index 2129107af..90c3d5bb6 100644
--- a/src/apps/mplayerc/StatusLabel.cpp
+++ b/src/apps/mplayerc/StatusLabel.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -39,11 +39,11 @@ CStatusLabel::CStatusLabel(bool fRightAlign, bool fAddEllipses)
m_font.m_hObject = NULL;
- if(!(::GetVersion()&0x80000000))
+ if (!(::GetVersion()&0x80000000))
m_font.CreateFont(int(14.0 * scale), 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE,
_T("Microsoft Sans Serif"));
- if(!m_font.m_hObject)
+ if (!m_font.m_hObject)
m_font.CreateFont(int(14.0 * scale), 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE,
_T("MS Sans Serif"));
@@ -73,8 +73,8 @@ void CStatusLabel::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
CSize size = dc.GetTextExtent(str);
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) {
+ if (m_fAddEllipses)
+ 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/SubtitleDlDlg.cpp b/src/apps/mplayerc/SubtitleDlDlg.cpp
index 576c34db7..0b9b08b6d 100644
--- a/src/apps/mplayerc/SubtitleDlDlg.cpp
+++ b/src/apps/mplayerc/SubtitleDlDlg.cpp
@@ -32,15 +32,14 @@
//IMPLEMENT_DYNAMIC(CSubtitleDlDlg, CResizableDialog)
CSubtitleDlDlg::CSubtitleDlDlg(CList<isdb_movie>& movies, CWnd* pParent /*=NULL*/)
: CResizableDialog(CSubtitleDlDlg::IDD, pParent),
- iColumn(-1),
- bSortDirection(false)
+ iColumn(-1),
+ bSortDirection(false)
{
m_movies.AddTail(&movies);
// Parse
POSITION pos = m_movies.GetHeadPosition();
- while (pos)
- {
+ while (pos) {
isdb_movie& m = m_movies.GetNext(pos);
isdb_movie_Parsed p;
@@ -110,8 +109,7 @@ BOOL CSubtitleDlDlg::OnInitDialog()
void CSubtitleDlDlg::OnOK()
{
- for (int i = 0; i < m_list.GetItemCount(); ++i)
- {
+ for (int i = 0; i < m_list.GetItemCount(); ++i) {
if (m_list.GetCheck(i)) {
m_selsubs.AddTail(*(isdb_subtitle*)m_list.GetItemData(i));
}
@@ -137,14 +135,11 @@ void CSubtitleDlDlg::OnHdnItemclickList1(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMHEADER phdr = reinterpret_cast<LPNMHEADER>(pNMHDR);
*pResult = 0;
-
- if ( phdr->iItem != iColumn )
- {
+
+ if ( phdr->iItem != iColumn ) {
iColumn = phdr->iItem;
bSortDirection = false;
- }
- else
- {
+ } else {
bSortDirection = !bSortDirection;
}
@@ -153,8 +148,7 @@ void CSubtitleDlDlg::OnHdnItemclickList1(NMHDR *pNMHDR, LRESULT *pResult)
void CSubtitleDlDlg::BuildList( void )
{
- for (INT_PTR i = 0; i < m_moviesParsed.GetCount(); ++i)
- {
+ for (INT_PTR i = 0; i < m_moviesParsed.GetCount(); ++i) {
isdb_movie_Parsed& m = m_moviesParsed[i];
int iItem = m_list.InsertItem(i, _T(""));
@@ -171,34 +165,32 @@ void CSubtitleDlDlg::BuildList( void )
struct sort_cmp {
sort_cmp(int col, bool dir) : iColumn(col), bSortDirection(dir) {}
- bool operator()(const CSubtitleDlDlg::isdb_movie_Parsed& a, const CSubtitleDlDlg::isdb_movie_Parsed& b) const
- {
+ bool operator()(const CSubtitleDlDlg::isdb_movie_Parsed& a, const CSubtitleDlDlg::isdb_movie_Parsed& b) const {
bool result = false;
// Should this macro be a function instead ?
- #define dir_cmp(l, r) bSortDirection ? (r) < (l) : (l) < (r)
-
- switch (iColumn)
- {
- case CSubtitleDlDlg::COL_FILENAME:
- result = dir_cmp(a.name, b.name);
- break;
- case CSubtitleDlDlg::COL_LANGUAGE:
- result = dir_cmp(a.language, b.language);
- break;
- case CSubtitleDlDlg::COL_FORMAT:
- result = dir_cmp(a.format, b.format);
- break;
- case CSubtitleDlDlg::COL_DISC:
- result = dir_cmp(a.disc, b.disc);
- break;
- case CSubtitleDlDlg::COL_TITLES:
- result = dir_cmp(a.titles, b.titles);
- break;
+#define dir_cmp(l, r) bSortDirection ? (r) < (l) : (l) < (r)
+
+ switch (iColumn) {
+ case CSubtitleDlDlg::COL_FILENAME:
+ result = dir_cmp(a.name, b.name);
+ break;
+ case CSubtitleDlDlg::COL_LANGUAGE:
+ result = dir_cmp(a.language, b.language);
+ break;
+ case CSubtitleDlDlg::COL_FORMAT:
+ result = dir_cmp(a.format, b.format);
+ break;
+ case CSubtitleDlDlg::COL_DISC:
+ result = dir_cmp(a.disc, b.disc);
+ break;
+ case CSubtitleDlDlg::COL_TITLES:
+ result = dir_cmp(a.titles, b.titles);
+ break;
}
-
- #undef dir_cmp
-
+
+#undef dir_cmp
+
return result;
}
@@ -209,8 +201,7 @@ struct sort_cmp {
void CSubtitleDlDlg::SortList( void )
{
// Save checked state
- for (INT_PTR i = 0; i < m_moviesParsed.GetCount(); ++i)
- {
+ for (INT_PTR i = 0; i < m_moviesParsed.GetCount(); ++i) {
m_moviesParsed[i].checked = m_list.GetCheck(i);
}
diff --git a/src/apps/mplayerc/TextPassThruFilter.cpp b/src/apps/mplayerc/TextPassThruFilter.cpp
index b9ef84e86..e4c68d686 100644
--- a/src/apps/mplayerc/TextPassThruFilter.cpp
+++ b/src/apps/mplayerc/TextPassThruFilter.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -42,8 +42,8 @@ class CTextPassThruInputPin : public CSubtitleInputPin
protected:
void AddSubStream(ISubStream* pSubStream) {
- if(m_pSubStreamOld) {
- if(pSubStream) {
+ if (m_pSubStreamOld) {
+ if (pSubStream) {
m_pTPTFilter->m_pMainFrame->ReplaceSubtitle(m_pSubStreamOld, pSubStream);
}
m_pSubStreamOld = NULL;
@@ -99,7 +99,7 @@ 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)) {
+ if (FAILED(hr)) {
return hr;
}
return m_pTPTFilter->m_pOutput->DeliverNewSegment(tStart, tStop, dRate);
@@ -108,7 +108,7 @@ STDMETHODIMP CTextPassThruInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_
STDMETHODIMP CTextPassThruInputPin::Receive(IMediaSample* pSample)
{
HRESULT hr = __super::Receive(pSample);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
return m_pTPTFilter->m_pOutput->Deliver(pSample);
@@ -117,7 +117,7 @@ STDMETHODIMP CTextPassThruInputPin::Receive(IMediaSample* pSample)
STDMETHODIMP CTextPassThruInputPin::EndOfStream()
{
HRESULT hr = __super::EndOfStream();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
return m_pTPTFilter->m_pOutput->DeliverEndOfStream();
@@ -126,7 +126,7 @@ STDMETHODIMP CTextPassThruInputPin::EndOfStream()
STDMETHODIMP CTextPassThruInputPin::BeginFlush()
{
HRESULT hr = __super::BeginFlush();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
return m_pTPTFilter->m_pOutput->DeliverBeginFlush();
@@ -135,7 +135,7 @@ STDMETHODIMP CTextPassThruInputPin::BeginFlush()
STDMETHODIMP CTextPassThruInputPin::EndFlush()
{
HRESULT hr = __super::EndFlush();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
return m_pTPTFilter->m_pOutput->DeliverEndFlush();
@@ -144,7 +144,7 @@ STDMETHODIMP CTextPassThruInputPin::EndFlush()
HRESULT CTextPassThruInputPin::CompleteConnect(IPin* pReceivePin)
{
HRESULT hr = __super::CompleteConnect(pReceivePin);
- if(FAILED(hr) || !m_pTPTFilter->m_pOutput->IsConnected()) {
+ if (FAILED(hr) || !m_pTPTFilter->m_pOutput->IsConnected()) {
return hr;
}
return m_pTPTFilter->ReconnectPin(m_pTPTFilter->m_pOutput, &m_mt);
@@ -168,13 +168,13 @@ 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) {
+ if (!pAllocatorIn) {
return E_UNEXPECTED;
}
@@ -182,7 +182,7 @@ HRESULT CTextPassThruOutputPin::DecideBufferSize(IMemAllocator* pAllocator, ALLO
HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
}
@@ -193,14 +193,14 @@ 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) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -232,8 +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;
}
@@ -249,9 +249,9 @@ int CTextPassThruFilter::GetPinCount()
CBasePin* CTextPassThruFilter::GetPin(int n)
{
- if(n == 0) {
+ if (n == 0) {
return m_pInput;
- } else if(n == 1) {
+ } else if (n == 1) {
return m_pOutput;
}
return NULL;
diff --git a/src/apps/mplayerc/VMROSD.cpp b/src/apps/mplayerc/VMROSD.cpp
index d33276fc0..581054008 100644
--- a/src/apps/mplayerc/VMROSD.cpp
+++ b/src/apps/mplayerc/VMROSD.cpp
@@ -131,7 +131,7 @@ void CVMROSD::UpdateBitmap()
m_MemDC.SetBkMode(TRANSPARENT);
}
- if(m_MainFont.GetSafeHandle()) {
+ if (m_MainFont.GetSafeHandle()) {
m_MemDC.SelectObject(m_MainFont);
}
@@ -171,13 +171,13 @@ void CVMROSD::Start (CWnd* pWnd, IMadVRTextOsd* pMVTO)
void CVMROSD::Stop()
{
- if(m_pVMB) {
+ if (m_pVMB) {
m_pVMB.Release();
}
- if(m_pMFVMB) {
+ if (m_pMFVMB) {
m_pMFVMB.Release();
}
- if(m_pMVTO) {
+ if (m_pMVTO) {
m_pMVTO.Release();
}
m_pWnd = NULL;
@@ -256,7 +256,7 @@ void CVMROSD::DrawMessage()
}
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;
}
@@ -272,7 +272,7 @@ void CVMROSD::DrawDebug()
pos = m_debugMessages.GetHeadPosition();
msg.Format(_T("%s"), m_debugMessages.GetNext(pos));
- while(pos) {
+ while (pos) {
tmp = m_debugMessages.GetNext(pos);
if ( !tmp.IsEmpty() ) {
msg.AppendFormat(_T("\r\n%s"), tmp);
@@ -415,7 +415,7 @@ void CVMROSD::TimerFunc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime)
KillTimer(hWnd, nIDEvent);
}
-void CVMROSD::ClearMessage()
+void CVMROSD::ClearMessage(bool hide)
{
CAutoLock Lock(&m_Lock);
if (m_bSeekBarVisible) {
@@ -424,7 +424,9 @@ void CVMROSD::ClearMessage()
if (m_pVMB) {
DWORD dwBackup = (m_VMR9AlphaBitmap.dwFlags | VMRBITMAP_DISABLE);
m_VMR9AlphaBitmap.dwFlags = VMRBITMAP_DISABLE;
- m_nMessagePos = OSD_NOMESSAGE;
+ if (!hide) {
+ m_nMessagePos = OSD_NOMESSAGE;
+ }
m_pVMB->SetAlphaBitmap(&m_VMR9AlphaBitmap);
m_VMR9AlphaBitmap.dwFlags = dwBackup;
} else if (m_pMFVMB) {
@@ -465,8 +467,8 @@ void CVMROSD::DisplayMessage (OSD_MESSAGEPOS nPos, LPCTSTR strMsg, int nDuration
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();
}
@@ -496,3 +498,14 @@ void CVMROSD::DebugMessage( LPCTSTR format, ... )
DisplayMessage(OSD_DEBUG, tmp);
}
+
+void CVMROSD::HideMessage(bool hide)
+{
+ if (m_pVMB || m_pMFVMB) {
+ if (hide) {
+ ClearMessage(true);
+ } else {
+ Invalidate();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/VMROSD.h b/src/apps/mplayerc/VMROSD.h
index 117e2d2d7..b8a5b9180 100644
--- a/src/apps/mplayerc/VMROSD.h
+++ b/src/apps/mplayerc/VMROSD.h
@@ -60,7 +60,8 @@ public:
void DisplayMessage (OSD_MESSAGEPOS nPos, LPCTSTR strMsg, int nDuration = 5000, int FontSize = 0, CString OSD_Font = _T(""));
void DebugMessage( LPCTSTR format, ... );
- void ClearMessage();
+ void ClearMessage(bool hide=false);
+ void HideMessage(bool hide);
__int64 GetPos() const;
void SetPos(__int64 pos);
diff --git a/src/apps/mplayerc/VolumeCtrl.cpp b/src/apps/mplayerc/VolumeCtrl.cpp
index 2a0580522..50545e1cb 100644
--- a/src/apps/mplayerc/VolumeCtrl.cpp
+++ b/src/apps/mplayerc/VolumeCtrl.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -39,7 +39,7 @@ 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);
}
@@ -84,14 +84,14 @@ void CVolumeCtrl::OnNMCustomdraw(NMHDR* pNMHDR, LRESULT* pResult)
LRESULT lr = CDRF_DODEFAULT;
- if(m_fSelfDrawn)
- switch(pNMCD->dwDrawStage) {
+ if (m_fSelfDrawn)
+ switch (pNMCD->dwDrawStage) {
case CDDS_PREPAINT:
lr = CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT:
- if(pNMCD->dwItemSpec == TBCD_CHANNEL) {
+ if (pNMCD->dwItemSpec == TBCD_CHANNEL) {
CDC dc;
dc.Attach(pNMCD->hdc);
@@ -111,7 +111,7 @@ void CVolumeCtrl::OnNMCustomdraw(NMHDR* pNMHDR, LRESULT* pResult)
dc.Detach();
lr = CDRF_SKIPDEFAULT;
- } else if(pNMCD->dwItemSpec == TBCD_THUMB) {
+ } else if (pNMCD->dwItemSpec == TBCD_THUMB) {
CDC dc;
dc.Attach(pNMCD->hdc);
pNMCD->rc.bottom--;
@@ -144,7 +144,7 @@ void CVolumeCtrl::OnLButtonDown(UINT nFlags, CPoint point)
CRect r;
GetChannelRect(&r);
- if(r.left >= r.right) {
+ if (r.left >= r.right) {
return;
}
@@ -154,13 +154,13 @@ void CVolumeCtrl::OnLButtonDown(UINT nFlags, CPoint point)
r.left += 3;
r.right -= 4;
- if(point.x < r.left) {
+ if (point.x < r.left) {
SetPos(start);
- } else if(point.x >= r.right) {
+ } 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);
}
}
@@ -180,7 +180,7 @@ 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);
}
}
diff --git a/src/apps/mplayerc/WebClientSocket.cpp b/src/apps/mplayerc/WebClientSocket.cpp
index f1a600e4c..d6894a2e1 100644
--- a/src/apps/mplayerc/WebClientSocket.cpp
+++ b/src/apps/mplayerc/WebClientSocket.cpp
@@ -42,10 +42,10 @@ CWebClientSocket::~CWebClientSocket()
bool CWebClientSocket::SetCookie(CString name, CString value, __time64_t expire, CString path, CString domain)
{
- if(name.IsEmpty()) {
+ if (name.IsEmpty()) {
return(false);
}
- if(value.IsEmpty()) {
+ if (value.IsEmpty()) {
m_cookie.RemoveKey(name);
return true;
}
@@ -55,7 +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,8 +84,8 @@ void CWebClientSocket::Clear()
void CWebClientSocket::Header()
{
- if(m_cmd.IsEmpty()) {
- if(m_hdr.IsEmpty()) {
+ if (m_cmd.IsEmpty()) {
+ if (m_hdr.IsEmpty()) {
return;
}
@@ -101,9 +101,9 @@ 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();
}
}
@@ -112,15 +112,15 @@ void CWebClientSocket::Header()
// 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("");
@@ -130,7 +130,7 @@ 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);
@@ -140,9 +140,9 @@ void CWebClientSocket::Header()
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();
@@ -152,17 +152,17 @@ void CWebClientSocket::Header()
int timeout = 1000;
do {
- for(; len > 0 && (err = Receive(&c, 1)) > 0; len--) {
+ for (; len > 0 && (err = Receive(&c, 1)) > 0; len--) {
m_data += c;
- if(c == '\r') {
+ 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("");
@@ -171,11 +171,11 @@ void CWebClientSocket::Header()
}
}
- if(err == SOCKET_ERROR) {
+ if (err == SOCKET_ERROR) {
Sleep(1);
}
- } while(err == SOCKET_ERROR && GetLastError() == WSAEWOULDBLOCK
- && timeout-- > 0); // FIXME: this is just a dirty fix now
+ } 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
Receive(&c, 1);
@@ -183,20 +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);
@@ -209,17 +209,17 @@ 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;
}
@@ -230,26 +230,26 @@ void CWebClientSocket::Header()
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()) {
+ if (!value.path.IsEmpty()) {
reshdr += " path=" + value.path;
}
- if(!value.expire.IsEmpty()) {
+ if (!value.expire.IsEmpty()) {
reshdr += " expire=" + value.expire;
}
- if(!value.domain.IsEmpty()) {
+ if (!value.domain.IsEmpty()) {
reshdr += " domain=" + value.domain;
}
}
@@ -264,7 +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());
}
@@ -274,7 +274,7 @@ void CWebClientSocket::Header()
Clear();
// TODO
- // if(connection == _T("close"))
+ // if (connection == _T("close"))
OnClose(0);
}
}
@@ -283,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') {
+ 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;
}
@@ -315,34 +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) {
+ 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 (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, 0), 100);
m_pMainFrame->OnPlayVolume(0);
@@ -351,7 +351,7 @@ 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;
}
@@ -370,7 +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);
@@ -387,8 +387,8 @@ bool CWebClientSocket::OnIndex(CStringA& hdr, CStringA& body, CStringA& mime)
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) {
+ for (TCHAR drive[] = _T("A:"); drive[0] <= 'Z'; drive[0]++)
+ if (GetDriveType(drive) != DRIVE_NO_ROOT_DIR) {
rootdrives.AddTail(CStringA(drive) + '\\');
}
@@ -396,10 +396,10 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime)
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;
@@ -407,26 +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);
@@ -447,18 +447,18 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime)
} 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)
+ if (CFileGetStatus(path, fs) && (fs.m_attribute&CFile::directory)
|| path.Find(_T("\\")) == 0) { // FIXME
CPath p(path);
p.Canonicalize();
@@ -469,9 +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";
@@ -487,7 +487,7 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime)
} else {
CString parent;
- if(path.GetLength() > 3) {
+ if (path.GetLength() > 3) {
CPath p(path + "..");
p.Canonicalize();
p.AddBackslash();
@@ -505,9 +505,9 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime)
WIN32_FIND_DATA fd = {0};
HANDLE hFind = FindFirstFile(path + "*.*", &fd);
- if(hFind != INVALID_HANDLE_VALUE) {
+ if (hFind != INVALID_HANDLE_VALUE) {
do {
- if(!(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) || fd.cFileName[0] == '.') {
+ if (!(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) || fd.cFileName[0] == '.') {
continue;
}
@@ -520,15 +520,15 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime)
"<td class=\"dirsize\">&nbsp</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) {
+ if (hFind != INVALID_HANDLE_VALUE) {
do {
- if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
+ if (fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
continue;
}
@@ -555,7 +555,7 @@ bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime)
"<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);
}
@@ -574,7 +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;
@@ -584,7 +584,7 @@ bool CWebClientSocket::OnControls(CStringA& hdr, CStringA& body, CStringA& mime)
CString state;
state.Format(_T("%d"), fs);
CString statestring;
- switch(fs) {
+ switch (fs) {
case State_Stopped:
statestring = ResStr(IDS_CONTROLS_STOPPED);
break;
@@ -636,84 +636,84 @@ bool CWebClientSocket::OnControls(CStringA& hdr, CStringA& body, CStringA& mime)
body.Replace("[playbackrate]", UTF8(playbackrate));
body.Replace("[reloadtime]", UTF8(reloadtime));
- return true;
-}
-
-bool CWebClientSocket::OnVariables(CStringA& hdr, CStringA& body, CStringA& mime)
-{
- CString path = m_pMainFrame->m_wndPlaylistBar.GetCurFileName();
- CString dir;
-
- if(!path.IsEmpty()) {
- CPath p(path);
- p.RemoveFileSpec();
- dir = (LPCTSTR)p;
- }
-
- OAFilterState fs = m_pMainFrame->GetMediaState();
- 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;
- }
-
- int pos = (int)(m_pMainFrame->GetPos()/10000);
- int dur = (int)(m_pMainFrame->GetDur()/10000);
-
- CString position, duration;
- position.Format(_T("%d"), pos);
- 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"), (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
-
- CString volumelevel, muted;
- volumelevel.Format(_T("%d"), m_pMainFrame->m_wndToolBar.m_volctrl.GetPos());
- muted.Format(_T("%d"), m_pMainFrame->m_wndToolBar.Volume == -10000 ? 1 : 0);
-
- CString reloadtime(_T("0")); // TODO
-
- m_pWebServer->LoadPage(IDR_HTML_VARIABLES, body, m_path);
- body.Replace("[charset]", "UTF-8"); // FIXME: win9x build...
- body.Replace("[filepatharg]", UTF8Arg(path));
- body.Replace("[filepath]", UTF8(path));
- body.Replace("[filedirarg]", UTF8Arg(dir));
- body.Replace("[filedir]", UTF8(dir));
- body.Replace("[state]", UTF8(state));
- body.Replace("[statestring]", UTF8(statestring));
- body.Replace("[position]", UTF8(position));
- body.Replace("[positionstring]", UTF8(positionstring));
- body.Replace("[duration]", UTF8(duration));
- body.Replace("[durationstring]", UTF8(durationstring));
- body.Replace("[volumelevel]", UTF8(volumelevel));
- body.Replace("[muted]", UTF8(muted));
- body.Replace("[playbackrate]", UTF8(playbackrate));
- body.Replace("[reloadtime]", UTF8(reloadtime));
-
- return true;
-}
-
-bool CWebClientSocket::OnStatus(CStringA& hdr, CStringA& body, CStringA& mime)
-{
- /*
+ return true;
+}
+
+bool CWebClientSocket::OnVariables(CStringA& hdr, CStringA& body, CStringA& mime)
+{
+ CString path = m_pMainFrame->m_wndPlaylistBar.GetCurFileName();
+ CString dir;
+
+ if (!path.IsEmpty()) {
+ CPath p(path);
+ p.RemoveFileSpec();
+ dir = (LPCTSTR)p;
+ }
+
+ OAFilterState fs = m_pMainFrame->GetMediaState();
+ 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;
+ }
+
+ int pos = (int)(m_pMainFrame->GetPos()/10000);
+ int dur = (int)(m_pMainFrame->GetDur()/10000);
+
+ CString position, duration;
+ position.Format(_T("%d"), pos);
+ 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"), (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
+
+ CString volumelevel, muted;
+ volumelevel.Format(_T("%d"), m_pMainFrame->m_wndToolBar.m_volctrl.GetPos());
+ muted.Format(_T("%d"), m_pMainFrame->m_wndToolBar.Volume == -10000 ? 1 : 0);
+
+ CString reloadtime(_T("0")); // TODO
+
+ m_pWebServer->LoadPage(IDR_HTML_VARIABLES, body, m_path);
+ body.Replace("[charset]", "UTF-8"); // FIXME: win9x build...
+ body.Replace("[filepatharg]", UTF8Arg(path));
+ body.Replace("[filepath]", UTF8(path));
+ body.Replace("[filedirarg]", UTF8Arg(dir));
+ body.Replace("[filedir]", UTF8(dir));
+ body.Replace("[state]", UTF8(state));
+ body.Replace("[statestring]", UTF8(statestring));
+ body.Replace("[position]", UTF8(position));
+ body.Replace("[positionstring]", UTF8(positionstring));
+ body.Replace("[duration]", UTF8(duration));
+ body.Replace("[durationstring]", UTF8(durationstring));
+ body.Replace("[volumelevel]", UTF8(volumelevel));
+ body.Replace("[muted]", UTF8(muted));
+ body.Replace("[playbackrate]", UTF8(playbackrate));
+ body.Replace("[reloadtime]", UTF8(reloadtime));
+
+ return true;
+}
+
+bool CWebClientSocket::OnStatus(CStringA& hdr, CStringA& body, CStringA& mime)
+{
+ /*
CString path = m_pMainFrame->m_wndPlaylistBar.GetCur(), dir;
- if(!path.IsEmpty()) {CPath p(path); p.RemoveFileSpec(); dir = (LPCTSTR)p;}
+ if (!path.IsEmpty()) {CPath p(path); p.RemoveFileSpec(); dir = (LPCTSTR)p;}
path.Replace(_T("'"), _T("\\'"));
dir.Replace(_T("'"), _T("\\'"));
@@ -787,8 +787,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"
@@ -809,19 +809,19 @@ 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;
}
diff --git a/src/apps/mplayerc/WebClientSocket.h b/src/apps/mplayerc/WebClientSocket.h
index 089be21bd..b2714b086 100644
--- a/src/apps/mplayerc/WebClientSocket.h
+++ b/src/apps/mplayerc/WebClientSocket.h
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -58,13 +58,13 @@ public:
CAtlStringMap<> m_request;
bool OnCommand(CStringA& hdr, CStringA& body, CStringA& mime);
- bool OnIndex(CStringA& hdr, CStringA& body, CStringA& mime);
- bool OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime);
- bool OnControls(CStringA& hdr, CStringA& body, CStringA& mime);
- bool OnVariables(CStringA& hdr, CStringA& body, CStringA& mime);
- bool OnStatus(CStringA& hdr, CStringA& body, CStringA& mime);
- bool OnError404(CStringA& hdr, CStringA& body, CStringA& mime);
- bool OnPlayer(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnIndex(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnControls(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnVariables(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnStatus(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnError404(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnPlayer(CStringA& hdr, CStringA& body, CStringA& mime);
bool OnSnapShotJpeg(CStringA& hdr, CStringA& body, CStringA& mime);
bool OnConvRes(CStringA& hdr, CStringA& body, CStringA& mime);
};
diff --git a/src/apps/mplayerc/WebServer.cpp b/src/apps/mplayerc/WebServer.cpp
index ed5148c43..a050c30b2 100644
--- a/src/apps/mplayerc/WebServer.cpp
+++ b/src/apps/mplayerc/WebServer.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -39,21 +39,21 @@ 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;
m_internalpages[_T("/controls.html")] = &CWebClientSocket::OnControls;
- m_internalpages[_T("/command.html")] = &CWebClientSocket::OnCommand;
- m_internalpages[_T("/status.html")] = &CWebClientSocket::OnStatus;
- m_internalpages[_T("/player.html")] = &CWebClientSocket::OnPlayer;
- m_internalpages[_T("/variables.html")] = &CWebClientSocket::OnVariables;
- m_internalpages[_T("/snapshot.jpg")] = &CWebClientSocket::OnSnapShotJpeg;
- m_internalpages[_T("/404.html")] = &CWebClientSocket::OnError404;
- m_internalpages[_T("/convres.html")] = &CWebClientSocket::OnConvRes;
+ m_internalpages[_T("/command.html")] = &CWebClientSocket::OnCommand;
+ m_internalpages[_T("/status.html")] = &CWebClientSocket::OnStatus;
+ m_internalpages[_T("/player.html")] = &CWebClientSocket::OnPlayer;
+ m_internalpages[_T("/variables.html")] = &CWebClientSocket::OnVariables;
+ m_internalpages[_T("/snapshot.jpg")] = &CWebClientSocket::OnSnapShotJpeg;
+ m_internalpages[_T("/404.html")] = &CWebClientSocket::OnError404;
+ 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;
@@ -91,14 +91,14 @@ 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)
+ if (ERROR_SUCCESS == mime.Open(HKEY_CLASSES_ROOT, str + _T("\\") + buff, KEY_READ)
&& ERROR_SUCCESS == mime.QueryStringValue(_T("Extension"), ext, &len)) {
m_mimes[CStringA(ext).MakeLower()] = CStringA(buff).MakeLower();
}
@@ -109,13 +109,13 @@ CWebServer::CWebServer(CMainFrame* pMainFrame, int nPort)
m_mimes[".txt"] = "text/plain";
m_mimes[".css"] = "text/css";
m_mimes[".gif"] = "image/gif";
- m_mimes[".jpeg"] = "image/jpeg";
- m_mimes[".jpg"] = "image/jpeg";
- m_mimes[".png"] = "image/png";
- m_mimes[".js"] = "text/javascript";
-
- GetModuleFileName(AfxGetInstanceHandle(), str.GetBuffer(_MAX_PATH), _MAX_PATH);
- str.ReleaseBuffer();
+ m_mimes[".jpeg"] = "image/jpeg";
+ m_mimes[".jpg"] = "image/jpeg";
+ m_mimes[".png"] = "image/png";
+ m_mimes[".js"] = "text/javascript";
+
+ GetModuleFileName(AfxGetInstanceHandle(), str.GetBuffer(_MAX_PATH), _MAX_PATH);
+ str.ReleaseBuffer();
m_webroot = CPath(str);
m_webroot.RemoveFileSpec();
@@ -123,24 +123,24 @@ CWebServer::CWebServer(CMainFrame* pMainFrame, int nPort)
WebRoot.Replace('/', '\\');
WebRoot.Trim();
CPath p(WebRoot);
- if(WebRoot.Find(_T(":\\")) < 0 && WebRoot.Find(_T("\\\\")) < 0) {
+ 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()) {
+ 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) {
+ if (sl2.GetCount() < 2) {
continue;
}
m_cgi[ext] = sl2.GetTail();
@@ -152,7 +152,7 @@ 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) {
TerminateThread (m_hThread, 0xDEAD);
@@ -168,14 +168,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);
}
@@ -185,7 +185,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);
}
@@ -194,31 +194,31 @@ static void PutFileContents(LPCTSTR fn, const CStringA& data)
void CWebServer::Deploy(CString dir)
{
CStringA data;
- if(LoadResource(IDR_HTML_INDEX, data, RT_HTML)) {
+ if (LoadResource(IDR_HTML_INDEX, data, RT_HTML)) {
PutFileContents(dir + _T("index.html"), data);
}
- if(LoadResource(IDR_HTML_BROWSER, data, RT_HTML)) {
+ 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_VARIABLES, data, RT_HTML)) {
- PutFileContents(dir + _T("variables.html"), data);
- }
- if(LoadResource(IDR_HTML_404, data, RT_HTML)) {
- PutFileContents(dir + _T("404.html"), data);
- }
- if(LoadResource(IDR_HTML_PLAYER, data, RT_HTML)) {
+ if (LoadResource(IDR_HTML_CONTROLS, data, RT_HTML)) {
+ PutFileContents(dir + _T("controls.html"), data);
+ }
+ if (LoadResource(IDR_HTML_VARIABLES, data, RT_HTML)) {
+ PutFileContents(dir + _T("variables.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);
}
}
@@ -226,7 +226,7 @@ void CWebServer::Deploy(CString dir)
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('\\');
@@ -235,18 +235,18 @@ 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) != '/') {
+ if (redir.GetAt(redir.GetLength()-1) != '/') {
redir += '/';
}
redir += str;
@@ -255,7 +255,7 @@ bool CWebServer::ToLocalPath(CString& path, CString& redir)
}
}
- if(_tcslen(p) > _tcslen(m_webroot) && p.FileExists()) {
+ if (_tcslen(p) > _tcslen(m_webroot) && p.FileExists()) {
path = (LPCTSTR)p;
return true;
}
@@ -267,8 +267,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);
@@ -284,10 +284,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;
}
@@ -299,9 +299,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;
}
@@ -313,7 +313,7 @@ void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& b
CPath p(pClient->m_path);
CStringA ext = p.GetExtension().MakeLower();
CStringA mime;
- if(ext.IsEmpty()) {
+ if (ext.IsEmpty()) {
mime = "text/html";
} else {
m_mimes.Lookup(ext, mime);
@@ -323,27 +323,27 @@ void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& b
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) {
+ 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);
}
}
@@ -354,15 +354,15 @@ 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()) {
+ 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)
+ if (pClient->m_get.Lookup(_T("redir"), redir)
|| pClient->m_post.Lookup(_T("redir"), redir)) {
- if(redir.IsEmpty()) {
+ if (redir.IsEmpty()) {
redir = '/';
}
@@ -375,40 +375,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()) {
+ 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";
}
@@ -416,22 +416,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,25 +450,25 @@ void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& b
}
// gzip
- if(AfxGetAppSettings().fWebServerUseCompression && hdr.Find("Content-Encoding:") < 0)
+ if (AfxGetAppSettings().fWebServerUseCompression && hdr.Find("Content-Encoding:") < 0)
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"))) {
+ 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) {
+ if (!gf || gzwrite(gf, (LPVOID)(LPCSTR)body, body.GetLength()) != body.GetLength()) {
+ if (gf) {
gzclose(gf);
}
DeleteFileA(fn);
@@ -477,7 +477,7 @@ void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& b
gzclose(gf);
FILE* f = fopen(fn, "rb");
- if(!f) {
+ if (!f) {
DeleteFileA(fn);
break;
}
@@ -491,7 +491,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(
@@ -504,7 +504,7 @@ 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;
@@ -513,7 +513,7 @@ static DWORD WINAPI KillCGI(LPVOID lParam)
bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& body, CStringA& mime)
{
CString path = pClient->m_path, redir = path;
- if(!ToLocalPath(path, redir)) {
+ if (!ToLocalPath(path, redir)) {
return false;
}
CString ext = CPath(path).GetExtension().MakeLower();
@@ -521,7 +521,7 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod
dir.RemoveFileSpec();
CString cgi;
- if(!m_cgi.Lookup(ext, cgi) || !CPath(cgi).FileExists()) {
+ if (!m_cgi.Lookup(ext, cgi) || !CPath(cgi).FileExists()) {
return false;
}
@@ -534,13 +534,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);
@@ -561,12 +561,12 @@ 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) {
+ for (LPTSTR lpszVariable = (LPTSTR)lpvEnv; *lpszVariable; lpszVariable += _tcslen(lpszVariable)+1)
+ if (lpszVariable != (LPTSTR)lpvEnv) {
env.AddTail(lpszVariable);
}
@@ -579,15 +579,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("_"));
@@ -598,14 +598,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 +622,8 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod
TCHAR* cmdln = DNew TCHAR[32768];
_sntprintf(cmdln, 32768, _T("\"%s\" \"%s\""), cgi, path);
- if(hChildStdinRd && hChildStdoutWr)
- if(CreateProcess(
+ if (hChildStdinRd && hChildStdoutWr)
+ if (CreateProcess(
NULL, cmdln, NULL, NULL, TRUE, 0,
envstr.GetLength() ? (LPVOID)(LPCSTR)envstr : NULL,
dir, &siStartInfo, &piProcInfo)) {
@@ -634,8 +634,8 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod
DWORD dwRead, dwWritten = 0;
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)) {
+ for (; i < len; i += dwWritten)
+ if (!WriteFile(hChildStdinWrDup, (LPCSTR)pClient->m_data + i, min(len - i, BUFFSIZE), &dwWritten, NULL)) {
break;
}
@@ -645,13 +645,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);
}
diff --git a/src/apps/mplayerc/WebServerSocket.cpp b/src/apps/mplayerc/WebServerSocket.cpp
index 4810aa6c5..f502023c4 100644
--- a/src/apps/mplayerc/WebServerSocket.cpp
+++ b/src/apps/mplayerc/WebServerSocket.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -38,7 +38,7 @@ CWebServerSocket::~CWebServerSocket()
void CWebServerSocket::OnAccept(int nErrorCode)
{
- if(nErrorCode == 0 && m_pWebServer) {
+ if (nErrorCode == 0 && m_pWebServer) {
m_pWebServer->OnAccept(this);
}
diff --git a/src/apps/mplayerc/jpeg.cpp b/src/apps/mplayerc/jpeg.cpp
index bcb32c098..85164bb0a 100644
--- a/src/apps/mplayerc/jpeg.cpp
+++ b/src/apps/mplayerc/jpeg.cpp
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -29,7 +29,7 @@
bool CJpegEncoder::PutBit(int b, int n)
{
- if(n > 24 || n <= 0) {
+ if (n > 24 || n <= 0) {
return(false);
}
@@ -37,10 +37,10 @@ bool CJpegEncoder::PutBit(int b, int 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) {
+ if (c == 0xff) {
PutByte(0);
}
m_bwidth -= 8;
@@ -51,10 +51,10 @@ 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) {
+ if (c == 0xff) {
PutByte(0);
}
}
@@ -66,15 +66,15 @@ void CJpegEncoder::Flush()
int CJpegEncoder::GetBitWidth(short q)
{
- if(q == 0) {
+ if (q == 0) {
return(0);
}
- if(q < 0) {
+ if (q < 0) {
q = -q;
}
int width = 15;
- for(; !(q&0x4000); q <<= 1, width--) {
+ for (; !(q&0x4000); q <<= 1, width--) {
;
}
return(width);
@@ -97,7 +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);
}
@@ -145,13 +145,13 @@ void CJpegEncoder::WriteDHT()
PutByte(0x00); // tbl class (DC) | tbl id
PutBytes(DCVLC_NumByLength[0], 16);
- for(int i = 0; i < 12; 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++) {
+ for (int i = 0; i < 12; i++) {
PutByte(i);
}
@@ -196,41 +196,41 @@ void CJpegEncoder::WriteSOS()
static float cosuv[8][8][8][8];
// oh yeah, we don't need no fast dct :)
- 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 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++) {
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];
float F = 0;
/*
- for(int j = 0; j < jj; j++)
- for(int i = 0; i < ii; i++)
+ for (int j = 0; j < jj; j++)
+ 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];
}
}
@@ -247,21 +247,21 @@ void CJpegEncoder::WriteSOS()
int size = GetBitWidth(DC);
PutBit(DCVLC[cc][size], DCVLC_Size[cc][size]);
- if(DC < 0) {
+ 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;
}
@@ -269,7 +269,7 @@ void CJpegEncoder::WriteSOS()
int size = GetBitWidth(AC);
PutBit(ACVLC[cc][ACs][size], ACVLC_Size[cc][ACs][size]);
- if(AC < 0) {
+ if (AC < 0) {
AC--;
}
PutBit(AC, size);
@@ -278,7 +278,7 @@ void CJpegEncoder::WriteSOS()
}
}
- if(j < 64) {
+ if (j < 64) {
PutBit(ACVLC[cc][0][0], ACVLC_Size[cc][0][0]);
}
}
@@ -308,7 +308,7 @@ 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;
}
@@ -317,8 +317,8 @@ bool CJpegEncoder::Encode(const BYTE* dib)
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) {
+ 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]));
@@ -334,7 +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;
@@ -342,9 +342,9 @@ 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) {
- for(int i = 0; i < countof(quanttbl); i++)
- for(int j = 0; j < countof(quanttbl[0]); j++) {
+ 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
}
}
@@ -382,7 +382,7 @@ 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);
diff --git a/src/apps/mplayerc/libpng.c b/src/apps/mplayerc/libpng.c
index eb5dd89fa..8a10c00e1 100644
--- a/src/apps/mplayerc/libpng.c
+++ b/src/apps/mplayerc/libpng.c
@@ -31,7 +31,7 @@
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) {
+ if (png->pos + length > png->size) {
png_error(png_ptr, "Read Error");
}
memcpy(data, &png->data[png->pos], length);
@@ -48,7 +48,7 @@ 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;
}
@@ -56,25 +56,25 @@ unsigned char* DecompressPNG(struct png_t* png, int* w, int* h)
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;
}
@@ -90,7 +90,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;
}
@@ -100,11 +100,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 7a5cf8aaa..de82b27bb 100644
--- a/src/apps/mplayerc/libpng.h
+++ b/src/apps/mplayerc/libpng.h
@@ -2,7 +2,7 @@
* $Id$
*
* (C) 2003-2006 Gabest
- * (C) 2006-2010 see AUTHORS
+ * (C) 2006-2011 see AUTHORS
*
* This file is part of mplayerc.
*
@@ -42,14 +42,14 @@ public:
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.h b/src/apps/mplayerc/mpciconlib/mpciconlib.h
index 159a6c151..fe5ebdeec 100644
--- a/src/apps/mplayerc/mpciconlib/mpciconlib.h
+++ b/src/apps/mplayerc/mpciconlib/mpciconlib.h
@@ -4,7 +4,7 @@
* when adding/removing icons.
*/
-#define IDI_OTHER_ICON 0
+#define IDI_OTHER_ICON 0
#define IDI_AAC_ICON 1
#define IDI_AC3_ICON 2
#define IDI_AIFF_ICON 3
diff --git a/src/apps/mplayerc/mpcresources/common.pl b/src/apps/mplayerc/mpcresources/common.pl
index 980aadc98..68ddeed25 100644
--- a/src/apps/mplayerc/mpcresources/common.pl
+++ b/src/apps/mplayerc/mpcresources/common.pl
@@ -86,7 +86,7 @@ sub analyseData {
my $menuname = readMenu($menus, \@blocks);
push(@{$outline}, ["MENU", [$menuname, ""]]);
}
- elsif($tagidx == 2) {
+ elsif($tagidx == 2) {
readStringTable($strings, \@blocks);
push(@{$outline}, ["STRINGTABLE", [@blocks]]);
}
@@ -379,7 +379,7 @@ sub lcs {
$idx=0;
for($r=$rows, $c=$cols, $i=$align->[$r][$c];
$i>0 && $r>0 && $c>0;
- $i=$align->[$r][$c])
+ $i=$align->[$r][$c])
{
if($align->[$r-1][$c] == $i) {
$r--;
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.br.rc b/src/apps/mplayerc/mpcresources/mplayerc.br.rc
index 4f7751376..35df8696a 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.br.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.br.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.by.rc b/src/apps/mplayerc/mpcresources/mplayerc.by.rc
index d98a45eaa..b0fc2039b 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.by.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.by.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.ca.rc b/src/apps/mplayerc/mpcresources/mplayerc.ca.rc
index 4418cf519..581aeaa09 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.ca.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.ca.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.cz.rc b/src/apps/mplayerc/mpcresources/mplayerc.cz.rc
index 7d094e8c9..e2b5eb51c 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.cz.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.cz.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.de.rc b/src/apps/mplayerc/mpcresources/mplayerc.de.rc
index 41d97224c..ee558a516 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.de.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.de.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.es.rc b/src/apps/mplayerc/mpcresources/mplayerc.es.rc
index 26de5e2a0..3be9b5b25 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.es.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.es.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.fr.rc b/src/apps/mplayerc/mpcresources/mplayerc.fr.rc
index fd4c0a3e6..ee0667589 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.fr.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.fr.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.hu.rc b/src/apps/mplayerc/mpcresources/mplayerc.hu.rc
index 134f0df81..bec74aaf7 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.hu.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.hu.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.hy.rc b/src/apps/mplayerc/mpcresources/mplayerc.hy.rc
index bf3d06be0..62ec77c0d 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.hy.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.hy.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.it.rc b/src/apps/mplayerc/mpcresources/mplayerc.it.rc
index 6943b1dfa..adb543241 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.it.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.it.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.ja.rc b/src/apps/mplayerc/mpcresources/mplayerc.ja.rc
index 23767c15e..b22260718 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.ja.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.ja.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.kr.rc b/src/apps/mplayerc/mpcresources/mplayerc.kr.rc
index 2c5b9beda..421be3f19 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.kr.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.kr.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.nl.rc b/src/apps/mplayerc/mpcresources/mplayerc.nl.rc
index b80eb3cab..7e56193cc 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.nl.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.nl.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.pl.rc b/src/apps/mplayerc/mpcresources/mplayerc.pl.rc
index d57243027..7ad8eb4d2 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.pl.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.pl.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.ru.rc b/src/apps/mplayerc/mpcresources/mplayerc.ru.rc
index 749cf0729..cc104436a 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.ru.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.ru.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.sc.rc b/src/apps/mplayerc/mpcresources/mplayerc.sc.rc
index 49333ba7f..42e153a51 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.sc.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.sc.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.sk.rc b/src/apps/mplayerc/mpcresources/mplayerc.sk.rc
index f3f078724..2a626ab25 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.sk.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.sk.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.sv.rc b/src/apps/mplayerc/mpcresources/mplayerc.sv.rc
index 967c5122f..cb2228f33 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.sv.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.sv.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.tc.rc b/src/apps/mplayerc/mpcresources/mplayerc.tc.rc
index 62ff28145..075cd5c63 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.tc.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.tc.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.tr.rc b/src/apps/mplayerc/mpcresources/mplayerc.tr.rc
index 44719216d..0e6358884 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.tr.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.tr.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.ua.rc b/src/apps/mplayerc/mpcresources/mplayerc.ua.rc
index 667888ef4..c198336d9 100644
--- a/src/apps/mplayerc/mpcresources/mplayerc.ua.rc
+++ b/src/apps/mplayerc/mpcresources/mplayerc.ua.rc
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/rcfile.pl b/src/apps/mplayerc/mpcresources/rcfile.pl
index 81b734152..373d03927 100644
--- a/src/apps/mplayerc/mpcresources/rcfile.pl
+++ b/src/apps/mplayerc/mpcresources/rcfile.pl
@@ -60,14 +60,14 @@ Options:
Go to the mpcresources directory, then >perl rcfile.pl
example 2: you changed some gui of mpc-hc, that means you also modified the mplayerc.rc file.
- First: checkout the head revision of mplayerc.rc using the svn client, give it any other name, for example:
+ First: checkout the head revision of mplayerc.rc using the svn client, give it any other name, for example:
>svn cat -r head ../mplayerc.rc > mplayer.rc.old
Second: >perl rcfile.pl -b mplayerc.rc.old
Or better yet use provided batch file: >rcfile.bat
- After running this script, you will find all new language rc files under "newrc" subdir.
- These new rc files have all changes copied from your modified mplayerc.rc file and is ready to compile,
- except use english version strings. Use rcstrings.pl to extract all strings for translators,
+ After running this script, you will find all new language rc files under "newrc" subdir.
+ These new rc files have all changes copied from your modified mplayerc.rc file and is ready to compile,
+ except use english version strings. Use rcstrings.pl to extract all strings for translators,
After recieved translated text files, use patch.pl script to merge back to rc files.
USAGE
exit(0);
@@ -234,7 +234,7 @@ sub writeStringTable {
my ($key, $value);
if (/\b(ID\S+)\b\s*(".+")/){ #distinguish between key value at same line or not for syntax's sake
- ($key, $value)= ($1,$2);
+ ($key, $value)= ($1,$2);
}
elsif (/\b(ID\S+)\b\s*$/){ #value too long to fit in one line but we don't care. :)
$key = $1;
@@ -278,7 +278,7 @@ sub writeDialogContent {
my $refdataLines = @refdatas;
if($newdataLines && $basedataLines && $refdataLines) {
- my $diffData = $DialogDiffs->{$name};
+ my $diffData = $DialogDiffs->{$name};
foreach(@$diffData) {
my $linenum = $newidxs[$_->[0]];
@@ -311,11 +311,11 @@ sub writeMenuContent {
if(my $diffData = $MenuDiffs->{$name}) {
# this menu exists in old file
my @changes = grep($_->[0] != $_->[1],@$diffData); #anything changed for this menu?
- my $samelines = @$diffData;
+ my $samelines = @$diffData;
if((!@changes) && ($samelines == $contentLines)) { #no change then just use old data
@contents = ();
- push(@contents, @{$refs->{$name}{"__TEXT__"}});
+ push(@contents, @{$refs->{$name}{"__TEXT__"}});
}
else { #change in this menu
my @checkIdx=(1..$contentLines);
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.br.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.br.rc.txt
index d97d615c9..b2a9c68e0 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.br.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.br.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.by.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.by.rc.txt
index 31cc82450..b5a51a89c 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.by.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.by.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.ca.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.ca.rc.txt
index fca02d33d..9f83d2dea 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.ca.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.ca.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.cz.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.cz.rc.txt
index 038dd706a..0dfb6ca4e 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.cz.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.cz.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.de.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.de.rc.txt
index 5415542b5..47da9bafd 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.de.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.de.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.es.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.es.rc.txt
index 8cacc9280..32c427a00 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.es.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.es.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.fr.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.fr.rc.txt
index b30c1a68f..96aef048f 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.fr.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.fr.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.hu.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.hu.rc.txt
index ee7281c21..f64c6138a 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.hu.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.hu.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.hy.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.hy.rc.txt
index 8897529e6..c52c4ca52 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.hy.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.hy.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.it.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.it.rc.txt
index 71b0d12c5..f9f050fe1 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.it.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.it.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.ja.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.ja.rc.txt
index f718b042c..eda3c39f4 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.ja.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.ja.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.kr.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.kr.rc.txt
index 214b2baa3..487b4b4d1 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.kr.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.kr.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.nl.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.nl.rc.txt
index 18684d593..f028873bb 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.nl.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.nl.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.pl.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.pl.rc.txt
index 70b9bf810..af65828d9 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.pl.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.pl.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.rc.txt
index cdc614046..a57c125cd 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.ru.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.ru.rc.txt
index 2a9d7bfbe..788c41f07 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.ru.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.ru.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.sc.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.sc.rc.txt
index a9025f494..1a2e9161e 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.sc.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.sc.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.sk.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.sk.rc.txt
index 5b87d05e3..c8a685f1f 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.sk.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.sk.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.sv.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.sv.rc.txt
index 736cda6f1..120a36ccf 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.sv.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.sv.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.tc.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.tc.rc.txt
index 179143af1..5f8a10d5f 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.tc.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.tc.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.tr.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.tr.rc.txt
index 6b89c5eee..57d60b942 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.tr.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.tr.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mpcresources/text/mplayerc.ua.rc.txt b/src/apps/mplayerc/mpcresources/text/mplayerc.ua.rc.txt
index 0c45f9c80..c72f45e0b 100644
--- a/src/apps/mplayerc/mpcresources/text/mplayerc.ua.rc.txt
+++ b/src/apps/mplayerc/mpcresources/text/mplayerc.ua.rc.txt
Binary files differ
diff --git a/src/apps/mplayerc/mplayerc.cpp b/src/apps/mplayerc/mplayerc.cpp
index 6b996a755..258132887 100644
--- a/src/apps/mplayerc/mplayerc.cpp
+++ b/src/apps/mplayerc/mplayerc.cpp
@@ -40,7 +40,7 @@ extern "C" {
void CorrectComboListWidth(CComboBox& box, CFont* pWndFont)
{
int cnt = box.GetCount();
- if(cnt <= 0) {
+ if (cnt <= 0) {
return;
}
@@ -49,11 +49,11 @@ void CorrectComboListWidth(CComboBox& box, CFont* 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) {
+ if (maxw < w) {
maxw = w;
}
}
@@ -65,25 +65,25 @@ void CorrectComboListWidth(CComboBox& box, CFont* pWndFont)
HICON LoadIcon(CString fn, bool fSmall)
{
- if(fn.IsEmpty()) {
+ 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);
}
}
@@ -94,18 +94,18 @@ HICON LoadIcon(CString fn, bool fSmall)
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;
}
}
@@ -114,17 +114,17 @@ HICON LoadIcon(CString fn, bool fSmall)
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) {
+ 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;
}
@@ -135,10 +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) {
+ if (hIcon) {
return hIcon;
}
- } while(0);
+ } while (0);
return((HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_UNKNOWN), IMAGE_ICON, size.cx, size.cy, 0));
}
@@ -150,41 +150,41 @@ bool LoadType(CString fn, CString& type)
TCHAR buff[256];
ULONG len;
- if(fn.IsEmpty()) {
+ 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("")) {
+ 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;
}
@@ -200,35 +200,36 @@ bool LoadResource(UINT resid, CStringA& str, LPCTSTR restype)
{
str.Empty();
HRSRC hrsrc = FindResource(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(resid), restype);
- if(!hrsrc) {
+ if (!hrsrc) {
return(false);
}
HGLOBAL hGlobal = LoadResource(AfxGetApp()->m_hInstance, hrsrc);
- if(!hGlobal) {
+ if (!hGlobal) {
return(false);
}
DWORD size = SizeofResource(AfxGetApp()->m_hInstance, hrsrc);
- if(!size) {
+ if (!size) {
return(false);
}
memcpy(str.GetBufferSetLength(size), LockResource(hGlobal), size);
return(true);
}
-WORD assignedToCmd(UINT keyOrMouseValue, bool bCheckMouse) {
+WORD assignedToCmd(UINT keyOrMouseValue, bool bCheckMouse)
+{
WORD assignTo = 0;
AppSettings& s = AfxGetAppSettings();
POSITION pos = s.wmcmds.GetHeadPosition();
- while(pos && (!assignTo)) {
+ while (pos && (!assignTo)) {
wmcmd& wc = s.wmcmds.GetNext(pos);
- if(bCheckMouse) {
- if(wc.mouse == keyOrMouseValue) {
+ if (bCheckMouse) {
+ if (wc.mouse == keyOrMouseValue) {
assignTo = wc.cmd;
break;
}
} else {
- if(wc.key == keyOrMouseValue) {
+ if (wc.key == keyOrMouseValue) {
assignTo = wc.cmd;
break;
}
@@ -404,9 +405,9 @@ 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++) {
+ for (int i = 0; i < __argc; i++) {
sl.AddTail(__targv[i]);
}
s += ResStr(IDS_UNKNOWN_SWITCH) + Implode(sl, ' ') + _T("\n\n");
@@ -429,7 +430,7 @@ bool CMPlayerCApp::StoreSettingsToIni()
CString ini = GetIniPath();
/*
FILE* f;
- if(!(f = _tfopen(ini, _T("r+"))) && !(f = _tfopen(ini, _T("w"))))
+ if (!(f = _tfopen(ini, _T("r+"))) && !(f = _tfopen(ini, _T("w"))))
return StoreSettingsToRegistry();
fclose(f);
*/
@@ -444,14 +445,14 @@ bool CMPlayerCApp::StoreSettingsToIni()
// If you want to try unicode ini, uncomment following code block.
/*
- if(!::PathFileExists(m_pszProfileName)) // don't overwrite existing ini file
+ if (!::PathFileExists(m_pszProfileName)) // don't overwrite existing ini file
{
LPTSTR pszComments = _T("; Media Player Classic - Home Cinema");
WORD wBOM = 0xFEFF;// UTF16-LE BOM(FFFE)
DWORD nBytes;
HANDLE hFile = ::CreateFile(m_pszProfileName, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- if(hFile != INVALID_HANDLE_VALUE)
+ if (hFile != INVALID_HANDLE_VALUE)
{
::WriteFile(hFile, &wBOM, sizeof(WORD), &nBytes, NULL);
::WriteFile(hFile, pszComments, (_tcslen(pszComments)+1)*(sizeof(TCHAR)), &nBytes, NULL);
@@ -494,20 +495,20 @@ 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 {
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);
}
@@ -523,15 +524,15 @@ 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)) {
+ if (!str2.IsEmpty() && CFileGetStatus(str2, fs)) {
str = str2;
}
}
@@ -542,19 +543,19 @@ 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) {
+ while (pos) {
bufflen += (m_cmdln.GetNext(pos).GetLength()+1)*sizeof(TCHAR);
}
CAutoVectorPtr<BYTE> buff;
- if(!buff.Allocate(bufflen)) {
+ if (!buff.Allocate(bufflen)) {
return;
}
@@ -564,7 +565,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);
@@ -586,21 +587,21 @@ void CMPlayerCApp::SendCommandLine(HWND hWnd)
#include <detours/detours.h>
BOOL (__stdcall * Real_IsDebuggerPresent)(void)
-= IsDebuggerPresent;
+ = IsDebuggerPresent;
LONG (__stdcall * Real_ChangeDisplaySettingsExA)(LPCSTR a0,
LPDEVMODEA a1,
HWND a2,
DWORD a3,
LPVOID a4)
-= ChangeDisplaySettingsExA;
+ = ChangeDisplaySettingsExA;
LONG (__stdcall * Real_ChangeDisplaySettingsExW)(LPCWSTR a0,
LPDEVMODEW a1,
HWND a2,
DWORD a3,
LPVOID a4)
-= ChangeDisplaySettingsExW;
+ = ChangeDisplaySettingsExW;
HANDLE (__stdcall * Real_CreateFileA)(LPCSTR a0,
DWORD a1,
@@ -609,7 +610,7 @@ HANDLE (__stdcall * Real_CreateFileA)(LPCSTR a0,
DWORD a4,
DWORD a5,
HANDLE a6)
-= CreateFileA;
+ = CreateFileA;
HANDLE (__stdcall * Real_CreateFileW)(LPCWSTR a0,
DWORD a1,
@@ -618,7 +619,7 @@ HANDLE (__stdcall * Real_CreateFileW)(LPCWSTR a0,
DWORD a4,
DWORD a5,
HANDLE a6)
-= CreateFileW;
+ = CreateFileW;
BOOL (__stdcall * Real_DeviceIoControl)(HANDLE a0,
DWORD a1,
@@ -628,12 +629,12 @@ BOOL (__stdcall * Real_DeviceIoControl)(HANDLE a0,
DWORD a5,
LPDWORD a6,
LPOVERLAPPED a7)
-= DeviceIoControl;
+ = DeviceIoControl;
MMRESULT (__stdcall * Real_mixerSetControlDetails)( HMIXEROBJ hmxobj,
LPMIXERCONTROLDETAILS pmxcd,
DWORD fdwDetails)
-= mixerSetControlDetails;
+ = mixerSetControlDetails;
typedef NTSTATUS (WINAPI *FUNC_NTQUERYINFORMATIONPROCESS)(HANDLE ProcessHandle, PROCESSINFOCLASS ProcessInformationClass, PVOID ProcessInformation, ULONG ProcessInformationLength, PULONG ReturnLength);
@@ -680,18 +681,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}"))
+ if (vp->Guid == GUIDFromCString(_T("{02C62061-1097-11d1-920F-00A024DF156E}"))
&& (vp->dwFlags&VP_FLAGS_COPYPROTECT)) {
- if(vp->dwCommand == VP_COMMAND_GET) {
- if((vp->dwTVStandard&VP_TV_STANDARD_WIN_VGA)
+ if (vp->dwCommand == VP_COMMAND_GET) {
+ if ((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;
}
@@ -720,7 +721,7 @@ HANDLE WINAPI Mine_CreateFileA(LPCSTR p1, DWORD p2, DWORD p3, LPSECURITY_ATTRIBU
//CStringA fn(p1);
//fn.MakeLower();
//int i = fn.Find(".part");
- //if(i > 0 && i == fn.GetLength() - 5)
+ //if (i > 0 && i == fn.GetLength() - 5)
p3 |= FILE_SHARE_WRITE;
return Real_CreateFileA(p1, p2, p3, p4, p5, p6, p7);
@@ -774,7 +775,7 @@ 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)) {
+ if (fdwDetails == (MIXER_OBJECTF_HMIXER|MIXER_SETCONTROLDETAILSF_VALUE)) {
return MMSYSERR_NOERROR; // don't touch the mixer, kthx
}
return Real_mixerSetControlDetails(hmxobj, pmxcd, fdwDetails);
@@ -784,7 +785,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
+ if (IOCTL_DVD_GET_REGION == dwIoControlCode && lpOutBuffer
&& lpBytesReturned && *lpBytesReturned == sizeof(DVD_REGION)) {
DVD_REGION* pDVDRegion = (DVD_REGION*)lpOutBuffer;
pDVDRegion->SystemRegion = ~pDVDRegion->RegionData;
@@ -821,7 +822,7 @@ public:
CRenderedTextSubtitle s(&csLock);
s.Open(_T("../../Subtitles/libssf/demo/demo.ssa"), 1);
- for(int i = 2*60*1000+2000; i < 2*60*1000+17000; i += 10)
+ for (int i = 2*60*1000+2000; i < 2*60*1000+17000; i += 10)
{
memsetd(spd.bits, 0xff000000, spd.pitch*spd.h);
CRect bbox;
@@ -833,9 +834,9 @@ public:
ssf::CRenderer s(&csLock);
s.Open(_T("../../Subtitles/libssf/demo/demo.ssf"));
- for(int i = 2*60*1000+2000; i < 2*60*1000+17000; i += 40)
- //for(int i = 2*60*1000+2000; i < 2*60*1000+17000; i += 1000)
- //for(int i = 0; i < 5000; i += 40)
+ for (int i = 2*60*1000+2000; i < 2*60*1000+17000; i += 40)
+ //for (int i = 2*60*1000+2000; i < 2*60*1000+17000; i += 1000)
+ //for (int i = 0; i < 5000; i += 40)
{
memsetd(spd.bits, 0xff000000, spd.pitch*spd.h);
CRect bbox;
@@ -905,7 +906,7 @@ BOOL CMPlayerCApp::InitInstance()
}
#endif
- if(SetHeapOptions()) {
+ if (SetHeapOptions()) {
TRACE(_T("Terminate on corruption enabled\n"));
} else {
CString heap_err;
@@ -943,7 +944,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;
}
@@ -959,19 +960,19 @@ 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 {
StoreSettingsToRegistry();
@@ -979,23 +980,23 @@ BOOL CMPlayerCApp::InitInstance()
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))) {
+ for (int i = 0; i < (int)mf.GetCount(); i++) {
+ if (!mf[i].GetLabel().CompareNoCase(ResStr(IDS_AG_PLAYLIST_FILE))) {
continue;
}
@@ -1003,8 +1004,8 @@ BOOL CMPlayerCApp::InitInstance()
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);
}
}
@@ -1014,13 +1015,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);
}
}
@@ -1047,19 +1048,19 @@ BOOL CMPlayerCApp::InitInstance()
m_mutexOneInstance.Create(NULL, TRUE, MPC_WND_CLASS_NAME);
- if(GetLastError() == ERROR_ALREADY_EXISTS
+ if (GetLastError() == ERROR_ALREADY_EXISTS
&& (!(m_s.fAllowMultipleInst || (m_s.nCLSwitches&CLSW_NEW) || m_cmdln.IsEmpty())
|| (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);
}
@@ -1071,13 +1072,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();
@@ -1100,11 +1101,11 @@ BOOL CMPlayerCApp::InitInstance()
pFrame->UpdateWindow();
pFrame->m_hAccelTable = m_s.hAccel;
m_s.WinLircClient.SetHWND(m_pMainWnd->m_hWnd);
- if(m_s.fWinLirc) {
+ if (m_s.fWinLirc) {
m_s.WinLircClient.Connect(m_s.strWinLircAddr);
}
m_s.UIceClient.SetHWND(m_pMainWnd->m_hWnd);
- if(m_s.fUIce) {
+ if (m_s.fUIce) {
m_s.UIceClient.Connect(m_s.strUIceAddr);
}
@@ -1128,7 +1129,7 @@ UINT CMPlayerCApp::GetRemoteControlCodeMicrosoft(UINT nInputcode, HRAWINPUT hRaw
pRawBuffer = DNew BYTE[dwSize];
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);
}
}
@@ -1151,7 +1152,7 @@ UINT CMPlayerCApp::GetRemoteControlCodeSRM7500(UINT nInputcode, HRAWINPUT hRawIn
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 :
@@ -1230,7 +1231,7 @@ void CMPlayerCApp::RegisterHotkeys()
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) {
RegisterHotKey(m_pMainWnd->m_hWnd, wc.appcmd, 0, GetVKFromAppCommand (wc.appcmd));
@@ -1244,7 +1245,7 @@ void CMPlayerCApp::UnregisterHotkeys()
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) {
UnregisterHotKey(m_pMainWnd->m_hWnd, wc.appcmd);
@@ -1340,12 +1341,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;
}
@@ -1379,7 +1380,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"));
}
@@ -1390,13 +1391,13 @@ void CRemoteCtrlClient::OnClose(int nErrorCode)
void CRemoteCtrlClient::OnReceive(int nErrorCode)
{
- if(nErrorCode != 0 || !m_pWnd) {
+ if (nErrorCode != 0 || !m_pWnd) {
return;
}
CStringA str;
int ret = Receive(str.GetBuffer(256), 255, 0);
- if(ret <= 0) {
+ if (ret <= 0) {
return;
}
str.ReleaseBuffer(ret);
@@ -1411,7 +1412,7 @@ void CRemoteCtrlClient::OnReceive(int nErrorCode)
void CRemoteCtrlClient::ExecuteCommand(CStringA cmd, int repcnt)
{
cmd.Trim();
- if(cmd.IsEmpty()) {
+ if (cmd.IsEmpty()) {
return;
}
cmd.Replace(' ', '_');
@@ -1419,11 +1420,11 @@ void CRemoteCtrlClient::ExecuteCommand(CStringA cmd, int repcnt)
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)
+ 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))) {
CAutoLock cAutoLock(&m_csLock);
TRACE(_T("CRemoteCtrlClient (calling command): %s\n"), wc.GetName());
@@ -1444,12 +1445,12 @@ void CWinLircClient::OnCommand(CStringA str)
TRACE(_T("CWinLircClient (OnCommand): %s\n"), CString(str));
int i = 0, j = 0, repcnt = 0;
- for(CStringA token = str.Tokenize(" ", i);
+ for (CStringA token = str.Tokenize(" ", i);
!token.IsEmpty();
token = str.Tokenize(" ", i), j++) {
- if(j == 1) {
+ if (j == 1) {
repcnt = strtol(token, NULL, 16);
- } else if(j == 2) {
+ } else if (j == 2) {
ExecuteCommand(token, repcnt);
}
}
@@ -1467,12 +1468,12 @@ void CUIceClient::OnCommand(CStringA str)
CStringA cmd;
int i = 0, j = 0;
- for(CStringA token = str.Tokenize("|", i);
+ for (CStringA token = str.Tokenize("|", i);
!token.IsEmpty();
token = str.Tokenize("|", i), j++) {
- if(j == 0) {
+ if (j == 0) {
cmd = token;
- } else if(j == 1) {
+ } else if (j == 1) {
ExecuteCommand(cmd, strtol(token, NULL, 16));
}
}
@@ -1495,7 +1496,7 @@ void GetCurDispMode(dispmode& dm, CString& DisplayName)
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);
@@ -1515,7 +1516,7 @@ bool GetDispMode(int i, dispmode& dm, CString& DisplayName)
monitor = monitors.GetNearestMonitor(AfxGetApp()->m_pMainWnd);
monitor.GetName(DisplayName1);
}
- if(!EnumDisplaySettings(DisplayName1, i, &devmode)) {
+ if (!EnumDisplaySettings(DisplayName1, i, &devmode)) {
return(false);
}
dm.fValid = true;
@@ -1534,7 +1535,7 @@ void SetDispMode(dispmode& dm, CString& DisplayName)
return;
}
- if(!dm.fValid) {
+ if (!dm.fValid) {
return;
}
DEVMODE dmScreenSettings;
@@ -1553,7 +1554,7 @@ void SetDispMode(dispmode& dm, CString& DisplayName)
monitor = monitors.GetNearestMonitor(AfxGetApp()->m_pMainWnd);
monitor.GetName(DisplayName1);
}
- if(AfxGetAppSettings().fRestoreResAfterExit) {
+ if (AfxGetAppSettings().fRestoreResAfterExit) {
ChangeDisplaySettingsEx(DisplayName1, &dmScreenSettings, NULL, CDS_FULLSCREEN, NULL);
} else {
ChangeDisplaySettingsEx(DisplayName1, &dmScreenSettings, NULL, NULL, NULL);
@@ -1569,7 +1570,7 @@ void SetAudioRenderer(int AudioDevNo)
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);
@@ -1604,13 +1605,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);
@@ -1619,13 +1620,13 @@ 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) {
+ if (url.CompareNoCase(_T("asf path")) == 0) {
continue;
}
CUrl dst;
dst.CrackUrl(CString(url));
- if(_tcsicmp(src.GetSchemeName(), dst.GetSchemeName())
+ if (_tcsicmp(src.GetSchemeName(), dst.GetSchemeName())
|| _tcsicmp(src.GetHostName(), dst.GetHostName())
|| _tcsicmp(src.GetUrlPath(), dst.GetUrlPath())) {
urls.AddTail(url);
@@ -1645,20 +1646,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);
@@ -1667,20 +1668,20 @@ 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"))) {
+ if (!fn2.CompareNoCase(_T("asf path"))) {
continue;
}
- if(fn2.Find(_T("EXTM3U")) == 0 || fn2.Find(_T("#EXTINF")) == 0) {
+ 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;
}
@@ -1696,18 +1697,18 @@ 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 "";
}
@@ -1717,18 +1718,18 @@ CStringA GetContentType(CString fn, CAtlList<CString>* redir)
ULONG len = 256+1;
CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), KEY_READ)
+ 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)) {
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"))
+ if (!Explode(sl.GetNext(pos), sl2, '=', 2).CompareNoCase(_T("http"))
&& sl2.GetCount() == 2) {
ProxyServer = sl2.GetTail();
break;
@@ -1737,20 +1738,20 @@ CStringA GetContentType(CString fn, CAtlList<CString>* redir)
}
ProxyServer = Explode(ProxyServer, sl, ':');
- if(sl.GetCount() > 1) {
+ if (sl.GetCount() > 1) {
ProxyPort = _tcstol(sl.GetTail(), NULL, 10);
}
}
CSocket s;
s.Create();
- if(s.Connect(
+ if (s.Connect(
ProxyEnable ? ProxyServer : url.GetHostName(),
ProxyEnable ? ProxyPort : url.GetPortNumber())) {
CStringA host = CStringA(url.GetHostName());
CStringA path = CStringA(url.GetUrlPath()) + CStringA(url.GetExtraInfo());
- if(ProxyEnable) {
+ if (ProxyEnable) {
path = "http://" + host + path;
}
@@ -1764,20 +1765,20 @@ CStringA GetContentType(CString fn, CAtlList<CString>* redir)
// MessageBox(NULL, CString(hdr), _T("Sending..."), MB_OK);
- if(s.Send((LPCSTR)hdr, hdr.GetLength()) < hdr.GetLength()) {
+ 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()) {
+ 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;
@@ -1789,73 +1790,73 @@ CStringA GetContentType(CString fn, CAtlList<CString>* redir)
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()) {
+ 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()) {
+ 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")) {
+ if (ext == _T(".asx")) {
ct = _T("video/x-ms-asf");
- } else if(ext == _T(".pls")) {
+ } else if (ext == _T(".pls")) {
ct = _T("audio/x-scpls");
- } else if(ext == _T(".m3u")) {
+ } else if (ext == _T(".m3u")) {
ct = _T("audio/x-mpegurl");
- } else if(ext == _T(".qtl")) {
+ } else if (ext == _T(".qtl")) {
ct = _T("application/x-quicktimeplayer");
- } else if(ext == _T(".mpcpl")) {
+ } else if (ext == _T(".mpcpl")) {
ct = _T("application/x-mpc-playlist");
- } else if(ext == _T(".bdmv")) {
+ } else if (ext == _T(".bdmv")) {
ct = _T("application/x-bdmv-playlist");
}
- if(FILE* f = _tfopen(fn, _T("rb"))) {
+ if (FILE* f = _tfopen(fn, _T("rb"))) {
CStringA str;
str.ReleaseBufferSetLength(fread(str.GetBuffer(10240), 1, 10240, f));
body = AToT(str);
@@ -1863,55 +1864,55 @@ 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) {
+ if (!body.IsEmpty()) {
+ if (fn.Find(_T("://")) >= 0) {
FindRedir(url, ct, body, *redir, res);
} else {
FindRedir(fn, ct, *redir, res);
@@ -2084,7 +2085,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;
}
@@ -2095,7 +2096,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;
}
diff --git a/src/apps/mplayerc/mplayerc.rc b/src/apps/mplayerc/mplayerc.rc
index 592df3083..48401a6e1 100644
--- a/src/apps/mplayerc/mplayerc.rc
+++ b/src/apps/mplayerc/mplayerc.rc
Binary files differ
diff --git a/src/apps/mplayerc/res/shaders/BT601BT709.psh b/src/apps/mplayerc/res/shaders/BT601BT709.psh
index 04662ee05..fd5f8406e 100644
--- a/src/apps/mplayerc/res/shaders/BT601BT709.psh
+++ b/src/apps/mplayerc/res/shaders/BT601BT709.psh
@@ -3,14 +3,13 @@ float4 p0 : register(c0);
#define height (p0[1])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
// original pixel
float4 c0 = tex2D(s0,tex);
// uncomment to activate for HD only
/*
- if(height > 719)
+ if (height > 719)
{
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/EdgeSharpen.psh b/src/apps/mplayerc/res/shaders/EdgeSharpen.psh
index 78956d698..14c0e4679 100644
--- a/src/apps/mplayerc/res/shaders/EdgeSharpen.psh
+++ b/src/apps/mplayerc/res/shaders/EdgeSharpen.psh
@@ -1,56 +1,53 @@
sampler s0 : register(s0);
float4 p0 : register(c0);
-#define width (p0[0])
-#define height (p0[1])
-
-#define NbPixel 1
-
-#define Edge_threshold 0.2
-
-#define Sharpen_val0 2.0
-#define Sharpen_val1 0.125
-
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
-// taille de NbPixel pixels
-float dx = NbPixel/width;
-float dy = NbPixel/height;
-float4 Res = 0;
-
-// Détection de contour par Prewitt
- // récuppération des 9 points
- // [ 1, 2, 3 ]
- // [ 4, 0, 5 ]
- // [ 6, 7, 8 ]
- float4 c0 = tex2D(s0, tex);
- float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
- float4 c2 = tex2D(s0, tex + float2(0,-dy));
- float4 c3 = tex2D(s0, tex + float2(dx,-dy));
- float4 c4 = tex2D(s0, tex + float2(-dx,0));
- float4 c5 = tex2D(s0, tex + float2(dx,0));
- float4 c6 = tex2D(s0, tex + float2(-dx,dy));
- float4 c7 = tex2D(s0, tex + float2(0,dy));
- float4 c8 = tex2D(s0, tex + float2(dx,dy));
-
- // Calcul des 3 vecteurs dérivé (hor,vert, diag1, diag2)
- float4 delta1 = (c6+c4+c1-c3-c5-c8);
- float4 delta2 = (c4+c1+c2-c5-c8-c7);
- float4 delta3 = (c1+c2+c3-c8-c7-c6);
- float4 delta4 = (c2+c3+c5-c7-c6-c4);
-
- // calcul du Prewitt
- float value = length(abs(delta1) + abs(delta2) + abs(delta3) + abs(delta4))/6;
-
-// Si c'est un contour (vector lenght > Edge_threshold) => filtre de sharpen
- if(value > Edge_threshold )
- {
- Res = c0 * Sharpen_val0 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * Sharpen_val1 ;
- // Pour voir les contour en rouge ...
- //Res = float4( 1.0, 0.0, 0.0, 0.0 );
-
- return Res;
- }
- else
- return c0;
+#define width (p0[0])
+#define height (p0[1])
+
+#define NbPixel 1
+
+#define Edge_threshold 0.2
+
+#define Sharpen_val0 2.0
+#define Sharpen_val1 0.125
+
+float4 main(float2 tex : TEXCOORD0) : COLOR {
+ // taille de NbPixel pixels
+ float dx = NbPixel/width;
+ float dy = NbPixel/height;
+ float4 Res = 0;
+
+ // Détection de contour par Prewitt
+ // récuppération des 9 points
+ // [ 1, 2, 3 ]
+ // [ 4, 0, 5 ]
+ // [ 6, 7, 8 ]
+ float4 c0 = tex2D(s0, tex);
+ float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
+ float4 c2 = tex2D(s0, tex + float2(0,-dy));
+ float4 c3 = tex2D(s0, tex + float2(dx,-dy));
+ float4 c4 = tex2D(s0, tex + float2(-dx,0));
+ float4 c5 = tex2D(s0, tex + float2(dx,0));
+ float4 c6 = tex2D(s0, tex + float2(-dx,dy));
+ float4 c7 = tex2D(s0, tex + float2(0,dy));
+ float4 c8 = tex2D(s0, tex + float2(dx,dy));
+
+ // Calcul des 3 vecteurs dérivé (hor,vert, diag1, diag2)
+ float4 delta1 = (c6+c4+c1-c3-c5-c8);
+ float4 delta2 = (c4+c1+c2-c5-c8-c7);
+ float4 delta3 = (c1+c2+c3-c8-c7-c6);
+ float4 delta4 = (c2+c3+c5-c7-c6-c4);
+
+ // calcul du Prewitt
+ float value = length(abs(delta1) + abs(delta2) + abs(delta3) + abs(delta4))/6;
+
+ // Si c'est un contour (vector lenght > Edge_threshold) => filtre de sharpen
+ if (value > Edge_threshold) {
+ Res = c0 * Sharpen_val0 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * Sharpen_val1;
+ // Pour voir les contour en rouge ...
+ //Res = float4( 1.0, 0.0, 0.0, 0.0 );
+
+ return Res;
+ } else
+ { return c0; }
} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/SharpenComplex.psh b/src/apps/mplayerc/res/shaders/SharpenComplex.psh
index 5d2db1a05..7341a1ab0 100644
--- a/src/apps/mplayerc/res/shaders/SharpenComplex.psh
+++ b/src/apps/mplayerc/res/shaders/SharpenComplex.psh
@@ -4,8 +4,7 @@ float4 p1 : register(c1);
#define dx (p1[0])
#define dy (p1[1])
-float4 main( float2 tex : TEXCOORD0 ) : COLOR
-{
+float4 main( float2 tex : TEXCOORD0 ) : COLOR {
// definition des pixels : original, flouté, corigé, final
float4 ori;
float4 flou;
@@ -54,13 +53,13 @@ float4 main( float2 tex : TEXCOORD0 ) : COLOR
delta2 = (c6 + 2*c7 + c8)-(c1 + 2*c2 + c3);
// calcul
- value = sqrt( mul(delta1,delta1) + mul(delta2,delta2) ) ;
+ value = sqrt( mul(delta1,delta1) + mul(delta2,delta2) );
- if( value >.3 ) {
+ if (value >.3) {
// si contour, sharpen
#define Sharpen_val0 2.0
#define Sharpen_val1 0.125
- final = ori*2 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * 0.125 ;
+ final = ori*2 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * 0.125;
//final= float4(1,0,0,0);
return final;
}
diff --git a/src/apps/mplayerc/res/shaders/SharpenComplex2.psh b/src/apps/mplayerc/res/shaders/SharpenComplex2.psh
index 6f930bdd3..ec441a885 100644
--- a/src/apps/mplayerc/res/shaders/SharpenComplex2.psh
+++ b/src/apps/mplayerc/res/shaders/SharpenComplex2.psh
@@ -26,10 +26,9 @@ float4 p1 : register(c1);
#define Sharpen_val0 2
#define Sharpen_val1 ((Sharpen_val0-1) / 8.0)
-float4 main( float2 tex : TEXCOORD0 ) : COLOR
-{
+float4 main( float2 tex : TEXCOORD0 ) : COLOR {
// recup du pixel original
- float4 ori = tex2D(s0, tex); ;
+ float4 ori = tex2D(s0, tex);
// calcul image floue (filtre gaussien)
float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
@@ -53,10 +52,10 @@ float4 main( float2 tex : TEXCOORD0 ) : COLOR
float4 cori = CoefOri*ori - CoefFlou*flou;
// détection des contours
- // récuppération des 9 voisins
- // [ c1, c2 , c3 ]
- // [ c4,ori , c5 ]
- // [ c6, c7 , c8 ]
+ // récuppération des 9 voisins
+ // [ c1, c2 , c3 ]
+ // [ c4,ori , c5 ]
+ // [ c6, c7 , c8 ]
c1 = tex2D(s0, tex + float2(-px,-py));
c2 = tex2D(s0, tex + float2(0,-py));
c3 = tex2D(s0, tex + float2(px,-py));
@@ -80,10 +79,10 @@ float4 main( float2 tex : TEXCOORD0 ) : COLOR
float delta2 = (c6 + 2*c7 + c8)-(c1 + 2*c2 + c3);
// calcul
- if( sqrt( mul(delta1,delta1) + mul(delta2,delta2) ) >SharpenEdge ) {
+ if (sqrt( mul(delta1,delta1) + mul(delta2,delta2)) > SharpenEdge) {
// si contour, sharpen
//return float4(1,0,0,0);
- return ori*Sharpen_val0 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * Sharpen_val1 ;
+ return ori*Sharpen_val0 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * Sharpen_val1;
} else {
// sinon, image corrigée
return cori;
diff --git a/src/apps/mplayerc/res/shaders/YV12ChromaUpsampling.psh b/src/apps/mplayerc/res/shaders/YV12ChromaUpsampling.psh
index 172c4ed87..9b48206d7 100644
--- a/src/apps/mplayerc/res/shaders/YV12ChromaUpsampling.psh
+++ b/src/apps/mplayerc/res/shaders/YV12ChromaUpsampling.psh
@@ -2,11 +2,11 @@
YV12 chroma upsampling fixer
by Kurt Bernhard 'Leak' Pruenner
-Use with YV12 output if the half-resolution chroma
+Use with YV12 output if the half-resolution chroma
gets upsampled in hardware by doubling the values
instead of interpolating between them.
-(i.e. if you're getting blocky red edges on dark
+(i.e. if you're getting blocky red edges on dark
backgrounds...)
*/
@@ -21,41 +21,38 @@ float4 getPixel(float2 tex, float dx, float dy)
{
tex.x+=dx;
tex.y+=dy;
-
+
return tex2D(s0, tex);
}
float4 rgb2yuv(float4 rgb)
{
- float4x4 coeffs=
- {
- 0.299, 0.587, 0.114, 0.000,
- -0.147,-0.289, 0.436, 0.000,
- 0.615,-0.515,-0.100, 0.000,
- 0.000, 0.000, 0.000, 0.000
- };
-
+ float4x4 coeffs= {
+ 0.299, 0.587, 0.114, 0.000,
+ -0.147,-0.289, 0.436, 0.000,
+ 0.615,-0.515,-0.100, 0.000,
+ 0.000, 0.000, 0.000, 0.000
+ };
+
return mul(coeffs,rgb);
}
float4 yuv2rgb(float4 yuv)
{
- float4x4 coeffs=
- {
- 1.000, 0.000, 1.140, 0.000,
- 1.000,-0.395,-0.581, 0.000,
- 1.000, 2.032, 0.000, 0.000,
- 0.000, 0.000, 0.000, 0.000
- };
-
+ float4x4 coeffs= {
+ 1.000, 0.000, 1.140, 0.000,
+ 1.000,-0.395,-0.581, 0.000,
+ 1.000, 2.032, 0.000, 0.000,
+ 0.000, 0.000, 0.000, 0.000
+ };
+
return mul(coeffs,yuv);
}
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float dx=1/width;
float dy=1/height;
-
+
float4 yuv00=rgb2yuv(getPixel(tex,-dx,-dy));
float4 yuv01=rgb2yuv(getPixel(tex,-dx, 0));
float4 yuv02=rgb2yuv(getPixel(tex,-dx, dy));
@@ -67,10 +64,10 @@ float4 main(float2 tex : TEXCOORD0) : COLOR
float4 yuv22=rgb2yuv(getPixel(tex, dx, dy));
float4 yuv=
- (yuv00*1+yuv01*2+yuv02*1+
- yuv10*2+yuv11*4+yuv12*2+
- yuv20*1+yuv21*2+yuv22*1)/16;
-
+ (yuv00*1+yuv01*2+yuv02*1+
+ yuv10*2+yuv11*4+yuv12*2+
+ yuv20*1+yuv21*2+yuv22*1)/16;
+
yuv.r=yuv11.r;
return yuv2rgb(yuv);
diff --git a/src/apps/mplayerc/res/shaders/contour.psh b/src/apps/mplayerc/res/shaders/contour.psh
index b89e96198..8fd122ee4 100644
--- a/src/apps/mplayerc/res/shaders/contour.psh
+++ b/src/apps/mplayerc/res/shaders/contour.psh
@@ -4,20 +4,20 @@ float4 p0 : register(c0);
#define width (p0[0])
#define height (p0[1])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float dx = 4/width;
float dy = 4/height;
-
+
float4 c2 = tex2D(s0, tex + float2(0,-dy));
float4 c4 = tex2D(s0, tex + float2(-dx,0));
float4 c5 = tex2D(s0, tex + float2(0,0));
float4 c6 = tex2D(s0, tex + float2(dx,0));
float4 c8 = tex2D(s0, tex + float2(0,dy));
-
+
float4 c0 = (-c2-c4+c5*4-c6-c8);
- if(length(c0) < 1.0) c0 = float4(0,0,0,0);
- else c0 = float4(1,1,1,0);
-
+ if (length(c0) < 1.0) {
+ c0 = float4(0,0,0,0);
+ } else { c0 = float4(1,1,1,0); }
+
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/deinterlace (blend).psh b/src/apps/mplayerc/res/shaders/deinterlace (blend).psh
index 51a6be5f3..0e955f3a2 100644
--- a/src/apps/mplayerc/res/shaders/deinterlace (blend).psh
+++ b/src/apps/mplayerc/res/shaders/deinterlace (blend).psh
@@ -4,14 +4,13 @@ float4 p0 : register(c0);
#define width (p0[0])
#define height (p0[1])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = tex2D(s0, tex);
-
+
float2 h = float2(0, 1/height);
float4 c1 = tex2D(s0, tex-h);
float4 c2 = tex2D(s0, tex+h);
c0 = (c0*2+c1+c2)/4;
-
+
return c0;
} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/denoise.psh b/src/apps/mplayerc/res/shaders/denoise.psh
index 0394081b0..78b1e3716 100644
--- a/src/apps/mplayerc/res/shaders/denoise.psh
+++ b/src/apps/mplayerc/res/shaders/denoise.psh
@@ -5,22 +5,20 @@ float4 p0 : register(c0);
#define height (p0[1])
#define val0 (1.0)
-#define val1 (0.125)
+#define val1 (0.125)
#define effect_width (0.1)
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float dx = 0.0f;
float dy = 0.0f;
- float fTap = effect_width;
+ float fTap = effect_width;
float4 cAccum = tex2D(s0, tex) * val0;
- for ( int iDx = 0 ; iDx < 16; ++iDx )
- {
- dx = fTap /width;
- dy = fTap /height;
+ for ( int iDx = 0 ; iDx < 16; ++iDx ) {
+ dx = fTap /width;
+ dy = fTap /height;
cAccum += tex2D(s0, tex + float2(-dx,-dy)) * val1;
cAccum += tex2D(s0, tex + float2(0,-dy)) * val1;
@@ -30,9 +28,9 @@ float4 main(float2 tex : TEXCOORD0) : COLOR
cAccum += tex2D(s0, tex + float2(dx,dy)) * val1;
cAccum += tex2D(s0, tex + float2(-dx,+dy)) * val1;
cAccum += tex2D(s0, tex + float2(+dx,-dy)) * val1;
-
+
fTap += 0.1f;
}
-
+
return(cAccum/16.0f);
} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/emboss.psh b/src/apps/mplayerc/res/shaders/emboss.psh
index a0053996c..2d9c535c2 100644
--- a/src/apps/mplayerc/res/shaders/emboss.psh
+++ b/src/apps/mplayerc/res/shaders/emboss.psh
@@ -4,20 +4,19 @@ float4 p0 : register(c0);
#define width (p0[0])
#define height (p0[1])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float dx = 1/width;
float dy = 1/height;
-
+
float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
float4 c2 = tex2D(s0, tex + float2(0,-dy));
float4 c4 = tex2D(s0, tex + float2(-dx,0));
float4 c6 = tex2D(s0, tex + float2(dx,0));
float4 c8 = tex2D(s0, tex + float2(0,dy));
float4 c9 = tex2D(s0, tex + float2(dx,dy));
-
+
float4 c0 = (-c1-c2-c4+c6+c8+c9);
c0 = (c0.r+c0.g+c0.b)/3 + 0.5;
-
+
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/empty.psh b/src/apps/mplayerc/res/shaders/empty.psh
index 3d0ab987a..e15b71b6b 100644
--- a/src/apps/mplayerc/res/shaders/empty.psh
+++ b/src/apps/mplayerc/res/shaders/empty.psh
@@ -11,9 +11,8 @@ float4 p1 : register(c1);
#define PI acos(-1)
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = tex2D(s0, tex);
-
+
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/final.psh b/src/apps/mplayerc/res/shaders/final.psh
index 96eccb562..c39b5078e 100644
--- a/src/apps/mplayerc/res/shaders/final.psh
+++ b/src/apps/mplayerc/res/shaders/final.psh
@@ -17,8 +17,7 @@ static const float LUT3D_SCALE = (LUT3D_SIZE - 1.0f) / LUT3D_SIZE;
static const float LUT3D_OFFSET = 1.0f / (2.0f * LUT3D_SIZE);
#endif
-float4 main(float2 imageCoord : TEXCOORD0) : COLOR
-{
+float4 main(float2 imageCoord : TEXCOORD0) : COLOR {
float4 pixel = tex2D(image, imageCoord);
#if LUT3D_ENABLED
diff --git a/src/apps/mplayerc/res/shaders/grayscale.psh b/src/apps/mplayerc/res/shaders/grayscale.psh
index 46952b3d2..c337021ed 100644
--- a/src/apps/mplayerc/res/shaders/grayscale.psh
+++ b/src/apps/mplayerc/res/shaders/grayscale.psh
@@ -1,8 +1,7 @@
sampler s0 : register(s0);
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float c0 = dot(tex2D(s0, tex), float4(0.299, 0.587, 0.114, 0));
-
+
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/invert.psh b/src/apps/mplayerc/res/shaders/invert.psh
index 902391b81..54eb8b9e0 100644
--- a/src/apps/mplayerc/res/shaders/invert.psh
+++ b/src/apps/mplayerc/res/shaders/invert.psh
@@ -1,8 +1,7 @@
sampler s0 : register(s0);
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = float4(1, 1, 1, 1) - tex2D(s0, tex);
-
+
return c0;
} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/letterbox.psh b/src/apps/mplayerc/res/shaders/letterbox.psh
index 63c70aef2..bb3cd0fe0 100644
--- a/src/apps/mplayerc/res/shaders/letterbox.psh
+++ b/src/apps/mplayerc/res/shaders/letterbox.psh
@@ -4,15 +4,15 @@ float4 p0 : register(c0);
#define width (p0[0])
#define height (p0[1])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = 0;
-
+
float2 ar = float2(16, 9);
float h = (1 - width/height * ar.y/ar.x) / 2;
-
- if(tex.y >= h && tex.y <= 1-h)
+
+ if (tex.y >= h && tex.y <= 1-h) {
c0 = tex2D(s0, tex);
-
+ }
+
return c0;
} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/levels.psh b/src/apps/mplayerc/res/shaders/levels.psh
index 62e7ca672..aa4201f80 100644
--- a/src/apps/mplayerc/res/shaders/levels.psh
+++ b/src/apps/mplayerc/res/shaders/levels.psh
@@ -3,8 +3,7 @@ sampler s0 : register(s0);
#define const_1 (16.0/255.0)
#define const_2 (255.0/219.0)
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
// original pixel
float4 c0 = tex2D(s0,tex);
diff --git a/src/apps/mplayerc/res/shaders/levels2.psh b/src/apps/mplayerc/res/shaders/levels2.psh
index 047509979..86cc6d03a 100644
--- a/src/apps/mplayerc/res/shaders/levels2.psh
+++ b/src/apps/mplayerc/res/shaders/levels2.psh
@@ -7,13 +7,12 @@ float4 p0 : register(c0);
#define const_1 (16.0/255.0)
#define const_2 (255.0/219.0)
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
// original pixel
float4 c0 = tex2D(s0,tex);
/* ATI driver only looks at the height */
- if(height >= 720 ) {
+ if (height >= 720 ) {
return c0;
} else {
return((c0 - const_1) * const_2);
diff --git a/src/apps/mplayerc/res/shaders/levels3.psh b/src/apps/mplayerc/res/shaders/levels3.psh
index d88796645..952a8bdf0 100644
--- a/src/apps/mplayerc/res/shaders/levels3.psh
+++ b/src/apps/mplayerc/res/shaders/levels3.psh
@@ -3,8 +3,7 @@ sampler s0 : register(s0);
#define const_1 (16.0/255.0)
#define const_2 (219.0/255.0)
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
// original pixel
float4 c0 = tex2D(s0,tex);
diff --git a/src/apps/mplayerc/res/shaders/nightvision.psh b/src/apps/mplayerc/res/shaders/nightvision.psh
index 1fc4adfee..c887b5622 100644
--- a/src/apps/mplayerc/res/shaders/nightvision.psh
+++ b/src/apps/mplayerc/res/shaders/nightvision.psh
@@ -1,7 +1,6 @@
sampler s0 : register(s0);
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float c = dot(tex2D(s0, tex), float4(0.2, 0.6, 0.1, 0.1));
return float4(0,c,0,0);
}
diff --git a/src/apps/mplayerc/res/shaders/procamp.psh b/src/apps/mplayerc/res/shaders/procamp.psh
index ec331d6bd..4016f444c 100644
--- a/src/apps/mplayerc/res/shaders/procamp.psh
+++ b/src/apps/mplayerc/res/shaders/procamp.psh
@@ -11,19 +11,17 @@ float4 p1 : register(c1);
#define PI acos(-1)
-static float4x4 r2y =
-{
+static float4x4 r2y = {
0.299, 0.587, 0.114, 0,
-0.147, -0.289, 0.437, 0,
0.615, -0.515, -0.100, 0,
0, 0, 0, 0
};
-static float4x4 y2r =
-{
- 1.0, 0.0, 1.140, 0,
+static float4x4 y2r = {
+ 1.0, 0.0, 1.140, 0,
1.0, -0.394, -0.581, 0,
- 1.0, 2.028, 0.0, 0,
+ 1.0, 2.028, 0.0, 0,
0, 0, 0, 0
};
@@ -44,18 +42,16 @@ static float4x4 y2r =
// #define Brightness (-ymin)
// #define Contrast (1.0/(ymax-ymin))
-static float2x2 HueMatrix =
-{
+static float2x2 HueMatrix = {
cos(Hue * PI / 180), sin(Hue * PI / 180),
-sin(Hue * PI / 180), cos(Hue * PI / 180)
};
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = tex2D(s0, tex);
c0 = mul(r2y, c0);
c0.r = Contrast * (c0.r - ymin) + ymin + Brightness;
c0.gb = mul(HueMatrix, c0.gb) * Saturation;
c0 = mul(y2r, c0);
- return c0;
+ return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/resizer.psh b/src/apps/mplayerc/res/shaders/resizer.psh
index 66cd0bb27..31c6be47b 100644
--- a/src/apps/mplayerc/res/shaders/resizer.psh
+++ b/src/apps/mplayerc/res/shaders/resizer.psh
@@ -5,19 +5,18 @@ sampler s2 : register(s2);
sampler s3 : register(s3);
sampler s4 : register(s4);
-float4 dxdy05 : register(c0);
+float4 dxdy05 : register(c0);
float2 dxdy : register(c1);
float2 dx : register(c2);
float2 dy : register(c3);
#define A _The_Value_Of_A_Is_Set_Here_
-// none of the resizers here can be used for 1:1 mapping!
+// none of the resizers here can be used for 1:1 mapping!
// tex * size won't be 0, 1, 2, 3, .. as you might expect, but something like 0, 0.999, 2.001, 2.999, ...
// this means when the fractional part becomes 0.999 we will be interpolating with the wrong value!!!
-struct PS_INPUT
-{
+struct PS_INPUT {
float2 t0 : TEXCOORD0;
float2 t1 : TEXCOORD1;
float2 t2 : TEXCOORD2;
@@ -25,9 +24,8 @@ struct PS_INPUT
float2 t4 : TEXCOORD4;
};
-float4 main_bilinear(PS_INPUT input) : COLOR
-{
- float2 PixelPos = input.t0;
+float4 main_bilinear(PS_INPUT input) : COLOR {
+ float2 PixelPos = input.t0;
float2 dd = frac(PixelPos);
float2 ExactPixel = PixelPos - dd;
float2 samplePos = ExactPixel*dxdy + dxdy05;
@@ -36,12 +34,11 @@ float4 main_bilinear(PS_INPUT input) : COLOR
lerp(tex2D(s0, samplePos), tex2D(s0, samplePos + dx), dd.x),
lerp(tex2D(s0, samplePos + dy), tex2D(s0, samplePos + dxdy), dd.x),
dd.y);
-
+
return c;
}
-static float4x4 tco =
-{
+static float4x4 tco = {
0, A, -2*A, A,
1, 0, -A-3, A+2,
0, -A, 2*A+3, -A-2,
@@ -63,7 +60,7 @@ float4 SampleX(float4 tx, float2 t0)
tex2D(s0, t0 + dx),
tex2D(s0, t0 + dx + dx)
)
- );
+ );
}
float4 SampleY(float4 tx, float4 ty, float2 t0)
@@ -76,12 +73,11 @@ float4 SampleY(float4 tx, float4 ty, float2 t0)
SampleX(tx, t0 + dy),
SampleX(tx, t0 + dy + dy)
)
- );
+ );
}
-float4 main_bicubic1pass(PS_INPUT input) : COLOR
-{
- float2 PixelPos = input.t0;
+float4 main_bicubic1pass(PS_INPUT input) : COLOR {
+ float2 PixelPos = input.t0;
float2 dd = frac(PixelPos);
float2 ExactPixel = PixelPos - dd;
float2 samplePos = ExactPixel*dxdy + dxdy05;
@@ -91,33 +87,31 @@ float4 main_bicubic1pass(PS_INPUT input) : COLOR
float4 Sample(float4 t, float2 samplePos, float2 sampleD)
{
return
- mul(t,
+ mul(t,
float4x4(
tex2D(s0, samplePos - sampleD),
tex2D(s0, samplePos),
tex2D(s0, samplePos + sampleD),
tex2D(s0, samplePos + sampleD + sampleD)
)
- );
+ );
}
-float4 main_bicubic2pass_pass1(PS_INPUT input) : COLOR
-{
- float2 PixelPos = input.t0;
+float4 main_bicubic2pass_pass1(PS_INPUT input) : COLOR {
+ float2 PixelPos = input.t0;
float2 dd = frac(PixelPos);
float2 ExactPixel = PixelPos - dd;
float2 samplePos = ExactPixel*dxdy + dxdy05;
-
+
return Sample(taps(dd.x), samplePos, dx);
}
-float4 main_bicubic2pass_pass2(PS_INPUT input) : COLOR
-{
- float2 PixelPos = input.t0;
+float4 main_bicubic2pass_pass2(PS_INPUT input) : COLOR {
+ float2 PixelPos = input.t0;
float2 dd = frac(PixelPos);
float2 ExactPixel = PixelPos - dd;
float2 samplePos = ExactPixel*dxdy + dxdy05;
-
+
return Sample(taps(dd.y), samplePos, dy);
}
diff --git a/src/apps/mplayerc/res/shaders/sharpen.psh b/src/apps/mplayerc/res/shaders/sharpen.psh
index 90d9ec4c2..b475576ad 100644
--- a/src/apps/mplayerc/res/shaders/sharpen.psh
+++ b/src/apps/mplayerc/res/shaders/sharpen.psh
@@ -2,29 +2,28 @@ sampler s0 : register(s0);
float4 p0 : register(c0);
float4 p1 : register(c1);
-#define width (p0[0])
-#define height (p0[1])
-
-#define effect_width (1.6)
-#define val0 (2.0)
-#define val1 (-0.125)
+#define width (p0[0])
+#define height (p0[1])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
- float dx = effect_width/width;
- float dy = effect_width/height;
-
- float4 c1 = tex2D(s0, tex + float2(-dx,-dy)) * val1;
- float4 c2 = tex2D(s0, tex + float2(0,-dy)) * val1;
- float4 c3 = tex2D(s0, tex + float2(-dx,0)) * val1;
- float4 c4 = tex2D(s0, tex + float2(dx,0)) * val1;
- float4 c5 = tex2D(s0, tex + float2(0,dy)) * val1;
- float4 c6 = tex2D(s0, tex + float2(dx,dy)) * val1;
- float4 c7 = tex2D(s0, tex + float2(-dx,+dy)) * val1;
- float4 c8 = tex2D(s0, tex + float2(+dx,-dy)) * val1;
- float4 c9 = tex2D(s0, tex) * val0;
-
- float4 c0 = (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9);
-
- return c0;
+#define effect_width (1.6)
+#define val0 (2.0)
+#define val1 (-0.125)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR {
+ float dx = effect_width/width;
+ float dy = effect_width/height;
+
+ float4 c1 = tex2D(s0, tex + float2(-dx,-dy)) * val1;
+ float4 c2 = tex2D(s0, tex + float2(0,-dy)) * val1;
+ float4 c3 = tex2D(s0, tex + float2(-dx,0)) * val1;
+ float4 c4 = tex2D(s0, tex + float2(dx,0)) * val1;
+ float4 c5 = tex2D(s0, tex + float2(0,dy)) * val1;
+ float4 c6 = tex2D(s0, tex + float2(dx,dy)) * val1;
+ float4 c7 = tex2D(s0, tex + float2(-dx,+dy)) * val1;
+ float4 c8 = tex2D(s0, tex + float2(+dx,-dy)) * val1;
+ float4 c9 = tex2D(s0, tex) * val0;
+
+ float4 c0 = (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9);
+
+ return c0;
} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/sphere.psh b/src/apps/mplayerc/res/shaders/sphere.psh
index 56276716c..d50422a46 100644
--- a/src/apps/mplayerc/res/shaders/sphere.psh
+++ b/src/apps/mplayerc/res/shaders/sphere.psh
@@ -5,50 +5,48 @@ float4 p0 : register(c0);
#define PI acos(-1)
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
// - this is a very simple raytracer, one sphere only
// - no reflection or refraction, yet (my ati 9800 has a 64 + 32 instruction limit...)
-
+
float3 pl = float3(3,-3,-4); // light pos
float4 cl = 0.4; // light color
-
+
float3 pc = float3(0,0,-1); // cam pos
float3 ps = float3(0,0,0.5); // sphere pos
float r = 0.65; // sphere radius
-
+
float3 pd = normalize(float3(tex.x-0.5, tex.y-0.5, 0) - pc);
-
+
float A = 1;
float B = 2*dot(pd, pc - ps);
float C = dot(pc - ps, pc - ps) - r*r;
float D = B*B - 4*A*C;
-
+
float4 c0 = 0;
-
- if(D >= 0)
- {
+
+ if (D >= 0) {
// t2 is the smaller, obviously...
// float t1 = (-B + sqrt(D)) / (2*A);
// float t2 = (-B - sqrt(D)) / (2*A);
- // float t = min(t1, t2);
-
+ // float t = min(t1, t2);
+
float t = (-B - sqrt(D)) / (2*A);
-
+
// intersection data
float3 p = pc + pd*t;
float3 n = normalize(p - ps);
float3 l = normalize(pl - p);
-
+
// mapping the image onto the sphere
- tex = acos(-n)/PI;
-
+ tex = acos(-n)/PI;
+
// rotate it
tex.x = frac(tex.x + frac(clock/10));
-
+
// diffuse + specular
c0 = tex2D(s0, tex) * dot(n, l) + cl * pow(max(dot(l, reflect(pd, n)), 0), 50);
}
-
+
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/spotlight.psh b/src/apps/mplayerc/res/shaders/spotlight.psh
index e6fae3aa0..746475064 100644
--- a/src/apps/mplayerc/res/shaders/spotlight.psh
+++ b/src/apps/mplayerc/res/shaders/spotlight.psh
@@ -7,12 +7,11 @@ float4 p0 : register(c0);
#define PI acos(-1)
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = tex2D(s0, tex);
float3 lightsrc = float3(sin(clock*PI/1.5)/2+0.5,cos(clock*PI)/2+0.5,1);
float3 light = normalize(lightsrc - float3(tex.x,tex.y,0));
c0 *= pow(dot(light, float3(0,0,1)), 50);
-
+
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/wave.psh b/src/apps/mplayerc/res/shaders/wave.psh
index 2bd7ff38d..16884aa8d 100644
--- a/src/apps/mplayerc/res/shaders/wave.psh
+++ b/src/apps/mplayerc/res/shaders/wave.psh
@@ -5,17 +5,15 @@ float4 p0 : register(c0);
#define height (p0[1])
#define clock (p0[3])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = 0;
-
+
tex.x += sin(tex.x+clock/0.3)/20;
tex.y += sin(tex.x+clock/0.3)/20;
-
- if(tex.x >= 0 && tex.x <= 1 && tex.y >= 0 && tex.y <= 1)
- {
+
+ if (tex.x >= 0 && tex.x <= 1 && tex.y >= 0 && tex.y <= 1) {
c0 = tex2D(s0, tex);
}
-
+
return c0;
}
diff --git a/src/apps/mplayerc/res/web/controls.html b/src/apps/mplayerc/res/web/controls.html
index 4b55cf79f..fbfe55541 100644
--- a/src/apps/mplayerc/res/web/controls.html
+++ b/src/apps/mplayerc/res/web/controls.html
@@ -26,7 +26,7 @@
var RL
var rpt
var etaup=false
-
+
if (eta==0) eta=(state<0 && filepath.length>0)?2:120;
function init()
@@ -91,7 +91,7 @@
function pad(number, length)
{
var str = '' + number;
- while(str.length < length) str = '0' + str;
+ while (str.length < length) str = '0' + str;
return str;
}
function secondsToTS(a,b,c)
@@ -104,7 +104,7 @@
var a2s = pad(a2.toString(),2);
var a3s = pad(a3.toString(),2);
var a4s = pad(a4.toString(),3);
- switch(b){
+ switch (b){
case 1: return a1s;
case 2: return a2s;
case 3: return a3s;
@@ -169,9 +169,9 @@
function timesyntax(ts)
{
var b=""
- for(a=0;a<ts.length;a++)
+ for (a=0;a<ts.length;a++)
{
- switch(ts.charAt(a)){
+ switch (ts.charAt(a)){
case "0": b+="0";break;
case "1": b+="1";break;
case "2": b+="2";break;
diff --git a/src/apps/mplayerc/res/web/index.html b/src/apps/mplayerc/res/web/index.html
index fcead5d73..e87270da4 100644
--- a/src/apps/mplayerc/res/web/index.html
+++ b/src/apps/mplayerc/res/web/index.html
@@ -10,7 +10,7 @@
of this web server in the future. You users can always come up with something.
</p>
<p>
- And if you are already here, why don't you try sending a few commands to MPC,
+ And if you are already here, why don't you try sending a few commands to MPC-HC,
just to see if it works :)
</p>
<p>
diff --git a/src/apps/mplayerc/res/web/player.html b/src/apps/mplayerc/res/web/player.html
index 035026c03..9edf1d63d 100644
--- a/src/apps/mplayerc/res/web/player.html
+++ b/src/apps/mplayerc/res/web/player.html
@@ -1,4 +1,4 @@
-<html>
+<html>
<head>
@@ -13,14 +13,14 @@ function getXMLHTTP()
try {return new ActiveXObject("Msxml2.XMLHTTP");}
catch(e) {try {return new ActiveXObject("Microsoft.XMLHTTP");}
catch(e) {}}
- if(typeof XMLHttpRequest != "undefined") {return new XMLHttpRequest();}
+ if (typeof XMLHttpRequest != "undefined") {return new XMLHttpRequest();}
return null;
}
function MakeRequest(req)
{
var httpRequest = getXMLHTTP();
-
+
try
{
httpRequest.open("GET", req, true);
@@ -33,8 +33,8 @@ function MakeRequest(req)
function urlencode(s)
{
- if(encodeURIComponent) return encodeURIComponent(s);
- if(escape) return escape(s);
+ if (encodeURIComponent) return encodeURIComponent(s);
+ if (escape) return escape(s);
return s; // whatever
}
@@ -48,18 +48,18 @@ function getOffsetX(m)
OnStatus = function(title, status, pos, posstr, dur, durstr, muted, volume)
{
var maxtitle = 70;
- if(title.length > maxtitle) title = title.substr(0, maxtitle-3) + '...';
+ if (title.length > maxtitle) title = title.substr(0, maxtitle-3) + '...';
var timestr = dur > 0 && posstr && durstr ? posstr + '&nbsp;/&nbsp;' + durstr : '&nbsp;';
- if(!dur || dur == 0) dur = 1;
+ if (!dur || dur == 0) dur = 1;
var sbpercent = Math.floor(100*pos/dur);
- if(e = document.getElementById('title')) e.innerHTML = title;
- if(e = document.getElementById('seekbarchleft')) e.width = sbpercent > 0 ? sbpercent + '%' : '1px';
- if(e = document.getElementById('seekbarchright')) e.width = sbpercent < 100 ? (100 - sbpercent) + '%' : '1px';
- if((e = document.getElementById('status')) && e.innerHTML != status) e.innerHTML = status;
- if((e = document.getElementById('timer')) && e.innerHTML != timestr) e.innerHTML = timestr;
- if(e = document.getElementById('controlvolumemute')) {url = 'url(controlvolume' + (muted?'off':'on') + '.png)'; if(e.style.backgroundImage != url) e.style.backgroundImage = url;}
- if(e = document.getElementById('controlvolumegrip'))
+ if (e = document.getElementById('title')) e.innerHTML = title;
+ if (e = document.getElementById('seekbarchleft')) e.width = sbpercent > 0 ? sbpercent + '%' : '1px';
+ if (e = document.getElementById('seekbarchright')) e.width = sbpercent < 100 ? (100 - sbpercent) + '%' : '1px';
+ if ((e = document.getElementById('status')) && e.innerHTML != status) e.innerHTML = status;
+ if ((e = document.getElementById('timer')) && e.innerHTML != timestr) e.innerHTML = timestr;
+ if (e = document.getElementById('controlvolumemute')) {url = 'url(controlvolume' + (muted?'off':'on') + '.png)'; if (e.style.backgroundImage != url) e.style.backgroundImage = url;}
+ if (e = document.getElementById('controlvolumegrip'))
{
volume = (document.getElementById('controlvolumebar').offsetWidth - e.offsetWidth) * volume / 100;
e.style.position = 'relative';
@@ -72,17 +72,17 @@ var httpRequestStatus;
function OnReadyStateChange()
{
- if(httpRequestStatus && httpRequestStatus.readyState == 4 && httpRequestStatus.responseText)
+ if (httpRequestStatus && httpRequestStatus.readyState == 4 && httpRequestStatus.responseText)
{
- if(httpRequestStatus.responseText.charAt(0) != "<") eval(httpRequestStatus.responseText);
+ if (httpRequestStatus.responseText.charAt(0) != "<") eval(httpRequestStatus.responseText);
else {alert(httpRequestStatus.responseText);}
httpRequestStatus = null;
- }
+ }
}
function StatusLoop()
{
- if(!httpRequestStatus || httpRequestStatus.readyState == 0)
+ if (!httpRequestStatus || httpRequestStatus.readyState == 0)
{
httpRequestStatus = getXMLHTTP();
@@ -96,7 +96,7 @@ function StatusLoop()
{
}
}
-
+
setTimeout("StatusLoop()", 500);
}
@@ -104,7 +104,7 @@ var snapshotcounter = 0;
function LoadSnapShot()
{
- if(img = document.getElementById('snapshot'))
+ if (img = document.getElementById('snapshot'))
{
img.src = 'snapshot.jpg' + '?' + snapshotcounter++;
}
@@ -123,15 +123,15 @@ function OnAbortErrorSnapShot(e)
function OnSeek(e)
{
left = right = 0;
- if(sb = document.getElementById('seekbarchleft')) left = getOffsetX(sb);
- if(sb = document.getElementById('seekbarchright')) {right = getOffsetX(sb) + sb.offsetWidth;}
- if(sb = document.getElementById('seekbargrip')) {left += sb.offsetWidth / 2; right -= sb.offsetWidth / 2;}
- if(left > 0 && left < right)
+ if (sb = document.getElementById('seekbarchleft')) left = getOffsetX(sb);
+ if (sb = document.getElementById('seekbarchright')) {right = getOffsetX(sb) + sb.offsetWidth;}
+ if (sb = document.getElementById('seekbargrip')) {left += sb.offsetWidth / 2; right -= sb.offsetWidth / 2;}
+ if (left > 0 && left < right)
{
percent = 100 * ((window.event ? window.event.clientX : e.clientX) - left) / (right - left);
- if(percent < 0) percent = 0;
- else if(percent > 100) percent = 100;
-
+ if (percent < 0) percent = 0;
+ else if (percent > 100) percent = 100;
+
MakeRequest('command.html?wm_command=[setposcommand]&percent='+percent);
}
}
@@ -139,12 +139,12 @@ function OnSeek(e)
function OnVolume(e)
{
left = right = 0;
- if(cv = document.getElementById('controlvolumebar')) {left = getOffsetX(cv)+3; right = getOffsetX(cv) + cv.offsetWidth-3;}
- if(left > 0 && left < right)
+ if (cv = document.getElementById('controlvolumebar')) {left = getOffsetX(cv)+3; right = getOffsetX(cv) + cv.offsetWidth-3;}
+ if (left > 0 && left < right)
{
percent = 100 * ((window.event ? window.event.clientX : e.clientX) - left) / (right - left);
- if(percent < 0) percent = 0;
- else if(percent > 100) percent = 100;
+ if (percent < 0) percent = 0;
+ else if (percent > 100) percent = 100;
MakeRequest('command.html?wm_command=[setvolumecommand]&volume='+percent);
}
@@ -160,10 +160,10 @@ function Init()
StatusLoop();
LoadSnapShot();
- if(e = document.getElementById('seekbar'))
+ if (e = document.getElementById('seekbar'))
e.onclick = OnSeek;
- if(e = document.getElementById('controlvolumebar'))
+ if (e = document.getElementById('controlvolumebar'))
e.onclick = OnVolume;
}
diff --git a/src/apps/mplayerc/resource.h b/src/apps/mplayerc/resource.h
index 5be2f148a..93b7bb75e 100644
--- a/src/apps/mplayerc/resource.h
+++ b/src/apps/mplayerc/resource.h
Binary files differ
diff --git a/src/common.props b/src/common.props
index c99f8a2b0..c282c07de 100644
--- a/src/common.props
+++ b/src/common.props
@@ -16,7 +16,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
+ <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Debug Filter'">
<ClCompile>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -25,32 +25,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
</ClCompile>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug Filter'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- </ClCompile>
- <Link>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <LargeAddressAware>true</LargeAddressAware>
- <LinkIncremental>false</LinkIncremental>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)'=='Release Filter'">
+ <ItemDefinitionGroup Condition="'$(Configuration)'=='Release' Or '$(Configuration)'=='Release Filter'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp
index 759e9547b..ec8173be9 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp
+++ b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp
@@ -579,69 +579,91 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p
return(true);
}
-bool CBaseSplitterFileEx::Read(aachdr& h, int len, CMediaType* pmt)
+bool CBaseSplitterFileEx::Read(latm_aachdr& h, int len, CMediaType* pmt)
{
memset(&h, 0, sizeof(h));
- for(; len >= 7 && BitRead(12, true) != 0xfff; len--) {
+ for(; len >= 3 && BitRead(11, true) != 0x2b7; len--) {
BitRead(8);
}
-
- if(len < 7) {
+
+ if(len < 3) {
return(false);
}
- h.sync = BitRead(12);
- h.version = BitRead(1);
- h.layer = BitRead(2);
- h.fcrc = BitRead(1);
- h.profile = BitRead(2);
- h.freq = BitRead(4);
- h.privatebit = BitRead(1);
- h.channels = BitRead(3);
- h.original = BitRead(1);
- h.home = BitRead(1);
+ // Disable AAC latm stream support until make correct header parsing ...
+ return(true);
+}
- h.copyright_id_bit = BitRead(1);
- h.copyright_id_start = BitRead(1);
- h.aac_frame_length = BitRead(13);
- h.adts_buffer_fullness = BitRead(11);
- h.no_raw_data_blocks_in_frame = BitRead(2);
+bool CBaseSplitterFileEx::Read(aachdr& h, int len, CMediaType* pmt)
+{
+ memset(&h, 0, sizeof(h));
- if(h.fcrc == 0) {
- h.crc = BitRead(16);
- }
+ __int64 pos = 0;
- if(h.layer != 0 || h.freq >= 12 || h.aac_frame_length <= (h.fcrc == 0 ? 9 : 7)) {
- return(false);
- }
+ for(;;) {
+ for(; len >= 7 && BitRead(12, true) != 0xfff; len--) {
+ BitRead(8);
+ }
+
+ if(len < 7) {
+ return(false);
+ }
- h.FrameSize = h.aac_frame_length - (h.fcrc == 0 ? 9 : 7);
- static int freq[] = {96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000};
- h.nBytesPerSec = h.aac_frame_length * freq[h.freq] / 1024; // ok?
- h.rtDuration = 10000000i64 * 1024 / freq[h.freq]; // ok?
+ h.sync = BitRead(12);
+ pos = GetPos();
+ h.version = BitRead(1);
+ h.layer = BitRead(2);
+ h.fcrc = BitRead(1);
+ h.profile = BitRead(2);
+ h.freq = BitRead(4);
+ h.privatebit = BitRead(1);
+ h.channels = BitRead(3);
+ h.original = BitRead(1);
+ h.home = BitRead(1);
- if(!pmt) {
- return(true);
- }
+ h.copyright_id_bit = BitRead(1);
+ h.copyright_id_start = BitRead(1);
+ h.aac_frame_length = BitRead(13);
+ h.adts_buffer_fullness = BitRead(11);
+ h.no_raw_data_blocks_in_frame = BitRead(2);
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)DNew BYTE[sizeof(WAVEFORMATEX)+5];
- memset(wfe, 0, sizeof(WAVEFORMATEX)+5);
- wfe->wFormatTag = WAVE_FORMAT_AAC;
- wfe->nChannels = h.channels <= 6 ? h.channels : 2;
- wfe->nSamplesPerSec = freq[h.freq];
- wfe->nBlockAlign = h.aac_frame_length;
- wfe->nAvgBytesPerSec = h.nBytesPerSec;
- wfe->cbSize = MakeAACInitData((BYTE*)(wfe+1), h.profile, wfe->nSamplesPerSec, wfe->nChannels);
+ if(h.fcrc == 0) {
+ h.crc = BitRead(16);
+ }
- pmt->majortype = MEDIATYPE_Audio;
- pmt->subtype = MEDIASUBTYPE_AAC;
- pmt->formattype = FORMAT_WaveFormatEx;
- pmt->SetFormat((BYTE*)wfe, sizeof(WAVEFORMATEX)+wfe->cbSize);
+ if(h.layer != 0 || h.freq >= 12 || h.aac_frame_length <= (h.fcrc == 0 ? 9 : 7)) {
+ Seek(pos);
+ continue;
+ }
- delete [] wfe;
+ h.FrameSize = h.aac_frame_length - (h.fcrc == 0 ? 9 : 7);
+ static int freq[] = {96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000};
+ h.nBytesPerSec = h.aac_frame_length * freq[h.freq] / 1024; // ok?
+ h.rtDuration = 10000000i64 * 1024 / freq[h.freq]; // ok?
- return(true);
+ if(!pmt) {
+ return(true);
+ }
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)DNew BYTE[sizeof(WAVEFORMATEX)+5];
+ memset(wfe, 0, sizeof(WAVEFORMATEX)+5);
+ wfe->wFormatTag = WAVE_FORMAT_AAC;
+ wfe->nChannels = h.channels <= 6 ? h.channels : 2;
+ wfe->nSamplesPerSec = freq[h.freq];
+ wfe->nBlockAlign = h.aac_frame_length;
+ wfe->nAvgBytesPerSec = h.nBytesPerSec;
+ wfe->cbSize = MakeAACInitData((BYTE*)(wfe+1), h.profile, wfe->nSamplesPerSec, wfe->nChannels);
+
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = MEDIASUBTYPE_AAC;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)wfe, sizeof(WAVEFORMATEX)+wfe->cbSize);
+
+ delete [] wfe;
+
+ return(true);
+ }
}
bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt)
@@ -773,7 +795,7 @@ bool CBaseSplitterFileEx::Read(dtshdr& h, int len, CMediaType* pmt)
h.frametype = BitRead(1);
h.deficitsamplecount = BitRead(5);
h.fcrc = BitRead(1);
- h.nblocks = BitRead(7);
+ h.nblocks = BitRead(7)+1;
h.framebytes = (WORD)BitRead(14)+1;
h.amode = BitRead(6);
h.sfreq = BitRead(4);
@@ -811,14 +833,21 @@ bool CBaseSplitterFileEx::Read(dtshdr& h, int len, CMediaType* pmt)
static int freq[] = {0,8000,16000,32000,0,0,11025,22050,44100,0,0,12000,24000,48000,0,0};
wfe.nSamplesPerSec = freq[h.sfreq];
- static int rate[] = {
- 32000,56000,64000,96000,112000,128000,192000,224000,
- 256000,320000,384000,448000,512000,576000,640000,754500,
- 960000,1024000,1152000,1280000,1344000,1408000,1411200,1472000,
- 1509750,1920000,2048000,3072000,3840000,0,0,0
+ /*static int rate[] = {
+ 32000, 56000, 64000, 96000,
+ 112000, 128000, 192000, 224000,
+ 256000, 320000, 384000, 448000,
+ 512000, 576000, 640000, 768000,
+ 960000, 1024000, 1152000, 1280000,
+ 1344000, 1408000, 1411200, 1472000,
+ 1536000, 1920000, 2048000, 3072000,
+ 3840000, 0, 0, 0 //open, variable, lossless
};
+ int nom_bitrate = rate[h.rate];*/
- wfe.nAvgBytesPerSec = (rate[h.rate] + 4) / 8;
+ __int64 bitrate = h.framebytes * 8 * wfe.nSamplesPerSec / (h.nblocks*32);
+
+ wfe.nAvgBytesPerSec = (bitrate + 4) / 8;
wfe.nBlockAlign = h.framebytes;
pmt->majortype = MEDIATYPE_Audio;
@@ -1251,9 +1280,11 @@ bool CBaseSplitterFileEx::Read(pvahdr& h, bool fSync)
return(true);
}
-void CBaseSplitterFileEx::HrdParameters(CGolombBuffer& gb)
+int CBaseSplitterFileEx::HrdParameters(CGolombBuffer& gb)
{
unsigned int cnt = gb.UExpGolombRead(); // cpb_cnt_minus1
+ if(cnt > 32U)
+ return -1;
gb.BitRead(4); // bit_rate_scale
gb.BitRead(4); // cpb_size_scale
@@ -1267,6 +1298,8 @@ void CBaseSplitterFileEx::HrdParameters(CGolombBuffer& gb)
gb.BitRead(5); // cpb_removal_delay_length_minus1
gb.BitRead(5); // dpb_output_delay_length_minus1
gb.BitRead(5); // time_offset_length
+
+ return 0;
}
void CBaseSplitterFileEx::RemoveMpegEscapeCode(BYTE* dst, BYTE* src, int length)
@@ -1300,6 +1333,23 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
__int64 nalendpos;
bool repeat = false;
+ // First try search for the start code
+ DWORD _dwStartCode = BitRead(32, true);
+ while(GetPos() < endpos+4 &&
+ (_dwStartCode & 0xFFFFFF1F) != 0x101 && // Coded slide of a non-IDR
+ (_dwStartCode & 0xFFFFFF1F) != 0x105 && // Coded slide of an IDR
+ (_dwStartCode & 0xFFFFFF1F) != 0x107 && // Sequence Parameter Set
+ (_dwStartCode & 0xFFFFFF1F) != 0x108 && // Picture Parameter Set
+ (_dwStartCode & 0xFFFFFF1F) != 0x109 && // Access Unit Delimiter
+ (_dwStartCode & 0xFFFFFF1F) != 0x10f // Subset Sequence Parameter Set (MVC)
+ ) {
+ BitRead(8);
+ _dwStartCode = BitRead(32, true);
+ }
+ if(GetPos() >= endpos+4) {
+ return(false);
+ }
+
// At least a SPS (normal or subset) and a PPS is required
while(GetPos() < endpos+4 && (!(h.spspps[index_sps].complete || h.spspps[index_subsetsps].complete) || !h.spspps[index_pps1].complete || repeat))
{
@@ -1356,7 +1406,7 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
Seek(pos);
h.spspps[index].size += len;
- ASSERT(h.spspps[index].size < bufsize);
+ //ASSERT(h.spspps[index].size < bufsize); // disable for better debug ...
if(h.spspps[index].size >= bufsize || dwStartCode == 0x00000001 || (dwStartCode & 0xFFFFFF00) == 0x00000100) {
if (Read(h, index)) {
@@ -1414,6 +1464,12 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
if(lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
+
+ if(aspect.cx * 2 < aspect.cy) {
+ memset(vi, 0, len);
+ return(false);
+ }
+
vi->hdr.dwPictAspectRatioX = aspect.cx;
vi->hdr.dwPictAspectRatioY = aspect.cy;
vi->hdr.bmiHeader.biSize = sizeof(vi->hdr.bmiHeader);
@@ -1451,6 +1507,9 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
{
+ static BYTE profiles[] = {44, 66, 77, 88, 100, 110, 118, 122, 128, 144, 244};
+ static BYTE levels[] = {10, 11, 12, 13, 20, 21, 22, 30, 31, 32, 40, 41, 42, 50, 51};
+
// Only care about SPS and subset SPS
if(index != index_sps && index != index_subsetsps)
return true;
@@ -1462,10 +1521,31 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
gb.BitRead(8); // nal_unit_type
h.profile = (BYTE)gb.BitRead(8);
+ bool b_ident = false;
+ for(int i = 0; i<sizeof(profiles); i++) {
+ if(h.profile == profiles[i]) {
+ b_ident = true;
+ break;
+ }
+ }
+ if(!b_ident)
+ return(false);
+
gb.BitRead(8);
h.level = (BYTE)gb.BitRead(8);
+ b_ident = false;
+ for(int i = 0; i<sizeof(levels); i++) {
+ if(h.level == levels[i]) {
+ b_ident = true;
+ break;
+ }
+ }
+ if(!b_ident)
+ return(false);
- gb.UExpGolombRead(); // seq_parameter_set_id
+ unsigned int sps_id = gb.UExpGolombRead(); // seq_parameter_set_id
+ if(sps_id >= 32)
+ return(false);
if(h.profile >= 100) { // high profile
if(gb.UExpGolombRead() == 3) { // chroma_format_idc
@@ -1499,6 +1579,8 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
gb.SExpGolombRead(); // offset_for_non_ref_pic
gb.SExpGolombRead(); // offset_for_top_to_bottom_field
UINT64 num_ref_frames_in_pic_order_cnt_cycle = gb.UExpGolombRead();
+ if(num_ref_frames_in_pic_order_cnt_cycle >= 256)
+ return(false);
for(int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
gb.SExpGolombRead(); // offset_for_ref_frame[i]
}
@@ -1506,7 +1588,9 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
return(false);
}
- gb.UExpGolombRead(); // num_ref_frames
+ UINT64 ref_frame_count = gb.UExpGolombRead(); // num_ref_frames
+ if (ref_frame_count > 30)
+ return(false);
gb.BitRead(1); // gaps_in_frame_num_value_allowed_flag
UINT64 pic_width_in_mbs_minus1 = gb.UExpGolombRead();
@@ -1516,6 +1600,10 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
h.width = (pic_width_in_mbs_minus1 + 1) * 16;
h.height = (2 - frame_mbs_only_flag) * (pic_height_in_map_units_minus1 + 1) * 16;
+ if(h.height<100 || h.width<100) {
+ return(false);
+ }
+
if(h.height == 1088) {
h.height = 1080; // Prevent blur lines
}
@@ -1594,11 +1682,13 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
bool nalflag = gb.BitRead(1); // nal_hrd_parameters_present_flag
if(nalflag) {
- HrdParameters(gb);
+ if(HrdParameters(gb)<0)
+ return(false);
}
bool vlcflag = gb.BitRead(1); // vlc_hrd_parameters_present_flag
if(vlcflag) {
- HrdParameters(gb);
+ if(HrdParameters(gb)<0)
+ return(false);
}
if(nalflag || vlcflag) {
gb.BitRead(1); // low_delay_hrd_flag
@@ -1611,8 +1701,14 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
gb.UExpGolombRead(); // max_bits_per_mb_denom
gb.UExpGolombRead(); // log2_max_mv_length_horizontal
gb.UExpGolombRead(); // log2_max_mv_length_vertical
- gb.UExpGolombRead(); // num_reorder_frames
+ UINT64 num_reorder_frames = gb.UExpGolombRead(); // num_reorder_frames
gb.UExpGolombRead(); // max_dec_frame_buffering
+
+ if(gb.GetSize() < gb.GetPos()){
+ num_reorder_frames = 0;
+ }
+ if(num_reorder_frames > 16U)
+ return(false);
}
}
@@ -1690,18 +1786,6 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
}
}
- if(!((h.level == 10) || (h.level == 11) || (h.level == 12) ||
- (h.level == 13) || (h.level == 20) || (h.level == 21) ||
- (h.level == 22) || (h.level == 30) || (h.level == 31) ||
- (h.level == 32) || (h.level == 40) || (h.level == 41) ||
- (h.level == 42) || (h.level == 50) || (h.level == 51))) {
- return(false);
- }
-
- if(h.height<300 || h.width<300) {
- return(false);
- }
-
return true;
}
@@ -1710,6 +1794,15 @@ bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt, int guid_fla
__int64 endpos = GetPos() + len; // - sequence header length
__int64 extrapos = 0, extralen = 0;
int nFrameRateNum = 0, nFrameRateDen = 1;
+
+ if (GetPos() < endpos+4 && BitRead(32, true) == 0x0000010D) { // if VC1 Frame found ...
+ while ((GetPos() < GetLength()-4) && (BitRead(32, true) != 0x0000010F)) { // try to found Header
+ BitRead(8);
+ }
+ if(BitRead(32, true) == 0x0000010F) {
+ endpos = GetPos() + len;
+ }
+ }
if (GetPos() < endpos+4 && BitRead(32, true) == 0x0000010F) {
extrapos = GetPos();
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h
index 04498c136..d148d6845 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h
+++ b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h
@@ -169,6 +169,12 @@ public:
REFERENCE_TIME rtDuration;
};
+ class latm_aachdr
+ {
+ public:
+ // nothing ;)
+ };
+
class ac3hdr
{
public:
@@ -406,6 +412,7 @@ public:
bool Read(seqhdr& h, int len, CMediaType* pmt = NULL);
bool Read(mpahdr& h, int len, bool fAllowV25, CMediaType* pmt = NULL);
bool Read(aachdr& h, int len, CMediaType* pmt = NULL);
+ bool Read(latm_aachdr& h, int len, CMediaType* pmt = NULL);
bool Read(ac3hdr& h, int len, CMediaType* pmt = NULL);
bool Read(dtshdr& h, int len, CMediaType* pmt = NULL);
bool Read(lpcmhdr& h, CMediaType* pmt = NULL);
@@ -424,6 +431,6 @@ public:
bool Read(dvbsub& h, int len, CMediaType* pmt = NULL);
bool Read(avchdr& h, spsppsindex index);
- void HrdParameters(CGolombBuffer& gb);
+ int HrdParameters(CGolombBuffer& gb);
void RemoveMpegEscapeCode(BYTE* dst, BYTE* src, int length);
};
diff --git a/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp b/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp
index e8e3ed516..957b9cc3c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.cpp
@@ -36,6 +36,7 @@
#include "Ap4SampleDescription.h"
#include "Ap4FtabAtom.h"
#include "Ap4EndaAtom.h"
+
/*----------------------------------------------------------------------
| AP4_SampleEntry::AP4_SampleEntry
+---------------------------------------------------------------------*/
@@ -1248,57 +1249,11 @@ AP4_AC3SampleEntry::GetFieldsSize()
}
/*----------------------------------------------------------------------
-| AP4_AC3SampleEntry::AP4_AC3SampleEntry
+| AP4_EAC3SampleEntry::AP4_EAC3SampleEntry
+---------------------------------------------------------------------*/
AP4_EAC3SampleEntry::AP4_EAC3SampleEntry(AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory) :
- AP4_AudioSampleEntry(AP4_ATOM_TYPE_EAC3, size)
+ AP4_AudioSampleEntry(AP4_ATOM_TYPE_EAC3, size, stream, atom_factory)
{
-
- // read fields
- ReadFields(stream);
-
- AP4_Size fields_size = GetFieldsSize();
-
- // read children atoms (ex: esds and maybe others)
- ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
}
-
-/*----------------------------------------------------------------------
-| AP4_AC3SampleEntry::ReadFields
-+---------------------------------------------------------------------*/
-AP4_Result
-AP4_EAC3SampleEntry::ReadFields(AP4_ByteStream& stream)
-{
-
- AP4_AudioSampleEntry::ReadFields(stream);
-
- // SampleSize field from AudioSampleEntry shall be ignored
- m_SampleSize = 0;
-
- // AC3SpecificBox
-
- // BoxHeader.Size, BoxHeader.Type
- char junk[8];
- stream.Read(junk, 8);
-
- AP4_UI32 data;
- stream.ReadUI24(data);
-
- // fscod
- m_SampleRate = freq[(data>>22) & 0x3];
- m_SampleRate <<= 16;
-
- // acmod
- m_ChannelCount = channels[(data>>17) & 0x7] + ((data>>18) & 0x1);
-
- return AP4_SUCCESS;
-}
-
-AP4_Size
-AP4_EAC3SampleEntry::GetFieldsSize()
-{
- return AP4_AudioSampleEntry::GetFieldsSize() + 11;
-}
-
diff --git a/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.h b/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.h
index 61dbda53e..9e8cfe732 100644
--- a/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.h
+++ b/src/filters/parser/MP4Splitter/AP4/Core/Ap4SampleEntry.h
@@ -390,7 +390,7 @@ class AP4_AC3SampleEntry : public AP4_AudioSampleEntry
};
/*----------------------------------------------------------------------
-| AP4_AC3SampleEntry
+| AP4_EAC3SampleEntry
+---------------------------------------------------------------------*/
class AP4_EAC3SampleEntry : public AP4_AudioSampleEntry
{
@@ -399,9 +399,6 @@ class AP4_EAC3SampleEntry : public AP4_AudioSampleEntry
AP4_EAC3SampleEntry(AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
-
- AP4_Result ReadFields(AP4_ByteStream& stream);
- AP4_Size GetFieldsSize();
};
#endif // _AP4_SAMPLE_ENTRY_H_
diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.cpp b/src/filters/parser/MP4Splitter/MP4Splitter.cpp
index 812d40737..5eafbb311 100644
--- a/src/filters/parser/MP4Splitter/MP4Splitter.cpp
+++ b/src/filters/parser/MP4Splitter/MP4Splitter.cpp
@@ -23,6 +23,7 @@
#include "Mmreg.h"
#include "MP4Splitter.h"
#include "../../../DSUtil/DSUtil.h"
+#include "../../../DSUtil/GolombBuffer.h"
#include <initguid.h>
#include <moreuuids.h>
@@ -528,6 +529,50 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
fourcc = type; //reverse fourcc
}
}
+
+ DWORD nSampleRate = ase->GetSampleRate();
+ WORD nChannels = ase->GetChannelCount();
+ DWORD nAvgBytesPerSec = 0;
+ if(type == AP4_ATOM_TYPE_EAC3) {
+
+ AP4_Sample sample;
+ AP4_DataBuffer sample_data;
+
+ AP4_Cardinal SampleCount = track->GetSampleCount();
+ if(SampleCount) {
+ track->ReadSample(1, sample, sample_data);
+ const AP4_Byte* data = sample_data.GetData();
+ AP4_Size size = sample_data.GetDataSize();
+
+ CGolombBuffer gb((BYTE *)data, size);
+ for(; size >= 7 && gb.BitRead(16, true) != 0x0b77; size--) {
+ gb.BitRead(8);
+ }
+ WORD sync = (WORD)gb.BitRead(16);
+ if((size >= 7) && (sync == 0x0b77)) {
+ static int freq[] = {48000, 44100, 32000, 0};
+ BYTE num_blocks;
+ gb.BitRead(2);
+ gb.BitRead(3);
+ WORD frame_size = (gb.BitRead(11) + 1) << 1;
+ BYTE sr_code = gb.BitRead(2);
+ if(sr_code == 3) {
+ BYTE sr_code2 = gb.BitRead(2);
+ nSampleRate = freq[sr_code2] / 2;
+ } else {
+ static int eac3_blocks[4] = {1, 2, 3, 6};
+ num_blocks = eac3_blocks[gb.BitRead(2)];
+ nSampleRate = freq[sr_code];
+ }
+ BYTE acmod = gb.BitRead(3);
+ BYTE lfeon = gb.BitRead(1);
+ static int channels[] = {2, 1, 2, 3, 3, 4, 4, 5};
+ nChannels = channels[acmod] + lfeon;
+ nAvgBytesPerSec = frame_size * nSampleRate / (num_blocks * 256);
+ }
+ }
+ }
+
mt.majortype = MEDIATYPE_Audio;
mt.subtype = FOURCCMap(fourcc);
mt.formattype = FORMAT_WaveFormatEx;
@@ -536,11 +581,11 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
if(!(fourcc & 0xffff0000)) {
wfe->wFormatTag = (WORD)fourcc;
}
- wfe->nSamplesPerSec = ase->GetSampleRate();
- wfe->nChannels = ase->GetChannelCount();
+ wfe->nSamplesPerSec = nSampleRate;
+ wfe->nChannels = nChannels;
wfe->wBitsPerSample = ase->GetSampleSize();
wfe->nBlockAlign = ase->GetBytesPerFrame();
- wfe->nAvgBytesPerSec = wfe->nSamplesPerSec * wfe->nChannels * wfe->wBitsPerSample / 8;
+ wfe->nAvgBytesPerSec = nAvgBytesPerSec ? nAvgBytesPerSec : wfe->nSamplesPerSec * wfe->nChannels * wfe->wBitsPerSample / 8;
wfe->cbSize = db.GetDataSize();
memcpy(wfe+1, db.GetData(), db.GetDataSize());
mts.Add(mt);
diff --git a/src/filters/parser/MpegSplitter/MpegSplitter.cpp b/src/filters/parser/MpegSplitter/MpegSplitter.cpp
index b508f4cc5..328eb02e0 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitter.cpp
+++ b/src/filters/parser/MpegSplitter/MpegSplitter.cpp
@@ -670,11 +670,9 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset)
__int64 pos = m_pFile->GetPos();
- if(h.payload && h.payloadstart) {
- m_pFile->UpdatePrograms(h);
- }
+ m_pFile->UpdatePrograms(h);
- if(h.payload && h.pid >= 16 && h.pid < 0x1fff && !h.scrambling) {
+ if(h.payload && ISVALIDPID(h.pid)/* && !h.scrambling*/) {
DWORD TrackNumber = h.pid;
CMpegSplitterFile::peshdr h2;
@@ -699,9 +697,6 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset)
StreamTime(rtNow);
TRACE ("Now=%S PCR=%S\n", ReftimeToString(rtNow.m_time), ReftimeToString(h.PCR));
}
- if (h2.fpts && h.pid == 241) {
- TRACE ("Sub=%S\n", ReftimeToString(h2.pts - rtStartOffset));
- }
p->rtStart = h2.fpts ? (h2.pts - rtStartOffset) : Packet::INVALID_TIME;
p->rtStop = p->rtStart+1;
@@ -815,33 +810,38 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
CStringW name = CMpegSplitterFile::CStreamList::ToString(i);
CStringW str;
- int iProgram;
-
- const CHdmvClipInfo::Stream *pClipInfo;
- const CMpegSplitterFile::program * pProgram = m_pFile->FindProgram(s.pid, iProgram, pClipInfo);
- const wchar_t *pStreamName = NULL;
- int StreamType = pClipInfo ? pClipInfo->m_Type : pProgram ? pProgram->streams[iProgram].type : 0;
- pStreamName = StreamTypeToName((PES_STREAM_TYPE)StreamType);
-
- CString lang_str;
- CString lang_name = _T("");
- if((m_pFile->m_pPMT_Lang.Lookup(s.pid, lang_str)) && (!lang_str.IsEmpty())) {
- char ch[4];
- ch[0] = lang_str[0];
- ch[1] = lang_str[1];
- ch[2] = lang_str[2];
- ch[3] = lang_str[3];
- lang_name = ISO6392ToLanguage(ch);
- }
-
- CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType, lang_name);
-
- if (!FormatDesc.IsEmpty()) {
- str.Format(L"%s (%04x,%02x,%02x)", FormatDesc.GetString(), s.pid, s.pesid, s.ps1id); // TODO: make this nicer
- } else if (pStreamName) {
- str.Format(L"%s - %s (%04x,%02x,%02x)", name, pStreamName, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ int iProgram = -1;
+
+ if (i == CMpegSplitterFile::subpic && s.pid == NO_SUBTITLE_PID) {
+ str = NO_SUBTITLE_NAME;
+ continue;
} else {
- str.Format(L"%s (%04x,%02x,%02x)", name, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ const CHdmvClipInfo::Stream *pClipInfo;
+ const CMpegSplitterFile::program * pProgram = m_pFile->FindProgram(s.pid, iProgram, pClipInfo);
+ const wchar_t *pStreamName = NULL;
+ int StreamType = pClipInfo ? pClipInfo->m_Type : pProgram ? pProgram->streams[iProgram].type : 0;
+ pStreamName = StreamTypeToName((PES_STREAM_TYPE)StreamType);
+
+ CString lang_str;
+ CString lang_name = _T("");
+ if((m_pFile->m_pPMT_Lang.Lookup(s.pid, lang_str)) && (!lang_str.IsEmpty())) {
+ char ch[4];
+ ch[0] = lang_str[0];
+ ch[1] = lang_str[1];
+ ch[2] = lang_str[2];
+ ch[3] = lang_str[3];
+ lang_name = ISO6392ToLanguage(ch);
+ }
+
+ CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType, lang_name);
+
+ if (!FormatDesc.IsEmpty()) {
+ str.Format(L"%s (%04x,%02x,%02x)", FormatDesc.GetString(), s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ } else if (pStreamName) {
+ str.Format(L"%s - %s (%04x,%02x,%02x)", name, pStreamName, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ } else {
+ str.Format(L"%s (%04x,%02x,%02x)", name, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ }
}
CString str_tmp = str;
str_tmp.MakeLower();
@@ -898,31 +898,35 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
CStringW str;
int iProgram = -1;
- const CHdmvClipInfo::Stream *pClipInfo;
- const CMpegSplitterFile::program * pProgram = m_pFile->FindProgram(s.pid, iProgram, pClipInfo);
- const wchar_t *pStreamName = NULL;
- int StreamType = pClipInfo ? pClipInfo->m_Type : pProgram ? pProgram->streams[iProgram].type : 0;
- pStreamName = StreamTypeToName((PES_STREAM_TYPE)StreamType);
+ if (i == CMpegSplitterFile::subpic && s.pid == NO_SUBTITLE_PID) {
+ str = NO_SUBTITLE_NAME;
+ } else {
+ const CHdmvClipInfo::Stream *pClipInfo;
+ const CMpegSplitterFile::program * pProgram = m_pFile->FindProgram(s.pid, iProgram, pClipInfo);
+ const wchar_t *pStreamName = NULL;
+ int StreamType = pClipInfo ? pClipInfo->m_Type : pProgram ? pProgram->streams[iProgram].type : 0;
+ pStreamName = StreamTypeToName((PES_STREAM_TYPE)StreamType);
- CString lang_str;
- CString lang_name = _T("");
- if((m_pFile->m_pPMT_Lang.Lookup(s.pid, lang_str)) && (!lang_str.IsEmpty())) {
- char ch[4];
- ch[0] = lang_str[0];
- ch[1] = lang_str[1];
- ch[2] = lang_str[2];
- ch[3] = lang_str[3];
- lang_name = ISO6392ToLanguage(ch);
- }
+ CString lang_str;
+ CString lang_name = _T("");
+ if((m_pFile->m_pPMT_Lang.Lookup(s.pid, lang_str)) && (!lang_str.IsEmpty())) {
+ char ch[4];
+ ch[0] = lang_str[0];
+ ch[1] = lang_str[1];
+ ch[2] = lang_str[2];
+ ch[3] = lang_str[3];
+ lang_name = ISO6392ToLanguage(ch);
+ }
- CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType, lang_name);
+ CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType, lang_name);
- if (!FormatDesc.IsEmpty()) {
- str.Format(L"%s (%04x,%02x,%02x)", FormatDesc.GetString(), s.pid, s.pesid, s.ps1id); // TODO: make this nicer
- } else if (pStreamName) {
- str.Format(L"%s - %s (%04x,%02x,%02x)", name, pStreamName, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
- } else {
- str.Format(L"%s (%04x,%02x,%02x)", name, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ if (!FormatDesc.IsEmpty()) {
+ str.Format(L"%s (%04x,%02x,%02x)", FormatDesc.GetString(), s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ } else if (pStreamName) {
+ str.Format(L"%s - %s (%04x,%02x,%02x)", name, pStreamName, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ } else {
+ str.Format(L"%s (%04x,%02x,%02x)", name, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ }
}
CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CMpegSplitterOutputPin(mts, str, this, this, &hr));
@@ -1323,32 +1327,37 @@ STDMETHODIMP CMpegSplitterFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD*
CStringW str;
- int iProgram;
- const CHdmvClipInfo::Stream *pClipInfo;
- const CMpegSplitterFile::program * pProgram = m_pFile->FindProgram(s.pid, iProgram, pClipInfo);
- const wchar_t *pStreamName = NULL;
- int StreamType = pClipInfo ? pClipInfo->m_Type : pProgram ? pProgram->streams[iProgram].type : 0;
- pStreamName = StreamTypeToName((PES_STREAM_TYPE)StreamType);
-
- CString lang_str;
- CString lang_name = _T("");
- if((m_pFile->m_pPMT_Lang.Lookup(s.pid, lang_str)) && (!lang_str.IsEmpty())) {
- char ch[4];
- ch[0] = lang_str[0];
- ch[1] = lang_str[1];
- ch[2] = lang_str[2];
- ch[3] = lang_str[3];
- lang_name = ISO6392ToLanguage(ch);
- }
+ if (i == CMpegSplitterFile::subpic && s.pid == NO_SUBTITLE_PID) {
+ str = NO_SUBTITLE_NAME;
+ *plcid = (LCID)LCID_NOSUBTITLES;
+ } else {
+ int iProgram;
+ const CHdmvClipInfo::Stream *pClipInfo;
+ const CMpegSplitterFile::program * pProgram = m_pFile->FindProgram(s.pid, iProgram, pClipInfo);
+ const wchar_t *pStreamName = NULL;
+ int StreamType = pClipInfo ? pClipInfo->m_Type : pProgram ? pProgram->streams[iProgram].type : 0;
+ pStreamName = StreamTypeToName((PES_STREAM_TYPE)StreamType);
+
+ CString lang_str;
+ CString lang_name = _T("");
+ if((m_pFile->m_pPMT_Lang.Lookup(s.pid, lang_str)) && (!lang_str.IsEmpty())) {
+ char ch[4];
+ ch[0] = lang_str[0];
+ ch[1] = lang_str[1];
+ ch[2] = lang_str[2];
+ ch[3] = lang_str[3];
+ lang_name = ISO6392ToLanguage(ch);
+ }
- CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType, lang_name);
+ CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType, lang_name);
- if (!FormatDesc.IsEmpty()) {
- str.Format(L"%s (%04x,%02x,%02x)", FormatDesc.GetString(), s.pid, s.pesid, s.ps1id); // TODO: make this nicer
- } else if (pStreamName) {
- str.Format(L"%s - %s (%04x,%02x,%02x)", name, pStreamName, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
- } else {
- str.Format(L"%s (%04x,%02x,%02x)", name, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ if (!FormatDesc.IsEmpty()) {
+ str.Format(L"%s (%04x,%02x,%02x)", FormatDesc.GetString(), s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ } else if (pStreamName) {
+ str.Format(L"%s - %s (%04x,%02x,%02x)", name, pStreamName, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ } else {
+ str.Format(L"%s (%04x,%02x,%02x)", name, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ }
}
*ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength()+1)*sizeof(WCHAR));
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp
index 8898ce61e..38d2dae1a 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp
+++ b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp
@@ -27,7 +27,6 @@
#include <moreuuids.h>
#define MEGABYTE 1024*1024
-#define ISVALIDPID(pid) (pid >= 0x10 && pid < 0x1fff)
CMpegSplitterFile::CMpegSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, bool bIsHdmv, CHdmvClipInfo &ClipInfo, int guid_flag)
: CBaseSplitterFileEx(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false, true)
@@ -172,6 +171,20 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader)
; // TODO: in this case disable seeking, or try doing something less drastical...
}
+ // Add fake Subtitle stream ...
+ if(m_streams[video].GetCount()) {
+ if (!m_bIsHdmv && m_streams[subpic].GetCount()) {
+ stream s;
+ s.pid = NO_SUBTITLE_PID;
+ s.mt.majortype = m_streams[subpic].GetHead().mt.majortype;
+ s.mt.subtype = m_streams[subpic].GetHead().mt.subtype;
+ s.mt.formattype = m_streams[subpic].GetHead().mt.formattype;
+ m_streams[subpic].Insert(s, this);
+ } else {
+ AddHdmvPGStream(NO_SUBTITLE_PID, "---");
+ }
+ }
+
Seek(0);
return S_OK;
@@ -341,9 +354,7 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead
__int64 pos = GetPos();
- if(h.payload && h.payloadstart) {
- UpdatePrograms(h);
- }
+ UpdatePrograms(h);
if(h.payload && ISVALIDPID(h.pid)) {
peshdr h2;
@@ -452,36 +463,40 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
}
}
- Seek(pos);
-
if(type == unknown) {
+ Seek(pos);
// PPS and SPS can be present on differents packets
// and can also be split into multiple packets
if (!avch.Lookup(pid))
memset(&avch[pid], 0, sizeof(CMpegSplitterFile::avchdr));
-
- if(!m_streams[video].Find(s) && !m_streams[stereo].Find(s) && Read(avch[pid], len, &s.mt)) {
+#if defined(MVC_SUPPORT)
+ if(!m_streams[video].Find(s) && !m_streams[stereo].Find(s) && Read(avch[pid], len, &s.mt))
+ {
if (avch[pid].spspps[index_subsetsps].complete)
type = stereo;
else
type = video;
}
+#else
+ if(!m_streams[video].Find(s) && Read(avch[pid], len, &s.mt)) {
+ type = video;
+ }
+#endif
}
} else if(pesid >= 0xc0 && pesid < 0xe0) { // mpeg audio
__int64 pos = GetPos();
if(type == unknown) {
- CMpegSplitterFile::mpahdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, false, &s.mt)) {
+ CMpegSplitterFile::aachdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
type = audio;
}
}
- Seek(pos);
-
if(type == unknown) {
- CMpegSplitterFile::aachdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
+ Seek(pos);
+ CMpegSplitterFile::mpahdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, false, &s.mt)) {
type = audio;
}
}
@@ -499,8 +514,8 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
}
// DTS
- Seek(pos);
if(type == unknown) {
+ Seek(pos);
CMpegSplitterFile::dtshdr h;
if(Read(h, len, &s.mt)) {
type = audio;
@@ -508,8 +523,8 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
}
// VC1
- Seek(pos);
if(type == unknown) {
+ Seek(pos);
CMpegSplitterFile::vc1hdr h;
if(!m_streams[video].Find(s) && Read(h, len, &s.mt, m_nVC1_GuidFlag)) {
type = video;
@@ -517,8 +532,8 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
}
// DVB subtitles
- Seek(pos);
if(type == unknown) {
+ Seek(pos);
CMpegSplitterFile::dvbsub h;
if(!m_streams[video].Find(s) && Read(h, len, &s.mt)) {
type = subpic;
@@ -693,7 +708,9 @@ CAtlList<CMpegSplitterFile::stream>* CMpegSplitterFile::GetMasterStream()
!m_streams[video].IsEmpty() ? &m_streams[video] :
!m_streams[audio].IsEmpty() ? &m_streams[audio] :
!m_streams[subpic].IsEmpty() ? &m_streams[subpic] :
+#if defined(MVC_SUPPORT)
!m_streams[stereo].IsEmpty() ? &m_streams[stereo] :
+#endif
NULL;
}
@@ -701,7 +718,7 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h)
{
CAutoLock cAutoLock(&m_csProps);
- if(h.pid == 0) {
+ if(h.payload && h.payloadstart && h.pid == 0) {
trsechdr h2;
if(Read(h2) && h2.table_id == 0) {
CAtlMap<WORD, bool> newprograms;
@@ -730,79 +747,127 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h)
}
}
} else if(CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(h.pid)) {
- trsechdr h2;
- if(Read(h2) && h2.table_id == 2) {
- memset(pPair->m_value.streams, 0, sizeof(pPair->m_value.streams));
+ if(h.payload && h.payloadstart) {
+ trsechdr h2;
+ if(Read(h2) && h2.table_id == 2) {
+ int len = h2.section_length;
+ len -= 5+4;
+
+ BYTE buffer[1024];
+ ByteRead(buffer, len);
+ CGolombBuffer gb(buffer, len);
+
+ int max_len = h.bytes - 9;
+
+ if(len > max_len) {
+ memset(pPair->m_value.ts_buffer, 0, sizeof(pPair->m_value.ts_buffer));
+ pPair->m_value.ts_len_cur = max_len;
+ pPair->m_value.ts_len_packet = len;
+ memcpy(pPair->m_value.ts_buffer, buffer, max_len);
+ } else {
+ CGolombBuffer gb(buffer, len);
+ UpdatePrograms(gb, h.pid);
+ }
+ }
+ } else {
+ if(pPair->m_value.ts_len_cur > 0) {
+ int len = pPair->m_value.ts_len_packet - pPair->m_value.ts_len_cur;
+ if(len > h.bytes) {
+ ByteRead(pPair->m_value.ts_buffer + pPair->m_value.ts_len_cur, h.bytes);
+ pPair->m_value.ts_len_cur += h.bytes;
+ } else {
+ ByteRead(pPair->m_value.ts_buffer + pPair->m_value.ts_len_cur, pPair->m_value.ts_len_packet - pPair->m_value.ts_len_cur);
+ CGolombBuffer gb(pPair->m_value.ts_buffer, pPair->m_value.ts_len_packet);
+ UpdatePrograms(gb, h.pid);
+ }
+ }
+ }
+ }
+}
- int len = h2.section_length;
- len -= 5+4;
+void CMpegSplitterFile::UpdatePrograms(CGolombBuffer gb, WORD pid)
+{
+ if(CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(pid))
+ {
+ memset(pPair->m_value.streams, 0, sizeof(pPair->m_value.streams));
+
+ int len = gb.GetSize();
+
+ BYTE reserved1 = (BYTE)gb.BitRead(3);
+ WORD PCR_PID = (WORD)gb.BitRead(13);
+ BYTE reserved2 = (BYTE)gb.BitRead(4);
+ WORD program_info_length = (WORD)gb.BitRead(12);
+ UNUSED_ALWAYS(reserved1);
+ UNUSED_ALWAYS(PCR_PID);
+ UNUSED_ALWAYS(reserved2);
+
+ len -= (4 + program_info_length);
+ if(len <= 0)
+ return;
+
+ while(program_info_length-- > 0) {
+ gb.BitRead(8);
+ }
- BYTE reserved1 = (BYTE)BitRead(3);
- WORD PCR_PID = (WORD)BitRead(13);
- BYTE reserved2 = (BYTE)BitRead(4);
- WORD program_info_length = (WORD)BitRead(12);
- UNUSED_ALWAYS(reserved1);
- UNUSED_ALWAYS(PCR_PID);
- UNUSED_ALWAYS(reserved2);
+ for(int i = 0; i < countof(pPair->m_value.streams) && len >= 5; i++) {
+ BYTE stream_type = (BYTE)gb.BitRead(8);
+ BYTE nreserved1 = (BYTE)gb.BitRead(3);
+ WORD pid = (WORD)gb.BitRead(13);
+ BYTE nreserved2 = (BYTE)gb.BitRead(4);
+ WORD ES_info_length = (WORD)gb.BitRead(12);
+ UNUSED_ALWAYS(nreserved1);
+ UNUSED_ALWAYS(nreserved2);
- len -= 4+program_info_length;
+ pPair->m_value.streams[i].pid = pid;
+ pPair->m_value.streams[i].type = (PES_STREAM_TYPE)stream_type;
- while(program_info_length-- > 0) {
- BitRead(8);
- }
+ len -= (5 + ES_info_length);
+ if(len < 0)
+ break;
+ if(ES_info_length<=2)
+ continue;
- for(int i = 0; i < countof(pPair->m_value.streams) && len >= 5; i++) {
- BYTE stream_type = (BYTE)BitRead(8);
- BYTE nreserved1 = (BYTE)BitRead(3);
- WORD pid = (WORD)BitRead(13);
- BYTE nreserved2 = (BYTE)BitRead(4);
- WORD ES_info_length = (WORD)BitRead(12);
- UNUSED_ALWAYS(nreserved1);
- UNUSED_ALWAYS(nreserved2);
-
- len -= 5+ES_info_length;
-
- if(!PMT_find) {
- INT64 info_length = ES_info_length;
- for(;;) {
- BYTE descriptor_tag = BitRead(8);
- BYTE descriptor_length = BitRead(8);
- info_length -= (2 + descriptor_length);
- char ch[4];
- switch(descriptor_tag) {
- case 0x0a: // ISO 639 language descriptor
- case 0x56: // Teletext descriptor
- case 0x59: // Subtitling descriptor
- ch[0] = BitRead(8);
- ch[1] = BitRead(8);
- ch[2] = BitRead(8);
- ch[3] = 0;
- for(int i = 3; i < descriptor_length; i++) {
- BitRead(8);
- }
- if(!(ch[0] == 'u' && ch[1] == 'n' && ch[2] == 'd')) {
- m_pPMT_Lang[pid] = CString(ch);
- }
- break;
- default:
- for(int i = 0; i < descriptor_length; i++) {
- BitRead(8);
- }
- break;
- }
- if(info_length<=2) break;
- }
- } else {
- while(ES_info_length-- > 0) {
- BitRead(8);
+ if(!PMT_find) {
+ int info_length = ES_info_length;
+ for(;;) {
+ BYTE descriptor_tag = gb.BitRead(8);
+ BYTE descriptor_length = gb.BitRead(8);
+ info_length -= (2 + descriptor_length);
+ if(info_length < 0)
+ break;
+ char ch[4];
+ switch(descriptor_tag) {
+ case 0x0a: // ISO 639 language descriptor
+ case 0x56: // Teletext descriptor
+ case 0x59: // Subtitling descriptor
+ ch[0] = gb.BitRead(8);
+ ch[1] = gb.BitRead(8);
+ ch[2] = gb.BitRead(8);
+ ch[3] = 0;
+ for(int i = 3; i < descriptor_length; i++) {
+ gb.BitRead(8);
+ }
+ if(!(ch[0] == 'u' && ch[1] == 'n' && ch[2] == 'd')) {
+ m_pPMT_Lang[pid] = CString(ch);
+ }
+ break;
+ default:
+ for(int i = 0; i < descriptor_length; i++) {
+ gb.BitRead(8);
+ }
+ break;
}
+ if(info_length<=2) break;
+ }
+ } else {
+ while(ES_info_length-- > 0) {
+ gb.BitRead(8);
}
-
- pPair->m_value.streams[i].pid = pid;
- pPair->m_value.streams[i].type = (PES_STREAM_TYPE)stream_type;
}
- PMT_find = true;
}
+ PMT_find = true;
+ pPair->m_value.ts_len_cur = 0;
+ pPair->m_value.ts_len_packet = 0;
}
}
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterFile.h b/src/filters/parser/MpegSplitter/MpegSplitterFile.h
index 6c9650f54..7c5e23471 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitterFile.h
+++ b/src/filters/parser/MpegSplitter/MpegSplitterFile.h
@@ -24,9 +24,14 @@
#include <atlbase.h>
#include <atlcoll.h>
#include "../BaseSplitter/BaseSplitter.h"
+#include "../../../DSUtil/GolombBuffer.h"
#define NO_SUBTITLE_PID 1 // Fake PID use for the "No subtitle" entry
+#define NO_SUBTITLE_NAME _T("No subtitle")
+#define ISVALIDPID(pid) (pid >= 0x10 && pid < 0x1fff)
+
+//#define MVC_SUPPORT
class CMpegSplitterFile : public CBaseSplitterFileEx
{
@@ -34,7 +39,6 @@ class CMpegSplitterFile : public CBaseSplitterFileEx
CAtlMap<WORD, CMpegSplitterFile::avchdr> avch;
bool m_bIsHdmv;
-
HRESULT Init(IAsyncReader* pAsyncReader);
void OnComplete(IAsyncReader* pAsyncReader);
@@ -72,7 +76,11 @@ public:
}
};
- enum {video, audio, subpic, stereo, unknown};
+ enum {video, audio, subpic,
+#if defined(MVC_SUPPORT)
+ stereo,
+#endif
+ unknown};
class CStreamList : public CAtlList<stream>
{
@@ -95,7 +103,9 @@ public:
type == video ? L"Video" :
type == audio ? L"Audio" :
type == subpic ? L"Subtitle" :
+#if defined(MVC_SUPPORT)
type == stereo ? L"Stereo" :
+#endif
L"Unknown";
}
@@ -131,11 +141,15 @@ public:
struct program() {
memset(this, 0, sizeof(*this));
}
+
+ BYTE ts_buffer[1024];
+ WORD ts_len_cur, ts_len_packet;
};
CAtlMap<WORD, program> m_programs;
void UpdatePrograms(const trhdr& h);
+ void UpdatePrograms(CGolombBuffer gb, WORD pid);
const program* FindProgram(WORD pid, int &iStream, const CHdmvClipInfo::Stream * &_pClipInfo);
CAtlMap<DWORD, CString> m_pPMT_Lang;
diff --git a/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp
index 63eb726c1..420355842 100644
--- a/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp
@@ -884,6 +884,8 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error)
pp.BackBufferWidth = m_ScreenSize.cx;
pp.BackBufferHeight = m_ScreenSize.cy;
+ // We can get 0x8876086a here when switching from two displays to one display using Win + P (Windows 7)
+ // Cause: We might not reinitialize dx correctly during the switch
hr = m_pD3DEx->CreateDeviceEx(
m_CurrentAdapter, D3DDEVTYPE_HAL, m_hWnd,
GetVertexProcessing() | D3DCREATE_FPU_PRESERVE | D3DCREATE_MULTITHREADED | D3DCREATE_ENABLE_PRESENTSTATS, //D3DCREATE_MANAGED
@@ -929,6 +931,9 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error)
if(FAILED(hr)) {
_Error += L"CreateDevice failed\n";
+ CStringW str;
+ str.Format(L"Error code: 0x%X\n", hr);
+ _Error += str;
return hr;
}
@@ -1861,11 +1866,19 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::ResetDevice()
TRACE("ResetDevice\n");
_ASSERT(m_MainThreadId == GetCurrentThreadId());
StopWorkerThreads();
+
+ // In VMR-9 deleting the surfaces before we are told to is bad !
+ // Can't comment out this because CDX9AllocatorPresenter is used by EVR Custom
+ // Why is EVR using a presenter for DX9 anyway ?!
DeleteSurfaces();
+
HRESULT hr;
CString Error;
// TODO: Report error messages here
+ // In VMR-9 'AllocSurfaces' call is redundant afaik because
+ // 'CreateDevice' calls 'm_pIVMRSurfAllocNotify->ChangeD3DDevice' which in turn calls
+ // 'CVMR9AllocatorPresenter::InitializeDevice' which calls 'AllocSurfaces'
if(FAILED(hr = CreateDevice(Error)) || FAILED(hr = AllocSurfaces())) {
// TODO: We should probably pause player
#ifdef _DEBUG
diff --git a/src/filters/renderer/VideoRenderers/IPinHook.cpp b/src/filters/renderer/VideoRenderers/IPinHook.cpp
index 9ca8d2b35..099be3174 100644
--- a/src/filters/renderer/VideoRenderers/IPinHook.cpp
+++ b/src/filters/renderer/VideoRenderers/IPinHook.cpp
@@ -31,7 +31,7 @@
#include "IPinHook.h"
#include "AllocatorCommon.h"
-#define DXVA_LOGFILE_A
+//#define DXVA_LOGFILE_A
#if defined(_DEBUG) && defined(DXVA_LOGFILE_A)
#define LOG_FILE_DXVA _T("dxva_ipinhook.log")
diff --git a/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp
index 7d7ecc5ab..939958d51 100644
--- a/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp
@@ -179,11 +179,13 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A
return E_FAIL;
}
+ // WTF: Is this some kind of forgotten debug code ?
if((GetAsyncKeyState(VK_CONTROL)&0x80000000))
if(lpAllocInfo->Format == '21VY' || lpAllocInfo->Format == '024I') {
return E_FAIL;
}
+ // The surfaces should already be free when InitializeDevice is called
DeleteSurfaces();
int nOriginal = *lpNumBuffers;
@@ -250,6 +252,9 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A
STDMETHODIMP CVMR9AllocatorPresenter::TerminateDevice(DWORD_PTR dwUserID)
{
+ // We should not free the surfaces until we are told to !
+ // Thats what TerminateDevice is for
+ DeleteSurfaces();
return S_OK;
}
@@ -259,19 +264,42 @@ STDMETHODIMP CVMR9AllocatorPresenter::GetSurface(DWORD_PTR dwUserID, DWORD Surfa
return E_POINTER;
}
+ CAutoLock cAutoLock(this);
+ CAutoLock cRenderLock(&m_RenderLock);
+
+ /*
+ SurfaceIndex = 0
+ m_pSurfaces.GetCount() = 0
+
+ Scenario:
+ Thread 1:
+ Wait on m_RenderLock in this function
+ Thread 2:
+ Have m_RenderLock and removes all m_pSurfaces
+ (Happens by calling ex CDX9AllocatorPresenter::ResetDevice)
+
+ When thread 2 releases the lock thread 1 gets it and boom!
+
+ Possible solution: Adding object lock and moving m_RenderLock to try to fix this threading issue.
+ This problem occurs when moving the window from display a to display b.
+
+ NOTE: This is just a workaround.
+ CDX9AllocatorPresenter doesn't follow the rules which is why this happened.
+ And it is used by EVR custom (which it really shouldn't) so i can't easily fix it without breaking EVR custom.
+ */
if(SurfaceIndex >= m_pSurfaces.GetCount()) {
return E_FAIL;
}
- CAutoLock cRenderLock(&m_RenderLock);
-
if (m_nVMR9Surfaces) {
++m_iVMR9Surface;
m_iVMR9Surface = m_iVMR9Surface % m_nVMR9Surfaces;
- (*lplpSurface = m_pSurfaces[m_iVMR9Surface + SurfaceIndex])->AddRef();
+ *lplpSurface = m_pSurfaces[m_iVMR9Surface + SurfaceIndex];
+ (*lplpSurface)->AddRef();
} else {
m_iVMR9Surface = SurfaceIndex;
- (*lplpSurface = m_pSurfaces[SurfaceIndex])->AddRef();
+ *lplpSurface = m_pSurfaces[SurfaceIndex];
+ (*lplpSurface)->AddRef();
}
return S_OK;
diff --git a/src/filters/source/DTSAC3Source/DTSAC3Source.cpp b/src/filters/source/DTSAC3Source/DTSAC3Source.cpp
index 9e2c55e3f..efd357234 100644
--- a/src/filters/source/DTSAC3Source/DTSAC3Source.cpp
+++ b/src/filters/source/DTSAC3Source/DTSAC3Source.cpp
@@ -170,7 +170,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
int frametype = (buff[0]>>7); // 1
int deficitsamplecount = (buff[0]>>2)&31; // 5
int crcpresent = (buff[0]>>1)&1; // 1
- int npcmsampleblocks = ((buff[0]&1)<<6)|(buff[1]>>2); // 7
+ int npcmsampleblocks = ((buff[0]&1)<<6)|(buff[1]>>2) + 1; // 7
int framebytes = (((buff[1]&3)<<12)|(buff[2]<<4)|(buff[3]>>4)) + 1; // 14
int audiochannelarrangement = (buff[3]&15)<<2|(buff[4]>>6); // 6
int freq = (buff[4]>>2)&15; // 4
@@ -178,7 +178,6 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
UNUSED_ALWAYS(frametype);
UNUSED_ALWAYS(deficitsamplecount);
UNUSED_ALWAYS(crcpresent);
- UNUSED_ALWAYS(npcmsampleblocks);
UNUSED_ALWAYS(audiochannelarrangement);
/////DTS-HD
@@ -193,7 +192,6 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
HD_size = ((buff[2]&1)<<19 | buff[3]<<11 | buff[4]<<3 | buff[5]>>5) + 1;
else
HD_size = ((buff[2]&31)<<11 | buff[3]<<3 | buff[4]>>5) + 1;
-
}
/////
@@ -203,7 +201,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
12000, 24000, 48000, 0, 0
};
- const int bitratetbl[32] = {
+ /*const int bitratetbl[32] = {
32000, 56000, 64000, 96000,
112000, 128000, 192000, 224000,
256000, 320000, 384000, 448000,
@@ -211,36 +209,23 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
960000, 1024000, 1152000, 1280000,
1344000, 1408000, 1411200, 1472000,
1536000, 1920000, 2048000, 3072000,
- 3840000, 0 /*open*/, 0 /*variable*/, 0 /*lossless*/
+ 3840000, 0, 0, 0 //open, variable, lossless
// [15] 768000 is actually 754500 for DVD
// [24] 1536000 is actually 1509000 for ???
// [24] 1536000 is actually 1509750 for DVD
// [22] 1411200 is actually 1234800 for 14-bit DTS-CD audio
- };
+ };*/
+
#define DTS_MAGIC_NUMBER 6 //magic number to make sonic audio decoder 4.2 happy
m_nSamplesPerSec = freqtbl[freq];
- m_nBytesPerFrame = framebytes*DTS_MAGIC_NUMBER;
-
- //int bitrate = bitratetbl[transbitrate];
- //if (transbitrate == 15 && framebytes == 1006) bitrate = 754500;
- //else if (transbitrate == 24 && framebytes == 2012) bitrate = 1509000;
- //else if (transbitrate == 24 && framebytes == 2013) bitrate = 1509750;
- //else if (transbitrate == 22 && framebytes == 3584) bitrate = 1234800;
- __int64 bitrate = bitratetbl[transbitrate];
- if (framebytes<=256)
- bitrate = (bitrate * (framebytes+HD_size)+128) / 256;
- else if (framebytes<=512)
- bitrate = (bitrate * (framebytes+HD_size)+256) / 512;
- else if (framebytes<=1024)
- bitrate = (bitrate * (framebytes+HD_size)+512) / 1024;
- else if (framebytes<=2048)
- bitrate = (bitrate * (framebytes+HD_size)+1024) / 2048;
- else if (framebytes<=4096)
- bitrate = (bitrate * (framebytes+HD_size)+2048) / 4096;
-
- m_nAvgBytesPerSec = (bitrate + 4)/8;
+ m_nBytesPerFrame = (framebytes + HD_size) * DTS_MAGIC_NUMBER;
+
+ //__int64 core_bitrate = framebytes * 8 * m_nSamplesPerSec / (npcmsampleblocks*32);
+ __int64 bitrate = (framebytes + HD_size) * 8 * m_nSamplesPerSec / (npcmsampleblocks * 32);
+
+ m_nAvgBytesPerSec = (bitrate + 4) / 8;
if (bitrate!=0) m_AvgTimePerFrame = 10000000i64 * m_nBytesPerFrame * 8 / bitrate;
else m_AvgTimePerFrame = 0;
diff --git a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp
index a0d6f7fcb..efe0b14f8 100644
--- a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp
+++ b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp
@@ -1568,6 +1568,10 @@ HRESULT CMPCVideoDecFilter::SoftwareDecode(IMediaSample* pIn, BYTE* pDataIn, int
csp_yuv_adj_to_plane(nTempCsp,outcspInfo,m_pAVCtx->height,(unsigned char**)dst,dstStride);
}
+ // We crash inside this function
+ // In swscale.c: Function 'simpleCopy'
+ // Line: 1961 - Buffer Overrun
+ // This might be ffmpeg fault or more likely mpchc is not reinitializing ffmpeg correctly during display change (moving mpchc window from display A to display B)
sws_scale_ordered (m_pSwsContext, m_pFrame->data, srcStride, 0, m_pAVCtx->height, dst, dstStride);
}
#endif /* HAS_FFMPEG_VIDEO_DECODERS */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg_x64/buildmingwlibs.sh b/src/filters/transform/MPCVideoDec/ffmpeg_x64/buildmingwlibs.sh
index 5f9778c6e..3edf607d0 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg_x64/buildmingwlibs.sh
+++ b/src/filters/transform/MPCVideoDec/ffmpeg_x64/buildmingwlibs.sh
@@ -25,7 +25,7 @@ downloaded from the MinGW64 SourceForge project:
(http://sourceforge.net/project/showfiles.php?group_id=202880)
To use this script, you should first:
- - Download MinGW64 chaintool for the i686-mingw platform
+ - Download MinGW64 chaintool for the i686-mingw platform
(http://sourceforge.net/project/showfiles.php?group_id=202880&package_id=245516&release_id=546049)
- Download MSYS and configure MingW64 with the postinstall script
(or edit your "MSYS\etc\fstab" file and add your mingw path)
@@ -60,7 +60,7 @@ done
for i in "$PF" "$PF/$TGT" "build" "$BD/mingw" "$BD/mingw/build-$HST"
do
- [ -d "$i" ] || mkdir "$i" || updatemingw="true"
+ [ -d "$i" ] || mkdir "$i" || updatemingw="true"
done
if [[ $updatemingw == "true" ]]
@@ -73,10 +73,6 @@ then
then
rm mingw-w64-crt/misc/delayimp.c
fi
- if [ -f mingw-w64-crt/misc/mingw_getsp.S ]
- then
- rm mingw-w64-crt/misc/mingw_getsp.S
- fi
svn -q co https://mingw-w64.svn.sourceforge.net/svnroot/mingw-w64/branches/releases/v1.0 .
diff --git a/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp b/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp
index 41ea23da2..6436b86a2 100644
--- a/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp
+++ b/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp
@@ -753,51 +753,46 @@ HRESULT CMpaDecFilter::ProcessHdmvLPCM(bool bAlignOldBuffer) // Blu ray LPCM
{
WAVEFORMATEX_HDMV_LPCM* wfein = (WAVEFORMATEX_HDMV_LPCM*)m_pInput->CurrentMediaType().Format();
- BYTE* pDataIn = m_buff.GetData();
- int BytesPerChannelSample = (((wfein->wBitsPerSample + 7)&(~7))) / 8;
- int BytesPerSample = wfein->nChannels*BytesPerChannelSample; // Beliyaal: Old calculation only worked if nChannel*bytespersample is power of 2
- int oldlen = m_buff.GetCount();
- int len = (oldlen / BytesPerSample) * BytesPerSample;
+ scmap_t* remap = &s_scmap_hdmv [wfein->channel_conf];
+ int nChannels = wfein->nChannels;
+ int xChannels = nChannels + (nChannels % 2);
+ int BytesPerSample = (wfein->wBitsPerSample + 7) / 8;
+ int BytesPerFrame = BytesPerSample * xChannels;
+
+ BYTE* pDataIn = m_buff.GetData();
+ int len = m_buff.GetCount() - (m_buff.GetCount() % BytesPerFrame);
if (bAlignOldBuffer) {
m_buff.SetCount(len);
}
- scmap_t* remap = &s_scmap_hdmv [wfein->channel_conf];
+ int nFrames = len/xChannels/BytesPerSample;
CAtlArray<float> pBuff;
- pBuff.SetCount(len/BytesPerChannelSample);
-
+ pBuff.SetCount(nFrames*nChannels); //nSamples
float* pDataOut = pBuff.GetData();
switch (wfein->wBitsPerSample) {
case 16 :
- for (int i=0; i<len/wfein->nChannels/2; i++) {
- for(int j = 0; j < wfein->nChannels; j++) {
- int nRemap = remap->ch[j];
- *pDataOut = (float)(short)((pDataIn[nRemap*2]<<8)|pDataIn[nRemap*2+1]) / SHRT_MAX;
+ for (int i=0; i<nFrames; i++) {
+ for(int j = 0; j < nChannels; j++) {
+ BYTE nRemap = remap->ch[j];
+ *pDataOut = (float)(short)(pDataIn[nRemap*2]<<8 | pDataIn[nRemap*2+1]) / 32768;
pDataOut++;
}
- pDataIn += wfein->nChannels*2;
+ pDataIn += xChannels*2;
}
break;
-
case 24 :
case 20 :
- long lSample;
-
- for (int i=0; i<len/wfein->nChannels/3; i++) {
- for(int j = 0; j < wfein->nChannels; j++) {
- BYTE nRemap = remap->ch[j];
-
- lSample = (long)pDataIn[nRemap*3]<<24 | (long)pDataIn[nRemap*3+1]<<16 | (long)pDataIn[nRemap*3+2]<<8;
- *pDataOut = (float)(long)lSample / 0x80000000;
-
+ for (int i=0; i<nFrames; i++) {
+ for(int j = 0; j < nChannels; j++) {
+ BYTE nRemap = remap->ch[j];
+ *pDataOut = (float)(long)(pDataIn[nRemap*3]<<24 | pDataIn[nRemap*3+1]<<16 | pDataIn[nRemap*3+2]<<8) / 0x80000000;
pDataOut++;
}
- pDataIn += wfein->nChannels*3;
+ pDataIn += xChannels*3;
}
break;
}
-
memmove(m_buff.GetData(), pDataIn, m_buff.GetCount() - len );
m_buff.SetCount(m_buff.GetCount() - len);
@@ -1071,6 +1066,7 @@ HRESULT CMpaDecFilter::ProcessDTS()
if((size = dts_syncinfo(m_dts_state, p, &flags, &sample_rate, &bit_rate, &frame_length)) > 0) {
// TRACE(_T("dts: size=%d, flags=%08x, sample_rate=%d, bit_rate=%d, frame_length=%d\n"), size, flags, sample_rate, bit_rate, frame_length);
+ bit_rate = int (size * 8i64 * sample_rate / frame_length); // calculate actual bitrate
bool fEnoughData = p + size <= end;
@@ -1935,15 +1931,13 @@ HRESULT CMpaDecFilter::Deliver(BYTE* pBuff, int size, int bit_rate, BYTE type)
REFERENCE_TIME rtDur;
if(!padded) {
- rtDur = 10000000i64 * size*8 / bit_rate;
pDataOutW[3] = size*8;
_swab((char*)pBuff, (char*)&pDataOutW[4], size);
} else {
- const size_t blocks = (size + length - 1) / length;
- rtDur = 10000000i64 * blocks * length*8 / bit_rate;
pDataOutW[3] = length*8;
_swab((char*)pBuff, (char*)&pDataOutW[4], length);
}
+ rtDur = 10000000i64 * size*8 / bit_rate;
REFERENCE_TIME rtStart = m_rtStart, rtStop = m_rtStart + rtDur;
m_rtStart += rtDur;
diff --git a/src/thirdparty/lcms2/AUTHORS b/src/thirdparty/lcms2/AUTHORS
index d132ad51e..0536dbfb8 100644
--- a/src/thirdparty/lcms2/AUTHORS
+++ b/src/thirdparty/lcms2/AUTHORS
@@ -1,6 +1,4 @@
-(file still on the works)
-
Main Author
------------
Marti Maria
@@ -18,6 +16,7 @@ Chris Evans
Lorenzo Ridolfi
Robin Watts
Shawn Pedersen
+Andrew Brygin
Special Thanks
--------------
diff --git a/src/thirdparty/lcms2/COPYING b/src/thirdparty/lcms2/COPYING
index 407495012..79be162d8 100644
--- a/src/thirdparty/lcms2/COPYING
+++ b/src/thirdparty/lcms2/COPYING
@@ -1,5 +1,5 @@
Little CMS
-Copyright (c) 1998-2010 Marti Maria Saguer
+Copyright (c) 1998-2011 Marti Maria Saguer
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
diff --git a/src/thirdparty/lcms2/ChangeLog b/src/thirdparty/lcms2/ChangeLog
index f4ef1f554..86fbafdd9 100644
--- a/src/thirdparty/lcms2/ChangeLog
+++ b/src/thirdparty/lcms2/ChangeLog
@@ -38,4 +38,10 @@ Added functions to retrieve formatters from transforms
Fixed a bug that made crash black preservation on CMYK2CMYK devicelinks
Added named color functionality
Fixed a bug in black preservation and sligtly non-monotonic curves
-
+Added dictionary metatag support
+Fixed a bug on ReadRAWtag
+
+
+2.2 Maintenance release
+-----------------------
+
diff --git a/src/thirdparty/lcms2/include/lcms2.h b/src/thirdparty/lcms2/include/lcms2.h
index b09d607d5..359386125 100644
--- a/src/thirdparty/lcms2/include/lcms2.h
+++ b/src/thirdparty/lcms2/include/lcms2.h
@@ -23,7 +23,7 @@
//
//---------------------------------------------------------------------------------
//
-// Version 2.2a
+// Version 2.2
//
#ifndef _lcms2_H
@@ -248,6 +248,7 @@ typedef enum {
cmsSigCrdInfoType = 0x63726469, // 'crdi'
cmsSigCurveType = 0x63757276, // 'curv'
cmsSigDataType = 0x64617461, // 'data'
+ cmsSigDictType = 0x64696374, // 'dict'
cmsSigDateTimeType = 0x6474696D, // 'dtim'
cmsSigDeviceSettingsType = 0x64657673, // 'devs'
cmsSigLut16Type = 0x6d667432, // 'mft2'
@@ -273,10 +274,11 @@ typedef enum {
cmsSigUInt16ArrayType = 0x75693136, // 'ui16'
cmsSigUInt32ArrayType = 0x75693332, // 'ui32'
cmsSigUInt64ArrayType = 0x75693634, // 'ui64'
- cmsSigUInt8ArrayType = 0x75693038, // 'ui08'
+ cmsSigUInt8ArrayType = 0x75693038, // 'ui08'
+ cmsSigVcgtType = 0x76636774, // 'vcgt'
cmsSigViewingConditionsType = 0x76696577, // 'view'
- cmsSigXYZType = 0x58595A20, // 'XYZ '
- cmsSigVcgtType = 0x76636774 // 'vcgt'
+ cmsSigXYZType = 0x58595A20 // 'XYZ '
+
} cmsTagTypeSignature;
@@ -349,7 +351,8 @@ typedef enum {
cmsSigUcrBgTag = 0x62666420, // 'bfd '
cmsSigViewingCondDescTag = 0x76756564, // 'vued'
cmsSigViewingConditionsTag = 0x76696577, // 'view'
- cmsSigVcgtTag = 0x76636774 // 'vcgt'
+ cmsSigVcgtTag = 0x76636774, // 'vcgt'
+ cmsSigMetaTag = 0x6D657461 // 'meta'
} cmsTagSignature;
@@ -1299,6 +1302,27 @@ CMSAPI cmsSEQ* CMSEXPORT cmsAllocProfileSequenceDescription(cmsContext
CMSAPI cmsSEQ* CMSEXPORT cmsDupProfileSequenceDescription(const cmsSEQ* pseq);
CMSAPI void CMSEXPORT cmsFreeProfileSequenceDescription(cmsSEQ* pseq);
+// Dictionaries --------------------------------------------------------------------------------------------------------
+
+typedef struct _cmsDICTentry_struct {
+
+ struct _cmsDICTentry_struct* Next;
+
+ cmsMLU *DisplayName;
+ cmsMLU *DisplayValue;
+ wchar_t* Name;
+ wchar_t* Value;
+
+} cmsDICTentry;
+
+CMSAPI cmsHANDLE CMSEXPORT cmsDictAlloc(cmsContext ContextID);
+CMSAPI void CMSEXPORT cmsDictFree(cmsHANDLE hDict);
+CMSAPI cmsHANDLE CMSEXPORT cmsDictDup(cmsHANDLE hDict);
+
+CMSAPI cmsBool CMSEXPORT cmsDictAddEntry(cmsHANDLE hDict, const wchar_t* Name, const wchar_t* Value, const cmsMLU *DisplayName, const cmsMLU *DisplayValue);
+CMSAPI const cmsDICTentry* CMSEXPORT cmsDictGetEntryList(cmsHANDLE hDict);
+CMSAPI const cmsDICTentry* CMSEXPORT cmsDictNextEntry(const cmsDICTentry* e);
+
// Access to Profile data ----------------------------------------------------------------------------------------------
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateProfilePlaceholder(cmsContext ContextID);
diff --git a/src/thirdparty/lcms2/src/cmsio0.c b/src/thirdparty/lcms2/src/cmsio0.c
index c3e7440d9..2080c96d7 100644
--- a/src/thirdparty/lcms2/src/cmsio0.c
+++ b/src/thirdparty/lcms2/src/cmsio0.c
@@ -1361,7 +1361,6 @@ void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig)
if (n < 0) return NULL; // Not found, return NULL
-
// If the element is already in memory, return the pointer
if (Icc -> TagPtrs[n]) {
@@ -1461,7 +1460,10 @@ cmsBool CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const v
if (data == NULL) {
- cmsSignalError(cmsGetProfileContextID(hProfile), cmsERROR_NULL, "couldn't wite NULL to tag");
+ i = _cmsSearchTag(Icc, sig, FALSE);
+ if (i >= 0)
+ Icc ->TagNames[i] = (cmsTagSignature) 0;
+ // Unsupported by now, reserved for future ampliations (delete)
return FALSE;
}
@@ -1657,6 +1659,12 @@ cmsInt32Number CMSEXPORT cmsReadRawTag(cmsHPROFILE hProfile, cmsTagSignature sig
// Serialize
TypeHandler ->ContextID = Icc ->ContextID;
TypeHandler ->ICCVersion = Icc ->Version;
+
+ if (!_cmsWriteTypeBase(MemIO, TypeHandler ->Signature)) {
+ cmsCloseIOhandler(MemIO);
+ return 0;
+ }
+
if (!TypeHandler ->WritePtr(TypeHandler, MemIO, Object, TagDescriptor ->ElemCount)) {
cmsCloseIOhandler(MemIO);
return 0;
diff --git a/src/thirdparty/lcms2/src/cmsio1.c b/src/thirdparty/lcms2/src/cmsio1.c
index 8e4aad07a..ca1dd6902 100644
--- a/src/thirdparty/lcms2/src/cmsio1.c
+++ b/src/thirdparty/lcms2/src/cmsio1.c
@@ -512,8 +512,7 @@ cmsPipeline* _cmsReadDevicelinkLUT(cmsHPROFILE hProfile, int Intent)
// On named color, take the appropiate tag
if (cmsGetDeviceClass(hProfile) == cmsSigNamedColorClass) {
-
- cmsPipeline* Lut;
+
cmsNAMEDCOLORLIST* nc = (cmsNAMEDCOLORLIST*) cmsReadTag(hProfile, cmsSigNamedColor2Tag);
if (nc == NULL) return NULL;
diff --git a/src/thirdparty/lcms2/src/cmsnamed.c b/src/thirdparty/lcms2/src/cmsnamed.c
index 1df32c2a7..a1aff3965 100644
--- a/src/thirdparty/lcms2/src/cmsnamed.c
+++ b/src/thirdparty/lcms2/src/cmsnamed.c
@@ -32,29 +32,29 @@
// Allocates an empty multi localizad unicode object
cmsMLU* CMSEXPORT cmsMLUalloc(cmsContext ContextID, cmsUInt32Number nItems)
{
- cmsMLU* mlu;
+ cmsMLU* mlu;
- // nItems should be positive if given
- if (nItems <= 0) nItems = 2;
+ // nItems should be positive if given
+ if (nItems <= 0) nItems = 2;
- // Create the container
- mlu = (cmsMLU*) _cmsMallocZero(ContextID, sizeof(cmsMLU));
- if (mlu == NULL) return NULL;
+ // Create the container
+ mlu = (cmsMLU*) _cmsMallocZero(ContextID, sizeof(cmsMLU));
+ if (mlu == NULL) return NULL;
- mlu ->ContextID = ContextID;
+ mlu ->ContextID = ContextID;
- // Create entry array
- mlu ->Entries = (_cmsMLUentry*) _cmsCalloc(ContextID, nItems, sizeof(_cmsMLUentry));
- if (mlu ->Entries == NULL) {
- _cmsFree(ContextID, mlu);
- return NULL;
- }
+ // Create entry array
+ mlu ->Entries = (_cmsMLUentry*) _cmsCalloc(ContextID, nItems, sizeof(_cmsMLUentry));
+ if (mlu ->Entries == NULL) {
+ _cmsFree(ContextID, mlu);
+ return NULL;
+ }
- // Ok, keep indexes up to date
- mlu ->AllocatedEntries = nItems;
- mlu ->UsedEntries = 0;
+ // Ok, keep indexes up to date
+ mlu ->AllocatedEntries = nItems;
+ mlu ->UsedEntries = 0;
- return mlu;
+ return mlu;
}
@@ -62,29 +62,29 @@ cmsMLU* CMSEXPORT cmsMLUalloc(cmsContext ContextID, cmsUInt32Number nItems)
static
cmsBool GrowMLUpool(cmsMLU* mlu)
{
- cmsUInt32Number size;
- void *NewPtr;
+ cmsUInt32Number size;
+ void *NewPtr;
- // Sanity check
- if (mlu == NULL) return FALSE;
+ // Sanity check
+ if (mlu == NULL) return FALSE;
- if (mlu ->PoolSize == 0)
- size = 256;
- else
- size = mlu ->PoolSize * 2;
+ if (mlu ->PoolSize == 0)
+ size = 256;
+ else
+ size = mlu ->PoolSize * 2;
- // Check for overflow
- if (size < mlu ->PoolSize) return FALSE;
+ // Check for overflow
+ if (size < mlu ->PoolSize) return FALSE;
- // Reallocate the pool
- NewPtr = _cmsRealloc(mlu ->ContextID, mlu ->MemPool, size);
- if (NewPtr == NULL) return FALSE;
+ // Reallocate the pool
+ NewPtr = _cmsRealloc(mlu ->ContextID, mlu ->MemPool, size);
+ if (NewPtr == NULL) return FALSE;
- mlu ->MemPool = NewPtr;
- mlu ->PoolSize = size;
+ mlu ->MemPool = NewPtr;
+ mlu ->PoolSize = size;
- return TRUE;
+ return TRUE;
}
@@ -94,16 +94,16 @@ cmsBool GrowMLUtable(cmsMLU* mlu)
{
int AllocatedEntries;
_cmsMLUentry *NewPtr;
-
- // Sanity check
- if (mlu == NULL) return FALSE;
+
+ // Sanity check
+ if (mlu == NULL) return FALSE;
AllocatedEntries = mlu ->AllocatedEntries * 2;
- // Check for overflow
- if (AllocatedEntries / 2 != mlu ->AllocatedEntries) return FALSE;
+ // Check for overflow
+ if (AllocatedEntries / 2 != mlu ->AllocatedEntries) return FALSE;
- // Reallocate the memory
+ // Reallocate the memory
NewPtr = (_cmsMLUentry*)_cmsRealloc(mlu ->ContextID, mlu ->Entries, AllocatedEntries*sizeof(_cmsMLUentry));
if (NewPtr == NULL) return FALSE;
@@ -119,18 +119,18 @@ static
int SearchMLUEntry(cmsMLU* mlu, cmsUInt16Number LanguageCode, cmsUInt16Number CountryCode)
{
int i;
-
- // Sanity check
- if (mlu == NULL) return -1;
+
+ // Sanity check
+ if (mlu == NULL) return -1;
- // Iterate whole table
+ // Iterate whole table
for (i=0; i < mlu ->UsedEntries; i++) {
if (mlu ->Entries[i].Country == CountryCode &&
mlu ->Entries[i].Language == LanguageCode) return i;
}
- // Not found
+ // Not found
return -1;
}
@@ -143,8 +143,8 @@ cmsBool AddMLUBlock(cmsMLU* mlu, cmsUInt32Number size, const wchar_t *Block,
cmsUInt32Number Offset;
cmsUInt8Number* Ptr;
- // Sanity check
- if (mlu == NULL) return FALSE;
+ // Sanity check
+ if (mlu == NULL) return FALSE;
// Is there any room available?
if (mlu ->UsedEntries >= mlu ->AllocatedEntries) {
@@ -155,17 +155,17 @@ cmsBool AddMLUBlock(cmsMLU* mlu, cmsUInt32Number size, const wchar_t *Block,
if (SearchMLUEntry(mlu, LanguageCode, CountryCode) >= 0) return FALSE; // Only one is allowed!
// Check for size
- while ((mlu ->PoolSize - mlu ->PoolUsed) < size) {
+ while ((mlu ->PoolSize - mlu ->PoolUsed) < size) {
if (!GrowMLUpool(mlu)) return FALSE;
- }
+ }
Offset = mlu ->PoolUsed;
- Ptr = (cmsUInt8Number*) mlu ->MemPool;
- if (Ptr == NULL) return FALSE;
+ Ptr = (cmsUInt8Number*) mlu ->MemPool;
+ if (Ptr == NULL) return FALSE;
- // Set the entry
+ // Set the entry
memmove(Ptr + Offset, Block, size);
mlu ->PoolUsed += size;
@@ -209,7 +209,7 @@ cmsUInt32Number mywcslen(const wchar_t *s)
{
const wchar_t *p;
- p = s;
+ p = s;
while (*p)
p++;
@@ -225,7 +225,7 @@ cmsBool CMSEXPORT cmsMLUsetWide(cmsMLU* mlu, const char Language[3], const char
cmsUInt32Number len;
if (mlu == NULL) return FALSE;
- if (WideString == NULL) return FALSE;
+ if (WideString == NULL) return FALSE;
len = (cmsUInt32Number) (mywcslen(WideString) + 1) * sizeof(wchar_t);
return AddMLUBlock(mlu, len, WideString, Lang, Cntry);
@@ -234,59 +234,59 @@ cmsBool CMSEXPORT cmsMLUsetWide(cmsMLU* mlu, const char Language[3], const char
// Duplicating a MLU is as easy as copying all members
cmsMLU* CMSEXPORT cmsMLUdup(const cmsMLU* mlu)
{
- cmsMLU* NewMlu = NULL;
+ cmsMLU* NewMlu = NULL;
- // Duplicating a NULL obtains a NULL
- if (mlu == NULL) return NULL;
+ // Duplicating a NULL obtains a NULL
+ if (mlu == NULL) return NULL;
- NewMlu = cmsMLUalloc(mlu ->ContextID, mlu ->UsedEntries);
- if (NewMlu == NULL) return NULL;
+ NewMlu = cmsMLUalloc(mlu ->ContextID, mlu ->UsedEntries);
+ if (NewMlu == NULL) return NULL;
- // Should never happen
- if (NewMlu ->AllocatedEntries < mlu ->UsedEntries)
- goto Error;
+ // Should never happen
+ if (NewMlu ->AllocatedEntries < mlu ->UsedEntries)
+ goto Error;
- // Sanitize...
- if (NewMlu ->Entries == NULL || mlu ->Entries == NULL) goto Error;
+ // Sanitize...
+ if (NewMlu ->Entries == NULL || mlu ->Entries == NULL) goto Error;
- memmove(NewMlu ->Entries, mlu ->Entries, mlu ->UsedEntries * sizeof(_cmsMLUentry));
- NewMlu ->UsedEntries = mlu ->UsedEntries;
+ memmove(NewMlu ->Entries, mlu ->Entries, mlu ->UsedEntries * sizeof(_cmsMLUentry));
+ NewMlu ->UsedEntries = mlu ->UsedEntries;
- // The MLU may be empty
- if (mlu ->PoolUsed == 0) {
- NewMlu ->MemPool = NULL;
- }
- else {
- // It is not empty
- NewMlu ->MemPool = _cmsMalloc(mlu ->ContextID, mlu ->PoolUsed);
- if (NewMlu ->MemPool == NULL) goto Error;
- }
+ // The MLU may be empty
+ if (mlu ->PoolUsed == 0) {
+ NewMlu ->MemPool = NULL;
+ }
+ else {
+ // It is not empty
+ NewMlu ->MemPool = _cmsMalloc(mlu ->ContextID, mlu ->PoolUsed);
+ if (NewMlu ->MemPool == NULL) goto Error;
+ }
- NewMlu ->PoolSize = mlu ->PoolUsed;
+ NewMlu ->PoolSize = mlu ->PoolUsed;
- if (NewMlu ->MemPool == NULL || mlu ->MemPool == NULL) goto Error;
+ if (NewMlu ->MemPool == NULL || mlu ->MemPool == NULL) goto Error;
- memmove(NewMlu ->MemPool, mlu->MemPool, mlu ->PoolUsed);
- NewMlu ->PoolUsed = mlu ->PoolUsed;
+ memmove(NewMlu ->MemPool, mlu->MemPool, mlu ->PoolUsed);
+ NewMlu ->PoolUsed = mlu ->PoolUsed;
- return NewMlu;
+ return NewMlu;
Error:
- if (NewMlu != NULL) cmsMLUfree(NewMlu);
- return NULL;
+ if (NewMlu != NULL) cmsMLUfree(NewMlu);
+ return NULL;
}
// Free any used memory
void CMSEXPORT cmsMLUfree(cmsMLU* mlu)
{
- if (mlu) {
+ if (mlu) {
- if (mlu -> Entries) _cmsFree(mlu ->ContextID, mlu->Entries);
- if (mlu -> MemPool) _cmsFree(mlu ->ContextID, mlu->MemPool);
+ if (mlu -> Entries) _cmsFree(mlu ->ContextID, mlu->Entries);
+ if (mlu -> MemPool) _cmsFree(mlu ->ContextID, mlu->MemPool);
- _cmsFree(mlu ->ContextID, mlu);
- }
+ _cmsFree(mlu ->ContextID, mlu);
+ }
}
@@ -294,13 +294,13 @@ void CMSEXPORT cmsMLUfree(cmsMLU* mlu)
// the Language. If none is found, first entry is used instead.
static
const wchar_t* _cmsMLUgetWide(const cmsMLU* mlu,
- cmsUInt32Number *len,
- cmsUInt16Number LanguageCode, cmsUInt16Number CountryCode,
- cmsUInt16Number* UsedLanguageCode, cmsUInt16Number* UsedCountryCode)
+ cmsUInt32Number *len,
+ cmsUInt16Number LanguageCode, cmsUInt16Number CountryCode,
+ cmsUInt16Number* UsedLanguageCode, cmsUInt16Number* UsedCountryCode)
{
int i;
int Best = -1;
- _cmsMLUentry* v;
+ _cmsMLUentry* v;
if (mlu == NULL) return NULL;
@@ -316,8 +316,8 @@ const wchar_t* _cmsMLUgetWide(const cmsMLU* mlu,
if (v -> Country == CountryCode) {
- if (UsedLanguageCode != NULL) *UsedLanguageCode = v ->Language;
- if (UsedCountryCode != NULL) *UsedCountryCode = v ->Country;
+ if (UsedLanguageCode != NULL) *UsedLanguageCode = v ->Language;
+ if (UsedCountryCode != NULL) *UsedCountryCode = v ->Country;
if (len != NULL) *len = v ->Len;
@@ -330,30 +330,30 @@ const wchar_t* _cmsMLUgetWide(const cmsMLU* mlu,
if (Best == -1)
Best = 0;
- v = mlu ->Entries + Best;
+ v = mlu ->Entries + Best;
- if (UsedLanguageCode != NULL) *UsedLanguageCode = v ->Language;
- if (UsedCountryCode != NULL) *UsedCountryCode = v ->Country;
+ if (UsedLanguageCode != NULL) *UsedLanguageCode = v ->Language;
+ if (UsedCountryCode != NULL) *UsedCountryCode = v ->Country;
if (len != NULL) *len = v ->Len;
- return(wchar_t*) ((cmsUInt8Number*) mlu ->MemPool + v ->StrW);
+ return(wchar_t*) ((cmsUInt8Number*) mlu ->MemPool + v ->StrW);
}
// Obtain an ASCII representation of the wide string. Setting buffer to NULL returns the len
cmsUInt32Number CMSEXPORT cmsMLUgetASCII(const cmsMLU* mlu,
- const char LanguageCode[3], const char CountryCode[3],
- char* Buffer, cmsUInt32Number BufferSize)
+ const char LanguageCode[3], const char CountryCode[3],
+ char* Buffer, cmsUInt32Number BufferSize)
{
const wchar_t *Wide;
cmsUInt32Number StrLen = 0;
cmsUInt32Number ASCIIlen, i;
- cmsUInt16Number Lang = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
+ cmsUInt16Number Lang = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) CountryCode);
- // Sanitize
+ // Sanitize
if (mlu == NULL) return 0;
// Get WideChar
@@ -381,23 +381,23 @@ cmsUInt32Number CMSEXPORT cmsMLUgetASCII(const cmsMLU* mlu,
Buffer[i] = (char) Wide[i];
}
- // We put a termination "\0"
+ // We put a termination "\0"
Buffer[ASCIIlen] = 0;
return ASCIIlen + 1;
}
// Obtain a wide representation of the MLU, on depending on current locale settings
cmsUInt32Number CMSEXPORT cmsMLUgetWide(const cmsMLU* mlu,
- const char LanguageCode[3], const char CountryCode[3],
- wchar_t* Buffer, cmsUInt32Number BufferSize)
+ const char LanguageCode[3], const char CountryCode[3],
+ wchar_t* Buffer, cmsUInt32Number BufferSize)
{
const wchar_t *Wide;
cmsUInt32Number StrLen = 0;
- cmsUInt16Number Lang = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
+ cmsUInt16Number Lang = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) CountryCode);
- // Sanitize
+ // Sanitize
if (mlu == NULL) return 0;
Wide = _cmsMLUgetWide(mlu, &StrLen, Lang, Cntry, NULL, NULL);
@@ -414,7 +414,7 @@ cmsUInt32Number CMSEXPORT cmsMLUgetWide(const cmsMLU* mlu,
StrLen = BufferSize - + sizeof(wchar_t);
memmove(Buffer, Wide, StrLen);
- Buffer[StrLen / sizeof(wchar_t)] = 0;
+ Buffer[StrLen / sizeof(wchar_t)] = 0;
return StrLen + sizeof(wchar_t);
}
@@ -422,27 +422,27 @@ cmsUInt32Number CMSEXPORT cmsMLUgetWide(const cmsMLU* mlu,
// Get also the language and country
CMSAPI cmsBool CMSEXPORT cmsMLUgetTranslation(const cmsMLU* mlu,
- const char LanguageCode[3], const char CountryCode[3],
- char ObtainedLanguage[3], char ObtainedCountry[3])
+ const char LanguageCode[3], const char CountryCode[3],
+ char ObtainedLanguage[3], char ObtainedCountry[3])
{
- const wchar_t *Wide;
+ const wchar_t *Wide;
- cmsUInt16Number Lang = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
+ cmsUInt16Number Lang = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) CountryCode);
cmsUInt16Number ObtLang, ObtCode;
- // Sanitize
+ // Sanitize
if (mlu == NULL) return FALSE;
Wide = _cmsMLUgetWide(mlu, NULL, Lang, Cntry, &ObtLang, &ObtCode);
- if (Wide == NULL) return FALSE;
+ if (Wide == NULL) return FALSE;
- // Get used language and code
+ // Get used language and code
*(cmsUInt16Number *)ObtainedLanguage = _cmsAdjustEndianess16(ObtLang);
- *(cmsUInt16Number *)ObtainedCountry = _cmsAdjustEndianess16(ObtCode);
+ *(cmsUInt16Number *)ObtainedCountry = _cmsAdjustEndianess16(ObtCode);
- ObtainedLanguage[2] = ObtainedCountry[2] = 0;
- return TRUE;
+ ObtainedLanguage[2] = ObtainedCountry[2] = 0;
+ return TRUE;
}
@@ -657,12 +657,12 @@ void EvalNamedColor(const cmsFloat32Number In[], cmsFloat32Number Out[], const c
cmsStage* _cmsStageAllocNamedColor(cmsNAMEDCOLORLIST* NamedColorList, cmsBool UsePCS)
{
return _cmsStageAllocPlaceholder(NamedColorList ->ContextID,
- cmsSigNamedColorElemType,
+ cmsSigNamedColorElemType,
1, UsePCS ? 3 : NamedColorList ->ColorantCount,
- UsePCS ? EvalNamedColorPCS : EvalNamedColor,
- DupNamedColorList,
- FreeNamedColorList,
- cmsDupNamedColorList(NamedColorList));
+ UsePCS ? EvalNamedColorPCS : EvalNamedColor,
+ DupNamedColorList,
+ FreeNamedColorList,
+ cmsDupNamedColorList(NamedColorList));
}
@@ -763,6 +763,131 @@ Error:
return NULL;
}
+// Dictionaries --------------------------------------------------------------------------------------------------------
+
+// Dictionaries are just very simple linked lists
+
+
+typedef struct _cmsDICT_struct {
+ cmsDICTentry* head;
+ cmsContext ContextID;
+} _cmsDICT;
+
+
+// Allocate an empty dictionary
+cmsHANDLE CMSEXPORT cmsDictAlloc(cmsContext ContextID)
+{
+ _cmsDICT* dict = (_cmsDICT*) _cmsMallocZero(ContextID, sizeof(_cmsDICT));
+ if (dict == NULL) return NULL;
+
+ dict ->ContextID = ContextID;
+ return (cmsHANDLE) dict;
+
+}
+
+// Dispose resources
+void CMSEXPORT cmsDictFree(cmsHANDLE hDict)
+{
+ _cmsDICT* dict = (_cmsDICT*) hDict;
+ cmsDICTentry *entry, *next;
+
+ _cmsAssert(dict != NULL);
+
+ // Walk the list freeing all nodes
+ entry = dict ->head;
+ while (entry != NULL) {
+
+ if (entry ->DisplayName != NULL) cmsMLUfree(entry ->DisplayName);
+ if (entry ->DisplayValue != NULL) cmsMLUfree(entry ->DisplayValue);
+ if (entry ->Name != NULL) _cmsFree(dict ->ContextID, entry -> Name);
+ if (entry ->Value != NULL) _cmsFree(dict ->ContextID, entry -> Value);
+
+ // Don't fall in the habitual trap...
+ next = entry ->Next;
+ _cmsFree(dict ->ContextID, entry);
+
+ entry = next;
+ }
+
+ _cmsFree(dict ->ContextID, dict);
+}
+
+// Duplicate a wide char string
+static
+wchar_t* DupWcs(cmsContext ContextID, const wchar_t* ptr)
+{
+ if (ptr == NULL) return NULL;
+ return (wchar_t*) _cmsDupMem(ContextID, ptr, (mywcslen(ptr) + 1) * sizeof(wchar_t));
+}
+// Add a new entry to the linked list
+cmsBool CMSEXPORT cmsDictAddEntry(cmsHANDLE hDict, const wchar_t* Name, const wchar_t* Value, const cmsMLU *DisplayName, const cmsMLU *DisplayValue)
+{
+ _cmsDICT* dict = (_cmsDICT*) hDict;
+ cmsDICTentry *entry;
+ _cmsAssert(dict != NULL);
+ _cmsAssert(Name != NULL);
+
+ entry = (cmsDICTentry*) _cmsMallocZero(dict ->ContextID, sizeof(cmsDICTentry));
+ if (entry == NULL) return FALSE;
+
+ entry ->DisplayName = cmsMLUdup(DisplayName);
+ entry ->DisplayValue = cmsMLUdup(DisplayValue);
+ entry ->Name = DupWcs(dict ->ContextID, Name);
+ entry ->Value = DupWcs(dict ->ContextID, Value);
+
+ entry ->Next = dict ->head;
+ dict ->head = entry;
+
+ return TRUE;
+}
+
+
+// Duplicates an existing dictionary
+cmsHANDLE CMSEXPORT cmsDictDup(cmsHANDLE hDict)
+{
+ _cmsDICT* old_dict = (_cmsDICT*) hDict;
+ cmsHANDLE hNew;
+ _cmsDICT* new_dict;
+ cmsDICTentry *entry;
+
+ _cmsAssert(old_dict != NULL);
+
+ hNew = cmsDictAlloc(old_dict ->ContextID);
+ if (hNew == NULL) return NULL;
+
+ new_dict = (_cmsDICT*) hNew;
+
+ // Walk the list freeing all nodes
+ entry = old_dict ->head;
+ while (entry != NULL) {
+
+ if (!cmsDictAddEntry(hNew, entry ->Name, entry ->Value, entry ->DisplayName, entry ->DisplayValue)) {
+
+ cmsDictFree(hNew);
+ return NULL;
+ }
+
+ entry = entry -> Next;
+ }
+
+ return hNew;
+}
+
+// Get a pointer to the linked list
+const cmsDICTentry* CMSEXPORT cmsDictGetEntryList(cmsHANDLE hDict)
+{
+ _cmsDICT* dict = (_cmsDICT*) hDict;
+
+ if (dict == NULL) return NULL;
+ return dict ->head;
+}
+
+// Helper For external languages
+const cmsDICTentry* CMSEXPORT cmsDictNextEntry(const cmsDICTentry* e)
+{
+ if (e == NULL) return NULL;
+ return e ->Next;
+}
diff --git a/src/thirdparty/lcms2/src/cmstypes.c b/src/thirdparty/lcms2/src/cmstypes.c
index 3af8c8983..52d6c6b18 100644
--- a/src/thirdparty/lcms2/src/cmstypes.c
+++ b/src/thirdparty/lcms2/src/cmstypes.c
@@ -165,7 +165,7 @@ typedef cmsBool (* PositionTableEntryFn)(struct _cms_typehandler_struct* self,
cmsUInt32Number SizeOfTag);
// Helper function to deal with position tables as decribed in several addendums to ICC spec 4.2
-// A table of n elements is written, where first comes n records containing offsets and sizes and
+// A table of n elements is readed, where first comes n records containing offsets and sizes and
// then a block containing the data itself. This allows to reuse same data in more than one entry
static
cmsBool ReadPositionTable(struct _cms_typehandler_struct* self,
@@ -4733,6 +4733,435 @@ void Type_vcgt_Free(struct _cms_typehandler_struct* self, void* Ptr)
_cmsFree(self ->ContextID, Ptr);
}
+
+// ********************************************************************************
+// Type cmsSigDictType
+// ********************************************************************************
+
+// Single column of the table can point to wchar or MLUC elements. Holds arrays of data
+typedef struct {
+ cmsContext ContextID;
+ cmsUInt32Number *Offsets;
+ cmsUInt32Number *Sizes;
+} _cmsDICelem;
+
+typedef struct {
+ _cmsDICelem Name, Value, DisplayName, DisplayValue;
+
+} _cmsDICarray;
+
+// Allocate an empty array element
+static
+cmsBool AllocElem(cmsContext ContextID, _cmsDICelem* e, cmsUInt32Number Count)
+{
+ e->Offsets = (cmsUInt32Number *) _cmsCalloc(ContextID, Count, sizeof(cmsUInt32Number *));
+ if (e->Offsets == NULL) return FALSE;
+
+ e->Sizes = (cmsUInt32Number *) _cmsCalloc(ContextID, Count, sizeof(cmsUInt32Number *));
+ if (e->Sizes == NULL) {
+
+ _cmsFree(ContextID, e -> Offsets);
+ return FALSE;
+ }
+
+ e ->ContextID = ContextID;
+ return TRUE;
+}
+
+// Free an array element
+static
+void FreeElem(_cmsDICelem* e)
+{
+ if (e ->Offsets != NULL) _cmsFree(e -> ContextID, e -> Offsets);
+ if (e ->Sizes != NULL) _cmsFree(e -> ContextID, e ->Sizes);
+ e->Offsets = e ->Sizes = NULL;
+}
+
+// Get rid of whole array
+static
+void FreeArray( _cmsDICarray* a)
+{
+ if (a ->Name.Offsets != NULL) FreeElem(&a->Name);
+ if (a ->Value.Offsets != NULL) FreeElem(&a ->Value);
+ if (a ->DisplayName.Offsets != NULL) FreeElem(&a->DisplayName);
+ if (a ->DisplayValue.Offsets != NULL) FreeElem(&a ->DisplayValue);
+}
+
+
+// Allocate whole array
+static
+cmsBool AllocArray(cmsContext ContextID, _cmsDICarray* a, cmsUInt32Number Count, cmsUInt32Number Length)
+{
+ // Empty values
+ memset(a, 0, sizeof(_cmsDICarray));
+
+ // On depending on record size, create column arrays
+ if (!AllocElem(ContextID, &a ->Name, Count)) goto Error;
+ if (!AllocElem(ContextID, &a ->Value, Count)) goto Error;
+
+ if (Length > 16) {
+ if (!AllocElem(ContextID, &a -> DisplayName, Count)) goto Error;
+
+ }
+ if (Length > 24) {
+ if (!AllocElem(ContextID, &a ->DisplayValue, Count)) goto Error;
+ }
+ return TRUE;
+
+Error:
+ FreeArray(a);
+ return FALSE;
+}
+
+// Read one element
+static
+cmsBool ReadOneElem(cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i, cmsUInt32Number BaseOffset)
+{
+ if (!_cmsReadUInt32Number(io, &e->Offsets[i])) return FALSE;
+ if (!_cmsReadUInt32Number(io, &e ->Sizes[i])) return FALSE;
+
+ // An offset of zero has special meaning and shal be preserved
+ if (e ->Offsets[i] > 0)
+ e ->Offsets[i] += BaseOffset;
+ return TRUE;
+}
+
+
+static
+cmsBool ReadOffsetArray(cmsIOHANDLER* io, _cmsDICarray* a, cmsUInt32Number Count, cmsUInt32Number Length, cmsUInt32Number BaseOffset)
+{
+ cmsUInt32Number i;
+
+ // Read column arrays
+ for (i=0; i < Count; i++) {
+
+ if (!ReadOneElem(io, &a -> Name, i, BaseOffset)) return FALSE;
+ if (!ReadOneElem(io, &a -> Value, i, BaseOffset)) return FALSE;
+
+ if (Length > 16) {
+
+ if (!ReadOneElem(io, &a ->DisplayName, i, BaseOffset)) return FALSE;
+
+ }
+
+ if (Length > 24) {
+
+ if (!ReadOneElem(io, & a -> DisplayValue, i, BaseOffset)) return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+
+// Write one element
+static
+cmsBool WriteOneElem(cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i)
+{
+ if (!_cmsWriteUInt32Number(io, e->Offsets[i])) return FALSE;
+ if (!_cmsWriteUInt32Number(io, e ->Sizes[i])) return FALSE;
+
+ return TRUE;
+}
+
+static
+cmsBool WriteOffsetArray(cmsIOHANDLER* io, _cmsDICarray* a, cmsUInt32Number Count, cmsUInt32Number Length)
+{
+ cmsUInt32Number i;
+
+ for (i=0; i < Count; i++) {
+
+ if (!WriteOneElem(io, &a -> Name, i)) return FALSE;
+ if (!WriteOneElem(io, &a -> Value, i)) return FALSE;
+
+ if (Length > 16) {
+
+ if (!WriteOneElem(io, &a -> DisplayName, i)) return FALSE;
+ }
+
+ if (Length > 24) {
+
+ if (!WriteOneElem(io, &a -> DisplayValue, i)) return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+static
+cmsBool ReadOneWChar(cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i, wchar_t ** wcstr)
+{
+
+ cmsUInt32Number nChars;
+
+ // Special case for undefined strings (see ICC Votable
+ // Proposal Submission, Dictionary Type and Metadata TAG Definition)
+ if (e -> Offsets[i] == 0) {
+
+ *wcstr = NULL;
+ return TRUE;
+ }
+
+ if (!io -> Seek(io, e -> Offsets[i])) return FALSE;
+
+ nChars = e ->Sizes[i] / sizeof(cmsUInt16Number);
+
+
+ *wcstr = (wchar_t*) _cmsMallocZero(e ->ContextID, (nChars + 1) * sizeof(wchar_t));
+ if (*wcstr == NULL) return FALSE;
+
+ if (!_cmsReadWCharArray(io, nChars, *wcstr)) {
+ _cmsFree(e ->ContextID, *wcstr);
+ return FALSE;
+ }
+
+ // End of string marker
+ (*wcstr)[nChars] = 0;
+ return TRUE;
+}
+
+static
+cmsUInt32Number mywcslen(const wchar_t *s)
+{
+ const wchar_t *p;
+
+ p = s;
+ while (*p)
+ p++;
+
+ return (cmsUInt32Number)(p - s);
+}
+
+static
+cmsBool WriteOneWChar(cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i, const wchar_t * wcstr, cmsUInt32Number BaseOffset)
+{
+ cmsUInt32Number Before = io ->Tell(io);
+ cmsUInt32Number n;
+
+ e ->Offsets[i] = Before - BaseOffset;
+
+ if (wcstr == NULL) {
+ e ->Sizes[i] = 0;
+ e ->Offsets[i] = 0;
+ return TRUE;
+ }
+
+ n = mywcslen(wcstr);
+ if (!_cmsWriteWCharArray(io, n, wcstr)) return FALSE;
+
+ e ->Sizes[i] = io ->Tell(io) - Before;
+ return TRUE;
+}
+
+static
+cmsBool ReadOneMLUC(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i, cmsMLU** mlu)
+{
+ cmsUInt32Number nItems = 0;
+
+ // A way to get null MLUCs
+ if (e -> Offsets[i] == 0 || e ->Sizes[i] == 0) {
+
+ *mlu = NULL;
+ return TRUE;
+ }
+
+ if (!io -> Seek(io, e -> Offsets[i])) return FALSE;
+
+ *mlu = (cmsMLU*) Type_MLU_Read(self, io, &nItems, e ->Sizes[i]);
+ return *mlu != NULL;
+}
+
+static
+cmsBool WriteOneMLUC(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i, const cmsMLU* mlu, cmsUInt32Number BaseOffset)
+{
+ cmsUInt32Number Before;
+
+ // Special case for undefined strings (see ICC Votable
+ // Proposal Submission, Dictionary Type and Metadata TAG Definition)
+ if (mlu == NULL) {
+ e ->Sizes[i] = 0;
+ e ->Offsets[i] = 0;
+ return TRUE;
+ }
+
+ Before = io ->Tell(io);
+ e ->Offsets[i] = Before - BaseOffset;
+
+ if (!Type_MLU_Write(self, io, (void*) mlu, 1)) return FALSE;
+
+ e ->Sizes[i] = io ->Tell(io) - Before;
+ return TRUE;
+}
+
+
+static
+void *Type_Dictionary_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag)
+{
+ cmsHANDLE hDict;
+ cmsUInt32Number i, Count, Length;
+ cmsUInt32Number BaseOffset;
+ _cmsDICarray a;
+ wchar_t *NameWCS = NULL, *ValueWCS = NULL;
+ cmsMLU *DisplayNameMLU = NULL, *DisplayValueMLU=NULL;
+ cmsBool rc;
+
+ *nItems = 0;
+
+ // Get actual position as a basis for element offsets
+ BaseOffset = io ->Tell(io) - sizeof(_cmsTagBase);
+
+ // Get name-value record count
+ if (!_cmsReadUInt32Number(io, &Count)) return NULL;
+ SizeOfTag -= sizeof(cmsUInt32Number);
+
+ // Get rec lenghth
+ if (!_cmsReadUInt32Number(io, &Length)) return NULL;
+ SizeOfTag -= sizeof(cmsUInt32Number);
+
+ // Check for valid lengths
+ if (Length != 16 && Length != 24 && Length != 32) {
+ cmsSignalError(self->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown record length in dictionary '%d'", Length);
+ return NULL;
+ }
+
+ // Creates an empty dictionary
+ hDict = cmsDictAlloc(self -> ContextID);
+ if (hDict == NULL) return NULL;
+
+ // On depending on record size, create column arrays
+ if (!AllocArray(self -> ContextID, &a, Count, Length)) goto Error;
+
+ // Read column arrays
+ if (!ReadOffsetArray(io, &a, Count, Length, BaseOffset)) goto Error;
+
+ // Seek to each element and read it
+ for (i=0; i < Count; i++) {
+
+ if (!ReadOneWChar(io, &a.Name, i, &NameWCS)) goto Error;
+ if (!ReadOneWChar(io, &a.Value, i, &ValueWCS)) goto Error;
+
+ if (Length > 16) {
+ if (!ReadOneMLUC(self, io, &a.DisplayName, i, &DisplayNameMLU)) goto Error;
+ }
+
+ if (Length > 24) {
+ if (!ReadOneMLUC(self, io, &a.DisplayValue, i, &DisplayValueMLU)) goto Error;
+ }
+
+ rc = cmsDictAddEntry(hDict, NameWCS, ValueWCS, DisplayNameMLU, DisplayValueMLU);
+
+ if (NameWCS != NULL) _cmsFree(self ->ContextID, NameWCS);
+ if (ValueWCS != NULL) _cmsFree(self ->ContextID, ValueWCS);
+ if (DisplayNameMLU != NULL) cmsMLUfree(DisplayNameMLU);
+ if (DisplayValueMLU != NULL) cmsMLUfree(DisplayValueMLU);
+
+ if (!rc) return FALSE;
+ }
+
+ FreeArray(&a);
+ *nItems = 1;
+ return (void*) hDict;
+
+Error:
+ FreeArray(&a);
+ cmsDictFree(hDict);
+ return NULL;
+}
+
+
+static
+cmsBool Type_Dictionary_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
+{
+ cmsHANDLE hDict = (cmsHANDLE) Ptr;
+ const cmsDICTentry* p;
+ cmsBool AnyName, AnyValue;
+ cmsUInt32Number i, Count, Length;
+ cmsUInt32Number DirectoryPos, CurrentPos, BaseOffset;
+ _cmsDICarray a;
+
+ if (hDict == NULL) return FALSE;
+
+ BaseOffset = io ->Tell(io) - sizeof(_cmsTagBase);
+
+ // Let's inspect the dictionary
+ Count = 0; AnyName = FALSE; AnyValue = FALSE;
+ for (p = cmsDictGetEntryList(hDict); p != NULL; p = cmsDictNextEntry(p)) {
+
+ if (p ->DisplayName != NULL) AnyName = TRUE;
+ if (p ->DisplayValue != NULL) AnyValue = TRUE;
+ Count++;
+ }
+
+ Length = 16;
+ if (AnyName) Length += 8;
+ if (AnyValue) Length += 8;
+
+ if (!_cmsWriteUInt32Number(io, Count)) return FALSE;
+ if (!_cmsWriteUInt32Number(io, Length)) return FALSE;
+
+ // Keep starting position of offsets table
+ DirectoryPos = io ->Tell(io);
+
+ // Allocate offsets array
+ if (!AllocArray(self ->ContextID, &a, Count, Length)) goto Error;
+
+ // Write a fake directory to be filled latter on
+ if (!WriteOffsetArray(io, &a, Count, Length)) goto Error;
+
+ // Write each element. Keep track of the size as well.
+ p = cmsDictGetEntryList(hDict);
+ for (i=0; i < Count; i++) {
+
+ if (!WriteOneWChar(io, &a.Name, i, p ->Name, BaseOffset)) goto Error;
+ if (!WriteOneWChar(io, &a.Value, i, p ->Value, BaseOffset)) goto Error;
+
+ if (p ->DisplayName != NULL) {
+ if (!WriteOneMLUC(self, io, &a.DisplayName, i, p ->DisplayName, BaseOffset)) goto Error;
+ }
+
+ if (p ->DisplayValue != NULL) {
+ if (!WriteOneMLUC(self, io, &a.DisplayValue, i, p ->DisplayValue, BaseOffset)) goto Error;
+ }
+
+ p = cmsDictNextEntry(p);
+ }
+
+ // Write the directory
+ CurrentPos = io ->Tell(io);
+ if (!io ->Seek(io, DirectoryPos)) goto Error;
+
+ if (!WriteOffsetArray(io, &a, Count, Length)) goto Error;
+
+ if (!io ->Seek(io, CurrentPos)) goto Error;
+
+ FreeArray(&a);
+ return TRUE;
+
+Error:
+ FreeArray(&a);
+ return FALSE;
+
+ cmsUNUSED_PARAMETER(nItems);
+}
+
+
+static
+void* Type_Dictionary_Dup(struct _cms_typehandler_struct* self, const void *Ptr, cmsUInt32Number n)
+{
+ return (void*) cmsDictDup((cmsHANDLE) Ptr);
+
+ cmsUNUSED_PARAMETER(n);
+ cmsUNUSED_PARAMETER(self);
+}
+
+
+static
+void Type_Dictionary_Free(struct _cms_typehandler_struct* self, void* Ptr)
+{
+ cmsDictFree((cmsHANDLE) Ptr);
+ cmsUNUSED_PARAMETER(self);
+}
+
+
// ********************************************************************************
// Type support main routines
// ********************************************************************************
@@ -4770,6 +5199,7 @@ static _cmsTagTypeLinkedList SupportedTagTypes[] = {
{TYPE_HANDLER(cmsCorbisBrokenXYZtype, XYZ), &SupportedTagTypes[27] },
{TYPE_HANDLER(cmsMonacoBrokenCurveType, Curve), &SupportedTagTypes[28] },
{TYPE_HANDLER(cmsSigProfileSequenceIdType, ProfileSequenceId), &SupportedTagTypes[29] },
+{TYPE_HANDLER(cmsSigDictType, Dictionary), &SupportedTagTypes[30] },
{TYPE_HANDLER(cmsSigVcgtType, vcgt), NULL }
};
@@ -4889,6 +5319,7 @@ static _cmsTagLinkedList SupportedTags[] = {
{ cmsSigScreeningTag, { 1, 1, { cmsSigScreeningType}, NULL }, &SupportedTags[59]},
{ cmsSigVcgtTag, { 1, 1, { cmsSigVcgtType}, NULL }, &SupportedTags[60]},
+ { cmsSigMetaTag, { 1, 1, { cmsSigDictType}, NULL }, &SupportedTags[61]},
{ cmsSigProfileSequenceIdTag, { 1, 1, { cmsSigProfileSequenceIdType}, NULL}, NULL}
};
diff --git a/src/thirdparty/mfc/winmdi.cpp b/src/thirdparty/mfc/winmdi.cpp
index 11f23e419..470750f3d 100644
--- a/src/thirdparty/mfc/winmdi.cpp
+++ b/src/thirdparty/mfc/winmdi.cpp
@@ -632,19 +632,16 @@ void CMDIChildWnd::OnSize(UINT nType, int cx, int cy)
BOOL CMDIChildWnd::UpdateClientEdge(LPRECT lpRect)
{
- UNREFERENCED_PARAMETER(lpRect);
-
// only adjust for active MDI child window
- //CMDIFrameWnd* pFrameWnd = GetMDIFrame();
- //CMDIChildWnd* pChild = pFrameWnd->MDIGetActive();
+ CMDIFrameWnd* pFrameWnd = GetMDIFrame();
+ CMDIChildWnd* pChild = pFrameWnd->MDIGetActive();
// Only adjust for regular MDI child windows, not tabbed windows. Attempting to set WS_EX_CLIENTEDGE on the tabbed
// MDI client area window is subverted by CMDIClientAreaWnd::OnStyleChanging, so we always try to reset the style and
// always repaint, none of which is necessary since the tabbed MDI children never change from maximized to restored.
-#if 0
- CMDIChildWndEx* pChildEx = (pChild == NULL) ? NULL : DYNAMIC_DOWNCAST(CMDIChildWndEx, pChild);
- BOOL bIsTabbedMDIChild = (pChildEx == NULL) ? FALSE : pChildEx->GetMDIFrameWndEx() != NULL && pChildEx->GetMDIFrameWndEx()->AreMDITabs();
- if ((pChild == NULL || pChild == this) && !bIsTabbedMDIChild)
+ //CMDIChildWndEx* pChildEx = (pChild == NULL) ? NULL : DYNAMIC_DOWNCAST(CMDIChildWndEx, pChild);
+ //BOOL bIsTabbedMDIChild = (pChildEx == NULL) ? FALSE : pChildEx->GetMDIFrameWndEx() != NULL && pChildEx->GetMDIFrameWndEx()->AreMDITabs();
+ if ((pChild == NULL || pChild == this) /*&& !bIsTabbedMDIChild*/)
{
// need to adjust the client edge style as max/restore happens
DWORD dwStyle = ::GetWindowLong(pFrameWnd->m_hWndMDIClient, GWL_EXSTYLE);
@@ -676,7 +673,7 @@ BOOL CMDIChildWnd::UpdateClientEdge(LPRECT lpRect)
return TRUE;
}
}
-#endif
+
return FALSE;
}