mfmediaengine: Implement error property.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9aec1ef3c1
commit
4d56ed9d02
|
@ -84,6 +84,7 @@ struct media_engine
|
||||||
double default_playback_rate;
|
double default_playback_rate;
|
||||||
double volume;
|
double volume;
|
||||||
double duration;
|
double duration;
|
||||||
|
MF_MEDIA_ENGINE_ERR error_code;
|
||||||
IMFMediaSession *session;
|
IMFMediaSession *session;
|
||||||
IMFSourceResolver *resolver;
|
IMFSourceResolver *resolver;
|
||||||
CRITICAL_SECTION cs;
|
CRITICAL_SECTION cs;
|
||||||
|
@ -512,16 +513,44 @@ static ULONG WINAPI media_engine_Release(IMFMediaEngine *iface)
|
||||||
|
|
||||||
static HRESULT WINAPI media_engine_GetError(IMFMediaEngine *iface, IMFMediaError **error)
|
static HRESULT WINAPI media_engine_GetError(IMFMediaEngine *iface, IMFMediaError **error)
|
||||||
{
|
{
|
||||||
FIXME("(%p, %p): stub.\n", iface, error);
|
struct media_engine *engine = impl_from_IMFMediaEngine(iface);
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
return E_NOTIMPL;
|
TRACE("%p, %p.\n", iface, error);
|
||||||
|
|
||||||
|
*error = NULL;
|
||||||
|
|
||||||
|
EnterCriticalSection(&engine->cs);
|
||||||
|
if (engine->flags & FLAGS_ENGINE_SHUT_DOWN)
|
||||||
|
hr = MF_E_SHUTDOWN;
|
||||||
|
else if (engine->error_code)
|
||||||
|
{
|
||||||
|
if (SUCCEEDED(hr = create_media_error(error)))
|
||||||
|
IMFMediaError_SetErrorCode(*error, engine->error_code);
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&engine->cs);
|
||||||
|
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI media_engine_SetErrorCode(IMFMediaEngine *iface, MF_MEDIA_ENGINE_ERR error)
|
static HRESULT WINAPI media_engine_SetErrorCode(IMFMediaEngine *iface, MF_MEDIA_ENGINE_ERR code)
|
||||||
{
|
{
|
||||||
FIXME("(%p, %d): stub.\n", iface, error);
|
struct media_engine *engine = impl_from_IMFMediaEngine(iface);
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
return E_NOTIMPL;
|
TRACE("%p, %u.\n", iface, code);
|
||||||
|
|
||||||
|
if ((unsigned int)code > MF_MEDIA_ENGINE_ERR_ENCRYPTED)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
EnterCriticalSection(&engine->cs);
|
||||||
|
if (engine->flags & FLAGS_ENGINE_SHUT_DOWN)
|
||||||
|
hr = MF_E_SHUTDOWN;
|
||||||
|
else
|
||||||
|
engine->error_code = code;
|
||||||
|
LeaveCriticalSection(&engine->cs);
|
||||||
|
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI media_engine_SetSourceElements(IMFMediaEngine *iface, IMFMediaEngineSrcElements *elements)
|
static HRESULT WINAPI media_engine_SetSourceElements(IMFMediaEngine *iface, IMFMediaEngineSrcElements *elements)
|
||||||
|
|
|
@ -503,45 +503,47 @@ static void test_error(void)
|
||||||
|
|
||||||
eo = (void *)0xdeadbeef;
|
eo = (void *)0xdeadbeef;
|
||||||
hr = IMFMediaEngine_GetError(media_engine, &eo);
|
hr = IMFMediaEngine_GetError(media_engine, &eo);
|
||||||
todo_wine {
|
|
||||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
ok(!eo, "Unexpected instance.\n");
|
ok(!eo, "Unexpected instance.\n");
|
||||||
}
|
|
||||||
hr = IMFMediaEngine_SetErrorCode(media_engine, MF_MEDIA_ENGINE_ERR_ENCRYPTED + 1);
|
hr = IMFMediaEngine_SetErrorCode(media_engine, MF_MEDIA_ENGINE_ERR_ENCRYPTED + 1);
|
||||||
todo_wine
|
|
||||||
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IMFMediaEngine_SetErrorCode(media_engine, MF_MEDIA_ENGINE_ERR_ABORTED);
|
hr = IMFMediaEngine_SetErrorCode(media_engine, MF_MEDIA_ENGINE_ERR_ABORTED);
|
||||||
todo_wine
|
|
||||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
eo = NULL;
|
eo = NULL;
|
||||||
hr = IMFMediaEngine_GetError(media_engine, &eo);
|
hr = IMFMediaEngine_GetError(media_engine, &eo);
|
||||||
todo_wine {
|
|
||||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
ok(!!eo, "Unexpected instance.\n");
|
ok(!!eo, "Unexpected instance.\n");
|
||||||
}
|
|
||||||
eo2 = NULL;
|
eo2 = NULL;
|
||||||
hr = IMFMediaEngine_GetError(media_engine, &eo2);
|
hr = IMFMediaEngine_GetError(media_engine, &eo2);
|
||||||
todo_wine {
|
|
||||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
ok(eo2 != eo, "Unexpected instance.\n");
|
ok(eo2 != eo, "Unexpected instance.\n");
|
||||||
}
|
|
||||||
if (eo2)
|
IMFMediaError_Release(eo2);
|
||||||
IMFMediaError_Release(eo2);
|
IMFMediaError_Release(eo);
|
||||||
if (eo)
|
|
||||||
IMFMediaError_Release(eo);
|
|
||||||
|
|
||||||
hr = IMFMediaEngine_SetErrorCode(media_engine, MF_MEDIA_ENGINE_ERR_NOERROR);
|
hr = IMFMediaEngine_SetErrorCode(media_engine, MF_MEDIA_ENGINE_ERR_NOERROR);
|
||||||
todo_wine
|
|
||||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
eo = (void *)0xdeadbeef;
|
eo = (void *)0xdeadbeef;
|
||||||
hr = IMFMediaEngine_GetError(media_engine, &eo);
|
hr = IMFMediaEngine_GetError(media_engine, &eo);
|
||||||
todo_wine {
|
|
||||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
ok(!eo, "Unexpected instance.\n");
|
ok(!eo, "Unexpected instance.\n");
|
||||||
}
|
|
||||||
|
hr = IMFMediaEngine_Shutdown(media_engine);
|
||||||
|
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
eo = (void *)0xdeadbeef;
|
||||||
|
hr = IMFMediaEngine_GetError(media_engine, &eo);
|
||||||
|
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
|
||||||
|
ok(!eo, "Unexpected instance.\n");
|
||||||
|
|
||||||
|
hr = IMFMediaEngine_SetErrorCode(media_engine, MF_MEDIA_ENGINE_ERR_NOERROR);
|
||||||
|
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
IMFMediaEngine_Release(media_engine);
|
IMFMediaEngine_Release(media_engine);
|
||||||
|
|
||||||
/* Error object. */
|
/* Error object. */
|
||||||
|
|
Loading…
Reference in New Issue