Skip to content

Commit

Permalink
stats.lua: add subtitles section
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 committed Apr 17, 2024
1 parent 16345ee commit fc48592
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions player/lua/stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,24 @@ local function add_audio(s)
end


local function add_subtitles(s, sub)
local track = mp.get_property_native("current-tracks/" .. sub)
if not track then
return
end

local desc = track["codec-desc"] and string.gsub(track["codec-desc"], "%s*subtitles?$", "")
append(s, "", {prefix=o.nl .. o.nl .. "Subtitles:", nl="", indent=""})
append(s, desc or track["codec"], {prefix_sep="", nl="", indent=""})
if track["codec"] ~= track["decoder"] then
append(s, track["decoder"], {prefix="[", nl="", indent=" ", prefix_sep="",
no_prefix_markup=true, suffix="]"})
end
append(s, track["profile"], {prefix="[", nl="", indent=" ", prefix_sep="",
no_prefix_markup=true, suffix="]"})
end


-- Determine whether ASS formatting shall/can be used and set formatting sequences
local function eval_ass_formatting()
o.use_ass = o.ass_formatting and has_vo_window()
Expand Down Expand Up @@ -1123,6 +1141,8 @@ local function default_stats()
add_video_out(stats)
add_video(stats)
add_audio(stats)
add_subtitles(stats, "sub")
add_subtitles(stats, "sub2")
return finalize_page({}, stats, false)
end

Expand Down

0 comments on commit fc48592

Please sign in to comment.