From: Thibault Saunier Date: Thu, 10 Jan 2013 16:32:15 +0000 (-0300) Subject: timeline: Avoid recreating the moving_tlobjs when unecessary X-Git-Tag: 1.19.3~493^2~2045 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eeef1548b3708112de58915dda8fb88de5a4fc23;p=platform%2Fupstream%2Fgstreamer.git timeline: Avoid recreating the moving_tlobjs when unecessary --- diff --git a/ges/ges-timeline.c b/ges/ges-timeline.c index 25e3c5f..c76a6d1 100644 --- a/ges/ges-timeline.c +++ b/ges/ges-timeline.c @@ -48,7 +48,7 @@ typedef struct _MoveContext MoveContext; static GPtrArray *select_tracks_for_object_default (GESTimeline * timeline, GESTimelineObject * tl_obj, GESTrackObject * tr_obj, gpointer user_data); -static inline void init_movecontext (MoveContext * mv_ctx); +static inline void init_movecontext (MoveContext * mv_ctx, gboolean first_init); static void ges_extractable_interface_init (GESExtractableInterface * iface); static void ges_meta_container_interface_init (GESMetaContainerInterface * iface); @@ -499,7 +499,7 @@ ges_timeline_init (GESTimeline * self) priv->snapping_distance = 0; /* Move context initialization */ - init_movecontext (&self->priv->movecontext); + init_movecontext (&self->priv->movecontext, TRUE); priv->movecontext.ignore_needs_ctx = FALSE; priv->priv_tracks = NULL; @@ -631,10 +631,12 @@ sort_starts_ends_start (GESTimeline * timeline, TrackObjIters * iters) /* Timeline edition functions */ static inline void -init_movecontext (MoveContext * mv_ctx) +init_movecontext (MoveContext * mv_ctx, gboolean first_init) { + if (G_UNLIKELY (first_init)) + mv_ctx->moving_tlobjs = g_hash_table_new (g_direct_hash, g_direct_equal); + mv_ctx->moving_tckobjs = NULL; - mv_ctx->moving_tlobjs = g_hash_table_new (g_direct_hash, g_direct_equal); mv_ctx->max_trim_pos = G_MAXUINT64; mv_ctx->min_move_layer = G_MAXUINT; mv_ctx->max_layer_prio = 0; @@ -647,8 +649,8 @@ static inline void clean_movecontext (MoveContext * mv_ctx) { g_list_free (mv_ctx->moving_tckobjs); - g_hash_table_unref (mv_ctx->moving_tlobjs); - init_movecontext (mv_ctx); + g_hash_table_remove_all (mv_ctx->moving_tlobjs); + init_movecontext (mv_ctx, FALSE); } static void