gstreamer_core/gst/gstpadtemplate.h
changeset 0 0e761a78d257
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     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_STATIC_PAD_TEMPLATE	(gst_static_pad_template_get_type ())
       
    44 
       
    45 #define GST_TYPE_PAD_TEMPLATE		(gst_pad_template_get_type ())
       
    46 #define GST_PAD_TEMPLATE(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD_TEMPLATE,GstPadTemplate))
       
    47 #define GST_PAD_TEMPLATE_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD_TEMPLATE,GstPadTemplateClass))
       
    48 #define GST_IS_PAD_TEMPLATE(obj)	(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD_TEMPLATE))
       
    49 #define GST_IS_PAD_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD_TEMPLATE))
       
    50 
       
    51 /**
       
    52  * GstPadPresence:
       
    53  * @GST_PAD_ALWAYS: the pad is always available
       
    54  * @GST_PAD_SOMETIMES: the pad will become available depending on the media stream
       
    55  * @GST_PAD_REQUEST: the pad is only available on request with
       
    56  *  gst_element_request_pad_by_name() or gst_element_request_compatible_pad().
       
    57  *
       
    58  * Indicates when this pad will become available.
       
    59  */
       
    60 typedef enum {
       
    61   GST_PAD_ALWAYS,
       
    62   GST_PAD_SOMETIMES,
       
    63   GST_PAD_REQUEST
       
    64 } GstPadPresence;
       
    65 
       
    66 /**
       
    67  * GST_PAD_TEMPLATE_NAME_TEMPLATE:
       
    68  * @templ: the template to query
       
    69  *
       
    70  * Get the nametemplate of the padtemplate.
       
    71  */
       
    72 #define GST_PAD_TEMPLATE_NAME_TEMPLATE(templ)	(((GstPadTemplate *)(templ))->name_template)
       
    73 
       
    74 /**
       
    75  * GST_PAD_TEMPLATE_DIRECTION:
       
    76  * @templ: the template to query
       
    77  *
       
    78  * Get the #GstPadDirection of the padtemplate.
       
    79  */
       
    80 #define GST_PAD_TEMPLATE_DIRECTION(templ)	(((GstPadTemplate *)(templ))->direction)
       
    81 
       
    82 /**
       
    83  * GST_PAD_TEMPLATE_PRESENCE:
       
    84  * @templ: the template to query
       
    85  *
       
    86  * Get the #GstPadPresence of the padtemplate.
       
    87  */
       
    88 #define GST_PAD_TEMPLATE_PRESENCE(templ)	(((GstPadTemplate *)(templ))->presence)
       
    89 
       
    90 /**
       
    91  * GST_PAD_TEMPLATE_CAPS:
       
    92  * @templ: the template to query
       
    93  *
       
    94  * Get a handle to the padtemplate #GstCaps
       
    95  */
       
    96 #define GST_PAD_TEMPLATE_CAPS(templ)		(((GstPadTemplate *)(templ))->caps)
       
    97 
       
    98 /**
       
    99  * GstPadTemplateFlags:
       
   100  * @GST_PAD_TEMPLATE_FIXED: the padtemplate has no variable properties
       
   101  * @GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
       
   102  *
       
   103  * Flags for the padtemplate
       
   104  */
       
   105 typedef enum {
       
   106   GST_PAD_TEMPLATE_FIXED        = (GST_OBJECT_FLAG_LAST << 0),
       
   107   /* padding */
       
   108   GST_PAD_TEMPLATE_FLAG_LAST    = (GST_OBJECT_FLAG_LAST << 4)
       
   109 } GstPadTemplateFlags;
       
   110 
       
   111 /**
       
   112  * GST_PAD_TEMPLATE_IS_FIXED:
       
   113  * @templ: the template to query
       
   114  *
       
   115  * Check if the properties of the padtemplate are fixed
       
   116  */
       
   117 #define GST_PAD_TEMPLATE_IS_FIXED(templ)	(GST_OBJECT_FLAG_IS_SET(templ, GST_PAD_TEMPLATE_FIXED))
       
   118 
       
   119 /**
       
   120  * GstPadTemplate:
       
   121  *
       
   122  * The padtemplate object.
       
   123  */
       
   124 struct _GstPadTemplate {
       
   125   GstObject	   object;
       
   126 
       
   127   gchar           *name_template;
       
   128   GstPadDirection  direction;
       
   129   GstPadPresence   presence;
       
   130   GstCaps	  *caps;
       
   131 
       
   132   gpointer _gst_reserved[GST_PADDING];
       
   133 };
       
   134 
       
   135 struct _GstPadTemplateClass {
       
   136   GstObjectClass   parent_class;
       
   137 
       
   138   /* signal callbacks */
       
   139   void (*pad_created)	(GstPadTemplate *templ, GstPad *pad);
       
   140 
       
   141   gpointer _gst_reserved[GST_PADDING];
       
   142 };
       
   143 
       
   144 /** 
       
   145  * GstStaticPadTemplate:
       
   146  * @name_template: the name of the template
       
   147  * @direction: the direction of the template
       
   148  * @presence: the presence of the template
       
   149  * @static_caps: the caps of the template.
       
   150  *
       
   151  * Structure describing the #GstStaticPadTemplate.
       
   152  */
       
   153 struct _GstStaticPadTemplate {
       
   154   const gchar     *name_template;
       
   155   GstPadDirection  direction;
       
   156   GstPadPresence   presence;
       
   157   GstStaticCaps    static_caps;
       
   158 };
       
   159 
       
   160 /**
       
   161  * GST_STATIC_PAD_TEMPLATE:
       
   162  * @padname: the name template of the pad
       
   163  * @dir: the GstPadDirection of the pad
       
   164  * @pres: the GstPadPresence of the pad
       
   165  * @caps: the GstStaticCaps of the pad
       
   166  *
       
   167  * Convenience macro to fill the values of a GstStaticPadTemplate
       
   168  * structure.
       
   169  */
       
   170 #define GST_STATIC_PAD_TEMPLATE(padname, dir, pres, caps) \
       
   171 { \
       
   172   /* name_template */    padname, \
       
   173   /* direction */        dir, \
       
   174   /* presence */         pres, \
       
   175   /* caps */             caps \
       
   176 }
       
   177 
       
   178 /* templates and factories */
       
   179 #ifdef __SYMBIAN32__
       
   180 IMPORT_C
       
   181 #endif
       
   182 
       
   183 GType			gst_pad_template_get_type		(void);
       
   184 #ifdef __SYMBIAN32__
       
   185 IMPORT_C
       
   186 #endif
       
   187 
       
   188 GType			gst_static_pad_template_get_type	(void);
       
   189 #ifdef __SYMBIAN32__
       
   190 IMPORT_C
       
   191 #endif
       
   192 
       
   193 
       
   194 GstPadTemplate*		gst_pad_template_new			(const gchar *name_template,
       
   195 								 GstPadDirection direction, GstPadPresence presence,
       
   196 								 GstCaps *caps);
       
   197 #ifdef __SYMBIAN32__
       
   198 IMPORT_C
       
   199 #endif
       
   200 
       
   201 
       
   202 GstPadTemplate *	gst_static_pad_template_get             (GstStaticPadTemplate *pad_template);
       
   203 #ifdef __SYMBIAN32__
       
   204 IMPORT_C
       
   205 #endif
       
   206 
       
   207 GstCaps*		gst_static_pad_template_get_caps	(GstStaticPadTemplate *templ);
       
   208 #ifdef __SYMBIAN32__
       
   209 IMPORT_C
       
   210 #endif
       
   211 
       
   212 GstCaps*		gst_pad_template_get_caps		(GstPadTemplate *templ);
       
   213 #ifdef __SYMBIAN32__
       
   214 IMPORT_C
       
   215 #endif
       
   216 
       
   217 
       
   218 void                    gst_pad_template_pad_created            (GstPadTemplate * templ, GstPad * pad);
       
   219 
       
   220 G_END_DECLS
       
   221 
       
   222 #endif /* __GST_PAD_TEMPLATE_H__ */
       
   223