Fixed handling primary device on headless systems

This commit is contained in:
Klaus Schmidinger 2024-01-22 12:10:30 +01:00
parent 552f5fc4e7
commit fe97a38e77
4 changed files with 8 additions and 10 deletions

View File

@ -2561,6 +2561,7 @@ Markus Ehrnsperger <markus.ehrnsperger@googlemail.com>
any more
for removing syslog calls in child process after fork()
for adding the move constructor to cString for better performance
for fixing handling primary device on headless systems
Werner Färber <w.faerber@gmx.de>
for reporting a bug in handling the cPluginManager::Active() result when pressing

View File

@ -9863,7 +9863,7 @@ Video Disk Recorder Revision History
- The recording info of the default skins now shows the frame parameters of the
recording at the end of the description (if such information is available).
2024-01-21:
2024-01-22:
- Changed installing config files to handle potentially broken 'cp -n'.
- Fixed height calculation in progress display (thanks to Matthias Senzel).
@ -9881,3 +9881,4 @@ Video Disk Recorder Revision History
Ehrnsperger).
- Added the total number of errors when logging new recording errors.
- Added '/' to the list of fuzzy characters for pattern timers.
- Fixed handling primary device on headless systems (thanks to Markus Ehrnsperger).

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 5.9 2024/01/18 10:58:39 kls Exp $
* $Id: device.c 5.10 2024/01/22 12:10:30 kls Exp $
*/
#include "device.h"
@ -807,10 +807,6 @@ bool cDevice::MaySwitchTransponder(const cChannel *Channel) const
bool cDevice::SwitchChannel(const cChannel *Channel, bool LiveView)
{
if (LiveView) {
if (!PrimaryDevice()->CanReplay()) {
isyslog("can't switch to live channel %d %s (%s)", Channel->Number(), *Channel->GetChannelID().ToString(), Channel->Name());
return false;
}
isyslog("switching to channel %d %s (%s)", Channel->Number(), *Channel->GetChannelID().ToString(), Channel->Name());
cControl::Shutdown(); // prevents old channel from being shown too long if GetDevice() takes longer
// and, if decrypted, this removes the now superfluous PIDs from the CAM, too
@ -880,7 +876,7 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
DELETENULL(dvbSubtitleConverter);
}
cDevice *Device = (LiveView && IsPrimaryDevice()) ? GetDevice(Channel, LIVEPRIORITY, true) : this;
cDevice *Device = (LiveView && IsPrimaryDevice(false)) ? GetDevice(Channel, LIVEPRIORITY, true) : this;
bool NeedsTransferMode = LiveView && Device != PrimaryDevice();
// If the CAM slot wants the TS data, we need to switch to Transfer Mode:
@ -927,7 +923,7 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
}
if (Result == scrOk) {
if (LiveView && IsPrimaryDevice()) {
if (LiveView && IsPrimaryDevice(false)) {
if (patFilter) // this is only for FF DVB cards!
patFilter->Request(Channel->Sid());
currentChannel = Channel->Number();

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 5.2 2022/01/24 16:53:45 kls Exp $
* $Id: device.h 5.3 2024/01/22 12:10:30 kls Exp $
*/
#ifndef __DEVICE_H
@ -217,7 +217,7 @@ protected:
///< May be dropped in a future version, if a better solution is found.
///< Do not use otherwise!
public:
bool IsPrimaryDevice(void) const { return this == primaryDevice && HasDecoder(); }
bool IsPrimaryDevice(bool CheckDecoder = true) const { return this == primaryDevice && (!CheckDecoder || HasDecoder()); }
int CardIndex(void) const { return cardIndex; }
///< Returns the card index of this device (0 ... MAXDEVICES - 1).
int DeviceNumber(void) const;