1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Moved any locking from cutter.c into recording.c

This commit is contained in:
Klaus Schmidinger 2018-01-16 14:11:40 +01:00
parent e7936c8595
commit ae41be85c8
3 changed files with 14 additions and 13 deletions

View File

@ -9162,7 +9162,7 @@ Video Disk Recorder Revision History
a subdirectory.
- SVDRP peering can now be limited to the default SVDRP host (see MANUAL for details).
2017-12-15: Version 2.3.9
2018-01-16: Version 2.3.9
- Updated the Italian OSD texts (thanks to Diego Pierotto).
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
@ -9234,11 +9234,11 @@ Video Disk Recorder Revision History
new location of the recording, but rather stays in the original folder (suggested by
Matthias Senzel). If the original folder got empty by moving away the last recording
it contained, the cursor is moved up until a non empty folder is found.
- Moved adding the name of the edited recording into the cutting thread, to avoid a
problem with locking the Recordings list (reported by Matthias Senzel).
- Changed the log message ""ERROR: copying directory '%s' to '%s' ended prematurely" from
"error" to "info", because any actual error would have already been reported before this
(suggested by Matthias Senzel).
- When selecting a folder for a recording or timer, it is now possible to open a folder
even if it doesn't contain any subfolders (suggested by Matthias Senzel).
- Fixed a possible deadlock when detaching a receiver from a device.
- Moved any locking from cutter.c into recording.c, to avoid a problem with locking
the Recordings list (reported by Matthias Senzel).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: cutter.c 4.4 2017/12/14 14:09:46 kls Exp $
* $Id: cutter.c 4.5 2018/01/16 14:09:14 kls Exp $
*/
#include "cutter.h"
@ -222,7 +222,6 @@ 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;
@ -287,7 +286,6 @@ 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);
@ -605,10 +603,6 @@ 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:
@ -707,8 +701,6 @@ void cCutter::Stop(void)
if (cReplayControl::NowReplaying() && strcmp(cReplayControl::NowReplaying(), editedVersionName) == 0)
cControl::Shutdown();
cVideoDirectory::RemoveVideoFile(editedVersionName);
LOCK_RECORDINGS_WRITE;
Recordings->DelByName(editedVersionName);
}
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.c 4.16 2018/01/16 11:09:26 kls Exp $
* $Id: recording.c 4.17 2018/01/16 14:07:04 kls Exp $
*/
#include "recording.h"
@ -1908,6 +1908,7 @@ bool cRecordingsHandlerEntry::Active(cRecordings *Recordings)
// Now check if there is something to start:
if ((Usage() & ruPending) != 0) {
if ((Usage() & ruCut) != 0) {
Recordings->AddByName(FileNameDst(), false);
cutter = new cCutter(FileNameSrc());
cutter->Start();
}
@ -1932,6 +1933,14 @@ bool cRecordingsHandlerEntry::Active(cRecordings *Recordings)
void cRecordingsHandlerEntry::Cleanup(cRecordings *Recordings)
{
if ((usage & ruCut)) { // this was a cut operation...
if (cutter) { // ...which had not yet ended
delete cutter;
cutter = NULL;
}
cVideoDirectory::RemoveVideoFile(fileNameDst);
Recordings->DelByName(fileNameDst);
}
if ((usage & (ruMove | ruCopy)) // this was a move/copy operation...
&& ((usage & ruPending) // ...which had not yet started...
|| copier // ...or not yet finished...