diff -ruNbw vdr-1.2.2/CONTRIBUTORS vdr-1.2.4/CONTRIBUTORS
--- vdr-1.2.2/CONTRIBUTORS	Sat Aug  2 16:32:53 2003
+++ vdr-1.2.4/CONTRIBUTORS	Sun Aug 24 16:47:34 2003
@@ -315,6 +315,10 @@
  for suggesting a confirmation prompt when the user presses the "Power" button
  and there is an upcoming timer event
  for reporting a bug in skipping the next hit of a repeating timer
+ for reporting a problem with staying off the end of an ongoing recording while
+ replaying in time shift mode
+ for suggesting that VDR should stop if one of the configuration files can't be
+ read correctly at program startup
 
 Oleg Assovski <assen@bitcom.msk.ru>
  for adding EPG scanning for another 4 days
@@ -328,6 +332,9 @@
 Mirko Günther <mi.guenther@ib-helms.de>
  for suggesting the -m command line option
  for suggesting the SVDRP command VOLU
+ for reporting a bug in keeping track of the current channel number when moving
+ channels in the "Channels" menu
+ for reporting a bug in toggling channels with the '0' key
 
 Achim Lange <Achim_Lange@t-online.de>
  for replacing 'killproc' with 'killall' in 'runvdr' to make it work on Debian
@@ -450,6 +457,7 @@
 
 Helmut Auer <vdr@helmutauer.de>
  for reporting a superfluous error message in cLockFile
+ for suggesting to make the "Zap timeout" a setup variable
 
 Jeremy Hall <jhall@UU.NET>
  for fixing an incomplete initialization of the filter parameters in eit.c
@@ -550,6 +558,8 @@
 
 Andreas Kool <akool@akool.de>
  for his help in keeping 'channels.conf.cable' up to date
+ for fixing the TS to PES repacker so that it works with MPEG1 streams
+ for reporting a problem with empty values in setup.conf
 
 Guy Roussin <guy.roussin@teledetection.fr>
  for suggesting not to display channel group delimiters without text
@@ -612,6 +622,7 @@
  for fixing a possible deadlock when using the "Blue" button in the "Schedules" menu
  to switch to an other channel
  for reporting a wrong EPG bugfix code number for the MAX_USEFUL_SUBTITLE_LENGTH fix
+ for fixing a bug in resetting OSD color palettes
 
 Steffen Becker <stbecker@rbg.informatik.tu-darmstadt.de>
  for reporting a problem with CPU load peaks (in the EPG scanner)
@@ -637,6 +648,7 @@
  for fixing handling repeat function with LIRC
  for reporting a problem with the LIRC remote control trying to learn keys even if it
  couldn't connect to the LIRC daemon
+ for making the plugin library directory configurable via Make.config
 
 Thomas Koch <tom@harhar.net>
  for his support in keeping the Premiere World channels up to date in 'channels.conf'
@@ -689,6 +701,7 @@
 Alfred Zastrow <vdr@zastrow4u.de>
  for suggesting to implement separate PausePriority and PauseLifetime parameters for
  the recordings created when pausing live video
+ for reporting two warnings when compiling with gcc 3.3.1
 
 Matthias Raus <matthias-raus@web.de>
  for reporting a problem with starting the editing process if no marks have been set
@@ -737,6 +750,7 @@
  that a channel only qualifies as "previous" if it has been selected for at least
  3 seconds
  for reporting a bug in handling the color buttons in the "Edit channel" menu
+ for adding a note about the config files of plugins to INSTALL
 
 Kenneth Aafløy <ke-aa@frisurf.no>
  for fixing checking CA capabilities with the dvb-kernel driver
@@ -744,3 +758,19 @@
 Ernst Fürst <ernstfuerst@swissonline.ch>
  for reporting a crash in case a VFAT file system is used without compiling VDR
  with VFAT=1
+
+Reinhard Nissl <rnissl@gmx.de>
+ for reporting a name clash because of function crc32() in libdtv/libsi/si_parser.c
+ when using other libraries that also implement a function by that name
+
+Richard Robson <richard_robson@beeb.net>
+ for reporting freezing replay if a timer starts while in Transfer Mode from the
+ device used by the timer, and the timer needs a different transponder
+
+Manfred Schmidt-Voigt <manfred.schmidt-voigt@mannitec.de>
+ for reporting a problem with runnign out of disk space while cutting in case
+ there are still deleted recordings to remove
+
+Javier Marcet <lists@marcet.info>
+ for reporting a problem when starting a recording on the primary device if there
+ is a replay session active
diff -ruNbw vdr-1.2.2/HISTORY vdr-1.2.4/HISTORY
--- vdr-1.2.2/HISTORY	Sun Aug  3 11:54:18 2003
+++ vdr-1.2.4/HISTORY	Sun Aug 24 16:49:53 2003
@@ -2282,3 +2282,50 @@
 - Now the program uses the values of VIDEODIR and PLUGINDIR defined in Makefile
   or Makefile.config as defaults (thanks to Steffen Barszus).
 - Added the usual menu timeout to the CAM menus.
+
+2003-08-17: Version 1.2.3 (not officially released)
+
+- Fixed the TS to PES repacker so that it works with MPEG1 streams (thanks to
+  Andreas Kool).
+- Fixed keeping track of the current channel number when moving channels in
+  the "Channels" menu (thanks to Mirko Günther for reporting this one).
+- Made the plugin library directory configurable via Make.config (thanks to
+  Ludwig Nussel).
+- Fixed scaling SPU bitmaps in Letterbox mode when playing NTSC material.
+  In order to do this, the cDevice was given a new member function GetVideoSystem().
+- Fixed two warnings when compiling with gcc 3.3.1 (thanks to Alfred Zastrow for
+  reporting this).
+- Made crc32() a static function in libdtv/libsi/si_parser.c to avoid a name clash
+  when using other libraries that also implement a function by that name (thanks
+  to Reinhard Nissl for reporting this one).
+- Fixed staying off the end of an ongoing recording while replaying in time shift
+  mode (thanks to Rainer Zocholl for reporting this one).
+- VDR now stops with exit status 2 if one of the configuration files can't be
+  read correctly at program startup (suggested by Rainer Zocholl).
+- Fixed a crash when starting "Pause live video" twice within the same minute on
+  the same channel.
+- Fixed freezing replay if a timer starts while in Transfer Mode from the device
+  used by the timer, and the timer needs a different transponder (thanks to
+  Richard Robson for reporting this one).
+- Fixed toggling channels with the '0' key (thanks to Mirko Günther for reporting
+  this one).
+- Made the "Zap timeout" (the time until a channel counts as "previous" for
+  switching with '0') a setup variable, available in "Setup/Miscellaneous"
+  (suggested by Helmut Auer).
+- Removing deleted recordings faster than normal when cutting, to avoid running
+  out of disk space (thanks to Manfred Schmidt-Voigt for reporting this one).
+
+2003-08-24: Version 1.2.4
+
+- Fixed 'runvdr' to stay in the loop only if VDR returns an exit status of '1'.
+- Completed the Finnish OSD texts (thanks to Rolf Ahrenberg).
+- Empty values in setup.conf are no longer treated as an error (thanks to Andreas
+  Kool for reporting this one).
+- Added a note about the config files of plugins to INSTALL (thanks to Thomas
+  Keil).
+- VDR now continues to start up, even if there is an error in setup.conf.
+- Fixed a bug in resetting OSD color palettes (thanks to Torsten Herz).
+- Fixed starting a recording on the primary device if there is a replay session
+  active (thanks to Javier Marcet for reporting this one).
+- Avoiding an unnecessary stop of an ongoing Transfer Mode when starting a
+  recording on the primary device.
diff -ruNbw vdr-1.2.2/INSTALL vdr-1.2.4/INSTALL
--- vdr-1.2.2/INSTALL	Sat May 31 18:20:59 2003
+++ vdr-1.2.4/INSTALL	Sun Aug 24 13:08:27 2003
@@ -302,8 +302,11 @@
 There are several configuration files that hold information about
 channels, remote control keys, timers etc. By default these files are
 assumed to be located in the video directory, but a different directory
-can be used with the '-c' option. For starters just copy all *.conf files from
-the VDR directory into your video directory.
+can be used with the '-c' option. Plugins assume their configuration files
+in a subdirectory called "plugins" of this directory.
+
+For starters just copy all *.conf files from the VDR directory into your
+video directory.
 
 The configuration files can be edited with any text editor, or will be written
 by the 'vdr' program if any changes are made inside the on-screen menus.
diff -ruNbw vdr-1.2.2/MANUAL vdr-1.2.4/MANUAL
--- vdr-1.2.2/MANUAL	Sun Jun 15 16:35:38 2003
+++ vdr-1.2.4/MANUAL	Sun Aug 17 10:51:23 2003
@@ -635,6 +635,9 @@
                          connection after which the connection is automatically
                          closed. Default is 300, a value of 0 means no timeout.
 
+  Zap Timeout = 3        The time (in seconds) until a channel counts as "previous"
+                         for switching with '0'
+
 * Executing system commands
 
   The "VDR" menu option "Commands" allows you to execute any system commands
diff -ruNbw vdr-1.2.2/Make.config.template vdr-1.2.4/Make.config.template
--- vdr-1.2.2/Make.config.template	Sat Aug  2 16:25:53 2003
+++ vdr-1.2.4/Make.config.template	Sat Aug  9 13:03:25 2003
@@ -6,7 +6,7 @@
 # See the main source file 'vdr.c' for copyright information and
 # how to reach the author.
 #
-# $Id: Make.config.template 1.2 2003/08/02 14:25:53 kls Exp $
+# $Id: Make.config.template 1.3 2003/08/09 11:03:25 kls Exp $
 
 ### The C compiler and options:
 
@@ -23,4 +23,5 @@
 BINDIR   = /usr/local/bin
 
 PLUGINDIR= ./PLUGINS
+PLUGINLIBDIR= $(PLUGINDIR)/lib
 VIDEODIR = /video
diff -ruNbw vdr-1.2.2/Makefile vdr-1.2.4/Makefile
--- vdr-1.2.2/Makefile	Sat Aug  2 16:27:21 2003
+++ vdr-1.2.4/Makefile	Sat Aug  9 13:09:45 2003
@@ -4,7 +4,7 @@
 # See the main source file 'vdr.c' for copyright information and
 # how to reach the author.
 #
-# $Id: Makefile 1.57 2003/08/02 14:27:21 kls Exp $
+# $Id: Makefile 1.58 2003/08/09 11:09:45 kls Exp $
 
 .DELETE_ON_ERROR:
 
@@ -20,6 +20,7 @@
 BINDIR   = /usr/local/bin
 
 PLUGINDIR= ./PLUGINS
+PLUGINLIBDIR= $(PLUGINDIR)/lib
 
 VIDEODIR = /video
 
@@ -50,7 +51,7 @@
 DEFINES += -D_GNU_SOURCE
 
 DEFINES += -DVIDEODIR=\"$(VIDEODIR)\"
-DEFINES += -DPLUGINDIR=\"$(PLUGINDIR)/lib\"
+DEFINES += -DPLUGINDIR=\"$(PLUGINLIBDIR)\"
 
 ifdef DEBUG_OSD
 DEFINES += -DDEBUG_OSD
@@ -115,7 +116,7 @@
 
 plugins-clean:
 	@for i in `ls $(PLUGINDIR)/src | grep -v '[^a-z0-9]'`; do $(MAKE) -C "$(PLUGINDIR)/src/$$i" clean; done
-	@-rm -f $(PLUGINDIR)/lib/*
+	@-rm -f $(PLUGINLIBDIR)/*
 
 # Install the files:
 
diff -ruNbw vdr-1.2.2/channels.c vdr-1.2.4/channels.c
--- vdr-1.2.2/channels.c	Sat Apr 26 11:57:48 2003
+++ vdr-1.2.4/channels.c	Sat Aug 16 11:12:26 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: channels.c 1.12 2003/04/26 09:57:48 kls Exp $
+ * $Id: channels.c 1.13 2003/08/16 09:12:26 kls Exp $
  */
 
 #include "channels.h"
@@ -390,9 +390,9 @@
 
 cChannels Channels;
 
