From c6ac49bfed705630fdcf6ec6800990f15b0fd92b Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Fri, 27 Feb 2004 04:20:00 +0200 Subject: [PATCH] Some minor cosmetic changes. --- HISTORY | 4 ++++ README | 8 +++++--- femon.c | 6 ++++-- femon.h | 3 +-- femonosd.c | 28 +++++++++++++++------------- femonosd.h | 2 +- femonreceiver.c | 10 +++++----- femonreceiver.h | 1 + 8 files changed, 36 insertions(+), 26 deletions(-) diff --git a/HISTORY b/HISTORY index dbfbe63..1a22fc6 100644 --- a/HISTORY +++ b/HISTORY @@ -12,3 +12,7 @@ VDR Plugin 'femon' Revision History 2004-02-26: Version 0.0.2 - Added preliminary video (VPID) and audio (APID1) bitrate calculations. + +2004-02-27: Version 0.0.2b + +- Some minor cosmetic changes. diff --git a/README b/README index d23052f..04eec4c 100644 --- a/README +++ b/README @@ -26,7 +26,7 @@ further information). The other parts of plugin code are borrowed from the excellent OSD Picture-In-Picture plugin by Sascha Volkenandt and Andreas Regel . Props to Sascha for being brave enough to test this piece of junk and ofcourse for german translations. The bitrate -calculation algorithm is copied from dvbstream application by Dave Chapman +calculation algorithm is originally copied from dvbstream application by Dave Chapman . Shortcomings / Todo list: @@ -38,5 +38,7 @@ Shortcomings / Todo list: multiple frontends even exist?), because I haven't yet figured howto do it without patching the VDR core. - Sometimes (read always) ttxtsubs plugin messes up the OSD - user should disable - ttxtsubs, but closing and reopening the femon plugin might help as well. BTW. the - same things happens with OSDTeletext plugin too :) + ttxtsubs, but closing and reopening the femon plugin might help temporarily as 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 + the ElchiAIO4a+ patch to maximize the *wow* effect :) diff --git a/femon.c b/femon.c index 50e18de..e60d811 100644 --- a/femon.c +++ b/femon.c @@ -6,9 +6,11 @@ * $Id$ */ -#include "femon.h" -#include "femonosd.h" +#include "femoncfg.h" #include "femoni18n.h" +#include "femonreceiver.h" +#include "femonosd.h" +#include "femon.h" cPluginFemon::cPluginFemon(void) { diff --git a/femon.h b/femon.h index 9a4e3ce..8fcd467 100644 --- a/femon.h +++ b/femon.h @@ -2,9 +2,8 @@ #define __FEMON_H #include -#include "femoncfg.h" -static const char *VERSION = "0.0.2"; +static const char *VERSION = "0.0.2b"; static const char *DESCRIPTION = "DVB Signal Quality Monitor (OSD)"; static const char *MAINMENUENTRY = "Signal Quality"; diff --git a/femonosd.c b/femonosd.c index 0bcc2a8..601a4d8 100644 --- a/femonosd.c +++ b/femonosd.c @@ -7,6 +7,7 @@ */ #include "femoncfg.h" +#include "femonreceiver.h" #include "femonosd.h" #define FE_DEVICE "/dev/dvb/adapter%d/frontend%d" @@ -60,6 +61,9 @@ void cFemonOsd::Action(void) double VRate = 0.0; double ARate = 0.0; +#if (VDRVERSNUM < 10300) + isyslog("femon plugin: thread started (pid = %d)", getpid()); +#endif m_Active = true; while (m_Active) { if (m_Frontend != -1) { @@ -73,23 +77,17 @@ void cFemonOsd::Action(void) #if (VDRVERSNUM >= 10300) || defined(ELCHIAIOVERSION) eDvbFont OldFont = m_Osd->SetFont(fontSml); #endif - sprintf(buf, "%d %s", cDevice::CurrentChannel(), Channels.GetByNumber(cDevice::CurrentChannel())->Name()); + sprintf(buf, "%d%s%s", m_Number ? m_Number : cDevice::CurrentChannel(), m_Number ? "- " : " ", Channels.GetByNumber(cDevice::CurrentChannel())->Name()); m_Osd->Fill(0, 0, m_Width, cOsd::LineHeight() - 1, clrWhite, m_Window); m_Osd->Text(cOsd::CellWidth(), 0, buf, clrBlack, clrWhite, m_Window); if (m_Receiver) { // do some averaging to smooth the value - VRate = (VRate + (m_Receiver->VideoPacketCount() * 184.0 * 8.0) / (femonConfig.interval * 102.4 * 1024.0)) / 2.0; - ARate = (ARate + (m_Receiver->AudioPacketCount() * 184.0 * 8.0) / (femonConfig.interval * 102.4 * 1024.0)) / 2.0; - sprintf(buf, "V: %.1f Mbit/s\n", VRate); -#if (VDRVERSNUM >= 10300) || defined(ELCHIAIOVERSION) - m_Osd->Text((m_Width - 20 * cOsd::CellWidth()), 0, buf, clrBlack, clrWhite, m_Window); - sprintf(buf, "A: %.1f Mbit/s\n", ARate); - m_Osd->Text((m_Width - 10 * cOsd::CellWidth()), 0, buf, clrBlack, clrWhite, m_Window); -#else + VRate = (VRate + (8.0 * TS_SIZE * m_Receiver->VideoPacketCount()) / (femonConfig.interval * 102.4 * 1024.0)) / 2.0; + ARate = (ARate + (8.0 * TS_SIZE * m_Receiver->AudioPacketCount()) / (femonConfig.interval * 102.4)) / 2.0; + sprintf(buf, "V: %.2f Mbit/s", VRate); m_Osd->Text((m_Width - 22 * cOsd::CellWidth()), 0, buf, clrBlack, clrWhite, m_Window); - sprintf(buf, "A: %.1f Mbit/s\n", ARate); - m_Osd->Text((m_Width - 11 * cOsd::CellWidth()), 0, buf, clrBlack, clrWhite, m_Window); -#endif + sprintf(buf, "A: %.0f kbit/s", ARate); + m_Osd->Text((m_Width - 10 * cOsd::CellWidth()), 0, buf, clrBlack, clrWhite, m_Window); } sprintf(buf, "STR: %04x", signal); m_Osd->Text(cOsd::CellWidth(), 3 * cOsd::LineHeight(), buf, clrWhite, clrBackground, m_Window); @@ -144,6 +142,9 @@ void cFemonOsd::Action(void) } usleep(100000L * femonConfig.interval); } +#if (VDRVERSNUM < 10300) + isyslog("femon plugin: thread stopped (pid = %d)", getpid()); +#endif } void cFemonOsd::Show(void) @@ -191,7 +192,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); // only the first frontend$ + asprintf(&dev, FE_DEVICE, cDevice::ActualDevice()->CardIndex(), 0); m_Frontend = open(dev, O_RDONLY | O_NONBLOCK); free(dev); if (m_Frontend < 0) { @@ -203,6 +204,7 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber) isyslog("cFemonOsd::ChannelSwitch() cannot read frontend info."); m_Frontend = -1; close(m_Frontend); + return; } if (m_Receiver) delete m_Receiver; diff --git a/femonosd.h b/femonosd.h index fc411de..6d5765d 100644 --- a/femonosd.h +++ b/femonosd.h @@ -9,7 +9,7 @@ #include #include #include -#include "femonreceiver.h" +#include // only for TS_SIZE class cFemonOsd : public cOsdObject, public cThread, public cStatus { private: diff --git a/femonreceiver.c b/femonreceiver.c index 183a33f..556281d 100644 --- a/femonreceiver.c +++ b/femonreceiver.c @@ -8,8 +8,6 @@ #include "femonreceiver.h" -#define TS_SIZE 188 - cFemonReceiver::cFemonReceiver(int Ca, int Vpid, int Apid) :cReceiver(Ca, -1, 2, Vpid, Apid) { @@ -34,11 +32,13 @@ void cFemonReceiver::Receive(uchar *Data, int Length) { //printf("cFemonReceiver::Receive()\n"); if (Length == TS_SIZE) { - int pid = ((Data[1]&0x1f) << 8) | (Data[2]); - if (pid == m_VPid) + int pid = ((Data[1] & 0x1f) << 8) | (Data[2]); + if (pid == m_VPid) { m_VideoCount++; - if (pid == m_APid) + } + else if (pid == m_APid) { m_AudioCount++; + } } } diff --git a/femonreceiver.h b/femonreceiver.h index 8451e50..7b80630 100644 --- a/femonreceiver.h +++ b/femonreceiver.h @@ -1,6 +1,7 @@ #ifndef __FEMONRECEIVER_H #define __FEMONRECEIVER_H +#include // only for TS_SIZE #include class cFemonReceiver : public cReceiver {