mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
Set default subtitle styling
This commit is contained in:
parent
32712c39a0
commit
e982119237
1 changed files with 22 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import android.view.SurfaceHolder
|
||||||
import android.view.SurfaceView
|
import android.view.SurfaceView
|
||||||
import android.view.TextureView
|
import android.view.TextureView
|
||||||
import androidx.annotation.OptIn
|
import androidx.annotation.OptIn
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.media3.common.AudioAttributes
|
import androidx.media3.common.AudioAttributes
|
||||||
import androidx.media3.common.BasePlayer
|
import androidx.media3.common.BasePlayer
|
||||||
import androidx.media3.common.C
|
import androidx.media3.common.C
|
||||||
|
|
@ -104,6 +105,16 @@ class MpvPlayer(
|
||||||
MPVLib.setOptionString("demuxer-max-bytes", "${cacheMegs * 1024 * 1024}")
|
MPVLib.setOptionString("demuxer-max-bytes", "${cacheMegs * 1024 * 1024}")
|
||||||
MPVLib.setOptionString("demuxer-max-back-bytes", "${cacheMegs * 1024 * 1024}")
|
MPVLib.setOptionString("demuxer-max-back-bytes", "${cacheMegs * 1024 * 1024}")
|
||||||
|
|
||||||
|
// TODO make configurable
|
||||||
|
// Subtitle styling
|
||||||
|
MPVLib.setPropertyInt("sub-font-size", 56)
|
||||||
|
MPVLib.setPropertyColor("sub-color", Color.White)
|
||||||
|
MPVLib.setPropertyColor("sub-outline-color", Color.Black)
|
||||||
|
MPVLib.setPropertyDouble("sub-outline-size", 1.65)
|
||||||
|
|
||||||
|
// sub-back-color
|
||||||
|
// sub-border-style
|
||||||
|
|
||||||
MPVLib.init()
|
MPVLib.init()
|
||||||
|
|
||||||
MPVLib.setOptionString("force-window", "no")
|
MPVLib.setOptionString("force-window", "no")
|
||||||
|
|
@ -724,4 +735,15 @@ class MpvPlayer(
|
||||||
override fun onTrackSelectionsInvalidated() {
|
override fun onTrackSelectionsInvalidated() {
|
||||||
// no-op
|
// no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var subtitleDelay: Double
|
||||||
|
get() = MPVLib.getPropertyDouble("sub-delay") ?: 0.0
|
||||||
|
set(value) = MPVLib.setPropertyDouble("sub-delay", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun MPVLib.setPropertyColor(
|
||||||
|
property: String,
|
||||||
|
color: Color,
|
||||||
|
) = MPVLib.setPropertyString(property, color.mpvFormat)
|
||||||
|
|
||||||
|
private val Color.mpvFormat: String get() = "$red/$green/$blue/$alpha"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue