Saving relocations for GTypeInfo and GstElementDetails. Fixes #437457.
[platform/upstream/gstreamer.git] / gst / gstutils.h
1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  *                    2000 Wim Taymans <wtay@chello.be>
4  *                    2002 Thomas Vander Stichele <thomas@apestaart.org>
5  *
6  * gstutils.h: Header for various utility functions
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24
25 #ifndef __GST_UTILS_H__
26 #define __GST_UTILS_H__
27
28 #include <glib.h>
29 #include <gst/gstbin.h>
30
31 G_BEGIN_DECLS
32
33 void            gst_util_set_value_from_string  (GValue *value, const gchar *value_str);
34 void            gst_util_set_object_arg         (GObject *object, const gchar *name, const gchar *value);
35 void            gst_util_dump_mem               (const guchar *mem, guint size);
36
37 guint64         gst_util_gdouble_to_guint64     (gdouble value);
38 gdouble         gst_util_guint64_to_gdouble     (guint64 value);
39
40 /**
41  * gst_guint64_to_gdouble:
42  * @value: the #guint64 value to convert
43  *
44  * Convert @value to a gdouble.
45  *
46  * Returns: @value converted to a #gdouble.
47  */
48
49 /**
50  * gst_gdouble_to_guint64:
51  * @value: the #gdouble value to convert
52  *
53  * Convert @value to a guint64.
54  *
55  * Returns: @value converted to a #guint64.
56  */
57 #ifdef WIN32
58 #define         gst_gdouble_to_guint64(value)   gst_util_gdouble_to_guint64(value)
59 #define         gst_guint64_to_gdouble(value)   gst_util_guint64_to_gdouble(value)
60 #else
61 #define         gst_gdouble_to_guint64(value)   ((guint64) (value))
62 #define         gst_guint64_to_gdouble(value)   ((gdouble) (value))
63 #endif
64
65 guint64         gst_util_uint64_scale           (guint64 val, guint64 num, guint64 denom);
66
67 guint64         gst_util_uint64_scale_int       (guint64 val, gint num, gint denom);
68
69 void            gst_print_pad_caps              (GString *buf, gint indent, GstPad *pad);
70 void            gst_print_element_args          (GString *buf, gint indent, GstElement *element);
71
72
73 GType gst_type_register_static_full (GType parent_type,
74                                            const gchar       *type_name,
75                                guint              class_size,
76                                GBaseInitFunc      base_init,
77                                GBaseFinalizeFunc  base_finalize,
78                                GClassInitFunc     class_init,
79                                GClassFinalizeFunc class_finalize,
80                                gconstpointer      class_data,
81                                guint              instance_size,
82                                guint16            n_preallocs,
83                                GInstanceInitFunc  instance_init,
84                                const GTypeValueTable *value_table,
85                                GTypeFlags        flags);
86
87
88 /* Macros for defining classes.  Ideas taken from Bonobo, which took theirs
89    from Nautilus and GOB. */
90
91 /**
92  * GST_BOILERPLATE_FULL:
93  * @type: the name of the type struct
94  * @type_as_function: the prefix for the functions
95  * @parent_type: the parent type struct name
96  * @parent_type_macro: the parent type macro
97  * @additional_initializations: function pointer in the form of
98  * void additional_initializations (GType type) that can be used for
99  * initializing interfaces and the like
100  *
101  * Define the boilerplate type stuff to reduce typos and code size.  Defines
102  * the get_type method and the parent_class static variable.
103  *
104  * <informalexample>
105  * <programlisting>
106  *   GST_BOILERPLATE_FULL (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT, _do_init);
107  * </programlisting>
108  * </informalexample>
109  */
110 #define GST_BOILERPLATE_FULL(type, type_as_function, parent_type, parent_type_macro, additional_initializations)        \
111                                                                         \
112 static void type_as_function ## _base_init     (gpointer      g_class); \
113 static void type_as_function ## _class_init    (type ## Class *g_class);\
114 static void type_as_function ## _init          (type          *object,  \
115                                                 type ## Class *g_class);\
116 static parent_type ## Class *parent_class = NULL;                       \
117 static void                                                             \
118 type_as_function ## _class_init_trampoline (gpointer g_class,           \
119                                             gpointer data)              \
120 {                                                                       \
121   parent_class = (parent_type ## Class *)                               \
122       g_type_class_peek_parent (g_class);                               \
123   type_as_function ## _class_init ((type ## Class *)g_class);           \
124 }                                                                       \
125                                                                         \
126 GType type_as_function ## _get_type (void);                             \
127                                                                         \
128 GType                                                                   \
129 type_as_function ## _get_type (void)                                    \
130 {                                                                       \
131   static GType object_type = 0;                                         \
132   if (G_UNLIKELY (object_type == 0)) {                                  \
133     object_type = gst_type_register_static_full (parent_type_macro, #type,      \
134         sizeof (type ## Class),                                 \
135         type_as_function ## _base_init,                                 \
136         NULL,             /* base_finalize */                           \
137         type_as_function ## _class_init_trampoline,                     \
138         NULL,             /* class_finalize */                          \
139         NULL,               /* class_data */                            \
140         sizeof (type),                                                  \
141         0,                  /* n_preallocs */                           \
142         (GInstanceInitFunc) type_as_function ## _init,                  \
143         NULL,                                                           \
144         (GTypeFlags) 0);                                                \
145     additional_initializations (object_type);                           \
146   }                                                                     \
147   return object_type;                                                   \
148 }
149
150 #define __GST_DO_NOTHING(type)  /* NOP */
151
152 /**
153  * GST_BOILERPLATE:
154  * @type: the name of the type struct
155  * @type_as_function: the prefix for the functions
156  * @parent_type: the parent type struct name
157  * @parent_type_macro: the parent type macro
158  *
159  * Define the boilerplate type stuff to reduce typos and code size.  Defines
160  * the get_type method and the parent_class static variable.
161  *
162  * <informalexample>
163  * <programlisting>
164  *   GST_BOILERPLATE (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT);
165  * </programlisting>
166  * </informalexample>
167  */
168 #define GST_BOILERPLATE(type,type_as_function,parent_type,parent_type_macro)    \
169   GST_BOILERPLATE_FULL (type, type_as_function, parent_type, parent_type_macro, \
170       __GST_DO_NOTHING)
171
172 /* Like GST_BOILERPLATE, but makes the type 1) implement an interface, and 2)
173  * implement GstImplementsInterface for that type
174  *
175  * After this you will need to implement interface_as_function ## _supported
176  * and interface_as_function ## _interface_init
177  */
178 /**
179  * GST_BOILERPLATE_WITH_INTERFACE:
180  * @type: the name of the type struct
181  * @type_as_function: the prefix for the functions
182  * @parent_type: the parent type struct name
183  * @parent_type_as_macro: the parent type macro
184  * @interface_type: the name of the interface type struct
185  * @interface_type_as_macro: the interface type macro
186  * @interface_as_function: the interface function name prefix
187  *
188  * Like GST_BOILERPLATE, but makes the type 1) implement an interface, and 2)
189  * implement GstImplementsInterface for that type.
190  *
191  * After this you will need to implement interface_as_function ## _supported
192  * and interface_as_function ## _interface_init
193  */
194 #define GST_BOILERPLATE_WITH_INTERFACE(type, type_as_function,          \
195     parent_type, parent_type_as_macro, interface_type,                  \
196     interface_type_as_macro, interface_as_function)                     \
197                                                                         \
198 static void interface_as_function ## _interface_init (interface_type ## Class *klass);  \
199 static gboolean interface_as_function ## _supported (type *object, GType iface_type);   \
200                                                                         \
201 static void                                                             \
202 type_as_function ## _implements_interface_init (GstImplementsInterfaceClass *klass)     \
203 {                                                                       \
204   klass->supported = (gboolean (*)(GstImplementsInterface*, GType))interface_as_function ## _supported;     \
205 }                                                                       \
206                                                                         \
207 static void                                                             \
208 type_as_function ## _init_interfaces (GType type)                       \
209 {                                                                       \
210   static const GInterfaceInfo implements_iface_info = {                 \
211     (GInterfaceInitFunc) type_as_function ## _implements_interface_init,\
212     NULL,                                                               \
213     NULL,                                                               \
214   };                                                                    \
215   static const GInterfaceInfo iface_info = {                            \
216     (GInterfaceInitFunc) interface_as_function ## _interface_init,      \
217     NULL,                                                               \
218     NULL,                                                               \
219   };                                                                    \
220                                                                         \
221   g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,     \
222       &implements_iface_info);                                          \
223   g_type_add_interface_static (type, interface_type_as_macro,           \
224       &iface_info);                                                     \
225 }                                                                       \
226                                                                         \
227 GST_BOILERPLATE_FULL (type, type_as_function, parent_type,              \
228     parent_type_as_macro, type_as_function ## _init_interfaces)
229
230 /**
231  * GST_CALL_PARENT:
232  * @parent_class_cast: the name of the class cast macro for the parent type
233  * @name: name of the function to call
234  * @args: arguments enclosed in '( )'
235  *
236  * Just call the parent handler.  This assumes that there is a variable
237  * named parent_class that points to the (duh!) parent class.  Note that
238  * this macro is not to be used with things that return something, use
239  * the _WITH_DEFAULT version for that
240  */
241 #define GST_CALL_PARENT(parent_class_cast, name, args)                  \
242         ((parent_class_cast(parent_class)->name != NULL) ?              \
243          parent_class_cast(parent_class)->name args : (void) 0)
244
245 /**
246  * GST_CALL_PARENT_WITH_DEFAULT:
247  * @parent_class_cast: the name of the class cast macro for the parent type
248  * @name: name of the function to call
249  * @args: arguments enclosed in '( )'
250  * @def_return: default result
251  *
252  * Same as GST_CALL_PARENT(), but in case there is no implementation, it
253  * evaluates to @def_return.
254  */
255 #define GST_CALL_PARENT_WITH_DEFAULT(parent_class_cast, name, args, def_return)\
256         ((parent_class_cast(parent_class)->name != NULL) ?              \
257          parent_class_cast(parent_class)->name args : def_return)
258
259 /* Define possibly unaligned memory access method whether the type of
260  * architecture. */
261 #if GST_HAVE_UNALIGNED_ACCESS
262
263 #define _GST_GET(__data, __size, __end) \
264     (GUINT##__size##_FROM_##__end (* ((guint##__size *) (__data))))
265
266 /**
267  * GST_READ_UINT64_BE:
268  * @data: memory location
269  *
270  * Read a 64 bit unsigned integer value in big endian format from the memory buffer.
271  */
272 #define GST_READ_UINT64_BE(data)        _GST_GET (data, 64, BE)
273 /**
274  * GST_READ_UINT64_LE:
275  * @data: memory location
276  *
277  * Read a 64 bit unsigned integer value in little endian format from the memory buffer.
278  */
279 #define GST_READ_UINT64_LE(data)        _GST_GET (data, 64, LE)
280 /**
281  * GST_READ_UINT32_BE:
282  * @data: memory location
283  *
284  * Read a 32 bit unsigned integer value in big endian format from the memory buffer.
285  */
286 #define GST_READ_UINT32_BE(data)        _GST_GET (data, 32, BE)
287 /**
288  * GST_READ_UINT32_LE:
289  * @data: memory location
290  *
291  * Read a 32 bit unsigned integer value in little endian format from the memory buffer.
292  */
293 #define GST_READ_UINT32_LE(data)        _GST_GET (data, 32, LE)
294 /**
295  * GST_READ_UINT16_BE:
296  * @data: memory location
297  *
298  * Read a 16 bit unsigned integer value in big endian format from the memory buffer.
299  */
300 #define GST_READ_UINT16_BE(data)        _GST_GET (data, 16, BE)
301 /**
302  * GST_READ_UINT16_LE:
303  * @data: memory location
304  *
305  * Read a 16 bit unsigned integer value in little endian format from the memory buffer.
306  */
307 #define GST_READ_UINT16_LE(data)        _GST_GET (data, 16, LE)
308 /**
309  * GST_READ_UINT8:
310  * @data: memory location
311  *
312  * Read an 8 bit unsigned integer value from the memory buffer.
313  */
314 #define GST_READ_UINT8(data)            (* ((guint8 *) (data)))
315
316 #define _GST_PUT(__data, __size, __end, __num) \
317     ((* (guint##__size *) (__data)) = GUINT##__size##_TO_##__end (__num))
318
319 /**
320  * GST_WRITE_UINT64_BE:
321  * @data: memory location
322  * @num: value to store
323  *
324  * Store a 64 bit unsigned integer value in big endian format into the memory buffer.
325  */
326 #define GST_WRITE_UINT64_BE(data, num)  _GST_PUT(data, 64, BE, num)
327 /**
328  * GST_WRITE_UINT64_LE:
329  * @data: memory location
330  * @num: value to store
331  *
332  * Store a 64 bit unsigned integer value in little endian format into the memory buffer.
333  */
334 #define GST_WRITE_UINT64_LE(data, num)  _GST_PUT(data, 64, LE, num)
335 /**
336  * GST_WRITE_UINT32_BE:
337  * @data: memory location
338  * @num: value to store
339  *
340  * Store a 32 bit unsigned integer value in big endian format into the memory buffer.
341  */
342 #define GST_WRITE_UINT32_BE(data, num)  _GST_PUT(data, 32, BE, num)
343 /**
344  * GST_WRITE_UINT32_LE:
345  * @data: memory location
346  * @num: value to store
347  *
348  * Store a 32 bit unsigned integer value in little endian format into the memory buffer.
349  */
350 #define GST_WRITE_UINT32_LE(data, num)  _GST_PUT(data, 32, LE, num)
351 /**
352  * GST_WRITE_UINT16_BE:
353  * @data: memory location
354  * @num: value to store
355  *
356  * Store a 16 bit unsigned integer value in big endian format into the memory buffer.
357  */
358 #define GST_WRITE_UINT16_BE(data, num)  _GST_PUT(data, 16, BE, num)
359 /**
360  * GST_WRITE_UINT16_LE:
361  * @data: memory location
362  * @num: value to store
363  *
364  * Store a 16 bit unsigned integer value in little endian format into the memory buffer.
365  */
366 #define GST_WRITE_UINT16_LE(data, num)  _GST_PUT(data, 16, LE, num)
367 /**
368  * GST_WRITE_UINT8:
369  * @data: memory location
370  * @num: value to store
371  *
372  * Store an 8 bit unsigned integer value into the memory buffer.
373  */
374 #define GST_WRITE_UINT8(data, num)      ((* (guint8 *) (data)) = (num))
375
376 #else /* GST_HAVE_UNALIGNED_ACCESS */
377
378 #define _GST_GET(__data, __idx, __size, __shift) \
379     (((guint##__size) (((guint8 *) (__data))[__idx])) << __shift)
380
381 #define GST_READ_UINT64_BE(data)        (_GST_GET (data, 0, 64, 56) | \
382                                          _GST_GET (data, 1, 64, 48) | \
383                                          _GST_GET (data, 2, 64, 40) | \
384                                          _GST_GET (data, 3, 64, 32) | \
385                                          _GST_GET (data, 4, 64, 24) | \
386                                          _GST_GET (data, 5, 64, 16) | \
387                                          _GST_GET (data, 6, 64,  8) | \
388                                          _GST_GET (data, 7, 64,  0))
389
390 #define GST_READ_UINT64_LE(data)        (_GST_GET (data, 7, 64, 56) | \
391                                          _GST_GET (data, 6, 64, 48) | \
392                                          _GST_GET (data, 5, 64, 40) | \
393                                          _GST_GET (data, 4, 64, 32) | \
394                                          _GST_GET (data, 3, 64, 24) | \
395                                          _GST_GET (data, 2, 64, 16) | \
396                                          _GST_GET (data, 1, 64,  8) | \
397                                          _GST_GET (data, 0, 64,  0))
398
399 #define GST_READ_UINT32_BE(data)        (_GST_GET (data, 0, 32, 24) | \
400                                          _GST_GET (data, 1, 32, 16) | \
401                                          _GST_GET (data, 2, 32,  8) | \
402                                          _GST_GET (data, 3, 32,  0))
403
404 #define GST_READ_UINT32_LE(data)        (_GST_GET (data, 3, 32, 24) | \
405                                          _GST_GET (data, 2, 32, 16) | \
406                                          _GST_GET (data, 1, 32,  8) | \
407                                          _GST_GET (data, 0, 32,  0))
408
409 #define GST_READ_UINT16_BE(data)        (_GST_GET (data, 0, 16,  8) | \
410                                          _GST_GET (data, 1, 16,  0))
411
412 #define GST_READ_UINT16_LE(data)        (_GST_GET (data, 1, 16,  8) | \
413                                          _GST_GET (data, 0, 16,  0))
414
415 #define GST_READ_UINT8(data)            (_GST_GET (data, 0,  8,  0))
416
417 #define _GST_PUT(__data, __idx, __size, __shift, __num) \
418     (((guint8 *) (__data))[__idx] = (((guint##__size) __num) >> __shift) & 0xff)
419
420 #define GST_WRITE_UINT64_BE(data, num)  do { \
421                                           _GST_PUT (data, 0, 64, 56, num); \
422                                           _GST_PUT (data, 1, 64, 48, num); \
423                                           _GST_PUT (data, 2, 64, 40, num); \
424                                           _GST_PUT (data, 3, 64, 32, num); \
425                                           _GST_PUT (data, 4, 64, 24, num); \
426                                           _GST_PUT (data, 5, 64, 16, num); \
427                                           _GST_PUT (data, 6, 64,  8, num); \
428                                           _GST_PUT (data, 7, 64,  0, num); \
429                                         } while (0)
430
431 #define GST_WRITE_UINT64_LE(data, num)  do { \
432                                           _GST_PUT (data, 0, 64,  0, num); \
433                                           _GST_PUT (data, 1, 64,  8, num); \
434                                           _GST_PUT (data, 2, 64, 16, num); \
435                                           _GST_PUT (data, 3, 64, 24, num); \
436                                           _GST_PUT (data, 4, 64, 32, num); \
437                                           _GST_PUT (data, 5, 64, 40, num); \
438                                           _GST_PUT (data, 6, 64, 48, num); \
439                                           _GST_PUT (data, 7, 64, 56, num); \
440                                         } while (0)
441
442 #define GST_WRITE_UINT32_BE(data, num)  do { \
443                                           _GST_PUT (data, 0, 32, 24, num); \
444                                           _GST_PUT (data, 1, 32, 16, num); \
445                                           _GST_PUT (data, 2, 32,  8, num); \
446                                           _GST_PUT (data, 3, 32,  0, num); \
447                                         } while (0)
448
449 #define GST_WRITE_UINT32_LE(data, num)  do { \
450                                           _GST_PUT (data, 0, 32,  0, num); \
451                                           _GST_PUT (data, 1, 32,  8, num); \
452                                           _GST_PUT (data, 2, 32, 16, num); \
453                                           _GST_PUT (data, 3, 32, 24, num); \
454                                         } while (0)
455
456 #define GST_WRITE_UINT16_BE(data, num)  do { \
457                                           _GST_PUT (data, 0, 16,  8, num); \
458                                           _GST_PUT (data, 1, 16,  0, num); \
459                                         } while (0)
460
461 #define GST_WRITE_UINT16_LE(data, num)  do { \
462                                           _GST_PUT (data, 0, 16,  0, num); \
463                                           _GST_PUT (data, 1, 16,  8, num); \
464                                         } while (0)
465
466 #define GST_WRITE_UINT8(data, num)      do { \
467                                           _GST_PUT (data, 0,  8,  0, num); \
468                                         } while (0)
469
470 #endif /* GST_HAVE_UNALIGNED_ACCESS */
471
472
473 /* Miscellaneous utility macros */
474
475 /**
476  * GST_ROUND_UP_2:
477  * @num: integer value to round up
478  *
479  * Rounds an integer value up to the next multiple of 2.
480  */
481 #define GST_ROUND_UP_2(num)  (((num)+1)&~1)
482 /**
483  * GST_ROUND_UP_4:
484  * @num: integer value to round up
485  *
486  * Rounds an integer value up to the next multiple of 4.
487  */
488 #define GST_ROUND_UP_4(num)  (((num)+3)&~3)
489 /**
490  * GST_ROUND_UP_8:
491  * @num: integer value to round up
492  *
493  * Rounds an integer value up to the next multiple of 8.
494  */
495 #define GST_ROUND_UP_8(num)  (((num)+7)&~7)
496 /**
497  * GST_ROUND_UP_16:
498  * @num: integer value to round up
499  *
500  * Rounds an integer value up to the next multiple of 16.
501  */
502 #define GST_ROUND_UP_16(num) (((num)+15)&~15)
503 /**
504  * GST_ROUND_UP_32:
505  * @num: integer value to round up
506  *
507  * Rounds an integer value up to the next multiple of 32.
508  */
509 #define GST_ROUND_UP_32(num) (((num)+31)&~31)
510 /**
511  * GST_ROUND_UP_64:
512  * @num: integer value to round up
513  *
514  * Rounds an integer value up to the next multiple of 64.
515  */
516 #define GST_ROUND_UP_64(num) (((num)+63)&~63)
517
518 /**
519  * GST_ROUND_DOWN_2:
520  * @num: integer value to round down
521  *
522  * Rounds an integer value down to the next multiple of 2.
523  *
524  * Since: 0.10.12
525  */
526 #define GST_ROUND_DOWN_2(num)  ((num)&(~1))
527 /**
528  * GST_ROUND_DOWN_4:
529  * @num: integer value to round down
530  *
531  * Rounds an integer value down to the next multiple of 4.
532  *
533  * Since: 0.10.12
534  */
535 #define GST_ROUND_DOWN_4(num)  ((num)&(~3))
536 /**
537  * GST_ROUND_DOWN_8:
538  * @num: integer value to round down
539  *
540  * Rounds an integer value down to the next multiple of 8.
541  *
542  * Since: 0.10.12
543  */
544 #define GST_ROUND_DOWN_8(num)  ((num)&(~7))
545 /**
546  * GST_ROUND_DOWN_16:
547  * @num: integer value to round down
548  *
549  * Rounds an integer value down to the next multiple of 16.
550  *
551  * Since: 0.10.12
552  */
553 #define GST_ROUND_DOWN_16(num) ((num)&(~15))
554 /**
555  * GST_ROUND_DOWN_32:
556  * @num: integer value to round down
557  *
558  * Rounds an integer value down to the next multiple of 32.
559  *
560  * Since: 0.10.12
561  */
562 #define GST_ROUND_DOWN_32(num) ((num)&(~31))
563 /**
564  * GST_ROUND_DOWN_64:
565  * @num: integer value to round down
566  *
567  * Rounds an integer value down to the next multiple of 64.
568  *
569  * Since: 0.10.12
570  */
571 #define GST_ROUND_DOWN_64(num) ((num)&(~63))
572
573 void                    gst_object_default_error        (GstObject * source,
574                                                          GError * error, gchar * debug);
575
576 /* element functions */
577 void                    gst_element_create_all_pads     (GstElement *element);
578 GstPad*                 gst_element_get_compatible_pad  (GstElement *element, GstPad *pad,
579                                                          const GstCaps *caps);
580
581 GstPadTemplate*         gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *compattempl);
582
583 G_CONST_RETURN gchar*   gst_element_state_get_name      (GstState state);
584 G_CONST_RETURN gchar *  gst_element_state_change_return_get_name (GstStateChangeReturn state_ret);
585
586 gboolean                gst_element_link                (GstElement *src, GstElement *dest);
587 gboolean                gst_element_link_many           (GstElement *element_1,
588                                                          GstElement *element_2, ...) G_GNUC_NULL_TERMINATED;
589 gboolean                gst_element_link_filtered       (GstElement * src,
590                                                          GstElement * dest,
591                                                          GstCaps *filter);
592 void                    gst_element_unlink              (GstElement *src, GstElement *dest);
593 void                    gst_element_unlink_many         (GstElement *element_1,
594                                                          GstElement *element_2, ...) G_GNUC_NULL_TERMINATED;
595
596 gboolean                gst_element_link_pads           (GstElement *src, const gchar *srcpadname,
597                                                          GstElement *dest, const gchar *destpadname);
598 void                    gst_element_unlink_pads         (GstElement *src, const gchar *srcpadname,
599                                                          GstElement *dest, const gchar *destpadname);
600
601 gboolean                gst_element_link_pads_filtered  (GstElement * src, const gchar * srcpadname,
602                                                          GstElement * dest, const gchar * destpadname,
603                                                          GstCaps *filter);
604
605 gboolean        gst_element_seek_simple (GstElement   *element,
606                                          GstFormat     format,
607                                          GstSeekFlags  seek_flags,
608                                          gint64        seek_pos);
609
610 /* util elementfactory functions */
611 gboolean                gst_element_factory_can_src_caps(GstElementFactory *factory, const GstCaps *caps);
612 gboolean                gst_element_factory_can_sink_caps(GstElementFactory *factory, const GstCaps *caps);
613
614 /* util query functions */
615 gboolean                gst_element_query_position      (GstElement *element, GstFormat *format,
616                                                          gint64 *cur);
617 gboolean                gst_element_query_duration      (GstElement *element, GstFormat *format,
618                                                          gint64 *duration);
619 gboolean                gst_element_query_convert       (GstElement *element, GstFormat src_format, gint64 src_val,
620                                                          GstFormat *dest_format, gint64 *dest_val);
621
622 /* element class functions */
623 void                    gst_element_class_install_std_props (GstElementClass * klass,
624                                                          const gchar * first_name, ...) G_GNUC_NULL_TERMINATED;
625
626 /* pad functions */
627 gboolean                gst_pad_can_link                (GstPad *srcpad, GstPad *sinkpad);
628
629 void                    gst_pad_use_fixed_caps          (GstPad *pad);
630 GstCaps*                gst_pad_get_fixed_caps_func     (GstPad *pad);
631 GstCaps*                gst_pad_proxy_getcaps           (GstPad * pad);
632 gboolean                gst_pad_proxy_setcaps           (GstPad * pad, GstCaps * caps);
633
634 GstElement*             gst_pad_get_parent_element      (GstPad *pad);
635
636 /* util query functions */
637 gboolean                gst_pad_query_position          (GstPad *pad, GstFormat *format,
638                                                          gint64 *cur);
639 gboolean                gst_pad_query_duration          (GstPad *pad, GstFormat *format,
640                                                          gint64 *duration);
641 gboolean                gst_pad_query_convert           (GstPad *pad, GstFormat src_format, gint64 src_val,
642                                                          GstFormat *dest_format, gint64 *dest_val);
643
644 gboolean                gst_pad_query_peer_position     (GstPad *pad, GstFormat *format,
645                                                          gint64 *cur);
646 gboolean                gst_pad_query_peer_duration     (GstPad *pad, GstFormat *format,
647                                                          gint64 *duration);
648 gboolean                gst_pad_query_peer_convert      (GstPad *pad, GstFormat src_format, gint64 src_val,
649                                                          GstFormat *dest_format, gint64 *dest_val);
650
651 /* bin functions */
652 void                    gst_bin_add_many                (GstBin *bin, GstElement *element_1, ...) G_GNUC_NULL_TERMINATED;
653 void                    gst_bin_remove_many             (GstBin *bin, GstElement *element_1, ...) G_GNUC_NULL_TERMINATED;
654 GstPad *                gst_bin_find_unconnected_pad    (GstBin *bin, GstPadDirection direction);
655
656 /* buffer functions */
657 GstBuffer *             gst_buffer_merge                (GstBuffer * buf1, GstBuffer * buf2);
658 GstBuffer *             gst_buffer_join                 (GstBuffer * buf1, GstBuffer * buf2);
659 void                    gst_buffer_stamp                (GstBuffer * dest, const GstBuffer * src);
660
661 /* atomic functions */
662 void                    gst_atomic_int_set              (gint * atomic_int, gint value);
663
664 /* probes */
665 gulong                  gst_pad_add_data_probe          (GstPad * pad,
666                                                          GCallback handler,
667                                                          gpointer data);
668 void                    gst_pad_remove_data_probe       (GstPad * pad, guint handler_id);
669 gulong                  gst_pad_add_event_probe         (GstPad * pad,
670                                                          GCallback handler,
671                                                          gpointer data);
672 void                    gst_pad_remove_event_probe      (GstPad * pad, guint handler_id);
673 gulong                  gst_pad_add_buffer_probe        (GstPad * pad,
674                                                          GCallback handler,
675                                                          gpointer data);
676 void                    gst_pad_remove_buffer_probe     (GstPad * pad, guint handler_id);
677
678 /* tag emission utility functions */
679 void                    gst_element_found_tags_for_pad  (GstElement * element,
680                                                          GstPad * pad,
681                                                          GstTagList * list);
682 void                    gst_element_found_tags          (GstElement * element,
683                                                          GstTagList * list);
684
685 /* parse utility functions */
686 GstElement *            gst_parse_bin_from_description  (const gchar * bin_description,
687                                                          gboolean ghost_unconnected_pads,
688                                                          GError ** err);
689
690 G_END_DECLS
691
692 #endif /* __GST_UTILS_H__ */