ReactOS 0.4.16-dev-250-g3ecd236
COutputPin Class Reference
Inheritance diagram for COutputPin:
Collaboration diagram for COutputPin:

Public Types

typedef std::vector< IUnknown * > ProxyPluginVector
 
- Public Types inherited from IPin
typedef struct IPin::_PinInfo PIN_INFO
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from ISpecifyPropertyPages
typedef ISpecifyPropertyPagesLPSPECIFYPROPERTYPAGES
 
typedef struct ISpecifyPropertyPages::tagCAUUID CAUUID
 
typedef struct ISpecifyPropertyPages::tagCAUUIDLPCAUUID
 

Public Member Functions

STDMETHODIMP QueryInterface (REFIID InterfaceId, PVOID *Interface)
 
 STDMETHODIMP_ (ULONG) AddRef()
 
 STDMETHODIMP_ (ULONG) Release()
 
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)
 
VOID STDMETHODCALLTYPE KsNotifyError (IMediaSample *Sample, HRESULT hr)
 
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 ()
 
HRESULT STDMETHODCALLTYPE Connect (IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
 
HRESULT STDMETHODCALLTYPE ReceiveConnection (IPin *pConnector, const AM_MEDIA_TYPE *pmt)
 
HRESULT STDMETHODCALLTYPE Disconnect ()
 
HRESULT STDMETHODCALLTYPE ConnectedTo (IPin **pPin)
 
HRESULT STDMETHODCALLTYPE ConnectionMediaType (AM_MEDIA_TYPE *pmt)
 
HRESULT STDMETHODCALLTYPE QueryPinInfo (PIN_INFO *pInfo)
 
HRESULT STDMETHODCALLTYPE QueryDirection (PIN_DIRECTION *pPinDir)
 
HRESULT STDMETHODCALLTYPE QueryId (LPWSTR *Id)
 
HRESULT STDMETHODCALLTYPE QueryAccept (const AM_MEDIA_TYPE *pmt)
 
HRESULT STDMETHODCALLTYPE EnumMediaTypes (IEnumMediaTypes **ppEnum)
 
HRESULT STDMETHODCALLTYPE QueryInternalConnections (IPin **apPin, ULONG *nPin)
 
HRESULT STDMETHODCALLTYPE EndOfStream ()
 
HRESULT STDMETHODCALLTYPE BeginFlush ()
 
HRESULT STDMETHODCALLTYPE EndFlush ()
 
HRESULT STDMETHODCALLTYPE NewSegment (REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
 
HRESULT STDMETHODCALLTYPE GetPages (CAUUID *pPages)
 
HANDLE STDMETHODCALLTYPE KsGetObjectHandle ()
 
HRESULT STDMETHODCALLTYPE Set (REFGUID guidPropSet, DWORD dwPropID, LPVOID pInstanceData, DWORD cbInstanceData, LPVOID pPropData, DWORD cbPropData)
 
HRESULT STDMETHODCALLTYPE Get (REFGUID guidPropSet, DWORD dwPropID, LPVOID pInstanceData, DWORD cbInstanceData, LPVOID pPropData, DWORD cbPropData, DWORD *pcbReturned)
 
HRESULT STDMETHODCALLTYPE QuerySupported (REFGUID guidPropSet, DWORD dwPropID, DWORD *pTypeSupport)
 
HRESULT STDMETHODCALLTYPE KsProperty (PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData, ULONG DataLength, ULONG *BytesReturned)
 
HRESULT STDMETHODCALLTYPE KsMethod (PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData, ULONG DataLength, ULONG *BytesReturned)
 
HRESULT STDMETHODCALLTYPE KsEvent (PKSEVENT Event, ULONG EventLength, LPVOID EventData, ULONG DataLength, ULONG *BytesReturned)
 
HRESULT STDMETHODCALLTYPE Render (IPin *ppinOut, IGraphBuilder *pGraph)
 
HRESULT STDMETHODCALLTYPE Backout (IPin *ppinOut, IGraphBuilder *pGraph)
 
HRESULT STDMETHODCALLTYPE KsPinFactory (ULONG *PinFactory)
 
HRESULT STDMETHODCALLTYPE KsAddAggregate (IN REFGUID AggregateClass)
 
HRESULT STDMETHODCALLTYPE KsRemoveAggregate (REFGUID AggregateClass)
 
HRESULT STDMETHODCALLTYPE Notify (IBaseFilter *pSelf, Quality q)
 
HRESULT STDMETHODCALLTYPE SetSink (IQualityControl *piqc)
 
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)
 
HRESULT STDMETHODCALLTYPE SuggestAllocatorProperties (const ALLOCATOR_PROPERTIES *pprop)
 
HRESULT STDMETHODCALLTYPE GetAllocatorProperties (ALLOCATOR_PROPERTIES *pprop)
 
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)
 
HRESULT STDMETHODCALLTYPE NotifyRelease ()
 
 COutputPin (IBaseFilter *ParentFilter, LPCWSTR PinName, ULONG PinId, KSPIN_COMMUNICATION Communication)
 
virtual ~COutputPin ()
 
HRESULT STDMETHODCALLTYPE CheckFormat (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 WINAPI IoProcessRoutine ()
 
HRESULT WINAPI InitializeIOThread ()
 
HRESULT STDMETHODCALLTYPE GetSupportedSets (LPGUID *pOutGuid, PULONG NumGuids)
 
HRESULT STDMETHODCALLTYPE LoadProxyPlugins (LPGUID pGuids, ULONG NumGuids)
 
- Public Member Functions inherited from IPin
HRESULT Connect ([in] IPin *pReceivePin, [in] const AM_MEDIA_TYPE *pmt)
 
HRESULT ReceiveConnection ([in] IPin *pConnector, [in] const AM_MEDIA_TYPE *pmt)
 
HRESULT Disconnect (void)
 
HRESULT ConnectedTo ([out] IPin **pPin)
 
HRESULT ConnectionMediaType ([out] AM_MEDIA_TYPE *pmt)
 
HRESULT QueryPinInfo ([out] PIN_INFO *pInfo)
 
HRESULT QueryDirection ([out] PIN_DIRECTION *pPinDir)
 
HRESULT QueryId ([out] LPWSTR *Id)
 
HRESULT QueryAccept ([in] const AM_MEDIA_TYPE *pmt)
 
HRESULT EnumMediaTypes ([out] IEnumMediaTypes **ppEnum)
 
HRESULT QueryInternalConnections ([out] IPin **apPin, [in, out] ULONG *nPin)
 
HRESULT EndOfStream (void)
 
HRESULT BeginFlush (void)
 
HRESULT EndFlush (void)
 
HRESULT NewSegment ([in] REFERENCE_TIME tStart, [in] REFERENCE_TIME tStop, [in] double dRate)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
HRESULT Set ([in] REFGUID guidPropSet, [in] DWORD dwPropID, [in, size_is(cbInstanceData)] LPVOID pInstanceData, [in] DWORD cbInstanceData, [in, size_is(cbPropData)] LPVOID pPropData, [in] DWORD cbPropData)
 
HRESULT Get ([in] REFGUID guidPropSet, [in] DWORD dwPropID, [in, size_is(cbInstanceData)] LPVOID pInstanceData, [in] DWORD cbInstanceData, [out, size_is(cbPropData)] LPVOID pPropData, [in] DWORD cbPropData, [out] DWORD *pcbReturned)
 
HRESULT QuerySupported ([in] REFGUID guidPropSet, [in] DWORD dwPropID, [out] DWORD *pTypeSupport)
 
HRESULT Render ([in] IPin *ppinOut, [in] IGraphBuilder *pGraph)
 
HRESULT Backout ([in] IPin *ppinOut, [in] IGraphBuilder *pGraph)
 
HRESULT GetPages ([out] CAUUID *pPages)
 
- Public Member Functions inherited from IKsControl
HRESULT KsProperty ([in] PKSPROPERTY Property, [in] ULONG PropertyLength, [in, out] void *PropertyData, [in] ULONG DataLength, [out] ULONG *BytesReturned)
 
HRESULT KsMethod ([in] PKSMETHOD Method, [in] ULONG MethodLength, [in, out] void *MethodData, [in] ULONG DataLength, [out] ULONG *BytesReturned)
 
HRESULT KsEvent ([in] PKSEVENT Event, [in] ULONG EventLength, [in, out] void *EventData, [in] ULONG DataLength, [out] ULONG *BytesReturned)
 
HRESULT Notify ([in] IBaseFilter *pSelf, [in] Quality q)
 
HRESULT SetSink ([in] IQualityControl *piqc)
 
HRESULT GetCapabilities ([out] DWORD *pCapabilities)
 
HRESULT CheckCapabilities ([in, out] DWORD *pCapabilities)
 
HRESULT IsFormatSupported ([in] const GUID *pFormat)
 
HRESULT QueryPreferredFormat ([out] GUID *pFormat)
 
HRESULT GetTimeFormat ([out] GUID *pFormat)
 
HRESULT IsUsingTimeFormat ([in] const GUID *pFormat)
 
HRESULT SetTimeFormat ([in] const GUID *pFormat)
 
HRESULT GetDuration ([out] LONGLONG *pDuration)
 
HRESULT GetStopPosition ([out] LONGLONG *pStop)
 
HRESULT GetCurrentPosition ([out] LONGLONG *pCurrent)
 
HRESULT ConvertTimeFormat ([out] LONGLONG *pTarget, [in] const GUID *pTargetFormat, [in] LONGLONG Source, [in] const GUID *pSourceFormat)
 
HRESULT SetPositions ([in, out] LONGLONG *pCurrent, [in] DWORD dwCurrentFlags, [in, out] LONGLONG *pStop, [in] DWORD dwStopFlags)
 
HRESULT GetPositions ([out] LONGLONG *pCurrent, [out] LONGLONG *pStop)
 
HRESULT GetAvailable ([out] LONGLONG *pEarliest, [out] LONGLONG *pLatest)
 
HRESULT SetRate ([in] double dRate)
 
HRESULT GetRate ([out] double *pdRate)
 
HRESULT GetPreroll ([out] LONGLONG *pllPreroll)
 
HRESULT SuggestAllocatorProperties ([in] const ALLOCATOR_PROPERTIES *pprop)
 
HRESULT GetAllocatorProperties ([out] ALLOCATOR_PROPERTIES *pprop)
 
HRESULT NotifyRelease ()
 

Protected Attributes

LONG m_Ref
 
IBaseFilterm_ParentFilter
 
LPCWSTR m_PinName
 
HANDLE m_hPin
 
ULONG m_PinId
 
IPinm_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]
 
IMemAllocatorm_MemAllocator
 
IMemInputPinm_MemInputPin
 
LONG m_IoCount
 
KSPIN_COMMUNICATION m_Communication
 
KSPIN_INTERFACE m_Interface
 
KSPIN_MEDIUM m_Medium
 
AM_MEDIA_TYPE m_MediaFormat
 
ALLOCATOR_PROPERTIES m_Properties
 
IKsInterfaceHandler * m_InterfaceHandler
 
HANDLE m_hStartEvent
 
HANDLE m_hBufferAvailable
 
HANDLE m_hStopEvent
 
BOOL m_StopInProgress
 
BOOL m_IoThreadStarted
 
KSSTATE m_State
 
CRITICAL_SECTION m_Lock
 
ProxyPluginVector m_Plugins
 

Friends

DWORD WINAPI COutputPin_IoThreadStartup (LPVOID lpParameter)
 
HRESULT STDMETHODCALLTYPE COutputPin_SetState (IPin *Pin, KSSTATE State)
 

Detailed Description

Definition at line 11 of file output_pin.cpp.

Member Typedef Documentation

◆ ProxyPluginVector

typedef std::vector<IUnknown *> COutputPin::ProxyPluginVector

Definition at line 29 of file output_pin.cpp.

Constructor & Destructor Documentation

◆ COutputPin()

COutputPin::COutputPin ( IBaseFilter ParentFilter,
LPCWSTR  PinName,
ULONG  PinId,
KSPIN_COMMUNICATION  Communication 
)

Definition at line 214 of file output_pin.cpp.

