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). */
24 * Describes a data sink for audio streams.
26 * A paraslash writer obtains data via the buffer tree mechanism from its
27 * parent node. It consumes data without producing output on its own.
29 * This structure contains the methods which have to be implemented by each
32 * \sa struct \ref writer_node, struct \ref receiver, struct \ref filter,
36 /** Ask the scheduler to check whether data can be written. */
37 void (*pre_monitor)(struct sched *s, void *context);
38 /** Write audio data. */
39 int (*post_monitor)(struct sched *s, void *context);
41 * Close one instance of the writer.
43 * This function is assumed to succeed.
45 void (*close)(struct writer_node *);
47 * The callback handler.
49 * Each writer may provide an ->execute callback which can be used for
50 * inter-node communication.
52 btr_command_handler execute;
55 #define WRITE_CMD(_num) (lls_cmd(_num, write_cmd_suite))
57 #define WRITE_CMD_OPT_RESULT(_cmd, _opt, _lpr) \
58 (lls_opt_result(LSG_WRITE_CMD_ ## _cmd ## _OPT_ ## _opt, _lpr))
59 #define WRITE_CMD_OPT_GIVEN(_cmd, _opt, _lpr) \
60 (lls_opt_given(WRITE_CMD_OPT_RESULT(_cmd, _opt, _lpr)))
61 #define WRITE_CMD_OPT_UINT32_VAL(_cmd, _opt, _lpr) \
62 (lls_uint32_val(0, WRITE_CMD_OPT_RESULT(_cmd, _opt, (_lpr))))
63 #define WRITE_CMD_OPT_STRING_VAL(_cmd, _opt, _lpr) \
64 (lls_string_val(0, WRITE_CMD_OPT_RESULT(_cmd, _opt, (_lpr))))
66 int check_writer_arg_or_die(const char *wa, struct lls_parse_result **lprp);
67 const struct writer *writer_get(int wid);
68 const char *writer_name(int wid);
69 void register_writer_node(struct writer_node *wn, struct btr_node *parent,
71 int get_btr_sample_rate(struct btr_node *btrn, int32_t *result);
72 int get_btr_channels(struct btr_node *btrn, int32_t *result);
73 int get_btr_sample_format(struct btr_node *btrn, int32_t *result);
74 void print_writer_helps(bool detailed);