-bool cChannels::Load(const char *FileName, bool AllowComments)
+bool cChannels::Load(const char *FileName, bool AllowComments, bool MustExist)
 {
-  if (cConfig<cChannel>::Load(FileName, AllowComments)) {
+  if (cConfig<cChannel>::Load(FileName, AllowComments, MustExist)) {
      ReNumber();
      return true;
      }
diff -ruNbw vdr-1.2.2/channels.h vdr-1.2.4/channels.h
--- vdr-1.2.2/channels.h	Sat Apr 26 11:15:40 2003
+++ vdr-1.2.4/channels.h	Sat Aug 16 11:12:15 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: channels.h 1.7 2003/04/26 09:15:40 kls Exp $
+ * $Id: channels.h 1.8 2003/08/16 09:12:15 kls Exp $
  */
 
 #ifndef __CHANNELS_H
@@ -130,7 +130,7 @@
   int maxNumber;
 public:
   cChannels(void) { maxNumber = 0; }
-  virtual bool Load(const char *FileName, bool AllowComments = false);
+  virtual bool Load(const char *FileName, bool AllowComments = false, bool MustExist = false);
   int GetNextGroup(int Idx);   // Get next channel group
   int GetPrevGroup(int Idx);   // Get previous channel group
   int GetNextNormal(int Idx);  // Get next normal channel (not group)
diff -ruNbw vdr-1.2.2/config.c vdr-1.2.4/config.c
--- vdr-1.2.2/config.c	Sun May 11 15:50:02 2003
+++ vdr-1.2.4/config.c	Sun Aug 24 13:00:24 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: config.c 1.114 2003/05/11 13:50:02 kls Exp $
+ * $Id: config.c 1.116 2003/08/24 11:00:24 kls Exp $
  */
 
 #include "config.h"
@@ -215,7 +215,7 @@
      *p = 0;
      char *Name  = compactspace(s);
      char *Value = compactspace(p + 1);
-     if (*Name && *Value) {
+     if (*Name) { // value may be an empty string
         p = strchr(Name, '.');
         if (p) {
            *p = 0;
@@ -262,6 +262,7 @@
   EPGScanTimeout = 5;
   EPGBugfixLevel = 2;
   SVDRPTimeout = 300;
+  ZapTimeout = 3;
   SortTimers = 1;
   PrimaryLimit = 0;
   DefaultPriority = 50;
@@ -413,6 +414,7 @@
   else if (!strcasecmp(Name, "EPGScanTimeout"))      EPGScanTimeout     = atoi(Value);
   else if (!strcasecmp(Name, "EPGBugfixLevel"))      EPGBugfixLevel     = atoi(Value);
   else if (!strcasecmp(Name, "SVDRPTimeout"))        SVDRPTimeout       = atoi(Value);
+  else if (!strcasecmp(Name, "ZapTimeout"))          ZapTimeout         = atoi(Value);
   else if (!strcasecmp(Name, "SortTimers"))          SortTimers         = atoi(Value);
   else if (!strcasecmp(Name, "PrimaryLimit"))        PrimaryLimit       = atoi(Value);
   else if (!strcasecmp(Name, "DefaultPriority"))     DefaultPriority    = atoi(Value);
@@ -462,6 +464,7 @@
   Store("EPGScanTimeout",     EPGScanTimeout);
   Store("EPGBugfixLevel",     EPGBugfixLevel);
   Store("SVDRPTimeout",       SVDRPTimeout);
+  Store("ZapTimeout",         ZapTimeout);
   Store("SortTimers",         SortTimers);
   Store("PrimaryLimit",       PrimaryLimit);
   Store("DefaultPriority",    DefaultPriority);
diff -ruNbw vdr-1.2.2/config.h vdr-1.2.4/config.h
--- vdr-1.2.2/config.h	Thu Jun 12 22:37:14 2003
+++ vdr-1.2.4/config.h	Sun Aug 24 12:52:20 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: config.h 1.165 2003/06/12 20:37:14 kls Exp $
+ * $Id: config.h 1.169 2003/08/24 10:52:20 kls Exp $
  */
 
 #ifndef __CONFIG_H
@@ -19,8 +19,8 @@
 #include "device.h"
 #include "tools.h"
 
-#define VDRVERSION  "1.2.2"
-#define VDRVERSNUM   10202  // Version * 10000 + Major * 100 + Minor
+#define VDRVERSION  "1.2.4"
+#define VDRVERSNUM   10204  // Version * 10000 + Major * 100 + Minor
 
 #define MAXPRIORITY 99
 #define MAXLIFETIME 99
@@ -87,7 +87,7 @@
   cConfig(void) { fileName = NULL; }
   virtual ~cConfig() { free(fileName); }
   const char *FileName(void) { return fileName; }
-  bool Load(const char *FileName = NULL, bool AllowComments = false)
+  bool Load(const char *FileName = NULL, bool AllowComments = false, bool MustExist = false)
   {
     Clear();
     if (FileName) {
@@ -95,7 +95,7 @@
        fileName = strdup(FileName);
        allowComments = AllowComments;
        }
-    bool result = false;
+    bool result = !MustExist;
     if (fileName && access(fileName, F_OK) == 0) {
        isyslog("loading %s", fileName);
        FILE *f = fopen(fileName, "r");
@@ -125,9 +125,13 @@
                 }
           fclose(f);
           }
-       else
+       else {
           LOG_ERROR_STR(fileName);
+          result = false;
+          }
        }
+    if (!result)
+       fprintf(stderr, "vdr: error while reading '%s'\n", fileName);
     return result;
   }
   bool Save(void)
@@ -215,6 +219,7 @@
   int EPGScanTimeout;
   int EPGBugfixLevel;
   int SVDRPTimeout;
+  int ZapTimeout;
   int SortTimers;
   int PrimaryLimit;
   int DefaultPriority, DefaultLifetime;
diff -ruNbw vdr-1.2.2/cutter.c vdr-1.2.4/cutter.c
--- vdr-1.2.2/cutter.c	Sat May 24 13:59:33 2003
+++ vdr-1.2.4/cutter.c	Sun Aug 17 11:04:04 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: cutter.c 1.4 2003/05/24 11:59:33 kls Exp $
+ * $Id: cutter.c 1.5 2003/08/17 09:04:04 kls Exp $
  */
 
 #include "cutter.h"
@@ -86,7 +86,7 @@
 
            // Make sure there is enough disk space:
 
-           AssertFreeDiskSpace();
+           AssertFreeDiskSpace(-1);
 
            // Read one frame:
 
diff -ruNbw vdr-1.2.2/device.c vdr-1.2.4/device.c
--- vdr-1.2.2/device.c	Sat Aug  2 13:44:28 2003
+++ vdr-1.2.4/device.c	Fri Aug 15 14:34:36 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: device.c 1.46 2003/08/02 11:44:28 kls Exp $
+ * $Id: device.c 1.47 2003/08/15 12:34:36 kls Exp $
  */
 
 #include "device.h"
@@ -214,6 +214,11 @@
 
 void cDevice::SetVideoFormat(bool VideoFormat16_9)
 {
+}
+
+eVideoSystem cDevice::GetVideoSystem(void)
+{
+  return vsPAL;
 }
 
 //#define PRINTPIDS(s) { char b[500]; char *q = b; q += sprintf(q, "%d %s ", CardIndex(), s); for (int i = 0; i < MAXPIDHANDLES; i++) q += sprintf(q, " %s%4d %d", i == ptOther ? "* " : "", pidHandles[i].pid, pidHandles[i].used); dsyslog(b); }
diff -ruNbw vdr-1.2.2/device.h vdr-1.2.4/device.h
--- vdr-1.2.2/device.h	Sun May 11 10:50:04 2003
+++ vdr-1.2.4/device.h	Fri Aug 15 15:05:50 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: device.h 1.33 2003/05/11 08:50:04 kls Exp $
+ * $Id: device.h 1.34 2003/08/15 13:05:50 kls Exp $
  */
 
 #ifndef __DEVICE_H
@@ -45,6 +45,10 @@
                  // KNOWN TO YOUR PLAYER.
                };
 
+enum eVideoSystem { vsPAL,
+                    vsNTSC
+                  };
+
 class cOsdBase;
 class cChannel;
 class cPlayer;
@@ -248,6 +252,9 @@
   virtual void SetVideoFormat(bool VideoFormat16_9);
          ///< Sets the output video format to either 16:9 or 4:3 (only useful
          ///< if this device has an MPEG decoder).
+  virtual eVideoSystem GetVideoSystem(void);
+         ///< Returns the video system of the currently displayed material
+         ///< (default is PAL).
 
 // Audio facilities
 
diff -ruNbw vdr-1.2.2/dvbdevice.c vdr-1.2.4/dvbdevice.c
--- vdr-1.2.2/dvbdevice.c	Sat May 24 15:23:51 2003
+++ vdr-1.2.4/dvbdevice.c	Sun Aug 24 16:23:12 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: dvbdevice.c 1.60 2003/05/24 13:23:51 kls Exp $
+ * $Id: dvbdevice.c 1.62 2003/08/24 14:23:12 kls Exp $
  */
 
 #include "dvbdevice.h"
@@ -525,6 +525,19 @@
      CHECK(ioctl(fd_video, VIDEO_SET_FORMAT, VideoFormat16_9 ? VIDEO_FORMAT_16_9 : VIDEO_FORMAT_4_3));
 }
 
+eVideoSystem cDvbDevice::GetVideoSystem(void)
+{
+  eVideoSystem VideoSytem = vsPAL;
+  video_size_t vs;
+  if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) {
+     if (vs.h == 480 || vs.h == 240)
+        VideoSytem = vsNTSC;
+     }
+  else
+     LOG_ERROR;
+  return VideoSytem;
+}
+
 //                            ptAudio        ptVideo        ptPcr        ptTeletext        ptDolby        ptOther
 dmx_pes_type_t PesTypes[] = { DMX_PES_AUDIO, DMX_PES_VIDEO, DMX_PES_PCR, DMX_PES_TELETEXT, DMX_PES_OTHER, DMX_PES_OTHER };
 
