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

evr/presenter: Add presented frames counter.

parent 460ae3d8
......@@ -116,6 +116,12 @@ struct video_presenter
unsigned int ar_mode;
unsigned int state;
unsigned int flags;
struct
{
int presented;
} frame_stats;
CRITICAL_SECTION cs;
};
......@@ -532,6 +538,7 @@ static void video_presenter_sample_present(struct video_presenter *presenter, IM
}
IDirect3DSwapChain9_Present(presenter->swapchain, &src, &dst, NULL, NULL, 0);
presenter->frame_stats.presented++;
IDirect3DDevice9_Release(device);
IDirect3DSurface9_Release(backbuffer);
......@@ -934,6 +941,7 @@ static HRESULT WINAPI video_presenter_OnClockStop(IMFVideoPresenter *iface, MFTI
EnterCriticalSection(&presenter->cs);
presenter->state = PRESENTER_STATE_STOPPED;
presenter->frame_stats.presented = 0;
LeaveCriticalSection(&presenter->cs);
return S_OK;
......@@ -1766,9 +1774,26 @@ static HRESULT WINAPI video_presenter_qualprop_get_FramesDroppedInRenderer(IQual
static HRESULT WINAPI video_presenter_qualprop_get_FramesDrawn(IQualProp *iface, int *frames)
{
FIXME("%p, %p stub.\n", iface, frames);
struct video_presenter *presenter = impl_from_IQualProp(iface);
HRESULT hr = S_OK;
return E_NOTIMPL;
TRACE("%p, %p.\n", iface, frames);
EnterCriticalSection(&presenter->cs);
switch (presenter->state)
{
case PRESENTER_STATE_STARTED:
case PRESENTER_STATE_PAUSED:
if (frames) *frames = presenter->frame_stats.presented;
else hr = E_POINTER;
default:
hr = E_NOTIMPL;
}
LeaveCriticalSection(&presenter->cs);
return hr;
}
static HRESULT WINAPI video_presenter_qualprop_get_AvgFrameRate(IQualProp *iface, int *avg_frame_rate)
......
......@@ -2240,6 +2240,8 @@ static void test_presenter_quality_control(void)
MF_QUALITY_DROP_MODE mode;
IMFQualityAdvise *advise;
MF_QUALITY_LEVEL level;
IQualProp *qual_prop;
int frame_count;
HRESULT hr;
hr = MFCreateVideoPresenter(NULL, &IID_IDirect3DDevice9, &IID_IMFVideoPresenter, (void **)&presenter);
......@@ -2293,6 +2295,17 @@ todo_wine {
IMFQualityAdvise_Release(advise);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IQualProp, (void **)&qual_prop);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IQualProp_get_FramesDrawn(qual_prop, NULL);
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
hr = IQualProp_get_FramesDrawn(qual_prop, &frame_count);
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
IQualProp_Release(qual_prop);
IMFVideoPresenter_Release(presenter);
}
......@@ -2432,6 +2445,8 @@ static void test_presenter_shutdown(void)
IMFVideoPresenter *presenter;
IMFVideoDeviceID *deviceid;
HWND window, window2;
IQualProp *qual_prop;
int frame_count;
HRESULT hr;
DWORD mode;
RECT rect;
......@@ -2453,6 +2468,9 @@ static void test_presenter_shutdown(void)
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IQualProp, (void **)&qual_prop);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFTopologyServiceLookupClient_ReleaseServicePointers(lookup_client);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
......@@ -2505,9 +2523,16 @@ static void test_presenter_shutdown(void)
hr = IMFVideoDisplayControl_RepaintVideo(display_control);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
hr = IQualProp_get_FramesDrawn(qual_prop, NULL);
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
hr = IQualProp_get_FramesDrawn(qual_prop, &frame_count);
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
hr = IMFTopologyServiceLookupClient_ReleaseServicePointers(lookup_client);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
IQualProp_Release(qual_prop);
IMFVideoDeviceID_Release(deviceid);
IMFVideoDisplayControl_Release(display_control);
IMFTopologyServiceLookupClient_Release(lookup_client);
......
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