ao_pulse, core: make pulse thread wake up core for more data
[mplayer.git] / libao2 / audio_out.h
blob1c472565a05f266009d61f54f3d4f7ead21517d6
1 /*
2 * This file is part of MPlayer.
4 * MPlayer 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.
9 * MPlayer 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.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef MPLAYER_AUDIO_OUT_H
20 #define MPLAYER_AUDIO_OUT_H
22 #include <stdbool.h>
24 #include "bstr.h"
26 typedef struct ao_info {
27 /* driver name ("Matrox Millennium G200/G400" */
28 const char *name;
29 /* short name (for config strings) ("mga") */
30 const char *short_name;
31 /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
32 const char *author;
33 /* any additional comments */
34 const char *comment;
35 } ao_info_t;
37 /* interface towards mplayer and */
38 typedef struct ao_old_functions {
39 int (*control)(int cmd, void *arg);
40 int (*init)(int rate, int channels, int format, int flags);
41 void (*uninit)(int immed);
42 void (*reset)(void);
43 int (*get_space)(void);
44 int (*play)(void *data, int len, int flags);
45 float (*get_delay)(void);
46 void (*pause)(void);
47 void (*resume)(void);
48 } ao_functions_t;
50 struct ao;
52 struct ao_driver {
53 bool is_new;
54 const struct ao_info *info;
55 const struct ao_old_functions *old_functions;
56 int (*control)(struct ao *ao, int cmd, void *arg);
57 int (*init)(struct ao *ao, char *params);
58 void (*uninit)(struct ao *ao, bool cut_audio);
59 void (*reset)(struct ao*ao);
60 int (*get_space)(struct ao *ao);
61 int (*play)(struct ao *ao, void *data, int len, int flags);
62 float (*get_delay)(struct ao *ao);
63 void (*pause)(struct ao *ao);
64 void (*resume)(struct ao *ao);
67 /* global data used by mplayer and plugins */
68 struct ao {
69 int samplerate;
70 int channels;
71 int format;
72 int bps;
73 int outburst;
74 int buffersize;
75 int brokenpts;
76 double pts;
77 struct bstr buffer;
78 int buffer_playable_size;
79 bool initialized;
80 bool untimed;
81 const struct ao_driver *driver;
82 void *priv;
83 struct MPOpts *opts;
84 struct input_ctx *input_ctx;
87 extern char *ao_subdevice;
89 void list_audio_out(void);
91 #define CONTROL_OK 1
92 #define CONTROL_TRUE 1
93 #define CONTROL_FALSE 0
94 #define CONTROL_UNKNOWN -1
95 #define CONTROL_ERROR -2
96 #define CONTROL_NA -3
98 #define AOCONTROL_SET_DEVICE 1
99 #define AOCONTROL_GET_DEVICE 2
100 #define AOCONTROL_QUERY_FORMAT 3 /* test for availabilty of a format */
101 #define AOCONTROL_GET_VOLUME 4
102 #define AOCONTROL_SET_VOLUME 5
103 #define AOCONTROL_SET_PLUGIN_DRIVER 6
104 #define AOCONTROL_SET_PLUGIN_LIST 7
106 #define AOPLAY_FINAL_CHUNK 1
108 typedef struct ao_control_vol {
109 float left;
110 float right;
111 } ao_control_vol_t;
113 struct ao *ao_create(struct MPOpts *opts, struct input_ctx *input);
114 void ao_init(struct ao *ao, char **ao_list);
115 void ao_uninit(struct ao *ao, bool cut_audio);
116 int ao_play(struct ao *ao, void *data, int len, int flags);
117 int ao_control(struct ao *ao, int cmd, void *arg);
118 double ao_get_delay(struct ao *ao);
119 int ao_get_space(struct ao *ao);
120 void ao_reset(struct ao *ao);
121 void ao_pause(struct ao *ao);
122 void ao_resume(struct ao *ao);
124 int old_ao_control(struct ao *ao, int cmd, void *arg);
125 int old_ao_init(struct ao *ao, char *params);
126 void old_ao_uninit(struct ao *ao, bool cut_audio);
127 void old_ao_reset(struct ao*ao);
128 int old_ao_get_space(struct ao *ao);
129 int old_ao_play(struct ao *ao, void *data, int len, int flags);
130 float old_ao_get_delay(struct ao *ao);
131 void old_ao_pause(struct ao *ao);
132 void old_ao_resume(struct ao *ao);
134 #endif /* MPLAYER_AUDIO_OUT_H */