<SUBSECTION element-construction>
gst_element_class_add_pad_template
gst_element_class_add_static_pad_template
+gst_element_class_add_static_pad_template_with_gtype
gst_element_class_get_pad_template
gst_element_class_get_pad_template_list
gst_element_class_set_metadata
GST_PAD_TEMPLATE_PRESENCE
GST_PAD_TEMPLATE_CAPS
GST_PAD_TEMPLATE_IS_FIXED
+GST_PAD_TEMPLATE_GTYPE
gst_pad_template_new
+gst_pad_template_new_from_static_pad_template_with_gtype
gst_pad_template_get_caps
<SUBSECTION Standard>
}
/**
+ * gst_element_class_add_static_pad_template_with_gtype:
+ * @klass: the #GstElementClass to add the pad template to.
+ * @static_templ: #GstStaticPadTemplate to add as pad template to the element class.
+ * @pad_type: The #GType of the pad to create
+ *
+ * Adds a pad template to an element class based on the static pad template
+ * @templ. This is mainly used in the _class_init functions of element
+ * implementations. If a pad template with the same name already exists,
+ * the old one is replaced by the new one.
+ *
+ * Since: 1.14
+ */
+void
+gst_element_class_add_static_pad_template_with_gtype (GstElementClass * klass,
+ GstStaticPadTemplate * static_templ, GType pad_type)
+{
+ gst_element_class_add_pad_template (klass,
+ gst_pad_template_new_from_static_pad_template_with_gtype (static_templ,
+ pad_type));
+}
+
+/**
* gst_element_class_add_metadata:
* @klass: class to set metadata for
* @key: the key to set
void gst_element_class_add_static_pad_template (GstElementClass *klass, GstStaticPadTemplate *static_templ);
GST_EXPORT
+void gst_element_class_add_static_pad_template_with_gtype (GstElementClass *klass,
+ GstStaticPadTemplate *static_templ,
+ GType pad_type);
+
+GST_EXPORT
GstPadTemplate* gst_element_class_get_pad_template (GstElementClass *element_class, const gchar *name);
GST_EXPORT
PROP_NAME_TEMPLATE = 1,
PROP_DIRECTION,
PROP_PRESENCE,
- PROP_CAPS
+ PROP_CAPS,
+ PROP_GTYPE,
};
enum
GST_TYPE_CAPS,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+ /**
+ * GstPadTemplate:gtype:
+ *
+ * The type of the pad described by the pad template.
+ *
+ * Since: 1.14
+ */
+ g_object_class_install_property (gobject_class, PROP_GTYPE,
+ g_param_spec_gtype ("gtype", "GType",
+ "The GType of the pad described by the pad template",
+ G_TYPE_NONE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
gstobject_class->path_string_separator = "*";
}
}
/**
+ * gst_pad_template_new_from_static_pad_template_with_gtype:
+ * @pad_template: the static pad template
+ * @pad_type: The #GType of the pad to create
+ *
+ * Converts a #GstStaticPadTemplate into a #GstPadTemplate with a type.
+ *
+ * Returns: (transfer floating): a new #GstPadTemplate.
+ */
+GstPadTemplate *
+gst_pad_template_new_from_static_pad_template_with_gtype (GstStaticPadTemplate *
+ pad_template, GType pad_type)
+{
+ GstPadTemplate *new;
+ GstCaps *caps;
+
+ if (!name_is_valid (pad_template->name_template, pad_template->presence))
+ return NULL;
+
+ caps = gst_static_caps_get (&pad_template->static_caps);
+
+ new = g_object_new (gst_pad_template_get_type (),
+ "name", pad_template->name_template,
+ "name-template", pad_template->name_template,
+ "direction", pad_template->direction,
+ "presence", pad_template->presence, "caps", caps, "gtype", pad_type,
+ NULL);
+
+ gst_caps_unref (caps);
+
+ return new;
+}
+
+/**
* gst_pad_template_new:
* @name_template: the name template.
* @direction: the #GstPadDirection of the template.
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
}
break;
+ case PROP_GTYPE:
+ GST_PAD_TEMPLATE_GTYPE (object) = g_value_get_gtype (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_CAPS:
g_value_set_boxed (value, GST_PAD_TEMPLATE_CAPS (object));
break;
+ case PROP_GTYPE:
+ g_value_set_gtype (value, GST_PAD_TEMPLATE_GTYPE (object));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
#define GST_PAD_TEMPLATE_CAPS(templ) (((GstPadTemplate *)(templ))->caps)
/**
+ * GST_PAD_TEMPLATE_GTYPE:
+ * @templ: the template to query
+ *
+ * Get the #GType of the padtemplate
+ *
+ * Since: 1.14
+ */
+#define GST_PAD_TEMPLATE_GTYPE(templ) (((GstPadTemplate *)(templ))->ABI.abi.gtype)
+
+/**
* GstPadTemplateFlags:
* @GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
*
GstCaps *caps;
/*< private >*/
- gpointer _gst_reserved[GST_PADDING];
+ union {
+ gpointer _gst_reserved[GST_PADDING];
+ struct {
+ GType gtype;
+ } abi;
+ } ABI;
};
struct _GstPadTemplateClass {
GstPadTemplate * gst_static_pad_template_get (GstStaticPadTemplate *pad_template);
GST_EXPORT
+GstPadTemplate * gst_pad_template_new_from_static_pad_template_with_gtype (
+ GstStaticPadTemplate * pad_template,
+ GType pad_type);
+
+GST_EXPORT
GstCaps* gst_static_pad_template_get_caps (GstStaticPadTemplate *templ);
GST_EXPORT
gst_element_class_add_pad_template
gst_element_class_add_static_metadata
gst_element_class_add_static_pad_template
+ gst_element_class_add_static_pad_template_with_gtype
gst_element_class_get_metadata
gst_element_class_get_pad_template
gst_element_class_get_pad_template_list
gst_pad_template_get_caps
gst_pad_template_get_type
gst_pad_template_new
+ gst_pad_template_new_from_static_pad_template_with_gtype
gst_pad_template_pad_created
gst_pad_unlink
gst_pad_use_fixed_caps