[gst-cvs] gst-plugins-bad: jpegparse: Small optimization on tags parsing

Thiago Sousa Santos thiagoss at kemper.freedesktop.org
Mon Nov 22 12:44:30 PST 2010


Module: gst-plugins-bad
Branch: master
Commit: 7622328aab0aea21841a50e1fa4ab98b8d6389fa
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=7622328aab0aea21841a50e1fa4ab98b8d6389fa

Author: Thiago Santos <thiago.sousa.santos at collabora.co.uk>
Date:   Mon Nov 22 17:43:12 2010 -0300

jpegparse: Small optimization on tags parsing

Optimize a little avoiding copying a taglist when parsing xmp/exif
data.

---

 gst/jpegformat/gstjpegparse.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/gst/jpegformat/gstjpegparse.c b/gst/jpegformat/gstjpegparse.c
index 012c77f..d22dd46 100644
--- a/gst/jpegformat/gstjpegparse.c
+++ b/gst/jpegformat/gstjpegparse.c
@@ -594,11 +594,13 @@ gst_jpeg_parse_read_header (GstJpegParse * parse, GstBuffer * buffer)
 
           if (tags) {
             GST_INFO_OBJECT (parse, "got exif metadata");
-            if (!parse->priv->tags)
-              parse->priv->tags = gst_tag_list_new ();
-            gst_tag_list_insert (parse->priv->tags, tags,
-                GST_TAG_MERGE_REPLACE);
-            gst_tag_list_free (tags);
+            if (parse->priv->tags) {
+              gst_tag_list_insert (parse->priv->tags, tags,
+                  GST_TAG_MERGE_REPLACE);
+              gst_tag_list_free (tags);
+            } else {
+              parse->priv->tags = tags;
+            }
           }
 
           GST_LOG_OBJECT (parse, "parsed marker %x: '%s' %u bytes",
@@ -621,11 +623,13 @@ gst_jpeg_parse_read_header (GstJpegParse * parse, GstBuffer * buffer)
 
           if (tags) {
             GST_INFO_OBJECT (parse, "got xmp metadata");
-            if (!parse->priv->tags)
-              parse->priv->tags = gst_tag_list_new ();
-            gst_tag_list_insert (parse->priv->tags, tags,
-                GST_TAG_MERGE_REPLACE);
-            gst_tag_list_free (tags);
+            if (parse->priv->tags) {
+              gst_tag_list_insert (parse->priv->tags, tags,
+                  GST_TAG_MERGE_REPLACE);
+              gst_tag_list_free (tags);
+            } else {
+              parse->priv->tags = tags;
+            }
           }
 
           GST_LOG_OBJECT (parse, "parsed marker %x: '%s' %u bytes",





More information about the Gstreamer-commits mailing list