2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wim.taymans@chello.be>
5 * gstpadtemplate.h: Header for GstPadTemplate object
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
24 #ifndef __GST_PAD_TEMPLATE_H__
25 #define __GST_PAD_TEMPLATE_H__
27 #include <gst/gstconfig.h>
29 typedef struct _GstPadTemplate GstPadTemplate;
30 typedef struct _GstPadTemplateClass GstPadTemplateClass;
31 typedef struct _GstStaticPadTemplate GstStaticPadTemplate;
33 #include <gst/gstobject.h>
34 #include <gst/gstbuffer.h>
35 #include <gst/gstcaps.h>
36 #include <gst/gstevent.h>
37 #include <gst/gstquery.h>
38 #include <gst/gsttask.h>
42 #define GST_TYPE_STATIC_PAD_TEMPLATE (gst_static_pad_template_get_type ())
44 #define GST_TYPE_PAD_TEMPLATE (gst_pad_template_get_type ())
45 #define GST_PAD_TEMPLATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD_TEMPLATE,GstPadTemplate))
46 #define GST_PAD_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD_TEMPLATE,GstPadTemplateClass))
47 #define GST_IS_PAD_TEMPLATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD_TEMPLATE))
48 #define GST_IS_PAD_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD_TEMPLATE))
52 * @GST_PAD_ALWAYS: the pad is always available
53 * @GST_PAD_SOMETIMES: the pad will become available depending on the media stream
54 * @GST_PAD_REQUEST: the pad is only available on request with
55 * gst_element_request_pad().
57 * Indicates when this pad will become available.
66 * GST_PAD_TEMPLATE_NAME_TEMPLATE:
67 * @templ: the template to query
69 * Get the nametemplate of the padtemplate.
71 #define GST_PAD_TEMPLATE_NAME_TEMPLATE(templ) (((GstPadTemplate *)(templ))->name_template)
74 * GST_PAD_TEMPLATE_DIRECTION:
75 * @templ: the template to query
77 * Get the #GstPadDirection of the padtemplate.
79 #define GST_PAD_TEMPLATE_DIRECTION(templ) (((GstPadTemplate *)(templ))->direction)
82 * GST_PAD_TEMPLATE_PRESENCE:
83 * @templ: the template to query
85 * Get the #GstPadPresence of the padtemplate.
87 #define GST_PAD_TEMPLATE_PRESENCE(templ) (((GstPadTemplate *)(templ))->presence)
90 * GST_PAD_TEMPLATE_CAPS:
91 * @templ: the template to query
93 * Get a handle to the padtemplate #GstCaps
95 #define GST_PAD_TEMPLATE_CAPS(templ) (((GstPadTemplate *)(templ))->caps)
98 * GstPadTemplateFlags:
99 * @GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
101 * Flags for the padtemplate
105 GST_PAD_TEMPLATE_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 4)
106 } GstPadTemplateFlags;
109 * GST_PAD_TEMPLATE_IS_FIXED:
110 * @templ: the template to query
112 * Check if the properties of the padtemplate are fixed
114 #define GST_PAD_TEMPLATE_IS_FIXED(templ) (GST_OBJECT_FLAG_IS_SET(templ, GST_PAD_TEMPLATE_FIXED))
119 * The padtemplate object.
121 struct _GstPadTemplate {
124 gchar *name_template;
125 GstPadDirection direction;
126 GstPadPresence presence;
130 gpointer _gst_reserved[GST_PADDING];
133 struct _GstPadTemplateClass {
134 GstObjectClass parent_class;
136 /* signal callbacks */
137 void (*pad_created) (GstPadTemplate *templ, GstPad *pad);
140 gpointer _gst_reserved[GST_PADDING];
144 * GstStaticPadTemplate:
145 * @name_template: the name of the template
146 * @direction: the direction of the template
147 * @presence: the presence of the template
148 * @static_caps: the caps of the template.
150 * Structure describing the #GstStaticPadTemplate.
152 struct _GstStaticPadTemplate {
153 const gchar *name_template;
154 GstPadDirection direction;
155 GstPadPresence presence;
156 GstStaticCaps static_caps;
160 * GST_STATIC_PAD_TEMPLATE:
161 * @padname: the name template of the pad
162 * @dir: the GstPadDirection of the pad
163 * @pres: the GstPadPresence of the pad
164 * @caps: the GstStaticCaps of the pad
166 * Convenience macro to fill the values of a GstStaticPadTemplate
169 #define GST_STATIC_PAD_TEMPLATE(padname, dir, pres, caps) \
171 /* name_template */ padname, \
172 /* direction */ dir, \
173 /* presence */ pres, \
177 /* templates and factories */
180 GType gst_pad_template_get_type (void);
183 GType gst_static_pad_template_get_type (void);
186 GstPadTemplate* gst_pad_template_new (const gchar *name_template,
187 GstPadDirection direction, GstPadPresence presence,
188 GstCaps *caps) G_GNUC_MALLOC;
190 GstPadTemplate * gst_static_pad_template_get (GstStaticPadTemplate *pad_template);
193 GstCaps* gst_static_pad_template_get_caps (GstStaticPadTemplate *templ);
196 GstCaps* gst_pad_template_get_caps (GstPadTemplate *templ);
199 void gst_pad_template_pad_created (GstPadTemplate * templ, GstPad * pad);
201 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
202 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPadTemplate, gst_object_unref)
207 #endif /* __GST_PAD_TEMPLATE_H__ */