diff -Naur vdr-1.5.8/config.c vdr-1.5.8-pin/config.c --- vdr-1.5.8/config.c 2009-01-10 11:01:00.702666069 -0500 +++ vdr-1.5.8-pin/config.c 2008-12-29 12:15:02.000000000 -0500 @@ -15,6 +15,7 @@ #include "interface.h" #include "plugin.h" #include "recording.h" +#include "sources.h" #include "memcpy.h" // IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d' @@ -295,6 +297,8 @@ MultiSpeedMode = 0; ShowReplayMode = 0; ResumeID = 0; + memset(SourceCaps, 0, sizeof SourceCaps); + SourceCapsSet = false; CurrentChannel = -1; CurrentVolume = MAXVOLUME; CurrentDolby = 0; @@ -400,6 +404,49 @@ return true; } +void cSetup::StoreSourceCaps(const char *Name) +{ + cSetupLine *l; + while ((l = Get(Name)) != NULL) + Del(l); + + for (int i = 0; i < MAXDEVICES; i++) { + char buffer[MAXSOURCECAPS*8]={0,}, *q = buffer; + int j = 0; + while (SourceCaps[i][j] && j < MAXSOURCECAPS) { + if (j==0) + q += snprintf(buffer, sizeof(buffer), "%i ", i+1); + q += snprintf(q, sizeof(buffer) - (q-buffer), "%s ", *cSource::ToString(SourceCaps[i][j++])); + } + if (*buffer) + Store(Name, buffer, NULL, true); + } +} + +bool cSetup::ParseSourceCaps(const char *Value) +{ + char *p; + int d = strtol(Value, &p, 10)-1, i = 0; + while (p < Value+strlen(Value)) { + if (*p==0) return true; + if (isblank(*p)) ++p; + if (isalpha(*p)) { + int source = cSource::FromString(p); + if (source != cSource::stNone) { + SourceCaps[d][i++] = source; + SourceCapsSet = true; + } + else + return false; + while (!isblank(*p) && *p) + ++p; + if (i>MAXSOURCECAPS) + return false; + } + } + return true; +} + bool cSetup::Parse(const char *Name, const char *Value) { if (!strcasecmp(Name, "OSDLanguage")) { strn0cpy(OSDLanguage, Value, sizeof(OSDLanguage)); I18nSetLocale(OSDLanguage); } @@ -482,6 +528,7 @@ else if (!strcasecmp(Name, "MultiSpeedMode")) MultiSpeedMode = atoi(Value); else if (!strcasecmp(Name, "ShowReplayMode")) ShowReplayMode = atoi(Value); else if (!strcasecmp(Name, "ResumeID")) ResumeID = atoi(Value); + else if (!strcasecmp(Name, "SourceCaps")) return ParseSourceCaps(Value); else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value); else if (!strcasecmp(Name, "CurrentVolume")) CurrentVolume = atoi(Value); else if (!strcasecmp(Name, "CurrentDolby")) CurrentDolby = atoi(Value); @@ -576,6 +626,7 @@ Store("MultiSpeedMode", MultiSpeedMode); Store("ShowReplayMode", ShowReplayMode); Store("ResumeID", ResumeID); + if (SourceCapsSet) StoreSourceCaps("SourceCaps"); Store("CurrentChannel", CurrentChannel); Store("CurrentVolume", CurrentVolume); Store("CurrentDolby", CurrentDolby); diff -Naur vdr-1.5.8/config.h vdr-1.5.8-pin/config.h --- vdr-1.5.8/config.h 2009-01-10 11:18:34.278679377 -0500 +++ vdr-1.5.8-pin/config.h 2008-12-29 12:15:44.000000000 -0500 @@ -48,6 +48,9 @@ #define MINOSDHEIGHT 324 #define MAXOSDHEIGHT 567 +#define MAXDEVICES 16 // the maximum number of devices in the system +#define MAXSOURCECAPS 128 // the maximum number of different sources per device + #define MaxFileName 256 #define MaxSkinName 16 #define MaxThemeName 16 @@ -198,6 +201,8 @@ void StoreLanguages(const char *Name, int *Values); bool ParseLanguages(const char *Value, int *Values); bool Parse(const char *Name, const char *Value); + void StoreSourceCaps(const char *Name); + bool ParseSourceCaps(const char *Value); cSetupLine *Get(const char *Name, const char *Plugin = NULL); void Store(const char *Name, const char *Value, const char *Plugin = NULL, bool AllowMultiple = false); void Store(const char *Name, int Value, const char *Plugin = NULL); @@ -277,6 +283,8 @@ int MultiSpeedMode; int ShowReplayMode; int ResumeID; + int SourceCaps[MAXDEVICES][MAXSOURCECAPS]; + bool SourceCapsSet; int CurrentChannel; int CurrentVolume; int CurrentDolby; diff -Naur vdr-1.5.8/device.c vdr-1.5.8-pin/device.c --- vdr-1.5.8/device.c 2009-01-10 10:59:10.647620860 -0500 +++ vdr-1.5.8-pin/device.c 2008-10-07 17:43:27.000000000 -0400 @@ -180,8 +181,10 @@ for (int i = 0; i < MAXRECEIVERS; i++) receiver[i] = NULL; - if (numDevices < MAXDEVICES) + if (numDevices < MAXDEVICES) { device[numDevices++] = this; + SetSourceCaps(cardIndex); + } else esyslog("ERROR: too many devices!"); } @@ -386,6 +402,16 @@ camSlot = CamSlot; } +void cDevice::SetSourceCaps(int Index) +{ + for (int d = 0; d < numDevices; d++) { + if (Index < 0 || Index == device[d]->CardIndex()) { + for (int i = 0; i < MAXSOURCECAPS; i++) + device[d]->sourceCaps[i] = Setup.SourceCaps[device[d]->CardIndex()][i]; + } + } +} + void cDevice::Shutdown(void) { primaryDevice = NULL; diff -Naur vdr-1.5.8/device.h vdr-1.5.8-pin/device.h --- vdr-1.5.8/device.h 2009-01-10 10:21:42.336870320 -0500 +++ vdr-1.5.8-pin/device.h 2008-10-07 13:54:42.000000000 -0400 @@ -144,6 +144,8 @@ ///< this device/CAM combination will be skipped in the next call to ///< GetDevice(). ///< See also ProvidesChannel(). + static void SetSourceCaps(int Index = -1); + ///< Sets the SourceCaps of the given device according to the Setup data. static void Shutdown(void); ///< Closes down all devices. ///< Must be called at the end of the program. @@ -151,6 +153,7 @@ static int nextCardIndex; int cardIndex; protected: + int sourceCaps[MAXSOURCECAPS]; cDevice(void); virtual ~cDevice(); virtual bool Ready(void); diff -Naur vdr-1.5.8/dvbdevice.c vdr-1.5.8-pin/dvbdevice.c --- vdr-1.5.8/dvbdevice.c 2009-01-10 10:59:10.648620360 -0500 +++ vdr-1.5.8-pin/dvbdevice.c 2008-10-07 13:55:00.000000000 -0400 @@ -775,6 +775,13 @@ bool cDvbDevice::ProvidesSource(int Source) const { int type = Source & cSource::st_Mask; + if (Setup.SourceCapsSet && type == cSource::stSat && (frontendType == FE_QPSK || frontendType ==FE_DVB_S || frontendType == FE_DVB_S2)) { + for (int i = 0; i < MAXSOURCECAPS; i++) + if (sourceCaps[i] == Source) + return true; + return false; + } + else return type == cSource::stNone || type == cSource::stCable && frontendType == FE_QAM || type == cSource::stCable && frontendType == FE_ATSC diff -Naur vdr-1.5.8/sources.c vdr-1.5.8-pin/sources.c --- vdr-1.5.8/sources.c 2009-01-09 19:43:36.169621124 -0500 +++ vdr-1.5.8-pin/sources.c 2008-08-29 18:51:21.000000000 -0400 @@ -69,7 +69,7 @@ int pos = 0; bool dot = false; bool neg = false; - while (*++s) { + while (*++s && !isblank(*s)) { switch (toupper(*s)) { case '0' ... '9': pos *= 10; pos += *s - '0';