Commit 37ffe444 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfmediaengine: Issue MF_MEDIA_ENGINE_EVENT_FIRSTFRAMEREADY on first video sample.

parent fa253602
...@@ -68,6 +68,7 @@ enum media_engine_flags ...@@ -68,6 +68,7 @@ enum media_engine_flags
FLAGS_ENGINE_MUTED = 0x400, FLAGS_ENGINE_MUTED = 0x400,
FLAGS_ENGINE_HAS_AUDIO = 0x800, FLAGS_ENGINE_HAS_AUDIO = 0x800,
FLAGS_ENGINE_HAS_VIDEO = 0x1000, FLAGS_ENGINE_HAS_VIDEO = 0x1000,
FLAGS_ENGINE_FIRST_FRAME = 0x2000,
}; };
struct media_engine struct media_engine
...@@ -316,6 +317,10 @@ static HRESULT WINAPI media_engine_session_events_Invoke(IMFAsyncCallback *iface ...@@ -316,6 +317,10 @@ static HRESULT WINAPI media_engine_session_events_Invoke(IMFAsyncCallback *iface
break; break;
case MESessionEnded: case MESessionEnded:
EnterCriticalSection(&engine->cs);
media_engine_set_flag(engine, FLAGS_ENGINE_FIRST_FRAME, FALSE);
LeaveCriticalSection(&engine->cs);
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_ENDED, 0, 0); IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_ENDED, 0, 0);
break; break;
} }
...@@ -1351,6 +1356,12 @@ static HRESULT WINAPI media_engine_grabber_callback_OnClockStart(IMFSampleGrabbe ...@@ -1351,6 +1356,12 @@ static HRESULT WINAPI media_engine_grabber_callback_OnClockStart(IMFSampleGrabbe
static HRESULT WINAPI media_engine_grabber_callback_OnClockStop(IMFSampleGrabberSinkCallback *iface, static HRESULT WINAPI media_engine_grabber_callback_OnClockStop(IMFSampleGrabberSinkCallback *iface,
MFTIME systime) MFTIME systime)
{ {
struct media_engine *engine = impl_from_IMFSampleGrabberSinkCallback(iface);
EnterCriticalSection(&engine->cs);
media_engine_set_flag(engine, FLAGS_ENGINE_FIRST_FRAME, FALSE);
LeaveCriticalSection(&engine->cs);
return S_OK; return S_OK;
} }
...@@ -1382,6 +1393,18 @@ static HRESULT WINAPI media_engine_grabber_callback_OnProcessSample(IMFSampleGra ...@@ -1382,6 +1393,18 @@ static HRESULT WINAPI media_engine_grabber_callback_OnProcessSample(IMFSampleGra
REFGUID major_type, DWORD sample_flags, LONGLONG sample_time, LONGLONG sample_duration, REFGUID major_type, DWORD sample_flags, LONGLONG sample_time, LONGLONG sample_duration,
const BYTE *buffer, DWORD sample_size) const BYTE *buffer, DWORD sample_size)
{ {
struct media_engine *engine = impl_from_IMFSampleGrabberSinkCallback(iface);
EnterCriticalSection(&engine->cs);
if (!(engine->flags & FLAGS_ENGINE_FIRST_FRAME))
{
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_FIRSTFRAMEREADY, 0, 0);
engine->flags |= FLAGS_ENGINE_FIRST_FRAME;
}
LeaveCriticalSection(&engine->cs);
return S_OK; return S_OK;
} }
......
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