Update: 2009/12/23
最新版本的mpc-hc已经不存在DirectX SDK的版本依赖关系了,可以使用最新的DirectX SDK(August 2009),不需要修改任何代码直接编译通过。因为DirectX SDK里面不存在的头文件,mpc-hc已经在项目中主动提供了。
所以下面关于DirectX 7的一些hack,目前已经不需要,如何编译最新的mpc-hc,请参照如下官方链接:
http://sourceforge.net/apps/trac/mpc-hc/wiki/How_to_compile_the_MPC
由于我用到的gcc不是官方编译版本,需要做如下一个小的补丁:
Index: src/filters/transform/mpcvideodec/MPCVideoDec.vcproj
===================================================================
--- src/filters/transform/mpcvideodec/MPCVideoDec.vcproj (revision 1443)
+++ src/filters/transform/mpcvideodec/MPCVideoDec.vcproj (working copy)
@@ -1,7 +1,7 @@
ProjectType="Visual C++" - Version="9,00" + Version="9.00" Name="MPCVideoDec" ProjectGUID="{58E36BF5-4A06-47E4-BD40-4CCEF8C634DF}" RootNamespace="MPCVideoDec" @@ -474,7 +474,7 @@ Name="VCLibrarianTool" LinkLibraryDependencies="true" AdditionalOptions="/IGNORE:4221" - AdditionalDependencies="libavcodec_gcc.lib libgcc.a libmingwex.a" + AdditionalDependencies="libavcodec_gcc.lib libgcov.a libgcc.a libmingwex.a" OutputFile="../../../../lib/$(ProjectName)RU.lib" AdditionalLibraryDirectories="../../../../lib" /> 在此顺便提一下最近一段时间非常搞笑的射手播放器鄙视腾讯的QQ影音的闹剧: 射手播放器的开发者SS公开指责腾讯的QQ影音的无耻抄袭其自动加载字幕的功能,试图将自己塑造成一个开源受害者的形象,到最后搬起石头砸了自己的脚。因为: 1) 射手自己也是在公然强奸mpc-hc的GPL协议,射手的一些所谓的关键代码并没有开源 2) 射手对外公开的那个svn, 是没法编译的,因为其故意将一些头文件或者library不放到svn上,使得别人无法编译svn的代码 关于2) 我半年前就单独通过mail和其开发者SS联系过,其承认一些代码没有开放出来! 所以说射手的所谓的开源口号只是个幌子,是用来进行宣传,并欺骗一些无知者的伎俩而已。 虽然射手后来为了表明自己的开源的决心将某些代码放出来了,但其在某些代码上还是故意做了手脚,真无聊啊! 声明:我在此指责射手的做法并不表明我支持腾讯的QQ影音,相反,我是从心底鄙视腾讯的无耻行径的。一个公司全靠抄起家,并能成为中国最赚钱的互联网公司之一,这也只有在中国这个神奇的土地上才能存在的神奇现象了。 ----------------------------------------------------------------- 由于DirectX SDK 不同版本之间有较大影响,编译最新的MPC-HC最好用DirectX SDK 2007的版本,但我不想将我目前的最新的DirectX SDK卸载掉,直接使得我需要做如下修改才可以编译成功! 欢迎到 http://NextPlayer.net来进行交流 Index: mpc-hc.sln =================================================================== --- mpc-hc.sln (revision 1164) +++ mpc-hc.sln (working copy) @@ -279,6 +279,7 @@ {03208025-D5C2-426A-B0FA-251D4338F30C} = {03208025-D5C2-426A-B0FA-251D4338F30C} {3F5EA225-F4B7-4413-AEB3-4E4E5751E438} = {3F5EA225-F4B7-4413-AEB3-4E4E5751E438} {9DCFD02A-16A0-4766-BC18-66163E21929D} = {9DCFD02A-16A0-4766-BC18-66163E21929D} + {305BAB2D-0D75-4FBC-8BCD-A2917392B48C} = {305BAB2D-0D75-4FBC-8BCD-A2917392B48C} {AB494732-EF6D-44D0-BCF8-80FF04858D10} = {AB494732-EF6D-44D0-BCF8-80FF04858D10} {C0F7A036-FC2D-40DF-9852-C37518DB6B3E} = {C0F7A036-FC2D-40DF-9852-C37518DB6B3E} {9ED4B036-7399-4128-868D-6E71188E0277} = {9ED4B036-7399-4128-868D-6E71188E0277} @@ -302,6 +303,7 @@ {F6B06383-3FFD-403B-9867-4AA82A20AA83} = {F6B06383-3FFD-403B-9867-4AA82A20AA83} {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0} = {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0} + {83CC6B88-A112-4192-BD5A-F2A249AF2277} = {83CC6B88-A112-4192-BD5A-F2A249AF2277} {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42} {1E91F58C-0BAE-4021-8087-D1864D8EC066} = {1E91F58C-0BAE-4021-8087-D1864D8EC066} {23E1898F-8262-435C-8848-D4D8824E6D71} = {23E1898F-8262-435C-8848-D4D8824E6D71} @@ -325,6 +327,7 @@ {E62223EF-8263-41EB-8174-CD78BBEEF368} = {E62223EF-8263-41EB-8174-CD78BBEEF368} {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95} = {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95} {58E36BF5-4A06-47E4-BD40-4CCEF8C634DF} = {58E36BF5-4A06-47E4-BD40-4CCEF8C634DF} + {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA} = {E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA} {54F609FD-A8CE-43CF-94AD-23E877B97C13} = {54F609FD-A8CE-43CF-94AD-23E877B97C13} EndProjectSection EndProject @@ -342,10 +345,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libavcodec_gcc", "src/filters/transform/mpcvideodec/ffmpeg/libavcodec_gcc.vcproj", "{438286B7-A9F4-411D-BCC5-948C40E37D8F}" EndProject Global - GlobalSection(SubversionScc) = preSolution - Svn-Managed = True - Manager = AnkhSVN - Subversion Support for Visual Studio - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug Unicode|Win32 = Debug Unicode|Win32 Debug Unicode|x64 = Debug Unicode|x64 @@ -929,4 +928,8 @@ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F} = {2913B7E4-7A8B-43D5-A60B-345A0782816A} {AB494732-EF6D-44D0-BCF8-80FF04858D10} = {2913B7E4-7A8B-43D5-A60B-345A0782816A} EndGlobalSection + GlobalSection(SubversionScc) = preSolution + Svn-Managed = True + Manager = AnkhSVN - Subversion Support for Visual Studio + EndGlobalSection EndGlobal Index: src/apps/mplayerc/FakeFilterMapper2.cpp =================================================================== --- src/apps/mplayerc/FakeFilterMapper2.cpp (revision 1164) +++ src/apps/mplayerc/FakeFilterMapper2.cpp (working copy) @@ -27,6 +27,11 @@ #include "../../DSUtil/DSUtil.h" #include +#pragma include_alias( "dxtrans.h", "qedit.h" ) +#define __IDxtCompositor_INTERFACE_DEFINED__ +#define __IDxtAlphaSetter_INTERFACE_DEFINED__ +#define __IDxtJpeg_INTERFACE_DEFINED__ +#define __IDxtKey_INTERFACE_DEFINED__ #include Index: src/apps/mplayerc/FGFilter.cpp =================================================================== --- src/apps/mplayerc/FGFilter.cpp (revision 1164) +++ src/apps/mplayerc/FGFilter.cpp (working copy) @@ -448,14 +448,22 @@ CComPtr +#if 0 if(m_clsid == CLSID_VMR7AllocatorPresenter || m_clsid == CLSID_VMR9AllocatorPresenter +#else + if(m_clsid == CLSID_VMR9AllocatorPresenter +#endif || m_clsid == CLSID_DXRAllocatorPresenter || m_clsid == CLSID_madVRAllocatorPresenter || m_clsid == CLSID_EVRAllocatorPresenter) { +#if 0 if(SUCCEEDED(CreateAP7(m_clsid, m_hWnd, &pCAP)) || SUCCEEDED(CreateAP9(m_clsid, m_hWnd, &pCAP)) +#else + if(SUCCEEDED(CreateAP9(m_clsid, m_hWnd, &pCAP)) +#endif || SUCCEEDED(CreateEVR(m_clsid, m_hWnd, &pCAP))) { CComPtr Index: src/apps/mplayerc/QuicktimeGraph.cpp =================================================================== --- src/apps/mplayerc/QuicktimeGraph.cpp (revision 1164) +++ src/apps/mplayerc/QuicktimeGraph.cpp (working copy) @@ -48,12 +48,16 @@ AppSettings& s = AfxGetAppSettings(); +#if 0 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) +#endif { if(SUCCEEDED(CreateAP9(CLSID_QT9AllocatorPresenter, hWndParent, &m_pQTAP))) dwStyle &= ~WS_VISIBLE; Index: src/apps/mplayerc/MainFrm.cpp =================================================================== --- src/apps/mplayerc/MainFrm.cpp (revision 1164) +++ src/apps/mplayerc/MainFrm.cpp (working copy) @@ -3956,7 +3956,9 @@ size = 0; bool fNeedsToPause = !m_pCAP; +#if 0 if(fNeedsToPause) fNeedsToPause = !IsVMR7InGraph(pGB); +#endif if(fNeedsToPause) fNeedsToPause = !IsVMR9InGraph(pGB); OAFilterState fs = GetMediaState(); Index: src/apps/mplayerc/mplayerc.vcproj =================================================================== --- src/apps/mplayerc/mplayerc.vcproj (revision 1164) +++ src/apps/mplayerc/mplayerc.vcproj (working copy) @@ -1,7 +1,7 @@ ProjectType="Visual C++" - Version="9,00" + Version="9.00" Name="mplayerc" ProjectGUID="{8CE7E5D0-C821-47AC-A247-28EC95B34670}" RootNamespace="mplayerc" @@ -423,6 +423,22 @@ RelativePath="DX7AllocatorPresenter.cpp" > + + Name="Release Unicode|Win32" + ExcludedFromBuild="true" + > + + Name="VCCLCompilerTool" + /> + + + Name="Debug Unicode|Win32" + ExcludedFromBuild="true" + > + + Name="VCCLCompilerTool" + /> + RelativePath="DX9AllocatorPresenter.cpp" Index: src/apps/mplayerc/RealMediaGraph.cpp =================================================================== --- src/apps/mplayerc/RealMediaGraph.cpp (revision 1164) +++ src/apps/mplayerc/RealMediaGraph.cpp (working copy) @@ -487,10 +487,12 @@ switch(s.iRMVideoRendererType) { default: +#if 0 case VIDRNDT_RM_DX7: if(FAILED(CreateAP7(CLSID_RM7AllocatorPresenter, hWndParent, &m_pRMAP))) return; break; +#endif case VIDRNDT_RM_DX9: if(FAILED(CreateAP9(CLSID_RM9AllocatorPresenter, hWndParent, &m_pRMAP))) return; Index: src/subpic/subpic.vcproj =================================================================== --- src/subpic/subpic.vcproj (revision 1164) +++ src/subpic/subpic.vcproj (working copy) @@ -270,6 +270,22 @@ RelativePath="DX7SubPic.cpp" > + + Name="Debug Unicode|Win32" + ExcludedFromBuild="true" + > + + Name="VCCLCompilerTool" + /> + + + Name="Release Unicode|Win32" + ExcludedFromBuild="true" + > + + Name="VCCLCompilerTool" + /> + RelativePath="DX9SubPic.cpp" Index: src/subtitles/CCDecoder.cpp =================================================================== --- src/subtitles/CCDecoder.cpp (revision 1164) +++ src/subtitles/CCDecoder.cpp (working copy) @@ -1,4 +1,4 @@ -/* +锘?* * Copyright (C) 2003-2006 Gabest * http://www.gabest.org * @@ -126,12 +126,12 @@ { static WCHAR charmap[0x60] = { - ' ','!','"','#','$','%','&','/'','(',')','?,'+',',','-','.','/', + ' ','!','"','#','$','%','&','/'','(',')','谩','+',',','-','.','/', '0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?', '@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', - 'P','Q','R','S','T','U','V','W','X','Y','Z','[','?,']','?,'?, - '?,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', - 'p','q','r','s','t','u','v','w','x','y','z','?,'?,'N','n','?' + 'P','Q','R','S','T','U','V','W','X','Y','Z','[','茅',']','铆','贸', + '煤','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', + 'p','q','r','s','t','u','v','w','x','y','z','莽','梅','N','n','?' }; PutChar(charmap[c - 0x20]);