Zebediah Figura : winegstreamer: Set the stream's current format and connected state through Unix library functions.

Alexandre Julliard julliard at winehq.org
Tue Feb 16 16:03:18 CST 2021


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Feb 15 17:01:51 2021 -0600

winegstreamer: Set the stream's current format and connected state through Unix library functions.

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

---

 dlls/winegstreamer/gst_private.h |  2 ++
 dlls/winegstreamer/gstdemux.c    |  9 ++++-----
 dlls/winegstreamer/wg_parser.c   | 14 ++++++++++++++
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index d95f58dc607..15c62fa29c5 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -219,6 +219,8 @@ struct unix_funcs
     struct wg_parser_stream *(CDECL *wg_parser_get_stream)(struct wg_parser *parser, uint32_t index);
 
     void (CDECL *wg_parser_stream_get_preferred_format)(struct wg_parser_stream *stream, struct wg_format *format);
+    void (CDECL *wg_parser_stream_enable)(struct wg_parser_stream *stream, const struct wg_format *format);
+    void (CDECL *wg_parser_stream_disable)(struct wg_parser_stream *stream);
 };
 
 extern const struct unix_funcs *unix_funcs;
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index 95e55a55f22..1f80a8fec8c 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -1507,6 +1507,7 @@ static HRESULT WINAPI GSTOutPin_DecideBufferSize(struct strmbase_source *iface,
     struct wg_parser_stream *stream = pin->wg_stream;
     unsigned int buffer_size = 16384;
     ALLOCATOR_PROPERTIES ret_props;
+    struct wg_format format;
     bool ret;
 
     if (IsEqualGUID(&pin->pin.pin.mt.formattype, &FORMAT_VideoInfo))
@@ -1526,11 +1527,10 @@ static HRESULT WINAPI GSTOutPin_DecideBufferSize(struct strmbase_source *iface,
         buffer_size = format->nAvgBytesPerSec;
     }
 
-    ret = amt_to_wg_format(&pin->pin.pin.mt, &stream->current_format);
+    ret = amt_to_wg_format(&pin->pin.pin.mt, &format);
     assert(ret);
-    stream->enabled = true;
+    unix_funcs->wg_parser_stream_enable(pin->wg_stream, &format);
 
-    gst_pad_push_event(stream->my_sink, gst_event_new_reconfigure());
     /* We do need to drop any buffers that might have been sent with the old
      * caps, but this will be handled in parser_init_stream(). */
 
@@ -1543,9 +1543,8 @@ static HRESULT WINAPI GSTOutPin_DecideBufferSize(struct strmbase_source *iface,
 static void source_disconnect(struct strmbase_source *iface)
 {
     struct parser_source *pin = impl_source_from_IPin(&iface->pin.IPin_iface);
-    struct wg_parser_stream *stream = pin->wg_stream;
 
-    stream->enabled = false;
+    unix_funcs->wg_parser_stream_disable(pin->wg_stream);
 }
 
 static void free_source_pin(struct parser_source *pin)
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index 208abc59a9b..107dfdd1a7f 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -332,6 +332,18 @@ static void CDECL wg_parser_stream_get_preferred_format(struct wg_parser_stream
     *format = stream->preferred_format;
 }
 
+static void CDECL wg_parser_stream_enable(struct wg_parser_stream *stream, const struct wg_format *format)
+{
+    stream->current_format = *format;
+    stream->enabled = true;
+    gst_pad_push_event(stream->my_sink, gst_event_new_reconfigure());
+}
+
+static void CDECL wg_parser_stream_disable(struct wg_parser_stream *stream)
+{
+    stream->enabled = false;
+}
+
 static GstAutoplugSelectResult autoplug_blacklist(GstElement *bin, GstPad *pad, GstCaps *caps, GstElementFactory *fact, gpointer user)
 {
     const char *name = gst_element_factory_get_longname(fact);
@@ -1487,6 +1499,8 @@ static const struct unix_funcs funcs =
     wg_parser_get_stream,
 
     wg_parser_stream_get_preferred_format,
+    wg_parser_stream_enable,
+    wg_parser_stream_disable,
 };
 
 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