summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* Revert "hwdec_vulkan: account for vulkan frames now using presentation size"Philip Langdale2023-10-261-2/+12
| | | | | | | | | | | ffmpeg is again setting the frame dimensions to the coded size, so we need to reintroduce our work-around to get the logical frame dimensions from the frames_ctx rather than the frame itself. ffmpeg commit: * https://github.com/FFmpeg/FFmpeg/commit/9ee4f47c94083b4fe38d4e217a7d65055d3ad53f This reverts commit c40bd888729212f698156b57e49391d3b51f8f07.
* timer: use MP_TIME macrosKacper Michajłow2023-10-263-3/+3
|
* options: rename --override-display-fps to --display-fps-overrideDudemanguy2023-10-251-1/+1
| | | | | | Other similar options are in the form of --foo-override not --override-foo. The display-fps one was backwards so flip it around the other way for consistency reasons.
* options: disable --allow-delayed-peak-detect by defaultKacper Michajłow2023-10-251-1/+0
| | | | | | Peak detection greatly increases HDR experience. Performance hit of non-delayed detection is not that significant and is in line with current default settings.
* meson: make libplacebo a required dependencyllyyr2023-10-234-6/+2
| | | | | | | Make it not possible to build mpv without the latest libplacebo anymore. This will allow for less code duplication between mpv and libplacebo, and in the future also let us delete legacy ifdefs and track libplacebo better.
* vo: define <= 0 as unsupported for last_queue_display_timeKacper Michajłow2023-10-232-3/+13
| | | | Also sanitize vsync values, just in case.
* vo: change spammy log to traceKacper Michajłow2023-10-231-2/+2
|
* vo: average more vsync samplesKacper Michajłow2023-10-231-1/+1
| | | | Improves averaging on high refresh rate displays.
* d3d11: calc vsync interval on real stats, not just last intervalKacper Michajłow2023-10-231-12/+17
|
* img_format: remove duplicated macrosNRK2023-10-231-6/+0
| | | | these are defined in osdep/endian.h already
* aspect: remove unused multiplicationNRK2023-10-231-2/+0
| | | | the variable `w` is unused as a whole.
* vf_vapoursynth: set nominal_fps after the filterchainikdn2023-10-211-1/+4
|
* various: sort some standard headersNRK2023-10-208-22/+25
| | | | | | | | | | | | since i was going to fix the include order of stdatomic, might as well sort the surrouding includes in accordance with the project's coding style. some headers can sometime require specific include order. standard library headers usually don't. but mpv might "hack into" the standard headers (e.g pthreads) so that complicates things a bit more. hopefully nothing breaks. if it does, the style guide is to blame.
* various: remove ATOMIC_VAR_INITNRK2023-10-201-1/+1
| | | | | | | | | | | the fallback needed it due to the struct wrapper. but the fallback is now removed so it's no longer needed. as for standard atomics, it was never really needed either, was useless and then made obsolete in C17 and removed in C23. ref: https://gustedt.wordpress.com/2018/08/06/c17-obsoletes-atomic_var_init/ ref: https://en.cppreference.com/w/c/atomic/ATOMIC_VAR_INIT
* osdep: remove atomic.hNRK2023-10-208-8/+8
| | | | | | | replace it with <stdatomic.h> and replace the mp_atomic_* typedefs with explicit _Atomic qualified types. also add missing config.h includes on some files.
* mp_image: set crop metadata when converting to AVFrameKacper Michajłow2023-10-201-0/+5
| | | | So it is not lost after filtering.
* vo_gpu_next: optimally align DR buffersNiklas Haas2023-10-191-0/+2
| | | | | May increase performance, especially when using DR with a dedicated transfer queue.
* vd_lavc: align buffers to multiple of image sizeNiklas Haas2023-10-192-2/+9
| | | | Fixes: https://github.com/mpv-player/mpv/issues/12672
* video/mp_image: handle non-power-of-two alignmentNiklas Haas2023-10-191-1/+1
| | | | Needed for odd formats like rgb24.
* win32: suppress pointer cast warningKacper Michajłow2023-10-191-1/+1
|
* vo_gpu_next: cast const away to suppress warningKacper Michajłow2023-10-191-1/+1
|
* d3d11: don't skip last char in bufferKacper Michajłow2023-10-191-1/+1
| | | | | Both buffers have the same size (32) and if the source is not null terminated it should be fixed there. Copy whole buffer.
* win32: clear background only on first paintKacper Michajłow2023-10-181-1/+4
| | | | | | | | | Some users report visible black frames during window resize, this should not happen in most cases. Let's just keep stale content as it is less distracting. While still clearing on first window paint to avoid white background. Fixes: #12642
* wayland: use ppoll if possibleDudemanguy2023-10-171-5/+6
| | | | | Since the previous commit unbreaks the timeout, this now actually works. Imagine that.
* dither: removed some unused codeDudemanguy2023-10-161-56/+0
| | | | | | Added in 58a7d81dc55835fb0f5cc6a3f14288d722f83c91. Nobody touched it since then, so it's probably useless. libplacebo has its own dithering stuff anyways.
* vo: convert some final low-hanging things to nanosecondsDudemanguy2023-10-162-11/+11
|
* timer: add convenience time unit conversion macrosDudemanguy2023-10-163-4/+4
| | | | | | | There's a lot of wild 1e6, 1000, etc. lying around in the code. A macro is much easier to read and understand at a glance. Add some helpers for this. We don't need to convert everything now but there's some simple things that can be done so they are included in this commit.
* vo_gpu/vo_gpu_next: add vulkan support for macOSder richter2023-10-145-0/+347
| | | | | | | | add support for vulkan through metal and a translation layer like MoltenVK. also add the possibility to use different render timing modes for testing. i still consider this experimental atm.
* mac: add a window animation lock to wait for animations to finishder richter2023-10-141-1/+16
| | | | | | | add an animation lock to the window to prevent the window from closing while animating. if this is done while the fs animation is running the dock will stay hidden. this is not used yet, because it's unnecessary for cocoa-cb but will be for new vo backends.
* hwdec_dxva2egl: fix log value typeKacper Michajłow2023-10-141-1/+1
| | | | | | Fixes type mismatch after recent changes. Fixes: 59dd7d94af7651baf7e60966c5f8e7d52959d958
* vo_gpu_next: only increment osd_sync in update_overlays if pausedDudemanguy2023-10-131-1/+1
| | | | | While the video playing, it's not actually needed and can cause unnecessary redraws. Fixes #12623.
* drm_common: don't spoil errno in signal handlerNRK2023-10-131-0/+2
| | | | same rationale as last commit
* win32: improve window snapping behaviorsunpenghao2023-10-101-53/+113
| | | | | | | | | | | Several window resizing operations (i.e., --auto-window-resize, border dragging with --keep-aspect-window, Alt+0/1/2) cause the window to detach from the snapped borders. This patch resolves this by recording to which borders the window is snapped, and using this info to determine how the window should be placed after resizing. Closes https://github.com/mpv-player/mpv/issues/6588
* timer: change mp_sleep_us to mp_sleep_nsDudemanguy2023-10-104-9/+9
| | | | | | | | | | | Linux and macOS already use nanosecond resolution for their sleep functions. It was just being converted from microseconds before. Since we have mp_time_ns now, go ahead and bump the precision here. The timer for windows uses some timeBeginPeriod thing which I'm not sure what it does really but whatever just convert the units to ms like they were doing before. There's really no reason to keep the mp_sleep_us helper around. A multiplication by 1000 is trivial and underlying OS clocks have nanosecond precision.
* vo: use mp_poll wrapper in wait_events when applicableDudemanguy2023-10-102-6/+8
| | | | | | | | | | On linux, several platforms poll for events over a fd. This has ms accuracy, but mpv's timer is in ns now so lots of precision is lost. We can use an mp_poll wrapper to use ppoll instead which takes a timespec directly with nanosecond precision. On systems without ppoll this falls back to old poll behavior. On wayland, we don't actually use this because ppoll completely messes up the event loop for some unknown reason.
* vo: change vo->driver->wait_events to nanosecondsDudemanguy2023-10-1019-39/+39
| | | | | | | | | | | | In many cases, this is purely cosmetic because poll still only accepts microseconds. There's still a gain here however since pthread_cond_timedwait can take a realtime ts now. Additionally, 37d6604d70c8c594de2817db26356c4c950ac0fd changed the value added to timeout_ms in X11 and Wayland to ensure that it would never be 0 and rounded up. This was both incomplete, several other parts of the player have this same problem like drm, and not really needed. Instead the MPCLAMP is just adjusted to have a min of 1.
* vo: use nanoseconds for frame duration and ptsDudemanguy2023-10-103-14/+14
|
* vo: remove vo_get_estimated_vsync_interval conversion to secondsDudemanguy2023-10-101-2/+1
| | | | | This is weird. The caller should be responsible for converting the value if desired. Move the conversion to player/command.c instead.
* 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 callDudemanguy