1
0
mirror of https://github.com/rofafor/vdr-plugin-iptv.git synced 2023-10-10 11:37:03 +00:00

Compare commits

...

15 Commits

Author SHA1 Message Date
Rolf Ahrenberg
dc64c044a1 Fixed installation target bugs (Thanks to Alexander Grothe). 2014-03-09 16:08:44 +02:00
Rolf Ahrenberg
3dcbff0a71 Updated translation files and version number. 2014-01-19 00:20:08 +02:00
Rolf Ahrenberg
5aefd40d65 Updated translation files and HISTORY. 2014-01-14 18:42:06 +02:00
Rolf Ahrenberg
6b0337d078 Added initial support for cDevice::MaySwitchTransponder(). 2014-01-14 18:40:54 +02:00
Rolf Ahrenberg
9e6d784aec Shutdown devices already in cPluginManager::Stop(). 2014-01-14 18:30:14 +02:00
Rolf Ahrenberg
3f3ba2ad1a Fixed a typo. 2014-01-11 00:35:12 +02:00
Rolf Ahrenberg
a4b9570ae6 Updated copyright headers. 2014-01-11 00:24:31 +02:00
Rolf Ahrenberg
767b1bdac7 Added support for cDevice::GetCurrentlyTunedTransponder(). 2014-01-10 23:59:26 +02:00
Rolf Ahrenberg
6f648401a4 Updated translation files and HISTORY. 2014-01-10 23:22:15 +02:00
Rolf Ahrenberg
b0995c9a9e Added support for cDevice::IsTunedToTransponder(). 2014-01-07 22:24:39 +02:00
Rolf Ahrenberg
412af81271 Fixed a mem leak and re-ordered pointer deletions. 2014-01-07 17:55:13 +02:00
Rolf Ahrenberg
43326bb4ea Whitespace cleanup. 2014-01-07 17:55:08 +02:00
Rolf Ahrenberg
555c08bd4d Updated Makefile. 2014-01-06 22:01:55 +02:00
Rolf Ahrenberg
5ad3103626 Fixed scan-build issues. 2014-01-02 21:47:43 +02:00
Rolf Ahrenberg
a4f0bdf737 Added missing CURL timeouts and improved section id scanner. 2014-01-02 21:35:38 +02:00
23 changed files with 163 additions and 66 deletions

17
HISTORY
View File

@@ -212,3 +212,20 @@ VDR Plugin 'iptv' Revision History
- Fixed a nasty network byte order bug.
- Fixed and refactored the section filtering code.
- Fixed a possible crash in the file protocol.
2014-01-10: Version 2.0.1
- Added missing CURL timeouts.
- Improved section id scanner.
- Added support for cDevice::IsTunedToTransponder() and
cDevice::GetCurrentlyTunedTransponder().
- Fixed a memory leak and some issues reported by scan-build.
2014-01-18: Version 2.0.2
- Made devices to shutdown already in cPluginManager::Stop()
to prevent possible crashes while VDR shutdown.
2014-03-09: Version 2.0.3
- Fixed installation target bugs (Thanks to Alexander Grothe).

View File

