Zebediah Figura : winegstreamer: Move seeking to the Unix library.

Alexandre Julliard julliard at winehq.org
Wed Feb 17 16:23:32 CST 2021


Module: wine
Branch: master
Commit: ccc6c98075761e8d8876c3d0e30215e98bb22024
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ccc6c98075761e8d8876c3d0e30215e98bb22024

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue Feb 16 19:28:26 2021 -0600

winegstreamer: Move seeking to the Unix library.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winegstreamer/gst_private.h |  4 ++++
 dlls/winegstreamer/gstdemux.c    | 31 ++++++-------------------------
 dlls/winegstreamer/wg_parser.c   | 24 ++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index 3c6d1147477..c77c5c14665 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -228,6 +228,10 @@ struct unix_funcs
     bool (CDECL *wg_parser_stream_get_event)(struct wg_parser_stream *stream, struct wg_parser_event *event);
     void (CDECL *wg_parser_stream_notify_qos)(struct wg_parser_stream *stream,
             bool underflow, double proportion, int64_t diff, uint64_t timestamp);
+
+    /* start_pos and stop_pos are in 100-nanosecond units. */
+    bool (CDECL *wg_parser_stream_seek)(struct wg_parser_stream *stream, double rate,
+            uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags);
 };
 
 extern const struct unix_funcs *unix_funcs;
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index da294c31e01..1af34441984 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -848,7 +848,7 @@ static HRESULT parser_init_stream(struct strmbase_filter *iface)
 {
     struct parser *filter = impl_from_strmbase_filter(iface);
     struct wg_parser *parser = filter->wg_parser;
-    GstSeekType stop_type = GST_SEEK_TYPE_NONE;
+    DWORD stop_flags = AM_SEEKING_NoPositioning;
     const SourceSeeking *seeking;
     unsigned int i;
 
@@ -861,15 +861,11 @@ static HRESULT parser_init_stream(struct strmbase_filter *iface)
     /* DirectShow retains the old seek positions, but resets to them every time
      * it transitions from stopped -> paused. */
 
-    parser->next_offset = parser->start_offset;
-
     seeking = &filter->sources[0]->seek;
     if (seeking->llStop && seeking->llStop != seeking->llDuration)
-        stop_type = GST_SEEK_TYPE_SET;
-    gst_pad_push_event(filter->sources[0]->wg_stream->my_sink, gst_event_new_seek(
-            seeking->dRate, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
-            GST_SEEK_TYPE_SET, seeking->llCurrent * 100,
-            stop_type, seeking->llStop * 100));
+        stop_flags = AM_SEEKING_AbsolutePositioning;
+    unix_funcs->wg_parser_stream_seek(filter->sources[0]->wg_stream, seeking->dRate,
+            seeking->llCurrent, seeking->llStop, AM_SEEKING_AbsolutePositioning, stop_flags);
 
     for (i = 0; i < filter->source_count; ++i)
     {
@@ -1212,11 +1208,8 @@ static ULONG WINAPI GST_Seeking_Release(IMediaSeeking *iface)
 static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface,
         LONGLONG *current, DWORD current_flags, LONGLONG *stop, DWORD stop_flags)
 {
-    GstSeekType current_type = GST_SEEK_TYPE_SET, stop_type = GST_SEEK_TYPE_SET;
     struct parser_source *pin = impl_from_IMediaSeeking(iface);
-    struct wg_parser_stream *stream = pin->wg_stream;
     struct parser *filter = impl_from_strmbase_filter(pin->pin.pin.filter);
-    GstSeekFlags flags = 0;
     HRESULT hr = S_OK;
     int i;
 
@@ -1256,20 +1249,8 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface,
 
     SourceSeekingImpl_SetPositions(iface, current, current_flags, stop, stop_flags);
 
-    if (current_flags & AM_SEEKING_SeekToKeyFrame)
-        flags |= GST_SEEK_FLAG_KEY_UNIT;
-    if (current_flags & AM_SEEKING_Segment)
-        flags |= GST_SEEK_FLAG_SEGMENT;
-    if (!(current_flags & AM_SEEKING_NoFlush))
-        flags |= GST_SEEK_FLAG_FLUSH;
-
-    if ((current_flags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
-        current_type = GST_SEEK_TYPE_NONE;
-    if ((stop_flags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
-        stop_type = GST_SEEK_TYPE_NONE;
-
-    if (!gst_pad_push_event(stream->my_sink, gst_event_new_seek(pin->seek.dRate, GST_FORMAT_TIME, flags,
-            current_type, pin->seek.llCurrent * 100, stop_type, pin->seek.llStop * 100)))
+    if (!unix_funcs->wg_parser_stream_seek(pin->wg_stream, pin->seek.dRate,
+            pin->seek.llCurrent, pin->seek.llStop, current_flags, stop_flags))
     {
         ERR("Failed to seek (current %s, stop %s).\n",
                 debugstr_time(pin->seek.llCurrent), debugstr_time(pin->seek.llStop));
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index 79fa45eadca..0738df150b2 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -391,6 +391,28 @@ static bool CDECL wg_parser_stream_get_event(struct wg_parser_stream *stream, st
     return true;
 }
 
+static bool CDECL wg_parser_stream_seek(struct wg_parser_stream *stream, double rate,
+        uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags)
+{
+    GstSeekType start_type = GST_SEEK_TYPE_SET, stop_type = GST_SEEK_TYPE_SET;
+    GstSeekFlags flags = 0;
+
+    if (start_flags & AM_SEEKING_SeekToKeyFrame)
+        flags |= GST_SEEK_FLAG_KEY_UNIT;
+    if (start_flags & AM_SEEKING_Segment)
+        flags |= GST_SEEK_FLAG_SEGMENT;
+    if (!(start_flags & AM_SEEKING_NoFlush))
+        flags |= GST_SEEK_FLAG_FLUSH;
+
+    if ((start_flags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
+        start_type = GST_SEEK_TYPE_NONE;
+    if ((stop_flags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
+        stop_type = GST_SEEK_TYPE_NONE;
+
+    return gst_pad_push_event(stream->my_sink, gst_event_new_seek(rate,
+            GST_FORMAT_TIME, flags, start_type, start_pos * 100, stop_type, stop_pos * 100));
+}
+
 static void CDECL wg_parser_stream_notify_qos(struct wg_parser_stream *stream,
         bool underflow, double proportion, int64_t diff, uint64_t timestamp)
 {
@@ -1565,6 +1587,8 @@ static const struct unix_funcs funcs =
 
     wg_parser_stream_get_event,
     wg_parser_stream_notify_qos,
+
+    wg_parser_stream_seek,
 };
 
 NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out)




More information about the wine-cvs mailing list