//
// CDXGraph.cpp
//
#include "stdafx.h"
#include <streams.h>
#include "CDXGraph.h"
//#pragma comment(lib, "strmbase_d.lib")
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define CLSID_SPLITER_AVI_STR L"{9736D831-9D6C-4E72-B6E7-560EF9181001}"
#define FNAME_SPLITER_AVI _T("AviSplitter.ax")
//{765035B3-5944-4A94-806B-20EE3415F26F}
//238D0F23-5DC9-45A6-9BE2-666160C324DD}
//{238D0F23-5DC9-45A6-9BE2-666160C324DD}
#define CLSID_SPLITER_RM_STR L"{E21BE468-5C18-43EB-B0CC-DB93A847D769}"
#define FNAME_SPLITER_RM _T("RMSplt.ax")
//{04FE9017-F873-410E-871E-AB91661A4EF7}
//{0512B874-44F6-48F1-AFB5-6DE808DDE230}
//{0B390488-D80F-4A68-8408-48DC199F0E97}
//{0F40E1E5-4F79-4988-B1A9-CC98794E6B55} audio
//{1F71651E-65D2-40BF-AC44-275D11927D99}
//{3E3ECA90-4D6A-4344-98C3-1BB95BF24038} audio
//{49590BC9-6DD5-4E44-AD4C-E8FCB7131EC4} audio
//{4DB2B5D9-4556-4340-B189-AD20110D953F}
//{5711D95F-0984-4A22-8FF8-90A954958D0C}
//{650DE05E-5CD3-44F8-BA20-A5BB91FC61E6}
//{7CA71B1E-A67D-4D54-A200-FA47605483A7}
//{87271B4E-1726-4CED-AF0D-BE675621FD29} converter
//{8E9922F0-B775-45B8-B650-941BEA790EEB} swatring init
//{9A98ADCC-C6A4-449E-A8B1-0363673D9F8A}
//{D6A9B8CC-192D-4F00-8BF8-AD8774011B07}
//{F6E8FC04-8B05-48B1-9399-848229502A06} acm
//{FFFCC670-5CD4-4C09-952C-F53F46C2B1A7}
//{4DB2B5D9-4556-4340-B189-AD20110D953F}
//{05F983EC-637F-4133-B489-5E03914929D7}
//{007FC171-01AA-4B3A-B2DB-062DEE815A1E}
#define CLSID_SPLITER_FFDSHOW_STR L"{04FE9017-F873-410E-871E-AB91661A4EF7}"
#define FNAME_SPLITER_FFDSHOW _T("ffdshow.ax")
//{55DA30FC-F16B-49FC-BAA5-AE59FC65F82D}
//{564FD788-86C9-4444-971E-CC4A243DA150}
//{7B63A013-DC2C-462E-9292-CAF8C867100F}
//{895322C5-84A1-450C-8478-C57793CAE86F} property
//{8F43B7D9-9D6B-4F48-BE18-4D787C795EEA}
//{A28F324B-DDC5-4999-AA25-D3A7E25EF7A8}
//{F13D3732-96BD-4108-AFEB-E85F68FF64DC}
#define CLSID_SPLITER_SPLITTER_STR L"{564FD788-86C9-4444-971E-CC4A243DA150}"
#define FNAME_SPLITER_SPLITTER _T("splitter.ax")
//{47E792CF-0BBE-4F7A-859C-194B0768650A} mfc
//{C9ECE7B3-1D8E-41F5-9F24-B255DF16C087}
#define CLSID_SPLITER_FLV_STR L"{564FD788-86C9-4444-971E-CC4A243DA150}"
#define FNAME_SPLITER_FLV _T("FLVSplitter.ax")
//{D8CF6A42-3E09-4922-A452-21DFF10BEEBA}
#define CLSID_SPLITER_WavPackDS_STR L"{564FD788-86C9-4444-971E-CC4A243DA150}"
#define FNAME_SPLITER_WavPackDS _T("WavPackDSSplitter.ax")
#define CLSID_SPLITER_WavPackDSDecoder_STR L"{564FD788-86C9-4444-971E-CC4A243DA150}"
#define FNAME_SPLITER_WavPackDSDecoder _T("WavPackDSDecoder.ax")
#define CLSID_SPLITER_VSFILTER_STR L"{0180E49C-13BF-46DB-9AFD-9F52292E1C22}"
#define FNAME_SPLITER_VSFILTER _T("VSFilter.dll")
//Haali
#define CLSID_SPLITER_AVIDLL_STR L"{51A00247-40A8-4845-9F17-7DBFCC9A8783}"
#define FNAME_SPLITER_AVIDLL _T("avi.dll")
//{53D9DE0B-FC61-4650-9773-74D13CC7E582}
//{64F2005C-6CF5-4652-B94F-600360B15B27}
#define CLSID_SPLITER_MKX_STR L"{BD4FB4BE-809D-487b-ADD6-F7D164247E52}"
#define FNAME_SPLITER_MKX _T("mkx.dll")
//A36C253D-CEE4-4BCA-9CC2-E03CF6BBB054}
#define CLSID_SPLITER_DXR_STR L"{8E8B4A31-408B-4929-86A4-A9FA9F01BA43}"
#define FNAME_SPLITER_DXR _T("dxr.dll")
#define CLSID_SPLITER_MP4_STR L"{B3DE7EDC-0CD4-4d07-B1C5-92219CD475CC}"
#define FNAME_SPLITER_MP4 _T("mp4.dll")
#define CLSID_SPLITER_TS_STR L"{B841F346-4835-4de8-AA5E-2E7CD2D4C435}"
#define FNAME_SPLITER_TS _T("ts.dll")
#define CLSID_SPLITER_OGM_STR L"{DB43B405-43AA-4f01-82D8-D84D47E6019C}"
#define FNAME_SPLITER_OGM _T("ogm.dll")
#define CLSID_SPLITER_AVS_STR L"{EB02CC0B-C3BF-4c10-859C-70F42AFCD6B6}"
#define FNAME_SPLITER_AVS _T("avs.dll")
typedef BOOL (_stdcall *lpRegHnd)(void); //注册组件
////////////////////////////////////////////////////////////////////////////////
CDXGraph::CDXGraph()
{
mGraph = NULL;
mMediaControl = NULL;
mEvent = NULL;
mBasicVideo = NULL;
mBasicAudio = NULL;
mVideoWindow = NULL;
mSeeking = NULL;
mObjectTableEntry = 0;
//moon++
RegisterCOM1(FNAME_SPLITER_SPLITTER,true);
RegisterCOM1(FNAME_SPLITER_MKX,true);
//RegisterCOM1(FNAME_SPLITER_MP4,false);
// RegisterCOM1(FNAME_SPLITER_TS,false);
/* RegisterCOM1(FNAME_SPLITER_FLV,false);
RegisterCOM1(FNAME_SPLITER_WavPackDS,false);
RegisterCOM1(FNAME_SPLITER_VSFILTER,false);
RegisterCOM1(FNAME_SPLITER_WavPackDSDecoder,false);
RegisterCOM1(FNAME_SPLITER_AVIDLL,false);
RegisterCOM1(FNAME_SPLITER_DXR,false);
RegisterCOM1(FNAME_SPLITER_OGM,false);
RegisterCOM1(FNAME_SPLITER_AVS,false);*/
//RegisterCOM1(FNAME_SPLITER_COREAVC,true);
//RegisterCOM1(FNAME_SPLITER_XVIDDEC,true);
//RegisterCOM1(_T("MpaSplitter.ax"),false);
//RegisterCOM1(FNAME_SPLITER_AVI,false);
//RegisterCOM1(FNAME_SPLITER_FFDSHOW,false);
::CoInitialize(NULL);
//moon--
}
bool CDXGraph::RegisterCOM1(wstring szFileDLL,bool bRegister){
TCHAR wcs[MAX_PATH]=_T("");
GetModuleFileName(NULL,wcs,MAX_PATH);
wstring fp=wcs;
int i=fp.rfind(_T("\\"));
if(i!=wstring::npos){
fp=fp.substr(0,i);
}
else{
return false;
}
wstring axDirName=_T("Codecs");
fp=fp+_T("\\")+axDirName+_T("\\");
fp=fp+szFileDLL;
Filter_Info tempFilter;
tempFilter.filePath=fp;
HINSTANCE hDLL = ::LoadLibrary(fp.c_str());
typedef BOOL (_stdcall *pRegFun)(void);
pRegFun regFun;
HRESULT hResult =S_OK;// ::OleInitialize(NULL);
if (hResult==S_OK)
{
if (bRegister){
regFun = (lpRegHnd)::GetProcAddress(hDLL, "DllRegisterServer");
}
else{
regFun = (lpRegHnd)::GetProcAddress(hDLL, "DllUnregisterServer");
}
if (regFun == NULL )
return false;
regFun(); //调用*.dll的DllRegisterServer方法,注册该DLL;
::FreeLibrary( hDLL );
}
//::OleUninitialize();
return true;
}
bool CDXGraph::RegisterCOM(bool bRegister, const TCHAR* ptcComDllPath)
{
TCHAR tcPath[MAX_PATH] = {0},
tcCmd[512] = {0};
wstring szfilePath = tcPath;
if( ptcComDllPath == NULL )
{
GetModuleFileName(NULL, tcPath, sizeof(tcPath));
int i = szfilePath.rfind('\\');
if (i!= wstring::npos)
{
szfilePath = szfilePath.substr(0,i);
}
i = szfilePath.rfind('\\');
if (i!= wstring::npos)
{
szfilePath = szfilePath.substr(0,i);
}
szfilePath = szfilePath + ptcComDllPath;
ptcComDllPath = szfilePath.c_str();
}
swprintf_s(tcCmd, _T("regsvr32 %s /s \"%s\
评论30
最新资源