Mercurial > mplayer.hg
annotate libao2/audio_out.c @ 28604:011bd477ee51
Mark all Linux RealVideo decoders as buggy, they all seem to have some problem
on some systems.
author | reimar |
---|---|
date | Tue, 17 Feb 2009 20:44:45 +0000 |
parents | e45b08f2f5d3 |
children | 1f76d86e49ae |
rev | line source |
---|---|
28343 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
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. | |
8 * | |
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. | |
13 * | |
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. | |
17 */ | |
18 | |
954 | 19 #include <stdio.h> |
20 #include <stdlib.h> | |
7848 | 21 #include <string.h> |
954 | 22 |
14123 | 23 #include "config.h" |
954 | 24 #include "audio_out.h" |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
25 |
14123 | 26 #include "mp_msg.h" |
27 #include "help_mp.h" | |
15058 | 28 #include "mplayer.h" /* for exit_player() */ |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
29 |
954 | 30 // there are some globals: |
3095 | 31 ao_data_t ao_data={0,0,0,0,OUTBURST,-1,0}; |
1185 | 32 char *ao_subdevice = NULL; |
954 | 33 |
34 extern ao_functions_t audio_out_oss; | |
12792 | 35 extern ao_functions_t audio_out_macosx; |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
6069
diff
changeset
|
36 extern ao_functions_t audio_out_arts; |
8572 | 37 extern ao_functions_t audio_out_esd; |
24781 | 38 extern ao_functions_t audio_out_pulse; |
12662
05d46af5e2bf
JACK audio support through bio2jack by Kamil Strzelecki <esack@o2.pl>
alex
parents:
12636
diff
changeset
|
39 extern ao_functions_t audio_out_jack; |
17633
e0ef5688cce7
OpenAL audio support, actual output is mono-only (no positioning yet).
reimar
parents:
17566
diff
changeset
|
40 extern ao_functions_t audio_out_openal; |
954 | 41 extern ao_functions_t audio_out_null; |
26101 | 42 extern ao_functions_t audio_out_alsa5; |
43 extern ao_functions_t audio_out_alsa; | |
3276 | 44 extern ao_functions_t audio_out_nas; |
966
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
45 extern ao_functions_t audio_out_sdl; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
46 extern ao_functions_t audio_out_sun; |
2450 | 47 extern ao_functions_t audio_out_sgi; |
7916 | 48 extern ao_functions_t audio_out_win32; |
13460
70d8f1975fc8
directsound audio output plugin, patch by Gabor Szecsi <deje at miki.hu> some minor modifications by me
faust3
parents:
12792
diff
changeset
|
49 extern ao_functions_t audio_out_dsound; |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
5192
diff
changeset
|
50 extern ao_functions_t audio_out_dxr2; |
19224 | 51 extern ao_functions_t audio_out_ivtv; |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
19409
diff
changeset
|
52 extern ao_functions_t audio_out_v4l2; |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4097
diff
changeset
|
53 extern ao_functions_t audio_out_mpegpes; |
1107 | 54 extern ao_functions_t audio_out_pcm; |
1185 | 55 extern ao_functions_t audio_out_pss; |
954 | 56 |
25913 | 57 const ao_functions_t* const audio_out_drivers[] = |
954 | 58 { |
7609 | 59 // native: |
27387
eb7bdbd98210
Rename some audio-output-related preprocessor directives.
diego
parents:
27370
diff
changeset
|
60 #ifdef CONFIG_DIRECTX |
13460
70d8f1975fc8
directsound audio output plugin, patch by Gabor Szecsi <deje at miki.hu> some minor modifications by me
faust3
parents:
12792
diff
changeset
|
61 &audio_out_dsound, |
70d8f1975fc8
directsound audio output plugin, patch by Gabor Szecsi <deje at miki.hu> some minor modifications by me
faust3
parents:
12792
diff
changeset
|
62 #endif |
27387
eb7bdbd98210
Rename some audio-output-related preprocessor directives.
diego
parents:
27370
diff
changeset
|
63 #ifdef CONFIG_WIN32WAVEOUT |
8729
561aa9c850f7
Rearrange the vo and ao driver order to prefer the native drivers and give
diego
parents:
8572
diff
changeset
|
64 &audio_out_win32, |
561aa9c850f7
Rearrange the vo and ao driver order to prefer the native drivers and give
diego
parents:
8572
diff
changeset
|
65 #endif |
27388
ac03760f7fcc
Rename all preprocessor directives related to Apple / Mac OS X.
diego
parents:
27387
diff
changeset
|
66 #ifdef CONFIG_COREAUDIO |
26101 | 67 &audio_out_macosx, |
16732
644baf91233c
ao_macosx is a native audio output driver and should thus have priority
diego
parents:
15789
diff
changeset
|
68 #endif |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27091
diff
changeset
|
69 #ifdef CONFIG_OSS_AUDIO |
954 | 70 &audio_out_oss, |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
71 #endif |
27390
9d95dc936e66
Introduce CONFIG_ALSA preprocessor directive for ALSA 0.9 and 1.x.
diego
parents:
27388
diff
changeset
|
72 #ifdef CONFIG_ALSA |
26101 | 73 &audio_out_alsa, |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
6069
diff
changeset
|
74 #endif |
27387
eb7bdbd98210
Rename some audio-output-related preprocessor directives.
diego
parents:
27370
diff
changeset
|
75 #ifdef CONFIG_ALSA5 |
26101 | 76 &audio_out_alsa5, |
1725
24e75b632740
Move the sun audio driver near the start of the list of audio drivers, so
jkeil
parents:
1528
diff
changeset
|
77 #endif |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27091
diff
changeset
|
78 #ifdef CONFIG_SGI_AUDIO |
2450 | 79 &audio_out_sgi, |
80 #endif | |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27091
diff
changeset
|
81 #ifdef CONFIG_SUN_AUDIO |
7609 | 82 &audio_out_sun, |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
5192
diff
changeset
|
83 #endif |
7609 | 84 // wrappers: |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27091
diff
changeset
|
85 #ifdef CONFIG_ARTS |
7609 | 86 &audio_out_arts, |
1032 | 87 #endif |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27091
diff
changeset
|
88 #ifdef CONFIG_ESD |
8572 | 89 &audio_out_esd, |
90 #endif | |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27091
diff
changeset
|
91 #ifdef CONFIG_PULSE |
24781 | 92 &audio_out_pulse, |
13878
66637fa67531
polyaudio audio driver patch by Lennart Poettering <mzzcynlre at 0pointer.de>
faust3
parents:
13632
diff
changeset
|
93 #endif |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27091
diff
changeset
|
94 #ifdef CONFIG_JACK |
12662
05d46af5e2bf
JACK audio support through bio2jack by Kamil Strzelecki <esack@o2.pl>
alex
parents:
12636
diff
changeset
|
95 &audio_out_jack, |
05d46af5e2bf
JACK audio support through bio2jack by Kamil Strzelecki <esack@o2.pl>
alex
parents:
12636
diff
changeset
|
96 #endif |
27387
eb7bdbd98210
Rename some audio-output-related preprocessor directives.
diego
parents:
27370
diff
changeset
|
97 #ifdef CONFIG_NAS |
26101 | 98 &audio_out_nas, |
3276 | 99 #endif |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27341
diff
changeset
|
100 #ifdef CONFIG_SDL |
966
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
101 &audio_out_sdl, |
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
102 #endif |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27091
diff
changeset
|
103 #ifdef CONFIG_OPENAL |
17633
e0ef5688cce7
OpenAL audio support, actual output is mono-only (no positioning yet).
reimar
parents:
17566
diff
changeset
|
104 &audio_out_openal, |
17634 | 105 #endif |
26101 | 106 &audio_out_mpegpes, |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27341
diff
changeset
|
107 #ifdef CONFIG_DXR2 |
19409
37decab2ed46
Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents:
19224
diff
changeset
|
108 &audio_out_dxr2, |
37decab2ed46
Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents:
19224
diff
changeset
|
109 #endif |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27341
diff
changeset
|
110 #ifdef CONFIG_IVTV |
19409
37decab2ed46
Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents:
19224
diff
changeset
|
111 &audio_out_ivtv, |
37decab2ed46
Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents:
19224
diff
changeset
|
112 #endif |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27341
diff
changeset
|
113 #ifdef CONFIG_V4L2_DECODER |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
19409
diff
changeset
|
114 &audio_out_v4l2, |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
19409
diff
changeset
|
115 #endif |
7609 | 116 &audio_out_null, |
117 // should not be auto-selected: | |
26101 | 118 &audio_out_pcm, |
119 NULL | |
954 | 120 }; |
3095 | 121 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
16732
diff
changeset
|
122 void list_audio_out(void){ |
26101 | 123 int i=0; |
124 mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AvailableAudioOutputDrivers); | |
125 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_OUTPUTS\n"); | |
126 while (audio_out_drivers[i]) { | |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
127 const ao_info_t *info = audio_out_drivers[i++]->info; |
26101 | 128 mp_msg(MSGT_GLOBAL, MSGL_INFO,"\t%s\t%s\n", info->short_name, info->name); |
129 } | |
130 mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n"); | |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
131 } |
3095 | 132 |
25913 | 133 const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int channels,int format,int flags){ |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
134 int i; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
135 // first try the preferred drivers, with their optional subdevice param: |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
136 if(ao_list && ao_list[0]) |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
137 while(ao_list[0][0]){ |
13632 | 138 char* ao=ao_list[0]; |
139 int ao_len; | |
13542
ed7e91827ead
removing ao_alsa9.c and ao_alsa1x.c as they are superseded by ao_alsa.c
reimar
parents:
13520
diff
changeset
|
140 if (strncmp(ao, "alsa9", 5) == 0 || strncmp(ao, "alsa1x", 6) == 0) { |
26101 | 141 mp_msg(MSGT_AO, MSGL_FATAL, MSGTR_AO_ALSA9_1x_Removed); |
142 exit_player(NULL); | |
13542
ed7e91827ead
removing ao_alsa9.c and ao_alsa1x.c as they are superseded by ao_alsa.c
reimar
parents:
13520
diff
changeset
|
143 } |
13632 | 144 if (ao_subdevice) { |
26101 | 145 free(ao_subdevice); |
146 ao_subdevice = NULL; | |
147 } | |
148 ao_subdevice=strchr(ao,':'); | |
149 if(ao_subdevice){ | |
150 ao_len = ao_subdevice - ao; | |
151 ao_subdevice = strdup(&ao[ao_len + 1]); | |
13632 | 152 } |
26101 | 153 else |
154 ao_len = strlen(ao); | |
27091
66e998895707
Add verbose messages about trying and searching for audio output drivers.
corey
parents:
26208
diff
changeset
|
155 |
66e998895707
Add verbose messages about trying and searching for audio output drivers.
corey
parents:
26208
diff
changeset
|
156 mp_msg(MSGT_AO, MSGL_V, MSGTR_AO_TryingPreferredAudioDriver, |
66e998895707
Add verbose messages about trying and searching for audio output drivers.
corey
parents:
26208
diff
changeset
|
157 ao_len, ao, ao_subdevice ? ao_subdevice : "[none]"); |
66e998895707
Add verbose messages about trying and searching for audio output drivers.
corey
parents:
26208
diff
changeset
|
158 |
26101 | 159 for(i=0;audio_out_drivers[i];i++){ |
160 const ao_functions_t* audio_out=audio_out_drivers[i]; | |
161 if(!strncmp(audio_out->info->short_name,ao,ao_len)){ | |
162 // name matches, try it | |
163 if(audio_out->init(rate,channels,format,flags)) | |
164 return audio_out; // success! | |
27091
66e998895707
Add verbose messages about trying and searching for audio output drivers.
corey
parents:
26208
diff
changeset
|
165 else |
66e998895707
Add verbose messages about trying and searching for audio output drivers.
corey
parents:
26208
diff
changeset
|
166 mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_FailedInit, ao); |
66e998895707
Add verbose messages about trying and searching for audio output drivers.
corey
parents:
26208
diff
changeset
|
167 break; |
26101 | 168 } |
169 } | |
27091
66e998895707
Add verbose messages about trying and searching for audio output drivers.
corey
parents:
26208
diff
changeset
|
170 if (!audio_out_drivers[i]) // we searched through the entire list |
66e998895707
Add verbose messages about trying and searching for audio output drivers.
corey
parents:
26208
diff
changeset
|
171 mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_NoSuchDriver, ao_len, ao); |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
172 // continue... |
26101 | 173 ++ao_list; |
174 if(!(ao_list[0])) return NULL; // do NOT fallback to others | |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
175 } |
13632 | 176 if (ao_subdevice) { |
26101 | 177 free(ao_subdevice); |
178 ao_subdevice = NULL; | |
13632 | 179 } |
27091
66e998895707
Add verbose messages about trying and searching for audio output drivers.
corey
parents:
26208
diff
changeset
|
180 |
66e998895707
Add verbose messages about trying and searching for audio output drivers.
corey
parents:
26208
diff
changeset
|
181 mp_msg(MSGT_AO, MSGL_V, MSGTR_AO_TryingEveryKnown); |
66e998895707
Add verbose messages about trying and searching for audio output drivers.
corey
parents:
26208
diff
changeset
|
182 |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
183 // now try the rest... |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
184 for(i=0;audio_out_drivers[i];i++){ |
26101 | 185 const ao_functions_t* audio_out=audio_out_drivers[i]; |
186 // if(audio_out->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE) | |
187 if(audio_out->init(rate,channels,format,flags)) | |
188 return audio_out; // success! | |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
189 } |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
190 return NULL; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
191 } |
3095 | 192 |