Commit f56c12c8 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfmediaengine: Update network state when loading the media source.

parent 04547b42
......@@ -126,6 +126,7 @@ struct media_engine
double default_playback_rate;
double volume;
double duration;
MF_MEDIA_ENGINE_NETWORK network_state;
MF_MEDIA_ENGINE_ERR error_code;
HRESULT extended_code;
MF_MEDIA_ENGINE_READY ready_state;
......@@ -1190,6 +1191,7 @@ static HRESULT WINAPI media_engine_load_handler_Invoke(IMFAsyncCallback *iface,
EnterCriticalSection(&engine->cs);
engine->network_state = MF_MEDIA_ENGINE_NETWORK_LOADING;
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_LOADSTART, 0, 0);
if (FAILED(hr = IMFSourceResolver_EndCreateObjectFromURL(engine->resolver, result, &obj_type, &object)))
......@@ -1205,8 +1207,13 @@ static HRESULT WINAPI media_engine_load_handler_Invoke(IMFAsyncCallback *iface,
IUnknown_Release(object);
}
if (FAILED(hr))
if (SUCCEEDED(hr))
{
engine->network_state = MF_MEDIA_ENGINE_NETWORK_IDLE;
}
else
{
engine->network_state = MF_MEDIA_ENGINE_NETWORK_NO_SOURCE;
engine->error_code = MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED;
engine->extended_code = hr;
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_ERROR, engine->error_code,
......@@ -1365,6 +1372,8 @@ static HRESULT WINAPI media_engine_SetSource(IMFMediaEngine *iface, BSTR url)
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_PURGEQUEUEDEVENTS, 0, 0);
engine->network_state = MF_MEDIA_ENGINE_NETWORK_NO_SOURCE;
if (url)
{
IPropertyStore *props = NULL;
......@@ -1410,9 +1419,11 @@ static HRESULT WINAPI media_engine_GetCurrentSource(IMFMediaEngine *iface, BSTR
static USHORT WINAPI media_engine_GetNetworkState(IMFMediaEngine *iface)
{
FIXME("(%p): stub.\n", iface);
struct media_engine *engine = impl_from_IMFMediaEngine(iface);
TRACE("%p.\n", iface);
return 0;
return engine->network_state;
}
static MF_MEDIA_ENGINE_PRELOAD WINAPI media_engine_GetPreload(IMFMediaEngine *iface)
......
......@@ -50,6 +50,14 @@ cpp_quote("EXTERN_GUID(MF_MEDIA_ENGINE_TELEMETRY_APPLICATION_ID, 0x1e7
cpp_quote("EXTERN_GUID(MF_MEDIA_ENGINE_TRACK_ID, 0x65bea312, 0x4043, 0x4815, 0x8e, 0xab, 0x44, 0xdc, 0xe2, 0xef, 0x8f, 0x2a);")
cpp_quote("EXTERN_GUID(MF_MEDIA_ENGINE_VIDEO_OUTPUT_FORMAT, 0x5066893c, 0x8cf9, 0x42bc, 0x8b, 0x8a, 0x47, 0x22, 0x12, 0xe5, 0x27, 0x26);")
typedef enum MF_MEDIA_ENGINE_NETWORK
{
MF_MEDIA_ENGINE_NETWORK_EMPTY,
MF_MEDIA_ENGINE_NETWORK_IDLE,
MF_MEDIA_ENGINE_NETWORK_LOADING,
MF_MEDIA_ENGINE_NETWORK_NO_SOURCE
} MF_MEDIA_ENGINE_NETWORK;
typedef enum MF_MEDIA_ENGINE_ERR
{
MF_MEDIA_ENGINE_ERR_NOERROR,
......
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