Class: M4S::Layout::Atom

Inherits:
Object
  • Object
show all
Defined in:
lib/m4s/layout/atom.rb

Direct Known Subclasses

Ctts, Dinf, Elst, Ftyp, Hdlr, Mdat, Mdhd, Mfhd, Mvhd, Sidx, Stco, Stsc, Stsd, Stss, Stsz, Stts, Styp, Tfdt, Tfhd, Tkhd, Trex, Trun, VSmhd

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cache, opts = {}) ⇒ Atom

Returns a new instance of Atom.



9
10
11
12
13
14
# File 'lib/m4s/layout/atom.rb', line 9

def initialize(cache, opts = {})
  @cache = cache
  @track = opts.fetch(:track, nil)
  @track_id = track.fetch('track_id') if track
  @segment_index = opts.fetch(:segment_index, nil)
end

Instance Attribute Details

#cacheObject

Returns the value of attribute cache.



3
4
5
# File 'lib/m4s/layout/atom.rb', line 3

def cache
  @cache
end

#segment_indexObject

Returns the value of attribute segment_index.



3
4
5
# File 'lib/m4s/layout/atom.rb', line 3

def segment_index
  @segment_index
end

#trackObject

Returns the value of attribute track.



3
4
5
# File 'lib/m4s/layout/atom.rb', line 3

def track
  @track
end

#track_idObject

Returns the value of attribute track_id.



3
4
5
# File 'lib/m4s/layout/atom.rb', line 3

def track_id
  @track_id
end

Class Method Details

.generate(cache, opts = {}) ⇒ Object



5
6
7
# File 'lib/m4s/layout/atom.rb', line 5

def self.generate(cache, opts = {})
  new(cache, opts).generate
end

Instance Method Details

#generateObject



16
17
18
19
20
21
# File 'lib/m4s/layout/atom.rb', line 16

def generate
  [
    *header,
    binary_content,
  ].join
end