summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-03-09 15:20:05 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2009-03-09 15:20:05 +0100
commitaf7aaef37ac5521e12684192507653741e85d812 (patch)
tree162be5dd72cefbee72fb6e1abafbb0e30f4588bb /gst
parent36e4c9fc9d5bd37e911eb86193bda335d1f865c6 (diff)
qtdemux: sanitize tag names
Sanitize the tag names before turning them into a structure name. We can only add alphanumeric values as the structure name.
Diffstat (limited to 'gst')
-rw-r--r--gst/qtdemux/qtdemux.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index 1cff4148..dcfdaafa 100644
--- a/gst/qtdemux/qtdemux.c
+++ b/gst/qtdemux/qtdemux.c
@@ -4207,6 +4207,8 @@ qtdemux_tag_add_blob (GNode * node, GstQTDemux * demux)
GstBuffer *buf;
gchar *media_type, *style;
GstCaps *caps;
+ guint i;
+ guint8 ndata[4];
data = node->data;
len = QT_UINT32 (data);
@@ -4223,10 +4225,19 @@ qtdemux_tag_add_blob (GNode * node, GstQTDemux * demux)
else
style = "iso";
+ /* santize the name for the caps. */
+ for (i = 0; i < 4; i++) {
+ guint8 d = data[4 + i];
+ if (g_ascii_isalnum (d))
+ ndata[i] = g_ascii_tolower (d);
+ else
+ ndata[i] = '_';
+ }
+
media_type = g_strdup_printf ("application/x-gst-qt-%c%c%c%c-tag",
- (data[4] == 0xa9) ? '_' : g_ascii_tolower (data[4]),
- g_ascii_tolower (data[5]), g_ascii_tolower (data[6]),
- g_ascii_tolower (data[7]));
+ 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);
gst_buffer_set_caps (buf, caps);
gst_caps_unref (caps);