summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* wayland: improve behavior with touch eventsDudemanguy2021-08-083-20/+10
| | | | | | | | | | | | | | | | | | | | | | | There's currently some touch related code in mpv wayland, but clearly nobody actually uses because it's a broken mess. Initially an attempt to distinguish between two finger touches and one finger touch was made, but there's not a good way to make this work. For whatever reason, initiating either xdg_toplevel_resize or xdg_toplevel_move blocks any other touch events from occurring (at least in plasma). Trying to call these functions anywhere else is not really useful since the serial will be invalid outside of the touch down events (well it would work in the touch up event but that's just silly). Anyways, let's just make this work sanely. Eliminate the touch entries variable completely because it's pointless. Only one finger event is ever considered at a time. Touches besides the initial one are all ignored. If a user touches and drags within the touch edge radius, then a resize event occurs. If the user touches and drags elsewhere on the window, a move event occurs. A single tap displays the osc (which is clickable if you tap again). A double tap toggles fullscreen. Additionally, the default touch edge radius of 64 pixels is way too big (at least I think so). Cut this in half to 32 which feels a lot better (on a pinephone using plasma mobile anyway).
* wayland: correct window-scale behaviorDudemanguy2021-08-071-3/+10
| | | | | | | | | | | | | | The way the window-scale option is supposed to behave wasn't really ever documented until 25cfc81. It turns out that different OS/WMs may do slightly different things. For wayland, we need to fix two things. First, only return the wl->window_size in GET_UNFS (aka don't return the fullscreen size). For SET_UNFS, we need to change the behavior for the maximized window case. If the window is maximized, first attempt to unmaximize it and send the wayland event. If the compositor allows this to happen, then go ahead and set the new dimensions and resize it. In the case that the attempt to unmaximize is not successful, then don't attempt the resize and just save the window size dimensions for later to be used when the user unmaximizes the window.
* manpage: clarify window-scale behaviorDudemanguy2021-08-071-5/+14
|
* command: make current-window-scale writeable, 2nd attemptDudemanguy2021-08-074-4/+21
| | | | | | | | | | | | | | | | | | | | | | The window-scale property mirrors the respective option (not the effective scale derived from the current window size), and as such setting its value to the same value it had before has no effect. Specifically - the window will not resize. This is consistent as far as property-option bridge behavior goes, but we do end up with an issue that we can't set an arbitrary scale and expect the window to always resize accordingly. We do also have a current-window-scale property which does reflect the actual window size, however, it's been read-only till now. This commit makes current-window-scale RW so that it's now always possible to set an arbitrary scale and expect the window to resize accordingly (without affecting window-scale - like manual resize). Also, mention window-scale no-effect-if-not-changed at the docs. Based on code by @Dudemanguy from commit 873ae0d, with same effect.
* Revert "command: make current-window-scale writeable"Avi Halachmi (:avih)2021-08-074-46/+42
| | | | | | | | | | | This reverts commit 873ae0de2af3bb84a11e5e57f6e3a8942b2263c2. The next commit will restore this functionality, with the following differences from the reverted commit: - Smaller and simpler code change. - On bad scale: use "Invalid value" (compared to "no such property"). - Doesn't combine the docs for window-scale and current-window-scale. - Doesn't remove the docs for window-scale behavior prior to 0.31.0.
* wayland: keep track of toplevel width/height againDudemanguy2021-08-062-1/+9
| | | | | | | | | | | | | | Regression from 24357cb. It's ugly but unfortunately keeping tracking of the last toplevel width and height really is the best way to solve this problem and removing it was a mistake. Compositors don't always send width/height coordinates of the actual window. The easiest way to trigger this is by changing window-scale/current-window-scale and then unfocusing the window. The compositor will send another toplevel configure event with coordinates of the window before the resize. Maybe compositors could be smarter but multiple ones do this (sway, gnome, plasma), so just keep the old workaround. The only difference this time is that the toplevel width/height is saved at the very beginning which also covers the case where it equals 0 (i.e. weston).
* stats.lua: page 4 (keys): group current-window-scale under windowGuido Cella2021-08-061-1/+1
| | | | | This groups "set current-window-scale ..." under the "window" group instead of "current" in the list of keybindings.
* command: make current-window-scale writeableDudemanguy2021-08-054-42/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | Somewhat confusingly, mpv has both a window-scale option and a current-window-scale property. The documentation lists window-scale under properties (and it is technically is one), but at its core it is actually an option which means it behaves subtly different. Options in mpv are runtime-configurable, but they only change anything if the value of the option itself changes. window-scale is an option and not meant to keep track of the actual scale of the window (intended behavior introduced by d07b7f0). This causes window-scale to do nothing in certain cases (ex: the window is manually resized and window-scale is set to 1.00 again). This is logical and consistent with the behavior of the rest of the mpv options, but it also makes it a poor candidate for setting the mpv window scale dynamically. As a remedy, we can just make current-window-scale writeable instead. current-window-scale is intended to always report the actual scale of the window and keep track of any window size changes made by the user. By making this property also writeable, it allows the user to have more intuitive behavior (i.e. setting current-window-scale to 1.00 always sets the window to a scale of 1). Additionally, the default input.conf is changed to use current-window-scale instead of window-scale. The window-scale documentation under property list is removed since it is already documented under options and users should probably set the current-window-scale property instead in most cases.
* sub: sub-filter-regex and jsre: support ass-to-plaintextAvi Halachmi (:avih)2021-08-057-3/+31
| | | | | | | | | | | Using --sub-filter-regex-plain (default:no) The ass-to-plaintext functionality already existed at sd_ass.c, but it's internal and uses a private buffer type, so a trivial utility wrapper was added with standard char*/bstr interface. The plaintext can be multi-line, and the multi-line regexp flag is now always set, but only affects plaintext (the ASS source is one line).
* sub: new: --sub-filter-jsre (js regex)Avi Halachmi (:avih)2021-08-057-0/+146
| | | | | | | | | | | | Pretty much identical to filter-regex but with JS expressions and requires only JS support. Shares the filter-regex-* control options. The target audience is Windows users - where filter-regex doesn't work due to missing APIs, but mujs builds cleanly on Windows, and JS is usually enabled in 3rd party Windows mpv builds. Lua could have been used with similar effort, however, the JS regex syntax is more extensive and also much more similar to POSIX.
* sub: SDH filter: use unified text-extraction utilsAvi Halachmi (:avih)2021-08-051-46/+17
|
* sub: SDH filter: small refinementsAvi Halachmi (:avih)2021-08-051-6/+10
| | | | | | | | | | | | | | | 1. On a pathological case where event_format is NULL, previously the filter was trying to use it with each new sub - and re-failed. Now the filter gets disabled on init (event_format doesn't change). 2. Previously, if the filter didn't modify the text or if the text could not be extracted - it still allocated a new packet with same content. Now it returns the original, saving a whole lot of no-ops (there are still few allocations in this case though). 1 above is preparation for the next commit, and 2 was trivial, but there's more to do if anyone cares (NIH string functions instead of bstr, unused arguments, messages could be improved, and more).
* sub: add filter text utils, use from filter-regex (no-op)Avi Halachmi (:avih)2021-08-053-22/+39
| | | | | | | | | | | | Add two stand-alone function to help with the text-extraction task which ass filters need. Makes it easier to add new filters without cargo-culting this functionality. Currently, on malformed event (which shouldn't happen), a warning is printed when a filter tries to extract the text, so if few filters are enabled, we'll get multiple warnings (like before) - not critical. The regex filter now uses these utils, the SDH filter not yet.
* wayland: cleanup handle_toplevel_configDudemanguy2021-08-032-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The source of many geometry woes. There's some loosely related toplevel things that should be cleaned up/fixed. First of all, VO_EVENT_LIVE_RESIZING is actually completely useless. It might have been useful sometime in the past, but there's no point. It doesn't "speed up" resizing in any way and appears to be originally for cocoa. Just remove it. Way back in the day, toplevel_width/height was added as a workaround for when we got uncoorperative (i.e. wrong) width/height coordinates from the compositor in this event. Basically it could happen due to numerous reasons but a lack of atomic commits was part of the reason and also mpv's geometry handling then was a lot rougher. We *shouldn't* need this workaround anymore. The width/height values are only used exactly when we need them. If mpv sets geometry on its own, it should still be the right dimensions. Related to the above, mpv never actually propertly handled the case where width or height was equal to 0. According to the xdg-shell spec, "If the width or height arguments are zero, it means the client should decided its own window dimension." An example of a compositor doing this is weston. It's, unsurprisingly, broken. Getting out of fullscreen or a maximized state does not restore the old window size like it should. The right way to handle this is to just return near the end of the function if we have a 0 for either argument and before any geometry is set (wl->geometry's width or height can never be zero). Luckily, state changes are already being detected so they just trigger the goto when needed. Finally, e2c24ad mistakenly removed the VO_EVENT_EXPOSE. There are edge cases where this is needed and it's safer to just force a redraw here when the window gets activated again. Just force wl->hidden to false first and then trigger the expose.
* options: don't always set set-locally to trueGuido Cella2021-08-031-2/+1
| | | | | | | | | | | | | | | | Since 1d1d1fbff9 option-info/<name>/set-locally was being set to true for every option. This broke setting start from ytdl-hook, which doesn't overwrite start if it was set-locally. Fix this so that only adding an option to reset-on-next-file or setting file-local-options/<name> make set-locally true like before. However, it's arguable that just adding an option to reset-on-next-file without ever changing it should not make set-locally true, so that e.g. --reset-on-next-file=start 'https://youtube.com/watch?v=...&t=30' will start at 30, though it currently doesn't. Fixes #9081.
* stats.lua: page 4 (keys): better alignment of non-ascii keysAvi Halachmi (:avih)2021-07-311-2/+16
| | | | | | | | | | | | | | | | | | | | | | | Previously we assumed the key-name string occupies strlen(name) cells, now we count codepoints instead. This improves alignment of non-english key names. Still not perfect because we don't know if the key name is single or double width, but wcwidth not available to scripts, notoriously unreliable (depends on locale, correct and updated tables, etc), and also not always available (Windows). Still, better than nothing, and we err by at most one cell - vs up to three before this commit (4 bytes keyname codepoint). In the future we could do the alignment using libass tags, however, this both complicates the ass-output generation, and also not available when we output for the terminal, so for now only count codepoints. Also, if the key name was in a right-to-left language, then previously the name/command were swapped visually. Now we inject a left-to-right marker before the name to ensure direction. This works also when harfbuzz is disabled for libass (--sub-ass-shaper=simple).
* player: eac3 to the whitelist of audio extensionsDudemanguy2021-07-301-1/+1
| | | | ffmpeg plays these just fine. Fixes #9065.
* DOCS/input.rst: key names: add shift modifier notehooke0072021-07-301-0/+6
| | | | Fixes #9060
* stats.lua: page 4 (keys): detect single-quotesAvi Halachmi (:avih)2021-07-301-2/+2
|
* input: arguments quoting: support single-quotesAvi Halachmi (:avih)2021-07-302-9/+26
| | | | | | | | | | | | | | | | | | | Users expect single quotes to work when the value includes literal backslashes or double-quotes (or as general quoting like in shell). The updated docs also include some previously-missing notes: - newline is only supported in double quotes. - adjacent (quoted) arguments don't join into one. Supporting mixed quoting (adjacent quoted strings) would make mpv's parsing more complete, but would require delicate effort of larger scope, for two reasons: - We'd need to also support escaping outside of quotes and do our best about backward compatibility. - The parsed value can either be a substring of the input or a newly-allocated string, which would be delicate when joining. Not critical to add right now.
* input: argument custom quotes: use ` instead of !Avi Halachmi (:avih)2021-07-302-7/+7
| | | | | | | | | | | Custom quotes were added in 4f129a3e and began with !, however, this required quoting "!reverse" (used for the cycle-values command), which is inconvenient, and was not taken into account when ! was chosen for custom quotes. Also, ` is more natural for quoting than !. This does break backward compatibility with the earlier form of custom quotes, but at least we didn't make a release yet since custom quotes were added (the last release - 0.33[.1] doesn't support it).
* options: audio-display determines cover priorityGuido Cella2021-07-294-12/+21
| | | | | | | | | | | | Let audio-display determine whether embedded images or external cover art tracks should be selected when both are present. Attached pictures are given priority by default as requested in #8539. Also updates references to attached pictures in the log and manpage to refer to cover art as well. Closes #8539.
* DOCS: fix manual compiling warningsgaroto2021-07-282-2/+2
| | | | | | | | | | This fix the warnings shown below when compiling the manual for any of its three common formats: ``` DOCS/man/mpv.rst:46: (ERROR/3) Unknown target name: "--input-test". DOCS/man/stats.rst:183: (ERROR/3) Unknown target name: "--input-test". ```
* DOCS/mpv.rst: fix quotingAvi Halachmi (:avih)2021-07-281-1/+1
| | | | | | In rst, double-backtick starts a code string only if it's followed by a non-space char, otherwise it's taken literally, hence, `` x2.0`` was taken literally rather than code string.
* ci/travis: remove everything as it's nop nowJan Beich2021-07-271-52/+0
|
* ci/travis: remove freebsd buildJan Beich2021-07-271-38/+0
|
* github/workflows: add freebsd CIJan Beich2021-07-271-0/+43
|
* manpage: explain when properties are expandedGuido Cella2021-07-271-3/+13
|
* TOOLS/autocrop.lua: allow hiding OSD messagesGuido Cella2021-07-271-6/+12
| | | | | | 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.
* wayland: unset hidden state in frame callbackDudemanguy2021-07-261-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | More wayland weirdness. So previously, flipping a hidden state from true to false was done in vo_wayland_wait_frame. In theory, this would be after you get the frame callback and all those events so there's no problem. However since the function also does a bunch of flushing/dispatching/etc. to the default display queue so a lot of unknown things can happen before we actually set the hidden variable back to false. For example if a single image was paused and left on another virtual desktop long enough (~5 minutes) while also not having focus, switching back to that desktop could render it a black frame. This edge case was supposed to be handled by the surface being activated again in the toplevel event but apparently that doesn't always work. The fix is to just delete all of that junk and set wl->hidden = false in the frame callback. What's actually happening is kind of a mystery honestly. Probably the compositor drops the buffers after a while as an optimization (sensible) and forces a repaint if you switch back to the virtual desktop. Somehow wl->hidden not being set to false would not properly trigger a repaint (likely because it also sends a toplevel event which does stuff) thus you just get a black window. If you just make sure to set hidden in the frame callback, it appears like all of these problems and edge cases are solved. Since this event must happen first, that makes sense. That simplifies a lot of stuff and fixes some subtle bugs at the same time so just go with this approach.
* egl_helpers: fix create_context fallback behaviorDudemanguy2021-07-253-16/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The EGL stuff is really complicated because of historical reasons (tl;dr: blame EGL). There was one edge case with EGL context creation that lead to incorrect behavior. EGL_KHR_create_context was created with EGL 1.4 (which mpv does support) but it is still possible for an EGL 1.4 device to not implement this extension. That means that none of the EGL attrs that pass a specific opengl version work. So for this obscure case, there is a fallback context creation at the very end which simply creates an EGLContext without passing any special attrs. This has another problem however. mpv has a hard requirement on at least desktop opengl 2.1 or opengl ES 2.0 to function (we're not asking for much here). Since the fallback EGL context creation has no version checking, it is entirely possible to create an EGL context with a desktop opengl version under 2.1. As you get further along in the code, the user will encounter the hard opengl version check and then error out. However, we're supposed to also actually check if GLES works (that's what the opengl-es=auto option is for) so this is a bug. The fix is to do a bit of code duplication and make a mpgl_check_version specifically for if we hit the edge case of needing to create an EGL context without the EGL_KHR_create_context extension. Grab the version with the function pointer, check if it's under 210, if so destroy the EGL context and set it to NULL. After that, if the user has set opengl-es to auto, mpv will try GLES next. If it is set to no, then mpv will simply fail as desired. Fixes #5915. Sidenote: the ra_gl_ctx_test_version originally testing 140 doesn't make any sense. Passing the version number in that function only does something if the user has set opengl-restrict. What we need to do is to pass the version of the created context to that function. If the version is higher than the opengl-restrict option, then make this a failure.
* command: handle changes to image-display-durationGuido Cella2021-07-251-0/+5
| | | | | | | | | | When changing image-display-duration at runtime, make the new value take effect immediately, rather than from the next playlist-position change. This allows toggling the slideshow mode while viewing images (without hacks like executing playlist-play-index current afterwards). All the conditions are just to be safe since even if you set time_frame while playing a video, it's immediately overwritten by the next value.
* github/workflows: separate jobs with an endlineJan Ekström2021-07-251-0/+2
|
* ci/travis: remove linux buildsJan Ekström2021-07-251-15/+0
|
* github/workflows: add linux CIJan Ekström2021-07-251-0/+26
|
* stats.lua: fix ass-escape while persistent_overlay=yesAvi Halachmi (:avih)2021-07-251-14/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mpv has two methods to display output from text input: - show-text (scripting: mp.osd_message) has ass disabled by default (escaped), and the property osd-ass-cc can control escaping. - osd-overlay (scripting: mp.set_osd_ass or mp.create_osd_overlay) has ass enabled (unescaped), and osd-ass-cc is NOT supported. By default, stats.lua uses mp.osd_message which does support escaping. That's persistent_overlay=no. When using persistent_overlay=yes then mp.set_osd_ass is used. Due to this, the no_ASS(..) function - which is supposed to escape ass, simply returned its input unmodified when persistent_overlay is enabled. This is not a new issue, and the filters on page 1 use no_ASS() to no avail in persistent mode, however, this content (filter name and value strings) rarely actually needs escaping, and users didn't notice. However, the new page 4 (keys) does break visibly when no_ASS doesn't work, because it tries to escape arbitrary key-names and command strings, and at the very least the key '{' is bound by default, which is displayed incorrectly if escaping doesn't work. Fix this by rolling our own escaping when using mp.set_osd_ass, similar to how the mpv code does it for mp.osd_message (substrings replacements). However, this means that the set_ASS(..) function can no longer behave correctly because escaping requires going through the whole content string rather than only inserting a marker. Luckily, other than at no_ASS, set_ASS was only used at one place (text_style), which is only called from two places: - generate_graph() only needs to restore styles - not to enable ass. - add_header() is only used at the begining of page output, and uses set_ASS to enable ass initially when using mp.osd_message. So remove the set_ASS function, and instead enable ass directly at print_page using osd-ass-cc when mp.osd_message is used. Fixes #9022
* ci/travis: remove macOS buildsJan Ekström2021-07-251-58/+0
| | | | | Quite unlikely to be run afterwards, and the macOS runner on Github actions seems to work.
* github/workflows: add macOS CIJan Ekström2021-07-251-0/+27
|
* context_drm_egl: allow autoprobe selectionDudemanguy2021-07-231-5/+0
| | | | | | | | | | This was explictly coded to avoid the autoprobe way back when in 2015[1] with no real explanation. In theory, there shouldn't be any issues allowing this. If a user runs mpv in tty, this is probably what they actually want in most cases. Perhaps something strange happens on nvidia, but it should just fail anyway during the autoprobe. [1]: https://github.com/mpv-player/mpv/commit/f757163058c2e5c7136213b0f79923fcea34b71a
* js: fix tiny leaks if js_try throws(!)Avi Halachmi (:avih)2021-07-231-16/+41
| | | | | | | | | | | | | | | | | | | | | | | | As it turns out, js_try can throw if it runs out of try-stack (without/before entering either the try part or the catch part). If it happens, then C code which does allocation -> try will leak. In mpv there were two places which do alloc and then try, one of them as part of the autofree system. On both cases the leak is the smallest possible (zero allocation) - talloc_new(NULL); It's very unlikely to trigger - an autofree mpv API should be called when the try-stack is exactly full, and our next try will throw (and guaranteed to get caught at an outer level, but with a leak). Fix that by doing the allocation inside the try block, so that if try throws before it's entered then nothing got allocated/leaked. Mujs internal code also has/had similar leaks, which are getting fixed around this time (July 2021, post mujs 1.1.3). [1] exhaust the try-stack or call-stack, whichever comes first: function kaboom() { try { kaboom() } catch(e) {} }
* manpage: fix watch-later-options examplesGuido Cella2021-07-212-5/+4
| | | | | | | | --watch-later-options-remove doesn't accept multiple options, so split the example. Also suggest the more correct -clr to empty the list, and remove the workaround to not print an error with --watch-later-options=
* js: key bindings: ensure priorities for same-key bindingsAvi Halachmi (:avih)2021-07-211-4/+14
| | | | | | | | | | | | | | | | | | Previously, if a script bound the same key more than once to different functions (without removing the older bindings first), then pressing the key triggered any of the bound functions arbitrarily[1]. Now the newest binding for the same key is always the active one. If the newest binding is then removed - the second-newest will become active, etc. (same mechanism as before, except that the active key was not always the newest). [1] The order was implementation-defined, however `for (name in obj)' happens to iterate. With mujs that's currently alhabetic order, and name is from mp.add_[forced_]key_binding(key, name...) or generated internally if name is not provided. So a binding with higher alphabetic `name' value had priority over lower name value.
* options: add watch-later-optionsGuido Cella2021-07-2110-78/+127
| | | | | | | | | | This allows configuring which options are saved by quit-watch-later. Fixes #4126, #4641 and #5567. Toggling a video or audio filter twice would treat the option as changed because the backup value is NULL, and the current value of vf/af is a list with one empty item, so obj_settings_list_equal had to be changed.
* stats.lua: remove script-opts for the main keys (i/I)Guido Cella2021-07-212-15/+4
| | | | | | | Unlike the page switching/scrolling keys which are bound at runtime and therefore we need to know which (configured) keys to bind, the main keys (i/I by default) are static and can be bound via input.conf. And inde