1
0
mirror of https://github.com/rofafor/vdr-plugin-iptv.git synced 2023-10-10 13:37:03 +02:00

Fixed remaining lint warnings.

This commit is contained in:
Rolf Ahrenberg 2009-03-21 00:56:37 +02:00
parent e74d4f88f4
commit d1c2d48a6b
8 changed files with 21 additions and 30 deletions

View File

@ -10,7 +10,7 @@
#define IPTV_MAX_DEVICES MAXDEVICES #define IPTV_MAX_DEVICES MAXDEVICES
cIptvDevice * IptvDevices[IPTV_MAX_DEVICES] = { NULL }; static cIptvDevice * IptvDevices[IPTV_MAX_DEVICES] = { NULL };
unsigned int cIptvDevice::deviceCount = 0; unsigned int cIptvDevice::deviceCount = 0;
@ -304,7 +304,7 @@ bool cIptvDevice::DeleteFilter(unsigned int Index)
return false; return false;
} }
bool cIptvDevice::IsBlackListed(u_short Pid, u_char Tid, u_char Mask) bool cIptvDevice::IsBlackListed(u_short Pid, u_char Tid, u_char Mask) const
{ {
//debug("cIptvDevice::IsBlackListed(%d) Pid=%d Tid=%02X Mask=%02X\n", deviceIndex, Pid, Tid, Mask); //debug("cIptvDevice::IsBlackListed(%d) Pid=%d Tid=%02X Mask=%02X\n", deviceIndex, Pid, Tid, Mask);
// loop through section filter table // loop through section filter table
@ -366,7 +366,7 @@ bool cIptvDevice::OpenDvr(void)
if (pIptvStreamer) if (pIptvStreamer)
pIptvStreamer->Open(); pIptvStreamer->Open();
if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering()) if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering())
pSidScanner->SetStatus(true); pSidScanner->Open();
isOpenDvr = true; isOpenDvr = true;
return true; return true;
} }
@ -375,7 +375,7 @@ void cIptvDevice::CloseDvr(void)
{ {
debug("cIptvDevice::CloseDvr(%d)\n", deviceIndex); debug("cIptvDevice::CloseDvr(%d)\n", deviceIndex);
if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering()) if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering())
pSidScanner->SetStatus(false); pSidScanner->Close();
if (pIptvStreamer) if (pIptvStreamer)
pIptvStreamer->Close(); pIptvStreamer->Close();
isOpenDvr = false; isOpenDvr = false;

View File

@ -74,7 +74,7 @@ private:
void ResetBuffering(void); void ResetBuffering(void);
bool IsBuffering(void); bool IsBuffering(void);
bool DeleteFilter(unsigned int Index); bool DeleteFilter(unsigned int Index);
bool IsBlackListed(u_short Pid, u_char Tid, u_char Mask); bool IsBlackListed(u_short Pid, u_char Tid, u_char Mask) const;
// for channel selection // for channel selection
public: public:

View File

