1
0
mirror of https://github.com/rofafor/vdr-plugin-femon.git synced 2023-10-10 13:36:53 +02:00

Refactored class members.

This commit is contained in:
Rolf Ahrenberg 2015-03-07 18:22:02 +02:00
parent 9420ab95e3
commit bdb9595cbe
23 changed files with 1284 additions and 1279 deletions

View File

@ -519,3 +519,7 @@ VDR Plugin 'femon' Revision History
- Updated CA definitions. - Updated CA definitions.
- Fixed the SVDRP service IP menu item (Thanks to Toerless Eckert). - Fixed the SVDRP service IP menu item (Thanks to Toerless Eckert).
- Fixed the detaching of receiver during a channel switch. - Fixed the detaching of receiver during a channel switch.
2015-XX-XX: Version 2.2.1
-

240
femon.c
View File

@ -22,7 +22,7 @@
#define GITVERSION "" #define GITVERSION ""
#endif #endif
static const char VERSION[] = "2.2.0" GITVERSION; static const char VERSION[] = "2.2.1" GITVERSION;
static const char DESCRIPTION[] = trNOOP("DVB Signal Information Monitor (OSD)"); static const char DESCRIPTION[] = trNOOP("DVB Signal Information Monitor (OSD)");
static const char MAINMENUENTRY[] = trNOOP("Signal Information"); static const char MAINMENUENTRY[] = trNOOP("Signal Information");
@ -40,13 +40,13 @@ 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.hidemenu ? NULL : tr(MAINMENUENTRY)); }
virtual cOsdObject *MainMenuAction(void); virtual cOsdObject *MainMenuAction(void);
virtual cMenuSetupPage *SetupMenu(void); virtual cMenuSetupPage *SetupMenu(void);
virtual bool SetupParse(const char *Name, const char *Value); virtual bool SetupParse(const char *nameP, const char *valueP);
virtual bool Service(const char *Id, void *Data); virtual bool Service(const char *idP, void *dataP);
virtual const char **SVDRPHelpPages(void); virtual const char **SVDRPHelpPages(void);
virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode); virtual cString SVDRPCommand(const char *commandP, const char *optionP, int &replyCodeP);
}; };
cPluginFemon::cPluginFemon() cPluginFemon::cPluginFemon()
@ -108,35 +108,35 @@ cOsdObject *cPluginFemon::MainMenuAction(void)
return NULL; return NULL;
} }
bool cPluginFemon::SetupParse(const char *Name, const char *Value) 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(Name, "HideMenu")) femonConfig.hidemenu = atoi(Value); if (!strcasecmp(nameP, "HideMenu")) FemonConfig.hidemenu = atoi(valueP);
else if (!strcasecmp(Name, "DisplayMode")) femonConfig.displaymode = atoi(Value); else if (!strcasecmp(nameP, "DisplayMode")) FemonConfig.displaymode = atoi(valueP);
else if (!strcasecmp(Name, "Position")) femonConfig.position = atoi(Value); else if (!strcasecmp(nameP, "Position")) FemonConfig.position = atoi(valueP);
else if (!strcasecmp(Name, "Skin")) femonConfig.skin = atoi(Value); else if (!strcasecmp(nameP, "Skin")) FemonConfig.skin = atoi(valueP);
else if (!strcasecmp(Name, "Theme")) femonConfig.theme = atoi(Value); else if (!strcasecmp(nameP, "Theme")) FemonConfig.theme = atoi(valueP);
else if (!strcasecmp(Name, "Downscale")) femonConfig.downscale = atoi(Value); else if (!strcasecmp(nameP, "Downscale")) FemonConfig.downscale = atoi(valueP);
else if (!strcasecmp(Name, "RedLimit")) femonConfig.redlimit = atoi(Value); else if (!strcasecmp(nameP, "RedLimit")) FemonConfig.redlimit = atoi(valueP);
else if (!strcasecmp(Name, "GreenLimit")) femonConfig.greenlimit = atoi(Value); else if (!strcasecmp(nameP, "GreenLimit")) FemonConfig.greenlimit = atoi(valueP);
else if (!strcasecmp(Name, "UpdateInterval")) femonConfig.updateinterval = atoi(Value); else if (!strcasecmp(nameP, "UpdateInterval")) FemonConfig.updateinterval = atoi(valueP);
else if (!strcasecmp(Name, "AnalStream")) femonConfig.analyzestream = atoi(Value); else if (!strcasecmp(nameP, "AnalStream")) FemonConfig.analyzestream = atoi(valueP);
else if (!strcasecmp(Name, "CalcInterval")) femonConfig.calcinterval = atoi(Value); else if (!strcasecmp(nameP, "CalcInterval")) FemonConfig.calcinterval = atoi(valueP);
else if (!strcasecmp(Name, "UseSvdrp")) femonConfig.usesvdrp = atoi(Value); else if (!strcasecmp(nameP, "UseSvdrp")) FemonConfig.usesvdrp = atoi(valueP);
else if (!strcasecmp(Name, "ServerPort")) femonConfig.svdrpport = atoi(Value); else if (!strcasecmp(nameP, "ServerPort")) FemonConfig.svdrpport = atoi(valueP);
else if (!strcasecmp(Name, "ServerIp")) strn0cpy(femonConfig.svdrpip, Value, sizeof(femonConfig.svdrpip)); else if (!strcasecmp(nameP, "ServerIp")) strn0cpy(FemonConfig.svdrpip, valueP, sizeof(FemonConfig.svdrpip));
else else
return false; return false;
if (femonConfig.displaymode < 0 || femonConfig.displaymode >= eFemonModeMaxNumber) femonConfig.displaymode = 0; if (FemonConfig.displaymode < 0 || FemonConfig.displaymode >= eFemonModeMaxNumber) FemonConfig.displaymode = 0;
return true; return true;
} }
bool cPluginFemon::Service(const char *Id, void *Data) bool cPluginFemon::Service(const char *idP, void *dataP)
{ {
if (strcmp(Id,"FemonService-v1.0") == 0) { if (strcmp(idP, "FemonService-v1.0") == 0) {
if (Data) { if (dataP) {
FemonService_v1_0 *data = reinterpret_cast<FemonService_v1_0*>(Data); FemonService_v1_0 *data = reinterpret_cast<FemonService_v1_0*>(dataP);
if (!cDevice::ActualDevice()) if (!cDevice::ActualDevice())
return false; return false;
cDvbDevice *dev = getDvbDevice(cDevice::ActualDevice()); cDvbDevice *dev = getDvbDevice(cDevice::ActualDevice());
@ -196,82 +196,82 @@ const char **cPluginFemon::SVDRPHelpPages(void)
return HelpPages; return HelpPages;
} }
cString cPluginFemon::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) cString cPluginFemon::SVDRPCommand(const char *commandP, const char *optionP, int &replyCodeP)
{ {
cDvbDevice *dev = getDvbDevice(cDevice::ActualDevice()); cDvbDevice *dev = getDvbDevice(cDevice::ActualDevice());
if (*Option && isnumber(Option)) { if (*optionP && isnumber(optionP)) {
cDvbDevice *dev2 = dynamic_cast<cDvbDevice*>(cDevice::GetDevice(int(strtol(Option, NULL, 10)))); cDvbDevice *dev2 = dynamic_cast<cDvbDevice*>(cDevice::GetDevice(int(strtol(optionP, NULL, 10))));
if (dev2) if (dev2)
dev = dev2; dev = dev2;
} }
if (cReplayControl::NowReplaying() || !dev) { if (cReplayControl::NowReplaying() || !dev) {
ReplyCode = 550; // Requested action not taken replyCodeP = 550; // Requested action not taken
return cString("Cannot open femon plugin while replaying"); return cString("Cannot open femon plugin while replaying");
} }
if (strcasecmp(Command, "OPEN") == 0) { if (strcasecmp(commandP, "OPEN") == 0) {
if (!cFemonOsd::Instance()) if (!cFemonOsd::Instance())
cRemote::CallPlugin(Name()); cRemote::CallPlugin(Name());
return cString("Opening femon plugin"); return cString("Opening femon plugin");
} }
else if (strcasecmp(Command, "QUIT") == 0) { else if (strcasecmp(commandP, "QUIT") == 0) {
if (cFemonOsd::Instance()) if (cFemonOsd::Instance())
cRemote::Put(kBack); cRemote::Put(kBack);
return cString("Closing femon plugin"); return cString("Closing femon plugin");
} }
else if (strcasecmp(Command, "NEXT") == 0) { else if (strcasecmp(commandP, "NEXT") == 0) {
if (cFemonOsd::Instance()) if (cFemonOsd::Instance())
return cString::sprintf("Switching to next device: %s", cFemonOsd::Instance()->DeviceSwitch(1) ? "ok" : "failed"); return cString::sprintf("Switching to next device: %s", cFemonOsd::Instance()->DeviceSwitch(1) ? "ok" : "failed");
else else
return cString("Cannot switch device"); return cString("Cannot switch device");
} }
else if (strcasecmp(Command, "PREV") == 0) { else if (strcasecmp(commandP, "PREV") == 0) {
if (cFemonOsd::Instance()) if (cFemonOsd::Instance())
return cString::sprintf("Switching to previous device: %s", cFemonOsd::Instance()->DeviceSwitch(-1) ? "ok" : "failed"); return cString::sprintf("Switching to previous device: %s", cFemonOsd::Instance()->DeviceSwitch(-1) ? "ok" : "failed");
else else
return cString("Cannot switch device"); return cString("Cannot switch device");
} }
else if (strcasecmp(Command, "INFO") == 0) { else if (strcasecmp(commandP, "INFO") == 0) {
return getFrontendInfo(dev); return getFrontendInfo(dev);
} }
else if (strcasecmp(Command, "NAME") == 0) { else if (strcasecmp(commandP, "NAME") == 0) {
return getFrontendName(dev); return getFrontendName(dev);
} }
else if (strcasecmp(Command, "STAT") == 0) { else if (strcasecmp(commandP, "STAT") == 0) {
return getFrontendStatus(dev); return getFrontendStatus(dev);
} }
else if (strcasecmp(Command, "STRG") == 0) { else if (strcasecmp(commandP, "STRG") == 0) {
return cString::sprintf("%d on device #%d", dev->SignalStrength(), dev->CardIndex()); return cString::sprintf("%d on device #%d", dev->SignalStrength(), dev->CardIndex());
} }
else if (strcasecmp(Command, "QUAL") == 0) { else if (strcasecmp(commandP, "QUAL") == 0) {
return cString::sprintf("%d on device #%d", dev->SignalQuality(), dev->CardIndex()); return cString::sprintf("%d on device #%d", dev->SignalQuality(), dev->CardIndex());
} }
else if (strcasecmp(Command, "SGNL") == 0) { else if (strcasecmp(commandP, "SGNL") == 0) {
int value = getSignal(dev); int value = getSignal(dev);
return cString::sprintf("%04X (%02d%%) on device #%d", value, value / 655, dev->CardIndex()); return cString::sprintf("%04X (%02d%%) on device #%d", value, value / 655, dev->CardIndex());
} }
else if (strcasecmp(Command, "SNRA") == 0) { else if (strcasecmp(commandP, "SNRA") == 0) {
int value = getSNR(dev); int value = getSNR(dev);
return cString::sprintf("%04X (%02d%%) on device #%d", value, value / 655, dev->CardIndex()); return cString::sprintf("%04X (%02d%%) on device #%d", value, value / 655, dev->CardIndex());
} }
else if (strcasecmp(Command, "BERA") == 0) { else if (strcasecmp(commandP, "BERA") == 0) {
return cString::sprintf("%08X on device #%d", getBER(dev), dev->CardIndex()); return cString::sprintf("%08X on device #%d", getBER(dev), dev->CardIndex());
} }
else if (strcasecmp(Command, "UNCB") == 0) { else if (strcasecmp(commandP, "UNCB") == 0) {
return cString::sprintf("%08X on device #%d", getUNC(dev), dev->CardIndex()); return cString::sprintf("%08X on device #%d", getUNC(dev), dev->CardIndex());
} }
else if (strcasecmp(Command, "VIBR") == 0) { else if (strcasecmp(commandP, "VIBR") == 0) {
if (cFemonOsd::Instance()) if (cFemonOsd::Instance())
return cString::sprintf("%s on device #%d", *getBitrateMbits(cFemonOsd::Instance()->GetVideoBitrate()), cDevice::ActualDevice()->CardIndex()); return cString::sprintf("%s on device #%d", *getBitrateMbits(cFemonOsd::Instance()->GetVideoBitrate()), cDevice::ActualDevice()->CardIndex());
else else
return cString::sprintf("--- Mbit/s on device #%d", cDevice::ActualDevice()->CardIndex()); return cString::sprintf("--- Mbit/s on device #%d", cDevice::ActualDevice()->CardIndex());
} }
else if (strcasecmp(Command, "AUBR") == 0) { else if (strcasecmp(commandP, "AUBR") == 0) {
if (cFemonOsd::Instance()) if (cFemonOsd::Instance())
return cString::sprintf("%s on device #%d", *getBitrateKbits(cFemonOsd::Instance()->GetAudioBitrate()), cDevice::ActualDevice()->CardIndex()); return cString::sprintf("%s on device #%d", *getBitrateKbits(cFemonOsd::Instance()->GetAudioBitrate()), cDevice::ActualDevice()->CardIndex());
else else
return cString::sprintf("--- kbit/s on device #%d", cDevice::ActualDevice()->CardIndex()); return cString::sprintf("--- kbit/s on device #%d", cDevice::ActualDevice()->CardIndex());
} }
else if (strcasecmp(Command, "DDBR") == 0) { else if (strcasecmp(commandP, "DDBR") == 0) {
if (cFemonOsd::Instance()) if (cFemonOsd::Instance())
return cString::sprintf("%s on device #%d", *getBitrateKbits(cFemonOsd::Instance()->GetDolbyBitrate()), cDevice::ActualDevice()->CardIndex()); return cString::sprintf("%s on device #%d", *getBitrateKbits(cFemonOsd::Instance()->GetDolbyBitrate()), cDevice::ActualDevice()->CardIndex());
else else
@ -282,42 +282,42 @@ cString cPluginFemon::SVDRPCommand(const char *Command, const char *Option, int
class cMenuFemonSetup : public cMenuSetupPage { class cMenuFemonSetup : public cMenuSetupPage {
private: private:
const char *dispmodes[eFemonModeMaxNumber]; const char *dispModesM[eFemonModeMaxNumber];
const char *skins[eFemonSkinMaxNumber]; const char *skinsM[eFemonSkinMaxNumber];
const char *themes[eFemonThemeMaxNumber]; const char *themesM[eFemonThemeMaxNumber];
cFemonConfig data; cFemonConfig dataM;
cVector<const char*> help; cVector<const char*> helpM;
void Setup(void); void Setup(void);
protected: protected:
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
virtual void Store(void); virtual void Store(void);
public: public:
cMenuFemonSetup(void); cMenuFemonSetup();
}; };
cMenuFemonSetup::cMenuFemonSetup(void) cMenuFemonSetup::cMenuFemonSetup()
{ {
debug("%s()\n", __PRETTY_FUNCTION__); debug("%s()\n", __PRETTY_FUNCTION__);
dispmodes[eFemonModeBasic] = tr("basic"); dispModesM[eFemonModeBasic] = tr("basic");
dispmodes[eFemonModeTransponder] = tr("transponder"); dispModesM[eFemonModeTransponder] = tr("transponder");
dispmodes[eFemonModeStream] = tr("stream"); dispModesM[eFemonModeStream] = tr("stream");
dispmodes[eFemonModeAC3] = tr("AC-3"); dispModesM[eFemonModeAC3] = tr("AC-3");
skins[eFemonSkinClassic] = tr("Classic"); skinsM[eFemonSkinClassic] = tr("Classic");
skins[eFemonSkinElchi] = tr("Elchi"); skinsM[eFemonSkinElchi] = tr("Elchi");
themes[eFemonThemeClassic] = tr("Classic"); themesM[eFemonThemeClassic] = tr("Classic");
themes[eFemonThemeElchi] = tr("Elchi"); themesM[eFemonThemeElchi] = tr("Elchi");
themes[eFemonThemeSTTNG] = tr("ST:TNG"); themesM[eFemonThemeSTTNG] = tr("ST:TNG");
themes[eFemonThemeDeepBlue] = tr("DeepBlue"); themesM[eFemonThemeDeepBlue] = tr("DeepBlue");
themes[eFemonThemeMoronimo] = tr("Moronimo"); themesM[eFemonThemeMoronimo] = tr("Moronimo");
themes[eFemonThemeEnigma] = tr("Enigma"); themesM[eFemonThemeEnigma] = tr("Enigma");
themes[eFemonThemeEgalsTry] = tr("EgalsTry"); themesM[eFemonThemeEgalsTry] = tr("EgalsTry");
themes[eFemonThemeDuotone] = tr("Duotone"); themesM[eFemonThemeDuotone] = tr("Duotone");
themes[eFemonThemeSilverGreen] = tr("SilverGreen"); themesM[eFemonThemeSilverGreen] = tr("SilverGreen");
themes[eFemonThemePearlHD] = tr("PearlHD"); themesM[eFemonThemePearlHD] = tr("PearlHD");
data = femonConfig; dataM = FemonConfig;
SetMenuCategory(mcSetupPlugins); SetMenuCategory(mcSetupPlugins);
Setup(); Setup();
} }
@ -327,52 +327,52 @@ void cMenuFemonSetup::Setup(void)
int current = Current(); int current = Current();
Clear(); Clear();
help.Clear(); helpM.Clear();
Add(new cMenuEditBoolItem(tr("Hide main menu entry"), &data.hidemenu)); Add(new cMenuEditBoolItem(tr("Hide main menu entry"), &dataM.hidemenu));
help.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"), &data.displaymode, eFemonModeMaxNumber, dispmodes)); Add(new cMenuEditStraItem(tr("Default display mode"), &dataM.displaymode, eFemonModeMaxNumber, dispModesM));
help.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"), &data.skin, eFemonSkinMaxNumber, skins)); Add(new cMenuEditStraItem(trVDR("Setup.OSD$Skin"), &dataM.skin, eFemonSkinMaxNumber, skinsM));
help.Append(tr("Define the used OSD skin.")); helpM.Append(tr("Define the used OSD skin."));
Add(new cMenuEditStraItem(trVDR("Setup.OSD$Theme"), &data.theme, eFemonThemeMaxNumber,themes)); Add(new cMenuEditStraItem(trVDR("Setup.OSD$Theme"), &dataM.theme, eFemonThemeMaxNumber, themesM));
help.Append(tr("Define the used OSD theme.")); helpM.Append(tr("Define the used OSD theme."));
Add(new cMenuEditBoolItem(tr("Position"), &data.position, trVDR("bottom"), trVDR("top"))); Add(new cMenuEditBoolItem(tr("Position"), &dataM.position, trVDR("bottom"), trVDR("top")));
help.Append(tr("Define the position of OSD.")); helpM.Append(tr("Define the position of OSD."));
Add(new cMenuEditIntItem(tr("Downscale OSD size [%]"), &data.downscale, 0, 20)); Add(new cMenuEditIntItem(tr("Downscale OSD size [%]"), &dataM.downscale, 0, 20));
help.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 [%]"), &data.redlimit, 1, 50)); Add(new cMenuEditIntItem(tr("Red limit [%]"), &dataM.redlimit, 1, 50));
help.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 [%]"), &data.greenlimit, 51, 100)); Add(new cMenuEditIntItem(tr("Green limit [%]"), &dataM.greenlimit, 51, 100));
help.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]"), &data.updateinterval, 1, 100)); Add(new cMenuEditIntItem(tr("OSD update interval [0.1s]"), &dataM.updateinterval, 1, 100));
help.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"), &data.analyzestream)); Add(new cMenuEditBoolItem(tr("Analyze stream"), &dataM.analyzestream));
help.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 (FemonConfig.analyzestream) {
Add(new cMenuEditIntItem(tr("Calculation interval [0.1s]"), &data.calcinterval, 1, 100)); Add(new cMenuEditIntItem(tr("Calculation interval [0.1s]"), &dataM.calcinterval, 1, 100));
help.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"), &data.usesvdrp)); Add(new cMenuEditBoolItem(tr("Use SVDRP service"), &dataM.usesvdrp));
help.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 (data.usesvdrp) { if (dataM.usesvdrp) {
Add(new cMenuEditIntItem(tr("SVDRP service port"), &data.svdrpport, 1, 65535)); Add(new cMenuEditIntItem(tr("SVDRP service port"), &dataM.svdrpport, 1, 65535));
help.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"), data.svdrpip, sizeof(data.svdrpip), ".1234567890")); Add(new cMenuEditStrItem(tr("SVDRP service IP"), dataM.svdrpip, sizeof(dataM.svdrpip), ".1234567890"));
help.Append(tr("Define the IP address of SVDRP service.")); helpM.Append(tr("Define the IP address of SVDRP service."));
} }
SetCurrent(Get(current)); SetCurrent(Get(current));
@ -382,35 +382,35 @@ void cMenuFemonSetup::Setup(void)
void cMenuFemonSetup::Store(void) void cMenuFemonSetup::Store(void)
{ {
debug("%s()\n", __PRETTY_FUNCTION__); debug("%s()\n", __PRETTY_FUNCTION__);
femonConfig = data; FemonConfig = dataM;
SetupStore("HideMenu", femonConfig.hidemenu); SetupStore("HideMenu", FemonConfig.hidemenu);
SetupStore("DisplayMode", femonConfig.displaymode); SetupStore("DisplayMode", FemonConfig.displaymode);
SetupStore("Skin", femonConfig.skin); SetupStore("Skin", FemonConfig.skin);
SetupStore("Theme", femonConfig.theme); SetupStore("Theme", FemonConfig.theme);
SetupStore("Position", femonConfig.position); SetupStore("Position", FemonConfig.position);
SetupStore("Downscale", femonConfig.downscale); SetupStore("Downscale", FemonConfig.downscale);
SetupStore("RedLimit", femonConfig.redlimit); SetupStore("RedLimit", FemonConfig.redlimit);
SetupStore("GreenLimit", femonConfig.greenlimit); SetupStore("GreenLimit", FemonConfig.greenlimit);
SetupStore("UpdateInterval", femonConfig.updateinterval); SetupStore("UpdateInterval", FemonConfig.updateinterval);
SetupStore("AnalStream", femonConfig.analyzestream); SetupStore("AnalStream", FemonConfig.analyzestream);
SetupStore("CalcInterval", femonConfig.calcinterval); SetupStore("CalcInterval", FemonConfig.calcinterval);
SetupStore("UseSvdrp", femonConfig.usesvdrp); SetupStore("UseSvdrp", FemonConfig.usesvdrp);
SetupStore("ServerPort", femonConfig.svdrpport); SetupStore("ServerPort", FemonConfig.svdrpport);
SetupStore("ServerIp", femonConfig.svdrpip); SetupStore("ServerIp", FemonConfig.svdrpip);
} }
eOSState cMenuFemonSetup::ProcessKey(eKeys Key) eOSState cMenuFemonSetup::ProcessKey(eKeys Key)
{ {
int oldUsesvdrp = data.usesvdrp; int oldUsesvdrp = dataM.usesvdrp;
int oldAnalyzestream = data.analyzestream; int oldAnalyzestream = dataM.analyzestream;
eOSState state = cMenuSetupPage::ProcessKey(Key); eOSState state = cMenuSetupPage::ProcessKey(Key);
if (Key != kNone && (data.analyzestream != oldAnalyzestream || data.usesvdrp != oldUsesvdrp)) if (Key != kNone && (dataM.analyzestream != oldAnalyzestream || dataM.usesvdrp != oldUsesvdrp))
Setup(); Setup();
if ((Key == kInfo) && (state == osUnknown) && (Current() < help.Size())) if ((Key == kInfo) && (state == osUnknown) && (Current() < helpM.Size()))
return AddSubMenu(new cMenuText(cString::sprintf("%s - %s '%s'", tr("Help"), trVDR("Plugin"), PLUGIN_NAME_I18N), help[Current()])); return AddSubMenu(new cMenuText(cString::sprintf("%s - %s '%s'", tr("Help"), trVDR("Plugin"), PLUGIN_NAME_I18N), helpM[Current()]));
return state; return state;
} }

View File

@ -10,13 +10,13 @@
#define IS_HEAAC_AUDIO(buf) (((buf)[0] == 0xFF) && (((buf)[1] & 0xF6) == 0xF0)) #define IS_HEAAC_AUDIO(buf) (((buf)[0] == 0xFF) && (((buf)[1] & 0xF6) == 0xF0))
int cFemonAAC::s_Samplerates[16] = int cFemonAAC::sampleRateS[16] =
{ {
96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, -1, -1, -1, -1 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, -1, -1, -1, -1
}; };
cFemonAAC::cFemonAAC(cFemonAudioIf *audiohandler) cFemonAAC::cFemonAAC(cFemonAudioIf *audioHandlerP)
: m_AudioHandler(audiohandler) : audioHandlerM(audioHandlerP)
{ {
} }
@ -24,11 +24,11 @@ cFemonAAC::~cFemonAAC()
{ {
} }
bool cFemonAAC::processAudio(const uint8_t *buf, int len) bool cFemonAAC::processAudio(const uint8_t *bufP, int lenP)
{ {
cFemonBitStream bs(buf, len * 8); cFemonBitStream bs(bufP, lenP * 8);
if (!m_AudioHandler) if (!audioHandlerM)
return false; return false;
/* ADTS Fixed Header: /* ADTS Fixed Header:
@ -46,9 +46,9 @@ bool cFemonAAC::processAudio(const uint8_t *buf, int len)
*/ */
// skip PES header // skip PES header
if (!PesLongEnough(len)) if (!PesLongEnough(lenP))
return false; return false;
bs.SkipBits(8 * PesPayloadOffset(buf)); bs.SkipBits(8 * PesPayloadOffset(bufP));
// HE-AAC audio detection // HE-AAC audio detection
if (bs.GetBits(12) != 0xFFF) // syncword if (bs.GetBits(12) != 0xFFF) // syncword
@ -66,38 +66,38 @@ bool cFemonAAC::processAudio(const uint8_t *buf, int len)
bs.SkipBit(); // private pid bs.SkipBit(); // private pid
int channel_configuration = bs.GetBits(3); // channel_configuration int channel_configuration = bs.GetBits(3); // channel_configuration
m_AudioHandler->SetAudioCodec(AUDIO_CODEC_HEAAC); audioHandlerM->SetAudioCodec(AUDIO_CODEC_HEAAC);
m_AudioHandler->SetAudioBitrate(AUDIO_BITRATE_RESERVED); audioHandlerM->SetAudioBitrate(AUDIO_BITRATE_RESERVED);
switch (channel_configuration) { switch (channel_configuration) {
case 0: case 0:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_STEREO); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_STEREO);
break; break;
case 1: case 1:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_JOINT_STEREO); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_JOINT_STEREO);
break; break;
case 2: case 2:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_DUAL); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_DUAL);
break; break;
case 3: case 3:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_SINGLE); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_SINGLE);
break; break;
default: default:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_INVALID); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_INVALID);
break; break;
} }
switch (sampling_frequency_index) { switch (sampling_frequency_index) {
case 0xC ... 0xF: case 0xC ... 0xF:
m_AudioHandler->SetAudioSamplingFrequency(AUDIO_SAMPLING_FREQUENCY_RESERVED); audioHandlerM->SetAudioSamplingFrequency(AUDIO_SAMPLING_FREQUENCY_RESERVED);
break; break;
default: default:
m_AudioHandler->SetAudioSamplingFrequency(s_Samplerates[sampling_frequency_index]); audioHandlerM->SetAudioSamplingFrequency(sampleRateS[sampling_frequency_index]);
break; break;
} }

