annotate libao2/ao_sun.c @ 7656:52009e5ef4fc

Handle playback of sample rates not supported by the sun audio hardware.
author jkeil
date Mon, 07 Oct 2002 18:42:31 +0000
parents 69d6da12bc30
children 6973a985ac2a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
1 #include <stdio.h>
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
2 #include <stdlib.h>
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
3 #include <string.h>
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
4
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
5 #include <unistd.h>
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
6 #include <fcntl.h>
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
7 #include <errno.h>
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
8 #include <sys/ioctl.h>
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
9 #include <sys/time.h>
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
10 #include <sys/types.h>
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
11 #include <sys/stat.h>
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
12 #include <sys/audioio.h>
7656
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
13 #ifdef AUDIO_SWFEATURE_MIXER /* solaris8 or newer? */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
14 # define HAVE_SYS_MIXER_H 1
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
15 #endif
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
16 #if HAVE_SYS_MIXER_H
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
17 # include <sys/mixer.h>
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
18 #endif
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
19 #ifdef __svr4__
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
20 #include <stropts.h>
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
21 #endif
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
22
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
23 #include "../config.h"
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
24 #include "../mixer.h"
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
25
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
26 #include "audio_out.h"
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
27 #include "audio_out_internal.h"
1058
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
28 #include "afmt.h"
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
29
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
30 static ao_info_t info =
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
31 {
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
32 "Sun audio output",
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
33 "sun",
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
34 "jk@tools.de",
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
35 ""
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
36 };
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
37
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
38 LIBAO_EXTERN(sun)
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
39
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
40
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
41 /* These defines are missing on NetBSD */
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
42 #ifndef AUDIO_PRECISION_8
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
43 #define AUDIO_PRECISION_8 8
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
44 #define AUDIO_PRECISION_16 16
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
45 #endif
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
46 #ifndef AUDIO_CHANNELS_MONO
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
47 #define AUDIO_CHANNELS_MONO 1
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
48 #define AUDIO_CHANNELS_STEREO 2
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
49 #endif
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
50
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
51
5893
6a6107da2d82 Default to the mixer device matching the audio device used for audio output.
jkeil
parents: 5872
diff changeset
52 static char *sun_mixer_device = NULL;
3492
24b0fad7fccc Use $AUDIODEV environment variable as the default audio device on solaris, if
jkeil
parents: 3137
diff changeset
53 static char *audio_dev = NULL;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
54 static int queued_bursts = 0;
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
55 static int queued_samples = 0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
56 static int bytes_per_sample = 0;
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
57 static int byte_per_sec = 0;
1807
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
58 static int convert_u8_s8;
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
59 static int audio_fd = -1;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
60 static enum {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
61 RTSC_UNKNOWN = 0,
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
62 RTSC_ENABLED,
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
63 RTSC_DISABLED
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
64 } enable_sample_timing;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
65
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
66 extern int verbose;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
67
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
68
1058
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
69 // convert an OSS audio format specification into a sun audio encoding
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
70 static int oss2sunfmt(int oss_format)
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
71 {
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
72 switch (oss_format){
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
73 case AFMT_MU_LAW:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
74 return AUDIO_ENCODING_ULAW;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
75 case AFMT_A_LAW:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
76 return AUDIO_ENCODING_ALAW;
1320
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
77 case AFMT_S16_BE:
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
78 case AFMT_S16_LE:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
79 return AUDIO_ENCODING_LINEAR;
1346
d6e6132bff35 AUDIO_ENCODING_LINEAR8 format is not available on sunos 5.5. Format is
jkeil
parents: 1320
diff changeset
80 #ifdef AUDIO_ENCODING_LINEAR8 // Missing on SunOS 5.5.1...
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
81 case AFMT_U8:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
82 return AUDIO_ENCODING_LINEAR8;
1346
d6e6132bff35 AUDIO_ENCODING_LINEAR8 format is not available on sunos 5.5. Format is
jkeil
parents: 1320
diff changeset
83 #endif
1058
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
84 #ifdef AUDIO_ENCODING_DVI // Missing on NetBSD...
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
85 case AFMT_IMA_ADPCM:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
86 return AUDIO_ENCODING_DVI;
1058
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
87 #endif
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
88 default:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
89 return AUDIO_ENCODING_NONE;
1058
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
90 }
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
91 }
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
92
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
93 // try to figure out, if the soundcard driver provides usable (precise)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
94 // sample counter information
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
95 static int realtime_samplecounter_available(char *dev)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
96 {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
97 int fd = -1;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
98 audio_info_t info;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
99 int rtsc_ok = RTSC_DISABLED;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
100 int len;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
101 void *silence = NULL;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
102 struct timeval start, end;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
103 struct timespec delay;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
104 int usec_delay;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
105 unsigned last_samplecnt;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
106 unsigned increment;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
107 unsigned min_increment;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
108
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
109 len = 44100 * 4 / 4; /* amount of data for 0.25sec of 44.1khz, stereo,
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
110 * 16bit. 44kbyte can be sent to all supported
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
111 * sun audio devices without blocking in the
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
112 * "write" below.
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
113 */
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
114 silence = calloc(1, len);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
115 if (silence == NULL)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
116 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
117
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
118 if ((fd = open(dev, O_WRONLY)) < 0)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
119 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
120
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
121 AUDIO_INITINFO(&info);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
122 info.play.sample_rate = 44100;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
123 info.play.channels = AUDIO_CHANNELS_STEREO;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
124 info.play.precision = AUDIO_PRECISION_16;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
125 info.play.encoding = AUDIO_ENCODING_LINEAR;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
126 info.play.samples = 0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
127 if (ioctl(fd, AUDIO_SETINFO, &info)) {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
128 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
129 printf("rtsc: SETINFO failed\n");
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
130 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
131 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
132
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
133 if (write(fd, silence, len) != len) {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
134 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
135 printf("rtsc: write failed");
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
136 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
137 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
138
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
139 if (ioctl(fd, AUDIO_GETINFO, &info)) {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
140 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
141 perror("rtsc: GETINFO1");
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
142 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
143 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
144
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
145 last_samplecnt = info.play.samples;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
146 min_increment = ~0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
147
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
148 gettimeofday(&start, NULL);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
149 for (;;) {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
150 delay.tv_sec = 0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
151 delay.tv_nsec = 10000000;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
152 nanosleep(&delay, NULL);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
153 gettimeofday(&end, NULL);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
154 usec_delay = (end.tv_sec - start.tv_sec) * 1000000
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
155 + end.tv_usec - start.tv_usec;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
156
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
157 // stop monitoring sample counter after 0.2 seconds
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
158 if (usec_delay > 200000)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
159 break;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
160
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
161 if (ioctl(fd, AUDIO_GETINFO, &info)) {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
162 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
163 perror("rtsc: GETINFO2 failed");
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
164 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
165 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
166 if (info.play.samples < last_samplecnt) {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
167 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
168 printf("rtsc: %d > %d?\n", last_samplecnt, info.play.samples);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
169 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
170 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
171
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
172 if ((increment = info.play.samples - last_samplecnt) > 0) {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
173 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
174 printf("ao_sun: sample counter increment: %d\n", increment);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
175 if (increment < min_increment) {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
176 min_increment = increment;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
177 if (min_increment < 2000)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
178 break; // looks good
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
179 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
180 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
181 last_samplecnt = info.play.samples;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
182 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
183
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
184 /*
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
185 * For 44.1kkz, stereo, 16-bit format we would send sound data in 16kbytes
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
186 * chunks (== 4096 samples) to the audio device. If we see a minimum
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
187 * sample counter increment from the soundcard driver of less than
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
188 * 2000 samples, we assume that the driver provides a useable realtime
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
189 * sample counter in the AUDIO_INFO play.samples field. Timing based
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
190 * on sample counts should be much more accurate than counting whole
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
191 * 16kbyte chunks.
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
192 */
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
193 if (min_increment < 2000)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
194 rtsc_ok = RTSC_ENABLED;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
195
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
196 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
197 printf("ao_sun: minimum sample counter increment per 10msec interval: %d\n"
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
198 "\t%susing sample counter based timing code\n",
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
199 min_increment, rtsc_ok == RTSC_ENABLED ? "" : "not ");
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
200
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
201
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
202 error:
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
203 if (silence != NULL) free(silence);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
204 if (fd >= 0) {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
205 #ifdef __svr4__
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
206 // remove the 0 bytes from the above measurement from the
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
207 // audio driver's STREAMS queue
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
208 ioctl(fd, I_FLUSH, FLUSHW);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
209 #endif
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
210 //ioctl(fd, AUDIO_DRAIN, 0);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
211 close(fd);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
212 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
213
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
214 return rtsc_ok;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
215 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
216
7656
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
217
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
218 // match the requested sample rate |sample_rate| against the
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
219 // sample rates supported by the audio device |dev|. Return
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
220 // a supported sample rate, if that sample rate is close to
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
221 // (< 1% difference) the requested rate; return 0 otherwise.
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
222
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
223 #define MAX_RATE_ERR 1
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
224
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
225 static unsigned
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
226 find_close_samplerate_match(int dev, unsigned sample_rate)
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
227 {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
228 #if HAVE_SYS_MIXER_H
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
229 am_sample_rates_t *sr;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
230 unsigned i, num, err, best_err, best_rate;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
231
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
232 for (num = 16; num < 1024; num *= 2) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
233 sr = malloc(AUDIO_MIXER_SAMP_RATES_STRUCT_SIZE(num));
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
234 if (!sr)
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
235 return 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
236 sr->type = AUDIO_PLAY;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
237 sr->flags = 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
238 sr->num_samp_rates = num;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
239 if (ioctl(dev, AUDIO_MIXER_GET_SAMPLE_RATES, sr)) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
240 free(sr);
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
241 return 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
242 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
243 if (sr->num_samp_rates <= num)
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
244 break;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
245 free(sr);
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
246 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
247
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
248 if (sr->flags & MIXER_SR_LIMITS) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
249 /*
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
250 * HW can playback any rate between
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
251 * sr->samp_rates[0] .. sr->samp_rates[1]
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
252 */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
253 free(sr);
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
254 return 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
255 } else {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
256 /* HW supports fixed sample rates only */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
257
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
258 best_err = 65535;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
259 best_rate = 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
260
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
261 for (i = 0; i < sr->num_samp_rates; i++) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
262 err = abs(sr->samp_rates[i] - sample_rate);
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
263 if (err == 0) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
264 /*
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
265 * exact supported sample rate match, no need to
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
266 * retry something else
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
267 */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
268 best_rate = 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
269 break;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
270 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
271 if (err < best_err) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
272 best_err = err;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
273 best_rate = sr->samp_rates[i];
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
274 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
275 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
276
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
277 free(sr);
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
278
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
279 if (best_rate > 0 && (100/MAX_RATE_ERR)*best_err < sample_rate) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
280 /* found a supported sample rate with <1% error? */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
281 return best_rate;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
282 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
283 return 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
284 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
285 #else /* old audioio driver, cannot return list of supported rates */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
286 /* XXX: hardcoded sample rates */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
287 unsigned i, err;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
288 unsigned audiocs_rates[] = {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
289 5510, 6620, 8000, 9600, 11025, 16000, 18900, 22050,
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
290 27420, 32000, 33075, 37800, 44100, 48000, 0
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
291 };
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
292
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
293 for (i = 0; audiocs_rates[i]; i++) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
294 err = abs(audiocs_rates[i] - sample_rate);
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
295 if (err == 0) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
296 /*
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
297 * exact supported sample rate match, no need to
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
298 * retry something elise
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
299 */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
300 return 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
301 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
302 if ((100/MAX_RATE_ERR)*err < audiocs_rates[i]) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
303 /* <1% error? */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
304 return audiocs_rates[i];
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
305 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
306 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
307
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
308 return 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
309 #endif
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
310 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
311
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
312
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
313 // return the highest sample rate supported by audio device |dev|.
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
314 static unsigned
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
315 find_highest_samplerate(int dev)
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
316 {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
317 #if HAVE_SYS_MIXER_H
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
318 am_sample_rates_t *sr;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
319 unsigned i, num, max_rate;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
320
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
321 for (num = 16; num < 1024; num *= 2) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
322 sr = malloc(AUDIO_MIXER_SAMP_RATES_STRUCT_SIZE(num));
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
323 if (!sr)
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
324 return 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
325 sr->type = AUDIO_PLAY;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
326 sr->flags = 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
327 sr->num_samp_rates = num;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
328 if (ioctl(dev, AUDIO_MIXER_GET_SAMPLE_RATES, sr)) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
329 free(sr);
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
330 return 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
331 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
332 if (sr->num_samp_rates <= num)
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
333 break;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
334 free(sr);
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
335 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
336
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
337 if (sr->flags & MIXER_SR_LIMITS) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
338 /*
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
339 * HW can playback any rate between
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
340 * sr->samp_rates[0] .. sr->samp_rates[1]
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
341 */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
342 max_rate = sr->samp_rates[1];
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
343 } else {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
344 /* HW supports fixed sample rates only */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
345 max_rate = 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
346 for (i = 0; i < sr->num_samp_rates; i++) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
347 if (sr->samp_rates[i] > max_rate)
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
348 max_rate = sr->samp_rates[i];
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
349 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
350 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
351 free(sr);
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
352 return max_rate;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
353
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
354 #else /* old audioio driver, cannot return list of supported rates */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
355 return 44100; /* should be supported even on old ISA SB cards */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
356 #endif
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
357 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
358
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
359
7378
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
360 static void setup_device_paths()
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
361 {
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
362 if (audio_dev == NULL) {
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
363 if ((audio_dev = getenv("AUDIODEV")) == NULL)
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
364 audio_dev = "/dev/audio";
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
365 }
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
366
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
367 if (sun_mixer_device == NULL) {
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
368 if ((sun_mixer_device = mixer_device) == NULL || !sun_mixer_device[0]) {
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
369 sun_mixer_device = malloc(strlen(audio_dev) + 4);
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
370 strcpy(sun_mixer_device, audio_dev);
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
371 strcat(sun_mixer_device, "ctl");
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
372 }
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
373 }
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
374
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
375 if (ao_subdevice) audio_dev = ao_subdevice;
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
376 }
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
377
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
378 // to set/get/query special features/parameters
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
379 static int control(int cmd,int arg){
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
380 switch(cmd){
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
381 case AOCONTROL_SET_DEVICE:
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
382 audio_dev=(char*)arg;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
383 return CONTROL_OK;
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
384 case AOCONTROL_QUERY_FORMAT:
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
385 return CONTROL_TRUE;
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
386 case AOCONTROL_GET_VOLUME:
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
387 {
7656
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
388 int fd;
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
389
7378
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
390 if ( !sun_mixer_device ) /* control function is used before init? */
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
391 setup_device_paths();
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
392
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
393 fd=open( sun_mixer_device,O_RDONLY );
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
394 if ( fd != -1 )
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
395 {
4907
08f739d36ae0 Fix a few syntax errors compiling ao_sun.c
jkeil
parents: 4788
diff changeset
396 ao_control_vol_t *vol = (ao_control_vol_t *)arg;
7378
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
397 float volume;
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
398 struct audio_info info;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
399 ioctl( fd,AUDIO_GETINFO,&info);
7378
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
400 volume = info.play.gain * 100. / AUDIO_MAX_GAIN;
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
401 if ( info.play.balance == AUDIO_MID_BALANCE ) {
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
402 vol->right = vol->left = volume;
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
403 } else if ( info.play.balance < AUDIO_MID_BALANCE ) {
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
404 vol->left = volume;
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
405 vol->right = volume * info.play.balance / AUDIO_MID_BALANCE;
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
406 } else {
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
407 vol->left = volume * (AUDIO_RIGHT_BALANCE-info.play.balance)
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
408 / AUDIO_MID_BALANCE;
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
409 vol->right = volume;
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
410 }
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
411 close( fd );
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
412 return CONTROL_OK;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
413 }
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
414 return CONTROL_ERROR;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
415 }
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
416 case AOCONTROL_SET_VOLUME:
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
417 {
4907
08f739d36ae0 Fix a few syntax errors compiling ao_sun.c
jkeil
parents: 4788
diff changeset
418 ao_control_vol_t *vol = (ao_control_vol_t *)arg;
7656
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
419 int fd;
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
420
7378
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
421 if ( !sun_mixer_device ) /* control function is used before init? */
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
422 setup_device_paths();
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
423
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
424 fd=open( sun_mixer_device,O_RDONLY );
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
425 if ( fd != -1 )
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
426 {
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
427 struct audio_info info;
7378
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
428 float volume;
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
429 AUDIO_INITINFO(&info);
7378
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
430 volume = vol->right > vol->left ? vol->right : vol->left;
7422
69d6da12bc30 *bsd doesn't have info.output_muted - patch by Bj¸«Órn Sandell <biorn@dce.chalmers.se>
arpi
parents: 7379
diff changeset
431 if ( volume != 0 ) {
7379
7b3c73a0c2dd Reconstruct the muting state for the playback from a l/r volume of 0.0.
jkeil
parents: 7378
diff changeset
432 info.play.gain = volume * AUDIO_MAX_GAIN / 100;
7b3c73a0c2dd Reconstruct the muting state for the playback from a l/r volume of 0.0.
jkeil
parents: 7378
diff changeset
433 if ( vol->right == vol->left )
7b3c73a0c2dd Reconstruct the muting state for the playback from a l/r volume of 0.0.
jkeil
parents: 7378
diff changeset
434 info.play.balance = AUDIO_MID_BALANCE;
7b3c73a0c2dd Reconstruct the muting state for the playback from a l/r volume of 0.0.
jkeil
parents: 7378
diff changeset
435 else
7b3c73a0c2dd Reconstruct the muting state for the playback from a l/r volume of 0.0.
jkeil
parents: 7378
diff changeset
436 info.play.balance = (vol->right - vol->left + volume) * AUDIO_RIGHT_BALANCE / (2*volume);
7b3c73a0c2dd Reconstruct the muting state for the playback from a l/r volume of 0.0.
jkeil
parents: 7378
diff changeset
437 }
7422
69d6da12bc30 *bsd doesn't have info.output_muted - patch by Bj¸«Órn Sandell <biorn@dce.chalmers.se>
arpi
parents: 7379
diff changeset
438 #if !defined (__OpenBSD__) && !defined (__NetBSD__)
69d6da12bc30 *bsd doesn't have info.output_muted - patch by Bj¸«Órn Sandell <biorn@dce.chalmers.se>
arpi
parents: 7379
diff changeset
439 info.output_muted = (volume == 0);
69d6da12bc30 *bsd doesn't have info.output_muted - patch by Bj¸«Órn Sandell <biorn@dce.chalmers.se>
arpi
parents: 7379
diff changeset
440 #endif
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
441 ioctl( fd,AUDIO_SETINFO,&info );
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
442 close( fd );
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
443 return CONTROL_OK;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
444 }
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 3492
diff changeset
445 return CONTROL_ERROR;
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
446 }
4907
08f739d36ae0 Fix a few syntax errors compiling ao_sun.c
jkeil
parents: 4788
diff changeset
447 }
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
448 return CONTROL_UNKNOWN;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
449 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
450
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
451 // open & setup audio device
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
452 // return: 1=success 0=fail
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
453 static int init(int rate,int channels,int format,int flags){
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
454
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
455 audio_info_t info;
7656
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
456 int pass;
1807
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
457 int ok;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
458
7378
9fb2113b4869 - gui version of mplayer is using the audio 'control' function before(!) the
jkeil
parents: 6630
diff changeset
459 setup_device_paths();
1209
18539f68dd37 ao_subdevice support
arpi_esp
parents: 1196
diff changeset
460
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
461 if (enable_sample_timing == RTSC_UNKNOWN
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
462 && !getenv("AO_SUN_DISABLE_SAMPLE_TIMING")) {
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
463 enable_sample_timing = realtime_samplecounter_available(audio_dev);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
464 }
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
465
1456
8c57a5a3c645 printfs cleanup - moved to higher -v level or moved to stderr
arpi
parents: 1346
diff changeset
466 // printf("ao2: %d Hz %d chans %s [0x%X]\n",
8c57a5a3c645 printfs cleanup - moved to higher -v level or moved to stderr
arpi
parents: 1346
diff changeset
467 // rate,channels,audio_out_format_name(format),format);
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
468
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
469 audio_fd=open(audio_dev, O_WRONLY);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
470 if(audio_fd<0){
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
471 printf("Can't open audio device %s, %s -> nosound\n", audio_dev, strerror(errno));
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
472 return 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
473 }
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
474
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
475 ioctl(audio_fd, AUDIO_DRAIN, 0);
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
476
7656
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
477 for (ok = pass = 0; pass <= 5; pass++) { /* pass 6&7 not useful */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
478
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
479 AUDIO_INITINFO(&info);
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
480 info.play.encoding = oss2sunfmt(ao_data.format = format);
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
481 info.play.precision =
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
482 (format==AFMT_S16_LE || format==AFMT_S16_BE
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
483 ? AUDIO_PRECISION_16
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
484 : AUDIO_PRECISION_8);
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
485 info.play.channels = ao_data.channels = channels;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
486 info.play.sample_rate = ao_data.samplerate = rate;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
487
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
488 convert_u8_s8 = 0;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
489
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
490 if (pass & 1) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
491 /*
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
492 * on some sun audio drivers, 8-bit unsigned LINEAR8 encoding is
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
493 * not supported, but 8-bit signed encoding is.
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
494 *
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
495 * Try S8, and if it works, use our own U8->S8 conversion before
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
496 * sending the samples to the sound driver.
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
497 */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
498 if (info.play.encoding != AUDIO_ENCODING_LINEAR8)
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
499 continue;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
500 info.play.encoding = AUDIO_ENCODING_LINEAR;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
501 convert_u8_s8 = 1;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
502 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
503
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
504 if (pass & 2) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
505 /*
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
506 * on some sun audio drivers, only certain fixed sample rates are
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
507 * supported.
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
508 *
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
509 * In case the requested sample rate is very close to one of the
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
510 * supported rates, use the fixed supported rate instead.
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
511 */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
512 if (!(info.play.sample_rate =
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
513 find_close_samplerate_match(audio_fd, rate)))
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
514 continue;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
515
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
516 /*
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
517 * I'm not returning the correct sample rate in
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
518 * |ao_data.samplerate|, to avoid software resampling.
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
519 *
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
520 * ao_data.samplerate = info.play.sample_rate;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
521 */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
522 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
523
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
524 if (pass & 4) {
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
525 /* like "pass & 2", but use the highest supported sample rate */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
526 if (!(info.play.sample_rate
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
527 = ao_data.samplerate
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
528 = find_highest_samplerate(audio_fd)))
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
529 continue;
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
530 }
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
531
1807
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
532 ok = ioctl(audio_fd, AUDIO_SETINFO, &info) >= 0;
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
533 if (ok) {
7656
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
534 /* audio format accepted by audio driver */
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
535 break;
1807
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
536 }
7656
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
537
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
538 /*
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
539 * format not supported?
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
540 * retry with different encoding and/or sample rate
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
541 */
1807
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
542 }
7656
52009e5ef4fc Handle playback of sample rates not supported by the sun audio hardware.
jkeil
parents: 7422
diff changeset
543
1807
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
544 if (!ok) {
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
545 printf("audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate\n",
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
546 channels, audio_out_format_name(format), rate);
1807
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
547 return 0;
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
548 }
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
549
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
550 bytes_per_sample = channels * info.play.precision / 8;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
551 byte_per_sec = bytes_per_sample * rate;
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
552 ao_data.outburst = byte_per_sec > 100000 ? 16384 : 8192;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
553
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
554 #ifdef __not_used__
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
555 /*
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
556 * hmm, ao_data.buffersize is currently not used in this driver, do there's
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
557 * no need to measure it
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
558 */
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
559 if(ao_data.buffersize==-1){
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
560 // Measuring buffer size:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
561 void* data;
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
562 ao_data.buffersize=0;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
563 #ifdef HAVE_AUDIO_SELECT
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
564 data = malloc(ao_data.outburst);
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
565 memset(data, format==AFMT_U8 ? 0x80 : 0, ao_data.outburst);
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
566 while(ao_data.buffersize<0x40000){
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
567 fd_set rfds;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
568 struct timeval tv;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
569 FD_ZERO(&rfds); FD_SET(audio_fd,&rfds);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
570 tv.tv_sec=0; tv.tv_usec = 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
571 if(!select(audio_fd+1, NULL, &rfds, NULL, &tv)) break;
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
572 write(audio_fd,data,ao_data.outburst);
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
573 ao_data.buffersize+=ao_data.outburst;
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
574 }
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
575 free(data);
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
576 if(ao_data.buffersize==0){
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
577 printf("\n *** Your audio driver DOES NOT support select() ***\n");
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
578 printf("Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n");
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
579 return 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
580 }
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
581 #ifdef __svr4__
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
582 // remove the 0 bytes from the above ao_data.buffersize measurement from the
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
583 // audio driver's STREAMS queue
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
584 ioctl(audio_fd, I_FLUSH, FLUSHW);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
585 #endif
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
586 ioctl(audio_fd, AUDIO_DRAIN, 0);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
587 #endif
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
588 }
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
589 #endif /* __not_used__ */
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
590
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
591 AUDIO_INITINFO(&info);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
592 info.play.samples = 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
593 info.play.eof = 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
594 info.play.error = 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
595 ioctl (audio_fd, AUDIO_SETINFO, &info);
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
596
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
597 queued_bursts = 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
598 queued_samples = 0;
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
599
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
600 return 1;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
601 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
602
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
603 // close audio device
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
604 static void uninit(){
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
605 #ifdef __svr4__
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
606 // throw away buffered data in the audio driver's STREAMS queue
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
607 ioctl(audio_fd, I_FLUSH, FLUSHW);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
608 #endif
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
609 close(audio_fd);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
610 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
611
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
612 // stop playing and empty buffers (for seeking/pause)
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
613 static void reset(){
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
614 audio_info_t info;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
615
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
616 uninit();
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
617 audio_fd=open(audio_dev, O_WRONLY);
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
618 if(audio_fd<0){
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
619 printf("\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE (%s) ***\n", strerror(errno));
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
620 return;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
621 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
622
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
623 ioctl(audio_fd, AUDIO_DRAIN, 0);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
624
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
625 AUDIO_INITINFO(&info);
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
626 info.play.encoding = oss2sunfmt(ao_data.format);
1320
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
627 info.play.precision =
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
628 (ao_data.format==AFMT_S16_LE || ao_data.format==AFMT_S16_BE
1320
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
629 ? AUDIO_PRECISION_16
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
630 : AUDIO_PRECISION_8);
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
631 info.play.channels = ao_data.channels;
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
632 info.play.sample_rate = ao_data.samplerate;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
633 info.play.samples = 0;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
634 info.play.eof = 0;
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
635 info.play.error = 0;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
636 ioctl (audio_fd, AUDIO_SETINFO, &info);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
637 queued_bursts = 0;
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
638 queued_samples = 0;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
639 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
640
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
641 // stop playing, keep buffers (for pause)
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
642 static void audio_pause()
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
643 {
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
644 struct audio_info info;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
645 AUDIO_INITINFO(&info);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
646 info.play.pause = 1;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
647 ioctl(audio_fd, AUDIO_SETINFO, &info);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
648 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
649
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
650 // resume playing, after audio_pause()
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
651 static void audio_resume()
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
652 {
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
653 struct audio_info info;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
654 AUDIO_INITINFO(&info);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
655 info.play.pause = 0;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
656 ioctl(audio_fd, AUDIO_SETINFO, &info);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
657 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
658
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
659
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
660 // return: how many bytes can be played without blocking
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
661 static int get_space(){
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
662 audio_info_t info;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
663
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
664 // check buffer
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
665 #ifdef HAVE_AUDIO_SELECT
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
666 {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
667 fd_set rfds;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
668 struct timeval tv;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
669 FD_ZERO(&rfds);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
670 FD_SET(audio_fd, &rfds);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
671 tv.tv_sec = 0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
672 tv.tv_usec = 0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
673 if(!select(audio_fd+1, NULL, &rfds, NULL, &tv)) return 0; // not block!
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
674 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
675 #endif
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
676
6630
daf0d43ccde2 Patch to improve bufferhandling on OpenBSD and NetBSD, by Bj¸«Órn Sandell and Bernd Ernesti <mplayer at lists.veego.de>
atmos4
parents: 5893
diff changeset
677 #if !defined (__OpenBSD__) && !defined(__NetBSD__)
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
678 ioctl(audio_fd, AUDIO_GETINFO, &info);
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
679 if (queued_bursts - info.play.eof > 2)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
680 return 0;
5872
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents: 4907
diff changeset
681 #endif
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
682
6630
daf0d43ccde2 Patch to improve bufferhandling on OpenBSD and NetBSD, by Bj¸«Órn Sandell and Bernd Ernesti <mplayer at lists.veego.de>
atmos4
parents: 5893
diff changeset
683 #if defined(__NetBSD__) || defined(__OpenBSD__)
daf0d43ccde2 Patch to improve bufferhandling on OpenBSD and NetBSD, by Bj¸«Órn Sandell and Bernd Ernesti <mplayer at lists.veego.de>
atmos4
parents: 5893
diff changeset
684 ioctl(audio_fd, AUDIO_GETINFO, &info);
daf0d43ccde2 Patch to improve bufferhandling on OpenBSD and NetBSD, by Bj¸«Órn Sandell and Bernd Ernesti <mplayer at lists.veego.de>
atmos4
parents: 5893
diff changeset
685 return info.hiwat * info.blocksize - info.play.seek;
daf0d43ccde2 Patch to improve bufferhandling on OpenBSD and NetBSD, by Bj¸«Órn Sandell and Bernd Ernesti <mplayer at lists.veego.de>
atmos4
parents: 5893
diff changeset
686 #else
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
687 return ao_data.outburst;
6630
daf0d43ccde2 Patch to improve bufferhandling on OpenBSD and NetBSD, by Bj¸«Órn Sandell and Bernd Ernesti <mplayer at lists.veego.de>
atmos4
parents: 5893
diff changeset
688 #endif
daf0d43ccde2 Patch to improve bufferhandling on OpenBSD and NetBSD, by Bj¸«Órn Sandell and Bernd Ernesti <mplayer at lists.veego.de>
atmos4
parents: 5893
diff changeset
689
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
690 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
691
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
692 // plays 'len' bytes of 'data'
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
693 // it should round it down to outburst*n
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
694 // return: number of bytes played
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
695 static int play(void* data,int len,int flags){
1320
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
696 #if WORDS_BIGENDIAN
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
697 int native_endian = AFMT_S16_BE;
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
698 #else
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
699 int native_endian = AFMT_S16_LE;
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
700 #endif
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
701
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
702 if (len < ao_data.outburst) return 0;
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
703 len /= ao_data.outburst;
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
704 len *= ao_data.outburst;
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
705
1320
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
706 /* 16-bit format using the 'wrong' byteorder? swap words */
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
707 if ((ao_data.format == AFMT_S16_LE || ao_data.format == AFMT_S16_BE)
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
708 && ao_data.format != native_endian) {
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
709 static void *swab_buf;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
710 static int swab_len;
1320
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
711 if (len > swab_len) {
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
712 if (swab_buf)
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
713 swab_buf = realloc(swab_buf, len);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
714 else
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
715 swab_buf = malloc(len);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
716 swab_len = len;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
717 if (swab_buf == NULL) return 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
718 }
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
719 swab(data, swab_buf, len);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
720 data = swab_buf;
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
721 } else if (ao_data.format == AFMT_U8 && convert_u8_s8) {
1807
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
722 int i;
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
723 unsigned char *p = data;
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
724
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
725 for (i = 0, p = data; i < len; i++, p++)
6da3b9428ff0 Sun audiocs HW does not support AFMT_U8, try to use AFMT_S8 instead. If AFMT_S8
jkeil
parents: 1456
diff changeset
726 *p ^= 0x80;
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
727 }
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
728
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
729 len = write(audio_fd, data, len);
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
730 if(len > 0) {
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
731 queued_samples += len / bytes_per_sample;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
732 if (write(audio_fd,data,0) < 0)
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
733 perror("ao_sun: send EOF audio record");
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
734 else
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
735 queued_bursts ++;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
736 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
737 return len;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
738 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
739
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
740
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
741 // return: delay in seconds between first and last sample in buffer
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
742 static float get_delay(){
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
743 audio_info_t info;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
744 ioctl(audio_fd, AUDIO_GETINFO, &info);
6630
daf0d43ccde2 Patch to improve bufferhandling on OpenBSD and NetBSD, by Bj¸«Órn Sandell and Bernd Ernesti <mplayer at lists.veego.de>
atmos4
parents: 5893
diff changeset
745 #if defined (__OpenBSD__) || defined(__NetBSD__)
5872
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents: 4907
diff changeset
746 return (float) info.play.seek/ (float)byte_per_sec ;
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents: 4907
diff changeset
747 #else
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
748 if (info.play.samples && enable_sample_timing == RTSC_ENABLED)
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 1807
diff changeset
749 return (float)(queued_samples - info.play.samples) / (float)byte_per_sec;
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
750 else
3137
b9ee2d8d7279 Audio delay bugfix
anders
parents: 3095
diff changeset
751 return (float)((queued_bursts - info.play.eof) * ao_data.outburst) / (float)byte_per_sec;
5872
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents: 4907
diff changeset
752 #endif
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
753 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
754