GST_DEBUG_CATEGORY (autoconvert_debug);
#define GST_CAT_DEFAULT (autoconvert_debug)
-#define DEFAULT_INITIAL_IDENTITY FALSE
-
#define GST_AUTOCONVERT_LOCK(ac) GST_OBJECT_LOCK (ac)
#define GST_AUTOCONVERT_UNLOCK(ac) GST_OBJECT_UNLOCK (ac)
enum
{
PROP_0,
- PROP_FACTORIES,
- PROP_INITIAL_IDENTITY
+ PROP_FACTORIES
};
static void gst_auto_convert_set_property (GObject * object,
" elements), can only be set once",
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_INITIAL_IDENTITY,
- g_param_spec_boolean ("initial-identity",
- "Install identity initially",
- "If true, then the identity element will be installed initially "
- "and used for event passing until the first data buffer arrives ",
- DEFAULT_INITIAL_IDENTITY,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_auto_convert_change_state);
}
gst_element_add_pad (GST_ELEMENT (autoconvert), autoconvert->srcpad);
gst_segment_init (&autoconvert->sink_segment, GST_FORMAT_UNDEFINED);
-
- autoconvert->initial_identity = DEFAULT_INITIAL_IDENTITY;
}
static void
" 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;
}
}
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;
}
}
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;
}
}
internal_srcpad = gst_auto_convert_get_internal_srcpad (autoconvert);
- if (internal_srcpad == NULL) {
- /* Query the subelement - triggers creation of an identity if necessary */
- GstElement *subelement =
- gst_auto_convert_get_subelement (autoconvert, FALSE);
- if (subelement)
- gst_object_unref (subelement);
- internal_srcpad = gst_auto_convert_get_internal_srcpad (autoconvert);
- }
-
if (internal_srcpad) {
ret = gst_pad_push_event (internal_srcpad, event);
gst_object_unref (internal_srcpad);