10 #include "mplayer.h" /* for exit_player() */
12 // there are some globals:
13 ao_data_t ao_data
={0,0,0,0,OUTBURST
,-1,0};
14 char *ao_subdevice
= NULL
;
17 extern ao_functions_t audio_out_oss
;
20 extern ao_functions_t audio_out_macosx
;
23 extern ao_functions_t audio_out_arts
;
26 extern ao_functions_t audio_out_esd
;
29 extern ao_functions_t audio_out_pulse
;
32 extern ao_functions_t audio_out_jack
;
35 extern ao_functions_t audio_out_openal
;
37 extern ao_functions_t audio_out_null
;
39 extern ao_functions_t audio_out_alsa5
;
42 extern ao_functions_t audio_out_alsa
;
45 extern ao_functions_t audio_out_alsa
;
48 extern ao_functions_t audio_out_nas
;
51 extern ao_functions_t audio_out_sdl
;
54 extern ao_functions_t audio_out_sun
;
57 extern ao_functions_t audio_out_sgi
;
59 #ifdef HAVE_WIN32WAVEOUT
60 extern ao_functions_t audio_out_win32
;
63 extern ao_functions_t audio_out_dsound
;
66 extern ao_functions_t audio_out_dxr2
;
69 extern ao_functions_t audio_out_ivtv
;
71 #ifdef HAVE_V4L2_DECODER
72 extern ao_functions_t audio_out_v4l2
;
74 extern ao_functions_t audio_out_mpegpes
;
75 extern ao_functions_t audio_out_pcm
;
76 extern ao_functions_t audio_out_pss
;
78 ao_functions_t
* audio_out_drivers
[] =
84 #ifdef HAVE_WIN32WAVEOUT
137 #ifdef HAVE_V4L2_DECODER
141 // should not be auto-selected:
146 void list_audio_out(void){
148 mp_msg(MSGT_AO
, MSGL_INFO
, MSGTR_AvailableAudioOutputDrivers
);
149 mp_msg(MSGT_IDENTIFY
, MSGL_INFO
, "ID_AUDIO_OUTPUTS\n");
150 while (audio_out_drivers
[i
]) {
151 const ao_info_t
*info
= audio_out_drivers
[i
++]->info
;
152 mp_msg(MSGT_GLOBAL
, MSGL_INFO
,"\t%s\t%s\n", info
->short_name
, info
->name
);
154 mp_msg(MSGT_GLOBAL
, MSGL_INFO
,"\n");
157 ao_functions_t
* init_best_audio_out(char** ao_list
,int use_plugin
,int rate
,int channels
,int format
,int flags
){
159 // first try the preferred drivers, with their optional subdevice param:
160 if(ao_list
&& ao_list
[0])
161 while(ao_list
[0][0]){
164 if (strncmp(ao
, "alsa9", 5) == 0 || strncmp(ao
, "alsa1x", 6) == 0) {
165 mp_msg(MSGT_AO
, MSGL_FATAL
, MSGTR_AO_ALSA9_1x_Removed
);
172 ao_subdevice
=strchr(ao
,':');
174 ao_len
= ao_subdevice
- ao
;
175 ao_subdevice
= strdup(&ao
[ao_len
+ 1]);
179 for(i
=0;audio_out_drivers
[i
];i
++){
180 ao_functions_t
* audio_out
=audio_out_drivers
[i
];
181 if(!strncmp(audio_out
->info
->short_name
,ao
,ao_len
)){
182 // name matches, try it
183 if(audio_out
->init(rate
,channels
,format
,flags
))
184 return audio_out
; // success!
189 if(!(ao_list
[0])) return NULL
; // do NOT fallback to others
195 // now try the rest...
196 for(i
=0;audio_out_drivers
[i
];i
++){
197 ao_functions_t
* audio_out
=audio_out_drivers
[i
];
198 // if(audio_out->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE)
199 if(audio_out
->init(rate
,channels
,format
,flags
))
200 return audio_out
; // success!