Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

The ALSA Sound Server
[The Applications]

The Distributed Audio Server Application. More...


Files

file  main.c
 This is the main file for alsad.


Data Structures

struct  alsad_handle_client_args
struct  alsad_drain_buff_args

Defines

#define ALSAD_CONFIG_FILE   "/etc/alsad/alsad.conf"
#define ALSAD_LOG_FILE   "/etc/alsad/alsad.log"
#define ALSAD_MAX_NET_QUEUE   30
#define ALSAD_SELECT_TIMEOUT   4
#define ALSAD_THREAD_CHANNEL_WAIT   4
#define ALSAD_THREAD_SHUTDOWN_TIME   6
#define ALSAD_BUFF_SIZE_SCALE   128
#define ALSAD_DEF_CIRC_TIMEOUT   1
#define ALSAD_MAX_COMPRESS   10L
#define ALSAD_DEFAULT_AUDIO_BUF_SIZE   1024
#define ALSAD_PROC_NAME   "alsad"
#define LOGMESSAGE(string, location)

Typedefs

typedef alsad_handle_client_args alsad_handle_client_args_t
typedef alsad_drain_buff_args alsad_drain_buff_args_t

Functions

void * alsad_handle_client (void *arguments)
void * alsad_drain_buffer (void *arguments)
int alsad_handle_add_stream (int sock, alsad_stream_list_t *head_of_list, alsad_config_keys_t *load_keys, alsad_control_t *return_ctrl)
int alsad_handle_del_stream (int sock, alsad_stream_list_t *head_of_list, alsad_control_t *return_ctrl)
int alsad_handle_add_src (int *sock, alsad_stream_list_t *head_of_list, alsad_control_t *rcvd_control, alsad_config_keys_t *load_keys, alsad_control_t *return_ctrl)
int alsad_handle_del_src (int sock, alsad_stream_list_t *head_of_list, alsad_control_t *rcvd_control, alsad_control_t *return_ctrl)
int alsad_handle_add_sink (int *sock, alsad_stream_list_t *head_of_list, alsad_control_t *rcvd_control, alsad_config_keys_t *load_keys, alsad_control_t *return_ctrl)
int alsad_handle_del_sink (int sock, alsad_stream_list_t *head_of_list, alsad_control_t *rcvd_control, alsad_control_t *return_ctrl)
int alsad_handle_list_stream (int sock, alsad_stream_list_t *head_of_list, alsad_control_t *return_ctrl)
int alsad_handle_list_pipe (int sock, alsad_stream_list_t *head_of_list, alsad_control_t *rcvd_control, alsad_control_t *return_ctrl)
int alsad_is_server (alsad_connect_addr_t *connection)
int alsad_data_pipe_compare (void *identifier, void *data_pipe)
int alsad_process_data_pipe (void *data_pipe, void *args)
int main (int argc, char **argv)

Variables

char buffer [50]
int server_port
int alsad_shutdown
char * config_file

Detailed Description

The Distributed Audio Server Application.


Define Documentation

#define ALSAD_BUFF_SIZE_SCALE   128
 

#define ALSAD_CONFIG_FILE   "/etc/alsad/alsad.conf"
 

#define ALSAD_DEF_CIRC_TIMEOUT   1
 

#define ALSAD_DEFAULT_AUDIO_BUF_SIZE   1024
 

#define ALSAD_LOG_FILE   "/etc/alsad/alsad.log"
 

#define ALSAD_MAX_COMPRESS   10L
 

#define ALSAD_MAX_NET_QUEUE   30
 

#define ALSAD_PROC_NAME   "alsad"
 

#define ALSAD_SELECT_TIMEOUT   4
 

#define ALSAD_THREAD_CHANNEL_WAIT   4
 

#define ALSAD_THREAD_SHUTDOWN_TIME   6
 

#define LOGMESSAGE string,
location   ) 
 

Value:

logmessage(string, location ,\
                ALSAD_PROC_NAME, ALSAD_LOG_FILE, __FILE__, __LINE__,\
                __FUNCTION__);


Typedef Documentation

typedef struct alsad_drain_buff_args alsad_drain_buff_args_t
 

typedef struct alsad_handle_client_args alsad_handle_client_args_t
 


Function Documentation

int alsad_data_pipe_compare void *  identifier,
void *  data_pipe
 

void * alsad_drain_buffer void *  arguments  ) 
 

Removes data from the streams circ_buff based on the alsad_stream_node_t.

This function is called in its own thread of execution by alsad_handle_add_stream. It removes sound data from the streams circ_buff at a rate that is defined by the streams alsad_stream_node_t.

Parameters:
arguments This parameter should to be a alsad_drain_buff_args*
See also:
alsad_handle_add_stream()
Returns:
There is no return value captured for this function.

