@desklink/host 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/NOTICE +23 -0
  2. package/README.md +107 -55
  3. package/bin/desklink-host.mjs +2 -2
  4. package/dist/bridge.d.ts +1 -0
  5. package/dist/bridge.d.ts.map +1 -1
  6. package/dist/bridge.js +12 -4
  7. package/dist/bridge.js.map +1 -1
  8. package/dist/engineProcess.d.ts.map +1 -1
  9. package/dist/engineProcess.js +1 -0
  10. package/dist/engineProcess.js.map +1 -1
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/keeper.d.ts +52 -0
  16. package/dist/keeper.d.ts.map +1 -0
  17. package/dist/keeper.js +101 -0
  18. package/dist/keeper.js.map +1 -0
  19. package/dist/protocol.d.ts +26 -0
  20. package/dist/protocol.d.ts.map +1 -1
  21. package/dist/protocol.js.map +1 -1
  22. package/dist/resolveEngine.d.ts +3 -3
  23. package/dist/resolveEngine.d.ts.map +1 -1
  24. package/dist/resolveEngine.js +24 -11
  25. package/dist/resolveEngine.js.map +1 -1
  26. package/docs/BOUNDARY.md +20 -8
  27. package/docs/PROTOCOL.md +347 -24
  28. package/engine/Cargo.lock +47 -1
  29. package/engine/Cargo.toml +13 -2
  30. package/engine/build.rs +28 -2
  31. package/engine/native/nvenc_shim.c +453 -0
  32. package/engine/native/vaapi_shim.c +727 -0
  33. package/engine/native/vpx_shim.c +54 -4
  34. package/engine/native/vt_shim.c +448 -0
  35. package/engine/src/capture.rs +75 -55
  36. package/engine/src/capture_mac.rs +24 -14
  37. package/engine/src/convert.rs +286 -61
  38. package/engine/src/encoder.rs +122 -13
  39. package/engine/src/h264.rs +188 -0
  40. package/engine/src/h264_nvenc.rs +308 -0
  41. package/engine/src/h264_openh264.rs +735 -0
  42. package/engine/src/h264_vaapi.rs +263 -0
  43. package/engine/src/h264_vt.rs +368 -0
  44. package/engine/src/keeper.rs +622 -0
  45. package/engine/src/mac.rs +9 -6
  46. package/engine/src/main.rs +64 -4
  47. package/engine/src/peer.rs +887 -42
  48. package/engine/src/protocol.rs +153 -4
  49. package/engine/src/session.rs +1547 -137
  50. package/engine/src/x11.rs +210 -9
  51. package/engine/src/x11_mac.rs +12 -0
  52. package/engine/vendor/libva/COPYING +19 -0
  53. package/engine/vendor/libva/va/va.h +5450 -0
  54. package/engine/vendor/libva/va/va_dec_av1.h +695 -0
  55. package/engine/vendor/libva/va/va_dec_hevc.h +616 -0
  56. package/engine/vendor/libva/va/va_dec_jpeg.h +157 -0
  57. package/engine/vendor/libva/va/va_dec_vp8.h +249 -0
  58. package/engine/vendor/libva/va/va_dec_vp9.h +312 -0
  59. package/engine/vendor/libva/va/va_dec_vvc.h +688 -0
  60. package/engine/vendor/libva/va/va_drm.h +61 -0
  61. package/engine/vendor/libva/va/va_enc_av1.h +1010 -0
  62. package/engine/vendor/libva/va/va_enc_h264.h +659 -0
  63. package/engine/vendor/libva/va/va_enc_hevc.h +958 -0
  64. package/engine/vendor/libva/va/va_enc_jpeg.h +162 -0
  65. package/engine/vendor/libva/va/va_enc_mpeg2.h +308 -0
  66. package/engine/vendor/libva/va/va_enc_vp8.h +350 -0
  67. package/engine/vendor/libva/va/va_enc_vp9.h +639 -0
  68. package/engine/vendor/libva/va/va_fei.h +170 -0
  69. package/engine/vendor/libva/va/va_fei_h264.h +505 -0
  70. package/engine/vendor/libva/va/va_fei_hevc.h +254 -0
  71. package/engine/vendor/libva/va/va_prot.h +525 -0
  72. package/engine/vendor/libva/va/va_version.h +87 -0
  73. package/engine/vendor/libva/va/va_vpp.h +1590 -0
  74. package/engine/vendor/nv-codec-headers/LICENSE +24 -0
  75. package/engine/vendor/nv-codec-headers/README +7 -0
  76. package/engine/vendor/nv-codec-headers/include/ffnvcodec/nvEncodeAPI.h +3825 -0
  77. package/examples/reference-client.html +1 -1
  78. package/package.json +3 -2
@@ -0,0 +1,312 @@
1
+ /*
2
+ * Copyright (c) 2014 Intel Corporation. All Rights Reserved.
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a
5
+ * copy of this software and associated documentation files (the
6
+ * "Software"), to deal in the Software without restriction, including
7
+ * without limitation the rights to use, copy, modify, merge, publish,
8
+ * distribute, sub license, and/or sell copies of the Software, and to
9
+ * permit persons to whom the Software is furnished to do so, subject to
10
+ * the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice (including the
13
+ * next paragraph) shall be included in all copies or substantial portions
14
+ * of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
20
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * \file va_dec_vp9.h
27
+ * \brief The VP9 decoding API
28
+ *
29
+ * This file contains the \ref api_dec_vp9 "VP9 decoding API".
30
+ */
31
+
32
+ #ifndef VA_DEC_VP9_H
33
+ #define VA_DEC_VP9_H
34
+
35
+ #ifdef __cplusplus
36
+ extern "C" {
37
+ #endif
38
+
39
+ /**
40
+ * \defgroup api_dec_vp9 VP9 decoding API
41
+ *
42
+ * This VP9 decoding API supports 8-bit 420 format only.
43
+ *
44
+ * @{
45
+ */
46
+
47
+
48
+
49
+
50
+ /**
51
+ * \brief VP9 Decoding Picture Parameter Buffer Structure
52
+ *
53
+ * This structure conveys picture level parameters.
54
+ * App should send a surface with this data structure down to VAAPI once
55
+ * per frame.
56
+ *
57
+ */
58
+ typedef struct _VADecPictureParameterBufferVP9 {
59
+ /** \brief picture width
60
+ * Picture original resolution. The value may not be multiple of 8.
61
+ */
62
+ uint16_t frame_width;
63
+ /** \brief picture height
64
+ * Picture original resolution. The value may not be multiple of 8.
65
+ */
66
+ uint16_t frame_height;
67
+
68
+ /** \brief Surface indices of reference frames in DPB.
69
+ *
70
+ * Each entry of the list specifies the surface index of the picture
71
+ * that is referred by current picture or will be referred by any future
72
+ * picture.
73
+ * Application who calls this API should update this list based on the
74
+ * refreshing information from VP9 bitstream.
75
+ */
76
+ VASurfaceID reference_frames[8];
77
+
78
+ union {
79
+ struct {
80
+ /** \brief flags for current picture
81
+ * same syntax and semantic as those in VP9 code
82
+ */
83
+ uint32_t subsampling_x : 1;
84
+ uint32_t subsampling_y : 1;
85
+ uint32_t frame_type : 1;
86
+ uint32_t show_frame : 1;
87
+ uint32_t error_resilient_mode : 1;
88
+ uint32_t intra_only : 1;
89
+ uint32_t allow_high_precision_mv : 1;
90
+ uint32_t mcomp_filter_type : 3;
91
+ uint32_t frame_parallel_decoding_mode : 1;
92
+ uint32_t reset_frame_context : 2;
93
+ uint32_t refresh_frame_context : 1;
94
+ uint32_t frame_context_idx : 2;
95
+ uint32_t segmentation_enabled : 1;
96
+
97
+ /** \brief corresponds to variable temporal_update in VP9 code.
98
+ */
99
+ uint32_t segmentation_temporal_update : 1;
100
+ /** \brief corresponds to variable update_mb_segmentation_map
101
+ * in VP9 code.
102
+ */
103
+ uint32_t segmentation_update_map : 1;
104
+
105
+ /** \brief Index of reference_frames[] and points to the
106
+ * LAST reference frame.
107
+ * It corresponds to active_ref_idx[0] in VP9 code.
108
+ */
109
+ uint32_t last_ref_frame : 3;
110
+ /** \brief Sign Bias of the LAST reference frame.
111
+ * It corresponds to ref_frame_sign_bias[LAST_FRAME] in VP9 code.
112
+ */
113
+ uint32_t last_ref_frame_sign_bias : 1;
114
+ /** \brief Index of reference_frames[] and points to the
115
+ * GOLDERN reference frame.
116
+ * It corresponds to active_ref_idx[1] in VP9 code.
117
+ */
118
+ uint32_t golden_ref_frame : 3;
119
+ /** \brief Sign Bias of the GOLDERN reference frame.
120
+ * Corresponds to ref_frame_sign_bias[GOLDERN_FRAME] in VP9 code.
121
+ */
122
+ uint32_t golden_ref_frame_sign_bias : 1;
123
+ /** \brief Index of reference_frames[] and points to the
124
+ * ALTERNATE reference frame.
125
+ * Corresponds to active_ref_idx[2] in VP9 code.
126
+ */
127
+ uint32_t alt_ref_frame : 3;
128
+ /** \brief Sign Bias of the ALTERNATE reference frame.
129
+ * Corresponds to ref_frame_sign_bias[ALTREF_FRAME] in VP9 code.
130
+ */
131
+ uint32_t alt_ref_frame_sign_bias : 1;
132
+ /** \brief Lossless Mode
133
+ * LosslessFlag = base_qindex == 0 &&
134
+ * y_dc_delta_q == 0 &&
135
+ * uv_dc_delta_q == 0 &&
136
+ * uv_ac_delta_q == 0;
137
+ * Where base_qindex, y_dc_delta_q, uv_dc_delta_q and uv_ac_delta_q
138
+ * are all variables in VP9 code.
139
+ */
140
+ uint32_t lossless_flag : 1;
141
+ } bits;
142
+ uint32_t value;
143
+ } pic_fields;
144
+
145
+ /* following parameters have same syntax with those in VP9 code */
146
+ uint8_t filter_level;
147
+ uint8_t sharpness_level;
148
+
149
+ /** \brief number of tile rows specified by (1 << log2_tile_rows).
150
+ * It corresponds the variable with same name in VP9 code.
151
+ */
152
+ uint8_t log2_tile_rows;
153
+ /** \brief number of tile columns specified by (1 << log2_tile_columns).
154
+ * It corresponds the variable with same name in VP9 code.
155
+ */
156
+ uint8_t log2_tile_columns;
157
+ /** \brief Number of bytes taken up by the uncompressed frame header,
158
+ * which corresponds to byte length of function
159
+ * read_uncompressed_header() in VP9 code.
160
+ * Specifically, it is the byte count from bit stream buffer start to
161
+ * the last byte of uncompressed frame header.
162
+ * If there are other meta data in the buffer before uncompressed header,
163
+ * its size should be also included here.
164
+ */
165
+ uint8_t frame_header_length_in_bytes;
166
+
167
+ /** \brief The byte count of compressed header the bitstream buffer,
168
+ * which corresponds to syntax first_partition_size in code.
169
+ */
170
+ uint16_t first_partition_size;
171
+
172
+ /** These values are segment probabilities with same names in VP9
173
+ * function setup_segmentation(). They should be parsed directly from
174
+ * bitstream by application.
175
+ */
176
+ uint8_t mb_segment_tree_probs[7];
177
+ uint8_t segment_pred_probs[3];
178
+
179
+ /** \brief VP9 Profile definition
180
+ * value range [0..3].
181
+ */
182
+ uint8_t profile;
183
+
184
+ /** \brief VP9 bit depth per sample
185
+ * same for both luma and chroma samples.
186
+ */
187
+ uint8_t bit_depth;
188
+
189
+ /** \brief Reserved bytes for future use, must be zero */
190
+ uint32_t va_reserved[VA_PADDING_MEDIUM];
191
+
192
+ } VADecPictureParameterBufferVP9;
193
+
194
+
195
+
196
+ /**
197
+ * \brief VP9 Segmentation Parameter Data Structure
198
+ *
199
+ * This structure conveys per segment parameters.
200
+ * 8 of this data structure will be included in VASegmentationParameterBufferVP9
201
+ * and sent to API in a single buffer.
202
+ *
203
+ */
204
+ typedef struct _VASegmentParameterVP9 {
205
+ union {
206
+ struct {
207
+ /** \brief Indicates if per segment reference frame indicator
208
+ * is enabled.
209
+ * Corresponding to variable feature_enabled when
210
+ * j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
211
+ */
212
+ uint16_t segment_reference_enabled : 1;
213
+ /** \brief Specifies per segment reference indication.
214
+ * 0: reserved
215
+ * 1: Last ref
216
+ * 2: golden
217
+ * 3: altref
218
+ * Value can be derived from variable data when
219
+ * j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
220
+ */
221
+ uint16_t segment_reference : 2;
222
+ /** \brief Indicates if per segment skip feature is enabled.
223
+ * Corresponding to variable feature_enabled when
224
+ * j == SEG_LVL_SKIP in function setup_segmentation() VP9 code.
225
+ */
226
+ uint16_t segment_reference_skipped : 1;
227
+ } fields;
228
+ uint16_t value;
229
+ } segment_flags;
230
+
231
+ /** \brief Specifies the filter level information per segment.
232
+ * The value corresponds to variable lfi->lvl[seg][ref][mode] in VP9 code,
233
+ * where m is [ref], and n is [mode] in FilterLevel[m][n].
234
+ */
235
+ uint8_t filter_level[4][2];
236
+ /** \brief Specifies per segment Luma AC quantization scale.
237
+ * Corresponding to y_dequant[qindex][1] in vp9_mb_init_quantizer()
238
+ * function of VP9 code.
239
+ */
240
+ int16_t luma_ac_quant_scale;
241
+ /** \brief Specifies per segment Luma DC quantization scale.
242
+ * Corresponding to y_dequant[qindex][0] in vp9_mb_init_quantizer()
243
+ * function of VP9 code.
244
+ */
245
+ int16_t luma_dc_quant_scale;
246
+ /** \brief Specifies per segment Chroma AC quantization scale.
247
+ * Corresponding to uv_dequant[qindex][1] in vp9_mb_init_quantizer()
248
+ * function of VP9 code.
249
+ */
250
+ int16_t chroma_ac_quant_scale;
251
+ /** \brief Specifies per segment Chroma DC quantization scale.
252
+ * Corresponding to uv_dequant[qindex][0] in vp9_mb_init_quantizer()
253
+ * function of VP9 code.
254
+ */
255
+ int16_t chroma_dc_quant_scale;
256
+
257
+ /** \brief Reserved bytes for future use, must be zero */
258
+ uint32_t va_reserved[VA_PADDING_LOW];
259
+
260
+ } VASegmentParameterVP9;
261
+
262
+
263
+
264
+ /**
265
+ * \brief VP9 Slice Parameter Buffer Structure
266
+ *
267
+ * This structure conveys parameters related to segmentation data and should be
268
+ * sent once per frame.
269
+ *
270
+ * When segmentation is disabled, only SegParam[0] has valid values,
271
+ * all other entries should be populated with 0.
272
+ * Otherwise, all eight entries should be valid.
273
+ *
274
+ * Slice data buffer of VASliceDataBufferType is used
275
+ * to send the bitstream which should include whole or part of partition 0
276
+ * (at least compressed header) to the end of frame.
277
+ *
278
+ */
279
+ typedef struct _VASliceParameterBufferVP9 {
280
+ /** \brief The byte count of current frame in the bitstream buffer,
281
+ * starting from first byte of the buffer.
282
+ * It uses the name slice_data_size to be consitent with other codec,
283
+ * but actually means frame_data_size.
284
+ */
285
+ uint32_t slice_data_size;
286
+ /**
287
+ * offset to the first byte of partition data (control partition)
288
+ */
289
+ uint32_t slice_data_offset;
290
+ /**
291
+ * see VA_SLICE_DATA_FLAG_XXX definitions
292
+ */
293
+ uint32_t slice_data_flag;
294
+
295
+ /**
296
+ * \brief per segment information
297
+ */
298
+ VASegmentParameterVP9 seg_param[8];
299
+
300
+ /** \brief Reserved bytes for future use, must be zero */
301
+ uint32_t va_reserved[VA_PADDING_LOW];
302
+
303
+ } VASliceParameterBufferVP9;
304
+
305
+
306
+ /**@}*/
307
+
308
+ #ifdef __cplusplus
309
+ }
310
+ #endif
311
+
312
+ #endif /* VA_DEC_VP9_H */