diff -ruNbw vdr-1.2.2/CONTRIBUTORS vdr-1.2.5pre2/CONTRIBUTORS
--- vdr-1.2.2/CONTRIBUTORS	Sat Aug  2 16:32:53 2003
+++ vdr-1.2.5pre2/CONTRIBUTORS	Sat Sep  6 12:35:24 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
@@ -481,6 +489,8 @@
  the remote control keys
  for reporting a bug in reading 'epg.data' for channels with non-zero RID
  for fixing I/O handling in case an explicit controlling terminal is given
+ for fixing displaying still pictures, now using the driver's VIDEO_STILLPICTURE call
+ directly
 
 Reinhard Walter Buchner <rw.buchner@freenet.de>
  for adding some satellites to 'sources.conf'
@@ -536,6 +546,8 @@
  for reporting a bug in switching audio tracks in 'Transfer Mode' on the primary DVB device
  for making the program use the values of VIDEODIR and PLUGINDIR defined in Makefile
  or Makefile.config as defaults
+ for helping to debug a crash when using the --terminal option without having access
+ to the given terminal
 
 Peter Seyringer <e9425234@student.tuwien.ac.at>
  for reporting a bug in saving the polarization parameter of channels that have a
@@ -550,6 +562,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 +626,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 +652,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 +705,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 +754,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 +762,40 @@
 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
+
+Peter Waechtler <pwaechtler@mac.com>
+ for adding channels for DVB-T Hannover (Germany) to channels.cont.terr
+
+Robert Bartl <robert@bartl.priv.at>
+ for reporting a hangup in SVDRP when the client disappears without sending QUIT
+
+Sebastian Frei <sebastian@schnapsleichen.de>
+ for his support in keeping 'channels.conf' up-to-date.
+
+Rene Bartsch <ml@bartschnet.de>
+ for reporting a bug in setting the primary device in case none of the devices
+ provides an MPEG decoder
+
+Christoph Hermanns <christoph.hermanns@gmx.de>
+ for reporting a bug in handling the "Red" button in the "Schedules" menu in case
+ there are no events listed for a particular channel
+
+Oskar Signell <oskar@signell.net>
+ for pointing out a problem with setting an editing mark while in "Pause" mode,
+ where replay was not immediately positioned to the marked frame
diff -ruNbw vdr-1.2.2/HISTORY vdr-1.2.5pre2/HISTORY
--- vdr-1.2.2/HISTORY	Sun Aug  3 11:54:18 2003
+++ vdr-1.2.5pre2/HISTORY	Sun Sep  7 11:02:19 2003
@@ -2282,3 +2282,96 @@
 - 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-26: Version 1.2.4 (not officially released)
