paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Data Structures | Macros | Functions
write.h File Reference

Writer-related structures. More...

Data Structures

struct  writer_node
 Describes one running instance of a writer. More...
 
struct  writer
 Describes a data sink for audio streams. More...
 

Macros

#define WRITE_CMD(_num)   (lls_cmd(_num, write_cmd_suite))
 
#define WRITE_CMD_OPT_RESULT(_cmd, _opt, _lpr)    (lls_opt_result(LSG_WRITE_CMD_ ## _cmd ## _OPT_ ## _opt, _lpr))
 
#define WRITE_CMD_OPT_GIVEN(_cmd, _opt, _lpr)    (lls_opt_given(WRITE_CMD_OPT_RESULT(_cmd, _opt, _lpr)))
 
#define WRITE_CMD_OPT_UINT32_VAL(_cmd, _opt, _lpr)    (lls_uint32_val(0, WRITE_CMD_OPT_RESULT(_cmd, _opt, (_lpr))))
 
#define WRITE_CMD_OPT_STRING_VAL(_cmd, _opt, _lpr)    (lls_string_val(0, WRITE_CMD_OPT_RESULT(_cmd, _opt, (_lpr))))
 

Functions

int check_writer_arg_or_die (const char *wa, struct lls_parse_result **lprp)
 Check if the given string is a valid command line for any writer. More...
 
const struct writerwriter_get (int wid)
 Return the writer structure from a writer ID. More...
 
const char * writer_name (int wid)
 Return name of the writer identified by a writer ID. More...
 
void register_writer_node (struct writer_node *wn, struct btr_node *parent, struct sched *s)
 Open a writer node and register the corresponding task. More...
 
int get_btr_sample_rate (struct btr_node *btrn, int32_t *result)
 Ask parent btr nodes for the sample rate of the current stream. More...
 
int get_btr_channels (struct btr_node *btrn, int32_t *result)
 Ask parent btr nodes for the channel count of the current stream. More...
 
int get_btr_sample_format (struct btr_node *btrn, int32_t *result)
 Ask parent btr nodes for the number of bits per sample and the byte sex. More...
 
void print_writer_helps (bool detailed)
 Print the help text of all writers to stdout. More...
 

Detailed Description

Writer-related structures.

Macro Definition Documentation

◆ WRITE_CMD

#define WRITE_CMD (   _num)    (lls_cmd(_num, write_cmd_suite))

◆ WRITE_CMD_OPT_RESULT

#define WRITE_CMD_OPT_RESULT (   _cmd,
  _opt,
  _lpr 
)     (lls_opt_result(LSG_WRITE_CMD_ ## _cmd ## _OPT_ ## _opt, _lpr))

◆ WRITE_CMD_OPT_GIVEN

#define WRITE_CMD_OPT_GIVEN (   _cmd,
  _opt,
  _lpr 
)     (lls_opt_given(WRITE_CMD_OPT_RESULT(_cmd, _opt, _lpr)))

◆ WRITE_CMD_OPT_UINT32_VAL

#define WRITE_CMD_OPT_UINT32_VAL (   _cmd,
  _opt,
  _lpr 
)     (lls_uint32_val(0, WRITE_CMD_OPT_RESULT(_cmd, _opt, (_lpr))))

◆ WRITE_CMD_OPT_STRING_VAL

#define WRITE_CMD_OPT_STRING_VAL (   _cmd,
  _opt,
  _lpr 
)     (lls_string_val(0, WRITE_CMD_OPT_RESULT(_cmd, _opt, (_lpr))))

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 command line for any writer.

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

If wa is NULL, the (configuration-dependent) default writer is assumed. Otherwise, the function checks whether wa starts with the name of a supported writer. If a valid writer name was found, the rest of the command line is passed to the config parser of this writer.

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

◆ 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.

References btr_new_node(), writer_node::btrn, EMBRACE, writer::execute, writer::post_monitor, writer::pre_monitor, writer_node::task, task_register(), writer_node::wid, writer_get(), and writer_name().

◆ get_btr_sample_rate()

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

Ask parent btr 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 btr 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 btr 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.

References FOR_EACH_WRITER.