View File

@ -12,15 +12,15 @@
class cFemonAAC { class cFemonAAC {
private: private:
cFemonAudioIf *m_AudioHandler; cFemonAudioIf *audioHandlerM;
static int s_Samplerates[16]; static int sampleRateS[16];
public: public:
cFemonAAC(cFemonAudioIf *audiohandler); cFemonAAC(cFemonAudioIf *audioHandlerP);
virtual ~cFemonAAC(); virtual ~cFemonAAC();
bool processAudio(const uint8_t *buf, int len); bool processAudio(const uint8_t *bufP, int lenP);
}; };
#endif //__FEMONAAC_H #endif //__FEMONAAC_H

View File

@ -9,25 +9,25 @@
#include "femontools.h" #include "femontools.h"
#include "femonac3.h" #include "femonac3.h"
int cFemonAC3::s_Bitrates[32] = int cFemonAC3::bitrateS[32] =
{ {
32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}; };
int cFemonAC3::s_Frequencies[4] = int cFemonAC3::frequencieS[4] =
{ {
480, 441, 320, 0 480, 441, 320, 0
}; };
int cFemonAC3::s_Frames[3][32] = int cFemonAC3::frameS[3][32] =
{ {
{64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 640, 768, 896, 1024, 1152, 1280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 640, 768, 896, 1024, 1152, 1280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{69, 87, 104, 121, 139, 174, 208, 243, 278, 348, 417, 487, 557, 696, 835, 975, 1114, 1253, 1393, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {69, 87, 104, 121, 139, 174, 208, 243, 278, 348, 417, 487, 557, 696, 835, 975, 1114, 1253, 1393, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{96, 120, 144, 168, 192, 240, 288, 336, 384, 480, 576, 672, 768, 960, 1152, 1344, 1536, 1728, 1920, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} {96, 120, 144, 168, 192, 240, 288, 336, 384, 480, 576, 672, 768, 960, 1152, 1344, 1536, 1728, 1920, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}; };
cFemonAC3::cFemonAC3(cFemonAC3If *audiohandler) cFemonAC3::cFemonAC3(cFemonAC3If *audioHandlerP)
: m_AudioHandler(audiohandler) : audioHandlerM(audioHandlerP)
{ {
} }
@ -35,21 +35,21 @@ cFemonAC3::~cFemonAC3()
{ {
} }
bool cFemonAC3::processAudio(const uint8_t *buf, int len) bool cFemonAC3::processAudio(const uint8_t *bufP, int lenP)
{ {
int fscod, frmsizcod, bsmod, acmod; int fscod, frmsizcod, bsmod, acmod;
int centermixlevel = AUDIO_CENTER_MIX_LEVEL_INVALID; int centermixlevel = AUDIO_CENTER_MIX_LEVEL_INVALID;
int surroundmixlevel = AUDIO_SURROUND_MIX_LEVEL_INVALID; int surroundmixlevel = AUDIO_SURROUND_MIX_LEVEL_INVALID;
int dolbysurroundmode = AUDIO_DOLBY_SURROUND_MODE_INVALID; int dolbysurroundmode = AUDIO_DOLBY_SURROUND_MODE_INVALID;
cFemonBitStream bs(buf, len * 8); cFemonBitStream bs(bufP, lenP * 8);
if (!m_AudioHandler) if (!audioHandlerM)
return false; return false;
// skip PES header // skip PES header
if (!PesLongEnough(len)) if (!PesLongEnough(lenP))
return false; return false;
bs.SkipBits(8 * PesPayloadOffset(buf)); bs.SkipBits(8 * PesPayloadOffset(bufP));
// http://rmworkshop.com/dvd_info/related_info/ac3hdr.htm // http://rmworkshop.com/dvd_info/related_info/ac3hdr.htm
@ -78,16 +78,16 @@ bool cFemonAC3::processAudio(const uint8_t *buf, int len)
if (acmod == 0x02) if (acmod == 0x02)
dolbysurroundmode = bs.GetBits(2); dolbysurroundmode = bs.GetBits(2);
m_AudioHandler->SetAC3Bitrate(1000 * s_Bitrates[frmsizcod >> 1]); audioHandlerM->SetAC3Bitrate(1000 * bitrateS[frmsizcod >> 1]);
m_AudioHandler->SetAC3SamplingFrequency(100 * s_Frequencies[fscod]); audioHandlerM->SetAC3SamplingFrequency(100 * frequencieS[fscod]);
m_AudioHandler->SetAC3Bitstream(bsmod); audioHandlerM->SetAC3Bitstream(bsmod);
m_AudioHandler->SetAC3AudioCoding(acmod); audioHandlerM->SetAC3AudioCoding(acmod);
m_AudioHandler->SetAC3CenterMix(centermixlevel); audioHandlerM->SetAC3CenterMix(centermixlevel);
m_AudioHandler->SetAC3SurroundMix(surroundmixlevel); audioHandlerM->SetAC3SurroundMix(surroundmixlevel);
m_AudioHandler->SetAC3DolbySurround(dolbysurroundmode); audioHandlerM->SetAC3DolbySurround(dolbysurroundmode);
m_AudioHandler->SetAC3LFE(bs.GetBit()); // low frequency effects on audioHandlerM->SetAC3LFE(bs.GetBit()); // low frequency effects on
m_AudioHandler->SetAC3Dialog(bs.GetBits(5)); // dialog normalization audioHandlerM->SetAC3Dialog(bs.GetBits(5)); // dialog normalization
return true; return true;
} }

View File

@ -12,17 +12,17 @@
class cFemonAC3 { class cFemonAC3 {
private: private:
cFemonAC3If *m_AudioHandler; cFemonAC3If *audioHandlerM;
static int s_Bitrates[32]; static int bitrateS[32];
static int s_Frequencies[4]; static int frequencieS[4];
static int s_Frames[3][32]; static int frameS[3][32];
public: public:
cFemonAC3(cFemonAC3If *audiohandler); cFemonAC3(cFemonAC3If *audioHandlerP);
virtual ~cFemonAC3(); virtual ~cFemonAC3();
bool processAudio(const uint8_t *buf, int len); bool processAudio(const uint8_t *bufP, int lenP);
}; };
#endif //__FEMONAC3_H #endif //__FEMONAC3_H

View File

@ -113,13 +113,13 @@ public:
virtual ~cFemonAudioIf() {} virtual ~cFemonAudioIf() {}
// enum // enum
virtual void SetAudioCodec(eAudioCodec codec) = 0; virtual void SetAudioCodec(eAudioCodec codecP) = 0;
// kbit/s or eAudioBitrate // kbit/s or eAudioBitrate
virtual void SetAudioBitrate(double bitrate) = 0; virtual void SetAudioBitrate(double bitRateP) = 0;
// Hz or eAudioSamplingFrequency // Hz or eAudioSamplingFrequency
virtual void SetAudioSamplingFrequency(int sampling) = 0; virtual void SetAudioSamplingFrequency(int samplingP) = 0;
// eAudioChannelMode // eAudioChannelMode
virtual void SetAudioChannel(eAudioChannelMode mode) = 0; virtual void SetAudioChannel(eAudioChannelMode modeP) = 0;
}; };
class cFemonAC3If { class cFemonAC3If {
@ -128,23 +128,23 @@ public:
virtual ~cFemonAC3If() {} virtual ~cFemonAC3If() {}
// bit/s or eAudioBitrate // bit/s or eAudioBitrate
virtual void SetAC3Bitrate(int bitrate) = 0; virtual void SetAC3Bitrate(int bitRateP) = 0;
// Hz or eAudioSamplingFrequency // Hz or eAudioSamplingFrequency
virtual void SetAC3SamplingFrequency(int sampling) = 0; virtual void SetAC3SamplingFrequency(int samplingP) = 0;
// 0..7 or eAudioBitstreamMode // 0..7 or eAudioBitstreamMode
virtual void SetAC3Bitstream(int mode) = 0; virtual void SetAC3Bitstream(int modeP) = 0;
// 0..7 or eAudioCodingMode // 0..7 or eAudioCodingMode
virtual void SetAC3AudioCoding(int mode) = 0; virtual void SetAC3AudioCoding(int modeP) = 0;
// eAudioDolbySurroundMode // eAudioDolbySurroundMode
virtual void SetAC3DolbySurround(int mode) = 0; virtual void SetAC3DolbySurround(int modeP) = 0;
// eAudioCenterMixLevel // eAudioCenterMixLevel
virtual void SetAC3CenterMix(int level) = 0; virtual void SetAC3CenterMix(int levelP) = 0;
// eAudioSurroundMixLevel // eAudioSurroundMixLevel
virtual void SetAC3SurroundMix(int level) = 0; virtual void SetAC3SurroundMix(int levelP) = 0;
// -dB // -dB
virtual void SetAC3Dialog(int level) = 0; virtual void SetAC3Dialog(int levelP) = 0;
// boolean // boolean
virtual void SetAC3LFE(bool onoff) = 0; virtual void SetAC3LFE(bool onoffP) = 0;
}; };
#endif //__FEMONAUDIO_H #endif //__FEMONAUDIO_H

View File

@ -8,7 +8,7 @@
#include <string.h> #include <string.h>
#include "femoncfg.h" #include "femoncfg.h"
cFemonConfig femonConfig; cFemonConfig FemonConfig;
cFemonConfig::cFemonConfig(void) cFemonConfig::cFemonConfig(void)
{ {
@ -28,7 +28,7 @@ cFemonConfig::cFemonConfig(void)
strncpy(svdrpip, "0.0.0.0", sizeof(svdrpip)); strncpy(svdrpip, "0.0.0.0", sizeof(svdrpip));
} }
const cFemonTheme femonTheme[eFemonThemeMaxNumber] = const cFemonTheme FemonTheme[eFemonThemeMaxNumber] =
{ {
{ {
// eFemonThemeClassic // eFemonThemeClassic

View File

@ -39,7 +39,7 @@ public:
char svdrpip[MaxSvdrpIp + 1]; // must end with additional null char svdrpip[MaxSvdrpIp + 1]; // must end with additional null
}; };
extern cFemonConfig femonConfig; extern cFemonConfig FemonConfig;
enum eFemonSkins enum eFemonSkins
{ {
@ -76,6 +76,6 @@ struct cFemonTheme
unsigned int clrGreen; unsigned int clrGreen;
}; };
extern const cFemonTheme femonTheme[eFemonThemeMaxNumber]; extern const cFemonTheme FemonTheme[eFemonThemeMaxNumber];
#endif // __FEMONCFG_H #endif // __FEMONCFG_H

View File

@ -8,7 +8,7 @@
#include "femontools.h" #include "femontools.h"
#include "femonh264.h" #include "femonh264.h"
const cFemonH264::t_DAR cFemonH264::s_DAR[] = const cFemonH264::t_DAR cFemonH264::darS[] =
{ {
{ VIDEO_ASPECT_RATIO_1_1, 100 }, { VIDEO_ASPECT_RATIO_1_1, 100 },
{ VIDEO_ASPECT_RATIO_4_3, 133 }, { VIDEO_ASPECT_RATIO_4_3, 133 },
@ -30,7 +30,7 @@ const cFemonH264::t_DAR cFemonH264::s_DAR[] =
{ VIDEO_ASPECT_RATIO_2_1, 200 } { VIDEO_ASPECT_RATIO_2_1, 200 }
}; };
const cFemonH264::t_SAR cFemonH264::s_SAR[] = const cFemonH264::t_SAR cFemonH264::sarS[] =
{ {
{ 0, 0 }, // VIDEO_ASPECT_RATIO_INVALID { 0, 0 }, // VIDEO_ASPECT_RATIO_INVALID
{ 1, 1 }, // VIDEO_ASPECT_RATIO_1_1 { 1, 1 }, // VIDEO_ASPECT_RATIO_1_1
@ -51,7 +51,7 @@ const cFemonH264::t_SAR cFemonH264::s_SAR[] =
{ 2, 1 } // VIDEO_ASPECT_RATIO_2_1 { 2, 1 } // VIDEO_ASPECT_RATIO_2_1
}; };
const eVideoFormat cFemonH264::s_VideoFormats[] = const eVideoFormat cFemonH264::videoFormatS[] =
{ {
VIDEO_FORMAT_COMPONENT, VIDEO_FORMAT_COMPONENT,
VIDEO_FORMAT_PAL, VIDEO_FORMAT_PAL,
@ -62,25 +62,25 @@ const eVideoFormat cFemonH264::s_VideoFormats[] =
VIDEO_FORMAT_RESERVED VIDEO_FORMAT_RESERVED
}; };
const uint8_t cFemonH264::s_SeiNumClockTsTable[9] = const uint8_t cFemonH264::seiNumClockTsTableS[9] =
{ {
1, 1, 1, 2, 2, 3, 3, 2, 3 1, 1, 1, 2, 2, 3, 3, 2, 3
}; };
cFemonH264::cFemonH264(cFemonVideoIf *videohandler) cFemonH264::cFemonH264(cFemonVideoIf *videoHandlerP)
: m_VideoHandler(videohandler), : videoHandlerM(videoHandlerP),
m_Width(0), widthM(0),
m_Height(0), heightM(0),
m_AspectRatio(VIDEO_ASPECT_RATIO_INVALID), aspectRatioM(VIDEO_ASPECT_RATIO_INVALID),
m_Format(VIDEO_FORMAT_INVALID), formatM(VIDEO_FORMAT_INVALID),
m_FrameRate(0), frameRateM(0),
m_BitRate(0), bitRateM(0),
m_Scan(VIDEO_SCAN_INVALID), scanM(VIDEO_SCAN_INVALID),
m_CpbDpbDelaysPresentFlag(false), cpbDpbDelaysPresentFlagM(false),
m_PicStructPresentFlag(false), picStructPresentFlagM(false),
m_FrameMbsOnlyFlag(false), frameMbsOnlyFlagM(false),
m_MbAdaptiveFrameFieldFlag(false), mbAdaptiveFrameFieldFlagM(false),
m_TimeOffsetLength(0) timeOffsetLengthM(0)
{ {
reset(); reset();
} }
@ -89,18 +89,19 @@ cFemonH264::~cFemonH264()
{ {
} }
bool cFemonH264::processVideo(const uint8_t *buf, int len) bool cFemonH264::processVideo(const uint8_t *bufP, int lenP)
{ {
uint8_t nal_data[len]; uint8_t nal_data[lenP];
bool aud_found = false, sps_found = false, sei_found = true; // SEI temporarily disabled! bool aud_found = false, sps_found = false, sei_found = true; // SEI temporarily disabled!
const uint8_t *buf = bufP;
const uint8_t *start = buf; const uint8_t *start = buf;
const uint8_t *end = start + len; const uint8_t *end = start + lenP;
if (!m_VideoHandler) if (!videoHandlerM)
return false; return false;
// skip PES header // skip PES header
if (!PesLongEnough(len)) if (!PesLongEnough(lenP))
return false; return false;
buf += PesPayloadOffset(buf); buf += PesPayloadOffset(buf);
start = buf; start = buf;
@ -119,7 +120,7 @@ bool cFemonH264::processVideo(const uint8_t *buf, int len)
if (!aud_found) { if (!aud_found) {
switch (buf[4] >> 5) { switch (buf[4] >> 5) {
case 0: case 3: case 5: // I_FRAME case 0: case 3: case 5: // I_FRAME
//debug("H.264: Found NAL AUD at offset %d/%d\n", int(buf - start), len); //debug("H.264: Found NAL AUD at offset %d/%d\n", int(buf - start), lenP);
aud_found = true; aud_found = true;
break; break;
case 1: case 4: case 6: // P_FRAME; case 1: case 4: case 6: // P_FRAME;
@ -132,7 +133,7 @@ bool cFemonH264::processVideo(const uint8_t *buf, int len)
case NAL_SPS: case NAL_SPS:
if (!sps_found) { if (!sps_found) {
//debug("H.264: Found NAL SPS at offset %d/%d\n", int(buf - start), len); //debug("H.264: Found NAL SPS at offset %d/%d\n", int(buf - start), lenP);
int nal_len = nalUnescape(nal_data, buf + 4, int(end - buf - 4)); int nal_len = nalUnescape(nal_data, buf + 4, int(end - buf - 4));
consumed = parseSPS(nal_data, nal_len); consumed = parseSPS(nal_data, nal_len);
if (consumed > 0) if (consumed > 0)
@ -142,7 +143,7 @@ bool cFemonH264::processVideo(const uint8_t *buf, int len)
case NAL_SEI: case NAL_SEI:
if (!sei_found) { if (!sei_found) {
//debug("H.264: Found NAL SEI at offset %d/%d\n", int(buf - start), len); //debug("H.264: Found NAL SEI at offset %d/%d\n", int(buf - start), lenP);
int nal_len = nalUnescape(nal_data, buf + 4, int(end - buf - 4)); int nal_len = nalUnescape(nal_data, buf + 4, int(end - buf - 4));
consumed = parseSEI(nal_data, nal_len); consumed = parseSEI(nal_data, nal_len);
if (consumed > 0) if (consumed > 0)
@ -161,18 +162,18 @@ bool cFemonH264::processVideo(const uint8_t *buf, int len)
} }
if (aud_found) { if (aud_found) {
m_VideoHandler->SetVideoCodec(VIDEO_CODEC_H264); videoHandlerM->SetVideoCodec(VIDEO_CODEC_H264);
if (sps_found) { if (sps_found) {
//debug("H.264: size %dx%d, aspect %d format %d bitrate %.0f\n", m_Width, m_Height, m_AspectRatio, m_Format, m_BitRate); //debug("H.264: size %dx%d, aspect %d format %d bitrate %.0f\n", widthM, heightM, aspectRatioM, formatM, bitRateM);
m_VideoHandler->SetVideoFormat(m_Format); videoHandlerM->SetVideoFormat(formatM);
m_VideoHandler->SetVideoSize(m_Width, m_Height); videoHandlerM->SetVideoSize(widthM, heightM);
m_VideoHandler->SetVideoAspectRatio(m_AspectRatio); videoHandlerM->SetVideoAspectRatio(aspectRatioM);
m_VideoHandler->SetVideoBitrate(m_BitRate); videoHandlerM->SetVideoBitrate(bitRateM);
} }
if (sps_found || sei_found) { if (sps_found || sei_found) {
//debug("H.264: scan %d framerate %.2f\n", m_Scan, (m_Scan == VIDEO_SCAN_PROGRESSIVE) ? (m_FrameRate / 2) : m_FrameRate); //debug("H.264: scan %d framerate %.2f\n", scanM, (scanM == VIDEO_SCAN_PROGRESSIVE) ? (frameRateM / 2) : frameRateM);
m_VideoHandler->SetVideoScan(m_Scan); videoHandlerM->SetVideoScan(scanM);
m_VideoHandler->SetVideoFramerate((m_Scan == VIDEO_SCAN_PROGRESSIVE) ? (m_FrameRate / 2) : m_FrameRate); videoHandlerM->SetVideoFramerate((scanM == VIDEO_SCAN_PROGRESSIVE) ? (frameRateM / 2) : frameRateM);
} }
} }
@ -181,60 +182,60 @@ bool cFemonH264::processVideo(const uint8_t *buf, int len)
void cFemonH264::reset() void cFemonH264::reset()
{ {
m_CpbDpbDelaysPresentFlag = false; cpbDpbDelaysPresentFlagM = false;
m_PicStructPresentFlag = false; picStructPresentFlagM = false;
m_FrameMbsOnlyFlag = false; frameMbsOnlyFlagM = false;
m_MbAdaptiveFrameFieldFlag = false; mbAdaptiveFrameFieldFlagM = false;
m_TimeOffsetLength = 0; timeOffsetLengthM = 0;
} }
const uint8_t *cFemonH264::nextStartCode(const uint8_t *start, const uint8_t *end) const uint8_t *cFemonH264::nextStartCode(const uint8_t *startP, const uint8_t *endP)
{ {
for (end -= 3; start < end; ++start) { for (endP -= 3; startP < endP; ++startP) {
if ((start[0] == 0x00) && (start[1] == 0x00) && (start[2] == 0x01)) if ((startP[0] == 0x00) && (startP[1] == 0x00) && (startP[2] == 0x01))
return start; return startP;
} }
return (end + 3); return (endP + 3);
} }
int cFemonH264::nalUnescape(uint8_t *dst, const uint8_t *src, int len) int cFemonH264::nalUnescape(uint8_t *dstP, const uint8_t *srcP, int lenP)
{ {
int s = 0, d = 0; int s = 0, d = 0;
while (s < len) { while (s < lenP) {
if (!src[s] && !src[s + 1]) { if (!srcP[s] && !srcP[s + 1]) {
// hit 00 00 xx // hit 00 00 xx
dst[d] = dst[d + 1] = 0; dstP[d] = dstP[d + 1] = 0;
s += 2; s += 2;
d += 2; d += 2;
if (src[s] == 3) { if (srcP[s] == 3) {
s++; // 00 00 03 xx --> 00 00 xx s++; // 00 00 03 xx --> 00 00 xx
if (s >= len) if (s >= lenP)
return d; return d;
} }
} }
dst[d++] = src[s++]; dstP[d++] = srcP[s++];
} }
return d; return d;
} }
int cFemonH264::parseSPS(const uint8_t *buf, int len) int cFemonH264::parseSPS(const uint8_t *bufP, int lenP)
{ {
int profile_idc, level_idc, constraint_set3_flag, pic_order_cnt_type, i, j; int profile_idc, level_idc, constraint_set3_flag, pic_order_cnt_type, i, j;
cFemonBitStream bs(buf, len); cFemonBitStream bs(bufP, lenP);
uint32_t width = m_Width; uint32_t width = widthM;
uint32_t height = m_Height; uint32_t height = heightM;
eVideoAspectRatio aspect_ratio = m_AspectRatio; eVideoAspectRatio aspect_ratio = aspectRatioM;
eVideoFormat format = m_Format; eVideoFormat format = formatM;
double frame_rate = m_FrameRate; double frame_rate = frameRateM;
double bit_rate = m_BitRate; double bit_rate = bitRateM;
bool cpb_dpb_delays_present_flag = m_CpbDpbDelaysPresentFlag; bool cpb_dpb_delays_present_flag = cpbDpbDelaysPresentFlagM;
bool pic_struct_present_flag = m_PicStructPresentFlag; bool pic_struct_present_flag = picStructPresentFlagM;
bool frame_mbs_only_flag = m_FrameMbsOnlyFlag; bool frame_mbs_only_flag = frameMbsOnlyFlagM;
bool mb_adaptive_frame_field_flag = m_MbAdaptiveFrameFieldFlag; bool mb_adaptive_frame_field_flag = mbAdaptiveFrameFieldFlagM;
uint32_t time_offset_length = m_TimeOffsetLength; uint32_t time_offset_length = timeOffsetLengthM;
profile_idc = bs.GetBits(8); // profile_idc profile_idc = bs.GetBits(8); // profile_idc
bs.SkipBit(); // constraint_set0_flag bs.SkipBit(); // constraint_set0_flag
@ -523,14 +524,14 @@ int cFemonH264::parseSPS(const uint8_t *buf, int len)
sar_width = bs.GetBits(16); // sar_width sar_width = bs.GetBits(16); // sar_width
sar_height = bs.GetBits(16); // sar_height sar_height = bs.GetBits(16); // sar_height
} }
else if (aspect_ratio_idc < ELEMENTS(s_SAR)) { else if (aspect_ratio_idc < ELEMENTS(sarS)) {
sar_width = s_SAR[aspect_ratio_idc].w; sar_width = sarS[aspect_ratio_idc].w;
sar_height = s_SAR[aspect_ratio_idc].h; sar_height = sarS[aspect_ratio_idc].h;
} }
if (sar_width && sar_height) { if (sar_width && sar_height) {
int index = -1, ratio = int(100.0L * sar_width * width / sar_height / height); int index = -1, ratio = int(100.0L * sar_width * width / sar_height / height);
for (unsigned int i = 0; i < ELEMENTS(s_DAR); ++i) { for (unsigned int i = 0; i < ELEMENTS(darS); ++i) {
if (s_DAR[i].ratio == ratio) { if (darS[i].ratio == ratio) {
index = i; index = i;
break; break;
} }
@ -542,7 +543,7 @@ int cFemonH264::parseSPS(const uint8_t *buf, int len)
aspect_ratio = VIDEO_ASPECT_RATIO_INVALID; aspect_ratio = VIDEO_ASPECT_RATIO_INVALID;
} }
else else
aspect_ratio = s_DAR[index].dar; aspect_ratio = darS[index].dar;
//debug("H.264 SPS: DAR %dx%d (%d)\n", sar_width, sar_height, aspect_ratio); //debug("H.264 SPS: DAR %dx%d (%d)\n", sar_width, sar_height, aspect_ratio);
} }
} }
@ -551,8 +552,8 @@ int cFemonH264::parseSPS(const uint8_t *buf, int len)
if (bs.GetBit()) { // video_signal_type_present_flag if (bs.GetBit()) { // video_signal_type_present_flag
uint32_t video_format; uint32_t video_format;
video_format = bs.GetBits(3); // video_format video_format = bs.GetBits(3); // video_format
if (video_format < sizeof(s_VideoFormats) / sizeof(s_VideoFormats[0])) { if (video_format < sizeof(videoFormatS) / sizeof(videoFormatS[0])) {
format = s_VideoFormats[video_format]; format = videoFormatS[video_format];
//debug("H.264 SPS: video format %d\n", format); //debug("H.264 SPS: video format %d\n", format);
} }
bs.SkipBit(); // video_full_range_flag bs.SkipBit(); // video_full_range_flag
@ -621,30 +622,30 @@ int cFemonH264::parseSPS(const uint8_t *buf, int len)
} }
} }
m_Width = width; widthM = width;
m_Height = height; heightM = height;
m_AspectRatio = aspect_ratio; aspectRatioM = aspect_ratio;
m_Format = format; formatM = format;
m_Scan = frame_mbs_only_flag ? VIDEO_SCAN_PROGRESSIVE : VIDEO_SCAN_INTERLACED; scanM = frame_mbs_only_flag ? VIDEO_SCAN_PROGRESSIVE : VIDEO_SCAN_INTERLACED;
m_FrameRate = frame_rate; frameRateM = frame_rate;
m_BitRate = bit_rate; bitRateM = bit_rate;
m_CpbDpbDelaysPresentFlag = cpb_dpb_delays_present_flag; cpbDpbDelaysPresentFlagM = cpb_dpb_delays_present_flag;
m_PicStructPresentFlag = pic_struct_present_flag; picStructPresentFlagM = pic_struct_present_flag;
m_FrameMbsOnlyFlag = frame_mbs_only_flag; frameMbsOnlyFlagM = frame_mbs_only_flag;
m_MbAdaptiveFrameFieldFlag = mb_adaptive_frame_field_flag; mbAdaptiveFrameFieldFlagM = mb_adaptive_frame_field_flag;
m_TimeOffsetLength = time_offset_length; timeOffsetLengthM = time_offset_length;
return (bs.Index() / 8); return (bs.Index() / 8);
} }
int cFemonH264::parseSEI(const uint8_t *buf, int len) int cFemonH264::parseSEI(const uint8_t *bufP, int lenP)
{ {
int num_referenced_subseqs, i; int num_referenced_subseqs, i;
cFemonBitStream bs(buf, len); cFemonBitStream bs(bufP, lenP);
eVideoScan scan = m_Scan; eVideoScan scan = scanM;
while ((bs.Index() * 8 + 16) < len) { // sei_message while ((bs.Index() * 8 + 16) < lenP) { // sei_message
int lastByte, payloadSize = 0, payloadType = 0; int lastByte, payloadSize = 0, payloadType = 0;
do { do {
@ -659,16 +660,16 @@ int cFemonH264::parseSEI(const uint8_t *buf, int len)
switch (payloadType) { // sei_payload switch (payloadType) { // sei_payload
case 1: // pic_timing case 1: // pic_timing
if (m_CpbDpbDelaysPresentFlag) { // cpb_dpb_delays_present_flag if (cpbDpbDelaysPresentFlagM) { // cpb_dpb_delays_present_flag
bs.SkipUeGolomb(); // cpb_removal_delay bs.SkipUeGolomb(); // cpb_removal_delay
bs.SkipUeGolomb(); // dpb_output_delay bs.SkipUeGolomb(); // dpb_output_delay
} }
if (m_PicStructPresentFlag) { // pic_struct_present_flag if (picStructPresentFlagM) { // pic_struct_present_flag
uint32_t pic_struct, ct_type = 0, i = 0; uint32_t pic_struct, ct_type = 0, i = 0;
pic_struct = bs.GetBits(4); // pic_struct pic_struct = bs.GetBits(4); // pic_struct
if (pic_struct >= (sizeof(s_SeiNumClockTsTable)) / sizeof(s_SeiNumClockTsTable[0])) if (pic_struct >= (sizeof(seiNumClockTsTableS)) / sizeof(seiNumClockTsTableS[0]))
return 0; return 0;
if (m_FrameMbsOnlyFlag && !m_MbAdaptiveFrameFieldFlag) if (frameMbsOnlyFlagM && !mbAdaptiveFrameFieldFlagM)
scan = VIDEO_SCAN_PROGRESSIVE; scan = VIDEO_SCAN_PROGRESSIVE;
else { else {
switch (pic_struct) { switch (pic_struct) {
@ -691,7 +692,7 @@ int cFemonH264::parseSEI(const uint8_t *buf, int len)
} }
} }
//debug("H.264 SEI: pic struct %d scan type %d\n", pic_struct, scan); //debug("H.264 SEI: pic struct %d scan type %d\n", pic_struct, scan);
for (i = 0; i < s_SeiNumClockTsTable[pic_struct]; ++i) { for (i = 0; i < seiNumClockTsTableS[pic_struct]; ++i) {
if (bs.GetBit()) { // clock_timestamp_flag[i] if (bs.GetBit()) { // clock_timestamp_flag[i]
int full_timestamp_flag; int full_timestamp_flag;
ct_type |= (1 << bs.GetBits(2)); // ct_type ct_type |= (1 << bs.GetBits(2)); // ct_type
@ -717,8 +718,8 @@ int cFemonH264::parseSEI(const uint8_t *buf, int len)
} }
} }
} }
if (m_TimeOffsetLength > 0) if (timeOffsetLengthM > 0)
bs.SkipBits(m_TimeOffsetLength); // time_offset bs.SkipBits(timeOffsetLengthM); // time_offset
} }
} }
if (i > 0) if (i > 0)
@ -753,7 +754,7 @@ int cFemonH264::parseSEI(const uint8_t *buf, int len)
bs.ByteAlign(); bs.ByteAlign();
} }
m_Scan = scan; scanM = scan;
return (bs.Index() / 8); return (bs.Index() / 8);
} }

View File

@ -29,19 +29,19 @@ private:
int h; int h;
} t_SAR; } t_SAR;
cFemonVideoIf *m_VideoHandler; cFemonVideoIf *videoHandlerM;
uint32_t m_Width; uint32_t widthM;
uint32_t m_Height; uint32_t heightM;
eVideoAspectRatio m_AspectRatio; eVideoAspectRatio aspectRatioM;
eVideoFormat m_Format; eVideoFormat formatM;
double m_FrameRate; double frameRateM;
double m_BitRate; double bitRateM;
eVideoScan m_Scan; eVideoScan scanM;
bool m_CpbDpbDelaysPresentFlag; bool cpbDpbDelaysPresentFlagM;
bool m_PicStructPresentFlag; bool picStructPresentFlagM;
bool m_FrameMbsOnlyFlag; bool frameMbsOnlyFlagM;
bool m_MbAdaptiveFrameFieldFlag; bool mbAdaptiveFrameFieldFlagM;
uint32_t m_TimeOffsetLength; uint32_t timeOffsetLengthM;
void reset(); void reset();
const uint8_t *nextStartCode(const uint8_t *start, const uint8_t *end); const uint8_t *nextStartCode(const uint8_t *start, const uint8_t *end);
@ -49,16 +49,16 @@ private:
int parseSPS(const uint8_t *buf, int len); int parseSPS(const uint8_t *buf, int len);
int parseSEI(const uint8_t *buf, int len); int parseSEI(const uint8_t *buf, int len);
static const t_SAR s_SAR[]; static const t_SAR sarS[];
static const t_DAR s_DAR[]; static const t_DAR darS[];
static const eVideoFormat s_VideoFormats[]; static const eVideoFormat videoFormatS[];
static const uint8_t s_SeiNumClockTsTable[9]; static const uint8_t seiNumClockTsTableS[9];
public: public:
cFemonH264(cFemonVideoIf *videohandler); cFemonH264(cFemonVideoIf *videoHandlerP);
virtual ~cFemonH264(); virtual ~cFemonH264();
bool processVideo(const uint8_t *buf, int len); bool processVideo(const uint8_t *bufP, int lenP);
}; };
#endif //__FEMONH264_H #endif //__FEMONH264_H

View File

@ -8,20 +8,20 @@
#include "femontools.h" #include "femontools.h"
#include "femonlatm.h" #include "femonlatm.h"
int cFemonLATM::s_Bitrates[3][16] = int cFemonLATM::bitrateS[3][16] =
{ {
{0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, -1}, // MPEG-2 Layer I {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, -1}, // MPEG-2 Layer I
{0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1}, // MPEG-2 Layer II/III {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1}, // MPEG-2 Layer II/III
{0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1} // MPEG-2 Layer II/III {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1} // MPEG-2 Layer II/III
}; };
int cFemonLATM::s_Samplerates[4] = int cFemonLATM::sampleRateS[4] =
{ {
22050, 24000, 16000, -1 22050, 24000, 16000, -1
}; };
cFemonLATM::cFemonLATM(cFemonAudioIf *audiohandler) cFemonLATM::cFemonLATM(cFemonAudioIf *audioHandlerP)
: m_AudioHandler(audiohandler) : audioHandlerM(audioHandlerP)
{ {
} }
@ -29,23 +29,23 @@ cFemonLATM::~cFemonLATM()
{ {
} }
bool cFemonLATM::processAudio(const uint8_t *buf, int len) bool cFemonLATM::processAudio(const uint8_t *bufP, int lenP)
{ {
cFemonBitStream bs(buf, len * 8); cFemonBitStream bs(bufP, lenP * 8);
if (!m_AudioHandler) if (!audioHandlerM)
return false; return false;
// skip PES header // skip PES header
if (!PesLongEnough(len)) if (!PesLongEnough(lenP))
return false; return false;
bs.SkipBits(8 * PesPayloadOffset(buf)); bs.SkipBits(8 * PesPayloadOffset(bufP));
// MPEG audio detection // MPEG audio detection
if (bs.GetBits(12) != 0x56E) // syncword if (bs.GetBits(12) != 0x56E) // syncword
return false; return false;
m_AudioHandler->SetAudioCodec(AUDIO_CODEC_LATM); audioHandlerM->SetAudioCodec(AUDIO_CODEC_LATM);
if (bs.GetBit() == 0) // id: MPEG-1=1, extension to lower sampling frequencies=0 if (bs.GetBit() == 0) // id: MPEG-1=1, extension to lower sampling frequencies=0
return true; // @todo: lower sampling frequencies support return true; // @todo: lower sampling frequencies support
@ -59,52 +59,52 @@ bool cFemonLATM::processAudio(const uint8_t *buf, int len)
switch (mode) { switch (mode) {
case 0: case 0:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_STEREO); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_STEREO);
break; break;
case 1: case 1:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_JOINT_STEREO); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_JOINT_STEREO);
break; break;
case 2: case 2:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_DUAL); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_DUAL);
break; break;
case 3: case 3:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_SINGLE); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_SINGLE);
break; break;
default: default:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_INVALID); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_INVALID);
break; break;
} }
if (layer == 3) { if (layer == 3) {
m_AudioHandler->SetAudioBitrate(AUDIO_BITRATE_FREE); audioHandlerM->SetAudioBitrate(AUDIO_BITRATE_FREE);
} }
else { else {
switch (bit_rate_index) { switch (bit_rate_index) {
case 0: case 0:
m_AudioHandler->SetAudioBitrate(AUDIO_BITRATE_FREE); audioHandlerM->SetAudioBitrate(AUDIO_BITRATE_FREE);
break; break;
case 0xF: case 0xF:
m_AudioHandler->SetAudioBitrate(AUDIO_BITRATE_RESERVED); audioHandlerM->SetAudioBitrate(AUDIO_BITRATE_RESERVED);
break; break;
default: default:
m_AudioHandler->SetAudioBitrate(1000 * s_Bitrates[layer][bit_rate_index]); audioHandlerM->SetAudioBitrate(1000 * bitrateS[layer][bit_rate_index]);
break; break;
} }
} }
switch (sampling_frequency) { switch (sampling_frequency) {
case 3: case 3:
m_AudioHandler->SetAudioSamplingFrequency(AUDIO_SAMPLING_FREQUENCY_RESERVED); audioHandlerM->SetAudioSamplingFrequency(AUDIO_SAMPLING_FREQUENCY_RESERVED);
break; break;
default: default:
m_AudioHandler->SetAudioSamplingFrequency(s_Samplerates[sampling_frequency]); audioHandlerM->SetAudioSamplingFrequency(sampleRateS[sampling_frequency]);
break; break;
} }

View File

@ -12,16 +12,16 @@
class cFemonLATM { class cFemonLATM {
private: private:
cFemonAudioIf *m_AudioHandler; cFemonAudioIf *audioHandlerM;
static int s_Bitrates[3][16]; static int bitrateS[3][16];
static int s_Samplerates[4]; static int sampleRateS[4];
public: public:
cFemonLATM(cFemonAudioIf *audiohandler); cFemonLATM(cFemonAudioIf *audioHandlerP);
virtual ~cFemonLATM(); virtual ~cFemonLATM();
bool processAudio(const uint8_t *buf, int len); bool processAudio(const uint8_t *bufP, int lenP);
}; };
#endif //__FEMONLATM_H #endif //__FEMONLATM_H

View File

@ -10,7 +10,7 @@
#define IS_EXTENSION_START(buf) (((buf)[0] == 0x00) && ((buf)[1] == 0x00) && ((buf)[2] == 0x01) && ((buf)[3] == 0xB5)) #define IS_EXTENSION_START(buf) (((buf)[0] == 0x00) && ((buf)[1] == 0x00) && ((buf)[2] == 0x01) && ((buf)[3] == 0xB5))
int cFemonMPEG::s_Bitrates[2][3][16] = int cFemonMPEG::bitrateS[2][3][16] =
{ {
{ {
{0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, -1}, // MPEG-2 Layer I {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, -1}, // MPEG-2 Layer I
@ -24,21 +24,21 @@ int cFemonMPEG::s_Bitrates[2][3][16] =
} }
}; };
int cFemonMPEG::s_Samplerates[2][4] = int cFemonMPEG::sampleRateS[2][4] =
{ {
{22050, 24000, 16000, -1}, // MPEG-2 {22050, 24000, 16000, -1}, // MPEG-2
{44100, 48000, 32000, -1} // MPEG-1 {44100, 48000, 32000, -1} // MPEG-1
}; };
eAudioCodec cFemonMPEG::s_Formats[2][4] = eAudioCodec cFemonMPEG::formatS[2][4] =
{ {
{AUDIO_CODEC_MPEG2_I, AUDIO_CODEC_MPEG2_II, AUDIO_CODEC_MPEG2_III, AUDIO_CODEC_UNKNOWN}, // MPEG-2 {AUDIO_CODEC_MPEG2_I, AUDIO_CODEC_MPEG2_II, AUDIO_CODEC_MPEG2_III, AUDIO_CODEC_UNKNOWN}, // MPEG-2
{AUDIO_CODEC_MPEG1_I, AUDIO_CODEC_MPEG1_II, AUDIO_CODEC_MPEG1_III, AUDIO_CODEC_UNKNOWN} // MPEG-1 {AUDIO_CODEC_MPEG1_I, AUDIO_CODEC_MPEG1_II, AUDIO_CODEC_MPEG1_III, AUDIO_CODEC_UNKNOWN} // MPEG-1
}; };
cFemonMPEG::cFemonMPEG(cFemonVideoIf *videohandler, cFemonAudioIf *audiohandler) cFemonMPEG::cFemonMPEG(cFemonVideoIf *videoHandlerP, cFemonAudioIf *audioHandlerP)
: m_VideoHandler(videohandler), : videoHandlerM(videoHandlerP),
m_AudioHandler(audiohandler) audioHandlerM(audioHandlerP)
{ {
} }
@ -46,17 +46,17 @@ cFemonMPEG::~cFemonMPEG()
{ {
} }
bool cFemonMPEG::processAudio(const uint8_t *buf, int len) bool cFemonMPEG::processAudio(const uint8_t *bufP, int lenP)
{ {
cFemonBitStream bs(buf, len * 8); cFemonBitStream bs(bufP, lenP * 8);
if (!m_AudioHandler) if (!audioHandlerM)
return false; return false;
// skip PES header // skip PES header
if (!PesLongEnough(len)) if (!PesLongEnough(lenP))
return false; return false;
bs.SkipBits(8 * PesPayloadOffset(buf)); bs.SkipBits(8 * PesPayloadOffset(bufP));
// MPEG audio detection // MPEG audio detection
if (bs.GetBits(12) != 0xFFF) // syncword if (bs.GetBits(12) != 0xFFF) // syncword
@ -71,68 +71,68 @@ bool cFemonMPEG::processAudio(const uint8_t *buf, int len)
bs.SkipBit(); // private pid bs.SkipBit(); // private pid
int mode = bs.GetBits(2); // mode int mode = bs.GetBits(2); // mode
m_AudioHandler->SetAudioCodec(s_Formats[id][layer]); audioHandlerM->SetAudioCodec(formatS[id][layer]);
switch (mode) { switch (mode) {
case 0: case 0:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_STEREO); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_STEREO);
break; break;
case 1: case 1:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_JOINT_STEREO); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_JOINT_STEREO);
break; break;
case 2: case 2:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_DUAL); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_DUAL);
break; break;
case 3: case 3:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_SINGLE); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_SINGLE);
break; break;
default: default:
m_AudioHandler->SetAudioChannel(AUDIO_CHANNEL_MODE_INVALID); audioHandlerM->SetAudioChannel(AUDIO_CHANNEL_MODE_INVALID);
break; break;
} }
switch (bit_rate_index) { switch (bit_rate_index) {
case 0: case 0:
m_AudioHandler->SetAudioBitrate(AUDIO_BITRATE_FREE); audioHandlerM->SetAudioBitrate(AUDIO_BITRATE_FREE);
break; break;
case 0xF: case 0xF:
m_AudioHandler->SetAudioBitrate(AUDIO_BITRATE_RESERVED); audioHandlerM->SetAudioBitrate(AUDIO_BITRATE_RESERVED);
break; break;
default: default:
m_AudioHandler->SetAudioBitrate(1000 * s_Bitrates[id][layer][bit_rate_index]); audioHandlerM->SetAudioBitrate(1000 * bitrateS[id][layer][bit_rate_index]);
break; break;
} }
switch (sampling_frequency) { switch (sampling_frequency) {
case 3: case 3:
m_AudioHandler->SetAudioSamplingFrequency(AUDIO_SAMPLING_FREQUENCY_RESERVED); audioHandlerM->SetAudioSamplingFrequency(AUDIO_SAMPLING_FREQUENCY_RESERVED);
break; break;
default: default:
m_AudioHandler->SetAudioSamplingFrequency(s_Samplerates[id][sampling_frequency]); audioHandlerM->SetAudioSamplingFrequency(sampleRateS[id][sampling_frequency]);
break; break;
} }
return true; return true;
} }
bool cFemonMPEG::processVideo(const uint8_t *buf, int len) bool cFemonMPEG::processVideo(const uint8_t *bufP, int lenP)
{ {
cFemonBitStream bs(buf, len * 8); cFemonBitStream bs(bufP, lenP * 8);
if (!m_VideoHandler) if (!videoHandlerM)
return false; return false;
// skip PES header // skip PES header
if (!PesLongEnough(len)) if (!PesLongEnough(lenP))
return false; return false;
bs.SkipBits(8 * PesPayloadOffset(buf)); bs.SkipBits(8 * PesPayloadOffset(bufP));
// MPEG-2 video detection, search for start code // MPEG-2 video detection, search for start code
if (bs.GetBits(32) != 0x000001B3) // sequence header if (bs.GetBits(32) != 0x000001B3) // sequence header
@ -274,13 +274,13 @@ bool cFemonMPEG::processVideo(const uint8_t *buf, int len)
} }
} }
m_VideoHandler->SetVideoCodec(VIDEO_CODEC_MPEG2); videoHandlerM->SetVideoCodec(VIDEO_CODEC_MPEG2);
m_VideoHandler->SetVideoSize(horizontal_size, vertical_size); videoHandlerM->SetVideoSize(horizontal_size, vertical_size);
m_VideoHandler->SetVideoBitrate(400.0 * (double)(bit_rate)); videoHandlerM->SetVideoBitrate(400.0 * (double)(bit_rate));
m_VideoHandler->SetVideoFramerate(frame_rate); videoHandlerM->SetVideoFramerate(frame_rate);
m_VideoHandler->SetVideoScan(eVideoScan(scan)); videoHandlerM->SetVideoScan(eVideoScan(scan));
m_VideoHandler->SetVideoAspectRatio(eVideoAspectRatio(aspect)); videoHandlerM->SetVideoAspectRatio(eVideoAspectRatio(aspect));
m_VideoHandler->SetVideoFormat(eVideoFormat(format)); videoHandlerM->SetVideoFormat(eVideoFormat(format));
return true; return true;
} }

View File

@ -13,19 +13,19 @@
class cFemonMPEG { class cFemonMPEG {
private: private:
cFemonVideoIf *m_VideoHandler; cFemonVideoIf *videoHandlerM;
cFemonAudioIf *m_AudioHandler; cFemonAudioIf *audioHandlerM;
static int s_Bitrates[2][3][16]; static int bitrateS[2][3][16];
static int s_Samplerates[2][4]; static int sampleRateS[2][4];
static eAudioCodec s_Formats[2][4]; static eAudioCodec formatS[2][4];
public: public:
cFemonMPEG(cFemonVideoIf *videohandler, cFemonAudioIf *audiohandler); cFemonMPEG(cFemonVideoIf *videoHandlerP, cFemonAudioIf *audioHandlerP);
virtual ~cFemonMPEG(); virtual ~cFemonMPEG();
bool processVideo(const uint8_t *buf, int len); bool processVideo(const uint8_t *bufP, int lenP);
bool processAudio(const uint8_t *buf, int len); bool processAudio(const uint8_t *bufP, int lenP);
}; };
#endif //__FEMONMPEG_H #endif //__FEMONMPEG_H

File diff suppressed because it is too large Load Diff

View File

@ -31,44 +31,44 @@ private:
DEVICESOURCE_COUNT DEVICESOURCE_COUNT
}; };
static cFemonOsd *pInstance; static cFemonOsd *pInstanceS;
cOsd *m_Osd; cOsd *osdM;
cFemonReceiver *m_Receiver; cFemonReceiver *receiverM;
int m_Frontend; int frontendM;
int m_SvdrpFrontend; int svdrpFrontendM;
double m_SvdrpVideoBitrate; double svdrpVideoBitRateM;
double m_SvdrpAudioBitrate; double svdrpAudioBitRateM;
SvdrpConnection_v1_0 m_SvdrpConnection; SvdrpConnection_v1_0 svdrpConnectionM;
cPlugin *m_SvdrpPlugin; cPlugin *svdrpPluginM;
int m_Number; int numberM;
int m_OldNumber; int oldNumberM;
int m_Quality; int qualityM;
bool m_QualityValid; bool qualityValidM;
int m_Strength; int strengthM;
bool m_StrengthValid; bool strengthValidM;
uint16_t m_SNR; uint16_t snrM;
bool m_SNRValid; bool snrValidM;
uint16_t m_Signal; uint16_t signalM;
bool m_SignalValid; bool signalValidM;
uint32_t m_BER; uint32_t berM;
bool m_BERValid; bool berValidM;
uint32_t m_UNC; uint32_t uncM;
bool m_UNCValid; bool uncValidM;
cString m_FrontendName; cString frontendNameM;
fe_status_t m_FrontendStatus; fe_status_t frontendStatusM;
bool m_FrontendStatusValid; bool frontendStatusValidM;
dvb_frontend_info m_FrontendInfo; dvb_frontend_info frontendInfoM;
eDeviceSourceType m_DeviceSource; eDeviceSourceType deviceSourceM;
int m_DisplayMode; int displayModeM;
int m_OsdWidth; int osdWidthM;
int m_OsdHeight; int osdHeightM;
int m_OsdLeft; int osdLeftM;
int m_OsdTop; int osdTopM;
cFont *m_Font; cFont *fontM;
cTimeMs m_InputTime; cTimeMs inputTimeM;
cCondWait m_Sleep; cCondWait sleepM;
cMutex m_Mutex; cMutex mutexM;
void DrawStatusWindow(void); void DrawStatusWindow(void);
void DrawInfoWindow(void); void DrawInfoWindow(void);
@ -80,17 +80,17 @@ protected:
cFemonOsd(const cFemonOsd&); cFemonOsd(const cFemonOsd&);
cFemonOsd& operator= (const cFemonOsd&); cFemonOsd& operator= (const cFemonOsd&);
virtual void Action(void); virtual void Action(void);
virtual void ChannelSwitch(const cDevice *device, int channelNumber, bool liveView); virtual void ChannelSwitch(const cDevice *deviceP, int channelNumberP, bool liveViewP);
virtual void SetAudioTrack(int Index, const char * const *Tracks); virtual void SetAudioTrack(int indexP, const char * const *tracksP);
public: public:
static cFemonOsd *Instance(bool create = false); static cFemonOsd *Instance(bool createP = false);
~cFemonOsd(); ~cFemonOsd();
virtual void Show(void); virtual void Show(void);
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys keyP);
bool DeviceSwitch(int direction); bool DeviceSwitch(int directionP);
double GetVideoBitrate(void); double GetVideoBitrate(void);
double GetAudioBitrate(void); double GetAudioBitrate(void);
double GetDolbyBitrate(void); double GetDolbyBitrate(void);

View File

