// // $Id: SIevents.hpp,v 1.29 2008/08/16 19:23:18 seife Exp $ // // classes SIevent and SIevents (dbox-II-project) // // Homepage: http://dbox2.elxsi.de // // Copyright (C) 2001 fnbrd (fnbrd@gmx.de) // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // #ifndef SIEVENTS_HPP #define SIEVENTS_HPP #include #include #include #include #include #include #include #include "edvbstring.h" class SIlinkage { public: unsigned char linkageType; std::string name; t_transport_stream_id transportStreamId; t_original_network_id originalNetworkId; t_service_id serviceId; SIlinkage(void) { linkageType = 0; transportStreamId = 0; originalNetworkId = 0; serviceId = 0; } void dump(void) const { printf("Linakge Type: 0x%02hhx\n", linkageType); if (name.length()) printf("Name: %s\n", name.c_str()); printf("Transport Stream Id: 0x%04hhx\n", transportStreamId); printf("Original Network Id: 0x%04hhx\n", originalNetworkId); printf("Service Id: 0x%04hhx\n", serviceId); } int saveXML(FILE *file) const { fprintf(file, "\t\t\t\n", transportStreamId, originalNetworkId, serviceId); // %s, , name.c_str())<0) // return 1; return 0; } // Der Operator zum sortieren bool operator < (const SIlinkage& l) const { return name < l.name; } bool operator==(const SIlinkage& s) const { return (linkageType == s.linkageType) && (transportStreamId == s.transportStreamId) && (originalNetworkId == s.originalNetworkId) && (serviceId == s.serviceId) && (name == s.name); } bool operator!=(const SIlinkage& s) const { return (linkageType != s.linkageType) || (transportStreamId != s.transportStreamId) || (originalNetworkId != s.originalNetworkId) || (serviceId != s.serviceId) || (name != s.name); } }; typedef std::vector SIlinkage_descs; // Fuer for_each struct printSIlinkage : public std::unary_function { void operator() (const SIlinkage &l) { l.dump();} }; // Fuer for_each struct saveSIlinkageXML : public std::unary_function { FILE *f; saveSIlinkageXML(FILE *fi) { f=fi;} void operator() (const SIlinkage &l) { l.saveXML(f);} }; class SIcomponent { public: std::string component; unsigned char componentType; unsigned char componentTag; unsigned char streamContent; SIcomponent(void) { streamContent=0; componentType=0; componentTag=0; } 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; } // Der Operator zum sortieren bool operator < (const SIcomponent& c) const { return streamContent < c.streamContent; } bool operator==(const SIcomponent& c) const { return (componentType == c.componentType) && (componentTag == c.componentTag) && (streamContent == c.streamContent) && (component == c.component); } bool operator!=(const SIcomponent& c) const { return (componentType != c.componentType) || (componentTag != c.componentTag) || (streamContent != c.streamContent) || (component != c.component); } }; typedef std::multiset > SIcomponents; // Fuer for_each struct printSIcomponent : public std::unary_function { 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);} }; class SIparentalRating { public: 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; } // 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; } bool operator==(const SIparentalRating& p) const { return (rating == p.rating) && (countryCode == p.countryCode); } bool operator!=(const SIparentalRating& p) const { return (rating != p.rating) || (countryCode != p.countryCode); } }; typedef std::set > SIparentalRatings; // Fuer for_each struct printSIparentalRating : public std::unary_function { 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);} }; class SItime { 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) } // 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