218 : m_Ref(0),
219 m_ParentFilter(ParentFilter),
220 m_PinName(PinName),
222 m_PinId(PinId),
223 m_Pin(0),
227 m_FilterName(0),
229 m_MemInputPin(0),
230 m_IoCount(0),
231 m_Communication(Communication),
233 m_hStartEvent(0),
235 m_hStopEvent(0),
239 m_Plugins()
240{
241 HRESULT hr;
242 IKsObject * KsObjectParent;
243
244 hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
245 assert(hr == S_OK);
246
250
251 hr = KsGetMediaType(0, &m_MediaFormat, KsObjectParent->KsGetObjectHandle(), m_PinId);
252
253#ifdef KSPROXY_TRACE
254 WCHAR Buffer[100];
255 swprintf(Buffer, L"COutputPin::COutputPin Format %p pbFormat %lu\n", &m_MediaFormat, m_MediaFormat.cbFormat);
257#endif
258
259 assert(hr == S_OK);
260
262
263 KsObjectParent->Release();
264};
Definition: bufpool.h:45
IKsInterfaceHandler * m_InterfaceHandler
Definition: output_pin.cpp:196
IKsAllocatorEx * m_KsAllocatorEx
Definition: output_pin.cpp:180
ULONG m_PinId
Definition: output_pin.cpp:178
BOOL m_bPinBusCacheInitialized
Definition: output_pin.cpp:182
BOOL m_StopInProgress
Definition: output_pin.cpp:201
HANDLE m_hStartEvent
Definition: output_pin.cpp:198
PKSALLOCATOR_FRAMING_EX m_FramingEx[4]
Definition: output_pin.cpp:186
HANDLE m_hPin
Definition: output_pin.cpp:177
HANDLE m_hBufferAvailable
Definition: output_pin.cpp:199
FRAMING_PROP m_FramingProp[4]
Definition: output_pin.cpp:185
ProxyPluginVector m_Plugins
Definition: output_pin.cpp:207
LPWSTR m_FilterName
Definition: output_pin.cpp:184
IPin * m_Pin
Definition: output_pin.cpp:179
BOOL m_IoThreadStarted
Definition: output_pin.cpp:202
IMemInputPin * m_MemInputPin
Definition: output_pin.cpp:189
HANDLE m_hStopEvent
Definition: output_pin.cpp:200
IMemAllocator * m_MemAllocator
Definition: output_pin.cpp:188
KSSTATE m_State
Definition: output_pin.cpp:204
CRITICAL_SECTION m_Lock
Definition: output_pin.cpp:205
LONG m_IoCount
Definition: output_pin.cpp:190
AM_MEDIA_TYPE m_MediaFormat
Definition: output_pin.cpp:194
ULONG m_PipeAllocatorFlag
Definition: output_pin.cpp:181
LPCWSTR m_PinName
Definition: output_pin.cpp:176
KSPIN_COMMUNICATION m_Communication
Definition: output_pin.cpp:191
IBaseFilter * m_ParentFilter
Definition: output_pin.cpp:175
const GUID IID_IKsObject
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define swprintf
Definition: precomp.h:40
#define assert(x)
Definition: debug.h:53
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
nsrefcnt Release()
#define S_OK
Definition: intsafe.h:52
@ KSSTATE_STOP
Definition: ks.h:1215
KSDDKAPI HRESULT WINAPI KsGetMediaType(int Position, AM_MEDIA_TYPE *AmMediaType, HANDLE FilterHandle, ULONG PinFactoryId)
Definition: ksproxy.cpp:250
#define L(x)
Definition: ntvdm.h:50
HRESULT hr
Definition: shlfolder.c:183
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define ZeroMemory
Definition: winbase.h:1737
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ ~COutputPin()

COutputPin::~COutputPin ( )
virtual

Definition at line 210 of file output_pin.cpp.

211{
212}

Member Function Documentation

◆ Backout()

HRESULT STDMETHODCALLTYPE COutputPin::Backout ( IPin ppinOut,
IGraphBuilder pGraph 
)

Implements IStreamBuilder.

Definition at line 1320 of file output_pin.cpp.

1323{
1324#ifdef KSPROXY_TRACE
1325 OutputDebugStringW(L"COutputPin::Backout\n");
1326#endif
1327
1328 return S_OK;
1329}

◆ BeginFlush()

HRESULT STDMETHODCALLTYPE COutputPin::BeginFlush ( void  )

Implements IPin.

Definition at line 1894 of file output_pin.cpp.

1895{
1896 /* should be called only on input pins */
1897 return E_UNEXPECTED;
1898}
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ CheckCapabilities()

HRESULT STDMETHODCALLTYPE COutputPin::CheckCapabilities ( DWORD pCapabilities)

Implements IMediaSeeking.

Definition at line 545 of file output_pin.cpp.

547{
548 IMediaSeeking * FilterMediaSeeking;
549 HRESULT hr;
550
551 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
552 if (FAILED(hr))
553 return hr;
554
555 hr = FilterMediaSeeking->CheckCapabilities(pCapabilities);
556
557 FilterMediaSeeking->Release();
558 return hr;
559}
#define FAILED(hr)
Definition: intsafe.h:51

◆ CheckFormat()

HRESULT STDMETHODCALLTYPE COutputPin::CheckFormat ( const AM_MEDIA_TYPE pmt)

Definition at line 1922 of file output_pin.cpp.

1924{
1925 PKSMULTIPLE_ITEM MultipleItem;
1927 HRESULT hr;
1928 IKsObject * KsObjectParent;
1929 HANDLE hFilter;
1930
1931 if (!pmt)
1932 return E_POINTER;
1933
1934 // get IKsObject interface
1935 hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
1936 if (FAILED(hr))
1937 return hr;
1938
1939 // get parent filter handle
1940 hFilter = KsObjectParent->KsGetObjectHandle();
1941
1942 // release IKsObject
1943 KsObjectParent->Release();
1944
1945 if (!hFilter)
1946 return E_HANDLE;
1947
1948
1950 if (FAILED(hr))
1951 return S_FALSE;
1952
1953 DataFormat = (PKSDATAFORMAT)(MultipleItem + 1);
1954 for(ULONG Index = 0; Index < MultipleItem->Count; Index++)
1955 {
1956 if (IsEqualGUID(pmt->majortype, DataFormat->MajorFormat) &&
1957 IsEqualGUID(pmt->subtype, DataFormat->SubFormat) &&
1958 IsEqualGUID(pmt->formattype, DataFormat->Specifier))
1959 {
1960 // format is supported
1961 CoTaskMemFree(MultipleItem);
1962 return S_OK;
1963 }
1965 }
1966 //format is not supported
1967 CoTaskMemFree(MultipleItem);
1968 return S_FALSE;
1969}
KSDATAFORMAT * PKSDATAFORMAT
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
@ KSPROPERTY_PIN_DATARANGES
Definition: ks.h:628
KSDDKAPI HRESULT WINAPI KsGetMultiplePinFactoryItems(HANDLE FilterHandle, ULONG PinFactoryId, ULONG PropertyId, PVOID *Items)
Definition: ksproxy.cpp:154
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
ULONG Count
Definition: ks.h:1980
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index
#define S_FALSE
Definition: winerror.h:2357
#define E_HANDLE
Definition: winerror.h:2850
#define E_POINTER
Definition: winerror.h:2365

◆ Connect()

HRESULT STDMETHODCALLTYPE COutputPin::Connect ( IPin pReceivePin,
const AM_MEDIA_TYPE pmt 
)

Definition at line 1524 of file output_pin.cpp.

1525{
1526 HRESULT hr;
1527 ALLOCATOR_PROPERTIES Properties;
1528 IMemAllocatorCallbackTemp *pMemCallback;
1529 LPGUID pGuid;
1530 ULONG NumGuids = 0;
1531
1532#ifdef KSPROXY_TRACE
1533 WCHAR Buffer[200];
1534 OutputDebugStringW(L"COutputPin::Connect called\n");
1535#endif
1536
1537 if (pmt)
1538 {
1539 hr = pReceivePin->QueryAccept(pmt);
1540 if (FAILED(hr))
1541 return hr;
1542 }
1543 else
1544 {
1545 // query accept
1546 hr = pReceivePin->QueryAccept(&m_MediaFormat);
1547 if (FAILED(hr))
1548 return hr;
1549
1550 pmt = &m_MediaFormat;
1551 }
1552
1554 {
1555 hr = CreatePin(pmt);
1556 if (FAILED(hr))
1557 {
1558#ifdef KSPROXY_TRACE
1559 swprintf(Buffer, L"COutputPin::Connect CreatePin handle failed with %lx\n", hr);
1561#endif
1562 return hr;
1563 }
1564 }
1565
1566
1567 // query for IMemInput interface
1568 hr = pReceivePin->QueryInterface(IID_IMemInputPin, (void**)&m_MemInputPin);
1569 if (FAILED(hr))
1570 {
1571#ifdef KSPROXY_TRACE
1572 OutputDebugStringW(L"COutputPin::Connect no IMemInputPin interface\n");
1573#endif
1574
1575 return hr;
1576 }
1577
1578 // get input pin allocator properties
1579 ZeroMemory(&Properties, sizeof(ALLOCATOR_PROPERTIES));
1581
1582 //FIXME determine allocator properties
1583 Properties.cBuffers = 32;
1584 Properties.cbBuffer = 2048 * 188; //2048 frames * MPEG2 TS Payload size
1585 Properties.cbAlign = 4;
1586
1587 // get input pin allocator
1588#if 0
1590 if (SUCCEEDED(hr))
1591 {
1592 // set allocator properties
1593 hr = m_MemAllocator->SetProperties(&Properties, &m_Properties);
1594 if (FAILED(hr))
1596 }
1597#endif
1598
1599 if (1)
1600 {
1601 hr = CKsAllocator_Constructor(NULL, IID_IMemAllocator, (void**)&m_MemAllocator);
1602 if (FAILED(hr))
1603 return hr;
1604
1605 // set allocator properties
1606 hr = m_MemAllocator->SetProperties(&Properties, &m_Properties);
1607 if (FAILED(hr))
1608 {
1609#ifdef KSPROXY_TRACE
1610 swprintf(Buffer, L"COutputPin::Connect IMemAllocator::SetProperties failed with hr %lx\n", hr);
1612#endif
1615 return hr;
1616 }
1617 }
1618
1619 // commit property changes
1621 if (FAILED(hr))
1622 {
1623#ifdef KSPROXY_TRACE
1624 swprintf(Buffer, L"COutputPin::Connect IMemAllocator::Commit failed with hr %lx\n", hr);
1626#endif
1629 return hr;
1630 }
1631
1632 // get callback interface
1633 hr = m_MemAllocator->QueryInterface(IID_IMemAllocatorCallbackTemp, (void**)&pMemCallback);
1634 if (FAILED(hr))
1635 {
1636#ifdef KSPROXY_TRACE
1637 swprintf(Buffer, L"COutputPin::Connect No IMemAllocatorCallbackTemp interface hr %lx\n", hr);
1639#endif
1642 return hr;
1643 }
1644
1645 // set notification routine
1646 hr = pMemCallback->SetNotify((IMemAllocatorNotifyCallbackTemp*)this);
1647
1648 // release IMemAllocatorNotifyCallbackTemp interface
1649 pMemCallback->Release();
1650
1651 if (FAILED(hr))
1652 {
1653#ifdef KSPROXY_TRACE
1654 swprintf(Buffer, L"COutputPin::Connect IMemAllocatorNotifyCallbackTemp::SetNotify failed hr %lx\n", hr);
1656#endif
1659 return hr;
1660 }
1661
1662 // now set allocator
1664 if (FAILED(hr))
1665 {
1666#ifdef KSPROXY_TRACE
1667 swprintf(Buffer, L"COutputPin::Connect IMemInputPin::NotifyAllocator failed with hr %lx\n", hr);
1669#endif
1672 return hr;
1673 }
1674
1675
1677
1678 // get all supported sets
1679 if (m_Plugins.empty())
1680 {
1681 if (GetSupportedSets(&pGuid, &NumGuids))
1682 {
1683 // load all proxy plugins
1684 if (FAILED(LoadProxyPlugins(pGuid, NumGuids)))
1685 {
1686#ifdef KSPROXY_TRACE
1687 OutputDebugStringW(L"COutputPin::Connect LoadProxyPlugins failed\n");
1688#endif
1689 }
1690 // free sets
1691 CoTaskMemFree(pGuid);
1692 }
1693 }
1694
1695 // receive connection;
1696 hr = pReceivePin->ReceiveConnection((IPin*)this, pmt);
1697 if (SUCCEEDED(hr))
1698 {
1699 // increment reference count
1700 pReceivePin->AddRef();
1701 m_Pin = pReceivePin;
1702#ifdef KSPROXY_TRACE
1703 OutputDebugStringW(L"COutputPin::Connect success\n");
1704#endif
1705 }
1706 else
1707 {
1710 }
1711
1712 return hr;
1713}
HRESULT WINAPI CKsAllocator_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
Definition: allocator.cpp:603
HRESULT STDMETHODCALLTYPE CreatePin(const AM_MEDIA_TYPE *pmt)
ALLOCATOR_PROPERTIES m_Properties
Definition: output_pin.cpp:195
HRESULT STDMETHODCALLTYPE LoadProxyPlugins(LPGUID pGuids, ULONG NumGuids)
HRESULT STDMETHODCALLTYPE GetSupportedSets(LPGUID *pOutGuid, PULONG NumGuids)
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
HRESULT SetProperties([in] ALLOCATOR_PROPERTIES *pRequest, [out] ALLOCATOR_PROPERTIES *pActual)
HRESULT Commit(void)
HRESULT NotifyAllocator([in] IMemAllocator *pAllocator, [in] BOOL bReadOnly)
HRESULT GetAllocator([out] IMemAllocator **ppAllocator)
HRESULT GetAllocatorRequirements([out] ALLOCATOR_PROPERTIES *pProps)
Definition: axcore.idl:92
HRESULT ReceiveConnection([in] IPin *pConnector, [in] const AM_MEDIA_TYPE *pmt)
HRESULT QueryAccept([in] const AM_MEDIA_TYPE *pmt)
ULONG AddRef()
ULONG Release()
#define SUCCEEDED(hr)
Definition: intsafe.h:50

◆ ConnectedTo()

HRESULT STDMETHODCALLTYPE COutputPin::ConnectedTo ( IPin **  pPin)

Implements IPin.

Definition at line 1753 of file output_pin.cpp.

1754{
1755#ifdef KSPROXY_TRACE
1756 OutputDebugStringW(L"COutputPin::ConnectedTo\n");
1757#endif
1758
1759 if (!pPin)
1760 return E_POINTER;
1761
1762 if (m_Pin)
1763 {
1764 // increment reference count
1765 m_Pin->AddRef();
1766 *pPin = m_Pin;
1767 return S_OK;
1768 }
1769
1770 *pPin = NULL;
1771 return VFW_E_NOT_CONNECTED;
1772}
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48

◆ ConnectionMediaType()

HRESULT STDMETHODCALLTYPE COutputPin::ConnectionMediaType ( AM_MEDIA_TYPE pmt)

Definition at line 1775 of file output_pin.cpp.

