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
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 <rw.buchner@freenet.de>
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).
- Updated French OSD texts (thanks to Olivier Jacques <jacquesolivier@hotmail.com>).
- 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
* 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");
}
}
}

View File

@ -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.

View File

@ -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;
}