diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2017-12-14 14:17:35 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2017-12-14 14:17:35 +0100 |
commit | 630cc496ea18d1f4958e650a60af3bcae61cbfb3 (patch) | |
tree | 9879f917dfe2506958ff9da522ba662950faaec6 /cutter.c | |
parent | c3af5a69da00d5474c0dc480d1b6cfa55fee7b14 (diff) | |
download | vdr-630cc496ea18d1f4958e650a60af3bcae61cbfb3.tar.gz vdr-630cc496ea18d1f4958e650a60af3bcae61cbfb3.tar.bz2 |
Moved adding the name of the edited recording into the cutting thread, to avoid a problem with locking the Recordings list
Diffstat (limited to 'cutter.c')
-rw-r--r-- | cutter.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: cutter.c 4.3 2017/05/21 09:45:06 kls Exp $ + * $Id: cutter.c 4.4 2017/12/14 14:09:46 kls Exp $ */ #include "cutter.h" @@ -222,6 +222,7 @@ void cMpeg2Fixer::AdjTref(int TrefOffset) class cCuttingThread : public cThread { private: + cString editedVersionName; // we add the edited version's name to Recordings only after the cutting process has successfully started, so we need to store that name here const char *error; bool isPesRecording; double framesPerSecond; @@ -286,6 +287,7 @@ cCuttingThread::cCuttingThread(const char *FromFileName, const char *ToFileName) if (fromMarks.Load(FromFileName, framesPerSecond, isPesRecording) && fromMarks.Count()) { numSequences = fromMarks.GetNumSequences(); if (numSequences > 0) { + editedVersionName = ToFileName; fromFileName = new cFileName(FromFileName, false, true, isPesRecording); toFileName = new cFileName(ToFileName, true, true, isPesRecording); fromIndex = new cIndexFile(FromFileName, false, isPesRecording); @@ -603,6 +605,10 @@ void cCuttingThread::Action(void) toFile = toFileName->Open(); if (!fromFile || !toFile) return; + { + LOCK_RECORDINGS_WRITE; + Recordings->AddByName(editedVersionName, false); + } int LastEndIndex = -1; while (BeginMark && Running()) { // Suspend cutting if we have severe throughput problems: @@ -677,8 +683,6 @@ bool cCutter::Start(void) cRecordingUserCommand::InvokeCommand(RUC_EDITINGRECORDING, editedVersionName, originalVersionName); if (cVideoDirectory::RemoveVideoFile(editedVersionName) && MakeDirs(editedVersionName, true)) { Recording.WriteInfo(editedVersionName); - LOCK_RECORDINGS_WRITE; - Recordings->AddByName(editedVersionName, false); cuttingThread = new cCuttingThread(originalVersionName, editedVersionName); return true; } |