1776{
1777#ifdef KSPROXY_TRACE
1778 OutputDebugStringW(L"COutputPin::ConnectionMediaType called\n");
1779#endif
1780
1781 return E_NOTIMPL;
1782}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ConvertTimeFormat()

HRESULT STDMETHODCALLTYPE COutputPin::ConvertTimeFormat ( LONGLONG pTarget,
const GUID pTargetFormat,
LONGLONG  Source,
const GUID pSourceFormat 
)

Implements IMediaSeeking.

Definition at line 708 of file output_pin.cpp.

713{
714 IMediaSeeking * FilterMediaSeeking;
715 HRESULT hr;
716
717 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
718 if (FAILED(hr))
719 return hr;
720
721 hr = FilterMediaSeeking->ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat);
722
723 FilterMediaSeeking->Release();
724 return hr;
725}
FxIoTarget * pTarget
Definition: fxdeviceapi.cpp:97
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169

◆ CreatePin()

HRESULT STDMETHODCALLTYPE COutputPin::CreatePin ( const AM_MEDIA_TYPE pmt)

Definition at line 1973 of file output_pin.cpp.

1975{
1976 PKSMULTIPLE_ITEM MediumList;
1978 PKSPIN_MEDIUM Medium;
1980 IKsInterfaceHandler * InterfaceHandler;
1981 HRESULT hr;
1982
1983 // query for pin medium
1984 hr = KsQueryMediums(&MediumList);
1985 if (FAILED(hr))
1986 {
1987#ifdef KSPROXY_TRACE
1988 WCHAR Buffer[100];
1989 swprintf(Buffer, L"COutputPin::CreatePin KsQueryMediums failed %lx\n", hr);
1991#endif
1992 return hr;
1993 }
1994
1995 // query for pin interface
1997 if (FAILED(hr))
1998 {
1999 // failed
2000#ifdef KSPROXY_TRACE
2001 WCHAR Buffer[100];
2002 swprintf(Buffer, L"COutputPin::CreatePin KsQueryInterfaces failed %lx\n", hr);
2004#endif
2005
2006 CoTaskMemFree(MediumList);
2007 return hr;
2008 }
2009
2010 if (MediumList->Count)
2011 {
2012 //use first available medium
2013 Medium = (PKSPIN_MEDIUM)(MediumList + 1);
2014 }
2015 else
2016 {
2017 // default to standard medium
2018 Medium = &StandardPinMedium;
2019 }
2020
2021 if (InterfaceList->Count)
2022 {
2023 //use first available interface
2025 }
2026 else
2027 {
2028 // default to standard interface
2030 }
2031
2033 {
2034 // now create pin
2035 hr = CreatePinHandle(Medium, Interface, pmt);
2036 if (FAILED(hr))
2037 {
2038#ifdef KSPROXY_TRACE
2039 WCHAR Buffer[100];
2040 swprintf(Buffer, L"COutputPin::CreatePinHandle failed with %lx\n", hr);
2042#endif
2043 return hr;
2044 }
2045
2046 if (!m_InterfaceHandler)
2047 {
2048 // now load the IKsInterfaceHandler plugin
2049 hr = CoCreateInstance(Interface->Set, NULL, CLSCTX_INPROC_SERVER, IID_IKsInterfaceHandler, (void**)&InterfaceHandler);
2050 if (FAILED(hr))
2051 {
2052 // failed to load interface handler plugin
2053 CoTaskMemFree(MediumList);
2055
2056#ifdef KSPROXY_TRACE
2057 WCHAR Buffer[100];
2058 swprintf(Buffer, L"COutputPin::CreatePin failed to create interface handler %lx\n", hr);
2060#endif
2061
2062 return hr;
2063 }
2064
2065 // now set the pin
2066 hr = InterfaceHandler->KsSetPin((IKsPin*)this);
2067 if (FAILED(hr))
2068 {
2069 // failed to initialize interface handler plugin
2070#ifdef KSPROXY_TRACE
2071 WCHAR Buffer[100];
2072 swprintf(Buffer, L"COutputPin::CreatePin failed to initialize interface handler %lx\n", hr);
2074#endif
2075 InterfaceHandler->Release();
2076 CoTaskMemFree(MediumList);
2078 return hr;
2079 }
2080
2081 // store interface handler
2082 m_InterfaceHandler = InterfaceHandler;
2083 }
2084 }
2085 else
2086 {
2087#ifdef KSPROXY_TRACE
2088 WCHAR Buffer[100];
2089 swprintf(Buffer, L"COutputPin::CreatePin unexpected communication %u %s\n", m_Communication, m_PinName);
2091#endif
2092
2093 hr = E_FAIL;
2094 }
2095
2096 // free medium / interface / dataformat
2097 CoTaskMemFree(MediumList);
2099
2100#ifdef KSPROXY_TRACE
2101 WCHAR Buffer[100];
2102 swprintf(Buffer, L"COutputPin::CreatePin Result %lx\n", hr);
2104#endif
2105
2106 return hr;
2107}
HRESULT STDMETHODCALLTYPE KsQueryMediums(PKSMULTIPLE_ITEM *MediumList)
Definition: output_pin.cpp:899
HRESULT STDMETHODCALLTYPE KsQueryInterfaces(PKSMULTIPLE_ITEM *InterfaceList)
Definition: output_pin.cpp:924
HRESULT STDMETHODCALLTYPE CreatePinHandle(PKSPIN_MEDIUM Medium, PKSPIN_INTERFACE Interface, const AM_MEDIA_TYPE *pmt)
#define E_FAIL
Definition: ddrawi.h:102
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
KSPIN_MEDIUM StandardPinMedium
Definition: input_pin.cpp:21
KSPIN_INTERFACE StandardPinInterface
Definition: input_pin.cpp:14
@ KSPIN_COMMUNICATION_BRIDGE
Definition: ks.h:1258
@ KSPIN_COMMUNICATION_NONE
Definition: ks.h:1254
KSIDENTIFIER * PKSPIN_INTERFACE
Definition: ks.h:243
KSIDENTIFIER * PKSPIN_MEDIUM
Definition: ks.h:244
_In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceList
Definition: usbdlib.h:181
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465

Referenced by Connect(), and QueryInterface().

◆ CreatePinHandle()

HRESULT STDMETHODCALLTYPE COutputPin::CreatePinHandle ( PKSPIN_MEDIUM  Medium,
PKSPIN_INTERFACE  Interface,
const AM_MEDIA_TYPE pmt 
)

Definition at line 2111 of file output_pin.cpp.

2115{
2116 PKSPIN_CONNECT PinConnect;
2118 ULONG Length;
2119 HRESULT hr;
2120 HANDLE hFilter;
2121 IKsObject * KsObjectParent;
2122
2123 //KSALLOCATOR_FRAMING Framing;
2124 //KSPROPERTY Property;
2125 //ULONG BytesReturned;
2126
2127 OutputDebugStringW(L"COutputPin::CreatePinHandle\n");
2128
2130 {
2131 // pin already exists
2132 //CloseHandle(m_hPin);
2133 //m_hPin = INVALID_HANDLE_VALUE;
2134 OutputDebugStringW(L"COutputPin::CreatePinHandle pin already exists\n");
2135 return S_OK;
2136 }
2137
2138
2139 // calc format size
2140 Length = sizeof(KSPIN_CONNECT) + sizeof(KSDATAFORMAT) + pmt->cbFormat;
2141
2142 // allocate pin connect
2143 PinConnect = (PKSPIN_CONNECT)CoTaskMemAlloc(Length);
2144 if (!PinConnect)
2145 {
2146 // failed
2147 OutputDebugStringW(L"COutputPin::CreatePinHandle out of memory\n");
2148 return E_OUTOFMEMORY;
2149 }
2150 OutputDebugStringW(L"COutputPin::CreatePinHandle copy pinconnect\n");
2151 // setup request
2152 CopyMemory(&PinConnect->Interface, Interface, sizeof(KSPIN_INTERFACE));
2153 CopyMemory(&PinConnect->Medium, Medium, sizeof(KSPIN_MEDIUM));
2154 PinConnect->PinId = m_PinId;
2155 PinConnect->PinToHandle = NULL;
2158
2159 // get dataformat offset
2160 DataFormat = (PKSDATAFORMAT)(PinConnect + 1);
2161 OutputDebugStringW(L"COutputPin::CreatePinHandle copy format\n");
2162 // copy data format
2163 DataFormat->FormatSize = sizeof(KSDATAFORMAT) + pmt->cbFormat;
2164 DataFormat->Flags = 0;
2165 DataFormat->SampleSize = pmt->lSampleSize;
2166 DataFormat->Reserved = 0;
2167 CopyMemory(&DataFormat->MajorFormat, &pmt->majortype, sizeof(GUID));
2168 CopyMemory(&DataFormat->SubFormat, &pmt->subtype, sizeof(GUID));
2169 CopyMemory(&DataFormat->Specifier, &pmt->formattype, sizeof(GUID));
2170
2171 if (pmt->cbFormat)
2172 {
2173 // copy extended format
2174 WCHAR Buffer[100];
2175 swprintf(Buffer, L"COutputPin::CreatePinHandle copy format %p pbFormat %lu\n", pmt, pmt->cbFormat);
2177 CopyMemory((DataFormat + 1), pmt->pbFormat, pmt->cbFormat);
2178 }
2179
2180 // get IKsObject interface
2181 hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
2182 if (FAILED(hr))
2183 {
2184 OutputDebugStringW(L"COutputPin::CreatePinHandle no IID_IKsObject interface\n");
2185 return hr;
2186 }
2187
2188 // get parent filter handle
2189 hFilter = KsObjectParent->KsGetObjectHandle();
2190
2191 // release IKsObject
2192 KsObjectParent->Release();
2193
2194 if (!hFilter)
2195 {
2196 OutputDebugStringW(L"COutputPin::CreatePinHandle no filter handle\n");
2197 return E_HANDLE;
2198 }
2199
2200 OutputDebugStringW(L"COutputPin::CreatePinHandle before creating pin\n");
2201 // create pin
2202 DWORD dwError = KsCreatePin(hFilter, PinConnect, GENERIC_READ, &m_hPin);
2203
2204 if (dwError == ERROR_SUCCESS)
2205 {
2206 OutputDebugStringW(L"COutputPin::CreatePinHandle created pin\n");
2207
2208 // store current interface / medium
2209 CopyMemory(&m_Medium, Medium, sizeof(KSPIN_MEDIUM));
2211 CopyMemory(&m_MediaFormat, pmt, sizeof(AM_MEDIA_TYPE));
2212
2213#ifdef KSPROXY_TRACE
2214 LPOLESTR pMajor, pSub, pFormat;
2215 StringFromIID(m_MediaFormat.majortype, &pMajor);
2216 StringFromIID(m_MediaFormat.subtype , &pSub);
2217 StringFromIID(m_MediaFormat.formattype, &pFormat);
2218 WCHAR Buffer[200];
2219 swprintf(Buffer, L"COutputPin::CreatePinHandle Major %s SubType %s Format %s pbFormat %p cbFormat %u\n", pMajor, pSub, pFormat, pmt->pbFormat, pmt->cbFormat);
2220 CoTaskMemFree(pMajor);
2221 CoTaskMemFree(pSub);
2222 CoTaskMemFree(pFormat);
2224#endif
2225
2226 if (pmt->cbFormat)
2227 {
2228 m_MediaFormat.pbFormat = (BYTE*)CoTaskMemAlloc(pmt->cbFormat);
2229 if (!m_MediaFormat.pbFormat)
2230 {
2231 CoTaskMemFree(PinConnect);
2232 m_MediaFormat.pbFormat = NULL;
2233 m_MediaFormat.cbFormat = 0;
2234 return E_OUTOFMEMORY;
2235 }
2236 CopyMemory(m_MediaFormat.pbFormat, pmt->pbFormat, pmt->cbFormat);
2237 }
2238#if 0
2242
2243 ZeroMemory(&Framing, sizeof(KSALLOCATOR_FRAMING));
2244 hr = KsProperty(&Property, sizeof(KSPROPERTY), (PVOID)&Framing, sizeof(KSALLOCATOR_FRAMING), &BytesReturned);
2245 if (SUCCEEDED(hr))
2246 {
2247 m_Properties.cbAlign = (Framing.FileAlignment + 1);
2248 m_Properties.cbBuffer = Framing.FrameSize;
2249 m_Properties.cbPrefix = 0; //FIXME
2250 m_Properties.cBuffers = Framing.Frames;
2251 }
2252 hr = S_OK;
2253#endif
2254
2256 {
2257 OutputDebugStringW(L"COutputPin::CreatePinHandle failed to initialize i/o thread\n");
2258 }
2259
2260 //TODO
2261 // connect pin pipes
2262
2263 }
2264 else
2265 OutputDebugStringW(L"COutputPin::CreatePinHandle failed to create pin\n");
2266 // free pin connect
2267 CoTaskMemFree(PinConnect);
2268
2269 return hr;
2270}
HRESULT STDMETHODCALLTYPE KsProperty(PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData, ULONG DataLength, ULONG *BytesReturned)
KSPIN_INTERFACE m_Interface
Definition: output_pin.cpp:192
KSPIN_MEDIUM m_Medium
Definition: output_pin.cpp:193
HRESULT WINAPI InitializeIOThread()
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define ERROR_SUCCESS
Definition: deptool.c:10
#define GENERIC_READ
Definition: compat.h:135
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
unsigned long DWORD
Definition: ntddk_ex.h:95
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define KSPRIORITY_NORMAL
Definition: ks.h:1386
@ KSPROPERTY_CONNECTION_ALLOCATORFRAMING
Definition: ks.h:352
struct KSPIN_CONNECT * PKSPIN_CONNECT
#define KSPROPSETID_Connection
Definition: ks.h:346
KSDDKAPI DWORD NTAPI KsCreatePin(HANDLE FilterHandle, PKSPIN_CONNECT Connect, ACCESS_MASK DesiredAccess, PHANDLE ConnectionHandle)
Definition: ksuser.c:192
static LPOLESTR
Definition: stg_prop.c:27
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_Check_return_ HRESULT WINAPI StringFromIID(_In_ REFIID rclsid, _Outptr_ LPOLESTR *lplpsz)
ULONG PinId
Definition: ks.h:2603
KSPIN_MEDIUM Medium
Definition: ks.h:2602
KSPRIORITY Priority
Definition: ks.h:2605
KSPIN_INTERFACE Interface
Definition: ks.h:2601
HANDLE PinToHandle
Definition: ks.h:2604
ULONG PriorityClass
Definition: ks.h:1391
ULONG PrioritySubClass
Definition: ks.h:1392
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesReturned
Definition: wdfiotarget.h:1052
#define CopyMemory
Definition: winbase.h:1735
unsigned char BYTE
Definition: xxhash.c:193