@@ -28,10 +28,11 @@ GITTAG = $(shell git describe --always 2>/dev/null)
### The directory environment:
# Use package data if installed...otherwise assume we're under the VDR source directory:
PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell pkg-config --variable=$(1) vdr || pkg-config --variable=$(1) ../../../vdr.pc))
PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../.." pkg-config --variable=$(1) vdr))
LIBDIR = $(call PKGCFG,libdir)
LOCDIR = $(call PKGCFG,locdir)
PLGCFG = $(call PKGCFG,plgcfg)
RESDIR = $(call PKGCFG,resdir)
CFGDIR = $(call PKGCFG,configdir)
#
TMPDIR ?= /tmp
@@ -147,7 +148,8 @@ install-lib: $(SOFILE)
install-conf:
@mkdir -p $(DESTDIR)$(CFGDIR)/plugins/$(PLUGIN)
@cp -pn $(PLUGIN)/* $(DESTDIR)$(CFGDIR)/plugins/$(PLUGIN)/
@mkdir -p $(DESTDIR)$(RESDIR)/plugins/$(PLUGIN)
@cp -pn $(PLUGIN)/* $(DESTDIR)$(RESDIR)/plugins/$(PLUGIN)/
install: install-lib install-i18n install-conf

10
README
View File

@@ -165,8 +165,7 @@ Notes:
"disable_ca_updates" patch to the VDR in order to get rid of "Channel not
available" messages.
- EIT scanning functionality can be disabled for all IPTV channels by applying
the "disable_eitscan" patch to the VDR.
- EIT scanning functionality is disabled by default.
- Section id and pid scanners should be disabled after the correct data is
found. This can be made via VDR's channel editor.
@@ -180,7 +179,12 @@ Notes:
netrc configuration file for authentication:
$(CONFDIR)/iptv/netrc
- CURL implementation
- You can quite easily figure out correct DVB triplet values by using the
multicat and dvbsnoop tools:
$ multicat -u -d 1620000000 @127.0.0.1:1234 /tmp/video.ts
$ dvbsnoop -s ts -if /tmp/video.ts -tssubdecode -hexdumpbuffer 0x12 | \
grep -m1 -A8 Service_ID | grep _ID
Acknowledgements:
- The IPTV section filtering code is derived from Linux kernel.

View File

@@ -44,7 +44,8 @@
do { \
if (exp) { \
char tmp[64]; \
error(errstr": %s", strerror_r(errno, tmp, sizeof(tmp))); \
error("[%s,%d]: "errstr": %s", __FILE__, __LINE__, \
strerror_r(errno, tmp, sizeof(tmp))); \
func; \
ret; \
} \

View File

@@ -19,6 +19,7 @@ cIptvConfig::cIptvConfig(void)
for (unsigned int i = 0; i < ARRAY_SIZE(disabledFiltersM); ++i)
disabledFiltersM[i] = -1;
memset(configDirectoryM, 0, sizeof(configDirectoryM));
memset(resourceDirectoryM, 0, sizeof(resourceDirectoryM));
}
unsigned int cIptvConfig::GetDisabledFiltersCount(void) const
@@ -45,3 +46,9 @@ void cIptvConfig::SetConfigDirectory(const char *directoryP)
debug("cIptvConfig::%s(%s)", __FUNCTION__, directoryP);
ERROR_IF(!realpath(directoryP, configDirectoryM), "Cannot canonicalize configuration directory");
}
void cIptvConfig::SetResourceDirectory(const char *directoryP)
{
debug("cIptvConfig::%s(%s)", __FUNCTION__, directoryP);
ERROR_IF(!realpath(directoryP, resourceDirectoryM), "Cannot canonicalize resource directory");
}

View File

@@ -21,6 +21,7 @@ private:
unsigned int sectionFilteringM;
int disabledFiltersM[SECTION_FILTER_TABLE_SIZE];
char configDirectoryM[PATH_MAX];
char resourceDirectoryM[PATH_MAX];
public:
cIptvConfig();
@@ -30,6 +31,7 @@ public:
unsigned int GetUseBytes(void) const { return useBytesM; }
unsigned int GetSectionFiltering(void) const { return sectionFilteringM; }
const char *GetConfigDirectory(void) const { return configDirectoryM; }
const char *GetResourceDirectory(void) const { return resourceDirectoryM; }
unsigned int GetDisabledFiltersCount(void) const;
int GetDisabledFilters(unsigned int indexP) const;
void SetTsBufferSize(unsigned int sizeP) { tsBufferSizeM = sizeP; }
@@ -39,6 +41,7 @@ public:
void SetSectionFiltering(unsigned int onOffP) { sectionFilteringM = onOffP; }
void SetDisabledFilters(unsigned int indexP, int numberP);
void SetConfigDirectory(const char *directoryP);
void SetResourceDirectory(const char *directoryP);
};
extern cIptvConfig IptvConfig;

View File

@@ -20,7 +20,7 @@ cIptvDevice::cIptvDevice(unsigned int indexP)
isOpenDvrM(false),
sidScanEnabledM(false),
pidScanEnabledM(false),
channelIdM(tChannelID::InvalidID)
channelM()
{
unsigned int bufsize = (unsigned int)MEGABYTE(IptvConfig.GetTsBufferSize());
bufsize -= (bufsize % TS_SIZE);
@@ -58,18 +58,18 @@ cIptvDevice::cIptvDevice(unsigned int indexP)
cIptvDevice::~cIptvDevice()
{
debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
DELETE_POINTER(pIptvStreamerM);
DELETE_POINTER(pUdpProtocolM);
DELETE_POINTER(pCurlProtocolM);
DELETE_POINTER(pHttpProtocolM);
DELETE_POINTER(pFileProtocolM);
DELETE_POINTER(pExtProtocolM);
DELETE_POINTER(tsBufferM);
DELETE_POINTER(pPidScannerM);
DELETE_POINTER(pSidScannerM);
// Stop section handler of iptv device
StopSectionHandler();
DELETE_POINTER(pIptvSectionM);
DELETE_POINTER(pSidScannerM);
DELETE_POINTER(pPidScannerM);
DELETE_POINTER(pIptvStreamerM);
DELETE_POINTER(pExtProtocolM);
DELETE_POINTER(pFileProtocolM);
DELETE_POINTER(pHttpProtocolM);
DELETE_POINTER(pCurlProtocolM);
DELETE_POINTER(pUdpProtocolM);
DELETE_POINTER(tsBufferM);
// Close dvr fifo
if (dvrFdM >= 0) {
int fd = dvrFdM;
@@ -91,6 +91,15 @@ bool cIptvDevice::Initialize(unsigned int deviceCountP)
return true;
}
void cIptvDevice::Shutdown(void)
{
debug("cIptvDevice::%s()", __FUNCTION__);
for (int i = 0; i < IPTV_MAX_DEVICES; ++i) {
if (IptvDevicesS[i])
IptvDevicesS[i]->CloseDvr();
}
}
unsigned int cIptvDevice::Count(void)
{
unsigned int count = 0;
@@ -106,7 +115,7 @@ cIptvDevice *cIptvDevice::GetIptvDevice(int cardIndexP)
{
//debug("cIptvDevice::%s(%d)", __FUNCTION__, cardIndexP);
for (unsigned int i = 0; i < IPTV_MAX_DEVICES; ++i) {
if ((IptvDevicesS[i] != NULL) && (IptvDevicesS[i]->CardIndex() == cardIndexP)) {
if (IptvDevicesS[i] && (IptvDevicesS[i]->CardIndex() == cardIndexP)) {
//debug("cIptvDevice::%s(%d): found!", __FUNCTION__, cardIndexP);
return IptvDevicesS[i];
}
@@ -214,7 +223,7 @@ bool cIptvDevice::ProvidesChannel(const cChannel *channelP, int priorityP, bool
if (channelP && ProvidesTransponder(channelP)) {
result = hasPriority;
if (Receiving()) {
if (channelP->GetChannelID() == channelIdM)
if (channelP->GetChannelID() == channelM.GetChannelID())
result = true;
else
needsDetachReceivers = Receiving();
@@ -235,6 +244,21 @@ int cIptvDevice::NumProvidedSystems(void) const
return 1;
}
const cChannel *cIptvDevice::GetCurrentlyTunedTransponder(void) const
{
return &channelM;
}
bool cIptvDevice::IsTunedToTransponder(const cChannel *channelP) const
{
return channelP ? (channelP->GetChannelID() == channelM.GetChannelID()) : false;
}
bool cIptvDevice::MaySwitchTransponder(const cChannel *channelP) const
{
return cDevice::MaySwitchTransponder(channelP);
}
bool cIptvDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
{
cIptvProtocolIf *protocol;
@@ -270,11 +294,11 @@ bool cIptvDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
sidScanEnabledM = itp.SidScan() ? true : false;
pidScanEnabledM = itp.PidScan() ? true : false;
if (pIptvStreamerM->Set(itp.Address(), itp.Parameter(), deviceIndexM, protocol)) {
channelIdM = channelP->GetChannelID();
channelM = *channelP;
if (sidScanEnabledM && pSidScannerM && IptvConfig.GetSectionFiltering())
pSidScannerM->SetChannel(channelIdM);
pSidScannerM->SetChannel(channelM.GetChannelID());
if (pidScanEnabledM && pPidScannerM)
pPidScannerM->SetChannel(channelIdM);
pPidScannerM->SetChannel(channelM.GetChannelID());
}
return true;
}
@@ -310,6 +334,8 @@ bool cIptvDevice::OpenDvr(void)
pIptvStreamerM->Open();
if (sidScanEnabledM && pSidScannerM && IptvConfig.GetSectionFiltering())
pSidScannerM->Open();
if (pidScanEnabledM && pPidScannerM)
pPidScannerM->Open();
isOpenDvrM = true;
return true;
}
@@ -317,7 +343,9 @@ bool cIptvDevice::OpenDvr(void)
void cIptvDevice::CloseDvr(void)
{
debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
if (sidScanEnabledM && pSidScannerM )
if (pidScanEnabledM && pPidScannerM)
pPidScannerM->Close();
if (sidScanEnabledM && pSidScannerM)
pSidScannerM->Close();
if (pIptvStreamerM)
pIptvStreamerM->Close();
@@ -384,7 +412,7 @@ unsigned int cIptvDevice::CheckData(void)
bool cIptvDevice::GetTSPacket(uchar *&Data)
{
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
if (tsBufferM && !IsBuffering()) {
if (isOpenDvrM && tsBufferM && !IsBuffering()) {
if (isPacketDeliveredM) {
tsBufferM->Del(TS_SIZE);
isPacketDeliveredM = false;

View File

@@ -27,6 +27,7 @@ class cIptvDevice : public cDevice, public cIptvPidStatistics, public cIptvBuffe
public:
static unsigned int deviceCount;
static bool Initialize(unsigned int DeviceCount);
static void Shutdown(void);
static unsigned int Count(void);
static cIptvDevice *GetIptvDevice(int CardIndex);
@@ -40,7 +41,7 @@ private:
bool pidScanEnabledM;
cRingBufferLinear *tsBufferM;
mutable int tsBufferPrefillM;
tChannelID channelIdM;
cChannel channelM;
cIptvProtocolUdp *pUdpProtocolM;
cIptvProtocolCurl *pCurlProtocolM;
cIptvProtocolHttp *pHttpProtocolM;
@@ -87,6 +88,10 @@ public:
virtual bool ProvidesChannel(const cChannel *channelP, int priorityP = -1, bool *needsDetachReceiversP = NULL) const;
virtual bool ProvidesEIT(void) const;
virtual int NumProvidedSystems(void) const;
virtual const cChannel *GetCurrentlyTunedTransponder(void) const;
virtual bool IsTunedToTransponder(const cChannel *channelP) const;
virtual bool MaySwitchTransponder(const cChannel *channelP) const;
protected:
virtual bool SetChannelDevice(const cChannel *channelP, bool liveViewP);

6
iptv.c
View File

@@ -21,7 +21,7 @@
#define GITVERSION ""
#endif
const char VERSION[] = "2.0.0" GITVERSION;
const char VERSION[] = "2.0.3" GITVERSION;
static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
class cPluginIptv : public cPlugin {
@@ -99,7 +99,8 @@ bool cPluginIptv::Initialize(void)
{
debug("cPluginIptv::%s()", __FUNCTION__);
// Initialize any background activities the plugin shall perform.
IptvConfig.SetConfigDirectory(cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
IptvConfig.SetConfigDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N));
IptvConfig.SetResourceDirectory(cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
return cIptvDevice::Initialize(deviceCountM);
}
@@ -118,6 +119,7 @@ void cPluginIptv::Stop(void)
{
debug("cPluginIptv::%s()", __FUNCTION__);
// Stop any background activities the plugin is performing.
cIptvDevice::Shutdown();
curl_global_cleanup();
}

View File

@@ -39,7 +39,6 @@ void cPidScanner::SetChannel(const tChannelID &channelIdP)
aPidM = 0xFFFF;
numApidsM = 0;
processM = true;
timeoutM.Set(PIDSCANNER_TIMEOUT_IN_MS);
}
void cPidScanner::Process(const uint8_t* bufP)

View File

@@ -13,6 +13,12 @@
class cPidScanner {
private:
enum {
PIDSCANNER_APID_COUNT = 5, /* minimum count of audio pid samples for pid detection */
PIDSCANNER_VPID_COUNT = 5, /* minimum count of video pid samples for pid detection */
PIDSCANNER_PID_DELTA_COUNT = 100, /* minimum count of pid samples for audio/video only pid detection */
PIDSCANNER_TIMEOUT_IN_MS = 15000 /* 15s timeout for detection */
};
cTimeMs timeoutM;
tChannelID channelIdM;
bool processM;
@@ -26,6 +32,8 @@ public:
~cPidScanner();
void SetChannel(const tChannelID &channelIdP);
void Process(const uint8_t* bufP);
void Open() { debug("cPidScanner::%s()", __FUNCTION__); timeoutM.Set(PIDSCANNER_TIMEOUT_IN_MS); }
void Close() { debug("cPidScanner::%s()", __FUNCTION__); timeoutM.Set(0); }
};
#endif // __PIDSCANNER_H

View File

@@ -1,14 +1,14 @@
# VDR plugin language source file.
# Copyright (C) 2007 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2014 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Tobias <vdr@e-tobi.net>, 2007.
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.0.0\n"
"Project-Id-Version: vdr-iptv 2.0.3\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-04-01 04:01+0200\n"
"PO-Revision-Date: 2013-04-01 04:01+0200\n"
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
"Last-Translator: Tobias Grimm <tg@e-tobi.net>\n"
"Language-Team: German <vdr@linuxtv.org>\n"
"Language: de\n"

View File

@@ -1,14 +1,14 @@
# VDR plugin language source file.
# Copyright (C) 2007 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2014 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Rolf Ahrenberg
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.0.0\n"
"Project-Id-Version: vdr-iptv 2.0.3\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-04-01 04:01+0200\n"
"PO-Revision-Date: 2013-04-01 04:01+0200\n"
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
"Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish <vdr@linuxtv.org>\n"
"Language: fi\n"

View File

@@ -1,15 +1,15 @@
# French translations for iptv package.
# Copyright (C) 2007 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2014 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Bruno ROUSSEL <bruno.roussel@free.fr>, 2007.
# NIVAL Michaël <mnival@club-internet.fr>, 2008.
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.0.0\n"
"Project-Id-Version: vdr-iptv 2.0.3\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-04-01 04:01+0200\n"
"PO-Revision-Date: 2013-04-01 04:01+0200\n"
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
"Last-Translator: NIVAL Michaël <mnival@club-internet.fr>\n"
"Language-Team: French <vdr@linuxtv.org>\n"
"Language: fr\n"

