Loading libraries/adb/src/commands/sync/pull.ts +3 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,9 @@ export async function* adbSyncPullGenerator( yield packet.data; } done = true; } catch (e) { done = true; throw e; } finally { if (!done) { // sync pull can't be cancelled, so we have to read all data Loading libraries/scrcpy/src/options/1_16/codec-options.ts +20 −5 Original line number Diff line number Diff line Loading @@ -27,14 +27,22 @@ const CODEC_OPTION_TYPES: Partial< }; export class CodecOptions implements ScrcpyOptionValue { value: Partial<CodecOptionsInit>; options: Partial<CodecOptionsInit>; constructor(value: Partial<CodecOptionsInit> = {}) { this.value = value; constructor(options: Partial<CodecOptionsInit> = {}) { for (const [key, value] of Object.entries(options)) { if (typeof value !== "number") { throw new Error( `Invalid option value for ${key}: ${String(value)}`, ); } } this.options = options; } toOptionValue(): string | undefined { const entries = Object.entries(this.value).filter( const entries = Object.entries(this.options).filter( ([, value]) => value !== undefined, ); Loading @@ -44,8 +52,15 @@ export class CodecOptions implements ScrcpyOptionValue { return entries .map(([key, value]) => { let result = toDashCase(key); const type = CODEC_OPTION_TYPES[key as keyof CodecOptionsInit]; return `${toDashCase(key)}${type ? `:${type}` : ""}=${value}`; if (type) { result += `:${type}`; } result += `=${value}`; return result; }) .join(","); } Loading libraries/scrcpy/src/options/types.ts +8 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,14 @@ export function toScrcpyOptionValue<T>(value: unknown, empty: T): string | T { return empty; } if ( typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean" ) { throw new Error(`Invalid option value: ${String(value)}`); } return String(value); } Loading Loading
libraries/adb/src/commands/sync/pull.ts +3 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,9 @@ export async function* adbSyncPullGenerator( yield packet.data; } done = true; } catch (e) { done = true; throw e; } finally { if (!done) { // sync pull can't be cancelled, so we have to read all data Loading
libraries/scrcpy/src/options/1_16/codec-options.ts +20 −5 Original line number Diff line number Diff line Loading @@ -27,14 +27,22 @@ const CODEC_OPTION_TYPES: Partial< }; export class CodecOptions implements ScrcpyOptionValue { value: Partial<CodecOptionsInit>; options: Partial<CodecOptionsInit>; constructor(value: Partial<CodecOptionsInit> = {}) { this.value = value; constructor(options: Partial<CodecOptionsInit> = {}) { for (const [key, value] of Object.entries(options)) { if (typeof value !== "number") { throw new Error( `Invalid option value for ${key}: ${String(value)}`, ); } } this.options = options; } toOptionValue(): string | undefined { const entries = Object.entries(this.value).filter( const entries = Object.entries(this.options).filter( ([, value]) => value !== undefined, ); Loading @@ -44,8 +52,15 @@ export class CodecOptions implements ScrcpyOptionValue { return entries .map(([key, value]) => { let result = toDashCase(key); const type = CODEC_OPTION_TYPES[key as keyof CodecOptionsInit]; return `${toDashCase(key)}${type ? `:${type}` : ""}=${value}`; if (type) { result += `:${type}`; } result += `=${value}`; return result; }) .join(","); } Loading
libraries/scrcpy/src/options/types.ts +8 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,14 @@ export function toScrcpyOptionValue<T>(value: unknown, empty: T): string | T { return empty; } if ( typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean" ) { throw new Error(`Invalid option value: ${String(value)}`); } return String(value); } Loading