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

Compare commits

..

15 Commits

Author SHA1 Message Date
Rolf Ahrenberg
f7369c9578 Silence a compiling warning. 2020-01-03 23:36:58 +02:00
Rolf Ahrenberg
876d0d954e Updated README. 2019-10-27 16:57:31 +02:00
Rolf Ahrenberg
5ae793f030 Updated for vdr-2.4.0. 2018-04-15 22:27:15 +03:00
Rolf Ahrenberg
0fe1cb7ab5 Updated for vdr-2.3.7. 2017-06-24 23:20:33 +03:00
Rolf Ahrenberg
08cecd5eba Merge pull request #4 from tmn505/polish_language
Add polish language
2017-02-28 21:53:04 +02:00
Tomasz Maciej Nowak
22beb1662f Add polish language 2017-02-28 16:34:56 +01:00
Frank Neumann
ce8680cbc9 Add Catalan and Espanol translations. 2017-02-11 19:35:17 +02:00
Rolf Ahrenberg
0d2f32dc6a Use 2MB ringbuffer per device. 2016-05-12 23:51:03 +03:00
Rolf Ahrenberg
201b50eb9d C++11 requires a mandatory space when concatenating string literals. 2016-02-07 13:41:37 +02:00
Rolf Ahrenberg
777be25375 Update README. 2016-01-31 20:22:16 +02:00
Rolf Ahrenberg
ccc9bab5e0 Updated for vdr-2.3.1. 2015-09-19 17:20:56 +03:00
Rolf Ahrenberg
03a1e33e2f Prepared for a release. 2015-04-04 14:13:22 +03:00
Rolf Ahrenberg
130e2d09d0 Got rid of IPTV_DEBUG. 2015-03-08 15:47:12 +02:00
Rolf Ahrenberg
bc6da9dd63 Added support for tracing modes. 2015-03-08 15:40:27 +02:00
Rolf Ahrenberg
63359e4c24 Fixed CURL timeout and added a stale connection detection (Thanks to Daniel Ribeiro). 2015-02-24 20:30:43 +02:00
35 changed files with 887 additions and 339 deletions

30
HISTORY
View File

@@ -263,4 +263,32 @@ 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.
==================================
VDR Plugin 'iptv' Revision History
==================================
2017-06-24: Version 2.3.0
- Updated for vdr-2.3.7.
- Added Polish translation (Thanks to Tomasz Nowak).
- Added Catalan and Spanish translations (Thanks to Gabriel Bonich).
==================================
VDR Plugin 'iptv' Revision History
==================================
2018-04-15: Version 2.4.0
- Updated for vdr-2.4.0.

View File

@@ -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
@@ -98,14 +87,15 @@ all: $(SOFILE) i18n
### Implicit rules:
%.o: %.c Makefile
$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
@echo CC $@
$(Q)$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
### Dependencies:
MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
$(Q)$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
-include $(DEPFILE)
@@ -118,17 +108,21 @@ I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLU
I18Npot = $(PODIR)/$(PLUGIN).pot
%.mo: %.po
msgfmt -c -o $@ $<
@echo MO $@
$(Q)msgfmt -c -o $@ $<
$(I18Npot): $(wildcard *.c)
xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^`
@echo GT $@
$(Q)xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^`
%.po: $(I18Npot)
msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
@echo PO $@
$(Q)msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
@touch $@
$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
install -D -m644 $< $@
@echo IN $@
$(Q)install -D -m644 $< $@
.PHONY: i18n
i18n: $(I18Nmo) $(I18Npot)
@@ -138,13 +132,13 @@ install-i18n: $(I18Nmsgs)
### Targets:
$(SOFILE): $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
ifndef IPTV_DEBUG
@$(STRIP) $@
endif
@echo LD $@
$(Q)$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
$(Q)$(STRIP) $@
install-lib: $(SOFILE)
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
@echo IN $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
$(Q)install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
install-conf:
@mkdir -p $(DESTDIR)$(CFGDIR)/plugins/$(PLUGIN)
@@ -167,4 +161,4 @@ clean:
.PHONY: cppcheck
cppcheck:
@cppcheck --language=c++ --enable=all -v -f $(OBJS:%.o=%.c)
$(Q)cppcheck --language=c++ --enable=all -v -f $(OBJS:%.o=%.c)

19
README
View File

@@ -29,15 +29,15 @@ filtering capabilities which allow for example EIT information to be
extracted from the incoming stream.
Currently the IPTV plugin has direct support for both multicast UDP/RTP
and unicast HTTP MPEG1/2 transport streams. Also a file input method is
supported, but a file delay must be selected individually to prevent
VDR's transfer buffer over/underflow. Therefore the file input should be
considered as a testing feature only.
and unicast HTTP MPEG1/2, H.264 and H.265 transport streams. Also a file
input method is supported, but a file delay must be selected individually
to prevent VDR's transfer buffer over/underflow. Therefore the file input
should be considered as a testing feature only.
IPTV plugin also features a support for external streaming applications.
With proper helper applications and configuration IPTV plugin is able to
display not only MPEG1/2 transport streams but also other formats like
MP3 radio streams, mms video streams and so on.
display not only MPEG1/2, H.264 and H.265 transport streams but also other
formats like MP3 radio streams, mms video streams and so on.
Installation:
@@ -46,13 +46,6 @@ make -C iptv-X.Y.Z install
Setup menu:
- TS buffer size [MB] = 2 Defines ringbuffer size for transport
stream in MB.
Valid range: 1...4
- TS buffer prefill ratio [%] = 0 Defines prefill ratio for transport
stream ringbuffer before data is
transferred to VDR.
Valid range: 0...40
- Protocol base port = 4321 Defines base port used in CURL/EXT
protocol. Two ports are defined for
each device.

View File

@@ -12,19 +12,9 @@
#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)
#define IPTV_BUFFER_SIZE KILOBYTE(2048)
#define IPTV_DVR_FILENAME "/tmp/vdr-iptv%d.dvr"
@@ -42,18 +32,17 @@
#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)
#define ERROR_IF_RET(exp, errstr, ret) ERROR_IF_FUNC(exp, errstr, ,ret);
#define ERROR_IF(exp, errstr) ERROR_IF_FUNC(exp, errstr, , );

View File

@@ -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");
}

View File

@@ -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; }

View File

@@ -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,24 +124,25 @@ cIptvDevice *cIptvDevice::GetIptvDevice(int cardIndexP)
cString cIptvDevice::GetGeneralInformation(void)
{
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
LOCK_CHANNELS_READ;
return cString::sprintf("IPTV device: %d\nCardIndex: %d\nStream: %s\nStream bitrate: %s\n%sChannel: %s",
deviceIndexM, CardIndex(),
pIptvStreamerM ? *pIptvStreamerM->GetInformation() : "",
pIptvStreamerM ? *pIptvStreamerM->GetStreamerStatistic() : "",
*GetBufferStatistic(),
*Channels.GetByNumber(cDevice::CurrentChannel())->ToText());
*Channels->GetByNumber(cDevice::CurrentChannel())->ToText());
}
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 +178,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 +218,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 +264,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 +305,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 +313,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 +324,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 +334,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 +349,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 +361,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 +391,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 +399,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 +430,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 +439,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()) {

61
iptv.c
View File

@@ -13,15 +13,15 @@
#include "device.h"
#include "iptvservice.h"
#if defined(APIVERSNUM) && APIVERSNUM < 20200
#error "VDR-2.2.0 API version or greater is required!"
#if defined(APIVERSNUM) && APIVERSNUM < 20400
#error "VDR-2.4.0 API version or greater is required!"
#endif
#ifndef GITVERSION
#define GITVERSION ""
#endif
const char VERSION[] = "2.2.0" GITVERSION;
const char VERSION[] = "2.4.0" 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;
}

