From: Anton Baskanov baskanov@gmail.com
Signed-off-by: Anton Baskanov baskanov@gmail.com --- configure | 2 ++ configure.ac | 1 + dlls/l3codecx.ax/Makefile.in | 4 ++++ dlls/l3codecx.ax/l3codecx.ax.spec | 5 +++++ dlls/l3codecx.ax/main.c | 36 +++++++++++++++++++++++++++++++ 5 files changed, 48 insertions(+) create mode 100644 dlls/l3codecx.ax/Makefile.in create mode 100644 dlls/l3codecx.ax/l3codecx.ax.spec create mode 100644 dlls/l3codecx.ax/main.c
diff --git a/configure b/configure index 3088184aade..541dcc931ab 100755 --- a/configure +++ b/configure @@ -1152,6 +1152,7 @@ enable_ksproxy_ax enable_ksuser enable_ktmw32 enable_l3codeca_acm +enable_l3codecx_ax enable_light_msstyles enable_loadperf enable_localspl @@ -21610,6 +21611,7 @@ wine_fn_config_makefile dlls/ksproxy.ax enable_ksproxy_ax wine_fn_config_makefile dlls/ksuser enable_ksuser wine_fn_config_makefile dlls/ktmw32 enable_ktmw32 wine_fn_config_makefile dlls/l3codeca.acm enable_l3codeca_acm +wine_fn_config_makefile dlls/l3codecx.ax enable_l3codecx_ax wine_fn_config_makefile dlls/light.msstyles enable_light_msstyles wine_fn_config_makefile dlls/loadperf enable_loadperf wine_fn_config_makefile dlls/localspl enable_localspl diff --git a/configure.ac b/configure.ac index 1e733962b75..2b53c2c1152 100644 --- a/configure.ac +++ b/configure.ac @@ -2714,6 +2714,7 @@ WINE_CONFIG_MAKEFILE(dlls/ksproxy.ax) WINE_CONFIG_MAKEFILE(dlls/ksuser) WINE_CONFIG_MAKEFILE(dlls/ktmw32) WINE_CONFIG_MAKEFILE(dlls/l3codeca.acm) +WINE_CONFIG_MAKEFILE(dlls/l3codecx.ax) WINE_CONFIG_MAKEFILE(dlls/light.msstyles) WINE_CONFIG_MAKEFILE(dlls/loadperf) WINE_CONFIG_MAKEFILE(dlls/localspl) diff --git a/dlls/l3codecx.ax/Makefile.in b/dlls/l3codecx.ax/Makefile.in new file mode 100644 index 00000000000..110a6d3633a --- /dev/null +++ b/dlls/l3codecx.ax/Makefile.in @@ -0,0 +1,4 @@ +MODULE = l3codecx.ax + +C_SRCS = \ + main.c diff --git a/dlls/l3codecx.ax/l3codecx.ax.spec b/dlls/l3codecx.ax/l3codecx.ax.spec new file mode 100644 index 00000000000..25104058c7d --- /dev/null +++ b/dlls/l3codecx.ax/l3codecx.ax.spec @@ -0,0 +1,5 @@ +@ stub CreateInstance +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/dlls/l3codecx.ax/main.c b/dlls/l3codecx.ax/main.c new file mode 100644 index 00000000000..068e353e266 --- /dev/null +++ b/dlls/l3codecx.ax/main.c @@ -0,0 +1,36 @@ +/* + * Copyright 2022 Anton Baskanov + * Copyright 2022 Rémi Bernon for CodeWeavers + * + * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(l3codecx); + +/************************************************************************* + * DllGetClassObject (L3CODECX.AX.@) + */ +HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID iid, void **obj ) +{ + FIXME( "class %s not available\n", debugstr_guid( clsid ) ); + return CLASS_E_CLASSNOTAVAILABLE; +}
On 10/5/22 03:11, Anton Baskanov wrote:
From: Anton Baskanov baskanov@gmail.com
Signed-off-by: Anton Baskanov baskanov@gmail.com
configure | 2 ++ configure.ac | 1 + dlls/l3codecx.ax/Makefile.in | 4 ++++ dlls/l3codecx.ax/l3codecx.ax.spec | 5 +++++ dlls/l3codecx.ax/main.c | 36 +++++++++++++++++++++++++++++++ 5 files changed, 48 insertions(+) create mode 100644 dlls/l3codecx.ax/Makefile.in create mode 100644 dlls/l3codecx.ax/l3codecx.ax.spec create mode 100644 dlls/l3codecx.ax/main.c
Judging from your "l3codecx" branch (and from what I'd expect), we're not actually going to vend this from l3codecx.ax, right?
I don't remember if it's possible with our build system to have a test module without a corresponding DLL, but if not, I'd be tempted just to put these tests in quartz instead.
Not a big deal, though.
From: Anton Baskanov baskanov@gmail.com
Signed-off-by: Anton Baskanov baskanov@gmail.com --- configure | 1 + configure.ac | 1 + dlls/l3codecx.ax/tests/Makefile.in | 5 ++ dlls/l3codecx.ax/tests/l3codecx.c | 119 +++++++++++++++++++++++++++++ 4 files changed, 126 insertions(+) create mode 100644 dlls/l3codecx.ax/tests/Makefile.in create mode 100644 dlls/l3codecx.ax/tests/l3codecx.c
diff --git a/configure b/configure index 541dcc931ab..a7f0df379e3 100755 --- a/configure +++ b/configure @@ -21612,6 +21612,7 @@ wine_fn_config_makefile dlls/ksuser enable_ksuser wine_fn_config_makefile dlls/ktmw32 enable_ktmw32 wine_fn_config_makefile dlls/l3codeca.acm enable_l3codeca_acm wine_fn_config_makefile dlls/l3codecx.ax enable_l3codecx_ax +wine_fn_config_makefile dlls/l3codecx.ax/tests enable_tests wine_fn_config_makefile dlls/light.msstyles enable_light_msstyles wine_fn_config_makefile dlls/loadperf enable_loadperf wine_fn_config_makefile dlls/localspl enable_localspl diff --git a/configure.ac b/configure.ac index 2b53c2c1152..9c6ac1cd2fa 100644 --- a/configure.ac +++ b/configure.ac @@ -2715,6 +2715,7 @@ WINE_CONFIG_MAKEFILE(dlls/ksuser) WINE_CONFIG_MAKEFILE(dlls/ktmw32) WINE_CONFIG_MAKEFILE(dlls/l3codeca.acm) WINE_CONFIG_MAKEFILE(dlls/l3codecx.ax) +WINE_CONFIG_MAKEFILE(dlls/l3codecx.ax/tests) WINE_CONFIG_MAKEFILE(dlls/light.msstyles) WINE_CONFIG_MAKEFILE(dlls/loadperf) WINE_CONFIG_MAKEFILE(dlls/localspl) diff --git a/dlls/l3codecx.ax/tests/Makefile.in b/dlls/l3codecx.ax/tests/Makefile.in new file mode 100644 index 00000000000..aad3f652f60 --- /dev/null +++ b/dlls/l3codecx.ax/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = l3codecx.ax +IMPORTS = ole32 strmiids uuid + +C_SRCS = \ + l3codecx.c diff --git a/dlls/l3codecx.ax/tests/l3codecx.c b/dlls/l3codecx.ax/tests/l3codecx.c new file mode 100644 index 00000000000..0fc958544d5 --- /dev/null +++ b/dlls/l3codecx.ax/tests/l3codecx.c @@ -0,0 +1,119 @@ +/* + * Copyright 2022 Anton Baskanov + * Copyright 2018 Zebediah Figura + * + * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS +#include "dshow.h" +#include "wine/test.h" + +#include "initguid.h" +DEFINE_GUID(CLSID_mpeg_layer3_decoder, 0x38be3000, 0xdbf4, 0x11d0, 0x86, 0x0e, 0x00, 0xa0, 0x24, 0xcf, 0xef, 0x6d); + +static IBaseFilter *create_mpeg_layer3_decoder(void) +{ + IBaseFilter *filter = NULL; + HRESULT hr = CoCreateInstance(&CLSID_mpeg_layer3_decoder, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + return filter; +} + +#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + +static void test_interfaces(void) +{ + IBaseFilter *filter = create_mpeg_layer3_decoder(); + IPin *pin; + + check_interface(filter, &IID_IBaseFilter, TRUE); + check_interface(filter, &IID_IMediaFilter, TRUE); + check_interface(filter, &IID_IPersist, TRUE); + check_interface(filter, &IID_IUnknown, TRUE); + + check_interface(filter, &IID_IMpegAudioDecoder, FALSE); + check_interface(filter, &IID_IAMFilterMiscFlags, FALSE); + check_interface(filter, &IID_IBasicAudio, FALSE); + check_interface(filter, &IID_IBasicVideo, FALSE); + check_interface(filter, &IID_IKsPropertySet, FALSE); + check_interface(filter, &IID_IMediaPosition, FALSE); + check_interface(filter, &IID_IMediaSeeking, FALSE); + check_interface(filter, &IID_IPin, FALSE); + check_interface(filter, &IID_IQualityControl, FALSE); + check_interface(filter, &IID_IQualProp, FALSE); + check_interface(filter, &IID_IReferenceClock, FALSE); + check_interface(filter, &IID_IVideoWindow, FALSE); + check_interface(filter, &IID_IPersistPropertyBag, FALSE); + + IBaseFilter_FindPin(filter, L"In", &pin); + + check_interface(pin, &IID_IMemInputPin, TRUE); + check_interface(pin, &IID_IPin, TRUE); + check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IMediaPosition, FALSE); + check_interface(pin, &IID_IMediaSeeking, FALSE); + + IPin_Release(pin); + + IBaseFilter_FindPin(filter, L"Out", &pin); + + check_interface(pin, &IID_IPin, TRUE); + check_interface(pin, &IID_IMediaPosition, TRUE); + check_interface(pin, &IID_IMediaSeeking, TRUE); + check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IAsyncReader, FALSE); + + IPin_Release(pin); + + IBaseFilter_Release(filter); +} + +START_TEST(l3codecx) +{ + IBaseFilter *filter; + + CoInitialize(NULL); + + if (FAILED(CoCreateInstance(&CLSID_mpeg_layer3_decoder, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter))) + { + skip("Failed to create MPEG layer-3 decoder instance.\n"); + return; + } + IBaseFilter_Release(filter); + + test_interfaces(); + + CoUninitialize(); +}
From: Anton Baskanov baskanov@gmail.com
Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/l3codecx.ax/tests/l3codecx.c | 102 ++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+)
diff --git a/dlls/l3codecx.ax/tests/l3codecx.c b/dlls/l3codecx.ax/tests/l3codecx.c index 0fc958544d5..d307b3fe776 100644 --- a/dlls/l3codecx.ax/tests/l3codecx.c +++ b/dlls/l3codecx.ax/tests/l3codecx.c @@ -33,6 +33,13 @@ static IBaseFilter *create_mpeg_layer3_decoder(void) return filter; }
+static ULONG get_refcount(void *iface) +{ + IUnknown *unknown = iface; + IUnknown_AddRef(unknown); + return IUnknown_Release(unknown); +} + #define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) { @@ -99,6 +106,100 @@ static void test_interfaces(void) IBaseFilter_Release(filter); }
+static const GUID test_iid = {0x33333333}; +static LONG outer_ref = 1; + +static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out) +{ + if (IsEqualGUID(iid, &IID_IUnknown) + || IsEqualGUID(iid, &IID_IBaseFilter) + || IsEqualGUID(iid, &test_iid)) + { + *out = (IUnknown *)0xdeadbeef; + return S_OK; + } + ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI outer_AddRef(IUnknown *iface) +{ + return InterlockedIncrement(&outer_ref); +} + +static ULONG WINAPI outer_Release(IUnknown *iface) +{ + return InterlockedDecrement(&outer_ref); +} + +static const IUnknownVtbl outer_vtbl = +{ + outer_QueryInterface, + outer_AddRef, + outer_Release, +}; + +static IUnknown test_outer = {&outer_vtbl}; + +static void test_aggregation(void) +{ + IBaseFilter *filter, *filter2; + IUnknown *unk, *unk2; + HRESULT hr; + ULONG ref; + + filter = (IBaseFilter *)0xdeadbeef; + hr = CoCreateInstance(&CLSID_mpeg_layer3_decoder, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr); + ok(!filter, "Got interface %p.\n", filter); + + hr = CoCreateInstance(&CLSID_mpeg_layer3_decoder, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void **)&unk); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref); + ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n"); + ref = get_refcount(unk); + ok(ref == 1, "Got unexpected refcount %ld.\n", ref); + + ref = IUnknown_AddRef(unk); + ok(ref == 2, "Got unexpected refcount %ld.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref); + + ref = IUnknown_Release(unk); + ok(ref == 1, "Got unexpected refcount %ld.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref); + + hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2); + + hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2); + ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr); + ok(!unk2, "Got unexpected IUnknown %p.\n", unk2); + + hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + IBaseFilter_Release(filter); + ref = IUnknown_Release(unk); + ok(!ref, "Got unexpected refcount %ld.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref); +} + START_TEST(l3codecx) { IBaseFilter *filter; @@ -114,6 +215,7 @@ START_TEST(l3codecx) IBaseFilter_Release(filter);
test_interfaces(); + test_aggregation();
CoUninitialize(); }
From: Anton Baskanov baskanov@gmail.com
Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/l3codecx.ax/tests/l3codecx.c | 58 +++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
diff --git a/dlls/l3codecx.ax/tests/l3codecx.c b/dlls/l3codecx.ax/tests/l3codecx.c index d307b3fe776..20e92a77b5c 100644 --- a/dlls/l3codecx.ax/tests/l3codecx.c +++ b/dlls/l3codecx.ax/tests/l3codecx.c @@ -200,6 +200,63 @@ static void test_aggregation(void) ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref); }
+static void test_unconnected_filter_state(void) +{ + IBaseFilter *filter = create_mpeg_layer3_decoder(); + FILTER_STATE state; + HRESULT hr; + ULONG ref; + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(state == State_Stopped, "Got state %u.\n", state); + + hr = IBaseFilter_Pause(filter); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(state == State_Paused, "Got state %u.\n", state); + + hr = IBaseFilter_Run(filter, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(state == State_Running, "Got state %u.\n", state); + + hr = IBaseFilter_Pause(filter); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(state == State_Paused, "Got state %u.\n", state); + + hr = IBaseFilter_Stop(filter); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(state == State_Stopped, "Got state %u.\n", state); + + hr = IBaseFilter_Run(filter, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(state == State_Running, "Got state %u.\n", state); + + hr = IBaseFilter_Stop(filter); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(state == State_Stopped, "Got state %u.\n", state); + + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %ld.\n", ref); +} + START_TEST(l3codecx) { IBaseFilter *filter; @@ -216,6 +273,7 @@ START_TEST(l3codecx)
test_interfaces(); test_aggregation(); + test_unconnected_filter_state();
CoUninitialize(); }
From: Anton Baskanov baskanov@gmail.com
Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/l3codecx.ax/tests/l3codecx.c | 122 ++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+)
diff --git a/dlls/l3codecx.ax/tests/l3codecx.c b/dlls/l3codecx.ax/tests/l3codecx.c index 20e92a77b5c..efa4332944a 100644 --- a/dlls/l3codecx.ax/tests/l3codecx.c +++ b/dlls/l3codecx.ax/tests/l3codecx.c @@ -257,6 +257,127 @@ static void test_unconnected_filter_state(void) ok(!ref, "Got outstanding refcount %ld.\n", ref); }
+static void test_enum_pins(void) +{ + IBaseFilter *filter = create_mpeg_layer3_decoder(); + IEnumPins *enum1, *enum2; + ULONG count, ref; + IPin *pins[3]; + HRESULT hr; + + ref = get_refcount(filter); + ok(ref == 1, "Got unexpected refcount %ld.\n", ref); + + hr = IBaseFilter_EnumPins(filter, NULL); + ok(hr == E_POINTER, "Got hr %#lx.\n", hr); + + hr = IBaseFilter_EnumPins(filter, &enum1); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ref = get_refcount(filter); + ok(ref == 2, "Got unexpected refcount %ld.\n", ref); + ref = get_refcount(enum1); + ok(ref == 1, "Got unexpected refcount %ld.\n", ref); + + hr = IEnumPins_Next(enum1, 1, NULL, NULL); + ok(hr == E_POINTER, "Got hr %#lx.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ref = get_refcount(filter); + ok(ref == 3, "Got unexpected refcount %ld.\n", ref); + ref = get_refcount(pins[0]); + ok(ref == 3, "Got unexpected refcount %ld.\n", ref); + ref = get_refcount(enum1); + ok(ref == 1, "Got unexpected refcount %ld.\n", ref); + IPin_Release(pins[0]); + ref = get_refcount(filter); + ok(ref == 2, "Got unexpected refcount %ld.\n", ref); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ref = get_refcount(filter); + ok(ref == 3, "Got unexpected refcount %ld.\n", ref); + ref = get_refcount(pins[0]); + ok(ref == 3, "Got unexpected refcount %ld.\n", ref); + ref = get_refcount(enum1); + ok(ref == 1, "Got unexpected refcount %ld.\n", ref); + IPin_Release(pins[0]); + ref = get_refcount(filter); + ok(ref == 2, "Got unexpected refcount %ld.\n", ref); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#lx.\n", hr); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, &count); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(count == 1, "Got count %lu.\n", count); + IPin_Release(pins[0]); + + hr = IEnumPins_Next(enum1, 1, pins, &count); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(count == 1, "Got count %lu.\n", count); + IPin_Release(pins[0]); + + hr = IEnumPins_Next(enum1, 1, pins, &count); + ok(hr == S_FALSE, "Got hr %#lx.\n", hr); + ok(!count, "Got count %lu.\n", count); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IEnumPins_Next(enum1, 2, pins, NULL); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); + + hr = IEnumPins_Next(enum1, 2, pins, &count); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(count == 2, "Got count %lu.\n", count); + IPin_Release(pins[0]); + IPin_Release(pins[1]); + + hr = IEnumPins_Next(enum1, 2, pins, &count); + ok(hr == S_FALSE, "Got hr %#lx.\n", hr); + ok(!count, "Got count %lu.\n", count); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IEnumPins_Next(enum1, 3, pins, &count); + ok(hr == S_FALSE, "Got hr %#lx.\n", hr); + ok(count == 2, "Got count %lu.\n", count); + IPin_Release(pins[0]); + IPin_Release(pins[1]); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IEnumPins_Clone(enum1, &enum2); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IEnumPins_Skip(enum1, 3); + ok(hr == S_FALSE, "Got hr %#lx.\n", hr); + + hr = IEnumPins_Skip(enum1, 2); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IEnumPins_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#lx.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#lx.\n", hr); + + hr = IEnumPins_Next(enum2, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + IPin_Release(pins[0]); + + IEnumPins_Release(enum2); + IEnumPins_Release(enum1); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %ld.\n", ref); +} + START_TEST(l3codecx) { IBaseFilter *filter; @@ -274,6 +395,7 @@ START_TEST(l3codecx) test_interfaces(); test_aggregation(); test_unconnected_filter_state(); + test_enum_pins();
CoUninitialize(); }
From: Anton Baskanov baskanov@gmail.com
Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/l3codecx.ax/tests/l3codecx.c | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
diff --git a/dlls/l3codecx.ax/tests/l3codecx.c b/dlls/l3codecx.ax/tests/l3codecx.c index efa4332944a..6ff5f7d36c6 100644 --- a/dlls/l3codecx.ax/tests/l3codecx.c +++ b/dlls/l3codecx.ax/tests/l3codecx.c @@ -378,6 +378,47 @@ static void test_enum_pins(void) ok(!ref, "Got outstanding refcount %ld.\n", ref); }
+static void test_find_pin(void) +{ + IBaseFilter *filter = create_mpeg_layer3_decoder(); + IEnumPins *enum_pins; + IPin *pin, *pin2; + HRESULT hr; + ULONG ref; + + hr = IBaseFilter_EnumPins(filter, &enum_pins); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IBaseFilter_FindPin(filter, L"In", &pin); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(pin == pin2, "Pins didn't match.\n"); + IPin_Release(pin); + IPin_Release(pin2); + + hr = IBaseFilter_FindPin(filter, L"Out", &pin); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(pin == pin2, "Pins didn't match.\n"); + IPin_Release(pin); + IPin_Release(pin2); + + hr = IBaseFilter_FindPin(filter, L"XForm In", &pin); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr); + hr = IBaseFilter_FindPin(filter, L"XForm Out", &pin); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr); + hr = IBaseFilter_FindPin(filter, L"input pin", &pin); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr); + hr = IBaseFilter_FindPin(filter, L"output pin", &pin); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr); + + IEnumPins_Release(enum_pins); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %ld.\n", ref); +} + START_TEST(l3codecx) { IBaseFilter *filter; @@ -396,6 +437,7 @@ START_TEST(l3codecx) test_aggregation(); test_unconnected_filter_state(); test_enum_pins(); + test_find_pin();
CoUninitialize(); }
From: Anton Baskanov baskanov@gmail.com
Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/l3codecx.ax/tests/l3codecx.c | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
diff --git a/dlls/l3codecx.ax/tests/l3codecx.c b/dlls/l3codecx.ax/tests/l3codecx.c index 6ff5f7d36c6..d6a5c7940cc 100644 --- a/dlls/l3codecx.ax/tests/l3codecx.c +++ b/dlls/l3codecx.ax/tests/l3codecx.c @@ -419,6 +419,75 @@ static void test_find_pin(void) ok(!ref, "Got outstanding refcount %ld.\n", ref); }
+static void test_pin_info(void) +{ + IBaseFilter *filter = create_mpeg_layer3_decoder(); + PIN_DIRECTION dir; + PIN_INFO info; + HRESULT hr; + WCHAR *id; + ULONG ref; + IPin *pin; + + hr = IBaseFilter_FindPin(filter, L"In", &pin); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ref = get_refcount(filter); + ok(ref == 2, "Got unexpected refcount %ld.\n", ref); + ref = get_refcount(pin); + ok(ref == 2, "Got unexpected refcount %ld.\n", ref); + + hr = IPin_QueryPinInfo(pin, &info); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter); + ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir); + ok(!wcscmp(info.achName, L"XForm In"), "Got name %s.\n", debugstr_w(info.achName)); + ref = get_refcount(filter); + ok(ref == 3, "Got unexpected refcount %ld.\n", ref); + ref = get_refcount(pin); + ok(ref == 3, "Got unexpected refcount %ld.\n", ref); + IBaseFilter_Release(info.pFilter); + + hr = IPin_QueryDirection(pin, &dir); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir); + + hr = IPin_QueryId(pin, &id); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(!wcscmp(id, L"In"), "Got id %s.\n", wine_dbgstr_w(id)); + CoTaskMemFree(id); + + hr = IPin_QueryInternalConnections(pin, NULL, NULL); + ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr); + + IPin_Release(pin); + + hr = IBaseFilter_FindPin(filter, L"Out", &pin); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IPin_QueryPinInfo(pin, &info); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter); + ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir); + ok(!wcscmp(info.achName, L"XForm Out"), "Got name %s.\n", debugstr_w(info.achName)); + IBaseFilter_Release(info.pFilter); + + hr = IPin_QueryDirection(pin, &dir); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir); + + hr = IPin_QueryId(pin, &id); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(!wcscmp(id, L"Out"), "Got id %s.\n", wine_dbgstr_w(id)); + CoTaskMemFree(id); + + hr = IPin_QueryInternalConnections(pin, NULL, NULL); + ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr); + + IPin_Release(pin); + + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %ld.\n", ref); +} + START_TEST(l3codecx) { IBaseFilter *filter; @@ -438,6 +507,7 @@ START_TEST(l3codecx) test_unconnected_filter_state(); test_enum_pins(); test_find_pin(); + test_pin_info();
CoUninitialize(); }