summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2003-02-16 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2003-02-16 18:00:00 +0100
commitb6e4637356502e707fdfc4b97ed1856e08de3df1 (patch)
treed974f0cc0e63083c75e51958cf8ce0e25bd7060e
parentb09aaa00a58ec72d0331a01f31b3df16d43ce90b (diff)
downloadvdr-patch-lnbsharing-b6e4637356502e707fdfc4b97ed1856e08de3df1.tar.gz
vdr-patch-lnbsharing-b6e4637356502e707fdfc4b97ed1856e08de3df1.tar.bz2
Version 1.1.25vdr-1.1.25
- Fixed high CPU load during replay (thanks to Marcel Wiesweg for pointing out this one). - Fixed margin handling in cRingBufferLinear. - Now polling the output device in 'Transfer Mode' and retrying to put packets into the ring buffer. - Resetting the CAM slot in case communication breaks down. - Improved keyboard detection (thanks to Werner Fink). - Updated 'channels.conf.terr' (thanks to Andy Carter). - Fixed broken support for raw OSDs of plugins (thanks to Marcel Wiesweg for reporting this one). - Broken CAM connections are now restored automatically.
-rw-r--r--CONTRIBUTORS5
-rw-r--r--HISTORY14
-rw-r--r--channels.conf.terr63
-rw-r--r--ci.c20
-rw-r--r--ci.h4
-rw-r--r--config.h4
-rw-r--r--dvbdevice.c74
-rw-r--r--dvbplayer.c6
-rw-r--r--ringbuffer.c15
-rw-r--r--transfer.c34
-rw-r--r--vdr.c6
11 files changed, 149 insertions, 96 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index a6663d9..fe70f1a 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -217,6 +217,7 @@ Werner Fink <werner@suse.de>
contains Dolby Digital data
for improving thread locking in the ring buffer to avoid possible race conditions
under heavy load
+ for improving keyboard detection
Rolf Hakenes <hakenes@hippomi.de>
for providing 'libdtv' and adapting the EIT mechanisms to it
@@ -539,3 +540,7 @@ Teemu Rantanen <tvr@iki.fi>
Jan Ekholm <chakie@infa.abo.fi>
for adding/improving some Swedish language OSD texts
+
+Marcel Wiesweg <marcel.wiesweg@gmx.de>
+ for pointing out a problem with high CPU load during replay
+ for reporting broken support for raw OSDs of plugins
diff --git a/HISTORY b/HISTORY
index 9369366..50e5bf5 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1956,3 +1956,17 @@ Video Disk Recorder Revision History
- Turning SI filtering off and on when switching channels.
- Timers are now processed even if an OSD menu is open (except for menus that
explicitly handle timers).
+
+2003-02-16: Version 1.1.25
+
+- Fixed high CPU load during replay (thanks Marcel Wiesweg for pointing out this
+ one).
+- Fixed margin handling in cRingBufferLinear.
+- Now polling the output device in 'Transfer Mode' and retrying to put packets
+ into the ring buffer.
+- Resetting the CAM slot in case communication breaks down.
+- Improved keyboard detection (thanks to Werner Fink).
+- Updated 'channels.conf.terr' (thanks to Andy Carter).
+- Fixed broken support for raw OSDs of plugins (thanks to Marcel Wiesweg for
+ reporting this one).
+- Broken CAM connections are now restored automatically.
diff --git a/channels.conf.terr b/channels.conf.terr
index f48d566..b618319 100644
--- a/channels.conf.terr
+++ b/channels.conf.terr
@@ -1,43 +1,50 @@
: UK channels for Crystal Palace, London
-BBC ONE (TV):505833:I0C34D0M16B8T2G32Y0:T:27500:600:601,602:602:0:4164:0:0:0
-BBC TWO (TV):505833:I0C34D0M16B8T2G32Y0:T:27500:610:611,612:0:2:4228:0:0:0
-BBC THREE (TV):505833:I0C34D0M16B8T2G32Y0:T:27500:620:621,622:0:0:4351:0:0:0
+701 (TV):529833:I0C34D0M16B8T2G32Y0:T:27500:203:407:0:0:19456:0:0:0
+702 (TV):529833:I0C34D0M16B8T2G32Y0:T:27500:204:411,412:0:0:19520:0:0:0
+BBC FOUR (TV):529833:I0C34D0M16B8T2G32Y0:T:27500:201:401,402:0:0:16832:0:0:0
BBC NEWS 24 (TV):505833:I0C34D0M16B8T2G32Y0:T:27500:640:641:0:0:4415:0:0:0
-Ch 14 (TV):481833:I0C23D0M64B8T2G32Y0:T:27500:2840:2841,2843:0:0:8800:0:0:0
-ITV 2 (TV):481833:I0C23D0M64B8T2G32Y0:T:27500:2818:2819,2821:0:0:8325:0:0:0
-ITV 1 (TV):481833:I0C23D0M64B8T2G32Y0:T:27500:512:650,660:0:0:8261:0:0:0
+BBC ONE (TV):505833:I0C34D0M16B8T2G32Y0:T:27500:600:601,602:0:0:4164:0:0:0
+BBC THREE (TV):505833:I0C34D0M16B8T2G32Y0:T:27500:620:621,622:0:0:4351:0:0:0
+BBC TWO (TV):505833:I0C34D0M16B8T2G32Y0:T:27500:610:611,612:0:2:4228:0:0:0
+bid-up.tv (TV):561833:I0C23D0M64B8T2G32Y0:T:27500:6273:6274:0:0:14272:0:0:0
+CBBC (TV):505833:I0C34D0M16B8T2G32Y0:T:27500:620:621,622:0:0:4671:0:0:0
+Cbeebies (TV):529833:I0C34D0M16B8T2G32Y0:T:27500:201:401,402:0:0:16960:0:0:0
+Ch 14 (TV):481833:I0C23D0M64B8T2G32Y0:T:27500:2840:2841:2843:0:0:8800:0:0
+Ch 32 (TV):537833:I0C34D0M16B8T2G32Y0:T:27500:501:502,504:0:0:25984:0:0:0
+Ch 44 (TV):537833:I0C34D0M16B8T2G32Y0:T:27500:501:502,504:0:0:26048:0:0:0
Channel 4 (TV):481833:I0C23D0M64B8T2G32Y0:T:27500:2827:2828,2830:0:0:8384:0:0:0
+f tn (TV):537833:I0C34D0M16B8T2G32Y0:T:27500:301:302,304:0:0:25856:0:0:0
five (TV):561833:I0C23D0M64B8T2G32Y0:T:27500:6017:6018,6019:0:0:12866:0:0:0
+ITV 1 (TV):481833:I0C23D0M64B8T2G32Y0:T:27500:512:650,660:0:0:8261:0:0:0
+ITV 2 (TV):481833:I0C23D0M64B8T2G32Y0:T:27500:2818:2819,2821:0:0:8325:0:0:0
+ITV News (TV):481833:I0C23D0M64B8T2G32Y0:T:27500:2850:2851:0:0:8581:0:0:0
QVC (TV):561833:I0C23D0M64B8T2G32Y0:T:27500:6049:6050:0:0:13120:0:0:0
-TV Travel Shop (TV):561833:I0C23D0M64B8T2G32Y0:T:27500:6161:6162:0:0:13632:0:0:0
-ITV News (TV):561833:I0C23D0M64B8T2G32Y0:T:27500:6193:6194:0:0:13760:0:0:0
-BBC PARLMNT (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:403:0:0:16768:0:0:0
-BBC FOUR (TV):529833:I0C34D0M16B8T2G32Y0:T:27500:201:401,402:0:0:16832:0:0:0
-BBC R5 Live (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:430:0:0:17920:0:0:0
-BBC 5L SportsX (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:431:0:0:17984:0:0:0
-BBC 6 Music (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:432:0:0:18048:0:0:0
-BBC 7 (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:433:0:0:18112:0:0:0
-1Xtra BBC (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:434:0:0:18176:0:0:0
-BBC Asian Net. (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:435:0:0:18240:0:0:0
-701 (TV):529833:I0C34D0M16B8T2G32Y0:T:27500:203:407:0:0:19456:0:0:0
-702 (TV):529833:I0C34D0M16B8T2G32Y0:T:27500:204:411:0:0:19520:0:0:0
Sky News (TV):578166:I0C34D0M16B8T2G32Y0:T:27500:101:102,104:0:0:22080:0:0:0
Sky Spts News (TV):578166:I0C34D0M16B8T2G32Y0:T:27500:201:202,204:0:0:22144:0:0:0
Sky Travel (TV):578166:I0C34D0M16B8T2G32Y0:T:27500:301:302,304:0:0:22208:0:0:0
-UKHistory (TV):578166:I0C34D0M16B8T2G32Y0:T:27500:401:402,404:0:0:22272:0:0:0
THE HITS (TV):537833:I0C34D0M16B8T2G32Y0:T:27500:101:102:0:0:25664:0:0:0
TMF (TV):537833:I0C34D0M16B8T2G32Y0:T:27500:201:202,204:0:0:25728:0:0:0
-UKHomeStyle (TV):537833:I0C34D0M16B8T2G32Y0:T:27500:301:302,306:0:0:25792:0:0:0
-f tn (TV):537833:I0C34D0M16B8T2G32Y0:T:27500:301:302,304:0:0:25856:0:0:0
-Ch 44 (TV):537833:I0C34D0M16B8T2G32Y0:T:27500:501:502,504:0:0:26048:0:0:0
-Smash Hits! (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1201:0:0:26240:0:0:0
-KISS (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1101:0:0:26176:0:0:0
-Kerrang! (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1301:0:0:26304:0:0:0
+TV Travel Shop (TV):561833:I0C23D0M64B8T2G32Y0:T:27500:6161:6162:0:0:13632:0:0:0
+UKBrightIdeas (TV):537833:I0C34D0M16B8T2G32Y0:T:27500:301:302,304:0:0:25792:0:0:0
+UKHistory (TV):578166:I0C34D0M16B8T2G32Y0:T:27500:401:402,404:0:0:22272:0:0:0
+1Xtra BBC (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:434:0:0:18176:0:0:0
+BBC 5L SportsX (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:431:0:0:17984:0:0:0
+BBC 6 Music (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:432:0:0:18048:0:0:0
+BBC 7 (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:433:0:0:18112:0:0:0
+BBC Asian Net. (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:435:0:0:18240:0:0:0
+BBC PARLMNT (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:403:0:0:16768:0:0:0
+BBC R5 Live (RADIO):529833:I0C34D0M16B8T2G32Y0:T:27500:0:430:0:0:17920:0:0:0
+BBC Radio 1 (RADIO):561833:I0C23D0M64B8T2G32Y0:T:27500:0:6210:0:0:14336:0:0:0
+BBC Radio 2 (RADIO):561833:I0C23D0M64B8T2G32Y0:T:27500:0:6226:0:0:14400:0:0:0
+BBC Radio 3 (RADIO):561833:I0C23D0M64B8T2G32Y0:T:27500:0:6242:0:0:14464:0:0:0
+BBC Radio 4 (RADIO):561833:I0C23D0M64B8T2G32Y0:T:27500:0:6258:0:0:14528:0:0:0
+BBC World Sv (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1601:0:0:26496:0:0:0
+Ch 15 (RADIO):561833:I0C23D0M64B8T2G32Y0:T:27500:0:660:0:0:14208:0:0:0
jazz fm (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1401:0:0:26368:0:0:0
+Kerrang! (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1301:0:0:26304:0:0:0
+KISS (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1101:0:0:26176:0:0:0
oneword (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1501:0:0:26432:0:0:0
-BBC World Sv (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1601:0:0:26496:0:0:0
-Ch 22 (TV):537833:I0C34D0M16B8T2G32Y0:T:27500:501:502,504:0:0:26048:0:0:1
-Ch 32 (TV):537833:I0C34D0M16B8T2G32Y0:T:27500:501:502,504:0:0:25984:0:0:0
+Smash Hits! (RADIO):537833:I0C34D0M16B8T2G32Y0:T:27500:0:1201:0:0:26240:0:0:0
: DVB-T Berlin Germany
PRO 7:658000:I0C23D0M16B8T8G8Y0:T:27500:305:306;307:0:0:16403:0:0:0
SAT 1:658000:I0C23D0M16B8T8G8Y0:T:27500:385:386:0:0:16408:0:0:0
diff --git a/ci.c b/ci.c
index c2e10fc..d345a3e 100644
--- a/ci.c
+++ b/ci.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: ci.c 1.5 2003/02/09 14:47:57 kls Exp $
+ * $Id: ci.c 1.7 2003/02/16 11:20:55 kls Exp $
*/
/* XXX TODO
@@ -1423,8 +1423,9 @@ int cCiHandler::CloseAllSessions(int Slot)
return result;
}
-void cCiHandler::Process(void)
+bool cCiHandler::Process(void)
{
+ bool result = true;
cMutexLock MutexLock(&mutex);
for (int Slot = 0; Slot < numSlots; Slot++) {
tc = tpl->Process(Slot);
@@ -1453,19 +1454,20 @@ void cCiHandler::Process(void)
}
}
}
- else {
- if (!CloseAllSessions(Slot)) {
- if (tpl->ModuleReady(Slot)) {
- dbgprotocol("Module ready in slot %d\n", Slot);
- tpl->NewConnection(Slot);
- }
- }
+ else if (CloseAllSessions(Slot)) {
+ tpl->ResetSlot(Slot);
+ result = false;
+ }
+ else if (tpl->ModuleReady(Slot)) {
+ dbgprotocol("Module ready in slot %d\n", Slot);
+ tpl->NewConnection(Slot);
}
}
for (int i = 0; i < MAX_CI_SESSION; i++) {
if (sessions[i])
sessions[i]->Process();
}
+ return result;
}
bool cCiHandler::EnterMenu(int Slot)
diff --git a/ci.h b/ci.h
index 5d33b61..255292a 100644
--- a/ci.h
+++ b/ci.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: ci.h 1.2 2003/02/09 11:44:00 kls Exp $
+ * $Id: ci.h 1.3 2003/02/16 10:55:21 kls Exp $
*/
#ifndef __CI_H
@@ -95,7 +95,7 @@ private:
public:
~cCiHandler();
static cCiHandler *CreateCiHandler(const char *FileName);
- void Process(void);
+ bool Process(void);
bool EnterMenu(int Slot);
cCiMenu *GetMenu(void);
cCiEnquiry *GetEnquiry(void);
diff --git a/config.h b/config.h
index 1760eed..d050516 100644
--- a/config.h
+++ b/config.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.h 1.148 2003/02/08 10:25:44 kls Exp $
+ * $Id: config.h 1.149 2003/02/15 11:01:04 kls Exp $
*/
#ifndef __CONFIG_H
@@ -19,7 +19,7 @@
#include "device.h"
#include "tools.h"
-#define VDRVERSION "1.1.24"
+#define VDRVERSION "1.1.25"
#define MAXPRIORITY 99
#define MAXLIFETIME 99
diff --git a/dvbdevice.c b/dvbdevice.c
index e587f69..ba60870 100644
--- a/dvbdevice.c
+++ b/dvbdevice.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbdevice.c 1.44 2003/02/09 12:41:14 kls Exp $
+ * $Id: dvbdevice.c 1.46 2003/02/16 15:10:39 kls Exp $
*/
#include "dvbdevice.h"
@@ -65,7 +65,7 @@ static int DvbOpen(const char *Name, int n, int Mode, bool ReportError = false)
class cDvbTuner : public cThread {
private:
- enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked };
+ enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked, tsCam };
int fd_frontend;
int cardIndex;
fe_type_t frontendType;
@@ -73,8 +73,8 @@ private:
cChannel channel;
const char *diseqcCommands;
bool active;
+ time_t startTime;
eTunerStatus tunerStatus;
- bool caSet;
cMutex mutex;
cCondVar newSet;
bool SetFrontend(void);
@@ -96,7 +96,7 @@ cDvbTuner::cDvbTuner(int Fd_Frontend, int CardIndex, fe_type_t FrontendType, cCi
diseqcCommands = NULL;
active = false;
tunerStatus = tsIdle;
- caSet = false;
+ startTime = time(NULL);
Start();
}
@@ -119,7 +119,10 @@ void cDvbTuner::Set(const cChannel *Channel, bool Tune)
channel = *Channel;
if (Tune)
tunerStatus = tsSet;
- caSet = false;
+ else if (tunerStatus == tsCam)
+ tunerStatus = tsTuned;
+ if (Channel->Ca())
+ startTime = time(NULL);
newSet.Broadcast();
}
@@ -238,7 +241,6 @@ bool cDvbTuner::SetFrontend(void)
void cDvbTuner::Action(void)
{
- time_t StartTime = time(NULL);
dsyslog("tuner thread started on device %d (pid=%d)", cardIndex + 1, getpid());
active = true;
while (active) {
@@ -251,36 +253,46 @@ void cDvbTuner::Action(void)
if (status & FE_HAS_LOCK)
tunerStatus = tsLocked;
}
- dvb_frontend_event event;
- if (ioctl(fd_frontend, FE_GET_EVENT, &event) == 0) {
- if (tunerStatus != tsIdle && event.status & FE_REINIT) {
- tunerStatus = tsSet;
- esyslog("ERROR: frontend %d was reinitialized - re-tuning", cardIndex);
- continue;
+ if (tunerStatus != tsIdle) {
+ dvb_frontend_event event;
+ if (ioctl(fd_frontend, FE_GET_EVENT, &event) == 0) {
+ if (event.status & FE_REINIT) {
+ tunerStatus = tsSet;
+ esyslog("ERROR: frontend %d was reinitialized - re-tuning", cardIndex);
+ continue;
+ }
}
- }
- if (ciHandler) {
- ciHandler->Process();
- if (!caSet) {//XXX TODO update in case the CA descriptors have changed
- uchar buffer[2048];
- int length = cSIProcessor::GetCaDescriptors(channel.Source(), channel.Frequency(), channel.Sid(), sizeof(buffer), buffer);
- if (length > 0) {
- cCiCaPmt CaPmt(channel.Sid());
- CaPmt.AddCaDescriptor(length, buffer);
- if (channel.Vpid())
- CaPmt.AddPid(channel.Vpid());
- if (channel.Apid1())
- CaPmt.AddPid(channel.Apid1());
- if (channel.Apid2())
- CaPmt.AddPid(channel.Apid2());
- if (channel.Dpid1())
- CaPmt.AddPid(channel.Dpid1());
- caSet = ciHandler->SetCaPmt(CaPmt);
+ if (tunerStatus >= tsLocked) {
+ if (ciHandler) {
+ if (ciHandler->Process()) {
+ if (tunerStatus != tsCam) {//XXX TODO update in case the CA descriptors have changed
+ uchar buffer[2048];
+ int length = cSIProcessor::GetCaDescriptors(channel.Source(), channel.Frequency(), channel.Sid(), sizeof(buffer), buffer);
+ if (length > 0) {
+ cCiCaPmt CaPmt(channel.Sid());
+ CaPmt.AddCaDescriptor(length, buffer);
+ if (channel.Vpid())
+ CaPmt.AddPid(channel.Vpid());
+ if (channel.Apid1())
+ CaPmt.AddPid(channel.Apid1());
+ if (channel.Apid2())
+ CaPmt.AddPid(channel.Apid2());
+ if (channel.Dpid1())
+ CaPmt.AddPid(channel.Dpid1());
+ if (ciHandler->SetCaPmt(CaPmt)) {
+ tunerStatus = tsCam;
+ startTime = 0;
+ }
+ }
+ }
+ }
+ else
+ tunerStatus = tsLocked;
}
}
}
// in the beginning we loop more often to let the CAM connection start up fast
- newSet.TimedWait(mutex, (ciHandler && (time(NULL) - StartTime < 20)) ? 100 : 1000);
+ newSet.TimedWait(mutex, (ciHandler && (time(NULL) - startTime < 20)) ? 100 : 1000);
}
dsyslog("tuner thread ended on device %d (pid=%d)", cardIndex + 1, getpid());
}
diff --git a/dvbplayer.c b/dvbplayer.c
index 1d140ea..5aff351 100644
--- a/dvbplayer.c
+++ b/dvbplayer.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbplayer.c 1.17 2003/01/19 15:43:58 kls Exp $
+ * $Id: dvbplayer.c 1.18 2003/02/15 10:38:59 kls Exp $
*/
#include "dvbplayer.h"
@@ -420,8 +420,6 @@ void cDvbPlayer::Action(void)
running = true;
while (running && (NextFile() || readIndex >= 0 || ringBuffer->Available())) {
cPoller Poller;
- if (!readFrame)
- Poller.Add(replayFile, false);
if (DevicePoll(Poller, 100)) {
LOCK_THREAD;
@@ -532,7 +530,7 @@ void cDvbPlayer::Action(void)
backTrace->Add(playFrame->Index(), playFrame->Count());
ringBuffer->Drop(playFrame);
playFrame = NULL;
- p = 0;
+ p = NULL;
}
}
}
diff --git a/ringbuffer.c b/ringbuffer.c
index 48622f0..9eecbba 100644
--- a/ringbuffer.c
+++ b/ringbuffer.c
@@ -7,7 +7,7 @@
* Parts of this file were inspired by the 'ringbuffy.c' from the
* LinuxDVB driver (see linuxtv.org).
*
- * $Id: ringbuffer.c 1.13 2003/01/26 19:47:10 kls Exp $
+ * $Id: ringbuffer.c 1.14 2003/02/15 13:21:50 kls Exp $
*/
#include "ringbuffer.h"
@@ -34,14 +34,14 @@ cRingBuffer::~cRingBuffer()
void cRingBuffer::WaitForPut(void)
{
putMutex.Lock();
- readyForPut.Wait(putMutex);
+ readyForPut.TimedWait(putMutex, 1000);
putMutex.Unlock();
}
void cRingBuffer::WaitForGet(void)
{
getMutex.Lock();
- readyForGet.Wait(getMutex);
+ readyForGet.TimedWait(getMutex, 10);
getMutex.Unlock();
}
@@ -102,7 +102,7 @@ int cRingBufferLinear::Put(const uchar *Data, int Count)
Lock();
int rest = Size() - head;
int diff = tail - head;
- int free = (diff > 0) ? diff - 1 : Size() + diff - (tail < margin ? -(margin - tail) : margin) - 1;
+ int free = ((tail < margin) ? rest : (diff > 0) ? diff : Size() + diff - margin) - 1;
if (statistics) {
int fill = Size() - free - 1 + Count;
if (fill >= Size())
@@ -136,6 +136,8 @@ int cRingBufferLinear::Put(const uchar *Data, int Count)
Count = 0;
Unlock();
EnableGet();
+ if (Count == 0)
+ WaitForPut();
}
return Count;
}
@@ -147,7 +149,7 @@ const uchar *cRingBufferLinear::Get(int &Count)
if (getThreadPid < 0)
getThreadPid = getpid();
int rest = Size() - tail;
- if (tail > Size() - margin && head < tail) {
+ if (rest < margin && head < tail) {
int t = margin - rest;
memcpy(buffer + t, buffer + tail, rest);
tail = t;
@@ -169,10 +171,13 @@ const uchar *cRingBufferLinear::Get(int &Count)
void cRingBufferLinear::Del(int Count)
{
if (Count > 0 && Count <= lastGet) {
+ Lock();
tail += Count;
lastGet -= Count;
if (tail >= Size())
tail = margin;
+ Unlock();
+ EnablePut();
}
else
esyslog("ERROR: invalid Count in cRingBufferLinear::Del: %d", Count);
diff --git a/transfer.c b/transfer.c
index abcb9d0..4e8c303 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.9 2003/01/26 09:59:35 kls Exp $
+ * $Id: transfer.c 1.10 2003/02/15 14:12:41 kls Exp $
*/
#include "transfer.h"
@@ -50,9 +50,16 @@ void cTransfer::Activate(bool On)
void cTransfer::Receive(uchar *Data, int Length)
{
if (IsAttached()) {
- int p = ringBuffer->Put(Data, Length);
- if (p != Length && active)
- esyslog("ERROR: ring buffer overflow (%d bytes dropped)", Length - p);
+ int i = 0;
+ while (active && Length > 0) {
+ if (i++ > 10) {
+ esyslog("ERROR: ring buffer overflow (%d bytes dropped)", Length);
+ break;
+ }
+ int p = ringBuffer->Put(Data, Length);
+ Length -= p;
+ Data += p;
+ }
}
}
@@ -90,14 +97,17 @@ void cTransfer::Action(void)
if (p) {
StripAudioPackets(p, Result, audioTrack);
while (Result > 0 && active) {
- int w = PlayVideo(p, Result);
- if (w > 0) {
- p += w;
- Result -= w;
- }
- else if (w < 0 && FATALERRNO) {
- LOG_ERROR;
- break;
+ cPoller Poller;
+ if (DevicePoll(Poller, 100)) {
+ int w = PlayVideo(p, Result);
+ if (w > 0) {
+ p += w;
+ Result -= w;
+ }
+ else if (w < 0 && FATALERRNO) {
+ LOG_ERROR;
+ break;
+ }
}
}
}
diff --git a/vdr.c b/vdr.c
index dfaf5dc..3e6a9ed 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
- * $Id: vdr.c 1.143 2003/02/09 13:13:42 kls Exp $
+ * $Id: vdr.c 1.145 2003/02/16 10:34:24 kls Exp $
*/
#include <getopt.h>
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
// Save terminal settings:
struct termios savedTm;
- bool HasStdin = tcgetpgrp(STDIN_FILENO) == getpid() && tcgetattr(STDIN_FILENO, &savedTm) == 0;
+ bool HasStdin = (tcgetpgrp(STDIN_FILENO) == getpid() || getppid() != (pid_t)1) && tcgetattr(STDIN_FILENO, &savedTm) == 0;
// Initiate locale:
@@ -469,7 +469,7 @@ int main(int argc, char *argv[])
}
}
// CAM control:
- if (!Interface->IsOpen())
+ if (!Menu && !Interface->IsOpen())
Menu = CamControl();
// User Input:
cOsdObject *Interact = Menu ? Menu : cControl::Control();