0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00
Commit Graph

3653 Commits

Author SHA1 Message Date
Kacper Michajłow
ff1f8baecd common/playlist: add playlist_set_current() 2024-08-10 23:27:40 +02:00
Kacper Michajłow
73b58722e7 player/misc: add str_in_list() and use it 2024-08-10 23:27:40 +02:00
Kacper Michajłow
44a3a3293f options: add --{video,audio,image}-exts 2024-08-10 23:27:40 +02:00
Kacper Michajłow
4f1e9e34c3 demux_playlist: add --directory-filter-types 2024-08-10 23:27:40 +02:00
Kacper Michajłow
c54ad6933b demux_playlist: add --autocreate-playlist-{video,audio,image}-exts 2024-08-10 23:27:40 +02:00
Kacper Michajłow
bb9b862f0c demux: add --autocreate-playlist 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
nanahi
0818f6001c console.lua: guard user-data/osc/margins value
Defaults margins to 0 if an external script sets this to an invalid value.
2024-08-06 20:28:44 +02:00
Guido Cella
ee05804bfa {osc,select}.lua: show playlist entries with trailing /
If a playlist entry ends with a slash these scripts only show the
basename which is empty. Fix this by stripping trailing slashes so that
the last directory component becomes the basename.
2024-08-06 20:27:33 +02:00
Kacper Michajłow
ec40dcca9b loadfile: fix relative file open exclusion for fuzzing 2024-08-04 21:33:36 +02:00
Guido Cella
5f768a688b loadfile,select.lua: print only one bitrate
Print demux-bitrate if available, else hls-bitrate, not both (as
demux-bitrate is generally more reliable). This avoids printing "HLS
kbps" which looks weird.

Fixes
https://github.com/mpv-player/mpv/pull/14453#discussion_r1700550385
2024-08-02 08:41:43 +02:00
llyyr
11ed012c34 player/audio: invert audio_started boolean
Waiting for audio_started to be set to true takes too long which causes
us to miss it for the first frame, instead invert the condition so it's
set on the first frame.

Fixes #14615
2024-08-01 11:45:13 +00: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
fc6aa2cc8a player/scripting: remove outdated comment about posix_spawn
The comment was added in e2ab6b7f35,
but posix_spawn usage was removed in 5309497727
to ensure CLOEXEC correctness.
2024-07-29 21:00:48 +02:00
Guido Cella
544240c829 player/command: fix --force-window=yes acting like immediate
player/main.c runs all option callbacks with a flag on init, so since
a5937ac7e3 which added UPDATE_VO, if --force-window=yes is passed, the
VO is immediately initialized, as if --force-window=immediate was
passed. Fix this by not running the UPDATE_VO code when there is no
video output.
2024-07-29 01:46:21 +00:00
Guido Cella
6107112b32 player: don't decrement --ab-loop-count=N and add remaining-ab-loops
Follow up to the previous commit. Stop decreasing --ab-loop-count=N on
each iteration so it is preserved across different loops. In particular
it is preserved between different files without adding it to
--reset-on-next-file. Add a property to expose the remaning A-B loop
count instead.

The current behavior of --ab-loop-count=N is even worse than --loop-file
since it also doesn't reset when defining a new A-B loop in the same
file. Defining it has no effect after --ab-loop-count has decreased to
0, and this can't be fixed by adding it to --reset-on-next-file. This
commit also resets remaining-ab-loops every time --ab-loop-a and
--ab-loop-b are set to fix this.
2024-07-26 20:09:19 +02:00
Guido Cella
f411f3145b player: don't decrement --loop-file=N and add remaining-file-loops
This stops decreasing numerical values of --loop-file on each iteration
so that loop-file=N loops every playlist entry without having to add
--loop-file to --reset-on-next-file.

The current behavior confuses users as seen in:

https://github.com/mpv-player/mpv/issues/2481
https://github.com/mpv-player/mpv/issues/5943
https://github.com/mpv-player/mpv/issues/11291
https://github.com/mpv-player/mpv/issues/13860
https://www.reddit.com/r/mpv/comments/rcwnrw/looping_each_file_n_times_in_a_playlist/

Also options are supposed to reflect the value configured by the user
and not change on their own.

A remaining-file-loops property is exposed as a replacement to check how
many loops are left.
2024-07-26 20:09:19 +02:00
Kacper Michajłow
397212ae15 player: remove empty line from --help
Follow-up after 127b6a3455.
2024-07-26 20:07:30 +02: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
Guido Cella
8110bdac6d command: remove deprecated packet-*-bitrate properties
These have been deprecated for 9 years so it's fine to remove them.

Using the replacement properties like video-bitrate in stats.lua will
convert big enough bitrates to Mbps.
2024-07-18 22:52:35 +02:00
Guido Cella
5f8ac5b862 loadfile,select.lua: print bitrates of tracks 2024-07-18 22:52:35 +02:00
Guido Cella
7bcd525dce various: sync shown track flags
Show the same flags in loadfile.c, select.lua and stats.lua. The only
differences are that only stats.lua prints both image and albumart
because it's supposed to show detailed track information, and select.lua
prints the image flag because pressing g-v doesn't show Video or Image
like in loadfile.c and stats.lua.
2024-07-18 22:52:35 +02:00
Guido Cella
2fd88ffbae various: print Image instead or Video for image tracks
Fixes #8561.
2024-07-18 22:52:35 +02:00
nanahi
21df853624 osc.lua: don't hide osc when touch is active
This lets touch events activate a separate timeout for osc hiding so that
the osc only hides when both mouse and touch timeout are expired.
This is the general expectation with touchscreen UI, and also fixes
platforms which reset the mouse position when all fingers leave the
touchscreen (e.g. sway).
2024-07-18 22:49:51 +02:00
llyyr
127b6a3455 player: remove empty line from --version 2024-07-18 22:49:28 +02:00
nanahi
58f3009b80 playloop: move run_command_opts to command_event for playback-restart 2024-07-17 18:28:56 +00:00
nanahi
503a896d1a command: run input commands after idle state is ready
This makes sure that commands like show-text update the osd properly
with --idle=yes.
2024-07-17 18:28:56 +00:00
Kacper Michajłow
607ad8943b player/command: don't return ill-formed node if there is no default val
option-info/<name>/default-value would be initialized with zeroed
object, which is not valid for string typed options, as the would be set
to NULL.

Found by OSS-Fuzz.
2024-07-16 22:59:23 +02:00
Kacper Michajłow
0018227b44 player/command: fix M_PROPERTY_KEY_ACTION for filter metadata
tag_property() expect metadata to not be NULL on M_PROPERTY_KEY_ACTION.
M_PROPERTY_GET_TYPE can be skipped only if key is not queried.

Fixes: a05b847879
2024-07-14 01:17:32 +02:00
Kacper Michajłow
0aebcbcc19 player/{command,scripting}: log subprocess execution
Useful for debugging purposes and sanity checks.

Remove unused function while at it.
2024-07-12 22:40:02 +02:00
Misaki Kasumi
f2e7146cb1 sub: add (sub/osd)-border-style; renaming sub options 2024-07-12 20:17:38 +00:00
Kacper Michajłow
c0f5d2391b ytdl_hook.lua: fix hook triggering while it shouldn't
Fixes: acbd537dac
Fixes: #14522
2024-07-12 11:11:54 +02:00
Kacper Michajłow
c505f77dda player/core: add core thread handle to MPContext
This change removes convoluted core thread extraction through dispatch
added in 500ce69a06.

Currently we fully control this thread, create it and join, there is no
reason not to keep the handle of it in the player context.

As a bonus to code simplification this also fixes thread handle leak on
Windows.

Fixes: #14472
2024-07-11 21:55:21 +02:00
Kacper Michajłow
b13642e115 player/loadfile: prevent fuzzers from loading absolute directories
It's waste of time to load external files. And it is not deterministic.

Note we still allow to load single files by name, but it is not a big
deal.
2024-07-11 03:48:25 +02:00
Kacper Michajłow
aea5b3dbea player/loadfile: cancel playback cleanly if thread fails to start
Currently it would crash, due to already canceled and freed resources.
2024-07-11 03:48:25 +02:00
Kacper Michajłow
acbd537dac ytdl_hook.lua: allow changing try_ytdl_first during runtime
Check value in hook instead of hooking conditionally.
2024-07-07 02:32:48 +02:00
verygoodlee
bcc72f97ef stats.lua: active key bindings: identify prefix nonrepeatable
The nonrepeatable prefix was added at commit bc5863a
2024-07-05 16:42:31 +03:00
Guido Cella
e07470adc2 console.lua: restore the order of items after clearing the input line
When you type something in select mode and then delete it, table.sort
changes how selectable items are sorted. Restore the order specified by
the mp.input caller in this case.
2024-07-04 22:24:10 +00:00
Guido Cella
97af5c98f4 console.lua: minor tweaks
- Remove the opts comments because they are already in console.rst and
  will become outdated if not updated in both places
- Reuse last_pos in truncate_utf8() instead of recalculating the
  previous character's position
- Clear the OSD earlier when the console is not active
2024-07-04 22:24:10 +00:00
Guido Cella
49afdb9365 console.lua: remove the scale script-opt
This is redundant because you can set font_size and border_size to have
the same effect.
2024-07-04 22:24:10 +00:00
nanahi
b09e48e388 player/loadfile: enable streams in order of types when loading file
The previous commit to avoid refresh seeking video streams has an edge
case when enabling tracks when loading files. Since the streams are
initially unselected and then multiple streams are enabled, the detection
only works reliably when video tracks are enabled first.

This makes sure that loading file enables tracks in a predictable order.
2024-07-04 22:23:27 +00:00
Guido Cella
dc523b137f video/out/gpu/context: convert --gpu-api to object settings list
This follows up 96e1f1dfa5 which converted --gpu-context, and has the
same advantages as listed there.

Unlike with --gpu-context auto can be used anywhere in the list, e.g.
--gpu-api=d3d11,auto works.

I wanted to use the list of GPU contexts as the description in
get_type_desc(), but there is no talloc context to allocate it to, so I
set a print_help_list to print them. The APIs go before the contexts so
that etc/_mpv.zsh doesn't try to complete the contexts.
2024-07-04 22:23:17 +00:00
bashonly
e78e2c73cf ytdl_hook: strip quotes from cookie values 2024-07-04 19:10:37 +00:00
Kacper Michajłow
4969d6e03e player/lua: restore original lua allocator before close
We wrap the default Lua allocator to allow used memory tracking. This
works well, except that we never destroy the default allocator or notify
it that we are closing. Since we override it for the current Lua state,
it is reasonable that the Lua engine does not expect it to be used. We
get and pass through a free call, but in the case of LuaJIT, the
internal allocator has additional state and is freed differently. So, in
fact, it is a LuaJIT leak because once we replace the allocator with our
custom one, they should clean its internal state. I guess the assumption
is to override allocator only before any allocation happen. To work
around this issue, restore the default allocator, the one that we use,
before closing the state. This way, everything is cleared as expected.

Note that the current solution of wrapping the default allocator works
only because none of the supported Lua engines actually invalidate the
allocator on the lua_setallocf() call. However, they could, so keep in
mind that we are currently depending on an implementation detail.

Thanks to @Dudemanguy for help with finding the changes that introduced
the leak.

Fixes: a67bda2840
Fixes: #14451
2024-06-30 21:15:37 +02:00
Kacper Michajłow
a3f72ea87c stats.lua: fix codec-profile position for audio 2024-06-27 20:24:13 +02:00
Kacper Michajłow
7fb7e1dd73 various: add more format specifiers checks 2024-06-25 05:29:46 +02:00
Dudemanguy
0db6abadd4 playlist: let playlist-next go to first item if player is idle
Similar to the previous commit but the other way around. If you start
mpv as idle, load up a playlist without immediately hitting play and
then try to go to the next item, nothing happens. Naturally, you would
expect this to go to the first item. Fix this detecting if the playlist
has not started yet, the direction, and going to the first item in the
list.
2024-06-25 02:19:08 +00:00
Dudemanguy
0f76848e5f playlist: let playlist-prev go to last item in playlist
Previously, playlist-prev didn't work if you played a playlist to
completion using --idle and tried to go back. Naturally, one would
expect this to bring up the last item in the playlist, but nothing
happens. This is just because playlist_get_next is stupid and doesn't
take this into account since pl->current is NULL and thus returns NULL.
Fix this by considering the direction, checking if the playlist was
played to completion and grabbing the last entry in the index.
2024-06-25 02:19:08 +00:00
Guido Cella
01330dba71 console.lua: assume non-ASCII characters span 2 cells for truncation
This prevents line wraps in select mode with terminal output which hide
the top items (OSD output no longer uses truncate_utf8 since the
previous commit). This is not ideal as even accented letters are assumed
to be 2 cells wide. The alternative is using \e[?7l and \e[?7h to
disable and enable text wrapping, but it won't work in Windows console
with VT processing disabled.
2024-06-24 21:30:14 +02:00