- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# VSFilter.cpp

    00001 /*
    00002  *      Copyright (C) 2003-2005 Gabest
    00003  *      http://www.gabest.org
    00004  *
    00005  *  This Program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2, or (at your option)
    00008  *  any later version.
    00009  *
    00010  *  This Program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    00013  *  GNU General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU General Public License
    00016  *  along with GNU Make; see the file COPYING.  If not, write to
    00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    00018  *  http://www.gnu.org/copyleft/gpl.html
    00019  *
    00020  */
    00021
    00022 #include "stdafx.h"
    00023 #include "DirectVobSubFilter.h"
    00024 #include "DirectVobSubPropPage.h"
    00025 #include "VSFilter.h"
    00026 #include "..\..\..\DSUtil\MediaTypes.h"
    00027
    00028 #include <initguid.h>
    00029 #include "..\..\..\..\include\moreuuids.h"
    00030
    00032 // CVSFilterApp
    00033
    00034 BEGIN_MESSAGE_MAP(CVSFilterApp, CWinApp)
    00035 END_MESSAGE_MAP()
    00036
    00037 CVSFilterApp::CVSFilterApp()
    00038 {
    00039 }
    00040
    00041 extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
    00042
    00043 BOOL CVSFilterApp::InitInstance()
    00044 {
    00045         if(!CWinApp::InitInstance())
    00046                 return FALSE;
    00047
    00048         SetRegistryKey(_T("Gabest"));
    00049
    00050         DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_ATTACH, 0); // "DllMain" of the dshow baseclasses
    00051
    00052         STARTUPINFO si;
    00053         GetStartupInfo(&si);
    00054         m_AppName = CString(si.lpTitle);
    00055         m_AppName.Replace('\\', '/');
    00056         m_AppName = m_AppName.Mid(m_AppName.ReverseFind('/')+1);
    00057         m_AppName.MakeLower();
    00058
    00059         return TRUE;
    00060 }
    00061
    00062 int CVSFilterApp::ExitInstance()
    00063 {
    00064         DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_DETACH, 0); // "DllMain" of the dshow baseclasses
    00065
    00066         return CWinApp::ExitInstance();
    00067 }
    00068
    00069 HINSTANCE CVSFilterApp::LoadAppLangResourceDLL()
    00070 {
    00071         CString fn;
    00072         fn.ReleaseBufferSetLength(::GetModuleFileName(m_hInstance, fn.GetBuffer(MAX_PATH), MAX_PATH));
    00073         fn = fn.Mid(fn.ReverseFind('\\')+1);
    00074         fn = fn.Left(fn.ReverseFind('.')+1);
    00075         fn = fn + _T("lang");
    00076         return ::LoadLibrary(fn);
    00077 }
    00078
    00079 CVSFilterApp theApp;
    00080
    00082
    00083 const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
    00084 {
    00085         {&MEDIATYPE_NULL, &MEDIASUBTYPE_NULL},
    00086         {&MEDIATYPE_Video, &MEDIASUBTYPE_YUY2},
    00087         {&MEDIATYPE_Video, &MEDIASUBTYPE_YV12},
    00088         {&MEDIATYPE_Video, &MEDIASUBTYPE_I420},
    00089         {&MEDIATYPE_Video, &MEDIASUBTYPE_IYUV},
    00090         {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB32},
    00091         {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB565},
    00092         {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB555},
    00093         {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB24},
    00094 };
    00095
    00096 const AMOVIESETUP_MEDIATYPE sudPinTypesIn2[] =
    00097 {
    00098         {&MEDIATYPE_Text, &MEDIASUBTYPE_None},
    00099 };
    00100
    00101 const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
    00102 {
    00103         {&MEDIATYPE_Video, &MEDIASUBTYPE_None},
    00104 };
    00105
    00106 const AMOVIESETUP_PIN sudpPins[] =
    00107 {
    00108     {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
    00109     {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut},
    00110     {L"Input2", TRUE, FALSE, FALSE, TRUE, &CLSID_NULL, NULL, countof(sudPinTypesIn2), sudPinTypesIn2}
    00111 };
    00112
    00113 /*const*/ AMOVIESETUP_FILTER sudFilter[] =
    00114 {
    00115         {&__uuidof(CDirectVobSubFilter), L"DirectVobSub", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins},
    00116         {&__uuidof(CDirectVobSubFilter2), L"DirectVobSub (auto-loading version)", MERIT_PREFERRED+2, countof(sudpPins), sudpPins},
    00117 };
    00118
    00119 CFactoryTemplate g_Templates[] =
    00120 {
    00121         {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDirectVobSubFilter>, NULL, &sudFilter[0]},
    00122     {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CDirectVobSubFilter2>, NULL, &sudFilter[1]},
    00123     {L"DVSMainPPage", &__uuidof(CDVSMainPPage), CreateInstance<CDVSMainPPage>},
    00124     {L"DVSGeneralPPage", &__uuidof(CDVSGeneralPPage), CreateInstance<CDVSGeneralPPage>},
    00125     {L"DVSMiscPPage", &__uuidof(CDVSMiscPPage), CreateInstance<CDVSMiscPPage>},
    00126     {L"DVSTimingPPage", &__uuidof(CDVSTimingPPage), CreateInstance<CDVSTimingPPage>},
    00127         {L"DVSZoomPPage", &__uuidof(CDVSZoomPPage), CreateInstance<CDVSZoomPPage>},
    00128     {L"DVSColorPPage", &__uuidof(CDVSColorPPage), CreateInstance<CDVSColorPPage>},
    00129     {L"DVSPathsPPage", &__uuidof(CDVSPathsPPage), CreateInstance<CDVSPathsPPage>},
    00130         {L"DVSAboutPPage", &__uuidof(CDVSAboutPPage), CreateInstance<CDVSAboutPPage>},
    00131 };
    00132
    00133 int g_cTemplates = countof(g_Templates);
    00134
    00136 /*removeme*/
    00137 extern void JajDeGonoszVagyok();
    00138
    00139 STDAPI DllRegisterServer()
    00140 {
    00141         AFX_MANAGE_STATE(AfxGetStaticModuleState());
    00142
    00143         if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0) != 1)
    00144                 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0);
    00145
    00146         if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), -1) == -1)
    00147                 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), 0);
    00148
    00149         if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), -1) == -1)
    00150                 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), 0);
    00151
    00152         /*removeme*/
    00153         JajDeGonoszVagyok();
    00154
    00155         return AMovieDllRegisterServer2(TRUE);
    00156 }
    00157
    00158 STDAPI DllUnregisterServer()
    00159 {
    00160 //      DVS_WriteProfileInt2(IDS_R_GENERAL, IDS_RG_SEENDIVXWARNING, 0);
    00161
    00162         return AMovieDllRegisterServer2(FALSE);
    00163 }
    00164
    00165 void CALLBACK DirectVobSub(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
    00166 {
    00167         if(FAILED(::CoInitialize(0))) return;
    00168
    00169     CComPtr<IBaseFilter> pFilter;
    00170         CComQIPtr<ISpecifyPropertyPages> pSpecify;
    00171
    00172         if(SUCCEEDED(pFilter.CoCreateInstance(__uuidof(CDirectVobSubFilter))) && (pSpecify = pFilter))
    00173         {
    00174                 ShowPPage(pFilter, hwnd);
    00175         }
    00176
    00177         ::CoUninitialize();
    00178 }