Conflicts:
	src/gui/channellist.cpp


Origin commit data
------------------
Branch: ni/coolstream
Commit: fca2de73e7
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-04-11 (Tue, 11 Apr 2017)



------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-04-11 23:14:03 +02:00
3 changed files with 35 additions and 337 deletions

View File

@@ -1,65 +0,0 @@
static unsigned char click[] = {
0xE5, 0xF5, 0xFF, 0xF7, 0x18, 0xFA, 0x7F, 0xFB, 0x98, 0xFD, 0xFF, 0xFE, 0x17, 0x01, 0x31, 0x03,
0x4A, 0x05, 0xB1, 0x06, 0xCA, 0x08, 0xCA, 0x0F, 0xCA, 0x16, 0x97, 0x12, 0x17, 0x0F, 0xFE, 0x13,
0xE4, 0x18, 0x7E, 0x17, 0x17, 0x16, 0x64, 0x15, 0x64, 0x15, 0xE4, 0x18, 0x17, 0x1D, 0xCA, 0x1D,
0x7E, 0x1E, 0xCA, 0x24, 0x17, 0x2B, 0xE4, 0x26, 0x64, 0x23, 0x31, 0x2D, 0xFE, 0x36, 0x7E, 0x33,
0xB1, 0x30, 0x17, 0x32, 0x7E, 0x33, 0x64, 0x2A, 0x4A, 0x21, 0x64, 0x15, 0x7E, 0x09, 0x97, 0x04,
0xB2, 0xFF, 0xB2, 0xF1, 0xB2, 0xE3, 0xFF, 0xE2, 0x4B, 0xE2, 0x32, 0xD9, 0xCB, 0xD0, 0x7F, 0xD1,
0xE5, 0xD2, 0x18, 0xD0, 0x4B, 0xCD, 0x65, 0xC8, 0x7F, 0xC3, 0xCB, 0xC2, 0x18, 0xC2, 0x18, 0xC2,
0x18, 0xC2, 0x18, 0xC2, 0x18, 0xC2, 0x18, 0xC2, 0x18, 0xC2, 0x18, 0xC2, 0x18, 0xC2, 0xCB, 0xC2,
0x7F, 0xC3, 0x18, 0xC9, 0xB2, 0xCE, 0xFF, 0xD4, 0x4B, 0xDB, 0x4B, 0xE2, 0x4B, 0xE9, 0xE5, 0xEE,
0x32, 0xF5, 0x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 0x06, 0x17, 0x0F, 0x7E, 0x17, 0xE4, 0x1F, 0x31, 0x26,
0x31, 0x2D, 0x64, 0x31, 0x4A, 0x36, 0x64, 0x38, 0x7E, 0x3A, 0x17, 0x39, 0x64, 0x38, 0x7E, 0x33,
0x97, 0x2E, 0x97, 0x27, 0x4A, 0x21, 0x97, 0x19, 0xE4, 0x11, 0xCA, 0x08, 0xB2, 0xFF, 0x4B, 0xF7,
0xE5, 0xEE, 0xE5, 0xE7, 0x98, 0xE1, 0xB2, 0xDC, 0xCB, 0xD7, 0xB2, 0xD5, 0x98, 0xD3, 0x98, 0xD3,
0x98, 0xD3, 0xFF, 0xD4, 0x65, 0xD6, 0x32, 0xD9, 0xFF, 0xDB, 0x7F, 0xDF, 0xFF, 0xE2, 0x7F, 0xE6,
0xB2, 0xEA, 0xE5, 0xEE, 0xCB, 0xF3, 0xB2, 0xF8, 0x98, 0xFD, 0x7E, 0x02, 0x17, 0x08, 0xB1, 0x0D,
0xFE, 0x13, 0x4A, 0x1A, 0x97, 0x20, 0x7E, 0x25, 0x17, 0x2B, 0x4A, 0x2F, 0x31, 0x34, 0x4A, 0x36,
0x64, 0x38, 0xFE, 0x36, 0x4A, 0x36, 0x17, 0x32, 0xE4, 0x2D, 0xE4, 0x26, 0xE4, 0x1F, 0x17, 0x16,
0x4A, 0x0C, 0xCA, 0x01, 0xFF, 0xF7, 0x32, 0xEE
};

