matroskaparse: send global tags

Global tags are already being read in matroskaparse, but they are not
currently being sent.

This patch makes global tags get sent incrementally whenever new ones
are found.

https://bugzilla.gnome.org/show_bug.cgi?id=746242
This commit is contained in:
Ramiro Polla 2015-03-14 17:07:05 +01:00 committed by Thiago Santos
parent fb5394dbf0
commit af45021036
3 changed files with 30 additions and 0 deletions

View file

@ -1071,6 +1071,27 @@ gst_matroska_parse_handle_src_query (GstPad * pad, GstObject * parent,
return ret;
}
static void
gst_matroska_parse_send_tags (GstMatroskaParse * parse)
{
if (G_UNLIKELY (parse->common.global_tags_changed)) {
GstEvent *tag_event;
gst_tag_list_add (parse->common.global_tags, GST_TAG_MERGE_REPLACE,
GST_TAG_CONTAINER_FORMAT, "Matroska", NULL);
GST_DEBUG_OBJECT (parse, "Sending global_tags %p : %" GST_PTR_FORMAT,
parse->common.global_tags, parse->common.global_tags);
/* Send a copy as we want to keep our local ref writable to add more tags
* if any are found */
tag_event =
gst_event_new_tag (gst_tag_list_copy (parse->common.global_tags));
gst_pad_push_event (parse->srcpad, tag_event);
parse->common.global_tags_changed = FALSE;
}
}
/* returns FALSE if there are no pads to deliver event to,
* otherwise TRUE (whatever the outcome of event sending),
* takes ownership of the passed event! */
@ -2567,6 +2588,8 @@ gst_matroska_parse_parse_id (GstMatroskaParse * parse, guint32 id,
if (!parse->common.segmentinfo_parsed) {
ret = gst_matroska_read_common_parse_info (&parse->common,
GST_ELEMENT_CAST (parse), &ebml);
if (ret == GST_FLOW_OK)
gst_matroska_parse_send_tags (parse);
}
gst_matroska_parse_accumulate_streamheader (parse, ebml.buf);
break;
@ -2660,6 +2683,8 @@ gst_matroska_parse_parse_id (GstMatroskaParse * parse, guint32 id,
if (!parse->common.attachments_parsed) {
ret = gst_matroska_read_common_parse_attachments (&parse->common,
GST_ELEMENT_CAST (parse), &ebml);
if (ret == GST_FLOW_OK)
gst_matroska_parse_send_tags (parse);
}
gst_matroska_parse_output (parse, ebml.buf, FALSE);
break;
@ -2667,6 +2692,8 @@ gst_matroska_parse_parse_id (GstMatroskaParse * parse, guint32 id,
GST_READ_CHECK (gst_matroska_parse_take (parse, read, &ebml));
ret = gst_matroska_read_common_parse_metadata (&parse->common,
GST_ELEMENT_CAST (parse), &ebml);
if (ret == GST_FLOW_OK)
gst_matroska_parse_send_tags (parse);
gst_matroska_parse_accumulate_streamheader (parse, ebml.buf);
break;
case GST_MATROSKA_ID_CHAPTERS:

View file

@ -452,6 +452,7 @@ gst_matroska_read_common_found_global_tag (GstMatroskaReadCommon * common,
} else {
common->global_tags = taglist;
}
common->global_tags_changed = TRUE;
}
gint64
@ -2923,6 +2924,7 @@ gst_matroska_read_common_reset (GstElement * element,
ctx->chapters_parsed = FALSE;
/* tags */
ctx->global_tags_changed = FALSE;
g_list_foreach (ctx->tags_parsed,
(GFunc) gst_matroska_read_common_free_parsed_el, NULL);
g_list_free (ctx->tags_parsed);

View file

@ -90,6 +90,7 @@ typedef struct _GstMatroskaReadCommon {
GstSegment segment;
GstTagList *global_tags;
gboolean global_tags_changed;
/* pull mode caching */
GstBuffer *cached_buffer;