summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.c13
-rw-r--r--src/lib.h1
-rw-r--r--src/main.c10
3 files changed, 10 insertions, 14 deletions
diff --git a/src/lib.c b/src/lib.c
index 8e0616f..fc21cde 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -60,7 +60,6 @@ pad_blocked_cleanup_cb (GstPad *srcpad,
GstPadProbeInfo *info,
TranscodeClientCtx *ctx)
{
- GstPad *sinkpad;
GstElement *tee;
GstElement *sinkbin = GST_ELEMENT (gst_element_get_parent (ctx->appsink));
@@ -69,13 +68,12 @@ pad_blocked_cleanup_cb (GstPad *srcpad,
gst_pad_remove_probe (srcpad, GST_PAD_PROBE_INFO_ID (info));
tee = gst_pad_get_parent_element (srcpad);
- sinkpad = gst_element_get_static_pad (sinkbin, "qsink");
- gst_pad_unlink (srcpad, sinkpad);
+ gst_pad_unlink (srcpad, ctx->ghostsinkpad);
gst_element_remove_pad (tee, srcpad);
-
- gst_object_unref (sinkpad);
+ gst_object_unref (srcpad);
gst_object_unref (tee);
+ gst_element_set_state (sinkbin, GST_STATE_NULL);
gst_bin_remove (GST_BIN (ctx->server_ctx->pipeline), sinkbin);
gst_object_unref (sinkbin);
gst_object_unref (ctx->appsink);
@@ -88,7 +86,7 @@ pad_blocked_cleanup_cb (GstPad *srcpad,
void
stp_cleanup_transcode_client_ctx (TranscodeClientCtx *ctx)
{
- GstPad *sinkpad, *srcpad;
+ GstPad *srcpad;
TranscodeServerCtx *server_ctx = ctx->server_ctx;
GstElement *sinkbin = GST_ELEMENT (gst_element_get_parent (ctx->appsink));
@@ -100,8 +98,7 @@ stp_cleanup_transcode_client_ctx (TranscodeClientCtx *ctx)
server_ctx->clients = g_list_remove (server_ctx->clients, ctx);
/* Block sinkpad and srcpad, then unlink and remove */
- sinkpad = gst_element_get_static_pad (sinkbin, "qsink");
- srcpad = gst_pad_get_peer (sinkpad);
+ srcpad = gst_pad_get_peer (ctx->ghostsinkpad);
gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_BLOCK,
(GstPadProbeCallback) pad_blocked_cleanup_cb,
diff --git a/src/lib.h b/src/lib.h
index 187bae7..733212c 100644
--- a/src/lib.h
+++ b/src/lib.h
@@ -33,6 +33,7 @@ struct _TranscodeServerCtx {
struct _TranscodeClientCtx {
SoupMessage *msg;
GstElement *appsink;
+ GstPad *ghostsinkpad;
gulong first_sample_handler_id;
/* The transcode server context */
TranscodeServerCtx *server_ctx;
diff --git a/src/main.c b/src/main.c
index 45a281f..8d016f0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -58,7 +58,6 @@ tee_src_pad_blocked_cb (GstPad *srcpad,
TranscodeClientCtx *ctx)
{
GstCaps *caps;
- GstPad *sinkpad;
GstBuffer *buffer;
GstState state;
GstStateChangeReturn ret;
@@ -71,8 +70,7 @@ tee_src_pad_blocked_cb (GstPad *srcpad,
gst_bin_add (GST_BIN (server_ctx->pipeline), sinkbin);
/* t. ! queue ! appsink */
- sinkpad = gst_element_get_static_pad (sinkbin, "qsink");
- gst_pad_link (srcpad, sinkpad);
+ gst_pad_link (srcpad, ctx->ghostsinkpad);
/* Send the WebM stream header through the pipeline first */
caps = gst_pad_get_current_caps (srcpad);
@@ -97,7 +95,6 @@ tee_src_pad_blocked_cb (GstPad *srcpad,
out:
gst_caps_unref (caps);
- gst_object_unref (sinkpad);
gst_object_unref (sinkbin);
return GST_PAD_PROBE_OK;
err:
@@ -261,7 +258,7 @@ GET:
bin = gst_bin_new (NULL);
/* queue ! appsink */
- q2 = gst_element_factory_make ("queue", "q2");
+ q2 = gst_element_factory_make ("queue", NULL);
appsink = gst_element_factory_make ("appsink", NULL);
g_object_set (appsink, "drop", FALSE,
"emit-signals", TRUE,
@@ -270,7 +267,8 @@ GET:
gst_element_link (q2, appsink);
sinkpadq2 = gst_element_get_static_pad (q2, "sink");
- gst_element_add_pad (bin, gst_ghost_pad_new ("qsink", sinkpadq2));
+ client_ctx->ghostsinkpad = gst_ghost_pad_new (NULL, sinkpadq2);
+ gst_element_add_pad (bin, client_ctx->ghostsinkpad);
gst_object_unref (sinkpadq2);
/* Set to PAUSED so the bin can pre-roll */