From: Philip Chimento Date: Tue, 28 Dec 2010 16:32:15 +0000 (+0100) Subject: Improve error handling X-Git-Tag: v0.9~152^2~20 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=9fb8d9eae579cb4dadc90929243aa0c3f2ff63f5;p=projects%2Fchimara%2Fchimara.git Improve error handling Interrupt glk_schannel_create() and print warnings if GStreamer functions fail --- diff --git a/libchimara/schannel.c b/libchimara/schannel.c index 696aaa2..004efef 100644 --- a/libchimara/schannel.c +++ b/libchimara/schannel.c @@ -44,12 +44,19 @@ glk_schannel_create(glui32 rock) g_free(pipeline_name); /* Create GStreamer elements to put in the pipeline */ - s->source = gst_element_factory_make("fakesrc", NULL); + s->source = gst_element_factory_make("filesrc", NULL); s->filter = gst_element_factory_make("identity", NULL); - s->sink = gst_element_factory_make("fakesink", NULL); + s->sink = gst_element_factory_make("autoaudiosink", NULL); + if(!s->source || !s->filter || !s->sink) { + WARNING("Could not create one or more GStreamer elements"); + goto fail; + } + gst_bin_add_many(GST_BIN(s->pipeline), s->source, s->filter, s->sink, NULL); - if(!gst_element_link_many(s->source, s->filter, s->sink, NULL)) + if(!gst_element_link_many(s->source, s->filter, s->sink, NULL)) { + WARNING("Could not link GStreamer elements"); goto fail; + } return s; @@ -166,8 +173,7 @@ glk_schannel_get_rock(schanid_t chan) glui32 glk_schannel_play(schanid_t chan, glui32 snd) { - VALID_SCHANNEL(chan, return 0); - return 0; + return glk_schannel_play_ext(chan, snd, 1, 0); } /**