@yume-chan/scrcpy 0.0.15 → 0.0.17
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 +33 -0
- package/CHANGELOG.md +18 -1
- package/LICENSE +21 -21
- package/README.md +327 -89
- package/esm/adb/client.d.ts +40 -0
- package/esm/adb/client.d.ts.map +1 -0
- package/esm/adb/client.js +218 -0
- package/esm/adb/client.js.map +1 -0
- package/esm/adb/connection.d.ts +38 -0
- package/esm/adb/connection.d.ts.map +1 -0
- package/esm/{connection.js → adb/connection.js} +20 -24
- package/esm/adb/connection.js.map +1 -0
- package/esm/adb/index.d.ts +4 -0
- package/esm/adb/index.d.ts.map +1 -0
- package/esm/adb/index.js +4 -0
- package/esm/adb/index.js.map +1 -0
- package/esm/adb/options/1_16.d.ts +8 -0
- package/esm/adb/options/1_16.d.ts.map +1 -0
- package/esm/adb/options/1_16.js +20 -0
- package/esm/adb/options/1_16.js.map +1 -0
- package/esm/adb/options/1_22.d.ts +8 -0
- package/esm/adb/options/1_22.d.ts.map +1 -0
- package/esm/adb/options/1_22.js +17 -0
- package/esm/adb/options/1_22.js.map +1 -0
- package/esm/adb/options/index.d.ts +4 -0
- package/esm/adb/options/index.d.ts.map +1 -0
- package/esm/adb/options/index.js +4 -0
- package/esm/adb/options/index.js.map +1 -0
- package/esm/adb/options/types.d.ts +23 -0
- package/esm/adb/options/types.d.ts.map +1 -0
- package/esm/adb/options/types.js +30 -0
- package/esm/adb/options/types.js.map +1 -0
- package/esm/codec.js +2 -2
- package/esm/codec.js.map +1 -1
- package/esm/control/index.d.ts +8 -0
- package/esm/control/index.d.ts.map +1 -0
- package/esm/control/index.js +8 -0
- package/esm/control/index.js.map +1 -0
- package/esm/control/inject-keycode.d.ts +53 -0
- package/esm/control/inject-keycode.d.ts.map +1 -0
- package/esm/control/inject-keycode.js +54 -0
- package/esm/control/inject-keycode.js.map +1 -0
- package/esm/control/inject-text.d.ts +9 -0
- package/esm/control/inject-text.d.ts.map +1 -0
- package/esm/control/inject-text.js +7 -0
- package/esm/control/inject-text.js.map +1 -0
- package/esm/control/inject-touch.d.ts +30 -0
- package/esm/control/inject-touch.d.ts.map +1 -0
- package/esm/control/inject-touch.js +30 -0
- package/esm/control/inject-touch.js.map +1 -0
- package/esm/control/rotate-device.d.ts +7 -0
- package/esm/control/rotate-device.d.ts.map +1 -0
- package/esm/control/rotate-device.js +5 -0
- package/esm/control/rotate-device.js.map +1 -0
- package/esm/control/serializer.d.ts +23 -0
- package/esm/control/serializer.d.ts.map +1 -0
- package/esm/control/serializer.js +73 -0
- package/esm/control/serializer.js.map +1 -0
- package/esm/control/set-screen-power-mode.d.ts +12 -0
- package/esm/control/set-screen-power-mode.d.ts.map +1 -0
- package/esm/control/set-screen-power-mode.js +12 -0
- package/esm/control/set-screen-power-mode.js.map +1 -0
- package/esm/control/type.d.ts +15 -0
- package/esm/control/type.d.ts.map +1 -0
- package/esm/control/type.js +19 -0
- package/esm/control/type.js.map +1 -0
- package/esm/decoder/index.d.ts +27 -3
- package/esm/decoder/index.d.ts.map +1 -1
- package/esm/decoder/index.js +1 -3
- package/esm/decoder/index.js.map +1 -1
- package/esm/decoder/tinyh264/index.d.ts +5 -5
- package/esm/decoder/tinyh264/index.d.ts.map +1 -1
- package/esm/decoder/tinyh264/index.js +4 -4
- package/esm/decoder/tinyh264/index.js.map +1 -1
- package/esm/decoder/tinyh264/worker.js.map +1 -1
- package/esm/decoder/tinyh264/wrapper.d.ts.map +1 -1
- package/esm/decoder/tinyh264/wrapper.js +14 -8
- package/esm/decoder/tinyh264/wrapper.js.map +1 -1
- package/esm/decoder/types.d.ts +1 -27
- package/esm/decoder/types.d.ts.map +1 -1
- package/esm/decoder/web-codecs/index.d.ts +4 -4
- package/esm/decoder/web-codecs/index.d.ts.map +1 -1
- package/esm/decoder/web-codecs/index.js +1 -1
- package/esm/decoder/web-codecs/index.js.map +1 -1
- package/esm/device-message/clipboard.d.ts +10 -0
- package/esm/device-message/clipboard.d.ts.map +1 -0
- package/esm/device-message/clipboard.js +7 -0
- package/esm/device-message/clipboard.js.map +1 -0
- package/esm/device-message/index.d.ts +4 -0
- package/esm/device-message/index.d.ts.map +1 -0
- package/esm/device-message/index.js +4 -0
- package/esm/device-message/index.js.map +1 -0
- package/esm/device-message/stream.d.ts +7 -0
- package/esm/device-message/stream.d.ts.map +1 -0
- package/esm/device-message/stream.js +16 -0
- package/esm/device-message/stream.js.map +1 -0
- package/esm/device-message/type.d.ts +5 -0
- package/esm/device-message/type.d.ts.map +1 -0
- package/esm/device-message/type.js +7 -0
- package/esm/device-message/type.js.map +1 -0
- package/esm/index.d.ts +3 -6
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +3 -6
- package/esm/index.js.map +1 -1
- package/esm/options/1_16/codec-options.d.ts +19 -0
- package/esm/options/1_16/codec-options.d.ts.map +1 -0
- package/esm/options/1_16/codec-options.js +27 -0
- package/esm/options/1_16/codec-options.js.map +1 -0
- package/esm/options/1_16/index.d.ts +3 -107
- package/esm/options/1_16/index.d.ts.map +1 -1
- package/esm/options/1_16/index.js +3 -216
- package/esm/options/1_16/index.js.map +1 -1
- package/esm/options/1_16/options.d.ts +97 -0
- package/esm/options/1_16/options.d.ts.map +1 -0
- package/esm/options/1_16/options.js +188 -0
- package/esm/options/1_16/options.js.map +1 -0
- package/esm/options/1_18.d.ts +8 -8
- package/esm/options/1_18.d.ts.map +1 -1
- package/esm/options/1_18.js +6 -6
- package/esm/options/1_18.js.map +1 -1
- package/esm/options/1_21.d.ts +1 -1
- package/esm/options/1_21.d.ts.map +1 -1
- package/esm/options/1_21.js +1 -1
- package/esm/options/1_21.js.map +1 -1
- package/esm/options/1_22.d.ts +5 -8
- package/esm/options/1_22.d.ts.map +1 -1
- package/esm/options/1_22.js +4 -17
- package/esm/options/1_22.js.map +1 -1
- package/esm/options/1_23.d.ts +4 -4
- package/esm/options/1_23.d.ts.map +1 -1
- package/esm/options/1_23.js +1 -1
- package/esm/options/1_23.js.map +1 -1
- package/esm/options/1_24.d.ts +1 -1
- package/esm/options/1_24.d.ts.map +1 -1
- package/esm/options/1_24.js.map +1 -1
- package/esm/options/index.d.ts +1 -1
- package/esm/options/index.d.ts.map +1 -1
- package/esm/options/index.js +1 -1
- package/esm/options/index.js.map +1 -1
- package/esm/options/types.d.ts +45 -0
- package/esm/options/types.d.ts.map +1 -0
- package/esm/options/{common.js → types.js} +1 -1
- package/esm/options/types.js.map +1 -0
- package/package.json +24 -24
- package/scrcpy.LICENSE +203 -203
- package/scripts/fetch-server.cjs +28 -28
- package/src/adb/client.ts +292 -0
- package/src/{connection.ts → adb/connection.ts} +145 -148
- package/src/adb/index.ts +3 -0
- package/src/adb/options/1_16.ts +23 -0
- package/src/adb/options/1_22.ts +20 -0
- package/src/adb/options/index.ts +3 -0
- package/src/adb/options/types.ts +55 -0
- package/src/codec.ts +35 -35
- package/src/control/index.ts +7 -0
- package/src/control/inject-keycode.ts +59 -0
- package/src/control/inject-text.ts +12 -0
- package/src/control/inject-touch.ts +34 -0
- package/src/control/rotate-device.ts +10 -0
- package/src/control/serializer.ts +86 -0
- package/src/control/set-screen-power-mode.ts +17 -0
- package/src/control/type.ts +17 -0
- package/src/device-message/clipboard.ts +11 -0
- package/src/device-message/index.ts +3 -0
- package/src/device-message/stream.ts +19 -0
- package/src/device-message/type.ts +5 -0
- package/src/index.ts +5 -8
- package/src/options/1_16/codec-options.ts +48 -0
- package/src/options/1_16/index.ts +3 -330
- package/src/options/1_16/options.ts +294 -0
- package/src/options/1_16/sps.ts +300 -300
- package/src/options/1_18.ts +63 -61
- package/src/options/1_21.ts +44 -34
- package/src/options/1_22.ts +67 -78
- package/src/options/1_23.ts +7 -5
- package/src/options/1_24.ts +3 -2
- package/src/options/index.ts +7 -7
- package/src/options/{common.ts → types.ts} +85 -66
- package/tsconfig.build.json +3 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.test.tsbuildinfo +1 -0
- package/esm/client.d.ts +0 -48
- package/esm/client.d.ts.map +0 -1
- package/esm/client.js +0 -341
- package/esm/client.js.map +0 -1
- package/esm/connection.d.ts +0 -37
- package/esm/connection.d.ts.map +0 -1
- package/esm/connection.js.map +0 -1
- package/esm/message.d.ts +0 -97
- package/esm/message.d.ts.map +0 -1
- package/esm/message.js +0 -97
- package/esm/message.js.map +0 -1
- package/esm/options/common.d.ts +0 -34
- package/esm/options/common.d.ts.map +0 -1
- package/esm/options/common.js.map +0 -1
- package/esm/push-server.d.ts +0 -6
- package/esm/push-server.d.ts.map +0 -1
- package/esm/push-server.js +0 -16
- package/esm/push-server.js.map +0 -1
- package/esm/utils.d.ts +0 -2
- package/esm/utils.d.ts.map +0 -1
- package/esm/utils.js +0 -6
- package/esm/utils.js.map +0 -1
- package/src/client.ts +0 -435
- package/src/decoder/index.ts +0 -3
- package/src/decoder/tinyh264/index.ts +0 -112
- package/src/decoder/tinyh264/types.d.ts +0 -137
- package/src/decoder/tinyh264/worker.ts +0 -2
- package/src/decoder/tinyh264/wrapper.ts +0 -89
- package/src/decoder/types.ts +0 -35
- package/src/decoder/web-codecs/index.ts +0 -99
- package/src/message.ts +0 -112
- package/src/push-server.ts +0 -24
- package/src/utils.ts +0 -5
package/esm/decoder/types.d.ts
CHANGED
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Disposable } from "@yume-chan/event";
|
|
3
|
-
import type { AndroidCodecLevel, AndroidCodecProfile } from "../codec.js";
|
|
4
|
-
import type { VideoStreamPacket } from "../options/index.js";
|
|
5
|
-
export interface H264Configuration {
|
|
6
|
-
profileIndex: number;
|
|
7
|
-
constraintSet: number;
|
|
8
|
-
levelIndex: number;
|
|
9
|
-
encodedWidth: number;
|
|
10
|
-
encodedHeight: number;
|
|
11
|
-
cropLeft: number;
|
|
12
|
-
cropRight: number;
|
|
13
|
-
cropTop: number;
|
|
14
|
-
cropBottom: number;
|
|
15
|
-
croppedWidth: number;
|
|
16
|
-
croppedHeight: number;
|
|
17
|
-
}
|
|
18
|
-
export interface H264Decoder extends Disposable {
|
|
19
|
-
readonly maxProfile: AndroidCodecProfile | undefined;
|
|
20
|
-
readonly maxLevel: AndroidCodecLevel | undefined;
|
|
21
|
-
readonly renderer: HTMLElement;
|
|
22
|
-
readonly frameRendered: number;
|
|
23
|
-
readonly writable: WritableStream<VideoStreamPacket>;
|
|
24
|
-
}
|
|
25
|
-
export interface H264DecoderConstructor {
|
|
26
|
-
new (): H264Decoder;
|
|
27
|
-
}
|
|
1
|
+
export {};
|
|
28
2
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/decoder/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/decoder/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { WritableStream } from '@yume-chan/
|
|
2
|
-
import type {
|
|
3
|
-
import type { H264Decoder } from
|
|
1
|
+
import { WritableStream } from '@yume-chan/stream-extra';
|
|
2
|
+
import type { ScrcpyVideoStreamPacket } from '../../options/index.js';
|
|
3
|
+
import type { H264Decoder } from '../types.js';
|
|
4
4
|
export declare class WebCodecsDecoder implements H264Decoder {
|
|
5
5
|
readonly maxProfile: undefined;
|
|
6
6
|
readonly maxLevel: undefined;
|
|
7
7
|
private _writable;
|
|
8
|
-
get writable(): WritableStream<
|
|
8
|
+
get writable(): WritableStream<ScrcpyVideoStreamPacket>;
|
|
9
9
|
private _renderer;
|
|
10
10
|
get renderer(): HTMLCanvasElement;
|
|
11
11
|
private _frameRendered;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decoder/web-codecs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decoder/web-codecs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,aAAa,CAAC;AAMlE,qBAAa,gBAAiB,YAAW,WAAW;IAGhD,SAAgB,UAAU,YAAa;IACvC,SAAgB,QAAQ,YAAa;IAErC,OAAO,CAAC,SAAS,CAA0C;IAC3D,IAAW,QAAQ,4CAA6B;IAEhD,OAAO,CAAC,SAAS,CAAoB;IACrC,IAAW,QAAQ,sBAA6B;IAEhD,OAAO,CAAC,cAAc,CAAK;IAC3B,IAAW,aAAa,WAAkC;IAE1D,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,OAAO,CAAe;IAG9B,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,cAAc,CAAa;;IAwCnC,OAAO,CAAC,MAAM,CASZ;IAEF,OAAO,CAAC,SAAS;IAeV,OAAO;CAIjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decoder/web-codecs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decoder/web-codecs/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Struct from '@yume-chan/struct';
|
|
2
|
+
import { ScrcpyDeviceMessageType } from './type.js';
|
|
3
|
+
export declare const ScrcpyClipboardDeviceMessage: Struct<{
|
|
4
|
+
length: number;
|
|
5
|
+
content: string;
|
|
6
|
+
}, "length", {
|
|
7
|
+
type: ScrcpyDeviceMessageType.Clipboard;
|
|
8
|
+
}, undefined>;
|
|
9
|
+
export declare type ScrcpyClipboardDeviceMessage = typeof ScrcpyClipboardDeviceMessage['TDeserializeResult'];
|
|
10
|
+
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/device-message/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,eAAO,MAAM,4BAA4B;;;;;aAI2B,CAAC;AAErE,oBAAY,4BAA4B,GACpC,OAAO,4BAA4B,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Struct from '@yume-chan/struct';
|
|
2
|
+
import { ScrcpyDeviceMessageType } from './type.js';
|
|
3
|
+
export const ScrcpyClipboardDeviceMessage = new Struct()
|
|
4
|
+
.uint32('length')
|
|
5
|
+
.string('content', { lengthField: 'length' })
|
|
6
|
+
.extra({ type: ScrcpyDeviceMessageType.Clipboard });
|
|
7
|
+
//# sourceMappingURL=clipboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/device-message/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,CAAC,MAAM,4BAA4B,GACrC,IAAI,MAAM,EAAE;KACP,MAAM,CAAC,QAAQ,CAAC;KAChB,MAAM,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;KAC5C,KAAK,CAAC,EAAE,IAAI,EAAE,uBAAuB,CAAC,SAAkB,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/device-message/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/device-message/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BufferedTransformStream } from '@yume-chan/stream-extra';
|
|
2
|
+
import { ScrcpyClipboardDeviceMessage } from './clipboard.js';
|
|
3
|
+
export declare type ScrcpyDeviceMessage = ScrcpyClipboardDeviceMessage;
|
|
4
|
+
export declare class ScrcpyDeviceMessageDeserializeStream extends BufferedTransformStream<ScrcpyDeviceMessage> {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/device-message/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAE9D,oBAAY,mBAAmB,GACzB,4BAA4B,CAAC;AAEnC,qBAAa,oCAAqC,SAAQ,uBAAuB,CAAC,mBAAmB,CAAC;;CAYrG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BufferedTransformStream } from '@yume-chan/stream-extra';
|
|
2
|
+
import { ScrcpyClipboardDeviceMessage } from './clipboard.js';
|
|
3
|
+
export class ScrcpyDeviceMessageDeserializeStream extends BufferedTransformStream {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(async (stream) => {
|
|
6
|
+
const type = await stream.read(1);
|
|
7
|
+
switch (type[0]) {
|
|
8
|
+
case 0:
|
|
9
|
+
return await ScrcpyClipboardDeviceMessage.deserialize(stream);
|
|
10
|
+
default:
|
|
11
|
+
throw new Error('unknown control message type');
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/device-message/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAK9D,MAAM,OAAO,oCAAqC,SAAQ,uBAA4C;IAClG;QACI,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACnB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClC,QAAQ,IAAI,CAAC,CAAC,CAAC,EAAE;gBACb,KAAK,CAAC;oBACF,OAAO,MAAM,4BAA4B,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAClE;oBACI,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;aACvD;QACL,CAAC,CAAC,CAAA;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/device-message/type.ts"],"names":[],"mappings":"AACA,oBAAY,uBAAuB;IAC/B,SAAS,IAAA;IACT,YAAY,IAAA;CACf"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// https://github.com/Genymobile/scrcpy/blob/41abe021e2a73efd4899b0efcd0b9eef9ec68c9b/server/src/main/java/com/genymobile/scrcpy/DeviceMessage.java#L5
|
|
2
|
+
export var ScrcpyDeviceMessageType;
|
|
3
|
+
(function (ScrcpyDeviceMessageType) {
|
|
4
|
+
ScrcpyDeviceMessageType[ScrcpyDeviceMessageType["Clipboard"] = 0] = "Clipboard";
|
|
5
|
+
ScrcpyDeviceMessageType[ScrcpyDeviceMessageType["AckClipboard"] = 1] = "AckClipboard";
|
|
6
|
+
})(ScrcpyDeviceMessageType = ScrcpyDeviceMessageType || (ScrcpyDeviceMessageType = {}));
|
|
7
|
+
//# sourceMappingURL=type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/device-message/type.ts"],"names":[],"mappings":"AAAA,sJAAsJ;AACtJ,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IAC/B,+EAAS,CAAA;IACT,qFAAY,CAAA;AAChB,CAAC,EAHW,uBAAuB,GAAvB,uBAAuB,KAAvB,uBAAuB,QAGlC"}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './adb/index.js';
|
|
2
2
|
export * from './codec.js';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './message.js';
|
|
3
|
+
export * from './control/index.js';
|
|
4
|
+
export * from './device-message/index.js';
|
|
6
5
|
export * from './options/index.js';
|
|
7
|
-
export * from './push-server.js';
|
|
8
|
-
export * from './utils.js';
|
|
9
6
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './adb/index.js';
|
|
2
2
|
export * from './codec.js';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './message.js';
|
|
3
|
+
export * from './control/index.js';
|
|
4
|
+
export * from './device-message/index.js';
|
|
6
5
|
export * from './options/index.js';
|
|
7
|
-
export * from './push-server.js';
|
|
8
|
-
export * from './utils.js';
|
|
9
6
|
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AndroidCodecLevel, AndroidCodecProfile } from '../../codec.js';
|
|
2
|
+
import type { ScrcpyOptionValue } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* If the option you need is not in this type,
|
|
5
|
+
* please file an issue on GitHub.
|
|
6
|
+
*/
|
|
7
|
+
export interface CodecOptionsInit {
|
|
8
|
+
profile: AndroidCodecProfile;
|
|
9
|
+
level: AndroidCodecLevel;
|
|
10
|
+
iFrameInterval: number;
|
|
11
|
+
repeatPreviousFrameAfter: number;
|
|
12
|
+
maxPtsGapToEncoder: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class CodecOptions implements ScrcpyOptionValue {
|
|
15
|
+
value: Partial<CodecOptionsInit>;
|
|
16
|
+
constructor(value: Partial<CodecOptionsInit>);
|
|
17
|
+
toOptionValue(): string | undefined;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=codec-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec-options.d.ts","sourceRoot":"","sources":["../../../src/options/1_16/codec-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,KAAK,EAAE,iBAAiB,CAAC;IAEzB,cAAc,EAAE,MAAM,CAAC;IACvB,wBAAwB,EAAE,MAAM,CAAC;IACjC,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAWD,qBAAa,YAAa,YAAW,iBAAiB;IAC3C,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;gBAErB,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAI5C,aAAa,IAAI,MAAM,GAAG,SAAS;CAe7C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function toDashCase(input) {
|
|
2
|
+
return input.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
3
|
+
}
|
|
4
|
+
const CODEC_OPTION_TYPES = {
|
|
5
|
+
repeatPreviousFrameAfter: 'long',
|
|
6
|
+
maxPtsGapToEncoder: 'long',
|
|
7
|
+
};
|
|
8
|
+
export class CodecOptions {
|
|
9
|
+
value;
|
|
10
|
+
constructor(value) {
|
|
11
|
+
this.value = value;
|
|
12
|
+
}
|
|
13
|
+
toOptionValue() {
|
|
14
|
+
const entries = Object.entries(this.value)
|
|
15
|
+
.filter(([key, value]) => value !== undefined);
|
|
16
|
+
if (entries.length === 0) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
return entries
|
|
20
|
+
.map(([key, value]) => {
|
|
21
|
+
const type = CODEC_OPTION_TYPES[key];
|
|
22
|
+
return `${toDashCase(key)}${type ? `:${type}` : ''}=${value}`;
|
|
23
|
+
})
|
|
24
|
+
.join(',');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=codec-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec-options.js","sourceRoot":"","sources":["../../../src/options/1_16/codec-options.ts"],"names":[],"mappings":"AAgBA,SAAS,UAAU,CAAC,KAAa;IAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,kBAAkB,GAAyE;IAC7F,wBAAwB,EAAE,MAAM;IAChC,kBAAkB,EAAE,MAAM;CAC7B,CAAC;AAEF,MAAM,OAAO,YAAY;IACd,KAAK,CAA4B;IAExC,YAAmB,KAAgC;QAC/C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAEM,aAAa;QAChB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;aACrC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;QAEnD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,OAAO,SAAS,CAAC;SACpB;QAED,OAAO,OAAO;aACT,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAClB,MAAM,IAAI,GAAG,kBAAkB,CAAC,GAA6B,CAAC,CAAC;YAC/D,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,EAAE,CAAC;QAClE,CAAC,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;CACJ"}
|
|
@@ -1,108 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { ScrcpyClientConnection } from "../../connection.js";
|
|
5
|
-
import { ScrcpyControlMessageType } from "../../message.js";
|
|
6
|
-
import type { ScrcpyBackOrScreenOnEvent1_18 } from "../1_18.js";
|
|
7
|
-
import type { ScrcpyInjectScrollControlMessage1_22 } from "../1_22.js";
|
|
8
|
-
import { type ScrcpyOptions, type ScrcpyOptionValue, type VideoStreamPacket } from "../common.js";
|
|
9
|
-
export declare enum ScrcpyLogLevel {
|
|
10
|
-
Verbose = "verbose",
|
|
11
|
-
Debug = "debug",
|
|
12
|
-
Info = "info",
|
|
13
|
-
Warn = "warn",
|
|
14
|
-
Error = "error"
|
|
15
|
-
}
|
|
16
|
-
export declare enum ScrcpyVideoOrientation {
|
|
17
|
-
Initial = -2,
|
|
18
|
-
Unlocked = -1,
|
|
19
|
-
Portrait = 0,
|
|
20
|
-
Landscape = 1,
|
|
21
|
-
PortraitFlipped = 2,
|
|
22
|
-
LandscapeFlipped = 3
|
|
23
|
-
}
|
|
24
|
-
export interface CodecOptionsInit {
|
|
25
|
-
profile: AndroidCodecProfile;
|
|
26
|
-
level: AndroidCodecLevel;
|
|
27
|
-
}
|
|
28
|
-
export declare class CodecOptions implements ScrcpyOptionValue {
|
|
29
|
-
value: Partial<CodecOptionsInit>;
|
|
30
|
-
constructor(value: Partial<CodecOptionsInit>);
|
|
31
|
-
toOptionValue(): string | undefined;
|
|
32
|
-
}
|
|
33
|
-
export interface ScrcpyOptionsInit1_16 {
|
|
34
|
-
logLevel: ScrcpyLogLevel;
|
|
35
|
-
/**
|
|
36
|
-
* The maximum value of both width and height.
|
|
37
|
-
*/
|
|
38
|
-
maxSize: number;
|
|
39
|
-
bitRate: number;
|
|
40
|
-
/**
|
|
41
|
-
* 0 for unlimited.
|
|
42
|
-
*
|
|
43
|
-
* @default 0
|
|
44
|
-
*/
|
|
45
|
-
maxFps: number;
|
|
46
|
-
/**
|
|
47
|
-
* The orientation of the video stream.
|
|
48
|
-
*
|
|
49
|
-
* It will not keep the device screen in specific orientation,
|
|
50
|
-
* only the captured video will in this orientation.
|
|
51
|
-
*/
|
|
52
|
-
lockVideoOrientation: ScrcpyVideoOrientation;
|
|
53
|
-
tunnelForward: boolean;
|
|
54
|
-
crop: string;
|
|
55
|
-
/**
|
|
56
|
-
* Send PTS so that the client may record properly
|
|
57
|
-
*
|
|
58
|
-
* Note: When `sendFrameMeta: false` is specified,
|
|
59
|
-
* `onChangeEncoding` event won't fire and `onVideoData` event doesn't
|
|
60
|
-
* merge sps/pps frame and first video frame. Which means you can't use
|
|
61
|
-
* the shipped decoders to render the video
|
|
62
|
-
* (You can still record the stream into a file).
|
|
63
|
-
*
|
|
64
|
-
* @default true
|
|
65
|
-
*/
|
|
66
|
-
sendFrameMeta: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* @default true
|
|
69
|
-
*/
|
|
70
|
-
control: boolean;
|
|
71
|
-
displayId: number;
|
|
72
|
-
showTouches: boolean;
|
|
73
|
-
stayAwake: boolean;
|
|
74
|
-
codecOptions: CodecOptions;
|
|
75
|
-
encoderName: string;
|
|
76
|
-
}
|
|
77
|
-
export declare const VideoPacket: Struct<{
|
|
78
|
-
pts: bigint;
|
|
79
|
-
size: number;
|
|
80
|
-
data: Uint8Array;
|
|
81
|
-
}, "size", {}, undefined>;
|
|
82
|
-
export declare const NO_PTS: bigint;
|
|
83
|
-
export declare const ScrcpyBackOrScreenOnEvent1_16: Struct<{
|
|
84
|
-
type: number;
|
|
85
|
-
}, never, {}, undefined>;
|
|
86
|
-
export declare const ScrcpyInjectScrollControlMessage1_16: Struct<{
|
|
87
|
-
type: number;
|
|
88
|
-
pointerX: number;
|
|
89
|
-
pointerY: number;
|
|
90
|
-
screenWidth: number;
|
|
91
|
-
screenHeight: number;
|
|
92
|
-
scrollX: number;
|
|
93
|
-
scrollY: number;
|
|
94
|
-
}, never, {}, undefined>;
|
|
95
|
-
export declare class ScrcpyOptions1_16<T extends ScrcpyOptionsInit1_16 = ScrcpyOptionsInit1_16> implements ScrcpyOptions<T> {
|
|
96
|
-
value: Partial<T>;
|
|
97
|
-
constructor(value: Partial<ScrcpyOptionsInit1_16>);
|
|
98
|
-
protected getArgumentOrder(): (keyof T)[];
|
|
99
|
-
protected getDefaultValue(): T;
|
|
100
|
-
formatServerArguments(): string[];
|
|
101
|
-
createConnection(adb: Adb): ScrcpyClientConnection;
|
|
102
|
-
getOutputEncoderNameRegex(): RegExp;
|
|
103
|
-
createVideoStreamTransformer(): TransformStream<Uint8Array, VideoStreamPacket>;
|
|
104
|
-
getControlMessageTypes(): ScrcpyControlMessageType[];
|
|
105
|
-
serializeBackOrScreenOnControlMessage(message: ScrcpyBackOrScreenOnEvent1_18): Uint8Array | undefined;
|
|
106
|
-
serializeInjectScrollControlMessage(message: ScrcpyInjectScrollControlMessage1_22): Uint8Array;
|
|
107
|
-
}
|
|
1
|
+
export * from './codec-options.js';
|
|
2
|
+
export * from './options.js';
|
|
3
|
+
export * from './sps.js';
|
|
108
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/options/1_16/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/options/1_16/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
|
|
@@ -1,217 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { AndroidKeyEventAction, ScrcpyControlMessageType, ScrcpySimpleControlMessage } from "../../message.js";
|
|
5
|
-
import { toScrcpyOptionValue } from "../common.js";
|
|
6
|
-
import { parse_sequence_parameter_set } from "./sps.js";
|
|
7
|
-
export var ScrcpyLogLevel;
|
|
8
|
-
(function (ScrcpyLogLevel) {
|
|
9
|
-
ScrcpyLogLevel["Verbose"] = "verbose";
|
|
10
|
-
ScrcpyLogLevel["Debug"] = "debug";
|
|
11
|
-
ScrcpyLogLevel["Info"] = "info";
|
|
12
|
-
ScrcpyLogLevel["Warn"] = "warn";
|
|
13
|
-
ScrcpyLogLevel["Error"] = "error";
|
|
14
|
-
})(ScrcpyLogLevel || (ScrcpyLogLevel = {}));
|
|
15
|
-
export var ScrcpyVideoOrientation;
|
|
16
|
-
(function (ScrcpyVideoOrientation) {
|
|
17
|
-
ScrcpyVideoOrientation[ScrcpyVideoOrientation["Initial"] = -2] = "Initial";
|
|
18
|
-
ScrcpyVideoOrientation[ScrcpyVideoOrientation["Unlocked"] = -1] = "Unlocked";
|
|
19
|
-
ScrcpyVideoOrientation[ScrcpyVideoOrientation["Portrait"] = 0] = "Portrait";
|
|
20
|
-
ScrcpyVideoOrientation[ScrcpyVideoOrientation["Landscape"] = 1] = "Landscape";
|
|
21
|
-
ScrcpyVideoOrientation[ScrcpyVideoOrientation["PortraitFlipped"] = 2] = "PortraitFlipped";
|
|
22
|
-
ScrcpyVideoOrientation[ScrcpyVideoOrientation["LandscapeFlipped"] = 3] = "LandscapeFlipped";
|
|
23
|
-
})(ScrcpyVideoOrientation || (ScrcpyVideoOrientation = {}));
|
|
24
|
-
export class CodecOptions {
|
|
25
|
-
value;
|
|
26
|
-
constructor(value) {
|
|
27
|
-
this.value = value;
|
|
28
|
-
}
|
|
29
|
-
toOptionValue() {
|
|
30
|
-
const entries = Object.entries(this.value)
|
|
31
|
-
.filter(([key, value]) => value !== undefined);
|
|
32
|
-
if (entries.length === 0) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
return entries
|
|
36
|
-
.map(([key, value]) => `${key}=${value}`)
|
|
37
|
-
.join(',');
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export const VideoPacket = new Struct()
|
|
41
|
-
.uint64('pts')
|
|
42
|
-
.uint32('size')
|
|
43
|
-
.uint8Array('data', { lengthField: 'size' });
|
|
44
|
-
export const NO_PTS = BigInt(1) << BigInt(63);
|
|
45
|
-
export const ScrcpyBackOrScreenOnEvent1_16 = ScrcpySimpleControlMessage;
|
|
46
|
-
export const ScrcpyInjectScrollControlMessage1_16 = new Struct()
|
|
47
|
-
.fields(ScrcpySimpleControlMessage)
|
|
48
|
-
.uint32('pointerX')
|
|
49
|
-
.uint32('pointerY')
|
|
50
|
-
.uint16('screenWidth')
|
|
51
|
-
.uint16('screenHeight')
|
|
52
|
-
.int32('scrollX')
|
|
53
|
-
.int32('scrollY');
|
|
54
|
-
export class ScrcpyOptions1_16 {
|
|
55
|
-
value;
|
|
56
|
-
constructor(value) {
|
|
57
|
-
if (new.target === ScrcpyOptions1_16 &&
|
|
58
|
-
value.logLevel === ScrcpyLogLevel.Verbose) {
|
|
59
|
-
value.logLevel = ScrcpyLogLevel.Debug;
|
|
60
|
-
}
|
|
61
|
-
if (new.target === ScrcpyOptions1_16 &&
|
|
62
|
-
value.lockVideoOrientation === ScrcpyVideoOrientation.Initial) {
|
|
63
|
-
value.lockVideoOrientation = ScrcpyVideoOrientation.Unlocked;
|
|
64
|
-
}
|
|
65
|
-
this.value = value;
|
|
66
|
-
}
|
|
67
|
-
getArgumentOrder() {
|
|
68
|
-
return [
|
|
69
|
-
'logLevel',
|
|
70
|
-
'maxSize',
|
|
71
|
-
'bitRate',
|
|
72
|
-
'maxFps',
|
|
73
|
-
'lockVideoOrientation',
|
|
74
|
-
'tunnelForward',
|
|
75
|
-
'crop',
|
|
76
|
-
'sendFrameMeta',
|
|
77
|
-
'control',
|
|
78
|
-
'displayId',
|
|
79
|
-
'showTouches',
|
|
80
|
-
'stayAwake',
|
|
81
|
-
'codecOptions',
|
|
82
|
-
'encoderName',
|
|
83
|
-
];
|
|
84
|
-
}
|
|
85
|
-
getDefaultValue() {
|
|
86
|
-
return {
|
|
87
|
-
logLevel: ScrcpyLogLevel.Debug,
|
|
88
|
-
maxSize: 0,
|
|
89
|
-
bitRate: 8000000,
|
|
90
|
-
maxFps: 0,
|
|
91
|
-
lockVideoOrientation: ScrcpyVideoOrientation.Unlocked,
|
|
92
|
-
tunnelForward: false,
|
|
93
|
-
crop: '-',
|
|
94
|
-
sendFrameMeta: true,
|
|
95
|
-
control: true,
|
|
96
|
-
displayId: 0,
|
|
97
|
-
showTouches: false,
|
|
98
|
-
stayAwake: false,
|
|
99
|
-
codecOptions: new CodecOptions({}),
|
|
100
|
-
encoderName: '-',
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
formatServerArguments() {
|
|
104
|
-
const defaults = this.getDefaultValue();
|
|
105
|
-
return this.getArgumentOrder()
|
|
106
|
-
.map(key => toScrcpyOptionValue(this.value[key] || defaults[key], '-'));
|
|
107
|
-
}
|
|
108
|
-
createConnection(adb) {
|
|
109
|
-
const options = {
|
|
110
|
-
// Old scrcpy connection always have control stream no matter what the option is
|
|
111
|
-
control: true,
|
|
112
|
-
sendDummyByte: true,
|
|
113
|
-
sendDeviceMeta: true,
|
|
114
|
-
};
|
|
115
|
-
if (this.value.tunnelForward) {
|
|
116
|
-
return new ScrcpyClientForwardConnection(adb, options);
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
return new ScrcpyClientReverseConnection(adb, options);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
getOutputEncoderNameRegex() {
|
|
123
|
-
return /\s+scrcpy --encoder-name '(.*?)'/;
|
|
124
|
-
}
|
|
125
|
-
createVideoStreamTransformer() {
|
|
126
|
-
// Optimized path for video frames only
|
|
127
|
-
if (this.value.sendFrameMeta === false) {
|
|
128
|
-
return new TransformStream({
|
|
129
|
-
transform(chunk, controller) {
|
|
130
|
-
controller.enqueue({
|
|
131
|
-
type: 'frame',
|
|
132
|
-
data: chunk,
|
|
133
|
-
});
|
|
134
|
-
},
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
let header;
|
|
138
|
-
let deserializeStream = new StructDeserializeStream(VideoPacket);
|
|
139
|
-
return {
|
|
140
|
-
writable: deserializeStream.writable,
|
|
141
|
-
readable: deserializeStream.readable.pipeThrough(new TransformStream({
|
|
142
|
-
transform(packet, controller) {
|
|
143
|
-
if (packet.pts === NO_PTS) {
|
|
144
|
-
const sequenceParameterSet = parse_sequence_parameter_set(packet.data.slice().buffer);
|
|
145
|
-
const { profile_idc: profileIndex, constraint_set: constraintSet, level_idc: levelIndex, pic_width_in_mbs_minus1, pic_height_in_map_units_minus1, frame_mbs_only_flag, frame_crop_left_offset, frame_crop_right_offset, frame_crop_top_offset, frame_crop_bottom_offset, } = sequenceParameterSet;
|
|
146
|
-
const encodedWidth = (pic_width_in_mbs_minus1 + 1) * 16;
|
|
147
|
-
const encodedHeight = (pic_height_in_map_units_minus1 + 1) * (2 - frame_mbs_only_flag) * 16;
|
|
148
|
-
const cropLeft = frame_crop_left_offset * 2;
|
|
149
|
-
const cropRight = frame_crop_right_offset * 2;
|
|
150
|
-
const cropTop = frame_crop_top_offset * 2;
|
|
151
|
-
const cropBottom = frame_crop_bottom_offset * 2;
|
|
152
|
-
const croppedWidth = encodedWidth - cropLeft - cropRight;
|
|
153
|
-
const croppedHeight = encodedHeight - cropTop - cropBottom;
|
|
154
|
-
header = packet.data;
|
|
155
|
-
controller.enqueue({
|
|
156
|
-
type: 'configuration',
|
|
157
|
-
data: {
|
|
158
|
-
profileIndex,
|
|
159
|
-
constraintSet,
|
|
160
|
-
levelIndex,
|
|
161
|
-
encodedWidth,
|
|
162
|
-
encodedHeight,
|
|
163
|
-
cropLeft,
|
|
164
|
-
cropRight,
|
|
165
|
-
cropTop,
|
|
166
|
-
cropBottom,
|
|
167
|
-
croppedWidth,
|
|
168
|
-
croppedHeight,
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
let frameData;
|
|
174
|
-
if (header) {
|
|
175
|
-
frameData = new Uint8Array(header.byteLength + packet.data.byteLength);
|
|
176
|
-
frameData.set(header);
|
|
177
|
-
frameData.set(packet.data, header.byteLength);
|
|
178
|
-
header = undefined;
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
frameData = packet.data;
|
|
182
|
-
}
|
|
183
|
-
controller.enqueue({
|
|
184
|
-
type: 'frame',
|
|
185
|
-
pts: packet.pts,
|
|
186
|
-
data: frameData,
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
}))
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
getControlMessageTypes() {
|
|
193
|
-
return [
|
|
194
|
-
/* 0 */ ScrcpyControlMessageType.InjectKeycode,
|
|
195
|
-
/* 1 */ ScrcpyControlMessageType.InjectText,
|
|
196
|
-
/* 2 */ ScrcpyControlMessageType.InjectTouch,
|
|
197
|
-
/* 3 */ ScrcpyControlMessageType.InjectScroll,
|
|
198
|
-
/* 4 */ ScrcpyControlMessageType.BackOrScreenOn,
|
|
199
|
-
/* 5 */ ScrcpyControlMessageType.ExpandNotificationPanel,
|
|
200
|
-
/* 6 */ ScrcpyControlMessageType.CollapseNotificationPanel,
|
|
201
|
-
/* 7 */ ScrcpyControlMessageType.GetClipboard,
|
|
202
|
-
/* 8 */ ScrcpyControlMessageType.SetClipboard,
|
|
203
|
-
/* 9 */ ScrcpyControlMessageType.SetScreenPowerMode,
|
|
204
|
-
/* 10 */ ScrcpyControlMessageType.RotateDevice,
|
|
205
|
-
];
|
|
206
|
-
}
|
|
207
|
-
serializeBackOrScreenOnControlMessage(message) {
|
|
208
|
-
if (message.action === AndroidKeyEventAction.Down) {
|
|
209
|
-
return ScrcpyBackOrScreenOnEvent1_16.serialize(message);
|
|
210
|
-
}
|
|
211
|
-
return undefined;
|
|
212
|
-
}
|
|
213
|
-
serializeInjectScrollControlMessage(message) {
|
|
214
|
-
return ScrcpyInjectScrollControlMessage1_16.serialize(message);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
1
|
+
export * from './codec-options.js';
|
|
2
|
+
export * from './options.js';
|
|
3
|
+
export * from './sps.js';
|
|
217
4
|
//# sourceMappingURL=index.js.map
|