gst/gstmessage.*: Added a bunch of messages for advanced seeking.

Original commit message from CVS:
* 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
This commit is contained in:
Wim Taymans 2005-07-20 18:02:13 +00:00
parent 8e12a91943
commit e261956ca6
5 changed files with 140 additions and 9 deletions

View file

@ -1,3 +1,16 @@
2005-07-20 Wim Taymans <wim@fluendo.com>
* 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 <rbultje@ronald.bitfreak.net> 2005-07-20 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* docs/manual/appendix-porting.xml: * docs/manual/appendix-porting.xml:

View file

@ -185,7 +185,9 @@ gst_message_new (GstMessageType type, GstObject * src)
/** /**
* gst_message_new_eos: * 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. * Returns: The new eos message.
* *
@ -208,7 +210,8 @@ gst_message_new_eos (GstObject * src)
* @debug: A debugging string for something or other. * @debug: A debugging string for something or other.
* *
* Create a new error message. The message will copy @error and * 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. * 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. * @tag_list: The tag list for the message.
* *
* Create a new tag message. The message will take ownership of the tag list. * 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. * Returns: The new tag message.
* *
@ -290,7 +294,8 @@ gst_message_new_tag (GstObject * src, GstTagList * tag_list)
* @old: The previous state. * @old: The previous state.
* @new: The new (current) 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. * 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. * @src: The object originating the message.
* @structure: The structure for the message. The message will take ownership of * @structure: The structure for the message. The message will take ownership of
* the structure. * the structure.
@ -462,3 +527,51 @@ gst_message_parse_warning (GstMessage * message, GError ** gerror,
*debug = g_strdup (gst_structure_get_string (message->structure, "debug")); *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);
}

View file

@ -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_tag (GstObject * src, GstTagList * tag_list);
GstMessage * gst_message_new_state_changed (GstObject * src, GstElementState old_state, GstMessage * gst_message_new_state_changed (GstObject * src, GstElementState old_state,
GstElementState new_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, GstMessage * gst_message_new_custom (GstMessageType type,
GstObject * src, GstObject * src,
GstStructure * structure); 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_tag (GstMessage *message, GstTagList **tag_list);
void gst_message_parse_state_changed (GstMessage *message, GstElementState *old_state, void gst_message_parse_state_changed (GstMessage *message, GstElementState *old_state,
GstElementState *new_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); const GstStructure * gst_message_get_structure (GstMessage *message);
G_END_DECLS G_END_DECLS

View file

@ -417,7 +417,7 @@ gst_parse_perform_delayed_link (GstElement *src, const gchar *src_pad,
} else { } else {
data->caps = NULL; 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); G_CALLBACK (gst_parse_found_pad), data);
return TRUE; return TRUE;
} }

View file

@ -44,7 +44,7 @@ static GstDParamWrapper *gst_dpman_new_wrapper (GstDParamManager * dpman,
GstDPMUpdateMethod update_method); GstDPMUpdateMethod update_method);
static GstDParamWrapper *gst_dpman_get_wrapper (GstDParamManager * dpman, static GstDParamWrapper *gst_dpman_get_wrapper (GstDParamManager * dpman,
const gchar * dparam_name); 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); gint new_state, GstDParamManager * dpman);
static gboolean gst_dpman_preprocess_synchronous (GstDParamManager * dpman, static gboolean gst_dpman_preprocess_synchronous (GstDParamManager * dpman,
guint frames, gint64 timestamp); guint frames, gint64 timestamp);
@ -625,8 +625,8 @@ gst_dpman_set_parent (GstDParamManager * dpman, GstElement * parent)
g_hash_table_insert (_element_registry, parent, dpman); g_hash_table_insert (_element_registry, parent, dpman);
gst_object_set_parent (GST_OBJECT (dpman), GST_OBJECT (parent)); gst_object_set_parent (GST_OBJECT (dpman), GST_OBJECT (parent));
g_signal_connect (G_OBJECT (parent), "state_change", g_signal_connect (G_OBJECT (parent), "state_changed",
G_CALLBACK (gst_dpman_state_change), dpman); G_CALLBACK (gst_dpman_state_changed), dpman);
} }
/** /**
@ -725,7 +725,7 @@ gst_dpman_new_wrapper (GstDParamManager * dpman,
static void 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) GstDParamManager * dpman)
{ {
GList *dwraps; GList *dwraps;