mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-03 09:49:24 +02:00
feat(adb-scrcpy): infer type of videoStream
from video
option
This commit is contained in:
parent
02f5bd5929
commit
24b65fd2c1
61 changed files with 653 additions and 336 deletions
|
@ -41,12 +41,14 @@ import {
|
|||
UHidOutputStream,
|
||||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions3_1 implements ScrcpyOptions<Init> {
|
||||
export class ScrcpyOptions3_1<TVideo extends boolean>
|
||||
implements ScrcpyOptions<Init<TVideo>>
|
||||
{
|
||||
static readonly Defaults = Defaults;
|
||||
|
||||
readonly version: string;
|
||||
|
||||
readonly value: Required<Init>;
|
||||
readonly value: Required<Init<TVideo>>;
|
||||
|
||||
get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
|
||||
return ControlMessageTypes;
|
||||
|
@ -66,8 +68,8 @@ export class ScrcpyOptions3_1 implements ScrcpyOptions<Init> {
|
|||
return this.#uHidOutput;
|
||||
}
|
||||
|
||||
constructor(init: Init, version = "3.1") {
|
||||
this.value = { ...Defaults, ...init };
|
||||
constructor(init: Init<TVideo>, version = "3.1") {
|
||||
this.value = { ...Defaults, ...init } as never;
|
||||
this.version = version;
|
||||
|
||||
if (this.value.videoSource === "camera") {
|
||||
|
@ -89,7 +91,7 @@ export class ScrcpyOptions3_1 implements ScrcpyOptions<Init> {
|
|||
}
|
||||
|
||||
serialize(): string[] {
|
||||
return serialize(this.value, Defaults);
|
||||
return serialize<Init<boolean>>(this.value, Defaults);
|
||||
}
|
||||
|
||||
setListDisplays(): void {
|
||||
|
@ -183,8 +185,8 @@ export class ScrcpyOptions3_1 implements ScrcpyOptions<Init> {
|
|||
}
|
||||
}
|
||||
|
||||
type Init_ = Init;
|
||||
type Init_<TVideo extends boolean> = Init<TVideo>;
|
||||
|
||||
export namespace ScrcpyOptions3_1 {
|
||||
export type Init = Init_;
|
||||
export type Init<TVideo extends boolean = boolean> = Init_<TVideo>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue