diff --git a/examples/queue/queue.c b/examples/queue/queue.c index 9dc42d1f17..10272da519 100644 --- a/examples/queue/queue.c +++ b/examples/queue/queue.c @@ -47,6 +47,8 @@ int main(int argc,char *argv[]) audiosink = gst_elementfactory_make("audiosink", "play_audio"); g_assert(audiosink != NULL); + gst_bin_use_cothreads (GST_BIN (bin), TRUE); + /* add objects to the main pipeline */ gst_bin_add(GST_BIN(bin), disksrc); gst_bin_add(GST_BIN(bin), parse); diff --git a/examples/queue2/queue2.c b/examples/queue2/queue2.c index 845f491f89..6258e9cec3 100644 --- a/examples/queue2/queue2.c +++ b/examples/queue2/queue2.c @@ -53,9 +53,6 @@ int main(int argc,char *argv[]) gst_pad_connect(gst_element_get_pad(queue,"src"), gst_element_get_pad(audiosink,"sink")); - gst_pad_set_type_id(gst_element_get_pad(queue, "sink"), - gst_pad_get_type_id(gst_element_get_pad(audiosink, "sink"))); - if (!gst_pipeline_autoplug(GST_PIPELINE(pipeline))) { g_print("cannot autoplug pipeline\n"); exit(-1); diff --git a/gst/gstbin.c b/gst/gstbin.c index f3b6d810c7..2a058f2898 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -17,7 +17,7 @@ * Boston, MA 02111-1307, USA. */ -//#define GST_DEBUG_ENABLED +#define GST_DEBUG_ENABLED #include "gstbin.h" #include "gstdebug.h" @@ -772,6 +772,7 @@ GST_DEBUG_PAD_NAME(pad->peer),GST_DEBUG_PAD_NAME(pad),&pad->pullfunc); if (!pad->pullregionfunc) pad->pullregionfunc = gst_bin_pullregionfunc_proxy; } + //pad->threadstate = element->threadstate; } pads = g_list_next (pads); } diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 7643939b4d..6130da97c1 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -118,7 +118,10 @@ gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps) if (fromcaps->id != tocaps->id) return FALSE; - return gst_props_check_compatibility (fromcaps->properties, tocaps->properties); + if (fromcaps->properties && tocaps->properties) { + return gst_props_check_compatibility (fromcaps->properties, tocaps->properties); + } + else return TRUE; } diff --git a/gst/gstpipeline.c b/gst/gstpipeline.c index 2a02bf1f01..5b7cd965c1 100644 --- a/gst/gstpipeline.c +++ b/gst/gstpipeline.c @@ -166,8 +166,11 @@ gst_pipeline_typefind (GstPipeline *pipeline, GstElement *element) gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); if (found) { + GstType *type; type_id = gst_util_get_int_arg (GTK_OBJECT (typefind), "type"); - //gst_pad_add_type_id (gst_element_get_pad (element, "src"), type_id); + type = gst_type_find_by_id (type_id); + + gst_pad_set_caps (gst_element_get_pad (element, "src"), gst_caps_new (type->mime)); } gst_pad_disconnect (gst_element_get_pad (element, "src"), @@ -224,7 +227,8 @@ gst_pipeline_pads_autoplug (GstElement *src, GstElement *sink) while (srcpads && !connected) { GstPad *srcpad = (GstPad *)srcpads->data; - connected = gst_pipeline_pads_autoplug_func (src, srcpad, sink); + if (srcpad->direction == GST_PAD_SRC) + connected = gst_pipeline_pads_autoplug_func (src, srcpad, sink); srcpads = g_list_next(srcpads); } @@ -369,18 +373,14 @@ gst_pipeline_autoplug (GstPipeline *pipeline) pad = (GstPad *)pads->data; if (pad->direction == GST_PAD_SINK) { - /* - GList *types = gst_pad_get_type_ids(pad); - if (types) { - sink_type = GPOINTER_TO_INT (types->data); + GstCaps *caps = gst_pad_get_caps (pad); + if (caps) { + sink_type = caps->id; break; } else - */ sink_type = 0; - } - g_print ("type %d\n", sink_type); pads = g_list_next(pads); } @@ -471,20 +471,16 @@ differ: while (sinkpads) { sinkpad = (GstPad *)sinkpads->data; - /* // FIXME connect matching pads, not just the first one... if (sinkpad->direction == GST_PAD_SINK && !GST_PAD_CONNECTED(sinkpad)) { - guint16 sinktype = 0; - GList *types = gst_pad_get_type_ids(sinkpad); - if (types) - sinktype = GPOINTER_TO_INT (types->data); + GstCaps *caps = gst_pad_get_caps (sinkpad); + // the queue has the type of the elements it connects - gst_pad_set_type_id (srcpad, sinktype); - gst_pad_set_type_id (gst_element_get_pad(queue, "sink"), sinktype); + gst_pad_set_caps (srcpad, caps); + gst_pad_set_caps (gst_element_get_pad(queue, "sink"), caps); break; } - */ sinkpads = g_list_next(sinkpads); } gst_pipeline_pads_autoplug(thesrcelement, queue); diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 0de739ee3d..15b401323c 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -496,6 +496,7 @@ gst_plugin_add_type (GstPlugin *plugin, GstTypeFactory *factory) // g_print("adding factory to plugin\n"); plugin->types = g_list_prepend (plugin->types, factory); + gst_type_register (factory); } /** diff --git a/gst/gsttype.c b/gst/gsttype.c index 16c60616fd..073c89172a 100644 --- a/gst/gsttype.c +++ b/gst/gsttype.c @@ -98,7 +98,6 @@ gst_type_register (GstTypeFactory *factory) type->id = _gst_maxtype++; type->mime = factory->mime; type->exts = factory->exts; - //type->typefindfunc = factory->typefindfunc; type->srcs = NULL; type->sinks = NULL; type->converters = g_hash_table_new (NULL, NULL); @@ -113,11 +112,9 @@ gst_type_register (GstTypeFactory *factory) /* FIXME: do extension merging here, not that easy */ /* if there is no existing typefind function, try to use new one */ - /* - if ((type->typefindfunc == gst_type_typefind_dummy || - type->typefindfunc == NULL) && factory->typefindfunc) - type->typefindfunc = factory->typefindfunc; - */ + } + if (factory->typefindfunc) { + type->typefindfuncs = g_slist_prepend (type->typefindfuncs, factory->typefindfunc); } return id; @@ -558,6 +555,7 @@ gst_type_get_sink_to_src (guint16 sinkid, guint16 srcid) GList *queue = NULL; gint iNode, iDist, iPrev, i, iCost; + g_print ("gsttype: find %d to %d\n", srcid, sinkid); if (sinkid == srcid) { //FIXME return an identity element return NULL; @@ -648,6 +646,7 @@ gst_type_load_thyself (xmlNodePtr parent) GstTypeFactory *factory = g_new0 (GstTypeFactory, 1); factory->mime = g_strdup (xmlNodeGetContent (field)); + factory->typefindfunc = gst_type_typefind_dummy; typeid = gst_type_register (factory); } return typeid; @@ -686,6 +685,8 @@ gst_type_typefind_dummy (GstBuffer *buffer, gpointer priv) { GstType *type = (GstType *)priv; guint16 typeid; + GSList *funcs; + g_print ("gsttype: need to load typefind function\n"); type->typefindfuncs = NULL; @@ -693,11 +694,17 @@ gst_type_typefind_dummy (GstBuffer *buffer, gpointer priv) typeid = gst_type_find_by_mime (type->mime); type = gst_type_find_by_id (typeid); - /* - if (type->typefindfunc) { - return type->typefindfunc (buffer, type); + funcs = type->typefindfuncs; + + while (funcs) { + GstTypeFindFunc func = (GstTypeFindFunc) funcs->data; + + if (func) { + if (func (buffer, type)) return TRUE; + } + + funcs = g_slist_next (funcs); } - */ return FALSE; } @@ -726,7 +733,7 @@ gst_typefactory_load_thyself (xmlNodePtr parent) factory->exts = g_strdup (xmlNodeGetContent (field)); } else if (!strcmp (field->name, "typefind")) { - //factory->typefindfunc = gst_type_typefind_dummy; + factory->typefindfunc = gst_type_typefind_dummy; } field = field->next; } diff --git a/tests/old/examples/queue/queue.c b/tests/old/examples/queue/queue.c index 9dc42d1f17..10272da519 100644 --- a/tests/old/examples/queue/queue.c +++ b/tests/old/examples/queue/queue.c @@ -47,6 +47,8 @@ int main(int argc,char *argv[]) audiosink = gst_elementfactory_make("audiosink", "play_audio"); g_assert(audiosink != NULL); + gst_bin_use_cothreads (GST_BIN (bin), TRUE); + /* add objects to the main pipeline */ gst_bin_add(GST_BIN(bin), disksrc); gst_bin_add(GST_BIN(bin), parse); diff --git a/tests/old/examples/queue2/queue2.c b/tests/old/examples/queue2/queue2.c index 845f491f89..6258e9cec3 100644 --- a/tests/old/examples/queue2/queue2.c +++ b/tests/old/examples/queue2/queue2.c @@ -53,9 +53,6 @@ int main(int argc,char *argv[]) gst_pad_connect(gst_element_get_pad(queue,"src"), gst_element_get_pad(audiosink,"sink")); - gst_pad_set_type_id(gst_element_get_pad(queue, "sink"), - gst_pad_get_type_id(gst_element_get_pad(audiosink, "sink"))); - if (!gst_pipeline_autoplug(GST_PIPELINE(pipeline))) { g_print("cannot autoplug pipeline\n"); exit(-1);