Class: MP4::Parser::Moov

Inherits:
Object
  • Object
show all
Defined in:
lib/mp4/parser/moov.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bytes) ⇒ Moov

Returns a new instance of Moov.



11
12
13
14
# File 'lib/mp4/parser/moov.rb', line 11

def initialize(bytes)
  @bytes = bytes
  @tracks = []
end

Instance Attribute Details

#bytesObject (readonly)

Returns the value of attribute bytes.



3
4
5
# File 'lib/mp4/parser/moov.rb', line 3

def bytes
  @bytes
end

#mvhdObject (readonly)

Returns the value of attribute mvhd.



3
4
5
# File 'lib/mp4/parser/moov.rb', line 3

def mvhd
  @mvhd
end

#tracksObject (readonly)

Returns the value of attribute tracks.



3
4
5
# File 'lib/mp4/parser/moov.rb', line 3

def tracks
  @tracks
end

Class Method Details

.parse(bytes) ⇒ Object



5
6
7
8
9
# File 'lib/mp4/parser/moov.rb', line 5

def self.parse(bytes)
   = new(bytes)
  .parse
  
end

Instance Method Details

#parseObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/mp4/parser/moov.rb', line 16

def parse
  _header = bytes.read(8)

  until bytes.eof?
    box_size = BinData::Uint32be.read(bytes.read(4))
    box_type = bytes.read(4)
    box_bytes = StringIO.new(bytes.read(box_size - MP4::Constants::GENERIC_HEADER_SIZE))

    send("parse_#{box_type}", box_bytes)
  end
end

#parse_iods(_bytes) ⇒ Object



36
# File 'lib/mp4/parser/moov.rb', line 36

def parse_iods(_bytes); end

#parse_mvhd(bytes) ⇒ Object



28
29
30
# File 'lib/mp4/parser/moov.rb', line 28

def parse_mvhd(bytes)
  @mvhd = MP4::Binary::Mvhd.read(bytes).snapshot
end

#parse_trak(bytes) ⇒ Object



32
33
34
# File 'lib/mp4/parser/moov.rb', line 32

def parse_trak(bytes)
  @tracks << MP4::Parser::Track.parse(bytes)
end

#parse_udta(_bytes) ⇒ Object



38
# File 'lib/mp4/parser/moov.rb', line 38

def parse_udta(_bytes); end