48
log.h Normal file
View File

@@ -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

View File

@@ -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,35 +84,37 @@ 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);
}
}
}
if (((numVpidsM >= PIDSCANNER_VPID_COUNT) && (numApidsM >= PIDSCANNER_APID_COUNT)) ||
(abs(numApidsM - numVpidsM) >= PIDSCANNER_PID_DELTA_COUNT)) {
// Lock channels for pid updates
if (!Channels.Lock(true, 10)) {
timeoutM.Set(PIDSCANNER_TIMEOUT_IN_MS);
timeoutM.Set(PIDSCANNER_TIMEOUT_IN_MS);
cStateKey StateKey;
cChannels *Channels = cChannels::GetChannelsWrite(StateKey, 10);
if (!Channels)
return;
}
cChannel *IptvChannel = Channels.GetByChannelID(channelIdM);
bool ChannelsModified = false;
cChannel *IptvChannel = Channels->GetByChannelID(channelIdM);
if (IptvChannel) {
int Apids[MAXAPIDS + 1] = { 0 }; // these lists are zero-terminated
int Atypes[MAXAPIDS + 1] = { 0 };
@@ -146,10 +148,10 @@ 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);
IptvChannel->SetPids(vPidM, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, Dtypes, DLangs, Spids, SLangs, Tpid);
debug1("%s vpid=0x%04X, apid=0x%04X", __PRETTY_FUNCTION__, vPidM, aPidM);
ChannelsModified |= IptvChannel->SetPids(vPidM, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, Dtypes, DLangs, Spids, SLangs, Tpid);
}
Channels.Unlock();
StateKey.Remove(ChannelsModified);
processM = false;
}
}

View File

@@ -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

134
po/ca_ES.po Normal file
View File

@@ -0,0 +1,134 @@
# VDR plugin language source file.
# Copyright (C) 2007-2017 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Gabriel Bonich, 2017
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.4.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2018-04-15 04:15+0300\n"
"PO-Revision-Date: 2018-04-15 04:15+0300\n"
"Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n"
"Language-Team: Catalan <vdr@linuxtv.org>\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "PAT (0x00)"
msgstr "PAT (0x00)"
msgid "NIT (0x40)"
msgstr "NIT (0x40)"
msgid "SDT (0x42)"
msgstr "SDT (0x42)"
msgid "EIT (0x4E/0x4F/0x5X/0x6X)"
msgstr "EIT (0x4E/0x4F/0x5X/0x6X)"
msgid "TDT (0x70)"
msgstr "TDT (0x70)"
msgid "Experience the IPTV"
msgstr "Experimenta la IPTV"
msgid "IPTV Information"
msgstr "Informació IPTV"
msgid "General"
msgstr "General"
msgid "Pids"
msgstr "Pids"
msgid "Filters"
msgstr "Filtres"
msgid "Bits/bytes"
msgstr "Bits/Bytes"
msgid "IPTV information not available!"
msgstr "Informació IPTV no disponible!"
msgid "Protocol base port"
msgstr "Port Protocol"
msgid ""
"Define a base port used by CURL/EXT protocol.\n"
"\n"
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the CURL/EXT protocol."
msgstr ""
"Definir el port utilizat por el protocol CURL/EXT.\n"
"\n"
"El nombre de ports es defineix por el nombre de dispositius IPTV. Aquesta configuració estableix el port que escolta a las conexions de las aplicaciones externas quant s'utiliza el protocol CURL / EXT."
msgid "Use section filtering"
msgstr "Utilitzi la secció de filtrat"
msgid ""
"Define whether the section filtering shall be used.\n"
"\n"
"Section filtering means that IPTV plugin tries to parse and provide VDR with secondary data about the currently active stream. VDR can then use this data for providing various functionalities such as automatic pid change detection and EPG etc.\n"
"Enabling this feature does not affect streams that do not contain section data."
msgstr ""
"Definir si s'utilizarà la secció de filtrat.\n"
"\n"
"Secció de filtrat significa que el plugin IPTV tracta de analitzar i proporcionar a VDR les dades secundaries sobre el fluxe actiu. VDR pot utilitzar aquestes dades per proporcionar diverses funcionalitats com ara la detecció de canvis automatics del PID,EPG, etc.\n"
"L'activació d'aquesta funció no afecta als fluxes que no contenen dades de la secció."
msgid "Disabled filters"
msgstr "Desactivar Filtres"
msgid ""
"Define number of section filters to be disabled.\n"
"\n"
"Certain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process."
msgstr ""
"Definir el nombre de filtres de sección a desactivar.\n"
"\n"
"Certs filtres de secció podrien causar un comportament no desitjat a VDR, com el temps que sincronitza malament. Aquí la llista negra dels filtres, les dades útils de la secció es poden deixar intactes perquè VDR els processi."
msgid "Filter"
msgstr "Filtre"
msgid "Define an ill-behaving filter to be blacklisted."
msgstr "Definir un filtre que no funcioni per ser inclos a la llista negre."
msgid "Help"
msgstr "Ajuda"
msgid "UDP"
msgstr "UDP"
msgid "CURL"
msgstr "CURL"
msgid "HTTP"
msgstr "HTTP"
msgid "FILE"
msgstr "ARXIU"
msgid "EXT"
msgstr "EXT"
msgid "Rid"
msgstr "Rid"
msgid "Scan section ids"
msgstr "Escaneja secció ids"
msgid "Scan pids"
msgstr "Escaneja pids"
msgid "Protocol"
msgstr "Protocol"
msgid "Address"
msgstr "Direcció"
msgid "Parameter"
msgstr "Parametre"