@ -15,16 +15,6 @@
class cIptvSectionFilter : public cIptvSectionStatistics { class cIptvSectionFilter : public cIptvSectionStatistics {
private: private:
enum dmx_success {
DMX_OK = 0, // Received OK
DMX_LENGTH_ERROR, // Incorrect length
DMX_OVERRUN_ERROR, // Receiver ring buffer overrun
DMX_CRC_ERROR, // Incorrect CRC
DMX_FRAME_ERROR, // Frame alignment error
DMX_FIFO_ERROR, // Receiver FIFO overrun
DMX_MISSED_ERROR // Receiver missed packet
};
enum dmx_limits { enum dmx_limits {
DMX_MAX_FILTER_SIZE = 18, DMX_MAX_FILTER_SIZE = 18,
DMX_MAX_SECTION_SIZE = 4096, DMX_MAX_SECTION_SIZE = 4096,
@ -69,7 +59,7 @@ public:
virtual ~cIptvSectionFilter(); virtual ~cIptvSectionFilter();
void Process(const uint8_t* Data); void Process(const uint8_t* Data);
int GetReadDesc(void); int GetReadDesc(void);
uint16_t GetPid(void) { return pid; } uint16_t GetPid(void) const { return pid; }
}; };
#endif // __IPTV_SECTIONFILTER_H #endif // __IPTV_SECTIONFILTER_H

10
setup.c
View File

@ -17,10 +17,6 @@
#include "device.h" #include "device.h"
#include "setup.h" #include "setup.h"
#ifndef trVDR
#define trVDR(s) tr(s)
#endif
// --- cIptvMenuEditChannel -------------------------------------------------- // --- cIptvMenuEditChannel --------------------------------------------------
class cIptvMenuEditChannel : public cOsdMenu class cIptvMenuEditChannel : public cOsdMenu
@ -391,7 +387,7 @@ class cIptvMenuChannels : public cOsdMenu
{ {
private: private:
void Setup(void); void Setup(void);
cChannel *GetChannel(int Index); cChannel *GetChannel(int Index) const;
void Propagate(void); void Propagate(void);
protected: protected:
@ -431,7 +427,7 @@ void cIptvMenuChannels::Setup(void)
Display(); Display();
} }
cChannel *cIptvMenuChannels::GetChannel(int Index) cChannel *cIptvMenuChannels::GetChannel(int Index) const
{ {
cIptvMenuChannelItem *p = dynamic_cast<cIptvMenuChannelItem *>(Get(Index)); cIptvMenuChannelItem *p = dynamic_cast<cIptvMenuChannelItem *>(Get(Index));
return p ? (cChannel *)p->Channel() : NULL; return p ? (cChannel *)p->Channel() : NULL;
@ -712,7 +708,7 @@ eOSState cIptvPluginSetup::ProcessKey(eKeys Key)
case kBlue: return ShowInfo(); case kBlue: return ShowInfo();
case kInfo: if (Current() < help.Size()) case kInfo: if (Current() < help.Size())
return AddSubMenu(new cMenuText(cString::sprintf("%s - %s '%s'", tr("Help"), trVDR("Plugin"), PLUGIN_NAME_I18N), help[Current()])); return AddSubMenu(new cMenuText(cString::sprintf("%s - %s '%s'", tr("Help"), trVDR("Plugin"), PLUGIN_NAME_I18N), help[Current()]));
default: state = osContinue; default: state = osContinue; break;
} }
} }

View File

@ -17,11 +17,13 @@ private:
protected: protected:
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length); virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length);
virtual void SetStatus(bool On);
public: public:
cSidScanner(void); cSidScanner(void);
virtual void SetStatus(bool On);
void SetChannel(const cChannel *Channel); void SetChannel(const cChannel *Channel);
void Open() { SetStatus(true); }
void Close() { SetStatus(false); }
}; };
#endif // __SIDSCANNER_H #endif // __SIDSCANNER_H

View File

