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

Any cReceivers still attached to a cDevice when that device switches to a different transponder are now automatically detached

This commit is contained in:
Klaus Schmidinger 2006-01-06 13:55:57 +01:00
parent e87e649991
commit 16f037e3c2
4 changed files with 30 additions and 5 deletions

View File

@ -1566,6 +1566,8 @@ Patrick Fischer <patrick_fischer@gmx.de>
for reporting an error in the cFilter example in PLUGINS.html for reporting an error in the cFilter example in PLUGINS.html
for making the static cControl functions thread safe for making the static cControl functions thread safe
for suggesting that the cTimer constructor should take an optional cChannel for suggesting that the cTimer constructor should take an optional cChannel
for suggesting that any cReceivers still attached to a cDevice when that device
switches to a different transponder shall be automatically detached
Ralf Müller <ralf@bj-ig.de> Ralf Müller <ralf@bj-ig.de>
for a patch that was used to implement cUnbufferedFile for a patch that was used to implement cUnbufferedFile

View File

@ -4113,3 +4113,6 @@ Video Disk Recorder Revision History
displayed will close the OSD. In order to assign this new key to an existing displayed will close the OSD. In order to assign this new key to an existing
remote control setup, the remote.conf file needs to be deleted and VDR has remote control setup, the remote.conf file needs to be deleted and VDR has
to be restarted to go through the process of learning the remote control keys. to be restarted to go through the process of learning the remote control keys.
- Any cReceivers still attached to a cDevice when that device switches to a
different transponder are now automatically detached (suggested by Patrick
Fischer).

View File

@ -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 1.116 2006/01/06 12:56:44 kls Exp $ * $Id: device.c 1.117 2006/01/06 13:50:00 kls Exp $
*/ */
#include "device.h" #include "device.h"
@ -604,10 +604,14 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
if (LiveView) if (LiveView)
StopReplay(); StopReplay();
// If this card is switched to an other transponder, any receivers still
// attached to it ineed to be automatically detached:
bool NeedsDetachReceivers = false;
// If this card can't receive this channel, we must not actually switch // If this card can't receive this channel, we must not actually switch
// the channel here, because that would irritate the driver when we // the channel here, because that would irritate the driver when we
// start replaying in Transfer Mode immediately after switching the channel: // start replaying in Transfer Mode immediately after switching the channel:
bool NeedsTransferMode = (LiveView && IsPrimaryDevice() && !ProvidesChannel(Channel, Setup.PrimaryLimit)); bool NeedsTransferMode = (LiveView && IsPrimaryDevice() && !ProvidesChannel(Channel, Setup.PrimaryLimit, &NeedsDetachReceivers));
eSetChannelResult Result = scrOk; eSetChannelResult Result = scrOk;
@ -615,11 +619,14 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
// use the card that actually can receive it and transfer data from there: // use the card that actually can receive it and transfer data from there:
if (NeedsTransferMode) { if (NeedsTransferMode) {
cDevice *CaDevice = GetDevice(Channel, 0); cDevice *CaDevice = GetDevice(Channel, 0, &NeedsDetachReceivers);
if (CaDevice && CanReplay()) { if (CaDevice && CanReplay()) {
cStatus::MsgChannelSwitch(this, 0); // only report status if we are actually going to switch the channel cStatus::MsgChannelSwitch(this, 0); // only report status if we are actually going to switch the channel
if (CaDevice->SetChannel(Channel, false) == scrOk) // calling SetChannel() directly, not SwitchChannel()! if (CaDevice->SetChannel(Channel, false) == scrOk) { // calling SetChannel() directly, not SwitchChannel()!
if (NeedsDetachReceivers)
CaDevice->DetachAllReceivers();
cControl::Launch(new cTransferControl(CaDevice, Channel->Vpid(), Channel->Apids(), Channel->Dpids(), Channel->Spids())); cControl::Launch(new cTransferControl(CaDevice, Channel->Vpid(), Channel->Apids(), Channel->Dpids(), Channel->Spids()));
}
else else
Result = scrNoTransfer; Result = scrNoTransfer;
} }
@ -653,6 +660,8 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
} }
#endif #endif
} }
if (NeedsDetachReceivers)
DetachAllReceivers();
if (SetChannelDevice(Channel, LiveView)) { if (SetChannelDevice(Channel, LiveView)) {
// Start section handling: // Start section handling:
if (sectionHandler) { if (sectionHandler) {
@ -1269,6 +1278,15 @@ void cDevice::DetachAll(int Pid)
} }
} }
void cDevice::DetachAllReceivers(void)
{
cMutexLock MutexLock(&mutexReceiver);
for (int i = 0; i < MAXRECEIVERS; i++) {
if (receiver[i])
Detach(receiver[i]);
}
}
// --- cTSBuffer ------------------------------------------------------------- // --- cTSBuffer -------------------------------------------------------------
cTSBuffer::cTSBuffer(int File, int Size, int CardIndex) 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 * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: device.h 1.67 2005/12/29 14:51:59 kls Exp $ * $Id: device.h 1.68 2006/01/06 13:20:25 kls Exp $
*/ */
#ifndef __DEVICE_H #ifndef __DEVICE_H
@ -520,6 +520,8 @@ public:
///< Detaches the given receiver from this device. ///< Detaches the given receiver from this device.
void DetachAll(int Pid); void DetachAll(int Pid);
///< Detaches all receivers from this device for this pid. ///< Detaches all receivers from this device for this pid.
void DetachAllReceivers(void);
///< Detaches all receivers from this device.
}; };
/// Derived cDevice classes that can receive channels will have to provide /// Derived cDevice classes that can receive channels will have to provide