2 * Copyright (C) 2007-2008 Wouter Cloetens <wouter@mind.be>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more
16 * SECTION:element-souphttpsrc
18 * This plugin reads data from a remote location specified by a URI.
19 * Supported protocols are 'http', 'https'.
21 * An HTTP proxy must be specified by its URL.
22 * If the "http_proxy" environment variable is set, its value is used.
23 * If built with libsoup's GNOME integration features, the GNOME proxy
24 * configuration will be used, or failing that, proxy autodetection.
25 * The #GstSoupHTTPSrc:proxy property can be used to override the default.
27 * In case the #GstSoupHTTPSrc:iradio-mode property is set and the location is
28 * an HTTP resource, souphttpsrc will send special Icecast HTTP headers to the
29 * server to request additional Icecast meta-information.
30 * If the server is not an Icecast server, it will behave as if the
31 * #GstSoupHTTPSrc:iradio-mode property were not set. If it is, souphttpsrc will
32 * output data with a media type of application/x-icy, in which case you will
33 * need to use the #ICYDemux element as follow-up element to extract the Icecast
34 * metadata and to determine the underlying media type.
37 * <title>Example launch line</title>
39 * gst-launch -v souphttpsrc location=https://some.server.org/index.html
40 * ! filesink location=/home/joe/server.html
41 * ]| The above pipeline reads a web page from a server using the HTTPS protocol
42 * and writes it to a local file.
44 * gst-launch -v souphttpsrc user-agent="FooPlayer 0.99 beta"
45 * automatic-redirect=false proxy=http://proxy.intranet.local:8080
46 * location=http://music.foobar.com/demo.mp3 ! mad ! audioconvert
47 * ! audioresample ! alsasink
48 * ]| The above pipeline will read and decode and play an mp3 file from a
49 * web server using the HTTP protocol. If the server sends redirects,
50 * the request fails instead of following the redirect. The specified
51 * HTTP proxy server is used. The User-Agent HTTP request header
52 * is set to a custom string instead of "GStreamer souphttpsrc."
54 * gst-launch -v souphttpsrc location=http://10.11.12.13/mjpeg
55 * do-timestamp=true ! multipartdemux
56 * ! image/jpeg,width=640,height=480 ! matroskamux
57 * ! filesink location=mjpeg.mkv
58 * ]| The above pipeline reads a motion JPEG stream from an IP camera
59 * using the HTTP protocol, encoded as mime/multipart image/jpeg
60 * parts, and writes a Matroska motion JPEG file. The width and
61 * height properties are set in the caps to provide the Matroska
62 * multiplexer with the information to set this in the header.
63 * Timestamps are set on the buffers as they arrive from the camera.
64 * These are used by the mime/multipart demultiplexer to emit timestamps
65 * on the JPEG-encoded video frame buffers. This allows the Matroska
66 * multiplexer to timestamp the frames in the resulting file.
76 #include <stdlib.h> /* atoi() */
78 #include <gst/gstelement.h>
79 #include <gst/gst-i18n-plugin.h>
80 #ifdef HAVE_LIBSOUP_GNOME
81 #include <libsoup/soup-gnome.h>
83 #include <libsoup/soup.h>
85 #include "gstsouphttpsrc.h"
87 #include <gst/tag/tag.h>
89 GST_DEBUG_CATEGORY_STATIC (souphttpsrc_debug);
90 #define GST_CAT_DEFAULT souphttpsrc_debug
92 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
103 PROP_AUTOMATIC_REDIRECT,
114 #define DEFAULT_USER_AGENT "GStreamer souphttpsrc "
116 static void gst_soup_http_src_uri_handler_init (gpointer g_iface,
117 gpointer iface_data);
118 static void gst_soup_http_src_finalize (GObject * gobject);
120 static void gst_soup_http_src_set_property (GObject * object, guint prop_id,
121 const GValue * value, GParamSpec * pspec);
122 static void gst_soup_http_src_get_property (GObject * object, guint prop_id,
123 GValue * value, GParamSpec * pspec);
125 static GstFlowReturn gst_soup_http_src_create (GstPushSrc * psrc,
126 GstBuffer ** outbuf);
127 static gboolean gst_soup_http_src_start (GstBaseSrc * bsrc);
128 static gboolean gst_soup_http_src_stop (GstBaseSrc * bsrc);
129 static gboolean gst_soup_http_src_get_size (GstBaseSrc * bsrc, guint64 * size);
130 static gboolean gst_soup_http_src_is_seekable (GstBaseSrc * bsrc);
131 static gboolean gst_soup_http_src_do_seek (GstBaseSrc * bsrc,
132 GstSegment * segment);
133 static gboolean gst_soup_http_src_query (GstBaseSrc * bsrc, GstQuery * query);
134 static gboolean gst_soup_http_src_unlock (GstBaseSrc * bsrc);
135 static gboolean gst_soup_http_src_unlock_stop (GstBaseSrc * bsrc);
136 static gboolean gst_soup_http_src_set_location (GstSoupHTTPSrc * src,
137 const gchar * uri, GError ** error);
138 static gboolean gst_soup_http_src_set_proxy (GstSoupHTTPSrc * src,
140 static char *gst_soup_http_src_unicodify (const char *str);
141 static gboolean gst_soup_http_src_build_message (GstSoupHTTPSrc * src);
142 static void gst_soup_http_src_cancel_message (GstSoupHTTPSrc * src);
143 static void gst_soup_http_src_queue_message (GstSoupHTTPSrc * src);
144 static gboolean gst_soup_http_src_add_range_header (GstSoupHTTPSrc * src,
146 static void gst_soup_http_src_session_unpause_message (GstSoupHTTPSrc * src);
147 static void gst_soup_http_src_session_pause_message (GstSoupHTTPSrc * src);
148 static void gst_soup_http_src_session_close (GstSoupHTTPSrc * src);
149 static void gst_soup_http_src_parse_status (SoupMessage * msg,
150 GstSoupHTTPSrc * src);
151 static void gst_soup_http_src_chunk_free (gpointer gstbuf);
152 static SoupBuffer *gst_soup_http_src_chunk_allocator (SoupMessage * msg,
153 gsize max_len, gpointer user_data);
154 static void gst_soup_http_src_got_chunk_cb (SoupMessage * msg,
155 SoupBuffer * chunk, GstSoupHTTPSrc * src);
156 static void gst_soup_http_src_response_cb (SoupSession * session,
157 SoupMessage * msg, GstSoupHTTPSrc * src);
158 static void gst_soup_http_src_got_headers_cb (SoupMessage * msg,
159 GstSoupHTTPSrc * src);
160 static void gst_soup_http_src_got_body_cb (SoupMessage * msg,
161 GstSoupHTTPSrc * src);
162 static void gst_soup_http_src_finished_cb (SoupMessage * msg,
163 GstSoupHTTPSrc * src);
164 static void gst_soup_http_src_authenticate_cb (SoupSession * session,
165 SoupMessage * msg, SoupAuth * auth, gboolean retrying,
166 GstSoupHTTPSrc * src);
168 #define gst_soup_http_src_parent_class parent_class
169 G_DEFINE_TYPE_WITH_CODE (GstSoupHTTPSrc, gst_soup_http_src, GST_TYPE_PUSH_SRC,
170 G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
171 gst_soup_http_src_uri_handler_init));
174 gst_soup_http_src_class_init (GstSoupHTTPSrcClass * klass)
176 GObjectClass *gobject_class;
177 GstElementClass *gstelement_class;
178 GstBaseSrcClass *gstbasesrc_class;
179 GstPushSrcClass *gstpushsrc_class;
181 gobject_class = (GObjectClass *) klass;
182 gstelement_class = (GstElementClass *) klass;
183 gstbasesrc_class = (GstBaseSrcClass *) klass;
184 gstpushsrc_class = (GstPushSrcClass *) klass;
186 gobject_class->set_property = gst_soup_http_src_set_property;
187 gobject_class->get_property = gst_soup_http_src_get_property;
188 gobject_class->finalize = gst_soup_http_src_finalize;
190 g_object_class_install_property (gobject_class,
192 g_param_spec_string ("location", "Location",
193 "Location to read from", "",
194 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
195 g_object_class_install_property (gobject_class,
197 g_param_spec_string ("user-agent", "User-Agent",
198 "Value of the User-Agent HTTP request header field",
199 DEFAULT_USER_AGENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
200 g_object_class_install_property (gobject_class,
201 PROP_AUTOMATIC_REDIRECT,
202 g_param_spec_boolean ("automatic-redirect", "automatic-redirect",
203 "Automatically follow HTTP redirects (HTTP Status Code 3xx)",
204 TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
205 g_object_class_install_property (gobject_class,
207 g_param_spec_string ("proxy", "Proxy",
208 "HTTP proxy server URI", "",
209 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
210 g_object_class_install_property (gobject_class,
212 g_param_spec_string ("user-id", "user-id",
213 "HTTP location URI user id for authentication", "",
214 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
215 g_object_class_install_property (gobject_class, PROP_USER_PW,
216 g_param_spec_string ("user-pw", "user-pw",
217 "HTTP location URI user password for authentication", "",
218 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
219 g_object_class_install_property (gobject_class, PROP_PROXY_ID,
220 g_param_spec_string ("proxy-id", "proxy-id",
221 "HTTP proxy URI user id for authentication", "",
222 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
223 g_object_class_install_property (gobject_class, PROP_PROXY_PW,
224 g_param_spec_string ("proxy-pw", "proxy-pw",
225 "HTTP proxy URI user password for authentication", "",
226 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
227 g_object_class_install_property (gobject_class, PROP_COOKIES,
228 g_param_spec_boxed ("cookies", "Cookies", "HTTP request cookies",
229 G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
230 g_object_class_install_property (gobject_class, PROP_IS_LIVE,
231 g_param_spec_boolean ("is-live", "is-live", "Act like a live source",
232 FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
233 g_object_class_install_property (gobject_class, PROP_TIMEOUT,
234 g_param_spec_uint ("timeout", "timeout",
235 "Value in seconds to timeout a blocking I/O (0 = No timeout).", 0,
236 3600, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
237 g_object_class_install_property (gobject_class, PROP_EXTRA_HEADERS,
238 g_param_spec_boxed ("extra-headers", "Extra Headers",
239 "Extra headers to append to the HTTP request",
240 GST_TYPE_STRUCTURE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
242 gst_element_class_add_pad_template (gstelement_class,
243 gst_static_pad_template_get (&srctemplate));
245 gst_element_class_set_static_metadata (gstelement_class, "HTTP client source",
247 "Receive data as a client over the network via HTTP using SOUP",
248 "Wouter Cloetens <wouter@mind.be>");
250 gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_soup_http_src_start);
251 gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_soup_http_src_stop);
252 gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_soup_http_src_unlock);
253 gstbasesrc_class->unlock_stop =
254 GST_DEBUG_FUNCPTR (gst_soup_http_src_unlock_stop);
255 gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_soup_http_src_get_size);
256 gstbasesrc_class->is_seekable =
257 GST_DEBUG_FUNCPTR (gst_soup_http_src_is_seekable);
258 gstbasesrc_class->do_seek = GST_DEBUG_FUNCPTR (gst_soup_http_src_do_seek);
259 gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_soup_http_src_query);
261 gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_soup_http_src_create);
263 GST_DEBUG_CATEGORY_INIT (souphttpsrc_debug, "souphttpsrc", 0,
268 gst_soup_http_src_reset (GstSoupHTTPSrc * src)
270 src->interrupted = FALSE;
272 src->have_size = FALSE;
273 src->seekable = FALSE;
274 src->read_position = 0;
275 src->request_position = 0;
276 src->content_size = 0;
278 gst_caps_replace (&src->src_caps, NULL);
279 g_free (src->iradio_name);
280 src->iradio_name = NULL;
281 g_free (src->iradio_genre);
282 src->iradio_genre = NULL;
283 g_free (src->iradio_url);
284 src->iradio_url = NULL;
288 gst_soup_http_src_init (GstSoupHTTPSrc * src)
292 src->location = NULL;
293 src->automatic_redirect = TRUE;
294 src->user_agent = g_strdup (DEFAULT_USER_AGENT);
297 src->proxy_id = NULL;
298 src->proxy_pw = NULL;
304 proxy = g_getenv ("http_proxy");
305 if (proxy && !gst_soup_http_src_set_proxy (src, proxy)) {
306 GST_WARNING_OBJECT (src,
307 "The proxy in the http_proxy env var (\"%s\") cannot be parsed.",
311 gst_soup_http_src_reset (src);
315 gst_soup_http_src_finalize (GObject * gobject)
317 GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (gobject);
319 GST_DEBUG_OBJECT (src, "finalize");
321 g_free (src->location);
322 g_free (src->user_agent);
323 if (src->proxy != NULL) {
324 soup_uri_free (src->proxy);
326 g_free (src->user_id);
327 g_free (src->user_pw);
328 g_free (src->proxy_id);
329 g_free (src->proxy_pw);
330 g_strfreev (src->cookies);
332 G_OBJECT_CLASS (parent_class)->finalize (gobject);
336 gst_soup_http_src_set_property (GObject * object, guint prop_id,
337 const GValue * value, GParamSpec * pspec)
339 GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (object);
344 const gchar *location;
346 location = g_value_get_string (value);
348 if (location == NULL) {
349 GST_WARNING ("location property cannot be NULL");
352 if (!gst_soup_http_src_set_location (src, location, NULL)) {
353 GST_WARNING ("badly formatted location");
358 case PROP_USER_AGENT:
360 g_free (src->user_agent);
361 src->user_agent = g_value_dup_string (value);
363 case PROP_AUTOMATIC_REDIRECT:
364 src->automatic_redirect = g_value_get_boolean (value);
370 proxy = g_value_get_string (value);
373 GST_WARNING ("proxy property cannot be NULL");
376 if (!gst_soup_http_src_set_proxy (src, proxy)) {
377 GST_WARNING ("badly formatted proxy URI");
383 g_strfreev (src->cookies);
384 src->cookies = g_strdupv (g_value_get_boxed (value));
387 gst_base_src_set_live (GST_BASE_SRC (src), g_value_get_boolean (value));
391 g_free (src->user_id);
392 src->user_id = g_value_dup_string (value);
396 g_free (src->user_pw);
397 src->user_pw = g_value_dup_string (value);
401 g_free (src->proxy_id);
402 src->proxy_id = g_value_dup_string (value);
406 g_free (src->proxy_pw);
407 src->proxy_pw = g_value_dup_string (value);
410 src->timeout = g_value_get_uint (value);
412 case PROP_EXTRA_HEADERS:{
413 const GstStructure *s = gst_value_get_structure (value);
415 if (src->extra_headers)
416 gst_structure_free (src->extra_headers);
418 src->extra_headers = s ? gst_structure_copy (s) : NULL;
422 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
430 gst_soup_http_src_get_property (GObject * object, guint prop_id,
431 GValue * value, GParamSpec * pspec)
433 GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (object);
437 g_value_set_string (value, src->location);
439 case PROP_USER_AGENT:
440 g_value_set_string (value, src->user_agent);
442 case PROP_AUTOMATIC_REDIRECT:
443 g_value_set_boolean (value, src->automatic_redirect);
446 if (src->proxy == NULL)
447 g_value_set_static_string (value, "");
449 char *proxy = soup_uri_to_string (src->proxy, FALSE);
451 g_value_set_string (value, proxy);
456 g_value_set_boxed (value, g_strdupv (src->cookies));
459 g_value_set_boolean (value, gst_base_src_is_live (GST_BASE_SRC (src)));
462 g_value_set_string (value, src->user_id);
465 g_value_set_string (value, src->user_pw);
468 g_value_set_string (value, src->proxy_id);
471 g_value_set_string (value, src->proxy_pw);
474 g_value_set_uint (value, src->timeout);
476 case PROP_EXTRA_HEADERS:
477 gst_value_set_structure (value, src->extra_headers);
480 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
486 gst_soup_http_src_unicodify (const gchar * str)
488 const gchar *env_vars[] = { "GST_ICY_TAG_ENCODING",
489 "GST_TAG_ENCODING", NULL
492 return gst_tag_freeform_string_to_utf8 (str, -1, env_vars);
496 gst_soup_http_src_cancel_message (GstSoupHTTPSrc * src)
498 if (src->msg != NULL) {
499 src->session_io_status = GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_CANCELLED;
500 soup_session_cancel_message (src->session, src->msg, SOUP_STATUS_CANCELLED);
502 src->session_io_status = GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE;
507 gst_soup_http_src_queue_message (GstSoupHTTPSrc * src)
509 soup_session_queue_message (src->session, src->msg,
510 (SoupSessionCallback) gst_soup_http_src_response_cb, src);
511 src->session_io_status = GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_QUEUED;
515 gst_soup_http_src_add_range_header (GstSoupHTTPSrc * src, guint64 offset)
521 soup_message_headers_remove (src->msg->request_headers, "Range");
523 rc = g_snprintf (buf, sizeof (buf), "bytes=%" G_GUINT64_FORMAT "-", offset);
524 if (rc > sizeof (buf) || rc < 0)
526 soup_message_headers_append (src->msg->request_headers, "Range", buf);
528 src->read_position = offset;
533 _append_extra_header (GQuark field_id, const GValue * value, gpointer user_data)
535 GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (user_data);
536 const gchar *field_name = g_quark_to_string (field_id);
537 gchar *field_content = NULL;
539 if (G_VALUE_TYPE (value) == G_TYPE_STRING) {
540 field_content = g_value_dup_string (value);
542 GValue dest = { 0, };
544 g_value_init (&dest, G_TYPE_STRING);
545 if (g_value_transform (value, &dest)) {
546 field_content = g_value_dup_string (&dest);
550 if (field_content == NULL) {
551 GST_ERROR_OBJECT (src, "extra-headers field '%s' contains no value "
552 "or can't be converted to a string", field_name);
556 GST_DEBUG_OBJECT (src, "Appending extra header: \"%s: %s\"", field_name,
558 soup_message_headers_append (src->msg->request_headers, field_name,
561 g_free (field_content);
567 _append_extra_headers (GQuark field_id, const GValue * value,
570 if (G_VALUE_TYPE (value) == GST_TYPE_ARRAY) {
571 guint n = gst_value_array_get_size (value);
574 for (i = 0; i < n; i++) {
575 const GValue *v = gst_value_array_get_value (value, i);
577 if (!_append_extra_header (field_id, v, user_data))
580 } else if (G_VALUE_TYPE (value) == GST_TYPE_LIST) {
581 guint n = gst_value_list_get_size (value);
584 for (i = 0; i < n; i++) {
585 const GValue *v = gst_value_list_get_value (value, i);
587 if (!_append_extra_header (field_id, v, user_data))
591 return _append_extra_header (field_id, value, user_data);
599 gst_soup_http_src_add_extra_headers (GstSoupHTTPSrc * src)
601 if (!src->extra_headers)
604 return gst_structure_foreach (src->extra_headers, _append_extra_headers, src);
609 gst_soup_http_src_session_unpause_message (GstSoupHTTPSrc * src)
611 soup_session_unpause_message (src->session, src->msg);
615 gst_soup_http_src_session_pause_message (GstSoupHTTPSrc * src)
617 soup_session_pause_message (src->session, src->msg);
621 gst_soup_http_src_session_close (GstSoupHTTPSrc * src)
624 soup_session_abort (src->session); /* This unrefs the message. */
625 g_object_unref (src->session);
632 gst_soup_http_src_authenticate_cb (SoupSession * session, SoupMessage * msg,
633 SoupAuth * auth, gboolean retrying, GstSoupHTTPSrc * src)
636 /* First time authentication only, if we fail and are called again with retry true fall through */
637 if (msg->status_code == SOUP_STATUS_UNAUTHORIZED) {
638 if (src->user_id && src->user_pw)
639 soup_auth_authenticate (auth, src->user_id, src->user_pw);
640 } else if (msg->status_code == SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED) {
641 if (src->proxy_id && src->proxy_pw)
642 soup_auth_authenticate (auth, src->proxy_id, src->proxy_pw);
648 gst_soup_http_src_headers_foreach (const gchar * name, const gchar * val,
651 GST_DEBUG_OBJECT (src, " %s: %s", name, val);
655 gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
658 GstTagList *tag_list;
661 GHashTable *params = NULL;
663 GST_DEBUG_OBJECT (src, "got headers:");
664 soup_message_headers_foreach (msg->response_headers,
665 gst_soup_http_src_headers_foreach, src);
667 if (msg->status_code == 407 && src->proxy_id && src->proxy_pw)
670 if (src->automatic_redirect && SOUP_STATUS_IS_REDIRECTION (msg->status_code)) {
671 GST_DEBUG_OBJECT (src, "%u redirect to \"%s\"", msg->status_code,
672 soup_message_headers_get_one (msg->response_headers, "Location"));
676 if (msg->status_code == SOUP_STATUS_UNAUTHORIZED)
679 src->session_io_status = GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING;
681 /* Parse Content-Length. */
682 if (soup_message_headers_get_encoding (msg->response_headers) ==
683 SOUP_ENCODING_CONTENT_LENGTH) {
684 newsize = src->request_position +
685 soup_message_headers_get_content_length (msg->response_headers);
686 if (!src->have_size || (src->content_size != newsize)) {
687 src->content_size = newsize;
688 src->have_size = TRUE;
689 src->seekable = TRUE;
690 GST_DEBUG_OBJECT (src, "size = %" G_GUINT64_FORMAT, src->content_size);
692 basesrc = GST_BASE_SRC_CAST (src);
693 basesrc->segment.duration = src->content_size;
694 gst_element_post_message (GST_ELEMENT (src),
695 gst_message_new_duration (GST_OBJECT (src), GST_FORMAT_BYTES,
701 tag_list = gst_tag_list_new_empty ();
704 soup_message_headers_get_one (msg->response_headers,
705 "icy-metaint")) != NULL) {
706 gint icy_metaint = atoi (value);
708 GST_DEBUG_OBJECT (src, "icy-metaint: %s (parsed: %d)", value, icy_metaint);
709 if (icy_metaint > 0) {
711 gst_caps_unref (src->src_caps);
713 src->src_caps = gst_caps_new_simple ("application/x-icy",
714 "metadata-interval", G_TYPE_INT, icy_metaint, NULL);
716 gst_base_src_set_caps (GST_BASE_SRC (src), src->src_caps);
720 soup_message_headers_get_content_type (msg->response_headers,
722 GST_DEBUG_OBJECT (src, "Content-Type: %s", value);
723 if (g_ascii_strcasecmp (value, "audio/L16") == 0) {
729 gst_caps_unref (src->src_caps);
731 param = g_hash_table_lookup (params, "channels");
733 channels = atol (param);
735 param = g_hash_table_lookup (params, "rate");
739 src->src_caps = gst_caps_new_simple ("audio/x-raw",
740 "format", G_TYPE_STRING, "S16BE",
741 "layout", G_TYPE_STRING, "interleaved",
742 "channels", G_TYPE_INT, channels, "rate", G_TYPE_INT, rate, NULL);
744 gst_base_src_set_caps (GST_BASE_SRC (src), src->src_caps);
746 /* Set the Content-Type field on the caps */
748 src->src_caps = gst_caps_make_writable (src->src_caps);
749 gst_caps_set_simple (src->src_caps, "content-type", G_TYPE_STRING,
751 gst_base_src_set_caps (GST_BASE_SRC (src), src->src_caps);
757 g_hash_table_destroy (params);
760 soup_message_headers_get_one (msg->response_headers,
761 "icy-name")) != NULL) {
762 g_free (src->iradio_name);
763 src->iradio_name = gst_soup_http_src_unicodify (value);
764 if (src->iradio_name) {
765 gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, GST_TAG_ORGANIZATION,
766 src->iradio_name, NULL);
770 soup_message_headers_get_one (msg->response_headers,
771 "icy-genre")) != NULL) {
772 g_free (src->iradio_genre);
773 src->iradio_genre = gst_soup_http_src_unicodify (value);
774 if (src->iradio_genre) {
775 gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, GST_TAG_GENRE,
776 src->iradio_genre, NULL);
779 if ((value = soup_message_headers_get_one (msg->response_headers, "icy-url"))
781 g_free (src->iradio_url);
782 src->iradio_url = gst_soup_http_src_unicodify (value);
783 if (src->iradio_url) {
784 gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, GST_TAG_LOCATION,
785 src->iradio_url, NULL);
788 if (!gst_tag_list_is_empty (tag_list)) {
789 GST_DEBUG_OBJECT (src,
790 "calling gst_element_found_tags with %" GST_PTR_FORMAT, tag_list);
791 gst_pad_push_event (GST_BASE_SRC_PAD (src), gst_event_new_tag ("GstSrc",
794 gst_tag_list_free (tag_list);
797 /* Handle HTTP errors. */
798 gst_soup_http_src_parse_status (msg, src);
800 /* Check if Range header was respected. */
801 if (src->ret == GST_FLOW_CUSTOM_ERROR &&
802 src->read_position && msg->status_code != SOUP_STATUS_PARTIAL_CONTENT) {
803 src->seekable = FALSE;
804 GST_ELEMENT_ERROR (src, RESOURCE, SEEK,
805 (_("Server does not support seeking.")),
806 ("Server does not accept Range HTTP header, URL: %s", src->location));
807 src->ret = GST_FLOW_ERROR;
811 /* Have body. Signal EOS. */
813 gst_soup_http_src_got_body_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
815 if (G_UNLIKELY (msg != src->msg)) {
816 GST_DEBUG_OBJECT (src, "got body, but not for current message");
819 if (G_UNLIKELY (src->session_io_status !=
820 GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING)) {
821 /* Probably a redirect. */
824 GST_DEBUG_OBJECT (src, "got body");
825 src->ret = GST_FLOW_EOS;
827 g_main_loop_quit (src->loop);
828 gst_soup_http_src_session_pause_message (src);
831 /* Finished. Signal EOS. */
833 gst_soup_http_src_finished_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
835 if (G_UNLIKELY (msg != src->msg)) {
836 GST_DEBUG_OBJECT (src, "finished, but not for current message");
839 GST_DEBUG_OBJECT (src, "finished");
840 src->ret = GST_FLOW_EOS;
841 if (src->session_io_status == GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_CANCELLED) {
842 /* gst_soup_http_src_cancel_message() triggered this; probably a seek
843 * that occurred in the QUEUEING state; i.e. before the connection setup
844 * was complete. Do nothing */
845 } else if (src->session_io_status ==
846 GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING && src->read_position > 0) {
847 /* The server disconnected while streaming. Reconnect and seeking to the
850 src->ret = GST_FLOW_CUSTOM_ERROR;
851 } else if (G_UNLIKELY (src->session_io_status !=
852 GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING)) {
853 /* FIXME: reason_phrase is not translated, add proper error message */
854 GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
855 ("%s", msg->reason_phrase),
856 ("libsoup status code %d", msg->status_code));
859 g_main_loop_quit (src->loop);
862 /* Buffer lifecycle management.
864 * gst_soup_http_src_create() runs the GMainLoop for this element, to let
866 * A GstBuffer is allocated in gst_soup_http_src_chunk_allocator() and
867 * associated with a SoupBuffer.
868 * Soup reads HTTP data in the GstBuffer's data buffer.
869 * The gst_soup_http_src_got_chunk_cb() is then called with the SoupBuffer.
870 * That sets gst_soup_http_src_create()'s return argument to the GstBuffer,
871 * increments its refcount (to 2), pauses the flow of data from the HTTP
872 * source to prevent gst_soup_http_src_got_chunk_cb() from being called
873 * again and breaks out of the GMainLoop.
874 * Because the SOUP_MESSAGE_OVERWRITE_CHUNKS flag is set, Soup frees the
875 * SoupBuffer and calls gst_soup_http_src_chunk_free(), which decrements the
877 * gst_soup_http_src_create() returns the GstBuffer. It will be freed by a
878 * downstream element.
879 * If Soup fails to read HTTP data, it does not call
880 * gst_soup_http_src_got_chunk_cb(), but still frees the SoupBuffer and
881 * calls gst_soup_http_src_chunk_free(), which decrements the GstBuffer's
882 * refcount to 0, freeing it.
892 gst_soup_http_src_chunk_free (gpointer user_data)
894 SoupGstChunk *chunk = (SoupGstChunk *) user_data;
896 gst_buffer_unmap (chunk->buffer, &chunk->map);
897 gst_buffer_unref (chunk->buffer);
898 g_slice_free (SoupGstChunk, chunk);
902 gst_soup_http_src_chunk_allocator (SoupMessage * msg, gsize max_len,
905 GstSoupHTTPSrc *src = (GstSoupHTTPSrc *) user_data;
906 GstBaseSrc *basesrc = GST_BASE_SRC_CAST (src);
914 length = MIN (basesrc->blocksize, max_len);
916 length = basesrc->blocksize;
917 GST_DEBUG_OBJECT (src, "alloc %" G_GSIZE_FORMAT " bytes <= %" G_GSIZE_FORMAT,
920 rc = GST_BASE_SRC_CLASS (parent_class)->alloc (basesrc, -1, length, &gstbuf);
921 if (G_UNLIKELY (rc != GST_FLOW_OK)) {
922 /* Failed to allocate buffer. Stall SoupSession and return error code
925 g_main_loop_quit (src->loop);
929 chunk = g_slice_new0 (SoupGstChunk);
930 chunk->buffer = gstbuf;
931 gst_buffer_map (gstbuf, &chunk->map, GST_MAP_READWRITE);
933 soupbuf = soup_buffer_new_with_owner (chunk->map.data, chunk->map.size,
934 chunk, gst_soup_http_src_chunk_free);
940 gst_soup_http_src_got_chunk_cb (SoupMessage * msg, SoupBuffer * chunk,
941 GstSoupHTTPSrc * src)
944 guint64 new_position;
945 SoupGstChunk *gchunk;
947 if (G_UNLIKELY (msg != src->msg)) {
948 GST_DEBUG_OBJECT (src, "got chunk, but not for current message");
951 if (G_UNLIKELY (src->session_io_status !=
952 GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING)) {
953 /* Probably a redirect. */
956 basesrc = GST_BASE_SRC_CAST (src);
957 GST_DEBUG_OBJECT (src, "got chunk of %" G_GSIZE_FORMAT " bytes",
960 /* Extract the GstBuffer from the SoupBuffer and set its fields. */
961 gchunk = (SoupGstChunk *) soup_buffer_get_owner (chunk);
962 *src->outbuf = gchunk->buffer;
964 gst_buffer_resize (*src->outbuf, 0, chunk->length);
965 GST_BUFFER_OFFSET (*src->outbuf) = basesrc->segment.position;
967 gst_buffer_ref (*src->outbuf);
969 new_position = src->read_position + chunk->length;
970 if (G_LIKELY (src->request_position == src->read_position))
971 src->request_position = new_position;
972 src->read_position = new_position;
974 src->ret = GST_FLOW_OK;
975 g_main_loop_quit (src->loop);
976 gst_soup_http_src_session_pause_message (src);
980 gst_soup_http_src_response_cb (SoupSession * session, SoupMessage * msg,
981 GstSoupHTTPSrc * src)
983 if (G_UNLIKELY (msg != src->msg)) {
984 GST_DEBUG_OBJECT (src, "got response %d: %s, but not for current message",
985 msg->status_code, msg->reason_phrase);
988 if (G_UNLIKELY (src->session_io_status !=
989 GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING)
990 && SOUP_STATUS_IS_REDIRECTION (msg->status_code)) {
991 /* Ignore redirections. */
994 GST_DEBUG_OBJECT (src, "got response %d: %s", msg->status_code,
996 if (src->session_io_status == GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING &&
997 src->read_position > 0) {
998 /* The server disconnected while streaming. Reconnect and seeking to the
1002 gst_soup_http_src_parse_status (msg, src);
1003 /* The session's SoupMessage object expires after this callback returns. */
1005 g_main_loop_quit (src->loop);
1008 #define SOUP_HTTP_SRC_ERROR(src,soup_msg,cat,code,error_message) \
1009 GST_ELEMENT_ERROR ((src), cat, code, ("%s", error_message), \
1010 ("%s (%d), URL: %s", (soup_msg)->reason_phrase, \
1011 (soup_msg)->status_code, (src)->location));
1014 gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src)
1016 if (SOUP_STATUS_IS_TRANSPORT_ERROR (msg->status_code)) {
1017 switch (msg->status_code) {
1018 case SOUP_STATUS_CANT_RESOLVE:
1019 case SOUP_STATUS_CANT_RESOLVE_PROXY:
1020 SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, NOT_FOUND,
1021 _("Could not resolve server name."));
1022 src->ret = GST_FLOW_ERROR;
1024 case SOUP_STATUS_CANT_CONNECT:
1025 case SOUP_STATUS_CANT_CONNECT_PROXY:
1026 SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, OPEN_READ,
1027 _("Could not establish connection to server."));
1028 src->ret = GST_FLOW_ERROR;
1030 case SOUP_STATUS_SSL_FAILED:
1031 SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, OPEN_READ,
1032 _("Secure connection setup failed."));
1033 src->ret = GST_FLOW_ERROR;
1035 case SOUP_STATUS_IO_ERROR:
1036 SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, READ,
1037 _("A network error occured, or the server closed the connection "
1039 src->ret = GST_FLOW_ERROR;
1041 case SOUP_STATUS_MALFORMED:
1042 SOUP_HTTP_SRC_ERROR (src, msg, RESOURCE, READ,
1043 _("Server sent bad data."));
1044 src->ret = GST_FLOW_ERROR;
1046 case SOUP_STATUS_CANCELLED:
1047 /* No error message when interrupted by program. */
1050 } else if (SOUP_STATUS_IS_CLIENT_ERROR (msg->status_code) ||
1051 SOUP_STATUS_IS_REDIRECTION (msg->status_code) ||
1052 SOUP_STATUS_IS_SERVER_ERROR (msg->status_code)) {
1053 /* Report HTTP error. */
1054 /* FIXME: reason_phrase is not translated and not suitable for user
1055 * error dialog according to libsoup documentation.
1056 * FIXME: error code (OPEN_READ vs. READ) should depend on http status? */
1057 GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
1058 ("%s", msg->reason_phrase),
1059 ("%s (%d), URL: %s", msg->reason_phrase, msg->status_code,
1061 src->ret = GST_FLOW_ERROR;
1066 gst_soup_http_src_build_message (GstSoupHTTPSrc * src)
1068 src->msg = soup_message_new (SOUP_METHOD_GET, src->location);
1070 GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
1071 ("Error parsing URL."), ("URL: %s", src->location));
1074 src->session_io_status = GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE;
1075 soup_message_headers_append (src->msg->request_headers, "Connection",
1077 soup_message_headers_append (src->msg->request_headers, "icy-metadata", "1");
1082 for (cookie = src->cookies; *cookie != NULL; cookie++) {
1083 soup_message_headers_append (src->msg->request_headers, "Cookie",
1089 g_signal_connect (src->msg, "got_headers",
1090 G_CALLBACK (gst_soup_http_src_got_headers_cb), src);
1091 g_signal_connect (src->msg, "got_body",
1092 G_CALLBACK (gst_soup_http_src_got_body_cb), src);
1093 g_signal_connect (src->msg, "finished",
1094 G_CALLBACK (gst_soup_http_src_finished_cb), src);
1095 g_signal_connect (src->msg, "got_chunk",
1096 G_CALLBACK (gst_soup_http_src_got_chunk_cb), src);
1097 soup_message_set_flags (src->msg, SOUP_MESSAGE_OVERWRITE_CHUNKS |
1098 (src->automatic_redirect ? 0 : SOUP_MESSAGE_NO_REDIRECT));
1099 soup_message_set_chunk_allocator (src->msg,
1100 gst_soup_http_src_chunk_allocator, src, NULL);
1101 gst_soup_http_src_add_range_header (src, src->request_position);
1103 gst_soup_http_src_add_extra_headers (src);
1105 GST_DEBUG_OBJECT (src, "request headers:");
1106 soup_message_headers_foreach (src->msg->request_headers,
1107 gst_soup_http_src_headers_foreach, src);
1112 static GstFlowReturn
1113 gst_soup_http_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
1115 GstSoupHTTPSrc *src;
1117 src = GST_SOUP_HTTP_SRC (psrc);
1119 if (src->msg && (src->request_position != src->read_position)) {
1120 if (src->content_size != 0 && src->request_position >= src->content_size) {
1121 GST_WARNING_OBJECT (src, "Seeking behind the end of file -- EOS");
1122 return GST_FLOW_EOS;
1123 } else if (src->session_io_status ==
1124 GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE) {
1125 gst_soup_http_src_add_range_header (src, src->request_position);
1127 GST_DEBUG_OBJECT (src, "Seek from position %" G_GUINT64_FORMAT
1128 " to %" G_GUINT64_FORMAT ": requeueing connection request",
1129 src->read_position, src->request_position);
1130 gst_soup_http_src_cancel_message (src);
1134 if (!gst_soup_http_src_build_message (src))
1135 return GST_FLOW_ERROR;
1137 src->ret = GST_FLOW_CUSTOM_ERROR;
1138 src->outbuf = outbuf;
1140 if (src->interrupted) {
1141 GST_DEBUG_OBJECT (src, "interrupted");
1145 GST_DEBUG_OBJECT (src, "Reconnecting");
1146 if (!gst_soup_http_src_build_message (src))
1147 return GST_FLOW_ERROR;
1152 GST_DEBUG_OBJECT (src, "EOS reached");
1156 switch (src->session_io_status) {
1157 case GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE:
1158 GST_DEBUG_OBJECT (src, "Queueing connection request");
1159 gst_soup_http_src_queue_message (src);
1161 case GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_QUEUED:
1163 case GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING:
1164 gst_soup_http_src_session_unpause_message (src);
1166 case GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_CANCELLED:
1171 if (src->ret == GST_FLOW_CUSTOM_ERROR)
1172 g_main_loop_run (src->loop);
1173 } while (src->ret == GST_FLOW_CUSTOM_ERROR);
1175 if (src->ret == GST_FLOW_CUSTOM_ERROR)
1176 src->ret = GST_FLOW_EOS;
1181 gst_soup_http_src_start (GstBaseSrc * bsrc)
1183 GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (bsrc);
1185 GST_DEBUG_OBJECT (src, "start(\"%s\")", src->location);
1187 if (!src->location) {
1188 GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (_("No URL set.")),
1189 ("Missing location property"));
1193 src->context = g_main_context_new ();
1195 src->loop = g_main_loop_new (src->context, TRUE);
1197 GST_ELEMENT_ERROR (src, LIBRARY, INIT,
1198 (NULL), ("Failed to start GMainLoop"));
1199 g_main_context_unref (src->context);
1203 if (src->proxy == NULL) {
1205 soup_session_async_new_with_options (SOUP_SESSION_ASYNC_CONTEXT,
1206 src->context, SOUP_SESSION_USER_AGENT, src->user_agent,
1207 SOUP_SESSION_TIMEOUT, src->timeout,
1208 #ifdef HAVE_LIBSOUP_GNOME
1209 SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_GNOME,
1214 soup_session_async_new_with_options (SOUP_SESSION_ASYNC_CONTEXT,
1215 src->context, SOUP_SESSION_PROXY_URI, src->proxy,
1216 SOUP_SESSION_TIMEOUT, src->timeout,
1217 SOUP_SESSION_USER_AGENT, src->user_agent, NULL);
1220 if (!src->session) {
1221 GST_ELEMENT_ERROR (src, LIBRARY, INIT,
1222 (NULL), ("Failed to create async session"));
1226 g_signal_connect (src->session, "authenticate",
1227 G_CALLBACK (gst_soup_http_src_authenticate_cb), src);
1232 gst_soup_http_src_stop (GstBaseSrc * bsrc)
1234 GstSoupHTTPSrc *src;
1236 src = GST_SOUP_HTTP_SRC (bsrc);
1237 GST_DEBUG_OBJECT (src, "stop()");
1238 gst_soup_http_src_session_close (src);
1240 g_main_loop_unref (src->loop);
1241 g_main_context_unref (src->context);
1243 src->context = NULL;
1245 if (src->extra_headers) {
1246 gst_structure_free (src->extra_headers);
1247 src->extra_headers = NULL;
1250 gst_soup_http_src_reset (src);
1254 /* Interrupt a blocking request. */
1256 gst_soup_http_src_unlock (GstBaseSrc * bsrc)
1258 GstSoupHTTPSrc *src;
1260 src = GST_SOUP_HTTP_SRC (bsrc);
1261 GST_DEBUG_OBJECT (src, "unlock()");
1263 src->interrupted = TRUE;
1265 g_main_loop_quit (src->loop);
1269 /* Interrupt interrupt. */
1271 gst_soup_http_src_unlock_stop (GstBaseSrc * bsrc)
1273 GstSoupHTTPSrc *src;
1275 src = GST_SOUP_HTTP_SRC (bsrc);
1276 GST_DEBUG_OBJECT (src, "unlock_stop()");
1278 src->interrupted = FALSE;
1283 gst_soup_http_src_get_size (GstBaseSrc * bsrc, guint64 * size)
1285 GstSoupHTTPSrc *src;
1287 src = GST_SOUP_HTTP_SRC (bsrc);
1289 if (src->have_size) {
1290 GST_DEBUG_OBJECT (src, "get_size() = %" G_GUINT64_FORMAT,
1292 *size = src->content_size;
1295 GST_DEBUG_OBJECT (src, "get_size() = FALSE");
1300 gst_soup_http_src_is_seekable (GstBaseSrc * bsrc)
1302 GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (bsrc);
1304 return src->seekable;
1308 gst_soup_http_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
1310 GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (bsrc);
1312 GST_DEBUG_OBJECT (src, "do_seek(%" G_GUINT64_FORMAT ")", segment->start);
1314 if (src->read_position == segment->start &&
1315 src->request_position == src->read_position) {
1316 GST_DEBUG_OBJECT (src, "Seek to current read position and no seek pending");
1320 if (!src->seekable) {
1321 GST_WARNING_OBJECT (src, "Not seekable");
1325 if (segment->rate < 0.0 || segment->format != GST_FORMAT_BYTES) {
1326 GST_WARNING_OBJECT (src, "Invalid seek segment");
1330 if (src->content_size != 0 && segment->start >= src->content_size) {
1331 GST_WARNING_OBJECT (src, "Seeking behind end of file, will go to EOS soon");
1334 /* Wait for create() to handle the jump in offset. */
1335 src->request_position = segment->start;
1340 gst_soup_http_src_query (GstBaseSrc * bsrc, GstQuery * query)
1342 GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (bsrc);
1345 switch (GST_QUERY_TYPE (query)) {
1347 gst_query_set_uri (query, src->location);
1356 ret = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
1362 gst_soup_http_src_set_location (GstSoupHTTPSrc * src, const gchar * uri,
1365 const char *alt_schemes[] = { "icy://", "icyx://" };
1368 if (src->location) {
1369 g_free (src->location);
1370 src->location = NULL;
1376 for (i = 0; i < G_N_ELEMENTS (alt_schemes); i++) {
1377 if (g_str_has_prefix (uri, alt_schemes[i])) {
1379 g_strdup_printf ("http://%s", uri + strlen (alt_schemes[i]));
1384 src->location = g_strdup (uri);
1390 gst_soup_http_src_set_proxy (GstSoupHTTPSrc * src, const gchar * uri)
1393 soup_uri_free (src->proxy);
1396 if (g_str_has_prefix (uri, "http://")) {
1397 src->proxy = soup_uri_new (uri);
1399 gchar *new_uri = g_strconcat ("http://", uri, NULL);
1401 src->proxy = soup_uri_new (new_uri);
1409 gst_soup_http_src_uri_get_type (GType type)
1414 static const gchar *const *
1415 gst_soup_http_src_uri_get_protocols (GType type)
1417 static const gchar *protocols[] = { "http", "https", "icy", "icyx", NULL };
1423 gst_soup_http_src_uri_get_uri (GstURIHandler * handler)
1425 GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (handler);
1427 /* FIXME: make thread-safe */
1428 return g_strdup (src->location);
1432 gst_soup_http_src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
1435 GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (handler);
1437 return gst_soup_http_src_set_location (src, uri, error);
1441 gst_soup_http_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
1443 GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
1445 iface->get_type = gst_soup_http_src_uri_get_type;
1446 iface->get_protocols = gst_soup_http_src_uri_get_protocols;
1447 iface->get_uri = gst_soup_http_src_uri_get_uri;
1448 iface->set_uri = gst_soup_http_src_uri_set_uri;