Index: ext/neon/gstneonhttpsrc.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-bad/ext/neon/gstneonhttpsrc.c,v
retrieving revision 1.11
diff -u -r1.11 gstneonhttpsrc.c
--- ext/neon/gstneonhttpsrc.c	9 Apr 2006 18:30:50 -0000	1.11
+++ ext/neon/gstneonhttpsrc.c	24 Apr 2006 19:37:16 -0000
@@ -22,7 +22,7 @@
 
 #define HTTP_DEFAULT_HOST        "localhost"
 #define HTTP_DEFAULT_PORT        80
-#define HTTPS_DEFAULT_PORT        443
+#define HTTPS_DEFAULT_PORT       443
 
 GST_DEBUG_CATEGORY (neonhttpsrc_debug);
 #define GST_CAT_DEFAULT neonhttpsrc_debug
@@ -41,13 +41,17 @@
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS_ANY);
 
-
 enum
 {
   PROP_0,
   PROP_LOCATION,
   PROP_URI,
-  PROP_PROXY
+  PROP_PROXY,
+  PROP_USER_AGENT,
+  PROP_IRADIO_MODE,
+  PROP_IRADIO_NAME,
+  PROP_IRADIO_GENRE,
+  PROP_IRADIO_URL
 };
 
 static void oom_callback ();
@@ -119,7 +123,7 @@
   gobject_class->finalize = gst_neonhttp_src_finalize;
 
   g_object_class_install_property
