Mercurial > mplayer.hg
annotate libao2/audio_out.c @ 26130:e17acc5feca4
Move duplicated extern declarations of mp_msg_levels and mp_msg_level_all
to cfg-common.h where they are really needed.
author | diego |
---|---|
date | Tue, 04 Mar 2008 21:45:36 +0000 |
parents | 5eb017bb1568 |
children | 4980ed598e8a |
rev | line source |
---|---|
954 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
7848 | 3 #include <string.h> |
954 | 4 |
14123 | 5 #include "config.h" |
954 | 6 #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
|
7 |
14123 | 8 #include "mp_msg.h" |
9 #include "help_mp.h" | |
15058 | 10 #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
|
11 |
954 | 12 // there are some globals: |
3095 | 13 ao_data_t ao_data={0,0,0,0,OUTBURST,-1,0}; |
1185 | 14 char *ao_subdevice = NULL; |
954 | 15 |
16 extern ao_functions_t audio_out_oss; | |
12792 | 17 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
|
18 extern ao_functions_t audio_out_arts; |
8572 | 19 extern ao_functions_t audio_out_esd; |
24781 | 20 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
|
21 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
|
22 extern ao_functions_t audio_out_openal; |
954 | 23 extern ao_functions_t audio_out_null; |
26101 | 24 extern ao_functions_t audio_out_alsa5; |
25 extern ao_functions_t audio_out_alsa; | |
3276 | 26 extern ao_functions_t audio_out_nas; |
966
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
27 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
|
28 extern ao_functions_t audio_out_sun; |
2450 | 29 extern ao_functions_t audio_out_sgi; |
7916 | 30 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
|
31 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
|
32 extern ao_functions_t audio_out_dxr2; |
19224 | 33 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
|
34 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
|
35 extern ao_functions_t audio_out_mpegpes; |
1107 | 36 extern ao_functions_t audio_out_pcm; |
1185 | 37 extern ao_functions_t audio_out_pss; |
954 | 38 |
25913 | 39 const ao_functions_t* const audio_out_drivers[] = |
954 | 40 { |
7609 | 41 // native: |
13460
70d8f1975fc8
directsound audio output plugin, patch by Gabor Szecsi <deje at miki.hu> some minor modifications by me
faust3
parents:
12792
diff
changeset
|
42 #ifdef HAVE_DIRECTX |
70d8f1975fc8
directsound audio output plugin, patch by Gabor Szecsi <deje at miki.hu> some minor modifications by me
faust3
parents:
12792
diff
changeset
|
43 &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
|
44 #endif |
8729
561aa9c850f7
Rearrange the vo and ao driver order to prefer the native drivers and give
diego
parents:
8572
diff
changeset
|
45 #ifdef HAVE_WIN32WAVEOUT |
561aa9c850f7
Rearrange the vo and ao driver order to prefer the native drivers and give
diego
parents:
8572
diff
changeset
|
46 &audio_out_win32, |
561aa9c850f7
Rearrange the vo and ao driver order to prefer the native drivers and give
diego
parents:
8572
diff
changeset
|
47 #endif |
16732
644baf91233c
ao_macosx is a native audio output driver and should thus have priority
diego
parents:
15789
diff
changeset
|
48 #ifdef MACOSX |
26101 | 49 &audio_out_macosx, |
16732
644baf91233c
ao_macosx is a native audio output driver and should thus have priority
diego
parents:
15789
diff
changeset
|
50 #endif |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
51 #ifdef USE_OSS_AUDIO |
954 | 52 &audio_out_oss, |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
53 #endif |
26102 | 54 #if defined (HAVE_ALSA1X) || defined (HAVE_ALSA9) |
26101 | 55 &audio_out_alsa, |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
6069
diff
changeset
|
56 #endif |
7609 | 57 #ifdef HAVE_ALSA5 |
26101 | 58 &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
|
59 #endif |
2450 | 60 #ifdef USE_SGI_AUDIO |
61 &audio_out_sgi, | |
62 #endif | |
7609 | 63 #ifdef USE_SUN_AUDIO |
64 &audio_out_sun, | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
5192
diff
changeset
|
65 #endif |
7609 | 66 // wrappers: |
67 #ifdef USE_ARTS | |
68 &audio_out_arts, | |
1032 | 69 #endif |
8572 | 70 #ifdef USE_ESD |
71 &audio_out_esd, | |
72 #endif | |
24781 | 73 #ifdef USE_PULSE |
74 &audio_out_pulse, | |
13878
66637fa67531
polyaudio audio driver patch by Lennart Poettering <mzzcynlre at 0pointer.de>
faust3
parents:
13632
diff
changeset
|
75 #endif |
12662
05d46af5e2bf
JACK audio support through bio2jack by Kamil Strzelecki <esack@o2.pl>
alex
parents:
12636
diff
changeset
|
76 #ifdef USE_JACK |
05d46af5e2bf
JACK audio support through bio2jack by Kamil Strzelecki <esack@o2.pl>
alex
parents:
12636
diff
changeset
|
77 &audio_out_jack, |
05d46af5e2bf
JACK audio support through bio2jack by Kamil Strzelecki <esack@o2.pl>
alex
parents:
12636
diff
changeset
|
78 #endif |
3276 | 79 #ifdef HAVE_NAS |
26101 | 80 &audio_out_nas, |
3276 | 81 #endif |
966
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
82 #ifdef HAVE_SDL |
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
83 &audio_out_sdl, |
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
84 #endif |
17634 | 85 #ifdef USE_OPENAL |
17633
e0ef5688cce7
OpenAL audio support, actual output is mono-only (no positioning yet).
reimar
parents:
17566
diff
changeset
|
86 &audio_out_openal, |
17634 | 87 #endif |
26101 | 88 &audio_out_mpegpes, |
19409
37decab2ed46
Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents:
19224
diff
changeset
|
89 #ifdef HAVE_DXR2 |
37decab2ed46
Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents:
19224
diff
changeset
|
90 &audio_out_dxr2, |
37decab2ed46
Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents:
19224
diff
changeset
|
91 #endif |
37decab2ed46
Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents:
19224
diff
changeset
|
92 #ifdef HAVE_IVTV |
37decab2ed46
Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents:
19224
diff
changeset
|
93 &audio_out_ivtv, |
37decab2ed46
Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents:
19224
diff
changeset
|
94 #endif |
23905
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
19409
diff
changeset
|
95 #ifdef HAVE_V4L2_DECODER |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
19409
diff
changeset
|
96 &audio_out_v4l2, |
fb63124c7920
v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents:
19409
diff
changeset
|
97 #endif |
7609 | 98 &audio_out_null, |
99 // should not be auto-selected: | |
26101 | 100 &audio_out_pcm, |
101 NULL | |
954 | 102 }; |
3095 | 103 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
16732
diff
changeset
|
104 void list_audio_out(void){ |
26101 | 105 int i=0; |
106 mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AvailableAudioOutputDrivers); | |
107 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_OUTPUTS\n"); | |
108 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
|
109 const ao_info_t *info = audio_out_drivers[i++]->info; |
26101 | 110 mp_msg(MSGT_GLOBAL, MSGL_INFO,"\t%s\t%s\n", info->short_name, info->name); |
111 } | |
112 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
|
113 } |
3095 | 114 |
25913 | 115 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
|
116 int i; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
117 // 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
|
118 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
|
119 while(ao_list[0][0]){ |
13632 | 120 char* ao=ao_list[0]; |
121 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
|
122 if (strncmp(ao, "alsa9", 5) == 0 || strncmp(ao, "alsa1x", 6) == 0) { |
26101 | 123 mp_msg(MSGT_AO, MSGL_FATAL, MSGTR_AO_ALSA9_1x_Removed); |
124 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
|
125 } |
13632 | 126 if (ao_subdevice) { |
26101 | 127 free(ao_subdevice); |
128 ao_subdevice = NULL; | |
129 } | |
130 ao_subdevice=strchr(ao,':'); | |
131 if(ao_subdevice){ | |
132 ao_len = ao_subdevice - ao; | |
133 ao_subdevice = strdup(&ao[ao_len + 1]); | |
13632 | 134 } |
26101 | 135 else |
136 ao_len = strlen(ao); | |
137 for(i=0;audio_out_drivers[i];i++){ | |
138 const ao_functions_t* audio_out=audio_out_drivers[i]; | |
139 if(!strncmp(audio_out->info->short_name,ao,ao_len)){ | |
140 // name matches, try it | |
141 if(audio_out->init(rate,channels,format,flags)) | |
142 return audio_out; // success! | |
143 } | |
144 } | |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
145 // continue... |
26101 | 146 ++ao_list; |
147 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
|
148 } |
13632 | 149 if (ao_subdevice) { |
26101 | 150 free(ao_subdevice); |
151 ao_subdevice = NULL; | |
13632 | 152 } |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
153 // now try the rest... |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
154 for(i=0;audio_out_drivers[i];i++){ |
26101 | 155 const ao_functions_t* audio_out=audio_out_drivers[i]; |
156 // if(audio_out->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE) | |
157 if(audio_out->init(rate,channels,format,flags)) | |
158 return audio_out; // success! | |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
159 } |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
160 return NULL; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
161 } |
3095 | 162 |