Commit Graph

1007 Commits

Author SHA1 Message Date
Dudemanguy d59f4fd3ec Revert "player: do not exit when a seek gets queued"
In various edge cases, this causes an assertion that was added later in
8816e1117e to be hit. The actual purpose
of the special case is not really clear. mp_seek already will change the
mpctx->stop_play value, so there shouldn't be any need to do it in
queue_seek. And it is known to cause problems so revert it. Also, remove
the special play direction logic that works around this behavior.
Fixes #13778.

This reverts commit dbdc46c97a.
2024-05-16 13:26:34 +00:00
Guido Cella c4b03700e1 player: add option-info/<name>/expects-file
This will allow console.lua to complete files after e.g. set
glsl-shaders <Tab>.
2024-05-12 22:29:40 +02:00
Kacper Michajłow aa3cf6d57b command: add dolby-vision-profile and dolby-vision-level to track-list 2024-05-10 01:26:30 +02:00
Guido Cella 20b8fe05bf misc/language: move mp_guess_lang_from_filename() here 2024-05-10 01:22:31 +02:00
nanahi 9f5edd4eed various: fix indentation 2024-05-07 11:23:08 +02:00
Kacper Michajłow 18ef834ef4 various: move unistd.h inclusion to common.h 2024-05-06 22:01:17 +02:00
Guido Cella 6ec3e1549d command: add normalize-path command
This can be used e.g. by a bookmarking script to show normalized paths.
2024-05-05 20:29:27 +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
Aman Karmani abe8f3f9df demux: keep track of ts information per stream type
Signed-off-by: Aman Karmani <aman@tmm1.net>
2024-05-05 14:11:47 +02:00
nanahi 46cca1a67f command: add touch-pos property
This adds touch-pos property, which contains the information of all
current touch points. The property has sub properties:

touch-pos/count: the number of current touch points
touch-pos/N/x,y: the position of touch point N
touch-pos/N/id: unique identifier of the touch point
2024-05-03 16:14:03 +02:00
Kacper Michajłow 0b234af113 player/command: mark sub-text-ass as deprecated
Fixes: 437fff9f21
2024-04-27 01:23:52 +02:00
rcombs 99f1b2b7b4 player/command: add sub-text/ass-full sub-property
This is like sub-text/ass, but it returns a full ASS line, making it suitable for some more advanced scripting use-cases.
2024-04-27 01:19:56 +02:00
rcombs 437fff9f21 player/command: move sub-text-ass to a sub-property 2024-04-27 01:19:56 +02:00
nanahi 96e1f1dfa5 video/out/gpu/context: convert --gpu-context to use obj_settings_list
Since the list of available GPU contexts is a compile time constant,
use obj_settings_list instead of opt_string_validate for GPU contexts.
This has several advantages:

- Aligns with the existing usage of vo, ao, and filter lists.
- Allows custom probing order.
- Allows list option suffixes. (--gpu-context-append, etc.)
- Allows autocomplete in console.lua.
- Uses the standard obj_settings_list help printing, so the custom
  help printing function is no longer needed.

This also deduplicates some context creation code for ra_ctx_create
and ra_ctx_create_by_name.
2024-04-18 16:28:21 +02:00
rcombs d3a63e16d2 command: use property_time() for sub-start and sub-end
This gives these properties the "time" type, which allows them to be pretty-printed as HH:MM:SS easily (but also still allows raw formatting using e.g. ${=sub-start}).
2024-04-18 13:11:01 +02:00
Kacper Michajłow a569c3ce0c player/command: add track-list/N/decoder 2024-04-18 01:20:32 +02:00
Kacper Michajłow d23f641bb3 player/command: remove codec-info and use track-list directly
Turns out that adding more medatata like HDR10+ and Dolby Vision would
produce a lot of duplication and it is better to centralize it around
the track-list property.

Fixes: e720159f72
2024-04-16 21:58:55 +02:00
Kacper Michajłow e720159f72 player/command: add video-codec-info and audio-codec-info
Adds support for extracting codec profile. Old properties are redirected
to new one and removed from docs. Likely will stay like that forever as
there is no reason to remove them.

