icanhasaudio 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +5 -0
- data/README.txt +5 -5
- data/Rakefile +2 -2
- data/ext/decoder.c +26 -30
- data/ext/extconf.rb +4 -0
- data/ext/get_audio.c +0 -34
- data/ext/get_audio.h +0 -4
- data/ext/icanhasaudio.c +19 -2
- data/ext/rb_ogg.c +139 -0
- data/ext/rb_wav.c +51 -0
- data/ext/rb_wav.h +11 -0
- data/lib/icanhasaudio/mpeg.rb +12 -0
- data/lib/icanhasaudio/ogg.rb +21 -0
- metadata +15 -9
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
== DESCRIPTION. LULZ
|
6
6
|
|
7
7
|
Hai! icanhasaudio? is an interface to lame for decoding ur MP3s. I iz in ur
|
8
|
-
computer. Decodin ur mp3s.
|
8
|
+
computer. Decodin ur mp3s. Whatevs! I also decodin ur OGGz!
|
9
9
|
|
10
10
|
== SYNOPSYS ROFLOL
|
11
11
|
|
@@ -20,22 +20,22 @@ computer. Decodin ur mp3s.
|
|
20
20
|
|
21
21
|
Or even smaller:
|
22
22
|
|
23
|
-
reader = Audio::
|
23
|
+
reader = Audio::OGG::Decoder.new
|
24
24
|
reader.decode(File.open(ARGV[0], 'rb'), File.open(ARGV[1], 'wb'))
|
25
25
|
|
26
26
|
== PROBLEMS
|
27
27
|
|
28
|
-
Currently only decodes MP3 data. Plus many other problems....
|
28
|
+
Currently only decodes MP3/OGG data. Plus many other problems.... YMMV. LOL.
|
29
29
|
Not laugh plz!
|
30
30
|
|
31
31
|
== DEPENDENSEEZ
|
32
32
|
|
33
|
-
Make sure lame is installed on ur 'puter.
|
33
|
+
Make sure lame is installed on ur 'puter. Also ogg and vorbisfile!
|
34
34
|
|
35
35
|
== CREDITZ
|
36
36
|
|
37
37
|
Thanx Ryan for mah name! Also, most of this code was taken from the lame
|
38
|
-
front end. So thank you to the lame team!
|
38
|
+
front end. So thank you to the lame team! THX VORBIS!
|
39
39
|
|
40
40
|
== LICENSE
|
41
41
|
|
data/Rakefile
CHANGED
@@ -2,11 +2,11 @@ require 'hoe'
|
|
2
2
|
|
3
3
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "lib")
|
4
4
|
|
5
|
-
Hoe.new('icanhasaudio', '0.0.
|
5
|
+
Hoe.new('icanhasaudio', '0.0.2') do |p|
|
6
6
|
p.rubyforge_name = 'seattlerb'
|
7
7
|
p.author = 'Aaron Patterson'
|
8
8
|
p.email = 'aaronp@rubyforge.org'
|
9
|
-
p.summary = "icanhasaudio is a
|
9
|
+
p.summary = "icanhasaudio is a lame/vorbis wrapper for decoding ur mp3s and ur oggs."
|
10
10
|
p.description = p.paragraphs_of('README.txt', 3..6).join("\n\n")
|
11
11
|
p.url = p.paragraphs_of('README.txt', 1).first.strip
|
12
12
|
p.changes = p.paragraphs_of('History.txt', 0..2).join("\n\n")
|
data/ext/decoder.c
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
#include <ruby.h>
|
2
2
|
#include <lame/lame.h>
|
3
3
|
#include <assert.h>
|
4
|
-
#include
|
5
|
-
#include
|
4
|
+
#include <decoder.h>
|
5
|
+
#include <get_audio.h>
|
6
|
+
#include <rb_wav.h>
|
6
7
|
|
7
8
|
int
|
8
9
|
lame_decoder(VALUE self, VALUE infile, VALUE outf, mp3data_struct * mp3data)
|
@@ -14,20 +15,31 @@ lame_decoder(VALUE self, VALUE infile, VALUE outf, mp3data_struct * mp3data)
|
|
14
15
|
int i;
|
15
16
|
int tmp_num_channels;
|
16
17
|
int skip;
|
18
|
+
char headbuf[44];
|
19
|
+
VALUE raw;
|
20
|
+
|
21
|
+
raw = rb_iv_get(self, "@raw");
|
22
|
+
if(raw == Qnil) {
|
23
|
+
raw = Qfalse;
|
24
|
+
rb_iv_set(self, "@raw", Qfalse);
|
25
|
+
}
|
17
26
|
|
18
27
|
Data_Get_Struct(self, lame_global_flags, gfp);
|
19
28
|
tmp_num_channels = lame_get_num_channels( gfp );
|
20
29
|
|
21
30
|
skip = lame_get_encoder_delay(gfp)+528+1;
|
22
31
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
32
|
+
if(!raw) {
|
33
|
+
rb_iv_set(self, "@bits", INT2NUM(16));
|
34
|
+
prelim_header( self,
|
35
|
+
headbuf,
|
36
|
+
0x7FFFFFFF,
|
37
|
+
0,
|
38
|
+
tmp_num_channels,
|
39
|
+
lame_get_in_samplerate( gfp )
|
40
|
+
);
|
41
|
+
rb_funcall(outf, rb_intern("write"), 1, rb_str_new(headbuf, 44));
|
42
|
+
}
|
31
43
|
|
32
44
|
wavsize = -skip;
|
33
45
|
mp3data->totalframes = mp3data->nsamp / mp3data->framesize;
|
@@ -46,16 +58,7 @@ lame_decoder(VALUE self, VALUE infile, VALUE outf, mp3data_struct * mp3data)
|
|
46
58
|
|
47
59
|
skip -= (i = skip < iread ? skip : iread); /* 'i' samples are to skip in this frame */
|
48
60
|
|
49
|
-
//printf("Writing: %d\n", mp3data->framenum);
|
50
61
|
for (; i < iread; i++) {
|
51
|
-
/*
|
52
|
-
if ( disable_wav_header ) {
|
53
|
-
WriteFunction(outf, (char *) &Buffer[0][i], sizeof(short));
|
54
|
-
if (tmp_num_channels == 2)
|
55
|
-
WriteFunction(outf, (char *) &Buffer[1][i], sizeof(short));
|
56
|
-
}
|
57
|
-
else { */
|
58
|
-
|
59
62
|
/* Write the 0 channel */
|
60
63
|
BitBuffer16[bit_16_i] = Buffer[0][i] & 0xFF;
|
61
64
|
BitBuffer16[bit_16_i + 1] = ((Buffer[0][i] >> 8) & 0xFF);
|
@@ -67,13 +70,6 @@ lame_decoder(VALUE self, VALUE infile, VALUE outf, mp3data_struct * mp3data)
|
|
67
70
|
} else {
|
68
71
|
bit_16_i += 2;
|
69
72
|
}
|
70
|
-
|
71
|
-
/*
|
72
|
-
Write16BitsLowHigh(outf, Buffer[0][i]);
|
73
|
-
if (tmp_num_channels == 2)
|
74
|
-
Write16BitsLowHigh(outf, Buffer[1][i]);
|
75
|
-
*/
|
76
|
-
/* } */
|
77
73
|
}
|
78
74
|
rb_funcall(outf, rb_intern("write"), 1, rb_str_new(BitBuffer16, bit_16_i));
|
79
75
|
} while (iread);
|
@@ -90,16 +86,16 @@ lame_decoder(VALUE self, VALUE infile, VALUE outf, mp3data_struct * mp3data)
|
|
90
86
|
wavsize *= i;
|
91
87
|
}
|
92
88
|
|
93
|
-
if(rb_respond_to(outf, rb_intern("seek")) == Qtrue) {
|
89
|
+
if(!raw && rb_respond_to(outf, rb_intern("seek")) == Qtrue) {
|
94
90
|
rb_funcall( outf,
|
95
91
|
rb_intern("seek"),
|
96
92
|
2,
|
97
93
|
INT2NUM(0),
|
98
94
|
rb_const_get(rb_cIO, rb_intern("SEEK_SET")) );
|
99
|
-
WriteWaveHeader(outf, (int)wavsize, lame_get_in_samplerate(gfp),
|
100
|
-
tmp_num_channels, 16);
|
101
|
-
}
|
102
95
|
|
96
|
+
rewrite_header(headbuf, (int)wavsize);
|
97
|
+
rb_funcall(outf, rb_intern("write"), 1, rb_str_new(headbuf, 44));
|
98
|
+
}
|
103
99
|
return 0;
|
104
100
|
}
|
105
101
|
|
data/ext/extconf.rb
CHANGED
data/ext/get_audio.c
CHANGED
@@ -18,19 +18,6 @@ int
|
|
18
18
|
lame_decode_fromfile(VALUE file, short pcm_l[], short pcm_r[],
|
19
19
|
mp3data_struct * mp3data);
|
20
20
|
|
21
|
-
static void
|
22
|
-
Write16BitsLowHigh(VALUE file, int i) {
|
23
|
-
rb_funcall(file, rb_intern("putc"), 1, INT2NUM(i & 0xFF));
|
24
|
-
rb_funcall(file, rb_intern("putc"), 1, INT2NUM((i >> 8) & 0xFF));
|
25
|
-
}
|
26
|
-
|
27
|
-
void
|
28
|
-
Write32BitsLowHigh(VALUE fp, int i)
|
29
|
-
{
|
30
|
-
Write16BitsLowHigh(fp,(int)(i&0xffffL));
|
31
|
-
Write16BitsLowHigh(fp,(int)((i>>16)&0xffffL));
|
32
|
-
}
|
33
|
-
|
34
21
|
/*
|
35
22
|
get_audio16 - behave as the original get_audio function, with a limited
|
36
23
|
16 bit per sample output
|
@@ -143,27 +130,6 @@ read_samples_mp3(VALUE self, VALUE musicin,
|
|
143
130
|
}
|
144
131
|
|
145
132
|
|
146
|
-
void
|
147
|
-
WriteWaveHeader(VALUE fp, const int pcmbytes,
|
148
|
-
const int freq, const int channels, const int bits)
|
149
|
-
{
|
150
|
-
int bytes = (bits + 7) / 8;
|
151
|
-
|
152
|
-
/* quick and dirty, but documented */
|
153
|
-
rb_funcall(fp, rb_intern("write"), 1, rb_str_new2("RIFF"));
|
154
|
-
Write32BitsLowHigh(fp, pcmbytes + 44 - 8); /* length in bytes without header */
|
155
|
-
rb_funcall(fp, rb_intern("write"), 1, rb_str_new2("WAVEfmt "));
|
156
|
-
Write32BitsLowHigh(fp, 2 + 2 + 4 + 4 + 2 + 2); /* length of PCM format declaration area */
|
157
|
-
Write16BitsLowHigh(fp, 1); /* is PCM? */
|
158
|
-
Write16BitsLowHigh(fp, channels); /* number of channels */
|
159
|
-
Write32BitsLowHigh(fp, freq); /* sample frequency in [Hz] */
|
160
|
-
Write32BitsLowHigh(fp, freq * channels * bytes); /* bytes per second */
|
161
|
-
Write16BitsLowHigh(fp, channels * bytes); /* bytes per sample time */
|
162
|
-
Write16BitsLowHigh(fp, bits); /* bits per sample */
|
163
|
-
rb_funcall(fp, rb_intern("write"), 1, rb_str_new2("data"));
|
164
|
-
Write32BitsLowHigh(fp, pcmbytes); /* length in bytes of raw PCM data */
|
165
|
-
}
|
166
|
-
|
167
133
|
/*
|
168
134
|
For lame_decode_fromfile: return code
|
169
135
|
-1 error
|
data/ext/get_audio.h
CHANGED
data/ext/icanhasaudio.c
CHANGED
@@ -16,12 +16,22 @@
|
|
16
16
|
static VALUE rb_mAudio;
|
17
17
|
static VALUE rb_mMpeg;
|
18
18
|
static VALUE rb_cDecoder;
|
19
|
+
static VALUE rb_mOgg;
|
20
|
+
static VALUE rb_cOggDecoder;
|
19
21
|
|
20
22
|
static void reader_mark(lame_global_flags * lgf) {}
|
21
23
|
static void reader_free(lame_global_flags * gfp) {
|
22
24
|
lame_close(gfp);
|
23
25
|
}
|
24
26
|
|
27
|
+
/*
|
28
|
+
* call-seq:
|
29
|
+
* decoder.decode(input_io, output_io)
|
30
|
+
*
|
31
|
+
* Decode the input IO and write it to the output IO.
|
32
|
+
*/
|
33
|
+
VALUE method_ogg_decode(VALUE self, VALUE infile, VALUE outf);
|
34
|
+
|
25
35
|
/*
|
26
36
|
* call-seq:
|
27
37
|
* Audio::MPEG::Decoder.new
|
@@ -150,8 +160,12 @@ void Init_icanhasaudio() {
|
|
150
160
|
rb_mAudio = rb_define_module("Audio");
|
151
161
|
rb_mMpeg = rb_define_module_under(rb_mAudio, "MPEG");
|
152
162
|
rb_cDecoder = rb_define_class_under(rb_mMpeg, "Decoder", rb_cObject);
|
153
|
-
|
154
|
-
|
163
|
+
|
164
|
+
rb_mOgg = rb_define_module_under(rb_mAudio, "OGG");
|
165
|
+
rb_cOggDecoder = rb_define_class_under(rb_mOgg, "Decoder", rb_cObject);
|
166
|
+
|
167
|
+
/* VERSION = '0.0.2' */
|
168
|
+
rb_define_const(rb_cDecoder, "VERSION", rb_str_new2("0.0.2"));
|
155
169
|
rb_define_singleton_method(
|
156
170
|
rb_cDecoder,
|
157
171
|
"lame_version",
|
@@ -161,5 +175,8 @@ void Init_icanhasaudio() {
|
|
161
175
|
|
162
176
|
rb_define_alloc_func(rb_cDecoder, reader_allocate);
|
163
177
|
rb_define_method(rb_cDecoder, "decode", method_lame_decode, 2);
|
178
|
+
rb_define_method(rb_cOggDecoder, "decode", method_ogg_decode, 2);
|
179
|
+
rb_require("icanhasaudio/mpeg");
|
180
|
+
rb_require("icanhasaudio/ogg");
|
164
181
|
}
|
165
182
|
|
data/ext/rb_ogg.c
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include <ogg/ogg.h>
|
3
|
+
#include <vorbis/vorbisfile.h>
|
4
|
+
#include <rb_wav.h>
|
5
|
+
|
6
|
+
size_t rb_ogg_read(void *ptr, size_t size, size_t nmemb, void *datasource) {
|
7
|
+
VALUE file = (VALUE)datasource;
|
8
|
+
VALUE str;
|
9
|
+
size_t length;
|
10
|
+
|
11
|
+
str = rb_funcall(file, rb_intern("read"), 1, INT2NUM(size * nmemb));
|
12
|
+
if(str == Qnil) return 0;
|
13
|
+
|
14
|
+
length = NUM2INT(rb_funcall(str, rb_intern("length"), 0));
|
15
|
+
|
16
|
+
memcpy(ptr, StringValuePtr(str), length);
|
17
|
+
return length;
|
18
|
+
}
|
19
|
+
|
20
|
+
int rb_ogg_seek(void *datasource, ogg_int64_t offset, int whence) {
|
21
|
+
VALUE file = (VALUE)datasource;
|
22
|
+
if(rb_respond_to(file, rb_intern("seek")) == Qtrue) {
|
23
|
+
return NUM2INT(rb_funcall( file,
|
24
|
+
rb_intern("seek"),
|
25
|
+
2,
|
26
|
+
INT2NUM(offset),
|
27
|
+
INT2NUM(whence)));
|
28
|
+
}
|
29
|
+
return -1;
|
30
|
+
}
|
31
|
+
|
32
|
+
int rb_ogg_close(void *datasource) {
|
33
|
+
VALUE file = (VALUE)datasource;
|
34
|
+
rb_funcall(file, rb_intern("close"), 0);
|
35
|
+
return 0;
|
36
|
+
}
|
37
|
+
|
38
|
+
long rb_ogg_tell(void *datasource) {
|
39
|
+
VALUE file = (VALUE)datasource;
|
40
|
+
return NUM2LONG(rb_funcall(file, rb_intern("tell"), 0));
|
41
|
+
}
|
42
|
+
|
43
|
+
/*
|
44
|
+
* call-seq:
|
45
|
+
* decoder.decode(input_io, output_io)
|
46
|
+
*
|
47
|
+
* Decode the input IO and write it to the output IO.
|
48
|
+
*/
|
49
|
+
VALUE method_ogg_decode(VALUE self, VALUE infile, VALUE outf) {
|
50
|
+
OggVorbis_File vf;
|
51
|
+
ov_callbacks callbacks;
|
52
|
+
int bs = 0;
|
53
|
+
char buf[8192];
|
54
|
+
int buflen = 8192;
|
55
|
+
unsigned int written = 0;
|
56
|
+
int ret;
|
57
|
+
ogg_int64_t length = 0;
|
58
|
+
int seekable = 0;
|
59
|
+
VALUE raw;
|
60
|
+
char headbuf[44];
|
61
|
+
VALUE bits;
|
62
|
+
VALUE endian;
|
63
|
+
VALUE sign;
|
64
|
+
|
65
|
+
raw = rb_iv_get(self, "@raw");
|
66
|
+
if(raw == Qnil) {
|
67
|
+
raw = Qfalse;
|
68
|
+
rb_iv_set(self, "@raw", Qfalse);
|
69
|
+
}
|
70
|
+
|
71
|
+
bits = rb_iv_get(self, "@bits");
|
72
|
+
if(bits == Qnil) {
|
73
|
+
bits = INT2NUM(16);
|
74
|
+
rb_iv_set(self, "@bits", INT2NUM(16));
|
75
|
+
}
|
76
|
+
|
77
|
+
endian = rb_iv_get(self, "@endian");
|
78
|
+
if(endian == Qnil) {
|
79
|
+
rb_iv_set(self, "@endian", INT2NUM(0));
|
80
|
+
endian = INT2NUM(0);
|
81
|
+
}
|
82
|
+
|
83
|
+
sign = rb_iv_get(self, "@sign");
|
84
|
+
if(sign == Qnil) {
|
85
|
+
rb_iv_set(self, "@sign", INT2NUM(1));
|
86
|
+
sign = INT2NUM(1);
|
87
|
+
}
|
88
|
+
|
89
|
+
callbacks.read_func = rb_ogg_read;
|
90
|
+
callbacks.seek_func = rb_ogg_seek;
|
91
|
+
callbacks.close_func = rb_ogg_close;
|
92
|
+
callbacks.tell_func = rb_ogg_tell;
|
93
|
+
|
94
|
+
if(ov_open_callbacks((void *)infile, &vf, NULL, 0, callbacks) < 0) {
|
95
|
+
rb_raise(rb_eRuntimeError, "Failed to open input as vorbis.\n");
|
96
|
+
}
|
97
|
+
|
98
|
+
if(ov_seekable(&vf)) {
|
99
|
+
seekable = 1;
|
100
|
+
length = ov_pcm_total(&vf, 0);
|
101
|
+
}
|
102
|
+
|
103
|
+
if(!raw) {
|
104
|
+
prelim_header( self,
|
105
|
+
headbuf,
|
106
|
+
0x7fffffff,
|
107
|
+
length,
|
108
|
+
ov_info(&vf,0)->channels,
|
109
|
+
ov_info(&vf,0)->rate );
|
110
|
+
|
111
|
+
rb_funcall(outf, rb_intern("write"), 1, rb_str_new(headbuf, 44));
|
112
|
+
}
|
113
|
+
|
114
|
+
while((ret = ov_read(&vf, buf, buflen, NUM2INT(endian), NUM2INT(bits)/8, NUM2INT(sign), &bs)) != 0) {
|
115
|
+
if(bs !=0) {
|
116
|
+
rb_raise(rb_eRuntimeError,
|
117
|
+
"Only one logical bitstream currently supported.\n");
|
118
|
+
}
|
119
|
+
|
120
|
+
if(ret) {
|
121
|
+
rb_funcall(outf, rb_intern("write"), 1, rb_str_new(buf, ret));
|
122
|
+
written += ret;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
if(seekable && !raw) {
|
127
|
+
rewrite_header(headbuf, written);
|
128
|
+
rb_funcall( outf,
|
129
|
+
rb_intern("seek"),
|
130
|
+
2,
|
131
|
+
INT2NUM(0),
|
132
|
+
rb_const_get(rb_cIO, rb_intern("SEEK_SET")) );
|
133
|
+
rb_funcall(outf, rb_intern("write"), 1, rb_str_new(headbuf, 44));
|
134
|
+
}
|
135
|
+
|
136
|
+
ov_clear(&vf);
|
137
|
+
|
138
|
+
return Qnil;
|
139
|
+
}
|
data/ext/rb_wav.c
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include <rb_wav.h>
|
3
|
+
|
4
|
+
#define WRITE_U32(buf, x) *(buf) = (unsigned char)((x)&0xff);\
|
5
|
+
*((buf)+1) = (unsigned char)(((x)>>8)&0xff);\
|
6
|
+
*((buf)+2) = (unsigned char)(((x)>>16)&0xff);\
|
7
|
+
*((buf)+3) = (unsigned char)(((x)>>24)&0xff);
|
8
|
+
|
9
|
+
#define WRITE_U16(buf, x) *(buf) = (unsigned char)((x)&0xff);\
|
10
|
+
*((buf)+1) = (unsigned char)(((x)>>8)&0xff);
|
11
|
+
|
12
|
+
/* Some of this based on ao/src/ao_wav.c */
|
13
|
+
void prelim_header( VALUE self,
|
14
|
+
char *headbuf,
|
15
|
+
unsigned int size, /* 0x7fffffff */
|
16
|
+
ogg_int64_t knownlength,
|
17
|
+
int channels,
|
18
|
+
int samplerate
|
19
|
+
) {
|
20
|
+
VALUE bits = rb_iv_get(self, "@bits");
|
21
|
+
int bytespersec = channels*samplerate*NUM2INT(bits)/8;
|
22
|
+
int align = channels*NUM2INT(bits)/8;
|
23
|
+
int samplesize = NUM2INT(bits);
|
24
|
+
|
25
|
+
if(knownlength && knownlength*NUM2INT(bits)/8*channels < size)
|
26
|
+
size = (unsigned int)(knownlength*NUM2INT(bits)/8*channels+44) ;
|
27
|
+
|
28
|
+
memcpy(headbuf, "RIFF", 4);
|
29
|
+
WRITE_U32(headbuf+4, size-8);
|
30
|
+
memcpy(headbuf+8, "WAVE", 4);
|
31
|
+
memcpy(headbuf+12, "fmt ", 4);
|
32
|
+
WRITE_U32(headbuf+16, 16);
|
33
|
+
WRITE_U16(headbuf+20, 1); /* format */
|
34
|
+
WRITE_U16(headbuf+22, channels);
|
35
|
+
WRITE_U32(headbuf+24, samplerate);
|
36
|
+
WRITE_U32(headbuf+28, bytespersec);
|
37
|
+
WRITE_U16(headbuf+32, align);
|
38
|
+
WRITE_U16(headbuf+34, samplesize);
|
39
|
+
memcpy(headbuf+36, "data", 4);
|
40
|
+
WRITE_U32(headbuf+40, size - 44);
|
41
|
+
}
|
42
|
+
|
43
|
+
void rewrite_header(char *headbuf, unsigned int written)
|
44
|
+
{
|
45
|
+
unsigned int length = written;
|
46
|
+
|
47
|
+
length += 44;
|
48
|
+
|
49
|
+
WRITE_U32(headbuf+4, length-8);
|
50
|
+
WRITE_U32(headbuf+40, length-44);
|
51
|
+
}
|
data/ext/rb_wav.h
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#include <ogg/ogg.h>
|
2
|
+
#include <vorbis/vorbisfile.h>
|
3
|
+
|
4
|
+
void prelim_header( VALUE self,
|
5
|
+
char *headbuf,
|
6
|
+
unsigned int size, /* 0x7fffffff */
|
7
|
+
ogg_int64_t knownlength,
|
8
|
+
int channels,
|
9
|
+
int samplerate
|
10
|
+
);
|
11
|
+
void rewrite_header(char *headbuf, unsigned int written);
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Audio::OGG::Decoder
|
2
|
+
# Set to true for no WAV header
|
3
|
+
attr_accessor :raw
|
4
|
+
|
5
|
+
# Number of bits, 8 or 16
|
6
|
+
attr_accessor :bits
|
7
|
+
|
8
|
+
# Endianness
|
9
|
+
attr_accessor :endian
|
10
|
+
|
11
|
+
# Signedness
|
12
|
+
attr_accessor :sign
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@raw = false
|
16
|
+
@bits = 16
|
17
|
+
@endian = 0
|
18
|
+
@sign = 1
|
19
|
+
yield self if block_given?
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.0
|
3
3
|
specification_version: 1
|
4
4
|
name: icanhasaudio
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-07-
|
8
|
-
summary: icanhasaudio is a
|
6
|
+
version: 0.0.2
|
7
|
+
date: 2007-07-28 00:00:00 -07:00
|
8
|
+
summary: icanhasaudio is a lame/vorbis wrapper for decoding ur mp3s and ur oggs.
|
9
9
|
require_paths:
|
10
|
+
- lib
|
10
11
|
- ext
|
11
12
|
email: aaronp@rubyforge.org
|
12
13
|
homepage: http://seattlerb.rubyforge.org/
|
13
14
|
rubyforge_project: seattlerb
|
14
15
|
description: "Hai! icanhasaudio? is an interface to lame for decoding ur MP3s. I iz in ur
|
15
|
-
computer. Decodin ur mp3s.
|
16
|
-
Audio::MPEG::Decoder.new
|
17
|
-
File.open(ARGV[
|
18
|
-
}"
|
16
|
+
computer. Decodin ur mp3s. Whatevs! I also decodin ur OGGz! == SYNOPSYS
|
17
|
+
ROFLOL require 'icanhasaudio' reader = Audio::MPEG::Decoder.new
|
18
|
+
File.open(ARGV[0], 'rb') { |input_lol| File.open(ARGV[1], 'wb') { |output_lol|
|
19
|
+
reader.decode(input_lol, output_lol) } }"
|
19
20
|
autorequire:
|
20
21
|
default_executable:
|
21
22
|
bindir: bin
|
@@ -47,8 +48,13 @@ files:
|
|
47
48
|
- ext/get_audio.c
|
48
49
|
- ext/get_audio.h
|
49
50
|
- ext/icanhasaudio.c
|
51
|
+
- ext/rb_ogg.c
|
52
|
+
- ext/rb_wav.c
|
53
|
+
- ext/rb_wav.h
|
50
54
|
- ext/syncword.c
|
51
55
|
- ext/syncword.h
|
56
|
+
- lib/icanhasaudio/mpeg.rb
|
57
|
+
- lib/icanhasaudio/ogg.rb
|
52
58
|
test_files: []
|
53
59
|
rdoc_options:
|
54
60
|
- "--main"
|
@@ -71,5 +77,5 @@ dependencies:
|
|
71
77
|
-
|
72
78
|
- ">="
|
73
79
|
- !ruby/object:Gem::Version
|
74
|
-
version: 1.2.
|
80
|
+
version: 1.2.2
|
75
81
|
version:
|