libav: switch from CODEC_ID to AV_CODEC_ID
[mplayer.git] / libao2 / audio_out.h
blob955376d460ea7d7351dc1aad1aacbe00fbc171a8
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 #define CONTROL_OK 1
27 #define CONTROL_TRUE 1
28 #define CONTROL_FALSE 0
29 #define CONTROL_UNKNOWN -1
30 #define CONTROL_ERROR -2
31 #define CONTROL_NA -3
33 enum aocontrol {
34 // _VOLUME commands take struct ao_control_vol pointer for input/output.
35 // If there's only one volume, SET should use average of left/right.
36 AOCONTROL_GET_VOLUME,
37 AOCONTROL_SET_VOLUME,
38 // _MUTE commands take a pointer to bool
39 AOCONTROL_GET_MUTE,
40 AOCONTROL_SET_MUTE,
43 #define AOPLAY_FINAL_CHUNK 1
45 typedef struct ao_control_vol {
46 float left;
47 float right;
48 } ao_control_vol_t;
50 typedef struct ao_info {
51 /* driver name ("Matrox Millennium G200/G400" */
52 const char *name;
53 /* short name (for config strings) ("mga") */
54 const char *short_name;
55 /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
56 const char *author;
57 /* any additional comments */
58 const char *comment;
59 } ao_info_t;
61 /* interface towards mplayer and */
62 typedef struct ao_old_functions {
63 int (*control)(int cmd, void *arg);
64 int (*init)(int rate, int channels, int format, int flags);
65 void (*uninit)(int immed);
66 void (*reset)(void);
67 int (*get_space)(void);
68 int (*play)(void *data, int len, int flags);
69 float (*get_delay)(void);
70 void (*pause)(void);
71 void (*resume)(void);
72 } ao_functions_t;
74 struct ao;
76 struct ao_driver {
77 bool is_new;
78 const struct ao_info *info;
79 const struct ao_old_functions *old_functions;
80 int (*control)(struct ao *ao, enum aocontrol cmd, void *arg);
81 int (*init)(struct ao *ao, char *params);
82 void (*uninit)(struct ao *ao, bool cut_audio);
83 void (*reset)(struct ao*ao);
84 int (*get_space)(struct ao *ao);
85 int (*play)(struct ao *ao, void *data, int len, int flags);
86 float (*get_delay)(struct ao *ao);
87 void (*pause)(struct ao *ao);
88 void (*resume)(struct ao *ao);
91 /* global data used by mplayer and plugins */
92 struct ao {
93 int samplerate;
94 int channels;
95 int format;
96 int bps;
97 int outburst;
98 int buffersize;
99 int brokenpts;
100 double pts;
101 struct bstr buffer;
102 int buffer_playable_size;
103 bool initialized;
104 bool untimed;
105 bool no_persistent_volume;
106 const struct ao_driver *driver;
107 void *priv;
108 struct MPOpts *opts;
109 struct input_ctx *input_ctx;
112 extern char *ao_subdevice;
114 void list_audio_out(void);
116 struct ao *ao_create(struct MPOpts *opts, struct input_ctx *input);
117 void ao_init(struct ao *ao, char **ao_list);
118 void ao_uninit(struct ao *ao, bool cut_audio);
119 int ao_play(struct ao *ao, void *data, int len, int flags);
120 int ao_control(struct ao *ao, enum aocontrol cmd, void *arg);
121 double ao_get_delay(struct ao *ao);
122 int ao_get_space(struct ao *ao);
123 void ao_reset(struct ao *ao);
124 void ao_pause(struct ao *ao);
125 void ao_resume(struct ao *ao);
127 int old_ao_control(struct ao *ao, enum aocontrol cmd, void *arg);
128 int old_ao_init(struct ao *ao, char *params);
129 void old_ao_uninit(struct ao *ao, bool cut_audio);
130 void old_ao_reset(struct ao*ao);
131 int old_ao_get_space(struct ao *ao);
132 int old_ao_play(struct ao *ao, void *data, int len, int flags);
133 float old_ao_get_delay(struct ao *ao);
134 void old_ao_pause(struct ao *ao);
135 void old_ao_resume(struct ao *ao);
137 #endif /* MPLAYER_AUDIO_OUT_H */