2000-12-28 22:12:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
|
|
|
* gstelementfactory.c: GstElementFactory object, support routines
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2001-12-14 22:59:21 +00:00
|
|
|
/* #define DEBUG_ENABLED */
|
2000-12-28 22:12:02 +00:00
|
|
|
#include "gst_private.h"
|
2000-09-27 19:33:10 +00:00
|
|
|
|
2000-12-15 01:57:34 +00:00
|
|
|
#include "gstelement.h"
|
2002-05-08 20:40:48 +00:00
|
|
|
#include "gstregistry.h"
|
2002-07-08 19:07:30 +00:00
|
|
|
#include "gstlog.h"
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
static void gst_element_factory_class_init (GstElementFactoryClass *klass);
|
|
|
|
static void gst_element_factory_init (GstElementFactory *factory);
|
2001-08-21 20:16:48 +00:00
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
static void gst_element_factory_unload_thyself (GstPluginFeature *feature);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2001-08-21 20:16:48 +00:00
|
|
|
static GstPluginFeatureClass *parent_class = NULL;
|
2002-04-11 20:35:18 +00:00
|
|
|
/* static guint gst_element_factory_signals[LAST_SIGNAL] = { 0 }; */
|
2001-08-21 20:16:48 +00:00
|
|
|
|
|
|
|
GType
|
2002-04-11 20:35:18 +00:00
|
|
|
gst_element_factory_get_type (void)
|
2000-12-12 19:29:43 +00:00
|
|
|
{
|
2001-08-21 20:16:48 +00:00
|
|
|
static GType elementfactory_type = 0;
|
|
|
|
|
|
|
|
if (!elementfactory_type) {
|
|
|
|
static const GTypeInfo elementfactory_info = {
|
|
|
|
sizeof (GstElementFactoryClass),
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2002-04-11 20:35:18 +00:00
|
|
|
(GClassInitFunc) gst_element_factory_class_init,
|
2001-08-21 20:16:48 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof(GstElementFactory),
|
|
|
|
0,
|
2002-04-11 20:35:18 +00:00
|
|
|
(GInstanceInitFunc) gst_element_factory_init,
|
2001-09-14 22:16:47 +00:00
|
|
|
NULL
|
2001-08-21 20:16:48 +00:00
|
|
|
};
|
|
|
|
elementfactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE,
|
|
|
|
"GstElementFactory", &elementfactory_info, 0);
|
|
|
|
}
|
|
|
|
return elementfactory_type;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2001-08-21 20:16:48 +00:00
|
|
|
static void
|
2002-04-11 20:35:18 +00:00
|
|
|
gst_element_factory_class_init (GstElementFactoryClass *klass)
|
2000-12-11 00:04:25 +00:00
|
|
|
{
|
2001-08-21 20:16:48 +00:00
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstObjectClass *gstobject_class;
|
|
|
|
GstPluginFeatureClass *gstpluginfeature_class;
|
|
|
|
|
|
|
|
gobject_class = (GObjectClass*)klass;
|
|
|
|
gstobject_class = (GstObjectClass*)klass;
|
|
|
|
gstpluginfeature_class = (GstPluginFeatureClass*) klass;
|
|
|
|
|
|
|
|
parent_class = g_type_class_ref (GST_TYPE_PLUGIN_FEATURE);
|
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
gstpluginfeature_class->unload_thyself = GST_DEBUG_FUNCPTR (gst_element_factory_unload_thyself);
|
2001-08-21 20:16:48 +00:00
|
|
|
|
|
|
|
}
|
2000-12-11 00:04:25 +00:00
|
|
|
|
2001-08-21 20:16:48 +00:00
|
|
|
static void
|
2002-04-11 20:35:18 +00:00
|
|
|
gst_element_factory_init (GstElementFactory *factory)
|
2001-08-21 20:16:48 +00:00
|
|
|
{
|
|
|
|
factory->padtemplates = NULL;
|
|
|
|
factory->numpadtemplates = 0;
|
2000-12-11 00:04:25 +00:00
|
|
|
}
|
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
/**
|
2002-04-11 20:35:18 +00:00
|
|
|
* gst_element_factory_find:
|
2000-01-30 09:03:00 +00:00
|
|
|
* @name: name of factory to find
|
|
|
|
*
|
2002-04-12 18:26:17 +00:00
|
|
|
* Search for an element factory of the given name.
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
|
|
|
* Returns: #GstElementFactory if found, NULL otherwise
|
|
|
|
*/
|
2000-12-12 19:29:43 +00:00
|
|
|
GstElementFactory*
|
2002-04-11 20:35:18 +00:00
|
|
|
gst_element_factory_find (const gchar *name)
|
2000-12-12 19:29:43 +00:00
|
|
|
{
|
2002-05-08 20:40:48 +00:00
|
|
|
GstPluginFeature *feature;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-12-23 03:17:52 +00:00
|
|
|
g_return_val_if_fail(name != NULL, NULL);
|
|
|
|
|
2002-05-08 20:40:48 +00:00
|
|
|
feature = gst_registry_pool_find_feature (name, GST_TYPE_ELEMENT_FACTORY);
|
|
|
|
if (feature)
|
|
|
|
return GST_ELEMENT_FACTORY (feature);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2001-12-14 22:59:21 +00:00
|
|
|
/* this should be an ERROR */
|
2002-04-11 20:35:18 +00:00
|
|
|
GST_DEBUG (GST_CAT_ELEMENT_FACTORY,"no such elementfactory \"%s\"", name);
|
2000-01-30 09:03:00 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2001-09-13 20:12:17 +00:00
|
|
|
static void
|
|
|
|
gst_element_details_free (GstElementDetails *dp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (dp);
|
|
|
|
|
|
|
|
if (dp->longname)
|
|
|
|
g_free (dp->longname);
|
|
|
|
if (dp->klass)
|
|
|
|
g_free (dp->klass);
|
|
|
|
if (dp->description)
|
|
|
|
g_free (dp->description);
|
|
|
|
if (dp->version)
|
|
|
|
g_free (dp->version);
|
|
|
|
if (dp->author)
|
|
|
|
g_free (dp->author);
|
|
|
|
if (dp->copyright)
|
|
|
|
g_free (dp->copyright);
|
|
|
|
g_free (dp);
|
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/**
|
2002-04-11 20:35:18 +00:00
|
|
|
* gst_element_factory_new:
|
2000-01-30 09:03:00 +00:00
|
|
|
* @name: name of new elementfactory
|
2001-06-25 01:20:11 +00:00
|
|
|
* @type: GType of new element
|
2000-01-30 09:03:00 +00:00
|
|
|
* @details: #GstElementDetails structure with element details
|
|
|
|
*
|
|
|
|
* Create a new elementfactory capable of insantiating objects of the
|
|
|
|
* given type.
|
|
|
|
*
|
|
|
|
* Returns: new elementfactory
|
|
|
|
*/
|
2000-12-12 19:29:43 +00:00
|
|
|
GstElementFactory*
|
2002-04-11 20:35:18 +00:00
|
|
|
gst_element_factory_new (const gchar *name, GType type,
|
2001-03-07 21:52:56 +00:00
|
|
|
GstElementDetails *details)
|
2000-12-12 19:29:43 +00:00
|
|
|
{
|
2001-03-07 21:52:56 +00:00
|
|
|
GstElementFactory *factory;
|
2000-12-19 13:41:55 +00:00
|
|
|
|
2000-12-23 03:17:52 +00:00
|
|
|
g_return_val_if_fail(name != NULL, NULL);
|
2001-09-14 22:16:47 +00:00
|
|
|
g_return_val_if_fail (type, NULL);
|
2001-09-13 20:12:17 +00:00
|
|
|
g_return_val_if_fail (details, NULL);
|
2000-12-23 03:17:52 +00:00
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
factory = gst_element_factory_find (name);
|
2001-09-13 01:15:25 +00:00
|
|
|
|
2001-09-13 20:12:17 +00:00
|
|
|
if (!factory)
|
2002-04-11 20:35:18 +00:00
|
|
|
factory = GST_ELEMENT_FACTORY (g_object_new (GST_TYPE_ELEMENT_FACTORY, NULL));
|
2001-09-13 01:15:25 +00:00
|
|
|
|
2002-05-08 20:40:48 +00:00
|
|
|
if (factory->details_dynamic) {
|
|
|
|
gst_element_details_free (factory->details);
|
|
|
|
factory->details_dynamic = FALSE;
|
|
|
|
}
|
2001-09-13 01:15:25 +00:00
|
|
|
|
2001-09-13 20:12:17 +00:00
|
|
|
factory->details = details;
|
|
|
|
|
|
|
|
if (!factory->type)
|
|
|
|
factory->type = type;
|
|
|
|
else if (factory->type != type)
|
|
|
|
g_critical ("`%s' requested type change (!)", name);
|
2002-02-20 21:31:16 +00:00
|
|
|
|
2002-05-08 20:40:48 +00:00
|
|
|
GST_PLUGIN_FEATURE (factory)->name = g_strdup (name);
|
2000-12-19 13:41:55 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
return factory;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2002-04-11 20:35:18 +00:00
|
|
|
* gst_element_factory_create:
|
2000-01-30 09:03:00 +00:00
|
|
|
* @factory: factory to instantiate
|
|
|
|
* @name: name of new element
|
|
|
|
*
|
|
|
|
* Create a new element of the type defined by the given elementfactory.
|
2002-04-21 14:06:14 +00:00
|
|
|
* It will be given the name supplied, since all elements require a name as
|
2000-01-30 09:03:00 +00:00
|
|
|
* their first argument.
|
|
|
|
*
|
|
|
|
* Returns: new #GstElement
|
|
|
|
*/
|
2000-12-12 19:29:43 +00:00
|
|
|
GstElement *
|
2002-04-11 20:35:18 +00:00
|
|
|
gst_element_factory_create (GstElementFactory *factory,
|
2001-03-07 21:52:56 +00:00
|
|
|
const gchar *name)
|
2000-12-12 19:29:43 +00:00
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
GstElement *element;
|
|
|
|
GstElementClass *oclass;
|
|
|
|
|
2000-03-13 22:13:11 +00:00
|
|
|
g_return_val_if_fail(factory != NULL, NULL);
|
2000-08-28 20:20:55 +00:00
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
GST_DEBUG (GST_CAT_ELEMENT_FACTORY,"creating element from factory \"%s\" with name \"%s\" and type %d",
|
2002-03-04 22:01:42 +00:00
|
|
|
GST_OBJECT_NAME (factory), name, (gint) factory->type);
|
2001-08-21 20:16:48 +00:00
|
|
|
|
2001-10-21 18:00:31 +00:00
|
|
|
if (!gst_plugin_feature_ensure_loaded (GST_PLUGIN_FEATURE (factory)))
|
|
|
|
return NULL;
|
2000-08-28 20:20:55 +00:00
|
|
|
|
2001-10-21 18:00:31 +00:00
|
|
|
if (factory->type == 0) {
|
2001-09-13 01:15:25 +00:00
|
|
|
g_critical ("Factory for `%s' has no type",
|
2002-05-08 20:40:48 +00:00
|
|
|
GST_PLUGIN_FEATURE_NAME (factory));
|
2001-09-13 01:15:25 +00:00
|
|
|
return NULL;
|
2001-10-21 18:00:31 +00:00
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2001-12-14 22:59:21 +00:00
|
|
|
/* create an instance of the element */
|
2001-06-25 01:20:11 +00:00
|
|
|
element = GST_ELEMENT(g_object_new(factory->type,NULL));
|
2000-01-30 09:03:00 +00:00
|
|
|
g_assert(element != NULL);
|
|
|
|
|
2001-12-14 22:59:21 +00:00
|
|
|
/* attempt to set the elemenfactory class pointer if necessary */
|
2001-06-25 01:20:11 +00:00
|
|
|
oclass = GST_ELEMENT_CLASS(G_OBJECT_GET_CLASS(element));
|
2000-12-22 23:23:10 +00:00
|
|
|
if (oclass->elementfactory == NULL) {
|
2002-04-11 20:35:18 +00:00
|
|
|
GST_DEBUG (GST_CAT_ELEMENT_FACTORY,"class %s", GST_OBJECT_NAME (factory));
|
2000-01-30 09:03:00 +00:00
|
|
|
oclass->elementfactory = factory;
|
2001-12-15 22:37:35 +00:00
|
|
|
|
2002-02-18 00:40:56 +00:00
|
|
|
/* copy pad template pointers to the element class, allow for custom padtemplates */
|
2002-05-08 20:40:48 +00:00
|
|
|
oclass->padtemplates = g_list_concat (oclass->padtemplates,
|
|
|
|
g_list_copy (factory->padtemplates));
|
2002-02-18 00:40:56 +00:00
|
|
|
oclass->numpadtemplates += factory->numpadtemplates;
|
2000-12-22 23:23:10 +00:00
|
|
|
}
|
2002-04-26 15:02:34 +00:00
|
|
|
|
|
|
|
gst_object_set_name (GST_OBJECT (element), name);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
2000-09-14 20:31:03 +00:00
|
|
|
/**
|
2002-04-11 20:35:18 +00:00
|
|
|
* gst_element_factory_make:
|
2000-09-14 20:31:03 +00:00
|
|
|
* @factoryname: a named factory to instantiate
|
|
|
|
* @name: name of new element
|
|
|
|
*
|
2002-04-21 14:06:14 +00:00
|
|
|
* Create a new element of the type defined by the given element factory.
|
|
|
|
* If name is NULL, then the element will receive a guaranteed unique name,
|
|
|
|
* consisting of the element factory name and a number.
|
|
|
|
* If name is given, it will be given the name supplied.
|
2000-09-14 20:31:03 +00:00
|
|
|
*
|
2002-02-19 16:08:23 +00:00
|
|
|
* Returns: new #GstElement (or NULL if unable to create element)
|
2000-09-14 20:31:03 +00:00
|
|
|
*/
|
2000-12-12 19:29:43 +00:00
|
|
|
GstElement*
|
2002-04-11 20:35:18 +00:00
|
|
|
gst_element_factory_make (const gchar *factoryname, const gchar *name)
|
2000-12-12 19:29:43 +00:00
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
GstElementFactory *factory;
|
|
|
|
GstElement *element;
|
|
|
|
|
2001-08-21 20:16:48 +00:00
|
|
|
g_return_val_if_fail (factoryname != NULL, NULL);
|
2000-12-23 03:17:52 +00:00
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
GST_DEBUG (GST_CAT_ELEMENT_FACTORY, "gstelementfactory: make \"%s\" \"%s\"", factoryname, name);
|
2000-09-27 19:33:10 +00:00
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
/* gst_plugin_load_element_factory(factoryname); */
|
|
|
|
factory = gst_element_factory_find(factoryname);
|
2001-08-21 19:30:45 +00:00
|
|
|
if (factory == NULL) {
|
2002-04-11 20:35:18 +00:00
|
|
|
GST_INFO (GST_CAT_ELEMENT_FACTORY,"no such elementfactory \"%s\"!",factoryname);
|
2001-08-21 19:30:45 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2002-04-26 15:02:34 +00:00
|
|
|
element = gst_element_factory_create (factory, name);
|
2001-08-21 19:30:45 +00:00
|
|
|
if (element == NULL) {
|
2002-04-11 20:35:18 +00:00
|
|
|
GST_INFO (GST_CAT_ELEMENT_FACTORY,"couldn't create instance of elementfactory \"%s\"!",factoryname);
|
2001-08-21 19:30:45 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2001-08-21 20:16:48 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
return element;
|
|
|
|
}
|
2000-08-21 21:20:38 +00:00
|
|
|
|
2002-06-13 15:08:52 +00:00
|
|
|
/**
|
|
|
|
* gst_element_factory_make_or_warn:
|
|
|
|
* @factoryname: a named factory to instantiate
|
|
|
|
* @name: name of new element
|
|
|
|
*
|
|
|
|
* Create a new element of the type defined by the given element factory
|
|
|
|
* using #gst_element_factory_make.
|
|
|
|
* Will use g_warning if the element could not be created.
|
|
|
|
*
|
|
|
|
* Returns: new #GstElement (or NULL if unable to create element)
|
|
|
|
*/
|
|
|
|
GstElement*
|
|
|
|
gst_element_factory_make_or_warn (const gchar *factoryname, const gchar *name)
|
|
|
|
{
|
|
|
|
GstElement *element = gst_element_factory_make (factoryname, name);
|
|
|
|
|
|
|
|
if (element == NULL)
|
|
|
|
g_warning ("Could not create element from factory %s !\n", factoryname);
|
|
|
|
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
2000-09-14 20:31:03 +00:00
|
|
|
/**
|
2002-04-11 20:35:18 +00:00
|
|
|
* gst_element_factory_add_pad_template :
|
2000-09-14 20:31:03 +00:00
|
|
|
* @elementfactory: factory to add the src id to
|
2001-01-19 22:15:21 +00:00
|
|
|
* @templ: the padtemplate to add
|
2000-09-14 20:31:03 +00:00
|
|
|
*
|
2001-01-19 22:15:21 +00:00
|
|
|
* Add the given padtemplate to this elementfactory.
|
2000-09-14 20:31:03 +00:00
|
|
|
*/
|
2001-01-19 22:15:21 +00:00
|
|
|
void
|
2002-04-11 20:35:18 +00:00
|
|
|
gst_element_factory_add_pad_template (GstElementFactory *factory,
|
2001-01-19 22:15:21 +00:00
|
|
|
GstPadTemplate *templ)
|
2000-12-11 00:04:25 +00:00
|
|
|
{
|
2001-08-21 20:16:48 +00:00
|
|
|
GList *padtemplates;
|
|
|
|
|
2000-12-11 00:04:25 +00:00
|
|
|
g_return_if_fail(factory != NULL);
|
2001-01-19 22:15:21 +00:00
|
|
|
g_return_if_fail(templ != NULL);
|
2000-12-11 00:04:25 +00:00
|
|
|
|
2001-08-21 20:16:48 +00:00
|
|
|
padtemplates = factory->padtemplates;
|
2001-09-29 09:53:07 +00:00
|
|
|
|
|
|
|
gst_object_ref (GST_OBJECT (templ));
|
|
|
|
|
2001-08-21 20:16:48 +00:00
|
|
|
while (padtemplates) {
|
2002-04-11 20:35:18 +00:00
|
|
|
GstPadTemplate *oldtempl = GST_PAD_TEMPLATE (padtemplates->data);
|
2001-08-21 20:16:48 +00:00
|
|
|
|
|
|
|
if (!strcmp (oldtempl->name_template, templ->name_template)) {
|
|
|
|
gst_object_unref (GST_OBJECT (oldtempl));
|
|
|
|
padtemplates->data = templ;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
padtemplates = g_list_next (padtemplates);
|
|
|
|
}
|
2001-01-19 22:15:21 +00:00
|
|
|
factory->padtemplates = g_list_append (factory->padtemplates, templ);
|
2001-01-03 20:44:28 +00:00
|
|
|
factory->numpadtemplates++;
|
2000-12-19 13:41:55 +00:00
|
|
|
}
|
2000-08-21 21:20:38 +00:00
|
|
|
|
2000-12-28 21:42:23 +00:00
|
|
|
/**
|
2002-04-11 20:35:18 +00:00
|
|
|
* gst_element_factory_can_src_caps :
|
2000-12-28 21:42:23 +00:00
|
|
|
* @factory: factory to query
|
2001-03-12 21:02:12 +00:00
|
|
|
* @caps: the caps to check
|
2000-12-28 21:42:23 +00:00
|
|
|
*
|
2001-03-12 21:02:12 +00:00
|
|
|
* Checks if the factory can source the given capability.
|
2000-12-28 21:42:23 +00:00
|
|
|
*
|
2000-12-31 16:12:48 +00:00
|
|
|
* Returns: true if it can src the capabilities
|
2000-12-28 21:42:23 +00:00
|
|
|
*/
|
2000-12-19 13:41:55 +00:00
|
|
|
gboolean
|
2002-04-11 20:35:18 +00:00
|
|
|
gst_element_factory_can_src_caps (GstElementFactory *factory,
|
2001-03-12 21:02:12 +00:00
|
|
|
GstCaps *caps)
|
2000-12-19 13:41:55 +00:00
|
|
|
{
|
|
|
|
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) {
|
2002-04-11 20:35:18 +00:00
|
|
|
if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (template), caps))
|
2000-12-19 13:41:55 +00:00
|
|
|
return TRUE;
|
2000-12-12 19:29:43 +00:00
|
|
|
}
|
2000-12-19 13:41:55 +00:00
|
|
|
templates = g_list_next (templates);
|
2000-12-11 00:04:25 +00:00
|
|
|
}
|
2000-12-19 13:41:55 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-12-28 21:42:23 +00:00
|
|
|
/**
|
2002-04-11 20:35:18 +00:00
|
|
|
* gst_element_factory_can_sink_caps :
|
2000-12-28 21:42:23 +00:00
|
|
|
* @factory: factory to query
|
2001-03-12 21:02:12 +00:00
|
|
|
* @caps: the caps to check
|
2000-12-28 21:42:23 +00:00
|
|
|
*
|
2001-03-12 21:02:12 +00:00
|
|
|
* Checks if the factory can sink the given capability.
|
2000-12-28 21:42:23 +00:00
|
|
|
*
|
2000-12-31 16:12:48 +00:00
|
|
|
* Returns: true if it can sink the capabilities
|
2000-12-28 21:42:23 +00:00
|
|
|
*/
|
2000-12-19 13:41:55 +00:00
|
|
|
gboolean
|
2002-04-11 20:35:18 +00:00
|
|
|
gst_element_factory_can_sink_caps (GstElementFactory *factory,
|
2001-03-12 21:02:12 +00:00
|
|
|
GstCaps *caps)
|
2000-12-19 13:41:55 +00:00
|
|
|
{
|
|
|
|
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) {
|
2002-04-11 20:35:18 +00:00
|
|
|
if (gst_caps_check_compatibility (caps, GST_PAD_TEMPLATE_CAPS (template)))
|
2000-12-19 13:41:55 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
templates = g_list_next (templates);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
2000-08-21 21:20:38 +00:00
|
|
|
}
|
|
|
|
|
2002-05-31 08:17:15 +00:00
|
|
|
/**
|
|
|
|
* gst_element_factory_set_rank :
|
|
|
|
* @factory: factory to rank
|
|
|
|
* @rank: rank value - higher number means more priority rank
|
|
|
|
*
|
|
|
|
* Specifies a rank for the element so that
|
|
|
|
* autoplugging uses the most appropriate elements.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_element_factory_set_rank (GstElementFactory *factory, guint16 rank)
|
|
|
|
{
|
|
|
|
g_return_if_fail(factory != NULL);
|
|
|
|
factory->rank = rank;
|
|
|
|
}
|
|
|
|
|
2001-08-21 20:16:48 +00:00
|
|
|
static void
|
2002-04-11 20:35:18 +00:00
|
|
|
gst_element_factory_unload_thyself (GstPluginFeature *feature)
|
2001-08-21 20:16:48 +00:00
|
|
|
{
|
|
|
|
GstElementFactory *factory;
|
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
factory = GST_ELEMENT_FACTORY (feature);
|
2001-08-21 20:16:48 +00:00
|
|
|
|
|
|
|
factory->type = 0;
|
|
|
|
}
|