Referenced by CreatePin().

◆ Disconnect()

HRESULT STDMETHODCALLTYPE COutputPin::Disconnect ( void  )

Implements IPin.

Definition at line 1723 of file output_pin.cpp.

1724{
1725#ifdef KSPROXY_TRACE
1726 OutputDebugStringW(L"COutputPin::Disconnect\n");
1727#endif
1728
1729 if (!m_Pin)
1730 {
1731 // pin was not connected
1732 return S_FALSE;
1733 }
1734
1735 //FIXME
1736 //check if filter is active
1737
1738 m_Pin->Release();
1739 m_Pin = NULL;
1742
1745
1746#ifdef KSPROXY_TRACE
1747 OutputDebugStringW(L"COutputPin::Disconnect\n");
1748#endif
1749 return S_OK;
1750}
#define CloseHandle
Definition: compat.h:739

◆ EndFlush()

HRESULT STDMETHODCALLTYPE COutputPin::EndFlush ( void  )

Implements IPin.

Definition at line 1901 of file output_pin.cpp.

1902{
1903 /* should be called only on input pins */
1904 return E_UNEXPECTED;
1905}

◆ EndOfStream()

HRESULT STDMETHODCALLTYPE COutputPin::EndOfStream ( void  )

Implements IPin.

Definition at line 1887 of file output_pin.cpp.

1888{
1889 /* should be called only on input pins */
1890 return E_UNEXPECTED;
1891}

◆ EnumMediaTypes()

HRESULT STDMETHODCALLTYPE COutputPin::EnumMediaTypes ( IEnumMediaTypes **  ppEnum)

Implements IPin.

Definition at line 1829 of file output_pin.cpp.

1830{
1831 HRESULT hr;
1832 ULONG MediaTypeCount = 0, Index;
1833 AM_MEDIA_TYPE * MediaTypes;
1834 HANDLE hFilter;
1835 IKsObject * KsObjectParent;
1836
1837 hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
1838 if (FAILED(hr))
1839 return hr;
1840
1841 // get parent filter handle
1842 hFilter = KsObjectParent->KsGetObjectHandle();
1843
1844 // release IKsObject
1845 KsObjectParent->Release();
1846
1847 // query media type count
1848 hr = KsGetMediaTypeCount(hFilter, m_PinId, &MediaTypeCount);
1849 if (FAILED(hr) || !MediaTypeCount)
1850 {
1851 return hr;
1852 }
1853
1854 // allocate media types
1855 MediaTypes = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE) * MediaTypeCount);
1856 if (!MediaTypes)
1857 {
1858 // not enough memory
1859 return E_OUTOFMEMORY;
1860 }
1861
1862 // zero media types
1863 ZeroMemory(MediaTypes, sizeof(AM_MEDIA_TYPE) * MediaTypeCount);
1864
1865 for(Index = 0; Index < MediaTypeCount; Index++)
1866 {
1867 // get media type
1868 hr = KsGetMediaType(Index, &MediaTypes[Index], hFilter, m_PinId);
1869 if (FAILED(hr))
1870 {
1871 // failed
1872 CoTaskMemFree(MediaTypes);
1873 return hr;
1874 }
1875 }
1876
1877 return CEnumMediaTypes_fnConstructor(MediaTypeCount, MediaTypes, IID_IEnumMediaTypes, (void**)ppEnum);
1878}
HRESULT WINAPI CEnumMediaTypes_fnConstructor(ULONG MediaTypeCount, AM_MEDIA_TYPE *MediaTypes, REFIID riid, LPVOID *ppv)
KSDDKAPI HRESULT WINAPI KsGetMediaTypeCount(HANDLE FilterHandle, ULONG PinFactoryId, ULONG *MediaTypeCount)
Definition: ksproxy.cpp:216

◆ Get()

HRESULT STDMETHODCALLTYPE COutputPin::Get ( REFGUID  guidPropSet,
DWORD  dwPropID,
LPVOID  pInstanceData,
DWORD  cbInstanceData,
LPVOID  pPropData,
DWORD  cbPropData,
DWORD pcbReturned 
)

Implements IKsPropertySet.

Definition at line 1457 of file output_pin.cpp.

1465{
1467
1468 if (cbInstanceData)
1469 {
1470 PKSPROPERTY Property = (PKSPROPERTY)CoTaskMemAlloc(sizeof(KSPROPERTY) + cbInstanceData);
1471 if (!Property)
1472 return E_OUTOFMEMORY;
1473
1474 Property->Set = guidPropSet;
1475 Property->Id = dwPropID;
1477
1478 CopyMemory((Property+1), pInstanceData, cbInstanceData);
1479
1480 HRESULT hr = KsProperty(Property, sizeof(KSPROPERTY) + cbInstanceData, pPropData, cbPropData, &BytesReturned);
1482 return hr;
1483 }
1484 else
1485 {
1487
1488 Property.Set = guidPropSet;
1489 Property.Id = dwPropID;
1491
1492 HRESULT hr = KsProperty(&Property, sizeof(KSPROPERTY), pPropData, cbPropData, &BytesReturned);
1493 return hr;
1494 }
1495}
struct KSIDENTIFIER * PKSPROPERTY

◆ GetAllocatorProperties()

HRESULT STDMETHODCALLTYPE COutputPin::GetAllocatorProperties ( ALLOCATOR_PROPERTIES pprop)

Implements IAMBufferNegotiation.

Definition at line 433 of file output_pin.cpp.

435{
436#ifdef KSPROXY_TRACE
437 OutputDebugStringW(L"COutputPin::GetAllocatorProperties\n");
438#endif
439
440 if (!m_Pin)
441 {
442 // you should call this method AFTER you connected
443 return E_UNEXPECTED;
444 }
445
446 if (!m_KsAllocatorEx)
447 {
448 // something went wrong while creating the allocator
449 return E_FAIL;
450 }
451
453 return NOERROR;
454}
#define NOERROR
Definition: winerror.h:2354

◆ GetAvailable()

HRESULT STDMETHODCALLTYPE COutputPin::GetAvailable ( LONGLONG pEarliest,
LONGLONG pLatest 
)

Implements IMediaSeeking.

Definition at line 769 of file output_pin.cpp.

772{
773 IMediaSeeking * FilterMediaSeeking;
774 HRESULT hr;
775
776 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
777 if (FAILED(hr))
778 return hr;
779
780 hr = FilterMediaSeeking->GetAvailable(pEarliest, pLatest);
781
782 FilterMediaSeeking->Release();
783 return hr;
784}

◆ GetCapabilities()

HRESULT STDMETHODCALLTYPE COutputPin::GetCapabilities ( DWORD pCapabilities)

Implements IMediaSeeking.

Definition at line 527 of file output_pin.cpp.

529{
530 IMediaSeeking * FilterMediaSeeking;
531 HRESULT hr;
532
533 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
534 if (FAILED(hr))
535 return hr;
536
537 hr = FilterMediaSeeking->GetCapabilities(pCapabilities);
538
539 FilterMediaSeeking->Release();
540 return hr;
541}

◆ GetCurrentPosition()

HRESULT STDMETHODCALLTYPE COutputPin::GetCurrentPosition ( LONGLONG pCurrent)

Implements IMediaSeeking.

Definition at line 690 of file output_pin.cpp.

692{
693 IMediaSeeking * FilterMediaSeeking;
694 HRESULT hr;
695
696 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
697 if (FAILED(hr))
698 return hr;
699
700 hr = FilterMediaSeeking->GetCurrentPosition(pCurrent);
701
702 FilterMediaSeeking->Release();
703 return hr;
704}

◆ GetDuration()

HRESULT STDMETHODCALLTYPE COutputPin::GetDuration ( LONGLONG pDuration)

Implements IMediaSeeking.

Definition at line 653 of file output_pin.cpp.

655{
656 IMediaSeeking * FilterMediaSeeking;
657 HRESULT hr;
658
659 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
660 if (FAILED(hr))
661 return hr;
662
663 hr = FilterMediaSeeking->GetDuration(pDuration);
664
665 FilterMediaSeeking->Release();
666 return hr;
667}

◆ GetFormat()

HRESULT STDMETHODCALLTYPE COutputPin::GetFormat ( AM_MEDIA_TYPE **  ppmt)

Definition at line 472 of file output_pin.cpp.

473{
474#ifdef KSPROXY_TRACE
475 OutputDebugStringW(L"COutputPin::GetFormat NotImplemented\n");
476#endif
477 return E_NOTIMPL;
478}

◆ GetNumberOfCapabilities()

HRESULT STDMETHODCALLTYPE COutputPin::GetNumberOfCapabilities ( int piCount,
int piSize 
)

Definition at line 482 of file output_pin.cpp.

485{
486#ifdef KSPROXY_TRACE
487 OutputDebugStringW(L"COutputPin::GetNumberOfCapabilities NotImplemented\n");
488#endif
489 return E_NOTIMPL;
490}

◆ GetPages()

HRESULT STDMETHODCALLTYPE COutputPin::GetPages ( CAUUID pPages)

Implements ISpecifyPropertyPages.

Definition at line 1269 of file output_pin.cpp.

1270{
1271#ifdef KSPROXY_TRACE
1272 OutputDebugStringW(L"COutputPin::GetPages NotImplemented\n");
1273#endif
1274
1275 if (!pPages)
1276 return E_POINTER;
1277
1278 pPages->cElems = 0;
1279 pPages->pElems = NULL;
1280
1281 return S_OK;
1282}

◆ GetPositions()

HRESULT STDMETHODCALLTYPE COutputPin::GetPositions ( LONGLONG pCurrent,
LONGLONG pStop 
)

Implements IMediaSeeking.

Definition at line 750 of file output_pin.cpp.

753{
754 IMediaSeeking * FilterMediaSeeking;
755 HRESULT hr;
756
757 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
758 if (FAILED(hr))
759 return hr;
760
761 hr = FilterMediaSeeking->GetPositions(pCurrent, pStop);
762
763 FilterMediaSeeking->Release();
764 return hr;
765}

◆ GetPreroll()

HRESULT STDMETHODCALLTYPE COutputPin::GetPreroll ( LONGLONG pllPreroll)

Implements IMediaSeeking.

Definition at line 824 of file output_pin.cpp.

826{
827 IMediaSeeking * FilterMediaSeeking;
828 HRESULT hr;
829
830 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
831 if (FAILED(hr))
832 return hr;
833
834 hr = FilterMediaSeeking->GetPreroll(pllPreroll);
835
836 FilterMediaSeeking->Release();
837 return hr;
838}

◆ GetRate()

HRESULT STDMETHODCALLTYPE COutputPin::GetRate ( double pdRate)

Implements IMediaSeeking.

Definition at line 806 of file output_pin.cpp.

808{
809 IMediaSeeking * FilterMediaSeeking;
810 HRESULT hr;
811
812 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
813 if (FAILED(hr))
814 return hr;
815
816 hr = FilterMediaSeeking->GetRate(pdRate);
817
818 FilterMediaSeeking->Release();
819 return hr;
820}

◆ GetStopPosition()

HRESULT STDMETHODCALLTYPE COutputPin::GetStopPosition ( LONGLONG pStop)

Implements IMediaSeeking.

Definition at line 671 of file output_pin.cpp.

673{
674 IMediaSeeking * FilterMediaSeeking;
675 HRESULT hr;
676
677 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
678 if (FAILED(hr))
679 return hr;
680
681 hr = FilterMediaSeeking->GetStopPosition(pStop);
682
683 FilterMediaSeeking->Release();
684 return hr;
685}

◆ GetStreamCaps()

HRESULT STDMETHODCALLTYPE COutputPin::GetStreamCaps ( int  iIndex,
AM_MEDIA_TYPE **  ppmt,
BYTE pSCC 
)

Definition at line 494 of file output_pin.cpp.

498{
499#ifdef KSPROXY_TRACE
500 OutputDebugStringW(L"COutputPin::GetStreamCaps NotImplemented\n");
501#endif
502 return E_NOTIMPL;
503}

◆ GetSupportedSets()

HRESULT STDMETHODCALLTYPE COutputPin::GetSupportedSets ( LPGUID pOutGuid,
PULONG  NumGuids 
)

Definition at line 2274 of file output_pin.cpp.