+
+- 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.
+
+2003-08-31: Version 1.2.5pre1
+
+- Now explicitly handling exit value 0 and 2 in 'runvdr'.
+- Added a missing 'w' to the allowed characters for Finnish and Swedish (thanks
+  to Lauri Tischler and Ragnar Sundblad).
+- Added channels for DVB-T Hannover (Germany) to channels.cont.terr (thanks to
+  Peter Waechtler).
+- Fixed a hangup in SVDRP when the client disappears without sending QUIT (thanks
+  to Robert Bartl for reporting this one). The problem was introduced in version
+  1.2.2 through the fix for an occasional "Broken pipe" error in SVDRP connections.
+- Updated 'channels.conf.terr' for Berlin.
+- Fixed displaying still pictures, now using the driver's VIDEO_STILLPICTURE call
+  directly (thanks to Oliver Endriss). This also improves navigating through DVD
+  menus with the DVD plugin. If this causes problems with your particular system
+  (maybe because you are using the 'analogtv' plugin) you can reactivate the
+  previous behaviour by commenting out the line
+  #define VIDEO_STILLPICTURE_WORKS_WITH_VDR_FRAMES
+  in VDR/dvbdevice.c.
+  Note that you need driver version 2003-08-23 or later for this to work!
+- Fixed handling extra blanks in plugin command lines.
+- Actually implemented the SVDRP command DELC.
+- Now clearing the player device if there are too many poll timeouts in 'Transfer
+  Mode', which avoids buffer overflows and black screens in such cases.
+
+2003-09-07: Version 1.2.5pre2
+
+- Updated VIVA, VIVA Plus, MTV Central and MTV 2 in channels.conf (thanks to
+  Sebastian Frei).
+- Changed "Studio Universal" to "Sci-Fi" in channels.conf.
+- Fixed a crash when using the --terminal option without having access to the
+  given terminal (thanks to Steffen Barszus for helping to debug this one).
+- Added a note about the driver version needed for the still picture fix from
+  version 1.2.5pre1 to work properly (thanks to Oliver Endriss for pointing
+  this out).
+- Fixed setting the primary device in case none of the devices provides an MPEG
+  decoder (thanks to Rene Bartsch for reporting this one).
+- Fixed handling the "Red" button in the "Schedules" menu in case there are no
+  events listed for a particular channel (thanks to Christoph Hermanns for
+  reporting this one).
+- When setting an editing mark while in "Pause" mode, replay now immediately
+  jumps to the marked frame (thanks to Oskar Signell for pointing out this
+  problem).
+- The DVB devices no longer send CA descriptors to the CAM while the EPG scanner
+  is active (sometimes the CAMs got irritated when the device tuned to channels
+  they couldn't handle).
diff -ruNbw vdr-1.2.2/INSTALL vdr-1.2.5pre2/INSTALL
--- vdr-1.2.2/INSTALL	Sat May 31 18:20:59 2003
+++ vdr-1.2.5pre2/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.5pre2/MANUAL
--- vdr-1.2.2/MANUAL	Sun Jun 15 16:35:38 2003
+++ vdr-1.2.5pre2/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.5pre2/Make.config.template
--- vdr-1.2.2/Make.config.template	Sat Aug  2 16:25:53 2003
+++ vdr-1.2.5pre2/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.5pre2/Makefile
--- vdr-1.2.2/Makefile	Sat Aug  2 16:27:21 2003
+++ vdr-1.2.5pre2/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.5pre2/channels.c
--- vdr-1.2.2/channels.c	Sat Apr 26 11:57:48 2003
+++ vdr-1.2.5pre2/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.conf vdr-1.2.5pre2/channels.conf
--- vdr-1.2.2/channels.conf	Sun Jun 22 15:41:17 2003
+++ vdr-1.2.5pre2/channels.conf	Fri Sep  5 14:46:20 2003
@@ -56,7 +56,7 @@
 Premiere 6:11797:h:S19.2E:27500:1535:1536:0:101:41:0:0:0
 Premiere 7:11797:h:S19.2E:27500:1023:1024:0:101:20:0:0:0
 13th Street:11758:h:S19.2E:27500:2303:2304:0:101:42:0:0:0
-Studio Universal:11798:h:S19.2E:27500:2047:2048:0:101:36:0:0:0
+Sci-Fi:11758:h:S19.2E:27500:2047:2048:0:101:36:0:0:0
 Premiere Serie:12031:h:S19.2E:27500:1023:1024:0:101:16:0:0:0
 Disney Channel:11758:h:S19.2E:27500:2559:2560:0:101:34:0:0:0
 Premiere Nostalgie:12031:h:S19.2E:27500:2559:2560:0:101:516:0:0:0
@@ -145,13 +145,13 @@
 RTL Tele Letzebuerg:12552:v:S19.2E:22000:168:144,146:0:0:3994:0:0:0
 VERONICA:12574:h:S19.2E:22000:161:84:0:0:5010:0:0:0
 VH1 Classic:12670:v:S19.2E:22000:3071:3072:0:0:28647:0:0:0
-MTV 2 Pop:12670:v:S19.2E:22000:3081:3082:0:0:28648:0:0:0
+MTV 2:12225:h:S19.2E:27500:513:661:577:0:28640:0:0:0
 Via 1 - Schöner Reisen:12148:h:S19.2E:27500:511:512:0:0:44:0:0:0
 Video Italia:12610:v:S19.2E:22000:121:122:0:0:12220:0:0:0
 ORF/ZDF:12670:h:S19.2E:22000:506:507:0:0:13012:0:0:0
-VIVA:12670:v:S19.2E:22000:309:310:0:0:12732:0:0:0
-VIVA PLUS:12552:v:S19.2E:22000:171:172:0:0:12120:0:0:0
-MTV German:12670:v:S19.2E:22000:3031:3032:0:0:28643:0:0:0
+VIVA:12670:v:S19.2E:22000:309:310:311:0:12732:0:0:0
+VIVA PLUS:12552:v:S19.2E:22000:171:172:179:0:12120:0:0:0
+MTV Central:11739:v:S19.2E:27500:3031:3032:3034:0:28653:0:0:0
 QVC Germany:12552:v:S19.2E:22000:165:166:0:0:12100:0:0:0
 Tele 5:12480:v:S19.2E:27500:1535:1536:0:0:51:0:0:0
 :@201 Sky
diff -ruNbw vdr-1.2.2/channels.conf.terr vdr-1.2.5pre2/channels.conf.terr
--- vdr-1.2.2/channels.conf.terr	Sun May 11 14:00:48 2003
+++ vdr-1.2.5pre2/channels.conf.terr	Sat Aug 30 12:31:55 2003
@@ -45,7 +45,14 @@
 KISS (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1101:0:0:26176:0:0:0
 oneword (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1501:0:0:26432:0:0:0
 Smash Hits! (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1201:0:0:26240:0:0:0
-: DVB-T Berlin Germany
+: DVB-T Berlin, Germany
+BBC World:177500:I0C23D0M16B8T8G8Y0:T:27500:49:50:55:0:16387:0:0:0
+FAB:177500:I0C23D0M16B8T8G8Y0:T:27500:3073:3074:3079:0:16576:0:0:0
+WDR:177500:I0C23D0M16B8T8G8Y0:T:27500:241:242:247:0:15:0:0:0
+SWR BW:177500:I0C23D0M16B8T8G8Y0:T:27500:257:258:263:0:16:0:0:0
+MDR Fernsehen:191500:I0C23D0M16B8T8G8Y0:T:27500:101:102:104:0:1:0:0:0
+arte:191500:I0C23D0M16B8T8G8Y0:T:27500:201:202,203:204:0:2:0:0:0
+NDR Fernsehen:191500:I0C23D0M16B8T8G8Y0:T:27500:301:302:304:0:3:0:0:0
 RTL:506000:I0C23D0M16B8T8G8Y0:T:27500:337:338:343:0:16405:0:0:0
 RTL2:506000:I0C23D0M16B8T8G8Y0:T:27500:353:354:359:0:16406:0:0:0
 Super RTL:506000:I0C23D0M16B8T8G8Y0:T:27500:433:434:439:0:16411:0:0:0
@@ -61,6 +68,15 @@
 N24:658000:I0C23D0M16B8T8G8Y0:T:27500:225:226:231:0:16398:0:0:0
 ProSieben:658000:I0C23D0M16B8T8G8Y0:T:27500:305:306;307:311:0:16403:0:0:0
 SAT.1:658000:I0C23D0M16B8T8G8Y0:T:27500:385:386:391:0:16408:0:0:0
-MTV:778000:I0C23D0M16B8T8G8Y0:T:27500:193:194:199:0:16396:0:0:0
-n-tv:778000:I0C23D0M16B8T8G8Y0:T:27500:273:274:279:0:16401:0:0:0
-Eurosport:778000:I0C23D0M16B8T8G8Y0:T:27500:577:578:583:0:16420:0:0:0
+Testkanal 9live:754000:I0C23D0M16B8T8G8Y0:T:27500:273:274:279:0:16401:0:0:0
+Eurosport:754000:I0C23D0M16B8T8G8Y0:T:27500:577:578:583:0:16420:0:0:0
+DSF:754000:I0C23D0M16B8T8G8Y0:T:27500:129:130:135:0:16392:0:0:0
+VIVA Plus:754000:I0C23D0M16B8T8G8Y0:T:27500:529:530:535:0:16417:0:0:0
+Testkanal Pro7:778000:I0C23D0M16B8T8G8Y0:T:27500:305:306:311:0:16403:0:0:0
+: DVB-T Hannover, Germany
+ARD:554000:I0C12D0M16B8T8G32Y0:T:27500:512:650:513:0:28156:0:0:0
+ZDF:554000:I0C12D0M16B8T8G32Y0:T:27500:513:651:513:0:28160:0:0:0
+NDR:554000:I0C12D0M16B8T8G32Y0:T:27500:514:652:513:0:28162:0:0:0
+RTL:530500:I0C12D0M16B8T8G32Y0:T:27500:512:650:513:0:1:0:0:0
+SAT1:530500:I0C12D0M16B8T8G32Y0:T:27500:513:651:513:0:2:0:0:0
+9Live:530500:I0C12D0M16B8T8G32Y0:T:27500:514:652:513:0:3:0:0:0
diff -ruNbw vdr-1.2.2/channels.h vdr-1.2.5pre2/channels.h
--- vdr-1.2.2/channels.h	Sat Apr 26 11:15:40 2003
+++ vdr-1.2.5pre2/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.5pre2/config.c
--- vdr-1.2.2/config.c	Sun May 11 15:50:02 2003
+++ vdr-1.2.5pre2/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.5pre2/config.h
--- vdr-1.2.2/config.h	Thu Jun 12 22:37:14 2003
+++ vdr-1.2.5pre2/config.h	Fri Sep  5 15:18:38 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.171 2003/09/05 13:18:38 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.5pre2"
+#define VDRVERSNUM   10205  // 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.5pre2/cutter.c
--- vdr-1.2.2/cutter.c	Sat May 24 13:59:33 2003
+++ vdr-1.2.5pre2/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.5pre2/device.c
--- vdr-1.2.2/device.c	Sat Aug  2 13:44:28 2003
+++ vdr-1.2.5pre2/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.5pre2/device.h
--- vdr-1.2.2/device.h	Sun May 11 10:50:04 2003
+++ vdr-1.2.5pre2/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.5pre2/dvbdevice.c
--- vdr-1.2.2/dvbdevice.c	Sat May 24 15:23:51 2003
+++ vdr-1.2.5pre2/dvbdevice.c	Sat Sep  6 15:19:33 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.64 2003/09/06 13:19:33 kls Exp $
  */
 
 #include "dvbdevice.h"
@@ -74,6 +74,7 @@
   cChannel channel;
   const char *diseqcCommands;
   bool active;
+  bool useCa;
   time_t startTime;
   eTunerStatus tunerStatus;
   cMutex mutex;
@@ -84,7 +85,7 @@
   cDvbTuner(int Fd_Frontend, int CardIndex, fe_type_t FrontendType, cCiHandler *CiHandler);
   virtual ~cDvbTuner();
   bool IsTunedTo(const cChannel *Channel) const;
-  void Set(const cChannel *Channel, bool Tune);
+  void Set(const cChannel *Channel, bool Tune, bool UseCa);
   bool Locked(void) { return tunerStatus == tsLocked; }
   };
 
@@ -96,6 +97,7 @@
   ciHandler = CiHandler;
   diseqcCommands = NULL;
   active = false;
+  useCa = false;
   tunerStatus = tsIdle;
   startTime = time(NULL);
   Start();
@@ -114,7 +116,7 @@
   return tunerStatus != tsIdle && channel.Source() == Channel->Source() && channel.Frequency() == Channel->Frequency();
 }
 
-void cDvbTuner::Set(const cChannel *Channel, bool Tune)
+void cDvbTuner::Set(const cChannel *Channel, bool Tune, bool UseCa)
 {
   cMutexLock MutexLock(&mutex);
   bool CaChange = !(Channel->GetChannelID() == channel.GetChannelID());
@@ -122,6 +124,7 @@
      tunerStatus = tsSet;
   else if (tunerStatus == tsCam && CaChange)
      tunerStatus = tsTuned;
+  useCa = UseCa;
   if (Channel->Ca() && CaChange)
      startTime = time(NULL);
   channel = *Channel;
@@ -267,7 +270,7 @@
               }
            if (tunerStatus >= tsLocked) {
               if (ciHandler) {
-                 if (ciHandler->Process()) {
+                 if (ciHandler->Process() && useCa) {
                     if (tunerStatus != tsCam) {//XXX TODO update in case the CA descriptors have changed
                        for (int Slot = 0; Slot < ciHandler->NumSlots(); Slot++) {
                            uchar buffer[2048];
@@ -525,6 +528,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 +616,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 +638,8 @@
            else
               result = !IsPrimaryDevice() || Priority >= Setup.PrimaryLimit;
            }
+        else
+           needsDetachReceivers = true;
         }
      }
   if (NeedsDetachReceivers)
@@ -659,6 +676,7 @@
   StartTransferMode = false;
 #endif
 
+  // XXX 1.3: use the same mechanism as below (!EITScanner.UsesDevice(this))
   if (EITScanner.Active()) {
      StartTransferMode = false;
      TurnOnLivePIDs = false;
@@ -676,7 +694,7 @@
   if (TurnOffLivePIDs)
      TurnOffLiveMode();
 
-  dvbTuner->Set(Channel, DoTune);
+  dvbTuner->Set(Channel, DoTune, !EITScanner.UsesDevice(this)); //XXX 1.3: this is an ugly hack - find a cleaner solution
 
   // PID settings:
 
@@ -882,11 +900,49 @@
    If anybody ever finds out what could be changed so that VIDEO_STILLPICTURE
    could be used, please let me know!
    kls 2002-03-23
+   2003-08-30: apparently the driver can't handle PES data, so Oliver Endriss
+               <o.endriss@gmx.de> has changed this to strip all PES headers
+               and send pure ES data to the driver. Seems to work just fine!
+               Let's drop the VIDEO_STILLPICTURE_WORKS_WITH_VDR_FRAMES stuff
+               once this has proven to work in all cases.
 */
-//#define VIDEO_STILLPICTURE_WORKS_WITH_VDR_FRAMES
+#define VIDEO_STILLPICTURE_WORKS_WITH_VDR_FRAMES
 #ifdef VIDEO_STILLPICTURE_WORKS_WITH_VDR_FRAMES
+  if (Data[0] == 0x00 && Data[1] == 0x00 && Data[2] == 0x01 && (Data[3] & 0xF0) == 0xE0) {
+     // PES data
+     char *buf = MALLOC(char, Length);
+     if (!buf)
+        return;
+     int i = 0;
+     int blen = 0;
+     while (i < Length - 4) {
+           if (Data[i] == 0x00 && Data[i + 1] == 0x00 && Data[i + 2] == 0x01 && (Data[i + 3] & 0xF0) == 0xE0) {
+              // skip PES header
+              int offs = i + 6;
+              int len = Data[i + 4] * 256 + Data[i + 5];
+              // skip header extension
+              if ((Data[i + 6] & 0xC0) == 0x80) {
+                 offs += 3;
+                 offs += Data[i + 8];
+                 len -= 3;
+                 len -= Data[i + 8];
+                 }
+              memcpy(&buf[blen], &Data[offs], len);
+              i = offs + len;
+              blen += len;
+              }
+           else
+              i++;
+           }
+     video_still_picture sp = { buf, blen };
+     CHECK(ioctl(fd_video, VIDEO_STILLPICTURE, &sp));
+     free(buf);
+     }
+  else {
+     // non-PES data
   video_still_picture sp = { (char *)Data, Length };
   CHECK(ioctl(fd_video, VIDEO_STILLPICTURE, &sp));
+     }
 #else
 #define MIN_IFRAME 400000
   for (int i = MIN_IFRAME / Length + 1; i > 0; i--) {
diff -ruNbw vdr-1.2.2/dvbdevice.h vdr-1.2.5pre2/dvbdevice.h
--- vdr-1.2.2/dvbdevice.h	Fri May  2 14:21:51 2003
+++ vdr-1.2.5pre2/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.5pre2/dvbspu.c
--- vdr-1.2.2/dvbspu.c	Sat Oct 26 12:46:49 2002
+++ vdr-1.2.5pre2/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/eitscan.c vdr-1.2.5pre2/eitscan.c
--- vdr-1.2.2/eitscan.c	Sat May 24 15:34:59 2003
+++ vdr-1.2.5pre2/eitscan.c	Sat Sep  6 15:06:13 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: eitscan.c 1.13 2003/05/24 13:34:59 kls Exp $
+ * $Id: eitscan.c 1.14 2003/09/06 13:06:13 kls Exp $
  */
 
 #include "eitscan.h"
@@ -17,6 +17,7 @@
 cEITScanner::cEITScanner(void)
 {
   lastScan = lastActivity = time(NULL);
+  currentDevice = NULL;
   currentChannel = 0;
   memset(lastChannel, 0, sizeof(lastChannel));
   numTransponders = 0;
@@ -66,7 +67,9 @@
                                if (Device == cDevice::PrimaryDevice() && !currentChannel) {
                                   currentChannel = Device->CurrentChannel();
                                   }
+                               currentDevice = Device;
                                Device->SwitchChannel(Channel, false);
+                               currentDevice = NULL;
                                break;
                                }
                             }
diff -ruNbw vdr-1.2.2/eitscan.h vdr-1.2.5pre2/eitscan.h
--- vdr-1.2.2/eitscan.h	Sat May 24 15:21:36 2003
+++ vdr-1.2.5pre2/eitscan.h	Sat Sep  6 15:05:51 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: eitscan.h 1.3 2003/05/24 13:21:36 kls Exp $
+ * $Id: eitscan.h 1.4 2003/09/06 13:05:51 kls Exp $
  */
 
 #ifndef __EITSCAN_H
@@ -19,6 +19,7 @@
          ScanTimeout = 20
        };
   time_t lastScan, lastActivity;
+  cDevice *currentDevice;
   int currentChannel;
   int lastChannel[MAXDEVICES];
   int numTransponders, *transponders;
@@ -27,6 +28,7 @@
   cEITScanner(void);
   ~cEITScanner();
   bool Active(void) { return currentChannel; }
+  bool UsesDevice(const cDevice *Device) { return currentDevice == Device; }
   void Activity(void);
   void Process(void);
   };
diff -ruNbw vdr-1.2.2/i18n.c vdr-1.2.5pre2/i18n.c
--- vdr-1.2.2/i18n.c	Sun Jul 13 17:03:07 2003
+++ vdr-1.2.5pre2/i18n.c	Tue Aug 26 17:27:25 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.133 2003/08/26 15:27:25 kls Exp $
  *
  * Translations provided by:
  *
@@ -79,7 +79,7 @@
     "Português",
     "Français",
     "Norsk",
-    "suomi",
+    "suomi", // this is not a typo - it's really lowercase!
     "Polski",
     "Español",
     "Ellinika",
@@ -2663,6 +2663,23 @@
     "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",
     "MDMDFSS",
@@ -2707,11 +2724,11 @@
     "",// TODO
     " aàbcçdeéèêfghiîjklmnoôpqrstuùûvwxyz0123456789-.#~",
     "",// TODO
-    " abcdefghijklmnopqrstuvxyzåäö0123456789-.#~",
+    " abcdefghijklmnopqrstuvwxyzåäö0123456789-.#~",
     " abcdefghijklmnopqrstuvwxyz0123456789-.#~",
     " aábcdeéfghiíjklmnñoópqrstuúvwxyz0123456789-.#~",
     "",// TODO
-    " abcdefghijklmnopqrstuvxyzåäö0123456789-.#~",
+    " abcdefghijklmnopqrstuvwxyzåäö0123456789-.#~",
     " abcdefghijklmnopqrstuvwxyz0123456789-.#~",
     " aábcdeéfghiíjklmnoóöpqrstuúüvwxyz0123456789-.,#~",
     " aàbcçdeéèfghiíjklmnoòpqrstuúvwxyz0123456789-.,#~_·",
diff -ruNbw vdr-1.2.2/libdtv/libsi/include/libsi.h vdr-1.2.5pre2/libdtv/libsi/include/libsi.h
--- vdr-1.2.2/libdtv/libsi/include/libsi.h	Sun May 11 17:08:30 2003
+++ vdr-1.2.5pre2/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.5pre2/libdtv/libsi/si_parser.c
--- vdr-1.2.2/libdtv/libsi/si_parser.c	Sun May 11 17:06:57 2003
+++ vdr-1.2.5pre2/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.5pre2/menu.c
--- vdr-1.2.2/menu.c	Sun Aug  3 11:38:37 2003
+++ vdr-1.2.5pre2/menu.c	Sat Sep  6 12:26:45 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.271 2003/09/06 10:26:45 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());
      }
 }
 
@@ -1245,7 +1250,7 @@
 
   currentChannel = CurrentChannelNr;
   free(pArray);
-  SetHelp(tr("Record"), Now ? tr("Next") : tr("Now"), tr("Button$Schedule"), tr("Switch"));
+  SetHelp(Count() ? tr("Record") : NULL, Now ? tr("Next") : tr("Now"), tr("Button$Schedule"), tr("Switch"));
 }
 
 const cEventInfo *cMenuWhatsOn::ScheduleEventInfo(void)
