Zebediah Figura : winegstreamer: Retrieve wg_parser streams through Unix library functions.

Alexandre Julliard julliard at winehq.org
Mon Feb 15 16:09:49 CST 2021


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sat Feb 13 11:33:06 2021 -0600

winegstreamer: Retrieve wg_parser streams 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 |  3 +++
 dlls/winegstreamer/gstdemux.c    | 18 ++++++++++--------
 dlls/winegstreamer/wg_parser.c   | 13 +++++++++++++
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index 0ddd9ea1da8..0a37e10c840 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -214,6 +214,9 @@ struct unix_funcs
 
     HRESULT (CDECL *wg_parser_connect)(struct wg_parser *parser, uint64_t file_size);
     void (CDECL *wg_parser_disconnect)(struct wg_parser *parser);
+
+    uint32_t (CDECL *wg_parser_get_stream_count)(struct wg_parser *parser);
+    struct wg_parser_stream *(CDECL *wg_parser_get_stream)(struct wg_parser *parser, uint32_t index);
 };
 
 extern const struct unix_funcs *unix_funcs;
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index 2093608c443..be1c59453d5 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -1039,13 +1039,14 @@ static BOOL decodebin_parser_filter_init_gst(struct parser *filter)
 {
     static const WCHAR formatW[] = {'S','t','r','e','a','m',' ','%','0','2','u',0};
     struct wg_parser *parser = filter->wg_parser;
+    unsigned int i, stream_count;
     WCHAR source_name[20];
-    unsigned int i;
 
-    for (i = 0; i < parser->stream_count; ++i)
+    stream_count = unix_funcs->wg_parser_get_stream_count(parser);
+    for (i = 0; i < stream_count; ++i)
     {
         sprintfW(source_name, formatW, i);
-        if (!create_pin(filter, parser->streams[i], source_name))
+        if (!create_pin(filter, unix_funcs->wg_parser_get_stream(parser, i), source_name))
             return FALSE;
     }
 
@@ -1664,7 +1665,7 @@ static BOOL wave_parser_filter_init_gst(struct parser *filter)
     static const WCHAR source_name[] = {'o','u','t','p','u','t',0};
     struct wg_parser *parser = filter->wg_parser;
 
-    if (!create_pin(filter, parser->streams[0], source_name))
+    if (!create_pin(filter, unix_funcs->wg_parser_get_stream(parser, 0), source_name))
         return FALSE;
 
     return TRUE;
@@ -1744,13 +1745,14 @@ static BOOL avi_splitter_filter_init_gst(struct parser *filter)
 {
     static const WCHAR formatW[] = {'S','t','r','e','a','m',' ','%','0','2','u',0};
     struct wg_parser *parser = filter->wg_parser;
+    uint32_t i, stream_count;
     WCHAR source_name[20];
-    unsigned int i;
 
-    for (i = 0; i < parser->stream_count; ++i)
+    stream_count = unix_funcs->wg_parser_get_stream_count(parser);
+    for (i = 0; i < stream_count; ++i)
     {
         sprintfW(source_name, formatW, i);
-        if (!create_pin(filter, parser->streams[i], source_name))
+        if (!create_pin(filter, unix_funcs->wg_parser_get_stream(parser, i), source_name))
             return FALSE;
     }
 
@@ -1837,7 +1839,7 @@ static BOOL mpeg_splitter_filter_init_gst(struct parser *filter)
     static const WCHAR source_name[] = {'A','u','d','i','o',0};
     struct wg_parser *parser = filter->wg_parser;
 
-    if (!create_pin(filter, parser->streams[0], source_name))
+    if (!create_pin(filter, unix_funcs->wg_parser_get_stream(parser, 0), source_name))
         return FALSE;
 
     return TRUE;
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index 31b5a67032a..8468bde4894 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -317,6 +317,16 @@ static bool wg_format_compare(const struct wg_format *a, const struct wg_format
     return false;
 }
 
+static uint32_t CDECL wg_parser_get_stream_count(struct wg_parser *parser)
+{
+    return parser->stream_count;
+}
+
+static struct wg_parser_stream * CDECL wg_parser_get_stream(struct wg_parser *parser, uint32_t index)
+{
+    return parser->streams[index];
+}
+
 static GstAutoplugSelectResult autoplug_blacklist(GstElement *bin, GstPad *pad, GstCaps *caps, GstElementFactory *fact, gpointer user)
 {
     const char *name = gst_element_factory_get_longname(fact);
@@ -1467,6 +1477,9 @@ static const struct unix_funcs funcs =
 
     wg_parser_connect,
     wg_parser_disconnect,
+
+    wg_parser_get_stream_count,
+    wg_parser_get_stream,
 };
 
 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