qcap/videocapture: Implement IAMFilterMiscFlags interface.

Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jactry Zeng 2020-05-13 11:27:50 -05:00 committed by Alexandre Julliard
parent 974971ade3
commit e2abd392c0
2 changed files with 58 additions and 1 deletions

View File

@ -215,7 +215,7 @@ static void test_capture(IBaseFilter *filter)
IEnumPins_Release(enum_pins);
todo_wine check_interface(filter, &IID_IAMFilterMiscFlags, TRUE);
check_interface(filter, &IID_IAMFilterMiscFlags, TRUE);
todo_wine check_interface(filter, &IID_IAMVideoControl, TRUE);
check_interface(filter, &IID_IAMVideoProcAmp, TRUE);
check_interface(filter, &IID_IBaseFilter, TRUE);
@ -235,6 +235,22 @@ static void test_capture(IBaseFilter *filter)
check_interface(filter, &IID_IOverlayNotify, FALSE);
}
static void test_misc_flags(IBaseFilter *filter)
{
IAMFilterMiscFlags *misc_flags;
ULONG flags;
HRESULT hr;
hr = IBaseFilter_QueryInterface(filter, &IID_IAMFilterMiscFlags, (void **)&misc_flags);
ok(hr == S_OK, "Got hr %#x.\n", hr);
flags = IAMFilterMiscFlags_GetMiscFlags(misc_flags);
ok(flags == AM_FILTER_MISC_FLAGS_IS_SOURCE
|| broken(!flags) /* win7 */, "Got wrong flags: %#x.\n", flags);
IAMFilterMiscFlags_Release(misc_flags);
}
START_TEST(videocapture)
{
ICreateDevEnum *dev_enum;
@ -272,6 +288,7 @@ START_TEST(videocapture)
if (hr == S_OK)
{
test_capture(filter);
test_misc_flags(filter);
ref = IBaseFilter_Release(filter);
ok(!ref, "Got outstanding refcount %d.\n", ref);
}

View File

@ -49,6 +49,7 @@ typedef struct VfwCapture
struct strmbase_filter filter;
IAMStreamConfig IAMStreamConfig_iface;
IAMVideoProcAmp IAMVideoProcAmp_iface;
IAMFilterMiscFlags IAMFilterMiscFlags_iface;
IPersistPropertyBag IPersistPropertyBag_iface;
BOOL init;
Capture *driver_info;
@ -72,6 +73,11 @@ static inline VfwCapture *impl_from_IAMVideoProcAmp(IAMVideoProcAmp *iface)
return CONTAINING_RECORD(iface, VfwCapture, IAMVideoProcAmp_iface);
}
static inline VfwCapture *impl_from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface)
{
return CONTAINING_RECORD(iface, VfwCapture, IAMFilterMiscFlags_iface);
}
static inline VfwCapture *impl_from_IPersistPropertyBag(IPersistPropertyBag *iface)
{
return CONTAINING_RECORD(iface, VfwCapture, IPersistPropertyBag_iface);
@ -117,6 +123,8 @@ static HRESULT vfw_capture_query_interface(struct strmbase_filter *iface, REFIID
*out = &filter->IPersistPropertyBag_iface;
else if (IsEqualGUID(iid, &IID_IAMVideoProcAmp))
*out = &filter->IAMVideoProcAmp_iface;
else if (IsEqualGUID(iid, &IID_IAMFilterMiscFlags))
*out = &filter->IAMFilterMiscFlags_iface;
else
return E_NOINTERFACE;
@ -574,6 +582,37 @@ static const struct strmbase_source_ops source_ops =
.pfnDecideAllocator = BaseOutputPinImpl_DecideAllocator,
};
static HRESULT WINAPI misc_flags_QueryInterface(IAMFilterMiscFlags *iface, REFIID riid, void **ppv)
{
VfwCapture *filter = impl_from_IAMFilterMiscFlags(iface);
return IUnknown_QueryInterface(filter->filter.outer_unk, riid, ppv);
}
static ULONG WINAPI misc_flags_AddRef(IAMFilterMiscFlags *iface)
{
VfwCapture *filter = impl_from_IAMFilterMiscFlags(iface);
return IUnknown_AddRef(filter->filter.outer_unk);
}
static ULONG WINAPI misc_flags_Release(IAMFilterMiscFlags *iface)
{
VfwCapture *filter = impl_from_IAMFilterMiscFlags(iface);
return IUnknown_Release(filter->filter.outer_unk);
}
static ULONG WINAPI misc_flags_GetMiscFlags(IAMFilterMiscFlags *iface)
{
return AM_FILTER_MISC_FLAGS_IS_SOURCE;
}
static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_VTable =
{
misc_flags_QueryInterface,
misc_flags_AddRef,
misc_flags_Release,
misc_flags_GetMiscFlags
};
HRESULT vfw_capture_create(IUnknown *outer, IUnknown **out)
{
static const WCHAR source_name[] = {'O','u','t','p','u','t',0};
@ -586,6 +625,7 @@ HRESULT vfw_capture_create(IUnknown *outer, IUnknown **out)
object->IAMStreamConfig_iface.lpVtbl = &IAMStreamConfig_VTable;
object->IAMVideoProcAmp_iface.lpVtbl = &IAMVideoProcAmp_VTable;
object->IAMFilterMiscFlags_iface.lpVtbl = &IAMFilterMiscFlags_VTable;
object->IPersistPropertyBag_iface.lpVtbl = &IPersistPropertyBag_VTable;
object->init = FALSE;