View File

@@ -1,15 +1,15 @@
# VDR plugin language source file.
# Copyright (C) 2007-2015 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2018 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Tobias <vdr@e-tobi.net>, 2007.
# Frank Neumann, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.2.0\n"
"Project-Id-Version: vdr-iptv 2.4.0\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: 2018-04-15 04:15+0300\n"
"PO-Revision-Date: 2018-04-15 04:15+0300\n"
"Last-Translator: Frank Neumann <fnu@yavdr.org>\n"
"Language-Team: German <vdr@linuxtv.org>\n"
"Language: de\n"

134
po/es_ES.po Normal file
View File

@@ -0,0 +1,134 @@
# VDR plugin language source file.
# Copyright (C) 2007-2017 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Gabriel Bonich, 2017
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.4.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2018-04-15 04:15+0300\n"
"PO-Revision-Date: 2018-04-15 04:15+0300\n"
"Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n"
"Language-Team: Spanish <vdr@linuxtv.org>\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "PAT (0x00)"
msgstr "PAT (0x00)"
msgid "NIT (0x40)"
msgstr "NIT (0x40)"
msgid "SDT (0x42)"
msgstr "SDT (0x42)"
msgid "EIT (0x4E/0x4F/0x5X/0x6X)"
msgstr "EIT (0x4E/0x4F/0x5X/0x6X)"
msgid "TDT (0x70)"
msgstr "TDT (0x70)"
msgid "Experience the IPTV"
msgstr "Experimente la IPTV"
msgid "IPTV Information"
msgstr "Información IPTV"
msgid "General"
msgstr "General"
msgid "Pids"
msgstr "Pids"
msgid "Filters"
msgstr "Filtros"
msgid "Bits/bytes"
msgstr "Bits/Bytes"
msgid "IPTV information not available!"
msgstr "Información IPTV no disponible!"
msgid "Protocol base port"
msgstr "Puerto Protocolo"
msgid ""
"Define a base port used by CURL/EXT protocol.\n"
"\n"
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the CURL/EXT protocol."
msgstr ""
"Definir el puerto utilizado por el protocolo CURL/EXT.\n"
"\n"
"El rango de puertos se define por el número de dispositivos IPTV. Esta configuración establece el puerto que se escucha para las conexiones de las aplicaciones externas cuando se utiliza el protocolo CURL / EXT."
msgid "Use section filtering"
msgstr "Utilice la sección de filtrado"
msgid ""
"Define whether the section filtering shall be used.\n"
"\n"
"Section filtering means that IPTV plugin tries to parse and provide VDR with secondary data about the currently active stream. VDR can then use this data for providing various functionalities such as automatic pid change detection and EPG etc.\n"
"Enabling this feature does not affect streams that do not contain section data."
msgstr ""
"Definir si se utilizará la sección de filtrado.\n"
"\n"
"Sección de filtrado significa que el plugin IPTV trata de analizar y proporcionar a VDR los datos secundarios sobre el flujo activo. VDR puede entonces utilizar estos datos para proporcionar diversas funcionalidades tales como detección automática del cambio del PID, EPG, etc.\n"
"El uso de esta capacidad no afecta a fuentes que no contienen datos de la sección."
msgid "Disabled filters"
msgstr "Desactivar Filtros"
msgid ""
"Define number of section filters to be disabled.\n"
"\n"
"Certain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process."
msgstr ""
"Defina el número de filtros de sección a deshabilitar.\n"
"\n"
"Ciertos filtros de sección pueden causar algún comportamiento no deseado a VDR, como el tiempo que sincroniza mal. Aquí la lista negra de los filtros, los datos útiles de la sección se pueden dejar intactos para que VDR los procese."
msgid "Filter"
msgstr "Filtro"
msgid "Define an ill-behaving filter to be blacklisted."
msgstr "Defina un filtro que no funcione para ser incluido en la lista negra."
msgid "Help"
msgstr "Ayuda"
msgid "UDP"
msgstr "UDP"
msgid "CURL"
msgstr "CURL"
msgid "HTTP"
msgstr "HTTP"
msgid "FILE"
msgstr "ARCHIVO"
msgid "EXT"
msgstr "EXT"
msgid "Rid"
msgstr "Rid"
msgid "Scan section ids"
msgstr "Escanea sección ids"
msgid "Scan pids"
msgstr "Escanea pids"
msgid "Protocol"
msgstr "Protocolo"
msgid "Address"
msgstr "Dirección"
msgid "Parameter"
msgstr "Parametro"

View File

@@ -1,14 +1,14 @@
# VDR plugin language source file.
# Copyright (C) 2007-2015 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2018 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Rolf Ahrenberg
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.2.0\n"
"Project-Id-Version: vdr-iptv 2.4.0\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: 2018-04-15 04:15+0300\n"
"PO-Revision-Date: 2018-04-15 04:15+0300\n"
"Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish <vdr@linuxtv.org>\n"
"Language: fi\n"

View File

@@ -1,15 +1,15 @@
# French translations for iptv package.
# Copyright (C) 2007-2015 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2018 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Bruno ROUSSEL <bruno.roussel@free.fr>, 2007.
# NIVAL Michaël <mnival@club-internet.fr>, 2008.
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.2.0\n"
"Project-Id-Version: vdr-iptv 2.4.0\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: 2018-04-15 04:15+0300\n"
"PO-Revision-Date: 2018-04-15 04:15+0300\n"
"Last-Translator: NIVAL Michaël <mnival@club-internet.fr>\n"
"Language-Team: French <vdr@linuxtv.org>\n"
"Language: fr\n"

View File

@@ -1,14 +1,14 @@
# VDR plugin language source file.
# Copyright (C) 2007-2015 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2018 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Diego Pierotto <vdr-italian@tiscali.it>, 2008.
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.2.0\n"
"Project-Id-Version: vdr-iptv 2.4.0\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: 2018-04-15 04:15+0300\n"
"PO-Revision-Date: 2018-04-15 04:15+0300\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: Italian <vdr@linuxtv.org>\n"
"Language: it\n"

