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

50930 Commits

Author SHA1 Message Date
Dudemanguy
ba4b408b8b osdep: rename polldev to poll_wrapper
Originally, this was added as purely a shim for macOS. However since we
want to do high resolution polling which is not neccesarily available on
all platforms, making this a generic wrapper for poll functions is
useful so rename it.
2023-10-10 19:10:55 +00:00
Dudemanguy
a899e14bcc vo: change vo->driver->wait_events to nanoseconds
In many cases, this is purely cosmetic because poll still only accepts
microseconds. There's still a gain here however since
pthread_cond_timedwait can take a realtime ts now.

Additionally, 37d6604d70 changed the value
added to timeout_ms in X11 and Wayland to ensure that it would never be
0 and rounded up. This was both incomplete, several other parts of the
player have this same problem like drm, and not really needed. Instead
the MPCLAMP is just adjusted to have a min of 1.
2023-10-10 19:10:55 +00:00
Dudemanguy
c82c55b4b9 vo: use nanoseconds for frame duration and pts 2023-10-10 19:10:55 +00:00
Dudemanguy
8fccd6bf91 player: store last_time timestamp in nanoseconds 2023-10-10 19:10:55 +00:00
Dudemanguy
ae335ef155 vo: remove vo_get_estimated_vsync_interval conversion to seconds
This is weird. The caller should be responsible for converting the value
if desired. Move the conversion to player/command.c instead.
2023-10-10 19:10:55 +00:00
Guido Cella
2016e902e1 DOCS/lua: update read_options example
This still shows the old way of calling read_options even though it was
deprecated 8 years in ago 327b091909.
2023-10-10 18:38:15 +00:00
Guido Cella
cf762c1482 console.lua: exit with with Ctrl+[
This binding commonly closes similar input buffers like vim's
Command-line mode and dmenu.
2023-10-10 18:18:07 +00:00
Guido Cella
81dea9031d command: add playlist-next-playlist and playlist-prev-playlist
playlist-prev-playlist goes to the beginning of the previous playlist
because this seems more useful and symmetrical to
playlist-next-playlist. It does not go to the beginning when the current
playlist-path starts with the previous playlist-path, e.g. with mpv
--loop-playlist foo/, which expands to foo/{1..9}.zip, the current
playlist path foo/1.zip beings with the playlist-path foo/ of {2..9}.zip
and thus playlist-prev-playlist goes to 9.zip rather than to 2.zip.

Closes #12495.
2023-10-09 15:09:35 +00:00
Kacper Michajłow
bcb9ed56fa ci: add sanitizers to Tumbleweed build
We don't have much test coverage, but even running the built binary
doesn't harm to check with sanitizers.
2023-10-08 19:23:16 +00:00
Dudemanguy
e17375f151 core: remove duplicate init_{audio,video}_decoder declarations 2023-10-08 09:57:41 -05:00
lcksk
89261178d7 core: remove declarations of unused functions 2023-10-08 14:56:51 +00:00
Kacper Michajłow
78719c14ca TOOLS/autocrop.lua: add support for detect_min_ratio
This was lost in 6b963857c0
2023-10-07 22:47:43 +00:00
Guido Cella
76de65f116 DOCS/input: document the full sub-property 2023-10-07 22:46:16 +00:00
Christoph Heinrich
e475e1abc0 console: support utf8 for table formatting 2023-10-07 22:45:50 +00:00
Christoph Heinrich
d2c92f7653 console: cull lines outside of visible area
Lines that would be outside of the visible area are now culled.
The log messages were already culled, however with the introduction
of suggestions, they also needed a small update.
2023-10-07 22:45:50 +00:00
Christoph Heinrich
ed8a919812 console: show completion suggestions as table
Completion suggestions are now nicely formatted into a table.
Maximum width of the table is estimated based on OSD size and
font size.
This requires a new scaling factor option `font_hw_ratio`.
A factor of 2.15 works great for me,
but the default is 2.0 to avoid problems with other fonts.
The space between columns is automatically adjusted to be
between 2 and 8 spaces.
It tries to use as few rows as possible.
2023-10-07 22:45:50 +00:00
Christoph Heinrich
659353b7d6 console: show suggestions for completion
Tab completion now shows a list of all potential completions
between the log messages and prompt.
The text is colored to differentiate it from regular text.
The color matches the theme and is similar to the mpv logo.
2023-10-07 22:45:50 +00:00
Christoph Heinrich
898a4cd8a8 console: refactor text styles for log levels
The text styles are now in a table.
The color definitions of the theme where the colors were taken from
are now included in a comment for future reference.
The colors have been converted to BGR as is required by ASS.
2023-10-07 22:45:50 +00:00
Guido Cella
a08b75da2b TOOLS/autocrop.lua: simplify code
Refactor code that is no longer necessary after replacing vf=crop with
video-crop. There is no change in behavior.
2023-10-07 22:45:38 +00:00
Kacper Michajłow
bc81b3d19e player/video: mention --profile=fast and --hwdec in AV desync message 2023-10-07 23:06:16 +02:00
Kacper Michajłow
ef11d31c3a vo: remove frame timing check from vo_still_displaying()
This timing dependency does not guarantee that we will wake up in the
future, depending on processing times.
2023-10-07 17:50:50 +00:00
Kacper Michajłow
44c398c3e1 Revert "video: remove another redundant wakeup"
vo_still_displaying() is racey with vo_request_wakeup_on_done() and above
that it doesn't work as expected. VO can run out of work and go to sleep
for 1000s, while the play thread still returns on vo_still_displaying()
check, because of a check `now < frame_end` so it never advances and go
to sleep itself.

This fixes dead lock that we have when image parameters changes during
playback.

This reverts commit 0c9ac5835b.

Fixes: #12575
2023-10-07 17:50:50 +00:00
Kacper Michajłow
9d8dfc7b49 ci/mingw: use vulkan-loader v1.3.266
Upstream has been changing buildsystem and current vulkan.pc is not
functional with custom prefix path.

Rollback to older version until it is fixed.

See:
https://github.com/KhronosGroup/Vulkan-Loader/issues/1318
https://github.com/KhronosGroup/Vulkan-Loader/issues/1319
2023-10-07 17:47:57 +00:00
Kacper Michajłow
71ce0cb71f mp_image: don't copy crop value from opaque_ref
It is already set above.

Fixes: #12577, #12587
2023-10-07 14:36:06 +00:00
Dudemanguy
acac614032 demux_playlist: use --metacode-codepage when parsing playlist files
It's 2023 and people don't use UTF-8 for their m3u, ini, etc. files.
Well mpv already has the tools in place to try and guess other
codepages, so we might as well use it I guess. This change is pretty
awkward since we have to read line-by-line but mp_iconv_to_utf8 may
sometimes allocate memory. So sometimes the bstr needs to be freed and
sometimes not for every line. Also we need to make another copy of the
line on the stack since splitting by tokens and such will mess up the
original line which may possibly be allocated memory. The ugliness is
mostly hidden in pl_free_line, but it's still weird. Fixes #10911.
2023-10-07 02:41:27 +00:00
Dudemanguy
da4f11803f demux: change the default of metadata-codepage to auto
There's really no reason not to do this especially since sub-codepage
already defaults to auto. Also change logging in charset_conv since
telling us that the data is UTF-8 if the passed codepage value is "auto"
or "utf-8" is really not useful information (that's the expectation).
2023-10-07 02:41:27 +00:00
Dudemanguy
50b23a8c44 demux_cue: deprecate --demuxer-cue-codepage for --metadata-codepage
What are cue sheets not metadata or something? No reason this needs to
be a separate option so just deprecate it. This does mean that the
default value changes from "auto" to "utf-8" for this obscure fringe
case. I really hope people don't use non-UTF-8 cuesheets, but the next
commit will change the default of --metadata-codepage to "auto" so
there's no actual change in behavior to users.
2023-10-07 02:41:27 +00:00
Dudemanguy
a96dd2f5e7 charset_conv: remove ancient warning about deprecated syntax
wm4 removed this in 4adfde5dd1 and left a
warning. Nobody needs to know that enca:pl used to work.
2023-10-07 02:41:27 +00:00
Dudemanguy
e22efe2d22 stream_lavf: use metadata-codepage option for codepage conversion
a343666ab5 made demux options public, so
we can take advantage of that here as well. This lets users guess the
codepage if the stream doesn't use UTF-8 characters. Fixes #8844.
2023-10-07 02:41:27 +00:00
Christoph Heinrich
ef4a510128 af_scaletempo: overlap is a factor not a percentage 2023-10-07 00:30:29 +00:00
Guido Cella
7798881360 DOCS/mpv: update mpv.conf's documentation 2023-10-06 18:28:55 +00:00
Guido Cella
eecba5131a TOOLS/autocrop.lua: update comment 2023-10-06 15:08:19 +00:00
Guido Cella
185fa9ffc6 sd_ass: enable sub-start and sub-end with unknown duration subs
The function called to get sub-start and sub-end returns early when the
subtitle's duration is unknown, but by just removing this check the
properties work fine. The final sub line has a very large sub-end, but
that is much better than not having the properties work at all.
2023-10-06 16:35:55 +02:00
Dudemanguy
07995f5d5f vo_gpu_next: improve updating overlays
fbe154831a added a new VOCTRL to signal
when the OSD changed for gpu-next's handling of subtitles, but this is
both not necessary and actually incomplete. The VOCTRL would signal OSD
changes, but not all subtitle changes (like selecting another
non-external sub track for example). VOCTRL_OSD_CHANGED was used to
increment p->osd_sync which would then redraw the blended subtitles if
the player was paused.

But there's already a VOCTRL_PAUSE and VOCTRL_RESUME. Plus, the
sub_bitmap_list object will have items in it if it changed in any way,
so we don't need the VOCTRL_OSD_CHANGED method at all. That can be
removed.

The check that fp->osd_sync < p->osd_sync stays in place since that's an
optimization while the video is playing, but we also check the pause
state as well since the VO can know this. If we're paused, then always
do update_overlays since core must be signalling a redraw to us if we
get a draw_frame call here. Additionally in update_overlays itself, the
p->osd_sync counter is incremented if we have any items since the frame
signature will need that. As for the actual bug that is fixed, changing
subtitle tracks while paused with blended subtitles now correctly works.
Previously, it was never updated so the old subtitle stayed there
forever until you deselected it (since VOCTRL_OSD_CHANGED triggered
there).

Also include some cosmetic code fixes that were noticed.
2023-10-05 22:32:06 +00:00
Dudemanguy
61aecfabfd vo_dmabuf_wayland: correct full window size calculation
The current calculation makes the implicit assumption that the margins
on both sides are always equal (the 2 times multiplication). This isn't
true though. For example, a 720p video fullscreened on a 1680x1050
display will have a top margin of 52 but a bottom margin of 53. The
current calculation just multiplies 52 by 2, so it's off by one. Fix
this by adding together all the margins together (left + right or top +
bottom) then adding that to the dst window size (width or height). This
way, we get the full size of the window for the viewport. Fixes #12554.
2023-10-05 22:28:37 +00:00
Kacper Michajłow
d17db1367a win32: clear client area to black early
This fixes white background appearing for short period of time before
first frame is drawn. Clear to black as this is way less distracting
than bright white flash.

Borderless window and fullscreen seems to be initially not
drawn/transparent, so no need to clear it to black. Only when
decorations are enabled (--border) the issue happens.

Fixes: #12549
2023-10-05 17:10:23 +02:00
Dudemanguy
817c6f9cb7 player: remove unused mutate argument in mp_next_file
e277fadd60 originally added this but it
never actually did anything in the function... wm4 probably changed his
mind but forget to delete it so just remove it here.
2023-10-05 17:09:43 +02:00
Dudemanguy
034f75dacd loadfile: fix an old wonky playlist heuristic
2c6a3cb1f2 originally added this struct
member and then 1be863afdb later added
some more logic to loadfile that uses this. There's been more changes
since then of course, but bits using playback_short and playback_start
have mostly stayed the same. It's a bit strange it's worked this way for
so long since it makes an assumption on how long files should be and
leads to weird, broken behavior on playlists with shorter videos. The
main reason for playlist_short, as far as I can tell, is to deal with
some fringe cases with short videos and trying to go back in the
playlist. More specifically, if you use --loop=inf on a very short video
(say less than 1 second) and try to go back in the playlist, you won't
be able to without any of this special logic that deals with it. But the
current approach has several side effects like going back multiple items
in the playlist instead of just one if the video is less than one
second. This is just bad so delete everything related to playlist_short
and playlist_start.

Instead, let's handle this by keeping track of playlist-prev attempts.
Going forward in the playlist doesn't require any special handling since
a bad/broken file will just advance to the next one. So it's only going
backwards that requires some special consideration. If we're going
backwards and the user isn't using force, then mark the playlist entry
with a special flag. If the file loads successfully in
play_current_file, we can just clear the flag and not worry about it.
However if there's a failure, then we set a bool telling
play_current_file that it should go back one more item in the playlist
if possible and try again. This way, we avoid the previously mentioned
--loop=inf edgecase and the user can still attempt to retry previously
failed items in the playlist (like a url or such).

Fixes #6576, fixes #12548.
2023-10-05 17:09:43 +02:00
Ashyni
d32f1aac3f af/vf-command: add ability to target a specific lavfi filter
fixes: #11180
2023-10-05 11:41:09 +02:00
Dudemanguy
8641cbaab6 vo_dmabuf_wayland: free frame if the visibility check fails
Forgotten in 7b8a30fc81. Every other case
either is either a dummy frame (no allocated memory) or we manage it as
part of the usual wayland buffer release.
2023-10-04 16:21:47 -05:00
Guido Cella
ec80981c79 external_files: remove duplicate from cover art whitelist
I made a mistake in 0070a5820e here because there were 2 separate groups
of "front" filenames.
2023-10-04 15:31:38 +00:00
Dudemanguy
7b8a30fc81 vo_dmabuf_wayland: eliminate an extra frame copy
When implementing vo_dmabuf_wayland, it always did a copy of the image
from the current frame and worked with that. The reason was because
mpv's core held onto the frame and caused some timing issues and
rendering glitches depending on when it freed the image. This is pretty
easy to fix: just make vo_dmabuf_wayland manage the the frames. In vo.h,
we add a boolean that a VO can set to make them manage freeing frames
directly. After doing this, change the buffers in vo_dmabuf_wayland to
store the whole vo_frame instead of just the image. Then, just modify
some things a bit so frame is freed instead of the image. Now, we should
truly have zero-copy playback. Well as long as you don't use libass to
render anything (that's still a copy from system memory).
2023-10-03 23:45:20 +00:00
Dudemanguy
d147a06e60 TOOLS/lua/autoload: bump the msg-level of some logging
msg.info for when you're potentially adding hundreds of files is way
too spammy and not really useful (autoload loads files, what?). Bump it
up to msg.verbose. Also bump up the previously existing msg.verbose logs
up to msg.debug to keep the difference in log levels. Fixes #12551.
2023-10-03 23:39:42 +00:00
Dudemanguy
ace4d252e5 meson: declare libmpv as a dependency and override it
This allows libmpv users to build it as a subproject easily, i.e. meson
setup build --force-fallback-for=mpv -Dmpv:libmpv=true, if the mpv
source is in the subprojects directory. Mainly useful for development.
2023-10-03 15:46:14 +00:00
Kacper Michajłow
01c5346d1a win32: adjust WM_NCACTIVATE for better compatibility with window state
We have to support all changing states, not only borderless.
2023-10-02 21:51:47 +00:00
Dudemanguy
47dec1c7c2 vo_dmabuf_wayland: attach solid buffer when using force window
e125da2096 changed the z order of the
surfaces a bit, but it turns out this has a side effect. If the aspect
ratio of the actual video doesn't match your display, the osd surface
doesn't scale properly and gets clipped. Put the z ordering back where
it used to be. Instead when we have the force window case, simply attach
the already existing solid buffer to the video surface. This allows the
osd surface to actually draw over it instead of always being obscured so
it satisfies the case of not having any real video frames but still
wanting to draw the osd. Also don't mess with any of the viewport source
setting stuff with force window. Weston complains about it, and it's
nonsensical anyway. Fixes #12547.
2023-10-02 15:58:03 -05:00
Dudemanguy
05d79298b8 codec_tags: map some more image mimetypes
This only had jpeg and png in it strangely enough. Fixes #11592.
2023-10-02 17:49:48 +00:00
sfan5
df758880e2 path: don't override "cache" and "state" paths with configdir
This reverts commit 576e86bfa1 (functionally).

Right now, the --config-dir option silently causes all watch_later and cache
files to be written in the --config-dir as well. This is pretty uninitutive
and also not desirable in most cases so get rid of this.
libmpv users will have to set the corresponding options or env vars if they
want to keep the old behaviour.
2023-10-02 18:48:10 +02:00
Dudemanguy
0a1e3d8685 demux: move parent_stream_info before the goto
Previously if the demuxer didn't exist, then it could jump down and try
to free sinfo.filename before it was ever set thus segfaulting. Just
always set the struct unconditionally so we're always sure to free it.
2023-10-01 16:11:53 -05:00
Dudemanguy
d50de74c1e Revert "demux: constify a struct member"
Some demuxers actually close the stream right after they are finished
opening like cue. Since the stream->url is no longer copied with this
commit, that means it gets thrown away after the stream closes. This
leads to a use after free. We still need to allocate stream->url so fix
this another way.

This reverts commit 3e85df3b2d.
2023-10-01 16:11:06 -05:00