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

Add option to enable playback rewrite for audio #2455

Merged
Merged
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
13 changes: 11 additions & 2 deletions app/src/main/java/org/jellyfin/androidtv/di/PlaybackModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,20 @@ import org.koin.dsl.module

val playbackModule = module {
single { PlaybackManager(get()) }
single<MediaManager> { LegacyMediaManager(get()) }
single { LegacyMediaManager(get()) }

factory<MediaManager> {
val preferences = get<UserPreferences>()
val useRewrite = preferences[UserPreferences.playbackRewriteAudioEnabled] && BuildConfig.DEVELOPMENT

// TODO Return RewriteMediaManager when merged to master
if (useRewrite) get<LegacyMediaManager>()
else get<LegacyMediaManager>()
}

factory {
val preferences = get<UserPreferences>()
val useRewrite = preferences[UserPreferences.playbackRewriteEnabled] && BuildConfig.DEVELOPMENT
val useRewrite = preferences[UserPreferences.playbackRewriteVideoEnabled] && BuildConfig.DEVELOPMENT

if (useRewrite) RewritePlaybackLauncher()
else GarbagePlaybackLauncher(get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,14 @@ class UserPreferences(context: Context) : SharedPreferenceStore(
var debuggingEnabled = booleanPreference("pref_enable_debug", false)

/**
* Use playback rewrite module
* Use playback rewrite module for video
*/
var playbackRewriteEnabled = booleanPreference("playback_new", false)
var playbackRewriteVideoEnabled = booleanPreference("playback_new", false)

/**
* Use playback rewrite module for audio
*/
var playbackRewriteAudioEnabled = booleanPreference("playback_new_audio", false)

/**
* When to show the clock.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@ class DeveloperPreferencesScreen : OptionsFragment() {
}

// Only show in debug mode
// some strings are hardcoded because these options don't show in beta/release builds
if (BuildConfig.DEVELOPMENT) {
checkbox {
setTitle(R.string.enable_playback_module_title)
title = "Enable new playback module for video"
setContent(R.string.enable_playback_module_description)

bind(userPreferences, UserPreferences.playbackRewriteEnabled)
bind(userPreferences, UserPreferences.playbackRewriteVideoEnabled)
}

checkbox {
title = "Enable new playback module for audio"
setContent(R.string.enable_playback_module_description)

bind(userPreferences, UserPreferences.playbackRewriteAudioEnabled)
}
}
}
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@
<string name="lbl_one_song">1 Song</string>
<string name="lbl_name_date">%1$s (%2$s)</string>
<string name="lbl_time_range">%1$s–%2$s</string>
<string name="enable_playback_module_title">Enable new playback module</string>
<string name="enable_playback_module_description">This is an experimental feature. No support is provided.</string>
<string name="last_use">Most recently used</string>
<string name="alphabetical">Alphabetical</string>
Expand Down