static void gst_auto_convert_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstAutoConvert *autoconvert = GST_AUTO_CONVERT (object); switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; case PROP_FACTORIES: GST_AUTOCONVERT_LOCK (autoconvert); if (autoconvert->factories == NULL) { GList *factories = g_value_get_pointer (value); autoconvert->factories = g_list_copy (factories); g_list_foreach (autoconvert->factories, (GFunc) g_object_ref, NULL); } else GST_WARNING_OBJECT (object, "Can not reset factories after they" " have been set or auto-discovered"); GST_AUTOCONVERT_UNLOCK (autoconvert); break; case PROP_INITIAL_IDENTITY: GST_AUTOCONVERT_LOCK (autoconvert); autoconvert->initial_identity = g_value_get_boolean (value); GST_AUTOCONVERT_UNLOCK (autoconvert); break; } }
static void gst_auto_convert_dispose (GObject * object) { GstAutoConvert *autoconvert = GST_AUTO_CONVERT (object); gst_pad_set_fixatecaps_function (autoconvert->sinkpad, NULL); GST_AUTOCONVERT_LOCK (autoconvert); if (autoconvert->current_subelement) { gst_object_unref (autoconvert->current_subelement); autoconvert->current_subelement = NULL; autoconvert->current_internal_sinkpad = NULL; autoconvert->current_internal_srcpad = NULL; } g_list_foreach (autoconvert->cached_events, (GFunc) gst_mini_object_unref, NULL); g_list_free (autoconvert->cached_events); autoconvert->cached_events = NULL; if (autoconvert->factories) { gst_plugin_feature_list_free (autoconvert->factories); autoconvert->factories = NULL; } GST_AUTOCONVERT_UNLOCK (autoconvert); G_OBJECT_CLASS (parent_class)->dispose (object); }
static GstPad * gst_auto_convert_get_internal_srcpad (GstAutoConvert * autoconvert) { GstPad *pad = NULL; GST_AUTOCONVERT_LOCK (autoconvert); if (autoconvert->current_internal_srcpad) pad = gst_object_ref (autoconvert->current_internal_srcpad); GST_AUTOCONVERT_UNLOCK (autoconvert); return pad; }
static GstElement * gst_auto_convert_get_subelement (GstAutoConvert * autoconvert) { GstElement *element = NULL; GST_AUTOCONVERT_LOCK (autoconvert); if (autoconvert->current_subelement) element = gst_object_ref (autoconvert->current_subelement); GST_AUTOCONVERT_UNLOCK (autoconvert); return element; }
static void gst_auto_convert_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstAutoConvert *autoconvert = GST_AUTO_CONVERT (object); switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; case PROP_FACTORIES: GST_AUTOCONVERT_LOCK (autoconvert); g_value_set_pointer (value, &autoconvert->factories); GST_AUTOCONVERT_UNLOCK (autoconvert); break; case PROP_INITIAL_IDENTITY: GST_AUTOCONVERT_LOCK (autoconvert); g_value_set_boolean (value, autoconvert->initial_identity); GST_AUTOCONVERT_UNLOCK (autoconvert); break; } }
static GstElement * gst_auto_convert_get_subelement (GstAutoConvert * autoconvert, gboolean query_only) { GstElement *element = NULL; gboolean initial_identity; GST_AUTOCONVERT_LOCK (autoconvert); if (autoconvert->current_subelement) element = gst_object_ref (autoconvert->current_subelement); initial_identity = autoconvert->initial_identity; GST_AUTOCONVERT_UNLOCK (autoconvert); if (G_UNLIKELY (!query_only && element == NULL && initial_identity)) { /* No current sub-element - create an identity and install it */ GstElementFactory *identity_feature; GstElement *identity; GST_INFO_OBJECT (autoconvert, "No existing child element - instantiating identity"); /* if the identity feature doesn't exist - something is very wrong */ identity_feature = GST_ELEMENT_FACTORY_CAST (gst_default_registry_find_feature ("identity", GST_TYPE_ELEMENT_FACTORY)); identity = gst_auto_convert_get_or_make_element_from_factory (autoconvert, identity_feature); if (identity && gst_auto_convert_activate_element (autoconvert, identity, NULL)) { GST_AUTOCONVERT_LOCK (autoconvert); if (autoconvert->current_subelement) element = gst_object_ref (autoconvert->current_subelement); GST_AUTOCONVERT_UNLOCK (autoconvert); } } return element; }