From 24bc3c46f9ae814d466e165f9d5d0bd113f6671a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 14 Apr 2013 12:32:06 +0100 Subject: [PATCH] souphttpsrc: add back "iradio-mode" property to disable sending of icecast request headers In 1.0 we now always send the icecast request headers by default, which makes the server send icecasts metadata inserted into the stream if it supports that. However, there are some use cases where this is not desirable, like when just saving a radio stream to disk, so add back the "iradio-mode" property to allow people to disable this. https://bugzilla.gnome.org/show_bug.cgi?id=697984 --- ext/soup/gstsouphttpsrc.c | 20 ++++++++++++++++++-- ext/soup/gstsouphttpsrc.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index 0a3b4c1e73..58210e4c50 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -103,11 +103,13 @@ enum PROP_PROXY_ID, PROP_PROXY_PW, PROP_COOKIES, + PROP_IRADIO_MODE, PROP_TIMEOUT, PROP_EXTRA_HEADERS }; #define DEFAULT_USER_AGENT "GStreamer souphttpsrc " +#define DEFAULT_IRADIO_MODE TRUE static void gst_soup_http_src_uri_handler_init (gpointer g_iface, gpointer iface_data); @@ -234,6 +236,11 @@ gst_soup_http_src_class_init (GstSoupHTTPSrcClass * klass) g_param_spec_boxed ("extra-headers", "Extra Headers", "Extra headers to append to the HTTP request", GST_TYPE_STRUCTURE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, PROP_IRADIO_MODE, + g_param_spec_boolean ("iradio-mode", "iradio-mode", + "Enable internet radio mode (ask server to send shoutcast/icecast " + "metadata interleaved with the actual stream data)", + DEFAULT_IRADIO_MODE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&srctemplate)); @@ -293,6 +300,7 @@ gst_soup_http_src_init (GstSoupHTTPSrc * src) src->proxy_id = NULL; src->proxy_pw = NULL; src->cookies = NULL; + src->iradio_mode = DEFAULT_IRADIO_MODE; src->loop = NULL; src->context = NULL; src->session = NULL; @@ -356,6 +364,9 @@ gst_soup_http_src_set_property (GObject * object, guint prop_id, g_free (src->user_agent); src->user_agent = g_value_dup_string (value); break; + case PROP_IRADIO_MODE: + src->iradio_mode = g_value_get_boolean (value); + break; case PROP_AUTOMATIC_REDIRECT: src->automatic_redirect = g_value_get_boolean (value); break; @@ -454,6 +465,9 @@ gst_soup_http_src_get_property (GObject * object, guint prop_id, case PROP_IS_LIVE: g_value_set_boolean (value, gst_base_src_is_live (GST_BASE_SRC (src))); break; + case PROP_IRADIO_MODE: + g_value_set_boolean (value, src->iradio_mode); + break; case PROP_USER_ID: g_value_set_string (value, src->user_id); break; @@ -1079,8 +1093,10 @@ gst_soup_http_src_build_message (GstSoupHTTPSrc * src) src->session_io_status = GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE; soup_message_headers_append (src->msg->request_headers, "Connection", "close"); - soup_message_headers_append (src->msg->request_headers, "icy-metadata", "1"); - + if (src->iradio_mode) { + soup_message_headers_append (src->msg->request_headers, "icy-metadata", + "1"); + } if (src->cookies) { gchar **cookie; diff --git a/ext/soup/gstsouphttpsrc.h b/ext/soup/gstsouphttpsrc.h index 186c6d0679..491b69d471 100644 --- a/ext/soup/gstsouphttpsrc.h +++ b/ext/soup/gstsouphttpsrc.h @@ -77,6 +77,7 @@ struct _GstSoupHTTPSrc { guint64 request_position; /* Seek to this position. */ /* Shoutcast/icecast metadata extraction handling. */ + gboolean iradio_mode; GstCaps *src_caps; gchar *iradio_name; gchar *iradio_genre;