@@ -1353,7 +1358,7 @@
      cMenuWhatsOn::SetCurrentChannel(channel->Number());
      schedules = cSIProcessor::Schedules(mutexLock);
      PrepareSchedule(channel);
-     SetHelp(tr("Record"), tr("Now"), tr("Next"));
+     SetHelp(Count() ? tr("Record") : NULL, tr("Now"), tr("Next"));
      }
 }
 
@@ -1465,7 +1470,7 @@
            PrepareSchedule(channel);
            if (channel->Number() != cDevice::CurrentChannel()) {
               otherChannel = channel->Number();
-              SetHelp(tr("Record"), tr("Now"), tr("Next"), tr("Switch"));
+              SetHelp(Count() ? tr("Record") : NULL, tr("Now"), tr("Next"), tr("Switch"));
               }
            Display();
            }
@@ -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;
@@ -3520,6 +3531,10 @@
      else {
         marks.Add(Current);
         ShowTimed(2);
+        bool Play, Forward;
+        int Speed;
+        if (GetReplayMode(Play, Forward, Speed) && !Play)
+           Goto(Current, true);
         }
      marks.Save();
      }
@@ -3648,7 +3663,6 @@
       DoShowMode = false;
       switch (Key) {
         // Editing:
-        //XXX should we do this only when the ProgressDisplay is on???
         case kMarkToggle:      MarkToggle(); break;
         case kMarkJumpBack:    MarkJump(false); break;
         case kMarkJumpForward: MarkJump(true); break;
diff -ruNbw vdr-1.2.2/osdbase.c vdr-1.2.5pre2/osdbase.c
--- vdr-1.2.2/osdbase.c	Sun Mar 23 16:53:29 2003
+++ vdr-1.2.5pre2/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/plugin.c vdr-1.2.5pre2/plugin.c
--- vdr-1.2.2/plugin.c	Fri May  9 17:01:26 2003
+++ vdr-1.2.5pre2/plugin.c	Sat Aug 30 16:52:58 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: plugin.c 1.9 2003/05/09 15:01:26 kls Exp $
+ * $Id: plugin.c 1.10 2003/08/30 14:52:58 kls Exp $
  */
 
 #include "plugin.h"
@@ -170,7 +170,7 @@
      if (plugin && args) {
         int argc = 0;
         char *argv[MAXPLUGINARGS];
-        char *p = args;
+        char *p = skipspace(stripspace(args));
         char *q = NULL;
         bool done = false;
         while (!done) {
@@ -205,7 +205,7 @@
                                }
                             }
                          if (!done)
-                            p++;
+                            p = *p ? p + 1 : skipspace(p + 1);
                 }
               }
         argv[argc] = NULL;
