Class: WahWah::Ogg::OpusTag
- Inherits:
-
Object
- Object
- WahWah::Ogg::OpusTag
- Includes:
- VorbisComment
- Defined in:
- lib/wahwah/ogg/opus_tag.rb
Constant Summary
Constants included from VorbisComment
VorbisComment::COMMET_FIELD_MAPPING
Instance Method Summary collapse
-
#initialize(identification_packet, comment_packet) ⇒ OpusTag
constructor
A new instance of OpusTag.
Methods included from VorbisComment
Constructor Details
#initialize(identification_packet, comment_packet) ⇒ OpusTag
Returns a new instance of OpusTag.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/wahwah/ogg/opus_tag.rb', line 10 def initialize(identification_packet, comment_packet) # Identification packet structure: # # 1) "OpusHead" # 2) [version] = read 8 bits as unsigned integer # 3) [audio_channels] = read 8 bit as unsigned integer # 4) [pre_skip] = read 16 bits as unsigned little endian integer # 5) [input_sample_rate] = read 32 bits as unsigned little endian integer # 6) [output_gain] = read 16 bits as unsigned little endian integer # 7) [channel_mapping_family] = read 8 bit as unsigned integer # 8) [channel_mapping_table] @sample_rate = 48000 @pre_skip = identification_packet[10..11].unpack1("v") comment_packet_id, comment_packet_body = [comment_packet[0..7], comment_packet[8..]] # Opus comment packet start with 'OpusTags' return unless comment_packet_id == "OpusTags" parse_vorbis_comment(comment_packet_body) end |