Class: LAME::Decoding::StreamDecoder

Inherits:
Object
  • Object
show all
Defined in:
lib/lame/decoding/stream_decoder.rb

Constant Summary collapse

DECODE_SIZE =

arbitrary, taken from get_audio.c#lame_decode_fromfile

1024

Instance Method Summary collapse

Constructor Details

#initialize(decode_flags, mp3_data, stream) ⇒ StreamDecoder

Returns a new instance of StreamDecoder.



8
9
10
11
# File 'lib/lame/decoding/stream_decoder.rb', line 8

def initialize(decode_flags, mp3_data, stream)
  @stream = stream
  @single_frame_decoder = SingleFrameDecoder.new(decode_flags, mp3_data)
end

Instance Method Details

#each_decoded_frame(&block) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/lame/decoding/stream_decoder.rb', line 13

def each_decoded_frame(&block)
  begin
    @data = @stream.read(DECODE_SIZE)

    decode &block
  end until end_of_stream?
end