View File

@@ -1,14 +1,14 @@
# VDR plugin language source file.
# Copyright (C) 2007-2015 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2018 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Valdemaras Pipiras
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.2.0\n"
"Project-Id-Version: vdr-iptv 2.4.0\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: 2018-04-15 04:15+0300\n"
"PO-Revision-Date: 2018-04-15 04:15+0300\n"
"Last-Translator: Valdemaras Pipiras\n"
"Language-Team: Lithuanian <vdr@linuxtv.org>\n"
"Language: fi\n"

View File

@@ -1,14 +1,14 @@
# VDR plugin language source file.
# Copyright (C) 2007-2015 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2018 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Carel, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.2.0\n"
"Project-Id-Version: vdr-iptv 2.4.0\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: 2018-04-15 04:15+0300\n"
"PO-Revision-Date: 2018-04-15 04:15+0300\n"
"Last-Translator: Carel\n"
"Language-Team: Dutch <vdr@linuxtv.org>\n"
"Language: nl\n"

134
po/pl_PL.po Normal file
View File

@@ -0,0 +1,134 @@
# VDR plugin language source file.
# Copyright (C) 2007-2017 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the vdr-iptv package.
# Tomasz Maciej Nowak, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.4.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2018-04-15 04:15+0300\n"
"PO-Revision-Date: 2018-04-15 04:15+0300\n"
"Last-Translator: Tomasz Maciej Nowak <tomek_n@o2.pl>\n"
"Language-Team: Polish <vdr@linuxtv.org>\n"
"Language: pl_PL\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.11\n"
msgid "PAT (0x00)"
msgstr "PAT (0x00)"
msgid "NIT (0x40)"
msgstr "NIT (0x40)"
msgid "SDT (0x42)"
msgstr "SDT (0x42)"
msgid "EIT (0x4E/0x4F/0x5X/0x6X)"
msgstr "EIT (0x4E/0x4F/0x5X/0x6X)"
msgid "TDT (0x70)"
msgstr "TDT (0x70)"
msgid "Experience the IPTV"
msgstr "Poznaj IPTV"
msgid "IPTV Information"
msgstr "IPTV - informacje"
msgid "General"
msgstr "Główne"
msgid "Pids"
msgstr "Pidy"
msgid "Filters"
msgstr "Filtry"
msgid "Bits/bytes"
msgstr "Bity/bajty"
msgid "IPTV information not available!"
msgstr "Brak dostępnych informacji IPTV!"
msgid "Protocol base port"
msgstr "Podstawowy port protokołu"
msgid ""
"Define a base port used by CURL/EXT protocol.\n"
"\n"
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the CURL/EXT protocol."
msgstr ""
"Określa podstawowy port używany przez protokół CURL/EXT.\n"
"\n"
"Zakres portów jest zdefiniowany liczbą urządzeń IPTV. To ustawienie nadaje port, który nasłuchuje połączeń z zewnętrznych aplikacji używających protokołu CURL/EXT."
msgid "Use section filtering"
msgstr "Używaj filtrowania sekcji"
msgid ""
"Define whether the section filtering shall be used.\n"
"\n"
"Section filtering means that IPTV plugin tries to parse and provide VDR with secondary data about the currently active stream. VDR can then use this data for providing various functionalities such as automatic pid change detection and EPG etc.\n"
"Enabling this feature does not affect streams that do not contain section data."
msgstr ""
"Określa czy włączyć filtrowanie sekcji.\n"
"\n"
"Filtrowanie sekcji oznacza że wtyczka IPTV próbuje analizować i dostarczyć VDR dodatkowe informacje o aktywnym strumieniu. VDR może użyć tych danych aby dostarczyć dodatkowe usługi jak automatyczne wykrycie zmiany pidów i EPG, etc.\n"
"Włączenie tej funkcji nie wpływa na strumienie nie posiadające danych sekcji."
msgid "Disabled filters"
msgstr "Wyłączone filtry"
msgid ""
"Define number of section filters to be disabled.\n"
"\n"
"Certain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process."
msgstr ""
"Określa liczbę wyłączonych filtrów sekcji.\n"
"\n"
"Niektóre filtry sekcji mogą powodować niezamierzone efekty w VDR, takie jak zły czas synchronizacji. Poprzez wyłączenie niektórych filtrów, użyteczne dane sekcji będą dostępne do przetworzenia dla VDR."
msgid "Filter"
msgstr "Filtr"
msgid "Define an ill-behaving filter to be blacklisted."
msgstr "Określa filtry powodujące zakłócenia, które mają być wyłączone."
msgid "Help"
msgstr "Pomoc"
msgid "UDP"
msgstr "UDP"
msgid "CURL"
msgstr "CURL"
msgid "HTTP"
msgstr "HTTP"
msgid "FILE"
msgstr "PLIK"
msgid "EXT"
msgstr "EXT"
msgid "Rid"
msgstr "Rid"
msgid "Scan section ids"
msgstr "Skanuj sekcję identyfikatorów"
msgid "Scan pids"
msgstr "Skanuj pidy"
msgid "Protocol"
msgstr "Protokół"
msgid "Address"
msgstr "Adres"
msgid "Parameter"
msgstr "Parametr"

