Fixed setting the PCR-PID in case it is equal to one of the other PIDs

This commit is contained in:
Klaus Schmidinger 2003-05-02 09:24:31 +02:00
parent 5ddf78ade1
commit 240529710d
5 changed files with 44 additions and 26 deletions

View File

@ -460,6 +460,8 @@ Oliver Endriss <o.endriss@gmx.de>
for making the "Left" and "Right" buttons set the cursor to the first or last 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, list item even if the list consist only of a single page, like, for instance,
the Main menu 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 <rw.buchner@freenet.de> Reinhard Walter Buchner <rw.buchner@freenet.de>
for adding some satellites to 'sources.conf' for adding some satellites to 'sources.conf'

View File

@ -2090,3 +2090,5 @@ Video Disk Recorder Revision History
- Fixed minimum lifespan of deleted recordings (thanks to Jaakko Hyvätti). - Fixed minimum lifespan of deleted recordings (thanks to Jaakko Hyvätti).
- Updated French OSD texts (thanks to Olivier Jacques <jacquesolivier@hotmail.com>). - Updated French OSD texts (thanks to Olivier Jacques <jacquesolivier@hotmail.com>).
- Fixed paging through lists with repeated Left/Right keys. - 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).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "device.h"
@ -224,15 +224,19 @@ bool cDevice::HasPid(int Pid) const
bool cDevice::AddPid(int Pid, ePidType PidType) bool cDevice::AddPid(int Pid, ePidType PidType)
{ {
if (Pid) { if (Pid || PidType == ptPcr) {
int n = -1; int n = -1;
int a = -1; int a = -1;
for (int i = 0; i < MAXPIDHANDLES; i++) { if (PidType != ptPcr) { // PPID always has to be explicit
if (pidHandles[i].pid == Pid) for (int i = 0; i < MAXPIDHANDLES; i++) {
n = i; if (i != ptPcr) {
else if (a < 0 && i >= ptOther && !pidHandles[i].used) if (pidHandles[i].pid == Pid)
a = i; n = i;
} else if (a < 0 && i >= ptOther && !pidHandles[i].used)
a = i;
}
}
}
if (n >= 0) { if (n >= 0) {
// The Pid is already in use // The Pid is already in use
if (++pidHandles[n].used == 2 && n <= ptTeletext) { if (++pidHandles[n].used == 2 && n <= ptTeletext) {
@ -263,22 +267,31 @@ bool cDevice::AddPid(int Pid, ePidType PidType)
return true; return true;
} }
void cDevice::DelPid(int Pid) void cDevice::DelPid(int Pid, ePidType PidType)
{ {
if (Pid) { if (Pid || PidType == ptPcr) {
for (int i = 0; i < MAXPIDHANDLES; i++) { int n = -1;
if (pidHandles[i].pid == Pid) { if (PidType == ptPcr)
PRINTPIDS("D"); n = PidType; // PPID always has to be explicit
if (--pidHandles[i].used < 2) { else {
SetPid(&pidHandles[i], i, false); for (int i = 0; i < MAXPIDHANDLES; i++) {
if (pidHandles[i].used == 0) { if (pidHandles[i].pid == Pid) {
pidHandles[i].handle = -1; n = i;
pidHandles[i].pid = 0; 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");
}
} }
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __DEVICE_H
@ -201,7 +201,7 @@ protected:
///< Returns true if this device is currently receiving the given PID. ///< Returns true if this device is currently receiving the given PID.
bool AddPid(int Pid, ePidType PidType = ptOther); bool AddPid(int Pid, ePidType PidType = ptOther);
///< Adds a PID to the set of PIDs this device shall receive. ///< 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. ///< Deletes a PID from the set of PIDs this device shall receive.
virtual bool SetPid(cPidHandle *Handle, int Type, bool On); virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
///< Does the actual PID setting on this device. ///< Does the actual PID setting on this device.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "dvbdevice.h"
@ -662,7 +662,7 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
DelPid(pidHandles[ptAudio].pid); DelPid(pidHandles[ptAudio].pid);
DelPid(pidHandles[ptVideo].pid); DelPid(pidHandles[ptVideo].pid);
DelPid(pidHandles[ptPcr].pid); DelPid(pidHandles[ptPcr].pid, ptPcr);
DelPid(pidHandles[ptTeletext].pid); DelPid(pidHandles[ptTeletext].pid);
DelPid(pidHandles[ptDolby].pid); DelPid(pidHandles[ptDolby].pid);
} }
@ -684,7 +684,8 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
if (TurnOnLivePIDs) { if (TurnOnLivePIDs) {
aPid1 = Channel->Apid1(); aPid1 = Channel->Apid1();
aPid2 = Channel->Apid2(); 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); esyslog("ERROR: failed to set PIDs for channel %d on device %d", Channel->Number(), CardIndex() + 1);
return false; return false;
} }