mirror of
https://github.com/rofafor/vdr-plugin-femon.git
synced 2023-10-10 13:36:53 +02:00
Refactored configuration handling.
This commit is contained in:
parent
43a071c7fd
commit
6875f81c60
45
femon.c
45
femon.c
@ -42,7 +42,7 @@ public:
|
|||||||
virtual void Housekeeping(void);
|
virtual void Housekeeping(void);
|
||||||
virtual void MainThreadHook(void) {}
|
virtual void MainThreadHook(void) {}
|
||||||
virtual cString Active(void) { return NULL; }
|
virtual cString Active(void) { return NULL; }
|
||||||
virtual const char *MainMenuEntry(void) { return (FemonConfig.hidemenu ? NULL : tr(MAINMENUENTRY)); }
|
virtual const char *MainMenuEntry(void) { return (FemonConfig.GetHideMenu() ? NULL : tr(MAINMENUENTRY)); }
|
||||||
virtual cOsdObject *MainMenuAction(void);
|
virtual cOsdObject *MainMenuAction(void);
|
||||||
virtual cMenuSetupPage *SetupMenu(void);
|
virtual cMenuSetupPage *SetupMenu(void);
|
||||||
virtual bool SetupParse(const char *nameP, const char *valueP);
|
virtual bool SetupParse(const char *nameP, const char *valueP);
|
||||||
@ -119,23 +119,36 @@ cMenuSetupPage *cPluginFemon::SetupMenu(void)
|
|||||||
bool cPluginFemon::SetupParse(const char *nameP, const char *valueP)
|
bool cPluginFemon::SetupParse(const char *nameP, const char *valueP)
|
||||||
{
|
{
|
||||||
// Parse your own setup parameters and store their values.
|
// Parse your own setup parameters and store their values.
|
||||||
if (!strcasecmp(nameP, "HideMenu")) FemonConfig.hidemenu = atoi(valueP);
|
if (!strcasecmp(nameP, "HideMenu"))
|
||||||
else if (!strcasecmp(nameP, "DisplayMode")) FemonConfig.displaymode = atoi(valueP);
|
FemonConfig.SetHideMenu(atoi(valueP));
|
||||||
else if (!strcasecmp(nameP, "Position")) FemonConfig.position = atoi(valueP);
|
else if (!strcasecmp(nameP, "DisplayMode"))
|
||||||
else if (!strcasecmp(nameP, "Skin")) FemonConfig.skin = atoi(valueP);
|
FemonConfig.SetDisplayMode(atoi(valueP));
|
||||||
else if (!strcasecmp(nameP, "Theme")) FemonConfig.theme = atoi(valueP);
|
else if (!strcasecmp(nameP, "Position"))
|
||||||
else if (!strcasecmp(nameP, "Downscale")) FemonConfig.downscale = atoi(valueP);
|
FemonConfig.SetPosition(atoi(valueP));
|
||||||
else if (!strcasecmp(nameP, "RedLimit")) FemonConfig.redlimit = atoi(valueP);
|
else if (!strcasecmp(nameP, "Skin"))
|
||||||
else if (!strcasecmp(nameP, "GreenLimit")) FemonConfig.greenlimit = atoi(valueP);
|
FemonConfig.SetSkin(atoi(valueP));
|
||||||
else if (!strcasecmp(nameP, "UpdateInterval")) FemonConfig.updateinterval = atoi(valueP);
|
else if (!strcasecmp(nameP, "Theme"))
|
||||||
else if (!strcasecmp(nameP, "AnalStream")) FemonConfig.analyzestream = atoi(valueP);
|
FemonConfig.SetTheme(atoi(valueP));
|
||||||
else if (!strcasecmp(nameP, "CalcInterval")) FemonConfig.calcinterval = atoi(valueP);
|
else if (!strcasecmp(nameP, "Downscale"))
|
||||||
else if (!strcasecmp(nameP, "UseSvdrp")) FemonConfig.usesvdrp = atoi(valueP);
|
FemonConfig.SetDownscale(atoi(valueP));
|
||||||
else if (!strcasecmp(nameP, "ServerPort")) FemonConfig.svdrpport = atoi(valueP);
|
else if (!strcasecmp(nameP, "RedLimit"))
|
||||||
else if (!strcasecmp(nameP, "ServerIp")) strn0cpy(FemonConfig.svdrpip, valueP, sizeof(FemonConfig.svdrpip));
|
FemonConfig.SetRedLimit(atoi(valueP));
|
||||||
|
else if (!strcasecmp(nameP, "GreenLimit"))
|
||||||
|
FemonConfig.SetGreenLimit(atoi(valueP));
|
||||||
|
else if (!strcasecmp(nameP, "UpdateInterval"))
|
||||||
|
FemonConfig.SetUpdateInterval(atoi(valueP));
|
||||||
|
else if (!strcasecmp(nameP, "AnalStream"))
|
||||||
|
FemonConfig.SetAnalyzeStream(atoi(valueP));
|
||||||
|
else if (!strcasecmp(nameP, "CalcInterval"))
|
||||||
|
FemonConfig.SetCalcInterval(atoi(valueP));
|
||||||
|
else if (!strcasecmp(nameP, "UseSvdrp"))
|
||||||
|
FemonConfig.SetUseSvdrp(atoi(valueP));
|
||||||
|
else if (!strcasecmp(nameP, "ServerPort"))
|
||||||
|
FemonConfig.SetSvdrpPort(atoi(valueP));
|
||||||
|
else if (!strcasecmp(nameP, "ServerIp"))
|
||||||
|
FemonConfig.SetSvdrpIp(valueP);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
if (FemonConfig.displaymode < 0 || FemonConfig.displaymode >= eFemonModeMaxNumber) FemonConfig.displaymode = 0;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -7,26 +7,33 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "femontools.h"
|
||||||
#include "femonconfig.h"
|
#include "femonconfig.h"
|
||||||
|
|
||||||
cFemonConfig FemonConfig;
|
cFemonConfig FemonConfig;
|
||||||
|
|
||||||
cFemonConfig::cFemonConfig(void)
|
cFemonConfig::cFemonConfig()
|
||||||
|
: traceModeM(eTraceModeNormal),
|
||||||
|
hideMenuM(0),
|
||||||
|
displayModeM(0),
|
||||||
|
skinM(0),
|
||||||
|
themeM(0),
|
||||||
|
positionM(1),
|
||||||
|
downscaleM(0),
|
||||||
|
redLimitM(33),
|
||||||
|
greenLimitM(66),
|
||||||
|
updateIntervalM(5),
|
||||||
|
analyzeStreamM(1),
|
||||||
|
calcIntervalM(20),
|
||||||
|
useSvdrpM(0),
|
||||||
|
svdrpPortM(6419)
|
||||||
{
|
{
|
||||||
hidemenu = 0;
|
SetSvdrpIp("0.0.0.0");
|
||||||
displaymode = 0;
|
}
|
||||||
skin = 0;
|
|
||||||
theme = 0;
|
void cFemonConfig::SetSvdrpIp(const char *strP)
|
||||||
position = 1;
|
{
|
||||||
downscale = 0;
|
strn0cpy(svdrpIpM, strP, sizeof(svdrpIpM));
|
||||||
redlimit = 33;
|
|
||||||
greenlimit = 66;
|
|
||||||
updateinterval = 5;
|
|
||||||
analyzestream = 1;
|
|
||||||
calcinterval = 20;
|
|
||||||
usesvdrp = 0;
|
|
||||||
svdrpport = 6419;
|
|
||||||
strncpy(svdrpip, "0.0.0.0", sizeof(svdrpip));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const cFemonTheme FemonTheme[eFemonThemeMaxNumber] =
|
const cFemonTheme FemonTheme[eFemonThemeMaxNumber] =
|
||||||
|
@ -19,24 +19,79 @@ enum eFemonModes
|
|||||||
eFemonModeMaxNumber
|
eFemonModeMaxNumber
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cFemonConfig
|
class cFemonConfig
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
unsigned int traceModeM;
|
||||||
|
int hideMenuM;
|
||||||
|
int displayModeM;
|
||||||
|
int skinM;
|
||||||
|
int themeM;
|
||||||
|
int positionM;
|
||||||
|
int downscaleM;
|
||||||
|
int redLimitM;
|
||||||
|
int greenLimitM;
|
||||||
|
int updateIntervalM;
|
||||||
|
int analyzeStreamM;
|
||||||
|
int calcIntervalM;
|
||||||
|
int useSvdrpM;
|
||||||
|
int svdrpPortM;
|
||||||
|
char svdrpIpM[MaxSvdrpIp + 1]; // must end with additional null
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cFemonConfig(void);
|
enum eTraceMode {
|
||||||
int hidemenu;
|
eTraceModeNormal = 0x0000,
|
||||||
int displaymode;
|
eTraceModeDebug1 = 0x0001,
|
||||||
int skin;
|
eTraceModeDebug2 = 0x0002,
|
||||||
int theme;
|
eTraceModeDebug3 = 0x0004,
|
||||||
int position;
|
eTraceModeDebug4 = 0x0008,
|
||||||
int downscale;
|
eTraceModeDebug5 = 0x0010,
|
||||||
int redlimit;
|
eTraceModeDebug6 = 0x0020,
|
||||||
int greenlimit;
|
eTraceModeDebug7 = 0x0040,
|
||||||
int updateinterval;
|
eTraceModeDebug8 = 0x0080,
|
||||||
int analyzestream;
|
eTraceModeDebug9 = 0x0100,
|
||||||
int calcinterval;
|
eTraceModeDebug10 = 0x0200,
|
||||||
int usesvdrp;
|
eTraceModeDebug11 = 0x0400,
|
||||||
int svdrpport;
|
eTraceModeDebug12 = 0x0800,
|
||||||
char svdrpip[MaxSvdrpIp + 1]; // must end with additional null
|
eTraceModeDebug13 = 0x1000,
|
||||||
|
eTraceModeDebug14 = 0x2000,
|
||||||
|
eTraceModeDebug15 = 0x4000,
|
||||||
|
eTraceModeDebug16 = 0x8000,
|
||||||
|
eTraceModeMask = 0xFFFF
|
||||||
|
};
|
||||||
|
cFemonConfig();
|
||||||
|
unsigned int GetTraceMode(void) const { return traceModeM; }
|
||||||
|
bool IsTraceMode(eTraceMode modeP) const { return (traceModeM & modeP); }
|
||||||
|
int GetHideMenu(void) const { return hideMenuM; }
|
||||||
|
int GetDisplayMode(void) const { return displayModeM; }
|
||||||
|
int GetSkin(void) const { return skinM; }
|
||||||
|
int GetTheme(void) const { return themeM; }
|
||||||
|
int GetPosition(void) const { return positionM; }
|
||||||
|
int GetDownscale(void) const { return downscaleM; }
|
||||||
|
int GetRedLimit(void) const { return redLimitM; }
|
||||||
|
int GetGreenLimit(void) const { return greenLimitM; }
|
||||||
|
int GetUpdateInterval(void) const { return updateIntervalM; }
|
||||||
|
int GetAnalyzeStream(void) const { return analyzeStreamM; }
|
||||||
|
int GetCalcInterval(void) const { return calcIntervalM; }
|
||||||
|
int GetUseSvdrp(void) const { return useSvdrpM; }
|
||||||
|
int GetSvdrpPort(void) const { return svdrpPortM; }
|
||||||
|
const char *GetSvdrpIp(void) const { return svdrpIpM; }
|
||||||
|
|
||||||
|
void SetTraceMode(unsigned int modeP) { traceModeM = (modeP & eTraceModeMask); }
|
||||||
|
void SetHideMenu(int hideMenuP) { hideMenuM = hideMenuP; }
|
||||||
|
void SetDisplayMode(int displayModeP) { if (displayModeM < 0 || displayModeM >= eFemonModeMaxNumber) displayModeM = 0; else displayModeM = displayModeP; }
|
||||||
|
void SetSkin(int skinP) { skinM = skinP; }
|
||||||
|
void SetTheme(int themeP) { themeM = themeP; }
|
||||||
|
void SetPosition(int positionP) { positionM = positionP; }
|
||||||
|
void SetDownscale(int downscaleP) { downscaleM = downscaleP; }
|
||||||
|
void SetRedLimit(int redLimitP) { redLimitM = redLimitP; }
|
||||||
|
void SetGreenLimit(int greenLimitP) { greenLimitM = greenLimitP; }
|
||||||
|
void SetUpdateInterval(int updateIntervalP) { updateIntervalM = updateIntervalP; }
|
||||||
|
void SetAnalyzeStream(int analyzeStreamP) { analyzeStreamM = analyzeStreamP; }
|
||||||
|
void SetCalcInterval(int calcIntervalP) { calcIntervalM = calcIntervalP; }
|
||||||
|
void SetUseSvdrp(int useSvdrpP) { useSvdrpM = useSvdrpP; }
|
||||||
|
void SetSvdrpPort(int svdrpPortP) { svdrpPortM = svdrpPortP; }
|
||||||
|
void SetSvdrpIp(const char *strP);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern cFemonConfig FemonConfig;
|
extern cFemonConfig FemonConfig;
|
||||||
|
98
femonosd.c
98
femonosd.c
@ -29,14 +29,14 @@
|
|||||||
#define OSDSYMBOL(id) femonSymbols.Get(id)
|
#define OSDSYMBOL(id) femonSymbols.Get(id)
|
||||||
#define OSDSPACING femonSymbols.GetSpacing()
|
#define OSDSPACING femonSymbols.GetSpacing()
|
||||||
#define OSDROUNDING femonSymbols.GetRounding()
|
#define OSDROUNDING femonSymbols.GetRounding()
|
||||||
#define IS_OSDROUNDING (FemonConfig.skin == eFemonSkinElchi)
|
#define IS_OSDROUNDING (FemonConfig.GetSkin() == eFemonSkinElchi)
|
||||||
#define IS_OSDRESOLUTION(r1, r2) (abs(r1 - r2) < 20)
|
#define IS_OSDRESOLUTION(r1, r2) (abs(r1 - r2) < 20)
|
||||||
#define OSDINFOWIN_Y(offset) (FemonConfig.position ? (OSDHEIGHT - OSDINFOHEIGHT + offset) : offset)
|
#define OSDINFOWIN_Y(offset) (FemonConfig.GetPosition() ? (OSDHEIGHT - OSDINFOHEIGHT + offset) : offset)
|
||||||
#define OSDINFOWIN_X(col) ((col == 4) ? int(round(OSDWIDTH * 0.76)) : \
|
#define OSDINFOWIN_X(col) ((col == 4) ? int(round(OSDWIDTH * 0.76)) : \
|
||||||
(col == 3) ? int(round(OSDWIDTH * 0.51)) : \
|
(col == 3) ? int(round(OSDWIDTH * 0.51)) : \
|
||||||
(col == 2) ? int(round(OSDWIDTH * 0.26)) : \
|
(col == 2) ? int(round(OSDWIDTH * 0.26)) : \
|
||||||
int(round(OSDWIDTH * 0.025)))
|
int(round(OSDWIDTH * 0.025)))
|
||||||
#define OSDSTATUSWIN_Y(offset) (FemonConfig.position ? offset : (OSDHEIGHT - OSDSTATUSHEIGHT + offset))
|
#define OSDSTATUSWIN_Y(offset) (FemonConfig.GetPosition() ? offset : (OSDHEIGHT - OSDSTATUSHEIGHT + offset))
|
||||||
#define OSDSTATUSWIN_X(col) ((col == 7) ? int(round(OSDWIDTH * 0.79)) : \
|
#define OSDSTATUSWIN_X(col) ((col == 7) ? int(round(OSDWIDTH * 0.79)) : \
|
||||||
(col == 6) ? int(round(OSDWIDTH * 0.68)) : \
|
(col == 6) ? int(round(OSDWIDTH * 0.68)) : \
|
||||||
(col == 5) ? int(round(OSDWIDTH * 0.46)) : \
|
(col == 5) ? int(round(OSDWIDTH * 0.46)) : \
|
||||||
@ -52,39 +52,39 @@
|
|||||||
x -= bm->Width() + spacing; \
|
x -= bm->Width() + spacing; \
|
||||||
y = (OSDROWHEIGHT - bm->Height()) / 2; \
|
y = (OSDROWHEIGHT - bm->Height()) / 2; \
|
||||||
if (y < 0) y = 0; \
|
if (y < 0) y = 0; \
|
||||||
osdM->DrawBitmap(x, OSDSTATUSWIN_Y(offset) + y, *bm, FemonTheme[FemonConfig.theme].clrTitleText, FemonTheme[FemonConfig.theme].clrTitleBackground); \
|
osdM->DrawBitmap(x, OSDSTATUSWIN_Y(offset) + y, *bm, FemonTheme[FemonConfig.GetTheme()].clrTitleText, FemonTheme[FemonConfig.GetTheme()].clrTitleBackground); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define OSDDRAWSTATUSFRONTEND(column, bitmap, status) \
|
#define OSDDRAWSTATUSFRONTEND(column, bitmap, status) \
|
||||||
osdM->DrawBitmap(OSDSTATUSWIN_XSYMBOL(column, x), OSDSTATUSWIN_Y(offset) + y, bitmap, (frontendStatusM & status) ? FemonTheme[FemonConfig.theme].clrActiveText : FemonTheme[FemonConfig.theme].clrRed, FemonTheme[FemonConfig.theme].clrBackground)
|
osdM->DrawBitmap(OSDSTATUSWIN_XSYMBOL(column, x), OSDSTATUSWIN_Y(offset) + y, bitmap, (frontendStatusM & status) ? FemonTheme[FemonConfig.GetTheme()].clrActiveText : FemonTheme[FemonConfig.GetTheme()].clrRed, FemonTheme[FemonConfig.GetTheme()].clrBackground)
|
||||||
|
|
||||||
#define OSDDRAWSTATUSVALUES(label1, label2, label3, label4, label5, label6, label7) \
|
#define OSDDRAWSTATUSVALUES(label1, label2, label3, label4, label5, label6, label7) \
|
||||||
osdM->DrawText(OSDSTATUSWIN_X(1), OSDSTATUSWIN_Y(offset), label1, FemonTheme[FemonConfig.theme].clrInactiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM); \
|
osdM->DrawText(OSDSTATUSWIN_X(1), OSDSTATUSWIN_Y(offset), label1, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
||||||
osdM->DrawText(OSDSTATUSWIN_X(2), OSDSTATUSWIN_Y(offset), label2, FemonTheme[FemonConfig.theme].clrInactiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM); \
|
osdM->DrawText(OSDSTATUSWIN_X(2), OSDSTATUSWIN_Y(offset), label2, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
||||||
osdM->DrawText(OSDSTATUSWIN_X(3), OSDSTATUSWIN_Y(offset), label3, FemonTheme[FemonConfig.theme].clrInactiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM); \
|
osdM->DrawText(OSDSTATUSWIN_X(3), OSDSTATUSWIN_Y(offset), label3, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
||||||
osdM->DrawText(OSDSTATUSWIN_X(4), OSDSTATUSWIN_Y(offset), label4, FemonTheme[FemonConfig.theme].clrInactiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM); \
|
osdM->DrawText(OSDSTATUSWIN_X(4), OSDSTATUSWIN_Y(offset), label4, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
||||||
osdM->DrawText(OSDSTATUSWIN_X(5), OSDSTATUSWIN_Y(offset), label5, FemonTheme[FemonConfig.theme].clrInactiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM); \
|
osdM->DrawText(OSDSTATUSWIN_X(5), OSDSTATUSWIN_Y(offset), label5, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
||||||
osdM->DrawText(OSDSTATUSWIN_X(6), OSDSTATUSWIN_Y(offset), label6, FemonTheme[FemonConfig.theme].clrInactiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM); \
|
osdM->DrawText(OSDSTATUSWIN_X(6), OSDSTATUSWIN_Y(offset), label6, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
||||||
osdM->DrawText(OSDSTATUSWIN_X(7), OSDSTATUSWIN_Y(offset), label7, FemonTheme[FemonConfig.theme].clrInactiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM)
|
osdM->DrawText(OSDSTATUSWIN_X(7), OSDSTATUSWIN_Y(offset), label7, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM)
|
||||||
|
|
||||||
#define OSDDRAWSTATUSBAR(value) \
|
#define OSDDRAWSTATUSBAR(value) \
|
||||||
if (value > 0) { \
|
if (value > 0) { \
|
||||||
int barvalue = OSDBARWIDTH(value); \
|
int barvalue = OSDBARWIDTH(value); \
|
||||||
osdM->DrawRectangle(0, OSDSTATUSWIN_Y(offset) + 3, min(OSDBARWIDTH(FemonConfig.redlimit), barvalue), OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, FemonTheme[FemonConfig.theme].clrRed); \
|
osdM->DrawRectangle(0, OSDSTATUSWIN_Y(offset) + 3, min(OSDBARWIDTH(FemonConfig.GetRedLimit()), barvalue), OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, FemonTheme[FemonConfig.GetTheme()].clrRed); \
|
||||||
if (barvalue > OSDBARWIDTH(FemonConfig.redlimit)) \
|
if (barvalue > OSDBARWIDTH(FemonConfig.GetRedLimit())) \
|
||||||
osdM->DrawRectangle(OSDBARWIDTH(FemonConfig.redlimit), OSDSTATUSWIN_Y(offset) + 3, min((OSDWIDTH * FemonConfig.greenlimit / 100), barvalue), OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, FemonTheme[FemonConfig.theme].clrYellow); \
|
osdM->DrawRectangle(OSDBARWIDTH(FemonConfig.GetRedLimit()), OSDSTATUSWIN_Y(offset) + 3, min((OSDWIDTH * FemonConfig.GetGreenLimit() / 100), barvalue), OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, FemonTheme[FemonConfig.GetTheme()].clrYellow); \
|
||||||
if (barvalue > OSDBARWIDTH(FemonConfig.greenlimit)) \
|
if (barvalue > OSDBARWIDTH(FemonConfig.GetGreenLimit())) \
|
||||||
osdM->DrawRectangle(OSDBARWIDTH(FemonConfig.greenlimit), OSDSTATUSWIN_Y(offset) + 3, barvalue, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, FemonTheme[FemonConfig.theme].clrGreen); \
|
osdM->DrawRectangle(OSDBARWIDTH(FemonConfig.GetGreenLimit()), OSDSTATUSWIN_Y(offset) + 3, barvalue, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, FemonTheme[FemonConfig.GetTheme()].clrGreen); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define OSDDRAWSTATUSTITLEBAR(title) \
|
#define OSDDRAWSTATUSTITLEBAR(title) \
|
||||||
osdM->DrawRectangle(0, OSDSTATUSWIN_Y(offset), OSDWIDTH, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 1, FemonTheme[FemonConfig.theme].clrTitleBackground); \
|
osdM->DrawRectangle(0, OSDSTATUSWIN_Y(offset), OSDWIDTH, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 1, FemonTheme[FemonConfig.GetTheme()].clrTitleBackground); \
|
||||||
osdM->DrawText(OSDSTATUSWIN_X(1), OSDSTATUSWIN_Y(offset), title, FemonTheme[FemonConfig.theme].clrTitleText, FemonTheme[FemonConfig.theme].clrTitleBackground, fontM); \
|
osdM->DrawText(OSDSTATUSWIN_X(1), OSDSTATUSWIN_Y(offset), title, FemonTheme[FemonConfig.GetTheme()].clrTitleText, FemonTheme[FemonConfig.GetTheme()].clrTitleBackground, fontM); \
|
||||||
if (IS_OSDROUNDING) { \
|
if (IS_OSDROUNDING) { \
|
||||||
osdM->DrawEllipse(0, OSDSTATUSWIN_Y(0), OSDROUNDING, OSDSTATUSWIN_Y(OSDROUNDING), clrTransparent, -2); \
|
osdM->DrawEllipse(0, OSDSTATUSWIN_Y(0), OSDROUNDING, OSDSTATUSWIN_Y(OSDROUNDING), clrTransparent, -2); \
|
||||||
osdM->DrawEllipse(OSDWIDTH - OSDROUNDING, OSDSTATUSWIN_Y(0), OSDWIDTH, OSDSTATUSWIN_Y(OSDROUNDING), clrTransparent, -1); \
|
osdM->DrawEllipse(OSDWIDTH - OSDROUNDING, OSDSTATUSWIN_Y(0), OSDWIDTH, OSDSTATUSWIN_Y(OSDROUNDING), clrTransparent, -1); \
|
||||||
} \
|
} \
|
||||||
osdM->DrawRectangle(0, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT, OSDWIDTH, OSDSTATUSWIN_Y(offset) + OSDSTATUSHEIGHT - 1, FemonTheme[FemonConfig.theme].clrBackground)
|
osdM->DrawRectangle(0, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT, OSDWIDTH, OSDSTATUSWIN_Y(offset) + OSDSTATUSHEIGHT - 1, FemonTheme[FemonConfig.GetTheme()].clrBackground)
|
||||||
|
|
||||||
#define OSDDRAWSTATUSBOTTOMBAR() \
|
#define OSDDRAWSTATUSBOTTOMBAR() \
|
||||||
if (IS_OSDROUNDING) { \
|
if (IS_OSDROUNDING) { \
|
||||||
@ -96,32 +96,32 @@
|
|||||||
osdM->DrawRectangle(0, OSDSTATUSWIN_Y(0), OSDWIDTH, OSDSTATUSWIN_Y(OSDSTATUSHEIGHT) - 1, clrTransparent)
|
osdM->DrawRectangle(0, OSDSTATUSWIN_Y(0), OSDWIDTH, OSDSTATUSWIN_Y(OSDSTATUSHEIGHT) - 1, clrTransparent)
|
||||||
|
|
||||||
#define OSDDRAWINFOLEFT(label, value) \
|
#define OSDDRAWINFOLEFT(label, value) \
|
||||||
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.theme].clrInactiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM); \
|
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
||||||
osdM->DrawText(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), value, FemonTheme[FemonConfig.theme].clrActiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM)
|
osdM->DrawText(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), value, FemonTheme[FemonConfig.GetTheme()].clrActiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM)
|
||||||
|
|
||||||
#define OSDDRAWINFORIGHT(label, value) \
|
#define OSDDRAWINFORIGHT(label, value) \
|
||||||
osdM->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.theme].clrInactiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM); \
|
osdM->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
||||||
osdM->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), value, FemonTheme[FemonConfig.theme].clrActiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM)
|
osdM->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), value, FemonTheme[FemonConfig.GetTheme()].clrActiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM)
|
||||||
|
|
||||||
#define OSDDRAWINFOACTIVE(label, value) \
|
#define OSDDRAWINFOACTIVE(label, value) \
|
||||||
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.theme].clrActiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM); \
|
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.GetTheme()].clrActiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
||||||
osdM->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), value, FemonTheme[FemonConfig.theme].clrActiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM)
|
osdM->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), value, FemonTheme[FemonConfig.GetTheme()].clrActiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM)
|
||||||
|
|
||||||
#define OSDDRAWINFOINACTIVE(label, value) \
|
#define OSDDRAWINFOINACTIVE(label, value) \
|
||||||
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.theme].clrInactiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM); \
|
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
||||||
osdM->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), value, FemonTheme[FemonConfig.theme].clrActiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM)
|
osdM->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), value, FemonTheme[FemonConfig.GetTheme()].clrActiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM)
|
||||||
|
|
||||||
#define OSDDRAWINFOLINE(label) \
|
#define OSDDRAWINFOLINE(label) \
|
||||||
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.theme].clrActiveText, FemonTheme[FemonConfig.theme].clrBackground, fontM)
|
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.GetTheme()].clrActiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM)
|
||||||
|
|
||||||
#define OSDDRAWINFOTITLEBAR(title) \
|
#define OSDDRAWINFOTITLEBAR(title) \
|
||||||
osdM->DrawRectangle(0, OSDINFOWIN_Y(offset), OSDWIDTH, OSDINFOWIN_Y(offset) + OSDROWHEIGHT - 1, FemonTheme[FemonConfig.theme].clrTitleBackground); \
|
osdM->DrawRectangle(0, OSDINFOWIN_Y(offset), OSDWIDTH, OSDINFOWIN_Y(offset) + OSDROWHEIGHT - 1, FemonTheme[FemonConfig.GetTheme()].clrTitleBackground); \
|
||||||
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), title, FemonTheme[FemonConfig.theme].clrTitleText, FemonTheme[FemonConfig.theme].clrTitleBackground, fontM); \
|
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), title, FemonTheme[FemonConfig.GetTheme()].clrTitleText, FemonTheme[FemonConfig.GetTheme()].clrTitleBackground, fontM); \
|
||||||
if (IS_OSDROUNDING) { \
|
if (IS_OSDROUNDING) { \
|
||||||
osdM->DrawEllipse(0, OSDINFOWIN_Y(0), OSDROUNDING, OSDINFOWIN_Y(OSDROUNDING), clrTransparent, -2); \
|
osdM->DrawEllipse(0, OSDINFOWIN_Y(0), OSDROUNDING, OSDINFOWIN_Y(OSDROUNDING), clrTransparent, -2); \
|
||||||
osdM->DrawEllipse(OSDWIDTH - OSDROUNDING, OSDINFOWIN_Y(0), OSDWIDTH, OSDINFOWIN_Y(OSDROUNDING), clrTransparent, -1); \
|
osdM->DrawEllipse(OSDWIDTH - OSDROUNDING, OSDINFOWIN_Y(0), OSDWIDTH, OSDINFOWIN_Y(OSDROUNDING), clrTransparent, -1); \
|
||||||
} \
|
} \
|
||||||
osdM->DrawRectangle(0, OSDINFOWIN_Y(offset) + OSDROWHEIGHT, OSDWIDTH, OSDINFOWIN_Y(offset) + OSDINFOHEIGHT - 1, FemonTheme[FemonConfig.theme].clrBackground)
|
osdM->DrawRectangle(0, OSDINFOWIN_Y(offset) + OSDROWHEIGHT, OSDWIDTH, OSDINFOWIN_Y(offset) + OSDINFOHEIGHT - 1, FemonTheme[FemonConfig.GetTheme()].clrBackground)
|
||||||
|
|
||||||
#define OSDDRAWINFOBOTTOMBAR() \
|
#define OSDDRAWINFOBOTTOMBAR() \
|
||||||
if (IS_OSDROUNDING) { \
|
if (IS_OSDROUNDING) { \
|
||||||
@ -187,11 +187,11 @@ cFemonOsd::cFemonOsd()
|
|||||||
frontendNameM(""),
|
frontendNameM(""),
|
||||||
frontendStatusValidM(false),
|
frontendStatusValidM(false),
|
||||||
deviceSourceM(DEVICESOURCE_DVBAPI),
|
deviceSourceM(DEVICESOURCE_DVBAPI),
|
||||||
displayModeM(FemonConfig.displaymode),
|
displayModeM(FemonConfig.GetDisplayMode()),
|
||||||
osdWidthM(cOsd::OsdWidth() * (100 - FemonConfig.downscale) / 100),
|
osdWidthM(cOsd::OsdWidth() * (100 - FemonConfig.GetDownscale()) / 100),
|
||||||
osdHeightM(cOsd::OsdHeight() * (100 - FemonConfig.downscale) / 100),
|
osdHeightM(cOsd::OsdHeight() * (100 - FemonConfig.GetDownscale()) / 100),
|
||||||
osdLeftM(cOsd::OsdLeft() + (cOsd::OsdWidth() * FemonConfig.downscale / 200)),
|
osdLeftM(cOsd::OsdLeft() + (cOsd::OsdWidth() * FemonConfig.GetDownscale() / 200)),
|
||||||
osdTopM(cOsd::OsdTop() + (cOsd::OsdHeight() * FemonConfig.downscale / 200)),
|
osdTopM(cOsd::OsdTop() + (cOsd::OsdHeight() * FemonConfig.GetDownscale() / 200)),
|
||||||
inputTimeM(0),
|
inputTimeM(0),
|
||||||
sleepM(),
|
sleepM(),
|
||||||
mutexM()
|
mutexM()
|
||||||
@ -706,7 +706,7 @@ void cFemonOsd::Action(void)
|
|||||||
}
|
}
|
||||||
DrawInfoWindow();
|
DrawInfoWindow();
|
||||||
DrawStatusWindow();
|
DrawStatusWindow();
|
||||||
sleepM.Wait(max((int)(100 * FemonConfig.updateinterval - t.Elapsed()), 3));
|
sleepM.Wait(max((int)(100 * FemonConfig.GetUpdateInterval() - t.Elapsed()), 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -730,7 +730,7 @@ void cFemonOsd::Show(void)
|
|||||||
frontendM = dev ? open(*cString::sprintf(FRONTEND_DEVICE, dev->Adapter(), dev->Frontend()), O_RDONLY | O_NONBLOCK) : -1;
|
frontendM = dev ? open(*cString::sprintf(FRONTEND_DEVICE, dev->Adapter(), dev->Frontend()), O_RDONLY | O_NONBLOCK) : -1;
|
||||||
if (frontendM >= 0) {
|
if (frontendM >= 0) {
|
||||||
if (ioctl(frontendM, FE_GET_INFO, &frontendInfoM) < 0) {
|
if (ioctl(frontendM, FE_GET_INFO, &frontendInfoM) < 0) {
|
||||||
if (!FemonConfig.usesvdrp)
|
if (!FemonConfig.GetUseSvdrp())
|
||||||
error("cFemonOsd::Show() cannot read frontend info.");
|
error("cFemonOsd::Show() cannot read frontend info.");
|
||||||
close(frontendM);
|
close(frontendM);
|
||||||
frontendM = -1;
|
frontendM = -1;
|
||||||
@ -738,7 +738,7 @@ void cFemonOsd::Show(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (FemonConfig.usesvdrp) {
|
else if (FemonConfig.GetUseSvdrp()) {
|
||||||
if (!SvdrpConnect() || !SvdrpTune())
|
if (!SvdrpConnect() || !SvdrpTune())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -758,8 +758,8 @@ void cFemonOsd::Show(void)
|
|||||||
osdM->SetAreas(Areas1, sizeof(Areas1) / sizeof(tArea));
|
osdM->SetAreas(Areas1, sizeof(Areas1) / sizeof(tArea));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tArea Areas2[] = { { 0, OSDSTATUSWIN_Y(0), OSDWIDTH - 1, OSDSTATUSWIN_Y(0) + OSDSTATUSHEIGHT - 1, FemonTheme[FemonConfig.theme].bpp },
|
tArea Areas2[] = { { 0, OSDSTATUSWIN_Y(0), OSDWIDTH - 1, OSDSTATUSWIN_Y(0) + OSDSTATUSHEIGHT - 1, FemonTheme[FemonConfig.GetTheme()].bpp },
|
||||||
{ 0, OSDINFOWIN_Y(0), OSDWIDTH - 1, OSDINFOWIN_Y(0) + OSDROWHEIGHT - 1, FemonTheme[FemonConfig.theme].bpp },
|
{ 0, OSDINFOWIN_Y(0), OSDWIDTH - 1, OSDINFOWIN_Y(0) + OSDROWHEIGHT - 1, FemonTheme[FemonConfig.GetTheme()].bpp },
|
||||||
{ 0, OSDINFOWIN_Y(OSDROWHEIGHT), OSDWIDTH - 1, OSDINFOWIN_Y(0) + OSDINFOHEIGHT - 1, 2 } };
|
{ 0, OSDINFOWIN_Y(OSDROWHEIGHT), OSDWIDTH - 1, OSDINFOWIN_Y(0) + OSDINFOHEIGHT - 1, 2 } };
|
||||||
osdM->SetAreas(Areas2, sizeof(Areas2) / sizeof(tArea));
|
osdM->SetAreas(Areas2, sizeof(Areas2) / sizeof(tArea));
|
||||||
}
|
}
|
||||||
@ -770,7 +770,7 @@ void cFemonOsd::Show(void)
|
|||||||
receiverM->Deactivate();
|
receiverM->Deactivate();
|
||||||
DELETENULL(receiverM);
|
DELETENULL(receiverM);
|
||||||
}
|
}
|
||||||
if (FemonConfig.analyzestream && channel) {
|
if (FemonConfig.GetAnalyzeStream() && channel) {
|
||||||
receiverM = new cFemonReceiver(channel, IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0, IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
receiverM = new cFemonReceiver(channel, IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0, IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
||||||
cDevice::ActualDevice()->AttachReceiver(receiverM);
|
cDevice::ActualDevice()->AttachReceiver(receiverM);
|
||||||
}
|
}
|
||||||
@ -795,7 +795,7 @@ void cFemonOsd::ChannelSwitch(const cDevice * deviceP, int channelNumberP, bool
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel && FemonConfig.analyzestream) {
|
if (channel && FemonConfig.GetAnalyzeStream()) {
|
||||||
deviceSourceM = DEVICESOURCE_DVBAPI;
|
deviceSourceM = DEVICESOURCE_DVBAPI;
|
||||||
if (channel->IsSourceType('I'))
|
if (channel->IsSourceType('I'))
|
||||||
deviceSourceM = DEVICESOURCE_IPTV;
|
deviceSourceM = DEVICESOURCE_IPTV;
|
||||||
@ -813,7 +813,7 @@ void cFemonOsd::ChannelSwitch(const cDevice * deviceP, int channelNumberP, bool
|
|||||||
frontendM = dev ? open(*cString::sprintf(FRONTEND_DEVICE, dev->Adapter(), dev->Frontend()), O_RDONLY | O_NONBLOCK) : -1;
|
frontendM = dev ? open(*cString::sprintf(FRONTEND_DEVICE, dev->Adapter(), dev->Frontend()), O_RDONLY | O_NONBLOCK) : -1;
|
||||||
if (frontendM >= 0) {
|
if (frontendM >= 0) {
|
||||||
if (ioctl(frontendM, FE_GET_INFO, &frontendInfoM) < 0) {
|
if (ioctl(frontendM, FE_GET_INFO, &frontendInfoM) < 0) {
|
||||||
if (!FemonConfig.usesvdrp)
|
if (!FemonConfig.GetUseSvdrp())
|
||||||
error("cFemonOsd::ChannelSwitch() cannot read frontend info.");
|
error("cFemonOsd::ChannelSwitch() cannot read frontend info.");
|
||||||
close(frontendM);
|
close(frontendM);
|
||||||
frontendM = -1;
|
frontendM = -1;
|
||||||
@ -821,7 +821,7 @@ void cFemonOsd::ChannelSwitch(const cDevice * deviceP, int channelNumberP, bool
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (FemonConfig.usesvdrp) {
|
else if (FemonConfig.GetUseSvdrp()) {
|
||||||
if (!SvdrpConnect() || !SvdrpTune())
|
if (!SvdrpConnect() || !SvdrpTune())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -849,7 +849,7 @@ void cFemonOsd::SetAudioTrack(int indexP, const char * const *tracksP)
|
|||||||
receiverM->Deactivate();
|
receiverM->Deactivate();
|
||||||
DELETENULL(receiverM);
|
DELETENULL(receiverM);
|
||||||
}
|
}
|
||||||
if (FemonConfig.analyzestream) {
|
if (FemonConfig.GetAnalyzeStream()) {
|
||||||
const cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
const cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
||||||
if (channel) {
|
if (channel) {
|
||||||
receiverM = new cFemonReceiver(channel, IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0, IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
receiverM = new cFemonReceiver(channel, IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0, IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
||||||
@ -950,8 +950,8 @@ bool cFemonOsd::SvdrpConnect(void)
|
|||||||
if (svdrpConnectionM.handle < 0) {
|
if (svdrpConnectionM.handle < 0) {
|
||||||
svdrpPluginM = cPluginManager::GetPlugin(SVDRPPLUGIN);
|
svdrpPluginM = cPluginManager::GetPlugin(SVDRPPLUGIN);
|
||||||
if (svdrpPluginM) {
|
if (svdrpPluginM) {
|
||||||
svdrpConnectionM.serverIp = FemonConfig.svdrpip;
|
svdrpConnectionM.serverIp = FemonConfig.GetSvdrpIp();
|
||||||
svdrpConnectionM.serverPort = (unsigned short)FemonConfig.svdrpport;
|
svdrpConnectionM.serverPort = (unsigned short)FemonConfig.GetSvdrpPort();
|
||||||
svdrpConnectionM.shared = true;
|
svdrpConnectionM.shared = true;
|
||||||
svdrpPluginM->Service("SvdrpConnection-v1.0", &svdrpConnectionM);
|
svdrpPluginM->Service("SvdrpConnection-v1.0", &svdrpConnectionM);
|
||||||
if (svdrpConnectionM.handle >= 0) {
|
if (svdrpConnectionM.handle >= 0) {
|
||||||
|
@ -232,7 +232,7 @@ void cFemonReceiver::Action(void)
|
|||||||
|
|
||||||
// calculate bitrates
|
// calculate bitrates
|
||||||
timeout = double(calcPeriod.Elapsed());
|
timeout = double(calcPeriod.Elapsed());
|
||||||
if (activeM && (timeout >= (100.0 * FemonConfig.calcinterval))) {
|
if (activeM && (timeout >= (100.0 * FemonConfig.GetCalcInterval()))) {
|
||||||
// TS packet 188 bytes - 4 byte header; MPEG standard defines 1Mbit = 1000000bit
|
// TS packet 188 bytes - 4 byte header; MPEG standard defines 1Mbit = 1000000bit
|
||||||
// PES headers should be compensated!
|
// PES headers should be compensated!
|
||||||
videoBitRateM = (1000.0 * 8.0 * 184.0 * videoPacketCountM) / timeout;
|
videoBitRateM = (1000.0 * 8.0 * 184.0 * videoPacketCountM) / timeout;
|
||||||
|
105
femonsetup.c
105
femonsetup.c
@ -11,8 +11,23 @@
|
|||||||
#include "femonsetup.h"
|
#include "femonsetup.h"
|
||||||
|
|
||||||
cMenuFemonSetup::cMenuFemonSetup()
|
cMenuFemonSetup::cMenuFemonSetup()
|
||||||
|
: hideMenuM(FemonConfig.GetHideMenu()),
|
||||||
|
displayModeM(FemonConfig.GetDisplayMode()),
|
||||||
|
skinM(FemonConfig.GetSkin()),
|
||||||
|
themeM(FemonConfig.GetTheme()),
|
||||||
|
positionM(FemonConfig.GetPosition()),
|
||||||
|
downscaleM(FemonConfig.GetDownscale()),
|
||||||
|
redLimitM(FemonConfig.GetRedLimit()),
|
||||||
|
greenLimitM(FemonConfig.GetGreenLimit()),
|
||||||
|
updateIntervalM(FemonConfig.GetUpdateInterval()),
|
||||||
|
analyzeStreamM(FemonConfig.GetAnalyzeStream()),
|
||||||
|
calcIntervalM(FemonConfig.GetCalcInterval()),
|
||||||
|
useSvdrpM(FemonConfig.GetUseSvdrp()),
|
||||||
|
svdrpPortM(FemonConfig.GetSvdrpPort())
|
||||||
{
|
{
|
||||||
debug("%s()\n", __PRETTY_FUNCTION__);
|
debug("%s()\n", __PRETTY_FUNCTION__);
|
||||||
|
strn0cpy(svdrpIpM, FemonConfig.GetSvdrpIp(), sizeof(svdrpIpM));
|
||||||
|
|
||||||
dispModesM[eFemonModeBasic] = tr("basic");
|
dispModesM[eFemonModeBasic] = tr("basic");
|
||||||
dispModesM[eFemonModeTransponder] = tr("transponder");
|
dispModesM[eFemonModeTransponder] = tr("transponder");
|
||||||
dispModesM[eFemonModeStream] = tr("stream");
|
dispModesM[eFemonModeStream] = tr("stream");
|
||||||
@ -32,7 +47,6 @@ cMenuFemonSetup::cMenuFemonSetup()
|
|||||||
themesM[eFemonThemeSilverGreen] = tr("SilverGreen");
|
themesM[eFemonThemeSilverGreen] = tr("SilverGreen");
|
||||||
themesM[eFemonThemePearlHD] = tr("PearlHD");
|
themesM[eFemonThemePearlHD] = tr("PearlHD");
|
||||||
|
|
||||||
dataM = FemonConfig;
|
|
||||||
SetMenuCategory(mcSetupPlugins);
|
SetMenuCategory(mcSetupPlugins);
|
||||||
Setup();
|
Setup();
|
||||||
}
|
}
|
||||||
@ -44,49 +58,49 @@ void cMenuFemonSetup::Setup(void)
|
|||||||
Clear();
|
Clear();
|
||||||
helpM.Clear();
|
helpM.Clear();
|
||||||
|
|
||||||
Add(new cMenuEditBoolItem(tr("Hide main menu entry"), &dataM.hidemenu));
|
Add(new cMenuEditBoolItem(tr("Hide main menu entry"), &hideMenuM));
|
||||||
helpM.Append(tr("Define whether the main menu entry is hidden."));
|
helpM.Append(tr("Define whether the main menu entry is hidden."));
|
||||||
|
|
||||||
Add(new cMenuEditStraItem(tr("Default display mode"), &dataM.displaymode, eFemonModeMaxNumber, dispModesM));
|
Add(new cMenuEditStraItem(tr("Default display mode"), &displayModeM, eFemonModeMaxNumber, dispModesM));
|
||||||
helpM.Append(tr("Define the default display mode at startup."));
|
helpM.Append(tr("Define the default display mode at startup."));
|
||||||
|
|
||||||
Add(new cMenuEditStraItem(trVDR("Setup.OSD$Skin"), &dataM.skin, eFemonSkinMaxNumber, skinsM));
|
Add(new cMenuEditStraItem(trVDR("Setup.OSD$Skin"), &skinM, eFemonSkinMaxNumber, skinsM));
|
||||||
helpM.Append(tr("Define the used OSD skin."));
|
helpM.Append(tr("Define the used OSD skin."));
|
||||||
|
|
||||||
Add(new cMenuEditStraItem(trVDR("Setup.OSD$Theme"), &dataM.theme, eFemonThemeMaxNumber, themesM));
|
Add(new cMenuEditStraItem(trVDR("Setup.OSD$Theme"), &themeM, eFemonThemeMaxNumber, themesM));
|
||||||
helpM.Append(tr("Define the used OSD theme."));
|
helpM.Append(tr("Define the used OSD theme."));
|
||||||
|
|
||||||
Add(new cMenuEditBoolItem(tr("Position"), &dataM.position, trVDR("bottom"), trVDR("top")));
|
Add(new cMenuEditBoolItem(tr("Position"), &positionM, trVDR("bottom"), trVDR("top")));
|
||||||
helpM.Append(tr("Define the position of OSD."));
|
helpM.Append(tr("Define the position of OSD."));
|
||||||
|
|
||||||
Add(new cMenuEditIntItem(tr("Downscale OSD size [%]"), &dataM.downscale, 0, 20));
|
Add(new cMenuEditIntItem(tr("Downscale OSD size [%]"), &downscaleM, 0, 20));
|
||||||
helpM.Append(tr("Define the downscale ratio for OSD size."));
|
helpM.Append(tr("Define the downscale ratio for OSD size."));
|
||||||
|
|
||||||
Add(new cMenuEditIntItem(tr("Red limit [%]"), &dataM.redlimit, 1, 50));
|
Add(new cMenuEditIntItem(tr("Red limit [%]"), &redLimitM, 1, 50));
|
||||||
helpM.Append(tr("Define a limit for red bar, which is used to indicate a bad signal."));
|
helpM.Append(tr("Define a limit for red bar, which is used to indicate a bad signal."));
|
||||||
|
|
||||||
Add(new cMenuEditIntItem(tr("Green limit [%]"), &dataM.greenlimit, 51, 100));
|
Add(new cMenuEditIntItem(tr("Green limit [%]"), &greenLimitM, 51, 100));
|
||||||
helpM.Append(tr("Define a limit for green bar, which is used to indicate a good signal."));
|
helpM.Append(tr("Define a limit for green bar, which is used to indicate a good signal."));
|
||||||
|
|
||||||
Add(new cMenuEditIntItem(tr("OSD update interval [0.1s]"), &dataM.updateinterval, 1, 100));
|
Add(new cMenuEditIntItem(tr("OSD update interval [0.1s]"), &updateIntervalM, 1, 100));
|
||||||
helpM.Append(tr("Define an interval for OSD updates. The smaller interval generates higher CPU load."));
|
helpM.Append(tr("Define an interval for OSD updates. The smaller interval generates higher CPU load."));
|
||||||
|
|
||||||
Add(new cMenuEditBoolItem(tr("Analyze stream"), &dataM.analyzestream));
|
Add(new cMenuEditBoolItem(tr("Analyze stream"), &analyzeStreamM));
|
||||||
helpM.Append(tr("Define whether the DVB stream is analyzed and bitrates calculated."));
|
helpM.Append(tr("Define whether the DVB stream is analyzed and bitrates calculated."));
|
||||||
|
|
||||||
if (FemonConfig.analyzestream) {
|
if (analyzeStreamM) {
|
||||||
Add(new cMenuEditIntItem(tr("Calculation interval [0.1s]"), &dataM.calcinterval, 1, 100));
|
Add(new cMenuEditIntItem(tr("Calculation interval [0.1s]"), &calcIntervalM, 1, 100));
|
||||||
helpM.Append(tr("Define an interval for calculation. The bigger interval generates more stable values."));
|
helpM.Append(tr("Define an interval for calculation. The bigger interval generates more stable values."));
|
||||||
}
|
}
|
||||||
|
|
||||||
Add(new cMenuEditBoolItem(tr("Use SVDRP service"), &dataM.usesvdrp));
|
Add(new cMenuEditBoolItem(tr("Use SVDRP service"), &useSvdrpM));
|
||||||
helpM.Append(tr("Define whether the SVDRP service is used in client/server setups."));
|
helpM.Append(tr("Define whether the SVDRP service is used in client/server setups."));
|
||||||
|
|
||||||
if (dataM.usesvdrp) {
|
if (useSvdrpM) {
|
||||||
Add(new cMenuEditIntItem(tr("SVDRP service port"), &dataM.svdrpport, 1, 65535));
|
Add(new cMenuEditIntItem(tr("SVDRP service port"), &svdrpPortM, 1, 65535));
|
||||||
helpM.Append(tr("Define the port number of SVDRP service."));
|
helpM.Append(tr("Define the port number of SVDRP service."));
|
||||||
|
|
||||||
Add(new cMenuEditStrItem(tr("SVDRP service IP"), dataM.svdrpip, sizeof(dataM.svdrpip), ".1234567890"));
|
Add(new cMenuEditStrItem(tr("SVDRP service IP"), svdrpIpM, sizeof(svdrpIpM), ".1234567890"));
|
||||||
helpM.Append(tr("Define the IP address of SVDRP service."));
|
helpM.Append(tr("Define the IP address of SVDRP service."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,34 +111,49 @@ void cMenuFemonSetup::Setup(void)
|
|||||||
void cMenuFemonSetup::Store(void)
|
void cMenuFemonSetup::Store(void)
|
||||||
{
|
{
|
||||||
debug("%s()\n", __PRETTY_FUNCTION__);
|
debug("%s()\n", __PRETTY_FUNCTION__);
|
||||||
FemonConfig = dataM;
|
// Store values into setup.conf
|
||||||
SetupStore("HideMenu", FemonConfig.hidemenu);
|
SetupStore("HideMenu", hideMenuM);
|
||||||
SetupStore("DisplayMode", FemonConfig.displaymode);
|
SetupStore("DisplayMode", displayModeM);
|
||||||
SetupStore("Skin", FemonConfig.skin);
|
SetupStore("Skin", skinM);
|
||||||
SetupStore("Theme", FemonConfig.theme);
|
SetupStore("Theme", themeM);
|
||||||
SetupStore("Position", FemonConfig.position);
|
SetupStore("Position", positionM);
|
||||||
SetupStore("Downscale", FemonConfig.downscale);
|
SetupStore("Downscale", downscaleM);
|
||||||
SetupStore("RedLimit", FemonConfig.redlimit);
|
SetupStore("RedLimit", redLimitM);
|
||||||
SetupStore("GreenLimit", FemonConfig.greenlimit);
|
SetupStore("GreenLimit", greenLimitM);
|
||||||
SetupStore("UpdateInterval", FemonConfig.updateinterval);
|
SetupStore("UpdateInterval", updateIntervalM);
|
||||||
SetupStore("AnalStream", FemonConfig.analyzestream);
|
SetupStore("AnalStream", analyzeStreamM);
|
||||||
SetupStore("CalcInterval", FemonConfig.calcinterval);
|
SetupStore("CalcInterval", calcIntervalM);
|
||||||
SetupStore("UseSvdrp", FemonConfig.usesvdrp);
|
SetupStore("UseSvdrp", useSvdrpM);
|
||||||
SetupStore("ServerPort", FemonConfig.svdrpport);
|
SetupStore("ServerPort", svdrpPortM);
|
||||||
SetupStore("ServerIp", FemonConfig.svdrpip);
|
SetupStore("ServerIp", svdrpIpM);
|
||||||
|
// Update global config
|
||||||
|
FemonConfig.SetHideMenu(hideMenuM);
|
||||||
|
FemonConfig.SetDisplayMode(displayModeM);
|
||||||
|
FemonConfig.SetSkin(skinM);
|
||||||
|
FemonConfig.SetTheme(themeM);
|
||||||
|
FemonConfig.SetPosition(positionM);
|
||||||
|
FemonConfig.SetDownscale(downscaleM);
|
||||||
|
FemonConfig.SetRedLimit(redLimitM);
|
||||||
|
FemonConfig.SetGreenLimit(greenLimitM);
|
||||||
|
FemonConfig.SetUpdateInterval(updateIntervalM);
|
||||||
|
FemonConfig.SetAnalyzeStream(analyzeStreamM);
|
||||||
|
FemonConfig.SetCalcInterval(calcIntervalM);
|
||||||
|
FemonConfig.SetUseSvdrp(useSvdrpM);
|
||||||
|
FemonConfig.SetSvdrpPort(svdrpPortM);
|
||||||
|
FemonConfig.SetSvdrpIp(svdrpIpM);
|
||||||
}
|
}
|
||||||
|
|
||||||
eOSState cMenuFemonSetup::ProcessKey(eKeys Key)
|
eOSState cMenuFemonSetup::ProcessKey(eKeys keyP)
|
||||||
{
|
{
|
||||||
int oldUsesvdrp = dataM.usesvdrp;
|
int oldUseSvdrp = useSvdrpM;
|
||||||
int oldAnalyzestream = dataM.analyzestream;
|
int oldAnalyzeStream = analyzeStreamM;
|
||||||
|
|
||||||
eOSState state = cMenuSetupPage::ProcessKey(Key);
|
eOSState state = cMenuSetupPage::ProcessKey(keyP);
|
||||||
|
|
||||||
if (Key != kNone && (dataM.analyzestream != oldAnalyzestream || dataM.usesvdrp != oldUsesvdrp))
|
if (keyP != kNone && (analyzeStreamM != oldAnalyzeStream || useSvdrpM != oldUseSvdrp))
|
||||||
Setup();
|
Setup();
|
||||||
|
|
||||||
if ((Key == kInfo) && (state == osUnknown) && (Current() < helpM.Size()))
|
if ((keyP == kInfo) && (state == osUnknown) && (Current() < helpM.Size()))
|
||||||
return AddSubMenu(new cMenuText(cString::sprintf("%s - %s '%s'", tr("Help"), trVDR("Plugin"), PLUGIN_NAME_I18N), helpM[Current()]));
|
return AddSubMenu(new cMenuText(cString::sprintf("%s - %s '%s'", tr("Help"), trVDR("Plugin"), PLUGIN_NAME_I18N), helpM[Current()]));
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
|
15
femonsetup.h
15
femonsetup.h
@ -13,8 +13,21 @@ private:
|
|||||||
const char *dispModesM[eFemonModeMaxNumber];
|
const char *dispModesM[eFemonModeMaxNumber];
|
||||||
const char *skinsM[eFemonSkinMaxNumber];
|
const char *skinsM[eFemonSkinMaxNumber];
|
||||||
const char *themesM[eFemonThemeMaxNumber];
|
const char *themesM[eFemonThemeMaxNumber];
|
||||||
cFemonConfig dataM;
|
|
||||||
cVector<const char*> helpM;
|
cVector<const char*> helpM;
|
||||||
|
int hideMenuM;
|
||||||
|
int displayModeM;
|
||||||
|
int skinM;
|
||||||
|
int themeM;
|
||||||
|
int positionM;
|
||||||
|
int downscaleM;
|
||||||
|
int redLimitM;
|
||||||
|
int greenLimitM;
|
||||||
|
int updateIntervalM;
|
||||||
|
int analyzeStreamM;
|
||||||
|
int calcIntervalM;
|
||||||
|
int useSvdrpM;
|
||||||
|
int svdrpPortM;
|
||||||
|
char svdrpIpM[MaxSvdrpIp + 1]; // must end with additional null
|
||||||
void Setup(void);
|
void Setup(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
Reference in New Issue
Block a user