ext/soup/gstsouphttpsrc.c: Add changes to gstsouphttpsrc.c that were missing from last commit.

Original commit message from CVS:
* ext/soup/gstsouphttpsrc.c: (_do_init),
(gst_soup_http_src_base_init), (gst_soup_http_src_class_init),
(gst_soup_http_src_init), (gst_soup_http_src_dispose),
(gst_soup_http_src_set_property), (gst_soup_http_src_get_property),
(gst_soup_http_src_unicodify), (gst_soup_http_src_cancel_message),
(gst_soup_http_src_queue_message),
(gst_soup_http_src_add_range_header),
(gst_soup_http_src_session_unpause_message),
(gst_soup_http_src_session_pause_message),
(gst_soup_http_src_session_close),
(gst_soup_http_src_got_headers_cb),
(gst_soup_http_src_got_body_cb), (gst_soup_http_src_finished_cb),
(gst_soup_http_src_got_chunk_cb), (gst_soup_http_src_response_cb),
(gst_soup_http_src_parse_status), (gst_soup_http_src_create),
(gst_soup_http_src_start), (gst_soup_http_src_stop),
(gst_soup_http_src_unlock), (gst_soup_http_src_unlock_stop),
(gst_soup_http_src_get_size), (gst_soup_http_src_is_seekable),
(gst_soup_http_src_do_seek), (gst_soup_http_src_set_location),
(gst_soup_http_src_set_proxy), (gst_soup_http_src_uri_get_type),
(gst_soup_http_src_uri_get_protocols),
(gst_soup_http_src_uri_get_uri), (gst_soup_http_src_uri_set_uri),
(gst_soup_http_src_uri_handler_init), (plugin_init):
Add changes to gstsouphttpsrc.c that were missing from last commit.
This commit is contained in:
Sebastian Dröge 2008-01-31 09:50:31 +00:00
parent f745bf3dbe
commit 5203ce7e15
2 changed files with 174 additions and 150 deletions

View file

@ -1,3 +1,29 @@
2008-01-31 Sebastian Dröge <slomo@circular-chaos.org>
* ext/soup/gstsouphttpsrc.c: (_do_init),
(gst_soup_http_src_base_init), (gst_soup_http_src_class_init),
(gst_soup_http_src_init), (gst_soup_http_src_dispose),
(gst_soup_http_src_set_property), (gst_soup_http_src_get_property),
(gst_soup_http_src_unicodify), (gst_soup_http_src_cancel_message),
(gst_soup_http_src_queue_message),
(gst_soup_http_src_add_range_header),
(gst_soup_http_src_session_unpause_message),
(gst_soup_http_src_session_pause_message),
(gst_soup_http_src_session_close),
(gst_soup_http_src_got_headers_cb),
(gst_soup_http_src_got_body_cb), (gst_soup_http_src_finished_cb),
(gst_soup_http_src_got_chunk_cb), (gst_soup_http_src_response_cb),
(gst_soup_http_src_parse_status), (gst_soup_http_src_create),
(gst_soup_http_src_start), (gst_soup_http_src_stop),
(gst_soup_http_src_unlock), (gst_soup_http_src_unlock_stop),
(gst_soup_http_src_get_size), (gst_soup_http_src_is_seekable),
(gst_soup_http_src_do_seek), (gst_soup_http_src_set_location),
(gst_soup_http_src_set_proxy), (gst_soup_http_src_uri_get_type),
(gst_soup_http_src_uri_get_protocols),
(gst_soup_http_src_uri_get_uri), (gst_soup_http_src_uri_set_uri),
(gst_soup_http_src_uri_handler_init), (plugin_init):
Add changes to gstsouphttpsrc.c that were missing from last commit.
2008-01-31 Sebastian Dröge <slomo@circular-chaos.org> 2008-01-31 Sebastian Dröge <slomo@circular-chaos.org>
Patch by: Wouter Cloetens <wouter at mind dot be> Patch by: Wouter Cloetens <wouter at mind dot be>

View file

@ -66,7 +66,7 @@
* Yet another example pipeline: * Yet another example pipeline:
* <programlisting> * <programlisting>
* gst-launch -v souphttpsrc location=http://10.11.12.13/mjpeg * gst-launch -v souphttpsrc location=http://10.11.12.13/mjpeg
* do-timestamp=true ! multipartdemux * do-timestamp=true ! multipartdemux
* ! image/jpeg,width=640,height=480 ! matroskamux * ! image/jpeg,width=640,height=480 ! matroskamux
* ! filesink location=mjpeg.mkv * ! filesink location=mjpeg.mkv
* </programlisting> * </programlisting>
@ -99,7 +99,7 @@
GST_DEBUG_CATEGORY_STATIC (souphttpsrc_debug); GST_DEBUG_CATEGORY_STATIC (souphttpsrc_debug);
#define GST_CAT_DEFAULT souphttpsrc_debug #define GST_CAT_DEFAULT souphttpsrc_debug
static const GstElementDetails gst_souphttp_src_details = static const GstElementDetails gst_soup_http_src_details =
GST_ELEMENT_DETAILS ("HTTP client source", GST_ELEMENT_DETAILS ("HTTP client source",
"Source/Network", "Source/Network",
"Receive data as a client over the network via HTTP using SOUP", "Receive data as a client over the network via HTTP using SOUP",
@ -126,60 +126,60 @@ enum
#define DEFAULT_USER_AGENT "GStreamer souphttpsrc" #define DEFAULT_USER_AGENT "GStreamer souphttpsrc"
static void gst_souphttp_src_uri_handler_init (gpointer g_iface, static void gst_soup_http_src_uri_handler_init (gpointer g_iface,
gpointer iface_data); gpointer iface_data);
static void gst_souphttp_src_init (GstSouphttpSrc * src, static void gst_soup_http_src_init (GstSoupHTTPSrc * src,
GstSouphttpSrcClass * g_class); GstSoupHTTPSrcClass * g_class);
static void gst_souphttp_src_dispose (GObject * gobject); static void gst_soup_http_src_dispose (GObject * gobject);
static void gst_souphttp_src_set_property (GObject * object, guint prop_id, static void gst_soup_http_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
static void gst_souphttp_src_get_property (GObject * object, guint prop_id, static void gst_soup_http_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_souphttp_src_create (GstPushSrc * psrc, static GstFlowReturn gst_soup_http_src_create (GstPushSrc * psrc,
GstBuffer ** outbuf); GstBuffer ** outbuf);
static gboolean gst_souphttp_src_start (GstBaseSrc * bsrc); static gboolean gst_soup_http_src_start (GstBaseSrc * bsrc);
static gboolean gst_souphttp_src_stop (GstBaseSrc * bsrc); static gboolean gst_soup_http_src_stop (GstBaseSrc * bsrc);
static gboolean gst_souphttp_src_get_size (GstBaseSrc * bsrc, guint64 * size); static gboolean gst_soup_http_src_get_size (GstBaseSrc * bsrc, guint64 * size);
static gboolean gst_souphttp_src_is_seekable (GstBaseSrc * bsrc); static gboolean gst_soup_http_src_is_seekable (GstBaseSrc * bsrc);
static gboolean gst_souphttp_src_do_seek (GstBaseSrc * bsrc, static gboolean gst_soup_http_src_do_seek (GstBaseSrc * bsrc,
GstSegment * segment); GstSegment * segment);
static gboolean gst_souphttp_src_unlock (GstBaseSrc * bsrc); static gboolean gst_soup_http_src_unlock (GstBaseSrc * bsrc);
static gboolean gst_souphttp_src_unlock_stop (GstBaseSrc * bsrc); static gboolean gst_soup_http_src_unlock_stop (GstBaseSrc * bsrc);
static gboolean gst_souphttp_src_set_location (GstSouphttpSrc * src, static gboolean gst_soup_http_src_set_location (GstSoupHTTPSrc * src,
const gchar * uri); const gchar * uri);
static gboolean gst_souphttp_src_set_proxy (GstSouphttpSrc * src, static gboolean gst_soup_http_src_set_proxy (GstSoupHTTPSrc * src,
const gchar * uri); const gchar * uri);
static char *gst_souphttp_src_unicodify (const char *str); static char *gst_soup_http_src_unicodify (const char *str);
static void gst_souphttp_src_cancel_message (GstSouphttpSrc * src); static void gst_soup_http_src_cancel_message (GstSoupHTTPSrc * src);
static void gst_souphttp_src_queue_message (GstSouphttpSrc * src); static void gst_soup_http_src_queue_message (GstSoupHTTPSrc * src);
static gboolean gst_souphttp_src_add_range_header (GstSouphttpSrc * src, static gboolean gst_soup_http_src_add_range_header (GstSoupHTTPSrc * src,
guint64 offset); guint64 offset);
static void gst_souphttp_src_session_unpause_message (GstSouphttpSrc * src); static void gst_soup_http_src_session_unpause_message (GstSoupHTTPSrc * src);
static void gst_souphttp_src_session_pause_message (GstSouphttpSrc * src); static void gst_soup_http_src_session_pause_message (GstSoupHTTPSrc * src);
static void gst_souphttp_src_session_close (GstSouphttpSrc * src); static void gst_soup_http_src_session_close (GstSoupHTTPSrc * src);
static void gst_souphttp_src_parse_status (SoupMessage * msg, static void gst_soup_http_src_parse_status (SoupMessage * msg,
GstSouphttpSrc * src); GstSoupHTTPSrc * src);
static void gst_souphttp_src_got_chunk_cb (SoupMessage * msg, static void gst_soup_http_src_got_chunk_cb (SoupMessage * msg,
SoupBuffer * chunk, GstSouphttpSrc * src); SoupBuffer * chunk, GstSoupHTTPSrc * src);
static void gst_souphttp_src_response_cb (SoupSession * session, static void gst_soup_http_src_response_cb (SoupSession * session,
SoupMessage * msg, GstSouphttpSrc * src); SoupMessage * msg, GstSoupHTTPSrc * src);
static void gst_souphttp_src_got_headers_cb (SoupMessage * msg, static void gst_soup_http_src_got_headers_cb (SoupMessage * msg,
GstSouphttpSrc * src); GstSoupHTTPSrc * src);
static void gst_souphttp_src_got_body_cb (SoupMessage * msg, static void gst_soup_http_src_got_body_cb (SoupMessage * msg,
GstSouphttpSrc * src); GstSoupHTTPSrc * src);
static void gst_souphttp_src_finished_cb (SoupMessage * msg, static void gst_soup_http_src_finished_cb (SoupMessage * msg,
GstSouphttpSrc * src); GstSoupHTTPSrc * src);
static void static void
_do_init (GType type) _do_init (GType type)
{ {
static const GInterfaceInfo urihandler_info = { static const GInterfaceInfo urihandler_info = {
gst_souphttp_src_uri_handler_init, gst_soup_http_src_uri_handler_init,
NULL, NULL,
NULL NULL
}; };
@ -190,22 +190,22 @@ _do_init (GType type)
"SOUP HTTP src"); "SOUP HTTP src");
} }
GST_BOILERPLATE_FULL (GstSouphttpSrc, gst_souphttp_src, GstPushSrc, GST_BOILERPLATE_FULL (GstSoupHTTPSrc, gst_soup_http_src, GstPushSrc,
GST_TYPE_PUSH_SRC, _do_init); GST_TYPE_PUSH_SRC, _do_init);
static void static void
gst_souphttp_src_base_init (gpointer g_class) gst_soup_http_src_base_init (gpointer g_class)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&srctemplate)); gst_static_pad_template_get (&srctemplate));
gst_element_class_set_details (element_class, &gst_souphttp_src_details); gst_element_class_set_details (element_class, &gst_soup_http_src_details);
} }
static void static void
gst_souphttp_src_class_init (GstSouphttpSrcClass * klass) gst_soup_http_src_class_init (GstSoupHTTPSrcClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstBaseSrcClass *gstbasesrc_class; GstBaseSrcClass *gstbasesrc_class;
@ -215,9 +215,9 @@ gst_souphttp_src_class_init (GstSouphttpSrcClass * klass)
gstbasesrc_class = (GstBaseSrcClass *) klass; gstbasesrc_class = (GstBaseSrcClass *) klass;
gstpushsrc_class = (GstPushSrcClass *) klass; gstpushsrc_class = (GstPushSrcClass *) klass;
gobject_class->set_property = gst_souphttp_src_set_property; gobject_class->set_property = gst_soup_http_src_set_property;
gobject_class->get_property = gst_souphttp_src_get_property; gobject_class->get_property = gst_soup_http_src_get_property;
gobject_class->dispose = gst_souphttp_src_dispose; gobject_class->dispose = gst_soup_http_src_dispose;
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_LOCATION, PROP_LOCATION,
@ -264,24 +264,24 @@ gst_souphttp_src_class_init (GstSouphttpSrcClass * klass)
"iradio-title", "iradio-title",
"Name of currently playing song", NULL, G_PARAM_READABLE)); "Name of currently playing song", NULL, G_PARAM_READABLE));
gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_souphttp_src_start); gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_soup_http_src_start);
gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_souphttp_src_stop); gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_soup_http_src_stop);
gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_souphttp_src_unlock); gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_soup_http_src_unlock);
gstbasesrc_class->unlock_stop = gstbasesrc_class->unlock_stop =
GST_DEBUG_FUNCPTR (gst_souphttp_src_unlock_stop); GST_DEBUG_FUNCPTR (gst_soup_http_src_unlock_stop);
gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_souphttp_src_get_size); gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_soup_http_src_get_size);
gstbasesrc_class->is_seekable = gstbasesrc_class->is_seekable =
GST_DEBUG_FUNCPTR (gst_souphttp_src_is_seekable); GST_DEBUG_FUNCPTR (gst_soup_http_src_is_seekable);
gstbasesrc_class->do_seek = GST_DEBUG_FUNCPTR (gst_souphttp_src_do_seek); gstbasesrc_class->do_seek = GST_DEBUG_FUNCPTR (gst_soup_http_src_do_seek);
gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_souphttp_src_create); gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_soup_http_src_create);
GST_DEBUG_CATEGORY_INIT (souphttpsrc_debug, "souphttpsrc", 0, GST_DEBUG_CATEGORY_INIT (souphttpsrc_debug, "souphttpsrc", 0,
"SOUP HTTP Client Source"); "SOUP HTTP Client Source");
} }
static void static void
gst_souphttp_src_init (GstSouphttpSrc * src, GstSouphttpSrcClass * g_class) gst_soup_http_src_init (GstSoupHTTPSrc * src, GstSoupHTTPSrcClass * g_class)
{ {
const gchar *proxy; const gchar *proxy;
@ -304,7 +304,7 @@ gst_souphttp_src_init (GstSouphttpSrc * src, GstSouphttpSrcClass * g_class)
src->read_position = 0; src->read_position = 0;
src->request_position = 0; src->request_position = 0;
proxy = g_getenv ("http_proxy"); proxy = g_getenv ("http_proxy");
if (proxy && !gst_souphttp_src_set_proxy (src, proxy)) { if (proxy && !gst_soup_http_src_set_proxy (src, proxy)) {
GST_WARNING_OBJECT (src, GST_WARNING_OBJECT (src,
"The proxy in the http_proxy env var (\"%s\") cannot be parsed.", "The proxy in the http_proxy env var (\"%s\") cannot be parsed.",
proxy); proxy);
@ -312,9 +312,9 @@ gst_souphttp_src_init (GstSouphttpSrc * src, GstSouphttpSrcClass * g_class)
} }
static void static void
gst_souphttp_src_dispose (GObject * gobject) gst_soup_http_src_dispose (GObject * gobject)
{ {
GstSouphttpSrc *src = GST_SOUPHTTP_SRC (gobject); GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (gobject);
GST_DEBUG_OBJECT (src, "dispose"); GST_DEBUG_OBJECT (src, "dispose");
g_free (src->location); g_free (src->location);
@ -342,10 +342,10 @@ gst_souphttp_src_dispose (GObject * gobject)
} }
static void static void
gst_souphttp_src_set_property (GObject * object, guint prop_id, gst_soup_http_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
{ {
GstSouphttpSrc *src = GST_SOUPHTTP_SRC (object); GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (object);
switch (prop_id) { switch (prop_id) {
case PROP_LOCATION: case PROP_LOCATION:
@ -358,7 +358,7 @@ gst_souphttp_src_set_property (GObject * object, guint prop_id,
GST_WARNING ("location property cannot be NULL"); GST_WARNING ("location property cannot be NULL");
goto done; goto done;
} }
if (!gst_souphttp_src_set_location (src, location)) { if (!gst_soup_http_src_set_location (src, location)) {
GST_WARNING ("badly formatted location"); GST_WARNING ("badly formatted location");
goto done; goto done;
} }
@ -388,7 +388,7 @@ gst_souphttp_src_set_property (GObject * object, guint prop_id,
GST_WARNING ("proxy property cannot be NULL"); GST_WARNING ("proxy property cannot be NULL");
goto done; goto done;
} }
if (!gst_souphttp_src_set_proxy (src, proxy)) { if (!gst_soup_http_src_set_proxy (src, proxy)) {
GST_WARNING ("badly formatted proxy URI"); GST_WARNING ("badly formatted proxy URI");
goto done; goto done;
} }
@ -400,10 +400,10 @@ done:
} }
static void static void
gst_souphttp_src_get_property (GObject * object, guint prop_id, gst_soup_http_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec) GValue * value, GParamSpec * pspec)
{ {
GstSouphttpSrc *src = GST_SOUPHTTP_SRC (object); GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (object);
switch (prop_id) { switch (prop_id) {
case PROP_LOCATION: case PROP_LOCATION:
@ -447,7 +447,7 @@ gst_souphttp_src_get_property (GObject * object, guint prop_id,
} }
static gchar * static gchar *
gst_souphttp_src_unicodify (const gchar * str) gst_soup_http_src_unicodify (const gchar * str)
{ {
const gchar *env_vars[] = { "GST_ICY_TAG_ENCODING", const gchar *env_vars[] = { "GST_ICY_TAG_ENCODING",
"GST_TAG_ENCODING", NULL "GST_TAG_ENCODING", NULL
@ -457,23 +457,23 @@ gst_souphttp_src_unicodify (const gchar * str)
} }
static void static void
gst_souphttp_src_cancel_message (GstSouphttpSrc * src) gst_soup_http_src_cancel_message (GstSoupHTTPSrc * src)
{ {
soup_session_cancel_message (src->session, src->msg, SOUP_STATUS_CANCELLED); soup_session_cancel_message (src->session, src->msg, SOUP_STATUS_CANCELLED);
src->session_io_status = GST_SOUPHTTP_SRC_SESSION_IO_STATUS_IDLE; src->session_io_status = GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE;
src->msg = NULL; src->msg = NULL;
} }
static void static void
gst_souphttp_src_queue_message (GstSouphttpSrc * src) gst_soup_http_src_queue_message (GstSoupHTTPSrc * src)
{ {
soup_session_queue_message (src->session, src->msg, soup_session_queue_message (src->session, src->msg,
(SoupSessionCallback) gst_souphttp_src_response_cb, src); (SoupSessionCallback) gst_soup_http_src_response_cb, src);
src->session_io_status = GST_SOUPHTTP_SRC_SESSION_IO_STATUS_QUEUED; src->session_io_status = GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_QUEUED;
} }
static gboolean static gboolean
gst_souphttp_src_add_range_header (GstSouphttpSrc * src, guint64 offset) gst_soup_http_src_add_range_header (GstSoupHTTPSrc * src, guint64 offset)
{ {
gchar buf[64]; gchar buf[64];
gint rc; gint rc;
@ -490,19 +490,19 @@ gst_souphttp_src_add_range_header (GstSouphttpSrc * src, guint64 offset)
} }
static void static void
gst_souphttp_src_session_unpause_message (GstSouphttpSrc * src) gst_soup_http_src_session_unpause_message (GstSoupHTTPSrc * src)
{ {
soup_session_unpause_message (src->session, src->msg); soup_session_unpause_message (src->session, src->msg);
} }
static void static void
gst_souphttp_src_session_pause_message (GstSouphttpSrc * src) gst_soup_http_src_session_pause_message (GstSoupHTTPSrc * src)
{ {
soup_session_pause_message (src->session, src->msg); soup_session_pause_message (src->session, src->msg);
} }
static void static void
gst_souphttp_src_session_close (GstSouphttpSrc * src) gst_soup_http_src_session_close (GstSoupHTTPSrc * src)
{ {
if (src->session) { if (src->session) {
soup_session_abort (src->session); /* This unrefs the message. */ soup_session_abort (src->session); /* This unrefs the message. */
@ -513,7 +513,7 @@ gst_souphttp_src_session_close (GstSouphttpSrc * src)
} }
static void static void
gst_souphttp_src_got_headers_cb (SoupMessage * msg, GstSouphttpSrc * src) gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
{ {
const char *value; const char *value;
GstTagList *tag_list; GstTagList *tag_list;
@ -528,7 +528,7 @@ gst_souphttp_src_got_headers_cb (SoupMessage * msg, GstSouphttpSrc * src)
return; return;
} }
src->session_io_status = GST_SOUPHTTP_SRC_SESSION_IO_STATUS_RUNNING; src->session_io_status = GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING;
/* Parse Content-Length. */ /* Parse Content-Length. */
if (soup_message_headers_get_encoding (msg->response_headers) == if (soup_message_headers_get_encoding (msg->response_headers) ==
@ -567,7 +567,7 @@ gst_souphttp_src_got_headers_cb (SoupMessage * msg, GstSouphttpSrc * src)
soup_message_headers_get (msg->response_headers, soup_message_headers_get (msg->response_headers,
"icy-name")) != NULL) { "icy-name")) != NULL) {
g_free (src->iradio_name); g_free (src->iradio_name);
src->iradio_name = gst_souphttp_src_unicodify (value); src->iradio_name = gst_soup_http_src_unicodify (value);
if (src->iradio_name) { if (src->iradio_name) {
g_object_notify (G_OBJECT (src), "iradio-name"); g_object_notify (G_OBJECT (src), "iradio-name");
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, GST_TAG_ORGANIZATION, gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, GST_TAG_ORGANIZATION,
@ -578,7 +578,7 @@ gst_souphttp_src_got_headers_cb (SoupMessage * msg, GstSouphttpSrc * src)
soup_message_headers_get (msg->response_headers, soup_message_headers_get (msg->response_headers,
"icy-genre")) != NULL) { "icy-genre")) != NULL) {
g_free (src->iradio_genre); g_free (src->iradio_genre);
src->iradio_genre = gst_souphttp_src_unicodify (value); src->iradio_genre = gst_soup_http_src_unicodify (value);
if (src->iradio_genre) { if (src->iradio_genre) {
g_object_notify (G_OBJECT (src), "iradio-genre"); g_object_notify (G_OBJECT (src), "iradio-genre");
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, GST_TAG_GENRE, gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, GST_TAG_GENRE,
@ -588,7 +588,7 @@ gst_souphttp_src_got_headers_cb (SoupMessage * msg, GstSouphttpSrc * src)
if ((value = soup_message_headers_get (msg->response_headers, "icy-url")) if ((value = soup_message_headers_get (msg->response_headers, "icy-url"))
!= NULL) { != NULL) {
g_free (src->iradio_url); g_free (src->iradio_url);
src->iradio_url = gst_souphttp_src_unicodify (value); src->iradio_url = gst_soup_http_src_unicodify (value);
if (src->iradio_url) { if (src->iradio_url) {
g_object_notify (G_OBJECT (src), "iradio-url"); g_object_notify (G_OBJECT (src), "iradio-url");
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, GST_TAG_LOCATION, gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, GST_TAG_LOCATION,
@ -604,7 +604,7 @@ gst_souphttp_src_got_headers_cb (SoupMessage * msg, GstSouphttpSrc * src)
} }
/* Handle HTTP errors. */ /* Handle HTTP errors. */
gst_souphttp_src_parse_status (msg, src); gst_soup_http_src_parse_status (msg, src);
/* Check if Range header was respected. */ /* Check if Range header was respected. */
if (src->ret == GST_FLOW_CUSTOM_ERROR && if (src->ret == GST_FLOW_CUSTOM_ERROR &&
@ -619,14 +619,14 @@ gst_souphttp_src_got_headers_cb (SoupMessage * msg, GstSouphttpSrc * src)
/* Have body. Signal EOS. */ /* Have body. Signal EOS. */
static void static void
gst_souphttp_src_got_body_cb (SoupMessage * msg, GstSouphttpSrc * src) gst_soup_http_src_got_body_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
{ {
if (G_UNLIKELY (msg != src->msg)) { if (G_UNLIKELY (msg != src->msg)) {
GST_DEBUG_OBJECT (src, "got body, but not for current message"); GST_DEBUG_OBJECT (src, "got body, but not for current message");
return; return;
} }
if (G_UNLIKELY (src->session_io_status != if (G_UNLIKELY (src->session_io_status !=
GST_SOUPHTTP_SRC_SESSION_IO_STATUS_RUNNING)) { GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING)) {
/* Probably a redirect. */ /* Probably a redirect. */
return; return;
} }
@ -634,19 +634,19 @@ gst_souphttp_src_got_body_cb (SoupMessage * msg, GstSouphttpSrc * src)
src->ret = GST_FLOW_UNEXPECTED; src->ret = GST_FLOW_UNEXPECTED;
if (src->loop) if (src->loop)
g_main_loop_quit (src->loop); g_main_loop_quit (src->loop);
gst_souphttp_src_session_pause_message (src); gst_soup_http_src_session_pause_message (src);
} }
/* Finished. Signal EOS. */ /* Finished. Signal EOS. */
static void static void
gst_souphttp_src_finished_cb (SoupMessage * msg, GstSouphttpSrc * src) gst_soup_http_src_finished_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
{ {
if (G_UNLIKELY (msg != src->msg)) { if (G_UNLIKELY (msg != src->msg)) {
GST_DEBUG_OBJECT (src, "finished, but not for current message"); GST_DEBUG_OBJECT (src, "finished, but not for current message");
return; return;
} }
if (G_UNLIKELY (src->session_io_status != if (G_UNLIKELY (src->session_io_status !=
GST_SOUPHTTP_SRC_SESSION_IO_STATUS_RUNNING)) { GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING)) {
/* Probably a redirect. */ /* Probably a redirect. */
return; return;
} }
@ -657,8 +657,8 @@ gst_souphttp_src_finished_cb (SoupMessage * msg, GstSouphttpSrc * src)
} }
static void static void
gst_souphttp_src_got_chunk_cb (SoupMessage * msg, SoupBuffer * chunk, gst_soup_http_src_got_chunk_cb (SoupMessage * msg, SoupBuffer * chunk,
GstSouphttpSrc * src) GstSoupHTTPSrc * src)
{ {
GstBaseSrc *basesrc; GstBaseSrc *basesrc;
guint64 new_position; guint64 new_position;
@ -670,7 +670,7 @@ gst_souphttp_src_got_chunk_cb (SoupMessage * msg, SoupBuffer * chunk,
return; return;
} }
if (G_UNLIKELY (src->session_io_status != if (G_UNLIKELY (src->session_io_status !=
GST_SOUPHTTP_SRC_SESSION_IO_STATUS_RUNNING)) { GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING)) {
/* Probably a redirect. */ /* Probably a redirect. */
return; return;
} }
@ -692,12 +692,12 @@ gst_souphttp_src_got_chunk_cb (SoupMessage * msg, SoupBuffer * chunk,
} }
g_main_loop_quit (src->loop); g_main_loop_quit (src->loop);
gst_souphttp_src_session_pause_message (src); gst_soup_http_src_session_pause_message (src);
} }
static void static void
gst_souphttp_src_response_cb (SoupSession * session, SoupMessage * msg, gst_soup_http_src_response_cb (SoupSession * session, SoupMessage * msg,
GstSouphttpSrc * src) GstSoupHTTPSrc * src)
{ {
if (G_UNLIKELY (msg != src->msg)) { if (G_UNLIKELY (msg != src->msg)) {
GST_DEBUG_OBJECT (src, "got response %d: %s, but not for current message", GST_DEBUG_OBJECT (src, "got response %d: %s, but not for current message",
@ -705,18 +705,18 @@ gst_souphttp_src_response_cb (SoupSession * session, SoupMessage * msg,
return; return;
} }
if (G_UNLIKELY (src->session_io_status != if (G_UNLIKELY (src->session_io_status !=
GST_SOUPHTTP_SRC_SESSION_IO_STATUS_RUNNING)) { GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING)) {
/* Probably a redirect. */ /* Probably a redirect. */
return; return;
} }
GST_DEBUG_OBJECT (src, "got response %d: %s", msg->status_code, GST_DEBUG_OBJECT (src, "got response %d: %s", msg->status_code,
msg->reason_phrase); msg->reason_phrase);
gst_souphttp_src_parse_status (msg, src); gst_soup_http_src_parse_status (msg, src);
g_main_loop_quit (src->loop); g_main_loop_quit (src->loop);
} }
static void static void
gst_souphttp_src_parse_status (SoupMessage * msg, GstSouphttpSrc * src) gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src)
{ {
if (SOUP_STATUS_IS_TRANSPORT_ERROR (msg->status_code)) { if (SOUP_STATUS_IS_TRANSPORT_ERROR (msg->status_code)) {
switch (msg->status_code) { switch (msg->status_code) {
@ -763,20 +763,20 @@ gst_souphttp_src_parse_status (SoupMessage * msg, GstSouphttpSrc * src)
} }
static GstFlowReturn static GstFlowReturn
gst_souphttp_src_create (GstPushSrc * psrc, GstBuffer ** outbuf) gst_soup_http_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
{ {
GstSouphttpSrc *src; GstSoupHTTPSrc *src;
src = GST_SOUPHTTP_SRC (psrc); src = GST_SOUP_HTTP_SRC (psrc);
if (src->msg && (src->request_position != src->read_position)) { if (src->msg && (src->request_position != src->read_position)) {
if (src->session_io_status == GST_SOUPHTTP_SRC_SESSION_IO_STATUS_IDLE) { if (src->session_io_status == GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE) {
gst_souphttp_src_add_range_header (src, src->request_position); gst_soup_http_src_add_range_header (src, src->request_position);
} else { } else {
GST_DEBUG_OBJECT (src, "Seek from position %" G_GUINT64_FORMAT GST_DEBUG_OBJECT (src, "Seek from position %" G_GUINT64_FORMAT
" to %" G_GUINT64_FORMAT ": requeueing connection request", " to %" G_GUINT64_FORMAT ": requeueing connection request",
src->read_position, src->request_position); src->read_position, src->request_position);
gst_souphttp_src_cancel_message (src); gst_soup_http_src_cancel_message (src);
} }
} }
if (!src->msg) { if (!src->msg) {
@ -786,7 +786,7 @@ gst_souphttp_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
(NULL), ("Error parsing URL \"%s\"", src->location)); (NULL), ("Error parsing URL \"%s\"", src->location));
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
src->session_io_status = GST_SOUPHTTP_SRC_SESSION_IO_STATUS_IDLE; src->session_io_status = GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE;
soup_message_headers_append (src->msg->request_headers, "Connection", soup_message_headers_append (src->msg->request_headers, "Connection",
"close"); "close");
if (src->user_agent) { if (src->user_agent) {
@ -799,23 +799,23 @@ gst_souphttp_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
} }
g_signal_connect (src->msg, "got_headers", g_signal_connect (src->msg, "got_headers",
G_CALLBACK (gst_souphttp_src_got_headers_cb), src); G_CALLBACK (gst_soup_http_src_got_headers_cb), src);
g_signal_connect (src->msg, "got_body", g_signal_connect (src->msg, "got_body",
G_CALLBACK (gst_souphttp_src_got_body_cb), src); G_CALLBACK (gst_soup_http_src_got_body_cb), src);
g_signal_connect (src->msg, "finished", g_signal_connect (src->msg, "finished",
G_CALLBACK (gst_souphttp_src_finished_cb), src); G_CALLBACK (gst_soup_http_src_finished_cb), src);
g_signal_connect (src->msg, "got_chunk", g_signal_connect (src->msg, "got_chunk",
G_CALLBACK (gst_souphttp_src_got_chunk_cb), src); G_CALLBACK (gst_soup_http_src_got_chunk_cb), src);
soup_message_set_flags (src->msg, SOUP_MESSAGE_OVERWRITE_CHUNKS | soup_message_set_flags (src->msg, SOUP_MESSAGE_OVERWRITE_CHUNKS |
src->automatic_redirect ? 0 : SOUP_MESSAGE_NO_REDIRECT); src->automatic_redirect ? 0 : SOUP_MESSAGE_NO_REDIRECT);
gst_souphttp_src_add_range_header (src, src->request_position); gst_soup_http_src_add_range_header (src, src->request_position);
} }
src->ret = GST_FLOW_CUSTOM_ERROR; src->ret = GST_FLOW_CUSTOM_ERROR;
src->outbuf = outbuf; src->outbuf = outbuf;
do { do {
if (src->interrupted) { if (src->interrupted) {
gst_souphttp_src_cancel_message (src); gst_soup_http_src_cancel_message (src);
break; break;
} }
if (!src->msg) { if (!src->msg) {
@ -824,18 +824,18 @@ gst_souphttp_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
} }
switch (src->session_io_status) { switch (src->session_io_status) {
case GST_SOUPHTTP_SRC_SESSION_IO_STATUS_IDLE: case GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE:
GST_DEBUG_OBJECT (src, "Queueing connection request"); GST_DEBUG_OBJECT (src, "Queueing connection request");
gst_souphttp_src_queue_message (src); gst_soup_http_src_queue_message (src);
break; break;
case GST_SOUPHTTP_SRC_SESSION_IO_STATUS_FINISHED: case GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_FINISHED:
GST_DEBUG_OBJECT (src, "Connection closed"); GST_DEBUG_OBJECT (src, "Connection closed");
gst_souphttp_src_cancel_message (src); gst_soup_http_src_cancel_message (src);
break; break;
case GST_SOUPHTTP_SRC_SESSION_IO_STATUS_QUEUED: case GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_QUEUED:
break; break;
case GST_SOUPHTTP_SRC_SESSION_IO_STATUS_RUNNING: case GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING:
gst_souphttp_src_session_unpause_message (src); gst_soup_http_src_session_unpause_message (src);
break; break;
} }
@ -849,9 +849,9 @@ gst_souphttp_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
} }
static gboolean static gboolean
gst_souphttp_src_start (GstBaseSrc * bsrc) gst_soup_http_src_start (GstBaseSrc * bsrc)
{ {
GstSouphttpSrc *src = GST_SOUPHTTP_SRC (bsrc); GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (bsrc);
GST_DEBUG_OBJECT (src, "start(\"%s\")", src->location); GST_DEBUG_OBJECT (src, "start(\"%s\")", src->location);
@ -888,16 +888,14 @@ gst_souphttp_src_start (GstBaseSrc * bsrc)
return TRUE; return TRUE;
} }
/* Close the socket and associated resources
* used both to recover from errors and go to NULL state. */
static gboolean static gboolean
gst_souphttp_src_stop (GstBaseSrc * bsrc) gst_soup_http_src_stop (GstBaseSrc * bsrc)
{ {
GstSouphttpSrc *src; GstSoupHTTPSrc *src;
src = GST_SOUPHTTP_SRC (bsrc); src = GST_SOUP_HTTP_SRC (bsrc);
GST_DEBUG_OBJECT (src, "stop()"); GST_DEBUG_OBJECT (src, "stop()");
gst_souphttp_src_session_close (src); gst_soup_http_src_session_close (src);
if (src->loop) { if (src->loop) {
g_main_loop_unref (src->loop); g_main_loop_unref (src->loop);
g_main_context_unref (src->context); g_main_context_unref (src->context);
@ -910,11 +908,11 @@ gst_souphttp_src_stop (GstBaseSrc * bsrc)
/* Interrupt a blocking request. */ /* Interrupt a blocking request. */
static gboolean static gboolean
gst_souphttp_src_unlock (GstBaseSrc * bsrc) gst_soup_http_src_unlock (GstBaseSrc * bsrc)
{ {
GstSouphttpSrc *src; GstSoupHTTPSrc *src;
src = GST_SOUPHTTP_SRC (bsrc); src = GST_SOUP_HTTP_SRC (bsrc);
GST_DEBUG_OBJECT (src, "unlock()"); GST_DEBUG_OBJECT (src, "unlock()");
src->interrupted = TRUE; src->interrupted = TRUE;
@ -925,11 +923,11 @@ gst_souphttp_src_unlock (GstBaseSrc * bsrc)
/* Interrupt interrupt. */ /* Interrupt interrupt. */
static gboolean static gboolean
gst_souphttp_src_unlock_stop (GstBaseSrc * bsrc) gst_soup_http_src_unlock_stop (GstBaseSrc * bsrc)
{ {
GstSouphttpSrc *src; GstSoupHTTPSrc *src;
src = GST_SOUPHTTP_SRC (bsrc); src = GST_SOUP_HTTP_SRC (bsrc);
GST_DEBUG_OBJECT (src, "unlock_stop()"); GST_DEBUG_OBJECT (src, "unlock_stop()");
src->interrupted = FALSE; src->interrupted = FALSE;
@ -937,11 +935,11 @@ gst_souphttp_src_unlock_stop (GstBaseSrc * bsrc)
} }
static gboolean static gboolean
gst_souphttp_src_get_size (GstBaseSrc * bsrc, guint64 * size) gst_soup_http_src_get_size (GstBaseSrc * bsrc, guint64 * size)
{ {
GstSouphttpSrc *src; GstSoupHTTPSrc *src;
src = GST_SOUPHTTP_SRC (bsrc); src = GST_SOUP_HTTP_SRC (bsrc);
if (src->have_size) { if (src->have_size) {
GST_DEBUG_OBJECT (src, "get_size() = %" G_GUINT64_FORMAT, GST_DEBUG_OBJECT (src, "get_size() = %" G_GUINT64_FORMAT,
@ -954,17 +952,17 @@ gst_souphttp_src_get_size (GstBaseSrc * bsrc, guint64 * size)
} }
static gboolean static gboolean
gst_souphttp_src_is_seekable (GstBaseSrc * bsrc) gst_soup_http_src_is_seekable (GstBaseSrc * bsrc)
{ {
GstSouphttpSrc *src = GST_SOUPHTTP_SRC (bsrc); GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (bsrc);
return src->seekable; return src->seekable;
} }
static gboolean static gboolean
gst_souphttp_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment) gst_soup_http_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
{ {
GstSouphttpSrc *src = GST_SOUPHTTP_SRC (bsrc); GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (bsrc);
GST_DEBUG_OBJECT (src, "do_seek(%" G_GUINT64_FORMAT ")", segment->start); GST_DEBUG_OBJECT (src, "do_seek(%" G_GUINT64_FORMAT ")", segment->start);
@ -980,7 +978,7 @@ gst_souphttp_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
} }
static gboolean static gboolean
gst_souphttp_src_set_location (GstSouphttpSrc * src, const gchar * uri) gst_soup_http_src_set_location (GstSoupHTTPSrc * src, const gchar * uri)
{ {
if (src->location) { if (src->location) {
g_free (src->location); g_free (src->location);
@ -992,7 +990,7 @@ gst_souphttp_src_set_location (GstSouphttpSrc * src, const gchar * uri)
} }
static gboolean static gboolean
gst_souphttp_src_set_proxy (GstSouphttpSrc * src, const gchar * uri) gst_soup_http_src_set_proxy (GstSoupHTTPSrc * src, const gchar * uri)
{ {
if (src->proxy) { if (src->proxy) {
soup_uri_free (src->proxy); soup_uri_free (src->proxy);
@ -1004,54 +1002,54 @@ gst_souphttp_src_set_proxy (GstSouphttpSrc * src, const gchar * uri)
} }
static guint static guint
gst_souphttp_src_uri_get_type (void) gst_soup_http_src_uri_get_type (void)
{ {
return GST_URI_SRC; return GST_URI_SRC;
} }
static gchar ** static gchar **
gst_souphttp_src_uri_get_protocols (void) gst_soup_http_src_uri_get_protocols (void)
{ {
static gchar *protocols[] = { "http", "https", "dav", "davs", NULL }; static gchar *protocols[] = { "http", "https", "dav", "davs", NULL };
return protocols; return protocols;
} }
static const gchar * static const gchar *
gst_souphttp_src_uri_get_uri (GstURIHandler * handler) gst_soup_http_src_uri_get_uri (GstURIHandler * handler)
{ {
GstSouphttpSrc *src = GST_SOUPHTTP_SRC (handler); GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (handler);
return src->location; return src->location;
} }
static gboolean static gboolean
gst_souphttp_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) gst_soup_http_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
{ {
GstSouphttpSrc *src = GST_SOUPHTTP_SRC (handler); GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (handler);
return gst_souphttp_src_set_location (src, uri); return gst_soup_http_src_set_location (src, uri);
} }
static void static void
gst_souphttp_src_uri_handler_init (gpointer g_iface, gpointer iface_data) gst_soup_http_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
{ {
GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface; GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
iface->get_type = gst_souphttp_src_uri_get_type; iface->get_type = gst_soup_http_src_uri_get_type;
iface->get_protocols = gst_souphttp_src_uri_get_protocols; iface->get_protocols = gst_soup_http_src_uri_get_protocols;
iface->get_uri = gst_souphttp_src_uri_get_uri; iface->get_uri = gst_soup_http_src_uri_get_uri;
iface->set_uri = gst_souphttp_src_uri_set_uri; iface->set_uri = gst_soup_http_src_uri_set_uri;
} }
static gboolean static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
{ {
return gst_element_register (plugin, "souphttpsrc", GST_RANK_MARGINAL, return gst_element_register (plugin, "souphttpsrc", GST_RANK_MARGINAL,
GST_TYPE_SOUPHTTP_SRC); GST_TYPE_SOUP_HTTP_SRC);
} }
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"soup", "soup",
"libsoup http client src", "libsoup HTTP client src",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)