summaryrefslogtreecommitdiff
path: root/ext/hls/m3u8.c
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-02-12 14:10:02 +0100
committerSebastian Dröge <sebastian@centricular.com>2014-02-12 14:10:02 +0100
commitdc45d236d2d160099f439637b59275d0b967d524 (patch)
treead508a8567dce29fde604e3a6339b422067a760d /ext/hls/m3u8.c
parenta84220a65820f4a2d1b1e88a5ea48b3ed1ae8a6e (diff)
downloadgstreamer-plugins-bad-dc45d236d2d160099f439637b59275d0b967d524.tar.gz
hlsdemux: Use g_ascii_xdigit_value() instead of our own version of it
Diffstat (limited to 'ext/hls/m3u8.c')
-rw-r--r--ext/hls/m3u8.c54
1 files changed, 5 insertions, 49 deletions
diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c
index 7796e7698..5bdcc4b13 100644
--- a/ext/hls/m3u8.c
+++ b/ext/hls/m3u8.c
@@ -214,53 +214,6 @@ gst_m3u8_compare_playlist_by_bitrate (gconstpointer a, gconstpointer b)
return ((GstM3U8 *) (a))->bandwidth - ((GstM3U8 *) (b))->bandwidth;
}
-static gint
-hex_char_to_int (const gchar * v)
-{
- switch (*v) {
- case '0':
- return 0;
- case '1':
- return 1;
- case '2':
- return 2;
- case '3':
- return 3;
- case '4':
- return 4;
- case '5':
- return 5;
- case '6':
- return 6;
- case '7':
- return 7;
- case '8':
- return 8;
- case '9':
- return 9;
- case 'A':
- case 'a':
- return 0xa;
- case 'B':
- case 'b':
- return 0xb;
- case 'C':
- case 'c':
- return 0xc;
- case 'D':
- case 'd':
- return 0xd;
- case 'E':
- case 'e':
- return 0xe;
- case 'F':
- case 'f':
- return 0xf;
- default:
- return -1;
- }
-}
-
/*
* @data: a m3u8 playlist text data, taking ownership
*/
@@ -451,14 +404,17 @@ gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated)
for (i = 0; i < 16; i++) {
gint h, l;
- h = hex_char_to_int (ivp++);
- l = hex_char_to_int (ivp++);
+ h = g_ascii_xdigit_value (*ivp);
+ ivp++;
+ l = g_ascii_xdigit_value (*ivp);
+ ivp++;
if (h == -1 || l == -1) {
i = -1;
break;
}
iv[i] = (h << 4) | l;
}
+
if (i == -1) {
GST_WARNING ("Can't read IV");
continue;