Commit Graph

3535 Commits

Author SHA1 Message Date
rcombs 437fff9f21 player/command: move sub-text-ass to a sub-property 2024-04-27 01:19:56 +02:00
Kacper Michajłow e3fd24496a stats.lua: show osd-dimensions property
This change displays the scaled position and size of the image before
cropping to the target rectangle. In simple terms, it shows how much
margin has been added to the image or how much of the image has been
cropped.

Note that target resolution is displayed after crop as in fact all other
pixels are discarded anyway.
2024-04-27 01:15:25 +02:00
Dudemanguy b364e4a65c player/loadfile: check if forced track is also tagged as default first
If a forced sub track also happens to be tagged as default, we should
check that before deselecting in compare_track. Fixes #13944.
2024-04-20 00:55:30 -05:00
nanahi db6b195f3f stats.lua: add option to disable scale with video size
This adds a new configuration option vidscale, which controls whether
stats display is scaled with video, similar to the option for OSC.lua.
2024-04-18 18:44:53 +02:00
nanahi d283688939 stats.lua: add option to control plot border width
This adds a new configuration option plot_bg_border_width, which
controls the border width of plots.
2024-04-18 18:44:53 +02:00
nanahi 5370923a35 stats.lua: remove redundant style override 2024-04-18 18:44:53 +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 dc632e16d2 stats.lua: display short decoder name if not generic one is used 2024-04-18 01:20:32 +02:00
Kacper Michajłow a569c3ce0c player/command: add track-list/N/decoder 2024-04-18 01:20:32 +02:00
Guido Cella 8a4ecda940 stats.lua: filter input bindings by typing them
This lets you press / in page 4 of the stats and type a keybinding or
part of its command to filter it by using mp.input.

This works badly without a VO because both stats.lua and console.lua use
show-text and only one can be displayed at a time, but it's still better
than not having the search available at all.
2024-04-18 01:17:53 +02:00
Guido Cella 51bd00c33a stats.lua: inherit OSD styles
Avoid having to configure both the OSD and the stats script opts when
you change the OSD options, in particular avoid having to convert colors
to BGR.

Also document the shadow options.

font_size, border_size and shadow offset defaults are kept because the
same values look much bigger in the stats than in the corresponding OSD
options.

osd-back-color is now respected without extra checks until you
explicitly set a shadow_color.
2024-04-17 23:47:55 +02:00
sunpenghao c70cc5b01d osc: add playlist_media_title option
Showing media titles in the playlist is pointless when sources are ill
tagged and media titles contain only garbage. Being able to opt for
file names at least gives us a choice in such cases.
2024-04-17 23:46:35 +02:00
nanahi 32817198bb player/misc: fix audio-only fallback when video init fails
--stop-playback-on-init-failure=no is documented to continue playback in
audio-only mode if video init fails. However, this does not function
properly after a0804329927904fdeb70d9712ff23baaab161bb4: because video
is initialized first, if video init fails, ao_chain is still null.
As a result, !(mpctx->vo_chain || mpctx->ao_chain) is true, a playback
error is raised, so the playback ends and audio does not play.

Fix this by reverting that change, so it checks the tracks instead.

Fixes: a080432992
2024-04-16 22:19:55 +00: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
Dudemanguy 68bcbf66ef player: avoid busy looping during reinit_sub
If the player is paused, switching subtitle track requires us to read
subs packets for an indefinite amount of time in order to actually
display the subtitles. The problem with this is that it puts a blocking
loop in the play thread which can be slow in cases where it takes a long
time to fetch the subtitle (e.g. over a network).

9e27b1f523 alleviates this when a pause
happens because of buffering, but it's not complete. One could encounter
this if the user pauses the video first manually and then switches the
subtitle track.

To solve this better, make it so the loop has a time out (totally
arbitrary number) so the player isn't blocked forever. If subtitles are
not fetched within that time, we flag the track and try again later in
the playloop.
2024-04-16 19:45:00 +00:00
Kacper Michajłow ab504514b8 stats.lua: add codec profile
May be interesting information for users.

Fixes: #13839
2024-04-15 19:34:40 +02:00
Kacper Michajłow 0bcc33692d player/loadfile: add codec profile to print_stream() 2024-04-15 19:34:40 +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
Kacper Michajłow 7a0c8c4619 stats.lua: remove unused variables 2024-04-13 13:37:12 +02:00
Kacper Michajłow 94fbd3683a stats.lua: use '➜' (U+279C) instead '→' (U+2192) 2024-04-13 11:09:10 +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
nanahi f167d18ec8 player/lua: fix trailing whitespace for mp.log output
Previously it always inserts a whitespace after an arg because
i > 0 is always true.
2024-04-09 20:09:43 +02:00
Christoph Heinrich 58eae25fbf stats.lua: fix scrolling for page 2
Scrolling for page 2 was disabled in 777f69bee8
but the keys were still bound, so this was clearly a mistake.
2024-04-09 17:10:21 +02:00
Shuanglei Tao 3c1e983351 vo: add win32 context menu support 2024-04-06 08:24:06 +02:00
Dudemanguy 6179995dd7 player/loadfile: set track->forced_select outside of compare_track
This field is used by compare_track when determining if the next track
should be preferred. The only problem is that we were only setting this
in compare_track which isn't used for the very first subtitle track
selection. So if the first subtitle track was a forced track that was
selected, this wasn't marked and the next subtitle track could
mistakenly be detected as preferred. Fix this by setting the field after
we set pick equal to the track in select_default track. Fixes #13804.
2024-04-02 11:19:25 -05:00
llyyr cb82ad73f2 video: also reset video-sync state when resetting video state
Fixes #13790
2024-03-30 09:46:48 +01: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
der richter 7e07e1a087 mac/apphub: migrate remaining events functionality to new AppHub
add new app_bridge objc file for bridging between mpv core and app
functionality. replace old EventsResponder singleton with AppHub.

another step to clean up all App functionality and have one central
place for it.
2024-03-24 23:03:48 +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
Guido Cella 46a35e2edc console.lua: complete fixed precision properties
Add support for the syntax introduced by 8708f4dc91 in the completion
system.
2024-03-21 08:54:58 +01: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 c84bb1ce67 osc.lua: escape text
Escape all messages in osc.lua, because other than the title they
weren't being escaped at all. If for example you did mpv foo.mp4
'{\fs50}bar.mp4' and script-message osc-playlist, it would just render
the second entry as bar.mp4 in big text.

The title was escaped partially, now the escaping is complete because:

- It escapes \. Backslashes at the end of the title are escaped instead
  of being stripped, and \n, \N and \h are now printed verbatim. In
  particular, "\\n" is no longer converted to space and is printed
  verbatim instead which is more correct.
- Newlines ("\n", not the "\\n" escape sequence) are converted to spaces
  instead of rendering them and messing up the text positioning within
  the OSC.
- Spaces at the start are preserved.

Fixes #11209, fixes #11275.
2024-03-21 03:20:14 +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 97e16be294 stats.lua: use term-size as terminal output size
The terminal output was static in size with no way of automatically
adjusting it to the current terminal size.

The new term-size property makes truly automatic adjustment possible.
2024-03-21 03:08:52 +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
Christoph Heinrich 0230a0c25a stats.lua: fix and unify scroll hint
The scroll hint on page 4 had baked in ass tags, which shouldn't be
there in the terminal. Also the scroll hint on page 0 was missing.

