changeset 3078:3f023c46e40c

neon: Add support for icy-br.
author William Pitcock <nenolod@atheme.org>
date Mon, 27 Apr 2009 05:39:42 -0500
parents d58963762734
children 1637a04513dd
files src/neon/neon.c src/neon/neon.h
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/neon/neon.c	Mon Apr 27 04:47:07 2009 -0500
+++ b/src/neon/neon.c	Mon Apr 27 05:39:42 2009 -0500
@@ -466,6 +466,14 @@
             h->icy_metadata.stream_name = g_strdup(value);
         }
 
+        if (neon_strcmp(name, "icy-br")) {
+            /*
+             * The server sent us a bitrate. We might want to use it.
+             */
+            _DEBUG("ICY bitrate: %d", atoi(value);
+            h->icy_metadata.stream_bitrate = atoi(value);
+        }
+
         continue;
     }
 
@@ -1364,6 +1372,10 @@
         _LEAVE g_strdup(h->icy_metadata.stream_contenttype);
     }
 
+    if (neon_strcmp(field, "content-bitrate")) {
+        _LEAVE g_strdup_printf("%d", h->icy_metadata.stream_bitrate * 1000);
+    }
+
     _LEAVE NULL;
 }
 
--- a/src/neon/neon.h	Mon Apr 27 04:47:07 2009 -0500
+++ b/src/neon/neon.h	Mon Apr 27 05:39:42 2009 -0500
@@ -49,6 +49,7 @@
     gchar* stream_title;
     gchar* stream_url;
     gchar* stream_contenttype;
+    gint   stream_bitrate;
 };
 
 struct neon_handle {