-      (G_OBJECT_CLASS (klass), PROP_LOCATION,
+      (gobject_class, PROP_LOCATION,
       g_param_spec_string ("location", "Location",
           "The location. In the form:"
           "\n\t\t\thttp://a.com/file.txt - default port '80' "
@@ -130,19 +134,47 @@
           "", G_PARAM_READWRITE));
 
   g_object_class_install_property
-      (G_OBJECT_CLASS (klass), PROP_URI,
+      (gobject_class, PROP_URI,
       g_param_spec_string ("uri", "Uri",
           "The location in form of a URI (deprecated; use location)",
           "", G_PARAM_READWRITE));
 
   g_object_class_install_property
-      (G_OBJECT_CLASS (klass), PROP_PROXY,
+      (gobject_class, PROP_PROXY,
       g_param_spec_string ("proxy", "Proxy",
           "The proxy. In the form myproxy.mycompany.com:8080. "
           "\n\t\t\tIf nothing is passed g_getenv(\"http_proxy\") will be used "
           "\n\t\t\tIf that http_proxy enviroment var isn't define no proxy is used",
           "", G_PARAM_READWRITE));
 
+  g_object_class_install_property
+      (gobject_class, PROP_USER_AGENT,
+      g_param_spec_string ("user-agent", "User-Agent",
+          "The User-Agent used for connection.",
+          "neonhttpsrc", G_PARAM_READWRITE));
+
+  g_object_class_install_property 
+    (gobject_class, PROP_IRADIO_MODE,
+    g_param_spec_boolean ("iradio-mode", "iradio-mode",
+        "Enable internet radio mode (extraction of shoutcast/icecast metadata)",
+        FALSE, G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      PROP_IRADIO_NAME,
+      g_param_spec_string ("iradio-name",
+          "iradio-name", "Name of the stream", NULL, G_PARAM_READABLE));
+
+  g_object_class_install_property (gobject_class,
+      PROP_IRADIO_GENRE,
+      g_param_spec_string ("iradio-genre",
+          "iradio-genre", "Genre of the stream", NULL, G_PARAM_READABLE));
+
+  g_object_class_install_property (gobject_class,
+      PROP_IRADIO_URL,
+      g_param_spec_string ("iradio-url",
+          "iradio-url",
+          "Homepage URL for radio stream", NULL, G_PARAM_READABLE));
+
   gstbasesrc_class->start = gst_neonhttp_src_start;
   gstbasesrc_class->stop = gst_neonhttp_src_stop;
   gstbasesrc_class->unlock = gst_neonhttp_src_unlock;
@@ -170,6 +202,15 @@
   set_proxy (NULL, &this->proxy, TRUE);
 
   this->adapter = gst_adapter_new ();
+  
+  this->user_agent = g_strdup("neonhttpsrc");
+  
+  this->iradio_mode = FALSE;
+  this->iradio_name = NULL;
+  this->iradio_genre = NULL;
+  this->iradio_url = NULL;
+  this->icy_caps = NULL;
+  this->icy_metaint = 0;
 
   GST_OBJECT_FLAG_UNSET (this, GST_NEONHTTP_SRC_OPEN);
 }
@@ -182,6 +223,30 @@
   ne_uri_free (&this->uri);
   ne_uri_free (&this->proxy);
 
+  if (this->user_agent) {
+    g_free(this->user_agent);
+    this->user_agent = NULL;
+  }
+
+  if (this->iradio_name) {
+    g_free(this->iradio_name);
+    this->iradio_name = NULL;
+  }
+
+  if (this->iradio_genre) {
+    g_free(this->iradio_genre);
+    this->iradio_genre = NULL;
+  }
+
+  if (this->iradio_url) {
+    g_free(this->iradio_url);
+    this->iradio_url = NULL;
+  }
+
+  if (this->icy_caps) {
+    gst_caps_unref (this->icy_caps);
+    this->icy_caps = NULL;
+  }
 
   if (this->request) {
     ne_request_destroy (this->request);
@@ -288,7 +353,11 @@
   if (read > 0) {
 
     if (*outbuf) {
-      gst_buffer_set_caps (*outbuf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
+      if (src->icy_caps) {
+        gst_buffer_set_caps (*outbuf, src->icy_caps);
+      } else {
+        gst_buffer_set_caps (*outbuf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
+      }
     }
 
   } else if (read < 0) {
@@ -344,6 +413,14 @@
 
   src->request = ne_request_create (src->session, "GET", src->uri.path);
 
+  if (src->user_agent) {
+    ne_add_request_header (src->request, "User-Agent", src->user_agent);
+  }
+
+  if (src->iradio_mode) {
+      ne_add_request_header (src->request, "icy-metadata", "1");
+  }
+  
   if (NE_OK != ne_begin_request (src->request)) {
     ret = FALSE;
     goto done;
@@ -357,6 +434,36 @@
     src->content_size = -1;
   }
 
+  if (src->iradio_mode) {
+    /* Icecast stuff */
+    const char *str_value;
+    gint gint_value;
+    
+    str_value = ne_get_response_header (src->request, "icy-metaint");
+    if(str_value) {
+      if (sscanf (str_value, "%d", &gint_value) == 1) {
+          src->icy_metaint = gint_value;
+          src->icy_caps = gst_caps_new_simple ("application/x-icy", 
+                  "metadata-interval", G_TYPE_INT, src->icy_metaint, 
+                  NULL);
+        }
+    }
+    
+    str_value = ne_get_response_header (src->request, "icy-name");
+    if(str_value) {
+      src->iradio_name = g_strdup(str_value);
+    }
+    str_value = ne_get_response_header (src->request, "icy-genre");
+    if(str_value) {
+      src->iradio_genre = g_strdup(str_value);
+    }
+    str_value = ne_get_response_header (src->request, "icy-url");
+    if(str_value) {
+      src->iradio_url = g_strdup(str_value);
+    }
+    
+  }
+
   GST_OBJECT_FLAG_SET (src, GST_NEONHTTP_SRC_OPEN);
 
 done:
@@ -405,6 +512,26 @@
 
   src = GST_NEONHTTP_SRC (bsrc);
 
+  if (src->iradio_name) {
+    g_free(src->iradio_name);
+    src->iradio_name = NULL;
+  }
+
+  if (src->iradio_genre) {
+    g_free(src->iradio_genre);
+    src->iradio_genre = NULL;
+  }
+
+  if (src->iradio_url) {
+    g_free(src->iradio_url);
+    src->iradio_url = NULL;
+  }
+
+  if (src->icy_caps) {
+    gst_caps_unref (src->icy_caps);
+    src->icy_caps = NULL;
+  }
+
   if (src->request) {
     ne_request_destroy (src->request);
     src->request = NULL;
@@ -575,7 +702,24 @@
       }
     }
       break;
+    case PROP_USER_AGENT:
+    {
+      if (this->user_agent) {
+        g_free(this->user_agent);
+        this->user_agent = NULL;
+      }
 
+      if (g_value_get_string (value)) {
+        this->user_agent = g_strdup (g_value_get_string (value));
+      }
+
+      break;
+    }
+    case PROP_IRADIO_MODE:
+    {
+      this->iradio_mode = g_value_get_boolean (value);
+      break;
+    }
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -626,7 +770,23 @@
       }
     }
       break;
-
+    case PROP_USER_AGENT:
+    {
+      g_value_set_string (value, neonhttpsrc->user_agent);
+      break;
+    }
+    case PROP_IRADIO_MODE:
+      g_value_set_boolean (value, neonhttpsrc->iradio_mode);
+      break;
+    case PROP_IRADIO_NAME:
+      g_value_set_string (value, neonhttpsrc->iradio_name);
+      break;
+    case PROP_IRADIO_GENRE:
+      g_value_set_string (value, neonhttpsrc->iradio_genre);
+      break;
+    case PROP_IRADIO_URL:
+      g_value_set_string (value, neonhttpsrc->iradio_url);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
Index: ext/neon/gstneonhttpsrc.h
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-bad/ext/neon/gstneonhttpsrc.h,v
retrieving revision 1.3
diff -u -r1.3 gstneonhttpsrc.h
--- ext/neon/gstneonhttpsrc.h	4 Jan 2006 19:39:10 -0000	1.3
+++ ext/neon/gstneonhttpsrc.h	24 Apr 2006 19:26:38 -0000
@@ -55,6 +55,7 @@
   ne_uri uri;
   gchar *uristr;
   ne_uri proxy;
+  gchar *user_agent;
 
   gboolean ishttps;
 
@@ -64,6 +65,13 @@
 
   gboolean eos;
 
+  /* icecast/audiocast metadata extraction handling */
+  gboolean iradio_mode;
+  gchar *iradio_name;
+  gchar *iradio_genre;
+  gchar *iradio_url;
+  GstCaps *icy_caps;
+  gint icy_metaint;
 };
 
 struct _GstNeonhttpSrcClass {
