mirror of
				https://github.com/rofafor/vdr-plugin-femon.git
				synced 2023-10-10 11:36:53 +00:00 
			
		
		
		
	Some minor cosmetic changes.
This commit is contained in:
		
							
								
								
									
										4
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								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. | ||||
|   | ||||
							
								
								
									
										8
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								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 <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. 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>. | ||||
|  | ||||
| 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 :) | ||||
|   | ||||
							
								
								
									
										6
									
								
								femon.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								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) | ||||
| { | ||||
|   | ||||
							
								
								
									
										3
									
								
								femon.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								femon.h
									
									
									
									
									
								
							| @@ -2,9 +2,8 @@ | ||||
| #define __FEMON_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 *MAINMENUENTRY  = "Signal Quality"; | ||||
|  | ||||
|   | ||||
							
								
								
									
										28
									
								
								femonosd.c
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								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; | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
| #include <vdr/status.h> | ||||
| #include <vdr/channels.h> | ||||
| #include <vdr/font.h> | ||||
| #include "femonreceiver.h" | ||||
| #include <vdr/device.h> // only for TS_SIZE | ||||
|  | ||||
| class cFemonOsd : public cOsdObject, public cThread, public cStatus { | ||||
| private: | ||||
|   | ||||
| @@ -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++; | ||||
|         } | ||||
|      } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| #ifndef __FEMONRECEIVER_H | ||||
| #define __FEMONRECEIVER_H | ||||
|  | ||||
| #include <vdr/device.h> // only for TS_SIZE | ||||
| #include <vdr/receiver.h> | ||||
|  | ||||
| class cFemonReceiver : public cReceiver { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user