home *** CD-ROM | disk | FTP | other *** search
- //==========================================================================;
- //
- // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- // PURPOSE.
- //
- // Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
- //
- //--------------------------------------------------------------------------;
-
- #ifndef __TEE__
- #define __TEE__
-
- // define a GUID for tee objects.
-
- // {022B8142-0946-11cf-BCB1-444553540000}
- DEFINE_GUID (CLSID_Tee,
- 0x22b8142, 0x946, 0x11cf, 0xbc, 0xb1, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
-
- //----------------------------------------------------------------------------
- // forward reference to classes defined later
- //----------------------------------------------------------------------------
-
- class CTee ;
- class CTeeOutputPin ;
-
- //----------------------------------------------------------------------------
- // CTeeInputPin. class for the Tee filter's Input pin.
- //----------------------------------------------------------------------------
- class CTeeInputPin : public CBaseInputPin
- {
- friend class CTeeOutputPin ;
- public:
-
- // constructor and destructor
- CTeeInputPin (TCHAR *pObjName, CTee *pTee, HRESULT *phr, LPCWSTR pPinName) ;
- ~CTeeInputPin () ;
-
- // Used to check the input pin connection
- HRESULT CheckMediaType (const CMediaType *pmt) ;
- HRESULT SetMediaType (const CMediaType *pmt) ;
- HRESULT BreakConnect () ;
-
- // reconnect outputs if necessary at end of completion
- virtual HRESULT CompleteConnect(IPin *pReceivePin);
-
- STDMETHODIMP NotifyAllocator (IMemAllocator *pAllocator, BOOL bReadOnly);
-
- // pass throughs
- STDMETHODIMP EndOfStream () ;
- STDMETHODIMP BeginFlush () ;
- STDMETHODIMP EndFlush () ;
-
- // handles the next block of data from the stream
- STDMETHODIMP Receive (IMediaSample *pSample) ;
-
- // Persistent pin stuff
- STDMETHODIMP QueryId(LPWSTR * Id)
- {
- *Id = (LPWSTR)CoTaskMemAlloc(8);
- if (*Id==NULL) {
- return E_OUTOFMEMORY;
- }
- lstrcpyW(*Id, L"0");
- return NOERROR;
- }
-
- private:
- CTee *m_pTee ; // ptr to the owner filter class
- BOOL m_bInsideCheckMediaType ; // re-entrancy control
- } ;
-
-
- //----------------------------------------------------------------------------
- // CTeeOutputPin. class for the Tee filter's Output pins.
- //----------------------------------------------------------------------------
- class CTeeOutputPin : public CBaseOutputPin
- {
- friend class CTeeInputPin ;
- friend class CTee ;
-
- public:
-
- // constructor and destructor
- CTeeOutputPin (TCHAR *pObjName, CTee *pTee, HRESULT *phr, LPCWSTR pPinName,
- INT PinNumber) ;
- ~CTeeOutputPin () ;
-
- // Override to expose IMediaPosition
- STDMETHODIMP NonDelegatingQueryInterface (REFIID riid, void **ppvoid) ;
-
- // Override since the life time of pins and filters are not the same.
- STDMETHODIMP_(ULONG) NonDelegatingAddRef();
- STDMETHODIMP_(ULONG) NonDelegatingRelease();
-
- // Override to enumerate media types.
- STDMETHODIMP EnumMediaTypes (IEnumMediaTypes **ppEnum) ;
-
- // Check that we can support an output type
- HRESULT CheckMediaType (const CMediaType *pmt) ;
- HRESULT SetMediaType (const CMediaType *pmt) ;
-
- // Negotiation to use our input pins allocator
- HRESULT DecideAllocator (IMemInputPin *pPin, IMemAllocator **ppAlloc) ;
- HRESULT DecideBufferSize (IMemAllocator *pMemAllocator,
- ALLOCATOR_PROPERTIES * ppropInputRequest);
-
- // Used to create output queue objects
- HRESULT Active () ;
- HRESULT Inactive () ;
-
- // overriden to create and destroy output pins
- HRESULT CompleteConnect(IPin *pReceivePin);
-
- // overriden to pass data to the output queues
- HRESULT Deliver (IMediaSample *pMediaSample) ;
- HRESULT DeliverEndOfStream () ;
- HRESULT DeliverBeginFlush () ;
- HRESULT DeliverEndFlush () ;
-
- // overriden to handle quality messages
- STDMETHODIMP Notify (IFilter *pSender, Quality q) ;
-
- // Persistent pin id
- STDMETHODIMP QueryId(LPWSTR * Id);
-
- private:
-
- CTee *m_pTee ; // ptr to the owner filter class
- CPosPassThru *m_pPosition ; // pass seek calls upstream
- BOOL m_bHoldsSeek ; // is this the one seekable stream
- COutputQueue *m_pOutputQueue ; // streams data to the peer pin
- BOOL m_bInsideCheckMediaType ; // re-entrancy control
- LONG m_cOurRef ; // we maintain reference couting
- };
-
- //----------------------------------------------------------------------------
- // CTee. class for the Tee filter
- //----------------------------------------------------------------------------
-
- class CTee: public CCritSec, public CBaseFilter
- {
- // let the pins access our internal state.
- friend class CTeeInputPin ;
- friend class CTeeOutputPin ;
-
- public:
- CTee (TCHAR *pName, LPUNKNOWN pUnk, HRESULT *hr) ; // constructore
- ~CTee () ; // destructor
- CBasePin *GetPin (int n) ; // gets a pin ptr
- int GetPinCount () ; // rets # pins.
-
- // Persistent pin id support
- STDMETHODIMP FindPin(LPCWSTR pwszPinId, IPin **ppPin);
-
- // function needed for the class factory
- static CUnknown *CreateInstance (LPUNKNOWN pUnk, HRESULT *phr) ;
-
- // setup helper
- LPAMOVIESETUP_FILTER GetSetupData();
-
- protected:
-
- // The following manage the list of output pins, their creation and
- // deletions.
-
- void InitOutputPinsList () ;
- CTeeOutputPin *GetPinNFromList (int n) ;
- CTeeOutputPin *CreateNextOutputPin (CTee *pTee) ;
- void DeleteOutputPin (CTeeOutputPin *pPin) ;
- int GetNumFreePins () ;
-
- private:
-
- // declare a input pin.
-
- CTeeInputPin m_Input ;
-
- // declare a list to keep a list of all the output pins.
-
- INT m_NumOutputPins ;
- typedef CGenericList <CTeeOutputPin> COutputList ;
- COutputList m_OutputPinsList ;
- INT m_NextOutputPinNumber ; // increases monotonically.
-
-
- // other assorted data members.
-
- LONG m_lCanSeek ; // seekable output pin (only one is..)
- IMemAllocator *m_pAllocator ; // Allocator from our input pin
-
- } ;
-
- #endif // __TEE__
-