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
|
||||
struct stat sb;
|
||||
cString filename = cString::sprintf(IPTV_DVR_FILENAME, deviceIndexM);
|
||||
stat(filename, &sb);
|
||||
if (S_ISFIFO(sb.st_mode)) {
|
||||
dvrFdM = open(filename, O_RDWR | O_NONBLOCK);
|
||||
if (dvrFdM >= 0)
|
||||
info("IPTV device %d redirecting input stream to '%s'", deviceIndexM, *filename);
|
||||
if(stat(filename, &sb) == 0) {
|
||||
if (S_ISFIFO(sb.st_mode)) {
|
||||
dvrFdM = open(filename, O_RDWR | O_NONBLOCK);
|
||||
if (dvrFdM >= 0)
|
||||
info("IPTV device %d redirecting input stream to '%s'", deviceIndexM, *filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cIptvDevice::~cIptvDevice()
|
||||
|
18
iptv.c
18
iptv.c
@ -79,22 +79,22 @@ bool cPluginIptv::ProcessArgs(int argc, char *argv[])
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
// Implement command line argument processing here if applicable.
|
||||
static const struct option long_options[] = {
|
||||
{ "devices", required_argument, NULL, 'd' },
|
||||
{ "trace", required_argument, NULL, 't' },
|
||||
{ NULL, no_argument, NULL, 0 }
|
||||
{ "devices", required_argument, NULL, 'd' },
|
||||
{ "trace", required_argument, NULL, 't' },
|
||||
{ NULL, no_argument, NULL, 0 }
|
||||
};
|
||||
|
||||
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) {
|
||||
case 'd':
|
||||
deviceCountM = atoi(optarg);
|
||||
break;
|
||||
deviceCountM = atoi(optarg);
|
||||
break;
|
||||
case 't':
|
||||
IptvConfig.SetTraceMode(strtol(optarg, NULL, 0));
|
||||
break;
|
||||
IptvConfig.SetTraceMode(atoi(optarg));
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -280,8 +280,10 @@ bool cIptvProtocolCurl::Connect()
|
||||
return true;
|
||||
|
||||
// Initialize the curl session
|
||||
if (!handleM)
|
||||
if (!handleM) {
|
||||
handleM = curl_easy_init();
|
||||
connectedM = true;
|
||||
}
|
||||
|
||||
if (handleM && !isempty(*streamUrlM)) {
|
||||
CURLcode res = CURLE_OK;
|
||||
@ -428,7 +430,6 @@ bool cIptvProtocolCurl::Connect()
|
||||
}
|
||||
|
||||
timeoutM.Set(eKeepAliveIntervalMs);
|
||||
connectedM = 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_addr.s_addr = htonl(INADDR_ANY);
|
||||
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);
|
||||
|
||||
ERROR_IF_RET(setsockopt(socketDescM, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(int)) < 0, "setsockopt(SO_RCVBUF)", return false);
|
||||
}
|
||||
// Update socket port
|
||||
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);
|
||||
}
|
||||
else {
|
||||
struct ip_mreq mreq;
|
||||
mreq.imr_multiaddr.s_addr = streamAddrM;
|
||||
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);
|
||||
}
|
||||
if (IN_MULTICAST(ntohl(streamAddrM))) {
|
||||
struct ip_mreq mreq;
|
||||
mreq.imr_multiaddr.s_addr = streamAddrM;
|
||||
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
|
||||
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);
|
||||
}
|
||||
else {
|
||||
struct ip_mreq mreq;
|
||||
mreq.imr_multiaddr.s_addr = streamAddrM;
|
||||
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);
|
||||
if (IN_MULTICAST(ntohl(streamAddrM))) {
|
||||
struct ip_mreq mreq;
|
||||
mreq.imr_multiaddr.s_addr = streamAddrM;
|
||||
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
|
||||
isActiveM = false;
|
||||
}
|
||||
|
@ -173,7 +173,6 @@ void cIptvStreamerStatistics::AddStreamerStatistic(long bytesP)
|
||||
// Buffer statistics class
|
||||
cIptvBufferStatistics::cIptvBufferStatistics()
|
||||
: dataBytesM(0),
|
||||
freeSpaceM(0),
|
||||
usedSpaceM(0),
|
||||
timerM(),
|
||||
mutexM()
|
||||
|
@ -78,7 +78,6 @@ protected:
|
||||
|
||||
private:
|
||||
long dataBytesM;
|
||||
long freeSpaceM;
|
||||
long usedSpaceM;
|
||||
cTimeMs timerM;
|
||||
cMutex mutexM;
|
||||
|
Loading…
x
Reference in New Issue
Block a user