View File

@@ -1,14 +1,14 @@
# VDR plugin language source file.
# Copyright (C) 2007 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2014 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Diego Pierotto <vdr-italian@tiscali.it>, 2008.
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.0.0\n"
"Project-Id-Version: vdr-iptv 2.0.3\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-04-01 04:01+0200\n"
"PO-Revision-Date: 2013-04-01 04:01+0200\n"
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: Italian <vdr@linuxtv.org>\n"
"Language: it\n"

View File

@@ -1,14 +1,14 @@
# VDR plugin language source file.
# Copyright (C) 2007 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2014 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Carel, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.0.0\n"
"Project-Id-Version: vdr-iptv 2.0.3\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-04-01 04:01+0200\n"
"PO-Revision-Date: 2013-04-01 04:01+0200\n"
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
"Last-Translator: Carel\n"
"Language-Team: Dutch <vdr@linuxtv.org>\n"
"Language: nl\n"

View File

@@ -1,14 +1,14 @@
# VDR plugin language source file.
# Copyright (C) 2007 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2014 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Alexander Gross <Bikalexander@gmail.com>, 2008.
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.0.0\n"
"Project-Id-Version: vdr-iptv 2.0.3\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-04-01 04:01+0200\n"
"PO-Revision-Date: 2013-04-01 04:01+0200\n"
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
"Last-Translator: Alexander Gross <Bikalexander@gmail.com>\n"
"Language-Team: Russian <vdr@linuxtv.org>\n"
"Language: ru\n"

