Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/Makefile.in | 1 - dlls/evr/evr.c | 2 +- dlls/evr/mixer.c | 72 ++++++++++++++++++++++---------------------- dlls/evr/presenter.c | 40 ++++++++++++------------ dlls/evr/sample.c | 30 +++++++++--------- 5 files changed, 72 insertions(+), 73 deletions(-)
diff --git a/dlls/evr/Makefile.in b/dlls/evr/Makefile.in index 2d86885d650..d5d78252113 100644 --- a/dlls/evr/Makefile.in +++ b/dlls/evr/Makefile.in @@ -1,4 +1,3 @@ -EXTRADEFS = -DWINE_NO_LONG_TYPES MODULE = evr.dll IMPORTLIB = evr IMPORTS = mfuuid strmiids strmbase uuid dxguid ole32 oleaut32 user32 d3d9 dxva2 diff --git a/dlls/evr/evr.c b/dlls/evr/evr.c index 1965fd247de..5e6ca03ea3d 100644 --- a/dlls/evr/evr.c +++ b/dlls/evr/evr.c @@ -109,7 +109,7 @@ static HRESULT WINAPI filter_config_SetNumberOfStreams(IEVRFilterConfig *iface, { struct evr *filter = impl_from_IEVRFilterConfig(iface);
- FIXME("filter %p, count %u, stub!\n", filter, count); + FIXME("filter %p, count %lu, stub!\n", filter, count);
return E_NOTIMPL; } diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index 3d72270fc16..89215b4dec0 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -314,7 +314,7 @@ static ULONG WINAPI video_mixer_inner_AddRef(IUnknown *iface) struct video_mixer *mixer = impl_from_IUnknown(iface); ULONG refcount = InterlockedIncrement(&mixer->refcount);
- TRACE("%p, refcount %u.\n", iface, refcount); + TRACE("%p, refcount %lu.\n", iface, refcount);
return refcount; } @@ -339,7 +339,7 @@ static ULONG WINAPI video_mixer_inner_Release(IUnknown *iface) ULONG refcount = InterlockedDecrement(&mixer->refcount); unsigned int i;
- TRACE("%p, refcount %u.\n", iface, refcount); + TRACE("%p, refcount %lu.\n", iface, refcount);
if (!refcount) { @@ -419,7 +419,7 @@ static HRESULT WINAPI video_mixer_transform_GetStreamIDs(IMFTransform *iface, DW struct video_mixer *mixer = impl_from_IMFTransform(iface); HRESULT hr = S_OK;
- TRACE("%p, %u, %p, %u, %p.\n", iface, input_size, inputs, output_size, outputs); + TRACE("%p, %lu, %p, %lu, %p.\n", iface, input_size, inputs, output_size, outputs);
EnterCriticalSection(&mixer->cs); if (mixer->input_count > input_size || !output_size) @@ -438,7 +438,7 @@ static HRESULT WINAPI video_mixer_transform_GetInputStreamInfo(IMFTransform *ifa struct input_stream *input; HRESULT hr;
- TRACE("%p, %u, %p.\n", iface, id, info); + TRACE("%p, %lu, %p.\n", iface, id, info);
EnterCriticalSection(&mixer->cs);
@@ -456,7 +456,7 @@ static HRESULT WINAPI video_mixer_transform_GetInputStreamInfo(IMFTransform *ifa
static HRESULT WINAPI video_mixer_transform_GetOutputStreamInfo(IMFTransform *iface, DWORD id, MFT_OUTPUT_STREAM_INFO *info) { - TRACE("%p, %u, %p.\n", iface, id, info); + TRACE("%p, %lu, %p.\n", iface, id, info);
if (id) return MF_E_INVALIDSTREAMNUMBER; @@ -488,7 +488,7 @@ static HRESULT WINAPI video_mixer_transform_GetInputStreamAttributes(IMFTransfor struct input_stream *input; HRESULT hr;
- TRACE("%p, %u, %p.\n", iface, id, attributes); + TRACE("%p, %lu, %p.\n", iface, id, attributes);
EnterCriticalSection(&mixer->cs);
@@ -507,7 +507,7 @@ static HRESULT WINAPI video_mixer_transform_GetInputStreamAttributes(IMFTransfor static HRESULT WINAPI video_mixer_transform_GetOutputStreamAttributes(IMFTransform *iface, DWORD id, IMFAttributes **attributes) { - TRACE("%p, %u, %p.\n", iface, id, attributes); + TRACE("%p, %lu, %p.\n", iface, id, attributes);
return E_NOTIMPL; } @@ -519,7 +519,7 @@ static HRESULT WINAPI video_mixer_transform_DeleteInputStream(IMFTransform *ifac unsigned int idx; HRESULT hr;
- TRACE("%p, %u.\n", iface, id); + TRACE("%p, %lu.\n", iface, id);
if (!id) return MF_E_INVALIDSTREAMNUMBER; @@ -561,7 +561,7 @@ static HRESULT WINAPI video_mixer_transform_AddInputStreams(IMFTransform *iface, unsigned int i, len; HRESULT hr = S_OK;
- TRACE("%p, %u, %p.\n", iface, count, ids); + TRACE("%p, %lu, %p.\n", iface, count, ids);
if (!ids) return E_POINTER; @@ -620,7 +620,7 @@ static HRESULT WINAPI video_mixer_transform_AddInputStreams(IMFTransform *iface, static HRESULT WINAPI video_mixer_transform_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) { - TRACE("%p, %u, %u, %p.\n", iface, id, index, type); + TRACE("%p, %lu, %lu, %p.\n", iface, id, index, type);
return E_NOTIMPL; } @@ -631,7 +631,7 @@ static HRESULT WINAPI video_mixer_transform_GetOutputAvailableType(IMFTransform struct video_mixer *mixer = impl_from_IMFTransform(iface); HRESULT hr = S_OK;
- TRACE("%p, %u, %u, %p.\n", iface, id, index, type); + TRACE("%p, %lu, %lu, %p.\n", iface, id, index, type);
if (id) return MF_E_INVALIDSTREAMNUMBER; @@ -853,7 +853,7 @@ static HRESULT WINAPI video_mixer_transform_SetInputType(IMFTransform *iface, DW unsigned int count; GUID *guids;
- TRACE("%p, %u, %p, %#x.\n", iface, id, media_type, flags); + TRACE("%p, %lu, %p, %#lx.\n", iface, id, media_type, flags);
EnterCriticalSection(&mixer->cs);
@@ -910,7 +910,7 @@ static HRESULT WINAPI video_mixer_transform_SetOutputType(IMFTransform *iface, D DWORD compare_flags; unsigned int i;
- TRACE("%p, %u, %p, %#x.\n", iface, id, type, flags); + TRACE("%p, %lu, %p, %#lx.\n", iface, id, type, flags);
if (id) return MF_E_INVALIDSTREAMNUMBER; @@ -985,7 +985,7 @@ static HRESULT WINAPI video_mixer_transform_GetInputCurrentType(IMFTransform *if struct input_stream *stream; HRESULT hr;
- TRACE("%p, %u, %p.\n", iface, id, type); + TRACE("%p, %lu, %p.\n", iface, id, type);
EnterCriticalSection(&mixer->cs);
@@ -1010,7 +1010,7 @@ static HRESULT WINAPI video_mixer_transform_GetOutputCurrentType(IMFTransform *i struct video_mixer *mixer = impl_from_IMFTransform(iface); HRESULT hr = S_OK;
- TRACE("%p, %u, %p.\n", iface, id, type); + TRACE("%p, %lu, %p.\n", iface, id, type);
if (id) return MF_E_INVALIDSTREAMNUMBER; @@ -1036,7 +1036,7 @@ static HRESULT WINAPI video_mixer_transform_GetInputStatus(IMFTransform *iface, struct input_stream *stream; HRESULT hr;
- TRACE("%p, %u, %p.\n", iface, id, status); + TRACE("%p, %lu, %p.\n", iface, id, status);
if (!status) return E_POINTER; @@ -1106,7 +1106,7 @@ static HRESULT WINAPI video_mixer_transform_SetOutputBounds(IMFTransform *iface,
static HRESULT WINAPI video_mixer_transform_ProcessEvent(IMFTransform *iface, DWORD id, IMFMediaEvent *event) { - FIXME("%p, %u, %p.\n", iface, id, event); + FIXME("%p, %lu, %p.\n", iface, id, event);
return E_NOTIMPL; } @@ -1126,7 +1126,7 @@ static HRESULT WINAPI video_mixer_transform_ProcessMessage(IMFTransform *iface, HRESULT hr = S_OK; unsigned int i;
- TRACE("%p, %#x, %#lx.\n", iface, message, param); + TRACE("%p, %#x, %Iu.\n", iface, message, param);
EnterCriticalSection(&mixer->cs);
@@ -1177,7 +1177,7 @@ static HRESULT WINAPI video_mixer_transform_ProcessInput(IMFTransform *iface, DW struct input_stream *input; HRESULT hr;
- TRACE("%p, %u, %p, %#x.\n", iface, id, sample, flags); + TRACE("%p, %lu, %p, %#lx.\n", iface, id, sample, flags);
if (!sample) return E_POINTER; @@ -1317,7 +1317,7 @@ static void video_mixer_render(struct video_mixer *mixer, IDirect3DSurface9 *rt)
if (FAILED(hr = video_mixer_get_sample_surface(stream->sample, &surface))) { - WARN("Failed to get source surface for stream %u, hr %#x.\n", i, hr); + WARN("Failed to get source surface for stream %u, hr %#lx.\n", i, hr); break; }
@@ -1346,7 +1346,7 @@ static void video_mixer_render(struct video_mixer *mixer, IDirect3DSurface9 *rt) if (FAILED(hr = IDirectXVideoProcessor_VideoProcessBlt(mixer->processor, rt, ¶ms, samples, mixer->input_count, NULL))) { - WARN("Failed to process samples, hr %#x.\n", hr); + WARN("Failed to process samples, hr %#lx.\n", hr); } }
@@ -1395,7 +1395,7 @@ static HRESULT WINAPI video_mixer_transform_ProcessOutput(IMFTransform *iface, D unsigned int i; HRESULT hr;
- TRACE("%p, %#x, %u, %p, %p.\n", iface, flags, count, buffers, status); + TRACE("%p, %#lx, %lu, %p, %p.\n", iface, flags, count, buffers, status);
if (!buffers || !count || count > 1 || !buffers->pSample) return E_INVALIDARG; @@ -1572,7 +1572,7 @@ static HRESULT WINAPI video_mixer_service_client_InitServicePointers(IMFTopology if (FAILED(hr = IMFTopologyServiceLookup_LookupService(service_lookup, MF_SERVICE_LOOKUP_GLOBAL, 0, &MR_VIDEO_RENDER_SERVICE, &IID_IMediaEventSink, (void **)&mixer->event_sink, &count))) { - WARN("Failed to get renderer event sink, hr %#x.\n", hr); + WARN("Failed to get renderer event sink, hr %#lx.\n", hr); }
LeaveCriticalSection(&mixer->cs); @@ -1630,7 +1630,7 @@ static HRESULT WINAPI video_mixer_control_SetStreamZOrder(IMFVideoMixerControl2 struct input_stream *stream; HRESULT hr;
- TRACE("%p, %u, %u.\n", iface, id, zorder); + TRACE("%p, %lu, %lu.\n", iface, id, zorder);
/* Can't change reference stream. */ if (!id && zorder) @@ -1663,7 +1663,7 @@ static HRESULT WINAPI video_mixer_control_GetStreamZOrder(IMFVideoMixerControl2 struct input_stream *stream; HRESULT hr;
- TRACE("%p, %u, %p.\n", iface, id, zorder); + TRACE("%p, %lu, %p.\n", iface, id, zorder);
if (!zorder) return E_POINTER; @@ -1685,7 +1685,7 @@ static HRESULT WINAPI video_mixer_control_SetStreamOutputRect(IMFVideoMixerContr struct input_stream *stream; HRESULT hr;
- TRACE("%p, %u, %s.\n", iface, id, debugstr_normalized_rect(rect)); + TRACE("%p, %lu, %s.\n", iface, id, debugstr_normalized_rect(rect));
if (!rect) return E_POINTER; @@ -1713,7 +1713,7 @@ static HRESULT WINAPI video_mixer_control_GetStreamOutputRect(IMFVideoMixerContr struct input_stream *stream; HRESULT hr;
- TRACE("%p, %u, %p.\n", iface, id, rect); + TRACE("%p, %lu, %p.\n", iface, id, rect);
if (!rect) return E_POINTER; @@ -1732,7 +1732,7 @@ static HRESULT WINAPI video_mixer_control_SetMixingPrefs(IMFVideoMixerControl2 * { struct video_mixer *mixer = impl_from_IMFVideoMixerControl2(iface);
- TRACE("%p, %#x.\n", iface, flags); + TRACE("%p, %#lx.\n", iface, flags);
EnterCriticalSection(&mixer->cs); mixer->mixing_flags = flags; @@ -1898,7 +1898,7 @@ static ULONG WINAPI video_mixer_position_mapper_Release(IMFVideoPositionMapper * static HRESULT WINAPI video_mixer_position_mapper_MapOutputCoordinateToInputStream(IMFVideoPositionMapper *iface, float x_out, float y_out, DWORD output_stream, DWORD input_stream, float *x_in, float *y_in) { - FIXME("%p, %f, %f, %u, %u, %p, %p.\n", iface, x_out, y_out, output_stream, input_stream, x_in, y_in); + FIXME("%p, %f, %f, %lu, %lu, %p, %p.\n", iface, x_out, y_out, output_stream, input_stream, x_in, y_in);
return E_NOTIMPL; } @@ -1961,42 +1961,42 @@ static HRESULT WINAPI video_mixer_processor_SetVideoProcessorMode(IMFVideoProces
static HRESULT WINAPI video_mixer_processor_GetProcAmpRange(IMFVideoProcessor *iface, DWORD prop, DXVA2_ValueRange *range) { - FIXME("%p, %#x, %p.\n", iface, prop, range); + FIXME("%p, %#lx, %p.\n", iface, prop, range);
return E_NOTIMPL; }
static HRESULT WINAPI video_mixer_processor_GetProcAmpValues(IMFVideoProcessor *iface, DWORD flags, DXVA2_ProcAmpValues *values) { - FIXME("%p, %#x, %p.\n", iface, flags, values); + FIXME("%p, %#lx, %p.\n", iface, flags, values);
return E_NOTIMPL; }
static HRESULT WINAPI video_mixer_processor_SetProcAmpValues(IMFVideoProcessor *iface, DWORD flags, DXVA2_ProcAmpValues *values) { - FIXME("%p, %#x, %p.\n", iface, flags, values); + FIXME("%p, %#lx, %p.\n", iface, flags, values);
return E_NOTIMPL; }
static HRESULT WINAPI video_mixer_processor_GetFilteringRange(IMFVideoProcessor *iface, DWORD prop, DXVA2_ValueRange *range) { - FIXME("%p, %#x, %p.\n", iface, prop, range); + FIXME("%p, %#lx, %p.\n", iface, prop, range);
return E_NOTIMPL; }
static HRESULT WINAPI video_mixer_processor_GetFilteringValue(IMFVideoProcessor *iface, DWORD prop, DXVA2_Fixed32 *value) { - FIXME("%p, %#x, %p.\n", iface, prop, value); + FIXME("%p, %#lx, %p.\n", iface, prop, value);
return E_NOTIMPL; }
static HRESULT WINAPI video_mixer_processor_SetFilteringValue(IMFVideoProcessor *iface, DWORD prop, DXVA2_Fixed32 *value) { - FIXME("%p, %#x, %p.\n", iface, prop, value); + FIXME("%p, %#lx, %p.\n", iface, prop, value);
return E_NOTIMPL; } @@ -2037,7 +2037,7 @@ static HRESULT WINAPI video_mixer_processor_SetBackgroundColor(IMFVideoProcessor { struct video_mixer *mixer = impl_from_IMFVideoProcessor(iface);
- TRACE("%p, %#x.\n", iface, color); + TRACE("%p, %#lx.\n", iface, color);
EnterCriticalSection(&mixer->cs); if (mixer->bkgnd_color.rgba != color) diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c index cf8ba20cbb8..910af2891e3 100644 --- a/dlls/evr/presenter.c +++ b/dlls/evr/presenter.c @@ -320,7 +320,7 @@ static HRESULT video_presenter_set_media_type(struct video_presenter *presenter, presenter->frame_time_threshold = frametime / 4; } else - WARN("Failed to initialize sample allocator, hr %#x.\n", hr); + WARN("Failed to initialize sample allocator, hr %#lx.\n", hr);
return hr; } @@ -387,7 +387,7 @@ static HRESULT video_presenter_invalidate_media_type(struct video_presenter *pre /* FIXME: check that d3d device supports this format */
if (FAILED(hr = IMFMediaType_CopyAllItems(candidate_type, (IMFAttributes *)media_type))) - WARN("Failed to clone a media type, hr %#x.\n", hr); + WARN("Failed to clone a media type, hr %#lx.\n", hr); IMFMediaType_Release(candidate_type);
hr = video_presenter_configure_output_type(presenter, &aperture, media_type); @@ -490,13 +490,13 @@ static void video_presenter_sample_present(struct video_presenter *presenter, IM
if (FAILED(hr = video_presenter_get_sample_surface(sample, &surface))) { - WARN("Failed to get sample surface, hr %#x.\n", hr); + WARN("Failed to get sample surface, hr %#lx.\n", hr); return; }
if (FAILED(hr = IDirect3DSwapChain9_GetBackBuffer(presenter->swapchain, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer))) { - WARN("Failed to get a backbuffer, hr %#x.\n", hr); + WARN("Failed to get a backbuffer, hr %#lx.\n", hr); IDirect3DSurface9_Release(surface); return; } @@ -603,7 +603,7 @@ static HRESULT video_presenter_process_input(struct video_presenter *presenter)
if (FAILED(hr = IMFVideoSampleAllocator_AllocateSample(presenter->allocator, &sample))) { - WARN("Failed to allocate a sample, hr %#x.\n", hr); + WARN("Failed to allocate a sample, hr %#lx.\n", hr); break; }
@@ -722,7 +722,7 @@ static HRESULT video_presenter_start_streaming(struct video_presenter *presenter CloseHandle(presenter->thread.ready_event); presenter->thread.ready_event = NULL;
- TRACE("Started streaming thread, tid %#x.\n", presenter->thread.tid); + TRACE("Started streaming thread, tid %#lx.\n", presenter->thread.tid);
return S_OK; } @@ -737,7 +737,7 @@ static HRESULT video_presenter_end_streaming(struct video_presenter *presenter) WaitForSingleObject(presenter->thread.hthread, INFINITE); CloseHandle(presenter->thread.hthread);
- TRACE("Terminated streaming thread tid %#x.\n", presenter->thread.tid); + TRACE("Terminated streaming thread tid %#lx.\n", presenter->thread.tid);
memset(&presenter->thread, 0, sizeof(presenter->thread)); video_presenter_set_allocator_callback(presenter, NULL); @@ -816,7 +816,7 @@ static ULONG WINAPI video_presenter_inner_AddRef(IUnknown *iface) struct video_presenter *presenter = impl_from_IUnknown(iface); ULONG refcount = InterlockedIncrement(&presenter->refcount);
- TRACE("%p, refcount %u.\n", iface, refcount); + TRACE("%p, refcount %lu.\n", iface, refcount);
return refcount; } @@ -839,7 +839,7 @@ static ULONG WINAPI video_presenter_inner_Release(IUnknown *iface) struct video_presenter *presenter = impl_from_IUnknown(iface); ULONG refcount = InterlockedDecrement(&presenter->refcount);
- TRACE("%p, refcount %u.\n", iface, refcount); + TRACE("%p, refcount %lu.\n", iface, refcount);
if (!refcount) { @@ -952,7 +952,7 @@ static HRESULT WINAPI video_presenter_ProcessMessage(IMFVideoPresenter *iface, M struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface); HRESULT hr;
- TRACE("%p, %d, %lu.\n", iface, message, param); + TRACE("%p, %d, %Iu.\n", iface, message, param);
EnterCriticalSection(&presenter->cs);
@@ -1095,7 +1095,7 @@ static void video_presenter_set_mixer_rect(struct video_presenter *presenter) if (FAILED(hr = IMFAttributes_SetBlob(attributes, &VIDEO_ZOOM_RECT, (const UINT8 *)&presenter->src_rect, sizeof(presenter->src_rect)))) { - WARN("Failed to set zoom rectangle attribute, hr %#x.\n", hr); + WARN("Failed to set zoom rectangle attribute, hr %#lx.\n", hr); } IMFAttributes_Release(attributes); } @@ -1112,7 +1112,7 @@ static HRESULT video_presenter_attach_mixer(struct video_presenter *presenter, I if (FAILED(hr = IMFTopologyServiceLookup_LookupService(service_lookup, MF_SERVICE_LOOKUP_GLOBAL, 0, &MR_VIDEO_MIXER_SERVICE, &IID_IMFTransform, (void **)&presenter->mixer, &count))) { - WARN("Failed to get mixer interface, hr %#x.\n", hr); + WARN("Failed to get mixer interface, hr %#lx.\n", hr); return hr; }
@@ -1174,7 +1174,7 @@ static HRESULT WINAPI video_presenter_service_client_InitServicePointers(IMFTopo if (FAILED(hr = IMFTopologyServiceLookup_LookupService(service_lookup, MF_SERVICE_LOOKUP_GLOBAL, 0, &MR_VIDEO_RENDER_SERVICE, &IID_IMediaEventSink, (void **)&presenter->event_sink, &count))) { - WARN("Failed to get renderer event sink, hr %#x.\n", hr); + WARN("Failed to get renderer event sink, hr %#lx.\n", hr); } }
@@ -1350,7 +1350,7 @@ static HRESULT WINAPI video_presenter_control_SetAspectRatioMode(IMFVideoDisplay { struct video_presenter *presenter = impl_from_IMFVideoDisplayControl(iface);
- TRACE("%p, %#x.\n", iface, mode); + TRACE("%p, %#lx.\n", iface, mode);
if (mode & ~MFVideoARMode_Mask) return E_INVALIDARG; @@ -1468,7 +1468,7 @@ static HRESULT WINAPI video_presenter_control_GetCurrentImage(IMFVideoDisplayCon
static HRESULT WINAPI video_presenter_control_SetBorderColor(IMFVideoDisplayControl *iface, COLORREF color) { - FIXME("%p, %#x.\n", iface, color); + FIXME("%p, %#lx.\n", iface, color);
return E_NOTIMPL; } @@ -1482,7 +1482,7 @@ static HRESULT WINAPI video_presenter_control_GetBorderColor(IMFVideoDisplayCont
static HRESULT WINAPI video_presenter_control_SetRenderingPrefs(IMFVideoDisplayControl *iface, DWORD flags) { - FIXME("%p, %#x.\n", iface, flags); + FIXME("%p, %#lx.\n", iface, flags);
return E_NOTIMPL; } @@ -1654,7 +1654,7 @@ static ULONG WINAPI video_presenter_position_mapper_Release(IMFVideoPositionMapp static HRESULT WINAPI video_presenter_position_mapper_MapOutputCoordinateToInputStream(IMFVideoPositionMapper *iface, float x_out, float y_out, DWORD output_stream, DWORD input_stream, float *x_in, float *y_in) { - FIXME("%p, %f, %f, %u, %u, %p, %p.\n", iface, x_out, y_out, output_stream, input_stream, x_in, y_in); + FIXME("%p, %f, %f, %lu, %lu, %p, %p.\n", iface, x_out, y_out, output_stream, input_stream, x_in, y_in);
return E_NOTIMPL; } @@ -2028,14 +2028,14 @@ static HRESULT video_presenter_init_d3d(struct video_presenter *presenter)
if (FAILED(hr)) { - WARN("Failed to create d3d device, hr %#x.\n", hr); + WARN("Failed to create d3d device, hr %#lx.\n", hr); return hr; }
hr = IDirect3DDeviceManager9_ResetDevice(presenter->device_manager, device, presenter->reset_token); IDirect3DDevice9_Release(device); if (FAILED(hr)) - WARN("Failed to set new device for the manager, hr %#x.\n", hr); + WARN("Failed to set new device for the manager, hr %#lx.\n", hr);
if (SUCCEEDED(hr = MFCreateVideoSampleAllocator(&IID_IMFVideoSampleAllocator, (void **)&presenter->allocator))) { @@ -2080,7 +2080,7 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out)
if (FAILED(hr = video_presenter_init_d3d(object))) { - WARN("Failed to initialize d3d device, hr %#x.\n", hr); + WARN("Failed to initialize d3d device, hr %#lx.\n", hr); goto failed; }
diff --git a/dlls/evr/sample.c b/dlls/evr/sample.c index cbba384e181..1d29b6cdc2c 100644 --- a/dlls/evr/sample.c +++ b/dlls/evr/sample.c @@ -147,7 +147,7 @@ static ULONG WINAPI tracked_async_result_AddRef(IMFAsyncResult *iface) struct tracked_async_result *result = impl_from_IMFAsyncResult(iface); ULONG refcount = InterlockedIncrement(&result->refcount);
- TRACE("%p, %u.\n", iface, refcount); + TRACE("%p, refcount %lu.\n", iface, refcount);
return refcount; } @@ -157,7 +157,7 @@ static ULONG WINAPI tracked_async_result_Release(IMFAsyncResult *iface) struct tracked_async_result *result = impl_from_IMFAsyncResult(iface); ULONG refcount = InterlockedDecrement(&result->refcount);
- TRACE("%p, %u.\n", iface, refcount); + TRACE("%p, refcount %lu.\n", iface, refcount);
if (!refcount) { @@ -201,7 +201,7 @@ static HRESULT WINAPI tracked_async_result_SetStatus(IMFAsyncResult *iface, HRES { struct tracked_async_result *result = impl_from_IMFAsyncResult(iface);
- TRACE("%p, %#x.\n", iface, status); + TRACE("%p, %#lx.\n", iface, status);
result->result.hrStatusResult = status;
@@ -351,7 +351,7 @@ static void video_sample_create_tracking_thread(void) WaitForSingleObject(ready_event, INFINITE); CloseHandle(ready_event);
- TRACE("Create tracking thread %#x.\n", tracking_thread.tid); + TRACE("Create tracking thread %#lx.\n", tracking_thread.tid); }
LeaveCriticalSection(&tracking_thread_cs); @@ -450,7 +450,7 @@ static ULONG WINAPI sample_allocator_AddRef(IMFVideoSampleAllocator *iface) struct sample_allocator *allocator = impl_from_IMFVideoSampleAllocator(iface); ULONG refcount = InterlockedIncrement(&allocator->refcount);
- TRACE("%p, refcount %u.\n", iface, refcount); + TRACE("%p, refcount %lu.\n", iface, refcount);
return refcount; } @@ -478,7 +478,7 @@ static ULONG WINAPI sample_allocator_Release(IMFVideoSampleAllocator *iface) struct sample_allocator *allocator = impl_from_IMFVideoSampleAllocator(iface); ULONG refcount = InterlockedDecrement(&allocator->refcount);
- TRACE("%p, refcount %u.\n", iface, refcount); + TRACE("%p, refcount %lu.\n", iface, refcount);
if (!refcount) { @@ -575,7 +575,7 @@ static HRESULT sample_allocator_create_samples(struct sample_allocator *allocato
if (FAILED(hr)) { - WARN("Failed to get processor service, %#x.\n", hr); + WARN("Failed to get processor service, %#lx.\n", hr); return hr; } } @@ -638,7 +638,7 @@ static HRESULT WINAPI sample_allocator_InitializeSampleAllocator(IMFVideoSampleA struct sample_allocator *allocator = impl_from_IMFVideoSampleAllocator(iface); HRESULT hr;
- TRACE("%p, %u, %p.\n", iface, sample_count, media_type); + TRACE("%p, %lu, %p.\n", iface, sample_count, media_type);
if (!sample_count) sample_count = 1; @@ -912,7 +912,7 @@ static ULONG WINAPI video_sample_AddRef(IMFSample *iface) struct video_sample *sample = impl_from_IMFSample(iface); ULONG refcount = InterlockedIncrement(&sample->refcount);
- TRACE("%p, refcount %u.\n", iface, refcount); + TRACE("%p, refcount %lu.\n", iface, refcount);
return refcount; } @@ -934,7 +934,7 @@ static ULONG WINAPI video_sample_Release(IMFSample *iface)
refcount = InterlockedDecrement(&sample->refcount);
- TRACE("%p, refcount %u.\n", iface, refcount); + TRACE("%p, refcount %lu.\n", iface, refcount);
if (!refcount) { @@ -1232,7 +1232,7 @@ static HRESULT WINAPI video_sample_SetSampleFlags(IMFSample *iface, DWORD flags) { struct video_sample *sample = impl_from_IMFSample(iface);
- TRACE("%p, %#x.\n", iface, flags); + TRACE("%p, %#lx.\n", iface, flags);
return IMFSample_SetSampleFlags(sample->sample, flags); } @@ -1312,7 +1312,7 @@ static HRESULT WINAPI video_sample_GetBufferByIndex(IMFSample *iface, DWORD inde { struct video_sample *sample = impl_from_IMFSample(iface);
- TRACE("%p, %u, %p.\n", iface, index, buffer); + TRACE("%p, %lu, %p.\n", iface, index, buffer);
return IMFSample_GetBufferByIndex(sample->sample, index, buffer); } @@ -1337,7 +1337,7 @@ static HRESULT WINAPI video_sample_RemoveBufferByIndex(IMFSample *iface, DWORD i { struct video_sample *sample = impl_from_IMFSample(iface);
- TRACE("%p, %u.\n", iface, index); + TRACE("%p, %lu.\n", iface, index);
return IMFSample_RemoveBufferByIndex(sample->sample, index); } @@ -1585,7 +1585,7 @@ static ULONG WINAPI surface_buffer_AddRef(IMFMediaBuffer *iface) struct surface_buffer *buffer = impl_from_IMFMediaBuffer(iface); ULONG refcount = InterlockedIncrement(&buffer->refcount);
- TRACE("%p, refcount %u.\n", iface, refcount); + TRACE("%p, refcount %lu.\n", iface, refcount);
return refcount; } @@ -1595,7 +1595,7 @@ static ULONG WINAPI surface_buffer_Release(IMFMediaBuffer *iface) struct surface_buffer *buffer = impl_from_IMFMediaBuffer(iface); ULONG refcount = InterlockedDecrement(&buffer->refcount);
- TRACE("%p, refcount %u.\n", iface, refcount); + TRACE("%p, refcount %lu.\n", iface, refcount);
if (!refcount) {
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/presenter.c | 94 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 92 insertions(+), 2 deletions(-)
diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c index 910af2891e3..7e14cb2f720 100644 --- a/dlls/evr/presenter.c +++ b/dlls/evr/presenter.c @@ -65,6 +65,7 @@ struct sample_queue unsigned int used; unsigned int front; unsigned int back; + IMFSample *last_presented; };
struct streaming_thread @@ -120,6 +121,7 @@ struct video_presenter struct { int presented; + LONGLONG sampletime; } frame_stats;
CRITICAL_SECTION cs; @@ -507,6 +509,13 @@ static void video_presenter_sample_present(struct video_presenter *presenter, IM IDirect3DSwapChain9_Present(presenter->swapchain, NULL, NULL, NULL, NULL, 0); presenter->frame_stats.presented++;
+ EnterCriticalSection(&presenter->cs); + if (presenter->thread.queue.last_presented) + IMFSample_Release(presenter->thread.queue.last_presented); + presenter->thread.queue.last_presented = sample; + IMFSample_AddRef(presenter->thread.queue.last_presented); + LeaveCriticalSection(&presenter->cs); + IDirect3DDevice9_Release(device); IDirect3DSurface9_Release(backbuffer); IDirect3DSurface9_Release(surface); @@ -739,6 +748,8 @@ static HRESULT video_presenter_end_streaming(struct video_presenter *presenter)
TRACE("Terminated streaming thread tid %#lx.\n", presenter->thread.tid);
+ if (presenter->thread.queue.last_presented) + IMFSample_Release(presenter->thread.queue.last_presented); memset(&presenter->thread, 0, sizeof(presenter->thread)); video_presenter_set_allocator_callback(presenter, NULL);
@@ -1461,9 +1472,88 @@ static HRESULT WINAPI video_presenter_control_RepaintVideo(IMFVideoDisplayContro static HRESULT WINAPI video_presenter_control_GetCurrentImage(IMFVideoDisplayControl *iface, BITMAPINFOHEADER *header, BYTE **dib, DWORD *dib_size, LONGLONG *timestamp) { - FIXME("%p, %p, %p, %p, %p.\n", iface, header, dib, dib_size, timestamp); + struct video_presenter *presenter = impl_from_IMFVideoDisplayControl(iface); + IDirect3DSurface9 *readback = NULL, *surface; + D3DSURFACE_DESC surface_desc; + D3DLOCKED_RECT mapped_rect; + IDirect3DDevice9 *device; + IMFSample *sample; + LONG stride; + HRESULT hr;
- return E_NOTIMPL; + TRACE("%p, %p, %p, %p, %p.\n", iface, header, dib, dib_size, timestamp); + + EnterCriticalSection(&presenter->cs); + + sample = presenter->thread.queue.last_presented; + presenter->thread.queue.last_presented = NULL; + + if (!presenter->swapchain || !sample) + { + hr = MF_E_INVALIDREQUEST; + } + else if (SUCCEEDED(hr = video_presenter_get_sample_surface(sample, &surface))) + { + IDirect3DSwapChain9_GetDevice(presenter->swapchain, &device); + IDirect3DSurface9_GetDesc(surface, &surface_desc); + + if (surface_desc.Format != D3DFMT_X8R8G8B8) + { + FIXME("Unexpected surface format %d.\n", surface_desc.Format); + hr = E_FAIL; + } + + if (SUCCEEDED(hr)) + { + if (FAILED(hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, surface_desc.Width, + surface_desc.Height, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, &readback, NULL))) + { + WARN("Failed to create readback surface, hr %#lx.\n", hr); + } + } + + if (SUCCEEDED(hr)) + hr = IDirect3DDevice9_GetRenderTargetData(device, surface, readback); + + if (SUCCEEDED(hr)) + { + MFGetStrideForBitmapInfoHeader(D3DFMT_X8R8G8B8, surface_desc.Width, &stride); + *dib_size = abs(stride) * surface_desc.Height; + if (!(*dib = CoTaskMemAlloc(*dib_size))) + hr = E_OUTOFMEMORY; + } + + if (SUCCEEDED(hr)) + { + if (SUCCEEDED(hr = IDirect3DSurface9_LockRect(readback, &mapped_rect, NULL, D3DLOCK_READONLY))) + { + memcpy(*dib, mapped_rect.pBits, *dib_size); + IDirect3DSurface9_UnlockRect(readback); + } + } + + memset(header, 0, sizeof(*header)); + header->biSize = sizeof(*header); + header->biWidth = surface_desc.Width; + header->biHeight = surface_desc.Height; + header->biPlanes = 1; + header->biBitCount = 32; + header->biSizeImage = *dib_size; + IMFSample_GetSampleTime(sample, timestamp); + + if (readback) + IDirect3DSurface9_Release(readback); + IDirect3DSurface9_Release(surface); + + IDirect3DDevice9_Release(device); + } + + if (sample) + IMFSample_Release(sample); + + LeaveCriticalSection(&presenter->cs); + + return hr; }
static HRESULT WINAPI video_presenter_control_SetBorderColor(IMFVideoDisplayControl *iface, COLORREF color)