fork/rust-sdks
git clone https://git.julia.blue/fork/rust-sdks
370d2ac
main
1// Copyright 2023 LiveKit, Inc. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto2" ; 16 17package livekit . proto ; 18option csharp_namespace= "LiveKit.Proto" ; 19 20import "handle.proto" ; 21import "track.proto" ; 22 23// Create a new VideoStream 24// VideoStream is used to receive video frames from a track 25message NewVideoStreamRequest { 26required uint64 track_handle = 1 ; 27required VideoStreamType type = 2 ; 28// Get the frame on a specific format 29optional VideoBufferType format = 3 ; 30optional bool normalize_stride = 4 ; // if true, stride will be set to width/chroma_width 31} 32message NewVideoStreamResponse { required OwnedVideoStream stream = 1 ; } 33 34// Request a video stream from a participant 35message VideoStreamFromParticipantRequest { 36required uint64 participant_handle = 1 ; 37required VideoStreamType type = 2 ; 38required TrackSource track_source = 3 ; 39optional VideoBufferType format = 4 ; 40optional bool normalize_stride = 5 ; 41} 42 43message VideoStreamFromParticipantResponse { required OwnedVideoStream stream = 1 ;} 44 45// Create a new VideoSource 46// VideoSource is used to send video frame to a track 47message NewVideoSourceRequest { 48required VideoSourceType type = 1 ; 49// Used to determine which encodings to use + simulcast layers 50// Most of the time it corresponds to the source resolution 51required VideoSourceResolution resolution = 2 ; 52} 53message NewVideoSourceResponse { required OwnedVideoSource source = 1 ; } 54 55// Push a frame to a VideoSource 56message CaptureVideoFrameRequest { 57required uint64 source_handle = 1 ; 58required VideoBufferInfo buffer = 2 ; 59required int64 timestamp_us = 3 ; // In microseconds 60required VideoRotation rotation = 4 ; 61} 62 63message CaptureVideoFrameResponse {} 64 65message VideoConvertRequest { 66optional bool flip_y = 1 ; 67required VideoBufferInfo buffer = 2 ; 68required VideoBufferType dst_type = 3 ; 69} 70message VideoConvertResponse { 71oneof message { 72string error = 1 ; 73OwnedVideoBuffer buffer = 2 ; 74} 75} 76 77// 78// VideoFrame buffers 79// 80 81message VideoResolution { 82required uint32 width = 1 ; 83required uint32 height = 2 ; 84required double frame_rate = 3 ; 85} 86 87enum VideoCodec { 88VP8 = 0 ; 89H264 = 1 ; 90AV1 = 2 ; 91VP9 = 3 ; 92} 93 94enum VideoRotation { 95VIDEO_ROTATION_0 = 0 ; 96VIDEO_ROTATION_90 = 1 ; 97VIDEO_ROTATION_180 = 2 ; 98VIDEO_ROTATION_270 = 3 ; 99} 100 101// Values of this enum must not be changed 102// It is used to serialize a rtc.VideoFrame on Python 103enum VideoBufferType { 104RGBA = 0 ; 105ABGR = 1 ; 106ARGB = 2 ; 107BGRA = 3 ; 108RGB24 = 4 ; 109I420 = 5 ; 110I420A = 6 ; 111I422 = 7 ; 112I444 = 8 ; 113I010 = 9 ; 114NV12 = 10 ; 115} 116 117message VideoBufferInfo { 118message ComponentInfo { 119required uint64 data_ptr = 1 ; 120required uint32 stride = 2 ; 121required uint32 size = 3 ; 122} 123required VideoBufferType type = 1 ; 124required uint32 width = 2 ; 125required uint32 height = 3 ; 126required uint64 data_ptr = 4 ; 127optional uint32 stride = 6 ; // only for packed formats 128repeated ComponentInfo components = 7 ; 129} 130 131message OwnedVideoBuffer { 132required FfiOwnedHandle handle = 1 ; 133required VideoBufferInfo info = 2 ; 134} 135 136// 137// VideoStream 138// 139 140enum VideoStreamType { 141VIDEO_STREAM_NATIVE = 0 ; 142VIDEO_STREAM_WEBGL = 1 ; 143VIDEO_STREAM_HTML = 2 ; 144} 145 146message VideoStreamInfo { 147required VideoStreamType type = 1 ; 148} 149 150message OwnedVideoStream { 151required FfiOwnedHandle handle = 1 ; 152required VideoStreamInfo info = 2 ; 153} 154 155message VideoStreamEvent { 156required uint64 stream_handle = 1 ; 157oneof message { 158VideoFrameReceived frame_received = 2 ; 159VideoStreamEOS eos = 3 ; 160} 161} 162 163message VideoFrameReceived { 164required OwnedVideoBuffer buffer = 1 ; 165required int64 timestamp_us = 2 ; // In microseconds 166required VideoRotation rotation = 3 ; 167} 168 169message VideoStreamEOS {} 170 171// 172// VideoSource 173// 174 175message VideoSourceResolution { 176required uint32 width = 1 ; 177required uint32 height = 2 ; 178} 179 180enum VideoSourceType { 181VIDEO_SOURCE_NATIVE = 0 ; 182} 183 184message VideoSourceInfo { 185required VideoSourceType type = 1 ; 186} 187 188message OwnedVideoSource { 189required FfiOwnedHandle handle = 1 ; 190required VideoSourceInfo info = 2 ; 191}