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

Some minor cosmetic changes.

This commit is contained in:
Rolf Ahrenberg 2004-02-27 04:20:00 +02:00
parent 2d06d2c6c1
commit c6ac49bfed
8 changed files with 36 additions and 26 deletions

View File

@ -12,3 +12,7 @@ VDR Plugin 'femon' Revision History
2004-02-26: Version 0.0.2 2004-02-26: Version 0.0.2
- Added preliminary video (VPID) and audio (APID1) bitrate calculations. - Added preliminary video (VPID) and audio (APID1) bitrate calculations.
2004-02-27: Version 0.0.2b
- Some minor cosmetic changes.

8
README
View File

@ -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 <sascha@akv-soft.de> excellent OSD Picture-In-Picture plugin by Sascha Volkenandt <sascha@akv-soft.de>
and Andreas Regel <andreas.regel@powarman.de>. Props to Sascha for being brave and Andreas Regel <andreas.regel@powarman.de>. Props to Sascha for being brave
enough to test this piece of junk and ofcourse for german translations. The bitrate 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
<dave@dchapman.com>. <dave@dchapman.com>.
Shortcomings / Todo list: Shortcomings / Todo list:
@ -38,5 +38,7 @@ Shortcomings / Todo list:
multiple frontends even exist?), because I haven't yet figured howto do it without multiple frontends even exist?), because I haven't yet figured howto do it without
patching the VDR core. patching the VDR core.
- Sometimes (read always) ttxtsubs plugin messes up the OSD - user should disable - 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 ttxtsubs, but closing and reopening the femon plugin might help temporarily as well.
same things happens with OSDTeletext plugin too :) 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 :)

View File

