mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
gui/streaminfo2.cpp: add bitrate info for TS/webtv/file playback, based on code (C) martii
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
#include <dmx.h>
|
||||
#include <zapit/satconfig.h>
|
||||
#include <string>
|
||||
#include <system/helpers.h>
|
||||
|
||||
extern cVideo * videoDecoder;
|
||||
extern cAudio * audioDecoder;
|
||||
@@ -110,7 +111,16 @@ int CStreamInfo2::exec (CMenuTarget * parent, const std::string &)
|
||||
if (parent)
|
||||
parent->hide ();
|
||||
|
||||
if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv)
|
||||
mp = &CMoviePlayerGui::getInstance(true);
|
||||
else
|
||||
mp = &CMoviePlayerGui::getInstance();
|
||||
|
||||
if (!mp->Playing())
|
||||
mp = NULL;
|
||||
|
||||
frontend = CFEManager::getInstance()->getLiveFE();
|
||||
|
||||
paint (paint_mode);
|
||||
int res = doSignalStrengthLoop ();
|
||||
hide ();
|
||||
@@ -140,9 +150,11 @@ int CStreamInfo2::doSignalStrengthLoop ()
|
||||
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) {
|
||||
@@ -152,7 +164,7 @@ int CStreamInfo2::doSignalStrengthLoop ()
|
||||
int dheight = g_Font[font_info]->getHeight ();
|
||||
int dx1 = x + 10;
|
||||
|
||||
if(delay_counter > delay + 1){
|
||||
if(!mp && delay_counter > delay + 1){
|
||||
CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel();
|
||||
if(channel)
|
||||
pmt_version = channel->getPmtVersion();
|
||||
@@ -171,18 +183,23 @@ int CStreamInfo2::doSignalStrengthLoop ()
|
||||
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;
|
||||
@@ -256,9 +273,18 @@ void CStreamInfo2::paint_signal_fe_box(int _x, int _y, int w, int h)
|
||||
int y1;
|
||||
int xd = w/4;
|
||||
|
||||
std::string tname(g_Locale->getText(LOCALE_STREAMINFO_SIGNAL));
|
||||
tname += ": ";
|
||||
if (mp)
|
||||
tname += g_Locale->getText(LOCALE_WEBTV_HEAD);
|
||||
else
|
||||
tname += to_string(1 + frontend->getNumber()) + ": " + frontend->getName();
|
||||
|
||||
#if 0
|
||||
int tuner = 1 + frontend->getNumber();
|
||||
char tname[255];
|
||||
snprintf(tname, sizeof(tname), "%s: %d: %s", g_Locale->getText(LOCALE_STREAMINFO_SIGNAL), tuner, frontend->getName());
|
||||
#endif
|
||||
|
||||
g_Font[font_small]->RenderString(_x, _y+iheight+15, width-_x-10, tname /*tuner_name.c_str()*/, COL_INFOBAR_TEXT);
|
||||
|
||||
@@ -272,6 +298,7 @@ void CStreamInfo2::paint_signal_fe_box(int _x, int _y, int w, int h)
|
||||
int fw = g_Font[font_small]->getWidth();
|
||||
|
||||
|
||||
if (!mp) {
|
||||
frameBuffer->paintBoxRel(_x+xd*0,y1- 12,16,2, COL_RED); //red
|
||||
g_Font[font_small]->RenderString(_x+20+xd*0, y1, fw*4, "BER", COL_INFOBAR_TEXT);
|
||||
|
||||
@@ -280,6 +307,7 @@ void CStreamInfo2::paint_signal_fe_box(int _x, int _y, int w, int h)
|
||||
|
||||
frameBuffer->paintBoxRel(_x+8+xd*2,y1- 12,16,2, COL_GREEN); //green
|
||||
g_Font[font_small]->RenderString(_x+28+xd*2, y1, fw*4, "SIG", COL_INFOBAR_TEXT);
|
||||
}
|
||||
|
||||
frameBuffer->paintBoxRel(_x+xd*3,y1- 12,16,2,COL_YELLOW); // near yellow
|
||||
g_Font[font_small]->RenderString(_x+20+xd*3, y1, fw*5, "Bitrate", COL_INFOBAR_TEXT);
|
||||
@@ -326,7 +354,7 @@ void CStreamInfo2::paint_signal_fe(struct bitrate br, struct feSignal s)
|
||||
SignalRenderStr(value, sig_text_rate_x, yt + sheight);
|
||||
SignalRenderStr(br.max_short_average/ 1000ULL, sig_text_rate_x, yt);
|
||||
SignalRenderStr(br.min_short_average/ 1000ULL, sig_text_rate_x, yt + (sheight * 2));
|
||||
if ( g_RemoteControl->current_PIDs.PIDs.vpid > 0 ){
|
||||
if (mp || g_RemoteControl->current_PIDs.PIDs.vpid > 0 ){
|
||||
yd = y_signal_fe (value, scaling, sigBox_h);// Video + Audio
|
||||
} else {
|
||||
yd = y_signal_fe (value, 512, sigBox_h); // Audio only
|
||||
@@ -340,6 +368,7 @@ void CStreamInfo2::paint_signal_fe(struct bitrate br, struct feSignal s)
|
||||
old_y = sigBox_y+sigBox_h-yd;
|
||||
}
|
||||
|
||||
if (!mp) {
|
||||
if (s.ber != s.old_ber) {
|
||||
SignalRenderStr(s.ber, sig_text_ber_x, yt + sheight);
|
||||
SignalRenderStr(s.max_ber, sig_text_ber_x, yt);
|
||||
@@ -365,6 +394,7 @@ void CStreamInfo2::paint_signal_fe(struct bitrate br, struct feSignal s)
|
||||
}
|
||||
yd = y_signal_fe (s.snr, 65000, sigBox_h);
|
||||
frameBuffer->paintPixel(sigBox_x+x_now, sigBox_y+sigBox_h-yd, COL_BLUE); //blue
|
||||
}
|
||||
}
|
||||
|
||||
// -- calc y from max_range and max_y
|
||||
@@ -454,10 +484,6 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
|
||||
if(!channel)
|
||||
return;
|
||||
|
||||
transponder t;
|
||||
//CServiceManager::getInstance()->GetTransponder(channel->getTransponderId(), t);
|
||||
t = *frontend->getParameters();
|
||||
|
||||
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)),
|
||||
@@ -589,6 +615,26 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
|
||||
}
|
||||
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))
|
||||
@@ -696,6 +742,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
|
||||
box_h = ypos - ypos1;
|
||||
yypos = ypos;
|
||||
paintCASystem(xpos,ypos);
|
||||
}
|
||||
}
|
||||
|
||||
#define NUM_CAIDS 11
|
||||
@@ -829,13 +876,18 @@ int CStreamInfo2::ts_setup ()
|
||||
if (g_RemoteControl->current_PIDs.PIDs.vpid == 0)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
short ret = -1;
|
||||
if (mp) {
|
||||
mp->GetReadCount();
|
||||
} else {
|
||||
|
||||
unsigned short vpid, apid = 0;
|
||||
|
||||
vpid = g_RemoteControl->current_PIDs.PIDs.vpid;
|
||||
if( !g_RemoteControl->current_PIDs.APIDs.empty() )
|
||||
apid = g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].pid;
|
||||
|
||||
short ret = -1;
|
||||
if(vpid == 0 && apid == 0)
|
||||
return ret;
|
||||
|
||||
@@ -861,6 +913,7 @@ int CStreamInfo2::ts_setup ()
|
||||
dmx->pesFilter(apid);
|
||||
|
||||
dmx->Start(true);
|
||||
}
|
||||
|
||||
gettimeofday (&first_tv, NULL);
|
||||
last_tv.tv_sec = first_tv.tv_sec;
|
||||
@@ -872,13 +925,19 @@ int CStreamInfo2::ts_setup ()
|
||||
int CStreamInfo2::update_rate ()
|
||||
{
|
||||
|
||||
if(!dmx)
|
||||
return 0;
|
||||
|
||||
int ret = 0;
|
||||
int timeout = 100;
|
||||
int b_len;
|
||||
|
||||
int b_len = dmx->Read(dmxbuf, TS_BUF_SIZE, timeout);
|
||||
if(!dmx && !mp)
|
||||
return 0;
|
||||
|
||||
if (mp) {
|
||||
usleep(timeout * 1000);
|
||||
b_len = mp->GetReadCount();
|
||||
} else {
|
||||
b_len = dmx->Read(dmxbuf, TS_BUF_SIZE, timeout);
|
||||
}
|
||||
//printf("ts: read %d\n", b_len);
|
||||
|
||||
long b = b_len;
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <driver/framebuffer.h>
|
||||
#include <gui/components/cc.h>
|
||||
#include <gui/movieplayer.h>
|
||||
#include <zapit/femanager.h>
|
||||
|
||||
|
||||
@@ -37,6 +38,7 @@ class CStreamInfo2 : public CMenuTarget
|
||||
CFrameBuffer *frameBuffer;
|
||||
CFrontend *frontend;
|
||||
CComponentsPIP * pip;
|
||||
CMoviePlayerGui *mp;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
|
Reference in New Issue
Block a user