index.in.html: fix typo (2006 instead of 2007)
[paraslash.git] / audiod.h
1 /** \file audiod.h symbols exported from audiod.c */
2 int num_filters(int audio_format_num);
3 int get_audio_format_num(char *name);
4
5 /** enum of audio formats supported by para_audiod */
6 enum {AUDIOD_AUDIO_FORMATS_ENUM};
7
8 /** array of audio format names supported by para_audiod */
9 extern const char *audio_formats[];
10
11 /** maximal number of simultaneous instances */
12 #define MAX_STREAM_SLOTS 5
13
14 /**
15  * the possible modes of operation
16  *
17  * - off: disconnect from para_server
18  * - on: receive status information from para_server and play the audio stream
19  * - sb: only receive status information but not the audio stream
20 */
21 enum {AUDIOD_OFF, AUDIOD_ON, AUDIOD_STANDBY};
22
23 /**
24  * describes one instance of a receiver-filter-writer chain
25  *
26  * \sa receier_node, receiver, filter, filter_node, filter_chain, writer,
27  * writer_node, writer_node_group.
28   */
29 struct slot_info {
30         /** number of the audio format in this slot */
31         int format;
32         /** writer start time */
33         struct timeval wstime;
34         /** the receiver info associated with this slot */
35         struct receiver_node *receiver_node;
36         /** the active filter chain */
37         struct filter_chain *fc;
38         /** the active writer node group */
39         struct writer_node_group *wng;
40 };
41
42 /**
43  * the main task of audiod
44  *
45  * \sa struct task, struct sched
46  */
47 struct audiod_task {
48         struct timeval *now;
49         struct task task;
50 };
51
52 /**
53  * the task for audiod's child (para_client stat)
54  *
55  * \sa struct task, struct sched
56  */
57 struct status_task {
58         /** the associated task structure of audiod */
59         struct task task;
60         struct private_client_data *pcd;
61         /** the array of status items sent by para_server */
62         char *stat_item_values[NUM_STAT_ITEMS];
63         /** do not restart client command until this time */
64         struct timeval restart_barrier;
65         /** last time we received status data from para_server */
66         struct timeval last_status_read;
67         /** the offset value announced by para_server */
68         int offset_seconds;
69         /** the length of the current audio file as announced by para_server */
70         int length_seconds;
71         /** the start of the current stream from the view of para_server */
72         struct timeval server_stream_start;
73         /** the averaged time deviation between para_server and para_audiod */
74         struct timeval sa_time_diff;
75         /** whether client time is ahead of server time */
76         int sa_time_diff_sign;
77         /** non-zero if \a af_status is "playing" */
78         int playing;
79 };
80
81 extern struct status_task *stat_task;
82 extern struct slot_info slot[MAX_STREAM_SLOTS];
83 extern struct audiod_args_info conf;
84 extern int audiod_status;
85 extern const char *status_item_list[NUM_STAT_ITEMS];
86
87 void __noreturn clean_exit(int status, const char *msg);
88 int handle_connect(int accept_fd);
89 void audiod_status_dump(void);
90 void dump_empty_status(void);
91
92 /** iterate over all slots */
93 #define FOR_EACH_SLOT(_slot) for (_slot = 0; _slot < MAX_STREAM_SLOTS; _slot++)