Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 441 +++++++++++++++++++++++++++++++- 1 file changed, 427 insertions(+), 14 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 6b6d8aeb20..f63f7386b4 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -26,6 +26,8 @@ #include "wine/heap.h" #include "wine/test.h"
+static const GUID testguid = {0xabbccdde}; + typedef struct TestFilterImpl { IBaseFilter IBaseFilter_iface; @@ -1165,6 +1167,10 @@ struct testfilter ULONG misc_flags;
IMediaSeeking IMediaSeeking_iface; + DWORD seek_caps; + BOOL support_testguid; + LONGLONG seek_duration, seek_current, seek_stop; + double seek_rate; };
static inline struct testfilter *impl_from_IEnumPins(IEnumPins *iface) @@ -1520,8 +1526,10 @@ static ULONG WINAPI testseek_Release(IMediaSeeking *iface)
static HRESULT WINAPI testseek_GetCapabilities(IMediaSeeking *iface, DWORD *caps) { + struct testfilter *filter = impl_from_IMediaSeeking(iface); if (winetest_debug > 1) trace("%p->GetCapabilities()\n", iface); - return E_NOTIMPL; + *caps = filter->seek_caps; + return S_OK; }
static HRESULT WINAPI testseek_CheckCapabilities(IMediaSeeking *iface, DWORD *caps) @@ -1532,13 +1540,16 @@ static HRESULT WINAPI testseek_CheckCapabilities(IMediaSeeking *iface, DWORD *ca
static HRESULT WINAPI testseek_IsFormatSupported(IMediaSeeking *iface, const GUID *format) { + struct testfilter *filter = impl_from_IMediaSeeking(iface); if (winetest_debug > 1) trace("%p->IsFormatSupported(%s)\n", iface, wine_dbgstr_guid(format)); + if (IsEqualGUID(format, &testguid) && !filter->support_testguid) + return S_FALSE; return S_OK; }
static HRESULT WINAPI testseek_QueryPreferredFormat(IMediaSeeking *iface, GUID *format) { - ok(0, "Unexpected call.\n"); + if (winetest_debug > 1) trace("%p->QueryPreferredFormat()\n", iface); return E_NOTIMPL; }
@@ -1551,25 +1562,32 @@ static HRESULT WINAPI testseek_GetTimeFormat(IMediaSeeking *iface, GUID *format) static HRESULT WINAPI testseek_IsUsingTimeFormat(IMediaSeeking *iface, const GUID *format) { if (winetest_debug > 1) trace("%p->IsUsingTimeFormat(%s)\n", iface, wine_dbgstr_guid(format)); - return S_FALSE; + return S_OK; }
static HRESULT WINAPI testseek_SetTimeFormat(IMediaSeeking *iface, const GUID *format) { - ok(0, "Unexpected call.\n"); - return E_NOTIMPL; + struct testfilter *filter = impl_from_IMediaSeeking(iface); + if (winetest_debug > 1) trace("%p->SetTimeFormat(%s)\n", iface, wine_dbgstr_guid(format)); + if (IsEqualGUID(format, &testguid) && !filter->support_testguid) + return E_INVALIDARG; + return S_OK; }
static HRESULT WINAPI testseek_GetDuration(IMediaSeeking *iface, LONGLONG *duration) { - ok(0, "Unexpected call.\n"); - return E_NOTIMPL; + struct testfilter *filter = impl_from_IMediaSeeking(iface); + if (winetest_debug > 1) trace("%p->GetDuration()\n", iface); + *duration = filter->seek_duration; + return S_OK; }
static HRESULT WINAPI testseek_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop) { - ok(0, "Unexpected call.\n"); - return E_NOTIMPL; + struct testfilter *filter = impl_from_IMediaSeeking(iface); + if (winetest_debug > 1) trace("%p->GetStopPosition()\n", iface); + *stop = filter->seek_stop; + return S_OK; }
static HRESULT WINAPI testseek_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *current) @@ -1588,8 +1606,14 @@ static HRESULT WINAPI testseek_ConvertTimeFormat(IMediaSeeking *iface, LONGLONG static HRESULT WINAPI testseek_SetPositions(IMediaSeeking *iface, LONGLONG *current, DWORD current_flags, LONGLONG *stop, DWORD stop_flags ) { - ok(0, "Unexpected call.\n"); - return E_NOTIMPL; + struct testfilter *filter = impl_from_IMediaSeeking(iface); + if (winetest_debug > 1) trace("%p->SetPositions(%s, %#x, %s, %#x)\n", + iface, wine_dbgstr_longlong(*current), current_flags, wine_dbgstr_longlong(*stop), stop_flags); + filter->seek_current = *current; + filter->seek_stop = *stop; + *current = 0x1234; + *stop = 0x4321; + return S_OK; }
static HRESULT WINAPI testseek_GetPositions(IMediaSeeking *iface, LONGLONG *current, LONGLONG *stop) @@ -1606,8 +1630,10 @@ static HRESULT WINAPI testseek_GetAvailable(IMediaSeeking *iface, LONGLONG *earl
static HRESULT WINAPI testseek_SetRate(IMediaSeeking *iface, double rate) { - ok(0, "Unexpected call.\n"); - return E_NOTIMPL; + struct testfilter *filter = impl_from_IMediaSeeking(iface); + if (winetest_debug > 1) trace("%p->SetRate(%.16e)\n", iface, rate); + filter->seek_rate = rate; + return S_OK; }
static HRESULT WINAPI testseek_GetRate(IMediaSeeking *iface, double *rate) @@ -1618,7 +1644,7 @@ static HRESULT WINAPI testseek_GetRate(IMediaSeeking *iface, double *rate)
static HRESULT WINAPI testseek_GetPreroll(IMediaSeeking *iface, LONGLONG *preroll) { - ok(0, "Unexpected call.\n"); + if (winetest_debug > 1) trace("%p->GetPreroll()\n", iface); return E_NOTIMPL; }
@@ -3217,6 +3243,392 @@ static void test_ec_complete(void) ok(filter3.ref == 1, "Got outstanding refcount %d.\n", filter3.ref); }
+static void test_graph_seeking(void) +{ + struct testfilter filter1, filter2; + + LONGLONG time, current, stop, earliest, latest; + IFilterGraph2 *graph = create_graph(); + IMediaSeeking *seeking; + unsigned int i; + double rate; + GUID format; + HRESULT hr; + DWORD caps; + ULONG ref; + + static const GUID *const all_formats[] = + { + NULL, + &TIME_FORMAT_NONE, + &TIME_FORMAT_FRAME, + &TIME_FORMAT_SAMPLE, + &TIME_FORMAT_FIELD, + &TIME_FORMAT_BYTE, + &TIME_FORMAT_MEDIA_TIME, + &testguid, + }; + + static const GUID *const unsupported_formats[] = + { + &TIME_FORMAT_FRAME, + &TIME_FORMAT_SAMPLE, + &TIME_FORMAT_FIELD, + &TIME_FORMAT_BYTE, + &testguid, + }; + + testfilter_init(&filter1, NULL, 0); + testfilter_init(&filter2, NULL, 0); + + filter1.IMediaSeeking_iface.lpVtbl = &testseek_vtbl; + filter2.IMediaSeeking_iface.lpVtbl = &testseek_vtbl; + + IFilterGraph2_QueryInterface(graph, &IID_IMediaSeeking, (void **)&seeking); + + hr = IMediaSeeking_GetCapabilities(seeking, &caps); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!caps, "Got caps %#x.\n", caps); + + caps = 0; + hr = IMediaSeeking_CheckCapabilities(seeking, &caps); + todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr); + ok(!caps, "Got caps %#x.\n", caps); + + caps = AM_SEEKING_CanSeekAbsolute; + hr = IMediaSeeking_CheckCapabilities(seeking, &caps); + todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr); + todo_wine ok(!caps, "Got caps %#x.\n", caps); + + hr = IMediaSeeking_IsFormatSupported(seeking, NULL); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + for (i = 0; i < ARRAY_SIZE(all_formats); ++i) + { + hr = IMediaSeeking_IsFormatSupported(seeking, all_formats[i]); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x for format %s.\n", hr, wine_dbgstr_guid(all_formats[i])); + } + + hr = IMediaSeeking_QueryPreferredFormat(seeking, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + hr = IMediaSeeking_QueryPreferredFormat(seeking, &format); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format)); + + hr = IMediaSeeking_GetTimeFormat(seeking, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + hr = IMediaSeeking_GetTimeFormat(seeking, &format); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format)); + + hr = IMediaSeeking_IsUsingTimeFormat(seeking, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_NONE); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_NONE); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_QueryPreferredFormat(seeking, &format); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format)); + + hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_NONE); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_GetTimeFormat(seeking, &format); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format)); + + hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + for (i = 0; i < ARRAY_SIZE(unsupported_formats); ++i) + { + hr = IMediaSeeking_SetTimeFormat(seeking, unsupported_formats[i]); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x for format %s.\n", hr, wine_dbgstr_guid(unsupported_formats[i])); + } + + time = 0xdeadbeef; + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 0x123456789a, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time)); + + time = 0xdeadbeef; + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time)); + + time = 0xdeadbeef; + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 0x123456789a, &TIME_FORMAT_MEDIA_TIME); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time)); + + time = 0xdeadbeef; + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, &TIME_FORMAT_MEDIA_TIME); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time)); + + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_NONE, 0x123456789a, &TIME_FORMAT_MEDIA_TIME); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_NONE, 0x123456789a, NULL); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, &TIME_FORMAT_NONE); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 0x123456789a, &TIME_FORMAT_NONE); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + time = 0xdeadbeef; + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_NONE, 0x123456789a, &TIME_FORMAT_NONE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time)); + + time = 0xdeadbeef; + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &testguid, 0x123456789a, &testguid); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time)); + + hr = IMediaSeeking_GetDuration(seeking, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + hr = IMediaSeeking_GetDuration(seeking, &time); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_GetStopPosition(seeking, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + hr = IMediaSeeking_GetStopPosition(seeking, &time); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_SetPositions(seeking, ¤t, 0, &stop, 0); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_GetPositions(seeking, NULL, NULL); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSeeking_GetPositions(seeking, NULL, &stop); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + current = 0xdeadbeef; + hr = IMediaSeeking_GetPositions(seeking, ¤t, NULL); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!current, "Got time %s.\n", wine_dbgstr_longlong(time)); + + hr = IMediaSeeking_GetCurrentPosition(seeking, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + current = 0xdeadbeef; + hr = IMediaSeeking_GetCurrentPosition(seeking, ¤t); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!current, "Got time %s.\n", wine_dbgstr_longlong(time)); + + hr = IMediaSeeking_GetAvailable(seeking, &earliest, &latest); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_SetRate(seeking, 1.0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSeeking_SetRate(seeking, 2.0); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_GetRate(seeking, &rate); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(rate == 1.0, "Got rate %.16e.\n", rate); + + hr = IMediaSeeking_GetPreroll(seeking, &time); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + /* Try with filters added. Note that a filter need only expose + * IMediaSeeking—no other heuristics are used to determine if it is a + * renderer. */ + + IFilterGraph2_AddFilter(graph, &filter1.IBaseFilter_iface, NULL); + IFilterGraph2_AddFilter(graph, &filter2.IBaseFilter_iface, NULL); + + filter1.seek_caps = AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetCurrentPos; + filter2.seek_caps = AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetDuration; + hr = IMediaSeeking_GetCapabilities(seeking, &caps); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps); + + caps = AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetCurrentPos; + hr = IMediaSeeking_CheckCapabilities(seeking, &caps); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + todo_wine ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps); + + caps = AM_SEEKING_CanDoSegments; + hr = IMediaSeeking_CheckCapabilities(seeking, &caps); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps); + + caps = AM_SEEKING_CanGetCurrentPos; + hr = IMediaSeeking_CheckCapabilities(seeking, &caps); + todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr); + todo_wine ok(!caps, "Got caps %#x.\n", caps); + + hr = IMediaSeeking_IsFormatSupported(seeking, &testguid); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + filter1.support_testguid = TRUE; + hr = IMediaSeeking_IsFormatSupported(seeking, &testguid); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + filter1.support_testguid = FALSE; + filter2.support_testguid = TRUE; + hr = IMediaSeeking_IsFormatSupported(seeking, &testguid); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + /* Filters are not consulted about preferred formats. */ + hr = IMediaSeeking_QueryPreferredFormat(seeking, &format); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format)); + + hr = IMediaSeeking_GetTimeFormat(seeking, &format); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format)); + + filter2.support_testguid = FALSE; + hr = IMediaSeeking_SetTimeFormat(seeking, &testguid); + todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_GetTimeFormat(seeking, &format); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format)); + + filter1.support_testguid = TRUE; + hr = IMediaSeeking_SetTimeFormat(seeking, &testguid); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_GetTimeFormat(seeking, &format); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(IsEqualGUID(&format, &testguid), "Got format %s.\n", wine_dbgstr_guid(&format)); + + hr = IMediaSeeking_QueryPreferredFormat(seeking, &format); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format)); + + hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + hr = IMediaSeeking_IsUsingTimeFormat(seeking, &testguid); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + time = 0xdeadbeef; + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &testguid, 0x123456789a, &testguid); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time)); + + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &testguid, 0x123456789a, &TIME_FORMAT_NONE); + todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + filter1.seek_duration = 0x12345; + filter2.seek_duration = 0x23456; + hr = IMediaSeeking_GetDuration(seeking, &time); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(time == 0x23456, "Got time %s.\n", wine_dbgstr_longlong(time)); + + filter2.seek_duration = 0x12345; + filter1.seek_duration = 0x23456; + hr = IMediaSeeking_GetDuration(seeking, &time); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(time == 0x23456, "Got time %s.\n", wine_dbgstr_longlong(time)); + + filter1.seek_stop = 0x54321; + filter2.seek_stop = 0x65432; + hr = IMediaSeeking_GetStopPosition(seeking, &time); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(time == 0x65432, "Got time %s.\n", wine_dbgstr_longlong(time)); + + filter2.seek_stop = 0x54321; + filter1.seek_stop = 0x65432; + hr = IMediaSeeking_GetStopPosition(seeking, &time); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(time == 0x65432, "Got time %s.\n", wine_dbgstr_longlong(time)); + + hr = IMediaSeeking_GetCurrentPosition(seeking, &time); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!time, "Got time %s.\n", wine_dbgstr_longlong(time)); + + current = stop = 0xdeadbeef; + hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current)); + todo_wine ok(stop == 0x65432, "Got time %s.\n", wine_dbgstr_longlong(stop)); + + current = 0x123; + stop = 0x321; + hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning, + &stop, AM_SEEKING_AbsolutePositioning); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(current)); + ok(stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(stop)); + todo_wine ok(filter1.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_current)); + todo_wine ok(filter1.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_stop)); + todo_wine ok(filter2.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_current)); + todo_wine ok(filter2.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_stop)); + + hr = IMediaSeeking_GetCurrentPosition(seeking, &time); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(time == 0x1234, "Got time %s.\n", wine_dbgstr_longlong(time)); + + current = stop = 0xdeadbeef; + hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(current == 0x1234, "Got time %s.\n", wine_dbgstr_longlong(current)); + ok(stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(stop)); + + current = 0x123; + stop = 0x321; + hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime, + &stop, AM_SEEKING_AbsolutePositioning); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(current == 0x1234, "Got time %s.\n", wine_dbgstr_longlong(current)); + ok(stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(stop)); + todo_wine ok(filter1.seek_current == 0x1234, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_current)); + todo_wine ok(filter1.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_stop)); + todo_wine ok(filter2.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_current)); + todo_wine ok(filter2.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_stop)); + + current = 0x123; + stop = 0x321; + hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning, + &stop, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(current)); + todo_wine ok(stop == 0x4321, "Got time %s.\n", wine_dbgstr_longlong(stop)); + todo_wine ok(filter1.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_current)); + todo_wine ok(filter1.seek_stop == 0x4321, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_stop)); + todo_wine ok(filter2.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_current)); + todo_wine ok(filter2.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_stop)); + + hr = IMediaSeeking_SetRate(seeking, 2.0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(filter1.seek_rate == 2.0, "Got rate %.16e.\n", filter1.seek_rate); + todo_wine ok(filter2.seek_rate == 2.0, "Got rate %.16e.\n", filter2.seek_rate); + + hr = IMediaSeeking_SetRate(seeking, 1.0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(filter1.seek_rate == 1.0, "Got rate %.16e.\n", filter1.seek_rate); + todo_wine ok(filter2.seek_rate == 1.0, "Got rate %.16e.\n", filter2.seek_rate); + + hr = IMediaSeeking_SetRate(seeking, -1.0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(filter1.seek_rate == -1.0, "Got rate %.16e.\n", filter1.seek_rate); + todo_wine ok(filter2.seek_rate == -1.0, "Got rate %.16e.\n", filter2.seek_rate); + + hr = IMediaSeeking_GetRate(seeking, &rate); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(rate == -1.0, "Got rate %.16e.\n", rate); + + IMediaSeeking_Release(seeking); + ref = IFilterGraph2_Release(graph); + ok(!ref, "Got outstanding refcount %d.\n", hr); + ok(filter1.ref == 1, "Got outstanding refcount %d.\n", filter1.ref); + ok(filter2.ref == 1, "Got outstanding refcount %d.\n", filter2.ref); +} + START_TEST(filtergraph) { CoInitializeEx(NULL, COINIT_MULTITHREADED); @@ -3236,6 +3648,7 @@ START_TEST(filtergraph) test_sync_source(); test_filter_state(); test_ec_complete(); + test_graph_seeking();
CoUninitialize(); test_render_with_multithread();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/Makefile.in | 1 + dlls/qcap/tests/avimux.c | 86 +++++++++++++++++++++++++++++++++++++ dlls/qcap/tests/qcap.c | 41 ------------------ 3 files changed, 87 insertions(+), 41 deletions(-) create mode 100644 dlls/qcap/tests/avimux.c
diff --git a/dlls/qcap/tests/Makefile.in b/dlls/qcap/tests/Makefile.in index a5b9d0e474..7df8e24f67 100644 --- a/dlls/qcap/tests/Makefile.in +++ b/dlls/qcap/tests/Makefile.in @@ -4,6 +4,7 @@ IMPORTS = strmiids uuid oleaut32 ole32 advapi32 msvfw32 C_SRCS = \ audiorecord.c \ avico.c \ + avimux.c \ qcap.c \ smartteefilter.c \ videocapture.c diff --git a/dlls/qcap/tests/avimux.c b/dlls/qcap/tests/avimux.c new file mode 100644 index 0000000000..e204ec76ea --- /dev/null +++ b/dlls/qcap/tests/avimux.c @@ -0,0 +1,86 @@ +/* + * AVI muxer filter unit tests + * + * 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 "vfw.h" +#include "wine/test.h" + +static IBaseFilter *create_avi_mux(void) +{ + IBaseFilter *filter = NULL; + HRESULT hr = CoCreateInstance(&CLSID_AviDest, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + ok(hr == S_OK, "Got hr %#x.\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 %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + +static void test_interfaces(void) +{ + IBaseFilter *filter = create_avi_mux(); + + check_interface(filter, &IID_IBaseFilter, TRUE); + check_interface(filter, &IID_IConfigAviMux, TRUE); + check_interface(filter, &IID_IConfigInterleaving, TRUE); + check_interface(filter, &IID_IMediaFilter, TRUE); + check_interface(filter, &IID_IMediaSeeking, TRUE); + check_interface(filter, &IID_IPersist, TRUE); + check_interface(filter, &IID_IPersistMediaPropertyBag, TRUE); + check_interface(filter, &IID_ISpecifyPropertyPages, TRUE); + check_interface(filter, &IID_IUnknown, TRUE); + + 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_IPersistPropertyBag, 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); + + IBaseFilter_Release(filter); +} + +START_TEST(avimux) +{ + CoInitialize(NULL); + + test_interfaces(); + + CoUninitialize(); +} diff --git a/dlls/qcap/tests/qcap.c b/dlls/qcap/tests/qcap.c index c460991ec5..d880a26a67 100644 --- a/dlls/qcap/tests/qcap.c +++ b/dlls/qcap/tests/qcap.c @@ -1131,46 +1131,6 @@ static void init_test_filter(test_filter *This, PIN_DIRECTION dir, filter_type t This->filter_type = type; }
-static void test_AviMux_QueryInterface(void) -{ - IUnknown *avimux, *unk; - HRESULT hr; - - hr = CoCreateInstance(&CLSID_AviDest, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&avimux); - ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), - "couldn't create AVI Mux filter, hr = %08x\n", hr); - if(hr != S_OK) { - win_skip("AVI Mux filter is not registered\n"); - return; - } - - hr = IUnknown_QueryInterface(avimux, &IID_IBaseFilter, (void**)&unk); - ok(hr == S_OK, "QueryInterface(IID_IBaseFilter) failed: %x\n", hr); - IUnknown_Release(unk); - - hr = IUnknown_QueryInterface(avimux, &IID_IConfigAviMux, (void**)&unk); - ok(hr == S_OK, "QueryInterface(IID_IConfigAviMux) failed: %x\n", hr); - IUnknown_Release(unk); - - hr = IUnknown_QueryInterface(avimux, &IID_IConfigInterleaving, (void**)&unk); - ok(hr == S_OK, "QueryInterface(IID_IConfigInterleaving) failed: %x\n", hr); - IUnknown_Release(unk); - - hr = IUnknown_QueryInterface(avimux, &IID_IMediaSeeking, (void**)&unk); - ok(hr == S_OK, "QueryInterface(IID_IMediaSeeking) failed: %x\n", hr); - IUnknown_Release(unk); - - hr = IUnknown_QueryInterface(avimux, &IID_IPersistMediaPropertyBag, (void**)&unk); - ok(hr == S_OK, "QueryInterface(IID_IPersistMediaPropertyBag) failed: %x\n", hr); - IUnknown_Release(unk); - - hr = IUnknown_QueryInterface(avimux, &IID_ISpecifyPropertyPages, (void**)&unk); - ok(hr == S_OK, "QueryInterface(IID_ISpecifyPropertyPages) failed: %x\n", hr); - IUnknown_Release(unk); - - IUnknown_Release(avimux); -} - static HRESULT WINAPI MemAllocator_QueryInterface(IMemAllocator *iface, REFIID riid, void **ppvObject) { if(IsEqualIID(riid, &IID_IUnknown)) { @@ -1867,7 +1827,6 @@ START_TEST(qcap)
arg_c = winetest_get_mainargs(&arg_v);
- test_AviMux_QueryInterface(); test_AviMux(arg_c>2 ? arg_v[2] : NULL); test_COM_vfwcapture();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/avimux.c | 137 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+)
diff --git a/dlls/qcap/tests/avimux.c b/dlls/qcap/tests/avimux.c index e204ec76ea..81c82ee7a8 100644 --- a/dlls/qcap/tests/avimux.c +++ b/dlls/qcap/tests/avimux.c @@ -23,6 +23,8 @@ #include "vfw.h" #include "wine/test.h"
+static const GUID testguid = {0xfacade}; + static IBaseFilter *create_avi_mux(void) { IBaseFilter *filter = NULL; @@ -76,11 +78,146 @@ static void test_interfaces(void) IBaseFilter_Release(filter); }
+static void test_seeking(void) +{ + IBaseFilter *filter = create_avi_mux(); + LONGLONG time, current, stop; + IMediaSeeking *seeking; + unsigned int i; + GUID format; + HRESULT hr; + DWORD caps; + ULONG ref; + + static const struct + { + const GUID *guid; + HRESULT hr; + } + format_tests[] = + { + {&TIME_FORMAT_MEDIA_TIME, S_OK}, + {&TIME_FORMAT_BYTE, S_OK}, + + {&TIME_FORMAT_NONE, S_FALSE}, + {&TIME_FORMAT_FRAME, S_FALSE}, + {&TIME_FORMAT_SAMPLE, S_FALSE}, + {&TIME_FORMAT_FIELD, S_FALSE}, + {&testguid, S_FALSE}, + }; + + IBaseFilter_QueryInterface(filter, &IID_IMediaSeeking, (void **)&seeking); + + hr = IMediaSeeking_GetCapabilities(seeking, &caps); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(caps == (AM_SEEKING_CanGetCurrentPos | AM_SEEKING_CanGetDuration), "Got caps %#x.\n", caps); + + caps = AM_SEEKING_CanGetCurrentPos; + hr = IMediaSeeking_CheckCapabilities(seeking, &caps); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(caps == AM_SEEKING_CanGetCurrentPos, "Got caps %#x.\n", caps); + + caps = AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetCurrentPos; + hr = IMediaSeeking_CheckCapabilities(seeking, &caps); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(caps == AM_SEEKING_CanGetCurrentPos, "Got caps %#x.\n", caps); + + caps = AM_SEEKING_CanDoSegments; + hr = IMediaSeeking_CheckCapabilities(seeking, &caps); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!caps, "Got caps %#x.\n", caps); + + for (i = 0; i < ARRAY_SIZE(format_tests); ++i) + { + hr = IMediaSeeking_IsFormatSupported(seeking, format_tests[i].guid); + todo_wine ok(hr == format_tests[i].hr, "Got hr %#x for format %s.\n", hr, wine_dbgstr_guid(format_tests[i].guid)); + } + + hr = IMediaSeeking_QueryPreferredFormat(seeking, &format); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format)); + + hr = IMediaSeeking_GetTimeFormat(seeking, &format); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format)); + + hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_BYTE); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_SAMPLE); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_BYTE); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_QueryPreferredFormat(seeking, &format); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format)); + + hr = IMediaSeeking_GetTimeFormat(seeking, &format); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(IsEqualGUID(&format, &TIME_FORMAT_BYTE), "Got format %s.\n", wine_dbgstr_guid(&format)); + + hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_BYTE); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_BYTE); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 0x123456789a, NULL); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, &TIME_FORMAT_BYTE); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + current = 0x123; + stop = 0x321; + hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning, + &stop, AM_SEEKING_AbsolutePositioning); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_NoPositioning, + &stop, AM_SEEKING_NoPositioning); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_GetPositions(seeking, NULL, NULL); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + hr = IMediaSeeking_GetPositions(seeking, NULL, &stop); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + hr = IMediaSeeking_GetPositions(seeking, ¤t, NULL); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + hr = IMediaSeeking_GetDuration(seeking, &time); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!time, "Got duration %s.\n", wine_dbgstr_longlong(time)); + + hr = IMediaSeeking_GetCurrentPosition(seeking, &time); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!time, "Got duration %s.\n", wine_dbgstr_longlong(time)); + + hr = IMediaSeeking_GetStopPosition(seeking, &time); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + IMediaSeeking_Release(seeking); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got unexpected refcount %d.\n", ref); +} + START_TEST(avimux) { CoInitialize(NULL);
test_interfaces(); + test_seeking();
CoUninitialize(); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/acmwrapper.c | 4 ++-- dlls/quartz/tests/avidec.c | 4 ++-- dlls/strmbase/transform.c | 25 ++++++++++++++++++++++--- 3 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/dlls/quartz/tests/acmwrapper.c b/dlls/quartz/tests/acmwrapper.c index a543893d79..5acc91e722 100644 --- a/dlls/quartz/tests/acmwrapper.c +++ b/dlls/quartz/tests/acmwrapper.c @@ -74,7 +74,7 @@ static void test_interfaces(void) check_interface(filter, &IID_IBasicVideo, FALSE); check_interface(filter, &IID_IKsPropertySet, FALSE); todo_wine check_interface(filter, &IID_IMediaPosition, FALSE); - todo_wine check_interface(filter, &IID_IMediaSeeking, FALSE); + check_interface(filter, &IID_IMediaSeeking, FALSE); check_interface(filter, &IID_IPin, FALSE); todo_wine check_interface(filter, &IID_IQualityControl, FALSE); check_interface(filter, &IID_IQualProp, FALSE); @@ -89,7 +89,7 @@ static void test_interfaces(void) check_interface(pin, &IID_IUnknown, TRUE);
check_interface(pin, &IID_IMediaPosition, FALSE); - todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE); + check_interface(pin, &IID_IMediaSeeking, FALSE);
IPin_Release(pin);
diff --git a/dlls/quartz/tests/avidec.c b/dlls/quartz/tests/avidec.c index e897af434f..ffea059232 100644 --- a/dlls/quartz/tests/avidec.c +++ b/dlls/quartz/tests/avidec.c @@ -98,7 +98,7 @@ static void test_interfaces(void) check_interface(filter, &IID_IBasicVideo, FALSE); check_interface(filter, &IID_IKsPropertySet, FALSE); todo_wine check_interface(filter, &IID_IMediaPosition, FALSE); - todo_wine check_interface(filter, &IID_IMediaSeeking, FALSE); + check_interface(filter, &IID_IMediaSeeking, FALSE); check_interface(filter, &IID_IPersistPropertyBag, FALSE); check_interface(filter, &IID_IPin, FALSE); todo_wine check_interface(filter, &IID_IQualityControl, FALSE); @@ -114,7 +114,7 @@ static void test_interfaces(void) check_interface(pin, &IID_IUnknown, TRUE);
check_interface(pin, &IID_IMediaPosition, FALSE); - todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE); + check_interface(pin, &IID_IMediaSeeking, FALSE);
IPin_Release(pin);
diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index df16b67cb3..fa9abb0fda 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -172,8 +172,7 @@ static HRESULT WINAPI TransformFilterImpl_QueryInterface(IBaseFilter * iface, RE IUnknown_AddRef((IUnknown*)*ppv); return S_OK; } - else if (IsEqualIID(riid, &IID_IMediaSeeking) || - IsEqualIID(riid, &IID_IMediaPosition)) + else if (IsEqualIID(riid, &IID_IMediaPosition)) { return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv); } @@ -558,9 +557,29 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl = TransformFilter_InputPin_NewSegment };
+static HRESULT WINAPI transform_source_QueryInterface(IPin *iface, REFIID iid, void **out) +{ + TransformFilter *filter = impl_from_IBaseFilter(impl_BaseOutputPin_from_IPin(iface)->pin.pinInfo.pFilter); + if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IPin)) + *out = iface; + else if (IsEqualGUID(iid, &IID_IQualityControl)) + *out = &filter->qcimpl->IQualityControl_iface; + else if (IsEqualGUID(iid, &IID_IMediaSeeking)) + return IUnknown_QueryInterface(filter->seekthru_unk, iid, out); + else + { + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + static const IPinVtbl TransformFilter_OutputPin_Vtbl = { - BaseOutputPinImpl_QueryInterface, + transform_source_QueryInterface, BasePinImpl_AddRef, BaseOutputPinImpl_Release, BaseOutputPinImpl_Connect,
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/acmwrapper.c | 2 +- dlls/quartz/tests/avidec.c | 2 +- dlls/strmbase/transform.c | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/dlls/quartz/tests/acmwrapper.c b/dlls/quartz/tests/acmwrapper.c index 5acc91e722..08ee40bde6 100644 --- a/dlls/quartz/tests/acmwrapper.c +++ b/dlls/quartz/tests/acmwrapper.c @@ -73,7 +73,7 @@ static void test_interfaces(void) check_interface(filter, &IID_IBasicAudio, FALSE); check_interface(filter, &IID_IBasicVideo, FALSE); check_interface(filter, &IID_IKsPropertySet, FALSE); - todo_wine check_interface(filter, &IID_IMediaPosition, FALSE); + check_interface(filter, &IID_IMediaPosition, FALSE); check_interface(filter, &IID_IMediaSeeking, FALSE); check_interface(filter, &IID_IPin, FALSE); todo_wine check_interface(filter, &IID_IQualityControl, FALSE); diff --git a/dlls/quartz/tests/avidec.c b/dlls/quartz/tests/avidec.c index ffea059232..04de3733cd 100644 --- a/dlls/quartz/tests/avidec.c +++ b/dlls/quartz/tests/avidec.c @@ -97,7 +97,7 @@ static void test_interfaces(void) check_interface(filter, &IID_IBasicAudio, FALSE); check_interface(filter, &IID_IBasicVideo, FALSE); check_interface(filter, &IID_IKsPropertySet, FALSE); - todo_wine check_interface(filter, &IID_IMediaPosition, FALSE); + check_interface(filter, &IID_IMediaPosition, FALSE); check_interface(filter, &IID_IMediaSeeking, FALSE); check_interface(filter, &IID_IPersistPropertyBag, FALSE); check_interface(filter, &IID_IPin, FALSE); diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index fa9abb0fda..ab502c926c 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -172,10 +172,6 @@ static HRESULT WINAPI TransformFilterImpl_QueryInterface(IBaseFilter * iface, RE IUnknown_AddRef((IUnknown*)*ppv); return S_OK; } - else if (IsEqualIID(riid, &IID_IMediaPosition)) - { - return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv); - } hr = BaseFilterImpl_QueryInterface(iface, riid, ppv);
if (FAILED(hr) && !IsEqualIID(riid, &IID_IPin) && !IsEqualIID(riid, &IID_IVideoWindow) &&
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/acmwrapper.c | 2 +- dlls/quartz/tests/avidec.c | 2 +- dlls/strmbase/transform.c | 22 +--------------------- 3 files changed, 3 insertions(+), 23 deletions(-)
diff --git a/dlls/quartz/tests/acmwrapper.c b/dlls/quartz/tests/acmwrapper.c index 08ee40bde6..357a1ffa2d 100644 --- a/dlls/quartz/tests/acmwrapper.c +++ b/dlls/quartz/tests/acmwrapper.c @@ -76,7 +76,7 @@ static void test_interfaces(void) check_interface(filter, &IID_IMediaPosition, FALSE); check_interface(filter, &IID_IMediaSeeking, FALSE); check_interface(filter, &IID_IPin, FALSE); - todo_wine check_interface(filter, &IID_IQualityControl, 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); diff --git a/dlls/quartz/tests/avidec.c b/dlls/quartz/tests/avidec.c index 04de3733cd..5406c567b3 100644 --- a/dlls/quartz/tests/avidec.c +++ b/dlls/quartz/tests/avidec.c @@ -101,7 +101,7 @@ static void test_interfaces(void) check_interface(filter, &IID_IMediaSeeking, FALSE); check_interface(filter, &IID_IPersistPropertyBag, FALSE); check_interface(filter, &IID_IPin, FALSE); - todo_wine check_interface(filter, &IID_IQualityControl, 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); diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index ab502c926c..9cb18b2c3e 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -161,26 +161,6 @@ static const BaseOutputPinFuncTable tf_output_BaseOutputFuncTable = { BaseOutputPinImpl_DecideAllocator, };
-static HRESULT WINAPI TransformFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv) -{ - HRESULT hr; - TransformFilter *This = impl_from_IBaseFilter(iface); - TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv); - - if (IsEqualIID(riid, &IID_IQualityControl)) { - *ppv = (IQualityControl*)This->qcimpl; - IUnknown_AddRef((IUnknown*)*ppv); - return S_OK; - } - hr = BaseFilterImpl_QueryInterface(iface, riid, ppv); - - if (FAILED(hr) && !IsEqualIID(riid, &IID_IPin) && !IsEqualIID(riid, &IID_IVideoWindow) && - !IsEqualIID(riid, &IID_IAMFilterMiscFlags)) - FIXME("No interface for %s!\n", debugstr_guid(riid)); - - return hr; -} - static ULONG WINAPI TransformFilterImpl_Release(IBaseFilter * iface) { TransformFilter *This = impl_from_IBaseFilter(iface); @@ -293,7 +273,7 @@ static HRESULT WINAPI TransformFilterImpl_Run(IBaseFilter *iface, REFERENCE_TIME
static const IBaseFilterVtbl transform_vtbl = { - TransformFilterImpl_QueryInterface, + BaseFilterImpl_QueryInterface, BaseFilterImpl_AddRef, TransformFilterImpl_Release, BaseFilterImpl_GetClassID,
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/filtergraph.c | 9 ----- dlls/quartz/tests/filtergraph.c | 62 ++++++++++++++++----------------- 2 files changed, 31 insertions(+), 40 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 02707b4a5d..60cc368784 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -2319,15 +2319,6 @@ static HRESULT all_renderers_seek(IFilterGraphImpl *This, fnFoundSeek FoundSeek, LIST_FOR_EACH_ENTRY(filter, &This->filters, struct filter, entry) { IMediaSeeking *seek = NULL; - IAMFilterMiscFlags *flags = NULL; - ULONG filterflags; - IBaseFilter_QueryInterface(filter->filter, &IID_IAMFilterMiscFlags, (void **)&flags); - if (!flags) - continue; - filterflags = IAMFilterMiscFlags_GetMiscFlags(flags); - IAMFilterMiscFlags_Release(flags); - if (filterflags != AM_FILTER_MISC_FLAGS_IS_RENDERER) - continue;
IBaseFilter_QueryInterface(filter->filter, &IID_IMediaSeeking, (void **)&seek); if (!seek) diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index f63f7386b4..79841e6802 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -3448,23 +3448,23 @@ static void test_graph_seeking(void) filter1.seek_caps = AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetCurrentPos; filter2.seek_caps = AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetDuration; hr = IMediaSeeking_GetCapabilities(seeking, &caps); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps);
caps = AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetCurrentPos; hr = IMediaSeeking_CheckCapabilities(seeking, &caps); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); - todo_wine ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps);
caps = AM_SEEKING_CanDoSegments; hr = IMediaSeeking_CheckCapabilities(seeking, &caps); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps);
caps = AM_SEEKING_CanGetCurrentPos; hr = IMediaSeeking_CheckCapabilities(seeking, &caps); - todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr); - todo_wine ok(!caps, "Got caps %#x.\n", caps); + ok(hr == E_FAIL, "Got hr %#x.\n", hr); + ok(!caps, "Got caps %#x.\n", caps);
hr = IMediaSeeking_IsFormatSupported(seeking, &testguid); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -3526,25 +3526,25 @@ static void test_graph_seeking(void) filter1.seek_duration = 0x12345; filter2.seek_duration = 0x23456; hr = IMediaSeeking_GetDuration(seeking, &time); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(time == 0x23456, "Got time %s.\n", wine_dbgstr_longlong(time)); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(time == 0x23456, "Got time %s.\n", wine_dbgstr_longlong(time));
filter2.seek_duration = 0x12345; filter1.seek_duration = 0x23456; hr = IMediaSeeking_GetDuration(seeking, &time); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(time == 0x23456, "Got time %s.\n", wine_dbgstr_longlong(time)); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(time == 0x23456, "Got time %s.\n", wine_dbgstr_longlong(time));
filter1.seek_stop = 0x54321; filter2.seek_stop = 0x65432; hr = IMediaSeeking_GetStopPosition(seeking, &time); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); todo_wine ok(time == 0x65432, "Got time %s.\n", wine_dbgstr_longlong(time));
filter2.seek_stop = 0x54321; filter1.seek_stop = 0x65432; hr = IMediaSeeking_GetStopPosition(seeking, &time); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); todo_wine ok(time == 0x65432, "Got time %s.\n", wine_dbgstr_longlong(time));
hr = IMediaSeeking_GetCurrentPosition(seeking, &time); @@ -3553,7 +3553,7 @@ static void test_graph_seeking(void)
current = stop = 0xdeadbeef; hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current)); todo_wine ok(stop == 0x65432, "Got time %s.\n", wine_dbgstr_longlong(stop));
@@ -3561,13 +3561,13 @@ static void test_graph_seeking(void) stop = 0x321; hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning, &stop, AM_SEEKING_AbsolutePositioning); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - ok(current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(current)); - ok(stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(stop)); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(current)); + todo_wine ok(stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(stop)); todo_wine ok(filter1.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_current)); todo_wine ok(filter1.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_stop)); - todo_wine ok(filter2.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_current)); - todo_wine ok(filter2.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_stop)); + ok(filter2.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_current)); + ok(filter2.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_stop));
hr = IMediaSeeking_GetCurrentPosition(seeking, &time); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -3583,25 +3583,25 @@ static void test_graph_seeking(void) stop = 0x321; hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime, &stop, AM_SEEKING_AbsolutePositioning); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(current == 0x1234, "Got time %s.\n", wine_dbgstr_longlong(current)); - ok(stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(stop)); - todo_wine ok(filter1.seek_current == 0x1234, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_current)); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(current == 0x1234, "Got time %s.\n", wine_dbgstr_longlong(current)); + todo_wine ok(stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(stop)); + ok(filter1.seek_current == 0x1234, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_current)); todo_wine ok(filter1.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_stop)); - todo_wine ok(filter2.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_current)); - todo_wine ok(filter2.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_stop)); + ok(filter2.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_current)); + ok(filter2.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_stop));
current = 0x123; stop = 0x321; hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning, &stop, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - ok(current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(current)); - todo_wine ok(stop == 0x4321, "Got time %s.\n", wine_dbgstr_longlong(stop)); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(current)); + ok(stop == 0x4321, "Got time %s.\n", wine_dbgstr_longlong(stop)); todo_wine ok(filter1.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_current)); - todo_wine ok(filter1.seek_stop == 0x4321, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_stop)); - todo_wine ok(filter2.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_current)); - todo_wine ok(filter2.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_stop)); + ok(filter1.seek_stop == 0x4321, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_stop)); + ok(filter2.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_current)); + ok(filter2.seek_stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(filter2.seek_stop));
hr = IMediaSeeking_SetRate(seeking, 2.0); ok(hr == S_OK, "Got hr %#x.\n", hr);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=52456
Your paranoid android.
=== w2008s64 (32 bit report) ===
quartz: filtergraph.c:779: Test failed: wait failed
=== w1064v1507 (32 bit report) ===
quartz: filtergraph.c:523: Test failed: didn't get EOS filtergraph.c:528: Test failed: expected 2ccdba, got 0
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=52450
Your paranoid android.
=== w1064v1507 (32 bit report) ===
quartz: filtergraph.c:523: Test failed: didn't get EOS filtergraph.c:528: Test failed: expected 2ccdba, got 0 filtergraph.c:779: Test failed: wait failed