1
0
mirror of https://github.com/mpv-player/mpv synced 2025-05-04 09:10:09 +00:00
Commit Graph

139 Commits

Author SHA1 Message Date
Dudemanguy
25a0c8307d player: add an optional mute flag when framestepping
Need to shuffle some stuff around but it's pretty simple. Mute the
audio stream before the frame step and then unmute it when we're done.
It's exactly the same as the default play mode otherwise.
2025-02-20 15:50:03 +00:00
Dudemanguy
bb3265b9d3 stream_cdda: deprecate undocumented --cdda-span-{a,b} options
You probably wouldn't guess what this does from the name alone, but it
actually selects a range of tracks to play. It's slightly different than
using --start because it confines the range to just that track and you
cannot seek before it. The functionality is useful, but you can
accomplish exactly the same thing with --start and --end. Also the
implementation of the cdda option is weird because starting from a track
after 1 makes it impossible to seek before it. There's no reason to have
this when using the core option is simply better and works fine.
2025-02-20 15:49:45 +00:00
Dudemanguy
dd6e3a0ece stream_{bluray,cdda,dvdnav}: deprecate setting device after schema
This is allowed but it's pretty weird. You'd end up typing something
like dvd:////dev/sr0 or cdda:///dev/sr0 (notice the differing amount of
/). Why is this even useful? Just use the matching --cdda-device option.
There's no need to have two ways to do the same thing here.
2025-02-20 15:49:45 +00:00
nanahi
66a7338027 f_decoder_wrapper: warn when using video-aspect-override of 0 or -1 2025-02-18 23:05:02 +00:00
nanahi
13f94700d9 f_decoder_wrapper: add --video-aspect-method=ignore
This adds --video-aspect-method=ignore to replace --video-aspect-override=0.
--video-aspect-override=0 and --video-aspect-override=-1 will no longer be
handled specially. For compatibility, 0 is mapped to always use ignore
and -1 is always mapped to always use container.

"no" is now the replacement for --video-aspect-override=-1, which is
internally remapped to -2 to avoid using a deprecated value.
2025-02-18 23:05:02 +00:00
nanahi
704f995c49 Revert "m_option: deprecate setting -1 to --video-aspect-override"
This reverts commit 18257375e4.
2025-02-18 23:05:02 +00:00
Dudemanguy
319687f387 options: replace --wayland-disable-vsync with --wayland-internal-vsync
With the upcoming fixes to FIFO in wayland, it should be preferable to
use FIFO instead of our own hacky heuristic. This means
--wayland-disable-vsync should become a tristate option with an "auto"
behavior (not implemented in this commit). The semantics have to
slightly change so introduce --wayland-internal-vsync and deprecate
--wayland-disable-vsync.
2025-02-17 17:15:00 +00:00
nanahi
7f4add8ddb options: disable --input-ime by default
Enabling IME by default can cause problems when the player is
expecting keybinds and not text input. Windows IME implementation
mitigates this by switching IME to alphanumeric mode,
but this is impossible on Wayland with the text input protocol.

Disable it by default and add a note to recommend enabling IME only on
demand, like console.lua.
2025-02-17 16:56:47 +00:00
nanahi
bebecdf048 video/out/w32_common: support --input-ime
This allows enabling/disabling IME on win32.
2025-02-17 16:56:47 +00:00
Guido Cella
1329b50098 console.lua: give a different background color to the selected item
The default item also has the same background color but with
transparency.

Also stop bolding selections since inverted black and white backgrounds
should be visible even with color blindness. It was annoying with
proportional fonts because it misalignes similar strings.

As mpv's default text colors are white on black border or background,
--osd-selected-color's default of a bright yellow meant to be used with
a black border becomes unreadable with the inverted white background.

We could default to a dark --osd-selected-color and a a light
--osd-selected-outline-color and use --osd-selected-outline-color as the
selected back color. However in show-text commands having only the
selected item with a different white border doesn't look good.

This therefore adds indipendent selected_color and selected_back_color
script-opts. --osd-selected-color is only used for completions and for
the selected item when searching the command history with
outline-and-shadow.
2025-02-17 16:35:27 +00:00
Guido Cella
24cd11d85c console.lua: always draw a background behind items
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.
2025-02-17 16:35:27 +00:00
Dudemanguy
d7159e4662 vd_lavc: make auto the same as auto-safe and introduce auto-unsafe
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.
2025-02-17 16:32:37 +00:00
Kacper Michajłow
f14660b446 Revert "vo_gpu_next: set --target-colorspace-hint to yes by default"
HDR or any color-space pass-through should be opt-in, as we cannot
control the user's compositor or display. Allowing HDR signals to be
pushed by default may lead to surprising results for some users.
Additionally, for an optimal experience, this option should be paired
with the target-peak of the display.

