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