diff options
-rw-r--r-- | gst/matroska/matroska-parse.c | 27 | ||||
-rw-r--r-- | gst/matroska/matroska-read-common.c | 2 | ||||
-rw-r--r-- | gst/matroska/matroska-read-common.h | 1 |
3 files changed, 30 insertions, 0 deletions
diff --git a/gst/matroska/matroska-parse.c b/gst/matroska/matroska-parse.c index 1e86a252c..0e366134a 100644 --- a/gst/matroska/matroska-parse.c +++ b/gst/matroska/matroska-parse.c @@ -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: diff --git a/gst/matroska/matroska-read-common.c b/gst/matroska/matroska-read-common.c index 59feb9c98..8d3569037 100644 --- a/gst/matroska/matroska-read-common.c +++ b/gst/matroska/matroska-read-common.c @@ -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); diff --git a/gst/matroska/matroska-read-common.h b/gst/matroska/matroska-read-common.h index de2102689..3be954208 100644 --- a/gst/matroska/matroska-read-common.h +++ b/gst/matroska/matroska-read-common.h @@ -90,6 +90,7 @@ typedef struct _GstMatroskaReadCommon { GstSegment segment; GstTagList *global_tags; + gboolean global_tags_changed; /* pull mode caching */ GstBuffer *cached_buffer; |