Andrew Eikum : mfplat: Simplify IMFByteStream async Read/Write methods.

Alexandre Julliard julliard at winehq.org
Fri May 20 15:26:48 CDT 2022


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

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Thu May  5 10:33:14 2022 -0500

mfplat: Simplify IMFByteStream async Read/Write methods.

Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mfplat/main.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 9e6ff26b2f7..8cdf0d1c71f 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -4373,7 +4373,6 @@ static HRESULT WINAPI bytestream_stream_read_callback_Invoke(IRtwqAsyncCallback
 {
     struct bytestream *stream = impl_from_read_callback_IRtwqAsyncCallback(iface);
     struct async_stream_op *op;
-    LARGE_INTEGER position;
     IUnknown *object;
     HRESULT hr;
 
@@ -4384,13 +4383,8 @@ static HRESULT WINAPI bytestream_stream_read_callback_Invoke(IRtwqAsyncCallback
 
     EnterCriticalSection(&stream->cs);
 
-    position.QuadPart = op->position;
-    if (SUCCEEDED(hr = IStream_Seek(stream->stream, position, STREAM_SEEK_SET, NULL)))
-    {
-        if (SUCCEEDED(hr = IStream_Read(stream->stream, op->u.dest, op->requested_length, &op->actual_length)))
-            stream->position += op->actual_length;
-    }
-
+    hr = IMFByteStream_Read(&stream->IMFByteStream_iface, op->u.dest, op->requested_length, &op->actual_length);
+    if(FAILED(hr)) TRACE("Read failed: %#lx\n", hr);
     IMFAsyncResult_SetStatus(op->caller, hr);
     list_add_tail(&stream->pending, &op->entry);
 
@@ -4405,7 +4399,6 @@ static HRESULT WINAPI bytestream_stream_write_callback_Invoke(IRtwqAsyncCallback
 {
     struct bytestream *stream = impl_from_read_callback_IRtwqAsyncCallback(iface);
     struct async_stream_op *op;
-    LARGE_INTEGER position;
     IUnknown *object;
     HRESULT hr;
 
@@ -4416,13 +4409,8 @@ static HRESULT WINAPI bytestream_stream_write_callback_Invoke(IRtwqAsyncCallback
 
     EnterCriticalSection(&stream->cs);
 
-    position.QuadPart = op->position;
-    if (SUCCEEDED(hr = IStream_Seek(stream->stream, position, STREAM_SEEK_SET, NULL)))
-    {
-        if (SUCCEEDED(hr = IStream_Write(stream->stream, op->u.src, op->requested_length, &op->actual_length)))
-            stream->position += op->actual_length;
-    }
-
+    hr = IMFByteStream_Write(&stream->IMFByteStream_iface, op->u.src, op->requested_length, &op->actual_length);
+    if(FAILED(hr)) TRACE("Write failed: %#lx\n", hr);
     IMFAsyncResult_SetStatus(op->caller, hr);
     list_add_tail(&stream->pending, &op->entry);
 




More information about the wine-cvs mailing list