feat(mpv): default to gpu-next and mediacodec and use fast profile

This commit is contained in:
jarnedemeulemeester 2024-01-23 14:48:15 +01:00
parent 0ecf6d4c0e
commit a16f910ee3
No known key found for this signature in database
GPG key ID: 1E5C6AFBD622E9F5
3 changed files with 6 additions and 6 deletions

View file

@ -19,7 +19,7 @@
app:title="@string/pref_player_mpv_hwdec"
app:useSimpleSummaryProvider="true" />
<ListPreference
app:defaultValue="gpu"
app:defaultValue="gpu-next"
app:dependency="pref_player_mpv"
app:entries="@array/mpv_vos"
app:entryValues="@array/mpv_vos"

View file

@ -50,7 +50,7 @@ class MPVPlayer(
private var trackSelectionParameters: TrackSelectionParameters = TrackSelectionParameters.Builder(context).build(),
private val seekBackIncrement: Long = C.DEFAULT_SEEK_BACK_INCREMENT_MS,
private val seekForwardIncrement: Long = C.DEFAULT_SEEK_FORWARD_INCREMENT_MS,
videoOutput: String = "gpu",
videoOutput: String = "gpu-next",
audioOutput: String = "audiotrack",
hwDec: String = "mediacodec",
) : BasePlayer(), MPVLib.EventObserver, AudioManager.OnAudioFocusChangeListener {
@ -77,9 +77,11 @@ class MPVPlayer(
// General
MPVLib.setOptionString("config", "yes")
MPVLib.setOptionString("config-dir", mpvDir.path)
MPVLib.setOptionString("profile", "fast")
MPVLib.setOptionString("vo", videoOutput)
MPVLib.setOptionString("ao", audioOutput)
MPVLib.setOptionString("gpu-context", "android")
MPVLib.setOptionString("opengl-es", "yes")
// Hardware video decoding
MPVLib.setOptionString("hwdec", hwDec)
@ -108,8 +110,6 @@ class MPVPlayer(
MPVLib.setOptionString("save-position-on-quit", "no")
MPVLib.setOptionString("sub-font-provider", "none")
MPVLib.setOptionString("ytdl", "no")
// DR is known to ruin performance at least on Exynos devices, see mpv-android#508
MPVLib.setOptionString("vd-lavc-dr", "no")
MPVLib.init()

View file

@ -70,8 +70,8 @@ constructor(
DEFAULT_SEEK_FORWARD_INCREMENT_MS.toString(),
)!!.toLongOrNull() ?: DEFAULT_SEEK_FORWARD_INCREMENT_MS
val playerMpv get() = sharedPreferences.getBoolean(Constants.PREF_PLAYER_MPV, false)
val playerMpvHwdec get() = sharedPreferences.getString(Constants.PREF_PLAYER_MPV_HWDEC, "mediacodec-copy")!!
val playerMpvVo get() = sharedPreferences.getString(Constants.PREF_PLAYER_MPV_VO, "gpu")!!
val playerMpvHwdec get() = sharedPreferences.getString(Constants.PREF_PLAYER_MPV_HWDEC, "mediacodec")!!
val playerMpvVo get() = sharedPreferences.getString(Constants.PREF_PLAYER_MPV_VO, "gpu-next")!!
val playerMpvAo get() = sharedPreferences.getString(Constants.PREF_PLAYER_MPV_AO, "audiotrack")!!
val playerIntroSkipper get() = sharedPreferences.getBoolean(Constants.PREF_PLAYER_INTRO_SKIPPER, true)
val playerTrickPlay get() = sharedPreferences.getBoolean(Constants.PREF_PLAYER_TRICK_PLAY, true)