mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-03 17:22:29 +00:00
trackobject: Properly rename get/set_child_property
We used to have a ges_track_object_get/set_child_property that was in fact letting user set/get various properties at once, rename it to get/set_properties, and implement: API: ges_track_object_get_child_property (GESTrackObject *object, const gchar *property_name, GValue * value); ges_track_object_set_child_property (GESTrackObject *object, const gchar *property_name, GValue * value);
This commit is contained in:
parent
dcfda73777
commit
f8037f857d
6 changed files with 127 additions and 15 deletions
|
@ -165,7 +165,7 @@ C. Keyframes
|
||||||
*/
|
*/
|
||||||
void ges_track_object_get_child_property (GESTrackObject *object,
|
void ges_track_object_get_child_property (GESTrackObject *object,
|
||||||
const gchar *property_name,
|
const gchar *property_name,
|
||||||
gpointer value);
|
GValue * value);
|
||||||
=> DONE
|
=> DONE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -107,9 +107,11 @@ ges_track_object_is_active
|
||||||
ges_track_object_lookup_child
|
ges_track_object_lookup_child
|
||||||
ges_track_object_list_children_properties
|
ges_track_object_list_children_properties
|
||||||
ges_track_object_set_child_property
|
ges_track_object_set_child_property
|
||||||
|
ges_track_object_set_child_properties
|
||||||
ges_track_object_set_child_property_valist
|
ges_track_object_set_child_property_valist
|
||||||
ges_track_object_set_child_property_by_pspec
|
ges_track_object_set_child_property_by_pspec
|
||||||
ges_track_object_get_child_property
|
ges_track_object_get_child_property
|
||||||
|
ges_track_object_get_child_properties
|
||||||
ges_track_object_get_child_property_valist
|
ges_track_object_get_child_property_valist
|
||||||
ges_track_object_get_child_property_by_pspec
|
ges_track_object_get_child_property_by_pspec
|
||||||
ges_track_object_edit
|
ges_track_object_edit
|
||||||
|
|
|
@ -1028,7 +1028,7 @@ make_source (GESFormatter * self, GList * reflist, GHashTable * source_table)
|
||||||
if (g_strstr_len (prop_val, -1, "(GEnum)")) {
|
if (g_strstr_len (prop_val, -1, "(GEnum)")) {
|
||||||
gchar **val = g_strsplit (prop_val, ")", 2);
|
gchar **val = g_strsplit (prop_val, ")", 2);
|
||||||
|
|
||||||
ges_track_object_set_child_property (GES_TRACK_OBJECT (effect),
|
ges_track_object_set_child_properties (GES_TRACK_OBJECT (effect),
|
||||||
(gchar *) tmp_key->data, atoi (val[1]), NULL);
|
(gchar *) tmp_key->data, atoi (val[1]), NULL);
|
||||||
g_strfreev (val);
|
g_strfreev (val);
|
||||||
|
|
||||||
|
|
|
@ -1153,6 +1153,9 @@ ges_track_object_lookup_child (GESTrackObject * object, const gchar * prop_name,
|
||||||
|
|
||||||
priv = object->priv;
|
priv = object->priv;
|
||||||
|
|
||||||
|
if (!priv->properties_hashtable)
|
||||||
|
goto prop_hash_not_set;
|
||||||
|
|
||||||
classename = NULL;
|
classename = NULL;
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
|
|
||||||
|
@ -1181,6 +1184,12 @@ ges_track_object_lookup_child (GESTrackObject * object, const gchar * prop_name,
|
||||||
g_strfreev (names);
|
g_strfreev (names);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
prop_hash_not_set:
|
||||||
|
{
|
||||||
|
GST_WARNING_OBJECT (object, "The child properties haven't been set yet");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1299,7 +1308,7 @@ cant_copy:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ges_track_object_set_child_property:
|
* ges_track_object_set_child_properties:
|
||||||
* @object: The #GESTrackObject parent object
|
* @object: The #GESTrackObject parent object
|
||||||
* @first_property_name: The name of the first property to set
|
* @first_property_name: The name of the first property to set
|
||||||
* @...: value for the first property, followed optionally by more
|
* @...: value for the first property, followed optionally by more
|
||||||
|
@ -1313,7 +1322,7 @@ cant_copy:
|
||||||
* Since: 0.10.2
|
* Since: 0.10.2
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ges_track_object_set_child_property (GESTrackObject * object,
|
ges_track_object_set_child_properties (GESTrackObject * object,
|
||||||
const gchar * first_property_name, ...)
|
const gchar * first_property_name, ...)
|
||||||
{
|
{
|
||||||
va_list var_args;
|
va_list var_args;
|
||||||
|
@ -1412,7 +1421,7 @@ ges_track_object_list_children_properties (GESTrackObject * object,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ges_track_object_get_child_property:
|
* ges_track_object_get_child_properties:
|
||||||
* @object: The origin #GESTrackObject
|
* @object: The origin #GESTrackObject
|
||||||
* @first_property_name: The name of the first property to get
|
* @first_property_name: The name of the first property to get
|
||||||
* @...: return location for the first property, followed optionally by more
|
* @...: return location for the first property, followed optionally by more
|
||||||
|
@ -1423,7 +1432,7 @@ ges_track_object_list_children_properties (GESTrackObject * object,
|
||||||
* Since: 0.10.2
|
* Since: 0.10.2
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ges_track_object_get_child_property (GESTrackObject * object,
|
ges_track_object_get_child_properties (GESTrackObject * object,
|
||||||
const gchar * first_property_name, ...)
|
const gchar * first_property_name, ...)
|
||||||
{
|
{
|
||||||
va_list var_args;
|
va_list var_args;
|
||||||
|
@ -1480,6 +1489,96 @@ prop_hash_not_set:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ges_track_object_set_child_property:
|
||||||
|
* @object: The origin #GESTrackObject
|
||||||
|
* @property_name: The name of the property
|
||||||
|
* @value: the value
|
||||||
|
*
|
||||||
|
* Sets a property of a GstElement contained in @object.
|
||||||
|
*
|
||||||
|
* Note that #ges_track_object_set_child_property is really
|
||||||
|
* intended for language bindings, #ges_track_object_set_child_properties
|
||||||
|
* is much more convenient for C programming.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the property was set, %FALSE otherwize
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
ges_track_object_set_child_property (GESTrackObject * object,
|
||||||
|
const gchar * property_name, GValue * value)
|
||||||
|
{
|
||||||
|
GParamSpec *pspec;
|
||||||
|
GstElement *element;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE);
|
||||||
|
|
||||||
|
if (!ges_track_object_lookup_child (object, property_name, &element, &pspec))
|
||||||
|
goto not_found;
|
||||||
|
|
||||||
|
g_object_set_property (G_OBJECT (element), pspec->name, value);
|
||||||
|
|
||||||
|
g_object_unref (element);
|
||||||
|
g_param_spec_unref (pspec);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
not_found:
|
||||||
|
{
|
||||||
|
GST_WARNING_OBJECT (object, "The %s property doesn't exist", property_name);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ges_track_object_get_child_property:
|
||||||
|
* @object: The origin #GESTrackObject
|
||||||
|
* @property_name: The name of the property
|
||||||
|
* @value: (out): return location for the property value, it will
|
||||||
|
* be initialized if it is initialized with 0
|
||||||
|
*
|
||||||
|
* In general, a copy is made of the property contents and
|
||||||
|
* the caller is responsible for freeing the memory by calling
|
||||||
|
* g_value_unset().
|
||||||
|
*
|
||||||
|
* Gets a property of a GstElement contained in @object.
|
||||||
|
*
|
||||||
|
* Note that #ges_track_object_get_child_property is really
|
||||||
|
* intended for language bindings, #ges_track_object_get_child_properties
|
||||||
|
* is much more convenient for C programming.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the property was found, %FALSE otherwize
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
ges_track_object_get_child_property (GESTrackObject * object,
|
||||||
|
const gchar * property_name, GValue * value)
|
||||||
|
{
|
||||||
|
GParamSpec *pspec;
|
||||||
|
GstElement *element;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE);
|
||||||
|
|
||||||
|
if (!ges_track_object_lookup_child (object, property_name, &element, &pspec))
|
||||||
|
goto not_found;
|
||||||
|
|
||||||
|
if (G_VALUE_TYPE (value) == G_TYPE_INVALID)
|
||||||
|
g_value_init (value, pspec->value_type);
|
||||||
|
|
||||||
|
g_object_get_property (G_OBJECT (element), pspec->name, value);
|
||||||
|
|
||||||
|
g_object_unref (element);
|
||||||
|
g_param_spec_unref (pspec);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
not_found:
|
||||||
|
{
|
||||||
|
GST_WARNING_OBJECT (object, "The %s property doesn't exist", property_name);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static GParamSpec **
|
static GParamSpec **
|
||||||
default_list_children_properties (GESTrackObject * object, guint * n_properties)
|
default_list_children_properties (GESTrackObject * object, guint * n_properties)
|
||||||
{
|
{
|
||||||
|
|
|
@ -208,7 +208,7 @@ ges_track_object_get_child_property_valist (GESTrackObject * object,
|
||||||
const gchar * first_property_name,
|
const gchar * first_property_name,
|
||||||
va_list var_args);
|
va_list var_args);
|
||||||
|
|
||||||
void ges_track_object_get_child_property (GESTrackObject *object,
|
void ges_track_object_get_child_properties (GESTrackObject *object,
|
||||||
const gchar * first_property_name,
|
const gchar * first_property_name,
|
||||||
...) G_GNUC_NULL_TERMINATED;
|
...) G_GNUC_NULL_TERMINATED;
|
||||||
|
|
||||||
|
@ -222,13 +222,21 @@ ges_track_object_set_child_property_by_pspec (GESTrackObject * object,
|
||||||
GParamSpec * pspec,
|
GParamSpec * pspec,
|
||||||
GValue * value);
|
GValue * value);
|
||||||
|
|
||||||
void ges_track_object_set_child_property (GESTrackObject * object,
|
void ges_track_object_set_child_properties (GESTrackObject * object,
|
||||||
const gchar * first_property_name,
|
const gchar * first_property_name,
|
||||||
...) G_GNUC_NULL_TERMINATED;
|
...) G_GNUC_NULL_TERMINATED;
|
||||||
|
|
||||||
GESTrackObject * ges_track_object_copy (GESTrackObject * object,
|
GESTrackObject * ges_track_object_copy (GESTrackObject * object,
|
||||||
gboolean deep);
|
gboolean deep);
|
||||||
|
|
||||||
|
gboolean ges_track_object_set_child_property (GESTrackObject *object,
|
||||||
|
const gchar *property_name,
|
||||||
|
GValue * value);
|
||||||
|
|
||||||
|
gboolean ges_track_object_get_child_property (GESTrackObject *object,
|
||||||
|
const gchar *property_name,
|
||||||
|
GValue * value);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
ges_track_object_edit (GESTrackObject * object,
|
ges_track_object_edit (GESTrackObject * object,
|
||||||
GList *layers, GESEditMode mode,
|
GList *layers, GESEditMode mode,
|
||||||
|
|
|
@ -356,9 +356,9 @@ GST_START_TEST (test_track_effect_set_properties)
|
||||||
(tl_effect), tck_effect));
|
(tl_effect), tck_effect));
|
||||||
fail_unless (ges_track_add_object (track_video, tck_effect));
|
fail_unless (ges_track_add_object (track_video, tck_effect));
|
||||||
|
|
||||||
ges_track_object_set_child_property (tck_effect,
|
ges_track_object_set_child_properties (tck_effect,
|
||||||
"GstAgingTV::scratch-lines", 17, "color-aging", FALSE, NULL);
|
"GstAgingTV::scratch-lines", 17, "color-aging", FALSE, NULL);
|
||||||
ges_track_object_get_child_property (tck_effect,
|
ges_track_object_get_child_properties (tck_effect,
|
||||||
"GstAgingTV::scratch-lines", &scratch_line,
|
"GstAgingTV::scratch-lines", &scratch_line,
|
||||||
"color-aging", &color_aging, NULL);
|
"color-aging", &color_aging, NULL);
|
||||||
fail_unless (scratch_line == 17);
|
fail_unless (scratch_line == 17);
|
||||||
|
@ -417,7 +417,7 @@ GST_START_TEST (test_tl_obj_signals)
|
||||||
GESTrack *track_video;
|
GESTrack *track_video;
|
||||||
GESTimelineParseLaunchEffect *tl_effect;
|
GESTimelineParseLaunchEffect *tl_effect;
|
||||||
GESTrackParseLaunchEffect *tck_effect;
|
GESTrackParseLaunchEffect *tck_effect;
|
||||||
guint val;
|
GValue val = { 0, };
|
||||||
|
|
||||||
ges_init ();
|
ges_init ();
|
||||||
|
|
||||||
|
@ -446,11 +446,14 @@ GST_START_TEST (test_tl_obj_signals)
|
||||||
g_signal_connect (tck_effect, "deep-notify", (GCallback) deep_prop_changed_cb,
|
g_signal_connect (tck_effect, "deep-notify", (GCallback) deep_prop_changed_cb,
|
||||||
tck_effect);
|
tck_effect);
|
||||||
|
|
||||||
ges_track_object_set_child_property (GES_TRACK_OBJECT (tck_effect),
|
ges_track_object_set_child_properties (GES_TRACK_OBJECT (tck_effect),
|
||||||
"GstAgingTV::scratch-lines", 17, NULL);
|
"GstAgingTV::scratch-lines", 17, NULL);
|
||||||
|
|
||||||
|
g_value_init (&val, G_TYPE_UINT);
|
||||||
ges_track_object_get_child_property (GES_TRACK_OBJECT (tck_effect),
|
ges_track_object_get_child_property (GES_TRACK_OBJECT (tck_effect),
|
||||||
"GstAgingTV::scratch-lines", &val, NULL);
|
"GstAgingTV::scratch-lines", &val);
|
||||||
fail_unless (val == 17);
|
fail_unless (G_VALUE_HOLDS_UINT (&val));
|
||||||
|
g_value_unset (&val);
|
||||||
|
|
||||||
ges_timeline_layer_remove_object (layer, (GESTimelineObject *) tl_effect);
|
ges_timeline_layer_remove_object (layer, (GESTimelineObject *) tl_effect);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue