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
This commit is contained in:
Thibault Saunier 2016-01-25 11:56:57 +01:00
parent 799c11b58c
commit 7211e6982f
2 changed files with 19 additions and 23 deletions

View file

@ -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;
/**

View file

@ -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