gstpadtemplate.h 5.7 KB

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