1
/*
2
 * Copyright 2008-2011 Various Authors
3
 * Copyright 2004 Timo Hirvonen
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License as
7
 * published by the Free Software Foundation; either version 2 of the
8
 * License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful, but
11
 * WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
#ifndef _OP_H
20
#define _OP_H
21
22
#include "sf.h"
23
#include "channelmap.h"
24
25
#ifndef __GNUC__
26
#include <fcntl.h>
27
#endif
28
29
enum {
30
	/* no error */
31
	OP_ERROR_SUCCESS,
32
	/* system error (error code in errno) */
33
	OP_ERROR_ERRNO,
34
	/* no such plugin */
35
	OP_ERROR_NO_PLUGIN,
36
	/* plugin not initialized */
37
	OP_ERROR_NOT_INITIALIZED,
38
	/* function not supported */
39
	OP_ERROR_NOT_SUPPORTED,
40
	/* mixer not open */
41
	OP_ERROR_NOT_OPEN,
42
	/* plugin does not support the sample format */
43
	OP_ERROR_SAMPLE_FORMAT,
44
	/* plugin does not have this option */
45
	OP_ERROR_NOT_OPTION,
46
	/*  */
47
	OP_ERROR_INTERNAL
48
};
49
50
struct output_plugin_ops {
51
	int (*init)(void);
52
	int (*exit)(void);
53
	int (*open)(sample_format_t sf, const channel_position_t *channel_map);
54
	int (*close)(void);
55
	int (*drop)(void);
56
	int (*write)(const char *buffer, int count);
57
	int (*buffer_space)(void);
58
59
	/* these can be NULL */
60
	int (*pause)(void);
61
	int (*unpause)(void);
62
63
	int (*set_option)(int key, const char *val);
64
	int (*get_option)(int key, char **val);
65
};
66
67
/* symbols exported by plugin */
68
extern const struct output_plugin_ops op_pcm_ops;
69
extern const char * const op_pcm_options[];
70
extern const int op_priority;
71
72
#endif