diff --git a/package.json b/package.json index 4bffbe30a..9d2afa3b2 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "react-router": "6.30.0", "react-router-dom": "6.30.0", "spatial-navigation-polyfill": "github:Stremio/spatial-navigation#64871b1422466f5f45d24ebc8bbd315b2ebab6a6", - "stremio-translations": "github:Stremio/stremio-translations#e40729413eee88d71908dcbb5d21c7925a99f4a2", + "stremio-translations": "github:Stremio/stremio-translations#89e695effcd165b6b1f2133d9bc5c4ffe37ba4be", "url": "0.11.4", "use-long-press": "^3.3.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ca22f8a32..1d32a6e82 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -96,8 +96,8 @@ importers: specifier: github:Stremio/spatial-navigation#64871b1422466f5f45d24ebc8bbd315b2ebab6a6 version: https://codeload.github.com/Stremio/spatial-navigation/tar.gz/64871b1422466f5f45d24ebc8bbd315b2ebab6a6 stremio-translations: - specifier: github:Stremio/stremio-translations#e40729413eee88d71908dcbb5d21c7925a99f4a2 - version: https://codeload.github.com/Stremio/stremio-translations/tar.gz/e40729413eee88d71908dcbb5d21c7925a99f4a2 + specifier: github:Stremio/stremio-translations#89e695effcd165b6b1f2133d9bc5c4ffe37ba4be + version: https://codeload.github.com/Stremio/stremio-translations/tar.gz/89e695effcd165b6b1f2133d9bc5c4ffe37ba4be url: specifier: 0.11.4 version: 0.11.4 @@ -4457,8 +4457,8 @@ packages: resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==} engines: {node: '>= 0.4'} - stremio-translations@https://codeload.github.com/Stremio/stremio-translations/tar.gz/e40729413eee88d71908dcbb5d21c7925a99f4a2: - resolution: {gitHosted: true, tarball: https://codeload.github.com/Stremio/stremio-translations/tar.gz/e40729413eee88d71908dcbb5d21c7925a99f4a2} + stremio-translations@https://codeload.github.com/Stremio/stremio-translations/tar.gz/89e695effcd165b6b1f2133d9bc5c4ffe37ba4be: + resolution: {gitHosted: true, tarball: https://codeload.github.com/Stremio/stremio-translations/tar.gz/89e695effcd165b6b1f2133d9bc5c4ffe37ba4be} version: 1.52.0 string-length@4.0.2: @@ -10050,7 +10050,7 @@ snapshots: es-errors: 1.3.0 internal-slot: 1.1.0 - stremio-translations@https://codeload.github.com/Stremio/stremio-translations/tar.gz/e40729413eee88d71908dcbb5d21c7925a99f4a2: {} + stremio-translations@https://codeload.github.com/Stremio/stremio-translations/tar.gz/89e695effcd165b6b1f2133d9bc5c4ffe37ba4be: {} string-length@4.0.2: dependencies: diff --git a/src/common/Platform/shell/shell.d.ts b/src/common/Platform/shell/shell.d.ts index bf7b25ca5..5c1b8eb93 100644 --- a/src/common/Platform/shell/shell.d.ts +++ b/src/common/Platform/shell/shell.d.ts @@ -14,12 +14,17 @@ type MediaStatus = { interface Shell { active: boolean, + capabilities: ShellCapabilities, state: ShellState, on: (name: string, listener: (arg: any) => void) => void; off: (name: string, listener: (arg: any) => void) => void; send: (method: string, ...args: (string | number | object)[]) => void; } +type ShellCapabilities = { + gpuVideoProcessing: boolean; +}; + type ShellState = { initialized: boolean; version: string | null; diff --git a/src/common/Platform/shell/useShell.ts b/src/common/Platform/shell/useShell.ts index 55775578d..a672fa990 100644 --- a/src/common/Platform/shell/useShell.ts +++ b/src/common/Platform/shell/useShell.ts @@ -41,6 +41,9 @@ const useShell = (): Shell => { windowClosed: false, windowHidden: false, }); + const [capabilities, setCapabilities] = useState({ + gpuVideoProcessing: false, + }); const on = (name: string, listener: (arg: any) => void) => events.on(name, listener); const off = (name: string, listener: (arg: any) => void) => events.off(name, listener); @@ -88,9 +91,16 @@ const useShell = (): Shell => { if (event.type === ShellEventType.INIT) { const { data } = event as ShellEventInit; - const [, [,,, version]] = data.transport.properties; + const [, [,,, version], [,,, gpuVideoProcessing] = []] = data.transport.properties; - setState((state) => ({ ...state, initialized: true, version })); + setState((state) => ({ + ...state, + initialized: true, + version, + })); + setCapabilities({ + gpuVideoProcessing: gpuVideoProcessing === 'true', + }); } if (event.type === ShellEventType.SIGNAL) { @@ -118,6 +128,7 @@ const useShell = (): Shell => { on, off, state, + capabilities, }; }; diff --git a/src/core/types/models/Ctx.d.ts b/src/core/types/models/Ctx.d.ts index 8d7e6cc9c..652cf83ca 100644 --- a/src/core/types/models/Ctx.d.ts +++ b/src/core/types/models/Ctx.d.ts @@ -20,6 +20,7 @@ type Settings = { bingeWatching: boolean, discordRpcEnabled: boolean, hardwareDecoding: boolean, + gpuVideoProcessing: boolean, videoMode: string | null, escExitFullscreen: boolean, interfaceLanguage: string, diff --git a/src/routes/Player/Player.js b/src/routes/Player/Player.js index c722dcd7a..fbfa46fd0 100644 --- a/src/routes/Player/Player.js +++ b/src/routes/Player/Player.js @@ -414,6 +414,7 @@ const Player = () => { maxAudioChannels: settings.surroundSound ? 32 : 2, hardwareDecoding: settings.hardwareDecoding, assSubtitlesStyling: settings.assSubtitlesStyling, + gpuVideoProcessing: settings.gpuVideoProcessing && platform.shell.capabilities.gpuVideoProcessing, videoMode: settings.videoMode, platform: platform.name, streamingServerURL: streamingServer.baseUrl ? diff --git a/src/routes/Settings/Player/Player.tsx b/src/routes/Settings/Player/Player.tsx index f45cf142c..29883e91d 100644 --- a/src/routes/Settings/Player/Player.tsx +++ b/src/routes/Settings/Player/Player.tsx @@ -28,6 +28,7 @@ const Player = forwardRef(({ profile }: Props, ref) => { bingeWatchingToggle, playInBackgroundToggle, hardwareDecodingToggle, + gpuVideoProcessingToggle, videoModeSelect, pauseOnMinimizeToggle, } = usePlayerOptions(profile); @@ -131,6 +132,15 @@ const Player = forwardRef(({ profile }: Props, ref) => { /> } + { + shell.active && shell.capabilities.gpuVideoProcessing && + + } { shell.active && platform.name === 'windows' &&