mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
- properly ref/unref scheduler and clock in gstelement
Original commit message from CVS: - properly ref/unref scheduler and clock in gstelement - ref/unref clock in scheduler - better cleanup in element factory
This commit is contained in:
parent
2268739955
commit
06fe035ae4
2 changed files with 32 additions and 25 deletions
|
@ -714,7 +714,7 @@ gst_element_set_clock (GstElement *element, GstClock *clock)
|
|||
if (oclass->set_clock)
|
||||
oclass->set_clock (element, clock);
|
||||
|
||||
element->clock = clock;
|
||||
gst_object_swap ((GstObject **)&element->clock, (GstObject *)clock);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2411,6 +2411,9 @@ gst_element_dispose (GObject *object)
|
|||
if (element->property_mutex)
|
||||
g_mutex_free (element->property_mutex);
|
||||
|
||||
gst_object_swap ((GstObject **)&element->sched, NULL);
|
||||
gst_object_swap ((GstObject **)&element->clock, NULL);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
@ -2598,7 +2601,7 @@ gst_element_set_scheduler (GstElement *element,
|
|||
|
||||
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting scheduler to %p", sched);
|
||||
|
||||
GST_ELEMENT_SCHED (element) = sched;
|
||||
gst_object_swap ((GstObject **)&GST_ELEMENT_SCHED (element), GST_OBJECT (sched));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -110,23 +110,26 @@ gst_element_factory_find (const gchar *name)
|
|||
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->longname);
|
||||
g_free (dp->klass);
|
||||
g_free (dp->description);
|
||||
g_free (dp->version);
|
||||
g_free (dp->author);
|
||||
g_free (dp->copyright);
|
||||
g_free (dp);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_element_factory_cleanup (GstElementFactory *factory)
|
||||
{
|
||||
if (factory->details_dynamic) {
|
||||
gst_element_details_free (factory->details);
|
||||
factory->details_dynamic = FALSE;
|
||||
}
|
||||
|
||||
g_free (GST_PLUGIN_FEATURE (factory)->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_element_factory_new:
|
||||
* @name: name of new elementfactory
|
||||
|
@ -152,13 +155,12 @@ gst_element_factory_new (const gchar *name, GType type,
|
|||
|
||||
if (!factory)
|
||||
factory = GST_ELEMENT_FACTORY (g_object_new (GST_TYPE_ELEMENT_FACTORY, NULL));
|
||||
|
||||
if (factory->details_dynamic) {
|
||||
gst_element_details_free (factory->details);
|
||||
factory->details_dynamic = FALSE;
|
||||
else {
|
||||
gst_element_factory_cleanup (factory);
|
||||
}
|
||||
|
||||
factory->details = details;
|
||||
factory->details_dynamic = FALSE;
|
||||
|
||||
if (!factory->type)
|
||||
factory->type = type;
|
||||
|
@ -181,7 +183,7 @@ gst_element_factory_new (const gchar *name, GType type,
|
|||
*
|
||||
* Returns: new #GstElement
|
||||
*/
|
||||
GstElement *
|
||||
GstElement*
|
||||
gst_element_factory_create (GstElementFactory *factory,
|
||||
const gchar *name)
|
||||
{
|
||||
|
@ -280,7 +282,9 @@ gst_element_factory_make (const gchar *factoryname, const gchar *name)
|
|||
GstElement*
|
||||
gst_element_factory_make_or_warn (const gchar *factoryname, const gchar *name)
|
||||
{
|
||||
GstElement *element = gst_element_factory_make (factoryname, name);
|
||||
GstElement *element;
|
||||
|
||||
element = gst_element_factory_make (factoryname, name);
|
||||
|
||||
if (element == NULL)
|
||||
g_warning ("Could not create element from factory %s !\n", factoryname);
|
||||
|
@ -301,8 +305,8 @@ gst_element_factory_add_pad_template (GstElementFactory *factory,
|
|||
{
|
||||
GList *padtemplates;
|
||||
|
||||
g_return_if_fail(factory != NULL);
|
||||
g_return_if_fail(templ != NULL);
|
||||
g_return_if_fail (factory != NULL);
|
||||
g_return_if_fail (templ != NULL);
|
||||
|
||||
padtemplates = factory->padtemplates;
|
||||
|
||||
|
@ -401,7 +405,7 @@ gst_element_factory_can_sink_caps (GstElementFactory *factory,
|
|||
void
|
||||
gst_element_factory_set_rank (GstElementFactory *factory, guint16 rank)
|
||||
{
|
||||
g_return_if_fail(factory != NULL);
|
||||
g_return_if_fail (factory != NULL);
|
||||
factory->rank = rank;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue