- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# BaseMuxer.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 "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         // only called when the output pin is connected
    00055         virtual void MuxHeader(IBitStream* pBS) {}
    00056         virtual void MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket) {}
    00057         virtual void MuxFooter(IBitStream* pBS) {}
    00058
    00059         // always called (useful if the derived class wants to write somewhere else than downstream)
    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         //void Receive(CAutoPtr<Packet> pPacket);
    00075
    00076         int GetPinCount();
    00077         CBasePin* GetPin(int n);
    00078
    00079         STDMETHODIMP Stop();
    00080         STDMETHODIMP Pause();
    00081         STDMETHODIMP Run(REFERENCE_TIME tStart);
    00082
    00083         // IMediaSeeking
    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