mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-03 17:59:50 +02:00
feat(scrcpy): move version to AdbScrcpyOptions
and simplify inheritance
This commit is contained in:
parent
b79df96301
commit
fe06652f52
69 changed files with 714 additions and 672 deletions
6
.changeset/chilly-tigers-float.md
Normal file
6
.changeset/chilly-tigers-float.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
"@yume-chan/adb-scrcpy": major
|
||||
"@yume-chan/scrcpy": major
|
||||
---
|
||||
|
||||
Move `version` parameter to `AdbScrcpyOptions`
|
|
@ -1,3 +1,2 @@
|
|||
export * from "./create-connection.js";
|
||||
export * from "./get-displays.js";
|
||||
export * from "./get-encoders.js";
|
||||
|
|
|
@ -1,33 +1,36 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_15 } from "@yume-chan/scrcpy";
|
||||
|
||||
import type { AdbScrcpyClientOptions } from "../client-options.js";
|
||||
import type { AdbScrcpyConnection } from "../connection.js";
|
||||
import { AdbScrcpyOptions } from "../types.js";
|
||||
import type { AdbScrcpyOptions } from "../types.js";
|
||||
|
||||
import { createConnection, getDisplays, getEncoders } from "./impl/index.js";
|
||||
import { createConnection, getDisplays } from "./impl/index.js";
|
||||
|
||||
export class AdbScrcpyOptions1_15
|
||||
extends ScrcpyOptions1_15
|
||||
implements AdbScrcpyOptions<ScrcpyOptions1_15.Init>
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions1_15 extends AdbScrcpyOptions<ScrcpyOptions1_15.Init> {
|
||||
constructor(
|
||||
init: ScrcpyOptions1_15.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions1_15(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "1.15";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,35 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_15_1 } from "@yume-chan/scrcpy";
|
||||
|
||||
import {
|
||||
createConnection,
|
||||
getDisplays,
|
||||
getEncoders,
|
||||
} from "./1_15/impl/index.js";
|
||||
import { createConnection, getDisplays } from "./1_15/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions1_15_1
|
||||
extends ScrcpyOptions1_15_1
|
||||
implements AdbScrcpyOptions<ScrcpyOptions1_15_1.Init>
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions1_15_1 extends AdbScrcpyOptions<ScrcpyOptions1_15_1.Init> {
|
||||
constructor(
|
||||
init: ScrcpyOptions1_15_1.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions1_15_1(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "1.15.1";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,35 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_16 } from "@yume-chan/scrcpy";
|
||||
|
||||
import {
|
||||
createConnection,
|
||||
getDisplays,
|
||||
getEncoders,
|
||||
} from "./1_15/impl/index.js";
|
||||
import { createConnection, getDisplays } from "./1_15/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions1_16
|
||||
extends ScrcpyOptions1_16
|
||||
implements AdbScrcpyOptions<ScrcpyOptions1_16.Init>
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions1_16 extends AdbScrcpyOptions<ScrcpyOptions1_16.Init> {
|
||||
constructor(
|
||||
init: ScrcpyOptions1_16.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions1_16(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "1.16";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_17 } from "@yume-chan/scrcpy";
|
||||
|
||||
import {
|
||||
createConnection,
|
||||
getDisplays,
|
||||
getEncoders,
|
||||
} from "./1_15/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions1_17 extends AdbScrcpyOptions<ScrcpyOptions1_17.Init> {
|
||||
constructor(
|
||||
init: ScrcpyOptions1_17.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions1_17(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace AdbScrcpyOptions1_17 {
|
||||
export type Init = ScrcpyOptions1_17.Init;
|
||||
}
|
|
@ -1,5 +1,9 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { ScrcpyEncoder, ScrcpyOptions1_15 } from "@yume-chan/scrcpy";
|
||||
import type {
|
||||
ScrcpyEncoder,
|
||||
ScrcpyOptions1_17,
|
||||
ScrcpyOptionsListEncoders,
|
||||
} from "@yume-chan/scrcpy";
|
||||
|
||||
import { AdbScrcpyClient } from "../../client.js";
|
||||
import type { AdbScrcpyOptions } from "../../types.js";
|
||||
|
@ -7,13 +11,14 @@ import type { AdbScrcpyOptions } from "../../types.js";
|
|||
export async function getEncoders(
|
||||
adb: Adb,
|
||||
path: string,
|
||||
options: AdbScrcpyOptions<Pick<ScrcpyOptions1_15.Init, "tunnelForward">>,
|
||||
options: AdbScrcpyOptions<Pick<ScrcpyOptions1_17.Init, "tunnelForward">> &
|
||||
ScrcpyOptionsListEncoders,
|
||||
): Promise<ScrcpyEncoder[]> {
|
||||
const client = await AdbScrcpyClient.start(adb, path, options);
|
||||
|
||||
const encoders: ScrcpyEncoder[] = [];
|
||||
|
||||
for await (const line of client.stdout) {
|
||||
for await (const line of client.output) {
|
||||
const encoder = options.parseEncoder(line);
|
||||
if (encoder) {
|
||||
encoders.push(encoder);
|
2
libraries/adb-scrcpy/src/1_17/impl/index.ts
Normal file
2
libraries/adb-scrcpy/src/1_17/impl/index.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
export * from "../../1_15/impl/index.js";
|
||||
export { getEncoders } from "./get-encoders.js";
|
1
libraries/adb-scrcpy/src/1_17/index.ts
Normal file
1
libraries/adb-scrcpy/src/1_17/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export * from "./options.js";
|
40
libraries/adb-scrcpy/src/1_17/options.ts
Normal file
40
libraries/adb-scrcpy/src/1_17/options.ts
Normal file
|
@ -0,0 +1,40 @@
|
|||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_17 } from "@yume-chan/scrcpy";
|
||||
|
||||
import type { AdbScrcpyClientOptions } from "../client-options.js";
|
||||
import type { AdbScrcpyConnection } from "../connection.js";
|
||||
import type { AdbScrcpyOptions } from "../types.js";
|
||||
|
||||
import { createConnection, getDisplays } from "./impl/index.js";
|
||||
|
||||
export class AdbScrcpyOptions1_17
|
||||
extends ScrcpyOptions1_17
|
||||
implements AdbScrcpyOptions<ScrcpyOptions1_17.Init>
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
constructor(
|
||||
init: ScrcpyOptions1_17.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "1.17";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace AdbScrcpyOptions1_17 {
|
||||
export type Init = ScrcpyOptions1_17.Init;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_18 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -6,31 +6,40 @@ import {
|
|||
createConnection,
|
||||
getDisplays,
|
||||
getEncoders,
|
||||
} from "./1_15/impl/index.js";
|
||||
} from "./1_17/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions1_18
|
||||
extends ScrcpyOptions1_18
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions1_18.Init>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions1_18 extends AdbScrcpyOptions<ScrcpyOptions1_18.Init> {
|
||||
constructor(
|
||||
init: ScrcpyOptions1_18.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions1_18(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "1.18";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_19 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -6,31 +6,40 @@ import {
|
|||
createConnection,
|
||||
getDisplays,
|
||||
getEncoders,
|
||||
} from "./1_15/impl/index.js";
|
||||
} from "./1_17/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions1_19
|
||||
extends ScrcpyOptions1_19
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions1_19.Init>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions1_19 extends AdbScrcpyOptions<ScrcpyOptions1_19.Init> {
|
||||
constructor(
|
||||
init: ScrcpyOptions1_19.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions1_19(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "1.19";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_20 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -6,31 +6,40 @@ import {
|
|||
createConnection,
|
||||
getDisplays,
|
||||
getEncoders,
|
||||
} from "./1_15/impl/index.js";
|
||||
} from "./1_17/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions1_20
|
||||
extends ScrcpyOptions1_20
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions1_20.Init>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions1_20 extends AdbScrcpyOptions<ScrcpyOptions1_20.Init> {
|
||||
constructor(
|
||||
init: ScrcpyOptions1_20.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions1_20(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "1.20";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_21 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -6,31 +6,40 @@ import {
|
|||
createConnection,
|
||||
getDisplays,
|
||||
getEncoders,
|
||||
} from "./1_15/impl/index.js";
|
||||
} from "./1_17/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions1_21
|
||||
extends ScrcpyOptions1_21
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions1_21.Init>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions1_21 extends AdbScrcpyOptions<ScrcpyOptions1_21.Init> {
|
||||
constructor(
|
||||
init: ScrcpyOptions1_21.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions1_21(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "1.21";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export * from "../../1_15/impl/index.js";
|
||||
export * from "../../1_17/impl/index.js";
|
||||
export { createConnection } from "./create-connection.js";
|
||||
|
|
|
@ -1,36 +1,45 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_22 } from "@yume-chan/scrcpy";
|
||||
|
||||
import {
|
||||
createConnection,
|
||||
getDisplays,
|
||||
getEncoders,
|
||||
} from "../1_15/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "../client-options.js";
|
||||
import type { AdbScrcpyConnection } from "../connection.js";
|
||||
import { AdbScrcpyOptions } from "../types.js";
|
||||
import type {
|
||||
AdbScrcpyOptions,
|
||||
AdbScrcpyOptionsGetEncoders,
|
||||
} from "../types.js";
|
||||
|
||||
import { createConnection, getDisplays, getEncoders } from "./impl/index.js";
|
||||
|
||||
export class AdbScrcpyOptions1_22
|
||||
extends ScrcpyOptions1_22
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions1_22.Init>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions1_22 extends AdbScrcpyOptions<ScrcpyOptions1_22.Init> {
|
||||
constructor(
|
||||
init: ScrcpyOptions1_22.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions1_22(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "1.22";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_23 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,28 +9,37 @@ import {
|
|||
} from "./1_22/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions1_23
|
||||
extends ScrcpyOptions1_23
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions1_23.Init>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions1_23 extends AdbScrcpyOptions<ScrcpyOptions1_23.Init> {
|
||||
constructor(
|
||||
init: ScrcpyOptions1_23.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions1_23(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "1.23";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_24 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,28 +9,37 @@ import {
|
|||
} from "./1_22/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions1_24
|
||||
extends ScrcpyOptions1_24
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions1_24.Init>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions1_24 extends AdbScrcpyOptions<ScrcpyOptions1_24.Init> {
|
||||
constructor(
|
||||
init: ScrcpyOptions1_24.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions1_24(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "1.24";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions1_25 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,28 +9,37 @@ import {
|
|||
} from "./1_22/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions1_25
|
||||
extends ScrcpyOptions1_25
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions1_25.Init>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions1_25 extends AdbScrcpyOptions<ScrcpyOptions1_25.Init> {
|
||||
constructor(
|
||||
init: ScrcpyOptions1_25.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions1_25(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "1.25";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { ScrcpyEncoder, ScrcpyOptions1_15 } from "@yume-chan/scrcpy";
|
||||
import type {
|
||||
ScrcpyEncoder,
|
||||
ScrcpyOptions2_0,
|
||||
ScrcpyOptionsListEncoders,
|
||||
} from "@yume-chan/scrcpy";
|
||||
|
||||
import { AdbScrcpyClient, AdbScrcpyExitedError } from "../../client.js";
|
||||
import type { AdbScrcpyOptions } from "../../types.js";
|
||||
|
@ -7,7 +11,8 @@ import type { AdbScrcpyOptions } from "../../types.js";
|
|||
export async function getEncoders(
|
||||
adb: Adb,
|
||||
path: string,
|
||||
options: AdbScrcpyOptions<Pick<ScrcpyOptions1_15.Init, "tunnelForward">>,
|
||||
options: AdbScrcpyOptions<Pick<ScrcpyOptions2_0.Init, "tunnelForward">> &
|
||||
ScrcpyOptionsListEncoders,
|
||||
): Promise<ScrcpyEncoder[]> {
|
||||
try {
|
||||
// Similar to `getDisplays`, now the server won't create video sockets,
|
||||
|
|
|
@ -1,33 +1,45 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions2_0 } from "@yume-chan/scrcpy";
|
||||
|
||||
import type { AdbScrcpyClientOptions } from "../client-options.js";
|
||||
import type { AdbScrcpyConnection } from "../connection.js";
|
||||
import { AdbScrcpyOptions } from "../types.js";
|
||||
import type {
|
||||
AdbScrcpyOptions,
|
||||
AdbScrcpyOptionsGetEncoders,
|
||||
} from "../types.js";
|
||||
|
||||
import { createConnection, getDisplays, getEncoders } from "./impl/index.js";
|
||||
|
||||
export class AdbScrcpyOptions2_0 extends AdbScrcpyOptions<ScrcpyOptions2_0.Init> {
|
||||
export class AdbScrcpyOptions2_0
|
||||
extends ScrcpyOptions2_0
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions2_0.Init>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
constructor(
|
||||
init: ScrcpyOptions2_0.Init,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions2_0(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "2.0";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +1,45 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions2_1 } from "@yume-chan/scrcpy";
|
||||
|
||||
import {
|
||||
createConnection,
|
||||
getDisplays,
|
||||
getEncoders,
|
||||
} from "../2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "../client-options.js";
|
||||
import type { AdbScrcpyConnection } from "../connection.js";
|
||||
import { AdbScrcpyOptions } from "../types.js";
|
||||
import type {
|
||||
AdbScrcpyOptions,
|
||||
AdbScrcpyOptionsGetEncoders,
|
||||
} from "../types.js";
|
||||
|
||||
import { createConnection, getDisplays, getEncoders } from "./impl/index.js";
|
||||
|
||||
export class AdbScrcpyOptions2_1<TVideo extends boolean>
|
||||
extends ScrcpyOptions2_1<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions2_1.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions2_1<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions2_1.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions2_1.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions2_1(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "2.1";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions2_1_1 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,30 +9,37 @@ import {
|
|||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions2_1_1<TVideo extends boolean>
|
||||
extends ScrcpyOptions2_1_1<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions2_1_1.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions2_1_1<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions2_1_1.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions2_1_1.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions2_1_1(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "2.1.1";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions2_2 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,30 +9,37 @@ import {
|
|||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions2_2<TVideo extends boolean>
|
||||
extends ScrcpyOptions2_2<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions2_2.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions2_2<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions2_2.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions2_2.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions2_2(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "v2.2";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions2_3 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,30 +9,37 @@ import {
|
|||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions2_3<TVideo extends boolean>
|
||||
extends ScrcpyOptions2_3<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions2_3.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions2_3<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions2_3.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions2_3.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions2_3(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "2.3";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions2_3_1 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,30 +9,37 @@ import {
|
|||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions2_3_1<TVideo extends boolean>
|
||||
extends ScrcpyOptions2_3_1<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions2_3_1.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions2_3_1<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions2_3_1.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions2_3_1.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions2_3_1(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "2.3.1";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions2_4 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,30 +9,37 @@ import {
|
|||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions2_4<TVideo extends boolean>
|
||||
extends ScrcpyOptions2_4<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions2_4.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions2_4<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions2_4.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions2_4.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions2_4(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "2.4";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions2_5 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,30 +9,37 @@ import {
|
|||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions2_5<TVideo extends boolean>
|
||||
extends ScrcpyOptions2_5<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions2_5.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions2_5<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions2_5.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions2_5.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions2_5(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "2.5";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions2_6 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,30 +9,37 @@ import {
|
|||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions2_6<TVideo extends boolean>
|
||||
extends ScrcpyOptions2_6<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions2_6.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions2_6<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions2_6.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions2_6.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions2_6(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "2.6";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions2_7 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,30 +9,37 @@ import {
|
|||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions2_7<TVideo extends boolean>
|
||||
extends ScrcpyOptions2_7<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions2_7.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions2_7<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions2_7.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions2_7.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions2_7(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "2.7";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions3_0 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,30 +9,37 @@ import {
|
|||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions3_0<TVideo extends boolean>
|
||||
extends ScrcpyOptions3_0<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions3_0.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions3_0<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions3_0.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions3_0.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions3_0(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "3.0";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions3_0_1 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,30 +9,37 @@ import {
|
|||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions3_0_1<TVideo extends boolean>
|
||||
extends ScrcpyOptions3_0_1<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions3_0_1.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions3_0_1<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions3_0_1.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions3_0_1.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions3_0_1(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "3.0.1";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions3_0_2 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,30 +9,37 @@ import {
|
|||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions3_0_2<TVideo extends boolean>
|
||||
extends ScrcpyOptions3_0_2<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions3_0_2.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions3_0_2<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions3_0_2.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions3_0_2.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions3_0_2(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "3.0.2";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Adb } from "@yume-chan/adb";
|
||||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions3_1 } from "@yume-chan/scrcpy";
|
||||
|
||||
|
@ -9,30 +9,37 @@ import {
|
|||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions3_1<TVideo extends boolean>
|
||||
extends ScrcpyOptions3_1<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions3_1.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
export class AdbScrcpyOptions3_1<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions<ScrcpyOptions3_1.Init<TVideo>> {
|
||||
constructor(
|
||||
init: ScrcpyOptions3_1.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(
|
||||
new ScrcpyOptions3_1(init, clientOptions?.version),
|
||||
clientOptions?.spawner,
|
||||
);
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "3.1";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
override getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
override getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
override createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import {
|
|||
import { ExactReadableEndedError } from "@yume-chan/struct";
|
||||
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import type { AdbScrcpyOptions } from "./types.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
import { AdbScrcpyVideoStream } from "./video.js";
|
||||
|
||||
function arrayToStream<T>(array: T[]): ReadableStream<T> {
|
||||
|
@ -68,7 +68,7 @@ export class AdbScrcpyExitedError extends Error {
|
|||
interface AdbScrcpyClientInit<TOptions extends AdbScrcpyOptions<object>> {
|
||||
options: TOptions;
|
||||
process: AdbNoneProtocolProcess;
|
||||
stdout: ReadableStream<string>;
|
||||
output: ReadableStream<string>;
|
||||
|
||||
videoStream: ReadableStream<Uint8Array> | undefined;
|
||||
audioStream: ReadableStream<Uint8Array> | undefined;
|
||||
|
@ -188,7 +188,7 @@ export class AdbScrcpyClient<TOptions extends AdbScrcpyOptions<object>> {
|
|||
return new AdbScrcpyClient({
|
||||
options,
|
||||
process,
|
||||
stdout: concatStreams(arrayToStream(lines), output),
|
||||
output: concatStreams(arrayToStream(lines), output),
|
||||
videoStream: streams.video,
|
||||
audioStream: streams.audio,
|
||||
controlStream: streams.control,
|
||||
|
@ -208,7 +208,7 @@ export class AdbScrcpyClient<TOptions extends AdbScrcpyOptions<object>> {
|
|||
static getEncoders(
|
||||
adb: Adb,
|
||||
path: string,
|
||||
options: AdbScrcpyOptions<object>,
|
||||
options: AdbScrcpyOptions<object> & AdbScrcpyOptionsGetEncoders,
|
||||
): Promise<ScrcpyEncoder[]> {
|
||||
options.setListEncoders();
|
||||
return options.getEncoders(adb, path);
|
||||
|
@ -230,9 +230,9 @@ export class AdbScrcpyClient<TOptions extends AdbScrcpyOptions<object>> {
|
|||
#options: TOptions;
|
||||
#process: AdbNoneProtocolProcess;
|
||||
|
||||
#stdout: ReadableStream<string>;
|
||||
get stdout() {
|
||||
return this.#stdout;
|
||||
#output: ReadableStream<string>;
|
||||
get output() {
|
||||
return this.#output;
|
||||
}
|
||||
|
||||
get exited() {
|
||||
|
@ -290,14 +290,14 @@ export class AdbScrcpyClient<TOptions extends AdbScrcpyOptions<object>> {
|
|||
constructor({
|
||||
options,
|
||||
process,
|
||||
stdout,
|
||||
output,
|
||||
videoStream,
|
||||
audioStream,
|
||||
controlStream,
|
||||
}: AdbScrcpyClientInit<TOptions>) {
|
||||
this.#options = options;
|
||||
this.#process = process;
|
||||
this.#stdout = stdout;
|
||||
this.#output = output;
|
||||
|
||||
this.#videoStream = videoStream
|
||||
? this.#createVideoStream(videoStream)
|
||||
|
@ -349,6 +349,12 @@ export class AdbScrcpyClient<TOptions extends AdbScrcpyOptions<object>> {
|
|||
async #createAudioStream(
|
||||
initialStream: ReadableStream<Uint8Array>,
|
||||
): Promise<AdbScrcpyAudioStreamMetadata> {
|
||||
if (!this.#options.parseAudioStreamMetadata) {
|
||||
throw new Error(
|
||||
"parsing audio stream is not supported in this version",
|
||||
);
|
||||
}
|
||||
|
||||
const metadata =
|
||||
await this.#options.parseAudioStreamMetadata(initialStream);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export * from "./1_15/index.js";
|
||||
export * from "./1_15_1.js";
|
||||
export * from "./1_16.js";
|
||||
export * from "./1_17.js";
|
||||
export * from "./1_17/index.js";
|
||||
export * from "./1_18.js";
|
||||
export * from "./1_19.js";
|
||||
export * from "./1_20.js";
|
||||
|
|
|
@ -3,27 +3,21 @@ import type {
|
|||
ScrcpyDisplay,
|
||||
ScrcpyEncoder,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
} from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptionsWrapper } from "@yume-chan/scrcpy";
|
||||
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
|
||||
export abstract class AdbScrcpyOptions<
|
||||
T extends object,
|
||||
> extends ScrcpyOptionsWrapper<T> {
|
||||
#spawner: AdbNoneProtocolSpawner | undefined;
|
||||
get spawner() {
|
||||
return this.#spawner;
|
||||
}
|
||||
export interface AdbScrcpyOptions<T extends object> extends ScrcpyOptions<T> {
|
||||
readonly version: string;
|
||||
|
||||
constructor(base: ScrcpyOptions<T>, spawner?: AdbNoneProtocolSpawner) {
|
||||
super(base);
|
||||
this.#spawner = spawner;
|
||||
}
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
abstract getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]>;
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]>;
|
||||
|
||||
abstract getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]>;
|
||||
|
||||
abstract createConnection(adb: Adb): AdbScrcpyConnection;
|
||||
createConnection(adb: Adb): AdbScrcpyConnection;
|
||||
}
|
||||
|
||||
export interface AdbScrcpyOptionsGetEncoders extends ScrcpyOptionsListEncoders {
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]>;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { EventEmitter } from "@yume-chan/event";
|
||||
import { StickyEventEmitter } from "@yume-chan/event";
|
||||
import type {
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyVideoStreamMetadata,
|
||||
|
@ -27,7 +27,7 @@ export class AdbScrcpyVideoStream {
|
|||
return this.#stream;
|
||||
}
|
||||
|
||||
#sizeChanged = new EventEmitter<{ width: number; height: number }>();
|
||||
#sizeChanged = new StickyEventEmitter<{ width: number; height: number }>();
|
||||
get sizeChanged() {
|
||||
return this.#sizeChanged.event;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyControlMessageType,
|
||||
|
@ -36,8 +36,6 @@ import {
|
|||
export class ScrcpyOptions1_15 implements ScrcpyOptions<Init> {
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -49,9 +47,8 @@ export class ScrcpyOptions1_15 implements ScrcpyOptions<Init> {
|
|||
return this.#clipboard;
|
||||
}
|
||||
|
||||
constructor(init: Init, version = "1.15") {
|
||||
constructor(init: Init) {
|
||||
this.value = { ...Defaults, ...init };
|
||||
this.version = version;
|
||||
|
||||
if (this.value.control) {
|
||||
this.#clipboard = new ClipboardStream();
|
||||
|
@ -78,7 +75,7 @@ export class ScrcpyOptions1_15 implements ScrcpyOptions<Init> {
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard!.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { ScrcpyOptions1_15 } from "./1_15/index.js";
|
||||
|
||||
export class ScrcpyOptions1_15_1 extends ScrcpyOptions1_15 {
|
||||
constructor(init: ScrcpyOptions1_15.Init, version = "1.15.1") {
|
||||
super(init, version);
|
||||
constructor(init: ScrcpyOptions1_15.Init) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { ScrcpyOptions1_15 } from "./1_15/index.js";
|
||||
|
||||
export class ScrcpyOptions1_16 extends ScrcpyOptions1_15 {
|
||||
constructor(init: ScrcpyOptions1_15.Init, version = "1.16") {
|
||||
super(init, version);
|
||||
constructor(init: ScrcpyOptions1_15.Init) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyControlMessageType,
|
||||
|
@ -8,6 +8,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -37,11 +38,11 @@ import {
|
|||
setListEncoders,
|
||||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions1_17 implements ScrcpyOptions<Init> {
|
||||
export class ScrcpyOptions1_17
|
||||
implements ScrcpyOptions<Init>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -53,9 +54,8 @@ export class ScrcpyOptions1_17 implements ScrcpyOptions<Init> {
|
|||
return this.#clipboard;
|
||||
}
|
||||
|
||||
constructor(init: Init, version = "1.17") {
|
||||
constructor(init: Init) {
|
||||
this.value = { ...Defaults, ...init };
|
||||
this.version = version;
|
||||
|
||||
if (this.value.control) {
|
||||
this.#clipboard = new ClipboardStream();
|
||||
|
@ -90,7 +90,7 @@ export class ScrcpyOptions1_17 implements ScrcpyOptions<Init> {
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard!.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyControlMessageType,
|
||||
|
@ -8,6 +8,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -37,11 +38,11 @@ import {
|
|||
setListEncoders,
|
||||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions1_18 implements ScrcpyOptions<Init> {
|
||||
export class ScrcpyOptions1_18
|
||||
implements ScrcpyOptions<Init>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -53,9 +54,8 @@ export class ScrcpyOptions1_18 implements ScrcpyOptions<Init> {
|
|||
return this.#clipboard;
|
||||
}
|
||||
|
||||
constructor(init: Init, version = "1.18") {
|
||||
constructor(init: Init) {
|
||||
this.value = { ...Defaults, ...init };
|
||||
this.version = version;
|
||||
|
||||
if (this.value.control) {
|
||||
this.#clipboard = new ClipboardStream();
|
||||
|
@ -90,7 +90,7 @@ export class ScrcpyOptions1_18 implements ScrcpyOptions<Init> {
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard!.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { ScrcpyOptions1_18 } from "./1_18/index.js";
|
||||
|
||||
export class ScrcpyOptions1_19 extends ScrcpyOptions1_18 {
|
||||
constructor(init: ScrcpyOptions1_18.Init, version = "1.19") {
|
||||
super(init, version);
|
||||
constructor(init: ScrcpyOptions1_18.Init) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { ScrcpyOptions1_18 } from "./1_18/index.js";
|
||||
|
||||
export class ScrcpyOptions1_20 extends ScrcpyOptions1_18 {
|
||||
constructor(init: ScrcpyOptions1_18.Init, version = "1.20") {
|
||||
super(init, version);
|
||||
constructor(init: ScrcpyOptions1_18.Init) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyControlMessageType,
|
||||
|
@ -8,6 +8,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -36,11 +37,11 @@ import {
|
|||
setListEncoders,
|
||||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions1_21 implements ScrcpyOptions<Init> {
|
||||
export class ScrcpyOptions1_21
|
||||
implements ScrcpyOptions<Init>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -54,9 +55,8 @@ export class ScrcpyOptions1_21 implements ScrcpyOptions<Init> {
|
|||
|
||||
#ackClipboardHandler: AckClipboardHandler | undefined;
|
||||
|
||||
constructor(init: Init, version = "1.21") {
|
||||
constructor(init: Init) {
|
||||
this.value = { ...Defaults, ...init };
|
||||
this.version = version;
|
||||
|
||||
if (this.value.control && this.value.clipboardAutosync) {
|
||||
this.#clipboard = new ClipboardStream();
|
||||
|
@ -92,7 +92,7 @@ export class ScrcpyOptions1_21 implements ScrcpyOptions<Init> {
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyControlMessageType,
|
||||
|
@ -8,6 +8,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -36,11 +37,11 @@ import {
|
|||
setListEncoders,
|
||||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions1_22 implements ScrcpyOptions<Init> {
|
||||
export class ScrcpyOptions1_22
|
||||
implements ScrcpyOptions<Init>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -54,9 +55,8 @@ export class ScrcpyOptions1_22 implements ScrcpyOptions<Init> {
|
|||
|
||||
#ackClipboardHandler: AckClipboardHandler | undefined;
|
||||
|
||||
constructor(init: Init, version = "1.22") {
|
||||
constructor(init: Init) {
|
||||
this.value = { ...Defaults, ...init };
|
||||
this.version = version;
|
||||
|
||||
if (this.value.control && this.value.clipboardAutosync) {
|
||||
this.#clipboard = new ClipboardStream();
|
||||
|
@ -92,7 +92,7 @@ export class ScrcpyOptions1_22 implements ScrcpyOptions<Init> {
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyControlMessageType,
|
||||
|
@ -8,6 +8,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -36,11 +37,11 @@ import {
|
|||
setListEncoders,
|
||||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions1_23 implements ScrcpyOptions<Init> {
|
||||
export class ScrcpyOptions1_23
|
||||
implements ScrcpyOptions<Init>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -54,9 +55,8 @@ export class ScrcpyOptions1_23 implements ScrcpyOptions<Init> {
|
|||
|
||||
#ackClipboardHandler: AckClipboardHandler | undefined;
|
||||
|
||||
constructor(init: Init, version = "1.23") {
|
||||
constructor(init: Init) {
|
||||
this.value = { ...Defaults, ...init };
|
||||
this.version = version;
|
||||
|
||||
if (this.value.control && this.value.clipboardAutosync) {
|
||||
this.#clipboard = new ClipboardStream();
|
||||
|
@ -92,7 +92,7 @@ export class ScrcpyOptions1_23 implements ScrcpyOptions<Init> {
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyControlMessageType,
|
||||
|
@ -8,6 +8,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -36,11 +37,11 @@ import {
|
|||
setListEncoders,
|
||||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions1_24 implements ScrcpyOptions<Init> {
|
||||
export class ScrcpyOptions1_24
|
||||
implements ScrcpyOptions<Init>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -54,9 +55,8 @@ export class ScrcpyOptions1_24 implements ScrcpyOptions<Init> {
|
|||
|
||||
#ackClipboardHandler: AckClipboardHandler | undefined;
|
||||
|
||||
constructor(init: Init, version = "1.24") {
|
||||
constructor(init: Init) {
|
||||
this.value = { ...Defaults, ...init };
|
||||
this.version = version;
|
||||
|
||||
if (this.value.control && this.value.clipboardAutosync) {
|
||||
this.#clipboard = new ClipboardStream();
|
||||
|
@ -92,7 +92,7 @@ export class ScrcpyOptions1_24 implements ScrcpyOptions<Init> {
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyControlMessageType,
|
||||
|
@ -8,6 +8,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -36,11 +37,11 @@ import {
|
|||
setListEncoders,
|
||||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions1_25 implements ScrcpyOptions<Init> {
|
||||
export class ScrcpyOptions1_25
|
||||
implements ScrcpyOptions<Init>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -54,9 +55,8 @@ export class ScrcpyOptions1_25 implements ScrcpyOptions<Init> {
|
|||
|
||||
#ackClipboardHandler: AckClipboardHandler | undefined;
|
||||
|
||||
constructor(init: Init, version = "1.25") {
|
||||
constructor(init: Init) {
|
||||
this.value = { ...Defaults, ...init };
|
||||
this.version = version;
|
||||
|
||||
if (this.value.control && this.value.clipboardAutosync) {
|
||||
this.#clipboard = new ClipboardStream();
|
||||
|
@ -92,7 +92,7 @@ export class ScrcpyOptions1_25 implements ScrcpyOptions<Init> {
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyAudioStreamMetadata,
|
||||
|
@ -9,6 +9,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -37,11 +38,11 @@ import {
|
|||
setListEncoders,
|
||||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions2_0 implements ScrcpyOptions<Init> {
|
||||
export class ScrcpyOptions2_0
|
||||
implements ScrcpyOptions<Init>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -55,9 +56,8 @@ export class ScrcpyOptions2_0 implements ScrcpyOptions<Init> {
|
|||
|
||||
#ackClipboardHandler: AckClipboardHandler | undefined;
|
||||
|
||||
constructor(init: Init, version = "2.0") {
|
||||
constructor(init: Init) {
|
||||
this.value = { ...Defaults, ...init };
|
||||
this.version = version;
|
||||
|
||||
if (this.value.control && this.value.clipboardAutosync) {
|
||||
this.#clipboard = new ClipboardStream();
|
||||
|
@ -99,7 +99,7 @@ export class ScrcpyOptions2_0 implements ScrcpyOptions<Init> {
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyAudioStreamMetadata,
|
||||
|
@ -9,6 +9,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -38,12 +39,10 @@ import {
|
|||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions2_1<TVideo extends boolean>
|
||||
implements ScrcpyOptions<Init<TVideo>>
|
||||
implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init<TVideo>>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -57,9 +56,8 @@ export class ScrcpyOptions2_1<TVideo extends boolean>
|
|||
|
||||
#ackClipboardHandler: AckClipboardHandler | undefined;
|
||||
|
||||
constructor(init: Init<TVideo>, version = "2.1") {
|
||||
constructor(init: Init<TVideo>) {
|
||||
this.value = { ...Defaults, ...init } as never;
|
||||
this.version = version;
|
||||
|
||||
if (this.value.control && this.value.clipboardAutosync) {
|
||||
this.#clipboard = new ClipboardStream();
|
||||
|
@ -101,7 +99,7 @@ export class ScrcpyOptions2_1<TVideo extends boolean>
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -3,8 +3,8 @@ import { ScrcpyOptions2_1 } from "./2_1/index.js";
|
|||
export class ScrcpyOptions2_1_1<
|
||||
TVideo extends boolean,
|
||||
> extends ScrcpyOptions2_1<TVideo> {
|
||||
constructor(init: ScrcpyOptions2_1.Init<TVideo>, version = "2.1.1") {
|
||||
super(init, version);
|
||||
constructor(init: ScrcpyOptions2_1.Init<TVideo>) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyAudioStreamMetadata,
|
||||
|
@ -9,6 +9,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -38,12 +39,10 @@ import {
|
|||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions2_2<TVideo extends boolean>
|
||||
implements ScrcpyOptions<Init<TVideo>>
|
||||
implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init<TVideo>>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -57,9 +56,8 @@ export class ScrcpyOptions2_2<TVideo extends boolean>
|
|||
|
||||
#ackClipboardHandler: AckClipboardHandler | undefined;
|
||||
|
||||
constructor(init: Init<TVideo>, version = "v2.2") {
|
||||
constructor(init: Init<TVideo>) {
|
||||
this.value = { ...Defaults, ...init } as never;
|
||||
this.version = version;
|
||||
|
||||
if (this.value.videoSource === "camera") {
|
||||
this.value.control = false;
|
||||
|
@ -105,7 +103,7 @@ export class ScrcpyOptions2_2<TVideo extends boolean>
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyAudioStreamMetadata,
|
||||
|
@ -9,6 +9,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -38,12 +39,10 @@ import {
|
|||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions2_3<TVideo extends boolean>
|
||||
implements ScrcpyOptions<Init<TVideo>>
|
||||
implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init<TVideo>>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -57,9 +56,8 @@ export class ScrcpyOptions2_3<TVideo extends boolean>
|
|||
|
||||
#ackClipboardHandler: AckClipboardHandler | undefined;
|
||||
|
||||
constructor(init: Init<TVideo>, version = "2.3") {
|
||||
constructor(init: Init<TVideo>) {
|
||||
this.value = { ...Defaults, ...init } as never;
|
||||
this.version = version;
|
||||
|
||||
if (this.value.videoSource === "camera") {
|
||||
this.value.control = false;
|
||||
|
@ -105,7 +103,7 @@ export class ScrcpyOptions2_3<TVideo extends boolean>
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -3,8 +3,8 @@ import { ScrcpyOptions2_3 } from "./2_3/index.js";
|
|||
export class ScrcpyOptions2_3_1<
|
||||
TVideo extends boolean,
|
||||
> extends ScrcpyOptions2_3<TVideo> {
|
||||
constructor(init: ScrcpyOptions2_3.Init<TVideo>, version = "2.3.1") {
|
||||
super(init, version);
|
||||
constructor(init: ScrcpyOptions2_3.Init<TVideo>) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyAudioStreamMetadata,
|
||||
|
@ -9,6 +9,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -42,12 +43,10 @@ import {
|
|||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions2_4<TVideo extends boolean>
|
||||
implements ScrcpyOptions<Init<TVideo>>
|
||||
implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init<TVideo>>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -68,9 +67,8 @@ export class ScrcpyOptions2_4<TVideo extends boolean>
|
|||
return this.#uHidOutput;
|
||||
}
|
||||
|
||||
constructor(init: Init<TVideo>, version = "2.4") {
|
||||
constructor(init: Init<TVideo>) {
|
||||
this.value = { ...Defaults, ...init } as never;
|
||||
this.version = version;
|
||||
|
||||
if (this.value.videoSource === "camera") {
|
||||
this.value.control = false;
|
||||
|
@ -120,7 +118,7 @@ export class ScrcpyOptions2_4<TVideo extends boolean>
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -3,8 +3,8 @@ import { ScrcpyOptions2_4 } from "./2_4/index.js";
|
|||
export class ScrcpyOptions2_5<
|
||||
TVideo extends boolean,
|
||||
> extends ScrcpyOptions2_4<TVideo> {
|
||||
constructor(init: ScrcpyOptions2_4.Init<TVideo>, version = "2.5") {
|
||||
super(init, version);
|
||||
constructor(init: ScrcpyOptions2_4.Init<TVideo>) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyAudioStreamMetadata,
|
||||
|
@ -9,6 +9,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -42,12 +43,10 @@ import {
|
|||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions2_6<TVideo extends boolean>
|
||||
implements ScrcpyOptions<Init<TVideo>>
|
||||
implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init<TVideo>>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -68,9 +67,8 @@ export class ScrcpyOptions2_6<TVideo extends boolean>
|
|||
return this.#uHidOutput;
|
||||
}
|
||||
|
||||
constructor(init: Init<TVideo>, version = "2.6") {
|
||||
constructor(init: Init<TVideo>) {
|
||||
this.value = { ...Defaults, ...init } as never;
|
||||
this.version = version;
|
||||
|
||||
if (this.value.videoSource === "camera") {
|
||||
this.value.control = false;
|
||||
|
@ -124,7 +122,7 @@ export class ScrcpyOptions2_6<TVideo extends boolean>
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -3,8 +3,8 @@ import { ScrcpyOptions2_6 } from "./2_6/index.js";
|
|||
export class ScrcpyOptions2_6_1<
|
||||
TVideo extends boolean,
|
||||
> extends ScrcpyOptions2_6<TVideo> {
|
||||
constructor(init: ScrcpyOptions2_6.Init<TVideo>, version = "2.6.1") {
|
||||
super(init, version);
|
||||
constructor(init: ScrcpyOptions2_6.Init<TVideo>) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyAudioStreamMetadata,
|
||||
|
@ -9,6 +9,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -42,12 +43,10 @@ import {
|
|||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions2_7<TVideo extends boolean>
|
||||
implements ScrcpyOptions<Init<TVideo>>
|
||||
implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init<TVideo>>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -68,9 +67,8 @@ export class ScrcpyOptions2_7<TVideo extends boolean>
|
|||
return this.#uHidOutput;
|
||||
}
|
||||
|
||||
constructor(init: Init<TVideo>, version = "2.7") {
|
||||
constructor(init: Init<TVideo>) {
|
||||
this.value = { ...Defaults, ...init } as never;
|
||||
this.version = version;
|
||||
|
||||
if (this.value.videoSource === "camera") {
|
||||
this.value.control = false;
|
||||
|
@ -124,7 +122,7 @@ export class ScrcpyOptions2_7<TVideo extends boolean>
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyAudioStreamMetadata,
|
||||
|
@ -9,6 +9,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -42,12 +43,10 @@ import {
|
|||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions3_0<TVideo extends boolean>
|
||||
implements ScrcpyOptions<Init<TVideo>>
|
||||
implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init<TVideo>>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -68,9 +67,8 @@ export class ScrcpyOptions3_0<TVideo extends boolean>
|
|||
return this.#uHidOutput;
|
||||
}
|
||||
|
||||
constructor(init: Init<TVideo>, version = "3.0") {
|
||||
constructor(init: Init<TVideo>) {
|
||||
this.value = { ...Defaults, ...init } as never;
|
||||
this.version = version;
|
||||
|
||||
if (this.value.videoSource === "camera") {
|
||||
this.value.control = false;
|
||||
|
@ -124,7 +122,7 @@ export class ScrcpyOptions3_0<TVideo extends boolean>
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -3,8 +3,8 @@ import { ScrcpyOptions3_0 } from "./3_0/index.js";
|
|||
export class ScrcpyOptions3_0_1<
|
||||
TVideo extends boolean,
|
||||
> extends ScrcpyOptions3_0<TVideo> {
|
||||
constructor(init: ScrcpyOptions3_0.Init<TVideo>, version = "3.0.1") {
|
||||
super(init, version);
|
||||
constructor(init: ScrcpyOptions3_0.Init<TVideo>) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ import { ScrcpyOptions3_0 } from "./3_0/index.js";
|
|||
export class ScrcpyOptions3_0_2<
|
||||
TVideo extends boolean,
|
||||
> extends ScrcpyOptions3_0<TVideo> {
|
||||
constructor(init: ScrcpyOptions3_0.Init<TVideo>, version = "3.0.2") {
|
||||
super(init, version);
|
||||
constructor(init: ScrcpyOptions3_0.Init<TVideo>) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyAudioStreamMetadata,
|
||||
|
@ -9,6 +9,7 @@ import type {
|
|||
ScrcpyEncoder,
|
||||
ScrcpyMediaStreamPacket,
|
||||
ScrcpyOptions,
|
||||
ScrcpyOptionsListEncoders,
|
||||
ScrcpyScrollController,
|
||||
ScrcpyVideoStream,
|
||||
} from "../base/index.js";
|
||||
|
@ -42,12 +43,10 @@ import {
|
|||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions3_1<TVideo extends boolean>
|
||||
implements ScrcpyOptions<Init<TVideo>>
|
||||
implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init<TVideo>>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
|
@ -68,9 +67,8 @@ export class ScrcpyOptions3_1<TVideo extends boolean>
|
|||
return this.#uHidOutput;
|
||||
}
|
||||
|
||||
constructor(init: Init<TVideo>, version = "3.1") {
|
||||
constructor(init: Init<TVideo>) {
|
||||
this.value = { ...Defaults, ...init } as never;
|
||||
this.version = version;
|
||||
|
||||
if (this.value.videoSource === "camera") {
|
||||
this.value.control = false;
|
||||
|
@ -124,7 +122,7 @@ export class ScrcpyOptions3_1<TVideo extends boolean>
|
|||
|
||||
async parseDeviceMessage(
|
||||
id: number,
|
||||
stream: AsyncExactReadable,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void> {
|
||||
if (await this.#clipboard?.parse(id, stream)) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type {
|
||||
ScrcpyBackOrScreenOnControlMessage,
|
||||
|
@ -19,8 +19,6 @@ import type { ScrcpyScrollController } from "./scroll-controller.js";
|
|||
import type { ScrcpyVideoStream } from "./video.js";
|
||||
|
||||
export interface ScrcpyOptions<T extends object> {
|
||||
get version(): string;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[];
|
||||
|
||||
value: Required<T>;
|
||||
|
@ -37,10 +35,6 @@ export interface ScrcpyOptions<T extends object> {
|
|||
|
||||
parseDisplay(line: string): ScrcpyDisplay | undefined;
|
||||
|
||||
setListEncoders?(): void;
|
||||
|
||||
parseEncoder?(line: string): ScrcpyEncoder | undefined;
|
||||
|
||||
parseVideoStreamMetadata(
|
||||
stream: ReadableStream<Uint8Array>,
|
||||
): MaybePromiseLike<ScrcpyVideoStream>;
|
||||
|
@ -49,7 +43,10 @@ export interface ScrcpyOptions<T extends object> {
|
|||
stream: ReadableStream<Uint8Array>,
|
||||
): MaybePromiseLike<ScrcpyAudioStreamMetadata>;
|
||||
|
||||
parseDeviceMessage(id: number, stream: AsyncExactReadable): Promise<void>;
|
||||
parseDeviceMessage(
|
||||
id: number,
|
||||
stream: ExactReadable | AsyncExactReadable,
|
||||
): Promise<void>;
|
||||
|
||||
endDeviceMessageStream(e?: unknown): void;
|
||||
|
||||
|
@ -76,3 +73,9 @@ export interface ScrcpyOptions<T extends object> {
|
|||
message: ScrcpyUHidCreateControlMessage,
|
||||
): Uint8Array;
|
||||
}
|
||||
|
||||
export interface ScrcpyOptionsListEncoders {
|
||||
setListEncoders(): void;
|
||||
|
||||
parseEncoder(line: string): ScrcpyEncoder | undefined;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ import { ScrcpyOptions3_1 } from "./3_1/options.js";
|
|||
export class ScrcpyOptionsLatest<
|
||||
TVideo extends boolean,
|
||||
> extends ScrcpyOptions3_1<TVideo> {
|
||||
constructor(init: ScrcpyOptions3_1.Init<TVideo>, version: string) {
|
||||
super(init, version);
|
||||
constructor(init: ScrcpyOptions3_1.Init<TVideo>) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
export * from "./clamp.js";
|
||||
export * from "./constants.js";
|
||||
export * from "./omit.js";
|
||||
export * from "./wrapper.js";
|
||||
|
|
|
@ -1,135 +0,0 @@
|
|||
import type { MaybePromiseLike } from "@yume-chan/async";
|
||||
import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
|
||||
import type { AsyncExactReadable } from "@yume-chan/struct";
|
||||
|
||||
import type { ScrcpyAudioStreamMetadata } from "../base/audio.js";
|
||||
import type { ScrcpyEncoder } from "../base/encoder.js";
|
||||
import type { ScrcpyMediaStreamPacket } from "../base/media.js";
|
||||
import type { ScrcpyOptions } from "../base/options.js";
|
||||
import type { ScrcpyScrollController } from "../base/scroll-controller.js";
|
||||
import type { ScrcpyVideoStream } from "../base/video.js";
|
||||
import type {
|
||||
ScrcpyBackOrScreenOnControlMessage,
|
||||
ScrcpyInjectTouchControlMessage,
|
||||
ScrcpySetClipboardControlMessage,
|
||||
ScrcpyUHidCreateControlMessage,
|
||||
} from "../latest.js";
|
||||
|
||||
export class ScrcpyOptionsWrapper<T extends object>
|
||||
implements ScrcpyOptions<T>
|
||||
{
|
||||
#base: ScrcpyOptions<T>;
|
||||
|
||||
get version() {
|
||||
return this.#base.version;
|
||||
}
|
||||
|
||||
get controlMessageTypes() {
|
||||
return this.#base.controlMessageTypes;
|
||||
}
|
||||
|
||||
get value() {
|
||||
return this.#base.value;
|
||||
}
|
||||
|
||||
get clipboard() {
|
||||
return this.#base.clipboard;
|
||||
}
|
||||
|
||||
get uHidOutput() {
|
||||
return this.#base.uHidOutput;
|
||||
}
|
||||
|
||||
constructor(base: ScrcpyOptions<T>) {
|
||||
this.#base = base;
|
||||
}
|
||||
|
||||
serialize(): string[] {
|
||||
return this.#base.serialize();
|
||||
}
|
||||
|
||||
setListDisplays() {
|
||||
this.#base.setListDisplays();
|
||||
}
|
||||
|
||||
parseDisplay(line: string) {
|
||||
return this.#base.parseDisplay(line);
|
||||
}
|
||||
|
||||
setListEncoders(): void {
|
||||
if (!this.#base.setListEncoders) {
|
||||
throw new Error("setListEncoders is not implemented");
|
||||
}
|
||||
this.#base.setListEncoders();
|
||||
}
|
||||
|
||||
parseEncoder(line: string): ScrcpyEncoder | undefined {
|
||||
if (!this.#base.parseEncoder) {
|
||||
throw new Error("parseEncoder is not implemented");
|
||||
}
|
||||
return this.#base.parseEncoder(line);
|
||||
}
|
||||
|
||||
parseVideoStreamMetadata(
|
||||
stream: ReadableStream<Uint8Array>,
|
||||
): MaybePromiseLike<ScrcpyVideoStream> {
|
||||
return this.#base.parseVideoStreamMetadata(stream);
|
||||
}
|
||||
|
||||
parseAudioStreamMetadata(
|
||||
stream: ReadableStream<Uint8Array>,
|
||||
): MaybePromiseLike<ScrcpyAudioStreamMetadata> {
|
||||
if (!this.#base.parseAudioStreamMetadata) {
|
||||
throw new Error("parseAudioStreamMetadata is not implemented");
|
||||
}
|
||||
return this.#base.parseAudioStreamMetadata(stream);
|
||||
}
|
||||
|
||||
parseDeviceMessage(id: number, stream: AsyncExactReadable): Promise<void> {
|
||||
return this.#base.parseDeviceMessage(id, stream);
|
||||
}
|
||||
|
||||
endDeviceMessageStream(e?: unknown): void {
|
||||
this.#base.endDeviceMessageStream(e);
|
||||
}
|
||||
|
||||
createMediaStreamTransformer(): TransformStream<
|
||||
Uint8Array,
|
||||
ScrcpyMediaStreamPacket
|
||||
> {
|
||||
return this.#base.createMediaStreamTransformer();
|
||||
}
|
||||
|
||||
serializeInjectTouchControlMessage(
|
||||
message: ScrcpyInjectTouchControlMessage,
|
||||
): Uint8Array {
|
||||
return this.#base.serializeInjectTouchControlMessage(message);
|
||||
}
|
||||
|
||||
serializeBackOrScreenOnControlMessage(
|
||||
message: ScrcpyBackOrScreenOnControlMessage,
|
||||
): Uint8Array | undefined {
|
||||
return this.#base.serializeBackOrScreenOnControlMessage(message);
|
||||
}
|
||||
|
||||
serializeSetClipboardControlMessage(
|
||||
message: ScrcpySetClipboardControlMessage,
|
||||
): Uint8Array | [Uint8Array, Promise<void>] {
|
||||
return this.#base.serializeSetClipboardControlMessage(message);
|
||||
}
|
||||
|
||||
createScrollController(): ScrcpyScrollController {
|
||||
return this.#base.createScrollController();
|
||||
}
|
||||
|
||||
serializeUHidCreateControlMessage(
|
||||
message: ScrcpyUHidCreateControlMessage,
|
||||
): Uint8Array {
|
||||
if (!this.#base.serializeUHidCreateControlMessage) {
|
||||
throw new Error(
|
||||
"serializeUHidCreateControlMessage is not implemented",
|
||||
);
|
||||
}
|
||||
return this.#base.serializeUHidCreateControlMessage(message);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue