mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
GESTrackObject: add a ges_track_object_set_child_property_method
test: Test the new method
This commit is contained in:
parent
28ea2cf7a1
commit
d9c07a4ed4
4 changed files with 84 additions and 4 deletions
|
@ -83,6 +83,7 @@ ges_track_object_get_inpoint
|
|||
ges_track_object_get_duration
|
||||
ges_track_object_get_priority
|
||||
ges_track_object_is_active
|
||||
ges_track_object_set_child_property
|
||||
<SUBSECTION Standard>
|
||||
GES_TRACK_OBJECT_DURATION
|
||||
GES_TRACK_OBJECT_INPOINT
|
||||
|
|
|
@ -920,3 +920,35 @@ ges_track_object_is_active (GESTrackObject * object)
|
|||
else
|
||||
return object->active;
|
||||
}
|
||||
|
||||
/**
|
||||
* ges_track_object_set_child_property:
|
||||
* @object: a #GESTrackObject
|
||||
* @property_name: The name of the property to set
|
||||
* @value: the value
|
||||
*
|
||||
* Sets a property of a child of @object. The property name
|
||||
* should look like ClasseName-property-name
|
||||
*/
|
||||
void
|
||||
ges_track_object_set_child_property (GESTrackObject * object,
|
||||
const gchar * property_name, GValue * value)
|
||||
{
|
||||
GESTrackObjectPrivate *priv = object->priv;
|
||||
|
||||
if (priv->properties_hashtable) {
|
||||
GstElement *element;
|
||||
gchar **prop_name;
|
||||
|
||||
element = g_hash_table_lookup (priv->properties_hashtable, property_name);
|
||||
if (element) {
|
||||
prop_name = g_strsplit (property_name, "-", 2);
|
||||
g_object_set_property (G_OBJECT (element), prop_name[1], value);
|
||||
g_strfreev (prop_name);
|
||||
} else {
|
||||
GST_ERROR ("The %s property doesn't exist", property_name);
|
||||
}
|
||||
} else {
|
||||
GST_DEBUG ("The child properties haven't been set on %p", object);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,6 +152,7 @@ void ges_track_object_set_start (GESTrackObject * object, guint64 start);
|
|||
void ges_track_object_set_inpoint (GESTrackObject * object, guint64 inpoint);
|
||||
void ges_track_object_set_duration (GESTrackObject * object, guint64 duration);
|
||||
void ges_track_object_set_priority (GESTrackObject * object, guint32 priority);
|
||||
gboolean ges_track_object_set_active (GESTrackObject * object, gboolean active);
|
||||
|
||||
guint64 ges_track_object_get_start (GESTrackObject * object);
|
||||
guint64 ges_track_object_get_inpoint (GESTrackObject * object);
|
||||
|
@ -159,7 +160,7 @@ guint64 ges_track_object_get_duration (GESTrackObject * object);
|
|||
guint32 ges_track_object_get_priority (GESTrackObject * object);
|
||||
gboolean ges_track_object_is_active (GESTrackObject * object);
|
||||
|
||||
gboolean ges_track_object_set_active (GESTrackObject * object, gboolean active);
|
||||
void ges_track_object_set_child_property (GESTrackObject * object,
|
||||
const gchar * property_name, GValue * value);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _GES_TRACK_OBJECT */
|
||||
|
|
|
@ -218,8 +218,8 @@ GST_START_TEST (test_tl_effect)
|
|||
GES_TRACK_OPERATION (tmp->data));
|
||||
fail_unless (priority > effect_prio);
|
||||
fail_unless (GES_IS_TRACK_EFFECT (tmp->data));
|
||||
fail_unless (ges_track_object_get_track (GES_TRACK_OBJECT (tmp->data))->
|
||||
type == track_type[i]);
|
||||
fail_unless (ges_track_object_get_track (GES_TRACK_OBJECT (tmp->
|
||||
data))->type == track_type[i]);
|
||||
effect_prio = priority;
|
||||
|
||||
g_object_unref (tmp->data);
|
||||
|
@ -313,6 +313,51 @@ GST_START_TEST (test_priorities_tl_object)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_track_effect_set_properties)
|
||||
{
|
||||
GESTimeline *timeline;
|
||||
GESTimelineLayer *layer;
|
||||
GESTrack *track_video;
|
||||
GESTimelineEffect *tl_effect;
|
||||
GESTrackEffect *tck_effect;
|
||||
GValue value = { 0 };
|
||||
|
||||
ges_init ();
|
||||
|
||||
timeline = ges_timeline_new ();
|
||||
layer = (GESTimelineLayer *) ges_simple_timeline_layer_new ();
|
||||
track_video = ges_track_video_raw_new ();
|
||||
|
||||
ges_timeline_add_track (timeline, track_video);
|
||||
ges_timeline_add_layer (timeline, layer);
|
||||
|
||||
GST_DEBUG ("Create effect");
|
||||
tl_effect = ges_timeline_effect_new_from_bin_desc ("agingtv", NULL);
|
||||
|
||||
g_object_set (tl_effect, "duration", 25 * GST_SECOND, NULL);
|
||||
|
||||
ges_simple_timeline_layer_add_object ((GESSimpleTimelineLayer *) (layer),
|
||||
(GESTimelineObject *) tl_effect, 0);
|
||||
|
||||
tck_effect = ges_track_effect_new_from_bin_desc ("agingtv");
|
||||
fail_unless (ges_timeline_object_add_track_object (GES_TIMELINE_OBJECT
|
||||
(tl_effect), GES_TRACK_OBJECT (tck_effect)));
|
||||
fail_unless (ges_track_add_object (track_video,
|
||||
GES_TRACK_OBJECT (tck_effect)));
|
||||
|
||||
g_value_init (&value, G_TYPE_UINT);
|
||||
g_value_set_uint (&value, 17);
|
||||
|
||||
ges_track_object_set_child_property (GES_TRACK_OBJECT (tck_effect),
|
||||
"GstAgingTV-scratch-lines", &value);
|
||||
|
||||
ges_timeline_layer_remove_object (layer, (GESTimelineObject *) tl_effect);
|
||||
|
||||
g_object_unref (timeline);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
ges_suite (void)
|
||||
{
|
||||
|
@ -326,6 +371,7 @@ ges_suite (void)
|
|||
tcase_add_test (tc_chain, test_get_effects_from_tl);
|
||||
tcase_add_test (tc_chain, test_tl_effect);
|
||||
tcase_add_test (tc_chain, test_priorities_tl_object);
|
||||
tcase_add_test (tc_chain, test_track_effect_set_properties);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue