Class: FileData::MvhdBoxParser

Inherits:
Object
  • Object
show all
Defined in:
lib/file_data/formats/mpeg4/box_parsers/mvhd_box.rb

Overview

Parser for the ‘mvhd’ box

Class Method Summary collapse

Class Method Details

.parse(view) ⇒ Object



4
5
6
# 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) ⇒ Object



8
9
10
11
12
13
14
15
# 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