diff --git a/ChangeLog b/ChangeLog index 245ed0c46f..684298d8fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-07-20 Wim Taymans + + * gst/gstmessage.c: (gst_message_new_segment_start), + (gst_message_new_segment_done), (gst_message_parse_segment_start), + (gst_message_parse_segment_done): + * gst/gstmessage.h: + Added a bunch of messages for advanced seeking. + + * gst/parse/grammar.y: + * libs/gst/control/dparammanager.c: (gst_dpman_set_parent), + (gst_dpman_state_changed): + Fix some new-pad -> pad-added signals + 2005-07-20 Ronald S. Bultje * docs/manual/appendix-porting.xml: diff --git a/gst/gstmessage.c b/gst/gstmessage.c index c7cd465137..e0e0d5e480 100644 --- a/gst/gstmessage.c +++ b/gst/gstmessage.c @@ -185,7 +185,9 @@ gst_message_new (GstMessageType type, GstObject * src) /** * gst_message_new_eos: * - * Create a new eos message. + * Create a new eos message. This message is generated and posted in + * the sink elements of a GstBin. The bin will only forward the EOS + * message to the application if all sinks have posted an EOS message. * * Returns: The new eos message. * @@ -208,7 +210,8 @@ gst_message_new_eos (GstObject * src) * @debug: A debugging string for something or other. * * Create a new error message. The message will copy @error and - * @debug. + * @debug. This message is posted by element when a fatal event + * occured. The pipeline will probably (partially) stop. * * Returns: The new error message. * @@ -265,6 +268,7 @@ gst_message_new_warning (GstObject * src, GError * error, gchar * debug) * @tag_list: The tag list for the message. * * Create a new tag message. The message will take ownership of the tag list. + * The message is posted by elements that discovered a new taglist. * * Returns: The new tag message. * @@ -290,7 +294,8 @@ gst_message_new_tag (GstObject * src, GstTagList * tag_list) * @old: The previous state. * @new: The new (current) state. * - * Create a state change message. + * Create a state change message. This message is posted whenever an element changed + * its state. * * Returns: The new state change message. * @@ -314,7 +319,67 @@ gst_message_new_state_changed (GstObject * src, GstElementState old, } /** - * gst_message_new_cistom: + * gst_message_new_segment_start: + * @src: The object originating the message. + * @timestamp: The timestamp of the segment being played + * + * Create a new segment message. This message is posted by elements that + * start playback of a segment as a result of a segment seek. This message + * is not received by the application but is used for maintenance reasons in + * container elements. + * + * Returns: The new segment start message. + * + * MT safe. + */ +GstMessage * +gst_message_new_segment_start (GstObject * src, GstClockTime timestamp) +{ + GstMessage *message; + GstStructure *s; + + message = gst_message_new (GST_MESSAGE_SEGMENT_START, src); + + s = gst_structure_new ("GstMessageSegmentStart", "timestamp", G_TYPE_INT64, + (gint64) timestamp, NULL); + gst_structure_set_parent_refcount (s, &message->mini_object.refcount); + message->structure = s; + + return message; +} + +/** + * gst_message_new_segment_done: + * @src: The object originating the message. + * @timestamp: The timestamp of the segment being played + * + * Create a new segment done message. This message is posted by elements that + * finish playback of a segment as a result of a segment seek. This message + * is received by the application after all elements that posted a segment_start + * have posted the segment_done. + * + * Returns: The new segment done message. + * + * MT safe. + */ +GstMessage * +gst_message_new_segment_done (GstObject * src, GstClockTime timestamp) +{ + GstMessage *message; + GstStructure *s; + + message = gst_message_new (GST_MESSAGE_SEGMENT_DONE, src); + + s = gst_structure_new ("GstMessageSegmentDone", "timestamp", G_TYPE_INT64, + (gint64) timestamp, NULL); + gst_structure_set_parent_refcount (s, &message->mini_object.refcount); + message->structure = s; + + return message; +} + +/** + * gst_message_new_custom: * @src: The object originating the message. * @structure: The structure for the message. The message will take ownership of * the structure. @@ -462,3 +527,51 @@ gst_message_parse_warning (GstMessage * message, GError ** gerror, *debug = g_strdup (gst_structure_get_string (message->structure, "debug")); } + +/** + * gst_message_parse_segment_start: + * @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_START. + * + * Extracts the timestamp from the segment start message. + * + * MT safe. + */ +void +gst_message_parse_segment_start (GstMessage * message, GstClockTime * timestamp) +{ + const GValue *time_gvalue; + + g_return_if_fail (GST_IS_MESSAGE (message)); + g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_SEGMENT_START); + + time_gvalue = gst_structure_get_value (message->structure, "timstamp"); + g_return_if_fail (time_gvalue != NULL); + g_return_if_fail (G_VALUE_TYPE (time_gvalue) == G_TYPE_INT64); + + if (timestamp) + *timestamp = (GstClockTime) g_value_get_int64 (time_gvalue); +} + +/** + * gst_message_parse_segment_done: + * @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_DONE. + * + * Extracts the timestamp from the segment done message. + * + * MT safe. + */ +void +gst_message_parse_segment_done (GstMessage * message, GstClockTime * timestamp) +{ + const GValue *time_gvalue; + + g_return_if_fail (GST_IS_MESSAGE (message)); + g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_SEGMENT_DONE); + + time_gvalue = gst_structure_get_value (message->structure, "timstamp"); + g_return_if_fail (time_gvalue != NULL); + g_return_if_fail (G_VALUE_TYPE (time_gvalue) == G_TYPE_INT64); + + if (timestamp) + *timestamp = (GstClockTime) g_value_get_int64 (time_gvalue); +} diff --git a/gst/gstmessage.h b/gst/gstmessage.h index 29c9e8b11d..d9d4b6d9df 100644 --- a/gst/gstmessage.h +++ b/gst/gstmessage.h @@ -140,6 +140,8 @@ GstMessage * gst_message_new_warning (GstObject * src, GError * error, gchar * GstMessage * gst_message_new_tag (GstObject * src, GstTagList * tag_list); GstMessage * gst_message_new_state_changed (GstObject * src, GstElementState old_state, GstElementState new_state); +GstMessage * gst_message_new_segment_start (GstObject * src, GstClockTime timestamp); +GstMessage * gst_message_new_segment_done (GstObject * src, GstClockTime timestamp); GstMessage * gst_message_new_custom (GstMessageType type, GstObject * src, GstStructure * structure); @@ -151,6 +153,9 @@ void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **d void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list); void gst_message_parse_state_changed (GstMessage *message, GstElementState *old_state, GstElementState *new_state); +void gst_message_parse_segment_start (GstMessage *message, GstClockTime *timestamp); +void gst_message_parse_segment_done (GstMessage *message, GstClockTime *timestamp); + const GstStructure * gst_message_get_structure (GstMessage *message); G_END_DECLS diff --git a/gst/parse/grammar.y b/gst/parse/grammar.y index 7561fa1ca0..2809a6f209 100644 --- a/gst/parse/grammar.y +++ b/gst/parse/grammar.y @@ -417,7 +417,7 @@ gst_parse_perform_delayed_link (GstElement *src, const gchar *src_pad, } else { data->caps = NULL; } - data->signal_id = g_signal_connect (G_OBJECT (src), "new_pad", + data->signal_id = g_signal_connect (G_OBJECT (src), "pad-added", G_CALLBACK (gst_parse_found_pad), data); return TRUE; } diff --git a/libs/gst/control/dparammanager.c b/libs/gst/control/dparammanager.c index 60deb39168..dfbb400de7 100644 --- a/libs/gst/control/dparammanager.c +++ b/libs/gst/control/dparammanager.c @@ -44,7 +44,7 @@ static GstDParamWrapper *gst_dpman_new_wrapper (GstDParamManager * dpman, GstDPMUpdateMethod update_method); static GstDParamWrapper *gst_dpman_get_wrapper (GstDParamManager * dpman, const gchar * dparam_name); -static void gst_dpman_state_change (GstElement * element, gint old_state, +static void gst_dpman_state_changed (GstElement * element, gint old_state, gint new_state, GstDParamManager * dpman); static gboolean gst_dpman_preprocess_synchronous (GstDParamManager * dpman, guint frames, gint64 timestamp); @@ -625,8 +625,8 @@ gst_dpman_set_parent (GstDParamManager * dpman, GstElement * parent) g_hash_table_insert (_element_registry, parent, dpman); gst_object_set_parent (GST_OBJECT (dpman), GST_OBJECT (parent)); - g_signal_connect (G_OBJECT (parent), "state_change", - G_CALLBACK (gst_dpman_state_change), dpman); + g_signal_connect (G_OBJECT (parent), "state_changed", + G_CALLBACK (gst_dpman_state_changed), dpman); } /** @@ -725,7 +725,7 @@ gst_dpman_new_wrapper (GstDParamManager * dpman, static void -gst_dpman_state_change (GstElement * element, gint old_state, gint new_state, +gst_dpman_state_changed (GstElement * element, gint old_state, gint new_state, GstDParamManager * dpman) { GList *dwraps;