summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-06-05 13:37:37 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2005-06-05 13:37:37 +0200
commitf4c63964a898b78e3bbce17e4fdb8f13e78e3317 (patch)
tree80bb3a4271753761a960636bc1d45634f0f20f7a /device.c
parent393627abd5c44cc092d178b70d7fb09c676a3dee (diff)
downloadvdr-f4c63964a898b78e3bbce17e4fdb8f13e78e3317.tar.gz
vdr-f4c63964a898b78e3bbce17e4fdb8f13e78e3317.tar.bz2
A device can now detach all receivers for a given PID
Diffstat (limited to 'device.c')
-rw-r--r--device.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/device.c b/device.c
index 806c1370..9b5f701d 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.101 2005/05/07 15:04:17 kls Exp $
+ * $Id: device.c 1.102 2005/06/05 13:28:03 kls Exp $
*/
#include "device.h"
@@ -397,6 +397,8 @@ bool cDevice::AddPid(int Pid, ePidType PidType)
PRINTPIDS("A");
if (!SetPid(&pidHandles[n], n, true)) {
esyslog("ERROR: can't set PID %d on device %d", Pid, CardIndex() + 1);
+ if (PidType <= ptTeletext)
+ DetachAll(Pid);
DelPid(Pid, PidType);
return false;
}
@@ -422,6 +424,8 @@ bool cDevice::AddPid(int Pid, ePidType PidType)
PRINTPIDS("C");
if (!SetPid(&pidHandles[n], n, true)) {
esyslog("ERROR: can't set PID %d on device %d", Pid, CardIndex() + 1);
+ if (PidType <= ptTeletext)
+ DetachAll(Pid);
DelPid(Pid, PidType);
return false;
}
@@ -1211,6 +1215,18 @@ void cDevice::Detach(cReceiver *Receiver)
}
}
+void cDevice::DetachAll(int Pid)
+{
+ if (Pid) {
+ cMutexLock MutexLock(&mutexReceiver);
+ for (int i = 0; i < MAXRECEIVERS; i++) {
+ cReceiver *Receiver = receiver[i];
+ if (Receiver && Receiver->WantsPid(Pid))
+ Detach(Receiver);
+ }
+ }
+}
+
// --- cTSBuffer -------------------------------------------------------------
cTSBuffer::cTSBuffer(int File, int Size, int CardIndex)