Class: FormatParser::ISOBaseMediaFileFormat::Decoder

Inherits:
Object
  • Object
show all
Includes:
FormatParser::IOUtils
Defined in:
lib/parsers/iso_base_media_file_format/decoder.rb

Direct Known Subclasses

CR3Parser::Decoder, MOVParser::Decoder

Constant Summary

Constants included from FormatParser::IOUtils

FormatParser::IOUtils::INTEGER_DIRECTIVES

Instance Method Summary collapse

Methods included from FormatParser::IOUtils

#read_bytes, #read_fixed_point, #read_int, #safe_read, #safe_skip, #skip_bytes

Instance Method Details

#build_box_tree(max_read, io = nil) ⇒ Array<Box>

Attempt to build the ISOBMFF box tree represented in the given IO object.

Parameters:

Returns:

Raises:

  • (ArgumentError)


25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/parsers/iso_base_media_file_format/decoder.rb', line 25

def build_box_tree(max_read, io = nil)
  @buf = FormatParser::IOConstraint.new(io) if io
  raise ArgumentError, "IO missing - supply a valid IO object" unless @buf
  boxes = []
  max_pos = @buf.pos + max_read
  loop do
    break if @buf.pos >= max_pos
    box = parse_box
    break unless box
    boxes << box
  end
  boxes
end