Fix cover surface & dvdsub direct play

This commit is contained in:
Damontecres 2025-11-10 10:07:40 -05:00
parent b84166e2a5
commit 2eea5b967e
No known key found for this signature in database
4 changed files with 9 additions and 4 deletions

View file

@ -177,7 +177,7 @@ fun PlaybackPage(
var playbackSpeed by remember { mutableFloatStateOf(1.0f) } var playbackSpeed by remember { mutableFloatStateOf(1.0f) }
LaunchedEffect(playbackSpeed) { player.setPlaybackSpeed(playbackSpeed) } LaunchedEffect(playbackSpeed) { player.setPlaybackSpeed(playbackSpeed) }
val presentationState = rememberPresentationState(player) val presentationState = rememberPresentationState(player, false)
val scaledModifier = val scaledModifier =
Modifier.resizeWithContentScale(contentScale, presentationState.videoSizeDp) Modifier.resizeWithContentScale(contentScale, presentationState.videoSizeDp)
val focusRequester = remember { FocusRequester() } val focusRequester = remember { FocusRequester() }
@ -251,7 +251,7 @@ fun PlaybackPage(
surfaceType = SURFACE_TYPE_SURFACE_VIEW, surfaceType = SURFACE_TYPE_SURFACE_VIEW,
modifier = scaledModifier, modifier = scaledModifier,
) )
if (false && presentationState.coverSurface) { if (presentationState.coverSurface) {
Box( Box(
Modifier Modifier
.matchParentSize() .matchParentSize()

View file

@ -545,7 +545,7 @@ class PlaybackViewModel
} }
val transcodeType = val transcodeType =
when { when {
playerBackend == PlayerBackend.MPV -> PlayMethod.DIRECT_PLAY // playerBackend == PlayerBackend.MPV -> PlayMethod.DIRECT_PLAY
source.supportsDirectPlay -> PlayMethod.DIRECT_PLAY source.supportsDirectPlay -> PlayMethod.DIRECT_PLAY
source.supportsDirectStream -> PlayMethod.DIRECT_STREAM source.supportsDirectStream -> PlayMethod.DIRECT_STREAM
source.supportsTranscoding -> PlayMethod.TRANSCODE source.supportsTranscoding -> PlayMethod.TRANSCODE

View file

@ -43,6 +43,7 @@ val mpvDeviceProfile =
Codec.Container.MKV, Codec.Container.MKV,
Codec.Container.MOV, Codec.Container.MOV,
Codec.Container.MP4, Codec.Container.MP4,
Codec.Container.MPG,
Codec.Container.OGM, Codec.Container.OGM,
Codec.Container.OGV, Codec.Container.OGV,
Codec.Container.TS, Codec.Container.TS,
@ -62,7 +63,7 @@ val mpvDeviceProfile =
Codec.Video.VP9, Codec.Video.VP9,
) )
audioCodec(*supportedAudioCodecs) audioCodec(*supportedAudioCodecs, Codec.Audio.WAV, Codec.Audio.OGG)
} }
subtitleProfile(Codec.Subtitle.VTT, embedded = true, hls = true, external = true) subtitleProfile(Codec.Subtitle.VTT, embedded = true, hls = true, external = true)
@ -71,6 +72,7 @@ val mpvDeviceProfile =
subtitleProfile(Codec.Subtitle.SUBRIP, embedded = true, external = true) subtitleProfile(Codec.Subtitle.SUBRIP, embedded = true, external = true)
subtitleProfile(Codec.Subtitle.TTML, embedded = true, external = true) subtitleProfile(Codec.Subtitle.TTML, embedded = true, external = true)
subtitleProfile(Codec.Subtitle.DVBSUB, embedded = true, encode = true) subtitleProfile(Codec.Subtitle.DVBSUB, embedded = true, encode = true)
subtitleProfile(Codec.Subtitle.DVDSUB, embedded = true, encode = true)
subtitleProfile(Codec.Subtitle.IDX, embedded = true, encode = true) subtitleProfile(Codec.Subtitle.IDX, embedded = true, encode = true)
subtitleProfile(Codec.Subtitle.PGS, embedded = true, encode = true) subtitleProfile(Codec.Subtitle.PGS, embedded = true, encode = true)
subtitleProfile(Codec.Subtitle.PGSSUB, embedded = true, encode = true) subtitleProfile(Codec.Subtitle.PGSSUB, embedded = true, encode = true)

View file

@ -597,6 +597,8 @@ class MpvPlayer(
override fun event(eventId: Int) { override fun event(eventId: Int) {
when (eventId) { when (eventId) {
// MPV_EVENT_START_FILE -> {
// }
MPV_EVENT_FILE_LOADED -> { MPV_EVENT_FILE_LOADED -> {
Timber.d("event: MPV_EVENT_FILE_LOADED") Timber.d("event: MPV_EVENT_FILE_LOADED")
mediaItem!!.localConfiguration?.subtitleConfigurations?.forEach { mediaItem!!.localConfiguration?.subtitleConfigurations?.forEach {
@ -605,6 +607,7 @@ class MpvPlayer(
Timber.v("Adding external subtitle track '$title'") Timber.v("Adding external subtitle track '$title'")
MPVLib.command(arrayOf("sub-add", url, "auto", title)) MPVLib.command(arrayOf("sub-add", url, "auto", title))
} }
notifyListeners(EVENT_RENDERED_FIRST_FRAME) { onRenderedFirstFrame() }
notifyListeners(EVENT_IS_PLAYING_CHANGED) { onIsPlayingChanged(true) } notifyListeners(EVENT_IS_PLAYING_CHANGED) { onIsPlayingChanged(true) }
getTracks().let { getTracks().let {
notifyListeners(EVENT_TRACKS_CHANGED) { onTracksChanged(it) } notifyListeners(EVENT_TRACKS_CHANGED) { onTracksChanged(it) }