annotate src/alac/stream.c @ 3200:8da9787de69d

alsa-ng: More paranoid debugging.
author John Lindgren <john.lindgren@tds.net>
date Tue, 11 Aug 2009 10:34:26 -0400
parents 3134a0987162
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
56
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
1 /*
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
2 * ALAC (Apple Lossless Audio Codec) decoder
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
3 * Copyright (c) 2005 David Hammerton
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
4 * All rights reserved.
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
5 *
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
6 * Basic stream reading
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
7 *
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
8 * http://crazney.net/programs/itunes/alac.html
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
9 *
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
10 * Permission is hereby granted, free of charge, to any person
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
11 * obtaining a copy of this software and associated documentation
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
12 * files (the "Software"), to deal in the Software without
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
13 * restriction, including without limitation the rights to use,
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
14 * copy, modify, merge, publish, distribute, sublicense, and/or
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
15 * sell copies of the Software, and to permit persons to whom the
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
16 * Software is furnished to do so, subject to the following conditions:
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
17 *
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
18 * The above copyright notice and this permission notice shall be
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
19 * included in all copies or substantial portions of the Software.
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
20 *
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
28 * OTHER DEALINGS IN THE SOFTWARE.
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
29 *
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
30 */
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
31
330
74df3bd6f472 [svn] - portability fixes:
nenolod
parents: 57
diff changeset
32 #include "config.h"
56
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
33
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
34 #include <stdio.h>
330
74df3bd6f472 [svn] - portability fixes:
nenolod
parents: 57
diff changeset
35
74df3bd6f472 [svn] - portability fixes:
nenolod
parents: 57
diff changeset
36 #if HAVE_STDINT_H
74df3bd6f472 [svn] - portability fixes:
nenolod
parents: 57
diff changeset
37 # include <stdint.h>
74df3bd6f472 [svn] - portability fixes:
nenolod
parents: 57
diff changeset
38 #else
74df3bd6f472 [svn] - portability fixes:
nenolod
parents: 57
diff changeset
39 # if HAVE_INTTYPES_H
74df3bd6f472 [svn] - portability fixes:
nenolod
parents: 57
diff changeset
40 # include <inttypes.h>
74df3bd6f472 [svn] - portability fixes:
nenolod
parents: 57
diff changeset
41 # endif
74df3bd6f472 [svn] - portability fixes:
nenolod
parents: 57
diff changeset
42 #endif
74df3bd6f472 [svn] - portability fixes:
nenolod
parents: 57
diff changeset
43
56
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
44 #include <stdlib.h>
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
45 #include <errno.h>
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
46
2971
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2497
diff changeset
47 #include <audlegacy/plugin.h>
56
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
48
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
49 #include "stream.h"
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
50
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
51 #define _Swap32(v) do { \
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
52 v = (((v) & 0x000000FF) << 0x18) | \
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
53 (((v) & 0x0000FF00) << 0x08) | \
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
54 (((v) & 0x00FF0000) >> 0x08) | \
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
55 (((v) & 0xFF000000) >> 0x18); } while(0)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
56
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
57 #define _Swap16(v) do { \
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
58 v = (((v) & 0x00FF) << 0x08) | \
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
59 (((v) & 0xFF00) >> 0x08); } while (0)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
60
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
61 struct stream_tTAG {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
62 VFSFile *f;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
63 int bigendian;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
64 int eof;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
65 };
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
66
57
96901271d2e2 [svn] - fix crashing. works on my x64 box, static on bigendian (tested: x64-be, mips, ppc64)
nenolod
parents: 56
diff changeset
67 extern int host_bigendian;
96901271d2e2 [svn] - fix crashing. works on my x64 box, static on bigendian (tested: x64-be, mips, ppc64)
nenolod
parents: 56
diff changeset
68
56
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
69 void stream_read(stream_t *stream, size_t size, void *buf)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
70 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
71 size_t ret;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
72
1978
fa9f85cebade s/vfs_/aud_vfs_/g
William Pitcock <nenolod@atheme.org>
parents: 330
diff changeset
73 ret = aud_vfs_fread(buf, 4, size >> 2, stream->f) * 4;
fa9f85cebade s/vfs_/aud_vfs_/g
William Pitcock <nenolod@atheme.org>
parents: 330
diff changeset
74 ret += aud_vfs_fread((char*)buf + ret, 1, size - ret, stream->f);
56
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
75
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
76 if (ret == 0 && size != 0) stream->eof = 1;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
77 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
78
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
79 int32_t stream_read_int32(stream_t *stream)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
80 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
81 int32_t v;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
82 stream_read(stream, 4, &v);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
83 if ((stream->bigendian && !host_bigendian) ||
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
84 (!stream->bigendian && host_bigendian))
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
85 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
86 _Swap32(v);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
87 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
88 return v;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
89 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
90
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
91 uint32_t stream_read_uint32(stream_t *stream)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
92 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
93 uint32_t v;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
94 stream_read(stream, 4, &v);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
95 if ((stream->bigendian && !host_bigendian) ||
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
96 (!stream->bigendian && host_bigendian))
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
97 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
98 _Swap32(v);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
99 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
100 return v;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
101 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
102
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
103 int16_t stream_read_int16(stream_t *stream)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
104 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
105 int16_t v;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
106 stream_read(stream, 2, &v);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
107 if ((stream->bigendian && !host_bigendian) ||
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
108 (!stream->bigendian && host_bigendian))
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
109 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
110 _Swap16(v);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
111 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
112 return v;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
113 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
114
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
115 uint16_t stream_read_uint16(stream_t *stream)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
116 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
117 uint16_t v;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
118 stream_read(stream, 2, &v);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
119 if ((stream->bigendian && !host_bigendian) ||
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
120 (!stream->bigendian && host_bigendian))
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
121 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
122 _Swap16(v);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
123 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
124 return v;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
125 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
126
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
127 int8_t stream_read_int8(stream_t *stream)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
128 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
129 int8_t v;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
130 stream_read(stream, 1, &v);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
131 return v;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
132 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
133
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
134 uint8_t stream_read_uint8(stream_t *stream)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
135 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
136 uint8_t v;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
137 stream_read(stream, 1, &v);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
138 return v;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
139 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
140
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
141
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
142 void stream_skip(stream_t *stream, size_t skip)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
143 {
1978
fa9f85cebade s/vfs_/aud_vfs_/g
William Pitcock <nenolod@atheme.org>
parents: 330
diff changeset
144 if (aud_vfs_fseek(stream->f, (long)skip, SEEK_CUR) == 0) return;
56
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
145 if (errno == ESPIPE)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
146 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
147 char *buffer = malloc(skip);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
148 stream_read(stream, skip, buffer);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
149 free(buffer);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
150 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
151 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
152
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
153 int stream_eof(stream_t *stream)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
154 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
155 return stream->eof;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
156 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
157
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
158 long stream_tell(stream_t *stream)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
159 {
1978
fa9f85cebade s/vfs_/aud_vfs_/g
William Pitcock <nenolod@atheme.org>
parents: 330
diff changeset
160 return aud_vfs_ftell(stream->f); /* returns -1 on error */
56
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
161 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
162
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
163 int stream_setpos(stream_t *stream, long pos)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
164 {
1978
fa9f85cebade s/vfs_/aud_vfs_/g
William Pitcock <nenolod@atheme.org>
parents: 330
diff changeset
165 return aud_vfs_fseek(stream->f, pos, SEEK_SET);
56
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
166 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
167
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
168 stream_t *stream_create_file(VFSFile *file,
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
169 int bigendian)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
170 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
171 stream_t *new_stream;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
172
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
173 new_stream = (stream_t*)malloc(sizeof(stream_t));
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
174 new_stream->f = file;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
175 new_stream->bigendian = bigendian;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
176 new_stream->eof = 0;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
177
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
178 return new_stream;
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
179 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
180
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
181 void stream_destroy(stream_t *stream)
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
182 {
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
183 free(stream);
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
184 }
56c88eee9802 [svn] - experimental ALAC plugin -- don't use this, it crashes
nenolod
parents:
diff changeset
185