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
21 #define NONAMELESSSTRUCT
22 #define NONAMELESSUNION
35 #include "qcap_main.h"
36 #include "wine/debug.h"
49 WINE_DEFAULT_DEBUG_CHANNEL(qcap
);
51 #define ICOM_THIS_MULTI(impl,field,iface) \
52 impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
54 static const IBaseFilterVtbl VfwCapture_Vtbl
;
55 static const IAMStreamConfigVtbl IAMStreamConfig_VTable
;
56 static const IAMVideoProcAmpVtbl IAMVideoProcAmp_VTable
;
57 static const IPersistPropertyBagVtbl IPersistPropertyBag_VTable
;
58 static const IPinVtbl VfwPin_Vtbl
;
60 static HRESULT
VfwPin_Construct( IBaseFilter
*, LPCRITICAL_SECTION
, IPin
** );
62 typedef struct VfwCapture
64 const IBaseFilterVtbl
* lpVtbl
;
65 const IAMStreamConfigVtbl
* IAMStreamConfig_vtbl
;
66 const IAMVideoProcAmpVtbl
* IAMVideoProcAmp_vtbl
;
67 const IPersistPropertyBagVtbl
* IPersistPropertyBag_vtbl
;
72 FILTER_INFO filterInfo
;
74 CRITICAL_SECTION csFilter
;
79 /* VfwPin implementation */
80 typedef struct VfwPinImpl
84 const IKsPropertySetVtbl
* KSP_VT
;
88 IUnknown
* WINAPI
QCAP_createVFWCaptureFilter(IUnknown
*pUnkOuter
, HRESULT
*phr
)
90 VfwCapture
*pVfwCapture
;
93 TRACE("%p - %p\n", pUnkOuter
, phr
);
95 *phr
= CLASS_E_NOAGGREGATION
;
100 pVfwCapture
= CoTaskMemAlloc( sizeof(VfwCapture
) );
105 pVfwCapture
->lpVtbl
= &VfwCapture_Vtbl
;
106 pVfwCapture
->IAMStreamConfig_vtbl
= &IAMStreamConfig_VTable
;
107 pVfwCapture
->IAMVideoProcAmp_vtbl
= &IAMVideoProcAmp_VTable
;
108 pVfwCapture
->IPersistPropertyBag_vtbl
= &IPersistPropertyBag_VTable
;
109 pVfwCapture
->refCount
= 1;
110 pVfwCapture
->filterInfo
.achName
[0] = '\0';
111 pVfwCapture
->filterInfo
.pGraph
= NULL
;
112 pVfwCapture
->state
= State_Stopped
;
113 pVfwCapture
->init
= FALSE
;
114 InitializeCriticalSection(&pVfwCapture
->csFilter
);
115 hr
= VfwPin_Construct((IBaseFilter
*)&pVfwCapture
->lpVtbl
,
116 &pVfwCapture
->csFilter
, &pVfwCapture
->pOutputPin
);
119 CoTaskMemFree(pVfwCapture
);
122 TRACE("-- created at %p\n", pVfwCapture
);
124 ObjectRefCount(TRUE
);
126 return (IUnknown
*)pVfwCapture
;
129 static HRESULT WINAPI
VfwCapture_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
131 VfwCapture
*This
= (VfwCapture
*)iface
;
132 TRACE("(%s, %p)\n", debugstr_guid(riid
), ppv
);
135 if (IsEqualIID(riid
, &IID_IUnknown
) ||
136 IsEqualIID(riid
, &IID_IPersist
) ||
137 IsEqualIID(riid
, &IID_IMediaFilter
) ||
138 IsEqualIID(riid
, &IID_IBaseFilter
))
142 else if (IsEqualIID(riid
, &IID_IAMStreamConfig
))
143 *ppv
= &(This
->IAMStreamConfig_vtbl
);
144 else if (IsEqualIID(riid
, &IID_IAMVideoProcAmp
))
145 *ppv
= &(This
->IAMVideoProcAmp_vtbl
);
146 else if (IsEqualIID(riid
, &IID_IPersistPropertyBag
))
147 *ppv
= &(This
->IPersistPropertyBag_vtbl
);
149 if (!IsEqualIID(riid
, &IID_IUnknown
) &&
150 !IsEqualIID(riid
, &IID_IPersist
) &&
151 !IsEqualIID(riid
, &IID_IPersistPropertyBag
) &&
154 FIXME("Capture system not initialised when looking for %s, "
155 "trying it on primary device now\n", debugstr_guid(riid
));
156 This
->driver_info
= qcap_driver_init( This
->pOutputPin
, 0 );
157 if (!This
->driver_info
)
159 ERR("VfwCapture initialisation failed\n");
167 TRACE("Returning %s interface\n", debugstr_guid(riid
));
168 IUnknown_AddRef((IUnknown
*)(*ppv
));
172 FIXME("No interface for %s!\n", debugstr_guid(riid
));
173 return E_NOINTERFACE
;
176 static ULONG WINAPI
VfwCapture_AddRef(IBaseFilter
* iface
)
178 VfwCapture
*This
= (VfwCapture
*)iface
;
179 ULONG refCount
= InterlockedIncrement(&This
->refCount
);
181 TRACE("%p->() New refcount: %d\n", This
, refCount
);
186 static ULONG WINAPI
VfwCapture_Release(IBaseFilter
* iface
)
188 VfwCapture
*This
= (VfwCapture
*)iface
;
189 ULONG refCount
= InterlockedDecrement(&This
->refCount
);
191 TRACE("%p->() New refcount: %d\n", This
, refCount
);
197 TRACE("destroying everything\n");
200 if (This
->state
!= State_Stopped
)
201 qcap_driver_stop(This
->driver_info
, &This
->state
);
202 qcap_driver_destroy(This
->driver_info
);
204 pin
= (IPinImpl
*) This
->pOutputPin
;
205 if (pin
->pConnectedTo
!= NULL
)
207 IPin_Disconnect(pin
->pConnectedTo
);
208 IPin_Disconnect(This
->pOutputPin
);
210 IPin_Release(This
->pOutputPin
);
211 DeleteCriticalSection(&This
->csFilter
);
214 ObjectRefCount(FALSE
);
219 /** IPersist methods **/
221 static HRESULT WINAPI
VfwCapture_GetClassID(IBaseFilter
* iface
, CLSID
* pClsid
)
223 TRACE("(%p)\n", pClsid
);
224 *pClsid
= CLSID_VfwCapture
;
228 /** IMediaFilter methods **/
230 static HRESULT WINAPI
VfwCapture_Stop(IBaseFilter
* iface
)
232 VfwCapture
*This
= (VfwCapture
*)iface
;
235 return qcap_driver_stop(This
->driver_info
, &This
->state
);
238 static HRESULT WINAPI
VfwCapture_Pause(IBaseFilter
* iface
)
240 VfwCapture
*This
= (VfwCapture
*)iface
;
243 return qcap_driver_pause(This
->driver_info
, &This
->state
);
246 static HRESULT WINAPI
VfwCapture_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
248 VfwCapture
*This
= (VfwCapture
*)iface
;
249 TRACE("(%x%08x)\n", (ULONG
)(tStart
>> 32), (ULONG
)tStart
);
250 return qcap_driver_run(This
->driver_info
, &This
->state
);
253 static HRESULT WINAPI
254 VfwCapture_GetState( IBaseFilter
* iface
, DWORD dwMilliSecsTimeout
,
255 FILTER_STATE
*pState
)
257 VfwCapture
*This
= (VfwCapture
*)iface
;
259 TRACE("(%u, %p)\n", dwMilliSecsTimeout
, pState
);
261 *pState
= This
->state
;
265 static HRESULT WINAPI
266 VfwCapture_SetSyncSource(IBaseFilter
* iface
, IReferenceClock
*pClock
)
268 TRACE("(%p)\n", pClock
);
273 static HRESULT WINAPI
274 VfwCapture_GetSyncSource(IBaseFilter
* iface
, IReferenceClock
**ppClock
)
276 TRACE("(%p)\n", ppClock
);
281 /** IBaseFilter methods **/
283 static HRESULT WINAPI
284 VfwCapture_EnumPins(IBaseFilter
* iface
, IEnumPins
**ppEnum
)
287 VfwCapture
*This
= (VfwCapture
*)iface
;
289 TRACE("(%p)\n", ppEnum
);
292 epd
.ppPins
= &This
->pOutputPin
;
293 return IEnumPinsImpl_Construct(&epd
, ppEnum
);
296 static HRESULT WINAPI
VfwCapture_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
298 FIXME("(%s, %p) - stub\n", debugstr_w(Id
), ppPin
);
302 static HRESULT WINAPI
VfwCapture_QueryFilterInfo(IBaseFilter
* iface
, FILTER_INFO
*pInfo
)
304 VfwCapture
*This
= (VfwCapture
*)iface
;
306 TRACE("(%p)\n", pInfo
);
308 lstrcpyW(pInfo
->achName
, This
->filterInfo
.achName
);
309 pInfo
->pGraph
= This
->filterInfo
.pGraph
;
312 IFilterGraph_AddRef(pInfo
->pGraph
);
316 static HRESULT WINAPI
317 VfwCapture_JoinFilterGraph( IBaseFilter
* iface
, IFilterGraph
*pGraph
, LPCWSTR pName
)
319 VfwCapture
*This
= (VfwCapture
*)iface
;
321 TRACE("(%p, %s)\n", pGraph
, debugstr_w(pName
));
324 lstrcpyW(This
->filterInfo
.achName
, pName
);
326 *This
->filterInfo
.achName
= 0;
327 This
->filterInfo
.pGraph
= pGraph
; /* NOTE: do NOT increase ref. count */
332 static HRESULT WINAPI
333 VfwCapture_QueryVendorInfo(IBaseFilter
* iface
, LPWSTR
*pVendorInfo
)
335 FIXME("(%p) - stub\n", pVendorInfo
);
339 static const IBaseFilterVtbl VfwCapture_Vtbl
=
341 VfwCapture_QueryInterface
,
344 VfwCapture_GetClassID
,
349 VfwCapture_SetSyncSource
,
350 VfwCapture_GetSyncSource
,
353 VfwCapture_QueryFilterInfo
,
354 VfwCapture_JoinFilterGraph
,
355 VfwCapture_QueryVendorInfo
358 /* AMStreamConfig interface, we only need to implement {G,S}etFormat */
359 static HRESULT WINAPI
360 AMStreamConfig_QueryInterface( IAMStreamConfig
* iface
, REFIID riid
, LPVOID
* ppv
)
362 ICOM_THIS_MULTI(VfwCapture
, IAMStreamConfig_vtbl
, iface
);
364 TRACE("%p --> %s\n", This
, debugstr_guid(riid
));
366 if (IsEqualIID(riid
, &IID_IUnknown
) ||
367 IsEqualIID(riid
, &IID_IAMStreamConfig
))
369 IAMStreamConfig_AddRef(iface
);
374 FIXME("No interface for iid %s\n", debugstr_guid(riid
));
375 return E_NOINTERFACE
;
378 static ULONG WINAPI
AMStreamConfig_AddRef( IAMStreamConfig
* iface
)
380 ICOM_THIS_MULTI(VfwCapture
, IAMStreamConfig_vtbl
, iface
);
382 TRACE("%p --> Forwarding to VfwCapture (%p)\n", iface
, This
);
383 return IUnknown_AddRef((IUnknown
*)This
);
386 static ULONG WINAPI
AMStreamConfig_Release( IAMStreamConfig
* iface
)
388 ICOM_THIS_MULTI(VfwCapture
, IAMStreamConfig_vtbl
, iface
);
390 TRACE("%p --> Forwarding to VfwCapture (%p)\n", iface
, This
);
391 return IUnknown_Release((IUnknown
*)This
);
394 static HRESULT WINAPI
395 AMStreamConfig_SetFormat(IAMStreamConfig
*iface
, AM_MEDIA_TYPE
*pmt
)
398 ICOM_THIS_MULTI(VfwCapture
, IAMStreamConfig_vtbl
, iface
);
401 TRACE("(%p): %p->%p\n", iface
, pmt
, pmt
->pbFormat
);
403 if (This
->state
!= State_Stopped
)
405 TRACE("Returning not stopped error\n");
406 return VFW_E_NOT_STOPPED
;
409 dump_AM_MEDIA_TYPE(pmt
);
411 pin
= (IPinImpl
*)This
->pOutputPin
;
412 if (pin
->pConnectedTo
!= NULL
)
414 hr
= IPin_QueryAccept(pin
->pConnectedTo
, pmt
);
415 TRACE("Would accept: %d\n", hr
);
417 return VFW_E_INVALIDMEDIATYPE
;
420 hr
= qcap_driver_set_format(This
->driver_info
, pmt
);
421 if (SUCCEEDED(hr
) && This
->filterInfo
.pGraph
&& pin
->pConnectedTo
)
423 hr
= IFilterGraph_Reconnect(This
->filterInfo
.pGraph
, This
->pOutputPin
);
425 TRACE("Reconnection completed, with new media format..\n");
427 TRACE("Returning: %d\n", hr
);
431 static HRESULT WINAPI
432 AMStreamConfig_GetFormat( IAMStreamConfig
*iface
, AM_MEDIA_TYPE
**pmt
)
434 ICOM_THIS_MULTI(VfwCapture
, IAMStreamConfig_vtbl
, iface
);
436 TRACE("%p -> (%p)\n", iface
, pmt
);
437 return qcap_driver_get_format(This
->driver_info
, pmt
);
440 static HRESULT WINAPI
441 AMStreamConfig_GetNumberOfCapabilities( IAMStreamConfig
*iface
, int *piCount
,
444 FIXME("%p: %p %p - stub, intentional\n", iface
, piCount
, piSize
);
445 return E_NOTIMPL
; /* Not implemented for this interface */
448 static HRESULT WINAPI
449 AMStreamConfig_GetStreamCaps( IAMStreamConfig
*iface
, int iIndex
,
450 AM_MEDIA_TYPE
**pmt
, BYTE
*pSCC
)
452 FIXME("%p: %d %p %p - stub, intentional\n", iface
, iIndex
, pmt
, pSCC
);
453 return E_NOTIMPL
; /* Not implemented for this interface */
456 static const IAMStreamConfigVtbl IAMStreamConfig_VTable
=
458 AMStreamConfig_QueryInterface
,
459 AMStreamConfig_AddRef
,
460 AMStreamConfig_Release
,
461 AMStreamConfig_SetFormat
,
462 AMStreamConfig_GetFormat
,
463 AMStreamConfig_GetNumberOfCapabilities
,
464 AMStreamConfig_GetStreamCaps
467 static HRESULT WINAPI
468 AMVideoProcAmp_QueryInterface( IAMVideoProcAmp
* iface
, REFIID riid
,
471 if (IsEqualIID(riid
, &IID_IUnknown
) ||
472 IsEqualIID(riid
, &IID_IAMVideoProcAmp
))
475 IAMVideoProcAmp_AddRef( iface
);
479 FIXME("No interface for iid %s\n", debugstr_guid(riid
));
480 return E_NOINTERFACE
;
483 static ULONG WINAPI
AMVideoProcAmp_AddRef(IAMVideoProcAmp
* iface
)
485 ICOM_THIS_MULTI(VfwCapture
, IAMVideoProcAmp_vtbl
, iface
);
487 return IUnknown_AddRef((IUnknown
*)This
);
490 static ULONG WINAPI
AMVideoProcAmp_Release(IAMVideoProcAmp
* iface
)
492 ICOM_THIS_MULTI(VfwCapture
, IAMVideoProcAmp_vtbl
, iface
);
494 return IUnknown_Release((IUnknown
*)This
);
497 static HRESULT WINAPI
498 AMVideoProcAmp_GetRange( IAMVideoProcAmp
* iface
, long Property
, long *pMin
,
499 long *pMax
, long *pSteppingDelta
, long *pDefault
, long *pCapsFlags
)
501 ICOM_THIS_MULTI(VfwCapture
, IAMVideoProcAmp_vtbl
, iface
);
503 return qcap_driver_get_prop_range( This
->driver_info
, Property
, pMin
, pMax
,
504 pSteppingDelta
, pDefault
, pCapsFlags
);
507 static HRESULT WINAPI
508 AMVideoProcAmp_Set( IAMVideoProcAmp
* iface
, long Property
, long lValue
,
511 ICOM_THIS_MULTI(VfwCapture
, IAMVideoProcAmp_vtbl
, iface
);
513 return qcap_driver_set_prop(This
->driver_info
, Property
, lValue
, Flags
);
516 static HRESULT WINAPI
517 AMVideoProcAmp_Get( IAMVideoProcAmp
* iface
, long Property
, long *lValue
,
520 ICOM_THIS_MULTI(VfwCapture
, IAMVideoProcAmp_vtbl
, iface
);
522 return qcap_driver_get_prop(This
->driver_info
, Property
, lValue
, Flags
);
525 static const IAMVideoProcAmpVtbl IAMVideoProcAmp_VTable
=
527 AMVideoProcAmp_QueryInterface
,
528 AMVideoProcAmp_AddRef
,
529 AMVideoProcAmp_Release
,
530 AMVideoProcAmp_GetRange
,
535 static HRESULT WINAPI
536 PPB_QueryInterface( IPersistPropertyBag
* iface
, REFIID riid
, LPVOID
* ppv
)
538 if (IsEqualIID(riid
, &IID_IUnknown
) ||
539 IsEqualIID(riid
, &IID_IPersist
) ||
540 IsEqualIID(riid
, &IID_IPersistPropertyBag
))
542 IPersistPropertyBag_AddRef(iface
);
546 if (IsEqualIID(riid
, &IID_IBaseFilter
))
548 /* FIXME: native devenum asks for IBaseFilter, should we return it? */
549 IPersistPropertyBag_AddRef(iface
);
554 FIXME("No interface for iid %s\n", debugstr_guid(riid
));
555 return E_NOINTERFACE
;
558 static ULONG WINAPI
PPB_AddRef(IPersistPropertyBag
* iface
)
560 ICOM_THIS_MULTI(VfwCapture
, IPersistPropertyBag_vtbl
, iface
);
562 TRACE("%p --> Forwarding to VfwCapture (%p)\n", iface
, This
);
564 return IUnknown_AddRef((IUnknown
*)This
);
567 static ULONG WINAPI
PPB_Release(IPersistPropertyBag
* iface
)
569 ICOM_THIS_MULTI(VfwCapture
, IPersistPropertyBag_vtbl
, iface
);
571 TRACE("%p --> Forwarding to VfwCapture (%p)\n", iface
, This
);
573 return IUnknown_Release((IUnknown
*)This
);
576 static HRESULT WINAPI
577 PPB_GetClassID( IPersistPropertyBag
* iface
, CLSID
* pClassID
)
579 ICOM_THIS_MULTI(VfwCapture
, IPersistPropertyBag_vtbl
, iface
);
581 FIXME("%p - stub\n", This
);
586 static HRESULT WINAPI
PPB_InitNew(IPersistPropertyBag
* iface
)
588 ICOM_THIS_MULTI(VfwCapture
, IPersistPropertyBag_vtbl
, iface
);
590 FIXME("%p - stub\n", This
);
595 static HRESULT WINAPI
596 PPB_Load( IPersistPropertyBag
* iface
, IPropertyBag
*pPropBag
,
597 IErrorLog
*pErrorLog
)
599 ICOM_THIS_MULTI(VfwCapture
, IPersistPropertyBag_vtbl
, iface
);
602 const OLECHAR VFWIndex
[] = {'V','F','W','I','n','d','e','x',0};
604 TRACE("%p/%p-> (%p, %p)\n", iface
, This
, pPropBag
, pErrorLog
);
607 hr
= IPropertyBag_Read(pPropBag
, (LPCOLESTR
)VFWIndex
, &var
, pErrorLog
);
613 This
->driver_info
= qcap_driver_init( This
->pOutputPin
,
614 var
.__VARIANT_NAME_1
.__VARIANT_NAME_2
.__VARIANT_NAME_3
.ulVal
);
615 if (This
->driver_info
)
617 pin
= (VfwPinImpl
*)This
->pOutputPin
;
618 pin
->driver_info
= This
->driver_info
;
629 static HRESULT WINAPI
630 PPB_Save( IPersistPropertyBag
* iface
, IPropertyBag
*pPropBag
,
631 BOOL fClearDirty
, BOOL fSaveAllProperties
)
633 ICOM_THIS_MULTI(VfwCapture
, IPersistPropertyBag_vtbl
, iface
);
634 FIXME("%p - stub\n", This
);
638 static const IPersistPropertyBagVtbl IPersistPropertyBag_VTable
=
649 /* IKsPropertySet interface */
650 static HRESULT WINAPI
651 KSP_QueryInterface( IKsPropertySet
* iface
, REFIID riid
, LPVOID
* ppv
)
653 if (IsEqualIID(riid
, &IID_IUnknown
) ||
654 IsEqualIID(riid
, &IID_IKsPropertySet
))
656 *ppv
= (LPVOID
)iface
;
657 IKsPropertySet_AddRef( iface
);
661 FIXME("No interface for iid %s\n", debugstr_guid(riid
));
662 return E_NOINTERFACE
;
665 static ULONG WINAPI
KSP_AddRef(IKsPropertySet
* iface
)
667 ICOM_THIS_MULTI(VfwPinImpl
, KSP_VT
, iface
);
669 TRACE("%p --> Forwarding to VfwPin (%p)\n", iface
, This
);
671 return IUnknown_AddRef((IUnknown
*)This
);
674 static ULONG WINAPI
KSP_Release(IKsPropertySet
* iface
)
676 ICOM_THIS_MULTI(VfwPinImpl
, KSP_VT
, iface
);
678 TRACE("%p --> Forwarding to VfwPin (%p)\n", iface
, This
);
680 return IUnknown_Release((IUnknown
*)This
);
683 static HRESULT WINAPI
684 KSP_Set( IKsPropertySet
* iface
, REFGUID guidPropSet
, DWORD dwPropID
,
685 LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
,
688 FIXME("%p: stub\n", iface
);
692 static HRESULT WINAPI
693 KSP_Get( IKsPropertySet
* iface
, REFGUID guidPropSet
, DWORD dwPropID
,
694 LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
,
695 DWORD cbPropData
, DWORD
*pcbReturned
)
701 if (!IsEqualIID(guidPropSet
, &ROPSETID_Pin
))
702 return E_PROP_SET_UNSUPPORTED
;
703 if (pPropData
== NULL
&& pcbReturned
== NULL
)
706 *pcbReturned
= sizeof(GUID
);
707 if (pPropData
== NULL
)
709 if (cbPropData
< sizeof(GUID
))
712 *pGuid
= PIN_CATEGORY_PREVIEW
;
713 FIXME("() Not adding a pin with PIN_CATEGORY_CAPTURE\n");
717 static HRESULT WINAPI
718 KSP_QuerySupported( IKsPropertySet
* iface
, REFGUID guidPropSet
,
719 DWORD dwPropID
, DWORD
*pTypeSupport
)
721 FIXME("%p: stub\n", iface
);
725 static const IKsPropertySetVtbl KSP_VTable
=
736 VfwPin_Construct( IBaseFilter
* pBaseFilter
, LPCRITICAL_SECTION pCritSec
,
739 static const WCHAR wszOutputPinName
[] = { 'O','u','t','p','u','t',0 };
740 ALLOCATOR_PROPERTIES ap
;
741 VfwPinImpl
* pPinImpl
;
745 pPinImpl
= CoTaskMemAlloc( sizeof(*pPinImpl
) );
747 return E_OUTOFMEMORY
;
749 /* What we put here doesn't matter, the
750 driver function should override it then commit */
752 ap
.cbBuffer
= 230400;
756 piOutput
.dir
= PINDIR_OUTPUT
;
757 piOutput
.pFilter
= pBaseFilter
;
758 lstrcpyW(piOutput
.achName
, wszOutputPinName
);
759 ObjectRefCount(TRUE
);
761 hr
= OutputPin_Init(&piOutput
, &ap
, pBaseFilter
, NULL
, pCritSec
, &pPinImpl
->pin
);
764 pPinImpl
->KSP_VT
= &KSP_VTable
;
765 pPinImpl
->pin
.pin
.lpVtbl
= &VfwPin_Vtbl
;
766 *ppPin
= (IPin
*)(&pPinImpl
->pin
.pin
.lpVtbl
);
772 static HRESULT WINAPI
VfwPin_QueryInterface(IPin
* iface
, REFIID riid
, LPVOID
* ppv
)
774 VfwPinImpl
*This
= (VfwPinImpl
*)iface
;
776 TRACE("%s %p\n", debugstr_guid(riid
), ppv
);
779 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IPin
))
781 else if (IsEqualIID(riid
, &IID_IKsPropertySet
))
782 *ppv
= (LPVOID
)&(This
->KSP_VT
);
786 IUnknown_AddRef((IUnknown
*)(*ppv
));
790 FIXME("No interface for %s!\n", debugstr_guid(riid
));
791 return E_NOINTERFACE
;
794 static ULONG WINAPI
VfwPin_AddRef(IPin
* iface
)
796 VfwPinImpl
*This
= (VfwPinImpl
*)iface
;
797 ULONG refCount
= InterlockedIncrement(&This
->pin
.pin
.refCount
);
799 TRACE("() -> new refcount: %u\n", refCount
);
805 VfwPin_Release(IPin
* iface
)
807 VfwPinImpl
*This
= (VfwPinImpl
*)iface
;
808 ULONG refCount
= InterlockedDecrement(&This
->pin
.pin
.refCount
);
810 TRACE("() -> new refcount: %u\n", refCount
);
815 ObjectRefCount(FALSE
);
820 static HRESULT WINAPI
821 VfwPin_EnumMediaTypes(IPin
* iface
, IEnumMediaTypes
** ppEnum
)
823 ENUMMEDIADETAILS emd
;
827 VfwPinImpl
*This
= (VfwPinImpl
*)iface
;
829 hr
= qcap_driver_get_format(This
->driver_info
, &pmt
);
830 emd
.pMediaTypes
= pmt
;
832 hr
= IEnumMediaTypesImpl_Construct(&emd
, ppEnum
);
833 TRACE("%p -- %x\n", This
, hr
);
834 DeleteMediaType(pmt
);
838 static HRESULT WINAPI
839 VfwPin_QueryInternalConnections(IPin
* iface
, IPin
** apPin
, ULONG
* cPin
)
841 TRACE("(%p)->(%p, %p)\n", iface
, apPin
, cPin
);
845 static HRESULT WINAPI
VfwPin_EndOfStream(IPin
* iface
)
851 static HRESULT WINAPI
VfwPin_BeginFlush(IPin
* iface
)
853 TRACE("(%p)->()\n", iface
);
857 static HRESULT WINAPI
VfwPin_EndFlush(IPin
* iface
)
859 TRACE("(%p)->()\n", iface
);
863 static HRESULT WINAPI
864 VfwPin_NewSegment(IPin
* iface
, REFERENCE_TIME tStart
,
865 REFERENCE_TIME tStop
, double dRate
)
867 TRACE("(%p)->(%s, %s, %e)\n", iface
, wine_dbgstr_longlong(tStart
),
868 wine_dbgstr_longlong(tStop
), dRate
);
872 static const IPinVtbl VfwPin_Vtbl
=
874 VfwPin_QueryInterface
,
878 OutputPin_ReceiveConnection
,
879 OutputPin_Disconnect
,
880 IPinImpl_ConnectedTo
,
881 IPinImpl_ConnectionMediaType
,
882 IPinImpl_QueryPinInfo
,
883 IPinImpl_QueryDirection
,
885 IPinImpl_QueryAccept
,
886 VfwPin_EnumMediaTypes
,
887 VfwPin_QueryInternalConnections
,