summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* osc: expose osc-visibility via shared-script-propertiesAvi Halachmi (:avih)2021-07-061-0/+1
| | | | | | | | | | | | | | | | osc-visibility can already be changed at runtime via script-message or other means, but until now there was no way to tell what the current state is. Now shared-script-properties/osc-visibility reflects this state. It's output-only by the osc - changing it does not affect the osc. Useful if a script wants to change osc-visibility temporarily, and later restore to its original state. There's no way to coordinate if more than one script wants to change it, but that would be a hard problem to solve anyway, even if the osc itself tried to coordinate such requests from different sources.
* wayland: refactor surface scalingDudemanguy2021-06-302-33/+56
| | | | | | | | | | | | | | | Another day, another wayland refactor. Way back when, dcc3c2e added support for the hidpi-window-scale option (something you probably should never set to no but whatever) to wayland. Well technically, it never had any runtime toggling support (don't remember if detecting when vo_opts changed was possible or not then; maybe not). Anyways in the process of fixing that, I went ahead and refactored how this is all handled. The key difference is that when hidpi-window-scale is disabled, wl->scaling is directly set to 1 instead of forcibly setting wl->current_output->scale to 1. Note that scaling operations don't always require a geometry reset/resize so set_surface_scaling needs to be separate from set_geometry. The logic here is kind of complicated but it (should) be correct.
* sub: fix subs/lyrics on music files with sub-past-video-end=norcombs2021-06-271-1/+3
| | | | Regressed in 11423acf3
* wayland: fix wl_surface_set_buffer_scale usageDudemanguy2021-06-273-3/+2
| | | | | | | | | | | The wl_surface lives for the entire lifetime of the vo. It's only neccesary to set the scale initially and when the output scaling changes (the surface moves to a different output with a different scale or the output itself changes it scale). All of the calls that were being made in the egl/vulkan resize functions are not needed. vo_wlshm wasn't correctly rescaling itself before this commit since it had no logic to handle scale changes. This should all be shared, common code in the surface/output listeners.
* wayland: always be sure to initially try to renderDudemanguy2021-06-275-8/+7
| | | | | | | | | | | | | | | | | | | A subtle regression from c26d833. On sway if mpv was set to be a floating window in the config, set_buffer_scale would actually get applied twice according to the wayland log. That meant a 1920x1080 window would appear as a 960x540 window if the scale of the wl_output was set to 2. This only affected egl on sway (didn't occur on weston and was too lazy to try anything else; probably they were fine). Since wl->render is initially false, that meant that the very first run through the render loop returns false. This probably caused something weird to happen with the set_buffer_scale calls (the egl window gets created and everything but mpv doesn't write to it just yet) which makes the set_buffer_scale call happen an extra time. Since it was always intended for mpv to initally render, this is worth fixing. Just chnage wl->render to wl->hidden (again) and flip the bools around. That way, the initial false value results in render == true and mpv tries to draw on the first pass. This fixes the weird scaling behavior because reasons.
* wayland: remove unused includesDudemanguy2021-06-272-6/+0
| | | | Presentation time only lives in in wayland_common.
* wayland: handle app id option less stupidlyDudemanguy2021-06-263-6/+2
| | | | | | Not sure what I was on when I wrote this. wayland-app-id is supposed to default to "mpv". Just set that in the vo_sub_opts and don't do this weird m_config_cache_write_opt thing. Also make the doc entry nicer.
* wayland: reorganize wayland common codeDudemanguy2021-06-265-948/+962
| | | | | | | Mostly a cosmetic change that (hopefully) makes things look better. Some functions and structs that were previously being exported in the wayland header were made static to the wayland_common.c file (these shouldn't be accessed by anyone else).
* stats.lua: add scaled resolutionDudemanguy2021-06-251-0/+7
| | | | | Calculate the actual scaled size of the video from osd-dimensions and display it on the stats page.
* DOCS: fix typo on seekbarkeyframeshooke0072021-06-241-6/+6
|
* TOOLS/lua/autoload: load files even if current file is hiddenLaserEyess2021-06-241-1/+3
| | | | | | | When the current file is hidden and `ignore_hidden` is true, autoload will skip loading other files in the current directory. Make sure that the current file is always counted for autoloading even if it is hidden.
* TOOLS/lua/autoload: add ignore_hidden optionLaserEyess2021-06-241-2/+4
| | | | | | | | | | | | | | | In 8a7614a0fb0d4f1073057049933972bb1113c14c files that start with a '.' were blacklisted from autoload.lua. Since then 35e8710b86545849484f6544a16047792fa75bb2 was introduced and explicitly whitelisted file extensions. With this change, there is no longer a reason to blacklist all files starting with '.', because it is valid to have a file called '.hidden.mkv', and there is no chance of hidden files such as '.bashrc', '.DS_STORE', '.gitignore', etc. being autoloaded by mpv. This commit tries to keep the same behavior as before, which is to by default not load hidden files, but allows the user to optionally allow hidden files to be autoloaded.
* player: fix property nameGuido Cella2021-06-241-1/+1
| | | | | | | | | | | | | Commits 4d1ffec and 6e481d0 renamed sub-ass-style-override to sub-ass-override. But in commit bd603c2, when renaming it in quit-watch-later's backup_properties, which determines which properties are saved by quit-watch-later/write-watch-later-config, it was incorrectly renamed to sub-style-override instead, and thus never got saved even if modified at runtime. Instead mpv attempted to save the non-existing property "sub-style-override", but since no error is raised when saving non-existing properties with quit-watch-later, no one noticed it. This commit renames the saved property to the correct new name "sub-ass-override" so that it does get saved.
* lua: idle observers: ensure timers are up-to-dateAvi Halachmi (:avih)2021-06-231-0/+9
| | | | | | | | | | | | | | | This fixes two issues, both of which resulted from the timers-wait period not being re-calculated after idle-observers were executed: - If timers were added from an idle observer then they could fire long after they were due (only when/if the next mpv event arrives). - Idle observers don't execute in zero time, and the wait period for the next timer was implicitly extended by the idle observers execution time (because it was calculated before the idle observers). This commit ensures that if idle-observers were executed, then the timers wait period is re-calculated, which solves both issues.
* lua: timers: don't block forever with slow callbacksAvi Halachmi (:avih)2021-06-231-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, process_timers() kept going as long as there were due timers, which could be for extended periods of time or even forever if there were slow timer callbacks with either periodic timers or if timers were added repeatedly. This prevented dequeuing mpv events, and subsequently, among others, prevented mpv from quitting until process_timers() completed. For instance, this caused process_timers() to never return: function render() <longer than 1/60 s on a slow system> end mp.add_periodic_timer(1/60, render) Similarly, it never returned if a timer callback always added a new one-shot which was already due by the time the callback completed. This commit ensures that process_timers() only executes callbacks which were due when it started, so that timers which are added (or repeated) during process_timers() will wait for the next iteration - after mpv events are dequeued. This has no performance impact under normal conditions (when callbacks complete before the next timer is due). Additionally, previously idle-observers were executed unconditionally after the timers because indeed there was nothing due when (if...) process_timers() completed. However, now process_timers() can return even if there are due timers, so skip idle-observers on such case.
* sub: by default, don't render timestamps after video EOFrcombs2021-06-234-1/+11
| | | | | | | | | This fixes a long-standing apparent issue where mpv would display the last frame with no subtitles at EOF. This is caused by sub rendering switching from video timestamps to audio timestamps when the video ends, and audio streams often running past the timestamp of the last video frame. However, authoring tools (most notably Aegisub) don't tend to provide easy ways to add meaningful subtitles after the end of the video, so this is rarely actually useful.
* player: change cover-art-auto behaviorGuido Cella2021-06-233-12/+8
| | | | | | | | | | | | | | This makes cover-art-auto behave more like sub-auto and audio-file-auto: - load cover art with a language, e.g. if playing foo.mp3, foo.en.jpg will be loaded with lang=en - load cover art containing the media filename with fuzzy and all, e.g. 'foo (large).jpg' - make all/2 load all images in the directory, and make fuzzy/1 the default These are all uncommon use cases, but synchronizing the behavior of the external file options simplifies the code.
* js: idle-observers: minor performance improvementAvi Halachmi (:avih)2021-06-221-1/+1
| | | | | | The idle-observers block has at least 3 function calls, and it was entered every time the script went into idle, however, we can save these calls by checking first that there are indeed such observers.
* osc: seekbar hover/drag: display target chapter at the titleAvi Halachmi (:avih)2021-06-222-2/+35
| | | | Fixes #8925
* manpage: add article in fuzzy explanationGuido Cella2021-06-211-2/+2
|
* player: remove unnecessary checkGuido Cella2021-06-211-1/+1
| | | | | | | | | | | | Remove the check that the external filename is not the same as the currently playing one, which prevents mpv from loading images again as external cover art, but this isn't necessary because cover art is only added when playing standalone audio. I had only added this check because I would otherwise get a segfault only when compiling with gcc 10.2 with optimize and changing position within a playlist of multiple images (and this couldn't even be reproduced by Dudemanguy on the same gcc version), but this was caused by the uninitialized lang variable which is now fixed.
* player: fix segfaultGuido Cella2021-06-211-2/+1
| | | | | | | | | | | | | | | | | | Commit 029ff10 added a goto statement which skipped initializing the `lang' variable. This could crash depending on compiler optimizations and other factors: if the lang bstr pointer happened to end up NULL (which is apparently the case with most compilers) then it's validly empty, but if it pointed to a random and incorrect memory address then it crashed. The crash was observed when mpv was compiled using gcc 10.2 with optimizations enabled, and affected some third party Windows builds. This commit ensures the goto doesn't skip the initialization. Thanks to votemp for figuring this out. Fixes #8922.
* osc: ensure tick after any mouse-eventAvi Halachmi (:avih)2021-06-201-1/+3
| | | | | | | | | | | | | | | | | Previously tick() was ensured unconditionally only after mouse-move, but there are other mouse-events which need re-rendering (tick), like mouse-down (icons may get grayed-out) or mouse-up (icons may change). For instance: mpv --pause --myclip.mkv then move the mouse over the volume/mute OSC button, then - without moving the mouse - press and release the left mouse button. The osc was not re-rendered because it's paused and the mouse didn't move, so the volume icon didn't get grayed-out when held down, and the icon doesn't change on mouse-up (to reflect the new mute state). Now both these changes are rendered correctly.
* osc: don't initialize while mouse-down over an elementAvi Halachmi (:avih)2021-06-201-1/+8
| | | | | | | | | This is not a new issue, however, until the last commit - 96b246d init probably didn't happen much (or at all) between mouse-down and mouse-up, but after this commit, if there are chapters in a live-stream then osc_init() is used to re-render the markers at the adjusted position - which breaks the OSC buttons functionality if init happened between mouse-down and mouse-up.
* osc: update chapter marker positions when duration changesSagnac2021-06-162-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit 6abb7e3 updates the markers when the chapters change, but it doesn't update their relative position at the bar when the duration changes. This means that adding chapters to a live stream would result in corresponding chapter markers which were static while the duration changed and thus their positions became incorrect over time until the OSC was reinitialized. This is fixed by observing the duration property if chapters are present and reinitializing the OSC when the duration changes. The live_markers user option, which determines whether the duration property is observed when there are chapters, has been added in order to allow disabling this behaviour as calling request_init() frequently might have some impact on low-end systems. The impact of request_init() on render() was measured to increase from 1-1.5 ms to 2-3 ms on a 2010 MacBook Air, while the impact was neglible on a 2016 Surface Book (increasing only to an average of 1.4 ms from 1.3 ms for n=1500 render cycles). The live_markers option is enabled by default.
* js: add mp.utils.append_fileAvi Halachmi (:avih)2021-06-133-11/+23
| | | | | Also, for consistency with other APIs, mp.utils.{write,append}_file now return true on success (and still throw on any error).
* vo_gpu: vulkan: displayvk: Fix handling of unconnected planesPhilip Langdale2021-06-121-1/+6
| | | | | | | | If a plane is not connected to any displays, we won't set an entry in the mapping of planes to displays. So ensure these unset entries are null and skip them. Fixes #8913
* vo_gpu: vulkan: implement a VkDisplayKHR backed contextPhilip Langdale2021-06-116-0/+425
| | | | | | | | | | | | | | | | | | | | | | | | This is the Vulkan equivalent of the drm context for OpenGL, with the big difference that it's implemented purely in terms of Vulkan calls and doesn't actually require drm or kms. The basic idea is to identify a display, mode, and plane on a device, and then create a display backed surface for the swapchain. In theory, past that point, everything is the same, and this is in fact the case on Intel hardware. I can get a video playing on a vt. On nvidia, naturally, things don't work that way. Instead, nvidia only implemented the extension for scenarios where a VR application is stealing a display from a running window system, and not for standalone scenarios. With additional code, I've got this scenario to work but that's a separate incremental change. Other people have tested on AMD, and report roughly the same behaviour as on Intel. Note, that in this change, the VT will not be correctly restored after qutting. The only way to restore the VT is to introduce some drm specific code which I will illustrate in a separate change.
* vo_gpu: vulkan: provide a helper to access device name optionPhilip Langdale2021-06-112-0/+17
| | | | | | | | | | | The VkDisplayKHR context type requires making calls against the physical device before the libplacebo context is initialised. That means we can't simply use the physical device object that libplacebo would create - instead we have to create a separate one, but make sure it's referring to the same physical device. To that end, we need the device name that the user may have requested so we can pass it on.
* vo_rpi: fix argument nameDudemanguy2021-06-081-2/+2
| | | | This is data not arg.
* github/issue_template: irc -> IRCJan Ekström2021-06-081-2/+2
| | | | Requested to be changed while at it.
* {ci,docs,README}: update IRC references to new networkJan Ekström2021-06-084-6/+6
|
* docs: fix leftover reference to the now defunct --video-sync-adrop-size optionChris Varenhorst2021-06-041-5/+4
|
* ytdl_hook: improve handling of json parsing errorsRetusthese2021-05-291-10/+12
| | | | | | | | | | This moves the JSON parsing above the main youtube-dl error-handling block and integrates parsing errors into that block. Now, if a parsing error occurs, youtube-dl's stderr will be logged as it is with other errors. This also catches errors that cause youtube-dl to output "null", which would previously be mishandled as a parsing error and crash ytdl_hook when it attempted to concatenate the error string from parse_json.
* wayland: refactor dispatching eventsDudemanguy2021-05-281-46/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was originally just a bugfix for a race condition, but the scope expanded a bit. Currently, the wayland code does a prepare_read -> dispatch_pending -> display_flush -> read_events -> dispatch_pending routine that's basically straight from the wayland client API documentation. This essentially just queues up all the wayland events mpv has and dispatches them to the compositor. We do this for blocking purposes on every frame we render. A very similar thing is done for wait_events from the VO. This code can pretty easily be unified and split off into a separate function, vo_wayland_dispatch_events. vo_wayland_wait_frame will call this function in a while loop (which will break either on timeout or if we receive frame callback from the compositor). wait_events needs to just check this in case we get some state change on the wakeup_pipe (i.e. waking up from the paused state). As for the actual bugfix part of this, it's a slight regression from c26d833. The toplevel config event always forced a redraw when a surface became activated again. This is for something like displaying cover art on a music file. If the window was originally out of view and then later brought back into focus, no picture would be rendered (i.e. the window is just black). That's because something like cover art is just 1 frame and the VO stops doing any other additional rendering. If you miss that 1 frame, nothing would show up ever again. The fix in this case is to always just force a redraw when the mpv window comes back into view. Well with the aforementioned commit, we stopped doing wl_display_roundtrip calls on every frame. That means we no longer do roundtrip blocking calls. We just be sure to queue up all of the events we have and then dispatch them. Because wayland is fundamentally an asynchronous protocol, there's no guarantee what order these events would be processed in. This meant that on occasion, a vo_wayland_wait_frame call (this could occur multiple times depending on the exact situation) would occur before the compositor would send back frame callback. That would result in the aforementioned bug of having just a black window. The fix, in this case, is to just do a vo_wayland_wait_frame call directly before we force the VO to do a redraw. Note that merely dispatching events isn't enough because we specifically need to wait for the compositor to give us frame callback before doing a new render. P.S. fix a typo too.
* manpage: mention cover-art-autoGuido Cella2021-05-282-5/+6
| | | | | --cover-art-auto affects rescan-external-files, and --autoload-files affects cover art.
* README: fix link to feature-request issuesGuilherme2021-05-281-1/+1
|
* player: load cover art with the media filenameGuido Cella2021-05-273-19/+28
| | | | Closes #8666.
* win32: support the property 'focused'Avi Halachmi (:avih)2021-05-272-3/+13
| | | | | | | | | | | | | And also change the existing WM_KILLFOCUS handler to return 0 instead of 'break' (which later calls DefWindowProcW), as MSDN says we should do for WM_{KILL,SET}FOCUS. It seems that the 'focused' property is now supported by all main VOs: x11, macOS, wayland, Windows. TCT/sixel/caca probably don't support it, and unknown with SDL. Fixes #8868
* osc: re-initialize when chapter list changesRetusthese2021-05-271-0/+1
| | | | | | | | | | | | When the OSC initializes, it checks whether the current video has chapters, and if it does not, it disables its chapter functionality (chapter buttons are grayed out and unusable, chapter indicators don't show on the seek bar). If another script changed the chapter list after the video has loaded, those changes would be ignored by the OSC until some other event causes it to re-initialize, because it did not observe the chapter list property. This is fixed by adding observation of chapter-list alongside the other properties that trigger re-initialization.
* recorder: fix codec_tag / codec_id confusionTheAMM2021-05-261-2/+2
|
* recorder: clear codec_tag if no target format supportTheAMM2021-05-261-0/+6
| | | | | | | Avoiding blindly copying the codec_tag between different formats allows us to mux packets from, say, mpegts streams to matroska, making the recorder (dump-cache) much more usable as unsupported codec_tags can make the muxer reject the streams.
* af_scaletempo2: use gcc vectors to speed up inner loopNiklas Haas2021-05-262-3/+76
| | | | | | | | | | This brings my scaletempo2 benchmark down from ~22s to ~7s on my machine (-march=native), and down to ~11s with a generic compile. Guarded behind an appropriate #ifdef to avoid being ableist against people who have the clinical need to run obscure platforms. Closes #8848
* vo_gpu: replace --icc-contrast by --icc-force-contrastNiklas Haas2021-05-263-49/+52
| | | | | | | | | | | | | | Not only does this have semantics that make far more sense, it also has a default that makes far more sense. (Equivalent to the old `icc-contrast=inf`) This removes the weird 1000:1 contrast default assumption which especially broke perceptual profiles and also screws things up for OLED/CRT/etc. Should probably close some issues but I honestly can't be bothered to figure out which of the thousands colorimetry-related issues are affected.
* wayland: shuffle around the render loop againDudemanguy2021-05-245-35/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Take two. f4e89dd went wrong by moving vo_wayland_wait_frame before start_frame was called. Whether or not this matters depends on the compositor, but some weird things can happen. Basically, it's a scheduling issue. vo_wayland_wait_frame queues all events and sends them to the server to process (with no blocking if presentation time is available). If mpv changes state while rendering (and this function is called before every frame is drawn), then that event also gets dispatched and sent to the compositor. This, in some cases, can cause some funny behavior because the next frame gets attached to the surface while the old buffer is getting released. It's safer to call this function after the swap already happens and well before mpv calls its next draw. There's no weird scheduling of events, and the compositor log is more normal. The second part of this is to fix some stuttering issues. This is mostly just conjecture, but probably what was happening was this thing called "composition". The easiest way to see this is to play a video on the default audio sync mode (probably easiest to see on a typical 23.976 video). Have that in a window and float it over firefox (floating windows are bloat on a tiling wm anyway). Then in firefox, do some short bursts of smooth scrolling (likely uses egl). Some stutter in video rendering could be observed, particularly in panning shots. Compositors are supposed to prevent tearing so what likely was happening was that the compositor was simply holding the buffer a wee bit longer to make sure it happened in sync with the smooth scrolling. Because the mpv code waits precisely on presentation time, the loop would timeout on occasion instead of receiving the frame callback. This would then lead to a skipped frame when rendering and thus causing stuttering. The fix is simple: just only count consecutive timeouts as not receiving frame callback. If a compositor holds the mpv buffer slightly longer to avoid tearing, then we will definitely receive frame callback on the next round of the render loop. This logic also appears to be sound for plasma (funfact: Plasma always returns frame callback even when the window is hidden. Not sure what's up with that, but luckily it doesn't matter to us.), so get rid of the goofy 1/vblank_time thing and just keep it a simple > 1 check.
* wayland: send VO_EVENT_DPI on output event as wellDudemanguy2021-05-231-0/+1
| | | | The display scaling might change here, so we need to signal mpv's core.
* command: add a missing comma to MP_EVENT_WIN_STATEDudemanguy2021-05-231-1/+1
| | | | In my defense, it still compiled.
* vo_gpu: fix extreme clipping with --gamut-clipping for HDR outputsNiklas Haas2021-05-221-1/+2
| | | | | | Checking against 1.0 is wrong for this code, because it's in an absolute luminance scale relative to reference white. We should be normalizing this by `dst.sig_peak`.
* wayland: simplify render loopDudemanguy2021-05-225-49/+36