mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-22 01:32:08 +00:00
ref: potential audio channel related crash fix
This commit is contained in:
parent
938d33eb75
commit
4094151108
1 changed files with 18 additions and 11 deletions
|
|
@ -273,6 +273,8 @@ final class MPVPlayerViewController: UIViewController {
|
||||||
checkError(mpv_set_option_string(mpv, "gpu-api", "vulkan"))
|
checkError(mpv_set_option_string(mpv, "gpu-api", "vulkan"))
|
||||||
checkError(mpv_set_option_string(mpv, "gpu-context", "moltenvk"))
|
checkError(mpv_set_option_string(mpv, "gpu-context", "moltenvk"))
|
||||||
checkError(mpv_set_option_string(mpv, "hwdec", "auto"))
|
checkError(mpv_set_option_string(mpv, "hwdec", "auto"))
|
||||||
|
checkError(mpv_set_option_string(mpv, "audio-channels", "stereo"))
|
||||||
|
checkError(mpv_set_option_string(mpv, "audio-fallback-to-null", "yes"))
|
||||||
checkError(mpv_set_option_string(mpv, "vulkan-swap-mode", "fifo"))
|
checkError(mpv_set_option_string(mpv, "vulkan-swap-mode", "fifo"))
|
||||||
checkError(mpv_set_option_string(mpv, "vulkan-queue-count", "1"))
|
checkError(mpv_set_option_string(mpv, "vulkan-queue-count", "1"))
|
||||||
checkError(mpv_set_option_string(mpv, "vulkan-async-compute", "no"))
|
checkError(mpv_set_option_string(mpv, "vulkan-async-compute", "no"))
|
||||||
|
|
@ -312,12 +314,12 @@ final class MPVPlayerViewController: UIViewController {
|
||||||
@objc private func enterBackground() {
|
@objc private func enterBackground() {
|
||||||
guard mpv != nil else { return }
|
guard mpv != nil else { return }
|
||||||
pausePlayback()
|
pausePlayback()
|
||||||
checkError(mpv_set_option_string(mpv, "vid", "no"))
|
setStringProperty("vid", "no")
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func enterForeground() {
|
@objc private func enterForeground() {
|
||||||
guard mpv != nil else { return }
|
guard mpv != nil else { return }
|
||||||
checkError(mpv_set_option_string(mpv, "vid", "auto"))
|
setStringProperty("vid", "auto")
|
||||||
playPlayback()
|
playPlayback()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -443,14 +445,14 @@ final class MPVPlayerViewController: UIViewController {
|
||||||
guard mpv != nil else { return }
|
guard mpv != nil else { return }
|
||||||
switch mode {
|
switch mode {
|
||||||
case 1: // Fill
|
case 1: // Fill
|
||||||
checkError(mpv_set_option_string(mpv, "panscan", "1.0"))
|
setStringProperty("panscan", "1.0")
|
||||||
checkError(mpv_set_option_string(mpv, "video-unscaled", "no"))
|
setStringProperty("video-unscaled", "no")
|
||||||
case 2: // Zoom
|
case 2: // Zoom
|
||||||
checkError(mpv_set_option_string(mpv, "panscan", "1.0"))
|
setStringProperty("panscan", "1.0")
|
||||||
checkError(mpv_set_option_string(mpv, "video-unscaled", "no"))
|
setStringProperty("video-unscaled", "no")
|
||||||
default: // Fit
|
default: // Fit
|
||||||
checkError(mpv_set_option_string(mpv, "panscan", "0.0"))
|
setStringProperty("panscan", "0.0")
|
||||||
checkError(mpv_set_option_string(mpv, "video-unscaled", "no"))
|
setStringProperty("video-unscaled", "no")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -465,7 +467,7 @@ final class MPVPlayerViewController: UIViewController {
|
||||||
func selectSubtitle(_ trackId: Int) {
|
func selectSubtitle(_ trackId: Int) {
|
||||||
guard mpv != nil else { return }
|
guard mpv != nil else { return }
|
||||||
if trackId < 0 {
|
if trackId < 0 {
|
||||||
checkError(mpv_set_option_string(mpv, "sid", "no"))
|
setStringProperty("sid", "no")
|
||||||
} else {
|
} else {
|
||||||
var id = Int64(trackId)
|
var id = Int64(trackId)
|
||||||
mpv_set_property(mpv, "sid", MPV_FORMAT_INT64, &id)
|
mpv_set_property(mpv, "sid", MPV_FORMAT_INT64, &id)
|
||||||
|
|
@ -488,7 +490,7 @@ final class MPVPlayerViewController: UIViewController {
|
||||||
command("sub-remove", args: ["\(id)"], checkForErrors: false)
|
command("sub-remove", args: ["\(id)"], checkForErrors: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkError(mpv_set_option_string(mpv, "sid", "no"))
|
setStringProperty("sid", "no")
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeExternalSubtitlesAndSelect(_ trackId: Int) {
|
func removeExternalSubtitlesAndSelect(_ trackId: Int) {
|
||||||
|
|
@ -505,7 +507,7 @@ final class MPVPlayerViewController: UIViewController {
|
||||||
if trackId >= 0 {
|
if trackId >= 0 {
|
||||||
selectSubtitle(trackId)
|
selectSubtitle(trackId)
|
||||||
} else {
|
} else {
|
||||||
checkError(mpv_set_option_string(mpv, "sid", "no"))
|
setStringProperty("sid", "no")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -824,6 +826,11 @@ final class MPVPlayerViewController: UIViewController {
|
||||||
mpv_set_property(mpv, name, MPV_FORMAT_FLAG, &data)
|
mpv_set_property(mpv, name, MPV_FORMAT_FLAG, &data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func setStringProperty(_ name: String, _ value: String) {
|
||||||
|
guard mpv != nil else { return }
|
||||||
|
checkError(mpv_set_property_string(mpv, name, value))
|
||||||
|
}
|
||||||
|
|
||||||
private func getInt(_ name: String) -> Int {
|
private func getInt(_ name: String) -> Int {
|
||||||
guard mpv != nil else { return 0 }
|
guard mpv != nil else { return 0 }
|
||||||
var data = Int64()
|
var data = Int64()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue