1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

A device can now detach all receivers for a given PID

This commit is contained in:
Klaus Schmidinger 2005-06-05 13:37:37 +02:00
parent 393627abd5
commit f4c63964a8
5 changed files with 32 additions and 4 deletions

View File

@ -283,6 +283,7 @@ Werner Fink <werner@suse.de>
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 <hakenes@hippomi.de>
for providing 'libdtv' and adapting the EIT mechanisms to it

View File

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

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

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

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.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);
}