Fix stream grabbing.
[paraslash.git] / grab_client.h
1 /*
2 * Copyright (C) 2006 Andre Noll <maan@systemlinux.org>
3 *
4 * Licensed under the GPL v2. For licencing details see COPYING.
5 */
6
7 /** \file grab_client.h exported symbols from grab_client.c */
8
9 #include "config.h"
10
11 /**
12 * How to handle blocking writes for the grab client fds.
13 */
14 enum grab_mode {
15 /** Ignore the data and do not write. */
16 GM_SLOPPY,
17 /** Write anyway (default). */
18 GM_AGGRESSIVE,
19 /** Close fd if write would block. */
20 GM_PEDANTIC,
21 };
22
23 /** Flags specified as arguments to the grab command. */
24 enum grab_flags {
25 /** Stop grabbing if audio file changes. */
26 GF_ONE_SHOT = 1,
27 };
28
29 /** Describes one active grab client. */
30 struct grab_client {
31 /* The value of the -p option. */
32 char *parent;
33 /** The file descriptor to send the grabbed stream to. */
34 int fd;
35 /** See \ref grab_mode. */
36 enum grab_mode mode;
37 /** Flags given at the command line. */
38 enum grab_flags flags;
39 /** The point of the grab client's node in the buffer tree. */
40 struct btr_node *btrn;
41 /* The task of this grab client. */
42 struct task task;
43 /** All grab clients belong either to a filter node or to the inactive list. */
44 struct list_head node;
45 };
46
47 int grab_client_new(int fd, int argc, char **argv);
48 void activate_grab_clients(void);
49 void init_grabbing(void);