summaryrefslogtreecommitdiff
path: root/cutter.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-08-13 13:17:24 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2005-08-13 13:17:24 +0200
commitccb0add798961ce2fa24f625a00106cb0d3df709 (patch)
tree43e50aa8938a53236d90e260700e83296b26987d /cutter.c
parent1921c7465fd72d8507b11230729754a17761c7e1 (diff)
downloadvdr-ccb0add798961ce2fa24f625a00106cb0d3df709.tar.gz
vdr-ccb0add798961ce2fa24f625a00106cb0d3df709.tar.bz2
Centralized 'thread active' handling
Diffstat (limited to 'cutter.c')
-rw-r--r--cutter.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/cutter.c b/cutter.c
index 82c7fe5b..59c6fb86 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 1.8 2005/05/15 14:21:08 kls Exp $
+ * $Id: cutter.c 1.9 2005/08/13 11:49:02 kls Exp $
*/
#include "cutter.h"
@@ -18,7 +18,6 @@
class cCuttingThread : public cThread {
private:
const char *error;
- bool active;
int fromFile, toFile;
cFileName *fromFileName, *toFileName;
cIndexFile *fromIndex, *toIndex;
@@ -35,7 +34,6 @@ cCuttingThread::cCuttingThread(const char *FromFileName, const char *ToFileName)
:cThread("video cutting")
{
error = NULL;
- active = false;
fromFile = toFile = -1;
fromFileName = toFileName = NULL;
fromIndex = toIndex = NULL;
@@ -53,7 +51,6 @@ cCuttingThread::cCuttingThread(const char *FromFileName, const char *ToFileName)
cCuttingThread::~cCuttingThread()
{
- active = false;
Cancel(3);
delete fromFileName;
delete toFileName;
@@ -67,7 +64,8 @@ void cCuttingThread::Action(void)
if (Mark) {
fromFile = fromFileName->Open();
toFile = toFileName->Open();
- active = fromFile >= 0 && toFile >= 0;
+ if (fromFile < 0 || toFile < 0)
+ return;
int Index = Mark->position;
Mark = fromMarks.Next(Mark);
int FileSize = 0;
@@ -78,7 +76,7 @@ void cCuttingThread::Action(void)
uchar buffer[MAXFRAMESIZE];
bool LastMark = false;
bool cutIn = true;
- while (active) {
+ while (Active()) {
uchar FileNumber;
int FileOffset, Length;
uchar PictureType;
@@ -215,7 +213,7 @@ bool cCutter::Start(const char *FileName)
void cCutter::Stop(void)
{
- bool Interrupted = cuttingThread && cuttingThread->Active();
+ bool Interrupted = cuttingThread && cuttingThread->Running();
const char *Error = cuttingThread ? cuttingThread->Error() : NULL;
delete cuttingThread;
cuttingThread = NULL;
@@ -232,7 +230,7 @@ void cCutter::Stop(void)
bool cCutter::Active(void)
{
if (cuttingThread) {
- if (cuttingThread->Active())
+ if (cuttingThread->Running())
return true;
error = cuttingThread->Error();
Stop();