X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/0b47d5168900dcf3ba40d7abc7942cd8049818d7..477b12ff719d3749b8d8f85035bd6384fee9be0d:/server/gstdecode.c diff --git a/server/gstdecode.c b/server/gstdecode.c index 0ebe83a..6a288bc 100644 --- a/server/gstdecode.c +++ b/server/gstdecode.c @@ -35,11 +35,13 @@ #include #include -/* The only application we have for `attribute' is declaring function +/* The only applications we have for `attribute' is declaring function * arguments as being unused, because we have a lot of callback functions - * which are meant to comply with an externally defined interface. + * which are meant to comply with an externally defined interface; and + * marking `help' as not returning. */ #ifdef __GNUC__ +# define NORETURN __attribute__((noreturn)) # define UNUSED __attribute__((unused)) #endif @@ -149,7 +151,7 @@ static void link_elements(GstElement *left, GstElement *right) disorder_error(0, "failed to link GStreamer elements `%s' and `%s'", GST_OBJECT_NAME(left), GST_OBJECT_NAME(right)); report_element_pads("source", left, gst_element_iterate_src_pads(left)); - report_element_pads("source", right, gst_element_iterate_sink_pads(right)); + report_element_pads("dest", right, gst_element_iterate_sink_pads(right)); disorder_fatal(0, "can't decode `%s'", file); } @@ -215,6 +217,10 @@ static void prepare_pipeline(void) GstCaps *caps; const struct stream_header *fmt = &config->sample_format; + if(!source || !decode || !resample || !convert || !sink) + disorder_fatal(0, "failed to create GStreamer elements: " + "need base and good plugins"); + #ifndef HAVE_GSTREAMER_0_10 static const struct fmttab { const char *fmt; @@ -291,6 +297,9 @@ static void prepare_pipeline(void) */ if(mode != OFF) { gain = gst_element_factory_make("rgvolume", "gain"); + if(!gain) + disorder_fatal(0, "failed to create GStreamer elements: " + "need base and good plugins"); g_object_set(gain, "album-mode", mode == ALBUM, "fallback-gain", fallback, @@ -470,7 +479,7 @@ static void decode(void) gst_app_sink_set_callbacks(appsink, &callbacks, 0, 0); /* Set the ball rolling. */ - gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING); + gst_element_set_state(pipeline, GST_STATE_PLAYING); /* And wait for the miracle to come. */ g_main_loop_run(loop); @@ -478,7 +487,7 @@ static void decode(void) /* Shut down the pipeline. This isn't strictly necessary, since we're * about to exit very soon, but it's kind of polite. */ - gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_NULL); + gst_element_set_state(pipeline, GST_STATE_NULL); } static int getenum(const char *what, const char *s, const char *const *tags) @@ -526,7 +535,7 @@ static const struct option options[] = { { 0, 0, 0, 0 } }; -static void help(void) +static void NORETURN help(void) { xprintf("Usage:\n" " disorder-gstdecode [OPTIONS] PATH\n" @@ -577,6 +586,7 @@ int main(int argc, char *argv[]) if(optind >= argc) disorder_fatal(0, "missing filename"); file = argv[optind++]; if(optind < argc) disorder_fatal(0, "excess arguments"); + config_per_user = 0; if(config_read(1, 0)) disorder_fatal(0, "cannot read configuration"); /* Set up the GStreamer machinery. */