1/* GStreamer
2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wim.taymans@chello.be>
4 *
5 * gstpadtemplate.h: Header for GstPadTemplate object
6 *
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.
11 *
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.
16 *
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.
21 */
22
23
24#ifndef __GST_PAD_TEMPLATE_H__
25#define __GST_PAD_TEMPLATE_H__
26
27#include <gst/gstconfig.h>
28
29typedef struct _GstPadTemplate GstPadTemplate;
30typedef struct _GstPadTemplateClass GstPadTemplateClass;
31typedef struct _GstStaticPadTemplate GstStaticPadTemplate;
32
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>
39
40G_BEGIN_DECLS
41
42#define GST_TYPE_STATIC_PAD_TEMPLATE (gst_static_pad_template_get_type ())
43
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))
49
50/**
51 * GstPadPresence:
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().
56 *
57 * Indicates when this pad will become available.
58 */
59typedef enum {
60 GST_PAD_ALWAYS,
61 GST_PAD_SOMETIMES,
62 GST_PAD_REQUEST
63} GstPadPresence;
64
65/**
66 * GST_PAD_TEMPLATE_NAME_TEMPLATE:
67 * @templ: the template to query
68 *
69 * Get the nametemplate of the padtemplate.
70 */
71#define GST_PAD_TEMPLATE_NAME_TEMPLATE(templ) (((GstPadTemplate *)(templ))->name_template)
72
73/**
74 * GST_PAD_TEMPLATE_DIRECTION:
75 * @templ: the template to query
76 *
77 * Get the #GstPadDirection of the padtemplate.
78 */
79#define GST_PAD_TEMPLATE_DIRECTION(templ) (((GstPadTemplate *)(templ))->direction)
80
81/**
82 * GST_PAD_TEMPLATE_PRESENCE:
83 * @templ: the template to query
84 *
85 * Get the #GstPadPresence of the padtemplate.
86 */
87#define GST_PAD_TEMPLATE_PRESENCE(templ) (((GstPadTemplate *)(templ))->presence)
88
89/**
90 * GST_PAD_TEMPLATE_CAPS:
91 * @templ: the template to query
92 *
93 * Get a handle to the padtemplate #GstCaps
94 */
95#define GST_PAD_TEMPLATE_CAPS(templ) (((GstPadTemplate *)(templ))->caps)
96
97/**
98 * GST_PAD_TEMPLATE_GTYPE:
99 * @templ: the template to query
100 *
101 * Get the #GType of the padtemplate
102 *
103 * Since: 1.14
104 */
105#define GST_PAD_TEMPLATE_GTYPE(templ) (((GstPadTemplate *)(templ))->ABI.abi.gtype)
106
107/**
108 * GstPadTemplateFlags:
109 * @GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
110 *
111 * Flags for the padtemplate
112 */
113typedef enum {
114 /* padding */
115 GST_PAD_TEMPLATE_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 4)
116} GstPadTemplateFlags;
117
118/**
119 * GST_PAD_TEMPLATE_IS_FIXED:
120 * @templ: the template to query
121 *
122 * Check if the properties of the padtemplate are fixed
123 */
124#define GST_PAD_TEMPLATE_IS_FIXED(templ) (GST_OBJECT_FLAG_IS_SET(templ, GST_PAD_TEMPLATE_FIXED))
125
126/**
127 * GstPadTemplate:
128 *
129 * The padtemplate object.
130 */
131struct _GstPadTemplate {
132 GstObject object;
133
134 gchar *name_template;
135 GstPadDirection direction;
136 GstPadPresence presence;
137 GstCaps *caps;
138
139 /*< private >*/
140 union {
141 gpointer _gst_reserved[GST_PADDING];
142 struct {
143 GType gtype;
144 GstCaps *documentation_caps;
145 } abi;
146 } ABI;
147};
148
149struct _GstPadTemplateClass {
150 GstObjectClass parent_class;
151
152 /* signal callbacks */
153 void (*pad_created) (GstPadTemplate *templ, GstPad *pad);
154
155 /*< private >*/
156 gpointer _gst_reserved[GST_PADDING];
157};
158
159/**
160 * GstStaticPadTemplate:
161 * @name_template: the name of the template
162 * @direction: the direction of the template
163 * @presence: the presence of the template
164 * @static_caps: the caps of the template.
165 *
166 * Structure describing the #GstStaticPadTemplate.
167 */
168struct _GstStaticPadTemplate {
169 const gchar *name_template;
170 GstPadDirection direction;
171 GstPadPresence presence;
172 GstStaticCaps static_caps;
173};
174
175/**
176 * GST_STATIC_PAD_TEMPLATE:
177 * @padname: the name template of the pad
178 * @dir: the GstPadDirection of the pad
179 * @pres: the GstPadPresence of the pad
180 * @caps: the GstStaticCaps of the pad
181 *
182 * Convenience macro to fill the values of a #GstStaticPadTemplate
183 * structure.
184 * Example:
185 * |[<!-- language="C" -->
186 * static GstStaticPadTemplate my_src_template = \
187 * GST_STATIC_PAD_TEMPLATE("src", GST_PAD_SRC, GST_PAD_ALWAYS,
188 * GST_STATIC_CAPS_ANY);
189 * ]|
190 */
191#define GST_STATIC_PAD_TEMPLATE(padname, dir, pres, caps) \
192{ \
193 /* name_template */ padname, \
194 /* direction */ dir, \
195 /* presence */ pres, \
196 /* caps */ caps \
197}
198
199/* templates and factories */
200
201GST_API
202GType gst_pad_template_get_type (void);
203
204/**
205 * gst_static_pad_template_get_type: (attributes doc.skip=true)
206 */
207GST_API
208GType gst_static_pad_template_get_type (void);
209
210GST_API
211GstPadTemplate* gst_pad_template_new (const gchar *name_template,
212 GstPadDirection direction, GstPadPresence presence,
213 GstCaps *caps) G_GNUC_MALLOC;
214GST_API
215GstPadTemplate* gst_pad_template_new_with_gtype (const gchar *name_template,
216 GstPadDirection direction, GstPadPresence presence,
217 GstCaps *caps, GType pad_type) G_GNUC_MALLOC;
218GST_API
219GstPadTemplate * gst_static_pad_template_get (GstStaticPadTemplate *pad_template);
220
221GST_API
222GstPadTemplate * gst_pad_template_new_from_static_pad_template_with_gtype (
223 GstStaticPadTemplate * pad_template,
224 GType pad_type);
225
226GST_API
227GstCaps* gst_static_pad_template_get_caps (GstStaticPadTemplate *templ);
228
229GST_API
230GstCaps* gst_pad_template_get_caps (GstPadTemplate *templ);
231
232GST_API
233void gst_pad_template_set_documentation_caps (GstPadTemplate *templ, GstCaps *caps);
234
235GST_API
236GstCaps* gst_pad_template_get_documentation_caps (GstPadTemplate *templ);
237
238GST_API
239void gst_pad_template_pad_created (GstPadTemplate * templ, GstPad * pad);
240
241G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPadTemplate, gst_object_unref)
242
243G_END_DECLS
244
245#endif /* __GST_PAD_TEMPLATE_H__ */
246
247

source code of include/gstreamer-1.0/gst/gstpadtemplate.h