mfmediaengine: Update ready state property during resolution.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-06-04 13:41:48 +03:00 committed by Alexandre Julliard
parent 496a7035ac
commit b643cefdc0
2 changed files with 26 additions and 2 deletions

View File

@ -86,6 +86,7 @@ struct media_engine
double duration;
MF_MEDIA_ENGINE_ERR error_code;
HRESULT extended_code;
MF_MEDIA_ENGINE_READY ready_state;
IMFMediaSession *session;
IMFSourceResolver *resolver;
BSTR current_source;
@ -400,8 +401,13 @@ static HRESULT media_engine_create_topology(struct media_engine *engine, IMFMedi
else
engine->duration = INFINITY;
engine->ready_state = MF_MEDIA_ENGINE_READY_HAVE_METADATA;
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_DURATIONCHANGE, 0, 0);
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_LOADEDMETADATA, 0, 0);
engine->ready_state = MF_MEDIA_ENGINE_READY_HAVE_ENOUGH_DATA;
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_LOADEDDATA, 0, 0);
/* TODO: set up topology nodes */
@ -584,6 +590,8 @@ static HRESULT WINAPI media_engine_SetSource(IMFMediaEngine *iface, BSTR url)
if (url)
engine->current_source = SysAllocString(url);
engine->ready_state = MF_MEDIA_ENGINE_READY_HAVE_NOTHING;
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_PURGEQUEUEDEVENTS, 0, 0);
if (url)
@ -671,9 +679,16 @@ static HRESULT WINAPI media_engine_CanPlayType(IMFMediaEngine *iface, BSTR type,
static USHORT WINAPI media_engine_GetReadyState(IMFMediaEngine *iface)
{
FIXME("(%p): stub.\n", iface);
struct media_engine *engine = impl_from_IMFMediaEngine(iface);
unsigned short state;
return 0;
TRACE("%p.\n", iface);
EnterCriticalSection(&engine->cs);
state = engine->ready_state;
LeaveCriticalSection(&engine->cs);
return state;
}
static BOOL WINAPI media_engine_IsSeeking(IMFMediaEngine *iface)

View File

@ -137,6 +137,15 @@ typedef enum MF_MEDIA_ENGINE_EVENT
MF_MEDIA_ENGINE_EVENT_AUDIOENDPOINTCHANGE = 1016,
} MF_MEDIA_ENGINE_EVENT;
typedef enum MF_MEDIA_ENGINE_READY
{
MF_MEDIA_ENGINE_READY_HAVE_NOTHING,
MF_MEDIA_ENGINE_READY_HAVE_METADATA,
MF_MEDIA_ENGINE_READY_HAVE_CURRENT_DATA,
MF_MEDIA_ENGINE_READY_HAVE_FUTURE_DATA,
MF_MEDIA_ENGINE_READY_HAVE_ENOUGH_DATA,
} MF_MEDIA_ENGINE_READY;
[
object,
uuid(fc0e10d2-ab2a-4501-a951-06bb1075184c),