summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* hwdec_vaapi_vk: rename to vaapi_plNiklas Haas2022-03-036-26/+25
| | | | | | | | There's really nothing vulkan-specific about this hwdec wrapper, and it actually works perfectly fine with an OpenGL-based ra_pl. This is not hugely important at the time, but I still think it makes sense in case we ever decide to make vo_gpu_next wrap OpenGL contexts to ra_pl instead of exposing the underlying ra_gl.
* hwdec_vaapi_gl: properly zero initialize priv structNiklas Haas2022-03-031-6/+8
| | | | | | | | | Easiest way is by just using a designated struct initializer. If we don't, `p->images` ends up inheriting random data, which leaks into e.g. eglDestroyImageKHR. It's a small miracle this never blew up before. Or maybe it did. Who knows.
* filters: Re-add vavpp deinterlacing auto-filterPhilip Langdale2022-03-021-0/+5
| | | | | | | | | | | | A few years ago, in 25e70f4743c44db59fe8fc902c93a966d95ba8c3, we disabled the vavpp deinterlacing auto-filter on the basis that it caused crashes on _some_ hardware with _some_ driver version(s). But since then, the situation has improved. There is still a limitation where you can't turn deinterlacing on on the fly with AMD, but it doesn't crash anymore (That is #7388). So, given that AMD users have to set up the deinterlacing filter manually either way, let's re-add the auto-filter for Intel users.
* ytdl_hook: fix url_is_safe to match URL protocols properlyGeorge Brooke2022-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | Some youtube_dl extractors retrieve URLs which contain other URLs inside of them, for example Funimation, like this: https://example.com/video?parameter=https://example.net/something The url_is_safe function uses a pattern to match the protocol at the start of the URL. Before this commit, this pattern was not compliant with the URL spec (see the definition of "A URL-scheme string"): https://url.spec.whatwg.org/#url-writing Therefore it would match any characters, including "://", until the last occurence of "://" in the string. Thus the above URL would match https://example.com/video?parameter=https which is not in safe_protos so the video will not play. Now the protocol can only start with a letter and only contain alphanumerics, "." "+" or "-" as the spec says, so it will only match the first protocol in the URL ("https" in the above example.) Previously the URL also had to contain "//" after the ":". Data URLs do not contain "//": https://datatracker.ietf.org/doc/html/rfc2397 so now the pattern does not look for "//", only ":".
* vo_gpu_next: remove/simplify plane flipping hacksNiklas Haas2022-02-253-42/+14
| | | | | | | | | libplacebo v198 fixed this properly by adding the ability to flip planes directly, which is done automatically by the swapchain helpers. As such, we no longer need to concern ourselves with hacky logic to flip planes using the crop. This also removes the need for the OSD coordinate hack on OpenGL.
* vo_gpu_next: avoid rendering subtitles as HDR/wide gamutNiklas Haas2022-02-251-1/+9
| | | | Fixes #9911
* mp_image: fix mp_image_plane_w/hNiklas Haas2022-02-241-4/+2
| | | | | | | | | | | | | These helpers, for some reason, decided to round the returned values up to multiples of the nearest plane alignment. This logic makes no sense to me, and completely breaks any sort of oddly-sized mp_image. This logic was introduced, presumably in error and without real justification, as part of a major refactor commit (caee8748), As far as I can tell, removing it again doesn't regress anything. Fixes several serious bugs including buffer underflows and GPU crashes in vo_gpu and vo_gpu_next.
* stats.lua: page 2 - frame timing: use fixed display orderAvi Halachmi (:avih)2022-02-231-1/+10
| | | | | | | | | | | | | Page 2 displays the frame timing info for each type (currently "Fresh" and "Redraw"), but since they're unordered keys of a map, their iteration order and hence their order on screen could (and did) change depending on $things, which was annoying. haasn thinks none of them should be considered more important (and therefore maybe worthy of being displayed on top), so we go with lexicographic order, which currently means that "Fresh" is first. Fixes #9901
* stats.lua: graphs: fix bad rendering due to division by 0Avi Halachmi (:avih)2022-02-211-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes two potential divisions by 0 at generate_graph(...): - If v_avg is (given and) 0. - if v_max is 0. The former doesn't seem to happen in practice because v_avg is only used at one generate_gpah call, where it's apparently not 0. The latter triggers if all the graph values are 0 (hence v_max is also 0). The implication of these divisions by 0 is an invalid y-value which ends up at the ASS coordinates string for the graph inner content. On linux the value ends as "nan" (luajit) or "-nan" (lua 5.1/5.2), and on Windows it's "nan" (luajit) or "-1.#IND00" (lua 5.1/5.2), maybe due to msvcrt's snprintf. All these strings are wrong as ASS numbers, but due to luck in how libass parses the coordinates, "nan" and "-nan" result in empty graph (which looks OK for "all values are 0"), while "-1.#IND00" is parsed as -1, which breaks the graph rendering (affects other graphs too). One example of "all values are 0" is at page 0 (internal performance graphs) on Windows - because the cpu metrics don't work. So this fixes at least page 0 on Windows with lua 5.1/5.2. While at it, move the scale calculations to one place, which now avoids division by 0, instead of duplicating this calculation. In the future, we can consider improving the generate_graph API: - It needs one peak value, but takes 3 (v_max, v_avg, scale) which are meshed into one final value. - v_avg is only used in 1 of 6 call sites, but at the middle of the arguments, so all other call sites need to pass explicit "nil". - "scale" is arbitrary and used to leave some space at the top of the graph. 5 places use 0.8, one uses 0.9. Could probably be unified.
* vo_gpu_next: refactor subtitle renderingNiklas Haas2022-02-216-35/+63
| | | | | | | | | | | | | | | Render subs at the output resolution, rather than the video resolution. Uses the new APIs found in libplacebo 197+, to allow controlling the OSD resolution even for image-attached overlays. Also fixes an issue where the overlay state did not get correctly updated while paused. To avoid regenerating the OSD / flushing the cache constantly, we keep track of OSD changes and only regenerate the OSD when the OSD state is expected to change in some way (e.g. resolution change). This requires introducing a new VOCTRL to inform the VO when the UPDATE_OSD-tagged options have changed. Fixes #9744, #9524, #9399 and #9398.
* options: add always to stop-screensaverDudemanguy2022-02-183-5/+12
| | | | | | | | | | The stop-screensaver option is currently limited to a simple yes/no option. While the no option does always disable mpv trying to stop the screensaver, yes does not mean the screensaver is always stopped. The screensaver will be enabled again depending on certain conditions (like if the player is paused). Simply introduce a new value for this option, always, which does exactly what the name implies: the screensaver will always be disabled.
* DOCS/input: document subprocess more clearlyGuido Cella2022-02-181-19/+23
| | | | | | | | | | | - Make it clearer that playback_only affects subprocess' behavior when the playback of the current playlist entry terminates, rather than when mpv quits. - Explain when status is positive and when it is negative. - Replace "exited gracefully" in status' and error_string's documentation with "terminated normally" so it can't be misinterpreted as exiting successfully. - Reword the playback_only warning
* DOCS/input: fix typoGuido Cella2022-02-181-1/+1
|
* vo_gpu: hwdec: load hwdec interops on-demand by defaultPhilip Langdale2022-02-178-24/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | Historically, we have treated hwdec interop loading as a completely separate step from loading the hwdecs themselves. Some hwdecs need an interop, and some don't, and users generally configure the exact hwdec they want, so interops that aren't relevant for that hwdec shouldn't be loaded to save time and avoid warning/error spam. The basic approach here is to recognise that interops are tied to hwdecs by imgfmt. The hwdec outputs some format, and an interop is needed to get that format to the vo without read back. So, when we try to load an hwdec, instead of just blindly loading all interops as we do today, let's pass the imgfmt in and only load interops that work for that format. If more than one interop is available for the format, the existing logic (whatever it is) will continue to be used to pick one. We also have one callsite in filters where we seem to pre-emptively load all the interops. It's probably possible to trace down a specific format but for now I'm just letting it keep loading all of them; it's no worse than before. You may notice there is no documentation update - and that's because the current docs say that when the interop mode is `auto`, the interop is loaded on demand. So reality now reflects the docs. How nice.
* ao_pipewire: fix ao-volume handlingAlex B2022-02-111-3/+6
| | | | | | | | Pass channel volumes to `pw_stream_set_control` as array. This is correct calling conventions and prevents right channel muting every time ao-volume property is changed. Terminate `pw_stream_set_control` calls with 0.
* vo_gpu_next: don't crash on negative plane stridesNiklas Haas2022-02-111-5/+34
| | | | | | | | | | | | | | This is an annoying special case only really needed because of the `vflip` filter. mpv handles this by directly adjusting the plane transform. The libplacebo API, unfortunately, does not allow passing the required information for this to work smoothly. Long-term I plan on adding support for plane flipping in libplacebo directly, but for the meantime, we will have to work-around it by moving the flipping to the whole-image `crop` instead. Not an ideal solution but better than crashing. Fixes #9855
* vo_gpu: d3d11_helpers: don't create UNORDERED_ACCESS backbuffers in Win7James Ross-Gowan2022-02-091-0/+10
| | | | | | | | | | | | | | We're getting bug reports that the recent change to add extra usage flags to swapchain buffers (for gpu-next) breaks mpv on some Windows 7 systems, and it seems like this is only happening with flip-model swapchains. Creating swapchains with DXGI_USAGE_UNORDERED_ACCESS should be valid. At least, it's not specifically disallowed, unlike some other flags[1]. So, just disable it for flip-model swapchains in Windows 7, rather than disabling it everywhere. [1]: https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-usage
* meson: remove horrifying macos luajit hackDudemanguy2022-02-071-17/+4
| | | | | | | | | | | | | | | | | | | | | | | | See the previous commit for the full explanation. Basically, luajit 2.0 has a bad pc file on macos that causes libmpv to fail during build. The workaround was, if the os was darwin and luajit was found, to save a full luajit dep and a partial luajit dep with the link args removed. The partial dep was used for compiling libmpv, and the full dep was used for the actual mpv executable. This worked and was needed for the CI to pass but it sucked. Since the previous commit now makes the CI grab lua 5.1, we don't need all this crap anymore. Just delete it and treat the dependency normally. This does effectively mean that building libmpv with luajit 2.0 on macOS will no longer work with the meson build. However libraries not being built correctly is not a mpv-specific issue. The waf build will succeed for some reason, but it has known issues and it would be better if it just failed honestly. An upstream developer said years ago that that macOS users should use the 2.1 branch (and there's no release of course). In any case, no macOS user should be building mpv with luajit 2.0, so we shouldn't be going out of our way to support this. https://github.com/mpv-player/mpv/issues/7512 https://github.com/LuaJIT/LuaJIT/issues/521#issuecomment-562999247
* github/workflows: use lua 5.1 on macosDudemanguy2022-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | LuaJIT is still actively developed, but upstream is allergic to making new releases for whatever reason. The last tagged release was in May of 2017, so we probably shouldn't expect a new release anytime soon. Now for mpv, this doesn't really matter except in the case of macOS where 2.0.5 is actually a bit broken (and of course the CI uses luajit). More specifically, the 2.0.5 pc is broken and has a "-pagezero_size 10000" flag which causes libmpv to fail (only executables are allowed to use this). This magically works on waf. It's possible that it just happens to ignore the link arguments. However on the meson build, this is broken and led to a really ugly hack using a partial dependency so both mpv and libmpv succeed. Fortunately, the 2.1 luajit branch fixes this. Unfortunately, there's no actual release. Instead, just use Lua 5.1. Note that lua 5.1 is technically deprecated in homebrew, but the chances of this going away is pretty slim since everyone knows that new lua versions are not backwards compatible. Anyways, using 5.1 works fine and lets us get rid of a terrible hack in the meson build. People really shouldn't be using 2.0 LuaJIT anyway.
* DOCS/mpv: improve vf=rotate examplesGuido Cella2022-02-071-5/+5
| | | | | | | | | | | We have a few examples with vf=rotate=90, but libavfilter's rotate accepts radians - not degrees, so a value of 90 is valid but misleading because it's not 90 degrees. Change the value of 90 at those examples. Also replace "vf-add=hflip" with "vf add hflip", since that example lists commands, not options, to run.
* wayland: partially fix drag and drop handlingDudemanguy2022-02-071-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drag and drop in wayland is weird and it seems everyone does this slightly differently (fun). In the past, there was a crash that occured (fixed by 700f4ef5fad353800fa866b059663bc1dd58d3b7) which involved using the wl_data_offer_finish in an incorrect way that triggered a protocol error (always fatal). The fix involved moving the function call to data_device_handle_drop which seemingly works, but it has an unfortunate side effect. It appears like GTK applications (or at least firefox) close the pipe after this function is called which makes it impossible for mpv to read data from the fd (well you could force it open again in theory but let's not do that). Who knows if that was the case when that commit was made (probably not because I'd think I would have noticed; could just be a dummy though), but obviously having broken dnd for a major application isn't so fun (this works with QT and chromium anyway). Ideally one would just simply check the pipe in data_device_handle_drop, but this doesn't work because it doesn't seem the compositor actually sends mpv the data by then. There's not actually a defined event when you're supposed to be able to read data from this pipe, so we wait for the usual event checking loop later for this. In that case, wl_data_offer_finish needs to go back into check_dnd_fd, but we have to be careful when calling it otherwise we'd just commit protocol errors like before. We check to make sure we even have a valid wl->dnd_offer before trying to indicate that it is finished and additionally make sure there is a valid dnd_action (after checking the fd, it's always set back to -1). This doesn't fix everything though. Specifically, sway with focus_follows_mouse (the default) and GTK as the data source still doesn't work. The reason is that when you do a drag and drop in sway with that option on, a new wl_data_device.data_offer event is sent out instantly after the drop event. This happens before any data is sent across the fd and before mpv even has a chance to check it. What GTK does, when getting this new data_offer event, is close the pipe (POLLHUP). This means mpv can't read it when we reach the event loop and thus no data is ever read and broken drag and drop. From the client side, this isn't really fixable since the wayland protocol doesn't have a clear indication of when clients are supposed to read from the fd and both the compositor and data source are doing things totally out of our control. So we'll consider this weird case, "not our bug" at least. The rest should work.
* ao_pipewire: validate pod creationThomas Weißschuh2022-02-061-0/+6
| | | | | Our allocated buffers should be big enough, but add some errorhandling just in case.
* ao_pipewire: add support for device selectionThomas Weißschuh2022-02-061-14/+188
|
* vo_gpu_next/context: get graphics API-specific contexts from pl_gpuJan Ekström2022-02-061-36/+31
| | | | | | | | | | | | | | By receiving the graphics API-specific contexts from the generic pl_gpu instance, it is not necessary to store them separately. As the current priv struct stores nothing else, this allows its removal. This removal cleans up related compiler warnings regarding unused variables in case of opengl and d3d11 being disabled in mpv/libplacebo. Functions to receive the underlying vulkan,gl,d3d11 structure were added in libplacebo version 4.182. Our current requirement for gpu-next is 4.190, and thus we can freely utilize these helper functions.
* vf_format: simplify frame type checking after addition of DoVi optionJan Ekström2022-02-061-1/+5
| | | | | | | | | | | We only wish to touch actual video frames, which should have an allocated image attached to them, so just check the frame type early, and exit by passing through such non-video frames to further filters in the chain without attempting to process them. Fixes a crash in case of non-video (EOF/NONE) frames being passed onto the filter when the dovi option was set to false since 05ccc51d53424a771ece5bb818713d474d7874ce .
* vo_gpu: hwdec_vaapi: Don't probe formats for irrelevant endpointsPhilip Langdale2022-02-061-0/+8
| | | | | | | | | | | | | | While testing support for the exotic formats used by Intel vaapi for 4:2:2 and 4:4:4 surfaces, I realised that we were enumerating all endpoints and checking formats for them. The problem with this is that decoding (VLD) endpoints are only a subset of what vaapi exposes. All the encoding endpoints are there too, and there is also the None profile that we don't care about, but which generates ffmpeg warnings if you try and examine it. So, let's only look at VLD endpoints. This will speed things up a little bit and make the logging less noisy.
* ci/appveyor: fix package install lineappveyorsfan52022-02-061-1/+1
| | | | | It appears MinGW switched their pkg config implementation from pkg-config to pkgconf, causing all builds to fail because we requested the former.
* osc.lua: seekbar hover: speed-up chapter accessAvi Halachmi (:avih)2022-02-061-8/+9
| | | | | | | | | | | | | | | | | | | | | | This speeds up chapter name access while hovering the seekbar: - Fetch the chapter-list property using observation rather than on every render while hovering the bar. Property access, especially with potentially lots of values (chapters), can be expensive-ish, and can involve locking, so the less per-render the better. - Sort the list once (on change) to simplify the iteration logic when searching the chapter which matches the mouse position. It's still O(N) (no binary search currently), but with less work. The cached sorted list is stored at the state. While there are other places which access this property and could use this cache, for now we don't touch them, because they're not performance-critical (on init for the chapter markers, on ch_{prev,next} button click for OSD). Caching properties using observation instead of using mp.get_property can indeed speedup other places too, but it should be part of a system rather than implemented per-property. Maybe some day.
* js: utils.get_user_path: make wrapper of expand-pathAvi Halachmi (:avih)2022-02-043-10/+5
| | | | | | | | When utils.get_user_path was added, the expand-path command didn't exist. Now it does, so remove the C code, make it a trivial wrapper. Keep this function for backward compat to not break scripts, but technically it's not required anymore.
* libplacebo: switch to new target format APINiklas Haas2022-02-031-1/+6
| | | | | `target_dummy` got deprecated in version v4.169. We unfortunately have to hide this behind an #if for the time being.
* libplacebo: switch to new GPU limits APIsNiklas Haas2022-02-031-6/+11
| | | | | `caps` is deprecated, and replaced by individual fields in `pl_glsl_version` / `pl_gpu_limits`.
* libplacebo: switch to v4 naming conventionNiklas Haas2022-02-035-50/+46
| | | | | All of these const struct pointers got typedefs, clean up the code accordingly.
* libplacebo: update log helpersNiklas Haas2022-02-038-38/+35
| | | | | Use the pl_log APIs introduced in libplacebo v4, replacing the deprecated pl_context concept.
* libplacebo: bump minimum dependency to 4.157Niklas Haas2022-02-033-12/+5
| | | | | | This has been the latest stable release for about half a year now. This version in particular lets us get rid of all the deprecation warnings in the older code. (See the following commits)
* vo_gpu_next: create shader cache dir if missingNiklas Haas2022-02-031-0/+1
| | | | | Failing to do this results in the shader cache not actually ever being written, ergo no shader caching being done. Oops.
* build: rename libplacebo version checkNiklas Haas2022-02-034-8/+8
| | | | | Rename from "libplacebo-v4" to "libplacebo-next" to more closely capture the intent, since this will become libplacebo v5 eventually (tm).
* wayland: always start rendering after a resizeJulian Orth2022-02-031-0/+6
| | | | | | | | | | | | | | | | | | | The wayland backend contains logic to detect if the window is hidden. If so, we skip rendering as an optimization. However, if we receive multiple resize events in rapid succession, we will send the compositor new buffers faster than the refresh rate of the monitor. Therefore the compositor will not send us frame events which we incorrectly interpret as the window being hidden. Once the last buffer has actually been rendered, the compositor sends us a frame event. However, if at that point playback is paused, there is no logic to restart rendering of frames that we skipped due to the above optimization. Therefore we never send the compositor new buffers corresponding to the new size of the window and the surface will either be too small or too large. The simplest solution is to always render a few frames after we receive a resize event.
* DOCS/options.rst: fix typo (double "aspect")Avi Halachmi (:avih)2022-02-031-1/+1
|
* filter kernels: add cosine windowgaramond132022-02-031-0/+6
| | | | filter kernels: add cosine window
* wscript: bump libplacebo version requirement to 4.190Jan Ekström2022-02-021-2/+2
| | | | | | | | Was done in meson.build as part of a9cb2e2821adb40e7548e8233390e79706104041 , but the waf wscript was missed. This brings the two files in sync again.
* vo_gpu_next: initial attempt at adding d3d11 supportJan Ekström2022-02-022-8/+88
|
* vo_gpu_next/context: common'ize things that would be common for non-vulkanJan Ekström2022-02-021-10/+25
| | | | This prepares us to not duplicate all of this code for d3d11.
* vo_gpu/d3d11: enable access to the underlying ra_ctx swap chainJan Ekström2022-02-022-0/+22
| | | | This enables us to utilize it from gpu-next.
* vo_gpu/d3d11: add more usage flags to the swapchain imagesJames Ross-Gowan2022-02-021-1/+8
| | | | | | | | vo_gpu_next and libplacebo expect swapchain images to be able to be blitted to, which for libplacebo on FL11_0 and up means they have to have DXGI_USAGE_UNORDERED_ACCESS, since libplacebo uses a compute shader to emulate certain kinds of blits. For libplacebo's benefit, set all applicable usage flags on swapchain images.
* vo_gpu/d3d11: early exit in start_frame if output fbo is nullptrJan Ekström2022-02-021-0/+3
|
* win32: apply geometry position to content instead of windowAvi Halachmi (:avih)2022-02-021-1/+6
| | | | | | | | | | | | | | The docs specify that the +-X+-Y geometry values position the content. This used to work correctly but got broken at 8fb4fd9a . Geometry size is unaffected - this only concerns position. Commit 8fb4fd9a made it center the window rather than the content by taking the borders into account during positioning, but forgot to make an exception when a position is specified explicitly. This commit adds this exception, and now if a specific position is requested then the borders are ignored, and the content is positioned correctly.
* meson: fix libdl existence check for *bsd systemsAndrew Krasavin2022-02-021-6/+7
|
* auto_profiles.lua: don't warn if profile-restore=defaultCogentRedTester2022-01-301-1/+1
| | | | | | | | | | | | | | | The code assumed that the value of the profile-restore field is "default" for such profiles, but the C implementation is such that the field is intentionally omitted in such case. This resulted in incorrectly trying to restore such profiles. However, there are no stored values with profile-restore=default, so it only resulted in a harmless warning, but otherwise behaved correctly (i.e. nothing is restored). Fix the condition by taki