mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Workaround for switching direct play audio tracks
This commit is contained in:
parent
a674867656
commit
5d6b8ff1fe
1 changed files with 16 additions and 1 deletions
|
|
@ -50,6 +50,7 @@ import com.github.damontecres.wholphin.services.RefreshRateService
|
|||
import com.github.damontecres.wholphin.services.ScreensaverService
|
||||
import com.github.damontecres.wholphin.services.StreamChoiceService
|
||||
import com.github.damontecres.wholphin.services.UserPreferencesService
|
||||
import com.github.damontecres.wholphin.ui.gt
|
||||
import com.github.damontecres.wholphin.ui.isNotNullOrBlank
|
||||
import com.github.damontecres.wholphin.ui.launchDefault
|
||||
import com.github.damontecres.wholphin.ui.launchIO
|
||||
|
|
@ -794,12 +795,26 @@ class PlaybackViewModel
|
|||
userInitiated: Boolean,
|
||||
): Boolean =
|
||||
withContext(Dispatchers.IO) {
|
||||
// TODO there's probably no reason why we can't add external subtitles?
|
||||
Timber.v("changeStreams direct play")
|
||||
|
||||
// TODO Better way to handle unsupported types in general is needed
|
||||
// This is a workaround for switching to a non AC3 track when the user wants audio transcoded to AC3
|
||||
if (preferences.appPreferences.playbackPreferences.overrides.preferAc3Surround && audioIndex != null) {
|
||||
currentPlayback.mediaSourceInfo.mediaStreams
|
||||
.orEmpty()
|
||||
.firstOrNull { it.index == audioIndex }
|
||||
?.let {
|
||||
if (it.channels.gt(2) && it.codec != Codec.Audio.AC3) {
|
||||
// User wants to transcode audio into AC3
|
||||
return@withContext false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val source = currentPlayback.mediaSourceInfo
|
||||
val externalSubtitle = source.findExternalSubtitle(subtitleIndex)
|
||||
|
||||
// TODO there's probably no reason why we can't add external subtitles?
|
||||
if (externalSubtitle == null) {
|
||||
val result =
|
||||
withContext(Dispatchers.Main) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue