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.
diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c
index 591c7e4..992d8c1 100644
--- a/gst/isomp4/gstqtmux.c
+++ b/gst/isomp4/gstqtmux.c
@@ -1112,24 +1112,23 @@
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_buffer_unmap (buf, &map);
- gst_caps_unref (caps);
}
}
}
diff --git a/gst/isomp4/isomp4-plugin.c b/gst/isomp4/isomp4-plugin.c
index 9418e94..b0fe326 100644
--- a/gst/isomp4/isomp4-plugin.c
+++ b/gst/isomp4/isomp4-plugin.c
@@ -44,7 +44,7 @@
/* 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,
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
index bc4c4e5..40ecef2 100644
--- a/gst/isomp4/qtdemux.c
+++ b/gst/isomp4/qtdemux.c
@@ -8570,7 +8570,8 @@
GstBuffer *buf;
gchar *media_type;
const gchar *style;
- GstCaps *caps;
+ GstSample *sample;
+ GstStructure *s;
guint i;
guint8 ndata[4];
@@ -8602,17 +8603,16 @@
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);
}