paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Enumerations | Functions
grab_client.c File Reference

Functions for grabbing the audio stream. More...

#include <regex.h>
#include <sys/types.h>
#include <lopsub.h>
#include "audiod_cmd.lsg.h"
#include "para.h"
#include "list.h"
#include "sched.h"
#include "buffer_tree.h"
#include "grab_client.h"
#include "audiod.h"
#include "error.h"
#include "string.h"
#include "fd.h"

Enumerations

enum  grab_mode { GM_SLOPPY, GM_AGGRESSIVE, GM_PEDANTIC }
 How to handle blocking writes for the grab client fds. More...
 
enum  grab_flags { GF_ONE_SHOT = 1 }
 Flags specified as arguments to the grab command. More...
 

Functions

void activate_grab_clients (struct sched *s)
 Activate inactive grab clients if possible. More...
 
int grab_client_new (int fd, struct lls_parse_result *lpr, struct sched *s)
 Create and activate a grab client. More...
 

Detailed Description

Functions for grabbing the audio stream.

Enumeration Type Documentation

◆ grab_mode

enum grab_mode

How to handle blocking writes for the grab client fds.

Enumerator
GM_SLOPPY 

Ignore the data and do not write.

GM_AGGRESSIVE 

Write anyway (default).

GM_PEDANTIC 

Close fd if write would block.

◆ grab_flags

enum grab_flags

Flags specified as arguments to the grab command.

Enumerator
GF_ONE_SHOT 

Stop grabbing if audio file changes.

Function Documentation

◆ activate_grab_clients()

void activate_grab_clients ( struct sched s)

Activate inactive grab clients if possible.

Parameters
sNeeded to schedule the grab client task.

This is called from audiod.c when the current audio file changes. It loops over all inactive grab clients and checks each grab client's configuration to determine if the client in question wishes to grab the new stream. If yes, this grab client is moved from the inactive to the active grab client list.

This function also garbage collects all grab clients whose tasks have been unscheduled.

References list_for_each_entry_safe.

◆ grab_client_new()

int grab_client_new ( int  fd,
struct lls_parse_result *  lpr,
struct sched s 
)

Create and activate a grab client.

Parameters
fdThe file descriptor of the client.
lprThe parsed command line of the grab command.
sThe scheduler to register the grab client task to.

This function semantically parses the arguments given as options to the grab command. On success it allocates a struct grab_client, associates it with the given file descriptor and activates it. If the new grab client can not be attached to an existing buffer tree node it is put into the inactive list for later activation.

Returns
Standard.