mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
message: add a new message to reset time
Add a new message to reset the pipeline running_time. Currently reseting the pipeline can only be requested in the async_done message which means that the pipeline needs to be prerolled. It is better to move this to a separate message.
This commit is contained in:
parent
d05ad920ce
commit
8118767c82
5 changed files with 59 additions and 2 deletions
|
@ -2231,3 +2231,52 @@ gst_message_parse_toc (GstMessage * message, GstToc ** toc, gboolean * updated)
|
|||
*updated =
|
||||
__gst_toc_structure_get_updated (GST_MESSAGE_STRUCTURE (message));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_message_new_reset_time:
|
||||
* @src: (transfer none): The object originating the message.
|
||||
* @running_time: the requested running-time
|
||||
*
|
||||
* This message is posted when the pipeline running-time should be reset to
|
||||
* @running_time, like after a flushing seek.
|
||||
*
|
||||
* Returns: (transfer full): The new reset_time message.
|
||||
*
|
||||
* MT safe.
|
||||
*/
|
||||
GstMessage *
|
||||
gst_message_new_reset_time (GstObject * src, GstClockTime running_time)
|
||||
{
|
||||
GstMessage *message;
|
||||
GstStructure *structure;
|
||||
|
||||
structure = gst_structure_new_id (GST_QUARK (MESSAGE_RESET_TIME),
|
||||
GST_QUARK (RUNNING_TIME), G_TYPE_UINT64, running_time, NULL);
|
||||
message = gst_message_new_custom (GST_MESSAGE_RESET_TIME, src, structure);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_message_parse_reset_time:
|
||||
* @message: A valid #GstMessage of type GST_MESSAGE_RESET_TIME.
|
||||
* @running_time: (out): Result location for the running_time or NULL
|
||||
*
|
||||
* Extract the running-time from the RESET_TIME message.
|
||||
*
|
||||
* MT safe.
|
||||
*/
|
||||
void
|
||||
gst_message_parse_reset_time (GstMessage * message, GstClockTime * running_time)
|
||||
{
|
||||
GstStructure *structure;
|
||||
|
||||
g_return_if_fail (GST_IS_MESSAGE (message));
|
||||
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_RESET_TIME);
|
||||
|
||||
structure = GST_MESSAGE_STRUCTURE (message);
|
||||
if (running_time)
|
||||
*running_time =
|
||||
g_value_get_uint64 (gst_structure_id_get_value (structure,
|
||||
GST_QUARK (RUNNING_TIME)));
|
||||
}
|
||||
|
|
|
@ -127,6 +127,7 @@ typedef enum
|
|||
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;
|
||||
|
||||
|
@ -553,6 +554,10 @@ void gst_message_parse_progress (GstMessage * message, GstPro
|
|||
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
|
||||
|
||||
#endif /* __GST_MESSAGE_H__ */
|
||||
|
|
|
@ -62,7 +62,7 @@ static const gchar *_quark_strings[] = {
|
|||
GST_ELEMENT_METADATA_KLASS, GST_ELEMENT_METADATA_DESCRIPTION,
|
||||
GST_ELEMENT_METADATA_AUTHOR, "toc", "toc-entry", "updated", "extend-uid",
|
||||
"uid", "tags", "sub-entries", "info", "info-structure",
|
||||
"time-structure", "GstMessageTag", "GstEventTag"
|
||||
"time-structure", "GstMessageTag", "GstEventTag", "GstMessageResetTime"
|
||||
};
|
||||
|
||||
GQuark _priv_gst_quark_table[GST_QUARK_MAX];
|
||||
|
|
|
@ -183,7 +183,8 @@ typedef enum _GstQuarkId
|
|||
GST_QUARK_TIME_STRUCTURE = 154,
|
||||
GST_QUARK_MESSAGE_TAG = 155,
|
||||
GST_QUARK_EVENT_TAG = 156,
|
||||
GST_QUARK_MAX = 157
|
||||
GST_QUARK_MESSAGE_RESET_TIME = 157,
|
||||
GST_QUARK_MAX = 158
|
||||
} GstQuarkId;
|
||||
|
||||
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];
|
||||
|
|
|
@ -547,6 +547,7 @@ EXPORTS
|
|||
gst_message_new_progress
|
||||
gst_message_new_qos
|
||||
gst_message_new_request_state
|
||||
gst_message_new_reset_time
|
||||
gst_message_new_segment_done
|
||||
gst_message_new_segment_start
|
||||
gst_message_new_state_changed
|
||||
|
@ -572,6 +573,7 @@ EXPORTS
|
|||
gst_message_parse_qos_stats
|
||||
gst_message_parse_qos_values
|
||||
gst_message_parse_request_state
|
||||
gst_message_parse_reset_time
|
||||
gst_message_parse_segment_done
|
||||
gst_message_parse_segment_start
|
||||
gst_message_parse_state_changed
|
||||
|
|
Loading…
Reference in a new issue