clip: Copy trackelement's metadata upon splitting

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/260>
This commit is contained in:
Piotrek Brzeziński 2021-07-21 19:31:53 +02:00
parent 951e6181ce
commit a5a793f8b6
2 changed files with 12 additions and 0 deletions

View file

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

View file

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