1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-15 19:47:32 +00:00
Commit Graph

3535 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
sfan5
54c755b08d various: add missing checks for directory streams
All of this code opens a stream and expects to read stuff from a file.
But streams can also be directories and that has to be handled.
2024-05-15 22:45:18 +02:00
sfan5
b69b58a12a {options,player}: fix stream leaks 2024-05-15 22:45:18 +02:00
Guido Cella
4d32db21c5 select.lua: strip brackets in select-subtitle-line 2024-05-13 16:36:27 +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
Guido Cella
367a6b561a console.lua: close when pressing enter with input.select
When you select an item, due to the submit handler being called
asynchronously, the default item list is redrawn before the console
closes, which is jarring. Fix this by always closing the console as soon
as enter is pressed, as keeping it open is unlikely to be useful with a
fuzzy selector (unlike with input.get() where it can be used e.g. to
implement a Lua REPL). If desired we can later add a close_on_submit
flag defaulting to true.

Also fix a crash when pressing enter without any match.
2024-05-12 23:13:48 +02:00
Guido Cella
30fd3c1a96 console.lua: fix ctrl+f and ctrl+b keybindings
With mp.input.select() these keybindings were both scrolling and moving
the cursor because of how the condition was written and
handle_pgup()/handle_pgdown() not returning a truthy value.
2024-05-12 23:13:48 +02:00
Guido Cella
1ebe11d06f console.lua: don't crash when scrolling without matches
selected_match can become 0 when pressing certain scrolling
keybindings without any match, and

for i = first_match_to_print, last_match_to_print do

in populate_log_with_matches() runs from 0 to 0 and accessing
matches[0].text crashes console.lua. Return early when it is 0.
2024-05-12 23:13:48 +02:00
Guido Cella
9d75289ced console.lua: truncate lines longer than the maximum width
Avoid messing up the max_log_lines calculation when mp.input.select() is
called with very long items.

This doesn't work with Japanese characters because they are bigger.
2024-05-12 23:13:48 +02:00
Guido Cella
eb4c6be630 console.lua: don't convert integers for mp.input to string
I misunderstood CogentRedTester's review in
https://github.com/mpv-player/mpv/pull/10282#discussion_r1428972352 as
referring to the cursor_position in mp.input's arguments instead of the
one received by the closed callback.

The cursor_position passed to input.get doesn't need to be converted to
a number because it was already JSON, while the cursor_position received
by the closed callback is currently a string, and we need to pass JSON
in input-event script messages to keep it as an integer to work around
mpv converting integer script message arguments to string.

This is more noticeable after implementing mp.input.select(): its submit
argument currently receives the selected index as a string, and this
makes Lua error if you use it as an index of a numerical table, e.g.:

submit = function (id)
    mp.set_property(property, tracks[tonumber(id)].selected and "no"
                              or tracks[tonumber(id)].id)
    ...
end,

This commit avoids having to call tonumber(id).
2024-05-12 23:13:48 +02:00
Guido Cella
e6af31dc0c console.lua: implement a command parser to complete more things
This allows more completions than patterns:

Both single and double quotes are recognized.
Quotes around the first token are recognized.
Command prefixes are recognized.
Choice options are completed after change-list/vf/af add/append/pre/set.
File paths are completed after set/cycle-values/change-list with options
that expect files, including cycling between paths with spaces, e.g.
cycle-values glsl-shaders 'foo bar' 'baz qux'.
File paths are completed in the fourth argument of dump-cache.
Items that have been set are completed after change-list remove.
2024-05-12 22:29:40 +02: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
Guido Cella
4e5845ad03 osc.lua: remove scaleforcedwindow
This is unused since 4e013afd37 because the mpv logo and the "Drop files
or URLs to play here." message are shown instead of the OSC controls. It
has the adverse affect of making the OSC twice as big when playing
videos with --lavfi-complex, because that makes the video property which
osc.lua checks unavailable.
2024-05-12 21:00:38 +02:00
Kacper Michajłow
e5e17c80ba ytdl_hook.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow
f348a8b303 stats.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow
8fa0e09b27 osc.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow
e17546333a options.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow
fe488151dc defaults.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow
5e77d3b640 console.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow
1831c548db auto_profiles.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow
552c4552a2 audio: report EOF also for untimed AO mode 2024-05-10 23:56:56 +02:00
Guido Cella
aa067f5984 console.lua: increase margins from the bottom-left corner
console.lua is too close to the left and bottom of the OSD IMO. Make the
margins a bit bigger.
2024-05-10 22:57:44 +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
Guido Cella
dffc37dcfa external_files: detect language tags with hyphens
This loads subtitle files like foo.en-US.srt with --sub-auto=exact.

