qtmux: store stream and container tags separately

Tags received via events, when marked as stream tags, will
be stored on that stream's trak atom instead of being stored
in the main tags atom. This allows the resulting file to have
global and stream tags stored.

https://bugzilla.gnome.org/show_bug.cgi?id=692473
This commit is contained in:
Thiago Santos 2015-01-31 14:32:34 -03:00
parent 6321cdedb3
commit e52b2cb2cf
2 changed files with 31 additions and 1 deletions

View file

@ -388,6 +388,11 @@ gst_qt_mux_pad_reset (GstQTPad * qtpad)
if (qtpad->last_buf) if (qtpad->last_buf)
gst_buffer_replace (&qtpad->last_buf, NULL); gst_buffer_replace (&qtpad->last_buf, NULL);
if (qtpad->tags) {
gst_tag_list_unref (qtpad->tags);
qtpad->tags = NULL;
}
/* reference owned elsewhere */ /* reference owned elsewhere */
qtpad->trak = NULL; qtpad->trak = NULL;
@ -1212,6 +1217,7 @@ static void
gst_qt_mux_setup_metadata (GstQTMux * qtmux) gst_qt_mux_setup_metadata (GstQTMux * qtmux)
{ {
const GstTagList *tags; const GstTagList *tags;
GSList *walk;
GST_OBJECT_LOCK (qtmux); GST_OBJECT_LOCK (qtmux);
tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (qtmux)); tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (qtmux));
@ -1235,6 +1241,20 @@ gst_qt_mux_setup_metadata (GstQTMux * qtmux)
GST_DEBUG_OBJECT (qtmux, "No tags received"); GST_DEBUG_OBJECT (qtmux, "No tags received");
} }
for (walk = qtmux->sinkpads; walk; walk = g_slist_next (walk)) {
GstCollectData *cdata = (GstCollectData *) walk->data;
GstQTPad *qpad = (GstQTPad *) cdata;
GstPad *pad = qpad->collect.pad;
if (qpad->tags) {
GST_DEBUG_OBJECT (pad, "Adding tags");
gst_tag_list_remove_tag (qpad->tags, GST_TAG_CONTAINER_FORMAT);
gst_qt_mux_add_metadata_tags (qtmux, qpad->tags, &qpad->trak->udta);
GST_DEBUG_OBJECT (pad, "Tags added");
} else {
GST_DEBUG_OBJECT (pad, "No tags received");
}
}
} }
static inline GstBuffer * static inline GstBuffer *
@ -3397,15 +3417,23 @@ gst_qt_mux_sink_event (GstCollectPads * pads, GstCollectData * data,
GstTagSetter *setter = GST_TAG_SETTER (qtmux); GstTagSetter *setter = GST_TAG_SETTER (qtmux);
GstTagMergeMode mode; GstTagMergeMode mode;
gchar *code; gchar *code;
GstQTPad *collect_pad;
GST_OBJECT_LOCK (qtmux); GST_OBJECT_LOCK (qtmux);
mode = gst_tag_setter_get_tag_merge_mode (setter); mode = gst_tag_setter_get_tag_merge_mode (setter);
collect_pad = (GstQTPad *) gst_pad_get_element_private (pad);
gst_event_parse_tag (event, &list); gst_event_parse_tag (event, &list);
GST_DEBUG_OBJECT (qtmux, "received tag event on pad %s:%s : %" GST_DEBUG_OBJECT (qtmux, "received tag event on pad %s:%s : %"
GST_PTR_FORMAT, GST_DEBUG_PAD_NAME (pad), list); GST_PTR_FORMAT, GST_DEBUG_PAD_NAME (pad), list);
if (gst_tag_list_get_scope (list) == GST_TAG_SCOPE_GLOBAL) {
gst_tag_setter_merge_tags (setter, list, mode); gst_tag_setter_merge_tags (setter, list, mode);
} else {
if (!collect_pad->tags)
collect_pad->tags = gst_tag_list_new_empty ();
gst_tag_list_insert (collect_pad->tags, list, mode);
}
GST_OBJECT_UNLOCK (qtmux); GST_OBJECT_UNLOCK (qtmux);
if (gst_tag_list_get_uint (list, GST_TAG_BITRATE, &avg_bitrate) | if (gst_tag_list_get_uint (list, GST_TAG_BITRATE, &avg_bitrate) |

View file

@ -128,6 +128,8 @@ struct _GstQTPad
/* optional fragment index book-keeping */ /* optional fragment index book-keeping */
AtomTFRA *tfra; AtomTFRA *tfra;
GstTagList *tags;
/* if nothing is set, it won't be called */ /* if nothing is set, it won't be called */
GstQTPadPrepareBufferFunc prepare_buf_func; GstQTPadPrepareBufferFunc prepare_buf_func;
GstQTPadSetCapsFunc set_caps; GstQTPadSetCapsFunc set_caps;