Fixed a memory leak.

Added a check for the minimum OSD height.
This commit is contained in:
Rolf Ahrenberg 2008-11-12 17:58:32 +02:00
parent fa41c95b1c
commit a8c065639a
3 changed files with 49 additions and 42 deletions

View File

@ -315,3 +315,5 @@ VDR Plugin 'femon' Revision History
- Added getVideoStream() and getAudioStream() functions. - Added getVideoStream() and getAudioStream() functions.
- Updated Italian translation (Thanks to Diego Pierotto). - Updated Italian translation (Thanks to Diego Pierotto).
- Fixed a memory leak.
- Added a check for the minimum OSD height.

View File

@ -126,26 +126,29 @@ cFemonOsd *cFemonOsd::Instance(bool create)
} }
cFemonOsd::cFemonOsd() 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__); 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_SvdrpConnection.handle = -1;
m_SvdrpPlugin = NULL; if (femonConfig.osdheight < (OSDSTATUSHEIGHT + OSDROWHEIGHT + OSDSTATUSHEIGHT))
m_Number = 0; femonConfig.osdheight = (OSDSTATUSHEIGHT + OSDROWHEIGHT + OSDSTATUSHEIGHT);
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 (Setup.UseSmallFont == 0) { if (Setup.UseSmallFont == 0) {
// Dirty hack to force the small fonts... // Dirty hack to force the small fonts...
Setup.UseSmallFont = 1; Setup.UseSmallFont = 1;
@ -176,7 +179,7 @@ cFemonOsd::~cFemonOsd(void)
void cFemonOsd::DrawStatusWindow(void) void cFemonOsd::DrawStatusWindow(void)
{ {
cMutexLock lock(m_Mutex); cMutexLock lock(&m_Mutex);
cBitmap *bm = NULL; cBitmap *bm = NULL;
int snr = m_SNR / 655; int snr = m_SNR / 655;
int signal = m_Signal / 655; int signal = m_Signal / 655;
@ -282,7 +285,7 @@ void cFemonOsd::DrawStatusWindow(void)
void cFemonOsd::DrawInfoWindow(void) void cFemonOsd::DrawInfoWindow(void)
{ {
cMutexLock lock(m_Mutex); cMutexLock lock(&m_Mutex);
int offset = 0; int offset = 0;
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack(); eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();

View File

@ -25,27 +25,29 @@
class cFemonOsd : public cOsdObject, public cThread, public cStatus { class cFemonOsd : public cOsdObject, public cThread, public cStatus {
private: private:
static cFemonOsd *pInstance; static cFemonOsd *pInstance;
cOsd *m_Osd;
cFemonReceiver *m_Receiver; cOsd *m_Osd;
int m_Frontend; cFemonReceiver *m_Receiver;
int m_SvdrpFrontend; int m_Frontend;
double m_SvdrpVideoBitrate; int m_SvdrpFrontend;
double m_SvdrpAudioBitrate; double m_SvdrpVideoBitrate;
double m_SvdrpAudioBitrate;
SvdrpConnection_v1_0 m_SvdrpConnection; SvdrpConnection_v1_0 m_SvdrpConnection;
cPlugin *m_SvdrpPlugin; cPlugin *m_SvdrpPlugin;
struct dvb_frontend_info m_FrontendInfo; struct dvb_frontend_info m_FrontendInfo;
int m_Number; int m_Number;
int m_OldNumber; int m_OldNumber;
uint16_t m_SNR; uint16_t m_SNR;
uint16_t m_Signal; uint16_t m_Signal;
uint32_t m_BER; uint32_t m_BER;
uint32_t m_UNC; uint32_t m_UNC;
fe_status_t m_FrontendStatus; fe_status_t m_FrontendStatus;
int m_DisplayMode; int m_DisplayMode;
const cFont *m_Font; const cFont *m_Font;
cTimeMs m_InputTime; cTimeMs m_InputTime;
cCondWait m_Sleep; cCondWait m_Sleep;
cMutex* m_Mutex; cMutex m_Mutex;
void DrawStatusWindow(void); void DrawStatusWindow(void);
void DrawInfoWindow(void); void DrawInfoWindow(void);
bool SvdrpConnect(void); bool SvdrpConnect(void);
@ -66,10 +68,10 @@ public:
virtual void Show(void); virtual void Show(void);
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
bool DeviceSwitch(int direction); bool DeviceSwitch(int direction);
double GetVideoBitrate(void); double GetVideoBitrate(void);
double GetAudioBitrate(void); double GetAudioBitrate(void);
double GetDolbyBitrate(void); double GetDolbyBitrate(void);
}; };
#endif //__FEMONOSD_H #endif //__FEMONOSD_H