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

Added channel specific sid and pid scanning options.

This commit is contained in:
Rolf Ahrenberg 2008-01-31 22:28:53 +00:00
parent 68459e6553
commit 89e3aba59e
9 changed files with 122 additions and 35 deletions

View File

@ -44,3 +44,5 @@ VDR Plugin 'iptv' Revision History
- Updated French translation (Thanks to Michaël Nival). - Updated French translation (Thanks to Michaël Nival).
- Modified VDR locale support detection. - Modified VDR locale support detection.
- Added preliminary automatic Pid scanning functionality. - Added preliminary automatic Pid scanning functionality.
- Modified channels.conf format to enable/disable channel
specific pid and sid scanning functionality.

19
README
View File

@ -107,15 +107,16 @@ Configuration:
- channels.conf - channels.conf
TV4;IPTV:4:IPTV|EXT|iptvstream.sh|0:P:0:0:680:0:0:4:0:0:0 TV4;IPTV:4:IPTV|S1P0|EXT|iptvstream.sh|0:P:0:0:680:0:0:4:0:0:0
TV3;IPTV:3:IPTV|FILE|/video/stream.ts|5:P:0:514:670:2321:0:3:0:0:0 TV3;IPTV:3:IPTV|S0P1|FILE|/video/stream.ts|5:P:0:514:670:2321:0:3:0:0:0
TV2;IPTV:2:IPTV|HTTP|127.0.0.1/TS/2|3000:P:0:513:660:2321:0:2:0:0:0 TV2;IPTV:2:IPTV|S0P1|HTTP|127.0.0.1/TS/2|3000:P:0:513:660:2321:0:2:0:0:0
TV1;IPTV:1:IPTV|UDP|127.0.0.1|1234:P:0:512:650:2321:0:1:0:0:0 TV1;IPTV:1:IPTV|S1P0|UDP|127.0.0.1|1234:P:0:512:650:2321:0:1:0:0:0
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
| | | | | Source type ("P") | | | | | | Source type ("P")
| | | | IP Port Number, File delay (ms), Script parameter | | | | | IP Port Number, File delay (ms), Script parameter
| | | IP Address, File location, Script location | | | | IP Address, File location, Script location
| | Protocol ("UDP", "HTTP", "FILE", "EXT") | | | Protocol ("UDP", "HTTP", "FILE", "EXT")
| | Parameters ("S" Sid scan, "P" Pid scan, "0" disable, "1" enable)
| Plugin ID ("IPTV") | Plugin ID ("IPTV")
Unique enumeration Unique enumeration

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: device.c,v 1.81 2008/01/30 22:41:59 rahrenbe Exp $ * $Id: device.c,v 1.82 2008/01/31 22:28:53 rahrenbe Exp $
*/ */
#include "config.h" #include "config.h"
@ -19,6 +19,8 @@ cIptvDevice::cIptvDevice(unsigned int Index)
: deviceIndex(Index), : deviceIndex(Index),
isPacketDelivered(false), isPacketDelivered(false),
isOpenDvr(false), isOpenDvr(false),
sidScanEnabled(false),
pidScanEnabled(false),
mutex() mutex()
{ {
debug("cIptvDevice::cIptvDevice(%d)\n", deviceIndex); debug("cIptvDevice::cIptvDevice(%d)\n", deviceIndex);
@ -157,13 +159,13 @@ cString cIptvDevice::GetInformation(unsigned int Page)
return info; return info;
} }
cString cIptvDevice::GetChannelSettings(const char *IptvParam, int *Parameter, cIptvProtocolIf* *Protocol) cString cIptvDevice::GetChannelSettings(const char *IptvParam, int *Parameter, int *SidScan, int *PidScan, cIptvProtocolIf* *Protocol)
{ {
debug("cIptvDevice::GetChannelSettings(%d)\n", deviceIndex); debug("cIptvDevice::GetChannelSettings(%d)\n", deviceIndex);
char *tag = NULL; char *tag = NULL;
char *proto = NULL; char *proto = NULL;
char *loc = NULL; char *loc = NULL;
if (sscanf(IptvParam, "%a[^|]|%a[^|]|%a[^|]|%u", &tag, &proto, &loc, Parameter) == 4) { if (sscanf(IptvParam, "%a[^|]|S%dP%d|%a[^|]|%a[^|]|%u", &tag, SidScan, PidScan, &proto, &loc, Parameter) == 6) {
cString tagstr(tag, true); cString tagstr(tag, true);
cString protostr(proto, true); cString protostr(proto, true);
cString locstr(loc, true); cString locstr(loc, true);
@ -184,6 +186,30 @@ cString cIptvDevice::GetChannelSettings(const char *IptvParam, int *Parameter, c
return locstr; return locstr;
} }
} }
// compatibility mode for old channels.conf format
else if (sscanf(IptvParam, "%a[^|]|%a[^|]|%a[^|]|%u", &tag, &proto, &loc, Parameter) == 4) {
cString tagstr(tag, true);
cString protostr(proto, true);
cString locstr(loc, true);
*SidScan = 0;
*PidScan = 0;
// check if IPTV tag
if (strncasecmp(*tagstr, "IPTV", 4) == 0) {
// check if protocol is supported and update the pointer
if (strncasecmp(*protostr, "UDP", 3) == 0)
*Protocol = pUdpProtocol;
else if (strncasecmp(*protostr, "HTTP", 4) == 0)
*Protocol = pHttpProtocol;
else if (strncasecmp(*protostr, "FILE", 4) == 0)
*Protocol = pFileProtocol;
else if (strncasecmp(*protostr, "EXT", 3) == 0)
*Protocol = pExtProtocol;
else
return NULL;
// return location
return locstr;
}
}
return NULL; return NULL;
} }
@ -225,20 +251,22 @@ int cIptvDevice::NumProvidedSystems(void) const
bool cIptvDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) bool cIptvDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
{ {
int parameter; int parameter, sidscan, pidscan;
cString location; cString location;
cIptvProtocolIf *protocol; cIptvProtocolIf *protocol;
debug("cIptvDevice::SetChannelDevice(%d)\n", deviceIndex); debug("cIptvDevice::SetChannelDevice(%d)\n", deviceIndex);
location = GetChannelSettings(Channel->PluginParam(), &parameter, &protocol); location = GetChannelSettings(Channel->PluginParam(), &parameter, &sidscan, &pidscan, &protocol);
if (isempty(location)) { if (isempty(location)) {
error("ERROR: Unrecognized IPTV channel settings: %s", Channel->PluginParam()); error("ERROR: Unrecognized IPTV channel settings: %s", Channel->PluginParam());
return false; return false;
} }
sidScanEnabled = sidscan ? true : false;
pidScanEnabled = pidscan ? true : false;
pIptvStreamer->Set(location, parameter, deviceIndex, protocol); pIptvStreamer->Set(location, parameter, deviceIndex, protocol);
if (pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning()) if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning())
pSidScanner->SetChannel(Channel); pSidScanner->SetChannel(Channel);
if (pPidScanner && IptvConfig.GetPidScanning()) if (pidScanEnabled && pPidScanner && IptvConfig.GetPidScanning())
pPidScanner->SetChannel(Channel); pPidScanner->SetChannel(Channel);
return true; return true;
} }
@ -318,7 +346,7 @@ bool cIptvDevice::OpenDvr(void)
mutex.Unlock(); mutex.Unlock();
ResetBuffering(); ResetBuffering();
pIptvStreamer->Open(); pIptvStreamer->Open();
if (pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning()) if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning())
pSidScanner->SetStatus(true); pSidScanner->SetStatus(true);
isOpenDvr = true; isOpenDvr = true;
return true; return true;
@ -327,7 +355,7 @@ bool cIptvDevice::OpenDvr(void)
void cIptvDevice::CloseDvr(void) void cIptvDevice::CloseDvr(void)
{ {
debug("cIptvDevice::CloseDvr(%d)\n", deviceIndex); debug("cIptvDevice::CloseDvr(%d)\n", deviceIndex);
if (pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning()) if (pidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering() && IptvConfig.GetSidScanning())
pSidScanner->SetStatus(false); pSidScanner->SetStatus(false);
if (pIptvStreamer) if (pIptvStreamer)
pIptvStreamer->Close(); pIptvStreamer->Close();
@ -388,7 +416,7 @@ bool cIptvDevice::GetTSPacket(uchar *&Data)
// Update pid statistics // Update pid statistics
AddPidStatistic(ts_pid(p), payload(p)); AddPidStatistic(ts_pid(p), payload(p));
// Analyze incomplete streams with built-in pid analyzer // Analyze incomplete streams with built-in pid analyzer
if (pPidScanner && IptvConfig.GetPidScanning()) if (pidScanEnabled && pPidScanner && IptvConfig.GetPidScanning())
pPidScanner->Process(p); pPidScanner->Process(p);
// Run the data through all filters // Run the data through all filters
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: device.h,v 1.37 2008/01/30 22:41:59 rahrenbe Exp $ * $Id: device.h,v 1.38 2008/01/31 22:28:53 rahrenbe Exp $
*/ */
#ifndef __IPTV_DEVICE_H #ifndef __IPTV_DEVICE_H
@ -37,6 +37,8 @@ private:
unsigned int deviceIndex; unsigned int deviceIndex;
bool isPacketDelivered; bool isPacketDelivered;
bool isOpenDvr; bool isOpenDvr;
bool sidScanEnabled;
bool pidScanEnabled;
cRingBufferLinear *tsBuffer; cRingBufferLinear *tsBuffer;
int tsBufferPrefill; int tsBufferPrefill;
cIptvProtocolUdp *pUdpProtocol; cIptvProtocolUdp *pUdpProtocol;
@ -67,7 +69,7 @@ private:
// for channel parsing & buffering // for channel parsing & buffering
private: private:
cString GetChannelSettings(const char *IptvParam, int *Parameter, cIptvProtocolIf* *Protocol); cString GetChannelSettings(const char *IptvParam, int *Parameter, int *SidScan, int *PidScan, cIptvProtocolIf* *Protocol);
bool ProvidesIptv(const char *Param) const; bool ProvidesIptv(const char *Param) const;
void ResetBuffering(void); void ResetBuffering(void);
bool IsBuffering(void); bool IsBuffering(void);

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: iptv 0.0.6\n" "Project-Id-Version: iptv 0.0.6\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
"POT-Creation-Date: 2008-01-30 23:53+0200\n" "POT-Creation-Date: 2008-02-01 00:24+0200\n"
"PO-Revision-Date: 2007-10-29 21:19+0100\n" "PO-Revision-Date: 2007-10-29 21:19+0100\n"
"Last-Translator: Tobias Grimm <tg@e-tobi.net>\n" "Last-Translator: Tobias Grimm <tg@e-tobi.net>\n"
"Language-Team: German\n" "Language-Team: German\n"
@ -70,6 +70,12 @@ msgstr "Adresse"
msgid "Port" msgid "Port"
msgstr "Port" msgstr "Port"
msgid "Scan Sid"
msgstr "Scanne SID"
msgid "Scan Pid"
msgstr "Scanne PID"
msgid "Nid" msgid "Nid"
msgstr "Nid" msgstr "Nid"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: iptv 0.0.6\n" "Project-Id-Version: iptv 0.0.6\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
"POT-Creation-Date: 2008-01-30 23:53+0200\n" "POT-Creation-Date: 2008-02-01 00:24+0200\n"
"PO-Revision-Date: 2007-08-12 23:22+0300\n" "PO-Revision-Date: 2007-08-12 23:22+0300\n"
"Last-Translator: Rolf Ahrenberg\n" "Last-Translator: Rolf Ahrenberg\n"
"Language-Team: <vdr@linuxtv.org>\n" "Language-Team: <vdr@linuxtv.org>\n"
@ -69,6 +69,12 @@ msgstr "Osoite"
msgid "Port" msgid "Port"
msgstr "Portti" msgstr "Portti"
msgid "Scan Sid"
msgstr "Etsi palvelu-ID"
msgid "Scan Pid"
msgstr "Etsi ohjelmatunnisteet"
msgid "Nid" msgid "Nid"
msgstr "Verkko-ID" msgstr "Verkko-ID"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: iptv 0.0.6\n" "Project-Id-Version: iptv 0.0.6\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
"POT-Creation-Date: 2008-01-30 23:53+0200\n" "POT-Creation-Date: 2008-02-01 00:24+0200\n"
"PO-Revision-Date: 2008-01-26 13:14+0100\n" "PO-Revision-Date: 2008-01-26 13:14+0100\n"
"Last-Translator: NIVAL Michaël <mnival@club-internet.fr>\n" "Last-Translator: NIVAL Michaël <mnival@club-internet.fr>\n"
"Language-Team: French\n" "Language-Team: French\n"
@ -71,6 +71,12 @@ msgstr "Adresse"
msgid "Port" msgid "Port"
msgstr "Port" msgstr "Port"
msgid "Scan Sid"
msgstr "Scanne les SID"
msgid "Scan Pid"
msgstr "Scanne les PID"
msgid "Nid" msgid "Nid"
msgstr "Nid" msgstr "Nid"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: iptv 0.0.6\n" "Project-Id-Version: iptv 0.0.6\n"
"Report-Msgid-Bugs-To: Rolf Ahrenberg\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n"
"POT-Creation-Date: 2008-01-30 23:53+0200\n" "POT-Creation-Date: 2008-02-01 00:24+0200\n"
"PO-Revision-Date: 2008-01-13 16:46+0100\n" "PO-Revision-Date: 2008-01-13 16:46+0100\n"
"Last-Translator: Gringo <vdr-italian@tiscali.it>\n" "Last-Translator: Gringo <vdr-italian@tiscali.it>\n"
"Language-Team: Italian\n" "Language-Team: Italian\n"
@ -70,6 +70,12 @@ msgstr "Indirizzo"
msgid "Port" msgid "Port"
msgstr "Porta" msgstr "Porta"
msgid "Scan Sid"
msgstr "Scansione Sid"
msgid "Scan Pid"
msgstr "Scansione Pid"
msgid "Nid" msgid "Nid"
msgstr "Nid" msgstr "Nid"

50
setup.c
View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: setup.c,v 1.51 2008/01/30 21:57:33 rahrenbe Exp $ * $Id: setup.c,v 1.52 2008/01/31 22:28:53 rahrenbe Exp $
*/ */
#include <string.h> #include <string.h>
@ -37,12 +37,13 @@ private:
struct tIptvChannel { struct tIptvChannel {
int frequency, source, protocol, parameter, vpid, ppid, tpid, sid, nid, tid, rid; int frequency, source, protocol, parameter, vpid, ppid, tpid, sid, nid, tid, rid;
int apid[MAXAPIDS + 1], dpid[MAXDPIDS + 1], spid[MAXSPIDS + 1], caids[MAXCAIDS + 1]; int apid[MAXAPIDS + 1], dpid[MAXDPIDS + 1], spid[MAXSPIDS + 1], caids[MAXCAIDS + 1];
int sidscan, pidscan;
char name[256], location[256]; char name[256], location[256];
} data; } data;
cChannel *channel; cChannel *channel;
const char *protocols[eProtocolCount]; const char *protocols[eProtocolCount];
void Setup(void); void Setup(void);
cString GetIptvSettings(const char *Param, int *Parameter, int *Protocol); cString GetIptvSettings(const char *Param, int *Parameter, int *SidScan, int *PidScan, int *Protocol);
void GetChannelData(cChannel *Channel); void GetChannelData(cChannel *Channel);
void SetChannelData(cChannel *Channel); void SetChannelData(cChannel *Channel);
@ -69,12 +70,12 @@ cIptvMenuEditChannel::cIptvMenuEditChannel(cChannel *Channel, bool New)
Setup(); Setup();
} }
cString cIptvMenuEditChannel::GetIptvSettings(const char *Param, int *Parameter, int *Protocol) cString cIptvMenuEditChannel::GetIptvSettings(const char *Param, int *Parameter, int *SidScan, int *PidScan, int *Protocol)
{ {
char *tag = NULL; char *tag = NULL;
char *proto = NULL; char *proto = NULL;
char *loc = NULL; char *loc = NULL;
if (sscanf(Param, "%a[^|]|%a[^|]|%a[^|]|%d", &tag, &proto, &loc, Parameter) == 4) { if (sscanf(Param, "%a[^|]|S%dP%d|%a[^|]|%a[^|]|%d", &tag, SidScan, PidScan, &proto, &loc, Parameter) == 6) {
cString tagstr(tag, true); cString tagstr(tag, true);
cString protostr(proto, true); cString protostr(proto, true);
cString locstr(loc, true); cString locstr(loc, true);
@ -95,13 +96,36 @@ cString cIptvMenuEditChannel::GetIptvSettings(const char *Param, int *Parameter,
return locstr; return locstr;
} }
} }
else if (sscanf(Param, "%a[^|]|%a[^|]|%a[^|]|%d", &tag, &proto, &loc, Parameter) == 4) {
cString tagstr(tag, true);
cString protostr(proto, true);
cString locstr(loc, true);
*SidScan = 0;
*PidScan = 0;
// check if IPTV tag
if (strncasecmp(*tagstr, "IPTV", 4) == 0) {
// check if protocol is supported and update the pointer
if (strncasecmp(*protostr, "UDP", 3) == 0)
*Protocol = eProtocolUDP;
else if (strncasecmp(*protostr, "HTTP", 4) == 0)
*Protocol = eProtocolHTTP;
else if (strncasecmp(*protostr, "FILE", 4) == 0)
*Protocol = eProtocolFILE;
else if (strncasecmp(*protostr, "EXT", 3) == 0)
*Protocol = eProtocolEXT;
else
return NULL;
// return location
return locstr;
}
}
return NULL; return NULL;
} }
void cIptvMenuEditChannel::GetChannelData(cChannel *Channel) void cIptvMenuEditChannel::GetChannelData(cChannel *Channel)
{ {
if (Channel) { if (Channel) {
int parameter, protocol; int parameter, protocol, sidscan, pidscan;
data.frequency = Channel->Frequency(); data.frequency = Channel->Frequency();
data.source = Channel->Source(); data.source = Channel->Source();
data.vpid = Channel->Vpid(); data.vpid = Channel->Vpid();
@ -120,7 +144,9 @@ void cIptvMenuEditChannel::GetChannelData(cChannel *Channel)
data.tid = Channel->Tid(); data.tid = Channel->Tid();
data.rid = Channel->Rid(); data.rid = Channel->Rid();
strn0cpy(data.name, Channel->Name(), sizeof(data.name)); strn0cpy(data.name, Channel->Name(), sizeof(data.name));
strn0cpy(data.location, *GetIptvSettings(Channel->PluginParam(), &parameter, &protocol), sizeof(data.location)); strn0cpy(data.location, *GetIptvSettings(Channel->PluginParam(), &parameter, &sidscan, &pidscan, &protocol), sizeof(data.location));
data.sidscan = sidscan;
data.pidscan = pidscan;
data.protocol = protocol; data.protocol = protocol;
data.parameter = parameter; data.parameter = parameter;
} }
@ -144,6 +170,8 @@ void cIptvMenuEditChannel::GetChannelData(cChannel *Channel)
data.rid = 0; data.rid = 0;
strn0cpy(data.name, "IPTV", sizeof(data.name)); strn0cpy(data.name, "IPTV", sizeof(data.name));
strn0cpy(data.location, "127.0.0.1", sizeof(data.location)); strn0cpy(data.location, "127.0.0.1", sizeof(data.location));
data.sidscan = 0;
data.pidscan = 0;
data.protocol = eProtocolUDP; data.protocol = eProtocolUDP;
data.parameter = 1234; data.parameter = 1234;
} }
@ -157,17 +185,17 @@ void cIptvMenuEditChannel::SetChannelData(cChannel *Channel)
char dlangs[MAXDPIDS][MAXLANGCODE2] = { "" }; char dlangs[MAXDPIDS][MAXLANGCODE2] = { "" };
switch (data.protocol) { switch (data.protocol) {
case eProtocolEXT: case eProtocolEXT:
param = cString::sprintf("IPTV|EXT|%s|%d", data.location, data.parameter); param = cString::sprintf("IPTV|S%dP%d|EXT|%s|%d", data.sidscan, data.pidscan, data.location, data.parameter);
break; break;
case eProtocolFILE: case eProtocolFILE:
param = cString::sprintf("IPTV|FILE|%s|%d", data.location, data.parameter); param = cString::sprintf("IPTV|S%dP%d|FILE|%s|%d", data.sidscan, data.pidscan, data.location, data.parameter);
break; break;
case eProtocolHTTP: case eProtocolHTTP:
param = cString::sprintf("IPTV|HTTP|%s|%d", data.location, data.parameter); param = cString::sprintf("IPTV|S%dP%d|HTTP|%s|%d", data.sidscan, data.pidscan, data.location, data.parameter);
break; break;
default: default:
case eProtocolUDP: case eProtocolUDP:
param = cString::sprintf("IPTV|UDP|%s|%d", data.location, data.parameter); param = cString::sprintf("IPTV|S%dP%d|UDP|%s|%d", data.sidscan, data.pidscan, data.location, data.parameter);
break; break;
} }
#if defined(APIVERSNUM) && APIVERSNUM < 10510 #if defined(APIVERSNUM) && APIVERSNUM < 10510
@ -218,6 +246,8 @@ void cIptvMenuEditChannel::Setup(void)
Add(new cMenuEditIntItem(tr("Port"), &data.parameter, 0, 0xFFFF)); Add(new cMenuEditIntItem(tr("Port"), &data.parameter, 0, 0xFFFF));
break; break;
} }
Add(new cMenuEditBoolItem(tr("Scan Sid"), &data.sidscan));
Add(new cMenuEditBoolItem(tr("Scan Pid"), &data.pidscan));
// Normal settings // Normal settings
#if defined(APIVERSNUM) && APIVERSNUM < 10511 #if defined(APIVERSNUM) && APIVERSNUM < 10511
Add(new cMenuEditStrItem(trVDR("Name"), data.name, sizeof(data.name), trVDR(FileNameChars))); Add(new cMenuEditStrItem(trVDR("Name"), data.name, sizeof(data.name), trVDR(FileNameChars)));