@ -6,9 +6,11 @@
* $Id$ * $Id$
*/ */
#include "femon.h" #include "femoncfg.h"
#include "femonosd.h"
#include "femoni18n.h" #include "femoni18n.h"
#include "femonreceiver.h"
#include "femonosd.h"
#include "femon.h"
cPluginFemon::cPluginFemon(void) cPluginFemon::cPluginFemon(void)
{ {

View File

@ -2,9 +2,8 @@
#define __FEMON_H #define __FEMON_H
#include <vdr/plugin.h> #include <vdr/plugin.h>
#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 *DESCRIPTION = "DVB Signal Quality Monitor (OSD)";
static const char *MAINMENUENTRY = "Signal Quality"; static const char *MAINMENUENTRY = "Signal Quality";

View File

@ -7,6 +7,7 @@
*/ */
#include "femoncfg.h" #include "femoncfg.h"
#include "femonreceiver.h"
#include "femonosd.h" #include "femonosd.h"
#define FE_DEVICE "/dev/dvb/adapter%d/frontend%d" #define FE_DEVICE "/dev/dvb/adapter%d/frontend%d"
@ -60,6 +61,9 @@ void cFemonOsd::Action(void)
double VRate = 0.0; double VRate = 0.0;
double ARate = 0.0; double ARate = 0.0;
#if (VDRVERSNUM < 10300)
isyslog("femon plugin: thread started (pid = %d)", getpid());
#endif
m_Active = true; m_Active = true;
while (m_Active) { while (m_Active) {
if (m_Frontend != -1) { if (m_Frontend != -1) {
@ -73,23 +77,17 @@ void cFemonOsd::Action(void)
#if (VDRVERSNUM >= 10300) || defined(ELCHIAIOVERSION) #if (VDRVERSNUM >= 10300) || defined(ELCHIAIOVERSION)
eDvbFont OldFont = m_Osd->SetFont(fontSml); eDvbFont OldFont = m_Osd->SetFont(fontSml);
#endif #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->Fill(0, 0, m_Width, cOsd::LineHeight() - 1, clrWhite, m_Window);
m_Osd->Text(cOsd::CellWidth(), 0, buf, clrBlack, clrWhite, m_Window); m_Osd->Text(cOsd::CellWidth(), 0, buf, clrBlack, clrWhite, m_Window);
if (m_Receiver) { if (m_Receiver) {
// do some averaging to smooth the value // do some averaging to smooth the value
VRate = (VRate + (m_Receiver->VideoPacketCount() * 184.0 * 8.0) / (femonConfig.interval * 102.4 * 1024.0)) / 2.0; VRate = (VRate + (8.0 * TS_SIZE * m_Receiver->VideoPacketCount()) / (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; ARate = (ARate + (8.0 * TS_SIZE * m_Receiver->AudioPacketCount()) / (femonConfig.interval * 102.4)) / 2.0;
sprintf(buf, "V: %.1f Mbit/s\n", VRate); sprintf(buf, "V: %.2f Mbit/s", 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
m_Osd->Text((m_Width - 22 * cOsd::CellWidth()), 0, buf, clrBlack, clrWhite, m_Window); m_Osd->Text((m_Width - 22 * cOsd::CellWidth()), 0, buf, clrBlack, clrWhite, m_Window);
sprintf(buf, "A: %.1f Mbit/s\n", ARate); sprintf(buf, "A: %.0f kbit/s", ARate);
m_Osd->Text((m_Width - 11 * cOsd::CellWidth()), 0, buf, clrBlack, clrWhite, m_Window); m_Osd->Text((m_Width - 10 * cOsd::CellWidth()), 0, buf, clrBlack, clrWhite, m_Window);
#endif
} }
sprintf(buf, "STR: %04x", signal); sprintf(buf, "STR: %04x", signal);
m_Osd->Text(cOsd::CellWidth(), 3 * cOsd::LineHeight(), buf, clrWhite, clrBackground, m_Window); 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); usleep(100000L * femonConfig.interval);
} }
#if (VDRVERSNUM < 10300)
isyslog("femon plugin: thread stopped (pid = %d)", getpid());
#endif
} }
void cFemonOsd::Show(void) void cFemonOsd::Show(void)
@ -191,7 +192,7 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber)
//printf("cFemonOsd::ChannelSwitch()\n"); //printf("cFemonOsd::ChannelSwitch()\n");
char *dev = NULL; char *dev = NULL;
close(m_Frontend); 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); m_Frontend = open(dev, O_RDONLY | O_NONBLOCK);
free(dev); free(dev);
if (m_Frontend < 0) { if (m_Frontend < 0) {
@ -203,6 +204,7 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber)
isyslog("cFemonOsd::ChannelSwitch() cannot read frontend info."); isyslog("cFemonOsd::ChannelSwitch() cannot read frontend info.");
m_Frontend = -1; m_Frontend = -1;
close(m_Frontend); close(m_Frontend);
return;
} }
if (m_Receiver) if (m_Receiver)
delete m_Receiver; delete m_Receiver;

View File

@ -9,7 +9,7 @@
#include <vdr/status.h> #include <vdr/status.h>
#include <vdr/channels.h> #include <vdr/channels.h>
#include <vdr/font.h> #include <vdr/font.h>
#include "femonreceiver.h" #include <vdr/device.h> // only for TS_SIZE
class cFemonOsd : public cOsdObject, public cThread, public cStatus { class cFemonOsd : public cOsdObject, public cThread, public cStatus {
private: private:

View File

@ -8,8 +8,6 @@
#include "femonreceiver.h" #include "femonreceiver.h"
#define TS_SIZE 188
cFemonReceiver::cFemonReceiver(int Ca, int Vpid, int Apid) cFemonReceiver::cFemonReceiver(int Ca, int Vpid, int Apid)
:cReceiver(Ca, -1, 2, Vpid, Apid) :cReceiver(Ca, -1, 2, Vpid, Apid)
{ {
@ -35,12 +33,14 @@ void cFemonReceiver::Receive(uchar *Data, int Length)
//printf("cFemonReceiver::Receive()\n"); //printf("cFemonReceiver::Receive()\n");
if (Length == TS_SIZE) { if (Length == TS_SIZE) {
int pid = ((Data[1] & 0x1f) << 8) | (Data[2]); int pid = ((Data[1] & 0x1f) << 8) | (Data[2]);
if (pid == m_VPid) if (pid == m_VPid) {
m_VideoCount++; m_VideoCount++;
if (pid == m_APid) }
else if (pid == m_APid) {
m_AudioCount++; m_AudioCount++;
} }
} }
}
int cFemonReceiver::VideoPacketCount(void) int cFemonReceiver::VideoPacketCount(void)
{ {

View File

@ -1,6 +1,7 @@
#ifndef __FEMONRECEIVER_H #ifndef __FEMONRECEIVER_H
#define __FEMONRECEIVER_H #define __FEMONRECEIVER_H
#include <vdr/device.h> // only for TS_SIZE
#include <vdr/receiver.h> #include <vdr/receiver.h>
class cFemonReceiver : public cReceiver { class cFemonReceiver : public cReceiver {