Signed-off-by: Derek Lesho dlesho@codeweavers.com --- v2: Add tests. --- dlls/mfplat/main.c | 26 ++++++++++++++++---------- dlls/mfplat/tests/mfplat.c | 8 ++++++++ 2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 85d676a0d6..853b5ab370 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -3296,15 +3296,6 @@ static HRESULT WINAPI mfbytestream_GetCurrentPosition(IMFByteStream *iface, QWOR return E_NOTIMPL; }
-static HRESULT WINAPI mfbytestream_SetCurrentPosition(IMFByteStream *iface, QWORD position) -{ - mfbytestream *This = impl_from_IMFByteStream(iface); - - FIXME("%p, %s\n", This, wine_dbgstr_longlong(position)); - - return E_NOTIMPL; -} - static HRESULT WINAPI bytestream_file_GetLength(IMFByteStream *iface, QWORD *length) { struct bytestream *stream = impl_from_IMFByteStream(iface); @@ -3318,6 +3309,21 @@ static HRESULT WINAPI bytestream_file_GetLength(IMFByteStream *iface, QWORD *len return S_OK; }
+static HRESULT WINAPI bytestream_file_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_file_IsEndOfStream(IMFByteStream *iface, BOOL *ret) { struct bytestream *stream = impl_from_IMFByteStream(iface); @@ -3449,7 +3455,7 @@ static const IMFByteStreamVtbl bytestream_file_vtbl = bytestream_file_GetLength, mfbytestream_SetLength, mfbytestream_GetCurrentPosition, - mfbytestream_SetCurrentPosition, + bytestream_file_SetCurrentPosition, bytestream_file_IsEndOfStream, bytestream_file_Read, bytestream_BeginRead, diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 81219adff4..c468286362 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -1525,6 +1525,7 @@ static void test_file_stream(void) WCHAR *filename; IUnknown *unk; QWORD bytestream_length; + BOOL eos; HRESULT hr; WCHAR *str;
@@ -1588,6 +1589,13 @@ static void test_file_stream(void) ok(hr == S_OK, "Failed to get bytestream length, hr %#x.\n", hr); ok(bytestream_length == 1554, "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 = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_NONE, filename, &bytestream2); ok(hr == S_OK, "got 0x%08x\n", hr);