diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 76a862d38..22d24ceea 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1200,6 +1200,7 @@ streaminfo.aratio Verhältnis streaminfo.aratio_unknown Verhältnis: unbekannt streaminfo.audiotype Audiotyp streaminfo.audiotype_unknown Audiotyp: unbekannt +streaminfo.average_bitrate Durchschnitt streaminfo.bitrate Bitrate streaminfo.framerate Bildrate streaminfo.framerate_unknown Bildrate: unbekannt diff --git a/data/locale/english.locale b/data/locale/english.locale index 6eb7bd08c..879f7b341 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -756,6 +756,7 @@ streaminfo.aratio Aspect Ratio streaminfo.aratio_unknown Aspect Ratio: unknown streaminfo.audiotype Audiotype streaminfo.audiotype_unknown Audiotype: unknown +streaminfo.average_bitrate Average streaminfo.bitrate Bitrate streaminfo.framerate Framerate streaminfo.framerate_unknown Framerate: unknown diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 15e29fba9..6e1e6722e 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -1811,7 +1811,6 @@ void CInfoViewer::paint_ca_icons(int caid, char * icon) static char * gray = (char *) "white"; //static char * green = (char *) "green"; static char * white = (char *) "yellow"; -extern int pmt_caids[10]; void CInfoViewer::showIcon_CA_Status (int notfirst) { @@ -1822,12 +1821,13 @@ void CInfoViewer::showIcon_CA_Status (int notfirst) int acaid = 0; int py = BoxEndY - InfoHeightY_Info; #endif + extern int pmt_caids[4][11]; int i; int caids[] = { 0x1700, 0x0100, 0x0500, 0x1800, 0xB00, 0xD00, 0x900, 0x2600, 0x4a00, 0x0E00 }; if (!notfirst) { for (i=0; i < (int)(sizeof(caids)/sizeof(int)); i++) { - paint_ca_icons(caids[i], (char *) (pmt_caids[i] ? white : gray)); + paint_ca_icons(caids[i], (char *) (pmt_caids[0][i] ? white : gray)); } } } diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 04e740cf8..b57e65459 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -49,7 +49,7 @@ #include #include #include - +#include extern CFrontend * frontend; extern cVideo * videoDecoder; extern cAudio * audioDecoder; @@ -143,14 +143,12 @@ int CStreamInfo2::doSignalStrengthLoop () neutrino_msg_t msg; uint64_t maxb, minb, lastb, tmp_rate; - int cnt = 0,i=0; + int cnt = 0; uint16_t ssig, ssnr; uint32_t ber; char tmp_str[150]; - int offset_tmp = 0; int offset = g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_BITRATE)); int sw = g_Font[font_info]->getRenderWidth ("99999.999"); - int mm = g_Font[font_info]->getRenderWidth ("Max");//max min lenght maxb = minb = lastb = tmp_rate = 0; ts_setup (); while (1) { @@ -174,7 +172,6 @@ int CStreamInfo2::doSignalStrengthLoop () cnt++; int dheight = g_Font[font_info]->getHeight (); int dx1 = x + 10; - // int dy = y+ height - dheight - 5; if (ret && (lastb != bit_s)) { lastb = bit_s; @@ -182,30 +179,14 @@ int CStreamInfo2::doSignalStrengthLoop () rate.max_short_average = maxb = bit_s; if ((cnt > 10) && ((minb == 0) || (minb > bit_s))) rate.min_short_average = minb = bit_s; + sprintf(tmp_str, "%s:",g_Locale->getText(LOCALE_STREAMINFO_BITRATE)); + g_Font[font_info]->RenderString(dx1 , average_bitrate_pos, offset+10, tmp_str, COL_MENUCONTENTDARK, 0, true); + sprintf(currate, "%5llu.%02llu", rate.short_average / 1000ULL, rate.short_average % 1000ULL); + frameBuffer->paintBoxRel (dx1 + offset + 10 , average_bitrate_pos -dheight, sw, dheight, COL_MENUHEAD_PLUS_0); + g_Font[font_info]->RenderString (dx1 + offset + 15, average_bitrate_pos, sw - 10, currate, COL_MENUCONTENTDARK); + sprintf(tmp_str, "(%s)",g_Locale->getText(LOCALE_STREAMINFO_AVERAGE_BITRATE)); + g_Font[font_info]->RenderString (dx1 + offset+sw + 15, average_bitrate_pos, sw *2, tmp_str, COL_MENUCONTENTDARK); - for(i = 0; i < 3; i++){ - switch (i) { - case 0: - tmp_rate = rate.short_average; - sprintf(tmp_str, "%s", g_Locale->getText(LOCALE_STREAMINFO_BITRATE)); - offset_tmp = 0; - break; - case 1: - tmp_rate = minb; - sprintf(tmp_str, "%s", "Min"); - offset_tmp = offset+5; - break; - case 2: - tmp_rate = maxb; - sprintf(tmp_str, "%s", "Max"); - offset_tmp = offset+5+mm; - break; - } - g_Font[font_info]->RenderString (dx1+offset_tmp+((sw)*i), yypos+(dheight*4), offset, tmp_str, COL_MENUCONTENTDARK, 0, true); - sprintf(currate, "%5llu.%03llu", tmp_rate / 1000ULL, tmp_rate % 1000ULL); - frameBuffer->paintBoxRel (dx1+offset+5+((sw+mm)*i), yypos+(dheight*3), sw, dheight, COL_MENUHEAD_PLUS_0); - g_Font[font_info]->RenderString (dx1+offset+10+((sw+mm)*i), yypos+(dheight*4), sw - 10, currate, COL_MENUCONTENTDARK); - } } if(snrscale && sigscale) showSNR (); @@ -324,8 +305,9 @@ void CStreamInfo2::paint_signal_fe_box(int _x, int _y, int w, int h) else { maxmin_x = _x + 40 + xd * 3 + (fontW*4); } - g_Font[font_small]->RenderString(maxmin_x, y1 + sheight , 50, "max", COL_MENUCONTENTDARK, 0, true); - g_Font[font_small]->RenderString(maxmin_x, y1 + (sheight * 3), 50, "min", COL_MENUCONTENTDARK, 0, true); + g_Font[font_small]->RenderString(maxmin_x, y1 + sheight + 5, 50, "max", COL_MENUCONTENTDARK, 0, true); + g_Font[font_small]->RenderString(maxmin_x, y1 + (sheight * 2) +5, 50, "now", COL_MENUCONTENTDARK, 0, true); + g_Font[font_small]->RenderString(maxmin_x, y1 + (sheight * 3) +5, 50, "min", COL_MENUCONTENTDARK, 0, true); sigBox_pos = 0; @@ -535,6 +517,8 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) strncpy (buf, g_Locale->getText (LOCALE_STREAMINFO_FRAMERATE_UNKNOWN), sizeof (buf)); } g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, width*2/3 - 10, buf, COL_MENUCONTENTDARK, 0, true); // UTF-8 + // place for average bitrate + average_bitrate_pos = ypos += iheight; //AUDIOTYPE ypos += iheight; @@ -612,6 +596,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) g_Font[font_info]->RenderString(xpos+spaceoffset, ypos, width*2/3-10, buf, COL_MENUCONTENTDARK, 0, true); // UTF-8 scaling = 20000; } + // paint labels int fontW = g_Font[font_small]->getWidth(); spaceoffset = 7 * fontW; @@ -683,8 +668,207 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, width*2/3-10, buf, COL_MENUCONTENTDARK, 0, true); // UTF-8 yypos = ypos; + paintCASystem(xpos,ypos); } +void CStreamInfo2::paintCASystem(int xpos, int ypos) +{ + extern int pmt_caids[4][11]; + unsigned short i,j; + bool ecm_pid_ok = true; + std::string casys[11]={"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 }; + char tmp[100] = {0}; + int array[11] = {0}; + for(i = 0; i < 11; i++){ + array[i]=0; + array[i] = g_Font[font_info]->getRenderWidth( casys[i].c_str() ); + } + + for(j=0;j<4;j++){ + for(i=0;i<11;i++){ + if(pmt_caids[j][i] > 0 && i == 0){ + for( int k = 0; k < 4;k++){ + if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ + pmt_caids[j][i]=0; + } + } + if(pmt_caids[j][i] > 0 ) + { + snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); + casys[i] += tmp; + } + caids[i] = true; + } + else if(pmt_caids[j][i] > 0 && i == 1){ + for( int k = 0; k < 4;k++){ + if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ + pmt_caids[j][i]=0; + } + } + if(pmt_caids[j][i] > 0 ) + { + snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); + casys[i] += tmp; + } + caids[i] = true; + } + else if(pmt_caids[j][i] > 0 && i == 2){ + for( int k = 0; k < 4;k++){ + if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ + pmt_caids[j][i]=0; + } + } + if(pmt_caids[j][i] > 0 ) + { + snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); + casys[i] += tmp; + } + caids[i] = true; + } + else if(pmt_caids[j][i] > 0 && i == 3){ + for( int k = 0; k < 4;k++){ + if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ + pmt_caids[j][i]=0; + } + } + if(pmt_caids[j][i] > 0 ) + { + snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); + casys[i] += tmp; + } + caids[i] = true; + } + else if(pmt_caids[j][i] > 0 && i == 4){ + for( int k = 0; k < 4;k++){ + if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ + pmt_caids[j][i]=0; + } + } + if(pmt_caids[j][i] > 0 ) + { + snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); + casys[i] += tmp; + } + caids[i] = true; + } + else if(pmt_caids[j][i] > 0 && i == 5){ + for( int k = 0; k < 4;k++){ + if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ + pmt_caids[j][i]=0; + } + } + if(pmt_caids[j][i] > 0 ) + { + snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); + casys[i] += tmp; + } + caids[i] = true; + } + else if(pmt_caids[j][i] > 0 && i == 6){ + for( int k = 0; k < 4;k++){ + if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ + pmt_caids[j][i]=0; + } + } + if(pmt_caids[j][i] > 0 ) + { + snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); + casys[i] += tmp; + } + caids[i] = true; + } + else if(pmt_caids[j][i] > 0 && i == 7){ + for( int k = 0; k < 4;k++){ + if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ + pmt_caids[j][i]=0; + } + } + if(pmt_caids[j][i] > 0 ) + { + snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); + casys[i] += tmp; + } + caids[i] = true; + } + else if(pmt_caids[j][i] > 0 && i == 8){ + for( int k = 0; k < 4;k++){ + if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ + pmt_caids[j][i]=0; + } + } + if(pmt_caids[j][i] > 0 ) + { + snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); + casys[i] += tmp; + } + caids[i] = true; + } + else if(pmt_caids[j][i] > 0 && i == 9){ + for( int k = 0; k < 4;k++){ + if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ + pmt_caids[j][i]=0; + } + } + if(pmt_caids[j][i] > 0 ) + { + snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); + casys[i] += tmp; + } + caids[i] = true; + } + else if(pmt_caids[j][i] > 0 && i == 10){ + for( int k = 0; k < 4;k++){ + if(pmt_caids[j][i] == pmt_caids[k][i] && ( j != k)){ + pmt_caids[j][i]=0; + } + } + if(pmt_caids[j][i] > 0 ) + { + snprintf(tmp,sizeof(tmp)," 0x%04X",pmt_caids[j][i]); + casys[i] += tmp; + } + caids[i] = true; + } + ecm_pid_ok = true; + } + } + int spaceoffset = 0 ; + + for(i=0 ; i<11; i++){ + if(caids[i] == true) + if(spaceoffset < array[i]) + spaceoffset = array[i]; + } + spaceoffset+=4; + ypos += iheight*2 +4; + bool cryptsysteme = true; + for(int ca_id = 0;ca_id < 11;ca_id++){ + if(caids[ca_id] == true){ + if(cryptsysteme){ + ypos += iheight; + g_Font[font_info]->RenderString(xpos , ypos, width*2/3-10, "Cryptsysteme:" , COL_MENUCONTENTDARK, 0, false); + cryptsysteme = false; + } + ypos += sheight; + int width_txt = 0, index = 0; + const char *tok = " "; + std::string::size_type last_pos = casys[ca_id].find_first_not_of(tok, 0); + std::string::size_type pos = casys[ca_id].find_first_of(tok, last_pos); + while (std::string::npos != pos || std::string::npos != last_pos){ + g_Font[font_small]->RenderString(xpos + width_txt, ypos, width*2/3-10, casys[ca_id].substr(last_pos, pos - last_pos).c_str() , COL_MENUCONTENTDARK, 0, false); + if(index == 0) + width_txt = spaceoffset; + else + width_txt += g_Font[font_small]->getRenderWidth(casys[ca_id].substr(last_pos, pos - last_pos).c_str())+10; + index++; + last_pos = casys[ca_id].find_first_not_of(tok, pos); + pos = casys[ca_id].find_first_of(tok, last_pos); + } + } + } + +} int CStreamInfo2Handler::exec(CMenuTarget* parent, const std::string &/*actionkey*/) { int res = menu_return::RETURN_EXIT_ALL; diff --git a/src/gui/streaminfo2.h b/src/gui/streaminfo2.h index b95ed7390..d2298cc7d 100644 --- a/src/gui/streaminfo2.h +++ b/src/gui/streaminfo2.h @@ -61,6 +61,7 @@ class CStreamInfo2 : public CMenuTarget int sig_text_sig_x; int sig_text_snr_x; int sig_text_rate_x; + int average_bitrate_pos; unsigned int scaling; struct feSignal { unsigned long ber, old_ber, max_ber, min_ber; @@ -87,6 +88,7 @@ class CStreamInfo2 : public CMenuTarget void paint(int mode); void paint_pig(int x, int y, int w, int h); void paint_techinfo(int x, int y); + void paintCASystem(int xpos, int ypos); void paint_signal_fe_box(int x, int y, int w, int h); void paint_signal_fe(struct bitrate rate, struct feSignal s); int y_signal_fe(unsigned long value, unsigned long max_range, int max_y); @@ -95,7 +97,6 @@ class CStreamInfo2 : public CMenuTarget CProgressBar *snrscale; int lastsig, lastsnr; void showSNR (); - public: CStreamInfo2(); diff --git a/src/system/locals.h b/src/system/locals.h index 15aaa59e4..00982271b 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -993,6 +993,7 @@ typedef enum { LOCALE_STREAMINFO_ARATIO_UNKNOWN, LOCALE_STREAMINFO_AUDIOTYPE, LOCALE_STREAMINFO_AUDIOTYPE_UNKNOWN, + LOCALE_STREAMINFO_AVERAGE_BITRATE, LOCALE_STREAMINFO_BITRATE, LOCALE_STREAMINFO_FRAMERATE, LOCALE_STREAMINFO_FRAMERATE_UNKNOWN, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 7bf926b4f..6a096dae7 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -993,6 +993,7 @@ const char *locale_real_names[] = { "streaminfo.aratio_unknown", "streaminfo.audiotype", "streaminfo.audiotype_unknown", + "streaminfo.average_bitrate", "streaminfo.bitrate", "streaminfo.framerate", "streaminfo.framerate_unknown", diff --git a/src/zapit/src/pmt.cpp b/src/zapit/src/pmt.cpp index 33f939617..14fae328c 100644 --- a/src/zapit/src/pmt.cpp +++ b/src/zapit/src/pmt.cpp @@ -346,7 +346,7 @@ unsigned short parse_ES_info(const unsigned char * const buffer, CZapitChannel * } int curpmtpid; -int pmt_caids[10] = {0,0,0,0,0,0,0,0,0,0}; +int pmt_caids[4][11] = {{0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0}}; int parse_pmt(CZapitChannel * const channel) { @@ -358,10 +358,11 @@ int parse_pmt(CZapitChannel * const channel) unsigned char buffer[PMT_SIZE]; /* current position in buffer */ - unsigned short i; - for(i=0;i<10;i++) - pmt_caids[i] = 0; - + unsigned short i,j; + for(j=0;j<4;j++){ + for(i=0;i<10;i++) + pmt_caids[j][i] = 0; + } /* length of elementary stream description */ unsigned short ES_info_length; @@ -419,6 +420,7 @@ int parse_pmt(CZapitChannel * const channel) dpmtlen=0; pos=10; + short int ci0 = 0, ci1 = 0, ci2 = 0, ci3 = 0, ci4 = 0, ci5 = 0, ci6 = 0, ci7 = 0, ci8 = 0, ci9 = 0, ci10 = 0; if(!scan_runs) { while(pos+20) { switch(buffer[ia+2]) { - case 0x06: pmt_caids[0] = 1; - case 0x17: pmt_caids[0] = 1; + case 0x06: pmt_caids[ci0++][0] = (buffer[ia+4] & 0x1f) << 8 | buffer[ia+5]; break; - case 0x01: pmt_caids[1] = 1; + case 0x17: pmt_caids[ci1++][1] = (buffer[ia+4] & 0x1f) << 8 | buffer[ia+5]; break; - case 0x05: pmt_caids[2] = 1; + case 0x01: pmt_caids[ci2++][2] = (buffer[ia+4] & 0x1f) << 8 | buffer[ia+5]; break; - case 0x18: pmt_caids[3] = 1; + case 0x05: pmt_caids[ci3++][3] = (buffer[ia+4] & 0x1f) << 8 | buffer[ia+5]; break; - case 0x0B: pmt_caids[4] = 1; + case 0x18: pmt_caids[ci4++][4] = (buffer[ia+4] & 0x1f) << 8 | buffer[ia+5]; break; - case 0x0D: pmt_caids[5] = 1; + case 0x0B: pmt_caids[ci5++][5] = (buffer[ia+4] & 0x1f) << 8 | buffer[ia+5]; break; - case 0x09: pmt_caids[6] = 1; + case 0x0D: pmt_caids[ci6++][6] = (buffer[ia+4] & 0x1f) << 8 | buffer[ia+5]; break; - case 0x26: pmt_caids[7] = 1; + case 0x09: pmt_caids[ci7++][7] = (buffer[ia+4] & 0x1f) << 8 | buffer[ia+5]; break; - case 0x4a: pmt_caids[8] = 1; + case 0x26: pmt_caids[ci8++][8] = (buffer[ia+4] & 0x1f) << 8 | buffer[ia+5]; break; - case 0x0E: pmt_caids[9] = 1; + case 0x4a: pmt_caids[ci9++][9] = (buffer[ia+4] & 0x1f) << 8 | buffer[ia+5]; + break; + case 0x0E: pmt_caids[ci10++][10] = (buffer[ia+4] & 0x1f) << 8 | buffer[ia+5]; break; } //switch } // if