class FileData::MetaBoxParser

Parser for the 'meta' box

Public Class Methods

get_creation_date(view, index) click to toggle source
# File lib/file_data/formats/mpeg4/box_parsers/meta_box.rb, line 27
def self.get_creation_date(view, index)
  ilst_boxes = get_ilst_boxes(view)
  ilst_boxes.find { |x| x.index == index }
end
get_creation_key(view) click to toggle source
# File lib/file_data/formats/mpeg4/box_parsers/meta_box.rb, line 19
def self.get_creation_key(view)
  kb = BoxPath.get_path(view, 'keys')
  return nil if kb.nil?

  keys = KeysBoxParser.parse(kb.content_stream)
  keys.find { |key| key.value == 'com.apple.quicktime.creationdate' }
end
get_ilst_boxes(view) click to toggle source
# File lib/file_data/formats/mpeg4/box_parsers/meta_box.rb, line 32
def self.get_ilst_boxes(view)
  view.seek view.start_pos
  box = BoxPath.get_path(view, 'ilst')
  ilst_boxes = []
  ilst_boxes << IlstBoxParser.parse(box.content_stream) until box.content_stream.eof?
  ilst_boxes
end
parse(view) click to toggle source
# File lib/file_data/formats/mpeg4/box_parsers/meta_box.rb, line 9
def self.parse(view)
  creation_key = get_creation_key(view)
  return MetaBox.new(nil) if creation_key.nil?

  creation_date_data = get_creation_date(view, creation_key.index)
  return MetaBox.new(nil) if creation_date_data.nil?

  MetaBox.new(Time.parse(creation_date_data.data_box.value_text))
end