summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* 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
| | | | ffmpeg was internally defaulting to 24000fps, which resulted in encoders selecting inappropriate levels and making poor ratecontrol decisions.
* wayland: add auto choice to wayland-configure-boundsDudemanguy2023-01-301-2/+12
| | | | | | | | | | | Previously, this defaulted to yes and configure-bounds from the compositor would always apply. In the case where the user explicitly set autofit or geometry, this could be confusing because configure-bounds would take precedence over it. Instead, let's add an auto choice and make that the default. If we detect that the option is on auto and that there is autofit/geometry being set, then ignore the event. This should be more intuitive since someone who bothers to explicitly set mpv's geometry would naturally expect that geometry to actually apply.
* wayland: handle runtime hidpi-window-scale changes correctlyDudemanguy2023-01-301-6/+2
| | | | | | | | | | | Semi-regression although this option never really did what the manual said until recently. In the past, this option also controlled whether or not mpv set the wayland buffer_scale to the value of the wl_output or force it 1. This had varying effects depending on the exact compositor configuration. That logic has now all been removed and this option now only controls whether or not to scale the window with the hidpi scale factor we get from the compositor. i.e. it actually does what the manual says now.
* wayland: unbreak runtime geometry/autofit changesDudemanguy2023-01-301-12/+15
| | | | | | | | Regressed from 879824a47f50f7e93f85992c92d03f37129605f4. The geometry needs to be explictly recalculated now. Change up this function a little bit also give it the ability to directly perform a resize after the fact. This is a common workflow and we'll be using it in the next commit.
* hwdec_vaapi: close file descriptors even if surface export failsAaron Boxer2023-01-281-0/+7
| | | | otherwise they can leak
* vo_dmabuf_wayland: close file handles when surface export failsAaron Boxer2023-01-281-2/+9
| | | | file handles may still be opened despite failure
* vo_dmabuf_wayland: plug leaking file descriptor from solid buffer poolAaron Boxer2023-01-281-0/+1
|
* vo_opengl/angle_dynamic: simplify symbol renaming to make it more ↵Kacper Michajłow2023-01-282-8/+5
| | | | straightforward
* x11: remove PresentNotifyMSC from egl/glx/vulkan to fix xpresent timingSultan Alsawaf2023-01-253-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PresentNotifyMSC turns out to be not only redundant, but also harmful with mesa-backed egl/glx/vulkan VOs because for all of them, mesa uses PresentPixmap behind the scenes when DRI3 is available, which already spawns a PresentCompleteNotify event when the buffer swap actually finishes. This is important because without using the timing information from these PresentCompleteKindPixmap events, there's no way for mpv to know exactly when a frame becomes visible on the display. By using PresentNotifyMSC in conjunction with DRI3-enabled mesa, two problems are created: 1. mpv assumes that a vblank won't elapse (i.e., it assumes the current MSC won't change) between the time when mesa enqueues the buffer swap and the time when mpv calls PresentNotifyMSC to ask xorg for a notification at the next MSC, relative to the current MSC at the time that xorg reads it for the PresentNotifyMSC call. This means that mpv could get a notification one or more vblanks later than it expects, since the intention here is for mpv to get a notification at the MSC that the buffer swap completes. 2. mpv assumes that a buffer swap always takes one vblank to complete, which isn't always true. A buffer swap (i.e., a page flip) could take longer than that depending on hardware conditions (if the GPU is running slowly or needs to exit a low-power state), scheduling delays (under heavy system or GPU load), or unfortunate timing (if the raster scan line happens to be at one of the last few rows of pixels and a vblank elapses just before the buffer swap is enqueued). This causes mpv to have a faulty assumption of when frames become visible. Since mpv already receives the PresentCompleteNotify events generated by mesa's buffer swaps under the hood, the PresentNotifyMSC usage is unneeded and just throws a wrench in mpv's vsync timing when xpresent is enabled. Simply removing the PresentNotifyMSC usage from the egl, glx, and vulkan VOs fixes the xpresent vsync timing.
* wayland: add wp-fractional-scale-v1 supportDudemanguy2023-01-245-17/+113
| | | | | | | | | | | | | This protocol is pretty important since it finally lets us solve the longstanding issue of fractional scaling in wayland (no more mpv doing rendering over the target resolution and then being scaled down). This protocol also can completely replace the buffer_scale usage that we are currently using for integer scaling so hopefully this can be removed sometime in the future. Note that vo_dmabuf_wayland is omitted from the fractional scale handling because we want the compositor to handle all the scaling for that VO. Fixes #9443.
* wayland: rewrite geometry and scaling handlingDudemanguy2023-01-246-39/+31
| | | | | | | | | This is in preparation for fractional scaling support. Basically, redo all the coordinates in wayland so that wl->geometry is equal exactly to what is being put out to the screen (no extra wl->scaling multiplication required). The wl->vdparams variable is also eliminated for simplicity. This changes mpv's behavior on wayland with hidpi scaling but that will be addressed in more detail with the next commit.
* vo_gpu: implement VO_DR_FLAG_HOST_CACHEDsfan52023-01-236-0/+30
| | | | | | | | For OpenGL, this is based on simply comparing GL_VENDOR strings against a list of allowed vendors. Co-authored-by: Nicolas F. <ovdev@fratti.ch> Co-authored-by: Niklas Haas <git@haasn.dev>
* vo_gpu_next: implement VO_DR_FLAG_HOST_CACHEDNiklas Haas2023-01-231-0/+5
| | | | For sufficiently new versions of libplacebo.
* vd_lavc: add "auto" choice for vd-lavc-drsfan52023-01-232-4/+12
| | | | | | | | | | | | --vd-lavc-dr defaulted to "yes", which caused issues on certain hardware. Instead of disabling it, add a new "auto" value and make it the default. The "auto" choice will enable DR only when we can request host-cached buffers (as signalled by the new VO_DR_FLAG_HOST_CACHED). Co-authored-by: Nicolas F. <ovdev@fratti.ch> Co-authored-by: Niklas Haas <git@haasn.dev>
* vo: add `int flags` to the get_image signatureNiklas Haas2023-01-2312-29/+34
| | | | | This is a huge disgusting mess to thread through everywhere. Maybe I'm stupid for attempting to solve the problem this way.
* drm: rewrite based around vo_drm_stateDudemanguy2023-01-2110-1168/+951
| | | | | | | | | | | A longstanding pain point of the drm VOs is the relative lack of state sharing. While drm_common does provide some sharing, it's far less than other platforms like x11 or wayland. What we do here is essentially copy them by creating a new vo_drm_state struct and using it in vo_drm and context_drm_egl. Much of the functionality that was essentially duplicated in both VOs/contexts is now reduced simple functions in drm_common. The usage of the term 'kms' was also mostly eliminated since this is libdrm nowadays from a userspace perspective.
* mp_image: fix XYZ primaries defaultNiklas Haas2023-01-211-4/+4
| | | | | This was incorrectly set to BT.2020, when it should be DCI-P3 for pretty much all real-world XYZ content (which is digital cinema content).
* hwdec_cuda: drop support for PL_HANDLE_WIN32_KMTNiklas Haas2023-01-172-35/+17
| | | | | | | | | | | | | | | This handle type was only needed for backwards compatibility with windows 7. Dropping it allows us to simplify the code: there is no longer a need for runtime checks, as the handle type can now be statically assigned based on the platform. The motivating usecase here, apart from code simplification, is a desired switch to timeline semaphores, which (in the CUDA API) only supports the non-KMT win32 handles. It's worth pointing out that we need no runtime check for IsWindows8OrGreater(), because the `export_caps.sync` check will already fail on versions of windows not supporting PL_HANDLE_WIN32.
* wayland: only warn when actually missing idle inhibit supportThomas Weißschuh2023-01-161-5/+6
|
* vo: make driver list staticThomas Weißschuh2023-01-161-1/+1
|
* vo: remove trailing NULL element from driver arrayThomas Weißschuh2023-01-161-3/+2
|
* wayland: store presentation feedbacks in a poolDudemanguy2023-01-132-20/+65
| | | | | | | | | Officially, the most cursed part of the wayland code in mpv (third or fourth try now?) This time, let's allocate a pool during init (arbitrarily set to the maximum swapchain length mpv allows, 8; don't even know if this actually works in wayland). Then we add/remove feedbacks from the pool during the lifecycle of the VO, and clean it up all at the end. Hopefully, this does the trick for good this time.
* Revert "wayland: dispatch and wait for compositor events in uninit"Dudemanguy2023-01-132-22/+27
| | | | | | | | | | | This ended up being a bad idea. The problem is that it introduces ordering when destroying events (something we weren't worried about before) and Lynne pointed out a problem with the callback not also being destroyed before the surface in IRC. Just undo this and go with a different approach (next commit). P.S. the wayland_dispatch_events name change is kept though because I like that better. This reverts commit aa8ddfcdf30c4ffb38f3ec5d6663bbabf0b7b4df.
* various: replace abort() with MP_ASSERT_UNREACHABLE() where appropriatesfan52023-01-129-20/+19
| | | | | | | | In debug mode the macro causes an assertion failure. In release mode it works differently and tells the compiler that it can assume the codepath will never execute. For this reason I was conversative in replacing it, e.g. in mpv-internal code that exhausts all valid values of an enum or when a condition is clear from directly preceding code.
* various: replace if + abort() with MP_HANDLE_OOM()sfan52023-01-129-28/+14
| | | | | MP_HANDLE_OOM also aborts but calls assert() first, which will result in an useful message if compiled in debug mode.
* {video,audio}: adjust unsafe strncpy usagessfan52023-01-121-2/+2
|
* video/x11: replace sprintf usagesfan52023-01-121-1/+1
|
* video: replace sprintf usagesfan52023-01-122-2/+2
|
* ra_d3d11: fix incorrect typesfan52023-01-121-1