[vlc-devel] Playback controls and code duplication

Derk-Jan Hartman hartman at videolan.org
Wed Oct 8 23:43:55 CEST 2008


On 8 okt 2008, at 23:12, Kaarlo Räihä wrote:
> What is the proper way to control playback from inside VLC? I am  
> planning to add better multimedia keyboard support to Win32 builds  
> by catching WM_APPCOMMAND message and then controlling VLC from QT4  
> or Skins2 GUI. hotkey.c has some playback controls, but I don't  
> think it is a good thing to copy&paste code from there to both  
> modules.
>
> So there must be a better way to for example pause/play playback,  
> mute volume or jump to next item in the playlist. So how should I do  
> it?

In cases like these, where you KNOW what command you want with such a  
key, best is to trigger actions like this:

var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_PLAY_PAUSE );

This triggers code in hotkeys.c (key-action differs from key-pressed,  
in that it is agnostic of the key used, it only cares about the action  
that needs to be triggered)

DJ


More information about the vlc-devel mailing list