Origin commit data
------------------
Branch: ni/coolstream
Commit: d6b3754c6f
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-05-19 (Thu, 19 May 2016)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2016-05-19 22:59:54 +02:00
parent 464a234940
commit a86bc779b4
251 changed files with 26673 additions and 443 deletions

View File

@@ -59,6 +59,7 @@
#include <zapit/femanager.h>
#include <zapit/zapit.h>
#include <zapit/capmt.h> //NI
#include <video.h>
@@ -103,6 +104,22 @@ void CInfoViewerBB::Init()
fta = true;
minX = 0;
//NI init
DecEndx = 0;
decode = UNKNOWN;
camCI = false;
int CiSlots = cCA::GetInstance()->GetNumberCISlots();
int acc = 0;
while (acc < CiSlots && acc < 2) {
if (cCA::GetInstance()->ModulePresent(CA_SLOT_TYPE_CI, acc)) {
printf("CI: CAM found in Slot %i\n", acc);
camCI = true;
}
else
printf("CI: CAM not found\n");
acc++;
}
for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) {
tmp_bbButtonInfoText[i] = "";
bbButtonInfo[i].x = -1;
@@ -475,6 +492,10 @@ void CInfoViewerBB::paintshowButtonBar()
// Buttons
showBBButtons();
//NI
if (g_settings.infobar_casystem_display < 2)
paint_cam_icons();
// Icons, starting from right
showIcon_SubT();
showIcon_VTXT();
@@ -734,10 +755,10 @@ void CInfoViewerBB::paint_ca_icons(int caid, const char *icon, int &icon_space_o
int py = g_InfoViewer->BoxEndY + (g_settings.infobar_casystem_frame ? 4 : 2); /* hand-crafted, should be automatic */
int px = 0;
static map<int, std::pair<int,const char*> > icon_map;
const int icon_space = 10, icon_number = 10;
const int icon_space = 10, icon_number = 11; //NI
static int icon_offset[icon_number] = {0,0,0,0,0,0,0,0,0,0};
static int icon_sizeW [icon_number] = {0,0,0,0,0,0,0,0,0,0};
static int icon_offset[icon_number] = {0,0,0,0,0,0,0,0,0,0,0}; //NI
static int icon_sizeW [icon_number] = {0,0,0,0,0,0,0,0,0,0,0}; //NI
static bool init_flag = false;
if (!init_flag) {
@@ -745,6 +766,7 @@ void CInfoViewerBB::paint_ca_icons(int caid, const char *icon, int &icon_space_o
int icon_sizeH = 0, index = 0;
map<int, std::pair<int,const char*> >::const_iterator it;
icon_map[0x0000] = std::make_pair(index++,"dec"); //NI
icon_map[0x0E00] = std::make_pair(index++,"powervu");
icon_map[0x4A00] = std::make_pair(index++,"d");
icon_map[0x2600] = std::make_pair(index++,"biss");
@@ -757,7 +779,7 @@ void CInfoViewerBB::paint_ca_icons(int caid, const char *icon, int &icon_space_o
icon_map[0x0900] = std::make_pair(index ,"nds");
for (it=icon_map.begin(); it!=icon_map.end(); ++it) {
snprintf(buf, sizeof(buf), "%s_%s", (*it).second.second, icon);
snprintf(buf, sizeof(buf), "%s_%s", (*it).second.second, (*it).second.first==0 ? "na" : "white"); //NI
frameBuffer->getIconSize(buf, &icon_sizeW[(*it).second.first], &icon_sizeH);
}
@@ -785,7 +807,7 @@ void CInfoViewerBB::paint_ca_icons(int caid, const char *icon, int &icon_space_o
if ((px >= (endx-8)) || (px <= 0))
printf("#####[%s:%d] Error paint icon %s, px: %d, py: %d, endx: %d, icon_offset: %d\n",
__FUNCTION__, __LINE__, buf, px, py, endx, icon_offset[icon_map[caid].first]);
else
else if (strstr(buf,"dec_white") == 0) //NI
frameBuffer->paintIcon(buf, px, py);
}
}
@@ -802,11 +824,16 @@ void CInfoViewerBB::showIcon_CA_Status(int notfirst)
return;
}
int caids[] = { 0x900, 0xD00, 0xB00, 0x1800, 0x0500, 0x0100, 0x600, 0x2600, 0x4a00, 0x0E00 };
int caids[] = { 0x900, 0xD00, 0xB00, 0x1800, 0x0500, 0x0100, 0x600, 0x2600, 0x4a00, 0x0E00, 0x0000 }; //NI
const char *green = "green"; //NI
const char *white = "white";
const char *yellow = "yellow";
int icon_space_offset = 0;
//NI
const char *dec_icon_name[] = {"na","na","fta","int","card","net"};
decode = UNKNOWN;
if(!g_InfoViewer->chanready) {
if (g_settings.infobar_casystem_display == 2) {
fta = true;
@@ -838,20 +865,53 @@ void CInfoViewerBB::showIcon_CA_Status(int notfirst)
icon_space_offset = 0;
}
#endif
//NI - check ecm.info
int acaid = 0;
if (File_copy("/tmp/ecm.info", "/tmp/ecm.info.tmp")) {
g_InfoViewer->md5_ecmInfo = filehash((char *)"/tmp/ecm.info.tmp");
acaid = parse_ecmInfo("/tmp/ecm.info.tmp");
}
else
if(camCI)
decode = CARD;
//NI - map betacrypt to nagra
if((acaid & 0xFF00)== 0x1700 && (caids[3]& 0xFF00) == 0x1800)
acaid=0x1800;
for (int i = 0; i < (int)(sizeof(caids)/sizeof(int)); i++) {
//printf("caids[%i] = %X\n",i,caids[i]); //NI
bool dcaid = false; //NI
bool found = false;
for(casys_map_iterator_t it = channel->camap.begin(); it != channel->camap.end(); ++it) {
int caid = (*it) & 0xFF00;
if (caid == 0x1700)
caid = 0x0600;
if((found = (caid == caids[i])))
{
//NI
//printf(" ****** caid = %X - acaid = %X ******\n", caid, acaid & 0xFF00);
dcaid = ((caid) == (acaid & 0xFF00));
fta=false;
break;
}
}
//NI - decode info
if(i == (int)(sizeof(caids)/sizeof(int))-1) {
paint_ca_icons(caids[i], fta ? "fta" : dec_icon_name[decode], icon_space_offset);
continue;
}
if(g_settings.infobar_casystem_display == 0)
paint_ca_icons(caids[i], (found ? yellow : white), icon_space_offset);
paint_ca_icons(caids[i], (found ? (dcaid ? green : yellow) : white), icon_space_offset); //NI
else if(found)
paint_ca_icons(caids[i], yellow, icon_space_offset);
paint_ca_icons(caids[i], (dcaid ? green : yellow), icon_space_offset); //NI
}
//NI
if (camCI)
paint_cam_icons();
}
}
@@ -978,3 +1038,121 @@ void CInfoViewerBB::scrambledCheck(bool force)
scrambledNoSigSave = scrambledNoSig;
}
}
//NI CA Anzeige
void CInfoViewerBB::paint_cam_icons()
{
std::ostringstream buf;
int emu_pic_startx = g_InfoViewer->ChanInfoX + (g_settings.infobar_casystem_frame ? 20 : 10);
int py = g_InfoViewer->BoxEndY + (g_settings.infobar_casystem_frame ? 4 : 2);
const char *icon_name[] = {"mgcamd","doscam","oscam","osemu","newcs","gbox"};
static int icon_space[] = {14,14,14,14,14,14};
int icon_sizeH = 0;
int icon_sizeW = 0;
bool useCI = CCamManager::getInstance()->getUseCI();
bool filter_channels = CCamManager::getInstance()->getChannelFilter();
for (int i=0; i < (int)(sizeof(icon_name)/sizeof(icon_name[0])); i++) {
if ( getpidof(icon_name[i]) ) {
buf.str("");
buf << icon_name[i] << "_green";
if(strstr(icon_name[i], "doscam")) {
if(camCI && useCI && filter_channels) {
buf.str("");
buf << icon_name[i] << "_yellow";
}
}
frameBuffer->paintIcon(buf.str().c_str(), emu_pic_startx, py );
frameBuffer->getIconSize(buf.str().c_str(), &icon_sizeW, &icon_sizeH);
emu_pic_startx += icon_space[i];
emu_pic_startx += icon_sizeW;
}
}
if (camCI) {
if (useCI)
frameBuffer->paintIcon("ci+_green", emu_pic_startx, py);
else
frameBuffer->paintIcon("ci+_grey", emu_pic_startx, py);
}
}
//NI ecm-Info
int CInfoViewerBB::parse_ecmInfo(const char * file)
{
int acaid = 0;
char *buffer;
ssize_t read;
size_t len;
std::string ecm_txt("");
FILE *fh;
int w = 0;
int ecm_width = 0;
int ecm_height = 0;
Font * ecm_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_ECMINFO];
int font_height = ecm_font->getHeight();
buffer=NULL;
if((fh = fopen(file, "r")))
{
while ((read = getline(&buffer, &len, fh)) != -1)
{
if (g_settings.show_ecm)
{
w = ecm_font->getRenderWidth(buffer);
ecm_width = std::max(w, ecm_width);
ecm_height += font_height;
ecm_txt += buffer;
}
if ( !acaid && strstr(buffer, "0x") )
{
if(sscanf(buffer, "%*[^9-0]%x", &acaid ) == 1)
continue;
}
else if ( strstr(buffer, "source:") || //mgcamd
strstr(buffer, "decode:") || //gbox
strstr(buffer, "protocol:") || //doscam or oscam constcw
strstr(buffer, "from:")) //oscam
{
if ( strstr(buffer, "emu") || //mgcamd
strstr(buffer, "constcw") || //doscam or oscam constcw
strstr(buffer, "Internal")) //gbox
{
decode = LOCAL;
}
else if ( strstr(buffer, "slot") || //gbox
strstr(buffer, "local") || //oscam
strstr(buffer, "com"))
{
decode = CARD;
}
else if ( strstr(buffer, "net") || //mgcamd
strstr(buffer, "Network") || //gbox
strstr(buffer, ".")) //oscam
{
if ( strstr(buffer, "localhost") || strstr(buffer, "127.0.0.1"))
decode = CARD;
else
decode = REMOTE;
}
}
}
fclose(fh);
remove("/tmp/ecm.info.tmp");
if(buffer)
free(buffer);
}
if (g_settings.show_ecm)
{
if(decode == UNKNOWN || decode == NA || ecm_txt.empty()) {
g_InfoViewer->ecmInfoBox_hide();
}
else {
g_InfoViewer->ecmInfoBox_show(ecm_txt.c_str(), ecm_width, ecm_height, ecm_font);
}
}
return(acaid);
}