summaryrefslogtreecommitdiff
path: root/dvbapi.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-05-09 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-05-09 18:00:00 +0200
commitae8a947367b4be57c9b0ca7bbf0032de0e2018d3 (patch)
treef9a5b6c7d320222b841a54c86590eb012ab3a107 /dvbapi.c
parentc9a5d8ea5328e4a8bcb0c3423b825c02cb0c3b27 (diff)
downloadvdr-patch-lnbsharing-ae8a947367b4be57c9b0ca7bbf0032de0e2018d3.tar.gz
vdr-patch-lnbsharing-ae8a947367b4be57c9b0ca7bbf0032de0e2018d3.tar.bz2
Version 1.1.0vdr-1.1.0
- Begin of the 1.1 development branch. THIS IS NOT A STABLE VERSION! The current stable version for every day use is still the 1.0 branch. - First step towards a universal plugin interface. See the file PLUGINS.html for a detailed description. The man page vdr(1) describes the new options '-L' and '-P' used to load plugins. This first step implements the complete "outer" shell for plugins. The "inner" access to VDR data structures will follow. - The VDR version number is now displayed in the title line of the "Setup" menu.
Diffstat (limited to 'dvbapi.c')
-rw-r--r--dvbapi.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/dvbapi.c b/dvbapi.c
index 9d59d90..77e5372 100644
--- a/dvbapi.c
+++ b/dvbapi.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbapi.c 1.170 2002/04/07 09:35:51 kls Exp $
+ * $Id: dvbapi.c 1.174 2002/05/03 15:59:32 kls Exp $
*/
#include "dvbapi.h"
@@ -279,8 +279,7 @@ bool cIndexFile::Get(int Index, uchar *FileNumber, int *FileOffset, uchar *Pictu
int cIndexFile::GetNextIFrame(int Index, bool Forward, uchar *FileNumber, int *FileOffset, int *Length, bool StayOffEnd)
{
if (index) {
- if (Forward)
- CatchUp();
+ CatchUp();
int d = Forward ? 1 : -1;
for (;;) {
Index += d;
@@ -533,6 +532,8 @@ void cRecordBuffer::Input(void)
int w = Put(p, r);
p += w;
r -= w;
+ if (r > 0)
+ usleep(1); // this keeps the CPU load low
}
t = time(NULL);
}
@@ -1810,21 +1811,24 @@ bool cDvbApi::SetPrimaryDvbApi(int n)
return false;
}
-int cDvbApi::CanShift(int Ca, int Priority)
+int cDvbApi::CanShift(int Ca, int Priority, int UsedCards)
{
// Test whether a recording on this DVB device can be shifted to another one
// in order to perform a new recording with the given Ca and Priority on this device:
int ShiftLevel = -1; // default means this device can't be shifted
+ if (UsedCards & (1 << CardIndex()) != 0)
+ return ShiftLevel; // otherwise we would get into a loop
if (Recording()) {
if (ProvidesCa(Ca) // this device provides the requested Ca
&& (Ca != this->Ca() // the requested Ca is different from the one currently used...
|| Priority > this->Priority())) { // ...or the request comes from a higher priority
cDvbApi *d = NULL;
int Provides[MAXDVBAPI];
+ UsedCards |= (1 << CardIndex());
for (int i = 0; i < NumDvbApis; i++) {
if ((Provides[i] = dvbApi[i]->ProvidesCa(this->Ca())) != 0) { // this device is basicly able to do the job
if (dvbApi[i] != this) { // it is not _this_ device
- int sl = dvbApi[i]->CanShift(this->Ca(), Priority); // this is the original Priority!
+ int sl = dvbApi[i]->CanShift(this->Ca(), Priority, UsedCards); // this is the original Priority!
if (sl >= 0 && (ShiftLevel < 0 || sl < ShiftLevel)) {
d = dvbApi[i];
ShiftLevel = sl;
@@ -2301,16 +2305,17 @@ bool cDvbApi::SetPid(int fd, dmxPesType_t PesType, int Pid, dmxOutput_t Output)
{
if (Pid) {
CHECK(ioctl(fd, DMX_STOP));
- dmxPesFilterParams pesFilterParams;
- pesFilterParams.pid = Pid;
- pesFilterParams.input = DMX_IN_FRONTEND;
- pesFilterParams.output = Output;
- pesFilterParams.pesType = PesType;
- pesFilterParams.flags = DMX_IMMEDIATE_START;
- if (ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams) < 0) {
- if (Pid != 0x1FFF)
+ if (Pid != 0x1FFF) {
+ dmxPesFilterParams pesFilterParams;
+ pesFilterParams.pid = Pid;
+ pesFilterParams.input = DMX_IN_FRONTEND;
+ pesFilterParams.output = Output;
+ pesFilterParams.pesType = PesType;
+ pesFilterParams.flags = DMX_IMMEDIATE_START;
+ if (ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams) < 0) {
LOG_ERROR;
- return false;
+ return false;
+ }
}
}
return true;