mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
neutrino: add option to limit CI usage to selected bouquets;
if no bouquets selected, CI used for all channels
This commit is contained in:
@@ -282,6 +282,7 @@ ci.save_pincode Save pincode
|
||||
ci.settings Conditional access
|
||||
ci.timeout Timeout waiting CI menu ready
|
||||
ci.tuner Use CI only with tuner:
|
||||
ci.use Enable CI
|
||||
ci.waiting Waiting for CI answer
|
||||
clock_background Show background
|
||||
clock_seconds Show seconds
|
||||
|
@@ -223,7 +223,7 @@ int CBouquetList::exec( bool bShowChannelList)
|
||||
|
||||
int CBouquetList::doMenu()
|
||||
{
|
||||
int i = 0;
|
||||
int i = 0, ret = 0;
|
||||
int select = -1;
|
||||
static int old_selected = 0;
|
||||
signed int bouquet_id;
|
||||
@@ -245,13 +245,16 @@ int CBouquetList::doMenu()
|
||||
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
|
||||
|
||||
int old_epg = zapitBouquet ? zapitBouquet->bScanEpg : 0;
|
||||
int old_ci = zapitBouquet ? zapitBouquet->bUseCI : 0;
|
||||
sprintf(cnt, "%d", i);
|
||||
/* FIXME menu centered different than bouquet list ??? */
|
||||
/* provider bouquet */
|
||||
if (zapitBouquet && !zapitBouquet->bUser) {
|
||||
menu->addItem(new CMenuForwarder(LOCALE_FAVORITES_COPY, true, NULL, selector, cnt, CRCInput::RC_blue), old_selected == i ++);
|
||||
if (g_settings.epg_scan == CEpgScan::SCAN_SEL)
|
||||
if (!zapitBouquet->bWebtv && g_settings.epg_scan == CEpgScan::SCAN_SEL)
|
||||
menu->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &zapitBouquet->bScanEpg, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
|
||||
if (!zapitBouquet->bWebtv)
|
||||
menu->addItem(new CMenuOptionChooser(LOCALE_CI_USE, &zapitBouquet->bUseCI, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
|
||||
menu->exec(NULL, "");
|
||||
delete menu;
|
||||
delete selector;
|
||||
@@ -259,6 +262,21 @@ int CBouquetList::doMenu()
|
||||
if (old_epg != zapitBouquet->bScanEpg) {
|
||||
save_bouquets = true;
|
||||
CNeutrinoApp::getInstance()->MarkBouquetsChanged();
|
||||
ret = -1;
|
||||
}
|
||||
if (old_ci != zapitBouquet->bUseCI) {
|
||||
channels = &zapitBouquet->tvChannels;
|
||||
for(int li = 0; li < (int) channels->size(); li++)
|
||||
(*channels)[li]->bUseCI = zapitBouquet->bUseCI;
|
||||
|
||||
channels = &zapitBouquet->radioChannels;
|
||||
for(int li = 0; li < (int) channels->size(); li++)
|
||||
(*channels)[li]->bUseCI = zapitBouquet->bUseCI;
|
||||
|
||||
CServiceManager::getInstance()->SetCIFilter();
|
||||
save_bouquets = true;
|
||||
CNeutrinoApp::getInstance()->MarkBouquetsChanged();
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if(select >= 0) {
|
||||
@@ -304,8 +322,10 @@ int CBouquetList::doMenu()
|
||||
} else {
|
||||
/* user or satellite bouquet */
|
||||
menu->addItem(new CMenuForwarder(LOCALE_BOUQUETEDITOR_DELETE, true, NULL, selector, cnt, CRCInput::RC_red), old_selected == i ++);
|
||||
if (zapitBouquet && (g_settings.epg_scan == CEpgScan::SCAN_SEL))
|
||||
if (zapitBouquet && !zapitBouquet->bWebtv && (g_settings.epg_scan == CEpgScan::SCAN_SEL))
|
||||
menu->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &zapitBouquet->bScanEpg, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
|
||||
if (zapitBouquet && !zapitBouquet->bWebtv)
|
||||
menu->addItem(new CMenuOptionChooser(LOCALE_CI_USE, &zapitBouquet->bUseCI, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
|
||||
|
||||
menu->exec(NULL, "");
|
||||
delete menu;
|
||||
@@ -313,6 +333,21 @@ int CBouquetList::doMenu()
|
||||
if (zapitBouquet && (old_epg != zapitBouquet->bScanEpg)) {
|
||||
save_bouquets = true;
|
||||
CNeutrinoApp::getInstance()->MarkFavoritesChanged();
|
||||
ret = -1;
|
||||
}
|
||||
if (zapitBouquet && (old_ci != zapitBouquet->bUseCI)) {
|
||||
channels = &zapitBouquet->tvChannels;
|
||||
for(int li = 0; li < (int) channels->size(); li++)
|
||||
(*channels)[li]->bUseCI = zapitBouquet->bUseCI;
|
||||
|
||||
channels = &zapitBouquet->radioChannels;
|
||||
for(int li = 0; li < (int) channels->size(); li++)
|
||||
(*channels)[li]->bUseCI = zapitBouquet->bUseCI;
|
||||
|
||||
CServiceManager::getInstance()->SetCIFilter();
|
||||
save_bouquets = true;
|
||||
CNeutrinoApp::getInstance()->MarkFavoritesChanged();
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
printf("CBouquetList::doMenu: %d selected\n", select);
|
||||
@@ -342,7 +377,7 @@ int CBouquetList::doMenu()
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
const struct button_label CBouquetListButtons[4] =
|
||||
@@ -638,9 +673,19 @@ void CBouquetList::paintItem(int pos)
|
||||
if (iw && ih) {
|
||||
int icon_x = (x+width-2) - RADIUS_LARGE/2 - iw;
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_EPG, icon_x - iw, ypos, fheight);
|
||||
iw = iw + 12 + RADIUS_LARGE/2;
|
||||
iw = iw + 4 + RADIUS_LARGE/2;
|
||||
}
|
||||
}
|
||||
if (Bouquets[npos]->zapitBouquet && Bouquets[npos]->zapitBouquet->bUseCI) {
|
||||
int iw2;
|
||||
frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED2, &iw2, &ih);
|
||||
if (iw2 && ih) {
|
||||
int icon_x = (x+width-2) - RADIUS_LARGE/2 - iw - iw2 - 2;
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED2, icon_x - iw2, ypos, fheight);
|
||||
iw = iw + iw2 + 4 + RADIUS_LARGE/2;
|
||||
}
|
||||
}
|
||||
|
||||
int numpos = x+5+numwidth- g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos,ypos+fheight, numwidth+5, tmp, color, fheight);
|
||||
|
||||
|
@@ -309,6 +309,7 @@ typedef enum
|
||||
LOCALE_CI_SETTINGS,
|
||||
LOCALE_CI_TIMEOUT,
|
||||
LOCALE_CI_TUNER,
|
||||
LOCALE_CI_USE,
|
||||
LOCALE_CI_WAITING,
|
||||
LOCALE_CLOCK_BACKGROUND,
|
||||
LOCALE_CLOCK_SECONDS,
|
||||
|
@@ -309,6 +309,7 @@ const char * locale_real_names[] =
|
||||
"ci.settings",
|
||||
"ci.timeout",
|
||||
"ci.tuner",
|
||||
"ci.use",
|
||||
"ci.waiting",
|
||||
"clock_background",
|
||||
"clock_seconds",
|
||||
|
@@ -44,7 +44,8 @@ class CZapitBouquet
|
||||
bool bFav;
|
||||
bool bOther;
|
||||
int bScanEpg;
|
||||
bool bVirtual; // dont save
|
||||
bool bWebtv; // dont save
|
||||
int bUseCI;
|
||||
t_satellite_position satellitePosition;
|
||||
|
||||
ZapitChannelList radioChannels;
|
||||
@@ -59,7 +60,8 @@ class CZapitBouquet
|
||||
bUser = false;
|
||||
bOther = DEFAULT_BQ_OTHER;
|
||||
bScanEpg = DEFAULT_BQ_SCANEPG;
|
||||
bVirtual = false;
|
||||
bWebtv = false;
|
||||
bUseCI = false;
|
||||
}
|
||||
|
||||
void addService(CZapitChannel* newChannel);
|
||||
|
@@ -90,6 +90,7 @@ class CCamManager
|
||||
cammap_t channel_map;
|
||||
OpenThreads::Mutex mutex;
|
||||
int tunerno;
|
||||
bool filter_channels;
|
||||
static CCamManager * manager;
|
||||
bool SetMode(t_channel_id id, enum runmode mode, bool enable, bool force_update = false);
|
||||
void StopCam(t_channel_id id, CCam *cam);
|
||||
@@ -102,6 +103,7 @@ class CCamManager
|
||||
bool Stop(t_channel_id id, enum runmode mode) { return SetMode(id, mode, false); };
|
||||
void SetCITuner(int tuner);
|
||||
int GetCITuner(void) { return tunerno; };
|
||||
void EnableChannelFilter(bool enable) { filter_channels = enable; };
|
||||
|
||||
};
|
||||
#endif /* __capmt_h__ */
|
||||
|
@@ -191,6 +191,7 @@ class CZapitChannel
|
||||
|
||||
unsigned int bLockCount;
|
||||
bool bLocked;
|
||||
bool bUseCI;
|
||||
|
||||
int number;
|
||||
CChannelEvent currentEvent,nextEvent;
|
||||
|
@@ -178,5 +178,6 @@ class CServiceManager
|
||||
transponder_list_t & GetTransponders() { return transponders; }
|
||||
transponder_list_t & GetSatelliteTransponders(t_satellite_position position) { return satelliteTransponders[position]; }
|
||||
void KeepNumbers(bool enable) { keep_numbers = enable; };
|
||||
void SetCIFilter(void);
|
||||
};
|
||||
#endif /* __getservices_h__ */
|
||||
|
@@ -230,6 +230,7 @@ void CBouquetManager::writeBouquetHeader(FILE * bouq_fd, uint32_t i, const char
|
||||
if (Bouquets[i]->bHidden!=DEFAULT_BQ_HIDDEN) fprintf(bouq_fd, " hidden=\"%d\"", Bouquets[i]->bHidden ? 1 : 0);
|
||||
if (Bouquets[i]->bLocked!=DEFAULT_BQ_LOCKED) fprintf(bouq_fd, " locked=\"%d\"", Bouquets[i]->bLocked ? 1 : 0);
|
||||
if (Bouquets[i]->bScanEpg!=DEFAULT_BQ_SCANEPG) fprintf(bouq_fd, " epg=\"%d\"", Bouquets[i]->bScanEpg ? 1 : 0);
|
||||
if (Bouquets[i]->bUseCI) fprintf(bouq_fd, " ci=\"1\"");
|
||||
fprintf(bouq_fd, ">\n");
|
||||
}
|
||||
|
||||
@@ -272,7 +273,7 @@ void CBouquetManager::saveBouquets(void)
|
||||
for (unsigned int i = 0; i < Bouquets.size(); i++) {
|
||||
if (Bouquets[i] != remainChannels) {
|
||||
DBG("save Bouquets: name %s user: %d\n", Bouquets[i]->Name.c_str(), Bouquets[i]->bUser);
|
||||
if(!Bouquets[i]->bUser && !Bouquets[i]->bVirtual) {
|
||||
if(!Bouquets[i]->bUser && !Bouquets[i]->bWebtv) {
|
||||
writeBouquet(bouq_fd, i,false);
|
||||
}
|
||||
}
|
||||
@@ -405,10 +406,12 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
|
||||
const char* hidden = xmlGetAttribute(search, "hidden");
|
||||
const char* locked = xmlGetAttribute(search, "locked");
|
||||
const char* scanepg = xmlGetAttribute(search, "epg");
|
||||
const char* useci = xmlGetAttribute(search, "ci");
|
||||
newBouquet->bHidden = hidden ? (strcmp(hidden, "1") == 0) : false;
|
||||
newBouquet->bLocked = locked ? (strcmp(locked, "1") == 0) : false;
|
||||
newBouquet->bFav = (strcmp(name, "favorites") == 0);
|
||||
newBouquet->bScanEpg = scanepg ? (strcmp(scanepg, "1") == 0) : false;
|
||||
newBouquet->bUseCI = useci ? (strcmp(useci, "1") == 0) : false;
|
||||
channel_node = xmlChildrenNode(search);
|
||||
while ((channel_node = xmlGetNextOccurence(channel_node, "S")) != NULL) {
|
||||
std::string name2;
|
||||
@@ -444,6 +447,7 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
|
||||
if(!bUser)
|
||||
chan->pname = (char *) newBouquet->Name.c_str();
|
||||
chan->bLocked = clock;
|
||||
chan->bUseCI = newBouquet->bUseCI;
|
||||
|
||||
newBouquet->addService(chan);
|
||||
} else if (bUser) {
|
||||
@@ -495,6 +499,7 @@ void CBouquetManager::loadBouquets(bool ignoreBouquetFile)
|
||||
loadWebtv();
|
||||
parseBouquetsXml(UBOUQUETS_XML, true);
|
||||
renumServices();
|
||||
CServiceManager::getInstance()->SetCIFilter();
|
||||
TIMER_STOP("[zapit] bouquet loading took");
|
||||
}
|
||||
|
||||
@@ -813,7 +818,7 @@ void CBouquetManager::loadWebtv()
|
||||
if (!prov)
|
||||
prov = "WebTV";
|
||||
pbouquet = addBouquetIfNotExist(prov);
|
||||
pbouquet->bVirtual = true;
|
||||
pbouquet->bWebtv = true;
|
||||
|
||||
while ((xmlGetNextOccurence(l1, "webtv"))) {
|
||||
const char *title = xmlGetAttribute(l1, "title");
|
||||
@@ -829,7 +834,7 @@ void CBouquetManager::loadWebtv()
|
||||
if (genre) {
|
||||
std::string bname = prov ? std::string(std::string(prov) + " ") + genre : genre;
|
||||
gbouquet = addBouquetIfNotExist(bname);
|
||||
gbouquet->bVirtual = true;
|
||||
gbouquet->bWebtv = true;
|
||||
}
|
||||
if (title && url) {
|
||||
t_channel_id chid = create_channel_id64(0, 0, 0, 0, 0, url);
|
||||
|
@@ -171,6 +171,7 @@ CCamManager::CCamManager()
|
||||
{
|
||||
channel_map.clear();
|
||||
tunerno = -1;
|
||||
filter_channels = false;
|
||||
}
|
||||
|
||||
CCamManager::~CCamManager()
|
||||
@@ -298,6 +299,8 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
|
||||
|
||||
if (tunerno >= 0 && tunerno != cDemux::GetSource(cam->getSource()))
|
||||
INFO("CI: configured tuner %d do not match %d, skip...\n", tunerno, cam->getSource());
|
||||
else if (filter_channels && !channel->bUseCI)
|
||||
INFO("CI: filter enabled, CI not used\n");
|
||||
else
|
||||
cam->sendCaPmt(channel->getChannelID(), buffer, len, CA_SLOT_TYPE_CI);
|
||||
//list = CCam::CAPMT_MORE;
|
||||
|
@@ -99,6 +99,7 @@ void CZapitChannel::Init()
|
||||
delsys = DVB_S;
|
||||
bLockCount = 0;
|
||||
bLocked = DEFAULT_CH_LOCKED;
|
||||
bUseCI = false;
|
||||
}
|
||||
|
||||
CZapitChannel::~CZapitChannel(void)
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <zapit/getservices.h>
|
||||
#include <zapit/settings.h>
|
||||
#include <zapit/satconfig.h>
|
||||
#include <zapit/capmt.h>
|
||||
#include <xmlinterface.h>
|
||||
#include <math.h>
|
||||
#include <sys/time.h>
|
||||
@@ -1391,3 +1392,15 @@ bool CServiceManager::IsChannelTVChannel(const t_channel_id channel_id)
|
||||
ret = (channel->getServiceType() != ST_DIGITAL_RADIO_SOUND_SERVICE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CServiceManager::SetCIFilter()
|
||||
{
|
||||
bool enable = false;
|
||||
for (channel_map_iterator_t it = allchans.begin(); it != allchans.end(); ++it) {
|
||||
if (it->second.bUseCI) {
|
||||
enable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CCamManager::getInstance()->EnableChannelFilter(enable);
|
||||
}
|
||||
|
Reference in New Issue
Block a user