summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* vo_gpu_next: drop various PL_API_VER checksllyyr2023-03-262-46/+2
| | | | | We don't need these anymore now that we require PL_API_VER>=264 for building libplacebo-next
* vo_gpu_next: compatibility with libplacebo v6.265llyyr2023-03-131-1/+6
| | | | | | | | libplacebo v6.265.0 removed v4 deprecations. We already require PL_API_VER >= 202, so we don't need to wrap pl_tex_transfer_params.row_pitch around a conditional, which exists since PL_API_VER >= 168. However, pl_source_frame.duration does not exist until PL_API_VER >= 219, so we should use a conditional directive.
* wayland: make wayland-edge-pixels-pointer default to 16Dudemanguy2023-03-081-1/+1
| | | | | 10 is ludicrously small. How did no one on an CSD compositor complain about this?
* wayland: use correct x/y coordinates for the cursorDudemanguy2023-03-082-15/+11
| | | | | | | | | | | | | While adding fractional scale support, the coordinates for wayland changed to always include the scaling parameter. The pointer stuff actually did too. However, the check_for_resize function used the unscaled, local surface coordinates. Likely, it was neccesary at the time since wl->geometry used to report unscaled coordinates. In light of that, we can just simply use mouse_x/y instead for this function to make it work correctly with the right/bottom edges. mouse_unscaled becomes completely unneccesary, so just drop it. Some minor style changes included just because.
* wayland: fix client side resizeChristoph Heinrich2023-03-071-1/+1
| | | | | | | `xdg_toplevel_decoration` exists on SSD compositors independent of if there is a border or not, so resizing didn't work on those. Checking the border option makes more sense and also works on such compositors.
* vo_gpu_next: compatibility with PL_API_VER >= 254Niklas Haas2023-03-061-2/+12
| | | | This field was renamed/moved to a different params struct.
* vo_gpu_next: use inverse mapping functions to tag screenshotsLeo Izen2023-03-051-14/+5
| | | | | | Screenshots using the hardware renderer should now include color tags that map directly from the libplacebo tags, so the if/else logic only needs to be included once.
* video/out/placebo/utils: add mappings from pl enums to mpv enumsLeo Izen2023-03-052-0/+72
| | | | | | | mp_trc_to_pl, mp_prim_to_pl, and mp_levels_to_pl have forward but not inverse mappings. This commit adds mp_trc_from_pl, mp_prim_from_pl, and mp_levels_from_pl inverse mapping functions, which just map the enums in the other direction.
* video: add missing libplacebo colorspace enumsLeo Izen2023-03-054-0/+53
| | | | | Add some missing libplacebo primaries and transfer enums to mpv's enum constant tables, and update the functions that convert between the two.
* mp_image: assert if src and dst are different in copy_attributesKacper Michajłow2023-03-051-0/+2
| | | | | It doesn't make sense to call this function on same image and the code is not safe to do so.
* mp_image: copy side data in mp_image_copy_attributesKacper Michajłow2023-03-051-0/+12
| | | | | This fixes HDR10 and HDR10+ metadata usage in vo_gpu_next when hwdec copy variant is used.
* vo: fix race condition with redraw requestsDudemanguy2023-03-021-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a very subtle race in vo that can manifest itself on pause events. In the renderloop, render_frame, unsurprisingly, does the heavy lifting of actually queuing up and flipping the frames. This is called during normal playback. Sometimes various parts of the player can make a redraw request which will latter trigger another render of the frame later down in the loop (do_redraw). Because these requests can happen at essentially anytime, sometimes the redraw request will happen *before* do_redraw and it'll be caught in render_frame. When this happens, the existing render_frame run works perfectly fine as a redraw so it clears out the request which is sensible. Normally this is all locked of course, but there's one catch. render_frame has to unlock itself when propagating down into specific VOs/backends. That's what causes this bug. While render_frame is unlocked, other parts of the player can send redraw requests which will cause in->request_redraw to become true. The logic in the code always clears out this parameter after a successful render, but this isn't correct. When in->request_become becomes true in the middle of render_frame, there needs to be one more draw afterwards to reflect whatever actually changed (usually the OSD). Instead, this gets simply discarded. If you rapidly spam pause while rendering things to the OSD at the same time, it's possible to for the last render to be behind a frame and appear as if your osd event was ignored. Once you realize what is happening, the fix is quite simple. Just store the initial value of in->request_redraw before the unlock step. After we do the render step and unlock again, only set in->request_redraw to false if there was an initial redraw request. We just finished doing a redraw, so it is safe to clear. Otherwise, leave in->request_redraw alone. If it is initially false, then it will still be false and nothing changes. However if it updated to true in the middle of the rendering, this value is now preserved so we can go and call do_redraw later and show what that last frame was meant to be when you pause. One unfortunate thing about this design is that it is technically possible for other internal things in vo to update during that unlocked period. Hopefully, that doesn't actually happen and only redraw requests work like this. Fixes #8172 and #8350.
* test: integrate unittests with mesonDudemanguy2023-03-024-15/+21
| | | | | | | | | | | | This reworks all of mpv's unit tests so they are compiled as separate executables (optional) and run via meson test. Because most of the tests are dependant on mpv's internals, existing compiled objects are leveraged to create static libs and used when necessary. As an aside, a function was moved into video/out/gpu/utils for sanity's sake (otherwise most of vo would have been needed). As a plus, meson multithreads running tests automatically and also the output no longer pollutes the source directory. There are tests that can break due to ffmpeg changes, so they require a specific minimum libavutil version to be built.
* zimg: fix MP_CSP_PRIM_CIE_1931 mappingKacper Michajłow2023-03-021-1/+1
| | | | | MP_CSP_PRIM_CIE_1931 are RGB primaries, not ZIMG_PRIMARIES_ST428 which is XYZ.
* zimg: add ZIMG_TRANSFER_ST428 mappingKacper Michajłow2023-03-021-0/+4
|
* zimg: set correct primaries for XYZKacper Michajłow2023-03-021-1/+4
|
* sws_utils: hardcode output gamma and primaries for XYZKacper Michajłow2023-03-021-0/+10
|
* mp_image: fix XYZ gamma and primaries guessKacper Michajłow2023-03-021-12/+4
|
* vo_gpu: improve XYZ conversionKacper Michajłow2023-03-022-6/+14
| | | | Fixes #4925
* mp_image: be less agressive with clearing color informationKacper Michajłow2023-03-021-3/+8
|
* csputils: add MP_CSP_TRC_ST428 as defined in ST 428-1Kacper Michajłow2023-03-024-0/+15
|
* player: add --auto-window-resize optionDudemanguy2023-03-024-14/+23
| | | | | | | | | | | mpv's window resizing logic always automatically resized the window whenever the video resolution changed (i.e. advancing forward in a playlist). This simply introduces the option to make this behavior configurable. Every windowing backend would need to implement this behavior in their code since a reconfigure event must always be a resize. The params of the frame changed so you either have to resize the window to the new size of the params or make the params the same size as the window. This commit implements it for wayland, win32, and x11.
* ra: assert when using params with dimensionsDudemanguy2023-03-021-0/+10
| | | | | | | | | | This came up in #9828. According to the header comments, creating a 1D ra_tex requires height and depth to be set to 1. For a 2D texture, it requires depth be set to 1. There were a couple of spots in mpv's code where this wasn't being followed. Although there was no known bug from this, the rest of the code works like this so it was a good idea to go ahead and sync it up. As a followup, let's just add some simple asserts to ra.c to enforce this so it doesn't go unnoticed in the future.
* wayland: request frame callbacks on the topmost surfaceDaniel van Vugt2023-02-282-3/+5
| | | | | | | | | | | | Which is wl->video_surface for vo_dmabuf_wayland. Listening on wl->surface results in freezes if it is occluded and culled by the compositor. Which mutter does, and the wl_surface::frame spec warns about: > A server should avoid signaling the frame callbacks if the > surface is not visible in any way, e.g. the surface is off-screen, > or completely obscured by other opaque surfaces.
* wayland: deduplicate and cache detection of dmabuf-waylandDaniel van Vugt2023-02-282-4/+4
|
* wayland: use bool type for alpha framebuffer trackingRay Smith2023-02-285-5/+5
| | | | | | | | | ra_ctx_opts.want_alpha and vo_wayland_set_opaque_region's alpha argument are only used as bool but both are ints. Particularly for the function argument, passing a 0 or 1 is confusing - at first glance it looks like you're specifying an alpha value of 0 or 1. Since they're only used as bools, make them bools.
* vo_gpu: d3d11_helpers: prefer DXGI_SWAP_EFFECT_FLIP_DISCARD if possiblemsoxzw2023-02-281-2/+8
| | | | | | | Similar to libplacebo[1], DXGI_SWAP_EFFECT_FLIP_DISCARD is used instead of DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL starting with Windows 10. [1]: https://github.com/haasn/libplacebo/blob/master/src/d3d11/swapchain.c
* vf_gpu: initialize depth=1 on target texturesaverne2023-02-281-0/+1
| | | | | According to internal documentation, 2D textures should have d=1. This fixes the correctness of the API usage, not any bug.
* video: initialize depth=1 on screenshot texturesaverne2023-02-281-0/+1
| | | | | According to internal documentation, 2D textures should have d=1. This fixes the correctness of the API usage, not any bug.
* various: fix warning -Wimplicit-const-int-float-conversionThomas Weißschuh2023-02-261-2/+2
|
* vo_gpu_next: fix warning -Wunused-functionThomas Weißschuh2023-02-261-0/+2
|
* vo_wayland: fix warning -Wvoid-pointer-to-enum-castThomas Weißschuh2023-02-261-1/+1
|
* vd_lavc: sort hwdecs without hwdevices last for autoprobingsfan52023-02-261-0/+3
| | | | | | For hwdecs without devices we can't get instant feedback during probing whether the hwdec can possibly work or not, so we definitely want to try them last. Independently this would also have solved the issue addressed by the previous commit.
* vd_lavc: prioritize mediacodec for hwdec autoprobesfan52023-02-261-0/+2
| | | | | | This fixes an issue where mpv would try mediacodec (which may not be available depending on Android version) and pick v4l2m2m next which ends up failing even though mediacodec-copy would have been available.
* video: make csp option definitions privateThomas Weißschuh2023-02-242-22/+19
|
* video: make csp equalizer params floatThomas Weißschuh2023-02-242-11/+11
| | | | | | This allows more precise adjustments. Fixes #11316
* vo_gpu: fix newline in log messagesfan52023-02-241-1/+1
|
* vo_gpu_next: fix color space hint with target peak overrideKacper Michajłow2023-02-231-1/+4
| | | | Fixes: #11339
* options: remove explicit initialization of integers to 0Christoph Heinrich2023-02-213-12/+1
|
* options: transition commands from OPT_FLAG to OPT_BOOLChristoph Heinrich2023-02-216-3/+5
|
* options: transition options from OPT_FLAG to OPT_BOOLChristoph Heinrich2023-02-2141-198/+185
| | | | | | c78482045444c488bb7948305d583a55d17cd236 introduced a bool option type as a replacement for the flag type, but didn't actually transition and remove the flag type because it would have been too much mundane work.
* various: drop unused #include "config.h"Thomas Weißschuh2023-02-2032-48/+0
| | | | | | Most sources don't need config.h. The inclusion only leads to lots of unneeded recompilation if the configuration is changed.
* Vulkan: add configure check for VK_KHR_display extensionrcombs2023-02-201-0/+2
| | | | This allows building directly against ICDs that don't implement this extension.
* vo_gpu_next: add --tone-mapping-visualizeNiklas Haas2023-02-193-0/+5
|
* vo_gpu_next: parse Dolby Vision metadata for dynamic scene brightnessquietvoid2023-02-193-16/+53
| | | | | Improves playback for Dolby Vision video files as the metadata can be used instead of requiring `hdr-compute-peak=yes`.
* mp_image: forward AV_FRAME_DATA_DOVI_RPU_BUFFER side dataquietvoid2023-02-193-1/+13
| | | | When available, and ignored if `vf=format:dolbyvision=no`.
* Revert "vo_dmabuf_wayland: drop support for linux-dmabuf-v2"Dudemanguy2023-02-184-5/+35
| | | | | | | | | | | This was originally dropped because it was thought to be unneeded at the time, but at least some devices (rockchip) apparently are still on old compositors that use linux-dmabuf v2. It's not much code, and for testing purposes it's good to have around since it's hard to test drmprime otherwise. Some minor additions are here to support the newly added vaapi-format mapping in v2 of the protocol. This reverts commit a5b9d529eec8d4bb6fc858143337c3573ec8afd0.
* video/image_writer: use effort=4 default for JXL screenshotsLeo Izen2023-02-171-1/+1
| | | | | | effort=4 has a significant increase in quality/bpp compared to effort=3 with a very minor increase in encoding time. It's worth the trade-off as a default setting for lossy encoding.
* vo_gpu_next: allow native CSP screenshotsNiklas Haas2023-02-131-0/+5
| | | | | Useful for getting native screenshots of non-sRGB content, such as HDR etc.
* player/screenshot: pass on ability to output native CSPNiklas Haas2023-02-131-1/+1
| | | | Fixes: #10988
* video/image_writer: force sRGB for unsupported formatsNiklas Haas2023-02-131-8/+13
| | | | | | | | | After commit c98e7353, we blindly pass the screenshot colorspace to the image writer. But since we want to introduces the ability to save images in HDR and other exotic formats, we should strip this for unsupported formats. See-Also: #10988
* video/image_writer: add image_writer_flexible_cspNiklas Haas2023-02-132-0/+16
| | | | | | PNG only supports this since the introduction of cICP, so put a version check on the next API version bump after the cICP writing patch got merged.
* vo_gpu_next: tag screenshots with correct colorspaceNiklas Haas2023-02-131-0/+15
| | | | | | | | | When taking window screenshots with a colorspace override, tag them appropriately, based on the best-known colorspace info. Note that this is imperfect, we should ideally also attach the output ICC profile if one exists. But this is better than nothing. Also force 1:1 PAR in this case. In all other cases, default to sRGB.
* vo_gpu_next: only apply target options in window screenshot modeNiklas Haas2023-02-131-1/+5
| | | | | | | | | | When taking an unscaled screenshot, always render to an unspecified SDR-like space. (Subject to change) Apply output-specific options (ICC profile, color space overrides, custom LUT) only in window screenshot mode. I decided to split this off from subsequent refactors because it is IMO a bug fix deserving of its own commit.
* vo_gpu_next: be explicit about screenshot reprNiklas Haas2023-02-131-0/+1
| | | | | | Screenshots are currently always RGB. Subject to change, but needs to be communicated clearly if changed. This commit is not a functional change, it's merely for code clarity.
* vo_gpu_next: expose --tone-mapping=st2094-40 and st2094-10Niklas Haas2023-02-133-1/+9
|
* vo_gpu_next: support mapping HDR10+ dynamic metadataNiklas Haas2023-02-131-0/+19
| | | | | | | Based on the new upstream helper function `pl_map_hdr_metadata` and the existing AV_FRAME_DATA_DYNAMIC_HDR_PLUS. This allows us to use SMPTE 2094-40 dynamic HDR tonemapping in mpv, albeit with the limitation of requiring `--tone-mapping=auto` in order to pick this curve upstream.
* vf_sub: undeprecateDudemanguy2023-02-111-2/+0
| | | | | | | | | | 3a9e661e929c34d25810fa903abbd9961f73ecef officially made this video filter deprecated roughly 6 years ago. Every other video filter in that commit has actually been removed since then except for vf_sub. ffmpeg does have its own subtitles filter, but it doesn't have the same control over scale like vf_sub does. That's probably why wm4 never actually removed it. Let's stop scaring users with a warning since this filter probably won't ever get removed. Closes #9254.
* vo_dmabuf_wayland: reject hw formats not supported by compositorAaron Boxer2023-02-1110-33/+78
|
* video/image_writer: change screenshot-tag-colorspace default to yesLeo Izen2023-02-091-1/+1
| | | | | | With significant improvements to the color tagging support in various screenshot formats, e.g. cICP in FFmpeg, and JPEG XL's generally robust color support, it's safe to default this to yes.
* vo_dmabuf_wayland: add purgatory list to buffer pool to avoid memory leaksAaron Boxer2023-02-053-65/+114
|
* vo_dmabuf_wayland: ensure buffer pool is cleaned at start of uninitAaron Boxer2023-02-051-1/+1
|
* vo_dmabuf_wayland: simplify buffer pool resetAaron Boxer2023-02-051-12/+9
|
* vo_dmabuf_wayland: only resize when a new frame is about to be drawnAaron Boxer2023-02-051-4/+12
|
* image_pool: properly free framesThomas Weißschuh2023-02-031-2/+2
| | | | av_frame_unref() only frees the buffers, not the frame data itself.
* sws_utils: add check for HAVE_ZIMG to suppress warningsKacper Michajłow2023-02-021-0/+5
|
* vo_gpu_next: add check for PL_HAVE_LCMSKacper Michajłow2023-02-021-1/+1
|
* hwdec_cuda: fix enum type for semaphoreKacper Michajłow2023-02-021-4/+4
|
* vo_d3d11: do not call MAKEINTRESOURCEW twiceKacper Michajłow2023-02-021-1/+1
|
* osdep: add MP_FALLTHROUGHKacper Michajłow2023-02-023-3/+3
|
* libplacebo: fix enum type castKacper Michajłow2023-02-021-4/+4
|
* video/image_writer: avoid stripping colorspace info when writing imageLeo Izen2023-01-311-0/+1
| | | | | | | | | | | | | Writing an image either with vo_image or with a screenshot will strip the colorspace info because it allocates a new mp_image that contains the same data as the old image after calling mp_image_params_guess_csp. However, mp_image_params_guess_csp cannot always guess the appropriate colorspace, so it picks a "sane default." Since this function also changes parameters so the space always makes sense, this extra info isn't harmful and allows screenshots and vo_image outs to be properly tagged with the correct colorspace. Fixes #10988.
* hwdec/vaapi: zero-initialize VADRMPRIMESurfaceDescriptorDudemanguy2023-01-301-1/+1
| | | | | Otherwise, desc can contain garbage values and segfault trying to close file descriptors that aren't actually there. Fixes #11239.
* vo_lavc: set frame rate on encoder; fixes #11215rcombs2023-01-291-0/+11
| | |