eitd: remove old commented code

This commit is contained in:
[CST] Focus
2012-02-10 15:38:24 +04:00
parent 1d467ede60
commit 179804b37a
8 changed files with 72 additions and 976 deletions

View File

@@ -23,25 +23,13 @@
// //
// //
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <sys/poll.h> // fuer poll()
#include <set>
#include <algorithm>
#include <string>
#include "SIlanguage.hpp" #include "SIlanguage.hpp"
#include "SIutils.hpp" #include "SIutils.hpp"
#include "SIservices.hpp"
#include "SIevents.hpp" #include "SIevents.hpp"
#include "SIsections.hpp"
#include <dmxapi.h>
#include <dvbsi++/descriptor_tag.h> #include <dvbsi++/descriptor_tag.h>
#include <dvbsi++/short_event_descriptor.h> #include <dvbsi++/short_event_descriptor.h>
#include <dvbsi++/extended_event_descriptor.h> #include <dvbsi++/extended_event_descriptor.h>
@@ -52,32 +40,6 @@
const std::string languangeOFF = "OFF"; const std::string languangeOFF = "OFF";
#if 0
SIevent::SIevent(const struct eit_event *e)
{
eventID = (e->event_id_hi << 8) | e->event_id_lo;
time_t start_time = changeUTCtoCtime(((const unsigned char *)e) + 2);
unsigned long duration = 0;
if (!((e->duration_hi == 0xff) && (e->duration_mid == 0xff) && (e->duration_lo == 0xff)))
duration = ((e->duration_hi)>>4)*10*3600L + ((e->duration_hi)&0x0f)*3600L +
((e->duration_mid)>>4)*10*60L + ((e->duration_mid)&0x0f)*60L +
((e->duration_lo)>>4)*10 + ((e->duration_lo)&0x0f);
//printf("SIevent::SIevent: eventID %x start %d duration %d\n", eventID, (int) start_time, (int) duration);
if (start_time && duration)
times.insert(SItime(start_time, duration));
running = (int)e->running_status;
table_id = 0xFF; /* not set */
version = 0xFF;
service_id = 0;
original_network_id = 0;
transport_stream_id = 0;
}
#endif
SIevent::SIevent(const t_original_network_id _original_network_id, const t_transport_stream_id _transport_stream_id, const t_service_id _service_id, SIevent::SIevent(const t_original_network_id _original_network_id, const t_transport_stream_id _transport_stream_id, const t_service_id _service_id,
const unsigned short _event_id) const unsigned short _event_id)
{ {
@@ -176,37 +138,13 @@ void SIevent::parse(Event &event)
l.name = convertDVBUTF8((const char*)&((*privateData)[0]), privateData->size(), 1, tsidonid); l.name = convertDVBUTF8((const char*)&((*privateData)[0]), privateData->size(), 1, tsidonid);
linkage_descs.insert(linkage_descs.end(), l); linkage_descs.insert(linkage_descs.end(), l);
} }
#if 0 // TODO ? vps was never used
else if(dtype == PDC_DESCRIPTOR) {
}
#endif
} }
} }
#if 0
// Std-Copy
SIevent::SIevent(const SIevent &e)
{
eventID=e.eventID;
langName=e.langName;
langText=e.langText;
// startzeit=e.startzeit;
// dauer=e.dauer;
times=e.times;
service_id = e.service_id;
original_network_id = e.original_network_id;
transport_stream_id = e.transport_stream_id;
itemDescription=e.itemDescription;
item=e.item;
langExtendedText=e.langExtendedText;
contentClassification=e.contentClassification;
userClassification=e.userClassification;
components=e.components;
ratings=e.ratings;
linkage_descs=e.linkage_descs;
running=e.running;
vps = e.vps;
table_id = e.table_id;
version = e.version;
}
#endif
char SIevent::getFSK() const char SIevent::getFSK() const
{ {
for (SIparentalRatings::iterator it = ratings.begin(); it != ratings.end(); ++it) for (SIparentalRatings::iterator it = ratings.begin(); it != ratings.end(); ++it)
@@ -214,7 +152,7 @@ char SIevent::getFSK() const
if (it->countryCode == "DEU") if (it->countryCode == "DEU")
{ {
if ((it->rating >= 0x01) && (it->rating <= 0x0F)) if ((it->rating >= 0x01) && (it->rating <= 0x0F))
return (it->rating + 3); // 0x01 to 0x0F minimum age = rating + 3 years return (it->rating + 3); // 0x01 to 0x0F minimum age = rating + 3 years
else else
return (it->rating == 0 ? 0 : 18); // return FSK 18 for : 0x10 to 0xFF defined by the broadcaster return (it->rating == 0 ? 0 : 18); // return FSK 18 for : 0x10 to 0xFF defined by the broadcaster
} }
@@ -227,7 +165,7 @@ char SIevent::getFSK() const
return (ratings.begin()->rating == 0 ? 0 : 18); return (ratings.begin()->rating == 0 ? 0 : 18);
} }
return 0x00; // 0x00 undefined return 0x00; // 0x00 undefined
} }
std::string SIevent::getName() const std::string SIevent::getName() const

View File

