This is a "plugin" for the Video Disk Recorder (VDR).

Project's homepage:          https://github.com/FireFlyVDR/vdr-plugin-skinelchihd/wiki
Latest version available at: https://github.com/FireFlyVDR/vdr-plugin-skinelchihd

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
See the file COPYING for more information.


Description:
------------
This plugin for Klaus Schmidinger's Video Disc Recorder VDR adds the "Elchi HD"
skin. It is based on the Elchi skin with major refactoring to make use of newer
VDR features like True Color support.


Requirements:
-------------
- VDR 2.4.3+
     VDR 2.6.5+ requires at least SkinElchiHD 1.2.4 due to conflicting declaration
     For VDR 2.8.1+ SkinElchiHD 1.2.10+ is recommended due to a new menu category
- GraphicsMagick++ (recommended) or ImageMagick++ 7.x
- Channel logos in PNG format are supported by both libraries,
  for SVG format ImageMagick++ is required
- If Imagemagick++ shows an exception in syslog when loading image files then check/adapt
  the security settings of ImageMagick and/or use another path like /usr/share/vdr/...
  and do not use links


Features:
---------
- True Color Support
- shaded surface look
- SD, HD and UHD Support (OSD, Channel Logos, Video stream info)
- SVG channel logo support with ImageMagick++ (True Color, scaled to fit OSD resolution)
- EPG image support (True Color) for EPG and recordings
- displays type of recording in Recordings Menu (HD, UHD, PES)
- multithreaded scrolling and image loading
- if VDR is recording a REC symbols is displayed highlighted in red and white on the channel display and replay display
- if VDR is cutting or moving recordings a scissor symbols is displayed in the channel display and replay display

Installation
------------
The skinElchiHD plugin is compiled and installed the same way as any other plugin:
- cd <VDR>/PLUGINS/src
- tar xf vdr-skinelchihd-<version>.tar.bz2
- ln -s skinelchihd-<version> skinelchihd
- cd ../..
- make plugins  [IMAGELIB=imagemagick]

Append "IMAGELIB=graphicsmagick" or "IMAGELIB=imagemagick" to the make command to build with the respective library.
Beginning with SkinElchiHD 1.2.10 the default (e.g. without parameter) is graphicsmagick

Copy the provided 50-skinelchihd.conf file to your VDR args dir (e.g. /etc/vdr/conf.d)
and adapt it if required or use the parameters on the VDR commandline.

Copy the theme files in the archives's themes subdirectory to the VDR theme directory
  <configdir>/themes 


Usage:
------
Channel logos:
For displaying channel logos skinElchiHD requires PNG or SVG logo files. SkinElchiHD
does not provide logo files but there are several sets floating around in the
internet. The logos should have no background (= transparent) as it is added by
skinElchiHD.

The path to the logo files can be set with a command line parameter: 

  -l <LogoPath>,  --logopath=<LogoPath>     path to PNG and SVG channel logos
                                            (default: <ResourceDir>/plugins/skinelchihd/logos)
For displaying SVG channel logos ImagMagick++ is required.

Images of EPG and recordings: 
SkinElchiHD can display EPG images in jpg/jpeg/png/webp format for both EPG events and recordings.
The path to EPG images can be set with:
  -e <EPGImageDir>, --epgimages=<ImageDir>  path to EPG images
                                            (default: <CacheDir>/plugins/skinelchihd/epgimages)

For the EPG the images need to follow the format "<SOURCE>_<EPGID>_<No>.jpg"
where <SOURCE> is the DVB source (e.g. S19.2E-1-1019-10301), <EPGID> the ID
of the EPG event and <No> is a number starting with 0 and up to 9.
For compatibility with older EPG plugins the "_0" for the first image can be omitted.
The images are shown automatically one after another and the time until switching to the next
can be set in the plugins setup menu.

For recording images they have to reside in the folder of the recording and
need to end with one of jpg/jpeg/png/webp.


Setup Options:
--------------
The following settings are available in the Setup -> Plugins -> skinElchiHD setup menu:

General:
- scroll text:                         yes / no
  enable / disable scrolling of text

- Show timer and conflict in menu:     no / next recording / Timer-Conflict / all
  displays selected info in menus below header line 

- use graphical progressbar:           yes/no
  converts ascii symbols [||||  ] to a graphical progress bar

- show remote timers in EPG:           yes/no
  in addition to local timers show remote timers in EPG


Recordings:
- Show warning symbol if recording has errors:   none / only uncut recordings / all recordings
  shows an exclamation sign in front of recordings if it has errors
  (available for VDR 2.5.6+)

  - Show warning only if recording errors are more than: 0 - 10
    disable warning symbol for less errors than selected number

