mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 11:37:03 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54a990ffe8 | ||
|
|
53c2026a60 | ||
|
|
dc9f9f2b86 | ||
|
|
688c7db1fc | ||
|
|
591fb8431b | ||
|
|
dab869cf3a | ||
|
|
aaca7cba1a | ||
|
|
935f659e34 | ||
|
|
9839b47229 | ||
|
|
57e0af0ade | ||
|
|
0900e229cf |
24
HISTORY
24
HISTORY
@@ -229,3 +229,27 @@ VDR Plugin 'iptv' Revision History
|
|||||||
2014-03-09: Version 2.0.3
|
2014-03-09: Version 2.0.3
|
||||||
|
|
||||||
- Fixed installation target bugs (Thanks to Alexander Grothe).
|
- Fixed installation target bugs (Thanks to Alexander Grothe).
|
||||||
|
|
||||||
|
|
||||||
|
==================================
|
||||||
|
VDR Plugin 'iptv' Revision History
|
||||||
|
==================================
|
||||||
|
|
||||||
|
2014-02-20: Version 2.1.0
|
||||||
|
|
||||||
|
- Added initial CAM support.
|
||||||
|
- Added missing RTSP/UDP support.
|
||||||
|
|
||||||
|
2014-03-09: Version 2.1.1
|
||||||
|
|
||||||
|
- Fixed installation target bugs (Thanks to Alexander Grothe).
|
||||||
|
|
||||||
|
2014-03-16: Version 2.1.2
|
||||||
|
|
||||||
|
- Updated for vdr-2.1.6.
|
||||||
|
|
||||||
|
2014-05-10: Version 2.1.3
|
||||||
|
|
||||||
|
- Updated the section filtering options.
|
||||||
|
- Removed unnecessary TS buffer settings.
|
||||||
|
- Added RTP packet error detection.
|
||||||
|
|||||||
22
README
22
README
@@ -53,10 +53,12 @@ Setup menu:
|
|||||||
stream ringbuffer before data is
|
stream ringbuffer before data is
|
||||||
transferred to VDR.
|
transferred to VDR.
|
||||||
Valid range: 0...40
|
Valid range: 0...40
|
||||||
- EXT protocol base port = 4321 Defines base port used in EXT protocol.
|
- Protocol base port = 4321 Defines base port used in CURL/EXT
|
||||||
|
protocol. Two ports are defined for
|
||||||
|
each device.
|
||||||
The port range is defined by the number
|
The port range is defined by the number
|
||||||
of IPTV devices (max. 8).
|
of IPTV devices times two (max. 32).
|
||||||
Valid range: 0...65527
|
Valid range: 0...65503
|
||||||
- Use section filtering = 1 Defines whether section filtering shall
|
- Use section filtering = 1 Defines whether section filtering shall
|
||||||
be used.
|
be used.
|
||||||
Valid range: 0...1
|
Valid range: 0...1
|
||||||
@@ -127,11 +129,11 @@ External streaming:
|
|||||||
script parameter is passed to the script and it can be used to select for
|
script parameter is passed to the script and it can be used to select for
|
||||||
example between different URLs.
|
example between different URLs.
|
||||||
|
|
||||||
- When an EXT channel is opened the IPTV plugin opens an UDP listening port
|
- When an EXT or CURL/RTSP channel is opened the IPTV plugin opens an UDP
|
||||||
on the localhost. The external script is responsible for supplying IPTV
|
listening port on the localhost. The external script is responsible for
|
||||||
plugin with MPEG2 TS data in UDP/RTP format to the listening port. The
|
supplying IPTV plugin with MPEG2 TS data in UDP/RTP format to the listening
|
||||||
data will be processed in VDR like a normal DVB broadcast. The listening
|
port. The data will be processed in VDR like a normal DVB broadcast. The
|
||||||
base port can be specified in the plugin configuration menu.
|
listening base port can be specified in the plugin configuration menu.
|
||||||
|
|
||||||
- Each IPTV device has different listen port. The port number is specified
|
- Each IPTV device has different listen port. The port number is specified
|
||||||
as a base port number plus IPTV device index minus one. Maximum of 8 IPTV
|
as a base port number plus IPTV device index minus one. Maximum of 8 IPTV
|
||||||
@@ -175,8 +177,8 @@ Notes:
|
|||||||
IGMP v3 protocol:
|
IGMP v3 protocol:
|
||||||
"U=<source address>@<group address>"
|
"U=<source address>@<group address>"
|
||||||
|
|
||||||
- The CURL implementation supports only HTTP/HTTPS protocols and an optional
|
- The CURL implementation supports only RTSP/HTTP/HTTPS protocols and an
|
||||||
netrc configuration file for authentication:
|
optional netrc configuration file for authentication:
|
||||||
$(CONFDIR)/iptv/netrc
|
$(CONFDIR)/iptv/netrc
|
||||||
|
|
||||||
- You can quite easily figure out correct DVB triplet values by using the
|
- You can quite easily figure out correct DVB triplet values by using the
|
||||||
|
|||||||
14
common.c
14
common.c
@@ -75,12 +75,10 @@ cString ChangeCase(const cString &strP, bool upperP)
|
|||||||
|
|
||||||
const section_filter_table_type section_filter_table[SECTION_FILTER_TABLE_SIZE] =
|
const section_filter_table_type section_filter_table[SECTION_FILTER_TABLE_SIZE] =
|
||||||
{
|
{
|
||||||
/* description tag pid tid mask */
|
/* description tag pid tid mask */
|
||||||
{trNOOP("PAT (0x00)"), "PAT", 0x00, 0x00, 0xFF},
|
{trNOOP("PAT (0x00)"), "PAT", 0x00, 0x00, 0xFF},
|
||||||
{trNOOP("NIT (0x40)"), "NIT", 0x10, 0x40, 0xFF},
|
{trNOOP("NIT (0x40)"), "NIT", 0x10, 0x40, 0xFF},
|
||||||
{trNOOP("SDT (0x42)"), "SDT", 0x11, 0x42, 0xFF},
|
{trNOOP("SDT (0x42)"), "SDT", 0x11, 0x42, 0xFF},
|
||||||
{trNOOP("EIT (0x4E/0x4F)"), "EIT", 0x12, 0x4E, 0xFE},
|
{trNOOP("EIT (0x4E/0x4F/0x5X/0x6X)"), "EIT", 0x12, 0x40, 0xC0},
|
||||||
{trNOOP("EIT (0x5X)"), "EIT", 0x12, 0x50, 0xF0},
|
{trNOOP("TDT (0x70)"), "TDT", 0x14, 0x70, 0xFF},
|
||||||
{trNOOP("EIT (0x6X)"), "EIT", 0x12, 0x60, 0xF0},
|
|
||||||
{trNOOP("TDT (0x70)"), "TDT", 0x14, 0x70, 0xFF},
|
|
||||||
};
|
};
|
||||||
|
|||||||
4
common.h
4
common.h
@@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
#define ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
|
#define ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
|
||||||
|
|
||||||
|
#define IPTV_BUFFER_SIZE MEGABYTE(1)
|
||||||
|
|
||||||
#define IPTV_DVR_FILENAME "/tmp/vdr-iptv%d.dvr"
|
#define IPTV_DVR_FILENAME "/tmp/vdr-iptv%d.dvr"
|
||||||
|
|
||||||
#define IPTV_SOURCE_CHARACTER 'I'
|
#define IPTV_SOURCE_CHARACTER 'I'
|
||||||
@@ -38,7 +40,7 @@
|
|||||||
#define IPTV_STATS_ACTIVE_PIDS_COUNT 10
|
#define IPTV_STATS_ACTIVE_PIDS_COUNT 10
|
||||||
#define IPTV_STATS_ACTIVE_FILTERS_COUNT 10
|
#define IPTV_STATS_ACTIVE_FILTERS_COUNT 10
|
||||||
|
|
||||||
#define SECTION_FILTER_TABLE_SIZE 7
|
#define SECTION_FILTER_TABLE_SIZE 5
|
||||||
|
|
||||||
#define ERROR_IF_FUNC(exp, errstr, func, ret) \
|
#define ERROR_IF_FUNC(exp, errstr, func, ret) \
|
||||||
do { \
|
do { \
|
||||||
|
|||||||
4
config.c
4
config.c
@@ -10,9 +10,7 @@
|
|||||||
cIptvConfig IptvConfig;
|
cIptvConfig IptvConfig;
|
||||||
|
|
||||||
cIptvConfig::cIptvConfig(void)
|
cIptvConfig::cIptvConfig(void)
|
||||||
: tsBufferSizeM(2),
|
: protocolBasePortM(4321),
|
||||||
tsBufferPrefillRatioM(0),
|
|
||||||
extProtocolBasePortM(4321),
|
|
||||||
useBytesM(1),
|
useBytesM(1),
|
||||||
sectionFilteringM(1)
|
sectionFilteringM(1)
|
||||||
{
|
{
|
||||||
|
|||||||
12
config.h
12
config.h
@@ -14,9 +14,7 @@
|
|||||||
class cIptvConfig
|
class cIptvConfig
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
unsigned int tsBufferSizeM;
|
unsigned int protocolBasePortM;
|
||||||
unsigned int tsBufferPrefillRatioM;
|
|
||||||
unsigned int extProtocolBasePortM;
|
|
||||||
unsigned int useBytesM;
|
unsigned int useBytesM;
|
||||||
unsigned int sectionFilteringM;
|
unsigned int sectionFilteringM;
|
||||||
int disabledFiltersM[SECTION_FILTER_TABLE_SIZE];
|
int disabledFiltersM[SECTION_FILTER_TABLE_SIZE];
|
||||||
@@ -25,18 +23,14 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
cIptvConfig();
|
cIptvConfig();
|
||||||
unsigned int GetTsBufferSize(void) const { return tsBufferSizeM; }
|
unsigned int GetProtocolBasePort(void) const { return protocolBasePortM; }
|
||||||
unsigned int GetTsBufferPrefillRatio(void) const { return tsBufferPrefillRatioM; }
|
|
||||||
unsigned int GetExtProtocolBasePort(void) const { return extProtocolBasePortM; }
|
|
||||||
unsigned int GetUseBytes(void) const { return useBytesM; }
|
unsigned int GetUseBytes(void) const { return useBytesM; }
|
||||||
unsigned int GetSectionFiltering(void) const { return sectionFilteringM; }
|
unsigned int GetSectionFiltering(void) const { return sectionFilteringM; }
|
||||||
const char *GetConfigDirectory(void) const { return configDirectoryM; }
|
const char *GetConfigDirectory(void) const { return configDirectoryM; }
|
||||||
const char *GetResourceDirectory(void) const { return resourceDirectoryM; }
|
const char *GetResourceDirectory(void) const { return resourceDirectoryM; }
|
||||||
unsigned int GetDisabledFiltersCount(void) const;
|
unsigned int GetDisabledFiltersCount(void) const;
|
||||||
int GetDisabledFilters(unsigned int indexP) const;
|
int GetDisabledFilters(unsigned int indexP) const;
|
||||||
void SetTsBufferSize(unsigned int sizeP) { tsBufferSizeM = sizeP; }
|
void SetProtocolBasePort(unsigned int portNumberP) { protocolBasePortM = portNumberP; }
|
||||||
void SetTsBufferPrefillRatio(unsigned int ratioP) { tsBufferPrefillRatioM = ratioP; }
|
|
||||||
void SetExtProtocolBasePort(unsigned int portNumberP) { extProtocolBasePortM = portNumberP; }
|
|
||||||
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
|
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
|
||||||
void SetSectionFiltering(unsigned int onOffP) { sectionFilteringM = onOffP; }
|
void SetSectionFiltering(unsigned int onOffP) { sectionFilteringM = onOffP; }
|
||||||
void SetDisabledFilters(unsigned int indexP, int numberP);
|
void SetDisabledFilters(unsigned int indexP, int numberP);
|
||||||
|
|||||||
106
device.c
106
device.c
@@ -22,7 +22,7 @@ cIptvDevice::cIptvDevice(unsigned int indexP)
|
|||||||
pidScanEnabledM(false),
|
pidScanEnabledM(false),
|
||||||
channelM()
|
channelM()
|
||||||
{
|
{
|
||||||
unsigned int bufsize = (unsigned int)MEGABYTE(IptvConfig.GetTsBufferSize());
|
unsigned int bufsize = (unsigned int)IPTV_BUFFER_SIZE;
|
||||||
bufsize -= (bufsize % TS_SIZE);
|
bufsize -= (bufsize % TS_SIZE);
|
||||||
isyslog("creating IPTV device %d (CardIndex=%d)", deviceIndexM, CardIndex());
|
isyslog("creating IPTV device %d (CardIndex=%d)", deviceIndexM, CardIndex());
|
||||||
tsBufferM = new cRingBufferLinear(bufsize + 1, TS_SIZE, false,
|
tsBufferM = new cRingBufferLinear(bufsize + 1, TS_SIZE, false,
|
||||||
@@ -32,7 +32,6 @@ cIptvDevice::cIptvDevice(unsigned int indexP)
|
|||||||
tsBufferM->SetIoThrottle();
|
tsBufferM->SetIoThrottle();
|
||||||
pIptvStreamerM = new cIptvStreamer(*this, tsBufferM->Free());
|
pIptvStreamerM = new cIptvStreamer(*this, tsBufferM->Free());
|
||||||
}
|
}
|
||||||
ResetBuffering();
|
|
||||||
pUdpProtocolM = new cIptvProtocolUdp();
|
pUdpProtocolM = new cIptvProtocolUdp();
|
||||||
pCurlProtocolM = new cIptvProtocolCurl();
|
pCurlProtocolM = new cIptvProtocolCurl();
|
||||||
pHttpProtocolM = new cIptvProtocolHttp();
|
pHttpProtocolM = new cIptvProtocolHttp();
|
||||||
@@ -293,7 +292,7 @@ bool cIptvDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
|
|||||||
}
|
}
|
||||||
sidScanEnabledM = itp.SidScan() ? true : false;
|
sidScanEnabledM = itp.SidScan() ? true : false;
|
||||||
pidScanEnabledM = itp.PidScan() ? true : false;
|
pidScanEnabledM = itp.PidScan() ? true : false;
|
||||||
if (pIptvStreamerM->Set(itp.Address(), itp.Parameter(), deviceIndexM, protocol)) {
|
if (pIptvStreamerM && pIptvStreamerM->SetSource(itp.Address(), itp.Parameter(), deviceIndexM, protocol)) {
|
||||||
channelM = *channelP;
|
channelM = *channelP;
|
||||||
if (sidScanEnabledM && pSidScannerM && IptvConfig.GetSectionFiltering())
|
if (sidScanEnabledM && pSidScannerM && IptvConfig.GetSectionFiltering())
|
||||||
pSidScannerM->SetChannel(channelM.GetChannelID());
|
pSidScannerM->SetChannel(channelM.GetChannelID());
|
||||||
@@ -305,23 +304,31 @@ bool cIptvDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
|
|||||||
|
|
||||||
bool cIptvDevice::SetPid(cPidHandle *handleP, int typeP, bool onP)
|
bool cIptvDevice::SetPid(cPidHandle *handleP, int typeP, bool onP)
|
||||||
{
|
{
|
||||||
debug("cIptvDevice::%s(%d): pid=%d type=%d on=%d", __FUNCTION__, deviceIndexM, handleP->pid, typeP, onP);
|
debug("cIptvDevice::%s(%d): pid=%d type=%d on=%d", __FUNCTION__, deviceIndexM, handleP ? handleP->pid : -1, typeP, onP);
|
||||||
|
if (pIptvStreamerM && handleP)
|
||||||
|
return pIptvStreamerM->SetPid(handleP->pid, typeP, onP);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cIptvDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP)
|
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);
|
//debug("cIptvDevice::%s(%d): pid=%d tid=%d mask=%d", __FUNCTION__, deviceIndexM, pidP, tidP, maskP);
|
||||||
if (pIptvSectionM && IptvConfig.GetSectionFiltering())
|
if (pIptvSectionM && IptvConfig.GetSectionFiltering()) {
|
||||||
|
if (pIptvStreamerM)
|
||||||
|
pIptvStreamerM->SetPid(pidP, ptOther, true);
|
||||||
return pIptvSectionM->Open(pidP, tidP, maskP);
|
return pIptvSectionM->Open(pidP, tidP, maskP);
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cIptvDevice::CloseFilter(int handleP)
|
void cIptvDevice::CloseFilter(int handleP)
|
||||||
{
|
{
|
||||||
//debug("cIptvDevice::%s(%d): handle=%d", __FUNCTION__, deviceIndexM, handleP);
|
//debug("cIptvDevice::%s(%d): handle=%d", __FUNCTION__, deviceIndexM, handleP);
|
||||||
if (pIptvSectionM)
|
if (pIptvSectionM) {
|
||||||
|
if (pIptvStreamerM)
|
||||||
|
pIptvStreamerM->SetPid(pIptvSectionM->GetPid(handleP), ptOther, false);
|
||||||
pIptvSectionM->Close(handleP);
|
pIptvSectionM->Close(handleP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvDevice::OpenDvr(void)
|
bool cIptvDevice::OpenDvr(void)
|
||||||
@@ -329,7 +336,6 @@ bool cIptvDevice::OpenDvr(void)
|
|||||||
debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||||
isPacketDeliveredM = false;
|
isPacketDeliveredM = false;
|
||||||
tsBufferM->Clear();
|
tsBufferM->Clear();
|
||||||
ResetBuffering();
|
|
||||||
if (pIptvStreamerM)
|
if (pIptvStreamerM)
|
||||||
pIptvStreamerM->Open();
|
pIptvStreamerM->Open();
|
||||||
if (sidScanEnabledM && pSidScannerM && IptvConfig.GetSectionFiltering())
|
if (sidScanEnabledM && pSidScannerM && IptvConfig.GetSectionFiltering())
|
||||||
@@ -355,31 +361,12 @@ void cIptvDevice::CloseDvr(void)
|
|||||||
bool cIptvDevice::HasLock(int timeoutMsP) const
|
bool cIptvDevice::HasLock(int timeoutMsP) const
|
||||||
{
|
{
|
||||||
//debug("cIptvDevice::%s(%d): timeoutMs=%d", __FUNCTION__, deviceIndexM, timeoutMsP);
|
//debug("cIptvDevice::%s(%d): timeoutMs=%d", __FUNCTION__, deviceIndexM, timeoutMsP);
|
||||||
return (!IsBuffering());
|
return (pIptvStreamerM && pIptvStreamerM->Active());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvDevice::HasInternalCam(void)
|
bool cIptvDevice::HasInternalCam(void)
|
||||||
{
|
{
|
||||||
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cIptvDevice::ResetBuffering(void)
|
|
||||||
{
|
|
||||||
debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
|
||||||
// Pad prefill to multiple of TS_SIZE
|
|
||||||
tsBufferPrefillM = (unsigned int)MEGABYTE(IptvConfig.GetTsBufferSize()) *
|
|
||||||
IptvConfig.GetTsBufferPrefillRatio() / 100;
|
|
||||||
tsBufferPrefillM -= (tsBufferPrefillM % TS_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cIptvDevice::IsBuffering(void) const
|
|
||||||
{
|
|
||||||
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
|
||||||
if (tsBufferPrefillM && tsBufferM && tsBufferM->Available() < tsBufferPrefillM)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
tsBufferPrefillM = 0;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,39 +396,66 @@ unsigned int cIptvDevice::CheckData(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvDevice::GetTSPacket(uchar *&Data)
|
uchar *cIptvDevice::GetData(int *availableP)
|
||||||
{
|
{
|
||||||
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||||
if (isOpenDvrM && tsBufferM && !IsBuffering()) {
|
if (isOpenDvrM && tsBufferM) {
|
||||||
if (isPacketDeliveredM) {
|
int count = 0;
|
||||||
tsBufferM->Del(TS_SIZE);
|
if (isPacketDeliveredM)
|
||||||
isPacketDeliveredM = false;
|
SkipData(TS_SIZE);
|
||||||
// Update buffer statistics
|
uchar *p = tsBufferM->Get(count);
|
||||||
AddBufferStatistic(TS_SIZE, tsBufferM->Available());
|
if (p && count >= TS_SIZE) {
|
||||||
}
|
|
||||||
int Count = 0;
|
|
||||||
uchar *p = tsBufferM->Get(Count);
|
|
||||||
if (p && Count >= TS_SIZE) {
|
|
||||||
if (*p != TS_SYNC_BYTE) {
|
if (*p != TS_SYNC_BYTE) {
|
||||||
for (int i = 1; i < Count; i++) {
|
for (int i = 1; i < count; i++) {
|
||||||
if (p[i] == TS_SYNC_BYTE) {
|
if (p[i] == TS_SYNC_BYTE) {
|
||||||
Count = i;
|
count = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tsBufferM->Del(Count);
|
tsBufferM->Del(count);
|
||||||
error("Skipped %d bytes to sync on TS packet", Count);
|
info("Skipped %d bytes to sync on TS packet", count);
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
isPacketDeliveredM = true;
|
isPacketDeliveredM = true;
|
||||||
Data = p;
|
if (availableP)
|
||||||
|
*availableP = count;
|
||||||
// Update pid statistics
|
// Update pid statistics
|
||||||
AddPidStatistic(ts_pid(p), payload(p));
|
AddPidStatistic(ts_pid(p), payload(p));
|
||||||
return true;
|
return p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cIptvDevice::SkipData(int countP)
|
||||||
|
{
|
||||||
|
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||||
|
tsBufferM->Del(countP);
|
||||||
|
isPacketDeliveredM = false;
|
||||||
|
// Update buffer statistics
|
||||||
|
AddBufferStatistic(countP, tsBufferM->Available());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cIptvDevice::GetTSPacket(uchar *&dataP)
|
||||||
|
{
|
||||||
|
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||||
|
if (tsBufferM) {
|
||||||
|
if (cCamSlot *cs = CamSlot()) {
|
||||||
|
if (cs->WantsTsData()) {
|
||||||
|
int available;
|
||||||
|
dataP = GetData(&available);
|
||||||
|
if (dataP) {
|
||||||
|
dataP = cs->Decrypt(dataP, available);
|
||||||
|
SkipData(available);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataP = GetData();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// Reduce cpu load by preventing busylooping
|
// Reduce cpu load by preventing busylooping
|
||||||
cCondWait::SleepMs(10);
|
cCondWait::SleepMs(10);
|
||||||
Data = NULL;
|
dataP = NULL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
10
device.h
10
device.h
@@ -40,7 +40,6 @@ private:
|
|||||||
bool sidScanEnabledM;
|
bool sidScanEnabledM;
|
||||||
bool pidScanEnabledM;
|
bool pidScanEnabledM;
|
||||||
cRingBufferLinear *tsBufferM;
|
cRingBufferLinear *tsBufferM;
|
||||||
mutable int tsBufferPrefillM;
|
|
||||||
cChannel channelM;
|
cChannel channelM;
|
||||||
cIptvProtocolUdp *pUdpProtocolM;
|
cIptvProtocolUdp *pUdpProtocolM;
|
||||||
cIptvProtocolCurl *pCurlProtocolM;
|
cIptvProtocolCurl *pCurlProtocolM;
|
||||||
@@ -69,11 +68,6 @@ private:
|
|||||||
cString GetPidsInformation(void);
|
cString GetPidsInformation(void);
|
||||||
cString GetFiltersInformation(void);
|
cString GetFiltersInformation(void);
|
||||||
|
|
||||||
// for channel parsing & buffering
|
|
||||||
private:
|
|
||||||
void ResetBuffering(void);
|
|
||||||
bool IsBuffering(void) const;
|
|
||||||
|
|
||||||
// for channel info
|
// for channel info
|
||||||
public:
|
public:
|
||||||
virtual cString DeviceType(void) const;
|
virtual cString DeviceType(void) const;
|
||||||
@@ -96,6 +90,10 @@ protected:
|
|||||||
virtual bool SetChannelDevice(const cChannel *channelP, bool liveViewP);
|
virtual bool SetChannelDevice(const cChannel *channelP, bool liveViewP);
|
||||||
|
|
||||||
// for recording
|
// for recording
|
||||||
|
private:
|
||||||
|
uchar *GetData(int *availableP = NULL);
|
||||||
|
void SkipData(int countP);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool SetPid(cPidHandle *handleP, int typeP, bool onP);
|
virtual bool SetPid(cPidHandle *handleP, int typeP, bool onP);
|
||||||
virtual bool OpenDvr(void);
|
virtual bool OpenDvr(void);
|
||||||
|
|||||||
23
iptv.c
23
iptv.c
@@ -13,15 +13,15 @@
|
|||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "iptvservice.h"
|
#include "iptvservice.h"
|
||||||
|
|
||||||
#if defined(APIVERSNUM) && APIVERSNUM < 20000
|
#if defined(APIVERSNUM) && APIVERSNUM < 20106
|
||||||
#error "VDR-2.0.0 API version or greater is required!"
|
#error "VDR-2.1.6 API version or greater is required!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GITVERSION
|
#ifndef GITVERSION
|
||||||
#define GITVERSION ""
|
#define GITVERSION ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char VERSION[] = "2.0.3" GITVERSION;
|
const char VERSION[] = "2.1.3" GITVERSION;
|
||||||
static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
|
static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
|
||||||
|
|
||||||
class cPluginIptv : public cPlugin {
|
class cPluginIptv : public cPlugin {
|
||||||
@@ -110,7 +110,14 @@ bool cPluginIptv::Start(void)
|
|||||||
// Start any background activities the plugin shall perform.
|
// Start any background activities the plugin shall perform.
|
||||||
if (curl_global_init(CURL_GLOBAL_ALL) == CURLE_OK) {
|
if (curl_global_init(CURL_GLOBAL_ALL) == CURLE_OK) {
|
||||||
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
|
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
|
||||||
info("Using CURL %s", data->version);
|
cString info = cString::sprintf("Using CURL %s", data->version);
|
||||||
|
for (int i = 0; data->protocols[i]; ++i) {
|
||||||
|
// Supported protocols: HTTP(S), RTSP, FILE
|
||||||
|
if (startswith(data->protocols[i], "http") || startswith(data->protocols[i], "rtsp") ||
|
||||||
|
startswith(data->protocols[i], "file"))
|
||||||
|
info = cString::sprintf("%s %s", *info, data->protocols[i]);
|
||||||
|
}
|
||||||
|
info("%s", *info);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -185,12 +192,8 @@ bool cPluginIptv::SetupParse(const char *nameP, const char *valueP)
|
|||||||
{
|
{
|
||||||
debug("cPluginIptv::%s()", __FUNCTION__);
|
debug("cPluginIptv::%s()", __FUNCTION__);
|
||||||
// Parse your own setup parameters and store their values.
|
// Parse your own setup parameters and store their values.
|
||||||
if (!strcasecmp(nameP, "TsBufferSize"))
|
if (!strcasecmp(nameP, "ExtProtocolBasePort"))
|
||||||
IptvConfig.SetTsBufferSize(atoi(valueP));
|
IptvConfig.SetProtocolBasePort(atoi(valueP));
|
||||||
else if (!strcasecmp(nameP, "TsBufferPrefill"))
|
|
||||||
IptvConfig.SetTsBufferPrefillRatio(atoi(valueP));
|
|
||||||
else if (!strcasecmp(nameP, "ExtProtocolBasePort"))
|
|
||||||
IptvConfig.SetExtProtocolBasePort(atoi(valueP));
|
|
||||||
else if (!strcasecmp(nameP, "SectionFiltering"))
|
else if (!strcasecmp(nameP, "SectionFiltering"))
|
||||||
IptvConfig.SetSectionFiltering(atoi(valueP));
|
IptvConfig.SetSectionFiltering(atoi(valueP));
|
||||||
else if (!strcasecmp(nameP, "DisabledFilters")) {
|
else if (!strcasecmp(nameP, "DisabledFilters")) {
|
||||||
|
|||||||
48
po/de_DE.po
48
po/de_DE.po
@@ -5,10 +5,10 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: vdr-iptv 2.0.3\n"
|
"Project-Id-Version: vdr-iptv 2.1.3\n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\n"
|
"Report-Msgid-Bugs-To: <see README>\n"
|
||||||
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
|
"POT-Creation-Date: 2014-05-10 05:10+0200\n"
|
||||||
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
|
"PO-Revision-Date: 2014-05-10 05:10+0200\n"
|
||||||
"Last-Translator: Tobias Grimm <tg@e-tobi.net>\n"
|
"Last-Translator: Tobias Grimm <tg@e-tobi.net>\n"
|
||||||
"Language-Team: German <vdr@linuxtv.org>\n"
|
"Language-Team: German <vdr@linuxtv.org>\n"
|
||||||
"Language: de\n"
|
"Language: de\n"
|
||||||
@@ -26,14 +26,8 @@ msgstr "NIT (0x40)"
|
|||||||
msgid "SDT (0x42)"
|
msgid "SDT (0x42)"
|
||||||
msgstr "SDT (0x42)"
|
msgstr "SDT (0x42)"
|
||||||
|
|
||||||
msgid "EIT (0x4E/0x4F)"
|
msgid "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||||
msgstr "EIT (0x4E/0x4F)"
|
msgstr "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||||
|
|
||||||
msgid "EIT (0x5X)"
|
|
||||||
msgstr "EIT (0x5X)"
|
|
||||||
|
|
||||||
msgid "EIT (0x6X)"
|
|
||||||
msgstr "EIT (0x6X)"
|
|
||||||
|
|
||||||
msgid "TDT (0x70)"
|
msgid "TDT (0x70)"
|
||||||
msgstr "TDT (0x70)"
|
msgstr "TDT (0x70)"
|
||||||
@@ -59,31 +53,13 @@ msgstr "Bits/Bytes"
|
|||||||
msgid "IPTV information not available!"
|
msgid "IPTV information not available!"
|
||||||
msgstr "IPTV Informationen nicht verfügbar!"
|
msgstr "IPTV Informationen nicht verfügbar!"
|
||||||
|
|
||||||
msgid "TS buffer size [MB]"
|
msgid "Protocol base port"
|
||||||
msgstr "TS Puffergröße [MB]"
|
msgstr "Protokoll Basisport"
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
"Define a ringbuffer size for transport streams in megabytes.\n"
|
"Define a base port used by CURL/EXT protocol.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Smaller sizes help memory consumption, but are more prone to buffer overflows."
|
"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 ""
|
|
||||||
|
|
||||||
msgid "TS buffer prefill ratio [%]"
|
|
||||||
msgstr "TS Puffer-Preload [%]"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
|
|
||||||
"\n"
|
|
||||||
"This is useful if streaming media over a slow or unreliable connection."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "EXT protocol base port"
|
|
||||||
msgstr "EXT Protokoll Basisport"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Define a base port used by EXT protocol.\n"
|
|
||||||
"\n"
|
|
||||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "Use section filtering"
|
msgid "Use section filtering"
|
||||||
@@ -130,12 +106,6 @@ msgstr "DATEI"
|
|||||||
msgid "EXT"
|
msgid "EXT"
|
||||||
msgstr "EXT"
|
msgstr "EXT"
|
||||||
|
|
||||||
msgid "Nid"
|
|
||||||
msgstr "Nid"
|
|
||||||
|
|
||||||
msgid "Tid"
|
|
||||||
msgstr "Tid"
|
|
||||||
|
|
||||||
msgid "Rid"
|
msgid "Rid"
|
||||||
msgstr "Rid"
|
msgstr "Rid"
|
||||||
|
|
||||||
|
|||||||
58
po/fi_FI.po
58
po/fi_FI.po
@@ -5,10 +5,10 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: vdr-iptv 2.0.3\n"
|
"Project-Id-Version: vdr-iptv 2.1.3\n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\n"
|
"Report-Msgid-Bugs-To: <see README>\n"
|
||||||
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
|
"POT-Creation-Date: 2014-05-10 05:10+0200\n"
|
||||||
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
|
"PO-Revision-Date: 2014-05-10 05:10+0200\n"
|
||||||
"Last-Translator: Rolf Ahrenberg\n"
|
"Last-Translator: Rolf Ahrenberg\n"
|
||||||
"Language-Team: Finnish <vdr@linuxtv.org>\n"
|
"Language-Team: Finnish <vdr@linuxtv.org>\n"
|
||||||
"Language: fi\n"
|
"Language: fi\n"
|
||||||
@@ -25,14 +25,8 @@ msgstr "NIT (0x40)"
|
|||||||
msgid "SDT (0x42)"
|
msgid "SDT (0x42)"
|
||||||
msgstr "SDT (0x42)"
|
msgstr "SDT (0x42)"
|
||||||
|
|
||||||
msgid "EIT (0x4E/0x4F)"
|
msgid "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||||
msgstr "EIT (0x4E/0x4F)"
|
msgstr "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||||
|
|
||||||
msgid "EIT (0x5X)"
|
|
||||||
msgstr "EIT (0x5X)"
|
|
||||||
|
|
||||||
msgid "EIT (0x6X)"
|
|
||||||
msgstr "EIT (0x6X)"
|
|
||||||
|
|
||||||
msgid "TDT (0x70)"
|
msgid "TDT (0x70)"
|
||||||
msgstr "TDT (0x70)"
|
msgstr "TDT (0x70)"
|
||||||
@@ -58,41 +52,17 @@ msgstr "Bitit/tavut"
|
|||||||
msgid "IPTV information not available!"
|
msgid "IPTV information not available!"
|
||||||
msgstr "IPTV-tietoja ei saatavilla!"
|
msgstr "IPTV-tietoja ei saatavilla!"
|
||||||
|
|
||||||
msgid "TS buffer size [MB]"
|
msgid "Protocol base port"
|
||||||
msgstr "TS-puskurin koko [MB]"
|
msgstr "Protokollan perusportti"
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
"Define a ringbuffer size for transport streams in megabytes.\n"
|
"Define a base port used by CURL/EXT protocol.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Smaller sizes help memory consumption, but are more prone to buffer overflows."
|
"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 ""
|
msgstr ""
|
||||||
"Määritä rengaspuskurin koko TS-lähetteelle megatavuina.\n"
|
"Määrittele protokollan käyttämä perusportti.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Pienempi rengaspuskuri vähentää muistinkulutusta, mutta on virhealttiimpi puskurin ylivuodolle."
|
"Porttiavaruuden koko määräytyy käytettyjen IPTV-laitteiden mukaan. Laajennos lukee CURL/EXT-protokollan yhteydessä perusportista dataa, jota ulkoiset ohjelmistot tarjoavat."
|
||||||
|
|
||||||
msgid "TS buffer prefill ratio [%]"
|
|
||||||
msgstr "TS-puskurin esitäyttöaste [%]"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
|
|
||||||
"\n"
|
|
||||||
"This is useful if streaming media over a slow or unreliable connection."
|
|
||||||
msgstr ""
|
|
||||||
"Määrittele TS-rengaspuskurin esitäyttöaste, jonka jälkeen lähetettä aletaan siirtämään eteenpäin VDR:lle.\n"
|
|
||||||
"\n"
|
|
||||||
"Puskurin esitäyttö parantaa suoratoistoa hitailla ja epäluotettavilla yhteyksillä."
|
|
||||||
|
|
||||||
msgid "EXT protocol base port"
|
|
||||||
msgstr "EXT-protokollan perusportti"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Define a base port used by EXT protocol.\n"
|
|
||||||
"\n"
|
|
||||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
|
|
||||||
msgstr ""
|
|
||||||
"Määrittele EXT-protokollan käyttämä perusportti.\n"
|
|
||||||
"\n"
|
|
||||||
"Porttiavaruuden koko määräytyy käytettyjen IPTV-laitteiden mukaan. Laajennos lukee EXT-protokollan yhteydessä perusportista dataa, jota ulkoiset ohjelmistot tarjoavat."
|
|
||||||
|
|
||||||
msgid "Use section filtering"
|
msgid "Use section filtering"
|
||||||
msgstr "Käytä sektioiden suodatusta"
|
msgstr "Käytä sektioiden suodatusta"
|
||||||
@@ -145,12 +115,6 @@ msgstr "FILE"
|
|||||||
msgid "EXT"
|
msgid "EXT"
|
||||||
msgstr "EXT"
|
msgstr "EXT"
|
||||||
|
|
||||||
msgid "Nid"
|
|
||||||
msgstr "Verkko-ID"
|
|
||||||
|
|
||||||
msgid "Tid"
|
|
||||||
msgstr "Lähete-ID"
|
|
||||||
|
|
||||||
msgid "Rid"
|
msgid "Rid"
|
||||||
msgstr "Radio-ID"
|
msgstr "Radio-ID"
|
||||||
|
|
||||||
|
|||||||
58
po/fr_FR.po
58
po/fr_FR.po
@@ -6,10 +6,10 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: vdr-iptv 2.0.3\n"
|
"Project-Id-Version: vdr-iptv 2.1.3\n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\n"
|
"Report-Msgid-Bugs-To: <see README>\n"
|
||||||
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
|
"POT-Creation-Date: 2014-05-10 05:10+0200\n"
|
||||||
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
|
"PO-Revision-Date: 2014-05-10 05:10+0200\n"
|
||||||
"Last-Translator: NIVAL Michaël <mnival@club-internet.fr>\n"
|
"Last-Translator: NIVAL Michaël <mnival@club-internet.fr>\n"
|
||||||
"Language-Team: French <vdr@linuxtv.org>\n"
|
"Language-Team: French <vdr@linuxtv.org>\n"
|
||||||
"Language: fr\n"
|
"Language: fr\n"
|
||||||
@@ -27,14 +27,8 @@ msgstr "NIT (0x40)"
|
|||||||
msgid "SDT (0x42)"
|
msgid "SDT (0x42)"
|
||||||
msgstr "SDT (0x42)"
|
msgstr "SDT (0x42)"
|
||||||
|
|
||||||
msgid "EIT (0x4E/0x4F)"
|
msgid "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||||
msgstr "EIT (0x4E/0x4F)"
|
msgstr "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||||
|
|
||||||
msgid "EIT (0x5X)"
|
|
||||||
msgstr "EIT (0x5X)"
|
|
||||||
|
|
||||||
msgid "EIT (0x6X)"
|
|
||||||
msgstr "EIT (0x6X)"
|
|
||||||
|
|
||||||
msgid "TDT (0x70)"
|
msgid "TDT (0x70)"
|
||||||
msgstr "TDT (0x70)"
|
msgstr "TDT (0x70)"
|
||||||
@@ -60,41 +54,17 @@ msgstr "Bits/Bytes"
|
|||||||
msgid "IPTV information not available!"
|
msgid "IPTV information not available!"
|
||||||
msgstr "Information sur IPTV non disponible !"
|
msgstr "Information sur IPTV non disponible !"
|
||||||
|
|
||||||
msgid "TS buffer size [MB]"
|
msgid "Protocol base port"
|
||||||
msgstr "Taille du buffer TS [MB]"
|
msgstr "Port de base du protocole"
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
"Define a ringbuffer size for transport streams in megabytes.\n"
|
"Define a base port used by CURL/EXT protocol.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Smaller sizes help memory consumption, but are more prone to buffer overflows."
|
"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 ""
|
msgstr ""
|
||||||
"Définit la taille du ringbuffer pour le transport du flux en megabytes.\n"
|
"Définit le port de base utilisé par le protocole CURL/EXT.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Une taille plus petite taille aide la consommation de mémoire, mais c'est sujet à plus de débordement de tampon."
|
"La plage de port est défini par le nombre de dispositif IPTV. Ce paramètre défini le port qui est écouté pour les connexions à partir d'applications externes en utilisant le protocole CURL/EXT."
|
||||||
|
|
||||||
msgid "TS buffer prefill ratio [%]"
|
|
||||||
msgstr "Taux du buffer de pré-remplissage TS [%]"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
|
|
||||||
"\n"
|
|
||||||
"This is useful if streaming media over a slow or unreliable connection."
|
|
||||||
msgstr ""
|
|
||||||
"Définit le ratio de pré-remplissage du ringbuffer pour le transport du flux avant transfert dans VDR.\n"
|
|
||||||
"\n"
|
|
||||||
"Cette option est utile si le streaming est sur une connexion lente ou peu fiables."
|
|
||||||
|
|
||||||
msgid "EXT protocol base port"
|
|
||||||
msgstr "Port de base du protocole EXT"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Define a base port used by EXT protocol.\n"
|
|
||||||
"\n"
|
|
||||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
|
|
||||||
msgstr ""
|
|
||||||
"Définit le port de base utilisé par le protocole EXT.\n"
|
|
||||||
"\n"
|
|
||||||
"La plage de port est défini par le nombre de dispositif IPTV. Ce paramètre défini le port qui est écouté pour les connexions à partir d'applications externes en utilisant le protocole EXT."
|
|
||||||
|
|
||||||
msgid "Use section filtering"
|
msgid "Use section filtering"
|
||||||
msgstr "Utiliser le filtrage de section"
|
msgstr "Utiliser le filtrage de section"
|
||||||
@@ -147,12 +117,6 @@ msgstr "FICHIER"
|
|||||||
msgid "EXT"
|
msgid "EXT"
|
||||||
msgstr "EXT"
|
msgstr "EXT"
|
||||||
|
|
||||||
msgid "Nid"
|
|
||||||
msgstr "Nid"
|
|
||||||
|
|
||||||
msgid "Tid"
|
|
||||||
msgstr "Tid"
|
|
||||||
|
|
||||||
msgid "Rid"
|
msgid "Rid"
|
||||||
msgstr "Rid"
|
msgstr "Rid"
|
||||||
|
|
||||||
|
|||||||
58
po/it_IT.po
58
po/it_IT.po
@@ -5,10 +5,10 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: vdr-iptv 2.0.3\n"
|
"Project-Id-Version: vdr-iptv 2.1.3\n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\n"
|
"Report-Msgid-Bugs-To: <see README>\n"
|
||||||
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
|
"POT-Creation-Date: 2014-05-10 05:10+0200\n"
|
||||||
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
|
"PO-Revision-Date: 2014-05-10 05:10+0200\n"
|
||||||
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
|
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
|
||||||
"Language-Team: Italian <vdr@linuxtv.org>\n"
|
"Language-Team: Italian <vdr@linuxtv.org>\n"
|
||||||
"Language: it\n"
|
"Language: it\n"
|
||||||
@@ -26,14 +26,8 @@ msgstr "NIT (0x40)"
|
|||||||
msgid "SDT (0x42)"
|
msgid "SDT (0x42)"
|
||||||
msgstr "SDT (0x42)"
|
msgstr "SDT (0x42)"
|
||||||
|
|
||||||
msgid "EIT (0x4E/0x4F)"
|
msgid "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||||
msgstr "EIT (0x4E/0x4F)"
|
msgstr "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||||
|
|
||||||
msgid "EIT (0x5X)"
|
|
||||||
msgstr "EIT (0x5X)"
|
|
||||||
|
|
||||||
msgid "EIT (0x6X)"
|
|
||||||
msgstr "EIT (0x6X)"
|
|
||||||
|
|
||||||
msgid "TDT (0x70)"
|
msgid "TDT (0x70)"
|
||||||
msgstr "TDT (0x70)"
|
msgstr "TDT (0x70)"
|
||||||
@@ -59,41 +53,17 @@ msgstr "Bits/bytes"
|
|||||||
msgid "IPTV information not available!"
|
msgid "IPTV information not available!"
|
||||||
msgstr "Informazione IPTV non disponibile!"
|
msgstr "Informazione IPTV non disponibile!"
|
||||||
|
|
||||||
msgid "TS buffer size [MB]"
|
msgid "Protocol base port"
|
||||||
msgstr "Dimensione buffer TS [MB]"
|
msgstr "Porta base protocollo"
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
"Define a ringbuffer size for transport streams in megabytes.\n"
|
"Define a base port used by CURL/EXT protocol.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Smaller sizes help memory consumption, but are more prone to buffer overflows."
|
"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 ""
|
msgstr ""
|
||||||
"Definisci una dimensione del buffer in MB per i flussi di trasporto.\n"
|
"Definisci una porta base usata dal protocollo CURL/EXT.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Dimensioni più piccole aiutano il consumo di memoria, ma sono più inclini a generare buffer overflows."
|
"Il range della porta è definito dal numero di periferiche IPTV. Questo parametro imposta la porta che è in ascolto per connessioni da applicazioni esterne quando si usa il protocollo CURL/EXT."
|
||||||
|
|
||||||
msgid "TS buffer prefill ratio [%]"
|
|
||||||
msgstr "Riempimento buffer TS [%]"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
|
|
||||||
"\n"
|
|
||||||
"This is useful if streaming media over a slow or unreliable connection."
|
|
||||||
msgstr ""
|
|
||||||
"Definisci un rapporto di riempimento del buffer per i flussi di trasporto prima che i dati siano trasferiti a VDR.\n"
|
|
||||||
"\n"
|
|
||||||
"Questo è utile se si trasmette dati su una connessione lenta oppure inaffidabile."
|
|
||||||
|
|
||||||
msgid "EXT protocol base port"
|
|
||||||
msgstr "Porta base protocollo EXT"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Define a base port used by EXT protocol.\n"
|
|
||||||
"\n"
|
|
||||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
|
|
||||||
msgstr ""
|
|
||||||
"Definisci una porta base usata dal protocollo EXT.\n"
|
|
||||||
"\n"
|
|
||||||
"Il range della porta è definito dal numero di periferiche IPTV. Questo parametro imposta la porta che è in ascolto per connessioni da applicazioni esterne quando si usa il protocollo EXT."
|
|
||||||
|
|
||||||
msgid "Use section filtering"
|
msgid "Use section filtering"
|
||||||
msgstr "Utilizza sezione filtri"
|
msgstr "Utilizza sezione filtri"
|
||||||
@@ -146,12 +116,6 @@ msgstr "FILE"
|
|||||||
msgid "EXT"
|
msgid "EXT"
|
||||||
msgstr "EXT"
|
msgstr "EXT"
|
||||||
|
|
||||||
msgid "Nid"
|
|
||||||
msgstr "Nid"
|
|
||||||
|
|
||||||
msgid "Tid"
|
|
||||||
msgstr "Tid"
|
|
||||||
|
|
||||||
msgid "Rid"
|
msgid "Rid"
|
||||||
msgstr "Rid"
|
msgstr "Rid"
|
||||||
|
|
||||||
|
|||||||
58
po/nl_NL.po
58
po/nl_NL.po
@@ -5,10 +5,10 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: vdr-iptv 2.0.3\n"
|
"Project-Id-Version: vdr-iptv 2.1.3\n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\n"
|
"Report-Msgid-Bugs-To: <see README>\n"
|
||||||
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
|
"POT-Creation-Date: 2014-05-10 05:10+0200\n"
|
||||||
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
|
"PO-Revision-Date: 2014-05-10 05:10+0200\n"
|
||||||
"Last-Translator: Carel\n"
|
"Last-Translator: Carel\n"
|
||||||
"Language-Team: Dutch <vdr@linuxtv.org>\n"
|
"Language-Team: Dutch <vdr@linuxtv.org>\n"
|
||||||
"Language: nl\n"
|
"Language: nl\n"
|
||||||
@@ -26,14 +26,8 @@ msgstr "NIT (0x40)"
|
|||||||
msgid "SDT (0x42)"
|
msgid "SDT (0x42)"
|
||||||
msgstr "SDT (0x42)"
|
msgstr "SDT (0x42)"
|
||||||
|
|
||||||
msgid "EIT (0x4E/0x4F)"
|
msgid "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||||
msgstr "EIT (0x4E/0x4F)"
|
msgstr "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||||
|
|
||||||
msgid "EIT (0x5X)"
|
|
||||||
msgstr "EIT (0x5X)"
|
|
||||||
|
|
||||||
msgid "EIT (0x6X)"
|
|
||||||
msgstr "EIT (0x6X)"
|
|
||||||
|
|
||||||
msgid "TDT (0x70)"
|
msgid "TDT (0x70)"
|
||||||
msgstr "TDT (0x70)"
|
msgstr "TDT (0x70)"
|
||||||
@@ -59,41 +53,17 @@ msgstr "Bits/Bytes"
|
|||||||
msgid "IPTV information not available!"
|
msgid "IPTV information not available!"
|
||||||
msgstr "IPTV informatie niet beschikbaar!"
|
msgstr "IPTV informatie niet beschikbaar!"
|
||||||
|
|
||||||
msgid "TS buffer size [MB]"
|
msgid "Protocol base port"
|
||||||
msgstr "TS buffergrootte [MB]"
|
msgstr "Protocol basispoort"
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
"Define a ringbuffer size for transport streams in megabytes.\n"
|
"Define a base port used by CURL/EXT protocol.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Smaller sizes help memory consumption, but are more prone to buffer overflows."
|
"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 ""
|
msgstr ""
|
||||||
"Stel de grootte van de ringbuffer vast voor transportstreams in megabytes.\n"
|
"Bepaal de basispoort voor het CURL/EXT protocol.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Bij lage waarden zapt VDR sneller maar kunnen leiden tot bufferoverschreidingen en dus dropouts."
|
"De poortrange wordt bepaald door het aantal IPTV apparaten. Deze poort luistert naar inkomende verbindingen wanneer het CURL/EXT protocol wordt gebruikt."
|
||||||
|
|
||||||
msgid "TS buffer prefill ratio [%]"
|
|
||||||
msgstr "TS buffer-preload [%]"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
|
|
||||||
"\n"
|
|
||||||
"This is useful if streaming media over a slow or unreliable connection."
|
|
||||||
msgstr ""
|
|
||||||
"Stel een 'prefil ratio' in voor de ringbuffer voor transportstreams voor de data naar VDR wordt verstuurd.\n"
|
|
||||||
"\n"
|
|
||||||
"Dit is aan te bevelen bij onbetrouwbare of langzame verbindingen."
|
|
||||||
|
|
||||||
msgid "EXT protocol base port"
|
|
||||||
msgstr "EXT protocol basispoort"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Define a base port used by EXT protocol.\n"
|
|
||||||
"\n"
|
|
||||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
|
|
||||||
msgstr ""
|
|
||||||
"Bepaal de basispoort voor het EXT protocol.\n"
|
|
||||||
"\n"
|
|
||||||
"De poortrange wordt bepaald door het aantal IPTV apparaten. Deze poort luistert naar inkomende verbindingen wanneer het EXT protocol wordt gebruikt."
|
|
||||||
|
|
||||||
msgid "Use section filtering"
|
msgid "Use section filtering"
|
||||||
msgstr "Benutze Abschnittsfilterung"
|
msgstr "Benutze Abschnittsfilterung"
|
||||||
@@ -145,12 +115,6 @@ msgstr "BESTAND"
|
|||||||
msgid "EXT"
|
msgid "EXT"
|
||||||
msgstr "EXT"
|
msgstr "EXT"
|
||||||
|
|
||||||
msgid "Nid"
|
|
||||||
msgstr "Nid"
|
|
||||||
|
|
||||||
msgid "Tid"
|
|
||||||
msgstr "Tid"
|
|
||||||
|
|
||||||
msgid "Rid"
|
msgid "Rid"
|
||||||
msgstr "Rid"
|
msgstr "Rid"
|
||||||
|
|
||||||
|
|||||||
48
po/ru_RU.po
48
po/ru_RU.po
@@ -5,10 +5,10 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: vdr-iptv 2.0.3\n"
|
"Project-Id-Version: vdr-iptv 2.1.3\n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\n"
|
"Report-Msgid-Bugs-To: <see README>\n"
|
||||||
"POT-Creation-Date: 2014-03-09 03:09+0200\n"
|
"POT-Creation-Date: 2014-05-10 05:10+0200\n"
|
||||||
"PO-Revision-Date: 2014-03-09 03:09+0200\n"
|
"PO-Revision-Date: 2014-05-10 05:10+0200\n"
|
||||||
"Last-Translator: Alexander Gross <Bikalexander@gmail.com>\n"
|
"Last-Translator: Alexander Gross <Bikalexander@gmail.com>\n"
|
||||||
"Language-Team: Russian <vdr@linuxtv.org>\n"
|
"Language-Team: Russian <vdr@linuxtv.org>\n"
|
||||||
"Language: ru\n"
|
"Language: ru\n"
|
||||||
@@ -27,14 +27,8 @@ msgstr "NIT (0x40)"
|
|||||||
msgid "SDT (0x42)"
|
msgid "SDT (0x42)"
|
||||||
msgstr "SDT (0x42)"
|
msgstr "SDT (0x42)"
|
||||||
|
|
||||||
msgid "EIT (0x4E/0x4F)"
|
msgid "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||||
msgstr "EIT (0x4E/0x4F)"
|
msgstr "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||||
|
|
||||||
msgid "EIT (0x5X)"
|
|
||||||
msgstr "EIT (0x5X)"
|
|
||||||
|
|
||||||
msgid "EIT (0x6X)"
|
|
||||||
msgstr "EIT (0x6X)"
|
|
||||||
|
|
||||||
msgid "TDT (0x70)"
|
msgid "TDT (0x70)"
|
||||||
msgstr "TDT (0x70)"
|
msgstr "TDT (0x70)"
|
||||||
@@ -60,31 +54,13 @@ msgstr "Биты / байт"
|
|||||||
msgid "IPTV information not available!"
|
msgid "IPTV information not available!"
|
||||||
msgstr "IPTV информация отсутствует!"
|
msgstr "IPTV информация отсутствует!"
|
||||||
|
|
||||||
msgid "TS buffer size [MB]"
|
msgid "Protocol base port"
|
||||||
msgstr "Размер TS буфера [MB]"
|
msgstr "Базисный порт протокола"
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
"Define a ringbuffer size for transport streams in megabytes.\n"
|
"Define a base port used by CURL/EXT protocol.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Smaller sizes help memory consumption, but are more prone to buffer overflows."
|
"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 ""
|
|
||||||
|
|
||||||
msgid "TS buffer prefill ratio [%]"
|
|
||||||
msgstr "Предварительный буфер TS [%]"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
|
|
||||||
"\n"
|
|
||||||
"This is useful if streaming media over a slow or unreliable connection."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "EXT protocol base port"
|
|
||||||
msgstr "Базисный порт EXT протокола"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Define a base port used by EXT protocol.\n"
|
|
||||||
"\n"
|
|
||||||
"The port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "Use section filtering"
|
msgid "Use section filtering"
|
||||||
@@ -131,12 +107,6 @@ msgstr "ФАЙЛ"
|
|||||||
msgid "EXT"
|
msgid "EXT"
|
||||||
msgstr "EXT"
|
msgstr "EXT"
|
||||||
|
|
||||||
msgid "Nid"
|
|
||||||
msgstr "Nid"
|
|
||||||
|
|
||||||
msgid "Tid"
|
|
||||||
msgstr "Tid"
|
|
||||||
|
|
||||||
msgid "Rid"
|
msgid "Rid"
|
||||||
msgstr "Rid"
|
msgstr "Rid"
|
||||||
|
|
||||||
|
|||||||
185
protocolcurl.c
185
protocolcurl.c
@@ -26,14 +26,15 @@
|
|||||||
cIptvProtocolCurl::cIptvProtocolCurl()
|
cIptvProtocolCurl::cIptvProtocolCurl()
|
||||||
: streamUrlM(""),
|
: streamUrlM(""),
|
||||||
streamParamM(0),
|
streamParamM(0),
|
||||||
|
streamPortM(0),
|
||||||
mutexM(),
|
mutexM(),
|
||||||
handleM(NULL),
|
handleM(NULL),
|
||||||
multiM(NULL),
|
multiM(NULL),
|
||||||
headerListM(NULL),
|
headerListM(NULL),
|
||||||
ringBufferM(new cRingBufferLinear(MEGABYTE(IptvConfig.GetTsBufferSize()),
|
ringBufferM(new cRingBufferLinear(IPTV_BUFFER_SIZE, 7 * TS_SIZE, false, "IPTV CURL")),
|
||||||
7 * TS_SIZE, false, "IPTV CURL")),
|
rtspControlM(""),
|
||||||
rtspControlM(),
|
|
||||||
modeM(eModeUnknown),
|
modeM(eModeUnknown),
|
||||||
|
timeoutM(),
|
||||||
connectedM(false),
|
connectedM(false),
|
||||||
pausedM(false)
|
pausedM(false)
|
||||||
{
|
{
|
||||||
@@ -114,17 +115,24 @@ size_t cIptvProtocolCurl::DescribeCallback(void *ptrP, size_t sizeP, size_t nmem
|
|||||||
size_t len = sizeP * nmembP;
|
size_t len = sizeP * nmembP;
|
||||||
//debug("cIptvProtocolCurl::%s(%zu)", __FUNCTION__, len);
|
//debug("cIptvProtocolCurl::%s(%zu)", __FUNCTION__, len);
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
cString control = "";
|
cString control = "";
|
||||||
char *p = (char *)ptrP;
|
char *p = (char *)ptrP;
|
||||||
char *r = strtok(p, "\r\n");
|
char *r = strtok(p, "\r\n");
|
||||||
|
|
||||||
while (r) {
|
while (r) {
|
||||||
//debug("cIptvProtocolCurl::%s(%zu): %s", __FUNCTION__, len, r);
|
//debug("cIptvProtocolCurl::%s(%zu): %s", __FUNCTION__, len, r);
|
||||||
if (strstr(r, "a=control")) {
|
// Look for a media name: "video"
|
||||||
|
if (strstr(r, "m=video")) {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
// ... and find out its' attribute
|
||||||
|
if (found && strstr(r, "a=control")) {
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
if (sscanf(r, "a=control:%64ms", &s) == 1)
|
if (sscanf(r, "a=control:%255ms", &s) == 1)
|
||||||
control = compactspace(s);
|
control = compactspace(s);
|
||||||
free(s);
|
free(s);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
r = strtok(NULL, "\r\n");
|
r = strtok(NULL, "\r\n");
|
||||||
}
|
}
|
||||||
@@ -155,8 +163,14 @@ size_t cIptvProtocolCurl::HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP
|
|||||||
void cIptvProtocolCurl::SetRtspControl(const char *controlP)
|
void cIptvProtocolCurl::SetRtspControl(const char *controlP)
|
||||||
{
|
{
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
debug("cIptvProtocolCurl::%s(%s)", __FUNCTION__, controlP);
|
//debug("cIptvProtocolCurl::%s(%s)", __FUNCTION__, controlP);
|
||||||
rtspControlM = controlP;
|
cString protocol = ChangeCase(controlP, false).Truncate(7);
|
||||||
|
if (startswith(*protocol, "rtsp://")) {
|
||||||
|
streamUrlM = controlP;
|
||||||
|
rtspControlM = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rtspControlM = controlP;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolCurl::PutData(unsigned char *dataP, int lenP)
|
bool cIptvProtocolCurl::PutData(unsigned char *dataP, int lenP)
|
||||||
@@ -238,10 +252,8 @@ bool cIptvProtocolCurl::Connect()
|
|||||||
// Initialize the curl session
|
// Initialize the curl session
|
||||||
if (!handleM)
|
if (!handleM)
|
||||||
handleM = curl_easy_init();
|
handleM = curl_easy_init();
|
||||||
if (!multiM)
|
|
||||||
multiM = curl_multi_init();
|
|
||||||
|
|
||||||
if (handleM && multiM && !isempty(*streamUrlM)) {
|
if (handleM && !isempty(*streamUrlM)) {
|
||||||
CURLcode res = CURLE_OK;
|
CURLcode res = CURLE_OK;
|
||||||
cString netrc = cString::sprintf("%s/netrc", IptvConfig.GetConfigDirectory());
|
cString netrc = cString::sprintf("%s/netrc", IptvConfig.GetConfigDirectory());
|
||||||
|
|
||||||
@@ -284,6 +296,10 @@ bool cIptvProtocolCurl::Connect()
|
|||||||
{
|
{
|
||||||
cString uri, control, transport, range;
|
cString uri, control, transport, range;
|
||||||
|
|
||||||
|
// Create the listening socket for UDP mode
|
||||||
|
if (!streamParamM)
|
||||||
|
OpenSocket(streamPortM);
|
||||||
|
|
||||||
// Request server options
|
// Request server options
|
||||||
uri = cString::sprintf("%s", *streamUrlM);
|
uri = cString::sprintf("%s", *streamUrlM);
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||||
@@ -301,8 +317,14 @@ bool cIptvProtocolCurl::Connect()
|
|||||||
iptv_curl_easy_setopt(handleM, CURLOPT_WRITEDATA, NULL);
|
iptv_curl_easy_setopt(handleM, CURLOPT_WRITEDATA, NULL);
|
||||||
|
|
||||||
// Setup media stream
|
// Setup media stream
|
||||||
uri = cString::sprintf("%s/%s", *streamUrlM, *rtspControlM);
|
if (isempty(*rtspControlM))
|
||||||
transport = "RTP/AVP/TCP;unicast;interleaved=0-1";
|
uri = cString::sprintf("%s", *streamUrlM);
|
||||||
|
else
|
||||||
|
uri = cString::sprintf("%s/%s", *streamUrlM, *rtspControlM);
|
||||||
|
if (streamParamM)
|
||||||
|
transport = "RTP/AVP/TCP;unicast;interleaved=0-1";
|
||||||
|
else
|
||||||
|
transport = cString::sprintf("RTP/AVP;unicast;client_port=%d-%d", streamPortM, streamPortM + 1);
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_TRANSPORT, *transport);
|
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_TRANSPORT, *transport);
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_SETUP);
|
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_SETUP);
|
||||||
@@ -312,15 +334,20 @@ bool cIptvProtocolCurl::Connect()
|
|||||||
uri = cString::sprintf("%s/", *streamUrlM);
|
uri = cString::sprintf("%s/", *streamUrlM);
|
||||||
range = "0.000-";
|
range = "0.000-";
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_RANGE, *range);
|
//iptv_curl_easy_setopt(handleM, CURLOPT_RANGE, *range);
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_PLAY);
|
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_PLAY);
|
||||||
iptv_curl_easy_perform(handleM);
|
iptv_curl_easy_perform(handleM);
|
||||||
|
|
||||||
// Start receiving
|
// Start receiving
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_INTERLEAVEFUNCTION, cIptvProtocolCurl::WriteRtspCallback);
|
if (streamParamM) {
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_INTERLEAVEDATA, this);
|
iptv_curl_easy_setopt(handleM, CURLOPT_INTERLEAVEFUNCTION, cIptvProtocolCurl::WriteRtspCallback);
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_RECEIVE);
|
iptv_curl_easy_setopt(handleM, CURLOPT_INTERLEAVEDATA, this);
|
||||||
iptv_curl_easy_perform(handleM);
|
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_RECEIVE);
|
||||||
|
iptv_curl_easy_perform(handleM);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't add handle into multi set
|
||||||
|
isActiveM = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -342,12 +369,26 @@ bool cIptvProtocolCurl::Connect()
|
|||||||
headerListM = curl_slist_append(headerListM, "Pragma: no-cache");
|
headerListM = curl_slist_append(headerListM, "Pragma: no-cache");
|
||||||
headerListM = curl_slist_append(headerListM, "Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
headerListM = curl_slist_append(headerListM, "Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_HTTPHEADER, headerListM);
|
iptv_curl_easy_setopt(handleM, CURLOPT_HTTPHEADER, headerListM);
|
||||||
|
|
||||||
|
// Initialize multi set and add handle into it
|
||||||
|
if (!multiM)
|
||||||
|
multiM = curl_multi_init();
|
||||||
|
if (multiM)
|
||||||
|
curl_multi_add_handle(multiM, handleM);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eModeFile:
|
case eModeFile:
|
||||||
|
{
|
||||||
// Set timeout
|
// Set timeout
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_TIMEOUT_MS, 10L);
|
iptv_curl_easy_setopt(handleM, CURLOPT_TIMEOUT_MS, 10L);
|
||||||
|
|
||||||
|
// Initialize multi set and add handle into it
|
||||||
|
if (!multiM)
|
||||||
|
multiM = curl_multi_init();
|
||||||
|
if (multiM)
|
||||||
|
curl_multi_add_handle(multiM, handleM);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eModeUnknown:
|
case eModeUnknown:
|
||||||
@@ -355,9 +396,7 @@ bool cIptvProtocolCurl::Connect()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add handle into multi set
|
timeoutM.Set(eKeepAliveIntervalMs);
|
||||||
curl_multi_add_handle(multiM, handleM);
|
|
||||||
|
|
||||||
connectedM = true;
|
connectedM = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -373,7 +412,14 @@ bool cIptvProtocolCurl::Disconnect()
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Terminate curl session
|
// Terminate curl session
|
||||||
if (handleM && multiM) {
|
if (handleM) {
|
||||||
|
// Remove handle from multi set
|
||||||
|
if (multiM) {
|
||||||
|
curl_multi_remove_handle(multiM, handleM);
|
||||||
|
curl_multi_cleanup(multiM);
|
||||||
|
multiM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Mode specific tricks
|
// Mode specific tricks
|
||||||
switch (modeM) {
|
switch (modeM) {
|
||||||
#ifdef USE_RTSP
|
#ifdef USE_RTSP
|
||||||
@@ -386,6 +432,9 @@ bool cIptvProtocolCurl::Disconnect()
|
|||||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_TEARDOWN);
|
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_TEARDOWN);
|
||||||
iptv_curl_easy_perform(handleM);
|
iptv_curl_easy_perform(handleM);
|
||||||
rtspControlM = "";
|
rtspControlM = "";
|
||||||
|
isActiveM = false;
|
||||||
|
// Close the listening socket
|
||||||
|
CloseSocket();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -402,11 +451,8 @@ bool cIptvProtocolCurl::Disconnect()
|
|||||||
curl_slist_free_all(headerListM);
|
curl_slist_free_all(headerListM);
|
||||||
headerListM = NULL;
|
headerListM = NULL;
|
||||||
}
|
}
|
||||||
curl_multi_remove_handle(multiM, handleM);
|
|
||||||
curl_easy_cleanup(handleM);
|
curl_easy_cleanup(handleM);
|
||||||
handleM = NULL;
|
handleM = NULL;
|
||||||
curl_multi_cleanup(multiM);
|
|
||||||
multiM = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearData();
|
ClearData();
|
||||||
@@ -433,55 +479,70 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
if (ringBufferM) {
|
if (ringBufferM) {
|
||||||
// Fill up the buffer
|
// Fill up the buffer
|
||||||
if (handleM && multiM) {
|
if (handleM) {
|
||||||
switch (modeM) {
|
switch (modeM) {
|
||||||
#ifdef USE_RTSP
|
#ifdef USE_RTSP
|
||||||
case eModeRtsp:
|
case eModeRtsp:
|
||||||
{
|
{
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
CURLcode res = CURLE_OK;
|
CURLcode res = CURLE_OK;
|
||||||
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_RECEIVE);
|
|
||||||
iptv_curl_easy_perform(handleM);
|
// Remember the heart beat
|
||||||
// @todo - How to detect eof?
|
if (timeoutM.TimedOut()) {
|
||||||
|
debug("cIptvProtocolCurl::%s(): KeepAlive", __FUNCTION__);
|
||||||
|
cString uri = cString::sprintf("%s", *streamUrlM);
|
||||||
|
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||||
|
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_OPTIONS);
|
||||||
|
iptv_curl_easy_perform(handleM);
|
||||||
|
timeoutM.Set(eKeepAliveIntervalMs);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check whether UDP or TCP mode used
|
||||||
|
if (streamParamM) {
|
||||||
|
iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_RECEIVE);
|
||||||
|
iptv_curl_easy_perform(handleM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return cIptvUdpSocket::Read(bufferAddrP, bufferLenP);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case eModeFile:
|
case eModeFile:
|
||||||
case eModeHttp:
|
case eModeHttp:
|
||||||
case eModeHttps:
|
case eModeHttps:
|
||||||
{
|
if (multiM) {
|
||||||
CURLMcode res;
|
CURLMcode res;
|
||||||
int running_handles;
|
int running_handles;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
res = curl_multi_perform(multiM, &running_handles);
|
res = curl_multi_perform(multiM, &running_handles);
|
||||||
} while (res == CURLM_CALL_MULTI_PERFORM);
|
} while (res == CURLM_CALL_MULTI_PERFORM);
|
||||||
|
|
||||||
// Use 20% threshold before continuing to filling up the buffer.
|
// Use 20% threshold before continuing to filling up the buffer.
|
||||||
mutexM.Lock();
|
|
||||||
if (pausedM && (ringBufferM->Available() < (MEGABYTE(IptvConfig.GetTsBufferSize()) / 5))) {
|
|
||||||
debug("cIptvProtocolCurl::%s(continue): free=%d available=%d", __FUNCTION__,
|
|
||||||
ringBufferM->Free(), ringBufferM->Available());
|
|
||||||
pausedM = false;
|
|
||||||
curl_easy_pause(handleM, CURLPAUSE_CONT);
|
|
||||||
}
|
|
||||||
mutexM.Unlock();
|
|
||||||
|
|
||||||
// Check if end of file
|
|
||||||
if (running_handles == 0) {
|
|
||||||
int msgcount;
|
|
||||||
mutexM.Lock();
|
mutexM.Lock();
|
||||||
CURLMsg *msg = curl_multi_info_read(multiM, &msgcount);
|
if (pausedM && (ringBufferM->Available() < (IPTV_BUFFER_SIZE / 5))) {
|
||||||
|
debug("cIptvProtocolCurl::%s(continue): free=%d available=%d", __FUNCTION__,
|
||||||
|
ringBufferM->Free(), ringBufferM->Available());
|
||||||
|
pausedM = false;
|
||||||
|
curl_easy_pause(handleM, CURLPAUSE_CONT);
|
||||||
|
}
|
||||||
mutexM.Unlock();
|
mutexM.Unlock();
|
||||||
if (msg && (msg->msg == CURLMSG_DONE)) {
|
|
||||||
debug("cIptvProtocolCurl::%s(done): %s (%d)", __FUNCTION__,
|
// Check if end of file
|
||||||
curl_easy_strerror(msg->data.result), msg->data.result);
|
if (running_handles == 0) {
|
||||||
Disconnect();
|
int msgcount;
|
||||||
Connect();
|
mutexM.Lock();
|
||||||
|
CURLMsg *msg = curl_multi_info_read(multiM, &msgcount);
|
||||||
|
mutexM.Unlock();
|
||||||
|
if (msg && (msg->msg == CURLMSG_DONE)) {
|
||||||
|
debug("cIptvProtocolCurl::%s(done): %s (%d)", __FUNCTION__,
|
||||||
|
curl_easy_strerror(msg->data.result), msg->data.result);
|
||||||
|
Disconnect();
|
||||||
|
Connect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eModeUnknown:
|
case eModeUnknown:
|
||||||
@@ -503,7 +564,7 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolCurl::Set(const char* locationP, const int parameterP, const int indexP)
|
bool cIptvProtocolCurl::SetSource(const char* locationP, const int parameterP, const int indexP)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolCurl::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
debug("cIptvProtocolCurl::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
||||||
if (!isempty(locationP)) {
|
if (!isempty(locationP)) {
|
||||||
@@ -523,14 +584,22 @@ bool cIptvProtocolCurl::Set(const char* locationP, const int parameterP, const i
|
|||||||
else
|
else
|
||||||
modeM = eModeUnknown;
|
modeM = eModeUnknown;
|
||||||
debug("cIptvProtocolCurl::%s(): %s (%d)", __FUNCTION__, *protocol, modeM);
|
debug("cIptvProtocolCurl::%s(): %s (%d)", __FUNCTION__, *protocol, modeM);
|
||||||
// Update stream parameter
|
// Update stream parameter - force UDP mode for RTSP
|
||||||
streamParamM = parameterP;
|
streamParamM = (modeM == eModeRtsp) ? 0 : parameterP;
|
||||||
|
// Update listen port
|
||||||
|
streamPortM = IptvConfig.GetProtocolBasePort() + indexP * 2;
|
||||||
// Reconnect
|
// Reconnect
|
||||||
Connect();
|
Connect();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cIptvProtocolCurl::SetPid(int pidP, int typeP, bool onP)
|
||||||
|
{
|
||||||
|
//debug("cIptvProtocolCurl::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
cString cIptvProtocolCurl::GetInformation(void)
|
cString cIptvProtocolCurl::GetInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cIptvProtocolCurl::%s()", __FUNCTION__);
|
//debug("cIptvProtocolCurl::%s()", __FUNCTION__);
|
||||||
|
|||||||
@@ -16,8 +16,9 @@
|
|||||||
#include <vdr/tools.h>
|
#include <vdr/tools.h>
|
||||||
|
|
||||||
#include "protocolif.h"
|
#include "protocolif.h"
|
||||||
|
#include "socket.h"
|
||||||
|
|
||||||
class cIptvProtocolCurl : public cIptvProtocolIf {
|
class cIptvProtocolCurl : public cIptvUdpSocket, public cIptvProtocolIf {
|
||||||
private:
|
private:
|
||||||
enum eModeType {
|
enum eModeType {
|
||||||
eModeUnknown = 0,
|
eModeUnknown = 0,
|
||||||
@@ -28,8 +29,9 @@ private:
|
|||||||
eModeCount
|
eModeCount
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
eConnectTimeoutS = 5, // in seconds
|
eConnectTimeoutS = 5, // in seconds
|
||||||
eMaxDownloadSpeedMBits = 20 // in megabits per second
|
eMaxDownloadSpeedMBits = 20, // in megabits per second
|
||||||
|
eKeepAliveIntervalMs = 300000 // in milliseconds
|
||||||
};
|
};
|
||||||
|
|
||||||
static size_t WriteCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);
|
static size_t WriteCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);
|
||||||
@@ -39,6 +41,7 @@ private:
|
|||||||
|
|
||||||
cString streamUrlM;
|
cString streamUrlM;
|
||||||
int streamParamM;
|
int streamParamM;
|
||||||
|
int streamPortM;
|
||||||
cMutex mutexM;
|
cMutex mutexM;
|
||||||
CURL *handleM;
|
CURL *handleM;
|
||||||
CURLM *multiM;
|
CURLM *multiM;
|
||||||
@@ -46,6 +49,7 @@ private:
|
|||||||
cRingBufferLinear *ringBufferM;
|
cRingBufferLinear *ringBufferM;
|
||||||
cString rtspControlM;
|
cString rtspControlM;
|
||||||
eModeType modeM;
|
eModeType modeM;
|
||||||
|
cTimeMs timeoutM;
|
||||||
bool connectedM;
|
bool connectedM;
|
||||||
bool pausedM;
|
bool pausedM;
|
||||||
|
|
||||||
@@ -60,7 +64,8 @@ public:
|
|||||||
cIptvProtocolCurl();
|
cIptvProtocolCurl();
|
||||||
virtual ~cIptvProtocolCurl();
|
virtual ~cIptvProtocolCurl();
|
||||||
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
||||||
bool Set(const char* locationP, const int parameterP, const int indexP);
|
bool SetSource(const char* locationP, const int parameterP, const int indexP);
|
||||||
|
bool SetPid(int pidP, int typeP, bool onP);
|
||||||
bool Open(void);
|
bool Open(void);
|
||||||
bool Close(void);
|
bool Close(void);
|
||||||
cString GetInformation(void);
|
cString GetInformation(void);
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ int cIptvProtocolExt::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
|
|||||||
return cIptvUdpSocket::Read(bufferAddrP, bufferLenP);
|
return cIptvUdpSocket::Read(bufferAddrP, bufferLenP);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolExt::Set(const char* locationP, const int parameterP, const int indexP)
|
bool cIptvProtocolExt::SetSource(const char* locationP, const int parameterP, const int indexP)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolExt::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
debug("cIptvProtocolExt::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
||||||
if (!isempty(locationP)) {
|
if (!isempty(locationP)) {
|
||||||
@@ -165,11 +165,17 @@ bool cIptvProtocolExt::Set(const char* locationP, const int parameterP, const in
|
|||||||
}
|
}
|
||||||
scriptParameterM = parameterP;
|
scriptParameterM = parameterP;
|
||||||
// Update listen port
|
// Update listen port
|
||||||
streamPortM = IptvConfig.GetExtProtocolBasePort() + indexP;
|
streamPortM = IptvConfig.GetProtocolBasePort() + indexP * 2;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cIptvProtocolExt::SetPid(int pidP, int typeP, bool onP)
|
||||||
|
{
|
||||||
|
//debug("cIptvProtocolExt::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
cString cIptvProtocolExt::GetInformation(void)
|
cString cIptvProtocolExt::GetInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cIptvProtocolExt::%s()", __FUNCTION__);
|
//debug("cIptvProtocolExt::%s()", __FUNCTION__);
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ public:
|
|||||||
cIptvProtocolExt();
|
cIptvProtocolExt();
|
||||||
virtual ~cIptvProtocolExt();
|
virtual ~cIptvProtocolExt();
|
||||||
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
||||||
bool Set(const char* locationP, const int parameterP, const int indexP);
|
bool SetSource(const char* locationP, const int parameterP, const int indexP);
|
||||||
|
bool SetPid(int pidP, int typeP, bool onP);
|
||||||
bool Open(void);
|
bool Open(void);
|
||||||
bool Close(void);
|
bool Close(void);
|
||||||
cString GetInformation(void);
|
cString GetInformation(void);
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ bool cIptvProtocolFile::Close(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolFile::Set(const char* locationP, const int parameterP, const int indexP)
|
bool cIptvProtocolFile::SetSource(const char* locationP, const int parameterP, const int indexP)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolFile::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
debug("cIptvProtocolFile::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
||||||
if (!isempty(locationP)) {
|
if (!isempty(locationP)) {
|
||||||
@@ -110,6 +110,12 @@ bool cIptvProtocolFile::Set(const char* locationP, const int parameterP, const i
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cIptvProtocolFile::SetPid(int pidP, int typeP, bool onP)
|
||||||
|
{
|
||||||
|
//debug("cIptvProtocolFile::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
cString cIptvProtocolFile::GetInformation(void)
|
cString cIptvProtocolFile::GetInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cIptvProtocolFile::%s()", __FUNCTION__);
|
//debug("cIptvProtocolFile::%s()", __FUNCTION__);
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ public:
|
|||||||
cIptvProtocolFile();
|
cIptvProtocolFile();
|
||||||
virtual ~cIptvProtocolFile();
|
virtual ~cIptvProtocolFile();
|
||||||
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
||||||
bool Set(const char* locationP, const int parameterP, const int indexP);
|
bool SetSource(const char* locationP, const int parameterP, const int indexP);
|
||||||
|
bool SetPid(int pidP, int typeP, bool onP);
|
||||||
bool Open(void);
|
bool Open(void);
|
||||||
bool Close(void);
|
bool Close(void);
|
||||||
cString GetInformation(void);
|
cString GetInformation(void);
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ int cIptvProtocolHttp::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
|
|||||||
return cIptvTcpSocket::Read(bufferAddrP, bufferLenP);
|
return cIptvTcpSocket::Read(bufferAddrP, bufferLenP);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolHttp::Set(const char* locationP, const int parameterP, const int indexP)
|
bool cIptvProtocolHttp::SetSource(const char* locationP, const int parameterP, const int indexP)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolHttp::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
debug("cIptvProtocolHttp::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
||||||
if (!isempty(locationP)) {
|
if (!isempty(locationP)) {
|
||||||
@@ -199,6 +199,12 @@ bool cIptvProtocolHttp::Set(const char* locationP, const int parameterP, const i
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cIptvProtocolHttp::SetPid(int pidP, int typeP, bool onP)
|
||||||
|
{
|
||||||
|
//debug("cIptvProtocolHttp::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
cString cIptvProtocolHttp::GetInformation(void)
|
cString cIptvProtocolHttp::GetInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cIptvProtocolHttp::%s()", __FUNCTION__);
|
//debug("cIptvProtocolHttp::%s()", __FUNCTION__);
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ public:
|
|||||||
cIptvProtocolHttp();
|
cIptvProtocolHttp();
|
||||||
virtual ~cIptvProtocolHttp();
|
virtual ~cIptvProtocolHttp();
|
||||||
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
||||||
bool Set(const char* locationP, const int parameterP, const int indexP);
|
bool SetSource(const char* locationP, const int parameterP, const int indexP);
|
||||||
|
bool SetPid(int pidP, int typeP, bool onP);
|
||||||
bool Open(void);
|
bool Open(void);
|
||||||
bool Close(void);
|
bool Close(void);
|
||||||
cString GetInformation(void);
|
cString GetInformation(void);
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ public:
|
|||||||
cIptvProtocolIf() {}
|
cIptvProtocolIf() {}
|
||||||
virtual ~cIptvProtocolIf() {}
|
virtual ~cIptvProtocolIf() {}
|
||||||
virtual int Read(unsigned char* bufferAddrP, unsigned int bufferLenP) = 0;
|
virtual int Read(unsigned char* bufferAddrP, unsigned int bufferLenP) = 0;
|
||||||
virtual bool Set(const char* locationP, const int parameterP, const int indexP) = 0;
|
virtual bool SetSource(const char* locationP, const int parameterP, const int indexP) = 0;
|
||||||
|
virtual bool SetPid(int pidP, int typeP, bool onP) = 0;
|
||||||
virtual bool Open(void) = 0;
|
virtual bool Open(void) = 0;
|
||||||
virtual bool Close(void) = 0;
|
virtual bool Close(void) = 0;
|
||||||
virtual cString GetInformation(void) = 0;
|
virtual cString GetInformation(void) = 0;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ int cIptvProtocolUdp::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
|
|||||||
return cIptvUdpSocket::Read(bufferAddrP, bufferLenP);
|
return cIptvUdpSocket::Read(bufferAddrP, bufferLenP);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolUdp::Set(const char* locationP, const int parameterP, const int indexP)
|
bool cIptvProtocolUdp::SetSource(const char* locationP, const int parameterP, const int indexP)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolUdp::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
debug("cIptvProtocolUdp::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
||||||
if (!isempty(locationP)) {
|
if (!isempty(locationP)) {
|
||||||
@@ -103,6 +103,12 @@ bool cIptvProtocolUdp::Set(const char* locationP, const int parameterP, const in
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cIptvProtocolUdp::SetPid(int pidP, int typeP, bool onP)
|
||||||
|
{
|
||||||
|
//debug("cIptvProtocolUdp::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
cString cIptvProtocolUdp::GetInformation(void)
|
cString cIptvProtocolUdp::GetInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cIptvProtocolUdp::%s()", __FUNCTION__);
|
//debug("cIptvProtocolUdp::%s()", __FUNCTION__);
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ public:
|
|||||||
cIptvProtocolUdp();
|
cIptvProtocolUdp();
|
||||||
virtual ~cIptvProtocolUdp();
|
virtual ~cIptvProtocolUdp();
|
||||||
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
|
||||||
bool Set(const char* locationP, const int parameterP, const int indexP);
|
bool SetSource(const char* locationP, const int parameterP, const int indexP);
|
||||||
|
bool SetPid(int pidP, int typeP, bool onP);
|
||||||
bool Open(void);
|
bool Open(void);
|
||||||
bool Close(void);
|
bool Close(void);
|
||||||
cString GetInformation(void);
|
cString GetInformation(void);
|
||||||
|
|||||||
104
sectionfilter.c
104
sectionfilter.c
@@ -17,6 +17,7 @@ cIptvSectionFilter::cIptvSectionFilter(int deviceIndexP, uint16_t pidP, uint8_t
|
|||||||
secLenM(0),
|
secLenM(0),
|
||||||
tsFeedpM(0),
|
tsFeedpM(0),
|
||||||
pidM(pidP),
|
pidM(pidP),
|
||||||
|
ringBufferM(new cRingBufferFrame(eDmxMaxSectionCount * eDmxMaxSectionSize)),
|
||||||
deviceIndexM(deviceIndexP)
|
deviceIndexM(deviceIndexP)
|
||||||
{
|
{
|
||||||
//debug("cIptvSectionFilter::%s(%d, %d)", __FUNCTION__, deviceIndexM, pidM);
|
//debug("cIptvSectionFilter::%s(%d, %d)", __FUNCTION__, deviceIndexM, pidM);
|
||||||
@@ -33,11 +34,11 @@ cIptvSectionFilter::cIptvSectionFilter(int deviceIndexP, uint16_t pidP, uint8_t
|
|||||||
filterMaskM[0] = maskP;
|
filterMaskM[0] = maskP;
|
||||||
|
|
||||||
// Invert the filter
|
// Invert the filter
|
||||||
for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i)
|
for (i = 0; i < eDmxMaxFilterSize; ++i)
|
||||||
filterValueM[i] ^= 0xFF;
|
filterValueM[i] ^= 0xFF;
|
||||||
|
|
||||||
uint8_t mask, mode, doneq = 0;
|
uint8_t mask, mode, doneq = 0;
|
||||||
for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i) {
|
for (i = 0; i < eDmxMaxFilterSize; ++i) {
|
||||||
mode = filterModeM[i];
|
mode = filterModeM[i];
|
||||||
mask = filterMaskM[i];
|
mask = filterMaskM[i];
|
||||||
maskAndModeM[i] = (uint8_t)(mask & mode);
|
maskAndModeM[i] = (uint8_t)(mask & mode);
|
||||||
@@ -48,7 +49,7 @@ cIptvSectionFilter::cIptvSectionFilter(int deviceIndexP, uint16_t pidP, uint8_t
|
|||||||
|
|
||||||
// Create sockets
|
// Create sockets
|
||||||
socketM[0] = socketM[1] = -1;
|
socketM[0] = socketM[1] = -1;
|
||||||
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, socketM) != 0) {
|
if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, socketM) != 0) {
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
error("Opening section filter sockets failed (device=%d pid=%d): %s", deviceIndexM, pidM, strerror_r(errno, tmp, sizeof(tmp)));
|
error("Opening section filter sockets failed (device=%d pid=%d): %s", deviceIndexM, pidM, strerror_r(errno, tmp, sizeof(tmp)));
|
||||||
}
|
}
|
||||||
@@ -70,6 +71,7 @@ cIptvSectionFilter::~cIptvSectionFilter()
|
|||||||
if (tmp >= 0)
|
if (tmp >= 0)
|
||||||
close(tmp);
|
close(tmp);
|
||||||
secBufM = NULL;
|
secBufM = NULL;
|
||||||
|
DELETENULL(ringBufferM);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint16_t cIptvSectionFilter::GetLength(const uint8_t *dataP)
|
inline uint16_t cIptvSectionFilter::GetLength(const uint8_t *dataP)
|
||||||
@@ -89,7 +91,7 @@ int cIptvSectionFilter::Filter(void)
|
|||||||
int i;
|
int i;
|
||||||
uint8_t neq = 0;
|
uint8_t neq = 0;
|
||||||
|
|
||||||
for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i) {
|
for (i = 0; i < eDmxMaxFilterSize; ++i) {
|
||||||
uint8_t calcxor = (uint8_t)(filterValueM[i] ^ secBufM[i]);
|
uint8_t calcxor = (uint8_t)(filterValueM[i] ^ secBufM[i]);
|
||||||
if (maskAndModeM[i] & calcxor)
|
if (maskAndModeM[i] & calcxor)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -99,13 +101,8 @@ int cIptvSectionFilter::Filter(void)
|
|||||||
if (doneqM && !neq)
|
if (doneqM && !neq)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// There is no data in the read socket, more can be written
|
if (ringBufferM && (secLenM > 0))
|
||||||
if ((socketM[0] >= 0) && (socketM[1] >= 0) /*&& !select_single_desc(socketM[0], 0, false)*/) {
|
ringBufferM->Put(new cFrame(secBufM, secLenM));
|
||||||
ssize_t len = write(socketM[1], secBufM, secLenM);
|
|
||||||
ERROR_IF(len < 0, "write()");
|
|
||||||
// Update statistics
|
|
||||||
AddSectionStatistic(len, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -122,11 +119,11 @@ int cIptvSectionFilter::CopyDump(const uint8_t *bufP, uint8_t lenP)
|
|||||||
{
|
{
|
||||||
uint16_t limit, seclen, n;
|
uint16_t limit, seclen, n;
|
||||||
|
|
||||||
if (tsFeedpM >= DMX_MAX_SECFEED_SIZE)
|
if (tsFeedpM >= eDmxMaxSectionFeedSize)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (tsFeedpM + lenP > DMX_MAX_SECFEED_SIZE)
|
if (tsFeedpM + lenP > eDmxMaxSectionFeedSize)
|
||||||
lenP = (uint8_t)(DMX_MAX_SECFEED_SIZE - tsFeedpM);
|
lenP = (uint8_t)(eDmxMaxSectionFeedSize - tsFeedpM);
|
||||||
|
|
||||||
if (lenP <= 0)
|
if (lenP <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -135,7 +132,7 @@ int cIptvSectionFilter::CopyDump(const uint8_t *bufP, uint8_t lenP)
|
|||||||
tsFeedpM = uint16_t(tsFeedpM + lenP);
|
tsFeedpM = uint16_t(tsFeedpM + lenP);
|
||||||
|
|
||||||
limit = tsFeedpM;
|
limit = tsFeedpM;
|
||||||
if (limit > DMX_MAX_SECFEED_SIZE)
|
if (limit > eDmxMaxSectionFeedSize)
|
||||||
return -1; // internal error should never happen
|
return -1; // internal error should never happen
|
||||||
|
|
||||||
// Always set secbuf
|
// Always set secbuf
|
||||||
@@ -143,7 +140,7 @@ int cIptvSectionFilter::CopyDump(const uint8_t *bufP, uint8_t lenP)
|
|||||||
|
|
||||||
for (n = 0; secBufpM + 2 < limit; ++n) {
|
for (n = 0; secBufpM + 2 < limit; ++n) {
|
||||||
seclen = GetLength(secBufM);
|
seclen = GetLength(secBufM);
|
||||||
if ((seclen <= 0) || (seclen > DMX_MAX_SECTION_SIZE) || ((seclen + secBufpM) > limit))
|
if ((seclen <= 0) || (seclen > eDmxMaxSectionSize) || ((seclen + secBufpM) > limit))
|
||||||
return 0;
|
return 0;
|
||||||
secLenM = seclen;
|
secLenM = seclen;
|
||||||
if (pusiSeenM)
|
if (pusiSeenM)
|
||||||
@@ -211,13 +208,33 @@ void cIptvSectionFilter::Process(const uint8_t* dataP)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cIptvSectionFilter::Send(void)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
cFrame *section = ringBufferM->Get();
|
||||||
|
if (section) {
|
||||||
|
uchar *data = section->Data();
|
||||||
|
int count = section->Count();
|
||||||
|
if (data && (count > 0) && (socketM[1] >= 0) && (socketM[0] >= 0)) {
|
||||||
|
ssize_t len = send(socketM[1], data, count, MSG_EOR);
|
||||||
|
ERROR_IF(len < 0 && errno != EAGAIN, "send()");
|
||||||
|
if (len > 0) {
|
||||||
|
ringBufferM->Drop(section);
|
||||||
|
result = !!ringBufferM->Available();
|
||||||
|
// Update statistics
|
||||||
|
AddSectionStatistic(len, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
cIptvSectionFilterHandler::cIptvSectionFilterHandler(int deviceIndexP, unsigned int bufferLenP)
|
cIptvSectionFilterHandler::cIptvSectionFilterHandler(int deviceIndexP, unsigned int bufferLenP)
|
||||||
: cThread("IPTV section handler", true),
|
: cThread("IPTV section handler"),
|
||||||
|
ringBufferM(new cRingBufferLinear(bufferLenP, TS_SIZE, false, *cString::sprintf("IPTV SECTION HANDLER %d", deviceIndexP))),
|
||||||
mutexM(),
|
mutexM(),
|
||||||
deviceIndexM(deviceIndexP),
|
deviceIndexM(deviceIndexP)
|
||||||
processedM(false),
|
|
||||||
ringBufferM(new cRingBufferLinear(bufferLenP, TS_SIZE, false, *cString::sprintf("IPTV SECTION HANDLER %d", deviceIndexP)))
|
|
||||||
{
|
{
|
||||||
debug("cIptvSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM);
|
debug("cIptvSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||||
|
|
||||||
@@ -238,8 +255,9 @@ cIptvSectionFilterHandler::cIptvSectionFilterHandler(int deviceIndexP, unsigned
|
|||||||
cIptvSectionFilterHandler::~cIptvSectionFilterHandler()
|
cIptvSectionFilterHandler::~cIptvSectionFilterHandler()
|
||||||
{
|
{
|
||||||
debug("cIptvSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM);
|
debug("cIptvSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||||
Stop();
|
// Stop thread
|
||||||
|
if (Running())
|
||||||
|
Cancel(3);
|
||||||
DELETE_POINTER(ringBufferM);
|
DELETE_POINTER(ringBufferM);
|
||||||
|
|
||||||
// Destroy all filters
|
// Destroy all filters
|
||||||
@@ -248,26 +266,28 @@ cIptvSectionFilterHandler::~cIptvSectionFilterHandler()
|
|||||||
Delete(i);
|
Delete(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvSectionFilterHandler::Stop(void)
|
|
||||||
{
|
|
||||||
debug("cIptvSectionFilterHandler::%s(%d): entering", __FUNCTION__, deviceIndexM);
|
|
||||||
// Stop thread
|
|
||||||
if (Running())
|
|
||||||
Cancel(3);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cIptvSectionFilterHandler::Action(void)
|
void cIptvSectionFilterHandler::Action(void)
|
||||||
{
|
{
|
||||||
debug("cIptvSectionFilterHandler::%s(%d): entering", __FUNCTION__, deviceIndexM);
|
debug("cIptvSectionFilterHandler::%s(%d): entering", __FUNCTION__, deviceIndexM);
|
||||||
|
bool processed = false;
|
||||||
// Do the thread loop
|
// Do the thread loop
|
||||||
while (Running()) {
|
while (Running()) {
|
||||||
|
// Send demuxed section packets through all filters
|
||||||
|
bool retry = false;
|
||||||
|
mutexM.Lock();
|
||||||
|
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
||||||
|
if (filtersM[i] && filtersM[i]->Send())
|
||||||
|
retry = true;
|
||||||
|
}
|
||||||
|
mutexM.Unlock();
|
||||||
|
if (retry)
|
||||||
|
continue;
|
||||||
// Read one TS packet
|
// Read one TS packet
|
||||||
if (ringBufferM) {
|
if (ringBufferM) {
|
||||||
int len = 0;
|
int len = 0;
|
||||||
if (processedM) {
|
if (processed) {
|
||||||
ringBufferM->Del(TS_SIZE);
|
ringBufferM->Del(TS_SIZE);
|
||||||
processedM = false;
|
processed = false;
|
||||||
}
|
}
|
||||||
uchar *p = ringBufferM->Get(len);
|
uchar *p = ringBufferM->Get(len);
|
||||||
if (p && (len >= TS_SIZE)) {
|
if (p && (len >= TS_SIZE)) {
|
||||||
@@ -289,7 +309,7 @@ void cIptvSectionFilterHandler::Action(void)
|
|||||||
filtersM[i]->Process(p);
|
filtersM[i]->Process(p);
|
||||||
}
|
}
|
||||||
mutexM.Unlock();
|
mutexM.Unlock();
|
||||||
processedM = true;
|
processed = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -358,7 +378,7 @@ int cIptvSectionFilterHandler::Open(u_short pidP, u_char tidP, u_char maskP)
|
|||||||
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
||||||
if (!filtersM[i]) {
|
if (!filtersM[i]) {
|
||||||
filtersM[i] = new cIptvSectionFilter(deviceIndexM, pidP, tidP, maskP);
|
filtersM[i] = new cIptvSectionFilter(deviceIndexM, pidP, tidP, maskP);
|
||||||
debug("cIptvSectionFilterHandler::%s(%d): pid=%d tid=%02X mask=%02X handle=%d index=%d", __FUNCTION__, deviceIndexM, pidP, tidP, maskP, filtersM[i]->GetFd(), i);
|
//debug("cIptvSectionFilterHandler::%s(%d): pid=%d tid=%02X mask=%02X handle=%d index=%u", __FUNCTION__, deviceIndexM, pidP, tidP, maskP, filtersM[i]->GetFd(), i);
|
||||||
return filtersM[i]->GetFd();
|
return filtersM[i]->GetFd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -380,6 +400,20 @@ void cIptvSectionFilterHandler::Close(int handleP)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cIptvSectionFilterHandler::GetPid(int handleP)
|
||||||
|
{
|
||||||
|
// Lock
|
||||||
|
cMutexLock MutexLock(&mutexM);
|
||||||
|
// Search the filter for data
|
||||||
|
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
||||||
|
if (filtersM[i] && (handleP == filtersM[i]->GetFd())) {
|
||||||
|
debug("cIptvSectionFilterHandler::%s(%d): pid=%d handle=%d index=%d", __FUNCTION__, deviceIndexM, filtersM[i]->GetPid(), filtersM[i]->GetFd(), i);
|
||||||
|
return filtersM[i]->GetPid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void cIptvSectionFilterHandler::Write(uchar *bufferP, int lengthP)
|
void cIptvSectionFilterHandler::Write(uchar *bufferP, int lengthP)
|
||||||
{
|
{
|
||||||
//debug("cIptvSectionFilterHandler::%s(%d): length=%d", __FUNCTION__, deviceIndexM, lengthP);
|
//debug("cIptvSectionFilterHandler::%s(%d): length=%d", __FUNCTION__, deviceIndexM, lengthP);
|
||||||
|
|||||||
@@ -18,10 +18,11 @@
|
|||||||
|
|
||||||
class cIptvSectionFilter : public cIptvSectionStatistics {
|
class cIptvSectionFilter : public cIptvSectionStatistics {
|
||||||
private:
|
private:
|
||||||
enum dmx_limits {
|
enum {
|
||||||
DMX_MAX_FILTER_SIZE = 18,
|
eDmxMaxFilterSize = 18,
|
||||||
DMX_MAX_SECTION_SIZE = 4096,
|
eDmxMaxSectionCount = 64,
|
||||||
DMX_MAX_SECFEED_SIZE = (DMX_MAX_SECTION_SIZE + TS_SIZE)
|
eDmxMaxSectionSize = 4096,
|
||||||
|
eDmxMaxSectionFeedSize = (eDmxMaxSectionSize + TS_SIZE)
|
||||||
};
|
};
|
||||||
|
|
||||||
int pusiSeenM;
|
int pusiSeenM;
|
||||||
@@ -29,21 +30,22 @@ private:
|
|||||||
int doneqM;
|
int doneqM;
|
||||||
|
|
||||||
uint8_t *secBufM;
|
uint8_t *secBufM;
|
||||||
uint8_t secBufBaseM[DMX_MAX_SECFEED_SIZE];
|
uint8_t secBufBaseM[eDmxMaxSectionFeedSize];
|
||||||
uint16_t secBufpM;
|
uint16_t secBufpM;
|
||||||
uint16_t secLenM;
|
uint16_t secLenM;
|
||||||
uint16_t tsFeedpM;
|
uint16_t tsFeedpM;
|
||||||
uint16_t pidM;
|
uint16_t pidM;
|
||||||
|
|
||||||
|
cRingBufferFrame *ringBufferM;
|
||||||
int deviceIndexM;
|
int deviceIndexM;
|
||||||
int socketM[2];
|
int socketM[2];
|
||||||
|
|
||||||
uint8_t filterValueM[DMX_MAX_FILTER_SIZE];
|
uint8_t filterValueM[eDmxMaxFilterSize];
|
||||||
uint8_t filterMaskM[DMX_MAX_FILTER_SIZE];
|
uint8_t filterMaskM[eDmxMaxFilterSize];
|
||||||
uint8_t filterModeM[DMX_MAX_FILTER_SIZE];
|
uint8_t filterModeM[eDmxMaxFilterSize];
|
||||||
|
|
||||||
uint8_t maskAndModeM[DMX_MAX_FILTER_SIZE];
|
uint8_t maskAndModeM[eDmxMaxFilterSize];
|
||||||
uint8_t maskAndNotModeM[DMX_MAX_FILTER_SIZE];
|
uint8_t maskAndNotModeM[eDmxMaxFilterSize];
|
||||||
|
|
||||||
inline uint16_t GetLength(const uint8_t *dataP);
|
inline uint16_t GetLength(const uint8_t *dataP);
|
||||||
void New(void);
|
void New(void);
|
||||||
@@ -56,6 +58,7 @@ public:
|
|||||||
cIptvSectionFilter(int deviceIndexP, uint16_t pidP, uint8_t tidP, uint8_t maskP);
|
cIptvSectionFilter(int deviceIndexP, uint16_t pidP, uint8_t tidP, uint8_t maskP);
|
||||||
virtual ~cIptvSectionFilter();
|
virtual ~cIptvSectionFilter();
|
||||||
void Process(const uint8_t* dataP);
|
void Process(const uint8_t* dataP);
|
||||||
|
bool Send(void);
|
||||||
int GetFd(void) { return socketM[0]; }
|
int GetFd(void) { return socketM[0]; }
|
||||||
uint16_t GetPid(void) const { return pidM; }
|
uint16_t GetPid(void) const { return pidM; }
|
||||||
};
|
};
|
||||||
@@ -65,10 +68,9 @@ private:
|
|||||||
enum {
|
enum {
|
||||||
eMaxSecFilterCount = 32
|
eMaxSecFilterCount = 32
|
||||||
};
|
};
|
||||||
|
cRingBufferLinear *ringBufferM;
|
||||||
cMutex mutexM;
|
cMutex mutexM;
|
||||||
int deviceIndexM;
|
int deviceIndexM;
|
||||||
bool processedM;
|
|
||||||
cRingBufferLinear *ringBufferM;
|
|
||||||
cIptvSectionFilter *filtersM[eMaxSecFilterCount];
|
cIptvSectionFilter *filtersM[eMaxSecFilterCount];
|
||||||
|
|
||||||
bool Delete(unsigned int indexP);
|
bool Delete(unsigned int indexP);
|
||||||
@@ -80,10 +82,10 @@ protected:
|
|||||||
public:
|
public:
|
||||||
cIptvSectionFilterHandler(int deviceIndexP, unsigned int bufferLenP);
|
cIptvSectionFilterHandler(int deviceIndexP, unsigned int bufferLenP);
|
||||||
virtual ~cIptvSectionFilterHandler();
|
virtual ~cIptvSectionFilterHandler();
|
||||||
bool Stop(void);
|
|
||||||
cString GetInformation(void);
|
cString GetInformation(void);
|
||||||
int Open(u_short pidP, u_char tidP, u_char maskP);
|
int Open(u_short pidP, u_char tidP, u_char maskP);
|
||||||
void Close(int handleP);
|
void Close(int handleP);
|
||||||
|
int GetPid(int handleP);
|
||||||
void Write(u_char *bufferP, int lengthP);
|
void Write(u_char *bufferP, int lengthP);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
24
setup.c
24
setup.c
@@ -113,9 +113,7 @@ eOSState cIptvMenuInfo::ProcessKey(eKeys keyP)
|
|||||||
cIptvPluginSetup::cIptvPluginSetup()
|
cIptvPluginSetup::cIptvPluginSetup()
|
||||||
{
|
{
|
||||||
debug("cIptvPluginSetup::%s()", __FUNCTION__);
|
debug("cIptvPluginSetup::%s()", __FUNCTION__);
|
||||||
tsBufferSizeM = IptvConfig.GetTsBufferSize();
|
protocolBasePortM = IptvConfig.GetProtocolBasePort();
|
||||||
tsBufferPrefillM = IptvConfig.GetTsBufferPrefillRatio();
|
|
||||||
extProtocolBasePortM = IptvConfig.GetExtProtocolBasePort();
|
|
||||||
sectionFilteringM = IptvConfig.GetSectionFiltering();
|
sectionFilteringM = IptvConfig.GetSectionFiltering();
|
||||||
numDisabledFiltersM = IptvConfig.GetDisabledFiltersCount();
|
numDisabledFiltersM = IptvConfig.GetDisabledFiltersCount();
|
||||||
if (numDisabledFiltersM > SECTION_FILTER_TABLE_SIZE)
|
if (numDisabledFiltersM > SECTION_FILTER_TABLE_SIZE)
|
||||||
@@ -136,20 +134,14 @@ void cIptvPluginSetup::Setup(void)
|
|||||||
Clear();
|
Clear();
|
||||||
helpM.Clear();
|
helpM.Clear();
|
||||||
|
|
||||||
Add(new cMenuEditIntItem( tr("TS buffer size [MB]"), &tsBufferSizeM, 1, 4));
|
Add(new cMenuEditIntItem(tr("Protocol base port"), &protocolBasePortM, 0, 0xFFFF - MAXDEVICES * 2));
|
||||||
helpM.Append(tr("Define a ringbuffer size for transport streams in megabytes.\n\nSmaller sizes help memory consumption, but are more prone to buffer overflows."));
|
helpM.Append(tr("Define a base port used by CURL/EXT protocol.\n\nThe port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the CURL/EXT protocol."));
|
||||||
|
|
||||||
Add(new cMenuEditIntItem( tr("TS buffer prefill ratio [%]"), &tsBufferPrefillM, 0, 40));
|
|
||||||
helpM.Append(tr("Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n\nThis is useful if streaming media over a slow or unreliable connection."));
|
|
||||||
|
|
||||||
Add(new cMenuEditIntItem( tr("EXT protocol base port"), &extProtocolBasePortM, 0, 0xFFF7));
|
|
||||||
helpM.Append(tr("Define a base port used by EXT protocol.\n\nThe port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."));
|
|
||||||
|
|
||||||
Add(new cMenuEditBoolItem(tr("Use section filtering"), §ionFilteringM));
|
Add(new cMenuEditBoolItem(tr("Use section filtering"), §ionFilteringM));
|
||||||
helpM.Append(tr("Define whether the section filtering shall be used.\n\nSection filtering means that IPTV plugin tries to parse and provide VDR with secondary data about the currently active stream. VDR can then use this data for providing various functionalities such as automatic pid change detection and EPG etc.\nEnabling this feature does not affect streams that do not contain section data."));
|
helpM.Append(tr("Define whether the section filtering shall be used.\n\nSection filtering means that IPTV plugin tries to parse and provide VDR with secondary data about the currently active stream. VDR can then use this data for providing various functionalities such as automatic pid change detection and EPG etc.\nEnabling this feature does not affect streams that do not contain section data."));
|
||||||
|
|
||||||
if (sectionFilteringM) {
|
if (sectionFilteringM) {
|
||||||
Add(new cMenuEditIntItem( tr("Disable filters"), &numDisabledFiltersM, 0, SECTION_FILTER_TABLE_SIZE));
|
Add(new cMenuEditIntItem(tr("Disable filters"), &numDisabledFiltersM, 0, SECTION_FILTER_TABLE_SIZE));
|
||||||
helpM.Append(tr("Define number of section filters to be disabled.\n\nCertain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process."));
|
helpM.Append(tr("Define number of section filters to be disabled.\n\nCertain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process."));
|
||||||
|
|
||||||
for (int i = 0; i < numDisabledFiltersM; ++i) {
|
for (int i = 0; i < numDisabledFiltersM; ++i) {
|
||||||
@@ -217,15 +209,11 @@ void cIptvPluginSetup::StoreFilters(const char *nameP, int *valuesP)
|
|||||||
void cIptvPluginSetup::Store(void)
|
void cIptvPluginSetup::Store(void)
|
||||||
{
|
{
|
||||||
// Store values into setup.conf
|
// Store values into setup.conf
|
||||||
SetupStore("TsBufferSize", tsBufferSizeM);
|
SetupStore("ExtProtocolBasePort", protocolBasePortM);
|
||||||
SetupStore("TsBufferPrefill", tsBufferPrefillM);
|
|
||||||
SetupStore("ExtProtocolBasePort", extProtocolBasePortM);
|
|
||||||
SetupStore("SectionFiltering", sectionFilteringM);
|
SetupStore("SectionFiltering", sectionFilteringM);
|
||||||
StoreFilters("DisabledFilters", disabledFilterIndexesM);
|
StoreFilters("DisabledFilters", disabledFilterIndexesM);
|
||||||
// Update global config
|
// Update global config
|
||||||
IptvConfig.SetTsBufferSize(tsBufferSizeM);
|
IptvConfig.SetProtocolBasePort(protocolBasePortM);
|
||||||
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefillM);
|
|
||||||
IptvConfig.SetExtProtocolBasePort(extProtocolBasePortM);
|
|
||||||
IptvConfig.SetSectionFiltering(sectionFilteringM);
|
IptvConfig.SetSectionFiltering(sectionFilteringM);
|
||||||
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i)
|
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i)
|
||||||
IptvConfig.SetDisabledFilters(i, disabledFilterIndexesM[i]);
|
IptvConfig.SetDisabledFilters(i, disabledFilterIndexesM[i]);
|
||||||
|
|||||||
4
setup.h
4
setup.h
@@ -15,9 +15,7 @@
|
|||||||
class cIptvPluginSetup : public cMenuSetupPage
|
class cIptvPluginSetup : public cMenuSetupPage
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int tsBufferSizeM;
|
int protocolBasePortM;
|
||||||
int tsBufferPrefillM;
|
|
||||||
int extProtocolBasePortM;
|
|
||||||
int sectionFilteringM;
|
int sectionFilteringM;
|
||||||
int numDisabledFiltersM;
|
int numDisabledFiltersM;
|
||||||
int disabledFilterIndexesM[SECTION_FILTER_TABLE_SIZE];
|
int disabledFilterIndexesM[SECTION_FILTER_TABLE_SIZE];
|
||||||
|
|||||||
27
socket.c
27
socket.c
@@ -21,6 +21,9 @@
|
|||||||
cIptvSocket::cIptvSocket()
|
cIptvSocket::cIptvSocket()
|
||||||
: socketPortM(0),
|
: socketPortM(0),
|
||||||
socketDescM(-1),
|
socketDescM(-1),
|
||||||
|
lastErrorReportM(0),
|
||||||
|
packetErrorsM(0),
|
||||||
|
sequenceNumberM(-1),
|
||||||
isActiveM(false)
|
isActiveM(false)
|
||||||
{
|
{
|
||||||
debug("cIptvSocket::%s()", __FUNCTION__);
|
debug("cIptvSocket::%s()", __FUNCTION__);
|
||||||
@@ -36,7 +39,7 @@ cIptvSocket::~cIptvSocket()
|
|||||||
|
|
||||||
bool cIptvSocket::OpenSocket(const int portP, const bool isUdpP)
|
bool cIptvSocket::OpenSocket(const int portP, const bool isUdpP)
|
||||||
{
|
{
|
||||||
debug("cIptvSocket::%s()", __FUNCTION__);
|
debug("cIptvSocket::%s(%d, %d)", __FUNCTION__, portP, isUdpP);
|
||||||
// If socket is there already and it is bound to a different port, it must
|
// If socket is there already and it is bound to a different port, it must
|
||||||
// be closed first
|
// be closed first
|
||||||
if (portP != socketPortM) {
|
if (portP != socketPortM) {
|
||||||
@@ -87,6 +90,11 @@ void cIptvSocket::CloseSocket(void)
|
|||||||
socketPortM = 0;
|
socketPortM = 0;
|
||||||
memset(&sockAddrM, 0, sizeof(sockAddrM));
|
memset(&sockAddrM, 0, sizeof(sockAddrM));
|
||||||
}
|
}
|
||||||
|
if (packetErrorsM) {
|
||||||
|
info("detected %d RTP packet errors", packetErrorsM);
|
||||||
|
packetErrorsM = 0;
|
||||||
|
lastErrorReportM = time(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvSocket::CheckAddress(const char *addrP, in_addr_t *inAddrP)
|
bool cIptvSocket::CheckAddress(const char *addrP, in_addr_t *inAddrP)
|
||||||
@@ -274,6 +282,21 @@ int cIptvUdpSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP)
|
|||||||
unsigned int cc = bufferAddrP[0] & 0x0F;
|
unsigned int cc = bufferAddrP[0] & 0x0F;
|
||||||
// Payload type: MPEG2 TS = 33
|
// Payload type: MPEG2 TS = 33
|
||||||
//unsigned int pt = bufferAddrP[1] & 0x7F;
|
//unsigned int pt = bufferAddrP[1] & 0x7F;
|
||||||
|
// Sequence number
|
||||||
|
int seq = ((bufferAddrP[2] & 0xFF) << 8) | (bufferAddrP[3] & 0xFF);
|
||||||
|
if ((((sequenceNumberM + 1) % 0xFFFF) == 0) && (seq == 0xFFFF))
|
||||||
|
sequenceNumberM = -1;
|
||||||
|
else if ((sequenceNumberM >= 0) && (((sequenceNumberM + 1) % 0xFFFF) != seq)) {
|
||||||
|
packetErrorsM++;
|
||||||
|
if (time(NULL) - lastErrorReportM > eReportIntervalS) {
|
||||||
|
info("detected %d RTP packet errors", packetErrorsM);
|
||||||
|
packetErrorsM = 0;
|
||||||
|
lastErrorReportM = time(NULL);
|
||||||
|
}
|
||||||
|
sequenceNumberM = seq;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sequenceNumberM = seq;
|
||||||
// Header lenght
|
// Header lenght
|
||||||
unsigned int headerlen = (3 + cc) * (unsigned int)sizeof(uint32_t);
|
unsigned int headerlen = (3 + cc) * (unsigned int)sizeof(uint32_t);
|
||||||
// Check if extension
|
// Check if extension
|
||||||
@@ -401,7 +424,7 @@ bool cIptvTcpSocket::Write(const char *bufferAddrP, unsigned int bufferLenP)
|
|||||||
//debug("cIptvTcpSocket::%s()", __FUNCTION__);
|
//debug("cIptvTcpSocket::%s()", __FUNCTION__);
|
||||||
// Error out if socket not initialized
|
// Error out if socket not initialized
|
||||||
if (socketDescM <= 0) {
|
if (socketDescM <= 0) {
|
||||||
error("Invalid socket in cIptvTcpSocket::%s()", __FUNCTION__);
|
error("cIptvTcpSocket::%s(): Invalid socket", __FUNCTION__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ERROR_IF_RET(send(socketDescM, bufferAddrP, bufferLenP, 0) < 0, "send()", return false);
|
ERROR_IF_RET(send(socketDescM, bufferAddrP, bufferLenP, 0) < 0, "send()", return false);
|
||||||
|
|||||||
6
socket.h
6
socket.h
@@ -18,8 +18,14 @@ private:
|
|||||||
int socketPortM;
|
int socketPortM;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
enum {
|
||||||
|
eReportIntervalS = 300 // in seconds
|
||||||
|
};
|
||||||
int socketDescM;
|
int socketDescM;
|
||||||
struct sockaddr_in sockAddrM;
|
struct sockaddr_in sockAddrM;
|
||||||
|
time_t lastErrorReportM;
|
||||||
|
int packetErrorsM;
|
||||||
|
int sequenceNumberM;
|
||||||
bool isActiveM;
|
bool isActiveM;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
20
source.c
20
source.c
@@ -136,8 +136,6 @@ const char *cIptvSourceParam::allowedProtocolCharsS = " abcdefghijklmnopqrstuvwx
|
|||||||
cIptvSourceParam::cIptvSourceParam(char sourceP, const char *descriptionP)
|
cIptvSourceParam::cIptvSourceParam(char sourceP, const char *descriptionP)
|
||||||
: cSourceParam(sourceP, descriptionP),
|
: cSourceParam(sourceP, descriptionP),
|
||||||
paramM(0),
|
paramM(0),
|
||||||
nidM(0),
|
|
||||||
tidM(0),
|
|
||||||
ridM(0),
|
ridM(0),
|
||||||
dataM(),
|
dataM(),
|
||||||
itpM()
|
itpM()
|
||||||
@@ -155,8 +153,6 @@ void cIptvSourceParam::SetData(cChannel *channelP)
|
|||||||
{
|
{
|
||||||
debug("cIptvSourceParam::%s(%s)", __FUNCTION__, channelP->Parameters());
|
debug("cIptvSourceParam::%s(%s)", __FUNCTION__, channelP->Parameters());
|
||||||
dataM = *channelP;
|
dataM = *channelP;
|
||||||
nidM = dataM.Nid();
|
|
||||||
tidM = dataM.Tid();
|
|
||||||
ridM = dataM.Rid();
|
ridM = dataM.Rid();
|
||||||
itpM.Parse(dataM.Parameters());
|
itpM.Parse(dataM.Parameters());
|
||||||
paramM = 0;
|
paramM = 0;
|
||||||
@@ -166,21 +162,19 @@ void cIptvSourceParam::GetData(cChannel *channelP)
|
|||||||
{
|
{
|
||||||
debug("cIptvSourceParam::%s(%s)", __FUNCTION__, channelP->Parameters());
|
debug("cIptvSourceParam::%s(%s)", __FUNCTION__, channelP->Parameters());
|
||||||
channelP->SetTransponderData(channelP->Source(), channelP->Frequency(), dataM.Srate(), itpM.ToString(Source()), true);
|
channelP->SetTransponderData(channelP->Source(), channelP->Frequency(), dataM.Srate(), itpM.ToString(Source()), true);
|
||||||
channelP->SetId(nidM, tidM, channelP->Sid(), ridM);
|
channelP->SetId(channelP->Nid(), channelP->Tid(), channelP->Sid(), ridM);
|
||||||
}
|
}
|
||||||
|
|
||||||
cOsdItem *cIptvSourceParam::GetOsdItem(void)
|
cOsdItem *cIptvSourceParam::GetOsdItem(void)
|
||||||
{
|
{
|
||||||
debug("cIptvSourceParam::%s()", __FUNCTION__);
|
debug("cIptvSourceParam::%s()", __FUNCTION__);
|
||||||
switch (paramM++) {
|
switch (paramM++) {
|
||||||
case 0: return new cMenuEditIntItem( tr("Nid"), &nidM, 0);
|
case 0: return new cMenuEditIntItem( tr("Rid"), &ridM, 0);
|
||||||
case 1: return new cMenuEditIntItem( tr("Tid"), &tidM, 0);
|
case 1: return new cMenuEditBoolItem(tr("Scan section ids"), &itpM.sidScanM);
|
||||||
case 2: return new cMenuEditIntItem( tr("Rid"), &ridM, 0);
|
case 2: return new cMenuEditBoolItem(tr("Scan pids"), &itpM.pidScanM);
|
||||||
case 3: return new cMenuEditBoolItem(tr("Scan section ids"), &itpM.sidScanM);
|
case 3: return new cMenuEditStraItem(tr("Protocol"), &itpM.protocolM, ELEMENTS(protocolsM), protocolsM);
|
||||||
case 4: return new cMenuEditBoolItem(tr("Scan pids"), &itpM.pidScanM);
|
case 4: return new cMenuEditStrItem( tr("Address"), itpM.addressM, sizeof(itpM.addressM), allowedProtocolCharsS);
|
||||||
case 5: return new cMenuEditStraItem(tr("Protocol"), &itpM.protocolM, ELEMENTS(protocolsM), protocolsM);
|
case 5: return new cMenuEditIntItem( tr("Parameter"), &itpM.parameterM, 0, 0xFFFF);
|
||||||
case 6: return new cMenuEditStrItem( tr("Address"), itpM.addressM, sizeof(itpM.addressM), allowedProtocolCharsS);
|
|
||||||
case 7: return new cMenuEditIntItem( tr("Parameter"), &itpM.parameterM, 0, 0xFFFF);
|
|
||||||
default: return NULL;
|
default: return NULL;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
2
source.h
2
source.h
@@ -51,8 +51,6 @@ class cIptvSourceParam : public cSourceParam
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int paramM;
|
int paramM;
|
||||||
int nidM;
|
|
||||||
int tidM;
|
|
||||||
int ridM;
|
int ridM;
|
||||||
cChannel dataM;
|
cChannel dataM;
|
||||||
cIptvTransponderParameters itpM;
|
cIptvTransponderParameters itpM;
|
||||||
|
|||||||
32
statistics.c
32
statistics.c
@@ -58,7 +58,11 @@ cIptvPidStatistics::cIptvPidStatistics()
|
|||||||
mutexM()
|
mutexM()
|
||||||
{
|
{
|
||||||
debug("cIptvPidStatistics::%s()", __FUNCTION__);
|
debug("cIptvPidStatistics::%s()", __FUNCTION__);
|
||||||
memset(mostActivePidsM, 0, sizeof(mostActivePidsM));
|
const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct);
|
||||||
|
for (int i = 0; i < numberOfElements; ++i) {
|
||||||
|
mostActivePidsM[i].pid = -1;
|
||||||
|
mostActivePidsM[i].dataAmount = 0L;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cIptvPidStatistics::~cIptvPidStatistics()
|
cIptvPidStatistics::~cIptvPidStatistics()
|
||||||
@@ -70,12 +74,13 @@ cString cIptvPidStatistics::GetPidStatistic()
|
|||||||
{
|
{
|
||||||
//debug("cIptvPidStatistics::%s()", __FUNCTION__);
|
//debug("cIptvPidStatistics::%s()", __FUNCTION__);
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
|
const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct);
|
||||||
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
|
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
|
||||||
timerM.Set();
|
timerM.Set();
|
||||||
cString s("Active pids:\n");
|
cString s("Active pids:\n");
|
||||||
for (unsigned int i = 0; i < IPTV_STATS_ACTIVE_PIDS_COUNT; ++i) {
|
for (int i = 0; i < numberOfElements; ++i) {
|
||||||
if (mostActivePidsM[i].pid) {
|
if (mostActivePidsM[i].pid >= 0) {
|
||||||
long bitrate = elapsed ? (long)(1000.0L * mostActivePidsM[i].DataAmount / KILOBYTE(1) / elapsed) : 0L;
|
long bitrate = elapsed ? (long)(1000.0L * mostActivePidsM[i].dataAmount / KILOBYTE(1) / elapsed) : 0L;
|
||||||
if (!IptvConfig.GetUseBytes())
|
if (!IptvConfig.GetUseBytes())
|
||||||
bitrate *= 8;
|
bitrate *= 8;
|
||||||
s = cString::sprintf("%sPid %d: %4d (%4ld k%s/s)\n", *s, i,
|
s = cString::sprintf("%sPid %d: %4d (%4ld k%s/s)\n", *s, i,
|
||||||
@@ -83,7 +88,10 @@ cString cIptvPidStatistics::GetPidStatistic()
|
|||||||
IptvConfig.GetUseBytes() ? "B" : "bit");
|
IptvConfig.GetUseBytes() ? "B" : "bit");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memset(mostActivePidsM, 0, sizeof(mostActivePidsM));
|
for (int i = 0; i < numberOfElements; ++i) {
|
||||||
|
mostActivePidsM[i].pid = -1;
|
||||||
|
mostActivePidsM[i].dataAmount = 0L;
|
||||||
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,14 +100,14 @@ int cIptvPidStatistics::SortPids(const void* data1P, const void* data2P)
|
|||||||
//debug("cIptvPidStatistics::%s()", __FUNCTION__);
|
//debug("cIptvPidStatistics::%s()", __FUNCTION__);
|
||||||
const pidStruct *comp1 = reinterpret_cast<const pidStruct*>(data1P);
|
const pidStruct *comp1 = reinterpret_cast<const pidStruct*>(data1P);
|
||||||
const pidStruct *comp2 = reinterpret_cast<const pidStruct*>(data2P);
|
const pidStruct *comp2 = reinterpret_cast<const pidStruct*>(data2P);
|
||||||
if (comp1->DataAmount > comp2->DataAmount)
|
if (comp1->dataAmount > comp2->dataAmount)
|
||||||
return -1;
|
return -1;
|
||||||
if (comp1->DataAmount < comp2->DataAmount)
|
if (comp1->dataAmount < comp2->dataAmount)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cIptvPidStatistics::AddPidStatistic(u_short pidP, long payloadP)
|
void cIptvPidStatistics::AddPidStatistic(int pidP, long payloadP)
|
||||||
{
|
{
|
||||||
//debug("cIptvPidStatistics::%s(%ld, %ld)", __FUNCTION__, pidP, payloadP);
|
//debug("cIptvPidStatistics::%s(%ld, %ld)", __FUNCTION__, pidP, payloadP);
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
@@ -107,7 +115,7 @@ void cIptvPidStatistics::AddPidStatistic(u_short pidP, long payloadP)
|
|||||||
// If our statistic already is in the array, update it and quit
|
// If our statistic already is in the array, update it and quit
|
||||||
for (int i = 0; i < numberOfElements; ++i) {
|
for (int i = 0; i < numberOfElements; ++i) {
|
||||||
if (mostActivePidsM[i].pid == pidP) {
|
if (mostActivePidsM[i].pid == pidP) {
|
||||||
mostActivePidsM[i].DataAmount += payloadP;
|
mostActivePidsM[i].dataAmount += payloadP;
|
||||||
// Now re-sort the array and quit
|
// Now re-sort the array and quit
|
||||||
qsort(mostActivePidsM, numberOfElements, sizeof(pidStruct), SortPids);
|
qsort(mostActivePidsM, numberOfElements, sizeof(pidStruct), SortPids);
|
||||||
return;
|
return;
|
||||||
@@ -115,9 +123,9 @@ void cIptvPidStatistics::AddPidStatistic(u_short pidP, long payloadP)
|
|||||||
}
|
}
|
||||||
// Apparently our pid isn't in the array. Replace the last element with this
|
// Apparently our pid isn't in the array. Replace the last element with this
|
||||||
// one if new payload is greater
|
// one if new payload is greater
|
||||||
if (mostActivePidsM[numberOfElements - 1].DataAmount < payloadP) {
|
if (mostActivePidsM[numberOfElements - 1].dataAmount < payloadP) {
|
||||||
mostActivePidsM[numberOfElements - 1].pid = pidP;
|
mostActivePidsM[numberOfElements - 1].pid = pidP;
|
||||||
mostActivePidsM[numberOfElements - 1].DataAmount = payloadP;
|
mostActivePidsM[numberOfElements - 1].dataAmount = payloadP;
|
||||||
// Re-sort
|
// Re-sort
|
||||||
qsort(mostActivePidsM, numberOfElements, sizeof(pidStruct), SortPids);
|
qsort(mostActivePidsM, numberOfElements, sizeof(pidStruct), SortPids);
|
||||||
}
|
}
|
||||||
@@ -184,7 +192,7 @@ cString cIptvBufferStatistics::GetBufferStatistic()
|
|||||||
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
|
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
|
||||||
timerM.Set();
|
timerM.Set();
|
||||||
long bitrate = elapsed ? (long)(1000.0L * dataBytesM / KILOBYTE(1) / elapsed) : 0L;
|
long bitrate = elapsed ? (long)(1000.0L * dataBytesM / KILOBYTE(1) / elapsed) : 0L;
|
||||||
long totalSpace = MEGABYTE(IptvConfig.GetTsBufferSize());
|
long totalSpace = IPTV_BUFFER_SIZE;
|
||||||
float percentage = (float)((float)usedSpaceM / (float)totalSpace * 100.0);
|
float percentage = (float)((float)usedSpaceM / (float)totalSpace * 100.0);
|
||||||
long totalKilos = totalSpace / KILOBYTE(1);
|
long totalKilos = totalSpace / KILOBYTE(1);
|
||||||
long usedKilos = usedSpaceM / KILOBYTE(1);
|
long usedKilos = usedSpaceM / KILOBYTE(1);
|
||||||
|
|||||||
@@ -35,12 +35,12 @@ public:
|
|||||||
cString GetPidStatistic();
|
cString GetPidStatistic();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddPidStatistic(u_short pidP, long payloadP);
|
void AddPidStatistic(int pidP, long payloadP);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct pidStruct {
|
struct pidStruct {
|
||||||
u_short pid;
|
int pid;
|
||||||
long DataAmount;
|
long dataAmount;
|
||||||
};
|
};
|
||||||
pidStruct mostActivePidsM[IPTV_STATS_ACTIVE_PIDS_COUNT];
|
pidStruct mostActivePidsM[IPTV_STATS_ACTIVE_PIDS_COUNT];
|
||||||
cTimeMs timerM;
|
cTimeMs timerM;
|
||||||
|
|||||||
14
streamer.c
14
streamer.c
@@ -79,7 +79,7 @@ bool cIptvStreamer::Close(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvStreamer::Set(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP)
|
bool cIptvStreamer::SetSource(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP)
|
||||||
{
|
{
|
||||||
debug("cIptvStreamer::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
debug("cIptvStreamer::%s(%s, %d, %d)", __FUNCTION__, locationP, parameterP, indexP);
|
||||||
if (!isempty(locationP)) {
|
if (!isempty(locationP)) {
|
||||||
@@ -89,16 +89,24 @@ bool cIptvStreamer::Set(const char* locationP, const int parameterP, const int i
|
|||||||
protocolM->Close();
|
protocolM->Close();
|
||||||
protocolM = protocolP;
|
protocolM = protocolP;
|
||||||
if (protocolM) {
|
if (protocolM) {
|
||||||
protocolM->Set(locationP, parameterP, indexP);
|
protocolM->SetSource(locationP, parameterP, indexP);
|
||||||
protocolM->Open();
|
protocolM->Open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (protocolM)
|
else if (protocolM)
|
||||||
protocolM->Set(locationP, parameterP, indexP);
|
protocolM->SetSource(locationP, parameterP, indexP);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cIptvStreamer::SetPid(int pidP, int typeP, bool onP)
|
||||||
|
{
|
||||||
|
debug("cIptvStreamer::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||||
|
if (protocolM)
|
||||||
|
return protocolM->SetPid(pidP, typeP, onP);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
cString cIptvStreamer::GetInformation(void)
|
cString cIptvStreamer::GetInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cIptvStreamer::%s()", __FUNCTION__);
|
//debug("cIptvStreamer::%s()", __FUNCTION__);
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ protected:
|
|||||||
public:
|
public:
|
||||||
cIptvStreamer(cIptvDeviceIf &deviceP, unsigned int packetLenP);
|
cIptvStreamer(cIptvDeviceIf &deviceP, unsigned int packetLenP);
|
||||||
virtual ~cIptvStreamer();
|
virtual ~cIptvStreamer();
|
||||||
bool Set(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP);
|
bool SetSource(const char* locationP, const int parameterP, const int indexP, cIptvProtocolIf* protocolP);
|
||||||
|
bool SetPid(int pidP, int typeP, bool onP);
|
||||||
bool Open(void);
|
bool Open(void);
|
||||||
bool Close(void);
|
bool Close(void);
|
||||||
cString GetInformation(void);
|
cString GetInformation(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user