The various modulation types are now taken into account when selecting a device

This commit is contained in:
Klaus Schmidinger 2010-04-11 13:02:42 +02:00
parent 5a67f86207
commit 512522f259
4 changed files with 34 additions and 7 deletions

View File

@ -6411,7 +6411,7 @@ Video Disk Recorder Revision History
- The new setup option "Folders in timer menu" controls whether the file names in
the timer menu are shown with their full folder path.
2010-04-10: Version 1.7.15
2010-04-11: Version 1.7.15
- Added Macedonian language texts (thanks to Dimitar Petrovski).
- Updated the Estonian OSD texts (thanks to Arthur Konovalov).
@ -6432,3 +6432,6 @@ Video Disk Recorder Revision History
- Added user defined key kUser0 (suggested by Ulf Kiener).
- Include paths are now added instead of overwriting INCLUDES in the Makefile (thanks
to Paul Menzel).
- The various modulation types are now taken into account when selecting a device for
a recording or live viewing, so that devices that provide more capabilities are
spared.

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 2.35 2010/02/07 11:54:42 kls Exp $
* $Id: device.c 2.36 2010/04/11 10:45:15 kls Exp $
*/
#include "device.h"
@ -215,7 +215,7 @@ cDevice *cDevice::GetDevice(int Index)
static int GetClippedNumProvidedSystems(int AvailableBits, cDevice *Device)
{
int MaxNumProvidedSystems = 1 << AvailableBits;
int MaxNumProvidedSystems = (1 << AvailableBits) - 1;
int NumProvidedSystems = Device->NumProvidedSystems();
if (NumProvidedSystems > MaxNumProvidedSystems) {
esyslog("ERROR: device %d supports %d modulation systems but cDevice::GetDevice() currently only supports %d delivery systems which should be fixed", Device->CardIndex() + 1, NumProvidedSystems, MaxNumProvidedSystems);
@ -281,7 +281,7 @@ cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView
imp <<= 1; imp |= LiveView ? !device[i]->IsPrimaryDevice() || ndr : 0; // prefer the primary device for live viewing if we don't need to detach existing receivers
imp <<= 1; imp |= !device[i]->Receiving() && (device[i] != cTransferControl::ReceiverDevice() || device[i]->IsPrimaryDevice()) || ndr; // use receiving devices if we don't need to detach existing receivers, but avoid primary device in local transfer mode
imp <<= 1; imp |= device[i]->Receiving(); // avoid devices that are receiving
imp <<= 2; imp |= GetClippedNumProvidedSystems(2, device[i]) - 1; // avoid cards which support multiple delivery systems
imp <<= 4; imp |= GetClippedNumProvidedSystems(4, device[i]) - 1; // avoid cards which support multiple delivery systems
imp <<= 1; imp |= device[i] == cTransferControl::ReceiverDevice(); // avoid the Transfer Mode receiver device
imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 0), 0xFF); // use the device with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)
imp <<= 8; imp |= min(max((NumUsableSlots ? SlotPriority[j] : 0) + MAXPRIORITY, 0), 0xFF); // use the CAM slot with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)

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 2.35 2010/04/10 10:36:27 kls Exp $
* $Id: dvbdevice.c 2.36 2010/04/11 10:47:00 kls Exp $
*/
#include "dvbdevice.h"
@ -151,6 +151,14 @@ int MapToUser(int Value, const tDvbParameterMap *Map, const char **String)
return -1;
}
const char *MapToUserString(int Value, const tDvbParameterMap *Map)
{
int n = DriverIndex(Value, Map);
if (n >= 0)
return Map[n].userString;
return "???";
}
int MapToDriver(int Value, const tDvbParameterMap *Map)
{
int n = UserIndex(Value, Map);
@ -694,7 +702,22 @@ cDvbDevice::cDvbDevice(int Adapter, int Frontend)
numProvidedSystems++;
if (frontendType == SYS_DVBS2)
numProvidedSystems++;
isyslog("frontend %d/%d provides %s (\"%s\")", adapter, frontend, DeliverySystems[frontendType], frontendInfo.name);
char Modulations[64];
char *p = Modulations;
if (frontendInfo.caps & FE_CAN_QPSK) { numProvidedSystems++; p += sprintf(p, ",%s", MapToUserString(QPSK, ModulationValues)); }
if (frontendInfo.caps & FE_CAN_QAM_16) { numProvidedSystems++; p += sprintf(p, ",%s", MapToUserString(QAM_16, ModulationValues)); }
if (frontendInfo.caps & FE_CAN_QAM_32) { numProvidedSystems++; p += sprintf(p, ",%s", MapToUserString(QAM_32, ModulationValues)); }
if (frontendInfo.caps & FE_CAN_QAM_64) { numProvidedSystems++; p += sprintf(p, ",%s", MapToUserString(QAM_64, ModulationValues)); }
if (frontendInfo.caps & FE_CAN_QAM_128) { numProvidedSystems++; p += sprintf(p, ",%s", MapToUserString(QAM_128, ModulationValues)); }
if (frontendInfo.caps & FE_CAN_QAM_256) { numProvidedSystems++; p += sprintf(p, ",%s", MapToUserString(QAM_256, ModulationValues)); }
if (frontendInfo.caps & FE_CAN_8VSB) { numProvidedSystems++; p += sprintf(p, ",%s", MapToUserString(VSB_8, ModulationValues)); }
if (frontendInfo.caps & FE_CAN_16VSB) { numProvidedSystems++; p += sprintf(p, ",%s", MapToUserString(VSB_16, ModulationValues)); }
if (frontendInfo.caps & FE_CAN_PSK_8) { numProvidedSystems++; p += sprintf(p, ",%s", MapToUserString(PSK_8, ModulationValues)); }
if (p != Modulations)
p = Modulations + 1; // skips first ','
else
p = (char *)"unknown modulations";
isyslog("frontend %d/%d provides %s with %s (\"%s\")", adapter, frontend, DeliverySystems[frontendType], p, frontendInfo.name);
dvbTuner = new cDvbTuner(CardIndex() + 1, fd_frontend, adapter, frontend, frontendType);
}
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.h 2.13 2010/02/21 14:06:08 kls Exp $
* $Id: dvbdevice.h 2.14 2010/04/11 10:29:37 kls Exp $
*/
#ifndef __DVBDEVICE_H
@ -37,6 +37,7 @@ struct tDvbParameterMap {
const char *userString;
};
const char *MapToUserString(int Value, const tDvbParameterMap *Map);
int MapToUser(int Value, const tDvbParameterMap *Map, const char **String = NULL);
int MapToDriver(int Value, const tDvbParameterMap *Map);
int UserIndex(int Value, const tDvbParameterMap *Map);