As a effect of unification of properties between audio and video,
video-codec will now print codec (format) descriptive name, not decoder
long name as it were before. In practice this change fixes what docs
says. If you really need decoder name, use the `track-list/N/decoder-desc`.
2024-04-15 19:34:40 +02:00
nanahi 14462dafe4 command: don't use OSD_ASS_0 when converting lists to strings
When converting a list to string for show-text, since
05c398fb6c the OSD_ASS_0 escape hatch
is used. This usage is problematic because the same format string is
used for print-text, which results in these ASS escape sequences
being printed in the terminal.

Also since d6610a5b2f, the print-text
output to console.lua is no longer escaped if OSD_ASS_0 is present.
This results in abnormally formated text in the console output.

Fix this by not using ASS escape sequences for this. Instead, use the
circle symbols used by the OSC, which also results in the same width
for active and inactive items.
2024-04-10 20:47:08 +02:00
Shuanglei Tao 3c1e983351 vo: add win32 context menu support 2024-04-06 08:24:06 +02:00
Kacper Michajłow 12077b7f37 player/command: optimize duplicated property search in command_init
Would be better to search the other way around, because options list is
bigger than property list, but with minimal changes this is good enough.
Both are relatively small tho and the only reason for this micro
optimization is to increase the fuzzing throughput.
2024-03-25 15:56:06 +01:00
Shuanglei Tao 7490919a9a player/command: fix udata talloc parent 2024-03-23 02:28:18 +01:00
Dudemanguy 91489c9466 options: add --input-commands option
Basically a simple way to perform any command/property action from the
command line. This takes the exact same syntax as input.conf but not
including the key naturally. Potentially useful for weird properties
that don't map well to options (like ao-volume). Fixes #12353.
2024-03-21 14:48:53 +00:00
Kacper Michajłow 8708f4dc91 m_property: add `>` for fixed precision floating-point expansion
This enhancement makes it easier to create constant width property
expansions, useful for the `--term-status-msg`. Additionally, it changes
to `%f` printing with manual zero trimming, which is easier to control
than `%g`. With this method, we can directly specify precision, not just
significant numbers. This approach also avoids overly high precision for
values less than 1, which is not necessary for a generic floating-point
print function.

A new print helper function is added, which can be used with adjusted
precision for specific cases where a different default is needed. This
also unifies the code slightly.
2024-03-21 03:50:11 +01:00
Guido Cella d6610a5b2f command: add escape-ass
This adds a command to escape ASS tags to remove code duplication
between sub/osd_libass.c, console.lua, osc.lua, stats.lua and any user
script that calls mp.create_osd_overlay().

A command is used instead of scripting functions so that all clients can
use this and not just use Lua and JS ones.

osd_mangle_ass() also interprets osd-sym-cc and osd-ass-cc/{0,1}, but
since they use invalid UTF-8 characters there is no risk of escape-ass
users using them by accident, like with any OSD message.

Always replacing \n with \\N in mangle_ass() even when it is not called
by escape-ass doesn't seem to cause any issue, but I made it conditional
anyway to avoid changing how all OSD messages are treated unnecessarily.
2024-03-21 03:20:14 +01:00
Christoph Heinrich 0c8f3bc73c player/command: add term-size/[w,h] property
There was no way for scripts to know the current size of the terminal,
which is essintial if they want to provide a good user experience even
without a window.
2024-03-21 03:08:52 +01:00
Dudemanguy ccafd40ccc demux: add a format-name property
It can be useful to know the underlying format of any entry in the
track list. Only applicable to the lavf demuxer.
2024-03-17 14:59:40 +00:00
Kacper Michajłow da3bfc96e9 vo: add video-target-params property 2024-03-07 21:12:12 +02:00
Kacper Michajłow a6f661b5c7 player/command: fix video-params/[average-bpp, alpha] when hw decoding
Need to check hw_subfmt for real values.
2024-03-07 21:12:12 +02:00
Kacper Michajłow d471f2902e mp_image: add imgfmt_name to mp_image_params
Convenience to override name if imgfmt is not set.

