@yume-chan/scrcpy 1.1.0 → 2.0.1
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.md +26 -0
- package/LICENSE +1 -1
- package/esm/1_15/impl/back-or-screen-on.d.ts +1 -1
- package/esm/1_15/impl/clipboard-stream.d.ts +3 -3
- package/esm/1_15/impl/inject-touch.d.ts +9 -9
- package/esm/1_15/impl/inject-touch.d.ts.map +1 -1
- package/esm/1_15/impl/inject-touch.js +14 -18
- package/esm/1_15/impl/inject-touch.js.map +1 -1
- package/esm/1_15/impl/media-stream-transformer.d.ts +3 -3
- package/esm/1_15/impl/scroll-controller.d.ts +5 -5
- package/esm/1_15/impl/scroll-controller.js +2 -2
- package/esm/1_15/impl/scroll-controller.js.map +1 -1
- package/esm/1_15/impl/set-clipboard.d.ts +3 -3
- package/esm/1_15/index.d.ts +0 -1
- package/esm/1_15/index.d.ts.map +1 -1
- package/esm/1_15/index.js +0 -1
- package/esm/1_15/index.js.map +1 -1
- package/esm/1_15/options.d.ts +3 -4
- package/esm/1_15/options.d.ts.map +1 -1
- package/esm/1_15/options.js +1 -3
- package/esm/1_15/options.js.map +1 -1
- package/esm/1_15_1.d.ts +4 -2
- package/esm/1_15_1.d.ts.map +1 -1
- package/esm/1_15_1.js +2 -3
- package/esm/1_15_1.js.map +1 -1
- package/esm/1_16.d.ts +4 -2
- package/esm/1_16.d.ts.map +1 -1
- package/esm/1_16.js +2 -3
- package/esm/1_16.js.map +1 -1
- package/esm/1_17/index.d.ts +0 -1
- package/esm/1_17/index.d.ts.map +1 -1
- package/esm/1_17/index.js +0 -1
- package/esm/1_17/index.js.map +1 -1
- package/esm/1_17/options.d.ts +5 -6
- package/esm/1_17/options.d.ts.map +1 -1
- package/esm/1_17/options.js +1 -3
- package/esm/1_17/options.js.map +1 -1
- package/esm/1_18/impl/back-or-screen-on.d.ts +5 -3
- package/esm/1_18/impl/back-or-screen-on.d.ts.map +1 -1
- package/esm/1_18/impl/back-or-screen-on.js +2 -5
- package/esm/1_18/impl/back-or-screen-on.js.map +1 -1
- package/esm/1_18/index.d.ts +0 -1
- package/esm/1_18/index.d.ts.map +1 -1
- package/esm/1_18/index.js +0 -1
- package/esm/1_18/index.js.map +1 -1
- package/esm/1_18/options.d.ts +5 -6
- package/esm/1_18/options.d.ts.map +1 -1
- package/esm/1_18/options.js +1 -3
- package/esm/1_18/options.js.map +1 -1
- package/esm/1_19.d.ts +4 -2
- package/esm/1_19.d.ts.map +1 -1
- package/esm/1_19.js +2 -3
- package/esm/1_19.js.map +1 -1
- package/esm/1_20.d.ts +4 -2
- package/esm/1_20.d.ts.map +1 -1
- package/esm/1_20.js +2 -3
- package/esm/1_20.js.map +1 -1
- package/esm/1_21/impl/set-clipboard.d.ts +6 -6
- package/esm/1_21/index.d.ts +0 -1
- package/esm/1_21/index.d.ts.map +1 -1
- package/esm/1_21/index.js +0 -1
- package/esm/1_21/index.js.map +1 -1
- package/esm/1_21/options.d.ts +5 -6
- package/esm/1_21/options.d.ts.map +1 -1
- package/esm/1_21/options.js +1 -3
- package/esm/1_21/options.js.map +1 -1
- package/esm/1_22/impl/scroll-controller.d.ts +8 -6
- package/esm/1_22/impl/scroll-controller.d.ts.map +1 -1
- package/esm/1_22/impl/scroll-controller.js +2 -5
- package/esm/1_22/impl/scroll-controller.js.map +1 -1
- package/esm/1_22/index.d.ts +0 -1
- package/esm/1_22/index.d.ts.map +1 -1
- package/esm/1_22/index.js +0 -1
- package/esm/1_22/index.js.map +1 -1
- package/esm/1_22/options.d.ts +5 -6
- package/esm/1_22/options.d.ts.map +1 -1
- package/esm/1_22/options.js +1 -3
- package/esm/1_22/options.js.map +1 -1
- package/esm/1_23/index.d.ts +0 -1
- package/esm/1_23/index.d.ts.map +1 -1
- package/esm/1_23/index.js +0 -1
- package/esm/1_23/index.js.map +1 -1
- package/esm/1_23/options.d.ts +5 -6
- package/esm/1_23/options.d.ts.map +1 -1
- package/esm/1_23/options.js +1 -3
- package/esm/1_23/options.js.map +1 -1
- package/esm/1_24/index.d.ts +0 -1
- package/esm/1_24/index.d.ts.map +1 -1
- package/esm/1_24/index.js +0 -1
- package/esm/1_24/index.js.map +1 -1
- package/esm/1_24/options.d.ts +5 -6
- package/esm/1_24/options.d.ts.map +1 -1
- package/esm/1_24/options.js +1 -3
- package/esm/1_24/options.js.map +1 -1
- package/esm/1_25/impl/scroll-controller.d.ts +11 -11
- package/esm/1_25/impl/scroll-controller.d.ts.map +1 -1
- package/esm/1_25/impl/scroll-controller.js +14 -18
- package/esm/1_25/impl/scroll-controller.js.map +1 -1
- package/esm/1_25/index.d.ts +0 -1
- package/esm/1_25/index.d.ts.map +1 -1
- package/esm/1_25/index.js +0 -1
- package/esm/1_25/index.js.map +1 -1
- package/esm/1_25/options.d.ts +5 -6
- package/esm/1_25/options.d.ts.map +1 -1
- package/esm/1_25/options.js +1 -3
- package/esm/1_25/options.js.map +1 -1
- package/esm/2_0/impl/inject-touch.d.ts +11 -11
- package/esm/2_0/impl/inject-touch.js +2 -2
- package/esm/2_0/impl/inject-touch.js.map +1 -1
- package/esm/2_0/impl/parse-audio-stream-metadata.d.ts +1 -1
- package/esm/2_0/impl/parse-audio-stream-metadata.d.ts.map +1 -1
- package/esm/2_0/impl/parse-audio-stream-metadata.js.map +1 -1
- package/esm/2_0/index.d.ts +0 -1
- package/esm/2_0/index.d.ts.map +1 -1
- package/esm/2_0/index.js +0 -1
- package/esm/2_0/index.js.map +1 -1
- package/esm/2_0/options.d.ts +5 -6
- package/esm/2_0/options.d.ts.map +1 -1
- package/esm/2_0/options.js +1 -3
- package/esm/2_0/options.js.map +1 -1
- package/esm/2_1/impl/defaults.d.ts.map +1 -1
- package/esm/2_1/impl/defaults.js.map +1 -1
- package/esm/2_1/impl/init.d.ts +2 -2
- package/esm/2_1/impl/init.d.ts.map +1 -1
- package/esm/2_1/index.d.ts +0 -1
- package/esm/2_1/index.d.ts.map +1 -1
- package/esm/2_1/index.js +0 -1
- package/esm/2_1/index.js.map +1 -1
- package/esm/2_1/options.d.ts +8 -9
- package/esm/2_1/options.d.ts.map +1 -1
- package/esm/2_1/options.js +1 -3
- package/esm/2_1/options.js.map +1 -1
- package/esm/2_1_1.d.ts +5 -3
- package/esm/2_1_1.d.ts.map +1 -1
- package/esm/2_1_1.js +2 -3
- package/esm/2_1_1.js.map +1 -1
- package/esm/2_2/impl/defaults.d.ts.map +1 -1
- package/esm/2_2/impl/defaults.js.map +1 -1
- package/esm/2_2/impl/init.d.ts +1 -1
- package/esm/2_2/impl/init.d.ts.map +1 -1
- package/esm/2_2/index.d.ts +0 -1
- package/esm/2_2/index.d.ts.map +1 -1
- package/esm/2_2/index.js +0 -1
- package/esm/2_2/index.js.map +1 -1
- package/esm/2_2/options.d.ts +8 -9
- package/esm/2_2/options.d.ts.map +1 -1
- package/esm/2_2/options.js +1 -3
- package/esm/2_2/options.js.map +1 -1
- package/esm/2_3/impl/init.d.ts +2 -2
- package/esm/2_3/impl/init.d.ts.map +1 -1
- package/esm/2_3/index.d.ts +0 -1
- package/esm/2_3/index.d.ts.map +1 -1
- package/esm/2_3/index.js +0 -1
- package/esm/2_3/index.js.map +1 -1
- package/esm/2_3/options.d.ts +8 -9
- package/esm/2_3/options.d.ts.map +1 -1
- package/esm/2_3/options.js +1 -3
- package/esm/2_3/options.js.map +1 -1
- package/esm/2_3_1.d.ts +5 -3
- package/esm/2_3_1.d.ts.map +1 -1
- package/esm/2_3_1.js +2 -3
- package/esm/2_3_1.js.map +1 -1
- package/esm/2_4/impl/serialize-uhid-create.d.ts +3 -3
- package/esm/2_4/impl/uhid-output-stream.d.ts +3 -3
- package/esm/2_4/index.d.ts +0 -1
- package/esm/2_4/index.d.ts.map +1 -1
- package/esm/2_4/index.js +0 -1
- package/esm/2_4/index.js.map +1 -1
- package/esm/2_4/options.d.ts +8 -9
- package/esm/2_4/options.d.ts.map +1 -1
- package/esm/2_4/options.js +1 -3
- package/esm/2_4/options.js.map +1 -1
- package/esm/2_5.d.ts +5 -3
- package/esm/2_5.d.ts.map +1 -1
- package/esm/2_5.js +2 -3
- package/esm/2_5.js.map +1 -1
- package/esm/2_6/impl/defaults.d.ts.map +1 -1
- package/esm/2_6/impl/defaults.js.map +1 -1
- package/esm/2_6/impl/init.d.ts +2 -2
- package/esm/2_6/impl/init.d.ts.map +1 -1
- package/esm/2_6/index.d.ts +0 -1
- package/esm/2_6/index.d.ts.map +1 -1
- package/esm/2_6/index.js +0 -1
- package/esm/2_6/index.js.map +1 -1
- package/esm/2_6/options.d.ts +8 -9
- package/esm/2_6/options.d.ts.map +1 -1
- package/esm/2_6/options.js +1 -3
- package/esm/2_6/options.js.map +1 -1
- package/esm/2_6_1.d.ts +5 -3
- package/esm/2_6_1.d.ts.map +1 -1
- package/esm/2_6_1.js +2 -3
- package/esm/2_6_1.js.map +1 -1
- package/esm/2_7/impl/serialize-uhid-create.d.ts +7 -7
- package/esm/2_7/index.d.ts +0 -1
- package/esm/2_7/index.d.ts.map +1 -1
- package/esm/2_7/index.js +0 -1
- package/esm/2_7/index.js.map +1 -1
- package/esm/2_7/options.d.ts +8 -9
- package/esm/2_7/options.d.ts.map +1 -1
- package/esm/2_7/options.js +1 -3
- package/esm/2_7/options.js.map +1 -1
- package/esm/3_0/impl/defaults.d.ts.map +1 -1
- package/esm/3_0/impl/defaults.js.map +1 -1
- package/esm/3_0/impl/init.d.ts +1 -1
- package/esm/3_0/impl/init.d.ts.map +1 -1
- package/esm/3_0/index.d.ts +0 -1
- package/esm/3_0/index.d.ts.map +1 -1
- package/esm/3_0/index.js +0 -1
- package/esm/3_0/index.js.map +1 -1
- package/esm/3_0/options.d.ts +8 -9
- package/esm/3_0/options.d.ts.map +1 -1
- package/esm/3_0/options.js +1 -3
- package/esm/3_0/options.js.map +1 -1
- package/esm/3_0_1.d.ts +5 -3
- package/esm/3_0_1.d.ts.map +1 -1
- package/esm/3_0_1.js +2 -3
- package/esm/3_0_1.js.map +1 -1
- package/esm/3_0_2.d.ts +5 -3
- package/esm/3_0_2.d.ts.map +1 -1
- package/esm/3_0_2.js +2 -3
- package/esm/3_0_2.js.map +1 -1
- package/esm/3_1/impl/defaults.d.ts.map +1 -1
- package/esm/3_1/impl/defaults.js.map +1 -1
- package/esm/3_1/impl/init.d.ts +1 -1
- package/esm/3_1/impl/init.d.ts.map +1 -1
- package/esm/3_1/impl/serialize-uhid-create.d.ts +7 -7
- package/esm/3_1/index.d.ts +0 -1
- package/esm/3_1/index.d.ts.map +1 -1
- package/esm/3_1/index.js +0 -1
- package/esm/3_1/index.js.map +1 -1
- package/esm/3_1/options.d.ts +8 -9
- package/esm/3_1/options.d.ts.map +1 -1
- package/esm/3_1/options.js +1 -3
- package/esm/3_1/options.js.map +1 -1
- package/esm/android/key-event.d.ts.map +1 -1
- package/esm/android/key-event.js +3 -2
- package/esm/android/key-event.js.map +1 -1
- package/esm/base/options.d.ts +6 -5
- package/esm/base/options.d.ts.map +1 -1
- package/esm/codec/h265.d.ts +23 -2
- package/esm/codec/h265.d.ts.map +1 -1
- package/esm/codec/h265.js +25 -3
- package/esm/codec/h265.js.map +1 -1
- package/esm/control/empty.d.ts +1 -1
- package/esm/control/inject-key-code.d.ts +9 -9
- package/esm/control/inject-text.d.ts +3 -3
- package/esm/control/set-screen-power-mode.d.ts +3 -3
- package/esm/control/start-app.d.ts +3 -3
- package/esm/control/uhid.d.ts +6 -6
- package/esm/latest.d.ts +5 -3
- package/esm/latest.d.ts.map +1 -1
- package/esm/latest.js +2 -3
- package/esm/latest.js.map +1 -1
- package/esm/utils/index.d.ts +0 -1
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +0 -1
- package/esm/utils/index.js.map +1 -1
- package/package.json +9 -9
- package/src/1_15/impl/inject-touch.ts +13 -12
- package/src/1_15/impl/scroll-controller.ts +2 -2
- package/src/1_15/index.ts +0 -1
- package/src/1_15/options.ts +3 -6
- package/src/1_15_1.ts +5 -3
- package/src/1_16.ts +5 -3
- package/src/1_17/index.ts +0 -1
- package/src/1_17/options.ts +7 -7
- package/src/1_18/impl/back-or-screen-on.ts +5 -9
- package/src/1_18/index.ts +0 -1
- package/src/1_18/options.ts +7 -7
- package/src/1_19.ts +5 -3
- package/src/1_20.ts +5 -3
- package/src/1_21/index.ts +0 -1
- package/src/1_21/options.ts +7 -7
- package/src/1_22/impl/scroll-controller.ts +5 -9
- package/src/1_22/index.ts +0 -1
- package/src/1_22/options.ts +7 -7
- package/src/1_23/index.ts +0 -1
- package/src/1_23/options.ts +7 -7
- package/src/1_24/index.ts +0 -1
- package/src/1_24/options.ts +7 -7
- package/src/1_25/impl/scroll-controller.ts +10 -9
- package/src/1_25/index.ts +0 -1
- package/src/1_25/options.ts +7 -7
- package/src/2_0/impl/inject-touch.ts +2 -2
- package/src/2_0/impl/parse-audio-stream-metadata.ts +1 -1
- package/src/2_0/index.ts +0 -1
- package/src/2_0/options.ts +7 -7
- package/src/2_1/impl/defaults.ts +1 -1
- package/src/2_1/impl/init.ts +2 -2
- package/src/2_1/index.ts +0 -1
- package/src/2_1/options.ts +12 -12
- package/src/2_1_1.ts +9 -4
- package/src/2_2/impl/defaults.ts +1 -1
- package/src/2_2/impl/init.ts +1 -1
- package/src/2_2/index.ts +0 -1
- package/src/2_2/options.ts +12 -12
- package/src/2_3/impl/init.ts +3 -2
- package/src/2_3/index.ts +0 -1
- package/src/2_3/options.ts +12 -12
- package/src/2_3_1.ts +9 -4
- package/src/2_4/index.ts +0 -1
- package/src/2_4/options.ts +12 -12
- package/src/2_5.ts +9 -4
- package/src/2_6/impl/defaults.ts +1 -1
- package/src/2_6/impl/init.ts +3 -2
- package/src/2_6/index.ts +0 -1
- package/src/2_6/options.ts +12 -12
- package/src/2_6_1.ts +9 -4
- package/src/2_7/index.ts +0 -1
- package/src/2_7/options.ts +12 -12
- package/src/3_0/impl/defaults.ts +1 -1
- package/src/3_0/impl/init.ts +2 -1
- package/src/3_0/index.ts +0 -1
- package/src/3_0/options.ts +12 -12
- package/src/3_0_1.ts +9 -4
- package/src/3_0_2.ts +9 -4
- package/src/3_1/impl/defaults.ts +1 -1
- package/src/3_1/impl/init.ts +1 -1
- package/src/3_1/index.ts +0 -1
- package/src/3_1/options.ts +12 -12
- package/src/android/key-event.ts +3 -2
- package/src/base/options.ts +11 -8
- package/src/codec/h265.ts +31 -5
- package/src/latest.ts +9 -4
- package/src/utils/index.ts +0 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/esm/utils/wrapper.d.ts +0 -38
- package/esm/utils/wrapper.d.ts.map +0 -1
- package/esm/utils/wrapper.js +0 -79
- package/esm/utils/wrapper.js.map +0 -1
- package/src/utils/wrapper.ts +0 -135
package/src/1_24/options.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
2
|
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
|
3
|
-
import type { AsyncExactReadable } from "@yume-chan/struct";
|
|
3
|
+
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
ScrcpyControlMessageType,
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
ScrcpyEncoder,
|
|
9
9
|
ScrcpyMediaStreamPacket,
|
|
10
10
|
ScrcpyOptions,
|
|
11
|
+
ScrcpyOptionsListEncoders,
|
|
11
12
|
ScrcpyScrollController,
|
|
12
13
|
ScrcpyVideoStream,
|
|
13
14
|
} from "../base/index.js";
|
|
@@ -36,11 +37,11 @@ import {
|
|
|
36
37
|
setListEncoders,
|
|
37
38
|
} from "./impl/index.js";
|
|
38
39
|
|
|
39
|
-
export class ScrcpyOptions1_24
|
|
40
|
+
export class ScrcpyOptions1_24
|
|
41
|
+
implements ScrcpyOptions<Init>, ScrcpyOptionsListEncoders
|
|
42
|
+
{
|
|
40
43
|
static readonly Defaults = Defaults;
|
|
41
44
|
|
|
42
|
-
readonly version: string;
|
|
43
|
-
|
|
44
45
|
readonly value: Required<Init>;
|
|
45
46
|
|
|
46
47
|
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
|
@@ -54,9 +55,8 @@ export class ScrcpyOptions1_24 implements ScrcpyOptions<Init> {
|
|
|
54
55
|
|
|
55
56
|
#ackClipboardHandler: AckClipboardHandler | undefined;
|
|
56
57
|
|
|
57
|
-
constructor(init: Init
|
|
58
|
+
constructor(init: Init) {
|
|
58
59
|
this.value = { ...Defaults, ...init };
|
|
59
|
-
this.version = version;
|
|
60
60
|
|
|
61
61
|
if (this.value.control && this.value.clipboardAutosync) {
|
|
62
62
|
this.#clipboard = new ClipboardStream();
|
|
@@ -92,7 +92,7 @@ export class ScrcpyOptions1_24 implements ScrcpyOptions<Init> {
|
|
|
92
92
|
|
|
93
93
|
async parseDeviceMessage(
|
|
94
94
|
id: number,
|
|
95
|
-
stream: AsyncExactReadable,
|
|
95
|
+
stream: ExactReadable | AsyncExactReadable,
|
|
96
96
|
): Promise<void> {
|
|
97
97
|
if (await this.#clipboard?.parse(id, stream)) {
|
|
98
98
|
return;
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { getInt16, setInt16 } from "@yume-chan/no-data-view";
|
|
2
2
|
import type { Field, StructInit } from "@yume-chan/struct";
|
|
3
|
-
import {
|
|
3
|
+
import { field, struct, u16, u32, u8 } from "@yume-chan/struct";
|
|
4
4
|
|
|
5
5
|
import type { ScrcpyScrollController } from "../../base/index.js";
|
|
6
6
|
import { ScrcpyControlMessageType } from "../../base/index.js";
|
|
7
7
|
import type { ScrcpyInjectScrollControlMessage } from "../../latest.js";
|
|
8
8
|
import { clamp } from "../../utils/index.js";
|
|
9
9
|
|
|
10
|
-
export const SignedFloat: Field<number, never, never> =
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export const SignedFloat: Field<number, never, never> = field(
|
|
11
|
+
2,
|
|
12
|
+
"byob",
|
|
13
|
+
(value, { buffer, index, littleEndian }) => {
|
|
13
14
|
// https://github.com/Genymobile/scrcpy/blob/1f138aef41de651668043b32c4effc2d4adbfc44/app/src/util/binary.h#L51
|
|
14
15
|
value = clamp(value, -1, 1);
|
|
15
16
|
value = value === 1 ? 0x7fff : value * 0x8000;
|
|
16
17
|
setInt16(buffer, index, value, littleEndian);
|
|
17
18
|
},
|
|
18
|
-
|
|
19
|
+
function* (then, reader, { littleEndian }) {
|
|
19
20
|
const data = yield* then(reader.readExactly(2));
|
|
20
21
|
const value = getInt16(data, 0, littleEndian);
|
|
21
22
|
// https://github.com/Genymobile/scrcpy/blob/1f138aef41de651668043b32c4effc2d4adbfc44/server/src/main/java/com/genymobile/scrcpy/Binary.java#L34
|
|
22
23
|
return value === 0x7fff ? 1 : value / 0x8000;
|
|
23
|
-
}
|
|
24
|
-
|
|
24
|
+
},
|
|
25
|
+
);
|
|
25
26
|
|
|
26
27
|
export const InjectScrollControlMessage = /* #__PURE__ */ (() =>
|
|
27
28
|
struct(
|
|
@@ -29,8 +30,8 @@ export const InjectScrollControlMessage = /* #__PURE__ */ (() =>
|
|
|
29
30
|
type: u8(ScrcpyControlMessageType.InjectScroll),
|
|
30
31
|
pointerX: u32,
|
|
31
32
|
pointerY: u32,
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
videoWidth: u16,
|
|
34
|
+
videoHeight: u16,
|
|
34
35
|
scrollX: SignedFloat,
|
|
35
36
|
scrollY: SignedFloat,
|
|
36
37
|
buttons: u32,
|
package/src/1_25/index.ts
CHANGED
package/src/1_25/options.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
2
|
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
|
3
|
-
import type { AsyncExactReadable } from "@yume-chan/struct";
|
|
3
|
+
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
ScrcpyControlMessageType,
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
ScrcpyEncoder,
|
|
9
9
|
ScrcpyMediaStreamPacket,
|
|
10
10
|
ScrcpyOptions,
|
|
11
|
+
ScrcpyOptionsListEncoders,
|
|
11
12
|
ScrcpyScrollController,
|
|
12
13
|
ScrcpyVideoStream,
|
|
13
14
|
} from "../base/index.js";
|
|
@@ -36,11 +37,11 @@ import {
|
|
|
36
37
|
setListEncoders,
|
|
37
38
|
} from "./impl/index.js";
|
|
38
39
|
|
|
39
|
-
export class ScrcpyOptions1_25
|
|
40
|
+
export class ScrcpyOptions1_25
|
|
41
|
+
implements ScrcpyOptions<Init>, ScrcpyOptionsListEncoders
|
|
42
|
+
{
|
|
40
43
|
static readonly Defaults = Defaults;
|
|
41
44
|
|
|
42
|
-
readonly version: string;
|
|
43
|
-
|
|
44
45
|
readonly value: Required<Init>;
|
|
45
46
|
|
|
46
47
|
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
|
@@ -54,9 +55,8 @@ export class ScrcpyOptions1_25 implements ScrcpyOptions<Init> {
|
|
|
54
55
|
|
|
55
56
|
#ackClipboardHandler: AckClipboardHandler | undefined;
|
|
56
57
|
|
|
57
|
-
constructor(init: Init
|
|
58
|
+
constructor(init: Init) {
|
|
58
59
|
this.value = { ...Defaults, ...init };
|
|
59
|
-
this.version = version;
|
|
60
60
|
|
|
61
61
|
if (this.value.control && this.value.clipboardAutosync) {
|
|
62
62
|
this.#clipboard = new ClipboardStream();
|
|
@@ -92,7 +92,7 @@ export class ScrcpyOptions1_25 implements ScrcpyOptions<Init> {
|
|
|
92
92
|
|
|
93
93
|
async parseDeviceMessage(
|
|
94
94
|
id: number,
|
|
95
|
-
stream: AsyncExactReadable,
|
|
95
|
+
stream: ExactReadable | AsyncExactReadable,
|
|
96
96
|
): Promise<void> {
|
|
97
97
|
if (await this.#clipboard?.parse(id, stream)) {
|
|
98
98
|
return;
|
|
@@ -15,8 +15,8 @@ export const InjectTouchControlMessage = /* #__PURE__ */ (() =>
|
|
|
15
15
|
pointerId: u64,
|
|
16
16
|
pointerX: u32,
|
|
17
17
|
pointerY: u32,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
videoWidth: u16,
|
|
19
|
+
videoHeight: u16,
|
|
20
20
|
pressure: PrevImpl.UnsignedFloat,
|
|
21
21
|
actionButton: u32,
|
|
22
22
|
buttons: u32,
|
|
@@ -11,7 +11,7 @@ import { ScrcpyAudioCodec } from "../../base/index.js";
|
|
|
11
11
|
|
|
12
12
|
export async function parseAudioStreamMetadata(
|
|
13
13
|
stream: ReadableStream<Uint8Array>,
|
|
14
|
-
options: Pick<Required<Init
|
|
14
|
+
options: Pick<Required<Init<boolean>>, "sendCodecMeta" | "audioCodec">,
|
|
15
15
|
): Promise<ScrcpyAudioStreamMetadata> {
|
|
16
16
|
const buffered = new BufferedReadableStream(stream);
|
|
17
17
|
|
package/src/2_0/index.ts
CHANGED
package/src/2_0/options.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
2
|
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
|
3
|
-
import type { AsyncExactReadable } from "@yume-chan/struct";
|
|
3
|
+
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
ScrcpyAudioStreamMetadata,
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
ScrcpyEncoder,
|
|
10
10
|
ScrcpyMediaStreamPacket,
|
|
11
11
|
ScrcpyOptions,
|
|
12
|
+
ScrcpyOptionsListEncoders,
|
|
12
13
|
ScrcpyScrollController,
|
|
13
14
|
ScrcpyVideoStream,
|
|
14
15
|
} from "../base/index.js";
|
|
@@ -37,11 +38,11 @@ import {
|
|
|
37
38
|
setListEncoders,
|
|
38
39
|
} from "./impl/index.js";
|
|
39
40
|
|
|
40
|
-
export class ScrcpyOptions2_0
|
|
41
|
+
export class ScrcpyOptions2_0
|
|
42
|
+
implements ScrcpyOptions<Init>, ScrcpyOptionsListEncoders
|
|
43
|
+
{
|
|
41
44
|
static readonly Defaults = Defaults;
|
|
42
45
|
|
|
43
|
-
readonly version: string;
|
|
44
|
-
|
|
45
46
|
readonly value: Required<Init>;
|
|
46
47
|
|
|
47
48
|
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
|
@@ -55,9 +56,8 @@ export class ScrcpyOptions2_0 implements ScrcpyOptions<Init> {
|
|
|
55
56
|
|
|
56
57
|
#ackClipboardHandler: AckClipboardHandler | undefined;
|
|
57
58
|
|
|
58
|
-
constructor(init: Init
|
|
59
|
+
constructor(init: Init) {
|
|
59
60
|
this.value = { ...Defaults, ...init };
|
|
60
|
-
this.version = version;
|
|
61
61
|
|
|
62
62
|
if (this.value.control && this.value.clipboardAutosync) {
|
|
63
63
|
this.#clipboard = new ClipboardStream();
|
|
@@ -99,7 +99,7 @@ export class ScrcpyOptions2_0 implements ScrcpyOptions<Init> {
|
|
|
99
99
|
|
|
100
100
|
async parseDeviceMessage(
|
|
101
101
|
id: number,
|
|
102
|
-
stream: AsyncExactReadable,
|
|
102
|
+
stream: ExactReadable | AsyncExactReadable,
|
|
103
103
|
): Promise<void> {
|
|
104
104
|
if (await this.#clipboard?.parse(id, stream)) {
|
|
105
105
|
return;
|
package/src/2_1/impl/defaults.ts
CHANGED
package/src/2_1/impl/init.ts
CHANGED
package/src/2_1/index.ts
CHANGED
package/src/2_1/options.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
2
|
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
|
3
|
-
import type { AsyncExactReadable } from "@yume-chan/struct";
|
|
3
|
+
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
ScrcpyAudioStreamMetadata,
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
ScrcpyEncoder,
|
|
10
10
|
ScrcpyMediaStreamPacket,
|
|
11
11
|
ScrcpyOptions,
|
|
12
|
+
ScrcpyOptionsListEncoders,
|
|
12
13
|
ScrcpyScrollController,
|
|
13
14
|
ScrcpyVideoStream,
|
|
14
15
|
} from "../base/index.js";
|
|
@@ -37,12 +38,12 @@ import {
|
|
|
37
38
|
setListEncoders,
|
|
38
39
|
} from "./impl/index.js";
|
|
39
40
|
|
|
40
|
-
export class ScrcpyOptions2_1
|
|
41
|
+
export class ScrcpyOptions2_1<TVideo extends boolean>
|
|
42
|
+
implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
|
|
43
|
+
{
|
|
41
44
|
static readonly Defaults = Defaults;
|
|
42
45
|
|
|
43
|
-
readonly
|
|
44
|
-
|
|
45
|
-
readonly value: Required<Init>;
|
|
46
|
+
readonly value: Required<Init<TVideo>>;
|
|
46
47
|
|
|
47
48
|
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
|
48
49
|
return ControlMessageTypes;
|
|
@@ -55,9 +56,8 @@ export class ScrcpyOptions2_1 implements ScrcpyOptions<Init> {
|
|
|
55
56
|
|
|
56
57
|
#ackClipboardHandler: AckClipboardHandler | undefined;
|
|
57
58
|
|
|
58
|
-
constructor(init: Init
|
|
59
|
-
this.value = { ...Defaults, ...init };
|
|
60
|
-
this.version = version;
|
|
59
|
+
constructor(init: Init<TVideo>) {
|
|
60
|
+
this.value = { ...Defaults, ...init } as never;
|
|
61
61
|
|
|
62
62
|
if (this.value.control && this.value.clipboardAutosync) {
|
|
63
63
|
this.#clipboard = new ClipboardStream();
|
|
@@ -66,7 +66,7 @@ export class ScrcpyOptions2_1 implements ScrcpyOptions<Init> {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
serialize(): string[] {
|
|
69
|
-
return serialize(this.value, Defaults);
|
|
69
|
+
return serialize<Init<boolean>>(this.value, Defaults);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
setListDisplays(): void {
|
|
@@ -99,7 +99,7 @@ export class ScrcpyOptions2_1 implements ScrcpyOptions<Init> {
|
|
|
99
99
|
|
|
100
100
|
async parseDeviceMessage(
|
|
101
101
|
id: number,
|
|
102
|
-
stream: AsyncExactReadable,
|
|
102
|
+
stream: ExactReadable | AsyncExactReadable,
|
|
103
103
|
): Promise<void> {
|
|
104
104
|
if (await this.#clipboard?.parse(id, stream)) {
|
|
105
105
|
return;
|
|
@@ -154,8 +154,8 @@ export class ScrcpyOptions2_1 implements ScrcpyOptions<Init> {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
type Init_ = Init
|
|
157
|
+
type Init_<TVideo extends boolean> = Init<TVideo>;
|
|
158
158
|
|
|
159
159
|
export namespace ScrcpyOptions2_1 {
|
|
160
|
-
export type Init = Init_
|
|
160
|
+
export type Init<TVideo extends boolean = boolean> = Init_<TVideo>;
|
|
161
161
|
}
|
package/src/2_1_1.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { ScrcpyOptions2_1 } from "./2_1/index.js";
|
|
2
2
|
|
|
3
|
-
export class ScrcpyOptions2_1_1
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export class ScrcpyOptions2_1_1<
|
|
4
|
+
TVideo extends boolean,
|
|
5
|
+
> extends ScrcpyOptions2_1<TVideo> {
|
|
6
|
+
constructor(init: ScrcpyOptions2_1.Init<TVideo>) {
|
|
7
|
+
super(init);
|
|
6
8
|
}
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
export
|
|
11
|
+
export namespace ScrcpyOptions2_1_1 {
|
|
12
|
+
export type Init<TVideo extends boolean = boolean> =
|
|
13
|
+
ScrcpyOptions2_1.Init<TVideo>;
|
|
14
|
+
}
|
package/src/2_2/impl/defaults.ts
CHANGED
package/src/2_2/impl/init.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PrevImpl } from "./prev.js";
|
|
2
2
|
|
|
3
|
-
export interface Init extends PrevImpl.Init {
|
|
3
|
+
export interface Init<TVideo extends boolean> extends PrevImpl.Init<TVideo> {
|
|
4
4
|
videoSource?: "display" | "camera";
|
|
5
5
|
cameraId?: string | undefined;
|
|
6
6
|
cameraSize?: string | undefined;
|
package/src/2_2/index.ts
CHANGED
package/src/2_2/options.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
2
|
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
|
3
|
-
import type { AsyncExactReadable } from "@yume-chan/struct";
|
|
3
|
+
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
ScrcpyAudioStreamMetadata,
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
ScrcpyEncoder,
|
|
10
10
|
ScrcpyMediaStreamPacket,
|
|
11
11
|
ScrcpyOptions,
|
|
12
|
+
ScrcpyOptionsListEncoders,
|
|
12
13
|
ScrcpyScrollController,
|
|
13
14
|
ScrcpyVideoStream,
|
|
14
15
|
} from "../base/index.js";
|
|
@@ -37,12 +38,12 @@ import {
|
|
|
37
38
|
setListEncoders,
|
|
38
39
|
} from "./impl/index.js";
|
|
39
40
|
|
|
40
|
-
export class ScrcpyOptions2_2
|
|
41
|
+
export class ScrcpyOptions2_2<TVideo extends boolean>
|
|
42
|
+
implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
|
|
43
|
+
{
|
|
41
44
|
static readonly Defaults = Defaults;
|
|
42
45
|
|
|
43
|
-
readonly
|
|
44
|
-
|
|
45
|
-
readonly value: Required<Init>;
|
|
46
|
+
readonly value: Required<Init<TVideo>>;
|
|
46
47
|
|
|
47
48
|
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
|
48
49
|
return ControlMessageTypes;
|
|
@@ -55,9 +56,8 @@ export class ScrcpyOptions2_2 implements ScrcpyOptions<Init> {
|
|
|
55
56
|
|
|
56
57
|
#ackClipboardHandler: AckClipboardHandler | undefined;
|
|
57
58
|
|
|
58
|
-
constructor(init: Init
|
|
59
|
-
this.value = { ...Defaults, ...init };
|
|
60
|
-
this.version = version;
|
|
59
|
+
constructor(init: Init<TVideo>) {
|
|
60
|
+
this.value = { ...Defaults, ...init } as never;
|
|
61
61
|
|
|
62
62
|
if (this.value.videoSource === "camera") {
|
|
63
63
|
this.value.control = false;
|
|
@@ -70,7 +70,7 @@ export class ScrcpyOptions2_2 implements ScrcpyOptions<Init> {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
serialize(): string[] {
|
|
73
|
-
return serialize(this.value, Defaults);
|
|
73
|
+
return serialize<Init<boolean>>(this.value, Defaults);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
setListDisplays(): void {
|
|
@@ -103,7 +103,7 @@ export class ScrcpyOptions2_2 implements ScrcpyOptions<Init> {
|
|
|
103
103
|
|
|
104
104
|
async parseDeviceMessage(
|
|
105
105
|
id: number,
|
|
106
|
-
stream: AsyncExactReadable,
|
|
106
|
+
stream: ExactReadable | AsyncExactReadable,
|
|
107
107
|
): Promise<void> {
|
|
108
108
|
if (await this.#clipboard?.parse(id, stream)) {
|
|
109
109
|
return;
|
|
@@ -158,8 +158,8 @@ export class ScrcpyOptions2_2 implements ScrcpyOptions<Init> {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
type Init_ = Init
|
|
161
|
+
type Init_<TVideo extends boolean> = Init<TVideo>;
|
|
162
162
|
|
|
163
163
|
export namespace ScrcpyOptions2_2 {
|
|
164
|
-
export type Init = Init_
|
|
164
|
+
export type Init<TVideo extends boolean = boolean> = Init_<TVideo>;
|
|
165
165
|
}
|
package/src/2_3/impl/init.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PrevImpl } from "./prev.js";
|
|
2
2
|
|
|
3
|
-
export interface Init extends
|
|
4
|
-
|
|
3
|
+
export interface Init<TVideo extends boolean>
|
|
4
|
+
extends Omit<PrevImpl.Init<TVideo>, "audioCodec"> {
|
|
5
|
+
audioCodec?: PrevImpl.Init<TVideo>["audioCodec"] | "flac";
|
|
5
6
|
}
|
package/src/2_3/index.ts
CHANGED
package/src/2_3/options.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
2
|
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
|
3
|
-
import type { AsyncExactReadable } from "@yume-chan/struct";
|
|
3
|
+
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
ScrcpyAudioStreamMetadata,
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
ScrcpyEncoder,
|
|
10
10
|
ScrcpyMediaStreamPacket,
|
|
11
11
|
ScrcpyOptions,
|
|
12
|
+
ScrcpyOptionsListEncoders,
|
|
12
13
|
ScrcpyScrollController,
|
|
13
14
|
ScrcpyVideoStream,
|
|
14
15
|
} from "../base/index.js";
|
|
@@ -37,12 +38,12 @@ import {
|
|
|
37
38
|
setListEncoders,
|
|
38
39
|
} from "./impl/index.js";
|
|
39
40
|
|
|
40
|
-
export class ScrcpyOptions2_3
|
|
41
|
+
export class ScrcpyOptions2_3<TVideo extends boolean>
|
|
42
|
+
implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
|
|
43
|
+
{
|
|
41
44
|
static readonly Defaults = Defaults;
|
|
42
45
|
|
|
43
|
-
readonly
|
|
44
|
-
|
|
45
|
-
readonly value: Required<Init>;
|
|
46
|
+
readonly value: Required<Init<TVideo>>;
|
|
46
47
|
|
|
47
48
|
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
|
48
49
|
return ControlMessageTypes;
|
|
@@ -55,9 +56,8 @@ export class ScrcpyOptions2_3 implements ScrcpyOptions<Init> {
|
|
|
55
56
|
|
|
56
57
|
#ackClipboardHandler: AckClipboardHandler | undefined;
|
|
57
58
|
|
|
58
|
-
constructor(init: Init
|
|
59
|
-
this.value = { ...Defaults, ...init };
|
|
60
|
-
this.version = version;
|
|
59
|
+
constructor(init: Init<TVideo>) {
|
|
60
|
+
this.value = { ...Defaults, ...init } as never;
|
|
61
61
|
|
|
62
62
|
if (this.value.videoSource === "camera") {
|
|
63
63
|
this.value.control = false;
|
|
@@ -70,7 +70,7 @@ export class ScrcpyOptions2_3 implements ScrcpyOptions<Init> {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
serialize(): string[] {
|
|
73
|
-
return serialize(this.value, Defaults);
|
|
73
|
+
return serialize<Init<boolean>>(this.value, Defaults);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
setListDisplays(): void {
|
|
@@ -103,7 +103,7 @@ export class ScrcpyOptions2_3 implements ScrcpyOptions<Init> {
|
|
|
103
103
|
|
|
104
104
|
async parseDeviceMessage(
|
|
105
105
|
id: number,
|
|
106
|
-
stream: AsyncExactReadable,
|
|
106
|
+
stream: ExactReadable | AsyncExactReadable,
|
|
107
107
|
): Promise<void> {
|
|
108
108
|
if (await this.#clipboard?.parse(id, stream)) {
|
|
109
109
|
return;
|
|
@@ -158,8 +158,8 @@ export class ScrcpyOptions2_3 implements ScrcpyOptions<Init> {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
type Init_ = Init
|
|
161
|
+
type Init_<TVideo extends boolean> = Init<TVideo>;
|
|
162
162
|
|
|
163
163
|
export namespace ScrcpyOptions2_3 {
|
|
164
|
-
export type Init = Init_
|
|
164
|
+
export type Init<TVideo extends boolean = boolean> = Init_<TVideo>;
|
|
165
165
|
}
|
package/src/2_3_1.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { ScrcpyOptions2_3 } from "./2_3/index.js";
|
|
2
2
|
|
|
3
|
-
export class ScrcpyOptions2_3_1
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export class ScrcpyOptions2_3_1<
|
|
4
|
+
TVideo extends boolean,
|
|
5
|
+
> extends ScrcpyOptions2_3<TVideo> {
|
|
6
|
+
constructor(init: ScrcpyOptions2_3.Init<TVideo>) {
|
|
7
|
+
super(init);
|
|
6
8
|
}
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
export
|
|
11
|
+
export namespace ScrcpyOptions2_3_1 {
|
|
12
|
+
export type Init<TVideo extends boolean = boolean> =
|
|
13
|
+
ScrcpyOptions2_3.Init<TVideo>;
|
|
14
|
+
}
|
package/src/2_4/index.ts
CHANGED
package/src/2_4/options.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
2
|
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
|
3
|
-
import type { AsyncExactReadable } from "@yume-chan/struct";
|
|
3
|
+
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
ScrcpyAudioStreamMetadata,
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
ScrcpyEncoder,
|
|
10
10
|
ScrcpyMediaStreamPacket,
|
|
11
11
|
ScrcpyOptions,
|
|
12
|
+
ScrcpyOptionsListEncoders,
|
|
12
13
|
ScrcpyScrollController,
|
|
13
14
|
ScrcpyVideoStream,
|
|
14
15
|
} from "../base/index.js";
|
|
@@ -41,12 +42,12 @@ import {
|
|
|
41
42
|
UHidOutputStream,
|
|
42
43
|
} from "./impl/index.js";
|
|
43
44
|
|
|
44
|
-
export class ScrcpyOptions2_4
|
|
45
|
+
export class ScrcpyOptions2_4<TVideo extends boolean>
|
|
46
|
+
implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
|
|
47
|
+
{
|
|
45
48
|
static readonly Defaults = Defaults;
|
|
46
49
|
|
|
47
|
-
readonly
|
|
48
|
-
|
|
49
|
-
readonly value: Required<Init>;
|
|
50
|
+
readonly value: Required<Init<TVideo>>;
|
|
50
51
|
|
|
51
52
|
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
|
52
53
|
return ControlMessageTypes;
|
|
@@ -66,9 +67,8 @@ export class ScrcpyOptions2_4 implements ScrcpyOptions<Init> {
|
|
|
66
67
|
return this.#uHidOutput;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
constructor(init: Init
|
|
70
|
-
this.value = { ...Defaults, ...init };
|
|
71
|
-
this.version = version;
|
|
70
|
+
constructor(init: Init<TVideo>) {
|
|
71
|
+
this.value = { ...Defaults, ...init } as never;
|
|
72
72
|
|
|
73
73
|
if (this.value.videoSource === "camera") {
|
|
74
74
|
this.value.control = false;
|
|
@@ -85,7 +85,7 @@ export class ScrcpyOptions2_4 implements ScrcpyOptions<Init> {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
serialize(): string[] {
|
|
88
|
-
return serialize(this.value, Defaults);
|
|
88
|
+
return serialize<Init<boolean>>(this.value, Defaults);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
setListDisplays(): void {
|
|
@@ -118,7 +118,7 @@ export class ScrcpyOptions2_4 implements ScrcpyOptions<Init> {
|
|
|
118
118
|
|
|
119
119
|
async parseDeviceMessage(
|
|
120
120
|
id: number,
|
|
121
|
-
stream: AsyncExactReadable,
|
|
121
|
+
stream: ExactReadable | AsyncExactReadable,
|
|
122
122
|
): Promise<void> {
|
|
123
123
|
if (await this.#clipboard?.parse(id, stream)) {
|
|
124
124
|
return;
|
|
@@ -185,8 +185,8 @@ export class ScrcpyOptions2_4 implements ScrcpyOptions<Init> {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
type Init_ = Init
|
|
188
|
+
type Init_<TVideo extends boolean> = Init<TVideo>;
|
|
189
189
|
|
|
190
190
|
export namespace ScrcpyOptions2_4 {
|
|
191
|
-
export type Init = Init_
|
|
191
|
+
export type Init<TVideo extends boolean = boolean> = Init_<TVideo>;
|
|
192
192
|
}
|
package/src/2_5.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { ScrcpyOptions2_4 } from "./2_4/index.js";
|
|
2
2
|
|
|
3
|
-
export class ScrcpyOptions2_5
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export class ScrcpyOptions2_5<
|
|
4
|
+
TVideo extends boolean,
|
|
5
|
+
> extends ScrcpyOptions2_4<TVideo> {
|
|
6
|
+
constructor(init: ScrcpyOptions2_4.Init<TVideo>) {
|
|
7
|
+
super(init);
|
|
6
8
|
}
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
export
|
|
11
|
+
export namespace ScrcpyOptions2_5 {
|
|
12
|
+
export type Init<TVideo extends boolean = boolean> =
|
|
13
|
+
ScrcpyOptions2_4.Init<TVideo>;
|
|
14
|
+
}
|
package/src/2_6/impl/defaults.ts
CHANGED
package/src/2_6/impl/init.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PrevImpl } from "./prev.js";
|
|
2
2
|
|
|
3
|
-
export interface Init extends
|
|
4
|
-
|
|
3
|
+
export interface Init<TVideo extends boolean>
|
|
4
|
+
extends Omit<PrevImpl.Init<TVideo>, "audioSource"> {
|
|
5
|
+
audioSource?: PrevImpl.Init<TVideo>["audioSource"] | "playback";
|
|
5
6
|
audioDup?: boolean;
|
|
6
7
|
}
|
package/src/2_6/index.ts
CHANGED