mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +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
|
@ -164,8 +164,8 @@ C. Keyframes
|
|||
* Gets a property of a GstElement contained in @object.
|
||||
*/
|
||||
void ges_track_object_get_child_property (GESTrackObject *object,
|
||||
const gchar *property_name,
|
||||
gpointer value);
|
||||
const gchar *property_name,
|
||||
GValue * value);
|
||||
=> DONE
|
||||
|
||||
/**
|
||||
|
|
|
@ -107,9 +107,11 @@ ges_track_object_is_active
|
|||
ges_track_object_lookup_child
|
||||
ges_track_object_list_children_properties
|
||||
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_by_pspec
|
||||
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_by_pspec
|
||||
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)")) {
|
||||
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);
|
||||
g_strfreev (val);
|
||||
|
||||
|
|
|
@ -1153,6 +1153,9 @@ ges_track_object_lookup_child (GESTrackObject * object, const gchar * prop_name,
|
|||
|
||||
priv = object->priv;
|
||||
|
||||
if (!priv->properties_hashtable)
|
||||
goto prop_hash_not_set;
|
||||
|
||||
classename = NULL;
|
||||
res = FALSE;
|
||||
|
||||
|
@ -1181,6 +1184,12 @@ ges_track_object_lookup_child (GESTrackObject * object, const gchar * prop_name,
|
|||
g_strfreev (names);
|
||||
|
||||
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
|
||||
* @first_property_name: The name of the first property to set
|
||||
* @...: value for the first property, followed optionally by more
|
||||
|
@ -1313,7 +1322,7 @@ cant_copy:
|
|||
* Since: 0.10.2
|
||||
*/
|
||||
void
|
||||
ges_track_object_set_child_property (GESTrackObject * object,
|
||||
ges_track_object_set_child_properties (GESTrackObject * object,
|
||||
const gchar * first_property_name, ...)
|
||||
{
|
||||
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
|
||||
* @first_property_name: The name of the first property to get
|
||||
* @...: 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
|
||||
*/
|
||||
void
|
||||
ges_track_object_get_child_property (GESTrackObject * object,
|
||||
ges_track_object_get_child_properties (GESTrackObject * object,
|
||||
const gchar * first_property_name, ...)
|
||||
{
|
||||
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 **
|
||||
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,
|
||||
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,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
|
@ -222,13 +222,21 @@ ges_track_object_set_child_property_by_pspec (GESTrackObject * object,
|
|||
GParamSpec * pspec,
|
||||
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,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
GESTrackObject * ges_track_object_copy (GESTrackObject * object,
|
||||
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
|
||||
ges_track_object_edit (GESTrackObject * object,
|
||||
GList *layers, GESEditMode mode,
|
||||
|
|
|
@ -356,9 +356,9 @@ GST_START_TEST (test_track_effect_set_properties)
|
|||
(tl_effect), 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);
|
||||
ges_track_object_get_child_property (tck_effect,
|
||||
ges_track_object_get_child_properties (tck_effect,
|
||||
"GstAgingTV::scratch-lines", &scratch_line,
|
||||
"color-aging", &color_aging, NULL);
|
||||
fail_unless (scratch_line == 17);
|
||||
|
@ -417,7 +417,7 @@ GST_START_TEST (test_tl_obj_signals)
|
|||
GESTrack *track_video;
|
||||
GESTimelineParseLaunchEffect *tl_effect;
|
||||
GESTrackParseLaunchEffect *tck_effect;
|
||||
guint val;
|
||||
GValue val = { 0, };
|
||||
|
||||
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,
|
||||
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);
|
||||
|
||||
g_value_init (&val, G_TYPE_UINT);
|
||||
ges_track_object_get_child_property (GES_TRACK_OBJECT (tck_effect),
|
||||
"GstAgingTV::scratch-lines", &val, NULL);
|
||||
fail_unless (val == 17);
|
||||
"GstAgingTV::scratch-lines", &val);
|
||||
fail_unless (G_VALUE_HOLDS_UINT (&val));
|
||||
g_value_unset (&val);
|
||||
|
||||
ges_timeline_layer_remove_object (layer, (GESTimelineObject *) tl_effect);
|
||||
|
||||
|
|
Loading…
Reference in a new issue