2000-12-28 22:12:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
|
|
|
* gstutils.h: Header for various utility functions
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GST_UTILS_H__
|
|
|
|
#define __GST_UTILS_H__
|
|
|
|
|
2001-06-25 01:20:11 +00:00
|
|
|
#include <glib.h>
|
2005-03-07 18:27:42 +00:00
|
|
|
#include <gst/gstbin.h>
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2002-07-08 19:07:30 +00:00
|
|
|
G_BEGIN_DECLS
|
2001-02-25 03:42:51 +00:00
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
void gst_util_set_value_from_string (GValue *value, const gchar *value_str);
|
2005-09-12 18:14:03 +00:00
|
|
|
void gst_util_set_object_arg (GObject *object, const gchar *name, const gchar *value);
|
|
|
|
void gst_util_dump_mem (const guchar *mem, guint size);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-10-10 18:16:37 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
guint64 gst_gdouble_to_guint64 (gdouble value);
|
|
|
|
gdouble gst_guint64_to_gdouble (guint64 value);
|
|
|
|
#else
|
|
|
|
#define gst_gdouble_to_guint64(value) ((guint64) (value))
|
|
|
|
#define gst_guint64_to_gdouble(value) ((gdouble) (value))
|
|
|
|
#endif
|
|
|
|
|
2005-08-29 16:10:36 +00:00
|
|
|
guint64 gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom);
|
|
|
|
|
2005-11-23 13:22:21 +00:00
|
|
|
guint64 gst_util_uint64_scale_int (guint64 val, gint num, gint denom);
|
2005-11-22 15:15:53 +00:00
|
|
|
|
2005-09-12 18:14:03 +00:00
|
|
|
void gst_print_pad_caps (GString *buf, gint indent, GstPad *pad);
|
|
|
|
void gst_print_element_args (GString *buf, gint indent, GstElement *element);
|
2001-09-17 23:44:58 +00:00
|
|
|
|
2004-01-08 04:10:18 +00:00
|
|
|
|
2005-08-24 11:22:32 +00:00
|
|
|
/* Macros for defining classes. Ideas taken from Bonobo, which took theirs
|
2004-01-08 04:10:18 +00:00
|
|
|
from Nautilus and GOB. */
|
|
|
|
|
2005-09-27 20:40:35 +00:00
|
|
|
/**
|
|
|
|
* GST_BOILERPLATE_FULL:
|
|
|
|
* @type: the name of the type struct
|
|
|
|
* @type_as_function: the prefix for the functions
|
|
|
|
* @parent_type: the parent type struct name
|
|
|
|
* @parent_type_macro: the parent type macro
|
2005-10-15 15:30:24 +00:00
|
|
|
* @additional_initializations: function pointer in the form of
|
2005-09-27 20:40:35 +00:00
|
|
|
* void additional_initializations (GType type) that can be used for
|
|
|
|
* initializing interfaces and the like
|
|
|
|
*
|
|
|
|
* Define the boilerplate type stuff to reduce typos and code size. Defines
|
|
|
|
* the get_type method and the parent_class static variable.
|
|
|
|
*
|
|
|
|
* <informalexample>
|
|
|
|
* <programlisting>
|
|
|
|
* GST_BOILERPLATE_FULL (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT, _do_init);
|
|
|
|
* </programlisting>
|
|
|
|
* </informalexample>
|
|
|
|
*/
|
2005-08-24 11:22:32 +00:00
|
|
|
#define GST_BOILERPLATE_FULL(type, type_as_function, parent_type, parent_type_macro, additional_initializations) \
|
|
|
|
\
|
|
|
|
static void type_as_function ## _base_init (gpointer g_class); \
|
|
|
|
static void type_as_function ## _class_init (type ## Class *g_class);\
|
2005-08-28 17:45:58 +00:00
|
|
|
static void type_as_function ## _init (type *object, \
|
|
|
|
type ## Class *g_class);\
|
2005-08-24 11:22:32 +00:00
|
|
|
static parent_type ## Class *parent_class = NULL; \
|
|
|
|
static void \
|
|
|
|
type_as_function ## _class_init_trampoline (gpointer g_class, \
|
|
|
|
gpointer data) \
|
|
|
|
{ \
|
|
|
|
parent_class = (parent_type ## Class *) \
|
|
|
|
g_type_class_peek_parent (g_class); \
|
|
|
|
type_as_function ## _class_init ((type ## Class *)g_class); \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
GType \
|
|
|
|
type_as_function ## _get_type (void) \
|
|
|
|
{ \
|
|
|
|
static GType object_type = 0; \
|
|
|
|
if (object_type == 0) { \
|
|
|
|
static const GTypeInfo object_info = { \
|
|
|
|
sizeof (type ## Class), \
|
|
|
|
type_as_function ## _base_init, \
|
|
|
|
NULL, /* base_finalize */ \
|
|
|
|
type_as_function ## _class_init_trampoline, \
|
|
|
|
NULL, /* class_finalize */ \
|
|
|
|
NULL, /* class_data */ \
|
|
|
|
sizeof (type), \
|
|
|
|
0, /* n_preallocs */ \
|
|
|
|
(GInstanceInitFunc) type_as_function ## _init \
|
|
|
|
}; \
|
|
|
|
object_type = g_type_register_static (parent_type_macro, #type, \
|
|
|
|
&object_info, (GTypeFlags) 0); \
|
|
|
|
additional_initializations (object_type); \
|
|
|
|
} \
|
|
|
|
return object_type; \
|
2004-01-08 04:10:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define __GST_DO_NOTHING(type) /* NOP */
|
2005-09-27 20:40:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_BOILERPLATE:
|
|
|
|
* @type: the name of the type struct
|
|
|
|
* @type_as_function: the prefix for the functions
|
|
|
|
* @parent_type: the parent type struct name
|
|
|
|
* @parent_type_macro: the parent type macro
|
|
|
|
*
|
|
|
|
* Define the boilerplate type stuff to reduce typos and code size. Defines
|
|
|
|
* the get_type method and the parent_class static variable.
|
|
|
|
*
|
|
|
|
* <informalexample>
|
|
|
|
* <programlisting>
|
|
|
|
* GST_BOILERPLATE (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT);
|
|
|
|
* </programlisting>
|
|
|
|
* </informalexample>
|
|
|
|
*/
|
2004-01-08 04:10:18 +00:00
|
|
|
#define GST_BOILERPLATE(type,type_as_function,parent_type,parent_type_macro) \
|
|
|
|
GST_BOILERPLATE_FULL (type, type_as_function, parent_type, parent_type_macro, \
|
|
|
|
__GST_DO_NOTHING)
|
|
|
|
|
2005-08-22 15:12:56 +00:00
|
|
|
/* Like GST_BOILERPLATE, but makes the type 1) implement an interface, and 2)
|
|
|
|
* implement GstImplementsInterface for that type
|
|
|
|
*
|
|
|
|
* After this you will need to implement interface_as_function ## _supported
|
|
|
|
* and interface_as_function ## _interface_init
|
|
|
|
*/
|
2005-09-27 20:40:35 +00:00
|
|
|
/**
|
|
|
|
* GST_BOILERPLATE_WITH_INTERFACE:
|
|
|
|
* @type: the name of the type struct
|
|
|
|
* @type_as_function: the prefix for the functions
|
|
|
|
* @parent_type: the parent type struct name
|
|
|
|
* @parent_type_as_macro: the parent type macro
|
|
|
|
* @interface_type: the name of the interface type struct
|
|
|
|
* @interface_type_as_macro: the interface type macro
|
|
|
|
* @interface_as_function: the interface function name prefix
|
|
|
|
*
|
|
|
|
* Like GST_BOILERPLATE, but makes the type 1) implement an interface, and 2)
|
|
|
|
* implement GstImplementsInterface for that type.
|
|
|
|
*
|
|
|
|
* After this you will need to implement interface_as_function ## _supported
|
|
|
|
* and interface_as_function ## _interface_init
|
|
|
|
*/
|
2005-09-12 18:14:03 +00:00
|
|
|
#define GST_BOILERPLATE_WITH_INTERFACE(type, type_as_function, \
|
|
|
|
parent_type, parent_type_as_macro, interface_type, \
|
|
|
|
interface_type_as_macro, interface_as_function) \
|
|
|
|
\
|
2005-08-22 15:12:56 +00:00
|
|
|
static void interface_as_function ## _interface_init (interface_type ## Class *klass); \
|
|
|
|
static gboolean interface_as_function ## _supported (type *object, GType iface_type); \
|
2005-09-12 18:14:03 +00:00
|
|
|
\
|
|
|
|
static void \
|
2005-08-22 15:12:56 +00:00
|
|
|
type_as_function ## _implements_interface_init (GstImplementsInterfaceClass *klass) \
|
2005-09-12 18:14:03 +00:00
|
|
|
{ \
|
|
|
|
klass->supported = (gpointer)interface_as_function ## _supported; \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
static void \
|
|
|
|
type_as_function ## _init_interfaces (GType type) \
|
|
|
|
{ \
|
|
|
|
static const GInterfaceInfo implements_iface_info = { \
|
|
|
|
(GInterfaceInitFunc) type_as_function ## _implements_interface_init,\
|
|
|
|
NULL, \
|
|
|
|
NULL, \
|
|
|
|
}; \
|
|
|
|
static const GInterfaceInfo iface_info = { \
|
|
|
|
(GInterfaceInitFunc) interface_as_function ## _interface_init, \
|
|
|
|
NULL, \
|
|
|
|
NULL, \
|
|
|
|
}; \
|
|
|
|
\
|
|
|
|
g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, \
|
|
|
|
&implements_iface_info); \
|
|
|
|
g_type_add_interface_static (type, interface_type_as_macro, \
|
|
|
|
&iface_info); \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
GST_BOILERPLATE_FULL (type, type_as_function, parent_type, \
|
2005-08-22 15:12:56 +00:00
|
|
|
parent_type_as_macro, type_as_function ## _init_interfaces)
|
|
|
|
|
2005-11-04 20:12:01 +00:00
|
|
|
/**
|
|
|
|
* GST_CALL_PARENT:
|
|
|
|
* @parent_class_cast: the name of the class cast macro for the parent type
|
|
|
|
* @name: name of the function to call
|
|
|
|
* @args: arguments enclosed in '( )'
|
|
|
|
*
|
|
|
|
* Just call the parent handler. This assumes that there is a variable
|
2004-01-08 04:10:18 +00:00
|
|
|
* named parent_class that points to the (duh!) parent class. Note that
|
|
|
|
* this macro is not to be used with things that return something, use
|
2005-11-04 20:12:01 +00:00
|
|
|
* the _WITH_DEFAULT version for that
|
|
|
|
*/
|
2005-09-12 18:14:03 +00:00
|
|
|
#define GST_CALL_PARENT(parent_class_cast, name, args) \
|
|
|
|
((parent_class_cast(parent_class)->name != NULL) ? \
|
2004-01-08 04:10:18 +00:00
|
|
|
parent_class_cast(parent_class)->name args : (void) 0)
|
|
|
|
|
2005-11-04 20:12:01 +00:00
|
|
|
/**
|
|
|
|
* GST_CALL_PARENT_WITH_DEFAULT:
|
|
|
|
* @parent_class_cast: the name of the class cast macro for the parent type
|
|
|
|
* @name: name of the function to call
|
|
|
|
* @args: arguments enclosed in '( )'
|
|
|
|
* @def_return: default result
|
|
|
|
*
|
|
|
|
* Same as GST_CALL_PARENT(), but in case there is no implementation, it
|
|
|
|
* evaluates to @def_return.
|
|
|
|
*/
|
|
|
|
#define GST_CALL_PARENT_WITH_DEFAULT(parent_class_cast, name, args, def_return)\
|
2005-09-12 18:14:03 +00:00
|
|
|
((parent_class_cast(parent_class)->name != NULL) ? \
|
2004-01-08 04:10:18 +00:00
|
|
|
parent_class_cast(parent_class)->name args : def_return)
|
|
|
|
|
2004-04-20 00:17:26 +00:00
|
|
|
/* Define possibly unaligned memory access method whether the type of
|
|
|
|
* architecture. */
|
|
|
|
#if GST_HAVE_UNALIGNED_ACCESS
|
|
|
|
|
|
|
|
#define _GST_GET(__data, __size, __end) \
|
|
|
|
(GUINT##__size##_FROM_##__end (* ((guint##__size *) (__data))))
|
|
|
|
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_READ_UINT64_BE:
|
|
|
|
* @data: memory location
|
|
|
|
*
|
|
|
|
* Read a 64 bit unsigned integer value in big endian format from the memory buffer.
|
|
|
|
*/
|
2004-04-20 00:17:26 +00:00
|
|
|
#define GST_READ_UINT64_BE(data) _GST_GET (data, 64, BE)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_READ_UINT64_LE:
|
|
|
|
* @data: memory location
|
|
|
|
*
|
|
|
|
* Read a 64 bit unsigned integer value in little endian format from the memory buffer.
|
|
|
|
*/
|
2004-04-20 00:17:26 +00:00
|
|
|
#define GST_READ_UINT64_LE(data) _GST_GET (data, 64, LE)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_READ_UINT32_BE:
|
|
|
|
* @data: memory location
|
|
|
|
*
|
|
|
|
* Read a 32 bit unsigned integer value in big endian format from the memory buffer.
|
|
|
|
*/
|
2004-04-20 00:17:26 +00:00
|
|
|
#define GST_READ_UINT32_BE(data) _GST_GET (data, 32, BE)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_READ_UINT32_LE:
|
|
|
|
* @data: memory location
|
|
|
|
*
|
|
|
|
* Read a 32 bit unsigned integer value in little endian format from the memory buffer.
|
|
|
|
*/
|
2004-04-20 00:17:26 +00:00
|
|
|
#define GST_READ_UINT32_LE(data) _GST_GET (data, 32, LE)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_READ_UINT16_BE:
|
|
|
|
* @data: memory location
|
|
|
|
*
|
|
|
|
* Read a 16 bit unsigned integer value in big endian format from the memory buffer.
|
|
|
|
*/
|
2004-04-20 00:17:26 +00:00
|
|
|
#define GST_READ_UINT16_BE(data) _GST_GET (data, 16, BE)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_READ_UINT16_LE:
|
|
|
|
* @data: memory location
|
|
|
|
*
|
|
|
|
* Read a 16 bit unsigned integer value in little endian format from the memory buffer.
|
|
|
|
*/
|
2004-04-20 00:17:26 +00:00
|
|
|
#define GST_READ_UINT16_LE(data) _GST_GET (data, 16, LE)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_READ_UINT8:
|
|
|
|
* @data: memory location
|
|
|
|
*
|
|
|
|
* Read an 8 bit unsigned integer value from the memory buffer.
|
|
|
|
*/
|
2005-09-12 18:14:03 +00:00
|
|
|
#define GST_READ_UINT8(data) (* ((guint8 *) (data)))
|
2004-04-20 00:17:26 +00:00
|
|
|
|
|
|
|
#define _GST_PUT(__data, __size, __end, __num) \
|
|
|
|
((* (guint##__size *) (__data)) = GUINT##__size##_TO_##__end (__num))
|
|
|
|
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_WRITE_UINT64_BE:
|
|
|
|
* @data: memory location
|
|
|
|
* @num: value to store
|
|
|
|
*
|
|
|
|
* Store a 64 bit unsigned integer value in big endian format into the memory buffer.
|
|
|
|
*/
|
2004-04-20 00:17:26 +00:00
|
|
|
#define GST_WRITE_UINT64_BE(data, num) _GST_PUT(data, 64, BE, num)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_WRITE_UINT64_LE:
|
|
|
|
* @data: memory location
|
|
|
|
* @num: value to store
|
|
|
|
*
|
|
|
|
* Store a 64 bit unsigned integer value in little endian format into the memory buffer.
|
|
|
|
*/
|
2004-04-20 00:17:26 +00:00
|
|
|
#define GST_WRITE_UINT64_LE(data, num) _GST_PUT(data, 64, LE, num)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_WRITE_UINT32_BE:
|
|
|
|
* @data: memory location
|
|
|
|
* @num: value to store
|
|
|
|
*
|
|
|
|
* Store a 32 bit unsigned integer value in big endian format into the memory buffer.
|
|
|
|
*/
|
2004-04-20 00:17:26 +00:00
|
|
|
#define GST_WRITE_UINT32_BE(data, num) _GST_PUT(data, 32, BE, num)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_WRITE_UINT32_LE:
|
|
|
|
* @data: memory location
|
|
|
|
* @num: value to store
|
|
|
|
*
|
|
|
|
* Store a 32 bit unsigned integer value in little endian format into the memory buffer.
|
|
|
|
*/
|
2004-04-20 00:17:26 +00:00
|
|
|
#define GST_WRITE_UINT32_LE(data, num) _GST_PUT(data, 32, LE, num)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_WRITE_UINT16_BE:
|
|
|
|
* @data: memory location
|
|
|
|
* @num: value to store
|
|
|
|
*
|
|
|
|
* Store a 16 bit unsigned integer value in big endian format into the memory buffer.
|
|
|
|
*/
|
2004-04-20 00:17:26 +00:00
|
|
|
#define GST_WRITE_UINT16_BE(data, num) _GST_PUT(data, 16, BE, num)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_WRITE_UINT16_LE:
|
|
|
|
* @data: memory location
|
|
|
|
* @num: value to store
|
|
|
|
*
|
|
|
|
* Store a 16 bit unsigned integer value in little endian format into the memory buffer.
|
|
|
|
*/
|
2004-04-20 00:17:26 +00:00
|
|
|
#define GST_WRITE_UINT16_LE(data, num) _GST_PUT(data, 16, LE, num)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_WRITE_UINT8:
|
|
|
|
* @data: memory location
|
|
|
|
* @num: value to store
|
|
|
|
*
|
|
|
|
* Store an 8 bit unsigned integer value into the memory buffer.
|
|
|
|
*/
|
2005-09-12 18:14:03 +00:00
|
|
|
#define GST_WRITE_UINT8(data, num) ((* (guint8 *) (data)) = (num))
|
2004-04-20 00:17:26 +00:00
|
|
|
|
|
|
|
#else /* GST_HAVE_UNALIGNED_ACCESS */
|
|
|
|
|
|
|
|
#define _GST_GET(__data, __idx, __size, __shift) \
|
|
|
|
(((guint##__size) (((guint8 *) (__data))[__idx])) << __shift)
|
|
|
|
|
|
|
|
#define GST_READ_UINT64_BE(data) (_GST_GET (data, 0, 64, 56) | \
|
|
|
|
_GST_GET (data, 1, 64, 48) | \
|
|
|
|
_GST_GET (data, 2, 64, 40) | \
|
|
|
|
_GST_GET (data, 3, 64, 32) | \
|
|
|
|
_GST_GET (data, 4, 64, 24) | \
|
|
|
|
_GST_GET (data, 5, 64, 16) | \
|
|
|
|
_GST_GET (data, 6, 64, 8) | \
|
|
|
|
_GST_GET (data, 7, 64, 0))
|
|
|
|
|
|
|
|
#define GST_READ_UINT64_LE(data) (_GST_GET (data, 7, 64, 56) | \
|
|
|
|
_GST_GET (data, 6, 64, 48) | \
|
|
|
|
_GST_GET (data, 5, 64, 40) | \
|
|
|
|
_GST_GET (data, 4, 64, 32) | \
|
|
|
|
_GST_GET (data, 3, 64, 24) | \
|
|
|
|
_GST_GET (data, 2, 64, 16) | \
|
|
|
|
_GST_GET (data, 1, 64, 8) | \
|
|
|
|
_GST_GET (data, 0, 64, 0))
|
|
|
|
|
|
|
|
#define GST_READ_UINT32_BE(data) (_GST_GET (data, 0, 32, 24) | \
|
|
|
|
_GST_GET (data, 1, 32, 16) | \
|
|
|
|
_GST_GET (data, 2, 32, 8) | \
|
|
|
|
_GST_GET (data, 3, 32, 0))
|
|
|
|
|
|
|
|
#define GST_READ_UINT32_LE(data) (_GST_GET (data, 3, 32, 24) | \
|
|
|
|
_GST_GET (data, 2, 32, 16) | \
|
|
|
|
_GST_GET (data, 1, 32, 8) | \
|
|
|
|
_GST_GET (data, 0, 32, 0))
|
|
|
|
|
|
|
|
#define GST_READ_UINT16_BE(data) (_GST_GET (data, 0, 16, 8) | \
|
|
|
|
_GST_GET (data, 1, 16, 0))
|
|
|
|
|
|
|
|
#define GST_READ_UINT16_LE(data) (_GST_GET (data, 1, 16, 8) | \
|
|
|
|
_GST_GET (data, 0, 16, 0))
|
|
|
|
|
|
|
|
#define GST_READ_UINT8(data) (_GST_GET (data, 0, 8, 0))
|
|
|
|
|
|
|
|
#define _GST_PUT(__data, __idx, __size, __shift, __num) \
|
2004-05-20 14:01:45 +00:00
|
|
|
(((guint8 *) (__data))[__idx] = (((guint##__size) __num) >> __shift) & 0xff)
|
2004-04-20 00:17:26 +00:00
|
|
|
|
|
|
|
#define GST_WRITE_UINT64_BE(data, num) do { \
|
|
|
|
_GST_PUT (data, 0, 64, 56, num); \
|
|
|
|
_GST_PUT (data, 1, 64, 48, num); \
|
|
|
|
_GST_PUT (data, 2, 64, 40, num); \
|
|
|
|
_GST_PUT (data, 3, 64, 32, num); \
|
|
|
|
_GST_PUT (data, 4, 64, 24, num); \
|
|
|
|
_GST_PUT (data, 5, 64, 16, num); \
|
|
|
|
_GST_PUT (data, 6, 64, 8, num); \
|
|
|
|
_GST_PUT (data, 7, 64, 0, num); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define GST_WRITE_UINT64_LE(data, num) do { \
|
|
|
|
_GST_PUT (data, 0, 64, 0, num); \
|
|
|
|
_GST_PUT (data, 1, 64, 8, num); \
|
|
|
|
_GST_PUT (data, 2, 64, 16, num); \
|
|
|
|
_GST_PUT (data, 3, 64, 24, num); \
|
|
|
|
_GST_PUT (data, 4, 64, 32, num); \
|
|
|
|
_GST_PUT (data, 5, 64, 40, num); \
|
|
|
|
_GST_PUT (data, 6, 64, 48, num); \
|
|
|
|
_GST_PUT (data, 7, 64, 56, num); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define GST_WRITE_UINT32_BE(data, num) do { \
|
|
|
|
_GST_PUT (data, 0, 32, 24, num); \
|
|
|
|
_GST_PUT (data, 1, 32, 16, num); \
|
|
|
|
_GST_PUT (data, 2, 32, 8, num); \
|
|
|
|
_GST_PUT (data, 3, 32, 0, num); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define GST_WRITE_UINT32_LE(data, num) do { \
|
|
|
|
_GST_PUT (data, 0, 32, 0, num); \
|
|
|
|
_GST_PUT (data, 1, 32, 8, num); \
|
|
|
|
_GST_PUT (data, 2, 32, 16, num); \
|
|
|
|
_GST_PUT (data, 3, 32, 24, num); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define GST_WRITE_UINT16_BE(data, num) do { \
|
|
|
|
_GST_PUT (data, 0, 16, 8, num); \
|
|
|
|
_GST_PUT (data, 1, 16, 0, num); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define GST_WRITE_UINT16_LE(data, num) do { \
|
|
|
|
_GST_PUT (data, 0, 16, 0, num); \
|
|
|
|
_GST_PUT (data, 1, 16, 8, num); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define GST_WRITE_UINT8(data, num) do { \
|
|
|
|
_GST_PUT (data, 0, 8, 0, num); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#endif /* GST_HAVE_UNALIGNED_ACCESS */
|
2004-01-08 04:10:18 +00:00
|
|
|
|
2005-08-09 16:25:45 +00:00
|
|
|
|
|
|
|
/* Miscellaneous utility macros */
|
2005-10-08 14:48:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_ROUND_UP_2:
|
|
|
|
* @num: value round up
|
|
|
|
*
|
|
|
|
* Make number divideable by two without a rest.
|
|
|
|
*/
|
2005-08-09 16:25:45 +00:00
|
|
|
#define GST_ROUND_UP_2(num) (((num)+1)&~1)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_ROUND_UP_4:
|
|
|
|
* @num: value round up
|
|
|
|
*
|
|
|
|
* Make number divideable by four without a rest.
|
|
|
|
*/
|
2005-08-09 16:25:45 +00:00
|
|
|
#define GST_ROUND_UP_4(num) (((num)+3)&~3)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_ROUND_UP_8:
|
|
|
|
* @num: value round up
|
|
|
|
*
|
|
|
|
* Make number divideable by eight without a rest.
|
|
|
|
*/
|
2005-08-09 16:25:45 +00:00
|
|
|
#define GST_ROUND_UP_8(num) (((num)+7)&~7)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_ROUND_UP_16:
|
|
|
|
* @num: value round up
|
|
|
|
*
|
|
|
|
* Make number divideable by 16 without a rest.
|
|
|
|
*/
|
2005-08-09 16:25:45 +00:00
|
|
|
#define GST_ROUND_UP_16(num) (((num)+15)&~15)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_ROUND_UP_32:
|
|
|
|
* @num: value round up
|
|
|
|
*
|
|
|
|
* Make number divideable by 32 without a rest.
|
|
|
|
*/
|
2005-08-09 16:25:45 +00:00
|
|
|
#define GST_ROUND_UP_32(num) (((num)+31)&~31)
|
2005-10-08 14:48:17 +00:00
|
|
|
/**
|
|
|
|
* GST_ROUND_UP_64:
|
|
|
|
* @num: value round up
|
|
|
|
*
|
|
|
|
* Make number divideable by 64 without a rest.
|
|
|
|
*/
|
2005-08-09 16:25:45 +00:00
|
|
|
#define GST_ROUND_UP_64(num) (((num)+63)&~63)
|
|
|
|
|
2005-09-12 18:14:03 +00:00
|
|
|
void gst_object_default_error (GstObject * source,
|
2005-03-07 18:27:42 +00:00
|
|
|
GError * error, gchar * debug);
|
|
|
|
|
|
|
|
/* element functions */
|
2005-04-23 23:29:47 +00:00
|
|
|
void gst_element_create_all_pads (GstElement *element);
|
2005-04-24 21:16:45 +00:00
|
|
|
GstPad* gst_element_get_compatible_pad (GstElement *element, GstPad *pad,
|
|
|
|
const GstCaps *caps);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
GstPadTemplate* gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *compattempl);
|
|
|
|
|
2005-09-02 15:42:00 +00:00
|
|
|
G_CONST_RETURN gchar* gst_element_state_get_name (GstState state);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
gboolean gst_element_link (GstElement *src, GstElement *dest);
|
|
|
|
gboolean gst_element_link_many (GstElement *element_1,
|
2005-11-21 18:41:39 +00:00
|
|
|
GstElement *element_2, ...) G_GNUC_NULL_TERMINATED;
|
2005-08-31 15:27:55 +00:00
|
|
|
gboolean gst_element_link_filtered (GstElement * src,
|
|
|
|
GstElement * dest,
|
|
|
|
GstCaps *filter);
|
2005-03-07 18:27:42 +00:00
|
|
|
void gst_element_unlink (GstElement *src, GstElement *dest);
|
|
|
|
void gst_element_unlink_many (GstElement *element_1,
|
2005-11-21 18:41:39 +00:00
|
|
|
GstElement *element_2, ...) G_GNUC_NULL_TERMINATED;
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
gboolean gst_element_link_pads (GstElement *src, const gchar *srcpadname,
|
|
|
|
GstElement *dest, const gchar *destpadname);
|
|
|
|
void gst_element_unlink_pads (GstElement *src, const gchar *srcpadname,
|
|
|
|
GstElement *dest, const gchar *destpadname);
|
2005-06-29 15:17:25 +00:00
|
|
|
|
2005-07-13 16:26:07 +00:00
|
|
|
gboolean gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
|
|
|
|
GstElement * dest, const gchar * destpadname,
|
|
|
|
GstCaps *filter);
|
2005-06-29 15:17:25 +00:00
|
|
|
/* util elementfactory functions */
|
|
|
|
gboolean gst_element_factory_can_src_caps(GstElementFactory *factory, const GstCaps *caps);
|
|
|
|
gboolean gst_element_factory_can_sink_caps(GstElementFactory *factory, const GstCaps *caps);
|
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
/* util query functions */
|
|
|
|
gboolean gst_element_query_position (GstElement *element, GstFormat *format,
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
gint64 *cur);
|
|
|
|
gboolean gst_element_query_duration (GstElement *element, GstFormat *format,
|
|
|
|
gint64 *duration);
|
2005-05-09 10:53:13 +00:00
|
|
|
gboolean gst_element_query_convert (GstElement *element, GstFormat src_format, gint64 src_val,
|
2005-10-20 19:47:07 +00:00
|
|
|
GstFormat *dest_format, gint64 *dest_val);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
/* element class functions */
|
2005-09-12 18:14:03 +00:00
|
|
|
void gst_element_class_install_std_props (GstElementClass * klass,
|
2005-11-21 18:41:39 +00:00
|
|
|
const gchar * first_name, ...) G_GNUC_NULL_TERMINATED;
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
/* pad functions */
|
|
|
|
gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad);
|
|
|
|
|
|
|
|
void gst_pad_use_fixed_caps (GstPad *pad);
|
|
|
|
GstCaps* gst_pad_get_fixed_caps_func (GstPad *pad);
|
|
|
|
GstCaps* gst_pad_proxy_getcaps (GstPad * pad);
|
|
|
|
gboolean gst_pad_proxy_setcaps (GstPad * pad, GstCaps * caps);
|
|
|
|
|
docs/design/: Some more docs in the works.
Original commit message from CVS:
* docs/design/part-dynamic.txt:
* docs/design/part-events.txt:
* docs/design/part-seeking.txt:
Some more docs in the works.
* gst/base/gstbasetransform.c: (gst_base_transform_transform_caps),
(gst_base_transform_getcaps), (gst_base_transform_configure_caps),
(gst_base_transform_setcaps), (gst_base_transform_get_size),
(gst_base_transform_buffer_alloc), (gst_base_transform_event),
(gst_base_transform_handle_buffer),
(gst_base_transform_sink_activate_push),
(gst_base_transform_src_activate_pull),
(gst_base_transform_set_passthrough),
(gst_base_transform_is_passthrough):
Refcounting fixes.
* gst/gstbus.c: (gst_bus_source_dispatch), (gst_bus_poll):
Cleanups.
* gst/gstevent.c: (gst_event_finalize):
Set SRC to NULL.
* gst/gstutils.c: (gst_element_unlink),
(gst_pad_get_parent_element), (gst_pad_proxy_getcaps),
(gst_pad_proxy_setcaps):
* gst/gstutils.h:
Add _get_parent_element() to get a pads parent as an element.
2005-07-18 08:28:48 +00:00
|
|
|
GstElement* gst_pad_get_parent_element (GstPad *pad);
|
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
/* util query functions */
|
|
|
|
gboolean gst_pad_query_position (GstPad *pad, GstFormat *format,
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
gint64 *cur);
|
|
|
|
gboolean gst_pad_query_duration (GstPad *pad, GstFormat *format,
|
|
|
|
gint64 *duration);
|
2005-05-09 10:53:13 +00:00
|
|
|
gboolean gst_pad_query_convert (GstPad *pad, GstFormat src_format, gint64 src_val,
|
2005-08-25 23:17:18 +00:00
|
|
|
GstFormat *dest_format, gint64 *dest_val);
|
2005-05-09 10:53:13 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/* bin functions */
|
2005-11-21 18:41:39 +00:00
|
|
|
void gst_bin_add_many (GstBin *bin, GstElement *element_1, ...) G_GNUC_NULL_TERMINATED;
|
|
|
|
void gst_bin_remove_many (GstBin *bin, GstElement *element_1, ...) G_GNUC_NULL_TERMINATED;
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
/* buffer functions */
|
|
|
|
GstBuffer * gst_buffer_merge (GstBuffer * buf1, GstBuffer * buf2);
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
GstBuffer * gst_buffer_join (GstBuffer * buf1, GstBuffer * buf2);
|
2005-03-07 18:27:42 +00:00
|
|
|
void gst_buffer_stamp (GstBuffer * dest, const GstBuffer * src);
|
|
|
|
|
2005-04-24 22:49:45 +00:00
|
|
|
/* atomic functions */
|
|
|
|
void gst_atomic_int_set (gint * atomic_int, gint value);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
Remove old probes, add new g-signal-based probes and some utility functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* docs/gst/tmpl/gstpad.sgml:
* docs/gst/tmpl/gstprobe.sgml:
* gst/Makefile.am:
* gst/gstpad.c: (_gst_do_pass_data_accumulator),
(gst_pad_class_init), (gst_pad_init), (gst_pad_chain),
(gst_pad_push), (gst_pad_get_range), (gst_pad_pull_range),
(gst_pad_push_event), (gst_pad_send_event):
* gst/gstpad.h:
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
* gst/gstutils.h:
Remove old probes, add new g-signal-based probes and some utility
functions.
2005-06-29 15:51:25 +00:00
|
|
|
/* probes */
|
2005-07-04 15:08:30 +00:00
|
|
|
gulong gst_pad_add_data_probe (GstPad * pad,
|
Remove old probes, add new g-signal-based probes and some utility functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* docs/gst/tmpl/gstpad.sgml:
* docs/gst/tmpl/gstprobe.sgml:
* gst/Makefile.am:
* gst/gstpad.c: (_gst_do_pass_data_accumulator),
(gst_pad_class_init), (gst_pad_init), (gst_pad_chain),
(gst_pad_push), (gst_pad_get_range), (gst_pad_pull_range),
(gst_pad_push_event), (gst_pad_send_event):
* gst/gstpad.h:
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
* gst/gstutils.h:
Remove old probes, add new g-signal-based probes and some utility
functions.
2005-06-29 15:51:25 +00:00
|
|
|
GCallback handler,
|
|
|
|
gpointer data);
|
2005-09-21 12:21:10 +00:00
|
|
|
void gst_pad_remove_data_probe (GstPad * pad, guint handler_id);
|
2005-07-04 15:08:30 +00:00
|
|
|
gulong gst_pad_add_event_probe (GstPad * pad,
|
Remove old probes, add new g-signal-based probes and some utility functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* docs/gst/tmpl/gstpad.sgml:
* docs/gst/tmpl/gstprobe.sgml:
* gst/Makefile.am:
* gst/gstpad.c: (_gst_do_pass_data_accumulator),
(gst_pad_class_init), (gst_pad_init), (gst_pad_chain),
(gst_pad_push), (gst_pad_get_range), (gst_pad_pull_range),
(gst_pad_push_event), (gst_pad_send_event):
* gst/gstpad.h:
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
* gst/gstutils.h:
Remove old probes, add new g-signal-based probes and some utility
functions.
2005-06-29 15:51:25 +00:00
|
|
|
GCallback handler,
|
|
|
|
gpointer data);
|
2005-09-21 12:21:10 +00:00
|
|
|
void gst_pad_remove_event_probe (GstPad * pad, guint handler_id);
|
2005-07-04 15:08:30 +00:00
|
|
|
gulong gst_pad_add_buffer_probe (GstPad * pad,
|
Remove old probes, add new g-signal-based probes and some utility functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* docs/gst/tmpl/gstpad.sgml:
* docs/gst/tmpl/gstprobe.sgml:
* gst/Makefile.am:
* gst/gstpad.c: (_gst_do_pass_data_accumulator),
(gst_pad_class_init), (gst_pad_init), (gst_pad_chain),
(gst_pad_push), (gst_pad_get_range), (gst_pad_pull_range),
(gst_pad_push_event), (gst_pad_send_event):
* gst/gstpad.h:
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
* gst/gstutils.h:
Remove old probes, add new g-signal-based probes and some utility
functions.
2005-06-29 15:51:25 +00:00
|
|
|
GCallback handler,
|
|
|
|
gpointer data);
|
2005-09-21 12:21:10 +00:00
|
|
|
void gst_pad_remove_buffer_probe (GstPad * pad, guint handler_id);
|
Remove old probes, add new g-signal-based probes and some utility functions.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* docs/gst/tmpl/gstpad.sgml:
* docs/gst/tmpl/gstprobe.sgml:
* gst/Makefile.am:
* gst/gstpad.c: (_gst_do_pass_data_accumulator),
(gst_pad_class_init), (gst_pad_init), (gst_pad_chain),
(gst_pad_push), (gst_pad_get_range), (gst_pad_pull_range),
(gst_pad_push_event), (gst_pad_send_event):
* gst/gstpad.h:
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
* gst/gstutils.h:
Remove old probes, add new g-signal-based probes and some utility
functions.
2005-06-29 15:51:25 +00:00
|
|
|
|
2005-08-16 16:29:04 +00:00
|
|
|
/* tag emission utility functions */
|
|
|
|
void gst_element_found_tags_for_pad (GstElement * element,
|
|
|
|
GstPad * pad,
|
|
|
|
GstTagList * list);
|
|
|
|
void gst_element_found_tags (GstElement * element,
|
|
|
|
GstTagList * list);
|
|
|
|
|
2002-07-08 19:07:30 +00:00
|
|
|
G_END_DECLS
|
2004-03-15 14:43:35 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
#endif /* __GST_UTILS_H__ */
|