summaryrefslogtreecommitdiff
path: root/cutter.c
diff options
context:
space:
mode:
Diffstat (limited to 'cutter.c')
-rw-r--r--cutter.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/cutter.c b/cutter.c
index e83c5ac1..ff6b4edb 100644
--- a/cutter.c
+++ b/cutter.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: cutter.c 2.3 2009/04/19 10:56:33 kls Exp $
+ * $Id: cutter.c 2.4 2010/01/02 13:08:08 kls Exp $
*/
#include "cutter.h"
@@ -274,3 +274,31 @@ bool cCutter::Ended(void)
ended = false;
return result;
}
+
+#define CUTTINGCHECKINTERVAL 500 // ms between checks for the active cutting process
+
+bool CutRecording(const char *FileName)
+{
+ if (DirectoryOk(FileName)) {
+ cRecording Recording(FileName);
+ if (Recording.Name()) {
+ cMarks Marks;
+ if (Marks.Load(FileName, Recording.FramesPerSecond(), Recording.IsPesRecording()) && Marks.Count()) {
+ if (cCutter::Start(FileName)) {
+ while (cCutter::Active())
+ cCondWait::SleepMs(CUTTINGCHECKINTERVAL);
+ return true;
+ }
+ else
+ fprintf(stderr, "can't start editing process\n");
+ }
+ else
+ fprintf(stderr, "'%s' has no editing marks\n", FileName);
+ }
+ else
+ fprintf(stderr, "'%s' is not a recording\n", FileName);
+ }
+ else
+ fprintf(stderr, "'%s' is not a directory\n", FileName);
+ return false;
+}