mfplay: Implement MFP_EVENT_TYPE_PLAYBACK_ENDED event.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-04-20 12:06:00 +03:00 committed by Alexandre Julliard
parent 11d3f6976d
commit 2cd0d1ec7c
1 changed files with 26 additions and 0 deletions

View File

@ -1605,6 +1605,21 @@ static void media_player_create_forward_event(struct media_player *player, HRESU
LeaveCriticalSection(&player->cs);
}
static void media_player_create_playback_ended_event(struct media_player *player, HRESULT event_status,
struct media_event **event)
{
EnterCriticalSection(&player->cs);
if (SUCCEEDED(media_event_create(player, MFP_EVENT_TYPE_PLAYBACK_ENDED, event_status, player->item, event)))
{
if (player->item)
IMFPMediaItem_Release(player->item);
player->item = NULL;
}
LeaveCriticalSection(&player->cs);
}
static HRESULT WINAPI media_player_session_events_callback_Invoke(IMFAsyncCallback *iface,
IMFAsyncResult *result)
{
@ -1616,6 +1631,7 @@ static HRESULT WINAPI media_player_session_events_callback_Invoke(IMFAsyncCallba
HRESULT hr, event_status;
IMFPMediaItem *item = NULL;
IMFTopology *topology;
unsigned int status;
PROPVARIANT value;
if (FAILED(hr = IMFMediaSession_EndGetEvent(player->session, result, &session_event)))
@ -1661,6 +1677,16 @@ static HRESULT WINAPI media_player_session_events_callback_Invoke(IMFAsyncCallba
break;
case MESessionTopologyStatus:
if (SUCCEEDED(IMFMediaEvent_GetUINT32(session_event, &MF_EVENT_TOPOLOGY_STATUS, &status)) &&
status == MF_TOPOSTATUS_ENDED)
{
media_player_create_playback_ended_event(player, event_status, &event);
}
break;
case MEBufferingStarted:
case MEBufferingStopped:
case MEExtendedType: