diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2008-03-22 19:26:04 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-03-22 19:26:04 +0000 |
commit | cc2d5bd32b8db721e15aa4fa62cdc4852d233351 (patch) | |
tree | 1910d09159e29061a8ec3b53eb9ba861731c7f48 | |
parent | 89c2fe05be4f6f6ca0a03020ce3179c4fff178db (diff) | |
download | gst-plugins-bad-cc2d5bd32b8db721e15aa4fa62cdc4852d233351.tar.gz gst-plugins-bad-cc2d5bd32b8db721e15aa4fa62cdc4852d233351.tar.bz2 gst-plugins-bad-cc2d5bd32b8db721e15aa4fa62cdc4852d233351.zip |
ext/soup/gstsouphttpsrc.c: Don't autoplug souphttpsrc for dav/davs. This is better handled by
Original commit message from CVS:
* ext/soup/gstsouphttpsrc.c: (gst_soup_http_src_got_headers_cb),
(gst_soup_http_src_chunk_allocator),
(gst_soup_http_src_got_chunk_cb),
(gst_soup_http_src_uri_get_protocols):
Don't autoplug souphttpsrc for dav/davs. This is better handled by
GIO and GnomeVFS as they provide authentication.
Don't leak the icy caps if we already set them and get a new
icy-metaint header.
Try harder to set the icy caps on the output buffer to have correct
caps for the first buffer already.
* tests/check/elements/souphttpsrc.c: (got_buffer),
(GST_START_TEST):
Check that we get a buffer with application/x-icy caps if iradio-mode
is enabled and we have an icecast URL.
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | ext/soup/gstsouphttpsrc.c | 16 | ||||
-rw-r--r-- | tests/check/elements/souphttpsrc.c | 24 |
3 files changed, 55 insertions, 5 deletions
@@ -1,5 +1,25 @@ 2008-03-22 Sebastian Dröge <slomo@circular-chaos.org> + * ext/soup/gstsouphttpsrc.c: (gst_soup_http_src_got_headers_cb), + (gst_soup_http_src_chunk_allocator), + (gst_soup_http_src_got_chunk_cb), + (gst_soup_http_src_uri_get_protocols): + Don't autoplug souphttpsrc for dav/davs. This is better handled by + GIO and GnomeVFS as they provide authentication. + + Don't leak the icy caps if we already set them and get a new + icy-metaint header. + + Try harder to set the icy caps on the output buffer to have correct + caps for the first buffer already. + + * tests/check/elements/souphttpsrc.c: (got_buffer), + (GST_START_TEST): + Check that we get a buffer with application/x-icy caps if iradio-mode + is enabled and we have an icecast URL. + +2008-03-22 Sebastian Dröge <slomo@circular-chaos.org> + * ext/soup/gstsouphttpsrc.c: (gst_soup_http_src_chunk_allocator): Actually set the icy caps on our src pad if we have icecast data. Fixes bug #523854. diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index 6c43aab1..883cbbc2 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -20,7 +20,7 @@ * <refsect2> * <para> * This plugin reads data from a remote location specified by a URI. - * Supported protocols are 'http', 'https', 'dav', or 'davs'. + * Supported protocols are 'http', 'https'. * </para> * <para> * An HTTP proxy must be specified by its URL. @@ -577,9 +577,13 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src) gint icy_metaint = atoi (value); GST_DEBUG_OBJECT (src, "icy-metaint: %s (parsed: %d)", value, icy_metaint); - if (icy_metaint > 0) + if (icy_metaint > 0) { + if (src->icy_caps) + gst_caps_unref (src->icy_caps); + src->icy_caps = gst_caps_new_simple ("application/x-icy", "metadata-interval", G_TYPE_INT, icy_metaint, NULL); + } } if ((value = @@ -729,6 +733,7 @@ gst_soup_http_src_chunk_allocator (SoupMessage * msg, gsize max_len, GST_DEBUG_OBJECT (src, "alloc %" G_GSIZE_FORMAT " bytes <= %" G_GSIZE_FORMAT, length, max_len); + rc = gst_pad_alloc_buffer (GST_BASE_SRC_PAD (basesrc), GST_BUFFER_OFFSET_NONE, length, src->icy_caps ? src->icy_caps : @@ -772,7 +777,10 @@ gst_soup_http_src_got_chunk_cb (SoupMessage * msg, SoupBuffer * chunk, gst_buffer_ref (*src->outbuf); GST_BUFFER_SIZE (*src->outbuf) = chunk->length; GST_BUFFER_OFFSET (*src->outbuf) = basesrc->segment.last_stop; - gst_buffer_set_caps (*src->outbuf, GST_PAD_CAPS (GST_BASE_SRC_PAD (basesrc))); + + gst_buffer_set_caps (*src->outbuf, + (src->icy_caps) ? src-> + icy_caps : GST_PAD_CAPS (GST_BASE_SRC_PAD (basesrc))); new_position = src->read_position + chunk->length; if (G_LIKELY (src->request_position == src->read_position)) @@ -1130,7 +1138,7 @@ gst_soup_http_src_uri_get_type (void) static gchar ** gst_soup_http_src_uri_get_protocols (void) { - static gchar *protocols[] = { "http", "https", "dav", "davs", NULL }; + static gchar *protocols[] = { "http", "https", NULL }; return protocols; } diff --git a/tests/check/elements/souphttpsrc.c b/tests/check/elements/souphttpsrc.c index 0fc9c6a6..db8c27a9 100644 --- a/tests/check/elements/souphttpsrc.c +++ b/tests/check/elements/souphttpsrc.c @@ -201,6 +201,23 @@ GST_START_TEST (test_cookies) GST_END_TEST; +static gboolean icy_caps = FALSE; + +static void +got_buffer (GstElement * fakesink, GstBuffer * buf, GstPad * pad, + gpointer user_data) +{ + GstStructure *s; + + /* Caps can be anything if we don't except icy caps */ + if (!icy_caps) + return; + + /* Otherwise they _must_ be "application/x-icy" */ + s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0); + assert_equals_string (gst_structure_get_name (s), "application/x-icy"); +} + GST_START_TEST (test_icy_stream) { GstElement *pipe, *src, *sink; @@ -210,9 +227,12 @@ GST_START_TEST (test_icy_stream) src = gst_element_factory_make ("souphttpsrc", NULL); fail_unless (src != NULL); + g_object_set (src, "iradio-mode", TRUE, NULL); sink = gst_element_factory_make ("fakesink", NULL); fail_unless (sink != NULL); + g_object_set (sink, "signal-handoffs", TRUE, NULL); + g_signal_connect (sink, "handoff", G_CALLBACK (got_buffer), NULL); gst_bin_add (GST_BIN (pipe), src); gst_bin_add (GST_BIN (pipe), sink); @@ -224,6 +244,7 @@ GST_START_TEST (test_icy_stream) g_object_set (src, "location", "http://ogg2.smgradio.com/vr32.ogg", NULL); g_object_set (src, "num-buffers", 1, NULL); + icy_caps = FALSE; gst_element_set_state (pipe, GST_STATE_PLAYING); msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), @@ -247,7 +268,7 @@ GST_START_TEST (test_icy_stream) /* EOS after the first buffer */ g_object_set (src, "num-buffers", 1, NULL); - + icy_caps = TRUE; gst_element_set_state (pipe, GST_STATE_PLAYING); msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); @@ -268,6 +289,7 @@ GST_START_TEST (test_icy_stream) } done: + icy_caps = FALSE; gst_element_set_state (pipe, GST_STATE_NULL); gst_object_unref (pipe); |