event: clean up some macros

Avoid executing a method for GST_TYPE_EVENT but instead use the type variable
directly. We can do this because we register it before anything else.
This commit is contained in:
Wim Taymans 2011-05-11 12:04:43 +02:00
parent 9ec1673cae
commit 0bfbce4463
2 changed files with 19 additions and 27 deletions

View file

@ -85,7 +85,7 @@
#include "gstutils.h" #include "gstutils.h"
#include "gstquark.h" #include "gstquark.h"
static GType _gst_event_type = 0; GType _gst_event_type = 0;
typedef struct typedef struct
{ {
@ -147,7 +147,8 @@ _gst_event_initialize (void)
{ {
gint i; gint i;
gst_event_get_type (); _gst_event_type = gst_mini_object_register ("GstEvent");
g_type_class_ref (gst_seek_flags_get_type ()); g_type_class_ref (gst_seek_flags_get_type ());
g_type_class_ref (gst_seek_type_get_type ()); g_type_class_ref (gst_seek_type_get_type ());
@ -214,15 +215,6 @@ gst_event_type_get_flags (GstEventType type)
return ret; return ret;
} }
GType
gst_event_get_type (void)
{
if (G_UNLIKELY (_gst_event_type == 0)) {
_gst_event_type = gst_mini_object_register ("GstEvent");
}
return _gst_event_type;
}
static void static void
_gst_event_free (GstEvent * event) _gst_event_free (GstEvent * event)
{ {

View file

@ -34,6 +34,22 @@
G_BEGIN_DECLS G_BEGIN_DECLS
extern GType _gst_event_type;
typedef struct _GstEvent GstEvent;
#define GST_TYPE_EVENT (_gst_event_type)
#define GST_IS_EVENT(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_EVENT))
#define GST_EVENT_CAST(obj) ((GstEvent *)(obj))
#define GST_EVENT(obj) (GST_EVENT_CAST(obj))
/**
* GST_EVENT_TRACE_NAME:
*
* The name used for memory allocation tracing
*/
#define GST_EVENT_TRACE_NAME "GstEvent"
/** /**
* GstEventTypeFlags: * GstEventTypeFlags:
* @GST_EVENT_TYPE_UPSTREAM: Set if the event can travel upstream. * @GST_EVENT_TYPE_UPSTREAM: Set if the event can travel upstream.
@ -163,20 +179,6 @@ typedef enum {
} GstEventType; } GstEventType;
#undef FLAG #undef FLAG
/**
* GST_EVENT_TRACE_NAME:
*
* The name used for memory allocation tracing
*/
#define GST_EVENT_TRACE_NAME "GstEvent"
typedef struct _GstEvent GstEvent;
#define GST_TYPE_EVENT (gst_event_get_type())
#define GST_IS_EVENT(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_EVENT))
#define GST_EVENT(obj) ((GstEvent *)(obj))
#define GST_EVENT_CAST(obj) ((GstEvent *)(obj))
/** /**
* GST_EVENT_TYPE: * GST_EVENT_TYPE:
* @event: the event to query * @event: the event to query
@ -396,8 +398,6 @@ GstEventTypeFlags
gst_event_type_get_flags (GstEventType type); gst_event_type_get_flags (GstEventType type);
GType gst_event_get_type (void);
/* refcounting */ /* refcounting */
/** /**
* gst_event_ref: * gst_event_ref: