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 "BaseMuxerInputPin.h"
00025 #include "BaseMuxerOutputPin.h"
00026 #include "BitStream.h"
00027
00028 class CBaseMuxerFilter
00029 : public CBaseFilter
00030 , public CCritSec
00031 , public CAMThread
00032 , public IMediaSeeking
00033 , public IDSMPropertyBagImpl
00034 , public IDSMResourceBagImpl
00035 , public IDSMChapterBagImpl
00036 {
00037 private:
00038 CAutoPtrList<CBaseMuxerInputPin> m_pInputs;
00039 CAutoPtr<CBaseMuxerOutputPin> m_pOutput;
00040
00041 enum {CMD_EXIT, CMD_RUN};
00042 DWORD ThreadProc();
00043
00044 REFERENCE_TIME m_rtCurrent;
00045 CList<CBaseMuxerInputPin*> m_pActivePins;
00046
00047 CAutoPtr<MuxerPacket> GetPacket();
00048
00049 protected:
00050 CList<CBaseMuxerInputPin*> m_pPins;
00051
00052 virtual void MuxInit() = 0;
00053
00054
00055 virtual void MuxHeader(IBitStream* pBS) {}
00056 virtual void MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket) {}
00057 virtual void MuxFooter(IBitStream* pBS) {}
00058
00059
00060 virtual void MuxHeader() {}
00061 virtual void MuxPacket(const MuxerPacket* pPacket) {}
00062 virtual void MuxFooter() {}
00063
00064 virtual HRESULT CreateInput(CStringW name, CBaseMuxerInputPin** ppPin);
00065
00066 public:
00067 CBaseMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid);
00068 virtual ~CBaseMuxerFilter();
00069
00070 DECLARE_IUNKNOWN;
00071 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00072
00073 void AddInput();
00074
00075
00076 int GetPinCount();
00077 CBasePin* GetPin(int n);
00078
00079 STDMETHODIMP Stop();
00080 STDMETHODIMP Pause();
00081 STDMETHODIMP Run(REFERENCE_TIME tStart);
00082
00083
00084
00085 STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
00086 STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
00087 STDMETHODIMP IsFormatSupported(const GUID* pFormat);
00088 STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
00089 STDMETHODIMP GetTimeFormat(GUID* pFormat);
00090 STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
00091 STDMETHODIMP SetTimeFormat(const GUID* pFormat);
00092 STDMETHODIMP GetDuration(LONGLONG* pDuration);
00093 STDMETHODIMP GetStopPosition(LONGLONG* pStop);
00094 STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
00095 STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
00096 STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
00097 STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
00098 STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
00099 STDMETHODIMP SetRate(double dRate);
00100 STDMETHODIMP GetRate(double* pdRate);
00101 STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
00102 };
00103