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);
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);
* Boston, MA 02111-1307, USA.
*/
-//#define GST_DEBUG_ENABLED
+#define GST_DEBUG_ENABLED
#include "gstbin.h"
#include "gstdebug.h"
if (!pad->pullregionfunc)
pad->pullregionfunc = gst_bin_pullregionfunc_proxy;
}
+ //pad->threadstate = element->threadstate;
}
pads = g_list_next (pads);
}
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;
}
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"),
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);
}
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);
}
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);
// g_print("adding factory to plugin\n");
plugin->types = g_list_prepend (plugin->types, factory);
+ gst_type_register (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);
/* 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;
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;
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;
{
GstType *type = (GstType *)priv;
guint16 typeid;
+ GSList *funcs;
+
g_print ("gsttype: need to load typefind function\n");
type->typefindfuncs = NULL;
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;
}
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;
}
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);
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);