Commit Graph

51122 Commits

Author SHA1 Message Date
NRK 3789f1a387 demux: make hysteresis-secs respect cache-secs
currently hysteresis-secs only works when the demuxer-max-bytes fills
up. but it's possible for the cache-secs/demuxer-readahead-secs to be
reached first.

in those cases, hysteresis-secs doesn't work and keeps buffering
non-stop. but the goal of this option was to save power by avoiding
non-stop buffering so go ahead and make it respect cache-secs as well.

additionally remove some redundant repetition from the docs.
2023-10-30 17:16:38 +00:00
NRK 20fff1e509 demux: cosmetics
- brace goes to next line for multi-line conditional
- sort standard headers some more
2023-10-30 17:16:38 +00:00
Dudemanguy b56e63e2a9 m_option: drop support for -del for list options
5f74ed5828 deprecated this many years ago.
The utility is questionable at best given that -remove exists and is
more natural to use. Free up some code and drop it.
2023-10-30 16:47:44 +00:00
Dudemanguy d72c86f95c m_option: remove all matches when using -remove
When using -remove with list options, it previously only removed the
first match. Technically, it is possible for there to be more than entry
with the same name. They should all be removed. key/value lists
specifically only allow unique keys so we don't need to do anything
there.
2023-10-30 16:47:44 +00:00
Dudemanguy 991e2a599c options: make --screenshot-directory/--watch-later-directory aliases
By popular demand I guess.
2023-10-30 16:46:32 +00:00
Christoph Heinrich 612faed856 ytdl_hook: reverse thumbnail order
ytdl lists thumbnails in ascending order according to height/preference.
all_formats=yes adds formats from best to worst, so the same should also
be done for thumbnails.
2023-10-30 16:46:17 +00:00
Christoph Heinrich 21609953cc ytdl_hook: support the preference field of thumbnails
yt-dlp has a preference field for it's thumbnails, and not all of it's
listed thumbnails have fields with their dimensions.
Therefore prefere the preference field when available and fall back to
height if it's not.
2023-10-30 16:46:17 +00:00
Christoph Heinrich 045f4a7315 ytdl_hook: add thumbnail option
Opening speed could be improved with the "async" prefix, but then the
tracks would be out of order.
2023-10-30 16:46:17 +00:00
Eva a5b0eceeba ytdl_hook: support thumbnails
Similar to "write-sub=", adding "write-thumbnail=" to raw-options will add the highest resolution thumbnail as a video track.

Closes #7041
2023-10-30 16:46:17 +00:00
Guido Cella 040622f6b7 various: remove trailing whitespace 2023-10-30 16:45:47 +00:00
Umar Getagazov 0341a6f1d3 ao_coreaudio: signal buffer underruns
Change the resulting buffer sizes to match the actual amount of samples
read, and set a flag in case no samples were read at all.
2023-10-29 21:19:04 +01:00
Dudemanguy 18885917a7 meson: do the macos sdk version comparison in meson
Since we can no longer rely on distuils for a version comparison, let's
modify the macos-sdk-version script so it returns multiple potential
versions to meson. Then use meson's built-in version comparison to pick
the right one instead. This avoids the complication of needing certain
python packages installed since everything simply uses stdlib functions.
2023-10-29 19:48:43 +00:00
Dudemanguy 50187264fa Revert "meson: import python module"
Since distutils was dropped from python 3.12, we can't rely on a
standard library implementation for version comparison anymore hence
the switch to packaging instead which is essentially supposed to be the
replacement. This is problematic though because macOS can have several
ways of managing python can result in the build calling the wrong python
binary that doesn't have the actual packaging library installed. This
commit was a workaround for that since it would fetch the python used to
run the build (which is probably the one the user wants), but apparently
upstream doesn't like this and it's subject to change*. So instead,
let's solve try, and solve this a different way.

This reverts commit a57bd8e2b8.

*: https://github.com/mesonbuild/meson/pull/12116#pullrequestreview-1575846647
2023-10-29 19:48:43 +00:00
m154k1 a57bd8e2b8 meson: import python module
- Use import to find Python installation.
- Run macos-sdk-version.py with Python provided by meson.

This fixes an error when meson and python-packaging are installed from
Homebrew. Currently, the Python executable from python@3.12 is installed as
python3.12 so python3 is referring to system installation, which may not
have packaging module. meson can provide the correct executable via import.
2023-10-28 18:26:08 +00:00
Dudemanguy e76660cc54 TOOLS/{file2string,matroska}: drop unneeded stdout output
This was originally for the waf build, and then later writing the output
to a file was added for meson. Since the waf build is no longer around
anymore, remove the dead code.
2023-10-28 02:39:48 +00:00
Dudemanguy 891efca9d7 timer-linux: fallback to CLOCK_MONOTONIC instead of timespec_get
CLOCK_MONOTONIC_RAW is linux-specific (macOS later supported it but it
has its own timer code) and not neccessarily available everywhere like
on BSDs. It makes sense to prefer it because mpv does a lot of
measurements at small intervals (e.g. every frame) so theoretically it
should be more accurate. However if the OS doesn't have it, fallback to
CLOCK_MONOTONIC instead which is almost exactly the same and very widely
supported across unix-like systems. This clock is technically optional
according to POSIX, but any half-decent OS supports it anyway (sorry
Solaris users). As a benefit, we now know that the clock from mp_time is
always monotonic.
2023-10-27 23:19:07 +00:00
Kacper Michajłow bc3e850168 scripting: add 'script' to messages 2023-10-27 23:18:56 +00:00
Kacper Michajłow 6bb3e05d49 scripting: rename backend names for concise naming 2023-10-27 23:18:56 +00:00
Kacper Michajłow cb829879af mp_threads: rename threads for consistent naming across all of them
I'd like some names to be more descriptive, but to work with 15 chars
limit we have to make some sacrifice.

Also because of the limit, remove the `mpv/` prefix and prioritize
actuall thread name.
2023-10-27 23:18:56 +00:00
Dudemanguy 65806ac4d1 TOOLS/macos-sdk-version: use packaging instead of distutils for version
Python 3.10 deprecated disutils and then removed it in 3.12. The macos
sdk check uses the version compare from there, so it needs to be
replaced with something else. So instead use the API from the packaging
module which is also widely available and a fit replacement.

Fixes #12762.
2023-10-27 18:07:28 +00:00
NRK 8bbcc87fee timer: remove MP_START_TIME
instead require mp_raw_time_ns() to not return 0, which all current
implementation already should follow.
2023-10-27 18:07:19 +00:00
Kacper Michajłow 2f91e1441e player/lua: use mp_msg_find_level in check_loglevel
Fixes off by one error. Allows to use MSGL_STATS, but since this is
internal value, this is mostly cosmetic change.
2023-10-27 18:07:08 +00:00
Kacper Michajłow 29e677fea5 msg: make mp_msg_find_level case insensitive 2023-10-27 18:07:08 +00:00
llyyr 78f1cedd0c DOCS/options: clarify `no-config` is a command line flag
This option does nothing when put inside config files.
2023-10-27 11:19:32 +02:00
Dudemanguy 66fb1d1cdb player/audio: fix incorrect check on adding delay
dac977193c changed adding delay to only
when the video is playing but this isn't correct. The video frames
adjust themselves based on the audio, so if we still have audio
processing while the video itself happens to be in some non-playing
state (such as STATUS_READY), the delay still needs to be taken into
account. The correct thing to check is to make sure that it is not
STATUS_EOF. STATUS_EOF covers the case where we have still image, and of
course no video at all is STATUS_EOF. So having a massive bogus delay
value is still avoided.
2023-10-26 22:59:09 -05:00
Kacper Michajłow 729f2fed2c semaphore_osx: change mp_sem_timedwait to mp_time 2023-10-26 20:06:14 +00:00
Kacper Michajłow f659a60dfa semaphore_osx: don't overwrite global symbols 2023-10-26 20:06:14 +00:00
Philip Langdale 7a58763ad9 Revert "hwdec_vulkan: account for vulkan frames now using presentation size"
ffmpeg is again setting the frame dimensions to the coded size, so we
need to reintroduce our work-around to get the logical frame dimensions
from the frames_ctx rather than the frame itself.

ffmpeg commit:
* 9ee4f47c94

