This adds file tags to display along with the title, including
album/artist etc. for music, and series etc. for some videos.
The list of tags to display is identical to the tags printed to
the terminal and is controlled by the --display-tags option.
To filter out overlength tags (such as long comments and lyrics) and
files with too many tags, add file_tag_max_length and file_tag_max_count
options so that tags longer than this length are not displayed, and only
the first few tags are displayed.
Also makes tags show on page 5 only.
22a8b99 introduced print_perfdata_passes as a stopgap until a dedicated
performance stats page would be implemented. Since it has been
implemented for many years, remove this option, which isn't even
documented, and is likely to make the stats overflow beyond the screen.
To avoid a large append parameter refactoring is to make the append
function add the table index only if the newline character is not empty.
Otherwise, new strings are appended to the existing string.
If using --script-opts=stats-vidscale=no, until osd-height changes from
0 to the correct value, stats.lua's text sizes are multiplied by a scale
of 720, which with the default font size results in a font size of 5760.
Depending on the order of operations, if the stats are drawn at this
size before osd-height is updated, mpv freezes. I get this with
--input-commands=script-message-to stats display-stats-toggle in
conditional profiles, e.g.:
mpv --script-opts=stats-vidscale=no --include=<(echo $'[test]\nprofile-cond=true\ninput-commands=script-message-to stats display-stats-toggle') av://lavfi:testsrc
Fix this by setting a scale to 1 until osd-height is updated to the
correct value.
This change displays the scaled position and size of the image before
cropping to the target rectangle. In simple terms, it shows how much
margin has been added to the image or how much of the image has been
cropped.
Note that target resolution is displayed after crop as in fact all other
pixels are discarded anyway.
This lets you press / in page 4 of the stats and type a keybinding or
part of its command to filter it by using mp.input.
This works badly without a VO because both stats.lua and console.lua use
show-text and only one can be displayed at a time, but it's still better
than not having the search available at all.
Avoid having to configure both the OSD and the stats script opts when
you change the OSD options, in particular avoid having to convert colors
to BGR.
Also document the shadow options.
font_size, border_size and shadow offset defaults are kept because the
same values look much bigger in the stats than in the corresponding OSD
options.
osd-back-color is now respected without extra checks until you
explicitly set a shadow_color.
Turns out that adding more medatata like HDR10+ and Dolby Vision would
produce a lot of duplication and it is better to centralize it around
the track-list property.
Fixes: e720159f72
This adds a command to escape ASS tags to remove code duplication
between sub/osd_libass.c, console.lua, osc.lua, stats.lua and any user
script that calls mp.create_osd_overlay().
A command is used instead of scripting functions so that all clients can
use this and not just use Lua and JS ones.
osd_mangle_ass() also interprets osd-sym-cc and osd-ass-cc/{0,1}, but
since they use invalid UTF-8 characters there is no risk of escape-ass
users using them by accident, like with any OSD message.
Always replacing \n with \\N in mangle_ass() even when it is not called
by escape-ass doesn't seem to cause any issue, but I made it conditional
anyway to avoid changing how all OSD messages are treated unnecessarily.
The terminal output was static in size with no way of automatically
adjusting it to the current terminal size.
The new term-size property makes truly automatic adjustment possible.
The scroll hint on page 4 had baked in ass tags, which shouldn't be
there in the terminal. Also the scroll hint on page 0 was missing.
Refactor scroll hint generation into a function and use that for
pages 2, 4 and 0.
The terminal is assumed to be 80x24 in size, the new options
`term_width_limit` and `term_height_limit` can be used to overwrite
that.
Lines longer then the terminal width cause problems with scrolling
pages and need to be shortened.
The algorithm used for shortening can deal with tabs and escape
sequences, has rudimentary support for UTF-8 and runs in O(n).
avih helped in the creation of the term_ellipsis() function and split()
is also from him.
Pages 2 and 0 had their own scroll implementations, which worked fine
for ass, but didn't work well in the terminal.
Now they both use the same scroll function as page 4.
That scroll function requires each output line to be one entry
in the table. Page 0 did not adhere to that new requirement, instead
it generated two table entries for a single output line when a graph
is shown. To fulfill that requirement the generated graph now gets
directly appended to the same table entry that's used for the rest
of the line.
This scrolling implementation will be used for other pages in future
commits.
The comment said it takes up 20 lines of the terminal, but in reality
it was 22 lines.
When --osd-blur is set to a nonzero value, the graphs also become
blurry. This is because they are rendered by the osd-overlay command
with the "OSD" style which has OSD blur applied, and are treated no
differently from texts. Fix this by using the "Default" style for
these graphs which uses the default OSD options.
This displays the current GPU context when --vo=gpu or --vo=gpu-next
is used, which shows the platform and backend information of the vo
which are previously not available.
The "Resolution" property shows the storage resolution for videos with
non-square pixels.
Currently, display aspect ratio is shown for both "Resolution" and
"Output Resolution" properties which results in a duplicate,
and is incorrect for the "Resolution" property.
The correct aspect ratio is now shown using the sar and sar-name properties.
This commit replaces all uses of sig_peak and maps all HDR metadata.
Form notable changes mixed usage of maxCLL and max_luma is resolved and
not always max_luma is used which makes vo_gpu and vo_gpu_next behave
the same way.
For whatever reason, some of the lua code (particularly the osc and
ytdl_hook) is full of a bunch of stuff like if (foo), if not (foo ==
nil), etc. The parenthesis aren't needed in lua and actually just look
weird since nobody actually writes lua like this. You can see most of
the other conditionals are written normally. So cleanup the style to
match when the parenthesis clearly aren't doing anything. Not directly
related, but also add some spaces on a few math operations while we're
at it.
Nobody except a chosen few (I'm not one of them) even knows what it
means. Multiple people thought it was actually some kind of rendering
bug. Just disable it by default. Closes#12671.
These are ancient and have existed since before stats.lua lived in the
mpv repository. We don't need to worry about ancient mpv versions
anymore, so remove these.
The text didn't line up with with the percentages above it because it
didn't use a monospace font.
Instead insert the text at the same position in the template as the
percentages and convert one o.prefix_sep from the percentages into hard
coded \h\h to ensure alignment even when the user changes o.prefix_sep.