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

Backported changes and fixes from version 0.1.2.

This commit is contained in:
Rolf Ahrenberg 2004-06-06 04:20:00 +03:00
parent b08205607c
commit 9ce3009e39
7 changed files with 146 additions and 58 deletions

10
HISTORY
View File

@ -50,6 +50,10 @@ VDR Plugin 'femon' Revision History
- Backported "stream information" feature (from version 0.1.1).
2004-06-06: Version 0.0.5
- Backported changes and fixes from version 0.1.2.
-------------------------
2004-05-18: Version 0.1.0
@ -63,3 +67,9 @@ VDR Plugin 'femon' Revision History
.-> basic -> transponder -> stream -.
`-----------------------------------´
- Added missing german translations (Thanks to Peter Marquardt).
2004-06-06: Version 0.1.2
- Fixed the channel switch bug (reported by Stefan Lucke).
- Nid/Tid/Rid are now included in translations.
- Added video format and aspect ratio symbols into status window.

13
README
View File

@ -12,7 +12,7 @@ Requirements:
Ph.D. in Astro Physics and preferably a six-pack waiting in a fridge.
Never trust a Klingon. "Qu'vaD lI' De'vam". Beam me up, Scotty!
You're number six! I'm number two.
You're number six! I'm number two. YARRR!
Description:
@ -22,11 +22,11 @@ channels and the plugin should be monitoring always the right frontend. The
transponder and stream information are also available in advanced display modes.
User can switch between different display modes by pressing 'OK' key.
The plugin is based on a neat console frontend status monitor application called
'femon' by Johannes Stezenbach <js@convergence.de> (see DVB-apps/szap/femon.c
for further information). The other parts of plugin code are borrowed from the
excellent 'OSD Picture-In-Picture' plugin by Sascha Volkenandt and Andreas Regel.
The bitrate calculation algorithm originates from the 'dvbstream' application by
The plugin is based on a neat console frontend status monitor application
called 'femon' by Johannes Stezenbach (see DVB-apps/szap/femon.c for further
information). The other parts of plugin code are borrowed from the excellent
'OSD Picture-In-Picture' plugin by Sascha Volkenandt and Andreas Regel. The
bitrate calculation algorithm originates from the 'dvbstream' application by
Dave Chapman and the stream information routines from the 'libdvb' library by
Metzler Brothers.
@ -39,4 +39,3 @@ Shortcomings / Todo list / Important Notes:
ttxtsubs, but closing and reopening the femon plugin might help temporarily as
well. Btw., this same thing happens with OSDTeletext plugin too :)
- Disable the stream analyze to speed up heavy zapping sessions.
- If you're using VDR version 1.3.6 or older, you'll have to stick with femon-0.0.4!

View File

@ -11,7 +11,7 @@
#include <vdr/plugin.h>
static const char *VERSION = "0.0.4";
static const char *VERSION = "0.0.5";
static const char *DESCRIPTION = "DVB Signal Information Monitor (OSD)";
static const char *MAINMENUENTRY = "Signal Information";

View File

@ -517,7 +517,7 @@ const tI18nPhrase Phrases[] = {
"Auto", // Português
"Auto", // Français
"Auto", // Norsk
"Auto", // suomi
"auto", // suomi
"Auto", // Polski
"Auto", // Español
"Auto", // ÅëëçíéêÜ (Greek)
@ -537,7 +537,7 @@ const tI18nPhrase Phrases[] = {
"None", // Português
"None", // Français
"None", // Norsk
"None", // suomi
"ei", // suomi
"None", // Polski
"None", // Español
"None", // ÅëëçíéêÜ (Greek)
@ -557,7 +557,7 @@ const tI18nPhrase Phrases[] = {
"Off", // Português
"Off", // Français
"Off", // Norsk
"Off", // suomi
"poissa", // suomi
"Off", // Polski
"Off", // Español
"Off", // ÅëëçíéêÜ (Greek)
@ -577,7 +577,7 @@ const tI18nPhrase Phrases[] = {
"On", // Português
"On", // Français
"On", // Norsk
"On", // suomi
"päällä", // suomi
"On", // Polski
"On", // Español
"On", // ÅëëçíéêÜ (Greek)
@ -1007,6 +1007,66 @@ const tI18nPhrase Phrases[] = {
"", // Català
#if VDRVERSNUM >= 10302
"", // ÀãááÚØÙ (Russian)
#endif
},
{ "Nid", // English
"Nid", // Deutsch
"Nid", // Slovenski
"Nid", // Italiano
"Nid", // Nederlands
"Nid", // Português
"Nid", // Français
"Nid", // Norsk
"Verkko ID", // suomi
"Nid", // Polski
"Nid", // Español
"Nid", // ÅëëçíéêÜ (Greek)
"Nid", // Svenska
"Nid", // Romaneste
"Nid", // Magyar
"Nid", // Català
#if VDRVERSNUM >= 10302
"Nid", // ÀãááÚØÙ (Russian)
#endif
},
{ "Tid", // English
"Tid", // Deutsch
"Tid", // Slovenski
"Tid", // Italiano
"Tid", // Nederlands
"Tid", // Português
"Tid", // Français
"Tid", // Norsk
"Lähete ID", // suomi
"Tid", // Polski
"Tid", // Español
"Tid", // ÅëëçíéêÜ (Greek)
"Tid", // Svenska
"Tid", // Romaneste
"Tid", // Magyar
"Tid", // Català
#if VDRVERSNUM >= 10302
"Tid", // ÀãááÚØÙ (Russian)
#endif
},
{ "Rid", // English
"Rid", // Deutsch
"Rid", // Slovenski
"Rid", // Italiano
"Rid", // Nederlands
"Rid", // Português
"Rid", // Français
"Rid", // Norsk
"Radio ID", // suomi
"Rid", // Polski
"Rid", // Español
"Rid", // ÅëëçíéêÜ (Greek)
"Rid", // Svenska
"Rid", // Romaneste
"Rid", // Magyar
"Rid", // Català
#if VDRVERSNUM >= 10302
"Rid", // ÀãááÚØÙ (Russian)
#endif
},
{ NULL }

View File

@ -204,14 +204,14 @@ void cFemonOsd::DrawInfoWindow(void)
snprintf(buf, sizeof(buf), "%d", channel->Sid());
m_Osd->Text(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_InfoWindow);
#if (VDRVERSNUM >= 10300)
m_Osd->Text(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), "Nid", clrWhite, clrBackground, m_InfoWindow);
m_Osd->Text(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), tr("Nid"), clrWhite, clrBackground, m_InfoWindow);
snprintf(buf, sizeof(buf), "%d", channel->Nid());
m_Osd->Text(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_InfoWindow);
offset += cOsd::LineHeight() - 2;
m_Osd->Text(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), "Tid" /*tr("Tid")*/, clrWhite, clrBackground, m_InfoWindow);
m_Osd->Text(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Tid"), clrWhite, clrBackground, m_InfoWindow);
snprintf(buf, sizeof(buf), "%d", channel->Tid());
m_Osd->Text(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_InfoWindow);
m_Osd->Text(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), "Rid" /*tr("Rid")*/, clrWhite, clrBackground, m_InfoWindow);
m_Osd->Text(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), tr("Rid"), clrWhite, clrBackground, m_InfoWindow);
snprintf(buf, sizeof(buf), "%d", channel->Rid());
m_Osd->Text(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_InfoWindow);
#endif
@ -408,10 +408,10 @@ void cFemonOsd::DrawInfoWindow(void)
m_Osd->Text(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Aspect Ratio"), clrWhite, clrBackground, m_InfoWindow);
if (m_Receiver) {
value = m_Receiver->VideoAspectRatio();
if (value == 100) snprintf(buf, sizeof(buf), "1:1");
else if (value == 133) snprintf(buf, sizeof(buf), "4:3");
else if (value == 177) snprintf(buf, sizeof(buf), "16:9");
else if (value == 233) snprintf(buf, sizeof(buf), "2.21:1");
if (value == AR_1_1) snprintf(buf, sizeof(buf), "1:1");
else if (value == AR_4_3) snprintf(buf, sizeof(buf), "4:3");
else if (value == AR_16_9) snprintf(buf, sizeof(buf), "16:9");
else if (value == AR_2_21_1) snprintf(buf, sizeof(buf), "2.21:1");
else snprintf(buf, sizeof(buf), "%s", tr("reserved"));
}
else snprintf(buf, sizeof(buf), "---");
@ -425,8 +425,8 @@ void cFemonOsd::DrawInfoWindow(void)
m_Osd->Text(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Video Format"), clrWhite, clrBackground, m_InfoWindow);
if (m_Receiver) {
value = m_Receiver->VideoFormat();
if (value == 1) snprintf(buf, sizeof(buf), "%s", tr("PAL"));
else if (value == 2) snprintf(buf, sizeof(buf), "%s", tr("NTSC"));
if (value == VF_PAL) snprintf(buf, sizeof(buf), "%s", tr("PAL"));
else if (value == VF_NTSC) snprintf(buf, sizeof(buf), "%s", tr("NTSC"));
else snprintf(buf, sizeof(buf), "%s", tr("unknown"));
}
else snprintf(buf, sizeof(buf), "---");
@ -442,10 +442,10 @@ void cFemonOsd::DrawInfoWindow(void)
m_Osd->Text(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_InfoWindow);
offset += cOsd::LineHeight() - 2;
m_Osd->Text(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Bitrate"), clrWhite, clrBackground, m_InfoWindow);
dvalue = m_Receiver->AudioStreamBitrate();
if (m_Receiver) {
if (dvalue == -1.0) snprintf(buf, sizeof(buf), "%s (%.0f %s)", tr("reserved"), m_Receiver->AudioBitrate(), tr("kbit/s"));
else if (dvalue == -2.0) snprintf(buf, sizeof(buf), "%s (%.0f %s)", tr("free"), m_Receiver->AudioBitrate(), tr("kbit/s"));
dvalue = m_Receiver->AudioStreamBitrate();
if (dvalue == (double)FR_RESERVED) snprintf(buf, sizeof(buf), "%s (%.0f %s)", tr("reserved"), m_Receiver->AudioBitrate(), tr("kbit/s"));
else if (dvalue == (double)FR_FREE) snprintf(buf, sizeof(buf), "%s (%.0f %s)", tr("free"), m_Receiver->AudioBitrate(), tr("kbit/s"));
else snprintf(buf, sizeof(buf), "%.0f %s (%.0f %s)", dvalue, tr("kbit/s"), m_Receiver->AudioBitrate(), tr("kbit/s"));
}
else snprintf(buf, sizeof(buf), "---");
@ -459,7 +459,7 @@ void cFemonOsd::DrawInfoWindow(void)
m_Osd->Text(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Sampling Frequency"), clrWhite, clrBackground, m_InfoWindow);
if (m_Receiver) {
value = m_Receiver->AudioSamplingFreq();
if (value == -1) snprintf(buf, sizeof(buf), "%s", tr("reserved"));
if (value == FR_RESERVED) snprintf(buf, sizeof(buf), "%s", tr("reserved"));
else snprintf(buf, sizeof(buf), "%.1f %s", (value / 1000.0), tr("kHz"));
}
else snprintf(buf, sizeof(buf), "---");
@ -516,8 +516,8 @@ void cFemonOsd::Show(void)
}
if (ioctl(m_Frontend, FE_GET_INFO, &m_FrontendInfo) < 0) {
isyslog("cFemonOsd::Show() cannot read frontend info.");
m_Frontend = -1;
close(m_Frontend);
m_Frontend = -1;
return;
}
m_Osd = cOsd::OpenRaw((SCREENWIDTH - OSDWIDTH) / 2, (SCREENHEIGHT - OSDHEIGHT) / 2);
@ -548,6 +548,8 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber)
{
//printf("cFemonOsd::ChannelSwitch()\n");
char *dev = NULL;
if (!device->IsPrimaryDevice() || !channelNumber || cDevice::PrimaryDevice()->CurrentChannel() != channelNumber)
return;
close(m_Frontend);
asprintf(&dev, FRONTEND_DEVICE, cDevice::ActualDevice()->CardIndex(), 0);
m_Frontend = open(dev, O_RDONLY | O_NONBLOCK);
@ -559,8 +561,8 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber)
}
if (ioctl(m_Frontend, FE_GET_INFO, &m_FrontendInfo) < 0) {
isyslog("cFemonOsd::ChannelSwitch() cannot read frontend info.");
m_Frontend = -1;
close(m_Frontend);
m_Frontend = -1;
return;
}
if (m_Receiver)

View File

@ -30,8 +30,8 @@ cFemonReceiver::cFemonReceiver(int Ca, int Vpid, int Apid)
m_VideoPacketCount = 0;
m_VideoHorizontalSize = 0;
m_VideoVerticalSize = 0;
m_VideoAspectRatio = 0;
m_VideoFormat = 0;
m_VideoAspectRatio = AR_RESERVED;
m_VideoFormat = VF_UNKNOWN;
m_VideoFrameRate = 0.0;
m_VideoStreamBitrate = 0.0;
m_VideoBitrate = 0.0;
@ -77,19 +77,19 @@ void cFemonReceiver::GetVideoInfo(uint8_t *mbuf, int count)
int sw = (int)((headr[3] & 0xF0) >> 4);
switch( sw ){
case 1:
m_VideoAspectRatio = 100;
m_VideoAspectRatio = AR_1_1;
break;
case 2:
m_VideoAspectRatio = 133;
m_VideoAspectRatio = AR_4_3;
break;
case 3:
m_VideoAspectRatio = 177;
m_VideoAspectRatio = AR_16_9;
break;
case 4:
m_VideoAspectRatio = 221;
m_VideoAspectRatio = AR_2_21_1;
break;
case 5 ... 15:
m_VideoAspectRatio = 0;
m_VideoAspectRatio = AR_RESERVED;
break;
default:
return;
@ -98,31 +98,31 @@ void cFemonReceiver::GetVideoInfo(uint8_t *mbuf, int count)
switch ( sw ) {
case 1:
m_VideoFrameRate = 24000/1001.0;
m_VideoFormat = 0;
m_VideoFormat = VF_UNKNOWN;
break;
case 2:
m_VideoFrameRate = 24.0;
m_VideoFormat = 0;
m_VideoFormat = VF_UNKNOWN;
break;
case 3:
m_VideoFrameRate = 25.0;
m_VideoFormat = 1;
m_VideoFormat = VF_PAL;
break;
case 4:
m_VideoFrameRate = 30000/1001.0;
m_VideoFormat = 2;
m_VideoFormat = VF_NTSC;
break;
case 5:
m_VideoFrameRate = 30.0;
m_VideoFormat = 2;
m_VideoFormat = VF_NTSC;
break;
case 6:
m_VideoFrameRate = 50.0;
m_VideoFormat = 1;
m_VideoFormat = VF_PAL;
break;
case 7:
m_VideoFrameRate = 60.0;
m_VideoFormat = 2;
m_VideoFormat = VF_NTSC;
break;
}
m_VideoStreamBitrate = 400 * (((headr[4] << 10) & 0x0003FC00UL) | ((headr[5] << 2) & 0x000003FCUL) | (((headr[6] & 0xC0) >> 6) & 0x00000003UL)) / 1000000.0;
@ -158,14 +158,14 @@ void cFemonReceiver::GetAudioInfo(uint8_t *mbuf, int count)
m_AudioMPEGLayer = 4 - ((headr[1] & 0x06) >> 1);
tmp = bitrates[(3 - ((headr[1] & 0x06) >> 1))][(headr[2] >> 4)] * 1000;
if (tmp == 0)
m_AudioStreamBitrate = -2.0; // free
m_AudioStreamBitrate = (double)FR_FREE;
else if (tmp == 0xf)
m_AudioStreamBitrate = -1.0; // reserved
m_AudioStreamBitrate = (double)FR_RESERVED;
else
m_AudioStreamBitrate = tmp / 1000.0;
tmp = samplerates[((headr[2] & 0x0c) >> 2)] * 100;
if (tmp == 3)
m_AudioSamplingFreq = -1; // reserved
m_AudioSamplingFreq = FR_RESERVED;
else
m_AudioSamplingFreq = tmp;
}

View File

@ -12,6 +12,23 @@
#include <vdr/thread.h>
#include <vdr/receiver.h>
enum eVideoFormat {
VF_UNKNOWN = 0,
VF_PAL = 1,
VF_NTSC = 2,
};
enum eAspectRatio {
AR_RESERVED = 0,
AR_1_1 = 100,
AR_4_3 = 133,
AR_16_9 = 177,
AR_2_21_1 = 233,
};
#define FR_RESERVED -1
#define FR_FREE -2
class cFemonReceiver : public cReceiver, public cThread {
private:
bool m_Active;
@ -44,13 +61,13 @@ public:
int VideoHorizontalSize(void) { return m_VideoHorizontalSize; }; // pixels
int VideoVerticalSize(void) { return m_VideoVerticalSize; }; // pixels
int VideoAspectRatio(void) { return m_VideoAspectRatio; }; // 4:3 == 133, ...
int VideoFormat(void) { return m_VideoFormat; }; // 0 == unknown, 1 == PAL, 2 == NTSC
int VideoAspectRatio(void) { return m_VideoAspectRatio; }; // eAspectRatio
int VideoFormat(void) { return m_VideoFormat; }; // eVideoFormat
double VideoFrameRate(void) { return m_VideoFrameRate; }; // Hz
double VideoStreamBitrate(void) { return m_VideoStreamBitrate; }; // Mbit/s
double VideoBitrate(void) { return m_VideoBitrate; }; // Mbit/s
int AudioMPEGLayer(void) { return m_AudioMPEGLayer; }; // number
int AudioMPEGLayer(void) { return m_AudioMPEGLayer; }; // layer number
int AudioSamplingFreq(void) { return m_AudioSamplingFreq; }; // Hz
double AudioStreamBitrate(void) { return m_AudioStreamBitrate; }; // kbit/s
double AudioBitrate(void) { return m_AudioBitrate; }; // kbit/s