gstreamer_core/gst/gstutils.h
changeset 0 0e761a78d257
child 8 4a7fac7dd34a
child 29 567bb019e3e3
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 <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 #ifdef __SYMBIAN32__
       
    35 IMPORT_C
       
    36 #endif
       
    37 
       
    38 void		gst_util_set_object_arg		(GObject *object, const gchar *name, const gchar *value);
       
    39 #ifdef __SYMBIAN32__
       
    40 IMPORT_C
       
    41 #endif
       
    42 
       
    43 void		gst_util_dump_mem		(const guchar *mem, guint size);
       
    44 #ifdef __SYMBIAN32__
       
    45 IMPORT_C
       
    46 #endif
       
    47 
       
    48 
       
    49 guint64         gst_util_gdouble_to_guint64     (gdouble value);
       
    50 #ifdef __SYMBIAN32__
       
    51 IMPORT_C
       
    52 #endif
       
    53 
       
    54 gdouble         gst_util_guint64_to_gdouble     (guint64 value);
       
    55 
       
    56 /**
       
    57  * gst_guint64_to_gdouble:
       
    58  * @value: the #guint64 value to convert
       
    59  *
       
    60  * Convert @value to a gdouble.
       
    61  *
       
    62  * Returns: @value converted to a #gdouble.
       
    63  */
       
    64 
       
    65 /**
       
    66  * gst_gdouble_to_guint64:
       
    67  * @value: the #gdouble value to convert
       
    68  *
       
    69  * Convert @value to a guint64.
       
    70  *
       
    71  * Returns: @value converted to a #guint64.
       
    72  */
       
    73 #ifdef WIN32
       
    74 #define         gst_gdouble_to_guint64(value)   gst_util_gdouble_to_guint64(value)
       
    75 #define         gst_guint64_to_gdouble(value)   gst_util_guint64_to_gdouble(value)
       
    76 #else
       
    77 #define         gst_gdouble_to_guint64(value)   ((guint64) (value))
       
    78 #define         gst_guint64_to_gdouble(value)   ((gdouble) (value))
       
    79 #endif
       
    80 
       
    81 guint64		gst_util_uint64_scale		(guint64 val, guint64 num, guint64 denom);
       
    82 #ifdef __SYMBIAN32__
       
    83 IMPORT_C
       
    84 #endif
       
    85 
       
    86 
       
    87 guint64         gst_util_uint64_scale_int       (guint64 val, gint num, gint denom);
       
    88 #ifdef __SYMBIAN32__
       
    89 IMPORT_C
       
    90 #endif
       
    91 
       
    92 
       
    93 void		gst_print_pad_caps		(GString *buf, gint indent, GstPad *pad);
       
    94 #ifdef __SYMBIAN32__
       
    95 IMPORT_C
       
    96 #endif
       
    97 
       
    98 void		gst_print_element_args		(GString *buf, gint indent, GstElement *element);
       
    99 #ifdef __SYMBIAN32__
       
   100 IMPORT_C
       
   101 #endif
       
   102 
       
   103 
       
   104 
       
   105 GType gst_type_register_static_full (GType parent_type,
       
   106 			                   const gchar       *type_name,
       
   107                                guint              class_size,
       
   108                                GBaseInitFunc      base_init,
       
   109                                GBaseFinalizeFunc  base_finalize,
       
   110                                GClassInitFunc     class_init,
       
   111                                GClassFinalizeFunc class_finalize,
       
   112                                gconstpointer      class_data,
       
   113                                guint              instance_size,
       
   114                                guint16            n_preallocs,
       
   115                                GInstanceInitFunc  instance_init,
       
   116                                const GTypeValueTable *value_table,
       
   117                                GTypeFlags	 flags);
       
   118 
       
   119 
       
   120 /* Macros for defining classes.  Ideas taken from Bonobo, which took theirs
       
   121    from Nautilus and GOB. */
       
   122 
       
   123 /**
       
   124  * GST_BOILERPLATE_FULL:
       
   125  * @type: the name of the type struct
       
   126  * @type_as_function: the prefix for the functions
       
   127  * @parent_type: the parent type struct name
       
   128  * @parent_type_macro: the parent type macro
       
   129  * @additional_initializations: function pointer in the form of
       
   130  * void additional_initializations (GType type) that can be used for
       
   131  * initializing interfaces and the like
       
   132  *
       
   133  * Define the boilerplate type stuff to reduce typos and code size.  Defines
       
   134  * the get_type method and the parent_class static variable.
       
   135  *
       
   136  * <informalexample>
       
   137  * <programlisting>
       
   138  *   GST_BOILERPLATE_FULL (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT, _do_init);
       
   139  * </programlisting>
       
   140  * </informalexample>
       
   141  */
       
   142 #define GST_BOILERPLATE_FULL(type, type_as_function, parent_type, parent_type_macro, additional_initializations)	\
       
   143 									\
       
   144 static void type_as_function ## _base_init     (gpointer      g_class);	\
       
   145 static void type_as_function ## _class_init    (type ## Class *g_class);\
       
   146 static void type_as_function ## _init	       (type          *object,	\
       
   147                                                 type ## Class *g_class);\
       
   148 static parent_type ## Class *parent_class = NULL;			\
       
   149 static void								\
       
   150 type_as_function ## _class_init_trampoline (gpointer g_class,		\
       
   151 					    gpointer data)		\
       
   152 {									\
       
   153   parent_class = (parent_type ## Class *)				\
       
   154       g_type_class_peek_parent (g_class);				\
       
   155   type_as_function ## _class_init ((type ## Class *)g_class);		\
       
   156 }									\
       
   157 									\
       
   158 GType type_as_function ## _get_type (void);				\
       
   159 									\
       
   160 __declspec(dllexport) GType									\
       
   161 type_as_function ## _get_type (void)					\
       
   162 {									\
       
   163   static GType object_type = 0;						\
       
   164   if (G_UNLIKELY (object_type == 0)) {					\
       
   165     object_type = gst_type_register_static_full (parent_type_macro, #type,	\
       
   166 	sizeof (type ## Class),					\
       
   167         type_as_function ## _base_init,					\
       
   168         NULL,		  /* base_finalize */				\
       
   169         type_as_function ## _class_init_trampoline,			\
       
   170         NULL,		  /* class_finalize */				\
       
   171         NULL,               /* class_data */				\
       
   172         sizeof (type),							\
       
   173         0,                  /* n_preallocs */				\
       
   174         (GInstanceInitFunc) type_as_function ## _init,                  \
       
   175         NULL,                                                           \
       
   176         (GTypeFlags) 0);				                \
       
   177     additional_initializations (object_type);				\
       
   178   }									\
       
   179   return object_type;							\
       
   180 }
       
   181 
       
   182 #define __GST_DO_NOTHING(type)	/* NOP */
       
   183 
       
   184 /**
       
   185  * GST_BOILERPLATE:
       
   186  * @type: the name of the type struct
       
   187  * @type_as_function: the prefix for the functions
       
   188  * @parent_type: the parent type struct name
       
   189  * @parent_type_macro: the parent type macro
       
   190  *
       
   191  * Define the boilerplate type stuff to reduce typos and code size.  Defines
       
   192  * the get_type method and the parent_class static variable.
       
   193  *
       
   194  * <informalexample>
       
   195  * <programlisting>
       
   196  *   GST_BOILERPLATE (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT);
       
   197  * </programlisting>
       
   198  * </informalexample>
       
   199  */
       
   200 #define GST_BOILERPLATE(type,type_as_function,parent_type,parent_type_macro)	\
       
   201   GST_BOILERPLATE_FULL (type, type_as_function, parent_type, parent_type_macro,	\
       
   202       __GST_DO_NOTHING)
       
   203 
       
   204 /* Like GST_BOILERPLATE, but makes the type 1) implement an interface, and 2)
       
   205  * implement GstImplementsInterface for that type
       
   206  *
       
   207  * After this you will need to implement interface_as_function ## _supported
       
   208  * and interface_as_function ## _interface_init
       
   209  */
       
   210 /**
       
   211  * GST_BOILERPLATE_WITH_INTERFACE:
       
   212  * @type: the name of the type struct
       
   213  * @type_as_function: the prefix for the functions
       
   214  * @parent_type: the parent type struct name
       
   215  * @parent_type_as_macro: the parent type macro
       
   216  * @interface_type: the name of the interface type struct
       
   217  * @interface_type_as_macro: the interface type macro
       
   218  * @interface_as_function: the interface function name prefix
       
   219  *
       
   220  * Like GST_BOILERPLATE, but makes the type 1) implement an interface, and 2)
       
   221  * implement GstImplementsInterface for that type.
       
   222  *
       
   223  * After this you will need to implement interface_as_function ## _supported
       
   224  * and interface_as_function ## _interface_init
       
   225  */
       
   226 #define GST_BOILERPLATE_WITH_INTERFACE(type, type_as_function,		\
       
   227     parent_type, parent_type_as_macro, interface_type,			\
       
   228     interface_type_as_macro, interface_as_function)			\
       
   229                                                                         \
       
   230 static void interface_as_function ## _interface_init (interface_type ## Class *klass);  \
       
   231 static gboolean interface_as_function ## _supported (type *object, GType iface_type);   \
       
   232                                                                         \
       
   233 static void                                                             \
       
   234 type_as_function ## _implements_interface_init (GstImplementsInterfaceClass *klass)     \
       
   235 {                                                                       \
       
   236   klass->supported = (gboolean (*)(GstImplementsInterface*, GType))interface_as_function ## _supported;     \
       
   237 }                                                                       \
       
   238                                                                         \
       
   239 static void                                                             \
       
   240 type_as_function ## _init_interfaces (GType type)                       \
       
   241 {                                                                       \
       
   242   static const GInterfaceInfo implements_iface_info = {                 \
       
   243     (GInterfaceInitFunc) type_as_function ## _implements_interface_init,\
       
   244     NULL,                                                               \
       
   245     NULL,                                                               \
       
   246   };                                                                    \
       
   247   static const GInterfaceInfo iface_info = {                            \
       
   248     (GInterfaceInitFunc) interface_as_function ## _interface_init,      \
       
   249     NULL,                                                               \
       
   250     NULL,                                                               \
       
   251   };                                                                    \
       
   252                                                                         \
       
   253   g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,     \
       
   254       &implements_iface_info);                                          \
       
   255   g_type_add_interface_static (type, interface_type_as_macro,		\
       
   256       &iface_info);							\
       
   257 }                                                                       \
       
   258                                                                         \
       
   259 GST_BOILERPLATE_FULL (type, type_as_function, parent_type,              \
       
   260     parent_type_as_macro, type_as_function ## _init_interfaces)
       
   261 
       
   262 /**
       
   263  * GST_CALL_PARENT:
       
   264  * @parent_class_cast: the name of the class cast macro for the parent type
       
   265  * @name: name of the function to call
       
   266  * @args: arguments enclosed in '( )'
       
   267  *
       
   268  * Just call the parent handler.  This assumes that there is a variable
       
   269  * named parent_class that points to the (duh!) parent class.  Note that
       
   270  * this macro is not to be used with things that return something, use
       
   271  * the _WITH_DEFAULT version for that
       
   272  */
       
   273 #define GST_CALL_PARENT(parent_class_cast, name, args)			\
       
   274 	((parent_class_cast(parent_class)->name != NULL) ?		\
       
   275 	 parent_class_cast(parent_class)->name args : (void) 0)
       
   276 
       
   277 /**
       
   278  * GST_CALL_PARENT_WITH_DEFAULT:
       
   279  * @parent_class_cast: the name of the class cast macro for the parent type
       
   280  * @name: name of the function to call
       
   281  * @args: arguments enclosed in '( )'
       
   282  * @def_return: default result
       
   283  *
       
   284  * Same as GST_CALL_PARENT(), but in case there is no implementation, it
       
   285  * evaluates to @def_return.
       
   286  */
       
   287 #define GST_CALL_PARENT_WITH_DEFAULT(parent_class_cast, name, args, def_return)\
       
   288 	((parent_class_cast(parent_class)->name != NULL) ?		\
       
   289 	 parent_class_cast(parent_class)->name args : def_return)
       
   290 
       
   291 /* Define possibly unaligned memory access method whether the type of
       
   292  * architecture. */
       
   293 #if GST_HAVE_UNALIGNED_ACCESS
       
   294 
       
   295 #define _GST_GET(__data, __size, __end) \
       
   296     (GUINT##__size##_FROM_##__end (* ((guint##__size *) (__data))))
       
   297 
       
   298 /**
       
   299  * GST_READ_UINT64_BE:
       
   300  * @data: memory location
       
   301  *
       
   302  * Read a 64 bit unsigned integer value in big endian format from the memory buffer.
       
   303  */
       
   304 #define GST_READ_UINT64_BE(data)	_GST_GET (data, 64, BE)
       
   305 /**
       
   306  * GST_READ_UINT64_LE:
       
   307  * @data: memory location
       
   308  *
       
   309  * Read a 64 bit unsigned integer value in little endian format from the memory buffer.
       
   310  */
       
   311 #define GST_READ_UINT64_LE(data)	_GST_GET (data, 64, LE)
       
   312 /**
       
   313  * GST_READ_UINT32_BE:
       
   314  * @data: memory location
       
   315  *
       
   316  * Read a 32 bit unsigned integer value in big endian format from the memory buffer.
       
   317  */
       
   318 #define GST_READ_UINT32_BE(data)	_GST_GET (data, 32, BE)
       
   319 /**
       
   320  * GST_READ_UINT32_LE:
       
   321  * @data: memory location
       
   322  *
       
   323  * Read a 32 bit unsigned integer value in little endian format from the memory buffer.
       
   324  */
       
   325 #define GST_READ_UINT32_LE(data)        _GST_GET (data, 32, LE)
       
   326 /**
       
   327  * GST_READ_UINT16_BE:
       
   328  * @data: memory location
       
   329  *
       
   330  * Read a 16 bit unsigned integer value in big endian format from the memory buffer.
       
   331  */
       
   332 #define GST_READ_UINT16_BE(data)        _GST_GET (data, 16, BE)
       
   333 /**
       
   334  * GST_READ_UINT16_LE:
       
   335  * @data: memory location
       
   336  *
       
   337  * Read a 16 bit unsigned integer value in little endian format from the memory buffer.
       
   338  */
       
   339 #define GST_READ_UINT16_LE(data)        _GST_GET (data, 16, LE)
       
   340 /**
       
   341  * GST_READ_UINT8:
       
   342  * @data: memory location
       
   343  *
       
   344  * Read an 8 bit unsigned integer value from the memory buffer.
       
   345  */
       
   346 #define GST_READ_UINT8(data)		(* ((guint8 *) (data)))
       
   347 
       
   348 #define _GST_PUT(__data, __size, __end, __num) \
       
   349     ((* (guint##__size *) (__data)) = GUINT##__size##_TO_##__end (__num))
       
   350 
       
   351 /**
       
   352  * GST_WRITE_UINT64_BE:
       
   353  * @data: memory location
       
   354  * @num: value to store
       
   355  *
       
   356  * Store a 64 bit unsigned integer value in big endian format into the memory buffer.
       
   357  */
       
   358 #define GST_WRITE_UINT64_BE(data, num)	_GST_PUT(data, 64, BE, num)
       
   359 /**
       
   360  * GST_WRITE_UINT64_LE:
       
   361  * @data: memory location
       
   362  * @num: value to store
       
   363  *
       
   364  * Store a 64 bit unsigned integer value in little endian format into the memory buffer.
       
   365  */
       
   366 #define GST_WRITE_UINT64_LE(data, num)  _GST_PUT(data, 64, LE, num)
       
   367 /**
       
   368  * GST_WRITE_UINT32_BE:
       
   369  * @data: memory location
       
   370  * @num: value to store
       
   371  *
       
   372  * Store a 32 bit unsigned integer value in big endian format into the memory buffer.
       
   373  */
       
   374 #define GST_WRITE_UINT32_BE(data, num)  _GST_PUT(data, 32, BE, num)
       
   375 /**
       
   376  * GST_WRITE_UINT32_LE:
       
   377  * @data: memory location
       
   378  * @num: value to store
       
   379  *
       
   380  * Store a 32 bit unsigned integer value in little endian format into the memory buffer.
       
   381  */
       
   382 #define GST_WRITE_UINT32_LE(data, num)  _GST_PUT(data, 32, LE, num)
       
   383 /**
       
   384  * GST_WRITE_UINT16_BE:
       
   385  * @data: memory location
       
   386  * @num: value to store
       
   387  *
       
   388  * Store a 16 bit unsigned integer value in big endian format into the memory buffer.
       
   389  */
       
   390 #define GST_WRITE_UINT16_BE(data, num)  _GST_PUT(data, 16, BE, num)
       
   391 /**
       
   392  * GST_WRITE_UINT16_LE:
       
   393  * @data: memory location
       
   394  * @num: value to store
       
   395  *
       
   396  * Store a 16 bit unsigned integer value in little endian format into the memory buffer.
       
   397  */
       
   398 #define GST_WRITE_UINT16_LE(data, num)  _GST_PUT(data, 16, LE, num)
       
   399 /**
       
   400  * GST_WRITE_UINT8:
       
   401  * @data: memory location
       
   402  * @num: value to store
       
   403  *
       
   404  * Store an 8 bit unsigned integer value into the memory buffer.
       
   405  */
       
   406 #define GST_WRITE_UINT8(data, num)	((* (guint8 *) (data)) = (num))
       
   407 
       
   408 #else /* GST_HAVE_UNALIGNED_ACCESS */
       
   409 
       
   410 #define _GST_GET(__data, __idx, __size, __shift) \
       
   411     (((guint##__size) (((guint8 *) (__data))[__idx])) << __shift)
       
   412 
       
   413 #define GST_READ_UINT64_BE(data)	(_GST_GET (data, 0, 64, 56) | \
       
   414 					 _GST_GET (data, 1, 64, 48) | \
       
   415 					 _GST_GET (data, 2, 64, 40) | \
       
   416 					 _GST_GET (data, 3, 64, 32) | \
       
   417 					 _GST_GET (data, 4, 64, 24) | \
       
   418 					 _GST_GET (data, 5, 64, 16) | \
       
   419 					 _GST_GET (data, 6, 64,  8) | \
       
   420 					 _GST_GET (data, 7, 64,  0))
       
   421 
       
   422 #define GST_READ_UINT64_LE(data)	(_GST_GET (data, 7, 64, 56) | \
       
   423 					 _GST_GET (data, 6, 64, 48) | \
       
   424 					 _GST_GET (data, 5, 64, 40) | \
       
   425 					 _GST_GET (data, 4, 64, 32) | \
       
   426 					 _GST_GET (data, 3, 64, 24) | \
       
   427 					 _GST_GET (data, 2, 64, 16) | \
       
   428 					 _GST_GET (data, 1, 64,  8) | \
       
   429 					 _GST_GET (data, 0, 64,  0))
       
   430 
       
   431 #define GST_READ_UINT32_BE(data)	(_GST_GET (data, 0, 32, 24) | \
       
   432 					 _GST_GET (data, 1, 32, 16) | \
       
   433 					 _GST_GET (data, 2, 32,  8) | \
       
   434 					 _GST_GET (data, 3, 32,  0))
       
   435 
       
   436 #define GST_READ_UINT32_LE(data)	(_GST_GET (data, 3, 32, 24) | \
       
   437 					 _GST_GET (data, 2, 32, 16) | \
       
   438 					 _GST_GET (data, 1, 32,  8) | \
       
   439 					 _GST_GET (data, 0, 32,  0))
       
   440 
       
   441 #define GST_READ_UINT16_BE(data)	(_GST_GET (data, 0, 16,  8) | \
       
   442 					 _GST_GET (data, 1, 16,  0))
       
   443 
       
   444 #define GST_READ_UINT16_LE(data)	(_GST_GET (data, 1, 16,  8) | \
       
   445 					 _GST_GET (data, 0, 16,  0))
       
   446 
       
   447 #define GST_READ_UINT8(data)		(_GST_GET (data, 0,  8,  0))
       
   448 
       
   449 #define _GST_PUT(__data, __idx, __size, __shift, __num) \
       
   450     (((guint8 *) (__data))[__idx] = (((guint##__size) __num) >> __shift) & 0xff)
       
   451 
       
   452 #define GST_WRITE_UINT64_BE(data, num)	do { \
       
   453 					  _GST_PUT (data, 0, 64, 56, num); \
       
   454 					  _GST_PUT (data, 1, 64, 48, num); \
       
   455 					  _GST_PUT (data, 2, 64, 40, num); \
       
   456 					  _GST_PUT (data, 3, 64, 32, num); \
       
   457 					  _GST_PUT (data, 4, 64, 24, num); \
       
   458 					  _GST_PUT (data, 5, 64, 16, num); \
       
   459 					  _GST_PUT (data, 6, 64,  8, num); \
       
   460 					  _GST_PUT (data, 7, 64,  0, num); \
       
   461 					} while (0)
       
   462 
       
   463 #define GST_WRITE_UINT64_LE(data, num)	do { \
       
   464 					  _GST_PUT (data, 0, 64,  0, num); \
       
   465 					  _GST_PUT (data, 1, 64,  8, num); \
       
   466 					  _GST_PUT (data, 2, 64, 16, num); \
       
   467 					  _GST_PUT (data, 3, 64, 24, num); \
       
   468 					  _GST_PUT (data, 4, 64, 32, num); \
       
   469 					  _GST_PUT (data, 5, 64, 40, num); \
       
   470 					  _GST_PUT (data, 6, 64, 48, num); \
       
   471 					  _GST_PUT (data, 7, 64, 56, num); \
       
   472 					} while (0)
       
   473 
       
   474 #define GST_WRITE_UINT32_BE(data, num)	do { \
       
   475 					  _GST_PUT (data, 0, 32, 24, num); \
       
   476 					  _GST_PUT (data, 1, 32, 16, num); \
       
   477 					  _GST_PUT (data, 2, 32,  8, num); \
       
   478 					  _GST_PUT (data, 3, 32,  0, num); \
       
   479 					} while (0)
       
   480 
       
   481 #define GST_WRITE_UINT32_LE(data, num)	do { \
       
   482 					  _GST_PUT (data, 0, 32,  0, num); \
       
   483 					  _GST_PUT (data, 1, 32,  8, num); \
       
   484 					  _GST_PUT (data, 2, 32, 16, num); \
       
   485 					  _GST_PUT (data, 3, 32, 24, num); \
       
   486 					} while (0)
       
   487 
       
   488 #define GST_WRITE_UINT16_BE(data, num)	do { \
       
   489 					  _GST_PUT (data, 0, 16,  8, num); \
       
   490 					  _GST_PUT (data, 1, 16,  0, num); \
       
   491 					} while (0)
       
   492 
       
   493 #define GST_WRITE_UINT16_LE(data, num)	do { \
       
   494 					  _GST_PUT (data, 0, 16,  0, num); \
       
   495 					  _GST_PUT (data, 1, 16,  8, num); \
       
   496 					} while (0)
       
   497 
       
   498 #define GST_WRITE_UINT8(data, num)	do { \
       
   499 					  _GST_PUT (data, 0,  8,  0, num); \
       
   500 					} while (0)
       
   501 
       
   502 #endif /* GST_HAVE_UNALIGNED_ACCESS */
       
   503 
       
   504 
       
   505 /* Miscellaneous utility macros */
       
   506 
       
   507 /**
       
   508  * GST_ROUND_UP_2:
       
   509  * @num: integer value to round up
       
   510  *
       
   511  * Rounds an integer value up to the next multiple of 2.
       
   512  */
       
   513 #define GST_ROUND_UP_2(num)  (((num)+1)&~1)
       
   514 /**
       
   515  * GST_ROUND_UP_4:
       
   516  * @num: integer value to round up
       
   517  *
       
   518  * Rounds an integer value up to the next multiple of 4.
       
   519  */
       
   520 #define GST_ROUND_UP_4(num)  (((num)+3)&~3)
       
   521 /**
       
   522  * GST_ROUND_UP_8:
       
   523  * @num: integer value to round up
       
   524  *
       
   525  * Rounds an integer value up to the next multiple of 8.
       
   526  */
       
   527 #define GST_ROUND_UP_8(num)  (((num)+7)&~7)
       
   528 /**
       
   529  * GST_ROUND_UP_16:
       
   530  * @num: integer value to round up
       
   531  *
       
   532  * Rounds an integer value up to the next multiple of 16.
       
   533  */
       
   534 #define GST_ROUND_UP_16(num) (((num)+15)&~15)
       
   535 /**
       
   536  * GST_ROUND_UP_32:
       
   537  * @num: integer value to round up
       
   538  *
       
   539  * Rounds an integer value up to the next multiple of 32.
       
   540  */
       
   541 #define GST_ROUND_UP_32(num) (((num)+31)&~31)
       
   542 /**
       
   543  * GST_ROUND_UP_64:
       
   544  * @num: integer value to round up
       
   545  *
       
   546  * Rounds an integer value up to the next multiple of 64.
       
   547  */
       
   548 #define GST_ROUND_UP_64(num) (((num)+63)&~63)
       
   549 
       
   550 /**
       
   551  * GST_ROUND_DOWN_2:
       
   552  * @num: integer value to round down
       
   553  *
       
   554  * Rounds an integer value down to the next multiple of 2.
       
   555  *
       
   556  * Since: 0.10.12
       
   557  */
       
   558 #define GST_ROUND_DOWN_2(num)  ((num)&(~1))
       
   559 /**
       
   560  * GST_ROUND_DOWN_4:
       
   561  * @num: integer value to round down
       
   562  *
       
   563  * Rounds an integer value down to the next multiple of 4.
       
   564  *
       
   565  * Since: 0.10.12
       
   566  */
       
   567 #define GST_ROUND_DOWN_4(num)  ((num)&(~3))
       
   568 /**
       
   569  * GST_ROUND_DOWN_8:
       
   570  * @num: integer value to round down
       
   571  *
       
   572  * Rounds an integer value down to the next multiple of 8.
       
   573  *
       
   574  * Since: 0.10.12
       
   575  */
       
   576 #define GST_ROUND_DOWN_8(num)  ((num)&(~7))
       
   577 /**
       
   578  * GST_ROUND_DOWN_16:
       
   579  * @num: integer value to round down
       
   580  *
       
   581  * Rounds an integer value down to the next multiple of 16.
       
   582  *
       
   583  * Since: 0.10.12
       
   584  */
       
   585 #define GST_ROUND_DOWN_16(num) ((num)&(~15))
       
   586 /**
       
   587  * GST_ROUND_DOWN_32:
       
   588  * @num: integer value to round down
       
   589  *
       
   590  * Rounds an integer value down to the next multiple of 32.
       
   591  *
       
   592  * Since: 0.10.12
       
   593  */
       
   594 #define GST_ROUND_DOWN_32(num) ((num)&(~31))
       
   595 /**
       
   596  * GST_ROUND_DOWN_64:
       
   597  * @num: integer value to round down
       
   598  *
       
   599  * Rounds an integer value down to the next multiple of 64.
       
   600  *
       
   601  * Since: 0.10.12
       
   602  */
       
   603 #define GST_ROUND_DOWN_64(num) ((num)&(~63))
       
   604 
       
   605 void			gst_object_default_error	(GstObject * source,
       
   606 							 GError * error, gchar * debug);
       
   607 
       
   608 /* element functions */
       
   609 #ifdef __SYMBIAN32__
       
   610 IMPORT_C
       
   611 #endif
       
   612 
       
   613 void                    gst_element_create_all_pads     (GstElement *element);
       
   614 #ifdef __SYMBIAN32__
       
   615 IMPORT_C
       
   616 #endif
       
   617 
       
   618 GstPad*                 gst_element_get_compatible_pad  (GstElement *element, GstPad *pad,
       
   619 		                                         const GstCaps *caps);
       
   620 #ifdef __SYMBIAN32__
       
   621 IMPORT_C
       
   622 #endif
       
   623 
       
   624 
       
   625 GstPadTemplate*         gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *compattempl);
       
   626 #ifdef __SYMBIAN32__
       
   627 IMPORT_C
       
   628 #endif
       
   629 
       
   630 
       
   631 G_CONST_RETURN gchar*   gst_element_state_get_name      (GstState state);
       
   632 #ifdef __SYMBIAN32__
       
   633 IMPORT_C
       
   634 #endif
       
   635 
       
   636 G_CONST_RETURN gchar *  gst_element_state_change_return_get_name (GstStateChangeReturn state_ret);
       
   637 #ifdef __SYMBIAN32__
       
   638 IMPORT_C
       
   639 #endif
       
   640 
       
   641 
       
   642 gboolean		gst_element_link                (GstElement *src, GstElement *dest);
       
   643 #ifdef __SYMBIAN32__
       
   644 IMPORT_C
       
   645 #endif
       
   646 
       
   647 gboolean		gst_element_link_many           (GstElement *element_1,
       
   648 		                                         GstElement *element_2, ...) G_GNUC_NULL_TERMINATED;
       
   649 #ifdef __SYMBIAN32__
       
   650 IMPORT_C
       
   651 #endif
       
   652 
       
   653 gboolean		gst_element_link_filtered	(GstElement * src,
       
   654                                                          GstElement * dest,
       
   655                                                          GstCaps *filter);
       
   656 #ifdef __SYMBIAN32__
       
   657 IMPORT_C
       
   658 #endif
       
   659 
       
   660 void                    gst_element_unlink              (GstElement *src, GstElement *dest);
       
   661 #ifdef __SYMBIAN32__
       
   662 IMPORT_C
       
   663 #endif
       
   664 
       
   665 void                    gst_element_unlink_many         (GstElement *element_1,
       
   666 		                                         GstElement *element_2, ...) G_GNUC_NULL_TERMINATED;
       
   667 #ifdef __SYMBIAN32__
       
   668 IMPORT_C
       
   669 #endif
       
   670 
       
   671 
       
   672 gboolean		gst_element_link_pads           (GstElement *src, const gchar *srcpadname,
       
   673 		                                         GstElement *dest, const gchar *destpadname);
       
   674 #ifdef __SYMBIAN32__
       
   675 IMPORT_C
       
   676 #endif
       
   677 
       
   678 void                    gst_element_unlink_pads         (GstElement *src, const gchar *srcpadname,
       
   679 		                                         GstElement *dest, const gchar *destpadname);
       
   680 #ifdef __SYMBIAN32__
       
   681 IMPORT_C
       
   682 #endif
       
   683 
       
   684 
       
   685 gboolean		gst_element_link_pads_filtered	(GstElement * src, const gchar * srcpadname,
       
   686                                                          GstElement * dest, const gchar * destpadname,
       
   687                                                          GstCaps *filter);
       
   688 #ifdef __SYMBIAN32__
       
   689 IMPORT_C
       
   690 #endif
       
   691 
       
   692 
       
   693 gboolean        gst_element_seek_simple (GstElement   *element,
       
   694                                          GstFormat     format,
       
   695                                          GstSeekFlags  seek_flags,
       
   696                                          gint64        seek_pos);
       
   697 
       
   698 /* util elementfactory functions */
       
   699 #ifdef __SYMBIAN32__
       
   700 IMPORT_C
       
   701 #endif
       
   702 
       
   703 gboolean		gst_element_factory_can_src_caps(GstElementFactory *factory, const GstCaps *caps);
       
   704 #ifdef __SYMBIAN32__
       
   705 IMPORT_C
       
   706 #endif
       
   707 
       
   708 gboolean		gst_element_factory_can_sink_caps(GstElementFactory *factory, const GstCaps *caps);
       
   709 
       
   710 /* util query functions */
       
   711 #ifdef __SYMBIAN32__
       
   712 IMPORT_C
       
   713 #endif
       
   714 
       
   715 gboolean                gst_element_query_position      (GstElement *element, GstFormat *format,
       
   716 		                                         gint64 *cur);
       
   717 #ifdef __SYMBIAN32__
       
   718 IMPORT_C
       
   719 #endif
       
   720 
       
   721 gboolean                gst_element_query_duration      (GstElement *element, GstFormat *format,
       
   722 		                                         gint64 *duration);
       
   723 #ifdef __SYMBIAN32__
       
   724 IMPORT_C
       
   725 #endif
       
   726 
       
   727 gboolean                gst_element_query_convert       (GstElement *element, GstFormat src_format, gint64 src_val,
       
   728 		                                         GstFormat *dest_format, gint64 *dest_val);
       
   729 
       
   730 /* element class functions */
       
   731 #ifdef __SYMBIAN32__
       
   732 IMPORT_C
       
   733 #endif
       
   734 
       
   735 void			gst_element_class_install_std_props (GstElementClass * klass,
       
   736 							 const gchar * first_name, ...) G_GNUC_NULL_TERMINATED;
       
   737 
       
   738 /* pad functions */
       
   739 #ifdef __SYMBIAN32__
       
   740 IMPORT_C
       
   741 #endif
       
   742 
       
   743 gboolean                gst_pad_can_link                (GstPad *srcpad, GstPad *sinkpad);
       
   744 #ifdef __SYMBIAN32__
       
   745 IMPORT_C
       
   746 #endif
       
   747 
       
   748 
       
   749 void			gst_pad_use_fixed_caps		(GstPad *pad);
       
   750 #ifdef __SYMBIAN32__
       
   751 IMPORT_C
       
   752 #endif
       
   753 
       
   754 GstCaps*		gst_pad_get_fixed_caps_func	(GstPad *pad);
       
   755 #ifdef __SYMBIAN32__
       
   756 IMPORT_C
       
   757 #endif
       
   758 
       
   759 GstCaps*		gst_pad_proxy_getcaps		(GstPad * pad);
       
   760 #ifdef __SYMBIAN32__
       
   761 IMPORT_C
       
   762 #endif
       
   763 
       
   764 gboolean		gst_pad_proxy_setcaps		(GstPad * pad, GstCaps * caps);
       
   765 #ifdef __SYMBIAN32__
       
   766 IMPORT_C
       
   767 #endif
       
   768 
       
   769 
       
   770 GstElement*		gst_pad_get_parent_element	(GstPad *pad);
       
   771 
       
   772 /* util query functions */
       
   773 #ifdef __SYMBIAN32__
       
   774 IMPORT_C
       
   775 #endif
       
   776 
       
   777 gboolean                gst_pad_query_position          (GstPad *pad, GstFormat *format,
       
   778 		                                         gint64 *cur);
       
   779 #ifdef __SYMBIAN32__
       
   780 IMPORT_C
       
   781 #endif
       
   782 
       
   783 gboolean                gst_pad_query_duration          (GstPad *pad, GstFormat *format,
       
   784 		                                         gint64 *duration);
       
   785 #ifdef __SYMBIAN32__
       
   786 IMPORT_C
       
   787 #endif
       
   788 
       
   789 gboolean                gst_pad_query_convert           (GstPad *pad, GstFormat src_format, gint64 src_val,
       
   790 		                                         GstFormat *dest_format, gint64 *dest_val);
       
   791 #ifdef __SYMBIAN32__
       
   792 IMPORT_C
       
   793 #endif
       
   794 
       
   795 
       
   796 gboolean                gst_pad_query_peer_position     (GstPad *pad, GstFormat *format,
       
   797 		                                         gint64 *cur);
       
   798 #ifdef __SYMBIAN32__
       
   799 IMPORT_C
       
   800 #endif
       
   801 
       
   802 gboolean                gst_pad_query_peer_duration     (GstPad *pad, GstFormat *format,
       
   803 		                                         gint64 *duration);
       
   804 #ifdef __SYMBIAN32__
       
   805 IMPORT_C
       
   806 #endif
       
   807 
       
   808 gboolean                gst_pad_query_peer_convert      (GstPad *pad, GstFormat src_format, gint64 src_val,
       
   809 		                                         GstFormat *dest_format, gint64 *dest_val);
       
   810 
       
   811 /* bin functions */
       
   812 #ifdef __SYMBIAN32__
       
   813 IMPORT_C
       
   814 #endif
       
   815 
       
   816 void                    gst_bin_add_many                (GstBin *bin, GstElement *element_1, ...) G_GNUC_NULL_TERMINATED;
       
   817 #ifdef __SYMBIAN32__
       
   818 IMPORT_C
       
   819 #endif
       
   820 
       
   821 void                    gst_bin_remove_many             (GstBin *bin, GstElement *element_1, ...) G_GNUC_NULL_TERMINATED;
       
   822 #ifdef __SYMBIAN32__
       
   823 IMPORT_C
       
   824 #endif
       
   825 
       
   826 GstPad *                gst_bin_find_unconnected_pad    (GstBin *bin, GstPadDirection direction);
       
   827 
       
   828 /* buffer functions */
       
   829 #ifdef __SYMBIAN32__
       
   830 IMPORT_C
       
   831 #endif
       
   832 
       
   833 GstBuffer *		gst_buffer_merge		(GstBuffer * buf1, GstBuffer * buf2);
       
   834 #ifdef __SYMBIAN32__
       
   835 IMPORT_C
       
   836 #endif
       
   837 
       
   838 GstBuffer *		gst_buffer_join			(GstBuffer * buf1, GstBuffer * buf2);
       
   839 #ifndef GST_DISABLE_DEPRECATED
       
   840 void			gst_buffer_stamp		(GstBuffer * dest, const GstBuffer * src);
       
   841 #endif /* GST_DISABLE_DEPRECATED */
       
   842 
       
   843 /* atomic functions */
       
   844 #ifdef __SYMBIAN32__
       
   845 IMPORT_C
       
   846 #endif
       
   847 
       
   848 void                    gst_atomic_int_set              (gint * atomic_int, gint value);
       
   849 
       
   850 /* probes */
       
   851 #ifdef __SYMBIAN32__
       
   852 IMPORT_C
       
   853 #endif
       
   854 
       
   855 gulong			gst_pad_add_data_probe		(GstPad * pad,
       
   856 							 GCallback handler,
       
   857 							 gpointer data);
       
   858 #ifdef __SYMBIAN32__
       
   859 IMPORT_C
       
   860 #endif
       
   861 
       
   862 void			gst_pad_remove_data_probe	(GstPad * pad, guint handler_id);
       
   863 #ifdef __SYMBIAN32__
       
   864 IMPORT_C
       
   865 #endif
       
   866 
       
   867 gulong			gst_pad_add_event_probe		(GstPad * pad,
       
   868 							 GCallback handler,
       
   869 							 gpointer data);
       
   870 #ifdef __SYMBIAN32__
       
   871 IMPORT_C
       
   872 #endif
       
   873 
       
   874 void			gst_pad_remove_event_probe	(GstPad * pad, guint handler_id);
       
   875 #ifdef __SYMBIAN32__
       
   876 IMPORT_C
       
   877 #endif
       
   878 
       
   879 gulong			gst_pad_add_buffer_probe	(GstPad * pad,
       
   880 							 GCallback handler,
       
   881 							 gpointer data);
       
   882 #ifdef __SYMBIAN32__
       
   883 IMPORT_C
       
   884 #endif
       
   885 
       
   886 void			gst_pad_remove_buffer_probe	(GstPad * pad, guint handler_id);
       
   887 
       
   888 /* tag emission utility functions */
       
   889 #ifdef __SYMBIAN32__
       
   890 IMPORT_C
       
   891 #endif
       
   892 
       
   893 void			gst_element_found_tags_for_pad	(GstElement * element,
       
   894 							 GstPad * pad,
       
   895 							 GstTagList * list);
       
   896 #ifdef __SYMBIAN32__
       
   897 IMPORT_C
       
   898 #endif
       
   899 
       
   900 void			gst_element_found_tags		(GstElement * element,
       
   901 							 GstTagList * list);
       
   902 
       
   903 /* parse utility functions */
       
   904 #ifdef __SYMBIAN32__
       
   905 IMPORT_C
       
   906 #endif
       
   907 
       
   908 GstElement *            gst_parse_bin_from_description  (const gchar * bin_description,
       
   909                                                          gboolean ghost_unconnected_pads,
       
   910                                                          GError ** err);
       
   911 #ifdef __SYMBIAN32__
       
   912 IMPORT_C
       
   913 #endif
       
   914 
       
   915 
       
   916 GstClockTime gst_util_get_timestamp (void);
       
   917 
       
   918 G_END_DECLS
       
   919 
       
   920 #endif /* __GST_UTILS_H__ */