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

Compare commits

..

4 Commits

Author SHA1 Message Date
Rolf Ahrenberg
52b9653b42 Translation only update:
Fixed 'Deutsch' (Thanks to Olaf Henkel @ VDRPortal).
Added 'Italiano' (Thanks to Sean Carlos).
2004-02-28 04:20:00 +02:00
Rolf Ahrenberg
c6ac49bfed Some minor cosmetic changes. 2004-02-27 04:20:00 +02:00
Rolf Ahrenberg
2d06d2c6c1 Added preliminary video (VPID) and audio (APID1) bitrate calculations. 2004-02-26 04:20:00 +02:00
Rolf Ahrenberg
26918d18ce Fixed cThread to work under vdr-1.2.6. 2004-02-23 04:20:00 +02:00
11 changed files with 175 additions and 31 deletions

18
HISTORY
View File

@@ -4,3 +4,21 @@ VDR Plugin 'femon' Revision History
2004-02-15: Version 0.0.1
- Initial revision.
2004-02-23: Version 0.0.1b
- Fixed cThread to work under vdr-1.2.6.
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.
2004-02-28: Version 0.0.2c
- Translation only update:
Fixed 'Deutsch' (Thanks to Olaf Henkel @ VDRPortal).
Added 'Italiano' (Thanks to Sean Carlos).

View File

@@ -46,7 +46,7 @@ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
### The object files (add further files here):
OBJS = femon.o femonosd.o femoncfg.o femoni18n.o
OBJS = femon.o femonosd.o femonreceiver.o femoncfg.o femoni18n.o
### Implicit rules:

11
README
View File

@@ -25,7 +25,9 @@ The plugin is based on a neat console frontend status monitor application called
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>
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.
enough to test this piece of junk and ofcourse for german translations. The bitrate
calculation algorithm is originally copied from dvbstream application by Dave Chapman
<dave@dchapman.com>.
Shortcomings / Todo list:
@@ -36,6 +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 :)
- Where's the bitrate!?
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 :)

View File

