mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
event: Add format and position to the segment-done event
This commit is contained in:
parent
964ea9eccb
commit
aa2309e54a
9 changed files with 54 additions and 9 deletions
|
@ -1028,6 +1028,7 @@ gst_event_new_toc_select
|
|||
gst_event_parse_toc_select
|
||||
|
||||
gst_event_new_segment_done
|
||||
gst_event_parse_segment_done
|
||||
<SUBSECTION Standard>
|
||||
GstEventClass
|
||||
GST_EVENT
|
||||
|
|
|
@ -1739,7 +1739,9 @@ gst_event_parse_toc_select (GstEvent * event, gchar ** uid)
|
|||
|
||||
/**
|
||||
* gst_event_new_segment_done:
|
||||
|
||||
* @format: The format of the position being done
|
||||
* @position: The position of the segment being done
|
||||
*
|
||||
* Create a new segment-done event. This event is sent by elements that
|
||||
* finish playback of a segment as a result of a segment seek.
|
||||
*
|
||||
|
@ -1748,13 +1750,48 @@ gst_event_parse_toc_select (GstEvent * event, gchar ** uid)
|
|||
* Since: 0.11.0
|
||||
*/
|
||||
GstEvent *
|
||||
gst_event_new_segment_done (void)
|
||||
gst_event_new_segment_done (GstFormat format, gint64 position)
|
||||
{
|
||||
GstEvent *event;
|
||||
GstStructure *structure;
|
||||
|
||||
GST_CAT_INFO (GST_CAT_EVENT, "creating segment-done event");
|
||||
|
||||
event = gst_event_new_custom (GST_EVENT_SEGMENT_DONE, NULL);
|
||||
structure = gst_structure_new_id (GST_QUARK (EVENT_SEGMENT_DONE),
|
||||
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
||||
GST_QUARK (POSITION), G_TYPE_INT64, position, NULL);
|
||||
|
||||
event = gst_event_new_custom (GST_EVENT_SEGMENT_DONE, structure);
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_event_parse_segment_done:
|
||||
* @event: A valid #GstEvent of type GST_EVENT_SEGMENT_DONE.
|
||||
* @format: (out): Result location for the format, or NULL
|
||||
* @position: (out): Result location for the position, or NULL
|
||||
*
|
||||
* Extracts the position and format from the segment done message.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gst_event_parse_segment_done (GstEvent * event, GstFormat * format,
|
||||
gint64 * position)
|
||||
{
|
||||
const GstStructure *structure;
|
||||
const GValue *val;
|
||||
|
||||
g_return_if_fail (event != NULL);
|
||||
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT_DONE);
|
||||
|
||||
structure = gst_event_get_structure (event);
|
||||
|
||||
val = gst_structure_id_get_value (structure, GST_QUARK (FORMAT));
|
||||
if (format != NULL)
|
||||
*format = g_value_get_enum (val);
|
||||
|
||||
val = gst_structure_id_get_value (structure, GST_QUARK (POSITION));
|
||||
if (position != NULL)
|
||||
*position = g_value_get_int64 (val);
|
||||
}
|
||||
|
|
|
@ -577,7 +577,8 @@ GstEvent* gst_event_new_toc_select (const gchar *uid) G_GNUC_MALLOC
|
|||
void gst_event_parse_toc_select (GstEvent *event, gchar **uid);
|
||||
|
||||
/* segment-done event */
|
||||
GstEvent* gst_event_new_segment_done (void) G_GNUC_MALLOC;
|
||||
GstEvent* gst_event_new_segment_done (GstFormat format, gint64 position) G_GNUC_MALLOC;
|
||||
void gst_event_parse_segment_done (GstEvent *event, GstFormat *format, gint64 *position);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ static const gchar *_quark_strings[] = {
|
|||
GST_ELEMENT_METADATA_AUTHOR, "toc", "toc-entry", "updated", "extend-uid",
|
||||
"uid", "tags", "sub-entries", "info", "GstMessageTag", "GstEventTag",
|
||||
"GstMessageResetTime",
|
||||
"GstMessageToc", "GstEventToc"
|
||||
"GstMessageToc", "GstEventToc", "GstEventSegmentDone"
|
||||
};
|
||||
|
||||
GQuark _priv_gst_quark_table[GST_QUARK_MAX];
|
||||
|
|
|
@ -184,7 +184,8 @@ typedef enum _GstQuarkId
|
|||
GST_QUARK_MESSAGE_RESET_TIME = 155,
|
||||
GST_QUARK_MESSAGE_TOC = 156,
|
||||
GST_QUARK_EVENT_TOC = 157,
|
||||
GST_QUARK_MAX = 158
|
||||
GST_QUARK_EVENT_SEGMENT_DONE = 158,
|
||||
GST_QUARK_MAX = 159
|
||||
} GstQuarkId;
|
||||
|
||||
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];
|
||||
|
|
|
@ -2923,7 +2923,8 @@ pause:
|
|||
(GST_ELEMENT_CAST (parse),
|
||||
gst_message_new_segment_done (GST_OBJECT_CAST (parse),
|
||||
GST_FORMAT_TIME, stop));
|
||||
gst_pad_push_event (parse->srcpad, gst_event_new_segment_done ());
|
||||
gst_pad_push_event (parse->srcpad,
|
||||
gst_event_new_segment_done (GST_FORMAT_TIME, stop));
|
||||
} else {
|
||||
/* If we STILL have zero frames processed, fire an error */
|
||||
if (parse->priv->framecount == 0) {
|
||||
|
|
|
@ -3751,7 +3751,9 @@ paused:
|
|||
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
||||
gst_message_new_segment_done (GST_OBJECT_CAST (basesink),
|
||||
basesink->segment.format, basesink->segment.position));
|
||||
gst_base_sink_event (pad, parent, gst_event_new_segment_done ());
|
||||
gst_base_sink_event (pad, parent,
|
||||
gst_event_new_segment_done (basesink->segment.format,
|
||||
basesink->segment.position));
|
||||
} else {
|
||||
gst_base_sink_event (pad, parent, gst_event_new_eos ());
|
||||
}
|
||||
|
|
|
@ -2718,7 +2718,7 @@ pause:
|
|||
format, position);
|
||||
gst_message_set_seqnum (message, src->priv->seqnum);
|
||||
gst_element_post_message (GST_ELEMENT_CAST (src), message);
|
||||
event = gst_event_new_segment_done ();
|
||||
event = gst_event_new_segment_done (format, position);
|
||||
gst_event_set_seqnum (event, src->priv->seqnum);
|
||||
gst_pad_push_event (pad, event);
|
||||
} else {
|
||||
|
|
|
@ -432,6 +432,7 @@ EXPORTS
|
|||
gst_event_new_reconfigure
|
||||
gst_event_new_seek
|
||||
gst_event_new_segment
|
||||
gst_event_new_segment_done
|
||||
gst_event_new_sink_message
|
||||
gst_event_new_step
|
||||
gst_event_new_stream_config
|
||||
|
@ -448,6 +449,7 @@ EXPORTS
|
|||
gst_event_parse_qos
|
||||
gst_event_parse_seek
|
||||
gst_event_parse_segment
|
||||
gst_event_parse_segment_done
|
||||
gst_event_parse_sink_message
|
||||
gst_event_parse_step
|
||||
gst_event_parse_stream_config
|
||||
|
|
Loading…
Reference in a new issue