Class: M3Uzi::Stream

Inherits:
Item
  • Object
show all
Defined in:
lib/m3uzi/stream.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bandwidthObject

Returns the value of attribute bandwidth.



4
5
6
# File 'lib/m3uzi/stream.rb', line 4

def bandwidth
  @bandwidth
end

#codecsObject

Returns the value of attribute codecs.



4
5
6
# File 'lib/m3uzi/stream.rb', line 4

def codecs
  @codecs
end

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/m3uzi/stream.rb', line 4

def path
  @path
end

#program_idObject

Returns the value of attribute program_id.



4
5
6
# File 'lib/m3uzi/stream.rb', line 4

def program_id
  @program_id
end

#resolutionObject

Returns the value of attribute resolution.



4
5
6
# File 'lib/m3uzi/stream.rb', line 4

def resolution
  @resolution
end

Instance Method Details

#attribute_stringObject

Unsupported tags: EXT-X-MEDIA, EXT-X-I-FRAME-STREAM-INF Unsupported attributes of EXT-X-STREAM-INF: AUDIO, VIDEO



9
10
11
12
13
14
15
16
# File 'lib/m3uzi/stream.rb', line 9

def attribute_string
  s = []
  s << "PROGRAM-ID=#{(program_id || 1).to_i}"
  s << "BANDWIDTH=#{bandwidth.to_i}"
  s << "CODECS=\"#{codecs}\"" if codecs
  s << "RESOLUTION=#{resolution}" if resolution
  s.join(',')
end

#formatObject



18
19
20
# File 'lib/m3uzi/stream.rb', line 18

def format
  "#EXT-X-STREAM-INF:#{attribute_string}\n#{path}"
end

#valid?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/m3uzi/stream.rb', line 22

def valid?
  !!(path && bandwidth)
end