//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The use and distribution terms for this software are covered by the
// Microsoft Limited Public License (Ms-LPL)
// which can be found in the file MS-LPL.txt at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license.
//
// The software is licensed “as-is.”
//
// You must not remove this notice, or any other, from this software.
//
//
//
// Demux code for Windows CE
//
//-------------------------------------------------------------------------
//======================================================================
// Demux code for Windows CE
//======================================================================
#ifndef _mp2demux__pin_out_h
#define _mp2demux__pin_out_h
// forward declaration
class CMPEG2Demultiplexer ;
class CMediaSampleCopyBuffer ;
class CRefCountedCritSec ;
class CMPEG2DemuxOutputPin
: public CBaseOutputPin,
public IMPEG2PIDMap, // transport
public IMPEG2StreamIdMap, // program
public IAMPushSource
{
friend CMediaSampleCopyBuffer ;
friend CMediaSampleWrapperPool ;
friend CMPEG2Demultiplexer ;
CMediaType m_MediaType ;
LONG m_cRefcount ; // this is not the same refcount as
// the base class (m_cRef)
COutputQueue * m_pOutputQueue ;
CMpeg2Stats * m_pStats ;
LONG m_lBatchSize ; // size of the batches for downstream sends
LONG m_lQueueSize ; // output queue size
BOOL m_fBatchExact ; // send only batches of media samples downstream
DWORD m_dwMediaSampleLen ; // requested bytes available in each media sample
DWORD m_dwMediaSamplePool ; // requested number of media samples in pin's allocator pool
CMPEG2Demultiplexer * m_pMpeg2DemuxFilter ;
CMpeg2DemuxMediaSeekingCOM m_Seek ; // IMediaSeeking object
CRefCountedCritSec * m_pcrtSeekingLock ;
CMpeg2DemuxMediaSeekingCore * m_pSeekingCore ;
LONG m_lFlushingRef ; // handle nested begin/endflush calls
DWORD m_dwThreadPriority;
public :
CMPEG2DemuxOutputPin (
IN AM_MEDIA_TYPE * pmt,
IN LPWSTR pszPinName,
IN TCHAR * pObjectName,
IN CMPEG2Demultiplexer * pOwningFilter,
IN CRefCountedCritSec * pcrtFilterLock,
IN CMpeg2DemuxMediaSeekingCore * pSeekingCore,
IN CRefCountedCritSec * pcrtSeekingLock,
IN CMpeg2Stats * pStats,
IN LONG lBatchSize,
IN BOOL fBatchExact,
IN DWORD dwMediaSampleLen,
IN DWORD dwMediaSamplePool,
OUT HRESULT * pHr
) ;
~CMPEG2DemuxOutputPin (
void
) ;
DECLARE_IUNKNOWN ;
// Override since the life time of pins and filters are not the same
STDMETHODIMP_(ULONG)
NonDelegatingAddRef (
) ;
STDMETHODIMP_(ULONG)
NonDelegatingRelease (
) ;
STDMETHODIMP
NonDelegatingQueryInterface (
IN REFIID riid,
IN LPVOID * ppv
) ;
// dshow pin management methods
HRESULT
CheckMediaType (
IN const CMediaType * pmt
) ;
HRESULT
GetMediaType (
IN int iPosition,
OUT CMediaType * pmt
) ;
virtual
HRESULT
SetMediaType (
IN const CMediaType * pmt
) ;
HRESULT
DecideBufferSize (
IN IMemAllocator * pAlloc,
IN ALLOCATOR_PROPERTIES * ppropInputRequest
) ;
HRESULT
Active (
) ;
HRESULT
Inactive (
) ;
HRESULT
SendSample (
IN IMediaSample * pIMediaSample
) ;
BOOL
IsVideo (
)
{
return (IsConnected () &&
IsVideoMediaType (& m_mt) ? TRUE : FALSE) ;
}
HRESULT
DeliverBeginFlush (
) ;
HRESULT
DeliverEndFlush (
) ;
HRESULT
DeliverEndOfStream (
) ;
// if we're program stream, we must be the allocator
HRESULT
DecideAllocator (
IN IMemInputPin * pPin,
IN IMemAllocator ** ppAlloc
) ;
// -------------------------------------------------------------------
// IMPEG2PIDMap
virtual
STDMETHODIMP
MapPID (
IN ULONG,
IN ULONG *,
IN MEDIA_SAMPLE_CONTENT
) ;
virtual
STDMETHODIMP
UnmapPID (
IN ULONG,
IN ULONG *
) ;
virtual
STDMETHODIMP
EnumPIDMap (
OUT IEnumPIDMap **
) ;
// -------------------------------------------------------------------
// IMPEG2StreamIdMap
virtual
STDMETHODIMP
MapStreamId (
IN ULONG,
IN DWORD,
IN ULONG,
IN int
) ;
virtual
STDMETHODIMP
UnmapStreamId (
IN ULONG,
IN ULONG *
) ;
virtual
STDMETHODIMP
EnumStreamIdMap (
OUT IEnumStreamIdMap **
) ;
// -------------------------------------------------------------------
// IAMPushSource interface
STDMETHODIMP
GetPushSourceFlags (
OUT ULONG * pFlags
)
{
// set this purely to get around an ASSERT in quartz
if (pFlags == NULL) {
return E_POINTER ;
}
// we're not live in the strict sense; strict sense is that we are
// received stored content i.e. non-live content is being pushed
// (broadcast) to us.
(* pFlags) = AM_PUSHSOURCECAPS_NOT_LIVE ;
return S_OK ;
}
STDMETHODIMP
SetPushSourceFlags (
IN ULONG Flags
)
{
return E_NOTIMPL ;
}
STDMETHODIMP
SetStreamOffset (
IN REFERENCE_TIME rtOffset
)
{
return E_NOTIMPL ;
}
STDMETHODIMP
GetStreamOffset (
OUT REFERENCE_TIME * prtOffset
)
{
return E_NOTIMPL ;
}
STDMETHODIMP
GetMaxStreamOffset (
OUT REFERENCE_TIME * prtMaxOffset
)
{
return E_NOTIMPL ;
}
STDMETHODIMP
SetMaxStreamOffset (
IN REFERENCE_TIME rtMaxOffset
)
{
return E_NOTIMPL ;
}
STDMETHODIMP
GetLatency(
IN REFERENCE_TIME * prtLatency
)
{
return E_NOTIMPL ;
}
} ;
#endif // _mp2demux__pin_out_h