Commit 7a4da222 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

evr: Implement presenter state tracking methods.

parent 7e4e2b37
...@@ -31,6 +31,14 @@ ...@@ -31,6 +31,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(evr); WINE_DEFAULT_DEBUG_CHANNEL(evr);
enum presenter_state
{
PRESENTER_STATE_SHUT_DOWN = 0,
PRESENTER_STATE_STARTED,
PRESENTER_STATE_STOPPED,
PRESENTER_STATE_PAUSED,
};
struct video_presenter struct video_presenter
{ {
IMFVideoPresenter IMFVideoPresenter_iface; IMFVideoPresenter IMFVideoPresenter_iface;
...@@ -41,6 +49,9 @@ struct video_presenter ...@@ -41,6 +49,9 @@ struct video_presenter
IUnknown IUnknown_inner; IUnknown IUnknown_inner;
IUnknown *outer_unk; IUnknown *outer_unk;
LONG refcount; LONG refcount;
unsigned int state;
CRITICAL_SECTION cs;
}; };
static struct video_presenter *impl_from_IUnknown(IUnknown *iface) static struct video_presenter *impl_from_IUnknown(IUnknown *iface)
...@@ -134,6 +145,7 @@ static ULONG WINAPI video_presenter_inner_Release(IUnknown *iface) ...@@ -134,6 +145,7 @@ static ULONG WINAPI video_presenter_inner_Release(IUnknown *iface)
if (!refcount) if (!refcount)
{ {
DeleteCriticalSection(&presenter->cs);
heap_free(presenter); heap_free(presenter);
} }
...@@ -167,30 +179,54 @@ static ULONG WINAPI video_presenter_Release(IMFVideoPresenter *iface) ...@@ -167,30 +179,54 @@ static ULONG WINAPI video_presenter_Release(IMFVideoPresenter *iface)
static HRESULT WINAPI video_presenter_OnClockStart(IMFVideoPresenter *iface, MFTIME systime, LONGLONG offset) static HRESULT WINAPI video_presenter_OnClockStart(IMFVideoPresenter *iface, MFTIME systime, LONGLONG offset)
{ {
FIXME("%p, %s, %s.\n", iface, debugstr_time(systime), wine_dbgstr_longlong(offset)); struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface);
return E_NOTIMPL; TRACE("%p, %s, %s.\n", iface, debugstr_time(systime), wine_dbgstr_longlong(offset));
EnterCriticalSection(&presenter->cs);
presenter->state = PRESENTER_STATE_STARTED;
LeaveCriticalSection(&presenter->cs);
return S_OK;
} }
static HRESULT WINAPI video_presenter_OnClockStop(IMFVideoPresenter *iface, MFTIME systime) static HRESULT WINAPI video_presenter_OnClockStop(IMFVideoPresenter *iface, MFTIME systime)
{ {
FIXME("%p, %s.\n", iface, debugstr_time(systime)); struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface);
return E_NOTIMPL; TRACE("%p, %s.\n", iface, debugstr_time(systime));
EnterCriticalSection(&presenter->cs);
presenter->state = PRESENTER_STATE_STOPPED;
LeaveCriticalSection(&presenter->cs);
return S_OK;
} }
static HRESULT WINAPI video_presenter_OnClockPause(IMFVideoPresenter *iface, MFTIME systime) static HRESULT WINAPI video_presenter_OnClockPause(IMFVideoPresenter *iface, MFTIME systime)
{ {
FIXME("%p, %s.\n", iface, debugstr_time(systime)); struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface);
return E_NOTIMPL; TRACE("%p, %s.\n", iface, debugstr_time(systime));
EnterCriticalSection(&presenter->cs);
presenter->state = PRESENTER_STATE_PAUSED;
LeaveCriticalSection(&presenter->cs);
return S_OK;
} }
static HRESULT WINAPI video_presenter_OnClockRestart(IMFVideoPresenter *iface, MFTIME systime) static HRESULT WINAPI video_presenter_OnClockRestart(IMFVideoPresenter *iface, MFTIME systime)
{ {
FIXME("%p, %s.\n", iface, debugstr_time(systime)); struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface);
return E_NOTIMPL; TRACE("%p, %s.\n", iface, debugstr_time(systime));
EnterCriticalSection(&presenter->cs);
presenter->state = PRESENTER_STATE_STARTED;
LeaveCriticalSection(&presenter->cs);
return S_OK;
} }
static HRESULT WINAPI video_presenter_OnClockSetRate(IMFVideoPresenter *iface, MFTIME systime, float rate) static HRESULT WINAPI video_presenter_OnClockSetRate(IMFVideoPresenter *iface, MFTIME systime, float rate)
...@@ -295,9 +331,15 @@ static HRESULT WINAPI video_presenter_service_client_InitServicePointers(IMFTopo ...@@ -295,9 +331,15 @@ static HRESULT WINAPI video_presenter_service_client_InitServicePointers(IMFTopo
static HRESULT WINAPI video_presenter_service_client_ReleaseServicePointers(IMFTopologyServiceLookupClient *iface) static HRESULT WINAPI video_presenter_service_client_ReleaseServicePointers(IMFTopologyServiceLookupClient *iface)
{ {
FIXME("%p.\n", iface); struct video_presenter *presenter = impl_from_IMFTopologyServiceLookupClient(iface);
return E_NOTIMPL; TRACE("%p.\n", iface);
EnterCriticalSection(&presenter->cs);
presenter->state = PRESENTER_STATE_SHUT_DOWN;
LeaveCriticalSection(&presenter->cs);
return S_OK;
} }
static const IMFTopologyServiceLookupClientVtbl video_presenter_service_client_vtbl = static const IMFTopologyServiceLookupClientVtbl video_presenter_service_client_vtbl =
...@@ -496,6 +538,7 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out) ...@@ -496,6 +538,7 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out)
object->IUnknown_inner.lpVtbl = &video_presenter_inner_vtbl; object->IUnknown_inner.lpVtbl = &video_presenter_inner_vtbl;
object->outer_unk = outer ? outer : &object->IUnknown_inner; object->outer_unk = outer ? outer : &object->IUnknown_inner;
object->refcount = 1; object->refcount = 1;
InitializeCriticalSection(&object->cs);
*out = &object->IUnknown_inner; *out = &object->IUnknown_inner;
......
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