@@ -600,13 +613,12 @@
 {
   bool result = false;
   bool hasPriority = Priority < 0 || Priority > this->Priority();
-  bool needsDetachReceivers = true;
+  bool needsDetachReceivers = false;
 
   if (ProvidesSource(Channel->Source()) && ProvidesCa(Channel->Ca())) {
      result = hasPriority;
      if (Receiving()) {
         if (dvbTuner->IsTunedTo(Channel)) {
-           needsDetachReceivers = false;
            if (!HasPid(Channel->Vpid())) {
 #ifdef DO_MULTIPLE_RECORDINGS
               if (Channel->Ca() > CACONFBASE)
@@ -623,6 +635,8 @@
            else
               result = !IsPrimaryDevice() || Priority >= Setup.PrimaryLimit;
            }
+        else
+           needsDetachReceivers = true;
         }
      }
   if (NeedsDetachReceivers)
diff -ruNbw vdr-1.2.2/dvbdevice.h vdr-1.2.4/dvbdevice.h
--- vdr-1.2.2/dvbdevice.h	Fri May  2 14:21:51 2003
+++ vdr-1.2.4/dvbdevice.h	Fri Aug 15 14:34:55 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: dvbdevice.h 1.21 2003/05/02 12:21:51 kls Exp $
+ * $Id: dvbdevice.h 1.22 2003/08/15 12:34:55 kls Exp $
  */
 
 #ifndef __DVBDEVICE_H
@@ -80,6 +80,7 @@
 
 public:
   virtual void SetVideoFormat(bool VideoFormat16_9);
+  virtual eVideoSystem GetVideoSystem(void);
 
 // Audio facilities
 
diff -ruNbw vdr-1.2.2/dvbspu.c vdr-1.2.4/dvbspu.c
--- vdr-1.2.2/dvbspu.c	Sat Oct 26 12:46:49 2002
+++ vdr-1.2.4/dvbspu.c	Fri Aug 15 15:04:39 2003
@@ -8,7 +8,7 @@
  *
  * parts of this file are derived from the OMS program.
  *
- * $Id: dvbspu.c 1.3 2002/10/26 10:46:49 kls Exp $
+ * $Id: dvbspu.c 1.4 2003/08/15 13:04:39 kls Exp $
  */
 
 #include <assert.h>
@@ -301,8 +301,10 @@
 
 int cDvbSpuDecoder::ScaleYcoord(int value)
 {
-    if (scaleMode == eSpuLetterBox)
-        return lround((value * 3.0) / 4.0 + 72.0);
+    if (scaleMode == eSpuLetterBox) {
+        int offset = cDevice::PrimaryDevice()->GetVideoSystem() == vsPAL ? 72 : 60;
+        return lround((value * 3.0) / 4.0) + offset;
+        }
     else
         return value;
 }
diff -ruNbw vdr-1.2.2/i18n.c vdr-1.2.4/i18n.c
--- vdr-1.2.2/i18n.c	Sun Jul 13 17:03:07 2003
+++ vdr-1.2.4/i18n.c	Sun Aug 24 12:52:08 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: i18n.c 1.129 2003/07/13 15:03:07 kls Exp $
+ * $Id: i18n.c 1.131 2003/08/24 10:52:08 kls Exp $
  *
  * Translations provided by:
  *
@@ -79,7 +79,7 @@
     "Português",
     "Français",
     "Norsk",
-    "suomi",
+    "Suomi",
     "Polski",
     "Español",
     "Ellinika",
@@ -2662,6 +2662,23 @@
     "Timeout SVDRP (sec)",
     "SVDRP Timeout (s)",
     "SVDRP Timeout (s)",
+  },
+  { "Setup.Miscellaneous$Zap timeout (s)",
+    "Zap Timeout (s)",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "Kanavavalinnan odotusaika (s)",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
   },
   // The days of the week:
   { "MTWTFSS",
diff -ruNbw vdr-1.2.2/libdtv/libsi/include/libsi.h vdr-1.2.4/libdtv/libsi/include/libsi.h
--- vdr-1.2.2/libdtv/libsi/include/libsi.h	Sun May 11 17:08:30 2003
+++ vdr-1.2.4/libdtv/libsi/include/libsi.h	Fri Aug 15 15:54:53 2003
@@ -1226,7 +1226,6 @@
 void siParseDescriptor (struct LIST *, u_char *);
 char *siGetDescriptorText (u_char *, int);
 char *siGetDescriptorName (u_char *, int);
-u_long crc32 (char *data, int len);
 
 /* si_debug_services.c */
 
diff -ruNbw vdr-1.2.2/libdtv/libsi/si_parser.c vdr-1.2.4/libdtv/libsi/si_parser.c
--- vdr-1.2.2/libdtv/libsi/si_parser.c	Sun May 11 17:06:57 2003
+++ vdr-1.2.4/libdtv/libsi/si_parser.c	Fri Aug 15 15:56:02 2003
@@ -36,7 +36,7 @@
 #include "libsi.h"
 #include "si_tables.h"
 
-
+static u_long crc32 (char *data, int len);
 
 struct LIST *siParsePAT (u_char *Buffer) 
 {
@@ -1240,7 +1240,7 @@
          if (*Buffer == 0) break;
 
          if ((*Buffer >= ' ' && *Buffer <= '~') || (*Buffer == '\n') ||
-             (*Buffer >= 0xa0 && *Buffer <= 0xff)) *tmp++ = *Buffer;
+             (*Buffer >= 0xa0)) *tmp++ = *Buffer;
          if (*Buffer == 0x8A) *tmp++ = '\n';
          if ((*Buffer == 0x86 || *Buffer == 0x87) && !(GDT_NAME_DESCRIPTOR & type)) *tmp++ = ' ';
          Buffer++;
@@ -1323,7 +1323,7 @@
 	0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
 	0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4};
 
-u_long crc32 (char *data, int len)
+static u_long crc32 (char *data, int len)
 {
 	register int i;
 	u_long crc = 0xffffffff;
diff -ruNbw vdr-1.2.2/menu.c vdr-1.2.4/menu.c
--- vdr-1.2.2/menu.c	Sun Aug  3 11:38:37 2003
+++ vdr-1.2.4/menu.c	Sun Aug 24 16:28:44 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: menu.c 1.264 2003/08/03 09:38:37 kls Exp $
+ * $Id: menu.c 1.269 2003/08/24 14:28:44 kls Exp $
  */
 
 #include "menu.h"
@@ -25,6 +25,7 @@
 #include "sources.h"
 #include "status.h"
 #include "timers.h"
+#include "transfer.h"
 #include "videodir.h"
 
 #define MENUTIMEOUT     120 // seconds
@@ -763,6 +764,8 @@
 
 void cMenuChannels::Move(int From, int To)
 {
+  int CurrentChannelNr = cDevice::CurrentChannel();
+  cChannel *CurrentChannel = Channels.GetByNumber(CurrentChannelNr);
   cChannel *FromChannel = GetChannel(From);
   cChannel *ToChannel = GetChannel(To);
   if (FromChannel && ToChannel) {
@@ -772,6 +775,8 @@
      cOsdMenu::Move(From, To);
      Propagate();
      isyslog("channel %d moved to %d", FromNumber, ToNumber);
+     if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr)
+        Channels.SwitchTo(CurrentChannel->Number());
      }
 }
 
@@ -2252,6 +2257,7 @@
   Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Min. event timeout (min)"),   &data.MinEventTimeout));
   Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Min. user inactivity (min)"), &data.MinUserInactivity));
   Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$SVDRP timeout (s)"),          &data.SVDRPTimeout));
+  Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Zap timeout (s)"),            &data.ZapTimeout));
 }
 
 // --- cMenuSetupPluginItem --------------------------------------------------
