mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-03 09:49:24 +02:00
feat(adb-scrcpy): accept string-typed scid
This commit is contained in:
parent
0f5af05adb
commit
6f00fd5606
5 changed files with 9 additions and 7 deletions
|
@ -16,7 +16,7 @@ import {
|
||||||
} from "@yume-chan/stream-extra";
|
} from "@yume-chan/stream-extra";
|
||||||
|
|
||||||
export interface AdbScrcpyConnectionOptions {
|
export interface AdbScrcpyConnectionOptions {
|
||||||
scid: number;
|
scid: string | undefined;
|
||||||
|
|
||||||
video: boolean;
|
video: boolean;
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ export abstract class AdbScrcpyConnection implements Disposable {
|
||||||
|
|
||||||
protected getSocketName(): string {
|
protected getSocketName(): string {
|
||||||
let socketName = "localabstract:" + SCRCPY_SOCKET_NAME_PREFIX;
|
let socketName = "localabstract:" + SCRCPY_SOCKET_NAME_PREFIX;
|
||||||
if (this.options.scid !== undefined && this.options.scid >= 0) {
|
if (this.options.scid !== undefined) {
|
||||||
socketName += "_" + this.options.scid.toString(16).padStart(8, "0");
|
socketName += "_" + this.options.scid.padStart(8, "0");
|
||||||
}
|
}
|
||||||
return socketName;
|
return socketName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ export class AdbScrcpyOptions1_16 extends AdbScrcpyOptions<
|
||||||
return AdbScrcpyOptions1_16.createConnection(
|
return AdbScrcpyOptions1_16.createConnection(
|
||||||
adb,
|
adb,
|
||||||
{
|
{
|
||||||
scid: -1, // Not Supported
|
scid: undefined, // Not Supported
|
||||||
video: true, // Always enabled
|
video: true, // Always enabled
|
||||||
audio: false, // Not Supported
|
audio: false, // Not Supported
|
||||||
control: true, // Always enabled even when `--no-control` is specified
|
control: true, // Always enabled even when `--no-control` is specified
|
||||||
|
|
|
@ -38,7 +38,7 @@ export class AdbScrcpyOptions1_22 extends AdbScrcpyOptions<
|
||||||
return AdbScrcpyOptions1_16.createConnection(
|
return AdbScrcpyOptions1_16.createConnection(
|
||||||
adb,
|
adb,
|
||||||
{
|
{
|
||||||
scid: -1, // Not Supported
|
scid: undefined, // Not Supported
|
||||||
video: true, // Always enabled
|
video: true, // Always enabled
|
||||||
audio: false, // Not Supported
|
audio: false, // Not Supported
|
||||||
control: this.value.control,
|
control: this.value.control,
|
||||||
|
|
|
@ -5,6 +5,7 @@ import type {
|
||||||
ScrcpyOptions1_16Impl,
|
ScrcpyOptions1_16Impl,
|
||||||
ScrcpyOptions2_0Impl,
|
ScrcpyOptions2_0Impl,
|
||||||
} from "@yume-chan/scrcpy";
|
} from "@yume-chan/scrcpy";
|
||||||
|
import { toScrcpyOptionValue } from "@yume-chan/scrcpy";
|
||||||
|
|
||||||
import { AdbScrcpyClient, AdbScrcpyExitedError } from "../client.js";
|
import { AdbScrcpyClient, AdbScrcpyExitedError } from "../client.js";
|
||||||
import type { AdbScrcpyConnection } from "../connection.js";
|
import type { AdbScrcpyConnection } from "../connection.js";
|
||||||
|
@ -77,7 +78,7 @@ export class AdbScrcpyOptions2_0 extends AdbScrcpyOptions<
|
||||||
return AdbScrcpyOptions1_16.createConnection(
|
return AdbScrcpyOptions1_16.createConnection(
|
||||||
adb,
|
adb,
|
||||||
{
|
{
|
||||||
scid: this.value.scid.value,
|
scid: toScrcpyOptionValue(this.value.scid, undefined),
|
||||||
video: true, // Always enabled
|
video: true, // Always enabled
|
||||||
audio: this.value.audio,
|
audio: this.value.audio,
|
||||||
control: this.value.control,
|
control: this.value.control,
|
||||||
|
|
|
@ -4,6 +4,7 @@ import type {
|
||||||
ScrcpyEncoder,
|
ScrcpyEncoder,
|
||||||
ScrcpyOptions2_1Impl,
|
ScrcpyOptions2_1Impl,
|
||||||
} from "@yume-chan/scrcpy";
|
} from "@yume-chan/scrcpy";
|
||||||
|
import { toScrcpyOptionValue } from "@yume-chan/scrcpy";
|
||||||
|
|
||||||
import type { AdbScrcpyConnection } from "../connection.js";
|
import type { AdbScrcpyConnection } from "../connection.js";
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ export class AdbScrcpyOptions2_1 extends AdbScrcpyOptions<
|
||||||
return AdbScrcpyOptions1_16.createConnection(
|
return AdbScrcpyOptions1_16.createConnection(
|
||||||
adb,
|
adb,
|
||||||
{
|
{
|
||||||
scid: this.value.scid.value,
|
scid: toScrcpyOptionValue(this.value.scid, undefined),
|
||||||
video: this.value.video,
|
video: this.value.video,
|
||||||
audio: this.value.audio,
|
audio: this.value.audio,
|
||||||
control: this.value.control,
|
control: this.value.control,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue