summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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
| | | | | | | | | | | | | | | | | | Switching to a new file while keeping the AO didn't update the volume. While there's an explicit audio_update_volume() call in reinit_audio_chain_src(), it doesn't work, because at that point ao_chain->ao is still NULL, and it does nothing. That's pretty weird and might cause other problems (what happens if you try to mute while the AO is "floating"?). Regarding gapless, trying to use the AO gain for replaygain is also gross nonsense, because the new replaygain computed gain would affect audio from the previous file. It looks like replaygain should be in an af_volume filter maybe. On the other hand, I enjoy setting ridiculous replaygain-preamp values and compensating with a low volume setting, which would not work well if both gains were applied to the audio independently. For now, just add the missing call. This is orthogonal to fixing replaygain "properly".
* Revert "audio: set audio chain ao on reinit"Your Name2021-05-071-3/+1
| | | | | | | | | | | | This reverts commit 3239e41277173bace5ecc2a22910c4660642429c. I'm fairly sure this is wrong, and my next commit should fix it properly. I'm not really sure, though. Normally, the AO is set again by reinit_audio_filters_and_output() after the new audio chain has decoded a frame and knows the new format. The reason replaygain (and apparently the thing the reverted commit tried to fix) didn't work is because they work asynchronously to the audio played by the AO (i.e. buggy and hard to fix).
* mac: add support for display-width/display-height propertyder richter2021-05-061-13/+20
| | | | | also merge back a helper function that was introduced in commit d3b7732 and for the purpose to be used with the new display res voctrl event.
* command: add display-width/display-height propertyDudemanguy2021-05-069-1/+60
| | | | | | | | | For some reason, this never existed before. Add VOCTRL_GET_DISPLAY_RES and use it to obtain the current display's resolution from each vo/windowing backend if applicable. Users can then access the current display resolution as display-width and display-height as per the client api. Note that macOS/cocoa was not attempted in this commit since the author has no clue how to write swift.
* DOCS/input.rst: clarify --no-input-default-keybindings docsAvi Halachmi (:avih)2021-05-041-1/+4
| | | | | | | | | | | | | | This commit describes more accurately what currently gets disabled by this option - specifically also keys from mp.add_key_binding. It's not necessarily the best behavior because libmpv clients might want to disable mpv's own builtin keybindings while still allowing scripts to define keys which `input.conf' can override. In the future we might exclude mp.add_key_binding from this option, but for now at least document this option accurately. Fixes #8809
* filter_kernels: fix quadric windowNiklas Haas2021-05-041-1/+1
| | | | | | | | | 3909e4cdfcb9 seems to have replaced this 0.5 constant by 0.75, using its presence in glumpy as justification. 0.75 is clearly a bug in glumpy, as its own source code doesn't even match the comment immediately above it. Every other implementation of this window I could find uses 0.5, including e.g. ImageMagick.
* DOCS/lua.rst: fix docs for utils.file_infoAvi Halachmi (:avih)2021-05-031-1/+1
| | | | | | | | | | | | | | The ctime member on Windows uses FILE_BASIC_INFO.ChangeTime, which is pretty much the same as st_ctime on POSIX. See https://devblogs.microsoft.com/oldnewthing/20100709-00/?p=13463 : ... The Last­Write­Time covers writes to the file’s data stream (which you accomplish via the Write­File function). On the other hand, the Change­Time also includes changes to the file metadata, such as changing its file attributes ... Fixes #8801
* build: address AVCodec, AVInputFormat, AVOutputFormat const warningssfan52021-05-0110-17/+17
| | | | FFmpeg recently changed these to be const on their side.
* scripting (lua/js): utils.getpid: make wrapper of pid propertyAvi Halachmi (:avih)2021-05-014-16/+5
| | | | | | | | | We now have at least 3 scripting APIs which are trivial wrappers around properties: mp.get_mouse_pos, utils.getcwd, utils.getpid. After some discussion on IRC it was decided that it's easier for us to maintain them as trivial wrappers than to deprecate them and inflict pain on users and script authors, so currently no plan to deprecate.
* command: new property: pid (process id)Avi Halachmi (:avih)2021-05-012-0/+12
| | | | Fixes #7562
* DOCS: clarify how client/script names workDudemanguy2021-04-292-4/+12
| | | | | This isn't really clearly stated anywhere and could understandably lead to some confusion.
* command: osd-dimensions: return ints and doc fixesDudemanguy2021-04-292-8/+8
| | | | | | Some subproperties in osd-dimensions were returned as doubles despite actually being integers. Additionally, correct a highly misleading line in the osd-width/osd-height documentation.
* audio: add two minor log messagessfan52021-04-291-2/+6
| | | | | This would have made the problem fixed in the previous commit a bit more obvious from the log output.
* ao/pulse: fix incorrect state reported after resetsfan52021-04-291-0/+1
| | | | fixes #8768
* osc: reset margins when using boxvideo with showfullscreen/showwindowedossifrage2021-04-271-1/+11
| | | | | | | | | | | | | | | | | | | This fixes a bug where using boxvideo with showfullscreen=no or showwindowed=no resulted in the margins not resetting when the OSC wasn't visible. For example, using: script-opts=osc-visibility=always,osc-boxvideo=yes,osc-showfullscreen=no and then going fullscreen would make the OSC disappear but the video margins would remain. This is because boxvideo was missing a dependence on the showfullscreen and showwindowed user options. This is fixed by adding the corresponding conditions to update_margins() and setting state.marginsREQ on fullscreen changes. update_margins() is called on tick() if there's a margins update pending, which guarantees the boxvideo margins are reset appropriately.
* wayland: ignore toplevel listener if geometry is 0Dudemanguy2021-04-261-0/+4
| | | | | | | | | | It turns out that if a user specifies fullscreen=yes and a width/height in an autoprofile, the compositor can execute its toplevel listener event. This can happen before we have any mpv window rendered at all so we end up performing a bunch of geometry operations and state checks when we shouldn't. It subtly messes up a lot of things like state detection. Just return from this function if the geometry has no width or height yet.
* osc: display immediately when visibility changes from never to alwaysossifrage2021-04-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | Clearing state.osd.data with an empty string at render_wipe() fixes an issue where changing the OSC visibility from "never" directly to "always" didn't immediately update the display when the player was paused. This could be verified by starting the player with `--script-opts=osc-visibility=always --pause` and then running `script-message osc-visibility never` followed by `script-message osc-visibility always`. Removing the overlay without changing the contents meant the overlay wouldn't update and display when enabled again until the fields changed in some way (e.g. seeking, mousing over the OSC area, etc.). Clearing state.osd.data before removal of the OSC makes sure set_osd doesn't return on re-enable and instead displays the OSC immediately as the data is now different. render_wipe() is now also used when the OSC needs to be cleared at tick() as using set_osd to clear it with an empty string did not call state.osd:remove() which can allow cleanups related to bitmap memory allocations etc.
* mac: fix window geometry calculation on secondary screensder richter2021-04-241-19/+26
| | | | | | | | | | | | | | | this is a regression of af26402, where we changed the geometry calculation to use the visible frame and consider its origin. though the origin is not screen relative but relative to the main screen. the rest of the code expects a screen relative rectangle. because of that windows would be placed out of the screen bounds when not on the main screen. recalculate to origin to be screen relative and use those values for the rest of the calculations. to make the code a bit more comprehensible be a bit more explicit about what is done where with temporary variables and comments. also move the mp_rect calculation that moves the origin and flips the y position to a separate function, so we can reuse it later.
* stream_file: add new identifier for macOS FUSE filesystemsder richter2021-04-241-1/+1
| | | | | the new identifier for osxfusefs is macfuse, but we will keep both since the older releases are still used.
* DOCS: mpv.rst: minor escaping clarificationsAvi Halachmi (:avih)2021-04-231-1/+4
| | | | Fixes #8767
* win32: fit_window_on_screen: simplify, add commentsAvi Halachmi (:avih)2021-04-231-16/+17
| | | | | | | | | | The fit_on_screen logic was a bit twisted. Simplify it a bit and update few comments to explain better what it's used for. Note that the new logic is not identical to before, but its intent should now be clearer. This means there might be regressions or improvements at edge cases. If followup fixes are needed, then we should keep the intent clear. Most likely though that it's fine.
* win32: fit_window_on_screen: centralize logic (no-op)Avi Halachmi (:avih)2021-04-231-4/+3
| | | | | | | | fit_on_screen is called only from reinit_window_state. Move the yes/no logic unmodified from fit_on_screen to reinit_window_state, and remove the w32->parent condition because it's already checked earlier at reinit_window_state.
* win32: fit_window_on_screen: ensure top edge is insideAvi Halachmi (:avih)2021-04-231-6/+18
| | | | | | | | | | | | | | | | | | | | | Previously, because the video (client area) was centered but the top and bottom borders are uneven (title is taller), then if the window is shrunk vertically to just-fit the desktop - the top edge of the title bar ended above the top edge of the display. This is a state which Windows prevents during manual move, but apparently it's not rejected at the Windows API. Now we ensure it doesn't happen, and nudge the window down to align the top edges if necessary. This is a commulative regression of commits 981048e0 and 364af7c6. To clarify functionality, this includes a no-op change: fit_rect was renamed to fit_rect_size and it now takes explicit width and height, because it only used the width/height of rc2 anyway. Fixes #6695
* options: win32: ignore and deprecate --fit-borderAvi Halachmi (:avih)2021-04-233-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The accurate description of this option was: - fit-border is enabled by default. When disabled, it adds a bug where if the window has borders and mpv shrinks it to fit the desktop, then the calculation ignores the borders and adds incorrect video crop. The option was added at commits 70f64f3c and 949247d6, in order to solve an issue (#2935) where if mpv wanted to display a video with size WxH, then w32_common.c incorrectly set the window to WxH, while down-scaling the video slightly to fit (even with small sizes). It was addressed with a new option which is enabled by default, but does the right thing (sets the client area to WxH) only when disabled, so that everyone who prefers their video slightly downscaled could keep their default behavior. (#2935 also addressed an off-by-one issue, fixed before fit-border) While disabling the option did avoid unnecessary downscaling, it also added a bug when disabled: the borders are no longer taken into account when the size is too big for the desktop. Most users don't notice and are unaffected as it's enabled by default. Shortly later (981048e0) the core issue is fixed, and now the client area is correctly set to WxH instead of the window (and together with the three following commits which center the video, adds a new bug where the window title can be outside the display - addressed next). However, fit-border remained, now without any effect, except that it still has the same bug when disabled and the window is too big. Later code changes and refactoring preserved this issue with great attention to details, and it remained in identical form until now. Simply rip out fit-border.
* demux_lavf: fix minor memory leaksrland jon2021-04-201-0/+2
|
* vo_gpu: greatly increase maximum shader cache sizeNiklas Haas2021-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | See #8137 for justification. This is not ideal, because a large cache results in a lot of `strcmp` invocations for every single shader invocation. But it's way better than resulting in a lot of shader recompilations for every single shader invocation. The only reason I don't want to uncap it altogether is because there are conceivable edge cases in which users load dynamically generated shaders with updated parameters (indeed, I've seen IRC discussions to this effect), and in this case, we don't want to grow the cache infinitely as a result of something like a floating point parameter being continuously updated. (Never mind that this *would* actually trigger worst case behavior for the `strcmp`, since the updated float constant is likely to be near the bottom of the shader body) Whatever. vo_placebo will liberate us all in the end.
* wayland: workaround hidden state detection badnessDudemanguy2021-04-182-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The wayland code uses a heuristic to determine whether or not the mpv window is hidden since the xdg-shell protocol does not provide a way for a client to directly know this. We don't render with the frame callback function for various, complicated reasons but the tl;dr is that it doesn't work well with mpv's core (maybe an essay should be written on this one day). Currently, the aforementioned heuristic considers a window hidden if we miss more frames in a row than the display's current refresh rate (completely arbitrary number). However, the wayland protocol does allow for the display's refresh rate to be 0 in certain cases (like a virtual output). This completely wrecks the heuristic and basically causes only every other frame to be rendered (real world example: nested sway sessions). Instead let's slightly redesign this mechanism to be a little smarter. For coming up with the vblank time (to predict when to timeout on the wait function), instead use the vsync interval calculated using presentation time. That is the most accurate measure available. If that number is not available/invalid, then we try to use the vsync interval predicted by the presentation event. If we still don't have that (i.e. no presentation time supported by the compositor), we can instead use the old way of using the expected vsync interval from the display's reported refresh rate. If somehow we still do not have a usable number, then just give up and makeup shit. Note that at this point we could technically ask the vo for the estimated vsync jitter, but that would involve locking/unlocking vo which sounds horrifying. Ideally, you never reach here. See https://github.com/swaywm/wlroots/issues/2566 for the actual target of this fix. wlroots uses presentation time so in practice we are mostly just using that calculated vsync interval number.
* audio: set audio chain ao on reinitDudemanguy2021-04-181-1/+3
| | | | | | | | | Seems to be a slight corner case with the audio API rewrite. When switching from one file to another one, the volume of the ao would never be set because the audio chain's ao wasn't set. This caused a bug with the reset-set-on-file option. The volume/property would be correctly set internally, but the gain was not actually set when the file switched. Fixes #8287.
* wayland: update geometry + cursor on output eventDudemanguy2021-04-161-40/+56
| | | | | | | | | | | | | | | | | | | | The wayland output listener can update whenever something about the output changes (resolution, scale). Currently, the mpv VO updates correctly when the refresh rate changes, but changes of both scale and resolution were not considered. This causes a bug in certain cases like the mouse surface not being shown at certain scale factors due to the cursor scale not being updated correctly. Also autofit type options would not update if the resolution changes. To fix this, we must always reset the window geometry and wl scaling whenever the output event occurs on wl->current_output. There is no way to know precisely what changed from the previous state, so all of the parameters must be reset and then resized. As an aside, this apparently doesn't fix all cursor problem as there's apparently a bug in libwayland-cursor(*). It's still something we should be doing regardless. *: https://gitlab.freedesktop.org/wayland/wayland/-/issues/194
* wayland: support the display-hidpi-scale propertyDudemanguy2021-04-121-0/+8
| | | | | | | | | | | | | | So apparently this property had existed since 2019. Internally, it's used as a part of the console.lua script for scaling. Yours truly somehow didn't bat an eye at the fact that the text in the console was super small (made worse by the fact that xwayland does scale) and just ignored it for all this time. Oh well. To report dpi changes to mpv's core, we need to use VO_EVENT_DPI in a couple of places. One place is, of course, the surface listener if the scale value reported by the wayland server changes. The other place is in the very first reconfig since mpv's core will not find the correct scale value until we actually get a wl_output from the wayland server.
* demux: undeprecate --cache-secssfan52021-04-083-8/+2
| | | | | It serves a purpose and a rework of the cache won't be coming anytime soon. This partially reverts commit 8427292eb7c4074e1205c3d73c53c9e82569325f.
* audio/aframe: reuse data buffer if less than 8 channelssfan52021-04-081-6/+12
| | | | | | | | This fixes audio encoding crashing under ASan. When extended_data != data, FFmpeg copies more pointers from extended_data (= the number of channels) than there really are for non-planar formats (= exactly 1), but that's not our fault. Regardless, this commit makes it work in all common cases.
* stream: turn stream_info.open2's args argument constsfan52021-04-085-5/+5
| | | | So nobody comes up with the "smart" idea to modify those again.
* stream_slice: fix use-after-free if inner stream fails to opensfan52021-04-081-2/+3
| | | | | | The args struct is reused to attempt opening an URL with different stream layers, overwriting args->url not only breaks this but also causes the freed buffer to be used again.
* player/scripting: fix use-after-free when loading script folderssfan52021-04-081-2/+3
|
* stream_mf: set correct stream originsfan52021-04-081-0/+1
| | | | | mf:// reads files from the local filesystem and should be subject to the usual security checks mpv has for such protocols.
* demux_mf: improve format string processingAvi Halachmi (:avih)2021-04-051-2/+37
| | | | | | | | | | | | | | | | | | | | | Before this commit, the user could specify a printf format string which wasn't verified, and could result in: - Undefined behavior due to missing or non-matching arguments. - Buffer overflow due to untested result length. The offending code was added at commit 103a9609 (2002, mplayer svn): git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4566 b3059339-0415-0410-9bf9-f77b7e298cf2 It moved around but was not modified meaningfully until now. Now we reject all conversion specifiers at the format except %% and a simple subset of the valid specifiers. Also, we now use snprintf to avoid buffer overflow. The format string is provided by the user as part of mf:// URI. Report and initial patch by Stefan Schiller. Patch reviewed by @jeeb, @sfan5, Stefan Schiller.
* manpage: fix a typo in the --aid option noteun.def2021-04-051-1/+1
|
* vo_gpu: adjust interpolation_threshold's defaultLaserEyess2021-03-282-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When mpv attempts to play a video that is, on average, 60 FPS on a display that is not exactly 60.00 Hz, two options try to fight each other: `video-sync-max-video-change` and `interpolation-threshold`. Normally, container FPS in something such as an .mp4 or a .mkv is precise enough such that the video can be retimed exactly to the display Hz and interpolation is not activated. In the case of something like certain live streaming videos or other scenario where container FPS is not known, the default option of 0.0001 for `interpolation-threshold` is extremely low, and while `video-sync-max-video-change` retimes the video to what it approximately knows as the "real" FPS, this may or may not be outside of `interpolation-threshold`'s logic at any given time, which causes interpolation to be frequently flipped on and off giving an appearance of stuttering or repeated frames that is oftern quite jarring and makes a video unwatchable. This commit changes the default of `interpolation-threshold` to 0.01, which is the same value as `video-sync-max-video-change`, and guarantees that if the user accepts a video being retimed to match the display, they do not additionally have to worry about a much more precise interpolation threshold randomly flipping on or off. No internal logic is changed so setting `interpolation-threshold` to -1 will still disable this logic entirely and always enable interpolation. The documentation has been updated to reflect this change and give context to the user for which scenarios they might want to disable `interpolation-threshold` logic or change it to a smaller value.
* options: Add validation macro for int typePhilip Langdale2021-03-281-0/+8
| | | | As an illustrative example.
* demux: Move demuxer help to new standard mechanismPhilip Langdale2021-03-284-13/+9
| | | | | Previously, demux help was handled as a special case in main.c and this is no longer necessary.
* options: Make validation and help possible for all option typesPhilip Langdale2021-03-2814-106/+159
| | | | | | | | | | |