Class: LAME::Decoding::MPEGAudioFrameMatcher
- Inherits:
-
Object
- Object
- LAME::Decoding::MPEGAudioFrameMatcher
- Defined in:
- lib/lame/decoding/mpeg_audio_frame_matcher.rb
Overview
Specification is here: www.codeproject.com/Articles/8295/MPEG-Audio-Frame-Header
Also see ‘is_syncword_mp123` in lame-3.99.5/frontend/get_audio.c
Get ready for some bit-matching magic:
Constant Summary collapse
- CHANNEL_MODES =
[:stereo, :joint_stereo, :dual_channel, :mono]
Instance Attribute Summary collapse
-
#bytes ⇒ Object
readonly
Returns the value of attribute bytes.
Instance Method Summary collapse
-
#initialize(bytes) ⇒ MPEGAudioFrameMatcher
constructor
A new instance of MPEGAudioFrameMatcher.
- #match? ⇒ Boolean
Constructor Details
#initialize(bytes) ⇒ MPEGAudioFrameMatcher
Returns a new instance of MPEGAudioFrameMatcher.
16 17 18 |
# File 'lib/lame/decoding/mpeg_audio_frame_matcher.rb', line 16 def initialize(bytes) @bytes = bytes.unpack("C*") end |
Instance Attribute Details
#bytes ⇒ Object (readonly)
Returns the value of attribute bytes.
12 13 14 |
# File 'lib/lame/decoding/mpeg_audio_frame_matcher.rb', line 12 def bytes @bytes end |
Instance Method Details
#match? ⇒ Boolean
20 21 22 23 24 25 26 27 28 |
# File 'lib/lame/decoding/mpeg_audio_frame_matcher.rb', line 20 def match? leading_bits? && mpeg? && layer? && bitrate? && sample_frequency? && valid_mpeg1_layer2? && emphasis? end |