FreeBSD supports only two latest minor versions, since 14.3 has been
released, packages for 14.1 are not longer available. Bump to 14.2,
since action doesn't have images for 14.3 yet.
Unknown duration subtitle handling must be executed on every decode
call, because we are actually adjusting the duration value of subtitles
that are decoded in the past. It should not only execute when the
newest packet has an unknown duration.
C11 uses _Thread_local as the keyword, which thread_local macro
is defined to (inside of <threads.h>, which mpv doesn't use):
https://port70.net/~nsz/c/c11/n1570.html#7.26.1p3
C23 promotes thread_local to a keyword and marks _Thread_local
as obsolete and to be avoided in new code:
https://www.iso-9899.info/n3220.html#6.4.1p3
so just use thread_local directly, which is future-proof while
having a fallback define in osdep/threads.h for pre-C23 cases.
Clients run in detached threads and are waited to signal when they are
finished with self mpv_destroy() call. Problem is that after detached
thread calls this function, mpv consider this client to be done and can
do whatever. One example is when mpv exits and wait for scripts to
finish we got race condition, because mpv (main thread) can exit first
and the detached thread calls ta_free() which crashes, because we may
have already destroyed things that the thread depends on.
I've seen this crash on FreeBSD CI job (libmpv-lifetime test), where the
libmpv.so has been unloaded while the thread was still doing ta_free()
```
==5081==ERROR: AddressSanitizer: SEGV on unknoun address 0x000001111806 (pc 0x000001111806 bp 0x7fffdedf4e40 sp 0x7fffdedf4e08 T40)
==5081==The signal is caused by a READ memory access.
#0 0x1111806 (<unknown module>)
#1 0x803cd6900 in ta_free /home/runner/work/mpv/mpv/build/../ta/ta.c:243:5
#2 0x803a2fc87 in run_script /home/runner/work/mpv/mpv/build/../player/scripting.c:93:5
#3 0x803a2ffe0 in script_thread /home/runner/work/mpv/mpv/build/../player/scripting.c:99:5
#4 0x2c451a in asan_thread_start(void*) /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28
#5 0x80034fb04 (/lib/libthr.so.3+0x10b04)
```
Note the 0x1111806 jump which is completelly bogus.
Fix this by doing mpv_destroy() as a last step in detached threads.
removes awkward back-and-forth int -> double -> int conversion.
the last step also broke uniformity, though it likely doesn't
matter much in mpv's playlist shuffle context.
c365e2f7 added av_random_bytes() to avoid multiple
threads/processes getting the same seed. but the fallback case
still suffers from it.
also mix in a function pointer, which hopefully is randomized
per process due to ASLR (20+ years old technology) along with
the stack position which will be different on different threads.
splitmix was used since it's recommended by the official xoshiro
site [0] as a "radically different" PRNG to avoid correlation of
similar seeds. av_random_bytes() is cryptographically secure
and so we don't have to worry about that. so just use it to
initialize the whole state.
[0]: https://prng.di.unimi.it/
mutex itself was probably more costly than the PRNG itself. and
locking PRNGs is almost universally not recommended. simply add
a state parameter that the caller can hold to avoid locks.
CMake has been updated to 4.0 which breaks compatibility with all
project targeting version < 3.5. See for more user stories:
https://github.com/actions/runner-images/issues/11926
Remove 4.0 from path and use the one from VS installation which is
working for now. Generally we want to use only tools from VS
installation, but unfortunately Windows image provided by GHA have
polluted PATH which already causes issues in the past, that's why we
remove yet another directory from PATH.
The affected project in our case is https://github.com/webmproject/sjpeg
which is build as part of libjxl.
The buffer size were never set to 0, after first call. To retrive the
size both buffer has to be NULL and size 0. Otherwise it fails.
While at it refactor whole thing and use returned count as sanity limit.
The size of the buffer was never set so the Get*PreferredUILanguages()
were just returning ERROR_INSUFFICIENT_BUFFER.
Fix the buffer size and use the returned count as sanity limit.
Fixes the test.
Currently we check AV_FRAME_DATA_DISPLAYMATRIX for its rotation factor
but not for its flip factor, which could happen with some input files.
This commit adds and autovflip filter, which is applied before the
autorotate filter to flip vertically before rotating. It also changes
the displaymatrix reading code to output to mp_image->params.vflip so
it can be autoinserted as necessary.
Signed-off-by: Leo Izen <leo.izen@gmail.com>
The playlist demuxer won't propagate the protocol forward to its entries
if its protocol is on a whitelist, for example data:// or memory:// etc.
This commit adds fd:// to that list because that should not be expected
to work.
Signed-off-by: Leo Izen <leo.izen@gmail.com>
After removal of `MP_MUTEX_RECURSIVE` from vdpau.c there are no more
clients of recursive mutex. Remove all the code related to it. This
commit can be reverted if in the future it is needed again. For now
let's not keep dead code.
FFmpeg recently got a hardware accelerated decoder for FFv1.
The decoder has been tested on all major vendors and operating systems.
Intel support is currently disabled as all of their drivers have issues
with buffer device addresses.
Since its a software-defined implementation, internal issues can be fixed
and the overall implementation optimized further.
With that, I think it should be safe to enable it by default.
And eliminate recursive lock. This doesn't have to be guarded by mutex,
if for some reason preemption happens while we are handling preemption,
we remember the flag and do the dance gain. This is even nicer than
locking preemption callback.
- `priv` is used as `talloc_ctx`/`ta_parent` in `bstr_xappend_*` calls.
- `free_bufs` no longer frees `priv->cmd.start`.
- `bstr_*_passthrough` functions have been stripped off the `bstr_x`
prefix.
In the past `strlen` was used in the write function, which omitted the
trailing NULL byte, however with the addition of `bstr` API the NULL
byte produced by `av_base64_encode` in the output is also written to
stdout, this causes terminals (namely Ghostty) to not display the frame.
There was also an additional edge case where if the entire output is
less than 4096 bytes the finishing escape sequence `\033_Gm=0;` was
never emitted. Adding a check for this after the for loop fixes this
behavior.
Terminal multiplexers like (screen, tmux, ...) do not support the kitty
image protocol (as of yet), to go around this DCS escape sequences are
used (`\ePtmux;...\e\` for tmux, `\eP...\e\` for screen). This option
allows passing thorugh the kitty image escape sequences.
`\033\\` suffixes from `KITTY_ESC_IMG_SHM` and `KITTY_ESC_DELETE_ALL`
have been removed. This makes it easier to wrap the escape sequences in
a DCS control sequence since there will be no `\033` in them to escape
(as multiplexers require escaping the escapes within the DCS data
string). `DCS_GUARD_WRITE` and `DCS_GUARD_APPEND` macros have been added
to wrap escape sequences in DCS control sequence based on the
availability of the `priv->dcs_prefix` property.
`priv->cmd.start` is being freed in `reconfig` without being allocated
again this caused a segfault if `flip_page` was called after `reconfig`.
This segfault could be triggered by sending a SIGWINCH (resizing the
terminal).
We used to deal more directly with drm-specific things, but that has all
since been removed and is known to not be needed. We can relax the build
requirements some more since vo_dmabuf_wayland will simply error out if
no hwdec backend is available at init.
MP_EVENT_INPUT_PROCESSED is used to notify mouse and touch position
updates, but it is currently notified for all input commands even when
they have nothing to do with mouse position. This results in unnecessary
acquisition and comparision of mouse and touch positions for all commands.
Optimize this by checking whether the command is marked as requiring the
event notification, and only notify if that is true.
Some properties can take a long time to query, especially those which
require voctrl like current-window-scale and display-names.
Similar to d37521b5ef, make the script
observe these properties and cache the values to avoid querying them
on every refresh. This alleviates the issue when holding down "i" key
for a while and releasing it results in stats being stuck on display
for a long time because of the time required to query there properties.
The messages referred to "no" prefixes like --no-audio not working with
the client API. The language was removed in
b1ee92ad4a.
Remove the messages which are bogus and incorrect now.