Commit Graph

1005 Commits

Author SHA1 Message Date
sfan5 608b430b56 TOOLS: remove obsolete travisCI-related scripts 2023-07-19 13:01:08 +02:00
Dudemanguy 6ed521fd14 TOOLS/idet: fix some outdated cli syntax
d3cef97ad3 changed the way the command
line was parsed and syntax like "--foo value" stopped being considered
valid. This old script still was using the old syntax and thus was
broken. Update it to "--msg-level=ffmpeg=v" which is the recommended
syntax. Fixes #11892.
2023-07-06 22:40:51 -05:00
llyyr 9ad14e0886 TOOLS/lua/autoload: allow extending ext sets from script-opts 2023-07-06 13:42:54 +00:00
Eva 3ba446d0b0 TOOLS/lua/autoload: avoid unnecessary playlist manipulation, performance
We used to sort the playlist with playlist-move after every loadfile.
Instead, append all files in order and call playlist-move once to move
the only entry we don't control the position of.
Don't fetch every playlist item separately, reuse native property.
We used to pick up on new files added to the directory, but only when
playing an entry at the edge of the playlist due to an early return.
New files are now added to the playlist on every file change.
This still works as expected and doesn't load duplicate files on
shuffled playlists or playlists with files manually added after autoload

33% faster on average for my test directory with 1371 files.
2023-07-03 02:41:58 +00:00
Thomas Weißschuh 707554324a TOOLS/docutils-wrapper: handle commands without depfile 2023-03-24 02:18:39 +00:00
Thomas Weißschuh 375e527620 TOOLS/docutils-wrapper: properly propagate failures 2023-03-24 02:18:39 +00:00
Thomas Weißschuh d6f70ef96b TOOLS/docutils-wrapper: gracefully remove non-existing files 2023-03-24 02:18:39 +00:00
Guido Cella 0772d0263c TOOLS/autocrop.lua: log a more accurate warning
This reorders some code and checks the image track-list sub-property
instead of the albumart one, so that when playing audio without enough
playtime-remaining and images, the "autocrop only works for videos."
warning is logged instead of the "Not enough time to detect crop." one.
It also avoids repeating this warning twice in the code.

As of e16d0dd15d current-tracks returns a video track even when
lavfi-complex is used, so the track-list loop in is_cropable can be
replaced with just checking current-tracks/video while still cropping
videos with lavfi-complex.
2023-02-27 17:03:38 +00:00
Kacper Michajłow bc1af592db ci: migrate MSYS2 build to GitHub Actions 2023-01-28 01:03:12 +00:00
Christoph Heinrich 7b09bf7ffc TOOLS/lua/autoload: improve alphanumeric sorting
Currently filenames like `EP.1.v0.1080p.mp4` do not get sorted correctly
(e.g. episode 11 right after episode 1). That is caused by the `.` in
front of the episode number, making it get sorted as if it were
decimals.

The solution is to match the whole real number or integer instead of
matching the integer part and the fractional part separately.

This will regress sorting of numbers with multiple commas where the
length of the individual segments differs between filenames.
Since those are rather uncommon, that is unlikely to be a problem (for
anyone ever).
2023-01-15 16:45:24 +00:00
Dudemanguy 73581d8fe6 TOOLS/docutils-wrapper: make executable + alphabetize
I should have caught this during review but the feature was too cool and
I didn't really pay attention (sorry). For consistency with the rest of
the scripts here.
2023-01-13 10:13:39 -06:00
Christoph Heinrich de9f375a23 TOOLS/lua/autoload: optimize performance of natural sorting
Formatting the string on each comparison is wasteful.
Formatting strings beforehand and then comparing the already formatted
ones leads to a huge performance gain.
2023-01-09 15:01:17 +00:00
dyphire 444bcd43b7 TOOLS/lua/autoload: further optimize the natural sorting
Commits 257dbdf06f uses a algorithm of splitting strings
into a table of number and string values to achieve natural sorting.
This approach works well in most cases, but it does not work well
in some specific scenarios.
Now let's implement natural sorting with a stronger algorithm.

Also fixes indentation.

