Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfuuid/Makefile.in | 1 + dlls/mfuuid/mfplay.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 dlls/mfuuid/mfplay.c
diff --git a/dlls/mfuuid/Makefile.in b/dlls/mfuuid/Makefile.in index 5fbb522782c..b42583bbb73 100644 --- a/dlls/mfuuid/Makefile.in +++ b/dlls/mfuuid/Makefile.in @@ -1,4 +1,5 @@ MODULE = libmfuuid.a
C_SRCS = \ + mfplay.c \ mfuuid.c diff --git a/dlls/mfuuid/mfplay.c b/dlls/mfuuid/mfplay.c new file mode 100644 index 00000000000..1d28306fe4f --- /dev/null +++ b/dlls/mfuuid/mfplay.c @@ -0,0 +1,21 @@ +/* + * Copyright 2021 Nikolay Sivov for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "evr.h" +#include "initguid.h" +#include "mfplay.h"
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplay/Makefile.in | 1 + dlls/mfplay/player.c | 372 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 371 insertions(+), 2 deletions(-)
diff --git a/dlls/mfplay/Makefile.in b/dlls/mfplay/Makefile.in index 539240ceadc..0a8645fe840 100644 --- a/dlls/mfplay/Makefile.in +++ b/dlls/mfplay/Makefile.in @@ -1,4 +1,5 @@ MODULE = mfplay.dll +IMPORTS = uuid mfuuid
EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native
diff --git a/dlls/mfplay/player.c b/dlls/mfplay/player.c index 1e4f1f561f4..1e2a3a8f189 100644 --- a/dlls/mfplay/player.c +++ b/dlls/mfplay/player.c @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#define COBJMACROS + #include <stdarg.h>
#include "windef.h" @@ -23,13 +25,379 @@ #include "mfplay.h"
#include "wine/debug.h" +#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
+struct media_player +{ + IMFPMediaPlayer IMFPMediaPlayer_iface; + LONG refcount; +}; + +static struct media_player *impl_from_IMFPMediaPlayer(IMFPMediaPlayer *iface) +{ + return CONTAINING_RECORD(iface, struct media_player, IMFPMediaPlayer_iface); +} + +static HRESULT WINAPI media_player_QueryInterface(IMFPMediaPlayer *iface, REFIID riid, void **obj) +{ + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj); + + if (IsEqualIID(riid, &IID_IMFPMediaPlayer) || + IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IMFPMediaPlayer_AddRef(iface); + return S_OK; + } + + WARN("Unsupported interface %s.\n", debugstr_guid(riid)); + *obj = NULL; + + return E_NOINTERFACE; +} + +static ULONG WINAPI media_player_AddRef(IMFPMediaPlayer *iface) +{ + struct media_player *player = impl_from_IMFPMediaPlayer(iface); + ULONG refcount = InterlockedIncrement(&player->refcount); + + TRACE("%p, refcount %u.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI media_player_Release(IMFPMediaPlayer *iface) +{ + struct media_player *player = impl_from_IMFPMediaPlayer(iface); + ULONG refcount = InterlockedDecrement(&player->refcount); + + TRACE("%p, refcount %u.\n", iface, refcount); + + if (!refcount) + heap_free(player); + + return refcount; +} + +static HRESULT WINAPI media_player_Play(IMFPMediaPlayer *iface) +{ + FIXME("%p.\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_Pause(IMFPMediaPlayer *iface) +{ + FIXME("%p.\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_Stop(IMFPMediaPlayer *iface) +{ + FIXME("%p.\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_FrameStep(IMFPMediaPlayer *iface) +{ + FIXME("%p.\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_SetPosition(IMFPMediaPlayer *iface, REFGUID postype, const PROPVARIANT *position) +{ + FIXME("%p, %s, %p.\n", iface, debugstr_guid(postype), position); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetPosition(IMFPMediaPlayer *iface, REFGUID postype, PROPVARIANT *position) +{ + FIXME("%p, %s, %p.\n", iface, debugstr_guid(postype), position); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetDuration(IMFPMediaPlayer *iface, REFGUID postype, PROPVARIANT *position) +{ + FIXME("%p, %s, %p.\n", iface, debugstr_guid(postype), position); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_SetRate(IMFPMediaPlayer *iface, float rate) +{ + FIXME("%p, %f.\n", iface, rate); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetRate(IMFPMediaPlayer *iface, float *rate) +{ + FIXME("%p, %p.\n", iface, rate); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetSupportedRates(IMFPMediaPlayer *iface, BOOL forward, float *slowest_rate, float *fastest_rate) +{ + FIXME("%p, %d, %p, %p.\n", iface, forward, slowest_rate, fastest_rate); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetState(IMFPMediaPlayer *iface, MFP_MEDIAPLAYER_STATE *state) +{ + FIXME("%p, %p.\n", iface, state); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_CreateMediaItemFromURL(IMFPMediaPlayer *iface, + const WCHAR *url, BOOL sync, DWORD_PTR user_data, IMFPMediaItem **item) +{ + FIXME("%p, %s, %d, %lx, %p.\n", iface, debugstr_w(url), sync, user_data, item); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_CreateMediaItemFromObject(IMFPMediaPlayer *iface, + IUnknown *object, BOOL sync, DWORD_PTR user_data, IMFPMediaItem **item) +{ + FIXME("%p, %p, %d, %lx, %p.\n", iface, object, sync, user_data, item); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_SetMediaItem(IMFPMediaPlayer *iface, IMFPMediaItem *item) +{ + FIXME("%p, %p.\n", iface, item); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_ClearMediaItem(IMFPMediaPlayer *iface) +{ + FIXME("%p.\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetMediaItem(IMFPMediaPlayer *iface, IMFPMediaItem **item) +{ + FIXME("%p, %p.\n", iface, item); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetVolume(IMFPMediaPlayer *iface, float *volume) +{ + FIXME("%p, %p.\n", iface, volume); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_SetVolume(IMFPMediaPlayer *iface, float volume) +{ + FIXME("%p, %.8e.\n", iface, volume); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetBalance(IMFPMediaPlayer *iface, float *balance) +{ + FIXME("%p, %p.\n", iface, balance); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_SetBalance(IMFPMediaPlayer *iface, float balance) +{ + FIXME("%p, %.8e.\n", iface, balance); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetMute(IMFPMediaPlayer *iface, BOOL *mute) +{ + FIXME("%p, %p.\n", iface, mute); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_SetMute(IMFPMediaPlayer *iface, BOOL mute) +{ + FIXME("%p, %d.\n", iface, mute); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetNativeVideoSize(IMFPMediaPlayer *iface, + SIZE *video, SIZE *arvideo) +{ + FIXME("%p, %p, %p.\n", iface, video, arvideo); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetIdealVideoSize(IMFPMediaPlayer *iface, + SIZE *min_size, SIZE *max_size) +{ + FIXME("%p, %p, %p.\n", iface, min_size, max_size); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_SetVideoSourceRect(IMFPMediaPlayer *iface, + MFVideoNormalizedRect const *rect) +{ + FIXME("%p, %p.\n", iface, rect); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetVideoSourceRect(IMFPMediaPlayer *iface, + MFVideoNormalizedRect *rect) +{ + FIXME("%p, %p.\n", iface, rect); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_SetAspectRatioMode(IMFPMediaPlayer *iface, DWORD mode) +{ + FIXME("%p, %u.\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetAspectRatioMode(IMFPMediaPlayer *iface, + DWORD *mode) +{ + FIXME("%p, %p.\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetVideoWindow(IMFPMediaPlayer *iface, HWND *hwnd) +{ + FIXME("%p, %p.\n", iface, hwnd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_UpdateVideo(IMFPMediaPlayer *iface) +{ + FIXME("%p.\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_SetBorderColor(IMFPMediaPlayer *iface, COLORREF color) +{ + FIXME("%p, %#x.\n", iface, color); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_GetBorderColor(IMFPMediaPlayer *iface, COLORREF *color) +{ + FIXME("%p, %p.\n", iface, color); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_InsertEffect(IMFPMediaPlayer *iface, IUnknown *effect, + BOOL optional) +{ + FIXME("%p, %p, %d.\n", iface, effect, optional); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_RemoveEffect(IMFPMediaPlayer *iface, IUnknown *effect) +{ + FIXME("%p, %p.\n", iface, effect); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_RemoveAllEffects(IMFPMediaPlayer *iface) +{ + FIXME("%p.\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI media_player_Shutdown(IMFPMediaPlayer *iface) +{ + FIXME("%p.\n", iface); + + return E_NOTIMPL; +} + +static const IMFPMediaPlayerVtbl media_player_vtbl = +{ + media_player_QueryInterface, + media_player_AddRef, + media_player_Release, + media_player_Play, + media_player_Pause, + media_player_Stop, + media_player_FrameStep, + media_player_SetPosition, + media_player_GetPosition, + media_player_GetDuration, + media_player_SetRate, + media_player_GetRate, + media_player_GetSupportedRates, + media_player_GetState, + media_player_CreateMediaItemFromURL, + media_player_CreateMediaItemFromObject, + media_player_SetMediaItem, + media_player_ClearMediaItem, + media_player_GetMediaItem, + media_player_GetVolume, + media_player_SetVolume, + media_player_GetBalance, + media_player_SetBalance, + media_player_GetMute, + media_player_SetMute, + media_player_GetNativeVideoSize, + media_player_GetIdealVideoSize, + media_player_SetVideoSourceRect, + media_player_GetVideoSourceRect, + media_player_SetAspectRatioMode, + media_player_GetAspectRatioMode, + media_player_GetVideoWindow, + media_player_UpdateVideo, + media_player_SetBorderColor, + media_player_GetBorderColor, + media_player_InsertEffect, + media_player_RemoveEffect, + media_player_RemoveAllEffects, + media_player_Shutdown, +}; + HRESULT WINAPI MFPCreateMediaPlayer(const WCHAR *url, BOOL start_playback, MFP_CREATION_OPTIONS options, IMFPMediaPlayerCallback *callback, HWND hwnd, IMFPMediaPlayer **player) { - FIXME("%s, %d, %#x, %p, %p, %p.\n", debugstr_w(url), start_playback, options, callback, hwnd, player); + struct media_player *object;
- return E_NOTIMPL; + TRACE("%s, %d, %#x, %p, %p, %p.\n", debugstr_w(url), start_playback, options, callback, hwnd, player); + + if (!(object = heap_alloc_zero(sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IMFPMediaPlayer_iface.lpVtbl = &media_player_vtbl; + object->refcount = 1; + + *player = &object->IMFPMediaPlayer_iface; + + return S_OK; }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- configure | 1 + configure.ac | 1 + dlls/mfplay/Makefile.in | 1 + dlls/mfplay/tests/Makefile.in | 5 +++++ dlls/mfplay/tests/mfplay.c | 42 +++++++++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+) create mode 100644 dlls/mfplay/tests/Makefile.in create mode 100644 dlls/mfplay/tests/mfplay.c
diff --git a/configure b/configure index a19bb0b9581..cf34fa3ada5 100755 --- a/configure +++ b/configure @@ -20739,6 +20739,7 @@ wine_fn_config_makefile dlls/mfmediaengine/tests enable_tests wine_fn_config_makefile dlls/mfplat enable_mfplat wine_fn_config_makefile dlls/mfplat/tests enable_tests wine_fn_config_makefile dlls/mfplay enable_mfplay +wine_fn_config_makefile dlls/mfplay/tests enable_tests wine_fn_config_makefile dlls/mfreadwrite enable_mfreadwrite wine_fn_config_makefile dlls/mfreadwrite/tests enable_tests wine_fn_config_makefile dlls/mfuuid enable_mfuuid diff --git a/configure.ac b/configure.ac index eb08e8b0f17..95eb04d6d49 100644 --- a/configure.ac +++ b/configure.ac @@ -3414,6 +3414,7 @@ WINE_CONFIG_MAKEFILE(dlls/mfmediaengine/tests) WINE_CONFIG_MAKEFILE(dlls/mfplat) WINE_CONFIG_MAKEFILE(dlls/mfplat/tests) WINE_CONFIG_MAKEFILE(dlls/mfplay) +WINE_CONFIG_MAKEFILE(dlls/mfplay/tests) WINE_CONFIG_MAKEFILE(dlls/mfreadwrite) WINE_CONFIG_MAKEFILE(dlls/mfreadwrite/tests) WINE_CONFIG_MAKEFILE(dlls/mfuuid) diff --git a/dlls/mfplay/Makefile.in b/dlls/mfplay/Makefile.in index 0a8645fe840..b21ce0e2161 100644 --- a/dlls/mfplay/Makefile.in +++ b/dlls/mfplay/Makefile.in @@ -1,4 +1,5 @@ MODULE = mfplay.dll +IMPORTLIB = mfplay IMPORTS = uuid mfuuid
EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native diff --git a/dlls/mfplay/tests/Makefile.in b/dlls/mfplay/tests/Makefile.in new file mode 100644 index 00000000000..ca08c65ce24 --- /dev/null +++ b/dlls/mfplay/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = mfplay.dll +IMPORTS = mfplay + +C_SRCS = \ + mfplay.c diff --git a/dlls/mfplay/tests/mfplay.c b/dlls/mfplay/tests/mfplay.c new file mode 100644 index 00000000000..e9b5df95039 --- /dev/null +++ b/dlls/mfplay/tests/mfplay.c @@ -0,0 +1,42 @@ +/* + * Copyright 2021 Nikolay Sivov for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "mfplay.h" + +#include "wine/test.h" + +static void test_create_player(void) +{ + IMFPMediaPlayer *player; + HRESULT hr; + + hr = MFPCreateMediaPlayer(NULL, FALSE, 0, NULL, NULL, &player); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IMFPMediaPlayer_Release(player); +} + +START_TEST(mfplay) +{ + test_create_player(); +}
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=88105
Your paranoid android.
=== w2008s64 (32 bit report) ===
mfplay: mfplay.c:0: Test failed: missing manifest for side-by-side dll (details below)
=== w2008s64 (task log) ===
TestLauncher32.exe:error: Unexpected return value 1 from wait for child
=== wvistau64 (64 bit report) ===
mfplay: mfplay.c:0: Test failed: missing manifest for side-by-side dll (details below)
=== wvistau64 (task log) ===
TestLauncher64.exe:error: Unexpected return value 1 from wait for child
=== w2008s64 (64 bit report) ===
mfplay: mfplay.c:0: Test failed: missing manifest for side-by-side dll (details below)
=== w2008s64 (task log) ===
TestLauncher64.exe:error: Unexpected return value 1 from wait for child