mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Cleaned up compilation warnings.
This commit is contained in:
parent
a32cb95960
commit
26cd1aa1f1
4
common.c
4
common.c
@ -10,7 +10,7 @@
|
||||
|
||||
uint16_t ts_pid(const uint8_t *buf)
|
||||
{
|
||||
return ((buf[1] & 0x1f) << 8) + buf[2];
|
||||
return (uint16_t)(((buf[1] & 0x1f) << 8) + buf[2]);
|
||||
}
|
||||
|
||||
uint8_t payload(const uint8_t *tsp)
|
||||
@ -22,7 +22,7 @@ uint8_t payload(const uint8_t *tsp)
|
||||
if (tsp[4] > 183) // corrupted data?
|
||||
return 0;
|
||||
else
|
||||
return (184 - 1) - tsp[4];
|
||||
return (uint8_t)((184 - 1) - tsp[4]);
|
||||
}
|
||||
|
||||
return 184;
|
||||
|
2
device.c
2
device.c
@ -436,7 +436,7 @@ bool cIptvDevice::GetTSPacket(uchar *&Data)
|
||||
AddPidStatistic(ts_pid(p), payload(p));
|
||||
// Send data also to dvr fifo
|
||||
if (dvrFd >= 0)
|
||||
Count = write(dvrFd, p, TS_SIZE);
|
||||
Count = (int)write(dvrFd, p, TS_SIZE);
|
||||
// Analyze incomplete streams with built-in pid analyzer
|
||||
if (pidScanEnabled && pPidScanner)
|
||||
pPidScanner->Process(p);
|
||||
|
@ -75,7 +75,7 @@ int cIptvProtocolFile::Read(unsigned char* BufferAddr, unsigned int BufferLen)
|
||||
// during the sleep and buffers are disposed. Check here that the plugin is
|
||||
// still active before accessing the buffers
|
||||
if (isActive)
|
||||
return fread(BufferAddr, sizeof(unsigned char), BufferLen, fileStream);
|
||||
return (int)fread(BufferAddr, sizeof(unsigned char), BufferLen, fileStream);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,8 @@ bool cIptvProtocolHttp::Connect(void)
|
||||
"\r\n", streamPath, streamAddr);
|
||||
|
||||
debug("Sending http request: %s\n", *buffer);
|
||||
err = send(socketDesc, buffer, strlen(buffer), 0);
|
||||
ERROR_IF_FUNC(err < 0, "send()", CloseSocket(), return false);
|
||||
ssize_t err2 = send(socketDesc, buffer, strlen(buffer), 0);
|
||||
ERROR_IF_FUNC(err2 < 0, "send()", CloseSocket(), return false);
|
||||
|
||||
// Now process headers
|
||||
if (!ProcessHeaders()) {
|
||||
@ -141,7 +141,7 @@ bool cIptvProtocolHttp::GetHeaderLine(char* dest, unsigned int destLen,
|
||||
return false;
|
||||
// Check if data available
|
||||
else if (retval) {
|
||||
int retval = recvfrom(socketDesc, bufptr, 1, MSG_DONTWAIT,
|
||||
ssize_t retval = recvfrom(socketDesc, bufptr, 1, MSG_DONTWAIT,
|
||||
(struct sockaddr *)&sockAddr, &addrlen);
|
||||
if (retval <= 0)
|
||||
return false;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "sectionfilter.h"
|
||||
|
||||
cIptvSectionFilter::cIptvSectionFilter(int DeviceIndex, int Index,
|
||||
u_short Pid, u_char Tid, u_char Mask)
|
||||
uint16_t Pid, uint8_t Tid, uint8_t Mask)
|
||||
: pusi_seen(0),
|
||||
feedcc(0),
|
||||
doneq(0),
|
||||
@ -42,8 +42,9 @@ cIptvSectionFilter::cIptvSectionFilter(int DeviceIndex, int Index,
|
||||
for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i) {
|
||||
mode = filter_mode[i];
|
||||
mask = filter_mask[i];
|
||||
maskandmode[i] = mask & mode;
|
||||
local_doneq |= maskandnotmode[i] = mask & ~mode;
|
||||
maskandmode[i] = (uint8_t)(mask & mode);
|
||||
maskandnotmode[i] = (uint8_t)(mask & ~mode);
|
||||
local_doneq |= maskandnotmode[i];
|
||||
}
|
||||
doneq = local_doneq ? 1 : 0;
|
||||
|
||||
@ -78,7 +79,7 @@ int cIptvSectionFilter::GetReadDesc(void)
|
||||
|
||||
inline uint16_t cIptvSectionFilter::GetLength(const uint8_t *Data)
|
||||
{
|
||||
return 3 + ((Data[1] & 0x0f) << 8) + Data[2];
|
||||
return (uint16_t)(3 + ((Data[1] & 0x0f) << 8) + Data[2]);
|
||||
}
|
||||
|
||||
void cIptvSectionFilter::New(void)
|
||||
@ -94,10 +95,10 @@ int cIptvSectionFilter::Filter(void)
|
||||
|
||||
if (secbuf) {
|
||||
for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i) {
|
||||
uint8_t local_xor = filter_value[i] ^ secbuf[i];
|
||||
uint8_t local_xor = (uint8_t)(filter_value[i] ^ secbuf[i]);
|
||||
if (maskandmode[i] & local_xor)
|
||||
return 0;
|
||||
neq |= maskandnotmode[i] & local_xor;
|
||||
neq |= (maskandnotmode[i] & local_xor);
|
||||
}
|
||||
|
||||
if (doneq && !neq)
|
||||
@ -105,10 +106,10 @@ int cIptvSectionFilter::Filter(void)
|
||||
|
||||
// There is no data in the fifo, more can be written
|
||||
if (!select_single_desc(fifoDescriptor, 0, false)) {
|
||||
i = write(fifoDescriptor, secbuf, seclen);
|
||||
ERROR_IF(i < 0, "write()");
|
||||
ssize_t len = write(fifoDescriptor, secbuf, seclen);
|
||||
ERROR_IF(len < 0, "write()");
|
||||
// Update statistics
|
||||
AddSectionStatistic(i, 1);
|
||||
AddSectionStatistic(len, 1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -130,7 +131,7 @@ int cIptvSectionFilter::CopyDump(const uint8_t *buf, uint8_t len)
|
||||
return 0;
|
||||
|
||||
if (tsfeedp + len > DMX_MAX_SECFEED_SIZE)
|
||||
len = DMX_MAX_SECFEED_SIZE - tsfeedp;
|
||||
len = (uint8_t)(DMX_MAX_SECFEED_SIZE - tsfeedp);
|
||||
|
||||
if (len <= 0)
|
||||
return 0;
|
||||
@ -175,9 +176,9 @@ void cIptvSectionFilter::Process(const uint8_t* Data)
|
||||
return;
|
||||
|
||||
// Payload start
|
||||
uint8_t p = TS_SIZE - count;
|
||||
uint8_t p = (uint8_t)(TS_SIZE - count);
|
||||
|
||||
uint8_t cc = Data[3] & 0x0f;
|
||||
uint8_t cc = (uint8_t)(Data[3] & 0x0f);
|
||||
int ccok = ((feedcc + 1) & 0x0f) == cc;
|
||||
feedcc = cc;
|
||||
|
||||
@ -201,7 +202,7 @@ void cIptvSectionFilter::Process(const uint8_t* Data)
|
||||
const uint8_t *before = &Data[p + 1];
|
||||
uint8_t before_len = Data[p];
|
||||
const uint8_t *after = &before[before_len];
|
||||
uint8_t after_len = (count - 1) - before_len;
|
||||
uint8_t after_len = (uint8_t)(count - 1 - before_len);
|
||||
CopyDump(before, before_len);
|
||||
|
||||
// Before start of new section, set pusi_seen = 1
|
||||
|
@ -54,8 +54,8 @@ private:
|
||||
|
||||
public:
|
||||
// constructor & destructor
|
||||
cIptvSectionFilter(int Index, int DeviceIndex, u_short Pid,
|
||||
u_char Tid, u_char Mask);
|
||||
cIptvSectionFilter(int Index, int DeviceIndex, uint16_t Pid,
|
||||
uint8_t Tid, uint8_t Mask);
|
||||
virtual ~cIptvSectionFilter();
|
||||
void Process(const uint8_t* Data);
|
||||
int GetReadDesc(void);
|
||||
|
10
socket.c
10
socket.c
@ -59,7 +59,7 @@ bool cIptvSocket::OpenSocket(const int Port, const bool isUdp)
|
||||
// Bind socket
|
||||
memset(&sockAddr, '\0', sizeof(sockAddr));
|
||||
sockAddr.sin_family = AF_INET;
|
||||
sockAddr.sin_port = htons(Port);
|
||||
sockAddr.sin_port = htons((uint16_t)(Port & 0xFFFF));
|
||||
sockAddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
if (isUdp) {
|
||||
int err = bind(socketDesc, (struct sockaddr *)&sockAddr, sizeof(sockAddr));
|
||||
@ -110,7 +110,7 @@ int cIptvUdpSocket::Read(unsigned char* BufferAddr, unsigned int BufferLen)
|
||||
int len = 0;
|
||||
// Read data from socket
|
||||
if (isActive && socketDesc && BufferAddr && (BufferLen > 0))
|
||||
len = recvfrom(socketDesc, BufferAddr, BufferLen, MSG_DONTWAIT,
|
||||
len = (int)recvfrom(socketDesc, BufferAddr, BufferLen, MSG_DONTWAIT,
|
||||
(struct sockaddr *)&sockAddr, &addrlen);
|
||||
if ((len > 0) && (BufferAddr[0] == TS_SYNC_BYTE)) {
|
||||
return len;
|
||||
@ -126,14 +126,14 @@ int cIptvUdpSocket::Read(unsigned char* BufferAddr, unsigned int BufferLen)
|
||||
// payload type: MPEG2 TS = 33
|
||||
//unsigned int pt = readBuffer[1] & 0x7F;
|
||||
// header lenght
|
||||
unsigned int headerlen = (3 + cc) * sizeof(uint32_t);
|
||||
unsigned int headerlen = (3 + cc) * (unsigned int)sizeof(uint32_t);
|
||||
// check if extension
|
||||
if (x) {
|
||||
// extension header length
|
||||
unsigned int ehl = (((BufferAddr[headerlen + 2] & 0xFF) << 8) |
|
||||
(BufferAddr[headerlen + 3] & 0xFF));
|
||||
// update header length
|
||||
headerlen += (ehl + 1) * sizeof(uint32_t);
|
||||
headerlen += (ehl + 1) * (unsigned int)sizeof(uint32_t);
|
||||
}
|
||||
// Check that rtp is version 2 and payload contains multiple of TS packet data
|
||||
if ((v == 2) && (((len - headerlen) % TS_SIZE) == 0) &&
|
||||
@ -174,7 +174,7 @@ int cIptvTcpSocket::Read(unsigned char* BufferAddr, unsigned int BufferLen)
|
||||
socklen_t addrlen = sizeof(sockAddr);
|
||||
// Read data from socket
|
||||
if (isActive && socketDesc && BufferAddr && (BufferLen > 0))
|
||||
return recvfrom(socketDesc, BufferAddr, BufferLen, MSG_DONTWAIT,
|
||||
return (int)recvfrom(socketDesc, BufferAddr, BufferLen, MSG_DONTWAIT,
|
||||
(struct sockaddr *)&sockAddr, &addrlen);
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ cString cIptvSectionStatistics::GetSectionStatistic()
|
||||
cMutexLock MutexLock(&mutex);
|
||||
uint64_t elapsed = timer.Elapsed(); /* in milliseconds */
|
||||
timer.Set();
|
||||
long bitrate = elapsed ? (long)(((float)1000 / KILOBYTE(1)) * filteredData / elapsed) : 0L;
|
||||
long bitrate = elapsed ? (1000L * filteredData / KILOBYTE(1) / elapsed) : 0L;
|
||||
if (!IptvConfig.GetUseBytes())
|
||||
bitrate *= 8;
|
||||
// no trailing linefeed here!
|
||||
@ -75,7 +75,7 @@ cString cIptvPidStatistics::GetPidStatistic()
|
||||
cString info("Active pids:\n");
|
||||
for (unsigned int i = 0; i < IPTV_STATS_ACTIVE_PIDS_COUNT; ++i) {
|
||||
if (mostActivePids[i].pid) {
|
||||
long bitrate = elapsed ? (long)(((float)1000 / KILOBYTE(1)) * mostActivePids[i].DataAmount / elapsed) : 0L;
|
||||
long bitrate = elapsed ? (1000L * mostActivePids[i].DataAmount / KILOBYTE(1) / elapsed) : 0L;
|
||||
if (!IptvConfig.GetUseBytes())
|
||||
bitrate *= 8;
|
||||
info = cString::sprintf("%sPid %d: %4d (%4ld k%s/s)\n", *info, i,
|
||||
@ -145,7 +145,7 @@ cString cIptvStreamerStatistics::GetStreamerStatistic()
|
||||
cMutexLock MutexLock(&mutex);
|
||||
uint64_t elapsed = timer.Elapsed(); /* in milliseconds */
|
||||
timer.Set();
|
||||
long bitrate = elapsed ? (long)(((float)1000 / KILOBYTE(1)) * dataBytes / elapsed) : 0L;
|
||||
long bitrate = elapsed ? (1000L * dataBytes / KILOBYTE(1) / elapsed) : 0L;
|
||||
if (!IptvConfig.GetUseBytes())
|
||||
bitrate *= 8;
|
||||
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);
|
||||
uint64_t elapsed = timer.Elapsed(); /* in milliseconds */
|
||||
timer.Set();
|
||||
long bitrate = elapsed ? (long)(((float)1000 / KILOBYTE(1)) * dataBytes / elapsed) : 0L;
|
||||
long bitrate = elapsed ? (1000L * dataBytes / KILOBYTE(1) / elapsed) : 0L;
|
||||
long totalSpace = MEGABYTE(IptvConfig.GetTsBufferSize());
|
||||
float percentage = (float)((float)usedSpace / (float)totalSpace * 100.0);
|
||||
long totalKilos = totalSpace / KILOBYTE(1);
|
||||
|
Loading…
Reference in New Issue
Block a user