GstFlowReturn ret;
guint32 id, riff_fourcc = 0;
guint16 riff_audio_fmt = 0;
- GstTagList *list = NULL;
GstEvent *stream_start;
gchar *codec = NULL;
gchar *stream_id;
context->alignment = 1;
context->dts_only = FALSE;
context->intra_only = FALSE;
+ context->tags = gst_tag_list_new_empty ();
demux->common.num_streams++;
g_assert (demux->common.src->len == demux->common.num_streams);
context->codec_priv_size, &codec, &riff_fourcc);
if (codec) {
- list = gst_tag_list_new (GST_TAG_VIDEO_CODEC, codec, NULL);
+ gst_tag_list_add (context->tags, GST_TAG_MERGE_REPLACE,
+ GST_TAG_VIDEO_CODEC, codec, NULL);
+ context->tags_changed = TRUE;
g_free (codec);
}
break;
&codec, &riff_audio_fmt);
if (codec) {
- list = gst_tag_list_new (GST_TAG_AUDIO_CODEC, codec, NULL);
+ gst_tag_list_add (context->tags, GST_TAG_MERGE_REPLACE,
+ GST_TAG_AUDIO_CODEC, codec, NULL);
+ context->tags_changed = TRUE;
g_free (codec);
}
break;
if (context->language) {
const gchar *lang;
- if (!list)
- list = gst_tag_list_new_empty ();
-
/* Matroska contains ISO 639-2B codes, we want ISO 639-1 */
lang = gst_tag_get_language_code (context->language);
- gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
+ gst_tag_list_add (context->tags, GST_TAG_MERGE_REPLACE,
GST_TAG_LANGUAGE_CODE, (lang) ? lang : context->language, NULL);
+ context->tags_changed = TRUE;
}
if (caps == NULL) {
GST_INFO_OBJECT (demux, "Adding pad '%s' with caps %" GST_PTR_FORMAT,
padname, caps);
- context->pending_tags = list;
-
gst_pad_set_element_private (context->pad, context);
gst_pad_use_fixed_caps (context->pad);
stream = g_ptr_array_index (demux->common.src, i);
- if (G_UNLIKELY (stream->pending_tags != NULL)) {
- GST_DEBUG_OBJECT (demux, "Sending pending_tags %p for pad %s:%s : %"
- GST_PTR_FORMAT, stream->pending_tags,
- GST_DEBUG_PAD_NAME (stream->pad), stream->pending_tags);
+ if (G_UNLIKELY (stream->tags_changed)) {
+ GST_DEBUG_OBJECT (demux, "Sending tags %p for pad %s:%s : %"
+ GST_PTR_FORMAT, stream->tags,
+ GST_DEBUG_PAD_NAME (stream->pad), stream->tags);
gst_pad_push_event (stream->pad,
- gst_event_new_tag (stream->pending_tags));
- stream->pending_tags = NULL;
+ gst_event_new_tag (gst_tag_list_copy (stream->tags)));
+ stream->tags_changed = FALSE;
}
}
}
GstMatroskaTrackContext *stream = g_ptr_array_index (common->src, j);
if (stream->uid == tgt) {
- if (stream->pending_tags == NULL)
- stream->pending_tags = gst_tag_list_new_empty ();
-
- gst_tag_list_insert (stream->pending_tags, taglist,
- GST_TAG_MERGE_REPLACE);
+ gst_tag_list_insert (stream->tags, taglist, GST_TAG_MERGE_REPLACE);
+ stream->tags_changed = TRUE;
found = TRUE;
}
}
if (!found) {
- GST_WARNING_OBJECT (common->sinkpad,
+ GST_FIXME_OBJECT (common->sinkpad,
"Found track-specific tag(s), but track %" G_GUINT64_FORMAT
" is not known (yet?)", tgt);
}