summaryrefslogtreecommitdiff
path: root/p2pvr/scanner/eitRows.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'p2pvr/scanner/eitRows.cpp')
-rw-r--r--p2pvr/scanner/eitRows.cpp36
1 files changed, 13 insertions, 23 deletions
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();
}