Nikolay Sivov : mfplat: Use existing helper for BeginWrite() too.

Alexandre Julliard julliard at winehq.org
Mon Mar 25 16:54:57 CDT 2019


Module: wine
Branch: master
Commit: 493b375f0064e7f06d2cf6e17223791118a421ee
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=493b375f0064e7f06d2cf6e17223791118a421ee

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Mar 25 10:43:02 2019 +0300

mfplat: Use existing helper for BeginWrite() too.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mfplat/main.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 385eb25..57bed4a 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -2339,33 +2339,10 @@ static HRESULT WINAPI bytestream_BeginWrite(IMFByteStream *iface, const BYTE *da
         IMFAsyncCallback *callback, IUnknown *state)
 {
     struct bytestream *stream = impl_from_IMFByteStream(iface);
-    struct async_stream_op *op;
-    IMFAsyncResult *request;
-    HRESULT hr;
 
     TRACE("%p, %p, %u, %p, %p.\n", iface, data, size, callback, state);
 
-    op = heap_alloc(sizeof(*op));
-    if (!op)
-        return E_OUTOFMEMORY;
-
-    op->IUnknown_iface.lpVtbl = &async_stream_op_vtbl;
-    op->refcount = 1;
-    op->u.src = data;
-    op->requested_length = size;
-    op->type = ASYNC_STREAM_OP_WRITE;
-    if (FAILED(hr = MFCreateAsyncResult((IUnknown *)iface, callback, state, &op->caller)))
-        goto failed;
-
-    if (FAILED(hr = MFCreateAsyncResult(&op->IUnknown_iface, &stream->write_callback, NULL, &request)))
-        goto failed;
-
-    MFPutWorkItemEx(MFASYNC_CALLBACK_QUEUE_STANDARD, request);
-    IMFAsyncResult_Release(request);
-
-failed:
-    IUnknown_Release(&op->IUnknown_iface);
-    return hr;
+    return bytestream_create_io_request(stream, ASYNC_STREAM_OP_WRITE, data, size, callback, state);
 }
 
 static HRESULT WINAPI bytestream_EndWrite(IMFByteStream *iface, IMFAsyncResult *result, ULONG *written)




More information about the wine-cvs mailing list