mfplay: Implement GetPosition().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9d6fc061c9
commit
dd1a603a1f
|
@ -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)
|
||||
{
|
||||
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)
|
||||
|
@ -916,9 +947,12 @@ static HRESULT WINAPI media_player_GetDuration(IMFPMediaPlayer *iface, REFGUID p
|
|||
|
||||
TRACE("%p, %s, %p.\n", iface, debugstr_guid(postype), duration);
|
||||
|
||||
if (!postype || !duration)
|
||||
if (!duration)
|
||||
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;
|
||||
|
|
|
@ -227,6 +227,15 @@ todo_wine
|
|||
hr = IMFPMediaPlayer_GetDuration(player, &MFP_POSITIONTYPE_100NS, &propvar);
|
||||
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);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
|
@ -371,9 +380,24 @@ static void test_duration(void)
|
|||
hr = IMFPMediaPlayer_GetDuration(player, &MFP_POSITIONTYPE_100NS, NULL);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue