summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Green <tom78999@gmail.com>2007-09-09 19:05:19 +0000
committerTim-Philipp Müller <tim@centricular.net>2007-09-09 19:05:19 +0000
commitee01676c0d23b8ab0426a14306a1f0d1cefdc750 (patch)
tree51b9b1ddf7129bd0a5734f32aee3870e0f794cd9 /tests
parent30e7dc80a2f6cbc5aab609b97a4dcac286df5595 (diff)
downloadgst-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.
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/neonhttpsrc.c82
1 files changed, 81 insertions, 1 deletions
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;
}