class FileData::MvhdBoxParser

Parser for the 'mvhd' box

Public Class Methods

parse(view) click to toggle source
# File lib/file_data/formats/mpeg4/box_parsers/mvhd_box.rb, line 4
def self.parse(view)
  MvhdBox.new(parse_mvhd_creation_date(view))
end
parse_mvhd_creation_date(view) click to toggle source
# File lib/file_data/formats/mpeg4/box_parsers/mvhd_box.rb, line 8
def self.parse_mvhd_creation_date(view)
  version = view.read_value(1)
  view.read_value(3) # Flags bytes

  creation_time = view.read_value(version == 1 ? 8 : 4)
  epoch_delta = 2_082_844_800
  Time.at(creation_time - epoch_delta)
end