Sha256: e32f544ef92c1fbf501943efe15af4682aaf120f1743ab7ce97ebb2511ba4163
Contents?: true
Size: 865 Bytes
Versions: 5
Compression:
Stored size: 865 Bytes
Contents
require_relative '../../helpers/stream_view' module FileData # Mpeg4 box class Box attr_reader :type, :content_stream, :end_pos def initialize(type, content_stream) @type = type @content_stream = content_stream @end_pos = @content_stream.end_pos end def self.parse(view) type, pos, size = parse_header(view) new(type, Helpers::SubStreamView.new(view.stream, pos, size)) end 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 end end
Version data entries
5 entries across 5 versions & 1 rubygems