From cdecf17dd0de27171312408320fb3685a6e22665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com> Date: Wed, 28 Jun 2023 09:50:27 +0200 Subject: [PATCH] winegstreamer: Simplify media source creation flags handling. --- dlls/winegstreamer/media_source.c | 40 ++++++++++++------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index a5423411096..0fb41c0e8db 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -1780,7 +1780,6 @@ struct create_object_context IMFByteStream *stream; WCHAR *url; - DWORD flags; }; static struct create_object_context *impl_from_IUnknown(IUnknown *iface) @@ -1853,6 +1852,9 @@ static HRESULT WINAPI stream_handler_BeginCreateObject(IMFByteStreamHandler *ifa if (!stream) return E_INVALIDARG; + if (flags != MF_RESOLUTION_MEDIASOURCE) + FIXME("Unimplemented flags %#lx\n", flags); + if (FAILED(hr = MFCreateAsyncResult(NULL, callback, state, &caller))) return hr; @@ -1864,7 +1866,6 @@ static HRESULT WINAPI stream_handler_BeginCreateObject(IMFByteStreamHandler *ifa context->IUnknown_iface.lpVtbl = &create_object_context_vtbl; context->refcount = 1; - context->flags = flags; context->stream = stream; IMFByteStream_AddRef(context->stream); if (url) @@ -1978,37 +1979,27 @@ static HRESULT WINAPI stream_handler_callback_GetParameters(IMFAsyncCallback *if return E_NOTIMPL; } -static HRESULT stream_handler_create_object(struct stream_handler *handler, WCHAR *url, IMFByteStream *stream, DWORD flags, - IUnknown **out_object, MF_OBJECT_TYPE *out_obj_type) +static HRESULT stream_handler_create_object(struct stream_handler *handler, WCHAR *url, IMFByteStream *stream, + IUnknown **out_object) { - TRACE("%p, %s, %p, %#lx, %p, %p.\n", handler, debugstr_w(url), stream, flags, out_object, out_obj_type); + HRESULT hr; + struct media_source *new_source; - if (flags & MF_RESOLUTION_MEDIASOURCE) - { - HRESULT hr; - struct media_source *new_source; + TRACE("%p, %s, %p, %p.\n", handler, debugstr_w(url), stream, out_object); - if (FAILED(hr = media_source_constructor(stream, &new_source))) - return hr; + if (FAILED(hr = media_source_constructor(stream, &new_source))) + return hr; - TRACE("->(%p)\n", new_source); + TRACE("->(%p)\n", new_source); - *out_object = (IUnknown*)&new_source->IMFMediaSource_iface; - *out_obj_type = MF_OBJECT_MEDIASOURCE; + *out_object = (IUnknown*)&new_source->IMFMediaSource_iface; - return S_OK; - } - else - { - FIXME("Unhandled flags %#lx.\n", flags); - return E_NOTIMPL; - } + return S_OK; } static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IMFAsyncResult *result) { struct stream_handler *handler = impl_from_IMFAsyncCallback(iface); - MF_OBJECT_TYPE obj_type = MF_OBJECT_INVALID; IUnknown *object = NULL, *context_object; struct create_object_context *context; struct result_entry *entry; @@ -2025,12 +2016,11 @@ static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IM context = impl_from_IUnknown(context_object); - if (FAILED(hr = stream_handler_create_object(handler, context->url, context->stream, - context->flags, &object, &obj_type))) + if (FAILED(hr = stream_handler_create_object(handler, context->url, context->stream, &object))) WARN("Failed to create object, hr %#lx\n", hr); else { - if (FAILED(hr = result_entry_create(caller, obj_type, object, &entry))) + if (FAILED(hr = result_entry_create(caller, MF_OBJECT_MEDIASOURCE, object, &entry))) WARN("Failed to create handler result, hr %#lx\n", hr); else { -- 2.24.1