mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-05 19:42:15 +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
|
@ -37,12 +37,14 @@ import {
|
|||
setListEncoders,
|
||||
} from "./impl/index.js";
|
||||
|
||||
export class ScrcpyOptions2_3 implements ScrcpyOptions<Init> {
|
||||
export class ScrcpyOptions2_3<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;
|
||||
|
@ -55,8 +57,8 @@ export class ScrcpyOptions2_3 implements ScrcpyOptions<Init> {
|
|||
|
||||
#ackClipboardHandler: AckClipboardHandler | undefined;
|
||||
|
||||
constructor(init: Init, version = "2.3") {
|
||||
this.value = { ...Defaults, ...init };
|
||||
constructor(init: Init<TVideo>, version = "2.3") {
|
||||
this.value = { ...Defaults, ...init } as never;
|
||||
this.version = version;
|
||||
|
||||
if (this.value.videoSource === "camera") {
|
||||
|
@ -70,7 +72,7 @@ export class ScrcpyOptions2_3 implements ScrcpyOptions<Init> {
|
|||
}
|
||||
|
||||
serialize(): string[] {
|
||||
return serialize(this.value, Defaults);
|
||||
return serialize<Init<boolean>>(this.value, Defaults);
|
||||
}
|
||||
|
||||
setListDisplays(): void {
|
||||
|
@ -158,8 +160,8 @@ export class ScrcpyOptions2_3 implements ScrcpyOptions<Init> {
|
|||
}
|
||||
}
|
||||
|
||||
type Init_ = Init;
|
||||
type Init_<TVideo extends boolean> = Init<TVideo>;
|
||||
|
||||
export namespace ScrcpyOptions2_3 {
|
||||
export type Init = Init_;
|
||||
export type Init<TVideo extends boolean = boolean> = Init_<TVideo>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue