summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2013-05-29 20:23:33 +0000
committerrandomdan <randomdan@localhost>2013-05-29 20:23:33 +0000
commit00b15b88fbe93aa3966124b8e18d5059c7e29b00 (patch)
treec6abdbfcff764c70c8ffad6c325915baf29a6ec3
parentDrag up to date (diff)
downloadp2pvr-00b15b88fbe93aa3966124b8e18d5059c7e29b00.tar.bz2
p2pvr-00b15b88fbe93aa3966124b8e18d5059c7e29b00.tar.xz
p2pvr-00b15b88fbe93aa3966124b8e18d5059c7e29b00.zip
Tidy up and fixes - tested working
-rw-r--r--p2pvr/cron/importSchedule.xml (renamed from p2pvr/cron/importSchedume.xml)2
-rw-r--r--p2pvr/cron/sched.xml33
-rw-r--r--p2pvr/cron/schedule.xml35
-rw-r--r--p2pvr/cron/serv.xml16
-rw-r--r--p2pvr/cron/services.xml16
-rw-r--r--p2pvr/datasources/postgres.xml6
-rw-r--r--p2pvr/scanner/dvbSiReaderHelper.cpp14
-rw-r--r--p2pvr/scanner/dvbSiReaderHelper.h15
-rw-r--r--p2pvr/scanner/eitRows.cpp36
-rw-r--r--p2pvr/scanner/eitRows.h33
-rw-r--r--p2pvr/scanner/serviceRows.cpp26
-rw-r--r--p2pvr/scanner/serviceRows.h15
12 files changed, 122 insertions, 125 deletions
diff --git a/p2pvr/cron/importSchedume.xml b/p2pvr/cron/importSchedule.xml
index fd065eb..2cc0765 100644
--- a/p2pvr/cron/importSchedume.xml
+++ b/p2pvr/cron/importSchedule.xml
@@ -26,7 +26,7 @@
<contentRecommendation source="parent" attribute="contentRecommendation" depth="1" />
<contentSeriesID source="parent" attribute="contentSeriesID" depth="1" />
<startTime source="parent" attribute="startTime" depth="1" />
- <stopTime attribute="stopTime" depth="1" />
+ <stopTime source="parent" attribute="stopTime" depth="1" />
<eventID source="parent" attribute="eventID" depth="1" />
<episode source="parent" attribute="episode" depth="1" />
<episodes source="parent" attribute="episodes" depth="1" />
diff --git a/p2pvr/cron/sched.xml b/p2pvr/cron/sched.xml
deleted file mode 100644
index c2f9230..0000000
--- a/p2pvr/cron/sched.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-<block name="importSchedule" xmlns:p2="http://project2.randomdan.homeip.net">
- <p2:library path="libp2pvr-scan-p2.so" />
- <p2:eitrows name="schedule" demux="/dev/dvb/adapter0/demux0" />
- <p2:view name="showSchedule" source="schedule" rootname="sched" recordname="show">
- <columns>
- <column name="title">title</column>
- <column name="titleLang" source="attribute">titleLang</column>
- <column name="subtitle" source="attribute">subtitle</column>
- <column name="serviceID" source="attribute">serviceID</column>
- <column name="descLang" source="attribute">descLang</column>
- <column name="desc1" source="attribute">desc1</column>
- <column name="desc2" source="attribute">desc2</column>
- <column name="desc3" source="attribute">desc3</column>
- <column name="videoAspect" source="attribute">videoAspect</column>
- <column name="videoFrameRate" source="attribute">videoFrameRate</column>
- <column name="videoHD" source="attribute">videoHD</column>
- <column name="audioChannels" source="attribute">audioChannels</column>
- <column name="language" source="attribute">language</column>
- <column name="teletextSubtitleLang" source="attribute">teletextSubtitleLang</column>
- <column name="category" source="attribute">category</column>
- <column name="dvbRating" source="attribute">dvbRating</column>
- <column name="contentItemID" source="attribute">contentItemID</column>
- <column name="contentSeriesID" source="attribute">contentSeriesID</column>
- <column name="contentRecommendation" source="attribute">contentRecommendation</column>
- <column name="startTime" source="attribute">startTime</column>
- <column name="stopTime" source="attribute">stopTime</column>
- <column name="serviceID" source="attribute">serviceID</column>
- <column name="episode" source="attribute">episode</column>
- <column name="episodes" source="attribute">episodes</column>
- </columns>
- </p2:view>
-</block>
diff --git a/p2pvr/cron/schedule.xml b/p2pvr/cron/schedule.xml
new file mode 100644
index 0000000..8d76e99
--- /dev/null
+++ b/p2pvr/cron/schedule.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<block name="importSchedule" xmlns:p2="http://project2.randomdan.homeip.net">
+ <p2:library path="libp2pvr-scan-p2.so" />
+ <p2:eitrows name="schedule" demux="/dev/dvb/adapter0/demux0" />
+ <p2:view name="showSchedule" source="schedule" rootname="sched" recordname="show">
+ <columns>
+ <title source="parent" attribute="title" depth="1" />
+ <titleLang source="parent" attribute="titleLang" depth="1" />
+ <subtitle source="parent" attribute="subtitle" depth="1" />
+ <serviceID source="parent" attribute="serviceID" depth="1" />
+ <descLang source="parent" attribute="descLang" depth="1" />
+ <desc1 source="parent" attribute="desc1" depth="1" />
+ <desc2 source="parent" attribute="desc2" depth="1" />
+ <desc3 source="parent" attribute="desc3" depth="1" />
+ <videoAspect source="parent" attribute="videoAspect" depth="1" />
+ <videoFrameRate source="parent" attribute="videoFrameRate" depth="1" />
+ <videoHD source="parent" attribute="videoHD" depth="1" />
+ <audioChannels source="parent" attribute="audioChannels" depth="1" />
+ <language source="parent" attribute="language" depth="1" />
+ <teletextSubtitleLang source="parent" attribute="teletextSubtitleLang" depth="1" />
+ <category source="parent" attribute="category" depth="1" />
+ <dvbRating source="parent" attribute="dvbRating" depth="1" />
+ <contentItemID source="parent" attribute="contentItemID" depth="1" />
+ <contentRecommendation source="parent" attribute="contentRecommendation" depth="1" />
+ <contentSeriesID source="parent" attribute="contentSeriesID" depth="1" />
+ <startTime source="parent" attribute="startTime" depth="1" />
+ <stopTime source="parent" attribute="stopTime" depth="1" />
+ <eventID source="parent" attribute="eventID" depth="1" />
+ <episode source="parent" attribute="episode" depth="1" />
+ <episodes source="parent" attribute="episodes" depth="1" />
+ <year source="parent" attribute="year" depth="1" />
+ <flags source="parent" attribute="flags" depth="1" />
+ </columns>
+ </p2:view>
+</block>
diff --git a/p2pvr/cron/serv.xml b/p2pvr/cron/serv.xml
deleted file mode 100644
index 1cc209e..0000000
--- a/p2pvr/cron/serv.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<block name="showServices" xmlns:p2="http://project2.randomdan.homeip.net">
- <p2:library path="libp2pvr-scan-p2.so" />
- <p2:servicerows name="services" demux="/dev/dvb/adapter0/demux0" />
- <p2:view name="showServices" source="services" rootname="services" recordname="service">
- <columns>
- <column name="serviceID" source="attribute">serviceID</column>
- <column name="name">name</column>
- <column name="providerName" source="attribute">providerName</column>
- <column name="defaultAuthority" source="attribute">defaultAuthority</column>
- <column name="transportID" source="attribute">transportID</column>
- <column name="type" source="attribute">type</column>
- </columns>
- </p2:view>
-</block>
-
diff --git a/p2pvr/cron/services.xml b/p2pvr/cron/services.xml
new file mode 100644
index 0000000..bdd038e
--- /dev/null
+++ b/p2pvr/cron/services.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<block name="showServices" xmlns:p2="http://project2.randomdan.homeip.net">
+ <p2:library path="libp2pvr-scan-p2.so" />
+ <p2:servicerows name="services" demux="/dev/dvb/adapter0/demux0" />
+ <p2:view name="showServices" source="services" rootname="services" recordname="service">
+ <columns>
+ <serviceID source="parent" attribute="serviceID" depth="1" />
+ <name source="parent" attribute="name" depth="1" />
+ <providerName source="parent" attribute="providerName" depth="1" />
+ <transportID source="parent" attribute="transportID" depth="1" />
+ <type source="parent" attribute="type" depth="1" />
+ <defaultAuthority source="parent" attribute="defaultAuthority" depth="1" />
+ </columns>
+ </p2:view>
+</block>
+
diff --git a/p2pvr/datasources/postgres.xml b/p2pvr/datasources/postgres.xml
index df1ac0f..7d7440e 100644
--- a/p2pvr/datasources/postgres.xml
+++ b/p2pvr/datasources/postgres.xml
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<project2:rdbmsdatasource xmlns:project2="http://project2.randomdan.homeip.net" name="postgres">
<readonly preferlocal="true">
- <dsn host="defiant"><postgresql>host=defiant sslmode=disable user=p2tv dbname=gentoo options='-c search_path=p2tv,public'</postgresql></dsn>
- <dsn host="firebrand"><postgresql>host=firebrand sslmode=disable user=p2tv dbname=gentoo options='-c search_path=p2tv,public'</postgresql></dsn>
+ <dsn host="defiant" provider="postgresql" dsn="host=defiant sslmode=disable user=p2tv dbname=gentoo options='-c search_path=p2tv,public'" />
+ <dsn host="firebrand" provider="postgresql" dsn="host=firebrand sslmode=disable user=p2tv dbname=gentoo options='-c search_path=p2tv,public'" />
</readonly>
- <masterdsn><postgresql>host=defiant sslmode=disable user=p2tv dbname=gentoo options='-c search_path=p2tv,public'</postgresql></masterdsn>
+ <masterdsn host="defiant" provider="postgresql" dsn="host=defiant sslmode=disable user=p2tv dbname=gentoo options='-c search_path=p2tv,public'" />
</project2:rdbmsdatasource>
diff --git a/p2pvr/scanner/dvbSiReaderHelper.cpp b/p2pvr/scanner/dvbSiReaderHelper.cpp
index 1737921..7a14cd4 100644
--- a/p2pvr/scanner/dvbSiReaderHelper.cpp
+++ b/p2pvr/scanner/dvbSiReaderHelper.cpp
@@ -12,9 +12,9 @@ SimpleMessageException(ErrorReadingData);
SimpleMessageException(TimeoutReadingData);
SimpleMessageException(DemuxOpenFailure);
-const std::string DvbSiReaderHelper::ISO10646("ISO-10646");
-const std::string DvbSiReaderHelper::EitEncoding("ISO6937");
-const std::string DvbSiReaderHelper::UTF8("UTF8");
+const std::string DvbSiParserHelper::ISO10646("ISO-10646");
+const std::string DvbSiParserHelper::EitEncoding("ISO6937");
+const std::string DvbSiParserHelper::UTF8("UTF8");
DvbSiReaderHelper::DvbSiReaderHelper(const ScriptNodePtr p) :
demux(p, "demux", "/dev/dvb/adapter0/demux0"),
@@ -46,8 +46,8 @@ DvbSiReaderHelper::closeInput() const
}
}
-DvbSiReaderHelper::StrPtr
-DvbSiReaderHelper::convert(const char * txt, size_t len)
+DvbSiParserHelper::StrPtr
+DvbSiParserHelper::convert(const char * txt, size_t len)
{
if (len == 0) {
return boost::shared_ptr<Glib::ustring>(new Glib::ustring());
@@ -99,7 +99,7 @@ _dvb_crc32(void * buf, size_t len)
}
void
-DvbSiReaderHelper::readTables(const RowProcessor * rp) const
+DvbSiReaderHelper::readTables(const InfoTableParser & parseInfoTable) const
{
u_char buf[1<<12];
struct pollfd ufd;
@@ -117,7 +117,7 @@ DvbSiReaderHelper::readTables(const RowProcessor * rp) const
if (n < l)
throw ErrorReadingData("Smaller that section length");
if (_dvb_crc32(buf, l)) {
- if (parseInfoTable(buf, l, rp)) {
+ if (parseInfoTable(buf, l)) {
time(&lastuseful);
}
else {
diff --git a/p2pvr/scanner/dvbSiReaderHelper.h b/p2pvr/scanner/dvbSiReaderHelper.h
index bdcc3b6..66e1206 100644
--- a/p2pvr/scanner/dvbSiReaderHelper.h
+++ b/p2pvr/scanner/dvbSiReaderHelper.h
@@ -3,11 +3,14 @@
#include "scripts.h"
#include "variables.h"
+#include <boost/function.hpp>
class RowProcessor;
class DvbSiReaderHelper {
public:
+ typedef boost::function<bool (const u_char *, size_t)> InfoTableParser;
+
DvbSiReaderHelper(const ScriptNodePtr p);
~DvbSiReaderHelper();
@@ -17,18 +20,20 @@ class DvbSiReaderHelper {
protected:
void openInput() const;
virtual void filterInput(int fd) const = 0;
- void readTables(const RowProcessor *) const;
- virtual bool parseInfoTable(const u_char *data, size_t len, const RowProcessor *) const = 0;
+ void readTables(const InfoTableParser &) const;
void closeInput() const;
+ private:
+ mutable int fd_epg;
+};
+
+class DvbSiParserHelper {
+ protected:
typedef boost::shared_ptr<Glib::ustring> StrPtr;
static StrPtr convert(const char * txt, size_t len);
static const std::string ISO10646;
static const std::string EitEncoding;
static const std::string UTF8;
-
- private:
- mutable int fd_epg;
};
#endif
diff --git a/p2pvr/scanner/eitRows.cpp b/p2pvr/scanner/eitRows.cpp
index 6f1934a..cb69882 100644
--- a/p2pvr/scanner/eitRows.cpp
+++ b/p2pvr/scanner/eitRows.cpp
@@ -45,6 +45,7 @@
#include "rowProcessor.h"
#include "eitRows.h"
+#include <boost/tuple/tuple_comparison.hpp>
struct EitProgram {
VariableType serviceID;
@@ -151,7 +152,7 @@ static Glib::RefPtr<Glib::Regex> yearRegex = Glib::Regex::create("\\(([0-9]{4})[
static Glib::RefPtr<Glib::Regex> flagsRegex = Glib::Regex::create("[ []+([A-Z,]+)\\]");
void
-EitRows::parseEventDescription(const u_char * data, EitProgram * current) const {
+EitRowState::parseEventDescription(const u_char * data, EitProgram * current) const {
assert(GetDescriptorTag(data) == 0x4D);
const struct descr_short_event *evtdesc = reinterpret_cast<const struct descr_short_event *>(data);
@@ -232,7 +233,7 @@ EitRows::parseEventDescription(const u_char * data, EitProgram * current) const
/* Parse 0x4E Extended Event Descriptor. {{{ */
void
-EitRows::parseLongEventDescription(const u_char * data, EitProgram * current) const {
+EitRowState::parseLongEventDescription(const u_char * data, EitProgram * current) const {
assert(GetDescriptorTag(data) == 0x4E);
const struct descr_extended_event *levt = reinterpret_cast<const struct descr_extended_event *>(data);
bool non_empty = (levt->descriptor_number || levt->last_descriptor_number || levt->length_of_items || levt->data[0]);
@@ -274,7 +275,7 @@ EitRows::parseLongEventDescription(const u_char * data, EitProgram * current) co
only output the first one of each (XMLTV can't cope with more than
one) */
void
-EitRows::parseComponentDescription(const u_char * data, EitProgram * current) const {
+EitRowState::parseComponentDescription(const u_char * data, EitProgram * current) const {
assert(GetDescriptorTag(data) == 0x50);
const struct descr_component *dc = reinterpret_cast<const struct descr_component *>(data);
@@ -299,7 +300,7 @@ EitRows::parseComponentDescription(const u_char * data, EitProgram * current) co
} /*}}}*/
void
-EitRows::parseContentDescription(const u_char * data, EitProgram * current) const {
+EitRowState::parseContentDescription(const u_char * data, EitProgram * current) const {
assert(GetDescriptorTag(data) == 0x54);
const struct descr_content * dc = reinterpret_cast<const struct descr_content *>(data);
for (const u_char * p = reinterpret_cast<const u_char*>(&dc->data); p < data + DESCR_GEN_LEN + dc->descriptor_length; p += NIBBLE_CONTENT_LEN) {
@@ -311,7 +312,7 @@ EitRows::parseContentDescription(const u_char * data, EitProgram * current) cons
}
void
-EitRows::parseRatingDescription(const u_char * data, EitProgram * current) const {
+EitRowState::parseRatingDescription(const u_char * data, EitProgram * current) const {
assert(GetDescriptorTag(data) == 0x55);
const struct descr_parental_rating * pr = reinterpret_cast<const struct descr_parental_rating *>(data);
for (const u_char * p = reinterpret_cast<const u_char *>(&pr->data); p < data + DESCR_GEN_LEN + pr->descriptor_length; p += PARENTAL_RATING_ITEM_LEN) {
@@ -336,7 +337,7 @@ int parsePrivateDataSpecifier(const u_char *data) {
/* Parse 0x76 Content Identifier Descriptor. {{{ */
/* See ETSI TS 102 323, section 12 */
void
-EitRows::parseContentIdentifierDescription(const u_char * data, EitProgram * current) const {
+EitRowState::parseContentIdentifierDescription(const u_char * data, EitProgram * current) const {
assert(GetDescriptorTag(data) == 0x76);
const struct descr_content_identifier *ci = reinterpret_cast<const struct descr_content_identifier *>(data);
for (const u_char * p = reinterpret_cast<const u_char *>(&ci->data); p < data + DESCR_GEN_LEN + ci->descriptor_length; p += DESCR_GEN_LEN + ci->descriptor_length) {
@@ -378,7 +379,7 @@ EitRows::parseContentIdentifierDescription(const u_char * data, EitProgram * cur
'new', 'subtitles', 'rating', 'star-rating'
*/
void
-EitRows::parseDescription(const u_char * data, size_t len, EitProgram * current) const {
+EitRowState::parseDescription(const u_char * data, size_t len, EitProgram * current) const {
int pds = 0;
for (const u_char * p = data; p < data + len; p += DESCR_GEN_LEN + GetDescriptorLength(p)) {
const struct descr_gen *desc = reinterpret_cast<const struct descr_gen *>(p);
@@ -447,25 +448,13 @@ static bool validateDescription(const u_char *data, size_t len) {
return false;
} /*}}}*/
-EitRows::SeenProgram::SeenProgram(int s, int e) :
- sid(s),
- eid(e)
-{
-}
-bool
-EitRows::SeenProgram::operator<(const SeenProgram & o) const
-{
- return ((this->sid < o.sid) || ((this->sid == o.sid) && (this->eid < o.eid)));
-}
-
bool
-EitRows::parseInfoTable(const u_char *data, size_t len, const RowProcessor * rp) const {
+EitRowState::parseInfoTable(const u_char *data, size_t len, const RowProcessor * rp) {
const struct eit *e = reinterpret_cast<const struct eit *>(data);
len -= 4; //remove CRC
// For each event listing
- EitRowState state;
bool found = false;
for (const u_char *p = reinterpret_cast<const u_char *>(&e->data); p < data + len; p += EIT_EVENT_LEN + GetEITDescriptorsLoopLength(p)) {
const struct eit_event *evt = reinterpret_cast<const struct eit_event *>(p);
@@ -487,7 +476,7 @@ EitRows::parseInfoTable(const u_char *data, size_t len, const RowProcessor * rp)
BcdCharToInt(evt->start_time_m),
BcdCharToInt(evt->start_time_s));
EitProgram results;
- state.current = &results;
+ current = &results;
results.startTime = startTime;
results.stopTime = startTime + boost::posix_time::time_duration(
BcdCharToInt(evt->duration_h),
@@ -504,7 +493,7 @@ EitRows::parseInfoTable(const u_char *data, size_t len, const RowProcessor * rp)
results.eventID = HILO(evt->event_id);
parseDescription(reinterpret_cast<const u_char *>(&evt->data), GetEITDescriptorsLoopLength(evt), &results);
- state.process(rp);
+ process(rp);
found = true;
}
return found;
@@ -531,8 +520,9 @@ EitRows::filterInput(int fd) const
void
EitRows::execute(const Glib::ustring &, const RowProcessor * rp) const
{
+ EitRowState state;
openInput();
- readTables(rp);
+ readTables(boost::bind(&EitRowState::parseInfoTable, &state, _1, _2, rp));
closeInput();
}
diff --git a/p2pvr/scanner/eitRows.h b/p2pvr/scanner/eitRows.h
index 1d76c2d..2a3603f 100644
--- a/p2pvr/scanner/eitRows.h
+++ b/p2pvr/scanner/eitRows.h
@@ -5,6 +5,7 @@
#include "rowSet.h"
#include "variables.h"
#include "dvbSiReaderHelper.h"
+#include <boost/tuple/tuple.hpp>
class EitProgram;
@@ -17,18 +18,18 @@ class EitRows : public RowSet, DvbSiReaderHelper {
void loadComplete(const CommonObjects *);
private:
- class SeenProgram {
- public:
- SeenProgram(int sid, int eid);
- bool operator<(const SeenProgram &) const;
- const int sid;
- const int eid;
- };
- typedef std::set<SeenProgram> SeenPrograms;
- mutable SeenPrograms seenPrograms;
-
void filterInput(int fd) const;
- bool parseInfoTable(const u_char *data, size_t len, const RowProcessor *) const;
+};
+
+class EitRowState : public RowState, DvbSiParserHelper {
+ public:
+ EitRowState();
+ const Columns & getColumns() const;
+ RowAttribute resolveAttr(const Glib::ustring & attrName) const;
+
+ bool parseInfoTable(const u_char *data, size_t len, const RowProcessor *);
+
+ private:
void parseEventDescription(const u_char *data, EitProgram * current) const;
void parseLongEventDescription(const u_char *data, EitProgram * current) const;
void parseComponentDescription(const u_char *data, EitProgram * current) const;
@@ -36,15 +37,11 @@ class EitRows : public RowSet, DvbSiReaderHelper {
void parseRatingDescription(const u_char *data, EitProgram * current) const;
void parseContentIdentifierDescription(const u_char *data, EitProgram * current) const;
void parseDescription(const u_char * data, size_t len, EitProgram * current) const;
-};
-class EitRowState : public RowState {
- public:
- EitRowState();
- const Columns & getColumns() const;
- RowAttribute resolveAttr(const Glib::ustring & attrName) const;
+ typedef boost::tuple<int, int> SeenProgram;
+ typedef std::set<SeenProgram> SeenPrograms;
+ SeenPrograms seenPrograms;
- private:
Columns columns;
friend class EitRows;
mutable EitProgram * current;
diff --git a/p2pvr/scanner/serviceRows.cpp b/p2pvr/scanner/serviceRows.cpp
index 39a0cd7..38b1459 100644
--- a/p2pvr/scanner/serviceRows.cpp
+++ b/p2pvr/scanner/serviceRows.cpp
@@ -90,29 +90,29 @@ ServiceRows::filterInput(int fd) const
void
ServiceRows::execute(const Glib::ustring &, const RowProcessor * rp) const
{
+ ServiceRowState state;
openInput();
- readTables(rp);
+ readTables(boost::bind(&ServiceRowState::parseInfoTable, &state, _1, _2, rp));
closeInput();
}
bool
-ServiceRows::parseInfoTable(const u_char * data, size_t len, const RowProcessor * rp) const {
+ServiceRowState::parseInfoTable(const u_char * data, size_t len, const RowProcessor * rp) {
const struct sit *e = reinterpret_cast<const struct sit *>(data);
assert(e->tableid == 0x42 || e->tableid == 0x46);
len -= 4; //remove CRC
// For each event listing
bool found = false;
- ServiceRowState state;
for (const u_char * p = e->serviceData; p < data + len; ) {
const struct si * sid = reinterpret_cast<const struct si *>(p);
int sID = be16toh(sid->serviceid);
bool seen = (seenServices.find(sID) != seenServices.end());
- if (!seen) {
- size_t dll = HILO(sid->desc_loop_len);
- Service serv;
- state.current = &serv;
- for (p = sid->descData; p < sid->descData + dll; p += DESCR_GEN_LEN + GetDescriptorLength(p)) {
+ size_t dll = HILO(sid->desc_loop_len);
+ Service serv;
+ current = &serv;
+ for (p = sid->descData; p < sid->descData + dll; p += DESCR_GEN_LEN + GetDescriptorLength(p)) {
+ if (!seen) {
serv.serviceID = sID;
serv.transportID = be16toh(e->transport_stream_id);
const struct descr_gen *desc = reinterpret_cast<const struct descr_gen *>(p);
@@ -127,16 +127,18 @@ ServiceRows::parseInfoTable(const u_char * data, size_t len, const RowProcessor
break;
}
}
- seenServices.insert(sID);
- state.process(rp);
+ }
+ if (!seen) {
found = true;
+ seenServices.insert(sID);
+ process(rp);
}
}
return found;
}
void
-ServiceRows::parseServiceDescriptor(const u_char * p, size_t, Service * current) const
+ServiceRowState::parseServiceDescriptor(const u_char * p, size_t, Service * current) const
{
current->type = p[2];
if (p[3]) {
@@ -146,7 +148,7 @@ ServiceRows::parseServiceDescriptor(const u_char * p, size_t, Service * current)
}
void
-ServiceRows::parseServiceAuthDescriptor(const u_char * p, size_t len, Service * current) const
+ServiceRowState::parseServiceAuthDescriptor(const u_char * p, size_t len, Service * current) const
{
current->defaultAuthority = *convert((const char *)(p + 2), len);
}
diff --git a/p2pvr/scanner/serviceRows.h b/p2pvr/scanner/serviceRows.h
index 0fbd119..83eb623 100644
--- a/p2pvr/scanner/serviceRows.h
+++ b/p2pvr/scanner/serviceRows.h
@@ -17,22 +17,23 @@ class ServiceRows : public RowSet, DvbSiReaderHelper {
void loadComplete(const CommonObjects *);
private:
- typedef std::set<int> SeenServices;
- mutable SeenServices seenServices;
-
void filterInput(int fd) const;
- bool parseInfoTable(const u_char *data, size_t len, const RowProcessor *) const;
- void parseServiceDescriptor(const u_char *data, size_t len, Service * current) const;
- void parseServiceAuthDescriptor(const u_char *data, size_t len, Service * current) const;
};
-class ServiceRowState : public RowState {
+class ServiceRowState : public RowState, DvbSiParserHelper {
public:
ServiceRowState();
const Columns & getColumns() const;
RowAttribute resolveAttr(const Glib::ustring & attrName) const;
+ bool parseInfoTable(const u_char *data, size_t len, const RowProcessor *);
private:
+ void parseServiceDescriptor(const u_char *data, size_t len, Service * current) const;
+ void parseServiceAuthDescriptor(const u_char *data, size_t len, Service * current) const;
+
+ typedef std::set<int> SeenServices;
+ SeenServices seenServices;
+
Columns columns;
friend class ServiceRows;
mutable Service * current;