mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Fixed some channel switching bugs.
This commit is contained in:
parent
ff84c54d50
commit
b3b06e569f
4
HISTORY
4
HISTORY
@ -159,7 +159,7 @@ VDR Plugin 'iptv' Revision History
|
||||
- Added support for LDFLAGS.
|
||||
- Added cppcheck target into Makefile.
|
||||
|
||||
2012-03-25: Version 0.5.1
|
||||
2012-04-01: Version 0.5.1
|
||||
|
||||
- Updated for vdr-1.7.27.
|
||||
- Fixed channel switching in UDP protocol.
|
||||
- Fixed some channel switching bugs.
|
||||
|
@ -22,7 +22,8 @@
|
||||
cIptvProtocolExt::cIptvProtocolExt()
|
||||
: pid(-1),
|
||||
scriptFile(""),
|
||||
scriptParameter(0)
|
||||
scriptParameter(0),
|
||||
streamPort(0)
|
||||
{
|
||||
debug("cIptvProtocolExt::cIptvProtocolExt()\n");
|
||||
}
|
||||
@ -53,7 +54,7 @@ void cIptvProtocolExt::ExecuteScript(void)
|
||||
for (int i = STDERR_FILENO + 1; i < MaxPossibleFileDescriptors; i++)
|
||||
close(i);
|
||||
// Execute the external script
|
||||
cString cmd = cString::sprintf("%s %d %d", *scriptFile, scriptParameter, socketPort);
|
||||
cString cmd = cString::sprintf("%s %d %d", *scriptFile, scriptParameter, streamPort);
|
||||
debug("cIptvProtocolExt::ExecuteScript(child): %s\n", *cmd);
|
||||
if (execl("/bin/bash", "sh", "-c", *cmd, (char *)NULL) == -1) {
|
||||
error("Script execution failed: %s", *cmd);
|
||||
@ -113,7 +114,7 @@ bool cIptvProtocolExt::Open(void)
|
||||
if (!strlen(*scriptFile))
|
||||
return false;
|
||||
// Create the listening socket
|
||||
OpenSocket(socketPort);
|
||||
OpenSocket(streamPort);
|
||||
// Execute the external script
|
||||
ExecuteScript();
|
||||
isActive = true;
|
||||
@ -149,7 +150,7 @@ bool cIptvProtocolExt::Set(const char* Location, const int Parameter, const int
|
||||
}
|
||||
scriptParameter = Parameter;
|
||||
// Update listen port
|
||||
socketPort = IptvConfig.GetExtProtocolBasePort() + Index;
|
||||
streamPort = IptvConfig.GetExtProtocolBasePort() + Index;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ private:
|
||||
int pid;
|
||||
cString scriptFile;
|
||||
int scriptParameter;
|
||||
int streamPort;
|
||||
|
||||
private:
|
||||
void TerminateScript(void);
|
||||
|
@ -20,7 +20,8 @@
|
||||
|
||||
cIptvProtocolHttp::cIptvProtocolHttp()
|
||||
: streamAddr(strdup("")),
|
||||
streamPath(strdup("/"))
|
||||
streamPath(strdup("/")),
|
||||
streamPort(0)
|
||||
{
|
||||
debug("cIptvProtocolHttp::cIptvProtocolHttp()\n");
|
||||
}
|
||||
@ -41,7 +42,7 @@ bool cIptvProtocolHttp::Connect(void)
|
||||
// Check that stream address is valid
|
||||
if (!isActive && !isempty(streamAddr) && !isempty(streamPath)) {
|
||||
// Ensure that socket is valid and connect
|
||||
OpenSocket(socketPort, streamAddr);
|
||||
OpenSocket(streamPort, streamAddr);
|
||||
if (!ConnectSocket()) {
|
||||
CloseSocket();
|
||||
return false;
|
||||
@ -185,8 +186,8 @@ bool cIptvProtocolHttp::Set(const char* Location, const int Parameter, const int
|
||||
}
|
||||
else
|
||||
streamPath = strcpyrealloc(streamPath, "/");
|
||||
socketPort = Parameter;
|
||||
//debug("http://%s:%d%s\n", streamAddr, socketPort, streamPath);
|
||||
streamPort = Parameter;
|
||||
//debug("http://%s:%d%s\n", streamAddr, streamPort, streamPath);
|
||||
// Re-connect the socket
|
||||
Connect();
|
||||
}
|
||||
@ -196,5 +197,5 @@ bool cIptvProtocolHttp::Set(const char* Location, const int Parameter, const int
|
||||
cString cIptvProtocolHttp::GetInformation(void)
|
||||
{
|
||||
//debug("cIptvProtocolHttp::GetInformation()");
|
||||
return cString::sprintf("http://%s:%d%s", streamAddr, socketPort, streamPath);
|
||||
return cString::sprintf("http://%s:%d%s", streamAddr, streamPort, streamPath);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ class cIptvProtocolHttp : public cIptvTcpSocket, public cIptvProtocolIf {
|
||||
private:
|
||||
char* streamAddr;
|
||||
char* streamPath;
|
||||
int streamPort;
|
||||
|
||||
private:
|
||||
bool Connect(void);
|
||||
|
@ -20,7 +20,8 @@
|
||||
|
||||
cIptvProtocolUdp::cIptvProtocolUdp()
|
||||
: streamAddr(strdup("")),
|
||||
sourceAddr(strdup(""))
|
||||
sourceAddr(strdup("")),
|
||||
streamPort(0)
|
||||
{
|
||||
debug("cIptvProtocolUdp::cIptvProtocolUdp()\n");
|
||||
}
|
||||
@ -38,7 +39,7 @@ cIptvProtocolUdp::~cIptvProtocolUdp()
|
||||
bool cIptvProtocolUdp::Open(void)
|
||||
{
|
||||
debug("cIptvProtocolUdp::Open(): sourceAddr=%s streamAddr=%s\n", sourceAddr, streamAddr);
|
||||
OpenSocket(socketPort, isempty(sourceAddr) ? INADDR_ANY : inet_addr(sourceAddr));
|
||||
OpenSocket(streamPort, isempty(sourceAddr) ? INADDR_ANY : inet_addr(sourceAddr));
|
||||
if (!isempty(streamAddr)) {
|
||||
// Join a new multicast group
|
||||
JoinMulticast(inet_addr(streamAddr));
|
||||
@ -51,7 +52,7 @@ bool cIptvProtocolUdp::Close(void)
|
||||
debug("cIptvProtocolUdp::Close(): sourceAddr=%s streamAddr=%s\n", sourceAddr, streamAddr);
|
||||
if (!isempty(streamAddr)) {
|
||||
// Drop the multicast group
|
||||
OpenSocket(socketPort, isempty(sourceAddr) ? INADDR_ANY : inet_addr(sourceAddr));
|
||||
OpenSocket(streamPort, isempty(sourceAddr) ? INADDR_ANY : inet_addr(sourceAddr));
|
||||
DropMulticast(inet_addr(streamAddr));
|
||||
}
|
||||
// Close the socket
|
||||
@ -73,7 +74,7 @@ bool cIptvProtocolUdp::Set(const char* Location, const int Parameter, const int
|
||||
if (!isempty(Location)) {
|
||||
// Drop the multicast group
|
||||
if (!isempty(streamAddr)) {
|
||||
OpenSocket(socketPort, isempty(sourceAddr) ? INADDR_ANY : inet_addr(sourceAddr));
|
||||
OpenSocket(streamPort, isempty(sourceAddr) ? INADDR_ANY : inet_addr(sourceAddr));
|
||||
DropMulticast(inet_addr(streamAddr));
|
||||
}
|
||||
// Update stream address and port
|
||||
@ -85,10 +86,10 @@ bool cIptvProtocolUdp::Set(const char* Location, const int Parameter, const int
|
||||
}
|
||||
else
|
||||
sourceAddr = strcpyrealloc(sourceAddr, "");
|
||||
socketPort = Parameter;
|
||||
streamPort = Parameter;
|
||||
// Join a new multicast group
|
||||
if (!isempty(streamAddr)) {
|
||||
OpenSocket(socketPort, isempty(sourceAddr) ? INADDR_ANY : inet_addr(sourceAddr));
|
||||
OpenSocket(streamPort, isempty(sourceAddr) ? INADDR_ANY : inet_addr(sourceAddr));
|
||||
JoinMulticast(inet_addr(streamAddr));
|
||||
}
|
||||
}
|
||||
@ -98,5 +99,5 @@ bool cIptvProtocolUdp::Set(const char* Location, const int Parameter, const int
|
||||
cString cIptvProtocolUdp::GetInformation(void)
|
||||
{
|
||||
//debug("cIptvProtocolUdp::GetInformation()");
|
||||
return cString::sprintf("udp://%s:%d", streamAddr, socketPort);
|
||||
return cString::sprintf("udp://%s:%d", streamAddr, streamPort);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ class cIptvProtocolUdp : public cIptvUdpSocket, public cIptvProtocolIf {
|
||||
private:
|
||||
char* streamAddr;
|
||||
char* sourceAddr;
|
||||
int streamPort;
|
||||
|
||||
public:
|
||||
cIptvProtocolUdp();
|
||||
|
Loading…
Reference in New Issue
Block a user