00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 #include <atlsync.h>
00025 #include "DirectVobSub.h"
00026 #include "..\BaseVideoFilter\BaseVideoFilter.h"
00027 #include "..\..\..\subtitles\VobSubFile.h"
00028 #include "..\..\..\subtitles\RTS.h"
00029
00030 typedef struct
00031 {
00032 HWND hSystrayWnd;
00033 IFilterGraph* graph;
00034 IDirectVobSub* dvs;
00035 bool fRunOnce, fShowIcon;
00036 } SystrayIconData;
00037
00038
00039
00040 [uuid("93A22E7A-5091-45ef-BA61-6DA26156A5D0")]
00041 class CDirectVobSubFilter
00042 : public CBaseVideoFilter
00043 , public CDirectVobSub
00044 , public ISpecifyPropertyPages
00045 , public IAMStreamSelect
00046 , public CAMThread
00047 {
00048 friend class CTextInputPin;
00049
00050 CCritSec m_csQueueLock;
00051 CComPtr<ISubPicQueue> m_pSubPicQueue;
00052 void InitSubPicQueue();
00053 SubPicDesc m_spd;
00054
00055 bool AdjustFrameSize(CSize& s);
00056
00057 protected:
00058 void GetOutputSize(int& w, int& h, int& arx, int& ary);
00059 HRESULT Transform(IMediaSample* pIn);
00060
00061 public:
00062 CDirectVobSubFilter(LPUNKNOWN punk, HRESULT* phr, const GUID& clsid = __uuidof(CDirectVobSubFilter));
00063 virtual ~CDirectVobSubFilter();
00064
00065 DECLARE_IUNKNOWN;
00066 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00067
00068
00069
00070 CBasePin* GetPin(int n);
00071 int GetPinCount();
00072
00073 STDMETHODIMP JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName);
00074 STDMETHODIMP QueryFilterInfo(FILTER_INFO* pInfo);
00075
00076
00077 HRESULT SetMediaType(PIN_DIRECTION dir, const CMediaType* pMediaType),
00078 CheckConnect(PIN_DIRECTION dir, IPin* pPin),
00079 CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin),
00080 BreakConnect(PIN_DIRECTION dir),
00081 StartStreaming(),
00082 StopStreaming(),
00083 NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
00084
00085 CArray<CTextInputPin*> m_pTextInput;
00086
00087
00088 STDMETHODIMP put_FileName(WCHAR* fn);
00089 STDMETHODIMP get_LanguageCount(int* nLangs);
00090 STDMETHODIMP get_LanguageName(int iLanguage, WCHAR** ppName);
00091 STDMETHODIMP put_SelectedLanguage(int iSelected);
00092 STDMETHODIMP put_HideSubtitles(bool fHideSubtitles);
00093 STDMETHODIMP put_PreBuffering(bool fDoPreBuffering);
00094 STDMETHODIMP put_Placement(bool fOverridePlacement, int xperc, int yperc);
00095 STDMETHODIMP put_VobSubSettings(bool fBuffer, bool fOnlyShowForcedSubs, bool fPolygonize);
00096 STDMETHODIMP put_TextSettings(void* lf, int lflen, COLORREF color, bool fShadow, bool fOutline, bool fAdvancedRenderer);
00097 STDMETHODIMP put_SubtitleTiming(int delay, int speedmul, int speeddiv);
00098 STDMETHODIMP get_MediaFPS(bool* fEnabled, double* fps);
00099 STDMETHODIMP put_MediaFPS(bool fEnabled, double fps);
00100 STDMETHODIMP get_ZoomRect(NORMALIZEDRECT* rect);
00101 STDMETHODIMP put_ZoomRect(NORMALIZEDRECT* rect);
00102 STDMETHODIMP HasConfigDialog(int iSelected);
00103 STDMETHODIMP ShowConfigDialog(int iSelected, HWND hWndParent);
00104
00105
00106 STDMETHODIMP put_TextSettings(STSStyle* pDefStyle);
00107
00108
00109 STDMETHODIMP GetPages(CAUUID* pPages);
00110
00111
00112 STDMETHODIMP Count(DWORD* pcStreams);
00113 STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
00114 STDMETHODIMP Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk);
00115
00116
00117 STDMETHODIMP GetClassID(CLSID* pClsid);
00118
00119 protected:
00120 HRESULT ChangeMediaType(int iPosition);
00121
00122 HDC m_hdc;
00123 HBITMAP m_hbm;
00124 HFONT m_hfont;
00125 void PrintMessages(BYTE* pOut);
00126
00127
00128 CAutoVectorPtr<BYTE> m_pTempPicBuff;
00129 HRESULT Copy(BYTE* pSub, BYTE* pIn, CSize sub, CSize in, int bpp, const GUID& subtype, DWORD black);
00130
00131
00132 CRefTime m_tPrev;
00133 REFERENCE_TIME CalcCurrentTime();
00134
00135 double m_fps;
00136
00137
00138 bool m_fMSMpeg4Fix;
00139
00140
00141 bool m_fDivxPlusFix;
00142
00143
00144 bool m_fLoading;
00145
00146 bool Open();
00147
00148 int FindPreferedLanguage(bool fHideToo = true);
00149 void UpdatePreferedLanguages(CString lang);
00150
00151 CCritSec m_csSubLock;
00152 CInterfaceList<ISubStream> m_pSubStreams;
00153 DWORD_PTR m_nSubtitleId;
00154 void UpdateSubtitle(bool fApplyDefStyle = true);
00155 void SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle = true);
00156 void InvalidateSubtitle(REFERENCE_TIME rtInvalidate = -1, DWORD_PTR nSubtitleId = -1);
00157
00158
00159 void AddSubStream(ISubStream* pSubStream);
00160 void RemoveSubStream(ISubStream* pSubStream);
00161 void Post_EC_OLE_EVENT(CString str, DWORD_PTR nSubtitleId = -1);
00162
00163 private:
00164 class CFileReloaderData
00165 {
00166 public:
00167 ATL::CEvent EndThreadEvent, RefreshEvent;
00168 CList<CString> files;
00169 CArray<CTime> mtime;
00170 } m_frd;
00171
00172 void SetupFRD(CStringArray& paths, CArray<HANDLE>& handles);
00173 DWORD ThreadProc();
00174
00175 private:
00176 HANDLE m_hSystrayThread;
00177 SystrayIconData m_tbid;
00178 };
00179
00180
00181
00182 [uuid("9852A670-F845-491b-9BE6-EBD841B8A613")]
00183 class CDirectVobSubFilter2 : public CDirectVobSubFilter
00184 {
00185 bool ShouldWeAutoload(IFilterGraph* pGraph);
00186 void GetRidOfInternalScriptRenderer();
00187
00188 public:
00189 CDirectVobSubFilter2(LPUNKNOWN punk, HRESULT* phr, const GUID& clsid = __uuidof(CDirectVobSubFilter2));
00190
00191 HRESULT CheckConnect(PIN_DIRECTION dir, IPin* pPin);
00192 STDMETHODIMP JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName);
00193 HRESULT CheckInputType(const CMediaType* mtIn);
00194 };
00195