- show logo if recording is HD/UHD:    yes / no
  shows a HD or UHD logo in front of recordings if it's detected as HD or UHD
  format. However, for older recordings without regenerated index the format is often
  a best guess (e.g. for DVB-T2), so disable it in case of wrong detection.
  For SD recordings in the old PES format a 'PES' symbol is displayed.


Recordings & EPG:
- EPG picture size:                    don't show / small / medium / large / extra large / huge
  select size of images in EPG and recordings menu

  - duration of each EPG image [s]:    1 - 15
    select the time until the next images is displayed

  - search for EPG images with:        channel ID + event ID / event ID only
    recommended is "channel ID + event ID" because "event ID only" might pick
    wrong pictures when the event ID appears on several channels

  - EPG picture frame:                 none / Frame / Shadow / raised / Polaroid-like
    select different frames for the EPG images

- Show recording details:              EPG / EPG + details  / EPG + Details + Genre + Parental Rating
  select detail range of recordings

- Show EPG details:                    EPG / EPG + details  / EPG + Details + Genre + Parental Rating
  select detail range of EPG events

- Show video format info (if available): none / format / size and format
  shows format and size of current displayed stream in channel and replay menus


Channel Display:
- show channel logos:                  no / normal size / large size
  choose if channel logos should be displayed and which size

  - channel logo search sequence       SVG, PNG / PNG, SVG
    search the logo files first with extension SVG or PNG
    This option is only available when compiled with ImageMagick++

 - write logo messages to syslog:      yes / no
    write a message (found / not found) for each requested channel logo in the syslog
    this can be helpful to find missing logos or to verify the logopath

- show signal bars:                    yes / no
  choose if signal bars should be displayed
  (upper bar: signal strength, lower bar: signal qualitiy)

- show audio info:                     yes / no
  select if info about available audio sreams is displayed

- show recording info:                 no / only when recording / always
  this displays an additional line with the DVB device number and
  name and infos about ongoing recurdings
     no:                   the additional line is never displayed
     only when recording:  the additional line is displayed only during recording
     always:               the additional line is always shown even if it's empty

- show remote timers                   yes / no
  show a timer symbol in front of events if there's a remote timer, otherwise
  a symbol is only shown for local timers



Tips & Hints:
-------------
- use a script like yaVDR's R60copy_epgimage with VDR's '--record' parameter to copy
  the EPG images (downloaded by an EPG plugin) automatically into the recording's folder
- to convert SVG channel logs to png (including the links) call the following script
  in the channel logo folder (requires the 'convert' program from ImageMagick):

!/bin/bash
#
# convert all SVG files and links in the current directory to png

OLDIFS=$IFS
IFS=$'\n'

for svgfile in $(find . -iname "*.svg" -type f);
do
   pngfile=${svgfile%%.svg}.png
   if [ ! -e "$pngfile" ]; then
      echo "converting $svgfile -> $pngfile"
      convert -background none "$svgfile" "$pngfile"
   fi
done

for lnk in $(find . -lname "*.svg" );
do
   source="$(basename -s "svg" $lnk)png"
   target=$(realpath --relative-to=. "$lnk")
   target="${target%%.svg}.png"
   if [ ! -e "$source" ]; then
      echo "symlinking $source -> $target"
      ln -s "${target}" "${source}"
   fi
done
IFS=$OLDIFS


==================================================================================
NOTES:
------
struct tArea {  // Start- and End-POINT (== Size-1 )
  int x1, y1, x2, y2;
  int bpp;
  int Width(void) const { return x2 - x1 + 1; }
  int Height(void) const { return y2 - y1 + 1; }
  bool Intersects(const tArea &Area) const { return !(x2 < Area.x1 || x1 > Area.x2 || y2 < Area.y1 || y1 > Area.y2); }
  };


class cRect {   // Start-Point and Size (not End-Point)
private:
  cPoint point;
  cSize size;
public:
  cRect(void): point(0, 0), size(0, 0) {}
  cRect(int X, int Y, int Width, int Height): point(X, Y), size(Width, Height) {}


x0 = 0
x1 = lh
x2 = x1 + lh
x9 = OSDwith - 1

x1 - x0 = lh
=> xa - xb = width
xa, xb = pos relativ zu 0

x2 - x1 = lh   == width

x1 + lh = ?????


    x2 - x1 = lh
==>      x2 = x1 + lh       xN + width = pos

0              50                100
x1             x2                 x3
x3 - x2 = 50 == width

X:
 - geht von bis OSDwidth - 1
        also von 0 bis 1919
 - width = xMax + 1

x9 - x0 =

 x4 - h = xa
     x4 = xa + h
x4 - xa = h

