Commit Graph

1087 Commits

Author SHA1 Message Date
Kacper Michajłow 153d4927ab options: add --script-opt alias for --script-opts-append 2024-10-22 18:54:16 +02:00
nanahi 607997db24 options/parse_configfile: use stream_read_file2 for reading config
Remove the duplication with stream_read_file2, which also handles
directory correctly.
2024-10-20 19:31:49 +02:00
Guido Cella a0ca6ed5d5 options: rename --load-osd-console to --load-console
OSD is not accurate since when the console gained support for printing
to the terminal.
2024-10-17 23:57:24 +02:00
Kacper Michajłow 3df68c5807 options: mark sub-lavc-o as UPDATE_SUB_HARD
To properly update lavc options it may be required to reinit sub
decoder, so mark this option as UPDATE_SUB_HARD.
2024-10-10 16:24:09 +02:00
Dudemanguy e01eab4385 win_state: move window centering to vo_calc_window_geometry
c4e8c36071 made any usage of --geometry
implicitly center the window on the screen after a resize even if the
user did not pass any x/y arguments to the option. At the time, this was
probably wanted since --geometry was primarily a startup option and
likely the window wouldn't be centered on x11 without moving
coordinates. Times have changed since then and we support full runtime
--geometry changes on all the relevant platforms but it comes with this
automatic window centering behavior (except on wayland of course hah).

It's better to make such window centering optional and user controllable
since it is entirely reasonable that someone wants --geometry=50% to
just resize and not move anything. It's already trivial for a person
that does want to move the window to just add their coordinates to the
--geometry command so there's no reason to continue to force this
behavior since it is less flexible.

Instead, move the window centering stuff out of m_geometry_apply into
vo_calc_window_geometry. We give the power to the caller to whether or
not to force centering the window here and all usage of the function is
updated to simply call it with false for now. Additionally,
--force-window-position being set will also center the window like
before. All that is left is for the windowing code to take advantage of
this. See subsequent commits.
2024-10-05 18:40:11 +00:00
Kacper Michajłow 7202406fe8 various: remove global.h inclusion where not needed 2024-10-01 12:23:44 +02:00
sfan5 c11239be8c options: enable handling --no-hwdec as --hwdec=no
Reusing M_OPT_ALLOW_NO has the side-effect of applying to --ab-loop-[ab],
which makes sense.
2024-09-30 11:26:13 +02:00
nanahi 53f2619dbd options: force --ab-loop-count and --loop-file notification
Since f411f3145b, these properties
no longer change with each loop. This however caused a regression
on the behavior of resetting loop count by resetting these
properties.

Previously, after the loop count is decreased, it is possible to
reset these properties back their original values and thus reset
the remaining loop count. Currently, because setting properties
has no effect if the new value is the same as the existing value
(which no longer changes), resetting these properties does nothing,
and remaining-*-loops (which are read-only) remain unchanged.
There is no way to reset them other than temporarily setting them
to a different value, which is awkward.

Fortunately, this can be fixed by marking these properties as
force_update, which always notifies changes when being set.
2024-09-26 22:48:52 +02:00
Dudemanguy 21a0fa7abe options: fix missing comma in default watch_later_options values
Missed in 207b1a2c91.

Fixes https://github.com/mpv-player/mpv/pull/14731#issuecomment-2358718766
2024-09-18 10:40:42 -05:00
Oneric 5357d18fe6 sub: add ass-video-aspect-override option
It is unclear whether there actually is any usecase for this option
which isn't better served by sub-ass-use-video-data and/or LayoutRes
overrides, but prior to the introduction of sub-ass-use-video-data
it was possible to pass along storage resolution while faking an
aspect ratio of 1:1.
sub-ass-video-aspect-override=1 combined with sub-ass-use-video-data=all
now makes this possible again.

The uper limit of a 10:1 aspect matches
the general video-aspect-override option.
2024-09-13 23:24:08 +02:00
Oneric 207b1a2c91 sub: merge vsfilter-aspect and vsfilter-blur-compat options
The naming for "blur-compat" was misleading since the setting
actually affects more than just blur affects. Additionally
forwarding storage resolution but forcing an aspect ratio
of 1.0 for the video is likely to result in odd rendering
and there’s no known usecase for it.

Both options control which video properties are exposed to libass
so to fix the aforementioned issues merge these settings into one
tri-state sub-ass-use-video-data.

The default V keybind now cycles through all states of
use-video-data instead of toggling vsfilter-aspect-compat.

Resolves: https://github.com/mpv-player/mpv/issues/10680
2024-09-13 23:24:08 +02:00
Kacper Michajłow 5edc8973eb various: use talloc_replace 2024-09-08 17:33:27 +02:00
Kacper Michajłow 44a3a3293f options: add --{video,audio,image}-exts 2024-08-10 23:27:40 +02:00
Mike Will 88885c0401 audio: add pitch-shifting feature
Uses resampling in tandem with a time-stretching audio filter to
change the audio's pitch while leaving its tempo intact.
2024-08-07 22:56:17 +02:00
Kacper Michajłow 5fed12e025 win32: add Media Control support
Add support for SystemMediaTransportControls interface. This allows to
control mpv from Windows media control ui.
2024-07-29 21:38:19 +02:00
nanahi bb0932a3ad input/ipc-win: support fd:// for --input-ipc-client
This makes --input-ipc-client work on Windows.

To use this feature, a parent process needs to create a connected named pipe,
wrap the server handle in a CRT fd, and then spawn mpv as a child process
with the fd as the --input-ipc-client parameter.
The process can then communicate through the client handle.

The named pipe must be created duplex with overlapped IO and inheritable
handles.
2024-07-29 21:00:48 +02:00
Kacper Michajłow 77f1083098 options/m_config_frontend: remove empty line from --show-profile
Follow-up after 127b6a3455.
2024-07-26 20:07:30 +02:00
Dudemanguy 3c7b6db205 options: move all wayland specific options to vo_opts
Unlike most other platforming backends, wayland has its own specific
sub_options struct. 027ca4fb85 originally
introduced this and some more options were added later, but in
retrospect it's an unneccesary complication. There are already x11,
and windows-specific options within vo_opts. In fact, there actually is
a wayland one in there already as well (wayland-content-type) so it's
split btween two places. The wayland code already has to handle vo_opts
and it is already handles callbacks if needed. There is no advantage to
having a separate wayland-specific sub_options struct which is stuck
with whatever you set at init time.

So solve everything by deleting the old sub_options struct, moving it to
vo_opts and make some minor option naming changes for clarity (i.e.
adding a 'wl_' in front of the name). This simplifies the wayland common
code and also makes it have more functionality since you get runtime
updates for free.
2024-07-24 18:46:04 +00:00
Guido Cella a5937ac7e3 m_option: add UPDATE_VO flag
This will allow reiniting the VO when more options are changed without
hardcoding them in options.c

Also reinit the VO when changing --gpu-debug and --gpu-sw.
2024-07-24 18:44:41 +00:00
Guido Cella d384a6b793 external_files: allow specifying --cover-art-whitelist filenames
Fixes https://github.com/mpv-player/mpv/discussions/14520.
2024-07-23 14:12:11 +00:00
Misaki Kasumi f2e7146cb1 sub: add (sub/osd)-border-style; renaming sub options 2024-07-12 20:17:38 +00:00
nanahi 7c70df0934 input/cmd: move m_option_type_cycle_dir to m_option.c
A relic when commands lived in input.c. Move them to where other option
types live. Also remove the redundant copy_opt.
2024-07-01 10:02:13 +02:00
Kacper Michajłow 95ac32220e m_option: parse the timestamp as unsigned value
The sign is handled manually. This allows us to skip the check for
negative integers.
2024-06-25 05:29:46 +02:00
Dudemanguy 6e3d90d72a options: remove some deprecated OPT_REPLACED option mapping
These were all deprecated in mpv 0.37.0 or earlier and are not
considered common enough options to warrant keeping the deprecated
mapping longer. Since demux_cue had only a single option in it, the
entire option substract is removed. This can be readded later if someone
wants to introduce a specific option to it again.
2024-06-25 02:18:58 +00:00
Dudemanguy 26029cfbb0 m_option: add a way for aliases to use sub option prefix
Previously, using m_option_type_alias required that the alias have the
full name of the option value. This is limited if you are reusing the
same opts struct in different sub options. Fix this by add an additional
field to m_option to signal whether or not prefixes should be taken into
account for the alias option. Instead of blindly using whatever is
stored in opt->priv as the name, we can construct the desired option
name for either case (using the prefix or not).
2024-06-24 12:51:28 +00:00
Kacper Michajłow 103cae2591 m_option: ignore excessive elements only for obj_settings_list
It makes sense to allow the first part of the list. There are
warnings about excessive elements already. This also allows overriding
elements with the same label.
2024-06-24 03:05:09 +02:00
Kacper Michajłow 2b056c89cd m_config_frontend: disallow profile=default in config files
profile=default in config file causes infinite recursion. It triggers
reload of the default config, which contains the profile=default...
2024-06-24 03:05:09 +02:00
nanahi f7ed8c42d2 options: add secondary-{sid,sub-delay} to watch_later_options 2024-06-23 05:05:22 +02:00
Kacper Michajłow 7fda885747 m_option: do float multiplication to avoid integer overflow
Huge values doesn't make much sense, but to avoid some arbitrary limits,
use double, as the output is already floating point value.

Found by OSS-Fuzz.
2024-06-23 02:33:04 +02:00
Kacper Michajłow 758019bf92 m_options: fix obj settings list leak on error
Fixes: b3b542af51
2024-06-23 02:33:04 +02:00
Dudemanguy 23ecfa9845 options: remove deprecated auto choice for --mute
Since 995c47da9a, setting --mute=auto has
been equivalent to --mute=no. It was formally documented later in
79e20ff485. This is an old legacy relic
and the auto choice popping up during auto completion could be confusing
to users who aren't aware of the history. Remove it for good and convert
the option to a proper boolean.
2024-06-21 21:29:33 +02:00
Kacper Michajłow b3b542af51 m_options: limit list entries to 100
Limit list entries to 100. obj_settings_list is not designed to hold
more items, and it quickly starts taking ages to add all items. 100 is
more than enough.

Fixes 30s timeout on OSS-Fuzz and generally fixes possible DoS on mpv.
2024-06-18 03:11:14 +02:00
Kacper Michajłow 783150722d m_options: fix mark_del leak on error
Found by OSS-Fuzz.
2024-06-18 03:11:14 +02:00
Misaki Kasumi c55ff4176c opengl: add --egl-output-format 2024-06-08 10:23:32 +02:00
Misaki Kasumi cd74f8f7c5 opengl: add --egl-config-id 2024-06-08 10:23:32 +02:00
Guido Cella dc998560aa options: add --osd-playlist-entry
Allow configuring whether to print the media-title, the filename or both
(as `<title> (<filename>)`) in show-text ${playlist}, the OSC playlist
and in the playlist selector.

Showing only titles hides information when files are badly tagged, or
when it hides the track numbers of album songs. But showing filenames is
not as useful as titles e.g. when playing URLs with media titles. This
option lets the user choose which one to show, or show both if switching
is inconvenient.

The OSC's playlist_media_title script-opt is removed because this option
is better since it works everywhere after configuring it once.

Closes #11653.

Also show the full URLs of playlist entries instead of their basenames
in osc.lua and select.lua, consistently with mp_property_playlist().

For simplicity, this just checks if entries contain :// instead of
replicating all of mp_is_url().

Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2024-06-08 01:43:15 +02:00
Kacper Michajłow 0fd3fe857c parse_commandline: fix incorrect win32 check 2024-06-05 19:16:35 +02:00
llyyr de8bce33ed options: make sub-ass-override default to 'scale'
Previous commit changed the semantics of 'yes', so change the default to
scale to prevent unexpected user facing changes
2024-05-29 17:48:50 +00:00
llyyr f37691a156 options: move sub-ass-override 'scale' above 'force'
Also make it an enum for clarity

This is the right order in terms of both destructiveness and also the
total number of --sub-* options applied.
2024-05-29 17:48:50 +00:00
sfan5 b69b58a12a {options,player}: fix stream leaks 2024-05-15 22:45:18 +02:00
Guido Cella 61f72bd512 select.lua: add this script
This adds script messages to select playlist entries, tracks, chapters,
subtitle lines, bindings and properties using the newly introduced
mp.input.select().

This fully closes #13964.
2024-05-12 23:13:48 +02:00
Kacper Michajłow fffe723fc4 various: move strings.h inclusion to common.h 2024-05-06 22:01:17 +02:00
Kacper Michajłow 18ef834ef4 various: move unistd.h inclusion to common.h 2024-05-06 22:01:17 +02:00
Guido Cella b086a404b5 command: return lavfi filters in option-info/[av]f/choices
This adds non-mpv filters to option-info/af/choices and
option-info/vf/choices, which allows completing them with set af/vf
<Tab> in console.lua.

Partial fix of #13017. Getting the filter options would required adding
af-list and vf-list properties.
2024-05-05 14:43:57 +02:00
nanahi 807a6d875a options: add --native-touch option
For platforms which send emulated mouse inputs for touch-unaware clients,
such as Win32 and X11, this option enables the native multitouch handling
and disables emulated mouse inputs. This enables interested scripts to
handle multitouch events while keeping compatibility with touch-unaware
scripts.
2024-05-03 16:14:03 +02:00
Dudemanguy 76367dae35 m_config_core: fix forced option notification with m_config_cache
bc28f7693d originally added this, but the
implementation isn't correct and causes excessive notifications when
writing to other options which may have bad behavior in some some
circumstances. Fix this by reworking the implementation for force
options so that the timestamps of the option update compared instead.
Whenever an option gets changed, the internal timestamp in the cache is
always incremented. For a special force option, we can save this
timestamp internally as well.

Because cache_check_update is always checked before potentially sending
an option notification, we know that if the internal timestamp is equal
to the timestamp saved by a force update option, it must have been
previously written. Thus, the notification can be sent. This lets
options like geometry work repeatedly but without constantly sending
notifications. Fixes #13954.
2024-04-26 17:42:52 +00:00
Dudemanguy dc9da5d463 options: flag geometry/autofit options with force_update
Same reasoning as window-scale. This still requires that the windowing
backend correctly reacts to the notification.
2024-04-18 17:40:16 +00:00
Dudemanguy bd1bcc1f31 player: always notify when writing window-scale option
As described in the previous commit, update_window_scale will always
execute whenever window-scale is written even if the value doesn't
change.
2024-04-18 17:40:16 +00:00
Dudemanguy bc28f7693d m_option: add a force_update boolean
mpv's core does not propagate option notifications unless they actually
change to the rest of the player. Most of the time, this makes perfect
sense. If the user sets fullscreen multiple times, there's no reason to
care about anything other than the change in state. However, there are
certain options where it makes sense to always broadcast a notification
even if the value doesn't change. For example, consider the window-scale
case. A user may set window-scale to some value, resize the window
further through some other means (such as mouse resizing) and then want
to set the window-scale again to the same value as earlier. The
window-scale value did not change from before so no notification is sent
and nothing happens even though it is desirable and expected that it
operates again.

This was solved by making the current-window-scale property writable a
few years ago, but actually the easier solution is to just always force
the option to update on any write. For the big callback, the needed
changes are trivial. Unfortunately, it requires a hot mess in order to
have this work with the m_config_cache_update APIs. Spooky stuff in
there, but it does send the notification now.
2024-04-18 17:40:16 +00:00
nanahi 750dec880c m_option: change confusing error messages for obj_settings_list
This option type is not used only by filter options: they're already
used by --ao, --vo, and --gpu-context. Replace the mentions of
"filter" to "item" instead, and changes some languages to improve clarity.

Also change the documentation on "Filter options" to describe what it
really is, and fix a typo.
2024-04-18 16:28:21 +02:00