UNPKG

@yume-chan/scrcpy

Version:
62 lines 1.65 kB
export const VideoOrientation = { Unlocked: -1, Portrait: 0, Landscape: 1, PortraitFlipped: 2, LandscapeFlipped: 3, }; function toDashCase(input) { return input.replace(/([A-Z])/g, "-$1").toLowerCase(); } const CodecOptionTypes = { repeatPreviousFrameAfter: "long", maxPtsGapToEncoder: "long", }; export class CodecOptions { static Empty = /* #__PURE__ */ new CodecOptions(); options; constructor(options = {}) { for (const [key, value] of Object.entries(options)) { if (value === undefined) { continue; } if (typeof value !== "number") { throw new Error(`Invalid option value for ${key}: ${String(value)}`); } } this.options = options; } toOptionValue() { const entries = Object.entries(this.options).filter(([, value]) => value !== undefined); if (entries.length === 0) { return undefined; } return entries .map(([key, value]) => { let result = toDashCase(key); const type = CodecOptionTypes[key]; if (type) { result += `:${type}`; } result += `=${value}`; return result; }) .join(","); } } export class Crop { width; height; x; y; constructor(width, height, x, y) { this.width = width; this.height = height; this.x = x; this.y = y; } toOptionValue() { return `${this.width}:${this.height}:${this.x}:${this.y}`; } } //# sourceMappingURL=init.js.map