Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gst_private.h | 2 ++ dlls/winegstreamer/gstdemux.c | 29 +---------------------------- dlls/winegstreamer/wg_parser.c | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 28 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 15c62fa29c5..08ff6ee21f0 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -221,6 +221,8 @@ struct unix_funcs 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); + + bool (CDECL *wg_parser_stream_get_event)(struct wg_parser_stream *stream, struct wg_parser_event *event); };
extern const struct unix_funcs *unix_funcs; diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 1f80a8fec8c..d4614ca5a65 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -686,33 +686,6 @@ static void send_buffer(struct parser_source *pin, GstBuffer *buf) gst_buffer_unref(buf); }
-static bool get_stream_event(struct parser_source *pin, struct wg_parser_event *event) -{ - struct parser *filter = impl_from_strmbase_filter(pin->pin.pin.filter); - struct wg_parser_stream *stream = pin->wg_stream; - struct wg_parser *parser = filter->wg_parser; - - pthread_mutex_lock(&parser->mutex); - - while (!parser->flushing && stream->event.type == WG_PARSER_EVENT_NONE) - pthread_cond_wait(&stream->event_cond, &parser->mutex); - - if (parser->flushing) - { - pthread_mutex_unlock(&parser->mutex); - TRACE("Filter is flushing.\n"); - return false; - } - - *event = stream->event; - stream->event.type = WG_PARSER_EVENT_NONE; - - pthread_mutex_unlock(&parser->mutex); - pthread_cond_signal(&stream->event_empty_cond); - - return true; -} - static DWORD CALLBACK stream_thread(void *arg) { struct parser_source *pin = arg; @@ -726,7 +699,7 @@ static DWORD CALLBACK stream_thread(void *arg)
EnterCriticalSection(&pin->flushing_cs);
- if (!get_stream_event(pin, &event)) + if (!unix_funcs->wg_parser_stream_get_event(pin->wg_stream, &event)) { LeaveCriticalSection(&pin->flushing_cs); continue; diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 107dfdd1a7f..b3f8eff43ad 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -344,6 +344,31 @@ static void CDECL wg_parser_stream_disable(struct wg_parser_stream *stream) stream->enabled = false; }
+static bool CDECL wg_parser_stream_get_event(struct wg_parser_stream *stream, struct wg_parser_event *event) +{ + struct wg_parser *parser = stream->parser; + + pthread_mutex_lock(&parser->mutex); + + while (!parser->flushing && stream->event.type == WG_PARSER_EVENT_NONE) + pthread_cond_wait(&stream->event_cond, &parser->mutex); + + if (parser->flushing) + { + pthread_mutex_unlock(&parser->mutex); + TRACE("Filter is flushing.\n"); + return false; + } + + *event = stream->event; + stream->event.type = WG_PARSER_EVENT_NONE; + + pthread_mutex_unlock(&parser->mutex); + pthread_cond_signal(&stream->event_empty_cond); + + return true; +} + static GstAutoplugSelectResult autoplug_blacklist(GstElement *bin, GstPad *pad, GstCaps *caps, GstElementFactory *fact, gpointer user) { const char *name = gst_element_factory_get_longname(fact); @@ -1501,6 +1526,8 @@ static const struct unix_funcs funcs = wg_parser_stream_get_preferred_format, wg_parser_stream_enable, wg_parser_stream_disable, + + wg_parser_stream_get_event, };
NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out)