SubtitleSource.h

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 #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         // IFileSourceFilter
00044         STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
00045         STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
00046 
00047         // IAMFilterMiscFlags
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 

Generated on Tue Dec 13 14:47:26 2005 for guliverkli by  doxygen 1.4.5