mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 11:37:03 +00:00
Merge 4ef531e6379ab30dadb6026cdd015a1c66b70744 into f7369c9578c1437c7a19cf11e21424844f42a341
This commit is contained in:
commit
735ef0dcb8
11
device.c
11
device.c
@ -46,12 +46,13 @@ cIptvDevice::cIptvDevice(unsigned int indexP)
|
|||||||
// Check if dvr fifo exists
|
// Check if dvr fifo exists
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
cString filename = cString::sprintf(IPTV_DVR_FILENAME, deviceIndexM);
|
cString filename = cString::sprintf(IPTV_DVR_FILENAME, deviceIndexM);
|
||||||
stat(filename, &sb);
|
if(stat(filename, &sb) == 0) {
|
||||||
if (S_ISFIFO(sb.st_mode)) {
|
if (S_ISFIFO(sb.st_mode)) {
|
||||||
dvrFdM = open(filename, O_RDWR | O_NONBLOCK);
|
dvrFdM = open(filename, O_RDWR | O_NONBLOCK);
|
||||||
if (dvrFdM >= 0)
|
if (dvrFdM >= 0)
|
||||||
info("IPTV device %d redirecting input stream to '%s'", deviceIndexM, *filename);
|
info("IPTV device %d redirecting input stream to '%s'", deviceIndexM, *filename);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cIptvDevice::~cIptvDevice()
|
cIptvDevice::~cIptvDevice()
|
||||||
|
18
iptv.c
18
iptv.c
@ -79,22 +79,22 @@ bool cPluginIptv::ProcessArgs(int argc, char *argv[])
|
|||||||
debug1("%s", __PRETTY_FUNCTION__);
|
debug1("%s", __PRETTY_FUNCTION__);
|
||||||
// Implement command line argument processing here if applicable.
|
// Implement command line argument processing here if applicable.
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{ "devices", required_argument, NULL, 'd' },
|
{ "devices", required_argument, NULL, 'd' },
|
||||||
{ "trace", required_argument, NULL, 't' },
|
{ "trace", required_argument, NULL, 't' },
|
||||||
{ NULL, no_argument, NULL, 0 }
|
{ NULL, no_argument, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt_long(argc, argv, "d:", long_options, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, "d:t:", long_options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'd':
|
case 'd':
|
||||||
deviceCountM = atoi(optarg);
|
deviceCountM = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
IptvConfig.SetTraceMode(strtol(optarg, NULL, 0));
|
IptvConfig.SetTraceMode(atoi(optarg));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -280,8 +280,10 @@ bool cIptvProtocolCurl::Connect()
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Initialize the curl session
|
// Initialize the curl session
|
||||||
if (!handleM)
|
if (!handleM) {
|
||||||
handleM = curl_easy_init();
|
handleM = curl_easy_init();
|
||||||
|
connectedM = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (handleM && !isempty(*streamUrlM)) {
|
if (handleM && !isempty(*streamUrlM)) {
|
||||||
CURLcode res = CURLE_OK;
|
CURLcode res = CURLE_OK;
|
||||||
@ -428,7 +430,6 @@ bool cIptvProtocolCurl::Connect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
timeoutM.Set(eKeepAliveIntervalMs);
|
timeoutM.Set(eKeepAliveIntervalMs);
|
||||||
connectedM = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
30
socket.c
30
socket.c
@ -73,8 +73,14 @@ bool cIptvSocket::OpenSocket(const int portP, const bool isUdpP)
|
|||||||
sockAddrM.sin_port = htons((uint16_t)(portP & 0xFFFF));
|
sockAddrM.sin_port = htons((uint16_t)(portP & 0xFFFF));
|
||||||
sockAddrM.sin_addr.s_addr = htonl(INADDR_ANY);
|
sockAddrM.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||||
if (isUdpP)
|
if (isUdpP)
|
||||||
ERROR_IF_FUNC(bind(socketDescM, (struct sockaddr *)&sockAddrM, sizeof(sockAddrM)) < 0,
|
{
|
||||||
|
int rcvbuf = 4 * 1024 * 1024;
|
||||||
|
|
||||||
|
ERROR_IF_FUNC(bind(socketDescM, (struct sockaddr *)&sockAddrM, sizeof(sockAddrM)) < 0,
|
||||||
"bind()", CloseSocket(), return false);
|
"bind()", CloseSocket(), return false);
|
||||||
|
|
||||||
|
ERROR_IF_RET(setsockopt(socketDescM, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(int)) < 0, "setsockopt(SO_RCVBUF)", return false);
|
||||||
|
}
|
||||||
// Update socket port
|
// Update socket port
|
||||||
socketPortM = portP;
|
socketPortM = portP;
|
||||||
}
|
}
|
||||||
@ -184,11 +190,13 @@ bool cIptvUdpSocket::JoinMulticast(void)
|
|||||||
ERROR_IF_RET(setsockopt(socketDescM, SOL_IP, MCAST_JOIN_SOURCE_GROUP, &gsr, sizeof(gsr)) < 0, "setsockopt(MCAST_JOIN_SOURCE_GROUP)", return false);
|
ERROR_IF_RET(setsockopt(socketDescM, SOL_IP, MCAST_JOIN_SOURCE_GROUP, &gsr, sizeof(gsr)) < 0, "setsockopt(MCAST_JOIN_SOURCE_GROUP)", return false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
struct ip_mreq mreq;
|
if (IN_MULTICAST(ntohl(streamAddrM))) {
|
||||||
mreq.imr_multiaddr.s_addr = streamAddrM;
|
struct ip_mreq mreq;
|
||||||
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
mreq.imr_multiaddr.s_addr = streamAddrM;
|
||||||
ERROR_IF_RET(setsockopt(socketDescM, SOL_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0, "setsockopt(IP_ADD_MEMBERSHIP)", return false);
|
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||||
}
|
ERROR_IF_RET(setsockopt(socketDescM, SOL_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0, "setsockopt(IP_ADD_MEMBERSHIP)", return false);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Update multicasting flag
|
// Update multicasting flag
|
||||||
isActiveM = true;
|
isActiveM = true;
|
||||||
}
|
}
|
||||||
@ -218,11 +226,13 @@ bool cIptvUdpSocket::DropMulticast(void)
|
|||||||
ERROR_IF_RET(setsockopt(socketDescM, SOL_IP, MCAST_LEAVE_SOURCE_GROUP, &gsr, sizeof(gsr)) < 0, "setsockopt(MCAST_LEAVE_SOURCE_GROUP)", return false);
|
ERROR_IF_RET(setsockopt(socketDescM, SOL_IP, MCAST_LEAVE_SOURCE_GROUP, &gsr, sizeof(gsr)) < 0, "setsockopt(MCAST_LEAVE_SOURCE_GROUP)", return false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
struct ip_mreq mreq;
|
if (IN_MULTICAST(ntohl(streamAddrM))) {
|
||||||
mreq.imr_multiaddr.s_addr = streamAddrM;
|
struct ip_mreq mreq;
|
||||||
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
mreq.imr_multiaddr.s_addr = streamAddrM;
|
||||||
ERROR_IF_RET(setsockopt(socketDescM, SOL_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) < 0, "setsockopt(IP_DROP_MEMBERSHIP)", return false);
|
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||||
|
ERROR_IF_RET(setsockopt(socketDescM, SOL_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) < 0, "setsockopt(IP_DROP_MEMBERSHIP)", return false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Update multicasting flag
|
// Update multicasting flag
|
||||||
isActiveM = false;
|
isActiveM = false;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,6 @@ void cIptvStreamerStatistics::AddStreamerStatistic(long bytesP)
|
|||||||
// Buffer statistics class
|
// Buffer statistics class
|
||||||
cIptvBufferStatistics::cIptvBufferStatistics()
|
cIptvBufferStatistics::cIptvBufferStatistics()
|
||||||
: dataBytesM(0),
|
: dataBytesM(0),
|
||||||
freeSpaceM(0),
|
|
||||||
usedSpaceM(0),
|
usedSpaceM(0),
|
||||||
timerM(),
|
timerM(),
|
||||||
mutexM()
|
mutexM()
|
||||||
|
@ -78,7 +78,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
long dataBytesM;
|
long dataBytesM;
|
||||||
long freeSpaceM;
|
|
||||||
long usedSpaceM;
|
long usedSpaceM;
|
||||||
cTimeMs timerM;
|
cTimeMs timerM;
|
||||||
cMutex mutexM;
|
cMutex mutexM;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user