View File

@@ -1,14 +1,14 @@
# VDR plugin language source file.
# Copyright (C) 2007-2015 Rolf Ahrenberg & Antti Seppala
# Copyright (C) 2007-2018 Rolf Ahrenberg & Antti Seppala
# This file is distributed under the same license as the iptv package.
# Alexander Gross <Bikalexander@gmail.com>, 2008.
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.2.0\n"
"Project-Id-Version: vdr-iptv 2.4.0\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: 2018-04-15 04:15+0300\n"
"PO-Revision-Date: 2018-04-15 04:15+0300\n"
"Last-Translator: Alexander Gross <Bikalexander@gmail.com>\n"
"Language-Team: Russian <vdr@linuxtv.org>\n"
"Language: ru\n"

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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());
@@ -192,7 +192,7 @@ void cIptvPluginSetup::StoreFilters(const char *nameP, int *valuesP)
char *q = buffer;
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) {
char s[3];
if (valuesP[i] < 0)
if ((valuesP[i] < 0) || (valuesP[i] >= SECTION_FILTER_TABLE_SIZE))
break;
if (q > buffer)
*q++ = ' ';
@@ -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);
}

View File

@@ -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,20 +82,24 @@ 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;
}
}
}
if ((newSid >= 0) || (newNid >= 0) || (newTid >= 0)) {
if (!Channels.Lock(true, 10))
cStateKey StateKey;
cChannels *Channels = cChannels::GetChannelsWrite(StateKey, 10);
if (!Channels)
return;
cChannel *IptvChannel = Channels.GetByChannelID(channelIdM);
bool ChannelsModified = false;
cChannel *IptvChannel = Channels->GetByChannelID(channelIdM);
if (IptvChannel)
IptvChannel->SetId((newNid < 0) ? IptvChannel->Nid() : newNid, (newTid < 0) ? IptvChannel->Tid() : newTid,
(newSid < 0) ? IptvChannel->Sid() : newSid, IptvChannel->Rid());
Channels.Unlock();
ChannelsModified |= IptvChannel->SetId(Channels, (newNid < 0) ? IptvChannel->Nid() : newNid,
(newTid < 0) ? IptvChannel->Tid() : newTid,
(newSid < 0) ? IptvChannel->Sid() : newSid, IptvChannel->Rid());
StateKey.Remove(ChannelsModified);
}
if (sidFoundM && nidFoundM && tidFoundM) {
SetChannel(tChannelID::InvalidID);

View File

@@ -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

View File

@@ -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);

View File

@@ -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);
channelP->SetId(NULL, 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);

View File

@@ -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)

View File

@@ -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();