diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2003-05-02 09:24:31 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2003-05-02 09:24:31 +0200 |
commit | 240529710db31cd5a96ad2fdb7f9fd486ec7939f (patch) | |
tree | 5dc750c54136acfdcc1c6c1b1cfdfed4239397dc /device.c | |
parent | 5ddf78ade15ac4048ae6ec587078f1c2e68437d8 (diff) | |
download | vdr-240529710db31cd5a96ad2fdb7f9fd486ec7939f.tar.gz vdr-240529710db31cd5a96ad2fdb7f9fd486ec7939f.tar.bz2 |
Fixed setting the PCR-PID in case it is equal to one of the other PIDs
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 55 |
1 files changed, 34 insertions, 21 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.39 2003/04/12 11:51:04 kls Exp $ + * $Id: device.c 1.40 2003/05/02 09:18:42 kls Exp $ */ #include "device.h" @@ -224,15 +224,19 @@ bool cDevice::HasPid(int Pid) const bool cDevice::AddPid(int Pid, ePidType PidType) { - if (Pid) { + if (Pid || PidType == ptPcr) { int n = -1; int a = -1; - for (int i = 0; i < MAXPIDHANDLES; i++) { - if (pidHandles[i].pid == Pid) - n = i; - else if (a < 0 && i >= ptOther && !pidHandles[i].used) - a = i; - } + if (PidType != ptPcr) { // PPID always has to be explicit + for (int i = 0; i < MAXPIDHANDLES; i++) { + if (i != ptPcr) { + if (pidHandles[i].pid == Pid) + n = i; + else if (a < 0 && i >= ptOther && !pidHandles[i].used) + a = i; + } + } + } if (n >= 0) { // The Pid is already in use if (++pidHandles[n].used == 2 && n <= ptTeletext) { @@ -263,22 +267,31 @@ bool cDevice::AddPid(int Pid, ePidType PidType) return true; } -void cDevice::DelPid(int Pid) +void cDevice::DelPid(int Pid, ePidType PidType) { - if (Pid) { - for (int i = 0; i < MAXPIDHANDLES; i++) { - if (pidHandles[i].pid == Pid) { - PRINTPIDS("D"); - if (--pidHandles[i].used < 2) { - SetPid(&pidHandles[i], i, false); - if (pidHandles[i].used == 0) { - pidHandles[i].handle = -1; - pidHandles[i].pid = 0; - } + if (Pid || PidType == ptPcr) { + int n = -1; + if (PidType == ptPcr) + n = PidType; // PPID always has to be explicit + else { + for (int i = 0; i < MAXPIDHANDLES; i++) { + if (pidHandles[i].pid == Pid) { + n = i; + break; } - PRINTPIDS("E"); } - } + } + if (n >= 0 && pidHandles[n].used) { + PRINTPIDS("D"); + if (--pidHandles[n].used < 2) { + SetPid(&pidHandles[n], n, false); + if (pidHandles[n].used == 0) { + pidHandles[n].handle = -1; + pidHandles[n].pid = 0; + } + } + PRINTPIDS("E"); + } } } |