mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 11:37:03 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc64c044a1 |
14
HISTORY
14
HISTORY
@@ -229,17 +229,3 @@ VDR Plugin 'iptv' Revision History
|
||||
2014-03-09: Version 2.0.3
|
||||
|
||||
- Fixed installation target bugs (Thanks to Alexander Grothe).
|
||||
|
||||
|
||||
==================================
|
||||
VDR Plugin 'iptv' Revision History
|
||||
==================================
|
||||
|
||||
2014-02-20: Version 2.1.0
|
||||
|
||||
- Added initial CAM support.
|
||||
- Added missing RTSP/UDP support.
|
||||
|
||||
2014-03-09: Version 2.1.1
|
||||
|
||||
- Fixed installation target bugs (Thanks to Alexander Grothe).
|
||||
|
||||
22
README
22
README
@@ -53,12 +53,10 @@ Setup menu:
|
||||
stream ringbuffer before data is
|
||||
transferred to VDR.
|
||||
Valid range: 0...40
|
||||
- Protocol base port = 4321 Defines base port used in CURL/EXT
|
||||
protocol. Two ports are defined for
|
||||
each device.
|
||||
- EXT protocol base port = 4321 Defines base port used in EXT protocol.
|
||||
The port range is defined by the number
|
||||
of IPTV devices times two (max. 32).
|
||||
Valid range: 0...65503
|
||||
of IPTV devices (max. 8).
|
||||
Valid range: 0...65527
|
||||
- Use section filtering = 1 Defines whether section filtering shall
|
||||
be used.
|
||||
Valid range: 0...1
|
||||
@@ -129,11 +127,11 @@ External streaming:
|
||||
script parameter is passed to the script and it can be used to select for
|
||||
example between different URLs.
|
||||
|
||||
- When an EXT or CURL/RTSP channel is opened the IPTV plugin opens an UDP
|
||||
listening port on the localhost. The external script is responsible for
|
||||
supplying IPTV plugin with MPEG2 TS data in UDP/RTP format to the listening
|
||||
port. The data will be processed in VDR like a normal DVB broadcast. The
|
||||
listening base port can be specified in the plugin configuration menu.
|
||||
- When an EXT channel is opened the IPTV plugin opens an UDP listening port
|
||||
on the localhost. The external script is responsible for supplying IPTV
|
||||
plugin with MPEG2 TS data in UDP/RTP format to the listening port. The
|
||||
data will be processed in VDR like a normal DVB broadcast. The listening
|
||||
base port can be specified in the plugin configuration menu.
|
||||
|
||||
- Each IPTV device has different listen port. The port number is specified
|
||||
as a base port number plus IPTV device index minus one. Maximum of 8 IPTV
|
||||
@@ -177,8 +175,8 @@ Notes:
|
||||
IGMP v3 protocol:
|
||||
"U=<source address>@<group address>"
|
||||
|
||||
- The CURL implementation supports only RTSP/HTTP/HTTPS protocols and an
|
||||
optional netrc configuration file for authentication:
|
||||
- The CURL implementation supports only HTTP/HTTPS protocols and an optional
|
||||
netrc configuration file for authentication:
|
||||
$(CONFDIR)/iptv/netrc
|
||||
|
||||
- You can quite easily figure out correct DVB triplet values by using the
|
||||
|
||||
2
config.c
2
config.c
@@ -12,7 +12,7 @@ cIptvConfig IptvConfig;
|
||||
cIptvConfig::cIptvConfig(void)
|
||||
: tsBufferSizeM(2),
|
||||
tsBufferPrefillRatioM(0),
|
||||
protocolBasePortM(4321),
|
||||
extProtocolBasePortM(4321),
|
||||
useBytesM(1),
|
||||
sectionFilteringM(1)
|
||||
{
|
||||
|
||||
6
config.h
6
config.h
@@ -16,7 +16,7 @@ class cIptvConfig
|
||||
private:
|
||||
unsigned int tsBufferSizeM;
|
||||
unsigned int tsBufferPrefillRatioM;
|
||||
unsigned int protocolBasePortM;
|
||||
unsigned int extProtocolBasePortM;
|
||||
unsigned int useBytesM;
|
||||
unsigned int sectionFilteringM;
|
||||
int disabledFiltersM[SECTION_FILTER_TABLE_SIZE];
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
cIptvConfig();
|
||||
unsigned int GetTsBufferSize(void) const { return tsBufferSizeM; }
|
||||
unsigned int GetTsBufferPrefillRatio(void) const { return tsBufferPrefillRatioM; }
|
||||
unsigned int GetProtocolBasePort(void) const { return protocolBasePortM; }
|
||||
unsigned int GetExtProtocolBasePort(void) const { return extProtocolBasePortM; }
|
||||
unsigned int GetUseBytes(void) const { return useBytesM; }
|
||||
unsigned int GetSectionFiltering(void) const { return sectionFilteringM; }
|
||||
const char *GetConfigDirectory(void) const { return configDirectoryM; }
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
int GetDisabledFilters(unsigned int indexP) const;
|
||||
void SetTsBufferSize(unsigned int sizeP) { tsBufferSizeM = sizeP; }
|
||||
void SetTsBufferPrefillRatio(unsigned int ratioP) { tsBufferPrefillRatioM = ratioP; }
|
||||
void SetProtocolBasePort(unsigned int portNumberP) { protocolBasePortM = portNumberP; }
|
||||
void SetExtProtocolBasePort(unsigned int portNumberP) { extProtocolBasePortM = portNumberP; }
|
||||
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
|
||||
void SetSectionFiltering(unsigned int onOffP) { sectionFilteringM = onOffP; }
|
||||
void SetDisabledFilters(unsigned int indexP, int numberP);
|
||||
|
||||
79
device.c
79
device.c
@@ -293,7 +293,7 @@ bool cIptvDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
|
||||
}
|
||||
sidScanEnabledM = itp.SidScan() ? true : false;
|
||||
pidScanEnabledM = itp.PidScan() ? true : false;
|
||||
if (pIptvStreamerM && pIptvStreamerM->SetSource(itp.Address(), itp.Parameter(), deviceIndexM, protocol)) {
|
||||
if (pIptvStreamerM->Set(itp.Address(), itp.Parameter(), deviceIndexM, protocol)) {
|
||||
channelM = *channelP;
|
||||
if (sidScanEnabledM && pSidScannerM && IptvConfig.GetSectionFiltering())
|
||||
pSidScannerM->SetChannel(channelM.GetChannelID());
|
||||
@@ -306,30 +306,22 @@ bool cIptvDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
|
||||
bool cIptvDevice::SetPid(cPidHandle *handleP, int typeP, bool onP)
|
||||
{
|
||||
debug("cIptvDevice::%s(%d): pid=%d type=%d on=%d", __FUNCTION__, deviceIndexM, handleP->pid, typeP, onP);
|
||||
if (pIptvStreamerM && handleP)
|
||||
return pIptvStreamerM->SetPid(handleP->pid, typeP, onP);
|
||||
return true;
|
||||
}
|
||||
|
||||
int cIptvDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP)
|
||||
{
|
||||
//debug("cIptvDevice::%s(%d): pid=%d tid=%d mask=%d", __FUNCTION__, deviceIndexM, pidP, tidP, maskP);
|
||||
if (pIptvSectionM && IptvConfig.GetSectionFiltering()) {
|
||||
if (pIptvStreamerM)
|
||||
pIptvStreamerM->SetPid(pidP, ptOther, true);
|
||||
if (pIptvSectionM && IptvConfig.GetSectionFiltering())
|
||||
return pIptvSectionM->Open(pidP, tidP, maskP);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void cIptvDevice::CloseFilter(int handleP)
|
||||
{
|
||||
//debug("cIptvDevice::%s(%d): handle=%d", __FUNCTION__, deviceIndexM, handleP);
|
||||
if (pIptvSectionM) {
|
||||
if (pIptvStreamerM)
|
||||
pIptvStreamerM->SetPid(pIptvSectionM->GetPid(handleP), ptOther, false);
|
||||
if (pIptvSectionM)
|
||||
pIptvSectionM->Close(handleP);
|
||||
}
|
||||
}
|
||||
|
||||
bool cIptvDevice::OpenDvr(void)
|
||||
@@ -369,7 +361,7 @@ bool cIptvDevice::HasLock(int timeoutMsP) const
|
||||
bool cIptvDevice::HasInternalCam(void)
|
||||
{
|
||||
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void cIptvDevice::ResetBuffering(void)
|
||||
@@ -417,66 +409,39 @@ unsigned int cIptvDevice::CheckData(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uchar *cIptvDevice::GetData(int *availableP)
|
||||
bool cIptvDevice::GetTSPacket(uchar *&Data)
|
||||
{
|
||||
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||
if (isOpenDvrM && tsBufferM && !IsBuffering()) {
|
||||
int count = 0;
|
||||
if (isPacketDeliveredM)
|
||||
SkipData(TS_SIZE);
|
||||
uchar *p = tsBufferM->Get(count);
|
||||
if (p && count >= TS_SIZE) {
|
||||
if (isPacketDeliveredM) {
|
||||
tsBufferM->Del(TS_SIZE);
|
||||
isPacketDeliveredM = false;
|
||||
// Update buffer statistics
|
||||
AddBufferStatistic(TS_SIZE, tsBufferM->Available());
|
||||
}
|
||||
int Count = 0;
|
||||
uchar *p = tsBufferM->Get(Count);
|
||||
if (p && Count >= TS_SIZE) {
|
||||
if (*p != TS_SYNC_BYTE) {
|
||||
for (int i = 1; i < count; i++) {
|
||||
for (int i = 1; i < Count; i++) {
|
||||
if (p[i] == TS_SYNC_BYTE) {
|
||||
count = i;
|
||||
Count = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
tsBufferM->Del(count);
|
||||
error("Skipped %d bytes to sync on TS packet", count);
|
||||
return NULL;
|
||||
tsBufferM->Del(Count);
|
||||
error("Skipped %d bytes to sync on TS packet", Count);
|
||||
return false;
|
||||
}
|
||||
isPacketDeliveredM = true;
|
||||
if (availableP)
|
||||
*availableP = count;
|
||||
Data = p;
|
||||
// Update pid statistics
|
||||
AddPidStatistic(ts_pid(p), payload(p));
|
||||
return p;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void cIptvDevice::SkipData(int countP)
|
||||
{
|
||||
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||
tsBufferM->Del(countP);
|
||||
isPacketDeliveredM = false;
|
||||
// Update buffer statistics
|
||||
AddBufferStatistic(countP, tsBufferM->Available());
|
||||
}
|
||||
|
||||
bool cIptvDevice::GetTSPacket(uchar *&dataP)
|
||||
{
|
||||
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||
if (tsBufferM) {
|
||||
if (cCamSlot *cs = CamSlot()) {
|
||||
if (cs->WantsTsData()) {
|
||||
int available;
|
||||
dataP = GetData(&available);
|
||||
if (dataP) {
|
||||
dataP = cs->Decrypt(dataP, available);
|
||||
SkipData(available);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
dataP = GetData();
|
||||
return true;
|
||||
}
|
||||
// Reduce cpu load by preventing busylooping
|
||||
cCondWait::SleepMs(10);
|
||||
dataP = NULL;
|
||||
Data = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
4
device.h
4
device.h
@@ -96,10 +96,6 @@ protected:
|
||||
virtual bool SetChannelDevice(const cChannel *channelP, bool liveViewP);
|
||||
|
||||
// for recording
|
||||
private:
|
||||
uchar *GetData(int *availableP = NULL);
|
||||
void SkipData(int countP);
|
||||
|
||||
protected:
|
||||
virtual bool SetPid(cPidHandle *handleP, int typeP, bool onP);
|
||||
virtual bool OpenDvr(void);
|
||||
|
||||
17
iptv.c
17
iptv.c
@@ -13,15 +13,15 @@
|
||||
#include "device.h"
|
||||
#include "iptvservice.h"
|
||||
|
||||
#if defined(APIVERSNUM) && APIVERSNUM < 20104
|
||||
#error "VDR-2.1.4 API version or greater is required!"
|
||||
#if defined(APIVERSNUM) && APIVERSNUM < 20000
|
||||
#error "VDR-2.0.0 API version or greater is required!"
|
||||
#endif
|
||||
|
||||
#ifndef GITVERSION
|
||||
#define GITVERSION ""
|
||||
#endif
|
||||
|
||||
const char VERSION[] = "2.1.1" GITVERSION;
|
||||
const char VERSION[] = "2.0.3" GITVERSION;
|
||||
static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
|
||||
|
||||
class cPluginIptv : public cPlugin {
|
||||
@@ -110,14 +110,7 @@ bool cPluginIptv::Start(void)
|
||||
// Start any background activities the plugin shall perform.
|
||||
if (curl_global_init(CURL_GLOBAL_ALL) == CURLE_OK) {
|
||||
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
|
||||
cString info = cString::sprintf("Using CURL %s", data->version);
|
||||
for (int i = 0; data->protocols[i]; ++i) {
|
||||
// Supported protocols: HTTP(S), RTSP, FILE
|
||||
if (startswith(data->protocols[i], "http") || startswith(data->protocols[i], "rtsp") ||
|
||||
startswith(data->protocols[i], "file"))
|
||||
info = cString::sprintf("%s %s", *info, data->protocols[i]);
|
||||
}
|
||||
info("%s", *info);
|
||||
info("Using CURL %s", data->version);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -197,7 +190,7 @@ bool cPluginIptv::SetupParse(const char *nameP, const char *valueP)
|
||||
else if (!strcasecmp(nameP, "TsBufferPrefill"))
|
||||
IptvConfig.SetTsBufferPrefillRatio(atoi(valueP));
|
||||
else if (!strcasecmp(nameP, "ExtProtocolBasePort"))
|
||||
IptvConfig.SetProtocolBasePort(atoi(valueP));
|
||||
IptvConfig.SetExtProtocolBasePort(atoi(valueP));
|
||||
else if (!strcasecmp(nameP, "SectionFiltering"))
|
||||
IptvConfig.SetSectionFiltering(atoi(valueP));
|
||||
else if (!strcasecmp(nameP, "DisabledFilters")) {
|
||||
|
||||
10
po/de_DE.po
10
po/de_DE.po
@@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-iptv 2.1.1\n"
|
||||
"Project-Id-Version: vdr-iptv 2.0.3\n"
|
||||
"Report-Msgid-Bugs-To: <see README>\n"
|
||||
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
|
||||
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
|
||||
@@ -77,13 +77,13 @@ msgid ""
|
||||
"This is useful if streaming media over a slow or unreliable connection."
|
||||
msgstr ""
|
||||
|
||||
msgid "Protocol base port"
|
||||
msgstr "Protokoll Basisport"
|
||||
msgid "EXT protocol base port"
|
||||
msgstr "EXT Protokoll Basisport"
|
||||
|
||||
msgid ""
|
||||
"Define a base port used by CURL/EXT protocol.\n"
|
||||
"Define a base port used by EXT protocol.\n"
|
||||
"\n"
|
||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the CURL/EXT protocol."
|
||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
|
||||
msgstr ""
|
||||
|
||||
msgid "Use section filtering"
|
||||
|
||||
14
po/fi_FI.po
14
po/fi_FI.po
@@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-iptv 2.1.1\n"
|
||||
"Project-Id-Version: vdr-iptv 2.0.3\n"
|
||||
"Report-Msgid-Bugs-To: <see README>\n"
|
||||
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
|
||||
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
|
||||
@@ -82,17 +82,17 @@ msgstr ""
|
||||
"\n"
|
||||
"Puskurin esitäyttö parantaa suoratoistoa hitailla ja epäluotettavilla yhteyksillä."
|
||||
|
||||
msgid "Protocol base port"
|
||||
msgstr "Protokollan perusportti"
|
||||
msgid "EXT protocol base port"
|
||||
msgstr "EXT-protokollan perusportti"
|
||||
|
||||
msgid ""
|
||||
"Define a base port used by CURL/EXT protocol.\n"
|
||||
"Define a base port used by EXT protocol.\n"
|
||||
"\n"
|
||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the CURL/EXT protocol."
|
||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
|
||||
msgstr ""
|
||||
"Määrittele protokollan käyttämä perusportti.\n"
|
||||
"Määrittele EXT-protokollan käyttämä perusportti.\n"
|
||||
"\n"
|
||||
"Porttiavaruuden koko määräytyy käytettyjen IPTV-laitteiden mukaan. Laajennos lukee CURL/EXT-protokollan yhteydessä perusportista dataa, jota ulkoiset ohjelmistot tarjoavat."
|
||||
"Porttiavaruuden koko määräytyy käytettyjen IPTV-laitteiden mukaan. Laajennos lukee EXT-protokollan yhteydessä perusportista dataa, jota ulkoiset ohjelmistot tarjoavat."
|
||||
|
||||
msgid "Use section filtering"
|
||||
msgstr "Käytä sektioiden suodatusta"
|
||||
|
||||
14
po/fr_FR.po
14
po/fr_FR.po
@@ -6,7 +6,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-iptv 2.1.1\n"
|
||||
"Project-Id-Version: vdr-iptv 2.0.3\n"
|
||||
"Report-Msgid-Bugs-To: <see README>\n"
|
||||
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
|
||||
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
|
||||
@@ -84,17 +84,17 @@ msgstr ""
|
||||
"\n"
|
||||
"Cette option est utile si le streaming est sur une connexion lente ou peu fiables."
|
||||
|
||||
msgid "Protocol base port"
|
||||
msgstr "Port de base du protocole"
|
||||
msgid "EXT protocol base port"
|
||||
msgstr "Port de base du protocole EXT"
|
||||
|
||||
msgid ""
|
||||
"Define a base port used by CURL/EXT protocol.\n"
|
||||
"Define a base port used by EXT protocol.\n"
|
||||
"\n"
|
||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the CURL/EXT protocol."
|
||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
|
||||
msgstr ""
|
||||
"Définit le port de base utilisé par le protocole CURL/EXT.\n"
|
||||
"Définit le port de base utilisé par le protocole EXT.\n"
|
||||
"\n"
|
||||
"La plage de port est défini par le nombre de dispositif IPTV. Ce paramètre défini le port qui est écouté pour les connexions à partir d'applications externes en utilisant le protocole CURL/EXT."
|
||||
"La plage de port est défini par le nombre de dispositif IPTV. Ce paramètre défini le port qui est écouté pour les connexions à partir d'applications externes en utilisant le protocole EXT."
|
||||
|
||||
msgid "Use section filtering"
|
||||
msgstr "Utiliser le filtrage de section"
|
||||
|
||||
14
po/it_IT.po
14
po/it_IT.po
@@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-iptv 2.1.1\n"
|
||||
"Project-Id-Version: vdr-iptv 2.0.3\n"
|
||||
"Report-Msgid-Bugs-To: <see README>\n"
|
||||
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
|
||||
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
|
||||
@@ -83,17 +83,17 @@ msgstr ""
|
||||
"\n"
|
||||
"Questo è utile se si trasmette dati su una connessione lenta oppure inaffidabile."
|
||||
|
||||
msgid "Protocol base port"
|
||||
msgstr "Porta base protocollo"
|
||||
msgid "EXT protocol base port"
|
||||
msgstr "Porta base protocollo EXT"
|
||||
|
||||
msgid ""
|
||||
"Define a base port used by CURL/EXT protocol.\n"
|
||||
"Define a base port used by EXT protocol.\n"
|
||||
"\n"
|
||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the CURL/EXT protocol."
|
||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
|
||||
msgstr ""
|
||||
"Definisci una porta base usata dal protocollo CURL/EXT.\n"
|
||||
"Definisci una porta base usata dal protocollo EXT.\n"
|
||||
"\n"
|
||||
"Il range della porta è definito dal numero di periferiche IPTV. Questo parametro imposta la porta che è in ascolto per connessioni da applicazioni esterne quando si usa il protocollo CURL/EXT."
|
||||
"Il range della porta è definito dal numero di periferiche IPTV. Questo parametro imposta la porta che è in ascolto per connessioni da applicazioni esterne quando si usa il protocollo EXT."
|
||||
|
||||
msgid "Use section filtering"
|
||||
msgstr "Utilizza sezione filtri"
|
||||
|
||||
14
po/nl_NL.po
14
po/nl_NL.po
@@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-iptv 2.1.1\n"
|
||||
"Project-Id-Version: vdr-iptv 2.0.3\n"
|
||||
"Report-Msgid-Bugs-To: <see README>\n"
|
||||
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
|
||||
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
|
||||
@@ -83,17 +83,17 @@ msgstr ""
|
||||
"\n"
|
||||
"Dit is aan te bevelen bij onbetrouwbare of langzame verbindingen."
|
||||
|
||||
msgid "Protocol base port"
|
||||
msgstr "Protocol basispoort"
|
||||
msgid "EXT protocol base port"
|
||||
msgstr "EXT protocol basispoort"
|
||||
|
||||
msgid ""
|
||||
"Define a base port used by CURL/EXT protocol.\n"
|
||||
"Define a base port used by EXT protocol.\n"
|
||||
"\n"
|
||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the CURL/EXT protocol."
|
||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
|
||||
msgstr ""
|
||||
"Bepaal de basispoort voor het CURL/EXT protocol.\n"
|
||||
"Bepaal de basispoort voor het EXT protocol.\n"
|
||||
"\n"
|
||||
"De poortrange wordt bepaald door het aantal IPTV apparaten. Deze poort luistert naar inkomende verbindingen wanneer het CURL/EXT protocol wordt gebruikt."
|
||||
"De poortrange wordt bepaald door het aantal IPTV apparaten. Deze poort luistert naar inkomende verbindingen wanneer het EXT protocol wordt gebruikt."
|
||||
|
||||
msgid "Use section filtering"
|
||||
msgstr "Benutze Abschnittsfilterung"
|
||||
|
||||
10
po/ru_RU.po
10
po/ru_RU.po
@@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-iptv 2.1.1\n"
|
||||
"Project-Id-Version: vdr-iptv 2.0.3\n"
|
||||
"Report-Msgid-Bugs-To: <see README>\n"
|
||||
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
|
||||
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
|
||||
@@ -78,13 +78,13 @@ msgid ""
|
||||
"This is useful if streaming media over a slow or unreliable connection."
|
||||
msgstr ""
|
||||
|
||||
msgid "Protocol base port"
|
||||
msgstr "Базисный порт протокола"
|
||||
msgid "EXT protocol base port"
|
||||
msgstr "Базисный порт EXT протокола"
|
||||
|
||||
msgid ""
|
||||
"Define a base port used by CURL/EXT protocol.\n"
|
||||
"Define a base port used by EXT protocol.\n"
|
||||
"\n"
|
||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the CURL/EXT protocol."
|
||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
|
||||
msgstr ""
|
||||
|
||||
msgid "Use section filtering"
|
||||
|
||||
182
protocolcurl.c
182
protocolcurl.c
@@ -26,16 +26,14 @@
|
||||
cIptvProtocolCurl::cIptvProtocolCurl()
|
||||
: streamUrlM(""),
|
||||
streamParamM(0),
|
||||
streamPortM(0),
|
||||
mutexM(),
|
||||
handleM(NULL),
|
||||
multiM(NULL),
|
||||
headerListM(NULL),
|
||||
ringBufferM(new cRingBufferLinear(MEGABYTE(IptvConfig.GetTsBufferSize()),
|
||||
7 * TS_SIZE, false, "IPTV CURL")),
|
||||
rtspControlM(""),
|
||||
rtspControlM(),
|
||||
modeM(eModeUnknown),
|
||||
timeoutM(),
|
||||
connectedM(false),
|
||||
pausedM(false)
|
||||
{
|
||||
@@ -116,24 +114,17 @@ size_t cIptvProtocolCurl::DescribeCallback(void *ptrP, size_t sizeP, size_t nmem
|
||||
size_t len = sizeP * nmembP;
|
||||
//debug("cIptvProtocolCurl::%s(%zu)", __FUNCTION__, len);
|
||||
|
||||
bool found = false;
|
||||
cString control = "";
|
||||
char *p = (char *)ptrP;
|
||||
char *r = strtok(p, "\r\n");
|
||||
|
||||
while (r) {
|
||||
//debug("cIptvProtocolCurl::%s(%zu): %s", __FUNCTION__, len, r);
|
||||
// Look for a media name: "video"
|
||||
if (strstr(r, "m=video")) {
|
||||
found = true;
|
||||
}
|
||||
// ... and find out its' attribute
|
||||
if (found && strstr(r, "a=control")) {
|
||||
if (strstr(r, "a=control")) {
|
||||
char *s = NULL;
|
||||
if (sscanf(r, "a=control:%255ms", &s) == 1)
|
||||
if (sscanf(r, "a=control:%64ms", &s) == 1)
|
||||
control = compactspace(s);
|
||||
free(s);
|
||||
break;
|
||||
}
|
||||
r = strtok(NULL, "\r\n");
|
||||
}
|
||||
@@ -164,14 +155,8 @@ size_t cIptvProtocolCurl::HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP
|
||||
void cIptvProtocolCurl::SetRtspControl(const char *controlP)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
//debug("cIptvProtocolCurl::%s(%s)", __FUNCTION__, controlP);
|
||||
cString protocol = ChangeCase(controlP, false).Truncate(7);
|
||||
if (startswith(*protocol, "rtsp://")) {
|
||||
streamUrlM = controlP;
|
||||
rtspControlM = "";
|
||||
}
|
||||
else
|
||||
rtspControlM = controlP;
|
||||
debug("cIptvProtocolCurl::%s(%s)", __FUNCTION__, controlP);
|
||||
rtspControlM = controlP;
|
||||
}
|
||||
|
||||
bool cIptvProtocolCurl::PutData(unsigned char *dataP, int lenP)
|
||||
@@ -253,8 +238,10 @@ bool cIptvProtocolCurl::Connect()
|
||||
// Initialize the curl session
|
||||
if (!handleM)
|
||||
handleM = curl_easy_init();
|
||||
if (!multiM)
|
||||
multiM = curl_multi_init();
|
||||
|
||||
if (handleM && !isempty(*streamUrlM)) {
|
||||
if (handleM && multiM && !isempty(*streamUrlM)) {
|
||||
CURLcode res = CURLE_OK;
|
||||
cString netrc = cString::sprintf("%s/netrc", IptvConfig.GetConfigDirectory());
|
||||
|
||||
@@ -297,10 +284,6 @@ bool cIptvProtocolCurl::Connect()
|
||||
{
|
||||
cString uri, control, transport, range;
|
||||
|
||||
// Create the listening socket for UDP mode
|
||||
if (!streamParamM)
|
||||
OpenSocket(streamPortM);
|
||||
|
||||
// Request server options
|
||||
uri = cString::sprintf("%s", *streamUrlM);
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||
@@ -318,14 +301,8 @@ bool cIptvProtocolCurl::Connect()
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_WRITEDATA, NULL);
|
||||
|
||||
// Setup media stream
|
||||
if (isempty(*rtspControlM))
|
||||
uri = cString::sprintf("%s", *streamUrlM);
|
||||
else
|
||||
uri = cString::sprintf("%s/%s", *streamUrlM, *rtspControlM);
|
||||
if (streamParamM)
|
||||
transport = "RTP/AVP/TCP;unicast;interleaved=0-1";
|
||||
else
|
||||
transport = cString::sprintf("RTP/AVP;unicast;client_port=%d-%d", streamPortM, streamPortM + 1);
|
||||
uri = cString::sprintf("%s/%s", *streamUrlM, *rtspControlM);
|
||||
transport = "RTP/AVP/TCP;unicast;interleaved=0-1";
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_TRANSPORT, *transport);
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_SETUP);
|
||||
@@ -335,20 +312,15 @@ bool cIptvProtocolCurl::Connect()
|
||||
uri = cString::sprintf("%s/", *streamUrlM);
|
||||
range = "0.000-";
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||
//iptv_curl_easy_setopt(handleM, CURLOPT_RANGE, *range);
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RANGE, *range);
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_PLAY);
|
||||
iptv_curl_easy_perform(handleM);
|
||||
|
||||
// Start receiving
|
||||
if (streamParamM) {
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_INTERLEAVEFUNCTION, cIptvProtocolCurl::WriteRtspCallback);
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_INTERLEAVEDATA, this);
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_RECEIVE);
|
||||
iptv_curl_easy_perform(handleM);
|
||||
}
|
||||
|
||||
// Don't add handle into multi set
|
||||
isActiveM = true;
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_INTERLEAVEFUNCTION, cIptvProtocolCurl::WriteRtspCallback);
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_INTERLEAVEDATA, this);
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_RECEIVE);
|
||||
iptv_curl_easy_perform(handleM);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -370,26 +342,12 @@ bool cIptvProtocolCurl::Connect()
|
||||
headerListM = curl_slist_append(headerListM, "Pragma: no-cache");
|
||||
headerListM = curl_slist_append(headerListM, "Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_HTTPHEADER, headerListM);
|
||||
|
||||
// Initialize multi set and add handle into it
|
||||
if (!multiM)
|
||||
multiM = curl_multi_init();
|
||||
if (multiM)
|
||||
curl_multi_add_handle(multiM, handleM);
|
||||
}
|
||||
break;
|
||||
|
||||
case eModeFile:
|
||||
{
|
||||
// Set timeout
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_TIMEOUT_MS, 10L);
|
||||
|
||||
// Initialize multi set and add handle into it
|
||||
if (!multiM)
|
||||
multiM = curl_multi_init();
|
||||
if (multiM)
|
||||
curl_multi_add_handle(multiM, handleM);
|
||||
}
|
||||
break;
|
||||
|
||||
case eModeUnknown:
|
||||
@@ -397,7 +355,9 @@ bool cIptvProtocolCurl::Connect()
|
||||
break;
|
||||
}
|
||||
|
||||
timeoutM.Set(eKeepAliveIntervalMs);
|
||||
// Add handle into multi set
|
||||
curl_multi_add_handle(multiM, handleM);
|
||||
|
||||
connectedM = true;
|
||||
return true;
|
||||
}
|
||||
@@ -413,14 +373,7 @@ bool cIptvProtocolCurl::Disconnect()
|
||||
return true;
|
||||
|
||||
// Terminate curl session
|
||||
if (handleM) {
|
||||
// Remove handle from multi set
|
||||
if (multiM) {
|
||||
curl_multi_remove_handle(multiM, handleM);
|
||||
curl_multi_cleanup(multiM);
|
||||
multiM = NULL;
|
||||
}
|
||||
|
||||
if (handleM && multiM) {
|
||||
// Mode specific tricks
|
||||
switch (modeM) {
|
||||
#ifdef USE_RTSP
|
||||
@@ -433,9 +386,6 @@ bool cIptvProtocolCurl::Disconnect()
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_TEARDOWN);
|
||||
iptv_curl_easy_perform(handleM);
|
||||
rtspControlM = "";
|
||||
isActiveM = false;
|
||||
// Close the listening socket
|
||||
CloseSocket();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -452,8 +402,11 @@ bool cIptvProtocolCurl::Disconnect()
|
||||
curl_slist_free_all(headerListM);
|
||||
headerListM = NULL;
|
||||
}
|
||||
curl_multi_remove_handle(multiM, handleM);
|
||||
curl_easy_cleanup(handleM);
|
||||
handleM = NULL;
|
||||
curl_multi_cleanup(multiM);
|
||||
multiM = NULL;
|
||||
}
|
||||
|
||||
ClearData();
|
||||
@@ -480,70 +433,55 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
|
||||
int len = 0;
|
||||
if (ringBufferM) {
|
||||
// Fill up the buffer
|
||||
if (handleM) {
|
||||
if (handleM && multiM) {
|
||||
switch (modeM) {
|
||||
#ifdef USE_RTSP
|
||||
case eModeRtsp:
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
// Remember the heart beat
|
||||
if (timeoutM.TimedOut()) {
|
||||
debug("cIptvProtocolCurl::%s(): KeepAlive", __FUNCTION__);
|
||||
cString uri = cString::sprintf("%s", *streamUrlM);
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_OPTIONS);
|
||||
iptv_curl_easy_perform(handleM);
|
||||
timeoutM.Set(eKeepAliveIntervalMs);
|
||||
}
|
||||
|
||||
// Check whether UDP or TCP mode used
|
||||
if (streamParamM) {
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_RECEIVE);
|
||||
iptv_curl_easy_perform(handleM);
|
||||
}
|
||||
else
|
||||
return cIptvUdpSocket::Read(bufferAddrP, bufferLenP);
|
||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_RECEIVE);
|
||||
iptv_curl_easy_perform(handleM);
|
||||
// @todo - How to detect eof?
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case eModeFile:
|
||||
case eModeHttp:
|
||||
case eModeHttps:
|
||||
if (multiM) {
|
||||
CURLMcode res;
|
||||
int running_handles;
|
||||
{
|
||||
CURLMcode res;
|
||||
int running_handles;
|
||||
|
||||
do {
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
res = curl_multi_perform(multiM, &running_handles);
|
||||
} while (res == CURLM_CALL_MULTI_PERFORM);
|
||||
do {
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
res = curl_multi_perform(multiM, &running_handles);
|
||||
} while (res == CURLM_CALL_MULTI_PERFORM);
|
||||
|
||||
// Use 20% threshold before continuing to filling up the buffer.
|
||||
// Use 20% threshold before continuing to filling up the buffer.
|
||||
mutexM.Lock();
|
||||
if (pausedM && (ringBufferM->Available() < (MEGABYTE(IptvConfig.GetTsBufferSize()) / 5))) {
|
||||
debug("cIptvProtocolCurl::%s(continue): free=%d available=%d", __FUNCTION__,
|
||||
ringBufferM->Free(), ringBufferM->Available());
|
||||
pausedM = false;
|
||||
curl_easy_pause(handleM, CURLPAUSE_CONT);
|
||||
}
|
||||
mutexM.Unlock();
|
||||
|
||||
// Check if end of file
|
||||
if (running_handles == 0) {
|
||||
int msgcount;
|
||||
mutexM.Lock();
|
||||
if (pausedM && (ringBufferM->Available() < (MEGABYTE(IptvConfig.GetTsBufferSize()) / 5))) {
|
||||
debug("cIptvProtocolCurl::%s(continue): free=%d available=%d", __FUNCTION__,
|
||||
ringBufferM->Free(), ringBufferM->Available());
|
||||
pausedM = false;
|
||||
curl_easy_pause(handleM, CURLPAUSE_CONT);
|
||||
}
|
||||
CURLMsg *msg = curl_multi_info_read(multiM, &msgcount);
|
||||
mutexM.Unlock();
|
||||
|
||||
// Check if end of file
|
||||
if (running_handles == 0) {
|
||||
int msgcount;
|
||||
mutexM.Lock();
|
||||
CURLMsg *msg = curl_multi_info_read(multiM, &msgcount);
|
||||
mutexM.Unlock();
|
||||
if (msg && (msg->msg == CURLMSG_DONE)) {
|
||||
debug("cIptvProtocolCurl::%s(done): %s (%d)", __FUNCTION__,
|
||||
curl_easy_strerror(msg->data.result), msg->data.result);
|
||||
Disconnect();
|
||||
Connect();
|
||||
}
|
||||
if (msg && (msg->msg == CURLMSG_DONE)) {
|
||||
debug("cIptvProtocolCurl::%s(done): %s (%d)", __FUNCTION__,
|
||||
curl_easy_strerror(msg->data.result), msg->data.result);
|
||||
Disconnect();
|
||||
Connect();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case eModeUnknown:
|
||||
@@ -565,7 +503,7 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
|
||||
return len;
|
||||
}
|
||||
|
||||
bool cIptvProtocolCurl::SetSource(const char* locationP, const int parameterP, const int indexP)
|
||||
bool cIptvProtocolCurl::Set(const char* locationP, const int parameterP, const int indexP)
|
||||
{
|
||||
debug("cIptvProtocolCurl::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
||||
if (!isempty(locationP)) {
|
||||
@@ -585,22 +523,14 @@ bool cIptvProtocolCurl::SetSource(const char* locationP, const int parameterP, c
|
||||
else
|
||||
modeM = eModeUnknown;
|
||||
debug("cIptvProtocolCurl::%s(): %s (%d)", __FUNCTION__, *protocol, modeM);
|
||||
// Update stream parameter - force UDP mode for RTSP
|
||||
streamParamM = (modeM == eModeRtsp) ? 0 : parameterP;
|
||||
// Update listen port
|
||||
streamPortM = IptvConfig.GetProtocolBasePort() + indexP * 2;
|
||||
// Update stream parameter
|
||||
streamParamM = parameterP;
|
||||
// Reconnect
|
||||
Connect();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvProtocolCurl::SetPid(int pidP, int typeP, bool onP)
|
||||
{
|
||||
//debug("cIptvProtocolCurl::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||
return true;
|
||||
}
|
||||
|
||||
cString cIptvProtocolCurl::GetInformation(void)
|
||||
{
|
||||
//debug("cIptvProtocolCurl::%s()", __FUNCTION__);
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
#include <vdr/tools.h>
|
||||
|
||||
#include "protocolif.h"
|
||||
#include "socket.h"
|
||||
|
||||
class cIptvProtocolCurl : public cIptvUdpSocket, public cIptvProtocolIf {
|
||||
class cIptvProtocolCurl : public cIptvProtocolIf {
|
||||
private:
|
||||
enum eModeType {
|
||||
eModeUnknown = 0,
|
||||
@@ -29,9 +28,8 @@ private:
|
||||
eModeCount
|
||||
};
|
||||
enum {
|
||||
eConnectTimeoutS = 5, // in seconds
|
||||
eMaxDownloadSpeedMBits = 20, // in megabits per second
|
||||
eKeepAliveIntervalMs = 300000 // in milliseconds
|
||||
eConnectTimeoutS = 5, // in seconds
|
||||
eMaxDownloadSpeedMBits = 20 // in megabits per second
|
||||
};
|
||||
|
||||
static size_t WriteCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);
|
||||
@@ -41,7 +39,6 @@ private:
|
||||
|
||||
cString streamUrlM;
|
||||
int streamParamM;
|
||||
int streamPortM;
|
||||
cMutex mutexM;
|
||||
CURL *handleM;
|
||||
CURLM *multiM;
|
||||
@@ -49,7 +46,6 @@ private:
|
||||
cRingBufferLinear *ringBufferM;
|
||||
cString rtspControlM;
|
||||
eModeType modeM;
|
||||
cTimeMs timeoutM;
|
||||
bool connectedM;
|
||||
bool pausedM;
|
||||
|
||||
@@ -64,8 +60,7 @@ public:
|
||||
cIptvProtocolCurl();
|
||||
virtual ~cIptvProtocolCurl();
|
||||
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
||||
bool SetSource(const char* locationP, const int parameterP, const int indexP);
|
||||
bool SetPid(int pidP, int typeP, bool onP);
|
||||
bool Set(const char* locationP, const int parameterP, const int indexP);
|
||||
bool Open(void);
|
||||
bool Close(void);
|
||||
cString GetInformation(void);
|
||||
|
||||
@@ -152,7 +152,7 @@ int cIptvProtocolExt::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
|
||||
return cIptvUdpSocket::Read(bufferAddrP, bufferLenP);
|
||||
}
|
||||
|
||||
bool cIptvProtocolExt::SetSource(const char* locationP, const int parameterP, const int indexP)
|
||||
bool cIptvProtocolExt::Set(const char* locationP, const int parameterP, const int indexP)
|
||||
{
|
||||
debug("cIptvProtocolExt::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
||||
if (!isempty(locationP)) {
|
||||
@@ -165,17 +165,11 @@ bool cIptvProtocolExt::SetSource(const char* locationP, const int parameterP, co
|
||||
}
|
||||
scriptParameterM = parameterP;
|
||||
// Update listen port
|
||||
streamPortM = IptvConfig.GetProtocolBasePort() + indexP * 2;
|
||||
streamPortM = IptvConfig.GetExtProtocolBasePort() + indexP;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvProtocolExt::SetPid(int pidP, int typeP, bool onP)
|
||||
{
|
||||
//debug("cIptvProtocolExt::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||
return true;
|
||||
}
|
||||
|
||||
cString cIptvProtocolExt::GetInformation(void)
|
||||
{
|
||||
//debug("cIptvProtocolExt::%s()", __FUNCTION__);
|
||||
|
||||
@@ -27,8 +27,7 @@ public:
|
||||
cIptvProtocolExt();
|
||||
virtual ~cIptvProtocolExt();
|
||||
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
||||
bool SetSource(const char* locationP, const int parameterP, const int indexP);
|
||||
bool SetPid(int pidP, int typeP, bool onP);
|
||||
bool Set(const char* locationP, const int parameterP, const int indexP);
|
||||
bool Open(void);
|
||||
bool Close(void);
|
||||
cString GetInformation(void);
|
||||
|
||||
@@ -95,7 +95,7 @@ bool cIptvProtocolFile::Close(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvProtocolFile::SetSource(const char* locationP, const int parameterP, const int indexP)
|
||||
bool cIptvProtocolFile::Set(const char* locationP, const int parameterP, const int indexP)
|
||||
{
|
||||
debug("cIptvProtocolFile::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
||||
if (!isempty(locationP)) {
|
||||
@@ -110,12 +110,6 @@ bool cIptvProtocolFile::SetSource(const char* locationP, const int parameterP, c
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvProtocolFile::SetPid(int pidP, int typeP, bool onP)
|
||||
{
|
||||
//debug("cIptvProtocolFile::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||
return true;
|
||||
}
|
||||
|
||||
cString cIptvProtocolFile::GetInformation(void)
|
||||
{
|
||||
//debug("cIptvProtocolFile::%s()", __FUNCTION__);
|
||||
|
||||
@@ -26,8 +26,7 @@ public:
|
||||
cIptvProtocolFile();
|
||||
virtual ~cIptvProtocolFile();
|
||||
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
||||
bool SetSource(const char* locationP, const int parameterP, const int indexP);
|
||||
bool SetPid(int pidP, int typeP, bool onP);
|
||||
bool Set(const char* locationP, const int parameterP, const int indexP);
|
||||
bool Open(void);
|
||||
bool Close(void);
|
||||
cString GetInformation(void);
|
||||
|
||||
@@ -177,7 +177,7 @@ int cIptvProtocolHttp::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
|
||||
return cIptvTcpSocket::Read(bufferAddrP, bufferLenP);
|
||||
}
|
||||
|
||||
bool cIptvProtocolHttp::SetSource(const char* locationP, const int parameterP, const int indexP)
|
||||
bool cIptvProtocolHttp::Set(const char* locationP, const int parameterP, const int indexP)
|
||||
{
|
||||
debug("cIptvProtocolHttp::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
||||
if (!isempty(locationP)) {
|
||||
@@ -199,12 +199,6 @@ bool cIptvProtocolHttp::SetSource(const char* locationP, const int parameterP, c
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvProtocolHttp::SetPid(int pidP, int typeP, bool onP)
|
||||
{
|
||||
//debug("cIptvProtocolHttp::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||
return true;
|
||||
}
|
||||
|
||||
cString cIptvProtocolHttp::GetInformation(void)
|
||||
{
|
||||
//debug("cIptvProtocolHttp::%s()", __FUNCTION__);
|
||||
|
||||
@@ -28,8 +28,7 @@ public:
|
||||
cIptvProtocolHttp();
|
||||
virtual ~cIptvProtocolHttp();
|
||||
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
||||
bool SetSource(const char* locationP, const int parameterP, const int indexP);
|
||||
bool SetPid(int pidP, int typeP, bool onP);
|
||||
bool Set(const char* locationP, const int parameterP, const int indexP);
|
||||
bool Open(void);
|
||||
bool Close(void);
|
||||
cString GetInformation(void);
|
||||
|
||||
@@ -13,8 +13,7 @@ public:
|
||||
cIptvProtocolIf() {}
|
||||
virtual ~cIptvProtocolIf() {}
|
||||
virtual int Read(unsigned char* bufferAddrP, unsigned int bufferLenP) = 0;
|
||||
virtual bool SetSource(const char* locationP, const int parameterP, const int indexP) = 0;
|
||||
virtual bool SetPid(int pidP, int typeP, bool onP) = 0;
|
||||
virtual bool Set(const char* locationP, const int parameterP, const int indexP) = 0;
|
||||
virtual bool Open(void) = 0;
|
||||
virtual bool Close(void) = 0;
|
||||
virtual cString GetInformation(void) = 0;
|
||||
|
||||
@@ -70,7 +70,7 @@ int cIptvProtocolUdp::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
|
||||
return cIptvUdpSocket::Read(bufferAddrP, bufferLenP);
|
||||
}
|
||||
|
||||
bool cIptvProtocolUdp::SetSource(const char* locationP, const int parameterP, const int indexP)
|
||||
bool cIptvProtocolUdp::Set(const char* locationP, const int parameterP, const int indexP)
|
||||
{
|
||||
debug("cIptvProtocolUdp::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
||||
if (!isempty(locationP)) {
|
||||
@@ -103,12 +103,6 @@ bool cIptvProtocolUdp::SetSource(const char* locationP, const int parameterP, co
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvProtocolUdp::SetPid(int pidP, int typeP, bool onP)
|
||||
{
|
||||
//debug("cIptvProtocolUdp::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||
return true;
|
||||
}
|
||||
|
||||
cString cIptvProtocolUdp::GetInformation(void)
|
||||
{
|
||||
//debug("cIptvProtocolUdp::%s()", __FUNCTION__);
|
||||
|
||||
@@ -23,8 +23,7 @@ public:
|
||||
cIptvProtocolUdp();
|
||||
virtual ~cIptvProtocolUdp();
|
||||
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
||||
bool SetSource(const char* locationP, const int parameterP, const int indexP);
|
||||
bool SetPid(int pidP, int typeP, bool onP);
|
||||
bool Set(const char* locationP, const int parameterP, const int indexP);
|
||||
bool Open(void);
|
||||
bool Close(void);
|
||||
cString GetInformation(void);
|
||||
|
||||
@@ -380,20 +380,6 @@ void cIptvSectionFilterHandler::Close(int handleP)
|
||||
}
|
||||
}
|
||||
|
||||
int cIptvSectionFilterHandler::GetPid(int handleP)
|
||||
{
|
||||
// Lock
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
// Search the filter for data
|
||||
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
||||
if (filtersM[i] && (handleP == filtersM[i]->GetFd())) {
|
||||
debug("cIptvSectionFilterHandler::%s(%d): pid=%d handle=%d index=%d", __FUNCTION__, deviceIndexM, filtersM[i]->GetPid(), filtersM[i]->GetFd(), i);
|
||||
return filtersM[i]->GetPid();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void cIptvSectionFilterHandler::Write(uchar *bufferP, int lengthP)
|
||||
{
|
||||
//debug("cIptvSectionFilterHandler::%s(%d): length=%d", __FUNCTION__, deviceIndexM, lengthP);
|
||||
|
||||
@@ -84,7 +84,6 @@ public:
|
||||
cString GetInformation(void);
|
||||
int Open(u_short pidP, u_char tidP, u_char maskP);
|
||||
void Close(int handleP);
|
||||
int GetPid(int handleP);
|
||||
void Write(u_char *bufferP, int lengthP);
|
||||
};
|
||||
|
||||
|
||||
16
setup.c
16
setup.c
@@ -115,7 +115,7 @@ cIptvPluginSetup::cIptvPluginSetup()
|
||||
debug("cIptvPluginSetup::%s()", __FUNCTION__);
|
||||
tsBufferSizeM = IptvConfig.GetTsBufferSize();
|
||||
tsBufferPrefillM = IptvConfig.GetTsBufferPrefillRatio();
|
||||
protocolBasePortM = IptvConfig.GetProtocolBasePort();
|
||||
extProtocolBasePortM = IptvConfig.GetExtProtocolBasePort();
|
||||
sectionFilteringM = IptvConfig.GetSectionFiltering();
|
||||
numDisabledFiltersM = IptvConfig.GetDisabledFiltersCount();
|
||||
if (numDisabledFiltersM > SECTION_FILTER_TABLE_SIZE)
|
||||
@@ -136,20 +136,20 @@ void cIptvPluginSetup::Setup(void)
|
||||
Clear();
|
||||
helpM.Clear();
|
||||
|
||||
Add(new cMenuEditIntItem(tr("TS buffer size [MB]"), &tsBufferSizeM, 1, 4));
|
||||
Add(new cMenuEditIntItem( tr("TS buffer size [MB]"), &tsBufferSizeM, 1, 4));
|
||||
helpM.Append(tr("Define a ringbuffer size for transport streams in megabytes.\n\nSmaller sizes help memory consumption, but are more prone to buffer overflows."));
|
||||
|
||||
Add(new cMenuEditIntItem(tr("TS buffer prefill ratio [%]"), &tsBufferPrefillM, 0, 40));
|
||||
Add(new cMenuEditIntItem( tr("TS buffer prefill ratio [%]"), &tsBufferPrefillM, 0, 40));
|
||||
helpM.Append(tr("Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n\nThis is useful if streaming media over a slow or unreliable connection."));
|
||||
|
||||
Add(new cMenuEditIntItem(tr("Protocol base port"), &protocolBasePortM, 0, 0xFFFF - MAXDEVICES * 2));
|
||||
helpM.Append(tr("Define a base port used by CURL/EXT protocol.\n\nThe port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the CURL/EXT protocol."));
|
||||
Add(new cMenuEditIntItem( tr("EXT protocol base port"), &extProtocolBasePortM, 0, 0xFFF7));
|
||||
helpM.Append(tr("Define a base port used by EXT protocol.\n\nThe port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."));
|
||||
|
||||
Add(new cMenuEditBoolItem(tr("Use section filtering"), §ionFilteringM));
|
||||
helpM.Append(tr("Define whether the section filtering shall be used.\n\nSection filtering means that IPTV plugin tries to parse and provide VDR with secondary data about the currently active stream. VDR can then use this data for providing various functionalities such as automatic pid change detection and EPG etc.\nEnabling this feature does not affect streams that do not contain section data."));
|
||||
|
||||
if (sectionFilteringM) {
|
||||
Add(new cMenuEditIntItem(tr("Disable filters"), &numDisabledFiltersM, 0, SECTION_FILTER_TABLE_SIZE));
|
||||
Add(new cMenuEditIntItem( tr("Disable filters"), &numDisabledFiltersM, 0, SECTION_FILTER_TABLE_SIZE));
|
||||
helpM.Append(tr("Define number of section filters to be disabled.\n\nCertain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process."));
|
||||
|
||||
for (int i = 0; i < numDisabledFiltersM; ++i) {
|
||||
@@ -219,13 +219,13 @@ void cIptvPluginSetup::Store(void)
|
||||
// Store values into setup.conf
|
||||
SetupStore("TsBufferSize", tsBufferSizeM);
|
||||
SetupStore("TsBufferPrefill", tsBufferPrefillM);
|
||||
SetupStore("ExtProtocolBasePort", protocolBasePortM);
|
||||
SetupStore("ExtProtocolBasePort", extProtocolBasePortM);
|
||||
SetupStore("SectionFiltering", sectionFilteringM);
|
||||
StoreFilters("DisabledFilters", disabledFilterIndexesM);
|
||||
// Update global config
|
||||
IptvConfig.SetTsBufferSize(tsBufferSizeM);
|
||||
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefillM);
|
||||
IptvConfig.SetProtocolBasePort(protocolBasePortM);
|
||||
IptvConfig.SetExtProtocolBasePort(extProtocolBasePortM);
|
||||
IptvConfig.SetSectionFiltering(sectionFilteringM);
|
||||
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i)
|
||||
IptvConfig.SetDisabledFilters(i, disabledFilterIndexesM[i]);
|
||||
|
||||
2
setup.h
2
setup.h
@@ -17,7 +17,7 @@ class cIptvPluginSetup : public cMenuSetupPage
|
||||
private:
|
||||
int tsBufferSizeM;
|
||||
int tsBufferPrefillM;
|
||||
int protocolBasePortM;
|
||||
int extProtocolBasePortM;
|
||||
int sectionFilteringM;
|
||||
int numDisabledFiltersM;
|
||||
int disabledFilterIndexesM[SECTION_FILTER_TABLE_SIZE];
|
||||
|
||||
2
socket.c
2
socket.c
@@ -36,7 +36,7 @@ cIptvSocket::~cIptvSocket()
|
||||
|
||||
bool cIptvSocket::OpenSocket(const int portP, const bool isUdpP)
|
||||
{
|
||||
debug("cIptvSocket::%s(%d, %d)", __FUNCTION__, portP, isUdpP);
|
||||
debug("cIptvSocket::%s()", __FUNCTION__);
|
||||
// If socket is there already and it is bound to a different port, it must
|
||||
// be closed first
|
||||
if (portP != socketPortM) {
|
||||
|
||||
30
statistics.c
30
statistics.c
@@ -58,11 +58,7 @@ cIptvPidStatistics::cIptvPidStatistics()
|
||||
mutexM()
|
||||
{
|
||||
debug("cIptvPidStatistics::%s()", __FUNCTION__);
|
||||
const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct);
|
||||
for (int i = 0; i < numberOfElements; ++i) {
|
||||
mostActivePidsM[i].pid = -1;
|
||||
mostActivePidsM[i].dataAmount = 0L;
|
||||
}
|
||||
memset(mostActivePidsM, 0, sizeof(mostActivePidsM));
|
||||
}
|
||||
|
||||
cIptvPidStatistics::~cIptvPidStatistics()
|
||||
@@ -74,13 +70,12 @@ cString cIptvPidStatistics::GetPidStatistic()
|
||||
{
|
||||
//debug("cIptvPidStatistics::%s()", __FUNCTION__);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct);
|
||||
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
|
||||
timerM.Set();
|
||||
cString s("Active pids:\n");
|
||||
for (int i = 0; i < numberOfElements; ++i) {
|
||||
if (mostActivePidsM[i].pid >= 0) {
|
||||
long bitrate = elapsed ? (long)(1000.0L * mostActivePidsM[i].dataAmount / KILOBYTE(1) / elapsed) : 0L;
|
||||
for (unsigned int i = 0; i < IPTV_STATS_ACTIVE_PIDS_COUNT; ++i) {
|
||||
if (mostActivePidsM[i].pid) {
|
||||
long bitrate = elapsed ? (long)(1000.0L * mostActivePidsM[i].DataAmount / KILOBYTE(1) / elapsed) : 0L;
|
||||
if (!IptvConfig.GetUseBytes())
|
||||
bitrate *= 8;
|
||||
s = cString::sprintf("%sPid %d: %4d (%4ld k%s/s)\n", *s, i,
|
||||
@@ -88,10 +83,7 @@ cString cIptvPidStatistics::GetPidStatistic()
|
||||
IptvConfig.GetUseBytes() ? "B" : "bit");
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < numberOfElements; ++i) {
|
||||
mostActivePidsM[i].pid = -1;
|
||||
mostActivePidsM[i].dataAmount = 0L;
|
||||
}
|
||||
memset(mostActivePidsM, 0, sizeof(mostActivePidsM));
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -100,14 +92,14 @@ int cIptvPidStatistics::SortPids(const void* data1P, const void* data2P)
|
||||
//debug("cIptvPidStatistics::%s()", __FUNCTION__);
|
||||
const pidStruct *comp1 = reinterpret_cast<const pidStruct*>(data1P);
|
||||
const pidStruct *comp2 = reinterpret_cast<const pidStruct*>(data2P);
|
||||
if (comp1->dataAmount > comp2->dataAmount)
|
||||
if (comp1->DataAmount > comp2->DataAmount)
|
||||
return -1;
|
||||
if (comp1->dataAmount < comp2->dataAmount)
|
||||
if (comp1->DataAmount < comp2->DataAmount)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cIptvPidStatistics::AddPidStatistic(int pidP, long payloadP)
|
||||
void cIptvPidStatistics::AddPidStatistic(u_short pidP, long payloadP)
|
||||
{
|
||||
//debug("cIptvPidStatistics::%s(%ld, %ld)", __FUNCTION__, pidP, payloadP);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
@@ -115,7 +107,7 @@ void cIptvPidStatistics::AddPidStatistic(int pidP, long payloadP)
|
||||
// If our statistic already is in the array, update it and quit
|
||||
for (int i = 0; i < numberOfElements; ++i) {
|
||||
if (mostActivePidsM[i].pid == pidP) {
|
||||
mostActivePidsM[i].dataAmount += payloadP;
|
||||
mostActivePidsM[i].DataAmount += payloadP;
|
||||
// Now re-sort the array and quit
|
||||
qsort(mostActivePidsM, numberOfElements, sizeof(pidStruct), SortPids);
|
||||
return;
|
||||
@@ -123,9 +115,9 @@ void cIptvPidStatistics::AddPidStatistic(int pidP, long payloadP)
|
||||
}
|
||||
// Apparently our pid isn't in the array. Replace the last element with this
|
||||
// one if new payload is greater
|
||||
if (mostActivePidsM[numberOfElements - 1].dataAmount < payloadP) {
|
||||
if (mostActivePidsM[numberOfElements - 1].DataAmount < payloadP) {
|
||||
mostActivePidsM[numberOfElements - 1].pid = pidP;
|
||||
mostActivePidsM[numberOfElements - 1].dataAmount = payloadP;
|
||||
mostActivePidsM[numberOfElements - 1].DataAmount = payloadP;
|
||||
// Re-sort
|
||||
qsort(mostActivePidsM, numberOfElements, sizeof(pidStruct), SortPids);
|
||||
}
|
||||
|
||||
@@ -35,12 +35,12 @@ public:
|
||||
cString GetPidStatistic();
|
||||
|
||||
protected:
|
||||
void AddPidStatistic(int pidP, long payloadP);
|
||||
void AddPidStatistic(u_short pidP, long payloadP);
|
||||
|
||||
private:
|
||||
struct pidStruct {
|
||||
int pid;
|
||||
long dataAmount;
|
||||
u_short pid;
|
||||
long DataAmount;
|
||||
};
|
||||
pidStruct mostActivePidsM[IPTV_STATS_ACTIVE_PIDS_COUNT];
|
||||
cTimeMs timerM;
|
||||
|
||||
14
streamer.c
14
streamer.c
@@ -79,7 +79,7 @@ bool cIptvStreamer::Close(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvStreamer::SetSource(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP)
|
||||
bool cIptvStreamer::Set(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP)
|
||||
{
|
||||
debug("cIptvStreamer::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
||||
if (!isempty(locationP)) {
|
||||
@@ -89,24 +89,16 @@ bool cIptvStreamer::SetSource(const char* locationP, const int parameterP, const
|
||||
protocolM->Close();
|
||||
protocolM = protocolP;
|
||||
if (protocolM) {
|
||||
protocolM->SetSource(locationP, parameterP, indexP);
|
||||
protocolM->Set(locationP, parameterP, indexP);
|
||||
protocolM->Open();
|
||||
}
|
||||
}
|
||||
else if (protocolM)
|
||||
protocolM->SetSource(locationP, parameterP, indexP);
|
||||
protocolM->Set(locationP, parameterP, indexP);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cIptvStreamer::SetPid(int pidP, int typeP, bool onP)
|
||||
{
|
||||
debug("cIptvStreamer::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||
if (protocolM)
|
||||
return protocolM->SetPid(pidP, typeP, onP);
|
||||
return true;
|
||||
}
|
||||
|
||||
cString cIptvStreamer::GetInformation(void)
|
||||
{
|
||||
//debug("cIptvStreamer::%s()", __FUNCTION__);
|
||||
|
||||
@@ -30,8 +30,7 @@ protected:
|
||||
public:
|
||||
cIptvStreamer(cIptvDeviceIf &deviceP, unsigned int packetLenP);
|
||||
virtual ~cIptvStreamer();
|
||||
bool SetSource(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP);
|
||||
bool SetPid(int pidP, int typeP, bool onP);
|
||||
bool Set(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP);
|
||||
bool Open(void);
|
||||
bool Close(void);
|
||||
cString GetInformation(void);
|
||||
|
||||
Reference in New Issue
Block a user