int alsad_handle_add_sink int *  sock,
alsad_stream_list_t head_of_list,
alsad_control_t rcvd_control,
alsad_config_keys_t load_keys,
alsad_control_t return_ctrl
 

Handles adding a sink to an alsad stream

More description here

Parameters:
sock the socket descriptor for the current connection
head_of_list the global list of streams for alsad
rcvd_control the alsad_control_t received from the connected client
load_keys the key-value pairs loaded from the alsad config file
See also:
alsad_handle_del_sink()
Returns:
An integer -1 on failure or 0 on success

int alsad_handle_add_src int *  sock,
alsad_stream_list_t head_of_list,
alsad_control_t rcvd_control,
alsad_config_keys_t load_keys,
alsad_control_t return_ctrl
 

Handles adding a new source to an alsad stream

More detail here

Parameters:
sock the socket descriptor for the current connection
head_of_list the global list of streams for alsad
rcvd_control the alsad_control_t received from the connected client
load_keys the key-value pairs loaded from the alsad config file
See also:
alsad_handle_del_src()
Returns:
An integer -1 on failure or 0 on success

\todo When adding a source that is a hw_iface set the mixer to capture from the device specified by the client.

The main processing loop should probably be handled in a separate thread of execution. This change would allow a session to continue after a sink or source were created (this doesn't matter when the path is the current socket)

int alsad_handle_add_stream int  sock,
alsad_stream_list_t head_of_list,
alsad_config_keys_t load_keys,
alsad_control_t return_ctrl
 

Handles adding a new stream to alsad_stream_list_t.

This function requests an alsad_stream_props from the connected client, verifying the format, and attempts to add it into the global stream list. If the insertion is successful it will then create a thread to drain the audio buffer (alsad_drain_buffer).

This function allocates an alsad_stream_props_t and an alsad_stream_node_t that get freed by alsad_handle_del_stream.

Parameters:
sock the socket descriptor for the current connection
head_of_list the global list of streams for alsad
load_keys the key-value pairs loaded from the alsad config file
See also:
alsad_handle_del_stream()

alsad_drain_buffer()

Returns:
An integer -1 on failure or 0 on success

void * alsad_handle_client void *  arguments  ) 
 

int alsad_handle_del_sink int  sock,
alsad_stream_list_t head_of_list,
alsad_control_t rcvd_control,
alsad_control_t return_ctrl
 

Handles deleting a sink to from alsad stream

More description here

Parameters:
sock the socket descriptor for the current connection
head_of_list the global list of streams for alsad
rcvd_control the alsad_control_t received from the connected client
See also:
alsad_handle_del_sink()
Returns:
An integer -1 on failure or 0 on success

Todo:
I need a function to perform these operations in alsad_stream_list_t

int alsad_handle_del_src int  sock,
alsad_stream_list_t head_of_list,
alsad_control_t rcvd_control,
alsad_control_t return_ctrl
 

Handles deleting a source from an alsad stream

More description here

Parameters:
sock the socket descriptor for the current connection
head_of_list the global list of streams for alsad
rcvd_control the alsad_control_t received from the connected client
See also:
alsad_handle_add_src()
Returns:
An integer -1 on failure or 0 on success

int alsad_handle_del_stream int  sock,
alsad_stream_list_t head_of_list,
alsad_control_t return_ctrl
 

Handles deleting a stream from alsad_stream_list_t.

More detail here

This function frees the alsad_stream_props_t and alsad_stream_node_t allocated by alsad_handle_add_stream.

Parameters:
sock the socket descriptor for the current connection
head_of_list the global list of streams for alsad
See also:
alsad_handle_add_stream()
Returns:
An integer -1 on failure or 0 on success

int alsad_handle_list_pipe int  sock,
alsad_stream_list_t list,
alsad_control_t rcvd_control,
alsad_control_t return_ctrl
 

Handles returning a list of alsad_data_pipe_t to a connected client

More description here

Parameters:
sock the socket descriptor for the current connection
head_of_list the global list of streams for alsad
rcvd_control the alsad_control_t received from the connected client
Returns:
An integer -1 on failure or 0 on success

int alsad_handle_list_stream int  sock,
alsad_stream_list_t head_of_list,
alsad_control_t return_ctrl
 

Handles returning a list of alsad streams to a connected client

More description here

Parameters:
sock the socket descriptor for the current connection
head_of_list the global list of streams for alsad
Returns:
An integer -1 on failure or 0 on success

int alsad_is_server alsad_connect_addr_t connection  ) 
 

int alsad_process_data_pipe void *  data_pipe,
void *  args
 

int main int  argc,
char **  argv
 


Variable Documentation

int alsad_shutdown
 

char buffer[50]
 

char* config_file
 

int server_port
 


Generated on Thu Dec 16 23:07:32 2004 for alsad by doxygen 1.3.6