annotate libao2/audio_out.c @ 37195:ac6c37d85d65 default tip

configure: Fix initialization of variable def_local_aligned_32 It contiained the #define of HAVE_LOCAL_ALIGNED_16 instead of HAVE_LOCAL_ALIGNED_32.
author al
date Sun, 28 Sep 2014 18:38:41 +0000
parents 5a61b8dd0aad
children
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;
36463
c6843e5bf166 libao2: Add sndio audio output module.
reimar
parents: 34754
diff changeset
43 extern const ao_functions_t audio_out_sndio;
28824
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_nas;
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_sdl;
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_sun;
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_sgi;
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_win32;
f92673eb6683 Make audio_out_* structs const so they end up in .rodata
reimar
parents: 28740
diff changeset
49 extern const ao_functions_t audio_out_dsound;
30439
2118e8876a2b Add OS/2 KAI audio driver support
komh
parents: 29209
diff changeset
50 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
51 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
52 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
53 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
54 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
55 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
56 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
57 extern const ao_functions_t audio_out_pss;
954
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
58
25913
21a1dc062bc5 ao_functions_t should be const, part 1
reimar
parents: 24781
diff changeset
59 const ao_functions_t* const audio_out_drivers[] =
954
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
60 {
7609
arpi
parents: 7563
diff changeset
61 // native:
27387
eb7bdbd98210 Rename some audio-output-related preprocessor directives.
diego
parents: 27370
diff changeset
62 #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
63 &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
64 #endif
27387
eb7bdbd98210 Rename some audio-output-related preprocessor directives.
diego
parents: 27370
diff changeset
65 #ifdef CONFIG_WIN32WAVEOUT
8729
561aa9c850f7 Rearrange the vo and ao driver order to prefer the native drivers and give
diego
parents: 8572
diff changeset
66 &audio_out_win32,
561aa9c850f7 Rearrange the vo and ao driver order to prefer the native drivers and give
diego
parents: 8572
diff changeset
67 #endif
30439
2118e8876a2b Add OS/2 KAI audio driver support
komh
parents: 29209
diff changeset
68 #ifdef CONFIG_KAI
2118e8876a2b Add OS/2 KAI audio driver support
komh
parents: 29209
diff changeset
69 &audio_out_kai,
2118e8876a2b Add OS/2 KAI audio driver support
komh
parents: 29209
diff changeset
70 #endif
28740
1f76d86e49ae DART audio output driver for OS/2 by KO Myung-Hun, komh chollian net
diego
parents: 28343
diff changeset
71 #ifdef CONFIG_DART
1f76d86e49ae DART audio output driver for OS/2 by KO Myung-Hun, komh chollian net
diego
parents: 28343
diff changeset
72 &audio_out_dart,
1f76d86e49ae DART audio output driver for OS/2 by KO Myung-Hun, komh chollian net
diego
parents: 28343
diff changeset
73 #endif
27388
ac03760f7fcc Rename all preprocessor directives related to Apple / Mac OS X.
diego
parents: 27387
diff changeset
74 #ifdef CONFIG_COREAUDIO
29209
631aac106b7a Rename macosx audio output driver to coreaudio.
diego
parents: 28824
diff changeset
75 &audio_out_coreaudio,
16732
644baf91233c ao_macosx is a native audio output driver and should thus have priority
diego
parents: 15789
diff changeset
76 #endif
36463
c6843e5bf166 libao2: Add sndio audio output module.
reimar
parents: 34754
diff changeset
77 #ifdef CONFIG_SNDIO_AUDIO
c6843e5bf166 libao2: Add sndio audio output module.
reimar
parents: 34754
diff changeset
78 &audio_out_sndio,
c6843e5bf166 libao2: Add sndio audio output module.
reimar
parents: 34754
diff changeset
79 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
80 #ifdef CONFIG_OSS_AUDIO
954
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
81 &audio_out_oss,
1038
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents: 1032
diff changeset
82 #endif
27390
9d95dc936e66 Introduce CONFIG_ALSA preprocessor directive for ALSA 0.9 and 1.x.
diego
parents: 27388
diff changeset
83 #ifdef CONFIG_ALSA
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
84 &audio_out_alsa,
6214
0398cb49fe5e aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents: 6069
diff changeset
85 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
86 #ifdef CONFIG_SGI_AUDIO
2450
f51307170f69 MIPS support by oliver.schoenbrunner@jku.at
arpi
parents: 1725
diff changeset
87 &audio_out_sgi,
f51307170f69 MIPS support by oliver.schoenbrunner@jku.at
arpi
parents: 1725
diff changeset
88 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
89 #ifdef CONFIG_SUN_AUDIO
7609
arpi
parents: 7563
diff changeset
90 &audio_out_sun,
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents: 5192
diff changeset
91 #endif
7609
arpi
parents: 7563
diff changeset
92 // wrappers:
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
93 #ifdef CONFIG_ARTS
7609
arpi
parents: 7563
diff changeset
94 &audio_out_arts,
1032
e34336f4feaf add esd support and disabled default.
pontscho
parents: 1007
diff changeset
95 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
96 #ifdef CONFIG_ESD
8572
46dbfa8c1999 new EsounD audio driver (-ao esd)
jkeil
parents: 7916
diff changeset
97 &audio_out_esd,
46dbfa8c1999 new EsounD audio driver (-ao esd)
jkeil
parents: 7916
diff changeset
98 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
99 #ifdef CONFIG_PULSE
24781
84adab7a8f97 Replace Polyp- by PulseAudio output.
reimar
parents: 23905
diff changeset
100 &audio_out_pulse,
13878
66637fa67531 polyaudio audio driver patch by Lennart Poettering <mzzcynlre at 0pointer.de>
faust3
parents: 13632
diff changeset
101 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
102 #ifdef CONFIG_JACK
12662
05d46af5e2bf JACK audio support through bio2jack by Kamil Strzelecki <esack@o2.pl>
alex
parents: 12636
diff changeset
103 &audio_out_jack,
05d46af5e2bf JACK audio support through bio2jack by Kamil Strzelecki <esack@o2.pl>
alex
parents: 12636
diff changeset
104 #endif
27387
eb7bdbd98210 Rename some audio-output-related preprocessor directives.
diego
parents: 27370
diff changeset
105 #ifdef CONFIG_NAS
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
106 &audio_out_nas,
3276
e279cc05f189 -ao NAS support by Tobias Diedrich <ranma@gmx.at>
arpi
parents: 3095
diff changeset
107 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
108 #ifdef CONFIG_SDL
966
69b4f944ce08 Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents: 954
diff changeset
109 &audio_out_sdl,
69b4f944ce08 Added support for sdl audio out (buggy pre-alpha).
atmosfear
parents: 954
diff changeset
110 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 27091
diff changeset
111 #ifdef CONFIG_OPENAL
17633
e0ef5688cce7 OpenAL audio support, actual output is mono-only (no positioning yet).
reimar
parents: 17566
diff changeset
112 &audio_out_openal,
17634
8dc8353c4ee8 fix compilation without openal
aurel
parents: 17633
diff changeset
113 #endif
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
114 &audio_out_mpegpes,
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
115 #ifdef CONFIG_DXR2
19409
37decab2ed46 Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents: 19224
diff changeset
116 &audio_out_dxr2,
37decab2ed46 Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents: 19224
diff changeset
117 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
118 #ifdef CONFIG_IVTV
19409
37decab2ed46 Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents: 19224
diff changeset
119 &audio_out_ivtv,
37decab2ed46 Move mpeg aos to the end of the autodetection list. At least mpegpes
uau
parents: 19224
diff changeset
120 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
121 #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
122 &audio_out_v4l2,
fb63124c7920 v4l2 audio/video outputs for linux 2.6.22+ kernels (outputs formerly known as ivtv)
ben
parents: 19409
diff changeset
123 #endif
7609
arpi
parents: 7563
diff changeset
124 &audio_out_null,
arpi
parents: 7563
diff changeset
125 // should not be auto-selected:
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
126 &audio_out_pcm,
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
127 NULL
954
db20b90dd34d audio out drivers
arpi_esp
parents:
diff changeset
128 };
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 2900
diff changeset
129
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 16732
diff changeset
130 void list_audio_out(void){
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
131 int i=0;
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
132 mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AvailableAudioOutputDrivers);
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
133 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_OUTPUTS\n");
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
134 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
135 const ao_info_t *info = audio_out_drivers[i++]->info;
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
136 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
137 }
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
138 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
139 }
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 2900
diff changeset
140
36851
5a61b8dd0aad Normalize 8-bit format "endianness".
reimar
parents: 36463
diff changeset
141 static int init_wrapper(const ao_functions_t *ao, int rate, int channels, int format, int flags)
5a61b8dd0aad Normalize 8-bit format "endianness".
reimar
parents: 36463
diff changeset
142 {
5a61b8dd0aad Normalize 8-bit format "endianness".
reimar
parents: 36463
diff changeset
143 int res = ao->init(rate, channels, format, flags);
5a61b8dd0aad Normalize 8-bit format "endianness".
reimar
parents: 36463
diff changeset
144 if (ao_data.format == (AF_FORMAT_U8 ^ AF_FORMAT_LE) ||
5a61b8dd0aad Normalize 8-bit format "endianness".
reimar
parents: 36463
diff changeset
145 ao_data.format == (AF_FORMAT_S8 ^ AF_FORMAT_LE))
5a61b8dd0aad Normalize 8-bit format "endianness".
reimar
parents: 36463
diff changeset
146 ao_data.format ^= AF_FORMAT_LE;
5a61b8dd0aad Normalize 8-bit format "endianness".
reimar
parents: 36463
diff changeset
147 return res;
5a61b8dd0aad Normalize 8-bit format "endianness".
reimar
parents: 36463
diff changeset
148 }
5a61b8dd0aad Normalize 8-bit format "endianness".
reimar
parents: 36463
diff changeset
149
25913
21a1dc062bc5 ao_functions_t should be const, part 1
reimar
parents: 24781
diff changeset
150 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
151 int i;
e9e4398029de audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents: 6214
diff changeset
152 // 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
153 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
154 while(ao_list[0][0]){
13632
b633ce0aa5c5 fixed small memleaks
reimar
parents: 13542
diff changeset
155 char* ao=ao_list[0];
b633ce0aa5c5 fixed small memleaks
reimar
parents: 13542
diff changeset
156 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
157 if (strncmp(ao, "alsa9", 5) == 0 || strncmp(ao, "alsa1x", 6) == 0) {
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
158 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
159 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
160 }
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 30633
diff changeset
161 free(ao_subdevice);
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 30633
diff changeset
162 ao_subdevice = NULL;
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
163 ao_subdevice=strchr(ao,':');
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
164 if(ao_subdevice){
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
165 ao_len = ao_subdevice - ao;
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
166 ao_subdevice = strdup(&ao[ao_len + 1]);
13632
b633ce0aa5c5 fixed small memleaks
reimar
parents: 13542
diff changeset
167 }
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
168 else
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
169 ao_len = strlen(ao);
27091
66e998895707 Add verbose messages about trying and searching for audio output drivers.
corey
parents: 26208
diff changeset
170
33827
277ec491a8a7 Do not translate console messages of verbosity level MSGL_V and above.
diego
parents: 32537
diff changeset
171 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
172 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
173
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
174 for(i=0;audio_out_drivers[i];i++){
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
175 const ao_functions_t* audio_out=audio_out_drivers[i];
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
176 if(!strncmp(audio_out->info->short_name,ao,ao_len)){
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
177 // name matches, try it
36851
5a61b8dd0aad Normalize 8-bit format "endianness".
reimar
parents: 36463
diff changeset
178 if(init_wrapper(audio_out,rate,channels,format,flags))
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
179 return audio_out; // success!
27091
66e998895707 Add verbose messages about trying and searching for audio output drivers.
corey
parents: 26208
diff changeset
180 else
66e998895707 Add verbose messages about trying and searching for audio output drivers.
corey
parents: 26208
diff changeset
181 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
182 break;
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
183 }
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
184 }
27091
66e998895707 Add verbose messages about trying and searching for audio output drivers.
corey
parents: 26208
diff changeset
185 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
186 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
187 // continue...
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
188 ++ao_list;
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
189 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
190 }
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 30633
diff changeset
191 free(ao_subdevice);
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 30633
diff changeset
192 ao_subdevice = NULL;
27091
66e998895707 Add verbose messages about trying and searching for audio output drivers.
corey
parents: 26208
diff changeset
193
33827
277ec491a8a7 Do not translate console messages of verbosity level MSGL_V and above.
diego
parents: 32537
diff changeset
194 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
195
7563
e9e4398029de audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents: 6214
diff changeset
196 // now try the rest...
e9e4398029de audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents: 6214
diff changeset
197 for(i=0;audio_out_drivers[i];i++){
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
198 const ao_functions_t* audio_out=audio_out_drivers[i];
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
199 // if(audio_out->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE)
36851
5a61b8dd0aad Normalize 8-bit format "endianness".
reimar
parents: 36463
diff changeset
200 if(init_wrapper(audio_out,rate,channels,format,flags))
26101
a65168348ad5 cosmetics: reindent, detabify
diego
parents: 26100
diff changeset
201 return audio_out; // success!
7563
e9e4398029de audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents: 6214
diff changeset
202 }
e9e4398029de audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents: 6214
diff changeset
203 return NULL;
e9e4398029de audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
arpi
parents: 6214
diff changeset
204 }
34754
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
205
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
206 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
207 {
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
208 int fillcnt = ao->get_space() - prepause_space;
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
209 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
210 void *silence = calloc(fillcnt, 1);
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
211 ao->play(silence, fillcnt, 0);
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
212 free(silence);
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
213 }
9d4720deada1 Use approach used by ao_oss to avoid audio desync
reimar
parents: 34247
diff changeset
214 }