Add toggles to override direct playback (#24)

Fixes #10 

Adds toggles to disable direct play of AC3 audio, ASS subtitles, and PGS
subtitles. Also a toggle to force down mixing audio to stereo.

This copies the behavior from the official client. I'm not sure if there
is a way to determine if direct playing AC3 is possible because it can
depend on devices other than the Android TV device such as a sound bar.
So it's up to the user to toggle off support if necessary.

Attribution: This PR uses on [code from the official
client](c775603df4/app/src/main/java/org/jellyfin/androidtv/util/profile/deviceProfile.kt).
This commit is contained in:
damontecres 2025-10-17 12:46:55 -04:00 committed by GitHub
parent bd4d4d5092
commit f220aeee44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 190 additions and 10 deletions

View file

@ -20,6 +20,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.unit.dp
import androidx.datastore.core.DataStore
import androidx.lifecycle.lifecycleScope
import androidx.navigation3.runtime.rememberNavBackStack
import androidx.tv.material3.ExperimentalTvMaterial3Api
import androidx.tv.material3.MaterialTheme
@ -34,9 +35,13 @@ import com.github.damontecres.wholphin.ui.nav.ApplicationContent
import com.github.damontecres.wholphin.ui.nav.Destination
import com.github.damontecres.wholphin.ui.nav.NavigationManager
import com.github.damontecres.wholphin.ui.theme.WholphinTheme
import com.github.damontecres.wholphin.util.AppUpgradeHandler
import com.github.damontecres.wholphin.util.ExceptionHandler
import com.github.damontecres.wholphin.util.UpdateChecker
import com.github.damontecres.wholphin.util.profile.createDeviceProfile
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import okhttp3.OkHttpClient
import timber.log.Timber
import javax.inject.Inject
@ -59,10 +64,16 @@ class MainActivity : AppCompatActivity() {
@Inject
lateinit var updateChecker: UpdateChecker
@Inject
lateinit var appUpgradeHandler: AppUpgradeHandler
@OptIn(ExperimentalTvMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Timber.i("MainActivity.onCreate")
lifecycleScope.launch(Dispatchers.IO + ExceptionHandler()) {
appUpgradeHandler.run()
}
setContent {
CoilConfig(okHttpClient, false)
val appPreferences by userPreferencesDataStore.data.collectAsState(null)