diff --git a/docs/random/porting-to-0.11.txt b/docs/random/porting-to-0.11.txt index b99363e0d0..f67f90f8aa 100644 --- a/docs/random/porting-to-0.11.txt +++ b/docs/random/porting-to-0.11.txt @@ -4,6 +4,8 @@ The 0.11 porting guide * All deprecated methods were removed. Recompile against 0.10 with DISABLE_DEPRECATED and fix issues before attempting to port to 0.11. +* GST_BOILERPLATE is gone, use G_DEFINE_TYPE instead. + * various methods take a gsize instead of a guint when talking about memory sizes. diff --git a/gst/gstutils.h b/gst/gstutils.h index 96f2116a72..1bed731919 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -92,152 +92,6 @@ GType gst_type_register_static_full (GType parent_type, const GTypeValueTable *value_table, GTypeFlags flags); - -/* Macros for defining classes. Ideas taken from Bonobo, which took theirs - from Nautilus and GOB. */ - -/** - * 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 - * @additional_initializations: function pointer in the form of - * 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. - * - * - * - * GST_BOILERPLATE_FULL (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT, _do_init); - * - * - */ -#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);\ -static void type_as_function ## _init (type *object, \ - type ## Class *g_class);\ -static parent_type ## Class *parent_class = NULL; \ -static void \ -type_as_function ## _class_init_trampoline (gpointer g_class) \ -{ \ - 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) \ -{ \ - /* The typedef for GType may be gulong or gsize, depending on the \ - * system and whether the compiler is c++ or not. The g_once_init_* \ - * functions always take a gsize * though ... */ \ - static volatile gsize gonce_data = 0; \ - if (g_once_init_enter (&gonce_data)) { \ - GType _type; \ - _type = gst_type_register_static_full (parent_type_macro, \ - g_intern_static_string (#type), \ - sizeof (type ## Class), \ - type_as_function ## _base_init, \ - NULL, /* base_finalize */ \ - (GClassInitFunc) type_as_function ## _class_init_trampoline, \ - NULL, /* class_finalize */ \ - NULL, /* class_data */ \ - sizeof (type), \ - 0, /* n_preallocs */ \ - (GInstanceInitFunc) type_as_function ## _init, \ - NULL, \ - (GTypeFlags) 0); \ - additional_initializations (_type); \ - g_once_init_leave (&gonce_data, (gsize) _type); \ - } \ - return (GType) gonce_data; \ -} - -#define __GST_DO_NOTHING(type) /* NOP */ - -/** - * 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. - * - * - * - * GST_BOILERPLATE (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT); - * - * - */ -#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) - -/* 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 - */ -/** - * 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 - */ -#define GST_BOILERPLATE_WITH_INTERFACE(type, type_as_function, \ - parent_type, parent_type_as_macro, interface_type, \ - interface_type_as_macro, interface_as_function) \ - \ -static void interface_as_function ## _interface_init (interface_type ## Class *klass); \ -static gboolean interface_as_function ## _supported (type *object, GType iface_type); \ - \ -static void \ -type_as_function ## _implements_interface_init (GstImplementsInterfaceClass *klass) \ -{ \ - klass->supported = (gboolean (*)(GstImplementsInterface*, GType))interface_as_function ## _supported; \ -} \ - \ -static void \ -type_as_function ## _init_interfaces (GType type_var) \ -{ \ - 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_var, GST_TYPE_IMPLEMENTS_INTERFACE, \ - &implements_iface_info); \ - g_type_add_interface_static (type_var, interface_type_as_macro, \ - &iface_info); \ -} \ - \ -GST_BOILERPLATE_FULL (type, type_as_function, parent_type, \ - parent_type_as_macro, type_as_function ## _init_interfaces) - /** * GST_CALL_PARENT: * @parent_class_cast: the name of the class cast macro for the parent type