/** * * 女医ハック DirectShowフィルタ * Copyright (C) 2008 id:yuaaaa * * $Id$ */ #pragma unmanaged #include #include #include #include #pragma managed #include #include "vtestguids.h" #include "IDirectJoyHack.h" #include "vfiltprop.h" //#using <../JHDrawLib/bin/Debug/JHDrawLib.dll> //#using //#include //#pragma comment (lib, "Gdiplus.lib") //using namespace Gdiplus; ref class delegateWrapper; class CDirectJoyHack : public CTransInPlaceFilter , public ISpecifyPropertyPages , public CPersistStream , public IDirectJoyHack { friend delegateWrapper; public: DECLARE_IUNKNOWN; static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr); HRESULT CheckInputType(const CMediaType *mtIn); //HRESULT GetMediaType(int iPosition, CMediaType *pMediaType); STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); STDMETHODIMP GetClassID(CLSID *pClsid); // IDirectJoyHack STDMETHODIMP get_FileName( WCHAR* fn ); STDMETHODIMP put_FileName( WCHAR* fn ); STDMETHODIMP reload_File( ); STDMETHODIMP get_ChangeImmediate( bool* fImmediate ); STDMETHODIMP put_ChangeImmediate( bool fImmediate ); STDMETHODIMP get_UseUTF8( bool* futf8 ); STDMETHODIMP put_UseUTF8( bool futf8 ); STDMETHODIMP get_HideSubtitles( bool* fHideSubtitles ); STDMETHODIMP put_HideSubtitles( bool fHideSubtitles ); STDMETHODIMP get_Delay ( __int32* fDelay ); STDMETHODIMP put_Delay ( __int32 fDelay ); STDMETHODIMP get_DebugOutput ( bool* fDebugOut ); STDMETHODIMP put_DebugOutput ( bool fDebugOut ); STDMETHODIMP get_DisableCache ( bool* fdcache ); STDMETHODIMP put_DisableCache ( bool fdcache ); STDMETHODIMP GetPages(CAUUID * pPages); private: HRESULT SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt); static int m_nInstanceCount; // total instances int m_nThisInstance; int width, height, stride; //ULONG_PTR gdiplusToken; gcroot joyhack; gcroot fswatch; gcroot mywrap; void file_Change(System::Object ^sender, System::IO::FileSystemEventArgs ^e); IMediaPosition *pMediaPosition; WCHAR m_filename[MAX_PATH]; bool m_Immediate; bool m_utf8; bool m_HideSub; __int32 m_Delay; //frame bool m_DebugOut; bool m_Locking; gcroot errorstr; CDirectJoyHack(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr); ~CDirectJoyHack(); HRESULT Transform(IMediaSample *pSample); }; ref class delegateWrapper { public: CDirectJoyHack *pclass; delegateWrapper ( CDirectJoyHack *p ) { pclass = p; } void Do(System::Object ^sender, System::IO::FileSystemEventArgs ^e) { pclass->file_Change( sender, e ); } };