The control program for the Installation player

Processing Java programming environment

I've continued the development of the program in the Processing environment because I believe the pros of doing so outweigh the cons.
Pros
  • It's cross-platform. The program works without alteration on Linux, MAC and Windows.
  • Development is very fast.
  • It's interesting to work in Java for a change.
  • It's well established, with a good support network.
Cons
  • The user interface, particularly the buttons, is a bit crude.
  • Processing has taken rather too much control of some classes, eg Client. This results in a surfeit of red in the Java console when abnormal things happen, but is not a serious problem.
  • It's not clear (to me) what the threading model is. This has been possible to work round, although the event driven model of Perl/Tk would make for a simpler program.
  • Some things seem unnecessarily complicated in Java. The lack of pointers to functions makes the button callback, and command processing mechanisms clumsy compared to their equivalents in C++ or Perl.
  • The Java console is shared by all the running sketches, which can be confusing if there's more than one.
  • The name is very unhelpful. Try Googling 'Processing'!
It wouldn't take long to convert the program to Perl/Tk if required.

Program details

Processing tabs and classes
  • installation tab
    The eponymous tab. Processing special functions setup() and draw(). Specification of the video player set. Specification of the installation state machines.
  • Vplayer_set tab
    Vplayer_set class. All the Vplayers synced together as one.
  • Vplayer tab
    Vplayer class. Everything about the video player which is not specific to VLC, XBMC or OMXPlayer. Parent class of VLC_player, XBMC_player and OMXPlayer.
  • VLC_player tab
    VLC_player class. Derived from Vplayer. All the code specific to VLC player.
  • XBMC_player tab
    XBMC_player class. Derived from Vplayer. All the code specific to XBMC player. Works in Linux and Raspberry Pi. Position reporting and control work well (as long as you choose the right version of Raspbmc!)
  • OMX_player tab
    OMX_player class. Derived from Vplayer. All the code specific to OMXPlayer with integral HTTP server.
  • buttons tab
    Classes for a (fairly crude) implementation of buttons in the Processing interface. DIY debouncing is done so the buttons can be processed at a defined point of the draw() loop without assuming anything about the threading structure of Processing. There is a callback mechanism to top-level functions to simplify coding.
  • commands tab
    Command and Command_buffer classes. These enable commands to be sent to the Vplayer_set with time gaps, but without blocking. The program contains no delay()s
  • gui tab
    Define buttons and their callbacks. The scrub bar gives a useful visual idea of movie and player times.
  • misc tab
    Command_buffer and Stop_clock classes, and the Vote server client.
Specify video players in set
This is done in a fairly obvious way in the installation tab. The first player in the set is the master, although this is less significant than formerly.
// Movie directory names
String mdn_linux = "/home/ncvp/winxp/video/installation_player/";
String mdn_rpi = "/home/pi/video/installation_player/";
String mdn_win = "/c:/video/installation_player/";
String mdn_mac = "/Users/show/video/";

void vplayer_init()
{
   vps = new Vplayer_set();
   
   vps.add(new VLC_player("192.168.1.37", "chill", mdn_linux));
   vps.add(new VLC_player("192.168.1.61", "mac1", mdn_mac));
   vps.add(new XBMC_player("192.168.1.36", "xps_xbmc", 8090, mdn_linux));
   vps.add(new XBMC_player("192.168.1.41", "nrbmc01", 80, mdn_rpi));
   ...
}
Specify an installation state machine
This is done with state string constants and code in the eponymous 'installation' tab. See here for details.