2 * Copyright (C) 2006 Andre Noll <maan@tuebingen.mpg.de>
4 * Licensed under the GPL v2. For licencing details see COPYING.
7 /** \file write.h Writer-related structures. */
10 * Describes one running instance of a writer.
13 /** The ID of this writer. */
15 /** Writer-specific data. */
17 /** The parsed command line, merged with options given in the config file. */
18 struct lls_parse_result *lpr;
19 /** The buffer tree node associated with this writer node. */
20 struct btr_node *btrn;
21 /** The task of this writer node. */
23 /** The minimal input queue size (size of one audio sample). */
27 /** Describes one supported writer. */
30 * Prepare the fd sets for select.
32 * This is called from scheduler. It may use the sched pointer to add
33 * any file descriptors or to decrease the select timeout.
35 void (*pre_select)(struct sched *s, void *context);
39 * Called from the post_select function of the writer node's task.
41 int (*post_select)(struct sched *s, void *context);
43 * Close one instance of the writer.
45 * This function is assumed to succeed.
47 void (*close)(struct writer_node *);
49 * The callback handler.
51 * Each writer may provide an ->execute callback which can be used for
52 * inter-node communication.
54 btr_command_handler execute;
57 #define WRITE_CMD(_num) (lls_cmd(_num, write_cmd_suite))
59 #define WRITE_CMD_OPT_RESULT(_cmd, _opt, _lpr) \
60 (lls_opt_result(LSG_WRITE_CMD_ ## _cmd ## _OPT_ ## _opt, _lpr))
61 #define WRITE_CMD_OPT_GIVEN(_cmd, _opt, _lpr) \
62 (lls_opt_given(WRITE_CMD_OPT_RESULT(_cmd, _opt, _lpr)))
63 #define WRITE_CMD_OPT_UINT32_VAL(_cmd, _opt, _lpr) \
64 (lls_uint32_val(0, WRITE_CMD_OPT_RESULT(_cmd, _opt, (_lpr))))
65 #define WRITE_CMD_OPT_STRING_VAL(_cmd, _opt, _lpr) \
66 (lls_string_val(0, WRITE_CMD_OPT_RESULT(_cmd, _opt, (_lpr))))
68 int check_writer_arg_or_die(const char *wa, struct lls_parse_result **lprp);
69 const struct writer *writer_get(int wid);
70 const char *writer_name(int wid);
71 void register_writer_node(struct writer_node *wn, struct btr_node *parent,
73 void get_btr_sample_rate(struct btr_node *btrn, int32_t *result);
74 void get_btr_channels(struct btr_node *btrn, int32_t *result);
75 void get_btr_sample_format(struct btr_node *btrn, int32_t *result);
76 void print_writer_helps(bool detailed);