View File

@@ -15,12 +15,12 @@
#define iptv_curl_easy_setopt(X, Y, Z) \
if ((res = curl_easy_setopt((X), (Y), (Z))) != CURLE_OK) { \
error("curl_easy_setopt(%s, %s, %s) failed: %d", #X, #Y, #Z, res); \
error("curl_easy_setopt(%s, %s) failed: %s (%d)", #Y, #Z, curl_easy_strerror(res), res); \
}
#define iptv_curl_easy_perform(X) \
if ((res = curl_easy_perform((X))) != CURLE_OK) { \
error("curl_easy_perform(%s) failed: %d", #X, res); \
error("curl_easy_perform() failed: %s (%d)", curl_easy_strerror(res), res); \
}
cIptvProtocolCurl::cIptvProtocolCurl()
@@ -73,7 +73,7 @@ size_t cIptvProtocolCurl::WriteRtspCallback(void *ptrP, size_t sizeP, size_t nme
//debug("cIptvProtocolCurl::%s(%zu)", __FUNCTION__, len);
// Validate packet header ('$') and channel (0)
if (obj && (p[0] == 0x24 ) && (p[1] == 0)) {
if (obj && (p[0] == 0x24) && (p[1] == 0)) {
int length = (p[2] << 8) | p[3];
if (length > 3) {
// Skip interleave header
@@ -264,7 +264,8 @@ bool cIptvProtocolCurl::Connect()
iptv_curl_easy_setopt(handleM, CURLOPT_NETRC, (long)CURL_NETRC_OPTIONAL);
iptv_curl_easy_setopt(handleM, CURLOPT_NETRC_FILE, *netrc);
// Set timeout
// Set timeouts
iptv_curl_easy_setopt(handleM, CURLOPT_TIMEOUT, (long)eConnectTimeoutS);
iptv_curl_easy_setopt(handleM, CURLOPT_CONNECTTIMEOUT, (long)eConnectTimeoutS);
// Set user-agent
@@ -345,6 +346,10 @@ bool cIptvProtocolCurl::Connect()
break;
case eModeFile:
// Set timeout
iptv_curl_easy_setopt(handleM, CURLOPT_TIMEOUT_MS, 10L);
break;
case eModeUnknown:
default:
break;

View File

@@ -158,7 +158,7 @@ bool cIptvProtocolExt::Set(const char* locationP, const int parameterP, const in
if (!isempty(locationP)) {
struct stat stbuf;
// Update script file and parameter
scriptFileM = cString::sprintf("%s/%s", IptvConfig.GetConfigDirectory(), locationP);
scriptFileM = cString::sprintf("%s/%s", IptvConfig.GetResourceDirectory(), locationP);
if ((stat(*scriptFileM, &stbuf) != 0) || (strstr(*scriptFileM, "..") != 0)) {
error("Non-existent or relative path script '%s'", *scriptFileM);
return false;

View File

@@ -238,9 +238,9 @@ cIptvSectionFilterHandler::cIptvSectionFilterHandler(int deviceIndexP, unsigned
cIptvSectionFilterHandler::~cIptvSectionFilterHandler()
{
debug("cIptvSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM);
// Stop thread
if (Running())
Cancel(3);
Stop();
DELETE_POINTER(ringBufferM);
// Destroy all filters
cMutexLock MutexLock(&mutexM);
@@ -248,6 +248,15 @@ cIptvSectionFilterHandler::~cIptvSectionFilterHandler()
Delete(i);
}
bool cIptvSectionFilterHandler::Stop(void)
{
debug("cIptvSectionFilterHandler::%s(%d): entering", __FUNCTION__, deviceIndexM);
// Stop thread
if (Running())
Cancel(3);
return true;
}
void cIptvSectionFilterHandler::Action(void)
{
debug("cIptvSectionFilterHandler::%s(%d): entering", __FUNCTION__, deviceIndexM);
@@ -381,4 +390,3 @@ void cIptvSectionFilterHandler::Write(uchar *bufferP, int lengthP)
ringBufferM->ReportOverflow(lengthP - len);
}
}

View File

@@ -80,6 +80,7 @@ protected:
public:
cIptvSectionFilterHandler(int deviceIndexP, unsigned int bufferLenP);
virtual ~cIptvSectionFilterHandler();
bool Stop(void);
cString GetInformation(void);
int Open(u_short pidP, u_char tidP, u_char maskP);
void Close(int handleP);

View File

@@ -71,15 +71,21 @@ void cSidScanner::Process(u_short pidP, u_char tidP, const u_char *dataP, int le
if (ts.getTransportStreamId() != channelIdM.Tid()) {
debug("cSidScanner::%s(): tsid=%d", __FUNCTION__, ts.getTransportStreamId());
newTid = ts.getTransportStreamId();
tidFoundM = true;
}
if (ts.getOriginalNetworkId() != channelIdM.Nid()) {
debug("cSidScanner::%s(): onid=%d", __FUNCTION__, ts.getOriginalNetworkId());
newNid = ts.getOriginalNetworkId();
nidFoundM = true;
}
tidFoundM = true;
break; // default to the first one
}
if (nit.getNetworkId() != channelIdM.Nid()) {
debug("cSidScanner::%s(): nid=%d", __FUNCTION__, ts.getTransportStreamId());
// fallback for network id if not found already
if (!nidFoundM && (nit.getNetworkId() != channelIdM.Nid())) {
debug("cSidScanner::%s(): nid=%d", __FUNCTION__, nit.getNetworkId());
newNid = nit.getNetworkId();
nidFoundM = true;
}
nidFoundM = true;
}
}
if ((newSid >= 0) || (newNid >= 0) || (newTid >= 0)) {

View File

@@ -58,6 +58,7 @@ bool cIptvTransponderParameters::Parse(const char *strP)
if (strP && *strP) {
const char *delim = "|";
char *str = strdup(strP);
char *p = str;
char *saveptr = NULL;
char *token = NULL;
bool found_s = false;
@@ -120,9 +121,9 @@ bool cIptvTransponderParameters::Parse(const char *strP)
if (found_s && found_p && found_f && found_u && found_a)
result = true;
else
error("Invalid channel parameters: %s", str);
error("Invalid channel parameters: %s", p);
free(str);
free(p);
}
return (result);