Make the pass-through opt-in and let the user decide if they want or
need it. By default, mpv should render a safe and consistent sRGB
output. mpv's tone mapping is generally of higher quality than any
external solution.

This reverts commit 23843b4aa5.
2025-02-08 06:15:32 +01:00
Dudemanguy
18257375e4 m_option: deprecate setting -1 to --video-aspect-override
It's unfortunate that it is implemented this way since changing it will
take time. This option should *really* be like OPT_CHOICE but with
doubles and not integers. We don't have that though and implementing it
is something for the future. Even if that was done today, this still
couldn't be switched to since setting -1 has been the effective way for
years to undo video-aspect stuff. So the approach is to just add another
special keyword for this and tell people to use that instead. Note that
setting 0 isn't deprecated since M_RANGE(0, 10) is totally fine and
would work in the future if this option type ever gets redone.
2025-02-08 02:01:13 +00:00
Dudemanguy
16828aa952 command: convert aspect, par, and sar sub-properties to double
These were still set to float. For some common aspect ratios (e.g. like
4:3), the loss of precision is significant. The underlying calculations
are already done with doubles so all that needs to be done is to change
the type of the sub-property.
2025-02-08 02:01:13 +00:00
Dudemanguy
38ad1ed03b command: normalize paths for path and track-list/N/external-filename
It's better for API users to actually get predictable results.
2025-02-01 16:12:03 +00:00
Guido Cella
cada717416 Revert "console.lua: add pause_on_open script-opt"
This reverts commit 850e03d29f.

The previous commit solved this in a more general way. You can do:

[open-console]
profile-cond=p['user-data/mpv/console/open'] and p['current-tracks/video/albumart'] == false
profile-restore=copy
pause

Thankfully pause_on_open was just added and has not been in a release so
we can remove it.
2025-01-31 06:04:54 +01:00
Dudemanguy
62c3aeb9cb command: expand paths for all commands with path arguments
Follow up to be15be3a83 with the same
reasoning.
2025-01-30 21:57:31 +00:00
Dudemanguy
814316fb2a command: add metadata sub-property for track-list
Requires a little bit of massaging for the key/value access to work
correctly, it's not terribly intrusive all things considered.
2025-01-30 15:24:38 +00:00
Dudemanguy
4c3eb16a47 m_option: add -clr to keyvalue list options
Seems to have been omitted by mistake and nobody ever noticed.
2025-01-29 20:45:13 +00:00
Dudemanguy
d2c409c56b m_option: reintroduce -del to string list and keyvalue list
b56e63e2a9 removed this because it was
deprecated and not clearly useful. This commit adds this operation back
to string lists and keyvalue lists, but with one important change. It
operates via the actual values and not indexes. So you can use
--foo-del=bar,bar2 to remove bar and bar2 from foo. The difference from
using -remove is that this is subject to escaping rules and has the same
caveats as -add. Note that -del wasn't added back to the object settings
list because you can already remove multiple items with -remove from it.
2025-01-29 20:45:13 +00:00
Dudemanguy
7456816217 m_option: undeprecate list option suffixes with multiple items
Done with 4a084c0df8. The reasoning was
that it was "confusing", but without using -add it is impossible to
append multiple items to a list in a single command and just overall
makes this less powerful. The code works fine. You might find yourself
in escaping hell, but that's on the user to deal with.

