gui/streaminfo2.cpp: add bitrate info for TS/webtv/file playback, based on code (C) martii

This commit is contained in:
[CST] Focus
2015-10-29 17:42:56 +03:00
parent 3feba2b40d
commit 891c0fe8d0
2 changed files with 234 additions and 173 deletions

View File

@@ -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);
signal.sig = frontend->getSignalStrength() & 0xFFFF;
signal.snr = frontend->getSignalNoiseRatio() & 0xFFFF;
signal.ber = frontend->getBitErrorRate();
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,17 +183,22 @@ 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);
}
showSNR ();
if(pmt_version != current_pmt_version && delay_counter > delay){
current_pmt_version = pmt_version;
paint_techinfo (x + 10, y+ hheight +5);
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++;
}
@@ -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,14 +298,16 @@ void CStreamInfo2::paint_signal_fe_box(int _x, int _y, int w, int h)
int fw = g_Font[font_small]->getWidth();
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);
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);
frameBuffer->paintBoxRel(_x+xd*1,y1- 12,16,2,COL_BLUE); //blue
g_Font[font_small]->RenderString(_x+20+xd*1, y1, fw*4, "SNR", COL_INFOBAR_TEXT);
frameBuffer->paintBoxRel(_x+xd*1,y1- 12,16,2,COL_BLUE); //blue
g_Font[font_small]->RenderString(_x+20+xd*1, y1, fw*4, "SNR", COL_INFOBAR_TEXT);
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+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,31 +368,33 @@ void CStreamInfo2::paint_signal_fe(struct bitrate br, struct feSignal s)
old_y = sigBox_y+sigBox_h-yd;
}
if (s.ber != s.old_ber) {
SignalRenderStr(s.ber, sig_text_ber_x, yt + sheight);
SignalRenderStr(s.max_ber, sig_text_ber_x, yt);
SignalRenderStr(s.min_ber, sig_text_ber_x, yt + (sheight * 2));
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);
SignalRenderStr(s.min_ber, sig_text_ber_x, yt + (sheight * 2));
}
yd = y_signal_fe (s.ber, 4000, sigBox_h);
frameBuffer->paintPixel(sigBox_x+x_now, sigBox_y+sigBox_h-yd, COL_RED); //red
if (s.sig != s.old_sig) {
SignalRenderStr(s.sig, sig_text_sig_x, yt + sheight);
SignalRenderStr(s.max_sig, sig_text_sig_x, yt);
SignalRenderStr(s.min_sig, sig_text_sig_x, yt + (sheight * 2));
}
yd = y_signal_fe (s.sig, 65000, sigBox_h);
frameBuffer->paintPixel(sigBox_x+x_now, sigBox_y+sigBox_h-yd, COL_GREEN); //green
if (s.snr != s.old_snr) {
SignalRenderStr(s.snr, sig_text_snr_x, yt + sheight);
SignalRenderStr(s.max_snr, sig_text_snr_x, yt);
SignalRenderStr(s.min_snr, sig_text_snr_x, yt + (sheight * 2));
}
yd = y_signal_fe (s.snr, 65000, sigBox_h);
frameBuffer->paintPixel(sigBox_x+x_now, sigBox_y+sigBox_h-yd, COL_BLUE); //blue
}
yd = y_signal_fe (s.ber, 4000, sigBox_h);
frameBuffer->paintPixel(sigBox_x+x_now, sigBox_y+sigBox_h-yd, COL_RED); //red
if (s.sig != s.old_sig) {
SignalRenderStr(s.sig, sig_text_sig_x, yt + sheight);
SignalRenderStr(s.max_sig, sig_text_sig_x, yt);
SignalRenderStr(s.min_sig, sig_text_sig_x, yt + (sheight * 2));
}
yd = y_signal_fe (s.sig, 65000, sigBox_h);
frameBuffer->paintPixel(sigBox_x+x_now, sigBox_y+sigBox_h-yd, COL_GREEN); //green
if (s.snr != s.old_snr) {
SignalRenderStr(s.snr, sig_text_snr_x, yt + sheight);
SignalRenderStr(s.max_snr, sig_text_snr_x, yt);
SignalRenderStr(s.min_snr, sig_text_snr_x, yt + (sheight * 2));
}
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,113 +615,134 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
}
g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);
//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));
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);
}
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 );
scaling = 27000;
} 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;
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);
//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);
}
}
#define NUM_CAIDS 11
@@ -829,38 +876,44 @@ int CStreamInfo2::ts_setup ()
if (g_RemoteControl->current_PIDs.PIDs.vpid == 0)
return -1;
#endif
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;
if (mp) {
mp->GetReadCount();
} else {
dmx = new cDemux(0);
if(!dmx)
return ret;
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;
if(vpid == 0 && apid == 0)
return ret;
dmx = new cDemux(0);
if(!dmx)
return ret;
#define TS_LEN 188
#define TS_BUF_SIZE (TS_LEN * 2048) /* fix dmx buffer size */
dmxbuf = new unsigned char[TS_BUF_SIZE];
if(!dmxbuf){
delete dmx;
dmx = NULL;
return ret;
dmxbuf = new unsigned char[TS_BUF_SIZE];
if(!dmxbuf){
delete dmx;
dmx = NULL;
return ret;
}
dmx->Open(DMX_TP_CHANNEL, NULL, 3 * 3008 * 62);
if(vpid > 0) {
dmx->pesFilter(vpid);
if(apid > 0)
dmx->addPid(apid);
} else
dmx->pesFilter(apid);
dmx->Start(true);
}
dmx->Open(DMX_TP_CHANNEL, NULL, 3 * 3008 * 62);
if(vpid > 0) {
dmx->pesFilter(vpid);
if(apid > 0)
dmx->addPid(apid);
} else
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;

View File

@@ -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;