From ff52e2a9a77f164c7931bb24734db79fc1d4c311 Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Tue, 13 Aug 2024 16:58:12 +0200 Subject: [PATCH] Use device profile builder in jellyfinPlugin --- .../src/main/kotlin/JellyfinPlugin.kt | 49 ++++++++----------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/playback/jellyfin/src/main/kotlin/JellyfinPlugin.kt b/playback/jellyfin/src/main/kotlin/JellyfinPlugin.kt index c10c39ddf8..00f5a00025 100644 --- a/playback/jellyfin/src/main/kotlin/JellyfinPlugin.kt +++ b/playback/jellyfin/src/main/kotlin/JellyfinPlugin.kt @@ -6,45 +6,36 @@ import org.jellyfin.playback.jellyfin.mediastream.VideoMediaStreamResolver import org.jellyfin.playback.jellyfin.playsession.PlaySessionService import org.jellyfin.playback.jellyfin.playsession.PlaySessionSocketService import org.jellyfin.sdk.api.client.ApiClient -import org.jellyfin.sdk.model.api.DeviceProfile import org.jellyfin.sdk.model.api.DlnaProfileType import org.jellyfin.sdk.model.api.EncodingContext import org.jellyfin.sdk.model.api.MediaStreamProtocol -import org.jellyfin.sdk.model.api.TranscodingProfile +import org.jellyfin.sdk.model.deviceprofile.buildDeviceProfile fun jellyfinPlugin( api: ApiClient, ) = playbackPlugin { - // TODO: Generate the device profile - val profile = DeviceProfile( - codecProfiles = emptyList(), - containerProfiles = emptyList(), - directPlayProfiles = emptyList(), - subtitleProfiles = emptyList(), + val profile = buildDeviceProfile { // Add at least one transcoding profile for both audio an video so the server returns a // value for "SupportsTranscoding" based on the user policy. We don't actually use this // profile in the client - transcodingProfiles = listOf( - TranscodingProfile( - type = DlnaProfileType.AUDIO, - context = EncodingContext.STREAMING, - protocol = MediaStreamProtocol.HLS, - container = "mp3", - audioCodec = "mp3", - videoCodec = "", - conditions = emptyList() - ), - TranscodingProfile( - type = DlnaProfileType.VIDEO, - context = EncodingContext.STREAMING, - protocol = MediaStreamProtocol.HLS, - container = "ts", - audioCodec = "aac", - videoCodec = "h264", - conditions = emptyList() - ) - ), - ) + transcodingProfile { + type = DlnaProfileType.AUDIO + context = EncodingContext.STREAMING + protocol = MediaStreamProtocol.HLS + container = "mp3" + audioCodec("mp3") + } + + transcodingProfile { + type = DlnaProfileType.VIDEO + context = EncodingContext.STREAMING + protocol = MediaStreamProtocol.HLS + container = "ts" + audioCodec("aac") + videoCodec("h264") + } + } + provide(AudioMediaStreamResolver(api, profile)) provide(VideoMediaStreamResolver(api, profile))