summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Crête <olivier.crete@collabora.com>2013-08-14 15:56:11 -0400
committerTim-Philipp Müller <tim@centricular.com>2014-03-16 14:38:07 +0000
commit10d53423b50496a0159ca852dff32618f68f0bb7 (patch)
tree48d8c90e8ab5da0d767d68fd2e48d4cca8044339
parent29bae0bc727b990a40c48f59baad284e0cc89189 (diff)
message: Add GST_MESSAGE_EXTENDED
https://bugzilla.gnome.org/show_bug.cgi?id=678402
-rw-r--r--gst/gst.c3
-rw-r--r--gst/gstmessage.c28
-rw-r--r--gst/gstmessage.h21
-rw-r--r--gst/gstquark.c2
-rw-r--r--gst/gstquark.h3
5 files changed, 54 insertions, 3 deletions
diff --git a/gst/gst.c b/gst/gst.c
index f734dc9c7..b24ecbe9d 100644
--- a/gst/gst.c
+++ b/gst/gst.c
@@ -667,6 +667,7 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
g_type_class_ref (gst_lock_flags_get_type ());
g_type_class_ref (gst_allocator_flags_get_type ());
g_type_class_ref (gst_stream_flags_get_type ());
+ g_type_class_ref (gst_message_extended_type_get_type ());
_priv_gst_event_initialize ();
_priv_gst_buffer_initialize ();
@@ -1062,6 +1063,8 @@ gst_deinit (void)
g_type_class_unref (g_type_class_peek (gst_allocator_flags_get_type ()));
g_type_class_unref (g_type_class_peek (gst_stream_flags_get_type ()));
g_type_class_unref (g_type_class_peek (gst_debug_color_mode_get_type ()));
+ g_type_class_unref (g_type_class_peek (gst_message_extended_type_get_type
+ ()));
gst_deinitialized = TRUE;
GST_INFO ("deinitialized GStreamer");
diff --git a/gst/gstmessage.c b/gst/gstmessage.c
index 1402a6798..debc52644 100644
--- a/gst/gstmessage.c
+++ b/gst/gstmessage.c
@@ -60,6 +60,8 @@ typedef struct
{
GstMessage message;
+ GstMessageExtendedType extended_type;
+
GstStructure *structure;
} GstMessageImpl;
@@ -105,6 +107,8 @@ static GstMessageQuarks message_quarks[] = {
{GST_MESSAGE_STREAM_START, "stream-start", 0},
{GST_MESSAGE_NEED_CONTEXT, "need-context", 0},
{GST_MESSAGE_HAVE_CONTEXT, "have-context", 0},
+ {GST_MESSAGE_EXTENDED, "extended", 0},
+ {GST_MESSAGE_DEVICE, "device", 0},
{0, NULL, 0}
};
@@ -235,6 +239,16 @@ _gst_message_copy (GstMessage * message)
return GST_MESSAGE_CAST (copy);
}
+GstMessageExtendedType
+gst_message_get_extended_type (GstMessage * msg)
+{
+ GstMessageImpl *message = (GstMessageImpl *) msg;
+
+ g_return_val_if_fail (GST_IS_MESSAGE (msg), 0);
+
+ return message->extended_type;
+}
+
static void
gst_message_init (GstMessageImpl * message, GstMessageType type,
GstObject * src)
@@ -300,6 +314,20 @@ had_parent:
}
}
+static inline GstMessage *
+gst_message_new_extended (GstMessageExtendedType extended_type, GstObject * src,
+ GstStructure * structure)
+{
+ GstMessageImpl *message;
+
+ message = (GstMessageImpl *) gst_message_new_custom (GST_MESSAGE_EXTENDED,
+ src, structure);
+
+ message->extended_type = extended_type;
+
+ return GST_MESSAGE_CAST (message);
+}
+
/**
* gst_message_get_seqnum:
* @message: A #GstMessage.
diff --git a/gst/gstmessage.h b/gst/gstmessage.h
index fc73661c7..951a62015 100644
--- a/gst/gstmessage.h
+++ b/gst/gstmessage.h
@@ -99,13 +99,16 @@ typedef struct _GstMessage GstMessage;
* the URI for the next title has been set).
* @GST_MESSAGE_NEED_CONTEXT: Message indicating that an element wants a specific context (Since 1.2)
* @GST_MESSAGE_HAVE_CONTEXT: Message indicating that an element created a context (Since 1.2)
+ * @GST_MESSAGE_EXTENDED: See gst_message_get_extended_type() to get the type (Since 1.2)
* @GST_MESSAGE_ANY: mask for all of the above messages.
*
- * The different message types that are available.
+ * The different message types that are available. Also see
+ * #GstMessageExtendedType for more types.
*/
/* NOTE: keep in sync with quark registration in gstmessage.c
* NOTE: keep GST_MESSAGE_ANY a valid gint to avoid compiler warnings.
*/
+/* FIXME: 2.0: Make it NOT flags, just a regular 1,2,3,4.. enumeration */
typedef enum
{
GST_MESSAGE_UNKNOWN = 0,
@@ -140,9 +143,23 @@ typedef enum
GST_MESSAGE_STREAM_START = (1 << 28),
GST_MESSAGE_NEED_CONTEXT = (1 << 29),
GST_MESSAGE_HAVE_CONTEXT = (1 << 30),
+ GST_MESSAGE_EXTENDED = (1 << 31),
GST_MESSAGE_ANY = ~0
} GstMessageType;
+/**
+ * GstMessageExtendedType:
+ * @GST_MESSAGE_DEVICE: A #GstDevice addition or removal according to
+ * a #GstDeviceMonitor
+ *
+ * Extra message types, see #GstMessageType for the basic types
+ */
+
+typedef enum {
+ /* Skip those defined in #GstMessage to avoid confusion */
+ GST_MESSAGE_DEVICE = 3
+} GstMessageExtendedType;
+
#include <gst/gstminiobject.h>
#include <gst/gstobject.h>
#include <gst/gstelement.h>
@@ -300,6 +317,8 @@ GType gst_message_get_type (void);
const gchar* gst_message_type_get_name (GstMessageType type);
GQuark gst_message_type_to_quark (GstMessageType type);
+GstMessageExtendedType gst_message_get_extended_type (GstMessage * msg);
+
/* refcounting */
/**
* gst_message_ref:
diff --git a/gst/gstquark.c b/gst/gstquark.c
index 5598b9969..714aac8e5 100644
--- a/gst/gstquark.c
+++ b/gst/gstquark.c
@@ -68,7 +68,7 @@ static const gchar *_quark_strings[] = {
"GstEventSegmentDone",
"GstEventStreamStart", "stream-id", "GstQueryContext",
"GstMessageNeedContext", "GstMessageHaveContext", "context", "context-type",
- "GstMessageStreamStart", "group-id", "uri-redirection"
+ "GstMessageStreamStart", "group-id", "uri-redirection", "GstMessageExtended"
};
GQuark _priv_gst_quark_table[GST_QUARK_MAX];
diff --git a/gst/gstquark.h b/gst/gstquark.h
index 025f508ad..3a3f440f8 100644
--- a/gst/gstquark.h
+++ b/gst/gstquark.h
@@ -196,7 +196,8 @@ typedef enum _GstQuarkId
GST_QUARK_MESSAGE_STREAM_START = 167,
GST_QUARK_GROUP_ID = 168,
GST_QUARK_URI_REDIRECTION = 169,
- GST_QUARK_MAX = 170
+ GST_QUARK_MESSAGE_EXTENDED = 170,
+ GST_QUARK_MAX = 171
} GstQuarkId;
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];