Commit c10d39a8 authored by Wim Taymans's avatar Wim Taymans

event: add name to sticky_multi events

The name of the event is used to store multiple sticky events of a certain type
on a pad.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=676859
parent 27e4faa1
......@@ -992,22 +992,26 @@ gst_event_copy_segment (GstEvent * event, GstSegment * segment)
/**
* gst_event_new_tag:
* @name: (transfer none): the name of the event
* @taglist: (transfer full): metadata list. The event will take ownership
* of the taglist.
*
* Generates a metadata tag event from the given @taglist.
*
* Since the TAG event has the %GST_EVENT_TYPE_STICKY_MULTI flag set, the
* @name will be used to keep track of multiple tag events.
*
* Returns: (transfer full): a new #GstEvent
*/
GstEvent *
gst_event_new_tag (GstTagList * taglist)
gst_event_new_tag (const gchar * name, GstTagList * taglist)
{
GstStructure *s;
GValue val = G_VALUE_INIT;
g_return_val_if_fail (taglist != NULL, NULL);
s = gst_structure_new_id_empty (GST_QUARK (EVENT_TAG));
s = gst_structure_new_empty (name);
g_value_init (&val, GST_TYPE_TAG_LIST);
g_value_take_boxed (&val, taglist);
gst_structure_id_take_value (s, GST_QUARK (TAGLIST), &val);
......@@ -1551,19 +1555,22 @@ gst_event_new_reconfigure (void)
/**
* gst_event_new_sink_message:
* @name: a name for the event
* @msg: (transfer none): the #GstMessage to be posted
*
* Create a new sink-message event. The purpose of the sink-message event is
* to instruct a sink to post the message contained in the event synchronized
* with the stream.
*
* @name is used to store multiple sticky events on one pad.
*
* Returns: (transfer full): a new #GstEvent
*
* Since: 0.10.26
*/
/* FIXME 0.11: take ownership of msg for consistency? */
GstEvent *
gst_event_new_sink_message (GstMessage * msg)
gst_event_new_sink_message (const gchar * name, GstMessage * msg)
{
GstEvent *event;
GstStructure *structure;
......@@ -1572,7 +1579,7 @@ gst_event_new_sink_message (GstMessage * msg)
GST_CAT_INFO (GST_CAT_EVENT, "creating sink-message event");
structure = gst_structure_new_id (GST_QUARK (EVENT_SINK_MESSAGE),
structure = gst_structure_new_id (g_quark_from_string (name),
GST_QUARK (MESSAGE), GST_TYPE_MESSAGE, msg, NULL);
event = gst_event_new_custom (GST_EVENT_SINK_MESSAGE, structure);
......@@ -1627,6 +1634,7 @@ gst_event_new_stream_start (void)
/**
* gst_event_new_toc:
* @name: a name for the event
* @toc: #GstToc structure.
* @updated: whether @toc was updated or not.
*
......@@ -1638,7 +1646,7 @@ gst_event_new_stream_start (void)
* Since: 0.10.37
*/
GstEvent *
gst_event_new_toc (GstToc * toc, gboolean updated)
gst_event_new_toc (const gchar * name, GstToc * toc, gboolean updated)
{
GstStructure *toc_struct;
......
......@@ -523,11 +523,11 @@ void gst_event_parse_segment (GstEvent *event, const GstSegme
void gst_event_copy_segment (GstEvent *event, GstSegment *segment);
/* tag event */
GstEvent* gst_event_new_tag (GstTagList *taglist) G_GNUC_MALLOC;
GstEvent* gst_event_new_tag (const gchar *name, GstTagList *taglist) G_GNUC_MALLOC;
void gst_event_parse_tag (GstEvent *event, GstTagList **taglist);
/* TOC event */
GstEvent* gst_event_new_toc (GstToc *toc, gboolean updated);
GstEvent* gst_event_new_toc (const gchar *name, GstToc *toc, gboolean updated);
void gst_event_parse_toc (GstEvent *event, GstToc **toc, gboolean *updated);
......@@ -538,7 +538,7 @@ void gst_event_parse_buffer_size (GstEvent *event, GstFormat *for
gint64 *maxsize, gboolean *async);
/* sink message */
GstEvent* gst_event_new_sink_message (GstMessage *msg) G_GNUC_MALLOC;
GstEvent* gst_event_new_sink_message (const gchar *name, GstMessage *msg) G_GNUC_MALLOC;
void gst_event_parse_sink_message (GstEvent *event, GstMessage **msg);
/* QOS events */
......
......@@ -1407,7 +1407,8 @@ gst_base_parse_post_bitrates (GstBaseParse * parse, gboolean post_min,
parse->priv->max_bitrate);
if (taglist != NULL) {
gst_pad_push_event (parse->srcpad, gst_event_new_tag (taglist));
gst_pad_push_event (parse->srcpad, gst_event_new_tag ("GstParser",
taglist));
}
}
......
......@@ -185,7 +185,7 @@ GST_START_TEST (create_events)
GstTagList *taglist = gst_tag_list_new_empty ();
GstTagList *tl2 = NULL;
event = gst_event_new_tag (taglist);
event = gst_event_new_tag ("test", taglist);
fail_if (taglist == NULL);
fail_if (event == NULL);
fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_TAG);
......
......@@ -278,7 +278,7 @@ GST_START_TEST (test_serializing)
test_toc = NULL;
/* check TOC event handling */
event = gst_event_new_toc (toc, TRUE);
event = gst_event_new_toc ("test", toc, TRUE);
fail_if (event == NULL);
fail_unless (event->type == GST_EVENT_TOC);
ASSERT_MINI_OBJECT_REFCOUNT (GST_MINI_OBJECT (event), "GstEvent", 1);
......
......@@ -504,7 +504,7 @@ GST_START_TEST (test_element_found_tags)
gst_element_set_state (pipeline, GST_STATE_PLAYING);
srcpad = gst_element_get_static_pad (fakesrc, "src");
gst_pad_push_event (srcpad, gst_event_new_tag (list));
gst_pad_push_event (srcpad, gst_event_new_tag ("test", list));
gst_object_unref (srcpad);
bus = gst_element_get_bus (pipeline);
......
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