@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,157 @@
1
+ /*
2
+ * Copyright (c) 2007-2012 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_jpeg.h
27
+ * \brief The JPEG decoding API
28
+ *
29
+ * This file contains the \ref api_dec_jpeg "JPEG decoding API".
30
+ */
31
+
32
+ #ifndef VA_DEC_JPEG_H
33
+ #define VA_DEC_JPEG_H
34
+
35
+ #ifdef __cplusplus
36
+ extern "C" {
37
+ #endif
38
+
39
+ #include <va/va.h>
40
+
41
+ /**
42
+ * \defgroup api_dec_jpeg JPEG decoding API
43
+ *
44
+ * This JPEG decoding API supports Baseline profile only.
45
+ *
46
+ * @{
47
+ */
48
+
49
+ /**
50
+ * \brief Picture parameter for JPEG decoding.
51
+ *
52
+ * This structure holds information from the frame header, along with
53
+ * definitions from additional segments.
54
+ */
55
+ typedef struct _VAPictureParameterBufferJPEGBaseline {
56
+ /** \brief Picture width in pixels. */
57
+ uint16_t picture_width;
58
+ /** \brief Picture height in pixels. */
59
+ uint16_t picture_height;
60
+
61
+ struct {
62
+ /** \brief Component identifier (Ci). */
63
+ uint8_t component_id;
64
+ /** \brief Horizontal sampling factor (Hi). */
65
+ uint8_t h_sampling_factor;
66
+ /** \brief Vertical sampling factor (Vi). */
67
+ uint8_t v_sampling_factor;
68
+ /* \brief Quantization table selector (Tqi). */
69
+ uint8_t quantiser_table_selector;
70
+ } components[255];
71
+ /** \brief Number of components in frame (Nf). */
72
+ uint8_t num_components;
73
+
74
+ /** \brief Input color space 0: YUV, 1: RGB, 2: BGR, others: reserved */
75
+ uint8_t color_space;
76
+ /** \brief Set to VA_ROTATION_* for a single rotation angle reported by VAConfigAttribDecJPEG. */
77
+ uint32_t rotation;
78
+ /** \brief crop rectangle boundary in pixels */
79
+ VARectangle crop_rectangle;
80
+ /** \brief Reserved bytes for future use, must be zero */
81
+ uint32_t va_reserved[VA_PADDING_MEDIUM - 3];
82
+ } VAPictureParameterBufferJPEGBaseline;
83
+
84
+ /**
85
+ * \brief Quantization table for JPEG decoding.
86
+ *
87
+ * This structure holds the complete quantization tables. This is an
88
+ * aggregation of all quantization table (DQT) segments maintained by
89
+ * the application. i.e. up to 4 quantization tables are stored in
90
+ * there for baseline profile.
91
+ *
92
+ * The #load_quantization_table array can be used as a hint to notify
93
+ * the VA driver implementation about which table(s) actually changed
94
+ * since the last submission of this buffer.
95
+ *
96
+ * The #quantiser_table values are specified in zig-zag scan order.
97
+ */
98
+ typedef struct _VAIQMatrixBufferJPEGBaseline {
99
+ /** \brief Specifies which #quantiser_table is valid. */
100
+ uint8_t load_quantiser_table[4];
101
+ /** \brief Quanziation tables indexed by table identifier (Tqi). */
102
+ uint8_t quantiser_table[4][64];
103
+
104
+ /** \brief Reserved bytes for future use, must be zero */
105
+ uint32_t va_reserved[VA_PADDING_LOW];
106
+ } VAIQMatrixBufferJPEGBaseline;
107
+
108
+ /**
109
+ * \brief Slice parameter for JPEG decoding.
110
+ *
111
+ * This structure holds information from the scan header, along with
112
+ * definitions from additional segments. The associated slice data
113
+ * buffer holds all entropy coded segments (ECS) in the scan.
114
+ */
115
+ typedef struct _VASliceParameterBufferJPEGBaseline {
116
+ /** @name Codec-independent Slice Parameter Buffer base. */
117
+ /**@{*/
118
+ /** \brief Number of bytes in the slice data buffer for this slice. */
119
+ uint32_t slice_data_size;
120
+ /** \brief The offset to the first byte of the first MCU. */
121
+ uint32_t slice_data_offset;
122
+ /** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_xxx. */
123
+ uint32_t slice_data_flag;
124
+ /**@}*/
125
+
126
+ /** \brief Scan horizontal position. */
127
+ uint32_t slice_horizontal_position;
128
+ /** \brief Scan vertical position. */
129
+ uint32_t slice_vertical_position;
130
+
131
+ struct {
132
+ /** \brief Scan component selector (Csj). */
133
+ uint8_t component_selector;
134
+ /** \brief DC entropy coding table selector (Tdj). */
135
+ uint8_t dc_table_selector;
136
+ /** \brief AC entropy coding table selector (Taj). */
137
+ uint8_t ac_table_selector;
138
+ } components[4];
139
+ /** \brief Number of components in scan (Ns). */
140
+ uint8_t num_components;
141
+
142
+ /** \brief Restart interval definition (Ri). */
143
+ uint16_t restart_interval;
144
+ /** \brief Number of MCUs in a scan. */
145
+ uint32_t num_mcus;
146
+
147
+ /** \brief Reserved bytes for future use, must be zero */
148
+ uint32_t va_reserved[VA_PADDING_LOW];
149
+ } VASliceParameterBufferJPEGBaseline;
150
+
151
+ /**@}*/
152
+
153
+ #ifdef __cplusplus
154
+ }
155
+ #endif
156
+
157
+ #endif /* VA_DEC_JPEG_H */
@@ -0,0 +1,249 @@
1
+ /*
2
+ * Copyright (c) 2007-2012 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_vp8.h
27
+ * \brief VP8 decoding API
28
+ *
29
+ * This file contains the \ref api_dec_vp8 "VP8 decoding API".
30
+ */
31
+
32
+ #ifndef VA_DEC_VP8_H
33
+ #define VA_DEC_VP8_H
34
+
35
+ #ifdef __cplusplus
36
+ extern "C" {
37
+ #endif
38
+
39
+ /**
40
+ * \defgroup api_dec_vp8 VP8 decoding API
41
+ *
42
+ * @{
43
+ */
44
+
45
+ /**
46
+ * \brief VPX Bool Coder Context structure
47
+ *
48
+ * This common structure is defined for potential sharing by other VP formats
49
+ *
50
+ */
51
+ typedef struct _VABoolCoderContextVPX {
52
+ /* partition 0 "range" */
53
+ uint8_t range;
54
+ /* partition 0 "value" */
55
+ uint8_t value;
56
+ /*
57
+ * 'partition 0 number of shifts before an output byte is available'
58
+ * it is the number of remaining bits in 'value' for decoding, range [0, 7].
59
+ */
60
+
61
+ uint8_t count;
62
+ } VABoolCoderContextVPX;
63
+
64
+ /**
65
+ * \brief VP8 Decoding Picture Parameter Buffer Structure
66
+ *
67
+ * This structure conveys frame level parameters and should be sent once
68
+ * per frame.
69
+ *
70
+ */
71
+ typedef struct _VAPictureParameterBufferVP8 {
72
+ /* frame width in pixels */
73
+ uint32_t frame_width;
74
+ /* frame height in pixels */
75
+ uint32_t frame_height;
76
+
77
+ /* specifies the "last" reference frame */
78
+ VASurfaceID last_ref_frame;
79
+ /* specifies the "golden" reference frame */
80
+ VASurfaceID golden_ref_frame;
81
+ /* specifies the "alternate" referrence frame */
82
+ VASurfaceID alt_ref_frame;
83
+ /* specifies the out-of-loop deblocked frame, not used currently */
84
+ VASurfaceID out_of_loop_frame;
85
+
86
+ union {
87
+ struct {
88
+ /* same as key_frame in bitstream syntax, 0 means a key frame */
89
+ uint32_t key_frame : 1;
90
+ /* same as version in bitstream syntax */
91
+ uint32_t version : 3;
92
+ /* same as segmentation_enabled in bitstream syntax */
93
+ uint32_t segmentation_enabled : 1;
94
+ /* same as update_mb_segmentation_map in bitstream syntax */
95
+ uint32_t update_mb_segmentation_map : 1;
96
+ /* same as update_segment_feature_data in bitstream syntax */
97
+ uint32_t update_segment_feature_data : 1;
98
+ /* same as filter_type in bitstream syntax */
99
+ uint32_t filter_type : 1;
100
+ /* same as sharpness_level in bitstream syntax */
101
+ uint32_t sharpness_level : 3;
102
+ /* same as loop_filter_adj_enable in bitstream syntax */
103
+ uint32_t loop_filter_adj_enable : 1;
104
+ /* same as mode_ref_lf_delta_update in bitstream syntax */
105
+ uint32_t mode_ref_lf_delta_update : 1;
106
+ /* same as sign_bias_golden in bitstream syntax */
107
+ uint32_t sign_bias_golden : 1;
108
+ /* same as sign_bias_alternate in bitstream syntax */
109
+ uint32_t sign_bias_alternate : 1;
110
+ /* same as mb_no_coeff_skip in bitstream syntax */
111
+ uint32_t mb_no_coeff_skip : 1;
112
+ /* flag to indicate that loop filter should be disabled */
113
+ uint32_t loop_filter_disable : 1;
114
+ } bits;
115
+ uint32_t value;
116
+ } pic_fields;
117
+
118
+ /*
119
+ * probabilities of the segment_id decoding tree and same as
120
+ * mb_segment_tree_probs in the spec.
121
+ */
122
+ uint8_t mb_segment_tree_probs[3];
123
+
124
+ /* Post-adjustment loop filter levels for the 4 segments */
125
+ uint8_t loop_filter_level[4];
126
+ /* loop filter deltas for reference frame based MB level adjustment */
127
+ int8_t loop_filter_deltas_ref_frame[4];
128
+ /* loop filter deltas for coding mode based MB level adjustment */
129
+ int8_t loop_filter_deltas_mode[4];
130
+
131
+ /* same as prob_skip_false in bitstream syntax */
132
+ uint8_t prob_skip_false;
133
+ /* same as prob_intra in bitstream syntax */
134
+ uint8_t prob_intra;
135
+ /* same as prob_last in bitstream syntax */
136
+ uint8_t prob_last;
137
+ /* same as prob_gf in bitstream syntax */
138
+ uint8_t prob_gf;
139
+
140
+ /*
141
+ * list of 4 probabilities of the luma intra prediction mode decoding
142
+ * tree and same as y_mode_probs in frame header
143
+ */
144
+ uint8_t y_mode_probs[4];
145
+ /*
146
+ * list of 3 probabilities of the chroma intra prediction mode decoding
147
+ * tree and same as uv_mode_probs in frame header
148
+ */
149
+ uint8_t uv_mode_probs[3];
150
+ /*
151
+ * updated mv decoding probabilities and same as mv_probs in
152
+ * frame header
153
+ */
154
+ uint8_t mv_probs[2][19];
155
+
156
+ VABoolCoderContextVPX bool_coder_ctx;
157
+
158
+ /** \brief Reserved bytes for future use, must be zero */
159
+ uint32_t va_reserved[VA_PADDING_LOW];
160
+ } VAPictureParameterBufferVP8;
161
+
162
+ /**
163
+ * \brief VP8 Slice Parameter Buffer Structure
164
+ *
165
+ * This structure conveys parameters related to data partitions and should be
166
+ * sent once per frame. Slice data buffer of VASliceDataBufferType is used
167
+ * to send the partition data.
168
+ *
169
+ */
170
+ typedef struct _VASliceParameterBufferVP8 {
171
+ /*
172
+ * number of bytes in the slice data buffer for the partitions
173
+ */
174
+ uint32_t slice_data_size;
175
+ /*
176
+ * offset to the first byte of partition data (control partition)
177
+ */
178
+ uint32_t slice_data_offset;
179
+ /*
180
+ * see VA_SLICE_DATA_FLAG_XXX definitions
181
+ */
182
+ uint32_t slice_data_flag;
183
+ /*
184
+ * offset to the first bit of MB from the first byte of partition data(slice_data_offset)
185
+ */
186
+ uint32_t macroblock_offset;
187
+
188
+ /*
189
+ * Partitions
190
+ * (1<<log2_nbr_of_dct_partitions)+1, count both control partition (frame header) and toke partition
191
+ */
192
+ uint8_t num_of_partitions;
193
+ /*
194
+ * partition_size[0] is remaining bytes of control partition after parsed by application.
195
+ * exclude current byte for the remaining bits in bool_coder_ctx.
196
+ * exclude the uncompress data chunk since first_part_size 'excluding the uncompressed data chunk'
197
+ */
198
+ uint32_t partition_size[9];
199
+
200
+ /** \brief Reserved bytes for future use, must be zero */
201
+ uint32_t va_reserved[VA_PADDING_LOW];
202
+ } VASliceParameterBufferVP8;
203
+
204
+ /**
205
+ * \brief VP8 Coefficient Probability Data Buffer Structure
206
+ *
207
+ * Contains the contents of the token probability table, which may be
208
+ * incrementally modified in the frame header. There are four dimensions to
209
+ * the token probability array. The outermost dimension is indexed by the
210
+ * type of plane being decoded; the next dimension is selected by the
211
+ * position of the coefficient being decoded; the third dimension, * roughly
212
+ * speaking, measures the "local complexity" or extent to which nearby
213
+ * coefficients are non-zero; the fourth, and final, dimension of the token
214
+ * probability array is indexed by the position in the token tree structure,
215
+ * as are all tree probability arrays. This structure is sent once per frame.
216
+ *
217
+ */
218
+ typedef struct _VAProbabilityDataBufferVP8 {
219
+ uint8_t dct_coeff_probs[4][8][3][11];
220
+
221
+ /** \brief Reserved bytes for future use, must be zero */
222
+ uint32_t va_reserved[VA_PADDING_LOW];
223
+ } VAProbabilityDataBufferVP8;
224
+
225
+ /**
226
+ * \brief VP8 Inverse Quantization Matrix Buffer Structure
227
+ *
228
+ * Contains quantization indices for yac(0),ydc(1),y2dc(2),y2ac(3),uvdc(4),
229
+ * uvac(5) for each segment (0-3). When segmentation is disabled, only
230
+ * quantization_index[0][] will be used. This structure is sent once per frame.
231
+ */
232
+ typedef struct _VAIQMatrixBufferVP8 {
233
+ /*
234
+ * array first dimensional is segment and 2nd dimensional is Q index
235
+ * all Q indexs should be clipped to be range [0, 127]
236
+ */
237
+ uint16_t quantization_index[4][6];
238
+
239
+ /** \brief Reserved bytes for future use, must be zero */
240
+ uint32_t va_reserved[VA_PADDING_LOW];
241
+ } VAIQMatrixBufferVP8;
242
+
243
+ /**@}*/
244
+
245
+ #ifdef __cplusplus
246
+ }
247
+ #endif
248
+
249
+ #endif /* VA_DEC_VP8_H */