mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
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.
This commit is contained in:
parent
30e7dc80a2
commit
ee01676c0d
3 changed files with 98 additions and 1 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
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:
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue