Commit Graph

270 Commits

Author SHA1 Message Date
Julian 90ecf52a45 stats: add sum of timing values
Display an additional line with the sum of all three timing values.
Disabled by default.

I didn't see the necessity to also create a graph for this line
2017-10-09 20:40:31 +02:00
Julian 3663a411d3 stats: put colormatrix, primaries and gamma together
Saves a bit of space.
2017-10-09 20:40:31 +02:00
Julian 8bbbab9523 stats: change highlighting of performance data
Add a yellow highlight to the existing red highlight.
Red is still used once the available time is exhausted, yellow is
supposed to be a warning when the headroom is getting small.
The threshold is configurable.
2017-10-09 20:40:31 +02:00
Julian 485c3549d7 stats: declare functions as local
Because why not.
Simply reorder functions instead of forward declaring stuff.
2017-10-09 20:40:31 +02:00
Julian 5e0d36c515 stats: align graphs
Graphs are now aligned. This required a change in the layout of
performance data. Reason is a wrong (but intended) calculation
of vector drawing sizes in libass to maintain compatibility.
This essentially prevents text following the graph.
To achieve alignment only monospaced text can precede the graph.
This led to the layout changing slightly when graphs are shown.
2017-10-09 20:40:31 +02:00
Julian 946d45a421 stats: change the way the output is built
Instead of creating new strings with the content of the previous
one followed by some new content we now write all content into
tables that are concatenated in the end.
This is unlikely to improve performance but at least it will
cut down on all these temporary, growing strings polluting memory.
2017-10-09 20:40:31 +02:00
Julian a256d61ef4 stats: rewrite parts of performance data
Major changes:
  - graphs are only drawn when in toggled mode
  - performance data is retrieved every ith frame (default: 5)
  - highlighting of performance data (numbers): add a highlight
    when the summed numbers (last/avg/peak) exceed 1/display-fps
2017-10-09 20:40:31 +02:00
Julian de38bd0f81 stats: add performance data
Display various performance data about frames and their
display/rendering. Additionally plot graphs for this data.

This is experimental and pretty much just a test at this point and by
far not final.
2017-10-09 20:40:31 +02:00
Julian 2de778f699 stats: update stats when file changes
Only in toggled mode and actually only when the video output is
reconfigured. This should cover the relevant cases.

Fixes #22
2017-10-09 20:40:31 +02:00
Julian fcacf82865 stats: small spelling correction 2017-10-09 20:40:31 +02:00
Julian f8bafd4734 stats: use redraw_delay for timer period
Previously the delay was slightly shortened but a user explicitly
setting a specific delay most likely expects the stats to refresh
in exactly the frequency he desired.
2017-10-09 20:40:31 +02:00
Ricardo Constantino (:RiCON) 8db09be51a stats: always print title if different from filename 2017-10-09 20:40:31 +02:00
Julian c387b1db6f stats: make a warning more visible
Print it to console and especially OSD upon each invocation
2017-10-09 20:40:31 +02:00
Julian a87af63365 stats: rename some functions
More useful names
2017-10-09 20:40:31 +02:00
Julian 2f5ee99509 stats: add toggling of stats
You can now either show the stats once or toggle their display. Both are
using different key bindings which are additionally configurable now.

Please bear in mind that "toggling" means "redraw every x seconds for x
seconds". Therefore, this approach is prone to problems especially when
something else is printing text to the OSD as well as every of these
calls will overwrite each other. This is currently a limitation of mpv.

