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

51264 Commits

Author SHA1 Message Date
Dudemanguy
4b0f03d455 vo_gpu_next: set max cache size back down to 10 MiB
It turns out that mpv will rewrite the entire cache file on every single
quit. It's not so great since after viewing a ton of files, your cache
can grow to massive sizes and slow down quitting the player to a
noticeable amount. Turn down the max size of both caches to 10 MiB for
now as a workaround until this gets improved later.
2023-11-18 18:33:21 +00:00
rcombs
ca45b71edc hwdec: support videotoolbox with libplacebo 2023-11-16 09:48:20 -08:00
der richter
62b1ce0a55 osxbundle: sign bundle with ad-hoc pseudo identity
without a developer license and the corresponding certificate we can't
sign our app bundle properly. instead use the ad-hoc pseudo identity.
there. i am not sure what restrictions we have because of that, but it's
the only way we can pseudo sign the app bundle.

Fixes #12116
2023-11-15 23:08:11 +01:00
Daniel Brookman
aa8af2e66b osxbundle: remove mpv-bundle symlink to allow code signing
Apps on Apple silicon have to be codesigned to run, but you can't
codesign bundles that have a symlink for the main executable.

The "mpv-bundle" symlink was used as the bundle's main executable
because it makes the execution name of the binary different.
Launch Services runs the CFBundleExecutable key from Info.plist when
launching a bundle, so by comparing the execution name to the name of
the symlink, you can check if that's how the binary was launched.

This replaces that detection method by moving the MPVBUNDLE
environmental variable into Info.plist. Launch Services will set
anything in LSEnvironment as environmental variables before launching
the bundle, so we're able to check for it instead of needing to
differentiate the execution name of the binary.

Fixes #12116
2023-11-15 23:08:11 +01:00
der richter
dcb3213aa7 osxbundle: resolve relative linked dependency paths
not all dependencies are linked with an absolute path but rather are
relatively linked via @rpath or @loader_path. in those cases we have to
resolve the paths to those dependencies ourselves and change the linking
with install_name_tool to be relative to the @executable_path of the
binary within bundle.

Fixes #11897
2023-11-15 23:08:11 +01:00
Guido Cella
5362ec9ec0 zsh-completion: complete options after --help 2023-11-15 15:08:30 +00:00
Christoph Heinrich
cb89c7ef89 command: notify media-title on force-media-title change
Fixes #12887
2023-11-15 14:57:32 +00:00
Kacper Michajłow
a6fb9321ea audio: fix UB when casting INFINITY to integer
Fixes busy wait, because in practice inf would be casted to 0.

Fixes: 174df99
2023-11-15 14:57:18 +00:00
Kacper Michajłow
39cab760b3 vo: delay vsync samples by at least 10 refreshes
This filters out vastly inaccurate values from presentation feedback
that can happen shortly after restarting playback or seeking.

Makes estimated vsync converge almost instantly instead of waiting
until those outliers are dropped from the past samples.
2023-11-14 15:09:03 +00:00
karelrooted
4420dfee2a player: don't remove all selected sub tracks in mp_dselect_track
fix secondary sub disappear after sub-reload, sub-remove.
2023-11-14 15:00:54 +00:00
nanahi
6f17a5efe3 stats.lua: fix incorrect storage aspect ratio value
The "Resolution" property shows the storage resolution for videos with
non-square pixels.

Currently, display aspect ratio is shown for both "Resolution" and
"Output Resolution" properties which results in a duplicate,
and is incorrect for the "Resolution" property.

The correct aspect ratio is now shown using the sar and sar-name properties.
2023-11-14 15:00:23 +00:00
nanahi
4ab4a88889 command: export storage aspect ratio (sar) properties
Display aspect ratio (aspect) and pixel aspect ratio (par) are already
exported, but storage aspect ratio (sar) isn't. This value is needed to
display the storage aspect ratio for non-square pixel sources in stats.lua.

