From 96c523a0c27f64e269a3d7e9bbceb1a0ad4fe6ff Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 30 Jan 2015 19:47:30 +0300 Subject: [PATCH] eitd: as long as neutrino using only first content classification, reduce content classification caching (leaving old code with ifdef) Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e8700de2b780d28ca4546c230cc4f0897cf43420 Author: [CST] Focus Date: 2015-01-30 (Fri, 30 Jan 2015) --- lib/sectionsdclient/sectionsdclient.h | 7 +++++- src/driver/record.cpp | 5 ++++ src/eitd/SIevents.cpp | 25 +++++++++++++++++++ src/eitd/SIevents.hpp | 11 ++++++++ src/eitd/sectionsd.cpp | 11 ++++++++ src/eitd/xmlutil.cpp | 5 ++++ src/gui/epgview.cpp | 6 ++++- .../tuxboxapi/coolstream/controlapi.cpp | 16 ++++++++++++ 8 files changed, 84 insertions(+), 2 deletions(-) diff --git a/lib/sectionsdclient/sectionsdclient.h b/lib/sectionsdclient/sectionsdclient.h index b020407a0..1f70b01f2 100644 --- a/lib/sectionsdclient/sectionsdclient.h +++ b/lib/sectionsdclient/sectionsdclient.h @@ -1,7 +1,7 @@ #ifndef __sectionsdclient__ #define __sectionsdclient__ /* - Client-Interface für zapit - DBoxII-Project + Client-Interface for zapit - DBoxII-Project $Id: sectionsdclient.h,v 1.42 2007/01/12 22:57:57 houdini Exp $ @@ -221,8 +221,13 @@ class CEPGData std::vector items; char fsk; unsigned char table_id; +#ifdef FULL_CONTENT_CLASSIFICATION std::string contentClassification; std::string userClassification; +#else + unsigned char contentClassification; + unsigned char userClassification; +#endif CEPGData() { diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 590d9038a..6a71fc41e 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -580,8 +580,13 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis info2 = epgdata.info2; recMovieInfo->parentalLockAge = epgdata.fsk; +#ifdef FULL_CONTENT_CLASSIFICATION if( !epgdata.contentClassification.empty() ) recMovieInfo->genreMajor = epgdata.contentClassification[0]; +#else + if(epgdata.contentClassification) + recMovieInfo->genreMajor = epgdata.contentClassification; +#endif recMovieInfo->length = epgdata.epg_times.dauer / 60; diff --git a/src/eitd/SIevents.cpp b/src/eitd/SIevents.cpp index 7883d22b4..b68072cb6 100644 --- a/src/eitd/SIevents.cpp +++ b/src/eitd/SIevents.cpp @@ -248,11 +248,17 @@ void SIevent::parse(Event &event) const ContentDescriptor * d = (ContentDescriptor *) *dit; const ContentClassificationList *clist = d->getClassifications(); if (clist->size()) { +#ifdef FULL_CONTENT_CLASSIFICATION ssize_t off = classifications.reserve(clist->size() * 2); for (ContentClassificationConstIterator cit = clist->begin(); cit != clist->end(); ++cit) off = classifications.set(off, (*cit)->getContentNibbleLevel1() << 4 | (*cit)->getContentNibbleLevel2(), (*cit)->getUserNibble1() << 4 | (*cit)->getUserNibble2()); +#else + ContentClassificationConstIterator cit = clist->begin(); + classifications.content = (*cit)->getContentNibbleLevel1() << 4 | (*cit)->getContentNibbleLevel2(); + classifications.user = (*cit)->getUserNibble1() << 4 | (*cit)->getUserNibble2(); +#endif } break; } @@ -414,8 +420,14 @@ void SIevent::parseContentDescriptor(const uint8_t *buf, unsigned maxlen) return; if(!cont->descriptor_length) return; +#ifdef FULL_CONTENT_CLASSIFICATION ssize_t off = classifications.reserve(cont->descriptor_length); classifications.set(off, buf + sizeof(struct descr_generic_header), cont->descriptor_length); +#else + classifications.content = buf[sizeof(struct descr_generic_header)]; + if (cont->descriptor_length > 1) + classifications.user = buf[sizeof(struct descr_generic_header)+1]; +#endif } void SIevent::parseComponentDescriptor(const uint8_t *buf, unsigned maxlen) @@ -651,6 +663,7 @@ int SIevent::saveXML2(FILE *file) const } } for_each(times.begin(), times.end(), saveSItimeXML(file)); +#ifdef FULL_CONTENT_CLASSIFICATION std::string contentClassification, userClassification; classifications.get(contentClassification, userClassification); for(unsigned i=0; i\n", contentClassification[i], userClassification[i]); } +#else + if (classifications.content || classifications.user) + fprintf(file, "\t\t\t\n", classifications.content, classifications.user); +#endif + 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)); @@ -685,6 +703,7 @@ void SIevent::dump(void) const printf("Extended-Text (%s): %s\n", langIndex[it->lang].c_str(), it->text[SILangData::langExtendedText].c_str()); } +#ifdef FULL_CONTENT_CLASSIFICATION std::string contentClassification, userClassification; classifications.get(contentClassification, userClassification); if(!contentClassification.empty()) { @@ -699,6 +718,12 @@ void SIevent::dump(void) const printf(" 0x%02hhx", userClassification[i]); printf("\n"); } +#else + if (classifications.content || classifications.user) { + printf("Content classification: 0x%02hhx\n", classifications.content); + printf("User classification: 0x%02hhx\n", classifications.user); + } +#endif for_each(times.begin(), times.end(), printSItime()); for_each(components.begin(), components.end(), printSIcomponent()); diff --git a/src/eitd/SIevents.hpp b/src/eitd/SIevents.hpp index 0031853ce..7d4c00338 100644 --- a/src/eitd/SIevents.hpp +++ b/src/eitd/SIevents.hpp @@ -376,6 +376,7 @@ class SIevent #endif struct SIeventClassifications { +#ifdef FULL_CONTENT_CLASSIFICATION uint8_t *data; unsigned int size; @@ -486,6 +487,16 @@ class SIevent memcpy (data + off, _data, len); return off + len; } +#else + uint8_t content; + uint8_t user; + + SIeventClassifications() + { + content = 0; + user = 0; + } +#endif }; SIeventClassifications classifications; diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index d151f8229..51d4809c9 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -2629,7 +2629,12 @@ bool CEitManager::getEPGid(const event_id_t epgID, const time_t startzeit, CEPGD epgdata->info1 = evt.getText(); epgdata->info2 = evt.getExtendedText(); /* FIXME printf("itemDescription: %s\n", evt.itemDescription.c_str()); */ +#ifdef FULL_CONTENT_CLASSIFICATION evt.classifications.get(epgdata->contentClassification, epgdata->userClassification); +#else + epgdata->contentClassification = evt.classifications.content; + epgdata->userClassification = evt.classifications.user; +#endif epgdata->fsk = evt.getFSK(); epgdata->table_id = evt.table_id; @@ -2690,7 +2695,13 @@ bool CEitManager::getActualEPGServiceKey(const t_channel_id channel_id, CEPGData epgdata->info1 = evt.getText(); epgdata->info2 = evt.getExtendedText(); /* FIXME printf("itemDescription: %s\n", evt.itemDescription.c_str());*/ +#ifdef FULL_CONTENT_CLASSIFICATION evt.classifications.get(epgdata->contentClassification, epgdata->userClassification); +#else + epgdata->contentClassification = evt.classifications.content; + epgdata->userClassification = evt.classifications.user; +#endif + epgdata->fsk = evt.getFSK(); epgdata->table_id = evt.table_id; diff --git a/src/eitd/xmlutil.cpp b/src/eitd/xmlutil.cpp index 1d624523c..5087cc0d8 100644 --- a/src/eitd/xmlutil.cpp +++ b/src/eitd/xmlutil.cpp @@ -439,10 +439,15 @@ void *insertEventsfromFile(void * data) } if (!contentClassification.empty()) { +#ifdef FULL_CONTENT_CLASSIFICATION ssize_t off = e.classifications.reserve(2 * contentClassification.size()); if (off > -1) for (unsigned i = 0; i < contentClassification.size(); i++) off = e.classifications.set(off, contentClassification.at(i), userClassification.at(i)); +#else + e.classifications.content = contentClassification.at(0); + e.classifications.user = userClassification.at(0); +#endif } addEvent(e, 0); ev_count++; diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 3c72724b3..783eabdbc 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -611,10 +611,14 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start } // Show genre information +#ifdef FULL_CONTENT_CLASSIFICATION if (!epgData.contentClassification.empty()) processTextToArray(std::string(g_Locale->getText(LOCALE_EPGVIEWER_GENRE)) + ": " + GetGenre(epgData.contentClassification[0])); // UTF-8 // processTextToArray( epgData.userClassification.c_str() ); - +#else + if (epgData.contentClassification) + processTextToArray(std::string(g_Locale->getText(LOCALE_EPGVIEWER_GENRE)) + ": " + GetGenre(epgData.contentClassification)); // UTF-8 +#endif // -- display more screenings on the same channel // -- 2002-05-03 rasc diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 21cde474e..39a19d06e 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -1402,11 +1402,19 @@ void CControlAPI::EpgSearchCGI(CyhookHandler *hh, bool xml_forat ) hh->printf("\t\t%s\n",ZapitTools::UTF8_to_UTF8XML(epg.info2.c_str()).c_str()); if (CEitManager::getInstance()->getEPGid(eventIterator->eventID, eventIterator->startTime, &longepg)) { hh->printf("\t\t%u\n", longepg.fsk); +#ifdef FULL_CONTENT_CLASSIFICATION if (!longepg.contentClassification.empty()){ genere = GetGenre(longepg.contentClassification[0]); genere = ZapitTools::UTF8_to_UTF8XML(genere.c_str()); hh->printf("\t\t%s\n", genere.c_str()); } +#else + if (longepg.contentClassification) { + genere = GetGenre(longepg.contentClassification); + genere = ZapitTools::UTF8_to_UTF8XML(genere.c_str()); + hh->printf("\t\t%s\n", genere.c_str()); + } +#endif } strftime(tmpstr, sizeof(tmpstr), "%Y-%m-%d", tmStartZeit ); hh->printf("\t\t%s\n", tmpstr); @@ -1436,11 +1444,19 @@ void CControlAPI::EpgSearchCGI(CyhookHandler *hh, bool xml_forat ) hh->WriteLn(epg.info2); if (CEitManager::getInstance()->getEPGid(eventIterator->eventID, eventIterator->startTime, &longepg)) { hh->printf("fsk:%u\n", longepg.fsk); +#ifdef FULL_CONTENT_CLASSIFICATION if (!longepg.contentClassification.empty()){ genere = GetGenre(longepg.contentClassification[0]); genere = ZapitTools::UTF8_to_UTF8XML(genere.c_str()); hh->WriteLn(genere); } +#else + if (longepg.contentClassification) { + genere = GetGenre(longepg.contentClassification); + genere = ZapitTools::UTF8_to_UTF8XML(genere.c_str()); + hh->WriteLn(genere); + } +#endif } hh->WriteLn("----------------------------------------------------------");