mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
gst_scheduler_factory_make () can accept NULL as the first arg now _create () sets the element sched and refcounts th...
Original commit message from CVS: * gst_scheduler_factory_make () can accept NULL as the first arg now * _create () sets the element sched and refcounts the scheduler * corresponding touchups to gstpipeline and gstthread
This commit is contained in:
parent
19bd060114
commit
6691120451
3 changed files with 26 additions and 30 deletions
|
@ -97,20 +97,13 @@ gst_pipeline_class_init (GstPipelineClass *klass)
|
|||
static void
|
||||
gst_pipeline_init (GstPipeline *pipeline)
|
||||
{
|
||||
const gchar *schedname;
|
||||
GstScheduler *scheduler;
|
||||
|
||||
/* we're a manager by default */
|
||||
/* pipelines are managing bins */
|
||||
GST_FLAG_SET (pipeline, GST_BIN_FLAG_MANAGER);
|
||||
|
||||
schedname = gst_scheduler_factory_get_default_name ();
|
||||
|
||||
scheduler = gst_scheduler_factory_make (schedname, GST_ELEMENT (pipeline));
|
||||
|
||||
GST_ELEMENT_SCHED (pipeline) = scheduler;
|
||||
|
||||
gst_object_ref (GST_OBJECT (scheduler));
|
||||
gst_object_sink (GST_OBJECT (scheduler));
|
||||
/* get an instance of the default scheduler */
|
||||
scheduler = gst_scheduler_factory_make (NULL, GST_ELEMENT (pipeline));
|
||||
|
||||
gst_scheduler_setup (scheduler);
|
||||
}
|
||||
|
@ -125,6 +118,7 @@ gst_pipeline_dispose (GObject *object)
|
|||
if (GST_ELEMENT_SCHED (pipeline)) {
|
||||
gst_scheduler_reset (GST_ELEMENT_SCHED (pipeline));
|
||||
gst_object_unref (GST_OBJECT (GST_ELEMENT_SCHED (pipeline)));
|
||||
GST_ELEMENT_SCHED (pipeline) = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -735,9 +735,10 @@ gst_scheduler_factory_get_list (void)
|
|||
* @parent: the parent element of this scheduler
|
||||
*
|
||||
* Create a new #GstScheduler instance from the
|
||||
* given schedulerfactory with the given parent.
|
||||
* given schedulerfactory with the given parent. @parent will
|
||||
* have its scheduler set to the returned #GstScheduler instance.
|
||||
*
|
||||
* Returns: A new #GstScheduler instance.
|
||||
* Returns: A new #GstScheduler instance with a reference count of %1.
|
||||
*/
|
||||
GstScheduler*
|
||||
gst_scheduler_factory_create (GstSchedulerFactory *factory, GstElement *parent)
|
||||
|
@ -745,12 +746,19 @@ gst_scheduler_factory_create (GstSchedulerFactory *factory, GstElement *parent)
|
|||
GstScheduler *new = NULL;
|
||||
|
||||
g_return_val_if_fail (factory != NULL, NULL);
|
||||
g_return_val_if_fail (parent != NULL, NULL);
|
||||
|
||||
if (gst_plugin_feature_ensure_loaded (GST_PLUGIN_FEATURE (factory))) {
|
||||
g_return_val_if_fail (factory->type != 0, NULL);
|
||||
|
||||
new = GST_SCHEDULER (g_object_new (factory->type, NULL));
|
||||
new->parent = parent;
|
||||
|
||||
GST_ELEMENT_SCHED (parent) = new;
|
||||
|
||||
/* let's refcount the scheduler */
|
||||
gst_object_ref (GST_OBJECT (new));
|
||||
gst_object_sink (GST_OBJECT (new));
|
||||
}
|
||||
|
||||
return new;
|
||||
|
@ -762,18 +770,22 @@ gst_scheduler_factory_create (GstSchedulerFactory *factory, GstElement *parent)
|
|||
* @parent: the parent element of this scheduler
|
||||
*
|
||||
* Create a new #GstScheduler instance from the
|
||||
* schedulerfactory with the given name and parent.
|
||||
* schedulerfactory with the given name and parent. @parent will
|
||||
* have its scheduler set to the returned #GstScheduler instance.
|
||||
* If %NULL is passed as @name, the default scheduler name will
|
||||
* be used.
|
||||
*
|
||||
* Returns: A new #GstScheduler instance.
|
||||
* Returns: A new #GstScheduler instance with a reference count of %1.
|
||||
*/
|
||||
GstScheduler*
|
||||
gst_scheduler_factory_make (const gchar *name, GstElement *parent)
|
||||
{
|
||||
GstSchedulerFactory *factory;
|
||||
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
if (name)
|
||||
factory = gst_scheduler_factory_find (name);
|
||||
else
|
||||
factory = gst_scheduler_factory_find (gst_scheduler_factory_get_default_name ());
|
||||
|
||||
if (factory == NULL)
|
||||
return NULL;
|
||||
|
|
|
@ -118,13 +118,11 @@ gst_thread_class_init (GstThreadClass *klass)
|
|||
|
||||
#ifndef GST_DISABLE_LOADSAVE
|
||||
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR (gst_thread_save_thyself);
|
||||
gstobject_class->restore_thyself = GST_DEBUG_FUNCPTR(gst_thread_restore_thyself);
|
||||
gstobject_class->restore_thyself = GST_DEBUG_FUNCPTR (gst_thread_restore_thyself);
|
||||
#endif
|
||||
|
||||
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_thread_change_state);
|
||||
|
||||
/* gstbin_class->schedule = gst_thread_schedule_dummy; */
|
||||
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_thread_set_property);
|
||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_thread_get_property);
|
||||
|
||||
|
@ -133,24 +131,16 @@ gst_thread_class_init (GstThreadClass *klass)
|
|||
static void
|
||||
gst_thread_init (GstThread *thread)
|
||||
{
|
||||
const gchar *schedname;
|
||||
GstScheduler *scheduler;
|
||||
|
||||
GST_DEBUG (GST_CAT_THREAD, "initializing thread");
|
||||
|
||||
/* we're a manager by default */
|
||||
/* threads are managing bins and iterate themselves */
|
||||
/* CR1: the GstBin code checks these flags */
|
||||
GST_FLAG_SET (thread, GST_BIN_FLAG_MANAGER);
|
||||
GST_FLAG_SET (thread, GST_BIN_SELF_SCHEDULABLE);
|
||||
|
||||
schedname = gst_scheduler_factory_get_default_name ();
|
||||
|
||||
scheduler = gst_scheduler_factory_make (schedname, GST_ELEMENT (thread));
|
||||
|
||||
GST_ELEMENT_SCHED (thread) = scheduler;
|
||||
|
||||
gst_object_ref (GST_OBJECT (scheduler));
|
||||
gst_object_sink (GST_OBJECT (scheduler));
|
||||
scheduler = gst_scheduler_factory_make (NULL, GST_ELEMENT (thread));
|
||||
|
||||
thread->lock = g_mutex_new ();
|
||||
thread->cond = g_cond_new ();
|
||||
|
|
Loading…
Reference in a new issue