Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/sample.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/dlls/evr/sample.c b/dlls/evr/sample.c index cd6cef001aa..f5189443307 100644 --- a/dlls/evr/sample.c +++ b/dlls/evr/sample.c @@ -21,6 +21,8 @@ #include "evr.h" #include "mfapi.h" #include "mferror.h" +#include "d3d9.h" +#include "dxva2api.h"
#include "wine/debug.h" #include "wine/heap.h" @@ -108,6 +110,7 @@ struct sample_allocator
IMFVideoSampleAllocatorNotify *callback; unsigned int free_samples; + IDirect3DDeviceManager9 *device_manager; CRITICAL_SECTION cs; };
@@ -168,6 +171,8 @@ static ULONG WINAPI sample_allocator_Release(IMFVideoSampleAllocator *iface) { if (allocator->callback) IMFVideoSampleAllocatorNotify_Release(allocator->callback); + if (allocator->device_manager) + IDirect3DDeviceManager9_Release(allocator->device_manager); DeleteCriticalSection(&allocator->cs); heap_free(allocator); } @@ -178,9 +183,27 @@ static ULONG WINAPI sample_allocator_Release(IMFVideoSampleAllocator *iface) static HRESULT WINAPI sample_allocator_SetDirectXManager(IMFVideoSampleAllocator *iface, IUnknown *manager) { - FIXME("%p, %p.\n", iface, manager); + struct sample_allocator *allocator = impl_from_IMFVideoSampleAllocator(iface); + IDirect3DDeviceManager9 *device_manager = NULL; + HRESULT hr;
- return E_NOTIMPL; + TRACE("%p, %p.\n", iface, manager); + + if (manager && FAILED(hr = IUnknown_QueryInterface(manager, &IID_IDirect3DDeviceManager9, + (void **)&device_manager))) + { + return hr; + } + + EnterCriticalSection(&allocator->cs); + + if (allocator->device_manager) + IDirect3DDeviceManager9_Release(allocator->device_manager); + allocator->device_manager = device_manager; + + LeaveCriticalSection(&allocator->cs); + + return S_OK; }
static HRESULT WINAPI sample_allocator_UninitializeSampleAllocator(IMFVideoSampleAllocator *iface)
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index 957d0e0f797..cc3f828e540 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -528,13 +528,26 @@ static ULONG WINAPI video_stream_get_service_Release(IMFGetService *iface) static HRESULT WINAPI video_stream_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj) { struct video_stream *stream = impl_from_stream_IMFGetService(iface); + HRESULT hr = S_OK;
TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
if (IsEqualGUID(service, &MR_VIDEO_ACCELERATION_SERVICE)) { if (IsEqualIID(riid, &IID_IMFVideoSampleAllocator)) - return IMFVideoSampleAllocator_QueryInterface(stream->allocator, riid, obj); + { + EnterCriticalSection(&stream->cs); + + if (!stream->allocator) + hr = MFCreateVideoSampleAllocator(&IID_IMFVideoSampleAllocator, (void **)&stream->allocator); + if (SUCCEEDED(hr)) + hr = IMFVideoSampleAllocator_QueryInterface(stream->allocator, riid, obj); + + LeaveCriticalSection(&stream->cs); + + return hr; + } + return E_NOINTERFACE; }
@@ -569,9 +582,6 @@ static HRESULT video_renderer_stream_create(struct video_renderer *renderer, uns if (FAILED(hr = MFCreateEventQueue(&stream->event_queue))) goto failed;
- if (FAILED(hr = MFCreateVideoSampleAllocator(&IID_IMFVideoSampleAllocator, (void **)&stream->allocator))) - goto failed; - stream->parent = renderer; IMFMediaSink_AddRef(&stream->parent->IMFMediaSink_iface); stream->id = id;
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index cc3f828e540..7a00c4dd038 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -539,7 +539,11 @@ static HRESULT WINAPI video_stream_get_service_GetService(IMFGetService *iface, EnterCriticalSection(&stream->cs);
if (!stream->allocator) + { hr = MFCreateVideoSampleAllocator(&IID_IMFVideoSampleAllocator, (void **)&stream->allocator); + if (SUCCEEDED(hr)) + hr = IMFVideoSampleAllocator_SetDirectXManager(stream->allocator, stream->parent->device_manager); + } if (SUCCEEDED(hr)) hr = IMFVideoSampleAllocator_QueryInterface(stream->allocator, riid, obj);
@@ -667,6 +671,8 @@ static ULONG WINAPI video_renderer_sink_Release(IMFMediaSink *iface) IMFTransform_Release(renderer->mixer); if (renderer->presenter) IMFVideoPresenter_Release(renderer->presenter); + if (renderer->device_manager) + IUnknown_Release(renderer->device_manager); if (renderer->clock) IMFPresentationClock_Release(renderer->clock); if (renderer->attributes) @@ -1183,6 +1189,12 @@ static HRESULT video_renderer_configure_presenter(struct video_renderer *rendere IMFTopologyServiceLookupClient_Release(lookup_client); }
+ if (FAILED(MFGetService((IUnknown *)renderer->presenter, &MR_VIDEO_ACCELERATION_SERVICE, + &IID_IUnknown, (void **)&renderer->device_manager))) + { + WARN("Failed to get device manager from the presenter.\n"); + } + return hr; }
@@ -1203,6 +1215,12 @@ static HRESULT video_renderer_initialize(struct video_renderer *renderer, IMFTra renderer->presenter = NULL; }
+ if (renderer->device_manager) + { + IUnknown_Release(renderer->device_manager); + renderer->device_manager = NULL; + } + renderer->mixer = mixer; IMFTransform_AddRef(renderer->mixer);
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=80819
Your paranoid android.
=== debiant (build log) ===
../wine/dlls/mf/evr.c:545:101: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:674:21: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:675:38: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:675:38: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:1193:46: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:1218:17: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:1220:34: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:1220:34: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:1221:17: error: ‘struct video_renderer’ has no member named ‘device_manager’ Task: The win32 Wine build failed
=== debiant (build log) ===
../wine/dlls/mf/evr.c:545:101: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:674:21: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:675:38: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:675:38: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:1193:46: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:1218:17: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:1220:34: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:1220:34: error: ‘struct video_renderer’ has no member named ‘device_manager’ ../wine/dlls/mf/evr.c:1221:17: error: ‘struct video_renderer’ has no member named ‘device_manager’ Task: The wow64 Wine build failed