Commit dd254111 authored by Mark Nauwelaerts's avatar Mark Nauwelaerts

qt(de)mux: pass private blob tags in a sample

... rather than a buffer, and the detailed info in the sample info
rather than caps.
parent af7fee71
......@@ -1112,24 +1112,23 @@ gst_qt_mux_add_metadata_tags (GstQTMux * qtmux, const GstTagList * list)
num_tags = gst_tag_list_get_tag_size (list, GST_QT_DEMUX_PRIVATE_TAG);
for (i = 0; i < num_tags; ++i) {
const GValue *val;
GstSample *sample = NULL;
GstBuffer *buf;
GstCaps *caps = NULL;
const GstStructure *s;
val = gst_tag_list_get_value_index (list, GST_QT_DEMUX_PRIVATE_TAG, i);
buf = (GstBuffer *) gst_value_get_buffer (val);
if (!gst_tag_list_get_sample_index (list, GST_QT_DEMUX_PRIVATE_TAG, i,
&sample))
continue;
buf = gst_sample_get_buffer (sample);
/* FIXME-0.11 */
if (buf && (caps = NULL /*gst_buffer_get_caps (buf) */ )) {
GstStructure *s;
if (buf && (s = gst_sample_get_info (sample))) {
const gchar *style = NULL;
GstMapInfo map;
gst_buffer_map (buf, &map, GST_MAP_READ);
GST_DEBUG_OBJECT (qtmux,
"Found private tag %d/%d; size %" G_GSIZE_FORMAT ", caps %"
GST_PTR_FORMAT, i, num_tags, map.size, caps);
s = gst_caps_get_structure (caps, 0);
"Found private tag %d/%d; size %" G_GSIZE_FORMAT ", info %"
GST_PTR_FORMAT, i, num_tags, map.size, s);
if (s && (style = gst_structure_get_string (s, "style"))) {
/* try to prevent some style tag ending up into another variant
* (todo: make into a list if more cases) */
......@@ -1142,7 +1141,6 @@ gst_qt_mux_add_metadata_tags (GstQTMux * qtmux, const GstTagList * list)
}
}
gst_buffer_unmap (buf, &map);
gst_caps_unref (caps);
}
}
}
......
......@@ -44,7 +44,7 @@ plugin_init (GstPlugin * plugin)
/* ensure private tag is registered */
gst_tag_register (GST_QT_DEMUX_PRIVATE_TAG, GST_TAG_FLAG_META,
GST_TYPE_BUFFER, "QT atom", "unparsed QT tag atom",
GST_TYPE_SAMPLE, "QT atom", "unparsed QT tag atom",
gst_tag_merge_use_first);
gst_tag_register (GST_QT_DEMUX_CLASSIFICATION_TAG, GST_TAG_FLAG_META,
......
......@@ -8570,7 +8570,8 @@ qtdemux_tag_add_blob (GNode * node, GstQTDemux * demux)
GstBuffer *buf;
gchar *media_type;
const gchar *style;
GstCaps *caps;
GstSample *sample;
GstStructure *s;
guint i;
guint8 ndata[4];
......@@ -8602,17 +8603,16 @@ qtdemux_tag_add_blob (GNode * node, GstQTDemux * demux)
ndata[0], ndata[1], ndata[2], ndata[3]);
GST_DEBUG_OBJECT (demux, "media type %s", media_type);
caps = gst_caps_new_simple (media_type, "style", G_TYPE_STRING, style, NULL);
// TODO conver to metadata or ???
// gst_buffer_set_caps (buf, caps);
gst_caps_unref (caps);
s = gst_structure_new (media_type, "style", G_TYPE_STRING, style, NULL);
sample = gst_sample_new (buf, NULL, NULL, s);
gst_buffer_unref (buf);
g_free (media_type);
GST_DEBUG_OBJECT (demux, "adding private tag; size %d, caps %" GST_PTR_FORMAT,
len, caps);
GST_DEBUG_OBJECT (demux, "adding private tag; size %d, info %" GST_PTR_FORMAT,
len, s);
gst_tag_list_add (demux->tag_list, GST_TAG_MERGE_APPEND,
GST_QT_DEMUX_PRIVATE_TAG, buf, NULL);
GST_QT_DEMUX_PRIVATE_TAG, sample, NULL);
gst_buffer_unref (buf);
}
......
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