5b1fa74b436654b442bd5b613cdd4b8ab721042b
[paraslash.git] / grab_client.h
1 /*
2 * Copyright (C) 2006 Andre Noll <maan@systemlinux.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
17 */
18
19 /** \file grab_client.h exported symbols from grab_client.c */
20
21 #include "config.h"
22 /**
23 * handle blocking writes for the grab client fds
24 *
25 * - pedantic: close fd if write would block
26 * - sloppy: ignore the data and do not write
27 * - aggressive: write anyway (default)
28 *
29 */
30 enum grab_mode {GRAB_SLOPPY, GRAB_AGGRESSIVE, GRAB_PEDANTIC};
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 /** the command line options for this grab client */
40 struct grab_client_args_info *conf;
41 /** pedantic, sloppy, or aggressive, computed from command line */
42 enum grab_mode mode;
43 /** non-zero if the write() to \a fd failed */
44 int error;
45 /** the number of the desired audio format, computed from command line */
46 int audio_format_num;
47 /** the callback data which gets attached to a suitable filter_node */
48 struct filter_callback fcb;
49 /** all grab clients belong either to a filter node or to the inactive list */
50 struct list_head node;
51 /** the number of command line options */
52 int argc;
53 /** pointers to the command line options */
54 char **argv;
55 };
56
57 __malloc struct grab_client *grab_client_new(int fd, char *line, int *err);
58 void activate_inactive_grab_clients(int slot, int audio_format_num, struct list_head *filter_list);
59 void activate_grab_client(struct grab_client *gc, struct filter_node *fn);
60 void init_grabbing(void);