Commit 0e5c1dcf authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠

event: add stream flags to stream-start event

API: gst_event_set_stream_flags()
API: gst_event_parse_stream_flags()
API: GST_STREAM_FLAG_NONE
API: GST_STREAM_FLAG_SPARSE

https://bugzilla.gnome.org/show_bug.cgi?id=600648
parent dd831b81
......@@ -1003,6 +1003,8 @@ gst_event_parse_gap
gst_event_new_stream_start
gst_event_parse_stream_start
gst_event_set_stream_flags
gst_event_parse_stream_flags
gst_event_new_segment
gst_event_parse_segment
......
......@@ -1404,7 +1404,8 @@ gst_event_new_stream_start (const gchar * stream_id)
g_return_val_if_fail (stream_id != NULL, NULL);
s = gst_structure_new_id (GST_QUARK (EVENT_STREAM_START),
GST_QUARK (STREAM_ID), G_TYPE_STRING, stream_id, NULL);
GST_QUARK (STREAM_ID), G_TYPE_STRING, stream_id,
GST_QUARK (FLAGS), GST_TYPE_STREAM_FLAGS, GST_STREAM_FLAG_NONE, NULL);
return gst_event_new_custom (GST_EVENT_STREAM_START, s);
}
......@@ -1435,6 +1436,43 @@ gst_event_parse_stream_start (GstEvent * event, const gchar ** stream_id)
*stream_id = g_value_get_string (val);
}
/**
* gst_event_set_stream_flags:
* @event: a stream-start event
* @flags: the stream flags to set
*
* Since: 1.2
*/
void
gst_event_set_stream_flags (GstEvent * event, GstStreamFlags flags)
{
g_return_if_fail (event != NULL);
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START);
g_return_if_fail (gst_event_is_writable (event));
gst_structure_id_set (GST_EVENT_STRUCTURE (event),
GST_QUARK (FLAGS), GST_TYPE_STREAM_FLAGS, flags, NULL);
}
/**
* gst_event_parse_stream_flags:
* @event: a stream-start event
* @flags: (out): address of variable where to store the stream flags
*
* Since: 1.2
*/
void
gst_event_parse_stream_flags (GstEvent * event, GstStreamFlags * flags)
{
g_return_if_fail (event != NULL);
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START);
if (flags) {
gst_structure_id_get (GST_EVENT_STRUCTURE (event),
GST_QUARK (FLAGS), GST_TYPE_STREAM_FLAGS, flags, NULL);
}
}
/**
* gst_event_new_toc:
* @toc: (transfer none): #GstToc structure.
......
......@@ -366,6 +366,20 @@ typedef enum {
GST_QOS_TYPE_THROTTLE = 2
} GstQOSType;
/**
* GstStreamFlags:
* @GST_STREAM_FLAG_NONE: This stream has no special attributes
* @GST_STREAM_FLAG_SPARSE: This stream is a sparse stream (e.g. a subtitle
* stream), data may flow only in irregular intervals with large gaps in
* between.
*
* Since: 1.2
*/
typedef enum {
GST_STREAM_FLAG_NONE,
GST_STREAM_FLAG_SPARSE = (1 << 0)
} GstStreamFlags;
/**
* GstEvent:
* @mini_object: the parent structure
......@@ -463,6 +477,9 @@ void gst_event_set_seqnum (GstEvent *event, guint32 seqnum
GstEvent * gst_event_new_stream_start (const gchar *stream_id) G_GNUC_MALLOC;
void gst_event_parse_stream_start (GstEvent *event, const gchar **stream_id);
void gst_event_set_stream_flags (GstEvent *event, GstStreamFlags flags);
void gst_event_parse_stream_flags (GstEvent *event, GstStreamFlags *flags);
/* flush events */
GstEvent * gst_event_new_flush_start (void) G_GNUC_MALLOC;
......
......@@ -198,6 +198,27 @@ GST_START_TEST (create_events)
gst_event_unref (event);
}
/* STREAM_START */
{
GstStreamFlags flags = ~GST_STREAM_FLAG_NONE;
event = gst_event_new_stream_start ("7f4b2f0/audio_02");
fail_if (event == NULL);
fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START);
fail_if (GST_EVENT_IS_UPSTREAM (event));
fail_unless (GST_EVENT_IS_DOWNSTREAM (event));
fail_unless (GST_EVENT_IS_SERIALIZED (event));
gst_event_parse_stream_flags (event, &flags);
fail_unless_equals_int (flags, GST_STREAM_FLAG_NONE);
gst_event_set_stream_flags (event, GST_STREAM_FLAG_SPARSE);
gst_event_parse_stream_flags (event, &flags);
fail_unless_equals_int (flags, GST_STREAM_FLAG_SPARSE);
gst_event_ref (event);
ASSERT_CRITICAL (gst_event_set_stream_flags (event, GST_STREAM_FLAG_NONE));
gst_event_unref (event);
gst_event_unref (event);
}
/* NAVIGATION */
{
structure = gst_structure_new ("application/x-gst-navigation", "event",
......
......@@ -473,11 +473,13 @@ EXPORTS
gst_event_parse_segment_done
gst_event_parse_sink_message
gst_event_parse_step
gst_event_parse_stream_flags
gst_event_parse_stream_start
gst_event_parse_tag
gst_event_parse_toc
gst_event_parse_toc_select
gst_event_set_seqnum
gst_event_set_stream_flags
gst_event_type_flags_get_type
gst_event_type_get_flags
gst_event_type_get_name
......@@ -1014,6 +1016,7 @@ EXPORTS
gst_static_pad_template_get_type
gst_stream_error_get_type
gst_stream_error_quark
gst_stream_flags_get_type
gst_stream_status_type_get_type
gst_structure_can_intersect
gst_structure_change_type_get_type
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment