Remove global allchans, use CServiceManager.

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1649 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
focus
2011-09-01 12:24:18 +00:00
parent 0cca068283
commit 28382c9aa5
7 changed files with 52 additions and 84 deletions

View File

@@ -46,8 +46,9 @@
#include <zapit/channel.h>
#include <zapit/bouquets.h>
#include <zapit/zapit.h>
#include <zapit/getservices.h>
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<65>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 );

View File

@@ -53,6 +53,7 @@
#include <ca_cs.h>
#include <zapit/cam.h>
#include <zapit/channel.h>
#include <zapit/getservices.h>
#include <zapit/client/zapittools.h>
/* 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()) {
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()) {
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()) {
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 {

View File

@@ -54,6 +54,7 @@
#include <gui/pictureviewer.h>
#include <zapit/bouquets.h>
#include <zapit/getservices.h>
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)));

View File

@@ -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"

View File

@@ -37,8 +37,8 @@
#include <zapit/client/zapitclient.h>
#include <zapit/channel.h>
#include <zapit/bouquets.h>
#include <zapit/getservices.h>
extern tallchans allchans;
extern CBouquetManager *g_bouquetManager;
extern CFrontend * frontend;
extern cVideo * videoDecoder;
@@ -205,19 +205,14 @@ 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;j<channel_names.size();j++)
{
if(channel_names[j].length() == channel_name.length() &&
equal(channel_names[j].begin(), channel_names[j].end(),
channel_name.begin(), nocase_compare)) //case insensitive compare
{
channel_id = it->second.channel_id;
for(unsigned int j=0;j<channel_names.size();j++) {
CZapitChannel * channel = CServiceManager::getInstance()->FindChannelByName(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);
}
//-------------------------------------------------------------------------

View File

@@ -28,10 +28,10 @@
#include <zapit/channel.h>
#include <zapit/bouquets.h>
#include <zapit/getservices.h>
#include <cs_api.h>
#include <system/configure_network.h>
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++) {

View File

@@ -27,9 +27,7 @@
#include <messagetools.h> /* get_length_field_size */
#include <zapit/bouquets.h>
#include <zapit/satconfig.h>
extern tallchans allchans;
extern tallchans nvodchannels;
#include <zapit/getservices.h>
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);
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id);
if(channel == NULL) {
printf("CCamManager: channel %llx not found\n", channel_id);
return false;
}
}
CZapitChannel * channel = &(cit->second);
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<t_channel_id, CCam*>(id, cam));
channel_map.insert(std::pair<t_channel_id, CCam*>(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();