mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Centralized 'thread active' handling
This commit is contained in:
21
transfer.c
21
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 ------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user