Skip to content

Commit

Permalink
Use device profile builder in jellyfinPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Aug 13, 2024
1 parent e65492c commit ff52e2a
Showing 1 changed file with 20 additions and 29 deletions.
49 changes: 20 additions & 29 deletions playback/jellyfin/src/main/kotlin/JellyfinPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit ff52e2a

Please sign in to comment.