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 <atlbase.h>
00025 #include <afxtempl.h>
00026 #include "..\..\..\subtitles\RTS.h"
00027
00028 class CSubtitleSource
00029 : public CSource
00030 , public IFileSourceFilter
00031 , public IAMFilterMiscFlags
00032 {
00033 protected:
00034 CStringW m_fn;
00035
00036 public:
00037 CSubtitleSource(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid);
00038 virtual ~CSubtitleSource();
00039
00040 DECLARE_IUNKNOWN;
00041 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00042
00043
00044 STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
00045 STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
00046
00047
00048 STDMETHODIMP_(ULONG) GetMiscFlags();
00049
00050 virtual HRESULT GetMediaType(CMediaType* pmt) = 0;
00051 };
00052
00053 class CSubtitleStream
00054 : public CSourceStream
00055 , public CSourceSeeking
00056 {
00057 CCritSec m_cSharedState;
00058
00059 int m_nPosition;
00060
00061 BOOL m_bDiscontinuity, m_bFlushing;
00062
00063 HRESULT OnThreadStartPlay();
00064 HRESULT OnThreadCreate();
00065
00066 void UpdateFromSeek();
00067 STDMETHODIMP SetRate(double dRate);
00068
00069 HRESULT ChangeStart();
00070 HRESULT ChangeStop();
00071 HRESULT ChangeRate() {return S_OK;}
00072
00073 protected:
00074 CRenderedTextSubtitle m_rts;
00075
00076 public:
00077 CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRESULT* phr);
00078 virtual ~CSubtitleStream();
00079
00080 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00081
00082 HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
00083 HRESULT FillBuffer(IMediaSample* pSample);
00084 HRESULT GetMediaType(CMediaType* pmt);
00085 HRESULT CheckMediaType(const CMediaType* pmt);
00086
00087 STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
00088 };
00089
00090 [uuid("E44CA3B5-A0FF-41A0-AF16-42429B1095EA")]
00091 class CSubtitleSourceASCII : public CSubtitleSource
00092 {
00093 public:
00094 CSubtitleSourceASCII(LPUNKNOWN lpunk, HRESULT* phr);
00095
00096 HRESULT GetMediaType(CMediaType* pmt);
00097 };
00098
00099 [uuid("87864E0F-7073-4E39-B802-143DE0ED4964")]
00100 class CSubtitleSourceUTF8 : public CSubtitleSource
00101 {
00102 public:
00103 CSubtitleSourceUTF8(LPUNKNOWN lpunk, HRESULT* phr);
00104
00105 HRESULT GetMediaType(CMediaType* pmt);
00106 };
00107
00108 [uuid("18316B1A-5877-4CC4-85FD-EDE65CD489EC")]
00109 class CSubtitleSourceSSA : public CSubtitleSource
00110 {
00111 public:
00112 CSubtitleSourceSSA(LPUNKNOWN lpunk, HRESULT* phr);
00113
00114 HRESULT GetMediaType(CMediaType* pmt);
00115 };
00116
00117 [uuid("416782BC-1D87-48C0-8F65-F113A5CB8E15")]
00118 class CSubtitleSourceASS : public CSubtitleSource
00119 {
00120 public:
00121 CSubtitleSourceASS(LPUNKNOWN lpunk, HRESULT* phr);
00122
00123 HRESULT GetMediaType(CMediaType* pmt);
00124 };
00125
00126 [uuid("D7215AFC-DFE6-483B-9AF3-6BBECFF14CF4")]
00127 class CSubtitleSourceUSF : public CSubtitleSource
00128 {
00129 public:
00130 CSubtitleSourceUSF(LPUNKNOWN lpunk, HRESULT* phr);
00131
00132 HRESULT GetMediaType(CMediaType* pmt);
00133 };
00134
00135 [uuid("932E75D4-BBD4-4A0F-9071-6728FBDC4C98")]
00136 class CSubtitleSourcePreview : public CSubtitleSource
00137 {
00138 public:
00139 CSubtitleSourcePreview(LPUNKNOWN lpunk, HRESULT* phr);
00140
00141 HRESULT GetMediaType(CMediaType* pmt);
00142 };
00143
00144 [uuid("CF0D7280-527D-415E-BA02-56017484D73E")]
00145 class CSubtitleSourceARGB : public CSubtitleSource
00146 {
00147 public:
00148 CSubtitleSourceARGB(LPUNKNOWN lpunk, HRESULT* phr);
00149
00150 HRESULT GetMediaType(CMediaType* pmt);
00151 };
00152