remove queryutils headers after moving the two used functions to gstquery. also...
[platform/upstream/gstreamer.git] / gst / gstpadtemplate.h
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., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23
24 #ifndef __GST_PAD_TEMPLATE_H__
25 #define __GST_PAD_TEMPLATE_H__
26
27 #include <gst/gstconfig.h>
28
29 #include <gst/gstobject.h>
30 #include <gst/gstbuffer.h>
31 #include <gst/gstcaps.h>
32 #include <gst/gstevent.h>
33 #include <gst/gstquery.h>
34 #include <gst/gsttask.h>
35
36 G_BEGIN_DECLS
37
38 /* FIXME: this awful circular dependency need to be resolved properly (see pad.h) */
39 //typedef struct _GstPadTemplate GstPadTemplate;
40 typedef struct _GstPadTemplateClass GstPadTemplateClass;
41 typedef struct _GstStaticPadTemplate GstStaticPadTemplate;
42
43 #define GST_TYPE_PAD_TEMPLATE           (gst_pad_template_get_type ())
44 #define GST_PAD_TEMPLATE(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD_TEMPLATE,GstPadTemplate))
45 #define GST_PAD_TEMPLATE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD_TEMPLATE,GstPadTemplateClass))
46 #define GST_IS_PAD_TEMPLATE(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD_TEMPLATE))
47 #define GST_IS_PAD_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD_TEMPLATE))
48
49 /**
50  * GstPadPresence:
51  * @GST_PAD_ALWAYS: the pad is always available
52  * @GST_PAD_SOMETIMES: the pad will become available depending on the media stream
53  * @GST_PAD_REQUEST: the pad is only available on request with 
54  *  gst_element_request_pad_by_name() or gst_element_request_compatible_pad().
55  *
56  * Indicates when this pad will become available.
57  */
58 typedef enum {
59   GST_PAD_ALWAYS,
60   GST_PAD_SOMETIMES,
61   GST_PAD_REQUEST
62 } GstPadPresence;
63
64 /**
65  * GST_PAD_TEMPLATE_NAME_TEMPLATE:
66  * @templ: the template to query
67  *
68  * Get the nametemplate of the padtemplate.
69  */
70 #define GST_PAD_TEMPLATE_NAME_TEMPLATE(templ)   (((GstPadTemplate *)(templ))->name_template)
71
72 /**
73  * GST_PAD_TEMPLATE_DIRECTION:
74  * @templ: the template to query
75  *
76  * Get the direction of the padtemplate.
77  */
78 #define GST_PAD_TEMPLATE_DIRECTION(templ)       (((GstPadTemplate *)(templ))->direction)
79
80 /**
81  * GST_PAD_TEMPLATE_PRESENCE:
82  * @templ: the template to query
83  *
84  * Get the presence of the padtemplate.
85  */
86 #define GST_PAD_TEMPLATE_PRESENCE(templ)        (((GstPadTemplate *)(templ))->presence)
87
88 /**
89  * GST_PAD_TEMPLATE_CAPS:
90  * @templ: the template to query
91  *
92  * Get a handle to the padtemplate #GstCaps
93  */
94 #define GST_PAD_TEMPLATE_CAPS(templ)            (((GstPadTemplate *)(templ))->caps)
95
96 /**
97  * GstPadTemplateFlags:
98  * @GST_PAD_TEMPLATE_FIXED: the padtemplate has no variable properties
99  * @GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
100  *
101  * Flags for the padtemplate
102  */
103 typedef enum {
104   GST_PAD_TEMPLATE_FIXED        = GST_OBJECT_FLAG_LAST,
105
106   GST_PAD_TEMPLATE_FLAG_LAST    = GST_OBJECT_FLAG_LAST + 4
107 } GstPadTemplateFlags;
108
109 /**
110  * GST_PAD_TEMPLATE_IS_FIXED:
111  * @templ: the template to query
112  *
113  * Check if the properties of the padtemplate are fixed
114  */
115 #define GST_PAD_TEMPLATE_IS_FIXED(templ)        (GST_FLAG_IS_SET(templ, GST_PAD_TEMPLATE_FIXED))
116
117 /**
118  * GstPadTemplate:
119  *
120  * The padtemplate object.
121  */
122 struct _GstPadTemplate {
123   GstObject        object;
124
125   gchar           *name_template;
126   GstPadDirection  direction;
127   GstPadPresence   presence;
128   GstCaps         *caps;
129
130   gpointer _gst_reserved[GST_PADDING];
131 };
132
133 struct _GstPadTemplateClass {
134   GstObjectClass   parent_class;
135
136   /* signal callbacks */
137   void (*pad_created)   (GstPadTemplate *templ, GstPad *pad);
138
139   gpointer _gst_reserved[GST_PADDING];
140 };
141
142 struct _GstStaticPadTemplate {
143   gchar           *name_template;
144   GstPadDirection  direction;
145   GstPadPresence   presence;
146   GstStaticCaps   static_caps;
147 };
148
149 #define GST_STATIC_PAD_TEMPLATE(padname, dir, pres, caps) \
150 { \
151   /* name_template */    padname, \
152   /* direction */        dir, \
153   /* presence */         pres, \
154   /* caps */             caps \
155 }
156
157 /* templates and factories */
158 GType                   gst_pad_template_get_type               (void);
159
160 GstPadTemplate*         gst_pad_template_new                    (const gchar *name_template,
161                                                                  GstPadDirection direction, GstPadPresence presence,
162                                                                  GstCaps *caps);
163
164 GstPadTemplate *        gst_static_pad_template_get             (GstStaticPadTemplate *pad_template);
165 GstCaps*                gst_static_pad_template_get_caps        (GstStaticPadTemplate *templ);
166 GstCaps*                gst_pad_template_get_caps               (GstPadTemplate *templ);
167
168 void                    gst_pad_template_pad_created            (GstPadTemplate * templ, GstPad * pad);
169
170 G_END_DECLS
171
172 #endif /* __GST_PAD_TEMPLATE_H__ */
173