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

mfplay: Implement GetPosition().

parent 9d6fc061
...@@ -904,9 +904,40 @@ static HRESULT WINAPI media_player_SetPosition(IMFPMediaPlayer *iface, REFGUID p ...@@ -904,9 +904,40 @@ static HRESULT WINAPI media_player_SetPosition(IMFPMediaPlayer *iface, REFGUID p
static HRESULT WINAPI media_player_GetPosition(IMFPMediaPlayer *iface, REFGUID postype, PROPVARIANT *position) static HRESULT WINAPI media_player_GetPosition(IMFPMediaPlayer *iface, REFGUID postype, PROPVARIANT *position)
{ {
FIXME("%p, %s, %p.\n", iface, debugstr_guid(postype), position); struct media_player *player = impl_from_IMFPMediaPlayer(iface);
IMFPresentationClock *presentation_clock;
IMFClock *clock;
HRESULT hr;
return E_NOTIMPL; TRACE("%p, %s, %p.\n", iface, debugstr_guid(postype), position);
if (!position)
return E_POINTER;
if (!IsEqualGUID(postype, &MFP_POSITIONTYPE_100NS))
return E_INVALIDARG;
EnterCriticalSection(&player->cs);
if (player->state == MFP_MEDIAPLAYER_STATE_SHUTDOWN)
hr = MF_E_SHUTDOWN;
else if (!player->item)
hr = MF_E_INVALIDREQUEST;
else
{
if (SUCCEEDED(hr = IMFMediaSession_GetClock(player->session, &clock)))
{
if (SUCCEEDED(hr = IMFClock_QueryInterface(clock, &IID_IMFPresentationClock, (void **)&presentation_clock)))
{
position->vt = VT_UI8;
hr = IMFPresentationClock_GetTime(presentation_clock, (MFTIME *)&position->uhVal.QuadPart);
IMFPresentationClock_Release(presentation_clock);
}
IMFClock_Release(clock);
}
}
LeaveCriticalSection(&player->cs);
return hr;
} }
static HRESULT WINAPI media_player_GetDuration(IMFPMediaPlayer *iface, REFGUID postype, PROPVARIANT *duration) static HRESULT WINAPI media_player_GetDuration(IMFPMediaPlayer *iface, REFGUID postype, PROPVARIANT *duration)
...@@ -916,9 +947,12 @@ static HRESULT WINAPI media_player_GetDuration(IMFPMediaPlayer *iface, REFGUID p ...@@ -916,9 +947,12 @@ static HRESULT WINAPI media_player_GetDuration(IMFPMediaPlayer *iface, REFGUID p
TRACE("%p, %s, %p.\n", iface, debugstr_guid(postype), duration); TRACE("%p, %s, %p.\n", iface, debugstr_guid(postype), duration);
if (!postype || !duration) if (!duration)
return E_POINTER; return E_POINTER;
if (!IsEqualGUID(postype, &MFP_POSITIONTYPE_100NS))
return E_INVALIDARG;
EnterCriticalSection(&player->cs); EnterCriticalSection(&player->cs);
if (player->state == MFP_MEDIAPLAYER_STATE_SHUTDOWN) if (player->state == MFP_MEDIAPLAYER_STATE_SHUTDOWN)
hr = MF_E_SHUTDOWN; hr = MF_E_SHUTDOWN;
......
...@@ -227,6 +227,15 @@ todo_wine ...@@ -227,6 +227,15 @@ todo_wine
hr = IMFPMediaPlayer_GetDuration(player, &MFP_POSITIONTYPE_100NS, &propvar); hr = IMFPMediaPlayer_GetDuration(player, &MFP_POSITIONTYPE_100NS, &propvar);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetPosition(player, NULL, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetPosition(player, &MFP_POSITIONTYPE_100NS, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetPosition(player, &MFP_POSITIONTYPE_100NS, &propvar);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_Shutdown(player); hr = IMFPMediaPlayer_Shutdown(player);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
...@@ -371,9 +380,24 @@ static void test_duration(void) ...@@ -371,9 +380,24 @@ static void test_duration(void)
hr = IMFPMediaPlayer_GetDuration(player, &MFP_POSITIONTYPE_100NS, NULL); hr = IMFPMediaPlayer_GetDuration(player, &MFP_POSITIONTYPE_100NS, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetDuration(player, &IID_IUnknown, &propvar);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetDuration(player, &MFP_POSITIONTYPE_100NS, &propvar); hr = IMFPMediaPlayer_GetDuration(player, &MFP_POSITIONTYPE_100NS, &propvar);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr); ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetPosition(player, NULL, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetPosition(player, &MFP_POSITIONTYPE_100NS, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetPosition(player, &IID_IUnknown, &propvar);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetPosition(player, &MFP_POSITIONTYPE_100NS, &propvar);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
IMFPMediaPlayer_Release(player); IMFPMediaPlayer_Release(player);
} }
......
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