This reverts commit ad0c29e5ac.
This should be unnecessary now that the menu has a visible horizontal
and vertical hitbox, and was not discoverable anyway. Right click can be
useful even while the console is open to pause or open a context menu.
Requested in
https://github.com/mpv-player/mpv/pull/15145#issuecomment-2428032616.
Draw a background behind selectable items even with outline-and-shadow.
This makes sense for a menu because you want it to be readable, select
something and move on. It doesn't stay open while watching like OSD
messages and subtitles, so it can cover more of the video. In fact this
was probably the only menu without a background by default. Also the
scrollbar without a background looked weird, and the background shows
the new horizontal hit box.
--osd-outline-color determines the background color with
outline-and-shadow, while --osd-back-color determines the background
color with background-box. Some transparency is added because using pure
black is not recommended because it causes eye strain; alternatively
--osd-outline-color could default to #222222.
Drawing the background ourselves also allows making the corners rounded.
Free-form text mode keeps using only background-box backgrounds if
configured as covering the whole screen while searching stats key
bindings would be bad. Searching history also doesn't add a background
to not change the layout abruptly. When searching history with
background-box, it preserves the alpha component of --osd-back-color.
Add a scrollbar to give a visual representation of the size and position
in the items. It is not clickable.
The counter is moved above the scrollbar to free up a line for an
another item, simplify calculations, and prevent the selected item from
jumping from the second to the first line as you type.
In terminal output there is no easy way to draw a scrollbar to the right
due to Unicode widths. This just moves the counter into the prompt.
The newly added max width calculation allows positioning the select menu
in the center of the window.
The input line is moved above the items so that the selected item stays
near the input line as you type instead of jumping from top to bottom as
the matches decrease.
Keep aligning to the bottom left to search the command history to not
change the layout abruptly, the same reason the monospace font is kept.
Follow up to c438732b23 which improved the calculation with the default
outline-and-shadow. We can make the calculation accurate for
background-box too without making semitransparent rectangle backgrounds
overlap by disabling the shadow of selectable items, and drawing a
single rectangle below the items.
We could also calculate the height of each item to make them perfectly
adjacent by rendering each one with compute_bounds, but that takes 15ms
per render even on a new CPU, so 20 lines would take 300ms, which is too
slow.
The rectangle is as wide as the longest item. Even using compute_bounds
once on the longest item on each render() slows it to the point of
making updating the highlight while moving the mouse slower than with
outline-and-shadow, especially on old hardware. So cache the width of
the longest item when opening the console and update it when
osd-dimensions change.
Also increase the items' height to opts.font_size * 1.1 because it looks
better with some margin between the items. It is possible to do it now
because selectable items are drawn in separate ASS events in all border
styles.
The big option callback in player/command will trigger on every single
update. This is not so great when several heavy option changes are
called in rapid succession and operations are pointlessly repeated. Try
to copy the approach that input commands do and run the actual callbacks
during the playloop. This is not really a smart or sophisticated
mechanism. It also only works for the main option cache. In theory,
other option caches like vo_opts could get spammed too and this makes no
attempt on those. But regardless, this is probably good enough for us.
mp_option_change_callback now tries to group together any new callbacks
with existing unprocessed ones and drop redundant ones whenever
something new arrives.
For some reason, mp_option_change_callback had weird special logic on
init to start the ipc client. This makes no sense. It should just be
started in mp_initialize like all the other clients.
Users basically never need --hwdec=auto in reality and sometimes it
bites them unexpectedly (e.g. #15814). Unfortunately the name is kind of
nice sounding and if you don't read the manual closely, you might
inadvertently end up using it. So just make auto the same as auto-safe.
auto-unsafe is introduced to have the old behavior of auto instead. A
similar thing is done with the -copy variants. Try to update the
documentation of this section a little bit and discourage people from
using auto-unsafe because it's kind of dumb.
Partial revert of the drm stuff added in commits
4d09cde8f9 and
0d7b4d64a5. This was due to my
misunderstanding and simply that my card has some sort of mesa bug. It
appears that YUV sampling is somehow skipped for the implicit modifier
path on radeonsi if the client doesn't use EGL directly (e.g. like
vo_dmabuf_wayland which creates a wl_buffer from dmabfus directly).
Anyways, all of this is just wrong so remove it. All mpv should do is
match format + modifier pairs in the tranches and nothing more.
Currently using mp.input while the console is open doesn't do anything.
We can allow using mp.input multiple times in a row by keeping the
console open, and sending a closed event only when the previous calling
script is different from the current one. If it is the same, sending a
closed event would unregister the new input-event listener, so it is
just never sent in this case as there is no sane way to do it. This is
useful e.g. to try out select script bindings in the console, or to
switch to a different mp.input script binding with a key binding without
having to close the current one.
Calling input.select() again within input.select()'s submit handler
needs to be fixed separately because with select the console is
immediately closed on submit (367a6b561a), so input.lua receives submit,
requests a new selection, and receives closed wich unregisters the
handler of the new selection. Just not calling
mp.unregister_script_message("input-event") fixes it; its only purpose
was to allow garbage collection of variables defined in the scope using
mp.input.
Fixes#15795.
Having path -> path in the log is kind of useless. If someone happens to
call this on memory://, it will also flood the log with garbage. Only
log it if the path actually gets expanded.
We already have more than enough options. This doesn't need to exist.
Just use the environment variable if you really want to use this for
some reason.
Sometimes there was an immediate return on error and other times it
destroyed things before returning the error. Make this consistent
whenever something fails while we open. Also remove the destruct
function since it is completely redundant with bluray_stream_close.
Sometimes a CD can have non-audio data at the start that is not
playable. libcdio/paranoia is smart enough to already skip this, but our
calculations for when the tracks/chapters start completely fall apart.
The beginning bytes are not valid CD audio so it should just be
subtracted and ignored. This probably doesn't work if a CD somehow has
its audio tracks in a non-continuous manner with non-audio data
in between tracks at random points. There's likely not much we could do
in such a case, and probably nobody has an audio CD like that anyways.
Ref: #8322
We hit a -Wstrict-prototypes error which was fixed in the latest release
of libcdio-paranoia but openbsd is too old. We already have coverage of
this in other CIs so remove it.
The same as 04a2450aab, but now cdda is
auto detected, so disable it explicitly.
This test requires that the OS language settings be English so the
--subs-match-os-language option is actually testable. In Linux, this can
be done by just setting LANG and it always will work. For macOS and
Windows, we use the OS APIs to get the languages and let the test
proceed if we find English. Gracefully fail and skip otherwise.
Internally, mpv uses '-' as a separator for language codes like
specifying the region/variant for the language. However, the posix
environment variables for this separate using a _. Since
5009e13431, support for the _ separator
was dropped which meant that --subs-match-os-language actually didn't
work on linux/bsd at all (mac has its own separate implementation).
Instead of adding _ back to the function, it makes more sense to just
replace _ with - while we parse through the languages since this
implementation of mp_get_user_langs is the only one that separates with
_.
Notably they are exchanged between demux and decode thread. It's fine
because we know those pointers will be alive as long as avctx is alive.
And only the value may change during decoding in rare situations. Make
those pointers atomic for the sake of it.
It shouldn't change anything, except some codegen.
From https://www.gnu.org/software/libc/manual/html_node/Atomic-Types.html#Atomic-Types:
In practice, you can assume that int is atomic. You can also assume that
pointer types are atomic; that is very convenient. Both of these
assumptions are true on all of the machines that the GNU C Library
supports and on all POSIX systems we know of.
We use the ext protocol, not the wlr specific protocol. Moreover,
"zwlr_data_control_manager_v1" is an interface within the protocol, not
the protocol name itself.
Loading the file and then waiting it for it to be loaded again doesn't
need to be two separate functions. Combine it into a simple
"reload_file" so it's more readable.
This got refactored so it only loads one file at a time and not
everything in a loop. The option resetting at the end of conditional
branches is pointless.