Commit 91d0d9ec authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

qcap/filewriter: Implement IAMFilterMiscFlags.

parent 28f17d8e
......@@ -29,6 +29,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qcap);
struct file_writer
{
struct strmbase_filter filter;
IAMFilterMiscFlags IAMFilterMiscFlags_iface;
IFileSinkFilter IFileSinkFilter_iface;
struct strmbase_sink sink;
......@@ -105,7 +106,9 @@ static HRESULT file_writer_query_interface(struct strmbase_filter *iface, REFIID
{
struct file_writer *filter = impl_from_strmbase_filter(iface);
if (IsEqualGUID(iid, &IID_IFileSinkFilter))
if (IsEqualGUID(iid, &IID_IAMFilterMiscFlags))
*out = &filter->IAMFilterMiscFlags_iface;
else if (IsEqualGUID(iid, &IID_IFileSinkFilter))
*out = &filter->IFileSinkFilter_iface;
else
return E_NOINTERFACE;
......@@ -228,6 +231,46 @@ static const IFileSinkFilterVtbl filesinkfilter_vtbl =
filesinkfilter_GetCurFile,
};
static inline struct file_writer *impl_from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface)
{
return CONTAINING_RECORD(iface, struct file_writer, IAMFilterMiscFlags_iface);
}
static HRESULT WINAPI misc_flags_QueryInterface(IAMFilterMiscFlags *iface, REFIID iid, void **out)
{
struct file_writer *filter = impl_from_IAMFilterMiscFlags(iface);
return IUnknown_QueryInterface(filter->filter.outer_unk, iid, out);
}
static ULONG WINAPI misc_flags_AddRef(IAMFilterMiscFlags *iface)
{
struct file_writer *filter = impl_from_IAMFilterMiscFlags(iface);
return IUnknown_AddRef(filter->filter.outer_unk);
}
static ULONG WINAPI misc_flags_Release(IAMFilterMiscFlags *iface)
{
struct file_writer *filter = impl_from_IAMFilterMiscFlags(iface);
return IUnknown_Release(filter->filter.outer_unk);
}
static ULONG WINAPI misc_flags_GetMiscFlags(IAMFilterMiscFlags *iface)
{
struct file_writer *filter = impl_from_IAMFilterMiscFlags(iface);
TRACE("filter %p.\n", filter);
return AM_FILTER_MISC_FLAGS_IS_RENDERER;
}
static const IAMFilterMiscFlagsVtbl misc_flags_vtbl =
{
misc_flags_QueryInterface,
misc_flags_AddRef,
misc_flags_Release,
misc_flags_GetMiscFlags,
};
HRESULT file_writer_create(IUnknown *outer, IUnknown **out)
{
static const WCHAR sink_name[] = {'i','n',0};
......@@ -238,6 +281,7 @@ HRESULT file_writer_create(IUnknown *outer, IUnknown **out)
strmbase_filter_init(&object->filter, outer, &CLSID_FileWriter, &filter_ops);
object->IFileSinkFilter_iface.lpVtbl = &filesinkfilter_vtbl;
object->IAMFilterMiscFlags_iface.lpVtbl = &misc_flags_vtbl;
strmbase_sink_init(&object->sink, &object->filter, sink_name, &sink_ops, NULL);
......
......@@ -78,7 +78,7 @@ static void test_interfaces(void)
ULONG ref;
IPin *pin;
todo_wine check_interface(filter, &IID_IAMFilterMiscFlags, TRUE);
check_interface(filter, &IID_IAMFilterMiscFlags, TRUE);
check_interface(filter, &IID_IBaseFilter, TRUE);
check_interface(filter, &IID_IFileSinkFilter, TRUE);
todo_wine check_interface(filter, &IID_IFileSinkFilter2, TRUE);
......@@ -769,6 +769,22 @@ static void test_connect_pin(void)
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
static void test_misc_flags(void)
{
IBaseFilter *filter = create_file_writer();
IAMFilterMiscFlags *misc_flags;
ULONG flags, ref;
IBaseFilter_QueryInterface(filter, &IID_IAMFilterMiscFlags, (void **)&misc_flags);
flags = IAMFilterMiscFlags_GetMiscFlags(misc_flags);
ok(flags == AM_FILTER_MISC_FLAGS_IS_RENDERER, "Got flags %#x.\n", flags);
IAMFilterMiscFlags_Release(misc_flags);
ref = IBaseFilter_Release(filter);
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
START_TEST(filewriter)
{
CoInitializeEx(NULL, COINIT_MULTITHREADED);
......@@ -781,6 +797,7 @@ START_TEST(filewriter)
test_media_types();
test_enum_media_types();
test_connect_pin();
test_misc_flags();
CoUninitialize();
}
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