Media PLayer Functions
Author: Andreas Vogel (andvogel@online.de)
Version: 2008/03/20
New 2008/03/20:
  support for video (still not included in playAll)
  server side scripting interface (include converter scripts)
New 2008/01/02:
Audio and pictures in parallel (YELLOW key)
Jpeg EXIF Orientation
     more flexible scaling
     faster loading
     Colour Tuner
Media Options
details below

Basics:
Adding some media player functions to VOMP.
This should enable VOMP to:
  - work as a picture viewer (for digicam pictures)
  - play audio (at least mp3)
  - play (mpeg) video
It requires some extensions on the server side (of course).
Version 2008/03/20
play video
  plays "well formatted" mpeg2 videos (extension .mpg, .MPG)
  moving (skip fw,bw, to %) works basing on estimated values
  no ffw, fbw
  currently video is not included in the "playAll"
server side conversions
  on the server side there is an option to include commands that
  convert media on the fly
  You will loose navigation on the client in this case (i.e. no fw,bw, jump)
CVS Version (delivered 2008/01/02):
parallel audio and picture
  use YELLOW key for audio player in background / toggle audioplayer
  hierarchical mediaprovider structure
  version handling at client-server interface
  enable local mediaprovider (simply reading below /media)
  have separate names for base directories (beside filenames) in config file
  include standalone target into the makefile
  
CVS Version (delivered 2007/07/15):
Media Selection
  browse through media directories
  select single Media (OK)
  select all Media from directory (PLAY)
  change sort order (BLUE) - name, time, random
Basic picture viewer functions:
  show jpeg picture
  auto scale them by 1/1, 1/2, 1/4, 1/8
  rotate pictures
  slide show
Audio player functions
  play mp3 audio
  position by 10%...90%
  show Id3 info
  handle vbr

Configuration
  You can add a list of directories to vomp.conf that will be used as base dirs to
  find media files.
  For each directory you can define a separate name that is displayed.
  Example:
  [Media]
  Dir.1=/home/Andreas/pictestA
  Dir.Name.1=Picture-test
  Dir.2=/home/video
  Dir.3=/home/bilder
  Dir.4=/media

  You can have up to 50 directories there.
  The recognition of media types is based on extensions today. In the moment it recognizes:
	JPEG,jpeg,JPG,jpg as Jpeg
	mp3,MP3           as mp3 
        mpg,MPG           as Mpeg2 video
  Additionally you can define commands that handle other types of media.
  Example:
     Command.Name.1=/home/Andreas/src/vompserver-devenv/test1.sh
     Command.Extension.1=avi
     Command.Type.1=VIDEO
  The allowed values for Type are 
    VIDEO - mpeg2
    AUDIO - mp3
    PICTURE - jpeg
  The commands will be called with the following options:
  check
    at startup to check the command being available, has to return 0
  play "filename" xsize ysize
    must send the media stream to stdout
  The command will be stopped with SIGINT. If this is not successfull, a SIGKILL will follow.
  An example command file is included (test1.sh).
  You can define up to 50 commands (1...50).

  In the vomp main menu a new item is added (5 MediaPlayer).
  This will open a menu with the configured base dirs (/ if none configured).
  Additionally this menu will show the media under the client!!! /media directory.

Usage and Keys
	
SELECTOR WINDOW
	You can traverse through the dirs with the normal keys.
	When pointing to a media file you can activate the viewer/player with
	[OK] (normal view) or [PLAY] (slide show/play all files from this directory).
	[BLUE] will toggle the serach order (name->time->random), the status line will display
	the NEXT sort order that you get with [BLUE].
  If the audio player is running you can bring it to front (and back) with the YELLOW key.

