Kill unused writer_node_group code.
[paraslash.git] / write.h
1 /*
2 * Copyright (C) 2006-2009 Andre Noll <maan@systemlinux.org>
3 *
4 * Licensed under the GPL v2. For licencing details see COPYING.
5 */
6
7 /** \file write.h Writer-related structures. */
8
9 /** The list of supported writers. */
10 enum writer_enum {WRITER_ENUM};
11
12 /**
13 * Describes one running instance of a writer.
14 */
15 struct writer_node {
16 /** The number of this writer. */
17 int writer_num;
18 /** Writer-specific data. */
19 void *private_data;
20 /** The writer-specific configuration of this node. */
21 void *conf;
22 struct btr_node *btrn;
23 struct task task;
24 size_t min_iqs;
25 };
26
27 /** Describes one supported writer. */
28 struct writer {
29 /**
30 * The init function of the writer.
31 *
32 * It must fill in all other function pointers of the given
33 * writer structure.
34 */
35 void (*init)(struct writer *w);
36 /**
37 * The command line parser of the writer.
38 *
39 * It should check whether the command line options given by \a options are
40 * valid. On success, it should return a pointer to the writer-specific
41 * configuration data determined by \a options. Note that this might be called
42 * more than once with different values of \a options.
43 */
44 void *(*parse_config)(const char *options);
45 void (*free_config)(void *conf);
46 /**
47 * Open one instance of this writer.
48 *
49 * This function should perform any work necessary to write the incoming
50 * stream. To this aim, it may allocate its private data structure and store
51 * a pointer to that structure via the given writer_node parameter.
52 */
53 int (*open)(struct writer_node *);
54 /**
55 * Prepare the fd sets for select.
56 *
57 * This is called from the writer node group task's pre_select(). It
58 * may use the sched pointer to add any file descriptors or to decrease
59 * the select timeout. It must return positive on success and negative
60 * on errors.
61 */
62 int (*pre_select)(struct sched *s, struct writer_node *wn);
63 void (*pre_select_btr)(struct sched *s, struct task *t);
64 /**
65 * Write audio data.
66 *
67 * Called from the post_select function of the wng task. It must keep
68 * track of the number of bytes consumed from the wng's buffer via
69 * the \p wn->written variable (which may be modified by the wng handling
70 * functions). This function must return positive on success and
71 * negative on errors.
72 */
73 int (*post_select)(struct sched *s, struct writer_node *wn);
74 void (*post_select_btr)(struct sched *s, struct task *t);
75 /**
76 * Close one instance of the writer.
77 *
78 * This function is assumed to succeed.
79 */
80 void (*close)(struct writer_node *);
81 /**
82 * Shutdown the writer
83 *
84 * This is a optional function pointer used for cleaning up.
85 */
86 void (*shutdown)(struct writer_node *);
87 struct ggo_help help;
88 btr_command_handler execute;
89 };
90
91 /** Loop over each supported writer. */
92 #define FOR_EACH_WRITER(i) for (i = 0; i < NUM_SUPPORTED_WRITERS; i++)
93
94 /** Declare the init functions of all supported writers. */
95 DECLARE_WRITER_INITS;
96
97 /** Array containing the name of each writer. */
98 extern const char *writer_names[];
99
100 /** The writer structure for each supported writer. */
101 extern struct writer writers[NUM_SUPPORTED_WRITERS];