]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - filter.h
Make filter config parsers return int.
[paraslash.git] / filter.h
index 1b916eecf632cc834b46703007097d6a02e6413a..2d1c150afdda6add9bb498c625889fdcbdda5ea3 100644 (file)
--- a/filter.h
+++ b/filter.h
@@ -34,6 +34,7 @@ struct filter_node {
 
 /** Describes one running instance of a chain of filters */
 struct filter_chain {
+       /** The length of the filter chain. */
        unsigned int num_filters;
        /**
         * The number of channels of the current stream.
@@ -190,14 +191,16 @@ struct filter {
        /**
         * A pointer to the filter's command line parser.
         *
-        * If this optional function pointer is not NULL, any filter options are passed
-        * from the main program to this command line parser once at application
-        * startup. The command line parser should check its command line options given
-        * by \a argc and \a argv and abort on errors. On success, it should return a
-        * pointer to the filter-specific configuration data determined by \a argc and
-        * \a argv.
+        * If this optional function pointer is not NULL, any filter options
+        * are passed from the main program to this command line parser once at
+        * application startup. The command line parser should check its
+        * command line options given by \a argc and \a argv and abort on
+        * errors. Success must be indicated by a non-negative return value. In
+        * this case the function should return a pointer to the
+        * filter-specific configuration data determined by \a argc and \a
+        * argv. On failure, a negative paraslash error code must be returned.
         */
-       void *(*parse_config)(int argc, char **argv);
+       int (*parse_config)(int argc, char **argv, void **config);
 };
 
 void close_filters(struct filter_chain *fc);
@@ -232,9 +235,8 @@ extern struct filter filters[];
 
 /* filters that are always present */
 DECLARE_EXTERN_FILTER_INIT(wav);
-/* wav is always the first filter */
-#define WAV_FILTER_NUM 0
 DECLARE_EXTERN_FILTER_INIT(compress);
+DECLARE_EXTERN_FILTER_INIT(amp);
 
 /* next the optional filters */
 #ifdef HAVE_MAD
@@ -263,6 +265,7 @@ DECLARE_EXTERN_FILTER_INIT(oggdec);
 #define DEFINE_FILTER_ARRAY(filters) struct filter filters[] = { \
        FILTER_INIT(wav) \
        FILTER_INIT(compress) \
+       FILTER_INIT(amp) \
        MP3DEC_FILTER \
        AACDEC_FILTER \
        OGGDEC_FILTER \