mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 04:56:24 +00:00
xmptag: More efficient GSList usage
Instead of constantly appending (which gets more and more expensive), just prepend to the list (O(1)) and reverse the list before usage. https://bugzilla.gnome.org/show_bug.cgi?id=702545
This commit is contained in:
parent
4dd5c5b808
commit
420dacb2d5
1 changed files with 6 additions and 2 deletions
|
@ -1338,7 +1338,7 @@ gst_tag_list_from_xmp_buffer (GstBuffer * buffer)
|
|||
ptag->xmp_tag = xmp_tag;
|
||||
ptag->str = g_strdup (v);
|
||||
|
||||
pending_tags = g_slist_append (pending_tags, ptag);
|
||||
pending_tags = g_slist_prepend (pending_tags, ptag);
|
||||
}
|
||||
}
|
||||
/* restore chars overwritten by '\0' */
|
||||
|
@ -1431,7 +1431,7 @@ gst_tag_list_from_xmp_buffer (GstBuffer * buffer)
|
|||
ptag->xmp_tag = last_xmp_tag;
|
||||
ptag->str = g_strdup (part);
|
||||
|
||||
pending_tags = g_slist_append (pending_tags, ptag);
|
||||
pending_tags = g_slist_prepend (pending_tags, ptag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1442,6 +1442,10 @@ gst_tag_list_from_xmp_buffer (GstBuffer * buffer)
|
|||
}
|
||||
}
|
||||
|
||||
pending_tags = g_slist_reverse (pending_tags);
|
||||
|
||||
GST_DEBUG ("Done accumulating tags, now handling them");
|
||||
|
||||
while (pending_tags) {
|
||||
PendingXmpTag *ptag = (PendingXmpTag *) pending_tags->data;
|
||||
|
||||
|
|
Loading…
Reference in a new issue