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

51840 Commits

Author SHA1 Message Date
Dudemanguy
b71af009dc DOCS/man: remove outdated softvol entry
69ae23fdd1 removed this option completely.
2024-02-25 19:09:35 -06:00
Leonardo Boss
58ed620c06 player: add ao-volume option, to set the system volume at startup
closes #12353
2024-02-25 23:57:35 +00:00
nanahi
2872e23aea ao: don't clip floating point formats at non-unity gain
Currently, the softvol gain control attempts to clip floating point ao
formats within -1 and +1. However, this is "optimized out" at unity gain,
where no clipping is applied. This results in inconsistent behavior when
the source audio is already out of -1 and +1 range, where a gain of 0.99
results in clipping, but not at exactly 1.

Since a big advantage of floating point audio data is that they do not
lose information through out-of-range data because the ao sink can apply
suitable negative gain to prevent clipping before converting them to
integer formats, clipping should not be performed on these data.

Fix this by removing the existing clipping behavior. It now results in
a simple multiplication, which faciliates compiler auto-vectorization
of this operation over audio data.
2024-02-25 18:23:57 +00:00
nanahi
ab3a63285a osdep/io: add mp_unlink()
unlink() was never wrapped in win32, so all usages of it were referring
the ANSI version of the function. This doesn't work properly for Windows
versions before 1903 (where the UTF-8 codepage is requested).

Fix this by adding mp_unlink() which wraps over _wunlink().
2024-02-25 14:30:20 +01:00
Guido Cella
748504de52 sub: fix LRC lines with multiple timestamps
LRC subtitles can have lines with multiple timestamps, e.g.

[00:00.00][00:02.00]foo
[00:01.00]bar

Currently mpv shows only the "foo" that was decoded first, because it
compares the packet file position to check if a packet was already seen,
and it is the same for both occurrences of "foo". Fix this by also
comparing the pts.

This keeps comparing the packet position on top of the pts to not break
subtitle lines with the same timestamp, like:

1
00:00:00,000 --> 00:00:01,000
foo

2
00:00:00,000 --> 00:00:01,000
bar

where mpv shows both lines on top of each other. They are common in ASS
subtitles.

Fixes https://github.com/mpv-player/mpv/issues/13497.
2024-02-25 14:30:07 +01:00
LaserEyess
a0447a370e ci: add OpenBSD 2024-02-25 14:29:18 +01:00
LaserEyess
914e56d845 ci: fix typing in lint-commit-msg.py
1. Explicitly add typing to lint_rules
2. Fix return type for get_commit_range()
3. Fix no-return path with get_commit_range()
2024-02-25 14:28:05 +01:00
nanahi
3e8d69e3e8 image_writer: cleanup leftover files if image writing fails
This avoids leaving an empty/corrupt file if fopen succeeds but
image writing fails afterwards.
2024-02-25 11:37:44 +01:00
Dudemanguy
74b4c3c531 player: set hidpi-window-scale to no by default
This has defaulted to yes for a very long time, but evidentally it
annoys a lot of people (including myself). My argument is that this
makes no sense. mpv is for videos; not text. A 1920x1080 video should
open as 1920x1080 regardless of whatever the DPI settings of the OS is.
This can get very silly when you consider watching a 4k video which will
get this additional scale factor which is virtually never desirable.
Whether or not the OS and/or WM prevents it from getting larger than the
screen depends on a lot of things.

Previously some windowing backends required that this option be set to
yes in order to report a dpi scale value other than 1, but this should
be fixed with the previous commits. The only difference is whether or
not to scale the window by the additional factor.

Fixes #13465.
2024-02-24 20:31:08 +00:00
Dudemanguy
3b23b2c22a DOCS/options: clarify hidpi-window-scale 2024-02-24 20:31:08 +00:00
Dudemanguy
17d9abd08f player/command: handle runtime toggling of hidpi-window-scale
Wayland was the only backend that attempted this, but it can be done in
a centralized place for anything that supports this. hidpi-window-scale
is just the same as a normal window scale but with the OS DPI as the
factor.
2024-02-24 20:31:08 +00:00
Dudemanguy
a3648ddac8 win32: clean up hidpi window scale behavior
Same as X11. An accurate dpi scale should always be reported and
UNFS_WINDOW_SIZE shouldn't take dpi scale as an additional multiplier.
2024-02-24 20:31:08 +00:00
Dudemanguy
006822434a x11: clean up hidpi-window-scale behavior
Several related things but in a nutshell makes it more like wayland.

1. Remove unneeded --hidpi-window-scale checks. The backend should
   always report the actual dpi value regardless of what this option
   says.
2. Remove dpi_scale factors from UNFS_WINDOW_SIZE VOCTRLs. It makes
   things more complicated and unintuitive for no reason. A window scale
   of 1 should mean 1. It annoyed a few years ago in #9437, and I agree
   with them (wayland was never implemented like this).
3. Change the dpi log messages to be more brief and remove the unneeded
   comments about prescaling.
2024-02-24 20:31:08 +00:00
nanahi
3e17d9da8f vo_gpu: use fbo texture height for fragment coordinate calculation
Previous fix only worked when the video output doesn't have vertical
black bars. This fixes the cases like fullscreen, video-zoom etc.

Fixes: https://github.com/mpv-player/mpv/pull/13528
2024-02-24 21:12:17 +01:00
der richter
f9b8f156d7 test: add missing libplacebo dependency 2024-02-24 20:04:16 +01:00
der richter
0f36a09881 github/workflows: add macOS 14 arm runner with most recent xcode 2024-02-24 20:04:16 +01:00
der richter
3390dce426 github/workflows: add vulkan, mujs and urchadet to macOS dependencies
also explicitly enable those and remaining macOS features.
2024-02-24 20:04:16 +01:00
der richter
555bdf78b2 github/workflows: link macOS artifacts in comments 2024-02-24 20:04:16 +01:00
der richter
0ed023653a github/workflows: bundle macOS App and upload it as artifact
also add architecture to artifact name
2024-02-24 20:04:16 +01:00
der richter
06ee5e9344 mac: code consistency changes 2024-02-24 20:04:16 +01:00
der richter
56b1078bfd osxbundle: use dylib script directly instead of in a subprocess
before errors and outputs where ignored from the subscript and the main
script didn't fail nor did it output anything.

with this change the script properly outputs everything to stdout and
stderr. in the case the dylib script fails the whole script fails now.

the main function in dylib_unhell was kept since it can still be used
individually without the oscbundle script. the script had to be renamed
with an underscore to make it importable.
2024-02-24 20:04:16 +01:00
der richter
00f1743ae2 osxbundle: add homebrew vulkan loader location to search path 2024-02-24 20:04:16 +01:00
der richter
48f48e0d5d osxbundle: resolve loader_path on rpath retrieval
rpaths can be relative to the current object folder path. resolve those
paths.
2024-02-24 20:04:16 +01:00
der richter
98f2dcb676 osxbundle: remove unused import 2024-02-24 20:04:16 +01:00
der richter
948b0487f7 osxbundle: fix syntax warning with python 3.12 2024-02-24 20:04:16 +01:00
der richter
218d9e26d2 meson: add custom target for macOS App bundling
Fixes #10879
2024-02-24 20:04:16 +01:00
sunpenghao
2cc3bc12db ao_wasapi: scale queried AO volume to (0, 100)
This was done for `AOCONTROL_SET_VOLUME` but not `AOCONTROL_GET_VOLUME`.
2024-02-24 05:26:56 +00:00
sunpenghao
6863eefc3d ao_wasapi: address premature buffer fills in exclusive mode
Currently, running AO control wakes up the WASAPI renderer thread in the
`WASAPI_THREAD_FEED` state, where `thread_feed` will be called. However,
it seems that in recent Windows versions (tested on Windows 10 build
19044.3930 and Windows 11 build 22631.3007) we can't know if it is safe
to feed more audio data in event-driven exclusive mode:
- `IAudioClient_GetCurrentPadding` always returns `bufferFrameCount`,
  even if *NO* data has ever been written. This means we don't know how
  much free space we have that is available for writing. This is not the
  case in shared mode, where the return value correctly reflects the
  size of data waiting to be processed. As a sidenote, MS did not
  document the precise definition of the return value for an
  event-driven, exclusive stream [1].
- `IAudioRenderClient_GetBuffer` never fails. We can call it for 10
  times in a roll, each time requesting an entire buffer (the unit at
  which data is exchanged in exclusive mode using event-driven
  buffering; there are 2 such buffers) and get a successful return code
  everytime. In shared mode, we get `AUDCLNT_E_BUFFER_TOO_LARGE` if we
  request a buffer larger than that currently available.

As a result, `thread_feed` will always write `bufferFrameCount` frames
of audio in exclusive mode. There will therefore be glitches each time
`thread_control` is called due to the subsequent `thread_feed`
overwriting frames yet to be processed. Also, an irreversible error is
accumulated to `sample_count` as long as there is no AO reset, leading
to eventual, unbounded A/V desync.

As a fix to the issue, add a dedicated state for dispatch queue
processing so that `thread_feed` is only called when signaled by the OS.
The buffer checks in `thread_feed` that use `GetCurrentPadding` in
exclusive mode are kept in case there are older versions where the two
APIs behave differently.

Closes #12615.

[1] https://learn.microsoft.com/en-us/windows/win32/api/audioclient/nf-audioclient-iaudioclient-getcurrentpadding
2024-02-24 05:26:56 +00:00
Guido Cella
8cd678bfe4 player: fix watch later config comments when ignoring path
With --ignore-path-in-watch-later-config,
--write-filename-in-watch-later-config still writes the absolute path of
files in the comment, even though the hash is calculated from the
basename. Make it write the basename to avoid confusion.

Also stop writing redirect entries for parent directories with
--ignore-path-in-watch-later-config, both because it's redundant, and
because with this patch it would write the basename of directories in
the comment, which would be wrong because their hashes are calculated
from the absolute paths.
2024-02-24 05:26:48 +00:00
Dudemanguy
8150682814 player/loadfile: rewrite sub autoselection logic
There's too many dumb options related to subtitles which have annoying
edge cases. Try to rewrite this completely so it hopefully behaves
normally in every expected scenario. A key goal here is be smarter while
looping through the tracks and avoid selecting the subtitle if it
doesn't meet user's passed options as opposed to clearing the pick after
the fact. Fixes #13280 and fixes #13263.
2024-02-24 05:26:37 +00:00
Kacper Michajłow
7454edc556 github/workflows: update cross-platform-actions to v0.23.0
- Use hardware accelerated virtualization on Linux runners
- Update to FreeBSD 14.0
2024-02-23 22:37:37 +02:00
Guido Cella
b35e34ae2f command: fix sub-seek while paused without a video
When using sub-seek without a video track while paused, adding the 0.01
SUB_SEEK_OFFSET to the new timestamp is not enough to show the new
subtitle line. Add 0.1 instead to fix it. 0.01 is already enough for
sub-step.
2024-02-23 21:37:22 +01:00
Guido Cella
b564d5916e command: don't add SUB_SEEK_OFFSET twice with sub-seek
The name SD_CTRL_SUB_STEP is misleading, but it is also used for
sub-seek, and sub/sd_ass.c already adds SUB_SEEK_OFFSET with it.
2024-02-23 21:37:22 +01:00
nanahi
4e73602ae5 options/path: move path utility functions to misc/path_utils
These utility functions have nothing to do with user and config dir/file.
Move them to a separate file.
2024-02-23 21:35:57 +01:00
nanahi
84015959cc osdep/io: move I/O utility functions to misc/io_utils
The purpose of osdep/io is to provide a wrapper for POSIX I/O functions
on Windows. The last 2 functions are utility functions which don't serve
this purpose.
Move them to a separate file.
2024-02-23 21:35:57 +01:00
nanahi
c36e051470 osdep/io: ignore 'x' mode for mp_fopen
fopen() with 'x' mode is a non-portable glibc extension, is currently
unused, and should not be used in order to maintain POSIX compatibility.
Thus there is no need for the Windows wrapper mp_fopen() to support it.
2024-02-23 21:35:43 +01:00
nanahi
ae1a4ed28a vo_gpu: fix fragment coordinate calculation when dithering
When doing the dithering pass, the fragment coordinate is queried, but
doesn't take the fbo texture flipped property into account. This results
in different dithering patterns when toggling between fbo flipped and
non-flipped state. This can be reproduced with --vo=gpu --gpu-api=opengl
and easily seen with --dither-depth=1 when toggling between playing and
pausing.

Fix this by flipping the fragment y coordinate if the fbo is flipped
when calculating dithering coordinate.
2024-02-22 12:35:40 +01:00
nanahi
74f2260cd6 vo_gpu: fix fragment coordinate calculation when drawing checkerboard
When redrawing cached frames while the fbo texture is flipped,
the texture after drawing to screen pass will be flipped when blitting.
However, when rendering the checkerboard, the fragment coordinate
doesn't take this into account, so the coordinate before flipping is used,
resulting in different checkerboard location when toggling between
flipped and non-flipped state. This can be reproduced with --vo=gpu
and --gpu-api=opengl: the checkerboard patterns when playing and
pausing are different (vertically flipped).

Fix this by flipping the fragment y coordinate if the fbo is flipped
when calculating checkerboard coordinate.
2024-02-22 12:35:40 +01:00
nanahi
531704e35d x11_common: handle window dragging in ButtonPress event
Begin the _NET_WM_MOVERESIZE window dragging in ButtonPress event
to match the behavior of win32 and wayland, simplify logic by dropping
the win_drag_button1_down hack required by the old method, and fix a race
condition described in commit 19f101db68,
which happens when moving the mouse and releasing the button at the same time.

The race condition can be easily triggered when using a touch screen
(tested with libinput driver), where a tap is translated to MotionNotify,
ButtonPress, MotionNotify, and ButtonRelease in sequence, with the last 2
events having the same timestamp. This has caused some window managers to
not stop dragging after the ButtonRelease, resulting in window being stuck
in dragging state after a single tap.
2024-02-21 22:39:28 +01:00
der richter
d954646d29 various: make mentions of macOS consistent
change all mentions and variations of OSX, OS X, MacOSX, MacOS X, etc
consistent. use the official naming macOS.
2024-02-21 20:46:53 +01:00
der richter
d6fdc0ae74 DOCS: make mentions of macOS consistent
change all mentions and variations of OSX, OS X, MacOSX, MacOS X, etc
consistent. use the official naming macOS.
2024-02-21 20:46:53 +01:00
nanahi
24afc00b8c DOCS/man: document Ctrl+WHEEL_UP/WHEEL_DOWN keybinds
Also remove the existing redundant wordings.
2024-02-21 18:55:43 +00:00
nanahi
de4f301891 input.conf: bind Ctrl+WHEEL_UP/DOWN to video-zoom
There are good reasons to bind Ctrl+WHEEL_UP/WHEEL_DOWN to video-zoom:

- They are ubiquitous and familiar key bindings to represent zooming
operations, which are used in all popular web browsers, document viewers,
and document editors.
- Because WHEEL_UP/WHEEL_DOWN are scaled with high-resolution scrolling
input devices like touchpads, this allows smooth zooming.
- This makes "pinch to zoom" with touchpads and touchscreens work out of
box on Windows, since by default applications receive these key inputs
for pinch gesture.
- It had been considered to bind these keys to window-scale instead.
However, this results in horrible UX as the keybinds work only when the
mouse pointer is over the mpv window, and if the window shrinks during
this operation, the window below mpv now receives these keybinds,
resulting in unwanted zooming for that window, which violates the principle
of least surprise.
2024-02-21 18:55:43 +00:00
llyyr
362959ace3 DOCS/mpv: update ancient profiles config example
Hopefully actually useful now. Also updates big-cache to not be smaller
than the current default.
2024-02-20 23:11:39 +01:00
der richter
f9197e07ee osxbundle: add optional source path argument 2024-02-20 20:55:12 +01:00
der richter
166f039edb osxbundle: remove old version retrieval fallback 2024-02-20 20:55:12 +01:00
der richter
6b5b4b74b1 osxbundle: bundle vulkan driver and layers
only bundle synchronization2 layer for older vulkan/MoltenVK versions
where it is needed.

Fixes #13232
2024-02-20 20:55:12 +01:00
der richter
0e441525cf vo: make libmpv last in the auto-probing order for cocoa-cb only
this partially reverts commit 7b5a258. back then the only properly
working vo on macOS was cocoa-cb (libmpv). it would always use the
deprecated opengl cocoa backend or no vo at all. because of that libmpv
was moved to the top of the auto-probing order, so the preferred vo
was used on macOS only.

we now have a working vulkan gpu/gpu-next backend on macOS which should
be the new default vo. though disabling the auto-probing again for
libmpv would probably cause the undesired behaviour on macOS that
cocoa-cb would never be auto selected again. especially if not build
with vulkan support or without vulkan driver on macOS, this would lead
to no video output at all. so instead of completely reverting the
mentioned commit, we instead move libmpv to the bottom of the
auto-probing order but only auto select it when mpv was built with
cocoa-cb support. this restores the previous behaviour on all other
platforms besides macOS, but also lets us auto select cocoa-cb if
supported.
2024-02-20 20:42:02 +01:00
llyyr
4a563a6390 encode_lavc: don't use deprecated avcodec_close
Deprecated upstream 1cc24d7495
2024-02-19 18:09:58 +01:00
llyyr
6a5a3ec3bf af_lavcac3enc: don't use deprecated avcodec_close
Deprecated upstream 1cc24d7495

We need to reallocate the context here because `avcodec_free_context`
also frees the context, and we want to reuse the context with some
reconfig.
2024-02-19 18:09:58 +01:00