2005-05-27 21:22:39 +02:00
|
|
|
/* Video For Windows Steering structure
|
|
|
|
*
|
|
|
|
* Copyright 2005 Maarten Lankhorst
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-05-27 21:22:39 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wtypes.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "dshow.h"
|
|
|
|
|
|
|
|
#include "qcap_main.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "capture.h"
|
|
|
|
#include "uuids.h"
|
|
|
|
#include "vfwmsgs.h"
|
|
|
|
#include "amvideo.h"
|
|
|
|
#include "strmif.h"
|
|
|
|
#include "ddraw.h"
|
|
|
|
#include "ocidl.h"
|
|
|
|
#include "oleauto.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(qcap);
|
|
|
|
|
|
|
|
static const IBaseFilterVtbl VfwCapture_Vtbl;
|
|
|
|
static const IAMStreamConfigVtbl IAMStreamConfig_VTable;
|
|
|
|
static const IAMVideoProcAmpVtbl IAMVideoProcAmp_VTable;
|
|
|
|
static const IPersistPropertyBagVtbl IPersistPropertyBag_VTable;
|
|
|
|
static const IPinVtbl VfwPin_Vtbl;
|
|
|
|
|
|
|
|
static HRESULT VfwPin_Construct( IBaseFilter *, LPCRITICAL_SECTION, IPin ** );
|
|
|
|
|
|
|
|
typedef struct VfwCapture
|
|
|
|
{
|
2015-07-28 11:03:23 +02:00
|
|
|
IUnknown IUnknown_inner;
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilter filter;
|
2010-12-21 11:31:10 +01:00
|
|
|
IAMStreamConfig IAMStreamConfig_iface;
|
|
|
|
IAMVideoProcAmp IAMVideoProcAmp_iface;
|
|
|
|
IPersistPropertyBag IPersistPropertyBag_iface;
|
2015-07-28 11:03:23 +02:00
|
|
|
IUnknown *outer_unk;
|
2005-05-27 21:22:39 +02:00
|
|
|
BOOL init;
|
2005-06-04 11:49:02 +02:00
|
|
|
Capture *driver_info;
|
2005-05-27 21:22:39 +02:00
|
|
|
|
|
|
|
IPin * pOutputPin;
|
|
|
|
} VfwCapture;
|
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
static inline VfwCapture *impl_from_IUnknown(IUnknown *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VfwCapture, IUnknown_inner);
|
|
|
|
}
|
|
|
|
|
2015-06-26 05:52:26 +02:00
|
|
|
static inline VfwCapture *impl_from_BaseFilter(BaseFilter *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VfwCapture, filter);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline VfwCapture *impl_from_IBaseFilter(IBaseFilter *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VfwCapture, filter.IBaseFilter_iface);
|
|
|
|
}
|
|
|
|
|
2010-12-21 11:31:10 +01:00
|
|
|
static inline VfwCapture *impl_from_IAMStreamConfig(IAMStreamConfig *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VfwCapture, IAMStreamConfig_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline VfwCapture *impl_from_IAMVideoProcAmp(IAMVideoProcAmp *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VfwCapture, IAMVideoProcAmp_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline VfwCapture *impl_from_IPersistPropertyBag(IPersistPropertyBag *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VfwCapture, IPersistPropertyBag_iface);
|
|
|
|
}
|
|
|
|
|
2005-05-27 21:22:39 +02:00
|
|
|
/* VfwPin implementation */
|
|
|
|
typedef struct VfwPinImpl
|
|
|
|
{
|
2010-10-05 21:37:56 +02:00
|
|
|
BaseOutputPin pin;
|
2015-08-03 23:28:41 +02:00
|
|
|
IKsPropertySet IKsPropertySet_iface;
|
2008-06-10 16:44:26 +02:00
|
|
|
VfwCapture *parent;
|
2005-05-27 21:22:39 +02:00
|
|
|
} VfwPinImpl;
|
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
|
|
|
|
/* VfwCapture inner IUnknown */
|
|
|
|
static HRESULT WINAPI unknown_inner_QueryInterface(IUnknown *iface, REFIID riid, void **ret_iface)
|
|
|
|
{
|
|
|
|
VfwCapture *This = impl_from_IUnknown(iface);
|
|
|
|
|
|
|
|
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ret_iface);
|
|
|
|
|
|
|
|
*ret_iface = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown))
|
|
|
|
*ret_iface = &This->IUnknown_inner;
|
|
|
|
else if (IsEqualIID(riid, &IID_IPersist) || IsEqualIID(riid, &IID_IMediaFilter) ||
|
|
|
|
IsEqualIID(riid, &IID_IBaseFilter))
|
|
|
|
*ret_iface = &This->filter.IBaseFilter_iface;
|
|
|
|
else if (IsEqualIID(riid, &IID_IPersistPropertyBag))
|
|
|
|
*ret_iface = &This->IPersistPropertyBag_iface;
|
|
|
|
else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
|
|
|
|
FIXME("IAMFilterMiscFlags not supported yet!\n");
|
|
|
|
else if (IsEqualIID(riid, &IID_ISpecifyPropertyPages))
|
|
|
|
FIXME("ISpecifyPropertyPages not supported yet!\n");
|
|
|
|
else if (IsEqualIID(riid, &IID_IAMVfwCaptureDialogs))
|
|
|
|
FIXME("IAMVfwCaptureDialogs not supported yet!\n");
|
|
|
|
else if (IsEqualIID(riid, &IID_IAMStreamConfig))
|
|
|
|
*ret_iface = &This->IAMStreamConfig_iface;
|
|
|
|
else if (IsEqualIID(riid, &IID_IAMVideoProcAmp))
|
|
|
|
*ret_iface = &This->IAMVideoProcAmp_iface;
|
|
|
|
else
|
|
|
|
WARN("(%p, %s, %p): not found\n", This, debugstr_guid(riid), ret_iface);
|
|
|
|
|
|
|
|
if (!*ret_iface)
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ret_iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI unknown_inner_AddRef(IUnknown *iface)
|
|
|
|
{
|
|
|
|
VfwCapture *This = impl_from_IUnknown(iface);
|
|
|
|
ULONG ref = BaseFilterImpl_AddRef(&This->filter.IBaseFilter_iface);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI unknown_inner_Release(IUnknown *iface)
|
|
|
|
{
|
|
|
|
VfwCapture *This = impl_from_IUnknown(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->filter.refCount);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
if (!ref)
|
|
|
|
{
|
|
|
|
IPin *conn = NULL;
|
|
|
|
|
|
|
|
TRACE("destroying everything\n");
|
|
|
|
if (This->init)
|
|
|
|
{
|
|
|
|
if (This->filter.state != State_Stopped)
|
|
|
|
qcap_driver_stop(This->driver_info, &This->filter.state);
|
|
|
|
qcap_driver_destroy(This->driver_info);
|
|
|
|
}
|
|
|
|
IPin_ConnectedTo(This->pOutputPin, &conn);
|
|
|
|
if (conn)
|
|
|
|
{
|
|
|
|
IPin_Disconnect(conn);
|
|
|
|
IPin_Disconnect(This->pOutputPin);
|
|
|
|
IPin_Release(conn);
|
|
|
|
}
|
|
|
|
IPin_Release(This->pOutputPin);
|
|
|
|
BaseFilter_Destroy(&This->filter);
|
|
|
|
CoTaskMemFree(This);
|
|
|
|
ObjectRefCount(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IUnknownVtbl unknown_inner_vtbl =
|
|
|
|
{
|
|
|
|
unknown_inner_QueryInterface,
|
|
|
|
unknown_inner_AddRef,
|
|
|
|
unknown_inner_Release,
|
|
|
|
};
|
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
static IPin* WINAPI VfwCapture_GetPin(BaseFilter *iface, int pos)
|
2010-10-07 21:48:01 +02:00
|
|
|
{
|
2015-06-26 05:52:26 +02:00
|
|
|
VfwCapture *This = impl_from_BaseFilter(iface);
|
2010-10-07 21:48:01 +02:00
|
|
|
|
|
|
|
if (pos >= 1 || pos < 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
IPin_AddRef(This->pOutputPin);
|
|
|
|
return This->pOutputPin;
|
|
|
|
}
|
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
static LONG WINAPI VfwCapture_GetPinCount(BaseFilter *iface)
|
2010-10-07 21:48:01 +02:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
static const BaseFilterFuncTable BaseFuncTable = {
|
|
|
|
VfwCapture_GetPin,
|
|
|
|
VfwCapture_GetPinCount
|
|
|
|
};
|
|
|
|
|
2005-05-27 21:22:39 +02:00
|
|
|
IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *pUnkOuter, HRESULT *phr)
|
|
|
|
{
|
|
|
|
VfwCapture *pVfwCapture;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("%p - %p\n", pUnkOuter, phr);
|
|
|
|
|
|
|
|
*phr = E_OUTOFMEMORY;
|
|
|
|
pVfwCapture = CoTaskMemAlloc( sizeof(VfwCapture) );
|
|
|
|
if (!pVfwCapture)
|
|
|
|
return NULL;
|
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
BaseFilter_Init(&pVfwCapture->filter, &VfwCapture_Vtbl, &CLSID_VfwCapture, (DWORD_PTR)(__FILE__ ": VfwCapture.csFilter"), &BaseFuncTable);
|
2010-10-07 21:47:33 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
pVfwCapture->IUnknown_inner.lpVtbl = &unknown_inner_vtbl;
|
2010-12-21 11:31:10 +01:00
|
|
|
pVfwCapture->IAMStreamConfig_iface.lpVtbl = &IAMStreamConfig_VTable;
|
|
|
|
pVfwCapture->IAMVideoProcAmp_iface.lpVtbl = &IAMVideoProcAmp_VTable;
|
|
|
|
pVfwCapture->IPersistPropertyBag_iface.lpVtbl = &IPersistPropertyBag_VTable;
|
2005-05-27 21:22:39 +02:00
|
|
|
pVfwCapture->init = FALSE;
|
2010-10-07 21:47:33 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
if (pUnkOuter)
|
|
|
|
pVfwCapture->outer_unk = pUnkOuter;
|
|
|
|
else
|
|
|
|
pVfwCapture->outer_unk = &pVfwCapture->IUnknown_inner;
|
|
|
|
|
2012-03-24 17:42:27 +01:00
|
|
|
hr = VfwPin_Construct(&pVfwCapture->filter.IBaseFilter_iface,
|
2010-10-07 21:47:33 +02:00
|
|
|
&pVfwCapture->filter.csFilter, &pVfwCapture->pOutputPin);
|
2008-10-08 01:36:01 +02:00
|
|
|
if (FAILED(hr))
|
2005-05-27 21:22:39 +02:00
|
|
|
{
|
|
|
|
CoTaskMemFree(pVfwCapture);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
TRACE("-- created at %p\n", pVfwCapture);
|
|
|
|
|
|
|
|
ObjectRefCount(TRUE);
|
|
|
|
*phr = S_OK;
|
2015-07-28 11:03:23 +02:00
|
|
|
return &pVfwCapture->IUnknown_inner;
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
static HRESULT WINAPI VfwCapture_QueryInterface(IBaseFilter *iface, REFIID riid, void **ret_iface)
|
2005-05-27 21:22:39 +02:00
|
|
|
{
|
2015-06-26 05:52:26 +02:00
|
|
|
VfwCapture *This = impl_from_IBaseFilter(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface);
|
|
|
|
}
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
static ULONG WINAPI VfwCapture_AddRef(IBaseFilter *iface)
|
|
|
|
{
|
|
|
|
VfwCapture *This = impl_from_IBaseFilter(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
return IUnknown_AddRef(This->outer_unk);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI VfwCapture_Release(IBaseFilter * iface)
|
|
|
|
{
|
2015-06-26 05:52:26 +02:00
|
|
|
VfwCapture *This = impl_from_IBaseFilter(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
return IUnknown_Release(This->outer_unk);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** IMediaFilter methods **/
|
|
|
|
|
|
|
|
static HRESULT WINAPI VfwCapture_Stop(IBaseFilter * iface)
|
|
|
|
{
|
2015-06-26 05:52:26 +02:00
|
|
|
VfwCapture *This = impl_from_IBaseFilter(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
|
|
|
TRACE("()\n");
|
2010-10-07 21:47:33 +02:00
|
|
|
return qcap_driver_stop(This->driver_info, &This->filter.state);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI VfwCapture_Pause(IBaseFilter * iface)
|
|
|
|
{
|
2015-06-26 05:52:26 +02:00
|
|
|
VfwCapture *This = impl_from_IBaseFilter(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
|
|
|
TRACE("()\n");
|
2010-10-07 21:47:33 +02:00
|
|
|
return qcap_driver_pause(This->driver_info, &This->filter.state);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI VfwCapture_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
|
|
|
|
{
|
2015-06-26 05:52:26 +02:00
|
|
|
VfwCapture *This = impl_from_IBaseFilter(iface);
|
2017-08-18 22:12:18 +02:00
|
|
|
TRACE("(%s)\n", wine_dbgstr_longlong(tStart));
|
2010-10-07 21:47:33 +02:00
|
|
|
return qcap_driver_run(This->driver_info, &This->filter.state);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** IBaseFilter methods **/
|
|
|
|
static HRESULT WINAPI VfwCapture_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
|
|
|
|
{
|
|
|
|
FIXME("(%s, %p) - stub\n", debugstr_w(Id), ppPin);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IBaseFilterVtbl VfwCapture_Vtbl =
|
|
|
|
{
|
|
|
|
VfwCapture_QueryInterface,
|
2015-07-28 11:03:23 +02:00
|
|
|
VfwCapture_AddRef,
|
2005-05-27 21:22:39 +02:00
|
|
|
VfwCapture_Release,
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilterImpl_GetClassID,
|
2005-05-27 21:22:39 +02:00
|
|
|
VfwCapture_Stop,
|
|
|
|
VfwCapture_Pause,
|
|
|
|
VfwCapture_Run,
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilterImpl_GetState,
|
|
|
|
BaseFilterImpl_SetSyncSource,
|
|
|
|
BaseFilterImpl_GetSyncSource,
|
2010-10-07 21:48:01 +02:00
|
|
|
BaseFilterImpl_EnumPins,
|
2005-05-27 21:22:39 +02:00
|
|
|
VfwCapture_FindPin,
|
2010-10-07 21:47:33 +02:00
|
|
|
BaseFilterImpl_QueryFilterInfo,
|
|
|
|
BaseFilterImpl_JoinFilterGraph,
|
|
|
|
BaseFilterImpl_QueryVendorInfo
|
2005-05-27 21:22:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* AMStreamConfig interface, we only need to implement {G,S}etFormat */
|
2015-07-27 09:28:22 +02:00
|
|
|
static HRESULT WINAPI AMStreamConfig_QueryInterface(IAMStreamConfig *iface, REFIID riid,
|
|
|
|
void **ret_iface)
|
2005-05-27 21:22:39 +02:00
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IAMStreamConfig(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AMStreamConfig_AddRef( IAMStreamConfig * iface )
|
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IAMStreamConfig(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
return IUnknown_AddRef(This->outer_unk);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AMStreamConfig_Release( IAMStreamConfig * iface )
|
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IAMStreamConfig(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
return IUnknown_Release(This->outer_unk);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
AMStreamConfig_SetFormat(IAMStreamConfig *iface, AM_MEDIA_TYPE *pmt)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IAMStreamConfig(iface);
|
2010-10-05 21:37:42 +02:00
|
|
|
BasePin *pin;
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2008-09-16 22:54:20 +02:00
|
|
|
TRACE("(%p): %p->%p\n", iface, pmt, pmt ? pmt->pbFormat : NULL);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2010-10-07 21:47:33 +02:00
|
|
|
if (This->filter.state != State_Stopped)
|
2005-05-27 21:22:39 +02:00
|
|
|
{
|
|
|
|
TRACE("Returning not stopped error\n");
|
|
|
|
return VFW_E_NOT_STOPPED;
|
|
|
|
}
|
|
|
|
|
2008-09-16 22:54:20 +02:00
|
|
|
if (!pmt)
|
|
|
|
{
|
|
|
|
TRACE("pmt is NULL\n");
|
|
|
|
return E_POINTER;
|
|
|
|
}
|
|
|
|
|
2005-05-27 21:22:39 +02:00
|
|
|
dump_AM_MEDIA_TYPE(pmt);
|
|
|
|
|
2010-10-05 21:37:42 +02:00
|
|
|
pin = (BasePin *)This->pOutputPin;
|
2005-05-27 21:22:39 +02:00
|
|
|
if (pin->pConnectedTo != NULL)
|
|
|
|
{
|
|
|
|
hr = IPin_QueryAccept(pin->pConnectedTo, pmt);
|
2006-10-08 19:36:31 +02:00
|
|
|
TRACE("Would accept: %d\n", hr);
|
2005-05-27 21:22:39 +02:00
|
|
|
if (hr == S_FALSE)
|
|
|
|
return VFW_E_INVALIDMEDIATYPE;
|
|
|
|
}
|
|
|
|
|
2005-06-04 11:49:02 +02:00
|
|
|
hr = qcap_driver_set_format(This->driver_info, pmt);
|
2010-10-07 21:47:33 +02:00
|
|
|
if (SUCCEEDED(hr) && This->filter.filterInfo.pGraph && pin->pConnectedTo )
|
2005-05-27 21:22:39 +02:00
|
|
|
{
|
2010-10-07 21:47:33 +02:00
|
|
|
hr = IFilterGraph_Reconnect(This->filter.filterInfo.pGraph, This->pOutputPin);
|
2005-05-27 21:22:39 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
TRACE("Reconnection completed, with new media format..\n");
|
|
|
|
}
|
2006-10-08 19:36:31 +02:00
|
|
|
TRACE("Returning: %d\n", hr);
|
2005-05-27 21:22:39 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
AMStreamConfig_GetFormat( IAMStreamConfig *iface, AM_MEDIA_TYPE **pmt )
|
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IAMStreamConfig(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
|
|
|
TRACE("%p -> (%p)\n", iface, pmt);
|
2005-06-04 11:49:02 +02:00
|
|
|
return qcap_driver_get_format(This->driver_info, pmt);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
AMStreamConfig_GetNumberOfCapabilities( IAMStreamConfig *iface, int *piCount,
|
|
|
|
int *piSize )
|
|
|
|
{
|
|
|
|
FIXME("%p: %p %p - stub, intentional\n", iface, piCount, piSize);
|
2015-05-31 20:15:20 +02:00
|
|
|
*piCount = 0;
|
2005-05-27 21:22:39 +02:00
|
|
|
return E_NOTIMPL; /* Not implemented for this interface */
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
AMStreamConfig_GetStreamCaps( IAMStreamConfig *iface, int iIndex,
|
|
|
|
AM_MEDIA_TYPE **pmt, BYTE *pSCC )
|
|
|
|
{
|
|
|
|
FIXME("%p: %d %p %p - stub, intentional\n", iface, iIndex, pmt, pSCC);
|
|
|
|
return E_NOTIMPL; /* Not implemented for this interface */
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IAMStreamConfigVtbl IAMStreamConfig_VTable =
|
|
|
|
{
|
|
|
|
AMStreamConfig_QueryInterface,
|
|
|
|
AMStreamConfig_AddRef,
|
|
|
|
AMStreamConfig_Release,
|
|
|
|
AMStreamConfig_SetFormat,
|
|
|
|
AMStreamConfig_GetFormat,
|
|
|
|
AMStreamConfig_GetNumberOfCapabilities,
|
|
|
|
AMStreamConfig_GetStreamCaps
|
|
|
|
};
|
|
|
|
|
2015-07-27 09:28:22 +02:00
|
|
|
static HRESULT WINAPI AMVideoProcAmp_QueryInterface(IAMVideoProcAmp *iface, REFIID riid,
|
|
|
|
void **ret_iface)
|
2005-05-27 21:22:39 +02:00
|
|
|
{
|
2015-07-27 09:28:22 +02:00
|
|
|
VfwCapture *This = impl_from_IAMVideoProcAmp(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AMVideoProcAmp_AddRef(IAMVideoProcAmp * iface)
|
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IAMVideoProcAmp(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
return IUnknown_AddRef(This->outer_unk);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AMVideoProcAmp_Release(IAMVideoProcAmp * iface)
|
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IAMVideoProcAmp(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
return IUnknown_Release(This->outer_unk);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
2009-03-12 01:42:38 +01:00
|
|
|
AMVideoProcAmp_GetRange( IAMVideoProcAmp * iface, LONG Property, LONG *pMin,
|
|
|
|
LONG *pMax, LONG *pSteppingDelta, LONG *pDefault, LONG *pCapsFlags )
|
2005-05-27 21:22:39 +02:00
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IAMVideoProcAmp(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2005-06-04 11:49:02 +02:00
|
|
|
return qcap_driver_get_prop_range( This->driver_info, Property, pMin, pMax,
|
2005-05-27 21:22:39 +02:00
|
|
|
pSteppingDelta, pDefault, pCapsFlags );
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
2009-03-12 01:42:38 +01:00
|
|
|
AMVideoProcAmp_Set( IAMVideoProcAmp * iface, LONG Property, LONG lValue,
|
|
|
|
LONG Flags )
|
2005-05-27 21:22:39 +02:00
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IAMVideoProcAmp(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2005-06-04 11:49:02 +02:00
|
|
|
return qcap_driver_set_prop(This->driver_info, Property, lValue, Flags);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
2009-03-12 01:42:38 +01:00
|
|
|
AMVideoProcAmp_Get( IAMVideoProcAmp * iface, LONG Property, LONG *lValue,
|
|
|
|
LONG *Flags )
|
2005-05-27 21:22:39 +02:00
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IAMVideoProcAmp(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2005-06-04 11:49:02 +02:00
|
|
|
return qcap_driver_get_prop(This->driver_info, Property, lValue, Flags);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IAMVideoProcAmpVtbl IAMVideoProcAmp_VTable =
|
|
|
|
{
|
|
|
|
AMVideoProcAmp_QueryInterface,
|
|
|
|
AMVideoProcAmp_AddRef,
|
|
|
|
AMVideoProcAmp_Release,
|
|
|
|
AMVideoProcAmp_GetRange,
|
|
|
|
AMVideoProcAmp_Set,
|
|
|
|
AMVideoProcAmp_Get,
|
|
|
|
};
|
|
|
|
|
2015-07-27 09:28:22 +02:00
|
|
|
static HRESULT WINAPI PPB_QueryInterface(IPersistPropertyBag *iface, REFIID riid, void **ret_iface)
|
2005-05-27 21:22:39 +02:00
|
|
|
{
|
2015-07-27 09:28:22 +02:00
|
|
|
VfwCapture *This = impl_from_IPersistPropertyBag(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PPB_AddRef(IPersistPropertyBag * iface)
|
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IPersistPropertyBag(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
return IUnknown_AddRef(This->outer_unk);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PPB_Release(IPersistPropertyBag * iface)
|
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IPersistPropertyBag(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-07-28 11:03:23 +02:00
|
|
|
return IUnknown_Release(This->outer_unk);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
PPB_GetClassID( IPersistPropertyBag * iface, CLSID * pClassID )
|
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IPersistPropertyBag(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
|
|
|
FIXME("%p - stub\n", This);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PPB_InitNew(IPersistPropertyBag * iface)
|
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IPersistPropertyBag(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
|
|
|
FIXME("%p - stub\n", This);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
PPB_Load( IPersistPropertyBag * iface, IPropertyBag *pPropBag,
|
|
|
|
IErrorLog *pErrorLog )
|
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IPersistPropertyBag(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
HRESULT hr;
|
|
|
|
VARIANT var;
|
|
|
|
const OLECHAR VFWIndex[] = {'V','F','W','I','n','d','e','x',0};
|
|
|
|
|
|
|
|
TRACE("%p/%p-> (%p, %p)\n", iface, This, pPropBag, pErrorLog);
|
|
|
|
|
|
|
|
V_VT(&var) = VT_I4;
|
2009-01-08 00:37:09 +01:00
|
|
|
hr = IPropertyBag_Read(pPropBag, VFWIndex, &var, pErrorLog);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
VfwPinImpl *pin;
|
|
|
|
|
2005-06-04 11:49:02 +02:00
|
|
|
This->driver_info = qcap_driver_init( This->pOutputPin,
|
|
|
|
var.__VARIANT_NAME_1.__VARIANT_NAME_2.__VARIANT_NAME_3.ulVal );
|
|
|
|
if (This->driver_info)
|
|
|
|
{
|
|
|
|
pin = (VfwPinImpl *)This->pOutputPin;
|
2008-06-10 16:44:26 +02:00
|
|
|
pin->parent = This;
|
2005-05-27 21:22:39 +02:00
|
|
|
This->init = TRUE;
|
2005-06-04 11:49:02 +02:00
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
hr = E_FAIL;
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
PPB_Save( IPersistPropertyBag * iface, IPropertyBag *pPropBag,
|
|
|
|
BOOL fClearDirty, BOOL fSaveAllProperties )
|
|
|
|
{
|
2010-12-21 11:31:10 +01:00
|
|
|
VfwCapture *This = impl_from_IPersistPropertyBag(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
FIXME("%p - stub\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IPersistPropertyBagVtbl IPersistPropertyBag_VTable =
|
|
|
|
{
|
|
|
|
PPB_QueryInterface,
|
|
|
|
PPB_AddRef,
|
|
|
|
PPB_Release,
|
|
|
|
PPB_GetClassID,
|
|
|
|
PPB_InitNew,
|
|
|
|
PPB_Load,
|
|
|
|
PPB_Save
|
|
|
|
};
|
|
|
|
|
|
|
|
/* IKsPropertySet interface */
|
2015-08-03 23:28:41 +02:00
|
|
|
static inline VfwPinImpl *impl_from_IKsPropertySet(IKsPropertySet *iface)
|
2005-05-27 21:22:39 +02:00
|
|
|
{
|
2015-08-03 23:28:41 +02:00
|
|
|
return CONTAINING_RECORD(iface, VfwPinImpl, IKsPropertySet_iface);
|
|
|
|
}
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-08-03 23:28:41 +02:00
|
|
|
static HRESULT WINAPI KSP_QueryInterface(IKsPropertySet * iface, REFIID riid, void **ret_iface)
|
|
|
|
{
|
|
|
|
VfwPinImpl *This = impl_from_IKsPropertySet(iface);
|
|
|
|
|
|
|
|
return IPin_QueryInterface(&This->pin.pin.IPin_iface, riid, ret_iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI KSP_AddRef(IKsPropertySet * iface)
|
|
|
|
{
|
2015-08-03 23:28:41 +02:00
|
|
|
VfwPinImpl *This = impl_from_IKsPropertySet(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-08-03 23:28:41 +02:00
|
|
|
return IPin_AddRef(&This->pin.pin.IPin_iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI KSP_Release(IKsPropertySet * iface)
|
|
|
|
{
|
2015-08-03 23:28:41 +02:00
|
|
|
VfwPinImpl *This = impl_from_IKsPropertySet(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
2015-08-03 23:28:41 +02:00
|
|
|
return IPin_Release(&This->pin.pin.IPin_iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
KSP_Set( IKsPropertySet * iface, REFGUID guidPropSet, DWORD dwPropID,
|
|
|
|
LPVOID pInstanceData, DWORD cbInstanceData, LPVOID pPropData,
|
|
|
|
DWORD cbPropData )
|
|
|
|
{
|
|
|
|
FIXME("%p: stub\n", iface);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
KSP_Get( IKsPropertySet * iface, REFGUID guidPropSet, DWORD dwPropID,
|
|
|
|
LPVOID pInstanceData, DWORD cbInstanceData, LPVOID pPropData,
|
|
|
|
DWORD cbPropData, DWORD *pcbReturned )
|
|
|
|
{
|
|
|
|
LPGUID pGuid;
|
|
|
|
|
|
|
|
TRACE("()\n");
|
|
|
|
|
|
|
|
if (!IsEqualIID(guidPropSet, &ROPSETID_Pin))
|
|
|
|
return E_PROP_SET_UNSUPPORTED;
|
|
|
|
if (pPropData == NULL && pcbReturned == NULL)
|
|
|
|
return E_POINTER;
|
|
|
|
if (pcbReturned)
|
|
|
|
*pcbReturned = sizeof(GUID);
|
|
|
|
if (pPropData == NULL)
|
|
|
|
return S_OK;
|
|
|
|
if (cbPropData < sizeof(GUID))
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
pGuid = pPropData;
|
2015-05-31 20:13:35 +02:00
|
|
|
*pGuid = PIN_CATEGORY_CAPTURE;
|
|
|
|
FIXME("() Not adding a pin with PIN_CATEGORY_PREVIEW\n");
|
2005-05-27 21:22:39 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
KSP_QuerySupported( IKsPropertySet * iface, REFGUID guidPropSet,
|
|
|
|
DWORD dwPropID, DWORD *pTypeSupport )
|
|
|
|
{
|
|
|
|
FIXME("%p: stub\n", iface);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-08-03 23:28:41 +02:00
|
|
|
static const IKsPropertySetVtbl IKsPropertySet_VTable =
|
2005-05-27 21:22:39 +02:00
|
|
|
{
|
|
|
|
KSP_QueryInterface,
|
|
|
|
KSP_AddRef,
|
|
|
|
KSP_Release,
|
|
|
|
KSP_Set,
|
|
|
|
KSP_Get,
|
|
|
|
KSP_QuerySupported
|
|
|
|
};
|
|
|
|
|
2015-08-03 23:24:18 +02:00
|
|
|
static inline VfwPinImpl *impl_from_BasePin(BasePin *pin)
|
2010-10-05 21:37:30 +02:00
|
|
|
{
|
2015-08-03 23:24:18 +02:00
|
|
|
return CONTAINING_RECORD(pin, VfwPinImpl, pin.pin);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI VfwPin_GetMediaType(BasePin *pin, int iPosition, AM_MEDIA_TYPE *pmt)
|
|
|
|
{
|
|
|
|
VfwPinImpl *This = impl_from_BasePin(pin);
|
2010-10-05 21:37:30 +02:00
|
|
|
AM_MEDIA_TYPE *vfw_pmt;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (iPosition < 0)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
if (iPosition > 0)
|
|
|
|
return VFW_S_NO_MORE_ITEMS;
|
|
|
|
|
2015-08-02 23:19:52 +02:00
|
|
|
hr = qcap_driver_get_format(This->parent->driver_info, &vfw_pmt);
|
2012-08-17 23:04:31 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
CopyMediaType(pmt, vfw_pmt);
|
|
|
|
DeleteMediaType(vfw_pmt);
|
|
|
|
}
|
2010-10-05 21:37:30 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2011-03-16 08:32:51 +01:00
|
|
|
static LONG WINAPI VfwPin_GetMediaTypeVersion(BasePin *iface)
|
2010-10-05 21:37:30 +02:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
static HRESULT WINAPI VfwPin_DecideBufferSize(BaseOutputPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
|
2010-10-13 17:46:27 +02:00
|
|
|
{
|
|
|
|
ALLOCATOR_PROPERTIES actual;
|
|
|
|
|
|
|
|
/* What we put here doesn't matter, the
|
|
|
|
driver function should override it then commit */
|
|
|
|
if (!ppropInputRequest->cBuffers)
|
|
|
|
ppropInputRequest->cBuffers = 3;
|
|
|
|
if (!ppropInputRequest->cbBuffer)
|
|
|
|
ppropInputRequest->cbBuffer = 230400;
|
|
|
|
if (!ppropInputRequest->cbAlign)
|
|
|
|
ppropInputRequest->cbAlign = 1;
|
|
|
|
|
|
|
|
return IMemAllocator_SetProperties(pAlloc, ppropInputRequest, &actual);
|
|
|
|
}
|
|
|
|
|
2010-10-13 18:02:01 +02:00
|
|
|
static const BaseOutputPinFuncTable output_BaseOutputFuncTable = {
|
2014-01-06 17:54:13 +01:00
|
|
|
{
|
|
|
|
NULL,
|
|
|
|
BaseOutputPinImpl_AttemptConnection,
|
|
|
|
VfwPin_GetMediaTypeVersion,
|
|
|
|
VfwPin_GetMediaType
|
|
|
|
},
|
2010-10-13 18:02:14 +02:00
|
|
|
VfwPin_DecideBufferSize,
|
|
|
|
BaseOutputPinImpl_DecideAllocator,
|
|
|
|
BaseOutputPinImpl_BreakConnect
|
2010-10-13 18:02:01 +02:00
|
|
|
};
|
|
|
|
|
2005-05-27 21:22:39 +02:00
|
|
|
static HRESULT
|
|
|
|
VfwPin_Construct( IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec,
|
|
|
|
IPin ** ppPin )
|
|
|
|
{
|
|
|
|
static const WCHAR wszOutputPinName[] = { 'O','u','t','p','u','t',0 };
|
|
|
|
PIN_INFO piOutput;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2011-05-11 03:45:59 +02:00
|
|
|
*ppPin = NULL;
|
2005-05-27 21:22:39 +02:00
|
|
|
|
|
|
|
piOutput.dir = PINDIR_OUTPUT;
|
|
|
|
piOutput.pFilter = pBaseFilter;
|
|
|
|
lstrcpyW(piOutput.achName, wszOutputPinName);
|
|
|
|
|
2014-01-06 17:54:13 +01:00
|
|
|
hr = BaseOutputPin_Construct(&VfwPin_Vtbl, sizeof(VfwPinImpl), &piOutput, &output_BaseOutputFuncTable, pCritSec, ppPin);
|
2010-10-05 21:37:56 +02:00
|
|
|
|
2005-05-27 21:22:39 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2010-10-05 21:37:56 +02:00
|
|
|
VfwPinImpl *pPinImpl = (VfwPinImpl*)*ppPin;
|
2015-08-03 23:28:41 +02:00
|
|
|
pPinImpl->IKsPropertySet_iface.lpVtbl = &IKsPropertySet_VTable;
|
2014-07-27 11:03:40 +02:00
|
|
|
ObjectRefCount(TRUE);
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
2007-11-19 00:19:47 +01:00
|
|
|
|
2010-10-05 21:37:56 +02:00
|
|
|
return hr;
|
2005-05-27 21:22:39 +02:00
|
|
|
}
|
|
|
|
|
2015-08-03 23:24:18 +02:00
|
|
|
static inline VfwPinImpl *impl_from_IPin(IPin *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, VfwPinImpl, pin.pin.IPin_iface);
|
|
|
|
}
|
|
|
|
|
2005-05-27 21:22:39 +02:00
|
|
|
static HRESULT WINAPI VfwPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
|
|
|
|
{
|
2015-08-03 23:24:18 +02:00
|
|
|
VfwPinImpl *This = impl_from_IPin(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
|
|
|
TRACE("%s %p\n", debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPin))
|
2009-01-08 00:37:09 +01:00
|
|
|
*ppv = This;
|
2005-05-27 21:22:39 +02:00
|
|
|
else if (IsEqualIID(riid, &IID_IKsPropertySet))
|
2015-08-03 23:28:41 +02:00
|
|
|
*ppv = &This->IKsPropertySet_iface;
|
2008-06-10 16:44:26 +02:00
|
|
|
else if (IsEqualIID(riid, &IID_IAMStreamConfig))
|
|
|
|
return IUnknown_QueryInterface((IUnknown *)This->parent, riid, ppv);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
|
|
|
if (*ppv)
|
|
|
|
{
|
|
|
|
IUnknown_AddRef((IUnknown *)(*ppv));
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("No interface for %s!\n", debugstr_guid(riid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI
|
|
|
|
VfwPin_Release(IPin * iface)
|
|
|
|
{
|
2015-08-03 23:24:18 +02:00
|
|
|
VfwPinImpl *This = impl_from_IPin(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
ULONG refCount = InterlockedDecrement(&This->pin.pin.refCount);
|
|
|
|
|
2006-10-08 19:36:31 +02:00
|
|
|
TRACE("() -> new refcount: %u\n", refCount);
|
2005-05-27 21:22:39 +02:00
|
|
|
|
|
|
|
if (!refCount)
|
|
|
|
{
|
2014-07-27 01:34:55 +02:00
|
|
|
BaseOutputPin_Destroy(&This->pin);
|
2005-05-27 21:22:39 +02:00
|
|
|
ObjectRefCount(FALSE);
|
|
|
|
}
|
|
|
|
return refCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
VfwPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
|
|
|
|
{
|
2015-08-03 23:24:18 +02:00
|
|
|
VfwPinImpl *This = impl_from_IPin(iface);
|
2005-05-27 21:22:39 +02:00
|
|
|
AM_MEDIA_TYPE *pmt;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2015-08-02 23:19:52 +02:00
|
|
|
hr = qcap_driver_get_format(This->parent->driver_info, &pmt);
|
2012-08-17 23:07:11 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
2010-10-13 18:02:08 +02:00
|
|
|
hr = BasePinImpl_EnumMediaTypes(iface, ppEnum);
|
2012-08-17 23:07:11 +02:00
|
|
|
DeleteMediaType(pmt);
|
|
|
|
}
|
2006-10-08 19:36:31 +02:00
|
|
|
TRACE("%p -- %x\n", This, hr);
|
2005-05-27 21:22:39 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
VfwPin_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%p, %p)\n", iface, apPin, cPin);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IPinVtbl VfwPin_Vtbl =
|
|
|
|
{
|
|
|
|
VfwPin_QueryInterface,
|
2010-10-22 23:21:10 +02:00
|
|
|
BasePinImpl_AddRef,
|
2005-05-27 21:22:39 +02:00
|
|
|
VfwPin_Release,
|
2010-10-05 21:37:56 +02:00
|
|
|
BaseOutputPinImpl_Connect,
|
|
|
|
BaseOutputPinImpl_ReceiveConnection,
|
|
|
|
BaseOutputPinImpl_Disconnect,
|
2010-10-05 21:37:42 +02:00
|
|
|
BasePinImpl_ConnectedTo,
|
|
|
|
BasePinImpl_ConnectionMediaType,
|
|
|
|
BasePinImpl_QueryPinInfo,
|
|
|
|
BasePinImpl_QueryDirection,
|
|
|
|
BasePinImpl_QueryId,
|
|
|
|
BasePinImpl_QueryAccept,
|
2005-05-27 21:22:39 +02:00
|
|
|
VfwPin_EnumMediaTypes,
|
|
|
|
VfwPin_QueryInternalConnections,
|
2010-10-22 23:21:10 +02:00
|
|
|
BaseOutputPinImpl_EndOfStream,
|
|
|
|
BaseOutputPinImpl_BeginFlush,
|
|
|
|
BaseOutputPinImpl_EndFlush,
|
2010-11-01 13:42:14 +01:00
|
|
|
BasePinImpl_NewSegment
|
2005-05-27 21:22:39 +02:00
|
|
|
};
|