diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 1416c473..db49edb1 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -283,6 +283,7 @@ Werner Fink for pointing out that MAXDPIDS needs to be to 16 (8xAC3 + 8xDTS) for reporting a problem with ensuring there is a current audio track in case there is only one track + for enabling a device to detach all receivers for a given PID Rolf Hakenes for providing 'libdtv' and adapting the EIT mechanisms to it diff --git a/HISTORY b/HISTORY index 76d2fef1..04996979 100644 --- a/HISTORY +++ b/HISTORY @@ -3589,3 +3589,5 @@ Video Disk Recorder Revision History only data from one frame (thanks to Reinhard Nissl). - EPG events without a title now display "No title" instead of "(null)" (thanks to Rolf Ahrenberg). +- A device can now detach all receivers for a given PID, as is necessary, e.g., + for the bitstreamout plugin (thanks to Werner Fink). 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) diff --git a/device.h b/device.h index 02fa35cc..ceda3d2a 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.57 2005/02/20 14:06:28 kls Exp $ + * $Id: device.h 1.58 2005/06/05 12:56:08 kls Exp $ */ #ifndef __DEVICE_H @@ -500,6 +500,8 @@ public: ///< Attaches the given receiver to this device. void Detach(cReceiver *Receiver); ///< Detaches the given receiver from this device. + void DetachAll(int Pid); + ///< Detaches all receivers from this device for this pid. }; /// Derived cDevice classes that can receive channels will have to provide diff --git a/dvbdevice.c b/dvbdevice.c index 3a3b19bd..88afdffa 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.129 2005/05/16 15:23:43 kls Exp $ + * $Id: dvbdevice.c 1.130 2005/06/05 13:05:55 kls Exp $ */ #include "dvbdevice.h" @@ -654,8 +654,10 @@ bool cDvbDevice::SetPid(cPidHandle *Handle, int Type, bool On) if (On) { if (Handle->handle < 0) { Handle->handle = DvbOpen(DEV_DVB_DEMUX, CardIndex(), O_RDWR | O_NONBLOCK, true); - if (Handle->handle < 0) + if (Handle->handle < 0) { + LOG_ERROR; return false; + } } pesFilterParams.pid = Handle->pid; pesFilterParams.input = DMX_IN_FRONTEND; @@ -722,6 +724,10 @@ void cDvbDevice::TurnOffLiveMode(bool LiveView) // Turn off live PIDs: + DetachAll(pidHandles[ptAudio].pid); + DetachAll(pidHandles[ptVideo].pid); + DetachAll(pidHandles[ptPcr].pid); + DetachAll(pidHandles[ptTeletext].pid); DelPid(pidHandles[ptAudio].pid); DelPid(pidHandles[ptVideo].pid); DelPid(pidHandles[ptPcr].pid, ptPcr); @@ -891,6 +897,7 @@ void cDvbDevice::SetAudioTrackDevice(eTrackType Type) if (TrackId && TrackId->id) { if (IS_AUDIO_TRACK(Type)) { if (pidHandles[ptAudio].pid && pidHandles[ptAudio].pid != TrackId->id) { + DetachAll(pidHandles[ptAudio].pid); pidHandles[ptAudio].pid = TrackId->id; SetPid(&pidHandles[ptAudio], ptAudio, true); }