- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# BaseMuxerInputPin.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 "..\..\..\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 };