Object
consume header and tag pages, return array of two hashes, info and tags
# File lib/ogg/codecs/vorbis.rb, line 11 def decode_headers(reader) init_pkt, tag_pkt, setup_pkt = reader.read_packets(3) info = extract_info(init_pkt) info[:tag], info[:tag_vendor] = unpack_comments(tag_pkt, "\0003vorbis") info end
# File lib/ogg/codecs/vorbis.rb, line 25 def extract_info(packet) vorbis_string, vorbis_version, channels, samplerate, upper_bitrate, nominal_bitrate, lower_bitrate = packet.unpack("a7VCV4") if nominal_bitrate == 0 if (upper_bitrate == 2**32 - 1) || (lower_bitrate == 2**32 - 1) nominal_bitrate = 0 else nominal_bitrate = ( upper_bitrate + lower_bitrate) / 2 end end return { :channels => channels, :samplerate => samplerate, :nominal_bitrate => nominal_bitrate } end
Generated with the Darkfish Rdoc Generator 2.