1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
$NetBSD: patch-ac,v 1.1.1.1 2004/01/26 13:03:38 jmmv Exp $
--- src/audio_out/audio_sun_out.c.orig 2003-07-13 19:29:04.000000000 +0000
+++ src/audio_out/audio_sun_out.c 2003-10-02 09:51:34.000000000 +0000
@@ -41,6 +41,11 @@
#ifdef __svr4__
#include <stropts.h>
#endif
+#include <sys/param.h>
+
+#if (defined(BSD) && BSD >= 199306)
+typedef unsigned uint_t;
+#endif
#include "xine_internal.h"
#include "xineutils.h"
@@ -89,7 +94,9 @@
uint32_t num_channels;
int bytes_per_frame;
+#ifndef __NetBSD__
uint32_t frames_in_buffer; /* number of frames writen to audio hardware */
+#endif
enum {
RTSC_UNKNOWN = 0,
@@ -113,12 +120,14 @@
unsigned buf_len;
#endif
+#ifndef __NetBSD__
#if SW_SAMPLE_COUNT
struct timeval tv0;
uint_t sample0;
#endif
uint_t last_samplecnt;
+#endif
} sun_driver_t;
@@ -128,6 +137,7 @@
*/
static int realtime_samplecounter_available(char *dev)
{
+#ifndef __NetBSD__
int fd = -1;
audio_info_t info;
int rtsc_ok = RTSC_DISABLED;
@@ -246,6 +256,9 @@
}
return rtsc_ok;
+#else
+ return RTSC_ENABLED;
+#endif
}
@@ -431,7 +444,9 @@
this->mode = mode;
this->input_sample_rate = rate;
+#ifndef __NetBSD__
this->frames_in_buffer = 0;
+#endif
/*
* open audio device
@@ -463,6 +478,9 @@
info.play.sample_rate = this->input_sample_rate;
info.play.eof = 0;
info.play.samples = 0;
+#ifdef __NetBSD__
+ info.blocksize = 1024;
+#endif
this->convert_u8_s8 = 0;
@@ -524,7 +542,9 @@
return 0;
}
+#ifndef __NetBSD__
this->last_samplecnt = 0;
+#endif
this->output_sample_rate = info.play.sample_rate;
this->num_channels = info.play.channels;
@@ -566,6 +586,7 @@
sun_driver_t *this = (sun_driver_t *) this_gen;
audio_info_t info;
+#ifndef __NetBSD__
if (ioctl(this->audio_fd, AUDIO_GETINFO, &info) == 0 &&
(this->frames_in_buffer == 0 || info.play.samples > 0)) {
@@ -611,6 +632,10 @@
}
#endif
}
+#else
+ if (ioctl(this->audio_fd, AUDIO_GETINFO, &info) == 0)
+ return info.play.seek / this->bytes_per_frame;
+#endif
return NOT_REAL_TIME;
}
@@ -719,7 +744,9 @@
if (num_written > 0) {
int buffered_samples;
+#ifndef __NetBSD__
this->frames_in_buffer += num_written / this->bytes_per_frame;
+#endif
/*
* Avoid storing too much data in the sound driver's buffers.
|