Skip to content

Commit

Permalink
Add note about regex filter for ignoring empty subtitle lines
Browse files Browse the repository at this point in the history
This gets rid of text subtitle detection and our own empty subtitle
check, since it didn't work with subs_lookahead for muxed subtitles
(sub-text wasn't available straight away).
  • Loading branch information
po5 committed Jul 26, 2023
1 parent 4bd9993 commit 2c00ab2
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions evafast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-- Adjust --input-ar-delay to define when to start fastforwarding.
-- Define --hr-seek if you want accurate seeking.
-- If you just want a nicer fastforward.lua without hybrid key behavior, set seek_distance to 0.
-- Consider setting --sub-filter-regex=^\s*$ (or --sub-filter-jsre on Windows) to ignore empty lines.

local options = {
-- How far to jump on press, set to 0 to disable seeking and force fastforward
Expand Down Expand Up @@ -51,7 +52,6 @@ mp.options.read_options(options, "evafast")

local uosc_available = false
local has_subtitle = true
local has_text_subtitle = false
local speedup_target = nil
local toggled_display = true
local toggled = false
Expand Down Expand Up @@ -198,13 +198,7 @@ local function adjust_speed()
target_speed = options.speed_cap

if has_subtitle and target_speed ~= options.subs_speed_cap then
local sub_displayed

if has_text_subtitle then
sub_displayed = mp.get_property("sub-text", "") ~= ""
else
sub_displayed = mp.get_property("sub-start") ~= nil
end
local sub_displayed = mp.get_property("sub-start") ~= nil

if sub_displayed then
target_speed = options.subs_speed_cap
Expand Down Expand Up @@ -332,10 +326,6 @@ mp.observe_property("duration", "native", function(prop, val)
file_duration = val or 0
end)

mp.observe_property("current-tracks/sub/codec", "native", function(prop, val)
has_text_subtitle = val ~= nil and val ~= "hdmv_pgs_subtitle" and val ~= "dvd_subtitle" and val ~= "dvb_subtitle"
end)

mp.observe_property("sid", "native", function(prop, val)
has_subtitle = (val or 0) ~= 0
next_sub_at = -1
Expand Down

0 comments on commit 2c00ab2

Please sign in to comment.