[KSPROXY]

- Implement IKsPinPipe for CInputPin & COutputPin
- Implement IKsPinFactory, IStreamBuilder for CInputPin
- Implement IKsAggregateControl, IQualityControl stub for CInputPin & COutputPin

svn path=/trunk/; revision=46222
This commit is contained in:
Johannes Anderwald 2010-03-16 11:12:19 +00:00
parent 76e59af897
commit 8012adb803
3 changed files with 1057 additions and 29 deletions

View file

@ -8,13 +8,14 @@
*/ */
#include "precomp.h" #include "precomp.h"
const GUID IID_IKsPinPipe = {0xe539cd90, 0xa8b4, 0x11d1, {0x81, 0x89, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02}};
const GUID IID_IKsPinEx = {0x7bb38260L, 0xd19c, 0x11d2, {0xb3, 0x8a, 0x00, 0xa0, 0xc9, 0x5e, 0xc2, 0x2e}}; const GUID IID_IKsPinEx = {0x7bb38260L, 0xd19c, 0x11d2, {0xb3, 0x8a, 0x00, 0xa0, 0xc9, 0x5e, 0xc2, 0x2e}};
#ifndef _MSC_VER
const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
#endif
#ifndef _MSC_VER #ifndef _MSC_VER
const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
KSPIN_INTERFACE StandardPinInterface = KSPIN_INTERFACE StandardPinInterface =
{ {
{STATIC_KSINTERFACESETID_Standard}, {STATIC_KSINTERFACESETID_Standard},
@ -53,14 +54,12 @@ class CInputPin : public IPin,
public IKsObject, public IKsObject,
public IKsPinEx, public IKsPinEx,
public IMemInputPin, public IMemInputPin,
public ISpecifyPropertyPages
/*
public IQualityControl,
public IKsPinPipe, public IKsPinPipe,
public IStreamBuilder,
public IKsPinFactory, public IKsPinFactory,
public IKsAggregateControl public IStreamBuilder,
*/ public IKsAggregateControl,
public IQualityControl,
public ISpecifyPropertyPages
{ {
public: public:
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface); STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
@ -81,6 +80,19 @@ public:
return m_Ref; return m_Ref;
} }
//IKsPinPipe
HRESULT STDMETHODCALLTYPE KsGetPinFramingCache(PKSALLOCATOR_FRAMING_EX *FramingEx, PFRAMING_PROP FramingProp, FRAMING_CACHE_OPS Option);
HRESULT STDMETHODCALLTYPE KsSetPinFramingCache(PKSALLOCATOR_FRAMING_EX FramingEx, PFRAMING_PROP FramingProp, FRAMING_CACHE_OPS Option);
IPin* STDMETHODCALLTYPE KsGetConnectedPin();
IKsAllocatorEx* STDMETHODCALLTYPE KsGetPipe(KSPEEKOPERATION Operation);
HRESULT STDMETHODCALLTYPE KsSetPipe(IKsAllocatorEx *KsAllocator);
ULONG STDMETHODCALLTYPE KsGetPipeAllocatorFlag();
HRESULT STDMETHODCALLTYPE KsSetPipeAllocatorFlag(ULONG Flag);
GUID STDMETHODCALLTYPE KsGetPinBusCache();
HRESULT STDMETHODCALLTYPE KsSetPinBusCache(GUID Bus);
PWCHAR STDMETHODCALLTYPE KsGetPinName();
PWCHAR STDMETHODCALLTYPE KsGetFilterName();
//IPin methods //IPin methods
HRESULT STDMETHODCALLTYPE Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt); HRESULT STDMETHODCALLTYPE Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt);
HRESULT STDMETHODCALLTYPE ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt); HRESULT STDMETHODCALLTYPE ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt);
@ -139,11 +151,26 @@ public:
HRESULT STDMETHODCALLTYPE ReceiveMultiple(IMediaSample **pSamples, long nSamples, long *nSamplesProcessed); HRESULT STDMETHODCALLTYPE ReceiveMultiple(IMediaSample **pSamples, long nSamples, long *nSamplesProcessed);
HRESULT STDMETHODCALLTYPE ReceiveCanBlock( void); HRESULT STDMETHODCALLTYPE ReceiveCanBlock( void);
//IKsPinFactory
HRESULT STDMETHODCALLTYPE KsPinFactory(ULONG* PinFactory);
//IStreamBuilder
HRESULT STDMETHODCALLTYPE Render(IPin *ppinOut, IGraphBuilder *pGraph);
HRESULT STDMETHODCALLTYPE Backout(IPin *ppinOut, IGraphBuilder *pGraph);
//IKsAggregateControl
HRESULT STDMETHODCALLTYPE KsAddAggregate(IN REFGUID AggregateClass);
HRESULT STDMETHODCALLTYPE KsRemoveAggregate(REFGUID AggregateClass);
//IQualityControl
HRESULT STDMETHODCALLTYPE Notify(IBaseFilter *pSelf, Quality q);
HRESULT STDMETHODCALLTYPE SetSink(IQualityControl *piqc);
//--------------------------------------------------------------- //---------------------------------------------------------------
HRESULT STDMETHODCALLTYPE CheckFormat(const AM_MEDIA_TYPE *pmt); HRESULT STDMETHODCALLTYPE CheckFormat(const AM_MEDIA_TYPE *pmt);
HRESULT STDMETHODCALLTYPE CreatePin(const AM_MEDIA_TYPE *pmt); HRESULT STDMETHODCALLTYPE CreatePin(const AM_MEDIA_TYPE *pmt);
HRESULT STDMETHODCALLTYPE CreatePinHandle(PKSPIN_MEDIUM Medium, PKSPIN_INTERFACE Interface, const AM_MEDIA_TYPE *pmt); HRESULT STDMETHODCALLTYPE CreatePinHandle(PKSPIN_MEDIUM Medium, PKSPIN_INTERFACE Interface, const AM_MEDIA_TYPE *pmt);
CInputPin(IBaseFilter * ParentFilter, LPCWSTR PinName, HANDLE hFilter, ULONG PinId, KSPIN_COMMUNICATION Communication) : m_Ref(0), m_ParentFilter(ParentFilter), m_PinName(PinName), m_hFilter(hFilter), m_hPin(INVALID_HANDLE_VALUE), m_PinId(PinId), m_MemAllocator(0), m_IoCount(0), m_Communication(Communication), m_Pin(0), m_ReadOnly(0), m_InterfaceHandler(0){}; CInputPin(IBaseFilter * ParentFilter, LPCWSTR PinName, HANDLE hFilter, ULONG PinId, KSPIN_COMMUNICATION Communication);
virtual ~CInputPin(){}; virtual ~CInputPin(){};
protected: protected:
@ -161,8 +188,41 @@ protected:
IPin * m_Pin; IPin * m_Pin;
BOOL m_ReadOnly; BOOL m_ReadOnly;
IKsInterfaceHandler * m_InterfaceHandler; IKsInterfaceHandler * m_InterfaceHandler;
IKsAllocatorEx * m_KsAllocatorEx;
ULONG m_PipeAllocatorFlag;
BOOL m_bPinBusCacheInitialized;
GUID m_PinBusCache;
LPWSTR m_FilterName;
FRAMING_PROP m_FramingProp[4];
PKSALLOCATOR_FRAMING_EX m_FramingEx[4];
}; };
CInputPin::CInputPin(
IBaseFilter * ParentFilter,
LPCWSTR PinName,
HANDLE hFilter,
ULONG PinId,
KSPIN_COMMUNICATION Communication) : m_Ref(0),
m_ParentFilter(ParentFilter),
m_PinName(PinName),
m_hFilter(hFilter),
m_hPin(INVALID_HANDLE_VALUE),
m_PinId(PinId),
m_MemAllocator(0),
m_IoCount(0),
m_Communication(Communication),
m_Pin(0),
m_ReadOnly(0),
m_InterfaceHandler(0),
m_KsAllocatorEx(0),
m_PipeAllocatorFlag(0),
m_bPinBusCacheInitialized(0),
m_FilterName(0)
{
ZeroMemory(m_FramingProp, sizeof(m_FramingProp));
ZeroMemory(m_FramingEx, sizeof(m_FramingEx));
}
HRESULT HRESULT
STDMETHODCALLTYPE STDMETHODCALLTYPE
CInputPin::QueryInterface( CInputPin::QueryInterface(
@ -209,6 +269,38 @@ CInputPin::QueryInterface(
reinterpret_cast<IKsPinEx*>(*Output)->AddRef(); reinterpret_cast<IKsPinEx*>(*Output)->AddRef();
return NOERROR; return NOERROR;
} }
else if (IsEqualGUID(refiid, IID_IKsPinPipe))
{
*Output = (IKsPinPipe*)(this);
reinterpret_cast<IKsPinPipe*>(*Output)->AddRef();
return NOERROR;
}
else if (IsEqualGUID(refiid, IID_IKsPinFactory))
{
*Output = (IKsPinFactory*)(this);
reinterpret_cast<IKsPinFactory*>(*Output)->AddRef();
return NOERROR;
}
#if 0
else if (IsEqualGUID(refiid, IID_IStreamBuilder))
{
*Output = (IStreamBuilder*)(this);
reinterpret_cast<IStreamBuilder*>(*Output)->AddRef();
return NOERROR;
}
#endif
else if (IsEqualGUID(refiid, IID_IKsAggregateControl))
{
*Output = (IKsAggregateControl*)(this);
reinterpret_cast<IKsAggregateControl*>(*Output)->AddRef();
return NOERROR;
}
else if (IsEqualGUID(refiid, IID_IQualityControl))
{
*Output = (IQualityControl*)(this);
reinterpret_cast<IQualityControl*>(*Output)->AddRef();
return NOERROR;
}
else if (IsEqualGUID(refiid, IID_ISpecifyPropertyPages)) else if (IsEqualGUID(refiid, IID_ISpecifyPropertyPages))
{ {
*Output = (ISpecifyPropertyPages*)(this); *Output = (ISpecifyPropertyPages*)(this);
@ -225,6 +317,232 @@ CInputPin::QueryInterface(
return E_NOINTERFACE; return E_NOINTERFACE;
} }
//-------------------------------------------------------------------
// IQualityControl interface
//
HRESULT
STDMETHODCALLTYPE
CInputPin::Notify(
IBaseFilter *pSelf,
Quality q)
{
OutputDebugStringW(L"CInputPin::Notify NotImplemented\n");
return E_NOTIMPL;
}
HRESULT
STDMETHODCALLTYPE
CInputPin::SetSink(
IQualityControl *piqc)
{
OutputDebugStringW(L"CInputPin::SetSink NotImplemented\n");
return E_NOTIMPL;
}
//-------------------------------------------------------------------
// IKsAggregateControl interface
//
HRESULT
STDMETHODCALLTYPE
CInputPin::KsAddAggregate(
IN REFGUID AggregateClass)
{
OutputDebugStringW(L"CInputPin::KsAddAggregate NotImplemented\n");
return E_NOTIMPL;
}
HRESULT
STDMETHODCALLTYPE
CInputPin::KsRemoveAggregate(
REFGUID AggregateClass)
{
OutputDebugStringW(L"CInputPin::KsRemoveAggregate NotImplemented\n");
return E_NOTIMPL;
}
//-------------------------------------------------------------------
// IStreamBuilder
//
HRESULT
STDMETHODCALLTYPE
CInputPin::Render(
IPin *ppinOut,
IGraphBuilder *pGraph)
{
OutputDebugStringW(L"CInputPin::Render\n");
return S_OK;
}
HRESULT
STDMETHODCALLTYPE
CInputPin::Backout(
IPin *ppinOut,
IGraphBuilder *pGraph)
{
OutputDebugStringW(L"CInputPin::Backout\n");
return S_OK;
}
//-------------------------------------------------------------------
// IKsPinFactory
//
HRESULT
STDMETHODCALLTYPE
CInputPin::KsPinFactory(
ULONG* PinFactory)
{
OutputDebugStringW(L"CInputPin::KsPinFactory\n");
*PinFactory = m_PinId;
return S_OK;
}
//-------------------------------------------------------------------
// IKsPinPipe
//
HRESULT
STDMETHODCALLTYPE
CInputPin::KsGetPinFramingCache(
PKSALLOCATOR_FRAMING_EX *FramingEx,
PFRAMING_PROP FramingProp,
FRAMING_CACHE_OPS Option)
{
if (Option > Framing_Cache_Write || Option < Framing_Cache_ReadLast)
{
// invalid argument
return E_INVALIDARG;
}
// get framing properties
*FramingProp = m_FramingProp[Option];
*FramingEx = m_FramingEx[Option];
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CInputPin::KsSetPinFramingCache(
PKSALLOCATOR_FRAMING_EX FramingEx,
PFRAMING_PROP FramingProp,
FRAMING_CACHE_OPS Option)
{
ULONG Index;
ULONG RefCount = 0;
if (m_FramingEx[Option])
{
for(Index = 1; Index < 4; Index++)
{
if (m_FramingEx[Index] == m_FramingEx[Option])
RefCount++;
}
if (RefCount == 1)
{
// existing framing is only used once
CoTaskMemFree(m_FramingEx[Option]);
}
}
// store framing
m_FramingEx[Option] = FramingEx;
m_FramingProp[Option] = *FramingProp;
return S_OK;
}
IPin*
STDMETHODCALLTYPE
CInputPin::KsGetConnectedPin()
{
return m_Pin;
}
IKsAllocatorEx*
STDMETHODCALLTYPE
CInputPin::KsGetPipe(
KSPEEKOPERATION Operation)
{
if (Operation == KsPeekOperation_AddRef)
{
if (m_KsAllocatorEx)
m_KsAllocatorEx->AddRef();
}
return m_KsAllocatorEx;
}
HRESULT
STDMETHODCALLTYPE
CInputPin::KsSetPipe(
IKsAllocatorEx *KsAllocator)
{
if (KsAllocator)
KsAllocator->AddRef();
if (m_KsAllocatorEx)
m_KsAllocatorEx->Release();
m_KsAllocatorEx = KsAllocator;
return NOERROR;
}
ULONG
STDMETHODCALLTYPE
CInputPin::KsGetPipeAllocatorFlag()
{
return m_PipeAllocatorFlag;
}
HRESULT
STDMETHODCALLTYPE
CInputPin::KsSetPipeAllocatorFlag(
ULONG Flag)
{
m_PipeAllocatorFlag = Flag;
return NOERROR;
}
GUID
STDMETHODCALLTYPE
CInputPin::KsGetPinBusCache()
{
if (!m_bPinBusCacheInitialized)
{
CopyMemory(&m_PinBusCache, &m_Medium.Set, sizeof(GUID));
m_bPinBusCacheInitialized = TRUE;
}
return m_PinBusCache;
}
HRESULT
STDMETHODCALLTYPE
CInputPin::KsSetPinBusCache(
GUID Bus)
{
CopyMemory(&m_PinBusCache, &Bus, sizeof(GUID));
return NOERROR;
}
PWCHAR
STDMETHODCALLTYPE
CInputPin::KsGetPinName()
{
return (PWCHAR)m_PinName;
}
PWCHAR
STDMETHODCALLTYPE
CInputPin::KsGetFilterName()
{
return m_FilterName;
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// ISpecifyPropertyPages // ISpecifyPropertyPages
@ -325,7 +643,6 @@ CInputPin::ReceiveCanBlock( void)
return S_FALSE; return S_FALSE;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// IKsPin // IKsPin
// //
@ -854,6 +1171,7 @@ CInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
return E_NOTIMPL; return E_NOTIMPL;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
HRESULT HRESULT
STDMETHODCALLTYPE STDMETHODCALLTYPE

View file

@ -1,34 +1,29 @@
/* /*
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS WDM Streaming ActiveMovie Proxy * PROJECT: ReactOS WDM Streaming ActiveMovie Proxy
* FILE: dll/directx/ksproxy/input_cpp.cpp * FILE: dll/directx/ksproxy/Output_cpp.cpp
* PURPOSE: InputPin of Proxy Filter * PURPOSE: OutputPin of Proxy Filter
* *
* PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org) * PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org)
*/ */
#include "precomp.h" #include "precomp.h"
#ifndef _MSC_VER
const GUID IID_IKsPinFactory = {0xCD5EBE6BL, 0x8B6E, 0x11D1, {0x8A, 0xE0, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
#endif
class COutputPin : public IPin, class COutputPin : public IPin,
public IKsObject, public IKsObject,
public IKsPropertySet, public IKsPropertySet,
public IStreamBuilder, public IStreamBuilder,
public IKsPinFactory, public IKsPinFactory,
public ISpecifyPropertyPages, public ISpecifyPropertyPages,
// public IKsPinPipe,
public IKsControl
/*
public IAMBufferNegotiation,
public IQualityControl,
public IKsPinEx, public IKsPinEx,
public IKsAggregateControl public IKsPinPipe,
public IKsControl,
public IKsAggregateControl,
public IQualityControl,
public IMediaSeeking, public IMediaSeeking,
public IAMBufferNegotiation,
public IAMStreamConfig, public IAMStreamConfig,
public IMemAllocatorNotifyCallbackTemp public IMemAllocatorNotifyCallbackTemp
*/
{ {
public: public:
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface); STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
@ -49,6 +44,23 @@ public:
return m_Ref; return m_Ref;
} }
//IKsPin
HRESULT STDMETHODCALLTYPE KsQueryMediums(PKSMULTIPLE_ITEM* MediumList);
HRESULT STDMETHODCALLTYPE KsQueryInterfaces(PKSMULTIPLE_ITEM* InterfaceList);
HRESULT STDMETHODCALLTYPE KsCreateSinkPinHandle(KSPIN_INTERFACE& Interface, KSPIN_MEDIUM& Medium);
HRESULT STDMETHODCALLTYPE KsGetCurrentCommunication(KSPIN_COMMUNICATION *Communication, KSPIN_INTERFACE *Interface, KSPIN_MEDIUM *Medium);
HRESULT STDMETHODCALLTYPE KsPropagateAcquire();
HRESULT STDMETHODCALLTYPE KsDeliver(IMediaSample* Sample, ULONG Flags);
HRESULT STDMETHODCALLTYPE KsMediaSamplesCompleted(PKSSTREAM_SEGMENT StreamSegment);
IMemAllocator * STDMETHODCALLTYPE KsPeekAllocator(KSPEEKOPERATION Operation);
HRESULT STDMETHODCALLTYPE KsReceiveAllocator(IMemAllocator *MemAllocator);
HRESULT STDMETHODCALLTYPE KsRenegotiateAllocator();
LONG STDMETHODCALLTYPE KsIncrementPendingIoCount();
LONG STDMETHODCALLTYPE KsDecrementPendingIoCount();
HRESULT STDMETHODCALLTYPE KsQualityNotify(ULONG Proportion, REFERENCE_TIME TimeDelta);
// IKsPinEx
VOID STDMETHODCALLTYPE KsNotifyError(IMediaSample* Sample, HRESULT hr);
//IKsPinPipe //IKsPinPipe
HRESULT STDMETHODCALLTYPE KsGetPinFramingCache(PKSALLOCATOR_FRAMING_EX *FramingEx, PFRAMING_PROP FramingProp, FRAMING_CACHE_OPS Option); HRESULT STDMETHODCALLTYPE KsGetPinFramingCache(PKSALLOCATOR_FRAMING_EX *FramingEx, PFRAMING_PROP FramingProp, FRAMING_CACHE_OPS Option);
HRESULT STDMETHODCALLTYPE KsSetPinFramingCache(PKSALLOCATOR_FRAMING_EX FramingEx, PFRAMING_PROP FramingProp, FRAMING_CACHE_OPS Option); HRESULT STDMETHODCALLTYPE KsSetPinFramingCache(PKSALLOCATOR_FRAMING_EX FramingEx, PFRAMING_PROP FramingProp, FRAMING_CACHE_OPS Option);
@ -102,6 +114,46 @@ public:
//IKsPinFactory //IKsPinFactory
HRESULT STDMETHODCALLTYPE KsPinFactory(ULONG* PinFactory); HRESULT STDMETHODCALLTYPE KsPinFactory(ULONG* PinFactory);
//IKsAggregateControl
HRESULT STDMETHODCALLTYPE KsAddAggregate(IN REFGUID AggregateClass);
HRESULT STDMETHODCALLTYPE KsRemoveAggregate(REFGUID AggregateClass);
//IQualityControl
HRESULT STDMETHODCALLTYPE Notify(IBaseFilter *pSelf, Quality q);
HRESULT STDMETHODCALLTYPE SetSink(IQualityControl *piqc);
//IMediaSeeking
HRESULT STDMETHODCALLTYPE GetCapabilities(DWORD *pCapabilities);
HRESULT STDMETHODCALLTYPE CheckCapabilities(DWORD *pCapabilities);
HRESULT STDMETHODCALLTYPE IsFormatSupported(const GUID *pFormat);
HRESULT STDMETHODCALLTYPE QueryPreferredFormat(GUID *pFormat);
HRESULT STDMETHODCALLTYPE GetTimeFormat(GUID *pFormat);
HRESULT STDMETHODCALLTYPE IsUsingTimeFormat(const GUID *pFormat);
HRESULT STDMETHODCALLTYPE SetTimeFormat(const GUID *pFormat);
HRESULT STDMETHODCALLTYPE GetDuration(LONGLONG *pDuration);
HRESULT STDMETHODCALLTYPE GetStopPosition(LONGLONG *pStop);
HRESULT STDMETHODCALLTYPE GetCurrentPosition(LONGLONG *pCurrent);
HRESULT STDMETHODCALLTYPE ConvertTimeFormat(LONGLONG *pTarget, const GUID *pTargetFormat, LONGLONG Source, const GUID *pSourceFormat);
HRESULT STDMETHODCALLTYPE SetPositions(LONGLONG *pCurrent, DWORD dwCurrentFlags, LONGLONG *pStop, DWORD dwStopFlags);
HRESULT STDMETHODCALLTYPE GetPositions(LONGLONG *pCurrent, LONGLONG *pStop);
HRESULT STDMETHODCALLTYPE GetAvailable(LONGLONG *pEarliest, LONGLONG *pLatest);
HRESULT STDMETHODCALLTYPE SetRate(double dRate);
HRESULT STDMETHODCALLTYPE GetRate(double *pdRate);
HRESULT STDMETHODCALLTYPE GetPreroll(LONGLONG *pllPreroll);
//IAMBufferNegotiation
HRESULT STDMETHODCALLTYPE SuggestAllocatorProperties(const ALLOCATOR_PROPERTIES *pprop);
HRESULT STDMETHODCALLTYPE GetAllocatorProperties(ALLOCATOR_PROPERTIES *pprop);
//IAMStreamConfig
HRESULT STDMETHODCALLTYPE SetFormat(AM_MEDIA_TYPE *pmt);
HRESULT STDMETHODCALLTYPE GetFormat(AM_MEDIA_TYPE **ppmt);
HRESULT STDMETHODCALLTYPE GetNumberOfCapabilities(int *piCount, int *piSize);
HRESULT STDMETHODCALLTYPE GetStreamCaps(int iIndex, AM_MEDIA_TYPE **ppmt, BYTE *pSCC);
//IMemAllocatorNotifyCallbackTemp
HRESULT STDMETHODCALLTYPE NotifyRelease();
COutputPin(IBaseFilter * ParentFilter, LPCWSTR PinName, ULONG PinId); COutputPin(IBaseFilter * ParentFilter, LPCWSTR PinName, ULONG PinId);
virtual ~COutputPin(); virtual ~COutputPin();
@ -113,6 +165,20 @@ protected:
ULONG m_PinId; ULONG m_PinId;
IKsObject * m_KsObjectParent; IKsObject * m_KsObjectParent;
IPin * m_Pin; IPin * m_Pin;
IKsAllocatorEx * m_KsAllocatorEx;
ULONG m_PipeAllocatorFlag;
BOOL m_bPinBusCacheInitialized;
GUID m_PinBusCache;
LPWSTR m_FilterName;
FRAMING_PROP m_FramingProp[4];
PKSALLOCATOR_FRAMING_EX m_FramingEx[4];
IMemAllocator * m_MemAllocator;
LONG m_IoCount;
KSPIN_COMMUNICATION m_Communication;
KSPIN_INTERFACE m_Interface;
KSPIN_MEDIUM m_Medium;
IMediaSeeking * m_FilterMediaSeeking;
}; };
COutputPin::~COutputPin() COutputPin::~COutputPin()
@ -124,13 +190,32 @@ COutputPin::~COutputPin()
COutputPin::COutputPin( COutputPin::COutputPin(
IBaseFilter * ParentFilter, IBaseFilter * ParentFilter,
LPCWSTR PinName, LPCWSTR PinName,
ULONG PinId) : m_Ref(0), m_ParentFilter(ParentFilter), m_PinName(PinName), m_hPin(INVALID_HANDLE_VALUE), m_PinId(PinId), m_KsObjectParent(0), m_Pin(0) ULONG PinId) : m_Ref(0),
m_ParentFilter(ParentFilter),
m_PinName(PinName),
m_hPin(INVALID_HANDLE_VALUE),
m_PinId(PinId),
m_KsObjectParent(0),
m_Pin(0),
m_KsAllocatorEx(0),
m_PipeAllocatorFlag(0),
m_bPinBusCacheInitialized(0),
m_FilterName(0),
m_MemAllocator(0),
m_IoCount(0),
m_Communication(KSPIN_COMMUNICATION_NONE),
m_FilterMediaSeeking(0)
{ {
HRESULT hr; HRESULT hr;
hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&m_KsObjectParent); hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&m_KsObjectParent);
assert(hr == S_OK); assert(hr == S_OK);
hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&m_FilterMediaSeeking);
assert(hr == S_OK);
ZeroMemory(m_FramingProp, sizeof(m_FramingProp));
ZeroMemory(m_FramingEx, sizeof(m_FramingEx));
}; };
HRESULT HRESULT
@ -155,6 +240,30 @@ COutputPin::QueryInterface(
reinterpret_cast<IKsObject*>(*Output)->AddRef(); reinterpret_cast<IKsObject*>(*Output)->AddRef();
return NOERROR; return NOERROR;
} }
else if (IsEqualGUID(refiid, IID_IKsPin) || IsEqualGUID(refiid, IID_IKsPinEx))
{
*Output = (IKsPinEx*)(this);
reinterpret_cast<IKsPinEx*>(*Output)->AddRef();
return NOERROR;
}
else if (IsEqualGUID(refiid, IID_IKsPinPipe))
{
*Output = (IKsPinPipe*)(this);
reinterpret_cast<IKsPinPipe*>(*Output)->AddRef();
return NOERROR;
}
else if (IsEqualGUID(refiid, IID_IKsAggregateControl))
{
*Output = (IKsAggregateControl*)(this);
reinterpret_cast<IKsAggregateControl*>(*Output)->AddRef();
return NOERROR;
}
else if (IsEqualGUID(refiid, IID_IQualityControl))
{
*Output = (IQualityControl*)(this);
reinterpret_cast<IQualityControl*>(*Output)->AddRef();
return NOERROR;
}
else if (IsEqualGUID(refiid, IID_IKsPropertySet)) else if (IsEqualGUID(refiid, IID_IKsPropertySet))
{ {
OutputDebugStringW(L"COutputPin::QueryInterface IID_IKsPropertySet\n"); OutputDebugStringW(L"COutputPin::QueryInterface IID_IKsPropertySet\n");
@ -192,6 +301,30 @@ COutputPin::QueryInterface(
reinterpret_cast<ISpecifyPropertyPages*>(*Output)->AddRef(); reinterpret_cast<ISpecifyPropertyPages*>(*Output)->AddRef();
return NOERROR; return NOERROR;
} }
else if (IsEqualGUID(refiid, IID_IMediaSeeking))
{
*Output = (IMediaSeeking*)(this);
reinterpret_cast<IMediaSeeking*>(*Output)->AddRef();
return NOERROR;
}
else if (IsEqualGUID(refiid, IID_IAMBufferNegotiation))
{
*Output = (IAMBufferNegotiation*)(this);
reinterpret_cast<IAMBufferNegotiation*>(*Output)->AddRef();
return NOERROR;
}
else if (IsEqualGUID(refiid, IID_IAMStreamConfig))
{
*Output = (IAMStreamConfig*)(this);
reinterpret_cast<IAMStreamConfig*>(*Output)->AddRef();
return NOERROR;
}
else if (IsEqualGUID(refiid, IID_IMemAllocatorNotifyCallbackTemp))
{
*Output = (IMemAllocatorNotifyCallbackTemp*)(this);
reinterpret_cast<IMemAllocatorNotifyCallbackTemp*>(*Output)->AddRef();
return NOERROR;
}
WCHAR Buffer[MAX_PATH]; WCHAR Buffer[MAX_PATH];
LPOLESTR lpstr; LPOLESTR lpstr;
@ -203,6 +336,580 @@ COutputPin::QueryInterface(
return E_NOINTERFACE; return E_NOINTERFACE;
} }
//-------------------------------------------------------------------
// IAMBufferNegotiation interface
//
HRESULT
STDMETHODCALLTYPE
COutputPin::SuggestAllocatorProperties(
const ALLOCATOR_PROPERTIES *pprop)
{
OutputDebugStringW(L"COutputPin::SuggestAllocatorProperties NotImplemented\n");
return E_NOTIMPL;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::GetAllocatorProperties(
ALLOCATOR_PROPERTIES *pprop)
{
OutputDebugStringW(L"COutputPin::GetAllocatorProperties NotImplemented\n");
return E_NOTIMPL;
}
//-------------------------------------------------------------------
// IAMStreamConfig interface
//
HRESULT
STDMETHODCALLTYPE
COutputPin::SetFormat(
AM_MEDIA_TYPE *pmt)
{
OutputDebugStringW(L"COutputPin::SetFormat NotImplemented\n");
return E_NOTIMPL;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::GetFormat(AM_MEDIA_TYPE **ppmt)
{
OutputDebugStringW(L"COutputPin::GetFormat NotImplemented\n");
return E_NOTIMPL;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::GetNumberOfCapabilities(
int *piCount,
int *piSize)
{
OutputDebugStringW(L"COutputPin::GetNumberOfCapabilities NotImplemented\n");
return E_NOTIMPL;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::GetStreamCaps(
int iIndex,
AM_MEDIA_TYPE **ppmt,
BYTE *pSCC)
{
OutputDebugStringW(L"COutputPin::GetStreamCaps NotImplemented\n");
return E_NOTIMPL;
}
//-------------------------------------------------------------------
// IMemAllocatorNotifyCallbackTemp interface
//
HRESULT
STDMETHODCALLTYPE
COutputPin::NotifyRelease()
{
OutputDebugStringW(L"COutputPin::NotifyRelease NotImplemented\n");
return E_NOTIMPL;
}
//-------------------------------------------------------------------
// IMediaSeeking interface
//
HRESULT
STDMETHODCALLTYPE
COutputPin::GetCapabilities(
DWORD *pCapabilities)
{
return m_FilterMediaSeeking->GetCapabilities(pCapabilities);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::CheckCapabilities(
DWORD *pCapabilities)
{
return m_FilterMediaSeeking->CheckCapabilities(pCapabilities);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::IsFormatSupported(
const GUID *pFormat)
{
return m_FilterMediaSeeking->IsFormatSupported(pFormat);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::QueryPreferredFormat(
GUID *pFormat)
{
return m_FilterMediaSeeking->QueryPreferredFormat(pFormat);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::GetTimeFormat(
GUID *pFormat)
{
return m_FilterMediaSeeking->GetTimeFormat(pFormat);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::IsUsingTimeFormat(
const GUID *pFormat)
{
return m_FilterMediaSeeking->IsUsingTimeFormat(pFormat);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::SetTimeFormat(
const GUID *pFormat)
{
return m_FilterMediaSeeking->SetTimeFormat(pFormat);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::GetDuration(
LONGLONG *pDuration)
{
return m_FilterMediaSeeking->GetDuration(pDuration);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::GetStopPosition(
LONGLONG *pStop)
{
return m_FilterMediaSeeking->GetStopPosition(pStop);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::GetCurrentPosition(
LONGLONG *pCurrent)
{
return m_FilterMediaSeeking->GetCurrentPosition(pCurrent);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::ConvertTimeFormat(
LONGLONG *pTarget,
const GUID *pTargetFormat,
LONGLONG Source,
const GUID *pSourceFormat)
{
return m_FilterMediaSeeking->ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::SetPositions(
LONGLONG *pCurrent,
DWORD dwCurrentFlags,
LONGLONG *pStop,
DWORD dwStopFlags)
{
return m_FilterMediaSeeking->SetPositions(pCurrent, dwCurrentFlags, pStop, dwStopFlags);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::GetPositions(
LONGLONG *pCurrent,
LONGLONG *pStop)
{
return m_FilterMediaSeeking->GetPositions(pCurrent, pStop);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::GetAvailable(
LONGLONG *pEarliest,
LONGLONG *pLatest)
{
return m_FilterMediaSeeking->GetAvailable(pEarliest, pLatest);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::SetRate(
double dRate)
{
return m_FilterMediaSeeking->SetRate(dRate);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::GetRate(
double *pdRate)
{
return m_FilterMediaSeeking->GetRate(pdRate);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::GetPreroll(
LONGLONG *pllPreroll)
{
return m_FilterMediaSeeking->GetPreroll(pllPreroll);
}
//-------------------------------------------------------------------
// IQualityControl interface
//
HRESULT
STDMETHODCALLTYPE
COutputPin::Notify(
IBaseFilter *pSelf,
Quality q)
{
OutputDebugStringW(L"COutputPin::Notify NotImplemented\n");
return E_NOTIMPL;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::SetSink(
IQualityControl *piqc)
{
OutputDebugStringW(L"COutputPin::SetSink NotImplemented\n");
return E_NOTIMPL;
}
//-------------------------------------------------------------------
// IKsAggregateControl interface
//
HRESULT
STDMETHODCALLTYPE
COutputPin::KsAddAggregate(
IN REFGUID AggregateClass)
{
OutputDebugStringW(L"COutputPin::KsAddAggregate NotImplemented\n");
return E_NOTIMPL;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsRemoveAggregate(
REFGUID AggregateClass)
{
OutputDebugStringW(L"COutputPin::KsRemoveAggregate NotImplemented\n");
return E_NOTIMPL;
}
//-------------------------------------------------------------------
// IKsPin
//
HRESULT
STDMETHODCALLTYPE
COutputPin::KsQueryMediums(
PKSMULTIPLE_ITEM* MediumList)
{
HANDLE hFilter = m_KsObjectParent->KsGetObjectHandle();
return KsGetMultiplePinFactoryItems(hFilter, m_PinId, KSPROPERTY_PIN_MEDIUMS, (PVOID*)MediumList);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsQueryInterfaces(
PKSMULTIPLE_ITEM* InterfaceList)
{
HANDLE hFilter = m_KsObjectParent->KsGetObjectHandle();
return KsGetMultiplePinFactoryItems(hFilter, m_PinId, KSPROPERTY_PIN_INTERFACES, (PVOID*)InterfaceList);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsCreateSinkPinHandle(
KSPIN_INTERFACE& Interface,
KSPIN_MEDIUM& Medium)
{
OutputDebugStringW(L"COutputPin::KsCreateSinkPinHandle NotImplemented\n");
return E_NOTIMPL;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsGetCurrentCommunication(
KSPIN_COMMUNICATION *Communication,
KSPIN_INTERFACE *Interface,
KSPIN_MEDIUM *Medium)
{
if (Communication)
{
*Communication = m_Communication;
}
if (Interface)
{
if (!m_hPin)
return VFW_E_NOT_CONNECTED;
CopyMemory(Interface, &m_Interface, sizeof(KSPIN_INTERFACE));
}
if (Medium)
{
if (!m_hPin)
return VFW_E_NOT_CONNECTED;
CopyMemory(Medium, &m_Medium, sizeof(KSPIN_MEDIUM));
}
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsPropagateAcquire()
{
OutputDebugStringW(L"COutputPin::KsPropagateAcquire NotImplemented\n");
return E_NOTIMPL;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsDeliver(
IMediaSample* Sample,
ULONG Flags)
{
return E_FAIL;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsMediaSamplesCompleted(PKSSTREAM_SEGMENT StreamSegment)
{
return NOERROR;
}
IMemAllocator *
STDMETHODCALLTYPE
COutputPin::KsPeekAllocator(KSPEEKOPERATION Operation)
{
if (Operation == KsPeekOperation_AddRef)
{
// add reference on allocator
m_MemAllocator->AddRef();
}
return m_MemAllocator;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsReceiveAllocator(IMemAllocator *MemAllocator)
{
if (MemAllocator)
{
MemAllocator->AddRef();
}
if (m_MemAllocator)
{
m_MemAllocator->Release();
}
m_MemAllocator = MemAllocator;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsRenegotiateAllocator()
{
return E_FAIL;
}
LONG
STDMETHODCALLTYPE
COutputPin::KsIncrementPendingIoCount()
{
return InterlockedIncrement((volatile LONG*)&m_IoCount);
}
LONG
STDMETHODCALLTYPE
COutputPin::KsDecrementPendingIoCount()
{
return InterlockedDecrement((volatile LONG*)&m_IoCount);
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsQualityNotify(
ULONG Proportion,
REFERENCE_TIME TimeDelta)
{
OutputDebugStringW(L"COutputPin::KsQualityNotify NotImplemented\n");
return E_NOTIMPL;
}
//-------------------------------------------------------------------
// IKsPinEx
//
VOID
STDMETHODCALLTYPE
COutputPin::KsNotifyError(
IMediaSample* Sample,
HRESULT hr)
{
OutputDebugStringW(L"COutputPin::KsNotifyError NotImplemented\n");
}
//-------------------------------------------------------------------
// IKsPinPipe
//
HRESULT
STDMETHODCALLTYPE
COutputPin::KsGetPinFramingCache(
PKSALLOCATOR_FRAMING_EX *FramingEx,
PFRAMING_PROP FramingProp,
FRAMING_CACHE_OPS Option)
{
if (Option > Framing_Cache_Write || Option < Framing_Cache_ReadLast)
{
// invalid argument
return E_INVALIDARG;
}
// get framing properties
*FramingProp = m_FramingProp[Option];
*FramingEx = m_FramingEx[Option];
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsSetPinFramingCache(
PKSALLOCATOR_FRAMING_EX FramingEx,
PFRAMING_PROP FramingProp,
FRAMING_CACHE_OPS Option)
{
ULONG Index;
ULONG RefCount = 0;
if (m_FramingEx[Option])
{
for(Index = 1; Index < 4; Index++)
{
if (m_FramingEx[Index] == m_FramingEx[Option])
RefCount++;
}
if (RefCount == 1)
{
// existing framing is only used once
CoTaskMemFree(m_FramingEx[Option]);
}
}
// store framing
m_FramingEx[Option] = FramingEx;
m_FramingProp[Option] = *FramingProp;
return S_OK;
}
IPin*
STDMETHODCALLTYPE
COutputPin::KsGetConnectedPin()
{
return m_Pin;
}
IKsAllocatorEx*
STDMETHODCALLTYPE
COutputPin::KsGetPipe(
KSPEEKOPERATION Operation)
{
if (Operation == KsPeekOperation_AddRef)
{
if (m_KsAllocatorEx)
m_KsAllocatorEx->AddRef();
}
return m_KsAllocatorEx;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsSetPipe(
IKsAllocatorEx *KsAllocator)
{
if (KsAllocator)
KsAllocator->AddRef();
if (m_KsAllocatorEx)
m_KsAllocatorEx->Release();
m_KsAllocatorEx = KsAllocator;
return NOERROR;
}
ULONG
STDMETHODCALLTYPE
COutputPin::KsGetPipeAllocatorFlag()
{
return m_PipeAllocatorFlag;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsSetPipeAllocatorFlag(
ULONG Flag)
{
m_PipeAllocatorFlag = Flag;
return NOERROR;
}
GUID
STDMETHODCALLTYPE
COutputPin::KsGetPinBusCache()
{
if (!m_bPinBusCacheInitialized)
{
CopyMemory(&m_PinBusCache, &m_Medium.Set, sizeof(GUID));
m_bPinBusCacheInitialized = TRUE;
}
return m_PinBusCache;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::KsSetPinBusCache(
GUID Bus)
{
CopyMemory(&m_PinBusCache, &Bus, sizeof(GUID));
return NOERROR;
}
PWCHAR
STDMETHODCALLTYPE
COutputPin::KsGetPinName()
{
return (PWCHAR)m_PinName;
}
PWCHAR
STDMETHODCALLTYPE
COutputPin::KsGetFilterName()
{
return m_FilterName;
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// ISpecifyPropertyPages // ISpecifyPropertyPages
// //

View file

@ -167,3 +167,6 @@ CKsNode_Constructor(
extern const GUID IID_IKsObject; extern const GUID IID_IKsObject;
extern const GUID IID_IKsPinEx; extern const GUID IID_IKsPinEx;
extern const GUID IID_IKsAggregateControl;
extern const GUID IID_IKsPinPipe;
extern const GUID IID_IKsPinFactory;