This reverts commit c40bd88872.
2023-10-26 09:51:47 -07:00
Dudemanguy b9c42755a7 javascript: use --js-memory-report option instead of MPV_LEAK_REPORT
The MPV_LEAK_REPORT environment variable was previously read in order to
determine whether or not to enable memory reporting for javascript
scripts. This is kind of weird and deviates from the norm of exposing an
option to the user. So let's just add --js-memory-report and disable it
by default instead.
2023-10-26 16:49:56 +00:00
Kacper Michajłow 1be0d0aa84 test: unbreak build when win32-internal-pthreads is disabled 2023-10-26 16:49:46 +00:00
Kacper Michajłow 34d99840a5 timer: use MP_TIME macros 2023-10-26 16:49:38 +00:00
Kacper Michajłow 032b7de97f osdep/timer-win2: rename to timer-win32 2023-10-25 19:30:39 +00:00
llyyr 54223fc8e7 ci/msys2: create a wrap file for libplacebo
This is required because msys2's libplacebo is too outdated
2023-10-25 16:40:02 +00:00
llyyr 486bb93dfa meson: remove libplacebo wrap
This causes more pain than it is worth
2023-10-25 16:40:02 +00:00
Dudemanguy 2783d5a51a options: rename --play-dir to --play-direction
--play-dir sounds like it has something to do with directories so change
it. The play_dir variable is used a bunch everywhere internally so
whatever just leave it alone instead of renaming that.
2023-10-25 16:16:37 +00:00
Dudemanguy 36de0d784f options: rename --watch-later-directory to --watch-later-dir
Same logic as the previous commit.
2023-10-25 16:16:37 +00:00
Dudemanguy 1370ecfc1b options: rename --screenshot-directory to --screenshot-dir
Less characters is better? Other options use -dir for directory so
consistency I guess.
2023-10-25 16:16:37 +00:00
Dudemanguy b626f3ba83 options: rename --sub-ass-force-style to --sub-ass-style-overrides
This option has exactly the same semantics are other mpv options that
override a particular thing with something from the user. So instead of
the "force-style" name, use "-overrides" which is more consistent.
The plural form is used since it's a list option.
2023-10-25 16:16:37 +00:00
Dudemanguy 9924102c66 options: rename --override-display-fps to --display-fps-override
Other similar options are in the form of --foo-override not
--override-foo. The display-fps one was backwards so flip it around the
other way for consistency reasons.
2023-10-25 16:16:37 +00:00
Dudemanguy 7aed492ccc options: rename --fps to --container-fps-override
This better reflects what it actually does. As a bonus, script writers
won't be misled into thinking that fps displays the actual video or
display fps.
2023-10-25 16:16:37 +00:00
Dudemanguy dac977193c player: don't calculate av delay if there's no audio or video
The point of the mpctx->delay field is for calculating a/v sync and
adjusting the frame timings appropriately. However, the frame_time was
always subtracted from mpctx->delay regardless of the audio status. This
meant that for a video with no audio, every single frame had a
subtraction with nothing ever added to it meaning that you get massive
negative delay times. For weird videos where the audio starts way later,
the massive delay leads to the VO sleeping for basically about as long
as the video was previously playing without audio. This results in
nothing being rendered during that brief period of time and just overall
badness. When using display-sync, it happens to work since the video
doesn't adjust itself based on audio and it renders anyway.

The fix is to simply not touch mpctx->delay in player/video.c unless
there's actually audio playing. This is what the rest of the code
already does aside from setting it to 0 on resets or EOFs. Move the
calculation into adjust_sync after the audio status check. It works
exactly the same as before except that we don't constantly subtract
bogus values when there's no audio playing. The reverse situation in
player/audio.c also has the same issue. For something that is only
audio, mpctx->delay is always added to but nothing will ever subtract
from it. It's not really clear if this particular version could ever
cause a real bug, but logically it needs to be guarded in the same way.
The field here should only be updated if the video is actually playing.

Fixes #12025.
2023-10-25 15:43:07 +00:00
Guido Cella c62adc3018 console.lua: complete choice and flag options 2023-10-25 15:42:33 +00:00
Guido Cella 4aa8b628e4 console.lua: remove unused capture from completion patterns
The end position of the word to be completed is never used because all
patterns end with $. Remove it or it would complicate implementing
completers with more patterns.
2023-10-25 15:42:33 +00:00
Guido Cella c4368dc08d console.lua: use string.match()
Avoids the 2 unneeded return values of string.find().
2023-10-25 15:42:33 +00:00
Guido Cella e92d794644 console.lua: generate completion lists lazily
This will allow providing more nested completions without pre-generating
an enormous amount of completions, and it is more efficient since it
only generates the completions needed for each completion attempt.
2023-10-25 15:42:33 +00:00
Guido Cella b89f0ad411 console.lua: remove repetition from build_completers() 2023-10-25 15:42:33 +00:00
Guido Cella b9ab8d1a6c console.lua: remove unnecessary copy 2023-10-25 15:42:33 +00:00
Kacper Michajłow 48ac5215cf github/workflows: use ubuntu-latest host for freebsd
In the pursuit of stability.

It is slower and QEMU-based, but if this isn't stable, I don't know what
will be.

Bump the timeout to 30 minutes, just in case. It seems to take 12-15
minutes to finish.
2023-10-25 13:51:20 +00:00
Kacper Michajłow 869faadc68 options: disable --allow-delayed-peak-detect by default
Peak detection greatly increases HDR experience. Performance hit of
non-delayed detection is not that significant and is in line with
current default settings.
2023-10-25 11:55:56 +02:00
llyyr 06c26e37ed osdep: fix clang warnings with `_FORTIFY_SOURCE`
This fixes warnings generated for `-Wunused-result` when mpv is built
with `-O1 -D_FORTIFY_SOURCE=1` or higher on clang since read/write
functions are declared with the `warn_unused_result` attribute.
Cast to void to avoid these warnings.
2023-10-24 22:49:22 +02:00