11 // there are some globals:
12 ao_data_t ao_data
={0,0,0,0,OUTBURST
,-1,0};
13 char *ao_subdevice
= NULL
;
15 extern ao_functions_t audio_out_oss
;
16 extern ao_functions_t audio_out_macosx
;
17 extern ao_functions_t audio_out_arts
;
18 extern ao_functions_t audio_out_esd
;
19 extern ao_functions_t audio_out_pulse
;
20 extern ao_functions_t audio_out_jack
;
21 extern ao_functions_t audio_out_openal
;
22 extern ao_functions_t audio_out_null
;
23 extern ao_functions_t audio_out_alsa5
;
24 extern ao_functions_t audio_out_alsa
;
25 extern ao_functions_t audio_out_nas
;
26 extern ao_functions_t audio_out_sdl
;
27 extern ao_functions_t audio_out_sun
;
28 extern ao_functions_t audio_out_sgi
;
29 extern ao_functions_t audio_out_win32
;
30 extern ao_functions_t audio_out_dsound
;
31 extern ao_functions_t audio_out_dxr2
;
32 extern ao_functions_t audio_out_ivtv
;
33 extern ao_functions_t audio_out_v4l2
;
34 extern ao_functions_t audio_out_mpegpes
;
35 extern ao_functions_t audio_out_pcm
;
36 extern ao_functions_t audio_out_pss
;
38 const ao_functions_t
* const audio_out_drivers
[] =
44 #ifdef CONFIG_WIN32WAVEOUT
47 #ifdef CONFIG_COREAUDIO
50 #ifdef CONFIG_OSS_AUDIO
59 #ifdef CONFIG_SGI_AUDIO
62 #ifdef CONFIG_SUN_AUDIO
94 #ifdef CONFIG_V4L2_DECODER
98 // should not be auto-selected:
103 void list_audio_out(void){
105 mp_msg(MSGT_AO
, MSGL_INFO
, MSGTR_AvailableAudioOutputDrivers
);
106 mp_msg(MSGT_IDENTIFY
, MSGL_INFO
, "ID_AUDIO_OUTPUTS\n");
107 while (audio_out_drivers
[i
]) {
108 const ao_info_t
*info
= audio_out_drivers
[i
++]->info
;
109 mp_msg(MSGT_GLOBAL
, MSGL_INFO
,"\t%s\t%s\n", info
->short_name
, info
->name
);
111 mp_msg(MSGT_GLOBAL
, MSGL_INFO
,"\n");
114 const ao_functions_t
* init_best_audio_out(char** ao_list
,int use_plugin
,int rate
,int channels
,int format
,int flags
){
116 // first try the preferred drivers, with their optional subdevice param:
117 if(ao_list
&& ao_list
[0])
118 while(ao_list
[0][0]){
125 ao_subdevice
=strchr(ao
,':');
127 ao_len
= ao_subdevice
- ao
;
128 ao_subdevice
= strdup(&ao
[ao_len
+ 1]);
133 mp_msg(MSGT_AO
, MSGL_V
, MSGTR_AO_TryingPreferredAudioDriver
,
134 ao_len
, ao
, ao_subdevice
? ao_subdevice
: "[none]");
136 for(i
=0;audio_out_drivers
[i
];i
++){
137 const ao_functions_t
* audio_out
=audio_out_drivers
[i
];
138 if(!strncmp(audio_out
->info
->short_name
,ao
,ao_len
)){
139 // name matches, try it
140 if(audio_out
->init(rate
,channels
,format
,flags
))
141 return audio_out
; // success!
143 mp_msg(MSGT_AO
, MSGL_WARN
, MSGTR_AO_FailedInit
, ao
);
147 if (!audio_out_drivers
[i
]) // we searched through the entire list
148 mp_msg(MSGT_AO
, MSGL_WARN
, MSGTR_AO_NoSuchDriver
, ao_len
, ao
);
151 if(!(ao_list
[0])) return NULL
; // do NOT fallback to others
158 mp_msg(MSGT_AO
, MSGL_V
, MSGTR_AO_TryingEveryKnown
);
160 // now try the rest...
161 for(i
=0;audio_out_drivers
[i
];i
++){
162 const ao_functions_t
* audio_out
=audio_out_drivers
[i
];
163 // if(audio_out->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE)
164 if(audio_out
->init(rate
,channels
,format
,flags
))
165 return audio_out
; // success!