Sha256: a626a5ad85bc30385e5cbe5f7c5a0cd03cccd16d59905b80e0d3ad18e7f65070

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

module QuickTime
  # see ext/track.c for additional methods
  class Track
    # Returns the length of this track in seconds
    # using raw_duration and time_scale.
    def duration
      raw_duration.to_f/time_scale
    end
    
    # The average frame_rate for this track. May not be exact.
    def frame_rate # what about odd frame rates such as 29.97?
      frame_count/duration
    end
    
    # Returns true/false depending on if track is an audio track.
    def audio?
      media_type == :audio
    end
    
    # Returns true/false depending on if track is a video track.
    def video?
      media_type == :video
    end
    
    # Returns true/false depending on if track is a text track.
    def text?
      media_type == :text
    end
    
    # Returns the bounding width of this track in number of pixels.
    def width
      bounds[:right] - bounds[:left]
    end
    
    # Returns the bounding height of this track in number of pixels.
    def height
      bounds[:bottom] - bounds[:top]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rmov-0.1.6 lib/quicktime/track.rb
rmov-0.1.5 lib/quicktime/track.rb