@ -10,66 +10,66 @@
#include "femoncfg.h" #include "femoncfg.h"
#include "femonreceiver.h" #include "femonreceiver.h"
cFemonReceiver::cFemonReceiver(const cChannel *Channel, int ATrack, int DTrack) cFemonReceiver::cFemonReceiver(const cChannel *channelP, int aTrackP, int dTrackP)
: cReceiver(Channel), : cReceiver(channelP),
cThread("femon receiver"), cThread("femon receiver"),
m_Mutex(), mutexM(),
m_Sleep(), sleepM(),
m_Active(false), activeM(false),
m_DetectH264(this), detectH264M(this),
m_DetectMPEG(this, this), detectMpegM(this, this),
m_DetectAAC(this), detectAacM(this),
m_DetectLATM(this), detectLatmM(this),
m_DetectAC3(this), detectAc3M(this),
m_VideoBuffer(KILOBYTE(512), TS_SIZE, false, "Femon video"), videoBufferM(KILOBYTE(512), TS_SIZE, false, "Femon video"),
m_VideoType(Channel ? Channel->Vtype(): 0), videoTypeM(channelP ? channelP->Vtype(): 0),
m_VideoPid(Channel ? Channel->Vpid() : 0), videoPidM(channelP ? channelP->Vpid() : 0),
m_VideoPacketCount(0), videoPacketCountM(0),
m_VideoBitrate(0.0), videoBitRateM(0.0),
m_VideoValid(false), videoValidM(false),
m_AudioBuffer(KILOBYTE(256), TS_SIZE, false, "Femon audio"), audioBufferM(KILOBYTE(256), TS_SIZE, false, "Femon audio"),
m_AudioPid(Channel ? Channel->Apid(ATrack) : 0), audioPidM(channelP ? channelP->Apid(aTrackP) : 0),
m_AudioPacketCount(0), audioPacketCountM(0),
m_AudioBitrate(0.0), audioBitRateM(0.0),
m_AudioValid(false), audioValidM(false),
m_AC3Buffer(KILOBYTE(256), TS_SIZE, false, "Femon AC3"), ac3BufferM(KILOBYTE(256), TS_SIZE, false, "Femon AC3"),
m_AC3Pid(Channel ? Channel->Dpid(DTrack) : 0), ac3PidM(channelP ? channelP->Dpid(dTrackP) : 0),
m_AC3PacketCount(0), ac3PacketCountM(0),
m_AC3Bitrate(0), ac3BitRateM(0),
m_AC3Valid(false) ac3ValidM(false)
{ {
debug("%s()\n", __PRETTY_FUNCTION__); debug("%s()\n", __PRETTY_FUNCTION__);
SetPids(NULL); SetPids(NULL);
AddPid(m_VideoPid); AddPid(videoPidM);
AddPid(m_AudioPid); AddPid(audioPidM);
AddPid(m_AC3Pid); AddPid(ac3PidM);
m_VideoBuffer.SetTimeouts(0, 100); videoBufferM.SetTimeouts(0, 100);
m_AudioBuffer.SetTimeouts(0, 100); audioBufferM.SetTimeouts(0, 100);
m_AC3Buffer.SetTimeouts(0, 100); ac3BufferM.SetTimeouts(0, 100);
m_VideoInfo.codec = VIDEO_CODEC_INVALID; videoInfoM.codec = VIDEO_CODEC_INVALID;
m_VideoInfo.format = VIDEO_FORMAT_INVALID; videoInfoM.format = VIDEO_FORMAT_INVALID;
m_VideoInfo.scan = VIDEO_SCAN_INVALID; videoInfoM.scan = VIDEO_SCAN_INVALID;
m_VideoInfo.aspectRatio = VIDEO_ASPECT_RATIO_INVALID; videoInfoM.aspectRatio = VIDEO_ASPECT_RATIO_INVALID;
m_VideoInfo.width = 0; videoInfoM.width = 0;
m_VideoInfo.height = 0; videoInfoM.height = 0;
m_VideoInfo.frameRate = 0; videoInfoM.frameRate = 0;
m_VideoInfo.bitrate = AUDIO_BITRATE_INVALID; videoInfoM.bitrate = AUDIO_BITRATE_INVALID;
m_AudioInfo.codec = AUDIO_CODEC_UNKNOWN; audioInfoM.codec = AUDIO_CODEC_UNKNOWN;
m_AudioInfo.bitrate = AUDIO_BITRATE_INVALID; audioInfoM.bitrate = AUDIO_BITRATE_INVALID;
m_AudioInfo.samplingFrequency = AUDIO_SAMPLING_FREQUENCY_INVALID; audioInfoM.samplingFrequency = AUDIO_SAMPLING_FREQUENCY_INVALID;
m_AudioInfo.channelMode = AUDIO_CHANNEL_MODE_INVALID; audioInfoM.channelMode = AUDIO_CHANNEL_MODE_INVALID;
m_AC3Info.bitrate = AUDIO_BITRATE_INVALID; ac3InfoM.bitrate = AUDIO_BITRATE_INVALID;
m_AC3Info.samplingFrequency = AUDIO_SAMPLING_FREQUENCY_INVALID; ac3InfoM.samplingFrequency = AUDIO_SAMPLING_FREQUENCY_INVALID;
m_AC3Info.bitstreamMode = AUDIO_BITSTREAM_MODE_INVALID; ac3InfoM.bitstreamMode = AUDIO_BITSTREAM_MODE_INVALID;
m_AC3Info.audioCodingMode = AUDIO_CODING_MODE_INVALID; ac3InfoM.audioCodingMode = AUDIO_CODING_MODE_INVALID;
m_AC3Info.dolbySurroundMode = AUDIO_DOLBY_SURROUND_MODE_INVALID; ac3InfoM.dolbySurroundMode = AUDIO_DOLBY_SURROUND_MODE_INVALID;
m_AC3Info.centerMixLevel = AUDIO_CENTER_MIX_LEVEL_INVALID; ac3InfoM.centerMixLevel = AUDIO_CENTER_MIX_LEVEL_INVALID;
m_AC3Info.surroundMixLevel = AUDIO_SURROUND_MIX_LEVEL_INVALID; ac3InfoM.surroundMixLevel = AUDIO_SURROUND_MIX_LEVEL_INVALID;
m_AC3Info.dialogLevel = 0; ac3InfoM.dialogLevel = 0;
m_AC3Info.lfe = false; ac3InfoM.lfe = false;
} }
cFemonReceiver::~cFemonReceiver(void) cFemonReceiver::~cFemonReceiver(void)
@ -82,50 +82,50 @@ void cFemonReceiver::Deactivate(void)
{ {
debug("%s()\n", __PRETTY_FUNCTION__); debug("%s()\n", __PRETTY_FUNCTION__);
Detach(); Detach();
if (m_Active) { if (activeM) {
m_Active = false; activeM = false;
m_Sleep.Signal(); sleepM.Signal();
if (Running()) if (Running())
Cancel(3); Cancel(3);
} }
} }
void cFemonReceiver::Activate(bool On) void cFemonReceiver::Activate(bool onP)
{ {
debug("%s(%d)\n", __PRETTY_FUNCTION__, On); debug("%s(%d)\n", __PRETTY_FUNCTION__, onP);
if (On) if (onP)
Start(); Start();
else else
Deactivate(); Deactivate();
} }
void cFemonReceiver::Receive(uchar *Data, int Length) void cFemonReceiver::Receive(uchar *dataP, int lengthP)
{ {
// TS packet length: TS_SIZE // TS packet length: TS_SIZE
if (Running() && (*Data == TS_SYNC_BYTE) && (Length == TS_SIZE)) { if (Running() && (*dataP == TS_SYNC_BYTE) && (lengthP == TS_SIZE)) {
int len, pid = TsPid(Data); int len, pid = TsPid(dataP);
if (pid == m_VideoPid) { if (pid == videoPidM) {
++m_VideoPacketCount; ++videoPacketCountM;
len = m_VideoBuffer.Put(Data, Length); len = videoBufferM.Put(dataP, lengthP);
if (len != Length) { if (len != lengthP) {
m_VideoBuffer.ReportOverflow(Length - len); videoBufferM.ReportOverflow(lengthP - len);
m_VideoBuffer.Clear(); videoBufferM.Clear();
} }
} }
else if (pid == m_AudioPid) { else if (pid == audioPidM) {
++m_AudioPacketCount; ++audioPacketCountM;
len = m_AudioBuffer.Put(Data, Length); len = audioBufferM.Put(dataP, lengthP);
if (len != Length) { if (len != lengthP) {
m_AudioBuffer.ReportOverflow(Length - len); audioBufferM.ReportOverflow(lengthP - len);
m_AudioBuffer.Clear(); audioBufferM.Clear();
} }
} }
else if (pid == m_AC3Pid) { else if (pid == ac3PidM) {
++m_AC3PacketCount; ++ac3PacketCountM;
len = m_AC3Buffer.Put(Data, Length); len = ac3BufferM.Put(dataP, lengthP);
if (len != Length) { if (len != lengthP) {
m_AC3Buffer.ReportOverflow(Length - len); ac3BufferM.ReportOverflow(lengthP - len);
m_AC3Buffer.Clear(); ac3BufferM.Clear();
} }
} }
} }
@ -135,17 +135,17 @@ void cFemonReceiver::Action(void)
{ {
debug("%s()\n", __PRETTY_FUNCTION__); debug("%s()\n", __PRETTY_FUNCTION__);
cTimeMs calcPeriod(0); cTimeMs calcPeriod(0);
m_Active = true; activeM = true;
while (Running() && m_Active) { while (Running() && activeM) {
uint8_t *Data; uint8_t *Data;
double timeout; double timeout;
int len, Length; int len, Length;
bool processed = false; bool processed = false;
// process available video data // process available video data
while ((Data = m_VideoBuffer.Get(Length))) { while ((Data = videoBufferM.Get(Length))) {
if (!m_Active || (Length < TS_SIZE)) if (!activeM || (Length < TS_SIZE))
break; break;
Length = TS_SIZE; Length = TS_SIZE;
if (*Data != TS_SYNC_BYTE) { if (*Data != TS_SYNC_BYTE) {
@ -155,34 +155,34 @@ void cFemonReceiver::Action(void)
break; break;
} }
} }
m_VideoBuffer.Del(Length); videoBufferM.Del(Length);
continue; continue;
} }
processed = true; processed = true;
if (TsPayloadStart(Data)) { if (TsPayloadStart(Data)) {
while (const uint8_t *p = m_VideoAssembler.GetPes(len)) { while (const uint8_t *p = videoAssemblerM.GetPes(len)) {
if (m_VideoType == 0x1B) { // MPEG4 if (videoTypeM == 0x1B) { // MPEG4
if (m_DetectH264.processVideo(p, len)) { if (detectH264M.processVideo(p, len)) {
m_VideoValid = true; videoValidM = true;
break; break;
} }
} }
else { else {
if (m_DetectMPEG.processVideo(p, len)) { if (detectMpegM.processVideo(p, len)) {
m_VideoValid = true; videoValidM = true;
break; break;
} }
} }
} }
m_VideoAssembler.Reset(); videoAssemblerM.Reset();
} }
m_VideoAssembler.PutTs(Data, Length); videoAssemblerM.PutTs(Data, Length);
m_VideoBuffer.Del(Length); videoBufferM.Del(Length);
} }
// process available audio data // process available audio data
while ((Data = m_AudioBuffer.Get(Length))) { while ((Data = audioBufferM.Get(Length))) {
if (!m_Active || (Length < TS_SIZE)) if (!activeM || (Length < TS_SIZE))
break; break;
Length = TS_SIZE; Length = TS_SIZE;
if (*Data != TS_SYNC_BYTE) { if (*Data != TS_SYNC_BYTE) {
@ -192,22 +192,22 @@ void cFemonReceiver::Action(void)
break; break;
} }
} }
m_AudioBuffer.Del(Length); audioBufferM.Del(Length);
continue; continue;
} }
processed = true; processed = true;
if (const uint8_t *p = m_AudioAssembler.GetPes(len)) { if (const uint8_t *p = audioAssemblerM.GetPes(len)) {
if (m_DetectAAC.processAudio(p, len) || m_DetectLATM.processAudio(p, len) || m_DetectMPEG.processAudio(p, len)) if (detectAacM.processAudio(p, len) || detectLatmM.processAudio(p, len) || detectMpegM.processAudio(p, len))
m_AudioValid = true; audioValidM = true;
m_AudioAssembler.Reset(); audioAssemblerM.Reset();
} }
m_AudioAssembler.PutTs(Data, Length); audioAssemblerM.PutTs(Data, Length);
m_AudioBuffer.Del(Length); audioBufferM.Del(Length);
} }
// process available dolby data // process available dolby data
while ((Data = m_AC3Buffer.Get(Length))) { while ((Data = ac3BufferM.Get(Length))) {
if (!m_Active || (Length < TS_SIZE)) if (!activeM || (Length < TS_SIZE))
break; break;
Length = TS_SIZE; Length = TS_SIZE;
if (*Data != TS_SYNC_BYTE) { if (*Data != TS_SYNC_BYTE) {
@ -217,34 +217,34 @@ void cFemonReceiver::Action(void)
break; break;
} }
} }
m_AC3Buffer.Del(Length); ac3BufferM.Del(Length);
continue; continue;
} }
processed = true; processed = true;
if (const uint8_t *p = m_AC3Assembler.GetPes(len)) { if (const uint8_t *p = ac3AssemblerM.GetPes(len)) {
if (m_DetectAC3.processAudio(p, len)) if (detectAc3M.processAudio(p, len))
m_AC3Valid = true; ac3ValidM = true;
m_AC3Assembler.Reset(); ac3AssemblerM.Reset();
} }
m_AC3Assembler.PutTs(Data, Length); ac3AssemblerM.PutTs(Data, Length);
m_AC3Buffer.Del(Length); ac3BufferM.Del(Length);
} }
// calculate bitrates // calculate bitrates
timeout = double(calcPeriod.Elapsed()); timeout = double(calcPeriod.Elapsed());
if (m_Active && (timeout >= (100.0 * femonConfig.calcinterval))) { if (activeM && (timeout >= (100.0 * FemonConfig.calcinterval))) {
// 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!
m_VideoBitrate = (1000.0 * 8.0 * 184.0 * m_VideoPacketCount) / timeout; videoBitRateM = (1000.0 * 8.0 * 184.0 * videoPacketCountM) / timeout;
m_VideoPacketCount = 0; videoPacketCountM = 0;
m_AudioBitrate = (1000.0 * 8.0 * 184.0 * m_AudioPacketCount) / timeout; audioBitRateM = (1000.0 * 8.0 * 184.0 * audioPacketCountM) / timeout;
m_AudioPacketCount = 0; audioPacketCountM = 0;
m_AC3Bitrate = (1000.0 * 8.0 * 184.0 * m_AC3PacketCount) / timeout; ac3BitRateM = (1000.0 * 8.0 * 184.0 * ac3PacketCountM) / timeout;
m_AC3PacketCount = 0; ac3PacketCountM = 0;
calcPeriod.Set(0); calcPeriod.Set(0);
} }
if (!processed) if (!processed)
m_Sleep.Wait(10); // to avoid busy loop and reduce cpu load sleepM.Wait(10); // to avoid busy loop and reduce cpu load
} }
} }

View File

