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
This commit is contained in:
Henry Wilkes 2019-10-16 16:40:27 +01:00
parent 0c96b9dd10
commit cab4a52dde
2 changed files with 13 additions and 7 deletions

View file

@ -162,9 +162,10 @@ ges_marker_list_class_init (GESMarkerListClass * klass)
object_class->finalize = ges_marker_list_finalize; object_class->finalize = ges_marker_list_finalize;
/** /**
* GESMarkerList::marker-added: * GESMarkerList::marker-added:
* @marker-list: the #GESMarkerList * @marker-list: the #GESMarkerList
* @position: the position of the added marker
* @marker: the #GESMarker that was added. * @marker: the #GESMarker that was added.
* *
* Will be emitted after the marker was added to the marker-list. * 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: * GESMarkerList::marker-moved:
* @marker-list: the #GESMarkerList * @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. * Will be emitted after the marker was moved to.
* Since: 1.18 * Since: 1.18
@ -199,7 +202,7 @@ ges_marker_list_class_init (GESMarkerListClass * klass)
ges_marker_list_signals[MARKER_MOVED] = ges_marker_list_signals[MARKER_MOVED] =
g_signal_new ("marker-moved", G_TYPE_FROM_CLASS (klass), g_signal_new ("marker-moved", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic, 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 static gint
@ -358,6 +361,7 @@ ges_marker_list_move (GESMarkerList * self, GESMarker * marker,
{ {
GSequenceIter *iter; GSequenceIter *iter;
gboolean ret = FALSE; gboolean ret = FALSE;
GstClockTime previous_position;
g_return_val_if_fail (GES_IS_MARKER_LIST (self), FALSE); 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; goto done;
} }
previous_position = marker->position;
marker->position = position; marker->position = position;
g_signal_emit (self, ges_marker_list_signals[MARKER_MOVED], 0, position, g_signal_emit (self, ges_marker_list_signals[MARKER_MOVED], 0,
marker); previous_position, position, marker);
g_sequence_sort_changed (iter, cmp_marker, NULL); g_sequence_sort_changed (iter, cmp_marker, NULL);

View file

@ -150,9 +150,10 @@ GST_END_TEST;
static void static void
marker_moved_cb (GESMarkerList * mlist, GstClockTime position, marker_moved_cb (GESMarkerList * mlist, GstClockTime prev_position,
GESMarker * marker, gboolean * called) GstClockTime position, GESMarker * marker, gboolean * called)
{ {
fail_unless_equals_int (prev_position, 10);
fail_unless_equals_int (position, 42); fail_unless_equals_int (position, 42);
ASSERT_OBJECT_REFCOUNT (marker, "local ref + signal", 2); ASSERT_OBJECT_REFCOUNT (marker, "local ref + signal", 2);