winegstreamer: Link the container pads and activate ours.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2022-02-25 11:43:00 -06:00 committed by Alexandre Julliard
parent aa867c6cfb
commit 9196fee583
1 changed files with 20 additions and 0 deletions

View File

@ -46,6 +46,7 @@ struct wg_transform
{ {
GstElement *container; GstElement *container;
GstPad *my_src, *my_sink; GstPad *my_src, *my_sink;
GstPad *their_sink, *their_src;
}; };
static GstFlowReturn transform_sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *buffer) static GstFlowReturn transform_sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *buffer)
@ -64,6 +65,8 @@ NTSTATUS wg_transform_destroy(void *args)
struct wg_transform *transform = args; struct wg_transform *transform = args;
gst_element_set_state(transform->container, GST_STATE_NULL); gst_element_set_state(transform->container, GST_STATE_NULL);
g_object_unref(transform->their_sink);
g_object_unref(transform->their_src);
g_object_unref(transform->container); g_object_unref(transform->container);
g_object_unref(transform->my_sink); g_object_unref(transform->my_sink);
g_object_unref(transform->my_src); g_object_unref(transform->my_src);
@ -237,6 +240,19 @@ NTSTATUS wg_transform_create(void *args)
goto out; goto out;
} }
if (!(transform->their_sink = gst_element_get_static_pad(first, "sink")))
goto out;
if (!(transform->their_src = gst_element_get_static_pad(last, "src")))
goto out;
if (gst_pad_link(transform->my_src, transform->their_sink) < 0)
goto out;
if (gst_pad_link(transform->their_src, transform->my_sink) < 0)
goto out;
if (!gst_pad_set_active(transform->my_sink, 1))
goto out;
if (!gst_pad_set_active(transform->my_src, 1))
goto out;
gst_element_set_state(transform->container, GST_STATE_PAUSED); gst_element_set_state(transform->container, GST_STATE_PAUSED);
if (!gst_element_get_state(transform->container, NULL, NULL, -1)) if (!gst_element_get_state(transform->container, NULL, NULL, -1))
goto out; goto out;
@ -249,6 +265,10 @@ NTSTATUS wg_transform_create(void *args)
return STATUS_SUCCESS; return STATUS_SUCCESS;
out: out:
if (transform->their_sink)
gst_object_unref(transform->their_sink);
if (transform->their_src)
gst_object_unref(transform->their_src);
if (transform->my_sink) if (transform->my_sink)
gst_object_unref(transform->my_sink); gst_object_unref(transform->my_sink);
if (sink_caps) if (sink_caps)