PICTURE VIEWER
	When viewing a picture, this gets loaded from the server (currently still a little bit slow), 
  Currently the scaling depends on the jpeg lib. You can have a scaling within the lib by 1/2,
  1/4 and 1/8. Additionally you can have an "after scaling" form 1/1...1/5. This anyway slows down.
  You can select the after scaling in the options (default 1 - no after scaling).
  There is an alternative Jpeg Lib available (see links) - with this lib you can better scale.
  Still to be discussed...
  You can select 3 different modes for the picture - "letter" - always completely on screen, 
  "crop" always cropped by next possible scale and "croppercent" - you can select the Picture Size
  within the option page from 10%...150% - the picture gets scaled to best fit to the screen within
  this range.
  To adapt the colours to you screen there is a colourTuner. You can set factors for R/G/B either
  in the media options or by pressing the [MENU] key in the pictureViewer. The current picture 
  will not be rendered again when leaving the colour tuner! So changes only wil become effective
  for the next picture.
  Keys in the Picture Viewer:
	With [OK] you can toggle the status line, With [RED] you can rotate the picture clockwise,
	[GREEN] brings up an info box with some picture data. [PLAY] starts the slideshow, |<- and ->| as
	well as [UP], [DOWN] travers trough all pictures within the directory.
	[PAUSE] will pause the slide show and resume it.
	<< and >> will slower/fasten the slide show (time getting displayed in the status line). II will
	pause the slide show [STOP] will pause and reset time to 5s.
  [BLUE] rotates through the clipping options (can be seen in the info display).
  The viewer now handles Exif rotation information if available and rotates the picture accordingly.
  If the audio player is running you can bring it to front (and back) with the YELLOW key.

AUDIO PLAYER
	The audioplayer will play mp3 files and has a similar status display like the recordings player.
	You can pause with [PAUSE], continue with [PLAY].
	[STOP] halts and rewinds to the beginning.
	[1]...[9] will postion to 10%...90% of the length.
	|<- and ->| will skip each 10s back/ forward.
	[GREEN] toggles the display of an info window with ID3 info.
	[OK] toggles the status display.
	[UP] and [DOWN] will change to the next song when the player was activated with [PLAY].
        The player window will disappear app. 30s after the last key press.
  [YELLOW] will put the audioplayer into "background". It will continue playing it's current list while
  you are able to continue browsing the media files and e.g. start a slideshow.
  Typical seqeunce (in the moment):
    Got to a directory containing audio files, select a file, press [PLAY]. The audioplayer comes up
    and starts playing. Press [YELLOW] (selector comes up) and go to a picture directory. Select a picture
    file and press [PLAY] - the picture viewer starts a slideshow. At any time you can toggle with the
    [YELLOW] key to the audioplayer and use [UP]/[DOWN] to change the played song. 
	The players parses ID3V1,V2.2,V2.3 (thanks to Walt for the supported code) and displays selected info.
	It also parses VBR headers ("Xing") and uses this info for display and movements.
	If  the player cannot parse the files, it tries to play them anyway, it will (for the display) assume 
	128kBit/s CBR.
	Currently the player uses the same media stream like the picture viewer -so no parallel viewing and
	listening is possible (will be changed soon).
VIDEO PLAYER
   all normal keys as for recordings player
   RED - media info
   GREEN audio selector

Translations
English and German are there...

Standalone Server
	With make make standalone in the vompserver you can create a standalone
	vompserver-standalone that does not need vdr to compile or to run. This enables running it on
	an arbitrary linux box without any VDR. It expects config files in the current directory. Client side
	is still very simple - all vdr command will lead to connection lost.


Implementation aspects:
  For easy handling there is now a couple of files (data holders) that is used both on the client and server side.
  Currently those are: vdrcommand.h serialize.* media.* mediaprovider.h mediaplayer.* mediafile.*
  With the script copyClientFiles.sh you can replace the files in the server dir by symlinks to the
  client files. This way they can easily be changed during development.
  With serialize.* and vdrcommands.h I created some infrastructure for interface compatibility handling.
  At least for the mediaplayer this will be used, maybe we can extend this to the other commands too (will
  be discussed at the forum).
  Now I created a hierarchical mediaprovider structure.
  Both on the client and server side you can add mediaproviders that implement the MediaProvider interface.
  Currently we have:
  client side:
  LocalMediaFile - providing files below the /media directory
  VDR - forwarding everything to the server
  server side:
  ServerMediaFile - provding the well known functions on the server
  New providers can be easily added, they must be initialized and registered.
  Client: Ctor of VMedialist (only register them once!)
  Server: Ctor of MVPclient
  
