X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=filter.h;h=77057e6a7d2b9a997219d907b3ddd459716283ad;hb=9228213e72bbcdaf42665f51c633af6c4ccc78bf;hp=69d4dfee8534941ab74bb17d7d2a5ff8e23eed6b;hpb=2031b9cab9304b02c0372f73eef54d9501277031;p=paraslash.git diff --git a/filter.h b/filter.h index 69d4dfee..77057e6a 100644 --- a/filter.h +++ b/filter.h @@ -28,16 +28,18 @@ struct filter_node { }; /** - * The structure associated with a paraslash filter. + * Describes a method to convert audio data. * - * Paraslash filters are "modules" which transform an audio stream. struct - * filter contains methods which are implemented by each filter. + * Paraslash filters are "modules" which transform the data of an audio stream. + * This structure contains the methods which have to be implemented by each + * filter. * - * Note: As several instances of the same filter may be running at the same - * time, all these filter functions must be reentrant; no static non-constant - * variables may be used. + * As several instances of the same filter may be running at the same time, all + * filter methods must be reentrant and no static non-constant variables must + * be used. * - * \sa \ref filter_node. + * \sa \ref filter_node, struct \ref receiver, struct \ref writer, struct \ref + * sched. */ struct filter { /** @@ -81,24 +83,10 @@ struct filter { * This should free whatever ->setup() has allocated. */ void (*teardown)(const struct lls_parse_result *lpr, void *conf); - /** - * Set scheduler timeout and add file descriptors to fd sets. - * - * This function controls the timeout value for the next call to - * select(2). It may decrease the current timeout but shall never - * increase it. The second purpose of this function is to add file - * descriptors to the two fd sets of the sched structure. The - * descriptors in these sets will be watched by the subsequent - * select(2) call. - */ - void (*pre_select)(struct sched *s, void *context); - /** - * Convert (filter) the given data. - * - * Pointer to the converting function of the filter. On errors, the - * post_select function is supposed to return a negative error code. - */ - int (*post_select)(struct sched *s, void *context); + /** Force a zero timeout if data is available in the buffer tree. */ + void (*pre_monitor)(struct sched *s, void *context); + /** Convert (filter) input data into output data. */ + int (*post_monitor)(struct sched *s, void *context); /** * Answer a buffer tree query. * @@ -124,7 +112,7 @@ int filter_setup(const char *fa, void **conf, struct lls_parse_result **lprp); #define FILTER_CMD_OPT_STRING_VAL(_cmd, _opt, _lpr) \ (lls_string_val(0, FILTER_CMD_OPT_RESULT(_cmd, _opt, _lpr))) -void generic_filter_pre_select(struct sched *s, void *context); +void generic_filter_pre_monitor(struct sched *s, void *context); int decoder_execute(const char *cmd, unsigned sample_rate, unsigned channels, char **result);