From cab4a52ddea843b21f0626a4a01bbce9b286bca1 Mon Sep 17 00:00:00 2001 From: Henry Wilkes Date: Wed, 16 Oct 2019 16:40:27 +0100 Subject: [PATCH] marker-list: add prev position to ::marker-moved Additionally give the previous marker position in the GESMarkerList::marker-moved signal, since a user may want to know where a move was from. Also, fixed the documentation for GESMarkerList::marker-added https://gitlab.freedesktop.org/gstreamer/gst-editing-services/issues/78 --- ges/ges-marker-list.c | 15 ++++++++++----- tests/check/ges/markerlist.c | 5 +++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ges/ges-marker-list.c b/ges/ges-marker-list.c index d0dde9cc26..4d8272ce49 100644 --- a/ges/ges-marker-list.c +++ b/ges/ges-marker-list.c @@ -162,9 +162,10 @@ ges_marker_list_class_init (GESMarkerListClass * klass) object_class->finalize = ges_marker_list_finalize; - /** +/** * GESMarkerList::marker-added: * @marker-list: the #GESMarkerList + * @position: the position of the added marker * @marker: the #GESMarker that was added. * * Will be emitted after the marker was added to the marker-list. @@ -191,7 +192,9 @@ ges_marker_list_class_init (GESMarkerListClass * klass) /** * GESMarkerList::marker-moved: * @marker-list: the #GESMarkerList - * @marker: the #GESMarker that was added. + * @previous-position: the previous position of the marker + * @new-position: the new position of the marker + * @marker: the #GESMarker that was moved. * * Will be emitted after the marker was moved to. * Since: 1.18 @@ -199,7 +202,7 @@ ges_marker_list_class_init (GESMarkerListClass * klass) ges_marker_list_signals[MARKER_MOVED] = g_signal_new ("marker-moved", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic, - G_TYPE_NONE, 2, G_TYPE_UINT64, GES_TYPE_MARKER); + G_TYPE_NONE, 3, G_TYPE_UINT64, G_TYPE_UINT64, GES_TYPE_MARKER); } static gint @@ -358,6 +361,7 @@ ges_marker_list_move (GESMarkerList * self, GESMarker * marker, { GSequenceIter *iter; gboolean ret = FALSE; + GstClockTime previous_position; g_return_val_if_fail (GES_IS_MARKER_LIST (self), FALSE); @@ -367,10 +371,11 @@ ges_marker_list_move (GESMarkerList * self, GESMarker * marker, goto done; } + previous_position = marker->position; marker->position = position; - g_signal_emit (self, ges_marker_list_signals[MARKER_MOVED], 0, position, - marker); + g_signal_emit (self, ges_marker_list_signals[MARKER_MOVED], 0, + previous_position, position, marker); g_sequence_sort_changed (iter, cmp_marker, NULL); diff --git a/tests/check/ges/markerlist.c b/tests/check/ges/markerlist.c index 588490da93..b41b00f71c 100644 --- a/tests/check/ges/markerlist.c +++ b/tests/check/ges/markerlist.c @@ -150,9 +150,10 @@ GST_END_TEST; static void -marker_moved_cb (GESMarkerList * mlist, GstClockTime position, - GESMarker * marker, gboolean * called) +marker_moved_cb (GESMarkerList * mlist, GstClockTime prev_position, + GstClockTime position, GESMarker * marker, gboolean * called) { + fail_unless_equals_int (prev_position, 10); fail_unless_equals_int (position, 42); ASSERT_OBJECT_REFCOUNT (marker, "local ref + signal", 2);