streaminfo2.cpp: add frontend class member;

show tuner number with name;
use channel ca sys map in place of global pmt_caids;
simplify paintCASystem
This commit is contained in:
[CST] Focus
2012-01-13 15:31:05 +04:00
parent 9a2c303348
commit 71bca85637
2 changed files with 98 additions and 186 deletions

View File

@@ -40,17 +40,18 @@
#include <gui/widget/icons.h> #include <gui/widget/icons.h>
#include <gui/customcolor.h> #include <gui/customcolor.h>
#include <daemonc/remotecontrol.h> #include <daemonc/remotecontrol.h>
#include <zapit/frontend_c.h> #include <zapit/zapit.h>
#include <zapit/getservices.h>
#include <video.h> #include <video.h>
#include <audio.h> #include <audio.h>
#include <dmx.h> #include <dmx.h>
#include <zapit/satconfig.h> #include <zapit/satconfig.h>
#include <string> #include <string>
extern cVideo * videoDecoder; extern cVideo * videoDecoder;
extern cAudio * audioDecoder; extern cAudio * audioDecoder;
extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */
extern CZapitClient::SatelliteList satList;
#if 0 #if 0
extern CPipSetup * g_Pip0; extern CPipSetup * g_Pip0;
@@ -115,6 +116,7 @@ int CStreamInfo2::exec (CMenuTarget * parent, const std::string &)
if (parent) if (parent)
parent->hide (); parent->hide ();
frontend = CFEManager::getInstance()->getLiveFE();
paint (paint_mode); paint (paint_mode);
int res = doSignalStrengthLoop (); int res = doSignalStrengthLoop ();
hide (); hide ();
@@ -150,9 +152,9 @@ int CStreamInfo2::doSignalStrengthLoop ()
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd_MS (100); uint64_t timeoutEnd = CRCInput::calcTimeoutEnd_MS (100);
g_RCInput->getMsgAbsoluteTimeout (&msg, &data, &timeoutEnd); g_RCInput->getMsgAbsoluteTimeout (&msg, &data, &timeoutEnd);
ssig = CFrontend::getInstance()->getSignalStrength(); ssig = frontend->getSignalStrength();
ssnr = CFrontend::getInstance()->getSignalNoiseRatio(); ssnr = frontend->getSignalNoiseRatio();
ber = CFrontend::getInstance()->getBitErrorRate(); ber = frontend->getBitErrorRate();
signal.sig = ssig & 0xFFFF; signal.sig = ssig & 0xFFFF;
signal.snr = ssnr & 0xFFFF; signal.snr = ssnr & 0xFFFF;
@@ -246,6 +248,10 @@ int CStreamInfo2::doSignalStrengthLoop ()
res = menu_return::RETURN_EXIT_ALL; res = menu_return::RETURN_EXIT_ALL;
break; break;
} }
else if (msg == (neutrino_msg_t) g_settings.key_screenshot) {
CNeutrinoApp::getInstance ()->handleMsg (msg, data);
continue;
}
// -- any key --> abort // -- any key --> abort
if (msg <= CRCInput::RC_MaxRC) { if (msg <= CRCInput::RC_MaxRC) {
@@ -285,10 +291,12 @@ void CStreamInfo2::paint_signal_fe_box(int _x, int _y, int w, int h)
{ {
int y1; int y1;
int xd = w/4; int xd = w/4;
std::string tuner_name = g_Locale->getText(LOCALE_STREAMINFO_SIGNAL);
tuner_name += ": "; int tuner = 1 + frontend->getNumber();
tuner_name += CFrontend::getInstance()->getInfo()->name; char tname[255];
g_Font[font_small]->RenderString(_x, _y+iheight+15, width-10, tuner_name.c_str(), COL_INFOBAR, 0, true); snprintf(tname, sizeof(tname), "%s: %d: %s", g_Locale->getText(LOCALE_STREAMINFO_SIGNAL), tuner, frontend->getInfo()->name);
g_Font[font_small]->RenderString(_x, _y+iheight+15, width-10, tname /*tuner_name.c_str()*/, COL_INFOBAR, 0, true);
sigBox_x = _x; sigBox_x = _x;
sigBox_y = _y+iheight+15; sigBox_y = _y+iheight+15;
@@ -602,19 +610,20 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
//satellite //satellite
t_satellite_position satellitePosition = CNeutrinoApp::getInstance ()->channelList->getActiveSatellitePosition (); t_satellite_position satellitePosition = CNeutrinoApp::getInstance ()->channelList->getActiveSatellitePosition ();
sat_iterator_t sit = satellitePositions.find(satellitePosition);
if(sit != satellitePositions.end()) { ypos += iheight;
ypos += iheight; if(frontend->getInfo()->type == FE_QPSK) {
if(CFrontend::getInstance()->getInfo()->type == FE_QPSK) { sprintf ((char *) buf, "%s:",g_Locale->getText (LOCALE_SATSETUP_SATELLITE));//swiped locale
sprintf ((char *) buf, "%s:",g_Locale->getText (LOCALE_SATSETUP_SATELLITE));//swiped locale
}
else if(CFrontend::getInstance()->getInfo()->type == FE_QAM) {
sprintf ((char *) buf, "%s:",g_Locale->getText (LOCALE_CHANNELLIST_PROVS));
}
g_Font[font_info]->RenderString(xpos, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8
sprintf ((char *) buf, "%s", sit->second.name.c_str());
g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8
} }
else if(frontend->getInfo()->type == FE_QAM) {
sprintf ((char *) buf, "%s:",g_Locale->getText (LOCALE_CHANNELLIST_PROVS));
}
g_Font[font_info]->RenderString(xpos, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8
sprintf ((char *) buf, "%s",
CServiceManager::getInstance()->GetSatelliteName(satellitePosition).c_str());
g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8
CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList; CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList;
// int curnum = channelList->getActiveChannelNumber(); // int curnum = channelList->getActiveChannelNumber();
// CZapitChannel * channel = channelList->getChannel(curnum); // CZapitChannel * channel = channelList->getChannel(curnum);
@@ -629,8 +638,8 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
//tsfrequenz //tsfrequenz
ypos += iheight; ypos += iheight;
char * f=NULL, *s=NULL, *m=NULL; char * f=NULL, *s=NULL, *m=NULL;
if(CFrontend::getInstance()->getInfo()->type == FE_QPSK) { if(frontend->getInfo()->type == FE_QPSK) {
CFrontend::getInstance()->getDelSys((fe_code_rate_t)si.fec, dvbs_get_modulation((fe_code_rate_t)si.fec), f, s, m); frontend->getDelSys((fe_code_rate_t)si.fec, dvbs_get_modulation((fe_code_rate_t)si.fec), f, s, m);
if (!strncmp(s,const_cast<char *>("DVB-S2"),6)){ if (!strncmp(s,const_cast<char *>("DVB-S2"),6)){
s=const_cast<char *>("S2"); s=const_cast<char *>("S2");
scaling = 27000; scaling = 27000;
@@ -643,7 +652,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
g_Font[font_info]->RenderString(xpos, ypos, box_width, "Tp. Freq.:" , COL_INFOBAR, 0, true); // UTF-8 g_Font[font_info]->RenderString(xpos, ypos, box_width, "Tp. Freq.:" , COL_INFOBAR, 0, true); // UTF-8
g_Font[font_info]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8 g_Font[font_info]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8
} }
else if(CFrontend::getInstance()->getInfo()->type == FE_QAM) { else if(frontend->getInfo()->type == FE_QAM) {
sprintf ((char *) buf, "%s",g_Locale->getText (LOCALE_SCANTS_FREQDATA)); sprintf ((char *) buf, "%s",g_Locale->getText (LOCALE_SCANTS_FREQDATA));
g_Font[font_info]->RenderString(xpos, ypos, box_width, buf , COL_INFOBAR, 0, true); // UTF-8 g_Font[font_info]->RenderString(xpos, ypos, box_width, buf , COL_INFOBAR, 0, true); // UTF-8
sprintf((char*) buf, "%d.%d MHz", si.tsfrequency/1000, si.tsfrequency%1000); sprintf((char*) buf, "%d.%d MHz", si.tsfrequency/1000, si.tsfrequency%1000);
@@ -728,187 +737,88 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
paintCASystem(xpos,ypos); paintCASystem(xpos,ypos);
} }
#define NUM_CAIDS 11
void CStreamInfo2::paintCASystem(int xpos, int ypos) void CStreamInfo2::paintCASystem(int xpos, int ypos)
{ {
extern int pmt_caids[4][11]; unsigned short i, ypos1 = 0;
unsigned short i,j, ypos1 = 0;
int box_width = width*2/3-10; int box_width = width*2/3-10;
if(box_h2 > 0) if(box_h2 > 0)
{ {
frameBuffer->paintBoxRel (0, ypos+(iheight*2), box_width, box_h2, COL_MENUHEAD_PLUS_0); frameBuffer->paintBoxRel (0, ypos+(iheight*2), box_width, box_h2, COL_MENUHEAD_PLUS_0);
} }
std::string casys[11]={"Irdeto:","Betacrypt:","Seca:","Viaccess:","Nagra:","Conax: ","Cryptoworks:","Videoguard:","EBU:","XCrypt:","PowerVU:"}; std::string casys[NUM_CAIDS]={"Irdeto:","Betacrypt:","Seca:","Viaccess:","Nagra:","Conax: ","Cryptoworks:","Videoguard:","EBU:","XCrypt:","PowerVU:"};
bool caids[11] ={ false, false, false, false, false, false, false, false, false, false, false }; bool caids[NUM_CAIDS];
char tmp[100] = {0}; int array[NUM_CAIDS];
int array[11] = {0}; char tmp[100];
for(i = 0; i < 11; i++){
array[i]=0; CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel();
array[i] = g_Font[font_info]->getRenderWidth( casys[i].c_str() ); if(!channel)
return;
for(i = 0; i < NUM_CAIDS; i++) {
array[i] = g_Font[font_info]->getRenderWidth(casys[i].c_str());
caids[i] = false;
} }
for(j=0;j<4;j++){ int spaceoffset = 0;
for(i=0;i<11;i++){
if(pmt_caids[j][i] > 1 && i == 0){ for(casys_map_iterator_t it = channel->camap.begin(); it != channel->camap.end(); ++it) {
for( int k = 0; k < 4;k++){ int idx = -1;
if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ switch(((*it) >> 8) & 0xFF) {
pmt_caids[j][i]=1; case 0x06:
} idx = 0;
} break;
if(pmt_caids[j][i] > 1 ) case 0x17:
{ idx = 1;
snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); break;
casys[i] += tmp; case 0x01:
} idx = 2;
caids[i] = true; break;
} case 0x05:
else if(pmt_caids[j][i] > 1 && i == 1){ idx = 3;
for( int k = 0; k < 4;k++){ break;
if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ case 0x18:
pmt_caids[j][i]=1; idx = 4;
} break;
} case 0x0B:
if(pmt_caids[j][i] > 1 ) idx = 5;
{ break;
snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); case 0x0D:
casys[i] += tmp; idx = 6;
} break;
caids[i] = true; case 0x09:
} idx = 7;
else if(pmt_caids[j][i] > 1 && i == 2){ break;
for( int k = 0; k < 4;k++){ case 0x26:
if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ idx = 8;
pmt_caids[j][i]=1; break;
} case 0x4a:
} idx = 9;
if(pmt_caids[j][i] > 1 ) break;
{ case 0x0E:
snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); idx = 10;
casys[i] += tmp; break;
} default:
caids[i] = true; break;
} }
else if(pmt_caids[j][i] > 1 && i == 3){ if(idx >= 0) {
for( int k = 0; k < 4;k++){ snprintf(tmp, sizeof(tmp)," 0x%04X", (*it));
if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ casys[idx] += tmp;
pmt_caids[j][i]=1; caids[idx] = true;
} if(spaceoffset < array[idx])
} spaceoffset = array[idx];
if(pmt_caids[j][i] > 1 )
{
snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]);
casys[i] += tmp;
}
caids[i] = true;
}
else if(pmt_caids[j][i] > 1 && i == 4){
for( int k = 0; k < 4;k++){
if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){
pmt_caids[j][i]=1;
}
}
if(pmt_caids[j][i] > 1 )
{
snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]);
casys[i] += tmp;
}
caids[i] = true;
}
else if(pmt_caids[j][i] > 1 && i == 5){
for( int k = 0; k < 4;k++){
if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){
pmt_caids[j][i]=1;
}
}
if(pmt_caids[j][i] > 1 )
{
snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]);
casys[i] += tmp;
}
caids[i] = true;
}
else if(pmt_caids[j][i] > 1 && i == 6){
for( int k = 0; k < 4;k++){
if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){
pmt_caids[j][i]=1;
}
}
if(pmt_caids[j][i] > 1 )
{
snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]);
casys[i] += tmp;
}
caids[i] = true;
}
else if(pmt_caids[j][i] > 1 && i == 7){
for( int k = 0; k < 4;k++){
if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){
pmt_caids[j][i]=1;
}
}
if(pmt_caids[j][i] > 1 )
{
snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]);
casys[i] += tmp;
}
caids[i] = true;
}
else if(pmt_caids[j][i] > 1 && i == 8){
for( int k = 0; k < 4;k++){
if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){
pmt_caids[j][i]=1;
}
}
if(pmt_caids[j][i] > 1 )
{
snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]);
casys[i] += tmp;
}
caids[i] = true;
}
else if(pmt_caids[j][i] > 1 && i == 9){
for( int k = 0; k < 4;k++){
if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){
pmt_caids[j][i]=1;
}
}
if(pmt_caids[j][i] > 1 )
{
snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]);
casys[i] += tmp;
}
caids[i] = true;
}
else if(pmt_caids[j][i] > 1 && i == 10){
for( int k = 0; k < 4;k++){
if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){
pmt_caids[j][i]=1;
}
}
if(pmt_caids[j][i] > 1 )
{
snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]);
casys[i] += tmp;
}
caids[i] = true;
}
} }
} }
int spaceoffset = 0 ;
for(i=0 ; i<11; i++){
if(caids[i] == true)
if(spaceoffset < array[i])
spaceoffset = array[i];
}
spaceoffset+=4; spaceoffset+=4;
ypos += iheight*2; ypos += iheight*2;
bool cryptsysteme = true; bool cryptsysteme = true;
for(int ca_id = 0;ca_id < 11;ca_id++){ for(int ca_id = 0; ca_id < NUM_CAIDS; ca_id++){
if(caids[ca_id] == true){ if(caids[ca_id] == true){
if(cryptsysteme){ if(cryptsysteme){
ypos += iheight; ypos += iheight;
g_Font[font_info]->RenderString(xpos , ypos, box_width, "Cryptsysteme:" , COL_INFOBAR, 0, false); g_Font[font_info]->RenderString(xpos , ypos, box_width, "Conditional access:" , COL_INFOBAR, 0, false);
cryptsysteme = false; cryptsysteme = false;
} }
ypos += sheight; ypos += sheight;

View File

@@ -27,6 +27,7 @@
#include <driver/framebuffer.h> #include <driver/framebuffer.h>
#include <gui/widget/progressbar.h> #include <gui/widget/progressbar.h>
#include <zapit/femanager.h>
class CStreamInfo2 : public CMenuTarget class CStreamInfo2 : public CMenuTarget
@@ -34,6 +35,7 @@ class CStreamInfo2 : public CMenuTarget
private: private:
CFrameBuffer *frameBuffer; CFrameBuffer *frameBuffer;
CFrontend *frontend;
int x; int x;
int y; int y;
int width; int width;