mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
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.
This commit is contained in:
parent
af7fee714d
commit
dd25411161
3 changed files with 18 additions and 20 deletions
|
@ -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);
|
num_tags = gst_tag_list_get_tag_size (list, GST_QT_DEMUX_PRIVATE_TAG);
|
||||||
for (i = 0; i < num_tags; ++i) {
|
for (i = 0; i < num_tags; ++i) {
|
||||||
const GValue *val;
|
GstSample *sample = NULL;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
GstCaps *caps = NULL;
|
const GstStructure *s;
|
||||||
|
|
||||||
val = gst_tag_list_get_value_index (list, GST_QT_DEMUX_PRIVATE_TAG, i);
|
if (!gst_tag_list_get_sample_index (list, GST_QT_DEMUX_PRIVATE_TAG, i,
|
||||||
buf = (GstBuffer *) gst_value_get_buffer (val);
|
&sample))
|
||||||
|
continue;
|
||||||
|
buf = gst_sample_get_buffer (sample);
|
||||||
|
|
||||||
/* FIXME-0.11 */
|
if (buf && (s = gst_sample_get_info (sample))) {
|
||||||
if (buf && (caps = NULL /*gst_buffer_get_caps (buf) */ )) {
|
|
||||||
GstStructure *s;
|
|
||||||
const gchar *style = NULL;
|
const gchar *style = NULL;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
|
|
||||||
gst_buffer_map (buf, &map, GST_MAP_READ);
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
||||||
GST_DEBUG_OBJECT (qtmux,
|
GST_DEBUG_OBJECT (qtmux,
|
||||||
"Found private tag %d/%d; size %" G_GSIZE_FORMAT ", caps %"
|
"Found private tag %d/%d; size %" G_GSIZE_FORMAT ", info %"
|
||||||
GST_PTR_FORMAT, i, num_tags, map.size, caps);
|
GST_PTR_FORMAT, i, num_tags, map.size, s);
|
||||||
s = gst_caps_get_structure (caps, 0);
|
|
||||||
if (s && (style = gst_structure_get_string (s, "style"))) {
|
if (s && (style = gst_structure_get_string (s, "style"))) {
|
||||||
/* try to prevent some style tag ending up into another variant
|
/* try to prevent some style tag ending up into another variant
|
||||||
* (todo: make into a list if more cases) */
|
* (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_buffer_unmap (buf, &map);
|
||||||
gst_caps_unref (caps);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ plugin_init (GstPlugin * plugin)
|
||||||
|
|
||||||
/* ensure private tag is registered */
|
/* ensure private tag is registered */
|
||||||
gst_tag_register (GST_QT_DEMUX_PRIVATE_TAG, GST_TAG_FLAG_META,
|
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_merge_use_first);
|
||||||
|
|
||||||
gst_tag_register (GST_QT_DEMUX_CLASSIFICATION_TAG, GST_TAG_FLAG_META,
|
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;
|
GstBuffer *buf;
|
||||||
gchar *media_type;
|
gchar *media_type;
|
||||||
const gchar *style;
|
const gchar *style;
|
||||||
GstCaps *caps;
|
GstSample *sample;
|
||||||
|
GstStructure *s;
|
||||||
guint i;
|
guint i;
|
||||||
guint8 ndata[4];
|
guint8 ndata[4];
|
||||||
|
|
||||||
|
@ -8602,17 +8603,16 @@ qtdemux_tag_add_blob (GNode * node, GstQTDemux * demux)
|
||||||
ndata[0], ndata[1], ndata[2], ndata[3]);
|
ndata[0], ndata[1], ndata[2], ndata[3]);
|
||||||
GST_DEBUG_OBJECT (demux, "media type %s", media_type);
|
GST_DEBUG_OBJECT (demux, "media type %s", media_type);
|
||||||
|
|
||||||
caps = gst_caps_new_simple (media_type, "style", G_TYPE_STRING, style, NULL);
|
s = gst_structure_new (media_type, "style", G_TYPE_STRING, style, NULL);
|
||||||
// TODO conver to metadata or ???
|
sample = gst_sample_new (buf, NULL, NULL, s);
|
||||||
// gst_buffer_set_caps (buf, caps);
|
gst_buffer_unref (buf);
|
||||||
gst_caps_unref (caps);
|
|
||||||
g_free (media_type);
|
g_free (media_type);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux, "adding private tag; size %d, caps %" GST_PTR_FORMAT,
|
GST_DEBUG_OBJECT (demux, "adding private tag; size %d, info %" GST_PTR_FORMAT,
|
||||||
len, caps);
|
len, s);
|
||||||
|
|
||||||
gst_tag_list_add (demux->tag_list, GST_TAG_MERGE_APPEND,
|
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);
|
gst_buffer_unref (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue