Commit Graph

893 Commits

Author SHA1 Message Date
Natural-Harmonia-Gropius e5e918954f options: log profile name if there is no restore data 2022-10-28 15:48:24 +00:00
Dudemanguy 24f4582b6f x11: add --x11-present option
With the recent addition of the libxpresent, it should improve frame
timings for most users. However, there were known cases of bad behavior
(Nvidia) which lead to a construction of a whitelist instead of just
enabling this all the time. Since there's no way to predict whatever
combination of hardware/drivers/etc. may work correctly, just give users
an option to switch the usage of xorg's presentation statistics on/off.
The default value, auto, works like before (basically, Mesa drivers and
no Nvidia are allowed), but now one can force it on/off if needed.
2022-06-22 03:55:49 +00:00
Cœur bb5b4b1ba6 various: fix typos 2022-04-25 09:07:18 -04:00
Guido Cella ccff82e610 options: make --cover-art-auto=exact the default
Now that a separate --cover-art-whitelist option exists, files like
cover.jpg are loaded even without setting --cover-art-auto to fuzzy, so
only load files that have exactly the media filename by default, since
fuzzy loading is probably more likely to load unwanted images than to
load cover art that the user intended to display, especially if you play
audio files with a short filename like a.mp3.
2022-04-21 16:42:27 +00:00
Guido Cella 9d2a6dc302 player: add cover-art-whitelist option
This allows more fine grained control over which cover art to load. With
--cover-art-auto=exact and --cover-art-whitelist=yes, you can now load
cover art with the exact media filename and the whitelisted filenames,
but not cover art that contains the media filename
(--cover-art-auto=fuzzy).
2022-04-21 16:42:27 +00:00
Dudemanguy fe6d9b6962 player: rearrange video sync opts/enums/defines
The video sync logic for mpv lies completely within its core at
essentially the highest layer of abstraction. The problem with this is
that it is impossible for VOs to know what video sync mode mpv is
currently using since it has no access to the opts. Because different
video sync modes completely changes how mpv's render loop operates, it's
reasonable that a VO may want to change how it renders based on the
current mode (see the next commit for an example).

Let's just move the video sync option to mp_vo_opts. MPContext, of
course, can still access the value of the option so it only requires
minor changes in player/video.c. Additionally, move the VS_IS_DISP
define from to player/core.h to common/common.h. All VOs already have
access to common/common.h, and there's no need for them to gain access
to everything that's in player/core.h.
2022-04-11 18:14:22 +00:00
Guido Cella d6affda0a7 options: add osd-playing-msg-duration 2022-04-07 22:13:50 +00:00
Dudemanguy 27c38eac10 options: add always to stop-screensaver
The stop-screensaver option is currently limited to a simple yes/no
option. While the no option does always disable mpv trying to stop the
screensaver, yes does not mean the screensaver is always stopped. The
screensaver will be enabled again depending on certain conditions (like
if the player is paused). Simply introduce a new value for this option,
always, which does exactly what the name implies: the screensaver will
always be disabled.
2022-02-18 22:04:08 +00:00
Avi Halachmi (:avih) 9cddd73f67 Revert "options: add --sub-visibility=<primary-only|secondary-only>"
This reverts commit 04f0b0abe4.

It's not a good idea to unify the names only for visibility, while
keeping secondary-* for everything else.

This needs a bit more thought before we allow secondary sub to be
visible on its own.
2022-01-19 21:56:28 +02:00
Ripose 04f0b0abe4 options: add --sub-visibility=<primary-only|secondary-only>
Adds --sub-visibility choices 'primary-only' for only displaying the
primary subtitle track, and 'secondary-only' for only displaying
secondary subtitle track.

Removes --secondary-sub-visibility and displays a message telling the
user to use --sub-visibility=yes/primary-only instead.

These changes make it so that the default 'sub-visibility' bind 'v'
cycles through all the 'sub-visibility' choices, 'no', 'yes',
'primary-only', and 'secondary-only'.
2022-01-19 14:27:04 +00:00
Emil Velikov b44f522dba options: const annotate all m_opt_choice_alternatives accessors
Constant data, most accessors are good but some were missing the
explicit notation.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2021-11-15 14:02:08 +00:00
Emil Velikov f09396ab7d options: const annotate m_obj_list accessors
Nearly all the code base correctly references the data as constant. But
a couple of instances - fix those.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2021-11-15 14:02:08 +00:00
Emil Velikov 37619c4cf5 options: remove always true m_obj_list::allow_unknown_entries
Ever instance of m_obj_list is a constant and for all of them, the field
is true. Just remove the field all together.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2021-11-15 14:02:08 +00:00
Niklas Haas 8bd0dee531 osdep: rename MP_UNREACHABLE
It was pointed out on IRC that the name is misleading, since the actual
semantics of the macro is to assert first.
2021-11-03 15:15:20 +01:00
Niklas Haas c704824b45 osdep: add MP_UNREACHABLE
This seems to work on gcc, clang and mingw as-is, but I made it
conditional on __GNUC__ just in case, even though I can't figure out
which compilers we care about that don't export this define.

Also replace all instances of assert(0) in the code by MP_UNREACHABLE(),
which is a strict improvement.
2021-11-03 14:09:27 +01:00
Niklas Haas 432581b604 vo_gpu: lift ra_ctx_* opts to a global struct
So I can re-use them for vo_gpu_next.
2021-11-03 14:09:27 +01:00
Emil Velikov c27c17fcab options: add missing dash in msg-level help message
Currently using mpv --msg-level=help, shows an instance of --msglevel
(missing dash). Seems like the help message was only partially updated
with the -msglevel -> --msg-level transition.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2021-10-03 23:09:22 +03:00
Avi Halachmi (:avih) 41650203c3 sub: sub-filter-regex and jsre: support ass-to-plaintext
Using --sub-filter-regex-plain (default:no)

The ass-to-plaintext functionality already existed at sd_ass.c, but
it's internal and uses a private buffer type, so a trivial utility
wrapper was added with standard char*/bstr interface.

The plaintext can be multi-line, and the multi-line regexp flag is now
always set, but only affects plaintext (the ASS source is one line).
2021-08-05 21:32:22 +03:00
Avi Halachmi (:avih) 7c264950c0 sub: new: --sub-filter-jsre (js regex)
Pretty much identical to filter-regex but with JS expressions and
requires only JS support. Shares the filter-regex-* control options.

The target audience is Windows users - where filter-regex doesn't
work due to missing APIs, but mujs builds cleanly on Windows, and JS
is usually enabled in 3rd party Windows mpv builds.

Lua could have been used with similar effort, however, the JS regex
syntax is more extensive and also much more similar to POSIX.
2021-08-05 21:32:22 +03:00
Guido Cella dd7a49eb71 options: don't always set set-locally to true
Since 1d1d1fbff9 option-info/<name>/set-locally was being set to true
for every option. This broke setting start from ytdl-hook, which doesn't
overwrite start if it was set-locally. Fix this so that only adding an
option to reset-on-next-file or setting file-local-options/<name> make
set-locally true like before.

However, it's arguable that just adding an option to
reset-on-next-file without ever changing it should not make set-locally
true, so that e.g.
--reset-on-next-file=start 'https://youtube.com/watch?v=...&t=30'
will start at 30, though it currently doesn't.

Fixes #9081.
2021-08-03 13:17:12 +00:00
Guido Cella 3f0e8bd506 options: audio-display determines cover priority
Let audio-display determine whether embedded images or external cover
art tracks should be selected when both are present.

Attached pictures are given priority by default as requested in #8539.

Also updates references to attached pictures in the log and manpage to
refer to cover art as well.

Closes #8539.
2021-07-29 13:38:28 +00:00
Guido Cella 36b7cff582 manpage: fix watch-later-options examples
--watch-later-options-remove doesn't accept multiple options, so split
the example.

Also suggest the more correct -clr to empty the list, and remove the
workaround to not print an error with --watch-later-options=
2021-07-21 16:56:54 +00:00
Guido Cella 1d1d1fbff9 options: add watch-later-options
This allows configuring which options are saved by quit-watch-later.

Fixes #4126, #4641 and #5567.

Toggling a video or audio filter twice would treat the option as changed
because the backup value is NULL, and the current value of vf/af is a
list with one empty item, so obj_settings_list_equal had to be changed.
2021-07-21 13:19:28 +00:00
Dudemanguy a1c6762156 wayland: handle app id option less stupidly
Not sure what I was on when I wrote this. wayland-app-id is supposed to
default to "mpv". Just set that in the vo_sub_opts and don't do this
weird m_config_cache_write_opt thing. Also make the doc entry nicer.
2021-06-26 17:28:01 -05:00
rcombs 11423acf30 sub: by default, don't render timestamps after video EOF
This fixes a long-standing apparent issue where mpv would display the last
frame with no subtitles at EOF. This is caused by sub rendering switching from
video timestamps to audio timestamps when the video ends, and audio streams
often running past the timestamp of the last video frame. However, authoring
tools (most notably Aegisub) don't tend to provide easy ways to add meaningful
subtitles after the end of the video, so this is rarely actually useful.
2021-06-23 16:10:29 -04:00
Guido Cella cb56c2f888 player: change cover-art-auto behavior
This makes cover-art-auto behave more like sub-auto and audio-file-auto:

- load cover art with a language, e.g. if playing foo.mp3, foo.en.jpg
will be loaded with lang=en
- load cover art containing the media filename with fuzzy and all, e.g.
'foo (large).jpg'
- make all/2 load all images in the directory, and make fuzzy/1 the
default

These are all uncommon use cases, but synchronizing the behavior of the
external file options simplifies the code.
2021-06-23 16:23:50 +00:00
Philip Langdale dbbf4a415d vo_gpu: vulkan: implement a VkDisplayKHR backed context
This is the Vulkan equivalent of the drm context for OpenGL, with
the big difference that it's implemented purely in terms of Vulkan
calls and doesn't actually require drm or kms.

The basic idea is to identify a display, mode, and plane on a device,
and then create a display backed surface for the swapchain. In theory,
past that point, everything is the same, and this is in fact the case
on Intel hardware. I can get a video playing on a vt.

On nvidia, naturally, things don't work that way. Instead, nvidia only
implemented the extension for scenarios where a VR application is
stealing a display from a running window system, and not for
standalone scenarios. With additional code, I've got this scenario to
work but that's a separate incremental change.

Other people have tested on AMD, and report roughly the same behaviour
as on Intel.

Note, that in this change, the VT will not be correctly restored after
qutting. The only way to restore the VT is to introduce some drm
specific code which I will illustrate in a separate change.
2021-06-11 09:54:16 -07:00
Guido Cella 029ff1049b player: load cover art with the media filename
Closes #8666.
2021-05-27 18:19:16 +00:00
Zsolt Vadasz 62f225ef9d sub/osd: hide secondary subtitles if secondary-sub-visibility is false 2021-05-19 15:56:43 +00:00
Your Name ded36a4470 options: add some entries to --display-tags defaults
Useful for the previous commit.
2021-05-11 22:22:33 +02:00
Your Name f891eefb5c options: extend --replaygain-preamp range
Whether that makes sense or not.
2021-05-07 15:01:15 +02:00
Avi Halachmi (:avih) ef1d0b2cdb options: win32: ignore and deprecate --fit-border
The accurate description of this option was:
- fit-border is enabled by default. When disabled, it adds a bug where
  if the window has borders and mpv shrinks it to fit the desktop, then
  the calculation ignores the borders and adds incorrect video crop.

The option was added at commits 70f64f3c and 949247d6, in order to
solve an issue (#2935) where if mpv wanted to display a video with
size WxH, then w32_common.c incorrectly set the window to WxH, while
down-scaling the video slightly to fit (even with small sizes).

It was addressed with a new option which is enabled by default, but
does the right thing (sets the client area to WxH) only when disabled,
so that everyone who prefers their video slightly downscaled could
keep their default behavior.

(#2935 also addressed an off-by-one issue, fixed before fit-border)

While disabling the option did avoid unnecessary downscaling, it also
added a bug when disabled: the borders are no longer taken into
account when the size is too big for the desktop. Most users don't
notice and are unaffected as it's enabled by default.

Shortly later (981048e0) the core issue is fixed, and now the client
area is correctly set to WxH instead of the window (and together with
the three following commits which center the video, adds a new bug
where the window title can be outside the display - addressed next).

However, fit-border remained, now without any effect, except that it
still has the same bug when disabled and the window is too big.

Later code changes and refactoring preserved this issue with great
attention to details, and it remained in identical form until now.

Simply rip out fit-border.
2021-04-23 10:45:51 +03:00
Philip Langdale e5551f775d options: Add validation macro for int type
As an illustrative example.
2021-03-28 19:46:32 +03:00
Philip Langdale c8f474e3e5 demux: Move demuxer help to new standard mechanism
Previously, demux help was handled as a special case in main.c and this
is no longer necessary.
2021-03-28 19:46:32 +03:00
Philip Langdale 3f006eced4 options: Make validation and help possible for all option types
Today, validation is only possible for string type options. But there's
no particular reason why it needs to be restricted in this way, and
there are potential uses, to allow other options to be validated
without forcing the option to have to reimplement parsing from
scratch.

The first part, simply making the validation function an explicit
field instead of overloading priv is simple enough. But if we only do
that, then the validation function still needs to deal with the raw
pre-parsed string. Instead, we want to allow the value to be parsed
before it is validated. That in turn leads to us having validator
functions that should be type aware. Unfortunately, that means we need
to keep the explicit macro like OPT_STRING_VALIDATE() as a way to
enforce the correct typing of the function. Otherwise, we'd have to
have the validator take a void * and hope the implementation can cast
it correctly.

For help, we don't have this problem, as help doesn't look at the
value.

Then, we turn validators that are really help generators into explicit
help functions and where a validator is help + validation, we split
them into two parts.

I have, however, left functions that need to query information for both
help and validation as single functions to avoid code duplication.

In this change, I have not added an other OPT_FOO_VALIDATE() macros as
they are not needed, but I will add some in a separate change to
illustrate the pattern.
2021-03-28 19:46:27 +03:00
Dudemanguy 08848e76d9 player: add --screen-name and --fs-screen-name
Simple groundwork for adding a couple of user options that allow
selecting the screen with a string name. The next two commits implements
these options for xorg and wayland.
2020-12-06 17:36:43 +00:00
rcombs 4dcaf70b96 Revert "options: disable vsfilter blur compat by default"
This reverts commit 3d17e19c2c.

The effect of turning off this setting is that mpv doesn't tell libass what
the video stream's resolution is. This happens to result in some files having
their transforms scaled in ways that give higher performance (as described
in #7435) because libass happened to guess a video resolution that resulted
in transforms yielding smaller bitmaps, but it's just as easy for the opposite
to happen depending on the resolutions and effects involved.

The option's name is also somewhat misleading: setting the storage size affects
blur, but it also affects stroke (which is far more important for the vast
majority of scripts) and 3D transforms (which look very screwy when done wrong).
2020-11-22 17:37:43 +02:00
wm4 26fc70dbfd path: do not use old_home for win32 exe dir
Apparently mpv supports loading config files from the same directory as
the mpv.exe. This is a fallback of some sort. It used the old_home
mechanism.

I want to add a warning if old_home exists, but that would always show
the warning on win32. Obviously we don't want that.

Add a separate exe_dir entry to deal with that.

Untested, but probably works.

Mistakenly reverted as part of the default configuration directory
location switch-back in aa18a8e1cd.

Separation of the mpv executable directory from old_path is a
good change now that we warn about the old_config directory also
existing.

Fixes #8232
Fixes #8244
Fixes #8262
2020-11-16 00:44:40 +02:00
Philip Langdale aa18a8e1cd Revert "path: do not use old_home for win32 exe dir"
This reverts commit c3694f0acb.
2020-10-16 00:47:18 +03:00
wm4 39f4fd0dc7 screenshot: add --screenshot-sw option
Probably worthless. As usual, the manpage dumps all the subtle
differences due to implementation details on the user.
2020-10-05 00:16:46 +02:00
Guido Cella dcec6d9556 options: fix --cover-art-file typo
...which makes it not work.
2020-09-30 17:57:44 +02:00
wm4 55d7f9ded1 player: add automatic loading of external cover art files
Picks up files like "cover.jpg". It's made part of normal external file
loading, so I'm adding 3 new options that are direct equivalents for the
options that control loading of external subtitle and audio files. Even
though I bet nobody wants them and they just increase confusion... I
guess the world is actually hell, so this outcome should be fine.

It prefers non-specific external files like "cover.jpg" over embedded
cover art. Not sure if that's wanted or unwanted.

There's some pain over explicitly marking such files as external
pictures. This is basically an optimization: in most cases, a heuristic
would treat an image file loaded with --external-file the same (it's a
heuristic because ffmpeg can't tell us whether something is an image or
a video). However, even with this heuristic, it would decode the cover
art picture again on each seek, which would essentially slow down
seeking in audio files. This bothered me greatly, which is why I'm
adding these additional options at all, and bothered with the previous
commit.

Fixes: #3056
2020-09-28 00:12:52 +02:00
der richter 18a35f17e2 mac: add an option to prevent focusing of the window on open
on macOS 10.15 setting the activation policy behaves quite weirdly. the
call changes the current active App to a nameless process, which
probably also the reason that prevents the not focusing to work.
a workaround for that, is to refocus the previous active app.

Fixes #7725
2020-09-25 16:48:24 +02:00
der richter e28724d90d mac: add ontop window level for desktop
this puts the window ontop of the desktop but behind the desktop icons.

Fixes #7791
2020-09-20 15:28:50 +02:00
sfan5 3054bcc62c options: simplify --android-surface-size handling 2020-09-20 12:04:25 +02:00
wm4 f57b90b069 options: fix a flags field 2020-09-04 00:31:59 +02:00
wm4 b3758db128 options: do not accept ":" as separator anymore in key/value lists
Accepting ":" in addition to "," seems confusing and dumb. It only
causing problems when you want to pass a value that contains ":". Remove
support for ":", it is now treated like any other normal character. This
affects all options that are listed as "Key/value list" in the option
list.

It's possible that this breaks for someone who happened to use ":" as
separator. But this was undocumented, and never recommended. Originally,
the option treated many other characters in a special way, but this was
changed in commit a3d561f950. I'm, not sure why ":" was explicitly
included. Maybe because -the absurd -vf/--af syntax uses ":" as list
separator. But "," was always recommended and used in examples for
key/value options.

Fixes: #8021 (if you consider it a bug)
2020-08-22 20:25:20 +02:00
rcombs c9474dc9ed player: add --subs-with-matching-audio option
This allows users to control whether full dialogue subtitles are displayed
with an audio track already in their preferred subtitle language.

Additionally, this improves handling for the forced flag, automatically
selecting between forced and unforced subtitle streams based on the user's
settings and the selected audio.
2020-08-19 23:44:54 -05:00
Dudemanguy 9bce236714 wayland: expose wayland-app-id as a user option
This is extremely similar to x11's WM_CLASS. This commit allows users to
set mpv's app-id at runtime for any of the wayland backends.
2020-08-14 13:02:01 +00:00
wm4 ed2e2894ab sub: extend range of --sub-pos option
Seems like this is requested all the time.

It seems libass allows out of range values, but does allows the subtitle
to go out of the screen at the bottom (only when moving it to the top
it's "clamped"). Too bad, don't do that then. The bitmap sub rendering
code on the other hand is under our control, and will not move a
subtitle out of the screen.

Fixes: #7986
2020-08-12 17:30:30 +02:00