@@ -2997,6 +3003,8 @@
      else {
         Timers.Del(timer);
         Timers.Save();
+        if (!cReplayControl::LastReplayed()) // an instant recording, maybe from cRecordControls::PauseLiveVideo()
+           cReplayControl::SetRecording(fileName, Recording.Name());
         }
      timer = NULL;
      return;
@@ -3093,8 +3101,11 @@
      int Priority = Timer ? Timer->Priority() : Pause ? Setup.PausePriority : Setup.DefaultPriority;
      cDevice *device = cDevice::GetDevice(channel, Priority, &NeedsDetachReceivers);
      if (device) {
-        if (NeedsDetachReceivers)
+        if (NeedsDetachReceivers) {
            Stop(device);
+           if (device == cTransferControl::ReceiverDevice())
+              cControl::Shutdown(); // in case this device was used for Transfer Mode
+           }
         if (!device->SwitchChannel(channel, false)) {
            cThread::EmergencyExit(true);
            return false;
diff -ruNbw vdr-1.2.2/osdbase.c vdr-1.2.4/osdbase.c
--- vdr-1.2.2/osdbase.c	Sun Mar 23 16:53:29 2003
+++ vdr-1.2.4/osdbase.c	Sun Aug 24 13:38:27 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: osdbase.c 1.8 2003/03/23 15:53:29 kls Exp $
+ * $Id: osdbase.c 1.10 2003/08/24 11:38:27 kls Exp $
  */
 
 #include "osdbase.h"
@@ -70,7 +70,7 @@
 void cPalette::Reset(void)
 {
   for (int i = 0; i < numColors; i++)
-      used[i] = false;
+      used[i] = fetched[i] = false;
   full = false;
 }
 
@@ -215,7 +215,7 @@
      Take(Bitmap, &Indexes);
      for (int ix = 0; ix < Bitmap.width; ix++) {
          for (int iy = 0; iy < Bitmap.height; iy++)
-             SetIndex(x + ix, y + iy, Indexes[Bitmap.bitmap[Bitmap.width * iy + ix]]);
+             SetIndex(x + ix, y + iy, Indexes[int(Bitmap.bitmap[Bitmap.width * iy + ix])]);
          }
      }
 }
