nurupo / vlc-pause-click-plugin

Plugin for VLC that pauses/plays video on mouse click
GNU Lesser General Public License v2.1
945 stars 64 forks source link

not working for audio #74

Closed Aphexus closed 4 years ago

Aphexus commented 4 years ago

Is there any way to get it to work with audio? Probably should be an easy fix as it would just have to enable the functionality for audio.

nurupo commented 4 years ago

Sorry, not possible because when playing audio-only files there is no video surface that would detect clicks.

Duplicate of #29.

Aphexus commented 4 years ago

Detecting clicks shouldn't be a problem. Surely you do not need a video surface to do that? Hell, if you have to, just add a mouse click handler using win32.

https://docs.microsoft.com/en-us/windows/win32/learnwin32/mouse-clicks

I mean, if they can't add such a feature then you'll have to hack it to make it work. Not your fault, theirs, but should still be able to have proper functionality.

https://docs.microsoft.com/en-us/windows/win32/winmsg/about-hooks https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644986(v=vs.85)

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowshookexa

Just a few lines of code:

  1. Set the mouse proc using SetWindowsHookExA and WH_MOUSE_LL
  2. Add mouse logic that maps it in to original code

Of course this might end up not working properly and you'll probably want to make sure the mouse coordinates are in the "video frame" of vlc before processing

nurupo commented 4 years ago

As far as I'm aware, a VLC plugin can detect mouse clicks only if it's a video filter plugin, which are not activated by VLC for audio-only files. If I'm missing something and it's actually possible to do so with VLC APIs alone, as a 3rd party plugin, i.e. without having to modify the 1st party plugins like Qt GUI plugin, then I'm all ears.

I'm not very interested in writing platform-specific code, nor can I test it well on Linux, aside from trying to run it under WINE. If you are willing to work on it, feel free to add the feature in a PR. I can't guarantee that I will merge it, but I will go over it for sure. If you do decide to work on it, make sure it works on the dev version of VLC (4.0) too, as they are re-writing the GUI for that version so your video frame detection code might need to be adjusted.