mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
PIDs can now be added to and deleted from a cReceiver while it is attached to a cDevice
This commit is contained in:
parent
71601e363e
commit
3f9cdea1c1
4
HISTORY
4
HISTORY
@ -8882,7 +8882,7 @@ Video Disk Recorder Revision History
|
|||||||
- Added a short sleep to cTSBuffer::Action() to avoid high CPU usage (thanks to
|
- Added a short sleep to cTSBuffer::Action() to avoid high CPU usage (thanks to
|
||||||
Sergey Chernyavskiy).
|
Sergey Chernyavskiy).
|
||||||
|
|
||||||
2017-02-14: Version 2.3.3
|
2017-02-21: Version 2.3.3
|
||||||
|
|
||||||
- Added 'S3W ABS-3A' to sources.conf (thanks to Frank Richter).
|
- Added 'S3W ABS-3A' to sources.conf (thanks to Frank Richter).
|
||||||
- Fixed a possible deadlock in the recordings handler thread.
|
- Fixed a possible deadlock in the recordings handler thread.
|
||||||
@ -8912,3 +8912,5 @@ Video Disk Recorder Revision History
|
|||||||
- The Setup/CAM menu now only displays master CAMs.
|
- The Setup/CAM menu now only displays master CAMs.
|
||||||
- Fixed setting the local machine's SVDRP host name (was overwritten if setup.conf
|
- Fixed setting the local machine's SVDRP host name (was overwritten if setup.conf
|
||||||
contained an empty string).
|
contained an empty string).
|
||||||
|
- PIDs can now be added to and deleted from a cReceiver while it is attached to
|
||||||
|
a cDevice, without having to detach it first and re-attach it afterwards.
|
||||||
|
48
ci.c
48
ci.c
@ -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: ci.c 4.5 2017/01/23 11:42:14 kls Exp $
|
* $Id: ci.c 4.6 2017/02/21 14:17:07 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ci.h"
|
#include "ci.h"
|
||||||
@ -121,8 +121,6 @@ private:
|
|||||||
int length;
|
int length;
|
||||||
void AddEmmPid(int Pid);
|
void AddEmmPid(int Pid);
|
||||||
void DelEmmPids(void);
|
void DelEmmPids(void);
|
||||||
protected:
|
|
||||||
virtual void Activate(bool On);
|
|
||||||
public:
|
public:
|
||||||
cCaPidReceiver(void);
|
cCaPidReceiver(void);
|
||||||
virtual ~cCaPidReceiver() { Detach(); }
|
virtual ~cCaPidReceiver() { Detach(); }
|
||||||
@ -156,11 +154,6 @@ void cCaPidReceiver::DelEmmPids(void)
|
|||||||
emmPids.Clear();
|
emmPids.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCaPidReceiver::Activate(bool On)
|
|
||||||
{
|
|
||||||
catVersion = -1; // can be done independent of 'On'
|
|
||||||
}
|
|
||||||
|
|
||||||
void cCaPidReceiver::Receive(const uchar *Data, int Length)
|
void cCaPidReceiver::Receive(const uchar *Data, int Length)
|
||||||
{
|
{
|
||||||
if (TsPid(Data) == CATPID) {
|
if (TsPid(Data) == CATPID) {
|
||||||
@ -208,10 +201,6 @@ void cCaPidReceiver::Receive(const uchar *Data, int Length)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p) {
|
if (p) {
|
||||||
int OldCatVersion = catVersion; // must preserve the current version number
|
|
||||||
cDevice *AttachedDevice = Device();
|
|
||||||
if (AttachedDevice)
|
|
||||||
AttachedDevice->Detach(this);
|
|
||||||
DelEmmPids();
|
DelEmmPids();
|
||||||
for (int i = 0; i < length - 4; i++) { // -4 = checksum
|
for (int i = 0; i < length - 4; i++) { // -4 = checksum
|
||||||
if (p[i] == 0x09) {
|
if (p[i] == 0x09) {
|
||||||
@ -228,9 +217,6 @@ void cCaPidReceiver::Receive(const uchar *Data, int Length)
|
|||||||
i += p[i + 1] + 2 - 1; // -1 to compensate for the loop increment
|
i += p[i + 1] + 2 - 1; // -1 to compensate for the loop increment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (AttachedDevice)
|
|
||||||
AttachedDevice->AttachReceiver(this);
|
|
||||||
catVersion = OldCatVersion;
|
|
||||||
p = NULL;
|
p = NULL;
|
||||||
bufp = 0;
|
bufp = 0;
|
||||||
length = 0;
|
length = 0;
|
||||||
@ -1747,9 +1733,10 @@ cCamSlot::cCamSlot(cCiAdapter *CiAdapter, bool WantsTsData, cCamSlot *MasterSlot
|
|||||||
tc[i] = NULL;
|
tc[i] = NULL;
|
||||||
CamSlots.Add(this);
|
CamSlots.Add(this);
|
||||||
slotNumber = Index() + 1;
|
slotNumber = Index() + 1;
|
||||||
if (ciAdapter)
|
if (ciAdapter) {
|
||||||
ciAdapter->AddCamSlot(this);
|
ciAdapter->AddCamSlot(this);
|
||||||
Reset();
|
Reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cCamSlot::~cCamSlot()
|
cCamSlot::~cCamSlot()
|
||||||
@ -1767,20 +1754,28 @@ bool cCamSlot::Assign(cDevice *Device, bool Query)
|
|||||||
cMutexLock MutexLock(&mutex);
|
cMutexLock MutexLock(&mutex);
|
||||||
if (ciAdapter) {
|
if (ciAdapter) {
|
||||||
if (ciAdapter->Assign(Device, true)) {
|
if (ciAdapter->Assign(Device, true)) {
|
||||||
if (!Device && assignedDevice)
|
if (!Device && assignedDevice) {
|
||||||
|
if (caPidReceiver)
|
||||||
|
assignedDevice->Detach(caPidReceiver);
|
||||||
assignedDevice->SetCamSlot(NULL);
|
assignedDevice->SetCamSlot(NULL);
|
||||||
|
}
|
||||||
if (!Query || !Device) {
|
if (!Query || !Device) {
|
||||||
StopDecrypting();
|
StopDecrypting();
|
||||||
source = transponder = 0;
|
source = transponder = 0;
|
||||||
if (ciAdapter->Assign(Device)) {
|
if (ciAdapter->Assign(Device)) {
|
||||||
|
int OldDeviceNumber = assignedDevice ? assignedDevice->DeviceNumber() + 1 : 0;
|
||||||
assignedDevice = Device;
|
assignedDevice = Device;
|
||||||
if (Device) {
|
if (Device) {
|
||||||
Device->SetCamSlot(this);
|
Device->SetCamSlot(this);
|
||||||
dsyslog("CAM %d: assigned to device %d", slotNumber, Device->DeviceNumber() + 1);
|
if (caPidReceiver) {
|
||||||
|
caPidReceiver->Reset();
|
||||||
|
Device->AttachReceiver(caPidReceiver);
|
||||||
|
}
|
||||||
|
dsyslog("CAM %d: assigned to device %d", MasterSlotNumber(), Device->DeviceNumber() + 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CancelActivation();
|
CancelActivation();
|
||||||
dsyslog("CAM %d: unassigned", slotNumber);
|
dsyslog("CAM %d: unassigned from device %d", MasterSlotNumber(), OldDeviceNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2014,10 +2009,6 @@ void cCamSlot::SendCaPmt(uint8_t CmdId)
|
|||||||
const int *CaSystemIds = cas->GetCaSystemIds();
|
const int *CaSystemIds = cas->GetCaSystemIds();
|
||||||
if (CaSystemIds && *CaSystemIds) {
|
if (CaSystemIds && *CaSystemIds) {
|
||||||
if (caProgramList.Count()) {
|
if (caProgramList.Count()) {
|
||||||
if (caPidReceiver && caPidReceiver->HasCaPids()) {
|
|
||||||
if (cDevice *d = Device())
|
|
||||||
d->Detach(caPidReceiver);
|
|
||||||
}
|
|
||||||
for (int Loop = 1; Loop <= 2; Loop++) {
|
for (int Loop = 1; Loop <= 2; Loop++) {
|
||||||
for (cCiCaProgramData *p = caProgramList.First(); p; p = caProgramList.Next(p)) {
|
for (cCiCaProgramData *p = caProgramList.First(); p; p = caProgramList.Next(p)) {
|
||||||
if (p->modified || resendPmt) {
|
if (p->modified || resendPmt) {
|
||||||
@ -2048,20 +2039,11 @@ void cCamSlot::SendCaPmt(uint8_t CmdId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (caPidReceiver && caPidReceiver->HasCaPids()) {
|
|
||||||
if (cDevice *d = Device())
|
|
||||||
d->AttachReceiver(caPidReceiver);
|
|
||||||
}
|
|
||||||
resendPmt = false;
|
resendPmt = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cCiCaPmt CaPmt(CmdId, 0, 0, 0, NULL);
|
cCiCaPmt CaPmt(CmdId, 0, 0, 0, NULL);
|
||||||
cas->SendPMT(&CaPmt);
|
cas->SendPMT(&CaPmt);
|
||||||
if (caPidReceiver) {
|
|
||||||
if (cDevice *d = Device())
|
|
||||||
d->Detach(caPidReceiver);
|
|
||||||
caPidReceiver->Reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
device.c
6
device.c
@ -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 4.6 2017/01/23 11:43:05 kls Exp $
|
* $Id: device.c 4.7 2017/02/21 13:38:01 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
@ -451,6 +451,7 @@ void cDevice::GetOsdSize(int &Width, int &Height, double &PixelAspect)
|
|||||||
|
|
||||||
bool cDevice::HasPid(int Pid) const
|
bool cDevice::HasPid(int Pid) const
|
||||||
{
|
{
|
||||||
|
cMutexLock MutexLock(&mutexPids);
|
||||||
for (int i = 0; i < MAXPIDHANDLES; i++) {
|
for (int i = 0; i < MAXPIDHANDLES; i++) {
|
||||||
if (pidHandles[i].pid == Pid)
|
if (pidHandles[i].pid == Pid)
|
||||||
return true;
|
return true;
|
||||||
@ -460,6 +461,7 @@ bool cDevice::HasPid(int Pid) const
|
|||||||
|
|
||||||
bool cDevice::AddPid(int Pid, ePidType PidType, int StreamType)
|
bool cDevice::AddPid(int Pid, ePidType PidType, int StreamType)
|
||||||
{
|
{
|
||||||
|
cMutexLock MutexLock(&mutexPids);
|
||||||
if (Pid || PidType == ptPcr) {
|
if (Pid || PidType == ptPcr) {
|
||||||
int n = -1;
|
int n = -1;
|
||||||
int a = -1;
|
int a = -1;
|
||||||
@ -524,6 +526,7 @@ bool cDevice::AddPid(int Pid, ePidType PidType, int StreamType)
|
|||||||
|
|
||||||
void cDevice::DelPid(int Pid, ePidType PidType)
|
void cDevice::DelPid(int Pid, ePidType PidType)
|
||||||
{
|
{
|
||||||
|
cMutexLock MutexLock(&mutexPids);
|
||||||
if (Pid || PidType == ptPcr) {
|
if (Pid || PidType == ptPcr) {
|
||||||
int n = -1;
|
int n = -1;
|
||||||
if (PidType == ptPcr)
|
if (PidType == ptPcr)
|
||||||
@ -559,6 +562,7 @@ bool cDevice::SetPid(cPidHandle *Handle, int Type, bool On)
|
|||||||
|
|
||||||
void cDevice::DelLivePids(void)
|
void cDevice::DelLivePids(void)
|
||||||
{
|
{
|
||||||
|
cMutexLock MutexLock(&mutexPids);
|
||||||
for (int i = ptAudio; i < ptOther; i++) {
|
for (int i = ptAudio; i < ptOther; i++) {
|
||||||
if (pidHandles[i].pid)
|
if (pidHandles[i].pid)
|
||||||
DelPid(pidHandles[i].pid, ePidType(i));
|
DelPid(pidHandles[i].pid, ePidType(i));
|
||||||
|
4
device.h
4
device.h
@ -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 4.3 2017/01/09 12:51:05 kls Exp $
|
* $Id: device.h 4.4 2017/02/21 13:23:24 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __DEVICE_H
|
#ifndef __DEVICE_H
|
||||||
@ -109,6 +109,7 @@ public:
|
|||||||
class cDevice : public cThread {
|
class cDevice : public cThread {
|
||||||
friend class cLiveSubtitle;
|
friend class cLiveSubtitle;
|
||||||
friend class cDeviceHook;
|
friend class cDeviceHook;
|
||||||
|
friend class cReceiver;
|
||||||
private:
|
private:
|
||||||
static int numDevices;
|
static int numDevices;
|
||||||
static int useDevice;
|
static int useDevice;
|
||||||
@ -355,6 +356,7 @@ public:
|
|||||||
// PID handle facilities
|
// PID handle facilities
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
mutable cMutex mutexPids;
|
||||||
virtual void Action(void);
|
virtual void Action(void);
|
||||||
protected:
|
protected:
|
||||||
enum ePidType { ptAudio, ptVideo, ptPcr, ptTeletext, ptDolby, ptOther };
|
enum ePidType { ptAudio, ptVideo, ptPcr, ptTeletext, ptDolby, ptOther };
|
||||||
|
@ -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: receiver.c 4.1 2015/09/16 11:19:47 kls Exp $
|
* $Id: receiver.c 4.2 2017/02/21 10:59:27 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "receiver.h"
|
#include "receiver.h"
|
||||||
@ -38,8 +38,11 @@ bool cReceiver::AddPid(int Pid)
|
|||||||
{
|
{
|
||||||
if (Pid) {
|
if (Pid) {
|
||||||
if (numPids < MAXRECEIVEPIDS) {
|
if (numPids < MAXRECEIVEPIDS) {
|
||||||
if (!WantsPid(Pid))
|
if (!WantsPid(Pid)) {
|
||||||
pids[numPids++] = Pid;
|
pids[numPids++] = Pid;
|
||||||
|
if (device)
|
||||||
|
device->AddPid(Pid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dsyslog("too many PIDs in cReceiver (Pid = %d)", Pid);
|
dsyslog("too many PIDs in cReceiver (Pid = %d)", Pid);
|
||||||
@ -87,6 +90,8 @@ void cReceiver::DelPid(int Pid)
|
|||||||
for ( ; i < numPids; i++) // we also copy the terminating 0!
|
for ( ; i < numPids; i++) // we also copy the terminating 0!
|
||||||
pids[i] = pids[i + 1];
|
pids[i] = pids[i + 1];
|
||||||
numPids--;
|
numPids--;
|
||||||
|
if (device)
|
||||||
|
device->DelPid(Pid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user