void CStreamInfo2::paint_techinfo(int xpos, int ypos) { char buf[100]; int xres = 0, yres = 0, aspectRatio = 0, framerate = -1; // paint labels int spaceoffset = 0,i = 0; int ypos1 = ypos; int box_width = width*2/3 - 10; yypos = ypos; if(box_h > 0) frameBuffer->paintBoxRel (0, ypos, box_width, box_h, COL_MENUHEAD_PLUS_0); CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); if(!channel) return; int array[6]={g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_RESOLUTION)), g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_ARATIO)), g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_BITRATE)), g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_FRAMERATE)), g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_AUDIOTYPE)), g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_SCANTS_FREQDATA))}; for(i=0 ; i<6; i++) { if(spaceoffset < array[i]) spaceoffset = array[i]; } spaceoffset += g_Font[font_info]->getRenderWidth(" "); average_bitrate_offset = spaceoffset; if((channel->getVideoPid() || IS_WEBTV(channel->getChannelID())) && !(videoDecoder->getBlank())){ videoDecoder->getPictureInfo(xres, yres, framerate); if (yres == 1088) yres = 1080; aspectRatio = videoDecoder->getAspectRatio(); } //Video RESOLUTION ypos += iheight; sprintf (buf, "%s:",g_Locale->getText (LOCALE_STREAMINFO_RESOLUTION)); g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_INFOBAR_TEXT); sprintf (buf, "%dx%d", xres, yres); g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); //audio rate ypos += iheight; sprintf (buf, "%s:",g_Locale->getText (LOCALE_STREAMINFO_ARATIO)); g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_INFOBAR_TEXT); switch (aspectRatio) { case 0: sprintf (buf, "N/A"); break; case 1: sprintf (buf, "4:3"); break; case 2: sprintf (buf, "14:9"); break; case 3: sprintf (buf, "16:9"); break; case 4: sprintf (buf, "20:9"); break; default: strncpy (buf, g_Locale->getText (LOCALE_STREAMINFO_ARATIO_UNKNOWN), sizeof (buf)-1); } g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); //Video FRAMERATE ypos += iheight; sprintf (buf, "%s:", g_Locale->getText (LOCALE_STREAMINFO_FRAMERATE)); g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_INFOBAR_TEXT); switch (framerate) { case 0: snprintf (buf,sizeof(buf), "23.976fps"); break; case 1: snprintf (buf,sizeof(buf), "24fps"); break; case 2: snprintf (buf,sizeof(buf), "25fps"); break; case 3: snprintf (buf,sizeof(buf), "29,976fps"); break; case 4: snprintf (buf,sizeof(buf), "30fps"); break; case 5: snprintf (buf,sizeof(buf), "50fps"); break; case 6: snprintf (buf,sizeof(buf), "50,94fps"); break; case 7: snprintf (buf,sizeof(buf), "60fps"); break; default: strncpy (buf, g_Locale->getText (LOCALE_STREAMINFO_FRAMERATE_UNKNOWN), sizeof (buf)-1); break; } g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); // place for average bitrate average_bitrate_pos = ypos += iheight; //AUDIOTYPE ypos += iheight; int type, layer, freq, mode, lbitrate; audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode); sprintf (buf, "%s:", g_Locale->getText (LOCALE_STREAMINFO_AUDIOTYPE)); g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_INFOBAR_TEXT); if(type == AUDIO_FMT_MPEG) { const int max_mode = 4; const char *mpegmodes[max_mode] = { "stereo", "joint_st", "dual_ch", "single_ch" }; sprintf (buf, "MPEG %s (%d)", (mode > max_mode) ?"unk":mpegmodes[mode], freq); } else if (type == AUDIO_FMT_DOLBY_DIGITAL || type == AUDIO_FMT_DD_PLUS) { const int max_mode = 8; const char *ddmodes[max_mode] = { "CH1/CH2", "C", "L/R", "L/C/R", "L/R/S", "L/C/R/S", "L/R/SL/SR", "L/C/R/SL/SR" }; sprintf (buf, "%s %s (%d)", (type == AUDIO_FMT_DOLBY_DIGITAL) ? "DD" : "DD+", (mode > max_mode) ?"unk": ddmodes[mode], freq); } else if (type == AUDIO_FMT_AAC || type == AUDIO_FMT_AAC_PLUS) { const int max_mode = 10; const char *aacmodes[max_mode] = { "N/S", "Mono", "L/R", "L/C/R", "L/C/R/SR/SL", "L/C/R/SR/SL/S", "L/R/RL/RR", "L/C/R/S", "L/R/SL/SR", "Dual-Mono" }; sprintf (buf, "%s %s (%d)", (type == AUDIO_FMT_AAC) ? "AAC" : "AAC+", (mode > max_mode) ?"unk":aacmodes[mode], freq); } else { sprintf (buf, "%s (%d)", g_Locale->getText(LOCALE_STREAMINFO_AUDIOTYPE_UNKNOWN), freq); } g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); if (mp) { //channel ypos += iheight; if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv) { sprintf (buf, "%s:",g_Locale->getText (LOCALE_TIMERLIST_CHANNEL));//swiped locale g_Font[font_info]->RenderString(xpos, ypos, box_width, buf , COL_INFOBAR_TEXT); sprintf(buf, "%s", channel->getName().c_str()); g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); } else { sprintf (buf, "%s:",g_Locale->getText (LOCALE_MOVIEBROWSER_INFO_FILE));//swiped locale g_Font[font_info]->RenderString(xpos, ypos, box_width, buf , COL_INFOBAR_TEXT); sprintf(buf, "%s", mp->GetFile().c_str()); g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); } scaling = 27000; } else { transponder t; t = *frontend->getParameters(); //satellite ypos += iheight; if (CFrontend::isSat(t.feparams.delsys)) sprintf (buf, "%s:",g_Locale->getText (LOCALE_SATSETUP_SATELLITE));//swiped locale else if (CFrontend::isCable(t.feparams.delsys)) sprintf (buf, "%s:",g_Locale->getText (LOCALE_CHANNELLIST_PROVS)); else if (CFrontend::isTerr(t.feparams.delsys)) snprintf (buf, sizeof(buf), "%s:",g_Locale->getText (LOCALE_TERRESTRIALSETUP_AREA)); g_Font[font_info]->RenderString(xpos, ypos, box_width, buf, COL_INFOBAR_TEXT); sprintf (buf, "%s", IS_WEBTV(channel->getChannelID()) ? g_Locale->getText(LOCALE_WEBTV_HEAD) : CServiceManager::getInstance()->GetSatelliteName(channel->getSatellitePosition()).c_str()); g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); //channel ypos += iheight; sprintf (buf, "%s:",g_Locale->getText (LOCALE_TIMERLIST_CHANNEL));//swiped locale g_Font[font_info]->RenderString(xpos, ypos, box_width, buf , COL_INFOBAR_TEXT); sprintf(buf, "%s", channel->getName().c_str()); g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); //tsfrequenz ypos += iheight; scaling = 27000; if (CFrontend::isSat(t.feparams.delsys) && t.feparams.delsys == DVB_S) scaling = 15000; sprintf (buf, "%s",g_Locale->getText (LOCALE_SCANTS_FREQDATA)); g_Font[font_info]->RenderString(xpos, ypos, box_width, buf , COL_INFOBAR_TEXT); g_Font[font_info]->RenderString(xpos+spaceoffset, ypos, box_width, t.description().c_str(), COL_INFOBAR_TEXT); // paint labels int fontW = g_Font[font_small]->getWidth(); spaceoffset = 7 * fontW; //onid ypos+= sheight; sprintf(buf, "0x%04X (%i)", channel->getOriginalNetworkId(), channel->getOriginalNetworkId()); g_Font[font_small]->RenderString(xpos, ypos, box_width, "ONid:" , COL_INFOBAR_TEXT); g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); //sid ypos+= sheight; sprintf(buf, "0x%04X (%i)", channel->getServiceId(), channel->getServiceId()); g_Font[font_small]->RenderString(xpos, ypos, box_width, "Sid:" , COL_INFOBAR_TEXT); g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); //tsid ypos+= sheight; sprintf(buf, "0x%04X (%i)", channel->getTransportStreamId(), channel->getTransportStreamId()); g_Font[font_small]->RenderString(xpos, ypos, box_width, "TSid:" , COL_INFOBAR_TEXT); g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); //pmtpid ypos+= sheight; pmt_version = channel->getPmtVersion(); sprintf(buf, "0x%04X (%i) [0x%02X]", channel->getPmtPid(), channel->getPmtPid(), pmt_version); g_Font[font_small]->RenderString(xpos, ypos, box_width, "PMTpid:", COL_INFOBAR_TEXT); g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); //vpid ypos+= sheight; if ( g_RemoteControl->current_PIDs.PIDs.vpid > 0 ){ sprintf(buf, "0x%04X (%i)", g_RemoteControl->current_PIDs.PIDs.vpid, g_RemoteControl->current_PIDs.PIDs.vpid ); } else { sprintf(buf, "%s", g_Locale->getText(LOCALE_STREAMINFO_NOT_AVAILABLE)); } g_Font[font_small]->RenderString(xpos, ypos, box_width, "Vpid:" , COL_INFOBAR_TEXT); g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); //apid ypos+= sheight; g_Font[font_small]->RenderString(xpos, ypos, box_width, "Apid(s):" , COL_INFOBAR_TEXT); if (g_RemoteControl->current_PIDs.APIDs.empty()){ sprintf(buf, "%s", g_Locale->getText(LOCALE_STREAMINFO_NOT_AVAILABLE)); } else { unsigned int sw=spaceoffset; for (unsigned int li= 0; (li<g_RemoteControl->current_PIDs.APIDs.size()) && (li<10); li++) { sprintf(buf, "0x%04X (%i)", g_RemoteControl->current_PIDs.APIDs[li].pid, g_RemoteControl->current_PIDs.APIDs[li].pid ); if (li == g_RemoteControl->current_PIDs.PIDs.selected_apid){ g_Font[font_small]->RenderString(xpos+sw, ypos, box_width, buf, COL_MENUHEAD_TEXT); } else{ g_Font[font_small]->RenderString(xpos+sw, ypos, box_width, buf, COL_INFOBAR_TEXT); } sw = g_Font[font_small]->getRenderWidth(buf)+sw+10; if (((li+1)%3 == 0) &&(g_RemoteControl->current_PIDs.APIDs.size()-1 > li)){ // if we have lots of apids, put "intermediate" line with pids ypos+= sheight; sw=spaceoffset; } } } //vtxtpid ypos += sheight; if ( g_RemoteControl->current_PIDs.PIDs.vtxtpid == 0 ) sprintf(buf, "%s", g_Locale->getText(LOCALE_STREAMINFO_NOT_AVAILABLE)); else sprintf(buf, "0x%04X (%i)", g_RemoteControl->current_PIDs.PIDs.vtxtpid, g_RemoteControl->current_PIDs.PIDs.vtxtpid ); g_Font[font_small]->RenderString(xpos, ypos, box_width, "VTXTpid:" , COL_INFOBAR_TEXT); g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT); if(box_h == 0) box_h = ypos - ypos1; yypos = ypos; paintCASystem(xpos,ypos); } }
int CStreamInfo2::doSignalStrengthLoop () { #define BAR_WIDTH 150 #define BAR_HEIGHT 12 int res = menu_return::RETURN_REPAINT; neutrino_msg_t msg; uint64_t maxb, minb, lastb, tmp_rate; unsigned int current_pmt_version= pmt_version; int cnt = 0; char tmp_str[150]; int delay_counter = 0; const int delay = 15; int offset = g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_BITRATE)); int sw = g_Font[font_info]->getRenderWidth ("99999.999"); maxb = minb = lastb = tmp_rate = 0; ts_setup (); while (1) { neutrino_msg_data_t data; uint64_t timeoutEnd = CRCInput::calcTimeoutEnd_MS (100); g_RCInput->getMsgAbsoluteTimeout (&msg, &data, &timeoutEnd); if (!mp) { signal.sig = frontend->getSignalStrength() & 0xFFFF; signal.snr = frontend->getSignalNoiseRatio() & 0xFFFF; signal.ber = frontend->getBitErrorRate(); } int ret = update_rate (); if (paint_mode == 0) { if (cnt < 12) cnt++; int dheight = g_Font[font_info]->getHeight (); int dx1 = x + 10; if(!mp && delay_counter > delay + 1){ CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); if(channel) pmt_version = channel->getPmtVersion(); if(pmt_version != current_pmt_version){ delay_counter = 0; } } if (ret && (lastb != bit_s)) { lastb = bit_s; if (maxb < bit_s) rate.max_short_average = maxb = bit_s; if ((cnt > 10) && ((minb == 0) || (minb > bit_s))) rate.min_short_average = minb = bit_s; char currate[150]; sprintf(tmp_str, "%s:",g_Locale->getText(LOCALE_STREAMINFO_BITRATE)); g_Font[font_info]->RenderString(dx1 , average_bitrate_pos, offset+10, tmp_str, COL_INFOBAR_TEXT); sprintf(currate, "%5llu.%02llu", rate.short_average / 1000ULL, rate.short_average % 1000ULL); frameBuffer->paintBoxRel (dx1 + average_bitrate_offset , average_bitrate_pos -dheight, sw, dheight, COL_MENUHEAD_PLUS_0); g_Font[font_info]->RenderString (dx1 + average_bitrate_offset , average_bitrate_pos, sw - 10, currate, COL_INFOBAR_TEXT); sprintf(tmp_str, "(%s)",g_Locale->getText(LOCALE_STREAMINFO_AVERAGE_BITRATE)); g_Font[font_info]->RenderString (dx1 + average_bitrate_offset + sw , average_bitrate_pos, sw *2, tmp_str, COL_INFOBAR_TEXT); } if (!mp) { showSNR (); if(pmt_version != current_pmt_version && delay_counter > delay){ current_pmt_version = pmt_version; paint_techinfo (x + 10, y+ hheight +5); } } delay_counter++; } rate.short_average = abit_s; if (signal.max_ber < signal.ber) signal.max_ber = signal.ber; if (signal.max_sig < signal.sig) signal.max_sig = signal.sig; if (signal.max_snr < signal.snr) signal.max_snr = signal.snr; if ((signal.min_ber == 0) || (signal.min_ber > signal.ber)) signal.min_ber = signal.ber; if ((signal.min_sig == 0) || (signal.min_sig > signal.sig)) signal.min_sig = signal.sig; if ((signal.min_snr == 0) || (signal.min_snr > signal.snr)) signal.min_snr = signal.snr; paint_signal_fe(rate, signal); signal.old_sig = signal.sig; signal.old_snr = signal.snr; signal.old_ber = signal.ber; // switch paint mode if (msg == CRCInput::RC_red || msg == CRCInput::RC_blue || msg == CRCInput::RC_green || msg == CRCInput::RC_yellow) { hide (); paint_mode = !paint_mode; paint (paint_mode); continue; } else if(msg == CRCInput::RC_setup) { res = menu_return::RETURN_EXIT_ALL; break; } else if((msg == CRCInput::RC_sat) || (msg == CRCInput::RC_favorites)) { g_RCInput->postMsg (msg, 0); res = menu_return::RETURN_EXIT_ALL; break; } else if (msg == (neutrino_msg_t) g_settings.key_screenshot) { CNeutrinoApp::getInstance ()->handleMsg (msg, data); continue; } // -- any key --> abort if (msg <= CRCInput::RC_MaxRC) break; // -- push other events if (msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout) CNeutrinoApp::getInstance ()->handleMsg (msg, data); } delete signalbox; signalbox = NULL; ts_close (); return res; }