class F4F

Attributes

boxes[R]

Public Class Methods

new(reader) click to toggle source
# File lib/glued/f4f.rb, line 6
def initialize(reader)
  @reader = reader
  @boxes = []

  # Scan for boxes in the stream see spec 1.3 F4V box format
  until (@reader.pos >= @reader.size) do
    box = next_box
    @boxes << box
    @reader.pos = box.pos + box.size
  end
end

Public Instance Methods

next_box() click to toggle source
# File lib/glued/f4f.rb, line 26
def next_box
  pos = @reader.pos
  size = @reader.int32
  type = @reader.fourCC
  size = @reader.int64 if size == 1 #For boxes over 4GB the size is moved here.

  header_size = @reader.pos-pos
  content_size = size - header_size

  F4FHeader.new(pos, size, type, @reader.pos, content_size)
end
ok?() click to toggle source
# File lib/glued/f4f.rb, line 18
def ok?
  # WARNING: There are rumours that "Some moronic servers add wrong
  # boxSize in header causing fragment verification to fail so we
  # have to fix the boxSize before processing the fragment."

  (@boxes[0].type == Bootstrap::AFRA && @boxes[1].type == Bootstrap::MOOF && @boxes[2].type == Bootstrap::MDAT)
end