@@ -1,5 +1,3 @@
#ifndef SIEVENTS_HPP
#define SIEVENTS_HPP
// //
// $Id: SIevents.hpp,v 1.29 2008/08/16 19:23:18 seife Exp $ // $Id: SIevents.hpp,v 1.29 2008/08/16 19:23:18 seife Exp $
// //
@@ -23,117 +21,32 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// //
#ifndef SIEVENTS_HPP
#define SIEVENTS_HPP
#include <endian.h>
#include <vector> #include <vector>
#include <map> #include <map>
#include <set>
#include <algorithm>
#include <string>
#include <sectionsdclient/sectionsdtypes.h> #include <sectionsdclient/sectionsdtypes.h>
#include "edvbstring.h" #include "edvbstring.h"
#include <dvbsi++/event_information_section.h> #include <dvbsi++/event_information_section.h>
//#include "SIutils.hpp"
// forward references
class SIservice;
class SIservices;
class SIbouquets;
#if 0
struct eit_event {
unsigned event_id_hi : 8;
unsigned event_id_lo : 8;
unsigned start_time_hi : 8;
unsigned start_time_hi2 : 8;
unsigned start_time_mid : 8;
unsigned start_time_lo2 : 8;
unsigned start_time_lo : 8;
unsigned duration_hi : 8;
unsigned duration_mid : 8;
unsigned duration_lo : 8;
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned running_status : 3;
unsigned free_CA_mode : 1;
unsigned descriptors_loop_length_hi : 4;
#else
unsigned descriptors_loop_length_hi : 4;
unsigned free_CA_mode : 1;
unsigned running_status : 3;
#endif
unsigned descriptors_loop_length_lo : 8;
} __attribute__ ((packed)) ;
#endif
struct descr_component_header {
unsigned descriptor_tag : 8;
unsigned descriptor_length : 8;
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned reserved_future_use : 4;
unsigned stream_content : 4;
#else
unsigned stream_content : 4;
unsigned reserved_future_use : 4;
#endif
unsigned component_type : 8;
unsigned component_tag : 8;
unsigned iso_639_2_language_code_hi : 8;
unsigned iso_639_2_language_code_mid : 8;
unsigned iso_639_2_language_code_lo : 8;
} __attribute__ ((packed)) ;
#if 0
struct descr_linkage_header {
unsigned descriptor_tag : 8;
unsigned descriptor_length : 8;
unsigned transport_stream_id_hi : 8;
unsigned transport_stream_id_lo : 8;
unsigned original_network_id_hi : 8;
unsigned original_network_id_lo : 8;
unsigned service_id_hi : 8;
unsigned service_id_lo : 8;
unsigned linkage_type : 8;
} __attribute__ ((packed)) ;
#endif
#if 0
struct descr_pdc_header {
unsigned descriptor_tag : 8;
unsigned descriptor_length : 8;
unsigned pil0 : 8;
unsigned pil1 : 8;
unsigned pil2 : 8;
} __attribute__ ((packed)) ;
#endif
class SIlinkage { class SIlinkage {
public: public:
#if 0 unsigned char linkageType;
SIlinkage(const struct descr_linkage_header *link) { std::string name;
linkageType = link->linkage_type; t_transport_stream_id transportStreamId;
transportStreamId = (link->transport_stream_id_hi << 8) | link->transport_stream_id_lo; t_original_network_id originalNetworkId;
originalNetworkId = (link->original_network_id_hi << 8) | link->original_network_id_lo; t_service_id serviceId;
serviceId = (link->service_id_hi << 8) | link->service_id_lo;
if (link->descriptor_length > sizeof(struct descr_linkage_header) - 2)
//name = std::string(((const char *)link) + sizeof(struct descr_linkage_header), link->descriptor_length - (sizeof(struct descr_linkage_header) - 2));
name = convertDVBUTF8(((const char *)link)+sizeof(struct descr_linkage_header), link->descriptor_length-(sizeof(struct descr_linkage_header)-2), 0, 0);
}
// Std-copy
SIlinkage(const SIlinkage &l) {
linkageType = l.linkageType;
transportStreamId = l.transportStreamId;
originalNetworkId = l.originalNetworkId;
serviceId = l.serviceId;
name = l.name;
}
#endif
// default
SIlinkage(void) { SIlinkage(void) {
linkageType = 0; linkageType = 0;
transportStreamId = 0; transportStreamId = 0;
originalNetworkId = 0; originalNetworkId = 0;
serviceId = 0; serviceId = 0;
// name = ;
} }
// Der Operator zum sortieren // Der Operator zum sortieren
@@ -159,11 +72,6 @@ public:
return 0; return 0;
} }
unsigned char linkageType; // Linkage Descriptor
std::string name; // Text aus dem Linkage Descriptor
t_transport_stream_id transportStreamId; // Linkage Descriptor
t_original_network_id originalNetworkId; // Linkage Descriptor
t_service_id serviceId; // Linkage Descriptor
}; };
// Fuer for_each // Fuer for_each
@@ -180,33 +88,16 @@ struct saveSIlinkageXML : public std::unary_function<class SIlinkage, void>
void operator() (const SIlinkage &l) { l.saveXML(f);} void operator() (const SIlinkage &l) { l.saveXML(f);}
}; };
//typedef std::multiset <SIlinkage, std::less<SIlinkage> > SIlinkage_descs;
typedef std::vector<class SIlinkage> SIlinkage_descs; typedef std::vector<class SIlinkage> SIlinkage_descs;
class SIcomponent class SIcomponent
{ {
public: public:
std::string component; // Text aus dem Component Descriptor std::string component;
unsigned char componentType; // Component Descriptor unsigned char componentType;
unsigned char componentTag; // Component Descriptor unsigned char componentTag;
unsigned char streamContent; // Component Descriptor unsigned char streamContent;
#if 0
SIcomponent(const struct descr_component_header *comp) {
streamContent=comp->stream_content;
componentType=comp->component_type;
componentTag=comp->component_tag;
if(comp->descriptor_length>sizeof(struct descr_component_header)-2)
//component=std::string(((const char *)comp)+sizeof(struct descr_component_header), comp->descriptor_length-(sizeof(struct descr_component_header)-2));
component=convertDVBUTF8(((const char *)comp)+sizeof(struct descr_component_header), comp->descriptor_length-(sizeof(struct descr_component_header)-2), 0, 0);
}
// Std-copy
SIcomponent(const SIcomponent &c) {
streamContent=c.streamContent;
componentType=c.componentType;
componentTag=c.componentTag;
component=c.component;
}
#endif
SIcomponent(void) { SIcomponent(void) {
streamContent=0; streamContent=0;
componentType=0; componentType=0;
@@ -257,13 +148,7 @@ class SIparentalRating
rating=rate; rating=rate;
countryCode=cc; countryCode=cc;
} }
#if 0
// Std-Copy
SIparentalRating(const SIparentalRating &r) {
rating=r.rating;
countryCode=r.countryCode;
}
#endif
// Der Operator zum sortieren // Der Operator zum sortieren
bool operator < (const SIparentalRating& c) const { bool operator < (const SIparentalRating& c) const {
return countryCode < c.countryCode; return countryCode < c.countryCode;
@@ -303,13 +188,7 @@ class SItime {
startzeit=s; startzeit=s;
dauer=d; // in Sekunden, 0 -> time shifted (cinedoms) dauer=d; // in Sekunden, 0 -> time shifted (cinedoms)
} }
#if 0
// Std-Copy
SItime(const SItime &t) {
startzeit=t.startzeit;
dauer=t.dauer;
}
#endif
// Der Operator zum sortieren // Der Operator zum sortieren
bool operator < (const SItime& t) const { bool operator < (const SItime& t) const {
return startzeit < t.startzeit; return startzeit < t.startzeit;
@@ -370,11 +249,7 @@ class SIevent
std::string item; // Aus dem Extended Descriptor std::string item; // Aus dem Extended Descriptor
std::string contentClassification; // Aus dem Content Descriptor, als String, da mehrere vorkommen koennen std::string contentClassification; // Aus dem Content Descriptor, als String, da mehrere vorkommen koennen
std::string userClassification; // Aus dem Content Descriptor, als String, da mehrere vorkommen koennen std::string userClassification; // Aus dem Content Descriptor, als String, da mehrere vorkommen koennen
#if 0
SIevent(const struct eit_event *);
// Std-Copy
SIevent(const SIevent &);
#endif
SIevent(const t_original_network_id, const t_transport_stream_id, const t_service_id, const unsigned short); SIevent(const t_original_network_id, const t_transport_stream_id, const t_service_id, const unsigned short);
SIevent(void) { SIevent(void) {
service_id = 0; service_id = 0;

View File

@@ -1,5 +1,3 @@
#ifndef SILANGUAGES_HPP
#define SILANGUAGES_HPP
// //
// $Id: SIlanguage.hpp,v 1.2 2006/04/12 21:23:58 Arzka Exp $ // $Id: SIlanguage.hpp,v 1.2 2006/04/12 21:23:58 Arzka Exp $
// //
@@ -21,17 +19,9 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// //
// $Log: SIlanguage.hpp,v $
// Revision 1.2 2006/04/12 21:23:58 Arzka #ifndef SILANGUAGES_HPP
// Optimization. #define SILANGUAGES_HPP
// Removed unnecessary copying of std:map and
// removed few avoidable std::string creation
//
// Revision 1.1 2006/03/26 20:13:49 Arzka
// Added support for selecting EPG language
//
//
//
#include <string> #include <string>
#include <vector> #include <vector>

View File

@@ -26,121 +26,19 @@
#include <config.h> #include <config.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <set>
#include <algorithm>
#include <string>
#include "SIutils.hpp" #include "SIutils.hpp"
#include "SIservices.hpp" #include "SIservices.hpp"
#include "SIevents.hpp" #include "SIevents.hpp"
#include "SIsections.hpp" #include "SIsections.hpp"
#include <zapit/dvbstring.h>
#include <edvbstring.h> #include <edvbstring.h>
#ifdef ENABLE_FREESATEPG
//#include "FreesatTables.hpp"
#endif
#include <dvbsi++/descriptor_tag.h> #include <dvbsi++/descriptor_tag.h>
#include <dvbsi++/nvod_reference_descriptor.h> #include <dvbsi++/nvod_reference_descriptor.h>
#include <dvbsi++/service_descriptor.h> #include <dvbsi++/service_descriptor.h>
struct descr_generic_header {
unsigned descriptor_tag : 8;
unsigned descriptor_length : 8;
} __attribute__ ((packed)) ;
#if 0
struct descr_short_event_header {
unsigned descriptor_tag : 8;
unsigned descriptor_length : 8;
unsigned language_code_hi : 8;
unsigned language_code_mid : 8;
unsigned language_code_lo : 8;
unsigned event_name_length : 8;
} __attribute__ ((packed)) ;
#endif
#if 0
struct descr_service_header {
unsigned descriptor_tag : 8;
unsigned descriptor_length : 8;
unsigned service_typ : 8;
unsigned service_provider_name_length : 8;
} __attribute__ ((packed)) ;
#endif
#if 0
struct descr_extended_event_header {
unsigned descriptor_tag : 8;
unsigned descriptor_length : 8;
unsigned descriptor_number : 4;
unsigned last_descriptor_number : 4;
unsigned iso_639_2_language_code_hi : 8;
unsigned iso_639_2_language_code_mid : 8;
unsigned iso_639_2_language_code_lo : 8;
unsigned length_of_items : 8;
} __attribute__ ((packed)) ;
#endif
#if 0
struct service_list_entry {
unsigned service_id_hi : 8;
unsigned service_id_lo : 8;
unsigned service_type : 8;
} __attribute__ ((packed)) ;
struct private_data_specifier {
unsigned byte1 : 8;
unsigned byte2 : 8;
unsigned byte3 : 8;
unsigned byte4 : 8;
} __attribute__ ((packed)) ;
inline unsigned min(unsigned a, unsigned b)
{
return b < a ? b : a;
}
#endif
void SIsectionEIT::parse(void) void SIsectionEIT::parse(void)
{ {
#if 0
if (!buffer || parsed)
return;
const uint8_t *actPos;
const uint8_t *bufEnd;
struct eit_event *evt;
unsigned short descriptors_loop_length;
if (bufferLength < sizeof(SI_section_EIT_header) + sizeof(struct eit_event)) {
bufferLength=0;
return;
}
unsigned char table_id = header()->table_id;
unsigned char version_number = header()->version_number;
actPos = buffer + sizeof(SI_section_EIT_header);
bufEnd = buffer + bufferLength;
while (actPos < bufEnd - sizeof(struct eit_event)) {
evt = (struct eit_event *) actPos;
SIevent e(evt);
e.service_id = service_id();
e.original_network_id = original_network_id();
e.transport_stream_id = transport_stream_id();
e.table_id = table_id;
e.version = version_number;
descriptors_loop_length = sizeof(struct eit_event) + ((evt->descriptors_loop_length_hi << 8) | evt->descriptors_loop_length_lo);
parseDescriptors(actPos, min((unsigned)(bufEnd - actPos), descriptors_loop_length), e);
evts.insert(e);
actPos += descriptors_loop_length;
}
#endif
#if 1
const EventList &elist = *getEvents(); const EventList &elist = *getEvents();
if(elist.empty()) if(elist.empty())
@@ -162,339 +60,18 @@ void SIsectionEIT::parse(void)
e.parse(event); e.parse(event);
evts.insert(e); evts.insert(e);
} }
#endif
parsed = 1; parsed = 1;
} }
#if 0
static int get_table(unsigned char hi, unsigned char mid, unsigned char lo)
{
char lang[4];
lang[0] = hi;
lang[1] = mid;
lang[2] = lo;
lang[3] = 0;
if(!strcmp(lang, "pol"))
return 2;
else if(!strcmp(lang, "tur"))
return 9;
else if(!strcmp(lang, "gre"))
return 7;
else if(!strcmp(lang, "rus"))
return 5;
else if(!strcmp(lang, "bul"))
return 5;
else if(!strcmp(lang, "ara"))
return 6;
return 0;
}
//-----------------------------------------------------------------------
// Da es vorkommen kann das defekte Packete empfangen werden
// sollte hier alles ueberprueft werden.
// Leider ist das noch nicht bei allen Descriptoren so.
//-----------------------------------------------------------------------
void SIsectionEIT::parseLinkageDescriptor(const char *buf, SIevent &e, unsigned maxlen)
{
if(maxlen>=sizeof(struct descr_linkage_header))
{
SIlinkage l((const struct descr_linkage_header *)buf);
e.linkage_descs.insert(e.linkage_descs.end(), l);
//printf("LinkName: %s\n", l.name.c_str());
}
}
void SIsectionEIT::parsePDCDescriptor(const char *buf, SIevent &e, unsigned maxlen)
{
if (maxlen >= sizeof(struct descr_pdc_header))
{
const struct descr_pdc_header *s = (struct descr_pdc_header *)buf;
time_t now = time(NULL);
struct tm tm_r;
struct tm t = *localtime_r(&now, &tm_r); // this initializes the time zone in 't'
t.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
int month = t.tm_mon;
t.tm_mon = ((s->pil1 >> 3) & 0x0F) - 1;
t.tm_mday = ((s->pil0 & 0x0F) << 1) | ((s->pil1 & 0x80) >> 7);
t.tm_hour = ((s->pil1 & 0x07) << 2) | ((s->pil2 & 0xC0) >> 6);
t.tm_min = s->pil2 & 0x3F;
t.tm_sec = 0;
if (month == 11 && t.tm_mon == 0) // current month is dec, but event is in jan
t.tm_year++;
else if (month == 0 && t.tm_mon == 11) // current month is jan, but event is in dec
t.tm_year--;
e.vps = mktime(&t);
// fprintf(stderr, "SIsectionEIT::parsePDCDescriptor: vps: %ld %s", e.vps, ctime(&e.vps));
}
}
void SIsectionEIT::parseComponentDescriptor(const char *buf, SIevent &e, unsigned maxlen)
{
if(maxlen>=sizeof(struct descr_component_header))
e.components.insert(SIcomponent((const struct descr_component_header *)buf));
}
void SIsectionEIT::parseContentDescriptor(const char *buf, SIevent &e, unsigned maxlen)
{
struct descr_generic_header *cont=(struct descr_generic_header *)buf;
if(cont->descriptor_length+sizeof(struct descr_generic_header)>maxlen)
return; // defekt
const char *classification=buf+sizeof(struct descr_generic_header);
while(classification<=buf+sizeof(struct descr_generic_header)+cont->descriptor_length-2) {
e.contentClassification+=std::string(classification, 1);
// printf("Content: 0x%02hhx\n", *classification);
e.userClassification+=std::string(classification+1, 1);
// printf("User: 0x%02hhx\n", *(classification+1));
classification+=2;
}
}
void SIsectionEIT::parseParentalRatingDescriptor(const char *buf, SIevent &e, unsigned maxlen)
{
struct descr_generic_header *cont=(struct descr_generic_header *)buf;
if(cont->descriptor_length+sizeof(struct descr_generic_header)>maxlen)
return; // defekt
const char *s=buf+sizeof(struct descr_generic_header);
while(s<buf+sizeof(struct descr_generic_header)+cont->descriptor_length-4) {
e.ratings.insert(SIparentalRating(std::string(s, 3), *(s+3)));
s+=4;
}
}
void SIsectionEIT::parseExtendedEventDescriptor(const char *buf, SIevent &e, unsigned maxlen)
{
struct descr_extended_event_header *evt=(struct descr_extended_event_header *)buf;
if((evt->descriptor_length+sizeof(descr_generic_header)>maxlen) || (evt->descriptor_length<sizeof(struct descr_extended_event_header)-sizeof(descr_generic_header)))
return; // defekt
unsigned char *items=(unsigned char *)(buf+sizeof(struct descr_extended_event_header));
int tsidonid = (e.transport_stream_id << 16) | e.original_network_id;
int table = get_table(evt->iso_639_2_language_code_hi, evt->iso_639_2_language_code_mid, evt->iso_639_2_language_code_lo);
char lang[] = {tolower(evt->iso_639_2_language_code_hi), tolower(evt->iso_639_2_language_code_mid), tolower(evt->iso_639_2_language_code_lo), '\0'};
std::string language(lang);
while(items < (unsigned char *)(buf + sizeof(struct descr_extended_event_header) + evt->length_of_items)) {
// TODO What info should be in item & itemDescription?
// Should I make language filter those as well? Arzka
if(*items) {
// 21.07.2005 - collect all extended events in one
// string, delimit multiple entries with a newline
e.itemDescription.append(convertDVBUTF8((const char *)(items+1), min(maxlen-((const char *)items+1-buf), *items), table, tsidonid));
e.itemDescription.append("\n");
}
items+=1+*items;
if(*items) {
// 21.07.2005 - collect all extended events in one
// string, delimit multiple entries with a newline
e.item.append(convertDVBUTF8((const char *)(items+1), min(maxlen-((const char *)items+1-buf), *items), table, tsidonid));
e.item.append("\n");
}
items+=1+*items;
}
// if (0 != e.itemDescription.length()) {
// printf("Item Description: %s\n", e.itemDescription.c_str());
// printf("Item: %s\n", e.item.c_str());
// }
if(*items) {
e.appendExtendedText(language, convertDVBUTF8((const char *)(items+1), min(maxlen-((const char *)items+1-buf), (*items)), table, tsidonid));
//printf("Extended Text: %s\n", e.extendedText.c_str());
}
}
void SIsectionEIT::parseShortEventDescriptor(const char *buf, SIevent &e, unsigned maxlen)
{
struct descr_short_event_header *evt=(struct descr_short_event_header *)buf;
if((evt->descriptor_length+sizeof(descr_generic_header)>maxlen) || (evt->descriptor_length<sizeof(struct descr_short_event_header)-sizeof(descr_generic_header)))
return; // defekt
int tsidonid = (e.transport_stream_id << 16) | e.original_network_id;
int table = get_table(evt->language_code_hi, evt->language_code_mid, evt->language_code_lo);
char lang[] = {tolower(evt->language_code_hi), tolower(evt->language_code_mid), tolower(evt->language_code_lo), '\0'};
std::string language(lang);
buf+=sizeof(struct descr_short_event_header);
if(evt->event_name_length) {
#ifdef ENABLE_FREESATEPG
std::string tmp_str = buf[0] == 0x1f ? freesatHuffmanDecode(std::string(buf, evt->event_name_length)) : std::string(buf, evt->event_name_length);
e.setName(language, convertDVBUTF8(tmp_str.c_str(), tmp_str.size(), table, tsidonid));
#else
e.setName(language, convertDVBUTF8(buf, evt->event_name_length, table, tsidonid));
#endif
}
buf+=evt->event_name_length;
unsigned char textlength=*((unsigned char *)buf);
if(textlength > 2) {
#ifdef ENABLE_FREESATEPG
std::string tmp_str = buf[1] == 0x1f ? freesatHuffmanDecode(std::string(++buf, textlength)) : std::string(++buf, textlength);
e.setText(language, convertDVBUTF8(tmp_str.c_str(), tmp_str.size(), table, tsidonid));
#else
e.setText(language, convertDVBUTF8((++buf), textlength, table, tsidonid));
#endif
}
// printf("Name: %s\n", e.name.c_str());
// printf("Text: %s\n", e.text.c_str());
}
void SIsectionEIT::parseDescriptors(const uint8_t *des, unsigned len, SIevent &e)
{
struct descr_generic_header *desc;
/* we pass the buffer including the eit_event header, so we have to
skip it here... */
des += sizeof(struct eit_event);
len -= sizeof(struct eit_event);
while(len>=sizeof(struct descr_generic_header)) {
desc=(struct descr_generic_header *)des;
// printf("Type: %s\n", decode_descr(desc->descriptor_tag));
if(desc->descriptor_tag==0x4D)
parseShortEventDescriptor((const char *)desc, e, len);
else if(desc->descriptor_tag==0x4E)
parseExtendedEventDescriptor((const char *)desc, e, len);
else if(desc->descriptor_tag==0x54)
parseContentDescriptor((const char *)desc, e, len);
else if(desc->descriptor_tag==0x50)
parseComponentDescriptor((const char *)desc, e, len);
else if(desc->descriptor_tag==0x55)
parseParentalRatingDescriptor((const char *)desc, e, len);
else if(desc->descriptor_tag==0x4A)
parseLinkageDescriptor((const char *)desc, e, len);
else if(desc->descriptor_tag==0x69)
parsePDCDescriptor((const char *)desc, e, len);
if((unsigned)(desc->descriptor_length+2)>len)
break;
len-=desc->descriptor_length+2;
des+=desc->descriptor_length+2;
}
}
#endif
/********************/
#if 0
bool check_blacklisted(const t_original_network_id onid, const t_transport_stream_id tsid)
{
if ( (onid == 0x0001) &&
((tsid == 0x03F0) || (tsid == 0x0408) || (tsid == 0x040E) || (tsid == 0x0412) || (tsid == 0x0416) || (tsid == 0x041E) ||
(tsid == 0x0420) || (tsid == 0x0422) || (tsid == 0x0424) || (tsid == 0x0444) ))
return true;
else
return false;
}
void SIsectionSDT::parseNVODreferenceDescriptor(const char *buf, SIservice &s)
{
struct descr_generic_header *hdr=(struct descr_generic_header *)buf;
unsigned short *spointer=(unsigned short *)(buf+sizeof(struct descr_generic_header));
while((const char *)spointer<=buf+sizeof(struct descr_generic_header)+hdr->descriptor_length-2) {
unsigned short transportStreamID=*spointer++;
unsigned short originalNetworkID=*spointer++;
unsigned short sID=*spointer++;
s.nvods.insert(SInvodReference(transportStreamID, originalNetworkID, sID));
}
}
void SIsectionSDT::parseServiceDescriptor(const char *buf, SIservice &s)
{
bool is_blacklisted;
struct descr_service_header *sv=(struct descr_service_header *)buf;
buf+=sizeof(struct descr_service_header);
s.serviceTyp=sv->service_typ;
is_blacklisted = check_blacklisted(s.original_network_id, s.transport_stream_id);
if(sv->service_provider_name_length) {
if ((*buf > 0x05) && (is_blacklisted))
s.providerName = CDVBString(("\x05" + std::string((const char *)(buf))).c_str(), sv->service_provider_name_length+1).getContent();
else
s.providerName = CDVBString((const char *)(buf), sv->service_provider_name_length).getContent();
}
buf+=sv->service_provider_name_length;
unsigned char servicenamelength=*((unsigned char *)buf);
if(servicenamelength) {
if ((*buf+1 > 0x05) && (is_blacklisted))
s.serviceName = CDVBString(("\x05" + std::string((const char *)(++buf))).c_str(), servicenamelength+1).getContent();
else
s.serviceName = CDVBString((const char *)(++buf), servicenamelength).getContent();
}
// printf("Provider-Name: %s\n", s.providerName.c_str());
// printf("Service-Name: %s\n", s.serviceName.c_str());
}
void SIsectionSDT::parsePrivateDataDescriptor(const char *buf, SIservice &s)
{
buf+=sizeof(struct descr_generic_header);
struct private_data_specifier *pds=(struct private_data_specifier *)buf;
if ((((((pds->byte1 << 24) | (pds->byte2 << 16)) | (pds->byte3 << 8)) | pds->byte4) == 0x000000c0) && (s.serviceTyp == 0xc3))
s.serviceTyp = 0x01;
}
void SIsectionSDT::parseDescriptors(const uint8_t *des, unsigned len, SIservice &s)
{
struct descr_generic_header *desc;
des += sizeof(struct sdt_service);
len -= sizeof(struct sdt_service);
while(len>=sizeof(struct descr_generic_header)) {
desc=(struct descr_generic_header *)des;
// printf("Type: %s\n", decode_descr(desc->descriptor_tag));
// printf("Length: %hhu\n", desc->descriptor_length);
if(desc->descriptor_tag==0x48) {
// printf("Found service descriptor\n");
parseServiceDescriptor((const char *)desc, s);
}
else if(desc->descriptor_tag==0x4b) {
// printf("Found NVOD reference descriptor\n");
parseNVODreferenceDescriptor((const char *)desc, s);
}
else if(desc->descriptor_tag==0x5f) {
// printf("Found Private Data Specifier\n");
parsePrivateDataDescriptor((const char *)desc, s);
}
// hotfix for ARD crash
if ((int) len<desc->descriptor_length+2) break;
len-=desc->descriptor_length+2;
des+=desc->descriptor_length+2;
}
}
#endif
// Die infos aus dem Puffer holen
void SIsectionSDT::parse(void) void SIsectionSDT::parse(void)
{ {
#if 0 const ServiceDescriptionList &slist = *getDescriptions();
const uint8_t *actPos;
const uint8_t *bufEnd;
struct sdt_service *sv;
unsigned short descriptors_loop_length;
if (!buffer || parsed) if(slist.empty())
return; return;
if (bufferLength < sizeof(SI_section_SDT_header) + sizeof(struct sdt_service)) {
bufferLength=0;
return;
}
actPos = buffer + sizeof(SI_section_SDT_header);
bufEnd = buffer + bufferLength;
while (actPos <= bufEnd - sizeof(struct sdt_service)) {
sv = (struct sdt_service *)actPos;
SIservice s(sv);
s.original_network_id = original_network_id();
s.transport_stream_id = transport_stream_id();
descriptors_loop_length = sizeof(struct sdt_service) + ((sv->descriptors_loop_length_hi << 8) | sv->descriptors_loop_length_lo);
//printf("actpos: %p buf+bl: %p sid: %hu desclen: %hu\n", actPos, buffer+bufferLength, sv->service_id, sv->descriptors_loop_length);
parseDescriptors(actPos, min((unsigned)(bufEnd - actPos), descriptors_loop_length), s);
svs.insert(s);
actPos += descriptors_loop_length;
}
#endif
parsed = 1;
t_transport_stream_id transport_stream_id = getTransportStreamId(); t_transport_stream_id transport_stream_id = getTransportStreamId();
t_original_network_id original_network_id = getOriginalNetworkId(); t_original_network_id original_network_id = getOriginalNetworkId();
const ServiceDescriptionList &slist = *getDescriptions();
for (ServiceDescriptionConstIterator sit = slist.begin(); sit != slist.end(); ++sit) { for (ServiceDescriptionConstIterator sit = slist.begin(); sit != slist.end(); ++sit) {
ServiceDescription * service = *sit; ServiceDescription * service = *sit;
@@ -531,4 +108,5 @@ void SIsectionSDT::parse(void)
} }
svs.insert(s); svs.insert(s);
} }
parsed = 1;
} }

View File

@@ -1,5 +1,3 @@
#ifndef SISECTIONS_HPP
#define SISECTIONS_HPP
// //
// $Id: SIsections.hpp,v 1.28 2009/07/26 17:02:46 rhabarber1848 Exp $ // $Id: SIsections.hpp,v 1.28 2009/07/26 17:02:46 rhabarber1848 Exp $
// //
@@ -25,174 +23,24 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// //
#include <endian.h> #ifndef SISECTIONS_HPP
#define SISECTIONS_HPP
#include <dvbsi++/event_information_section.h> #include <dvbsi++/event_information_section.h>
#include <dvbsi++/service_description_section.h> #include <dvbsi++/service_description_section.h>
#if 0 class SIsectionEIT : public EventInformationSection
struct SI_section_SDT_header {
unsigned table_id : 8;
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned section_syntax_indicator : 1;
unsigned reserved_future_use : 1;
unsigned reserved1 : 2;
unsigned section_length_hi : 4;
#else
unsigned section_length_hi : 4;
unsigned reserved1 : 2;
unsigned reserved_future_use : 1;
unsigned section_syntax_indicator : 1;
#endif
unsigned section_length_lo : 8;
unsigned transport_stream_id_hi : 8;
unsigned transport_stream_id_lo : 8;
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned reserved2 : 2;
unsigned version_number : 5;
unsigned current_next_indicator : 1;
#else
unsigned current_next_indicator : 1;
unsigned version_number : 5;
unsigned reserved2 : 2;
#endif
unsigned section_number : 8;
unsigned last_section_number : 8;
unsigned original_network_id_hi : 8;
unsigned original_network_id_lo : 8;
unsigned reserved_future_use2 : 8;
} __attribute__ ((packed)) ; // 11 bytes
#endif
#if 0
struct SI_section_EIT_header {
unsigned table_id : 8;
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned section_syntax_indicator : 1;
unsigned reserved_future_use : 1;
unsigned reserved1 : 2;
unsigned section_length_hi : 4;
#else
unsigned section_length_hi : 4;
unsigned reserved1 : 2;
unsigned reserved_future_use : 1;
unsigned section_syntax_indicator : 1;
#endif
unsigned section_length_lo : 8;
unsigned service_id_hi : 8;
unsigned service_id_lo : 8;
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned reserved2 : 2;
unsigned version_number : 5;
unsigned current_next_indicator : 1;
#else
unsigned current_next_indicator : 1;
unsigned version_number : 5;
unsigned reserved2 : 2;
#endif
unsigned section_number : 8;
unsigned last_section_number : 8;
unsigned transport_stream_id_hi : 8;
unsigned transport_stream_id_lo : 8;
unsigned original_network_id_hi : 8;
unsigned original_network_id_lo : 8;
unsigned segment_last_section_number : 8;
unsigned last_table_id : 8;
} __attribute__ ((packed)) ; // 14 bytes
#endif
// Muss evtl. angepasst werden falls damit RST, TDT und TOT gelesen werden sollen
// ^^^
// RST usw. haben section_syntax_indicator == 0, andere == 1 (obi)
#if 0
struct SI_section_header {
unsigned table_id : 8;
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned section_syntax_indicator : 1;
unsigned reserved_future_use : 1;
unsigned reserved1 : 2;
unsigned section_length_hi : 4;
#else
unsigned section_length_hi : 4;
unsigned reserved1 : 2;
unsigned reserved_future_use : 1;
unsigned section_syntax_indicator : 1;
#endif
unsigned section_length_lo : 8;
unsigned table_id_extension_hi : 8;
unsigned table_id_extension_lo : 8;
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned reserved2 : 2;
unsigned version_number : 5;
unsigned current_next_indicator : 1;
#else
unsigned current_next_indicator : 1;
unsigned version_number : 5;
unsigned reserved2 : 2;
#endif
unsigned section_number : 8;
unsigned last_section_number : 8;
} __attribute__ ((packed)) ; // 8 bytes
#endif
#if 0
class SIsection //: public LongSection
{
public:
//SIsection(void) { buffer = 0; bufferLength = 0;}
SIsection(uint8_t *buf) //: LongSection(buf)
{
buffer = NULL;
bufferLength = 0;
//unsigned bufLength = 3 + getSectionLength();
unsigned bufLength = 3 + (((struct SI_section_header*) buf)->section_length_hi << 8 | ((struct SI_section_header*) buf)->section_length_lo);
if ((buf) && (bufLength >= sizeof(struct SI_section_header))) {
buffer = buf;
bufferLength = bufLength;
}
}
// Destruktor
virtual ~SIsection(void) {
bufferLength = 0;
}
protected:
uint8_t *buffer;
unsigned bufferLength;
};
#endif
class SIsectionEIT : /*public SIsection,*/ public EventInformationSection
{ {
protected: protected:
SIevents evts; SIevents evts;
int parsed; int parsed;
void parse(void); void parse(void);
public: public:
SIsectionEIT(uint8_t *buf) : /*SIsection(buf),*/ EventInformationSection(buf) SIsectionEIT(uint8_t *buf) : EventInformationSection(buf)
{ {
parsed = 0; parsed = 0;
parse(); parse();
} }
#if 0
t_service_id service_id(void) const {
return buffer ? ((((struct SI_section_EIT_header *)buffer)->service_id_hi << 8) |
((struct SI_section_EIT_header *)buffer)->service_id_lo): 0;
}
t_original_network_id original_network_id(void) const {
return buffer ? ((((struct SI_section_EIT_header *)buffer)->original_network_id_hi << 8) |
((struct SI_section_EIT_header *)buffer)->original_network_id_lo) : 0;
}
t_transport_stream_id transport_stream_id(void) const {
return buffer ? ((((struct SI_section_EIT_header *)buffer)->transport_stream_id_hi << 8) |
((struct SI_section_EIT_header *)buffer)->transport_stream_id_lo) : 0;
}
struct SI_section_EIT_header const *header(void) const {
return (struct SI_section_EIT_header *)buffer;
}
#endif
const SIevents &events(void) const { const SIevents &events(void) const {
return evts; return evts;
@@ -201,71 +49,21 @@ public:
int is_parsed(void) const { int is_parsed(void) const {
return parsed; return parsed;
} }
#if 0
void parseDescriptors(const uint8_t *desc, unsigned len, SIevent &e);
void parseShortEventDescriptor(const char *buf, SIevent &e, unsigned maxlen);
void parseExtendedEventDescriptor(const char *buf, SIevent &e, unsigned maxlen);
void parseContentDescriptor(const char *buf, SIevent &e, unsigned maxlen);
void parseComponentDescriptor(const char *buf, SIevent &e, unsigned maxlen);
void parseParentalRatingDescriptor(const char *buf, SIevent &e, unsigned maxlen);
void parseLinkageDescriptor(const char *buf, SIevent &e, unsigned maxlen);
void parsePDCDescriptor(const char *buf, SIevent &e, unsigned maxlen);
#ifdef ENABLE_FREESATEPG
std::string freesatHuffmanDecode(std::string input);
#endif
#endif
}; };
class SIsectionSDT : public ServiceDescriptionSection class SIsectionSDT : public ServiceDescriptionSection
{ {
private: private:
SIservices svs; SIservices svs;
int parsed; int parsed;
void parse(void); void parse(void);
#if 0
void parseDescriptors(const uint8_t *desc, unsigned len, SIservice &s);
void parseServiceDescriptor(const char *buf, SIservice &s);
void parsePrivateDataDescriptor(const char *buf, SIservice &s);
void parseNVODreferenceDescriptor(const char *buf, SIservice &s);
#endif
public: public:
#if 0
SIsectionSDT(const SIsection &s) : SIsection(s) {
parsed = 0;
parse();
}
#endif
#if 0
// Std-Copy
SIsectionSDT(const SIsectionSDT &s) : SIsection(s) {
svs = s.svs;
parsed = s.parsed;
}
#endif
// Benutzt den uebergebenen Puffer (sollte mit new char[n] allokiert sein)
SIsectionSDT(uint8_t *buf) : ServiceDescriptionSection(buf) { SIsectionSDT(uint8_t *buf) : ServiceDescriptionSection(buf) {
parsed = 0; parsed = 0;
parse(); parse();
} }
#if 0 #if 0 // TODO ?
t_transport_stream_id transport_stream_id(void) const {
return buffer ? ((((struct SI_section_SDT_header *)buffer)->transport_stream_id_hi << 8) |
((struct SI_section_SDT_header *)buffer)->transport_stream_id_lo) : 0;
}
struct SI_section_SDT_header const *header(void) const {
return (struct SI_section_SDT_header *)buffer;
}
t_original_network_id original_network_id(void) const {
return buffer ? ((((struct SI_section_SDT_header *)buffer)->original_network_id_hi << 8) |
((struct SI_section_SDT_header *)buffer)->original_network_id_lo) : 0;
}
#endif
#if 0
static void dump(const struct SI_section_SDT_header *header) { static void dump(const struct SI_section_SDT_header *header) {
if (!header) if (!header)
return; return;

View File

@@ -1,5 +1,3 @@
#ifndef SISERVICES_HPP
#define SISERVICES_HPP
// //
// $Id: SIservices.hpp,v 1.15 2009/02/24 19:09:10 seife Exp $ // $Id: SIservices.hpp,v 1.15 2009/02/24 19:09:10 seife Exp $
// //
@@ -25,41 +23,16 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// //
#ifndef SISERVICES_HPP
#define SISERVICES_HPP
#include <set>
#include <algorithm> #include <algorithm>
#include <string>
#include <cstring> // memset #include <cstring> // memset
#include <endian.h>
#include <sectionsdclient/sectionsdMsg.h> #include <sectionsdclient/sectionsdMsg.h>
// forward references
class SIservice;
class SIevent;
#if 0
struct sdt_service {
unsigned service_id_hi : 8;
unsigned service_id_lo : 8;
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned reserved_future_use : 6;
unsigned EIT_schedule_flag : 1;
unsigned EIT_present_following_flag : 1;
unsigned running_status : 3;
unsigned free_CA_mode : 1;
unsigned descriptors_loop_length_hi : 4;
#else
unsigned EIT_present_following_flag : 1;
unsigned EIT_schedule_flag : 1;
unsigned reserved_future_use : 6;
unsigned descriptors_loop_length_hi : 4;
unsigned free_CA_mode : 1;
unsigned running_status : 3;
#endif
unsigned descriptors_loop_length_lo : 8;
} __attribute__ ((packed)) ; // 5 Bytes
#endif
class SInvodReference class SInvodReference
{ {
public: public:
@@ -73,27 +46,12 @@ public:
original_network_id = new_original_network_id; original_network_id = new_original_network_id;
transport_stream_id = new_transport_stream_id; transport_stream_id = new_transport_stream_id;
} }
#if 0
SInvodReference(const SInvodReference &ref)
{
service_id = ref.service_id;
original_network_id = ref.original_network_id;
transport_stream_id = ref.transport_stream_id;
}
#endif
bool operator < (const SInvodReference& ref) const bool operator < (const SInvodReference& ref) const
{ {
return uniqueKey() < ref.uniqueKey(); return uniqueKey() < ref.uniqueKey();
} }
void dump(void) const
{
printf("NVOD Ref. Service-ID: %hu\n", service_id);
printf("NVOD Ref. Original-Network-ID: %hu\n", original_network_id);
printf("NVOD Ref. Transport-Stream-ID: %hu\n", transport_stream_id);
}
void toStream(char * &p) const void toStream(char * &p) const
{ {
*(t_service_id *)p = service_id; p += sizeof(t_service_id); *(t_service_id *)p = service_id; p += sizeof(t_service_id);
@@ -109,6 +67,13 @@ public:
t_channel_id uniqueKey(void) const { t_channel_id uniqueKey(void) const {
return CREATE_CHANNEL_ID; // cf. zapittypes.h return CREATE_CHANNEL_ID; // cf. zapittypes.h
} }
void dump(void) const
{
printf("NVOD Ref. Service-ID: %hu\n", service_id);
printf("NVOD Ref. Original-Network-ID: %hu\n", original_network_id);
printf("NVOD Ref. Transport-Stream-ID: %hu\n", transport_stream_id);
}
}; };
// Fuer for_each // Fuer for_each
@@ -130,7 +95,7 @@ public:
unsigned char free_CA_mode : 1; unsigned char free_CA_mode : 1;
} flags; } flags;
t_service_id service_id; t_service_id service_id;
t_original_network_id original_network_id; // Ist innerhalb einer section unnoetig t_original_network_id original_network_id;
t_transport_stream_id transport_stream_id; t_transport_stream_id transport_stream_id;
unsigned char serviceTyp; unsigned char serviceTyp;
int is_actual; int is_actual;
@@ -140,20 +105,6 @@ public:
std::string providerName; // Name aus dem Service-Descriptor std::string providerName; // Name aus dem Service-Descriptor
#endif #endif
#if 0
SIservice(const struct sdt_service *s) {
service_id = (s->service_id_hi << 8) | s->service_id_lo;
original_network_id = 0;
transport_stream_id = 0;
serviceTyp = 0;
flags.EIT_schedule_flag = s->EIT_schedule_flag;
flags.EIT_present_following_flag = s->EIT_present_following_flag;
flags.running_status = s->running_status;
flags.free_CA_mode = s->free_CA_mode;
is_actual = false;
}
#endif
// Um einen service zum Suchen zu erstellen
SIservice(const t_service_id _service_id, const t_original_network_id _original_network_id, const t_transport_stream_id _transport_stream_id) SIservice(const t_service_id _service_id, const t_original_network_id _original_network_id, const t_transport_stream_id _transport_stream_id)
{ {
service_id = _service_id; service_id = _service_id;
@@ -163,20 +114,6 @@ public:
memset(&flags, 0, sizeof(flags)); memset(&flags, 0, sizeof(flags));
} }
#if 0
// Std-Copy
SIservice(const SIservice &s) {
service_id = s.service_id;
original_network_id = s.original_network_id;
transport_stream_id = s.transport_stream_id;
serviceTyp=s.serviceTyp;
providerName=s.providerName;
serviceName=s.serviceName;
flags=s.flags;
nvods=s.nvods;
is_actual=s.is_actual;
}
#endif
int eitScheduleFlag(void) { return (int)flags.EIT_schedule_flag; } int eitScheduleFlag(void) { return (int)flags.EIT_schedule_flag; }
int eitPresentFollowingFlag(void) { return (int)flags.EIT_present_following_flag; } int eitPresentFollowingFlag(void) { return (int)flags.EIT_present_following_flag; }
int runningStatus(void) { return (int)flags.running_status; } int runningStatus(void) { return (int)flags.running_status; }
@@ -196,7 +133,7 @@ public:
printf("Original-Network-ID: %hu\n", original_network_id); printf("Original-Network-ID: %hu\n", original_network_id);
printf("Service-ID: %hu\n", service_id); printf("Service-ID: %hu\n", service_id);
printf("Service-Typ: %hhu\n", serviceTyp); printf("Service-Typ: %hhu\n", serviceTyp);
#if 0 #if 0 // unused
if(providerName.length()) if(providerName.length())
printf("Provider-Name: %s\n", providerName.c_str()); printf("Provider-Name: %s\n", providerName.c_str());
if(serviceName.length()) if(serviceName.length())

View File

@@ -1,5 +1,3 @@
#ifndef SIUTILS_HPP
#define SIUTILS_HPP
// //
// $Id: SIutils.hpp,v 1.5 2006/05/19 21:28:08 houdini Exp $ // $Id: SIutils.hpp,v 1.5 2006/05/19 21:28:08 houdini Exp $
// //
@@ -23,27 +21,9 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// //
// $Log: SIutils.hpp,v $
// Revision 1.5 2006/05/19 21:28:08 houdini #ifndef SIUTILS_HPP
// - Nirvanas save/restore EPG patch #g #define SIUTILS_HPP
// - automatic update of subchannels for Premiere (disable with <sectionsd -nu>)
// - Fix for ZDF audio option "mono/H<>rfilm"
// - improved navigation speed in bouquet/channel list
// - zapit/pzapit new option (-sbo) save bouquets.xml including Bouquet "Andere" which saves me a lot of time :-)
//
// Revision 1.4 2001/07/14 16:38:46 fnbrd
// Mit workaround fuer defektes mktime der glibc
//
// Revision 1.3 2001/06/10 14:55:51 fnbrd
// Kleiner Aenderungen und Ergaenzungen (epgMini).
//
// Revision 1.2 2001/05/19 22:46:50 fnbrd
// Jetzt wellformed xml.
//
// Revision 1.1 2001/05/16 15:23:47 fnbrd
// Alles neu macht der Mai.
//
//
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>

View File

@@ -547,8 +547,8 @@ static bool deleteEvent(const event_id_t uniqueKey)
already_exists = false; already_exists = false;
break; break;
} }
c1++; ++c1;
c2++; ++c2;
} }
} }
} }
@@ -585,8 +585,8 @@ static bool deleteEvent(const event_id_t uniqueKey)
already_exists = false; already_exists = false;
break; break;
} }
p1++; ++p1;
p2++; ++p2;
} }
} }
} }
@@ -603,8 +603,8 @@ static bool deleteEvent(const event_id_t uniqueKey)
already_exists = false; already_exists = false;
break; break;
} }
t1++; ++t1;
t2++; ++t2;
} }
} }
} }
@@ -665,7 +665,7 @@ static bool deleteEvent(const event_id_t uniqueKey)
* match *or* from a different channel, then no event for this channel is stored */ * match *or* from a different channel, then no event for this channel is stored */
while (x != mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.begin()) while (x != mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.begin())
{ {
x--; --x;
if ((*x)->get_channel_id() != e_chid) if ((*x)->get_channel_id() != e_chid)
break; break;
else else
@@ -723,13 +723,13 @@ static bool deleteEvent(const event_id_t uniqueKey)
{ {
// fprintf(stderr, "<"); // fprintf(stderr, "<");
lastEvent = mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.end(); lastEvent = mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.end();
lastEvent--; --lastEvent;
//preserve events of current channel //preserve events of current channel
readLockMessaging(); readLockMessaging();
while ((lastEvent != mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.begin()) && while ((lastEvent != mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.begin()) &&
((*lastEvent)->get_channel_id() == messaging_current_servicekey)) { ((*lastEvent)->get_channel_id() == messaging_current_servicekey)) {
lastEvent--; --lastEvent;
} }
unlockMessaging(); unlockMessaging();
} }
@@ -830,7 +830,7 @@ static void addNVODevent(const SIevent &evt)
readLockMessaging(); readLockMessaging();
while ((lastEvent != mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.begin()) && while ((lastEvent != mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.begin()) &&
((*lastEvent)->get_channel_id() == messaging_current_servicekey)) { ((*lastEvent)->get_channel_id() == messaging_current_servicekey)) {
lastEvent--; --lastEvent;
} }
unlockMessaging(); unlockMessaging();
unlockEvents(); unlockEvents();
@@ -867,7 +867,7 @@ static void removeOldEvents(const long seconds)
while ((e != mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.end()) && (!messaging_zap_detected)) { while ((e != mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.end()) && (!messaging_zap_detected)) {
goodtimefound = false; goodtimefound = false;
for (SItimes::iterator t = (*e)->times.begin(); t != (*e)->times.end(); t++) { for (SItimes::iterator t = (*e)->times.begin(); t != (*e)->times.end(); ++t) {
if (t->startzeit + (long)t->dauer >= zeit - seconds) { if (t->startzeit + (long)t->dauer >= zeit - seconds) {
goodtimefound=true; goodtimefound=true;
// one time found -> exit times loop // one time found -> exit times loop
@@ -881,7 +881,7 @@ static void removeOldEvents(const long seconds)
} }
unlockEvents(); unlockEvents();
for (std::vector<event_id_t>::iterator i = to_delete.begin(); i != to_delete.end(); i++) for (std::vector<event_id_t>::iterator i = to_delete.begin(); i != to_delete.end(); ++i)
deleteEvent(*i); deleteEvent(*i);
return; return;
@@ -964,7 +964,7 @@ static const SIevent& findNextSIeventForServiceUniqueKey(const t_channel_id serv
{ {
time_t azeit = time(NULL); time_t azeit = time(NULL);
for (MySIeventsOrderFirstEndTimeServiceIDEventUniqueKey::iterator e = mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.begin(); e != mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.end(); e++) for (MySIeventsOrderFirstEndTimeServiceIDEventUniqueKey::iterator e = mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.begin(); e != mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.end(); ++e)
if ((*e)->get_channel_id() == serviceUniqueKey) if ((*e)->get_channel_id() == serviceUniqueKey)
{ {
for (SItimes::iterator t = (*e)->times.begin(); t != (*e)->times.end(); ++t) for (SItimes::iterator t = (*e)->times.begin(); t != (*e)->times.end(); ++t)
@@ -3094,7 +3094,7 @@ static void *fseitThread(void *)
//dprintf("[eitThread] adding %d events [table 0x%x] (begin)\n", eit.events().size(), eit.getTableId()); //dprintf("[eitThread] adding %d events [table 0x%x] (begin)\n", eit.events().size(), eit.getTableId());
zeit = time(NULL); zeit = time(NULL);
// Nicht alle Events speichern // Nicht alle Events speichern
for (SIevents::iterator e = eit.events().begin(); e != eit.events().end(); e++) for (SIevents::iterator e = eit.events().begin(); e != eit.events().end(); ++e)
{ {
if (!(e->times.empty())) if (!(e->times.empty()))
{ {
@@ -3115,7 +3115,7 @@ static void *fseitThread(void *)
// Ist ein nvod-event // Ist ein nvod-event
writeLockEvents(); writeLockEvents();
for (SInvodReferences::iterator i = si->second->nvods.begin(); i != si->second->nvods.end(); i++) for (SInvodReferences::iterator i = si->second->nvods.begin(); i != si->second->nvods.end(); ++i)
mySIeventUniqueKeysMetaOrderServiceUniqueKey.insert(std::make_pair(i->uniqueKey(), e->uniqueKey())); mySIeventUniqueKeysMetaOrderServiceUniqueKey.insert(std::make_pair(i->uniqueKey(), e->uniqueKey()));
unlockEvents(); unlockEvents();
@@ -3308,7 +3308,7 @@ static void *eitThread(void *)
dprintf("[eitThread] adding %d events [table 0x%x] (begin)\n", eit.events().size(), eit.getTableId()); dprintf("[eitThread] adding %d events [table 0x%x] (begin)\n", eit.events().size(), eit.getTableId());
zeit = time(NULL); zeit = time(NULL);
// Nicht alle Events speichern // Nicht alle Events speichern
for (SIevents::iterator e = eit.events().begin(); e != eit.events().end(); e++) for (SIevents::iterator e = eit.events().begin(); e != eit.events().end(); ++e)
{ {
if (!(e->times.empty())) if (!(e->times.empty()))
{ {
@@ -3332,7 +3332,7 @@ static void *eitThread(void *)
// Ist ein nvod-event // Ist ein nvod-event
writeLockEvents(); writeLockEvents();
for (SInvodReferences::iterator i = si->second->nvods.begin(); i != si->second->nvods.end(); i++) for (SInvodReferences::iterator i = si->second->nvods.begin(); i != si->second->nvods.end(); ++i)
mySIeventUniqueKeysMetaOrderServiceUniqueKey.insert(std::make_pair(i->uniqueKey(), e->uniqueKey())); mySIeventUniqueKeysMetaOrderServiceUniqueKey.insert(std::make_pair(i->uniqueKey(), e->uniqueKey()));
unlockEvents(); unlockEvents();
@@ -3547,7 +3547,7 @@ static void *cnThread(void *)
//dprintf("[cnThread] adding %d events [table 0x%x] (begin)\n", eit.events().size(), eit.getTableId()); //dprintf("[cnThread] adding %d events [table 0x%x] (begin)\n", eit.events().size(), eit.getTableId());
zeit = time(NULL); zeit = time(NULL);
// Nicht alle Events speichern // Nicht alle Events speichern
for (SIevents::iterator e = eit.events().begin(); e != eit.events().end(); e++) for (SIevents::iterator e = eit.events().begin(); e != eit.events().end(); ++e)
{ {
if (!(e->times.empty())) if (!(e->times.empty()))
{ {
@@ -3745,7 +3745,7 @@ static void *sdtThread(void *)
bool is_new = false; bool is_new = false;
is_actual = (is_actual | 8); is_actual = (is_actual | 8);
for (SIservices::iterator s = sdt.services().begin(); s != sdt.services().end(); s++) { for (SIservices::iterator s = sdt.services().begin(); s != sdt.services().end(); ++s) {
if (addService(*s, is_actual)) { if (addService(*s, is_actual)) {
is_new = true; is_new = true;
tid = CREATE_TRANSPONDER_ID_FROM_ORIGINALNETWORK_TRANSPORTSTREAM_ID(s->original_network_id, tid = CREATE_TRANSPONDER_ID_FROM_ORIGINALNETWORK_TRANSPORTSTREAM_ID(s->original_network_id,