@ -22,156 +22,156 @@
class cFemonReceiver : public cReceiver, public cThread, public cFemonVideoIf, public cFemonAudioIf, public cFemonAC3If { class cFemonReceiver : public cReceiver, public cThread, public cFemonVideoIf, public cFemonAudioIf, public cFemonAC3If {
private: private:
cMutex m_Mutex; cMutex mutexM;
cCondWait m_Sleep; cCondWait sleepM;
bool m_Active; bool activeM;
cFemonH264 m_DetectH264; cFemonH264 detectH264M;
cFemonMPEG m_DetectMPEG; cFemonMPEG detectMpegM;
cFemonAAC m_DetectAAC; cFemonAAC detectAacM;
cFemonLATM m_DetectLATM; cFemonLATM detectLatmM;
cFemonAC3 m_DetectAC3; cFemonAC3 detectAc3M;
cRingBufferLinear m_VideoBuffer; cRingBufferLinear videoBufferM;
cTsToPes m_VideoAssembler; cTsToPes videoAssemblerM;
int m_VideoType; int videoTypeM;
int m_VideoPid; int videoPidM;
int m_VideoPacketCount; int videoPacketCountM;
double m_VideoBitrate; double videoBitRateM;
bool m_VideoValid; bool videoValidM;
video_info_t m_VideoInfo; video_info_t videoInfoM;
cRingBufferLinear m_AudioBuffer; cRingBufferLinear audioBufferM;
cTsToPes m_AudioAssembler; cTsToPes audioAssemblerM;
int m_AudioPid; int audioPidM;
int m_AudioPacketCount; int audioPacketCountM;
double m_AudioBitrate; double audioBitRateM;
bool m_AudioValid; bool audioValidM;
audio_info_t m_AudioInfo; audio_info_t audioInfoM;
cRingBufferLinear m_AC3Buffer; cRingBufferLinear ac3BufferM;
cTsToPes m_AC3Assembler; cTsToPes ac3AssemblerM;
int m_AC3Pid; int ac3PidM;
int m_AC3PacketCount; int ac3PacketCountM;
double m_AC3Bitrate; double ac3BitRateM;
bool m_AC3Valid; bool ac3ValidM;
ac3_info_t m_AC3Info; ac3_info_t ac3InfoM;
protected: protected:
virtual void Activate(bool On); virtual void Activate(bool onP);
virtual void Receive(uchar *Data, int Length); virtual void Receive(uchar *dataP, int lengthP);
virtual void Action(void); virtual void Action(void);
public: public:
virtual void SetVideoCodec(eVideoCodec codec) { cMutexLock MutexLock(&m_Mutex); virtual void SetVideoCodec(eVideoCodec codecP) { cMutexLock MutexLock(&mutexM);
m_VideoInfo.codec = codec; } videoInfoM.codec = codecP; }
virtual void SetVideoFormat(eVideoFormat format) { cMutexLock MutexLock(&m_Mutex); virtual void SetVideoFormat(eVideoFormat formatP) { cMutexLock MutexLock(&mutexM);
m_VideoInfo.format = format; } videoInfoM.format = formatP; }
virtual void SetVideoScan(eVideoScan scan) { cMutexLock MutexLock(&m_Mutex); virtual void SetVideoScan(eVideoScan scanP) { cMutexLock MutexLock(&mutexM);
m_VideoInfo.scan = scan; } videoInfoM.scan = scanP; }
virtual void SetVideoAspectRatio(eVideoAspectRatio aspectratio) { cMutexLock MutexLock(&m_Mutex); virtual void SetVideoAspectRatio(eVideoAspectRatio aspectRatioP) { cMutexLock MutexLock(&mutexM);
m_VideoInfo.aspectRatio = aspectratio; } videoInfoM.aspectRatio = aspectRatioP; }
virtual void SetVideoSize(int width, int height) { cMutexLock MutexLock(&m_Mutex); virtual void SetVideoSize(int widthP, int heightP) { cMutexLock MutexLock(&mutexM);
m_VideoInfo.width = width; videoInfoM.width = widthP;
m_VideoInfo.height = height; } videoInfoM.height = heightP; }
virtual void SetVideoFramerate(double framerate) { cMutexLock MutexLock(&m_Mutex); virtual void SetVideoFramerate(double frameRateP) { cMutexLock MutexLock(&mutexM);
m_VideoInfo.frameRate = framerate; } videoInfoM.frameRate = frameRateP; }
virtual void SetVideoBitrate(double bitrate) { cMutexLock MutexLock(&m_Mutex); virtual void SetVideoBitrate(double bitRateP) { cMutexLock MutexLock(&mutexM);
m_VideoInfo.bitrate = bitrate; } videoInfoM.bitrate = bitRateP; }
virtual void SetAudioCodec(eAudioCodec codec) { cMutexLock MutexLock(&m_Mutex); virtual void SetAudioCodec(eAudioCodec codecP) { cMutexLock MutexLock(&mutexM);
m_AudioInfo.codec = codec; } audioInfoM.codec = codecP; }
virtual void SetAudioBitrate(double bitrate) { cMutexLock MutexLock(&m_Mutex); virtual void SetAudioBitrate(double bitRateP) { cMutexLock MutexLock(&mutexM);
m_AudioInfo.bitrate = bitrate; } audioInfoM.bitrate = bitRateP; }
virtual void SetAudioSamplingFrequency(int sampling) { cMutexLock MutexLock(&m_Mutex); virtual void SetAudioSamplingFrequency(int samplingP) { cMutexLock MutexLock(&mutexM);
m_AudioInfo.samplingFrequency = sampling; } audioInfoM.samplingFrequency = samplingP; }
virtual void SetAudioChannel(eAudioChannelMode mode) { cMutexLock MutexLock(&m_Mutex); virtual void SetAudioChannel(eAudioChannelMode modeP) { cMutexLock MutexLock(&mutexM);
m_AudioInfo.channelMode = mode; } audioInfoM.channelMode = modeP; }
virtual void SetAC3Bitrate(int bitrate) { cMutexLock MutexLock(&m_Mutex); virtual void SetAC3Bitrate(int bitRateP) { cMutexLock MutexLock(&mutexM);
m_AC3Info.bitrate = bitrate; } ac3InfoM.bitrate = bitRateP; }
virtual void SetAC3SamplingFrequency(int sampling) { cMutexLock MutexLock(&m_Mutex); virtual void SetAC3SamplingFrequency(int samplingP) { cMutexLock MutexLock(&mutexM);
m_AC3Info.samplingFrequency = sampling; } ac3InfoM.samplingFrequency = samplingP; }
virtual void SetAC3Bitstream(int mode) { cMutexLock MutexLock(&m_Mutex); virtual void SetAC3Bitstream(int modeP) { cMutexLock MutexLock(&mutexM);
m_AC3Info.bitstreamMode = mode; } ac3InfoM.bitstreamMode = modeP; }
virtual void SetAC3AudioCoding(int mode) { cMutexLock MutexLock(&m_Mutex); virtual void SetAC3AudioCoding(int modeP) { cMutexLock MutexLock(&mutexM);
m_AC3Info.audioCodingMode = mode; } ac3InfoM.audioCodingMode = modeP; }
virtual void SetAC3DolbySurround(int mode) { cMutexLock MutexLock(&m_Mutex); virtual void SetAC3DolbySurround(int modeP) { cMutexLock MutexLock(&mutexM);
m_AC3Info.dolbySurroundMode = mode; } ac3InfoM.dolbySurroundMode = modeP; }
virtual void SetAC3CenterMix(int level) { cMutexLock MutexLock(&m_Mutex); virtual void SetAC3CenterMix(int levelP) { cMutexLock MutexLock(&mutexM);
m_AC3Info.centerMixLevel = level; } ac3InfoM.centerMixLevel = levelP; }
virtual void SetAC3SurroundMix(int level) { cMutexLock MutexLock(&m_Mutex); virtual void SetAC3SurroundMix(int levelP) { cMutexLock MutexLock(&mutexM);
m_AC3Info.surroundMixLevel = level; } ac3InfoM.surroundMixLevel = levelP; }
virtual void SetAC3Dialog(int level) { cMutexLock MutexLock(&m_Mutex); virtual void SetAC3Dialog(int levelP) { cMutexLock MutexLock(&mutexM);
m_AC3Info.dialogLevel = level; } ac3InfoM.dialogLevel = levelP; }
virtual void SetAC3LFE(bool onoff) { cMutexLock MutexLock(&m_Mutex); virtual void SetAC3LFE(bool onoffP) { cMutexLock MutexLock(&mutexM);
m_AC3Info.lfe = onoff; } ac3InfoM.lfe = onoffP; }
public: public:
cFemonReceiver(const cChannel* Channel, int ATrack, int DTrack); cFemonReceiver(const cChannel* channelP, int aTrackp, int dTrackP);
virtual ~cFemonReceiver(); virtual ~cFemonReceiver();
void Deactivate(void); void Deactivate(void);
bool VideoValid(void) { cMutexLock MutexLock(&m_Mutex); bool VideoValid(void) { cMutexLock MutexLock(&mutexM);
return m_VideoValid; }; // boolean return videoValidM; }; // boolean
double VideoBitrate(void) { cMutexLock MutexLock(&m_Mutex); double VideoBitrate(void) { cMutexLock MutexLock(&mutexM);
return m_VideoBitrate; }; // bit/s return videoBitRateM; }; // bit/s
int VideoCodec(void) { cMutexLock MutexLock(&m_Mutex); int VideoCodec(void) { cMutexLock MutexLock(&mutexM);
return m_VideoInfo.codec; }; // eVideoCodec return videoInfoM.codec; }; // eVideoCodec
int VideoFormat(void) { cMutexLock MutexLock(&m_Mutex); int VideoFormat(void) { cMutexLock MutexLock(&mutexM);
return m_VideoInfo.format; }; // eVideoFormat return videoInfoM.format; }; // eVideoFormat
int VideoScan(void) { cMutexLock MutexLock(&m_Mutex); int VideoScan(void) { cMutexLock MutexLock(&mutexM);
return m_VideoInfo.scan; }; // eVideoScan return videoInfoM.scan; }; // eVideoScan
int VideoAspectRatio(void) { cMutexLock MutexLock(&m_Mutex); int VideoAspectRatio(void) { cMutexLock MutexLock(&mutexM);
return m_VideoInfo.aspectRatio; }; // eVideoAspectRatio return videoInfoM.aspectRatio; }; // eVideoAspectRatio
int VideoHorizontalSize(void) { cMutexLock MutexLock(&m_Mutex); int VideoHorizontalSize(void) { cMutexLock MutexLock(&mutexM);
return m_VideoInfo.width; }; // pixels return videoInfoM.width; }; // pixels
int VideoVerticalSize(void) { cMutexLock MutexLock(&m_Mutex); int VideoVerticalSize(void) { cMutexLock MutexLock(&mutexM);
return m_VideoInfo.height; }; // pixels return videoInfoM.height; }; // pixels
double VideoFrameRate(void) { cMutexLock MutexLock(&m_Mutex); double VideoFrameRate(void) { cMutexLock MutexLock(&mutexM);
return m_VideoInfo.frameRate; }; // Hz return videoInfoM.frameRate; }; // Hz
double VideoStreamBitrate(void) { cMutexLock MutexLock(&m_Mutex); double VideoStreamBitrate(void) { cMutexLock MutexLock(&mutexM);
return m_VideoInfo.bitrate; }; // bit/s return videoInfoM.bitrate; }; // bit/s
bool AudioValid(void) { cMutexLock MutexLock(&m_Mutex); bool AudioValid(void) { cMutexLock MutexLock(&mutexM);
return m_AudioValid; }; // boolean return audioValidM; }; // boolean
double AudioBitrate(void) { cMutexLock MutexLock(&m_Mutex); double AudioBitrate(void) { cMutexLock MutexLock(&mutexM);
return m_AudioBitrate; }; // bit/s return audioBitRateM; }; // bit/s
int AudioCodec(void) { cMutexLock MutexLock(&m_Mutex); int AudioCodec(void) { cMutexLock MutexLock(&mutexM);
return m_AudioInfo.codec; }; // eAudioCodec return audioInfoM.codec; }; // eAudioCodec
int AudioChannelMode(void) { cMutexLock MutexLock(&m_Mutex); int AudioChannelMode(void) { cMutexLock MutexLock(&mutexM);
return m_AudioInfo.channelMode; }; // eAudioChannelMode return audioInfoM.channelMode; }; // eAudioChannelMode
double AudioStreamBitrate(void) { cMutexLock MutexLock(&m_Mutex); double AudioStreamBitrate(void) { cMutexLock MutexLock(&mutexM);
return m_AudioInfo.bitrate; }; // bit/s or eAudioBitrate return audioInfoM.bitrate; }; // bit/s or eAudioBitrate
int AudioSamplingFreq(void) { cMutexLock MutexLock(&m_Mutex); int AudioSamplingFreq(void) { cMutexLock MutexLock(&mutexM);
return m_AudioInfo.samplingFrequency; }; // Hz or eAudioSamplingFrequency return audioInfoM.samplingFrequency; }; // Hz or eAudioSamplingFrequency
bool AC3Valid(void) { cMutexLock MutexLock(&m_Mutex); bool AC3Valid(void) { cMutexLock MutexLock(&mutexM);
return m_AC3Valid; }; // boolean return ac3ValidM; }; // boolean
double AC3Bitrate(void) { cMutexLock MutexLock(&m_Mutex); double AC3Bitrate(void) { cMutexLock MutexLock(&mutexM);
return m_AC3Bitrate; }; // bit/s return ac3BitRateM; }; // bit/s
double AC3StreamBitrate(void) { cMutexLock MutexLock(&m_Mutex); double AC3StreamBitrate(void) { cMutexLock MutexLock(&mutexM);
return m_AC3Info.bitrate; }; // bit/s or eAudioBitrate return ac3InfoM.bitrate; }; // bit/s or eAudioBitrate
int AC3SamplingFreq(void) { cMutexLock MutexLock(&m_Mutex); int AC3SamplingFreq(void) { cMutexLock MutexLock(&mutexM);
return m_AC3Info.samplingFrequency; }; // Hz or eAudioSamplingFrequency return ac3InfoM.samplingFrequency; }; // Hz or eAudioSamplingFrequency
int AC3BitStreamMode(void) { cMutexLock MutexLock(&m_Mutex); int AC3BitStreamMode(void) { cMutexLock MutexLock(&mutexM);
return m_AC3Info.bitstreamMode; }; // 0..7 or eAudioBitstreamMode return ac3InfoM.bitstreamMode; }; // 0..7 or eAudioBitstreamMode
int AC3AudioCodingMode(void) { cMutexLock MutexLock(&m_Mutex); int AC3AudioCodingMode(void) { cMutexLock MutexLock(&mutexM);
return m_AC3Info.audioCodingMode; }; // 0..7 or eAudioCodingMode return ac3InfoM.audioCodingMode; }; // 0..7 or eAudioCodingMode
bool AC3_2_0(void) { cMutexLock MutexLock(&m_Mutex); bool AC3_2_0(void) { cMutexLock MutexLock(&mutexM);
return (m_AC3Info.audioCodingMode == AUDIO_CODING_MODE_2_0); }; // boolean return (ac3InfoM.audioCodingMode == AUDIO_CODING_MODE_2_0); }; // boolean
bool AC3_5_1(void) { cMutexLock MutexLock(&m_Mutex); bool AC3_5_1(void) { cMutexLock MutexLock(&mutexM);
return (m_AC3Info.audioCodingMode == AUDIO_CODING_MODE_3_2); }; // boolean return (ac3InfoM.audioCodingMode == AUDIO_CODING_MODE_3_2); }; // boolean
int AC3DolbySurroundMode(void) { cMutexLock MutexLock(&m_Mutex); int AC3DolbySurroundMode(void) { cMutexLock MutexLock(&mutexM);
return m_AC3Info.dolbySurroundMode; }; // eAudioDolbySurroundMode return ac3InfoM.dolbySurroundMode; }; // eAudioDolbySurroundMode
int AC3CenterMixLevel(void) { cMutexLock MutexLock(&m_Mutex); int AC3CenterMixLevel(void) { cMutexLock MutexLock(&mutexM);
return m_AC3Info.centerMixLevel; }; // eAudioCenterMixLevel return ac3InfoM.centerMixLevel; }; // eAudioCenterMixLevel
int AC3SurroundMixLevel(void) { cMutexLock MutexLock(&m_Mutex); int AC3SurroundMixLevel(void) { cMutexLock MutexLock(&mutexM);
return m_AC3Info.surroundMixLevel; }; // eAudioSurroundMixLevel return ac3InfoM.surroundMixLevel; }; // eAudioSurroundMixLevel
int AC3DialogLevel(void) { cMutexLock MutexLock(&m_Mutex); int AC3DialogLevel(void) { cMutexLock MutexLock(&mutexM);
return m_AC3Info.dialogLevel; }; // -dB return ac3InfoM.dialogLevel; }; // -dB
bool AC3Lfe(void) { cMutexLock MutexLock(&m_Mutex); bool AC3Lfe(void) { cMutexLock MutexLock(&mutexM);
return m_AC3Info.lfe; }; // boolean return ac3InfoM.lfe; }; // boolean
}; };
#endif //__FEMONRECEIVER_H #endif //__FEMONRECEIVER_H

View File

@ -19,88 +19,88 @@
#include "femonosd.h" #include "femonosd.h"
#include "femontools.h" #include "femontools.h"
static cString getCA(int value) static cString getCA(int valueP)
{ {
// http://www.dvb.org/index.php?id=174 // http://www.dvb.org/index.php?id=174
// http://en.wikipedia.org/wiki/Conditional_access_system // http://en.wikipedia.org/wiki/Conditional_access_system
switch (value) { switch (valueP) {
case 0x0000: return cString::sprintf("%s (%X)", trVDR("Free To Air"), value); // Reserved case 0x0000: return cString::sprintf("%s (%X)", trVDR("Free To Air"), valueP); // Reserved
case 0x0001 ... 0x009F: case 0x0001 ... 0x009F:
case 0x00A2 ... 0x00FF: return cString::sprintf("%s (%X)", tr("Fixed"), value); // Standardized systems case 0x00A2 ... 0x00FF: return cString::sprintf("%s (%X)", tr("Fixed"), valueP); // Standardized systems
case 0x00A0 ... 0x00A1: return cString::sprintf("%s (%X)", tr("Analog"), value); // Analog signals case 0x00A0 ... 0x00A1: return cString::sprintf("%s (%X)", tr("Analog"), valueP); // Analog signals
case 0x0100 ... 0x01FF: return cString::sprintf("SECA Mediaguard (%X)", value); // Canal Plus case 0x0100 ... 0x01FF: return cString::sprintf("SECA Mediaguard (%X)", valueP); // Canal Plus
case 0x0464: return cString::sprintf("EuroDec (%X)", value); // EuroDec case 0x0464: return cString::sprintf("EuroDec (%X)", valueP); // EuroDec
case 0x0500 ... 0x05FF: return cString::sprintf("Viaccess (%X)", value); // France Telecom case 0x0500 ... 0x05FF: return cString::sprintf("Viaccess (%X)", valueP); // France Telecom
case 0x0600 ... 0x06FF: return cString::sprintf("Irdeto (%X)", value); // Irdeto case 0x0600 ... 0x06FF: return cString::sprintf("Irdeto (%X)", valueP); // Irdeto
case 0x0700 ... 0x07FF: return cString::sprintf("DigiCipher 2 (%X)", value); // Jerrold/GI/Motorola 4DTV case 0x0700 ... 0x07FF: return cString::sprintf("DigiCipher 2 (%X)", valueP); // Jerrold/GI/Motorola 4DTV
case 0x0900 ... 0x09FF: return cString::sprintf("NDS Videoguard (%X)", value); // NDS case 0x0900 ... 0x09FF: return cString::sprintf("NDS Videoguard (%X)", valueP); // NDS
case 0x0B00 ... 0x0BFF: return cString::sprintf("Conax (%X)", value); // Norwegian Telekom case 0x0B00 ... 0x0BFF: return cString::sprintf("Conax (%X)", valueP); // Norwegian Telekom
case 0x0D00 ... 0x0DFF: return cString::sprintf("CryptoWorks (%X)", value); // Philips CryptoTec case 0x0D00 ... 0x0DFF: return cString::sprintf("CryptoWorks (%X)", valueP); // Philips CryptoTec
case 0x0E00 ... 0x0EFF: return cString::sprintf("PowerVu (%X)", value); // Scientific Atlanta case 0x0E00 ... 0x0EFF: return cString::sprintf("PowerVu (%X)", valueP); // Scientific Atlanta
case 0x1000: return cString::sprintf("RAS (%X)", value); // Tandberg Television case 0x1000: return cString::sprintf("RAS (%X)", valueP); // Tandberg Television
case 0x1200 ... 0x12FF: return cString::sprintf("NagraVision (%X)", value); // BellVu Express case 0x1200 ... 0x12FF: return cString::sprintf("NagraVision (%X)", valueP); // BellVu Express
case 0x1700 ... 0x17FF: return cString::sprintf("VCAS (%X)", value); // Verimatrix Inc. former BetaTechnik case 0x1700 ... 0x17FF: return cString::sprintf("VCAS (%X)", valueP); // Verimatrix Inc. former BetaTechnik
case 0x1800 ... 0x18FF: return cString::sprintf("NagraVision (%X)", value); // Kudelski SA case 0x1800 ... 0x18FF: return cString::sprintf("NagraVision (%X)", valueP); // Kudelski SA
case 0x22F0: return cString::sprintf("Codicrypt (%X)", value); // Scopus Network Technologies case 0x22F0: return cString::sprintf("Codicrypt (%X)", valueP); // Scopus Network Technologies
case 0x2600: return cString::sprintf("BISS (%X)", value); // European Broadcasting Union case 0x2600: return cString::sprintf("BISS (%X)", valueP); // European Broadcasting Union
case 0x2719: return cString::sprintf("VanyaCas (%X)", value); // S-Curious Research & Technology Pvt. Ltd. case 0x2719: return cString::sprintf("VanyaCas (%X)", valueP); // S-Curious Research & Technology Pvt. Ltd.
case 0x4347: return cString::sprintf("CryptOn (%X)", value); // CryptOn case 0x4347: return cString::sprintf("CryptOn (%X)", valueP); // CryptOn
case 0x4800: return cString::sprintf("Accessgate (%X)", value); // Telemann case 0x4800: return cString::sprintf("Accessgate (%X)", valueP); // Telemann
case 0x4900: return cString::sprintf("China Crypt (%X)", value); // CryptoWorks case 0x4900: return cString::sprintf("China Crypt (%X)", valueP); // CryptoWorks
case 0x4A02: return cString::sprintf("Tongfang (%X)", value); // Tsinghua Tongfang Company case 0x4A02: return cString::sprintf("Tongfang (%X)", valueP); // Tsinghua Tongfang Company
case 0x4A10: return cString::sprintf("EasyCas (%X)", value); // EasyCas case 0x4A10: return cString::sprintf("EasyCas (%X)", valueP); // EasyCas
case 0x4A20: return cString::sprintf("AlphaCrypt (%X)", value); // AlphaCrypt case 0x4A20: return cString::sprintf("AlphaCrypt (%X)", valueP); // AlphaCrypt
case 0x4A60: return cString::sprintf("SkyCrypt (%X)", value); // @Sky case 0x4A60: return cString::sprintf("SkyCrypt (%X)", valueP); // @Sky
case 0x4A61: return cString::sprintf("Neotioncrypt (%X)", value); // Neotion case 0x4A61: return cString::sprintf("Neotioncrypt (%X)", valueP); // Neotion
case 0x4A62: return cString::sprintf("SkyCrypt (%X)", value); // @Sky case 0x4A62: return cString::sprintf("SkyCrypt (%X)", valueP); // @Sky
case 0x4A63: return cString::sprintf("Neotion SHL (%X)", value); // Neotion case 0x4A63: return cString::sprintf("Neotion SHL (%X)", valueP); // Neotion
case 0x4A64 ... 0x4A6F: return cString::sprintf("SkyCrypt (%X)", value); // @Sky case 0x4A64 ... 0x4A6F: return cString::sprintf("SkyCrypt (%X)", valueP); // @Sky
case 0x4A70: return cString::sprintf("DreamCrypt (%X)", value); // Dream Multimedia case 0x4A70: return cString::sprintf("DreamCrypt (%X)", valueP); // Dream Multimedia
case 0x4A80: return cString::sprintf("ThalesCrypt (%X)", value); // Thales Broadcast & Multimedia case 0x4A80: return cString::sprintf("ThalesCrypt (%X)", valueP); // Thales Broadcast & Multimedia
case 0x4AA1: return cString::sprintf("KeyFly (%X)", value); // SIDSA case 0x4AA1: return cString::sprintf("KeyFly (%X)", valueP); // SIDSA
case 0x4ABF: return cString::sprintf("CTI-CAS (%X)", value); // Beijing Compunicate Technology Inc. case 0x4ABF: return cString::sprintf("CTI-CAS (%X)", valueP); // Beijing Compunicate Technology Inc.
case 0x4AC1: return cString::sprintf("Latens (%X)", value); // Latens Systems case 0x4AC1: return cString::sprintf("Latens (%X)", valueP); // Latens Systems
case 0x4AD0 ... 0x4AD1: return cString::sprintf("X-Crypt (%X)", value); // XCrypt Inc. case 0x4AD0 ... 0x4AD1: return cString::sprintf("X-Crypt (%X)", valueP); // XCrypt Inc.
case 0x4AD4: return cString::sprintf("OmniCrypt (%X)", value); // Widevine Technologies, Inc. case 0x4AD4: return cString::sprintf("OmniCrypt (%X)", valueP); // Widevine Technologies, Inc.
case 0x4AE0 ... 0x4AE1: return cString::sprintf("Z-Crypt (%X)", value); // Digi Raum Electronics Co. Ltd. case 0x4AE0 ... 0x4AE1: return cString::sprintf("Z-Crypt (%X)", valueP); // Digi Raum Electronics Co. Ltd.
case 0x4AE4: return cString::sprintf("CoreCrypt (%X)", value); // CoreTrust case 0x4AE4: return cString::sprintf("CoreCrypt (%X)", valueP); // CoreTrust
case 0x4AE5: return cString::sprintf("PRO-Crypt (%X)", value); // IK SATPROF case 0x4AE5: return cString::sprintf("PRO-Crypt (%X)", valueP); // IK SATPROF
case 0x4AEA: return cString::sprintf("Cryptoguard (%X)", value); // Gryptoguard AB case 0x4AEA: return cString::sprintf("Cryptoguard (%X)", valueP); // Gryptoguard AB
case 0x4AEB: return cString::sprintf("Abel Quintic (%X)", value); // Abel DRM Systems case 0x4AEB: return cString::sprintf("Abel Quintic (%X)", valueP); // Abel DRM Systems
case 0x4AF0: return cString::sprintf("ABV (%X)", value); // Alliance Broadcast Vision case 0x4AF0: return cString::sprintf("ABV (%X)", valueP); // Alliance Broadcast Vision
case 0x5500: return cString::sprintf("Z-Crypt (%X)", value); // Digi Raum Electronics Co. Ltd. case 0x5500: return cString::sprintf("Z-Crypt (%X)", valueP); // Digi Raum Electronics Co. Ltd.
case 0x5501: return cString::sprintf("Griffin (%X)", value); // Nucleus Systems Ltd. case 0x5501: return cString::sprintf("Griffin (%X)", valueP); // Nucleus Systems Ltd.
case 0x5581: return cString::sprintf("Bulcrypt (%X)", value); // Bulcrypt case 0x5581: return cString::sprintf("Bulcrypt (%X)", valueP); // Bulcrypt
case 0x7BE1: return cString::sprintf("DRE-Crypt (%X)", value); // DRE-Crypt case 0x7BE1: return cString::sprintf("DRE-Crypt (%X)", valueP); // DRE-Crypt
case 0xA101: return cString::sprintf("RosCrypt-M (%X)", value); // NIIR case 0xA101: return cString::sprintf("RosCrypt-M (%X)", valueP); // NIIR
case 0xEAD0: return cString::sprintf("VanyaCas (%X)", value); // S-Curious Research & Technology Pvt. Ltd. case 0xEAD0: return cString::sprintf("VanyaCas (%X)", valueP); // S-Curious Research & Technology Pvt. Ltd.
default: break; default: break;
} }
return cString::sprintf("%X", value); return cString::sprintf("%X", valueP);
} }
static const char *getUserString(int Value, const tDvbParameterMap *Map) static const char *getUserString(int valueP, const tDvbParameterMap *mapP)
{ {
const tDvbParameterMap *map = Map; const tDvbParameterMap *map = mapP;
while (map && map->userValue != -1) { while (map && map->userValue != -1) {
if (map->driverValue == Value) if (map->driverValue == valueP)
return map->userString ? trVDR(map->userString) : "---"; return map->userString ? trVDR(map->userString) : "---";
map++; map++;
} }
return "---"; return "---";
} }
cDvbDevice *getDvbDevice(cDevice* device) cDvbDevice *getDvbDevice(cDevice* deviceP)
{ {
cDvbDevice *dev = dynamic_cast<cDvbDevice*>(device); cDvbDevice *dev = dynamic_cast<cDvbDevice*>(deviceP);
#ifdef __DYNAMIC_DEVICE_PROBE #ifdef __DYNAMIC_DEVICE_PROBE
if (!dev && device && device->HasSubDevice()) if (!dev && deviceP && deviceP->HasSubDevice())
dev = dynamic_cast<cDvbDevice*>(device->SubDevice()); dev = dynamic_cast<cDvbDevice*>(deviceP->SubDevice());
#endif #endif
return dev; return dev;
} }
cString getFrontendInfo(cDvbDevice *device) cString getFrontendInfo(cDvbDevice *deviceP)
{ {
struct dvb_frontend_info value; struct dvb_frontend_info value;
fe_status_t status; fe_status_t status;
@ -111,17 +111,17 @@ cString getFrontendInfo(cDvbDevice *device)
uint32_t unc = 0; uint32_t unc = 0;
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
if (!device) if (!deviceP)
return info; return info;
int fe = open(*cString::sprintf(FRONTEND_DEVICE, device->Adapter(), device->Frontend()), O_RDONLY | O_NONBLOCK); int fe = open(*cString::sprintf(FRONTEND_DEVICE, deviceP->Adapter(), deviceP->Frontend()), O_RDONLY | O_NONBLOCK);
if (fe < 0) if (fe < 0)
return info; return info;
info = cString::sprintf("CARD:%d\nSTRG:%d\nQUAL:%d", device->CardIndex(), device->SignalStrength(), device->SignalQuality()); info = cString::sprintf("CARD:%d\nSTRG:%d\nQUAL:%d", deviceP->CardIndex(), deviceP->SignalStrength(), deviceP->SignalQuality());
if (ioctl(fe, FE_GET_INFO, &value) >= 0) if (ioctl(fe, FE_GET_INFO, &value) >= 0)
info = cString::sprintf("%s\nTYPE:%d\nNAME:%s", *info, value.type, *device->DeviceName()); info = cString::sprintf("%s\nTYPE:%d\nNAME:%s", *info, value.type, *deviceP->DeviceName());
if (ioctl(fe, FE_READ_STATUS, &status) >= 0) if (ioctl(fe, FE_READ_STATUS, &status) >= 0)
info = cString::sprintf("%s\nSTAT:%02X", *info, status); info = cString::sprintf("%s\nSTAT:%02X", *info, status);
if (ioctl(fe, FE_READ_SIGNAL_STRENGTH, &signal) >= 0) if (ioctl(fe, FE_READ_SIGNAL_STRENGTH, &signal) >= 0)
@ -143,39 +143,39 @@ cString getFrontendInfo(cDvbDevice *device)
return info; return info;
} }
cString getFrontendName(cDvbDevice *device) cString getFrontendName(cDvbDevice *deviceP)
{ {
if (!device) if (!deviceP)
return NULL; return NULL;
return (cString::sprintf("%s on device #%d", *device->DeviceName(), device->CardIndex())); return (cString::sprintf("%s on deviceP #%d", *deviceP->DeviceName(), deviceP->CardIndex()));
} }
cString getFrontendStatus(cDvbDevice *device) cString getFrontendStatus(cDvbDevice *deviceP)
{ {
fe_status_t value; fe_status_t value;
if (!device) if (!deviceP)
return NULL; return NULL;
int fe = open(*cString::sprintf(FRONTEND_DEVICE, device->Adapter(), device->Frontend()), O_RDONLY | O_NONBLOCK); int fe = open(*cString::sprintf(FRONTEND_DEVICE, deviceP->Adapter(), deviceP->Frontend()), O_RDONLY | O_NONBLOCK);
if (fe < 0) if (fe < 0)
return NULL; return NULL;
memset(&value, 0, sizeof(value)); memset(&value, 0, sizeof(value));
ioctl(fe, FE_READ_STATUS, &value); ioctl(fe, FE_READ_STATUS, &value);
close(fe); close(fe);
return (cString::sprintf("Status %s:%s:%s:%s:%s on device #%d", (value & FE_HAS_LOCK) ? "LOCKED" : "-", (value & FE_HAS_SIGNAL) ? "SIGNAL" : "-", (value & FE_HAS_CARRIER) ? "CARRIER" : "-", (value & FE_HAS_VITERBI) ? "VITERBI" : "-", (value & FE_HAS_SYNC) ? "SYNC" : "-", device->CardIndex())); return (cString::sprintf("Status %s:%s:%s:%s:%s on deviceP #%d", (value & FE_HAS_LOCK) ? "LOCKED" : "-", (value & FE_HAS_SIGNAL) ? "SIGNAL" : "-", (value & FE_HAS_CARRIER) ? "CARRIER" : "-", (value & FE_HAS_VITERBI) ? "VITERBI" : "-", (value & FE_HAS_SYNC) ? "SYNC" : "-", deviceP->CardIndex()));
} }
uint16_t getSignal(cDvbDevice *device) uint16_t getSignal(cDvbDevice *deviceP)
{ {
uint16_t value = 0; uint16_t value = 0;
if (!device) if (!deviceP)
return (value); return (value);
int fe = open(*cString::sprintf(FRONTEND_DEVICE, device->Adapter(), device->Frontend()), O_RDONLY | O_NONBLOCK); int fe = open(*cString::sprintf(FRONTEND_DEVICE, deviceP->Adapter(), deviceP->Frontend()), O_RDONLY | O_NONBLOCK);
if (fe < 0) if (fe < 0)
return (value); return (value);
ioctl(fe, FE_READ_SIGNAL_STRENGTH, &value); ioctl(fe, FE_READ_SIGNAL_STRENGTH, &value);
@ -184,14 +184,14 @@ uint16_t getSignal(cDvbDevice *device)
return (value); return (value);
} }
uint16_t getSNR(cDvbDevice *device) uint16_t getSNR(cDvbDevice *deviceP)
{ {
uint16_t value = 0; uint16_t value = 0;
if (!device) if (!deviceP)
return (value); return (value);
int fe = open(*cString::sprintf(FRONTEND_DEVICE, device->Adapter(), device->Frontend()), O_RDONLY | O_NONBLOCK); int fe = open(*cString::sprintf(FRONTEND_DEVICE, deviceP->Adapter(), deviceP->Frontend()), O_RDONLY | O_NONBLOCK);
if (fe < 0) if (fe < 0)
return (value); return (value);
ioctl(fe, FE_READ_SNR, &value); ioctl(fe, FE_READ_SNR, &value);
@ -200,14 +200,14 @@ uint16_t getSNR(cDvbDevice *device)
return (value); return (value);
} }
uint32_t getBER(cDvbDevice *device) uint32_t getBER(cDvbDevice *deviceP)
{ {
uint32_t value = 0; uint32_t value = 0;
if (!device) if (!deviceP)
return (value); return (value);
int fe = open(*cString::sprintf(FRONTEND_DEVICE, device->Adapter(), device->Frontend()), O_RDONLY | O_NONBLOCK); int fe = open(*cString::sprintf(FRONTEND_DEVICE, deviceP->Adapter(), deviceP->Frontend()), O_RDONLY | O_NONBLOCK);
if (fe < 0) if (fe < 0)
return (value); return (value);
ioctl(fe, FE_READ_BER, &value); ioctl(fe, FE_READ_BER, &value);
@ -216,14 +216,14 @@ uint32_t getBER(cDvbDevice *device)
return (value); return (value);
} }
uint32_t getUNC(cDvbDevice *device) uint32_t getUNC(cDvbDevice *deviceP)
{ {
uint32_t value = 0; uint32_t value = 0;
if (!device) if (!deviceP)
return (value); return (value);
int fe = open(*cString::sprintf(FRONTEND_DEVICE, device->Adapter(), device->Frontend()), O_RDONLY | O_NONBLOCK); int fe = open(*cString::sprintf(FRONTEND_DEVICE, deviceP->Adapter(), deviceP->Frontend()), O_RDONLY | O_NONBLOCK);
if (fe < 0) if (fe < 0)
return (value); return (value);
ioctl(fe, FE_READ_UNCORRECTED_BLOCKS, &value); ioctl(fe, FE_READ_UNCORRECTED_BLOCKS, &value);
@ -232,39 +232,39 @@ uint32_t getUNC(cDvbDevice *device)
return (value); return (value);
} }
cString getApids(const cChannel *channel) cString getApids(const cChannel *channelP)
{ {
int value = 0; int value = 0;
cString apids = cString::sprintf("%d", channel->Apid(value)); cString apids = cString::sprintf("%d", channelP->Apid(value));
while (channel->Apid(++value) && (value < MAXAPIDS)) while (channelP->Apid(++value) && (value < MAXAPIDS))
apids = cString::sprintf("%s, %d", *apids, channel->Apid(value)); apids = cString::sprintf("%s, %d", *apids, channelP->Apid(value));
return apids; return apids;
} }
cString getDpids(const cChannel *channel) cString getDpids(const cChannel *channelP)
{ {
int value = 0; int value = 0;
cString dpids = cString::sprintf("%d", channel->Dpid(value)); cString dpids = cString::sprintf("%d", channelP->Dpid(value));
while (channel->Dpid(++value) && (value < MAXDPIDS)) while (channelP->Dpid(++value) && (value < MAXDPIDS))
dpids = cString::sprintf("%s, %d", *dpids, channel->Dpid(value)); dpids = cString::sprintf("%s, %d", *dpids, channelP->Dpid(value));
return dpids; return dpids;
} }
cString getSpids(const cChannel *channel) cString getSpids(const cChannel *channelP)
{ {
int value = 0; int value = 0;
cString spids = cString::sprintf("%d", channel->Spid(value)); cString spids = cString::sprintf("%d", channelP->Spid(value));
while (channel->Spid(++value) && (value < MAXSPIDS)) while (channelP->Spid(++value) && (value < MAXSPIDS))
spids = cString::sprintf("%s, %d", *spids, channel->Spid(value)); spids = cString::sprintf("%s, %d", *spids, channelP->Spid(value));
return spids; return spids;
} }
cString getCAids(const cChannel *channel) cString getCAids(const cChannel *channelP)
{ {
int value = 0; int value = 0;
cString caids = cString::sprintf("%s", *getCA(channel->Ca(value))); cString caids = cString::sprintf("%s", *getCA(channelP->Ca(value)));
while (channel->Ca(++value) && (value < MAXCAIDS)) while (channelP->Ca(++value) && (value < MAXCAIDS))
caids = cString::sprintf("%s, %s", *caids, *getCA(channel->Ca(value))); caids = cString::sprintf("%s, %s", *caids, *getCA(channelP->Ca(value)));
return caids; return caids;
} }
@ -275,37 +275,37 @@ cString getVideoStream(int value)
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getAudioStream(int value, const cChannel *channel) cString getAudioStream(int valueP, const cChannel *channelP)
{ {
int pid = 0; int pid = 0;
if (IS_AUDIO_TRACK(value)) if (IS_AUDIO_TRACK(valueP))
pid = int(value - ttAudioFirst); pid = int(valueP - ttAudioFirst);
if (channel && channel->Apid(pid)) { if (channelP && channelP->Apid(pid)) {
if (channel->Alang(pid)) if (channelP->Alang(pid))
return cString::sprintf("#%d (%s)", channel->Apid(pid), channel->Alang(pid)); return cString::sprintf("#%d (%s)", channelP->Apid(pid), channelP->Alang(pid));
else else
return cString::sprintf("#%d", channel->Apid(pid)); return cString::sprintf("#%d", channelP->Apid(pid));
} }
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getAC3Stream(int value, const cChannel *channel) cString getAC3Stream(int valueP, const cChannel *channelP)
{ {
int pid = 0; int pid = 0;
if (IS_DOLBY_TRACK(value)) if (IS_DOLBY_TRACK(valueP))
pid = int(value - ttDolbyFirst); pid = int(valueP - ttDolbyFirst);
if (channel && channel->Dpid(pid)) { if (channelP && channelP->Dpid(pid)) {
if (channel->Dlang(pid)) if (channelP->Dlang(pid))
return cString::sprintf("#%d (%s)", channel->Dpid(pid), channel->Dlang(pid)); return cString::sprintf("#%d (%s)", channelP->Dpid(pid), channelP->Dlang(pid));
else else
return cString::sprintf("#%d", channel->Dpid(pid)); return cString::sprintf("#%d", channelP->Dpid(pid));
} }
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getVideoCodec(int value) cString getVideoCodec(int valueP)
{ {
switch (value) { switch (valueP) {
case VIDEO_CODEC_MPEG2: return cString::sprintf("%s", tr("MPEG-2")); case VIDEO_CODEC_MPEG2: return cString::sprintf("%s", tr("MPEG-2"));
case VIDEO_CODEC_H264: return cString::sprintf("%s", tr("H.264")); case VIDEO_CODEC_H264: return cString::sprintf("%s", tr("H.264"));
default: break; default: break;
@ -313,9 +313,9 @@ cString getVideoCodec(int value)
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getAudioCodec(int value) cString getAudioCodec(int valueP)
{ {
switch (value) { switch (valueP) {
case AUDIO_CODEC_MPEG1_I: return cString::sprintf("%s", tr("MPEG-1 Layer I")); case AUDIO_CODEC_MPEG1_I: return cString::sprintf("%s", tr("MPEG-1 Layer I"));
case AUDIO_CODEC_MPEG1_II: return cString::sprintf("%s", tr("MPEG-1 Layer II")); case AUDIO_CODEC_MPEG1_II: return cString::sprintf("%s", tr("MPEG-1 Layer II"));
case AUDIO_CODEC_MPEG1_III: return cString::sprintf("%s", tr("MPEG-1 Layer III")); case AUDIO_CODEC_MPEG1_III: return cString::sprintf("%s", tr("MPEG-1 Layer III"));
@ -329,9 +329,9 @@ cString getAudioCodec(int value)
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getAudioChannelMode(int value) cString getAudioChannelMode(int valueP)
{ {
switch (value) { switch (valueP) {
case AUDIO_CHANNEL_MODE_STEREO: return cString::sprintf("%s", tr("stereo")); case AUDIO_CHANNEL_MODE_STEREO: return cString::sprintf("%s", tr("stereo"));
case AUDIO_CHANNEL_MODE_JOINT_STEREO: return cString::sprintf("%s", tr("joint Stereo")); case AUDIO_CHANNEL_MODE_JOINT_STEREO: return cString::sprintf("%s", tr("joint Stereo"));
case AUDIO_CHANNEL_MODE_DUAL: return cString::sprintf("%s", tr("dual")); case AUDIO_CHANNEL_MODE_DUAL: return cString::sprintf("%s", tr("dual"));
@ -341,76 +341,76 @@ cString getAudioChannelMode(int value)
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getCoderate(int value) cString getCoderate(int valueP)
{ {
return cString::sprintf("%s", getUserString(value, CoderateValues)); return cString::sprintf("%s", getUserString(valueP, CoderateValues));
} }
cString getTransmission(int value) cString getTransmission(int valueP)
{ {
return cString::sprintf("%s", getUserString(value, TransmissionValues)); return cString::sprintf("%s", getUserString(valueP, TransmissionValues));
} }
cString getBandwidth(int value) cString getBandwidth(int valueP)
{ {
return cString::sprintf("%s", getUserString(value, BandwidthValues)); return cString::sprintf("%s", getUserString(valueP, BandwidthValues));
} }
cString getInversion(int value) cString getInversion(int valueP)
{ {
return cString::sprintf("%s", getUserString(value, InversionValues)); return cString::sprintf("%s", getUserString(valueP, InversionValues));
} }
cString getHierarchy(int value) cString getHierarchy(int valueP)
{ {
return cString::sprintf("%s", getUserString(value, HierarchyValues)); return cString::sprintf("%s", getUserString(valueP, HierarchyValues));
} }
cString getGuard(int value) cString getGuard(int valueP)
{ {
return cString::sprintf("%s", getUserString(value, GuardValues)); return cString::sprintf("%s", getUserString(valueP, GuardValues));
} }
cString getModulation(int value) cString getModulation(int valueP)
{ {
return cString::sprintf("%s", getUserString(value, ModulationValues)); return cString::sprintf("%s", getUserString(valueP, ModulationValues));
} }
cString getTerrestrialSystem(int value) cString getTerrestrialSystem(int valueP)
{ {
return cString::sprintf("%s", getUserString(value, SystemValuesTerr)); return cString::sprintf("%s", getUserString(valueP, SystemValuesTerr));
} }
cString getSatelliteSystem(int value) cString getSatelliteSystem(int valueP)
{ {
return cString::sprintf("%s", getUserString(value, SystemValuesSat)); return cString::sprintf("%s", getUserString(valueP, SystemValuesSat));
} }
cString getRollOff(int value) cString getRollOff(int valueP)
{ {
return cString::sprintf("%s", getUserString(value, RollOffValues)); return cString::sprintf("%s", getUserString(valueP, RollOffValues));
} }
cString getPilot(int value) cString getPilot(int valueP)
{ {
return cString::sprintf("%s", getUserString(value, PilotValues)); return cString::sprintf("%s", getUserString(valueP, PilotValues));
} }
cString getResolution(int width, int height, int scan) cString getResolution(int widthP, int heightP, int scanP)
{ {
if ((width > 0) && (height > 0)) { if ((widthP > 0) && (heightP > 0)) {
switch (scan) { switch (scanP) {
case VIDEO_SCAN_INTERLACED: return cString::sprintf("%dx%d %s", width, height, tr("interlaced")); case VIDEO_SCAN_INTERLACED: return cString::sprintf("%dx%d %s", widthP, heightP, tr("interlaced"));
case VIDEO_SCAN_PROGRESSIVE: return cString::sprintf("%dx%d %s", width, height, tr("progressive")); case VIDEO_SCAN_PROGRESSIVE: return cString::sprintf("%dx%d %s", widthP, heightP, tr("progressive"));
default: return cString::sprintf("%dx%d", width, height); default: return cString::sprintf("%dx%d", widthP, heightP);
} }
} }
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getAspectRatio(int value) cString getAspectRatio(int valueP)
{ {
switch (value) { switch (valueP) {
case VIDEO_ASPECT_RATIO_RESERVED: return cString::sprintf("%s", tr("reserved")); case VIDEO_ASPECT_RATIO_RESERVED: return cString::sprintf("%s", tr("reserved"));
case VIDEO_ASPECT_RATIO_EXTENDED: return cString::sprintf("%s", tr("extended")); case VIDEO_ASPECT_RATIO_EXTENDED: return cString::sprintf("%s", tr("extended"));
case VIDEO_ASPECT_RATIO_1_1: return cString::sprintf("1:1"); case VIDEO_ASPECT_RATIO_1_1: return cString::sprintf("1:1");
@ -436,9 +436,9 @@ cString getAspectRatio(int value)
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getVideoFormat(int value) cString getVideoFormat(int valueP)
{ {
switch (value) { switch (valueP) {
case VIDEO_FORMAT_UNKNOWN: return cString::sprintf("%s", tr("unknown")); case VIDEO_FORMAT_UNKNOWN: return cString::sprintf("%s", tr("unknown"));
case VIDEO_FORMAT_RESERVED: return cString::sprintf("%s", tr("reserved")); case VIDEO_FORMAT_RESERVED: return cString::sprintf("%s", tr("reserved"));
case VIDEO_FORMAT_COMPONENT: return cString::sprintf("%s", tr("component")); case VIDEO_FORMAT_COMPONENT: return cString::sprintf("%s", tr("component"));
@ -451,16 +451,16 @@ cString getVideoFormat(int value)
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getFrameRate(double value) cString getFrameRate(double valueP)
{ {
if (value > 0) if (valueP > 0)
return cString::sprintf("%.2f %s", value, tr("Hz")); return cString::sprintf("%.2f %s", valueP, tr("Hz"));
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getAC3BitStreamMode(int value, int coding) cString getAC3BitStreamMode(int valueP, int codingP)
{ {
switch (value) { switch (valueP) {
case AUDIO_BITSTREAM_MODE_CM: return cString::sprintf("%s", tr("Complete Main (CM)")); case AUDIO_BITSTREAM_MODE_CM: return cString::sprintf("%s", tr("Complete Main (CM)"));
case AUDIO_BITSTREAM_MODE_ME: return cString::sprintf("%s", tr("Music and Effects (ME)")); case AUDIO_BITSTREAM_MODE_ME: return cString::sprintf("%s", tr("Music and Effects (ME)"));
case AUDIO_BITSTREAM_MODE_VI: return cString::sprintf("%s", tr("Visually Impaired (VI)")); case AUDIO_BITSTREAM_MODE_VI: return cString::sprintf("%s", tr("Visually Impaired (VI)"));
@ -468,16 +468,16 @@ cString getAC3BitStreamMode(int value, int coding)
case AUDIO_BITSTREAM_MODE_D: return cString::sprintf("%s", tr("Dialogue (D)")); case AUDIO_BITSTREAM_MODE_D: return cString::sprintf("%s", tr("Dialogue (D)"));
case AUDIO_BITSTREAM_MODE_C: return cString::sprintf("%s", tr("Commentary (C)")); case AUDIO_BITSTREAM_MODE_C: return cString::sprintf("%s", tr("Commentary (C)"));
case AUDIO_BITSTREAM_MODE_E: return cString::sprintf("%s", tr("Emergency (E)")); case AUDIO_BITSTREAM_MODE_E: return cString::sprintf("%s", tr("Emergency (E)"));
case AUDIO_BITSTREAM_MODE_VO_KAR: return cString::sprintf("%s", (coding == 1) ? tr("Voice Over (VO)") : tr("Karaoke")); case AUDIO_BITSTREAM_MODE_VO_KAR: return cString::sprintf("%s", (codingP == 1) ? tr("Voice Over (VO)") : tr("Karaoke"));
default: break; default: break;
} }
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getAC3AudioCodingMode(int value, int stream) cString getAC3AudioCodingMode(int valueP, int streamP)
{ {
if (stream != 7) { if (streamP != 7) {
switch (value) { switch (valueP) {
case AUDIO_CODING_MODE_1_1: return cString::sprintf("1+1 - %s, %s", tr("Ch1"), tr("Ch2")); case AUDIO_CODING_MODE_1_1: return cString::sprintf("1+1 - %s, %s", tr("Ch1"), tr("Ch2"));
case AUDIO_CODING_MODE_1_0: return cString::sprintf("1/0 - %s", tr("C")); case AUDIO_CODING_MODE_1_0: return cString::sprintf("1/0 - %s", tr("C"));
case AUDIO_CODING_MODE_2_0: return cString::sprintf("2/0 - %s, %s", tr("L"), tr("R")); case AUDIO_CODING_MODE_2_0: return cString::sprintf("2/0 - %s, %s", tr("L"), tr("R"));
@ -492,9 +492,9 @@ cString getAC3AudioCodingMode(int value, int stream)
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getAC3CenterMixLevel(int value) cString getAC3CenterMixLevel(int valueP)
{ {
switch (value) { switch (valueP) {
case AUDIO_CENTER_MIX_LEVEL_MINUS_3dB: return cString::sprintf("-3.0 %s", tr("dB")); case AUDIO_CENTER_MIX_LEVEL_MINUS_3dB: return cString::sprintf("-3.0 %s", tr("dB"));
case AUDIO_CENTER_MIX_LEVEL_MINUS_4_5dB: return cString::sprintf("-4.5 %s", tr("dB")); case AUDIO_CENTER_MIX_LEVEL_MINUS_4_5dB: return cString::sprintf("-4.5 %s", tr("dB"));
case AUDIO_CENTER_MIX_LEVEL_MINUS_6dB: return cString::sprintf("-6.0 %s", tr("dB")); case AUDIO_CENTER_MIX_LEVEL_MINUS_6dB: return cString::sprintf("-6.0 %s", tr("dB"));
@ -504,9 +504,9 @@ cString getAC3CenterMixLevel(int value)
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getAC3SurroundMixLevel(int value) cString getAC3SurroundMixLevel(int valueP)
{ {
switch (value) { switch (valueP) {
case AUDIO_SURROUND_MIX_LEVEL_MINUS_3dB: return cString::sprintf("-3 %s", tr("dB")); case AUDIO_SURROUND_MIX_LEVEL_MINUS_3dB: return cString::sprintf("-3 %s", tr("dB"));
case AUDIO_SURROUND_MIX_LEVEL_MINUS_6dB: return cString::sprintf("-6 %s", tr("dB")); case AUDIO_SURROUND_MIX_LEVEL_MINUS_6dB: return cString::sprintf("-6 %s", tr("dB"));
case AUDIO_SURROUND_MIX_LEVEL_0_dB: return cString::sprintf("0 %s", tr("dB")); case AUDIO_SURROUND_MIX_LEVEL_0_dB: return cString::sprintf("0 %s", tr("dB"));
@ -516,9 +516,9 @@ cString getAC3SurroundMixLevel(int value)
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getAC3DolbySurroundMode(int value) cString getAC3DolbySurroundMode(int valueP)
{ {
switch (value) { switch (valueP) {
case AUDIO_DOLBY_SURROUND_MODE_NOT_INDICATED: return cString::sprintf("%s", tr("not indicated")); case AUDIO_DOLBY_SURROUND_MODE_NOT_INDICATED: return cString::sprintf("%s", tr("not indicated"));
case AUDIO_DOLBY_SURROUND_MODE_NOT_DOLBYSURROUND: return cString::sprintf("%s", trVDR("no")); case AUDIO_DOLBY_SURROUND_MODE_NOT_DOLBYSURROUND: return cString::sprintf("%s", trVDR("no"));
case AUDIO_DOLBY_SURROUND_MODE_DOLBYSURROUND: return cString::sprintf("%s", trVDR("yes")); case AUDIO_DOLBY_SURROUND_MODE_DOLBYSURROUND: return cString::sprintf("%s", trVDR("yes"));
@ -528,57 +528,57 @@ cString getAC3DolbySurroundMode(int value)
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getAC3DialogLevel(int value) cString getAC3DialogLevel(int valueP)
{ {
if (value > 0) if (valueP > 0)
return cString::sprintf("-%d %s", value, tr("dB")); return cString::sprintf("-%d %s", valueP, tr("dB"));
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getFrequencyMHz(int value) cString getFrequencyMHz(int valueP)
{ {
double freq = value; double freq = valueP;
while (freq > 20000.0) freq /= 1000.0; while (freq > 20000.0) freq /= 1000.0;
return cString::sprintf("%s %s", *dtoa(freq, "%lg"), tr("MHz")); return cString::sprintf("%s %s", *dtoa(freq, "%lg"), tr("MHz"));
} }
cString getAudioSamplingFreq(int value) cString getAudioSamplingFreq(int valueP)
{ {
switch (value) { switch (valueP) {
case AUDIO_SAMPLING_FREQUENCY_INVALID: return cString::sprintf("---"); case AUDIO_SAMPLING_FREQUENCY_INVALID: return cString::sprintf("---");
case AUDIO_SAMPLING_FREQUENCY_RESERVED: return cString::sprintf("%s", tr("reserved")); case AUDIO_SAMPLING_FREQUENCY_RESERVED: return cString::sprintf("%s", tr("reserved"));
default: break; default: break;
} }
return cString::sprintf("%d %s", value, tr("Hz")); return cString::sprintf("%d %s", valueP, tr("Hz"));
} }
cString getAudioBitrate(double value, double stream) cString getAudioBitrate(double valueP, double streamP)
{ {
switch ((int)stream) { switch ((int)streamP) {
case AUDIO_BITRATE_INVALID: return cString::sprintf("---"); case AUDIO_BITRATE_INVALID: return cString::sprintf("---");
case AUDIO_BITRATE_RESERVED: return cString::sprintf("%s (%s)", tr("reserved"), *getBitrateKbits(value)); case AUDIO_BITRATE_RESERVED: return cString::sprintf("%s (%s)", tr("reserved"), *getBitrateKbits(valueP));
case AUDIO_BITRATE_FREE: return cString::sprintf("%s (%s)", tr("free"), *getBitrateKbits(value)); case AUDIO_BITRATE_FREE: return cString::sprintf("%s (%s)", tr("free"), *getBitrateKbits(valueP));
default: break; default: break;
} }
return cString::sprintf("%s (%s)", *getBitrateKbits(stream), *getBitrateKbits(value)); return cString::sprintf("%s (%s)", *getBitrateKbits(streamP), *getBitrateKbits(valueP));
} }
cString getVideoBitrate(double value, double stream) cString getVideoBitrate(double valueP, double streamP)
{ {
return cString::sprintf("%s (%s)", *getBitrateMbits(stream), *getBitrateMbits(value)); return cString::sprintf("%s (%s)", *getBitrateMbits(streamP), *getBitrateMbits(valueP));
} }
cString getBitrateMbits(double value) cString getBitrateMbits(double valueP)
{ {
if (value > 0) if (valueP > 0)
return cString::sprintf("%.2f %s", value / 1000000.0, tr("Mbit/s")); return cString::sprintf("%.2f %s", valueP / 1000000.0, tr("Mbit/s"));
return cString::sprintf("---"); return cString::sprintf("---");
} }
cString getBitrateKbits(double value) cString getBitrateKbits(double valueP)
{ {
if (value > 0) if (valueP > 0)
return cString::sprintf("%.0f %s", value / 1000.0, tr("kbit/s")); return cString::sprintf("%.0f %s", valueP / 1000.0, tr("kbit/s"));
return cString::sprintf("---"); return cString::sprintf("---");
} }

View File

@ -28,59 +28,59 @@
#define SATIP_DEVICE "SAT>IP" #define SATIP_DEVICE "SAT>IP"
cDvbDevice *getDvbDevice(cDevice* device); cDvbDevice *getDvbDevice(cDevice* deviceP);
cString getFrontendInfo(cDvbDevice *device); cString getFrontendInfo(cDvbDevice *deviceP);
cString getFrontendName(cDvbDevice *device); cString getFrontendName(cDvbDevice *deviceP);
cString getFrontendStatus(cDvbDevice *device); cString getFrontendStatus(cDvbDevice *deviceP);
uint16_t getSNR(cDvbDevice *device); uint16_t getSNR(cDvbDevice *deviceP);
uint16_t getSignal(cDvbDevice *device); uint16_t getSignal(cDvbDevice *deviceP);
uint32_t getBER(cDvbDevice *device); uint32_t getBER(cDvbDevice *deviceP);
uint32_t getUNC(cDvbDevice *device); uint32_t getUNC(cDvbDevice *deviceP);
cString getApids(const cChannel *channel); cString getApids(const cChannel *channelP);
cString getDpids(const cChannel *channel); cString getDpids(const cChannel *channelP);
cString getSpids(const cChannel *channel); cString getSpids(const cChannel *channelP);
cString getCAids(const cChannel *channel); cString getCAids(const cChannel *channelP);
cString getVideoStream(int value); cString getVideoStream(int valueP);
cString getVideoCodec(int value); cString getVideoCodec(int valueP);
cString getAudioStream(int value, const cChannel *channel); cString getAudioStream(int valueP, const cChannel *channelP);
cString getAudioCodec(int value); cString getAudioCodec(int valueP);
cString getAudioChannelMode(int value); cString getAudioChannelMode(int valueP);
cString getCoderate(int value); cString getCoderate(int valueP);
cString getTransmission(int value); cString getTransmission(int valueP);
cString getBandwidth(int value); cString getBandwidth(int valueP);
cString getInversion(int value); cString getInversion(int valueP);
cString getHierarchy(int value); cString getHierarchy(int valueP);
cString getGuard(int value); cString getGuard(int valueP);
cString getModulation(int value); cString getModulation(int valueP);
cString getTerrestrialSystem(int value); cString getTerrestrialSystem(int valueP);
cString getSatelliteSystem(int value); cString getSatelliteSystem(int valueP);
cString getRollOff(int value); cString getRollOff(int valueP);
cString getPilot(int value); cString getPilot(int valueP);
cString getResolution(int width, int height, int scan); cString getResolution(int widthP, int heightP, int scanP);
cString getAspectRatio(int value); cString getAspectRatio(int valueP);
cString getVideoFormat(int value); cString getVideoFormat(int valueP);
cString getFrameRate(double value); cString getFrameRate(double valueP);
cString getAC3Stream(int value, const cChannel *channel); cString getAC3Stream(int valueP, const cChannel *channelP);
cString getAC3BitStreamMode(int value, int coding); cString getAC3BitStreamMode(int valueP, int codingP);
cString getAC3AudioCodingMode(int value, int stream); cString getAC3AudioCodingMode(int valueP, int streamP);
cString getAC3CenterMixLevel(int value); cString getAC3CenterMixLevel(int valueP);
cString getAC3SurroundMixLevel(int value); cString getAC3SurroundMixLevel(int valueP);
cString getAC3DolbySurroundMode(int value); cString getAC3DolbySurroundMode(int valueP);
cString getAC3DialogLevel(int value); cString getAC3DialogLevel(int valueP);
cString getFrequencyMHz(int value); cString getFrequencyMHz(int valueP);
cString getAudioSamplingFreq(int value); cString getAudioSamplingFreq(int valueP);
cString getAudioBitrate(double value, double stream); cString getAudioBitrate(double valueP, double streamP);
cString getVideoBitrate(double value, double stream); cString getVideoBitrate(double valueP, double streamP);
cString getBitrateMbits(double value); cString getBitrateMbits(double valueP);
cString getBitrateKbits(double value); cString getBitrateKbits(double valueP);
class cFemonBitStream : public cBitStream { class cFemonBitStream : public cBitStream {
public: public:
cFemonBitStream(const uint8_t *Data, const int Length) : cBitStream(Data, Length) {} cFemonBitStream(const uint8_t *dataP, const int lengthP) : cBitStream(dataP, lengthP) {}
uint32_t GetUeGolomb(); uint32_t GetUeGolomb();
int32_t GetSeGolomb(); int32_t GetSeGolomb();
void SkipGolomb(); void SkipGolomb();

View File

@ -75,19 +75,19 @@ public:
virtual ~cFemonVideoIf() {} virtual ~cFemonVideoIf() {}
// eVideoCodec // eVideoCodec
virtual void SetVideoCodec(eVideoCodec codec) = 0; virtual void SetVideoCodec(eVideoCodec codecP) = 0;
// eVideoFormat // eVideoFormat
virtual void SetVideoFormat(eVideoFormat format) = 0; virtual void SetVideoFormat(eVideoFormat formatP) = 0;
// eVideoScan // eVideoScan
virtual void SetVideoScan(eVideoScan scan) = 0; virtual void SetVideoScan(eVideoScan scanP) = 0;
// eVideoAspectRatio // eVideoAspectRatio
virtual void SetVideoAspectRatio(eVideoAspectRatio aspectratio) = 0; virtual void SetVideoAspectRatio(eVideoAspectRatio aspectRatioP) = 0;
// pixels // pixels
virtual void SetVideoSize(int width, int height) = 0; virtual void SetVideoSize(int widthP, int heightP) = 0;
// Hz // Hz
virtual void SetVideoFramerate(double framerate) = 0; virtual void SetVideoFramerate(double frameRateP) = 0;
// Mbit/s // Mbit/s
virtual void SetVideoBitrate(double bitrate) = 0; virtual void SetVideoBitrate(double bitRateP) = 0;
}; };
#endif //__FEMONVIDEO_H #endif //__FEMONVIDEO_H

View File

@ -11,11 +11,11 @@
class cLine: public cListObject { class cLine: public cListObject {
private: private:
char *Line; char *lineM;
public: public:
const char *Text() { return Line; } const char *Text() { return lineM; }
cLine(const char *s) { Line = s ? strdup(s) : NULL; }; cLine(const char *strP) { lineM = strP ? strdup(strP) : NULL; };
virtual ~cLine() { if (Line) free(Line); }; virtual ~cLine() { if (lineM) free(lineM); };
}; };
struct SvdrpConnection_v1_0 { struct SvdrpConnection_v1_0 {