Refactor scroll hint generation into a function and use that for
pages 2, 4 and 0.
2024-03-21 03:08:52 +01:00
Christoph Heinrich c89b8340d5 stats.lua: use term_ellipsis for page 4
Page 4 might as well use the same line shortening function as the other
pages instead of rolling it's own.
2024-03-21 03:08:52 +01:00
Christoph Heinrich 777f69bee8 stats.lua: truncate long lines for the terminal
The terminal is assumed to be 80x24 in size, the new options
`term_width_limit` and `term_height_limit` can be used to overwrite
that.

Lines longer then the terminal width cause problems with scrolling
pages and need to be shortened.

The algorithm used for shortening can deal with tabs and escape
sequences, has rudimentary support for UTF-8 and runs in O(n).

avih helped in the creation of the term_ellipsis() function and split()
is also from him.
2024-03-21 03:08:52 +01:00
Christoph Heinrich 344ac5501d stats.lua: use scroll function for page 2 and 0
Pages 2 and 0 had their own scroll implementations, which worked fine
for ass, but didn't work well in the terminal.

Now they both use the same scroll function as page 4.

That scroll function requires each output line to be one entry
in the table. Page 0 did not adhere to that new requirement, instead
it generated two table entries for a single output line when a graph
is shown. To fulfill that requirement the generated graph now gets
directly appended to the same table entry that's used for the rest
of the line.
2024-03-21 03:08:52 +01:00
Christoph Heinrich 16a480375b stats.lua: refactor page 4 scrolling into function
This scrolling implementation will be used for other pages in future
commits.

The comment said it takes up 20 lines of the terminal, but in reality
it was 22 lines.
2024-03-21 03:08:52 +01:00
Kacper Michajłow 2a08440afb stats.lua: add more information in audio section
- current AO
- AO device
- AO volume
- audio delay
- output format
2024-03-21 02:40:00 +01:00
Kacper Michajłow c1282d4d43 player/main: move terminal_uninit to the end
It is strange to do terminal_uninit() and still use terminal after. Even
tho it has no side-effects.
2024-03-19 19:58:09 +01:00
nanahi 9a861c930b image_writer: fix TOCTOU in screenshot filename generation
The screenshot command is documented to not overwrite existing files.
However, there is a race window between the filename is generated with
gen_fname and when the file is open to write. Specifically, the
convert_image function in this window can be very time consuming
depending on video and screenshot image format and size. This results
in existing file being overwritten because the file writing functions
don't check for the existance of file.

Fix this be opening the file in exclusive mode. Add overwrite parameter to
write_image for other operations that are documented to overwrite existing
files, like screenshot-to-file. Note that for write_avif, checking
existance is used instead because avio_open does not support exclusive
open mode.
2024-03-19 19:30:27 +01:00
nanahi 82a186567e various: fix -Wold-style-declaration warning
warning: `static' is not at beginning of declaration
2024-03-19 08:58:18 +01:00
Kacper Michajłow ad093567e8 osc: add missing window controls for --title-bar=no 2024-03-18 02:22:28 +00: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 a56d8ff184 stats.lua: display video parameters after filtering 2024-03-09 05:58:52 +00:00
Kacper Michajłow 391261f757 mp_image: add mp_image_params_static_equal for finer comparision
In case of dynamic HDR metadata is present.
2024-03-09 05:58:52 +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
Dudemanguy d10cebec13 player/video: subtract frame_time from delay when ao_chain starts audio
This seems more robust than relying on the audio status to actually be
playing. For files where there is no audio or the audio start is
delayed, this guards against that but it allows the subtraction to
always occur otherwise on normal files with audio.
2024-03-03 16:24:28 -06:00
Dudemanguy 60abbb424b player/audio: also adjust apts by audio speed in audio_start_ao
Fixes 7051e94e4b
2024-03-03 16:24:17 -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
der richter 86fa9b18a3 osdep/mac: make mac naming of files, folders and function consistent
rename all macOS namings (osx, macosx, macOS, macos, apple) to mac, to
make naming consistent.
2024-02-28 15:52:47 +01:00
nanahi 3dcc661de7 console.lua: fix blurry cursor when --osd-blur is set
This is drawn with the same method as the stats.lua graphs so it's also
blurry. Fix this by using the "Default" style for cursor drawing.
2024-02-27 08:36:56 +01:00
nanahi f4af7b683e stats.lua: fix blurry graphs when --osd-blur is set
When --osd-blur is set to a nonzero value, the graphs also become
blurry. This is because they are rendered by the osd-overlay command
with the "OSD" style which has OSD blur applied, and are treated no
differently from texts. Fix this by using the "Default" style for
these graphs which uses the default OSD options.
2024-02-27 08:36:56 +01:00
Dudemanguy 4375a26e3c player/audio: remove misleading comment about delay
This came up in #13571. playing_audio_pts does not include mpctx->delay
contray to what that implies. The function is meant to only offset the
written audio pts by whatever the internal AO buffer may be.
mpctx->delay is a combination from both the audio and video code, so it
should not be used here. What is wanted is purely the audio pts.
b74c09efbf, a very controversial commit to
say the least, was what introduced this comment, so removing is probably
OK.
2024-02-26 15:41:34 +00: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
Dudemanguy 7051e94e4b player: remove speed adjustment from playing_audio_pts
When calculating the audio pts, mpv multiplies the ao delay by the
current audio speed and subtracts it from the written audio pts. This
doesn't really make sense though. mpctx->video_pts is never affected by
the playback speed, and this leads to weird behavior like the audio-pts
property changing values while paused merely because the playback speed
changes. Remove the multiplication and simply subtract the delay by a
factor of 1 instead. When updating the av_diff in player/video, this
does actually need to take in account the audio speed so we do the
calculation there.
2024-02-26 15:41:34 +00:00
Dudemanguy 63870ec225 player/main: don't set the main thread name
98a27b3cd1 changed this to mpv but that's
kind of pointless since the binary is already named mpv so that will be
the default thread name. Evidently, people rename/symlink the binary to
something else so might as well make them happier. Fixes #13469.
2024-02-26 09:35:58 +01: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 8cd678bfe4 player: fix watch later config comments when ignoring path
With --ignore-path-in-watch-later-config,
--write-filename-in-watch-later-config still writes the absolute path of
files in the comment, even though the hash is calculated from the
basename. Make it write the basename to avoid confusion.

Also stop writing redirect entries for parent directories with
--ignore-path-in-watch-later-config, both because it's redundant, and
because with this patch it would write the basename of directories in
the comment, which would be wrong because their hashes are calculated
from the absolute paths.
2024-02-24 05:26:48 +00:00
Dudemanguy 8150682814 player/loadfile: rewrite sub autoselection logic
There's too many dumb options related to subtitles which have annoying
edge cases. Try to rewrite this completely so it hopefully behaves
normally in every expected scenario. A key goal here is be smarter while
looping through the tracks and avoid selecting the subtitle if it
doesn't meet user's passed options as opposed to clearing the pick after
the fact. Fixes #13280 and fixes #13263.
2024-02-24 05:26:37 +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 8f043de961 player/sub: avoid wasteful subtitle redraws
This only affects two special cases: printing subtitles to the terminal
and printing subtitles on a still picture. Previously, mpv was very dumb
here and spammed this logic on every single loop. For terminal
subtitles, this isn't as big of a deal, but for the image case this is
pretty bad. The entire VO constantly redrew even when there was no need
to which can be very expensive depending on user settings.

Instead, let's rework sub_read_packets so that it also tells us whether
or not the subtitle packets update in some way in addition to telling us
whether or not to read more. Since we cache all packets thanks to the
previous commit, we can leverage this information to make a guess
whether or not the current subtitle packet is supposed to be visible on
the screen. Because the redraw now only happens when it is needed, the
mp_set_timeout_hack can be removed.
2024-02-15 16:43:11 +00:00
Kacper Michajłow a329bb546c Reapply "video: remove another redundant wakeup"
This reverts commit 44c398c3e1.
2024-02-15 16:39:58 +00:00
Avi Halachmi (:avih) d70c77b6b6 js: complex key-binding: send also key_text
This is doumented and has been part of the table in lua, but until
now not in the JS object.

Fixes #13448
2024-02-09 16:54:57 +02:00
Guido Cella 36153d1a4a console.lua: move functions to strip common characters
Move common_prefix_length() and related functions before the first call
to common_prefix_length(). It works now because it's global but if we
ever make all functions local for consistency it will stop working.
2024-02-08 18:18:33 +01:00
Dudemanguy fd2c5ee21d stats.lua: use deinterlace-active property instead
But still read the deinterlacing option to distinguish between yes and
auto.
2024-02-07 14:50:09 +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
Kacper Michajłow dd491c7c61 vo: change vo_frame duration to double
32-bit signed integer can hold ~2.1s stored as nanoseconds. While frame
duration doesn't make sense to be this long, the existing clamp is to
10s. Change type to double, which is consistent with other fields in
vo_frame.
2024-01-27 05:12:36 +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 62a0292dc1 player/video: force vo reconfigure on color parameters change
This workarounds the issue with vo_gpu that would freeze in certain
condition. I haven't go deep inside to understand why, so this should be
considered as a workaround.

Fixes: #13256
2024-01-22 15:23:24 +00:00
Kacper Michajłow 47be5ad4aa csputils: replace mp_chroma_location with pl_chroma_location 2024-01-22 14:54:55 +00:00
Kacper Michajłow 0ac7a40dac csputils: replace mp_alpha_type with pl_alpha_mode 2024-01-22 14:54:55 +00:00
Kacper Michajłow 66e451f4e6 csputils: replace mp_colorspace with pl_color_space 2024-01-22 14:54:55 +00:00
jmir1 9dd1a13747 command: do a normal seek instead of a refresh seek when switching vo 2024-01-22 14:54:29 +00:00
Dudemanguy 6ae5ff26b0 osc: add osc-windowcontrols_title option
This allows the title shown with the windowcontrols to be controlled
separately from the normal osc title. Fixes #13295.
2024-01-22 14:41:36 +00:00
llyyr b0e6ac380f Revert "player/video: loosen logic checks for adjust_sync"
This reverts commit cb2b579f61.

This breaks files where the audio starts much later after the video
since mpv reads the first audio packet even if it isn't supposed to
start yet, resulting in the audio_status being STATUS_READY for the
entire time mpv is "waiting" for the first audio packet to be played.
2024-01-21 18:59:04 +00:00
Dudemanguy a39f9b6181 player: remove --term-remaining-playtime option
This wasn't useful and didn't even really do what it said anyway.
Closes #12167.
2024-01-20 23:24:48 +00:00
Guido Cella 5871ba8f3e command: restore lang after track reload
If a track's language was guessed from its filename, the commands that
reload the track, like sub-reload, remove it. Fix this by calling
guess_lang_from_filename() again.

Note that backing up t->lang and restoring it if nt->lang is NULL would
work incorrectly when lang is in the stream and it is removed before
reloading.
2024-01-20 17:26:45 +00:00
nanahi 02c6165d2b command: minor m_property_strdup_ro style changes 2024-01-20 17:12:07 +00:00
nanahi 2cb1485492 stats.lua: display the current GPU context
This displays the current GPU context when --vo=gpu or --vo=gpu-next
is used, which shows the platform and backend information of the vo
which are previously not available.
2024-01-20 17:12:07 +00:00
nanahi a0ba10b62e command: export current-gpu-context property
This exports `current-gpu-context` property, which is the string
description of the current active GPU context. This allows scripts to
uniquely identify the platform and backend used for --vo=gpu
and --vo=gpu-next.
2024-01-20 17:12:07 +00:00