2 * Copyright (C) 2006-2009 Andre Noll <maan@systemlinux.org>
4 * Licensed under the GPL v2. For licencing details see COPYING.
7 /** \file audiod.h symbols exported from audiod.c */
10 int num_filters(int audio_format_num);
11 int get_audio_format_num(char *name);
13 /** enum of audio formats supported by para_audiod */
14 enum {AUDIOD_AUDIO_FORMATS_ENUM};
16 /** array of audio format names supported by para_audiod */
17 extern const char *audio_formats[];
19 /** maximal number of simultaneous instances */
20 #define MAX_STREAM_SLOTS 5
23 * the possible modes of operation
25 * - off: disconnect from para_server
26 * - on: receive status information from para_server and play the audio stream
27 * - sb: only receive status information but not the audio stream
29 enum audiod_status_info {AUDIOD_OFF, AUDIOD_ON, AUDIOD_STANDBY};
31 /** defines one command of para_audiod */
32 struct audiod_command {
33 /** the name of the command */
35 /** pointer to the function that handles the command */
36 int (*handler)(int, int, char**);
38 * if the command prefers to handle the full line (rather than the usual
39 * argv[] array), it stores a pointer to the corresponding line handling
40 * function here. In this case, the above \a handler pointer must be NULL.
42 int (*line_handler)(int, char*);
43 /** one-line description of the command */
44 const char *description;
45 /** summary of the command line options */
47 /** the long help text */
52 * Describes one instance of a receiver-filter-writer chain.
54 * \sa receiver_node, receiver, filter, filter_node, filter_chain, writer,
55 * writer_node, writer_node_group.
58 /** Number of the audio format in this slot. */
60 /** Receiver start time. */
61 struct timeval rstime;
62 /** Writer start time. */
63 struct timeval wstime;
64 /** The stream_start status item announced by para_server. */
65 struct timeval server_stream_start;
66 /** The offset status item announced by para_server. */
67 unsigned offset_seconds;
68 /** The seconds_total status item announced by para_server. */
69 unsigned seconds_total;
70 /** The receiver info associated with this slot. */
71 struct receiver_node *receiver_node;
72 /** The active filter chain. */
73 struct filter_chain *fc;
74 /** The active writer node group. */
75 struct writer_node_group *wng;
78 extern struct slot_info slot[MAX_STREAM_SLOTS];
79 extern struct audiod_args_info conf;
80 extern int audiod_status;
82 void __noreturn clean_exit(int status, const char *msg);
83 int handle_connect(int accept_fd);
84 void audiod_status_dump(void);
85 void dump_empty_status(void);
86 char *get_time_string(int slot_num);
88 /** iterate over all slots */
89 #define FOR_EACH_SLOT(_slot) for (_slot = 0; _slot < MAX_STREAM_SLOTS; _slot++)