mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 11:37:03 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc64c044a1 | ||
|
|
3dcbff0a71 | ||
|
|
5aefd40d65 | ||
|
|
6b0337d078 | ||
|
|
9e6d784aec |
9
HISTORY
9
HISTORY
@@ -220,3 +220,12 @@ VDR Plugin 'iptv' Revision History
|
||||
- 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).
|
||||
|
||||
4
Makefile
4
Makefile
@@ -32,6 +32,7 @@ PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(s
|
||||
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
|
||||
|
||||
|
||||
7
config.c
7
config.c
@@ -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");
|
||||
}
|
||||
|
||||
3
config.h
3
config.h
@@ -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;
|
||||
|
||||
22
device.c
22
device.c
@@ -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];
|
||||
}
|
||||
@@ -245,6 +254,11 @@ 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;
|
||||
@@ -320,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;
|
||||
}
|
||||
@@ -327,6 +343,8 @@ bool cIptvDevice::OpenDvr(void)
|
||||
void cIptvDevice::CloseDvr(void)
|
||||
{
|
||||
debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||
if (pidScanEnabledM && pPidScannerM)
|
||||
pPidScannerM->Close();
|
||||
if (sidScanEnabledM && pSidScannerM)
|
||||
pSidScannerM->Close();
|
||||
if (pIptvStreamerM)
|
||||
@@ -394,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;
|
||||
|
||||
3
device.h
3
device.h
@@ -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);
|
||||
|
||||
@@ -89,6 +90,8 @@ public:
|
||||
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
6
iptv.c
@@ -21,7 +21,7 @@
|
||||
#define GITVERSION ""
|
||||
#endif
|
||||
|
||||
const char VERSION[] = "2.0.1" 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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-iptv 2.0.1\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"
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-iptv 2.0.1\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"
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-iptv 2.0.1\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"
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-iptv 2.0.1\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"
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-iptv 2.0.1\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"
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-iptv 2.0.1\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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -238,9 +238,7 @@ cIptvSectionFilterHandler::cIptvSectionFilterHandler(int deviceIndexP, unsigned
|
||||
cIptvSectionFilterHandler::~cIptvSectionFilterHandler()
|
||||
{
|
||||
debug("cIptvSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||
// Stop thread
|
||||
if (Running())
|
||||
Cancel(3);
|
||||
Stop();
|
||||
|
||||
DELETE_POINTER(ringBufferM);
|
||||
|
||||
@@ -250,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);
|
||||
@@ -383,4 +390,3 @@ void cIptvSectionFilterHandler::Write(uchar *bufferP, int lengthP)
|
||||
ringBufferM->ReportOverflow(lengthP - len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user