summaryrefslogtreecommitdiff
path: root/cutter.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-02-16 12:20:46 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-02-16 12:20:46 +0100
commit26d2fe51d139362a99d76a90de490138dea7477e (patch)
treeb8296cdd1cdeca748b5d4be7fc72ddbc4093415a /cutter.c
parent3432b2638c97ec1ac8afa9aa08246d221e2f89a5 (diff)
downloadvdr-26d2fe51d139362a99d76a90de490138dea7477e.tar.gz
vdr-26d2fe51d139362a99d76a90de490138dea7477e.tar.bz2
An ongoing editing process is now canceled if either the original or the edited version of the recording is deleted from the Recordings menu
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;
}