Allows to create mp_image_params without setting imgfmt. Will be useful
for the next change where mp_imgfmt is not available. This is workaround
that will be remved once all codebase switches to pl_fmt.
2024-03-07 21:12:12 +02:00
Dudemanguy 9ac791c329 Revert "player: reset av state on speed changes"
Ended up being too flawed and caused trouble in other areas. There's
other approaches to trying to solve the issue this meant to address in
the works that should be better, so let's wait on that. Fixes #13613 and
fixes #13622.

This reverts commit e3af545421.
2024-03-03 16:27:59 -06:00
nanahi 9d03b83a6c command: add begin-vo-dragging command
This command initializes a vo dragging request for VOs that implement
the new VOCTRL_BEGIN_DRAGGING voctrl. This allows scripts to begin vo
dragging for any button press event.
2024-03-01 18:25:12 +01:00
Dudemanguy 4560d93bf0 Revert "player: add ao-volume option, to set the system volume at startup"
Ended up being a bad idea. As a property, this inherently has more
functionality and the tradeoff of being able to do --ao-volume wasn't
worth it.

This reverts commit 58ed620c06.
2024-03-01 09:20:15 -06:00
Dudemanguy e3af545421 player: reset av state on speed changes
Playback speed changes should be treated as a discontinuity just like
seeking. Previously, this was being treated internally as just plain
normal playback, but that can't really work. The frame timings from
before the speed change and after the speed change are completely
different and shouldn't be compared to each other. This lead to frames
being adjusted to weird places and possibly even being skipped (as if
mpv was seeking) on speed changes. What we should do is clear out and
reset all av related fields like what happens when you seek, but it is
not quite as aggressive. No need to do a full video state reset or such.
We also wait an arbitrary amount of frames before adjusting for av sync
again. compute_audio_drift already used a magic number of 10 which
sounds reasonable enough so define that and use it here. Fixes #13513.
2024-02-26 15:41:34 +00:00
David Vaughan c678033c1d input/player: add loadfile/loadlist insert-at command 2024-02-26 02:03:21 +00:00
David Vaughan da753196af player: change insert_next to insert_at
Change the `playlist_insert_next` function to `playlist_insert_at` (ie,
insert at the location of an entry, rather than after it, and rename to
be clearer that it doesn't have anything to do with the
currently-playing entry).

Also, replace calls to `playlist_add` with calls to
`playlist_insert_at`, since the former has become redundant.
2024-02-26 02:03:21 +00:00
David Vaughan 432256e5d2 player: add loadlist insert-next commands
Analogous changes to the previous commit ("add loadfile insert-next commands"),
but for the `loadlist` command.

This allows us to insert a new playlist next in the current playlist,
rather than just appending it to the end.
2024-02-26 02:03:21 +00:00
David Vaughan 9e162d2604 player: add loadfile insert-next commands
This commit adds two new commands (`insert-next` and `insert-next-play`)
which mirror the existing commands, `append` and `append-play` in
functionality, with the difference that they insert directly after the
current playlist entry, rather than at the end of the playlist.

This change gives MPV a piece of functionality already found in (for
example) Spotify's media player: "play next". Additionally, using the
new `insert-next` command, users can trivially write a script to play a
new piece of media immediately without otherwise clearing or altering
the remainder of the playlist.
2024-02-26 02:03:21 +00:00
Leonardo Boss 58ed620c06 player: add ao-volume option, to set the system volume at startup
closes #12353
2024-02-25 23:57:35 +00:00
Dudemanguy 17d9abd08f player/command: handle runtime toggling of hidpi-window-scale
Wayland was the only backend that attempted this, but it can be done in
a centralized place for anything that supports this. hidpi-window-scale
is just the same as a normal window scale but with the OS DPI as the
factor.
2024-02-24 20:31:08 +00:00
Guido Cella b35e34ae2f command: fix sub-seek while paused without a video
When using sub-seek without a video track while paused, adding the 0.01
SUB_SEEK_OFFSET to the new timestamp is not enough to show the new
subtitle line. Add 0.1 instead to fix it. 0.01 is already enough for
sub-step.
2024-02-23 21:37:22 +01:00
Guido Cella b564d5916e command: don't add SUB_SEEK_OFFSET twice with sub-seek
The name SD_CTRL_SUB_STEP is misleading, but it is also used for
sub-seek, and sub/sd_ass.c already adds SUB_SEEK_OFFSET with it.
2024-02-23 21:37:22 +01:00
Dudemanguy 073858fcdd vo: remove VOCTRL_SET_EQUALIZER and simplify into UPDATE_VIDEO
Since 03cf150ff3, the only purpose of this
VOCTRL was to signal a redraw to the vo. It actualy could have been
removed in 531868fe0d, but this was
missed. The UPDATE_VIDEO flag is better anyway because it allows us to
handle a wide variety of options scattered around that require the VO to
update itself and redraw. We can remove both of the custom callbacks in
vo.c and only leave the VOCTRL_VO_OPTS_CHANGED one. Additionally, that
commit also introduced vo_set_want_redraw, but this is redundant and not
needed. The VOs that use VOCTRL_UPDATE_RENDER_OPTS already set
vo->want_redraw, and those are the only VOs where these options are
relevant in the first place. So we can remove this as well and just let
the big callback in player/command do everything.
2024-02-17 18:56:20 +00:00
Dudemanguy 965119a2b7 command: add window-id to MPV_EVENT_VIDEO_RECONFIG property change
25b66256d7 originally added this
property, but it did not add it to the property notification. This is
possibly because the window id doesn't appear to change on x11 even when
toggling VOs at runtime. However, windows uses this property and
apparently the id changes there so we should signal updates when
appropriate. Fixes #13495.
2024-02-17 15:41:23 +00:00
Dudemanguy 003fb15cbb player/command: add deinterlace-active property 2024-02-07 14:50:09 +00:00
Dudemanguy 531868fe0d player: ensure runtime updates of certain rendering options
When adding things like brightness or gamma, the video obviously needs a
redraw if paused. This happened to work in the normal case because the
OSD notification triggered a redraw, but if you use no-osd the picture
won't change. Fix this by adding another option flag, UPDATE_VIDEO, and
simply signalling we want a redraw. This gets handled along with the
normal osd redrawing check in the playloop so something like "no-osd add
gamma 1" actually works.
2024-02-05 17:23:47 +00:00
Guido Cella 4ab521f080 command: add load-input-conf
This can be used to auto reload the input configuration file, e.g. in
vim:

autocmd BufWritePost ~/.config/mpv/input.conf silent !echo load-input-conf %:p | socat - /tmp/mpvsocket

Partially fixes #6362.

Additionally this can be used as a replacement for deprecated input
sections if they are ever actually removed. For example, if you want to
define different bindings for images, you can load-input-conf an
input.conf for images, and load the original again when switching to a
video. Though currently you would have to redefine builtin bindings that
were overwritten with image ones in the default input.conf.
2024-02-04 15:12:02 +00:00
Guido Cella e2284fba18 command: add load-config-file
Unlike set include mpv.conf, this works after playback has started. It
can be used to auto reload the configuration, e.g. in vim:
autocmd BufWritePost ~/.config/mpv/mpv.conf silent !echo load-config-file %:p | socat - /tmp/mpvsocket

Partially fixes #6362.
2024-02-04 15:12:02 +00:00
Dudemanguy 7f595aabf4 player/command: don't reselect demux stream on only UPDATE_OSD
700f72f8e4 should have put this inside the
flag check.
2024-01-22 12:26:01 -06:00
Kacper Michajłow 47be5ad4aa csputils: replace mp_chroma_location with pl_chroma_location 2024-01-22 14:54:55 +00:00