mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
add gst_scheduler_register shortcut similar to gst_element_register
Original commit message from CVS: * docs/gst/gstreamer-sections.txt: * gst/gstscheduler.c: (gst_scheduler_register): * gst/gstscheduler.h: add gst_scheduler_register shortcut similar to gst_element_register * gst/schedulers/entryscheduler.c: (plugin_init): * gst/schedulers/gstbasicscheduler.c: (plugin_init): * gst/schedulers/gstoptimalscheduler.c: (plugin_init): use it
This commit is contained in:
parent
6bf163742a
commit
6e15cb6ce9
7 changed files with 69 additions and 33 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2004-08-11 Benjamin Otte <otte@gnome.org>
|
||||
|
||||
* docs/gst/gstreamer-sections.txt:
|
||||
* gst/gstscheduler.c: (gst_scheduler_register):
|
||||
* gst/gstscheduler.h:
|
||||
add gst_scheduler_register shortcut similar to gst_element_register
|
||||
* gst/schedulers/entryscheduler.c: (plugin_init):
|
||||
* gst/schedulers/gstbasicscheduler.c: (plugin_init):
|
||||
* gst/schedulers/gstoptimalscheduler.c: (plugin_init):
|
||||
use it
|
||||
|
||||
2004-08-10 Steve Lhomme <steve.lhomme@free.fr>
|
||||
|
||||
* gst/gstvalue.h:
|
||||
|
|
|
@ -1418,6 +1418,7 @@ gst_scheduler_get_type
|
|||
<TITLE>GstSchedulerFactory</TITLE>
|
||||
GstSchedulerFactory
|
||||
GST_TYPE_SCHEDULER_FACTORY
|
||||
gst_scheduler_register
|
||||
gst_scheduler_factory_new
|
||||
gst_scheduler_factory_destroy
|
||||
gst_scheduler_factory_find
|
||||
|
|
|
@ -793,6 +793,43 @@ gst_scheduler_factory_init (GstSchedulerFactory * factory)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* gst_scheduler_register:
|
||||
* @plugin: a #GstPlugin
|
||||
* @name: name of the scheduler to register
|
||||
* @longdesc: description of the scheduler
|
||||
* @type: #GType of the scheduler to register
|
||||
*
|
||||
* Registers a scheduler with GStreamer.
|
||||
*
|
||||
* Returns: TRUE, if the registering succeeded, FALSE on error
|
||||
**/
|
||||
gboolean
|
||||
gst_scheduler_register (GstPlugin * plugin, const gchar * name,
|
||||
const gchar * longdesc, GType type)
|
||||
{
|
||||
GstSchedulerFactory *factory;
|
||||
|
||||
g_return_val_if_fail (plugin != NULL, FALSE);
|
||||
g_return_val_if_fail (name != NULL, FALSE);
|
||||
g_return_val_if_fail (longdesc != NULL, FALSE);
|
||||
g_return_val_if_fail (g_type_is_a (type, GST_TYPE_SCHEDULER), FALSE);
|
||||
|
||||
factory = gst_scheduler_factory_find (name);
|
||||
if (factory) {
|
||||
g_return_val_if_fail (factory->type == 0, FALSE);
|
||||
g_free (factory->longdesc);
|
||||
factory->longdesc = g_strdup (longdesc);
|
||||
factory->type = type;
|
||||
} else {
|
||||
factory = gst_scheduler_factory_new (name, longdesc, type);
|
||||
g_return_val_if_fail (factory, FALSE);
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_scheduler_factory_new:
|
||||
* @name: name of schedulerfactory to create
|
||||
|
|
|
@ -181,6 +181,8 @@ struct _GstSchedulerFactoryClass {
|
|||
|
||||
GType gst_scheduler_factory_get_type (void);
|
||||
|
||||
gboolean gst_scheduler_register (GstPlugin *plugin, const gchar *name,
|
||||
const gchar *longdesc, GType type);
|
||||
GstSchedulerFactory* gst_scheduler_factory_new (const gchar *name, const gchar *longdesc, GType type);
|
||||
void gst_scheduler_factory_destroy (GstSchedulerFactory *factory);
|
||||
|
||||
|
|
|
@ -1160,18 +1160,14 @@ gst_entry_scheduler_show (GstScheduler * scheduler)
|
|||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
GstSchedulerFactory *factory;
|
||||
if (!gst_scheduler_register (plugin, "entry" COTHREADS_NAME,
|
||||
"A entry scheduler using " COTHREADS_NAME " cothreads",
|
||||
GST_TYPE_ENTRY_SCHEDULER))
|
||||
return FALSE;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (debug_scheduler, "entry" COTHREADS_NAME, 0,
|
||||
"entry " COTHREADS_NAME "scheduler");
|
||||
|
||||
factory = gst_scheduler_factory_new ("entry" COTHREADS_NAME,
|
||||
"A entry scheduler using " COTHREADS_NAME " cothreads",
|
||||
GST_TYPE_ENTRY_SCHEDULER);
|
||||
if (factory == NULL)
|
||||
return FALSE;
|
||||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -263,22 +263,16 @@ gst_basic_scheduler_dispose (GObject * object)
|
|||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
GstSchedulerFactory *factory;
|
||||
if (!gst_scheduler_register (plugin, "basic" COTHREADS_NAME,
|
||||
"A basic scheduler using " COTHREADS_NAME " cothreads",
|
||||
gst_basic_scheduler_get_type ()))
|
||||
return FALSE;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (debug_dataflow, "basic_dataflow", 0,
|
||||
"basic scheduler dataflow");
|
||||
GST_DEBUG_CATEGORY_INIT (debug_scheduler, "basic_scheduler", 0,
|
||||
"basic scheduler general information");
|
||||
|
||||
factory = gst_scheduler_factory_new ("basic" COTHREADS_NAME,
|
||||
"A basic scheduler using " COTHREADS_NAME " cothreads",
|
||||
gst_basic_scheduler_get_type ());
|
||||
|
||||
if (factory != NULL) {
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
} else {
|
||||
g_warning ("could not register scheduler: " COTHREADS_NAME);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -447,25 +447,20 @@ gst_opt_scheduler_dispose (GObject * object)
|
|||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
GstSchedulerFactory *factory;
|
||||
#ifdef USE_COTHREADS
|
||||
if (!gst_scheduler_register (plugin, "opt" COTHREADS_NAME,
|
||||
"An optimal scheduler using " COTHREADS_NAME " cothreads",
|
||||
gst_opt_scheduler_get_type ()))
|
||||
#else
|
||||
if (!gst_scheduler_register (plugin, "opt",
|
||||
"An optimal scheduler using no cothreads",
|
||||
gst_opt_scheduler_get_type ()))
|
||||
#endif
|
||||
return FALSE;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (debug_scheduler, "scheduler", 0,
|
||||
"optimal scheduler");
|
||||
|
||||
#ifdef USE_COTHREADS
|
||||
factory = gst_scheduler_factory_new ("opt" COTHREADS_NAME,
|
||||
"An optimal scheduler using " COTHREADS_NAME " cothreads",
|
||||
gst_opt_scheduler_get_type ());
|
||||
#else
|
||||
factory = gst_scheduler_factory_new ("opt",
|
||||
"An optimal scheduler using no cothreads", gst_opt_scheduler_get_type ());
|
||||
#endif
|
||||
|
||||
if (factory != NULL) {
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
} else {
|
||||
g_warning ("could not register scheduler: optimal");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue