@yume-chan/scrcpy 0.0.11
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.
- package/CHANGELOG.json +43 -0
- package/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.md +88 -0
- package/bin/scrcpy-server +0 -0
- package/bin/version.d.ts +1 -0
- package/bin/version.js +1 -0
- package/esm/client.d.ts +36 -0
- package/esm/client.d.ts.map +1 -0
- package/esm/client.js +209 -0
- package/esm/client.js.map +1 -0
- package/esm/codec.d.ts +34 -0
- package/esm/codec.d.ts.map +1 -0
- package/esm/codec.js +37 -0
- package/esm/codec.js.map +1 -0
- package/esm/connection.d.ts +37 -0
- package/esm/connection.d.ts.map +1 -0
- package/esm/connection.js +103 -0
- package/esm/connection.js.map +1 -0
- package/esm/decoder/index.d.ts +4 -0
- package/esm/decoder/index.d.ts.map +1 -0
- package/esm/decoder/index.js +4 -0
- package/esm/decoder/index.js.map +1 -0
- package/esm/decoder/tinyh264/index.d.ts +20 -0
- package/esm/decoder/tinyh264/index.d.ts.map +1 -0
- package/esm/decoder/tinyh264/index.js +86 -0
- package/esm/decoder/tinyh264/index.js.map +1 -0
- package/esm/decoder/tinyh264/worker.d.ts +2 -0
- package/esm/decoder/tinyh264/worker.d.ts.map +1 -0
- package/esm/decoder/tinyh264/worker.js +3 -0
- package/esm/decoder/tinyh264/worker.js.map +1 -0
- package/esm/decoder/tinyh264/wrapper.d.ts +21 -0
- package/esm/decoder/tinyh264/wrapper.d.ts.map +1 -0
- package/esm/decoder/tinyh264/wrapper.js +67 -0
- package/esm/decoder/tinyh264/wrapper.js.map +1 -0
- package/esm/decoder/types.d.ts +28 -0
- package/esm/decoder/types.d.ts.map +1 -0
- package/esm/decoder/types.js +2 -0
- package/esm/decoder/types.js.map +1 -0
- package/esm/decoder/web-codecs/index.d.ts +22 -0
- package/esm/decoder/web-codecs/index.d.ts.map +1 -0
- package/esm/decoder/web-codecs/index.js +75 -0
- package/esm/decoder/web-codecs/index.js.map +1 -0
- package/esm/index.d.ts +9 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +9 -0
- package/esm/index.js.map +1 -0
- package/esm/message.d.ts +93 -0
- package/esm/message.d.ts.map +1 -0
- package/esm/message.js +92 -0
- package/esm/message.js.map +1 -0
- package/esm/options/1_16/index.d.ts +107 -0
- package/esm/options/1_16/index.d.ts.map +1 -0
- package/esm/options/1_16/index.js +211 -0
- package/esm/options/1_16/index.js.map +1 -0
- package/esm/options/1_16/sps.d.ts +22 -0
- package/esm/options/1_16/sps.d.ts.map +1 -0
- package/esm/options/1_16/sps.js +254 -0
- package/esm/options/1_16/sps.js.map +1 -0
- package/esm/options/1_18.d.ts +19 -0
- package/esm/options/1_18.d.ts.map +1 -0
- package/esm/options/1_18.js +23 -0
- package/esm/options/1_18.js.map +1 -0
- package/esm/options/1_21.d.ts +10 -0
- package/esm/options/1_21.d.ts.map +1 -0
- package/esm/options/1_21.js +23 -0
- package/esm/options/1_21.js.map +1 -0
- package/esm/options/1_22.d.ts +43 -0
- package/esm/options/1_22.d.ts.map +1 -0
- package/esm/options/1_22.js +40 -0
- package/esm/options/1_22.js.map +1 -0
- package/esm/options/common.d.ts +30 -0
- package/esm/options/common.d.ts.map +1 -0
- package/esm/options/common.js +16 -0
- package/esm/options/common.js.map +1 -0
- package/esm/options/index.d.ts +6 -0
- package/esm/options/index.d.ts.map +1 -0
- package/esm/options/index.js +6 -0
- package/esm/options/index.js.map +1 -0
- package/esm/push-server.d.ts +6 -0
- package/esm/push-server.d.ts.map +1 -0
- package/esm/push-server.js +23 -0
- package/esm/push-server.js.map +1 -0
- package/esm/utils.d.ts +4 -0
- package/esm/utils.d.ts.map +1 -0
- package/esm/utils.js +14 -0
- package/esm/utils.js.map +1 -0
- package/package.json +61 -0
- package/scrcpy.LICENSE +203 -0
- package/scripts/fetch-server.cjs +28 -0
- package/src/client.ts +275 -0
- package/src/codec.ts +35 -0
- package/src/connection.ts +123 -0
- package/src/decoder/index.ts +3 -0
- package/src/decoder/tinyh264/index.ts +112 -0
- package/src/decoder/tinyh264/types.d.ts +137 -0
- package/src/decoder/tinyh264/worker.ts +2 -0
- package/src/decoder/tinyh264/wrapper.ts +89 -0
- package/src/decoder/types.ts +35 -0
- package/src/decoder/web-codecs/index.ts +98 -0
- package/src/index.ts +8 -0
- package/src/message.ts +105 -0
- package/src/options/1_16/index.ts +322 -0
- package/src/options/1_16/sps.ts +300 -0
- package/src/options/1_18.ts +41 -0
- package/src/options/1_21.ts +34 -0
- package/src/options/1_22.ts +80 -0
- package/src/options/common.ts +61 -0
- package/src/options/index.ts +5 -0
- package/src/push-server.ts +26 -0
- package/src/utils.ts +16 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
// cspell: ignore golomb
|
|
2
|
+
// cspell: ignore qpprime
|
|
3
|
+
class BitReader {
|
|
4
|
+
constructor(buffer) {
|
|
5
|
+
this.bytePosition = 0;
|
|
6
|
+
this.bitPosition = 0;
|
|
7
|
+
this.buffer = buffer;
|
|
8
|
+
}
|
|
9
|
+
read(length) {
|
|
10
|
+
let result = 0;
|
|
11
|
+
for (let i = 0; i < length; i += 1) {
|
|
12
|
+
result = (result << 1) | this.next();
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
next() {
|
|
17
|
+
const value = (this.buffer[this.bytePosition] >> (7 - this.bitPosition)) & 1;
|
|
18
|
+
this.bitPosition += 1;
|
|
19
|
+
if (this.bitPosition === 8) {
|
|
20
|
+
this.bytePosition += 1;
|
|
21
|
+
this.bitPosition = 0;
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
decodeExponentialGolombNumber() {
|
|
26
|
+
let length = 0;
|
|
27
|
+
while (this.next() === 0) {
|
|
28
|
+
length += 1;
|
|
29
|
+
}
|
|
30
|
+
if (length === 0) {
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
return (1 << length | this.read(length)) - 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function* iterateNalu(buffer) {
|
|
37
|
+
// -1 means we haven't found the first start code
|
|
38
|
+
let start = -1;
|
|
39
|
+
let writeIndex = 0;
|
|
40
|
+
// How many `0x00`s in a row we have counted
|
|
41
|
+
let zeroCount = 0;
|
|
42
|
+
let inEmulation = false;
|
|
43
|
+
for (const byte of buffer) {
|
|
44
|
+
buffer[writeIndex] = byte;
|
|
45
|
+
writeIndex += 1;
|
|
46
|
+
if (inEmulation) {
|
|
47
|
+
if (byte > 0x03) {
|
|
48
|
+
// `0x00000304` or larger are invalid
|
|
49
|
+
throw new Error('Invalid data');
|
|
50
|
+
}
|
|
51
|
+
inEmulation = false;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (byte == 0x00) {
|
|
55
|
+
zeroCount += 1;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const lastZeroCount = zeroCount;
|
|
59
|
+
zeroCount = 0;
|
|
60
|
+
if (start === -1) {
|
|
61
|
+
// 0x000001 is the start code
|
|
62
|
+
// But it can be preceded by any number of zeros
|
|
63
|
+
// So 2 is the minimal
|
|
64
|
+
if (lastZeroCount >= 2 && byte === 0x01) {
|
|
65
|
+
// Found start of first NAL unit
|
|
66
|
+
writeIndex = 0;
|
|
67
|
+
start = 0;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
// Not begin with start code
|
|
71
|
+
throw new Error('Invalid data');
|
|
72
|
+
}
|
|
73
|
+
if (lastZeroCount < 2) {
|
|
74
|
+
// zero or one `0x00`s are acceptable
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (byte === 0x01) {
|
|
78
|
+
// Remove all leading `0x00`s and this `0x01`
|
|
79
|
+
writeIndex -= lastZeroCount + 1;
|
|
80
|
+
// Found another NAL unit
|
|
81
|
+
yield buffer.subarray(start, writeIndex);
|
|
82
|
+
start = writeIndex;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (lastZeroCount > 2) {
|
|
86
|
+
// Too much `0x00`s
|
|
87
|
+
throw new Error('Invalid data');
|
|
88
|
+
}
|
|
89
|
+
switch (byte) {
|
|
90
|
+
case 0x02:
|
|
91
|
+
// Didn't find why, but 7.4.1 NAL unit semantics forbids `0x000002` appearing in NAL units
|
|
92
|
+
throw new Error('Invalid data');
|
|
93
|
+
case 0x03:
|
|
94
|
+
// `0x000003` is the "emulation_prevention_three_byte"
|
|
95
|
+
// `0x00000300`, `0x00000301`, `0x00000302` and `0x00000303` represent
|
|
96
|
+
// `0x000000`, `0x000001`, `0x000002` and `0x000003` respectively
|
|
97
|
+
// Remove current byte
|
|
98
|
+
writeIndex -= 1;
|
|
99
|
+
inEmulation = true;
|
|
100
|
+
break;
|
|
101
|
+
default:
|
|
102
|
+
// `0x000004` or larger are ok
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (inEmulation || zeroCount !== 0) {
|
|
107
|
+
throw new Error('Invalid data');
|
|
108
|
+
}
|
|
109
|
+
yield buffer.subarray(start, writeIndex);
|
|
110
|
+
}
|
|
111
|
+
// 7.3.2.1.1 Sequence parameter set data syntax
|
|
112
|
+
export function parse_sequence_parameter_set(buffer) {
|
|
113
|
+
for (const nalu of iterateNalu(new Uint8Array(buffer))) {
|
|
114
|
+
const reader = new BitReader(nalu);
|
|
115
|
+
if (reader.next() !== 0) {
|
|
116
|
+
throw new Error('Invalid data');
|
|
117
|
+
}
|
|
118
|
+
const nal_ref_idc = reader.read(2);
|
|
119
|
+
const nal_unit_type = reader.read(5);
|
|
120
|
+
if (nal_unit_type !== 7) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (nal_ref_idc === 0) {
|
|
124
|
+
throw new Error('Invalid data');
|
|
125
|
+
}
|
|
126
|
+
const profile_idc = reader.read(8);
|
|
127
|
+
const constraint_set = reader.read(8);
|
|
128
|
+
const constraint_set_reader = new BitReader(new Uint8Array([constraint_set]));
|
|
129
|
+
const constraint_set0_flag = !!constraint_set_reader.next();
|
|
130
|
+
const constraint_set1_flag = !!constraint_set_reader.next();
|
|
131
|
+
const constraint_set2_flag = !!constraint_set_reader.next();
|
|
132
|
+
const constraint_set3_flag = !!constraint_set_reader.next();
|
|
133
|
+
const constraint_set4_flag = !!constraint_set_reader.next();
|
|
134
|
+
const constraint_set5_flag = !!constraint_set_reader.next();
|
|
135
|
+
// reserved_zero_2bits
|
|
136
|
+
if (constraint_set_reader.read(2) !== 0) {
|
|
137
|
+
throw new Error('Invalid data');
|
|
138
|
+
}
|
|
139
|
+
const level_idc = reader.read(8);
|
|
140
|
+
const seq_parameter_set_id = reader.decodeExponentialGolombNumber();
|
|
141
|
+
if (profile_idc === 100 || profile_idc === 110 ||
|
|
142
|
+
profile_idc === 122 || profile_idc === 244 || profile_idc === 44 ||
|
|
143
|
+
profile_idc === 83 || profile_idc === 86 || profile_idc === 118 ||
|
|
144
|
+
profile_idc === 128 || profile_idc === 138 || profile_idc === 139 ||
|
|
145
|
+
profile_idc === 134) {
|
|
146
|
+
const chroma_format_idc = reader.decodeExponentialGolombNumber();
|
|
147
|
+
if (chroma_format_idc === 3) {
|
|
148
|
+
// separate_colour_plane_flag
|
|
149
|
+
reader.next();
|
|
150
|
+
}
|
|
151
|
+
// bit_depth_luma_minus8
|
|
152
|
+
reader.decodeExponentialGolombNumber();
|
|
153
|
+
// bit_depth_chroma_minus8
|
|
154
|
+
reader.decodeExponentialGolombNumber();
|
|
155
|
+
// qpprime_y_zero_transform_bypass_flag
|
|
156
|
+
reader.next();
|
|
157
|
+
const seq_scaling_matrix_present_flag = !!reader.next();
|
|
158
|
+
if (seq_scaling_matrix_present_flag) {
|
|
159
|
+
const seq_scaling_list_present_flag = [];
|
|
160
|
+
for (let i = 0; i < ((chroma_format_idc !== 3) ? 8 : 12); i++) {
|
|
161
|
+
seq_scaling_list_present_flag[i] = !!reader.next();
|
|
162
|
+
if (seq_scaling_list_present_flag[i])
|
|
163
|
+
if (i < 6) {
|
|
164
|
+
// TODO
|
|
165
|
+
// scaling_list( ScalingList4x4[ i ], 16,
|
|
166
|
+
// UseDefaultScalingMatrix4x4Flag[ i ])
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
// TODO
|
|
170
|
+
// scaling_list( ScalingList8x8[ i − 6 ], 64,
|
|
171
|
+
// UseDefaultScalingMatrix8x8Flag[ i − 6 ] )
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// log2_max_frame_num_minus4
|
|
177
|
+
reader.decodeExponentialGolombNumber();
|
|
178
|
+
const pic_order_cnt_type = reader.decodeExponentialGolombNumber();
|
|
179
|
+
if (pic_order_cnt_type === 0) {
|
|
180
|
+
// log2_max_pic_order_cnt_lsb_minus4
|
|
181
|
+
reader.decodeExponentialGolombNumber();
|
|
182
|
+
}
|
|
183
|
+
else if (pic_order_cnt_type === 1) {
|
|
184
|
+
// delta_pic_order_always_zero_flag
|
|
185
|
+
reader.next();
|
|
186
|
+
// offset_for_non_ref_pic
|
|
187
|
+
reader.decodeExponentialGolombNumber();
|
|
188
|
+
// offset_for_top_to_bottom_field
|
|
189
|
+
reader.decodeExponentialGolombNumber();
|
|
190
|
+
const num_ref_frames_in_pic_order_cnt_cycle = reader.decodeExponentialGolombNumber();
|
|
191
|
+
const offset_for_ref_frame = [];
|
|
192
|
+
for (let i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
|
|
193
|
+
offset_for_ref_frame[i] = reader.decodeExponentialGolombNumber();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// max_num_ref_frames
|
|
197
|
+
reader.decodeExponentialGolombNumber();
|
|
198
|
+
// gaps_in_frame_num_value_allowed_flag
|
|
199
|
+
reader.next();
|
|
200
|
+
const pic_width_in_mbs_minus1 = reader.decodeExponentialGolombNumber();
|
|
201
|
+
const pic_height_in_map_units_minus1 = reader.decodeExponentialGolombNumber();
|
|
202
|
+
const frame_mbs_only_flag = reader.next();
|
|
203
|
+
if (!frame_mbs_only_flag) {
|
|
204
|
+
// mb_adaptive_frame_field_flag
|
|
205
|
+
reader.next();
|
|
206
|
+
}
|
|
207
|
+
// direct_8x8_inference_flag
|
|
208
|
+
reader.next();
|
|
209
|
+
const frame_cropping_flag = !!reader.next();
|
|
210
|
+
let frame_crop_left_offset;
|
|
211
|
+
let frame_crop_right_offset;
|
|
212
|
+
let frame_crop_top_offset;
|
|
213
|
+
let frame_crop_bottom_offset;
|
|
214
|
+
if (frame_cropping_flag) {
|
|
215
|
+
frame_crop_left_offset = reader.decodeExponentialGolombNumber();
|
|
216
|
+
frame_crop_right_offset = reader.decodeExponentialGolombNumber();
|
|
217
|
+
frame_crop_top_offset = reader.decodeExponentialGolombNumber();
|
|
218
|
+
frame_crop_bottom_offset = reader.decodeExponentialGolombNumber();
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
frame_crop_left_offset = 0;
|
|
222
|
+
frame_crop_right_offset = 0;
|
|
223
|
+
frame_crop_top_offset = 0;
|
|
224
|
+
frame_crop_bottom_offset = 0;
|
|
225
|
+
}
|
|
226
|
+
const vui_parameters_present_flag = !!reader.next();
|
|
227
|
+
if (vui_parameters_present_flag) {
|
|
228
|
+
// TODO
|
|
229
|
+
// vui_parameters( )
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
profile_idc,
|
|
233
|
+
constraint_set,
|
|
234
|
+
constraint_set0_flag,
|
|
235
|
+
constraint_set1_flag,
|
|
236
|
+
constraint_set2_flag,
|
|
237
|
+
constraint_set3_flag,
|
|
238
|
+
constraint_set4_flag,
|
|
239
|
+
constraint_set5_flag,
|
|
240
|
+
level_idc,
|
|
241
|
+
seq_parameter_set_id,
|
|
242
|
+
pic_width_in_mbs_minus1,
|
|
243
|
+
pic_height_in_map_units_minus1,
|
|
244
|
+
frame_mbs_only_flag,
|
|
245
|
+
frame_cropping_flag,
|
|
246
|
+
frame_crop_left_offset,
|
|
247
|
+
frame_crop_right_offset,
|
|
248
|
+
frame_crop_top_offset,
|
|
249
|
+
frame_crop_bottom_offset,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
throw new Error('Invalid data');
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=sps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sps.js","sourceRoot":"","sources":["../../../src/options/1_16/sps.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,yBAAyB;AAEzB,MAAM,SAAS;IAOX,YAAmB,MAAkB;QAJ7B,iBAAY,GAAG,CAAC,CAAC;QAEjB,gBAAW,GAAG,CAAC,CAAC;QAGpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAEM,IAAI,CAAC,MAAc;QACtB,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAChC,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;SACxC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAEM,IAAI;QACP,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC;QAC9E,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC;QACtB,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,EAAE;YACxB,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC;YACvB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;SACxB;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,6BAA6B;QAChC,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,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,uBAAuB,GAAG,MAAM,CAAC,6BAA6B,EAAE,CAAC;YACjE,qBAAqB,GAAG,MAAM,CAAC,6BAA6B,EAAE,CAAC;YAC/D,wBAAwB,GAAG,MAAM,CAAC,6BAA6B,EAAE,CAAC;SACrE;aAAM;YACH,sBAAsB,GAAG,CAAC,CAAC;YAC3B,uBAAuB,GAAG,CAAC,CAAC;YAC5B,qBAAqB,GAAG,CAAC,CAAC;YAC1B,wBAAwB,GAAG,CAAC,CAAC;SAChC;QAED,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACpD,IAAI,2BAA2B,EAAE;YAC7B,OAAO;YACP,oBAAoB;SACvB;QAED,OAAO;YACH,WAAW;YACX,cAAc;YACd,oBAAoB;YACpB,oBAAoB;YACpB,oBAAoB;YACpB,oBAAoB;YACpB,oBAAoB;YACpB,oBAAoB;YACpB,SAAS;YACT,oBAAoB;YACpB,uBAAuB;YACvB,8BAA8B;YAC9B,mBAAmB;YACnB,mBAAmB;YACnB,sBAAsB;YACtB,uBAAuB;YACvB,qBAAqB;YACrB,wBAAwB;SAC3B,CAAC;KACL;IAED,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Struct from "@yume-chan/struct";
|
|
2
|
+
import type { AndroidKeyEventAction } from "../message.js";
|
|
3
|
+
import { ScrcpyOptions1_16, type ScrcpyOptionsInit1_16 } from "./1_16/index.js";
|
|
4
|
+
export interface ScrcpyOptionsInit1_18 extends ScrcpyOptionsInit1_16 {
|
|
5
|
+
powerOffOnClose: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const ScrcpyBackOrScreenOnEvent1_18: Struct<{
|
|
8
|
+
type: import("../message.js").ScrcpyControlMessageType.BackOrScreenOn;
|
|
9
|
+
action: AndroidKeyEventAction;
|
|
10
|
+
}, never, {}, undefined>;
|
|
11
|
+
export declare type ScrcpyBackOrScreenOnEvent1_18 = typeof ScrcpyBackOrScreenOnEvent1_18["TInit"];
|
|
12
|
+
export declare class ScrcpyOptions1_18<T extends ScrcpyOptionsInit1_18 = ScrcpyOptionsInit1_18> extends ScrcpyOptions1_16<T> {
|
|
13
|
+
constructor(value: Partial<ScrcpyOptionsInit1_18>);
|
|
14
|
+
protected getArgumentOrder(): (keyof T)[];
|
|
15
|
+
protected getDefaultValue(): T;
|
|
16
|
+
getOutputEncoderNameRegex(): RegExp;
|
|
17
|
+
serializeBackOrScreenOnControlMessage(message: ScrcpyBackOrScreenOnEvent1_18): Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=1_18.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_18.d.ts","sourceRoot":"","sources":["../../src/options/1_18.ts"],"names":[],"mappings":"AAAA,OAAO,MAAuB,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAiC,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE/G,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAChE,eAAe,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,6BAA6B;;;wBAGoB,CAAC;AAE/D,oBAAY,6BAA6B,GAAG,OAAO,6BAA6B,CAAC,OAAO,CAAC,CAAC;AAE1F,qBAAa,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;gBACpG,KAAK,EAAE,OAAO,CAAC,qBAAqB,CAAC;cAI9B,gBAAgB,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE;cAI/B,eAAe,IAAI,CAAC;IAOvB,yBAAyB,IAAI,MAAM;IAInC,qCAAqC,CACjD,OAAO,EAAE,6BAA6B;CAI7C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Struct, { placeholder } from "@yume-chan/struct";
|
|
2
|
+
import { ScrcpyBackOrScreenOnEvent1_16, ScrcpyOptions1_16 } from "./1_16/index.js";
|
|
3
|
+
export const ScrcpyBackOrScreenOnEvent1_18 = new Struct()
|
|
4
|
+
.fields(ScrcpyBackOrScreenOnEvent1_16)
|
|
5
|
+
.uint8('action', placeholder());
|
|
6
|
+
export class ScrcpyOptions1_18 extends ScrcpyOptions1_16 {
|
|
7
|
+
constructor(value) {
|
|
8
|
+
super(value);
|
|
9
|
+
}
|
|
10
|
+
getArgumentOrder() {
|
|
11
|
+
return super.getArgumentOrder().concat(['powerOffOnClose']);
|
|
12
|
+
}
|
|
13
|
+
getDefaultValue() {
|
|
14
|
+
return Object.assign(Object.assign({}, super.getDefaultValue()), { powerOffOnClose: false });
|
|
15
|
+
}
|
|
16
|
+
getOutputEncoderNameRegex() {
|
|
17
|
+
return /\s+scrcpy --encoder '(.*?)'/;
|
|
18
|
+
}
|
|
19
|
+
serializeBackOrScreenOnControlMessage(message) {
|
|
20
|
+
return ScrcpyBackOrScreenOnEvent1_18.serialize(message);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=1_18.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_18.js","sourceRoot":"","sources":["../../src/options/1_18.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,6BAA6B,EAAE,iBAAiB,EAA8B,MAAM,iBAAiB,CAAC;AAM/G,MAAM,CAAC,MAAM,6BAA6B,GACtC,IAAI,MAAM,EAAE;KACP,MAAM,CAAC,6BAA6B,CAAC;KACrC,KAAK,CAAC,QAAQ,EAAE,WAAW,EAAyB,CAAC,CAAC;AAI/D,MAAM,OAAO,iBAA2E,SAAQ,iBAAoB;IAChH,YAAY,KAAqC;QAC7C,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEkB,gBAAgB;QAC/B,OAAO,KAAK,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAChE,CAAC;IAEkB,eAAe;QAC9B,uCACO,KAAK,CAAC,eAAe,EAAE,KAC1B,eAAe,EAAE,KAAK,IACxB;IACN,CAAC;IAEe,yBAAyB;QACrC,OAAO,6BAA6B,CAAC;IACzC,CAAC;IAEe,qCAAqC,CACjD,OAAsC;QAEtC,OAAO,6BAA6B,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5D,CAAC;CACJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ScrcpyOptions1_18, type ScrcpyOptionsInit1_18 } from './1_18.js';
|
|
2
|
+
export interface ScrcpyOptionsInit1_21 extends ScrcpyOptionsInit1_18 {
|
|
3
|
+
clipboardAutosync?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare class ScrcpyOptions1_21<T extends ScrcpyOptionsInit1_21 = ScrcpyOptionsInit1_21> extends ScrcpyOptions1_18<T> {
|
|
6
|
+
constructor(init: Partial<ScrcpyOptionsInit1_21>);
|
|
7
|
+
protected getDefaultValue(): T;
|
|
8
|
+
formatServerArguments(): string[];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=1_21.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_21.d.ts","sourceRoot":"","sources":["../../src/options/1_21.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAG1E,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAChE,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAMD,qBAAa,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;gBAC7F,IAAI,EAAE,OAAO,CAAC,qBAAqB,CAAC;cAIpC,eAAe,IAAI,CAAC;IAOvB,qBAAqB,IAAI,MAAM,EAAE;CAQpD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// cspell: ignore autosync
|
|
2
|
+
import { ScrcpyOptions1_18 } from './1_18.js';
|
|
3
|
+
import { toScrcpyOptionValue } from "./common.js";
|
|
4
|
+
function toSnakeCase(input) {
|
|
5
|
+
return input.replace(/([A-Z])/g, '_$1').toLowerCase();
|
|
6
|
+
}
|
|
7
|
+
export class ScrcpyOptions1_21 extends ScrcpyOptions1_18 {
|
|
8
|
+
constructor(init) {
|
|
9
|
+
super(init);
|
|
10
|
+
}
|
|
11
|
+
getDefaultValue() {
|
|
12
|
+
return Object.assign(Object.assign({}, super.getDefaultValue()), { clipboardAutosync: true });
|
|
13
|
+
}
|
|
14
|
+
formatServerArguments() {
|
|
15
|
+
// 1.21 changed the format of arguments
|
|
16
|
+
// So `getArgumentOrder()` is no longer needed
|
|
17
|
+
return Object.entries(this.value)
|
|
18
|
+
.map(([key, value]) => [key, toScrcpyOptionValue(value, undefined)])
|
|
19
|
+
.filter((pair) => pair[1] !== undefined)
|
|
20
|
+
.map(([key, value]) => `${toSnakeCase(key)}=${value}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=1_21.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_21.js","sourceRoot":"","sources":["../../src/options/1_21.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAE,iBAAiB,EAA8B,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAMlD,SAAS,WAAW,CAAC,KAAa;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,OAAO,iBAA2E,SAAQ,iBAAoB;IAChH,YAAmB,IAAoC;QACnD,KAAK,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEkB,eAAe;QAC9B,uCACO,KAAK,CAAC,eAAe,EAAE,KAC1B,iBAAiB,EAAE,IAAI,IACzB;IACN,CAAC;IAEe,qBAAqB;QACjC,uCAAuC;QACvC,8CAA8C;QAC9C,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;aAC5B,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,mBAAmB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAU,CAAC;aAC5E,MAAM,CAAC,CAAC,IAAI,EAA4B,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;aACjE,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IAC/D,CAAC;CACJ"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Adb } from "@yume-chan/adb";
|
|
2
|
+
import Struct from "@yume-chan/struct";
|
|
3
|
+
import { type ScrcpyClientConnection } from "../connection.js";
|
|
4
|
+
import { ScrcpyOptions1_21, type ScrcpyOptionsInit1_21 } from "./1_21.js";
|
|
5
|
+
export interface ScrcpyOptionsInit1_22 extends ScrcpyOptionsInit1_21 {
|
|
6
|
+
downsizeOnError: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Send device name and size
|
|
9
|
+
*
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
sendDeviceMeta: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Write a byte on start to detect connection issues
|
|
15
|
+
*
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
sendDummyByte: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Implies `sendDeviceMeta: false`, `sendFrameMeta: false` and `sendDummyByte: false`
|
|
21
|
+
*
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
rawVideoStream: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare const ScrcpyInjectScrollControlMessage1_22: Struct<{
|
|
27
|
+
type: import("../message.js").ScrcpyControlMessageType.InjectScroll;
|
|
28
|
+
pointerX: number;
|
|
29
|
+
pointerY: number;
|
|
30
|
+
screenWidth: number;
|
|
31
|
+
screenHeight: number;
|
|
32
|
+
scrollX: number;
|
|
33
|
+
scrollY: number;
|
|
34
|
+
buttons: number;
|
|
35
|
+
}, never, {}, undefined>;
|
|
36
|
+
export declare type ScrcpyInjectScrollControlMessage1_22 = typeof ScrcpyInjectScrollControlMessage1_22["TInit"];
|
|
37
|
+
export declare class ScrcpyOptions1_22<T extends ScrcpyOptionsInit1_22 = ScrcpyOptionsInit1_22> extends ScrcpyOptions1_21<T> {
|
|
38
|
+
constructor(init: Partial<ScrcpyOptionsInit1_22>);
|
|
39
|
+
protected getDefaultValue(): T;
|
|
40
|
+
createConnection(device: Adb): ScrcpyClientConnection;
|
|
41
|
+
serializeInjectScrollControlMessage(message: ScrcpyInjectScrollControlMessage1_22): Uint8Array;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=1_22.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_22.d.ts","sourceRoot":"","sources":["../../src/options/1_22.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAgE,KAAK,sBAAsB,EAAsC,MAAM,kBAAkB,CAAC;AAEjK,OAAO,EAAE,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAE1E,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAChE,eAAe,EAAE,OAAO,CAAC;IAEzB;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,oCAAoC;;;;;;;;;wBAGxB,CAAC;AAE1B,oBAAY,oCAAoC,GAAG,OAAO,oCAAoC,CAAC,OAAO,CAAC,CAAC;AAExG,qBAAa,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;gBAC7F,IAAI,EAAE,OAAO,CAAC,qBAAqB,CAAC;cAWpC,eAAe,IAAI,CAAC;IAUvB,gBAAgB,CAAC,MAAM,EAAE,GAAG,GAAG,sBAAsB;IAcrD,mCAAmC,CAC/C,OAAO,EAAE,oCAAoC,GAC9C,UAAU;CAGhB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Struct from "@yume-chan/struct";
|
|
2
|
+
import { ScrcpyClientForwardConnection, ScrcpyClientReverseConnection } from "../connection.js";
|
|
3
|
+
import { ScrcpyInjectScrollControlMessage1_16 } from "./1_16/index.js";
|
|
4
|
+
import { ScrcpyOptions1_21 } from "./1_21.js";
|
|
5
|
+
export const ScrcpyInjectScrollControlMessage1_22 = new Struct()
|
|
6
|
+
.fields(ScrcpyInjectScrollControlMessage1_16)
|
|
7
|
+
.int32("buttons");
|
|
8
|
+
export class ScrcpyOptions1_22 extends ScrcpyOptions1_21 {
|
|
9
|
+
constructor(init) {
|
|
10
|
+
if (init.rawVideoStream) {
|
|
11
|
+
// Set implied options for client-side processing
|
|
12
|
+
init.sendDeviceMeta = false;
|
|
13
|
+
init.sendFrameMeta = false;
|
|
14
|
+
init.sendDummyByte = false;
|
|
15
|
+
}
|
|
16
|
+
super(init);
|
|
17
|
+
}
|
|
18
|
+
getDefaultValue() {
|
|
19
|
+
return Object.assign(Object.assign({}, super.getDefaultValue()), { downsizeOnError: true, sendDeviceMeta: true, sendDummyByte: true, rawVideoStream: false });
|
|
20
|
+
}
|
|
21
|
+
createConnection(device) {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
const defaultValue = this.getDefaultValue();
|
|
24
|
+
const options = {
|
|
25
|
+
control: (_a = this.value.control) !== null && _a !== void 0 ? _a : defaultValue.control,
|
|
26
|
+
sendDummyByte: (_b = this.value.sendDummyByte) !== null && _b !== void 0 ? _b : defaultValue.sendDummyByte,
|
|
27
|
+
sendDeviceMeta: (_c = this.value.sendDeviceMeta) !== null && _c !== void 0 ? _c : defaultValue.sendDeviceMeta,
|
|
28
|
+
};
|
|
29
|
+
if (this.value.tunnelForward) {
|
|
30
|
+
return new ScrcpyClientForwardConnection(device, options);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return new ScrcpyClientReverseConnection(device, options);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
serializeInjectScrollControlMessage(message) {
|
|
37
|
+
return ScrcpyInjectScrollControlMessage1_22.serialize(message);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=1_22.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_22.js","sourceRoot":"","sources":["../../src/options/1_22.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,6BAA6B,EAAE,6BAA6B,EAAmE,MAAM,kBAAkB,CAAC;AACjK,OAAO,EAAE,oCAAoC,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAA8B,MAAM,WAAW,CAAC;AA2B1E,MAAM,CAAC,MAAM,oCAAoC,GAC7C,IAAI,MAAM,EAAE;KACP,MAAM,CAAC,oCAAoC,CAAC;KAC5C,KAAK,CAAC,SAAS,CAAC,CAAC;AAI1B,MAAM,OAAO,iBAA2E,SAAQ,iBAAoB;IAChH,YAAmB,IAAoC;QACnD,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,iDAAiD;YACjD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;YAC5B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC3B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;SAC9B;QAED,KAAK,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEkB,eAAe;QAC9B,uCACO,KAAK,CAAC,eAAe,EAAE,KAC1B,eAAe,EAAE,IAAI,EACrB,cAAc,EAAE,IAAI,EACpB,aAAa,EAAE,IAAI,EACnB,cAAc,EAAE,KAAK,IACvB;IACN,CAAC;IAEe,gBAAgB,CAAC,MAAW;;QACxC,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAC5C,MAAM,OAAO,GAAkC;YAC3C,OAAO,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,OAAO,mCAAI,YAAY,CAAC,OAAO;YACnD,aAAa,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,aAAa,mCAAI,YAAY,CAAC,aAAa;YACrE,cAAc,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,cAAc,mCAAI,YAAY,CAAC,cAAc;SAC3E,CAAC;QACF,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE;YAC1B,OAAO,IAAI,6BAA6B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SAC7D;aAAM;YACH,OAAO,IAAI,6BAA6B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SAC7D;IACL,CAAC;IAEe,mCAAmC,CAC/C,OAA6C;QAE7C,OAAO,oCAAoC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC;CACJ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Adb, AdbBufferedStream, ReadableStream } from "@yume-chan/adb";
|
|
2
|
+
import type { ScrcpyClientConnection } from "../connection.js";
|
|
3
|
+
import type { H264Configuration } from "../decoder/index.js";
|
|
4
|
+
import type { ScrcpyBackOrScreenOnEvent1_18 } from "./1_18.js";
|
|
5
|
+
import type { ScrcpyInjectScrollControlMessage1_22 } from "./1_22.js";
|
|
6
|
+
export declare const DEFAULT_SERVER_PATH = "/data/local/tmp/scrcpy-server.jar";
|
|
7
|
+
export interface ScrcpyOptionValue {
|
|
8
|
+
toOptionValue(): string | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function isScrcpyOptionValue(value: any): value is ScrcpyOptionValue;
|
|
11
|
+
export declare function toScrcpyOptionValue<T>(value: any, empty: T): string | T;
|
|
12
|
+
export interface VideoStreamConfigurationPacket {
|
|
13
|
+
type: 'configuration';
|
|
14
|
+
data: H264Configuration;
|
|
15
|
+
}
|
|
16
|
+
export interface VideoStreamFramePacket {
|
|
17
|
+
type: 'frame';
|
|
18
|
+
data: Uint8Array;
|
|
19
|
+
}
|
|
20
|
+
export declare type VideoStreamPacket = VideoStreamConfigurationPacket | VideoStreamFramePacket;
|
|
21
|
+
export interface ScrcpyOptions<T> {
|
|
22
|
+
value: Partial<T>;
|
|
23
|
+
formatServerArguments(): string[];
|
|
24
|
+
getOutputEncoderNameRegex(): RegExp;
|
|
25
|
+
createConnection(adb: Adb): ScrcpyClientConnection;
|
|
26
|
+
parseVideoStream(stream: AdbBufferedStream): ReadableStream<VideoStreamPacket>;
|
|
27
|
+
serializeBackOrScreenOnControlMessage(message: ScrcpyBackOrScreenOnEvent1_18): Uint8Array | undefined;
|
|
28
|
+
serializeInjectScrollControlMessage(message: ScrcpyInjectScrollControlMessage1_22): Uint8Array;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/options/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,E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
export function isScrcpyOptionValue(value) {
|
|
3
|
+
return typeof value === 'object' &&
|
|
4
|
+
value !== null &&
|
|
5
|
+
typeof value.toOptionValue === 'function';
|
|
6
|
+
}
|
|
7
|
+
export function toScrcpyOptionValue(value, empty) {
|
|
8
|
+
if (isScrcpyOptionValue(value)) {
|
|
9
|
+
value = value.toOptionValue();
|
|
10
|
+
}
|
|
11
|
+
if (value === undefined) {
|
|
12
|
+
return empty;
|
|
13
|
+
}
|
|
14
|
+
return `${value}`;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/options/common.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,mBAAmB,GAAG,mCAAmC,CAAC;AAMvE,MAAM,UAAU,mBAAmB,CAAC,KAAU;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ;QAC5B,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,CAAC,aAAa,KAAK,UAAU,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAI,KAAU,EAAE,KAAQ;IACvD,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE;QAC5B,KAAK,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;KACjC;IAED,IAAI,KAAK,KAAK,SAAS,EAAE;QACrB,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,GAAG,KAAK,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Adb, AdbSync, WrapWritableStream, WritableStream } from "@yume-chan/adb";
|
|
2
|
+
export interface PushServerOptions {
|
|
3
|
+
path?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function pushServer(device: Adb, options?: PushServerOptions): WrapWritableStream<Uint8Array, WritableStream<Uint8Array>, AdbSync>;
|
|
6
|
+
//# sourceMappingURL=push-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-server.d.ts","sourceRoot":"","sources":["../src/push-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGlF,MAAM,WAAW,iBAAiB;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,CACtB,MAAM,EAAE,GAAG,EACX,OAAO,GAAE,iBAAsB,uEAgBlC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { WrapWritableStream } from "@yume-chan/adb";
|
|
3
|
+
import { DEFAULT_SERVER_PATH } from "./options/index.js";
|
|
4
|
+
export function pushServer(device, options = {}) {
|
|
5
|
+
const { path = DEFAULT_SERVER_PATH } = options;
|
|
6
|
+
return new WrapWritableStream({
|
|
7
|
+
start() {
|
|
8
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const sync = yield device.sync();
|
|
10
|
+
return {
|
|
11
|
+
writable: sync.write(path),
|
|
12
|
+
state: sync,
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
close(sync) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
yield sync.dispose();
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=push-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-server.js","sourceRoot":"","sources":["../src/push-server.ts"],"names":[],"mappings":";AAAA,OAAO,EAAgB,kBAAkB,EAAkB,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAMzD,MAAM,UAAU,UAAU,CACtB,MAAW,EACX,UAA6B,EAAE;IAE/B,MAAM,EAAE,IAAI,GAAG,mBAAmB,EAAE,GAAG,OAAO,CAAC;IAE/C,OAAO,IAAI,kBAAkB,CAAkD;QACrE,KAAK;;gBACP,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;gBACjC,OAAO;oBACH,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;oBAC1B,KAAK,EAAE,IAAI;iBACd,CAAC;YACN,CAAC;SAAA;QACK,KAAK,CAAC,IAAI;;gBACZ,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;YACzB,CAAC;SAAA;KACJ,CAAC,CAAC;AACP,CAAC"}
|
package/esm/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjD;AAKD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAErD;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAEtD"}
|
package/esm/utils.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function delay(time) {
|
|
2
|
+
return new Promise(resolve => {
|
|
3
|
+
globalThis.setTimeout(resolve, time);
|
|
4
|
+
});
|
|
5
|
+
}
|
|
6
|
+
const Utf8Encoder = new TextEncoder();
|
|
7
|
+
const Utf8Decoder = new TextDecoder();
|
|
8
|
+
export function encodeUtf8(input) {
|
|
9
|
+
return Utf8Encoder.encode(input).buffer;
|
|
10
|
+
}
|
|
11
|
+
export function decodeUtf8(buffer) {
|
|
12
|
+
return Utf8Decoder.decode(buffer);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=utils.js.map
|
package/esm/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAC,IAAY;IAC9B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QACxB,UAAkB,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC,MAAM,UAAU,UAAU,CAAC,KAAa;IACpC,OAAO,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAmB;IAC1C,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC"}
|