View File

@@ -68,6 +68,7 @@
#else
#include <gui/widget/msgbox.h>
#endif
#include <system/helpers.h>
#include <system/settings.h>
#include <system/set_threadname.h>
@@ -1920,10 +1921,10 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
int prg_offset = 0;
int title_offset = 0;
int rec_mode;
if(g_settings.theme.progressbar_design_channellist != CProgressBar::PB_OFF)
if (g_settings.theme.progressbar_design_channellist != CProgressBar::PB_OFF)
{
prg_offset = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("00:00");
title_offset = OFFSET_INNER_SMALL;
title_offset = OFFSET_INNER_MID;
}
snprintf(tmp, sizeof(tmp), "%d", this->historyMode ? pos : chan->number);
@@ -2014,16 +2015,16 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
if (curr == selected && move_state == beMoving)
{
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icon_w, &icon_h);
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_SMALL + numwidth - icon_w, ypos, fheight);
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID + numwidth - icon_w, ypos, fheight);
}
else if (edit_state && chan->bLocked)
{
frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &icon_w, &icon_h);
frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_SMALL + numwidth - icon_w, ypos, fheight);
frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_MID + numwidth - icon_w, ypos, fheight);
}
else if (g_settings.channellist_show_numbers)
{
int numpos = x + OFFSET_INNER_SMALL + numwidth - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp);
int numpos = x + OFFSET_INNER_MID + numwidth - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos, ypos + fheight, numwidth + 5, tmp, color, fheight);
}
else if (!edit_state)
@@ -2037,9 +2038,9 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
else
l = snprintf(nameAndDescription, sizeof(nameAndDescription), "%s", chan->getName().c_str());
int pb_space = prg_offset - title_offset;
int pb_width = prg_offset;
int pb_height = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getDigitHeight();
CProgressBar pb(x + OFFSET_INNER_SMALL + numwidth + title_offset, ypos + (fheight-pb_height)/2, pb_space + 2, pb_height, COL_MENUCONTENT_PLUS_0);
CProgressBar pb(x + OFFSET_INNER_MID + numwidth + title_offset, ypos + (fheight-pb_height)/2, pb_width, pb_height, COL_MENUCONTENT_PLUS_0);
pb.setType(CProgressBar::PB_TIMESCALE);
pb.setDesign(g_settings.theme.progressbar_design_channellist);
pb.setCornerType(0);
@@ -2052,28 +2053,28 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
}
pb.setFrameThickness(pb_frame);
pb.doPaintBg(false);
int pb_max = pb_space - 4;
if (!(p_event->description.empty()))
{
snprintf(nameAndDescription+l, sizeof(nameAndDescription)-l,g_settings.channellist_epgtext_align_right ? " ":" - ");
snprintf(nameAndDescription+l, sizeof(nameAndDescription)-l, g_settings.channellist_epgtext_align_right ? " " : " - ");
unsigned int ch_name_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(nameAndDescription);
unsigned int ch_desc_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(p_event->description);
int max_desc_len = width - numwidth - prg_offset - ch_name_len - 15 - 2*OFFSET_INNER_MID - offset_right; // 15 = scrollbar
int max_desc_len = width - numwidth - prg_offset - ch_name_len - 15 - 3*OFFSET_INNER_MID - offset_right; // 15 = scrollbar
if (max_desc_len < 0)
max_desc_len = 0;
if ((int) ch_desc_len > max_desc_len)
ch_desc_len = max_desc_len;
if(g_settings.theme.progressbar_design_channellist != CProgressBar::PB_OFF) {
if (g_settings.theme.progressbar_design_channellist != CProgressBar::PB_OFF)
{
if(displayNext)
{
struct tm *pStartZeit = localtime(&p_event->startTime);
snprintf(tmp, sizeof(tmp), "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x + OFFSET_INNER_SMALL + numwidth + 6, ypos + fheight, width - numwidth - 15 - prg_offset - 2*OFFSET_INNER_MID, tmp, ecolor, fheight);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID, ypos + fheight, width - numwidth - 15 - prg_offset - 2*OFFSET_INNER_MID, tmp, ecolor, fheight);
}
else
{
@@ -2083,34 +2084,36 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
if (((jetzt - p_event->startTime + 30) / 60) < 0 )
runningPercent= 0;
else
runningPercent=(jetzt-p_event->startTime) * pb_max / p_event->duration;
runningPercent=(jetzt-p_event->startTime) * pb_width / p_event->duration;
pb.setValues(runningPercent, pb_max);
pb.setValues(runningPercent, pb_width);
pb.paint();
}
}
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_SMALL + numwidth + OFFSET_INNER_MID + prg_offset, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - 15 - prg_offset, nameAndDescription, color);
if (g_settings.channellist_epgtext_align_right) {
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - 15 - prg_offset, nameAndDescription, color);
if (g_settings.channellist_epgtext_align_right)
{
// align right
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + width - 15 - offset_right - ch_desc_len, ypos + fheight, ch_desc_len, p_event->description, ecolor);
}
else {
else
{
// align left
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + OFFSET_INNER_SMALL + numwidth + OFFSET_INNER_MID + ch_name_len + OFFSET_INNER_SMALL + prg_offset, ypos + fheight, ch_desc_len, p_event->description, ecolor);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID + ch_name_len, ypos + fheight, ch_desc_len, p_event->description, ecolor);
}
}
else
{
if (g_settings.theme.progressbar_design_channellist != CProgressBar::PB_OFF)
{
pb.setValues(0, pb_max);
pb.setValues(0, pb_width);
if (g_settings.theme.progressbar_design == CProgressBar::PB_GRAPHIC) //NI graphic
pb.setGraphic("progressbar_inactive");
pb.paint();
}
//name
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_SMALL + numwidth + OFFSET_INNER_MID + prg_offset, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - 15 - prg_offset, nameAndDescription, color);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - 15 - prg_offset, nameAndDescription, color);
}
if (!firstpaint && curr == selected)
updateVfd();
@@ -2182,7 +2185,7 @@ void CChannelList::paintHead()
if (!header->getContextBtnObject()->empty())
header->removeContextButtons();
header->enableClock(true, "%H:%M", "%H %M", true);
logo_off = header->getClockObject()->getWidth() + 10;
logo_off = header->getClockObject()->getWidth() + OFFSET_INNER_MID;
header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT);
}else{
@@ -2193,7 +2196,7 @@ void CChannelList::paintHead()
}
}
else
logo_off = 10;
logo_off = OFFSET_INNER_MID;
header->paint(CC_SAVE_SCREEN_NO);
}
@@ -2327,17 +2330,12 @@ bool CChannelList::SameTP(CZapitChannel * channel)
std::string CChannelList::MaxChanNr()
{
zapit_list_it_t chan_it;
std::stringstream ss;
std::string maxchansize;
int chan_nr_max = 1;
unsigned int nr = 0;
for (chan_it=(*chanlist).begin(); chan_it!=(*chanlist).end(); ++chan_it) {
chan_nr_max = std::max(chan_nr_max, (*chanlist)[nr++]->number);
int n = 1;
for (zapit_list_it_t it = (*chanlist).begin(); it != (*chanlist).end(); ++it)
{
n = std::max(n, (*it)->number);
}
ss << chan_nr_max;
ss >> maxchansize;
return maxchansize;
return to_string(n);
}
void CChannelList::paintPig (int _x, int _y, int w, int h)
@@ -2423,7 +2421,7 @@ void CChannelList::paint_events(CChannelEventList &evtlist)
frameBuffer->paintBoxRel(x+ width,y+ theight+pig_height, infozone_width, infozone_height,COL_MENUCONTENT_PLUS_0);
char startTime[10];
int eventStartTimeWidth = 4 * g_Font[eventFont]->getMaxDigitWidth() + g_Font[eventFont]->getRenderWidth(":") + 5; // use a fixed value
int eventStartTimeWidth = 4 * g_Font[eventFont]->getMaxDigitWidth() + g_Font[eventFont]->getRenderWidth(":") + OFFSET_INNER_SMALL; // use a fixed value
int startTimeWidth = 0;
CChannelEventList::iterator e;
time_t azeit;
@@ -2472,9 +2470,9 @@ void CChannelList::paint_events(CChannelEventList &evtlist)
strftime(startTime, sizeof(startTime), "%H:%M", tmStartZeit );
//printf("%s %s\n", startTime, e->description.c_str());
startTimeWidth = eventStartTimeWidth;
g_Font[eventFont]->RenderString(x+ width+5, y+ theight+ pig_height + i*ffheight, startTimeWidth, startTime, color);
g_Font[eventFont]->RenderString(x+ width+ OFFSET_INNER_MID, y+ theight+ pig_height + i*ffheight, startTimeWidth, startTime, color);
}
g_Font[eventFont]->RenderString(x+ width+5+startTimeWidth, y+ theight+ pig_height + i*ffheight, infozone_width - startTimeWidth - 20, e->description, color);
g_Font[eventFont]->RenderString(x+ width+ OFFSET_INNER_MID +startTimeWidth, y+ theight+ pig_height + i*ffheight, infozone_width - startTimeWidth - 2*OFFSET_INNER_MID, e->description, color);
}
else
{

View File

@@ -1,235 +0,0 @@
/*
* some definition
*/
#define TS_LEN 188
#define TS_SYNC_BYTE 0x47
#define TS_BUF_SIZE (TS_LEN * 2048) /* fix dmx buffer size */
static unsigned long timeval_to_ms(const struct timeval *tv)
{
return (tv->tv_sec * 1000) + ((tv->tv_usec + 500) / 1000);
}
long delta_time_ms (struct timeval *tv, struct timeval *last_tv)
{
return timeval_to_ms(tv) - timeval_to_ms(last_tv);
}
int ts_pidbandwidth (OPTION *opt)
{
u_char buf[TS_BUF_SIZE];
struct pollfd pfd;
struct dmx_pes_filter_params flt;
int dmxfd;
struct timeval tv,last_tv, first_tv;
int pid;
uint64_t b_total;
long b;
long packets_bad;
long packets_total;
struct { // simple struct for storing last average bandwidth
unsigned long kb_sec;
unsigned long b_sec;
} last_avg;
if (opt->ts_raw_mode) {
pid = PID_FULL_TS;
} else {
pid = opt->pid;
}
indent (0);
out_nl (2,"");
out_nl (2,"---------------------------------------------------------");
out_nl (2,"PID bandwidth statistics...");
if (opt->ts_raw_mode) {
out (2,"Full Transponder");
} else {
out (2,"PID: %u (0x%04x)", pid, pid);
}
if (opt->rd_packet_count != 0) {
out (2," - max packet count: %ld ", opt->rd_packet_count);
}
out_nl (2,"");
out_nl (2,"---------------------------------------------------------");
// -- open DVR device for reading
pfd.events = POLLIN | POLLPRI;
if((pfd.fd = open(opt->devDvr,O_RDONLY|O_NONBLOCK)) < 0){
IO_error(opt->devDvr);
return -1;
}
if ((dmxfd=open(opt->devDemux,O_RDWR)) < 0) {
IO_error(opt->devDemux);
close(pfd.fd);
return -1;
}
ioctl (dmxfd,DMX_SET_BUFFER_SIZE, sizeof(buf));
flt.pid = pid;
flt.input = DMX_IN_FRONTEND;
flt.output = DMX_OUT_TS_TAP;
flt.pes_type = DMX_PES_OTHER;
flt.flags = DMX_IMMEDIATE_START;
if (ioctl(dmxfd, DMX_SET_PES_FILTER, &flt) < 0) {
IO_error("DMX_SET_PES_FILTER");
close(pfd.fd);
close(dmxfd);
return -1;
}
gettimeofday (&first_tv, NULL);
last_tv.tv_sec = first_tv.tv_sec;
last_tv.tv_usec = first_tv.tv_usec;
b_total = 0;
packets_total = 0;
packets_bad = 0;
while ( !isSigAbort() ) {
int b_len, b_start;
// -- we will poll the PID in 2 secs intervall
int timeout = 2000;
b_len = 0;
b_start = 0;
if (poll(&pfd, 1, timeout) > 0) {
if (pfd.revents & POLLIN) {
b_len = read(pfd.fd, buf, sizeof(buf));
gettimeofday (&tv, NULL);
if (b_len >= TS_LEN) {
b_start = sync_ts (buf, b_len);
} else {
b_len = 0;
}
b = b_len - b_start;
if (b == 0) continue;
if (b < 0) {
IO_error("read");
continue;
}
b_total += b;
// -- calc bandwidth
{
uint64_t bit_s;
long d_tim_ms;
int packets;
packets = b/TS_LEN;
packets_total += packets;
// output on different verbosity levels
// -- current bandwidth
d_tim_ms = delta_time_ms (&tv, &last_tv);
if (d_tim_ms <= 0) d_tim_ms = 1; // ignore usecs
out (3, "packets read: %3d/(%ld) d_time: %2ld.%03ld s = ",
packets, packets_total, d_tim_ms / 1000UL, d_tim_ms % 1000UL);
// -- current bandwidth in kbit/sec
// --- cast to uint64_t so it doesn't overflow as
// --- early, add time / 2 before division for correct rounding
bit_s = (((uint64_t)b * 8000ULL) + ((uint64_t)d_tim_ms / 2ULL))
/ (uint64_t)d_tim_ms;
out (1, "%5llu.%03llu kbit/s", bit_s / 1000ULL, bit_s % 1000ULL);
// -- average bandwidth
d_tim_ms = delta_time_ms (&tv,&first_tv);
if (d_tim_ms <= 0) d_tim_ms = 1; // ignore usecs
bit_s = ((b_total * 8000ULL) + ((uint64_t)d_tim_ms / 2ULL))
/ (uint64_t)d_tim_ms;
last_avg.kb_sec = (unsigned long) (bit_s / 1000ULL);
last_avg.b_sec = (unsigned long) (bit_s % 1000ULL);
out (2, " (Avrg: %5lu.%03lu kbit/s)", last_avg.kb_sec, last_avg.b_sec);
// -- bad packet(s) check in buffer
{
int bp;
bp = ts_error_count (buf+b_start, b);
packets_bad += bp;
out (4, " [bad: %d]", bp);
}
out_NL (1);
}
last_tv.tv_sec = tv.tv_sec;
last_tv.tv_usec = tv.tv_usec;
// count packets ?
if (opt->rd_packet_count > 0) {
opt->rd_packet_count -= b/TS_LEN;
if (opt->rd_packet_count <= 0) break;
}
}
}
}
// -- packets stats
out (4, "## ");
if (opt->ts_raw_mode) { out (2,"PID: <ALL>");
} else { out (2,"PID: %u (0x%04x)", pid, pid);
}
out (4, " bad/total packets: %ld/%ld (= %1.1Lf%%)",
packets_bad, packets_total,
(((long double) packets_bad)*100)/packets_total );
out (4, " Avrg: %5lu.%03lu kbit/s",
last_avg.kb_sec, last_avg.b_sec);
out_NL(4);
if (ioctl(dmxfd, DMX_STOP) < 0) {
IO_error("DMX_STOP");
}
close(dmxfd);
close(pfd.fd);
return 0;
}