Ref: 3cf323f3c4
Closes https://github.com/mpv-player/mpv/issues/8969
2023-01-09 15:01:17 +00:00
Thomas Weißschuh 8a0fa62b58 meson: dynamically compute dependencies for manpage and html build
This allows us to rebuild the manpages and html documentation only when
necessary. It is not necessary to manually keep the list of dependencies
up to date.

Unfortunately rst2pdf does not yet support this feature, see
https://github.com/rst2pdf/rst2pdf/issues/1108
2023-01-08 01:55:40 +00:00
sfan5 c8a90001f2 TOOLS/umpv: support shell-quotes in $MPV 2023-01-07 13:16:03 +01:00
SuperSamus 3624a9d3e6 TOOLS/umpv: prefer $XDG_RUNTIME_DIR 2022-11-28 21:08:55 +00:00
dyphire 4bc6686b6a
TOOLS/lua/autoload: fix incorrect duplicate file loading behavior
This will correctly avoid the duplicate file loading when the playlist
changes due to shuffle playback or append new files.

Fixes https://github.com/mpv-player/mpv/issues/8575
2022-10-24 01:34:39 -04:00
Leo Izen 56e24d535e TOOLS/lua/autoload: add various extra file extensions
Add to autoload.lua several extra file extensions that are
unambiguously for media files.
2022-09-23 15:50:57 -04:00
Leo Izen a6d544d6a6 TOOLS/lua/autoload: alphebatize auto-loaded file extensions
Alphabetizing the extensions cleans up the code and makes it less
ambiguous where newer extensions should be added. The video line
also was wrapped to 72 characters for cleanliness.
2022-09-23 15:50:57 -04:00
DeadNews 750b58a5a3 TOOLS/lua/autoload: add `m2ts` extension
* `.m2ts` used for the Blu-ray disc container file format
2022-09-14 14:49:00 -04:00
The-head-obamid 4c431c8ad6 osxbundle: add RIST protocol support to app metadata 2022-08-18 11:33:50 +02:00
Guido Cella fe9e074752 various: remove trailing whitespace 2022-05-14 14:51:34 +00:00
Cœur bb5b4b1ba6 various: fix typos 2022-04-25 09:07:18 -04:00
Dudemanguy 94950b1b22 TOOLS/matroska.py: support outputting to file
Like the previous commit, it's better to just output it to a file for
meson.
2021-11-14 19:13:10 +00:00
Dudemanguy f7fab994eb TOOLS/file2string.py: support outputting to file
Another modification for the upcoming meson build. Meson can capture the
stdout and redirect it to a file. However, this is considered a hack.
It's better to just add a few lines to this script and write a file
directly.
2021-11-14 19:13:10 +00:00
Dudemanguy c698575c57 TOOLS: add macos-swift-lib-directory.py script
Apple is great and forces us to do a lot of weird checks because they
randomly move the location of the swift libraries around. Make a
specific python script for checking various locations and write the
output to stdout for meson.
2021-11-14 19:13:10 +00:00
Dudemanguy be536dd45a TOOLS: add macos-sdk-version.py script
Building for macos requires us to check the macos sdk path as well as
the sdk version that is on the system. To do this, let's steal the logic
that's in the compiler_swift.py check from the waf build. This returns a
comma-delinated string. The first entry is the absolute path to the sdk.
The second entry is the detected macos sdk version.
2021-11-14 19:13:10 +00:00
Guido Cella 6fe4fc4593 TOOLS/autocrop.lua: allow hiding OSD messages
Because having these on every video is annoying, and when you resume
from watch later files, the filters are applied immediately so they hide
your osd-playing-msg or equivalent show-text commands.
2021-07-27 20:32:05 +03:00
Kiracus 1e90ec647c osxbundle: use python3 2021-07-17 00:08:54 +02:00
Guido Cella 075154175d TOOLS/autocrop.lua: improve enable/disable condition
The previous code tried to disable autocrop for cover-art by testing
that track-list/$vid/albumart is false, however, $vid is completely
unrelated to the track-list index.

It only sometimes succeeded to disable for albumart, by accident,
e.g. with one audio track and one video track where $vid==1 and
track-list/1 happens to be the video (cover art) track.

The new code detects the currently-used video track by finding a track
with type=="video" and selected==true. Unlike the previous code, it
also works in scenarios with many audio/video/sub tracks.

Additionally, autocrop is now enabled also with lavfi-complex, which
should be considered an improvement. The previous code implicitly
disabled it with lavfi-complex because $vid is nil on such case.
2021-07-14 11:58:29 +03:00
LaserEyess ee27629244 TOOLS/lua/autoload: load files even if current file is hidden
When the current file is hidden and `ignore_hidden` is true,
autoload will skip loading other files in the current directory. Make
sure that the current file is always counted for autoloading even if it
is hidden.
2021-06-24 13:13:53 +00:00
LaserEyess 28c53dbfa0 TOOLS/lua/autoload: add ignore_hidden option
In 8a7614a0fb files that start with a '.'
were blacklisted from autoload.lua. Since then
35e8710b86 was introduced and explicitly
whitelisted file extensions. With this change, there is no longer a
reason to blacklist all files starting with '.', because it is valid to
have a file called '.hidden.mkv', and there is no chance of hidden files
such as '.bashrc', '.DS_STORE', '.gitignore', etc. being autoloaded by
mpv.

This commit tries to keep the same behavior as before, which is to by
default not load hidden files, but allows the user to optionally allow
hidden files to be autoloaded.
2021-06-24 13:13:53 +00:00
der richter 9fbe000451 osxbundle: fix slow and wasteful memory allocation
when using the bundle with activated big enough cache, very slow and
wasteful memory allocations lead to jittery playback and lot of dropped
frames. the cache had to have a certain size so it would constantly
allocate new memory to reproduce this. this never happens when started
from the terminal.

the source of the problem is a different malloc allocation policy,
MALLOC_NANO, that allocated a huge amount of virtual memory without
actually using it. the usage was between 0% to 25% of that virtual
memory. the binaries allocation policy on the other hand used >80% of
that allocated virtual memory and was a lot more efficient, it would use
MALLOC_TINY instead.

this is fixed by setting the MallocNanoZone environment variable to 0
to use the V1 of the allocation policy. when started from the bundle via
launchd this is forced to 1 and V2 policy which causes this problem.

some more info can be found in following file and its comments on the
Apple open source site:
https://opensource.apple.com/source/libmalloc/libmalloc-317.40.8/src/nano_malloc_common.c.auto.html

Fixes #7405
2021-05-16 13:50:40 +02:00
sfan5 10d68d06e6 build: move website rebuild into Linux/clang travis job
The mingw ones will be removed in the next commit.
2021-05-16 01:55:37 +03:00
jimman2003 aac1844179 umpv: Use generator expression for files
Instead of list. potential memory savings.
2021-03-03 21:35:33 +02:00
Biswapriyo Nath b95c7dd6cc appveyor: Use MSYS2's spirv-cross package instead of building it 2021-02-23 01:38:39 +02:00
Jim Manos 5edf22d2e9 umpv: remove unused imports
* fcntl usage was replaced by socket usage in
  518bd4c306
* stat usage was removed in 51a3f13705
  as the socket was created under the user's HOME.
2021-01-19 22:44:59 +02:00
James Ross-Gowan 2bc88a2936 appveyor: use MSYS2 shaderc package
There's a shaderc package in MSYS2 now. Using it should shave ten
minutes off the appveyor build.
2020-12-19 23:46:16 +11:00
LaserEyess 8886f017a1 matroska.py: remove python2 support
Since 0.33.0 mpv does not support python2. This commit removes
python2 support from the file completely with the following
changes:

 - __future__ import of print_function is python2 only
 - unicode literals are legacy in python3
 - 'sys.version_info.major < 3' check is redundant
2020-11-27 11:17:29 +01:00
sfan5 6bb73040dd file2string: remove question mark from safe chars
Trigraphs such as "??=" (which are enabled by default with -std=c11)
can mess up strings, so avoid them entirely by escaping question marks.

This also drops Python 2 compatibility from file2string, making the
change to the waf rule necessary. The input file is now opened in
binary mode which is also more correct versus the old text mode
which just happened to work even on binary files.
2020-11-22 17:16:57 +01:00
Alexandre Iooss 75acc04262 stream_lavf: enable SRT protocol support through FFmpeg
Additionally, announce support for the protocol in Mac and Linux
application metadata.
2020-10-15 23:53:33 +03:00
wm4 e27c523a10 command: extend subprocess command stdin, change behavior
Make it possible to feed a string to stdin of a subprocess. Out of
laziness, it can't be an arbitrary byte string. (Would require adding an
option type that takes in a Lua byte string.)

Do not set stdin of a subprocess to fd 0 (i.e. mpv's stdin) anymore,
because it makes things more consistent. Enabling stdin didn't make too
much sense in the first place, so this behavior change seems
justifiable.

win32 support missing.

Fixes: #8003
2020-08-16 02:54:44 +02:00
wm4 45cc47a68b TOOLS/file2string: change to python3
The same was done to matroska.py before, so at least it's consistent.
Doesn't matter for waf, because it imports this script (rather than
executing it).
2020-08-12 17:21:49 +02:00
ヒカリ 376aea36eb TOOLS/autocrop.lua: automatically crop at startup 2020-06-01 23:07:26 -07:00
wm4 eeb711f5f3 umpv: convert to python 3
Sigh.
2020-04-03 12:57:24 +02:00
wm4 518bd4c306 umpv: change from legacy FIFO to socket
--input-file is deprecated, and the JSON IPC is saner anyway.
2020-03-28 00:38:29 +01:00
Jan Ekström 038f2213e1 ci: remove libass enablement
This is no longer a configurable option.
2020-03-22 14:33:41 +02:00
wm4 ba70b150fb client API: provide ways to finish property changes on file changes
When the current file changes (or rather, when starting/finishing
playback of a playlist entry), clients tend to have the problem that
it's hard to tell whether a property change notification (via
mpv_observe_property() and mechanisms layered on top of it) is from the
previous or new playlist entry. The previous commit probably helps, but
all the asynchronity is still a bit unhelpful.

Try to make this better by adding new hooks, that are run before/after
playback init/deinit. This is similar to the existing hooks, except
they're outside of "initialized" playback, which excludes that you might
accidentally get an overlap between the current and the previous/next
playlist entry.

That still doesn't seem quite enough, since normally, property change
notifications come after the hook event. So basically a client would
have to explicitly "drain" the event queue within the hook, and make the
hook continue only after that is done. Knowing when property
notifications are done is another asynchronous nightmare (how exactly it
works keeps changing within client.c, and an API user probably can't
tell anymore when all pending properties are truly done). So introduce
another guarantee: properties that were changed before the hook happens
will be returned before the hook event is returned. That means the
client will have received all pending property notifications from the
previous playlist entry (or whatever) before the hook is entered.

As another minor complication, we shouldn't just keep the hook pending
until _all_ property notifications are done, since the client's hook
could produce new ones. (Or just consider things like the demuxer thread
hammering the client with cache update events, while the "on_preloaded"
hook is run.) So there is some extra untested, fragile logic in client.c
to handle this (the waiting_for_hook flag).

This probably works, but was barely tested. Not sure if this helps
anyone, but I think it's fine for my own purposes. (I really hated this
aspect of the API whenever I used it myself.)
2020-03-07 02:52:10 +01:00
wm4 7a76b577d8 command: extend osd-overlay command with bounds reporting
This is more or less a minimal hack to make _some_ text measurement
functionality available to scripts. Since libass does not support such a
thing, this simply uses the bounding box of the rendered text.

This is far from ideal. Problems include:
- using a bitmap bounding box
- additional memory waste and/or flushing caches
- dependency on window size
- odd small deviations with different window sizes (run osd-test.lua and
  resize the window after each timer update; the bounding boxes aren't
  adjusted in an overly useful way)
- inability to query the size _after_ actual rendering

But I guess it's a start. Since I'm aware that it's crap, add a threat
to the manpage that this may be changed/removed again. For now, I'm
interested whether anyone will have use for it in its current form, as
it's an often requested feature.
2020-03-06 18:20:11 +01:00
wm4 d45d4f86e1 skip-logo.lua: remove lua 5.2 warning message
(OK, I tested it.)
2020-02-29 21:49:14 +01:00