winegstreamer: Move get_stream_event() to the Unix library.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
563ccc4df5
commit
aa695e2125
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue