mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 02:30:35 +00:00
Move a step closer to autoplugging. The element selection in the pipeline works.
Original commit message from CVS: Move a step closer to autoplugging. The element selection in the pipeline works. Slight modification to the typefind function handling. removed the stupid mime types in the mpeg decoders. Adjust videosink for the new caps handling. Modified the queue example to show an error in plan creation; Erik can you solve this? This is the type of pipelines autoplugging uses.
This commit is contained in:
parent
a63780a377
commit
64a740ad9b
9 changed files with 42 additions and 36 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue