Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,20 @@ sealed interface AppPreference<Pref, T> {
summary = R.string.force_dovi_profile_7_summary,
)

val DoviDeviceCompatibilityPref =
Comment thread
whitingj marked this conversation as resolved.
AppChoicePreference<AppPreferences, DoviDeviceCompatibilityMode>(
title = R.string.dovi_device_compatibility_mode,
defaultValue = DoviDeviceCompatibilityMode.DOVI_ALLOW,
getter = { it.playbackPreferences.overrides.doviDeviceCompatibilityMode },
setter = { prefs, value ->
prefs.updatePlaybackOverrides { doviDeviceCompatibilityMode = value }
},
displayValues = R.array.dovi_device_compatibility_modes,
subtitles = R.array.dovi_device_compatibility_mode_descriptions,
indexToValue = { DoviDeviceCompatibilityMode.forNumber(it) ?: DoviDeviceCompatibilityMode.DOVI_ALLOW },
valueToIndex = { if (it != DoviDeviceCompatibilityMode.UNRECOGNIZED) it.number else 0 },
)

val DecodeAv1 =
AppSwitchPreference<AppPreferences>(
title = R.string.software_decoding_av1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ val experimentalPreferences =
ExperimentalPreference.VideoTunneling,
ExperimentalPreference.PreferAc3ForSurround,
ExperimentalPreference.DisableAudioOffload,
AppPreference.DoviDeviceCompatibilityPref,
),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ class DeviceProfileService
assDirectPlay = newConfig.overrides.assPlaybackMode != AssPlaybackMode.ASS_TRANSCODE,
pgsDirectPlay = newConfig.overrides.directPlayPgs,
dolbyVisionELDirectPlay = newConfig.overrides.directPlayDolbyVisionEL,
doviDeviceCompatibilityMode = newConfig.overrides.doviDeviceCompatibilityMode,
decodeAv1 = prefs.overrides.decodeAv1,
preferAc3ForSurround = appPrefs.experimentalPreferences.enabled { preferAc3Surround },
preferAc3ForSurround = newConfig.experimental.enabled { preferAc3Surround },

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to use newConfig so it is consistent with how all the other ones are done is this block.

jellyfinTenEleven = newConfig.jellyfinTenEleven,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package com.github.damontecres.wholphin.util.profile

import android.media.MediaCodecInfo
import androidx.media3.common.MimeTypes
import com.github.damontecres.wholphin.preferences.DoviDeviceCompatibilityMode
import com.github.damontecres.wholphin.util.profile.KnownDefects.supportsHi10P52
import org.jellyfin.sdk.model.api.CodecType
import org.jellyfin.sdk.model.api.DlnaProfileType
Expand Down Expand Up @@ -69,6 +70,7 @@ fun createDeviceProfile(
assDirectPlay: Boolean,
pgsDirectPlay: Boolean,
dolbyVisionELDirectPlay: Boolean,
doviDeviceCompatibilityMode: DoviDeviceCompatibilityMode,
decodeAv1: Boolean,
jellyfinTenEleven: Boolean,
preferAc3ForSurround: Boolean,
Expand Down Expand Up @@ -479,6 +481,23 @@ fun createDeviceProfile(
if (!mediaTest.supportsAV1HDR10()) add(VideoRangeType.HDR10.serialName)
}
}

// Check the user preferences for DoVi compatibility mode
when (doviDeviceCompatibilityMode) {
DoviDeviceCompatibilityMode.DISABLE_DOVI_ALL -> {
add(VideoRangeType.DOVI.serialName)
add(VideoRangeType.DOVI_WITH_HDR10.serialName)
Comment thread
whitingj marked this conversation as resolved.
add(VideoRangeType.DOVI_WITH_HLG.serialName)
add(VideoRangeType.DOVI_WITH_SDR.serialName)
if (jellyfinTenEleven) add("DOVIWithHDR10Plus")
}
DoviDeviceCompatibilityMode.DISABLE_DOVI_WITH_HDR10 -> {
add(VideoRangeType.DOVI_WITH_HDR10.serialName)
if (jellyfinTenEleven) add("DOVIWithHDR10Plus")
}
DoviDeviceCompatibilityMode.DOVI_ALLOW,
DoviDeviceCompatibilityMode.UNRECOGNIZED -> {}
}
}

// TODO Use VideoRangeType enum with Jellyfin 10.11 based SDK
Expand All @@ -498,11 +517,33 @@ fun createDeviceProfile(
add(VideoRangeType.DOVI.serialName)
if (!supportsHevcHDR10) add(VideoRangeType.DOVI_WITH_HDR10.serialName)
if (jellyfinTenEleven && !supportsHevcHDR10Plus && !KnownDefects.hevcDoviHdr10PlusBug) {
add(
"DOVIWithHDR10Plus",
)
add("DOVIWithHDR10Plus")
}
}
}

// Check the user preferences for DoVi compatibility mode
when (doviDeviceCompatibilityMode) {
DoviDeviceCompatibilityMode.DISABLE_DOVI_ALL -> {
add(VideoRangeType.DOVI.serialName)
add(VideoRangeType.DOVI_WITH_HDR10.serialName)
add(VideoRangeType.DOVI_WITH_HLG.serialName)
add(VideoRangeType.DOVI_WITH_SDR.serialName)
if (jellyfinTenEleven) {
add("DOVIWithHDR10Plus")
add("DOVIWithEL")
add("DOVIWithELHDR10Plus")
}
}
DoviDeviceCompatibilityMode.DISABLE_DOVI_WITH_HDR10 -> {
add(VideoRangeType.DOVI_WITH_HDR10.serialName)
if (jellyfinTenEleven) {
add("DOVIWithHDR10Plus")
add("DOVIWithELHDR10Plus")
}
}
DoviDeviceCompatibilityMode.DOVI_ALLOW,
DoviDeviceCompatibilityMode.UNRECOGNIZED -> {}
}

if (!supportsHevcHDR10Plus) {
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/proto/WholphinDataStore.proto
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ enum AssPlaybackMode{
ASS_TRANSCODE = 2;
}

enum DoviDeviceCompatibilityMode{
DOVI_ALLOW = 0;
DISABLE_DOVI_ALL = 1;
DISABLE_DOVI_WITH_HDR10 = 2;
}

message PlaybackOverrides{
bool ac3_supported = 1;
bool downmix_stereo = 2;
Expand All @@ -57,6 +63,7 @@ message PlaybackOverrides{
bool direct_play_dolby_vision_e_l = 6;
bool decode_av1 = 7;
AssPlaybackMode ass_playback_mode = 8;
DoviDeviceCompatibilityMode dovi_device_compatibility_mode = 9;
}

message PlaybackPreferences {
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,17 @@
<string name="dts">DTS</string>
<string name="force_dovi_profile_7">Direct play Dolby Vision Profile 7</string>
<string name="force_dovi_profile_7_summary">Ignores device compatibility checks</string>
<string name="dovi_device_compatibility_mode">Disable Dolby Vision</string>
<string-array name="dovi_device_compatibility_modes">
<item>Off</item>
<item>Disable All Dolby Vision</item>
<item>Disable Dolby Vision with HDR10</item>
</string-array>
<string-array name="dovi_device_compatibility_mode_descriptions">
<item>Allow Dolby Vision media</item>
<item>Force transcoding all Dolby Vision media</item>
<item>Force transcoding Dolby Vision with HDR10/HDR10+ hybrid media</item>
</string-array>

<string name="discover">Discover</string>
<string name="request">Request</string>
Expand Down