summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-12-04 22:32:38 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2011-02-23 10:34:45 +0100
commit317af67bc45188e3f746e3c16aeeb229d82f5e0d (patch)
tree4f595b6c5f2faa8012c6ceb73b197095d8405573
parent56a3364183b323cbb85e0dfc14b4c14035e947c9 (diff)
miniobject: make queries a boxed type
More minionject stuff.
-rw-r--r--gst/gstcaps.h4
-rw-r--r--gst/gstevent.c31
-rw-r--r--gst/gstmarshal.list1
-rw-r--r--gst/gstmessage.c86
-rw-r--r--gst/gstminiobject.c2
-rw-r--r--gst/gstpad.c17
6 files changed, 67 insertions, 74 deletions
diff --git a/gst/gstcaps.h b/gst/gstcaps.h
index 4c888fef0..b95439cc9 100644
--- a/gst/gstcaps.h
+++ b/gst/gstcaps.h
@@ -21,6 +21,7 @@
#define __GST_CAPS_H__
#include <gst/gstconfig.h>
+#include <gst/gstminiobject.h>
#include <gst/gststructure.h>
#include <gst/glib-compat.h>
@@ -91,7 +92,8 @@ typedef enum {
*/
#define GST_STATIC_CAPS(string) \
{ \
- /* caps */ { 0, 0, (GstCapsFlags) 0, NULL, GST_PADDING_INIT }, \
+ /* miniobject */ { { 0, 0, 0, 0, NULL, NULL, NULL }, \
+ /* caps */ NULL, GST_PADDING_INIT }, \
/* string */ string, \
GST_PADDING_INIT \
}
diff --git a/gst/gstevent.c b/gst/gstevent.c
index a8365c60e..cfe40ea80 100644
--- a/gst/gstevent.c
+++ b/gst/gstevent.c
@@ -87,14 +87,6 @@
static GType _gst_event_type = 0;
-void
-_gst_event_initialize (void)
-{
- g_type_class_ref (gst_event_get_type ());
- g_type_class_ref (gst_seek_flags_get_type ());
- g_type_class_ref (gst_seek_type_get_type ());
-}
-
typedef struct
{
const gint type;
@@ -125,6 +117,19 @@ static GstEventQuarks event_quarks[] = {
{0, NULL, 0}
};
+void
+_gst_event_initialize (void)
+{
+ gint i;
+ g_type_class_ref (gst_event_get_type ());
+ g_type_class_ref (gst_seek_flags_get_type ());
+ g_type_class_ref (gst_seek_type_get_type ());
+
+ for (i = 0; event_quarks[i].name; i++) {
+ event_quarks[i].quark = g_quark_from_static_string (event_quarks[i].name);
+ }
+}
+
/**
* gst_event_type_get_name:
* @type: the event type
@@ -183,16 +188,6 @@ gst_event_type_get_flags (GstEventType type)
return ret;
}
-#define _do_init \
-{ \
- gint i; \
- \
- for (i = 0; event_quarks[i].name; i++) { \
- event_quarks[i].quark = g_quark_from_static_string (event_quarks[i].name); \
- } \
-}
-
-
GType
gst_event_get_type (void)
{
diff --git a/gst/gstmarshal.list b/gst/gstmarshal.list
index 7d34089ef..b9fc16466 100644
--- a/gst/gstmarshal.list
+++ b/gst/gstmarshal.list
@@ -20,5 +20,6 @@ VOID:UINT,BOXED
VOID:UINT,POINTER
BOOLEAN:VOID
BOOLEAN:POINTER
+BOOLEAN:BOXED
POINTER:POINTER
BOXED:BOXED
diff --git a/gst/gstmessage.c b/gst/gstmessage.c
index 12ec71153..b32bdf9d9 100644
--- a/gst/gstmessage.c
+++ b/gst/gstmessage.c
@@ -60,19 +60,7 @@
#include "gstquark.h"
-static void gst_message_finalize (GstMessage * message);
-static GstMessage *_gst_message_copy (GstMessage * message);
-
-void
-_gst_message_initialize (void)
-{
- GST_CAT_INFO (GST_CAT_GST_INIT, "init messages");
-
- /* the GstMiniObject types need to be class_ref'd once before it can be
- * done from multiple threads;
- * see http://bugzilla.gnome.org/show_bug.cgi?id=304551 */
- g_type_class_ref (gst_message_get_type ());
-}
+static GType _gst_message_type = 0;
typedef struct
{
@@ -112,6 +100,24 @@ static GstMessageQuarks message_quarks[] = {
{0, NULL, 0}
};
+void
+_gst_message_initialize (void)
+{
+ gint i;
+
+ GST_CAT_INFO (GST_CAT_GST_INIT, "init messages");
+
+ /* the GstMiniObject types need to be class_ref'd once before it can be
+ * done from multiple threads;
+ * see http://bugzilla.gnome.org/show_bug.cgi?id=304551 */
+ g_type_class_ref (gst_message_get_type ());
+
+ for (i = 0; message_quarks[i].name; i++) {
+ message_quarks[i].quark =
+ g_quark_from_static_string (message_quarks[i].name);
+ }
+}
+
/**
* gst_message_type_get_name:
* @type: the message type
@@ -152,38 +158,18 @@ gst_message_type_to_quark (GstMessageType type)
return 0;
}
-#define _do_init \
-{ \
- gint i; \
- \
- for (i = 0; message_quarks[i].name; i++) { \
- message_quarks[i].quark = \
- g_quark_from_static_string (message_quarks[i].name); \
- } \
-}
-
-G_DEFINE_TYPE_WITH_CODE (GstMessage, gst_message, GST_TYPE_MINI_OBJECT,
- _do_init);
-
-static void
-gst_message_class_init (GstMessageClass * klass)
+GType
+gst_message_get_type (void)
{
- parent_class = g_type_class_peek_parent (klass);
-
- klass->mini_object_class.copy = (GstMiniObjectCopyFunction) _gst_message_copy;
- klass->mini_object_class.finalize =
- (GstMiniObjectFinalizeFunction) gst_message_finalize;
+ if (G_UNLIKELY (_gst_message_type == 0)) {
+ _gst_message_type = gst_mini_object_register ("GstMessage");
+ }
+ return _gst_message_type;
}
-static void
-gst_message_init (GstMessage * message)
-{
- GST_CAT_LOG (GST_CAT_MESSAGE, "new message %p", message);
- GST_MESSAGE_TIMESTAMP (message) = GST_CLOCK_TIME_NONE;
-}
static void
-gst_message_finalize (GstMessage * message)
+_gst_message_free (GstMessage * message)
{
g_return_if_fail (message != NULL);
@@ -205,7 +191,7 @@ gst_message_finalize (GstMessage * message)
gst_structure_free (message->structure);
}
-/* GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (message)); */
+ g_slice_free (GstMessage, message);
}
static GstMessage *
@@ -215,10 +201,13 @@ _gst_message_copy (GstMessage * message)
GST_CAT_LOG (GST_CAT_MESSAGE, "copy message %p", message);
- copy = (GstMessage *) gst_mini_object_new (GST_TYPE_MESSAGE);
+ copy = g_slice_new0 (GstMessage);
+
+ gst_mini_object_init (GST_MINI_OBJECT_CAST (copy),
+ _gst_message_type, sizeof (GstMessage));
- /* FIXME, need to copy relevant data from the miniobject. */
- //memcpy (copy, message, sizeof (GstMessage));
+ copy->mini_object.copy = (GstMiniObjectCopyFunction) _gst_message_copy;
+ copy->mini_object.free = (GstMiniObjectFreeFunction) _gst_message_free;
GST_MESSAGE_GET_LOCK (copy) = GST_MESSAGE_GET_LOCK (message);
GST_MESSAGE_COND (copy) = GST_MESSAGE_COND (message);
@@ -260,7 +249,13 @@ gst_message_new_custom (GstMessageType type, GstObject * src,
{
GstMessage *message;
- message = (GstMessage *) gst_mini_object_new (GST_TYPE_MESSAGE);
+ message = g_slice_new0 (GstMessage);
+
+ gst_mini_object_init (GST_MINI_OBJECT_CAST (message),
+ _gst_message_type, sizeof (GstMessage));
+
+ message->mini_object.copy = (GstMiniObjectCopyFunction) _gst_message_copy;
+ message->mini_object.free = (GstMiniObjectFreeFunction) _gst_message_free;
GST_CAT_LOG (GST_CAT_MESSAGE, "source %s: creating new message %p %s",
(src ? GST_OBJECT_NAME (src) : "NULL"), message,
@@ -278,6 +273,7 @@ gst_message_new_custom (GstMessageType type, GstObject * src,
}
message->structure = structure;
+ GST_MESSAGE_TIMESTAMP (message) = GST_CLOCK_TIME_NONE;
GST_MESSAGE_SEQNUM (message) = gst_util_seqnum_next ();
return message;
diff --git a/gst/gstminiobject.c b/gst/gstminiobject.c
index 027efae34..74a6e1e88 100644
--- a/gst/gstminiobject.c
+++ b/gst/gstminiobject.c
@@ -140,7 +140,7 @@ gst_mini_object_copy (const GstMiniObject * mini_object)
g_return_val_if_fail (mini_object != NULL, NULL);
if (mini_object->copy)
- copy = mo_class->copy (mini_object);
+ copy = mini_object->copy (mini_object);
else
copy = NULL;
diff --git a/gst/gstpad.c b/gst/gstpad.c
index 81b7e3352..a917e3f85 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -305,8 +305,7 @@ gst_pad_class_init (GstPadClass * klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
G_STRUCT_OFFSET (GstPadClass, have_data),
_gst_do_pass_data_accumulator,
- NULL, gst_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1,
- GST_TYPE_MINI_OBJECT);
+ NULL, gst_marshal_BOOLEAN__BOXED, G_TYPE_BOOLEAN, 1, G_TYPE_BOXED);
pspec_caps = g_param_spec_boxed ("caps", "Caps",
"The capabilities of the pad", GST_TYPE_CAPS,
@@ -3639,8 +3638,8 @@ gst_pad_emit_have_data_signal (GstPad * pad, GstMiniObject * obj)
g_value_set_boolean (&ret, TRUE);
g_value_init (&args[0], GST_TYPE_PAD);
g_value_set_object (&args[0], pad);
- g_value_init (&args[1], GST_TYPE_MINI_OBJECT);
- gst_value_set_mini_object (&args[1], obj);
+ g_value_init (&args[1], G_TYPE_BOXED);
+ g_value_set_boxed (&args[1], obj);
if (GST_IS_EVENT (obj))
detail = event_quark;
@@ -3716,7 +3715,7 @@ gst_pad_chain_data_unchecked (GstPad * pad, gboolean is_buffer, void *data,
if (G_UNLIKELY (emit_signal)) {
cache = NULL;
if (G_LIKELY (is_buffer)) {
- if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (data)))
+ if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT_CAST (data)))
goto dropping;
} else {
/* chain all groups in the buffer list one by one to avoid problems with
@@ -3953,7 +3952,7 @@ gst_pad_push_data (GstPad * pad, gboolean is_buffer, void *data,
if (G_LIKELY (is_buffer)) {
/* if the signal handler returned FALSE, it means we should just drop the
* buffer */
- if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (data)))
+ if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT_CAST (data)))
goto dropped;
} else {
/* push all buffers in the list */
@@ -4443,7 +4442,7 @@ gst_pad_get_range_unchecked (GstPad * pad, guint64 offset, guint size,
/* can only fire the signal if we have a valid buffer */
if (G_UNLIKELY (emit_signal) && (ret == GST_FLOW_OK)) {
- if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (*buffer)))
+ if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT_CAST (*buffer)))
goto dropping;
}
@@ -4612,7 +4611,7 @@ gst_pad_pull_range (GstPad * pad, guint64 offset, guint size,
/* can only fire the signal if we have a valid buffer */
if (G_UNLIKELY (emit_signal)) {
- if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (*buffer)))
+ if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT_CAST (*buffer)))
goto dropping;
}
@@ -4739,7 +4738,7 @@ gst_pad_push_event (GstPad * pad, GstEvent * event)
if (G_UNLIKELY (GST_PAD_DO_EVENT_SIGNALS (pad) > 0)) {
GST_OBJECT_UNLOCK (pad);
- if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (event)))
+ if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT_CAST (event)))
goto dropping;
GST_OBJECT_LOCK (pad);