[vdr-plugin-iptv] 01/03: Imported Upstream version 2.2.1
Tobias Grimm
tiber-guest at moszumanska.debian.org
Thu Sep 3 16:58:31 UTC 2015
This is an automated email from the git hooks/post-receive script.
tiber-guest pushed a commit to branch master
in repository vdr-plugin-iptv.
commit 0e6334db1da6cb5e2916f93061e19ad9fc9f5c01
Author: etobi <git at e-tobi.net>
Date: Thu Sep 3 18:52:59 2015 +0200
Imported Upstream version 2.2.1
---
HISTORY | 10 +++++-
Makefile | 15 +--------
common.h | 28 ++++++-----------
config.c | 8 +++--
config.h | 24 +++++++++++++++
device.c | 62 ++++++++++++++++++-------------------
iptv.c | 57 +++++++++++++++++++++-------------
log.h | 48 +++++++++++++++++++++++++++++
pidscanner.c | 20 ++++++------
pidscanner.h | 6 ++--
po/de_DE.po | 6 ++--
po/fi_FI.po | 6 ++--
po/fr_FR.po | 6 ++--
po/it_IT.po | 6 ++--
po/lt_LT.po | 6 ++--
po/nl_NL.po | 6 ++--
po/ru_RU.po | 6 ++--
protocolcurl.c | 95 ++++++++++++++++++++++++++++++++++++++-------------------
protocolcurl.h | 3 ++
protocolext.c | 25 +++++++--------
protocolfile.c | 23 +++++++-------
protocolhttp.c | 25 +++++++--------
protocoludp.c | 17 ++++++-----
sectionfilter.c | 33 ++++++++++----------
setup.c | 6 ++--
sidscanner.c | 20 ++++++------
sidscanner.h | 6 ++--
socket.c | 57 +++++++++++++++++-----------------
source.c | 16 +++++-----
statistics.c | 37 +++++++++++-----------
streamer.c | 19 ++++++------
31 files changed, 411 insertions(+), 291 deletions(-)
diff --git a/HISTORY b/HISTORY
index 13afb37..0ee3e03 100644
--- a/HISTORY
+++ b/HISTORY
@@ -263,4 +263,12 @@ VDR Plugin 'iptv' Revision History
- Updated for vdr-2.2.0.
- Updated German translations (Thanks to Frank Neumann).
-- Updated Lithuanian translations (Thanks to Valdemaras Pipiras).
+- Updated Lithuanian translations (Thanks to Valdemaras
+ Pipiras).
+
+2015-04-04: Version 2.2.1
+
+- Fixed CURL timeout and added a stale connection
+ detection (Thanks to Daniel Ribeiro).
+- Got rid of IPTV_DEBUG.
+- Added support for tracing modes.
diff --git a/Makefile b/Makefile
index 4e48a2e..62b2fb4 100644
--- a/Makefile
+++ b/Makefile
@@ -2,18 +2,10 @@
# Makefile for IPTV plugin
#
-# Debugging on/off
-
-#IPTV_DEBUG = 1
-
# Default shell for EXT protocol
#IPTV_EXTSHELL = /bin/bash
-# Strip debug symbols? Set eg. to /bin/true if not
-
-STRIP = strip
-
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
# By default the main source file also carries this name.
@@ -41,6 +33,7 @@ TMPDIR ?= /tmp
export CFLAGS = $(call PKGCFG,cflags)
export CXXFLAGS = $(call PKGCFG,cxxflags)
+STRIP ?= /bin/true
### The version number of VDR's plugin API:
@@ -69,10 +62,6 @@ INCLUDES +=
DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
-ifdef IPTV_DEBUG
-DEFINES += -DDEBUG
-endif
-
ifdef IPTV_EXTSHELL
DEFINES += -DEXTSHELL='"$(IPTV_EXTSHELL)"'
endif
@@ -139,9 +128,7 @@ install-i18n: $(I18Nmsgs)
$(SOFILE): $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
-ifndef IPTV_DEBUG
@$(STRIP) $@
-endif
install-lib: $(SOFILE)
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
diff --git a/common.h b/common.h
index 450f53a..3190297 100644
--- a/common.h
+++ b/common.h
@@ -12,16 +12,6 @@
#include <vdr/config.h>
#include <vdr/i18n.h>
-#ifdef DEBUG
-#define debug(x...) dsyslog("IPTV: " x);
-#define info(x...) isyslog("IPTV: " x);
-#define error(x...) esyslog("ERROR: " x);
-#else
-#define debug(x...) ;
-#define info(x...) isyslog("IPTV: " x);
-#define error(x...) esyslog("ERROR: " x);
-#endif
-
#define ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
#define IPTV_BUFFER_SIZE MEGABYTE(1)
@@ -42,15 +32,15 @@
#define SECTION_FILTER_TABLE_SIZE 5
-#define ERROR_IF_FUNC(exp, errstr, func, ret) \
- do { \
- if (exp) { \
- char tmp[64]; \
- error("[%s,%d]: "errstr": %s", __FILE__, __LINE__, \
- strerror_r(errno, tmp, sizeof(tmp))); \
- func; \
- ret; \
- } \
+#define ERROR_IF_FUNC(exp, errstr, func, ret) \
+ do { \
+ if (exp) { \
+ char tmp[64]; \
+ esyslog("[%s,%d]: "errstr": %s", __FILE__, __LINE__, \
+ strerror_r(errno, tmp, sizeof(tmp))); \
+ func; \
+ ret; \
+ } \
} while (0)
diff --git a/config.c b/config.c
index 6a5e7b2..f681c30 100644
--- a/config.c
+++ b/config.c
@@ -5,12 +5,14 @@
*
*/
+#include "log.h"
#include "config.h"
cIptvConfig IptvConfig;
cIptvConfig::cIptvConfig(void)
-: protocolBasePortM(4321),
+: traceModeM(eTraceModeNormal),
+ protocolBasePortM(4321),
useBytesM(1),
sectionFilteringM(1)
{
@@ -41,12 +43,12 @@ void cIptvConfig::SetDisabledFilters(unsigned int indexP, int numberP)
void cIptvConfig::SetConfigDirectory(const char *directoryP)
{
- debug("cIptvConfig::%s(%s)", __FUNCTION__, directoryP);
+ debug1("%s (%s)", __PRETTY_FUNCTION__, directoryP);
ERROR_IF(!realpath(directoryP, configDirectoryM), "Cannot canonicalize configuration directory");
}
void cIptvConfig::SetResourceDirectory(const char *directoryP)
{
- debug("cIptvConfig::%s(%s)", __FUNCTION__, directoryP);
+ debug1("%s (%s)", __PRETTY_FUNCTION__, directoryP);
ERROR_IF(!realpath(directoryP, resourceDirectoryM), "Cannot canonicalize resource directory");
}
diff --git a/config.h b/config.h
index e13318a..d5ce470 100644
--- a/config.h
+++ b/config.h
@@ -14,6 +14,7 @@
class cIptvConfig
{
private:
+ unsigned int traceModeM;
unsigned int protocolBasePortM;
unsigned int useBytesM;
unsigned int sectionFilteringM;
@@ -22,7 +23,29 @@ private:
char resourceDirectoryM[PATH_MAX];
public:
+ enum eTraceMode {
+ eTraceModeNormal = 0x0000,
+ eTraceModeDebug1 = 0x0001,
+ eTraceModeDebug2 = 0x0002,
+ eTraceModeDebug3 = 0x0004,
+ eTraceModeDebug4 = 0x0008,
+ eTraceModeDebug5 = 0x0010,
+ eTraceModeDebug6 = 0x0020,
+ eTraceModeDebug7 = 0x0040,
+ eTraceModeDebug8 = 0x0080,
+ eTraceModeDebug9 = 0x0100,
+ eTraceModeDebug10 = 0x0200,
+ eTraceModeDebug11 = 0x0400,
+ eTraceModeDebug12 = 0x0800,
+ eTraceModeDebug13 = 0x1000,
+ eTraceModeDebug14 = 0x2000,
+ eTraceModeDebug15 = 0x4000,
+ eTraceModeDebug16 = 0x8000,
+ eTraceModeMask = 0xFFFF
+ };
cIptvConfig();
+ unsigned int GetTraceMode(void) const { return traceModeM; }
+ bool IsTraceMode(eTraceMode modeP) const { return (traceModeM & modeP); }
unsigned int GetProtocolBasePort(void) const { return protocolBasePortM; }
unsigned int GetUseBytes(void) const { return useBytesM; }
unsigned int GetSectionFiltering(void) const { return sectionFilteringM; }
@@ -30,6 +53,7 @@ public:
const char *GetResourceDirectory(void) const { return resourceDirectoryM; }
unsigned int GetDisabledFiltersCount(void) const;
int GetDisabledFilters(unsigned int indexP) const;
+ void SetTraceMode(unsigned int modeP) { traceModeM = (modeP & eTraceModeMask); }
void SetProtocolBasePort(unsigned int portNumberP) { protocolBasePortM = portNumberP; }
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
void SetSectionFiltering(unsigned int onOffP) { sectionFilteringM = onOffP; }
diff --git a/device.c b/device.c
index 1ca7043..d94510a 100644
--- a/device.c
+++ b/device.c
@@ -24,7 +24,7 @@ cIptvDevice::cIptvDevice(unsigned int indexP)
{
unsigned int bufsize = (unsigned int)IPTV_BUFFER_SIZE;
bufsize -= (bufsize % TS_SIZE);
- isyslog("creating IPTV device %d (CardIndex=%d)", deviceIndexM, CardIndex());
+ info("Creating IPTV device %d (CardIndex=%d)", deviceIndexM, CardIndex());
tsBufferM = new cRingBufferLinear(bufsize + 1, TS_SIZE, false,
*cString::sprintf("IPTV TS %d", deviceIndexM));
if (tsBufferM) {
@@ -50,13 +50,13 @@ cIptvDevice::cIptvDevice(unsigned int indexP)
if (S_ISFIFO(sb.st_mode)) {
dvrFdM = open(filename, O_RDWR | O_NONBLOCK);
if (dvrFdM >= 0)
- dsyslog("IPTV device %d redirecting input stream to '%s'", deviceIndexM, *filename);
+ info("IPTV device %d redirecting input stream to '%s'", deviceIndexM, *filename);
}
}
cIptvDevice::~cIptvDevice()
{
- debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
// Stop section handler of iptv device
StopSectionHandler();
DELETE_POINTER(pIptvSectionM);
@@ -79,7 +79,7 @@ cIptvDevice::~cIptvDevice()
bool cIptvDevice::Initialize(unsigned int deviceCountP)
{
- debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceCountP);
+ debug1("%s (%u)", __PRETTY_FUNCTION__, deviceCountP);
new cIptvSourceParam(IPTV_SOURCE_CHARACTER, "IPTV");
if (deviceCountP > IPTV_MAX_DEVICES)
deviceCountP = IPTV_MAX_DEVICES;
@@ -92,7 +92,7 @@ bool cIptvDevice::Initialize(unsigned int deviceCountP)
void cIptvDevice::Shutdown(void)
{
- debug("cIptvDevice::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
for (int i = 0; i < IPTV_MAX_DEVICES; ++i) {
if (IptvDevicesS[i])
IptvDevicesS[i]->CloseDvr();
@@ -102,7 +102,7 @@ void cIptvDevice::Shutdown(void)
unsigned int cIptvDevice::Count(void)
{
unsigned int count = 0;
- debug("cIptvDevice::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
for (unsigned int i = 0; i < IPTV_MAX_DEVICES; ++i) {
if (IptvDevicesS[i] != NULL)
count++;
@@ -112,10 +112,10 @@ unsigned int cIptvDevice::Count(void)
cIptvDevice *cIptvDevice::GetIptvDevice(int cardIndexP)
{
- //debug("cIptvDevice::%s(%d)", __FUNCTION__, cardIndexP);
+ debug16("%s (%d)", __PRETTY_FUNCTION__, cardIndexP);
for (unsigned int i = 0; i < IPTV_MAX_DEVICES; ++i) {
if (IptvDevicesS[i] && (IptvDevicesS[i]->CardIndex() == cardIndexP)) {
- //debug("cIptvDevice::%s(%d): found!", __FUNCTION__, cardIndexP);
+ debug16("%s (%d) Found", __PRETTY_FUNCTION__, cardIndexP);
return IptvDevicesS[i];
}
}
@@ -124,7 +124,7 @@ cIptvDevice *cIptvDevice::GetIptvDevice(int cardIndexP)
cString cIptvDevice::GetGeneralInformation(void)
{
- //debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
return cString::sprintf("IPTV device: %d\nCardIndex: %d\nStream: %s\nStream bitrate: %s\n%sChannel: %s",
deviceIndexM, CardIndex(),
pIptvStreamerM ? *pIptvStreamerM->GetInformation() : "",
@@ -135,13 +135,13 @@ cString cIptvDevice::GetGeneralInformation(void)
cString cIptvDevice::GetPidsInformation(void)
{
- //debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
return GetPidStatistic();
}
cString cIptvDevice::GetFiltersInformation(void)
{
- //debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
return cString::sprintf("Active section filters:\n%s", pIptvSectionM ? *pIptvSectionM->GetInformation() : "");
}
@@ -177,37 +177,37 @@ cString cIptvDevice::GetInformation(unsigned int pageP)
cString cIptvDevice::DeviceType(void) const
{
- //debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
return "IPTV";
}
cString cIptvDevice::DeviceName(void) const
{
- debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
return cString::sprintf("IPTV %d", deviceIndexM);
}
int cIptvDevice::SignalStrength(void) const
{
- debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
return (100);
}
int cIptvDevice::SignalQuality(void) const
{
- debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
return (100);
}
bool cIptvDevice::ProvidesSource(int sourceP) const
{
- debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
return (cSource::IsType(sourceP, IPTV_SOURCE_CHARACTER));
}
bool cIptvDevice::ProvidesTransponder(const cChannel *channelP) const
{
- debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
return (ProvidesSource(channelP->Source()));
}
@@ -217,7 +217,7 @@ bool cIptvDevice::ProvidesChannel(const cChannel *channelP, int priorityP, bool
bool hasPriority = (priorityP == IDLEPRIORITY) || (priorityP > this->Priority());
bool needsDetachReceivers = false;
- debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
if (channelP && ProvidesTransponder(channelP)) {
result = hasPriority;
@@ -263,7 +263,7 @@ bool cIptvDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
cIptvProtocolIf *protocol;
cIptvTransponderParameters itp(channelP->Parameters());
- debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
if (isempty(itp.Address())) {
error("Unrecognized IPTV address: %s", channelP->Parameters());
@@ -304,7 +304,7 @@ 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 ? handleP->pid : -1, typeP, onP);
+ debug1("%s (%d, %d, %d) [device %d]", __PRETTY_FUNCTION__, handleP ? handleP->pid : -1, typeP, onP, deviceIndexM);
if (pIptvStreamerM && handleP)
return pIptvStreamerM->SetPid(handleP->pid, typeP, onP);
return true;
@@ -312,7 +312,7 @@ bool cIptvDevice::SetPid(cPidHandle *handleP, int typeP, bool onP)
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);
+ debug16("%s (%d, %d, %d) [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, deviceIndexM);
if (pIptvSectionM && IptvConfig.GetSectionFiltering()) {
if (pIptvStreamerM)
pIptvStreamerM->SetPid(pidP, ptOther, true);
@@ -323,7 +323,7 @@ int cIptvDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP)
void cIptvDevice::CloseFilter(int handleP)
{
- //debug("cIptvDevice::%s(%d): handle=%d", __FUNCTION__, deviceIndexM, handleP);
+ debug16("%s (%d) [device %d]", __PRETTY_FUNCTION__, handleP, deviceIndexM);
if (pIptvSectionM) {
if (pIptvStreamerM)
pIptvStreamerM->SetPid(pIptvSectionM->GetPid(handleP), ptOther, false);
@@ -333,7 +333,7 @@ void cIptvDevice::CloseFilter(int handleP)
bool cIptvDevice::OpenDvr(void)
{
- debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
isPacketDeliveredM = false;
tsBufferM->Clear();
if (pIptvStreamerM)
@@ -348,7 +348,7 @@ bool cIptvDevice::OpenDvr(void)
void cIptvDevice::CloseDvr(void)
{
- debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
if (pidScanEnabledM && pPidScannerM)
pPidScannerM->Close();
if (sidScanEnabledM && pSidScannerM)
@@ -360,19 +360,19 @@ void cIptvDevice::CloseDvr(void)
bool cIptvDevice::HasLock(int timeoutMsP) const
{
- //debug("cIptvDevice::%s(%d): timeoutMs=%d", __FUNCTION__, deviceIndexM, timeoutMsP);
+ debug16("%s (%d) [device %d]", __PRETTY_FUNCTION__, timeoutMsP, deviceIndexM);
return (pIptvStreamerM && pIptvStreamerM->Active());
}
bool cIptvDevice::HasInternalCam(void)
{
- //debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
return false;
}
void cIptvDevice::WriteData(uchar *bufferP, int lengthP)
{
- //debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug16("%s (, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIndexM);
int len;
// Send data to dvr fifo
if (dvrFdM >= 0)
@@ -390,7 +390,7 @@ void cIptvDevice::WriteData(uchar *bufferP, int lengthP)
unsigned int cIptvDevice::CheckData(void)
{
- //debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
if (tsBufferM)
return (unsigned int)tsBufferM->Free();
return 0;
@@ -398,7 +398,7 @@ unsigned int cIptvDevice::CheckData(void)
uchar *cIptvDevice::GetData(int *availableP)
{
- //debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
if (isOpenDvrM && tsBufferM) {
int count = 0;
if (isPacketDeliveredM)
@@ -429,7 +429,7 @@ uchar *cIptvDevice::GetData(int *availableP)
void cIptvDevice::SkipData(int countP)
{
- //debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug16("%s (%d) [device %d]]", __PRETTY_FUNCTION__, countP, deviceIndexM);
tsBufferM->Del(countP);
isPacketDeliveredM = false;
// Update buffer statistics
@@ -438,7 +438,7 @@ void cIptvDevice::SkipData(int countP)
bool cIptvDevice::GetTSPacket(uchar *&dataP)
{
- //debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
if (tsBufferM) {
if (cCamSlot *cs = CamSlot()) {
if (cs->WantsTsData()) {
diff --git a/iptv.c b/iptv.c
index 1c6981f..594bb59 100644
--- a/iptv.c
+++ b/iptv.c
@@ -21,7 +21,7 @@
#define GITVERSION ""
#endif
- const char VERSION[] = "2.2.0" GITVERSION;
+ const char VERSION[] = "2.2.1" GITVERSION;
static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
class cPluginIptv : public cPlugin {
@@ -54,7 +54,7 @@ public:
cPluginIptv::cPluginIptv(void)
: deviceCountM(1)
{
- //debug("cPluginIptv::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
// Initialize any member variables here.
// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
@@ -62,23 +62,25 @@ cPluginIptv::cPluginIptv(void)
cPluginIptv::~cPluginIptv()
{
- //debug("cPluginIptv::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
// Clean up after yourself!
}
const char *cPluginIptv::CommandLineHelp(void)
{
- debug("cPluginIptv::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Return a string that describes all known command line options.
- return " -d <num>, --devices=<number> number of devices to be created\n";
+ return " -d <num>, --devices=<number> number of devices to be created\n"
+ " -t <mode>, --trace=<mode> set the tracing mode\n";
}
bool cPluginIptv::ProcessArgs(int argc, char *argv[])
{
- debug("cPluginIptv::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Implement command line argument processing here if applicable.
static const struct option long_options[] = {
{ "devices", required_argument, NULL, 'd' },
+ { "trace", required_argument, NULL, 't' },
{ NULL, no_argument, NULL, 0 }
};
@@ -88,6 +90,9 @@ bool cPluginIptv::ProcessArgs(int argc, char *argv[])
case 'd':
deviceCountM = atoi(optarg);
break;
+ case 't':
+ IptvConfig.SetTraceMode(strtol(optarg, NULL, 0));
+ break;
default:
return false;
}
@@ -97,7 +102,7 @@ bool cPluginIptv::ProcessArgs(int argc, char *argv[])
bool cPluginIptv::Initialize(void)
{
- debug("cPluginIptv::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Initialize any background activities the plugin shall perform.
IptvConfig.SetConfigDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N));
IptvConfig.SetResourceDirectory(cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
@@ -106,7 +111,7 @@ bool cPluginIptv::Initialize(void)
bool cPluginIptv::Start(void)
{
- debug("cPluginIptv::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// 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);
@@ -124,7 +129,7 @@ bool cPluginIptv::Start(void)
void cPluginIptv::Stop(void)
{
- debug("cPluginIptv::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Stop any background activities the plugin is performing.
cIptvDevice::Shutdown();
curl_global_cleanup();
@@ -132,54 +137,54 @@ void cPluginIptv::Stop(void)
void cPluginIptv::Housekeeping(void)
{
- //debug("cPluginIptv::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
// Perform any cleanup or other regular tasks.
}
void cPluginIptv::MainThreadHook(void)
{
- //debug("cPluginIptv::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
// Perform actions in the context of the main program thread.
// WARNING: Use with great care - see PLUGINS.html!
}
cString cPluginIptv::Active(void)
{
- //debug("cPluginIptv::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
// Return a message string if shutdown should be postponed
return NULL;
}
time_t cPluginIptv::WakeupTime(void)
{
- //debug("cPluginIptv::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
// Return custom wakeup time for shutdown script
return 0;
}
cOsdObject *cPluginIptv::MainMenuAction(void)
{
- //debug("cPluginIptv::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
// Perform the action when selected from the main VDR menu.
return NULL;
}
cMenuSetupPage *cPluginIptv::SetupMenu(void)
{
- debug("cPluginIptv::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Return a setup menu in case the plugin supports one.
return new cIptvPluginSetup();
}
int cPluginIptv::ParseFilters(const char *valueP, int *filtersP)
{
- debug("cPluginIptv::%s(%s)", __FUNCTION__, valueP);
+ debug1("%s (%s, )", __PRETTY_FUNCTION__, valueP);
char buffer[256];
int n = 0;
while (valueP && *valueP && (n < SECTION_FILTER_TABLE_SIZE)) {
strn0cpy(buffer, valueP, sizeof(buffer));
int i = atoi(buffer);
- //debug("cPluginIptv::%s(): filters[%d]=%d", __FUNCTION__, n, i);
+ debug16("%s (%s, ) filters[%d]=%d", __PRETTY_FUNCTION__, valueP, n, i);
if (i >= 0)
filtersP[n++] = i;
if ((valueP = strchr(valueP, ' ')) != NULL)
@@ -190,7 +195,7 @@ int cPluginIptv::ParseFilters(const char *valueP, int *filtersP)
bool cPluginIptv::SetupParse(const char *nameP, const char *valueP)
{
- debug("cPluginIptv::%s()", __FUNCTION__);
+ debug1("%s (%s, %s)", __PRETTY_FUNCTION__, nameP, valueP);
// Parse your own setup parameters and store their values.
if (!strcasecmp(nameP, "ExtProtocolBasePort"))
IptvConfig.SetProtocolBasePort(atoi(valueP));
@@ -211,8 +216,8 @@ bool cPluginIptv::SetupParse(const char *nameP, const char *valueP)
bool cPluginIptv::Service(const char *idP, void *dataP)
{
- debug("cPluginIptv::%s()", __FUNCTION__);
- if (strcmp(idP,"IptvService-v1.0") == 0) {
+ debug1("%s (%s, )", __PRETTY_FUNCTION__, idP);
+ if (strcmp(idP, "IptvService-v1.0") == 0) {
if (dataP) {
IptvService_v1_0 *data = reinterpret_cast<IptvService_v1_0*>(dataP);
cIptvDevice *dev = cIptvDevice::GetIptvDevice(data->cardIndex);
@@ -228,7 +233,7 @@ bool cPluginIptv::Service(const char *idP, void *dataP)
const char **cPluginIptv::SVDRPHelpPages(void)
{
- debug("cPluginIptv::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
static const char *HelpPages[] = {
"INFO [ <page> ]\n"
" Print IPTV device information and statistics.\n"
@@ -236,6 +241,8 @@ const char **cPluginIptv::SVDRPHelpPages(void)
" option: 1=general 2=pids 3=section filters.\n",
"MODE\n"
" Toggles between bit or byte information mode.\n",
+ "TRAC [ <mode> ]\n"
+ " Gets and/or sets used tracing mode.\n",
NULL
};
return HelpPages;
@@ -243,7 +250,7 @@ const char **cPluginIptv::SVDRPHelpPages(void)
cString cPluginIptv::SVDRPCommand(const char *commandP, const char *optionP, int &replyCodeP)
{
- debug("cPluginIptv::%s(%s, %s)", __FUNCTION__, commandP, optionP);
+ debug1("%s (%s, %s, )", __PRETTY_FUNCTION__, commandP, optionP);
if (strcasecmp(commandP, "INFO") == 0) {
cIptvDevice *device = cIptvDevice::GetIptvDevice(cDevice::ActualDevice()->CardIndex());
if (device) {
@@ -265,6 +272,12 @@ cString cPluginIptv::SVDRPCommand(const char *commandP, const char *optionP, int
IptvConfig.SetUseBytes(mode);
return cString::sprintf("IPTV information mode is: %s\n", mode ? "bytes" : "bits");
}
+ else if (strcasecmp(commandP, "TRAC") == 0) {
+ if (optionP && *optionP)
+ IptvConfig.SetTraceMode(strtol(optionP, NULL, 0));
+ return cString::sprintf("IPTV tracing mode: 0x%04X\n", IptvConfig.GetTraceMode());
+ }
+
return NULL;
}
diff --git a/log.h b/log.h
new file mode 100644
index 0000000..37f463d
--- /dev/null
+++ b/log.h
@@ -0,0 +1,48 @@
+/*
+ * log.h: IPTV plugin for the Video Disk Recorder
+ *
+ * See the README file for copyright information and how to reach the author.
+ *
+ */
+
+#ifndef __IPTV_LOG_H
+#define __IPTV_LOG_H
+
+#include "config.h"
+
+#define error(x...) esyslog("IPTV-ERROR: " x)
+#define info(x...) isyslog("IPTV: " x)
+// 0x0001: Generic call stack
+#define debug1(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug1) ? dsyslog("IPTV1: " x) : void() )
+// 0x0002: TBD
+#define debug2(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug2) ? dsyslog("IPTV2: " x) : void() )
+// 0x0004: TBD
+#define debug3(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug3) ? dsyslog("IPTV3: " x) : void() )
+// 0x0008: TBD
+#define debug4(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug4) ? dsyslog("IPTV4: " x) : void() )
+// 0x0010: TBD
+#define debug5(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug5) ? dsyslog("IPTV5: " x) : void() )
+// 0x0020: TBD
+#define debug6(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug6) ? dsyslog("IPTV6: " x) : void() )
+// 0x0040: TBD
+#define debug7(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug7) ? dsyslog("IPTV7: " x) : void() )
+// 0x0080: CURL
+#define debug8(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug8) ? dsyslog("IPTV8: " x) : void() )
+// 0x0100: TBD
+#define debug9(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug9) ? dsyslog("IPTV9: " x) : void() )
+// 0x0200: TBD
+#define debug10(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug10) ? dsyslog("IPTV10: " x) : void() )
+// 0x0400: TBD
+#define debug11(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug11) ? dsyslog("IPTV11: " x) : void() )
+// 0x0800: TBD
+#define debug12(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug12) ? dsyslog("IPTV12: " x) : void() )
+// 0x1000: TBD
+#define debug13(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug13) ? dsyslog("IPTV13: " x) : void() )
+// 0x2000: TBD
+#define debug14(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug14) ? dsyslog("IPTV14: " x) : void() )
+// 0x4000: TBD
+#define debug15(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug15) ? dsyslog("IPTV15: " x) : void() )
+// 0x8000; Extra call stack
+#define debug16(x...) void( IptvConfig.IsTraceMode(cIptvConfig::eTraceModeDebug16) ? dsyslog("IPTV16: " x) : void() )
+
+#endif // __IPTV_LOG_H
diff --git a/pidscanner.c b/pidscanner.c
index 777a63a..80af34c 100644
--- a/pidscanner.c
+++ b/pidscanner.c
@@ -22,17 +22,17 @@ cPidScanner::cPidScanner(void)
numVpidsM(0),
numApidsM(0)
{
- debug("cPidScanner::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
cPidScanner::~cPidScanner()
{
- debug("cPidScanner::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
void cPidScanner::SetChannel(const tChannelID &channelIdP)
{
- debug("cPidScanner::%s(%s)", __FUNCTION__, *channelIdP.ToString());
+ debug1("%s (%s)", __PRETTY_FUNCTION__, *channelIdP.ToString());
channelIdM = channelIdP;
vPidM = 0xFFFF;
numVpidsM = 0;
@@ -43,13 +43,13 @@ void cPidScanner::SetChannel(const tChannelID &channelIdP)
void cPidScanner::Process(const uint8_t* bufP)
{
- //debug("cPidScanner::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
if (!processM)
return;
// Stop scanning after defined timeout
if (timeoutM.TimedOut()) {
- debug("cPidScanner::%s(): timed out determining pids", __FUNCTION__);
+ debug1("%s Timed out determining pids", __PRETTY_FUNCTION__);
processM = false;
}
@@ -84,24 +84,24 @@ void cPidScanner::Process(const uint8_t* bufP)
// Stream ID
if ((sid >= 0xC0) && (sid <= 0xDF)) {
if (pid < aPidM) {
- debug("cPidScanner::%s(): found lower Apid: 0x%X instead of 0x%X", __FUNCTION__, pid, aPidM);
+ debug1("%s Found lower Apid: 0x%X instead of 0x%X", __PRETTY_FUNCTION__, pid, aPidM);
aPidM = pid;
numApidsM = 1;
}
else if (pid == aPidM) {
++numApidsM;
- debug("cPidScanner::%s(): incrementing Apids, now at %d", __FUNCTION__, numApidsM);
+ debug1("%s Incrementing Apids, now at %d", __PRETTY_FUNCTION__, numApidsM);
}
}
else if ((sid >= 0xE0) && (sid <= 0xEF)) {
if (pid < vPidM) {
- debug("cPidScanner::%s(): found lower Vpid: 0x%X instead of 0x%X", __FUNCTION__, pid, vPidM);
+ debug1("%s Found lower Vpid: 0x%X instead of 0x%X", __PRETTY_FUNCTION__, pid, vPidM);
vPidM = pid;
numVpidsM = 1;
}
else if (pid == vPidM) {
++numVpidsM;
- debug("cPidScanner::%s(): incrementing Vpids, now at %d", __FUNCTION__, numVpidsM);
+ debug1("%s Incrementing Vpids, now at %d", __PRETTY_FUNCTION__, numVpidsM);
}
}
}
@@ -146,7 +146,7 @@ void cPidScanner::Process(const uint8_t* bufP)
}
for (unsigned int i = 0; i < MAXSPIDS; ++i)
Spids[i] = IptvChannel->Spid(i);
- debug("cPidScanner::%s(): vpid=0x%04X, apid=0x%04X", __FUNCTION__, vPidM, aPidM);
+ debug1("%s vpid=0x%04X, apid=0x%04X", __PRETTY_FUNCTION__, vPidM, aPidM);
IptvChannel->SetPids(vPidM, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, Dtypes, DLangs, Spids, SLangs, Tpid);
}
Channels.Unlock();
diff --git a/pidscanner.h b/pidscanner.h
index e9125ec..9987517 100644
--- a/pidscanner.h
+++ b/pidscanner.h
@@ -11,6 +11,8 @@
#include <vdr/tools.h>
#include <vdr/channels.h>
+#include "log.h"
+
class cPidScanner {
private:
enum {
@@ -32,8 +34,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); }
+ void Open() { debug1("%s", __PRETTY_FUNCTION__); timeoutM.Set(PIDSCANNER_TIMEOUT_IN_MS); }
+ void Close() { debug1("%s", __PRETTY_FUNCTION__); timeoutM.Set(0); }
};
#endif // __PIDSCANNER_H
diff --git a/po/de_DE.po b/po/de_DE.po
index 8921b8f..3686e09 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -6,10 +6,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: vdr-iptv 2.2.0\n"
+"Project-Id-Version: vdr-iptv 2.2.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2015-02-19 02:19+0200\n"
-"PO-Revision-Date: 2015-02-19 02:19+0200\n"
+"POT-Creation-Date: 2015-04-04 04:04+0300\n"
+"PO-Revision-Date: 2015-04-04 04:04+0300\n"
"Last-Translator: Frank Neumann <fnu at yavdr.org>\n"
"Language-Team: German <vdr at linuxtv.org>\n"
"Language: de\n"
diff --git a/po/fi_FI.po b/po/fi_FI.po
index f5f510a..73090a5 100644
--- a/po/fi_FI.po
+++ b/po/fi_FI.po
@@ -5,10 +5,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: vdr-iptv 2.2.0\n"
+"Project-Id-Version: vdr-iptv 2.2.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2015-02-19 02:19+0200\n"
-"PO-Revision-Date: 2015-02-19 02:19+0200\n"
+"POT-Creation-Date: 2015-04-04 04:04+0300\n"
+"PO-Revision-Date: 2015-04-04 04:04+0300\n"
"Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish <vdr at linuxtv.org>\n"
"Language: fi\n"
diff --git a/po/fr_FR.po b/po/fr_FR.po
index 572004b..5aecacc 100644
--- a/po/fr_FR.po
+++ b/po/fr_FR.po
@@ -6,10 +6,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: vdr-iptv 2.2.0\n"
+"Project-Id-Version: vdr-iptv 2.2.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2015-02-19 02:19+0200\n"
-"PO-Revision-Date: 2015-02-19 02:19+0200\n"
+"POT-Creation-Date: 2015-04-04 04:04+0300\n"
+"PO-Revision-Date: 2015-04-04 04:04+0300\n"
"Last-Translator: NIVAL Michaƫl <mnival at club-internet.fr>\n"
"Language-Team: French <vdr at linuxtv.org>\n"
"Language: fr\n"
diff --git a/po/it_IT.po b/po/it_IT.po
index 96788f7..26f0e90 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -5,10 +5,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: vdr-iptv 2.2.0\n"
+"Project-Id-Version: vdr-iptv 2.2.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2015-02-19 02:19+0200\n"
-"PO-Revision-Date: 2015-02-19 02:19+0200\n"
+"POT-Creation-Date: 2015-04-04 04:04+0300\n"
+"PO-Revision-Date: 2015-04-04 04:04+0300\n"
"Last-Translator: Diego Pierotto <vdr-italian at tiscali.it>\n"
"Language-Team: Italian <vdr at linuxtv.org>\n"
"Language: it\n"
diff --git a/po/lt_LT.po b/po/lt_LT.po
index 9fdd234..2b0bea0 100644
--- a/po/lt_LT.po
+++ b/po/lt_LT.po
@@ -5,10 +5,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: vdr-iptv 2.2.0\n"
+"Project-Id-Version: vdr-iptv 2.2.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2015-02-19 02:19+0200\n"
-"PO-Revision-Date: 2015-02-19 02:19+0200\n"
+"POT-Creation-Date: 2015-04-04 04:04+0300\n"
+"PO-Revision-Date: 2015-04-04 04:04+0300\n"
"Last-Translator: Valdemaras Pipiras\n"
"Language-Team: Lithuanian <vdr at linuxtv.org>\n"
"Language: fi\n"
diff --git a/po/nl_NL.po b/po/nl_NL.po
index f9e9593..7689869 100644
--- a/po/nl_NL.po
+++ b/po/nl_NL.po
@@ -5,10 +5,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: vdr-iptv 2.2.0\n"
+"Project-Id-Version: vdr-iptv 2.2.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2015-02-19 02:19+0200\n"
-"PO-Revision-Date: 2015-02-19 02:19+0200\n"
+"POT-Creation-Date: 2015-04-04 04:04+0300\n"
+"PO-Revision-Date: 2015-04-04 04:04+0300\n"
"Last-Translator: Carel\n"
"Language-Team: Dutch <vdr at linuxtv.org>\n"
"Language: nl\n"
diff --git a/po/ru_RU.po b/po/ru_RU.po
index 086040c..4afba74 100644
--- a/po/ru_RU.po
+++ b/po/ru_RU.po
@@ -5,10 +5,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: vdr-iptv 2.2.0\n"
+"Project-Id-Version: vdr-iptv 2.2.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2015-02-19 02:19+0200\n"
-"PO-Revision-Date: 2015-02-19 02:19+0200\n"
+"POT-Creation-Date: 2015-04-04 04:04+0300\n"
+"PO-Revision-Date: 2015-04-04 04:04+0300\n"
"Last-Translator: Alexander Gross <Bikalexander at gmail.com>\n"
"Language-Team: Russian <vdr at linuxtv.org>\n"
"Language: ru\n"
diff --git a/protocolcurl.c b/protocolcurl.c
index fc42429..d286218 100644
--- a/protocolcurl.c
+++ b/protocolcurl.c
@@ -7,6 +7,7 @@
#include "common.h"
#include "config.h"
+#include "log.h"
#include "protocolcurl.h"
#ifdef CURLOPT_RTSPHEADER
@@ -38,7 +39,7 @@ cIptvProtocolCurl::cIptvProtocolCurl()
connectedM(false),
pausedM(false)
{
- debug("cIptvProtocolCurl::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
if (ringBufferM) {
ringBufferM->SetTimeouts(100, 0);
ringBufferM->SetIoThrottle();
@@ -48,17 +49,46 @@ cIptvProtocolCurl::cIptvProtocolCurl()
cIptvProtocolCurl::~cIptvProtocolCurl()
{
- debug("cIptvProtocolCurl::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
Disconnect();
// Free allocated memory
DELETE_POINTER(ringBufferM);
}
+int cIptvProtocolCurl::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, size_t sizeP, void *userPtrP)
+{
+ cIptvProtocolCurl *obj = reinterpret_cast<cIptvProtocolCurl *>(dataP);
+
+ if (obj) {
+ switch (typeP) {
+ case CURLINFO_TEXT:
+ debug8("%s INFO %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
+ break;
+ case CURLINFO_HEADER_IN:
+ debug8("%s HEAD <<< %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
+ break;
+ case CURLINFO_HEADER_OUT:
+ debug8("%s HEAD >>>\n%.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
+ break;
+ case CURLINFO_DATA_IN:
+ debug8("%s DATA <<< %zu", __PRETTY_FUNCTION__, sizeP);
+ break;
+ case CURLINFO_DATA_OUT:
+ debug8("%s DATA >>> %zu", __PRETTY_FUNCTION__, sizeP);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return 0;
+}
+
size_t cIptvProtocolCurl::WriteCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP)
{
cIptvProtocolCurl *obj = reinterpret_cast<cIptvProtocolCurl *>(dataP);
size_t len = sizeP * nmembP;
- //debug("cIptvProtocolCurl::%s(%zu)", __FUNCTION__, len);
+ debug16("%s (, %zu, %zu, ) len=%zu", __PRETTY_FUNCTION__, sizeP, nmembP, len);
if (obj && !obj->PutData((unsigned char *)ptrP, (int)len))
return CURL_WRITEFUNC_PAUSE;
@@ -71,7 +101,7 @@ size_t cIptvProtocolCurl::WriteRtspCallback(void *ptrP, size_t sizeP, size_t nme
cIptvProtocolCurl *obj = reinterpret_cast<cIptvProtocolCurl *>(dataP);
size_t len = sizeP * nmembP;
unsigned char *p = (unsigned char *)ptrP;
- //debug("cIptvProtocolCurl::%s(%zu)", __FUNCTION__, len);
+ debug16("%s (, %zu, %zu, ) len=%zu", __PRETTY_FUNCTION__, sizeP, nmembP, len);
// Validate packet header ('$') and channel (0)
if (obj && (p[0] == 0x24) && (p[1] == 0)) {
@@ -113,7 +143,7 @@ size_t cIptvProtocolCurl::DescribeCallback(void *ptrP, size_t sizeP, size_t nmem
{
cIptvProtocolCurl *obj = reinterpret_cast<cIptvProtocolCurl *>(dataP);
size_t len = sizeP * nmembP;
- //debug("cIptvProtocolCurl::%s(%zu)", __FUNCTION__, len);
+ debug16("%s (, %zu, %zu, ) len=%zu", __PRETTY_FUNCTION__, sizeP, nmembP, len);
bool found = false;
cString control = "";
@@ -121,7 +151,7 @@ size_t cIptvProtocolCurl::DescribeCallback(void *ptrP, size_t sizeP, size_t nmem
char *r = strtok(p, "\r\n");
while (r) {
- //debug("cIptvProtocolCurl::%s(%zu): %s", __FUNCTION__, len, r);
+ debug16("%s (, %zu, %zu, ) len=%zu r=%s", __PRETTY_FUNCTION__, sizeP, nmembP, len, r);
// Look for a media name: "video"
if (strstr(r, "m=video")) {
found = true;
@@ -147,13 +177,13 @@ size_t cIptvProtocolCurl::HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP
{
//cIptvProtocolCurl *obj = reinterpret_cast<cIptvProtocolCurl *>(dataP);
size_t len = sizeP * nmembP;
- //debug("cIptvProtocolCurl::%s(%zu)", __FUNCTION__, len);
+ debug16("%s (, %zu, %zu, ) len=%zu", __PRETTY_FUNCTION__, sizeP, nmembP, len);
char *p = (char *)ptrP;
char *r = strtok(p, "\r\n");
while (r) {
- //debug("cIptvProtocolCurl::%s(%zu): %s", __FUNCTION__, len, r);
+ debug16("%s (, %zu, %zu, ) len=%zu r=%s", __PRETTY_FUNCTION__, sizeP, nmembP, len, r);
r = strtok(NULL, "\r\n");
}
@@ -163,7 +193,7 @@ 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);
+ debug16("%s (%s)", __PRETTY_FUNCTION__, controlP);
cString protocol = ChangeCase(controlP, false).Truncate(7);
if (startswith(*protocol, "rtsp://")) {
streamUrlM = controlP;
@@ -176,13 +206,13 @@ void cIptvProtocolCurl::SetRtspControl(const char *controlP)
bool cIptvProtocolCurl::PutData(unsigned char *dataP, int lenP)
{
cMutexLock MutexLock(&mutexM);
- //debug("cIptvProtocolCurl::%s(%d)", __FUNCTION__, lenP);
+ debug16("%s (, %d)", __PRETTY_FUNCTION__, lenP);
if (pausedM)
return false;
if (ringBufferM && (lenP >= 0)) {
// Should we pause the transfer ?
if (ringBufferM->Free() < (2 * CURL_MAX_WRITE_SIZE)) {
- debug("cIptvProtocolCurl::%s(pause): free=%d available=%d len=%d", __FUNCTION__,
+ debug1("%s Pause free=%d available=%d len=%d", __PRETTY_FUNCTION__,
ringBufferM->Free(), ringBufferM->Available(), lenP);
pausedM = true;
return false;
@@ -198,14 +228,14 @@ bool cIptvProtocolCurl::PutData(unsigned char *dataP, int lenP)
void cIptvProtocolCurl::DelData(int lenP)
{
cMutexLock MutexLock(&mutexM);
- //debug("cIptvProtocolCurl::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
if (ringBufferM && (lenP >= 0))
ringBufferM->Del(lenP);
}
void cIptvProtocolCurl::ClearData()
{
- //debug("cIptvProtocolCurl::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
if (ringBufferM)
ringBufferM->Clear();
}
@@ -213,7 +243,7 @@ void cIptvProtocolCurl::ClearData()
unsigned char *cIptvProtocolCurl::GetData(int &lenP)
{
cMutexLock MutexLock(&mutexM);
- //debug("cIptvProtocolCurl::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
unsigned char *p = NULL;
lenP = 0;
if (ringBufferM) {
@@ -245,7 +275,7 @@ unsigned char *cIptvProtocolCurl::GetData(int &lenP)
bool cIptvProtocolCurl::Connect()
{
cMutexLock MutexLock(&mutexM);
- debug("cIptvProtocolCurl::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
if (connectedM)
return true;
@@ -257,10 +287,10 @@ bool cIptvProtocolCurl::Connect()
CURLcode res = CURLE_OK;
cString netrc = cString::sprintf("%s/netrc", IptvConfig.GetConfigDirectory());
-#ifdef DEBUG
// Verbose output
iptv_curl_easy_setopt(handleM, CURLOPT_VERBOSE, 1L);
-#endif
+ iptv_curl_easy_setopt(handleM, CURLOPT_DEBUGFUNCTION, cIptvProtocolCurl::DebugCallback);
+ iptv_curl_easy_setopt(handleM, CURLOPT_DEBUGDATA, this);
// Set callbacks
iptv_curl_easy_setopt(handleM, CURLOPT_WRITEFUNCTION, cIptvProtocolCurl::WriteCallback);
@@ -277,8 +307,9 @@ bool cIptvProtocolCurl::Connect()
iptv_curl_easy_setopt(handleM, CURLOPT_NETRC_FILE, *netrc);
// Set timeouts
- iptv_curl_easy_setopt(handleM, CURLOPT_TIMEOUT, (long)eConnectTimeoutS);
iptv_curl_easy_setopt(handleM, CURLOPT_CONNECTTIMEOUT, (long)eConnectTimeoutS);
+ iptv_curl_easy_setopt(handleM, CURLOPT_LOW_SPEED_LIMIT, (long)eLowSpeedLimitBytes);
+ iptv_curl_easy_setopt(handleM, CURLOPT_LOW_SPEED_TIME, (long)eLowSpeedTimeoutS);
// Set user-agent
iptv_curl_easy_setopt(handleM, CURLOPT_USERAGENT, *cString::sprintf("vdr-%s/%s", PLUGIN_NAME_I18N, VERSION));
@@ -407,7 +438,7 @@ bool cIptvProtocolCurl::Connect()
bool cIptvProtocolCurl::Disconnect()
{
cMutexLock MutexLock(&mutexM);
- debug("cIptvProtocolCurl::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
if (!connectedM)
return true;
@@ -462,20 +493,20 @@ bool cIptvProtocolCurl::Disconnect()
bool cIptvProtocolCurl::Open(void)
{
- debug("cIptvProtocolCurl::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
return Connect();
}
bool cIptvProtocolCurl::Close(void)
{
- debug("cIptvProtocolCurl::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
Disconnect();
return true;
}
int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
{
- //debug("cIptvProtocolCurl::%s()", __FUNCTION__);
+ debug16("%s (, %u)", __PRETTY_FUNCTION__, bufferLenP);
int len = 0;
if (ringBufferM) {
// Fill up the buffer
@@ -489,7 +520,7 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
// Remember the heart beat
if (timeoutM.TimedOut()) {
- debug("cIptvProtocolCurl::%s(): KeepAlive", __FUNCTION__);
+ debug1("%s KeepAlive", __PRETTY_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);
@@ -522,8 +553,8 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
// Use 20% threshold before continuing to filling up the buffer.
mutexM.Lock();
if (pausedM && (ringBufferM->Available() < (IPTV_BUFFER_SIZE / 5))) {
- debug("cIptvProtocolCurl::%s(continue): free=%d available=%d", __FUNCTION__,
- ringBufferM->Free(), ringBufferM->Available());
+ debug1("%s Continue free=%d available=%d", __PRETTY_FUNCTION__,
+ ringBufferM->Free(), ringBufferM->Available());
pausedM = false;
curl_easy_pause(handleM, CURLPAUSE_CONT);
}
@@ -536,8 +567,8 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
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);
+ debug1("%s Done %s (%d)", __PRETTY_FUNCTION__,
+ curl_easy_strerror(msg->data.result), msg->data.result);
Disconnect();
Connect();
}
@@ -557,7 +588,7 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
len = min(len, (int)bufferLenP);
memcpy(bufferAddrP, p, len);
DelData(len);
- //debug("cIptvProtocolCurl::%s(): get %d bytes", __FUNCTION__, len);
+ debug16("%s Get %d bytes", __PRETTY_FUNCTION__, len);
}
}
@@ -566,7 +597,7 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
bool cIptvProtocolCurl::SetSource(const char* locationP, const int parameterP, const int indexP)
{
- debug("cIptvProtocolCurl::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
+ debug1("%s (%s, %d, %d)", __PRETTY_FUNCTION__, locationP, parameterP, indexP);
if (!isempty(locationP)) {
// Disconnect
Disconnect();
@@ -583,7 +614,7 @@ bool cIptvProtocolCurl::SetSource(const char* locationP, const int parameterP, c
modeM = eModeFile;
else
modeM = eModeUnknown;
- debug("cIptvProtocolCurl::%s(): %s (%d)", __FUNCTION__, *protocol, modeM);
+ debug1("%s (%s, %d, %d) protocol=%s mode=%d", __PRETTY_FUNCTION__, locationP, parameterP, indexP, *protocol, modeM);
// Update stream parameter - force UDP mode for RTSP
streamParamM = (modeM == eModeRtsp) ? 0 : parameterP;
// Update listen port
@@ -596,12 +627,12 @@ bool cIptvProtocolCurl::SetSource(const char* locationP, const int parameterP, c
bool cIptvProtocolCurl::SetPid(int pidP, int typeP, bool onP)
{
- //debug("cIptvProtocolCurl::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
+ debug16("%s (%d, %d, %d)", __PRETTY_FUNCTION__, pidP, typeP, onP);
return true;
}
cString cIptvProtocolCurl::GetInformation(void)
{
- //debug("cIptvProtocolCurl::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
return cString::sprintf("%s [%d]", *streamUrlM, streamParamM);
}
diff --git a/protocolcurl.h b/protocolcurl.h
index a5a0cc4..888fb87 100644
--- a/protocolcurl.h
+++ b/protocolcurl.h
@@ -30,10 +30,13 @@ private:
};
enum {
eConnectTimeoutS = 5, // in seconds
+ eLowSpeedTimeoutS = 3, // in seconds
+ eLowSpeedLimitBytes = 100, // in bytes per second
eMaxDownloadSpeedMBits = 20, // in megabits per second
eKeepAliveIntervalMs = 300000 // in milliseconds
};
+ static int DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, size_t sizeP, void *userPtrP);
static size_t WriteCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);
static size_t WriteRtspCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);
static size_t DescribeCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);
diff --git a/protocolext.c b/protocolext.c
index 59d69d3..fcf757c 100644
--- a/protocolext.c
+++ b/protocolext.c
@@ -17,6 +17,7 @@
#include "common.h"
#include "config.h"
+#include "log.h"
#include "protocolext.h"
#ifndef EXTSHELL
@@ -29,19 +30,19 @@ cIptvProtocolExt::cIptvProtocolExt()
scriptParameterM(0),
streamPortM(0)
{
- debug("cIptvProtocolExt::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
cIptvProtocolExt::~cIptvProtocolExt()
{
- debug("cIptvProtocolExt::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Drop the socket connection
cIptvProtocolExt::Close();
}
void cIptvProtocolExt::ExecuteScript(void)
{
- debug("cIptvProtocolExt::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Check if already executing
if (isActiveM || isempty(scriptFileM))
return;
@@ -59,7 +60,7 @@ void cIptvProtocolExt::ExecuteScript(void)
close(i);
// Execute the external script
cString cmd = cString::sprintf("%s %d %d", *scriptFileM, scriptParameterM, streamPortM);
- debug("cIptvProtocolExt::%s(child): %s", __FUNCTION__, *cmd);
+ debug1("%s Child %s", __PRETTY_FUNCTION__, *cmd);
// Create a new session for a process group
ERROR_IF_RET(setsid() == -1, "setsid()", _exit(-1));
if (execl(EXTSHELL, "sh", "-c", *cmd, (char *)NULL) == -1) {
@@ -69,13 +70,13 @@ void cIptvProtocolExt::ExecuteScript(void)
_exit(0);
}
else {
- debug("cIptvProtocolExt::%s(): pid=%d", __FUNCTION__, pidM);
+ debug1("%s pid=%d", __PRETTY_FUNCTION__, pidM);
}
}
void cIptvProtocolExt::TerminateScript(void)
{
- debug("cIptvProtocolExt::%s(): pid=%d", __FUNCTION__, pidM);
+ debug1("%s pid=%d", __PRETTY_FUNCTION__, pidM);
if (!isActiveM || isempty(scriptFileM))
return;
if (pidM > 0) {
@@ -111,7 +112,7 @@ void cIptvProtocolExt::TerminateScript(void)
if (!retval && waitStatus.si_pid && (waitStatus.si_pid == pidM) &&
((waitStatus.si_code == CLD_EXITED) || (waitStatus.si_code == CLD_KILLED))) {
#endif // __FreeBSD__
- debug("cIptvProtocolExt::%s(): child (%d) exited as expected", __FUNCTION__, pidM);
+ debug1("%s Child (%d) exited as expected", __PRETTY_FUNCTION__, pidM);
waitOver = true;
}
// Unsuccessful wait, avoid busy looping
@@ -124,7 +125,7 @@ void cIptvProtocolExt::TerminateScript(void)
bool cIptvProtocolExt::Open(void)
{
- debug("cIptvProtocolExt::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Reject empty script files
if (!strlen(*scriptFileM))
return false;
@@ -138,7 +139,7 @@ bool cIptvProtocolExt::Open(void)
bool cIptvProtocolExt::Close(void)
{
- debug("cIptvProtocolExt::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Terminate the external script
TerminateScript();
isActiveM = false;
@@ -154,7 +155,7 @@ int cIptvProtocolExt::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
bool cIptvProtocolExt::SetSource(const char* locationP, const int parameterP, const int indexP)
{
- debug("cIptvProtocolExt::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
+ debug1("%s (%s, %d, %d)", __PRETTY_FUNCTION__, locationP, parameterP, indexP);
if (!isempty(locationP)) {
struct stat stbuf;
// Update script file and parameter
@@ -172,12 +173,12 @@ bool cIptvProtocolExt::SetSource(const char* locationP, const int parameterP, co
bool cIptvProtocolExt::SetPid(int pidP, int typeP, bool onP)
{
- //debug("cIptvProtocolExt::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
+ debug16("%s (%d, %d, %d)", __PRETTY_FUNCTION__, pidP, typeP, onP);
return true;
}
cString cIptvProtocolExt::GetInformation(void)
{
- //debug("cIptvProtocolExt::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
return cString::sprintf("ext://%s:%d", *scriptFileM, scriptParameterM);
}
diff --git a/protocolfile.c b/protocolfile.c
index 51cd746..de9d132 100644
--- a/protocolfile.c
+++ b/protocolfile.c
@@ -12,6 +12,7 @@
#include "common.h"
#include "config.h"
+#include "log.h"
#include "protocolfile.h"
cIptvProtocolFile::cIptvProtocolFile()
@@ -20,12 +21,12 @@ cIptvProtocolFile::cIptvProtocolFile()
fileStreamM(NULL),
isActiveM(false)
{
- debug("cIptvProtocolFile::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
cIptvProtocolFile::~cIptvProtocolFile()
{
- debug("cIptvProtocolFile::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Drop open handles
cIptvProtocolFile::Close();
// Free allocated memory
@@ -34,7 +35,7 @@ cIptvProtocolFile::~cIptvProtocolFile()
bool cIptvProtocolFile::OpenFile(void)
{
- debug("cIptvProtocolFile::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Check that stream address is valid
if (!isActiveM && !isempty(fileLocationM)) {
fileStreamM = fopen(fileLocationM, "rb");
@@ -47,7 +48,7 @@ bool cIptvProtocolFile::OpenFile(void)
void cIptvProtocolFile::CloseFile(void)
{
- debug("cIptvProtocolFile::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Check that file stream is valid
if (isActiveM && !isempty(fileLocationM)) {
fclose(fileStreamM);
@@ -58,10 +59,10 @@ void cIptvProtocolFile::CloseFile(void)
int cIptvProtocolFile::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
{
- //debug("cIptvProtocolFile::%s()", __FUNCTION__);
+ debug16("%s (, %u)", __PRETTY_FUNCTION__, bufferLenP);
// Check errors
if (!fileStreamM || ferror(fileStreamM)) {
- debug("cIptvProtocolFile::%s(): stream error", __FUNCTION__);
+ debug1("%s (, %d) Stream error", __PRETTY_FUNCTION__, bufferLenP);
return -1;
}
// Rewind if EOF
@@ -81,7 +82,7 @@ int cIptvProtocolFile::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
bool cIptvProtocolFile::Open(void)
{
- debug("cIptvProtocolFile::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Open the file stream
OpenFile();
return true;
@@ -89,7 +90,7 @@ bool cIptvProtocolFile::Open(void)
bool cIptvProtocolFile::Close(void)
{
- debug("cIptvProtocolFile::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Close the file stream
CloseFile();
return true;
@@ -97,7 +98,7 @@ bool cIptvProtocolFile::Close(void)
bool cIptvProtocolFile::SetSource(const char* locationP, const int parameterP, const int indexP)
{
- debug("cIptvProtocolFile::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
+ debug1("%s (%s, %d, %d)", __PRETTY_FUNCTION__, locationP, parameterP, indexP);
if (!isempty(locationP)) {
// Close the file stream
CloseFile();
@@ -112,12 +113,12 @@ bool cIptvProtocolFile::SetSource(const char* locationP, const int parameterP, c
bool cIptvProtocolFile::SetPid(int pidP, int typeP, bool onP)
{
- //debug("cIptvProtocolFile::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
+ debug16("%s (%d, %d, %d)", __PRETTY_FUNCTION__, pidP, typeP, onP);
return true;
}
cString cIptvProtocolFile::GetInformation(void)
{
- //debug("cIptvProtocolFile::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
return cString::sprintf("file://%s:%d", fileLocationM, fileDelayM);
}
diff --git a/protocolhttp.c b/protocolhttp.c
index 3d933aa..9e2f679 100644
--- a/protocolhttp.c
+++ b/protocolhttp.c
@@ -16,6 +16,7 @@
#include "common.h"
#include "config.h"
+#include "log.h"
#include "protocolhttp.h"
cIptvProtocolHttp::cIptvProtocolHttp()
@@ -23,12 +24,12 @@ cIptvProtocolHttp::cIptvProtocolHttp()
streamPathM(strdup("/")),
streamPortM(0)
{
- debug("cIptvProtocolHttp::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
cIptvProtocolHttp::~cIptvProtocolHttp()
{
- debug("cIptvProtocolHttp::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Close the socket
cIptvProtocolHttp::Close();
// Free allocated memory
@@ -38,7 +39,7 @@ cIptvProtocolHttp::~cIptvProtocolHttp()
bool cIptvProtocolHttp::Connect(void)
{
- debug("cIptvProtocolHttp::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Check that stream address is valid
if (!isActiveM && !isempty(streamAddrM) && !isempty(streamPathM)) {
// Ensure that socket is valid and connect
@@ -56,7 +57,7 @@ bool cIptvProtocolHttp::Connect(void)
"\r\n", streamPathM, streamAddrM,
PLUGIN_NAME_I18N, VERSION);
unsigned int len = strlen(*buffer);
- debug("cIptvProtocolHttp::%s(): requesting %d: %s", __FUNCTION__, len, *buffer);
+ debug1("%s Requesting %d: %s", __PRETTY_FUNCTION__, len, *buffer);
if (!Write(*buffer, len)) {
CloseSocket();
return false;
@@ -74,7 +75,7 @@ bool cIptvProtocolHttp::Connect(void)
bool cIptvProtocolHttp::Disconnect(void)
{
- debug("cIptvProtocolHttp::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
if (isActiveM) {
// Close the socket
CloseSocket();
@@ -87,7 +88,7 @@ bool cIptvProtocolHttp::Disconnect(void)
bool cIptvProtocolHttp::GetHeaderLine(char* destP, unsigned int destLenP,
unsigned int &recvLenP)
{
- debug("cIptvProtocolHttp::%s()", __FUNCTION__);
+ debug1("%s (, %u, )", __PRETTY_FUNCTION__, destLenP);
bool linefeed = false;
bool newline = false;
char *bufptr = destP;
@@ -128,7 +129,7 @@ bool cIptvProtocolHttp::GetHeaderLine(char* destP, unsigned int destLenP,
bool cIptvProtocolHttp::ProcessHeaders(void)
{
- debug("cIptvProtocolHttp::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
unsigned int lineLength = 0;
int version = 0, response = 0;
bool responseFound = false;
@@ -159,14 +160,14 @@ bool cIptvProtocolHttp::ProcessHeaders(void)
bool cIptvProtocolHttp::Open(void)
{
- debug("cIptvProtocolHttp::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Connect the socket
return Connect();
}
bool cIptvProtocolHttp::Close(void)
{
- debug("cIptvProtocolHttp::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Disconnect the current stream
Disconnect();
return true;
@@ -179,7 +180,7 @@ int cIptvProtocolHttp::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
bool cIptvProtocolHttp::SetSource(const char* locationP, const int parameterP, const int indexP)
{
- debug("cIptvProtocolHttp::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
+ debug1("%s (%s, %d, %d)", __PRETTY_FUNCTION__, locationP, parameterP, indexP);
if (!isempty(locationP)) {
// Disconnect the current socket
Disconnect();
@@ -201,12 +202,12 @@ bool cIptvProtocolHttp::SetSource(const char* locationP, const int parameterP, c
bool cIptvProtocolHttp::SetPid(int pidP, int typeP, bool onP)
{
- //debug("cIptvProtocolHttp::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
+ debug16("%s (%d, %d, %d)", __PRETTY_FUNCTION__, pidP, typeP, onP);
return true;
}
cString cIptvProtocolHttp::GetInformation(void)
{
- //debug("cIptvProtocolHttp::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
return cString::sprintf("http://%s:%d%s", streamAddrM, streamPortM, streamPathM);
}
diff --git a/protocoludp.c b/protocoludp.c
index a83845e..9767f10 100644
--- a/protocoludp.c
+++ b/protocoludp.c
@@ -15,8 +15,9 @@
#include "common.h"
#include "config.h"
-#include "protocoludp.h"
+#include "log.h"
#include "socket.h"
+#include "protocoludp.h"
cIptvProtocolUdp::cIptvProtocolUdp()
: isIGMPv3M(false),
@@ -24,12 +25,12 @@ cIptvProtocolUdp::cIptvProtocolUdp()
streamAddrM(strdup("")),
streamPortM(0)
{
- debug("cIptvProtocolUdp::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
cIptvProtocolUdp::~cIptvProtocolUdp()
{
- debug("cIptvProtocolUdp::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Drop the multicast group and close the socket
cIptvProtocolUdp::Close();
// Free allocated memory
@@ -39,7 +40,7 @@ cIptvProtocolUdp::~cIptvProtocolUdp()
bool cIptvProtocolUdp::Open(void)
{
- debug("cIptvProtocolUdp::%s(%s)", __FUNCTION__, streamAddrM);
+ debug1("%s streamAddr='%s'", __PRETTY_FUNCTION__, streamAddrM);
OpenSocket(streamPortM, streamAddrM, sourceAddrM, isIGMPv3M);
if (!isempty(streamAddrM)) {
// Join a new multicast group
@@ -50,7 +51,7 @@ bool cIptvProtocolUdp::Open(void)
bool cIptvProtocolUdp::Close(void)
{
- debug("cIptvProtocolUdp::%s(%s)", __FUNCTION__, streamAddrM);
+ debug1("%s streamAddr='%s'", __PRETTY_FUNCTION__, streamAddrM);
if (!isempty(streamAddrM)) {
// Drop the multicast group
OpenSocket(streamPortM, streamAddrM, sourceAddrM, isIGMPv3M);
@@ -72,7 +73,7 @@ int cIptvProtocolUdp::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
bool cIptvProtocolUdp::SetSource(const char* locationP, const int parameterP, const int indexP)
{
- debug("cIptvProtocolUdp::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
+ debug1("%s (%s, %d, %d)", __PRETTY_FUNCTION__, locationP, parameterP, indexP);
if (!isempty(locationP)) {
// Drop the multicast group
if (!isempty(streamAddrM)) {
@@ -105,13 +106,13 @@ bool cIptvProtocolUdp::SetSource(const char* locationP, const int parameterP, co
bool cIptvProtocolUdp::SetPid(int pidP, int typeP, bool onP)
{
- //debug("cIptvProtocolUdp::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
+ debug16("%s (%d, %d, %d)", __PRETTY_FUNCTION__, pidP, typeP, onP);
return true;
}
cString cIptvProtocolUdp::GetInformation(void)
{
- //debug("cIptvProtocolUdp::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
if (isIGMPv3M)
return cString::sprintf("udp://%s@%s:%d", sourceAddrM, streamAddrM, streamPortM);
return cString::sprintf("udp://%s:%d", streamAddrM, streamPortM);
diff --git a/sectionfilter.c b/sectionfilter.c
index 98a0fdf..49b7bcd 100644
--- a/sectionfilter.c
+++ b/sectionfilter.c
@@ -6,6 +6,7 @@
*/
#include "config.h"
+#include "log.h"
#include "sectionfilter.h"
cIptvSectionFilter::cIptvSectionFilter(int deviceIndexP, uint16_t pidP, uint8_t tidP, uint8_t maskP)
@@ -20,7 +21,7 @@ cIptvSectionFilter::cIptvSectionFilter(int deviceIndexP, uint16_t pidP, uint8_t
ringBufferM(new cRingBufferFrame(eDmxMaxSectionCount * eDmxMaxSectionSize)),
deviceIndexM(deviceIndexP)
{
- //debug("cIptvSectionFilter::%s(%d, %d)", __FUNCTION__, deviceIndexM, pidM);
+ debug16("%s (%d, %d)", __PRETTY_FUNCTION__, deviceIndexM, pidM);
int i;
memset(secBufBaseM, 0, sizeof(secBufBaseM));
@@ -61,7 +62,7 @@ cIptvSectionFilter::cIptvSectionFilter(int deviceIndexP, uint16_t pidP, uint8_t
cIptvSectionFilter::~cIptvSectionFilter()
{
- //debug("cIptvSectionFilter::%s(%d, %d)", __FUNCTION__, deviceIndexM, pidM);
+ debug16("%s (%d, %d)", __PRETTY_FUNCTION__, deviceIndexM, pidM);
int tmp = socketM[1];
socketM[1] = -1;
if (tmp >= 0)
@@ -236,7 +237,7 @@ cIptvSectionFilterHandler::cIptvSectionFilterHandler(int deviceIndexP, unsigned
mutexM(),
deviceIndexM(deviceIndexP)
{
- debug("cIptvSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug1("%s (%d, %d) [device %d]", __PRETTY_FUNCTION__, deviceIndexP, bufferLenP, deviceIndexM);
// Initialize filter pointers
memset(filtersM, 0, sizeof(filtersM));
@@ -254,7 +255,7 @@ cIptvSectionFilterHandler::cIptvSectionFilterHandler(int deviceIndexP, unsigned
cIptvSectionFilterHandler::~cIptvSectionFilterHandler()
{
- debug("cIptvSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
// Stop thread
if (Running())
Cancel(3);
@@ -268,7 +269,7 @@ cIptvSectionFilterHandler::~cIptvSectionFilterHandler()
void cIptvSectionFilterHandler::Action(void)
{
- debug("cIptvSectionFilterHandler::%s(%d): entering", __FUNCTION__, deviceIndexM);
+ debug1("%s Entering [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
bool processed = false;
// Do the thread loop
while (Running()) {
@@ -299,7 +300,7 @@ void cIptvSectionFilterHandler::Action(void)
}
}
ringBufferM->Del(len);
- debug("cIptvSectionFilterHandler::%s(%d): Skipped %d bytes to sync on TS packet", __FUNCTION__, deviceIndexM, len);
+ debug1("%s Skipped %d bytes to sync on TS packet [device %d]]", __PRETTY_FUNCTION__, len, deviceIndexM);
continue;
}
// Process TS packet through all filters
@@ -315,12 +316,12 @@ void cIptvSectionFilterHandler::Action(void)
}
cCondWait::SleepMs(10); // to avoid busy loop and reduce cpu load
}
- debug("cIptvSectionFilterHandler::%s(%d): exiting", __FUNCTION__, deviceIndexM);
+ debug1("%s Exiting [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
}
cString cIptvSectionFilterHandler::GetInformation(void)
{
- //debug("cIptvSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM);
+ debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
// loop through active section filters
cMutexLock MutexLock(&mutexM);
cString s = "";
@@ -339,9 +340,9 @@ cString cIptvSectionFilterHandler::GetInformation(void)
bool cIptvSectionFilterHandler::Delete(unsigned int indexP)
{
- //debug("cIptvSectionFilterHandler::%s(%d): index=%d", __FUNCTION__, deviceIndexM, indexP);
+ debug16("%s (%d) [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM);
if ((indexP < eMaxSecFilterCount) && filtersM[indexP]) {
- //debug("cIptvSectionFilterHandler::%s(%d): found %d", __FUNCTION__, deviceIndexM, indexP);
+ debug16("%s (%d) Found [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM);
cIptvSectionFilter *tmp = filtersM[indexP];
filtersM[indexP] = NULL;
delete tmp;
@@ -352,7 +353,7 @@ bool cIptvSectionFilterHandler::Delete(unsigned int indexP)
bool cIptvSectionFilterHandler::IsBlackListed(u_short pidP, u_char tidP, u_char maskP) const
{
- //debug("cIptvSectionFilterHandler::%s(%d): pid=%d tid=%02X mask=%02X", __FUNCTION__, deviceIndexM, pidP, tidP, maskP);
+ debug16("%s (%d, %02X, %02X) [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, deviceIndexM);
// loop through section filter table
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) {
int index = IptvConfig.GetDisabledFilters(i);
@@ -360,7 +361,7 @@ bool cIptvSectionFilterHandler::IsBlackListed(u_short pidP, u_char tidP, u_char
if ((index >= 0) && (index < SECTION_FILTER_TABLE_SIZE) &&
(section_filter_table[index].pid == pidP) && (section_filter_table[index].tid == tidP) &&
(section_filter_table[index].mask == maskP)) {
- //debug("cIptvSectionFilterHandler::%s(%d): found %s", __FUNCTION__, deviceIndexM, section_filter_table[index].description);
+ debug16("%s (%d, %02X, %02X) Found %s [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, section_filter_table[index].description, deviceIndexM);
return true;
}
}
@@ -378,7 +379,7 @@ int cIptvSectionFilterHandler::Open(u_short pidP, u_char tidP, u_char maskP)
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (!filtersM[i]) {
filtersM[i] = new cIptvSectionFilter(deviceIndexM, pidP, tidP, maskP);
- //debug("cIptvSectionFilterHandler::%s(%d): pid=%d tid=%02X mask=%02X handle=%d index=%u", __FUNCTION__, deviceIndexM, pidP, tidP, maskP, filtersM[i]->GetFd(), i);
+ debug16("%s (%d, %02X, %02X) handle=%d index=%u [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, filtersM[i]->GetFd(), i, deviceIndexM);
return filtersM[i]->GetFd();
}
}
@@ -393,7 +394,7 @@ void cIptvSectionFilterHandler::Close(int handleP)
// Search the filter for deletion
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);
+ debug1("%s (%d) pid=%d handle=%d index=%d [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), filtersM[i]->GetFd(), i, deviceIndexM);
Delete(i);
break;
}
@@ -407,7 +408,7 @@ int cIptvSectionFilterHandler::GetPid(int handleP)
// 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);
+ debug1("%s (%d) pid=%d handle=%d index=%d [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), filtersM[i]->GetFd(), i, deviceIndexM);
return filtersM[i]->GetPid();
}
}
@@ -416,7 +417,7 @@ int cIptvSectionFilterHandler::GetPid(int handleP)
void cIptvSectionFilterHandler::Write(uchar *bufferP, int lengthP)
{
- //debug("cIptvSectionFilterHandler::%s(%d): length=%d", __FUNCTION__, deviceIndexM, lengthP);
+ debug16("%s (, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIndexM);
// Fill up the buffer
if (ringBufferM) {
int len = ringBufferM->Put(bufferP, lengthP);
diff --git a/setup.c b/setup.c
index 1fd35e5..9fb2547 100644
--- a/setup.c
+++ b/setup.c
@@ -112,7 +112,7 @@ eOSState cIptvMenuInfo::ProcessKey(eKeys keyP)
cIptvPluginSetup::cIptvPluginSetup()
{
- debug("cIptvPluginSetup::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
protocolBasePortM = IptvConfig.GetProtocolBasePort();
sectionFilteringM = IptvConfig.GetSectionFiltering();
numDisabledFiltersM = IptvConfig.GetDisabledFiltersCount();
@@ -156,7 +156,7 @@ void cIptvPluginSetup::Setup(void)
eOSState cIptvPluginSetup::ShowInfo(void)
{
- debug("cIptvPluginSetup::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
if (HasSubMenu())
return osContinue;
return AddSubMenu(new cIptvMenuInfo());
@@ -201,7 +201,7 @@ void cIptvPluginSetup::StoreFilters(const char *nameP, int *valuesP)
q += strlen(s);
}
*q = 0;
- debug("cIptvPluginSetup::%s(%s, %s)", __FUNCTION__, nameP, buffer);
+ debug1("%s (%s, %s)", __PRETTY_FUNCTION__, nameP, buffer);
SetupStore(nameP, buffer);
}
diff --git a/sidscanner.c b/sidscanner.c
index fc626ea..098d51d 100644
--- a/sidscanner.c
+++ b/sidscanner.c
@@ -17,19 +17,19 @@ cSidScanner::cSidScanner(void)
tidFoundM(false),
isActiveM(false)
{
- debug("cSidScanner::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
Set(0x00, 0x00); // PAT
Set(0x10, 0x40); // NIT
}
cSidScanner::~cSidScanner()
{
- debug("cSidScanner::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
void cSidScanner::SetChannel(const tChannelID &channelIdP)
{
- debug("cSidScanner::%s(%s)", __FUNCTION__, *channelIdP.ToString());
+ debug1("%s (%s)", __PRETTY_FUNCTION__, *channelIdP.ToString());
channelIdM = channelIdP;
sidFoundM = false;
nidFoundM = false;
@@ -40,12 +40,12 @@ void cSidScanner::Process(u_short pidP, u_char tidP, const u_char *dataP, int le
{
int newSid = -1, newNid = -1, newTid = -1;
- //debug("cSidScanner::%s()", __FUNCTION__);
+ debug16("%s (%d, %02X, , %d)", __PRETTY_FUNCTION__, pidP, tidP, lengthP);
if (!isActiveM)
return;
if (channelIdM.Valid()) {
if ((pidP == 0x00) && (tidP == 0x00)) {
- //debug("cSidScanner::%s(%d, %02X)", __FUNCTION__, pidP, tidP);
+ debug16("%s (%d, %02X, , %d) pat", __PRETTY_FUNCTION__, pidP, tidP, lengthP);
SI::PAT pat(dataP, false);
if (!pat.CheckCRCAndParse())
return;
@@ -53,7 +53,7 @@ void cSidScanner::Process(u_short pidP, u_char tidP, const u_char *dataP, int le
for (SI::Loop::Iterator it; pat.associationLoop.getNext(assoc, it); ) {
if (!assoc.isNITPid()) {
if (assoc.getServiceId() != channelIdM.Sid()) {
- debug("cSidScanner::%s(): sid=%d", __FUNCTION__, assoc.getServiceId());
+ debug1("%s (%d, %02X, , %d) sid=%d", __PRETTY_FUNCTION__, pidP, tidP, lengthP, assoc.getServiceId());
newSid = assoc.getServiceId();
}
sidFoundM = true;
@@ -62,19 +62,19 @@ void cSidScanner::Process(u_short pidP, u_char tidP, const u_char *dataP, int le
}
}
else if ((pidP == 0x10) && (tidP == 0x40)) {
- debug("cSidScanner::%s(%d, %02X)", __FUNCTION__, pidP, tidP);
+ debug1("%s (%d, %02X, , %d)", __PRETTY_FUNCTION__, pidP, tidP, lengthP);
SI::NIT nit(dataP, false);
if (!nit.CheckCRCAndParse())
return;
SI::NIT::TransportStream ts;
for (SI::Loop::Iterator it; nit.transportStreamLoop.getNext(ts, it); ) {
if (ts.getTransportStreamId() != channelIdM.Tid()) {
- debug("cSidScanner::%s(): tsid=%d", __FUNCTION__, ts.getTransportStreamId());
+ debug1("%s (%d, %02X, , %d) tsid=%d", __PRETTY_FUNCTION__, pidP, tidP, lengthP, ts.getTransportStreamId());
newTid = ts.getTransportStreamId();
tidFoundM = true;
}
if (ts.getOriginalNetworkId() != channelIdM.Nid()) {
- debug("cSidScanner::%s(): onid=%d", __FUNCTION__, ts.getOriginalNetworkId());
+ debug1("%s (%d, %02X, , %d) onid=%d", __PRETTY_FUNCTION__, pidP, tidP, lengthP, ts.getOriginalNetworkId());
newNid = ts.getOriginalNetworkId();
nidFoundM = true;
}
@@ -82,7 +82,7 @@ void cSidScanner::Process(u_short pidP, u_char tidP, const u_char *dataP, int le
}
// fallback for network id if not found already
if (!nidFoundM && (nit.getNetworkId() != channelIdM.Nid())) {
- debug("cSidScanner::%s(): nid=%d", __FUNCTION__, nit.getNetworkId());
+ debug1("%s (%d, %02X, , %d) nid=%d", __PRETTY_FUNCTION__, pidP, tidP, lengthP, nit.getNetworkId());
newNid = nit.getNetworkId();
nidFoundM = true;
}
diff --git a/sidscanner.h b/sidscanner.h
index 5649232..9e315dc 100644
--- a/sidscanner.h
+++ b/sidscanner.h
@@ -11,6 +11,8 @@
#include <vdr/channels.h>
#include <vdr/filter.h>
+#include "log.h"
+
class cSidScanner : public cFilter {
private:
tChannelID channelIdM;
@@ -26,8 +28,8 @@ public:
cSidScanner(void);
~cSidScanner();
void SetChannel(const tChannelID &channelIdP);
- void Open() { debug("cSidScanner::%s()", __FUNCTION__); isActiveM = true; }
- void Close() { debug("cSidScanner::%s()", __FUNCTION__); isActiveM = false; }
+ void Open() { debug1("%s", __PRETTY_FUNCTION__); isActiveM = true; }
+ void Close() { debug1("%s", __PRETTY_FUNCTION__); isActiveM = false; }
};
#endif // __SIDSCANNER_H
diff --git a/socket.c b/socket.c
index 8137719..0e1e8ae 100644
--- a/socket.c
+++ b/socket.c
@@ -16,6 +16,7 @@
#include "common.h"
#include "config.h"
+#include "log.h"
#include "socket.h"
cIptvSocket::cIptvSocket()
@@ -26,24 +27,24 @@ cIptvSocket::cIptvSocket()
sequenceNumberM(-1),
isActiveM(false)
{
- debug("cIptvSocket::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
memset(&sockAddrM, 0, sizeof(sockAddrM));
}
cIptvSocket::~cIptvSocket()
{
- debug("cIptvSocket::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Close the socket
CloseSocket();
}
bool cIptvSocket::OpenSocket(const int portP, const bool isUdpP)
{
- debug("cIptvSocket::%s(%d, %d)", __FUNCTION__, portP, isUdpP);
+ debug1("%s (%d, %d)", __PRETTY_FUNCTION__, portP, isUdpP);
// If socket is there already and it is bound to a different port, it must
// be closed first
if (portP != socketPortM) {
- debug("cIptvSocket::%s(): socket tear-down", __FUNCTION__);
+ debug1("%s (%d, %d) Socket tear-down", __PRETTY_FUNCTION__, portP, isUdpP);
CloseSocket();
}
// Bind to the socket if it is not active already
@@ -82,7 +83,7 @@ bool cIptvSocket::OpenSocket(const int portP, const bool isUdpP)
void cIptvSocket::CloseSocket(void)
{
- debug("cIptvSocket::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Check if socket exists
if (socketDescM >= 0) {
close(socketDescM);
@@ -91,7 +92,7 @@ void cIptvSocket::CloseSocket(void)
memset(&sockAddrM, 0, sizeof(sockAddrM));
}
if (packetErrorsM) {
- info("detected %d RTP packet errors", packetErrorsM);
+ info("Detected %d RTP packet errors", packetErrorsM);
packetErrorsM = 0;
lastErrorReportM = time(NULL);
}
@@ -103,7 +104,7 @@ bool cIptvSocket::CheckAddress(const char *addrP, in_addr_t *inAddrP)
// First try only the IP address
*inAddrP = inet_addr(addrP);
if (*inAddrP == htonl(INADDR_NONE)) {
- debug("cIptvSocket::%s(%s): cannot convert to address", __FUNCTION__, addrP);
+ debug1("%s (%s, ) Cannot convert to address", __PRETTY_FUNCTION__, addrP);
// It may be a host name, get the name
struct hostent *host = gethostbyname(addrP);
if (!host) {
@@ -125,17 +126,17 @@ cIptvUdpSocket::cIptvUdpSocket()
sourceAddrM(htonl(INADDR_ANY)),
useIGMPv3M(false)
{
- debug("cIptvUdpSocket::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
cIptvUdpSocket::~cIptvUdpSocket()
{
- debug("cIptvUdpSocket::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
bool cIptvUdpSocket::OpenSocket(const int portP)
{
- debug("cIptvUdpSocket::%s()", __FUNCTION__);
+ debug1("%s (%d)", __PRETTY_FUNCTION__, portP);
streamAddrM = htonl(INADDR_ANY);
sourceAddrM = htonl(INADDR_ANY);
useIGMPv3M = false;
@@ -144,7 +145,7 @@ bool cIptvUdpSocket::OpenSocket(const int portP)
bool cIptvUdpSocket::OpenSocket(const int portP, const char *streamAddrP, const char *sourceAddrP, bool useIGMPv3P)
{
- debug("cIptvUdpSocket::%s(%d, %s, %s, %d)", __FUNCTION__, portP, streamAddrP, sourceAddrP, useIGMPv3P);
+ debug1("%s (%d, %s, %s, %d)", __PRETTY_FUNCTION__, portP, streamAddrP, sourceAddrP, useIGMPv3P);
CheckAddress(streamAddrP, &streamAddrM);
CheckAddress(sourceAddrP, &sourceAddrM);
useIGMPv3M = useIGMPv3P;
@@ -153,7 +154,7 @@ bool cIptvUdpSocket::OpenSocket(const int portP, const char *streamAddrP, const
void cIptvUdpSocket::CloseSocket(void)
{
- debug("cIptvUdpSocket::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
streamAddrM = htonl(INADDR_ANY);
sourceAddrM = htonl(INADDR_ANY);
useIGMPv3M = false;
@@ -162,7 +163,7 @@ void cIptvUdpSocket::CloseSocket(void)
bool cIptvUdpSocket::JoinMulticast(void)
{
- debug("cIptvUdpSocket::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Check if socket exists
if (!isActiveM && (socketDescM >= 0)) {
// Join a new multicast group
@@ -196,7 +197,7 @@ bool cIptvUdpSocket::JoinMulticast(void)
bool cIptvUdpSocket::DropMulticast(void)
{
- debug("cIptvUdpSocket::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Check if socket exists
if (isActiveM && (socketDescM >= 0)) {
// Drop the existing multicast group
@@ -231,10 +232,10 @@ bool cIptvUdpSocket::DropMulticast(void)
int cIptvUdpSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP)
{
- //debug("cIptvUdpSocket::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
// Error out if socket not initialized
if (socketDescM <= 0) {
- error("Invalid socket in cIptvUdpSocket::%s()", __FUNCTION__);
+ error("%s Invalid socket", __PRETTY_FUNCTION__);
return -1;
}
int len = 0;
@@ -289,7 +290,7 @@ int cIptvUdpSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP)
else if ((sequenceNumberM >= 0) && (((sequenceNumberM + 1) % 0xFFFF) != seq)) {
packetErrorsM++;
if (time(NULL) - lastErrorReportM > eReportIntervalS) {
- info("detected %d RTP packet errors", packetErrorsM);
+ info("Detected %d RTP packet errors", packetErrorsM);
packetErrorsM = 0;
lastErrorReportM = time(NULL);
}
@@ -330,30 +331,30 @@ int cIptvUdpSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP)
// TCP socket class
cIptvTcpSocket::cIptvTcpSocket()
{
- debug("cIptvTcpSocket::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
cIptvTcpSocket::~cIptvTcpSocket()
{
- debug("cIptvTcpSocket::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
bool cIptvTcpSocket::OpenSocket(const int portP, const char *streamAddrP)
{
- debug("cIptvTcpSocket::%s(%d, %s)", __FUNCTION__, portP, streamAddrP);
+ debug1("%s (%d, %s)", __PRETTY_FUNCTION__, portP, streamAddrP);
// Socket must be opened before setting the host address
return (cIptvSocket::OpenSocket(portP, false) && CheckAddress(streamAddrP, &sockAddrM.sin_addr.s_addr));
}
void cIptvTcpSocket::CloseSocket(void)
{
- debug("cIptvTcpSocket::%s()", __FUNCTION__);
+ debug1("%s()", __PRETTY_FUNCTION__);
cIptvSocket::CloseSocket();
}
bool cIptvTcpSocket::ConnectSocket(void)
{
- debug("cIptvTcpSocket::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
if (!isActiveM && (socketDescM >= 0)) {
int retval = connect(socketDescM, (struct sockaddr *)&sockAddrM, sizeof(sockAddrM));
// Non-blocking sockets always report in-progress error when connected
@@ -379,10 +380,10 @@ bool cIptvTcpSocket::ConnectSocket(void)
int cIptvTcpSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP)
{
- //debug("cIptvTcpSocket::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
// Error out if socket not initialized
if (socketDescM <= 0) {
- error("Invalid socket in cIptvTcpSocket::%s()", __FUNCTION__);
+ error("%s Invalid socket", __PRETTY_FUNCTION__);
return -1;
}
int len = 0;
@@ -396,10 +397,10 @@ int cIptvTcpSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP)
bool cIptvTcpSocket::ReadChar(char *bufferAddrP, unsigned int timeoutMsP)
{
- //debug("cIptvTcpSocket::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
// Error out if socket not initialized
if (socketDescM <= 0) {
- error("Invalid socket in cIptvTcpSocket::%s()", __FUNCTION__);
+ error("%s Invalid socket", __PRETTY_FUNCTION__);
return false;
}
socklen_t addrlen = sizeof(sockAddrM);
@@ -421,10 +422,10 @@ bool cIptvTcpSocket::ReadChar(char *bufferAddrP, unsigned int timeoutMsP)
bool cIptvTcpSocket::Write(const char *bufferAddrP, unsigned int bufferLenP)
{
- //debug("cIptvTcpSocket::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
// Error out if socket not initialized
if (socketDescM <= 0) {
- error("cIptvTcpSocket::%s(): Invalid socket", __FUNCTION__);
+ error("%s Invalid socket", __PRETTY_FUNCTION__);
return false;
}
ERROR_IF_RET(send(socketDescM, bufferAddrP, bufferLenP, 0) < 0, "send()", return false);
diff --git a/source.c b/source.c
index 6ccab65..f737107 100644
--- a/source.c
+++ b/source.c
@@ -6,7 +6,9 @@
*/
#include <ctype.h>
+
#include "common.h"
+#include "log.h"
#include "source.h"
// --- cIptvTransponderParameters --------------------------------------------
@@ -17,7 +19,7 @@ cIptvTransponderParameters::cIptvTransponderParameters(const char *parametersP)
protocolM(eProtocolUDP),
parameterM(0)
{
- debug("cIptvTransponderParameters::%s(%s)", __FUNCTION__, parametersP);
+ debug1("%s (%s)", __PRETTY_FUNCTION__, parametersP);
memset(&addressM, 0, sizeof(addressM));
Parse(parametersP);
@@ -25,7 +27,7 @@ cIptvTransponderParameters::cIptvTransponderParameters(const char *parametersP)
cString cIptvTransponderParameters::ToString(char typeP) const
{
- debug("cIptvTransponderParameters::%s(%c)", __FUNCTION__, typeP);
+ debug1("%s (%c)", __PRETTY_FUNCTION__, typeP);
const char *protocolstr;
@@ -52,7 +54,7 @@ cString cIptvTransponderParameters::ToString(char typeP) const
bool cIptvTransponderParameters::Parse(const char *strP)
{
- debug("cIptvTransponderParameters::%s(%s)", __FUNCTION__, strP);
+ debug1("%s (%s)", __PRETTY_FUNCTION__, strP);
bool result = false;
if (strP && *strP) {
@@ -140,7 +142,7 @@ cIptvSourceParam::cIptvSourceParam(char sourceP, const char *descriptionP)
dataM(),
itpM()
{
- debug("cIptvSourceParam::%s(%c, %s)", __FUNCTION__, sourceP, descriptionP);
+ debug1("%s (%c, %s)", __PRETTY_FUNCTION__, sourceP, descriptionP);
protocolsM[cIptvTransponderParameters::eProtocolUDP] = tr("UDP");
protocolsM[cIptvTransponderParameters::eProtocolCURL] = tr("CURL");
@@ -151,7 +153,7 @@ cIptvSourceParam::cIptvSourceParam(char sourceP, const char *descriptionP)
void cIptvSourceParam::SetData(cChannel *channelP)
{
- debug("cIptvSourceParam::%s(%s)", __FUNCTION__, channelP->Parameters());
+ debug1("%s (%s)", __PRETTY_FUNCTION__, channelP->Parameters());
dataM = *channelP;
ridM = dataM.Rid();
itpM.Parse(dataM.Parameters());
@@ -160,14 +162,14 @@ void cIptvSourceParam::SetData(cChannel *channelP)
void cIptvSourceParam::GetData(cChannel *channelP)
{
- debug("cIptvSourceParam::%s(%s)", __FUNCTION__, channelP->Parameters());
+ debug1("%s (%s)", __PRETTY_FUNCTION__, channelP->Parameters());
channelP->SetTransponderData(channelP->Source(), channelP->Frequency(), dataM.Srate(), itpM.ToString(Source()), true);
channelP->SetId(channelP->Nid(), channelP->Tid(), channelP->Sid(), ridM);
}
cOsdItem *cIptvSourceParam::GetOsdItem(void)
{
- debug("cIptvSourceParam::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
switch (paramM++) {
case 0: return new cMenuEditIntItem( tr("Rid"), &ridM, 0);
case 1: return new cMenuEditBoolItem(tr("Scan section ids"), &itpM.sidScanM);
diff --git a/statistics.c b/statistics.c
index 139cd3b..a1b37bd 100644
--- a/statistics.c
+++ b/statistics.c
@@ -8,8 +8,9 @@
#include <limits.h>
#include "common.h"
-#include "statistics.h"
#include "config.h"
+#include "log.h"
+#include "statistics.h"
// Section statistics class
cIptvSectionStatistics::cIptvSectionStatistics()
@@ -18,17 +19,17 @@ cIptvSectionStatistics::cIptvSectionStatistics()
timerM(),
mutexM()
{
- //debug("cIptvSectionStatistics::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
}
cIptvSectionStatistics::~cIptvSectionStatistics()
{
- //debug("cIptvSectionStatistics::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
}
cString cIptvSectionStatistics::GetSectionStatistic()
{
- //debug("cIptvSectionStatistics::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
cMutexLock MutexLock(&mutexM);
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
timerM.Set();
@@ -44,7 +45,7 @@ cString cIptvSectionStatistics::GetSectionStatistic()
void cIptvSectionStatistics::AddSectionStatistic(long bytesP, long callsP)
{
- //debug("cIptvSectionStatistics::%s(%ld, %ld)", __FUNCTION__, bytesP, callsP);
+ debug16("%s (%ld, %ld)", __PRETTY_FUNCTION__, bytesP, callsP);
cMutexLock MutexLock(&mutexM);
filteredDataM += bytesP;
numberOfCallsM += callsP;
@@ -57,7 +58,7 @@ cIptvPidStatistics::cIptvPidStatistics()
: timerM(),
mutexM()
{
- debug("cIptvPidStatistics::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct);
for (int i = 0; i < numberOfElements; ++i) {
mostActivePidsM[i].pid = -1;
@@ -67,12 +68,12 @@ cIptvPidStatistics::cIptvPidStatistics()
cIptvPidStatistics::~cIptvPidStatistics()
{
- debug("cIptvPidStatistics::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
cString cIptvPidStatistics::GetPidStatistic()
{
- //debug("cIptvPidStatistics::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
cMutexLock MutexLock(&mutexM);
const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct);
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
@@ -97,7 +98,7 @@ cString cIptvPidStatistics::GetPidStatistic()
int cIptvPidStatistics::SortPids(const void* data1P, const void* data2P)
{
- //debug("cIptvPidStatistics::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
const pidStruct *comp1 = reinterpret_cast<const pidStruct*>(data1P);
const pidStruct *comp2 = reinterpret_cast<const pidStruct*>(data2P);
if (comp1->dataAmount > comp2->dataAmount)
@@ -109,7 +110,7 @@ int cIptvPidStatistics::SortPids(const void* data1P, const void* data2P)
void cIptvPidStatistics::AddPidStatistic(int pidP, long payloadP)
{
- //debug("cIptvPidStatistics::%s(%ld, %ld)", __FUNCTION__, pidP, payloadP);
+ debug16("%s (%d, %ld)", __PRETTY_FUNCTION__, pidP, payloadP);
cMutexLock MutexLock(&mutexM);
const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct);
// If our statistic already is in the array, update it and quit
@@ -139,17 +140,17 @@ cIptvStreamerStatistics::cIptvStreamerStatistics()
timerM(),
mutexM()
{
- debug("cIptvStreamerStatistics::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
cIptvStreamerStatistics::~cIptvStreamerStatistics()
{
- debug("cIptvStreamerStatistics::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
cString cIptvStreamerStatistics::GetStreamerStatistic()
{
- //debug("cIptvStreamerStatistics::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
cMutexLock MutexLock(&mutexM);
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
timerM.Set();
@@ -163,7 +164,7 @@ cString cIptvStreamerStatistics::GetStreamerStatistic()
void cIptvStreamerStatistics::AddStreamerStatistic(long bytesP)
{
- //debug("cIptvStreamerStatistics::%s(%ld)", __FUNCTION__, bytesP);
+ debug16("%s (%ld)", __PRETTY_FUNCTION__, bytesP);
cMutexLock MutexLock(&mutexM);
dataBytesM += bytesP;
}
@@ -177,17 +178,17 @@ cIptvBufferStatistics::cIptvBufferStatistics()
timerM(),
mutexM()
{
- debug("cIptvBufferStatistics::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
cIptvBufferStatistics::~cIptvBufferStatistics()
{
- debug("cIptvBufferStatistics::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
}
cString cIptvBufferStatistics::GetBufferStatistic()
{
- //debug("cIptvBufferStatistics::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
cMutexLock MutexLock(&mutexM);
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
timerM.Set();
@@ -211,7 +212,7 @@ cString cIptvBufferStatistics::GetBufferStatistic()
void cIptvBufferStatistics::AddBufferStatistic(long bytesP, long usedP)
{
- //debug("cIptvBufferStatistics::%s(%ld, %ld)", __FUNCTION__, bytesP, usedP);
+ debug16("%s (%ld, %ld)", __PRETTY_FUNCTION__, bytesP, usedP);
cMutexLock MutexLock(&mutexM);
dataBytesM += bytesP;
if (usedP > usedSpaceM)
diff --git a/streamer.c b/streamer.c
index 2afffb1..847dd53 100644
--- a/streamer.c
+++ b/streamer.c
@@ -6,6 +6,7 @@
*/
#include "common.h"
+#include "log.h"
#include "streamer.h"
cIptvStreamer::cIptvStreamer(cIptvDeviceIf &deviceP, unsigned int packetLenP)
@@ -15,7 +16,7 @@ cIptvStreamer::cIptvStreamer(cIptvDeviceIf &deviceP, unsigned int packetLenP)
packetBufferLenM(packetLenP),
protocolM(NULL)
{
- debug("cIptvStreamer::%s(%d)", __FUNCTION__, packetBufferLenM);
+ debug1("%s (, %d)", __PRETTY_FUNCTION__, packetBufferLenM);
// Allocate packet buffer
packetBufferM = MALLOC(unsigned char, packetBufferLenM);
if (packetBufferM)
@@ -26,7 +27,7 @@ cIptvStreamer::cIptvStreamer(cIptvDeviceIf &deviceP, unsigned int packetLenP)
cIptvStreamer::~cIptvStreamer()
{
- debug("cIptvStreamer::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Close the protocol
Close();
protocolM = NULL;
@@ -36,7 +37,7 @@ cIptvStreamer::~cIptvStreamer()
void cIptvStreamer::Action(void)
{
- debug("cIptvStreamer::%s(): entering", __FUNCTION__);
+ debug1("%s() Entering", __PRETTY_FUNCTION__);
// Increase priority
//SetPriority(-1);
// Do the thread loop
@@ -52,12 +53,12 @@ void cIptvStreamer::Action(void)
else
sleepM.Wait(10); // to avoid busy loop and reduce cpu load
}
- debug("cIptvStreamer::%s(): exiting", __FUNCTION__);
+ debug1("%s Exiting", __PRETTY_FUNCTION__);
}
bool cIptvStreamer::Open(void)
{
- debug("cIptvStreamer::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Open the protocol
if (protocolM && !protocolM->Open())
return false;
@@ -68,7 +69,7 @@ bool cIptvStreamer::Open(void)
bool cIptvStreamer::Close(void)
{
- debug("cIptvStreamer::%s()", __FUNCTION__);
+ debug1("%s", __PRETTY_FUNCTION__);
// Stop thread
sleepM.Signal();
if (Running())
@@ -81,7 +82,7 @@ bool cIptvStreamer::Close(void)
bool cIptvStreamer::SetSource(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP)
{
- debug("cIptvStreamer::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
+ debug1("%s (%s, %d, %d, )", __PRETTY_FUNCTION__, locationP, parameterP, indexP);
if (!isempty(locationP)) {
// Update protocol and set location and parameter; Close the existing one if changed
if (protocolM != protocolP) {
@@ -101,7 +102,7 @@ bool cIptvStreamer::SetSource(const char* locationP, const int parameterP, const
bool cIptvStreamer::SetPid(int pidP, int typeP, bool onP)
{
- debug("cIptvStreamer::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
+ debug1("%s (%d, %d, %d)", __PRETTY_FUNCTION__, pidP, typeP, onP);
if (protocolM)
return protocolM->SetPid(pidP, typeP, onP);
return true;
@@ -109,7 +110,7 @@ bool cIptvStreamer::SetPid(int pidP, int typeP, bool onP)
cString cIptvStreamer::GetInformation(void)
{
- //debug("cIptvStreamer::%s()", __FUNCTION__);
+ debug16("%s", __PRETTY_FUNCTION__);
cString s;
if (protocolM)
s = protocolM->GetInformation();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vdr-dvb/vdr-plugin-iptv.git
More information about the pkg-vdr-dvb-changes
mailing list