summaryrefslogtreecommitdiff
path: root/cutter.c
diff options
context:
space:
mode:
Diffstat (limited to 'cutter.c')
-rw-r--r--cutter.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/cutter.c b/cutter.c
index f4df7fe9..320d554c 100644
--- a/cutter.c
+++ b/cutter.c
@@ -4,10 +4,11 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: cutter.c 2.10 2011/12/04 12:55:53 kls Exp $
+ * $Id: cutter.c 2.11 2012/02/16 12:08:39 kls Exp $
*/
#include "cutter.h"
+#include "menu.h"
#include "recording.h"
#include "remux.h"
#include "videodir.h"
@@ -197,7 +198,8 @@ void cCuttingThread::Action(void)
// --- cCutter ---------------------------------------------------------------
cMutex cCutter::mutex;
-char *cCutter::editedVersionName = NULL;
+cString cCutter::originalVersionName;
+cString cCutter::editedVersionName;
cCuttingThread *cCutter::cuttingThread = NULL;
bool cCutter::error = false;
bool cCutter::ended = false;
@@ -208,6 +210,7 @@ bool cCutter::Start(const char *FileName)
if (!cuttingThread) {
error = false;
ended = false;
+ originalVersionName = FileName;
cRecording Recording(FileName);
cMarks FromMarks;
@@ -229,7 +232,7 @@ bool cCutter::Start(const char *FileName)
}
free(s);
// XXX
- editedVersionName = strdup(evn);
+ editedVersionName = evn;
Recording.WriteInfo();
Recordings.AddByName(editedVersionName, false);
cuttingThread = new cCuttingThread(FileName, editedVersionName);
@@ -246,27 +249,29 @@ void cCutter::Stop(void)
const char *Error = cuttingThread ? cuttingThread->Error() : NULL;
delete cuttingThread;
cuttingThread = NULL;
- if ((Interrupted || Error) && editedVersionName) {
+ if ((Interrupted || Error) && *editedVersionName) {
if (Interrupted)
isyslog("editing process has been interrupted");
if (Error)
esyslog("ERROR: '%s' during editing process", Error);
- RemoveVideoFile(editedVersionName); //XXX what if this file is currently being replayed?
+ if (cReplayControl::NowReplaying() && strcmp(cReplayControl::NowReplaying(), editedVersionName) == 0)
+ cControl::Shutdown();
+ RemoveVideoFile(editedVersionName);
Recordings.DelByName(editedVersionName);
}
}
-bool cCutter::Active(void)
+bool cCutter::Active(const char *FileName)
{
cMutexLock MutexLock(&mutex);
if (cuttingThread) {
if (cuttingThread->Active())
- return true;
+ return !FileName || strcmp(FileName, originalVersionName) == 0 || strcmp(FileName, editedVersionName) == 0;
error = cuttingThread->Error();
Stop();
if (!error)
cRecordingUserCommand::InvokeCommand(RUC_EDITEDRECORDING, editedVersionName);
- free(editedVersionName);
+ originalVersionName = NULL;
editedVersionName = NULL;
ended = true;
}