Commit e2abd392 authored by Jactry Zeng's avatar Jactry Zeng Committed by Alexandre Julliard

qcap/videocapture: Implement IAMFilterMiscFlags interface.

parent 974971ad
......@@ -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);
}
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment