summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* and anotherabsurd_test3wm42020-02-081-1/+1
|
* ...absurd_test2wm42020-02-081-1/+1
|
* actually...absurd_testwm42020-02-081-1/+1
|
* absurd buffering testwm42020-02-081-3/+95
|
* wayland: adjust vo_wayland_wait_frame logicDudemanguy2020-02-071-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Wayland uses vo_wayland_wait_frame plus some polling with a timeout for blocking on vsync. Here are a couple of changes that seem to be improvements. First, the poll time is always rounded up instead of truncated. When rendering frames longer than the standard 16.666 ms timeout, it seems that truncating the poll time slightly early may cause some vsync jitter spikes. Waiting longer, even if it's too long, appears to behave better. The second change is to use wl_display_roundtrip instead of wl_display_dispatch_pending. wl_display_dispatch_pending dispatches all events immediately. This is good to avoid blocking, but it's not guaranteed to wait long enough for all events to be processed on the display fd. The preceding wl_display_read_events routine ensures that all events on the display fd are queued. We just need a semi-blocking routine to dispatch them for the most reliable vsync. wl_display_roundtrip will dispatch any events for us, but also wait for a reply from the display server. This makes it ideal for this role. If the compositor doesn't reply to the client something else is probably horribly broken and wrong anyway. It's also not a permanently blocking call like wl_display_dispatch. If there's no frame callback (i.e. the window is hidden), then it does not dispatch any events and returns immediately.
* DOCS: js: minor update for requireAvi Halachmi (:avih)2020-02-071-5/+5
|
* js: require: directory-scripts: first look at <dir>/modules/Avi Halachmi (:avih)2020-02-074-1/+16
| | | | | Also, add the function mp.get_script_directory() to let scripts know if they're loaded as a directory and where.
* js: require: don't use ~~/scripts/modules.js/Avi Halachmi (:avih)2020-02-072-12/+26
| | | | | | | | | Directories inside ~~/scripts/ are now loaded as scripts, so don't use it also for modules. Now there are no default module paths. To compensate, we now try to run ~~/.init.js right after defaults.js, so the user may extend the js init procedure via this script, e.g. for adding default paths to mp.module_paths .
* osc: use cache state cache-duration fieldwm42020-02-071-1/+1
| | | | Avoids an additional property access; see previous commit.
* command: add cache-duration to cache state propertywm42020-02-072-0/+6
| | | | Convenience; see following commit.
* demux: add option to disable "sharing" between back and forward bufferswm42020-02-072-2/+18
| | | | | | | As requested. I guess option name and manpage text could be better and clearer. Closes: #7442
* console: fix typo in previous commitwm42020-02-071-1/+1
| | | | Now keypad enter actually works.
* console: manually map numeric keypad (KP*) bindingswm42020-02-071-0/+7
| | | | | | | | | | | | | | | While mpv normally uses the text a key produces (as opposed to physical key mappings), this is different with the keypad. This is for the sake of making it possible to distinguish between these keys and the normal number keys on the left side of a full size keyboard. There were complaints that the keypad doesn't interact with console.lua, so manually map them. This ignores numlock (behaves as if it's always on), and maps KP_DEC to "." (even though it's mapped to "," on some keyboards). The /*-+ keys produce ASCII on mpv (at least with X11) as an inexplicable inconsistency, so there are no mappings for these. Fixes: #7431
* screenshot: fix typo in commentwm42020-02-071-1/+1
| | | | | It was not meant to imply that screenshots are male. Female (and other) screenshots are also welcome to this project.
* player: make screenshot each-frame mode more accuratewm42020-02-074-5/+11
| | | | | | | | | | | | | | | | | | | | | | | Due to asynchronicity, we generally can't guarantee that a video frame matches up with other events such as playback time change exactly (since decoding, presentation, and property update all happen at different times). This is a complaint in the referenced bug report, where screenshot filenames in each-frame screenshot did not use the correct timestamp, and instead was lagging behind by 1 frame. But in this case, synchronicity was already pretty much forced with wait calls. The only problem was that the playback time was updated at a later time, which results in the observed 1 frame lag. Fix this by moving the place where the screenshot is triggered in this mode. Normal screenshots may still have the old problem. There is no effort made to guarantee the timestamps absolutely line up, same as with the OSD. (If you want a guarantee, you need to use a video filter, such as libavfilter's drawtext. These will obviously use the proper timestamp, instead of going through the somewhat asynchronous property etc. system in the player frontend.) Fixes: #7433
* options: disable vsfilter blur compat by defaultwm42020-02-072-2/+2
| | | | | | | | | | | | | | | | | | | See #7435 and related for context. Basically, it seems that while the original vsfilter processed subtitles like with this option set to "yes", many current players (mpc-hc default, vlc, probably most libass users) treat them like with "no". In the linked issue, this makes rendering severely slower, and can consume a lot of memory (or just overflow libass memory calculations). It seems that changing this to "no" will lead to more good than bad, especially because newer subtitles may be authored for the "no" behavior. Most libass users seem to use "no" exactly because they do not call ass_set_storage_size() at all. This API was needed because the scaling of the subtitles depends on the video size (vsfilter bugs, or something). In addition, it's my personal opinion that rendering should not depend on the video at all, so I like setting the default of this to "no".
* lua: fix typo in commentwm42020-02-061-1/+1
|
* options.lua: avoid unnecessary on_update callsOscar Manglaras2020-02-061-1/+1
| | | | | | | The script was set up to only call on_update when the changelist was non-empty. However, since the size operator does not operate on dicts, it always returned 0 (which is truthy), thus on_update would always be called when the script-opts property changed.
* stats: fix incorrect ass formatting on 3rd page when vo was switchedsfan52020-02-061-0/+1
| | | | | | When switching between having a video visible or not, stats.lua now picks up the required formatting changes for the cache stats page to display correctly.
* scripting: give proper name to scripts using a directorywm42020-02-061-2/+8
| | | | | | | | | | | | | | | | | The recently added feature to load scripts from a sub-directory. A problem was that the script name was still derived from the actual script source file that was loaded, which was always "main.lua" (or similar), resulting in "main" as name. Fix this by using the directory name. One odd corner case is that you can do "--script=/path/foo////". As by POSIX semantics, the extra "/" are ignored. However, the newly added code strips only one separator, so mp_basename() returns "" (as it should), and the empty name makes mp_new_client() fail in turn. I don't really care about this, just don't do it. But mp_new_client() failure was silent (since it normally never happens), so add at least an error message for that, instead of being entirely silent.
* wayland: toplevel config fixesDudemanguy2020-02-062-3/+18
| | | | | | | | | | | | | | | | | | | | | | | There were a couple of erroneous things in the handle_toplevel_config function. Firstly, looping through the different states was not handled correctly. Launching a window as maximized (can happen in sway for example) was always stuck on true and would never be set to false. Fix this by always checking if XDG_TOPLEVEL_STATE_MAXIMIZED is found or not. Also do a similar thing for the fullscreen state. Additionally, there were some issues with resizing windows and window-scale going back to old sizes. The root of this problem is that the width and height arguments of handle_toplevel_config aren't actually guarenteed to be the actual width and height of the surface. There are times when mpv will set the surface size on its own (like with window-scale) which will be unknown to the toplevel listener. To complicate matters, there are times when we do want to use the width and height arguments (like when resizing with the mouse). Fix this by checking if the width and height arguments reported by handle_toplevel_config changed from the previous call of the function. If the value is different, then we go ahead and use them when setting mpv's geometry. If not, then we just ignore it.
* lua: use mp_path_is_absolute() for checking package pathswm42020-02-061-1/+1
| | | | | This makes it work with the shitty OS. Behavior on Linux should be the same.
* path: add mp_path_is_absolute()wm42020-02-063-10/+41
| | | | Just move it from mp_path_join_bstr() to this new function.
* path: change win32 semantics for joining drive-relative pathswm42020-02-062-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | win32 is a cursed abomination which has "drive letters" at the root of the filesystem namespace for no reason. This requires special handling beyond tolerating the idiotic "\" path separator. Even more cursed is the fact that a path starting with a drive letter can be a relative path. For example, "c:billsucks" is actually a relative path to the current working directory of the C drive. So for example if the current working directory is "c:/windowsphone", then "c:billsucks" would reference "c:/windowsphone/billsucks". You should realize that win32 is a ridiculous satanic trash fire by the point you realize that win32 has at least 26 current working directories, one for each drive letter. Anyway, the actual problem is that mpv's mp_path_join() function would return a relative path if an absolute relative path is joined with a drive-relative path. This should never happen; I bet it breaks a lot of assumptions (maybe even some security or safety relevant ones, but probably not). Since relative drive paths are such a fucked up shit idea, don't try to support them "properly", and just solve the problem at hand. The solution produces a path that should be invalid on win32. Joining two relative paths still behaves the same; this is probably OK (maybe). The change isn't very minimal due to me rewriting parts of it without strict need, but I don't care. Note that the Python os.path.join() function (after which the mpv function was apparently modeled) has the same problem.
* test: add some path handling testswm42020-02-064-0/+51
| | | | | Exhaustive tests would be nice, but I'm only adding a test for a function I'm going to change.
* lua: fix highly security relevant arbitrary code execution bugwm42020-02-061-14/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It appears Lua's package paths try to load .lua files from the current working directory. Not only that, but also shared libraries. WHAT THE FUCK IS WHOEVER IS RESPONSIBLE FOR THIS FUCKING DOING? mpv isn't setting this package path; currently it's only extending it. In any sane world, this wouldn't be a default. Most programs use essentially random working directories and don't change it. I cannot comprehend what bullshit about "convenience" or whatever made them do something this broken and dangerous. Thousands of programs using Lua out there will try to randomly load random code from random directories. In mpv's case, this is so security relevant, because mpv is normally used from the command line, and you will most likely actually change into your media directory or whatever with the shell, and play a file from there. No, you don't want to load a (probably downloaded) shared library from this directory if a script try to load a system lib with the same name or so. I'm not sure why LUA_PATH_DEFAULT in luaconf.h (both upstream and the Debian version) put "./?.lua" at the end, but in any case, trying to load a module that doesn't exist nicely lists all package paths in order, and confirms it tries to load files from the working directory first (anyone can try this). Even if it didn't, this would be problematic at best. Note that scripts are _not_ sandboxed. They're allowed to load system libraries, which is also why we want to keep the non-idiotic parts of the package paths. Attempt to fix this by filtering out relative paths. This is a bit fragile and not very great for something security related, but probably the best we can do without having to make assumptions about the target system file system layout. Also, someone else can fix this for Windows. Also replace ":" with ";" (for the extra path). On a side note, this extra path addition is just in this function out of laziness, since I'd rather not have 2 functions with edit the package path. mpv in default configuration (i.e. no external scripts) is probably not affected. All builtin scripts only "require" preloaded modules, which, in a stroke of genius by the Lua developers, are highest priority in the load order. Otherwise, enjoy your semi-remote code execution bug. Completely unrelated this, I'm open for scripting languages and especially implementations which are all around better than Lua, and are suited for low footprint embedding.
* lua: add mp.get_script_directory() functionwm42020-02-042-5/+27
| | | | And add some clarifications/suggestions to the manpage.
* player: partially fix backward playback display of cached text subtitleswm42020-02-042-5/+4
| | | | | | | | | | | | | | This simply didn't set the direction flag in most situations, which meant the timestamps used in the subtitle renderer were nonsense, leading to invisible subtitles. This works only for text subtitles that are cached in the ASS_Track state. Reading new subtitles is broken because the demuxer layer has trouble returning subtitle packets backwards, and I think for rendering bitmap subtitles, the pruning direction would have to be adjusted. (Not sure if reversing the timestamps before the subtitle renderer backend is even the right thing to do. At least for sd_ass.c, it seems to make sense, because it caches subtitles with "normal" timestamps.)
* options: stop hiding deprecated optionswm42020-02-042-7/+3
| | | | | I think this was annoying. It shouldn't be dishonest about which options exist. List them as "[deprecated]" instead.
* cue: tolerate NBSP as whitespacewm42020-02-031-5/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently such .cue files exist. They fail both probing and parsing. To make it worse, the sample at hand was encoded as Latin1. One part of this is replacing bstr_lstrip() with a version that supports NBSP. One could argue that bstr_lstrip() should always do this, but I don't want to overdo it. There are many more unicode abomination which it could be said it's supposed to handle, so it will stay ASCII instead of going down this rabbit hole. I'm just assuming this cue sheet was generated by some stupid software that inexplicably liked NBSPs (which is how we justify a one-off fix). The new lstrip_whitespace() doesn't look particularly efficient, but it doesn't have to be. The second part is dealing with the fact that the charset is not necessarily UTF-8. We don't want to do conversion before probing thinks it knows it's a cue sheet (would probably make it more fragile all around), so just make it work with Latin1 by assuming invalid code points are Latin1. This fallback is part of why lstrip_whitespace() is sort of roundabout. (You could still rewrite it as much more efficient state machine, instead of using a slow and validating UTF-8 parser that is called per codepoint. Starting to overthink this.) Multimedia is terrible. Legacy charsets are terrible. Everything is terrible. Fixes: #7429
* stream_libarchive: disable tar supportwm42020-02-021-5/+0
| | | | | | | | | | Unfortunately, libarchive detects a stream of 0s as tar, as demonstrated by "mpv /dev/zero". This is inconvenient in some cases. One example is the .cue demuxer trying to open a raw audio .bin file, which it allows only if probing fails (as .bin is raw and normally will not look like any real file format). Although this use-case is worthless.
* drm_atomic: do not set immutable propertiesAnton Kindestam2020-02-021-1/+6
| | | | | | | | | | | | | | | On some platforms the ZPOS property might exist, but be immutable. This is at least the case on Intel Sandy Bridge since Linux kernel 5.5.0. Trying to set an immutable property will cause. drmModeAtomicCommit to fail with -EINVAL. On other platforms we might want to set ZPOS to tweak the layering of planes. To reconcile these two, simply have drm_object_set_property check if a property is immutable before attempting to add it to the atomic commit, instead returning an error code (which is, as previously, ignored in the case of ZPOS as we don't strictly need it)
* stream_cdda: fix operationwm42020-02-021-12/+15
| | | | | | | | | | | | | | | | | | The cdio API always reads in sectors (fixed CDIO_CD_FRAMESIZE_RAW blocks). In the past, mpv/MPlayer streams had a way for a stream to signal a sector size, so the stream's fill_buffer implementation could ignore the length argument. Later, that was removed, but stream_cdda.c was left with assuming that the read size was always larger than the sector size (rightfully at the time). Even later, this assumption was broken with commit f37f4de, when it was suddenly possibly that smaller reads were performed (at ring buffer boundaries). It returned EOF if the buffer size was too small, so playback stopped very early. Fix this by explicitly handling arbitrary sizes. Tested with a .cue/.bin file only. Fixes: #7384
* manpage: --sub-codepage cannot do muxed subswm42020-02-011-0/+5
| | | | | mpv actually used to be able to, from what I remember, but this was changed for simplicity and because of problems with FFmpeg.
* lua: set package path if loaded from a script directorywm42020-02-013-10/+72
| | | | | | And document the shit. This uses code from commit bc1c024ae032e5b5c.
* scripting: load scripts from directorieswm42020-02-017-52/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | The intention is to provide a slightly nicer way to distribute scripts. For example, you could put multiple source files into the directory, and then import them from the actual script file (this is still unimplemented). At first I wanted to require a config file (because you need to know at least which scripting backend it should use). This wouldn't have been too hard (could have reused/abused the mpv config file parsing mechanism, and I already had working code that was just 2 function calls). But probably better to do this without new config files, because it might become a pain in the distant future. So this just probes for "main.lua", "main.js", etc., until an existing file is found. Another important change is that this skips all directory entries whose name starts with ".". This automatically excludes the "." and ".." special directories, and is probably useful to exclude random crap that might be lying around in the directory (such as editor temporary files, or OSX, in its usual hrmful, annoying, and idiotic modus operandi, sharting all over any directories opened by "Finder"). Although the changelog mentions the docs, they're added only in a later commit.
* options: remove unused set_defaults callbackwm42020-02-012-6/+0
| | | | | Was only needed for an ancient version of af_lavfrresample, which is gone now.
* ao_wasapi_utils: remove invalid audio session icon path (fixes #7269)Rafael Rivera2020-01-311-2/+1
|
* wayland: remove wayland-frame-wait-offset optiondudemanguy2020-01-315-17/+5
| | | | | | | | | | | | | | | | | This originally existed as a hack for weston. In certain scenarios, a frame taking too long to render would cause vo_wayland_wait_frame to timeout which would result in a ton of dropped frames. The naive solution was to just to add a slight delay to the time value. If a frame took too long, it would likely to fall under the timeout value and all was well. This was exposed to the user since the default delay (1000) was completely arbitrary. However with presentation time, this doesn't appear to be neccesary. Fresh frames that take longer than the display's refresh rate (16.666 ms in most cases) behave well in Weston. In the other two main compositors without presentation time (GNOME and Plasma), they also do not experience any ill effects. It's better not to overcomplicate things, so this "feature" can be removed now.
* msg: move central msg lock to mp_log_rootwm42020-01-301-34/+36
| | | | | | | | | | | | This is a central lock (that is to stay and has no reason to go away), and it was simply made global. This reduces complexity when the original MPlayer code was changed from single thread + global state to a context handle. Having the global lock was still a bit silly if there were multiple mpv instances in the process, because it would make the instances wait for each other for no reason. So move it to the per-instance context, which is trivial enough.
* msg: fix some locking issueswm42020-01-301-7/+8
| | | | | | | | | | | | | | | | | | | | | | The wakeup_log_file callback was still assuming that mp_msg_lock was used to control the log file thread, but this changed while I was writing this code, and forgot to update it. (It doesn't change any state, which is untypical for condition variable usage. The state that is changed is protected by another lock instead. But log_file_lock still needs to be acquired to ensure the signal isn't sent while the thread is right before the pthread_cond_wait() call, when the lock is held, but the signal would still be lost.) Because the buffer's wakeup callback now acquires the lock, the wakeup callback must be called outside of the buffer lock, to keep the lock order (log_file_lock > mp_log_buffer.lock). Fortunately, the wakeup callback is immutable, or we would have needed another dumb leaf lock. mp_msg_has_log_file() made a similar outdated assumption. But now access to the log_file field is much trickier; just define that it's only to be called from the thread that manages the msg state. (The calling code could also just check whether the log-file option changed instead, but currently that would be slightly more messy.)
* msg: make --log-file buffered through a threadwm42020-01-292-53/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now --log-file performed a blocking write to the log file, which made any calling thread block for I/O. It even explicitly flushed after every line (to make it tail-able, or to ensure a hard crash wouldn't lose any of the output). This wasn't so good, because it could cause real playback problems, which made it infeasible to enable it by default. Try to buffer it through a ring buffer and a thread. There's no other choice but to use a thread, since async I/O on files is generally a big and unportable pain. (We very much prefer portable pain.) Fortunately, there's already a ring buffer (mp_log_buffer, normally for the client API logging hook). This still involves some pretty messy locking. Give each mp_log_buffer its own lock to make this easier. This still makes calling threads block if the log buffer is full (unlike with client API log buffers, which just drop messages). I don't want log messages to get lost for this purpose. This also made locking pretty complicated (without it, mp_log_buffer wouldn't have needed its own lock). Maybe I'll remove this blocking again when it turns out to be nonsense. (We could avoid wasting an entire thread by "reusing" some other thread. E.g. pick some otherwise not real time thread, and make it react to the log buffer's wakeup callback. But let's not. It's complicated to abuse random threads for this. It'd also raise locking complexity, because we still want it to block on a full buffer.)
* options: merge split_opt functionswm42020-01-291-30/+18
| | | | | | | | | | | There wasn't really much of a reason to keep split_opt and splot_opt_silent apart. It made sense before the latter also had a log call (which was silenced by using mp_null_log if necessary). Just merge them back into one, and always rely on mp_null_log to silence unwanted output. Shouldn't have any functional changes.
* options: suggest not using the syntax that was recently disabledwm42020-01-291-0/+4
|
* manpage: update force dedicated gpu on macOS optionder richter2020-01-271-1/+1
| | | | was forgotten in commit 3275cd0
* Update VERSIONsfan52020-01-261-1/+1
|
* Release 0.32.0v0.32.0release/0.32sfan52020-01-263-63/+25
|
*