summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* vo: delay vsync samples by at least 10 refreshesKacper Michajłow2023-11-141-1/+2
| | | | | | | | This filters out vastly inaccurate values from presentation feedback that can happen shortly after restarting playback or seeking. Makes estimated vsync converge almost instantly instead of waiting until those outliers are dropped from the past samples.
* vo_gpu_next: guard from cache save conflictKacper Michajłow2023-11-141-3/+8
| | | | | | If multiple instances of mpv are closed at the same time, they will write to the same temporary file. Fix that by using unique temporary file.
* vo_gpu_next: disable libplacebo drift_compensationKacper Michajłow2023-11-121-0/+7
| | | | | | | | | | | | | | In commit de6d57f0 libplacebo enabled drift compensation by default. mpv already tracks error and adjust the speed by itself. This commit fixes judder visible when slowing video a lot, ex. playing back at 10% speed. Set ideal vsync duration also when dropping frames, libplacebo estimate currently own values anyway, will be useful later... See: https://code.videolan.org/videolan/libplacebo/-/commit/de6d57f021e2336851f51b1a8538aa1484c56607
* vo_gpu_next: update overlays for blend subtitles on frame redrawsDudemanguy2023-11-121-8/+5
| | | | | | | | | The commit subject sounds reasonable except that frame redraws get spammed in certain cases (still image with subtitles) all the time regardless if the subtitle actually has changed or not. So this is stupid and wasteful, but you'll always see subtitles. vo_gpu currently has this behavior as well, so we're just matching it but later mpv's core should be fixed so this works reasonably. Fixes #11335.
* vo_gpu_next: fix interpolationKacper Michajłow2023-11-111-6/+5
| | | | | | | | | | | | | | | | Fixes gpu-next completely ignoring any speed adjustment, either DS or playback. Frames in pl_queue have raw PTS values, so when querying them we have to use the same time base. There was misunderstanding between mpv and libplacebo, where the former was querying the frames based on display vblank timeline, but this cannot work if the playback speed is adjusted and display timeline is not aligned with video timelien. In which case we have to schedule "video vsync" points that we want to display. Previous code was working only when playback speed was 1.0x, but since DS almost always changes the speed the interpolation was mostly not timied correctly.
* vo: add frame vsync and vsync durationKacper Michajłow2023-11-112-0/+5
| | | | | | | | Relative to frame PTS timeline as oposed to display vblank. Those values are relative to unadjusted video timeline. They will be used by gpu-next where it expect virtual frame vsync, not display vblank time.
* vo_gpu_next: improve PTS clampingDudemanguy2023-11-111-3/+8
| | | | | | | Originally suggested by @haasn. Instead of awkwardly using a pts from the previous render loop, we can just peek into pl_queue and use the pts of the first frame instead. This eliminates a lot of weird artifacts that can happen on discontinuities like seeking. Fixes #12355.
* vo_gpu_next: add some additional sanity checking for interpolationDudemanguy2023-11-111-3/+5
| | | | | | | | | | | | | | | | | | | | | Several related things in regards to interpolation. Essentially this adds more general sanity checking to bring it more in line with what vo_gpu does. - Add a can_interpolate bool which determines whether or not this frame is allowed to interpolate. - p->is_interpolated was sometimes lying and because you can have a mix frames greater than 1 depending on the video and settings. Make sure that vsync_offset is not 0 so we know if it's actually interpolated or not. This prevents a redundant redraw for those edge cases when pausing. - When the vo wants a reset, i.e. some sort of discontinuity, don't try to interpolate the frame. Interpolation is only valid for monotonically increasing times. This fixes #11519 because of the additional check to make sure that we have more than 1 frame. The PTS clamping part is still not great. That is for the next commit.
* wayland: fix shift+tab keyboard inputChristoph Heinrich2023-11-111-4/+4
| | | | | When pressing shift+tab we get 0xfe20 instead of 0xff09, which corresponds to the XKB_KEY_ISO_Left_Tab define.
* wayland: obey initial size hints set by the compositorDudemanguy2023-11-102-11/+19
| | | | | | | | | In the past, this worked by accident because the initial startup was racy and sometimes the initial firing of handle_toplevel_config would happen after reconfig. Since we now properly wait on all compositor events we can save the initial size hint that is given to us and try to use that as the window-size/geometry provided the --autofit/geometry options aren't explictly set. Fixes #11134.
* cocoa: remove OpenGL cocoa backendder richter2023-11-1012-2322/+0
| | | | | | the OpenGL cocoa backend was deprecated in 0.29, it has lot of bugs, is completely unmaintained and can't properly playback anything anymore on the newest macOS. it is time to remove it.
* mac: change display name retrieval to localizedName NSScreen propertyder richter2023-11-101-2/+2
| | | | | | | | | | | | | | | the old displayName property via the IODisplay API is not working anymore on ARM based macs and was broken in at least one other case. instead we use the new localizedName property introduced in 10.15 of the NSScreen. we don't need any backwards compatibility since 10.15 is the oldest version we support now. configs and scripts that use the options and properties fs-screen-name, screen-name or display-names need to be adjusted since the names could differ from the previous implementation via the IODisplay API. Fixes #9697
* mac: fix build on older swift versionsder richter2023-11-101-5/+5
| | | | | | | | | | this is apparently something that was added with swift 5.5, though it is hard to find anything officially. don't capture self in closure but explicitly access all variables by prepending self. Fixes #12653
* vo_gpu_next: overwrite cache files atomicallysfan52023-11-101-2/+7
|
* vo_gpu_next: refactor cache saving codesfan52023-11-101-33/+33
| | | | No functional change.
* vo: don't sleep 1ms always when requested time is in the pastKacper Michajłow2023-11-094-4/+7
| | | | | | | | | | | | | | Fixes a899e14b which changed clamp from 0 to 1 ms which effectivelly introduced 1ms sleep always, even if requested until_time_ns is in the past and should request 0 timeout. While at it also fix mp_poll wrapper to respect negative timeout which should mean infinite wait. Also keep the 37d6604 behaviour for very short timeouts, but round only the ones > 100us, anything else is 0. Fixes: a899e14b
* vo: replace some magic numbers with timer macrosDudemanguy2023-11-091-5/+5
| | | | | | | | | | Most importantly, the wait_until addition was missed while doing the unit conversions to nanoseconds which meant mpv woke up roughly every second since not nearly enough time was added. It was meant to be 1000 seconds (1e9 in microseconds). Use a macro so it's more readable. Also put some other wild 1e9 calculations inside of a macro as well. Fixes a899e14bccb667af243f8fce454160e17ae45c2a.
* mac: remove runtime checks and compatibility for macOS older than 10.15der richter2023-11-0910-85/+42
| | | | | we stopped supporting macOS older than 10.15 and hence can remove all the unnecessary runtime checks and compatibility layers.
* meson: remove several macos-10-* build optionsDudemanguy2023-11-091-8/+1
| | | | | | | | | | | These have been build options since the waf build, but that doesn't really make sense. The build can detect whatever macOS sdk version is available and then use that information to determine whether to enable the features or not. Potentially disabling multiple sdk versions doesn't really make any sense. Because f5ca11e12bc55d14bd6895b619c4abfd470c6452 effectively made macOS 10.15 the minimum supported version, we can drop all of these checks and bump the required sdk version to 10.15. The rest of the build simplifies from there.
* vo: replace VOCTRL_HDR_METADATA with direct VO params readKacper Michajłow2023-11-083-20/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently VOCTRL are completely unusable for frequent data query. Since the HDR parameter addition to video-params, the parameters can change each frame. In which case observe on those parameter would be triggered constantly. The problem is that quering those parameters involves VOCTRL which in turn involves whole render cycle of delay. Instead update VO params on each draw_frame. This requires changes to VO reconfiguration condition, but in practice it should only be triggered when image size or data layout changes. In other cases it will be handled internal by VO driver. I'm not quite happy with this solution, but don't see better one without changing observe/notify logic significantly. There is no good way currently to handle VOCTRL that are constantly queried. This adds unfortunate synchronization of player command with VO thread, but there is not way around that and if too frequent queries of this param becomes a problem we can thing of other solutions. Changes the way to get data from VO driver added by a98c5328dc Fixes: 84de84b Fixes: #12825
* vo_gpu_next: add --target-gamut optionNiklas Haas2023-11-083-0/+9
| | | | Fixes: https://github.com/mpv-player/mpv/issues/12777
* win32: fix hit test using client rc instead windowKacper Michajłow2023-11-071-16/+20
| | | | | | | | | windowrc in vo_w32_state is actually client size, for hit test we need proper window size. When border is disabled those sizes are the same, but when only title bar is disabled it is not. Reduce the hit area to more sane values when the border is not drawn to minimize amount of covered client area in borderless mode.
* vo_gpu: apply ICC profile and dithering only to window screenshotssfan52023-11-072-10/+14
|
* vo_gpu_next: drop alpha channel from screenshots if unneededsfan52023-11-071-1/+5
|
* image_writer: improve format conversion loggingsfan52023-11-071-2/+6
|
* present_sync: remove unneeded clear_values functionDudemanguy2023-11-073-13/+0
| | | | | | | | | This was specifically special logic for drm. Before present_sync, it would also clear out all of its vsync values like this. The old drm code would save a bunch of samples which would confuse vo.c when unpausing since it got old, bogus values. Since we make sure to match successive vsync samples with the swapchain depth and that present sync samples also match the swapchain depth, this is unneeded.
* vo: require successive vsyncs to be more than swapchain depthDudemanguy2023-11-071-1/+1
| | | | To make sure that present_sync is in line with the vsync timings here.
* present_sync: only save as many entries as the swapchain depthDudemanguy2023-11-075-7/+10
| | | | | | Saving more than the swapchain depth is just wasteful. We can just save a copy of the vo_opts here and check the value whenever we're updating values.
* vo: replace max swapchain depth magic numberDudemanguy2023-11-074-4/+5
|
* wayland: improve wl_output guessing before mpv window is mappedDudemanguy2023-11-061-4/+5
| | | | | | | | | | | | | | | | | | | | There's some geometry-related things that mpv has to calculate before the window is actually mapped onto the screen in wayland. But there's no way to know which output the window will end up on before it happens, so it's possible to calculate it using the wrong values. mpv corrects itself later when the surface event happens, but making the initial guess work better can help in certain cases. find_output is the only thing that needs to be changed here. Its main purpose is to grab the right output based on user settings when we're trying to full screen and giving a fallback in case we don't have wl->current_output yet. The x11 code already does something similar, so we're basically just copying it. Allow user settings like --screen and --screen-name to influence the initial wl_output guess. Those options won't actually place the window on that specific screen since we can't do that in wayland, but if the user knows where the window will end up beforehand it makes sense to listen to the arguments they pass. If something goes wrong, then we just fallback to 0 like before.
* drm: use present_sync mechanism for presentation feedbackDudemanguy2023-11-066-122/+40
| | | | | | | | | | | A ton of code and drm-specific abstractions can be dropped with this. One important thing to note is that the usage of sbc is completely dropped here. The utility of that is not particularly clear since the sbc value was manually incremented before the flip and it's not as if the drm page flip event gives it to us like it does with the msec and ust. It can be reintroduced later if there is a need. For drm, we also add a present_sync_clear_values helper since all presentation feedback needs to be cleared on pause/resume for it.
* present_sync: rename function to present_sync_update_valuesDudemanguy2023-11-064-4/+4
| | | | This had to have been a mistake. It was just confusing.
* present_sync: rewrite around linked listDudemanguy2023-11-064-33/+81
| | | | | | | | | | | | | | | | | | | | | | | | | When this was originally written, the queuing/list approach was deliberately removed since it adds more complication and xorg/wayland don't really use it anyway. In practice, you only really have one frame in flight with presentation timestamps. However, one slight annoyance is that the drm code has its own thing which is almost exactly the same and does its own calculations. Ideally, we'd port drm to this instead, but the implementation there takes into account N-frames in flight which probably does actually work. So we need to make present_sync smarter and be able to handle this. mpv does actually have its own linked list implementation already which is a good fit for this. mp_present becomes the list and each mp_present_entry has its own set of timestamps. During initialization, we create all the entries we need and then simply treat it like a queue during the lifecycle of the VO. When an entry is fully used (present_sync_get_info), then we remove it from the list, zero it out, and append it to the end for future use. This avoids needing to allocate memory on every frame (which is what drm currently does) and allows for a reasonable number of in flight frames at the same time as this should never grow to some obscene number. The nice thing is that current users of present_sync don't need to change anything besides the initialization step.
* Revert "vo: clear vsync_offset if drawing while paused"llyyr2023-11-061-3/+0
| | | | | | This reverts commit 640c07fb19b7ea11f1a97784e517c38449f816d0. This commit isn't needed anymore after the previous commit.
* ALL: use pl_hdr_metadata and nuke sig_peakKacper Michajłow2023-11-059-73/+45
| | | | | | | | This commit replaces all uses of sig_peak and maps all HDR metadata. Form notable changes mixed usage of maxCLL and max_luma is resolved and not always max_luma is used which makes vo_gpu and vo_gpu_next behave the same way.
* csputils: add pl_hdr_metadata to mp_colorspace and deprecate sig_peakKacper Michajłow2023-11-053-3/+8
| | | | | Note this commit does not change all uses of sig-peak, this is for future refactoring.
* csputils: change mp_hdr_metadata to pl_hdr_metadataKacper Michajłow2023-11-053-32/+5
|
* timer: remove unnecesary time conversionsKacper Michajłow2023-11-053-3/+3
|
* mp_thread: prefer tracking threads with idKacper Michajłow2023-11-052-7/+7
| | | | | | | | | | | | | | This change essentially removes mp_thread_self() and instead add mp_thread_id to track threads and have ability to query current thread id during runtime. This will be useful for upcoming win32 implementation, where accessing thread handle is different than on pthreads. Greatly reduces complexity. Otherweis locked map of tid <-> handle is required which is completely unnecessary for all mpv use-cases. Note that this is the mp_thread_id, not to confuse with system tid. For example on threads-posix implementation it is simply pthread_t.
* ALL: use new mp_thread abstractionKacper Michajłow2023-11-0522-378/+367
|
* vo_gpu_next: update to newer cache APIDudemanguy2023-11-051-98/+96
| | | | | | | | The old one would actually crash if the libplacebo.cache file was invalid. Additionally, set a max size of 1 GiB for icc cache and 50 MiB for gpu shader cache. The per object size limit is removed which puts mpv in line with plplay. Finally, a few memory leaks are also fixed since several objects previously were not freed on uninit.
* ra_pl: drop deprecated cached_program paramDudemanguy2023-11-051-7/+0
| | | | | This was deprecated in api version 322 which earlier than the current 6.338 version that mpv depends on. So remove it.
* vo_gpu_next: remove unneeded PL_API_VER guarding and definesDudemanguy2023-11-051-131/+1
| | | | | Since the minimum required libplacebo version is 6.338, all of these checks are unneeded.
* mp_image: pass rotation correctly to/from AVFrameKacper Michajłow2023-11-031-1/+8
| | | | | | Fixes rotating image by --video-rotate when filtering. Fixes: #12771
* win32: add more values for monitor refresh rate detectionnanahi2023-11-021-0/+4
| | | | | Add more refresh rates for get_refresh_rate_from_gdi() now (Nov 2023) that 165 Hz is common, 240 Hz is on the rise, and 120 * N Hz is the future.
* vo_gpu_next: use pl_queue_params() macroNiklas Haas2023-10-311-2/+2
| | | | In case new default parameters are added later.
* vf_vapoursynth: set crop metadata after mapping vapoursynth frameKacper Michajłow2023-10-311-0/+2
| | | | | | | | Vapoursynth does not provide crop metadata and input one is likely to be invalidated during filtering. Set crop to full frame if image dimensions were changed during filtering. Fixes: #12780
* various: remove trailing whitespaceGuido Cella2023-10-302-2/+2
|
* mp_threads: rename threads for consistent naming across all of themKacper Michajłow2023-10-271-1/+1
| | | | | | | | I'd like some names to be more descriptive, but to work with 15 chars limit we have to make some sacrifice. Also because of the limit, remove the `mpv/` prefix and prioritize actuall thread name.
* 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 fallba