Commit Graph

121 Commits

Author SHA1 Message Date
nanahi f11002cef3 various: fix tabs in code 2024-05-07 11:23:08 +02:00
Kacper Michajłow 006c3ce9fe test: mark libmpv as expected fail if OSC is not available
This test is expected to fail without lua and osc.lua support.
2024-05-06 22:01:17 +02:00
Kacper Michajłow cd12e923f8 test/libmpv_encode: minor adjustments for win32 build fix 2024-05-06 22:01:17 +02:00
Kacper Michajłow 5cf0da2a6a various: remove unused sys/time.h include 2024-05-06 22:01:17 +02:00
Kacper Michajłow 053d971507 misc/path_utils: normalize win32 paths 2024-05-05 19:37:57 +02:00
Guido Cella 1d640c9887 player: normalize paths for resuming playback
Paths like foo.mkv, ./foo.mkv .//foo.mkv, ../"$(basename
"$PWD")"/foo.mkv, and C:\foo.mkv and C:/foo.mkv on Windows, use
different config files for resuming playback, so if you quit-watch-later
and later play the same file with a different path, mpv does not resume
playback. This commit normalizes the paths on Unix to fix this.
2024-05-05 19:37:57 +02:00
Guido Cella 1128989885 test: fflush between printf and abort
This is necessary to show the output with meson test. Followup to
06edb04692.
2024-05-05 17:51:34 +02:00
sfan5 426be8441a test: make libmpv_test abort if an error is logged
Among others this provides a trivial test that built-in scripts aren't throwing
an error at load or init time.
2024-04-24 12:58:50 +02:00
sfan5 3b64bf908a test: add an encoding test with libmpv 2024-04-17 20:22:36 +02:00
Dudemanguy a5269d7a73 test: support format refs for multiple ffmpeg versions
With some small tweaks to the test, we can support multiple ffmpeg
versions. This adds back ffmpeg 6 support that was removed in the
previous commit.
2024-04-12 17:39:34 +00:00
Dudemanguy 05607fed19 test: update format refs for new major ffmpeg version
xvmc was removed and d3d12 was added.

a12cd3be98
142f727b9c
2024-04-12 17:39:34 +00:00
Kacper Michajłow c389f9e75e win32: change fputs to fwrite wrapper
Removes mp_puts/mp_fputs and adds mp_fwrite.

In fact I wanted fwrite instead of puts, no need to make it more awkward
with the implicit new lines.

Fixes: fc55f355fc
2024-04-07 20:23:04 +02:00
Kacper Michajłow 06edb04692 test: fflush output stream before abort
For `meson test` to not eat lines on abort.
2024-03-21 03:50:11 +01:00
Kacper Michajłow 8708f4dc91 m_property: add `>` for fixed precision floating-point expansion
This enhancement makes it easier to create constant width property
expansions, useful for the `--term-status-msg`. Additionally, it changes
to `%f` printing with manual zero trimming, which is easier to control
than `%g`. With this method, we can directly specify precision, not just
significant numbers. This approach also avoids overly high precision for
values less than 1, which is not necessary for a generic floating-point
print function.

A new print helper function is added, which can be used with adjusted
precision for specific cases where a different default is needed. This
also unifies the code slightly.
2024-03-21 03:50:11 +01:00
nanahi 8c1117b2cb meson: remove winmm dependency for win32 desktop target
Not needed anymore as timeBeginPeriod() is removed.
2024-03-19 20:23:25 +01:00
nanahi aff376e066 win32: increase hires timer resolution
timeBeginPeriod() only allows setting minimum timer resolution
to 1 ms. However, modern x86 platforms support a minimum timer
resolution of 0.5 ms. Use NtSetTimerResolution() instead for
the increased resolution, which can be set with MPV_HRT_RES.

Additionally, change the units of mp_start_hires_timers(),
mp_end_hires_timer(), MPV_HRT_RES, and MPV_HRT_MAX to nanoseconds,
in accordance with other functions used in timer.h.
2024-03-19 20:23:25 +01:00
Kacper Michajłow fc55f355fc win32: add puts/fputs wrappers 2024-03-19 19:58:09 +01:00
Kacper Michajłow 3372e17d51 win32: optimize mp_vfprintf a little
- remove redundant strlen/wcslen
- reuse allocated temporary buffers

The difference is not big, but it satisfies me to remove those
redundancies.
2024-03-19 19:58:09 +01:00
Kacper Michajłow 8ee25db71f win32: cache GetConsoleMode state for stdout/stderr
GetConsoleMode() can be quite slow and in mpv the mode never changes, so
we can just check it once.

Fixes performance when writing lots of logs to terminal.
2024-03-19 19:58:09 +01:00
nanahi 9a861c930b image_writer: fix TOCTOU in screenshot filename generation
The screenshot command is documented to not overwrite existing files.
However, there is a race window between the filename is generated with
gen_fname and when the file is open to write. Specifically, the
convert_image function in this window can be very time consuming
depending on video and screenshot image format and size. This results
in existing file being overwritten because the file writing functions
don't check for the existance of file.

Fix this be opening the file in exclusive mode. Add overwrite parameter to
write_image for other operations that are documented to overwrite existing
files, like screenshot-to-file. Note that for write_avif, checking
existance is used instead because avio_open does not support exclusive
open mode.
2024-03-19 19:30:27 +01:00
Dudemanguy b08822b8ce test/test_utils: add mp_msg_set_max_level stub
Needed since the previous commit.
2024-03-03 15:15:51 -06:00
der richter f9b8f156d7 test: add missing libplacebo dependency 2024-02-24 20:04:16 +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
Kacper Michajłow 19a6b84915 osdep/timer: update documentation and test for mp_time_ns
No longer true after 8bbcc87fee.
2024-01-26 03:28:55 +00:00
Kacper Michajłow 66e451f4e6 csputils: replace mp_colorspace with pl_color_space 2024-01-22 14:54:55 +00:00
nanahi 7ffd947830 win32: move IME candidate window to video window
By default the IME candidate window appears on the top left corner
of the monitor. Move it to the video window for sane behavior.
2024-01-15 16:06:06 +00:00
Dudemanguy cf27152991 test: update ffmpeg format refs
These tests should really be rewritten to be less stupid so they don't
break everytime ffmpeg updates its formats, but that's too much effort
right now. Bump the required libavutil version as well.

8e1ef7c38f
2023-11-18 20:46:11 +00:00
Kacper Michajłow 73fbe09a49 ALL: use pl_hdr_metadata and nuke sig_peak
This commit replaces all uses of sig_peak and maps all HDR metadata.

Form notable changes mixed usage of maxCLL and max_luma is resolved and
not always max_luma is used which makes vo_gpu and vo_gpu_next behave
the same way.
2023-11-05 18:57:36 +01:00
Kacper Michajłow 71e888c2a0 timer: remove unused code 2023-11-05 17:36:17 +00:00
Kacper Michajłow f75fe33da7 threads: rename threads.c to threads-posix.c 2023-11-05 17:36:17 +00:00
Kacper Michajłow 56d35da180 mp_thread: add win32 implementation 2023-11-05 17:36:17 +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 2f5f15039d test/meson: add missing libplacebo dep 2023-10-24 01:30:22 +00:00
sfan5 dad4e61b68 test: add basic tests for timer code 2023-10-20 21:30:51 +02:00
Dudemanguy bb036c67f4 test: change test_utils stubs to ns variants
The functions now internally use the ns timer and not the us one.
2023-10-16 15:38:59 +00:00
Kacper Michajłow d263087713 meson: don't link pthreads when internal impl is used 2023-09-29 20:48:58 +00:00
Kacper Michajłow d0e4eabb4e meson: add missing gl-video test dependency 2023-09-29 20:48:58 +00:00
Kacper Michajłow 40e0fea6eb timer: rename mp_add_timeout to reflect what it actually does 2023-09-29 20:48:58 +00:00
Kacper Michajłow da4c4d2ebd timer: rename mp_time_us_to_timespec to reflect what it actually does 2023-09-29 20:48:58 +00:00
Jan Ekström 10087b4086 test/meson: add missing avutil dependency to chmap test
Found out with a CI image where FFmpeg is not located in the default
sysroot.
2023-08-06 20:36:12 +03:00
sfan5 38b59408c2 test: indicate test function ran in log 2023-08-06 18:49:54 +02:00
sfan5 b68491e9a6 test: enable log messages for libmpv test 2023-08-06 18:49:54 +02:00
sfan5 5d71f858c2 test: refactor helper methods to be universally usable 2023-08-06 18:49:54 +02:00
Dudemanguy af9eac654e test: bump libmpv test timeout
Get rid of the time during the while loop and just let this run forever
in case of a failure and also bump the timeout in meson to 60 seconds
since we know it is possible for msys to take a very long time on
occasion. That should be plenty of time for it to finish.
2023-08-01 15:04:36 +00:00
Dudemanguy bb17d44835 test: enhance libmpv test
We already have a libmpv test, but it's really basic and barely does
anything. In an effort to hopefully prevent future breakage, lets expand
this to do more stuff. First of all, it simply tests setting a bunch of
properties/options. Secondly, it tries to load a file (the mpv icon that
we already have in the source tree). And then finally it tries the
lavfi-complex filter since this is a known special case where weird
things can happen.
2023-07-27 14:48:09 +00:00
cvzi f5eb7ea1a9 json: unify json_parse depth to MAX_JSON_DEPTH=50 2023-07-08 11:36:15 +02:00
cloud11665 b45be3d6e9 test/meson: explicitly specify lavf dependency
Added stubs for mp_set_avdict().
2023-07-01 02:05:23 +00:00
Harri Nieminen 292a5868cb various: fix typos
Found by codespell
2023-03-28 19:29:44 +00:00
Dudemanguy e1727553f1 test: update format refs to ffmpeg 6
Major release means new formats and failing tests so just add the new
stuff to the ref again and bump the minimum libavutil version. The last
ffmpeg commit that added a new format and is the minimum required
version for these subset of tests is referenced below.

479747645f
2023-03-15 00:25:11 +02:00
Dudemanguy 9db818279a test: integrate unittests with meson
This reworks all of mpv's unit tests so they are compiled as separate
executables (optional) and run via meson test. Because most of the tests
are dependant on mpv's internals, existing compiled objects are
leveraged to create static libs and used when necessary. As an aside, a
function was moved into video/out/gpu/utils for sanity's sake (otherwise
most of vo would have been needed). As a plus, meson multithreads
running tests automatically and also the output no longer pollutes the
source directory. There are tests that can break due to ffmpeg changes,
so they require a specific minimum libavutil version to be built.
2023-03-02 15:45:27 +00:00