From: Brendan McGrath bmcgrath@codeweavers.com
--- dlls/mp3dmod/mp3dmod.c | 24 ++++++++++++++++++++++++ dlls/mp3dmod/tests/mp3dmod.c | 9 --------- 2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/dlls/mp3dmod/mp3dmod.c b/dlls/mp3dmod/mp3dmod.c index 842be5889da..830e94353e9 100644 --- a/dlls/mp3dmod/mp3dmod.c +++ b/dlls/mp3dmod/mp3dmod.c @@ -171,6 +171,9 @@ static HRESULT WINAPI MediaObject_GetInputType(IMediaObject *iface, DWORD index, { TRACE("iface %p, index %lu, type_index %lu, type %p.\n", iface, index, type_index, type);
+ if (index) + return DMO_E_INVALIDSTREAMINDEX; + if (type_index) return DMO_E_NO_MORE_ITEMS;
@@ -192,6 +195,9 @@ static HRESULT WINAPI MediaObject_GetOutputType(IMediaObject *iface, DWORD index
TRACE("iface %p, index %lu, type_index %lu, type %p.\n", iface, index, type_index, type);
+ if (index) + return DMO_E_INVALIDSTREAMINDEX; + if (!dmo->intype_set) return DMO_E_TYPE_NOT_SET;
@@ -225,6 +231,9 @@ static HRESULT WINAPI MediaObject_SetInputType(IMediaObject *iface, DWORD index,
TRACE("iface %p, index %lu, type %p, flags %#lx.\n", iface, index, type, flags);
+ if (index) + return DMO_E_INVALIDSTREAMINDEX; + if (flags & DMO_SET_TYPEF_CLEAR) { if (dmo->intype_set) @@ -258,6 +267,12 @@ static HRESULT WINAPI MediaObject_SetOutputType(IMediaObject *iface, DWORD index
TRACE("(%p)->(%ld, %p, %#lx)\n", iface, index, type, flags);
+ if (index) + return DMO_E_INVALIDSTREAMINDEX; + + if (!This->intype_set) + return DMO_E_TYPE_NOT_SET; + if (flags & DMO_SET_TYPEF_CLEAR) { MoFreeMediaType(&This->outtype); @@ -317,6 +332,9 @@ static HRESULT WINAPI MediaObject_GetInputSizeInfo(IMediaObject *iface,
TRACE("iface %p, index %lu, size %p, lookahead %p, alignment %p.\n", iface, index, size, lookahead, alignment);
+ if (index) + return DMO_E_INVALIDSTREAMINDEX; + if (!dmo->intype_set || !dmo->outtype_set) return DMO_E_TYPE_NOT_SET;
@@ -331,6 +349,9 @@ static HRESULT WINAPI MediaObject_GetOutputSizeInfo(IMediaObject *iface, DWORD i
TRACE("iface %p, index %lu, size %p, alignment %p.\n", iface, index, size, alignment);
+ if (index) + return DMO_E_INVALIDSTREAMINDEX; + if (!dmo->intype_set || !dmo->outtype_set) return DMO_E_TYPE_NOT_SET;
@@ -411,6 +432,9 @@ static HRESULT WINAPI MediaObject_ProcessInput(IMediaObject *iface, DWORD index, TRACE("(%p)->(%ld, %p, %#lx, %s, %s)\n", iface, index, buffer, flags, wine_dbgstr_longlong(timestamp), wine_dbgstr_longlong(timelength));
+ if (index) + return DMO_E_INVALIDSTREAMINDEX; + if (This->buffer) { ERR("Already have a buffer.\n"); diff --git a/dlls/mp3dmod/tests/mp3dmod.c b/dlls/mp3dmod/tests/mp3dmod.c index dd1d6171f55..ee59631f044 100644 --- a/dlls/mp3dmod/tests/mp3dmod.c +++ b/dlls/mp3dmod/tests/mp3dmod.c @@ -172,10 +172,8 @@ static void test_convert(void) memcpy(inbuf.data + 96 * i, mp3hdr, 4); inbuf.len = 96 * 5; hr = IMediaObject_ProcessInput(dmo, 1, &inbuf.IMediaBuffer_iface, 0, 0, 0); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "got %#lx\n", hr); hr = IMediaObject_ProcessInput(dmo, 0, &inbuf.IMediaBuffer_iface, 0, 0, 0); - todo_wine ok(hr == S_OK, "got %#lx\n", hr); ok(inbuf.refcount == 2, "Got refcount %ld.\n", inbuf.refcount);
@@ -430,10 +428,8 @@ static void test_stream_info(void) ok(!flags, "Got flags %#lx.\n", flags);
hr = IMediaObject_GetInputSizeInfo(dmo, 1, &size, &lookahead, &alignment); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "Got hr %#lx.\n", hr); hr = IMediaObject_GetOutputSizeInfo(dmo, 1, &size, &alignment); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "Got hr %#lx.\n", hr);
hr = IMediaObject_GetInputSizeInfo(dmo, 0, &size, &lookahead, &alignment); @@ -536,7 +532,6 @@ static void test_media_types(void)
memset(&mt, 0xcc, sizeof(DMO_MEDIA_TYPE)); hr = IMediaObject_GetInputType(dmo, 1, 0, &mt); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "Got hr %#lx.\n", hr); hr = IMediaObject_GetInputType(dmo, 0, 0, &mt); ok(hr == S_OK, "Got hr %#lx.\n", hr); @@ -556,17 +551,14 @@ static void test_media_types(void)
memset(&mt, 0xcc, sizeof(DMO_MEDIA_TYPE)); hr = IMediaObject_GetOutputType(dmo, 1, 0, &mt); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "Got hr %#lx.\n", hr); hr = IMediaObject_GetOutputType(dmo, 0, 0, &mt); ok(hr == DMO_E_TYPE_NOT_SET, "Got hr %#lx.\n", hr);
hr = IMediaObject_SetOutputType(dmo, 0, &output_mt, DMO_SET_TYPEF_TEST_ONLY); - todo_wine ok(hr == DMO_E_TYPE_NOT_SET, "Got hr %#lx.\n", hr);
hr = IMediaObject_SetInputType(dmo, 1, &input_mt, DMO_SET_TYPEF_TEST_ONLY); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "Got hr %#lx.\n", hr); hr = IMediaObject_SetInputType(dmo, 0, &input_mt, DMO_SET_TYPEF_TEST_ONLY); ok(hr == S_OK, "Got hr %#lx.\n", hr); @@ -659,7 +651,6 @@ static void test_media_types(void) ok(hr == DMO_E_NO_MORE_ITEMS, "Got hr %#lx.\n", hr);
hr = IMediaObject_SetOutputType(dmo, 1, &output_mt, DMO_SET_TYPEF_TEST_ONLY); - todo_wine ok(hr == DMO_E_INVALIDSTREAMINDEX, "Got hr %#lx.\n", hr);
hr = IMediaObject_SetOutputType(dmo, 0, &output_mt, DMO_SET_TYPEF_TEST_ONLY);