summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is actually a very nice simplification that should have been thought of years ago (sue me). In a nutshell, the story with the wayland code is that the frame callback and swap buffer behavior doesn't fit very well with mpv's rendering loop. It's been refactored/changed quite a few times over the years and works well enough but things could be better. The current iteration works with an external swapchain to check if we have frame callback before deciding whether or not to render. This logic was implemented in both egl and vulkan. This does have its warts however. There's some hidden state detection logic which works but is kind of ugly. Since wayland doesn't allow clients to know if they are actually visible (questionable but whatever), you can just reasonably assume that if a bunch of callbacks are missed in a row, you're probably not visible. That's fine, but it is indeed less than ideal since the threshold is basically entirely arbitrary and mpv does do a few wasteful renders before it decides that the window is actually hidden. The biggest urk in the vo_wayland_wait_frame is the use of wl_display_roundtrip. Wayland developers would probably be offended by the way mpv abuses that function, but essentially it was a way to have semi-blocking behavior needed for display-resample to work. Since the swap interval must be 0 on wayland (otherwise it will block the entire player's rendering loop), we need some other way to wait on vsync. The idea here was to dispatch and poll a bunch of wayland events, wait (with a timeout) until we get frame callback, and then wait for the compositor to process it. That pretty much perfectly waits on vsync and lets us keep all the good timings and all that jazz that we want for mpv. The problem is that wl_display_roundtrip is conceptually a bad function. It can internally call wl_display_dispatch which in certain instances, empty event queue, will block forever. Now strictly speaking, this probably will never, ever happen (once I was able to to trigger it by hardcoding an error into a compositor), but ideally vo_wayland_wait_frame should never infinitely block and stall the player. Unfortunately, removing that function always lead to problems with timings and unsteady vsync intervals so it survived many refactors. Until now, of course. In wayland, the ideal is to never do wasteful rendering (i.e. don't render if the window isn't visible). Instead of wrestling around with hidden states and possible missed vblanks, let's rearrange the wayland rendering logic so we only ever draw a frame when the frame callback is returned to use (within a reasonable timeout to avoid blocking forever). This slight rearrangement of the wait allows for several simplifications to be made. Namely, wl_display_roundtrip stops being needed. Instead, we can rely entirely on totally nonblocking calls (dispatch_pending, flush, and so on). We still need to poll the fd here to actually get the frame callback event from the compositor, but there's no longer any reason to do extra waiting. As soon as we get the callback, we immediately draw. This works quite well and has stable vsync (display-resample and audio). Additionally, all of the logic about hidden states is no longer needed. If vo_wayland_wait_frame times out, it's okay to assume immediately that the window is not visible and skip rendering. Unfortunately, there's one limitation on this new approach. It will only work correctly if the compositor implements presentation time. That means a reduced version of the old way still has to be carried around in vo_wayland_wait_frame. So if the compositor has no presentation time, then we are forced to use wl_display_roundtrip and juggle some funny assumptions about whether or not the window is hidden or not. Plasma is the only real notable compositor without presentation time at this stage so perhaps this "legacy" mechanism could be removed in the future.
* player/command: add secondary-sub-text propertyZsolt Vadasz2021-05-192-5/+22
|
* sub/osd: hide secondary subtitles if secondary-sub-visibility is falseZsolt Vadasz2021-05-197-2/+17
|
* vo_gpu: hwdec_vaapi: silence errors while probingNiklas Haas2021-05-194-4/+7
| | | | | Silences warnings related to DRM format modifiers that can show up while probing formats.
* stream_lavf: remove uninitialized http_like arrayDudemanguy2021-05-181-4/+2
| | | | | Serves no purpose and can be a fatal error on certain compiler settings. Just move the other http_like up here instead.
* osxbundle: fix slow and wasteful memory allocationder richter2021-05-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | when using the bundle with activated big enough cache, very slow and wasteful memory allocations lead to jittery playback and lot of dropped frames. the cache had to have a certain size so it would constantly allocate new memory to reproduce this. this never happens when started from the terminal. the source of the problem is a different malloc allocation policy, MALLOC_NANO, that allocated a huge amount of virtual memory without actually using it. the usage was between 0% to 25% of that virtual memory. the binaries allocation policy on the other hand used >80% of that allocated virtual memory and was a lot more efficient, it would use MALLOC_TINY instead. this is fixed by setting the MallocNanoZone environment variable to 0 to use the V1 of the allocation policy. when started from the bundle via launchd this is forced to 1 and V2 policy which causes this problem. some more info can be found in following file and its comments on the Apple open source site: https://opensource.apple.com/source/libmalloc/libmalloc-317.40.8/src/nano_malloc_common.c.auto.html Fixes #7405
* stream_file: disable read ahead for remote files on macOSder richter2021-05-161-1/+8
| | | | | | | | | this can cause stutter on remote files because in certain cases this causes a reconnect to the remote that leads to the file not being read fast enough. VLC had the same problem and fixes it the same way. https://github.com/videolan/vlc/commit/b8b8c438f8f65a93da82364c8fea1dbf987c4a8e Fixes #4434
* build: move mingw jobs to Github actionssfan52021-05-162-21/+41
|
* build: move website rebuild into Linux/clang travis jobsfan52021-05-161-1/+1
| | | | The mingw ones will be removed in the next commit.
* options: add some entries to --display-tags defaultsYour Name2021-05-111-0/+1
| | | | Useful for the previous commit.
* ytdl_hook: expose some JSON fields as tagsYour Name2021-05-111-0/+29
| | | | | | | | | | Shows uploader, channel, description fields. This works only if the media media is constructed as EDL (for youtube it usually does this), and if the all_formats option is not set to true (does anyone even use it?). The former usually happens because youtube serves audio and video separately, though it will not for live HLS/DASH. The latter uses delayed media opening, which breaks the global_tags mechanism (see previous commit).
* edl: add a way to add tagsYour Name2021-05-112-1/+36
| | | | | | | | Add new header which shows up as tags/metadata (associated with --display-tags). The way this is added means it doesn't always work, because root->meta (see code) can be NULL for some absurd reason. But it works for the one case I intended to use it (ytdl_hook, see next commit), though only in default configurations.
* zsh completion: perform globbing on binary pathNiklas Haas2021-05-071-4/+4
| | | | | | | | | | | When trying to use completion for mpv binaries specified with some shell glob, e.g. ~/dev/mpv/build/mpv, the current code doesn't substitute the homedir prefix into the path name, resulting in runtime errors about the file '~/dev/mpv/build/mpv' not being found. The simple fixed is to use $~var instead of $var whenever expanding the filename, which performs the same globbing that would otherwise be performed when executing the command.
* vo_gpu: fix trivial memory leakYour Name2021-05-071-1/+3
| | | | Nobody noticed this? Seriously?
* Revert "vo_gpu: revert 8a09299 and conditionally clear framebuffer again"Your Name2021-05-071-5/+3
| | | | | | | | | | This reverts commit b8156a9a86ae4ff087b1b255c68a3ca38ec2d086. Apparently there are two problems here. One on Linux (fixed by the original change and this revert) and one on alternative-medicine-Job's OS. Since the latter has deprecated OpenGL and OpenGL is a second-class citizen, I think it's better to prefer the fix for a platform that is still alive.
* vf_sub: restore OSD if removedYour Name2021-05-071-0/+9
| | | | | | | When inserting vf_sub, the VO OSD is directed not to draw itself. But this flag was never unset, even when removing vf_sub. The fix is pretty shit, but appears to work.
* options: extend --replaygain-preamp rangeYour Name2021-05-071-1/+1
| | | | Whether that makes sense or not.
* audio: fix replaygain being completely brokenYour Name2021-05-071-0/+1
| | | | | | | | | | | | |