This exports two new properties: video-params/sar and video-params/sar-name.
Docmentation is updated accordingly.
2023-11-14 15:00:23 +00:00
Kacper Michajłow
ff7f105c85 vo_gpu_next: guard from cache save conflict
If multiple instances of mpv are closed at the same time, they will
write to the same temporary file. Fix that by using unique temporary
file.
2023-11-14 15:00:00 +00:00
Dudemanguy
d124449c3d demux_playlist: simplify ini parsing
In acac614032, I sort of cargoculted what
I had to do for m3u, but it's actually not needed. bstr_split_tok
unexpectedly doesn't modify the original string. So the line_dup
business in the ini parsing is not needed. Remove it. The part in
parse_ref_init isn't wrong but naming the variable "line_dup" instead of
"value" is stupid so adjust that. And finally, you can actually force a
codepage in mpv (add "+" before the codepage) which will cause every
line to be allocated memory including the header lines even though those
are obviously valid utf8 that should never need conversion. This wasn't
taken into account so add an extra pl_free_line in a couple of places to
make sure they are freed.
2023-11-14 14:59:48 +00:00
Kacper Michajłow
ad02db8cee DOCS/options: update watch-later-options docs 2023-11-12 21:25:22 +00:00
Kacper Michajłow
e669493e6e options: add more properties to default watch-later-options
Adds:
--secondary-sub-visibility
--video-aspect-method
--video-unscaled
--video-pan-x
--video-pan-y
--video-rotate
--video-crop
--video-zoom
--video-scale-x
--video-scale-y
--video-align-x
--video-align-y

Those properties are related to playback state and are likely expected
to be restored when resuming playback.
2023-11-12 21:25:22 +00:00
Kacper Michajłow
cb30c497c2 options: remove not relevant props from default watch-later-options
Removes:
--border
--fullscreen
--ontop
--osd-level
--pause

Those options are not really content related. I don't see much gain to
save them per each watch later entry.
2023-11-12 21:25:22 +00:00
Kacper Michajłow
5b4a119267 vo_gpu_next: disable libplacebo drift_compensation
In commit de6d57f0 libplacebo enabled drift compensation by default.

mpv already tracks error and adjust the speed by itself.

This commit fixes judder visible when slowing video a lot, ex. playing
back at 10% speed.

Set ideal vsync duration also when dropping frames, libplacebo estimate
currently own values anyway, will be useful later...

See: de6d57f021
2023-11-12 20:22:26 +00:00
Kacper Michajłow
08c12a28b3 player/video: fix calculation of ideal_frame_vsync_duration
During move of this code from vo_gpu_next.c to video.c someone(TM) tried
to be smart and simplify the expression. The num_vsync includes error
compensation which can cause it to display +-1 vsync at the same rate.
We explicitly don't want to include this in "ideal" parameters.

Also num_vsyncs was already rounded so we produced off timings in
general.

Revert back to proper way of translating the time.

Fixes: 5e5a325
2023-11-12 20:22:26 +00:00
Guido Cella
8b3075c9be m_option: remove leftovers of del action
b56e63e2a9 removed -del for list options but it is still listed in the
list structs, which means that it is still tab completed on the CLI like
the other actions, and seems to behave like -set. Remove it so it is no
longer tab completed.

Also remove the description of -del from the help output of object
settings lists --(ao|vo|af|vf)-help, and update a comment.
2023-11-12 18:48:25 +00:00
Dudemanguy
ca6ae6fb5f vo_gpu_next: update overlays for blend subtitles on frame redraws
The commit subject sounds reasonable except that frame redraws get
spammed in certain cases (still image with subtitles) all the time
regardless if the subtitle actually has changed or not. So this is
stupid and wasteful, but you'll always see subtitles. vo_gpu currently
has this behavior as well, so we're just matching it but later mpv's
core should be fixed so this works reasonably. Fixes #11335.
2023-11-12 17:18:04 +00:00
Guido Cella
2ba75a0ffc DOCS/options: osd-shadow is ignored with osd-back-color
The back color overrides the shadow, not the border.
2023-11-12 17:16:13 +00:00
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