--- vdr-1.3.31-orig/cutter.h	2002-06-22 13:03:15.000000000 +0300
+++ vdr-1.3.31/cutter.h	2005-09-08 07:06:37.000000000 +0300
@@ -11,6 +11,7 @@
 #define __CUTTER_H
 
 class cCuttingThread;
+class cMutex;
 
 class cCutter {
 private:
@@ -18,6 +19,7 @@
   static cCuttingThread *cuttingThread;
   static bool error;
   static bool ended;
+  static cMutex *cutterLock;
 public:
   static bool Start(const char *FileName);
   static void Stop(void);
--- vdr-1.3.31-orig/cutter.c	2005-08-14 13:51:54.000000000 +0300
+++ vdr-1.3.31/cutter.c	2005-09-20 12:26:03.000000000 +0300
@@ -176,13 +222,55 @@
 
 // --- cCutter ---------------------------------------------------------------
 
+#define WAIT_BEFORE_NEXT_CUT   (10*1000)  // 10 seconds
+
+#define CUTTER_QUEUE
+#define CUTTER_AUTO_DELETE
+
+class cStringListObject : public cListObject {
+  public:
+    cStringListObject(const char *s) { str = strdup(s); }
+    ~cStringListObject() { free(str); }
+
+    const char *Value() { return str; }
+    operator const char * () { return str; }
+
+  private:  
+    char *str;
+};
+
 char *cCutter::editedVersionName = NULL;
 cCuttingThread *cCutter::cuttingThread = NULL;
 bool cCutter::error = false;
 bool cCutter::ended = false;
+cMutex *cCutter::cutterLock = new cMutex();
+
+static uint64 /*cCutter::*/lastCuttingEndTime = 0;
+static cList<cStringListObject> /**cCutter::*/cutterQueue /*= new cList<cStringListObject>*/;
 
 bool cCutter::Start(const char *FileName)
 {
+  cMutexLock(cutterLock);
+
+#ifdef CUTTER_QUEUE
+  if(FileName) {
+    /* Add file to queue.
+     * If cutter is still active, next cutting will be started 
+     * when vdr.c:main calls cCutter::Active and previous cutting has 
+     * been stopped > 10 s before 
+     */
+    cutterQueue.Add(new cStringListObject(FileName));
+  }
+
+  if (cuttingThread) 
+    return true;
+
+  /* cut next file from queue */
+  if(!(cutterQueue.First()))
+    return false;
+  FileName = cutterQueue.First()->Value();
+#endif
+
   if (!cuttingThread) {
      error = false;
      ended = false;
@@ -213,6 +301,8 @@
 
 void cCutter::Stop(void)
 {
+  cMutexLock(cutterLock);
+
   bool Interrupted = cuttingThread && cuttingThread->Active();
   const char *Error = cuttingThread ? cuttingThread->Error() : NULL;
   delete cuttingThread;
@@ -224,11 +314,19 @@
         esyslog("ERROR: '%s' during editing process", Error);
      RemoveVideoFile(editedVersionName); //XXX what if this file is currently being replayed?
      Recordings.DelByName(editedVersionName);
+#ifdef CUTTER_QUEUE
+     cutterQueue.Del(cutterQueue.First());
+#endif
      }
+#ifdef CUTTER_QUEUE
+  lastCuttingEndTime = cTimeMs::Now();
+#endif
 }
 
 bool cCutter::Active(void)
 {
+  cMutexLock(cutterLock);
+
   if (cuttingThread) {
      if (cuttingThread->Active())
         return true;
@@ -239,12 +337,39 @@
      free(editedVersionName);
      editedVersionName = NULL;
      ended = true;
+#ifdef CUTTER_AUTO_DELETE
+     /* Remove original (if cutting was successful) */
+     if(!error) {
+       cRecording *recording = Recordings.GetByName(*cutterQueue.First());
+       if (!recording) {
+	 esyslog("ERROR: Can't found '%s' after editing process", cutterQueue.First()->Value());
+       } else {
+	 if (recording->Delete()) 
+	   Recordings.Del(recording);
+	 else
+	   esyslog("ERROR: Can't delete '%s' after editing process", cutterQueue.First()->Value());
+       }
+     }
+    lastCuttingEndTime = cTimeMs::Now();
+#endif
+#ifdef CUTTER_QUEUE
+     cutterQueue.Del(cutterQueue.First());
+#endif
      }
+#ifdef CUTTER_QUEUE
+  if(!cuttingThread && cutterQueue.First()) {
+    /* start next cutting from queue*/
+    if(cTimeMs::Now() > lastCuttingEndTime + WAIT_BEFORE_NEXT_CUT)
+      Start(NULL);
+  }
+#endif
+
   return false;
 }
 
 bool cCutter::Error(void)
 {
+  cMutexLock(cutterLock);
   bool result = error;
   error = false;
   return result;
@@ -252,6 +377,7 @@
 
 bool cCutter::Ended(void)
 {
+  cMutexLock(cutterLock);
   bool result = ended;
   ended = false;
   return result;
--- vdr-1.3.31-orig/menu.c	2005-08-27 12:37:23.000000000 +0300
+++ vdr-1.3.31/menu.c	2005-09-20 12:13:09.000000000 +0300
@@ -3599,7 +3601,11 @@
 {
   if (fileName) {
      Hide();
+#if 0
      if (!cCutter::Active()) {
+#else
+     if (!cCutter::Active() || Interface->Confirm(tr("Cutter already running - Add to cutting queue?"))) {
+#endif
         if (!marks.Count())
            Skins.Message(mtError, tr("No editing marks defined!"));
         else if (!cCutter::Start(fileName))
