summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotrek Brzeziński <thewildtree@outlook.com>2021-07-21 19:31:53 +0200
committerPiotrek Brzeziński <thewildtree@outlook.com>2021-08-14 15:46:07 +0200
commita5a793f8b6845b5dbefd3e7cd0ce41e5c9cb1e9c (patch)
tree10ab6a0e5780323bf021b6d55a6a5960cd5b0807
parent951e6181ce7106d2ed9f55474b3db8fe538867f7 (diff)
clip: Copy trackelement's metadata upon splitting
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/260>
-rw-r--r--ges/ges-clip.c5
-rw-r--r--tests/check/ges/clip.c7
2 files changed, 12 insertions, 0 deletions
diff --git a/ges/ges-clip.c b/ges/ges-clip.c
index fbd4f471..1b297b37 100644
--- a/ges/ges-clip.c
+++ b/ges/ges-clip.c
@@ -3480,6 +3480,7 @@ ges_clip_split_full (GESClip * clip, guint64 position, GError ** error)
GESTrackElement *copy, *orig = tmp->data;
GESTrack *track = ges_track_element_get_track (orig);
GESAutoTransition *trans;
+ gchar *meta;
copy = ges_clip_copy_track_element_into (new_object, orig, new_inpoint);
@@ -3490,6 +3491,10 @@ ges_clip_split_full (GESClip * clip, guint64 position, GError ** error)
g_hash_table_insert (track_for_copy, gst_object_ref (copy),
gst_object_ref (track));
+ meta = ges_meta_container_metas_to_string (GES_META_CONTAINER (orig));
+ ges_meta_container_add_metas_from_string (GES_META_CONTAINER (copy), meta);
+ g_free (meta);
+
trans = timeline ?
ges_timeline_get_auto_transition_at_edge (timeline, orig,
GES_EDGE_END) : NULL;
diff --git a/tests/check/ges/clip.c b/tests/check/ges/clip.c
index cabb3e2c..f2a9d23d 100644
--- a/tests/check/ges/clip.c
+++ b/tests/check/ges/clip.c
@@ -475,6 +475,7 @@ GST_START_TEST (test_split_object)
*splittrackelement;
guint32 priority1, priority2, effect_priority1, effect_priority2;
guint selection_called = 0;
+ const gchar *meta;
ges_init ();
@@ -502,6 +503,9 @@ GST_START_TEST (test_split_object)
fail_unless (trackelement1 != NULL);
fail_unless (GES_TIMELINE_ELEMENT_PARENT (trackelement1) ==
GES_TIMELINE_ELEMENT (clip));
+ ges_meta_container_set_string (GES_META_CONTAINER (trackelement1), "test_key",
+ "test_value");
+
trackelement2 = GES_CONTAINER_CHILDREN (clip)->next->data;
fail_unless (trackelement2 != NULL);
fail_unless (GES_TIMELINE_ELEMENT_PARENT (trackelement2) ==
@@ -633,6 +637,9 @@ GST_START_TEST (test_split_object)
assert_equals_int (GES_TIMELINE_ELEMENT_PRIORITY (splittrackelement),
priority1 + 3);
fail_unless (GES_TIMELINE_ELEMENT_PRIORITY (trackelement1) == priority2);
+ meta = ges_meta_container_get_string (GES_META_CONTAINER (splittrackelement),
+ "test_key");
+ fail_unless_equals_string (meta, "test_value");
fail_unless (splittrackelement != trackelement1);
fail_unless (splittrackelement != trackelement2);