diff --git a/src/daemonc/remotecontrol.cpp b/src/daemonc/remotecontrol.cpp index 837c41660..365ae2d16 100644 --- a/src/daemonc/remotecontrol.cpp +++ b/src/daemonc/remotecontrol.cpp @@ -50,10 +50,8 @@ #include extern CBouquetManager *g_bouquetManager; -extern CZapitChannel *g_current_channel; extern uint32_t scrambled_timer; -extern t_channel_id live_channel_id; //zapit bool sectionsd_getComponentTagsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::ComponentTagList& tags); bool sectionsd_getLinkageDescriptorsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::LinkageDescriptorList& descriptors); @@ -68,7 +66,9 @@ CSubService::CSubService(const t_original_network_id anoriginal_network_id, cons startzeit = 0; dauer = 0; subservice_name = asubservice_name; - satellitePosition = g_current_channel ? g_current_channel->getSatellitePosition() : 0; + + CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); + satellitePosition = channel ? channel->getSatellitePosition() : 0; } CSubService::CSubService(const t_original_network_id anoriginal_network_id, const t_service_id aservice_id, const t_transport_stream_id atransport_stream_id, const time_t astartzeit, const unsigned adauer) @@ -79,7 +79,9 @@ CSubService::CSubService(const t_original_network_id anoriginal_network_id, cons startzeit = astartzeit; dauer = adauer; subservice_name = ""; - satellitePosition = g_current_channel ? g_current_channel->getSatellitePosition() : 0; + + CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); + satellitePosition = channel ? channel->getSatellitePosition() : 0; } t_channel_id CSubService::getChannelID(void) const @@ -91,7 +93,7 @@ t_channel_id CSubService::getChannelID(void) const CRemoteControl::CRemoteControl() { - current_channel_id = live_channel_id; + current_channel_id = CZapit::getInstance()->GetCurrentChannelID();; current_sub_channel_id = 0; current_channel_name = ""; diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 3578c5223..4136fe42d 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include /* TODO: @@ -63,8 +64,7 @@ */ extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ -extern t_channel_id live_channel_id; -extern t_channel_id rec_channel_id; +t_channel_id rec_channel_id; bool sectionsd_getActualEPGServiceKey(const t_channel_id uniqueServiceKey, CEPGData * epgdata); bool sectionsd_getEPGidShort(event_id_t epgID, CShortEPGData * epgdata); @@ -778,6 +778,7 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons if(timeshift) autoshift = true; // mimic old behavior for start/stop menu option chooser, still actual ? + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if(eventinfo->channel_id == live_channel_id) { recordingstatus = 1; rec_channel_id = live_channel_id;//FIXME @@ -817,6 +818,7 @@ bool CRecordManager::StartAutoRecord() { printf("%s: starting to %s\n", __FUNCTION__, TimeshiftDirectory.c_str()); g_RCInput->killTimer (shift_timer); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); return Record(live_channel_id, TimeshiftDirectory.c_str(), true); } @@ -832,6 +834,7 @@ bool CRecordManager::StopAutoRecord() return false; mutex.lock(); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); CRecordInstance * inst = FindInstance(live_channel_id); if(inst && inst->Timeshift()) found = true; @@ -847,6 +850,7 @@ bool CRecordManager::StopAutoRecord() bool CRecordManager::CheckRecording(const CTimerd::RecordingInfo * const eventinfo) { + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if((eventinfo->channel_id == live_channel_id) || !SAME_TRANSPONDER(eventinfo->channel_id, live_channel_id)) StopAutoRecord(); @@ -941,6 +945,7 @@ bool CRecordManager::Stop(const t_channel_id channel_id) if(inst->Timeshift()) autoshift = false; delete inst; + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if(channel_id == live_channel_id) { recordingstatus = 0; rec_channel_id = 0;//FIXME @@ -969,6 +974,7 @@ bool CRecordManager::Stop(const CTimerd::RecordingStopInfo * recinfo) autoshift = false; delete inst; ret = true; + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if(recinfo->channel_id == live_channel_id) recordingstatus = 0; } else { @@ -1083,6 +1089,7 @@ void CRecordManager::StartTimeshift() { std::string tmode; bool res = true; + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if(RecordingStatus(live_channel_id)) { tmode = "ptimeshift"; // already recording, pause @@ -1173,6 +1180,7 @@ int CRecordManager::exec(CMenuTarget* parent, const std::string & actionKey ) }else if(actionKey == "Record") { printf("[neutrino] direct record\n"); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if(!CRecordManager::getInstance()->RecordingStatus(live_channel_id)) CRecordManager::getInstance()->Record(live_channel_id); return menu_return::RETURN_EXIT_ALL; @@ -1201,6 +1209,7 @@ bool CRecordManager::ShowMenu(void) menu.addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); // Record / Timeshift + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); bool status_ts = IsTimeshift(live_channel_id); bool status_rec = RecordingStatus(live_channel_id) && !status_ts; @@ -1339,7 +1348,8 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo if(last_mode == NeutrinoMessages::mode_standby && !recmap.size()) g_Zapit->setStandby(false); // this zap to live_channel_id - + + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); 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); @@ -1409,6 +1419,7 @@ bool CRecordManager::doGuiRecord() bool refreshGui = false; std::string recDir; + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if(recordingstatus == 1) { bool doRecord = true; #if 0 //FIXME unused ? diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index f45886146..573234bad 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #define TS_SIZE 188 @@ -45,8 +45,6 @@ //unsigned char * buf; -extern CZapitChannel *g_current_channel; -extern t_channel_id live_channel_id; extern CCam *cam0; //int demuxfd[MAXPIDS]; @@ -336,7 +334,7 @@ void * streamts_live_thread(void *data) dmx->Start(true);//FIXME - CCamManager::getInstance()->Start(live_channel_id, CCamManager::STREAM); + CCamManager::getInstance()->Start(CZapit::getInstance()->GetCurrentChannelID(), CCamManager::STREAM); ssize_t r; while (!exit_flag) { @@ -347,7 +345,7 @@ void * streamts_live_thread(void *data) printf("Exiting LIVE STREAM thread, fd %d\n", fd); - CCamManager::getInstance()->Stop(live_channel_id, CCamManager::STREAM); + CCamManager::getInstance()->Stop(CZapit::getInstance()->GetCurrentChannelID(), CCamManager::STREAM); delete dmx; free(buf); diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index b6fb54308..29cc6fc4e 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -51,12 +51,12 @@ #include extern CBouquetList * bouquetList; -extern t_channel_id live_channel_id; #include /* CZapitClient::Utf8_to_Latin1 */ #include #include +#include #include extern CPictureViewer * g_PicViewer; @@ -936,7 +936,7 @@ int CEventListHandler::exec(CMenuTarget* parent, const std::string &/*actionkey* channelList = CNeutrinoApp::getInstance()->channelList; //e->exec(channelList->getActiveChannel_ChannelID(), channelList->getActiveChannelName()); // UTF-8 //e->exec(g_Zapit->getCurrentServiceID(), channelList->getActiveChannelName()); // UTF-8 - e->exec(live_channel_id, channelList->getActiveChannelName()); // UTF-8 + e->exec(CZapit::getInstance()->GetCurrentChannelID(), channelList->getActiveChannelName()); // UTF-8 delete e; return res; diff --git a/src/gui/favorites.cpp b/src/gui/favorites.cpp index ba64fd7eb..addef994a 100644 --- a/src/gui/favorites.cpp +++ b/src/gui/favorites.cpp @@ -46,7 +46,6 @@ #include extern CBouquetList * bouquetList; /* neutrino.cpp */ -extern t_channel_id live_channel_id; extern CBouquetManager *g_bouquetManager; // // -- Add current channel to Favorites-Bouquet @@ -88,8 +87,7 @@ int CFavorites::addChannelToFavorites(bool show_list) } } - //channel_id = g_Zapit->getCurrentServiceID(); - channel_id = live_channel_id; + channel_id = CZapit::getInstance()->GetCurrentChannelID();; if(!g_bouquetManager->existsChannelInBouquet(bouquet_id, channel_id)) { CZapit::getInstance()->addChannelToBouquet(bouquet_id, channel_id); diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 97627e51f..2820a3429 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -60,6 +60,7 @@ #include #include +#include #include void sectionsd_getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventList &eList, char search = 0, std::string search_text = ""); @@ -69,8 +70,6 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern CBouquetList * bouquetList; /* neutrino.cpp */ extern CPictureViewer * g_PicViewer; extern cVideo * videoDecoder; -extern t_channel_id live_channel_id; //zapit -extern t_channel_id rec_channel_id; //zapit #define COL_INFOBAR_BUTTONS (COL_INFOBAR_SHADOW + 1) #define COL_INFOBAR_BUTTONS_BACKGROUND (COL_INFOBAR_SHADOW_PLUS_1) @@ -131,7 +130,7 @@ void CInfoViewer::Init() /* we need to calculate this only once */ info_time_width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getRenderWidth("22:22") + 10; - channel_id = live_channel_id; + channel_id = CZapit::getInstance()->GetCurrentChannelID();; lcdUpdateTimer = 0; int dummy_h; diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index c0bf44fa5..caf5035f3 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -76,6 +76,7 @@ #include #include "libtuxtxt/teletext.h" +#include //int dvbsub_start(int pid);//??? @@ -85,7 +86,6 @@ extern cVideo * videoDecoder; extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern CInfoClock *InfoClock; -extern t_channel_id live_channel_id; #define MINUTEOFFSET 117*262072 #define MP_TS_SIZE 262072 // ~0.5 sec @@ -485,6 +485,7 @@ void CMoviePlayerGui::PlayFile(void) CVCRControl::getInstance()->GetPids(&g_vpid, &g_vtype, &CAPIDSelectExec::g_currentapid, &CAPIDSelectExec::g_currentac3, &g_numpida, CAPIDSelectExec::g_apids, CAPIDSelectExec::g_ac3flags); p_movie_info = CVCRControl::getInstance()->GetMovieInfo(); #endif + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); p_movie_info = CRecordManager::getInstance()->GetMovieInfo(live_channel_id); rec_filename = CRecordManager::getInstance()->GetFileName(live_channel_id) + ".ts"; fillPids(p_movie_info); diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index 29a2f3a0b..505a1280c 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -82,7 +82,6 @@ CScanTs::CScanTs() snrscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); } -extern int scan_pids; extern int scan_fta_flag;//in zapit descriptors definiert extern int start_fast_scan(int scan_mode, int opid); #include @@ -177,7 +176,7 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) CZapitClient::ScanSatelliteList satList; CZapitClient::commandSetScanSatelliteList sat; - int _scan_pids = scan_pids; + int _scan_pids = CZapit::getInstance()->scanPids(); hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); @@ -211,7 +210,7 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) //printf("[neutrino] scan_mode %d TP_freq %s TP_rate %s TP_fec %d TP_pol %d\n", scansettings.scan_mode, scansettings.TP_freq, scansettings.TP_rate, scansettings.TP_fec, scansettings.TP_pol); if(manual) { - scan_pids = true; + CZapit::getInstance()->scanPids(true); TP.scan_mode = scansettings.scan_mode; TP.feparams.frequency = atoi(scansettings.TP_freq); if(g_info.delivery_system == DVB_S) { @@ -344,7 +343,7 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) hide(); - scan_pids = _scan_pids; + CZapit::getInstance()->scanPids(_scan_pids); videoDecoder->StopPicture(); frameBuffer->Clear(); g_Sectionsd->setPauseScanning(false); diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index ff963a583..d2ac922f0 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -56,13 +56,10 @@ #include #include -extern int scan_pids; -extern CZapitChannel *g_current_channel; extern std::map select_transponders; extern Zapit_config zapitCfg; extern char zapit_lat[20]; extern char zapit_long[20]; -extern int scan_pids; static int all_usals = 1; sat_iterator_t sit; @@ -734,7 +731,7 @@ int CScanSetup::addListFlagsItems(CMenuWidget *listflags_menu, const int &shortc CMenuOptionChooser *useNit = new CMenuOptionChooser(LOCALE_SATSETUP_USE_NIT, (int *)&scansettings.scan_mode, OPTIONS_OFF1_ON0_OPTIONS, OPTIONS_OFF1_ON0_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++)); CMenuOptionChooser *ftaFlag = new CMenuOptionChooser(LOCALE_SATSETUP_USE_FTA_FLAG, (int *)&scansettings.scan_fta_flag, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF1_ON0_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++)); - CMenuOptionChooser *scanPid = new CMenuOptionChooser(LOCALE_EXTRA_ZAPIT_SCANPIDS, &scan_pids, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++)); + CMenuOptionChooser *scanPid = new CMenuOptionChooser(LOCALE_EXTRA_ZAPIT_SCANPIDS, &zapitCfg.scanPids, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++)); listflags_menu->addItem(useNit); listflags_menu->addItem(ftaFlag); @@ -827,9 +824,10 @@ int CTPSelectHandler::exec(CMenuTarget* parent, const std::string &/*actionkey*/ break; } - if(!old_selected && g_current_channel && g_current_channel->getSatellitePosition() == position) + CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); + if(!old_selected && channel && channel->getSatellitePosition() == position) { - if(g_current_channel->getFreqId() == GET_FREQ_FROM_TPID(tI->first)) + if(channel->getFreqId() == GET_FREQ_FROM_TPID(tI->first)) old_selected = i; } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index f729b81bc..373697784 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -177,8 +177,6 @@ static pthread_t stream_thread ; //extern int zapit_ready; //static pthread_t zapit_thread ; void * zapit_main_thread(void *data); -extern t_channel_id live_channel_id; //zapit -extern CZapitChannel *g_current_channel; void * nhttpd_main_thread(void *data); static pthread_t nhttpd_thread ; @@ -1793,6 +1791,8 @@ void CNeutrinoApp::InitZapper() } if(g_settings.cacheTXT) tuxtxt_init(); + + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if(channelList->getSize() && live_channel_id) { channelList->adjustToChannelID(live_channel_id); CVFD::getInstance ()->showServicename(channelList->getActiveChannelName()); @@ -2195,11 +2195,13 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) if( (msg == NeutrinoMessages::SHOW_EPG) /* || (msg == CRCInput::RC_info) */ ) { //g_EpgData->show( g_Zapit->getCurrentServiceID() ); StopSubtitles(); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); g_EpgData->show(live_channel_id); StartSubtitles(); } else if( msg == CRCInput::RC_epg ) { StopSubtitles(); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); g_EventList->exec(live_channel_id, channelList->getActiveChannelName()); StartSubtitles(); } @@ -2315,12 +2317,14 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) } else if(msg == CRCInput::RC_rewind) { if(g_RemoteControl->is_video_started) { + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if(CRecordManager::getInstance()->RecordingStatus(live_channel_id)) CMoviePlayerGui::getInstance().exec(NULL, "rtimeshift"); } } else if( msg == CRCInput::RC_record /* || msg == CRCInput::RC_stop*/ ) { printf("[neutrino] direct record\n"); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if(!CRecordManager::getInstance()->RecordingStatus(live_channel_id)) { #if 0 // uncomment, if ChooseRecDir and g_settings.recording_choose_direct_rec_dir ever used to select recording dir CRecordManager::getInstance()->recordingstatus = 1; @@ -2456,13 +2460,14 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) StartSubtitles(!g_InfoViewer->is_visible); /* update scan settings for manual scan to current channel */ - if(g_current_channel) { - sat_iterator_t sit = satellitePositions.find(g_current_channel->getSatellitePosition()); + CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); + if(channel) { + sat_iterator_t sit = satellitePositions.find(channel->getSatellitePosition()); if(sit != satellitePositions.end()) strncpy(scanSettings.satNameNoDiseqc, sit->second.name.c_str(), 50); transponder_list_t::iterator tI; - tI = transponders.find(g_current_channel->getTransponderId()); + tI = transponders.find(channel->getTransponderId()); if(tI != transponders.end()) { sprintf(scanSettings.TP_freq, "%d", tI->second.feparams.frequency); switch (CFrontend::getInstance()->getInfo()->type) { @@ -2740,6 +2745,7 @@ _repeat: else if( msg == NeutrinoMessages::EVT_SERVICESCHANGED ) { printf("NeutrinoMessages::EVT_SERVICESCHANGED\n");fflush(stdout); channelsInit(); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); channelList->adjustToChannelID(live_channel_id);//FIXME what if deleted ? if(old_b_id >= 0) { bouquetList->activateBouquet(old_b_id, false); @@ -2750,6 +2756,7 @@ _repeat: else if( msg == NeutrinoMessages::EVT_BOUQUETSCHANGED ) { printf("NeutrinoMessages::EVT_BOUQUETSCHANGED\n");fflush(stdout); channelsInit(); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); channelList->adjustToChannelID(live_channel_id);//FIXME what if deleted ? return messages_return::handled; } @@ -3579,7 +3586,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff ) } //remember tuned channel-id - standby_channel_id = live_channel_id; + standby_channel_id = CZapit::getInstance()->GetCurrentChannelID(); puts("[neutrino.cpp] executing " NEUTRINO_ENTER_STANDBY_SCRIPT "."); if (system(NEUTRINO_ENTER_STANDBY_SCRIPT) != 0) @@ -3644,7 +3651,8 @@ void CNeutrinoApp::standbyMode( bool bOnOff ) radioMode( false ); } else { tvMode( false ); - } + } + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if(!recordingstatus) { //only switch to standby_channel_id when not recording live_channel_id = standby_channel_id; } diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 955034450..760d48416 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -28,8 +28,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -51,7 +50,6 @@ bool sectionsd_getLinkageDescriptorsUniqueKey(const event_id_t uniqueKey, CSecti bool sectionsd_getComponentTagsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::ComponentTagList& tags); extern CBouquetManager *g_bouquetManager; -extern t_channel_id live_channel_id; #define EVENTDEV "/dev/input/input0" //----------------------------------------------------------------------------- @@ -877,7 +875,7 @@ void CControlAPI::ChannellistCGI(CyhookHandler *hh) //----------------------------------------------------------------------------- std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChannel * channel) { std::string result, firstEPG, secondEPG = ""; - t_channel_id current_channel = live_channel_id; + t_channel_id current_channel = CZapit::getInstance()->GetCurrentChannelID(); int percentage = 100; std::string timestr; @@ -1025,7 +1023,7 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh) { if (hh->ParamList["1"] == "actual") { int actual = 0; for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) { - if (g_bouquetManager->existsChannelInBouquet(i, live_channel_id)) { + if (g_bouquetManager->existsChannelInBouquet(i, CZapit::getInstance()->GetCurrentChannelID())) { actual = i + 1; break; } diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index f4f3e06ef..2b61d9910 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -27,13 +27,12 @@ #include #include -#include +#include #include #include #include extern CBouquetManager *g_bouquetManager; -extern t_channel_id live_channel_id; bool sectionsd_getNVODTimesServiceKey(const t_channel_id uniqueServiceKey, CSectionsdClient::NVODTimesList& nvod_list); void sectionsd_getCurrentNextServiceKey(t_channel_id uniqueServiceKey, CSectionsdClient::responseGetCurrentNextInfoChannelID& current_next ); @@ -258,7 +257,7 @@ std::string CNeutrinoYParser::func_get_actual_bouquet_number(CyhookHandler *, s { int actual=0; for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) { - if(g_bouquetManager->existsChannelInBouquet(i, live_channel_id)) { + if(g_bouquetManager->existsChannelInBouquet(i, CZapit::getInstance()->GetCurrentChannelID())) { actual=i+1; break; } @@ -326,7 +325,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: int i = 1; char classname; - t_channel_id current_channel = live_channel_id; + t_channel_id current_channel = CZapit::getInstance()->GetCurrentChannelID(); int prozent; CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo; std::string timestr; @@ -467,7 +466,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: //------------------------------------------------------------------------- std::string CNeutrinoYParser::func_get_actual_channel_id(CyhookHandler *, std::string) { - return string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, live_channel_id /*NeutrinoAPI->Zapit->getCurrentServiceID()*/); + return string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, CZapit::getInstance()->GetCurrentChannelID()); } //------------------------------------------------------------------------- // y-func : get_mode (returns tv|radio|unknown) @@ -544,7 +543,7 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *, pids.PIDs.vpid=0; NeutrinoAPI->Zapit->getPIDS(pids); - t_channel_id current_channel = live_channel_id; //NeutrinoAPI->Zapit->getCurrentServiceID(); + t_channel_id current_channel = CZapit::getInstance()->GetCurrentChannelID(); CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo; sectionsd_getCurrentNextServiceKey(current_channel&0xFFFFFFFFFFFFULL, currentNextInfo); if (sectionsd_getComponentTagsUniqueKey(currentNextInfo.current_uniqueKey,tags)) @@ -714,7 +713,7 @@ std::string CNeutrinoYParser::func_get_current_stream_info(CyhookHandler *hh, s hh->ParamList["pmtpid"] = (serviceinfo.pmtpid != 0)?itoh(serviceinfo.pmtpid):"not available"; hh->ParamList["tsfrequency"] = string_printf("%d.%d MHz", serviceinfo.tsfrequency/1000, serviceinfo.tsfrequency%1000); hh->ParamList["polarisation"] = serviceinfo.polarisation==1?"h":"v"; - hh->ParamList["ServiceName"] = NeutrinoAPI->GetServiceName(live_channel_id);//NeutrinoAPI->Zapit->getCurrentServiceID()); + hh->ParamList["ServiceName"] = NeutrinoAPI->GetServiceName(CZapit::getInstance()->GetCurrentChannelID()); hh->ParamList["VideoFormat"] = NeutrinoAPI->getVideoResolutionAsString(); // hh->ParamList["BitRate"] = NeutrinoAPI->getVideoFramerateAsString(); hh->ParamList["AspectRatio"] = NeutrinoAPI->getVideoAspectRatioAsString(); @@ -955,7 +954,7 @@ std::string CNeutrinoYParser::func_set_timer_form(CyhookHandler *hh, std::strin hh->ParamList["timer_repeatCount"] = itoa(timer.repeatCount); // program row - t_channel_id current_channel = (cmd == "new") ? live_channel_id /*NeutrinoAPI->Zapit->getCurrentServiceID()*/ : timer.channel_id; + t_channel_id current_channel = (cmd == "new") ? CZapit::getInstance()->GetCurrentChannelID() : timer.channel_id; CBouquetManager::ChannelIterator cit = g_bouquetManager->tvChannelsBegin(); for (; !(cit.EndOfChannels()); cit++) { sel = ((*cit)->channel_id == current_channel) ? "selected=\"selected\"" : ""; diff --git a/src/zapit/src/descriptors.cpp b/src/zapit/src/descriptors.cpp index 4e623189c..cc22a9b30 100644 --- a/src/zapit/src/descriptors.cpp +++ b/src/zapit/src/descriptors.cpp @@ -49,8 +49,6 @@ std::string lastProviderName; //std::map service_types; extern CEventServer *eventServer; -extern int scan_pids; -extern t_channel_id live_channel_id; int scan_fta_flag = 0; void generic_descriptor(const unsigned char * const) @@ -655,7 +653,7 @@ void service_descriptor(const unsigned char * const buffer, const t_service_id s default: break; } - if(scan_pids) { + if(CZapit::getInstance()->scanPids()) { if(tpchange) parse_pat(); @@ -666,14 +664,12 @@ void service_descriptor(const unsigned char * const buffer, const t_service_id s // printf("[scan] Channel %s dont have A/V pids !\n", channel->getName().c_str()); if ((channel->getPreAudioPid() != 0) || (channel->getVideoPid() != 0)) { channel->setPidsFlag(); - //if(channel->getServiceType() == 1) - // live_channel_id = channel->getChannelID(); } } } } if(service_type == ST_DIGITAL_TELEVISION_SERVICE && !channel->scrambled) { - live_channel_id = channel->getChannelID(); + CZapit::getInstance()->SetCurrentChannelID(channel->getChannelID()); } } diff --git a/src/zapit/src/fastscan.cpp b/src/zapit/src/fastscan.cpp index d988e6348..cba141d73 100644 --- a/src/zapit/src/fastscan.cpp +++ b/src/zapit/src/fastscan.cpp @@ -31,9 +31,6 @@ extern CBouquetManager* scanBouquetManager; extern CZapitClient::bouquetMode bouquetMode; extern transponder_list_t transponders; // defined in zapit.cpp -extern t_channel_id live_channel_id; -extern CZapitChannel *g_current_channel; - void CServiceScan::InitFastscanLnb(int id) { CServiceManager::getInstance()->InitSatPosition(192); @@ -115,7 +112,7 @@ bool CServiceScan::ScanFast() printf("[fast scan] pid %d (HD) scan done, found %d transponders and %d services\n", op->hd_pid, found_transponders, found_channels); } - + //FIXME move to Cleanup() ? if(found_channels) { CZapitClient myZapitClient; CServiceManager::getInstance()->SaveServices(true); @@ -189,7 +186,6 @@ bool CServiceScan::ParseFst(unsigned short pid, fast_scan_operator_t * op) return false; } - g_current_channel = 0; g_bouquetManager->clearAll(); CServiceManager::getInstance()->RemoveAllChannels(); @@ -330,7 +326,7 @@ bool CServiceScan::ParseFst(unsigned short pid, fast_scan_operator_t * op) bouquet->addService(newchannel); if(newchannel->getServiceType() == 1) - live_channel_id = newchannel->getChannelID(); + CZapit::getInstance()->SetCurrentChannelID(newchannel->getChannelID()); bouquetId = g_bouquetManager->existsUBouquet(op->name); if (bouquetId == -1) { diff --git a/src/zapit/src/scan.cpp b/src/zapit/src/scan.cpp index 4319c1eff..d89e6774c 100644 --- a/src/zapit/src/scan.cpp +++ b/src/zapit/src/scan.cpp @@ -40,7 +40,6 @@ extern CBouquetManager *g_bouquetManager; extern transponder_list_t transponders; // defined in zapit.cpp -extern t_channel_id live_channel_id; extern CZapitClient::bouquetMode bouquetMode; extern int motorRotationSpeed; @@ -259,7 +258,7 @@ _repeat: #ifdef NIT_THREAD pthread_t nthread; - if(!scan_nit) + if(scan_nit) if(pthread_create(&nthread, 0, nit_thread, (void*)satellitePosition)) { ERROR("pthread_create"); nthread = 0; @@ -300,12 +299,12 @@ _repeat: stI->second.feparams.u.qpsk.fec_inner = tI->second.feparams.u.qpsk.fec_inner; #ifdef NIT_THREAD - if(!scan_nit && nthread) { + if(scan_nit && nthread) { if(pthread_join(nthread, NULL)) perror("pthread_join !!!!!!!!!"); } #else - if(!scan_nit) { + if(scan_nit) { printf("[scan] trying to parse NIT\n"); int status = parse_nit(satellitePosition, freq /*tI->second.feparams.frequency/1000*/); if(status < 0) @@ -314,7 +313,7 @@ _repeat: #endif printf("[scan] tpid ready: %llx\n", TsidOnid); } - if(!scan_nit) { + if(scan_nit) { printf("[scan] found %d transponders (%d failed) and %d channels\n", found_transponders, failed_transponders, found_channels); scantransponders.clear(); for (tI = nittransponders.begin(); tI != nittransponders.end(); tI++) { @@ -552,7 +551,7 @@ bool CServiceScan::ScanProviders() /* report status */ printf("[scan] found %d transponders (%d failed) and %d channels\n", found_transponders, failed_transponders, found_channels); - + //FIXME move to Cleanup() ? if (found_channels) { CServiceManager::getInstance()->SaveServices(true); printf("[scan] save services done\n"); fflush(stdout); @@ -567,6 +566,7 @@ bool CServiceScan::ScanProviders() } else { Cleanup(false); CFrontend::getInstance()->setTsidOnid(0); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); CZapit::getInstance()->ZapIt(live_channel_id, false); } @@ -614,6 +614,7 @@ bool CServiceScan::ScanTransponder() found_channels = 0; CZapitClient myZapitClient; + //FIXME move to Cleanup() ? if(found_channels) { CServiceManager::getInstance()->SaveServices(true); scanBouquetManager->saveBouquets(bouquetMode, providerName); @@ -627,6 +628,7 @@ bool CServiceScan::ScanTransponder() } else { Cleanup(false); CFrontend::getInstance()->setTsidOnid(0); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); CZapit::getInstance()->ZapIt(live_channel_id, false); } if(cable)