2277{
2279 LPGUID pGuid;
2280 ULONG NumProperty = 0;
2281 ULONG NumMethods = 0;
2282 ULONG NumEvents = 0;
2283 ULONG Length;
2285 HRESULT hr;
2286
2287 Property.Set = GUID_NULL;
2288 Property.Id = 0;
2290
2294
2295 Length = NumProperty + NumMethods + NumEvents;
2296
2297 assert(Length);
2298
2299 // allocate guid buffer
2300 pGuid = (LPGUID)CoTaskMemAlloc(Length);
2301 if (!pGuid)
2302 {
2303 // failed
2304 return E_OUTOFMEMORY;
2305 }
2306
2307 NumProperty /= sizeof(GUID);
2308 NumMethods /= sizeof(GUID);
2309 NumEvents /= sizeof(GUID);
2310
2311 // get all properties
2313 if (FAILED(hr))
2314 {
2315 CoTaskMemFree(pGuid);
2316 return E_FAIL;
2317 }
2319
2320 // get all methods
2321 if (Length && NumMethods)
2322 {
2324 if (FAILED(hr))
2325 {
2326 CoTaskMemFree(pGuid);
2327 return E_FAIL;
2328 }
2330 }
2331
2332 // get all events
2333 if (Length && NumEvents)
2334 {
2336 if (FAILED(hr))
2337 {
2338 CoTaskMemFree(pGuid);
2339 return E_FAIL;
2340 }
2342 }
2343
2344#ifdef KSPROXY_TRACE
2345 WCHAR Buffer[200];
2346 swprintf(Buffer, L"NumProperty %lu NumMethods %lu NumEvents %lu\n", NumProperty, NumMethods, NumEvents);
2348#endif
2349
2350 *pOutGuid = pGuid;
2351 *NumGuids = NumProperty+NumEvents+NumMethods;
2352 return S_OK;
2353}
#define KSPROPERTY_TYPE_SETSUPPORT
Definition: dmksctrl.h:44
#define GUID_NULL
Definition: ks.h:106
#define IOCTL_KS_METHOD
Definition: ks.h:136
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
#define IOCTL_KS_ENABLE_EVENT
Definition: ks.h:130
KSDDKAPI HRESULT WINAPI KsSynchronousDeviceControl(HANDLE Handle, ULONG IoControl, PVOID InBuffer, ULONG InLength, PVOID OutBuffer, ULONG OutLength, PULONG BytesReturned)
Definition: ksproxy.cpp:34
@ NumMethods
Definition: actctx.c:1556
GUID * LPGUID
Definition: guiddef.h:81

Referenced by Connect().

◆ GetTimeFormat()

HRESULT STDMETHODCALLTYPE COutputPin::GetTimeFormat ( GUID pFormat)

Implements IMediaSeeking.

Definition at line 599 of file output_pin.cpp.

601{
602 IMediaSeeking * FilterMediaSeeking;
603 HRESULT hr;
604
605 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
606 if (FAILED(hr))
607 return hr;
608
609 hr = FilterMediaSeeking->GetTimeFormat(pFormat);
610
611 FilterMediaSeeking->Release();
612 return hr;
613}

◆ InitializeIOThread()

HRESULT WINAPI COutputPin::InitializeIOThread ( )

Definition at line 2566 of file output_pin.cpp.

2567{
2569
2571 return NOERROR;
2572
2573 if (!m_hStartEvent)
2575
2576 if (!m_hStartEvent)
2577 return E_OUTOFMEMORY;
2578
2579 if (!m_hStopEvent)
2581
2582 if (!m_hStopEvent)
2583 return E_OUTOFMEMORY;
2584
2585 if (!m_hBufferAvailable)
2587
2588 if (!m_hBufferAvailable)
2589 return E_OUTOFMEMORY;
2590
2591 m_StopInProgress = false;
2592 m_IoThreadStarted = true;
2593
2594 // now create the startup thread
2596 if (!hThread)
2597 return E_OUTOFMEMORY;
2598
2599
2600 // close thread handle
2602 return NOERROR;
2603}
friend DWORD WINAPI COutputPin_IoThreadStartup(LPVOID lpParameter)
#define FALSE
Definition: types.h:117
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
HANDLE hThread
Definition: wizard.c:28
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651

Referenced by CreatePinHandle().

◆ IoProcessRoutine()

HRESULT WINAPI COutputPin::IoProcessRoutine ( )

Definition at line 2408 of file output_pin.cpp.

2409{
2410 IMediaSample *Sample;
2411 LONG SampleCount;
2412 HRESULT hr;
2413 PKSSTREAM_SEGMENT * StreamSegment;
2414 HANDLE hEvent;
2415 IMediaSample ** Samples;
2416 LONG NumHandles;
2418
2419#ifdef KSPROXY_TRACE
2420 WCHAR Buffer[200];
2421#endif
2422
2423 NumHandles = m_Properties.cBuffers / 2;
2424
2425 if (!NumHandles)
2426 NumHandles = 8;
2427
2428 assert(NumHandles);
2429
2430 //allocate stream segment array
2431 StreamSegment = (PKSSTREAM_SEGMENT*)CoTaskMemAlloc(sizeof(PVOID) * NumHandles);
2432 if (!StreamSegment)
2433 {
2434 OutputDebugStringW(L"COutputPin::IoProcessRoutine out of memory\n");
2435 return E_FAIL;
2436 }
2437
2438 // allocate handle array
2439 Samples = (IMediaSample**)CoTaskMemAlloc(sizeof(IMediaSample*) * NumHandles);
2440 if (!Samples)
2441 {
2442 OutputDebugStringW(L"COutputPin::IoProcessRoutine out of memory\n");
2443 return E_FAIL;
2444 }
2445
2446 // zero handles array
2447 ZeroMemory(StreamSegment, sizeof(PVOID) * NumHandles);
2448 ZeroMemory(Samples, sizeof(IMediaSample*) * NumHandles);
2449
2450 // first wait for the start event to signal
2452
2453 m_IoCount = 0;
2454
2456 do
2457 {
2458 if (m_StopInProgress)
2459 {
2460 // stop io thread
2461 break;
2462 }
2463
2466
2467 // get buffer
2468 hr = m_MemAllocator->GetBuffer(&Sample, NULL, NULL, AM_GBF_NOWAIT);
2469
2470 if (FAILED(hr))
2471 {
2473 // now retry again
2474 continue;
2475 }
2476
2477 // fill buffer
2478 SampleCount = 1;
2479 Samples[m_IoCount] = Sample;
2480
2481 Sample->SetTime(NULL, NULL);
2482 hr = m_InterfaceHandler->KsProcessMediaSamples(NULL, /* FIXME */
2483 &Samples[m_IoCount],
2484 &SampleCount,
2485 KsIoOperation_Read,
2486 &StreamSegment[m_IoCount]);
2487 if (FAILED(hr) || !StreamSegment)
2488 {
2489#ifdef KSPROXY_TRACE
2490 swprintf(Buffer, L"COutputPin::IoProcessRoutine KsProcessMediaSamples FAILED PinName %s hr %lx\n", m_PinName, hr);
2492#endif
2493 break;
2494 }
2495
2496 // interface handle should increment pending i/o count
2497 assert(m_IoCount >= 1);
2498
2499 swprintf(Buffer, L"COutputPin::IoProcessRoutine m_IoCount %lu NumHandles %lu\n", m_IoCount, NumHandles);
2501
2502 if (m_IoCount != NumHandles)
2503 continue;
2504
2505 // get completion handle
2506 hEvent = StreamSegment[0]->CompletionEvent;
2507
2508 // wait for i/o completion
2510
2511 swprintf(Buffer, L"COutputPin::IoProcessRoutine dwStatus %lx Error %lx NumHandles %lu\n", dwStatus, GetLastError(), NumHandles);
2513
2514 // perform completion
2515 m_InterfaceHandler->KsCompleteIo(StreamSegment[0]);
2516
2517 // close completion event
2519
2520 if (SUCCEEDED(hr))
2521 {
2523
2524 // now deliver the sample
2525 hr = m_MemInputPin->Receive(Samples[0]);
2526
2527#ifdef KSPROXY_TRACE
2528 swprintf(Buffer, L"COutputPin::IoProcessRoutine PinName %s IMemInputPin::Receive hr %lx Sample %p m_MemAllocator %p\n", m_PinName, hr, Sample, m_MemAllocator);
2530#endif
2531
2532 if (FAILED(hr))
2533 break;
2534
2535 Sample = NULL;
2536 }
2537
2538 //circular stream segment array
2539 RtlMoveMemory(StreamSegment, &StreamSegment[1], sizeof(PVOID) * (NumHandles - 1));
2540 RtlMoveMemory(Samples, &Samples[1], sizeof(IMediaSample*) * (NumHandles - 1));
2541
2542 }while(TRUE);
2543
2544 // signal end of i/o thread
2546
2547 m_IoThreadStarted = false;
2548
2549 return NOERROR;
2550}
#define INFINITE
Definition: serial.h:102
HRESULT SetTime([in] REFERENCE_TIME *pTimeStart, [in] REFERENCE_TIME *pTimeEnd)
HRESULT GetBuffer([out] IMediaSample **ppBuffer, [in] REFERENCE_TIME *pStartTime, [in] REFERENCE_TIME *pEndTime, [in] DWORD dwFlags)
HRESULT Receive([in] IMediaSample *pSample)
@ KSSTATE_RUN
Definition: ks.h:1218
static HANDLE hEvent
Definition: comm.c:54
long LONG
Definition: pedump.c:60
DWORD dwStatus
Definition: mediaobj.idl:95
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ IsFormatSupported()

HRESULT STDMETHODCALLTYPE COutputPin::IsFormatSupported ( const GUID pFormat)

Implements IMediaSeeking.

Definition at line 563 of file output_pin.cpp.

565{
566 IMediaSeeking * FilterMediaSeeking;
567 HRESULT hr;
568
569 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
570 if (FAILED(hr))
571 return hr;
572
573 hr = FilterMediaSeeking->IsFormatSupported(pFormat);
574
575 FilterMediaSeeking->Release();
576 return hr;
577}

◆ IsUsingTimeFormat()

HRESULT STDMETHODCALLTYPE COutputPin::IsUsingTimeFormat ( const GUID pFormat)

Implements IMediaSeeking.

Definition at line 617 of file output_pin.cpp.

619{
620 IMediaSeeking * FilterMediaSeeking;
621 HRESULT hr;
622
623 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
624 if (FAILED(hr))
625 return hr;
626
627 hr = FilterMediaSeeking->IsUsingTimeFormat(pFormat);
628
629 FilterMediaSeeking->Release();
630 return hr;
631}

◆ KsAddAggregate()

HRESULT STDMETHODCALLTYPE COutputPin::KsAddAggregate ( IN REFGUID  AggregateClass)

Definition at line 872 of file output_pin.cpp.

874{
875#ifdef KSPROXY_TRACE
876 OutputDebugStringW(L"COutputPin::KsAddAggregate NotImplemented\n");
877#endif
878 return E_NOTIMPL;
879}

◆ KsCreateSinkPinHandle()

HRESULT STDMETHODCALLTYPE COutputPin::KsCreateSinkPinHandle ( KSPIN_INTERFACE Interface,
KSPIN_MEDIUM Medium 
)

Definition at line 949 of file output_pin.cpp.

952{
953#ifdef KSPROXY_TRACE
954 OutputDebugStringW(L"COutputPin::KsCreateSinkPinHandle NotImplemented\n");
955#endif
956 return E_NOTIMPL;
957}

◆ KsDecrementPendingIoCount()

LONG STDMETHODCALLTYPE COutputPin::KsDecrementPendingIoCount ( )

Definition at line 1085 of file output_pin.cpp.

1086{
1087 return InterlockedDecrement((volatile LONG*)&m_IoCount);
1088}
#define InterlockedDecrement
Definition: armddk.h:52

◆ KsDeliver()

HRESULT STDMETHODCALLTYPE COutputPin::KsDeliver ( IMediaSample Sample,
ULONG  Flags 
)

Definition at line 1024 of file output_pin.cpp.

1027{
1028 return E_FAIL;
1029}

◆ KsEvent()

HRESULT STDMETHODCALLTYPE COutputPin::KsEvent ( PKSEVENT  Event,
ULONG  EventLength,
LPVOID  EventData,
ULONG  DataLength,
ULONG BytesReturned 
)

Definition at line 1391 of file output_pin.cpp.

1397{
1399
1400#ifdef KSPROXY_TRACE
1401 OutputDebugStringW(L"COutputPin::KsEvent\n");
1402#endif
1403
1404 if (EventLength)
1406 else
1408}
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
#define IOCTL_KS_DISABLE_EVENT
Definition: ks.h:133

◆ KsGetConnectedPin()

IPin *STDMETHODCALLTYPE COutputPin::KsGetConnectedPin ( )

Definition at line 1176 of file output_pin.cpp.

1177{
1178 return m_Pin;
1179}

◆ KsGetCurrentCommunication()

HRESULT STDMETHODCALLTYPE COutputPin::KsGetCurrentCommunication ( KSPIN_COMMUNICATION Communication,
KSPIN_INTERFACE Interface,
KSPIN_MEDIUM Medium 
)

Definition at line 961 of file output_pin.cpp.

965{
966 if (Communication)
967 {
968 *Communication = m_Communication;
969 }
970
971 if (Interface)
972 {
973 if (!m_hPin)
974 return VFW_E_NOT_CONNECTED;
975
977 }
978
979 if (Medium)
980 {
981 if (!m_hPin)
982 return VFW_E_NOT_CONNECTED;
983
984 CopyMemory(Medium, &m_Medium, sizeof(KSPIN_MEDIUM));
985 }
986 return NOERROR;
987}

◆ KsGetFilterName()

PWCHAR STDMETHODCALLTYPE COutputPin::KsGetFilterName ( )

Definition at line 1258 of file output_pin.cpp.

1259{
1260 return m_FilterName;
1261}

◆ KsGetObjectHandle()

HANDLE STDMETHODCALLTYPE COutputPin::KsGetObjectHandle ( )

Definition at line 1335 of file output_pin.cpp.

