How jellyfin/jellyfin-desktop works
Purpose and Runtime
Jellyfin Desktop is a native cross-platform Jellyfin client: a Qt/Qt WebEngine shell hosting the Jellyfin web client, with libmpv-backed video/audio playback for hardware decoding, passthrough, and broad direct-play support. Primary executable startup is src/main.cpp; build composition begins at CMakeLists.txt and src/CMakeLists.txt.
Application Composition and Lifecycle
A component-oriented C++/Qt application initializes shared services, coordinates their lifecycle, and exposes native capabilities to the web UI. ComponentManager is the central orchestration boundary; globals and signals provide process-wide state/coordination.
• src/core/ComponentManager.cpp
• src/core/Globals.cpp
• src/core/SignalManager.cpp
Web UI and Native Bridge
The display/UI layer owns the application window and WebEngine QML view. JavaScript loaded into the web client calls native plugins for shell, connectivity, update, input, and MPV control; native code returns functionality to the browser-hosted UI rather than implementing Jellyfin screens itself.
• src/ui/WindowManager.cpp
• src/ui/webview.qml
• native/nativeshell.js
• native/mpvVideoPlayer.js
Playback Pipeline
PlayerComponent integrates libmpv with Qt rendering through MpvVideoItem; it is the principal media boundary between web-client commands and native playback/output. Album artwork and OpenGL detection support UI/media rendering and platform capability selection.
• src/player/PlayerComponent.cpp
• src/player/MpvVideoItem.cpp
• external/mpvrenderer-wrapper.cpp
Input and Control Translation
Input sources—keyboard, SDL controllers, CEC, LIRC, socket input, and Apple remotes/media keys—feed an input component and mapping layer. JSON maps translate device events into the web client’s expected controls; this decouples platform/device acquisition from UI commands.
• src/input/InputComponent.cpp
• src/input/InputMapping.cpp
• resources/inputmaps/keyboard.json
Profiles, Settings, and Local IPC
Per-profile configuration, cache, and logs are managed through profile/path services. Settings are represented as sections/values and include audio control. Local JSON server/client classes provide an in-machine communication boundary, likely for single-instance or companion process coordination.
• src/core/ProfileManager.cpp
• src/settings/SettingsComponent.cpp
• src/shared/LocalJsonServer.cpp
• src/shared/Paths.cpp
OS Integration
Platform-specific implementations abstract display management, power inhibition/system behavior, taskbar integration, and MPRIS media controls. Linux desktop environments use DBus/MPRIS; macOS, Windows, X11, Raspberry Pi, and OpenELEC have conditional implementations.
• src/display/DisplayManager.cpp
• src/power/PowerComponent.cpp
• src/mpris/MprisComponent.cpp
• src/system/SystemComponent.cpp
Build, Dependencies, and Distribution
CMake builds the native Qt application and conditionally discovers/configures Qt, MPV, SDL2, CEC, graphics, and platform dependencies. CI emits Linux, AppImage, macOS, and Windows artifacts; packaging templates create platform-native bundles/installers.
• CMakeModules/DependencyConfiguration.cmake
• CMakeModules/FindMPV.cmake
• .github/workflows/build-macos.yml
• bundle/win/JellyfinDesktop.iss.in
Main entry points: ComponentManager.cpp Component manager · webview.qml WebEngine QML view · PlayerComponent.cpp Player component · InputMapping.cpp Input mapping
Components 21
Native Runtime
Qt application services and platform integration.
- Application startup
src/main.cpp - Component manager · Initializes and coordinates shared application components.
src/core/ComponentManager.cpp - Global state & signals
src/core/Globals.cpp - Profiles & local paths · Manages per-profile configuration, cache, and logs.
src/core/ProfileManager.cpp - Settings service · Provides settings sections, values, and audio controls.
src/settings/SettingsComponent.cpp - Local JSON IPC · In-machine JSON server/client boundary.
src/shared/LocalJsonServer.cpp - OS integration · Display, power, system, taskbar, and MPRIS implementations per platform.
src/display/DisplayManager.cpp
Web Client Host
Browser-hosted Jellyfin UI and native JavaScript bridge.
- Window manager · Owns the application window and WebEngine view.
src/ui/WindowManager.cpp - WebEngine QML view
src/ui/webview.qml - Shell native bridge · Exposes shell, connectivity, update, and input capabilities to the web client.
native/nativeshell.js - MPV native bridge · Translates web-client playback commands to native MPV control.
native/mpvVideoPlayer.js
Playback & Input
Native media output and control translation.
- Player component · Primary boundary for native playback, hardware decoding, and output.
src/player/PlayerComponent.cpp - MPV Qt renderer · Renders libmpv output into the Qt UI.
src/player/MpvVideoItem.cpp - Input acquisition · Receives keyboard, controller, CEC, LIRC, socket, and Apple input.
src/input/InputComponent.cpp - Input mapping · Maps device events to web-client controls.
src/input/InputMapping.cpp - Keyboard map
resources/inputmaps/keyboard.json
Build & Distribution
Dependency configuration, CI, and installers.
- CMake build composition
CMakeLists.txt - Dependency discovery · Configures Qt, MPV, SDL2, CEC, graphics, and platform dependencies.
CMakeModules/DependencyConfiguration.cmake - MPV discovery
CMakeModules/FindMPV.cmake - macOS build pipeline
.github/workflows/build-macos.yml - Windows installer
bundle/win/JellyfinDesktop.iss.in
Connections 24
- CMake build composition → Dependency discovery: configures
- Dependency discovery → MPV discovery: finds
- macOS build pipeline → CMake build composition: builds
- Windows installer → CMake build composition: packages build
- Application startup → Component manager: starts
- Component manager → Global state & signals: coordinates
- Component manager → Profiles & local paths: initializes
- Component manager → Settings service: initializes
- Component manager → Local JSON IPC: initializes
- Component manager → Window manager: initializes
- Component manager → Player component: initializes
- Component manager → Input acquisition: initializes
- Component manager → OS integration: initializes
- Window manager → WebEngine QML view: hosts
- WebEngine QML view → Shell native bridge: calls
- WebEngine QML view → MPV native bridge: calls
- Shell native bridge → Input mapping: delivers controls
- MPV native bridge → Player component: controls
- Player component → MPV Qt renderer: renders through
- Input acquisition → Input mapping: forwards events
- Keyboard map → Input mapping: defines mappings
- Input mapping → WebEngine QML view: emits web controls
- Profiles & local paths → Settings service: stores settings
- Dependency discovery → Player component: provides MPV dependency