1 /* Copyright (C) 2006 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
3 /** \file write.h Writer-related structures. */
6 * Describes one running instance of a writer.
9 /** The ID of this writer. */
11 /** Writer-specific data. */
13 /** The parsed command line, merged with options given in the config file. */
14 struct lls_parse_result *lpr;
15 /** The buffer tree node associated with this writer node. */
16 struct btr_node *btrn;
17 /** The task of this writer node. */
19 /** The minimal input queue size (size of one audio sample). */
23 /** Describes one supported writer. */
26 * Prepare the fd sets for select.
28 * This is called from scheduler. It may use the sched pointer to add
29 * any file descriptors or to decrease the select timeout.
31 void (*pre_select)(struct sched *s, void *context);
35 * Called from the post_select function of the writer node's task.
37 int (*post_select)(struct sched *s, void *context);
39 * Close one instance of the writer.
41 * This function is assumed to succeed.
43 void (*close)(struct writer_node *);
45 * The callback handler.
47 * Each writer may provide an ->execute callback which can be used for
48 * inter-node communication.
50 btr_command_handler execute;
53 #define WRITE_CMD(_num) (lls_cmd(_num, write_cmd_suite))
55 #define WRITE_CMD_OPT_RESULT(_cmd, _opt, _lpr) \
56 (lls_opt_result(LSG_WRITE_CMD_ ## _cmd ## _OPT_ ## _opt, _lpr))
57 #define WRITE_CMD_OPT_GIVEN(_cmd, _opt, _lpr) \
58 (lls_opt_given(WRITE_CMD_OPT_RESULT(_cmd, _opt, _lpr)))
59 #define WRITE_CMD_OPT_UINT32_VAL(_cmd, _opt, _lpr) \
60 (lls_uint32_val(0, WRITE_CMD_OPT_RESULT(_cmd, _opt, (_lpr))))
61 #define WRITE_CMD_OPT_STRING_VAL(_cmd, _opt, _lpr) \
62 (lls_string_val(0, WRITE_CMD_OPT_RESULT(_cmd, _opt, (_lpr))))
64 int check_writer_arg_or_die(const char *wa, struct lls_parse_result **lprp);
65 const struct writer *writer_get(int wid);
66 const char *writer_name(int wid);
67 void register_writer_node(struct writer_node *wn, struct btr_node *parent,
69 void get_btr_sample_rate(struct btr_node *btrn, int32_t *result);
70 void get_btr_channels(struct btr_node *btrn, int32_t *result);
71 void get_btr_sample_format(struct btr_node *btrn, int32_t *result);
72 void print_writer_helps(bool detailed);