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
00026 [uuid("63EF0035-3FFE-4c41-9230-4346E028BE20")]
00027 interface IBufferFilter : public IUnknown
00028 {
00029 STDMETHOD(SetBuffers) (int nBuffers) = 0;
00030 STDMETHOD_(int, GetBuffers) () = 0;
00031 STDMETHOD_(int, GetFreeBuffers) () = 0;
00032 STDMETHOD(SetPriority) (DWORD dwPriority = THREAD_PRIORITY_NORMAL) = 0;
00033 };
00034
00035 [uuid("DA2B3D77-2F29-4fd2-AC99-DEE4A8A13BF0")]
00036 class CBufferFilter : public CTransformFilter, public IBufferFilter
00037 {
00038 int m_nSamplesToBuffer;
00039
00040 public:
00041 CBufferFilter(LPUNKNOWN lpunk, HRESULT* phr);
00042 virtual ~CBufferFilter();
00043
00044 DECLARE_IUNKNOWN
00045 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00046
00047
00048 STDMETHODIMP SetBuffers(int nBuffers);
00049 STDMETHODIMP_(int) GetBuffers();
00050 STDMETHODIMP_(int) GetFreeBuffers();
00051 STDMETHODIMP SetPriority(DWORD dwPriority = THREAD_PRIORITY_NORMAL);
00052
00053 HRESULT Receive(IMediaSample* pSample);
00054 HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
00055 HRESULT CheckInputType(const CMediaType* mtIn);
00056 HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
00057 HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
00058 HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
00059 HRESULT StopStreaming();
00060 };
00061
00062 class CBufferFilterOutputPin : public CTransformOutputPin
00063 {
00064 class CBufferFilterOutputQueue : public COutputQueue
00065 {
00066 public:
00067 CBufferFilterOutputQueue(IPin* pInputPin, HRESULT* phr,
00068 DWORD dwPriority = THREAD_PRIORITY_NORMAL,
00069 BOOL bAuto = FALSE, BOOL bQueue = TRUE,
00070 LONG lBatchSize = 1, BOOL bBatchExact = FALSE,
00071 LONG lListSize = DEFAULTCACHE,
00072 bool bFlushingOpt = false)
00073 : COutputQueue(pInputPin, phr, bAuto, bQueue, lBatchSize, bBatchExact, lListSize, dwPriority, bFlushingOpt)
00074 {
00075 }
00076
00077 int GetQueueCount()
00078 {
00079 return m_List ? m_List->GetCount() : -1;
00080 }
00081
00082 bool SetPriority(DWORD dwPriority)
00083 {
00084 return m_hThread ? !!::SetThreadPriority(m_hThread, dwPriority) : false;
00085 }
00086 };
00087
00088 public:
00089 CBufferFilterOutputPin(CTransformFilter* pFilter, HRESULT* phr);
00090
00091 CAutoPtr<CBufferFilterOutputQueue> m_pOutputQueue;
00092
00093 HRESULT Active();
00094 HRESULT Inactive();
00095
00096 HRESULT Deliver(IMediaSample* pMediaSample);
00097 HRESULT DeliverEndOfStream();
00098 HRESULT DeliverBeginFlush();
00099 HRESULT DeliverEndFlush();
00100 HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
00101 };