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 "..\..\..\DSUtil\DSMPropertyBag.h"
00025
00026 class CBaseMuxerInputPin;
00027
00028 struct MuxerPacket
00029 {
00030 CBaseMuxerInputPin* pPin;
00031 REFERENCE_TIME rtStart, rtStop;
00032 CArray<BYTE> pData;
00033 enum flag_t {empty = 0, timevalid = 1, syncpoint = 2, discontinuity = 4, eos = 8, bogus = 16};
00034 DWORD flags;
00035 struct MuxerPacket(CBaseMuxerInputPin* pPin) {this->pPin = pPin; rtStart = rtStop = _I64_MIN; flags = empty;}
00036 bool IsTimeValid() const {return !!(flags & timevalid);}
00037 bool IsSyncPoint() const {return !!(flags & syncpoint);}
00038 bool IsDiscontinuity() const {return !!(flags & discontinuity);}
00039 bool IsEOS() const {return !!(flags & eos);}
00040 bool IsBogus() const {return !!(flags & bogus);}
00041 };
00042
00043 class CBaseMuxerInputPin : public CBaseInputPin, public IDSMPropertyBagImpl
00044 {
00045 private:
00046 int m_iID;
00047
00048 CCritSec m_csReceive;
00049 REFERENCE_TIME m_rtMaxStart, m_rtDuration;
00050 bool m_fEOS;
00051
00052 CCritSec m_csQueue;
00053 CAutoPtrList<MuxerPacket> m_queue;
00054 void PushPacket(CAutoPtr<MuxerPacket> pPacket);
00055 CAutoPtr<MuxerPacket> PopPacket();
00056 CAMEvent m_evAcceptPacket;
00057
00058 friend class CBaseMuxerFilter;
00059
00060 public:
00061 CBaseMuxerInputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
00062 virtual ~CBaseMuxerInputPin();
00063
00064 DECLARE_IUNKNOWN;
00065 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00066
00067 REFERENCE_TIME GetDuration() {return m_rtDuration;}
00068 int GetID() {return m_iID;}
00069 CMediaType& CurrentMediaType() {return m_mt;}
00070 bool IsSubtitleStream();
00071
00072 HRESULT CheckMediaType(const CMediaType* pmt);
00073 HRESULT BreakConnect();
00074 HRESULT CompleteConnect(IPin* pReceivePin);
00075
00076 HRESULT Active();
00077 HRESULT Inactive();
00078
00079 STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
00080 STDMETHODIMP Receive(IMediaSample* pSample);
00081 STDMETHODIMP EndOfStream();
00082 };