gst.c \
$(GSTOBJECT_SRCS) \
gstpad.c \
+ gstautoplug.c \
gstbuffer.c \
gstbufferpool.c \
gstclock.c \
gstlog.h \
$(GSTOBJECT_INCLUDES) \
gstpad.h \
+ gstautoplug.h \
gstbuffer.h \
gstbufferpool.h \
gstclock.h \
gsti386.h \
gstppc.h
-CFLAGS += -O6 -Wall
+CFLAGS += -g -O6 -Wall
libgst_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS)
libgst_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE)
_gst_buffer_initialize ();
/* register some standard builtin types */
- gst_elementfactory_register (gst_elementfactory_new ("bin",
- gst_bin_get_type (), &gst_bin_details));
- gst_elementfactory_register (gst_elementfactory_new ("pipeline",
- gst_pipeline_get_type (), &gst_pipeline_details));
- gst_elementfactory_register (gst_elementfactory_new("thread",
- gst_thread_get_type (), &gst_thread_details));
+ gst_elementfactory_new ("bin", gst_bin_get_type (), &gst_bin_details);
+ gst_elementfactory_new ("pipeline", gst_pipeline_get_type (), &gst_pipeline_details);
+ gst_elementfactory_new("thread", gst_thread_get_type (), &gst_thread_details);
_gst_trace_on = 0;
if (_gst_trace_on) {
gstelement_class->change_state = gst_bin_change_state;
gstelement_class->save_thyself = gst_bin_save_thyself;
gstelement_class->restore_thyself = gst_bin_restore_thyself;
- gstelement_class->elementfactory = gst_elementfactory_find("bin");
gtkobject_class->destroy = gst_bin_real_destroy;
}
g_return_val_if_fail (fromcaps != NULL, FALSE);
g_return_val_if_fail (tocaps != NULL, FALSE);
- if (fromcaps->id != tocaps->id)
+ if (fromcaps->id != tocaps->id) {
+ //g_print ("gstcaps: mime types wrong\n");
return FALSE;
+ }
if (tocaps->properties) {
GstPropsEntry *entry = (GstPropsEntry *)tocaps->properties;
return gst_props_check_compatibility (fromcaps->properties, tocaps->properties);
}
else {
- g_print ("gstcaps: no source caps\n");
+ //g_print ("gstcaps: no source caps\n");
return FALSE;
}
}
else {
// assume it accepts everything
- g_print ("gstcaps: no caps\n");
+ //g_print ("gstcaps: no caps\n");
return TRUE;
}
}
GstElement* gst_element_load_thyself (xmlNodePtr parent, GHashTable *elements);
-GstElementFactory* gst_elementfactory_new (gchar *name,GtkType type,
- GstElementDetails *details);
-
-void gst_elementfactory_register (GstElementFactory *elementfactory);
-void gst_elementfactory_unregister (GstElementFactory *elementfactory);
+/*
+ *
+ * factories stuff
+ *
+ **/
+GstElementFactory* gst_elementfactory_new (gchar *name,GtkType type,
+ GstElementDetails *details);
+void gst_elementfactory_destroy (GstElementFactory *elementfactory);
void gst_elementfactory_add_padtemplate (GstElementFactory *elementfactory,
- GstPadTemplate *pad);
+ GstPadTemplate *pad);
+
+GstElementFactory* gst_elementfactory_find (gchar *name);
+GList* gst_elementfactory_get_list (void);
-GstElementFactory* gst_elementfactory_find (gchar *name);
-GList* gst_elementfactory_get_list (void);
+gboolean gst_elementfactory_can_src_caps (GstElementFactory *factory,
+ GstCaps *caps);
+gboolean gst_elementfactory_can_sink_caps (GstElementFactory *factory,
+ GstCaps *caps);
-GstElement* gst_elementfactory_create (GstElementFactory *factory,
- gchar *name);
+GstElement* gst_elementfactory_create (GstElementFactory *factory,
+ gchar *name);
// FIXME this name is wrong, probably so is the one above it
-GstElement* gst_elementfactory_make (gchar *factoryname, gchar *name);
+GstElement* gst_elementfactory_make (gchar *factoryname, gchar *name);
-xmlNodePtr gst_elementfactory_save_thyself (GstElementFactory *factory, xmlNodePtr parent);
-GstElementFactory* gst_elementfactory_load_thyself (xmlNodePtr parent);
+xmlNodePtr gst_elementfactory_save_thyself (GstElementFactory *factory, xmlNodePtr parent);
+GstElementFactory* gst_elementfactory_load_thyself (xmlNodePtr parent);
#ifdef __cplusplus
}
}
/**
- * gst_elementfactory_register:
- * @elementfactory: factory to register
- *
- * Adds the elementfactory to the global list, so it can be retrieved by
- * name.
- */
-void
-gst_elementfactory_register (GstElementFactory *elementfactory)
-{
- g_return_if_fail(elementfactory != NULL);
-
- _gst_elementfactories = g_list_prepend (_gst_elementfactories, elementfactory);
-}
-
-/**
* gst_elementfactory_unregister:
* @elementfactory: factory to register
*
* Removes the elementfactory from the global list.
*/
void
-gst_elementfactory_unregister (GstElementFactory *factory)
+gst_elementfactory_destroy (GstElementFactory *factory)
{
- GList *padtemplates;
-
g_return_if_fail (factory != NULL);
- padtemplates = factory->padtemplates;
-
- while (padtemplates) {
- GstPadTemplate *padfactory = (GstPadTemplate *)padtemplates->data;
- GstCaps *caps = padfactory->caps;
-
- if (caps) {
- switch (padfactory->direction) {
- case GST_PAD_SRC:
- _gst_type_remove_src (caps->id, factory);
- break;
- case GST_PAD_SINK:
- _gst_type_remove_sink (caps->id, factory);
- break;
- default:
- break;
- }
- }
- padtemplates = g_list_next (padtemplates);
- }
-
_gst_elementfactories = g_list_remove (_gst_elementfactories, factory);
g_free (factory);
GstElementDetails *details)
{
GstElementFactory *factory = g_new0(GstElementFactory, 1);
+ GstElementClass *gstelement_class;
+
factory->name = g_strdup(name);
factory->type = type;
factory->details = details;
factory->padtemplates = NULL;
+ gstelement_class = (GstElementClass*) gtk_type_class (GST_TYPE_ELEMENT);
+
+ gstelement_class->elementfactory = factory;
+
+ _gst_elementfactories = g_list_prepend (_gst_elementfactories, factory);
+
return factory;
}
gst_elementfactory_add_padtemplate (GstElementFactory *factory,
GstPadTemplate *template)
{
- GstCaps *caps;
-
g_return_if_fail(factory != NULL);
g_return_if_fail(template != NULL);
factory->padtemplates = g_list_append (factory->padtemplates, template);
+}
- caps = template->caps;
-
- if (caps) {
- switch (template->direction) {
- case GST_PAD_SRC:
- _gst_type_add_src (caps->id, factory);
- break;
- case GST_PAD_SINK:
- _gst_type_add_sink (caps->id, factory);
- break;
- default:
- g_print ("gstelementfactory: uh? no pad direction\n");
- break;
+gboolean
+gst_elementfactory_can_src_caps (GstElementFactory *factory,
+ GstCaps *caps)
+{
+ GList *templates;
+
+ g_return_val_if_fail(factory != NULL, FALSE);
+ g_return_val_if_fail(caps != NULL, FALSE);
+
+ templates = factory->padtemplates;
+
+ while (templates) {
+ GstPadTemplate *template = (GstPadTemplate *)templates->data;
+
+ if (template->direction == GST_PAD_SRC) {
+ if (gst_caps_check_compatibility (template->caps, caps))
+ return TRUE;
}
+ templates = g_list_next (templates);
}
+
+ return FALSE;
+}
+
+gboolean
+gst_elementfactory_can_sink_caps (GstElementFactory *factory,
+ GstCaps *caps)
+{
+ GList *templates;
+
+ g_return_val_if_fail(factory != NULL, FALSE);
+ g_return_val_if_fail(caps != NULL, FALSE);
+
+ templates = factory->padtemplates;
+
+ while (templates) {
+ GstPadTemplate *template = (GstPadTemplate *)templates->data;
+
+ if (template->direction == GST_PAD_SINK) {
+ if (gst_caps_check_compatibility (caps, template->caps))
+ return TRUE;
+ }
+ templates = g_list_next (templates);
+ }
+
+ return FALSE;
}
/**
children = children->next;
}
+ _gst_elementfactories = g_list_prepend (_gst_elementfactories, factory);
+
return factory;
}
#include "gstsink.h"
#include "gstutils.h"
#include "gsttype.h"
+#include "gstautoplug.h"
GstElementDetails gst_pipeline_details = {
"Pipeline object",
parent_class = gtk_type_class(gst_bin_get_type());
gstelement_class->change_state = gst_pipeline_change_state;
- gstelement_class->elementfactory = gst_elementfactory_find ("pipeline");
}
static void
*(gboolean *)data = TRUE;
}
-static guint16
+static GstCaps*
gst_pipeline_typefind (GstPipeline *pipeline, GstElement *element)
{
gboolean found = FALSE;
GstElement *typefind;
GstCaps *caps = NULL;
- guint type_id = 0;
g_print("GstPipeline: typefind for element \"%s\" %p\n",
gst_element_get_name(element), &found);
caps = gst_util_get_pointer_arg (GTK_OBJECT (typefind), "caps");
gst_pad_set_caps (gst_element_get_pad (element, "src"), caps);
-
- type_id = caps->id;
}
gst_pad_disconnect (gst_element_get_pad (element, "src"),
gst_bin_remove (GST_BIN (pipeline), typefind);
gst_object_unref (GST_OBJECT (typefind));
- return type_id;
+ return caps;
}
static gboolean
connected = TRUE;
break;
}
- else {
- GList *factories;
- g_print("gstpipeline: not compatible, find intermediate element\n");
-
- factories = gst_type_get_sink_to_src (pad->caps->id, sinkpad->caps->id);
-
- while (factories) {
- GstElementFactory *factory = (GstElementFactory *)factories->data;
- GstElement *element = gst_elementfactory_create (factory, factory->name);
-
- g_print ("gstpipeline: trying element \"%s\"\n", element->name);
-
- if (gst_pipeline_pads_autoplug_func (src, pad, element)) {
- if (gst_pipeline_pads_autoplug_func (element, gst_element_get_pad (element, "src"), sink)) {
- gst_bin_add (gst_object_get_parent (GST_OBJECT(sink)), element);
- return TRUE;
- }
- }
- factories = g_list_next (factories);
- }
- }
}
sinkpads = g_list_next(sinkpads);
}
GList **factories;
GList **base_factories;
GstElementFactory *factory;
- GList *src_types;
- guint16 src_type = 0, sink_type = 0;
+ GList *src_pads;
+ GstCaps *src_caps = 0;
guint i, numsinks;
gboolean use_thread = FALSE, have_common = FALSE;
return FALSE;
}
- // FIXME check the factory???
- factory = gst_element_get_factory(pipeline->src);
+ g_print("GstPipeline: source \"%s\" has no MIME type, running typefind...\n",
+ gst_element_get_name(pipeline->src));
- //src_types = factory->pads;
- src_types = NULL; // FIXME
- if (src_types == NULL) {
- g_print("GstPipeline: source \"%s\" has no MIME type, running typefind...\n",
- gst_element_get_name(pipeline->src));
+ src_caps = gst_pipeline_typefind(pipeline, pipeline->src);
- src_type = gst_pipeline_typefind(pipeline, pipeline->src);
-
- if (src_type) {
- g_print("GstPipeline: source \"%s\" type found %d\n", gst_element_get_name(pipeline->src),
- src_type);
- }
- else {
- g_print("GstPipeline: source \"%s\" has no type\n", gst_element_get_name(pipeline->src));
- return FALSE;
- }
+ if (src_caps) {
+ g_print("GstPipeline: source \"%s\" type found %d\n", gst_element_get_name(pipeline->src),
+ src_caps->id);
}
else {
- while (src_types) {
- // FIXME loop over types and find paths...
- src_types = g_list_next(src_types);
- }
+ g_print("GstPipeline: source \"%s\" has no type\n", gst_element_get_name(pipeline->src));
+ return FALSE;
}
srcelement = pipeline->src;
element = GST_ELEMENT(elements->data);
- pads = gst_element_get_pad_list(element);
-
- while (pads) {
- pad = (GstPad *)pads->data;
-
- if (pad->direction == GST_PAD_SINK) {
- GstCaps *caps = gst_pad_get_caps (pad);
- if (caps) {
- sink_type = caps->id;
- break;
- }
- else
- sink_type = 0;
- }
-
- pads = g_list_next(pads);
- }
+ pad = (GstPad *)gst_element_get_pad_list (element)->data;
- base_factories[i] = factories[i] = gst_type_get_sink_to_src(src_type, sink_type);
+ base_factories[i] = factories[i] = gst_autoplug_caps (src_caps, pad->caps);
i++;
elements = g_list_next(elements);
factories = plugin->elements;
while (factories) {
- gst_elementfactory_unregister((GstElementFactory*)(factories->data));
+ gst_elementfactory_destroy ((GstElementFactory*)(factories->data));
factories = g_list_next(factories);
}
_gst_plugins = g_list_remove(_gst_plugins, plugin);
// g_print("adding factory to plugin\n");
plugin->elements = g_list_prepend (plugin->elements, factory);
- gst_elementfactory_register (factory);
}
/**
* Boston, MA 02111-1307, USA.
*/
-//#define DEBUG_ENABLED
+#define DEBUG_ENABLED
#include "gstdebug.h"
#include "gstprops.h"
sourcelist = g_slist_next (sourcelist);
sinklist = g_slist_next (sinklist);
}
+ if (sinklist) {
+ GstPropsEntry *entry2;
+ entry2 = (GstPropsEntry *)sinklist->data;
+ missing++;
+ DEBUG ("source has missing property \"%s\"\n", g_quark_to_string (entry2->propid));
+ }
end:
if (missing)
gstelement_class->change_state = gst_thread_change_state;
gstelement_class->save_thyself = gst_thread_save_thyself;
gstelement_class->restore_thyself = gst_thread_restore_thyself;
- gstelement_class->elementfactory = gst_elementfactory_find("thread");
gstbin_class->create_plan = gst_thread_create_plan_dummy;
GstPlugin *plugin; /* the plugin with this typefind function */
};
-#define MAX_COST 999999
-
-struct _gst_type_node
-{
- int iNode;
- int iDist;
- int iPrev;
-};
-
-typedef struct _gst_type_node gst_type_node;
-
static GstCaps* gst_type_typefind_dummy (GstBuffer *buffer, gpointer priv);
-/* we keep a (spase) matrix in the hashtable like:
- *
- * type_id list of factories hashed by src type_id
- *
- * 1 -> (1, factory1, factory2), (3, factory3)
- * 2 -> NULL
- * 3 -> (4, factory4)
- * 4 -> NULL
- *
- * That way, we can quickly find all factories that convert
- * 1 to 2.
- *
- **/
-
void
_gst_type_initialize (void)
{
type->id = _gst_maxtype++;
type->mime = factory->mime;
type->exts = factory->exts;
- type->srcs = NULL;
- type->sinks = NULL;
- type->converters = g_hash_table_new (NULL, NULL);
_gst_types = g_list_prepend (_gst_types, type);
id = type->id;
return NULL;
}
-static void
-gst_type_dump_converter (gpointer key,
- gpointer value,
- gpointer data)
-{
- GList *walk = (GList *)value;
- GstElementFactory *factory;
- guint16 id = GPOINTER_TO_UINT (key);
- GstType *type = gst_type_find_by_id (id);
-
- g_print ("\ngsttype: %u (%s), ", type->id, type->mime);
-
- while (walk) {
- factory = (GstElementFactory *) walk->data;
- g_print("\"%s\" ", factory->name);
- walk = g_list_next (walk);
- }
-}
-
-/**
- * gst_type_dump:
- *
- * dumps the current type system
- */
-void
-gst_type_dump(void)
-{
- GList *walk = _gst_types;
- GstType *type;
-
- g_print ("gst_type_dump() : \n");
-
- while (walk) {
- type = (GstType *)walk->data;
-
- g_print ("gsttype: %d (%s)", type->id, type->mime);
- g_hash_table_foreach (type->converters, gst_type_dump_converter, NULL);
- g_print ("\n");
-
- walk = g_list_next (walk);
- }
-}
-
-static void
-gst_type_handle_src (guint16 id, GstElementFactory *src, gboolean remove)
-{
- GList *walk;
- GstType *type = gst_type_find_by_id (id);
-
- g_return_if_fail (type != NULL);
- g_return_if_fail (src != NULL);
-
- if (remove)
- type->srcs = g_list_remove (type->srcs, src);
- else
- type->srcs = g_list_prepend (type->srcs, src);
-
- // find out if the element has to be indexed in the matrix
- walk = src->padtemplates;
-
- while (walk) {
- GstPadTemplate *template;
-
- template = (GstPadTemplate *) walk->data;
-
- if (template->direction == GST_PAD_SINK) {
- GstType *type2;
- GList *converters;
- GList *orig;
- GstCaps *caps;
-
- caps = template->caps;
-
- if (caps)
- type2 = gst_type_find_by_id (caps->id);
- else
- goto next;
-
- converters = (GList *)g_hash_table_lookup (type2->converters, GUINT_TO_POINTER ((guint)id));
- orig = converters;
-
- while (converters) {
- if (converters->data == src) {
- break;
- }
- converters = g_list_next (converters);
- }
-
- if (remove)
- orig = g_list_remove (orig, src);
- else if (!converters)
- orig = g_list_prepend (orig, src);
-
- g_hash_table_insert (type2->converters, GUINT_TO_POINTER ((guint)id), orig);
- }
-next:
- walk = g_list_next (walk);
- }
-}
-
-/**
- * gst_type_add_src:
- * @id: the type id to add the source factory to
- * @src: the source factory for the type
- *
- * register the src factory as being a source for the
- * given type id
- */
-void
-_gst_type_add_src (guint16 id, GstElementFactory *src)
-{
- gst_type_handle_src (id, src, FALSE);
-}
-
-/**
- * gst_type_remove_src:
- * @id: the type id to add the source factory to
- * @src: the source factory for the type
- *
- * register the src factory as being a source for the
- * given type id
- */
-void
-_gst_type_remove_src (guint16 id, GstElementFactory *src)
-{
- gst_type_handle_src (id, src, TRUE);
-}
-
-static void
-gst_type_handle_sink (guint16 id, GstElementFactory *sink, gboolean remove)
-{
- GList *walk;
- GstType *type = gst_type_find_by_id (id);
-
- g_return_if_fail (type != NULL);
- g_return_if_fail (sink != NULL);
-
- if (remove)
- type->sinks = g_list_remove (type->sinks, sink);
- else
- type->sinks = g_list_prepend (type->sinks, sink);
-
- // find out if the element has to be indexed in the matrix
- walk = sink->padtemplates;
-
- while (walk) {
- GstPadTemplate *template;
-
- template = (GstPadTemplate *) walk->data;
-
- if (template->direction == GST_PAD_SRC) {
- guint16 id2;
- GList *converters;
- GList *orig;
- GstCaps *caps;
-
- caps = template->caps;
-
- if (caps)
- id2 = caps->id;
- else
- goto next;
-
- converters = (GList *)g_hash_table_lookup (type->converters, GUINT_TO_POINTER ((guint)id2));
- orig = converters;
-
- while (converters) {
- if (converters->data == sink) {
- break;
- }
- converters = g_list_next (converters);
- }
-
- if (remove)
- orig = g_list_remove (orig, sink);
- else if (!converters)
- orig = g_list_prepend (orig, sink);
-
- g_hash_table_insert (type->converters, GUINT_TO_POINTER ((guint)id2), orig);
- }
-next:
- walk = g_list_next (walk);
- }
-}
-
-/**
- * gst_type_add_sink:
- * @id: the type id to add the sink factory to
- * @sink: the sink factory for the type
- *
- * register the sink factory as being a sink for the
- * given type id
- */
-void
-_gst_type_add_sink (guint16 id, GstElementFactory *sink)
-{
- gst_type_handle_sink (id, sink, FALSE);
-}
-
-/**
- * gst_type_remove_sink:
- * @id: the type id to remove the sink factory from
- * @sink: the sink factory for the type
- *
- * remove the sink factory as being a sink for the
- * given type id
- */
-void
-_gst_type_remove_sink (guint16 id, GstElementFactory *sink)
-{
- gst_type_handle_sink (id, sink, TRUE);
-}
-
-/**
- * gst_type_get_srcs:
- * @id: the id to fetch the source factories for
- *
- * return a list of elementfactories that source
- * the given type id
- *
- * Returns: a list of elementfactories
- */
-GList*
-gst_type_get_srcs (guint16 id)
-{
- GstType *type = gst_type_find_by_id (id);
-
- g_return_val_if_fail (type != NULL, NULL);
-
- return type->srcs;
-}
-
-/**
- * gst_type_get_sinks:
- * @id: the id to fetch the sink factories for
- *
- * return a list of elementfactories that sink
- * the given type id
- *
- * Returns: a list of elementfactories
- */
-GList*
-gst_type_get_sinks (guint16 id)
-{
- GstType *type = gst_type_find_by_id (id);
-
- g_return_val_if_fail (type != 0, NULL);
-
- return type->sinks;
-}
-
-/*
- * An implementation of Dijkstra's shortest path
- * algorithm to find the best set of GstElementFactories
- * to connnect two GstTypes
- *
- **/
-static GList*
-gst_type_enqueue (GList *queue, gint iNode, gint iDist, gint iPrev)
-{
- gst_type_node *node = g_malloc (sizeof (gst_type_node));
-
- node->iNode = iNode;
- node->iDist = iDist;
- node->iPrev = iPrev;
-
- queue = g_list_append (queue, node);
-
- return queue;
-}
-
-static GList*
-gst_type_dequeue (GList *queue, gint *iNode, gint *iDist, gint *iPrev)
-{
- GList *head;
- gst_type_node *node;
-
- head = g_list_first (queue);
-
- if (head) {
- node = (gst_type_node *)head->data;
- *iNode = node->iNode;
- *iPrev = node->iPrev;
- *iDist = node->iDist;
- head = g_list_remove (queue, node);
- }
-
- return head;
-}
-
-static GList*
-construct_path (gst_type_node *rgnNodes, gint chNode)
-{
- guint src = chNode;
- guint current = rgnNodes[chNode].iPrev;
- GList *factories = NULL;
- GstType *type;
- GList *converters;
-
- g_print ("gsttype: constructed mime path ");
- while (current != MAX_COST)
- {
- type = gst_type_find_by_id (current);
- converters = (GList *)g_hash_table_lookup (type->converters, GUINT_TO_POINTER (src));
-
- g_print ("(%d %d)", src, current);
- factories = g_list_prepend (factories, converters->data);
- src = current;
- current = rgnNodes[current].iPrev;
- }
- g_print("\n");
- return factories;
-}
-
-static guint
-gst_type_find_cost (gint src, gint dest)
-{
- GstType *type = gst_type_find_by_id (src);
-
- GList *converters = (GList *)g_hash_table_lookup (type->converters, GUINT_TO_POINTER (dest));
-
- // FIXME do something very clever here...
- if (converters) return 1;
- return MAX_COST;
-}
-
-static GList*
-gst_type_find_identity (gint typeid)
-{
- GstType *type = gst_type_find_by_id (typeid);
-
- return (GList *)g_hash_table_lookup (type->converters, GUINT_TO_POINTER (typeid));
-}
-
-/**
- * gst_type_get_sink_to_src:
- * @sinkid: the id of the sink
- * @srcid: the id of the source
- *
- * return a list of elementfactories that convert the source
- * type id to the sink type id
- *
- * Returns: a list of elementfactories
- */
-GList*
-gst_type_get_sink_to_src (guint16 sinkid, guint16 srcid)
-{
- gst_type_node *rgnNodes;
- 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 gst_type_find_identity (sinkid);
- }
- else {
- rgnNodes = g_malloc (sizeof (gst_type_node) * _gst_maxtype);
-
- for (i=0; i< _gst_maxtype; i++) {
- rgnNodes[i].iNode = i;
- rgnNodes[i].iDist = MAX_COST;
- rgnNodes[i].iPrev = MAX_COST;
- }
- rgnNodes[sinkid].iDist = 0;
- rgnNodes[sinkid].iPrev = MAX_COST;
-
- queue = gst_type_enqueue (queue, sinkid, 0, MAX_COST);
-
- while (g_list_length (queue) > 0) {
-
- queue = gst_type_dequeue (queue, &iNode, &iDist, &iPrev);
-
- for (i=0; i< _gst_maxtype; i++) {
- iCost = gst_type_find_cost (iNode, i);
- if (iCost != MAX_COST) {
- if((MAX_COST == rgnNodes[i].iDist) ||
- (rgnNodes[i].iDist > (iCost + iDist))) {
- rgnNodes[i].iDist = iDist + iCost;
- rgnNodes[i].iPrev = iNode;
-
- queue = gst_type_enqueue (queue, i, iDist + iCost, iNode);
- }
- }
- }
- }
- }
-
- return construct_path (rgnNodes, srcid);
-}
-
/**
* gst_type_get_list:
*
}
/**
- * gst_type_save_thyself:
- * @type: the type to save
- * @parent: the parent node to save into
- *
- * save a type into an XML representation
- *
- * Returns: the new xmlNodePtr
- */
-xmlNodePtr
-gst_type_save_thyself (GstType *type, xmlNodePtr parent)
-{
- xmlNewChild (parent, NULL, "mime", type->mime);
-
- return parent;
-}
-
-/**
- * gst_type_load_thyself:
- * @parent: the parent node with the xml information
- *
- * load a type from an XML representation
- *
- * Returns: the loaded type id
- */
-guint16
-gst_type_load_thyself (xmlNodePtr parent)
-{
- xmlNodePtr field = parent->childs;
- guint16 typeid = 0;
-
- while (field) {
- if (!strcmp (field->name, "mime")) {
- typeid = gst_type_find_by_mime (xmlNodeGetContent (field));
- if (!typeid) {
- 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;
- }
- field = field->next;
- }
-
- return typeid;
-}
-
-/**
* gst_typefactory_save_thyself:
* @factory: the type factory to save
* @parent: the parent node to save into
#include <gst/gstbuffer.h>
-#include <gst/gstelement.h>
+#include <gst/gstcaps.h>
/* type of function used to check a stream for equality with type */
GSList *typefindfuncs; /* typefind functions */
- GList *srcs; /* list of src objects for this type */
- GList *sinks; /* list of sink objects for type */
-
- GHashTable *converters; /* a hashtable of factories that can convert
- from this type to destination type. The
- factories are indexed by destination type */
};
struct _GstTypeFactory {
guint16 gst_type_find_by_mime (gchar *mime);
guint16 gst_type_find_by_ext (gchar *ext);
-/* add src or sink object */
-void _gst_type_add_src (guint16 id, GstElementFactory *src);
-void _gst_type_add_sink (guint16 id, GstElementFactory *sink);
-void _gst_type_remove_src (guint16 id, GstElementFactory *src);
-void _gst_type_remove_sink (guint16 id, GstElementFactory *sink);
-/* get list of src or sink objects */
-GList* gst_type_get_srcs (guint16 id);
-GList* gst_type_get_sinks (guint16 id);
-
/* get GstType by id */
GstType* gst_type_find_by_id (guint16 id);
-GList* gst_type_get_sink_to_src (guint16 sinkid, guint16 srcid);
-
/* get the list of registered types (returns list of GstType!) */
GList* gst_type_get_list (void);
-void gst_type_dump (void);
-
-xmlNodePtr gst_type_save_thyself (GstType *type, xmlNodePtr parent);
-guint16 gst_type_load_thyself (xmlNodePtr parent);
-
xmlNodePtr gst_typefactory_save_thyself (GstTypeFactory *factory, xmlNodePtr parent);
GstTypeFactory* gst_typefactory_load_thyself (xmlNodePtr parent);
-noinst_PROGRAMS = init loadall simplefake states caps queue registry paranoia rip mp3encode
+noinst_PROGRAMS = init loadall simplefake states caps queue registry paranoia rip mp3encode autoplug
LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(top_builddir)/gst/libgst.la
CFLAGS = -Wall
GList *srcs, *sinks;
type = gst_type_find_by_mime (mime);
+ /*
srcs = gst_type_get_srcs (type);
while (srcs) {
sinks = g_list_next (sinks);
}
+ */
}
int main(int argc,char *argv[])
dump_plugins ();
dump_factories ();
dump_types ();
- gst_type_dump ();
print_some_providers ("audio/mp3");
load_something ("mpg123");
print_some_providers ("audio/mp3");
- gst_type_dump ();
load_something ("mpg123");
dump_factories ();
dump_types ();
- gst_type_dump ();
-
dump_factory ("lame");
dump_factory ("mpeg_play");
}