class FileData::Box
Mpeg4
box
Attributes
content_stream[R]
end_pos[R]
type[R]
Public Class Methods
new(type, content_stream)
click to toggle source
# File lib/file_data/formats/mpeg4/box.rb, line 8 def initialize(type, content_stream) @type = type @content_stream = content_stream @end_pos = @content_stream.end_pos end
parse(view)
click to toggle source
# File lib/file_data/formats/mpeg4/box.rb, line 14 def self.parse(view) type, pos, size = parse_header(view) new(type, Helpers::SubStreamView.new(view.stream, pos, size)) end
parse_header(view)
click to toggle source
# File lib/file_data/formats/mpeg4/box.rb, line 19 def self.parse_header(view) start_pos = view.pos first_field = view.read_value(4) type = view.read_ascii(4) total_size = if first_field == 1 view.read_value(8) else first_field end content_pos = view.pos header_size = content_pos - start_pos content_size = total_size - header_size [type, content_pos, content_size] end