2 * Copyright (C) 2006-2011 Andre Noll <maan@systemlinux.org>
4 * Licensed under the GPL v2. For licencing details see COPYING.
7 /** \file write.h Writer-related structures. */
9 /** The list of supported writers. */
10 enum writer_enum
{WRITER_ENUM
};
13 * Describes one running instance of a writer.
16 /** The number of this writer. */
18 /** Writer-specific data. */
20 /** The writer-specific configuration of this node. */
22 /** The buffer tree node associated with this writer node. */
23 struct btr_node
*btrn
;
24 /** The task of this writer node. */
26 /** The minimal input queue size (size of one audio sample). */
30 /** Describes one supported writer. */
33 * The init function of the writer.
35 * It must fill in all other function pointers of the given
38 void (*init
)(struct writer
*w
);
40 * The command line parser of the writer.
42 * It should check whether the command line options given by \a options
43 * are valid and return a pointer to the writer-specific configuration
44 * data determined by \a options. This function must either succeed or
45 * call exit(). Note that parse_config_or_die() might be called more
46 * than once with different values of \a options. \sa \ref
49 void *(*parse_config_or_die
)(const char *options
);
51 * Dellocate all configuration resources.
53 * This should free whatever was allocated by \ref parse_config_or_die().
55 void (*free_config
)(void *config
);
57 * Prepare the fd sets for select.
59 * This is called from scheduler. It may use the sched pointer to add
60 * any file descriptors or to decrease the select timeout.
62 void (*pre_select
)(struct sched
*s
, struct task
*t
);
66 * Called from the post_select function of the writer node's task.
68 void (*post_select
)(struct sched
*s
, struct task
*t
);
70 * Close one instance of the writer.
72 * This function is assumed to succeed.
74 void (*close
)(struct writer_node
*);
76 * Shutdown the writer.
78 * This is a optional function pointer used for cleaning up.
80 void (*shutdown
)(struct writer_node
*);
81 /** The short and the log help text of this writer. */
84 * The callback handler.
86 * Each writer may provide an ->execute callback which can be used for
87 * inter-node communication.
89 btr_command_handler execute
;
92 /** Loop over each supported writer. */
93 #define FOR_EACH_WRITER(i) for (i = 0; i < NUM_SUPPORTED_WRITERS; i++)
95 /** Declare the init functions of all supported writers. */
98 /** Array containing the name of each writer. */
99 extern const char *writer_names
[];
101 /** The writer structure for each supported writer. */
102 extern struct writer writers
[NUM_SUPPORTED_WRITERS
];