wma afh chunk time fixes
[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         /** Grab the filter input instead of its output. */
26         GF_INPUT_GRAB = 1,
27         /** Stop grabbing if audio file changes. */
28         GF_ONE_SHOT = 2,
29 };
30
31 /**
32  * Describes one active grab client.
33  *
34  * \sa filter_callback, filter_node::callbacks.
35  */
36 struct grab_client {
37         /** The file descriptor to send the grabbed stream to. */
38         int fd;
39         /** Non-zero if the write() to \a fd failed. */
40         int error;
41         /** See \ref grab_mode. */
42         enum grab_mode mode;
43         /** Point of filter chain to grab. */
44         int32_t filter_num;
45         /** The number of the desired audio format. */
46         int audio_format_num;
47         /** Flags given at the command line. */
48         enum grab_flags flags;
49         /** The callback data which gets attached to a suitable filter_node. */
50         struct filter_callback fcb;
51         /** All grab clients belong either to a filter node or to the inactive list. */
52         struct list_head node;
53 };
54
55 int grab_client_new(int fd, int argc, char **argv);
56 void activate_inactive_grab_clients(int audio_format_num,
57                 struct filter_chain *fc);
58 void activate_grab_client(struct grab_client *gc, struct filter_node *fn);
59 void init_grabbing(void);