summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@gnome.org>2016-01-25 11:56:57 +0100
committerThibault Saunier <tsaunier@gnome.org>2016-02-04 15:23:21 +0100
commit7211e6982fdbf20db1877a618921ff2c7d2d0a06 (patch)
tree509982800a6418945973efb0df7af13036e22649
parent799c11b58c04f499aa013ddfba8808828aadce26 (diff)
ges: track-element: Try to create NleObject as soon as possible
This way we have informations about the content of the children as soon as possible. Most code paths where already ready to handle that as we use it for copying clips. Fix framepositionner to properly handle that (it would have broke with copied clips before). Reviewed-by: Thibault Saunier <thibault.saunier@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D736
-rw-r--r--ges/ges-track-element.c9
-rw-r--r--ges/gstframepositionner.c33
2 files changed, 19 insertions, 23 deletions
diff --git a/ges/ges-track-element.c b/ges/ges-track-element.c
index 16f5f078..2ba1089d 100644
--- a/ges/ges-track-element.c
+++ b/ges/ges-track-element.c
@@ -105,6 +105,7 @@ GESTrackType _get_track_types (GESTimelineElement * object);
static GParamSpec **default_list_children_properties (GESTrackElement * object,
guint * n_properties);
+static gboolean ensure_nle_object (GESTrackElement * object);
static void
_update_control_bindings (GESTimelineElement * element, GstClockTime inpoint,
@@ -208,9 +209,11 @@ ges_track_element_dispose (GObject * object)
}
static void
-ges_track_element_finalize (GObject * object)
+ges_track_element_constructed (GObject * object)
{
- G_OBJECT_CLASS (ges_track_element_parent_class)->finalize (object);
+ ensure_nle_object (GES_TRACK_ELEMENT (object));
+
+ G_OBJECT_CLASS (ges_track_element_parent_class)->constructed (object);
}
static void
@@ -224,7 +227,7 @@ ges_track_element_class_init (GESTrackElementClass * klass)
object_class->get_property = ges_track_element_get_property;
object_class->set_property = ges_track_element_set_property;
object_class->dispose = ges_track_element_dispose;
- object_class->finalize = ges_track_element_finalize;
+ object_class->constructed = ges_track_element_constructed;
/**
diff --git a/ges/gstframepositionner.c b/ges/gstframepositionner.c
index b4aaef2a..8c42f90b 100644
--- a/ges/gstframepositionner.c
+++ b/ges/gstframepositionner.c
@@ -165,8 +165,7 @@ _track_restriction_changed_cb (GESTrack * track, GParamSpec * arg G_GNUC_UNUSED,
}
static void
-_track_changed_cb (GESTrackElement * trksrc, GParamSpec * arg G_GNUC_UNUSED,
- GstFramePositionner * pos)
+set_track (GstFramePositionner * pos)
{
GESTrack *new_track;
@@ -177,17 +176,26 @@ _track_changed_cb (GESTrackElement * trksrc, GParamSpec * arg G_GNUC_UNUSED,
(GWeakNotify) _weak_notify_cb, pos);
}
- new_track = ges_track_element_get_track (trksrc);
+ new_track = ges_track_element_get_track (pos->track_source);
if (new_track) {
pos->current_track = new_track;
g_object_weak_ref (G_OBJECT (new_track), (GWeakNotify) _weak_notify_cb,
pos);
GST_DEBUG_OBJECT (pos, "connecting to track : %p", pos->current_track);
+
g_signal_connect (pos->current_track, "notify::restriction-caps",
(GCallback) _track_restriction_changed_cb, pos);
sync_properties_with_track (pos, pos->current_track);
- } else
+ } else {
pos->current_track = NULL;
+ }
+}
+
+static void
+_track_changed_cb (GESTrackElement * trksrc, GParamSpec * arg G_GNUC_UNUSED,
+ GstFramePositionner * pos)
+{
+ set_track (pos);
}
void
@@ -198,24 +206,9 @@ ges_frame_positionner_set_source_and_filter (GstFramePositionner * pos,
pos->capsfilter = capsfilter;
pos->current_track = ges_track_element_get_track (trksrc);
- if (!pos->current_track) {
- GST_INFO_OBJECT (pos, "No track set, won't be usable");
-
- return;
- }
-
- g_object_add_weak_pointer (G_OBJECT (pos->track_source),
- ((gpointer *) & pos->track_source));
- g_object_weak_ref (G_OBJECT (pos->current_track),
- (GWeakNotify) _weak_notify_cb, pos);
-
- GST_DEBUG_OBJECT (pos, "connecting to track : %p", pos->current_track);
-
- g_signal_connect (pos->current_track, "notify::restriction-caps",
- (GCallback) _track_restriction_changed_cb, pos);
g_signal_connect (trksrc, "notify::track", (GCallback) _track_changed_cb,
pos);
- sync_properties_with_track (pos, pos->current_track);
+ set_track (pos);
}
static void