You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I should be able to load a mixed content playlist and have zoom/pan functionality when viewing images but not when viewing video: mpv image.png video.mp4
The 'obvious' way of implementing this doesn't work:
[extension.jpg]
input-conf=~~/input-image.conf
I opened an issue with mpv about this a while ago but haven't heard anything, so I went looking for a work-around.
Work Around
Using add_hook("on_load"...) I can run a function that checks the "stream-open-filename" property to see if it's file extension is an image extension or not. Then I can either add or remove key bindings for image-viewer functions on the fly. When switching between files in the playlist, mpv will switch between video and image mode seamlessly.
Test (with nothing special in mpv.conf) using something to the effect of: mpv image.png video.mp4
(This proof of concept only creates/removes bindings for drag_to_pan_handler and cursor_centric_zoom_handler (because those are the ones I personally use) but I think it should work in general. Also my proof of concept has keybindings hardcoded, it doesn't read them from any input.conf. I'm not sure if there is a way around this.)
The text was updated successfully, but these errors were encountered:
I just noticed that there is a concept of "input sections" in mpv. Bindings defined in input.conf can be added to a "section" and sections can be enabled/disabled at runtime. I think that would be a satisfying solution
Problem
I should be able to load a mixed content playlist and have zoom/pan functionality when viewing images but not when viewing video:
mpv image.png video.mp4
The 'obvious' way of implementing this doesn't work:
I opened an issue with mpv about this a while ago but haven't heard anything, so I went looking for a work-around.
Work Around
Using
add_hook("on_load"...)
I can run a function that checks the "stream-open-filename" property to see if it's file extension is an image extension or not. Then I can either add or remove key bindings for image-viewer functions on the fly. When switching between files in the playlist, mpv will switch between video and image mode seamlessly.Here is my proof of concept for this: jgreco@f6234b2
Test (with nothing special in mpv.conf) using something to the effect of:
mpv image.png video.mp4
(This proof of concept only creates/removes bindings for
drag_to_pan_handler
andcursor_centric_zoom_handler
(because those are the ones I personally use) but I think it should work in general. Also my proof of concept has keybindings hardcoded, it doesn't read them from any input.conf. I'm not sure if there is a way around this.)The text was updated successfully, but these errors were encountered: