mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.66k stars 2.93k forks source link

various: define builtin options and key bindings for images #15346

Open guidocella opened 21 hours ago

guidocella commented 21 hours ago

This makes mpv a good image viewer out of the box, as it is currently hard to setup.

It adds a builtin image conditional profile that users can extend in mpv.conf. It is written to not restore and reapply the options on each image change, because that is slow for certain options (e.g. --d3d11-flip=no restarts the VO), and causes visible flicker when options like gamma are unapplied before changing image and reapplied on the next image. But it still restores the previous options after switching to a video or audio file.

etc/image-input.conf defines default key bindings for image, and ~/.config/mpv/image-input.conf can override them.

Files called image-input.conf are added to an input section called image, and builtin.conf enables it for images and disables it for non-images. Because enable-section and disable-section are only called in builtin.conf, they can be replaced with a different mechanism when deprecated input sections are removed without a breaking change.

Alternative to #15344, gives proper builtin support to image-input.conf instead of adding a new command to let user handle it. Input sections are only really useful for images, and it is fine to remove them if we support different image key bindings out of the box, and later disable them with a different mechanism, e.g. delete key bindings whose location contains image-input.conf. We already have many mechanisms to add key bindings anyway, input.conf, load-input-conf, mp.add_key_binding, the keybind command.

If this approach is considered good we can then actually decide the bindings and options.