diff options
author | Thomas Green <tom78999@gmail.com> | 2007-09-09 19:05:19 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2007-09-09 19:05:19 +0000 |
commit | ee01676c0d23b8ab0426a14306a1f0d1cefdc750 (patch) | |
tree | 51b9b1ddf7129bd0a5734f32aee3870e0f794cd9 | |
parent | 30e7dc80a2f6cbc5aab609b97a4dcac286df5595 (diff) | |
download | gst-plugins-bad-ee01676c0d23b8ab0426a14306a1f0d1cefdc750.tar.gz gst-plugins-bad-ee01676c0d23b8ab0426a14306a1f0d1cefdc750.tar.bz2 gst-plugins-bad-ee01676c0d23b8ab0426a14306a1f0d1cefdc750.zip |
ext/neon/gstneonhttpsrc.c: With libneon 2.6, we need to set the NE_SESSFLAG_ICYPROTO flag if we want ICY streams to b...
Original commit message from CVS:
Patch by: Thomas Green <tom78999 gmail com>
* ext/neon/gstneonhttpsrc.c:
With libneon 2.6, we need to set the NE_SESSFLAG_ICYPROTO
flag if we want ICY streams to be handled too, otherwise
libneon will error out with a 'can't parse reponse' error.
Fixes #474696.
* tests/check/elements/neonhttpsrc.c:
Unit test for the above by Yours Truly.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | ext/neon/gstneonhttpsrc.c | 4 | ||||
-rw-r--r-- | tests/check/elements/neonhttpsrc.c | 82 |
3 files changed, 98 insertions, 1 deletions
@@ -1,5 +1,18 @@ 2007-09-09 Tim-Philipp Müller <tim at centricular dot net> + Patch by: Thomas Green <tom78999 gmail com> + + * ext/neon/gstneonhttpsrc.c: + With libneon 2.6, we need to set the NE_SESSFLAG_ICYPROTO + flag if we want ICY streams to be handled too, otherwise + libneon will error out with a 'can't parse reponse' error. + Fixes #474696. + + * tests/check/elements/neonhttpsrc.c: + Unit test for the above by Yours Truly. + +2007-09-09 Tim-Philipp Müller <tim at centricular dot net> + * configure.ac: Use AC_TRY_COMPILE instead of AC_TRY_RUN for the faad and the xvid configure checks, so they still work when cross-compiling. diff --git a/ext/neon/gstneonhttpsrc.c b/ext/neon/gstneonhttpsrc.c index c29cd1c2..2c1c6c3a 100644 --- a/ext/neon/gstneonhttpsrc.c +++ b/ext/neon/gstneonhttpsrc.c @@ -800,6 +800,10 @@ gst_neonhttp_src_send_request_and_redirect (GstNeonhttpSrc * src, ne_session_create (src->uri.scheme, src->uri.host, src->uri.port); } +#ifdef NEON_026_OR_LATER + ne_set_session_flag (session, NE_SESSFLAG_ICYPROTO, 1); +#endif + request = ne_request_create (session, "GET", src->uri.path); if (src->user_agent) { diff --git a/tests/check/elements/neonhttpsrc.c b/tests/check/elements/neonhttpsrc.c index c5fc79bc..c5fda84b 100644 --- a/tests/check/elements/neonhttpsrc.c +++ b/tests/check/elements/neonhttpsrc.c @@ -1,5 +1,5 @@ /* GStreamer unit tests for the neonhttpsrc element - * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net> + * Copyright (C) 2006-2007 Tim-Philipp Müller <tim centricular net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -88,6 +88,85 @@ done: GST_END_TEST; +GST_START_TEST (test_icy_stream) +{ + GstElement *pipe, *src, *sink; + GstMessage *msg; + + pipe = gst_pipeline_new (NULL); + + src = gst_element_factory_make ("neonhttpsrc", NULL); + fail_unless (src != NULL); + + sink = gst_element_factory_make ("fakesink", NULL); + fail_unless (sink != NULL); + + gst_bin_add (GST_BIN (pipe), src); + gst_bin_add (GST_BIN (pipe), sink); + fail_unless (gst_element_link (src, sink)); + + /* First try Virgin Radio Ogg stream, to see if there's connectivity and all + * (which is an attempt to work around the completely horrid error reporting + * and that we can't distinguish different types of failures here). + * Note that neonhttpsrc does the whole connect + session initiation all in + * the state change function. */ + + g_object_set (src, "location", "http://ogg2.smgradio.com/vr32.ogg", NULL); + g_object_set (src, "automatic-redirect", FALSE, NULL); + g_object_set (src, "num-buffers", 1, NULL); + gst_element_set_state (pipe, GST_STATE_PLAYING); + + msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), + GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) { + GST_INFO ("looks like there's no net connectivity or sgmradio.com is " + "down. In any case, let's just skip this test"); + gst_message_unref (msg); + goto done; + } + gst_message_unref (msg); + msg = NULL; + gst_element_set_state (pipe, GST_STATE_NULL); + + /* Now, if the ogg stream works, the mp3 shoutcast stream should work as + * well (time will tell if that's true) */ + + /* Virgin Radio 32kbps mp3 shoutcast stream */ + g_object_set (src, "location", "http://mp3-vr-32.smgradio.com:80/", NULL); + g_object_set (src, "automatic-redirect", FALSE, NULL); + + /* g_object_set (src, "neon-http-debug", TRUE, NULL); */ + + /* EOS after the first buffer */ + g_object_set (src, "num-buffers", 1, NULL); + + gst_element_set_state (pipe, GST_STATE_PLAYING); + msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), + GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + + if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS) { + GST_DEBUG ("success, we're done here"); + gst_message_unref (msg); + goto done; + } + + { + GError *err = NULL; + + gst_message_parse_error (msg, &err, NULL); + gst_message_unref (msg); + g_error ("Error with ICY mp3 shoutcast stream: %s", err->message); + g_error_free (err); + } + +done: + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_object_unref (pipe); +} + +GST_END_TEST; + static Suite * neonhttpsrc_suite (void) { @@ -96,6 +175,7 @@ neonhttpsrc_suite (void) suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_first_buffer_has_offset); + tcase_add_test (tc_chain, test_icy_stream); return s; } |