Class: HLS::ApplicationVideo::Declaration

Inherits:
Data
  • Object
show all
Defined in:
lib/hls/application_video.rb

Overview

A class-level rendition declaration. Resolved against an input at instance time to a concrete Rendition.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bitrateObject (readonly)

Returns the value of attribute bitrate

Returns:

  • (Object)

    the current value of bitrate



47
48
49
# File 'lib/hls/application_video.rb', line 47

def bitrate
  @bitrate
end

#heightObject (readonly)

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



47
48
49
# File 'lib/hls/application_video.rb', line 47

def height
  @height
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



47
48
49
# File 'lib/hls/application_video.rb', line 47

def name
  @name
end

#scaleObject (readonly)

Returns the value of attribute scale

Returns:

  • (Object)

    the current value of scale



47
48
49
# File 'lib/hls/application_video.rb', line 47

def scale
  @scale
end

#widthObject (readonly)

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



47
48
49
# File 'lib/hls/application_video.rb', line 47

def width
  @width
end

Instance Method Details

#resolve(input:, bits_per_pixel:, max_bitrate_kbps:) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/hls/application_video.rb', line 50

def resolve(input:, bits_per_pixel:, max_bitrate_kbps:)
  if scaled?
    w = (input.width  * scale).floor
    h = (input.height * scale).floor
    Rendition.new(width: w, height: h, bitrate: estimate_bitrate(w, h, bits_per_pixel, max_bitrate_kbps))
  else
    Rendition.new(width: width, height: height, bitrate: bitrate)
  end
end

#scaled?Boolean

Returns:

  • (Boolean)


48
# File 'lib/hls/application_video.rb', line 48

def scaled? = !scale.nil?