Merge remote-tracking branch 'upstream/master' into tizen
[platform/upstream/gstreamer.git] / gst / gstpadtemplate.c
index 952f07e..8055a9a 100644 (file)
@@ -42,7 +42,7 @@
  * GST_PAD_TEMPLATE_DIRECTION().
  *
  * The GST_PAD_TEMPLATE_NAME_TEMPLATE () is important for GST_PAD_REQUEST pads
- * because it has to be used as the name in the gst_element_get_request_pad()
+ * because it has to be used as the name in the gst_element_request_pad_simple()
  * call to instantiate a pad from this template.
  *
  * Padtemplates can be created with gst_pad_template_new() or with
@@ -146,7 +146,7 @@ gst_pad_template_class_init (GstPadTemplateClass * klass)
   gst_pad_template_signals[TEMPL_PAD_CREATED] =
       g_signal_new ("pad-created", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
       G_STRUCT_OFFSET (GstPadTemplateClass, pad_created),
-      NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 1, GST_TYPE_PAD);
+      NULL, NULL, NULL, G_TYPE_NONE, 1, GST_TYPE_PAD);
 
   gobject_class->dispose = gst_pad_template_dispose;
 
@@ -230,6 +230,8 @@ gst_pad_template_dispose (GObject * object)
     gst_caps_unref (GST_PAD_TEMPLATE_CAPS (templ));
   }
 
+  gst_caps_replace (&templ->ABI.abi.documentation_caps, NULL);
+
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
@@ -479,6 +481,52 @@ gst_pad_template_get_caps (GstPadTemplate * templ)
 }
 
 /**
+ * gst_pad_template_set_documentation_caps:
+ * @templ: the pad template to set documented capabilities on
+ * @caps: (transfer full): the documented capabilities
+ *
+ * Certain elements will dynamically construct the caps of their
+ * pad templates. In order not to let environment-specific information
+ * into the documentation, element authors should use this method to
+ * expose "stable" caps to the reader.
+ *
+ * Since: 1.18
+ */
+void
+gst_pad_template_set_documentation_caps (GstPadTemplate * templ, GstCaps * caps)
+{
+  g_return_if_fail (GST_IS_PAD_TEMPLATE (templ));
+  g_return_if_fail (GST_IS_CAPS (caps));
+
+  if (caps)
+    GST_MINI_OBJECT_FLAG_SET (caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
+  gst_caps_replace (&(((GstPadTemplate *) (templ))->ABI.abi.documentation_caps),
+      caps);
+}
+
+/**
+ * gst_pad_template_get_documentation_caps:
+ * @templ: the pad template to get documented capabilities on
+ *
+ * See gst_pad_template_set_documentation_caps().
+ *
+ * Returns: The caps to document. For convenience, this will return
+ *   gst_pad_template_get_caps() when no documentation caps were set.
+ * Since: 1.18
+ */
+GstCaps *
+gst_pad_template_get_documentation_caps (GstPadTemplate * templ)
+{
+  g_return_val_if_fail (GST_IS_PAD_TEMPLATE (templ), NULL);
+
+  if (((GstPadTemplate *) (templ))->ABI.abi.documentation_caps)
+    return gst_caps_ref (((GstPadTemplate *) (templ))->ABI.abi.
+        documentation_caps);
+  else
+    return gst_pad_template_get_caps (templ);
+}
+
+/**
  * gst_pad_template_pad_created:
  * @templ: a #GstPadTemplate that has been created
  * @pad:   the #GstPad that created it