currently mouse processing only happens on mouse movement which
causes cases where going from never -> auto does not show the
osc even though the cursor might be in proximity.
move mouse processing code to a function and refresh it when
leaving visibility never to avoid such issues.
Fixes: https://github.com/mpv-player/mpv/pull/17954#discussion_r3286015305
currently hide_bar() bypasses set_visible when visibility was
changed to `never`, this can leave the thumbnail hanging.
instead of scattering disable_thumbnail() calls around, just
call set_visible(false) instead.
Fixes: 9ce79bcaa
this currently disables thumbnail even on set_visible(true)
calls which was causing flickering due when scrubbing through
the timeline. only disable thumbnail when hiding the osc.
Fixes: 9ce79bcaa
this was initially part of draw-preview but was later moved to a
separate property because it was deemed useful outside of just
thumbnail preview. however this causes bugs when a thumbnailer
observes draw-request and the draw rectangle doesn't change (e.g
due to getting clamped around the border).
add back hover-sec which makes the draw-request more self
contained and removes this footgun.
Fixes: https://github.com/mpv-player/mpv/pull/17518#discussion_r3256017469
Currently the duration observer is toggled in multiple places to not
call request_init unecessarily. It is much simpler to always observe it
and call request_init conditionally in the callback. This also allows
reusing the cached value throughout the OSC.
Note that dividing by 0 is not an error in Lua so there is no need to
check for both 0 and nil.
This:
- Removes the dependency of ffmpeg in PATH - useful on Windows, macOS
(?), Flatpak.
- Will support subrandr.
- Avoids redownloading network subtitles.
- Avoids slow demuxing of large mkvs.
- But no longer returns future lines of embedded subtitles.
- No longer returns embedded lines of regions you seeked beyond without
playing them.
- Changing sub track drops cached subtitles.
With use_manifests=yes EDL is not used so metadata never gets set
through the tags mechanism. Thankfully the metadata property was
recently made writable so use that instead.
The existing metadata variable is inlined to fix linting.
Fixes https://github.com/mpv-player/mpv/pull/17761#issuecomment-4306070651
93fe7a5526 fixed the only problem with all_formats=yes, so make it the
default to allow changing tracks of ytdl_hook URLs at runtime without
re-invoking yt-dlp.
Closes#16872.
This adds _down_command support to bind_mouse_buttons so it can be
used to bind button down actions like mbtn_left_down, and let forward
and backward buttons use bind_mouse_buttons. This makes mouse button
down actions customizable.
The event responder must have up, down, or press suffix, but
940ab99055 removed it for frame stepping
function, making it unusable. Fix this by using the down suffix.
Fixes: 940ab99055
Previously this function would just count bytes which was very easily
broken by incantations like `Ő̶̧͍̹͔̮̮̦͌̈̌̂́̊͜K͖̮̼̯͖͆͋̓̀̕` which take up 52 bytes while being just
2 normal width characters visually.
`terminal_display_width` correctly counts `Ő̶̧͍̹͔̮̮̦͌̈̌̂́̊͜K͖̮̼̯͖͆͋̓̀̕` as 2 visual characters.
Note: GitHub strips all these in their web UI but there are many Unicode
combining characters after each letter of the `OK`s above that produce
a "cursed" text effect.
Fixes#17772
When 0197729949 added state.chapter_list this call was not updated to
use the cached value, but there is no reason not to use it, especially
now that more cached properties are used.
For properties that were already being observed but still retrieved over
and over, cache their values using the new observe_cached().
osd-dimensions observer said that if cached we may have to worry about
property ordering but it seems to work fine. It is nice to cache it
because it was the property retrieved the most frequently, in 5
different places.
Similar to current-tracks, when the selected audio track is combined
with another one or with an ffmpeg filter, show the first selected track
id instead of "-".
This was requested by a user on IRC.
Also avoid fetching aid and sid on each render.
this adds a "standard" api for ui scripts and thumbnailers to
communicate with each other, based on the simple thumbfast api
[0].
the api works as follows:
* To issue a thumbnail draw command, the UI script will set the
property `user-data/osc/draw-preview`.
* To clear the thumbnail, the UI script will set the previously
mentioned property to `nil`.
a more ideal api would make it so that the thumbnailer script
only generates the thumbnail and doesn't need to draw at all.
but such api is vastly more complex [4] and would require a lot
more work and maintenance on mpv's side.
this is a decent enough api that allows arbitrary thumbnailers
and ui scripts to communicate between each other and work
together, while being simple enough that it can be supported
without too much maintenance.
this change has been tested with work with thumbfast [1]. and
for demonstration that this api can be useful outside of osc, it
has also been tested to work on mfpbar's thumbnailer branch [2].
the code to determine thumbnail x,y is based on the osc fork
inside of thumbfast [3].
[0]: https://github.com/po5/thumbfast?tab=readme-ov-file#for-ui-developers-how-to-add-thumbfast-support-to-your-script
[1]: https://github.com/po5/thumbfast/pull/173
[2]: https://codeberg.org/NRK/mpv-toolbox/src/branch/thumbnailer/mfpbar
[3]: https://github.com/po5/thumbfast/tree/vanilla-osc
[4]: https://github.com/mpv-player/mpv/discussions/17654
93fe7a5526 made global_tags work with all_formats=yes, so do like
suggested in 8ea7aa5471 and set the title via tags.
This makes available in ${metadata/title}, even if you set
--force-media-title separately.
--force-media-title is also set when self_redirecting_url is true, but
tags seem not to be set in this case and I don't know where to find such
videos to test. It was originally added to close#5313, but the URL
linked there no longer loads.
The delay_open mechanism used by
--script-opt=ytdl_hook-all_formats=yes breaks setting metadata with
global_tags because tl->track_layout is NULL. See adcf51dccdcbb8f534b08ea7aa5471.
Fix this by applying tags to the EDL timeline in this case.
Tags must still be applied to tl->track_layout when available for them
to work with local EDL files.
This has been deprecated for 8 years, since 9eadc068fa, with a visible
warning. Removing it has the benefit of not spamming every log file with
lua-settings searches.
Since changing the width and alignment of buttons shrinks them or messes
up the layout, manually override the hitbox of buttons at the edges.
Fixes#9791.
Alpha blending is done in gamma light of the target, when the overlay is
drawn. Depending on VO and target format, the alpha value can act quite
differently.
Lower it a little to avoid excessive transparency in some cases. This
should be fixed or workaround in better way, but for now just adjust the
value.
track-list/N is not required to match aid/vid. They are encoded as
track-list/N/id.
This fixes changes in 1a558bf5c2 where it
was asumed that track id is the same in track-list, which is not true,
in general sense.
Makes it nicer for speaker icon to not move around on different volume
levels. Also remove scaling, it was not needed.
This required to rewrite the exclamation mark drawing code, made it look
similar to old icon now.
There is an area between the 2 lines of bottombar and topbar that is not
clickable, e.g. between the menu and play_pause icons. Make it all
clickable so it's easier to click buttons.
This also allows clicking from the bottom in slimbottombar and from the
top in topbottombar.
Window controls are not clickable from the very top of the window, they
have a margin to the top that makes them harder to click. Make them
clickable also from the very top to make them easier to activate.
The close button with the default windowcontrols_alignment=right
specifically is already clickable from the rightmost part of the window.
Partial fix of #9791 (other buttons also need to be updated).