summaryrefslogtreecommitdiff
path: root/transfer.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 /transfer.c
parent1921c7465fd72d8507b11230729754a17761c7e1 (diff)
downloadvdr-ccb0add798961ce2fa24f625a00106cb0d3df709.tar.gz
vdr-ccb0add798961ce2fa24f625a00106cb0d3df709.tar.bz2
Centralized 'thread active' handling
Diffstat (limited to 'transfer.c')
-rw-r--r--transfer.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/transfer.c b/transfer.c
index c214b88f..89143c47 100644
--- a/transfer.c
+++ b/transfer.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: transfer.c 1.28 2005/02/19 14:38:55 kls Exp $
+ * $Id: transfer.c 1.29 2005/08/13 11:19:46 kls Exp $
*/
#include "transfer.h"
@@ -21,7 +21,6 @@ cTransfer::cTransfer(int VPid, const int *APids, const int *DPids, const int *SP
ringBuffer = new cRingBufferLinear(TRANSFERBUFSIZE, TS_SIZE * 2, true, "Transfer");
remux = new cRemux(VPid, APids, Setup.UseDolbyDigital ? DPids : NULL, SPids);
needsBufferReserve = Setup.UseDolbyDigital && VPid != 0 && DPids && DPids[0] != 0;
- active = false;
}
cTransfer::~cTransfer()
@@ -34,21 +33,17 @@ cTransfer::~cTransfer()
void cTransfer::Activate(bool On)
{
- if (On) {
- if (!active)
- Start();
- }
- else if (active) {
- active = false;
+ if (On)
+ Start();
+ else
Cancel(3);
- }
}
void cTransfer::Receive(uchar *Data, int Length)
{
- if (IsAttached() && active) {
+ if (IsAttached() && Active()) {
int p = ringBuffer->Put(Data, Length);
- if (p != Length && active)
+ if (p != Length && Active())
ringBuffer->ReportOverflow(Length - p);
return;
}
@@ -70,8 +65,7 @@ void cTransfer::Action(void)
bool GotBufferReserve = false;
int RequiredBufferReserve = KILOBYTE(DvbCardWith4MBofSDRAM ? 288 : 576);
#endif
- active = true;
- while (active) {
+ while (Active()) {
#ifdef FW_NEEDS_BUFFER_RESERVE_FOR_AC3
if (needsBufferReserve && !GotBufferReserve) {
//XXX For dolby we've to fill the buffer because the firmware does
@@ -145,7 +139,6 @@ void cTransfer::Action(void)
}
}
}
- active = false;
}
// --- cTransferControl ------------------------------------------------------