Loading the file and then waiting it for it to be loaded again doesn't
need to be two separate functions. Combine it into a simple
"reload_file" so it's more readable.
This got refactored so it only loads one file at a time and not
everything in a loop. The option resetting at the end of conditional
branches is pointless.
The amount of options we have that are related track selection is insane
and touching any of this stuff is scary. Add some track selection
testing to the CI to hopefully make it slightly less scary to touch any
of that. Since trying to work in media files from some outside source
would be a pain and need to live in some repo somewhere, it's nicer to
just generate dummy files on the fly with ffmpeg during the ci runs and
use that. Obviously, the actual tests themselves could be even more
thorough (external tracks were not even considered), but this is more
than a good enough start for now.
The big libmpv test file is really actually three different tests shoved
together into one. They do all use fairly similar underlying structures,
so put the shared stuff into an inline header. There's a little bit of
duplication with regards to the main function, but it's cleaner to
separate out the tests.
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.
It's unfortunate that it is implemented this way since changing it will
take time. This option should *really* be like OPT_CHOICE but with
doubles and not integers. We don't have that though and implementing it
is something for the future. Even if that was done today, this still
couldn't be switched to since setting -1 has been the effective way for
years to undo video-aspect stuff. So the approach is to just add another
special keyword for this and tell people to use that instead. Note that
setting 0 isn't deprecated since M_RANGE(0, 10) is totally fine and
would work in the future if this option type ever gets redone.
Setting this to M_RANGE(-1, 10) meant that you could pass fractional
negative values without it being an error. This is, of course, nonsense.
-1 is the only special negative value with a meaning. Error out if we
get anything else by doing some additional parsing before we send it off
to parse_double which will then restrict the range to 0, 10 with these
changes. Note that this approach requires defval to be there which is
not the most extensible thing in the world. But there's literally only
two OPT_ASPECT type options out of the hundreds we have so not a big
deal. Ideally, this type should be OPT_CHOICE but with underlying
doubles but that's too much effort to implement cleanly.
These were still set to float. For some common aspect ratios (e.g. like
4:3), the loss of precision is significant. The underlying calculations
are already done with doubles so all that needs to be done is to change
the type of the sub-property.
The error message is completely incomprehensible and also inconsistent
about whether it wants two newlines or just one after an import.
Consider this python script:
import sys
sys.stdout.write("garbage")
That passes the ruff isort check just fine. But this does not:
import sys
def fake_function():
sys.stdout.write("garbage")
fake_function()
This will fail. Why? Because there should be two newlines after imports
but only for functions. This is because of PEP8 rules about blank lines,
but this is not explained or referenced anywhere in output from the
lint. You only get a cryptic "Import block is un-sorted or un-formatted"
with some visual that isn't clear in what it's trying to communicate.
Additionally, it seems to go a bit beyond PEP8 and also will fail if you
have too many blank lines (i.e. more than 1) in certain cases if the
succeeding line isn't a function or class definition.
Furthermore consider this example:
import os
import sys
from subprocess import check_output, DEVNULL
This also fails the lint. Why? Because DEVNULL should come before
check_output. Again, the lint doesn't explain this and you're left
guessing what horrible formatting sin you committed.
Considering the amount of time I wasted trying to even understand this
and I still don't, just delete it. How are contributors supposed to
understand what this lint wants when the project's own developers were
confused by it. Please just alphabetically sort your python imports and
don't do "from foo import *".
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.
While parsing through the separators, the OP_APPEND also needs to use 0
for the separator since it is supposed to be unescaped. This was missed
in the code reorganization of d2c409c56b.
Keyvalue lists were unaffected because only OP_DELETE and OP_REMOVE use
this code.
This update introduces a demux_packet_pool, allowing for the reuse of
previously allocated packets when needed.
sizeof(AVPacket) is not a part of the lavc public ABI, which prevents us
to allocate memory in larger blocks. However, we can substantially
decrease the amount of alloc/free operations during playback by reusing
both mpv's demux_packet and AVPacket.
This adjustment addresses the root cause of issue #12076, which,
although resolved upstream, did not fully tackle the persistent problem
of allocating small blocks of aligned memory. This issue largely stems
from the FFmpeg design of the AVPacket API. After this change memory
will no longer be allocated once cache limits is reached.
The demux_packet_pool is shared as a global pool of packets for a given
MPContext.
This change significantly speeds up the demuxer deinitialization,
benefiting file switching scenarios, especially when a large demuxer
cache is used.
See: #12294
See: #12563
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
And move show-text ${path} to middle click. This is more useful than the
replaced show-text ${filename} binding since the left click stats
binding already shows the filename, and it matches how right clicking
other buttons shows menus. Alternatively middle click could also be
bound to select-watch-later.
Property names contain '-' characters, which are translated into
underscores because POSIX shell variables cannot contain hyphens.
We should do the same thing for forward slash characters (i.e. '/')
because these also cannot be present in the names of shell variables.
Fixes: #15782
When playing a video, 55% of CPU used in strlen, callgraph flip_page: ta_talloc_strdup_append ,
ta_talloc_asprintf_append and ta_talloc_strndup_append .
Before the fix: 2 fps when playing 1080p 24 fps video (--vo-kitty-use-shm=no),
24 fps after the fix.
video/out/kitty: move bstr cmd to priv
Now that mp_normalize_path can accept NULL and we have a shorthand for
expand + normalize, now is a good chance to simplify this to make it
less awkward.
Expanding a path and then normalizing it is probably a common shorthand.
The reason to not incorporate this directly into mp_normalize_path is
because it requires the global struct which is out of scope for
path_utils so use this wrapper instead.
If a talloc_ctx was being made solely for a onetime usage of getting a
normalized string, we can now just pass NULL instead and free the string
directly to make things easier.
It is not needed to expand ~ in file completion as you type after
62c3aeb9c made commands themselves interpret it. We only need to call
expand-path on the directory before passing it to utils.readdir in order
to find files in it when it contains ~ placeholders. As a bonus this
will now also complete files in directories like ~~/ and ~state/.
This simplifies command completion, and was also the blocker for
splitting running commands out of console.lua, since I didn't know how
to replicate it through mp.input.
This reverts commit 86383aef95.
shutdown isn't actually sent on exit() but only with internal options,
e.g. set osc no, which isn't relevant for users.