From 4471a7e84d6f1e1ac51ce8b6c7a11b9dae76144f Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 17 May 2003 17:08:58 +0000 Subject: [PATCH] only set state to playing when elements are linked - don't pause in SOMETIMES callback Original commit message from CVS: only set state to playing when elements are linked - don't pause in SOMETIMES callback --- gst/autoplug/gstspider.c | 21 +++------------------ gst/autoplug/gstspideridentity.c | 2 +- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/gst/autoplug/gstspider.c b/gst/autoplug/gstspider.c index 83ceba20b9..6a273afa6f 100644 --- a/gst/autoplug/gstspider.c +++ b/gst/autoplug/gstspider.c @@ -269,17 +269,8 @@ gst_spider_unused_elementname (GstBin *bin, const gchar *startwith) static void gst_spider_link_sometimes (GstElement *src, GstPad *pad, GstSpiderConnection *conn) { - gboolean restart = FALSE; gulong signal_id = conn->signal_id; GstPad *sinkpad = conn->src->sink; - GstSpider *spider = GST_SPIDER (GST_OBJECT_PARENT (conn->src)); - - /* check if restarting is necessary */ - if (gst_element_get_state ((GstElement *) spider) == GST_STATE_PLAYING) - { - restart = TRUE; - gst_element_set_state ((GstElement *) spider, GST_STATE_PAUSED); - } /* try to autoplug the elements */ if (gst_spider_plug_from_srcpad (conn, pad) != GST_PAD_LINK_REFUSED) { @@ -287,12 +278,6 @@ gst_spider_link_sometimes (GstElement *src, GstPad *pad, GstSpiderConnection *co g_signal_handler_disconnect (src, signal_id); signal_id = 0; } - - /* restart if needed */ - if (restart) - { - gst_element_set_state ((GstElement *) spider, GST_STATE_PLAYING); - } } /* create a new link from those two elements */ static GstSpiderConnection * @@ -505,11 +490,11 @@ gst_spider_create_and_plug (GstSpiderConnection *conn, GList *plugpath) GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "Adding element %s of type %s and syncing state with autoplugger", GST_ELEMENT_NAME (element), GST_PLUGIN_FEATURE_NAME (plugpath->data)); gst_bin_add (GST_BIN (spider), element); - gst_element_sync_state_with_parent (element); } /* insert and link new element */ - if (!gst_element_link (conn->current, element)) - { + if (gst_element_link (conn->current, element)) { + gst_element_sync_state_with_parent (element); + } else { /* check if the src has SOMETIMES templates. If so, link a callback */ GList *templs = gst_element_get_pad_template_list (conn->current); diff --git a/gst/autoplug/gstspideridentity.c b/gst/autoplug/gstspideridentity.c index ec24c7de4a..6b07b2e431 100644 --- a/gst/autoplug/gstspideridentity.c +++ b/gst/autoplug/gstspideridentity.c @@ -188,7 +188,7 @@ gst_spider_identity_chain (GstPad *pad, GstBuffer *buf) } /* end hack for current event stuff here */ - gst_pad_event_default (ident->sink, GST_EVENT (buf)); + gst_pad_event_default (pad, GST_EVENT (buf)); return; }