some code cleanup don't abort if can't connect, brings down whole app

Original commit message from CVS:
some code cleanup
don't abort if can't connect, brings down whole app
This commit is contained in:
Thomas Vander Stichele 2002-10-02 08:01:04 +00:00
parent 0bf3a73a5f
commit 545dd47499

View file

@ -21,10 +21,10 @@
/* elementfactory information */ /* elementfactory information */
static GstElementDetails icecastsend_details = { static GstElementDetails icecastsend_details = {
"An Icecast plugin", "An Icecast plugin",
"IcecastSend", "shoutsend",
"GPL", "GPL",
"Sends data to an icecast server", "Sends data to an icecast server using libshout",
VERSION, VERSION,
"Wim Taymans <wim.taymans@chello.be>", "Wim Taymans <wim.taymans@chello.be>",
"(C) 2000", "(C) 2000",
@ -55,10 +55,8 @@ enum {
ARG_NAME, /* Name of the stream */ ARG_NAME, /* Name of the stream */
ARG_DESCRIPTION, /* Description of the stream */ ARG_DESCRIPTION, /* Description of the stream */
ARG_GENRE, /* Genre of the stream */ ARG_GENRE, /* Genre of the stream */
ARG_MOUNT, /* mountpoint of stream (icecast only) */ ARG_MOUNT, /* mountpoint of stream (icecast only) */
ARG_DUMPFILE, /* Dumpfile on the server for this stream (icecast only) */ ARG_DUMPFILE, /* Dumpfile on the server for this stream (icecast only) */
ARG_ICY, /* use icy headers for login? (for use with shoutcast) */ ARG_ICY, /* use icy headers for login? (for use with shoutcast) */
ARG_AIM, /* AIM number (shoutcast only) */ ARG_AIM, /* AIM number (shoutcast only) */
ARG_ICQ, /* ICQ number (shoutcast only) */ ARG_ICQ, /* ICQ number (shoutcast only) */
@ -85,34 +83,31 @@ sink_template_factory (void)
return template; return template;
} }
static void gst_icecastsend_class_init (GstIcecastSendClass *klass); static void gst_icecastsend_class_init (GstIcecastSendClass *klass);
static void gst_icecastsend_init (GstIcecastSend *icecastsend); static void gst_icecastsend_init (GstIcecastSend *icecastsend);
static void gst_icecastsend_chain (GstPad *pad, GstBuffer *buf); static void gst_icecastsend_chain (GstPad *pad, GstBuffer *buf);
static void gst_icecastsend_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void gst_icecastsend_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_icecastsend_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void gst_icecastsend_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static GstElementStateReturn gst_icecastsend_change_state (GstElement *element); static
GstElementStateReturn gst_icecastsend_change_state (GstElement *element);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
/*static guint gst_icecastsend_signals[LAST_SIGNAL] = { 0 }; */ /*static guint gst_icecastsend_signals[LAST_SIGNAL] = { 0 }; */
GType GType
gst_icecastsend_get_type(void) gst_icecastsend_get_type (void)
{ {
static GType icecastsend_type = 0; static GType icecastsend_type = 0;
if (!icecastsend_type) { if (!icecastsend_type) {
static const GTypeInfo icecastsend_info = { static const GTypeInfo icecastsend_info = {
sizeof(GstIcecastSendClass), NULL, sizeof (GstIcecastSendClass), NULL, NULL,
NULL, (GClassInitFunc) gst_icecastsend_class_init, NULL, NULL,
(GClassInitFunc)gst_icecastsend_class_init, sizeof (GstIcecastSend), 0,
NULL, (GInstanceInitFunc) gst_icecastsend_init,
NULL,
sizeof(GstIcecastSend),
0,
(GInstanceInitFunc)gst_icecastsend_init,
}; };
icecastsend_type = g_type_register_static(GST_TYPE_ELEMENT, "GstIcecastSend", &icecastsend_info, 0); icecastsend_type = g_type_register_static(GST_TYPE_ELEMENT, "GstIcecastSend", &icecastsend_info, 0);
} }
@ -244,7 +239,6 @@ gst_icecastsend_set_property (GObject *object, guint prop_id, const GValue *valu
{ {
GstIcecastSend *icecastsend; GstIcecastSend *icecastsend;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail(GST_IS_ICECASTSEND(object)); g_return_if_fail(GST_IS_ICECASTSEND(object));
icecastsend = GST_ICECASTSEND(object); icecastsend = GST_ICECASTSEND(object);
@ -429,7 +423,7 @@ gst_icecastsend_change_state (GstElement *element)
} }
else { else {
/* changed from g_warning, and included result code lookup. */ /* changed from g_warning, and included result code lookup. */
g_error ("couldn't connect to server... (%i: %s)\n", icecastsend->conn.error, SHOUT_ERRORS[icecastsend->conn.error]); g_warning ("couldn't connect to server... (%i: %s)\n", icecastsend->conn.error, SHOUT_ERRORS[icecastsend->conn.error]);
shout_disconnect (&icecastsend->conn); shout_disconnect (&icecastsend->conn);
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
} }