Expand source code
class VideoSource:
def __init__(self, width: int, height: int) -> None:
req = proto_ffi.FfiRequest()
req.new_video_source.type = proto_video.VideoSourceType.VIDEO_SOURCE_NATIVE
req.new_video_source.resolution.width = width
req.new_video_source.resolution.height = height
resp = FfiClient.instance.request(req)
self._info = resp.new_video_source.source
self._ffi_handle = FfiHandle(self._info.handle.id)
def capture_frame(
self,
frame: VideoFrame,
*,
timestamp_us: int = 0,
rotation: proto_video.VideoRotation.ValueType = proto_video.VideoRotation.VIDEO_ROTATION_0,
) -> None:
req = proto_ffi.FfiRequest()
req.capture_video_frame.source_handle = self._ffi_handle.handle
req.capture_video_frame.buffer.CopyFrom(frame._proto_info())
req.capture_video_frame.rotation = rotation
req.capture_video_frame.timestamp_us = timestamp_us
FfiClient.instance.request(req)