summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* vo: remove frame timing check from vo_still_displaying()Kacper Michajłow2023-10-071-10/+3
| | | | | This timing dependency does not guarantee that we will wake up in the future, depending on processing times.
* Revert "video: remove another redundant wakeup"Kacper Michajłow2023-10-072-42/+19
| | | | | | | | | | | | | | | vo_still_displaying() is racey with vo_request_wakeup_on_done() and above that it doesn't work as expected. VO can run out of work and go to sleep for 1000s, while the play thread still returns on vo_still_displaying() check, because of a check `now < frame_end` so it never advances and go to sleep itself. This fixes dead lock that we have when image parameters changes during playback. This reverts commit 0c9ac5835be70ae26e4aa875e833fe2c7b3b3bf3. Fixes: #12575
* mp_image: don't copy crop value from opaque_refKacper Michajłow2023-10-071-1/+0
| | | | | | It is already set above. Fixes: #12577, #12587
* vo_gpu_next: improve updating overlaysDudemanguy2023-10-053-25/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | fbe154831a8addfc18a4f81e1c4b9284c31acace added a new VOCTRL to signal when the OSD changed for gpu-next's handling of subtitles, but this is both not necessary and actually incomplete. The VOCTRL would signal OSD changes, but not all subtitle changes (like selecting another non-external sub track for example). VOCTRL_OSD_CHANGED was used to increment p->osd_sync which would then redraw the blended subtitles if the player was paused. But there's already a VOCTRL_PAUSE and VOCTRL_RESUME. Plus, the sub_bitmap_list object will have items in it if it changed in any way, so we don't need the VOCTRL_OSD_CHANGED method at all. That can be removed. The check that fp->osd_sync < p->osd_sync stays in place since that's an optimization while the video is playing, but we also check the pause state as well since the VO can know this. If we're paused, then always do update_overlays since core must be signalling a redraw to us if we get a draw_frame call here. Additionally in update_overlays itself, the p->osd_sync counter is incremented if we have any items since the frame signature will need that. As for the actual bug that is fixed, changing subtitle tracks while paused with blended subtitles now correctly works. Previously, it was never updated so the old subtitle stayed there forever until you deselected it (since VOCTRL_OSD_CHANGED triggered there). Also include some cosmetic code fixes that were noticed.
* vo_dmabuf_wayland: correct full window size calculationDudemanguy2023-10-051-1/+3
| | | | | | | | | | | The current calculation makes the implicit assumption that the margins on both sides are always equal (the 2 times multiplication). This isn't true though. For example, a 720p video fullscreened on a 1680x1050 display will have a top margin of 52 but a bottom margin of 53. The current calculation just multiplies 52 by 2, so it's off by one. Fix this by adding together all the margins together (left + right or top + bottom) then adding that to the dst window size (width or height). This way, we get the full size of the window for the viewport. Fixes #12554.
* win32: clear client area to black earlyKacper Michajłow2023-10-051-2/+5
| | | | | | | | | | | | This fixes white background appearing for short period of time before first frame is drawn. Clear to black as this is way less distracting than bright white flash. Borderless window and fullscreen seems to be initially not drawn/transparent, so no need to clear it to black. Only when decorations are enabled (--border) the issue happens. Fixes: #12549
* vo_dmabuf_wayland: free frame if the visibility check failsDudemanguy2023-10-041-1/+4
| | | | | | Forgotten in 7b8a30fc8132203bc93d35ac887682d2044ad5a9. Every other case either is either a dummy frame (no allocated memory) or we manage it as part of the usual wayland buffer release.
* vo_dmabuf_wayland: eliminate an extra frame copyDudemanguy2023-10-033-29/+36
| | | | | | | | | | | | | | When implementing vo_dmabuf_wayland, it always did a copy of the image from the current frame and worked with that. The reason was because mpv's core held onto the frame and caused some timing issues and rendering glitches depending on when it freed the image. This is pretty easy to fix: just make vo_dmabuf_wayland manage the the frames. In vo.h, we add a boolean that a VO can set to make them manage freeing frames directly. After doing this, change the buffers in vo_dmabuf_wayland to store the whole vo_frame instead of just the image. Then, just modify some things a bit so frame is freed instead of the image. Now, we should truly have zero-copy playback. Well as long as you don't use libass to render anything (that's still a copy from system memory).
* win32: adjust WM_NCACTIVATE for better compatibility with window stateKacper Michajłow2023-10-021-2/+4
| | | | We have to support all changing states, not only borderless.
* vo_dmabuf_wayland: attach solid buffer when using force windowDudemanguy2023-10-022-2/+11
| | | | | | | | | | | | | | e125da2096d97ec7e64701bf6289705a24c31729 changed the z order of the surfaces a bit, but it turns out this has a side effect. If the aspect ratio of the actual video doesn't match your display, the osd surface doesn't scale properly and gets clipped. Put the z ordering back where it used to be. Instead when we have the force window case, simply attach the already existing solid buffer to the video surface. This allows the osd surface to actually draw over it instead of always being obscured so it satisfies the case of not having any real video frames but still wanting to draw the osd. Also don't mess with any of the viewport source setting stuff with force window. Weston complains about it, and it's nonsensical anyway. Fixes #12547.
* win32: add WS_THICKFRAME style in borderless modeKacper Michajłow2023-10-011-1/+9
| | | | | | Fixes window resizing in borderless mode after adding WS_SYSMENU. Fixes: 172d9be3005c6a85f4f139f1dedccefe26ea8d91
* vo: fully replace draw_image with draw_frameDudemanguy2023-10-0111-126/+58
| | | | | | | | | | | | 0739cfc20934ac7772ab71dbae7ecba4ba10fda4 added the draw_frame API deprecated draw_image internally. VOs that still used draw_image were around, but really there's no reason to not just "upgrade" them anyway. draw_frame is what the "real" VOs that people care about (gpu/gpu-next) use. So we can just simplfy the code a bit now. VOCTRL_REDRAW_FRAME is also no longer needed so that can be completely deleted as well. Note that several of these VOs are legacy crap anyway (e.g. vaapi) and maybe should just be deleted but whatever. vo_direct3d was also completely untested (not that anyone should ever use it).
* win32: set WS_SYSMENU style alwaysKacper Michajłow2023-10-011-1/+2
| | | | | | Fixes missing icon when initial window is created without caption. Fixes: #12472
* vo: don't invoke wait, when not neededKacper Michajłow2023-09-291-0/+3
| | | | | | | | This causes only problems, because we convert mp_time to realtime, which is not atomic, so we introduce error. And even though on sane platforms it should work fine, after all the sleep time is in the past. winpthreads like to sleep for like over 10ms when the time is less than current time, but not more than 1s.
* vo: increase display refresh rate estimation limit from 99 Hz to 400 HzKacper Michajłow2023-09-291-1/+1
| | | | High refresh rate displays exists...
* vo: change vsync base to nanosecondsKacper Michajłow2023-09-298-39/+40
| | | | | There is no reason to use microseconds precision. We have precise timers all all relevant platforms.
* timer: rename mp_add_timeout to reflect what it actually doesKacper Michajłow2023-09-291-1/+1
|
* timer: rename mp_time_us_to_timespec to reflect what it actually doesKacper Michajłow2023-09-292-3/+3
|
* vo_dmabuf_wayland: assume counter-clockwise rotationsDudemanguy2023-09-291-1/+4
| | | | | | | | | | | | | | In practice, most compositors implement the rotation clockwise which matches mpv's option, but amusingly this is actually incorrect. According to the spec*, wayland buffer rotations are counter-clockwise. So with this assumption in mind, in order for the rotation to match mpv's usual semantics, the 90 degree and 270 degree positions need to be flipped. Of course, this will make the VO rotate the wrong way on most compositors, but this is what the spec says (sway master is known to currently be correct). Fixes #12508 (sort of but will break the rotation direction on other compositors. Oh well). *: https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-enum-transform
* hwdec_drmprime: add nv16 supporthbiyik2023-09-292-0/+3
| | | | | | | | | NV16 is the half subsampled version of NV12 format. Decoders which support High 4:2:2 of h264 provide the frame in NV16 format to establish richer colorspace. Similar profiles are also available in HEVC and other popular codecs. This commit allows NV16 frames to be displayed over drmprime layers. Signed-off-by: hbiyik <boogiepop@gmx.com>
* wayland: don't double close display fdJack Mitchell2023-09-271-5/+2
| | | | | | | | Calling wl_display_disconnect closes the file descriptor, no need to manually do it ourselves beforehand which causes a double close on the fd. Signed-off-by: Jack Mitchell <jack.mitchell@tuxable.co.uk>
* win32: add option to change backdrop styleDeadSix2023-09-271-0/+17
|
* win32: pass window handle to the window-id propertyDeadSix272023-09-251-0/+6
| | | uses the same mechanic as for x11
* vo_gpu: remove --scaler-lut-sizeNiklas Haas2023-09-254-14/+9
| | | | | | | Pointless bloat option, hard-coded as 256 now in libplacebo and no reason not to also hard-code in mpv. See-Also: haasn/libplacebo@64d7c5aab06766a9492d3cfffd35333792052cd9
* vo_gpu: remove --scale-cutoff etcNiklas Haas2023-09-255-13/+5
| | | | | | | Pointless bloat option, hard-coded as 1e-3 now in libplacebo and no reason not to also hard-code in mpv. See-Also: haasn/libplacebo@64d7c5aab06766a9492d3cfffd35333792052cd9
* wayland: remove gnome-specific idle-inhibit warningDudemanguy2023-09-241-4/+0
| | | | | | | Unbelievably, mutter actually supports the idle inhibit protocol now after many years of pain*. Let's remove this hacky warning. *: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3145
* cuda: move --cuda-device to cuda_opts groupDudemanguy2023-09-222-10/+10
| | | | Also change a ta_free to talloc_free for consistency reasons.
* opengl/context_win: move opengl-dwmflush to wingl_opts groupDudemanguy2023-09-221-8/+23
| | | | Gets rid of yet another mp_read_option_raw call.
* libmpv_gl: replace mp_read_option_raw callDudemanguy2023-09-221-5/+5
|
* video/out/gpu: replace mp_read_option_raw callDudemanguy2023-09-221-3/+3
|
* win32: don't remove WS_CAPTION from styleKacper Michajłow2023-09-211-23/+16
| | | | | | | | Apparently removing WS_CAPTION disables some window animations. Instead adjust non-client area to not draw title bar. Note that we do not account for difference in real border size and invisible one, but seems to work correctly.
* win32: enable custom WM_NCHITTEST also when title bar is hiddenKacper Michajłow2023-09-211-1/+1
|
* win32: set window_corners to default for fullscreenKacper Michajłow2023-09-211-6/+10
| | | | | | I don't think in fullscreen mode it makes sense to enable rounded corners. We can add another option if someone needs it, but for now `window_corners` affects only the window as one would expect.
* win32: add --window-cornersKacper Michajłow2023-09-211-0/+11
| | | | Allows to set preference for window corners rounding for DWM.
* win32: fix fit_window_on_screen to account for invisible bordersKacper Michajłow2023-09-211-0/+12
| | | | Fixes too small initial window size.
* win32: reduce top border thickness to imitate DWM invisible bordersKacper Michajłow2023-09-211-0/+30
| | | | DWM makes part of left, right and bottom border invisible.
* win32: add an option to control window title bar stateKacper Michajłow2023-09-211-1/+5
| | | | Fixes: #11432
* win32: add an option to change window affinityDeadSix2023-09-211-0/+14
|
* wayland: ensure at least a scale factor of 1 when drawing cursorDudemanguy2023-09-211-2/+3
| | | | | | | | | | | | | | | | | | | With the addition of fractional scaling support, wl->scaling was converted to a double. Some compositors (Plasma) can report values under 1 for fractional scaling, so this meant wl->scaling could be some small fractional value. This is fine except that when using the legacy code for drawing the mouse cursor (i.e. not the cursor-shape protocol), it still uses the old integer scaling method in core wayland. The reason for this is simply because fractionally scaling the mouse cursor surface is nonsense and nobody even has cursor images for anything besides a select few sizes anyways (32x32, 48x48, etc.). The existing integer scaling sort of works but it's pretty bad too and you can get some weird sizes anyway. This is why cursor-shape is preferred since it fixes this. Anyways, since buffer scaling for the cursor only takes integers, there could be truncation to 0 in the previously mentioned fractional scale this. This naturally causes the compositor to send us an error and mpv quits. The fix is to always make sure that the scale value used for the cursor is at least 1. Anything less makes no sense. Fixes #12309.
* win32: explicitly guard dark mode calls by Windows versionKacper Michajłow2023-09-211-2/+14
| | | | | Fixes: #11610 Fixes: 9feeb324eddd9ed73ae667e10275f663d70f7544
* vo_gpu_next: use proper color for subtitlesKacper Michajłow2023-09-211-19/+28
| | | | | All SUBBITMAP_LIBASS are converted to sRGB beforehand, for the rest we need to use video color space.
* vo_gpu: don't override scaler options with default onesKacper Michajłow2023-09-211-2/+10
| | | | | | | There was assumption in the code that default settings are compatible with dumb mode and are only one that should be used in this case. Force bilinear if dumb mode is enabled.
* vo_gpu: allow deband-iterations to be 0llyyr2023-09-211-1/+1
| | | | | THis allows adding grain without debanding. libplacebo already supported this, so no changes are required there.
* drm: remove selecting the card number with --drm-connectorDudemanguy2023-09-211-18/+1
| | | | | | f56043759494dd584c8d82e7890f92fada18e34b deprecated this since the --drm-device path option was added as a replacement. Drop the card number selection logic.
* vo_sixel: change exit-clear handling to OPT_REPLACEDDudemanguy2023-09-211-2/+1
| | | | Easier to keep track of when we do want to remove it.
* options: remove a few options marked with .deprecation_messageDudemanguy2023-09-211-2/+0
| | | | | | | | | | | A bit different from the OPT_REPLACED/OPT_REMOVED ones in that the options still possibly do something but they have a deprecation message. Most of these are old and have no real usage. The only potentially controversial ones are the removal of --oaffset and --ovoffset which were deprecated years ago and seemingly have no real replacement. There's a cryptic message about --audio-delay but who knows. The less encoding mode code we have, the better so just chuck it.
* options: remove ancient option fallbacks/deprecationDudemanguy2023-09-219-46/+0
| | | | | | | | | | | | | We've got an ungodly amount of OPT_REPLACED and OPT_REMOVED sitting around in the code. This is harmless, but the vast majority of these are ancient. 26f4f18c0629998a9b91e94722d166866d8b80a3 is the last commit that touched the majority of these and of course that only changed how options were declared so all of this stuff was deprecated even before that. No use in keeping these, so just delete them all. As an aside, there was actually a cocoa_opts but it had only a single option which was replaced by something else and empty otherwise. So that entire thing was just simply removed. OPT_REPLACED/OPT_REMOVED declarations that were added in 0.35 or later were kept as is.
* vo_dmabuf_wayland: support osd rendering when there's no videoDudemanguy2023-09-212-25/+29
| | | | | | | | | | | | | The osd support was originally written with the requirement that we have actual frames getting delivered to the VO. This isn't always the case though. If you force a window on a blank audio file for example, then there will be no frame thus draw_frame did nothing. Since the previous commit allows us to reliably detect this, we can rearrange the code around a little bit to make this possible. A key change is to make the osd_subsurface have wl->surface as the parent. This is seemingly required otherwise the osd_surface buffers are never visible above the empty video_surface when we have a black window. Also nuke the desync call since it's completely pointless. Fixes #12429.
* mp_image: add force_window fieldDudemanguy2023-09-212-0/+2
| | | | | | It's useful for some VOs (dmabuf-wayland) to know if the image params are actually real or fake ones sent by the core for the purpose of force_window.
* vo_gpu_next: fix unscaled screenshot with --blend-subtitlesKacper Michajłow2023-09-211-4/+4
| | | | Need to use correct adjusted dst.
* vo_gpu: match libplacebo debanding defaultsNiklas Haas2023-09-201-2/+2
| | | | | | | | | The defaults were awful and horribly regressed many files while also not fixing banding on files that actually needed it, sometimes even *increasing* banding due to the low threshold. Fixes: 12ffce0f224056f91a20c9f0b197f4973931efbe See-Also: haasn/libplacebo@e1e43376d16d5112ee1254534664b0b85110139b
* vo_gpu: match libplacebo peak detection defaultsNiklas Haas2023-09-201-3/+3
| | | | | | | | | This probably makes `vo_gpu` tone mapping worse, or something, but who cares. The status quo for a while now has been to use `vo_gpu_next` if you care about HDR rendering at all. See-Also: haasn/libplacebo@ec60dd156b82753a2e2d8a399899244605f4d1bf See-Also: haasn/libplacebo@0903cbd05d7fc0391cbd99954924a39b855c8a1b
* vo_gpu: default to dscale=hermiteNiklas Haas2023-09-201-1/+1
| | | | | | | | | | This new filter is slightly sharper, and significantly faster, than mitchell. It also tends to preserve detail better. All in all, there is no reason not to use it by default, especially from a performance PoV. (In vo_gpu_next, hermite is implemented efficiently using hardware accelerated bilinear interpolation) See-Also: https://code.videolan.org/videolan/libplacebo/-/commit/75b3947b2c07803456483ec6976c037bad91b5dd
* builtin.conf: modernize internal profilesKacper Michajłow2023-09-191-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal is to provide simple to understand quality/performance level profiles for the users. Instead of default and gpu-hq profile. There main profiles were added: - fast: can run on any hardware - default: balanced profile between quality and performance - high-quality: out of the box high quality experience. Intended mostly for dGPU. Summary of three profiles, including default one: [fast] scale=bilinear cscale=bilinear (implicit) dscale=bilinear dither=no correct-downscaling=no linear-downscaling=no sigmoid-upscaling=no hdr-compute-peak=no [default] (implicit mpv defaults) scale=lanczos cscale=lanczos dscale=mitchell dither-depth=auto correct-downscaling=yes linear-downscaling=yes sigmoid-upscaling=yes hdr-compute-peak=yes [high-quality] (inherits default options) scale=ewa_lanczossharp cscale=ewa_lanczossharp (implicit) hdr-peak-percentile=99.995 hdr-contrast-recovery=0.30 allow-delayed-peak-detect=no deband=yes scaler-lut-size=8
* vo: change tscale to oversample by defaultKacper Michajłow2023-09-191-2/+1
| | | | Keep it sharp, let users opt-in more blurry result.
* vo: make cscale follow scale by defaultKacper Michajłow2023-09-192-2/+19
|
* vo: enable correct-downscaling, linear-downscaling, sigmoid-upscalingKacper Michajłow2023-09-191-0/+3
|
* vo: avoid unnecessary redraws when the OSD showsDudemanguy2023-09-191-6/+6
| | | | | | | | | | | | | | | | 296d40dc6f38401085d005bb4627f8afff46b041 changed how the vo handled redraw requests in order to fix a race condition that can occur with pausing. However, there was a slight oversight because a redraw request that occurred while the core was unlocked and the video was still playing would still be kept true (previously, this was always cleared). That redraw is essential if mpv is paused otherwise the old issue comes back, but if the video is playing it's unnecessary since the next loop around will simply draw whatever we needed. The extra redraw could cause a frame drop for some people in certain instances, so the solution is to simply always clear redraw requests if !in->paused. This eliminates the extra redraw but still keeps it when pausing. Fixes #12426 and fixes #11579.
* filter_kernels: remove bcspline filterllyyr2023-09-181-11/+1
| | | | | | After fixing the B and C params for bcspline, it ended up being the same thing as bicubic. There's no reason to have two names for the same filter, so remove bcspline and keep bicubic to match libplacebo.
* filter_kernels: fix bcspline paramsllyyr2023-09-181-1/+1
| | | | | bcspline is defined as B=1, C=0 in ImageMagick (as CubicFilter) and libplacebo, so we should match that.
* filter_kernels: add hermite filterllyyr2023-09-181-0/+1
| | | | Matches HermiteFilter from Imagemagick (B=C=0, R=1)
* vo_gpu_next: fix blur and taper values being zerollyyr2023-09-181