paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Functions | Data Structures
write.h File Reference

Detailed Description

Writer API.

Writers are part of para_audiod(1), para_write(1) and para_play(1). They represent data sinks which receive input via the buffer tree mechanism from their parent buffer tree node and consume input data without producing any output.

An instance of a writer is described by struct writer_node, whose buffer tree node writer_node::btrn is set up as a leaf node of the buffer tree, see buffer_tree.h.

The alsa and the ao writer defined in alsa_write.c and ao_write.c consume the data received from higher level buffer tree nodes by writing data to an audio device, employing the alsa and ao low level libraries. The file writer (see file_write.c) writes data to an output file instead.

The functions declared here are defined in write_common.c.

Functions

int check_writer_arg_or_die (const char *wa, struct lls_parse_result **lprp)
 
const struct writerwriter_get (int wid)
 
const char * writer_name (int wid)
 
void register_writer_node (struct writer_node *wn, struct btr_node *parent, struct sched *s)
 
int get_btr_sample_rate (struct btr_node *btrn, int32_t *result)
 
int get_btr_channels (struct btr_node *btrn, int32_t *result)
 
int get_btr_sample_format (struct btr_node *btrn, int32_t *result)
 
void print_writer_helps (bool detailed)
 

Data Structures

struct  writer_node
 
struct  writer
 

Function Documentation

◆ check_writer_arg_or_die()

int check_writer_arg_or_die ( const char *  wa,
struct lls_parse_result **  lprp 
)

Check if the given string is a valid writer argument.

Parameters
waString of the form writer_name options.
lprpContains the parsed command line on success.

If the argument is NULL, the (configuration-dependent) default writer and no arguments are assumed. Otherwise, the function makes sure that the argument starts with the name of a supported writer and splits the remaining part of the argument. In the second step the thusly obtained arguments are passed to the configuration parser determined in the first step, returning the parse result via the second argument to the function.

Returns
On success, the positive writer ID is returned. Otherwise the function prints an error message and calls exit(3).

◆ writer_get()

const struct writer* writer_get ( int  wid)

Return the writer structure from a writer ID.

Parameters
widIf non-positive, a pointer to the default writer is returned.
Returns
Pointer to a (constant) struct writer.

Referenced by register_writer_node().

◆ writer_name()

const char* writer_name ( int  wid)

Return name of the writer identified by a writer ID.

Parameters
widIf non-positive, the name of the default writer is returned.
Returns
The returned buffer must not be freed by the caller.

Referenced by register_writer_node().

◆ register_writer_node()

void register_writer_node ( struct writer_node wn,
struct btr_node *  parent,
struct sched s 
)

Open a writer node and register the corresponding task.

Parameters
wnThe writer node to open.
parentThe parent btr node (the source for the writer node).
sThe scheduler instance to register the task to.

◆ get_btr_sample_rate()

int get_btr_sample_rate ( struct btr_node *  btrn,
int32_t *  result 
)

Ask parent buffer tree nodes for the sample rate of the current stream.

Parameters
btrnWhere to start the search.
resultFilled in by this function.
Returns
Standard.

◆ get_btr_channels()

int get_btr_channels ( struct btr_node *  btrn,
int32_t *  result 
)

Ask parent buffer tree nodes for the channel count of the current stream.

Parameters
btrnSee get_btr_sample_rate.
resultSee get_btr_sample_rate.
Returns
Standard.

◆ get_btr_sample_format()

int get_btr_sample_format ( struct btr_node *  btrn,
int32_t *  result 
)

Ask parent nodes for the number of bits per sample and the byte sex.

Parameters
btrnSee get_btr_sample_rate.
resultContains the sample format as an enum sample_format type.
Returns
Standard.

◆ print_writer_helps()

void print_writer_helps ( bool  detailed)

Print the help text of all writers to stdout.

Parameters
detailedWhether to print the short or the detailed help.