[PATCH 2/4] mfplat: Simplify IMFByteStream async Read/Write methods
Andrew Eikum
wine at gitlab.winehq.org
Thu May 5 11:14:30 CDT 2022
From: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
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 e28dc677cdb..a87d388f511 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -4371,7 +4371,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;
@@ -4382,13 +4381,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);
@@ -4403,7 +4397,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;
@@ -4414,13 +4407,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);
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/40
More information about the wine-devel
mailing list