From 2074dc4a5d494750bb8a778773157fa374d38c53 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 28 Jan 2015 18:17:50 +0100 Subject: [PATCH 01/14] dt.cfix logic error --- src/dt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dt.c b/src/dt.c index eb82b2228..ddec4f7f9 100644 --- a/src/dt.c +++ b/src/dt.c @@ -129,14 +129,14 @@ int main(int argc, char **argv) } else if (sscanf(argv[x], "-ls%X", &b) == 1) { - if ((b > 0) || (b <= 8)) { + if ((b > 0) && (b <= 8)) { if (ioctl(fd, IOC_FP_LED_CTRL, b | 0x80)) perror("IOC_FP_LED_CTRL"); } } else if (sscanf(argv[x], "-lc%X", &b) == 1) { - if ((b > 0) || (b <= 8)) { + if ((b > 0) && (b <= 8)) { if (ioctl(fd, IOC_FP_LED_CTRL, b)) perror("IOC_FP_LED_CTRL"); } From 30fb340406d91e1a5fab12a349740ee3457ae080 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 29 Jan 2015 11:44:49 +0100 Subject: [PATCH 02/14] bouqueteditor_channels.cpp: use RC_tv if key_tvradio_mode not defined fix commit ecff98443260141e160cdf296ab468df29d7cf92 --- src/gui/bedit/bouqueteditor_channels.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 0f90e6ef9..bf777105b 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -437,7 +437,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* } } */ - else if( msg == (neutrino_msg_t) g_settings.key_tvradio_mode || CRCInput::RC_tv ) { + else if( msg == (neutrino_msg_t) g_settings.key_tvradio_mode || msg==CRCInput::RC_tv ) { if (mode == CZapitClient::MODE_TV) mode = CZapitClient::MODE_RADIO; else From c6245058184a1abbf6a69045bd7cf731906f3d0e Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 29 Jan 2015 14:58:09 +0100 Subject: [PATCH 03/14] make channel_id private, use getChannelID() --- src/gui/bedit/bouqueteditor_channels.cpp | 4 +- src/gui/bedit/bouqueteditor_chanselect.cpp | 2 +- src/gui/epgplus.cpp | 20 ++++---- src/gui/eventlist.cpp | 12 ++--- src/gui/timerlist.cpp | 4 +- src/gui/zapit_setup.cpp | 2 +- .../tuxboxapi/coolstream/controlapi.cpp | 36 +++++++-------- .../tuxboxapi/coolstream/neutrinoyparser.cpp | 46 +++++++++---------- src/zapit/include/zapit/channel.h | 2 +- 9 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index bf777105b..37eb291da 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -456,7 +456,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* if (state == beDefault) { if (selected < Channels->size()) /* Channels.size() might be 0 */ - g_Zapit->zapTo_serviceID((*Channels)[selected]->channel_id); + g_Zapit->zapTo_serviceID((*Channels)[selected]->getChannelID()); } else if (state == beMoving) { finishMoveChannel(); @@ -495,7 +495,7 @@ void CBEChannelWidget::deleteChannel() if (ShowMsg(LOCALE_FILEBROWSER_DELETE, (*Channels)[selected]->getName(), CMessageBox::mbrNo, CMessageBox::mbYes|CMessageBox::mbNo)!=CMessageBox::mbrYes) return; - g_bouquetManager->Bouquets[bouquet]->removeService((*Channels)[selected]->channel_id); + g_bouquetManager->Bouquets[bouquet]->removeService((*Channels)[selected]->getChannelID()); Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels); diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 746f05850..83b658534 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -92,7 +92,7 @@ bool CBEChannelSelectWidget::isChannelInBouquet( int index) { for (unsigned int i=0; i< bouquetChannels->size(); i++) { - if ((*bouquetChannels)[i]->channel_id == Channels[index]->channel_id) + if ((*bouquetChannels)[i]->getChannelID() == Channels[index]->getChannelID()) return true; } return false; diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 283289742..e14498578 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -549,9 +549,9 @@ void EpgPlus::createChannelEntries (int selectedChannelEntryIndex) CZapitChannel * channel = (*this->channelList)[i]; ChannelEntry *channelEntry = new ChannelEntry (channel, i, this->frameBuffer, this->footer, this->bouquetList, this->channelsTableX + 2, yPosChannelEntry, this->channelsTableWidth); -//printf("Going to get getEventsServiceKey for %llx\n", (channel->channel_id & 0xFFFFFFFFFFFFULL)); +//printf("Going to get getEventsServiceKey for %llx\n", (channel->getChannelID() & 0xFFFFFFFFFFFFULL)); CChannelEventList channelEventList; - CEitManager::getInstance()->getEventsServiceKey(channel->channel_id, channelEventList); + CEitManager::getInstance()->getEventsServiceKey(channel->getChannelID(), channelEventList); //printf("channelEventList size %d\n", channelEventList.size()); int xPosEventEntry = this->eventsTableX; @@ -562,13 +562,13 @@ void EpgPlus::createChannelEntries (int selectedChannelEntryIndex) //for (CChannelEventList::const_iterator It = channelEventList.begin(); (It != channelEventList.end()) && (It->startTime < (this->startTime + this->duration)); ++It) for (CChannelEventList::const_iterator It = channelEventList.begin(); It != channelEventList.end(); ++It) { -//if(0x2bc000b004b7ULL == (channel->channel_id & 0xFFFFFFFFFFFFULL)) printf("*** Check1 event %s event start %ld this start %ld\n", It->description.c_str(), It->startTime, (this->startTime + this->duration)); +//if(0x2bc000b004b7ULL == (channel->getChannelID() & 0xFFFFFFFFFFFFULL)) printf("*** Check1 event %s event start %ld this start %ld\n", It->description.c_str(), It->startTime, (this->startTime + this->duration)); if (!(It->startTime < (this->startTime + this->duration)) ) continue; if ((lastIt == channelEventList.end()) || (lastIt->startTime != It->startTime)) { int startTimeDiff = It->startTime - this->startTime; int endTimeDiff = this->startTime + time_t (this->duration) - It->startTime - time_t (It->duration); -//if(0x2bc000b004b7ULL == (channel->channel_id & 0xFFFFFFFFFFFFULL)) printf("*** Check event %s\n", It->description.c_str()); +//if(0x2bc000b004b7ULL == (channel->getChannelID() & 0xFFFFFFFFFFFFULL)) printf("*** Check event %s\n", It->description.c_str()); if ((startTimeDiff >= 0) && (endTimeDiff >= 0)) { // channel event fits completely in the visible part of time line startTimeDiff = 0; @@ -582,10 +582,10 @@ void EpgPlus::createChannelEntries (int selectedChannelEntryIndex) // channel event ends after visible part of the time line but starts in the visible part startTimeDiff = 0; } else if (startTimeDiff > 0) { // channel event starts and ends after visible part of the time line => break the loop -//if(0x2bc000b004b7ULL == (channel->channel_id & 0xFFFFFFFFFFFFULL)) printf("*** break 1\n"); +//if(0x2bc000b004b7ULL == (channel->getChannelID() & 0xFFFFFFFFFFFFULL)) printf("*** break 1\n"); break; } else { // channel event starts and ends after visible part of the time line => ignore the channel event -//if(0x2bc000b004b7ULL == (channel->channel_id & 0xFFFFFFFFFFFFULL)) printf("*** continue 1 startTimeDiff %ld endTimeDiff %ld\n", startTimeDiff, endTimeDiff); +//if(0x2bc000b004b7ULL == (channel->getChannelID() & 0xFFFFFFFFFFFFULL)) printf("*** continue 1 startTimeDiff %ld endTimeDiff %ld\n", startTimeDiff, endTimeDiff); continue; } @@ -926,7 +926,7 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu } else if (msg == CRCInput::RC_ok) { if (selectedChannelEntry) - CNeutrinoApp::getInstance()->channelList->zapTo_ChannelID(selectedChannelEntry->channel->channel_id); + CNeutrinoApp::getInstance()->channelList->zapTo_ChannelID(selectedChannelEntry->channel->getChannelID()); current_bouquet = bouquetList->getActiveBouquetNumber(); } else if (CRCInput::isNumeric (msg)) { @@ -1109,7 +1109,7 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu this->hide(); time_t startTime2 = (*It)->channelEvent.startTime; - res = g_EpgData->show (this->selectedChannelEntry->channel->channel_id, (*It)->channelEvent.eventID, &startTime2); + res = g_EpgData->show (this->selectedChannelEntry->channel->getChannelID(), (*It)->channelEvent.eventID, &startTime2); if (res == menu_return::RETURN_EXIT_ALL) { loop = false; @@ -1286,7 +1286,7 @@ int EpgPlus::MenuTargetAddReminder::exec (CMenuTarget * /*parent*/, const std::s && (!(*It)->channelEvent.description.empty()) ) { if (g_Timerd->isTimerdAvailable()) { - g_Timerd->addZaptoTimerEvent (this->epgPlus->selectedChannelEntry->channel->channel_id, (*It)->channelEvent.startTime - (g_settings.zapto_pre_time * 60), (*It)->channelEvent.startTime - ANNOUNCETIME - (g_settings.zapto_pre_time * 60), 0, (*It)->channelEvent.eventID, (*It)->channelEvent.startTime, 0); + g_Timerd->addZaptoTimerEvent (this->epgPlus->selectedChannelEntry->channel->getChannelID(), (*It)->channelEvent.startTime - (g_settings.zapto_pre_time * 60), (*It)->channelEvent.startTime - ANNOUNCETIME - (g_settings.zapto_pre_time * 60), 0, (*It)->channelEvent.eventID, (*It)->channelEvent.startTime, 0); ShowMsg (LOCALE_TIMER_EVENTTIMED_TITLE, g_Locale->getText (LOCALE_TIMER_EVENTTIMED_MSG) , CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); // UTF-8 @@ -1309,7 +1309,7 @@ int EpgPlus::MenuTargetAddRecordTimer::exec (CMenuTarget * /*parent*/, const std ) { if (g_Timerd->isTimerdAvailable()) { - g_Timerd->addRecordTimerEvent (this->epgPlus->selectedChannelEntry->channel->channel_id, (*It)->channelEvent.startTime, (*It)->channelEvent.startTime + (*It)->channelEvent.duration, (*It)->channelEvent.eventID, (*It)->channelEvent.startTime, (*It)->channelEvent.startTime - (ANNOUNCETIME + 120) + g_Timerd->addRecordTimerEvent (this->epgPlus->selectedChannelEntry->channel->getChannelID(), (*It)->channelEvent.startTime, (*It)->channelEvent.startTime + (*It)->channelEvent.duration, (*It)->channelEvent.eventID, (*It)->channelEvent.startTime, (*It)->channelEvent.startTime - (ANNOUNCETIME + 120) , TIMERD_APIDS_CONF, true); ShowMsg (LOCALE_TIMER_EVENTRECORD_TITLE, g_Locale->getText (LOCALE_TIMER_EVENTRECORD_MSG) , CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); // UTF-8 diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index b9203a007..0734e06f8 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -566,22 +566,22 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c unsigned int tmp_channel = 0; for(unsigned int channel = 0; channel < channel_nr; channel++) { - channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(channel)->channel_id; + channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(channel)->getChannelID(); if(channel_id_tmp == channel_id){ if ( msg==CRCInput::RC_right || msg==CRCInput::RC_forward ) { channel = (channel+1) %channel_nr; }else { //RC_rewind channel = (channel == 0) ? channel_nr -1 : channel - 1; } - _channel_id = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(channel)->channel_id; + _channel_id = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(channel)->getChannelID(); current_channel_name = CServiceManager::getInstance()->GetServiceName(_channel_id); tmp_channel = (channel == 0) ? channel_nr - 1 : channel - 1; - channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->channel_id; + channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->getChannelID(); prev_channel_name = CServiceManager::getInstance()->GetServiceName(channel_id_tmp); tmp_channel = (channel+1) %channel_nr; - channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->channel_id; + channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->getChannelID(); next_channel_name = CServiceManager::getInstance()->GetServiceName(channel_id_tmp); break; } @@ -1077,7 +1077,7 @@ bool CNeutrinoEventList::findEvents(void) int channel_nr = bouquetList->Bouquets[m_search_bouquet_id]->channelList->getSize(); for(int channel = 0; channel < channel_nr; channel++) { - channel_id = bouquetList->Bouquets[m_search_bouquet_id]->channelList->getChannelFromIndex(channel)->channel_id; + channel_id = bouquetList->Bouquets[m_search_bouquet_id]->channelList->getChannelFromIndex(channel)->getChannelID(); CEitManager::getInstance()->getEventsServiceKey(channel_id, evtlist, m_search_epg_item,m_search_keyword); } } @@ -1089,7 +1089,7 @@ bool CNeutrinoEventList::findEvents(void) std::vector v; int channel_nr = CNeutrinoApp::getInstance ()->channelList->getSize();//unique channelList TV or Radio for(int channel = 0; channel < channel_nr; channel++){ - channel_id = CNeutrinoApp::getInstance ()->channelList->getChannelFromIndex(channel)->channel_id; + channel_id = CNeutrinoApp::getInstance ()->channelList->getChannelFromIndex(channel)->getChannelID(); v.push_back(channel_id); } diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index cf465cb4f..4c26a2d70 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -1194,7 +1194,7 @@ int CTimerList::newTimer() g_bouquetManager->Bouquets[i]->getTvChannels(channels); for (int j = 0; j < (int) channels.size(); j++) { char cChannelId[3+16+1+1]; - sprintf(cChannelId, "SC:" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS ",", channels[j]->channel_id); + sprintf(cChannelId, "SC:" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS ",", channels[j]->getChannelID()); mwtv->addItem(new CMenuForwarder(channels[j]->getName(), true, NULL, this, (std::string(cChannelId) + channels[j]->getName()).c_str(), CRCInput::RC_nokey, NULL, channels[j]->scrambled ? NEUTRINO_ICON_SCRAMBLED : (channels[j]->getUrl().empty() ? NULL : NEUTRINO_ICON_STREAMING))); } @@ -1205,7 +1205,7 @@ int CTimerList::newTimer() g_bouquetManager->Bouquets[i]->getRadioChannels(channels); for (int j = 0; j < (int) channels.size(); j++) { char cChannelId[3+16+1+1]; - sprintf(cChannelId, "SC:" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS ",", channels[j]->channel_id); + sprintf(cChannelId, "SC:" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS ",", channels[j]->getChannelID()); mwradio->addItem(new CMenuForwarder(channels[j]->getName(), true, NULL, this, (std::string(cChannelId) + channels[j]->getName()).c_str(), CRCInput::RC_nokey, NULL, channels[j]->scrambled ? NEUTRINO_ICON_SCRAMBLED : (channels[j]->getUrl().empty() ? NULL : NEUTRINO_ICON_STREAMING))); } if (!channels.empty()) diff --git a/src/gui/zapit_setup.cpp b/src/gui/zapit_setup.cpp index 411ec8aea..51880c1d8 100644 --- a/src/gui/zapit_setup.cpp +++ b/src/gui/zapit_setup.cpp @@ -176,7 +176,7 @@ int CSelectChannelWidget::InitZapitChannelHelper(CZapitClient::channelsMode mode for(int j = 0; j < (int) channels.size(); j++) { CZapitChannel * channel = channels[j]; char cChannelId[60] = {0}; - snprintf(cChannelId, sizeof(cChannelId), "ZC%c:%d|%" PRIx64 "#", (mode==CZapitClient::MODE_TV)?'T':'R', channel->number, channel->channel_id); + snprintf(cChannelId, sizeof(cChannelId), "ZC%c:%d|%" PRIx64 "#", (mode==CZapitClient::MODE_TV)?'T':'R', channel->number, channel->getChannelID()); CMenuForwarder * chan_item = new CMenuForwarder(channel->getName(), true, NULL, this, (std::string(cChannelId) + channel->getName()).c_str(), CRCInput::RC_nokey, NULL, diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 64ead34d3..21cde474e 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -830,13 +830,13 @@ std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChann CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo; CChannelEvent *event; - event = NeutrinoAPI->ChannelListEvents[channel->channel_id]; + event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()]; if (event) { int percentage = 100; if (event->duration > 0) percentage = 100 * (time(NULL) - event->startTime) / event->duration; - CEitManager::getInstance()->getCurrentNextServiceKey(channel->channel_id, currentNextInfo); + CEitManager::getInstance()->getCurrentNextServiceKey(channel->getChannelID(), currentNextInfo); timestr = timeString(event->startTime); firstEPG += hh->outPair("startTime", timestr, true); @@ -855,7 +855,7 @@ std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChann } } - result += hh->outPair("isActiveChannel", (channel->channel_id == current_channel) ? "true" : "false", (!firstEPG.empty())); + result += hh->outPair("isActiveChannel", (channel->getChannelID() == current_channel) ? "true" : "false", (!firstEPG.empty())); if(!firstEPG.empty()) { result += hh->outCollection("firstEPG", firstEPG); } @@ -873,10 +873,10 @@ std::string CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel * bool isEPGdetails = !(hh->ParamList["epg"].empty()); if (hh->outType == json || hh->outType == xml) { result += hh->outPair("number", string_printf("%u", nr), true); - result += hh->outPair("id", string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->channel_id), true); - result += hh->outPair("short_id", string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->channel_id&0xFFFFFFFFFFFFULL), true); + result += hh->outPair("id", string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID()), true); + result += hh->outPair("short_id", string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID()&0xFFFFFFFFFFFFULL), true); result += hh->outPair("name", hh->outValue(channel->getName()), true); - result += hh->outPair("logo", hh->outValue(NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->channel_id)), true); + result += hh->outPair("logo", hh->outValue(NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->getChannelID())), true); result += hh->outPair("bouquetnr", string_printf("%d", bouquetNr), isEPGdetails); if(isEPGdetails) result += _GetBouquetActualEPGItem(hh, channel); @@ -884,21 +884,21 @@ std::string CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel * } else { CChannelEvent *event; - event = NeutrinoAPI->ChannelListEvents[channel->channel_id]; + event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()]; if (event && isEPGdetails) { result += string_printf("%u " PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %s (%s)\n", nr, - channel->channel_id, + channel->getChannelID(), channel->getName().c_str(), event->description.c_str()); } else { result += string_printf("%u " PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %s\n", nr, - channel->channel_id, + channel->getChannelID(), channel->getName().c_str()); } } @@ -1294,7 +1294,7 @@ void CControlAPI::epgDetailList(CyhookHandler *hh) { for (int j = 0, csize = (int) channels.size(); j < csize; j++) { CZapitChannel * channel = channels[j]; - res_channels += hh->outArrayItem("channel", channelEPGformated(hh, j + 1, channel->channel_id, max, stoptime), joutArrayItem("channel", channelEPGformated(hh, j + 1, channel->getChannelID(), max, stoptime), joutPair("number", string_printf("%d", i + 1), true) + @@ -1355,7 +1355,7 @@ void CControlAPI::EpgSearchCGI(CyhookHandler *hh, bool xml_forat ) std::vector v; int channel_nr = CNeutrinoApp::getInstance ()->channelList->getSize();//unique channelList TV or Radio for(int channel = 0; channel < channel_nr; channel++){ - channel_id = CNeutrinoApp::getInstance ()->channelList->getChannelFromIndex(channel)->channel_id; + channel_id = CNeutrinoApp::getInstance ()->channelList->getChannelFromIndex(channel)->getChannelID(); v.push_back(channel_id); } std::map ch_id_map; @@ -1491,15 +1491,15 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) { CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin(); for (; !(cit.EndOfChannels()); cit++) { CZapitChannel * channel = *cit; - event = NeutrinoAPI->ChannelListEvents[channel->channel_id]; + event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()]; if (event) { if (!isExt) { hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS - " %llu %s\n", channel->channel_id, event->eventID, event->description.c_str()); + " %llu %s\n", channel->getChannelID(), event->eventID, event->description.c_str()); } else { // ext output hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS - " %ld %u %llu %s\n", channel->channel_id, event->startTime, event->duration, event->eventID, event->description.c_str()); + " %ld %u %llu %s\n", channel->getChannelID(), event->startTime, event->duration, event->eventID, event->description.c_str()); } } } @@ -1765,14 +1765,14 @@ void CControlAPI::SendChannelList(CyhookHandler *hh, bool currentTP) CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin(); for (; !(cit.EndOfChannels()); cit++) { CZapitChannel * channel = *cit; - if(!currentTP || (channel->channel_id >>16) == current_channel){ + if(!currentTP || (channel->getChannelID() >>16) == current_channel){ - size_t pos = std::find(v.begin(), v.end(), channel->channel_id) - v.begin(); + size_t pos = std::find(v.begin(), v.end(), channel->getChannelID()) - v.begin(); if( pos < v.size() ) continue; - v.push_back(channel->channel_id); + v.push_back(channel->getChannelID()); - hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %s\n", channel->channel_id, channel->getName().c_str()); + hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %s\n", channel->getChannelID(), channel->getName().c_str()); } } } diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index 40d312d23..c9d119c7f 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -300,11 +300,11 @@ std::string CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler *, st CEPGData epg; CZapitChannel * channel = channels[j]; char buf[100],id[20]; - sprintf(id,PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS,channel->channel_id); + sprintf(id,PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS,channel->getChannelID()); std::string _sid = std::string(id); sel = (_sid == achannel_id) ? "selected=\"selected\"" : ""; - CEitManager::getInstance()->getActualEPGServiceKey(channel->channel_id, &epg); - sprintf(buf,"\n", channel->channel_id, sel.c_str(), channel->getName().c_str(),epg.title.c_str()); + CEitManager::getInstance()->getActualEPGServiceKey(channel->getChannelID(), &epg); + sprintf(buf,"\n", channel->getChannelID(), sel.c_str(), channel->getName().c_str(),epg.title.c_str()); yresult += buf; } } @@ -357,10 +357,10 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: { CZapitChannel * channel = channels[j]; CChannelEvent *event; - event = NeutrinoAPI->ChannelListEvents[channel->channel_id]; + event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()]; classname = (i++ & 1) ? 'a' : 'b'; - if (channel->channel_id == current_channel) + if (channel->getChannelID() == current_channel) classname = 'c'; std::string bouquetstr = (BouquetNr >= 0) ? ("&bouquet=" + itoa(BouquetNr)) : ""; @@ -369,8 +369,8 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: if(have_logos) yresult += string_printf("", classname, channel->channel_id, - (NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->channel_id)).c_str()); + "')\">", classname, channel->getChannelID(), + (NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->getChannelID())).c_str()); /* timer slider */ if(event && event->duration > 0) @@ -408,16 +408,16 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: "','" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "')\">%s\n", - ((channel->channel_id == current_channel) ? "" : " "), - channel->channel_id, + ((channel->getChannelID() == current_channel) ? "" : " "), + channel->getChannelID(), channel->number /* num + j */, channel->getName().c_str(), (channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE) ? " (NVOD)" : "", - channel->channel_id, - channel->channel_id & 0xFFFFFFFFFFFFULL, - ((NeutrinoAPI->ChannelListEvents[channel->channel_id]) ? "\"Program" : "")); + channel->getChannelID(), + channel->getChannelID() & 0xFFFFFFFFFFFFULL, + ((NeutrinoAPI->ChannelListEvents[channel->getChannelID()]) ? "\"Program" : "")); - if (channel->channel_id == current_channel) + if (channel->getChannelID() == current_channel) yresult += string_printf("\n  \"Streaminfo\""); yresult += string_printf("\n\n\n"); @@ -425,7 +425,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: if (channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE) { CSectionsdClient::NVODTimesList nvod_list; - if (CEitManager::getInstance()->getNVODTimesServiceKey(channel->channel_id, nvod_list)) + if (CEitManager::getInstance()->getNVODTimesServiceKey(channel->getChannelID(), nvod_list)) { CZapitClient::subServiceList subServiceList; @@ -465,10 +465,10 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: } } - else if ((event = NeutrinoAPI->ChannelListEvents[channel->channel_id])) + else if ((event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()])) { bool has_current_next = true; - CEitManager::getInstance()->getCurrentNextServiceKey(channel->channel_id, currentNextInfo); + CEitManager::getInstance()->getCurrentNextServiceKey(channel->getChannelID(), currentNextInfo); timestr = timeString(event->startTime); yresult += string_printf("",classname); @@ -1070,23 +1070,23 @@ std::string CNeutrinoYParser::func_set_timer_form(CyhookHandler *hh, std::strin for (; !(cit.EndOfChannels()); cit++) { if (((*cit)->flags & CZapitChannel::REMOVED) || (*cit)->flags & CZapitChannel::NOT_FOUND) continue; - sel = ((*cit)->channel_id == current_channel) ? "selected=\"selected\"" : ""; + sel = ((*cit)->getChannelID() == current_channel) ? "selected=\"selected\"" : ""; hh->ParamList["program_row"] += string_printf("\n", - (*cit)->channel_id, sel.c_str(), (*cit)->getName().c_str()); + (*cit)->getChannelID(), sel.c_str(), (*cit)->getName().c_str()); } cit = g_bouquetManager->radioChannelsBegin(); for (; !(cit.EndOfChannels()); cit++) { if (((*cit)->flags & CZapitChannel::REMOVED) || (*cit)->flags & CZapitChannel::NOT_FOUND) continue; - sel = ((*cit)->channel_id == current_channel) ? "selected=\"selected\"" : ""; + sel = ((*cit)->getChannelID() == current_channel) ? "selected=\"selected\"" : ""; hh->ParamList["program_row"] += string_printf("\n", - (*cit)->channel_id, sel.c_str(), (*cit)->getName().c_str()); + (*cit)->getChannelID(), sel.c_str(), (*cit)->getName().c_str()); } // recordingDir hh->ParamList["RECORD_DIR_MAXLEN"] = itoa(RECORD_DIR_MAXLEN-1); @@ -1174,7 +1174,7 @@ std::string CNeutrinoYParser::func_set_bouquet_edit_form(CyhookHandler *hh, std string_printf("\n", - (*channels)[j]->channel_id, + (*channels)[j]->getChannelID(), (*channels)[j]->getName().c_str()); } ZapitChannelList Channels; @@ -1187,12 +1187,12 @@ std::string CNeutrinoYParser::func_set_bouquet_edit_form(CyhookHandler *hh, std sort(Channels.begin(), Channels.end(), CmpChannelByChName()); for (int i = 0; i < (int) Channels.size(); i++) { - if (!g_bouquetManager->existsChannelInBouquet(selected, Channels[i]->channel_id)){ + if (!g_bouquetManager->existsChannelInBouquet(selected, Channels[i]->getChannelID())){ hh->ParamList["all_channels"] += string_printf("\n", - Channels[i]->channel_id, + Channels[i]->getChannelID(), Channels[i]->getName().c_str()); } } diff --git a/src/zapit/include/zapit/channel.h b/src/zapit/include/zapit/channel.h index 57dd00220..83bae3028 100644 --- a/src/zapit/include/zapit/channel.h +++ b/src/zapit/include/zapit/channel.h @@ -173,6 +173,7 @@ class CZapitChannel void Init(); friend class CChannelList; + t_channel_id channel_id; public: typedef enum channel_flags { @@ -193,7 +194,6 @@ class CZapitChannel int number; CChannelEvent currentEvent,nextEvent; int type; - t_channel_id channel_id; unsigned char scrambled; char * pname; bool has_bouquet; From ae6a5e691721d116100d168bbba6893535b1553a Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 27 Jan 2015 13:44:56 +0300 Subject: [PATCH 04/14] zapit/src/femanager.cpp: fix save/restore flag to use satellite in multi-satellite scan --- src/zapit/src/femanager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/zapit/src/femanager.cpp b/src/zapit/src/femanager.cpp index 75979b067..77dbad73e 100644 --- a/src/zapit/src/femanager.cpp +++ b/src/zapit/src/femanager.cpp @@ -286,7 +286,7 @@ bool CFEManager::loadSettings() satellite_map_t & satmap = fe->getSatellites(); satmap.clear(); - satellite_map_t satlist = CServiceManager::getInstance()->SatelliteList(); + satellite_map_t &satlist = CServiceManager::getInstance()->SatelliteList(); for(sat_iterator_t sit = satlist.begin(); sit != satlist.end(); ++sit) { if (!fe->supportsDelivery(sit->second.delsys)) @@ -314,6 +314,8 @@ bool CFEManager::loadSettings() if(getSatelliteConfig(fe, satconfig)) satmap[position] = satconfig; // overwrite if exist + if (satconfig.use_in_scan) + sit->second.use_in_scan = satconfig.use_in_scan; } } @@ -324,6 +326,7 @@ bool CFEManager::loadSettings() void CFEManager::saveSettings(bool write) { configfile.clear(); + satellite_map_t &satlist = CServiceManager::getInstance()->SatelliteList(); for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { CFrontend * fe = it->second; frontend_config_t & fe_config = fe->getConfig(); @@ -347,6 +350,9 @@ void CFEManager::saveSettings(bool write) satellite_map_t satellites = fe->getSatellites(); for(sat_iterator_t sit = satellites.begin(); sit != satellites.end(); ++sit) { if (sit->second.configured) { + sat_iterator_t tit = satlist.find(sit->first); + if (tit != satlist.end()) + sit->second.use_in_scan = tit->second.use_in_scan; satList.push_back(sit->first); setSatelliteConfig(fe, sit->second); } From e8700de2b780d28ca4546c230cc4f0897cf43420 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 30 Jan 2015 19:47:30 +0300 Subject: [PATCH 05/14] eitd: as long as neutrino using only first content classification, reduce content classification caching (leaving old code with ifdef) --- 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("----------------------------------------------------------"); From 0a4e9e8640416527a591b53795a302cfd2596651 Mon Sep 17 00:00:00 2001 From: Christian Schuett Date: Fri, 14 Feb 2014 18:10:04 +0100 Subject: [PATCH 06/14] Neutrino timer list: remove unnecessary check for last deleted event timerd client already filters deleted events (TIMERSTATE_TERMINATED) sent from timerd Signed-off-by: Christian Schuett Signed-off-by: Thilo Graf --- src/gui/timerlist.cpp | 12 ------------ src/gui/timerlist.h | 2 -- 2 files changed, 14 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 4c26a2d70..eab57ce56 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -262,7 +262,6 @@ CTimerList::CTimerList() liststart = 0; listmaxshow = 0; Timer = new CTimerdClient(); - skipEventID=0; timerNew_message = ""; timerNew_pluginName = ""; @@ -434,16 +433,6 @@ void CTimerList::updateEvents(void) { timerlist.clear(); Timer->getTimerList (timerlist); - //Remove last deleted event from List - CTimerd::TimerList::iterator timer = timerlist.begin(); - for (; timer != timerlist.end(); ++timer) - { - if (timer->eventID==skipEventID) - { - timerlist.erase(timer); - break; - } - } sort(timerlist.begin(), timerlist.end()); theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); @@ -613,7 +602,6 @@ int CTimerList::show() } if (killTimer) { Timer->removeTimerEvent(timerlist[selected].eventID); - skipEventID=timerlist[selected].eventID; update = true; } } diff --git a/src/gui/timerlist.h b/src/gui/timerlist.h index 137eb6286..1139bd3b7 100644 --- a/src/gui/timerlist.h +++ b/src/gui/timerlist.h @@ -73,8 +73,6 @@ class CTimerList : public CMenuTarget int timer_apids_ac3; int timer_apids_alt; - int skipEventID; - void paintItem(int pos); void paint(); void paintHead(); From 7f9dcb64b0837ace1cf38fce407473d4fca12342 Mon Sep 17 00:00:00 2001 From: Christian Schuett Date: Sun, 19 Jan 2014 14:38:59 +0100 Subject: [PATCH 07/14] Neutrino timerlist: sort timer type chooser alphabetically Signed-off-by: Christian Schuett Signed-off-by: Thilo Graf --- data/locale/english.locale | 2 +- src/gui/timerlist.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/locale/english.locale b/data/locale/english.locale index e2cb70226..807519718 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -2195,7 +2195,7 @@ timerlist.standby SB mode timerlist.standby.off Leave standby timerlist.standby.on Enter standby timerlist.stoptime Stop time -timerlist.type Timer typ +timerlist.type Timer type timerlist.type.execplugin Execute plugin timerlist.type.nextprogram Next program timerlist.type.record Record diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index eab57ce56..dc6279fef 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -1227,7 +1227,7 @@ int CTimerList::newTimer() &timerSettings_stopTime.getValue()); CMenuOptionChooser* m0; if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) - m0 = new CMenuOptionChooser(LOCALE_TIMERLIST_TYPE, (int *)&timerNew.eventType, TIMERLIST_TYPE_OPTIONS, TIMERLIST_TYPE_OPTION_COUNT, true, ¬ifier2); + m0 = new CMenuOptionChooser(LOCALE_TIMERLIST_TYPE, (int *)&timerNew.eventType, TIMERLIST_TYPE_OPTIONS, TIMERLIST_TYPE_OPTION_COUNT, true, ¬ifier2, CRCInput::RC_nokey, "", false, true); else m0 = new CMenuOptionChooser(LOCALE_TIMERLIST_TYPE, (int *)&timerNew.eventType, &TIMERLIST_TYPE_OPTIONS[1], TIMERLIST_TYPE_OPTION_COUNT-1, true, ¬ifier2); From a96fb7b7f0c9c73357aa2f38e0e985f4eb0161d7 Mon Sep 17 00:00:00 2001 From: Christian Schuett Date: Fri, 14 Feb 2014 18:40:22 +0100 Subject: [PATCH 08/14] timerd: prevent events from being deleted while sending them to neutrino in neutrino's timer list sometimes appears an entry with random values after deleting one because thread safety is not guaranteed for timerd's event list while sending items to neutrino, so let's lock the mutex earlier and unlock it later Signed-off-by: Christian Schuett Signed-off-by: Thilo Graf --- src/timerd/timerd.cpp | 6 ++++++ src/timerd/timermanager.cpp | 15 +++++++++++++-- src/timerd/timermanager.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/timerd/timerd.cpp b/src/timerd/timerd.cpp index 4d4538cfe..5f79230a0 100644 --- a/src/timerd/timerd.cpp +++ b/src/timerd/timerd.cpp @@ -59,6 +59,7 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd) case CTimerdMsg::CMD_GETSLEEPTIMER: rspGetSleeptimer.eventID = 0; + CTimerManager::getInstance()->lockEvents(); if (CTimerManager::getInstance()->listEvents(events)) { for (pos = events.begin(); pos != events.end(); ++pos) @@ -71,6 +72,7 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd) } } } + CTimerManager::getInstance()->unlockEvents(); CBasicServer::send_data(connfd, &rspGetSleeptimer, sizeof(rspGetSleeptimer)); break; @@ -78,6 +80,7 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd) CTimerdMsg::commandGetTimer msgGetTimer; CTimerd::responseGetTimer resp; CBasicServer::receive_data(connfd,&msgGetTimer, sizeof(msgGetTimer)); + CTimerManager::getInstance()->lockEvents(); if(CTimerManager::getInstance()->listEvents(events)) { if(events[msgGetTimer.eventID]) @@ -134,11 +137,13 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd) } } } + CTimerManager::getInstance()->unlockEvents(); CBasicServer::send_data(connfd, &resp, sizeof(CTimerd::responseGetTimer)); break; case CTimerdMsg::CMD_GETTIMERLIST: CTimerdMsg::generalInteger responseInteger; + CTimerManager::getInstance()->lockEvents(); responseInteger.number = (CTimerManager::getInstance()->listEvents(events)) ? events.size() : 0; if (CBasicServer::send_data(connfd, &responseInteger, sizeof(responseInteger)) == true) @@ -200,6 +205,7 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd) CBasicServer::send_data(connfd, &lresp, sizeof(CTimerd::responseGetTimer)); } } + CTimerManager::getInstance()->unlockEvents(); break; case CTimerdMsg::CMD_RESCHEDULETIMER: // event nach vorne oder hinten schieben diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index ad6262ead..01aae3af6 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -277,12 +277,24 @@ bool CTimerManager::stopEvent(int peventID) } //------------------------------------------------------------ +int CTimerManager::lockEvents() +{ + return pthread_mutex_lock(&tm_eventsMutex); +} + +//------------------------------------------------------------ +int CTimerManager::unlockEvents() +{ + return pthread_mutex_unlock(&tm_eventsMutex); +} + +//------------------------------------------------------------ + bool CTimerManager::listEvents(CTimerEventMap &Events) { if(!&Events) return false; - pthread_mutex_lock(&tm_eventsMutex); Events.clear(); for (CTimerEventMap::iterator pos = events.begin(); pos != events.end(); ++pos) @@ -290,7 +302,6 @@ bool CTimerManager::listEvents(CTimerEventMap &Events) pos->second->Refresh(); Events[pos->second->eventID] = pos->second; } - pthread_mutex_unlock(&tm_eventsMutex); return true; } //------------------------------------------------------------ diff --git a/src/timerd/timermanager.h b/src/timerd/timermanager.h index 708171d3e..7d9a18b22 100644 --- a/src/timerd/timermanager.h +++ b/src/timerd/timermanager.h @@ -237,6 +237,8 @@ public: bool removeEvent(int eventID); bool stopEvent(int eventID); CTimerEvent* getNextEvent(); + int lockEvents(); + int unlockEvents(); bool listEvents(CTimerEventMap &Events); CTimerd::CTimerEventTypes *getEventType(int eventID); // int modifyEvent(int eventID, time_t announceTime, time_t alarmTime, time_t stopTime, uint32_t repeatcount, CTimerd::CTimerEventRepeat evrepeat = CTimerd::TIMERREPEAT_ONCE); From 4eb949dda0f384fb12e09239a418233492c0bb41 Mon Sep 17 00:00:00 2001 From: Christian Schuett Date: Sun, 19 Jan 2014 19:33:57 +0100 Subject: [PATCH 09/14] timerd: reset EPG ID when modifying record or zapto timer this ensures an up-to-date EPG ID if no EPG infos available for the modified event during modification Signed-off-by: Christian Schuett Signed-off-by: Thilo Graf --- src/timerd/timermanager.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index 01aae3af6..f46a05bc8 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -350,13 +350,19 @@ int CTimerManager::modifyEvent(int peventID, time_t announceTime, time_t alarmTi break; case CTimerd::TIMER_RECORD: { - (static_cast(event))->recordingDir = data.recordingDir; - (static_cast(event))->getEpgId(); + CTimerEvent_Record *event_record = static_cast(event); + event_record->recordingDir = data.recordingDir; + event_record->eventInfo.epgID = 0; + event_record->eventInfo.epg_starttime = 0; + event_record->getEpgId(); break; } case CTimerd::TIMER_ZAPTO: { - (static_cast(event))->getEpgId(); + CTimerEvent_Zapto *event_zapto = static_cast(event); + event_zapto->eventInfo.epgID = 0; + event_zapto->eventInfo.epg_starttime = 0; + event_zapto->getEpgId(); break; } default: From 81eba0b35c2936c36a03a7b4a7cc7f4721f172bf Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 3 Feb 2015 17:27:00 +0100 Subject: [PATCH 10/14] timerdclient.cpp add check if zapto or record timer double is --- lib/timerdclient/timerdclient.cpp | 43 +++++++++++++++++++++++++++++++ lib/timerdclient/timerdclient.h | 1 + 2 files changed, 44 insertions(+) diff --git a/lib/timerdclient/timerdclient.cpp b/lib/timerdclient/timerdclient.cpp index 63aed7d6e..c6b62b6f0 100644 --- a/lib/timerdclient/timerdclient.cpp +++ b/lib/timerdclient/timerdclient.cpp @@ -237,10 +237,53 @@ int CTimerdClient::addTimerEvent( CTimerEventTypes evType, void* data , int min, addTimerEvent(evType,true,data,0,mktime(actTime),0); } */ +bool CTimerdClient::checkDouble(CTimerd::CTimerEventTypes evType, void* data, time_t announcetime, time_t alarmtime,time_t stoptime, + CTimerd::CTimerEventRepeat evrepeat, uint32_t repeatcount) +{ + if (evType != CTimerd::TIMER_RECORD && evType != CTimerd::TIMER_ZAPTO) + return false;//skip check not zap and record timer + + CTimerd::TimerList timerlist; + getTimerList(timerlist); + for (CTimerd::TimerList::iterator it = timerlist.begin(); it != timerlist.end();++it) + { + if ( (it->eventType == CTimerd::TIMER_RECORD || it->eventType == CTimerd::TIMER_ZAPTO ) && + (it->alarmTime == alarmtime && it->announceTime == announcetime && it->stopTime == stoptime && it->eventRepeat == evrepeat && it->repeatCount == repeatcount ) ) + { + if( it->eventType == CTimerd::TIMER_ZAPTO ) + { + CTimerd::EventInfo *ei=static_cast(data); + if( ei->channel_id == it->channel_id ) + { + if(( ei->epgID != 0 && ei->epgID != it->epgID ) || ( ei->epg_starttime != 0 && it->epg_starttime != ei->epg_starttime) ) + { + return false;//not double + } + return true; + } + } + else if(it->eventType == CTimerd::TIMER_RECORD) + { + CTimerd::RecordingInfo *ri=static_cast(data); + if(ri->channel_id == it->channel_id && ri->apids == it->apids && !strncmp(ri->recordingDir, it->recordingDir, RECORD_DIR_MAXLEN-1) ) + { + if( ( ri->epgID != 0 && ri->epgID != it->epgID ) || ( ri->epg_starttime != 0 && it->epg_starttime != ri->epg_starttime) ) + { + return false;//not double + } + return true; + } + } + } + } + return false;//not double +} //------------------------------------------------------------------------- int CTimerdClient::addTimerEvent( CTimerd::CTimerEventTypes evType, void* data, time_t announcetime, time_t alarmtime,time_t stoptime, CTimerd::CTimerEventRepeat evrepeat, uint32_t repeatcount,bool forceadd) { + if(checkDouble(evType, data, announcetime, alarmtime, stoptime, evrepeat, repeatcount))//check if timer is add double + return -1; if (!forceadd) { diff --git a/lib/timerdclient/timerdclient.h b/lib/timerdclient/timerdclient.h index 59a41b260..157c8f0f0 100644 --- a/lib/timerdclient/timerdclient.h +++ b/lib/timerdclient/timerdclient.h @@ -66,6 +66,7 @@ class CTimerdClient:private CBasicClient bool isTimerdAvailable(); // check if timerd is running CTimerd::TimerList getOverlappingTimers(time_t& announcetime, time_t& stoptime); + bool checkDouble(CTimerd::CTimerEventTypes evType, void* data, time_t announcetime, time_t alarmtime,time_t stoptime, CTimerd::CTimerEventRepeat /*evrepeat*/, uint32_t repeatcount); int addTimerEvent( CTimerd::CTimerEventTypes evType, void* data, time_t alarmtime,time_t announcetime = 0, time_t stoptime = 0, CTimerd::CTimerEventRepeat evrepeat = CTimerd::TIMERREPEAT_ONCE, uint32_t repeatcount = 0, bool forceadd=true); From a21399479e7c3503a466d6a3aff83e25d44b0b23 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 26 Jan 2015 13:51:20 +0100 Subject: [PATCH 11/14] luaclient: fix "jump to...crosses initialization of" error --- lib/luaclient/luaclient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/luaclient/luaclient.cpp b/lib/luaclient/luaclient.cpp index 7344dcad6..9eb3dd47c 100644 --- a/lib/luaclient/luaclient.cpp +++ b/lib/luaclient/luaclient.cpp @@ -76,6 +76,7 @@ int main(int argc, char** argv) int res = -1; const char *fun = NULL; char *resp = NULL; + char result[size]; if (!client.Send(data, size)) { fun = "Send failed"; @@ -85,7 +86,6 @@ int main(int argc, char** argv) fun = "Recv (1) failed"; goto fail; } - char result[size]; if (!client.Recv(result, size)) { fun = "Recv (2) failed"; goto fail; From fe5a6ec11191a9f398d8aa51f0dbd455888f3937 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 26 Jan 2015 19:30:23 +0100 Subject: [PATCH 12/14] picview/png, my_popen: fix -Wclobbered warnings --- src/driver/pictureviewer/png.cpp | 3 ++- src/system/helpers.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/driver/pictureviewer/png.cpp b/src/driver/pictureviewer/png.cpp index e0361b673..5e4009454 100644 --- a/src/driver/pictureviewer/png.cpp +++ b/src/driver/pictureviewer/png.cpp @@ -32,7 +32,7 @@ int int_png_load(const char *name, unsigned char **buffer, int* xp, int* yp, int png_infop info_ptr; png_uint_32 width, height; unsigned int i; - int bit_depth, color_type, interlace_type, number_passes, pass, int_bpp = 3; + int bit_depth, color_type, interlace_type, number_passes, pass, int_bpp; png_byte * fbptr; FILE * fh; @@ -100,6 +100,7 @@ int int_png_load(const char *name, unsigned char **buffer, int* xp, int* yp, int png_set_strip_alpha(png_ptr); if (bit_depth < 8) png_set_packing(png_ptr); + int_bpp = 3; } if (bit_depth == 16) png_set_strip_16(png_ptr); diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index ffa23ca55..d2bf3dc88 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -4,7 +4,7 @@ License: GPL (C) 2012-2013 the neutrino-hd developers - (C) 2012,2013 Stefan Seyfried + (C) 2012-2015 Stefan Seyfried 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 @@ -110,7 +110,7 @@ int my_system(const char * cmd) int my_system(int argc, const char *arg, ...) { - int i = 0, ret = 0, childExit = 0; + int i = 0, ret, childExit = 0; #define ARGV_MAX 64 /* static right now but could be made dynamic if necessary */ int argv_max = ARGV_MAX; @@ -141,6 +141,7 @@ int my_system(int argc, const char *arg, ...) ret = -errno; break; case 0: /* child process */ + ret = 0; for(i = 3; i < maxfd; i++) close(i); if (setsid() == -1) @@ -153,6 +154,7 @@ int my_system(int argc, const char *arg, ...) } _exit(ret); // terminate c h i l d proces s only default: /* parent returns to calling process */ + ret = 0; waitpid(pid, &childExit, 0); if (WEXITSTATUS(childExit) != 0) ret = (signed char)WEXITSTATUS(childExit); From 1121e6210eb6e428b94b9cb0013ceb07324b2328 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 4 Feb 2015 15:35:13 +0100 Subject: [PATCH 13/14] pictureviewer.cpp: CPictureViewer::DownloadImage add curl timeout opt --- src/driver/pictureviewer/pictureviewer.cpp | 27 ++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 022c4f553..aab815c70 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -111,15 +111,24 @@ std::string CPictureViewer::DownloadImage(std::string url) FILE *tmpFile = fopen(tmpname.c_str(), "wb"); if (tmpFile) { CURL *ch = curl_easy_init(); - curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); - curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); - curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); - curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, NULL); - curl_easy_setopt(ch, CURLOPT_WRITEDATA, tmpFile); - curl_easy_setopt(ch, CURLOPT_FAILONERROR, 1L); - curl_easy_setopt(ch, CURLOPT_URL, url.c_str()); - curl_easy_perform(ch); - curl_easy_cleanup(ch); + if(ch) + { + curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); + curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); + curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, NULL); + curl_easy_setopt(ch, CURLOPT_WRITEDATA, tmpFile); + curl_easy_setopt(ch, CURLOPT_FAILONERROR, 1L); + curl_easy_setopt(ch, CURLOPT_URL, url.c_str()); + curl_easy_setopt(ch, CURLOPT_NOSIGNAL,1); + curl_easy_setopt(ch, CURLOPT_CONNECTTIMEOUT, 3); + curl_easy_setopt(ch, CURLOPT_TIMEOUT, 4); + CURLcode res = curl_easy_perform(ch); + if (res != CURLE_OK){ + printf("[%s] curl_easy_perform() failed:%s\n",__func__, curl_easy_strerror(res)); + } + curl_easy_cleanup(ch); + } fclose(tmpFile); url = true; } From d58f62176974eefc6237510a38f9331d4bfa414d Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 4 Feb 2015 15:52:40 +0100 Subject: [PATCH 14/14] pictureviewer.cpp: CPictureViewer::DownloadImage remove double add CURLOPT_NOSIGNA --- src/driver/pictureviewer/pictureviewer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index aab815c70..3f73ae03e 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -120,7 +120,6 @@ std::string CPictureViewer::DownloadImage(std::string url) curl_easy_setopt(ch, CURLOPT_WRITEDATA, tmpFile); curl_easy_setopt(ch, CURLOPT_FAILONERROR, 1L); curl_easy_setopt(ch, CURLOPT_URL, url.c_str()); - curl_easy_setopt(ch, CURLOPT_NOSIGNAL,1); curl_easy_setopt(ch, CURLOPT_CONNECTTIMEOUT, 3); curl_easy_setopt(ch, CURLOPT_TIMEOUT, 4); CURLcode res = curl_easy_perform(ch);