StreamDriveThru.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 "..\..\..\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         // IMediaSeeking
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 

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