Mercurial > mplayer.hg
annotate libao2/audio_out.c @ 11994:a7751694c177
spp softthresholding in mmx
author | michael |
---|---|
date | Tue, 24 Feb 2004 13:28:42 +0000 |
parents | 66e491c35dc8 |
children | 38f523e2c3ba |
rev | line source |
---|---|
954 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
7848 | 3 #include <string.h> |
954 | 4 |
5 #include "../config.h" | |
6 #include "audio_out.h" | |
1058 | 7 #include "afmt.h" |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
8 |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
9 #include "../mp_msg.h" |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
10 #include "../help_mp.h" |
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 |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
16 #ifdef USE_OSS_AUDIO |
954 | 17 extern ao_functions_t audio_out_oss; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
18 #endif |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
6069
diff
changeset
|
19 #ifdef USE_ARTS |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
6069
diff
changeset
|
20 extern ao_functions_t audio_out_arts; |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
6069
diff
changeset
|
21 #endif |
8572 | 22 #ifdef USE_ESD |
23 extern ao_functions_t audio_out_esd; | |
24 #endif | |
954 | 25 extern ao_functions_t audio_out_null; |
1007 | 26 #ifdef HAVE_ALSA5 |
27 extern ao_functions_t audio_out_alsa5; | |
28 #endif | |
1032 | 29 #ifdef HAVE_ALSA9 |
30 extern ao_functions_t audio_out_alsa9; | |
31 #endif | |
11775 | 32 #ifdef HAVE_ALSA1X |
33 extern ao_functions_t audio_out_alsa1x; | |
34 #endif | |
3276 | 35 #ifdef HAVE_NAS |
36 extern ao_functions_t audio_out_nas; | |
37 #endif | |
966
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
38 #ifdef HAVE_SDL |
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
39 extern ao_functions_t audio_out_sdl; |
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
40 #endif |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
41 #ifdef USE_SUN_AUDIO |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
42 extern ao_functions_t audio_out_sun; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
43 #endif |
2450 | 44 #ifdef USE_SGI_AUDIO |
45 extern ao_functions_t audio_out_sgi; | |
46 #endif | |
7916 | 47 #ifdef HAVE_WIN32WAVEOUT |
48 extern ao_functions_t audio_out_win32; | |
49 #endif | |
10147
f2725d6717bd
Native MacOSX audio output by Dan Christiansen <danchr@daimi.au.dk>
alex
parents:
9633
diff
changeset
|
50 #ifdef MACOSX |
f2725d6717bd
Native MacOSX audio output by Dan Christiansen <danchr@daimi.au.dk>
alex
parents:
9633
diff
changeset
|
51 extern ao_functions_t audio_out_macosx; |
f2725d6717bd
Native MacOSX audio output by Dan Christiansen <danchr@daimi.au.dk>
alex
parents:
9633
diff
changeset
|
52 #endif |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
5192
diff
changeset
|
53 #ifdef HAVE_DXR2 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
5192
diff
changeset
|
54 extern ao_functions_t audio_out_dxr2; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
5192
diff
changeset
|
55 #endif |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4097
diff
changeset
|
56 extern ao_functions_t audio_out_mpegpes; |
1107 | 57 extern ao_functions_t audio_out_pcm; |
1185 | 58 extern ao_functions_t audio_out_pss; |
3095 | 59 extern ao_functions_t audio_out_plugin; |
954 | 60 |
61 ao_functions_t* audio_out_drivers[] = | |
62 { | |
7609 | 63 // vo-related: will fail unless you also do -vo mpegpes/dxr2 |
64 &audio_out_mpegpes, | |
65 #ifdef HAVE_DXR2 | |
66 &audio_out_dxr2, | |
67 #endif | |
68 // native: | |
8729
561aa9c850f7
Rearrange the vo and ao driver order to prefer the native drivers and give
diego
parents:
8572
diff
changeset
|
69 #ifdef HAVE_WIN32WAVEOUT |
561aa9c850f7
Rearrange the vo and ao driver order to prefer the native drivers and give
diego
parents:
8572
diff
changeset
|
70 &audio_out_win32, |
561aa9c850f7
Rearrange the vo and ao driver order to prefer the native drivers and give
diego
parents:
8572
diff
changeset
|
71 #endif |
10147
f2725d6717bd
Native MacOSX audio output by Dan Christiansen <danchr@daimi.au.dk>
alex
parents:
9633
diff
changeset
|
72 #ifdef MACOSX |
f2725d6717bd
Native MacOSX audio output by Dan Christiansen <danchr@daimi.au.dk>
alex
parents:
9633
diff
changeset
|
73 &audio_out_macosx, |
f2725d6717bd
Native MacOSX audio output by Dan Christiansen <danchr@daimi.au.dk>
alex
parents:
9633
diff
changeset
|
74 #endif |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
75 #ifdef USE_OSS_AUDIO |
954 | 76 &audio_out_oss, |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1032
diff
changeset
|
77 #endif |
11775 | 78 #ifdef HAVE_ALSA1X |
79 &audio_out_alsa1x, | |
80 #endif | |
7609 | 81 #ifdef HAVE_ALSA9 |
82 &audio_out_alsa9, | |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
6069
diff
changeset
|
83 #endif |
7609 | 84 #ifdef HAVE_ALSA5 |
85 &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
|
86 #endif |
2450 | 87 #ifdef USE_SGI_AUDIO |
88 &audio_out_sgi, | |
89 #endif | |
7609 | 90 #ifdef USE_SUN_AUDIO |
91 &audio_out_sun, | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
5192
diff
changeset
|
92 #endif |
7609 | 93 // wrappers: |
94 #ifdef USE_ARTS | |
95 &audio_out_arts, | |
1032 | 96 #endif |
8572 | 97 #ifdef USE_ESD |
98 &audio_out_esd, | |
99 #endif | |
3276 | 100 #ifdef HAVE_NAS |
101 &audio_out_nas, | |
102 #endif | |
966
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
103 #ifdef HAVE_SDL |
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
104 &audio_out_sdl, |
69b4f944ce08
Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents:
954
diff
changeset
|
105 #endif |
7609 | 106 &audio_out_null, |
107 // should not be auto-selected: | |
1107 | 108 &audio_out_pcm, |
3095 | 109 &audio_out_plugin, |
954 | 110 NULL |
111 }; | |
3095 | 112 |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
113 void list_audio_out(){ |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
114 int i=0; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
115 mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AvailableAudioOutputDrivers); |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
116 while (audio_out_drivers[i]) { |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
117 const ao_info_t *info = audio_out_drivers[i++]->info; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
118 printf("\t%s\t%s\n", info->short_name, info->name); |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
119 } |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
120 printf("\n"); |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
121 } |
3095 | 122 |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
123 ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int channels,int format,int flags){ |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
124 int i; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
125 // 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
|
126 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
|
127 while(ao_list[0][0]){ |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
128 char* ao=strdup(ao_list[0]); |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
129 ao_subdevice=strchr(ao,':'); |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
130 if(ao_subdevice){ |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
131 ao_subdevice[0]=0; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
132 ++ao_subdevice; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
133 } |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
134 for(i=0;audio_out_drivers[i];i++){ |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
135 ao_functions_t* audio_out=audio_out_drivers[i]; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
136 if(!strcmp(audio_out->info->short_name,ao)){ |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
137 // name matches, try it |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
138 if(use_plugin){ |
9633
12b1790038b0
64bit libao2 fix by Jens Axboe <mplayer-dev@kernel.dk>
alex
parents:
8729
diff
changeset
|
139 audio_out_plugin.control(AOCONTROL_SET_PLUGIN_DRIVER,audio_out); |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
140 audio_out=&audio_out_plugin; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
141 } |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
142 if(audio_out->init(rate,channels,format,flags)) |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
143 return audio_out; // success! |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
144 } |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
145 } |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
146 // continue... |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
147 ++ao_list; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
148 if(!(ao_list[0])) return NULL; // do NOT fallback to others |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
149 } |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
150 // now try the rest... |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
151 ao_subdevice=NULL; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
152 for(i=0;audio_out_drivers[i];i++){ |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
153 ao_functions_t* audio_out=audio_out_drivers[i]; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
154 if(use_plugin){ |
9633
12b1790038b0
64bit libao2 fix by Jens Axboe <mplayer-dev@kernel.dk>
alex
parents:
8729
diff
changeset
|
155 audio_out_plugin.control(AOCONTROL_SET_PLUGIN_DRIVER,audio_out); |
7563
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
156 audio_out=&audio_out_plugin; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
157 } |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
158 if(audio_out->init(rate,channels,format,flags)) |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
159 return audio_out; // success! |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
160 } |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
161 return NULL; |
e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents:
6214
diff
changeset
|
162 } |
3095 | 163 |