Commit 2086698e authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfmediaengine: Implement GetPresentationAttribute().

parent 40c99239
......@@ -143,6 +143,7 @@ struct media_engine
struct
{
IMFMediaSource *source;
IMFPresentationDescriptor *pd;
} presentation;
struct
{
......@@ -1079,9 +1080,11 @@ static void media_engine_clear_presentation(struct media_engine *engine)
{
if (engine->presentation.source)
{
IMFMediaSource_Shutdown(engine->presentation.source);
IMFMediaSource_Release(engine->presentation.source);
IMFMediaSource_Shutdown(engine->presentation.source);
IMFMediaSource_Release(engine->presentation.source);
}
if (engine->presentation.pd)
IMFPresentationDescriptor_Release(engine->presentation.pd);
memset(&engine->presentation, 0, sizeof(engine->presentation));
}
......@@ -1151,6 +1154,8 @@ static HRESULT media_engine_create_topology(struct media_engine *engine, IMFMedi
engine->presentation.source = source;
IMFMediaSource_AddRef(engine->presentation.source);
engine->presentation.pd = pd;
IMFPresentationDescriptor_AddRef(engine->presentation.pd);
media_engine_set_flag(engine, FLAGS_ENGINE_HAS_VIDEO, !!sd_video);
media_engine_set_flag(engine, FLAGS_ENGINE_HAS_AUDIO, !!sd_audio);
......@@ -2474,9 +2479,19 @@ static HRESULT WINAPI media_engine_GetResourceCharacteristics(IMFMediaEngineEx *
static HRESULT WINAPI media_engine_GetPresentationAttribute(IMFMediaEngineEx *iface, REFGUID attribute,
PROPVARIANT *value)
{
FIXME("%p, %s, %p stub.\n", iface, debugstr_guid(attribute), value);
struct media_engine *engine = impl_from_IMFMediaEngineEx(iface);
HRESULT hr = E_FAIL;
return E_NOTIMPL;
TRACE("%p, %s, %p.\n", iface, debugstr_guid(attribute), value);
EnterCriticalSection(&engine->cs);
if (engine->flags & FLAGS_ENGINE_SHUT_DOWN)
hr = MF_E_SHUTDOWN;
else if (engine->presentation.pd)
hr = IMFPresentationDescriptor_GetItem(engine->presentation.pd, attribute, value);
LeaveCriticalSection(&engine->cs);
return hr;
}
static HRESULT WINAPI media_engine_GetNumberOfStreams(IMFMediaEngineEx *iface, DWORD *stream_count)
......
......@@ -321,6 +321,7 @@ static void test_Shutdown(void)
IMFMediaEngineEx *media_engine_ex;
IMFMediaTimeRange *time_range;
IMFMediaEngine *media_engine;
PROPVARIANT propvar;
DWORD flags, cx, cy;
unsigned int state;
UINT32 value;
......@@ -493,6 +494,9 @@ static void test_Shutdown(void)
hr = IMFMediaEngineEx_SetRealTimeMode(media_engine_ex, TRUE);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr);
hr = IMFMediaEngineEx_GetPresentationAttribute(media_engine_ex, &MF_PD_DURATION, &propvar);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr);
IMFMediaEngineEx_Release(media_engine_ex);
}
......@@ -905,6 +909,7 @@ static void test_SetSourceFromByteStream(void)
{
struct media_engine_notify *notify;
IMFMediaEngineEx *media_engine;
PROPVARIANT propvar;
DWORD flags;
HRESULT hr;
......@@ -927,6 +932,9 @@ static void test_SetSourceFromByteStream(void)
hr = IMFMediaEngineEx_GetResourceCharacteristics(media_engine, &flags);
ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
hr = IMFMediaEngineEx_GetPresentationAttribute(media_engine, &MF_PD_DURATION, &propvar);
ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
IMFMediaEngineEx_Release(media_engine);
IMFMediaEngineNotify_Release(&notify->IMFMediaEngineNotify_iface);
}
......
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