diff options
author | Alex Ashley <bugzilla@ashley-family.net> | 2014-02-21 09:36:51 +0000 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-02-28 09:37:45 +0100 |
commit | ae87010c259e2f785ddb4a39fdc7601d809f7fc9 (patch) | |
tree | 1c1a5646553ea053bc63a63200206d378d58d9f6 | |
parent | 10744b91436104be4f31874064d587dee19aab94 (diff) | |
download | gstreamer-plugins-bad-ae87010c259e2f785ddb4a39fdc7601d809f7fc9.tar.gz |
hlsdemux: Fix parsing of CODECS and RESOLUTION
hlsdemux does not check for the '"' character in #EXT-X-STREAM-INF
attributes. The CODECS parameter is an example of an attribute
that might use the '"' symbol and might contain a ',' character
inside this quoted string.
For example: CODECS="avc1.77.30, mp4a.40.2"
hlsdemux does not correctly parse the RESOLUTION attribute, it
assumes that an '=' character is used to delineate the width
and height values, but the HLS RFC states that a 'x' character
must be used as the delimiter between width and height.
https://bugzilla.gnome.org/show_bug.cgi?id=725140
-rw-r--r-- | ext/hls/m3u8.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c index 91d00bcb6..bde93348e 100644 --- a/ext/hls/m3u8.c +++ b/ext/hls/m3u8.c @@ -169,7 +169,7 @@ double_from_string (gchar * ptr, gchar ** endptr, gdouble * val) static gboolean parse_attributes (gchar ** ptr, gchar ** a, gchar ** v) { - gchar *end, *p; + gchar *end=NULL, *p; g_return_val_if_fail (ptr != NULL, FALSE); g_return_val_if_fail (*ptr != NULL, FALSE); @@ -180,6 +180,19 @@ parse_attributes (gchar ** ptr, gchar ** a, gchar ** v) *a = *ptr; end = p = g_utf8_strchr (*ptr, -1, ','); + if(end){ + gchar *q = g_utf8_strchr (*ptr, -1, '"'); + if(q && q<end){ + /* special case, such as CODECS="avc1.77.30, mp4a.40.2" */ + q = g_utf8_next_char (q); + if(q){ + q = g_utf8_strchr (q, -1, '"'); + } + if(q){ + end = p = g_utf8_strchr (q, -1, ','); + } + } + } if (end) { do { end = g_utf8_next_char (end); @@ -392,7 +405,7 @@ gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated) } else if (g_str_equal (a, "RESOLUTION")) { if (!int_from_string (v, &v, &list->width)) GST_WARNING ("Error while reading RESOLUTION width"); - if (!v || *v != '=') { + if (!v || *v != 'x') { GST_WARNING ("Missing height"); } else { v = g_utf8_next_char (v); |