Class: QTRefMovie::QTDataReference
Overview
Data Reference Atom A data reference atom contains the information necessary to locate a movie, or a stream or file that QuickTime can play, typically in the form of a URL or a file alias.
Only one data reference atom is allowed in a given movie reference descriptor atom.
A data reference atom may contain the following information.
Size The number of bytes in this data reference atom.
Type The type of this atom; this field must be set to ‘rdrf’.
Flags A 32-bit integer containing flags. One flag is currently defined: movie is self-contained. If the least-significant bit is set to 1, the movie is self-contained. This requires that the parent movie contain a movie header atom as well as a reference movie atom. In other words, the current ‘moov’ atom must contain both a ‘rmra’ atom and a ‘mvhd’ atom. To resolve this data reference, an application uses the movie defined in the movie header atom, ignoring the remainder of the fields in this data reference atom, which are used only to specify external movies.
Data reference type The data reference type. A value of ‘alis’ indicates a file system alias record. A value of ‘url ’ indicates a string containing a uniform resource locator. Note that the fourth character in ‘url ’ is an ASCII blank (hex 20).
Data reference size The size of the data reference in bytes, expressed as a 32-bit integer.
Data reference A data reference to a QuickTime movie, or to a stream or file that QuickTime can play. If the reference type is ‘alis’ this field contains the contents of an AliasHandle. If the reference type is ‘url ’ this field contains a null-terminated string that can be interpreted as a URL. The URL can be absolute or relative, and can specify any protocol that QuickTime supports, including http://, ftp://, rtsp://, file:///, and data:.
Instance Method Summary collapse
-
#initialize(reference = nil) ⇒ QTDataReference
constructor
A new instance of QTDataReference.
- #set_reference(reference) ⇒ Object
- #size ⇒ Object
- #to_s ⇒ Object
Methods inherited from QTBase
Constructor Details
#initialize(reference = nil) ⇒ QTDataReference
Returns a new instance of QTDataReference.
300 301 302 303 304 305 306 307 308 |
# File 'lib/qtrefmovie.rb', line 300 def initialize( reference = nil ) super() @type = 'rdrf' @flag = 0 @ref_type = 'url ' @size = 0 @reference = '' set_reference(reference) unless reference.nil? end |
Instance Method Details
#set_reference(reference) ⇒ Object
310 311 312 313 |
# File 'lib/qtrefmovie.rb', line 310 def set_reference( reference ) @reference = reference @size = reference.length end |
#size ⇒ Object
315 316 317 |
# File 'lib/qtrefmovie.rb', line 315 def size @size + 5 * 4 end |
#to_s ⇒ Object
319 320 321 322 323 324 325 326 |
# File 'lib/qtrefmovie.rb', line 319 def to_s str = [size].pack('N') str += @type str += [@flag].pack('N') str += @ref_type str += [@size].pack('N') str += @reference end |