Commit 9d6fc061 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfplay: Partially implement GetDuration().

parent 4f923996
......@@ -909,11 +909,27 @@ static HRESULT WINAPI media_player_GetPosition(IMFPMediaPlayer *iface, REFGUID p
return E_NOTIMPL;
}
static HRESULT WINAPI media_player_GetDuration(IMFPMediaPlayer *iface, REFGUID postype, PROPVARIANT *position)
static HRESULT WINAPI media_player_GetDuration(IMFPMediaPlayer *iface, REFGUID postype, PROPVARIANT *duration)
{
FIXME("%p, %s, %p.\n", iface, debugstr_guid(postype), position);
struct media_player *player = impl_from_IMFPMediaPlayer(iface);
HRESULT hr;
return E_NOTIMPL;
TRACE("%p, %s, %p.\n", iface, debugstr_guid(postype), duration);
if (!postype || !duration)
return E_POINTER;
EnterCriticalSection(&player->cs);
if (player->state == MFP_MEDIAPLAYER_STATE_SHUTDOWN)
hr = MF_E_SHUTDOWN;
else if (!player->item)
hr = MF_E_INVALIDREQUEST;
else
/* FIXME: use start/stop markers for resulting duration */
hr = IMFPMediaItem_GetDuration(player->item, postype, duration);
LeaveCriticalSection(&player->cs);
return hr;
}
static HRESULT WINAPI media_player_SetRate(IMFPMediaPlayer *iface, float rate)
......
......@@ -148,6 +148,7 @@ static void test_shutdown(void)
IMFPMediaPlayer *player;
float slowest, fastest;
IMFPMediaItem *item;
PROPVARIANT propvar;
COLORREF color;
HWND window;
DWORD mode;
......@@ -217,6 +218,15 @@ todo_wine
hr = IMFPMediaPlayer_GetVideoWindow(player, &window);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetDuration(player, NULL, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetDuration(player, &MFP_POSITIONTYPE_100NS, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetDuration(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);
......@@ -345,10 +355,33 @@ todo_wine
DestroyWindow(window);
}
static void test_duration(void)
{
IMFPMediaPlayer *player;
PROPVARIANT propvar;
HRESULT hr;
hr = MFPCreateMediaPlayer(NULL, FALSE, 0, NULL, NULL, &player);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
/* No media item. */
hr = IMFPMediaPlayer_GetDuration(player, NULL, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetDuration(player, &MFP_POSITIONTYPE_100NS, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetDuration(player, &MFP_POSITIONTYPE_100NS, &propvar);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
IMFPMediaPlayer_Release(player);
}
START_TEST(mfplay)
{
test_create_player();
test_shutdown();
test_media_item();
test_video_control();
test_duration();
}
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