diff options
Diffstat (limited to 'ext/neon/gstneonhttpsrc.c')
-rw-r--r-- | ext/neon/gstneonhttpsrc.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ext/neon/gstneonhttpsrc.c b/ext/neon/gstneonhttpsrc.c index 0e4f472d6..a20a7e749 100644 --- a/ext/neon/gstneonhttpsrc.c +++ b/ext/neon/gstneonhttpsrc.c @@ -59,6 +59,8 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", #define DEFAULT_AUTOMATIC_REDIRECT TRUE #define DEFAULT_ACCEPT_SELF_SIGNED FALSE #define DEFAULT_NEON_HTTP_DEBUG FALSE +#define DEFAULT_CONNECT_TIMEOUT 0 +#define DEFAULT_READ_TIMEOUT 0 enum { @@ -73,6 +75,8 @@ enum PROP_IRADIO_URL, PROP_AUTOMATIC_REDIRECT, PROP_ACCEPT_SELF_SIGNED, + PROP_CONNECT_TIMEOUT, + PROP_READ_TIMEOUT, #ifndef GST_DISABLE_GST_DEBUG PROP_NEON_HTTP_DEBUG #endif @@ -219,6 +223,30 @@ gst_neonhttp_src_class_init (GstNeonhttpSrcClass * klass) "Accept self-signed SSL/TLS certificates", DEFAULT_ACCEPT_SELF_SIGNED, G_PARAM_READWRITE)); + /** + * GstNeonhttpSrc:connect-timeout + * + * After how many seconds to timeout a connect attempt (0 = default) + * + * Since: 0.10.20 + */ + g_object_class_install_property (gobject_class, PROP_CONNECT_TIMEOUT, + g_param_spec_uint ("connect-timeout", "connect-timeout", + "Value in seconds to timeout a blocking connection (0 = default).", 0, + 3600, DEFAULT_CONNECT_TIMEOUT, G_PARAM_READWRITE)); + + /** + * GstNeonhttpSrc:read-timeout + * + * After how many seconds to timeout a blocking read (0 = default) + * + * Since: 0.10.20 + */ + g_object_class_install_property (gobject_class, PROP_READ_TIMEOUT, + g_param_spec_uint ("read-timeout", "read-timeout", + "Value in seconds to timeout a blocking read (0 = default).", 0, + 3600, DEFAULT_READ_TIMEOUT, G_PARAM_READWRITE)); + #ifndef GST_DISABLE_GST_DEBUG g_object_class_install_property (gobject_class, PROP_NEON_HTTP_DEBUG, @@ -253,6 +281,8 @@ gst_neonhttp_src_init (GstNeonhttpSrc * src, GstNeonhttpSrcClass * g_class) src->user_agent = g_strdup (DEFAULT_USER_AGENT); src->automatic_redirect = DEFAULT_AUTOMATIC_REDIRECT; src->accept_self_signed = DEFAULT_ACCEPT_SELF_SIGNED; + src->connect_timeout = DEFAULT_CONNECT_TIMEOUT; + src->read_timeout = DEFAULT_READ_TIMEOUT; src->cookies = NULL; src->session = NULL; @@ -376,6 +406,12 @@ gst_neonhttp_src_set_property (GObject * object, guint prop_id, case PROP_ACCEPT_SELF_SIGNED: src->accept_self_signed = g_value_get_boolean (value); break; + case PROP_CONNECT_TIMEOUT: + src->connect_timeout = g_value_get_uint (value); + break; + case PROP_READ_TIMEOUT: + src->read_timeout = g_value_get_uint (value); + break; #ifndef GST_DISABLE_GST_DEBUG case PROP_NEON_HTTP_DEBUG: src->neon_http_debug = g_value_get_boolean (value); @@ -450,6 +486,12 @@ gst_neonhttp_src_get_property (GObject * object, guint prop_id, case PROP_ACCEPT_SELF_SIGNED: g_value_set_boolean (value, neonhttpsrc->accept_self_signed); break; + case PROP_CONNECT_TIMEOUT: + g_value_set_uint (value, neonhttpsrc->connect_timeout); + break; + case PROP_READ_TIMEOUT: + g_value_set_uint (value, neonhttpsrc->read_timeout); + break; #ifndef GST_DISABLE_GST_DEBUG case PROP_NEON_HTTP_DEBUG: g_value_set_boolean (value, neonhttpsrc->neon_http_debug); @@ -867,6 +909,14 @@ gst_neonhttp_src_send_request_and_redirect (GstNeonhttpSrc * src, ne_session_create (src->uri.scheme, src->uri.host, src->uri.port); } + if (src->connect_timeout > 0) { + ne_set_connect_timeout (session, src->connect_timeout); + } + + if (src->read_timeout > 0) { + ne_set_read_timeout (session, src->read_timeout); + } + ne_set_session_flag (session, NE_SESSFLAG_ICYPROTO, 1); ne_ssl_set_verify (session, ssl_verify_callback, src); |