Commit Graph

51242 Commits

Author SHA1 Message Date
Dudemanguy 0286e7f206 demux: always update the cache on init
cd59ea8afa removed an arbitrary start
offset added to the timer. However, it turns out that demux secretly
depends on this. When updating cache to actually read bytes from the
stream, there's a diff >= MP_TIME_S_TO_NS(1) check to make it only
update once every second. With the old MP_START_TIME macro, the initial
time value would always be at least 1e10, so this would also be true.
Since we don't have that offset anymore, now the initial time is less
than that so it is not updated and properties like file-size are 0. Just
be sure to always update if the last_speed_query is 0 (i.e. we just
started the player). Fixes #12869.
2023-11-12 11:47:16 +01:00
Kacper Michajłow 7cab30cec7 vo_gpu_next: fix interpolation
Fixes gpu-next completely ignoring any speed adjustment, either DS or
playback.

Frames in pl_queue have raw PTS values, so when querying them we have to
use the same time base. There was misunderstanding between mpv and
libplacebo, where the former was querying the frames based on display
vblank timeline, but this cannot work if the playback speed is adjusted
and display timeline is not aligned with video timelien. In which case
we have to schedule "video vsync" points that we want to display.

Previous code was working only when playback speed was 1.0x, but since
DS almost always changes the speed the interpolation was mostly not
timied correctly.
2023-11-11 20:44:01 +00:00
Kacper Michajłow 5e5a32534a vo: add frame vsync and vsync duration
Relative to frame PTS timeline as oposed to display vblank.

Those values are relative to unadjusted video timeline. They will be
used by gpu-next where it expect virtual frame vsync, not display vblank
time.
2023-11-11 20:44:01 +00:00
Dudemanguy 332619042f vo_gpu_next: improve PTS clamping
Originally suggested by @haasn. Instead of awkwardly using a pts from
the previous render loop, we can just peek into pl_queue and use the pts
of the first frame instead. This eliminates a lot of weird artifacts
that can happen on discontinuities like seeking. Fixes #12355.
2023-11-11 20:44:01 +00:00
Dudemanguy 9199afc405 vo_gpu_next: add some additional sanity checking for interpolation
Several related things in regards to interpolation. Essentially this
adds more general sanity checking to bring it more in line with what
vo_gpu does.

- Add a can_interpolate bool which determines whether or not this frame
  is allowed to interpolate.
- p->is_interpolated was sometimes lying and because you can have a mix
  frames greater than 1 depending on the video and settings. Make sure
  that vsync_offset is not 0 so we know if it's actually interpolated or
  not. This prevents a redundant redraw for those edge cases when
  pausing.
- When the vo wants a reset, i.e. some sort of discontinuity, don't try
  to interpolate the frame. Interpolation is only valid for
  monotonically increasing times.

This fixes #11519 because of the additional check to make sure that we
have more than 1 frame. The PTS clamping part is still not great. That
is for the next commit.
2023-11-11 20:44:01 +00:00
Christoph Heinrich 7302f871d1 wayland: fix shift+tab keyboard input
When pressing shift+tab we get 0xfe20 instead of 0xff09, which
corresponds to the XKB_KEY_ISO_Left_Tab define.
2023-11-11 20:43:12 +00:00
Christoph Heinrich 5db7dc0860 console: fix crash for long suggestion strings
String formatting of Lua crashes with widths greater then 99, so limit
the value to that.

A nicer solution would be to create our own string padding function that
can handle bigger widths, but such long suggestions aren't common enough
to be worth the effort.
2023-11-11 20:43:02 +00:00
Kacper Michajłow 438ead7a3d osdep/w32_keyboard: remove duplicated MP_KEY_BACK mapping
MP_MBTN_BACK is already mapped, the appcmd duplicates this.

Fixes: #12768
Fixes: 8301906
2023-11-11 03:34:00 +00:00
Dudemanguy 9c8b8ac9d9 wayland: obey initial size hints set by the compositor
In the past, this worked by accident because the initial startup was
racy and sometimes the initial firing of handle_toplevel_config would
happen after reconfig. Since we now properly wait on all compositor
events we can save the initial size hint that is given to us and try to
use that as the window-size/geometry provided the --autofit/geometry
options aren't explictly set. Fixes #11134.
2023-11-10 22:41:35 +00:00
der richter fc4db187d0 cocoa: remove OpenGL cocoa backend
the OpenGL cocoa backend was deprecated in 0.29, it has lot of bugs, is
completely unmaintained and can't properly playback anything anymore on
the newest macOS. it is time to remove it.
2023-11-10 14:54:37 +01:00
der richter a54cc02341 mac: change display name retrieval to localizedName NSScreen property
the old displayName property via the IODisplay API is not working
anymore on ARM based macs and was broken in at least one other case.

instead we use the new localizedName property introduced in 10.15 of the
NSScreen. we don't need any backwards compatibility since 10.15 is the
oldest version we support now.

configs and scripts that use the options and properties fs-screen-name,
screen-name or display-names need to be adjusted since the names could
differ from the previous implementation via the IODisplay API.

Fixes #9697
2023-11-10 14:30:32 +01:00
der richter 040a921964 mac: fix build on older swift versions
this is apparently something that was added with swift 5.5, though it is
hard to find anything officially.

don't capture self in closure but explicitly access all variables by
prepending self.

Fixes #12653
2023-11-10 14:29:23 +01:00
der richter 1c98ab6239 TOOLS/macos-sdk-version: remove legacy sdk version retrieval
older macOS dev tools were inconsistent with the way how SDK versions
were returned, some truncated the minor versions. in those cases the
SDK version had to be retrieved through the SDK build version.

recently the scheme for the SDK build version changed that our heuristic
for converting it to an SDK version produced wrong version strings.
the stride of the minor version changed from 1 to 2, so SDK versions
ended up higher than they actually were. furthermore macOS 11 was
hardcoded.

since Xcode 12 Apple fixed the SDK version retrieval and it is no longer
truncated when using Xcode as dev tools. Xcode 12 is also the latest
supported version on macOS 10.15, which is also our oldest supported
version. we can remove the old SDK build version conversation and use
the Xcode only tool to retrieve the SDK version in the case Xcode is
used as dev tools. furthermore this als keeps support for Xcode 11 where
the problem wasn't fixed yet, but is still a supported version on macOS
10.15.

Fixes #9907
2023-11-10 14:28:39 +01:00
sfan5 b4e14b9420 vo_gpu_next: overwrite cache files atomically 2023-11-10 11:26:10 +01:00
sfan5 8f8b63d622 osdep/io: implement rename() wrapper
This is needed to provide the POSIX behaviour of transparently
overwriting existing paths.
2023-11-10 11:26:10 +01:00
sfan5 cad24deea1 vo_gpu_next: refactor cache saving code
No functional change.
2023-11-10 11:26:10 +01:00
Dudemanguy f67478f8b2 DOSC/input: clarify a couple of commands where no-osd has no effect
This should be the intuitive expectation, but it's worth noting the
deviation.
2023-11-09 21:32:35 +00:00
Dudemanguy 5c2051b1ad player/command: make show-progress work regardless of osd prefix
Having the show-progress command obey no-osd is nonsensical and
unintuitive. The show-text command already ignores no-osd, so there's
precedence for this. Fixes #5662.
2023-11-09 21:32:35 +00:00
Kacper Michajłow 7d86807a5f vo: don't sleep 1ms always when requested time is in the past
Fixes a899e14b which changed clamp from 0 to 1 ms which effectivelly
introduced 1ms sleep always, even if requested until_time_ns is in the
past and should request 0 timeout.

While at it also fix mp_poll wrapper to respect negative timeout which
should mean infinite wait.

Also keep the 37d6604 behaviour for very short timeouts, but round only
the ones > 100us, anything else is 0.

Fixes: a899e14b
2023-11-09 21:31:58 +00:00
Dudemanguy a89ba2c749 vo: replace some magic numbers with timer macros
Most importantly, the wait_until addition was missed while doing the
unit conversions to nanoseconds which meant mpv woke up roughly every
second since not nearly enough time was added. It was meant to be 1000
seconds (1e9 in microseconds). Use a macro so it's more readable. Also
put some other wild 1e9 calculations inside of a macro as well.

Fixes a899e14bcc.
2023-11-09 21:31:58 +00:00
Kacper Michajłow dffaa9cf6b demux/lavf: don't use deprecated side data
Fixes rotation metadata no longer works.

See: 5432d2aaca
Fixes: #12836
2023-11-09 21:30:50 +00:00
NRK 04b220731e editorconfig: add max line
if we're going to have an editorconfig, might as well make it accurately
reflect the coding guide.

also set trim trailing whitespace to true.
2023-11-09 21:30:25 +00:00
der richter 23de1deaaa mac: remove runtime checks and compatibility for macOS older than 10.15
we stopped supporting macOS older than 10.15 and hence can remove all
the unnecessary runtime checks and compatibility layers.
2023-11-09 18:12:25 +00:00
Dudemanguy a5bf211e12 meson: remove several macos-10-* build options
These have been build options since the waf build, but that doesn't
really make sense. The build can detect whatever macOS sdk version is
available and then use that information to determine whether to enable
the features or not. Potentially disabling multiple sdk versions doesn't
really make any sense. Because f5ca11e12b
effectively made macOS 10.15 the minimum supported version, we can drop
all of these checks and bump the required sdk version to 10.15. The rest
of the build simplifies from there.
2023-11-09 18:12:25 +00:00
Kacper Michajłow 051ba909b4 player/loadfile: remove blank line on exit 2023-11-08 21:55:08 +00:00
Kacper Michajłow 82451bdf04 msg: ensure status line is always visible
Restore last status line if it has been cleared by another message.
2023-11-08 21:55:08 +00:00
Kacper Michajłow 5c3faf71e8 msg: factor out print code
Will be useful for next commit.
2023-11-08 21:55:08 +00:00
Kacper Michajłow 773f72e6c6 msg: convert dump_stats to bstr 2023-11-08 21:55:08 +00:00
Kacper Michajłow 0853c719f1 msg: use bstr for partial msg 2023-11-08 21:55:08 +00:00
Kacper Michajłow 2fdb1d31ae msg: check isatty separately per each stream 2023-11-08 21:55:08 +00:00
Kacper Michajłow db77d7836e Revert "player: cut off status line on terminal width"
No longer needed, wrapped status line is supported now. Also this didn't
work correctly if status were decorated with module name or time.

This reverts commit ab6fac43b4.
2023-11-08 21:55:08 +00:00
Kacper Michajłow 54a7acb7dc Revert "player: don't print status line again when quitting"
This workaround is not longer needed.

This reverts commit cdc05c33b3.
2023-11-08 21:55:08 +00:00
Kacper Michajłow 24270b8587 msg: refactor how terminal messages are printed
- prepare string before printing
- reduce amount of fflush(), especially for multiline messages
- clear status line and keep it always at the bottom
- indent module name to the longest value
- disable cursor for status line
- properly support wrapped status line

Overall makes status line less flickering and remove stray status
instead of scrolling them up.
2023-11-08 21:55:08 +00:00
Kacper Michajłow e682834234 stats.lua: disable ASS formatting when printing to terminal 2023-11-08 21:55:08 +00:00
Kacper Michajłow d0b8472e5a msg: don't mix partial log messages, with unrelated log levels 2023-11-08 21:55:08 +00:00
Kacper Michajłow 477a0f8318 vo: replace VOCTRL_HDR_METADATA with direct VO params read
Currently VOCTRL are completely unusable for frequent data query. Since
the HDR parameter addition to video-params, the parameters can change
each frame. In which case observe on those parameter would be triggered
constantly. The problem is that quering those parameters involves VOCTRL
which in turn involves whole render cycle of delay.

Instead update VO params on each draw_frame. This requires changes to VO
reconfiguration condition, but in practice it should only be triggered
when image size or data layout changes. In other cases it will be
handled internal by VO driver.

I'm not quite happy with this solution, but don't see better one without
changing observe/notify logic significantly. There is no good way
currently to handle VOCTRL that are constantly queried.

This adds unfortunate synchronization of player command with VO thread,
but there is not way around that and if too frequent queries of this
param becomes a problem we can thing of other solutions.

Changes the way to get data from VO driver added by a98c5328dc

Fixes: 84de84b
Fixes: #12825
2023-11-08 21:45:07 +00:00
Thomas Weißschuh a96d26e63a audio: avoid unnecessary silence padding in read_buffer()
Not all callers of read_buffer() require the buffer to be padded with
silence.
2023-11-08 20:26:23 +01:00
Thomas Weißschuh 0b43b74c15 ao_audiotrack: switch to ao_read_data_nonblocking() 2023-11-08 20:26:23 +01:00
Thomas Weißschuh 36d5b52612 ao_coreaudio: switch to ao_read_data_nonblocking() 2023-11-08 20:26:23 +01:00
Thomas Weißschuh 5aa2068270 ao_pipewire: switch to ao_read_data_nonblocking()
Avoid blocking the process callback as it runs with realtime privileges.
2023-11-08 20:26:23 +01:00
Thomas Weißschuh 4a134f441d audio: introduce ao_read_data_nonblocking()
This behaves similar to ao_read_data() but does not block and may return
partial data.
2023-11-08 20:26:23 +01:00
Kacper Michajłow a5c32ea52e threads-win32: add comment about local decl of a function 2023-11-08 04:32:10 +00:00
Kacper Michajłow 2ae56e78dd threads-win32: support UWP in mp_thread_set_name 2023-11-08 04:32:10 +00:00
Kacper Michajłow add2f3c8c9 meson: add missing source file for UWP 2023-11-08 04:32:10 +00:00
Kacper Michajłow fa0929bf71 osdep/threads-posix: use CLOCK_MONOTONIC if supported 2023-11-08 04:32:10 +00:00
Kacper Michajłow 0a6c179026 osdep/timer-linux: check clock availability on init 2023-11-08 04:32:10 +00:00
Dudemanguy 468b9bede7 DOCS/option: discourage the use of video-latency-hacks a bit more
Who knows why this exists but maybe it's possibly useful in some obscure
case. Probably worth mentioning that it could break other options.
2023-11-08 00:11:34 +00:00
Niklas Haas 293fe9d74a vo_gpu_next: add --target-gamut option
Fixes: https://github.com/mpv-player/mpv/issues/12777
2023-11-08 00:55:39 +01:00
Guido Cella c798f66343 stats.lua: remove unused variable
056072bf95 deleted the only use of property_list.
2023-11-07 20:58:30 +00:00
Guido Cella 5c2cdb749d console.lua: don't print the console log to the OSD when switching VO
Fixes #12735, fixes #12839.
2023-11-07 20:49:44 +00:00