Fixes #18
2017-10-09 20:40:31 +02:00
Ricardo Constantino (:RiCON) fe5b042b74 stats: add hwdec-current
Fallback to hwdec-active if not available. This one will be removed in
mpv 0.19.0.
2017-10-09 20:40:31 +02:00
Ricardo Constantino (:RiCON) 7c261899cf stats: add cache-speed 2017-10-09 20:40:31 +02:00
Julian 5fb8dc5943 stats: decrease default font size
It's getting a bit cramped
2017-10-09 20:40:31 +02:00
Niklas Haas bee7404efc stats: add video-params/gamma property 2017-10-09 20:40:31 +02:00
Kevin Mitchell 1f41c729bb stats: update frame drop diagnostics 2017-10-09 20:40:31 +02:00
Kevin Mitchell 41246c8a34 stats: add display fps 2017-10-09 20:40:31 +02:00
Julian 1a1e5b87fb stats: rename some variables for consistency 2017-10-09 20:40:31 +02:00
Niklas Haas 47016bf45e stats: add support for video-sync=display 2017-10-09 20:40:31 +02:00
Julian f22361727e stats: fix line wrapping
These spaces were not displayed on screen, however they were taken into
account for line wrapping.
2017-10-09 20:40:31 +02:00
Julian 6402f88de4 stats: remove dead link from comment 2017-10-09 20:40:31 +02:00
Rostislav Pehlivanov 918774b5aa stats: print bold text in terminals
This simply prints ASCII codes to display any text marked as bold in the
terminal. Supported by every sane terminal since 1986. For those insane,
there's a check. The check has been copied from the ansicolors.lua
script floating around and it checks if the directory path uses "\"
instead of "/", and in case it does, it checks whether ANSICON env
variable has been set (which is used to indicate the Windows terminal
supports ACII escape sequences).
2017-10-09 20:40:31 +02:00
Julian 89c854dc09 stats: minor simplification 2017-10-09 20:40:31 +02:00
Julian 3dbd031da0 stats: remove countless hardcoded strings
feels a bit better that way
2017-10-09 20:40:31 +02:00
Julian 6ed69cb132 stats: document append_property return value 2017-10-09 20:40:31 +02:00
Julian ab8b6e3c16 stats: fix oversight
this one slipped through my "tests"
2017-10-09 20:40:31 +02:00
Julian 95b6bc31b0 stats: unify redundant functions
Unify both append_property* functions and greatly refactor them.
Instead of thousands of arguments we now use a table.
While this is in theory cleaner it does not exactly look like it.
However, it's way more flexible and extendable this way.
Also, since the new append_property() might look a bit confusing
I felt the need to add a comment.
2017-10-09 20:40:31 +02:00
Julian d88adcfbc7 stats: proper usage of imported module
and comment nitpicking
2017-10-09 20:40:31 +02:00
Julian 0bf4b0d18a stats: add debug option
print a warning for properties without value
2017-10-09 20:40:31 +02:00
Julian f9fe3b264e stats: reflect latest changes to mpv
Some properties were renamed recently.
Of course this requires a recent mpv built (>
https://github.com/mpv-player/mpv/commit/f9507f) now.
2017-10-09 20:40:31 +02:00
Julian a78fce4676 stats: don't add superfluous EOL characters
Previously we unnecessarily added newline characters at the end.
Only noticeable when printed on terminal, though.
2017-10-09 20:40:31 +02:00
Julian 81efbc3921 stats: make non-ASS styling configurable
Also add a few convenience functions and remove the unused italic and
underlined formatting functions.
2017-10-09 20:40:31 +02:00
Rostislav Pehlivanov 9e57927af1 stats: make the OSD usable in audio-only mode
Previously, the script would throw garbage (ASS tags) at the terminal
when the bound key was pressed. This changes the behaviour to _not_
print any ASS tags (and replace those which can be interpreted by the
terminal) if there's no video.

I cleaned the patch up since you mentioned you were busy. As I said
before, there is absolutely no problem with calling mpv to display
strings to the OSD without any video. They'll just go straight to the
terminal just as they would with an active VO.
2017-10-09 20:40:31 +02:00
Julian 74e215e9bf stats: avoid clashing with similar named scripts 2017-10-09 20:40:31 +02:00
Julian c2f0557977 stats: initial commit 2017-10-09 20:40:31 +02:00
Avi Halachmi (:avih) 365b1d4f3d osc: fix rare stack overflow when changing visibility mode
Under some conditions, hide_osc() was calling render(), which then called
hide_osc() again, and so forth, until the stack overflows.

Tracking the exact conditions where this happens (and then managing them
to prevent it) is an excercise in futility.

Remove the osc directly - instead of going through the entire rendering
procedure just to end up rendering nothing.

Fixes #4900 .
2017-09-23 14:41:17 +03:00
Ricardo Constantino d280b3db93
ytdl_hook: resolve relative paths when joining segment urls
FFmpeg/mpv don't do it automatically.
See #4827
2017-09-03 13:42:51 +01:00
James Ross-Gowan 7897f79217 input: merge mouse wheel and axis keycodes
Mouse wheel bindings have always been a cause of user confusion.
Previously, on Wayland and macOS, precise touchpads would generate AXIS
keycodes and notched mouse wheels would generate mouse button keycodes.
On Windows, both types of device would generate AXIS keycodes and on
X11, both types of device would generate mouse button keycodes. This
made it pretty difficult for users to modify their mouse-wheel bindings,
since it differed between platforms and in some cases, between devices.

To make it more confusing, the keycodes used on Windows were changed in
18a45a42d5 without a deprecation period or adequate communication to
users.

This change aims to make mouse wheel binds less confusing. Both the
mouse button and AXIS keycodes are now deprecated aliases of the new
WHEEL keycodes. This will technically break input configs on Wayland and
macOS that assign different commands to precise and non-precise scroll
events, but this is probably uncommon (if anyone does it at all) and I
think it's a fair tradeoff for finally fixing mouse wheel-related
confusion on other platforms.
2017-09-03 20:31:44 +10:00
James Ross-Gowan 957e9a37db input: use mnemonic names for mouse buttons
mpv's mouse button numbering is based on X11 button numbering, which
allows for an arbitrary number of buttons and includes mouse wheel input
as buttons 3-6. This button numbering was used throughout the codebase
and exposed in input.conf, and it was difficult to remember which
physical button each number actually referred to and which referred to
the scroll wheel.

In practice, PC mice only have between two and five buttons and one or
two scroll wheel axes, which are more or less in the same location and
have more or less the same function. This allows us to use names to
refer to the buttons instead of numbers, which makes input.conf syntax a
lot easier to remember. It also makes the syntax robust to changes in
mpv's underlying numbering. The old MOUSE_BTNx names are still
understood as deprecated aliases of the named buttons.

This changes both the input.conf syntax and the MP_MOUSE_BTNx symbols in
the codebase, since I think both would benefit from using names over
numbers, especially since some platforms don't use X11 button numbering
and handle different mouse buttons in different windowing system events.

This also makes the names shorter, since otherwise they would be pretty
long, and it removes the high-numbered MOUSE_BTNx_DBL names, since they
weren't used.

Names are the same as used in Qt:
https://doc.qt.io/qt-5/qt.html#MouseButton-enum
2017-09-03 20:31:44 +10:00
Ricardo Constantino 2b83f7e391
ytdl_hook: support fragments with relative paths
Unbreaks segmented DASH with the change in
https://github.com/rg3/youtube-dl/commit/1141e9104 which made each
segment URL only use relative path from fragment_base_url with a
different key.
2017-08-06 13:27:53 +01:00
Jagannathan Tiruvallur Eachambadi 46bfa3726f
ytdl_hook: add a header to support geo-bypass
youtube-dl supports bypassing some geographic restrictions by
setting X-Forwarded-For header when used with geo-bypass and
geo-bypass-country.
2017-07-16 13:20:17 +01:00
Ricardo Constantino db60cbb80a
ytdl_hook: actually load the script-opts
Also, comma-separated list doesn't actually work, even quote-surrounded.
Switch to using | instead.
2017-07-11 23:42:22 +01:00
Ricardo Constantino 042e98f4c9
ytdl_hook: add option to exclude URLs from being parsed
This is more of a niche usecase than --ytdl-format and --ytdl-raw-options,
so a simple script option should be enough.

Either create lua-settings/ytdl_hook.conf with
'exclude=example.com,sub.example.com' option or
"--script-opts=ytdl_hook-exclude=example.com,sub.example.com"
2017-07-11 14:18:29 +01:00
Ricardo Constantino b1165ce3a2
ytdl_hook: add times for ytdl and hook running on debug-level
Not really important, but still interesting to know.
2017-07-11 14:16:35 +01:00
Ricardo Constantino 41b3b11669
ytdl_hook: add pre-parsed chapters, if available
Available since 2017.05.07 but only on certain extractors.
2017-07-02 21:15:15 +01:00
Martin D 30cd963b25 ytdl_hook: don't override start time set by saved state
This affects resuming playback from a watch_later directory so that you can resume playback even for URLs that have a start parameter.
2017-06-09 11:13:24 +01:00