From: Derek Lesho dlesho@codeweavers.com
Signed-off-by: Derek Lesho dlesho@codeweavers.com Signed-off-by: Nikolay Sivov nsivov@codeweavers.com ---
v2: fixed messed up implementation diff
dlls/mfplat/main.c | 50 ++++++++++++++++++-------------------- dlls/mfplat/tests/mfplat.c | 20 ++++++++++++++- 2 files changed, 42 insertions(+), 28 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 1ebd443131..ef0db5a276 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -3287,22 +3287,18 @@ static HRESULT WINAPI mfbytestream_SetLength(IMFByteStream *iface, QWORD length) return E_NOTIMPL; }
-static HRESULT WINAPI mfbytestream_GetCurrentPosition(IMFByteStream *iface, QWORD *position) +static HRESULT WINAPI bytestream_file_GetCurrentPosition(IMFByteStream *iface, QWORD *position) { - mfbytestream *This = impl_from_IMFByteStream(iface); - - FIXME("%p, %p\n", This, position); + struct bytestream *stream = impl_from_IMFByteStream(iface);
- return E_NOTIMPL; -} + TRACE("%p, %p.\n", iface, position);
-static HRESULT WINAPI mfbytestream_SetCurrentPosition(IMFByteStream *iface, QWORD position) -{ - mfbytestream *This = impl_from_IMFByteStream(iface); + if (!position) + return E_INVALIDARG;
- FIXME("%p, %s\n", This, wine_dbgstr_longlong(position)); + *position = stream->position;
- return E_NOTIMPL; + return S_OK; }
static HRESULT WINAPI bytestream_file_GetLength(IMFByteStream *iface, QWORD *length) @@ -3445,6 +3441,19 @@ static HRESULT WINAPI mfbytestream_Close(IMFByteStream *iface) return E_NOTIMPL; }
+static HRESULT WINAPI bytestream_SetCurrentPosition(IMFByteStream *iface, QWORD position) +{ + struct bytestream *stream = impl_from_IMFByteStream(iface); + + TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(position)); + + EnterCriticalSection(&stream->cs); + stream->position = position; + LeaveCriticalSection(&stream->cs); + + return S_OK; +} + static const IMFByteStreamVtbl bytestream_file_vtbl = { bytestream_QueryInterface, @@ -3453,8 +3462,8 @@ static const IMFByteStreamVtbl bytestream_file_vtbl = bytestream_GetCapabilities, bytestream_file_GetLength, mfbytestream_SetLength, - mfbytestream_GetCurrentPosition, - mfbytestream_SetCurrentPosition, + bytestream_file_GetCurrentPosition, + bytestream_SetCurrentPosition, bytestream_file_IsEndOfStream, bytestream_file_Read, bytestream_BeginRead, @@ -3512,19 +3521,6 @@ static HRESULT WINAPI bytestream_stream_GetCurrentPosition(IMFByteStream *iface, return S_OK; }
-static HRESULT WINAPI bytestream_stream_SetCurrentPosition(IMFByteStream *iface, QWORD position) -{ - struct bytestream *stream = impl_from_IMFByteStream(iface); - - TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(position)); - - EnterCriticalSection(&stream->cs); - stream->position = position; - LeaveCriticalSection(&stream->cs); - - return S_OK; -} - static HRESULT WINAPI bytestream_stream_IsEndOfStream(IMFByteStream *iface, BOOL *ret) { struct bytestream *stream = impl_from_IMFByteStream(iface); @@ -3642,7 +3638,7 @@ static const IMFByteStreamVtbl bytestream_stream_vtbl = bytestream_stream_GetLength, bytestream_stream_SetLength, bytestream_stream_GetCurrentPosition, - bytestream_stream_SetCurrentPosition, + bytestream_SetCurrentPosition, bytestream_stream_IsEndOfStream, bytestream_stream_Read, bytestream_BeginRead, diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 7ec0b01982..67123d0b69 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -1340,15 +1340,16 @@ static void test_MFCreateMFByteStreamOnStream(void) static void test_file_stream(void) { IMFByteStream *bytestream, *bytestream2; + QWORD bytestream_length, position; IMFAttributes *attributes = NULL; MF_ATTRIBUTE_TYPE item_type; - QWORD bytestream_length; WCHAR pathW[MAX_PATH]; DWORD caps, count; WCHAR *filename; IUnknown *unk; HRESULT hr; WCHAR *str; + BOOL eos;
static const WCHAR newfilename[] = {'n','e','w','.','m','p','4',0};
@@ -1415,6 +1416,23 @@ static void test_file_stream(void) ok(hr == S_OK, "Failed to get bytestream length, hr %#x.\n", hr); ok(bytestream_length > 0, "Unexpected bytestream length %s.\n", wine_dbgstr_longlong(bytestream_length));
+ hr = IMFByteStream_SetCurrentPosition(bytestream, bytestream_length); + ok(hr == S_OK, "Failed to set bytestream position, hr %#x.\n", hr); + + hr = IMFByteStream_IsEndOfStream(bytestream, &eos); + ok(hr == S_OK, "Failed query end of stream, hr %#x.\n", hr); + ok(eos == TRUE, "Unexpected IsEndOfStream result, %u.\n", eos); + + hr = IMFByteStream_SetCurrentPosition(bytestream, 2 * bytestream_length); + ok(hr == S_OK, "Failed to set bytestream position, hr %#x.\n", hr); + + hr = IMFByteStream_GetCurrentPosition(bytestream, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = IMFByteStream_GetCurrentPosition(bytestream, &position); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(position == 2 * bytestream_length, "Unexpected position.\n"); + hr = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_NONE, filename, &bytestream2); ok(hr == S_OK, "got 0x%08x\n", hr);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=64989
Your paranoid android.
=== wxppro (32 bit report) ===
=== w8adm (32 bit report) ===