annotate libao2/ao_sun.c @ 1422:d02e0dcaf077

libvo2 support
author arpi
date Mon, 30 Jul 2001 02:00:54 +0000
parents d6e6132bff35
children 8c57a5a3c645
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>
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
13 #ifdef __svr4__
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
14 #include <stropts.h>
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
15 #endif
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
16
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
17 #include "../config.h"
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
18
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
19 #include "audio_out.h"
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
20 #include "audio_out_internal.h"
1058
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
21 #include "afmt.h"
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
22
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
23 static ao_info_t info =
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
24 {
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
25 "Sun audio output",
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
26 "sun",
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
27 "jk@tools.de",
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
28 ""
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
29 };
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
30
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
31 LIBAO_EXTERN(sun)
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
32
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
33
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
34 /* These defines are missing on NetBSD */
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
35 #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
36 #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
37 #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
38 #endif
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
39 #ifndef AUDIO_CHANNELS_MONO
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
40 #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
41 #define AUDIO_CHANNELS_STEREO 2
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
42 #endif
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
43
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
44
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
45 // there are some globals:
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
46 // ao_samplerate
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
47 // ao_channels
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
48 // ao_format
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
49 // ao_bps
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
50 // ao_outburst
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
51 // ao_buffersize
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
52
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
53 static char *audio_dev = "/dev/audio";
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;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
57 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
58 static enum {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
59 RTSC_UNKNOWN = 0,
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
60 RTSC_ENABLED,
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
61 RTSC_DISABLED
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
62 } enable_sample_timing;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
63
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
64 extern int verbose;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
65
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
66
1058
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
67 // convert an OSS audio format specification into a sun audio encoding
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
68 static int oss2sunfmt(int oss_format)
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
69 {
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
70 switch (oss_format){
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
71 case AFMT_MU_LAW:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
72 return AUDIO_ENCODING_ULAW;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
73 case AFMT_A_LAW:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
74 return AUDIO_ENCODING_ALAW;
1320
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
75 case AFMT_S16_BE:
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
76 case AFMT_S16_LE:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
77 return AUDIO_ENCODING_LINEAR;
1346
d6e6132bff35 AUDIO_ENCODING_LINEAR8 format is not available on sunos 5.5. Format is
jkeil
parents: 1320
diff changeset
78 #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
79 case AFMT_U8:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
80 return AUDIO_ENCODING_LINEAR8;
1346
d6e6132bff35 AUDIO_ENCODING_LINEAR8 format is not available on sunos 5.5. Format is
jkeil
parents: 1320
diff changeset
81 #endif
1058
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
82 #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
83 case AFMT_IMA_ADPCM:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
84 return AUDIO_ENCODING_DVI;
1058
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
85 #endif
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
86 default:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
87 return AUDIO_ENCODING_NONE;
1058
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
88 }
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
89 }
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
90
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
91 // 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
92 // sample counter information
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
93 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
94 {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
95 int fd = -1;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
96 audio_info_t info;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
97 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
98 int len;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
99 void *silence = NULL;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
100 struct timeval start, end;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
101 struct timespec delay;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
102 int usec_delay;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
103 unsigned last_samplecnt;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
104 unsigned increment;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
105 unsigned min_increment;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
106
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
107 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
108 * 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
109 * 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
110 * "write" below.
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
111 */
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
112 silence = calloc(1, len);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
113 if (silence == NULL)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
114 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
115
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
116 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
117 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
118
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
119 AUDIO_INITINFO(&info);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
120 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
121 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
122 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
123 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
124 info.play.samples = 0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
125 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
126 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
127 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
128 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
129 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
130
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
131 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
132 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
133 printf("rtsc: write failed");
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
134 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
135 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
136
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
137 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
138 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
139 perror("rtsc: GETINFO1");
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
140 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
141 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
142
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
143 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
144 min_increment = ~0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
145
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
146 gettimeofday(&start, NULL);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
147 for (;;) {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
148 delay.tv_sec = 0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
149 delay.tv_nsec = 10000000;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
150 nanosleep(&delay, NULL);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
151 gettimeofday(&end, NULL);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
152 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
153 + 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
154
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
155 // 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
156 if (usec_delay > 200000)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
157 break;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
158
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
159 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
160 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
161 perror("rtsc: GETINFO2 failed");
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
162 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
163 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
164 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
165 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
166 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
167 goto error;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
168 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
169
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
170 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
171 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
172 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
173 if (increment < min_increment) {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
174 min_increment = increment;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
175 if (min_increment < 2000)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
176 break; // looks good
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
177 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
178 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
179 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
180 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
181
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
182 /*
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
183 * 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
184 * 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
185 * 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
186 * 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
187 * 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
188 * 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
189 * 16kbyte chunks.
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
190 */
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
191 if (min_increment < 2000)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
192 rtsc_ok = RTSC_ENABLED;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
193
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
194 if (verbose)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
195 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
196 "\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
197 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
198
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
199
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
200 error:
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
201 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
202 if (fd >= 0) {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
203 #ifdef __svr4__
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
204 // 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
205 // 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
206 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
207 #endif
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
208 //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
209 close(fd);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
210 }
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
211
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
212 return rtsc_ok;
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
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
215 // to set/get/query special features/parameters
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
216 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
217 switch(cmd){
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
218 case AOCONTROL_SET_DEVICE:
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
219 audio_dev=(char*)arg;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
220 return CONTROL_OK;
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
221 case AOCONTROL_QUERY_FORMAT:
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
222 return CONTROL_TRUE;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
223 }
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
224 return CONTROL_UNKNOWN;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
225 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
226
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
227 // open & setup audio device
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
228 // return: 1=success 0=fail
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
229 static int init(int rate,int channels,int format,int flags){
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
230
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
231 audio_info_t info;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
232 int byte_per_sec;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
233
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
234 if (ao_subdevice) audio_dev = ao_subdevice;
1209
18539f68dd37 ao_subdevice support
arpi_esp
parents: 1196
diff changeset
235
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
236 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
237 && !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
238 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
239 }
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
240
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
241 printf("ao2: %d Hz %d chans %s [0x%X]\n",
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
242 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
243
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
244 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
245 if(audio_fd<0){
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
246 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
247 return 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
248 }
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
249
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
250 ioctl(audio_fd, AUDIO_DRAIN, 0);
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
251
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
252 AUDIO_INITINFO(&info);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
253 info.play.encoding = oss2sunfmt(ao_format = format);
1320
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
254 info.play.precision =
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
255 (format==AFMT_S16_LE || format==AFMT_S16_BE
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
256 ? AUDIO_PRECISION_16
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
257 : AUDIO_PRECISION_8);
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
258 info.play.channels = ao_channels = channels;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
259 info.play.sample_rate = ao_samplerate = rate;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
260 if(ioctl (audio_fd, AUDIO_SETINFO, &info)<0)
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
261 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
262 channels, audio_out_format_name(format), rate);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
263 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
264 byte_per_sec = bytes_per_sample * rate;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
265 ao_outburst = byte_per_sec > 100000 ? 16384 : 8192;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
266
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
267 #ifdef __not_used__
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
268 /*
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
269 * hmm, ao_buffersize is currently not used in this driver, do there's
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
270 * no need to measure it
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
271 */
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
272 if(ao_buffersize==-1){
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
273 // Measuring buffer size:
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
274 void* data;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
275 ao_buffersize=0;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
276 #ifdef HAVE_AUDIO_SELECT
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
277 data = malloc(ao_outburst);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
278 memset(data, format==AFMT_U8 ? 0x80 : 0, ao_outburst);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
279 while(ao_buffersize<0x40000){
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
280 fd_set rfds;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
281 struct timeval tv;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
282 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
283 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
284 if(!select(audio_fd+1, NULL, &rfds, NULL, &tv)) break;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
285 write(audio_fd,data,ao_outburst);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
286 ao_buffersize+=ao_outburst;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
287 }
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
288 free(data);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
289 if(ao_buffersize==0){
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
290 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
291 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
292 return 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
293 }
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
294 #ifdef __svr4__
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
295 // remove the 0 bytes from the above ao_buffersize measurement from the
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
296 // audio driver's STREAMS queue
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
297 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
298 #endif
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
299 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
300 #endif
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
301 }
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
302 #endif /* __not_used__ */
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
303
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
304 AUDIO_INITINFO(&info);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
305 info.play.samples = 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
306 info.play.eof = 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
307 info.play.error = 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
308 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
309
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
310 queued_bursts = 0;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
311 queued_samples = 0;
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
312
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
313 return 1;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
314 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
315
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
316 // close audio device
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
317 static void uninit(){
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
318 #ifdef __svr4__
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
319 // 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
320 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
321 #endif
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
322 close(audio_fd);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
323 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
324
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
325 // stop playing and empty buffers (for seeking/pause)
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
326 static void reset(){
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
327 audio_info_t info;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
328
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
329 uninit();
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
330 audio_fd=open(audio_dev, O_WRONLY);
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
331 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
332 printf("\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE (%s) ***\n", strerror(errno));
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
333 return;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
334 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
335
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
336 ioctl(audio_fd, AUDIO_DRAIN, 0);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
337
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
338 AUDIO_INITINFO(&info);
1058
cab5ba9ffc6c fixed AFMT_ stuff (inclue afmt.h)
arpi_esp
parents: 1041
diff changeset
339 info.play.encoding = oss2sunfmt(ao_format);
1320
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
340 info.play.precision =
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
341 (ao_format==AFMT_S16_LE || ao_format==AFMT_S16_BE
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
342 ? AUDIO_PRECISION_16
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
343 : AUDIO_PRECISION_8);
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
344 info.play.channels = ao_channels;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
345 info.play.sample_rate = ao_samplerate;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
346 info.play.samples = 0;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
347 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
348 info.play.error = 0;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
349 ioctl (audio_fd, AUDIO_SETINFO, &info);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
350 queued_bursts = 0;
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
351 queued_samples = 0;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
352 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
353
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
354 // stop playing, keep buffers (for pause)
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
355 static void audio_pause()
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
356 {
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
357 struct audio_info info;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
358 AUDIO_INITINFO(&info);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
359 info.play.pause = 1;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
360 ioctl(audio_fd, AUDIO_SETINFO, &info);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
361 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
362
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
363 // resume playing, after audio_pause()
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
364 static void audio_resume()
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
365 {
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
366 struct audio_info info;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
367 AUDIO_INITINFO(&info);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
368 info.play.pause = 0;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
369 ioctl(audio_fd, AUDIO_SETINFO, &info);
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
370 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
371
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
372
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
373 // return: how many bytes can be played without blocking
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
374 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
375 int playsize = ao_outburst;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
376 audio_info_t info;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
377
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
378 // check buffer
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
379 #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
380 {
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
381 fd_set rfds;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
382 struct timeval tv;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
383 FD_ZERO(&rfds);
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
384 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
385 tv.tv_sec = 0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
386 tv.tv_usec = 0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
387 if(!select(audio_fd+1, NULL, &rfds, NULL, &tv)) return 0; // not block!
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
388 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
389 #endif
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
390
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
391 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
392 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
393 return 0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
394
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
395 return ao_outburst;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
396 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
397
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
398 // plays 'len' bytes of 'data'
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
399 // it should round it down to outburst*n
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
400 // return: number of bytes played
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
401 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
402 #if WORDS_BIGENDIAN
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
403 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
404 #else
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
405 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
406 #endif
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
407
1196
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
408 if (len < ao_outburst) return 0;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
409 len /= ao_outburst;
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
410 len *= ao_outburst;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
411
1320
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
412 /* 16-bit format using the 'wrong' byteorder? swap words */
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
413 if ((ao_format == AFMT_S16_LE || ao_format == AFMT_S16_BE)
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
414 && ao_format != native_endian) {
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
415 static void *swab_buf;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
416 static int swab_len;
1320
18374d49befa On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents: 1308
diff changeset
417 if (len > swab_len) {
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
418 if (swab_buf)
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
419 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
420 else
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
421 swab_buf = malloc(len);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
422 swab_len = len;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
423 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
424 }
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
425 swab(data, swab_buf, len);
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
426 data = swab_buf;
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
427 }
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
428
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
429 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
430 if(len > 0) {
1308
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
431 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
432 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
433 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
434 else
ffd63a75700c Support playback of AFMT_S16_LE audio data on a big endian machine
jkeil
parents: 1209
diff changeset
435 queued_bursts ++;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
436 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
437 return len;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
438 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
439
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
440
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
441 // return: how many unplayed bytes are in the buffer
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
442 static int get_delay(){
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
443 audio_info_t info;
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
444 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
445 if (info.play.samples && enable_sample_timing == RTSC_ENABLED)
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
446 return (queued_samples - info.play.samples) * bytes_per_sample;
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
447 else
fc51929ec8ea Applied patch by J¸«ärgen Keil (jk@tools.de), improves smoothness of video playback.
atmosfear
parents: 1058
diff changeset
448 return (queued_bursts - info.play.eof) * ao_outburst;
1041
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
449 }
4b3b2bf1c82b SUN-Solaris audio out
arpi_esp
parents:
diff changeset
450