Commit 32409efe authored by Geoffrey Métais's avatar Geoffrey Métais

Save spu or audio tracks on change

Remove the old systematic meta saving. It could deactivate subs
parent 45e27d09
......@@ -1165,13 +1165,13 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope {
fun addSubtitleTrack(uri: Uri, select: Boolean) = playlistManager.player.addSubtitleTrack(uri, select)
@MainThread
fun setSpuTrack(index: Int) = playlistManager.player.setSpuTrack(index)
fun setSpuTrack(index: Int) = playlistManager.setSpuTrack(index)
@MainThread
fun setAudioDelay(delay: Long) = playlistManager.player.setAudioDelay(delay)
fun setAudioDelay(delay: Long) = playlistManager.setAudioDelay(delay)
@MainThread
fun setSpuDelay(delay: Long) = playlistManager.player.setSpuDelay(delay)
fun setSpuDelay(delay: Long) = playlistManager.setSpuDelay(delay)
@MainThread
fun hasRenderer() = playlistManager.player.hasRenderer
......
......@@ -415,15 +415,28 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
media.time = if (progress == 0f) 0L else time
media.setLongMeta(MediaWrapper.META_PROGRESS, media.time)
}
if (canSwitchToVideo) {
//Save audio delay
if (settings.getBoolean("save_individual_audio_delay", false))
media.setLongMeta(MediaWrapper.META_AUDIODELAY, player.getAudioDelay())
media.setLongMeta(MediaWrapper.META_SUBTITLE_DELAY, player.getSpuDelay())
media.setLongMeta(MediaWrapper.META_SUBTITLE_TRACK, player.getSpuTrack().toLong())
}
fun setSpuTrack(index: Int) {
if (!player.setSpuTrack(index)) return
val media = getCurrentMedia() ?: return
if (media.id != 0L) launch(Dispatchers.IO) { media.setLongMeta(MediaWrapper.META_SUBTITLE_TRACK, player.getSpuTrack().toLong()) }
}
fun setAudioDelay(delay: Long) {
if (!player.setAudioDelay(delay)) return
val media = getCurrentMedia() ?: return
if (media.id != 0L && settings.getBoolean("save_individual_audio_delay", false)) {
launch(Dispatchers.IO) { media.setLongMeta(MediaWrapper.META_AUDIODELAY, player.getAudioDelay()) }
}
}
fun setSpuDelay(delay: Long) {
if (!player.setSpuDelay(delay)) return
val media = getCurrentMedia() ?: return
if (media.id != 0L) launch(Dispatchers.IO) { media.setLongMeta(MediaWrapper.META_SUBTITLE_DELAY, player.getSpuDelay()) }
}
private fun loadMediaMeta(media: MediaWrapper) {
if (media.id == 0L) return
if (player.canSwitchToVideo()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment