Add ASYNC_START and ASYNC_DONE messages to prepare for latency support.
authorWim Taymans <wim.taymans@gmail.com>
Mon, 19 Mar 2007 09:55:02 +0000 (09:55 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 19 Mar 2007 09:55:02 +0000 (09:55 +0000)
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_new_async_start),
(gst_message_new_async_done), (gst_message_parse_info),
(gst_message_parse_async_start):
* gst/gstmessage.h:
Add ASYNC_START and ASYNC_DONE messages to prepare for latency
support.

ChangeLog
docs/gst/gstreamer-sections.txt
gst/gstmessage.c
gst/gstmessage.h

index c01e7a1..e803469 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-03-19  Wim Taymans  <wim@fluendo.com>
+
+       * docs/gst/gstreamer-sections.txt:
+       * gst/gstmessage.c: (gst_message_new_async_start),
+       (gst_message_new_async_done), (gst_message_parse_info),
+       (gst_message_parse_async_start):
+       * gst/gstmessage.h:
+       Add ASYNC_START and ASYNC_DONE messages to prepare for latency
+       support.
+
 2007-03-15  Tim-Philipp Müller  <tim at centricular dot net>
 
        * tools/gst-inspect.c:
index c4a189d..d5bbdb6 100644 (file)
@@ -1013,6 +1013,8 @@ gst_message_new_buffering
 gst_message_new_warning
 gst_message_new_duration
 gst_message_new_state_dirty
+gst_message_new_async_start
+gst_message_new_async_done
 gst_message_new_latency
 gst_message_parse_clock_lost
 gst_message_parse_clock_provide
@@ -1026,8 +1028,10 @@ gst_message_parse_tag
 gst_message_parse_buffering
 gst_message_parse_warning
 gst_message_parse_duration
+gst_message_parse_async_start
 gst_message_ref
 gst_message_unref
+
 <SUBSECTION Standard>
 GstMessageClass
 GST_MESSAGE
index e5cf6b3..a92da25 100644 (file)
@@ -109,6 +109,8 @@ static GstMessageQuarks message_quarks[] = {
   {GST_MESSAGE_SEGMENT_DONE, "segment-done", 0},
   {GST_MESSAGE_DURATION, "duration", 0},
   {GST_MESSAGE_LATENCY, "latency", 0},
+  {GST_MESSAGE_ASYNC_START, "async-start", 0},
+  {GST_MESSAGE_ASYNC_DONE, "async-done", 0},
   {0, NULL, 0}
 };
 
@@ -725,6 +727,53 @@ gst_message_new_duration (GstObject * src, GstFormat format, gint64 duration)
 }
 
 /**
+ * gst_message_new_async_start:
+ * @src: The object originating the message.
+ * @new_base_time: if a new base_time should be set on the element
+ *
+ * This message is posted by elements when they start an ASYNC state change. 
+ * @new_base_time is set to TRUE when the element lost its state when it was
+ * PLAYING.
+ *
+ * Returns: The new async_start message. 
+ *
+ * MT safe.
+ *
+ * Since: 0.10.13
+ */
+GstMessage *
+gst_message_new_async_start (GstObject * src, gboolean new_base_time)
+{
+  GstMessage *message;
+
+  message = gst_message_new_custom (GST_MESSAGE_ASYNC_START, src,
+      gst_structure_new ("GstMessageAsyncStart",
+          "new-base-time", G_TYPE_BOOLEAN, new_base_time, NULL));
+
+  return message;
+}
+
+/**
+ * gst_message_new_async_done:
+ * @src: The object originating the message.
+ *
+ * Returns: The new async_done message.
+ *
+ * MT safe.
+ *
+ * Since: 0.10.13
+ */
+GstMessage *
+gst_message_new_async_done (GstObject * src)
+{
+  GstMessage *message;
+
+  message = gst_message_new_custom (GST_MESSAGE_ASYNC_DONE, src, NULL);
+
+  return message;
+}
+
+/**
  * gst_message_new_latency:
  * @src: The object originating the message.
  *
@@ -1108,3 +1157,29 @@ gst_message_parse_duration (GstMessage * message, GstFormat * format,
     *duration =
         g_value_get_int64 (gst_structure_get_value (structure, "duration"));
 }
+
+/**
+ * gst_message_parse_async_start:
+ * @message: A valid #GstMessage of type GST_MESSAGE_ASYNC_DONE.
+ * @new_base_time: Result location for the new_base_time or NULL
+ *
+ * Extract the new_base_time from the async_start message. 
+ *
+ * MT safe.
+ *
+ * Since: 0.10.13
+ */
+void
+gst_message_parse_async_start (GstMessage * message, gboolean * new_base_time)
+{
+  const GstStructure *structure;
+
+  g_return_if_fail (GST_IS_MESSAGE (message));
+  g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ASYNC_START);
+
+  structure = gst_message_get_structure (message);
+  if (new_base_time)
+    *new_base_time =
+        g_value_get_boolean (gst_structure_get_value (structure,
+            "new-base-time"));
+}
index 7853063..434d675 100644 (file)
@@ -55,6 +55,10 @@ typedef struct _GstMessageClass GstMessageClass;
  * @GST_MESSAGE_SEGMENT_START: pipeline started playback of a segment.
  * @GST_MESSAGE_SEGMENT_DONE: pipeline completed playback of a segment.
  * @GST_MESSAGE_DURATION: The duration of a pipeline changed.
+ * @GST_MESSAGE_ASYNC_START: Posted by elements when they start an ASYNC state
+ * change. Since: 0.10.13
+ * @GST_MESSAGE_ASYNC_DONE: Posted by elements when they complete an ASYNC state
+ * change. Since: 0.10.13
  * @GST_MESSAGE_LATENCY: Posted by elements when their latency changes. The
  * pipeline will calculate and distribute a new latency. Since: 0.10.12
  * @GST_MESSAGE_ANY: mask for all of the above messages.
@@ -87,6 +91,8 @@ typedef enum
   GST_MESSAGE_SEGMENT_DONE      = (1 << 17),
   GST_MESSAGE_DURATION          = (1 << 18),
   GST_MESSAGE_LATENCY           = (1 << 19),
+  GST_MESSAGE_ASYNC_START       = (1 << 20),
+  GST_MESSAGE_ASYNC_DONE        = (1 << 21),
   GST_MESSAGE_ANY               = ~0
 } GstMessageType;
 
@@ -263,6 +269,8 @@ GstMessage *        gst_message_new_element         (GstObject * src, GstStructure * structure
 GstMessage *   gst_message_new_segment_start   (GstObject * src, GstFormat format, gint64 position);
 GstMessage *   gst_message_new_segment_done    (GstObject * src, GstFormat format, gint64 position);
 GstMessage *   gst_message_new_duration        (GstObject * src, GstFormat format, gint64 duration);
+GstMessage *   gst_message_new_async_start     (GstObject * src, gboolean new_base_time);
+GstMessage *   gst_message_new_async_done      (GstObject * src);
 GstMessage *   gst_message_new_latency         (GstObject * src);
 GstMessage *   gst_message_new_custom          (GstMessageType type,
                                                 GstObject    * src,
@@ -281,6 +289,7 @@ void                gst_message_parse_new_clock     (GstMessage *message, GstClock **clock);
 void           gst_message_parse_segment_start (GstMessage *message, GstFormat *format, gint64 *position);
 void           gst_message_parse_segment_done  (GstMessage *message, GstFormat *format, gint64 *position);
 void           gst_message_parse_duration      (GstMessage *message, GstFormat *format, gint64 *duration);
+void           gst_message_parse_async_start   (GstMessage *message, gboolean *new_base_time);
 
 const GstStructure *  gst_message_get_structure        (GstMessage *message);