Sha256: d66636798576346cdba7160225f44ae4de0239acc08cafae6acf837c86d3b140
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
require "forwardable" module Mkv2m4v class Track extend Forwardable attr_reader :info def_delegator :info, :stream_id, :id def_delegators :info, :format def initialize(track_info) @info = track_info end def language Iso639[info["language"]] end def title info["title"] end def format_description "#{format} (#{info.format_info}, #{info.codec_id})" end end class VideoTrack < Track def_delegators :info, :frame_size, :interlaced?, :fps, :width, :height def resolution "#{frame_size}#{interlaced? ? "i" : "p"}" end def print puts "Track #{id}: (video)" puts " Format: #{format_description}" puts " Resolution: #{resolution}" puts " FPS: #{fps}" puts " Language: #{language}" puts " Title: #{title}" end end class AudioTrack < Track def_delegators :info, :bit_rate def channel_count info.channels.to_s.chars.first.to_i end def bit_rate_kbps info.bit_rate.gsub(/\D/, "").to_i if info.bit_rate end def channel_description "#{channel_count} (#{info.channel_positions})" end def bit_rate_description "#{bit_rate_kbps}k (#{info.bit_rate_mode})" end def print puts "Track #{id}: (audio)" puts " Format: #{format_description}" puts " Channels: #{channel_description}" puts " Bit rate: #{bit_rate_description}" puts " Language: #{language}" puts " Title: #{title}" end end class TextTrack < Track def format_description "#{format} (#{info.codec_id})" end def print puts "Track #{id}: (text)" puts " Format: #{format_description}" puts " Language: #{language}" puts " Title: #{title}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mkv2m4v-0.1.2 | lib/mkv2m4v/track.rb |
mkv2m4v-0.1.1 | lib/mkv2m4v/track.rb |