@@ -278,7 +278,7 @@
         }
      return;
      }
-  char *s = strdup(Args);
+  char *s = strdup(skipspace(Args));
   char *p = strchr(s, ' ');
   if (p)
      *p = 0;
diff -ruNbw vdr-1.2.2/recording.c vdr-1.2.5pre2/recording.c
--- vdr-1.2.2/recording.c	Fri May 30 15:23:54 2003
+++ vdr-1.2.5pre2/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.5pre2/recording.h
--- vdr-1.2.2/recording.h	Sat Oct 19 17:48:52 2002
+++ vdr-1.2.5pre2/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.5pre2/remux.c
--- vdr-1.2.2/remux.c	Sat Apr 26 17:07:41 2003
+++ vdr-1.2.5pre2/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.5pre2/runvdr
--- vdr-1.2.2/runvdr	Sat Mar 16 17:22:12 2002
+++ vdr-1.2.5pre2/runvdr	Tue Aug 26 18:15:41 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.11 2003/08/26 16:15:41 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 $? -eq 0 -o $? -eq 2; then exit; fi
       date
       echo "restarting VDR"
       $KILL $VDRPRG
diff -ruNbw vdr-1.2.2/svdrp.c vdr-1.2.5pre2/svdrp.c
--- vdr-1.2.2/svdrp.c	Sat Jul 26 12:57:33 2003
+++ vdr-1.2.5pre2/svdrp.c	Sun Aug 31 13:24:47 2003
@@ -10,7 +10,7 @@
  * and interact with the Video Disk Recorder - or write a full featured
  * graphical interface that sits on top of an SVDRP connection.
  *
