diff --git a/src/eitd/SIevents.cpp b/src/eitd/SIevents.cpp index c95aed685..79a6553f1 100644 --- a/src/eitd/SIevents.cpp +++ b/src/eitd/SIevents.cpp @@ -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, " ")<0) - return 2; - saveStringToXMLfile(file, serviceName); - if(fprintf(file, "\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\n", eventID)<0) - return 1; - return 0; -} - -int SIevent::saveXML2(FILE *file) const -{ - for (std::map::const_iterator - i = langName.begin() ; - i != langName.end() ; - i++) { - if (i->second.length()) { - fprintf(file, "\t\t\tfirst.c_str()); - saveStringToXMLfile(file, i->second.c_str()); - fprintf(file, "\"/>\n"); - } - } - for (std::map::const_iterator - i = langText.begin() ; - i != langText.end() ; - i++) { - if (i->second.length()) { - fprintf(file, "\t\t\tfirst.c_str()); - saveStringToXMLfile(file, i->second.c_str()); - fprintf(file, "\"/>\n"); - } - } - if(item.length()) { - fprintf(file, "\t\t\t\n"); - } - if(itemDescription.length()) { - fprintf(file, "\t\t\t\n"); - } - for (std::map::const_iterator - i = langExtendedText.begin() ; - i != langExtendedText.end() ; - i++) { - if (i->second.length()) { - fprintf(file, "\t\t\tfirst.c_str()); - saveStringToXMLfile(file, i->second.c_str()); - fprintf(file, "\"/>\n"); - } - } - for_each(times.begin(), times.end(), saveSItimeXML(file)); - for(unsigned i=0; i\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\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, " ")<0) + return 2; + saveStringToXMLfile(file, serviceName); + if(fprintf(file, "\n")<0) + return 3; + } + return saveXML2(file); +} + +int SIevent::saveXML0(FILE *file) const +{ + if(fprintf(file, "\t\t\n", eventID)<0) + return 1; + return 0; +} + +int SIevent::saveXML2(FILE *file) const +{ + for (std::map::const_iterator + i = langName.begin() ; + i != langName.end() ; + i++) { + if (i->second.length()) { + fprintf(file, "\t\t\tfirst.c_str()); + saveStringToXMLfile(file, i->second.c_str()); + fprintf(file, "\"/>\n"); + } + } + for (std::map::const_iterator + i = langText.begin() ; + i != langText.end() ; + i++) { + if (i->second.length()) { + fprintf(file, "\t\t\tfirst.c_str()); + saveStringToXMLfile(file, i->second.c_str()); + fprintf(file, "\"/>\n"); + } + } + if(item.length()) { + fprintf(file, "\t\t\t\n"); + } + if(itemDescription.length()) { + fprintf(file, "\t\t\t\n"); + } + for (std::map::const_iterator + i = langExtendedText.begin() ; + i != langExtendedText.end() ; + i++) { + if (i->second.length()) { + fprintf(file, "\t\t\tfirst.c_str()); + saveStringToXMLfile(file, i->second.c_str()); + fprintf(file, "\"/>\n"); + } + } + for_each(times.begin(), times.end(), saveSItimeXML(file)); + for(unsigned i=0; i\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\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::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()); diff --git a/src/eitd/SIevents.hpp b/src/eitd/SIevents.hpp index c3bb14f24..653db3277 100644 --- a/src/eitd/SIevents.hpp +++ b/src/eitd/SIevents.hpp @@ -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 //typedef std::multiset > SIlinkage_descs; typedef std::vector 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\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\n"); + return 0; + } }; +typedef std::multiset > SIcomponents; + // Fuer for_each struct printSIcomponent : public std::unary_function { - void operator() (const SIcomponent &c) { c.dump();} + void operator() (const SIcomponent &c) { c.dump();} }; // Fuer for_each struct saveSIcomponentXML : public std::unary_function { - 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 > 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\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\n", countryCode.c_str(), rating)<0) + return 1; + return 0; + } }; // Fuer for_each struct printSIparentalRating : public std::unary_function { - void operator() (const SIparentalRating &r) { r.dump();} + void operator() (const SIparentalRating &r) { r.dump();} }; // Fuer for_each struct saveSIparentalRatingXML : public std::unary_function { - 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 > 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\n", zeit->tm_hour, zeit->tm_min, zeit->tm_sec); - fprintf(file, "\t\t\t\t\t%02d.%02d.%04d\n", zeit->tm_mday, zeit->tm_mon+1, zeit->tm_year+1900); - fprintf(file, "\t\t\t\t\t%u\n", dauer); - */ - fprintf(file, "\t\t\t