afh loglevel adjustments.
[paraslash.git] / audiod.h
1 /*
2  * Copyright (C) 2006 Andre Noll <maan@tuebingen.mpg.de>
3  *
4  * Licensed under the GPL v2. For licencing details see COPYING.
5  */
6
7 /** \file audiod.h Symbols exported from audiod.c. */
8
9
10 /** enum of audio formats supported by para_audiod */
11 enum {AUDIOD_AUDIO_FORMATS_ENUM};
12
13 /** array of audio format names supported by para_audiod */
14 extern const char *audio_formats[];
15
16 /** maximal number of simultaneous instances */
17 #define MAX_STREAM_SLOTS 5
18
19 /**
20  * the possible modes of operation
21  *
22  * - off: disconnect from para_server
23  * - on: receive status information from para_server and play the audio stream
24  * - sb: only receive status information but not the audio stream
25  */
26 enum audiod_status_info {AUDIOD_OFF, AUDIOD_ON, AUDIOD_STANDBY};
27
28 /** defines one command of para_audiod */
29 struct audiod_command {
30         /** the name of the command */
31         const char *name;
32         /** pointer to the function that handles the command */
33         int (*handler)(int, int, char**);
34         /** one-line description of the command */
35         const char *description;
36         /** summary of the command line options */
37         const char *usage;
38         /** the long help text */
39         const char *help;
40 };
41
42 /**
43  * Describes one instance of a receiver-filter-writer chain.
44  *
45  * \sa receiver_node, receiver, filter, filter_node, writer, writer_node,
46  * writer_node_group.
47  */
48 struct slot_info {
49         /** Number of the audio format in this slot. */
50         int format;
51         /** The stream_start status item announced by para_server.  */
52         struct timeval server_stream_start;
53         /** The offset status item announced by para_server. */
54         unsigned offset_seconds;
55         /** The seconds_total status item announced by para_server. */
56         unsigned seconds_total;
57         /** The receiver info associated with this slot. */
58         struct receiver_node *receiver_node;
59         /** The array of filter nodes. */
60         struct filter_node *fns;
61         /** The array of writers attached to the last filter. */
62         struct writer_node *wns;
63 };
64
65 extern struct slot_info slot[MAX_STREAM_SLOTS];
66 extern struct audiod_args_info conf;
67 extern int audiod_status;
68
69 int handle_connect(int accept_fd, fd_set *rfds);
70 void audiod_status_dump(bool force);
71 char *get_time_string(int slot_num);
72 struct btr_node *audiod_get_btr_root(void);
73
74 void stat_client_write_item(int item_num);
75 void clear_and_dump_items(void);
76 void close_stat_clients(void);
77
78 /** iterate over all slots */
79 #define FOR_EACH_SLOT(_slot) for (_slot = 0; _slot < MAX_STREAM_SLOTS; _slot++)