selector: merge the tags
authorWim Taymans <wim.taymans@collabora.co.uk>
Tue, 24 Mar 2009 14:23:03 +0000 (15:23 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Tue, 24 Mar 2009 14:23:03 +0000 (15:23 +0100)
Merge the tags received on the input-selector sinkpads instead of only keeping
the last one we saw.

gst/selector/gstinputselector.c

index ec1ae54..7a458b0 100644 (file)
@@ -402,16 +402,18 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event)
     }
     case GST_EVENT_TAG:
     {
-      GstTagList *tags;
+      GstTagList *tags, *oldtags, *newtags;
 
-      GST_OBJECT_LOCK (selpad);
-      if (selpad->tags)
-        gst_tag_list_free (selpad->tags);
       gst_event_parse_tag (event, &tags);
-      if (tags)
-        tags = gst_tag_list_copy (tags);
-      selpad->tags = tags;
-      GST_DEBUG_OBJECT (pad, "received tags %" GST_PTR_FORMAT, selpad->tags);
+
+      GST_OBJECT_LOCK (selpad);
+      oldtags = selpad->tags;
+
+      newtags = gst_tag_list_merge (oldtags, tags, GST_TAG_MERGE_REPLACE);
+      selpad->tags = newtags;
+      if (oldtags)
+        gst_tag_list_free (oldtags);
+      GST_DEBUG_OBJECT (pad, "received tags %" GST_PTR_FORMAT, newtags);
       GST_OBJECT_UNLOCK (selpad);
       break;
     }