Skip to main content

## Module device_profile

Source
Expand description

Device-profile policy: turning what a device reports about its audio output into the constraints we send Jellyfin.

The platform layer reports raw facts (what `MediaCodecList` enumerates, how many channels the current audio route accepts); deciding what those facts mean for a `DeviceProfile` is domain logic and lives here, on the Rust side of the boundary, where it is testable without a device.

## Constants§

EXTERNAL_SUBTITLE_FORMATS 🔒
  Subtitle formats we can render ourselves, delivered as an external sidecar track rather than painted into the video.
FALLBACK_AUDIO_CHANNELS 🔒
  Channel count assumed when the platform cannot tell us — every audio route can voice stereo, so it is the only safe floor.
FALLBACK_AUDIO_CODEC 🔒
  The codec claimed when a device reports nothing we can use. Every renderer decodes AAC, and claiming something is what makes the server transcode to it rather than give up.
MAX_SUPPORTED_AUDIO_CHANNELS 🔒
  Upper bound we are willing to claim. Jellyfin profiles top out at 7.1, and a nonsense reading from a driver should not become a nonsense profile.
NO_SUBTITLE_STREAM
  Jellyfin’s sentinel for “negotiate no subtitle stream at all”.
SUBTITLE_QUERY_KEYS 🔒
  Query keys through which a stream URL can carry a subtitle decision.
WEBVIEW_AUDIO_CODECS 🔒
  Audio codecs the webview’s `<video>` element can decode.

## Functions§

audio_forces_transcode
  Decide whether we must transcode regardless of what the server negotiated, given the source’s audio streams as `(codec, is_default)` in source order.
clamp_max_audio_channels
  Decide the `MaxAudioChannels` to advertise, given what the current audio route reported.
max_audio_channels
  The channel cap for this device, reading the platform’s report where one exists.
playback_subtitle_stream_index
  The `SubtitleStreamIndex` to negotiate with: always “none”.
renderer_can_decode_audio
  Whether the renderer that decodes video on this platform can also decode this audio codec.
renderer_codecs
  What the renderer that will actually decode video on this platform can play.
served_audio_codec
  The codec of the audio track the server will actually serve, given the source’s audio streams as `(codec, is_default)` in source order: the default, or the first when none is marked.
subtitle_forces_burn_in
  Whether asking the server to serve this subtitle codec forces it to burn the subtitle into the picture.
subtitle_profiles
  The `SubtitleProfile` entries to advertise, as `(format, method)`.
subtitle_supports_external_delivery
  Whether a subtitle in this format can reach the app as a sidecar it draws itself — the same verdict as `subtitle_forces_burn_in`, from the reader’s side, and the one a subtitle picker needs.
video_audio_codecs
  Narrow a detected audio-codec list to what the renderer that will actually play the video can decode.
webview_can_decode_audio
  Whether the webview `<video>` element can decode this audio codec.
without_server_chosen_subtitle
  Rewrite a stream URL so it asks for no subtitle, whoever built it.