Commit 97555dff authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

winegstreamer: Add push_event wrapper.

parent aa15f41d
......@@ -39,6 +39,7 @@ extern GstElement *find_element(GstElementFactoryListType type, GstCaps *src_cap
extern bool append_element(GstElement *container, GstElement *element, GstElement **first, GstElement **last) DECLSPEC_HIDDEN;
extern bool link_src_to_element(GstPad *src_pad, GstElement *element) DECLSPEC_HIDDEN;
extern bool link_element_to_sink(GstElement *element, GstPad *sink_pad) DECLSPEC_HIDDEN;
extern bool push_event(GstPad *pad, GstEvent *event) DECLSPEC_HIDDEN;
/* wg_format.c */
......
......@@ -202,6 +202,20 @@ bool link_element_to_sink(GstElement *element, GstPad *sink_pad)
return !ret;
}
bool push_event(GstPad *pad, GstEvent *event)
{
if (!gst_pad_push_event(pad, event))
{
const gchar *type_name = gst_event_type_get_name(GST_EVENT_TYPE(event));
gchar *pad_name = gst_pad_get_name(pad);
GST_ERROR("Failed to push %s event %p to pad %s.", type_name, event, pad_name);
g_free(pad_name);
return false;
}
return true;
}
NTSTATUS wg_init_gstreamer(void *arg)
{
char arg0[] = "wine";
......
......@@ -258,7 +258,7 @@ static NTSTATUS wg_parser_stream_enable(void *args)
gst_util_set_object_arg(G_OBJECT(stream->flip), "method", flip ? "vertical-flip" : "none");
}
gst_pad_push_event(stream->my_sink, gst_event_new_reconfigure());
push_event(stream->my_sink, gst_event_new_reconfigure());
return S_OK;
}
......@@ -450,7 +450,7 @@ static NTSTATUS wg_parser_stream_seek(void *args)
if ((stop_flags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
stop_type = GST_SEEK_TYPE_NONE;
if (!gst_pad_push_event(get_stream(params->stream)->my_sink, gst_event_new_seek(params->rate, GST_FORMAT_TIME,
if (!push_event(get_stream(params->stream)->my_sink, gst_event_new_seek(params->rate, GST_FORMAT_TIME,
flags, start_type, params->start_pos * 100, stop_type, params->stop_pos * 100)))
GST_ERROR("Failed to seek.\n");
......@@ -480,7 +480,7 @@ static NTSTATUS wg_parser_stream_notify_qos(void *args)
if (!(event = gst_event_new_qos(params->underflow ? GST_QOS_TYPE_UNDERFLOW : GST_QOS_TYPE_OVERFLOW,
params->proportion, params->diff * 100, stream_time)))
GST_ERROR("Failed to create QOS event.\n");
gst_pad_push_event(stream->my_sink, event);
push_event(stream->my_sink, event);
return S_OK;
}
......@@ -1292,7 +1292,7 @@ static void *push_data(void *arg)
gst_buffer_unref(buffer);
gst_pad_push_event(parser->my_src, gst_event_new_eos());
push_event(parser->my_src, gst_event_new_eos());
GST_DEBUG("Stopping push thread.");
......@@ -1421,7 +1421,7 @@ static gboolean src_perform_seek(struct wg_parser *parser, GstEvent *event)
{
flush_event = gst_event_new_flush_start();
gst_event_set_seqnum(flush_event, seqnum);
gst_pad_push_event(parser->my_src, flush_event);
push_event(parser->my_src, flush_event);
if (thread)
gst_pad_set_active(parser->my_src, 1);
}
......@@ -1433,7 +1433,7 @@ static gboolean src_perform_seek(struct wg_parser *parser, GstEvent *event)
{
flush_event = gst_event_new_flush_stop(TRUE);
gst_event_set_seqnum(flush_event, seqnum);
gst_pad_push_event(parser->my_src, flush_event);
push_event(parser->my_src, flush_event);
if (thread)
gst_pad_set_active(parser->my_src, 1);
}
......
......@@ -443,10 +443,10 @@ NTSTATUS wg_transform_create(void *args)
goto out;
if (!(event = gst_event_new_stream_start("stream"))
|| !gst_pad_push_event(transform->my_src, event))
|| !push_event(transform->my_src, event))
goto out;
if (!(event = gst_event_new_caps(src_caps))
|| !gst_pad_push_event(transform->my_src, event))
|| !push_event(transform->my_src, event))
goto out;
/* We need to use GST_FORMAT_TIME here because it's the only format
......@@ -455,7 +455,7 @@ NTSTATUS wg_transform_create(void *args)
transform->segment.start = 0;
transform->segment.stop = -1;
if (!(event = gst_event_new_segment(&transform->segment))
|| !gst_pad_push_event(transform->my_src, event))
|| !push_event(transform->my_src, event))
goto out;
gst_caps_unref(src_caps);
......@@ -531,7 +531,7 @@ NTSTATUS wg_transform_set_output_format(void *args)
value = "none";
gst_util_set_object_arg(G_OBJECT(transform->video_flip), "method", value);
}
if (!gst_pad_push_event(transform->my_sink, gst_event_new_reconfigure()))
if (!push_event(transform->my_sink, gst_event_new_reconfigure()))
{
GST_ERROR("Failed to reconfigure transform %p.", transform);
return STATUS_UNSUCCESSFUL;
......@@ -892,16 +892,16 @@ NTSTATUS wg_transform_drain(void *args)
}
if (!(event = gst_event_new_segment_done(GST_FORMAT_TIME, -1))
|| !gst_pad_push_event(transform->my_src, event))
|| !push_event(transform->my_src, event))
goto error;
if (!(event = gst_event_new_eos())
|| !gst_pad_push_event(transform->my_src, event))
|| !push_event(transform->my_src, event))
goto error;
if (!(event = gst_event_new_stream_start("stream"))
|| !gst_pad_push_event(transform->my_src, event))
|| !push_event(transform->my_src, event))
goto error;
if (!(event = gst_event_new_segment(&transform->segment))
|| !gst_pad_push_event(transform->my_src, event))
|| !push_event(transform->my_src, event))
goto error;
return STATUS_SUCCESS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment