caps: delay _make_writable() until needed in _normalize()
[platform/upstream/gstreamer.git] / gst / gstregistrychunks.c
index d2900b7..0c58dab 100644 (file)
@@ -321,13 +321,13 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
     }
     /* save caps */
     if (factory->caps) {
-      /* we copy the caps here so we can simplify them before saving. This
-       * is a lot faster when loading them later on */
-      GstCaps *copy = gst_caps_copy (factory->caps);
+      GstCaps *fcaps = gst_caps_ref (factory->caps);
+      /* we simplify the caps before saving. This is a lot faster
+       * when loading them later on */
+      fcaps = gst_caps_simplify (fcaps);
+      str = gst_caps_to_string (fcaps);
+      gst_caps_unref (fcaps);
 
-      gst_caps_do_simplify (copy);
-      str = gst_caps_to_string (copy);
-      gst_caps_unref (copy);
       gst_registry_chunks_save_string (list, str);
     } else {
       gst_registry_chunks_save_const_string (list, "");
@@ -493,7 +493,7 @@ gst_registry_chunks_load_pad_template (GstElementFactory * factory, gchar ** in,
   template = g_slice_new (GstStaticPadTemplate);
   template->presence = pt->presence;
   template->direction = (GstPadDirection) pt->direction;
-  template->static_caps.caps.mini_object.refcount = 0;
+  template->static_caps.caps = NULL;
 
   /* unpack pad template strings */
   unpack_const_string (*in, template->name_template, end, fail);