Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DTS playback - ask for transcoding when unsupported #3929

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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 @@ -110,6 +110,11 @@ class UserPreferences(context: Context) : SharedPreferenceStore(
*/
var audioNightMode = enumPreference("audio_night_mode", false)

/**
* Enable DTS
*/
var dtsEnabled = booleanPreference("pref_bitstream_dts", false)

/**
* Enable AC3
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ private VideoOptions buildExoPlayerOptions(@Nullable Integer forcedSubtitleIndex
DeviceProfile internalProfile = new ExoPlayerProfile(
isLiveTv && !userPreferences.getValue().get(UserPreferences.Companion.getLiveTvDirectPlayEnabled()),
userPreferences.getValue().get(UserPreferences.Companion.getAc3Enabled()),
userPreferences.getValue().get(UserPreferences.Companion.getDtsEnabled()),
userPreferences.getValue().get(UserPreferences.Companion.getAudioBehaviour()) == AudioBehavior.DOWNMIX_TO_STEREO
);
internalOptions.setProfile(internalProfile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ class PlaybackAdvancedPreferencesScreen : OptionsFragment() {
setContent(R.string.desc_bitstream_ac3)
bind(userPreferences, UserPreferences.ac3Enabled)
}

checkbox {
setTitle(R.string.lbl_bitstream_dts)
setContent(R.string.desc_bitstream_dts)
bind(userPreferences, UserPreferences.dtsEnabled)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import org.jellyfin.apiclient.model.dlna.TranscodingProfile
class ExoPlayerProfile(
disableVideoDirectPlay: Boolean,
isAC3Enabled: Boolean,
downMixAudio: Boolean
isDtsEnabled: Boolean,
downMixAudio: Boolean,
) : DeviceProfile() {
private val downmixSupportedAudioCodecs = arrayOf(
Codec.Audio.AAC,
Expand All @@ -46,7 +47,7 @@ class ExoPlayerProfile(
if (isAC3Enabled) add(Codec.Audio.AC3)
if (isAC3Enabled) add(Codec.Audio.EAC3)
add(Codec.Audio.DCA)
add(Codec.Audio.DTS)
if (isDtsEnabled) add(Codec.Audio.DTS)
add(Codec.Audio.MLP)
add(Codec.Audio.TRUEHD)
add(Codec.Audio.PCM_ALAW)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import org.jellyfin.apiclient.model.dlna.SubtitleProfile
import timber.log.Timber

object ProfileHelper {
private val MediaTest by lazy { MediaCodecCapabilitiesTest() }
private val mediaTest by lazy { MediaCodecCapabilitiesTest() }

val deviceAV1CodecProfile by lazy {
CodecProfile().apply {
type = CodecType.Video
codec = Codec.Video.AV1

conditions = when {
!MediaTest.supportsAV1() -> {
!mediaTest.supportsAV1() -> {
// The following condition is a method to exclude all AV1
Timber.i("*** Does NOT support AV1")
arrayOf(
Expand All @@ -33,7 +33,7 @@ object ProfileHelper {
)
)
}
!MediaTest.supportsAV1Main10() -> {
!mediaTest.supportsAV1Main10() -> {
Timber.i("*** Does NOT support AV1 10 bit")
arrayOf(
ProfileCondition(
Expand All @@ -59,11 +59,11 @@ object ProfileHelper {
}

val supportsAVC by lazy {
MediaTest.supportsAVC()
mediaTest.supportsAVC()
}

val supportsAVCHigh10 by lazy {
MediaTest.supportsAVCHigh10()
mediaTest.supportsAVCHigh10()
}

val deviceAVCCodecProfile by lazy {
Expand Down Expand Up @@ -128,7 +128,7 @@ object ProfileHelper {
ProfileCondition(
ProfileConditionType.LessThanEqual,
ProfileConditionValue.VideoLevel,
MediaTest.getAVCMainLevel()
mediaTest.getAVCMainLevel()
)
)
})
Expand All @@ -150,7 +150,7 @@ object ProfileHelper {
ProfileCondition(
ProfileConditionType.LessThanEqual,
ProfileConditionValue.VideoLevel,
MediaTest.getAVCHigh10Level()
mediaTest.getAVCHigh10Level()
)
)
})
Expand All @@ -160,11 +160,11 @@ object ProfileHelper {
}

val supportsHevc by lazy {
MediaTest.supportsHevc()
mediaTest.supportsHevc()
}

val supportsHevcMain10 by lazy {
MediaTest.supportsHevcMain10()
mediaTest.supportsHevcMain10()
}

val deviceHevcCodecProfile by lazy {
Expand Down Expand Up @@ -221,7 +221,7 @@ object ProfileHelper {
ProfileCondition(
ProfileConditionType.LessThanEqual,
ProfileConditionValue.VideoLevel,
MediaTest.getHevcMainLevel()
mediaTest.getHevcMainLevel()
)
)
})
Expand All @@ -243,7 +243,7 @@ object ProfileHelper {
ProfileCondition(
ProfileConditionType.LessThanEqual,
ProfileConditionValue.VideoLevel,
MediaTest.getHevcMain10Level()
mediaTest.getHevcMain10Level()
)
)
})
Expand All @@ -253,7 +253,7 @@ object ProfileHelper {
}

val maxResolutionCodecProfile by lazy {
val maxResolution = MediaTest.getMaxResolution(MediaFormat.MIMETYPE_VIDEO_AVC)
val maxResolution = mediaTest.getMaxResolution(MediaFormat.MIMETYPE_VIDEO_AVC)

CodecProfile().apply {
type = CodecType.Video
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@
<string name="lbl_new_premieres">New premieres</string>
<string name="lbl_bitstream_ac3">Bitstream Dolby Digital audio</string>
<string name="desc_bitstream_ac3">Requires capable hardware</string>
<string name="lbl_bitstream_dts">Bitstream DTS audio</string>
<string name="desc_bitstream_dts">Requires capable hardware</string>
<string name="desc_audio_night_mode">Levels out audio volume automatically</string>
<string name="lbl_zoom">Zoom</string>
<string name="lbl_auto_crop">Auto crop</string>
Expand Down