[PATCH 5/5] mfplat: Return all possible events from IMFMediaSession

Sven Baars sven.wine at gmail.com
Mon Oct 29 15:12:03 CDT 2018


Signed-off-by: Sven Baars <sven.wine at gmail.com>
---
This feels like a hack, but without it, Disgaea 5 will be stuck in an infinite loop
waiting for the right event, which is of type MEEndOfPresentation. If I just return this
event, however, other applications may get stuck in the same infinite loop for a 
different event. I am open to suggestions.

 dlls/mf/Makefile.in |  1 +
 dlls/mf/session.c   | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/dlls/mf/Makefile.in b/dlls/mf/Makefile.in
index 9c61d94c8a..f05364bca6 100644
--- a/dlls/mf/Makefile.in
+++ b/dlls/mf/Makefile.in
@@ -1,5 +1,6 @@
 MODULE    = mf.dll
 IMPORTLIB = mf
+IMPORTS   = mfplat
 
 C_SRCS = \
 	main.c \
diff --git a/dlls/mf/session.c b/dlls/mf/session.c
index 18c5f3bf01..4cea5ec6f4 100644
--- a/dlls/mf/session.c
+++ b/dlls/mf/session.c
@@ -23,16 +23,23 @@
 
 #include "windef.h"
 #include "winbase.h"
+
+#include "mfapi.h"
 #include "mfidl.h"
 
+#include "initguid.h"
+
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
 
+DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
+
 typedef struct mfsession
 {
     IMFMediaSession IMFMediaSession_iface;
     LONG ref;
+    LONG event;
 } mfsession;
 
 static inline mfsession *impl_from_IMFMediaSession(IMFMediaSession *iface)
@@ -94,7 +101,11 @@ static HRESULT WINAPI mfsession_GetEvent(IMFMediaSession *iface, DWORD flags, IM
 
     FIXME("(%p)->(%#x, %p)\n", This, flags, event);
 
-    return E_NOTIMPL;
+    This->event = ++This->event % 10000;
+    TRACE("using event %d\n", This->event);
+    MFCreateMediaEvent(This->event, &GUID_NULL, S_OK, NULL, event);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI mfsession_BeginGetEvent(IMFMediaSession *iface, IMFAsyncCallback *callback, IUnknown *state)
@@ -257,6 +268,7 @@ HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **ses
 
     object->IMFMediaSession_iface.lpVtbl = &mfmediasessionvtbl;
     object->ref = 1;
+    object->event = 0;
 
     *session = &object->IMFMediaSession_iface;
 
-- 
2.17.1




More information about the wine-devel mailing list