@ -32,7 +32,7 @@ cString cIptvSectionStatistics::GetSectionStatistic()
cMutexLock MutexLock(&mutex); cMutexLock MutexLock(&mutex);
uint64_t elapsed = timer.Elapsed(); /* in milliseconds */ uint64_t elapsed = timer.Elapsed(); /* in milliseconds */
timer.Set(); timer.Set();
long bitrate = elapsed ? (long)((float)1000 / KILOBYTE(1) * filteredData / elapsed) : 0L; long bitrate = elapsed ? (long)(((float)1000 / KILOBYTE(1)) * filteredData / elapsed) : 0L;
if (!IptvConfig.GetUseBytes()) if (!IptvConfig.GetUseBytes())
bitrate *= 8; bitrate *= 8;
// no trailing linefeed here! // no trailing linefeed here!
@ -75,7 +75,7 @@ cString cIptvPidStatistics::GetPidStatistic()
cString info("Active pids:\n"); cString info("Active pids:\n");
for (unsigned int i = 0; i < IPTV_STATS_ACTIVE_PIDS_COUNT; ++i) { for (unsigned int i = 0; i < IPTV_STATS_ACTIVE_PIDS_COUNT; ++i) {
if (mostActivePids[i].pid) { if (mostActivePids[i].pid) {
long bitrate = elapsed ? (long)((float)1000 / KILOBYTE(1) * mostActivePids[i].DataAmount / elapsed) : 0L; long bitrate = elapsed ? (long)(((float)1000 / KILOBYTE(1)) * mostActivePids[i].DataAmount / elapsed) : 0L;
if (!IptvConfig.GetUseBytes()) if (!IptvConfig.GetUseBytes())
bitrate *= 8; bitrate *= 8;
info = cString::sprintf("%sPid %d: %4d (%4ld k%s/s)\n", *info, i, info = cString::sprintf("%sPid %d: %4d (%4ld k%s/s)\n", *info, i,
@ -145,7 +145,7 @@ cString cIptvStreamerStatistics::GetStreamerStatistic()
cMutexLock MutexLock(&mutex); cMutexLock MutexLock(&mutex);
uint64_t elapsed = timer.Elapsed(); /* in milliseconds */ uint64_t elapsed = timer.Elapsed(); /* in milliseconds */
timer.Set(); timer.Set();
long bitrate = elapsed ? (long)((float)1000 / KILOBYTE(1) * dataBytes / elapsed) : 0L; long bitrate = elapsed ? (long)(((float)1000 / KILOBYTE(1)) * dataBytes / elapsed) : 0L;
if (!IptvConfig.GetUseBytes()) if (!IptvConfig.GetUseBytes())
bitrate *= 8; bitrate *= 8;
cString info = cString::sprintf("Stream bitrate: %ld k%s/s\n", bitrate, IptvConfig.GetUseBytes() ? "B" : "bit"); cString info = cString::sprintf("Stream bitrate: %ld k%s/s\n", bitrate, IptvConfig.GetUseBytes() ? "B" : "bit");
@ -182,7 +182,7 @@ cString cIptvBufferStatistics::GetBufferStatistic()
cMutexLock MutexLock(&mutex); cMutexLock MutexLock(&mutex);
uint64_t elapsed = timer.Elapsed(); /* in milliseconds */ uint64_t elapsed = timer.Elapsed(); /* in milliseconds */
timer.Set(); timer.Set();
long bitrate = elapsed ? (long)((float)1000 / KILOBYTE(1) * dataBytes / elapsed) : 0L; long bitrate = elapsed ? (long)(((float)1000 / KILOBYTE(1)) * dataBytes / elapsed) : 0L;
long totalSpace = MEGABYTE(IptvConfig.GetTsBufferSize()); long totalSpace = MEGABYTE(IptvConfig.GetTsBufferSize());
float percentage = (float)((float)usedSpace / (float)totalSpace * 100.0); float percentage = (float)((float)usedSpace / (float)totalSpace * 100.0);
long totalKilos = totalSpace / KILOBYTE(1); long totalKilos = totalSpace / KILOBYTE(1);

View File

@ -21,7 +21,7 @@ cIptvStreamer::cIptvStreamer(cRingBufferLinear* RingBuffer, unsigned int PacketL
// Allocate packet buffer // Allocate packet buffer
packetBuffer = MALLOC(unsigned char, packetBufferLen); packetBuffer = MALLOC(unsigned char, packetBufferLen);
if (packetBuffer) if (packetBuffer)
memset(packetBuffer, 0, packetBufferLen); memset(packetBuffer, 0, packetBufferLen);
else else
error("ERROR: MALLOC() failed for packet buffer"); error("ERROR: MALLOC() failed for packet buffer");
} }
@ -32,6 +32,7 @@ cIptvStreamer::~cIptvStreamer()
// Close the protocol // Close the protocol
Close(); Close();
protocol = NULL; protocol = NULL;
ringBuffer = NULL;
// Free allocated memory // Free allocated memory
free(packetBuffer); free(packetBuffer);
} }

View File

@ -24,10 +24,12 @@ private:
unsigned int packetBufferLen; unsigned int packetBufferLen;
cIptvProtocolIf* protocol; cIptvProtocolIf* protocol;
protected:
virtual void Action(void);
public: public:
cIptvStreamer(cRingBufferLinear* RingBuffer, unsigned int PacketLen); cIptvStreamer(cRingBufferLinear* RingBuffer, unsigned int PacketLen);
virtual ~cIptvStreamer(); virtual ~cIptvStreamer();
virtual void Action(void);
bool Set(const char* Location, const int Parameter, const int Index, cIptvProtocolIf* Protocol); bool Set(const char* Location, const int Parameter, const int Index, cIptvProtocolIf* Protocol);
bool Open(void); bool Open(void);
bool Close(void); bool Close(void);