paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Data Structures | Macros | Functions
check_wav.h File Reference

Detect, process and cut a wav header. More...

Data Structures

struct  wav_params
 These come from the command line arguments. More...
 

Macros

#define LLS_COPY_WAV_PARMS(_dst, _pfx, _lpr)
 

Functions

struct check_wav_context * check_wav_init (struct btr_node *parent, struct btr_node *child, struct wav_params *params, struct btr_node **cw_btrn)
 Allocate and set up a new check_wav instance. More...
 
void check_wav_pre_monitor (struct sched *s, struct check_wav_context *cwc)
 Request a minimal timeout if not idle. More...
 
int check_wav_post_monitor (struct check_wav_context *cwc)
 Filter out the wav header, pushdown everything else. More...
 
void check_wav_shutdown (struct check_wav_context *cwc)
 Dellocate all ressources of a check_wav instance. More...
 

Detailed Description

Detect, process and cut a wav header.

Macro Definition Documentation

◆ LLS_COPY_WAV_PARMS

#define LLS_COPY_WAV_PARMS (   _dst,
  _pfx,
  _lpr 
)
Value:
(_dst)->channels_given = lls_opt_given(lls_opt_result( \
_pfx ## _OPT_CHANNELS, (_lpr))); \
(_dst)->sample_rate_given = lls_opt_given(lls_opt_result( \
_pfx ## _OPT_SAMPLE_RATE, (_lpr))); \
(_dst)->sample_format_given = lls_opt_given(lls_opt_result( \
_pfx ## _OPT_SAMPLE_FORMAT, (_lpr))); \
(_dst)->channels_arg = lls_uint32_val(0, lls_opt_result( \
_pfx ## _OPT_CHANNELS, (_lpr))); \
(_dst)->sample_rate_arg = lls_uint32_val(0, lls_opt_result( \
_pfx ## _OPT_SAMPLE_RATE, (_lpr))); \
(_dst)->sample_format_arg = lls_uint32_val(0, lls_opt_result( \
_pfx ## _OPT_SAMPLE_FORMAT, (_lpr)));

Function Documentation

◆ check_wav_init()

struct check_wav_context* check_wav_init ( struct btr_node *  parent,
struct btr_node *  child,
struct wav_params params,
struct btr_node **  cw_btrn 
)

Allocate and set up a new check_wav instance.

Parameters
parentThis buffer tree node will be the parent of the new node.
childThe child of the new node.
paramsDefault values and options.
cw_btrnA pointer to the check wav node is returned here.

This function also sets up the ->execute handler of the btrn so that all children of this node can figure out channel count, sample rate, etc.

Returns
The (opaque) handle of the newly created check_wav instance. It is supposed to be passed to check_wav_pre_monitor() and check_wav_post_monitor().
See also
btr_new_node.

References btr_new_node(), CWS_NEED_HEADER, EMBRACE, WAV_HEADER_LEN, and zalloc().

◆ check_wav_pre_monitor()

void check_wav_pre_monitor ( struct sched s,
struct check_wav_context *  cwc 
)

Request a minimal timeout if not idle.

Parameters
sThe scheduler instance.
cwcThe buffer tree node is derived from this.

If no data is available and the buffer tree node is not in error state, the function does nothing.

References btr_node_status(), BTR_NT_INTERNAL, and sched_min_delay().

◆ check_wav_post_monitor()

int check_wav_post_monitor ( struct check_wav_context *  cwc)

Filter out the wav header, pushdown everything else.

Parameters
cwcThe context of this instance.

This function looks at the first WAV_HEADER_SIZE bytes of the input queue of the btrn of cwc. If they look like a wav header, the function extracts the information of interest and swallows this part of the stream. Otherwise it is pushed down to all children. In either case the rest of the input is pushed down as well.

Once the first part has been processed this way, the state of the instance changes from CWS_NEED_HEADER to CWS_HAVE_HEADER or CWS_NO_HEADER.

Returns
Standard.

References btr_merge(), btr_next_buffer(), btr_node_status(), BTR_NT_INTERNAL, CWS_HAVE_HEADER, CWS_NEED_HEADER, CWS_NO_HEADER, PARA_INFO_LOG, PARA_NOTICE_LOG, and SAMPLE_FORMATS.

◆ check_wav_shutdown()

void check_wav_shutdown ( struct check_wav_context *  cwc)

Dellocate all ressources of a check_wav instance.

Parameters
cwcDetermines the instance to shut down.

This function may only be called after check_wav_post_monitor() has returned negative.