- * $Id: svdrp.c 1.53 2003/07/26 10:57:33 kls Exp $
+ * $Id: svdrp.c 1.55 2003/08/31 11:24:47 kls Exp $
  */
 
 #include "svdrp.h"
@@ -464,8 +464,30 @@
 
 void cSVDRP::CmdDELC(const char *Option)
 {
-  //TODO combine this with menu action (timers must be updated)
-  Reply(502, "DELC not yet implemented");
+  if (*Option) {
+     if (isnumber(Option)) {
+        cChannel *channel = Channels.GetByNumber(strtol(Option, NULL, 10));
+        if (channel) {
+           for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) {
+               if (timer->Channel() == channel) {
+                  Reply(550, "Channel \"%s\" is in use by timer %d", Option, timer->Index() + 1);
+                  return;
+                  }
+               }
+           Channels.Del(channel);
+           Channels.ReNumber();
+           Channels.Save();
+           isyslog("channel %s deleted", Option);
+           Reply(250, "Channel \"%s\" deleted", Option);
+           }
+        else
+           Reply(501, "Channel \"%s\" not defined", Option);
+        }
+     else
+        Reply(501, "Error in channel number \"%s\"", Option);
+     }
+  else
+     Reply(501, "Missing channel number");
 }
 
 void cSVDRP::CmdDELR(const char *Option)
