From d66263996dcddf057c952ab7a887aa8b33a6a9b3 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 19 Mar 2007 09:55:02 +0000 Subject: [PATCH] Add ASYNC_START and ASYNC_DONE messages to prepare for latency support. 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 | 10 +++++ docs/gst/gstreamer-sections.txt | 4 ++ gst/gstmessage.c | 75 +++++++++++++++++++++++++++++++++ gst/gstmessage.h | 9 ++++ 4 files changed, 98 insertions(+) diff --git a/ChangeLog b/ChangeLog index c01e7a1505..e8034693e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-03-19 Wim Taymans + + * 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 * tools/gst-inspect.c: diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index c4a189dfa9..d5bbdb6c2d 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -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 + GstMessageClass GST_MESSAGE diff --git a/gst/gstmessage.c b/gst/gstmessage.c index e5cf6b3d77..a92da25a0f 100644 --- a/gst/gstmessage.c +++ b/gst/gstmessage.c @@ -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} }; @@ -724,6 +726,53 @@ gst_message_new_duration (GstObject * src, GstFormat format, gint64 duration) return message; } +/** + * 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")); +} diff --git a/gst/gstmessage.h b/gst/gstmessage.h index 7853063d12..434d6759a6 100644 --- a/gst/gstmessage.h +++ b/gst/gstmessage.h @@ -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);