Sha256: e2f8480e70a017c25db18be9b3043f75d7b669d12266d8d81dc6b1fa922246df

Contents?: true

Size: 626 Bytes

Versions: 3

Compression:

Stored size: 626 Bytes

Contents

class M3Uzi
  class Stream < Item

    attr_accessor :path, :bandwidth, :program_id, :codecs, :resolution

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

    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

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

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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
m3uzi-0.5.1 lib/m3uzi/stream.rb
m3uzi-0.5.0 lib/m3uzi/stream.rb
m3uzi-0.4.3 lib/m3uzi/stream.rb