Class: FileData::MetaBoxParser
- Inherits:
-
Object
- Object
- FileData::MetaBoxParser
- Defined in:
- lib/file_data/formats/mpeg4/box_parsers/meta_box.rb
Overview
Parser for the ‘meta’ box
Class Method Summary collapse
- .get_creation_date(view, index) ⇒ Object
- .get_creation_key(view) ⇒ Object
- .get_ilst_boxes(view) ⇒ Object
- .parse(view) ⇒ Object
Class Method Details
.get_creation_date(view, index) ⇒ Object
27 28 29 30 |
# 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) ⇒ Object
19 20 21 22 23 24 25 |
# 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) ⇒ Object
32 33 34 35 36 37 38 |
# 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) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# 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 |