*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include <gst/gstconfig.h>
+typedef struct _GstPadTemplate GstPadTemplate;
+typedef struct _GstPadTemplateClass GstPadTemplateClass;
+typedef struct _GstStaticPadTemplate GstStaticPadTemplate;
+
#include <gst/gstobject.h>
#include <gst/gstbuffer.h>
#include <gst/gstcaps.h>
G_BEGIN_DECLS
-/* FIXME: this awful circular dependency need to be resolved properly (see pad.h) */
-//typedef struct _GstPadTemplate GstPadTemplate;
-typedef struct _GstPadTemplateClass GstPadTemplateClass;
-typedef struct _GstStaticPadTemplate GstStaticPadTemplate;
+#define GST_TYPE_STATIC_PAD_TEMPLATE (gst_static_pad_template_get_type ())
#define GST_TYPE_PAD_TEMPLATE (gst_pad_template_get_type ())
#define GST_PAD_TEMPLATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD_TEMPLATE,GstPadTemplate))
* GstPadPresence:
* @GST_PAD_ALWAYS: the pad is always available
* @GST_PAD_SOMETIMES: the pad will become available depending on the media stream
- * @GST_PAD_REQUEST: the pad is only available on request with
- * gst_element_request_pad_by_name() or gst_element_request_compatible_pad().
+ * @GST_PAD_REQUEST: the pad is only available on request with
+ * gst_element_request_pad().
*
* Indicates when this pad will become available.
*/
* GST_PAD_TEMPLATE_DIRECTION:
* @templ: the template to query
*
- * Get the direction of the padtemplate.
+ * Get the #GstPadDirection of the padtemplate.
*/
#define GST_PAD_TEMPLATE_DIRECTION(templ) (((GstPadTemplate *)(templ))->direction)
* GST_PAD_TEMPLATE_PRESENCE:
* @templ: the template to query
*
- * Get the presence of the padtemplate.
+ * Get the #GstPadPresence of the padtemplate.
*/
#define GST_PAD_TEMPLATE_PRESENCE(templ) (((GstPadTemplate *)(templ))->presence)
#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_FIXED: the padtemplate has no variable properties
* @GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
*
* Flags for the padtemplate
*/
typedef enum {
- GST_PAD_TEMPLATE_FIXED = (GST_OBJECT_FLAG_LAST << 0),
/* padding */
GST_PAD_TEMPLATE_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 4)
} GstPadTemplateFlags;
GstPadPresence presence;
GstCaps *caps;
- gpointer _gst_reserved[GST_PADDING];
+ /*< private >*/
+ union {
+ gpointer _gst_reserved[GST_PADDING];
+ struct {
+ GType gtype;
+ } abi;
+ } ABI;
};
struct _GstPadTemplateClass {
/* signal callbacks */
void (*pad_created) (GstPadTemplate *templ, GstPad *pad);
+ /*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
+/**
+ * GstStaticPadTemplate:
+ * @name_template: the name of the template
+ * @direction: the direction of the template
+ * @presence: the presence of the template
+ * @static_caps: the caps of the template.
+ *
+ * Structure describing the #GstStaticPadTemplate.
+ */
struct _GstStaticPadTemplate {
- gchar *name_template;
+ const gchar *name_template;
GstPadDirection direction;
GstPadPresence presence;
- GstStaticCaps static_caps;
+ GstStaticCaps static_caps;
};
+/**
+ * GST_STATIC_PAD_TEMPLATE:
+ * @padname: the name template of the pad
+ * @dir: the GstPadDirection of the pad
+ * @pres: the GstPadPresence of the pad
+ * @caps: the GstStaticCaps of the pad
+ *
+ * Convenience macro to fill the values of a #GstStaticPadTemplate
+ * structure.
+ * Example:
+ * |[<!-- language="C" -->
+ * static GstStaticPadTemplate my_src_template = \
+ * GST_STATIC_PAD_TEMPLATE("src", GST_PAD_SRC, GST_PAD_ALWAYS,
+ * GST_STATIC_CAPS_ANY);
+ * ]|
+ */
#define GST_STATIC_PAD_TEMPLATE(padname, dir, pres, caps) \
{ \
/* name_template */ padname, \
}
/* templates and factories */
+
+GST_API
GType gst_pad_template_get_type (void);
+GST_API
+GType gst_static_pad_template_get_type (void);
+
+GST_API
GstPadTemplate* gst_pad_template_new (const gchar *name_template,
GstPadDirection direction, GstPadPresence presence,
- GstCaps *caps);
-
+ GstCaps *caps) G_GNUC_MALLOC;
+GST_API
+GstPadTemplate* gst_pad_template_new_with_gtype (const gchar *name_template,
+ GstPadDirection direction, GstPadPresence presence,
+ GstCaps *caps, GType pad_type) G_GNUC_MALLOC;
+GST_API
GstPadTemplate * gst_static_pad_template_get (GstStaticPadTemplate *pad_template);
+
+GST_API
+GstPadTemplate * gst_pad_template_new_from_static_pad_template_with_gtype (
+ GstStaticPadTemplate * pad_template,
+ GType pad_type);
+
+GST_API
GstCaps* gst_static_pad_template_get_caps (GstStaticPadTemplate *templ);
+
+GST_API
GstCaps* gst_pad_template_get_caps (GstPadTemplate *templ);
+GST_API
void gst_pad_template_pad_created (GstPadTemplate * templ, GstPad * pad);
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPadTemplate, gst_object_unref)
+#endif
+
G_END_DECLS
#endif /* __GST_PAD_TEMPLATE_H__ */