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
This commit is contained in:
Benjamin Otte 2003-05-17 17:08:58 +00:00
parent 63c6869123
commit 4471a7e84d
2 changed files with 4 additions and 19 deletions

View file

@ -269,17 +269,8 @@ gst_spider_unused_elementname (GstBin *bin, const gchar *startwith)
static void static void
gst_spider_link_sometimes (GstElement *src, GstPad *pad, GstSpiderConnection *conn) gst_spider_link_sometimes (GstElement *src, GstPad *pad, GstSpiderConnection *conn)
{ {
gboolean restart = FALSE;
gulong signal_id = conn->signal_id; gulong signal_id = conn->signal_id;
GstPad *sinkpad = conn->src->sink; 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 */ /* try to autoplug the elements */
if (gst_spider_plug_from_srcpad (conn, pad) != GST_PAD_LINK_REFUSED) { 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); g_signal_handler_disconnect (src, signal_id);
signal_id = 0; 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 */ /* create a new link from those two elements */
static GstSpiderConnection * 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_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_ELEMENT_NAME (element), GST_PLUGIN_FEATURE_NAME (plugpath->data));
gst_bin_add (GST_BIN (spider), element); gst_bin_add (GST_BIN (spider), element);
gst_element_sync_state_with_parent (element);
} }
/* insert and link new 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 */ /* check if the src has SOMETIMES templates. If so, link a callback */
GList *templs = gst_element_get_pad_template_list (conn->current); GList *templs = gst_element_get_pad_template_list (conn->current);

View file

@ -188,7 +188,7 @@ gst_spider_identity_chain (GstPad *pad, GstBuffer *buf)
} }
/* end hack for current event stuff here */ /* 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; return;
} }