Also it's worth noting that -remove with object settings lists can
actually remove multiple items and unlike the other list option types.
2025-01-29 20:45:13 +00:00
Dudemanguy
8c4ca44e24 vd_lavc: separate opts to two structs and reorganize
The options in vd_lavc are all related, but they don't all require the
same thing for runtime changes. To avoid having to manually add UPDATE_*
to every single option flag, the options can be split into two separate
structs. The vd_lavc_conf becomes a catch all for all the --vd-lavc
options that require the full UPDATE_VD flag. The rest of the options
are split off into the new hwdec_conf instead. Additionally,
--vd-lavc-software-fallback is renamed to --hwdec-software-fallback and
moved to the hwdec_conf as well. The new name better reflects what it
does and it logically fits with those more. UPDATE_* flags are added on
everything now so these should all now be changeable on runtime.
2025-01-29 15:07:42 +00:00
Dudemanguy
be15be3a83 various: expand paths for all file/directory related options
There's several path-related options that do not handle common shortcuts
(like ~/). Fix this by using mp_get_user_path where appropriate which
expands the path so users get more intuitive behavior. Fixes #15598.
2025-01-29 14:49:06 +00:00
Dudemanguy
8d665ac2df osc.lua: add visibility_modes script opt
This allows users to choose what visibility modes they want to cycle
through when calling the osc-visibilty cycle script binding.
2025-01-28 15:47:47 +00:00
Dudemanguy
fd4aa9b533 osc.lua: deprecate pointless script-messages
1a558bf5c2 effectively aliased the custom
OSC printing to actual mpv properties instead. These only exist for
backwards compatibility which hopefully will get removed one day so
instead deprecate them and warn users of what they should be using.
2025-01-28 15:47:47 +00:00
Dudemanguy
9661a3839b command: allow frame-step to go through multiple frames and/or seek
Previously, the default behavior of frame-step and frame-back-step is to
play forward 1 frame or seek back 1 frame. We keep this behavior but
introduce additional flags to control the exact behavior of the frame
stepping. The first argument simply specifies how many frames to go
through. The second argument specifies whether to play video to step
through frames or to seek to step through frames. Playing through the
video to step through frames only works going forwards (otherwise it
will always seek). In theory we could use backwards playback for this,
but that can be decided later.

As a minor note, MPSEEK_BACKSTEP is renamed to MPSEEK_FRAMESTEP since
forward seeks can use this as well. Fixes #10128.
2025-01-28 04:20:16 +00:00
Guido Cella
b75ed73f4f loadfile: optionally save the watch history
The history could be formatted as CSV, but this requires escaping the
separator in the fields and doesn't work with paths and titles with
newlines. Or as JSON, but it is inefficient to reread and rewrite the
whole history on each new file, and doing so overwrites the history with
an empty file when writing without disk space left. So this uses a
hybrid of one JSON object per line to get the best of both worlds. This
is called NDJSON or JSONL.

Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2025-01-27 18:53:28 +01:00
nanahi
481646da37 command: add current-clipboard-backend property
Useful to know which clipboard backend is active.
2025-01-27 18:51:31 +01:00
Attila Fidan
51dc6286b6 video/out/wayland_common: support IME usage via text-input-v3
This is useful for text input in, for example, console.lua. Each
character in the commit string gets turned into an mpv key press.
Pre-edit strings are not handled, since there's currently no good way to
handle that or make it useful to text input scripts. Like win32, which I
tested in wine, another limitation is that the composition window is
always positioned at the top left of the window, since we cannot get
useful positioning hints from mpv scripts. It allows the composition
window to be within the window and avoids obstructing the console
prompt.

This can be enabled/disabled with --input-ime=<yes|no> (default: yes).
2025-01-25 03:14:44 +00:00
llyyr
4c083f130d DOCS/interface-changes: change rst exts to txt
gen-interface-changes.py only looks for .txt files.
2025-01-21 17:44:16 +01:00
Guido Cella
b530b402bf command: add current-watch-later-dir property
It will be used in the next commit.
2025-01-05 23:21:50 +01:00
Guido Cella
ff518ee6f0 DOCS/interface-changes: add slim*bar layouts to interface changes 2025-01-05 22:03:36 +01:00
nanahi
ab47e95197 player/screenshot: support more formats for screenshot-raw command
This adds a format parameter to screenshot-raw command which controls
the format of the returned image data. In addition to the bgr0 format,
this adds support for 3 other formats: bgra, rgba, rgba64.

bgra is used by overlay-add command and several window systems.
rgba and rgba64 are used by several GPU APIs and are the formats
returned by the gpu and gpu-next screenshot code, which avoid the need
for further format conversion (see convert_image function).
rgba64 also adds the ability to acquire high bit depth screenshots
for screenshot-raw command.
2025-01-05 21:28:57 +01:00
Guido Cella
850e03d29f console.lua: add pause_on_open script-opt
Add a script-opt to pause when console opens and unpause when it closes,
disabled by default.

This is particularly useful for selectors that take several seconds to
open so you don't have to guess when to pause, like the subtitle line
selector with embedded subtitles, or my script which lets you select
which lyrics to download after requesting them with curl.
2025-01-05 21:21:32 +01:00
llyyr
baecbb12fa sub: add sub-scale-signs
Allows --sub-scale to alow scale typesetting
2025-01-05 01:14:42 +01:00
Guido Cella
2e1bc3cf26 osc.lua: allow adding custom buttons 2025-01-05 00:50:35 +01:00
Kacper Michajłow
497310a235 Revert "demux_edl: disallow nested edl to avoid infinite loop"
Apparently there are some scripts that use nested edls instead of
flattening them first, so let's live with this.

This reverts commit de42e11662.
2025-01-04 16:13:07 +01:00
Kacper Michajłow
96da0cbcbd options: remove the player argument from --media-controls
It is now handled internally by the libmpv profile.

Since `player` was the default option, the impact should be minimal, as it
is uncommon to override the default option with the same value.
yes/no args will function the same way as before this commit.
2025-01-04 15:16:40 +01:00
Guido Cella
fab8848d7d sub/osd: default to a semitransparent black back color
By default OSD and subs have no shadow, but if you do set a
--osd/sub-shadow-offset, the current default white shadow color looks
bad around white text with black border. Default to semitransparent
black instead. Use the same color box profiles were using to allow
removing it from there.
2025-01-03 12:18:03 +01:00
Callum Moffat
748fc2b752 ao_audiounit: add --audio-exclusiv support, make non-exclusive default 2024-12-31 13:51:44 +01:00
Guido Cella
e696b75f57 options: add --playlist-exts
And add playlist to --directory-filter-types' default.

Fixes
https://github.com/mpv-player/mpv/issues/15096#issuecomment-2466695186,
fixes https://github.com/mpv-player/mpv/discussions/15508
2024-12-28 14:24:00 +01:00
Guido Cella
114bdc24f2 options: add --archive-exts
And add archive to --directory-filter-types' default.

Fixes #15550, fixes #15096.
2024-12-28 14:24:00 +01:00
Jisu Kim
e2014fb309 osc.lua: add option to enable fade-in effect
Introduced a new `fadein` option to control the fade-in effect for the OSC.
The default value is `no`, which disables fade-in. This option allows users
to enable a fade-in effect when the OSC appears. Updated documentation
accordingly.
2024-12-10 22:41:40 +01:00
Guido Cella
5dbaa69138 console.lua: add margin_{x,y} script-opts
Allow configuring the margins from the left bottom indipendently of
--osd-margin-{x,y}.

Fixes #15478.
2024-12-10 13:47:43 +01:00
Guido Cella
f7e6e30a49 aspect: add --video-recenter
This ignores --video-align-{x,y} when the video is smaller than the
window in the respective direction.

After zooming in, panning and zooming out, this is useful to recenter
the video in the window.

Unlike doing this by observing osd-dimensions in a script, this is done
before rerendering, so you don't see the image being rendered uncentered
for an instant after zooming out, before being rerendered centered.

Also update --video-align docs while at it.

This doesn't work well with --video-pan-{x,y} because you can move the
output rectangle far away from the image, and when zooming out pan is
abruptly reset to the center. It doesn't feel like natural like zooming
out after changing --video-align-{x,y}. So this commit doesn't set pan
to 0. Also this leaves a way to move scaled images within the window
even with --video-recenter.
2024-12-02 22:31:14 +01:00
der richter
dec0d02f9f vo_gpu: undeprecate --gamma-factor
deprecated since 0.35 in ac39661 and 2207236.
2024-11-30 02:32:39 +01:00
nanahi
34571e7882 command: make script-binding command scalable
script-binding command is currently not scalable, so script
registered key bindings also cannot be scalable, unlink input.conf
bindings.

This makes script-binding command scalable so that it's possible to
define scalable key bindings in scripts. It now calls script-message
command with an extra argument with the scale of the key.
2024-11-27 20:40:41 +01:00
nanahi
b97e3b9e4b DOCS: add clipboard documentations 2024-11-27 20:31:41 +01:00
Guido Cella
b9e6030053 command: highlight selected list items with color
Instead of printing circles in show-text ${playlist}, ${chapter-list}
and ${edition-list}, introduce --osd-selected-color and
--osd-selected-outline-color to reduce clutter, make the selected item
easier to differentiate, and have visual consistency with select.lua.

The defaults are taken from the style of the selected item in the
console. These new options are also used there, replacing the hardcoded
styles. Due to being user-configurable, selected item styles are changed
to take priority over default item styles.

The default selected style is yellow and bold. The bold (hardcoded)
allows differentiating the selected item with color blindness. There is
also a separate --osd-selected-outline-color option defaulting to black,
since without it if the user changes --osd-outline-color yellow text
becomes unreadable without a black border. --osd-selected-back-color is
omitted for now.

Text and background colors are inverted for the selected item in the
terminal. This is hardcoded, adding an option is overkill.

A disadvantage of this commit is that if you run print-text ${playlist}
with a VO, the selected style ASS is printed to the terminal (but ASS
printed in the console is interpreted). This commit avoids printing the
reset ASS sequence for non-selected items to reduce clutter in this
case.
2024-11-27 15:37:42 +01:00