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 "..\..\..\DSUtil\DSUtil.h"
00026
00027
00028 class CStreamDriveThruInputPin : public CBasePin
00029 {
00030 CComQIPtr<IAsyncReader> m_pAsyncReader;
00031
00032 public:
00033 CStreamDriveThruInputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
00034 virtual ~CStreamDriveThruInputPin();
00035
00036 HRESULT GetAsyncReader(IAsyncReader** ppAsyncReader);
00037
00038 DECLARE_IUNKNOWN;
00039 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00040
00041 HRESULT CheckMediaType(const CMediaType* pmt);
00042
00043 HRESULT CheckConnect(IPin* pPin);
00044 HRESULT BreakConnect();
00045 HRESULT CompleteConnect(IPin* pPin);
00046
00047 STDMETHODIMP BeginFlush();
00048 STDMETHODIMP EndFlush();
00049 };
00050
00051 class CStreamDriveThruOutputPin : public CBaseOutputPin
00052 {
00053 CComQIPtr<IStream> m_pStream;
00054
00055 public:
00056 CStreamDriveThruOutputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
00057 virtual ~CStreamDriveThruOutputPin();
00058
00059 HRESULT GetStream(IStream** ppStream);
00060
00061 DECLARE_IUNKNOWN;
00062 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00063
00064 HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
00065
00066 HRESULT CheckMediaType(const CMediaType* pmt);
00067 HRESULT GetMediaType(int iPosition, CMediaType* pmt);
00068
00069 HRESULT CheckConnect(IPin* pPin);
00070 HRESULT BreakConnect();
00071 HRESULT CompleteConnect(IPin* pPin);
00072
00073 STDMETHODIMP BeginFlush();
00074 STDMETHODIMP EndFlush();
00075
00076 STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
00077 };
00078
00079 [uuid("534FE6FD-F1F0-4aec-9F45-FF397320CE33")]
00080 class CStreamDriveThruFilter : public CBaseFilter, protected CAMThread, public IMediaSeeking
00081 {
00082 CCritSec m_csLock;
00083
00084 CStreamDriveThruInputPin* m_pInput;
00085 CStreamDriveThruOutputPin* m_pOutput;
00086
00087 protected:
00088 enum {CMD_EXIT, CMD_STOP, CMD_PAUSE, CMD_RUN};
00089 DWORD ThreadProc();
00090
00091 LONGLONG m_position;
00092
00093 public:
00094 CStreamDriveThruFilter(LPUNKNOWN pUnk, HRESULT* phr);
00095 virtual ~CStreamDriveThruFilter();
00096
00097 DECLARE_IUNKNOWN;
00098 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00099
00100 int GetPinCount();
00101 CBasePin* GetPin(int n);
00102
00103 STDMETHODIMP Stop();
00104 STDMETHODIMP Pause();
00105 STDMETHODIMP Run(REFERENCE_TIME tStart);
00106
00107
00108
00109 STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
00110 STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
00111 STDMETHODIMP IsFormatSupported(const GUID* pFormat);
00112 STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
00113 STDMETHODIMP GetTimeFormat(GUID* pFormat);
00114 STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
00115 STDMETHODIMP SetTimeFormat(const GUID* pFormat);
00116 STDMETHODIMP GetDuration(LONGLONG* pDuration);
00117 STDMETHODIMP GetStopPosition(LONGLONG* pStop);
00118 STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
00119 STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
00120 STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
00121 STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
00122 STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
00123 STDMETHODIMP SetRate(double dRate);
00124 STDMETHODIMP GetRate(double* pdRate);
00125 STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
00126 };
00127