GESTimelineObject: use GESTrackEffect as base classe for effects and not GESTrackOperation.

This commit is contained in:
Thibault Saunier 2011-02-16 14:05:14 +01:00 committed by Edward Hervey
parent 20c2d1df71
commit 9dccf8d475
3 changed files with 28 additions and 30 deletions

View file

@ -261,26 +261,26 @@ ges_timeline_object_class_init (GESTimelineObjectClass * klass)
/**
* GESTimelineObject::effect-added
* @object: the #GESTimelineObject
* @efect: the #GESTrackOperation that was added.
* @effect: the #GESTrackEffect that was added.
*
* Will be emitted after an effect was added to the object.
*/
ges_timeline_object_signals[EFFECT_ADDED] =
g_signal_new ("effect-added", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, ges_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, GES_TYPE_TRACK_OPERATION);
G_TYPE_NONE, 1, GES_TYPE_TRACK_EFFECT);
/**
* GESTimelineObject::effect-removed
* @object: the #GESTimelineObject
* @efect: the #GESTrackOperation that was added.
* @effect: the #GESTrackEffect that was added.
*
* Will be emitted after an effect was remove from the object.
*/
ges_timeline_object_signals[EFFECT_REMOVED] =
g_signal_new ("effect-removed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, ges_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, GES_TYPE_TRACK_OPERATION);
G_TYPE_NONE, 1, GES_TYPE_TRACK_EFFECT);
klass->need_fill_track = TRUE;
}
@ -397,9 +397,10 @@ ges_timeline_object_add_track_object (GESTimelineObject * object, GESTrackObject
ObjectMapping *mapping;
GList *tmp;
GESTimelineObjectPrivate *priv = object->priv;
gboolean is_effect = GES_IS_TRACK_EFFECT (trobj);
GST_LOG ("Got a TrackObject : %p , setting the timeline object as its"
"creator. Is a TrackOperation %i", trobj, GES_IS_TRACK_OPERATION (trobj));
"creator. Is a TrackEffect %i", trobj, is_effect);
if (!trobj)
return FALSE;
@ -418,14 +419,14 @@ ges_timeline_object_add_track_object (GESTimelineObject * object, GESTrackObject
mapping->priority_offset = priv->nb_effects;
/* If the trackobject is an operation:
* - We add it on top of the list of TrackOperation
/* If the trackobject is an effect:
* - We add it on top of the list of TrackEffect
* - We put all TrackObject present in the TimelineObject
* which are not TrackEffect on top of them
*
* FIXME: Let the full control over priorities to the user
*/
if (GES_IS_TRACK_OPERATION (trobj)) {
if (is_effect) {
GST_DEBUG
("Moving non on top effect under other TrackObject-s, nb effects %i",
priv->nb_effects);
@ -444,7 +445,7 @@ ges_timeline_object_add_track_object (GESTimelineObject * object, GESTrackObject
/* emit 'effect-added' */
g_signal_emit (object, ges_timeline_object_signals[EFFECT_ADDED], 0,
GES_TRACK_OPERATION (trobj));
GES_TRACK_EFFECT (trobj));
}
object->priv->trackobjects =
@ -525,10 +526,10 @@ ges_timeline_object_release_track_object (GESTimelineObject * object,
object->priv->trackobjects =
g_list_remove (object->priv->trackobjects, trackobject);
if (GES_IS_TRACK_OPERATION (trackobject)) {
if (GES_IS_TRACK_EFFECT (trackobject)) {
/* emit 'object-removed' */
g_signal_emit (object, ges_timeline_object_signals[EFFECT_REMOVED], 0,
GES_TRACK_OPERATION (trackobject));
GES_TRACK_EFFECT (trackobject));
}
ges_track_object_set_timeline_object (trackobject, NULL);
@ -848,10 +849,10 @@ sort_track_effects (gpointer a, gpointer b, GESTimelineObject * object)
*
* Get effects applied on @object
*
* Returns: a #GList of the #GESTrackOperation that are applied on
* Returns: a #GList of the #GESTrackEffect that are applied on
* @object order by ascendant priorities.
* The refcount of the objects will be increased. The user will have to
* unref each #GESTrackOperation and free the #GList.
* unref each #GESTrackEffect and free the #GList.
*/
GList *
ges_timeline_object_get_effects (GESTimelineObject * object)
@ -882,7 +883,7 @@ ges_timeline_object_get_effects (GESTimelineObject * object)
*/
gint
ges_timeline_object_get_top_effect_position (GESTimelineObject * object,
GESTrackOperation * effect)
GESTrackEffect * effect)
{
return find_object_mapping (object,
GES_TRACK_OBJECT (effect))->priority_offset;
@ -901,7 +902,7 @@ ges_timeline_object_get_top_effect_position (GESTimelineObject * object,
*/
gboolean
ges_timeline_object_set_top_effect_priority (GESTimelineObject * object,
GESTrackOperation * effect, guint newpriority)
GESTrackEffect * effect, guint newpriority)
{
GList *tmp;
guint inc;

View file

@ -246,11 +246,11 @@ ges_timeline_object_get_effects (GESTimelineObject *object);
gint
ges_timeline_object_get_top_effect_position (GESTimelineObject *object,
GESTrackOperation *effect);
GESTrackEffect *effect);
gboolean
ges_timeline_object_set_top_effect_priority (GESTimelineObject *object,
GESTrackOperation *effect, guint newpriority);
GESTrackEffect *effect, guint newpriority);
G_END_DECLS

View file

@ -18,12 +18,10 @@
*/
#include <ges/ges.h>
#include <ges/ges-track-operation.h>
#include <gst/check/gstcheck.h>
void
effect_added_cb (GESTimelineObject * obj, GESTrackOperation * trop,
gpointer data);
effect_added_cb (GESTimelineObject * obj, GESTrackEffect * trop, gpointer data);
void
deep_prop_changed_cb (GESTrackObject * obj, GstElement * element,
GParamSpec * spec);
@ -148,7 +146,7 @@ GST_START_TEST (test_get_effects_from_tl)
gint priority =
ges_timeline_object_get_top_effect_position (GES_TIMELINE_OBJECT
(source),
GES_TRACK_OPERATION (tmp->data));
GES_TRACK_EFFECT (tmp->data));
fail_unless (priority > effect_prio);
fail_unless (GES_IS_TRACK_EFFECT (tmp->data));
effect_prio = priority;
@ -222,11 +220,11 @@ GST_START_TEST (test_tl_effect)
gint priority =
ges_timeline_object_get_top_effect_position (GES_TIMELINE_OBJECT
(tl_effect),
GES_TRACK_OPERATION (tmp->data));
GES_TRACK_EFFECT (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);
@ -286,13 +284,13 @@ GST_START_TEST (test_priorities_tl_object)
GES_TRACK_OBJECT (tck_effect1)));
fail_unless (ges_timeline_object_set_top_effect_priority (GES_TIMELINE_OBJECT
(tl_effect), GES_TRACK_OPERATION (tck_effect1), 0));
(tl_effect), GES_TRACK_EFFECT (tck_effect1), 0));
fail_unless (ges_track_object_get_priority (GES_TRACK_OBJECT (tck_effect)) ==
3);
fail_unless (ges_timeline_object_set_top_effect_priority (GES_TIMELINE_OBJECT
(tl_effect), GES_TRACK_OPERATION (tck_effect1), 3));
(tl_effect), GES_TRACK_EFFECT (tck_effect1), 3));
fail_unless (ges_track_object_get_priority (GES_TRACK_OBJECT (tck_effect)) ==
2);
@ -304,7 +302,7 @@ GST_START_TEST (test_priorities_tl_object)
gint priority =
ges_timeline_object_get_top_effect_position (GES_TIMELINE_OBJECT
(tl_effect),
GES_TRACK_OPERATION (tmp->data));
GES_TRACK_EFFECT (tmp->data));
fail_unless (priority > effect_prio);
fail_unless (GES_IS_TRACK_EFFECT (tmp->data));
effect_prio = priority;
@ -369,12 +367,11 @@ GST_START_TEST (test_track_effect_set_properties)
GST_END_TEST;
void
effect_added_cb (GESTimelineObject * obj, GESTrackOperation * trop,
gpointer data)
effect_added_cb (GESTimelineObject * obj, GESTrackEffect * trop, gpointer data)
{
GST_DEBUG ("Effect added");
fail_unless (GES_IS_TIMELINE_OBJECT (obj));
fail_unless (GES_IS_TRACK_OPERATION (trop));
fail_unless (GES_IS_TRACK_EFFECT (trop));
}
void