summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* read stats newread_stats_newwm42020-02-051-1/+4
|
* lua: fix highly security relevant arbitrary code execution bugwm42020-02-051-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
|
* lua: stop setting bogus package pathwm42020-01-261-25/+0
| | | | | Scripts are not supposed to be able to "import" anything from mpv's scripts directory, because all these files are loaded by mpv itself.
* w32_common: support minimized and maximized propertiesJames Ross-Gowan2020-01-261-5/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for setting window-minimized and window-maximized in Windows. The minimized and maximized state can be set independently. When the window is minimized, the value of window-maximized will determine whether the window is restored to the maximized state or not. Changing state is done with ShowWindow(), which has commands that change the window state and activate it (eg. SW_RESTORE) and commands that change the window state without activating it (eg. SW_SHOWNOACTIVATE.) It would be nice if we could use commands that don't activate the window, so scripts could change the window state in the backrgound without bringing it to the foreground, but there are some problems with that. There is no command to maximize a window without activating it, so SW_MAXIMIZE is used instead. Also, restoring a window from minimize without activating it seems buggy. On my Windows 10 1909 PC, it always moves the window to the back of the z-order. SW_RESTORE is used instead of SW_SHOWNOACTIVATE because of this. This also changes the way the window is initially shown. Previously, the window was made visible as a consequence of the SWP_SHOWWINDOW flag in the first call to SetWindowPos. In order to set the initial minimized or maximized state of the window, the window is shown with the ShowWindow function instead, where the ShowWindow command is determined by whether the window should be initially maximized or minimized. Even when showing the window normally, we should still call ShowWindow with the SW_SHOW command instead of using SetWindowPos, since the first call a process makes to ShowWindow(SW_SHOW) has special behaviour where it uses the show command in the process' STARTUPINFO instead of the command passed to the function, which should fix #5724. Note: While changes to window-minimized while in fullscreen mode should work as expected, changing window-maximized while in fullscreen does not work and won't result in the window changing state, even after leaving fullscreen. For this to work correctly, the fullscreen logic needs to be changed to apply the new maximized state on leaving fullscreen. Fixes: #5724 Fixes: #7351
* player: fix minor coding style issuewm42020-01-261-1/+2
|
* player: check if file is URL before attempting to get mtimeChris Down2020-01-261-2/+5
| | | | | | I noticed an oversight when using ytdl-hook -- if the path is a URL, we try to `stat()` it, which obviously doesn't work. To mitigate that, don't check or update mtimes for URLs.
* stream_lavf: remove version from user agentwm42020-01-261-1/+1
|
* mac: change Report Issue menu link to the new choose template pageder richter2020-01-261-1/+1
|
* cocoa-cb: add pinch to resize window gestureder richter2020-01-262-0/+11
| | | | | | | the event returns a delta ratio so we can just add it to the current window-scale. Adds support for #3214
* cocoa-cb: never set a window size smaller than the set minSizeder richter2020-01-261-0/+5
| | | | this prevents a vanishing window if the size is set too small.
* travis: don't send notifications for forksder richter2020-01-261-0/+1
|
* cocoa-cb: fix race condition on quitder richter2020-01-261-0/+1
| | | | | | it was possible for mouse events to be triggered when the core was already being shut down. to prevent this properly close and remove the window and additional remove the reference to MPVHelper object.
* cocoa-cb: add support for forcing the dedicated GPU for renderingder richter2020-01-265-6/+19
| | | | | | | | this deprecates the old cocoa backend only option and moves it to the general macos ones. add support for the new option in the cocoa-cb layer creation and use the new option in the olde cocoa backend. Fixes #7272
* cocoa-cb: don't set App icon when called from bundleder richter2020-01-261-1/+3
| | | | | | | | | due to the bundle config the icon is set automatically via the bundle system mechanisms. this also makes it possible to set the icon to a custom one with the standard macOS copy paste method via the file info dialogue. Fixes #6874
* mac: report playback state to the MediaPlayer Command Centerder richter2020-01-262-11/+48
| | | | | | some system logic for the global media key events depends on the right playback state. set the state properly to prevent more breakages in the future.
* mac: add support for PLAYONLY and PAUSEONLY key codes to MediaPlayerder richter2020-01-261-3/+3
| | | | Fixes #7365
* input: add new PLAYONLY and PAUSEONLY MP_KEY key codesder richter2020-01-263-0/+6
| | | | | since the old PLAY and PAUSE key codes cycle through the pause property, the new key codes only explicitly set the pause property.
* client API: document srand() usewm42020-01-211-0/+2
|
* player: make failure to load scripts non-fatal againwm42020-01-201-2/+1
| | | | | Restore the behavior from a few commits ago. I decided that it's strange that this is fatal, since e.g. config file errors are also non-fatal.
* stream_libarchive: more broken garbagewm42020-01-201-7/+22
| | | | Why the fuck am I even bothering with this crap?
* Revert "stream_libarchive: remove "old" rar volume pattern"wm42020-01-201-0/+8
| | | | | | | | | | This reverts commit 1b0129c4143fe73ef0ee3c3f1e2bed734c374d40. It turns out most of the files affected by the idiotic use-case actually use this old naming pattern, which I hoped was unused. This means for now we'll always assume .rar files are multi-part (until proven otherwise), but the following commit tries to fix this.
* github: rename Bug to Issue and slightly change the question templateder richter2020-01-206-9/+16
|
* input: fix cycle 2nd argument stringificationwm42020-01-191-0/+6
| | | | Triggered the fallback code that formatted the argument as "(NULL)".
* stream_libarchive: do not require leading / in archive URLswm42020-01-191-3/+3
| | | | | The / was added some time ago, because it simplifies some other things. But there is actually no reason to reject old URLs.
* scripting: make player error when attempting to load unknown scriptswm42020-01-194-10/+19
| | | | | | It's ridiculous that --script=something.dumb does not cause an error. Make it error, and extend this behavior to the scripts/ sub-dir in the mpv config dir.
* player: write watch-later config even for unseekable streamswm42020-01-171-5/+7
| | | | | | | | | | | | I think there was a user complaint that this does not restore the playlist position. There's no reason not to save the "state" for unseekable streams; what we probably don't want is to make restoring trying to issue a seek. So just don't save the position. (Although we probably could anyway, since seek requests on unseekable streams are ignored now.) Fixes: issue number forgotten, if it even exists.
* f_autoconvert: remove subfmt conversion BSwm42020-01-173-71/+1
| | | | | | This was used to convert e.g. P010 to NV12 within the filter chain, which hopefully a thing that is not needed anymore. (And has been dead code since the ANGLE "RGB" interop code was removed.)
* f_hwtransfer: extend vaapi whitelist with some working formatswm42020-01-171-1/+2
| | | | | | Notably, BGR0, which is the only additional format listed as supported by the texture mapper, results in broken colors. This is most likely not a mpv issue, so the whitelist fulfils its purpose.
* f_hwtransfer: minor debug logging improvementwm42020-01-171-2/+5
|
* vo_gpu: hwdec_vaapi: set correct hw_imgfmt valuewm42020-01-171-0/+1
| | | | | | | As documented on struct mp_hwdec_ctx, hw_imgfmt specifies the hardware surface wrapper format for which supported_formats is valid. If this was not set, f_hwtransfer ignored supported_formats, and assumed all formats were supported.
* osc: more frequent cache updates: from 10% diff to 5% or 5sAvi Halachmi (:avih)2020-01-141-2/+2
| | | | | | | | Cache display updates, especially when it's bigger than few minute, could have been be very infrequent to the point that one is not sure if it updates at all. Reduce the 10% change-threshold to 5% and add another threshold of 5s.
* bash completion: only generate option list when neededPhilip Langdale2020-01-131-5/+5
| | | | | | | | | | Right now we are generating the fully option list before doing anything else. That makes filename completion significantly slower than it was before, for no gain. It's easy to only generate the option list when it's actually needed. I also know I could additionally cache the option list across invocations, but I'm not doing that yet to make testing easier.
* osc: usability improvements for pseudo-csd title barPhilip Langdale2020-01-131-4/+21
| | | | | | | | | | | |