summaryrefslogtreecommitdiff
path: root/gst/gstmessage.h
diff options
context:
space:
mode:
Diffstat (limited to 'gst/gstmessage.h')
-rw-r--r--gst/gstmessage.h92
1 files changed, 53 insertions, 39 deletions
diff --git a/gst/gstmessage.h b/gst/gstmessage.h
index 757b1d5bed..ebe53b1cef 100644
--- a/gst/gstmessage.h
+++ b/gst/gstmessage.h
@@ -25,7 +25,6 @@
G_BEGIN_DECLS
typedef struct _GstMessage GstMessage;
-typedef struct _GstMessageClass GstMessageClass;
/**
* GstMessageType:
@@ -133,6 +132,7 @@ typedef enum
#include <gst/gstelement.h>
#include <gst/gsttaglist.h>
#include <gst/gststructure.h>
+#include <gst/gstquery.h>
/**
* GST_MESSAGE_TRACE_NAME:
@@ -142,12 +142,9 @@ typedef enum
#define GST_MESSAGE_TRACE_NAME "GstMessage"
#define GST_TYPE_MESSAGE (gst_message_get_type())
-#define GST_IS_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MESSAGE))
-#define GST_IS_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MESSAGE))
-#define GST_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MESSAGE, GstMessageClass))
-#define GST_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MESSAGE, GstMessage))
-#define GST_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MESSAGE, GstMessageClass))
+#define GST_IS_MESSAGE(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_MESSAGE))
#define GST_MESSAGE_CAST(obj) ((GstMessage*)(obj))
+#define GST_MESSAGE(obj) (GST_MESSAGE_CAST(obj))
/* the lock is used to handle the synchronous handling of messages,
* the emiting thread is block until the handling thread processed
@@ -190,6 +187,15 @@ typedef enum
* Get the object that posted @message.
*/
#define GST_MESSAGE_SRC(message) (GST_MESSAGE_CAST(message)->src)
+
+/**
+ * GST_MESSAGE_SEQNUM:
+ * @message: a #GstMessage
+ *
+ * Get the sequence number of @message.
+ */
+#define GST_MESSAGE_SEQNUM(message) (GST_MESSAGE_CAST(message)->seqnum)
+
/**
* GST_MESSAGE_SRC_NAME:
* @message: a #GstMessage
@@ -270,7 +276,6 @@ typedef enum {
* @type: the #GstMessageType of the message
* @timestamp: the timestamp of the message
* @src: the src of the message
- * @structure: the #GstStructure containing the message info.
*
* A #GstMessage.
*/
@@ -278,32 +283,15 @@ struct _GstMessage
{
GstMiniObject mini_object;
- /*< private >*//* with MESSAGE_LOCK */
- GMutex *lock; /* lock and cond for async delivery */
- GCond *cond;
-
/*< public > *//* with COW */
GstMessageType type;
guint64 timestamp;
GstObject *src;
+ guint32 seqnum;
- GstStructure *structure;
-
- /*< private >*/
- union {
- struct {
- guint32 seqnum;
- } ABI;
- /* + 0 to mark ABI change for future greppage */
- gpointer _gst_reserved[GST_PADDING + 0];
- } abidata;
-};
-
-struct _GstMessageClass {
- GstMiniObjectClass mini_object_class;
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
+ /*< private >*//* with MESSAGE_LOCK */
+ GMutex *lock; /* lock and cond for async delivery */
+ GCond *cond;
};
GType gst_message_get_type (void);
@@ -369,6 +357,14 @@ gst_message_copy (const GstMessage * msg)
}
/**
+ * gst_message_is_writable:
+ * @msg: a #GstMessage
+ *
+ * Tests if you can safely write into a message's structure or validly
+ * modify the seqnum and timestamp fields.
+ */
+#define gst_message_is_writable(msg) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (msg))
+/**
* gst_message_make_writable:
* @msg: (transfer full): the message to make writable
*
@@ -380,6 +376,32 @@ gst_message_copy (const GstMessage * msg)
* MT safe
*/
#define gst_message_make_writable(msg) GST_MESSAGE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (msg)))
+/**
+ * gst_message_replace:
+ * @old_message: (inout) (transfer full): pointer to a pointer to a #GstMessage
+ * to be replaced.
+ * @new_message: (allow-none) (transfer none): pointer to a #GstMessage that will
+ * replace the message pointed to by @old_message.
+ *
+ * Modifies a pointer to a #GstMessage to point to a different #GstMessage. The
+ * modification is done atomically (so this is useful for ensuring thread safety
+ * in some cases), and the reference counts are updated appropriately (the old
+ * message is unreffed, the new one is reffed).
+ *
+ * Either @new_message or the #GstMessage pointed to by @old_message may be NULL.
+ */
+#define gst_message_replace(old_message,new_message) \
+ gst_mini_object_replace ((GstMiniObject **)(old_message), GST_MINI_OBJECT_CAST (new_message))
+
+
+/* custom messages */
+GstMessage * gst_message_new_custom (GstMessageType type,
+ GstObject * src,
+ GstStructure * structure);
+const GstStructure *
+ gst_message_get_structure (GstMessage *message);
+
+gboolean gst_message_has_name (GstMessage *message, const gchar *name);
/* identifiers for events and messages */
guint32 gst_message_get_seqnum (GstMessage *message);
@@ -403,9 +425,7 @@ void gst_message_parse_info (GstMessage *message, GError **g
/* TAG */
GstMessage * gst_message_new_tag (GstObject * src, GstTagList * tag_list);
-GstMessage * gst_message_new_tag_full (GstObject * src, GstPad *pad, GstTagList * tag_list);
void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list);
-void gst_message_parse_tag_full (GstMessage *message, GstPad **pad, GstTagList **tag_list);
/* BUFFERING */
GstMessage * gst_message_new_buffering (GstObject * src, gint percent);
@@ -471,11 +491,11 @@ void gst_message_parse_duration (GstMessage *message, GstFormat
GstMessage * gst_message_new_latency (GstObject * src);
/* ASYNC_START */
-GstMessage * gst_message_new_async_start (GstObject * src, gboolean new_base_time);
-void gst_message_parse_async_start (GstMessage *message, gboolean *new_base_time);
+GstMessage * gst_message_new_async_start (GstObject * src);
/* ASYNC_DONE */
-GstMessage * gst_message_new_async_done (GstObject * src);
+GstMessage * gst_message_new_async_done (GstObject * src, gboolean reset_time);
+void gst_message_parse_async_done (GstMessage *message, gboolean *reset_time);
/* STRUCTURE CHANGE */
GstMessage * gst_message_new_structure_change (GstObject * src, GstStructureChangeType type,
@@ -523,12 +543,6 @@ void gst_message_parse_progress (GstMessage * message, GstPro
gchar ** text);
-/* custom messages */
-GstMessage * gst_message_new_custom (GstMessageType type,
- GstObject * src,
- GstStructure * structure);
-const GstStructure * gst_message_get_structure (GstMessage *message);
-
G_END_DECLS
#endif /* __GST_MESSAGE_H__ */