diff -ruNbw vdr-1.2.2/recording.c vdr-1.2.4/recording.c
--- vdr-1.2.2/recording.c	Fri May 30 15:23:54 2003
+++ vdr-1.2.4/recording.c	Sun Aug 17 11:10:46 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: recording.c 1.80 2003/05/30 13:23:54 kls Exp $
+ * $Id: recording.c 1.82 2003/08/17 09:10:46 kls Exp $
  */
 
 #include "recording.h"
@@ -95,7 +95,8 @@
   // a file, or mark a file for removal ("delete" it), so that
   // it will get removed during the next call.
   static time_t LastFreeDiskCheck = 0;
-  if (time(NULL) - LastFreeDiskCheck > DISKCHECKDELTA) {
+  int Factor = (Priority == -1) ? 10 : 1;
+  if (time(NULL) - LastFreeDiskCheck > DISKCHECKDELTA / Factor) {
      if (!VideoFileSpaceAvailable(MINDISKSPACE)) {
         // Make sure only one instance of VDR does this:
         cLockFile LockFile(VideoDirectory);
@@ -113,7 +114,7 @@
                  r = Recordings.Next(r);
                  }
            if (r0 && r0->Remove()) {
-              LastFreeDiskCheck += REMOVELATENCY;
+              LastFreeDiskCheck += REMOVELATENCY / Factor;
               return;
               }
            }
@@ -770,7 +771,7 @@
 #define INDEXFILESUFFIX     "/index.vdr"
 
 // The number of frames to stay off the end in case of time shift:
-#define INDEXSAFETYLIMIT 100 // frames
+#define INDEXSAFETYLIMIT 150 // frames
 
 // The maximum time to wait before giving up while catching up on an index file:
 #define MAXINDEXCATCHUP   8 // seconds
diff -ruNbw vdr-1.2.2/recording.h vdr-1.2.4/recording.h
--- vdr-1.2.2/recording.h	Sat Oct 19 17:48:52 2002
+++ vdr-1.2.4/recording.h	Sun Aug 17 11:03:46 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: recording.h 1.25 2002/10/19 15:48:52 kls Exp $
+ * $Id: recording.h 1.26 2003/08/17 09:03:46 kls Exp $
  */
 
 #ifndef __RECORDING_H
@@ -17,6 +17,8 @@
 
 void RemoveDeletedRecordings(void);
 void AssertFreeDiskSpace(int Priority = 0);
+     ///< The special Priority value -1 means that we shall get rid of any
+     ///< deleted recordings faster than normal (because we're cutting).
 
 class cResumeFile {
 private:
diff -ruNbw vdr-1.2.2/remux.c vdr-1.2.4/remux.c
--- vdr-1.2.2/remux.c	Sat Apr 26 17:07:41 2003
+++ vdr-1.2.4/remux.c	Wed Aug  6 16:44:03 2003
@@ -8,7 +8,7 @@
  * the Linux DVB driver's 'tuxplayer' example and were rewritten to suit
  * VDR's needs.
  *
- * $Id: remux.c 1.15 2003/04/26 15:07:41 kls Exp $
+ * $Id: remux.c 1.16 2003/08/06 14:44:03 kls Exp $
  */
 
 /* The calling interface of the 'cRemux::Process()' function is defined
@@ -321,7 +321,6 @@
                      if ((flag1 & 0xC0) == 0x80 )
                         mpeg = 2;
                      else {
-                        esyslog("ERROR: error in data stream!");
                         hlength = 0;
                         which = 0;
                         mpeg = 1;
@@ -360,6 +359,9 @@
                write_ipack(&flag2, 1);
                write_ipack(&hlength, 1);
                }
+
+            if (mpeg == 1 && found == 7)
+               write_ipack(&flag1, 1);
 
             if (mpeg == 2 && (flag2 & PTS_ONLY) && found < 14) {
                while (c < Count && found < 14) {
diff -ruNbw vdr-1.2.2/runvdr vdr-1.2.4/runvdr
--- vdr-1.2.2/runvdr	Sat Mar 16 17:22:12 2002
+++ vdr-1.2.4/runvdr	Sun Aug 17 16:27:31 2003
@@ -18,7 +18,7 @@
 # See the main source file 'vdr.c' for copyright information and
 # how to reach the author.
 #
-# $Id: runvdr 1.9 2002/03/16 16:22:12 kls Exp $
+# $Id: runvdr 1.10 2003/08/17 14:27:31 kls Exp $
 
 DVBDIR="../DVB/driver"
 VDRPRG="./vdr"
@@ -34,7 +34,7 @@
 
 while (true) do
       su -c "$VDRCMD" $VDRUSR
-      if test $? -eq 0; then exit; fi
+      if test $? -ne 1; then exit; fi
       date
       echo "restarting VDR"
       $KILL $VDRPRG
diff -ruNbw vdr-1.2.2/vdr.c vdr-1.2.4/vdr.c
--- vdr-1.2.2/vdr.c	Sat Aug  2 16:01:32 2003
+++ vdr-1.2.4/vdr.c	Sun Aug 24 13:18:04 2003
@@ -22,7 +22,7 @@
  *
  * The project's page is at http://www.cadsoft.de/vdr
  *
- * $Id: vdr.c 1.162 2003/08/02 14:01:32 kls Exp $
+ * $Id: vdr.c 1.166 2003/08/24 11:18:04 kls Exp $
  */
 
 #include <getopt.h>
@@ -57,7 +57,6 @@
 #define ACTIVITYTIMEOUT 60 // seconds before starting housekeeping
 #define SHUTDOWNWAIT   300 // seconds to wait in user prompt before automatic shutdown
 #define MANUALSTART    600 // seconds the next timer must be in the future to assume manual start
-#define ZAPTIMEOUT       3 // seconds until a channel counts as "previous" for switching with '0'
 
 static int Interrupted = 0;
 
@@ -342,16 +341,18 @@
   cPlugin::SetConfigDirectory(ConfigDirectory);
 
   Setup.Load(AddDirectory(ConfigDirectory, "setup.conf"));
-  Sources.Load(AddDirectory(ConfigDirectory, "sources.conf"), true);
-  Diseqcs.Load(AddDirectory(ConfigDirectory, "diseqc.conf"), true);
-  Channels.Load(AddDirectory(ConfigDirectory, "channels.conf"));
-  Timers.Load(AddDirectory(ConfigDirectory, "timers.conf"));
-  Commands.Load(AddDirectory(ConfigDirectory, "commands.conf"), true);
-  RecordingCommands.Load(AddDirectory(ConfigDirectory, "reccmds.conf"), true);
-  SVDRPhosts.Load(AddDirectory(ConfigDirectory, "svdrphosts.conf"), true);
-  CaDefinitions.Load(AddDirectory(ConfigDirectory, "ca.conf"), true);
-  Keys.Load(AddDirectory(ConfigDirectory, "remote.conf"));
-  KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true);
+  if (!(Sources.Load(AddDirectory(ConfigDirectory, "sources.conf"), true, true) &&
+        Diseqcs.Load(AddDirectory(ConfigDirectory, "diseqc.conf"), true, true) &&
+        Channels.Load(AddDirectory(ConfigDirectory, "channels.conf"), false, true) &&
+        Timers.Load(AddDirectory(ConfigDirectory, "timers.conf")) &&
+        Commands.Load(AddDirectory(ConfigDirectory, "commands.conf"), true) &&
+        RecordingCommands.Load(AddDirectory(ConfigDirectory, "reccmds.conf"), true) &&
+        SVDRPhosts.Load(AddDirectory(ConfigDirectory, "svdrphosts.conf"), true) &&
+        CaDefinitions.Load(AddDirectory(ConfigDirectory, "ca.conf"), true) &&
+        Keys.Load(AddDirectory(ConfigDirectory, "remote.conf")) &&
+        KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true)
+        ))
+     return 2;
 
   // DVB interfaces:
 