1336{
1337#ifdef KSPROXY_TRACE
1338 OutputDebugStringW(L"COutputPin::KsGetObjectHandle\n");
1339#endif
1340
1342 return m_hPin;
1343}

◆ KsGetPinBusCache()

GUID STDMETHODCALLTYPE COutputPin::KsGetPinBusCache ( )

Definition at line 1228 of file output_pin.cpp.

1229{
1231 {
1234 }
1235
1236 return m_PinBusCache;
1237}
GUID m_PinBusCache
Definition: output_pin.cpp:183
GUID Set
Definition: dmksctrl.h:76

◆ KsGetPinFramingCache()

HRESULT STDMETHODCALLTYPE COutputPin::KsGetPinFramingCache ( PKSALLOCATOR_FRAMING_EX FramingEx,
PFRAMING_PROP  FramingProp,
FRAMING_CACHE_OPS  Option 
)

Definition at line 1124 of file output_pin.cpp.

1128{
1129 if (Option > Framing_Cache_Write || Option < Framing_Cache_ReadLast)
1130 {
1131 // invalid argument
1132 return E_INVALIDARG;
1133 }
1134
1135 // get framing properties
1136 *FramingProp = m_FramingProp[Option];
1137 *FramingEx = m_FramingEx[Option];
1138
1139 return NOERROR;
1140}
#define E_INVALIDARG
Definition: ddrawi.h:101

◆ KsGetPinName()

PWCHAR STDMETHODCALLTYPE COutputPin::KsGetPinName ( )

Definition at line 1250 of file output_pin.cpp.

1251{
1252 return (PWCHAR)m_PinName;
1253}
uint16_t * PWCHAR
Definition: typedefs.h:56

◆ KsGetPipe()

IKsAllocatorEx *STDMETHODCALLTYPE COutputPin::KsGetPipe ( KSPEEKOPERATION  Operation)

Definition at line 1183 of file output_pin.cpp.

1185{
1186 if (Operation == KsPeekOperation_AddRef)
1187 {
1188 if (m_KsAllocatorEx)
1189 m_KsAllocatorEx->AddRef();
1190 }
1191 return m_KsAllocatorEx;
1192}
FP_OP Operation
Definition: fpcontrol.c:150

◆ KsGetPipeAllocatorFlag()

ULONG STDMETHODCALLTYPE COutputPin::KsGetPipeAllocatorFlag ( )

Definition at line 1211 of file output_pin.cpp.

1212{
1213 return m_PipeAllocatorFlag;
1214}

◆ KsIncrementPendingIoCount()

LONG STDMETHODCALLTYPE COutputPin::KsIncrementPendingIoCount ( )

Definition at line 1078 of file output_pin.cpp.

1079{
1080 return InterlockedIncrement((volatile LONG*)&m_IoCount);
1081}
#define InterlockedIncrement
Definition: armddk.h:53

◆ KsMediaSamplesCompleted()

HRESULT STDMETHODCALLTYPE COutputPin::KsMediaSamplesCompleted ( PKSSTREAM_SEGMENT  StreamSegment)

Definition at line 1033 of file output_pin.cpp.

1034{
1035 return NOERROR;
1036}

◆ KsMethod()

HRESULT STDMETHODCALLTYPE COutputPin::KsMethod ( PKSMETHOD  Method,
ULONG  MethodLength,
LPVOID  MethodData,
ULONG  DataLength,
ULONG BytesReturned 
)

Definition at line 1375 of file output_pin.cpp.

1381{
1383#ifdef KSPROXY_TRACE
1384 OutputDebugStringW(L"COutputPin::KsMethod\n");
1385#endif
1386 return KsSynchronousDeviceControl(m_hPin, IOCTL_KS_METHOD, (PVOID)Method, MethodLength, (PVOID)MethodData, DataLength, BytesReturned);
1387}

◆ KsNotifyError()

VOID STDMETHODCALLTYPE COutputPin::KsNotifyError ( IMediaSample Sample,
HRESULT  hr 
)

Definition at line 1108 of file output_pin.cpp.

1111{
1112#ifdef KSPROXY_TRACE
1113 OutputDebugStringW(L"COutputPin::KsNotifyError NotImplemented\n");
1114#endif
1115}

◆ KsPeekAllocator()

IMemAllocator *STDMETHODCALLTYPE COutputPin::KsPeekAllocator ( KSPEEKOPERATION  Operation)

Definition at line 1040 of file output_pin.cpp.

1041{
1042 if (Operation == KsPeekOperation_AddRef)
1043 {
1044 // add reference on allocator
1046 }
1047
1048 return m_MemAllocator;
1049}

◆ KsPinFactory()

HRESULT STDMETHODCALLTYPE COutputPin::KsPinFactory ( ULONG PinFactory)

Definition at line 1290 of file output_pin.cpp.

1292{
1293#ifdef KSPROXY_TRACE
1294 OutputDebugStringW(L"COutputPin::KsPinFactory\n");
1295#endif
1296
1297 *PinFactory = m_PinId;
1298 return S_OK;
1299}

◆ KsPropagateAcquire()

HRESULT STDMETHODCALLTYPE COutputPin::KsPropagateAcquire ( )

Definition at line 991 of file output_pin.cpp.

992{
996 HRESULT hr;
997
998#ifdef KSPROXY_TRACE
999 OutputDebugStringW(L"COutputPin::KsPropagateAcquire\n");
1000#endif
1001
1003
1007
1009
1010 hr = KsProperty(&Property, sizeof(KSPROPERTY), (LPVOID)&State, sizeof(KSSTATE), &BytesReturned);
1011 if (SUCCEEDED(hr))
1012 {
1013 m_State = State;
1014 }
1015
1016 //TODO
1017 //propagate to connected pin on the pipe
1018
1019 return hr;
1020}
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
@ KSPROPERTY_CONNECTION_STATE
Definition: ks.h:349
KSSTATE
Definition: ks.h:1214
@ KSSTATE_ACQUIRE
Definition: ks.h:1216

◆ KsProperty()

HRESULT STDMETHODCALLTYPE COutputPin::KsProperty ( PKSPROPERTY  Property,
ULONG  PropertyLength,
LPVOID  PropertyData,
ULONG  DataLength,
ULONG BytesReturned 
)

Definition at line 1350 of file output_pin.cpp.

1356{
1357 HRESULT hr;
1358
1360
1362#ifdef KSPROXY_TRACE
1363 WCHAR Buffer[100];
1364 LPOLESTR pstr;
1365 StringFromCLSID(Property->Set, &pstr);
1366 swprintf(Buffer, L"COutputPin::KsProperty Set %s Id %lu Flags %x hr %x\n", pstr, Property->Id, Property->Flags, hr);
1368#endif
1369
1370 return hr;
1371}
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData

Referenced by CreatePinHandle(), Get(), KsPropagateAcquire(), QuerySupported(), and Set().

◆ KsQualityNotify()

HRESULT STDMETHODCALLTYPE COutputPin::KsQualityNotify ( ULONG  Proportion,
REFERENCE_TIME  TimeDelta 
)

Definition at line 1092 of file output_pin.cpp.

1095{
1096#ifdef KSPROXY_TRACE
1097 OutputDebugStringW(L"COutputPin::KsQualityNotify NotImplemented\n");
1098#endif
1099 return E_NOTIMPL;
1100}

◆ KsQueryInterfaces()

HRESULT STDMETHODCALLTYPE COutputPin::KsQueryInterfaces ( PKSMULTIPLE_ITEM InterfaceList)

Definition at line 924 of file output_pin.cpp.

926{
927 HRESULT hr;
928 HANDLE hFilter;
929 IKsObject * KsObjectParent;
930
931 hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
932 if (FAILED(hr))
933 return hr;
934
935 hFilter = KsObjectParent->KsGetObjectHandle();
936
937 if (hFilter)
939 else
940 hr = E_HANDLE;
941
942 KsObjectParent->Release();
943
944 return hr;
945}
@ KSPROPERTY_PIN_INTERFACES
Definition: ks.h:630

Referenced by CreatePin().

◆ KsQueryMediums()

HRESULT STDMETHODCALLTYPE COutputPin::KsQueryMediums ( PKSMULTIPLE_ITEM MediumList)

Definition at line 899 of file output_pin.cpp.

901{
902 HRESULT hr;
903 HANDLE hFilter;
904 IKsObject * KsObjectParent;
905
906 hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
907 if (FAILED(hr))
908 return E_NOINTERFACE;
909
910 hFilter = KsObjectParent->KsGetObjectHandle();
911
912 if (hFilter)
914 else
915 hr = E_HANDLE;
916
917 KsObjectParent->Release();
918
919 return hr;
920}
@ KSPROPERTY_PIN_MEDIUMS
Definition: ks.h:631
#define E_NOINTERFACE
Definition: winerror.h:2364

Referenced by CreatePin().

◆ KsReceiveAllocator()

HRESULT STDMETHODCALLTYPE COutputPin::KsReceiveAllocator ( IMemAllocator MemAllocator)

Definition at line 1053 of file output_pin.cpp.

1054{
1055 if (MemAllocator)
1056 {
1057 MemAllocator->AddRef();
1058 }
1059
1060 if (m_MemAllocator)
1061 {
1063 }
1064
1065 m_MemAllocator = MemAllocator;
1066 return NOERROR;
1067}

◆ KsRemoveAggregate()

HRESULT STDMETHODCALLTYPE COutputPin::KsRemoveAggregate ( REFGUID  AggregateClass)

Definition at line 883 of file output_pin.cpp.

885{
886#ifdef KSPROXY_TRACE
887 OutputDebugStringW(L"COutputPin::KsRemoveAggregate NotImplemented\n");
888#endif
889 return E_NOTIMPL;
890}

◆ KsRenegotiateAllocator()

HRESULT STDMETHODCALLTYPE COutputPin::KsRenegotiateAllocator ( )

Definition at line 1071 of file output_pin.cpp.

1072{
1073 return E_FAIL;
1074}

◆ KsSetPinBusCache()

HRESULT STDMETHODCALLTYPE COutputPin::KsSetPinBusCache ( GUID  Bus)

Definition at line 1241 of file output_pin.cpp.

1243{
1244 CopyMemory(&m_PinBusCache, &Bus, sizeof(GUID));
1245 return NOERROR;
1246}

◆ KsSetPinFramingCache()

HRESULT STDMETHODCALLTYPE COutputPin::KsSetPinFramingCache ( PKSALLOCATOR_FRAMING_EX  FramingEx,
PFRAMING_PROP  FramingProp,
FRAMING_CACHE_OPS  Option 
)

Definition at line 1144 of file output_pin.cpp.

1148{
1149 ULONG Index;
1150 ULONG RefCount = 0;
1151
1152 if (m_FramingEx[Option])
1153 {
1154 for(Index = 1; Index < 4; Index++)
1155 {
1156 if (m_FramingEx[Index] == m_FramingEx[Option])
1157 RefCount++;
1158 }
1159
1160 if (RefCount == 1)
1161 {
1162 // existing framing is only used once
1163 CoTaskMemFree(m_FramingEx[Option]);
1164 }
1165 }
1166
1167 // store framing
1168 m_FramingEx[Option] = FramingEx;
1169 m_FramingProp[Option] = *FramingProp;
1170
1171 return S_OK;
1172}

◆ KsSetPipe()

HRESULT STDMETHODCALLTYPE COutputPin::KsSetPipe ( IKsAllocatorEx *  KsAllocator)

Definition at line 1196 of file output_pin.cpp.

1198{
1199 if (KsAllocator)
1200 KsAllocator->AddRef();
1201
1202 if (m_KsAllocatorEx)
1203 m_KsAllocatorEx->Release();
1204
1205 m_KsAllocatorEx = KsAllocator;
1206 return NOERROR;
1207}

◆ KsSetPipeAllocatorFlag()

HRESULT STDMETHODCALLTYPE COutputPin::KsSetPipeAllocatorFlag ( ULONG  Flag)

Definition at line 1219 of file output_pin.cpp.

1221{
1223 return NOERROR;
1224}
Definition: xml2sdb.h:80

◆ LoadProxyPlugins()

HRESULT STDMETHODCALLTYPE COutputPin::LoadProxyPlugins ( LPGUID  pGuids,
ULONG  NumGuids 
)

Definition at line 2357 of file output_pin.cpp.

2360{
2361 ULONG Index;
2362 LPOLESTR pStr;
2363 HKEY hKey, hSubKey;
2364 HRESULT hr;
2366
2367 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\MediaInterfaces", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
2368 {
2369 OutputDebugStringW(L"CKsProxy::LoadProxyPlugins failed to open MediaInterfaces key\n");
2370 return E_FAIL;
2371 }
2372
2373 // enumerate all sets
2374 for(Index = 0; Index < NumGuids; Index++)
2375 {
2376 // convert to string
2377 hr = StringFromCLSID(pGuids[Index], &pStr);
2378 if (FAILED(hr))
2379 return E_FAIL;
2380
2381 // now try open class key
2382 if (RegOpenKeyExW(hKey, pStr, 0, KEY_READ, &hSubKey) != ERROR_SUCCESS)
2383 {
2384 // no plugin for that set exists
2385 CoTaskMemFree(pStr);
2386 continue;
2387 }
2388
2389 // try load plugin
2390 hr = CoCreateInstance(pGuids[Index], (IBaseFilter*)this, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**)&pUnknown);
2391 if (SUCCEEDED(hr))
2392 {
2393 // store plugin
2394 m_Plugins.push_back(pUnknown);
2395 }
2396 // close key
2397 RegCloseKey(hSubKey);
2398 }
2399
2400 // close media interfaces key
2402 return S_OK;
2403}
const GUID IID_IUnknown
#define RegCloseKey(hKey)
Definition: registry.h:49
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
FxAutoRegKey hKey
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by Connect().

