nabaztag_hack_kit 0.1.0.beta3 → 0.1.0.beta8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -2
- data/.gitmodules +3 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +17 -2
- data/LICENSE +21 -0
- data/README.md +115 -44
- data/Rakefile +2 -6
- data/bytecode/{Commands.md → _docs/commands.md} +0 -0
- data/bytecode/{Docs.md → _docs/grammar.md} +0 -0
- data/bytecode/_docs/grammar.pdf +0 -0
- data/bytecode/{src → _original}/README.md +0 -0
- data/bytecode/{src → _original}/lib/arp.mtl +0 -0
- data/bytecode/{src → _original}/lib/cfg.mtl +0 -0
- data/bytecode/{src → _original}/lib/choreos.mtl +0 -0
- data/bytecode/{src → _original}/lib/dhcp.mtl +0 -0
- data/bytecode/{src → _original}/lib/dns.mtl +0 -0
- data/bytecode/{src → _original}/lib/http.mtl +0 -0
- data/bytecode/{src → _original}/lib/tcp.mtl +0 -0
- data/bytecode/{src → _original}/lib/udp.mtl +0 -0
- data/bytecode/{src → _original}/lib/util.mtl +0 -0
- data/bytecode/{src → _original}/lib/var.mtl +0 -0
- data/bytecode/{src → _original}/lib/wav.mtl +0 -0
- data/bytecode/{src → _original}/lib/wifi.mtl +0 -0
- data/bytecode/{src → _original}/nominal-ping.mtl +0 -0
- data/bytecode/main.mtl +11 -11
- data/bytecode/test/test.mtl +8 -8
- data/examples/basic/Gemfile +1 -3
- data/examples/basic/config.ru +14 -4
- data/examples/record/Gemfile +0 -5
- data/examples/record/{config.ru.example → config.ru} +2 -2
- data/examples/record/server.rb +0 -2
- data/ext/Makefile +10 -0
- data/ext/bin/mtl_comp +29 -0
- data/{bytecode → ext}/bin/mtl_merge +0 -0
- data/ext/bin/mtl_simu +29 -0
- data/{bytecode/src/mtl → ext}/extconf.rb +0 -0
- data/ext/mtl_linux/.gitignore +7 -0
- data/ext/mtl_linux/LICENSE +21 -0
- data/ext/mtl_linux/Makefile +116 -0
- data/ext/mtl_linux/MetalC.project +196 -0
- data/ext/mtl_linux/conf.bin +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux}/conf.bin.sans_password +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux}/config.txt +0 -0
- data/ext/mtl_linux/inc/log.h +21 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/properties.h +0 -0
- data/{bytecode/src/mtl/linux_simuaudio.h → ext/mtl_linux/inc/simu/linux/simuaudio.h} +0 -0
- data/{bytecode/src/mtl/linux_simunet.h → ext/mtl_linux/inc/simu/linux/simunet.h} +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/simu/win}/simuaudio.h +18 -18
- data/{bytecode/src/mtl → ext/mtl_linux/inc/simu/win}/simunet.h +0 -0
- data/ext/mtl_linux/inc/vcomp/compiler.h +200 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/file.h +11 -11
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/filesystem.h +0 -0
- data/ext/mtl_linux/inc/vcomp/interpreter.h +121 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/memory.h +120 -92
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/param.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/parser.h +27 -27
- data/ext/mtl_linux/inc/vcomp/prodbuffer.h +42 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/resource.h +1 -1
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/terminal.h +8 -8
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/util.h +7 -7
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vaudio.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vbc.h +1 -1
- data/ext/mtl_linux/inc/vm/vbc_str.h +167 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vinterp.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vloader.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vlog.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vmem.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vnet.h +0 -0
- data/ext/mtl_linux/nominal.mtl +3959 -0
- data/ext/mtl_linux/src/comp/main.cpp +123 -0
- data/ext/mtl_linux/src/simu/dumpbc.c +2566 -0
- data/ext/mtl_linux/src/simu/linux/main.cpp +288 -0
- data/ext/mtl_linux/src/simu/linux/simu.c +309 -0
- data/ext/mtl_linux/src/simu/linux/simuaudio.c +44 -0
- data/ext/mtl_linux/src/simu/linux/simunet.c +707 -0
- data/ext/mtl_linux/src/simu/log.c +340 -0
- data/ext/mtl_linux/src/simu/properties.c +368 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/GTKANAL.H +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/LAYER3.C +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/TABINIT.C +0 -0
- data/ext/mtl_linux/src/simu/win/mp3/common.c +302 -0
- data/ext/mtl_linux/src/simu/win/mp3/dct64_i386.c +316 -0
- data/ext/mtl_linux/src/simu/win/mp3/decode_i386.c +160 -0
- data/ext/mtl_linux/src/simu/win/mp3/huffman.h +332 -0
- data/ext/mtl_linux/src/simu/win/mp3/interface.c +276 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/mpg123.h +34 -30
- data/ext/mtl_linux/src/simu/win/mp3/mpglib.h +47 -0
- data/ext/mtl_linux/src/simu/win/simu.c +819 -0
- data/ext/mtl_linux/src/simu/win/simuaudio.c +787 -0
- data/ext/mtl_linux/src/simu/win/simunet.c +489 -0
- data/ext/mtl_linux/src/vcomp/bootstrap.cpp +95 -0
- data/ext/mtl_linux/src/vcomp/compiler.cpp +587 -0
- data/ext/mtl_linux/src/vcomp/compiler_file.cpp +1253 -0
- data/ext/mtl_linux/src/vcomp/compiler_prog.cpp +437 -0
- data/ext/mtl_linux/src/vcomp/compiler_term.cpp +1500 -0
- data/ext/mtl_linux/src/vcomp/compiler_type.cpp +1238 -0
- data/ext/mtl_linux/src/vcomp/compiler_var.cpp +502 -0
- data/ext/mtl_linux/src/vcomp/file.cpp +100 -0
- data/ext/mtl_linux/src/vcomp/interpreter.cpp +93 -0
- data/ext/mtl_linux/src/vcomp/memory.cpp +313 -0
- data/ext/mtl_linux/src/vcomp/parser.cpp +584 -0
- data/ext/mtl_linux/src/vcomp/parser_xml.cpp +137 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src}/vcomp/prodbuffer.cpp +57 -36
- data/ext/mtl_linux/src/vcomp/stdlib_core.cpp +130 -0
- data/ext/mtl_linux/src/vcomp/terminal.cpp +80 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src}/vcomp/util.cpp +18 -11
- data/ext/mtl_linux/src/vm/vaudio.c +830 -0
- data/ext/mtl_linux/src/vm/vinterp.c +1780 -0
- data/ext/mtl_linux/src/vm/vloader.c +139 -0
- data/ext/mtl_linux/src/vm/vlog.c +782 -0
- data/ext/mtl_linux/src/vm/vmem.c +461 -0
- data/ext/mtl_linux/src/vm/vnet.c +298 -0
- data/{bytecode/src/mtl → ext/mtl_linux}/utils/correct_const.sh +0 -0
- data/lib/nabaztag_hack_kit/server.rb +4 -7
- data/lib/nabaztag_hack_kit/version.rb +1 -1
- data/lib/nabaztag_hack_kit.rb +2 -2
- data/nabaztag_hack_kit.gemspec +10 -11
- data/spec/integration/server_spec.rb +3 -3
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/message_spec.rb +12 -18
- data/spec/unit/server_spec.rb +13 -10
- metadata +145 -137
- data/bytecode/bin/mtl_comp +0 -50
- data/bytecode/bin/mtl_simu +0 -49
- data/bytecode/src/mtl/Makefile +0 -42
- data/bytecode/src/mtl/README.md +0 -13
- data/bytecode/src/mtl/bc.cpp +0 -1891
- data/bytecode/src/mtl/dumpbc.c +0 -2566
- data/bytecode/src/mtl/linux_simu.c +0 -271
- data/bytecode/src/mtl/linux_simuaudio.c +0 -16
- data/bytecode/src/mtl/linux_simunet.c +0 -620
- data/bytecode/src/mtl/log.c +0 -297
- data/bytecode/src/mtl/log.h +0 -20
- data/bytecode/src/mtl/main_compiler.cpp +0 -104
- data/bytecode/src/mtl/main_simu.cpp +0 -221
- data/bytecode/src/mtl/mp3/common.c +0 -265
- data/bytecode/src/mtl/mp3/dct64_i386.c +0 -316
- data/bytecode/src/mtl/mp3/decode_i386.c +0 -155
- data/bytecode/src/mtl/mp3/huffman.h +0 -332
- data/bytecode/src/mtl/mp3/interface.c +0 -258
- data/bytecode/src/mtl/mp3/mpglib.h +0 -44
- data/bytecode/src/mtl/properties.c +0 -293
- data/bytecode/src/mtl/simu.c +0 -750
- data/bytecode/src/mtl/simuaudio.c +0 -662
- data/bytecode/src/mtl/simunet.c +0 -400
- data/bytecode/src/mtl/vaudio.c +0 -677
- data/bytecode/src/mtl/vbc_str.h +0 -166
- data/bytecode/src/mtl/vcomp/Makefile +0 -29
- data/bytecode/src/mtl/vcomp/bootstrap.cpp +0 -89
- data/bytecode/src/mtl/vcomp/compiler.cpp +0 -470
- data/bytecode/src/mtl/vcomp/compiler.h +0 -200
- data/bytecode/src/mtl/vcomp/compiler_file.cpp +0 -929
- data/bytecode/src/mtl/vcomp/compiler_prog.cpp +0 -250
- data/bytecode/src/mtl/vcomp/compiler_term.cpp +0 -1053
- data/bytecode/src/mtl/vcomp/compiler_type.cpp +0 -872
- data/bytecode/src/mtl/vcomp/compiler_var.cpp +0 -289
- data/bytecode/src/mtl/vcomp/file.cpp +0 -79
- data/bytecode/src/mtl/vcomp/interpreter.cpp +0 -85
- data/bytecode/src/mtl/vcomp/interpreter.h +0 -121
- data/bytecode/src/mtl/vcomp/memory.cpp +0 -241
- data/bytecode/src/mtl/vcomp/parser.cpp +0 -427
- data/bytecode/src/mtl/vcomp/parser_xml.cpp +0 -124
- data/bytecode/src/mtl/vcomp/prodbuffer.h +0 -42
- data/bytecode/src/mtl/vcomp/stdlib_core.cpp +0 -122
- data/bytecode/src/mtl/vcomp/terminal.cpp +0 -73
- data/bytecode/src/mtl/vinterp.c +0 -1349
- data/bytecode/src/mtl/vloader.c +0 -127
- data/bytecode/src/mtl/vlog.c +0 -589
- data/bytecode/src/mtl/vmem.c +0 -424
- data/bytecode/src/mtl/vnet.c +0 -255
- data/examples/basic/Procfile +0 -2
- data/examples/basic/server.rb +0 -14
@@ -0,0 +1,276 @@
|
|
1
|
+
//#ifdef HAVEGTK
|
2
|
+
#include <stdlib.h>
|
3
|
+
#include <stdio.h>
|
4
|
+
|
5
|
+
#include "mpg123.h"
|
6
|
+
#include "mpglib.h"
|
7
|
+
|
8
|
+
|
9
|
+
/* Global mp .. it's a hack */
|
10
|
+
struct mpstr *gmp;
|
11
|
+
|
12
|
+
|
13
|
+
BOOL InitMP3(struct mpstr *mp)
|
14
|
+
{
|
15
|
+
memset(mp,0,sizeof(struct mpstr));
|
16
|
+
|
17
|
+
mp->framesize = 0;
|
18
|
+
mp->fsizeold = -1;
|
19
|
+
mp->bsize = 0;
|
20
|
+
mp->head = mp->tail = NULL;
|
21
|
+
mp->fr.single = -1;
|
22
|
+
mp->bsnum = 0;
|
23
|
+
mp->synth_bo = 1;
|
24
|
+
|
25
|
+
make_decode_tables(32767);
|
26
|
+
init_layer3(SBLIMIT);
|
27
|
+
|
28
|
+
return !0;
|
29
|
+
}
|
30
|
+
|
31
|
+
void ExitMP3(struct mpstr *mp)
|
32
|
+
{
|
33
|
+
struct buf *b,*bn;
|
34
|
+
|
35
|
+
b = mp->tail;
|
36
|
+
while(b)
|
37
|
+
{
|
38
|
+
free(b->pnt);
|
39
|
+
bn = b->next;
|
40
|
+
free(b);
|
41
|
+
b = bn;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
static struct buf *addbuf(struct mpstr *mp,char *buf,int size)
|
46
|
+
{
|
47
|
+
struct buf *nbuf;
|
48
|
+
|
49
|
+
nbuf = malloc( sizeof(struct buf) );
|
50
|
+
if(!nbuf)
|
51
|
+
{
|
52
|
+
fprintf(stderr,"Out of memory!\n");
|
53
|
+
return NULL;
|
54
|
+
}
|
55
|
+
nbuf->pnt = malloc(size);
|
56
|
+
if(!nbuf->pnt)
|
57
|
+
{
|
58
|
+
free(nbuf);
|
59
|
+
return NULL;
|
60
|
+
}
|
61
|
+
nbuf->size = size;
|
62
|
+
memcpy(nbuf->pnt,buf,size);
|
63
|
+
nbuf->next = NULL;
|
64
|
+
nbuf->prev = mp->head;
|
65
|
+
nbuf->pos = 0;
|
66
|
+
|
67
|
+
if(!mp->tail)
|
68
|
+
{
|
69
|
+
mp->tail = nbuf;
|
70
|
+
}
|
71
|
+
else
|
72
|
+
{
|
73
|
+
mp->head->next = nbuf;
|
74
|
+
}
|
75
|
+
|
76
|
+
mp->head = nbuf;
|
77
|
+
mp->bsize += size;
|
78
|
+
|
79
|
+
return nbuf;
|
80
|
+
}
|
81
|
+
|
82
|
+
static void remove_buf(struct mpstr *mp)
|
83
|
+
{
|
84
|
+
struct buf *buf = mp->tail;
|
85
|
+
|
86
|
+
mp->tail = buf->next;
|
87
|
+
if(mp->tail)
|
88
|
+
{
|
89
|
+
mp->tail->prev = NULL;
|
90
|
+
}
|
91
|
+
else
|
92
|
+
{
|
93
|
+
mp->tail = mp->head = NULL;
|
94
|
+
}
|
95
|
+
|
96
|
+
free(buf->pnt);
|
97
|
+
free(buf);
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
static int read_buf_byte(struct mpstr *mp)
|
102
|
+
{
|
103
|
+
unsigned int b;
|
104
|
+
|
105
|
+
int pos;
|
106
|
+
|
107
|
+
pos = mp->tail->pos;
|
108
|
+
while(pos >= mp->tail->size)
|
109
|
+
{
|
110
|
+
remove_buf(mp);
|
111
|
+
pos = mp->tail->pos;
|
112
|
+
if(!mp->tail)
|
113
|
+
{
|
114
|
+
fprintf(stderr,"Fatal error!\n");
|
115
|
+
// exit(1);
|
116
|
+
return 0;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
b = mp->tail->pnt[pos];
|
121
|
+
mp->bsize--;
|
122
|
+
mp->tail->pos++;
|
123
|
+
|
124
|
+
|
125
|
+
return b;
|
126
|
+
}
|
127
|
+
|
128
|
+
static void read_head(struct mpstr *mp)
|
129
|
+
{
|
130
|
+
unsigned long head;
|
131
|
+
|
132
|
+
mp->header<<=8;
|
133
|
+
head = read_buf_byte(mp);
|
134
|
+
mp->header+=(head&255);
|
135
|
+
|
136
|
+
/* head <<= 8;
|
137
|
+
head |= read_buf_byte(mp);
|
138
|
+
head <<= 8;
|
139
|
+
head |= read_buf_byte(mp);
|
140
|
+
head <<= 8;
|
141
|
+
head |= read_buf_byte(mp);
|
142
|
+
|
143
|
+
mp->header = head;
|
144
|
+
*/
|
145
|
+
}
|
146
|
+
|
147
|
+
int checkmp3header(head)
|
148
|
+
{
|
149
|
+
if (
|
150
|
+
((head & 0xffe00000) == 0xffe00000)
|
151
|
+
&&((head>>17)&3)
|
152
|
+
&&(((head>>12)&0xf) != 0xf)
|
153
|
+
&&(((head>>10)&0x3) != 0x3 )
|
154
|
+
&&((4-((head>>17)&3)) == 3)
|
155
|
+
)
|
156
|
+
{
|
157
|
+
return 1;
|
158
|
+
}
|
159
|
+
return 0;
|
160
|
+
}
|
161
|
+
|
162
|
+
int decodeMP3(struct mpstr *mp,char *in,int isize,char *out,int osize,int *done)
|
163
|
+
{
|
164
|
+
int len;
|
165
|
+
|
166
|
+
gmp = mp;
|
167
|
+
|
168
|
+
if(osize < 4608)
|
169
|
+
{
|
170
|
+
fprintf(stderr,"To less out space\n");
|
171
|
+
return MP3_ERR;
|
172
|
+
}
|
173
|
+
|
174
|
+
if(in)
|
175
|
+
{
|
176
|
+
if(addbuf(mp,in,isize) == NULL)
|
177
|
+
{
|
178
|
+
return MP3_ERR;
|
179
|
+
}
|
180
|
+
}
|
181
|
+
|
182
|
+
|
183
|
+
/* First decode header */
|
184
|
+
while(mp->framesize == 0)
|
185
|
+
{
|
186
|
+
if(mp->bsize < 1)
|
187
|
+
{
|
188
|
+
return MP3_NEED_MORE;
|
189
|
+
}
|
190
|
+
read_head(mp);
|
191
|
+
if ((checkmp3header(mp->header))&&(decode_header(&mp->fr,mp->header)==1))
|
192
|
+
{
|
193
|
+
mp->framesize = mp->fr.framesize;
|
194
|
+
}
|
195
|
+
}
|
196
|
+
/*
|
197
|
+
if(mp->framesize == 0)
|
198
|
+
{
|
199
|
+
if(mp->bsize < 4)
|
200
|
+
{
|
201
|
+
return MP3_NEED_MORE;
|
202
|
+
}
|
203
|
+
read_head(mp);
|
204
|
+
decode_header(&mp->fr,mp->header);
|
205
|
+
mp->framesize = mp->fr.framesize;
|
206
|
+
}
|
207
|
+
*/
|
208
|
+
/* printf(" fr.framesize = %i \n",mp->fr.framesize);
|
209
|
+
printf(" bsize = %i \n",mp->bsize);
|
210
|
+
*/
|
211
|
+
|
212
|
+
if(mp->fr.framesize > mp->bsize)
|
213
|
+
{
|
214
|
+
return MP3_NEED_MORE;
|
215
|
+
}
|
216
|
+
wordpointer = mp->bsspace[mp->bsnum] + 512;
|
217
|
+
mp->bsnum = (mp->bsnum + 1) & 0x1;
|
218
|
+
bitindex = 0;
|
219
|
+
|
220
|
+
len = 0;
|
221
|
+
while(len < mp->framesize)
|
222
|
+
{
|
223
|
+
int nlen;
|
224
|
+
int blen = mp->tail->size - mp->tail->pos;
|
225
|
+
if( (mp->framesize - len) <= blen)
|
226
|
+
{
|
227
|
+
nlen = mp->framesize-len;
|
228
|
+
}
|
229
|
+
else
|
230
|
+
{
|
231
|
+
nlen = blen;
|
232
|
+
}
|
233
|
+
memcpy(wordpointer+len,mp->tail->pnt+mp->tail->pos,nlen);
|
234
|
+
len += nlen;
|
235
|
+
mp->tail->pos += nlen;
|
236
|
+
mp->bsize -= nlen;
|
237
|
+
if(mp->tail->pos == mp->tail->size)
|
238
|
+
{
|
239
|
+
remove_buf(mp);
|
240
|
+
}
|
241
|
+
}
|
242
|
+
|
243
|
+
*done = 0;
|
244
|
+
if(mp->fr.error_protection)
|
245
|
+
{
|
246
|
+
getbits(16);
|
247
|
+
}
|
248
|
+
do_layer3(&mp->fr,(unsigned char *) out,done);
|
249
|
+
|
250
|
+
mp->fsizeold = mp->framesize;
|
251
|
+
mp->framesize = 0;
|
252
|
+
return MP3_OK;
|
253
|
+
}
|
254
|
+
|
255
|
+
int set_pointer(long backstep)
|
256
|
+
{
|
257
|
+
unsigned char *bsbufold;
|
258
|
+
if(gmp->fsizeold < 0 && backstep > 0)
|
259
|
+
{
|
260
|
+
fprintf(stderr,"Can't step back %ld!\n",backstep);
|
261
|
+
return MP3_ERR;
|
262
|
+
}
|
263
|
+
bsbufold = gmp->bsspace[gmp->bsnum] + 512;
|
264
|
+
wordpointer -= backstep;
|
265
|
+
if (backstep)
|
266
|
+
{
|
267
|
+
memcpy(wordpointer,bsbufold+gmp->fsizeold-backstep,backstep);
|
268
|
+
}
|
269
|
+
bitindex = 0;
|
270
|
+
return MP3_OK;
|
271
|
+
}
|
272
|
+
|
273
|
+
//#endif
|
274
|
+
|
275
|
+
|
276
|
+
|
@@ -59,7 +59,8 @@
|
|
59
59
|
|
60
60
|
extern int tabsel_123[2][3][16];
|
61
61
|
|
62
|
-
struct frame
|
62
|
+
struct frame
|
63
|
+
{
|
63
64
|
int stereo;
|
64
65
|
int jsbound;
|
65
66
|
int single;
|
@@ -80,11 +81,12 @@ struct frame {
|
|
80
81
|
int framesize; /* computed framesize */
|
81
82
|
};
|
82
83
|
|
83
|
-
struct parameter
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
struct parameter
|
85
|
+
{
|
86
|
+
int quiet; /* shut up! */
|
87
|
+
int tryresync; /* resync stream after error */
|
88
|
+
int verbose; /* verbose level */
|
89
|
+
int checkrange;
|
88
90
|
};
|
89
91
|
|
90
92
|
/* extern unsigned int get1bit(void); */
|
@@ -101,34 +103,36 @@ extern int decode_header(struct frame *fr,unsigned long newhead);
|
|
101
103
|
|
102
104
|
|
103
105
|
|
104
|
-
struct gr_info_s
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
106
|
+
struct gr_info_s
|
107
|
+
{
|
108
|
+
int scfsi;
|
109
|
+
unsigned part2_3_length;
|
110
|
+
unsigned big_values;
|
111
|
+
unsigned scalefac_compress;
|
112
|
+
unsigned block_type;
|
113
|
+
unsigned mixed_block_flag;
|
114
|
+
unsigned table_select[3];
|
115
|
+
unsigned subblock_gain[3];
|
116
|
+
unsigned maxband[3];
|
117
|
+
unsigned maxbandl;
|
118
|
+
unsigned maxb;
|
119
|
+
unsigned region1start;
|
120
|
+
unsigned region2start;
|
121
|
+
unsigned preflag;
|
122
|
+
unsigned scalefac_scale;
|
123
|
+
unsigned count1table_select;
|
124
|
+
real *full_gain[3];
|
125
|
+
real *pow2gain;
|
123
126
|
};
|
124
127
|
|
125
128
|
struct III_sideinfo
|
126
129
|
{
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
130
|
+
unsigned main_data_begin;
|
131
|
+
unsigned private_bits;
|
132
|
+
struct
|
133
|
+
{
|
134
|
+
struct gr_info_s gr[2];
|
135
|
+
} ch[2];
|
132
136
|
};
|
133
137
|
|
134
138
|
extern int synth_1to1 (real *,int,unsigned char *,int *);
|
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
struct buf
|
3
|
+
{
|
4
|
+
unsigned char *pnt;
|
5
|
+
long size;
|
6
|
+
long pos;
|
7
|
+
struct buf *next;
|
8
|
+
struct buf *prev;
|
9
|
+
};
|
10
|
+
|
11
|
+
struct framebuf
|
12
|
+
{
|
13
|
+
struct buf *buf;
|
14
|
+
long pos;
|
15
|
+
struct frame *next;
|
16
|
+
struct frame *prev;
|
17
|
+
};
|
18
|
+
|
19
|
+
struct mpstr
|
20
|
+
{
|
21
|
+
struct buf *head,*tail;
|
22
|
+
int bsize;
|
23
|
+
int framesize;
|
24
|
+
int fsizeold;
|
25
|
+
struct frame fr;
|
26
|
+
unsigned char bsspace[2][MAXFRAMESIZE+512]; /* MAXFRAMESIZE */
|
27
|
+
real hybrid_block[2][2][SBLIMIT*SSLIMIT];
|
28
|
+
int hybrid_blc[2];
|
29
|
+
unsigned long header;
|
30
|
+
int bsnum;
|
31
|
+
real synth_buffs[2][2][0x110];
|
32
|
+
int synth_bo;
|
33
|
+
|
34
|
+
};
|
35
|
+
|
36
|
+
#define BOOL int
|
37
|
+
|
38
|
+
#define MP3_ERR -1
|
39
|
+
#define MP3_OK 0
|
40
|
+
#define MP3_NEED_MORE 1
|
41
|
+
|
42
|
+
|
43
|
+
BOOL InitMP3(struct mpstr *mp);
|
44
|
+
int decodeMP3(struct mpstr *mp,char *inmemory,int inmemsize,
|
45
|
+
char *outmemory,int outmemsize,int *done);
|
46
|
+
void ExitMP3(struct mpstr *mp);
|
47
|
+
|