diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2005-11-26 19:01:11 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2005-11-26 19:01:11 +0000 |
| commit | f94e2c9821eb8784ca03b7122485d4720ec6d6e6 (patch) | |
| tree | 6da2323d2220093ea1c3756dbddb8e02fded2969 /lib/service | |
| parent | 68271eeaf83872270f13cc01e98960367d7d553f (diff) | |
| download | enigma2-f94e2c9821eb8784ca03b7122485d4720ec6d6e6.tar.gz enigma2-f94e2c9821eb8784ca03b7122485d4720ec6d6e6.zip | |
add ability to select default encoding for dvb texts in many ways.. ( take a look in data/encodings.conf )
Diffstat (limited to 'lib/service')
| -rw-r--r-- | lib/service/event.cpp | 25 | ||||
| -rw-r--r-- | lib/service/event.h | 12 |
2 files changed, 22 insertions, 15 deletions
diff --git a/lib/service/event.cpp b/lib/service/event.cpp index 684c9e5e..cfd2ac5f 100644 --- a/lib/service/event.cpp +++ b/lib/service/event.cpp @@ -1,5 +1,6 @@ #include <lib/service/event.h> #include <lib/base/estring.h> +#include <lib/base/encoding.h> #include <lib/dvb/dvbtime.h> #include <dvbsi++/event_information_section.h> #include <dvbsi++/short_event_descriptor.h> @@ -52,7 +53,7 @@ std::string ISOtbl[MAX_LANG][2] = }; /* search for the presence of language from given EIT event descriptors*/ -bool eServiceEvent::loadLanguage(Event *evt, std::string lang) +bool eServiceEvent::loadLanguage(Event *evt, std::string lang, int tsidonid) { bool retval=0; for (DescriptorConstIterator desc = evt->getDescriptors()->begin(); desc != evt->getDescriptors()->end(); ++desc) @@ -62,10 +63,12 @@ bool eServiceEvent::loadLanguage(Event *evt, std::string lang) case SHORT_EVENT_DESCRIPTOR: { const ShortEventDescriptor *sed = (ShortEventDescriptor*)*desc; - if (lang.empty() || sed->getIso639LanguageCode() == lang) + const std::string &cc = sed->getIso639LanguageCode(); + int table=encodingHandler.getCountryCodeDefaultMapping(cc); + if (lang.empty() || cc == lang) { - m_event_name = convertDVBUTF8(sed->getEventName()); - m_short_description = convertDVBUTF8(sed->getText()); + m_event_name = convertDVBUTF8(sed->getEventName(), table, tsidonid); + m_short_description = convertDVBUTF8(sed->getText(), table, tsidonid); retval=1; } break; @@ -73,9 +76,11 @@ bool eServiceEvent::loadLanguage(Event *evt, std::string lang) case EXTENDED_EVENT_DESCRIPTOR: { const ExtendedEventDescriptor *eed = (ExtendedEventDescriptor*)*desc; - if (lang.empty() || eed->getIso639LanguageCode() == lang) + const std::string &cc = eed->getIso639LanguageCode(); + int table=encodingHandler.getCountryCodeDefaultMapping(cc); + if (lang.empty() || cc == lang) { - m_extended_description += convertDVBUTF8(eed->getText()); + m_extended_description += convertDVBUTF8(eed->getText(), table, tsidonid); retval=1; } #if 0 @@ -99,7 +104,7 @@ bool eServiceEvent::loadLanguage(Event *evt, std::string lang) return retval; } -RESULT eServiceEvent::parseFrom(Event *evt) +RESULT eServiceEvent::parseFrom(Event *evt, int tsidonid) { uint16_t stime_mjd = evt->getStartTimeMjd(); uint32_t stime_bcd = evt->getStartTimeBcd(); @@ -115,11 +120,11 @@ RESULT eServiceEvent::parseFrom(Event *evt) std::string country="de_DE"; // TODO use local data here for (int i=0; i < MAX_LANG; i++) if (country==ISOtbl[i][0]) - if (loadLanguage(evt,ISOtbl[i][1])) + if (loadLanguage(evt, ISOtbl[i][1], tsidonid)) return 0; - if (loadLanguage(evt,"eng")) + if (loadLanguage(evt, "eng", tsidonid)) return 0; - if (loadLanguage(evt,std::string())) + if (loadLanguage(evt, std::string(), tsidonid)) return 0; return 0; } diff --git a/lib/service/event.h b/lib/service/event.h index 7e6cf5d8..07106e40 100644 --- a/lib/service/event.h +++ b/lib/service/event.h @@ -1,7 +1,7 @@ #ifndef __lib_service_event_h #define __lib_service_event_h -#ifndef PYTHON +#ifndef SWIG #include <time.h> #include <lib/base/object.h> #include <string> @@ -11,14 +11,16 @@ class Event; class eServiceEvent: public iObject { DECLARE_REF(eServiceEvent); +#ifndef SWIG + bool loadLanguage(Event *event, std::string lang, int tsidonid); +#endif public: -#ifndef PYTHON +#ifndef SWIG time_t m_begin; int m_duration; std::string m_event_name, m_short_description, m_extended_description; // .. additional info - bool loadLanguage(Event *event, std::string lang); - RESULT parseFrom(Event *evt); + RESULT parseFrom(Event *evt, int tsidonid=0); #endif time_t getBeginTime() { return m_begin; } int getDuration() { return m_duration; } @@ -28,8 +30,8 @@ public: std::string getBeginTimeString(); }; -#ifndef PYTHON TEMPLATE_TYPEDEF(ePtr<eServiceEvent>, eServiceEventPtr); +#ifndef SWIG class eDebugClass: public iObject { |
