Class: WebRTC::I420Buffer

Inherits:
Object
  • Object
show all
Defined in:
lib/webrtc/video_frame.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width:, height:, data_y: nil, data_u: nil, data_v: nil, stride_y: nil, stride_u: nil, stride_v: nil) ⇒ I420Buffer

Returns a new instance of I420Buffer.



8
9
10
11
12
13
14
15
16
17
# File 'lib/webrtc/video_frame.rb', line 8

def initialize(width:, height:, data_y: nil, data_u: nil, data_v: nil, stride_y: nil, stride_u: nil, stride_v: nil)
  @width = width
  @height = height
  @stride_y = stride_y || width
  @stride_u = stride_u || (width / 2)
  @stride_v = stride_v || (width / 2)
  @data_y = data_y || "\x00".b * (@stride_y * @height)
  @data_u = data_u || "\x80".b * (@stride_u * (@height / 2))
  @data_v = data_v || "\x80".b * (@stride_v * (@height / 2))
end

Instance Attribute Details

#data_uObject

Returns the value of attribute data_u.



6
7
8
# File 'lib/webrtc/video_frame.rb', line 6

def data_u
  @data_u
end

#data_vObject

Returns the value of attribute data_v.



6
7
8
# File 'lib/webrtc/video_frame.rb', line 6

def data_v
  @data_v
end

#data_yObject

Returns the value of attribute data_y.



6
7
8
# File 'lib/webrtc/video_frame.rb', line 6

def data_y
  @data_y
end

#heightObject (readonly)

Returns the value of attribute height.



5
6
7
# File 'lib/webrtc/video_frame.rb', line 5

def height
  @height
end

#stride_uObject (readonly)

Returns the value of attribute stride_u.



5
6
7
# File 'lib/webrtc/video_frame.rb', line 5

def stride_u
  @stride_u
end

#stride_vObject (readonly)

Returns the value of attribute stride_v.



5
6
7
# File 'lib/webrtc/video_frame.rb', line 5

def stride_v
  @stride_v
end

#stride_yObject (readonly)

Returns the value of attribute stride_y.



5
6
7
# File 'lib/webrtc/video_frame.rb', line 5

def stride_y
  @stride_y
end

#widthObject (readonly)

Returns the value of attribute width.



5
6
7
# File 'lib/webrtc/video_frame.rb', line 5

def width
  @width
end