Loading apps/demo/src/components/hex-viewer.tsx +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ const useClasses = makeStyles({ }, hex: { marginLeft: '40px', fontVariantLigatures: 'none', }, }); Loading apps/demo/src/pages/scrcpy.tsx +21 −1 Original line number Diff line number Diff line Loading @@ -288,6 +288,8 @@ class ScrcpyPageState { Constructor: TinyH264Decoder, }]; decoder: H264Decoder | undefined = undefined; fpsCounterIntervalId: any = undefined; fps = 0; displays: number[] = []; updateDisplays = async () => { Loading Loading @@ -388,6 +390,14 @@ class ScrcpyPageState { }, }); if (this.running) { result.push({ key: 'fps', text: `FPS: ${this.fps}`, disabled: true, }); } return result; } Loading Loading @@ -723,8 +733,15 @@ class ScrcpyPageState { const decoderDefinition = this.decoders.find(x => x.key === this.settings.decoder) ?? this.decoders[0]; const decoder = new decoderDefinition.Constructor(); runInAction(() => { this.decoder = decoder; let lastFrameCount = 0; this.fpsCounterIntervalId = setInterval(action(() => { this.fps = decoder.frameRendered - lastFrameCount; lastFrameCount = decoder.frameRendered; }), 1000); }); const options = new ScrcpyOptions1_24({ Loading Loading @@ -802,6 +819,9 @@ class ScrcpyPageState { this.decoder?.dispose(); this.decoder = undefined; this.fps = 0; clearTimeout(this.fpsCounterIntervalId); this.client = undefined; this.running = false; } Loading libraries/scrcpy/README.md +90 −89 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ Scrcpy server has no backward compatibility on options input format. Currently t | 1.21 | `ScrcpyOptions1_21` | | 1.22 | `ScrcpyOptions1_22` | | 1.23 | `ScrcpyOptions1_23` | | 1.24 | `ScrcpyOptions1_24` | You must use the correct type according to the server version. Loading libraries/scrcpy/src/options/1_16/index.ts +345 −330 Original line number Diff line number Diff line Loading @@ -27,10 +27,22 @@ export enum ScrcpyVideoOrientation { export interface CodecOptionsInit { profile: AndroidCodecProfile; level: AndroidCodecLevel; iFrameInterval: number; repeatPreviousFrameAfter: number; maxPtsGapToEncoder: number; } function toDashCase(input: string) { return input.replace(/([A-Z])/g, '-$1').toLowerCase(); } const CODEC_OPTION_TYPES: Partial<Record<keyof CodecOptionsInit, 'long' | 'float' | 'string'>> = { repeatPreviousFrameAfter: 'long', maxPtsGapToEncoder: 'long', }; export class CodecOptions implements ScrcpyOptionValue { public value: Partial<CodecOptionsInit>; Loading @@ -47,7 +59,10 @@ export class CodecOptions implements ScrcpyOptionValue { } return entries .map(([key, value]) => `${key}=${value}`) .map(([key, value]) => { const type = CODEC_OPTION_TYPES[key as keyof CodecOptionsInit]; return `${toDashCase(key)}${type ? `:${type}` : ''}=${value}`; }) .join(','); } } Loading Loading
apps/demo/src/components/hex-viewer.tsx +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ const useClasses = makeStyles({ }, hex: { marginLeft: '40px', fontVariantLigatures: 'none', }, }); Loading
apps/demo/src/pages/scrcpy.tsx +21 −1 Original line number Diff line number Diff line Loading @@ -288,6 +288,8 @@ class ScrcpyPageState { Constructor: TinyH264Decoder, }]; decoder: H264Decoder | undefined = undefined; fpsCounterIntervalId: any = undefined; fps = 0; displays: number[] = []; updateDisplays = async () => { Loading Loading @@ -388,6 +390,14 @@ class ScrcpyPageState { }, }); if (this.running) { result.push({ key: 'fps', text: `FPS: ${this.fps}`, disabled: true, }); } return result; } Loading Loading @@ -723,8 +733,15 @@ class ScrcpyPageState { const decoderDefinition = this.decoders.find(x => x.key === this.settings.decoder) ?? this.decoders[0]; const decoder = new decoderDefinition.Constructor(); runInAction(() => { this.decoder = decoder; let lastFrameCount = 0; this.fpsCounterIntervalId = setInterval(action(() => { this.fps = decoder.frameRendered - lastFrameCount; lastFrameCount = decoder.frameRendered; }), 1000); }); const options = new ScrcpyOptions1_24({ Loading Loading @@ -802,6 +819,9 @@ class ScrcpyPageState { this.decoder?.dispose(); this.decoder = undefined; this.fps = 0; clearTimeout(this.fpsCounterIntervalId); this.client = undefined; this.running = false; } Loading
libraries/scrcpy/README.md +90 −89 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ Scrcpy server has no backward compatibility on options input format. Currently t | 1.21 | `ScrcpyOptions1_21` | | 1.22 | `ScrcpyOptions1_22` | | 1.23 | `ScrcpyOptions1_23` | | 1.24 | `ScrcpyOptions1_24` | You must use the correct type according to the server version. Loading
libraries/scrcpy/src/options/1_16/index.ts +345 −330 Original line number Diff line number Diff line Loading @@ -27,10 +27,22 @@ export enum ScrcpyVideoOrientation { export interface CodecOptionsInit { profile: AndroidCodecProfile; level: AndroidCodecLevel; iFrameInterval: number; repeatPreviousFrameAfter: number; maxPtsGapToEncoder: number; } function toDashCase(input: string) { return input.replace(/([A-Z])/g, '-$1').toLowerCase(); } const CODEC_OPTION_TYPES: Partial<Record<keyof CodecOptionsInit, 'long' | 'float' | 'string'>> = { repeatPreviousFrameAfter: 'long', maxPtsGapToEncoder: 'long', }; export class CodecOptions implements ScrcpyOptionValue { public value: Partial<CodecOptionsInit>; Loading @@ -47,7 +59,10 @@ export class CodecOptions implements ScrcpyOptionValue { } return entries .map(([key, value]) => `${key}=${value}`) .map(([key, value]) => { const type = CODEC_OPTION_TYPES[key as keyof CodecOptionsInit]; return `${toDashCase(key)}${type ? `:${type}` : ''}=${value}`; }) .join(','); } } Loading