From 954f09182fb0dd4422f714e9090fcf34e77e101c Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sun, 7 Mar 2004 04:20:00 +0200 Subject: [PATCH] Fixed frequency, guard and bandwidth units in transponder information. Added Apid2, Dpid1, Dpid2 information. Added option to write signal information into system log. --- HISTORY | 6 ++ README | 6 +- femon.c | 3 + femon.h | 2 +- femoncfg.c | 1 + femoncfg.h | 17 +-- femoni18n.c | 48 ++++++--- femonosd.c | 276 ++++++++++++++++++++++++++---------------------- femonreceiver.c | 8 +- femonreceiver.h | 4 +- 10 files changed, 214 insertions(+), 157 deletions(-) diff --git a/HISTORY b/HISTORY index 3fc8b38..d5d35dd 100644 --- a/HISTORY +++ b/HISTORY @@ -29,3 +29,9 @@ VDR Plugin 'femon' Revision History - Transponder information is now available in advanced display mode: Press 'OK' key to switch between the simple and the advanced display mode. - Moved bitrate calculation to it's own thread for improved accurancy. + +2004-03-07: Version 0.0.3a + +- Fixed frequency, guard and bandwidth units in transponder information. +- Added Apid2, Dpid1, Dpid2 information. +- Added option to write signal information into system log. diff --git a/README b/README index 805cc96..d1f2fe9 100644 --- a/README +++ b/README @@ -11,7 +11,7 @@ See the file COPYING for license information. Requirements: Ph.D. in Astro Physics and preferably a six-pack waiting in a fridge. -Never trust a Klingon. +Never trust a Klingon. "Qu'vaD lI' De'vam" Description: @@ -28,7 +28,7 @@ excellent 'OSD Picture-In-Picture' plugin by Sascha Volkenandt . The bitrate calculation algorithm originates from the 'dvbstream' application by Dave Chapman . -Shortcomings / Todo list: +Shortcomings / Todo list / Notes: - The current version is a kind of Proof In Concept to replace the old 'tech patch', and it's now eating many unnecessary cpu clock cycles - this will be @@ -41,3 +41,5 @@ Shortcomings / Todo list: well. Btw., this same thing happens with OSDTeletext plugin too :) - The plugin GUI is designed for _small fonts_, so stable vdr-1.2.6 users should consider a small font patch (e.g. ElchiAIO4a) to maximize the visual effect :) +- The stream information is still missing. +- Disable bitrate calculation to speed up heavy zapping sessions. diff --git a/femon.c b/femon.c index f629831..3d35388 100644 --- a/femon.c +++ b/femon.c @@ -64,6 +64,7 @@ bool cPluginFemon::SetupParse(const char *Name, const char *Value) { // Parse your own setup parameters and store their values. if (!strcasecmp(Name, "HideMenu")) femonConfig.hidemenu = atoi(Value); + else if (!strcasecmp(Name, "SyslogOutput")) femonConfig.syslogoutput = atoi(Value); else if (!strcasecmp(Name, "DisplayMode")) femonConfig.displaymode = atoi(Value); else if (!strcasecmp(Name, "Position")) femonConfig.position = atoi(Value); else if (!strcasecmp(Name, "RedLimit")) femonConfig.redlimit = atoi(Value); @@ -88,6 +89,7 @@ void cMenuFemonSetup::Setup(void) Clear(); Add(new cMenuEditBoolItem( tr("Hide Mainmenu Entry"), &femonConfig.hidemenu, tr("no"), tr("yes"))); + Add(new cMenuEditBoolItem( tr("Use Syslog Output"), &femonConfig.syslogoutput, tr("no"), tr("yes"))); Add(new cMenuEditBoolItem( tr("Default Display Mode"), &femonConfig.displaymode, tr("simple"), tr("advanced"))); Add(new cMenuEditBoolItem( tr("Position"), &femonConfig.position, tr("bottom"), tr("top"))); Add(new cMenuEditIntItem( tr("Red Limit [%]"), &femonConfig.redlimit, 1, 50)); @@ -104,6 +106,7 @@ void cMenuFemonSetup::Setup(void) void cMenuFemonSetup::Store(void) { SetupStore("HideMenu", femonConfig.hidemenu); + SetupStore("SyslogOutput", femonConfig.syslogoutput); SetupStore("Position", femonConfig.position); SetupStore("DisplayMode", femonConfig.displaymode); SetupStore("RedLimit", femonConfig.redlimit); diff --git a/femon.h b/femon.h index a2ef116..96034f0 100644 --- a/femon.h +++ b/femon.h @@ -11,7 +11,7 @@ #include -static const char *VERSION = "0.0.3"; +static const char *VERSION = "0.0.3a"; static const char *DESCRIPTION = "DVB Signal Information Monitor (OSD)"; static const char *MAINMENUENTRY = "Signal Information"; diff --git a/femoncfg.c b/femoncfg.c index 1f61b92..5d7f40c 100644 --- a/femoncfg.c +++ b/femoncfg.c @@ -20,4 +20,5 @@ cFemonConfig::cFemonConfig(void) updateinterval = 5; showbitrate = 1; calcinterval = 20; + syslogoutput = 0; } diff --git a/femoncfg.h b/femoncfg.h index 6fddcb8..39efeaf 100644 --- a/femoncfg.h +++ b/femoncfg.h @@ -13,14 +13,15 @@ struct cFemonConfig { public: cFemonConfig(void); - int hidemenu; - int displaymode; - int position; - int redlimit; - int greenlimit; - int updateinterval; - int showbitrate; - int calcinterval; + int hidemenu; + int displaymode; + int position; + int redlimit; + int greenlimit; + int updateinterval; + int showbitrate; + int calcinterval; + int syslogoutput; }; extern cFemonConfig femonConfig; diff --git a/femoni18n.c b/femoni18n.c index 159bc5b..a936099 100644 --- a/femoni18n.c +++ b/femoni18n.c @@ -12,7 +12,7 @@ const tI18nPhrase Phrases[] = { { "DVB Signal Information Monitor (OSD)", // English "DVB Signal Informationsanzeige (OSD)", // Deutsch "", // Slovenski - "", // Italiano + "Visualizza le informazioni sul segnale DVB", // Italiano "", // Nederlands "", // Português "", // Français @@ -32,7 +32,7 @@ const tI18nPhrase Phrases[] = { { "Signal Information", // English "Signalinformationen", // Deutsch "", // Slovenski - "", // Italiano + "Informazioni sul segnale", // Italiano "", // Nederlands "", // Português "", // Français @@ -72,7 +72,7 @@ const tI18nPhrase Phrases[] = { { "Default Display Mode", // English "Standard Anzeigemodus", // Deutsch "", // Slovenski - "", // Italiano + "Modo di visualizzazione standard", // Italiano "", // Nederlands "", // Português "", // Français @@ -92,7 +92,7 @@ const tI18nPhrase Phrases[] = { { "simple", // English "einfach", // Deutsch "", // Slovenski - "", // Italiano + "semplice", // Italiano "", // Nederlands "", // Português "", // Français @@ -112,7 +112,7 @@ const tI18nPhrase Phrases[] = { { "advanced", // English "fortgeschritten", // Deutsch "", // Slovenski - "", // Italiano + "avanzato", // Italiano "", // Nederlands "", // Português "", // Français @@ -132,7 +132,7 @@ const tI18nPhrase Phrases[] = { { "Hide Mainmenu Entry", // English "Hauptmenüeintrag verstecken", // Deutsch "", // Slovenski - "Nascondere Voce Menu", // Italiano + "Nascondi voce menù", // Italiano "", // Nederlands "", // Português "", // Français @@ -172,7 +172,7 @@ const tI18nPhrase Phrases[] = { { "Bitrate Calculation", // English "Bitratenberechnung", // Deutsch "", // Slovenski - "", // Italiano + "Calcolo Bitrate", // Italiano "", // Nederlands "", // Português "", // Français @@ -192,7 +192,7 @@ const tI18nPhrase Phrases[] = { { "Calculation Interval [0.1s]", // English "Berechnungsintervall [0.1s]", // Deutsch "", // Slovenski - "", // Italiano + "Intervallo di calcolo [0.1s]", // Italiano "", // Nederlands "", // Português "", // Français @@ -212,7 +212,7 @@ const tI18nPhrase Phrases[] = { { "Red Limit [%]", // English "Grenze Rot [%]", // Deutsch "", // Slovenski - "Limite Rosso [%]", // Italiano + "Limite rosso [%]", // Italiano "", // Nederlands "", // Português "", // Français @@ -232,7 +232,7 @@ const tI18nPhrase Phrases[] = { { "Green Limit [%]", // English "Grenze Grün [%]", // Deutsch "", // Slovenski - "Limite Verde [%]", // Italiano + "Limite verde [%]", // Italiano "", // Nederlands "", // Português "", // Français @@ -252,7 +252,7 @@ const tI18nPhrase Phrases[] = { { "Transponder Information", // English "Transponderinformation", // Deutsch "", // Slovenski - "", // Italiano + "Informazioni transponder", // Italiano "", // Nederlands "", // Português "", // Français @@ -272,7 +272,7 @@ const tI18nPhrase Phrases[] = { { "Satellite Card", // English "Satellitenkarte", // Deutsch "", // Slovenski - "", // Italiano + "Scheda satellitare", // Italiano "", // Nederlands "", // Português "", // Français @@ -292,7 +292,7 @@ const tI18nPhrase Phrases[] = { { "Cable Card", // English "Kabelkarte", // Deutsch "", // Slovenski - "", // Italiano + "Scheda via cavo", // Italiano "", // Nederlands "", // Português "", // Français @@ -312,7 +312,7 @@ const tI18nPhrase Phrases[] = { { "Terrestial Card", // English "Terrestrische Karte", // Deutsch "", // Slovenski - "", // Italiano + "Scheda terrestre", // Italiano "", // Nederlands "", // Português "", // Français @@ -327,6 +327,26 @@ const tI18nPhrase Phrases[] = { "", // Català #if VDRVERSNUM >= 10300 "" // ÀãááÚØÙ +#endif + }, + { "Use Syslog Output", // English + "Benutze syslog Ausgabe", // Deutsch + "", // Slovenski + "Registra su syslog", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "Kirjaa systeemilokiin", // suomi + "", // Polski + "", // Español + "", // ÅëëçíéêÜ + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Català +#if VDRVERSNUM >= 10300 + "" // ÀãááÚØÙ #endif }, { NULL } diff --git a/femonosd.c b/femonosd.c index d0fa7bd..4dd41c3 100644 --- a/femonosd.c +++ b/femonosd.c @@ -16,9 +16,12 @@ #warning You should consider using the small fonts! #endif -#define FE_DEVICE "/dev/dvb/adapter%d/frontend%d" +#define FRONTEND_DEVICE "/dev/dvb/adapter%d/frontend%d" #define CHANNELINPUT_TIMEOUT 1000 +#define SCREENWIDTH 720 +#define SCREENHEIGHT 576 + #define OSDWIDTH 46 #define OSDINFOHEIGHT 11 #define OSDGAPHEIGHT 1 @@ -85,15 +88,16 @@ void cFemonOsd::DrawStatusWindow(void) int snr = m_SNR / 655; int signal = m_Signal / 655; int lines = 0; + cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); if (m_Osd) { #if (VDRVERSNUM >= 10300) || defined(ELCHIAIOVERSION) eDvbFont OldFont = m_Osd->SetFont(fontSml); #endif m_Osd->Clear(m_StatusWindow); - snprintf(buf, sizeof(buf), "%d%s %s", m_Number ? m_Number : Channels.GetByNumber(cDevice::CurrentChannel())->Number(), m_Number ? "-" : "", Channels.GetByNumber(cDevice::CurrentChannel())->Name()); + snprintf(buf, sizeof(buf), "%d%s %s", m_Number ? m_Number : channel->Number(), m_Number ? "-" : "", channel->Name()); m_Osd->Fill(0, femonConfig.position ? 0 : (OSDINFOHEIGHT + OSDGAPHEIGHT) * cOsd::LineHeight(), OSDWIDTH * cOsd::CellWidth(), femonConfig.position ? cOsd::LineHeight() - 1 : (OSDINFOHEIGHT + OSDGAPHEIGHT + 1) * cOsd::LineHeight() - 1, clrWhite, m_StatusWindow); - m_Osd->Text(OSDSTATUSCOL1 * cOsd::CellWidth(), femonConfig.position ? 0 : (OSDINFOHEIGHT + OSDGAPHEIGHT + 0) * cOsd::LineHeight(), buf, clrBlack, clrWhite, m_StatusWindow); + m_Osd->Text(OSDSTATUSCOL1 * cOsd::CellWidth(), femonConfig.position ? 0 : (OSDINFOHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight(), buf, clrBlack, clrWhite, m_StatusWindow); lines++; if (signal > 0) { signal = (OSDWIDTH * cOsd::CellWidth()) * signal / 100; @@ -123,7 +127,7 @@ void cFemonOsd::DrawStatusWindow(void) m_Osd->Text(OSDSTATUSCOL2 * cOsd::CellWidth(), femonConfig.position ? lines * cOsd::LineHeight() : (OSDINFOHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight(), buf, clrWhite /*signal < femonConfig.redlimit ? clrRed : signal < femonConfig.greenlimit ? clrYellow : clrGreen*/, clrBackground, m_StatusWindow); snprintf(buf, sizeof(buf), "BER: %08x", m_BER); m_Osd->Text(OSDSTATUSCOL3 * cOsd::CellWidth(), femonConfig.position ? lines * cOsd::LineHeight() : (OSDINFOHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight(), buf, clrWhite, clrBackground, m_StatusWindow); - if (m_Receiver) snprintf(buf, sizeof(buf), "Video: %.2f Mbit/s",m_Receiver->VideoBitrate()); + if (m_Receiver) snprintf(buf, sizeof(buf), "Video: %.2f Mbit/s", m_Receiver->VideoBitrate()); else snprintf(buf, sizeof(buf), "Video: --- Mbit/s"); m_Osd->Text(OSDSTATUSCOL4 * cOsd::CellWidth(), femonConfig.position ? lines * cOsd::LineHeight() : (OSDINFOHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight(), buf, clrWhite, clrBackground, m_StatusWindow); lines++; @@ -133,7 +137,7 @@ void cFemonOsd::DrawStatusWindow(void) m_Osd->Text(OSDSTATUSCOL2 * cOsd::CellWidth(), femonConfig.position ? lines * cOsd::LineHeight() : (OSDINFOHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight(), buf, clrWhite /*snr < femonConfig.redlimit ? clrRed : snr < femonConfig.greenlimit ? clrYellow : clrGreen*/, clrBackground, m_StatusWindow); snprintf(buf, sizeof(buf), "UNC: %08x", m_UNC); m_Osd->Text(OSDSTATUSCOL3 * cOsd::CellWidth(), femonConfig.position ? lines * cOsd::LineHeight() : (OSDINFOHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight(), buf, clrWhite, clrBackground, m_StatusWindow); - if (m_Receiver) snprintf(buf, sizeof(buf), "Audio: %.0f kbit/s",m_Receiver->AudioBitrate()); + if (m_Receiver) snprintf(buf, sizeof(buf), "Audio: %.0f kbit/s", m_Receiver->AudioBitrate()); else snprintf(buf, sizeof(buf), "Audio: --- kbit/s"); m_Osd->Text(OSDSTATUSCOL4 * cOsd::CellWidth(), femonConfig.position ? lines * cOsd::LineHeight() : (OSDINFOHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight(), buf, clrWhite, clrBackground, m_StatusWindow); lines++; @@ -157,6 +161,7 @@ void cFemonOsd::DrawInfoWindow(void) char buf2[20]; int lines = 0; int value = 0; + cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); if (m_Osd) { if (m_DisplayMode) { @@ -168,76 +173,85 @@ void cFemonOsd::DrawInfoWindow(void) m_Osd->Text( OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines, tr("Transponder Information"), clrBackground, clrWhite, m_InfoWindow); lines++; m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Vpid"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d", Channels.GetByNumber(cDevice::CurrentChannel())->Vpid()); + snprintf(buf, sizeof(buf), "%d", channel->Vpid()); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Ppid"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d", Channels.GetByNumber(cDevice::CurrentChannel())->Ppid()); + snprintf(buf, sizeof(buf), "%d", channel->Ppid()); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Apid1"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d", Channels.GetByNumber(cDevice::CurrentChannel())->Apid1()); + value = channel->Apid2(); + if (value) snprintf(buf, sizeof(buf), "%d, %d", channel->Apid1(), value); + else snprintf(buf, sizeof(buf), "%d", channel->Apid1()); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); - m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Tpid"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d", Channels.GetByNumber(cDevice::CurrentChannel())->Tpid()); + m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Dpid1"), clrWhite, clrBackground, m_InfoWindow); + value = channel->Dpid2(); + if (value) snprintf(buf, sizeof(buf), "%d, %d", channel->Dpid1(), value); + else snprintf(buf, sizeof(buf), "%d", channel->Dpid1()); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("CA"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d", Channels.GetByNumber(cDevice::CurrentChannel())->Ca()); + snprintf(buf, sizeof(buf), "%d", channel->Ca()); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); - m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Sid"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d", Channels.GetByNumber(cDevice::CurrentChannel())->Sid()); + m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Tpid"), clrWhite, clrBackground, m_InfoWindow); + snprintf(buf, sizeof(buf), "%d", channel->Tpid()); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; + m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Sid"), clrWhite, clrBackground, m_InfoWindow); + snprintf(buf, sizeof(buf), "%d", channel->Sid()); + m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); #if (VDRVERSNUM >= 10300) - m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), "Nid", clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d", Channels.GetByNumber(cDevice::CurrentChannel())->Nid()); - m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); - m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), "Tid" /*tr("Tid")*/, clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d", Channels.GetByNumber(cDevice::CurrentChannel())->Tid()); + m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), "Nid", clrWhite, clrBackground, m_InfoWindow); + snprintf(buf, sizeof(buf), "%d", channel->Nid()); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; - m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), "Rid" /*tr("Rid")*/, clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d", Channels.GetByNumber(cDevice::CurrentChannel())->Rid()); + m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), "Tid" /*tr("Tid")*/, clrWhite, clrBackground, m_InfoWindow); + snprintf(buf, sizeof(buf), "%d", channel->Tid()); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); - lines++; + m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), "Rid" /*tr("Rid")*/, clrWhite, clrBackground, m_InfoWindow); + snprintf(buf, sizeof(buf), "%d", channel->Rid()); + m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); #endif + lines++; switch (m_FrontendInfo.type) { case FE_QPSK: snprintf(buf, sizeof(buf), "%s #%d - %s", tr("Satellite Card"), cDevice::ActualDevice()->CardIndex(), m_FrontendInfo.name); m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Frequency"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d kHz", Channels.GetByNumber(cDevice::CurrentChannel())->Frequency()); + value = channel->Frequency(); + while (value > 20000) value /= 1000; + snprintf(buf, sizeof(buf), "%d MHz", value); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Source"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%s", cSource::ToString(Channels.GetByNumber(cDevice::CurrentChannel())->Source())); + snprintf(buf, sizeof(buf), "%s", cSource::ToString(channel->Source())); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Srate"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d", Channels.GetByNumber(cDevice::CurrentChannel())->Srate()); + snprintf(buf, sizeof(buf), "%d", channel->Srate()); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Polarization"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%c", toupper(Channels.GetByNumber(cDevice::CurrentChannel())->Polarization())); + snprintf(buf, sizeof(buf), "%c", toupper(channel->Polarization())); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Inversion"), clrWhite, clrBackground, m_InfoWindow); - value = Channels.GetByNumber(cDevice::CurrentChannel())->Inversion(); - if (value == 0) snprintf(buf, sizeof(buf), "Off"); - else if (value == 1) snprintf(buf, sizeof(buf), "On"); - else snprintf(buf, sizeof(buf), "Auto"); + value = channel->Inversion(); + if (value == INVERSION_OFF) snprintf(buf, sizeof(buf), "Off"); + else if (value == INVERSION_ON) snprintf(buf, sizeof(buf), "On"); + else /*INVERSION_AUTO*/ snprintf(buf, sizeof(buf), "Auto"); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("CoderateH"), clrWhite, clrBackground, m_InfoWindow); - value = Channels.GetByNumber(cDevice::CurrentChannel())->CoderateH(); - if (value == 0) snprintf(buf, sizeof(buf), "None"); - else if (value == 1) snprintf(buf, sizeof(buf), "1/2"); - else if (value == 2) snprintf(buf, sizeof(buf), "2/3"); - else if (value == 3) snprintf(buf, sizeof(buf), "3/4"); - else if (value == 4) snprintf(buf, sizeof(buf), "4/5"); - else if (value == 5) snprintf(buf, sizeof(buf), "5/6"); - else if (value == 6) snprintf(buf, sizeof(buf), "6/7"); - else if (value == 7) snprintf(buf, sizeof(buf), "7/8"); - else if (value == 8) snprintf(buf, sizeof(buf), "8/9"); - else snprintf(buf, sizeof(buf), "Auto"); + value = channel->CoderateH(); + if (value == FEC_NONE) snprintf(buf, sizeof(buf), "None"); + else if (value == FEC_1_2) snprintf(buf, sizeof(buf), "1/2"); + else if (value == FEC_2_3) snprintf(buf, sizeof(buf), "2/3"); + else if (value == FEC_3_4) snprintf(buf, sizeof(buf), "3/4"); + else if (value == FEC_4_5) snprintf(buf, sizeof(buf), "4/5"); + else if (value == FEC_5_6) snprintf(buf, sizeof(buf), "5/6"); + else if (value == FEC_6_7) snprintf(buf, sizeof(buf), "6/7"); + else if (value == FEC_7_8) snprintf(buf, sizeof(buf), "7/8"); + else if (value == FEC_8_9) snprintf(buf, sizeof(buf), "8/9"); + else /*FEC_AUTO*/ snprintf(buf, sizeof(buf), "Auto"); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); break; @@ -246,44 +260,46 @@ void cFemonOsd::DrawInfoWindow(void) m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Frequency"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d kHz", Channels.GetByNumber(cDevice::CurrentChannel())->Frequency()); + value = channel->Frequency(); + while (value > 20000) value /= 1000; + snprintf(buf, sizeof(buf), "%d MHz", value); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Source"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%s", cSource::ToString(Channels.GetByNumber(cDevice::CurrentChannel())->Source())); + snprintf(buf, sizeof(buf), "%s", cSource::ToString(channel->Source())); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Srate"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d", Channels.GetByNumber(cDevice::CurrentChannel())->Srate()); + snprintf(buf, sizeof(buf), "%d", channel->Srate()); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Modulation"), clrWhite, clrBackground, m_InfoWindow); - value = Channels.GetByNumber(cDevice::CurrentChannel())->Modulation(); - if (value == 0) snprintf(buf, sizeof(buf), "QPSK"); - else if (value == 1) snprintf(buf, sizeof(buf), "QAM 16"); - else if (value == 2) snprintf(buf, sizeof(buf), "QAM 32"); - else if (value == 3) snprintf(buf, sizeof(buf), "QAM 64"); - else if (value == 4) snprintf(buf, sizeof(buf), "QAM 128"); - else if (value == 5) snprintf(buf, sizeof(buf), "QAM 256"); - else snprintf(buf, sizeof(buf), "QAM Auto"); + value = channel->Modulation(); + if (value == QPSK) snprintf(buf, sizeof(buf), "QPSK"); + else if (value == QAM_16) snprintf(buf, sizeof(buf), "QAM 16"); + else if (value == QAM_32) snprintf(buf, sizeof(buf), "QAM 32"); + else if (value == QAM_64) snprintf(buf, sizeof(buf), "QAM 64"); + else if (value == QAM_128) snprintf(buf, sizeof(buf), "QAM 128"); + else if (value == QAM_256) snprintf(buf, sizeof(buf), "QAM 256"); + else /*QAM_AUTO*/ snprintf(buf, sizeof(buf), "QAM Auto"); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Inversion"), clrWhite, clrBackground, m_InfoWindow); - value = Channels.GetByNumber(cDevice::CurrentChannel())->Inversion(); - if (value == 0) snprintf(buf, sizeof(buf), "Off"); - else if (value == 1) snprintf(buf, sizeof(buf), "On"); - else snprintf(buf, sizeof(buf), "Auto"); + value = channel->Inversion(); + if (value == INVERSION_OFF) snprintf(buf, sizeof(buf), "Off"); + else if (value == INVERSION_ON) snprintf(buf, sizeof(buf), "On"); + else /*INVERSION_AUTO*/ snprintf(buf, sizeof(buf), "Auto"); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("CoderateH"), clrWhite, clrBackground, m_InfoWindow); - value = Channels.GetByNumber(cDevice::CurrentChannel())->CoderateH(); - if (value == 0) snprintf(buf, sizeof(buf), "None"); - else if (value == 1) snprintf(buf, sizeof(buf), "1/2"); - else if (value == 2) snprintf(buf, sizeof(buf), "2/3"); - else if (value == 3) snprintf(buf, sizeof(buf), "3/4"); - else if (value == 4) snprintf(buf, sizeof(buf), "4/5"); - else if (value == 5) snprintf(buf, sizeof(buf), "5/6"); - else if (value == 6) snprintf(buf, sizeof(buf), "6/7"); - else if (value == 7) snprintf(buf, sizeof(buf), "7/8"); - else if (value == 8) snprintf(buf, sizeof(buf), "8/9"); - else snprintf(buf, sizeof(buf), "Auto"); + value = channel->CoderateH(); + if (value == FEC_NONE) snprintf(buf, sizeof(buf), "None"); + else if (value == FEC_1_2) snprintf(buf, sizeof(buf), "1/2"); + else if (value == FEC_2_3) snprintf(buf, sizeof(buf), "2/3"); + else if (value == FEC_3_4) snprintf(buf, sizeof(buf), "3/4"); + else if (value == FEC_4_5) snprintf(buf, sizeof(buf), "4/5"); + else if (value == FEC_5_6) snprintf(buf, sizeof(buf), "5/6"); + else if (value == FEC_6_7) snprintf(buf, sizeof(buf), "6/7"); + else if (value == FEC_7_8) snprintf(buf, sizeof(buf), "7/8"); + else if (value == FEC_8_9) snprintf(buf, sizeof(buf), "8/9"); + else /*FEC_AUTO*/ snprintf(buf, sizeof(buf), "Auto"); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); break; @@ -292,79 +308,82 @@ void cFemonOsd::DrawInfoWindow(void) m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Frequency"), clrWhite, clrBackground, m_InfoWindow); - snprintf(buf, sizeof(buf), "%d kHz", Channels.GetByNumber(cDevice::CurrentChannel())->Frequency() / 1000); + value = channel->Frequency(); + while (value > 20000) value /= 1000; + snprintf(buf, sizeof(buf), "%d MHz", value); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Transmission"), clrWhite, clrBackground, m_InfoWindow); - value = Channels.GetByNumber(cDevice::CurrentChannel())->Transmission(); - if (value == 0) snprintf(buf, sizeof(buf), "2K"); - else if (value == 1) snprintf(buf, sizeof(buf), "8K"); - else snprintf(buf, sizeof(buf), "Auto"); + value = channel->Transmission(); + if (value == TRANSMISSION_MODE_2K) snprintf(buf, sizeof(buf), "2K"); + else if (value == TRANSMISSION_MODE_8K) snprintf(buf, sizeof(buf), "8K"); + else /*TRANSMISSION_MODE_AUTO*/ snprintf(buf, sizeof(buf), "Auto"); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; m_Osd->Text( OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Bandwidth"), clrWhite, clrBackground, m_InfoWindow); - value = Channels.GetByNumber(cDevice::CurrentChannel())->Bandwidth(); - if (value == 0) snprintf(buf, sizeof(buf), "6 MHz"); - else if (value == 1) snprintf(buf, sizeof(buf), "7 MHz"); - else if (value == 2) snprintf(buf, sizeof(buf), "8 MHz"); - else snprintf(buf, sizeof(buf), "Auto"); + value = channel->Bandwidth(); + if (value == BANDWIDTH_8_MHZ) snprintf(buf, sizeof(buf), "8 MHz"); + else if (value == BANDWIDTH_7_MHZ) snprintf(buf, sizeof(buf), "7 MHz"); + else if (value == BANDWIDTH_6_MHZ) snprintf(buf, sizeof(buf), "6 MHz"); + else /*BANDWIDTH_AUTO*/ snprintf(buf, sizeof(buf), "Auto"); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Modulation"), clrWhite, clrBackground, m_InfoWindow); - value = Channels.GetByNumber(cDevice::CurrentChannel())->Modulation(); - if (value == 0) snprintf(buf, sizeof(buf), "QPSK"); - else if (value == 1) snprintf(buf, sizeof(buf), "QAM 16"); - else if (value == 2) snprintf(buf, sizeof(buf), "QAM 32"); - else if (value == 3) snprintf(buf, sizeof(buf), "QAM 64"); - else if (value == 4) snprintf(buf, sizeof(buf), "QAM 128"); - else if (value == 5) snprintf(buf, sizeof(buf), "QAM 256"); - else snprintf(buf, sizeof(buf), "QAM Auto"); + value = channel->Modulation(); + if (value == QPSK) snprintf(buf, sizeof(buf), "QPSK"); + else if (value == QAM_16) snprintf(buf, sizeof(buf), "QAM 16"); + else if (value == QAM_32) snprintf(buf, sizeof(buf), "QAM 32"); + else if (value == QAM_64) snprintf(buf, sizeof(buf), "QAM 64"); + else if (value == QAM_128) snprintf(buf, sizeof(buf), "QAM 128"); + else if (value == QAM_256) snprintf(buf, sizeof(buf), "QAM 256"); + else /*QAM_AUTO*/ snprintf(buf, sizeof(buf), "QAM Auto"); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Inversion"), clrWhite, clrBackground, m_InfoWindow); - value = Channels.GetByNumber(cDevice::CurrentChannel())->Inversion(); - if (value == 0) snprintf(buf, sizeof(buf), "Off"); - else if (value == 1) snprintf(buf, sizeof(buf), "On"); - else snprintf(buf, sizeof(buf), "Auto"); + value = channel->Inversion(); + if (value == INVERSION_OFF) snprintf(buf, sizeof(buf), "Off"); + else if (value == INVERSION_ON) snprintf(buf, sizeof(buf), "On"); + else /*INVERSION_AUTO*/ snprintf(buf, sizeof(buf), "Auto"); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("CoderateH"), clrWhite, clrBackground, m_InfoWindow); - value = Channels.GetByNumber(cDevice::CurrentChannel())->CoderateH(); - if (value == 0) snprintf(buf, sizeof(buf), "None"); - else if (value == 1) snprintf(buf, sizeof(buf), "1/2"); - else if (value == 2) snprintf(buf, sizeof(buf), "2/3"); - else if (value == 3) snprintf(buf, sizeof(buf), "3/4"); - else if (value == 4) snprintf(buf, sizeof(buf), "4/5"); - else if (value == 5) snprintf(buf, sizeof(buf), "5/6"); - else if (value == 6) snprintf(buf, sizeof(buf), "6/7"); - else if (value == 7) snprintf(buf, sizeof(buf), "7/8"); - else if (value == 8) snprintf(buf, sizeof(buf), "8/9"); - else snprintf(buf, sizeof(buf), "Auto"); - value = Channels.GetByNumber(cDevice::CurrentChannel())->CoderateL(); - if (value == 0) snprintf(buf2, sizeof(buf2), " - None"); - else if (value == 1) snprintf(buf2, sizeof(buf2), " - 1/2"); - else if (value == 2) snprintf(buf2, sizeof(buf2), " - 2/3"); - else if (value == 3) snprintf(buf2, sizeof(buf2), " - 3/4"); - else if (value == 4) snprintf(buf2, sizeof(buf2), " - 4/5"); - else if (value == 5) snprintf(buf2, sizeof(buf2), " - 5/6"); - else if (value == 6) snprintf(buf2, sizeof(buf2), " - 6/7"); - else if (value == 7) snprintf(buf2, sizeof(buf2), " - 7/8"); - else if (value == 8) snprintf(buf2, sizeof(buf2), " - 8/9"); - else snprintf(buf2, sizeof(buf2), " - Auto"); + value = channel->CoderateH(); + if (value == FEC_NONE) snprintf(buf, sizeof(buf), "None"); + else if (value == FEC_1_2) snprintf(buf, sizeof(buf), "1/2"); + else if (value == FEC_2_3) snprintf(buf, sizeof(buf), "2/3"); + else if (value == FEC_3_4) snprintf(buf, sizeof(buf), "3/4"); + else if (value == FEC_4_5) snprintf(buf, sizeof(buf), "4/5"); + else if (value == FEC_5_6) snprintf(buf, sizeof(buf), "5/6"); + else if (value == FEC_6_7) snprintf(buf, sizeof(buf), "6/7"); + else if (value == FEC_7_8) snprintf(buf, sizeof(buf), "7/8"); + else if (value == FEC_8_9) snprintf(buf, sizeof(buf), "8/9"); + else /*FEC_AUTO*/ snprintf(buf, sizeof(buf), "Auto"); + value = channel->CoderateL(); + if (value == FEC_NONE) snprintf(buf2, sizeof(buf2), " - None"); + else if (value == FEC_1_2) snprintf(buf2, sizeof(buf2), " - 1/2"); + else if (value == FEC_2_3) snprintf(buf2, sizeof(buf2), " - 2/3"); + else if (value == FEC_3_4) snprintf(buf2, sizeof(buf2), " - 3/4"); + else if (value == FEC_4_5) snprintf(buf2, sizeof(buf2), " - 4/5"); + else if (value == FEC_5_6) snprintf(buf2, sizeof(buf2), " - 5/6"); + else if (value == FEC_6_7) snprintf(buf2, sizeof(buf2), " - 6/7"); + else if (value == FEC_7_8) snprintf(buf2, sizeof(buf2), " - 7/8"); + else if (value == FEC_8_9) snprintf(buf2, sizeof(buf2), " - 8/9"); + else /*FEC_AUTO*/ snprintf(buf2, sizeof(buf2), " - Auto"); strncat(buf, buf2, sizeof(buf)); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); lines++; m_Osd->Text(OSDINFOLCOL1 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Hierarchy"), clrWhite, clrBackground, m_InfoWindow); - value = Channels.GetByNumber(cDevice::CurrentChannel())->Hierarchy(); - if (value == 0) snprintf(buf, sizeof(buf), "None"); - else if (value == 1) snprintf(buf, sizeof(buf), "1"); - else if (value == 2) snprintf(buf, sizeof(buf), "2"); - else snprintf(buf, sizeof(buf), "Auto"); + value = channel->Hierarchy(); + if (value == HIERARCHY_NONE) snprintf(buf, sizeof(buf), "None"); + else if (value == HIERARCHY_1) snprintf(buf, sizeof(buf), "1"); + else if (value == HIERARCHY_2) snprintf(buf, sizeof(buf), "2"); + else if (value == HIERARCHY_4) snprintf(buf, sizeof(buf), "4"); + else /*HIERARCHY_AUTO*/ snprintf(buf, sizeof(buf), "Auto"); m_Osd->Text(OSDINFOLCOL2 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); m_Osd->Text(OSDINFOLCOL3 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), tr("Guard"), clrWhite, clrBackground, m_InfoWindow); - value = Channels.GetByNumber(cDevice::CurrentChannel())->Guard(); - if (value == 0) snprintf(buf, sizeof(buf), "1/4"); - else if (value == 1) snprintf(buf, sizeof(buf), "1/8"); - else if (value == 2) snprintf(buf, sizeof(buf), "1/16"); - else if (value == 3) snprintf(buf, sizeof(buf), "1/32"); - else snprintf(buf, sizeof(buf), "Auto"); + value = channel->Guard(); + if (value == GUARD_INTERVAL_1_32) snprintf(buf, sizeof(buf), "1/32"); + else if (value == GUARD_INTERVAL_1_16) snprintf(buf, sizeof(buf), "1/16"); + else if (value == GUARD_INTERVAL_1_8) snprintf(buf, sizeof(buf), "1/8"); + else if (value == GUARD_INTERVAL_1_4) snprintf(buf, sizeof(buf), "1/4"); + else /*GUARD_INTERVAL_AUTO*/ snprintf(buf, sizeof(buf), "Auto"); m_Osd->Text(OSDINFOLCOL4 * cOsd::CellWidth(), femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT + lines) * cOsd::LineHeight() : lines * cOsd::LineHeight(), buf, clrYellow, clrBackground, m_InfoWindow); break; } @@ -395,6 +414,9 @@ void cFemonOsd::Action(void) CHECK(ioctl(m_Frontend, FE_READ_UNCORRECTED_BLOCKS, &m_UNC)); DrawInfoWindow(); DrawStatusWindow(); + if (femonConfig.syslogoutput) { + isyslog("Card #%d (%s) STR: %04x SNR: %04x BER: %08x UNC: %08x |%c|%c|%c|%c|%c|", cDevice::ActualDevice()->CardIndex(), m_FrontendInfo.name, m_Signal, m_SNR, m_BER, m_UNC, (m_FrontendStatus & FE_HAS_LOCK) ? 'L' : ' ', (m_FrontendStatus & FE_HAS_SIGNAL) ? 'S' : ' ', (m_FrontendStatus & FE_HAS_CARRIER) ? 'C' : ' ', (m_FrontendStatus & FE_HAS_VITERBI) ? 'V' : ' ', (m_FrontendStatus & FE_HAS_SYNC) ? 'Z' : ' '); + } } usleep(100000L * femonConfig.updateinterval); } @@ -407,7 +429,7 @@ void cFemonOsd::Show(void) { //printf("cFemonOsd::Show()\n"); char *dev = NULL; - asprintf(&dev, FE_DEVICE, cDevice::ActualDevice()->CardIndex(), 0); + asprintf(&dev, FRONTEND_DEVICE, cDevice::ActualDevice()->CardIndex(), 0); m_Frontend = open(dev, O_RDONLY | O_NONBLOCK); free(dev); if (m_Frontend < 0) { @@ -421,7 +443,7 @@ void cFemonOsd::Show(void) close(m_Frontend); return; } - m_Osd = cOsd::OpenRaw((720 - OSDWIDTH * cOsd::CellWidth()) / 2, (576 - (OSDSTATUSHEIGHT + OSDINFOHEIGHT + OSDGAPHEIGHT) * cOsd::LineHeight()) / 2); + m_Osd = cOsd::OpenRaw((SCREENWIDTH - OSDWIDTH * cOsd::CellWidth()) / 2, (SCREENHEIGHT - (OSDSTATUSHEIGHT + OSDINFOHEIGHT + OSDGAPHEIGHT) * cOsd::LineHeight()) / 2); if (m_Osd) { m_StatusWindow = m_Osd->Create(0, femonConfig.position ? 0 : (OSDINFOHEIGHT + OSDGAPHEIGHT) * cOsd::LineHeight(), OSDWIDTH * cOsd::CellWidth(), OSDSTATUSHEIGHT * cOsd::LineHeight(), 4); m_InfoWindow = m_Osd->Create(0, femonConfig.position ? (OSDSTATUSHEIGHT + OSDGAPHEIGHT) * cOsd::LineHeight() : 0, OSDWIDTH * cOsd::CellWidth(), OSDINFOHEIGHT * cOsd::LineHeight(), 2); @@ -431,7 +453,8 @@ void cFemonOsd::Show(void) if (m_Receiver) delete m_Receiver; if (femonConfig.showbitrate) { - m_Receiver = new cFemonReceiver(Channels.GetByNumber(cDevice::CurrentChannel())->Ca(), Channels.GetByNumber(cDevice::CurrentChannel())->Vpid(), Channels.GetByNumber(cDevice::CurrentChannel())->Apid1()); + int channelNumber = cDevice::CurrentChannel(); + m_Receiver = new cFemonReceiver(Channels.GetByNumber(channelNumber)->Ca(), Channels.GetByNumber(channelNumber)->Vpid(), Channels.GetByNumber(channelNumber)->Apid1()); cDevice::ActualDevice()->AttachReceiver(m_Receiver); } Start(); @@ -443,7 +466,7 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber) //printf("cFemonOsd::ChannelSwitch()\n"); char *dev = NULL; close(m_Frontend); - asprintf(&dev, FE_DEVICE, cDevice::ActualDevice()->CardIndex(), 0); + asprintf(&dev, FRONTEND_DEVICE, cDevice::ActualDevice()->CardIndex(), 0); m_Frontend = open(dev, O_RDONLY | O_NONBLOCK); free(dev); if (m_Frontend < 0) { @@ -460,7 +483,8 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber) if (m_Receiver) delete m_Receiver; if (femonConfig.showbitrate) { - m_Receiver = new cFemonReceiver(Channels.GetByNumber(cDevice::CurrentChannel())->Ca(), Channels.GetByNumber(cDevice::CurrentChannel())->Vpid(), Channels.GetByNumber(cDevice::CurrentChannel())->Apid1()); + channelNumber = cDevice::CurrentChannel(); + m_Receiver = new cFemonReceiver(Channels.GetByNumber(channelNumber)->Ca(), Channels.GetByNumber(channelNumber)->Vpid(), Channels.GetByNumber(channelNumber)->Apid1()); cDevice::ActualDevice()->AttachReceiver(m_Receiver); } } diff --git a/femonreceiver.c b/femonreceiver.c index 61e0304..5ed0272 100644 --- a/femonreceiver.c +++ b/femonreceiver.c @@ -32,7 +32,7 @@ cFemonReceiver::~cFemonReceiver(void) //printf("cFemonReceiver::~cFemonReceiver()\n"); if (m_Active) { m_Active = false; - Cancel(5); + Cancel(3); } } @@ -60,11 +60,11 @@ void cFemonReceiver::Action(void) { //printf("cFemonReceiver::Action()\n"); #if (VDRVERSNUM < 10300) - isyslog("femon receiver: thread started (pid = %d)", getpid()); + isyslog("femon receiver: thread started (pid = %d)", getpid()); #endif m_Active = true; while (m_Active) { - // should we do some averaging to smooth the bitrates ? + // should we strip the 4 byte header off from TS packet ? m_VideoBitrate = (8.0 * TS_SIZE * m_VideoPacketCount) / (femonConfig.calcinterval * 102.4 * 1024.0); m_VideoPacketCount = 0; m_AudioBitrate = (8.0 * TS_SIZE * m_AudioPacketCount) / (femonConfig.calcinterval * 102.4); @@ -72,6 +72,6 @@ void cFemonReceiver::Action(void) usleep(100000L * femonConfig.calcinterval); } #if (VDRVERSNUM < 10300) - isyslog("femon receiver: thread stopped (pid = %d)", getpid()); + isyslog("femon receiver: thread stopped (pid = %d)", getpid()); #endif } diff --git a/femonreceiver.h b/femonreceiver.h index ece272d..9fe4e79 100644 --- a/femonreceiver.h +++ b/femonreceiver.h @@ -32,8 +32,8 @@ public: cFemonReceiver(int Ca, int Vpid, int Apid); virtual ~cFemonReceiver(); - double VideoBitrate(void) { return m_VideoBitrate; }; - double AudioBitrate(void) { return m_AudioBitrate; }; + double VideoBitrate(void) { return m_VideoBitrate; }; // Mbit/s + double AudioBitrate(void) { return m_AudioBitrate; }; // kbit/s }; #endif //__FEMONRECEIVER_H