mirror of
				https://github.com/rofafor/vdr-plugin-femon.git
				synced 2023-10-10 11:36:53 +00:00 
			
		
		
		
	Fixed a memory leak.
Added a check for the minimum OSD height.
This commit is contained in:
		
							
								
								
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							@@ -315,3 +315,5 @@ VDR Plugin 'femon' Revision History
 | 
			
		||||
 | 
			
		||||
- Added getVideoStream() and getAudioStream() functions.
 | 
			
		||||
- Updated Italian translation (Thanks to Diego Pierotto).
 | 
			
		||||
- Fixed a memory leak.
 | 
			
		||||
- Added a check for the minimum OSD height.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										41
									
								
								femonosd.c
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								femonosd.c
									
									
									
									
									
								
							@@ -126,26 +126,29 @@ cFemonOsd *cFemonOsd::Instance(bool create)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
cFemonOsd::cFemonOsd()
 | 
			
		||||
:cOsdObject(true), cThread("femon osd")
 | 
			
		||||
: cOsdObject(true), cThread("femon osd"),
 | 
			
		||||
  m_Osd(NULL),
 | 
			
		||||
  m_Receiver(NULL),
 | 
			
		||||
  m_Frontend(-1),
 | 
			
		||||
  m_SvdrpFrontend(-1),
 | 
			
		||||
  m_SvdrpVideoBitrate(-1),
 | 
			
		||||
  m_SvdrpAudioBitrate(-1),
 | 
			
		||||
  m_SvdrpPlugin(NULL),
 | 
			
		||||
  m_Number(0),
 | 
			
		||||
  m_OldNumber(0),
 | 
			
		||||
  m_SNR(0),
 | 
			
		||||
  m_Signal(0),
 | 
			
		||||
  m_BER(0),
 | 
			
		||||
  m_UNC(0),
 | 
			
		||||
  m_DisplayMode(femonConfig.displaymode),
 | 
			
		||||
  m_InputTime(0),
 | 
			
		||||
  m_Sleep(),
 | 
			
		||||
  m_Mutex()
 | 
			
		||||
{
 | 
			
		||||
  Dprintf("%s()\n", __PRETTY_FUNCTION__);
 | 
			
		||||
  m_Osd = NULL;
 | 
			
		||||
  m_Receiver = NULL;
 | 
			
		||||
  m_Frontend = -1;
 | 
			
		||||
  m_SvdrpVideoBitrate = -1.0;
 | 
			
		||||
  m_SvdrpAudioBitrate = -1.0;
 | 
			
		||||
  m_SvdrpFrontend = -1;
 | 
			
		||||
  m_SvdrpConnection.handle = -1;
 | 
			
		||||
  m_SvdrpPlugin = NULL;
 | 
			
		||||
  m_Number = 0;
 | 
			
		||||
  m_OldNumber = 0;
 | 
			
		||||
  m_Signal = 0;
 | 
			
		||||
  m_SNR = 0;
 | 
			
		||||
  m_BER = 0;
 | 
			
		||||
  m_UNC = 0;
 | 
			
		||||
  m_DisplayMode = femonConfig.displaymode;
 | 
			
		||||
  m_InputTime.Set(0);
 | 
			
		||||
  m_Mutex = new cMutex();
 | 
			
		||||
  if (femonConfig.osdheight < (OSDSTATUSHEIGHT + OSDROWHEIGHT + OSDSTATUSHEIGHT))
 | 
			
		||||
     femonConfig.osdheight = (OSDSTATUSHEIGHT + OSDROWHEIGHT + OSDSTATUSHEIGHT);
 | 
			
		||||
  if (Setup.UseSmallFont == 0) {
 | 
			
		||||
     // Dirty hack to force the small fonts...
 | 
			
		||||
     Setup.UseSmallFont = 1;
 | 
			
		||||
@@ -176,7 +179,7 @@ cFemonOsd::~cFemonOsd(void)
 | 
			
		||||
 | 
			
		||||
void cFemonOsd::DrawStatusWindow(void)
 | 
			
		||||
{
 | 
			
		||||
  cMutexLock lock(m_Mutex);
 | 
			
		||||
  cMutexLock lock(&m_Mutex);
 | 
			
		||||
  cBitmap *bm = NULL;
 | 
			
		||||
  int snr = m_SNR / 655;
 | 
			
		||||
  int signal = m_Signal / 655;
 | 
			
		||||
@@ -282,7 +285,7 @@ void cFemonOsd::DrawStatusWindow(void)
 | 
			
		||||
 | 
			
		||||
void cFemonOsd::DrawInfoWindow(void)
 | 
			
		||||
{
 | 
			
		||||
  cMutexLock lock(m_Mutex);
 | 
			
		||||
  cMutexLock lock(&m_Mutex);
 | 
			
		||||
  int offset = 0;
 | 
			
		||||
  cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
 | 
			
		||||
  eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										48
									
								
								femonosd.h
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								femonosd.h
									
									
									
									
									
								
							@@ -25,27 +25,29 @@
 | 
			
		||||
class cFemonOsd : public cOsdObject, public cThread, public cStatus {
 | 
			
		||||
private:
 | 
			
		||||
  static cFemonOsd *pInstance;
 | 
			
		||||
  cOsd *m_Osd;
 | 
			
		||||
  cFemonReceiver *m_Receiver;
 | 
			
		||||
  int m_Frontend;
 | 
			
		||||
  int m_SvdrpFrontend;
 | 
			
		||||
  double m_SvdrpVideoBitrate;
 | 
			
		||||
  double m_SvdrpAudioBitrate;
 | 
			
		||||
 | 
			
		||||
  cOsd             *m_Osd;
 | 
			
		||||
  cFemonReceiver   *m_Receiver;
 | 
			
		||||
  int               m_Frontend;
 | 
			
		||||
  int               m_SvdrpFrontend;
 | 
			
		||||
  double            m_SvdrpVideoBitrate;
 | 
			
		||||
  double            m_SvdrpAudioBitrate;
 | 
			
		||||
  SvdrpConnection_v1_0 m_SvdrpConnection;
 | 
			
		||||
  cPlugin *m_SvdrpPlugin;
 | 
			
		||||
  cPlugin          *m_SvdrpPlugin;
 | 
			
		||||
  struct dvb_frontend_info m_FrontendInfo;
 | 
			
		||||
  int m_Number;
 | 
			
		||||
  int m_OldNumber;
 | 
			
		||||
  uint16_t m_SNR;
 | 
			
		||||
  uint16_t m_Signal;
 | 
			
		||||
  uint32_t m_BER;
 | 
			
		||||
  uint32_t m_UNC;
 | 
			
		||||
  fe_status_t m_FrontendStatus;
 | 
			
		||||
  int m_DisplayMode;
 | 
			
		||||
  const cFont *m_Font;
 | 
			
		||||
  cTimeMs m_InputTime;
 | 
			
		||||
  cCondWait m_Sleep;
 | 
			
		||||
  cMutex* m_Mutex;
 | 
			
		||||
  int               m_Number;
 | 
			
		||||
  int               m_OldNumber;
 | 
			
		||||
  uint16_t          m_SNR;
 | 
			
		||||
  uint16_t          m_Signal;
 | 
			
		||||
  uint32_t          m_BER;
 | 
			
		||||
  uint32_t          m_UNC;
 | 
			
		||||
  fe_status_t       m_FrontendStatus;
 | 
			
		||||
  int               m_DisplayMode;
 | 
			
		||||
  const cFont      *m_Font;
 | 
			
		||||
  cTimeMs           m_InputTime;
 | 
			
		||||
  cCondWait         m_Sleep;
 | 
			
		||||
  cMutex            m_Mutex;
 | 
			
		||||
 | 
			
		||||
  void DrawStatusWindow(void);
 | 
			
		||||
  void DrawInfoWindow(void);
 | 
			
		||||
  bool SvdrpConnect(void);
 | 
			
		||||
@@ -66,10 +68,10 @@ public:
 | 
			
		||||
  virtual void Show(void);
 | 
			
		||||
  virtual eOSState ProcessKey(eKeys Key);
 | 
			
		||||
 | 
			
		||||
  bool DeviceSwitch(int direction);
 | 
			
		||||
  double GetVideoBitrate(void);
 | 
			
		||||
  double GetAudioBitrate(void);
 | 
			
		||||
  double GetDolbyBitrate(void);
 | 
			
		||||
  bool    DeviceSwitch(int direction);
 | 
			
		||||
  double  GetVideoBitrate(void);
 | 
			
		||||
  double  GetAudioBitrate(void);
 | 
			
		||||
  double  GetDolbyBitrate(void);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif //__FEMONOSD_H
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user