Zebediah Figura : winegstreamer: Manually track read offsets in the media source.
Alexandre Julliard
julliard at winehq.org
Fri Feb 19 17:20:07 CST 2021
Module: wine
Branch: master
Commit: 38330678a0e92db67ccf8ba4329e4449c2fa0681
URL: https://source.winehq.org/git/wine.git/?a=commit;h=38330678a0e92db67ccf8ba4329e4449c2fa0681
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Thu Feb 18 17:01:23 2021 -0600
winegstreamer: Manually track read offsets in the media source.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winegstreamer/media_source.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index a9a85cf4d4b..ffbf8041ed8 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -111,6 +111,8 @@ struct media_source
SOURCE_SHUTDOWN,
} state;
HANDLE no_more_pads_event;
+
+ uint64_t file_size, next_pull_offset;
};
static inline struct media_stream *impl_from_IMFMediaStream(IMFMediaStream *iface)
@@ -449,11 +451,12 @@ GstFlowReturn bytestream_wrapper_pull(GstPad *pad, GstObject *parent, guint64 of
TRACE("requesting %u bytes at %s from source %p into buffer %p\n", len, wine_dbgstr_longlong(ofs), source, *buf);
- if (ofs != GST_BUFFER_OFFSET_NONE)
- {
- if (FAILED(IMFByteStream_SetCurrentPosition(byte_stream, ofs)))
- return GST_FLOW_ERROR;
- }
+ if (ofs == GST_BUFFER_OFFSET_NONE)
+ ofs = source->next_pull_offset;
+ source->next_pull_offset = ofs + len;
+
+ if (FAILED(IMFByteStream_SetCurrentPosition(byte_stream, ofs)))
+ return GST_FLOW_ERROR;
if (FAILED(IMFByteStream_IsEndOfStream(byte_stream, &is_eof)))
return GST_FLOW_ERROR;
@@ -1244,6 +1247,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
struct media_source *object;
gint64 total_pres_time = 0;
DWORD bytestream_caps;
+ uint64_t file_size;
unsigned int i;
HRESULT hr;
int ret;
@@ -1257,6 +1261,12 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
return MF_E_BYTESTREAM_NOT_SEEKABLE;
}
+ if (FAILED(hr = IMFByteStream_GetLength(bytestream, &file_size)))
+ {
+ FIXME("Failed to get byte stream length, hr %#x.\n", hr);
+ return hr;
+ }
+
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
@@ -1266,6 +1276,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
object->byte_stream = bytestream;
IMFByteStream_AddRef(bytestream);
object->no_more_pads_event = CreateEventA(NULL, FALSE, FALSE, NULL);
+ object->file_size = file_size;
if (FAILED(hr = MFCreateEventQueue(&object->event_queue)))
goto fail;
More information about the wine-cvs
mailing list