1 /* Video For Windows Steering structure
3 * Copyright 2005 Maarten Lankhorst
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "qcap_main.h"
34 #include "wine/debug.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(qcap
);
47 #define ICOM_THIS_MULTI(impl,field,iface) \
48 impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
50 static const IBaseFilterVtbl VfwCapture_Vtbl
;
51 static const IAMStreamConfigVtbl IAMStreamConfig_VTable
;
52 static const IAMVideoProcAmpVtbl IAMVideoProcAmp_VTable
;
53 static const IPersistPropertyBagVtbl IPersistPropertyBag_VTable
;
54 static const IPinVtbl VfwPin_Vtbl
;
56 static HRESULT
VfwPin_Construct( IBaseFilter
*, LPCRITICAL_SECTION
, IPin
** );
58 typedef struct VfwCapture
61 IAMStreamConfig IAMStreamConfig_iface
;
62 IAMVideoProcAmp IAMVideoProcAmp_iface
;
63 IPersistPropertyBag IPersistPropertyBag_iface
;
71 static inline VfwCapture
*impl_from_IAMStreamConfig(IAMStreamConfig
*iface
)
73 return CONTAINING_RECORD(iface
, VfwCapture
, IAMStreamConfig_iface
);
76 static inline VfwCapture
*impl_from_IAMVideoProcAmp(IAMVideoProcAmp
*iface
)
78 return CONTAINING_RECORD(iface
, VfwCapture
, IAMVideoProcAmp_iface
);
81 static inline VfwCapture
*impl_from_IPersistPropertyBag(IPersistPropertyBag
*iface
)
83 return CONTAINING_RECORD(iface
, VfwCapture
, IPersistPropertyBag_iface
);
86 /* VfwPin implementation */
87 typedef struct VfwPinImpl
92 const IKsPropertySetVtbl
* KSP_VT
;
95 static IPin
* WINAPI
VfwCapture_GetPin(BaseFilter
*iface
, int pos
)
97 VfwCapture
*This
= (VfwCapture
*)iface
;
99 if (pos
>= 1 || pos
< 0)
102 IPin_AddRef(This
->pOutputPin
);
103 return This
->pOutputPin
;
106 static LONG WINAPI
VfwCapture_GetPinCount(BaseFilter
*iface
)
111 static const BaseFilterFuncTable BaseFuncTable
= {
113 VfwCapture_GetPinCount
116 IUnknown
* WINAPI
QCAP_createVFWCaptureFilter(IUnknown
*pUnkOuter
, HRESULT
*phr
)
118 VfwCapture
*pVfwCapture
;
121 TRACE("%p - %p\n", pUnkOuter
, phr
);
123 *phr
= CLASS_E_NOAGGREGATION
;
126 *phr
= E_OUTOFMEMORY
;
128 pVfwCapture
= CoTaskMemAlloc( sizeof(VfwCapture
) );
133 BaseFilter_Init(&pVfwCapture
->filter
, &VfwCapture_Vtbl
, &CLSID_VfwCapture
, (DWORD_PTR
)(__FILE__
": VfwCapture.csFilter"), &BaseFuncTable
);
135 pVfwCapture
->IAMStreamConfig_iface
.lpVtbl
= &IAMStreamConfig_VTable
;
136 pVfwCapture
->IAMVideoProcAmp_iface
.lpVtbl
= &IAMVideoProcAmp_VTable
;
137 pVfwCapture
->IPersistPropertyBag_iface
.lpVtbl
= &IPersistPropertyBag_VTable
;
138 pVfwCapture
->init
= FALSE
;
140 hr
= VfwPin_Construct(&pVfwCapture
->filter
.IBaseFilter_iface
,
141 &pVfwCapture
->filter
.csFilter
, &pVfwCapture
->pOutputPin
);
144 CoTaskMemFree(pVfwCapture
);
147 TRACE("-- created at %p\n", pVfwCapture
);
149 ObjectRefCount(TRUE
);
151 return (IUnknown
*)pVfwCapture
;
154 static HRESULT WINAPI
VfwCapture_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
156 VfwCapture
*This
= (VfwCapture
*)iface
;
157 TRACE("(%s, %p)\n", debugstr_guid(riid
), ppv
);
160 if (IsEqualIID(riid
, &IID_IUnknown
) ||
161 IsEqualIID(riid
, &IID_IPersist
) ||
162 IsEqualIID(riid
, &IID_IMediaFilter
) ||
163 IsEqualIID(riid
, &IID_IBaseFilter
))
167 else if (IsEqualIID(riid
, &IID_IAMStreamConfig
))
168 *ppv
= &This
->IAMStreamConfig_iface
;
169 else if (IsEqualIID(riid
, &IID_IAMVideoProcAmp
))
170 *ppv
= &This
->IAMVideoProcAmp_iface
;
171 else if (IsEqualIID(riid
, &IID_IPersistPropertyBag
))
172 *ppv
= &This
->IPersistPropertyBag_iface
;
174 if (!IsEqualIID(riid
, &IID_IUnknown
) &&
175 !IsEqualIID(riid
, &IID_IPersist
) &&
176 !IsEqualIID(riid
, &IID_IPersistPropertyBag
) &&
179 FIXME("Capture system not initialised when looking for %s, "
180 "trying it on primary device now\n", debugstr_guid(riid
));
181 This
->driver_info
= qcap_driver_init( This
->pOutputPin
, 0 );
182 if (!This
->driver_info
)
184 ERR("VfwCapture initialisation failed\n");
192 TRACE("Returning %s interface\n", debugstr_guid(riid
));
193 IUnknown_AddRef((IUnknown
*)(*ppv
));
197 FIXME("No interface for %s!\n", debugstr_guid(riid
));
198 return E_NOINTERFACE
;
201 static ULONG WINAPI
VfwCapture_Release(IBaseFilter
* iface
)
203 VfwCapture
*This
= (VfwCapture
*)iface
;
204 ULONG refCount
= InterlockedDecrement(&This
->filter
.refCount
);
206 TRACE("%p->() New refcount: %d\n", This
, refCount
);
212 TRACE("destroying everything\n");
215 if (This
->filter
.state
!= State_Stopped
)
216 qcap_driver_stop(This
->driver_info
, &This
->filter
.state
);
217 qcap_driver_destroy(This
->driver_info
);
219 pin
= (BasePin
*) This
->pOutputPin
;
220 if (pin
->pConnectedTo
!= NULL
)
222 IPin_Disconnect(pin
->pConnectedTo
);
223 IPin_Disconnect(This
->pOutputPin
);
225 IPin_Release(This
->pOutputPin
);
226 BaseFilter_Destroy(&This
->filter
);
228 ObjectRefCount(FALSE
);
233 /** IMediaFilter methods **/
235 static HRESULT WINAPI
VfwCapture_Stop(IBaseFilter
* iface
)
237 VfwCapture
*This
= (VfwCapture
*)iface
;
240 return qcap_driver_stop(This
->driver_info
, &This
->filter
.state
);
243 static HRESULT WINAPI
VfwCapture_Pause(IBaseFilter
* iface
)
245 VfwCapture
*This
= (VfwCapture
*)iface
;
248 return qcap_driver_pause(This
->driver_info
, &This
->filter
.state
);
251 static HRESULT WINAPI
VfwCapture_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
253 VfwCapture
*This
= (VfwCapture
*)iface
;
254 TRACE("(%x%08x)\n", (ULONG
)(tStart
>> 32), (ULONG
)tStart
);
255 return qcap_driver_run(This
->driver_info
, &This
->filter
.state
);
258 /** IBaseFilter methods **/
259 static HRESULT WINAPI
VfwCapture_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
261 FIXME("(%s, %p) - stub\n", debugstr_w(Id
), ppPin
);
265 static const IBaseFilterVtbl VfwCapture_Vtbl
=
267 VfwCapture_QueryInterface
,
268 BaseFilterImpl_AddRef
,
270 BaseFilterImpl_GetClassID
,
274 BaseFilterImpl_GetState
,
275 BaseFilterImpl_SetSyncSource
,
276 BaseFilterImpl_GetSyncSource
,
277 BaseFilterImpl_EnumPins
,
279 BaseFilterImpl_QueryFilterInfo
,
280 BaseFilterImpl_JoinFilterGraph
,
281 BaseFilterImpl_QueryVendorInfo
284 /* AMStreamConfig interface, we only need to implement {G,S}etFormat */
285 static HRESULT WINAPI
286 AMStreamConfig_QueryInterface( IAMStreamConfig
* iface
, REFIID riid
, LPVOID
* ppv
)
288 VfwCapture
*This
= impl_from_IAMStreamConfig(iface
);
290 TRACE("%p --> %s\n", This
, debugstr_guid(riid
));
292 if (IsEqualIID(riid
, &IID_IUnknown
) ||
293 IsEqualIID(riid
, &IID_IAMStreamConfig
))
295 IAMStreamConfig_AddRef(iface
);
300 FIXME("No interface for iid %s\n", debugstr_guid(riid
));
301 return E_NOINTERFACE
;
304 static ULONG WINAPI
AMStreamConfig_AddRef( IAMStreamConfig
* iface
)
306 VfwCapture
*This
= impl_from_IAMStreamConfig(iface
);
308 TRACE("%p --> Forwarding to VfwCapture (%p)\n", iface
, This
);
309 return IUnknown_AddRef((IUnknown
*)This
);
312 static ULONG WINAPI
AMStreamConfig_Release( IAMStreamConfig
* iface
)
314 VfwCapture
*This
= impl_from_IAMStreamConfig(iface
);
316 TRACE("%p --> Forwarding to VfwCapture (%p)\n", iface
, This
);
317 return IUnknown_Release((IUnknown
*)This
);
320 static HRESULT WINAPI
321 AMStreamConfig_SetFormat(IAMStreamConfig
*iface
, AM_MEDIA_TYPE
*pmt
)
324 VfwCapture
*This
= impl_from_IAMStreamConfig(iface
);
327 TRACE("(%p): %p->%p\n", iface
, pmt
, pmt
? pmt
->pbFormat
: NULL
);
329 if (This
->filter
.state
!= State_Stopped
)
331 TRACE("Returning not stopped error\n");
332 return VFW_E_NOT_STOPPED
;
337 TRACE("pmt is NULL\n");
341 dump_AM_MEDIA_TYPE(pmt
);
343 pin
= (BasePin
*)This
->pOutputPin
;
344 if (pin
->pConnectedTo
!= NULL
)
346 hr
= IPin_QueryAccept(pin
->pConnectedTo
, pmt
);
347 TRACE("Would accept: %d\n", hr
);
349 return VFW_E_INVALIDMEDIATYPE
;
352 hr
= qcap_driver_set_format(This
->driver_info
, pmt
);
353 if (SUCCEEDED(hr
) && This
->filter
.filterInfo
.pGraph
&& pin
->pConnectedTo
)
355 hr
= IFilterGraph_Reconnect(This
->filter
.filterInfo
.pGraph
, This
->pOutputPin
);
357 TRACE("Reconnection completed, with new media format..\n");
359 TRACE("Returning: %d\n", hr
);
363 static HRESULT WINAPI
364 AMStreamConfig_GetFormat( IAMStreamConfig
*iface
, AM_MEDIA_TYPE
**pmt
)
366 VfwCapture
*This
= impl_from_IAMStreamConfig(iface
);
368 TRACE("%p -> (%p)\n", iface
, pmt
);
369 return qcap_driver_get_format(This
->driver_info
, pmt
);
372 static HRESULT WINAPI
373 AMStreamConfig_GetNumberOfCapabilities( IAMStreamConfig
*iface
, int *piCount
,
376 FIXME("%p: %p %p - stub, intentional\n", iface
, piCount
, piSize
);
378 return E_NOTIMPL
; /* Not implemented for this interface */
381 static HRESULT WINAPI
382 AMStreamConfig_GetStreamCaps( IAMStreamConfig
*iface
, int iIndex
,
383 AM_MEDIA_TYPE
**pmt
, BYTE
*pSCC
)
385 FIXME("%p: %d %p %p - stub, intentional\n", iface
, iIndex
, pmt
, pSCC
);
386 return E_NOTIMPL
; /* Not implemented for this interface */
389 static const IAMStreamConfigVtbl IAMStreamConfig_VTable
=
391 AMStreamConfig_QueryInterface
,
392 AMStreamConfig_AddRef
,
393 AMStreamConfig_Release
,
394 AMStreamConfig_SetFormat
,
395 AMStreamConfig_GetFormat
,
396 AMStreamConfig_GetNumberOfCapabilities
,
397 AMStreamConfig_GetStreamCaps
400 static HRESULT WINAPI
401 AMVideoProcAmp_QueryInterface( IAMVideoProcAmp
* iface
, REFIID riid
,
404 if (IsEqualIID(riid
, &IID_IUnknown
) ||
405 IsEqualIID(riid
, &IID_IAMVideoProcAmp
))
408 IAMVideoProcAmp_AddRef( iface
);
412 FIXME("No interface for iid %s\n", debugstr_guid(riid
));
413 return E_NOINTERFACE
;
416 static ULONG WINAPI
AMVideoProcAmp_AddRef(IAMVideoProcAmp
* iface
)
418 VfwCapture
*This
= impl_from_IAMVideoProcAmp(iface
);
420 return IUnknown_AddRef((IUnknown
*)This
);
423 static ULONG WINAPI
AMVideoProcAmp_Release(IAMVideoProcAmp
* iface
)
425 VfwCapture
*This
= impl_from_IAMVideoProcAmp(iface
);
427 return IUnknown_Release((IUnknown
*)This
);
430 static HRESULT WINAPI
431 AMVideoProcAmp_GetRange( IAMVideoProcAmp
* iface
, LONG Property
, LONG
*pMin
,
432 LONG
*pMax
, LONG
*pSteppingDelta
, LONG
*pDefault
, LONG
*pCapsFlags
)
434 VfwCapture
*This
= impl_from_IAMVideoProcAmp(iface
);
436 return qcap_driver_get_prop_range( This
->driver_info
, Property
, pMin
, pMax
,
437 pSteppingDelta
, pDefault
, pCapsFlags
);
440 static HRESULT WINAPI
441 AMVideoProcAmp_Set( IAMVideoProcAmp
* iface
, LONG Property
, LONG lValue
,
444 VfwCapture
*This
= impl_from_IAMVideoProcAmp(iface
);
446 return qcap_driver_set_prop(This
->driver_info
, Property
, lValue
, Flags
);
449 static HRESULT WINAPI
450 AMVideoProcAmp_Get( IAMVideoProcAmp
* iface
, LONG Property
, LONG
*lValue
,
453 VfwCapture
*This
= impl_from_IAMVideoProcAmp(iface
);
455 return qcap_driver_get_prop(This
->driver_info
, Property
, lValue
, Flags
);
458 static const IAMVideoProcAmpVtbl IAMVideoProcAmp_VTable
=
460 AMVideoProcAmp_QueryInterface
,
461 AMVideoProcAmp_AddRef
,
462 AMVideoProcAmp_Release
,
463 AMVideoProcAmp_GetRange
,
468 static HRESULT WINAPI
469 PPB_QueryInterface( IPersistPropertyBag
* iface
, REFIID riid
, LPVOID
* ppv
)
471 if (IsEqualIID(riid
, &IID_IUnknown
) ||
472 IsEqualIID(riid
, &IID_IPersist
) ||
473 IsEqualIID(riid
, &IID_IPersistPropertyBag
))
475 IPersistPropertyBag_AddRef(iface
);
479 if (IsEqualIID(riid
, &IID_IBaseFilter
))
481 /* FIXME: native devenum asks for IBaseFilter, should we return it? */
482 IPersistPropertyBag_AddRef(iface
);
487 FIXME("No interface for iid %s\n", debugstr_guid(riid
));
488 return E_NOINTERFACE
;
491 static ULONG WINAPI
PPB_AddRef(IPersistPropertyBag
* iface
)
493 VfwCapture
*This
= impl_from_IPersistPropertyBag(iface
);
495 TRACE("%p --> Forwarding to VfwCapture (%p)\n", iface
, This
);
497 return IUnknown_AddRef((IUnknown
*)This
);
500 static ULONG WINAPI
PPB_Release(IPersistPropertyBag
* iface
)
502 VfwCapture
*This
= impl_from_IPersistPropertyBag(iface
);
504 TRACE("%p --> Forwarding to VfwCapture (%p)\n", iface
, This
);
506 return IUnknown_Release((IUnknown
*)This
);
509 static HRESULT WINAPI
510 PPB_GetClassID( IPersistPropertyBag
* iface
, CLSID
* pClassID
)
512 VfwCapture
*This
= impl_from_IPersistPropertyBag(iface
);
514 FIXME("%p - stub\n", This
);
519 static HRESULT WINAPI
PPB_InitNew(IPersistPropertyBag
* iface
)
521 VfwCapture
*This
= impl_from_IPersistPropertyBag(iface
);
523 FIXME("%p - stub\n", This
);
528 static HRESULT WINAPI
529 PPB_Load( IPersistPropertyBag
* iface
, IPropertyBag
*pPropBag
,
530 IErrorLog
*pErrorLog
)
532 VfwCapture
*This
= impl_from_IPersistPropertyBag(iface
);
535 const OLECHAR VFWIndex
[] = {'V','F','W','I','n','d','e','x',0};
537 TRACE("%p/%p-> (%p, %p)\n", iface
, This
, pPropBag
, pErrorLog
);
540 hr
= IPropertyBag_Read(pPropBag
, VFWIndex
, &var
, pErrorLog
);
546 This
->driver_info
= qcap_driver_init( This
->pOutputPin
,
547 var
.__VARIANT_NAME_1
.__VARIANT_NAME_2
.__VARIANT_NAME_3
.ulVal
);
548 if (This
->driver_info
)
550 pin
= (VfwPinImpl
*)This
->pOutputPin
;
551 pin
->driver_info
= This
->driver_info
;
563 static HRESULT WINAPI
564 PPB_Save( IPersistPropertyBag
* iface
, IPropertyBag
*pPropBag
,
565 BOOL fClearDirty
, BOOL fSaveAllProperties
)
567 VfwCapture
*This
= impl_from_IPersistPropertyBag(iface
);
568 FIXME("%p - stub\n", This
);
572 static const IPersistPropertyBagVtbl IPersistPropertyBag_VTable
=
583 /* IKsPropertySet interface */
584 static HRESULT WINAPI
585 KSP_QueryInterface( IKsPropertySet
* iface
, REFIID riid
, LPVOID
* ppv
)
587 if (IsEqualIID(riid
, &IID_IUnknown
) ||
588 IsEqualIID(riid
, &IID_IKsPropertySet
))
591 IKsPropertySet_AddRef( iface
);
595 FIXME("No interface for iid %s\n", debugstr_guid(riid
));
596 return E_NOINTERFACE
;
599 static ULONG WINAPI
KSP_AddRef(IKsPropertySet
* iface
)
601 ICOM_THIS_MULTI(VfwPinImpl
, KSP_VT
, iface
);
603 TRACE("%p --> Forwarding to VfwPin (%p)\n", iface
, This
);
605 return IUnknown_AddRef((IUnknown
*)This
);
608 static ULONG WINAPI
KSP_Release(IKsPropertySet
* iface
)
610 ICOM_THIS_MULTI(VfwPinImpl
, KSP_VT
, iface
);
612 TRACE("%p --> Forwarding to VfwPin (%p)\n", iface
, This
);
614 return IUnknown_Release((IUnknown
*)This
);
617 static HRESULT WINAPI
618 KSP_Set( IKsPropertySet
* iface
, REFGUID guidPropSet
, DWORD dwPropID
,
619 LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
,
622 FIXME("%p: stub\n", iface
);
626 static HRESULT WINAPI
627 KSP_Get( IKsPropertySet
* iface
, REFGUID guidPropSet
, DWORD dwPropID
,
628 LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
,
629 DWORD cbPropData
, DWORD
*pcbReturned
)
635 if (!IsEqualIID(guidPropSet
, &ROPSETID_Pin
))
636 return E_PROP_SET_UNSUPPORTED
;
637 if (pPropData
== NULL
&& pcbReturned
== NULL
)
640 *pcbReturned
= sizeof(GUID
);
641 if (pPropData
== NULL
)
643 if (cbPropData
< sizeof(GUID
))
646 *pGuid
= PIN_CATEGORY_CAPTURE
;
647 FIXME("() Not adding a pin with PIN_CATEGORY_PREVIEW\n");
651 static HRESULT WINAPI
652 KSP_QuerySupported( IKsPropertySet
* iface
, REFGUID guidPropSet
,
653 DWORD dwPropID
, DWORD
*pTypeSupport
)
655 FIXME("%p: stub\n", iface
);
659 static const IKsPropertySetVtbl KSP_VTable
=
669 static HRESULT WINAPI
VfwPin_GetMediaType(BasePin
*iface
, int iPosition
, AM_MEDIA_TYPE
*pmt
)
671 VfwPinImpl
*This
= (VfwPinImpl
*)iface
;
672 AM_MEDIA_TYPE
*vfw_pmt
;
678 return VFW_S_NO_MORE_ITEMS
;
680 hr
= qcap_driver_get_format(This
->driver_info
, &vfw_pmt
);
682 CopyMediaType(pmt
, vfw_pmt
);
683 DeleteMediaType(vfw_pmt
);
688 static LONG WINAPI
VfwPin_GetMediaTypeVersion(BasePin
*iface
)
693 static HRESULT WINAPI
VfwPin_DecideBufferSize(BaseOutputPin
*iface
, IMemAllocator
*pAlloc
, ALLOCATOR_PROPERTIES
*ppropInputRequest
)
695 ALLOCATOR_PROPERTIES actual
;
697 /* What we put here doesn't matter, the
698 driver function should override it then commit */
699 if (!ppropInputRequest
->cBuffers
)
700 ppropInputRequest
->cBuffers
= 3;
701 if (!ppropInputRequest
->cbBuffer
)
702 ppropInputRequest
->cbBuffer
= 230400;
703 if (!ppropInputRequest
->cbAlign
)
704 ppropInputRequest
->cbAlign
= 1;
706 return IMemAllocator_SetProperties(pAlloc
, ppropInputRequest
, &actual
);
709 static const BaseOutputPinFuncTable output_BaseOutputFuncTable
= {
712 BaseOutputPinImpl_AttemptConnection
,
713 VfwPin_GetMediaTypeVersion
,
716 VfwPin_DecideBufferSize
,
717 BaseOutputPinImpl_DecideAllocator
,
718 BaseOutputPinImpl_BreakConnect
722 VfwPin_Construct( IBaseFilter
* pBaseFilter
, LPCRITICAL_SECTION pCritSec
,
725 static const WCHAR wszOutputPinName
[] = { 'O','u','t','p','u','t',0 };
731 piOutput
.dir
= PINDIR_OUTPUT
;
732 piOutput
.pFilter
= pBaseFilter
;
733 lstrcpyW(piOutput
.achName
, wszOutputPinName
);
735 hr
= BaseOutputPin_Construct(&VfwPin_Vtbl
, sizeof(VfwPinImpl
), &piOutput
, &output_BaseOutputFuncTable
, pCritSec
, ppPin
);
739 VfwPinImpl
*pPinImpl
= (VfwPinImpl
*)*ppPin
;
740 pPinImpl
->KSP_VT
= &KSP_VTable
;
741 ObjectRefCount(TRUE
);
747 static HRESULT WINAPI
VfwPin_QueryInterface(IPin
* iface
, REFIID riid
, LPVOID
* ppv
)
749 VfwPinImpl
*This
= (VfwPinImpl
*)iface
;
751 TRACE("%s %p\n", debugstr_guid(riid
), ppv
);
754 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IPin
))
756 else if (IsEqualIID(riid
, &IID_IKsPropertySet
))
757 *ppv
= &(This
->KSP_VT
);
758 else if (IsEqualIID(riid
, &IID_IAMStreamConfig
))
759 return IUnknown_QueryInterface((IUnknown
*)This
->parent
, riid
, ppv
);
763 IUnknown_AddRef((IUnknown
*)(*ppv
));
767 FIXME("No interface for %s!\n", debugstr_guid(riid
));
768 return E_NOINTERFACE
;
772 VfwPin_Release(IPin
* iface
)
774 VfwPinImpl
*This
= (VfwPinImpl
*)iface
;
775 ULONG refCount
= InterlockedDecrement(&This
->pin
.pin
.refCount
);
777 TRACE("() -> new refcount: %u\n", refCount
);
781 BaseOutputPin_Destroy(&This
->pin
);
782 ObjectRefCount(FALSE
);
787 static HRESULT WINAPI
788 VfwPin_EnumMediaTypes(IPin
* iface
, IEnumMediaTypes
** ppEnum
)
793 VfwPinImpl
*This
= (VfwPinImpl
*)iface
;
794 hr
= qcap_driver_get_format(This
->driver_info
, &pmt
);
796 hr
= BasePinImpl_EnumMediaTypes(iface
, ppEnum
);
797 DeleteMediaType(pmt
);
799 TRACE("%p -- %x\n", This
, hr
);
803 static HRESULT WINAPI
804 VfwPin_QueryInternalConnections(IPin
* iface
, IPin
** apPin
, ULONG
* cPin
)
806 TRACE("(%p)->(%p, %p)\n", iface
, apPin
, cPin
);
810 static const IPinVtbl VfwPin_Vtbl
=
812 VfwPin_QueryInterface
,
815 BaseOutputPinImpl_Connect
,
816 BaseOutputPinImpl_ReceiveConnection
,
817 BaseOutputPinImpl_Disconnect
,
818 BasePinImpl_ConnectedTo
,
819 BasePinImpl_ConnectionMediaType
,
820 BasePinImpl_QueryPinInfo
,
821 BasePinImpl_QueryDirection
,
823 BasePinImpl_QueryAccept
,
824 VfwPin_EnumMediaTypes
,
825 VfwPin_QueryInternalConnections
,
826 BaseOutputPinImpl_EndOfStream
,
827 BaseOutputPinImpl_BeginFlush
,
828 BaseOutputPinImpl_EndFlush
,
829 BasePinImpl_NewSegment