@@ -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)
{
@@ -76,7 +78,7 @@ cMenuFemonSetup::cMenuFemonSetup(void)
{
Add(new cMenuEditBoolItem(tr("Hide Mainmenu Entry"), &femonConfig.hidemenu, tr("no"), tr("yes")));
Add(new cMenuEditBoolItem(tr("Position"), &femonConfig.position, tr("bottom"), tr("top")));
Add(new cMenuEditIntItem( tr("Update Interval [0.1s]"), &femonConfig.interval, 1, 20));
Add(new cMenuEditIntItem( tr("Update Interval [0.1s]"), &femonConfig.interval, 5, 50));
Add(new cMenuEditIntItem( tr("Red Limit [%]"), &femonConfig.redlimit, 1, 50));
Add(new cMenuEditIntItem( tr("Green Limit [%]"), &femonConfig.greenlimit, 51, 100));
}

View File

@@ -2,9 +2,8 @@
#define __FEMON_H
#include <vdr/plugin.h>
#include "femoncfg.h"
static const char *VERSION = "0.0.1";
static const char *VERSION = "0.0.2c";
static const char *DESCRIPTION = "DVB Signal Quality Monitor (OSD)";
static const char *MAINMENUENTRY = "Signal Quality";

View File

@@ -14,7 +14,7 @@ cFemonConfig::cFemonConfig(void)
{
hidemenu = 0;
position = 1;
interval = 5;
interval = 10;
redlimit = 33;
greenlimit = 66;
}

View File

@@ -12,7 +12,7 @@ const tI18nPhrase Phrases[] = {
{ "DVB Signal Quality Monitor (OSD)", // English
"DVB Signalqualit<69>ts-Anzeige (OSD)", // Deutsch
"", // Slovenski
"", // Italiano
"Visualizzazione della qualita' del segnale DVB (OSD)", // Italiano
"", // Nederlands
"", // Portugu<67>s
"", // Fran<61>ais
@@ -30,9 +30,9 @@ const tI18nPhrase Phrases[] = {
#endif
},
{ "Signal Quality", // English
"SIgnalqualit<EFBFBD>t", // Deutsch
"Signalqualit<EFBFBD>t", // Deutsch
"", // Slovenski
"", // Italiano
"Qualita' del segnale", // Italiano
"", // Nederlands
"", // Portugu<67>s
"", // Fran<61>ais
@@ -52,7 +52,7 @@ const tI18nPhrase Phrases[] = {
{ "Position", // English
"Position", // Deutsch
"", // Slovenski
"", // Italiano
"Posizione", // Italiano
"", // Nederlands
"", // Portugu<67>s
"", // Fran<61>ais
@@ -72,7 +72,7 @@ const tI18nPhrase Phrases[] = {
{ "Hide Mainmenu Entry", // English
"Hauptmen<EFBFBD>eintrag verstecken", // Deutsch
"", // Slovenski
"", // Italiano
"Nascondere Voce Menu", // Italiano
"", // Nederlands
"", // Portugu<67>s
"", // Fran<61>ais
@@ -92,7 +92,7 @@ const tI18nPhrase Phrases[] = {
{ "Update Interval [0.1s]", // English
"Aktualisierung alle [0.1s]", // Deutsch
"", // Slovenski
"", // Italiano
"Intervallo di aggiornamento [0.1s]", // Italiano
"", // Nederlands
"", // Portugu<67>s
"", // Fran<61>ais
@@ -112,7 +112,7 @@ const tI18nPhrase Phrases[] = {
{ "Red Limit [%]", // English
"Grenze Rot [%]", // Deutsch
"", // Slovenski
"", // Italiano
"Limite Rosso [%]", // Italiano
"", // Nederlands
"", // Portugu<67>s
"", // Fran<61>ais
@@ -132,7 +132,7 @@ const tI18nPhrase Phrases[] = {
{ "Green Limit [%]", // English
"Grenze Gr<47>n [%]", // Deutsch
"", // Slovenski
"", // Italiano
"Limite Verde [%]", // Italiano
"", // Nederlands
"", // Portugu<67>s
"", // Fran<61>ais

View File

@@ -6,20 +6,26 @@
* $Id$
*/
#include "femonosd.h"
#include "femoncfg.h"
#include "femonreceiver.h"
#include "femonosd.h"
#define FEMON_DEVICE "/dev/dvb/adapter%d/frontend%d"
#define FE_DEVICE "/dev/dvb/adapter%d/frontend%d"
#define CHANNELINPUT_TIMEOUT 1000
#define CHANNELINFO_TIMEOUT 5000
#define OSDHEIGHT 5
cFemonOsd::cFemonOsd(void)
#if VDRVERSNUM >= 10300
:cOsdObject(true), cThread("femon plugin")
#else
:cOsdObject(true), cThread()
#endif
{
//printf("cFemonOsd::cFemonOsd()\n");
m_Osd = NULL;
m_Window = -1;
m_Receiver = NULL;
m_Frontend = -1;
m_Active = false;
m_Number = 0;
@@ -38,6 +44,8 @@ cFemonOsd::~cFemonOsd(void)
m_Active = false;
Cancel(3);
}
if (m_Receiver)
delete m_Receiver;
if (m_Osd)
delete m_Osd;
}
@@ -50,7 +58,12 @@ void cFemonOsd::Action(void)
uint32_t ber, unc;
fe_status_t fe_status;
char buf[128];
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) {
@@ -64,9 +77,18 @@ 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 + (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: %.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);
sprintf(buf, "SNR: %04x", snr);
@@ -120,15 +142,18 @@ void cFemonOsd::Action(void)
}
usleep(100000L * femonConfig.interval);
}
#if (VDRVERSNUM < 10300)
isyslog("femon plugin: thread stopped (pid = %d)", getpid());
#endif
}
void cFemonOsd::Show(void)
{
//printf("cFemonOsd::Show()\n");
char *fedev = NULL;
asprintf(&fedev, FEMON_DEVICE, cDevice::ActualDevice()->CardIndex(), 0); // only the first frontend supported
m_Frontend = open(fedev, O_RDONLY | O_NONBLOCK);
free(fedev);
char *dev = NULL;
asprintf(&dev, FE_DEVICE, cDevice::ActualDevice()->CardIndex(), 0);
m_Frontend = open(dev, O_RDONLY | O_NONBLOCK);
free(dev);
if (m_Frontend < 0) {
isyslog("cFemonOsd::Show() cannot open frontend device.");
m_Frontend = -1;
@@ -138,6 +163,7 @@ void cFemonOsd::Show(void)
isyslog("cFemonOsd::Show() cannot read frontend info.");
m_Frontend = -1;
close(m_Frontend);
return;
}
m_InfoTime = time_ms();
m_Osd = cOsd::OpenRaw(m_Xpos, m_Ypos);
@@ -153,6 +179,10 @@ void cFemonOsd::Show(void)
m_Osd->AddColor(clrTransparent, m_Window);
m_Osd->Clear(m_Window);
m_Osd->Flush();
if (m_Receiver)
delete m_Receiver;
m_Receiver = new cFemonReceiver(Channels.GetByNumber(cDevice::CurrentChannel())->Ca(), Channels.GetByNumber(cDevice::CurrentChannel())->Vpid(), Channels.GetByNumber(cDevice::CurrentChannel())->Apid1());
cDevice::ActualDevice()->AttachReceiver(m_Receiver);
Start();
}
}
@@ -160,12 +190,11 @@ void cFemonOsd::Show(void)
void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber)
{
//printf("cFemonOsd::ChannelSwitch()\n");
char *fedev = NULL;
char *dev = NULL;
close(m_Frontend);
asprintf(&fedev, FEMON_DEVICE, cDevice::ActualDevice()->CardIndex(), 0); // only the first frontend$
m_Frontend = open(fedev, O_RDONLY | O_NONBLOCK);
free(fedev);
asprintf(&dev, FE_DEVICE, cDevice::ActualDevice()->CardIndex(), 0);
m_Frontend = open(dev, O_RDONLY | O_NONBLOCK);
free(dev);
if (m_Frontend < 0) {
isyslog("cFemonOsd::ChannelSwitch() cannot open frontend device.");
m_Frontend = -1;
@@ -175,7 +204,12 @@ 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;
m_Receiver = new cFemonReceiver(Channels.GetByNumber(cDevice::CurrentChannel())->Ca(), Channels.GetByNumber(cDevice::CurrentChannel())->Vpid(), Channels.GetByNumber(cDevice::CurrentChannel())->Apid1());
cDevice::ActualDevice()->AttachReceiver(m_Receiver);
m_InfoTime = time_ms();
}

View File

@@ -9,12 +9,14 @@
#include <vdr/status.h>
#include <vdr/channels.h>
#include <vdr/font.h>
#include <vdr/device.h> // only for TS_SIZE
class cFemonOsd : public cOsdObject, public cThread, public cStatus {
private:
bool m_Active;
cOsdBase *m_Osd;
tWindowHandle m_Window;
cFemonReceiver *m_Receiver;
int m_Frontend;
struct dvb_frontend_info m_FrontendInfo;
int m_Number;

59
femonreceiver.c Normal file
View File

@@ -0,0 +1,59 @@
/*
* A Frontend Monitor plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id$
*/
#include "femonreceiver.h"
cFemonReceiver::cFemonReceiver(int Ca, int Vpid, int Apid)
:cReceiver(Ca, -1, 2, Vpid, Apid)
{
//printf("cFemonReceiver::cFemonReceiver()\n");
m_VPid = Vpid;
m_APid = Apid;
m_VideoCount = 0;
m_AudioCount = 0;
}
cFemonReceiver::~cFemonReceiver(void)
{
//printf("cFemonReceiver::~cFemonReceiver()\n");
}
void cFemonReceiver::Activate(bool On)
{
//printf("cFemonReceiver::Activate()\n");
}
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) {
m_VideoCount++;
}
else if (pid == m_APid) {
m_AudioCount++;
}
}
}
int cFemonReceiver::VideoPacketCount(void)
{
//printf("cFemonReceiver::VideoPacketCount()\n");
int count = m_VideoCount;
m_VideoCount = 0;
return count;
}
int cFemonReceiver::AudioPacketCount(void)
{
//printf("cFemonReceiver::AudioPacketCount()\n");
int count = m_AudioCount;
m_AudioCount = 0;
return count;
}

27
femonreceiver.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef __FEMONRECEIVER_H
#define __FEMONRECEIVER_H
#include <vdr/device.h> // only for TS_SIZE
#include <vdr/receiver.h>
class cFemonReceiver : public cReceiver {
private:
int m_VPid;
int m_APid;
int m_VideoCount;
int m_AudioCount;
protected:
virtual void Activate(bool On);
virtual void Receive(uchar *Data, int Length);
public:
cFemonReceiver(int Ca, int Vpid, int Apid);
virtual ~cFemonReceiver();
int VideoPacketCount(void);
int AudioPacketCount(void);
};
#endif //__FEMONRECEIVER_H