diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 7946291d..e43c739c 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -460,6 +460,8 @@ Oliver Endriss for making the "Left" and "Right" buttons set the cursor to the first or last list item even if the list consist only of a single page, like, for instance, the Main menu + for reporting a bug in setting the PCR-PID in case it is equal to one of the other + PIDs Reinhard Walter Buchner for adding some satellites to 'sources.conf' diff --git a/HISTORY b/HISTORY index 75abf234..331c5097 100644 --- a/HISTORY +++ b/HISTORY @@ -2090,3 +2090,5 @@ Video Disk Recorder Revision History - Fixed minimum lifespan of deleted recordings (thanks to Jaakko Hyvätti). - Updated French OSD texts (thanks to Olivier Jacques ). - Fixed paging through lists with repeated Left/Right keys. +- Fixed setting the PCR-PID in case it is equal to one of the other PIDs (thanks + to Oliver Endriss for reporting this one). diff --git a/device.c b/device.c index 67da4571..9380f1d1 100644 --- a/device.c +++ b/device.c @@ -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"); + } } } diff --git a/device.h b/device.h index 8ffd4953..38e8028d 100644 --- a/device.h +++ b/device.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 1.30 2003/04/26 09:49:12 kls Exp $ + * $Id: device.h 1.31 2003/05/02 08:21:05 kls Exp $ */ #ifndef __DEVICE_H @@ -201,7 +201,7 @@ protected: ///< Returns true if this device is currently receiving the given PID. bool AddPid(int Pid, ePidType PidType = ptOther); ///< Adds a PID to the set of PIDs this device shall receive. - void DelPid(int Pid); + void DelPid(int Pid, ePidType PidType = ptOther); ///< Deletes a PID from the set of PIDs this device shall receive. virtual bool SetPid(cPidHandle *Handle, int Type, bool On); ///< Does the actual PID setting on this device. diff --git a/dvbdevice.c b/dvbdevice.c index d66cd767..f80f4d17 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.56 2003/04/27 09:44:17 kls Exp $ + * $Id: dvbdevice.c 1.57 2003/05/02 09:12:20 kls Exp $ */ #include "dvbdevice.h" @@ -662,7 +662,7 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) DelPid(pidHandles[ptAudio].pid); DelPid(pidHandles[ptVideo].pid); - DelPid(pidHandles[ptPcr].pid); + DelPid(pidHandles[ptPcr].pid, ptPcr); DelPid(pidHandles[ptTeletext].pid); DelPid(pidHandles[ptDolby].pid); } @@ -684,7 +684,8 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) if (TurnOnLivePIDs) { aPid1 = Channel->Apid1(); aPid2 = Channel->Apid2(); - if (!(AddPid(Channel->Ppid(), ptPcr) && AddPid(Channel->Apid1(), ptAudio) && AddPid(Channel->Vpid(), ptVideo))) {//XXX+ dolby dpid1!!! (if audio plugins are attached) + int pPid = Channel->Ppid() ? Channel->Ppid() : Channel->Vpid(); + if (!(AddPid(pPid, ptPcr) && AddPid(Channel->Apid1(), ptAudio) && AddPid(Channel->Vpid(), ptVideo))) {//XXX+ dolby dpid1!!! (if audio plugins are attached) esyslog("ERROR: failed to set PIDs for channel %d on device %d", Channel->Number(), CardIndex() + 1); return false; }