paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Data Structures | Macros | Functions
filter.h File Reference

Filter-related structures and exported symbols from filter_common.c. More...

Data Structures

struct  filter_node
 Describes one running instance of a filter. More...
 
struct  filter
 Describes a method to convert audio data. More...
 

Macros

#define FILTER_CMD(_num)   (lls_cmd(_num, filter_cmd_suite))
 
#define FILTER_CMD_OPT(_cmd, _opt)
 
#define FILTER_CMD_OPT_RESULT(_cmd, _opt, _lpr)    (lls_opt_result(LSG_FILTER_CMD_ ## _cmd ## _OPT_ ## _opt, _lpr))
 
#define FILTER_CMD_OPT_GIVEN(_cmd, _opt, _lpr)    (lls_opt_given(FILTER_CMD_OPT_RESULT(_cmd, _opt, _lpr)))
 
#define FILTER_CMD_OPT_UINT32_VAL(_cmd, _opt, _lpr)    (lls_uint32_val(0, FILTER_CMD_OPT_RESULT(_cmd, _opt, _lpr)))
 
#define FILTER_CMD_OPT_STRING_VAL(_cmd, _opt, _lpr)    (lls_string_val(0, FILTER_CMD_OPT_RESULT(_cmd, _opt, _lpr)))
 

Functions

void print_filter_helps (bool detailed)
 Print help text of each filter to stdout. More...
 
void print_filter_list (void)
 Print a short summary of all available filters to stdout. More...
 
int filter_setup (const char *fa, void **conf, struct lls_parse_result **lprp)
 Parse a filter command line and call the corresponding ->setup method. More...
 
void generic_filter_pre_monitor (struct sched *s, void *context)
 Request a minimal timeout if not idle. More...
 
int decoder_execute (const char *cmd, unsigned sample_rate, unsigned channels, char **result)
 Execute a btr command for a decoder. More...
 
const struct filterfilter_get (int filter_num)
 Obtain a reference to a filter structure. More...
 
const char * filter_name (int filter_num)
 Return the name of a filter, given its number. More...
 

Detailed Description

Filter-related structures and exported symbols from filter_common.c.

Macro Definition Documentation

◆ FILTER_CMD

#define FILTER_CMD (   _num)    (lls_cmd(_num, filter_cmd_suite))

◆ FILTER_CMD_OPT

#define FILTER_CMD_OPT (   _cmd,
  _opt 
)
Value:
(lls_opt( \
LSG_FILTER_CMD_ ## _cmd ## _OPT_ ## _opt, \
FILTER_CMD(LSG_FILTER_CMD_CMD_ ## _cmd)))

◆ FILTER_CMD_OPT_RESULT

#define FILTER_CMD_OPT_RESULT (   _cmd,
  _opt,
  _lpr 
)     (lls_opt_result(LSG_FILTER_CMD_ ## _cmd ## _OPT_ ## _opt, _lpr))

◆ FILTER_CMD_OPT_GIVEN

#define FILTER_CMD_OPT_GIVEN (   _cmd,
  _opt,
  _lpr 
)     (lls_opt_given(FILTER_CMD_OPT_RESULT(_cmd, _opt, _lpr)))

◆ FILTER_CMD_OPT_UINT32_VAL

#define FILTER_CMD_OPT_UINT32_VAL (   _cmd,
  _opt,
  _lpr 
)     (lls_uint32_val(0, FILTER_CMD_OPT_RESULT(_cmd, _opt, _lpr)))

◆ FILTER_CMD_OPT_STRING_VAL

#define FILTER_CMD_OPT_STRING_VAL (   _cmd,
  _opt,
  _lpr 
)     (lls_string_val(0, FILTER_CMD_OPT_RESULT(_cmd, _opt, _lpr)))

Function Documentation

◆ print_filter_helps()

void print_filter_helps ( bool  detailed)

Print help text of each filter to stdout.

Parameters
detailedWhether to print short or long help.

References FOR_EACH_FILTER.

◆ print_filter_list()

void print_filter_list ( void  )

Print a short summary of all available filters to stdout.

For each supported filter, the filter name and the purpose text is printed in a single line. Since no options are shown, the filter list is more concise than the text obtained from print_filter_helps().

References FILTER_CMD, and FOR_EACH_FILTER.

◆ filter_setup()

int filter_setup ( const char *  fa,
void **  conf,
struct lls_parse_result **  lprp 
)

Parse a filter command line and call the corresponding ->setup method.

Parameters
faThe filter argument.
confPoints to filter-specific setup upon successful return.
lprpParsed command line options are returned here.

Check if the given filter argument starts with the name of a supported filter, optionally followed by options for this filter. If yes, call the command line parser of that filter and its ->setup method.

Returns
On success, the number of the filter is returned and conf is initialized to point to the filter configuration as returned by the filter's ->setup() method, if any. Moreover, *lprp is initialized to contain the parsed command line options. On errors a negative paraslash error code is returned.

References create_argv(), FILTER_CMD, free_argv(), and lls().

◆ generic_filter_pre_monitor()

void generic_filter_pre_monitor ( struct sched s,
void *  context 
)

Request a minimal timeout if not idle.

Parameters
sThe scheduler instance.
contextPointer to the filter node.

If the buffer tree node of the given filter node has data available (or is in error state) a minimal I/O timeout is requested from the scheduler. Otherwise the function does nothing.

References btr_node_status(), BTR_NT_INTERNAL, filter_node::btrn, filter_node::min_iqs, and sched_min_delay().

◆ decoder_execute()

int decoder_execute ( const char *  cmd,
unsigned  sample_rate,
unsigned  channels,
char **  result 
)

Execute a btr command for a decoder.

The buffer tree nodes of the writers ask the parent nodes about sample_rate, channels count and sample format. This function is called by all decoders to answer these queries.

Parameters
cmdThe command to be executed by the child node.
sample_rateKnown to the decoder.
channelsKnown to the decoder.
resultAscii representation on the answer is stored here.
Returns
Standard.

◆ filter_get()

const struct filter* filter_get ( int  filter_num)

Obtain a reference to a filter structure.

Parameters
filter_numBetween zero and NUM_SUPPORTED_FILTERS, inclusively.
Returns
Pointer to the filter identified by the given filter number, or NULL if the filter number is out of range.
See also
filter_name().

References FILTER_CMD.

◆ filter_name()

const char* filter_name ( int  filter_num)

Return the name of a filter, given its number.

Parameters
filter_numSee filter_get().
Returns
A pointer to a string literal, or NULL if filter_num is out of range. The caller must not attempt to call free(3) on the returned pointer.

References FILTER_CMD.

FILTER_CMD
#define FILTER_CMD(_num)
Definition: filter.h:102