@@ -1104,6 +1126,8 @@
               isyslog("lost connection to SVDRP client");
               Close();
               }
+           else
+              break;
            }
      if (Setup.SVDRPTimeout && time(NULL) - lastActivity > Setup.SVDRPTimeout) {
         isyslog("timeout on SVDRP connection");
diff -ruNbw vdr-1.2.2/transfer.c vdr-1.2.5pre2/transfer.c
--- vdr-1.2.2/transfer.c	Sun May 18 17:22:09 2003
+++ vdr-1.2.5pre2/transfer.c	Sun Aug 31 14:19:16 2003
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: transfer.c 1.13 2003/05/18 15:22:09 kls Exp $
+ * $Id: transfer.c 1.14 2003/08/31 12:19:16 kls Exp $
  */
 
 #include "transfer.h"
@@ -13,6 +13,7 @@
 // The size of the array used to buffer video data:
 // (must be larger than MINVIDEODATA - see remux.h)
 #define VIDEOBUFSIZE  MEGABYTE(1)
+#define POLLTIMEOUTS_BEFORE_DEVICECLEAR 3
 
 // --- cTransfer -------------------------------------------------------------
 
@@ -67,6 +68,7 @@
 {
   dsyslog("transfer thread started (pid=%d)", getpid());
 
+  int PollTimeouts = 0;
   active = true;
   while (active) {
 
@@ -99,6 +101,7 @@
               while (Result > 0 && active) {
                     cPoller Poller;
                     if (DevicePoll(Poller, 100)) {
+                       PollTimeouts = 0;
                        int w = PlayVideo(p, Result);
                        if (w > 0) {
                           p += w;
@@ -107,6 +110,13 @@
                        else if (w < 0 && FATALERRNO) {
                           LOG_ERROR;
                           break;
+                          }
+                       }
+                    else {
+                       PollTimeouts++;
+                       if (PollTimeouts == POLLTIMEOUTS_BEFORE_DEVICECLEAR) {
+                          dsyslog("clearing device because of consecutive poll timeouts");
+                          DeviceClear();
                           }
                        }
                     }
diff -ruNbw vdr-1.2.2/vdr.c vdr-1.2.5pre2/vdr.c
--- vdr-1.2.2/vdr.c	Sat Aug  2 16:01:32 2003
+++ vdr-1.2.5pre2/vdr.c	Fri Sep  5 15:14:16 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.168 2003/09/05 13:14:16 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;
 
@@ -200,6 +199,10 @@
           case 's': Shutdown = optarg;
                     break;
           case 't': Terminal = optarg;
+                    if (access(Terminal, R_OK | W_OK) < 0) {
+                       fprintf(stderr, "vdr: can't access terminal: %s\n", Terminal);
+                       return 2;
+                       }
                     break;
           case 'V': DisplayVersion = true;
                     break;
@@ -342,16 +345,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:
 
@@ -382,7 +387,7 @@
         const char *msg = "no primary device found - using first device!";
         fprintf(stderr, "vdr: %s\n", msg);
         esyslog("ERROR: %s", msg);
-        if (!cDevice::SetPrimaryDevice(0))
+        if (!cDevice::SetPrimaryDevice(1))
            return 2;
         if (!cDevice::PrimaryDevice()) {
            const char *msg = "no primary device found - giving up!";
@@ -455,8 +460,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 +503,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 +683,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:
