From 1523ef681bc90bb85ae91c3b4299b36d6048b1fc Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 3 Mar 2009 12:20:27 +0100 Subject: souphttpsrc: Expose the SoupSession 'timeout' property. --- ext/soup/gstsouphttpsrc.c | 21 +++++++++++++++++---- ext/soup/gstsouphttpsrc.h | 2 ++ 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'ext/soup') diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index 02ff4c81..d145807b 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -117,7 +117,8 @@ enum PROP_IRADIO_NAME, PROP_IRADIO_GENRE, PROP_IRADIO_URL, - PROP_IRADIO_TITLE + PROP_IRADIO_TITLE, + PROP_TIMEOUT }; #define DEFAULT_USER_AGENT "GStreamer souphttpsrc " @@ -276,6 +277,10 @@ gst_soup_http_src_class_init (GstSoupHTTPSrcClass * klass) g_object_class_install_property (gobject_class, PROP_IS_LIVE, g_param_spec_boolean ("is-live", "is-live", "Act like a live source", FALSE, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_TIMEOUT, + g_param_spec_uint ("timeout", "timeout", + "Value in seconds to timeout a blocking I/O (0 = No timeout).", 0, + 3600, 0, G_PARAM_READWRITE)); /* icecast stuff */ g_object_class_install_property (gobject_class, @@ -426,9 +431,6 @@ gst_soup_http_src_set_property (GObject * object, guint prop_id, case PROP_IRADIO_MODE: src->iradio_mode = g_value_get_boolean (value); break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; case PROP_AUTOMATIC_REDIRECT: src->automatic_redirect = g_value_get_boolean (value); break; @@ -475,6 +477,12 @@ gst_soup_http_src_set_property (GObject * object, guint prop_id, g_free (src->proxy_pw); src->proxy_pw = g_value_dup_string (value); break; + case PROP_TIMEOUT: + src->timeout = g_value_get_uint (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; } done: return; @@ -539,6 +547,9 @@ gst_soup_http_src_get_property (GObject * object, guint prop_id, case PROP_PROXY_PW: g_value_set_string (value, src->proxy_pw); break; + case PROP_TIMEOUT: + g_value_set_uint (value, src->timeout); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1118,6 +1129,7 @@ gst_soup_http_src_start (GstBaseSrc * bsrc) src->session = soup_session_async_new_with_options (SOUP_SESSION_ASYNC_CONTEXT, src->context, SOUP_SESSION_USER_AGENT, src->user_agent, + SOUP_SESSION_TIMEOUT, src->timeout, #ifdef HAVE_LIBSOUP_GNOME SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_GNOME, #endif @@ -1126,6 +1138,7 @@ gst_soup_http_src_start (GstBaseSrc * bsrc) src->session = soup_session_async_new_with_options (SOUP_SESSION_ASYNC_CONTEXT, src->context, SOUP_SESSION_PROXY_URI, src->proxy, + SOUP_SESSION_TIMEOUT, src->timeout, SOUP_SESSION_USER_AGENT, src->user_agent, NULL); } diff --git a/ext/soup/gstsouphttpsrc.h b/ext/soup/gstsouphttpsrc.h index 38d670b1..378f49c8 100644 --- a/ext/soup/gstsouphttpsrc.h +++ b/ext/soup/gstsouphttpsrc.h @@ -83,6 +83,8 @@ struct _GstSoupHTTPSrc { gchar *iradio_genre; gchar *iradio_url; gchar *iradio_title; + + guint timeout; }; struct _GstSoupHTTPSrcClass { -- cgit