It can be too easy to change the video position without a single way to
undo the change. Also, this is mostly useful for images. Binding can be
brought back in a better way with an image profile or another method
that is more resistant to accidental clicks.
This reverts commit e98d3b62ec.
Fixes VO thread busy looping in paused state for untimed VOs.
One example is vo_lavc (encoding mode), used commonly to extract
thumbnail by scripts.
Example command that was affected:
mpv --ovc=rawvideo --of=image2 --ofopts=update=1 --o=test --pause
file.ext
We have to update request_redraw value to not redraw again. This has
been skipped by early exit before.
This also fixes VO_CAP_NORETAIN case.
Fixes: 8798cec7fa
The conversion is done to DXGI_FORMAT_B8G8R8X8_UNORM, this was tagged
as IMGFMT_RGB0 because vo_gpu didn't understand that B8G8R8X8 needs to be
sampled differently. This is fixed now, so we can tag the image with the
correct format.
Fixes output with dxva2 for gpu-next
(after https://github.com/haasn/libplacebo/commit/bbe63109cba2ef5c7e6aea1c47d5f6994b6dc71c)
and gpu (after previous commit).
Will fail with older libplacebo, but there is no reason to use dxva2
anyway. d3d11va is available on all supported platforms and is bit-exact
unlike dxva2 which always does conversion to 8-bit BGR.
Also note that libplacebo was broken with all BGR inputs up until
recently, and only because it was working the same as vo=gpu, the issue
was canceling out.
Those properties are already observed and trigger update, remember the
value to avoid re-fetching them.
This fixes delay caused by properties that synchronize GUI thread like
`focused` which takes 30+ ms in certain cases.
Co-authored-by: Guido Cella <guido@guidocella.xyz>
14-17 Data length in samples (binary, Little Endian)
This has been validated with sample generated with:
ffmpeg -i $(ffmpeg_fate)/lossless-audio/luckynight-partial.tak -c:a tta lucky.mka
The length is correctly calculated to be 418950 for that sample.
Basically this is a port of https://github.com/FFmpeg/FFmpeg/commit/af248fa1174200acb537a6ab1198bb2fed38e884
Fixes: d53d75e080
add_tl() when creating virtual_stream list is referencing sh->codec
which is owned by the demuxer. Don't close it to avoid dangling
pointers. The comment is right, but this happens regardless of
delay_open as we can clearly see in the add_tl() function.
It has been moved to the mpv core with additional security
considerations, including filtering unsafe protocols from being opened
via the URL handler.
While we are not aware of any active exploitation, naive protocol
handling could allow the use of niche protocols in FFmpeg, which, in
turn, might load native code. How such native code would be dropped on
the local machine is another question.
This remains theoretical, but it's better to be safe than sorry.
Fixes: 494d408583
This is useful to run mpv from URL handler. Can be used to start mpv
from you web browser or anything that would trigger url handler for
given protocol. Only safe protocols are allowed.
Current solutions to run mpv in such context are to spawn IPC proxy and
run mpv when requested, but this is in most cases not necessary.
Currently the protocol is added in mpv.desktop. Windows related
registration will follow in future changes.
This increases the priority from 50 (which is neutral) to ensure that
profiles are applied before other scripts.
In general, applying profiles before other scripts makes sense. This was
already the case for external scripts with default priority because they
would load after auto_profiles.
This commit primarily fixes ytdl_hook.lua to respond to profile changes.
In most cases, profile conditions are triggered by external conditions,
not the output from the ytdl hook, so this is fine.
I acknowledge that this will change the order if a script previously had
a priority lower than 50. However, injecting itself before profiles are
evaluated is a very obscure use case, if there is even a valid one.
This is required for creating a copy texture. Note that alignment is
applied only when making a copy; if mapping the texture directly, the
native texture size is used as-is. The texture itself may be larger
depending on the coded dimensions, but we only copy the "interesting"
part of the image.
Fixes playback of videos with odd dimensions.
Make sure the `early` variable is boolean. The issue was that if url have
`ytdl://`, find() would return position `1`. This makes `early` also `1`.
And now we try to compare `early == load_fail`, which for `1 == true` is
false, while we expect it to be true. Make sure we compare booleans.
Fixes unnecessary hook processing when using ytdl:// protocol.
This assert won't give much more information than the abort() itself. We
just want to abort on OOM there is not much to debug here. talloc macros
also doesn't add an assert.
It is easy to craft a config file that loads a profile recursively. To
prevent this, not only check the depth of the current inclusion but also
ignore already-seen profile names.
When a stream is not set to passthrough and there is no data to read or
write, a handle to the NUL file is created. However, these handles were
not included in the list of inheritable handles for the child process.
This commit ensures they are properly inherited.
Fixes: 83fec9bafbFixes: #15982
This ensures a clear separation between public and private headers. It
also makes it clear in Meson and prevents the accidental use of private
headers.
This is only needed for spawning main mpv process, there is no need to
spin CRT just to call main() and support basic memcpy.
Additionally adjust compilation flags to reduce the size of mpv.com.
This is the small binary using only kernel32 as dependecy now.
Stripped mpv.com built with clang 19.1.7 (x86_64-w64-windows-gnu)
Before:
text data bss dec hex filename
6982 7281 0 14263 37b7 mpv.com
After:
text data bss dec hex filename
1094 2894 0 3988 f94 mpv.com
Depending on compiler and options the size may vary. For example with
-flto and -Wl,-gc-sections it is:
text data bss dec hex filename
833 750 0 1583 62f mpv.com
but gc-sections were rejected as an default option before.
As a bonus add some error checking to this code.
No need for pointless prefix, print error directly. Don't use CRT
function. This will write only to console, but it's not meant to be
written to file anyway.
We hit a -Wstrict-prototypes error which was fixed in the latest release
of libcdio-paranoia but openbsd is too old. We already have coverage of
this in other CIs so remove it.
The same as 04a2450aab, but now cdda is
auto detected, so disable it explicitly.
Notably they are exchanged between demux and decode thread. It's fine
because we know those pointers will be alive as long as avctx is alive.
And only the value may change during decoding in rare situations. Make
those pointers atomic for the sake of it.
It shouldn't change anything, except some codegen.
From https://www.gnu.org/software/libc/manual/html_node/Atomic-Types.html#Atomic-Types:
In practice, you can assume that int is atomic. You can also assume that
pointer types are atomic; that is very convenient. Both of these
assumptions are true on all of the machines that the GNU C Library
supports and on all POSIX systems we know of.
mpv internally treats all string options/properties with NULL or an empty string the same way. client.h explicitly forbids MPV_FORMAT_STRING from being NULL, but in the C API, it has been working accidentally due to how strings are copied. Nevertheless, none of the APIs allow this; JavaScript, Lua, IPC, and CLI all require strings to be at least empty. We cannot pass NULL.
Furthermore, currently passing NULL causes an assertion failure in the JSON formatter, so it is clearly not intended to be used that way.
Internally, all string options default to NULL, but in this case, they should behave exactly the same as an empty string. Hence, this change is applied to the `demuxer-lavf-format` option.
Note that get_property will never return a NULL value, regardless of the internal value.
Fixes: #15840
HDR or any color-space pass-through should be opt-in, as we cannot
control the user's compositor or display. Allowing HDR signals to be
pushed by default may lead to surprising results for some users.
Additionally, for an optimal experience, this option should be paired
with the target-peak of the display.
Make the pass-through opt-in and let the user decide if they want or
need it. By default, mpv should render a safe and consistent sRGB
output. mpv's tone mapping is generally of higher quality than any
external solution.
This reverts commit 23843b4aa5.
This is not only cosmetic, but also avoids dummy get key action with
empty key. While this was allowed previously, I'm bit concerned about
Hyrum's law. But let's be strict about it.
This commit fixes current-tracks property.
Fixes: 95019fc256
Updating input-commands string list causes all commands to be rerun.
This happens during load-config-file command, so even with few commands
it is easy to amplify single command to run hundreds of times instead of
one. This causes timeouts and OOMs when specific command for example
reopens current playlist appending an item.
Also avoid even single input-commands, we want to test load-config-file
parsing and input-commands can do loadfile and trigger heavy code
paths. We don't want to mix this. Unfortunately parsing of
input-commands will not be tested.
If the cloned repo is shallow (e.g. like the default github actions
settings), the git describe command won't actually be able to fetch any
tags and will instead just get a hash. The resulting binary version
string will end up being that git hash. While it does tell you the exact
commit, it's not exactly helpful when wanting to know the general
version at a glance. For the case where we do have a git directory but
no available tags, build a version string using the mpv version + the
commit hash.
Fixes#15789.