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 >
2003-10-31 19:32:47 +00:00
* 2003 Benjamin Otte < in7y118 @ public . uni - hamburg . de >
2000-12-28 22:12:02 +00:00
*
* 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 .
*/
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"
2003-02-10 20:32:32 +00:00
# include "gstregistrypool.h"
2003-06-29 14:05:49 +00:00
# include "gstinfo.h"
2003-11-24 03:21:54 +00:00
# include "gsturi.h"
2004-12-16 10:40:05 +00:00
# ifndef GST_DISABLE_REGISTRY
2004-06-16 21:06:50 +00:00
# include "registries/gstxmlregistry.h" /* g_critical in gst_element_factory_create */
2004-12-16 10:40:05 +00:00
# endif
2000-01-30 09:03:00 +00:00
2003-10-31 19:32:47 +00:00
GST_DEBUG_CATEGORY_STATIC ( element_factory_debug ) ;
# define GST_CAT_DEFAULT element_factory_debug
2003-07-05 15:05:23 +00:00
2004-03-13 15:27:01 +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
2004-03-13 15:27:01 +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 ;
2004-03-13 15:27:01 +00:00
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
2004-03-13 15:27:01 +00:00
GType
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 ,
2004-03-13 15:27:01 +00:00
sizeof ( GstElementFactory ) ,
2001-08-21 20:16:48 +00:00
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
} ;
2004-03-15 19:27:17 +00:00
2004-03-13 15:27:01 +00:00
elementfactory_type = g_type_register_static ( GST_TYPE_PLUGIN_FEATURE ,
2004-03-15 19:27:17 +00:00
" GstElementFactory " , & elementfactory_info , 0 ) ;
2004-03-13 15:27:01 +00:00
GST_DEBUG_CATEGORY_INIT ( element_factory_debug , " GST_ELEMENT_FACTORY " ,
2004-03-15 19:27:17 +00:00
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED ,
" element factories keep information about installed elements " ) ;
2001-08-21 20:16:48 +00:00
}
return elementfactory_type ;
2000-01-30 09:03:00 +00:00
}
2001-08-21 20:16:48 +00:00
static void
2004-03-13 15:27:01 +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 ;
2004-03-13 15:27:01 +00:00
gobject_class = ( GObjectClass * ) klass ;
gstobject_class = ( GstObjectClass * ) klass ;
gstpluginfeature_class = ( GstPluginFeatureClass * ) klass ;
2001-08-21 20:16:48 +00:00
2003-10-31 19:32:47 +00:00
parent_class = g_type_class_peek_parent ( klass ) ;
2001-08-21 20:16:48 +00:00
2004-03-13 15:27:01 +00:00
gstpluginfeature_class - > unload_thyself =
GST_DEBUG_FUNCPTR ( gst_element_factory_unload_thyself ) ;
2001-08-21 20:16:48 +00:00
}
static void
2004-03-13 15:27:01 +00:00
gst_element_factory_init ( GstElementFactory * factory )
2001-08-21 20:16:48 +00:00
{
Use libxml2 for registry parsing, use staticpadtemplates in elementfactories. Makes gst_init() +/- 10x faster.
Original commit message from CVS:
* docs/gst/tmpl/gstelementfactory.sgml:
* gst/gstelement.h:
* gst/gstelementfactory.c: (gst_element_factory_init),
(gst_element_factory_cleanup), (gst_element_register),
(__gst_element_factory_add_static_pad_template),
(gst_element_factory_get_static_pad_templates),
(gst_element_factory_can_src_caps),
(gst_element_factory_can_sink_caps):
* gst/registries/Makefile.am:
* gst/registries/gstlibxmlregistry.c: (gst_xml_registry_get_type),
(gst_xml_registry_class_init), (gst_xml_registry_init),
(gst_xml_registry_new), (gst_xml_registry_set_property),
(gst_xml_registry_get_property), (get_time), (make_dir),
(gst_xml_registry_get_perms_func),
(plugin_times_older_than_recurse), (plugin_times_older_than),
(gst_xml_registry_open_func), (gst_xml_registry_load_func),
(gst_xml_registry_save_func), (gst_xml_registry_close_func),
(add_to_char_array), (read_string), (read_uint), (read_enum),
(load_pad_template), (load_feature), (load_plugin), (load_paths),
(gst_xml_registry_load), (gst_xml_registry_load_plugin),
(gst_xml_registry_save_caps), (gst_xml_registry_save_pad_template),
(gst_xml_registry_save_feature), (gst_xml_registry_save_plugin),
(gst_xml_registry_save), (gst_xml_registry_rebuild_recurse),
(gst_xml_registry_rebuild):
* gst/registries/gstlibxmlregistry.h:
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_pad_templates_info):
* tools/gst-xmlinspect.c: (print_element_info):
Use libxml2 for registry parsing, use staticpadtemplates in
elementfactories. Makes gst_init() +/- 10x faster.
2005-04-12 15:00:30 +00:00
factory - > staticpadtemplates = NULL ;
2001-08-21 20:16:48 +00:00
factory - > numpadtemplates = 0 ;
2003-11-24 02:09:23 +00:00
2003-11-24 03:21:54 +00:00
factory - > uri_type = GST_URI_UNKNOWN ;
factory - > uri_protocols = NULL ;
2003-11-24 02:09:23 +00:00
factory - > interfaces = NULL ;
2000-12-11 00:04:25 +00:00
}
2004-03-13 15:27:01 +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
*/
2004-03-13 15:27:01 +00:00
GstElementFactory *
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
2004-03-13 15:27:01 +00:00
g_return_val_if_fail ( name ! = NULL , NULL ) ;
2000-12-23 03:17:52 +00:00
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
2004-02-20 13:18:32 +00:00
/* this isn't an error, for instance when you query if an element factory is
* present */
GST_LOG ( " no such element factory \" %s \" " , name ) ;
2000-01-30 09:03:00 +00:00
return NULL ;
}
2003-11-02 16:24:22 +00:00
2003-10-31 19:32:47 +00:00
void
2004-03-13 15:27:01 +00:00
__gst_element_details_clear ( GstElementDetails * dp )
2001-09-13 20:12:17 +00:00
{
2003-01-17 18:50:07 +00:00
g_free ( dp - > longname ) ;
2003-10-31 19:32:47 +00:00
dp - > longname = NULL ;
2003-01-17 18:50:07 +00:00
g_free ( dp - > klass ) ;
2003-10-31 19:32:47 +00:00
dp - > klass = NULL ;
2003-01-17 18:50:07 +00:00
g_free ( dp - > description ) ;
2003-10-31 19:32:47 +00:00
dp - > description = NULL ;
2003-01-17 18:50:07 +00:00
g_free ( dp - > author ) ;
2003-10-31 19:32:47 +00:00
dp - > author = NULL ;
}
2004-03-13 15:27:01 +00:00
2004-07-20 10:18:48 +00:00
# define VALIDATE_SET(__dest, __src, __entry) \
G_STMT_START { \
if ( g_utf8_validate ( __src - > __entry , - 1 , NULL ) ) { \
__dest - > __entry = g_strdup ( __src - > __entry ) ; \
} else { \
g_warning ( " Invalid UTF-8 in " G_STRINGIFY ( __entry ) " : %s " , \
__src - > __entry ) ; \
__dest - > __entry = g_strdup ( " [ERROR: invalid UTF-8] " ) ; \
} \
} G_STMT_END
2003-10-31 19:32:47 +00:00
void
2004-03-13 15:27:01 +00:00
__gst_element_details_set ( GstElementDetails * dest ,
const GstElementDetails * src )
2003-10-31 19:32:47 +00:00
{
2004-07-20 10:18:48 +00:00
VALIDATE_SET ( dest , src , longname ) ;
VALIDATE_SET ( dest , src , klass ) ;
VALIDATE_SET ( dest , src , description ) ;
VALIDATE_SET ( dest , src , author ) ;
2003-10-31 19:32:47 +00:00
}
2004-03-13 15:27:01 +00:00
2003-10-31 19:32:47 +00:00
void
2004-03-13 15:27:01 +00:00
__gst_element_details_copy ( GstElementDetails * dest ,
const GstElementDetails * src )
2003-10-31 19:32:47 +00:00
{
__gst_element_details_clear ( dest ) ;
__gst_element_details_set ( dest , src ) ;
2001-09-13 20:12:17 +00:00
}
2004-07-20 10:18:48 +00:00
2003-01-17 18:50:07 +00:00
static void
2004-03-13 15:27:01 +00:00
gst_element_factory_cleanup ( GstElementFactory * factory )
2003-01-17 18:50:07 +00:00
{
Use libxml2 for registry parsing, use staticpadtemplates in elementfactories. Makes gst_init() +/- 10x faster.
Original commit message from CVS:
* docs/gst/tmpl/gstelementfactory.sgml:
* gst/gstelement.h:
* gst/gstelementfactory.c: (gst_element_factory_init),
(gst_element_factory_cleanup), (gst_element_register),
(__gst_element_factory_add_static_pad_template),
(gst_element_factory_get_static_pad_templates),
(gst_element_factory_can_src_caps),
(gst_element_factory_can_sink_caps):
* gst/registries/Makefile.am:
* gst/registries/gstlibxmlregistry.c: (gst_xml_registry_get_type),
(gst_xml_registry_class_init), (gst_xml_registry_init),
(gst_xml_registry_new), (gst_xml_registry_set_property),
(gst_xml_registry_get_property), (get_time), (make_dir),
(gst_xml_registry_get_perms_func),
(plugin_times_older_than_recurse), (plugin_times_older_than),
(gst_xml_registry_open_func), (gst_xml_registry_load_func),
(gst_xml_registry_save_func), (gst_xml_registry_close_func),
(add_to_char_array), (read_string), (read_uint), (read_enum),
(load_pad_template), (load_feature), (load_plugin), (load_paths),
(gst_xml_registry_load), (gst_xml_registry_load_plugin),
(gst_xml_registry_save_caps), (gst_xml_registry_save_pad_template),
(gst_xml_registry_save_feature), (gst_xml_registry_save_plugin),
(gst_xml_registry_save), (gst_xml_registry_rebuild_recurse),
(gst_xml_registry_rebuild):
* gst/registries/gstlibxmlregistry.h:
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_pad_templates_info):
* tools/gst-xmlinspect.c: (print_element_info):
Use libxml2 for registry parsing, use staticpadtemplates in
elementfactories. Makes gst_init() +/- 10x faster.
2005-04-12 15:00:30 +00:00
GList * item ;
2003-10-31 19:32:47 +00:00
__gst_element_details_clear ( & factory - > details ) ;
if ( factory - > type ) {
g_type_class_unref ( g_type_class_peek ( factory - > type ) ) ;
factory - > type = 0 ;
2003-01-17 18:50:07 +00:00
}
Use libxml2 for registry parsing, use staticpadtemplates in elementfactories. Makes gst_init() +/- 10x faster.
Original commit message from CVS:
* docs/gst/tmpl/gstelementfactory.sgml:
* gst/gstelement.h:
* gst/gstelementfactory.c: (gst_element_factory_init),
(gst_element_factory_cleanup), (gst_element_register),
(__gst_element_factory_add_static_pad_template),
(gst_element_factory_get_static_pad_templates),
(gst_element_factory_can_src_caps),
(gst_element_factory_can_sink_caps):
* gst/registries/Makefile.am:
* gst/registries/gstlibxmlregistry.c: (gst_xml_registry_get_type),
(gst_xml_registry_class_init), (gst_xml_registry_init),
(gst_xml_registry_new), (gst_xml_registry_set_property),
(gst_xml_registry_get_property), (get_time), (make_dir),
(gst_xml_registry_get_perms_func),
(plugin_times_older_than_recurse), (plugin_times_older_than),
(gst_xml_registry_open_func), (gst_xml_registry_load_func),
(gst_xml_registry_save_func), (gst_xml_registry_close_func),
(add_to_char_array), (read_string), (read_uint), (read_enum),
(load_pad_template), (load_feature), (load_plugin), (load_paths),
(gst_xml_registry_load), (gst_xml_registry_load_plugin),
(gst_xml_registry_save_caps), (gst_xml_registry_save_pad_template),
(gst_xml_registry_save_feature), (gst_xml_registry_save_plugin),
(gst_xml_registry_save), (gst_xml_registry_rebuild_recurse),
(gst_xml_registry_rebuild):
* gst/registries/gstlibxmlregistry.h:
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_pad_templates_info):
* tools/gst-xmlinspect.c: (print_element_info):
Use libxml2 for registry parsing, use staticpadtemplates in
elementfactories. Makes gst_init() +/- 10x faster.
2005-04-12 15:00:30 +00:00
for ( item = factory - > staticpadtemplates ; item ; item = item - > next ) {
GstStaticPadTemplate * templ = item - > data ;
g_free ( templ - > name_template ) ;
/* FIXME: free caps... */
g_free ( templ ) ;
}
g_list_free ( factory - > staticpadtemplates ) ;
factory - > staticpadtemplates = NULL ;
2003-02-02 19:58:11 +00:00
factory - > numpadtemplates = 0 ;
2003-11-24 03:21:54 +00:00
factory - > uri_type = GST_URI_UNKNOWN ;
if ( factory - > uri_protocols ) {
g_strfreev ( factory - > uri_protocols ) ;
factory - > uri_protocols = NULL ;
}
2004-03-13 15:27:01 +00:00
2003-11-24 02:09:23 +00:00
g_list_foreach ( factory - > interfaces , ( GFunc ) g_free , NULL ) ;
g_list_free ( factory - > interfaces ) ;
factory - > interfaces = NULL ;
2003-01-17 18:50:07 +00:00
}
2004-03-13 15:27:01 +00:00
2000-01-30 09:03:00 +00:00
/**
2003-10-31 19:32:47 +00:00
* gst_element_register :
2004-03-30 09:15:47 +00:00
* @ plugin : # GstPlugin to register the element with
2003-10-31 19:32:47 +00:00
* @ name : name of elements of this type
* @ rank : rank of element ( higher rank means more importance when autoplugging )
* @ type : GType of element to register
2000-01-30 09:03:00 +00:00
*
2004-03-30 09:15:47 +00:00
* Create a new elementfactory capable of instantiating objects of the
2000-01-30 09:03:00 +00:00
* given type .
*
2003-10-31 19:32:47 +00:00
* Returns : TRUE , if the registering succeeded , FALSE on error
2000-01-30 09:03:00 +00:00
*/
2003-10-31 19:32:47 +00:00
gboolean
2004-03-13 15:27:01 +00:00
gst_element_register ( GstPlugin * plugin , const gchar * name , guint rank ,
GType type )
2000-12-12 19:29:43 +00:00
{
2001-03-07 21:52:56 +00:00
GstElementFactory * factory ;
2003-11-24 02:09:23 +00:00
GType * interfaces ;
guint n_interfaces , i ;
2003-10-31 19:32:47 +00:00
GstElementClass * klass ;
Use libxml2 for registry parsing, use staticpadtemplates in elementfactories. Makes gst_init() +/- 10x faster.
Original commit message from CVS:
* docs/gst/tmpl/gstelementfactory.sgml:
* gst/gstelement.h:
* gst/gstelementfactory.c: (gst_element_factory_init),
(gst_element_factory_cleanup), (gst_element_register),
(__gst_element_factory_add_static_pad_template),
(gst_element_factory_get_static_pad_templates),
(gst_element_factory_can_src_caps),
(gst_element_factory_can_sink_caps):
* gst/registries/Makefile.am:
* gst/registries/gstlibxmlregistry.c: (gst_xml_registry_get_type),
(gst_xml_registry_class_init), (gst_xml_registry_init),
(gst_xml_registry_new), (gst_xml_registry_set_property),
(gst_xml_registry_get_property), (get_time), (make_dir),
(gst_xml_registry_get_perms_func),
(plugin_times_older_than_recurse), (plugin_times_older_than),
(gst_xml_registry_open_func), (gst_xml_registry_load_func),
(gst_xml_registry_save_func), (gst_xml_registry_close_func),
(add_to_char_array), (read_string), (read_uint), (read_enum),
(load_pad_template), (load_feature), (load_plugin), (load_paths),
(gst_xml_registry_load), (gst_xml_registry_load_plugin),
(gst_xml_registry_save_caps), (gst_xml_registry_save_pad_template),
(gst_xml_registry_save_feature), (gst_xml_registry_save_plugin),
(gst_xml_registry_save), (gst_xml_registry_rebuild_recurse),
(gst_xml_registry_rebuild):
* gst/registries/gstlibxmlregistry.h:
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_pad_templates_info):
* tools/gst-xmlinspect.c: (print_element_info):
Use libxml2 for registry parsing, use staticpadtemplates in
elementfactories. Makes gst_init() +/- 10x faster.
2005-04-12 15:00:30 +00:00
GList * item ;
2000-12-19 13:41:55 +00:00
2003-10-31 19:32:47 +00:00
g_return_val_if_fail ( name ! = NULL , FALSE ) ;
g_return_val_if_fail ( g_type_is_a ( type , GST_TYPE_ELEMENT ) , FALSE ) ;
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
2003-10-31 19:32:47 +00:00
if ( ! factory ) {
2004-03-13 15:27:01 +00:00
factory =
2004-03-15 19:27:17 +00:00
GST_ELEMENT_FACTORY ( g_object_new ( GST_TYPE_ELEMENT_FACTORY , NULL ) ) ;
2003-10-31 19:32:47 +00:00
gst_plugin_feature_set_name ( GST_PLUGIN_FEATURE ( factory ) , name ) ;
2004-03-13 15:27:01 +00:00
GST_LOG_OBJECT ( factory , " Created new elementfactory for type %s " ,
2004-03-15 19:27:17 +00:00
g_type_name ( type ) ) ;
2004-07-29 15:29:37 +00:00
gst_plugin_add_feature ( plugin , GST_PLUGIN_FEATURE ( factory ) ) ;
2003-10-31 19:32:47 +00:00
} else {
g_return_val_if_fail ( factory - > type = = 0 , FALSE ) ;
2003-01-17 18:50:07 +00:00
gst_element_factory_cleanup ( factory ) ;
2004-03-13 15:27:01 +00:00
GST_LOG_OBJECT ( factory , " Reuse existing elementfactory for type %s " ,
2004-03-15 19:27:17 +00:00
g_type_name ( type ) ) ;
2002-05-08 20:40:48 +00:00
}
2001-09-13 01:15:25 +00:00
2004-07-29 15:29:37 +00:00
klass = GST_ELEMENT_CLASS ( g_type_class_ref ( type ) ) ;
2003-10-31 19:32:47 +00:00
factory - > type = type ;
__gst_element_details_copy ( & factory - > details , & klass - > details ) ;
Use libxml2 for registry parsing, use staticpadtemplates in elementfactories. Makes gst_init() +/- 10x faster.
Original commit message from CVS:
* docs/gst/tmpl/gstelementfactory.sgml:
* gst/gstelement.h:
* gst/gstelementfactory.c: (gst_element_factory_init),
(gst_element_factory_cleanup), (gst_element_register),
(__gst_element_factory_add_static_pad_template),
(gst_element_factory_get_static_pad_templates),
(gst_element_factory_can_src_caps),
(gst_element_factory_can_sink_caps):
* gst/registries/Makefile.am:
* gst/registries/gstlibxmlregistry.c: (gst_xml_registry_get_type),
(gst_xml_registry_class_init), (gst_xml_registry_init),
(gst_xml_registry_new), (gst_xml_registry_set_property),
(gst_xml_registry_get_property), (get_time), (make_dir),
(gst_xml_registry_get_perms_func),
(plugin_times_older_than_recurse), (plugin_times_older_than),
(gst_xml_registry_open_func), (gst_xml_registry_load_func),
(gst_xml_registry_save_func), (gst_xml_registry_close_func),
(add_to_char_array), (read_string), (read_uint), (read_enum),
(load_pad_template), (load_feature), (load_plugin), (load_paths),
(gst_xml_registry_load), (gst_xml_registry_load_plugin),
(gst_xml_registry_save_caps), (gst_xml_registry_save_pad_template),
(gst_xml_registry_save_feature), (gst_xml_registry_save_plugin),
(gst_xml_registry_save), (gst_xml_registry_rebuild_recurse),
(gst_xml_registry_rebuild):
* gst/registries/gstlibxmlregistry.h:
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_pad_templates_info):
* tools/gst-xmlinspect.c: (print_element_info):
Use libxml2 for registry parsing, use staticpadtemplates in
elementfactories. Makes gst_init() +/- 10x faster.
2005-04-12 15:00:30 +00:00
for ( item = klass - > padtemplates ; item ; item = item - > next ) {
GstPadTemplate * templ = item - > data ;
GstStaticPadTemplate * newt ;
newt = g_new0 ( GstStaticPadTemplate , 1 ) ;
newt - > name_template = g_strdup ( templ - > name_template ) ;
newt - > direction = templ - > direction ;
newt - > presence = templ - > presence ;
newt - > static_caps . string = gst_caps_to_string ( templ - > caps ) ;
factory - > staticpadtemplates =
g_list_append ( factory - > staticpadtemplates , newt ) ;
}
2003-10-31 19:32:47 +00:00
factory - > numpadtemplates = klass - > numpadtemplates ;
2004-07-22 16:14:56 +00:00
klass - > elementfactory = factory ;
2001-09-13 20:12:17 +00:00
2003-11-24 03:21:54 +00:00
/* special stuff for URI handling */
if ( g_type_is_a ( type , GST_TYPE_URI_HANDLER ) ) {
2004-03-13 15:27:01 +00:00
GstURIHandlerInterface * iface = ( GstURIHandlerInterface * )
2004-03-15 19:27:17 +00:00
g_type_interface_peek ( klass , GST_TYPE_URI_HANDLER ) ;
2004-03-13 15:27:01 +00:00
2003-11-24 03:21:54 +00:00
if ( ! iface | | ! iface - > get_type | | ! iface - > get_protocols )
goto error ;
factory - > uri_type = iface - > get_type ( ) ;
if ( ! GST_URI_TYPE_IS_VALID ( factory - > uri_type ) )
goto error ;
factory - > uri_protocols = g_strdupv ( iface - > get_protocols ( ) ) ;
if ( ! factory - > uri_protocols )
goto error ;
}
2003-11-24 02:09:23 +00:00
interfaces = g_type_interfaces ( type , & n_interfaces ) ;
for ( i = 0 ; i < n_interfaces ; i + + ) {
__gst_element_factory_add_interface ( factory , g_type_name ( interfaces [ i ] ) ) ;
}
g_free ( interfaces ) ;
2004-03-13 15:27:01 +00:00
2003-10-31 19:32:47 +00:00
gst_plugin_feature_set_rank ( GST_PLUGIN_FEATURE ( factory ) , rank ) ;
2000-12-19 13:41:55 +00:00
2003-10-31 19:32:47 +00:00
return TRUE ;
2003-11-24 03:21:54 +00:00
error :
gst_element_factory_cleanup ( factory ) ;
return FALSE ;
2000-01-30 09:03:00 +00:00
}
2004-03-13 15:27:01 +00:00
2000-01-30 09:03:00 +00:00
/**
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 .
*
2003-10-31 19:32:47 +00:00
* Returns : new # GstElement or NULL if the element couldn ' t be created
2000-01-30 09:03:00 +00:00
*/
2004-03-13 15:27:01 +00:00
GstElement *
gst_element_factory_create ( GstElementFactory * factory , const gchar * name )
2000-12-12 19:29:43 +00:00
{
2000-01-30 09:03:00 +00:00
GstElement * element ;
2003-11-02 16:46:12 +00:00
GstElementClass * oclass ;
2000-01-30 09:03:00 +00:00
2002-08-28 10:45:57 +00:00
g_return_val_if_fail ( factory ! = NULL , NULL ) ;
2000-08-28 20:20:55 +00:00
2003-07-05 15:05:23 +00:00
if ( ! gst_plugin_feature_ensure_loaded ( GST_PLUGIN_FEATURE ( factory ) ) ) {
GST_INFO ( " could not load element factory for element \" %s \" " , name ) ;
2002-08-28 16:07:34 +00:00
return NULL ;
2003-07-05 15:05:23 +00:00
}
2002-08-28 16:07:34 +00:00
2004-02-20 13:18:32 +00:00
if ( name )
GST_INFO ( " creating \" %s \" named \" %s \" " , GST_PLUGIN_FEATURE_NAME ( factory ) ,
2004-03-15 19:27:17 +00:00
GST_STR_NULL ( name ) ) ;
2004-02-20 13:18:32 +00:00
else
GST_INFO ( " creating \" %s \" " , GST_PLUGIN_FEATURE_NAME ( factory ) ) ;
2001-08-21 20:16:48 +00:00
2001-10-21 18:00:31 +00:00
if ( factory - > type = = 0 ) {
2004-12-16 10:40:05 +00:00
# ifndef GST_DISABLE_REGISTRY
2004-06-16 21:06:50 +00:00
GstPlugin * plugin = GST_PLUGIN_FEATURE ( factory ) - > manager ;
g_critical
( " Factory for `%s' has no type. This probably means the plugin wasn't found because the registry is broken. The plugin GStreamer was looking for is named '%s' and is expected in file '%s'. The registry for this plugin is located at '%s' " ,
GST_PLUGIN_FEATURE_NAME ( factory ) ,
gst_plugin_get_name ( plugin ) , gst_plugin_get_filename ( plugin ) ,
GST_IS_XML_REGISTRY ( plugin - > manager ) ? GST_XML_REGISTRY ( plugin - >
manager ) - > location : " Unknown " ) ;
2004-12-16 10:40:05 +00:00
# else
g_critical ( " Factory for `%s' has no type " ,
GST_PLUGIN_FEATURE_NAME ( factory ) ) ;
# endif
2004-03-13 15:27:01 +00:00
return NULL ;
2001-10-21 18:00:31 +00:00
}
2000-01-30 09:03:00 +00:00
2004-03-13 15:27:01 +00:00
oclass = GST_ELEMENT_CLASS ( g_type_class_ref ( factory - > type ) ) ;
2004-02-20 13:18:32 +00:00
if ( oclass - > elementfactory = = NULL )
2003-11-02 16:46:12 +00:00
oclass - > elementfactory = factory ;
2003-06-16 15:08:34 +00:00
/* create an instance of the element */
element = GST_ELEMENT ( g_object_new ( factory - > type , NULL ) ) ;
g_assert ( element ! = NULL ) ;
2003-11-02 16:46:12 +00:00
g_type_class_unref ( oclass ) ;
2005-02-19 13:02:45 +00:00
if ( name )
gst_object_set_name ( GST_OBJECT ( element ) , name ) ;
2000-01-30 09:03:00 +00:00
2005-07-09 15:18:53 +00:00
GST_DEBUG ( " created \" %s \" " , GST_PLUGIN_FEATURE_NAME ( factory ) ) ;
2000-01-30 09:03:00 +00:00
return element ;
}
2004-03-13 15:27:01 +00:00
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
*
2003-10-31 19:32:47 +00:00
* Returns : new # GstElement or NULL if unable to create element
2000-09-14 20:31:03 +00:00
*/
2004-03-13 15:27:01 +00:00
GstElement *
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
2004-03-13 15:27:01 +00:00
GST_LOG ( " gstelementfactory: make \" %s \" \" %s \" " ,
factoryname , GST_STR_NULL ( name ) ) ;
2000-09-27 19:33:10 +00:00
2002-08-28 10:45:57 +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 ) {
2004-03-13 15:27:01 +00:00
GST_INFO ( " no such element factory \" %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 ) {
2003-10-31 19:32:47 +00:00
GST_INFO_OBJECT ( factory , " couldn't create instance! " ) ;
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 ;
}
2004-03-13 15:27:01 +00:00
2003-10-31 19:32:47 +00:00
void
Use libxml2 for registry parsing, use staticpadtemplates in elementfactories. Makes gst_init() +/- 10x faster.
Original commit message from CVS:
* docs/gst/tmpl/gstelementfactory.sgml:
* gst/gstelement.h:
* gst/gstelementfactory.c: (gst_element_factory_init),
(gst_element_factory_cleanup), (gst_element_register),
(__gst_element_factory_add_static_pad_template),
(gst_element_factory_get_static_pad_templates),
(gst_element_factory_can_src_caps),
(gst_element_factory_can_sink_caps):
* gst/registries/Makefile.am:
* gst/registries/gstlibxmlregistry.c: (gst_xml_registry_get_type),
(gst_xml_registry_class_init), (gst_xml_registry_init),
(gst_xml_registry_new), (gst_xml_registry_set_property),
(gst_xml_registry_get_property), (get_time), (make_dir),
(gst_xml_registry_get_perms_func),
(plugin_times_older_than_recurse), (plugin_times_older_than),
(gst_xml_registry_open_func), (gst_xml_registry_load_func),
(gst_xml_registry_save_func), (gst_xml_registry_close_func),
(add_to_char_array), (read_string), (read_uint), (read_enum),
(load_pad_template), (load_feature), (load_plugin), (load_paths),
(gst_xml_registry_load), (gst_xml_registry_load_plugin),
(gst_xml_registry_save_caps), (gst_xml_registry_save_pad_template),
(gst_xml_registry_save_feature), (gst_xml_registry_save_plugin),
(gst_xml_registry_save), (gst_xml_registry_rebuild_recurse),
(gst_xml_registry_rebuild):
* gst/registries/gstlibxmlregistry.h:
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_pad_templates_info):
* tools/gst-xmlinspect.c: (print_element_info):
Use libxml2 for registry parsing, use staticpadtemplates in
elementfactories. Makes gst_init() +/- 10x faster.
2005-04-12 15:00:30 +00:00
__gst_element_factory_add_static_pad_template ( GstElementFactory * factory ,
GstStaticPadTemplate * templ )
2003-10-31 19:32:47 +00:00
{
g_return_if_fail ( factory ! = NULL ) ;
g_return_if_fail ( templ ! = NULL ) ;
Use libxml2 for registry parsing, use staticpadtemplates in elementfactories. Makes gst_init() +/- 10x faster.
Original commit message from CVS:
* docs/gst/tmpl/gstelementfactory.sgml:
* gst/gstelement.h:
* gst/gstelementfactory.c: (gst_element_factory_init),
(gst_element_factory_cleanup), (gst_element_register),
(__gst_element_factory_add_static_pad_template),
(gst_element_factory_get_static_pad_templates),
(gst_element_factory_can_src_caps),
(gst_element_factory_can_sink_caps):
* gst/registries/Makefile.am:
* gst/registries/gstlibxmlregistry.c: (gst_xml_registry_get_type),
(gst_xml_registry_class_init), (gst_xml_registry_init),
(gst_xml_registry_new), (gst_xml_registry_set_property),
(gst_xml_registry_get_property), (get_time), (make_dir),
(gst_xml_registry_get_perms_func),
(plugin_times_older_than_recurse), (plugin_times_older_than),
(gst_xml_registry_open_func), (gst_xml_registry_load_func),
(gst_xml_registry_save_func), (gst_xml_registry_close_func),
(add_to_char_array), (read_string), (read_uint), (read_enum),
(load_pad_template), (load_feature), (load_plugin), (load_paths),
(gst_xml_registry_load), (gst_xml_registry_load_plugin),
(gst_xml_registry_save_caps), (gst_xml_registry_save_pad_template),
(gst_xml_registry_save_feature), (gst_xml_registry_save_plugin),
(gst_xml_registry_save), (gst_xml_registry_rebuild_recurse),
(gst_xml_registry_rebuild):
* gst/registries/gstlibxmlregistry.h:
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_pad_templates_info):
* tools/gst-xmlinspect.c: (print_element_info):
Use libxml2 for registry parsing, use staticpadtemplates in
elementfactories. Makes gst_init() +/- 10x faster.
2005-04-12 15:00:30 +00:00
factory - > staticpadtemplates =
g_list_append ( factory - > staticpadtemplates , templ ) ;
2003-10-31 19:32:47 +00:00
factory - > numpadtemplates + + ;
}
2004-03-13 15:27:01 +00:00
2002-06-13 15:08:52 +00:00
/**
2003-10-31 19:32:47 +00:00
* gst_element_factory_get_element_type :
* @ factory : factory to get managed # GType from
*
* Get the # GType for elements managed by this factory
2002-06-13 15:08:52 +00:00
*
2003-10-31 19:32:47 +00:00
* Returns : the # GType for elements managed by this factory
*/
GType
2004-03-13 15:27:01 +00:00
gst_element_factory_get_element_type ( GstElementFactory * factory )
2003-10-31 19:32:47 +00:00
{
g_return_val_if_fail ( GST_IS_ELEMENT_FACTORY ( factory ) , 0 ) ;
return factory - > type ;
}
2004-03-13 15:27:01 +00:00
2003-10-31 19:32:47 +00:00
/**
* gst_element_factory_get_longname :
* @ factory : a # GstElementFactory
*
* Gets the longname for this factory
2002-06-13 15:08:52 +00:00
*
2003-10-31 19:32:47 +00:00
* Returns : the longname
2002-06-13 15:08:52 +00:00
*/
2003-10-31 19:32:47 +00:00
G_CONST_RETURN gchar *
2004-03-13 15:27:01 +00:00
gst_element_factory_get_longname ( GstElementFactory * factory )
2002-06-13 15:08:52 +00:00
{
2003-10-31 19:32:47 +00:00
g_return_val_if_fail ( GST_IS_ELEMENT_FACTORY ( factory ) , NULL ) ;
2002-06-13 15:08:52 +00:00
2003-10-31 19:32:47 +00:00
return factory - > details . longname ;
}
2004-03-13 15:27:01 +00:00
2003-10-31 19:32:47 +00:00
/**
* gst_element_factory_get_class :
* @ factory : a # GstElementFactory
*
* Gets the class for this factory .
*
* Returns : the class
*/
G_CONST_RETURN gchar *
2004-03-13 15:27:01 +00:00
gst_element_factory_get_klass ( GstElementFactory * factory )
2003-10-31 19:32:47 +00:00
{
g_return_val_if_fail ( GST_IS_ELEMENT_FACTORY ( factory ) , NULL ) ;
2002-06-13 15:08:52 +00:00
2003-10-31 19:32:47 +00:00
return factory - > details . klass ;
2002-06-13 15:08:52 +00:00
}
2004-03-13 15:27:01 +00:00
2000-09-14 20:31:03 +00:00
/**
2003-10-31 19:32:47 +00:00
* gst_element_factory_get_description :
* @ factory : a # GstElementFactory
*
* Gets the description for this factory .
2000-09-14 20:31:03 +00:00
*
2003-10-31 19:32:47 +00:00
* Returns : the description
2000-09-14 20:31:03 +00:00
*/
2003-10-31 19:32:47 +00:00
G_CONST_RETURN gchar *
2004-03-13 15:27:01 +00:00
gst_element_factory_get_description ( GstElementFactory * factory )
2000-12-11 00:04:25 +00:00
{
2003-10-31 19:32:47 +00:00
g_return_val_if_fail ( GST_IS_ELEMENT_FACTORY ( factory ) , NULL ) ;
2000-12-11 00:04:25 +00:00
2003-10-31 19:32:47 +00:00
return factory - > details . description ;
}
2004-03-13 15:27:01 +00:00
2003-10-31 19:32:47 +00:00
/**
* gst_element_factory_get_author :
* @ factory : a # GstElementFactory
*
* Gets the author for this factory .
*
* Returns : the author
*/
G_CONST_RETURN gchar *
2004-03-13 15:27:01 +00:00
gst_element_factory_get_author ( GstElementFactory * factory )
2003-10-31 19:32:47 +00:00
{
g_return_val_if_fail ( GST_IS_ELEMENT_FACTORY ( factory ) , NULL ) ;
2001-09-29 09:53:07 +00:00
2003-10-31 19:32:47 +00:00
return factory - > details . author ;
}
2004-03-13 15:27:01 +00:00
2003-10-31 19:32:47 +00:00
/**
2003-11-11 12:34:15 +00:00
* gst_element_factory_get_num_pad_templates :
2003-10-31 19:32:47 +00:00
* @ factory : a # GstElementFactory
*
2003-11-11 12:34:15 +00:00
* Gets the number of pad_templates in this factory .
2003-10-31 19:32:47 +00:00
*
2003-11-11 12:34:15 +00:00
* Returns : the number of pad_templates
2003-10-31 19:32:47 +00:00
*/
guint
2004-03-13 15:27:01 +00:00
gst_element_factory_get_num_pad_templates ( GstElementFactory * factory )
2003-10-31 19:32:47 +00:00
{
g_return_val_if_fail ( GST_IS_ELEMENT_FACTORY ( factory ) , 0 ) ;
return factory - > numpadtemplates ;
2000-12-19 13:41:55 +00:00
}
2004-03-13 15:27:01 +00:00
2003-11-24 02:09:23 +00:00
/**
* __gst_element_factory_add_interface :
* @ elementfactory : The elementfactory to add the interface to
* @ interfacename : Name of the interface
*
* Adds the given interfacename to the list of implemented interfaces of the
* element .
*/
void
2004-03-13 15:27:01 +00:00
__gst_element_factory_add_interface ( GstElementFactory * elementfactory ,
const gchar * interfacename )
2003-11-24 02:09:23 +00:00
{
g_return_if_fail ( GST_IS_ELEMENT_FACTORY ( elementfactory ) ) ;
g_return_if_fail ( interfacename ! = NULL ) ;
2004-03-15 19:27:17 +00:00
g_return_if_fail ( interfacename [ 0 ] ! = ' \0 ' ) ; /* no empty string */
2004-03-13 15:27:01 +00:00
elementfactory - > interfaces =
g_list_prepend ( elementfactory - > interfaces , g_strdup ( interfacename ) ) ;
2003-11-24 02:09:23 +00:00
}
2004-03-13 15:27:01 +00:00
2003-10-31 19:32:47 +00:00
/**
Use libxml2 for registry parsing, use staticpadtemplates in elementfactories. Makes gst_init() +/- 10x faster.
Original commit message from CVS:
* docs/gst/tmpl/gstelementfactory.sgml:
* gst/gstelement.h:
* gst/gstelementfactory.c: (gst_element_factory_init),
(gst_element_factory_cleanup), (gst_element_register),
(__gst_element_factory_add_static_pad_template),
(gst_element_factory_get_static_pad_templates),
(gst_element_factory_can_src_caps),
(gst_element_factory_can_sink_caps):
* gst/registries/Makefile.am:
* gst/registries/gstlibxmlregistry.c: (gst_xml_registry_get_type),
(gst_xml_registry_class_init), (gst_xml_registry_init),
(gst_xml_registry_new), (gst_xml_registry_set_property),
(gst_xml_registry_get_property), (get_time), (make_dir),
(gst_xml_registry_get_perms_func),
(plugin_times_older_than_recurse), (plugin_times_older_than),
(gst_xml_registry_open_func), (gst_xml_registry_load_func),
(gst_xml_registry_save_func), (gst_xml_registry_close_func),
(add_to_char_array), (read_string), (read_uint), (read_enum),
(load_pad_template), (load_feature), (load_plugin), (load_paths),
(gst_xml_registry_load), (gst_xml_registry_load_plugin),
(gst_xml_registry_save_caps), (gst_xml_registry_save_pad_template),
(gst_xml_registry_save_feature), (gst_xml_registry_save_plugin),
(gst_xml_registry_save), (gst_xml_registry_rebuild_recurse),
(gst_xml_registry_rebuild):
* gst/registries/gstlibxmlregistry.h:
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_pad_templates_info):
* tools/gst-xmlinspect.c: (print_element_info):
Use libxml2 for registry parsing, use staticpadtemplates in
elementfactories. Makes gst_init() +/- 10x faster.
2005-04-12 15:00:30 +00:00
* gst_element_factory_get_static_pad_templates :
2003-10-31 19:32:47 +00:00
* @ factory : a # GstElementFactory
*
2003-11-24 03:21:54 +00:00
* Gets the # GList of padtemplates for this factory .
2003-10-31 19:32:47 +00:00
*
* Returns : the padtemplates
*/
G_CONST_RETURN GList *
Use libxml2 for registry parsing, use staticpadtemplates in elementfactories. Makes gst_init() +/- 10x faster.
Original commit message from CVS:
* docs/gst/tmpl/gstelementfactory.sgml:
* gst/gstelement.h:
* gst/gstelementfactory.c: (gst_element_factory_init),
(gst_element_factory_cleanup), (gst_element_register),
(__gst_element_factory_add_static_pad_template),
(gst_element_factory_get_static_pad_templates),
(gst_element_factory_can_src_caps),
(gst_element_factory_can_sink_caps):
* gst/registries/Makefile.am:
* gst/registries/gstlibxmlregistry.c: (gst_xml_registry_get_type),
(gst_xml_registry_class_init), (gst_xml_registry_init),
(gst_xml_registry_new), (gst_xml_registry_set_property),
(gst_xml_registry_get_property), (get_time), (make_dir),
(gst_xml_registry_get_perms_func),
(plugin_times_older_than_recurse), (plugin_times_older_than),
(gst_xml_registry_open_func), (gst_xml_registry_load_func),
(gst_xml_registry_save_func), (gst_xml_registry_close_func),
(add_to_char_array), (read_string), (read_uint), (read_enum),
(load_pad_template), (load_feature), (load_plugin), (load_paths),
(gst_xml_registry_load), (gst_xml_registry_load_plugin),
(gst_xml_registry_save_caps), (gst_xml_registry_save_pad_template),
(gst_xml_registry_save_feature), (gst_xml_registry_save_plugin),
(gst_xml_registry_save), (gst_xml_registry_rebuild_recurse),
(gst_xml_registry_rebuild):
* gst/registries/gstlibxmlregistry.h:
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_pad_templates_info):
* tools/gst-xmlinspect.c: (print_element_info):
Use libxml2 for registry parsing, use staticpadtemplates in
elementfactories. Makes gst_init() +/- 10x faster.
2005-04-12 15:00:30 +00:00
gst_element_factory_get_static_pad_templates ( GstElementFactory * factory )
2003-10-31 19:32:47 +00:00
{
g_return_val_if_fail ( GST_IS_ELEMENT_FACTORY ( factory ) , NULL ) ;
2000-08-21 21:20:38 +00:00
Use libxml2 for registry parsing, use staticpadtemplates in elementfactories. Makes gst_init() +/- 10x faster.
Original commit message from CVS:
* docs/gst/tmpl/gstelementfactory.sgml:
* gst/gstelement.h:
* gst/gstelementfactory.c: (gst_element_factory_init),
(gst_element_factory_cleanup), (gst_element_register),
(__gst_element_factory_add_static_pad_template),
(gst_element_factory_get_static_pad_templates),
(gst_element_factory_can_src_caps),
(gst_element_factory_can_sink_caps):
* gst/registries/Makefile.am:
* gst/registries/gstlibxmlregistry.c: (gst_xml_registry_get_type),
(gst_xml_registry_class_init), (gst_xml_registry_init),
(gst_xml_registry_new), (gst_xml_registry_set_property),
(gst_xml_registry_get_property), (get_time), (make_dir),
(gst_xml_registry_get_perms_func),
(plugin_times_older_than_recurse), (plugin_times_older_than),
(gst_xml_registry_open_func), (gst_xml_registry_load_func),
(gst_xml_registry_save_func), (gst_xml_registry_close_func),
(add_to_char_array), (read_string), (read_uint), (read_enum),
(load_pad_template), (load_feature), (load_plugin), (load_paths),
(gst_xml_registry_load), (gst_xml_registry_load_plugin),
(gst_xml_registry_save_caps), (gst_xml_registry_save_pad_template),
(gst_xml_registry_save_feature), (gst_xml_registry_save_plugin),
(gst_xml_registry_save), (gst_xml_registry_rebuild_recurse),
(gst_xml_registry_rebuild):
* gst/registries/gstlibxmlregistry.h:
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_pad_templates_info):
* tools/gst-xmlinspect.c: (print_element_info):
Use libxml2 for registry parsing, use staticpadtemplates in
elementfactories. Makes gst_init() +/- 10x faster.
2005-04-12 15:00:30 +00:00
return factory - > staticpadtemplates ;
2003-10-31 19:32:47 +00:00
}
2004-03-13 15:27:01 +00:00
2003-11-24 03:21:54 +00:00
/**
* gst_element_factory_get_uri_type :
* @ factory : a # GstElementFactory
*
* Gets the type of URIs the element supports or GST_URI_UNKNOWN if none .
*
* Returns : type of URIs this element supports
*/
guint
2004-03-13 15:27:01 +00:00
gst_element_factory_get_uri_type ( GstElementFactory * factory )
2003-11-24 03:21:54 +00:00
{
g_return_val_if_fail ( GST_IS_ELEMENT_FACTORY ( factory ) , GST_URI_UNKNOWN ) ;
return factory - > uri_type ;
}
2004-03-13 15:27:01 +00:00
2003-11-24 03:21:54 +00:00
/**
* gst_element_factory_get_uri_protocols :
* @ factory : a # GstElementFactory
*
* Gets a NULL - terminated array of protocols this element supports or NULL , if
* no protocols are supported . You may not change the contents of the returned
* array as it is still ownt by the element factory . Use g_strdupv ( ) if you want to .
*
* Returns : the supported protocols or NULL
*/
gchar * *
2004-03-13 15:27:01 +00:00
gst_element_factory_get_uri_protocols ( GstElementFactory * factory )
2003-11-24 03:21:54 +00:00
{
g_return_val_if_fail ( GST_IS_ELEMENT_FACTORY ( factory ) , NULL ) ;
return factory - > uri_protocols ;
}
2004-03-13 15:27:01 +00:00
2001-08-21 20:16:48 +00:00
static void
2004-03-13 15:27:01 +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
2003-10-31 19:32:47 +00:00
if ( factory - > type ) {
g_type_class_unref ( g_type_class_peek ( factory - > type ) ) ;
factory - > type = 0 ;
}
2001-08-21 20:16:48 +00:00
}