comparison libao2/audio_out.c @ 26101:a65168348ad5

cosmetics: reindent, detabify
author diego
date Sat, 01 Mar 2008 09:04:00 +0000
parents fb1ef5528f05
children 5eb017bb1568
comparison
equal deleted inserted replaced
26100:fb1ef5528f05 26101:a65168348ad5
19 extern ao_functions_t audio_out_esd; 19 extern ao_functions_t audio_out_esd;
20 extern ao_functions_t audio_out_pulse; 20 extern ao_functions_t audio_out_pulse;
21 extern ao_functions_t audio_out_jack; 21 extern ao_functions_t audio_out_jack;
22 extern ao_functions_t audio_out_openal; 22 extern ao_functions_t audio_out_openal;
23 extern ao_functions_t audio_out_null; 23 extern ao_functions_t audio_out_null;
24 extern ao_functions_t audio_out_alsa5; 24 extern ao_functions_t audio_out_alsa5;
25 extern ao_functions_t audio_out_alsa; 25 extern ao_functions_t audio_out_alsa;
26 extern ao_functions_t audio_out_nas; 26 extern ao_functions_t audio_out_nas;
27 extern ao_functions_t audio_out_sdl; 27 extern ao_functions_t audio_out_sdl;
28 extern ao_functions_t audio_out_sun; 28 extern ao_functions_t audio_out_sun;
29 extern ao_functions_t audio_out_sgi; 29 extern ao_functions_t audio_out_sgi;
30 extern ao_functions_t audio_out_win32; 30 extern ao_functions_t audio_out_win32;
44 #endif 44 #endif
45 #ifdef HAVE_WIN32WAVEOUT 45 #ifdef HAVE_WIN32WAVEOUT
46 &audio_out_win32, 46 &audio_out_win32,
47 #endif 47 #endif
48 #ifdef MACOSX 48 #ifdef MACOSX
49 &audio_out_macosx, 49 &audio_out_macosx,
50 #endif 50 #endif
51 #ifdef USE_OSS_AUDIO 51 #ifdef USE_OSS_AUDIO
52 &audio_out_oss, 52 &audio_out_oss,
53 #endif 53 #endif
54 #ifdef HAVE_ALSA1X 54 #ifdef HAVE_ALSA1X
55 &audio_out_alsa, 55 &audio_out_alsa,
56 #endif 56 #endif
57 #ifdef HAVE_ALSA9 57 #ifdef HAVE_ALSA9
58 &audio_out_alsa, 58 &audio_out_alsa,
59 #endif 59 #endif
60 #ifdef HAVE_ALSA5 60 #ifdef HAVE_ALSA5
61 &audio_out_alsa5, 61 &audio_out_alsa5,
62 #endif 62 #endif
63 #ifdef USE_SGI_AUDIO 63 #ifdef USE_SGI_AUDIO
64 &audio_out_sgi, 64 &audio_out_sgi,
65 #endif 65 #endif
66 #ifdef USE_SUN_AUDIO 66 #ifdef USE_SUN_AUDIO
78 #endif 78 #endif
79 #ifdef USE_JACK 79 #ifdef USE_JACK
80 &audio_out_jack, 80 &audio_out_jack,
81 #endif 81 #endif
82 #ifdef HAVE_NAS 82 #ifdef HAVE_NAS
83 &audio_out_nas, 83 &audio_out_nas,
84 #endif 84 #endif
85 #ifdef HAVE_SDL 85 #ifdef HAVE_SDL
86 &audio_out_sdl, 86 &audio_out_sdl,
87 #endif 87 #endif
88 #ifdef USE_OPENAL 88 #ifdef USE_OPENAL
89 &audio_out_openal, 89 &audio_out_openal,
90 #endif 90 #endif
91 &audio_out_mpegpes, 91 &audio_out_mpegpes,
92 #ifdef HAVE_DXR2 92 #ifdef HAVE_DXR2
93 &audio_out_dxr2, 93 &audio_out_dxr2,
94 #endif 94 #endif
95 #ifdef HAVE_IVTV 95 #ifdef HAVE_IVTV
96 &audio_out_ivtv, 96 &audio_out_ivtv,
98 #ifdef HAVE_V4L2_DECODER 98 #ifdef HAVE_V4L2_DECODER
99 &audio_out_v4l2, 99 &audio_out_v4l2,
100 #endif 100 #endif
101 &audio_out_null, 101 &audio_out_null,
102 // should not be auto-selected: 102 // should not be auto-selected:
103 &audio_out_pcm, 103 &audio_out_pcm,
104 NULL 104 NULL
105 }; 105 };
106 106
107 void list_audio_out(void){ 107 void list_audio_out(void){
108 int i=0; 108 int i=0;
109 mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AvailableAudioOutputDrivers); 109 mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AvailableAudioOutputDrivers);
110 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_OUTPUTS\n"); 110 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_OUTPUTS\n");
111 while (audio_out_drivers[i]) { 111 while (audio_out_drivers[i]) {
112 const ao_info_t *info = audio_out_drivers[i++]->info; 112 const ao_info_t *info = audio_out_drivers[i++]->info;
113 mp_msg(MSGT_GLOBAL, MSGL_INFO,"\t%s\t%s\n", info->short_name, info->name); 113 mp_msg(MSGT_GLOBAL, MSGL_INFO,"\t%s\t%s\n", info->short_name, info->name);
114 } 114 }
115 mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n"); 115 mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
116 } 116 }
117 117
118 const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int channels,int format,int flags){ 118 const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int channels,int format,int flags){
119 int i; 119 int i;
120 // first try the preferred drivers, with their optional subdevice param: 120 // first try the preferred drivers, with their optional subdevice param:
121 if(ao_list && ao_list[0]) 121 if(ao_list && ao_list[0])
122 while(ao_list[0][0]){ 122 while(ao_list[0][0]){
123 char* ao=ao_list[0]; 123 char* ao=ao_list[0];
124 int ao_len; 124 int ao_len;
125 if (strncmp(ao, "alsa9", 5) == 0 || strncmp(ao, "alsa1x", 6) == 0) { 125 if (strncmp(ao, "alsa9", 5) == 0 || strncmp(ao, "alsa1x", 6) == 0) {
126 mp_msg(MSGT_AO, MSGL_FATAL, MSGTR_AO_ALSA9_1x_Removed); 126 mp_msg(MSGT_AO, MSGL_FATAL, MSGTR_AO_ALSA9_1x_Removed);
127 exit_player(NULL); 127 exit_player(NULL);
128 } 128 }
129 if (ao_subdevice) { 129 if (ao_subdevice) {
130 free(ao_subdevice); 130 free(ao_subdevice);
131 ao_subdevice = NULL; 131 ao_subdevice = NULL;
132 } 132 }
133 ao_subdevice=strchr(ao,':'); 133 ao_subdevice=strchr(ao,':');
134 if(ao_subdevice){ 134 if(ao_subdevice){
135 ao_len = ao_subdevice - ao; 135 ao_len = ao_subdevice - ao;
136 ao_subdevice = strdup(&ao[ao_len + 1]); 136 ao_subdevice = strdup(&ao[ao_len + 1]);
137 } 137 }
138 else 138 else
139 ao_len = strlen(ao); 139 ao_len = strlen(ao);
140 for(i=0;audio_out_drivers[i];i++){ 140 for(i=0;audio_out_drivers[i];i++){
141 const ao_functions_t* audio_out=audio_out_drivers[i]; 141 const ao_functions_t* audio_out=audio_out_drivers[i];
142 if(!strncmp(audio_out->info->short_name,ao,ao_len)){ 142 if(!strncmp(audio_out->info->short_name,ao,ao_len)){
143 // name matches, try it 143 // name matches, try it
144 if(audio_out->init(rate,channels,format,flags)) 144 if(audio_out->init(rate,channels,format,flags))
145 return audio_out; // success! 145 return audio_out; // success!
146 } 146 }
147 } 147 }
148 // continue... 148 // continue...
149 ++ao_list; 149 ++ao_list;
150 if(!(ao_list[0])) return NULL; // do NOT fallback to others 150 if(!(ao_list[0])) return NULL; // do NOT fallback to others
151 } 151 }
152 if (ao_subdevice) { 152 if (ao_subdevice) {
153 free(ao_subdevice); 153 free(ao_subdevice);
154 ao_subdevice = NULL; 154 ao_subdevice = NULL;
155 } 155 }
156 // now try the rest... 156 // now try the rest...
157 for(i=0;audio_out_drivers[i];i++){ 157 for(i=0;audio_out_drivers[i];i++){
158 const ao_functions_t* audio_out=audio_out_drivers[i]; 158 const ao_functions_t* audio_out=audio_out_drivers[i];
159 // if(audio_out->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE) 159 // if(audio_out->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE)
160 if(audio_out->init(rate,channels,format,flags)) 160 if(audio_out->init(rate,channels,format,flags))
161 return audio_out; // success! 161 return audio_out; // success!
162 } 162 }
163 return NULL; 163 return NULL;
164 } 164 }
165 165