From 4bfd42bafff113d8cd7976fcb66516c3b2500d2f Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 3 Dec 2019 14:13:11 +0300 Subject: [PATCH] mfplat: Use underlying stream access mode for bytestream capabilities. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mfplat/main.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index e4ade7f202b..fc656678cad 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -2700,6 +2700,24 @@ static ULONG WINAPI bytestream_Release(IMFByteStream *iface) return refcount; } +static HRESULT WINAPI bytestream_stream_GetCapabilities(IMFByteStream *iface, DWORD *capabilities) +{ + struct bytestream *stream = impl_from_IMFByteStream(iface); + STATSTG stat; + HRESULT hr; + + TRACE("%p, %p.\n", iface, capabilities); + + if (FAILED(hr = IStream_Stat(stream->stream, &stat, STATFLAG_NONAME))) + return hr; + + *capabilities = MFBYTESTREAM_IS_READABLE | MFBYTESTREAM_IS_SEEKABLE; + if (stat.grfMode & (STGM_WRITE | STGM_READWRITE)) + *capabilities |= MFBYTESTREAM_IS_WRITABLE; + + return S_OK; +} + static HRESULT WINAPI bytestream_GetCapabilities(IMFByteStream *iface, DWORD *capabilities) { struct bytestream *stream = impl_from_IMFByteStream(iface); @@ -3060,7 +3078,7 @@ static const IMFByteStreamVtbl bytestream_stream_vtbl = bytestream_QueryInterface, bytestream_AddRef, bytestream_Release, - bytestream_GetCapabilities, + bytestream_stream_GetCapabilities, bytestream_stream_GetLength, bytestream_stream_SetLength, bytestream_stream_GetCurrentPosition, @@ -3252,7 +3270,6 @@ HRESULT WINAPI MFCreateMFByteStreamOnStream(IStream *stream, IMFByteStream **byt IStream_AddRef(object->stream); position.QuadPart = 0; IStream_Seek(object->stream, position, STREAM_SEEK_SET, NULL); - object->capabilities = MFBYTESTREAM_IS_READABLE | MFBYTESTREAM_IS_SEEKABLE; *bytestream = &object->IMFByteStream_iface;