◆ NewSegment()

HRESULT STDMETHODCALLTYPE COutputPin::NewSegment ( REFERENCE_TIME  tStart,
REFERENCE_TIME  tStop,
double  dRate 
)

Implements IPin.

Definition at line 1908 of file output_pin.cpp.

1909{
1910 if (!m_Pin)
1911 {
1912 // we are not connected
1913 return VFW_E_NOT_CONNECTED;
1914 }
1915
1916 return m_Pin->NewSegment(tStart, tStop, dRate);
1917}
HRESULT NewSegment([in] REFERENCE_TIME tStart, [in] REFERENCE_TIME tStop, [in] double dRate)

◆ Notify()

HRESULT STDMETHODCALLTYPE COutputPin::Notify ( IBaseFilter pSelf,
Quality  q 
)

Implements IQualityControl.

Definition at line 845 of file output_pin.cpp.

848{
849#ifdef KSPROXY_TRACE
850 OutputDebugStringW(L"COutputPin::Notify NotImplemented\n");
851#endif
852 return E_NOTIMPL;
853}

◆ NotifyRelease()

HRESULT STDMETHODCALLTYPE COutputPin::NotifyRelease ( )

Implements IMemAllocatorNotifyCallbackTemp.

Definition at line 510 of file output_pin.cpp.

511{
512#ifdef KSPROXY_TRACE
513 OutputDebugStringW(L"COutputPin::NotifyRelease\n");
514#endif
515
516 // notify thread of new available sample
518
519 return NOERROR;
520}

◆ QueryAccept()

HRESULT STDMETHODCALLTYPE COutputPin::QueryAccept ( const AM_MEDIA_TYPE pmt)

Definition at line 1819 of file output_pin.cpp.

1820{
1821#ifdef KSPROXY_TRACE
1822 OutputDebugStringW(L"COutputPin::QueryAccept called\n");
1823#endif
1824
1825 return E_NOTIMPL;
1826}

◆ QueryDirection()

HRESULT STDMETHODCALLTYPE COutputPin::QueryDirection ( PIN_DIRECTION pPinDir)

Implements IPin.

Definition at line 1796 of file output_pin.cpp.

1797{
1798 if (pPinDir)
1799 {
1800 *pPinDir = PINDIR_OUTPUT;
1801 return S_OK;
1802 }
1803
1804 return E_POINTER;
1805}
@ PINDIR_OUTPUT
Definition: axcore.idl:42

◆ QueryId()

HRESULT STDMETHODCALLTYPE COutputPin::QueryId ( LPWSTR Id)

Implements IPin.

Definition at line 1808 of file output_pin.cpp.

1809{
1810 *Id = (LPWSTR)CoTaskMemAlloc((wcslen(m_PinName)+1)*sizeof(WCHAR));
1811 if (!*Id)
1812 return E_OUTOFMEMORY;
1813
1814 wcscpy(*Id, m_PinName);
1815 return S_OK;
1816}
DWORD Id
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ QueryInterface()

HRESULT STDMETHODCALLTYPE COutputPin::QueryInterface ( REFIID  InterfaceId,
PVOID Interface 
)

Definition at line 268 of file output_pin.cpp.

271{
272 *Output = NULL;
273 if (IsEqualGUID(refiid, IID_IUnknown) ||
274 IsEqualGUID(refiid, IID_IPin))
275 {
276#ifdef KSPROXY_TRACE
277 OutputDebugStringW(L"COutputPin::QueryInterface IID_IPin\n");
278#endif
279 *Output = PVOID(this);
280 reinterpret_cast<IUnknown*>(*Output)->AddRef();
281 return NOERROR;
282 }
283 else if (IsEqualGUID(refiid, IID_IKsObject))
284 {
286 {
288 if (FAILED(hr))
289 return hr;
290 }
291#ifdef KSPROXY_TRACE
292 OutputDebugStringW(L"COutputPin::QueryInterface IID_IKsObject\n");
293#endif
294 *Output = (IKsObject*)(this);
295 reinterpret_cast<IKsObject*>(*Output)->AddRef();
296 return NOERROR;
297 }
298 else if (IsEqualGUID(refiid, IID_IKsPin) || IsEqualGUID(refiid, IID_IKsPinEx))
299 {
300 *Output = (IKsPinEx*)(this);
301 reinterpret_cast<IKsPinEx*>(*Output)->AddRef();
302 return NOERROR;
303 }
304 else if (IsEqualGUID(refiid, IID_IKsPinPipe))
305 {
306 *Output = (IKsPinPipe*)(this);
307 reinterpret_cast<IKsPinPipe*>(*Output)->AddRef();
308 return NOERROR;
309 }
310 else if (IsEqualGUID(refiid, IID_IKsAggregateControl))
311 {
312 *Output = (IKsAggregateControl*)(this);
313 reinterpret_cast<IKsAggregateControl*>(*Output)->AddRef();
314 return NOERROR;
315 }
316 else if (IsEqualGUID(refiid, IID_IQualityControl))
317 {
318 *Output = (IQualityControl*)(this);
319 reinterpret_cast<IQualityControl*>(*Output)->AddRef();
320 return NOERROR;
321 }
322 else if (IsEqualGUID(refiid, IID_IKsPropertySet))
323 {
325 {
327 if (FAILED(hr))
328 return hr;
329 }
330#ifdef KSPROXY_TRACE
331 OutputDebugStringW(L"COutputPin::QueryInterface IID_IKsPropertySet\n");
332#endif
333 *Output = (IKsPropertySet*)(this);
334 reinterpret_cast<IKsPropertySet*>(*Output)->AddRef();
335 return NOERROR;
336 }
337 else if (IsEqualGUID(refiid, IID_IKsControl))
338 {
339#ifdef KSPROXY_TRACE
340 OutputDebugStringW(L"COutputPin::QueryInterface IID_IKsControl\n");
341#endif
342 *Output = (IKsControl*)(this);
343 reinterpret_cast<IKsControl*>(*Output)->AddRef();
344 return NOERROR;
345 }
346#if 0
347 else if (IsEqualGUID(refiid, IID_IStreamBuilder))
348 {
349 *Output = (IStreamBuilder*)(this);
350 reinterpret_cast<IStreamBuilder*>(*Output)->AddRef();
351 return NOERROR;
352 }
353#endif
354 else if (IsEqualGUID(refiid, IID_IKsPinFactory))
355 {
356#ifdef KSPROXY_TRACE
357 OutputDebugStringW(L"COutputPin::QueryInterface IID_IKsPinFactory\n");
358#endif
359 *Output = (IKsPinFactory*)(this);
360 reinterpret_cast<IKsPinFactory*>(*Output)->AddRef();
361 return NOERROR;
362 }
363 else if (IsEqualGUID(refiid, IID_ISpecifyPropertyPages))
364 {
365#ifdef KSPROXY_TRACE
366 OutputDebugStringW(L"COutputPin::QueryInterface IID_ISpecifyPropertyPages\n");
367#endif
368 *Output = (ISpecifyPropertyPages*)(this);
369 reinterpret_cast<ISpecifyPropertyPages*>(*Output)->AddRef();
370 return NOERROR;
371 }
372 else if (IsEqualGUID(refiid, IID_IMediaSeeking))
373 {
374 *Output = (IMediaSeeking*)(this);
375 reinterpret_cast<IMediaSeeking*>(*Output)->AddRef();
376 return NOERROR;
377 }
378 else if (IsEqualGUID(refiid, IID_IAMBufferNegotiation))
379 {
380 *Output = (IAMBufferNegotiation*)(this);
381 reinterpret_cast<IAMBufferNegotiation*>(*Output)->AddRef();
382 return NOERROR;
383 }
384 else if (IsEqualGUID(refiid, IID_IAMStreamConfig))
385 {
386 *Output = (IAMStreamConfig*)(this);
387 reinterpret_cast<IAMStreamConfig*>(*Output)->AddRef();
388 return NOERROR;
389 }
390 else if (IsEqualGUID(refiid, IID_IMemAllocatorNotifyCallbackTemp))
391 {
393 reinterpret_cast<IMemAllocatorNotifyCallbackTemp*>(*Output)->AddRef();
394 return NOERROR;
395 }
396
397#ifdef KSPROXY_TRACE
400 StringFromCLSID(refiid, &lpstr);
401 swprintf(Buffer, L"COutputPin::QueryInterface: NoInterface for %s PinId %u PinName %s\n", lpstr, m_PinId, m_PinName);
404#endif
405
406 return E_NOINTERFACE;
407}
const GUID IID_IKsPropertySet
Definition: controlnode.cpp:13
const GUID IID_IKsPinFactory
const GUID IID_IKsAggregateControl
Definition: proxy.cpp:16
#define MAX_PATH
Definition: compat.h:34
const GUID IID_IKsControl
Definition: filter.c:44
const GUID IID_IKsPinEx
Definition: input_pin.cpp:12
const GUID IID_IKsPinPipe
Definition: input_pin.cpp:11
static LPCSTR lpstr
Definition: font.c:51
const GUID IID_IPin
Definition: pincontrol.cpp:15
const GUID IID_ISpecifyPropertyPages
Definition: proxy.cpp:12
@ Output
Definition: arc.h:85
void * PVOID
Definition: typedefs.h:50

◆ QueryInternalConnections()

HRESULT STDMETHODCALLTYPE COutputPin::QueryInternalConnections ( IPin **  apPin,
ULONG nPin 
)

Implements IPin.

Definition at line 1881 of file output_pin.cpp.

1882{
1883 return E_NOTIMPL;
1884}

◆ QueryPinInfo()

HRESULT STDMETHODCALLTYPE COutputPin::QueryPinInfo ( PIN_INFO pInfo)

Implements IPin.

Definition at line 1785 of file output_pin.cpp.

1786{
1787 wcscpy(pInfo->achName, m_PinName);
1788 pInfo->dir = PINDIR_OUTPUT;
1789 pInfo->pFilter = m_ParentFilter;
1791
1792 return S_OK;
1793}

◆ QueryPreferredFormat()

HRESULT STDMETHODCALLTYPE COutputPin::QueryPreferredFormat ( GUID pFormat)

Implements IMediaSeeking.

Definition at line 581 of file output_pin.cpp.

583{
584 IMediaSeeking * FilterMediaSeeking;
585 HRESULT hr;
586
587 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
588 if (FAILED(hr))
589 return hr;
590
591 hr = FilterMediaSeeking->QueryPreferredFormat(pFormat);
592
593 FilterMediaSeeking->Release();
594 return hr;
595}

◆ QuerySupported()

HRESULT STDMETHODCALLTYPE COutputPin::QuerySupported ( REFGUID  guidPropSet,
DWORD  dwPropID,
DWORD pTypeSupport 
)

Implements IKsPropertySet.

Definition at line 1499 of file output_pin.cpp.

1503{
1506
1507#ifdef KSPROXY_TRACE
1508 OutputDebugStringW(L"COutputPin::QuerySupported\n");
1509#endif
1510
1511 Property.Set = guidPropSet;
1512 Property.Id = dwPropID;
1514
1515 return KsProperty(&Property, sizeof(KSPROPERTY), pTypeSupport, sizeof(DWORD), &BytesReturned);
1516}

◆ ReceiveConnection()

HRESULT STDMETHODCALLTYPE COutputPin::ReceiveConnection ( IPin pConnector,
const AM_MEDIA_TYPE pmt 
)

Definition at line 1717 of file output_pin.cpp.

1718{
1719 return E_UNEXPECTED;
1720}

◆ Render()

HRESULT STDMETHODCALLTYPE COutputPin::Render ( IPin ppinOut,
IGraphBuilder pGraph 
)

Implements IStreamBuilder.

Definition at line 1308 of file output_pin.cpp.

1311{
1312#ifdef KSPROXY_TRACE
1313 OutputDebugStringW(L"COutputPin::Render\n");
1314#endif
1315 return S_OK;
1316}

◆ Set()

HRESULT STDMETHODCALLTYPE COutputPin::Set ( REFGUID  guidPropSet,
DWORD  dwPropID,
LPVOID  pInstanceData,
DWORD  cbInstanceData,
LPVOID  pPropData,
DWORD  cbPropData 
)

Implements IKsPropertySet.

Definition at line 1416 of file output_pin.cpp.

1423{
1425
1426 if (cbInstanceData)
1427 {
1428 PKSPROPERTY Property = (PKSPROPERTY)CoTaskMemAlloc(sizeof(KSPROPERTY) + cbInstanceData);
1429 if (!Property)
1430 return E_OUTOFMEMORY;
1431
1432 Property->Set = guidPropSet;
1433 Property->Id = dwPropID;
1435
1436 CopyMemory((Property+1), pInstanceData, cbInstanceData);
1437
1438 HRESULT hr = KsProperty(Property, sizeof(KSPROPERTY) + cbInstanceData, pPropData, cbPropData, &BytesReturned);
1440 return hr;
1441 }
1442 else
1443 {
1445
1446 Property.Set = guidPropSet;
1447 Property.Id = dwPropID;
1449
1450 HRESULT hr = KsProperty(&Property, sizeof(KSPROPERTY), pPropData, cbPropData, &BytesReturned);
1451 return hr;
1452 }
1453}

◆ SetFormat()

HRESULT STDMETHODCALLTYPE COutputPin::SetFormat ( AM_MEDIA_TYPE pmt)

Definition at line 461 of file output_pin.cpp.

463{
464#ifdef KSPROXY_TRACE
465 OutputDebugStringW(L"COutputPin::SetFormat NotImplemented\n");
466#endif
467 return E_NOTIMPL;
468}

◆ SetPositions()

