summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* wayland: make vo_wayland_reconfig a boolDudemanguy2023-01-084-10/+4
| | | | | | This was already returning true/false but the type was int. Also simplify a few places in the wayland contexts where we can just return the value of this function instead of doing redundant checks.
* wayland: cleanup on vo_wayland_init errorDudemanguy2023-01-083-13/+12
| | | | | | Instead of just returning true/false, it's better to have this function cleanup itself. We can eliminate some redundant uninit calls elsewhere in the code as well.
* vo: change vo_platform_init to boolDudemanguy2023-01-088-15/+14
| | | | | | | | There's several functions that are used for initializing mpv on a certain platform (x11, wayland, etc.). These currently are all int, but they actually return 1 and 0 like a boolean. This gets a bit confusing because actual vo preinit functions return 0 and -1 instead. Just make these all bool instead and return true/false to make it clearer.
* vo_wlshm: cleanup on failureDudemanguy2023-01-081-15/+18
| | | | | If failure occurs during preinit, vo_wlshm should goto an error and cleaup itself like the other VOs.
* vo_dmabuf_wayland: goto err instead of returningDudemanguy2023-01-081-11/+11
| | | | | Returning early is clearly wrong. It should use to goto to cleanup after itself. Also renamed from error_out to err for purely comestic reasons.
* vulkan: fix build error for 32bit builds with clangChristoph Reiter2023-01-081-1/+1
| | | | | | | | | | | vk->surface is a handle and not a pointer, so assign VK_NULL_HANDLE. This fixes the following build error on 32bit Windows when using clang for example, which errors out when assigning a 32bit pointer to a 64bit integer: ../mpv-0.35.0/video/out/vulkan/utils.c:37:21: error: incompatible pointer to integer conversion assigning to 'VkSurfaceKHR' (aka 'unsigned long long') from 'void *' [-Wint-conversion] vk->surface = NULL; ^ ~~~~
* meson: dynamically compute dependencies for manpage and html buildThomas Weißschuh2023-01-082-2/+68
| | | | | | | | | This allows us to rebuild the manpages and html documentation only when necessary. It is not necessary to manually keep the list of dependencies up to date. Unfortunately rst2pdf does not yet support this feature, see https://github.com/rst2pdf/rst2pdf/issues/1108
* TOOLS/umpv: support shell-quotes in $MPVsfan52023-01-071-1/+2
|
* demux: new packet should not point to source buffer when copying dataPhilip Langdale2023-01-061-1/+0
| | | | | | | In `new_demux_packet_from`, we initialise a new packet and allocate a buffer which we copy the source data into. But I was then assigning the original source pointer as the packet's buffer, rather than keeping the newly allocated one. Whoops.
* demux: actually initialise packet buffer when creating new packetPhilip Langdale2023-01-061-0/+1
| | | | | | | | When I refactored the code here to stop using stack allocated AVPackets, I forgot to assign `dp->buffer` after initialising the AVPacket. Fixes #11097
* version.py/version.sh: bump copyright yearDudemanguy2023-01-042-2/+2
|
* demux: boost read EBU R128 gain values to ReplayGain's reference levelSimon Ruderich2023-01-041-0/+5
| | | | | | | | | | | | | Without this change the same track encoded as Opus - which requires R128 tagging - and e.g. Vorbis with ReplayGain tagging have different volumes. This is caused by ReplayGain 2 having a higher reference level of -18 dB LUFS, while EBU R128 has a lower reference level of -23 dB LUFS. For the results of gain application to match, the read EBU R128 values need to be boosted according to the difference in reference levels. Patch inspired by mpd's source code.
* wayland: dispatch and wait for compositor events in uninitDudemanguy2023-01-032-30/+25
| | | | | | | | | | Similar to some other issues we've had with unprocessed compositor events. When quitting mpv, there's two things we should be doing: dispatching any last minute wayland events and then waiting for a compositor reply. Luckily, there's already an internal helper for this (renamed to wayland_dispatch_events for consistency) that we can use. All of the special casing of wl->feedback becomes unneccesary and we can remove this from vo_wayland_state with this method. Fixes #110022.
* wayland: initalize display_fd as -1Dudemanguy2023-01-031-3/+4
| | | | | | | | In the event of a failed wayland initalization, the display_fd is actually 0 instead of -1 which would correctly indicate it doesn't exist. Also move the fd check inside vo_wayland_dispatch_events since that function shouldn't ever do anything if we don't actually have a display fd.
* wayland: consistently employ use_presentDudemanguy2023-01-031-4/+1
| | | | | | | | | We have a use_present bool that keeps track of whether or not to use presentation time. However, the creation of the feedback listener actually wasn't checking this and was instead checking for the existence of wl->presentation. There's no point in always creating the listener and feedback if mpv isn't actually going to use it. Just change it to use_present instead.
* draw_bmp: ensure last slice width is less than total widthDudemanguy2023-01-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | e97819f88e451623a397b79d101497205fe849f9 corrected a special case condition that lead to an out of bounds access if the total width happened to be an integer multiple of SLICE_W (256) which could cause a crash in software VOs. However, it turns out that the functions in this file evaluate quite differently when using encoding mode (and presumably libmpv as well according to reports although I could not independently verify it). The logic here gets complicated but what ends up happening is that, in blend_overlay_with_video, the value of x + w can be greater than p->w in certain cases in encoding mode. The x is the positional value of the slice which remained unchanged from before, but w can take the full value of SLICE_W (256) which is not necessarily correct. The width of the final slice here should be the total remaining width. We can handle this in mark_rect by simply always adjusting x1 of the last slice to be equal to total width - SLICE_W * x so it can never extend beyond where it should be. In practice, this value should be the maximum allowed here. I'm not sure if the existing x1 value can possibly already be lower than SLICE_W, but just MPMIN it to be on the safe side. Fixes #10908.
* vo: hwdec: fix drmGetDeviceNameFromFd2() related memory leakrepojohnray2023-01-021-1/+5
| | | | | This commit fixes a minor memory leak related to drmGetDeviceNameFromFd2(). This function returns a string allocated with strdup().
* hwdec_drmprime: fix memory leakrepojohnray2023-01-021-0/+1
|
* ao_coreaudio: use AudioUnitReset as ao_driver.reset to prevent long restartLi Chang2023-01-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [motivation] Seeking on MacOS appears to be lagged when users connect to wireless audio output (airpods for example). This commit attempts to fix mpv-player/mpv#10270 [observation] 1. When using other media player (VLC to be exact) simultaneously, the lagging on seek disappear. We could guess that the AudioDevice is on some sort of "warm-up" state. See mpv-player/mpv#9243 for detailed description. 2. `AudioOutputUnitStart` takes significant longer time after each seek or pause/play when using wireless output devices compares to wired devices. [rationale] After investigate codes in ao_coreaudio.c, it appears that the the `stop` function was used as `ao_driver.reset` function. Therefore every seek and pause would call `AudioOutputUnitStop`. It turns out that `ao_driver.reset` function is used in `ao_reset`. And `ao_reset` function is used to clean up the state of current `ao` so I think `AudioUnitReset` is more proper than `AudioOutputUnitStop` under this semantics. Since ao_coreaudio use pull base mechanism, audio playback behaviors upon pause/seek could be handled by callback function (streaming silence when paused) so there is no need to stop AudioUnit when resetting. Therefore using `AudioUnitReset` as `ao_driver.reset` looks proper. Additionally, after using proper reset, the AudioUnit that represents hardware I/O devices doesn't need to be restart everytime seek/pause actions happen. Restarting wireless devices simply takes longer in MacOS which is the root cause of lagging observed by users when they seek or pause/play media. [method] Use `AudioUnitReset` for ao_driver.reset.
* vo_opengl: do not blindly reject all Microsoft's OpenGL implementationsKacper Michajłow2022-12-301-3/+3
| | | | | | | | | | | | | This change enables mpv to work in the WSL2 (WSLg) environment where OpenGL is implemented on top of D3D12. This reverts commit 149d98d244. Mentioned OpenGL implementation (GDI Generic) in the original change will be rejected by version check, so there is no need to handle it manually. Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
* demux: add --demuxer-hysteresis-secs option to save power with cachingSultan Alsawaf2022-12-303-3/+42
| | | | | | | | | | | | | | | | | | | | | | Buffering ahead nonstop into the cache results in nonstop disk or network activity to read stream data from wherever it may originate. Currently, there's no way to configure the demuxer to back off once it's buffered ahead enough data, since the cache limit will be perpetually not-reached as a stream continues to play, until the entire stream is eventually buffered. On a laptop with an i9-12900H with decoding performed by the iGPU, watching a locally-saved 1080p video which hasn't been buffered into the page cache consumes approximately 15 W even with caching enabled. When configuring a hysteresis to make the demuxer back off, power consumption drops to 9 W when watching the same video, resulting in a whopping 6 W of power savings. To make it possible to attain significant power savings via caching, add a --demuxer-hysteresis-secs option to configure a hysteresis to make the demuxer back off until there's only the configured number of seconds remaining in the cache from the current playback position. This feature is disabled by default.
* external_files: recognize webp files as cover artRon Shabi2022-12-291-0/+8
| | | | | | | | | | | | | mpv currently only recognizes jpg and png files named "AlbumArt", "Album", "cover", etc. which are in the same folder as the audio files as album/cover art and displays it when playing such audios. This feature adds support for webp files following the same naming scheme to be displayed as cover art for albums who have them. Webp variations are lower in priority compared to jpg or png files. Resolves: #11006
* x11: add modesetting to the xpresent whitelistSultan Alsawaf2022-12-271-1/+2
| | | | | | | | | | | | | | | | Since the modesetting driver now has TearFree support with integration into xpresent, it's important that xpresent is used with the modesetting driver to get the correct vsync timing when a frame is delayed by one vblank interval due to a pending page-flip enqueued by a different entity. The modesetting driver ensures that the xpresent extension reports the correct presentation timing when TearFree is used; mpv just needs to listen to it. Add the modesetting driver to the xpresent whitelist so mpv can get the correct presentation completion timing when modesetting TearFree is used. This is also helpful for when xpresent performs page flips directly in the modesetting driver and a natural delay in the display pipeline causes a page flip to be delayed by one vblank interval or more.
* build: add configure test for POSIX shm for the sake of vo_kittysfan52022-12-263-4/+15
| | | | Android's POSIX coverage is pretty sketchy but not like we have a choice.
* demux: replace deprecated usage of stack allocated AVPacketsPhilip Langdale2022-12-242-24/+45
| | | | | | | | | | | | | In the previous change, I replaced the callsites that used `av_init_packet`, but there are a handful of places that use stack allocated packets with no initialisation. In one case, I just switched to heap allocation as it's only done once per stream at most. In the other case, I removed our usage of the AVPackets as a convenience mechanism to transfer data into a heap allocated packet. Instead, I inlined the data copying.
* audio: reset pull AO at end of fileThomas Weißschuh2022-12-221-1/+1
| | | | | | | | | | When a pull AO reaches reaches EOF then ao_read_data() will set p->playing = false. Because the ao is marked as not playing ao_set_pause(true) will not reset the AO. This keeps the output stream unintentionally open. Fixes #9835
* vo_kitty: Introduce modern sixel alternativeMia Herkt2022-12-216-0/+480
| | | | | | | | | | | | | See https://sw.kovidgoyal.net/kitty/graphics-protocol/ This makes no attempt at querying terminal features or handling terminal errors, as it would require mpv to pass the response codes from the terminal to the vo instead of interpreting them as keystrokes made by the user and acting very unpredictably. Tested with kitty and konsole. Fixes #9605
* external_files: set log level for potential files to traceNicolas F2022-12-211-1/+1
| | | | | | | | | | We ask users to freely share log files with us, which is usually okay, unless a user has some unrelated and potentially embarrassing files in their working directory. These would show up in the debug level message output that --log-file enables. Change the listing of potential external files to trace log level, to save the users and the developers the embarrassment.
* hwdec/d3d11va: fix a possible memory leakchen702022-12-211-0/+1
|
* filter_kernels: fix kaisergaramond132022-12-201-1/+1
| | | | Seems to me that params[1] is set to NAN and here should be the same value as in params[0].
* man/vo: TypoMia Herkt2022-12-201-1/+1
|
* man/vo: Correct --vo-sixel-bufferedMia Herkt2022-12-201-2/+3
|
* vo_sixel: Implement write() loopMia Herkt2022-12-201-4/+16
| | | | | Not all systems are Linux. Also update the comment to better reflect POSIX documentation.
* vo_sixel: Rename draw-clear -> config-clearMia Herkt2022-12-203-8/+9
|
* osdep/terminal.h: Rename screen buffer controlsMia Herkt2022-12-203-6/+6
| | | | SAVE/RESTORE were a bit misleading.
* vo_sixel: Alias/deprecate exit-clear -> alt-screenMia Herkt2022-12-203-10/+18
| | | | Also update documentation to reflect actual behavior.
* vo_sixel: Make buffering optionalMia Herkt2022-12-203-13/+36
| | | | It can be slower than unbuffered.
* man/vo: Fix rendering error due to non-printablesMia Herkt2022-12-201-1/+1
|
* DOCS/interface-changes: Add --vo-sixel-draw-clearMia Herkt2022-12-201-0/+1
|
* Revert "ao_pipewire: deactivate stream at end of playback"Philip Langdale2022-12-191-14/+0
| | | | This reverts commit b5373079f20aeeba8ac80e773f3cc05692dbb51f.
* vo_sixel: Buffer full output sequenceMia Herkt2022-12-191-19/+27
| | | | | This allows the VO to write its output without interference from other processes or threads.
* vo_sixel: Use write(2) on POSIX platformsMia Herkt2022-12-191-14/+35
|
* vo_tct: Use newer options APIMia Herkt2022-12-191-28/+24
|
* vo_sixel: Move user options to structMia Herkt2022-12-191-69/+66
|
* vo_sixel: Add option to skip clear while drawingMia Herkt2022-12-192-7/+15
|
* osdep/terminal: Move common esc codes to terminal.hMia Herkt2022-12-193-42/+40
|
* vo_sixel: Use the alternate buffer to restore termMia Herkt2022-12-191-4/+6
|
* vo_tct: Use the alternate buffer to restore termMia Herkt2022-12-191-3/+7
|
* ao_pipewire: deactivate stream at end of playbackThomas Weißschuh2022-12-181-0/+14
| | | | | | | By explictly shutting down the stream pipewire can deactivate the used hardware, saving CPU and power. Fixes #9835
* ao_pipewire: clean up when hotplug_init failsThomas Weißschuh2022-12-121-1/+2
|
* ao_pipewire: destroy context on connection failureThomas Weißschuh2022-12-121-0/+1
|
* ao_pipewire: free properties on failureThomas Weißschuh2022-12-121-2/+4
|
* vd_lavc: Set AV_HWACCEL_FLAG_UNSAFE_OUTPUT flagPhilip Langdale2022-12-121-0/+11
| | | | | | | | | | This new hwaccel flag was added to allow us to request that an hwaccel decode not implicitly copy output frames before passing them out. The only hwaccel that would implicitly copy frames is nvdec due to how it has a small output pool that cannot be grown very much. However, we already copy frames as soon as we get our hands on them (in our hwdec) so we're already safe from pool exhaustion, and the extra copy doesn't help us.
* hwdec_drmprime: support yuv420p formatEmperorPenguin182022-12-102-0/+6
| | | | | | | | | | | H264 hardware decode with v4l2m2m wasn't working on the RPi 4. Mpv would report the image format (yuv420p) wasn't supported. The change to hwdec_drmprime.c is to explicitly say that the format now is supported. The change to dmabuf_interop_gl.c is to specify the colour format of the planes before generating egl images. These changes were tested on a Pi 4 with this fork of ffmpeg: https://github.com/jc-kynesim/rpi-ffmpeg. Signed-off-by: EmperorPenguin18 <60635017+EmperorPenguin18@users.noreply.github.com>
* ao_coreaudio: use device's nominal sample rate for latency propertiesrcombs2022-12-101-1/+9
| | | | | | Fixes sync issues when using high-latency devices at non-native sample rates Closes #10984
* player: add window-id propertyNRK2022-12-054-0/+23
| | | | | | | | | | | | | | | | | | | | | currently only supported on x11. one practical use-case of this is wanting to embed something (such as dmenu) into the mpv window to use as a menu/selection. there might be other use-cases as well (e.g doing some shenanigans with `xdotool` or whatnot). it's currently possible to: * listen for 'current-window-scale' change (to check if the window has been created or not) * call an external tool like `xdo` or `xdotool` and grab the xid from mpv's pid. however it adds unnecessary dependency on external tools when mpv is fully capable of easily providing this information. closes: #10918
* ffmpeg: update to handle deprecation of `av_init_packet`Philip Langdale2022-12-038-34/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This has been a long standing annoyance - ffmpeg is removing sizeof(AVPacket) from the API which means you cannot stack-allocate AVPacket anymore. However, that is something we take advantage of because we use short-lived AVPackets to bridge from native mpv packets in our main decoding paths. We don't think that switching these to `av_packet_alloc` is desirable, given the cost of heap allocation, so this change takes a different approach - allocating a single packet in the relevant context and reusing it over and over. That's fairly straight-forward, with the main caveat being that re-initialising the packet is unintuitive. There is no function that does exactly what we need (what `av_init_packet` did). The closest is `av_packet_unref`, which additionally frees buffers and side-data. However, we don't copy those things - we just assign them in from our own packet, so we have to explicitly clear the pointers before calling `av_packet_unref`. But at least we can make a wrapper function for that. The weirdest part of the change is the handling of the vtt subtitle conversion. This requires two packets, so I had to pre-allocate two in the context struct. That sounds excessive, but if allocating the primary packet is too expensive, then allocating the secondary one for vtt subtitles must also be too expensive. This change is not conditional as heap allocated AVPackets were available for years and years before the deprecation.
* sws_utils: update to handle deprecation of `avcodec_enum_to_chroma_pos`Philip Langdale2022-12-011-0/+14
| | | | This has been replaced by `av_chroma_location_enum_to_pos`.
* vd_lavc: update to handle deprecation of `pkt_duration`Philip Langdale2022-12-011-0/+5
| | | | This has been replaced by `duration`.
* ffmpeg: increase minimum required version to 4.4Philip Langdale2022-12-014-20/+14
| | | | | | | | | Now that 0.35 has been released, we can consider increasing our minimum required ffmpeg version. Currently, we think 4.4 is the most recent version we can move to (from the current requirement of 4.0). This allows us to remove a few conditionals. There are more that we won't be able to remove unless we move further up to 5.1.
* wayland: check for resize/move in touch event firstDudemanguy2022-12-011-8/+9
| | | | | | | | | | | | | | | 8300830951e2b0b90b22fc7d33b7556ed05e139c rearranged/simplified some of the wayland touch code mainly because what was there before was completely broken on my machine in those days (dragging was unreliable, resizing was really buggy, etc.). However, one user said that touch input no longer worked for him after that change. I could not ever reproduce it, but it seems the issue was putting down the key before testing for resize/move in the code. Now who knows why this actually matters, but apparently it works for the user in question and I don't observe any unexpected behavior on my end when swapping the order. Like the mouse/pointer code, we also now do a test for dragging before actually trying a resize/move which is a little more consistent than before. Fixes #9771.
* osc: don't spam window-controls bindings on every renderDudemanguy2022-11-291-3/+9
| | | | | | | | | | | | | | | Not sure when this actually started happening, but it's probably been like this for years. Currently, the logic for the window-controls works by simply checking if the osc is visib