@@ -455,8 +456,8 @@
   cOsdObject *Temp = NULL;
   int LastChannel = -1;
   int LastTimerChannel = -1;
-  int PreviousChannel = cDevice::CurrentChannel();
-  int LastLastChannel = PreviousChannel;
+  int PreviousChannel[2] = { 1, 1 };
+  int PreviousChannelIndex = 0;
   time_t LastChannelChanged = time(NULL);
   time_t LastActivity = 0;
   int MaxLatencyTime = 0;
@@ -498,10 +499,8 @@
            LastChannel = cDevice::CurrentChannel();
            LastChannelChanged = time(NULL);
            }
-        if (LastLastChannel != LastChannel && time(NULL) - LastChannelChanged >= ZAPTIMEOUT) {
-           PreviousChannel = LastLastChannel;
-           LastLastChannel = LastChannel;
-           }
+        if (time(NULL) - LastChannelChanged >= Setup.ZapTimeout && LastChannel != PreviousChannel[0] && LastChannel != PreviousChannel[1])
+           PreviousChannel[PreviousChannelIndex ^= 1] = LastChannel;
         // Timers and Recordings:
         if (!Timers.BeingEdited()) {
            time_t Now = time(NULL); // must do both following calls with the exact same time!
@@ -680,9 +679,9 @@
            switch (key) {
              // Toggle channels:
              case k0: {
-                  int CurrentChannel = cDevice::CurrentChannel();
-                  Channels.SwitchTo(PreviousChannel);
-                  PreviousChannel = CurrentChannel;
+                  if (PreviousChannel[PreviousChannelIndex ^ 1] == LastChannel || LastChannel != PreviousChannel[0] && LastChannel != PreviousChannel[1])
+                     PreviousChannelIndex ^= 1;
+                  Channels.SwitchTo(PreviousChannel[PreviousChannelIndex ^= 1]);
                   break;
                   }
              // Direct Channel Select:
