avoid hang if the user specified non-existent preset

This commit is contained in:
Ren Tatsumoto 2020-09-20 03:44:35 +03:00
parent 97296e1edf
commit d46f3b0134

View file

@ -31,6 +31,18 @@ local encoder
local OSD
local Timings
local presets = {
ultrafast = true,
superfast = true,
veryfast = true,
faster = true,
fast = true,
medium = true,
slow = true,
slower = true,
veryslow = true,
}
------------------------------------------------------------
-- utility functions
@ -335,6 +347,10 @@ if not config.audio_bitrate:endswith('k') then
config.audio_bitrate = config.audio_bitrate .. 'k'
end
if not presets[config.preset] then
config.preset = 'faster'
end
------------------------------------------------------------
-- Finally, set an 'entry point' in mpv