To preserve the case of these locales and not convert them to e.g.
en-us, stop lower casing filenames, and instead use case insensitive
functions to check if the media filename is contained in the external
filenames. Extensions, whitelisted cover art filenames and idx files
were already being compared case insensitively.

Fixes #12372, fixes #13251.
2024-05-10 01:22:31 +02:00
Guido Cella
e451d9c21b external_files: rename variables in guess_lang_from_filename() 2024-05-10 01:22:31 +02:00
Kacper Michajłow
5009e13431 player/loadfile: match language and subcodes 2024-05-09 17:12:55 +02:00
Kacper Michajłow
65c71b1643 Revert "loadfile: use mp_match_lang_single"
This reverts commit 76009bf7a6.
2024-05-09 17:12:55 +02:00
Kacper Michajłow
b7216d5d03 Revert "loadfile: compute audio lang for sub selection when using lavfi-complex"
This reverts commit 9e6c6c0897.
2024-05-09 17:12:55 +02:00
Kacper Michajłow
111d90d9e5 player/client: fix typo in description of MPV_ERROR_UNINITIALIZED 2024-05-08 18:52:40 +02:00
Guido Cella
ae7e7d07b8 js: fix defaults.js
Fixes 2354d876da.
2024-05-07 22:57:53 +02:00
Guido Cella
2354d876da scripting: add mp.input.select()
This allows scripts to make the user choose from a list of entries by
typing part of their text and/or by navigating them with keybindings,
like dmenu or fzf.

Closes #13964.
2024-05-07 22:34:22 +02:00
nanahi
9f5edd4eed various: fix indentation 2024-05-07 11:23:08 +02:00
Kacper Michajłow
414c47d1d8 player/main: select msg output stream early
This avoids printing any stray messages in encode output stream.

--o is already pre-parse cli option which is designed to be parsed
before anything else is printed to output. So we can use that to force
stderr output if needed for encode mode.
2024-05-06 22:21:46 +02:00
Kacper Michajłow
3ffb5c90ee player/configfiles: fix utime.h include for Windows SDK 2024-05-06 22:01:17 +02:00
Kacper Michajłow
86abbb89a7 win32: fix platform checks 2024-05-06 22:01:17 +02:00
Kacper Michajłow
b647201795 osdep/dirent: add implementation for Windows SDK build 2024-05-06 22:01:17 +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
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
1d640c9887 player: normalize paths for resuming playback
Paths like foo.mkv, ./foo.mkv .//foo.mkv, ../"$(basename
"$PWD")"/foo.mkv, and C:\foo.mkv and C:/foo.mkv on Windows, use
different config files for resuming playback, so if you quit-watch-later
and later play the same file with a different path, mpv does not resume
playback. This commit normalizes the paths on Unix to fix this.
2024-05-05 19:37:57 +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
Kacper Michajłow
eab9737ea6 osc: remove trailing space
Fixes: b80e4e46a3
2024-05-05 14:38:18 +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
Matthias Hunstock
2414051d76 osd: show left arrow when playing backwards
If playback direction is backwards, display a triangle
pointing to the left as status symbol of OSD.
2024-05-05 13:47:20 +02:00
Matthias Hunstock
b80e4e46a3 osc: show left arrow when paused while playing backwards
Use existing glyph for playlist buttons to show a triangle
pointing left if playback is stopped with a backward playback
direction.
2024-05-05 13:47:20 +02:00
omar
a26bbbd78d OSC: implemented user configurable colors 2024-05-03 16:50:49 +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