From 7622328aab0aea21841a50e1fa4ab98b8d6389fa Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Mon, 22 Nov 2010 17:43:12 -0300 Subject: [PATCH] jpegparse: Small optimization on tags parsing Optimize a little avoiding copying a taglist when parsing xmp/exif data. --- gst/jpegformat/gstjpegparse.c | 24 ++++++++++++++---------- 1 file 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", -- 2.7.4