gstfunnel: avoid access of freed pad
[platform/upstream/gstreamer.git] / gst / gstmessage.h
index 48190cf..50e0146 100644 (file)
@@ -88,6 +88,8 @@ typedef struct _GstMessage GstMessage;
  * @GST_MESSAGE_QOS: A buffer was dropped or an element changed its processing
  * strategy for Quality of Service reasons. Since: 0.10.29
  * @GST_MESSAGE_PROGRESS: A progress message. Since: 0.10.33
+ * @GST_MESSAGE_TOC: A new table of contents (TOC) was found or previously found TOC
+ * was updated. Since: 0.10.37
  * @GST_MESSAGE_ANY: mask for all of the above messages.
  *
  * The different message types that are available.
@@ -124,6 +126,8 @@ typedef enum
   GST_MESSAGE_STEP_START        = (1 << 23),
   GST_MESSAGE_QOS               = (1 << 24),
   GST_MESSAGE_PROGRESS          = (1 << 25),
+  GST_MESSAGE_TOC               = (1 << 26),
+  GST_MESSAGE_RESET_TIME        = (1 << 27),
   GST_MESSAGE_ANY               = ~0
 } GstMessageType;
 
@@ -133,13 +137,7 @@ typedef enum
 #include <gst/gsttaglist.h>
 #include <gst/gststructure.h>
 #include <gst/gstquery.h>
-
-/**
- * GST_MESSAGE_TRACE_NAME:
- *
- * The name used for memory allocation tracing
- */
-#define GST_MESSAGE_TRACE_NAME  "GstMessage"
+#include <gst/gsttoc.h>
 
 #define GST_TYPE_MESSAGE                         (gst_message_get_type())
 #define GST_IS_MESSAGE(obj)                      (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_MESSAGE))
@@ -149,12 +147,12 @@ typedef enum
 /* the lock is used to handle the synchronous handling of messages,
  * the emiting thread is block until the handling thread processed
  * the message using this mutex/cond pair */
-#define GST_MESSAGE_GET_LOCK(message)   (GST_MESSAGE_CAST(message)->lock)
+#define GST_MESSAGE_GET_LOCK(message)   (&GST_MESSAGE_CAST(message)->lock)
 #define GST_MESSAGE_LOCK(message)       g_mutex_lock(GST_MESSAGE_GET_LOCK(message))
 #define GST_MESSAGE_UNLOCK(message)     g_mutex_unlock(GST_MESSAGE_GET_LOCK(message))
-#define GST_MESSAGE_COND(message)       (GST_MESSAGE_CAST(message)->cond)
-#define GST_MESSAGE_WAIT(message)       g_cond_wait(GST_MESSAGE_COND(message),GST_MESSAGE_GET_LOCK(message))
-#define GST_MESSAGE_SIGNAL(message)     g_cond_signal(GST_MESSAGE_COND(message))
+#define GST_MESSAGE_GET_COND(message)   (&GST_MESSAGE_CAST(message)->cond)
+#define GST_MESSAGE_WAIT(message)       g_cond_wait(GST_MESSAGE_GET_COND(message),GST_MESSAGE_GET_LOCK(message))
+#define GST_MESSAGE_SIGNAL(message)     g_cond_signal(GST_MESSAGE_GET_COND(message))
 
 /**
  * GST_MESSAGE_TYPE:
@@ -267,7 +265,7 @@ typedef enum {
   GST_PROGRESS_TYPE_CONTINUE = 1,
   GST_PROGRESS_TYPE_COMPLETE = 2,
   GST_PROGRESS_TYPE_CANCELED = 3,
-  GST_PROGRESS_TYPE_ERROR    = 4,
+  GST_PROGRESS_TYPE_ERROR    = 4
 } GstProgressType;
 
 /**
@@ -282,17 +280,17 @@ typedef enum {
  */
 struct _GstMessage
 {
-  GstMiniObject mini_object;
+  GstMiniObject   mini_object;
 
   /*< public > *//* with COW */
-  GstMessageType type;
-  guint64 timestamp;
-  GstObject *src;
-  guint32 seqnum;
+  GstMessageType  type;
+  guint64         timestamp;
+  GstObject      *src;
+  guint32         seqnum;
 
   /*< private >*//* with MESSAGE_LOCK */
-  GMutex *lock;                 /* lock and cond for async delivery */
-  GCond *cond;
+  GMutex          lock;                 /* lock and cond for async delivery */
+  GCond           cond;
 };
 
 GType           gst_message_get_type            (void);
@@ -390,9 +388,18 @@ gst_message_copy (const GstMessage * msg)
  * message is unreffed, the new one is reffed).
  *
  * Either @new_message or the #GstMessage pointed to by @old_message may be NULL.
+ *
+ * Returns: TRUE if @new_message was different from @old_message
  */
-#define         gst_message_replace(old_message,new_message) \
-    gst_mini_object_replace ((GstMiniObject **)(old_message), GST_MINI_OBJECT_CAST (new_message))
+#ifdef _FOOL_GTK_DOC_
+G_INLINE_FUNC gboolean gst_message_replace (GstMessage **old_message, GstMessage *new_message);
+#endif
+
+static inline gboolean
+gst_message_replace (GstMessage **old_message, GstMessage *new_message)
+{
+  return gst_mini_object_replace ((GstMiniObject **) old_message, (GstMiniObject *) new_message);
+}
 
 
 /* custom messages */
@@ -495,8 +502,8 @@ GstMessage *    gst_message_new_latency         (GstObject * src) G_GNUC_MALLOC;
 GstMessage *    gst_message_new_async_start     (GstObject * src) G_GNUC_MALLOC;
 
 /* ASYNC_DONE */
-GstMessage *    gst_message_new_async_done      (GstObject * src, gboolean reset_time) G_GNUC_MALLOC;
-void            gst_message_parse_async_done    (GstMessage *message, gboolean *reset_time);
+GstMessage *    gst_message_new_async_done      (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC;
+void            gst_message_parse_async_done    (GstMessage *message, GstClockTime *running_time);
 
 /* STRUCTURE CHANGE */
 GstMessage *    gst_message_new_structure_change   (GstObject * src, GstStructureChangeType type,
@@ -543,6 +550,13 @@ GstMessage *    gst_message_new_progress           (GstObject * src, GstProgress
 void            gst_message_parse_progress         (GstMessage * message, GstProgressType * type, gchar ** code,
                                                     gchar ** text);
 
+/* TOC */
+GstMessage *    gst_message_new_toc             (GstObject *src, GstToc *toc, gboolean updated);
+void            gst_message_parse_toc           (GstMessage *message, GstToc **toc, gboolean *updated);
+
+/* RESET_TIME */
+GstMessage *    gst_message_new_reset_time      (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC;
+void            gst_message_parse_reset_time    (GstMessage *message, GstClockTime *running_time);
 
 G_END_DECLS