Merge structures into caps instead of appending them
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 3 Oct 2012 07:51:04 +0000 (09:51 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 15 Oct 2012 14:28:42 +0000 (16:28 +0200)
sys/androidmedia/gstamcaudiodec.c
sys/androidmedia/gstamcvideodec.c

index 72c845d..2b861be 100644 (file)
@@ -95,21 +95,21 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
           "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
           "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
           "parsed", G_TYPE_BOOLEAN, TRUE, NULL);
-      gst_caps_append_structure (ret, tmp);
+      gst_caps_merge_structure (ret, tmp);
     } else if (strcmp (type->mime, "audio/3gpp") == 0) {
       GstStructure *tmp;
 
       tmp = gst_structure_new ("audio/AMR",
           "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
           "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
-      gst_caps_append_structure (ret, tmp);
+      gst_caps_merge_structure (ret, tmp);
     } else if (strcmp (type->mime, "audio/amr-wb") == 0) {
       GstStructure *tmp;
 
       tmp = gst_structure_new ("audio/AMR-WB",
           "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
           "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
-      gst_caps_append_structure (ret, tmp);
+      gst_caps_merge_structure (ret, tmp);
     } else if (strcmp (type->mime, "audio/mp4a-latm") == 0) {
       gint j;
       GstStructure *tmp, *tmp2;
@@ -147,13 +147,13 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
 
         tmp2 = gst_structure_copy (tmp);
         gst_structure_set (tmp2, "profile", G_TYPE_STRING, profile, NULL);
-        gst_caps_append_structure (ret, tmp2);
+        gst_caps_merge_structure (ret, tmp2);
 
         have_profile = TRUE;
       }
 
       if (!have_profile) {
-        gst_caps_append_structure (ret, tmp);
+        gst_caps_merge_structure (ret, tmp);
       } else {
         gst_structure_free (tmp);
       }
@@ -163,21 +163,21 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
       tmp = gst_structure_new ("audio/x-alaw",
           "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
           "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
-      gst_caps_append_structure (ret, tmp);
+      gst_caps_merge_structure (ret, tmp);
     } else if (strcmp (type->mime, "audio/g711-mlaw") == 0) {
       GstStructure *tmp;
 
       tmp = gst_structure_new ("audio/x-mulaw",
           "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
           "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
-      gst_caps_append_structure (ret, tmp);
+      gst_caps_merge_structure (ret, tmp);
     } else if (strcmp (type->mime, "audio/vorbis") == 0) {
       GstStructure *tmp;
 
       tmp = gst_structure_new ("audio/x-vorbis",
           "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
           "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
-      gst_caps_append_structure (ret, tmp);
+      gst_caps_merge_structure (ret, tmp);
     } else if (strcmp (type->mime, "audio/flac") == 0) {
       GstStructure *tmp;
 
@@ -185,7 +185,7 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
           "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
           "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
           "framed", G_TYPE_BOOLEAN, TRUE, NULL);
-      gst_caps_append_structure (ret, tmp);
+      gst_caps_merge_structure (ret, tmp);
     } else if (strcmp (type->mime, "audio/mpeg-L2") == 0) {
       GstStructure *tmp;
 
@@ -195,7 +195,7 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
           "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
           "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
           "parsed", G_TYPE_BOOLEAN, TRUE, NULL);
-      gst_caps_append_structure (ret, tmp);
+      gst_caps_merge_structure (ret, tmp);
     } else {
       GST_WARNING ("Unsupported mimetype '%s'", type->mime);
     }
index 1421c48..fc07e01 100644 (file)
@@ -156,12 +156,12 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
         gst_structure_set_value (tmp2, "level", &va);
         g_value_unset (&va);
         g_value_unset (&v);
-        gst_caps_append_structure (ret, tmp2);
+        gst_caps_merge_structure (ret, tmp2);
         have_profile_level = TRUE;
       }
 
       if (!have_profile_level) {
-        gst_caps_append_structure (ret, tmp);
+        gst_caps_merge_structure (ret, tmp);
       } else {
         gst_structure_free (tmp);
       }
@@ -210,12 +210,12 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
         gst_structure_set_value (tmp2, "level", &va);
         g_value_unset (&va);
         g_value_unset (&v);
-        gst_caps_append_structure (ret, tmp2);
+        gst_caps_merge_structure (ret, tmp2);
         have_profile_level = TRUE;
       }
 
       if (!have_profile_level) {
-        gst_caps_append_structure (ret, tmp);
+        gst_caps_merge_structure (ret, tmp);
       } else {
         gst_structure_free (tmp);
       }
@@ -267,20 +267,20 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
         if (!alternative)
           g_value_unset (&va);
         g_value_unset (&v);
-        gst_caps_append_structure (ret, tmp2);
+        gst_caps_merge_structure (ret, tmp2);
 
         if (alternative) {
           tmp2 = gst_structure_copy (tmp);
           gst_structure_set (tmp2, "profile", G_TYPE_STRING, alternative, NULL);
           gst_structure_set_value (tmp2, "level", &va);
           g_value_unset (&va);
-          gst_caps_append_structure (ret, tmp2);
+          gst_caps_merge_structure (ret, tmp2);
         }
         have_profile_level = TRUE;
       }
 
       if (!have_profile_level) {
-        gst_caps_append_structure (ret, tmp);
+        gst_caps_merge_structure (ret, tmp);
       } else {
         gst_structure_free (tmp);
       }
@@ -292,7 +292,7 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
           "height", GST_TYPE_INT_RANGE, 16, 4096,
           "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
 
-      gst_caps_append_structure (ret, tmp);
+      gst_caps_merge_structure (ret, tmp);
     } else if (strcmp (type->mime, "video/mpeg2") == 0) {
       GstStructure *tmp;
 
@@ -305,7 +305,7 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
           "systemstream", G_TYPE_BOOLEAN, FALSE,
           "parsed", G_TYPE_BOOLEAN, TRUE, NULL);
 
-      gst_caps_append_structure (ret, tmp);
+      gst_caps_merge_structure (ret, tmp);
     } else {
       GST_WARNING ("Unsupported mimetype '%s'", type->mime);
     }
@@ -369,7 +369,7 @@ create_src_caps (const GstAmcCodecInfo * codec_info)
         continue;
       }
       tmp = gst_video_format_new_template_caps (format);
-      gst_caps_append (ret, tmp);
+      gst_caps_merge (ret, tmp);
     }
   }