Class: QTRefMovie::QTCPUSpeed

Inherits:
QTBase
  • Object
show all
Defined in:
lib/qtrefmovie.rb

Overview

CPU Speed Atom A CPU speed atom specifies the minimum computing power needed to display a movie. QuickTime performs an internal test to determine the speed of the user’s computer.

This is not a simple measurement of clock speed-it is a measurement of performance for QuickTime-related operations. Speed is expressed as a relative value between 100 and 2^31, in multiples of 100.

Note: Typical scores might range from a minimum score of 100, which would describe a computer as slow as, or slower than, a 166 MHz Pentium or 120 MHz PowerPC, to a maximum score of 600 for a 500 MHz Pentium III or 400 MHz G4 PowerPC. A computer with a graphics accelerator and a Gigahertz clock speed might score as high as 1000. Future computers will score higher.

Applications should play the movie with the highest specified CPU speed that is less than or equal to the user’s speed. If the user’s speed is lower than any movie’s CPU speed, applications should play the movie with the lowest CPU speed requirement. The movie with the highest CPU speed is assumed to be the highest quality.

Only one CPU speed atom is allowed in a given reference movie descriptor atom.

A CPU speed atom may contain the following information.

Size The number of bytes in this CPU speed atom.

Type The type of this atom; this field must be set to ‘rmcs’.

Flags A 32-bit integer that is currently always 0.

CPU speed A relative ranking of required computer speed, expressed as a 32-bit integer divisible by 100, with larger numbers indicating higher speed.

Instance Method Summary collapse

Methods inherited from QTBase

#add_chunk

Constructor Details

#initialize(speed = nil) ⇒ QTCPUSpeed

Returns a new instance of QTCPUSpeed.



433
434
435
436
437
438
439
# File 'lib/qtrefmovie.rb', line 433

def initialize( speed = nil )
  super()
  @type = 'rmcs'
  @flag = 0
  @speed = 500
  set_speed(speed) unless speed.nil?
end

Instance Method Details

#set_speed(speed) ⇒ Object



449
450
451
# File 'lib/qtrefmovie.rb', line 449

def set_speed( speed )
  @speed = speeds[speed] || speed
end

#sizeObject



453
454
455
# File 'lib/qtrefmovie.rb', line 453

def size
  4 * 4
end

#speedsObject



441
442
443
444
445
446
447
# File 'lib/qtrefmovie.rb', line 441

def speeds
  { 'very slow' => 100,
    'slow'      => 300,
    'medium'    => 500,
    'fast'      => 700,
    'very fast' => 1000 }
end

#to_sObject



457
458
459
460
461
462
# File 'lib/qtrefmovie.rb', line 457

def to_s
  str =  [size].pack('N')
  str += @type
  str += [@flag].pack('N')
  str += [@speed].pack('N')
end