Class: Audio::MPEG::Decoder
- Inherits:
-
Object
- Object
- Audio::MPEG::Decoder
- Defined in:
- ext/icanhasaudio.c,
lib/icanhasaudio/mpeg.rb
Constant Summary collapse
- VERSION =
VERSION = ‘0.0.2’
rb_str_new2("0.0.2")
Instance Attribute Summary collapse
-
#bitrate ⇒ Object
readonly
Returns the value of attribute bitrate.
-
#bits ⇒ Object
Number of bits, 8 or 16.
-
#framesize ⇒ Object
readonly
Returns the value of attribute framesize.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#mode_ext ⇒ Object
readonly
Returns the value of attribute mode_ext.
-
#samplerate ⇒ Object
readonly
Returns the value of attribute samplerate.
-
#stereo ⇒ Object
readonly
Returns the value of attribute stereo.
Class Method Summary collapse
-
.Audio::MPEG::Decoder.lame_version ⇒ Object
Returns the version of lame you are using.
Instance Method Summary collapse
-
#decode(input_io, output_io) ⇒ Object
Decode the input IO and write it to the output IO.
-
#initialize {|_self| ... } ⇒ Decoder
constructor
A new instance of Decoder.
Constructor Details
#initialize {|_self| ... } ⇒ Decoder
Returns a new instance of Decoder.
7 8 9 10 |
# File 'lib/icanhasaudio/mpeg.rb', line 7 def initialize @bits = 16 yield self if block_given? end |
Instance Attribute Details
#bitrate ⇒ Object (readonly)
Returns the value of attribute bitrate.
2 3 4 |
# File 'lib/icanhasaudio/mpeg.rb', line 2 def bitrate @bitrate end |
#bits ⇒ Object
Number of bits, 8 or 16
5 6 7 |
# File 'lib/icanhasaudio/mpeg.rb', line 5 def bits @bits end |
#framesize ⇒ Object (readonly)
Returns the value of attribute framesize.
2 3 4 |
# File 'lib/icanhasaudio/mpeg.rb', line 2 def framesize @framesize end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
2 3 4 |
# File 'lib/icanhasaudio/mpeg.rb', line 2 def mode @mode end |
#mode_ext ⇒ Object (readonly)
Returns the value of attribute mode_ext.
2 3 4 |
# File 'lib/icanhasaudio/mpeg.rb', line 2 def mode_ext @mode_ext end |
#samplerate ⇒ Object (readonly)
Returns the value of attribute samplerate.
2 3 4 |
# File 'lib/icanhasaudio/mpeg.rb', line 2 def samplerate @samplerate end |
#stereo ⇒ Object (readonly)
Returns the value of attribute stereo.
2 3 4 |
# File 'lib/icanhasaudio/mpeg.rb', line 2 def stereo @stereo end |
Class Method Details
.Audio::MPEG::Decoder.lame_version ⇒ Object
Returns the version of lame you are using.
61 62 63 64 |
# File 'ext/icanhasaudio.c', line 61 static VALUE method_lame_version(VALUE klass) { const char * version = get_lame_version(); return rb_str_new(version, strlen(version)); } |
Instance Method Details
#decode(input_io, output_io) ⇒ Object
Decode the input IO and write it to the output IO.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'ext/icanhasaudio.c', line 138
static VALUE method_lame_decode(VALUE self, VALUE file, VALUE outf) {
mp3data_struct mp3data;
lame_global_flags * gfp;
memset(&mp3data, 0, sizeof(mp3data_struct));
lame_decode_initfile(file, &mp3data);
Data_Get_Struct (self, lame_global_flags, gfp);
rb_iv_set(self, "@stereo", INT2NUM(mp3data.stereo));
rb_iv_set(self, "@samplerate", INT2NUM(mp3data.samplerate));
rb_iv_set(self, "@bitrate", INT2NUM(mp3data.bitrate));
rb_iv_set(self, "@mode", INT2NUM(mp3data.mode));
rb_iv_set(self, "@mode_ext", INT2NUM(mp3data.mode_ext));
rb_iv_set(self, "@framesize", INT2NUM(mp3data.framesize));
lame_decoder(self, file, outf, &mp3data);
return Qnil;
}
|