some minor improvements:

Original commit message from CVS:
some minor improvements:
- better debugging output
- don't set state to paused when plugging anymore
- bugfix: set typefind caps on srcpad, not sinkpad
- remove unnecessary check for right caps
This commit is contained in:
Benjamin Otte 2003-05-06 23:47:07 +00:00
parent 316124eb40
commit 6c44f865e8
2 changed files with 7 additions and 29 deletions

View file

@ -196,8 +196,7 @@ gst_spider_request_new_pad (GstElement *element, GstPadTemplate *templ, const gc
/* FIXME: use the requested name for the pad */
gst_object_ref (GST_OBJECT (templ));
GST_PAD_PAD_TEMPLATE (returnpad) = templ;
gst_object_replace ((GstObject **) &returnpad->padtemplate, (GstObject *) templ);
gst_bin_add (GST_BIN (element), GST_ELEMENT (identity));
@ -439,19 +438,7 @@ gst_spider_identity_plug (GstSpiderIdentity *ident)
}
if ((GstElement *) spider->sink_ident == conn->current)
{
gboolean restart = FALSE;
/* 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);
}
gst_spider_plug (conn);
/* restart if needed */
if (restart)
{
gst_element_set_state ((GstElement *) spider, GST_STATE_PLAYING);
}
}
}
}
@ -515,6 +502,8 @@ gst_spider_create_and_plug (GstSpiderConnection *conn, GList *plugpath)
element = (GstElement *) (endelements == NULL ? conn->src : endelements->data);
} else {
element = gst_element_factory_create ((GstElementFactory *) plugpath->data, NULL);
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);
}
@ -609,14 +598,7 @@ gst_spider_plug_from_srcpad (GstSpiderConnection *conn, GstPad *srcpad)
GST_DEBUG_PAD_NAME (srcpad), GST_ELEMENT_NAME (conn->src));
/* find a path from src to sink */
/* FIXME: make that if go away and work anyway */
if (srcpad == spider->sink_ident->src)
{
g_assert (GST_RPAD_PEER (spider->sink_ident->sink) != NULL);
plugpath = gst_autoplug_sp (gst_pad_get_caps ((GstPad *) GST_RPAD_PEER (spider->sink_ident->sink)), gst_pad_get_caps (conn->src->sink), spider->factories);
} else {
plugpath = gst_autoplug_sp (gst_pad_get_caps (srcpad), gst_pad_get_caps (conn->src->sink), spider->factories);
}
plugpath = gst_autoplug_sp (gst_pad_get_caps (srcpad), gst_pad_get_caps (conn->src->sink), spider->factories);
/* prints out the path that was found for plugging */
/* g_print ("found path from %s to %s:\n", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src));
@ -696,6 +678,3 @@ GstPluginDesc plugin_desc = {
"gstspider",
plugin_init
};

View file

@ -481,9 +481,10 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
GstTypeFactory *factory = GST_TYPE_FACTORY (factories->data);
GstTypeFindFunc typefindfunc = (GstTypeFindFunc)factory->typefindfunc;
GST_DEBUG (0, "trying typefind function %s", GST_PLUGIN_FEATURE_NAME (factory));
GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "trying typefind function %s", GST_PLUGIN_FEATURE_NAME (factory));
if (typefindfunc && (caps = typefindfunc (buf, factory))) {
if (gst_pad_try_set_caps (ident->sink, caps) <= 0) {
GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT, "typefind function %s found caps", GST_PLUGIN_FEATURE_NAME (factory));
if (gst_pad_try_set_caps (ident->src, caps) <= 0) {
g_warning ("typefind: found type but peer didn't accept it");
gst_caps_sink (caps);
} else {
@ -539,5 +540,3 @@ gst_spider_identity_handle_src_event (GstPad *pad, GstEvent *event)
return res;
}