Class: Mediainfo::AudioStream

Inherits:
Stream
  • Object
show all
Defined in:
lib/mediainfo.rb

Instance Attribute Summary

Attributes inherited from Stream

#parsed_response

Instance Method Summary collapse

Methods inherited from Stream

#[], #[]=, create, inherited, #initialize

Constructor Details

This class inherits a constructor from Mediainfo::Stream

Instance Method Details

#mono?Boolean

Returns:

  • (Boolean)


335
# File 'lib/mediainfo.rb', line 335

def mono?;   1 == channels; end

#sample_rateObject Also known as: sampling_rate



300
301
302
303
304
305
306
307
308
309
310
# File 'lib/mediainfo.rb', line 300

def sample_rate
  return unless rate = sampling_rate_before_type_cast
  number = rate.gsub(/[^\d.]+/, "").to_f
  number = case rate
  when /KHz/ then number * 1000
  when /Hz/  then number
  else
    raise "unhandled sample rate! please report bug!"
  end
  number.to_i
end

#stereo?Boolean

Returns:

  • (Boolean)


334
# File 'lib/mediainfo.rb', line 334

def stereo?; 2 == channels; end