fork/rust-sdks

git clone https://git.julia.blue/fork/rust-sdks

lukasIOUpdate protocol and add SendDataRequest nonce (#560)370d2ac

main
4.4 KiB191 linesraw
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 {
26  required uint64 track_handle = 1;
27  required VideoStreamType type = 2;
28  // Get the frame on a specific format
29  optional VideoBufferType format = 3;
30  optional 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 {
36  required uint64 participant_handle = 1;
37  required VideoStreamType type = 2;
38  required TrackSource track_source = 3;
39  optional VideoBufferType format = 4;
40  optional 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 { 
48  required VideoSourceType type = 1; 
49  // Used to determine which encodings to use + simulcast layers
50  // Most of the time it corresponds to the source resolution 
51  required VideoSourceResolution resolution = 2;
52}
53message NewVideoSourceResponse { required OwnedVideoSource source = 1; }
54
55// Push a frame to a VideoSource
56message CaptureVideoFrameRequest {
57  required uint64 source_handle = 1;
58  required VideoBufferInfo buffer = 2;
59  required int64 timestamp_us = 3; // In microseconds
60  required VideoRotation rotation = 4;
61}
62
63message CaptureVideoFrameResponse {}
64
65message VideoConvertRequest {
66  optional bool flip_y = 1;
67  required VideoBufferInfo buffer = 2;
68  required VideoBufferType dst_type = 3;
69}
70message VideoConvertResponse {
71  oneof message {
72    string error = 1;
73    OwnedVideoBuffer buffer = 2; 
74  }
75}
76
77//
78// VideoFrame buffers
79//
80
81message VideoResolution {
82  required uint32 width = 1;
83  required uint32 height = 2;
84  required double frame_rate = 3;
85}
86
87enum VideoCodec {
88  VP8 = 0;
89  H264 = 1;
90  AV1 = 2;
91  VP9 = 3;
92}
93
94enum VideoRotation {
95  VIDEO_ROTATION_0 = 0;
96  VIDEO_ROTATION_90 = 1;
97  VIDEO_ROTATION_180 = 2;
98  VIDEO_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 {
104  RGBA = 0;
105  ABGR = 1;
106  ARGB = 2;
107  BGRA = 3;
108  RGB24 = 4;
109  I420 = 5;
110  I420A = 6;
111  I422 = 7;
112  I444 = 8;
113  I010 = 9;
114  NV12 = 10;
115}
116
117message VideoBufferInfo {
118  message ComponentInfo {
119    required uint64 data_ptr = 1;
120    required uint32 stride = 2;
121    required uint32 size = 3;
122  }
123  required VideoBufferType type = 1;
124  required uint32 width = 2;
125  required uint32 height = 3;
126  required uint64 data_ptr = 4;
127  optional uint32 stride = 6; // only for packed formats
128  repeated ComponentInfo components = 7;
129}
130
131message OwnedVideoBuffer {
132  required FfiOwnedHandle handle = 1;
133  required VideoBufferInfo info = 2;
134}
135
136//
137// VideoStream
138//
139
140enum VideoStreamType {
141  VIDEO_STREAM_NATIVE = 0;
142  VIDEO_STREAM_WEBGL = 1;
143  VIDEO_STREAM_HTML = 2;
144}
145
146message VideoStreamInfo {
147  required VideoStreamType type = 1;
148}
149
150message OwnedVideoStream {
151  required FfiOwnedHandle handle = 1;
152  required VideoStreamInfo info = 2;
153}
154
155message VideoStreamEvent {
156  required uint64 stream_handle = 1;
157  oneof message { 
158    VideoFrameReceived frame_received = 2;
159    VideoStreamEOS eos = 3;
160  }
161}
162
163message VideoFrameReceived {
164  required OwnedVideoBuffer buffer = 1;
165  required int64 timestamp_us = 2; // In microseconds
166  required VideoRotation rotation = 3;
167}
168
169message VideoStreamEOS {}
170
171//
172// VideoSource
173//
174
175message VideoSourceResolution {
176  required uint32 width = 1;
177  required uint32 height = 2;
178}
179
180enum VideoSourceType {
181  VIDEO_SOURCE_NATIVE = 0;
182}
183
184message VideoSourceInfo {
185  required VideoSourceType type = 1;
186}
187
188message OwnedVideoSource {
189  required FfiOwnedHandle handle = 1;
190  required VideoSourceInfo info = 2;
191}