Search
SailfishOS Open Build Service
>
Projects
>
home:sledge
:
branches:nemo:devel:hw:ti:omap4:common
>
gstreamer
> 0009-utils-add-quark-and-mini-object-boilerplate-macros.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File 0009-utils-add-quark-and-mini-object-boilerplate-macros.patch of Package gstreamer
From 90d6c97048019295cc6a9880ed313880bb1fe19e Mon Sep 17 00:00:00 2001 From: Rob Clark <rob@ti.com> Date: Wed, 13 Jun 2012 18:54:51 -0500 Subject: [PATCH 09/11] utils: add quark and mini-object boilerplate macros --- gst/gstutils.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/gst/gstutils.h b/gst/gstutils.h index a746913..fef1f9d 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -96,6 +96,40 @@ GType gst_type_register_static_full (GType parent_type, /* Macros for defining classes. Ideas taken from Bonobo, which took theirs from Nautilus and GOB. */ +#define GST_BOILERPLATE_QUARK(type, type_as_function) \ +GQuark \ +type_as_function ## _get_type (void) \ +{ \ + static gsize quark_gonce = 0; \ + if (g_once_init_enter (&quark_gonce)) { \ + gsize quark; \ + quark = (gsize) g_quark_from_static_string (#type);\ + g_once_init_leave (&quark_gonce, quark); \ + } \ + return (GQuark) quark_gonce; \ +} + +#define GST_BOILERPLATE_MINI_OBJECT(type, type_as_function) \ +static void type_as_function ## _class_init (type ## Class *g_class); \ +GType \ +type_as_function ## _get_type (void) \ +{ \ + static volatile gsize type_id = 0; \ + if (g_once_init_enter (&type_id)) { \ + GType new_type_id = g_type_register_static_simple ( \ + GST_TYPE_MINI_OBJECT, \ + g_intern_static_string (#type), \ + sizeof (type ## Class), \ + (GClassInitFunc) type_as_function ## _class_init, \ + sizeof (type), \ + NULL, \ + (GTypeFlags) 0); \ + g_once_init_leave (&type_id, new_type_id); \ + } \ + return type_id; \ +} + + /** * GST_BOILERPLATE_FULL: * @type: the name of the type struct -- 1.7.9.5