annotate libao2/audio_out.c @ 36193:9beb155c77a0

Cosmetic: Adjust indent. Additionally, merge variable definitions.
author ib
date Sun, 26 May 2013 15:51:54 +0000
parents 9d4720deada1
children c6843e5bf166
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28343
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
1 /*
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
2 * This file is part of MPlayer.
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
3 *
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
5 * it under the terms of the GNU General Public License as published by
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
7 * (at your option) any later version.
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
8 *
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
12 * GNU General Public License for more details.
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
13 *
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
14 * You should have received a copy of the GNU General Public License along
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
17 */
e45b08f2f5d3 Add standard license headers.
diego
parents: 27390
diff changeset
18
954
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
19 #include <stdio.h>
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
20 #include <stdlib.h>
7848
3c1d30a1afc0 compiler warning fixes by Dominik
arpi
parents: 7609
diff changeset
21 #include <string.h>
954
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
22
14123
a92101a7eb49 Make include paths consistent.
diego
parents: 13878
diff changeset
23 #include "config.h"
954
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
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
a92101a7eb49 Make include paths consistent.
diego
parents: 13878
diff changeset
26 #include "mp_msg.h"
a92101a7eb49 Make include paths consistent.
diego
parents: 13878
diff changeset
27 #include "help_mp.h"
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30439
diff changeset
28 #include "mp_core.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
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
30 // there are some globals:
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 2900
diff changeset
31 ao_data_t ao_data={0,0,0,0,OUTBURST,-1,0};
1185
e21c96e28062 ao_subdevice implemented
al3x
parents: 1121
diff changeset
32 char *ao_subdevice = NULL;
954
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
33
28824
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
34 extern const ao_functions_t audio_out_oss;
29209
631aac106b7a Rename macosx audio output driver to coreaudio.
diego
parents: 28824
diff changeset
35 extern const ao_functions_t audio_out_coreaudio;
28824
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
36 extern const ao_functions_t audio_out_arts;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
37 extern const ao_functions_t audio_out_esd;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
38 extern const ao_functions_t audio_out_pulse;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
39 extern const ao_functions_t audio_out_jack;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
40 extern const ao_functions_t audio_out_openal;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
41 extern const ao_functions_t audio_out_null;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
42 extern const ao_functions_t audio_out_alsa;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
43 extern const ao_functions_t audio_out_nas;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
44 extern const ao_functions_t audio_out_sdl;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
45 extern const ao_functions_t audio_out_sun;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
46 extern const ao_functions_t audio_out_sgi;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
47 extern const ao_functions_t audio_out_win32;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
48 extern const ao_functions_t audio_out_dsound;
30439
2118e8876a2b Add OS/2 KAI audio driver support
komh
parents: 29209
diff changeset
49 extern const ao_functions_t audio_out_kai;
28824
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
50 extern const ao_functions_t audio_out_dart;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
51 extern const ao_functions_t audio_out_dxr2;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
52 extern const ao_functions_t audio_out_ivtv;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
53 extern const ao_functions_t audio_out_v4l2;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
54 extern const ao_functions_t audio_out_mpegpes;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
55 extern const ao_functions_t audio_out_pcm;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
56 extern const ao_functions_t audio_out_pss;
954
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
57
25913
21a1dc062bc5 ao_functions_t should be const, part 1
reimar
parents: 24781
diff changeset
58 const ao_functions_t* const audio_out_drivers[] =
954
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
59 {
7609
arpi
parents: 7563
diff changeset
60 // native:
27387
eb7bdbd98210 Rename some audio-output-related preprocessor directives.
diego
parents: 27370
diff changeset
61 #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
62 &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
63 #endif
27387
eb7bdbd98210 Rename some audio-output-related preprocessor directives.
diego
parents: 27370
diff changeset
64 #ifdef CONFIG_WIN32WAVEOUT
8729
561aa9c850f7 Rearrange the vo and ao driver order to prefer the native drivers and give
diego
parents: 8572
diff changeset
65 &audio_out_win32,
561aa9c850f7 Rearrange the vo and ao driver order to prefer the native drivers and give
diego
parents: 8572
diff changeset
66 #endif
30439
2118e8876a2b Add OS/2 KAI audio driver support
komh
parents: 29209
diff changeset
67 #ifdef CONFIG_KAI
2118e8876a2b Add OS/2 KAI audio driver support
komh
parents: 29209
diff changeset
68 &audio_out_kai,
2118e8876a2b Add OS/2 KAI audio driver support
komh
parents: 29209
diff changeset
69 #endif
28740
1f76d86e49ae DART audio output driver for OS/2 by KO Myung-Hun, komh chollian net
diego
parents: 28343
diff changeset
70 #ifdef CONFIG_DART
1f76d86e49ae DART audio output driver for OS/2 by KO Myung-Hun, komh chollian net
diego
parents: 28343
diff changeset
71 &audio_out_dart,
1f76d86e49ae DART audio output driver for OS/2 by KO Myung-Hun, komh chollian net
diego
parents: 28343
diff changeset
72 #endif
27388
ac03760f7fcc Rename all preprocessor directives related to Apple / Mac OS X.
diego
parents: 27387
diff changeset
73 #ifdef CONFIG_COREAUDIO
29209
631aac106b7a Rename macosx audio output driver to coreaudio.
diego
parents: 28824
diff changeset
74 &audio_out_coreaudio,
16732
644baf91233c ao_macosx is a native audio output driver and should thus have priority
diego
parents: 15789
diff changeset
75 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
76 #ifdef CONFIG_OSS_AUDIO
954
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
77 &audio_out_oss,
1038
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents: 1032
diff changeset
78 #endif
27390
9d95dc936e66 Introduce CONFIG_ALSA preprocessor directive for ALSA 0.9 and 1.x.
diego
parents: 27388
diff changeset
79 #ifdef CONFIG_ALSA
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
80 &audio_out_alsa,
6214
0398cb49fe5e aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents: 6069
diff changeset
81 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
82 #ifdef CONFIG_SGI_AUDIO
2450
f51307170f69 MIPS support by oliver.schoenbrunner@jku.at
arpi
parents: 1725
diff changeset
83 &audio_out_sgi,
f51307170f69 MIPS support by oliver.schoenbrunner@jku.at
arpi
parents: 1725
diff changeset
84 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
85 #ifdef CONFIG_SUN_AUDIO
7609
arpi
parents: 7563
diff changeset
86 &audio_out_sun,
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents: 5192
diff changeset
87 #endif
7609
arpi
parents: 7563
diff changeset
88 // wrappers:
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
89 #ifdef CONFIG_ARTS
7609
arpi
parents: 7563
diff changeset
90 &audio_out_arts,
1032
e34336f4feaf add esd support and disabled default.
pontscho
parents: 1007
diff changeset
91 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
92 #ifdef CONFIG_ESD
8572
46dbfa8c1999 new EsounD audio driver (-ao esd)
jkeil
parents: 7916
diff changeset
93 &audio_out_esd,
46dbfa8c1999 new EsounD audio driver (-ao esd)
jkeil
parents: 7916
diff changeset
94 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
95 #ifdef CONFIG_PULSE
24781
84adab7a8f97 Replace Polyp- by PulseAudio output.
reimar
parents: 23905
diff changeset
96 &audio_out_pulse,
13878
66637fa67531 polyaudio audio driver patch by Lennart Poettering <mzzcynlre at 0pointer.de>
faust3
parents: 13632
diff changeset
97 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
98 #ifdef CONFIG_JACK
12662
05d46af5e2bf JACK audio support through bio2jack by Kamil Strzelecki <esack@o2.pl>
alex
parents: 12636
diff changeset
99 &audio_out_jack,
05d46af5e2bf JACK audio support through bio2jack by Kamil Strzelecki <esack@o2.pl>
alex
parents: 12636
diff changeset
100 #endif
27387
eb7bdbd98210 Rename some audio-output-related preprocessor directives.
diego
parents: 27370
diff changeset
101 #ifdef CONFIG_NAS
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
102 &audio_out_nas,
3276
e279cc05f189 -ao NAS support by Tobias Diedrich <ranma@gmx.at>
arpi
parents: 3095
diff changeset
103 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
104 #ifdef CONFIG_SDL
966
69b4f944ce08 Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents: 954
diff changeset
105 &audio_out_sdl,
69b4f944ce08 Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents: 954
diff changeset
106 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
107 #ifdef CONFIG_OPENAL
17633
e0ef5688cce7 OpenAL audio support, actual output is mono-only (no positioning yet).
reimar
parents: 17566
diff changeset
108 &audio_out_openal,
17634
8dc8353c4ee8 fix compilation without openal
aurel
parents: 17633
diff changeset
109 #endif
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
110 &audio_out_mpegpes,
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
111 #ifdef CONFIG_DXR2
19409
37decab2ed46 Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents: 19224
diff changeset
112 &audio_out_dxr2,
37decab2ed46 Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents: 19224
diff changeset
113 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
114 #ifdef CONFIG_IVTV
19409
37decab2ed46 Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents: 19224
diff changeset
115 &audio_out_ivtv,
37decab2ed46 Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents: 19224
diff changeset
116 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
117 #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
118 &audio_out_v4l2,
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents: 19409
diff changeset
119 #endif
7609
arpi
parents: 7563
diff changeset
120 &audio_out_null,
arpi
parents: 7563
diff changeset
121 // should not be auto-selected:
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
122 &audio_out_pcm,
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
123 NULL
954
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
124 };
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 2900
diff changeset
125
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 16732
diff changeset
126 void list_audio_out(void){
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
127 int i=0;
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
128 mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AvailableAudioOutputDrivers);
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
129 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_OUTPUTS\n");
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
130 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
131 const ao_info_t *info = audio_out_drivers[i++]->info;
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
132 mp_msg(MSGT_GLOBAL, MSGL_INFO,"\t%s\t%s\n", info->short_name, info->name);
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
133 }
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
134 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
135 }
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 2900
diff changeset
136
25913
21a1dc062bc5 ao_functions_t should be const, part 1
reimar
parents: 24781
diff changeset
137 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
138 int i;
e9e4398029de audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents: 6214
diff changeset
139 // 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
140 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
141 while(ao_list[0][0]){
13632
b633ce0aa5c5 fixed small memleaks
reimar
parents: 13542
diff changeset
142 char* ao=ao_list[0];
b633ce0aa5c5 fixed small memleaks
reimar
parents: 13542
diff changeset
143 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
144 if (strncmp(ao, "alsa9", 5) == 0 || strncmp(ao, "alsa1x", 6) == 0) {
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
145 mp_msg(MSGT_AO, MSGL_FATAL, MSGTR_AO_ALSA9_1x_Removed);
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30439
diff changeset
146 exit_player(EXIT_NONE);
13542
ed7e91827ead removing ao_alsa9.c and ao_alsa1x.c as they are superseded by ao_alsa.c
reimar
parents: 13520
diff changeset
147 }
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 30633
diff changeset
148 free(ao_subdevice);
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 30633
diff changeset
149 ao_subdevice = NULL;
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
150 ao_subdevice=strchr(ao,':');
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
151 if(ao_subdevice){
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
152 ao_len = ao_subdevice - ao;
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
153 ao_subdevice = strdup(&ao[ao_len + 1]);
13632
b633ce0aa5c5 fixed small memleaks
reimar
parents: 13542
diff changeset
154 }
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
155 else
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
156 ao_len = strlen(ao);
27091
66e998895707 Add verbose messages about trying and searching for audio output drivers.
corey
parents: 26208
diff changeset
157
33827
277ec491a8a7 Do not translate console messages of verbosity level MSGL_V and above.
diego
parents: 32537
diff changeset
158 mp_msg(MSGT_AO, MSGL_V, "Trying preferred audio driver '%.*s', options '%s'\n",
27091
66e998895707 Add verbose messages about trying and searching for audio output drivers.
corey
parents: 26208
diff changeset
159 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
160
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
161 for(i=0;audio_out_drivers[i];i++){
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
162 const ao_functions_t* audio_out=audio_out_drivers[i];
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
163 if(!strncmp(audio_out->info->short_name,ao,ao_len)){
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
164 // name matches, try it
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
165 if(audio_out->init(rate,channels,format,flags))
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
166 return audio_out; // success!
27091
66e998895707 Add verbose messages about trying and searching for audio output drivers.
corey
parents: 26208
diff changeset
167 else
66e998895707 Add verbose messages about trying and searching for audio output drivers.
corey
parents: 26208
diff changeset
168 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
169 break;
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
170 }
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
171 }
27091
66e998895707 Add verbose messages about trying and searching for audio output drivers.
corey
parents: 26208
diff changeset
172 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
173 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
174 // continue...
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
175 ++ao_list;
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
176 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
177 }
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 30633
diff changeset
178 free(ao_subdevice);
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 30633
diff changeset
179 ao_subdevice = NULL;
27091
66e998895707 Add verbose messages about trying and searching for audio output drivers.
corey
parents: 26208
diff changeset
180
33827
277ec491a8a7 Do not translate console messages of verbosity level MSGL_V and above.
diego
parents: 32537
diff changeset
181 mp_msg(MSGT_AO, MSGL_V, "Trying every known audio driver...\n");
27091
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
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
185 const ao_functions_t* audio_out=audio_out_drivers[i];
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
186 // if(audio_out->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE)
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
187 if(audio_out->init(rate,channels,format,flags))
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
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 }
34754
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
192
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
193 void mp_ao_resume_refill(const ao_functions_t *ao, int prepause_space)
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
194 {
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
195 int fillcnt = ao->get_space() - prepause_space;
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
196 if (fillcnt > 0 && !(ao_data.format & AF_FORMAT_SPECIAL_MASK)) {
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
197 void *silence = calloc(fillcnt, 1);
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
198 ao->play(silence, fillcnt, 0);
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
199 free(silence);
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
200 }
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
201 }