mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-02 18:31:12 +02:00
eitd: comment most of unused code
Origin commit data
------------------
Branch: ni/coolstream
Commit: 551cce893a
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-02-08 (Wed, 08 Feb 2012)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
|
||||
const std::string languangeOFF = "OFF";
|
||||
|
||||
#if 0
|
||||
SIevent::SIevent(const struct eit_event *e)
|
||||
{
|
||||
eventID = (e->event_id_hi << 8) | e->event_id_lo;
|
||||
@@ -75,6 +76,7 @@ SIevent::SIevent(const struct eit_event *e)
|
||||
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,
|
||||
const unsigned short _event_id)
|
||||
@@ -177,6 +179,7 @@ void SIevent::parse(Event &event)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Std-Copy
|
||||
SIevent::SIevent(const SIevent &e)
|
||||
{
|
||||
@@ -202,20 +205,7 @@ SIevent::SIevent(const SIevent &e)
|
||||
table_id = e.table_id;
|
||||
version = e.version;
|
||||
}
|
||||
|
||||
int SIevent::saveXML(FILE *file, const char *serviceName) const
|
||||
{
|
||||
if(saveXML0(file))
|
||||
return 1;
|
||||
if(serviceName) {
|
||||
if(fprintf(file, " <service_name>")<0)
|
||||
return 2;
|
||||
saveStringToXMLfile(file, serviceName);
|
||||
if(fprintf(file, "</service_name>\n")<0)
|
||||
return 3;
|
||||
}
|
||||
return saveXML2(file);
|
||||
}
|
||||
#endif
|
||||
|
||||
char SIevent::getFSK() const
|
||||
{
|
||||
@@ -240,65 +230,6 @@ char SIevent::getFSK() const
|
||||
return 0x00; // 0x00 undefined
|
||||
}
|
||||
|
||||
int SIevent::saveXML0(FILE *file) const
|
||||
{
|
||||
if(fprintf(file, "\t\t<event id=\"%04x\">\n", eventID)<0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SIevent::saveXML2(FILE *file) const
|
||||
{
|
||||
for (std::map<std::string, std::string>::const_iterator
|
||||
i = langName.begin() ;
|
||||
i != langName.end() ;
|
||||
i++) {
|
||||
if (i->second.length()) {
|
||||
fprintf(file, "\t\t\t<name lang=\"%s\" string=\"", i->first.c_str());
|
||||
saveStringToXMLfile(file, i->second.c_str());
|
||||
fprintf(file, "\"/>\n");
|
||||
}
|
||||
}
|
||||
for (std::map<std::string, std::string>::const_iterator
|
||||
i = langText.begin() ;
|
||||
i != langText.end() ;
|
||||
i++) {
|
||||
if (i->second.length()) {
|
||||
fprintf(file, "\t\t\t<text lang=\"%s\" string=\"", i->first.c_str());
|
||||
saveStringToXMLfile(file, i->second.c_str());
|
||||
fprintf(file, "\"/>\n");
|
||||
}
|
||||
}
|
||||
if(item.length()) {
|
||||
fprintf(file, "\t\t\t<item string=\"");
|
||||
saveStringToXMLfile(file, item.c_str());
|
||||
fprintf(file, "\"/>\n");
|
||||
}
|
||||
if(itemDescription.length()) {
|
||||
fprintf(file, "\t\t\t<item_description string=\"");
|
||||
saveStringToXMLfile(file, itemDescription.c_str());
|
||||
fprintf(file, "\"/>\n");
|
||||
}
|
||||
for (std::map<std::string, std::string>::const_iterator
|
||||
i = langExtendedText.begin() ;
|
||||
i != langExtendedText.end() ;
|
||||
i++) {
|
||||
if (i->second.length()) {
|
||||
fprintf(file, "\t\t\t<extended_text lang=\"%s\" string=\"", i->first.c_str());
|
||||
saveStringToXMLfile(file, i->second.c_str());
|
||||
fprintf(file, "\"/>\n");
|
||||
}
|
||||
}
|
||||
for_each(times.begin(), times.end(), saveSItimeXML(file));
|
||||
for(unsigned i=0; i<contentClassification.length(); i++)
|
||||
fprintf(file, "\t\t\t<content class=\"%02x\" user=\"%02x\"/>\n", contentClassification[i], userClassification[i]);
|
||||
for_each(components.begin(), components.end(), saveSIcomponentXML(file));
|
||||
for_each(ratings.begin(), ratings.end(), saveSIparentalRatingXML(file));
|
||||
for_each(linkage_descs.begin(), linkage_descs.end(), saveSIlinkageXML(file));
|
||||
fprintf(file, "\t\t</event>\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string SIevent::getName() const
|
||||
{
|
||||
if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) {
|
||||
@@ -379,6 +310,79 @@ void SIevent::setExtendedText(const std::string &lang, const std::string &text)
|
||||
}
|
||||
}
|
||||
|
||||
int SIevent::saveXML(FILE *file, const char *serviceName) const
|
||||
{
|
||||
if(saveXML0(file))
|
||||
return 1;
|
||||
if(serviceName) {
|
||||
if(fprintf(file, " <service_name>")<0)
|
||||
return 2;
|
||||
saveStringToXMLfile(file, serviceName);
|
||||
if(fprintf(file, "</service_name>\n")<0)
|
||||
return 3;
|
||||
}
|
||||
return saveXML2(file);
|
||||
}
|
||||
|
||||
int SIevent::saveXML0(FILE *file) const
|
||||
{
|
||||
if(fprintf(file, "\t\t<event id=\"%04x\">\n", eventID)<0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SIevent::saveXML2(FILE *file) const
|
||||
{
|
||||
for (std::map<std::string, std::string>::const_iterator
|
||||
i = langName.begin() ;
|
||||
i != langName.end() ;
|
||||
i++) {
|
||||
if (i->second.length()) {
|
||||
fprintf(file, "\t\t\t<name lang=\"%s\" string=\"", i->first.c_str());
|
||||
saveStringToXMLfile(file, i->second.c_str());
|
||||
fprintf(file, "\"/>\n");
|
||||
}
|
||||
}
|
||||
for (std::map<std::string, std::string>::const_iterator
|
||||
i = langText.begin() ;
|
||||
i != langText.end() ;
|
||||
i++) {
|
||||
if (i->second.length()) {
|
||||
fprintf(file, "\t\t\t<text lang=\"%s\" string=\"", i->first.c_str());
|
||||
saveStringToXMLfile(file, i->second.c_str());
|
||||
fprintf(file, "\"/>\n");
|
||||
}
|
||||
}
|
||||
if(item.length()) {
|
||||
fprintf(file, "\t\t\t<item string=\"");
|
||||
saveStringToXMLfile(file, item.c_str());
|
||||
fprintf(file, "\"/>\n");
|
||||
}
|
||||
if(itemDescription.length()) {
|
||||
fprintf(file, "\t\t\t<item_description string=\"");
|
||||
saveStringToXMLfile(file, itemDescription.c_str());
|
||||
fprintf(file, "\"/>\n");
|
||||
}
|
||||
for (std::map<std::string, std::string>::const_iterator
|
||||
i = langExtendedText.begin() ;
|
||||
i != langExtendedText.end() ;
|
||||
i++) {
|
||||
if (i->second.length()) {
|
||||
fprintf(file, "\t\t\t<extended_text lang=\"%s\" string=\"", i->first.c_str());
|
||||
saveStringToXMLfile(file, i->second.c_str());
|
||||
fprintf(file, "\"/>\n");
|
||||
}
|
||||
}
|
||||
for_each(times.begin(), times.end(), saveSItimeXML(file));
|
||||
for(unsigned i=0; i<contentClassification.length(); i++)
|
||||
fprintf(file, "\t\t\t<content class=\"%02x\" user=\"%02x\"/>\n", contentClassification[i], userClassification[i]);
|
||||
for_each(components.begin(), components.end(), saveSIcomponentXML(file));
|
||||
for_each(ratings.begin(), ratings.end(), saveSIparentalRatingXML(file));
|
||||
for_each(linkage_descs.begin(), linkage_descs.end(), saveSIlinkageXML(file));
|
||||
fprintf(file, "\t\t</event>\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SIevent::dump(void) const
|
||||
{
|
||||
printf("Unique key: %llx\n", uniqueKey());
|
||||
@@ -414,12 +418,7 @@ void SIevent::dump(void) const
|
||||
printf(" 0x%02hhx", userClassification[i]);
|
||||
printf("\n");
|
||||
}
|
||||
/*
|
||||
if(startzeit)
|
||||
printf("Startzeit: %s", ctime(&startzeit));
|
||||
if(dauer)
|
||||
printf("Dauer: %02u:%02u:%02u (%umin, %us)\n", dauer/3600, (dauer%3600)/60, dauer%60, dauer/60, dauer);
|
||||
*/
|
||||
|
||||
for_each(times.begin(), times.end(), printSItime());
|
||||
for_each(components.begin(), components.end(), printSIcomponent());
|
||||
for_each(ratings.begin(), ratings.end(), printSIparentalRating());
|
||||
@@ -437,12 +436,7 @@ void SIevent::dumpSmall(void) const
|
||||
for (std::map<std::string, std::string>::const_iterator it = langExtendedText.begin() ;
|
||||
it != langExtendedText.end() ; ++it)
|
||||
printf("Extended-Text (%s): %s\n", it->first.c_str(), it->second.c_str());
|
||||
/*
|
||||
if(startzeit)
|
||||
printf("Startzeit: %s", ctime(&startzeit));
|
||||
if(dauer)
|
||||
printf("Dauer: %02u:%02u:%02u (%umin, %us)\n", dauer/3600, (dauer%3600)/60, dauer%60, dauer/60, dauer);
|
||||
*/
|
||||
|
||||
for_each(times.begin(), times.end(), printSItime());
|
||||
for_each(ratings.begin(), ratings.end(), printSIparentalRating());
|
||||
for_each(linkage_descs.begin(), linkage_descs.end(), printSIlinkage());
|
||||
|
@@ -38,6 +38,7 @@ class SIservice;
|
||||
class SIservices;
|
||||
class SIbouquets;
|
||||
|
||||
#if 0
|
||||
struct eit_event {
|
||||
unsigned event_id_hi : 8;
|
||||
unsigned event_id_lo : 8;
|
||||
@@ -61,6 +62,7 @@ struct eit_event {
|
||||
unsigned descriptors_loop_length_lo : 8;
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#endif
|
||||
|
||||
struct descr_component_header {
|
||||
unsigned descriptor_tag : 8;
|
||||
@@ -79,6 +81,7 @@ struct descr_component_header {
|
||||
unsigned iso_639_2_language_code_lo : 8;
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#if 0
|
||||
struct descr_linkage_header {
|
||||
unsigned descriptor_tag : 8;
|
||||
unsigned descriptor_length : 8;
|
||||
@@ -90,6 +93,7 @@ struct descr_linkage_header {
|
||||
unsigned service_id_lo : 8;
|
||||
unsigned linkage_type : 8;
|
||||
} __attribute__ ((packed)) ;
|
||||
#endif
|
||||
|
||||
struct descr_pdc_header {
|
||||
unsigned descriptor_tag : 8;
|
||||
@@ -101,6 +105,7 @@ struct descr_pdc_header {
|
||||
|
||||
class SIlinkage {
|
||||
public:
|
||||
#if 0
|
||||
SIlinkage(const struct descr_linkage_header *link) {
|
||||
linkageType = link->linkage_type;
|
||||
transportStreamId = (link->transport_stream_id_hi << 8) | link->transport_stream_id_lo;
|
||||
@@ -110,7 +115,6 @@ public:
|
||||
//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;
|
||||
@@ -119,6 +123,7 @@ public:
|
||||
serviceId = l.serviceId;
|
||||
name = l.name;
|
||||
}
|
||||
#endif
|
||||
|
||||
// default
|
||||
SIlinkage(void) {
|
||||
@@ -176,150 +181,145 @@ struct saveSIlinkageXML : public std::unary_function<class SIlinkage, void>
|
||||
//typedef std::multiset <SIlinkage, std::less<SIlinkage> > SIlinkage_descs;
|
||||
typedef std::vector<class SIlinkage> SIlinkage_descs;
|
||||
|
||||
class SIcomponent {
|
||||
public:
|
||||
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;
|
||||
}
|
||||
|
||||
SIcomponent(void) {
|
||||
streamContent=0;
|
||||
componentType=0;
|
||||
componentTag=0;
|
||||
}
|
||||
// Der Operator zum sortieren
|
||||
bool operator < (const SIcomponent& c) const {
|
||||
return streamContent < c.streamContent;
|
||||
// return component < c.component;
|
||||
}
|
||||
void dump(void) const {
|
||||
if(component.length())
|
||||
printf("Component: %s\n", component.c_str());
|
||||
printf("Stream Content: 0x%02hhx\n", streamContent);
|
||||
printf("Component type: 0x%02hhx\n", componentType);
|
||||
printf("Component tag: 0x%02hhx\n", componentTag);
|
||||
}
|
||||
int saveXML(FILE *file) const {
|
||||
fprintf(file, "\t\t\t<component tag=\"%02x\" type=\"%02x\" stream_content=\"%02x\" text=\"", componentTag, componentType, streamContent);
|
||||
saveStringToXMLfile(file,component.c_str());
|
||||
fprintf(file, "\"/>\n");
|
||||
// %s
|
||||
// return 1;
|
||||
// saveStringToXMLfile(file, component.c_str());
|
||||
// fprintf(file, "\"/>\n");
|
||||
return 0;
|
||||
}
|
||||
std::string component; // Text aus dem Component Descriptor
|
||||
unsigned char componentType; // Component Descriptor
|
||||
unsigned char componentTag; // Component Descriptor
|
||||
unsigned char streamContent; // Component Descriptor
|
||||
class SIcomponent
|
||||
{
|
||||
public:
|
||||
std::string component; // Text aus dem Component Descriptor
|
||||
unsigned char componentType; // Component Descriptor
|
||||
unsigned char componentTag; // Component Descriptor
|
||||
unsigned char streamContent; // Component Descriptor
|
||||
#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) {
|
||||
streamContent=0;
|
||||
componentType=0;
|
||||
componentTag=0;
|
||||
}
|
||||
// Der Operator zum sortieren
|
||||
bool operator < (const SIcomponent& c) const {
|
||||
return streamContent < c.streamContent;
|
||||
}
|
||||
void dump(void) const {
|
||||
if(component.length())
|
||||
printf("Component: %s\n", component.c_str());
|
||||
printf("Stream Content: 0x%02hhx\n", streamContent);
|
||||
printf("Component type: 0x%02hhx\n", componentType);
|
||||
printf("Component tag: 0x%02hhx\n", componentTag);
|
||||
}
|
||||
int saveXML(FILE *file) const {
|
||||
fprintf(file, "\t\t\t<component tag=\"%02x\" type=\"%02x\" stream_content=\"%02x\" text=\"", componentTag, componentType, streamContent);
|
||||
saveStringToXMLfile(file,component.c_str());
|
||||
fprintf(file, "\"/>\n");
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::multiset <SIcomponent, std::less<SIcomponent> > SIcomponents;
|
||||
|
||||
// Fuer for_each
|
||||
struct printSIcomponent : public std::unary_function<class SIcomponent, void>
|
||||
{
|
||||
void operator() (const SIcomponent &c) { c.dump();}
|
||||
void operator() (const SIcomponent &c) { c.dump();}
|
||||
};
|
||||
|
||||
// Fuer for_each
|
||||
struct saveSIcomponentXML : public std::unary_function<class SIcomponent, void>
|
||||
{
|
||||
FILE *f;
|
||||
saveSIcomponentXML(FILE *fi) { f=fi;}
|
||||
void operator() (const SIcomponent &c) { c.saveXML(f);}
|
||||
FILE *f;
|
||||
saveSIcomponentXML(FILE *fi) { f=fi;}
|
||||
void operator() (const SIcomponent &c) { c.saveXML(f);}
|
||||
};
|
||||
|
||||
typedef std::multiset <SIcomponent, std::less<SIcomponent> > SIcomponents;
|
||||
class SIparentalRating
|
||||
{
|
||||
public:
|
||||
std::string countryCode;
|
||||
unsigned char rating; // Bei 1-16 -> Minumim Alter = rating +3
|
||||
|
||||
class SIparentalRating {
|
||||
public:
|
||||
SIparentalRating(const std::string &cc, unsigned char rate) {
|
||||
rating=rate;
|
||||
countryCode=cc;
|
||||
}
|
||||
// Std-Copy
|
||||
SIparentalRating(const SIparentalRating &r) {
|
||||
rating=r.rating;
|
||||
countryCode=r.countryCode;
|
||||
}
|
||||
// Der Operator zum sortieren
|
||||
bool operator < (const SIparentalRating& c) const {
|
||||
return countryCode < c.countryCode;
|
||||
}
|
||||
void dump(void) const {
|
||||
printf("Rating: %s %hhu (+3)\n", countryCode.c_str(), rating);
|
||||
}
|
||||
int saveXML(FILE *file) const {
|
||||
if(fprintf(file, "\t\t\t<parental_rating country=\"%s\" rating=\"%hhu\"/>\n", countryCode.c_str(), rating)<0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
std::string countryCode;
|
||||
unsigned char rating; // Bei 1-16 -> Minumim Alter = rating +3
|
||||
SIparentalRating(const std::string &cc, unsigned char rate) {
|
||||
rating=rate;
|
||||
countryCode=cc;
|
||||
}
|
||||
#if 0
|
||||
// Std-Copy
|
||||
SIparentalRating(const SIparentalRating &r) {
|
||||
rating=r.rating;
|
||||
countryCode=r.countryCode;
|
||||
}
|
||||
#endif
|
||||
// Der Operator zum sortieren
|
||||
bool operator < (const SIparentalRating& c) const {
|
||||
return countryCode < c.countryCode;
|
||||
}
|
||||
void dump(void) const {
|
||||
printf("Rating: %s %hhu (+3)\n", countryCode.c_str(), rating);
|
||||
}
|
||||
int saveXML(FILE *file) const {
|
||||
if(fprintf(file, "\t\t\t<parental_rating country=\"%s\" rating=\"%hhu\"/>\n", countryCode.c_str(), rating)<0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// Fuer for_each
|
||||
struct printSIparentalRating : public std::unary_function<SIparentalRating, void>
|
||||
{
|
||||
void operator() (const SIparentalRating &r) { r.dump();}
|
||||
void operator() (const SIparentalRating &r) { r.dump();}
|
||||
};
|
||||
|
||||
// Fuer for_each
|
||||
struct saveSIparentalRatingXML : public std::unary_function<SIparentalRating, void>
|
||||
{
|
||||
FILE *f;
|
||||
saveSIparentalRatingXML(FILE *fi) { f=fi;}
|
||||
void operator() (const SIparentalRating &r) { r.saveXML(f);}
|
||||
FILE *f;
|
||||
saveSIparentalRatingXML(FILE *fi) { f=fi;}
|
||||
void operator() (const SIparentalRating &r) { r.saveXML(f);}
|
||||
};
|
||||
|
||||
typedef std::set <SIparentalRating, std::less<SIparentalRating> > SIparentalRatings;
|
||||
|
||||
class SItime {
|
||||
public:
|
||||
SItime(time_t s, unsigned d) {
|
||||
startzeit=s;
|
||||
dauer=d; // in Sekunden, 0 -> time shifted (cinedoms)
|
||||
}
|
||||
// Std-Copy
|
||||
SItime(const SItime &t) {
|
||||
startzeit=t.startzeit;
|
||||
dauer=t.dauer;
|
||||
}
|
||||
// Der Operator zum sortieren
|
||||
bool operator < (const SItime& t) const {
|
||||
return startzeit < t.startzeit;
|
||||
}
|
||||
void dump(void) const {
|
||||
printf("Startzeit: %s", ctime(&startzeit));
|
||||
printf("Dauer: %02u:%02u:%02u (%umin, %us)\n", dauer/3600, (dauer%3600)/60, dauer%60, dauer/60, dauer);
|
||||
}
|
||||
int saveXML(FILE *file) const { // saves the time
|
||||
// Ist so noch nicht in Ordnung, das sollte untergliedert werden,
|
||||
// da sonst evtl. time,date,duration,time,date,... auftritt
|
||||
// und eine rein sequentielle Ordnung finde ich nicht ok.
|
||||
/*
|
||||
struct tm *zeit=localtime(&startzeit);
|
||||
fprintf(file, "\t\t\t\t\t<time>%02d:%02d:%02d</time>\n", zeit->tm_hour, zeit->tm_min, zeit->tm_sec);
|
||||
fprintf(file, "\t\t\t\t\t<date>%02d.%02d.%04d</date>\n", zeit->tm_mday, zeit->tm_mon+1, zeit->tm_year+1900);
|
||||
fprintf(file, "\t\t\t\t\t<duration>%u</duration>\n", dauer);
|
||||
*/
|
||||
fprintf(file, "\t\t\t<time start_time=\"%u\" duration=\"%u\"/>\n", (unsigned int) startzeit, dauer);
|
||||
return 0;
|
||||
}
|
||||
time_t startzeit; // lokale Zeit, 0 -> time shifted (cinedoms)
|
||||
unsigned dauer; // in Sekunden, 0 -> time shifted (cinedoms)
|
||||
public:
|
||||
time_t startzeit; // lokale Zeit, 0 -> time shifted (cinedoms)
|
||||
unsigned dauer; // in Sekunden, 0 -> time shifted (cinedoms)
|
||||
|
||||
SItime(time_t s, unsigned d) {
|
||||
startzeit=s;
|
||||
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
|
||||
bool operator < (const SItime& t) const {
|
||||
return startzeit < t.startzeit;
|
||||
}
|
||||
void dump(void) const {
|
||||
printf("Startzeit: %s", ctime(&startzeit));
|
||||
printf("Dauer: %02u:%02u:%02u (%umin, %us)\n", dauer/3600, (dauer%3600)/60, dauer%60, dauer/60, dauer);
|
||||
}
|
||||
int saveXML(FILE *file) const { // saves the time
|
||||
fprintf(file, "\t\t\t<time start_time=\"%u\" duration=\"%u\"/>\n", (unsigned int) startzeit, dauer);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::set <SItime, std::less<SItime> > SItimes;
|
||||
@@ -327,109 +327,119 @@ typedef std::set <SItime, std::less<SItime> > SItimes;
|
||||
// Fuer for_each
|
||||
struct printSItime : public std::unary_function<SItime, void>
|
||||
{
|
||||
void operator() (const SItime &t) { t.dump();}
|
||||
void operator() (const SItime &t) { t.dump();}
|
||||
};
|
||||
|
||||
// Fuer for_each
|
||||
struct saveSItimeXML : public std::unary_function<SItime, void>
|
||||
{
|
||||
FILE *f;
|
||||
saveSItimeXML(FILE *fi) { f=fi;}
|
||||
void operator() (const SItime &t) { t.saveXML(f);}
|
||||
FILE *f;
|
||||
saveSItimeXML(FILE *fi) { f=fi;}
|
||||
void operator() (const SItime &t) { t.saveXML(f);}
|
||||
};
|
||||
|
||||
class SIevent {
|
||||
public:
|
||||
t_service_id service_id;
|
||||
t_original_network_id original_network_id;
|
||||
t_transport_stream_id transport_stream_id;
|
||||
class SIevent
|
||||
{
|
||||
private:
|
||||
std::map<std::string, std::string> langName;
|
||||
std::map<std::string, std::string> langText;
|
||||
std::map<std::string, std::string> langExtendedText;
|
||||
int running;
|
||||
|
||||
SIevent(const struct eit_event *);
|
||||
void parse(Event &event);
|
||||
// Std-Copy
|
||||
SIevent(const SIevent &);
|
||||
SIevent(const t_original_network_id, const t_transport_stream_id, const t_service_id, const unsigned short);
|
||||
SIevent(void) {
|
||||
service_id = 0;
|
||||
original_network_id = 0;
|
||||
transport_stream_id = 0;
|
||||
eventID = 0;
|
||||
vps = 0;
|
||||
table_id = 0xFF; /* 0xFF means "not set" */
|
||||
version = 0xFF;
|
||||
}
|
||||
unsigned short eventID;
|
||||
// Name aus dem Short-Event-Descriptor
|
||||
std::string getName() const;
|
||||
void setName(const std::string &lang, const std::string &name);
|
||||
protected:
|
||||
int saveXML0(FILE *f) const;
|
||||
int saveXML2(FILE *f) const;
|
||||
|
||||
// Text aus dem Short-Event-Descriptor
|
||||
std::string getText() const;
|
||||
void setText(const std::string &lang, const std::string &text);
|
||||
public:
|
||||
t_service_id service_id;
|
||||
t_original_network_id original_network_id;
|
||||
t_transport_stream_id transport_stream_id;
|
||||
unsigned short eventID;
|
||||
time_t vps;
|
||||
unsigned char table_id;
|
||||
unsigned char version;
|
||||
|
||||
std::string itemDescription; // Aus dem Extended Descriptor
|
||||
std::string item; // Aus dem Extended Descriptor
|
||||
SIcomponents components;
|
||||
SIparentalRatings ratings;
|
||||
SIlinkage_descs linkage_descs;
|
||||
SItimes times;
|
||||
|
||||
// Aus dem Extended Descriptor
|
||||
std::string getExtendedText() const;
|
||||
void appendExtendedText(const std::string &lang, const std::string &text);
|
||||
void setExtendedText(const std::string &lang, const std::string &text);
|
||||
std::string itemDescription; // 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 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(void) {
|
||||
service_id = 0;
|
||||
original_network_id = 0;
|
||||
transport_stream_id = 0;
|
||||
eventID = 0;
|
||||
vps = 0;
|
||||
table_id = 0xFF; /* 0xFF means "not set" */
|
||||
version = 0xFF;
|
||||
}
|
||||
void parse(Event &event);
|
||||
|
||||
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
|
||||
// Name aus dem Short-Event-Descriptor
|
||||
std::string getName() const;
|
||||
void setName(const std::string &lang, const std::string &name);
|
||||
|
||||
t_channel_id get_channel_id(void) const {
|
||||
return CREATE_CHANNEL_ID;
|
||||
}
|
||||
// Text aus dem Short-Event-Descriptor
|
||||
std::string getText() const;
|
||||
void setText(const std::string &lang, const std::string &text);
|
||||
|
||||
event_id_t uniqueKey(void) const {
|
||||
return CREATE_EVENT_ID(CREATE_CHANNEL_ID, eventID);
|
||||
}
|
||||
int runningStatus(void) const {
|
||||
return running;
|
||||
}
|
||||
SIcomponents components;
|
||||
SIparentalRatings ratings;
|
||||
SIlinkage_descs linkage_descs;
|
||||
SItimes times;
|
||||
time_t vps;
|
||||
unsigned char table_id;
|
||||
unsigned char version;
|
||||
// Der Operator zum sortieren
|
||||
bool operator < (const SIevent& e) const {
|
||||
return uniqueKey()<e.uniqueKey();
|
||||
}
|
||||
int saveXML(FILE *file) const { // saves the event
|
||||
return saveXML0(file) || saveXML2(file);
|
||||
}
|
||||
int saveXML(FILE *file, const char *serviceName) const; // saves the event
|
||||
void dump(void) const; // dumps the event to stdout
|
||||
void dumpSmall(void) const; // dumps the event to stdout (not all information)
|
||||
char getFSK() const;
|
||||
protected:
|
||||
int saveXML0(FILE *f) const;
|
||||
int saveXML2(FILE *f) const;
|
||||
private:
|
||||
std::map<std::string, std::string> langName;
|
||||
std::map<std::string, std::string> langText;
|
||||
std::map<std::string, std::string> langExtendedText;
|
||||
int running;
|
||||
|
||||
// Aus dem Extended Descriptor
|
||||
std::string getExtendedText() const;
|
||||
void appendExtendedText(const std::string &lang, const std::string &text);
|
||||
void setExtendedText(const std::string &lang, const std::string &text);
|
||||
|
||||
t_channel_id get_channel_id(void) const {
|
||||
return CREATE_CHANNEL_ID;
|
||||
}
|
||||
|
||||
event_id_t uniqueKey(void) const {
|
||||
return CREATE_EVENT_ID(CREATE_CHANNEL_ID, eventID);
|
||||
}
|
||||
int runningStatus(void) const {
|
||||
return running;
|
||||
}
|
||||
// Der Operator zum sortieren
|
||||
bool operator < (const SIevent& e) const {
|
||||
return uniqueKey()<e.uniqueKey();
|
||||
}
|
||||
int saveXML(FILE *file) const { // saves the event
|
||||
return saveXML0(file) || saveXML2(file);
|
||||
}
|
||||
int saveXML(FILE *file, const char *serviceName) const; // saves the event
|
||||
char getFSK() const;
|
||||
|
||||
void dump(void) const; // dumps the event to stdout
|
||||
void dumpSmall(void) const; // dumps the event to stdout (not all information)
|
||||
};
|
||||
|
||||
typedef std::set <SIevent, std::less<SIevent> > SIevents;
|
||||
|
||||
// Fuer for_each
|
||||
struct printSIevent : public std::unary_function<SIevent, void>
|
||||
{
|
||||
void operator() (const SIevent &e) { e.dump();}
|
||||
void operator() (const SIevent &e) { e.dump();}
|
||||
};
|
||||
|
||||
// Fuer for_each
|
||||
struct saveSIeventXML : public std::unary_function<SIevent, void>
|
||||
{
|
||||
FILE *f;
|
||||
saveSIeventXML(FILE *fi) { f=fi;}
|
||||
void operator() (const SIevent &e) { e.saveXML(f);}
|
||||
FILE *f;
|
||||
saveSIeventXML(FILE *fi) { f=fi;}
|
||||
void operator() (const SIevent &e) { e.saveXML(f);}
|
||||
};
|
||||
|
||||
#if 0
|
||||
// Fuer for_each
|
||||
struct saveSIeventXMLwithServiceName : public std::unary_function<SIevent, void>
|
||||
{
|
||||
@@ -446,7 +456,9 @@ struct saveSIeventXMLwithServiceName : public std::unary_function<SIevent, void>
|
||||
e.saveXML(f);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// Fuer for_each
|
||||
struct printSIeventWithService : public std::unary_function<SIevent, void>
|
||||
{
|
||||
@@ -477,5 +489,6 @@ class SIevents : public std::set <SIevent, std::less<SIevent> >
|
||||
// Loescht alte Events (aufgrund aktueller Zeit - seconds und Zeit im Event)
|
||||
void removeOldEvents(long seconds);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // SIEVENTS_HPP
|
||||
|
@@ -50,6 +50,7 @@ struct descr_generic_header {
|
||||
unsigned descriptor_length : 8;
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#if 0
|
||||
struct descr_short_event_header {
|
||||
unsigned descriptor_tag : 8;
|
||||
unsigned descriptor_length : 8;
|
||||
@@ -58,6 +59,7 @@ struct descr_short_event_header {
|
||||
unsigned language_code_lo : 8;
|
||||
unsigned event_name_length : 8;
|
||||
} __attribute__ ((packed)) ;
|
||||
#endif
|
||||
|
||||
struct descr_service_header {
|
||||
unsigned descriptor_tag : 8;
|
||||
@@ -66,6 +68,7 @@ struct descr_service_header {
|
||||
unsigned service_provider_name_length : 8;
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
#if 0
|
||||
struct descr_extended_event_header {
|
||||
unsigned descriptor_tag : 8;
|
||||
unsigned descriptor_length : 8;
|
||||
@@ -76,6 +79,7 @@ struct descr_extended_event_header {
|
||||
unsigned iso_639_2_language_code_lo : 8;
|
||||
unsigned length_of_items : 8;
|
||||
} __attribute__ ((packed)) ;
|
||||
#endif
|
||||
|
||||
struct service_list_entry {
|
||||
unsigned service_id_hi : 8;
|
||||
@@ -95,6 +99,68 @@ inline unsigned min(unsigned a, unsigned b)
|
||||
return b < a ? b : a;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
if(elist.empty())
|
||||
return;
|
||||
|
||||
t_service_id sid = getTableIdExtension();
|
||||
t_original_network_id onid = getOriginalNetworkId();
|
||||
t_transport_stream_id tsid = getTransportStreamId();
|
||||
unsigned char tid = getTableId();
|
||||
unsigned char version = getVersionNumber();
|
||||
|
||||
for (EventConstIterator eit = elist.begin(); eit != elist.end(); ++eit) {
|
||||
Event &event = (**eit);
|
||||
|
||||
SIevent e(onid, tsid, sid, event.getEventId());
|
||||
e.table_id = tid;
|
||||
e.version = version;
|
||||
|
||||
e.parse(event);
|
||||
evts.insert(e);
|
||||
}
|
||||
#endif
|
||||
parsed = 1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int get_table(unsigned char hi, unsigned char mid, unsigned char lo)
|
||||
{
|
||||
char lang[4];
|
||||
@@ -117,15 +183,6 @@ static int get_table(unsigned char hi, unsigned char mid, unsigned char lo)
|
||||
return 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;
|
||||
}
|
||||
//-----------------------------------------------------------------------
|
||||
// Da es vorkommen kann das defekte Packete empfangen werden
|
||||
// sollte hier alles ueberprueft werden.
|
||||
@@ -240,113 +297,6 @@ void SIsectionEIT::parseExtendedEventDescriptor(const char *buf, SIevent &e, uns
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FREESATEPG
|
||||
std::string SIsectionEIT::freesatHuffmanDecode(std::string input)
|
||||
{
|
||||
const char *src = input.c_str();
|
||||
uint size = input.length();
|
||||
|
||||
if (src[1] == 1 || src[1] == 2)
|
||||
{
|
||||
std::string uncompressed(size * 3, ' ');
|
||||
uint p = 0;
|
||||
struct hufftab *table;
|
||||
unsigned table_length;
|
||||
if (src[1] == 1)
|
||||
{
|
||||
table = fsat_huffman1;
|
||||
table_length = sizeof(fsat_huffman1) / sizeof(fsat_huffman1[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
table = fsat_huffman2;
|
||||
table_length = sizeof(fsat_huffman2) / sizeof(fsat_huffman2[0]);
|
||||
}
|
||||
unsigned value = 0, byte = 2, bit = 0;
|
||||
while (byte < 6 && byte < size)
|
||||
{
|
||||
value |= src[byte] << ((5-byte) * 8);
|
||||
byte++;
|
||||
}
|
||||
char lastch = START;
|
||||
|
||||
do
|
||||
{
|
||||
bool found = false;
|
||||
unsigned bitShift = 0;
|
||||
if (lastch == ESCAPE)
|
||||
{
|
||||
found = true;
|
||||
// Encoded in the next 8 bits.
|
||||
// Terminated by the first ASCII character.
|
||||
char nextCh = (value >> 24) & 0xff;
|
||||
bitShift = 8;
|
||||
if ((nextCh & 0x80) == 0)
|
||||
lastch = nextCh;
|
||||
if (p >= uncompressed.length())
|
||||
uncompressed.resize(p+10);
|
||||
uncompressed[p++] = nextCh;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned j = 0; j < table_length; j++)
|
||||
{
|
||||
if (table[j].last == lastch)
|
||||
{
|
||||
unsigned mask = 0, maskbit = 0x80000000;
|
||||
for (short kk = 0; kk < table[j].bits; kk++)
|
||||
{
|
||||
mask |= maskbit;
|
||||
maskbit >>= 1;
|
||||
}
|
||||
if ((value & mask) == table[j].value)
|
||||
{
|
||||
char nextCh = table[j].next;
|
||||
bitShift = table[j].bits;
|
||||
if (nextCh != STOP && nextCh != ESCAPE)
|
||||
{
|
||||
if (p >= uncompressed.length())
|
||||
uncompressed.resize(p+10);
|
||||
uncompressed[p++] = nextCh;
|
||||
}
|
||||
found = true;
|
||||
lastch = nextCh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
// Shift up by the number of bits.
|
||||
for (unsigned b = 0; b < bitShift; b++)
|
||||
{
|
||||
value = (value << 1) & 0xfffffffe;
|
||||
if (byte < size)
|
||||
value |= (src[byte] >> (7-bit)) & 1;
|
||||
if (bit == 7)
|
||||
{
|
||||
bit = 0;
|
||||
byte++;
|
||||
}
|
||||
else bit++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Entry missing in table.
|
||||
uncompressed.resize(p);
|
||||
uncompressed.append("...");
|
||||
return uncompressed;
|
||||
}
|
||||
} while (lastch != STOP && value != 0);
|
||||
|
||||
uncompressed.resize(p);
|
||||
return uncompressed;
|
||||
}
|
||||
else return input;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SIsectionEIT::parseShortEventDescriptor(const char *buf, SIevent &e, unsigned maxlen)
|
||||
{
|
||||
@@ -414,70 +364,19 @@ void SIsectionEIT::parseDescriptors(const uint8_t *des, unsigned len, SIevent &e
|
||||
des+=desc->descriptor_length+2;
|
||||
}
|
||||
}
|
||||
|
||||
// Die infos aus dem Puffer holen
|
||||
void SIsectionEIT::parse(void)
|
||||
{
|
||||
if (!buffer || parsed)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
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();
|
||||
|
||||
if(elist.empty())
|
||||
return;
|
||||
|
||||
t_service_id sid = getTableIdExtension();
|
||||
t_original_network_id onid = getOriginalNetworkId();
|
||||
t_transport_stream_id tsid = getTransportStreamId();
|
||||
unsigned char tid = getTableId();
|
||||
unsigned char version = getVersionNumber();
|
||||
|
||||
for (EventConstIterator eit = elist.begin(); eit != elist.end(); ++eit) {
|
||||
Event &event = (**eit);
|
||||
|
||||
SIevent e(onid, tsid, sid, event.getEventId());
|
||||
e.table_id = tid;
|
||||
e.version = version;
|
||||
|
||||
e.parse(event);
|
||||
evts.insert(e);
|
||||
}
|
||||
#endif
|
||||
parsed = 1;
|
||||
}
|
||||
|
||||
/********************/
|
||||
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;
|
||||
@@ -589,3 +488,111 @@ void SIsectionSDT::parse(void)
|
||||
|
||||
parsed = 1;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FREESATEPG
|
||||
std::string SIsectionEIT::freesatHuffmanDecode(std::string input)
|
||||
{
|
||||
const char *src = input.c_str();
|
||||
uint size = input.length();
|
||||
|
||||
if (src[1] == 1 || src[1] == 2)
|
||||
{
|
||||
std::string uncompressed(size * 3, ' ');
|
||||
uint p = 0;
|
||||
struct hufftab *table;
|
||||
unsigned table_length;
|
||||
if (src[1] == 1)
|
||||
{
|
||||
table = fsat_huffman1;
|
||||
table_length = sizeof(fsat_huffman1) / sizeof(fsat_huffman1[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
table = fsat_huffman2;
|
||||
table_length = sizeof(fsat_huffman2) / sizeof(fsat_huffman2[0]);
|
||||
}
|
||||
unsigned value = 0, byte = 2, bit = 0;
|
||||
while (byte < 6 && byte < size)
|
||||
{
|
||||
value |= src[byte] << ((5-byte) * 8);
|
||||
byte++;
|
||||
}
|
||||
char lastch = START;
|
||||
|
||||
do
|
||||
{
|
||||
bool found = false;
|
||||
unsigned bitShift = 0;
|
||||
if (lastch == ESCAPE)
|
||||
{
|
||||
found = true;
|
||||
// Encoded in the next 8 bits.
|
||||
// Terminated by the first ASCII character.
|
||||
char nextCh = (value >> 24) & 0xff;
|
||||
bitShift = 8;
|
||||
if ((nextCh & 0x80) == 0)
|
||||
lastch = nextCh;
|
||||
if (p >= uncompressed.length())
|
||||
uncompressed.resize(p+10);
|
||||
uncompressed[p++] = nextCh;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned j = 0; j < table_length; j++)
|
||||
{
|
||||
if (table[j].last == lastch)
|
||||
{
|
||||
unsigned mask = 0, maskbit = 0x80000000;
|
||||
for (short kk = 0; kk < table[j].bits; kk++)
|
||||
{
|
||||
mask |= maskbit;
|
||||
maskbit >>= 1;
|
||||
}
|
||||
if ((value & mask) == table[j].value)
|
||||
{
|
||||
char nextCh = table[j].next;
|
||||
bitShift = table[j].bits;
|
||||
if (nextCh != STOP && nextCh != ESCAPE)
|
||||
{
|
||||
if (p >= uncompressed.length())
|
||||
uncompressed.resize(p+10);
|
||||
uncompressed[p++] = nextCh;
|
||||
}
|
||||
found = true;
|
||||
lastch = nextCh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
// Shift up by the number of bits.
|
||||
for (unsigned b = 0; b < bitShift; b++)
|
||||
{
|
||||
value = (value << 1) & 0xfffffffe;
|
||||
if (byte < size)
|
||||
value |= (src[byte] >> (7-bit)) & 1;
|
||||
if (bit == 7)
|
||||
{
|
||||
bit = 0;
|
||||
byte++;
|
||||
}
|
||||
else bit++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Entry missing in table.
|
||||
uncompressed.resize(p);
|
||||
uncompressed.append("...");
|
||||
return uncompressed;
|
||||
}
|
||||
} while (lastch != STOP && value != 0);
|
||||
|
||||
uncompressed.resize(p);
|
||||
return uncompressed;
|
||||
}
|
||||
else return input;
|
||||
}
|
||||
#endif
|
||||
|
@@ -60,6 +60,7 @@ struct SI_section_SDT_header {
|
||||
unsigned reserved_future_use2 : 8;
|
||||
} __attribute__ ((packed)) ; // 11 bytes
|
||||
|
||||
#if 0
|
||||
struct SI_section_EIT_header {
|
||||
unsigned table_id : 8;
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
@@ -94,7 +95,7 @@ struct SI_section_EIT_header {
|
||||
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)
|
||||
@@ -155,15 +156,15 @@ protected:
|
||||
unsigned bufferLength;
|
||||
};
|
||||
|
||||
class SIsectionEIT : public SIsection, public EventInformationSection
|
||||
class SIsectionEIT : /*public SIsection,*/ public EventInformationSection
|
||||
{
|
||||
public:
|
||||
SIsectionEIT(uint8_t *buf) : SIsection(buf), EventInformationSection(buf)
|
||||
SIsectionEIT(uint8_t *buf) : /*SIsection(buf),*/ EventInformationSection(buf)
|
||||
{
|
||||
parsed = 0;
|
||||
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;
|
||||
@@ -178,14 +179,12 @@ public:
|
||||
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 {
|
||||
//if(!parsed)
|
||||
// parse(); -> nicht const
|
||||
return evts;
|
||||
}
|
||||
|
||||
@@ -197,6 +196,7 @@ protected:
|
||||
SIevents evts;
|
||||
int parsed;
|
||||
void parse(void);
|
||||
#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);
|
||||
@@ -205,6 +205,7 @@ protected:
|
||||
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);
|
||||
#endif
|
||||
#ifdef ENABLE_FREESATEPG
|
||||
std::string freesatHuffmanDecode(std::string input);
|
||||
#endif
|
||||
@@ -219,12 +220,13 @@ public:
|
||||
parse();
|
||||
}
|
||||
|
||||
#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) : SIsection(buf) {
|
||||
parsed = 0;
|
||||
|
Reference in New Issue
Block a user