summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* image_writer: default to lossless AVIF screenshotsKacper Michajłow2023-12-041-2/+1
| | | | | Also change the example to crf=23. crf=32 is pretty bad quality, don't give users bad usage ideas.
* image_writer: add missing mp_image_params in convert_imageKacper Michajłow2023-12-041-0/+2
| | | | | | | Fixes chroma location for screenshots. Also set the crop to full frame to not trip mp_image_params_equal check if not necessary.
* image_writer: print screenshot format in verbose logKacper Michajłow2023-12-041-2/+2
| | | | It is useful information, not only for debugging.
* image_writer: use common format selection for AVIF screenshotsKacper Michajłow2023-12-041-2/+2
| | | | --screenshot-avif-pixfmt no longer defaults to yuv420p.
* mac: report modifier keys on precise scrollingder richter2023-12-021-1/+1
| | | | | | modifier keys weren't reported when using the trackpad to scroll. Fixes #11195
* mac: fix initial window size and position when already maximizedder richter2023-12-021-1/+2
| | | | | | | | | | | | in the case the window was already set to a maximized size via geometry or related options (100%x100%) the maximize function would try to maximize the window again. this reset the position and slightly increased the size further. to prevent this only maximize on init if we really want to maximize. in the reverse case make a noop call by passing the current zoom state. Fixes #11193
* vo_gpu: fix ra_fbo stack-use-after-scopeDudemanguy2023-11-281-9/+6
| | | | | | | | 281b1d89994e3e3a9950d32fc451dff990c2320d introduced a stack use after scope because dest_fbo can be reassigned a new pointer and then be used by pass_draw_to_screen outside of that scope where the pointer is no longer valid. Fix this by rearranging the variables so the assignment is done in the same scope as the pass_draw_to_screen call instead.
* vo_kitty: init all fields of struct sigaction before using itKacper Michajłow2023-11-281-2/+3
|
* ra_pl: add missing initializerKacper Michajłow2023-11-281-1/+1
|
* vo: don't pass VADRMPRIMESurfaceDescriptor by valueKacper Michajłow2023-11-282-9/+9
|
* wayland: simplify reading dataKacper Michajłow2023-11-281-15/+10
| | | | | | | - read directly to bstr - use talloc for OOM checks - don't parent temporary allocation - don't check for NULL buffer after already writting to it
* mp_image: remove local params copy from mp_image_setfmtKacper Michajłow2023-11-281-3/+1
| | | | No longer needed after 079f67268f6f5a2ecfd12277b246b1937493c092.
* vo_gpu: don't pass gl_user_shader_hook by valueKacper Michajłow2023-11-283-12/+10
|
* vo_gpu: don't pass mp_pass_perf by valueKacper Michajłow2023-11-281-8/+14
|
* vo_gpu: don't pass ra_fbo by valueKacper Michajłow2023-11-2810-39/+39
| | | | Make it easier on compiler, no need to alloca and copy things around.
* vaapi: bump vaapi info callback to verbose messagesKacper Michajłow2023-11-261-1/+1
| | | | | | | | | | | | | | The info provided for libva might be useful. Specifically on Windows it seems to not use the error callback for what should be logged as error. [ 0.080][v][vaapi] libva: VA-API version 1.20.0 [ 0.080][v][vaapi] libva: Trying to open <path>/vaon12_drv_video.dll [ 0.080][v][vaapi] libva: va_openDriver() returns -1 [ 0.080][e][vaapi] Failed to initialize VAAPI: unknown libva error As we can see only the "unknown" error is printed to the error callback and important information is printed on the info callback. Print it to verbose log to make it easier to find.
* vaapi: add missing NULL checkKacper Michajłow2023-11-261-1/+2
| | | | ctx->destroy_native_ctx is guarded, but this early exit was not.
* mac: fix a race condition when updating the window titleder richter2023-11-251-3/+2
| | | | | | | | | | | | | | | | | | | | | | | the title is updated on the main thread (mandatory with cocoa) asynchronously, because otherwise it would either deadlock when done synchronously, lead to undefined behaviour or just crashes. the problem here is that the c string was only copied to an NSString within that asynchronous call, which potentially would access the pointer when it is accessed, modified or freed by another thread. it is only safe to access this pointer as long as the control callback wasn't returned yet. to fix this we move the copying and creation of the String from the c string pointer outside of the asynchronous call where the conversion of an untyped pointer to a typed pointer is done too. since the resulting String is a copy it's safe to be used in the asynchronous call. also reverting ee6ad40, since the problem was most likely an SDK problem or the very same problem as mentioned here. i retested the crash case again und can't reproduce it anymore. using a swift String again instead of an NSSstring. Fixes #12935
* mac: cleanup some unused and unneeded codeder richter2023-11-251-7/+1
|
* meson: adjust win32 definesKacper Michajłow2023-11-251-0/+1
| | | | | | | | - Don't define _GNU_SOURCE on Windows, no need - Define WIN32_LEAN_AND_MEAN to strip some unneded headers from windows.h - Define NOMINMAX and _USE_MATH_DEFINES as they are common for Windows headers
* various: replace some OOM handlingsfan52023-11-242-4/+2
| | | | | | We prefer to fail fast rather than degrade in unpredictable ways. The example in sub/ is particularly egregious because the code just skips the work it's meant to do when an allocation fails.
* vo: add params mutexKacper Michajłow2023-11-223-3/+19
| | | | | | | | | | | | This mostly is added to resolve player command synchronization with VO thread discussed in 477a0f83. The current uses does not necessarily need this as they are all managed by playloop. But for future use with other params that will be handy. Those params are mostly to observe current state of VO and does not necessarly need to be locked along with frame drawing, that changes the params once at the end.
* vaapi: add support for vaapi-win32Kacper Michajłow2023-11-221-2/+51
| | | | | | | | | | | Only vaapi-copy variant as nothing can map D3D12 resources currently. And even if we would add resource sharing to D3D11 it would invoke copy at some point, so there is no point really. Maybe in the future when libplacebo get smarter about resource sharing on Windows, but practical advantages are really small. I've tested it with Vulkan <-> D3D11 sharing and GPU <-> GPU copy is still invoked. Better than CPU memcpy, something for the future.
* vaapi: pass module into create()Kacper Michajłow2023-11-221-7/+8
| | | | Useful for logging
* d3d11: expose mp_get_dxgi_adapter and mp_dxgi_validate_adapterKacper Michajłow2023-11-223-41/+45
| | | | To be able to reuse them in other parts of code.
* d3d11: rename d3d11 adapter to DXGI adapterKacper Michajłow2023-11-223-22/+22
| | | | There is nothing d3d11 about those adapters.
* vo_gpu_next: reduce number of requested frames from VOKacper Michajłow2023-11-211-2/+2
| | | | | | | | | Up to 2x playback rate is the most we can offer currently. Should work fine for most kernels with radius <= 2. This avoids limitation of hwdecs number of frames in-flight. Fixes: #12927
* mac: title bar fix 1px none covered video at topder richter2023-11-201-1/+1
| | | | | | | | there is 1px border at the top of the window that is not covered by our title bar and the video below is visible. this broke in some newer macOS version even so the calculation of size and position of the title bar is still correct. add 1px the the height of the title bar to cover up the unwanted border.
* mac: fix reporting of left wheel and right wheel scrollingder richter2023-11-201-2/+2
| | | | | | | left wheel and right wheel was swapped. this was copied from the old cocoa backend. a delta <0 is a right scroll, >0 is a left scroll. Fixes #12899
* vo_gpu_next: bump ICC cache size limit to 20 MBNiklas Haas2023-11-201-1/+1
| | | | | | | These are less likely to be modified from run to run, and with the avoidance of redundant re-saving we can get away with a larger size. This is enough to save 10 3DLUTs at typical sizes.
* vo_gpu_next: don't re-save unmodified cacheNiklas Haas2023-11-201-0/+18
| | | | | | | Backwards compatibility wrapper can be bumped once sufficient libplacebo version is a minimum dependency. See-Also: https://github.com/mpv-player/mpv/pull/12902
* vo_gpu_next: dramatically simplify cache codeNiklas Haas2023-11-201-111/+64
| | | | | | | | | | | I have no idea why this code is such a convoluted mess of options and possibilities. First of all, why is dumping both caches to a single file even a supported use case? Why is the cache path generated multiple times, once for saving and once for loading, instead of just generated once and stored? Why even create a pl_cache if you're not going to save/load it? Why so much code duplication? I don't know. But I rewrote it in a way that makes far more sense to me.
* vo_direct3d: remove redundant conditionKacper Michajłow2023-11-181-2/+1
| | | | talloc_free is safe to call with NULL.
* opengl/context: remove duplicated conditionsKacper Michajłow2023-11-181-5/+1
|
* ra_d3d11: fix off by one checkKacper Michajłow2023-11-181-2/+2
|
* vo: add missing return variable assignmentKacper Michajłow2023-11-182-2/+2
|
* various: add some missing error checksKacper Michajłow2023-11-182-2/+6
|
* vo_gpu_next: disable drift compensation for screenshotsKacper Michajłow2023-11-181-1/+6
| | | | | | This change prevents unwanted adjustments. Generally, screenshots shouldn't invoke pl_queue_update, as this action could cull the already mapped frames in the queue.
* vo_gpu_next: add validation for invalid pl_queue usageKacper Michajłow2023-11-181-1/+22
| | | | | This is mainly for debugging purposes, as it should't happen in normal use. If it does, it needs fixing.
* vo_gpu_next: set frame duration if provided by VOKacper Michajłow2023-11-181-0/+1
|
* vo_gpu_next: interpolate only if display_synced or a still frameKacper Michajłow2023-11-181-3/+4
| | | | | | | If !display_synced, some values may not be correct or zeroed. Therefore, it makes no sense to interpolate in this case. For a non-moving frame, we always want to show an uninterpolated frame.
* vo_gpu_next: request more frames to account for anti aliasingKacper Michajłow2023-11-181-4/+8
| | | | | | | | libplacebo requires additional frames when VPS is lower than FPS and anti-aliasing is enabled. Supports up to a 1/4 ratio. VO has a limit of 10 frames, so in practice, not many more can fit. Note that the internal libplacebo mixing limit is 16 frames.
* vo_gpu_next: make the first frame check less ominousKacper Michajłow2023-11-181-7/+10
| | | | | It is valid to disable interpolation on resets and when the vsync error exceeds the duration of the frames that we have available.
* vo_gpu_next: remove incorrect interpolation disablingKacper Michajłow2023-11-181-1/+0
| | | | | We can possibly have all the frames needed for interpolation, even after a reset, so there's no need to prevent that.
* vo_gpu_next: fix pl_queue refill on resetKacper Michajłow2023-11-181-2/+4
| | | | | On reset, we would ignore all the frames that were seen before. This is incorrect and would drop valid frames that should be rendered.
* vo: pass approximate frame duration in vo_frameKacper Michajłow2023-11-181-0/+2
| | | | | | This information is already there, but speed adjusted. To avoid duplicating the calculation of frame duration, it's kept in the vo_frame structure.
* vo: avoid overshooting the expected end of the frame during pauseKacper Michajłow2023-11-181-2/+7
| | | | | | The `current_frame` can be redrawn even if the remaining `num_vsync` is equal to 0. In this scenario, the vsync offset would be incremented beyond the target point.
* vo_sdl: fix broken mouse wheel multipliernanahi2023-11-181-2/+2
| | | | It only registers 1 mouse wheel event per 10 physical mouse wheel clicks.
* hwdec_vulkan: use VK_NULL_HANDLE when counting the number of imagesDudemanguy2023-11-181-2/+2
| | | | | Otherwise you can get "error: comparison between pointer and integer" while compiling in some cases.
* vo_gpu_next: set max cache size back down to 10 MiBDudemanguy2023-11-181-2/+2
| | | | | | | | It turns out that mpv will rewrite the entire cache file on every single quit. It's not so great since after viewing a ton of files, your cache can grow to massive sizes and slow down quitting the player to a noticeable amount. Turn down the max size of both caches to 10 MiB for now as a workaround until this gets improved later.
* hwdec: support videotoolbox with libplaceborcombs2023-11-166-147/+552
|
* 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
| | | | | | |