HRESULT STDMETHODCALLTYPE COutputPin::SetPositions ( LONGLONG pCurrent,
DWORD  dwCurrentFlags,
LONGLONG pStop,
DWORD  dwStopFlags 
)

Implements IMediaSeeking.

Definition at line 729 of file output_pin.cpp.

734{
735 IMediaSeeking * FilterMediaSeeking;
736 HRESULT hr;
737
738 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
739 if (FAILED(hr))
740 return hr;
741
742 hr = FilterMediaSeeking->SetPositions(pCurrent, dwCurrentFlags, pStop, dwStopFlags);
743
744 FilterMediaSeeking->Release();
745 return hr;
746}

◆ SetRate()

HRESULT STDMETHODCALLTYPE COutputPin::SetRate ( double  dRate)

Implements IMediaSeeking.

Definition at line 788 of file output_pin.cpp.

790{
791 IMediaSeeking * FilterMediaSeeking;
792 HRESULT hr;
793
794 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
795 if (FAILED(hr))
796 return hr;
797
798 hr = FilterMediaSeeking->SetRate(dRate);
799
800 FilterMediaSeeking->Release();
801 return hr;
802}

◆ SetSink()

HRESULT STDMETHODCALLTYPE COutputPin::SetSink ( IQualityControl piqc)

Implements IQualityControl.

Definition at line 857 of file output_pin.cpp.

859{
860#ifdef KSPROXY_TRACE
861 OutputDebugStringW(L"COutputPin::SetSink NotImplemented\n");
862#endif
863 return E_NOTIMPL;
864}

◆ SetTimeFormat()

HRESULT STDMETHODCALLTYPE COutputPin::SetTimeFormat ( const GUID pFormat)

Implements IMediaSeeking.

Definition at line 635 of file output_pin.cpp.

637{
638 IMediaSeeking * FilterMediaSeeking;
639 HRESULT hr;
640
641 hr = m_ParentFilter->QueryInterface(IID_IMediaSeeking, (LPVOID*)&FilterMediaSeeking);
642 if (FAILED(hr))
643 return hr;
644
645 hr = FilterMediaSeeking->SetTimeFormat(pFormat);
646
647 FilterMediaSeeking->Release();
648 return hr;
649}

◆ STDMETHODIMP_() [1/2]

COutputPin::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 33 of file output_pin.cpp.

34 {
36 return m_Ref;
37 }

◆ STDMETHODIMP_() [2/2]

COutputPin::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 38 of file output_pin.cpp.

39 {
41 if (!m_Ref)
42 {
43 //delete this;
44 return 0;
45 }
46 return m_Ref;
47 }

◆ SuggestAllocatorProperties()

HRESULT STDMETHODCALLTYPE COutputPin::SuggestAllocatorProperties ( const ALLOCATOR_PROPERTIES pprop)

Implements IAMBufferNegotiation.

Definition at line 414 of file output_pin.cpp.

416{
417#ifdef KSPROXY_TRACE
418 OutputDebugStringW(L"COutputPin::SuggestAllocatorProperties\n");
419#endif
420
421 if (m_Pin)
422 {
423 // pin is already connected
425 }
426
428 return NOERROR;
429}
#define VFW_E_ALREADY_CONNECTED
Definition: vfwmsgs.h:43

Friends And Related Function Documentation

◆ COutputPin_IoThreadStartup

DWORD WINAPI COutputPin_IoThreadStartup ( LPVOID  lpParameter)
friend

Definition at line 2554 of file output_pin.cpp.

2556{
2557 COutputPin * Pin = (COutputPin*)lpParameter;
2558 assert(Pin);
2559
2560 return Pin->IoProcessRoutine();
2561}
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:428

Referenced by InitializeIOThread().

◆ COutputPin_SetState

HRESULT STDMETHODCALLTYPE COutputPin_SetState ( IPin Pin,
KSSTATE  State 
)
friend

Definition at line 2607 of file output_pin.cpp.

2610{
2611 HRESULT hr = S_OK;
2613 KSSTATE CurState;
2615 COutputPin * pPin = (COutputPin*)Pin;
2616
2617#ifdef KSPROXY_TRACE
2618 WCHAR Buffer[200];
2619#endif
2620
2624
2626
2627 if (pPin->m_State <= State)
2628 {
2629 if (pPin->m_State == KSSTATE_STOP)
2630 {
2631 hr = pPin->InitializeIOThread();
2632 if (FAILED(hr))
2633 {
2634 // failed to initialize I/O thread
2635#ifdef KSPROXY_TRACE
2636 OutputDebugStringW(L"Failed to initialize I/O Thread\n");
2637#endif
2639 return hr;
2640 }
2641 CurState = KSSTATE_ACQUIRE;
2642 hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
2643
2644#ifdef KSPROXY_TRACE
2645 swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_STOP KSSTATE_ACQUIRE PinName %s hr %lx\n", pPin->m_PinName, hr);
2647#endif
2648
2649 if (FAILED(hr))
2650 {
2652 return hr;
2653 }
2654
2655 pPin->m_State = CurState;
2656
2657 if (pPin->m_State == State)
2658 {
2660 return hr;
2661 }
2662 }
2663 if (pPin->m_State == KSSTATE_ACQUIRE)
2664 {
2665 CurState = KSSTATE_PAUSE;
2666 hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
2667
2668#ifdef KSPROXY_TRACE
2669 swprintf(Buffer, L"COutputPin_SetState Setting State CurState KSSTATE_ACQUIRE KSSTATE_PAUSE PinName %s hr %lx\n", pPin->m_PinName, hr);
2671#endif
2672
2673 if (FAILED(hr))
2674 {
2676 return hr;
2677 }
2678
2679 pPin->m_State = CurState;
2680
2681 if (pPin->m_State == State)
2682 {
2684 return hr;
2685 }
2686 }
2687 if (State == KSSTATE_RUN && pPin->m_State == KSSTATE_PAUSE)
2688 {
2689 CurState = KSSTATE_RUN;
2690 hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
2691
2692#ifdef KSPROXY_TRACE
2693 swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_PAUSE KSSTATE_RUN PinName %s hr %lx\n", pPin->m_PinName, hr);
2695#endif
2696
2697 if (SUCCEEDED(hr))
2698 {
2699 pPin->m_State = CurState;
2700 // signal start event
2701 SetEvent(pPin->m_hStartEvent);
2702 }
2703 }
2704
2706 return hr;
2707 }
2708 else
2709 {
2710 if (pPin->m_State == KSSTATE_RUN)
2711 {
2712 // setting pending stop flag
2713 pPin->m_StopInProgress = true;
2714
2715 // release any waiting threads
2717
2718 // wait until i/o thread is done
2720
2721 CurState = KSSTATE_PAUSE;
2722 hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
2723
2724#ifdef KSPROXY_TRACE
2725 swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_RUN KSSTATE_PAUSE PinName %s hr %lx\n", pPin->m_PinName, hr);
2727#endif
2728
2729 if (FAILED(hr))
2730 {
2732 return hr;
2733 }
2734
2735 pPin->m_State = CurState;
2736
2737 if (FAILED(hr))
2738 {
2740 return hr;
2741 }
2742 }
2743 if (pPin->m_State == KSSTATE_PAUSE)
2744 {
2745 CurState = KSSTATE_ACQUIRE;
2746 hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
2747
2748#ifdef KSPROXY_TRACE
2749 swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_PAUSE KSSTATE_ACQUIRE PinName %s hr %lx\n", pPin->m_PinName, hr);
2751#endif
2752
2753 if (FAILED(hr))
2754 {
2756 return hr;
2757 }
2758
2759 pPin->m_State = CurState;
2760
2761 if (pPin->m_State == State)
2762 {
2764 return hr;
2765 }
2766 }
2767
2771
2772 /* close event handles */
2773 pPin->m_hStopEvent = NULL;
2774 pPin->m_hStartEvent = NULL;
2775 pPin->m_hBufferAvailable = NULL;
2776
2777 CurState = KSSTATE_STOP;
2778 hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
2779
2780#ifdef KSPROXY_TRACE
2781 swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_ACQUIRE KSSTATE_STOP PinName %s hr %lx\n", pPin->m_PinName, hr);
2783#endif
2784
2785 if (SUCCEEDED(hr))
2786 {
2787 // store state
2788 pPin->m_State = CurState;
2789 }
2790
2791 // unset pending stop flag
2792 pPin->m_StopInProgress = false;
2793
2795 return hr;
2796 }
2797}
@ KSSTATE_PAUSE
Definition: ks.h:1217
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Member Data Documentation

◆ m_bPinBusCacheInitialized

BOOL COutputPin::m_bPinBusCacheInitialized
protected

Definition at line 182 of file output_pin.cpp.

Referenced by KsGetPinBusCache().

◆ m_Communication

KSPIN_COMMUNICATION COutputPin::m_Communication
protected

Definition at line 191 of file output_pin.cpp.

Referenced by CreatePin(), and KsGetCurrentCommunication().

◆ m_FilterName

LPWSTR COutputPin::m_FilterName
protected

Definition at line 184 of file output_pin.cpp.

Referenced by KsGetFilterName().

◆ m_FramingEx

PKSALLOCATOR_FRAMING_EX COutputPin::m_FramingEx[4]
protected

Definition at line 186 of file output_pin.cpp.

Referenced by COutputPin(), KsGetPinFramingCache(), and KsSetPinFramingCache().

◆ m_FramingProp

FRAMING_PROP COutputPin::m_FramingProp[4]
protected

Definition at line 185 of file output_pin.cpp.

Referenced by COutputPin(), KsGetPinFramingCache(), and KsSetPinFramingCache().

◆ m_hBufferAvailable

HANDLE COutputPin::m_hBufferAvailable
protected

Definition at line 199 of file output_pin.cpp.

Referenced by InitializeIOThread(), IoProcessRoutine(), and NotifyRelease().

◆ m_hPin

◆ m_hStartEvent

HANDLE COutputPin::m_hStartEvent
protected

Definition at line 198 of file output_pin.cpp.

Referenced by InitializeIOThread(), and IoProcessRoutine().

◆ m_hStopEvent

HANDLE COutputPin::m_hStopEvent
protected

Definition at line 200 of file output_pin.cpp.

Referenced by InitializeIOThread(), and IoProcessRoutine().

◆ m_Interface

KSPIN_INTERFACE COutputPin::m_Interface
protected

Definition at line 192 of file output_pin.cpp.

Referenced by CreatePinHandle(), and KsGetCurrentCommunication().

◆ m_InterfaceHandler

IKsInterfaceHandler* COutputPin::m_InterfaceHandler
protected

Definition at line 196 of file output_pin.cpp.

Referenced by CreatePin(), and IoProcessRoutine().

◆ m_IoCount

LONG COutputPin::m_IoCount
protected

◆ m_IoThreadStarted

BOOL COutputPin::m_IoThreadStarted
protected

Definition at line 202 of file output_pin.cpp.

Referenced by InitializeIOThread(), and IoProcessRoutine().

◆ m_KsAllocatorEx

IKsAllocatorEx* COutputPin::m_KsAllocatorEx
protected

Definition at line 180 of file output_pin.cpp.

Referenced by GetAllocatorProperties(), KsGetPipe(), and KsSetPipe().

◆ m_Lock

CRITICAL_SECTION COutputPin::m_Lock
protected

Definition at line 205 of file output_pin.cpp.

Referenced by COutputPin().

◆ m_MediaFormat

AM_MEDIA_TYPE COutputPin::m_MediaFormat
protected

Definition at line 194 of file output_pin.cpp.

Referenced by Connect(), COutputPin(), CreatePinHandle(), and QueryInterface().

◆ m_Medium

KSPIN_MEDIUM COutputPin::m_Medium
protected

Definition at line 193 of file output_pin.cpp.

Referenced by CreatePinHandle(), KsGetCurrentCommunication(), and KsGetPinBusCache().

◆ m_MemAllocator

IMemAllocator* COutputPin::m_MemAllocator
protected

◆ m_MemInputPin

IMemInputPin* COutputPin::m_MemInputPin
protected

Definition at line 189 of file output_pin.cpp.

Referenced by Connect(), Disconnect(), and IoProcessRoutine().

◆ m_ParentFilter

◆ m_Pin

IPin* COutputPin::m_Pin
protected

◆ m_PinBusCache

GUID COutputPin::m_PinBusCache
protected

Definition at line 183 of file output_pin.cpp.

Referenced by KsGetPinBusCache(), and KsSetPinBusCache().

◆ m_PinId

◆ m_PinName

LPCWSTR COutputPin::m_PinName
protected

◆ m_PipeAllocatorFlag

ULONG COutputPin::m_PipeAllocatorFlag
protected

Definition at line 181 of file output_pin.cpp.

Referenced by KsGetPipeAllocatorFlag(), and KsSetPipeAllocatorFlag().

◆ m_Plugins

ProxyPluginVector COutputPin::m_Plugins
protected

Definition at line 207 of file output_pin.cpp.

Referenced by Connect(), and LoadProxyPlugins().

◆ m_Properties

ALLOCATOR_PROPERTIES COutputPin::m_Properties
protected

◆ m_Ref

LONG COutputPin::m_Ref
protected

Definition at line 174 of file output_pin.cpp.

Referenced by STDMETHODIMP_().

◆ m_State

KSSTATE COutputPin::m_State
protected

Definition at line 204 of file output_pin.cpp.

Referenced by IoProcessRoutine(), and KsPropagateAcquire().

◆ m_StopInProgress

BOOL COutputPin::m_StopInProgress
protected

Definition at line 201 of file output_pin.cpp.

Referenced by InitializeIOThread(), and IoProcessRoutine().


The documentation for this class was generated from the following file: