While the code before 571f9b0f23f31741f3c5947b839411acfefae3cf had a
typo and it was intended to be 100 MB, there are files that exceed this
limit, like 147 MiB. Increase the limit to 512 MiB which should be more
than enough for valid files.
From quick look ffmpeg limits to 1<<8 bytes, so we should be good with
our new limit.
In theory this limit could be removed, but it is better to play the
file, possibly with skipped some corrupted block of data, instead OOM.
Fixes: 571f9b0f23f31741f3c5947b839411acfefae3cf
tag_property() expect metadata to not be NULL on M_PROPERTY_KEY_ACTION.
M_PROPERTY_GET_TYPE can be skipped only if key is not queried.
Fixes: a05b847879dbb5d30bebf188562d16fa3e68ca70
Described in more detail in the upstream MR*. mpv naively rounds which
makes us susceptible to the mentioned error. Fix this by keeping
wl->scaling and wl->pending_scaling in the base 120 units. Use the
simple rounding algorithm when needed for calculating widths/heights.
Create a wl->scaling_factor as convenient shorthand for scale / 120
which is what wl->scaling used to previously be.
*: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/309
This allows playing arguments like
mf://https://foo.jpg,https://bar.jpg
and also URLs within @listfiles (files with 1 image per line).
URLs still don't work with globs and printf-formats.
On X11, aspect ratio constraint is applied on the window manager side,
so whenever keepaspect and keepaspect-window change, mpv should update
the size hint immediately, otherwise the new constraint isn't applied.
This change removes convoluted core thread extraction through dispatch
added in 500ce69a06.
Currently we fully control this thread, create it and join, there is no
reason not to keep the handle of it in the player context.
As a bonus to code simplification this also fixes thread handle leak on
Windows.
Fixes: #14472
This test:
- Checks if libmpv can be loaded dynamically.
- Checks for leaks after mpv context destroy.
- Checks if libmpv can be reloads after dlclose()
Window classes are global per process, but they are associated with the
module that registered them. Documentation is clear that it is the DLL's
responsibility to unregister its own classes:
No window classes registered by a DLL are unregistered when the DLL is
unloaded. A DLL must explicitly unregister its classes when it is
unloaded.
See: https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-registerclassw
Using a window class after the DLL is unloaded would result in access
violation errors. This is not that important for libmpv, where it is
unlikely someone would use the "mpv" window class externally. The real
issue comes from the fact that reloading libmpv would fail to register
the class (as it still exists) and consequently fail to create a window.
This commit fixes the operability of libmpv after reloading it.
Fixes: #11638
Client side cursors have always had some issues with fractional scaling.
However since we changed to using viewporter for cursor scaling, most
(or all?) of the problems can be fixed. Unfortunately, a scaling factor
was being truncated to int instead of kept as a double. This matched the
old behavior with buffer_scale, but it's better to use double so the
viewport is actually set to the correct size. Of course, none of this is
relevant if the compositor is using cursor shape.
Fixes f0a6578259Fixes#14001
When you type something in select mode and then delete it, table.sort
changes how selectable items are sorted. Restore the order specified by
the mp.input caller in this case.
- Remove the opts comments because they are already in console.rst and
will become outdated if not updated in both places
- Reuse last_pos in truncate_utf8() instead of recalculating the
previous character's position
- Clear the OSD earlier when the console is not active
The previous commit to avoid refresh seeking video streams has an edge
case when enabling tracks when loading files. Since the streams are
initially unselected and then multiple streams are enabled, the detection
only works reliably when video tracks are enabled first.
This makes sure that loading file enables tracks in a predictable order.
940854c86f added this logic, but when the
demuxer contains a selected video stream, it causes a seek for the video
stream. This is unnecessary since the problems that commit fixed are only
relevant for external audio streams. For a demuxer with a video stream
selected, the synchronization is done by the demuxer implementation.
Add a check to prevent this.
This follows up 96e1f1dfa5 which converted --gpu-context, and has the
same advantages as listed there.
Unlike with --gpu-context auto can be used anywhere in the list, e.g.
--gpu-api=d3d11,auto works.
I wanted to use the list of GPU contexts as the description in
get_type_desc(), but there is no talloc context to allocate it to, so I
set a print_help_list to print them. The APIs go before the contexts so
that etc/_mpv.zsh doesn't try to complete the contexts.
This function is used to reject invalid context names early, and without
it the context fails to create and only audio is played, but it doesn't
need to check for known entries again.
We wrap the default Lua allocator to allow used memory tracking. This
works well, except that we never destroy the default allocator or notify
it that we are closing. Since we override it for the current Lua state,
it is reasonable that the Lua engine does not expect it to be used. We
get and pass through a free call, but in the case of LuaJIT, the
internal allocator has additional state and is freed differently. So, in
fact, it is a LuaJIT leak because once we replace the allocator with our
custom one, they should clean its internal state. I guess the assumption
is to override allocator only before any allocation happen. To work
around this issue, restore the default allocator, the one that we use,
before closing the state. This way, everything is cleared as expected.
Note that the current solution of wrapping the default allocator works
only because none of the supported Lua engines actually invalidate the
allocator on the lua_setallocf() call. However, they could, so keep in
mind that we are currently depending on an implementation detail.
Thanks to @Dudemanguy for help with finding the changes that introduced
the leak.
Fixes: a67bda2840Fixes: #14451
Mainly for debugging. It might be handy to disable presentation feedback
on wayland to make sure something isn't going wrong with the
calculations somewhere.
Before a7158ceec0, string comparision was
done with strcmp, which does unsigned comparison. The natural sort
implementation instead compares on char values.
This causes implementation-defined behavior in comparison, depending on
the signedness of char type.
Fix this by using unsigned comparison instead.