mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Channel parameter refactoring.
This commit is contained in:
parent
5ed04a6e72
commit
8e3956cbeb
4
README
4
README
@ -101,8 +101,8 @@ Configuration:
|
|||||||
TV1;IPTV:1:IPTV|UDP|127.0.0.1|1234:P:0:512:650:2321:0:1:0:0:0
|
TV1;IPTV:1:IPTV|UDP|127.0.0.1|1234:P:0:512:650:2321:0:1:0:0:0
|
||||||
^ ^ ^ ^ ^ ^
|
^ ^ ^ ^ ^ ^
|
||||||
| | | | | Source type ("P")
|
| | | | | Source type ("P")
|
||||||
| | | | IP Port Number or File delay (ms)
|
| | | | IP Port Number, File delay (ms), Script parameter
|
||||||
| | | IP Address or File Location
|
| | | IP Address, File location, Script location
|
||||||
| | Protocol ("UDP", "HTTP", "FILE", "EXT")
|
| | Protocol ("UDP", "HTTP", "FILE", "EXT")
|
||||||
| Plugin ID ("IPTV")
|
| Plugin ID ("IPTV")
|
||||||
Unique enumeration
|
Unique enumeration
|
||||||
|
22
device.c
22
device.c
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: device.c,v 1.69 2007/10/15 20:06:38 ajhseppa Exp $
|
* $Id: device.c,v 1.70 2007/10/19 21:36:27 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -155,26 +155,26 @@ cString cIptvDevice::GetInformation(unsigned int Page)
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cIptvDevice::GetChannelSettings(const char *Param, int *IpPort, cIptvProtocolIf* *Protocol)
|
cString cIptvDevice::GetChannelSettings(const char *IptvParam, int *Parameter, cIptvProtocolIf* *Protocol)
|
||||||
{
|
{
|
||||||
debug("cIptvDevice::GetChannelSettings(%d)\n", deviceIndex);
|
debug("cIptvDevice::GetChannelSettings(%d)\n", deviceIndex);
|
||||||
char *loc = NULL;
|
char *loc = NULL;
|
||||||
if (sscanf(Param, "IPTV|UDP|%a[^|]|%u", &loc, IpPort) == 2) {
|
if (sscanf(IptvParam, "IPTV|UDP|%a[^|]|%u", &loc, Parameter) == 2) {
|
||||||
cString addr(loc, true);
|
cString addr(loc, true);
|
||||||
*Protocol = pUdpProtocol;
|
*Protocol = pUdpProtocol;
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
else if (sscanf(Param, "IPTV|HTTP|%a[^|]|%u", &loc, IpPort) == 2) {
|
else if (sscanf(IptvParam, "IPTV|HTTP|%a[^|]|%u", &loc, Parameter) == 2) {
|
||||||
cString addr(loc, true);
|
cString addr(loc, true);
|
||||||
*Protocol = pHttpProtocol;
|
*Protocol = pHttpProtocol;
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
else if (sscanf(Param, "IPTV|FILE|%a[^|]|%u", &loc, IpPort) == 2) {
|
else if (sscanf(IptvParam, "IPTV|FILE|%a[^|]|%u", &loc, Parameter) == 2) {
|
||||||
cString addr(loc, true);
|
cString addr(loc, true);
|
||||||
*Protocol = pFileProtocol;
|
*Protocol = pFileProtocol;
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
else if (sscanf(Param, "IPTV|EXT|%a[^|]|%u", &loc, IpPort) == 2) {
|
else if (sscanf(IptvParam, "IPTV|EXT|%a[^|]|%u", &loc, Parameter) == 2) {
|
||||||
cString addr(loc, true);
|
cString addr(loc, true);
|
||||||
*Protocol = pExtProtocol;
|
*Protocol = pExtProtocol;
|
||||||
return addr;
|
return addr;
|
||||||
@ -215,17 +215,17 @@ bool cIptvDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *N
|
|||||||
|
|
||||||
bool cIptvDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
|
bool cIptvDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
|
||||||
{
|
{
|
||||||
int port;
|
int parameter;
|
||||||
cString addr;
|
cString location;
|
||||||
cIptvProtocolIf *protocol;
|
cIptvProtocolIf *protocol;
|
||||||
|
|
||||||
debug("cIptvDevice::SetChannelDevice(%d)\n", deviceIndex);
|
debug("cIptvDevice::SetChannelDevice(%d)\n", deviceIndex);
|
||||||
addr = GetChannelSettings(Channel->PluginParam(), &port, &protocol);
|
location = GetChannelSettings(Channel->PluginParam(), ¶meter, &protocol);
|
||||||
if (isempty(addr)) {
|
if (isempty(location)) {
|
||||||
error("ERROR: Unrecognized IPTV channel settings: %s", Channel->PluginParam());
|
error("ERROR: Unrecognized IPTV channel settings: %s", Channel->PluginParam());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pIptvStreamer->Set(addr, port, protocol);
|
pIptvStreamer->Set(location, parameter, protocol);
|
||||||
if (pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning())
|
if (pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning())
|
||||||
pSidScanner->SetChannel(Channel);
|
pSidScanner->SetChannel(Channel);
|
||||||
return true;
|
return true;
|
||||||
|
4
device.h
4
device.h
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: device.h,v 1.33 2007/10/15 21:03:45 rahrenbe Exp $
|
* $Id: device.h,v 1.34 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_DEVICE_H
|
#ifndef __IPTV_DEVICE_H
|
||||||
@ -61,7 +61,7 @@ private:
|
|||||||
|
|
||||||
// for channel parsing & buffering
|
// for channel parsing & buffering
|
||||||
private:
|
private:
|
||||||
cString GetChannelSettings(const char *Param, int *IpPort, cIptvProtocolIf* *Protocol);
|
cString GetChannelSettings(const char *IptvParam, int *Parameter, cIptvProtocolIf* *Protocol);
|
||||||
bool ProvidesIptv(const char *Param) const;
|
bool ProvidesIptv(const char *Param) const;
|
||||||
void ResetBuffering(void);
|
void ResetBuffering(void);
|
||||||
bool IsBuffering(void);
|
bool IsBuffering(void);
|
||||||
|
@ -1,5 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ $# -ne 2 ]; then
|
||||||
|
logger "$0: error: Invalid parameter count '$#' $*"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Channels.conf parameter
|
||||||
|
PARAMETER=${1}
|
||||||
|
|
||||||
|
# Iptv plugin listens this port
|
||||||
|
PORT=${2}
|
||||||
|
|
||||||
|
# Define stream address
|
||||||
URL=""
|
URL=""
|
||||||
|
|
||||||
if [ -z "${URL}" ]; then
|
if [ -z "${URL}" ]; then
|
||||||
@ -7,9 +19,5 @@ if [ -z "${URL}" ]; then
|
|||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -ne 1 ]; then
|
# Use 'exec' for capturing script pid
|
||||||
logger "$0: error: Invalid parameter count '$#' $*"
|
exec vlc "${URL}" --sout "#transcode{vcodec=mp2v,acodec=mpga,vb=800,ab=192}:standard{access=udp,mux=ts,dst=127.0.0.1:${PORT}}" --intf dummy
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec vlc "${URL}" --sout "#transcode{vcodec=mp2v,acodec=mpga,vb=800,ab=192}:standard{access=udp,mux=ts,dst=127.0.0.1:${1}}" --intf dummy
|
|
||||||
|
12
po/fi_FI.po
12
po/fi_FI.po
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: VDR 1.5.7\n"
|
"Project-Id-Version: VDR 1.5.7\n"
|
||||||
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
|
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
|
||||||
"POT-Creation-Date: 2007-10-17 00:19+0300\n"
|
"POT-Creation-Date: 2007-10-19 23:10+0300\n"
|
||||||
"PO-Revision-Date: 2007-08-12 23:22+0300\n"
|
"PO-Revision-Date: 2007-08-12 23:22+0300\n"
|
||||||
"Last-Translator: Rolf Ahrenberg\n"
|
"Last-Translator: Rolf Ahrenberg\n"
|
||||||
"Language-Team: <vdr@linuxtv.org>\n"
|
"Language-Team: <vdr@linuxtv.org>\n"
|
||||||
@ -57,12 +57,18 @@ msgstr "Protokolla"
|
|||||||
msgid "Delay (ms)"
|
msgid "Delay (ms)"
|
||||||
msgstr "Viive (ms)"
|
msgstr "Viive (ms)"
|
||||||
|
|
||||||
msgid "Port"
|
msgid "Script"
|
||||||
msgstr "Portti"
|
msgstr "Skripti"
|
||||||
|
|
||||||
|
msgid "Parameter"
|
||||||
|
msgstr "Parametri"
|
||||||
|
|
||||||
msgid "Address"
|
msgid "Address"
|
||||||
msgstr "Osoite"
|
msgstr "Osoite"
|
||||||
|
|
||||||
|
msgid "Port"
|
||||||
|
msgstr "Portti"
|
||||||
|
|
||||||
msgid "Nid"
|
msgid "Nid"
|
||||||
msgstr "Verkko-ID"
|
msgstr "Verkko-ID"
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: protocolext.c,v 1.6 2007/10/19 18:26:27 ajhseppa Exp $
|
* $Id: protocolext.c,v 1.7 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
@ -23,12 +23,12 @@
|
|||||||
cIptvProtocolExt::cIptvProtocolExt()
|
cIptvProtocolExt::cIptvProtocolExt()
|
||||||
: pid(-1),
|
: pid(-1),
|
||||||
listenPort(4321),
|
listenPort(4321),
|
||||||
|
scriptParameter(0),
|
||||||
socketDesc(-1),
|
socketDesc(-1),
|
||||||
readBufferLen(TS_SIZE * IptvConfig.GetReadBufferTsCount()),
|
readBufferLen(TS_SIZE * IptvConfig.GetReadBufferTsCount())
|
||||||
isActive(false)
|
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolExt::cIptvProtocolExt()\n");
|
debug("cIptvProtocolExt::cIptvProtocolExt()\n");
|
||||||
streamAddr = strdup("");
|
scriptFile = strdup("");
|
||||||
listenAddr = strdup("127.0.0.1");
|
listenAddr = strdup("127.0.0.1");
|
||||||
// Allocate receive buffer
|
// Allocate receive buffer
|
||||||
readBuffer = MALLOC(unsigned char, readBufferLen);
|
readBuffer = MALLOC(unsigned char, readBufferLen);
|
||||||
@ -42,7 +42,7 @@ cIptvProtocolExt::~cIptvProtocolExt()
|
|||||||
// Drop the multicast group and close the socket
|
// Drop the multicast group and close the socket
|
||||||
Close();
|
Close();
|
||||||
// Free allocated memory
|
// Free allocated memory
|
||||||
free(streamAddr);
|
free(scriptFile);
|
||||||
free(listenAddr);
|
free(listenAddr);
|
||||||
free(readBuffer);
|
free(readBuffer);
|
||||||
}
|
}
|
||||||
@ -104,13 +104,17 @@ void cIptvProtocolExt::CloseSocket(void)
|
|||||||
void cIptvProtocolExt::ExecuteCommand(void)
|
void cIptvProtocolExt::ExecuteCommand(void)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolExt::ExecuteCommand()\n");
|
debug("cIptvProtocolExt::ExecuteCommand()\n");
|
||||||
|
// Check if already executing
|
||||||
|
if (pid > 0) {
|
||||||
|
error("ERROR: Cannot execute command!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Let's fork
|
// Let's fork
|
||||||
if ((pid = fork()) == -1) {
|
if ((pid = fork()) == -1) {
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
error("ERROR: fork(): %s", strerror_r(errno, tmp, sizeof(tmp)));
|
error("ERROR: fork(): %s", strerror_r(errno, tmp, sizeof(tmp)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if child process
|
// Check if child process
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
// Close all dup'ed filedescriptors
|
// Close all dup'ed filedescriptors
|
||||||
@ -119,18 +123,17 @@ void cIptvProtocolExt::ExecuteCommand(void)
|
|||||||
close(i);
|
close(i);
|
||||||
// Execute the external script
|
// Execute the external script
|
||||||
char* cmd = NULL;
|
char* cmd = NULL;
|
||||||
asprintf(&cmd, "%s %d", streamAddr, listenPort);
|
asprintf(&cmd, "%s %d %d", scriptFile, scriptParameter, listenPort);
|
||||||
debug("cIptvProtocolExt::ExecuteCommand(child): %s\n", cmd);
|
debug("cIptvProtocolExt::ExecuteCommand(child): %s\n", cmd);
|
||||||
if (execl("/bin/sh", "sh", "-c", cmd, NULL) == -1) {
|
if (execl("/bin/sh", "sh", "-c", cmd, NULL) == -1) {
|
||||||
|
error("ERROR: Command failed: %s", cmd);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
error("ERROR: Command failed: %s", streamAddr);
|
|
||||||
_exit(-1);
|
_exit(-1);
|
||||||
}
|
}
|
||||||
free(cmd);
|
free(cmd);
|
||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
isActive = true;
|
|
||||||
debug("cIptvProtocolExt::ExecuteCommand(): pid=%d\n", pid);
|
debug("cIptvProtocolExt::ExecuteCommand(): pid=%d\n", pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,18 +153,17 @@ void cIptvProtocolExt::TerminateCommand(void)
|
|||||||
error("ERROR: kill(): %s", strerror_r(errno, tmp, sizeof(tmp)));
|
error("ERROR: kill(): %s", strerror_r(errno, tmp, sizeof(tmp)));
|
||||||
waitOver = true;
|
waitOver = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!waitOver) {
|
while (!waitOver) {
|
||||||
retval = 0;
|
retval = 0;
|
||||||
waitms += timeoutms;
|
waitms += timeoutms;
|
||||||
if ((waitms % 2000) == 0) {
|
if ((waitms % 2000) == 0) {
|
||||||
error("ERROR: Script '%s' won't terminate - killing it", streamAddr);
|
error("ERROR: Script '%s' won't terminate - killing it!", scriptFile);
|
||||||
kill(pid, SIGKILL);
|
kill(pid, SIGKILL);
|
||||||
}
|
}
|
||||||
// Clear wait status to make sure child exit status is accessible
|
// Clear wait status to make sure child exit status is accessible
|
||||||
memset(&waitStatus, '\0', sizeof(waitStatus));
|
memset(&waitStatus, '\0', sizeof(waitStatus));
|
||||||
// Wait for child termination
|
// Wait for child termination
|
||||||
retval = waitid(P_PID, pid, &waitStatus, WNOHANG | WEXITED);
|
retval = waitid(P_PID, pid, &waitStatus, (WNOHANG | WEXITED));
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
error("ERROR: waitid(): %s", strerror_r(errno, tmp, sizeof(tmp)));
|
error("ERROR: waitid(): %s", strerror_r(errno, tmp, sizeof(tmp)));
|
||||||
@ -169,20 +171,16 @@ void cIptvProtocolExt::TerminateCommand(void)
|
|||||||
}
|
}
|
||||||
// These are the acceptable conditions under which child exit is
|
// These are the acceptable conditions under which child exit is
|
||||||
// regarded as successful
|
// regarded as successful
|
||||||
if (!retval && waitStatus.si_pid && waitStatus.si_pid == pid
|
if (!retval && waitStatus.si_pid && (waitStatus.si_pid == pid) &&
|
||||||
&& (waitStatus.si_code == CLD_EXITED
|
((waitStatus.si_code == CLD_EXITED) || (waitStatus.si_code == CLD_KILLED))) {
|
||||||
|| waitStatus.si_code == CLD_KILLED)) {
|
|
||||||
debug("Child (%d) exited as expected\n", pid);
|
debug("Child (%d) exited as expected\n", pid);
|
||||||
waitOver = true;
|
waitOver = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unsuccessful wait, avoid busy looping
|
// Unsuccessful wait, avoid busy looping
|
||||||
if (!waitOver)
|
if (!waitOver)
|
||||||
cCondWait::SleepMs(timeoutms);
|
cCondWait::SleepMs(timeoutms);
|
||||||
}
|
}
|
||||||
|
|
||||||
pid = -1;
|
pid = -1;
|
||||||
isActive = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,34 +248,34 @@ int cIptvProtocolExt::Read(unsigned char* *BufferAddr)
|
|||||||
|
|
||||||
bool cIptvProtocolExt::Open(void)
|
bool cIptvProtocolExt::Open(void)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolExt::Open(): streamAddr=%s listenPort=%d\n", streamAddr, listenPort);
|
debug("cIptvProtocolExt::Open()\n");
|
||||||
// Reject completely empty stream addresses
|
// Reject empty script files
|
||||||
if (!strlen(streamAddr))
|
if (!strlen(scriptFile))
|
||||||
return false;
|
return false;
|
||||||
// Create the listening socket
|
// Create the listening socket
|
||||||
OpenSocket();
|
OpenSocket();
|
||||||
if (!isActive)
|
// Execute the external command
|
||||||
ExecuteCommand();
|
ExecuteCommand();
|
||||||
return isActive;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolExt::Close(void)
|
bool cIptvProtocolExt::Close(void)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolExt::Close(): streamAddr=%s\n", streamAddr);
|
debug("cIptvProtocolExt::Close()\n");
|
||||||
// Close the socket
|
// Close the socket
|
||||||
CloseSocket();
|
CloseSocket();
|
||||||
if (isActive)
|
// Terminate the external script
|
||||||
TerminateCommand();
|
TerminateCommand();
|
||||||
return !isActive;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolExt::Set(const char* Address, const int Port)
|
bool cIptvProtocolExt::Set(const char* Location, const int Parameter)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolExt::Set(): %s:%d\n", Address, Port);
|
debug("cIptvProtocolExt::Set(): Location=%s Parameter=%d\n", Location, Parameter);
|
||||||
if (!isempty(Address)) {
|
if (!isempty(Location)) {
|
||||||
// Update stream address and port
|
// Update stream address and port
|
||||||
streamAddr = strcpyrealloc(streamAddr, Address);
|
scriptFile = strcpyrealloc(scriptFile, Location);
|
||||||
listenPort = Port;
|
scriptParameter = Parameter;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -285,5 +283,5 @@ bool cIptvProtocolExt::Set(const char* Address, const int Port)
|
|||||||
cString cIptvProtocolExt::GetInformation(void)
|
cString cIptvProtocolExt::GetInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cIptvProtocolExt::GetInformation()");
|
//debug("cIptvProtocolExt::GetInformation()");
|
||||||
return cString::sprintf("ext://%s:%d", streamAddr, listenPort);
|
return cString::sprintf("ext://%s:%d", scriptFile, scriptParameter);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: protocolext.h,v 1.3 2007/10/18 19:33:15 rahrenbe Exp $
|
* $Id: protocolext.h,v 1.4 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_PROTOCOLEXT_H
|
#ifndef __IPTV_PROTOCOLEXT_H
|
||||||
@ -17,7 +17,8 @@ private:
|
|||||||
int pid;
|
int pid;
|
||||||
char* listenAddr;
|
char* listenAddr;
|
||||||
int listenPort;
|
int listenPort;
|
||||||
char* streamAddr;
|
char* scriptFile;
|
||||||
|
int scriptParameter;
|
||||||
int socketDesc;
|
int socketDesc;
|
||||||
unsigned char* readBuffer;
|
unsigned char* readBuffer;
|
||||||
unsigned int readBufferLen;
|
unsigned int readBufferLen;
|
||||||
@ -34,7 +35,7 @@ public:
|
|||||||
cIptvProtocolExt();
|
cIptvProtocolExt();
|
||||||
virtual ~cIptvProtocolExt();
|
virtual ~cIptvProtocolExt();
|
||||||
virtual int Read(unsigned char* *BufferAddr);
|
virtual int Read(unsigned char* *BufferAddr);
|
||||||
virtual bool Set(const char* Address, const int Port);
|
virtual bool Set(const char* Location, const int Parameter);
|
||||||
virtual bool Open(void);
|
virtual bool Open(void);
|
||||||
virtual bool Close(void);
|
virtual bool Close(void);
|
||||||
virtual cString GetInformation(void);
|
virtual cString GetInformation(void);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: protocolfile.c,v 1.10 2007/10/07 22:54:09 rahrenbe Exp $
|
* $Id: protocolfile.c,v 1.11 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -16,11 +16,12 @@
|
|||||||
#include "protocolfile.h"
|
#include "protocolfile.h"
|
||||||
|
|
||||||
cIptvProtocolFile::cIptvProtocolFile()
|
cIptvProtocolFile::cIptvProtocolFile()
|
||||||
: readBufferLen(TS_SIZE * IptvConfig.GetReadBufferTsCount()),
|
: fileDelay(0),
|
||||||
|
readBufferLen(TS_SIZE * IptvConfig.GetReadBufferTsCount()),
|
||||||
isActive(false)
|
isActive(false)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolFile::cIptvProtocolFile()\n");
|
debug("cIptvProtocolFile::cIptvProtocolFile()\n");
|
||||||
streamAddr = strdup("");
|
fileLocation = strdup("");
|
||||||
// Allocate receive buffer
|
// Allocate receive buffer
|
||||||
readBuffer = MALLOC(unsigned char, readBufferLen);
|
readBuffer = MALLOC(unsigned char, readBufferLen);
|
||||||
if (!readBuffer)
|
if (!readBuffer)
|
||||||
@ -33,7 +34,7 @@ cIptvProtocolFile::~cIptvProtocolFile()
|
|||||||
// Drop open handles
|
// Drop open handles
|
||||||
Close();
|
Close();
|
||||||
// Free allocated memory
|
// Free allocated memory
|
||||||
free(streamAddr);
|
free(fileLocation);
|
||||||
free(readBuffer);
|
free(readBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,8 +42,8 @@ bool cIptvProtocolFile::OpenFile(void)
|
|||||||
{
|
{
|
||||||
debug("cIptvProtocolFile::OpenFile()\n");
|
debug("cIptvProtocolFile::OpenFile()\n");
|
||||||
// Check that stream address is valid
|
// Check that stream address is valid
|
||||||
if (!isActive && !isempty(streamAddr)) {
|
if (!isActive && !isempty(fileLocation)) {
|
||||||
fileStream = fopen(streamAddr, "rb");
|
fileStream = fopen(fileLocation, "rb");
|
||||||
if (ferror(fileStream) || !fileStream) {
|
if (ferror(fileStream) || !fileStream) {
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
error("ERROR: fopen(): %s", strerror_r(errno, tmp, sizeof(tmp)));
|
error("ERROR: fopen(): %s", strerror_r(errno, tmp, sizeof(tmp)));
|
||||||
@ -58,7 +59,7 @@ void cIptvProtocolFile::CloseFile(void)
|
|||||||
{
|
{
|
||||||
debug("cIptvProtocolFile::CloseFile()\n");
|
debug("cIptvProtocolFile::CloseFile()\n");
|
||||||
// Check that file stream is valid
|
// Check that file stream is valid
|
||||||
if (isActive && !isempty(streamAddr)) {
|
if (isActive && !isempty(fileLocation)) {
|
||||||
fclose(fileStream);
|
fclose(fileStream);
|
||||||
// Update active flag
|
// Update active flag
|
||||||
isActive = false;
|
isActive = false;
|
||||||
@ -79,8 +80,8 @@ int cIptvProtocolFile::Read(unsigned char* *BufferAddr)
|
|||||||
rewind(fileStream);
|
rewind(fileStream);
|
||||||
// Sleep before reading the file stream to prevent aggressive busy looping
|
// Sleep before reading the file stream to prevent aggressive busy looping
|
||||||
// and prevent transfer ringbuffer overflows
|
// and prevent transfer ringbuffer overflows
|
||||||
if (streamPort)
|
if (fileDelay)
|
||||||
cCondWait::SleepMs(streamPort);
|
cCondWait::SleepMs(fileDelay);
|
||||||
// This check is to prevent a race condition where file may be switched off
|
// This check is to prevent a race condition where file may be switched off
|
||||||
// during the sleep and buffers are disposed. Check here that the plugin is
|
// during the sleep and buffers are disposed. Check here that the plugin is
|
||||||
// still active before accessing the buffers
|
// still active before accessing the buffers
|
||||||
@ -91,7 +92,7 @@ int cIptvProtocolFile::Read(unsigned char* *BufferAddr)
|
|||||||
|
|
||||||
bool cIptvProtocolFile::Open(void)
|
bool cIptvProtocolFile::Open(void)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolFile::Open(): streamAddr=%s\n", streamAddr);
|
debug("cIptvProtocolFile::Open()\n");
|
||||||
// Open the file stream
|
// Open the file stream
|
||||||
OpenFile();
|
OpenFile();
|
||||||
return true;
|
return true;
|
||||||
@ -99,21 +100,21 @@ bool cIptvProtocolFile::Open(void)
|
|||||||
|
|
||||||
bool cIptvProtocolFile::Close(void)
|
bool cIptvProtocolFile::Close(void)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolFile::Close(): streamAddr=%s\n", streamAddr);
|
debug("cIptvProtocolFile::Close()\n");
|
||||||
// Close the file stream
|
// Close the file stream
|
||||||
CloseFile();
|
CloseFile();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolFile::Set(const char* Address, const int Port)
|
bool cIptvProtocolFile::Set(const char* Location, const int Parameter)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolFile::Set(): %s:%d\n", Address, Port);
|
debug("cIptvProtocolFile::Set(): Location=%s Parameter=%d\n", Location, Parameter);
|
||||||
if (!isempty(Address)) {
|
if (!isempty(Location)) {
|
||||||
// Close the file stream
|
// Close the file stream
|
||||||
CloseFile();
|
CloseFile();
|
||||||
// Update stream address and port
|
// Update stream address and port
|
||||||
streamAddr = strcpyrealloc(streamAddr, Address);
|
fileLocation = strcpyrealloc(fileLocation, Location);
|
||||||
streamPort = Port;
|
fileDelay = Parameter;
|
||||||
// Open the file for input
|
// Open the file for input
|
||||||
OpenFile();
|
OpenFile();
|
||||||
}
|
}
|
||||||
@ -123,5 +124,5 @@ bool cIptvProtocolFile::Set(const char* Address, const int Port)
|
|||||||
cString cIptvProtocolFile::GetInformation(void)
|
cString cIptvProtocolFile::GetInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cIptvProtocolFile::GetInformation()");
|
//debug("cIptvProtocolFile::GetInformation()");
|
||||||
return cString::sprintf("file://%s:%d", streamAddr, streamPort);
|
return cString::sprintf("file://%s:%d", fileLocation, fileDelay);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: protocolfile.h,v 1.5 2007/10/07 22:54:09 rahrenbe Exp $
|
* $Id: protocolfile.h,v 1.6 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_PROTOCOLFILE_H
|
#ifndef __IPTV_PROTOCOLFILE_H
|
||||||
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
class cIptvProtocolFile : public cIptvProtocolIf {
|
class cIptvProtocolFile : public cIptvProtocolIf {
|
||||||
private:
|
private:
|
||||||
char* streamAddr;
|
char* fileLocation;
|
||||||
int streamPort;
|
int fileDelay;
|
||||||
FILE* fileStream;
|
FILE* fileStream;
|
||||||
unsigned char* readBuffer;
|
unsigned char* readBuffer;
|
||||||
unsigned int readBufferLen;
|
unsigned int readBufferLen;
|
||||||
@ -29,7 +29,7 @@ public:
|
|||||||
cIptvProtocolFile();
|
cIptvProtocolFile();
|
||||||
virtual ~cIptvProtocolFile();
|
virtual ~cIptvProtocolFile();
|
||||||
virtual int Read(unsigned char* *BufferAddr);
|
virtual int Read(unsigned char* *BufferAddr);
|
||||||
virtual bool Set(const char* Address, const int Port);
|
virtual bool Set(const char* Location, const int Parameter);
|
||||||
virtual bool Open(void);
|
virtual bool Open(void);
|
||||||
virtual bool Close(void);
|
virtual bool Close(void);
|
||||||
virtual cString GetInformation(void);
|
virtual cString GetInformation(void);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: protocolhttp.c,v 1.10 2007/10/07 22:54:09 rahrenbe Exp $
|
* $Id: protocolhttp.c,v 1.11 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -336,27 +336,27 @@ int cIptvProtocolHttp::Read(unsigned char* *BufferAddr)
|
|||||||
|
|
||||||
bool cIptvProtocolHttp::Open(void)
|
bool cIptvProtocolHttp::Open(void)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolHttp::Open(): streamAddr=%s\n", streamAddr);
|
debug("cIptvProtocolHttp::Open()\n");
|
||||||
// Connect the socket
|
// Connect the socket
|
||||||
return Connect();
|
return Connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolHttp::Close(void)
|
bool cIptvProtocolHttp::Close(void)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolHttp::Close(): streamAddr=%s\n", streamAddr);
|
debug("cIptvProtocolHttp::Close()\n");
|
||||||
// Disconnect the current stream
|
// Disconnect the current stream
|
||||||
Disconnect();
|
Disconnect();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolHttp::Set(const char* Address, const int Port)
|
bool cIptvProtocolHttp::Set(const char* Location, const int Parameter)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolHttp::Set(): %s:%d\n", Address, Port);
|
debug("cIptvProtocolHttp::Set(): Location=%s Parameter=%d\n", Location, Parameter);
|
||||||
if (!isempty(Address)) {
|
if (!isempty(Location)) {
|
||||||
// Disconnect the current socket
|
// Disconnect the current socket
|
||||||
Disconnect();
|
Disconnect();
|
||||||
// Update stream address, path and port
|
// Update stream address, path and port
|
||||||
streamAddr = strcpyrealloc(streamAddr, Address);
|
streamAddr = strcpyrealloc(streamAddr, Location);
|
||||||
char *path = strstr(streamAddr, "/");
|
char *path = strstr(streamAddr, "/");
|
||||||
if (path) {
|
if (path) {
|
||||||
streamPath = strcpyrealloc(streamPath, path);
|
streamPath = strcpyrealloc(streamPath, path);
|
||||||
@ -364,7 +364,7 @@ bool cIptvProtocolHttp::Set(const char* Address, const int Port)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
streamPath = strcpyrealloc(streamPath, "/");
|
streamPath = strcpyrealloc(streamPath, "/");
|
||||||
streamPort = Port;
|
streamPort = Parameter;
|
||||||
debug("http://%s:%d%s\n", streamAddr, streamPort, streamPath);
|
debug("http://%s:%d%s\n", streamAddr, streamPort, streamPath);
|
||||||
// Re-connect the socket
|
// Re-connect the socket
|
||||||
Connect();
|
Connect();
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: protocolhttp.h,v 1.7 2007/10/07 22:54:09 rahrenbe Exp $
|
* $Id: protocolhttp.h,v 1.8 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_PROTOCOLHTTP_H
|
#ifndef __IPTV_PROTOCOLHTTP_H
|
||||||
@ -36,7 +36,7 @@ public:
|
|||||||
cIptvProtocolHttp();
|
cIptvProtocolHttp();
|
||||||
virtual ~cIptvProtocolHttp();
|
virtual ~cIptvProtocolHttp();
|
||||||
virtual int Read(unsigned char* *BufferAddr);
|
virtual int Read(unsigned char* *BufferAddr);
|
||||||
virtual bool Set(const char* Address, const int Port);
|
virtual bool Set(const char* Location, const int Parameter);
|
||||||
virtual bool Open(void);
|
virtual bool Open(void);
|
||||||
virtual bool Close(void);
|
virtual bool Close(void);
|
||||||
virtual cString GetInformation(void);
|
virtual cString GetInformation(void);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: protocolif.h,v 1.5 2007/10/07 22:54:09 rahrenbe Exp $
|
* $Id: protocolif.h,v 1.6 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_PROTOCOLIF_H
|
#ifndef __IPTV_PROTOCOLIF_H
|
||||||
@ -14,7 +14,7 @@ public:
|
|||||||
cIptvProtocolIf() {}
|
cIptvProtocolIf() {}
|
||||||
virtual ~cIptvProtocolIf() {}
|
virtual ~cIptvProtocolIf() {}
|
||||||
virtual int Read(unsigned char* *BufferAddr) = 0;
|
virtual int Read(unsigned char* *BufferAddr) = 0;
|
||||||
virtual bool Set(const char* Address, const int Port) = 0;
|
virtual bool Set(const char* Location, const int Parameter) = 0;
|
||||||
virtual bool Open(void) = 0;
|
virtual bool Open(void) = 0;
|
||||||
virtual bool Close(void) = 0;
|
virtual bool Close(void) = 0;
|
||||||
virtual cString GetInformation(void) = 0;
|
virtual cString GetInformation(void) = 0;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: protocoludp.c,v 1.11 2007/10/07 22:54:09 rahrenbe Exp $
|
* $Id: protocoludp.c,v 1.12 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -216,7 +216,7 @@ int cIptvProtocolUdp::Read(unsigned char* *BufferAddr)
|
|||||||
|
|
||||||
bool cIptvProtocolUdp::Open(void)
|
bool cIptvProtocolUdp::Open(void)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolUdp::Open(): streamAddr=%s\n", streamAddr);
|
debug("cIptvProtocolUdp::Open()\n");
|
||||||
// Join a new multicast group
|
// Join a new multicast group
|
||||||
JoinMulticast();
|
JoinMulticast();
|
||||||
return true;
|
return true;
|
||||||
@ -224,7 +224,7 @@ bool cIptvProtocolUdp::Open(void)
|
|||||||
|
|
||||||
bool cIptvProtocolUdp::Close(void)
|
bool cIptvProtocolUdp::Close(void)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolUdp::Close(): streamAddr=%s\n", streamAddr);
|
debug("cIptvProtocolUdp::Close()\n");
|
||||||
// Drop the multicast group
|
// Drop the multicast group
|
||||||
DropMulticast();
|
DropMulticast();
|
||||||
// Close the socket
|
// Close the socket
|
||||||
@ -232,15 +232,15 @@ bool cIptvProtocolUdp::Close(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolUdp::Set(const char* Address, const int Port)
|
bool cIptvProtocolUdp::Set(const char* Location, const int Parameter)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolUdp::Set(): %s:%d\n", Address, Port);
|
debug("cIptvProtocolUdp::Set(): Location=%s Parameter=%d\n", Location, Parameter);
|
||||||
if (!isempty(Address)) {
|
if (!isempty(Location)) {
|
||||||
// Drop the multicast group
|
// Drop the multicast group
|
||||||
DropMulticast();
|
DropMulticast();
|
||||||
// Update stream address and port
|
// Update stream address and port
|
||||||
streamAddr = strcpyrealloc(streamAddr, Address);
|
streamAddr = strcpyrealloc(streamAddr, Location);
|
||||||
streamPort = Port;
|
streamPort = Parameter;
|
||||||
// Join a new multicast group
|
// Join a new multicast group
|
||||||
JoinMulticast();
|
JoinMulticast();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: protocoludp.h,v 1.8 2007/10/07 22:54:09 rahrenbe Exp $
|
* $Id: protocoludp.h,v 1.9 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_PROTOCOLUDP_H
|
#ifndef __IPTV_PROTOCOLUDP_H
|
||||||
@ -32,7 +32,7 @@ public:
|
|||||||
cIptvProtocolUdp();
|
cIptvProtocolUdp();
|
||||||
virtual ~cIptvProtocolUdp();
|
virtual ~cIptvProtocolUdp();
|
||||||
virtual int Read(unsigned char* *BufferAddr);
|
virtual int Read(unsigned char* *BufferAddr);
|
||||||
virtual bool Set(const char* Address, const int Port);
|
virtual bool Set(const char* Location, const int Parameter);
|
||||||
virtual bool Open(void);
|
virtual bool Open(void);
|
||||||
virtual bool Close(void);
|
virtual bool Close(void);
|
||||||
virtual cString GetInformation(void);
|
virtual cString GetInformation(void);
|
||||||
|
48
setup.c
48
setup.c
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: setup.c,v 1.37 2007/10/19 17:49:35 rahrenbe Exp $
|
* $Id: setup.c,v 1.38 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -34,14 +34,14 @@ private:
|
|||||||
eProtocolCount
|
eProtocolCount
|
||||||
};
|
};
|
||||||
struct tIptvChannel {
|
struct tIptvChannel {
|
||||||
int frequency, source, protocol, port, vpid, ppid, tpid, sid, nid, tid, rid;
|
int frequency, source, protocol, parameter, vpid, ppid, tpid, sid, nid, tid, rid;
|
||||||
int apid[MAXAPIDS + 1], dpid[MAXDPIDS + 1], spid[MAXSPIDS + 1], caids[MAXCAIDS + 1];
|
int apid[MAXAPIDS + 1], dpid[MAXDPIDS + 1], spid[MAXSPIDS + 1], caids[MAXCAIDS + 1];
|
||||||
char name[256], location[256];
|
char name[256], location[256];
|
||||||
} data;
|
} data;
|
||||||
cChannel *channel;
|
cChannel *channel;
|
||||||
const char *protocols[eProtocolCount];
|
const char *protocols[eProtocolCount];
|
||||||
void Setup(void);
|
void Setup(void);
|
||||||
cString GetIptvSettings(const char *Param, int *Port, int *Protocol);
|
cString GetIptvSettings(const char *Param, int *Parameter, int *Protocol);
|
||||||
void GetChannelData(cChannel *Channel);
|
void GetChannelData(cChannel *Channel);
|
||||||
void SetChannelData(cChannel *Channel);
|
void SetChannelData(cChannel *Channel);
|
||||||
|
|
||||||
@ -68,25 +68,25 @@ cIptvMenuEditChannel::cIptvMenuEditChannel(cChannel *Channel, bool New)
|
|||||||
Setup();
|
Setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cIptvMenuEditChannel::GetIptvSettings(const char *Param, int *Port, int *Protocol)
|
cString cIptvMenuEditChannel::GetIptvSettings(const char *Param, int *Parameter, int *Protocol)
|
||||||
{
|
{
|
||||||
char *loc = NULL;
|
char *loc = NULL;
|
||||||
if (sscanf(Param, "IPTV|UDP|%a[^|]|%u", &loc, Port) == 2) {
|
if (sscanf(Param, "IPTV|UDP|%a[^|]|%u", &loc, Parameter) == 2) {
|
||||||
cString addr(loc, true);
|
cString addr(loc, true);
|
||||||
*Protocol = eProtocolUDP;
|
*Protocol = eProtocolUDP;
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
else if (sscanf(Param, "IPTV|HTTP|%a[^|]|%u", &loc, Port) == 2) {
|
else if (sscanf(Param, "IPTV|HTTP|%a[^|]|%u", &loc, Parameter) == 2) {
|
||||||
cString addr(loc, true);
|
cString addr(loc, true);
|
||||||
*Protocol = eProtocolHTTP;
|
*Protocol = eProtocolHTTP;
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
else if (sscanf(Param, "IPTV|FILE|%a[^|]|%u", &loc, Port) == 2) {
|
else if (sscanf(Param, "IPTV|FILE|%a[^|]|%u", &loc, Parameter) == 2) {
|
||||||
cString addr(loc, true);
|
cString addr(loc, true);
|
||||||
*Protocol = eProtocolFILE;
|
*Protocol = eProtocolFILE;
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
else if (sscanf(Param, "IPTV|EXT|%a[^|]|%u", &loc, Port) == 2) {
|
else if (sscanf(Param, "IPTV|EXT|%a[^|]|%u", &loc, Parameter) == 2) {
|
||||||
cString addr(loc, true);
|
cString addr(loc, true);
|
||||||
*Protocol = eProtocolEXT;
|
*Protocol = eProtocolEXT;
|
||||||
return addr;
|
return addr;
|
||||||
@ -97,7 +97,7 @@ cString cIptvMenuEditChannel::GetIptvSettings(const char *Param, int *Port, int
|
|||||||
void cIptvMenuEditChannel::GetChannelData(cChannel *Channel)
|
void cIptvMenuEditChannel::GetChannelData(cChannel *Channel)
|
||||||
{
|
{
|
||||||
if (Channel) {
|
if (Channel) {
|
||||||
int port, protocol;
|
int parameter, protocol;
|
||||||
data.frequency = Channel->Frequency();
|
data.frequency = Channel->Frequency();
|
||||||
data.source = Channel->Source();
|
data.source = Channel->Source();
|
||||||
data.vpid = Channel->Vpid();
|
data.vpid = Channel->Vpid();
|
||||||
@ -116,9 +116,9 @@ void cIptvMenuEditChannel::GetChannelData(cChannel *Channel)
|
|||||||
data.tid = Channel->Tid();
|
data.tid = Channel->Tid();
|
||||||
data.rid = Channel->Rid();
|
data.rid = Channel->Rid();
|
||||||
strn0cpy(data.name, Channel->Name(), sizeof(data.name));
|
strn0cpy(data.name, Channel->Name(), sizeof(data.name));
|
||||||
strn0cpy(data.location, *GetIptvSettings(Channel->PluginParam(), &port, &protocol), sizeof(data.location));
|
strn0cpy(data.location, *GetIptvSettings(Channel->PluginParam(), ¶meter, &protocol), sizeof(data.location));
|
||||||
data.protocol = protocol;
|
data.protocol = protocol;
|
||||||
data.port = port;
|
data.parameter = parameter;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data.frequency = 1;
|
data.frequency = 1;
|
||||||
@ -141,7 +141,7 @@ void cIptvMenuEditChannel::GetChannelData(cChannel *Channel)
|
|||||||
strn0cpy(data.name, "IPTV", sizeof(data.name));
|
strn0cpy(data.name, "IPTV", sizeof(data.name));
|
||||||
strn0cpy(data.location, "127.0.0.1", sizeof(data.location));
|
strn0cpy(data.location, "127.0.0.1", sizeof(data.location));
|
||||||
data.protocol = eProtocolUDP;
|
data.protocol = eProtocolUDP;
|
||||||
data.port = 1234;
|
data.parameter = 1234;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,17 +154,17 @@ void cIptvMenuEditChannel::SetChannelData(cChannel *Channel)
|
|||||||
char slangs[MAXSPIDS][MAXLANGCODE2] = { "" };
|
char slangs[MAXSPIDS][MAXLANGCODE2] = { "" };
|
||||||
switch (data.protocol) {
|
switch (data.protocol) {
|
||||||
case eProtocolEXT:
|
case eProtocolEXT:
|
||||||
param = cString::sprintf("IPTV|EXT|%s|%d", data.location, data.port);
|
param = cString::sprintf("IPTV|EXT|%s|%d", data.location, data.parameter);
|
||||||
break;
|
break;
|
||||||
case eProtocolFILE:
|
case eProtocolFILE:
|
||||||
param = cString::sprintf("IPTV|FILE|%s|%d", data.location, data.port);
|
param = cString::sprintf("IPTV|FILE|%s|%d", data.location, data.parameter);
|
||||||
break;
|
break;
|
||||||
case eProtocolHTTP:
|
case eProtocolHTTP:
|
||||||
param = cString::sprintf("IPTV|HTTP|%s|%d", data.location, data.port);
|
param = cString::sprintf("IPTV|HTTP|%s|%d", data.location, data.parameter);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case eProtocolUDP:
|
case eProtocolUDP:
|
||||||
param = cString::sprintf("IPTV|UDP|%s|%d", data.location, data.port);
|
param = cString::sprintf("IPTV|UDP|%s|%d", data.location, data.parameter);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Channel->SetPids(data.vpid, data.ppid, data.apid, alangs, data.dpid, dlangs, data.spid, slangs, data.tpid);
|
Channel->SetPids(data.vpid, data.ppid, data.apid, alangs, data.dpid, dlangs, data.spid, slangs, data.tpid);
|
||||||
@ -185,17 +185,17 @@ void cIptvMenuEditChannel::Setup(void)
|
|||||||
switch (data.protocol) {
|
switch (data.protocol) {
|
||||||
case eProtocolFILE:
|
case eProtocolFILE:
|
||||||
Add(new cMenuEditStrItem(trVDR("File"), data.location, sizeof(data.location), trVDR(FileNameChars)));
|
Add(new cMenuEditStrItem(trVDR("File"), data.location, sizeof(data.location), trVDR(FileNameChars)));
|
||||||
Add(new cMenuEditIntItem(tr("Delay (ms)"), &data.port, 0, 0xFFFF));
|
Add(new cMenuEditIntItem(tr("Delay (ms)"), &data.parameter, 0, 0xFFFF));
|
||||||
break;
|
break;
|
||||||
case eProtocolEXT:
|
case eProtocolEXT:
|
||||||
Add(new cMenuEditStrItem(trVDR("File"), data.location, sizeof(data.location), trVDR(FileNameChars)));
|
Add(new cMenuEditStrItem(tr("Script"), data.location, sizeof(data.location), trVDR(FileNameChars)));
|
||||||
Add(new cMenuEditIntItem(tr("Port"), &data.port, 0, 0xFFFF));
|
Add(new cMenuEditIntItem(tr("Parameter"), &data.parameter, 0, 0xFFFF));
|
||||||
break;
|
break;
|
||||||
case eProtocolHTTP:
|
case eProtocolHTTP:
|
||||||
case eProtocolUDP:
|
case eProtocolUDP:
|
||||||
default:
|
default:
|
||||||
Add(new cMenuEditStrItem(tr("Address"), data.location, sizeof(data.location), trVDR(FileNameChars)));
|
Add(new cMenuEditStrItem(tr("Address"), data.location, sizeof(data.location), trVDR(FileNameChars)));
|
||||||
Add(new cMenuEditIntItem(tr("Port"), &data.port, 0, 0xFFFF));
|
Add(new cMenuEditIntItem(tr("Port"), &data.parameter, 0, 0xFFFF));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Normal settings
|
// Normal settings
|
||||||
@ -295,20 +295,20 @@ eOSState cIptvMenuEditChannel::ProcessKey(eKeys Key)
|
|||||||
switch (data.protocol) {
|
switch (data.protocol) {
|
||||||
case eProtocolEXT:
|
case eProtocolEXT:
|
||||||
strn0cpy(data.location, "/video/iptvstream.sh", sizeof(data.location));
|
strn0cpy(data.location, "/video/iptvstream.sh", sizeof(data.location));
|
||||||
data.port = 0;
|
data.parameter = 0;
|
||||||
break;
|
break;
|
||||||
case eProtocolFILE:
|
case eProtocolFILE:
|
||||||
strn0cpy(data.location, "/tmp/video.ts", sizeof(data.location));
|
strn0cpy(data.location, "/tmp/video.ts", sizeof(data.location));
|
||||||
data.port = 0;
|
data.parameter = 0;
|
||||||
break;
|
break;
|
||||||
case eProtocolHTTP:
|
case eProtocolHTTP:
|
||||||
strn0cpy(data.location, "127.0.0.1/TS/1", sizeof(data.location));
|
strn0cpy(data.location, "127.0.0.1/TS/1", sizeof(data.location));
|
||||||
data.port = 3000;
|
data.parameter = 3000;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case eProtocolUDP:
|
case eProtocolUDP:
|
||||||
strn0cpy(data.location, "127.0.0.1", sizeof(data.location));
|
strn0cpy(data.location, "127.0.0.1", sizeof(data.location));
|
||||||
data.port = 1234;
|
data.parameter = 1234;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Setup();
|
Setup();
|
||||||
|
12
streamer.c
12
streamer.c
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: streamer.c,v 1.23 2007/10/11 23:06:49 rahrenbe Exp $
|
* $Id: streamer.c,v 1.24 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <vdr/thread.h>
|
#include <vdr/thread.h>
|
||||||
@ -77,10 +77,10 @@ bool cIptvStreamer::Close(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvStreamer::Set(const char* Address, const int Port, cIptvProtocolIf* Protocol)
|
bool cIptvStreamer::Set(const char* Location, const int Parameter, cIptvProtocolIf* Protocol)
|
||||||
{
|
{
|
||||||
debug("cIptvStreamer::Set(): %s:%d\n", Address, Port);
|
debug("cIptvStreamer::Set(): %s:%d\n", Location, Parameter);
|
||||||
if (!isempty(Address)) {
|
if (!isempty(Location)) {
|
||||||
// Update protocol; Close the existing one if changed
|
// Update protocol; Close the existing one if changed
|
||||||
if (protocol != Protocol) {
|
if (protocol != Protocol) {
|
||||||
if (protocol)
|
if (protocol)
|
||||||
@ -89,9 +89,9 @@ bool cIptvStreamer::Set(const char* Address, const int Port, cIptvProtocolIf* Pr
|
|||||||
if (protocol)
|
if (protocol)
|
||||||
protocol->Open();
|
protocol->Open();
|
||||||
}
|
}
|
||||||
// Set protocol address and port
|
// Set protocol location and parameter
|
||||||
if (protocol)
|
if (protocol)
|
||||||
protocol->Set(Address, Port);
|
protocol->Set(Location, Parameter);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: streamer.h,v 1.11 2007/10/09 22:12:17 rahrenbe Exp $
|
* $Id: streamer.h,v 1.12 2007/10/19 21:36:28 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_STREAMER_H
|
#ifndef __IPTV_STREAMER_H
|
||||||
@ -29,7 +29,7 @@ public:
|
|||||||
cIptvStreamer(cRingBufferLinear* RingBuffer, cMutex* Mutex);
|
cIptvStreamer(cRingBufferLinear* RingBuffer, cMutex* Mutex);
|
||||||
virtual ~cIptvStreamer();
|
virtual ~cIptvStreamer();
|
||||||
virtual void Action(void);
|
virtual void Action(void);
|
||||||
bool Set(const char* Address, const int Port, cIptvProtocolIf* Protocol);
|
bool Set(const char* Location, const int Parameter, cIptvProtocolIf* Protocol);
|
||||||
bool Open(void);
|
bool Open(void);
|
||||||
bool Close(void);
|
bool Close(void);
|
||||||
cString GetInformation(void);
|
cString GetInformation(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user