Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplay/Makefile.in | 2 +- dlls/mfplay/player.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/mfplay/Makefile.in b/dlls/mfplay/Makefile.in index b21ce0e2161..91a8e5cc5a6 100644 --- a/dlls/mfplay/Makefile.in +++ b/dlls/mfplay/Makefile.in @@ -1,6 +1,6 @@ MODULE = mfplay.dll IMPORTLIB = mfplay -IMPORTS = uuid mfuuid +IMPORTS = mfplat uuid mfuuid
EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native
diff --git a/dlls/mfplay/player.c b/dlls/mfplay/player.c index 6905812835a..0305f663924 100644 --- a/dlls/mfplay/player.c +++ b/dlls/mfplay/player.c @@ -22,6 +22,7 @@
#include "windef.h" #include "winbase.h" +#include "mfapi.h" #include "mfplay.h"
#include "wine/debug.h" @@ -29,6 +30,20 @@
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
+static LONG startup_refcount; + +static void platform_startup(void) +{ + if (InterlockedIncrement(&startup_refcount) == 1) + MFStartup(MF_VERSION, MFSTARTUP_FULL); +} + +static void platform_shutdown(void) +{ + if (InterlockedDecrement(&startup_refcount) == 0) + MFShutdown(); +} + struct media_player { IMFPMediaPlayer IMFPMediaPlayer_iface; @@ -81,6 +96,8 @@ static ULONG WINAPI media_player_Release(IMFPMediaPlayer *iface) if (player->callback) IMFPMediaPlayerCallback_Release(player->callback); heap_free(player); + + platform_shutdown(); }
return refcount; @@ -405,6 +422,8 @@ HRESULT WINAPI MFPCreateMediaPlayer(const WCHAR *url, BOOL start_playback, MFP_C if (object->callback) IMFPMediaPlayerCallback_AddRef(object->callback);
+ platform_startup(); + *player = &object->IMFPMediaPlayer_iface;
return S_OK;