Paraslash Audio Streaming | |
About News Download Documentation Development |
The paraslash's audio daemon. More...
#include <netinet/in.h>
#include <sys/socket.h>
#include <regex.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <sys/un.h>
#include <netdb.h>
#include <signal.h>
#include <pwd.h>
#include <lopsub.h>
#include "audiod.lsg.h"
#include "recv_cmd.lsg.h"
#include "para.h"
#include "error.h"
#include "lsu.h"
#include "crypt.h"
#include "list.h"
#include "sched.h"
#include "buffer_tree.h"
#include "recv.h"
#include "filter.h"
#include "grab_client.h"
#include "client.h"
#include "audiod.h"
#include "net.h"
#include "daemon.h"
#include "string.h"
#include "fd.h"
#include "write.h"
#include "version.h"
Macros | |
#define | CMD_PTR (lls_cmd(0, audiod_suite)) |
#define | OPT_RESULT(_name) (lls_opt_result(LSG_AUDIOD_PARA_AUDIOD_OPT_ ## _name, lpr)) |
#define | OPT_GIVEN(_name) (lls_opt_given(OPT_RESULT(_name))) |
#define | OPT_STRING_VAL(_name) (lls_string_val(0, OPT_RESULT(_name))) |
#define | OPT_UINT32_VAL(_name) (lls_uint32_val(0, OPT_RESULT(_name))) |
#define | NUM_AUDIO_FORMATS ARRAY_SIZE(audio_formats) |
#define | RECEIVER_CMD(_a) lls_cmd((_a)->receiver_num, recv_cmd_suite) |
#define | RECEIVER(_a) ((const struct receiver *)lls_user_data(RECEIVER_CMD(_a))) |
#define | MAX_STREAM_SLOTS 5 |
Maximal number of simultaneous instances. More... | |
#define | FOR_EACH_SLOT(_slot) for (_slot = 0; _slot < MAX_STREAM_SLOTS; _slot++) |
Iterate over all slots. More... | |
#define | FOR_EACH_AUDIO_FORMAT(af) for (af = 0; af < NUM_AUDIO_FORMATS; af++) |
Iterate over all supported audio formats. More... | |
Enumerations | |
enum | vss_status_flags { VSS_STATUS_FLAG_NEXT = 1, VSS_STATUS_FLAG_PLAYING = 2 } |
The vss status flags audiod is interested in. More... | |
Functions | |
__malloc char * | audiod_get_decoder_flags (void) |
Return the flags for the decoder_flags status item. More... | |
__malloc char * | get_time_string (void) |
Compute the play time based on information of the current slot. More... | |
struct btr_node * | audiod_get_btr_root (void) |
Return the root node of the current buffer tree. More... | |
bool | uid_is_whitelisted (uid_t uid) |
Lookup the given UID in the whitelist. More... | |
int | main (int argc, char *argv[]) |
the main function of para_audiod More... | |
Variables | |
DEFINE_PARA_ERRLIST | |
Array of error strings. More... | |
__printf_2_3 void(* | para_log )(int, const char *,...) = daemon_log |
struct slot_info | slot [5] |
para_audiod uses MAX_STREAM_SLOTS different slots, each of which may be associated with a receiver/filter/writer triple. More... | |
struct sched | sched = {.timeout = 0} |
The scheduler instance of para_audiod. More... | |
char * | stat_item_values [NUM_STAT_ITEMS] = {NULL} |
The array of status items sent by para_server. More... | |
int | audiod_status = AUDIOD_ON |
The current mode of operation (AUDIOD_OFF, AUDIOD_ON or AUDIOD_STANDBY). More... | |
The paraslash's audio daemon.
#define CMD_PTR (lls_cmd(0, audiod_suite)) |
#define OPT_RESULT | ( | _name | ) | (lls_opt_result(LSG_AUDIOD_PARA_AUDIOD_OPT_ ## _name, lpr)) |
#define OPT_GIVEN | ( | _name | ) | (lls_opt_given(OPT_RESULT(_name))) |
#define OPT_STRING_VAL | ( | _name | ) | (lls_string_val(0, OPT_RESULT(_name))) |
#define OPT_UINT32_VAL | ( | _name | ) | (lls_uint32_val(0, OPT_RESULT(_name))) |
#define NUM_AUDIO_FORMATS ARRAY_SIZE(audio_formats) |
#define RECEIVER_CMD | ( | _a | ) | lls_cmd((_a)->receiver_num, recv_cmd_suite) |
#define RECEIVER | ( | _a | ) | ((const struct receiver *)lls_user_data(RECEIVER_CMD(_a))) |
#define MAX_STREAM_SLOTS 5 |
Maximal number of simultaneous instances.
#define FOR_EACH_SLOT | ( | _slot | ) | for (_slot = 0; _slot < MAX_STREAM_SLOTS; _slot++) |
Iterate over all slots.
#define FOR_EACH_AUDIO_FORMAT | ( | af | ) | for (af = 0; af < NUM_AUDIO_FORMATS; af++) |
Iterate over all supported audio formats.
enum vss_status_flags |
__malloc char* audiod_get_decoder_flags | ( | void | ) |
Return the flags for the decoder_flags status item.
Allocates a string which contains one octal digit per slot. Bit zero (value 1) is set if a receiver is active. Bit one (value 2) and bit three (value 4) have the analogous meaning for filter and writer, respectively.
References FOR_EACH_SLOT, MAX_STREAM_SLOTS, para_strdup(), and slot.
__malloc char* get_time_string | ( | void | ) |
Compute the play time based on information of the current slot.
This computes a string of the form "0:07 [3:33] (3%/3:40)" using information from the status items received from para_server and the start time of the (first) writer of the current slot.
It has to take into account that the stream was probably not started at the beginning of the file, that the clock between the server and the client host may differ and that playback of the stream was delayed, e.g. because the prebuffer filter is used in the filter configuration.
If no writer is active, for example because para_audiod runs in standby mode, an approximation based only on the status items is computed and the returned string is prefixed with "~".
Referenced by audiod_status_dump().
struct btr_node* audiod_get_btr_root | ( | void | ) |
Return the root node of the current buffer tree.
This is only used for stream grabbing.
NULL
if no slot is currently active. If more than one buffer tree exists, the node corresponding to the most recently started receiver is returned. References btr_get_node_start(), FOR_EACH_SLOT, slot, and tv_diff().
bool uid_is_whitelisted | ( | uid_t | uid | ) |
Lookup the given UID in the whitelist.
The whitelist is the array of arguments to the –user-allow opion. If the option was not given, the array is empty, in which case the check succeeds.
uid | User ID to look up. |
References OPT_GIVEN.
int main | ( | int | argc, |
char * | argv[] | ||
) |
the main function of para_audiod
argc | usual argument count |
argv | usual argument vector |
DEFINE_PARA_ERRLIST |
Array of error strings.
__printf_2_3 void(* para_log) (int, const char *,...) = daemon_log |
struct slot_info slot[5] |
para_audiod uses MAX_STREAM_SLOTS
different slots, each of which may be associated with a receiver/filter/writer triple.
This array holds all information on the status of these slots.
Referenced by audiod_get_btr_root(), and audiod_get_decoder_flags().
The scheduler instance of para_audiod.
This is needed also in audiod_command.c (for the tasks command), so it can not be made static.
char* stat_item_values[NUM_STAT_ITEMS] = {NULL} |
The array of status items sent by para_server.
int audiod_status = AUDIOD_ON |
The current mode of operation (AUDIOD_OFF, AUDIOD_ON or AUDIOD_STANDBY).
Set by the on/off/cycle commands.