Class: MP4::Layout::Atom

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

Direct Known Subclasses

Ctts, Dinf, Elst, Free, Ftyp, Hdlr, Mdat, Mdhd, Mvhd, Stco, Stsc, Stsd, Stss, Stsz, Stts, Tkhd, VSmhd

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Atom.



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

def initialize(cache, media_cache, opts = {})
  @cache = cache
  @media_cache = media_cache
  @track_id = opts.fetch(:track_id, nil)
end

Instance Attribute Details

#cacheObject

Returns the value of attribute cache.



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

def cache
  @cache
end

#media_cacheObject

Returns the value of attribute media_cache.



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

def media_cache
  @media_cache
end

#track_idObject

Returns the value of attribute track_id.



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

def track_id
  @track_id
end

Class Method Details

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



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

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

Instance Method Details

#generateObject



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

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