diff --git a/src/daemonc/remotecontrol.cpp b/src/daemonc/remotecontrol.cpp index ffb5e1e7a..837c41660 100644 --- a/src/daemonc/remotecontrol.cpp +++ b/src/daemonc/remotecontrol.cpp @@ -46,8 +46,9 @@ #include #include +#include +#include -extern tallchans allchans; extern CBouquetManager *g_bouquetManager; extern CZapitChannel *g_current_channel; @@ -142,11 +143,11 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data // warte auf keine Meldung vom ZAPIT -> jemand anderer hat das zappen ausgelöst... if ((*(t_channel_id *)data) != current_channel_id) { t_channel_id new_id = *(t_channel_id *)data; - tallchans_iterator cit = allchans.find(new_id); + CZapitChannel* channel = CServiceManager::getInstance()->FindChannel(new_id); is_video_started = true; - if (cit != allchans.end()) { - current_channel_name = cit->second.getName(); - if (cit->second.bAlwaysLocked) + if (channel) { + current_channel_name = channel->getName(); + if (channel->bAlwaysLocked) stopvideo(); } CVFD::getInstance()->showServicename(current_channel_name); // UTF-8 @@ -645,7 +646,6 @@ const std::string & CRemoteControl::subChannelDown(void) } void stopAutoRecord(); -extern int abort_zapit; void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::string & channame, const bool start_video) // UTF-8 { current_channel_id = channel_id; @@ -679,10 +679,9 @@ void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::s g_RCInput->killTimer(scrambled_timer); //dvbsub_pause(true); - abort_zapit = 1; + CZapit::getInstance()->Abort(); g_Zapit->zapTo_serviceID_NOWAIT(channel_id); g_Sectionsd->setServiceChanged( current_channel_id&0xFFFFFFFFFFFFULL, false ); - abort_zapit = 0; zap_completion_timeout = now + 2 * (int64_t) 1000000; g_RCInput->killTimer( current_programm_timer ); diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 90dcfbef3..41d003022 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include /* TODO: @@ -64,8 +65,6 @@ extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ extern t_channel_id live_channel_id; extern t_channel_id rec_channel_id; -extern tallchans allchans; -extern tallchans nvodchannels; bool sectionsd_getActualEPGServiceKey(const t_channel_id uniqueServiceKey, CEPGData * epgdata); bool sectionsd_getEPGidShort(event_id_t epgID, CShortEPGData * epgdata); @@ -222,15 +221,11 @@ bool CRecordInstance::Update() APIDList::iterator it; bool update = false; - tallchans_iterator cit = allchans.find(channel_id); - if(cit == allchans.end()) { - cit = nvodchannels.find(channel_id); - if(cit == nvodchannels.end()) { - printf("%s: channel %llx not found!\n", __FUNCTION__, channel_id); - return false; - } + CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); + if(channel == NULL) { + printf("%s: channel %llx not found!\n", __FUNCTION__, channel_id); + return false; } - CZapitChannel * channel = &(cit->second); if(channel->getVideoPid() != allpids.PIDs.vpid) { Stop(false); @@ -357,15 +352,11 @@ record_error_msg_t CRecordInstance::Record() APIDList apid_list; printf("%s: channel %llx recording_id %d\n", __FUNCTION__, channel_id, recording_id); - tallchans_iterator cit = allchans.find(channel_id); - if(cit == allchans.end()) { - cit = nvodchannels.find(channel_id); - if(cit == nvodchannels.end()) { - printf("%s: channel %llx not found!\n", __FUNCTION__, channel_id); - return RECORD_INVALID_CHANNEL; - } + CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); + if(channel == NULL) { + printf("%s: channel %llx not found!\n", __FUNCTION__, channel_id); + return RECORD_INVALID_CHANNEL; } - CZapitChannel * channel = &(cit->second); record_error_msg_t ret = MakeFileName(channel); if(ret != RECORD_OK) @@ -610,15 +601,13 @@ record_error_msg_t CRecordInstance::MakeFileName(CZapitChannel * channel) void CRecordInstance::GetRecordString(std::string &str) { - tallchans_iterator cit = allchans.find(channel_id); - if(cit == allchans.end()) { - cit = nvodchannels.find(channel_id); - if(cit == nvodchannels.end()) { - str = "Unknown channel : " + GetEpgTitle(); - return; - } + CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); + if(channel == NULL) { + printf("%s: channel %llx not found!\n", __FUNCTION__, channel_id); + str = "Unknown channel : " + GetEpgTitle(); + return; } - str = cit->second.getName() + ": " + GetEpgTitle(); + str = channel->getName() + ": " + GetEpgTitle(); } //------------------------------------------------------------------------- @@ -1331,7 +1320,7 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo if(live_channel_id != channel_id) { if(SAME_TRANSPONDER(live_channel_id, channel_id)) { printf("%s zapTo_record channel_id %llx\n", __FUNCTION__, channel_id); - ret = g_Zapit->zapTo_record(channel_id) == 0; + ret = g_Zapit->zapTo_record(channel_id) > 0; } else if(recmap.size()) { ret = false; } else { diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index fefed375e..c6e912e50 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -54,6 +54,7 @@ #include #include +#include extern CPictureViewer * g_PicViewer; @@ -447,7 +448,6 @@ static bool sortByDateTime (const CChannelEvent& a, const CChannelEvent& b) //extern char recDir[255]; void sectionsd_getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventList &eList, char search = 0, std::string search_text = ""); bool sectionsd_getComponentTagsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::ComponentTagList& tags); -extern tallchans allchans; int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_startzeit, bool doLoop ) { int res = menu_return::RETURN_REPAINT; @@ -600,12 +600,12 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start int pic_offx = 0; //hack.. - tallchans_iterator cit = allchans.find(channel_id); - if(cit != allchans.end()) { + CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); + if(channel) { std::string lname; int logo_w = 0; int logo_h = 0; - if(g_settings.infobar_show_channellogo && g_PicViewer->GetLogoName(channel_id, cit->second.getName(), lname, &logo_w, &logo_h)) { + if(g_settings.infobar_show_channellogo && g_PicViewer->GetLogoName(channel_id, channel->getName(), lname, &logo_w, &logo_h)) { if(logo_h > toph){ if((toph/(logo_h-toph))>1){ logo_w -= (logo_w/(toph/(logo_h-toph))); diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index bbe288210..dfae81b2f 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -49,7 +49,6 @@ void sectionsd_getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventL void sectionsd_getCurrentNextServiceKey(t_channel_id uniqueServiceKey, CSectionsdClient::responseGetCurrentNextInfoChannelID& current_next ); bool sectionsd_getLinkageDescriptorsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::LinkageDescriptorList& descriptors); bool sectionsd_getComponentTagsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::ComponentTagList& tags); -extern tallchans allchans; extern CBouquetManager *g_bouquetManager; extern t_channel_id live_channel_id; #define EVENTDEV "/dev/input/input0" diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp index b1e00e092..476ffbd5d 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp @@ -37,8 +37,8 @@ #include #include #include +#include -extern tallchans allchans; extern CBouquetManager *g_bouquetManager; extern CFrontend * frontend; extern cVideo * videoDecoder; @@ -205,17 +205,12 @@ t_channel_id CNeutrinoAPI::ChannelNameToChannelId(std::string search_channel_nam //int mode = Zapit->getMode(); t_channel_id channel_id = (t_channel_id)-1; CStringArray channel_names = ySplitStringVector(search_channel_name, ","); - for (tallchans_iterator it = allchans.begin(); it != allchans.end(); it++) { - std::string channel_name = it->second.getName(); - for(unsigned int j=0;jsecond.channel_id; - break; - } + + for(unsigned int j=0;jFindChannelByName(channel_names[j]); + if(channel) { + channel_id = channel->getChannelID(); + break; } } return channel_id; @@ -281,11 +276,7 @@ bool CNeutrinoAPI::GetChannelEvents(void) std::string CNeutrinoAPI::GetServiceName(t_channel_id channel_id) { - tallchans_iterator it = allchans.find(channel_id); - if (it != allchans.end()) - return it->second.getName(); - else - return ""; + return CServiceManager::getInstance()->GetServiceName(channel_id); } //------------------------------------------------------------------------- diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index 663d54784..f4f3e06ef 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -28,10 +28,10 @@ #include #include +#include #include #include -extern tallchans allchans; extern CBouquetManager *g_bouquetManager; extern t_channel_id live_channel_id; @@ -1065,15 +1065,11 @@ std::string CNeutrinoYParser::func_set_bouquet_edit_form(CyhookHandler *hh, std } ZapitChannelList Channels; Channels.clear(); - if (mode == CZapitClient::MODE_RADIO) { - for (tallchans_iterator it = allchans.begin(); it != allchans.end(); it++) - if (it->second.getServiceType() == ST_DIGITAL_RADIO_SOUND_SERVICE) - Channels.push_back(&(it->second)); - } else { - for (tallchans_iterator it = allchans.begin(); it != allchans.end(); it++) - if (it->second.getServiceType() != ST_DIGITAL_RADIO_SOUND_SERVICE) - Channels.push_back(&(it->second)); - } + if (mode == CZapitClient::MODE_RADIO) + CServiceManager::getInstance()->GetAllRadioChannels(Channels); + else + CServiceManager::getInstance()->GetAllTvChannels(Channels); + sort(Channels.begin(), Channels.end(), CmpChannelByChName()); for (int i = 0; i < (int) Channels.size(); i++) { diff --git a/src/zapit/src/cam.cpp b/src/zapit/src/cam.cpp index 00f29a664..33eee45ce 100644 --- a/src/zapit/src/cam.cpp +++ b/src/zapit/src/cam.cpp @@ -27,9 +27,7 @@ #include /* get_length_field_size */ #include #include - -extern tallchans allchans; -extern tallchans nvodchannels; +#include CCam::CCam() { @@ -129,37 +127,33 @@ CCamManager * CCamManager::getInstance(void) return manager; } -bool CCamManager::SetMode(t_channel_id id, enum runmode mode, bool start, bool force_update) +bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start, bool force_update) { CCam * cam; int oldmask, newmask; int demux = DEMUX_SOURCE_0; int source = DEMUX_SOURCE_0; - tallchans_iterator cit = allchans.find(id); - if(cit == allchans.end()) { - cit = nvodchannels.find(id); - if(cit == nvodchannels.end()) { - printf("CCamManager: channel %llx not found\n", id); - return false; - } - } + CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); - CZapitChannel * channel = &(cit->second); + if(channel == NULL) { + printf("CCamManager: channel %llx not found\n", channel_id); + return false; + } mutex.lock(); if(channel->getCaPmt() == NULL) { - printf("CCamManager: channel %llx dont have caPmt\n", id); + printf("CCamManager: channel %llx dont have caPmt\n", channel_id); mutex.unlock(); return false; } sat_iterator_t sit = satellitePositions.find(channel->getSatellitePosition()); - cammap_iterator_t it = channel_map.find(id); + cammap_iterator_t it = channel_map.find(channel_id); if(it == channel_map.end()) { cam = new CCam(); - channel_map.insert(std::pair(id, cam)); + channel_map.insert(std::pair(channel_id, cam)); } else cam = it->second; @@ -189,7 +183,7 @@ bool CCamManager::SetMode(t_channel_id id, enum runmode mode, bool start, bool f * (see CMD_SB_LOCK / UNLOCK PLAYBACK */ //channel->setCaPmt(NULL); channel->setRawPmt(NULL); - channel_map.erase(id); + channel_map.erase(channel_id); delete cam; } mutex.unlock();