From 9ea5bcfd74c789712be6b7887a17398111979cb2 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 11 Apr 2017 17:32:46 +0200 Subject: [PATCH 01/30] - remove obsolete src/gui/dmx_tspidbandwidth.c --- src/gui/dmx_tspidbandwidth.c | 235 ----------------------------------- 1 file changed, 235 deletions(-) delete mode 100644 src/gui/dmx_tspidbandwidth.c diff --git a/src/gui/dmx_tspidbandwidth.c b/src/gui/dmx_tspidbandwidth.c deleted file mode 100644 index 07ced12f5..000000000 --- a/src/gui/dmx_tspidbandwidth.c +++ /dev/null @@ -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: "); - } 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; - -} - From c3a1ef47dc4b03b16972797b86da57596c4ce1bc Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 11 Apr 2017 17:32:46 +0200 Subject: [PATCH 02/30] - remove obsolete src/driver/wav.h --- src/driver/wav.h | 65 ------------------------------------------------ 1 file changed, 65 deletions(-) delete mode 100644 src/driver/wav.h diff --git a/src/driver/wav.h b/src/driver/wav.h deleted file mode 100644 index 1b108b746..000000000 --- a/src/driver/wav.h +++ /dev/null @@ -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, 0x7F, 0xFB, 0xCA, 0x01, 0x17, 0x08, 0x17, 0x0F, 0xFE, 0x13, 0x97, 0x19, 0xCA, 0x1D, -0xB1, 0x22, 0x31, 0x26, 0xB1, 0x29, 0xCA, 0x2B, 0x97, 0x2E, 0x4A, 0x2F, 0xB1, 0x30, 0xFE, 0x2F, -0xFE, 0x2F, 0xE4, 0x2D, 0x7E, 0x2C, 0xFE, 0x28, 0x31, 0x26, 0xFE, 0x21, 0xCA, 0x1D, 0x31, 0x18, -0x4A, 0x13, 0xB1, 0x0D, 0x17, 0x08, 0xCA, 0x01, 0x7F, 0xFB, 0x32, 0xF5, 0x98, 0xEF, 0x4B, 0xE9, -0xB2, 0xE3, 0x18, 0xDE, 0x7F, 0xD8, 0x98, 0xD3, 0x65, 0xCF, 0x32, 0xCB, 0xB2, 0xC7, 0xE5, 0xC4, -0xCB, 0xC2, 0x18, 0xC2, 0x18, 0xC2, 0x18, 0xC2, 0x18, 0xC2, 0x7F, 0xC3, 0x98, 0xC5, 0x65, 0xC8, -0xE5, 0xCB, 0x18, 0xD0, 0xFF, 0xD4, 0x98, 0xDA, 0x32, 0xE0, 0x7F, 0xE6, 0x7F, 0xED, 0x7F, 0xF4, -0x32, 0xFC, 0xE4, 0x03, 0x97, 0x0B, 0xE4, 0x11, 0x31, 0x18, 0x31, 0x1F, 0x31, 0x26, 0x7E, 0x2C, -0x7E, 0x33, 0xB1, 0x37, 0x97, 0x3C, 0x4A, 0x3D, 0xFE, 0x3D, 0xFE, 0x3D, 0xFE, 0x3D, 0xFE, 0x3D, -0xFE, 0x3D, 0xFE, 0x3D, 0xFE, 0x3D, 0xFE, 0x3D, 0xFE, 0x3D, 0xFE, 0x3D, 0xFE, 0x3D, 0xCA, 0x39, -0x97, 0x35, 0xFE, 0x2F, 0x17, 0x2B, 0xCA, 0x24, 0x7E, 0x1E, 0x7E, 0x17, 0x7E, 0x10, 0x7E, 0x09, -0x31, 0x03, 0xE5, 0xFC, 0x4B, 0xF7, 0xFF, 0xF0, 0x65, 0xEB, 0x7F, 0xE6, 0x98, 0xE1, 0xCB, 0xDE, -0xFF, 0xDB, 0x32, 0xD9, 0x65, 0xD6, 0xFF, 0xD4, 0x4B, 0xD4, 0xFF, 0xD4, 0x65, 0xD6, 0x7F, 0xD8, -0x98, 0xDA, 0x65, 0xDD, 0xE5, 0xE0, 0x18, 0xE5, 0x4B, 0xE9, 0xE5, 0xEE, 0x32, 0xF5, 0xCB, 0xFA, -0x64, 0x00, 0xB1, 0x06, 0xFE, 0x0C, 0x4A, 0x13, 0x4A, 0x1A, 0xE4, 0x1F, 0x7E, 0x25, 0xB1, 0x29, -0x97, 0x2E, 0x17, 0x32, 0x4A, 0x36, 0x17, 0x39, 0x97, 0x3C, 0x97, 0x3C, 0x4A, 0x3D, 0x4A, 0x3D, -0x4A, 0x3D, 0x31, 0x3B, 0xCA, 0x39, 0x4A, 0x36, 0x7E, 0x33, 0x97, 0x2E, 0xB1, 0x29, 0x17, 0x24, -0x31, 0x1F, 0x31, 0x18, 0xE4, 0x11, 0xE4, 0x0A, 0xE4, 0x03, 0xE5, 0xFC, 0xE5, 0xF5, 0x98, 0xEF, -0x4B, 0xE9, 0xFF, 0xE2, 0x65, 0xDD, 0xCB, 0xD7, 0xE5, 0xD2, 0xB2, 0xCE, 0x32, 0xCB, 0x65, 0xC8, -0x4B, 0xC6, 0xE5, 0xC4, 0x7F, 0xC3, 0x32, 0xC4, 0xE5, 0xC4, 0xB2, 0xC7, 0x7F, 0xCA, 0xFF, 0xCD, -0x7F, 0xD1, 0x65, 0xD6, 0x4B, 0xDB, 0x98, 0xE1, 0xE5, 0xE7, 0x32, 0xEE, 0x32, 0xF5, 0x7F, 0xFB, -0x7E, 0x02, 0xCA, 0x08, 0xCA, 0x0F, 0x17, 0x16, 0x17, 0x1D, 0xFE, 0x21, 0xE4, 0x26, 0x17, 0x2B, -0x4A, 0x2F, 0x17, 0x32, 0x97, 0x35, 0x4A, 0x36, 0xB1, 0x37, 0xFE, 0x36, 0x4A, 0x36, 0x31, 0x34, -0x17, 0x32, 0x97, 0x2E, 0x17, 0x2B, 0x7E, 0x25, 0x97, 0x20, 0x4A, 0x1A, 0xB1, 0x14, 0x4A, 0x0C, -0x97, 0x04, 0x4B, 0xFE, 0xB2, 0xF8, 0x4B, 0xF0, 0xE5, 0xE7, 0x98, 0xE1, 0xFF, 0xDB, 0x65, 0xD6, -0xCB, 0xD0, 0x4B, 0xCD, 0x7F, 0xCA, 0x65, 0xC8, 0x4B, 0xC6, 0xE5, 0xC4, 0x7F, 0xC3, 0x98, 0xC5, -0x65, 0xC8, 0xCB, 0xC9, 0xE5, 0xCB, 0x18, 0xD0, 0xFF, 0xD4, 0xE5, 0xD9, 0x7F, 0xDF, 0x18, 0xE5, -0x65, 0xEB, 0xB2, 0xF1, 0xB2, 0xF8, 0xFF, 0xFE, 0xFE, 0x05, 0xFE, 0x0C, 0xFE, 0x13, 0x97, 0x19, -0xE4, 0x1F, 0x7E, 0x25, 0x17, 0x2B, 0x97, 0x2E, 0xCA, 0x32, 0x97, 0x35, 0x17, 0x39, 0xCA, 0x39, -0x7E, 0x3A, 0xCA, 0x39, 0x17, 0x39, 0xFE, 0x36, 0xE4, 0x34, 0xFE, 0x2F, 0x17, 0x2B, 0xCA, 0x24, -0x31, 0x1F, 0x7E, 0x17, 0x7E, 0x10, 0x17, 0x08, 0x64, 0x00, 0xFF, 0xF7, 0x98, 0xEF, 0x32, 0xE7, -0x7F, 0xDF, 0xCB, 0xD7, 0x18, 0xD0, 0xCB, 0xC9, 0x32, 0xC4, 0xCB, 0xC2, 0x18, 0xC2, 0x18, 0xC2, -0x18, 0xC2, 0x18, 0xC2, 0x18, 0xC2, 0x18, 0xC2, 0x18, 0xC2, 0x98, 0xC5, 0xCB, 0xC9, 0x18, 0xD0, -0x65, 0xD6, 0x18, 0xDE, 0xCB, 0xE5, 0x7F, 0xED, 0x32, 0xF5, 0xE5, 0xFC, 0x4A, 0x05, 0x97, 0x0B, -0x97, 0x12, 0x31, 0x18, 0x7E, 0x1E, 0xB1, 0x22, 0xE4, 0x26, 0xB1, 0x29, 0x7E, 0x2C, 0x31, 0x2D, -0x97, 0x2E, 0xE4, 0x2D, 0xE4, 0x2D, 0xCA, 0x2B, 0xB1, 0x29, 0x31, 0x26, 0x64, 0x23, 0x7E, 0x1E, -0x4A, 0x1A, 0xB1, 0x14, 0x17, 0x0F, 0xCA, 0x08, 0x7E, 0x02, 0x32, 0xFC, 0x98, 0xF6, 0xE5, 0xEE, -0xE5, 0xE7, 0xE5, 0xE0, 0x98, 0xDA, 0x65, 0xD6, 0x32, 0xD2, 0xFF, 0xCD, 0xCB, 0xC9, 0x98, 0xC5, -0x18, 0xC2, 0x18, 0xC2, 0x18, 0xC2, 0x32, 0xC4, 0xFF, 0xC6, 0xCB, 0xC9, 0x98, 0xCC, 0x32, 0xD2, -0x7F, 0xD8, 0xE5, 0xE0, 0xFF, 0xE9, 0x65, 0xF2, 0xCB, 0xFA, 0x31, 0x03, 0x97, 0x0B, 0xFE, 0x13, -0x64, 0x1C, 0x64, 0x23, 0x17, 0x2B, 0x97, 0x2E, 0x17, 0x32, 0x31, 0x34, 0x4A, 0x36, 0x4A, 0x36, -0x4A, 0x36, 0xCA, 0x32, 0x4A, 0x2F, 0x64, 0x2A, 0x7E, 0x25, 0xE4, 0x1F, 0x4A, 0x1A, 0x4A, 0x13, -0x4A, 0x0C, 0x4A, 0x05, 0x4B, 0xFE, 0xFF, 0xF7, 0x65, 0xF2, 0xCB, 0xEC, 0x32, 0xE7, 0xFF, 0xE2, -0xCB, 0xDE, 0x4B, 0xDB, 0xCB, 0xD7, 0xFF, 0xD4, 0xE5, 0xD2, 0x7F, 0xD1, 0x18, 0xD0, 0x18, 0xD0, -0xCB, 0xD0, 0x32, 0xD2, 0x98, 0xD3, 0x65, 0xD6, 0x32, 0xD9, 0x18, 0xDE, 0xFF, 0xE2, 0x4B, 0xE9, -0x98, 0xEF, 0x98, 0xF6, 0x4B, 0xFE, 0xB1, 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 -}; From 763f16ccca61817d1c7152dbd9671269ba0a5d55 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 11 Apr 2017 23:12:41 +0200 Subject: [PATCH 03/30] - channellist: simplify MaxChanNr() function --- src/gui/channellist.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index bb016b2e1..2d02382cc 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -68,6 +68,7 @@ #else #include #endif +#include #include #include @@ -1276,7 +1277,7 @@ int CChannelList::numericZap(int key) } return res; } - size_t maxchansize = MaxChanNr().size(); + size_t maxchansize = MaxChanNr().size(); int fw = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getMaxDigitWidth(); int sx = maxchansize * fw + (fw/2); int sy = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getHeight() + 6; @@ -2288,19 +2289,14 @@ bool CChannelList::SameTP(CZapitChannel * channel) return iscurrent; } -std::string CChannelList::MaxChanNr() +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) From 7e6746e2aa0d912fcf61aca88c74fd8776f2e00e Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 11 Apr 2017 23:12:41 +0200 Subject: [PATCH 04/30] - channellist: a bit more offset for item; fix progressbar's width use OFFSET defines for logo in header and in right infozone --- src/gui/channellist.cpp | 52 +++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 2d02382cc..03057fe87 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1900,10 +1900,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); @@ -1994,16 +1994,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) @@ -2017,9 +2017,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); @@ -2032,28 +2032,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 { @@ -2063,32 +2063,34 @@ 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); 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(); @@ -2157,7 +2159,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{ @@ -2168,7 +2170,7 @@ void CChannelList::paintHead() } } else - logo_off = 10; + logo_off = OFFSET_INNER_MID; header->paint(CC_SAVE_SCREEN_NO); } @@ -2382,7 +2384,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; @@ -2431,9 +2433,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 { From a1f174b80a928705a2081a6cff7ffebd7e1c8236 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 12 Apr 2017 09:31:21 +0200 Subject: [PATCH 05/30] - eventlist: use OFFSET defines for right infobox --- src/gui/eventlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 315acf576..f8209f6d5 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -300,7 +300,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna // init right info_zone if ((g_settings.eventlist_additional) && (cc_infozone == NULL)) - cc_infozone = new CComponentsText(x+width+10, y+theight, infozone_width-20, listmaxshow*fheight); + cc_infozone = new CComponentsText(x+width+OFFSET_INNER_MID, y+theight, infozone_width-2*OFFSET_INNER_MID, listmaxshow*fheight); int res = menu_return::RETURN_REPAINT; //printf("CEventList::exec: channel_id %llx\n", channel_id); From f4a0e8faf1e2a5bd7723b8c7bbf8e8848dccd433 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 12 Apr 2017 09:31:21 +0200 Subject: [PATCH 06/30] - channelist: use OFFSET defines for bottom detailsbox --- src/gui/channellist.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 03057fe87..7824f0b5c 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1559,8 +1559,8 @@ void CChannelList::paintDetails(int index) std::string text1= p_event->description; std::string text2= p_event->text; - int xstart = 10; - if (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text1) > (full_width - 30 - seit_len) ) + int xstart = OFFSET_INNER_MID; + if (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text1) > (full_width - 3*OFFSET_INNER_MID - seit_len) ) { // zu breit, Umbruch versuchen... int pos; @@ -1568,7 +1568,7 @@ void CChannelList::paintDetails(int index) pos = text1.find_last_of("[ -.]+"); if ( pos!=-1 ) text1 = text1.substr( 0, pos ); - } while ( ( pos != -1 ) && (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text1) > (full_width - 30 - seit_len) ) ); + } while ( ( pos != -1 ) && (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text1) > (full_width - 3*OFFSET_INNER_MID - seit_len) ) ); std::string text3 = ""; /* not perfect, but better than crashing... */ if (p_event->description.length() > text1.length()) @@ -1578,7 +1578,7 @@ void CChannelList::paintDetails(int index) text3= text3+ " - "; xstart += g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text3); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight, full_width - 30- noch_len, text3, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID, ypos_a + 2*fheight, full_width - 3*OFFSET_INNER_MID - noch_len, text3, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); } if (!(text2.empty())) { @@ -1587,7 +1587,7 @@ void CChannelList::paintDetails(int index) text2 = text2.substr( 0, text2.find('\n') ); #if 0 //FIXME: to discuss, eat too much cpu time if string long enough int pos = 0; - while ( ( pos != -1 ) && (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text2) > (full_width - 30 - noch_len) ) ) { + while ( ( pos != -1 ) && (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text2) > (full_width - 3*OFFSET_INNER_MID - noch_len) ) ) { pos = text2.find_last_of(" "); if ( pos!=-1 ) { @@ -1595,18 +1595,18 @@ void CChannelList::paintDetails(int index) } } #endif - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ xstart, ypos_a + fdescrheight+ fheight, full_width- xstart- 30- noch_len, text2, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + xstart, ypos_a + fdescrheight+ fheight, full_width- xstart- 3*OFFSET_INNER_MID- noch_len, text2, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); } - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + fheight, full_width - 30 - seit_len, text1, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- seit_len, ypos_a + fheight , seit_len, cSeit, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- noch_len, ypos_a + fdescrheight+ fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ OFFSET_INNER_MID, ypos_a + fheight, full_width - 3*OFFSET_INNER_MID - seit_len, text1, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- OFFSET_INNER_MID- seit_len, ypos_a + fheight , seit_len, cSeit, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- OFFSET_INNER_MID- noch_len, ypos_a + fdescrheight+ fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); } else if (IS_WEBTV((*chanlist)[index]->getChannelID())) { - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + fheight, full_width - 30, (*chanlist)[index]->getDesc(), colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT, 0, true); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ OFFSET_INNER_MID, ypos_a + fheight, full_width - 3*OFFSET_INNER_MID, (*chanlist)[index]->getDesc(), colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT, 0, true); } if (g_settings.channellist_foot == 0 && IS_WEBTV((*chanlist)[index]->getChannelID())) { - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight + fdescrheight, full_width - 30, (*chanlist)[index]->getUrl(), COL_MENUCONTENTDARK_TEXT, 0, true); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ OFFSET_INNER_MID, ypos_a + 2*fheight + fdescrheight, full_width - 3*OFFSET_INNER_MID, (*chanlist)[index]->getUrl(), COL_MENUCONTENTDARK_TEXT, 0, true); } else if(g_settings.channellist_foot == 0) { transponder t; CServiceManager::getInstance()->GetTransponder((*chanlist)[index]->getTransponderId(), t); @@ -1617,7 +1617,7 @@ void CChannelList::paintDetails(int index) else desc = desc + " (" + CServiceManager::getInstance()->GetSatelliteName((*chanlist)[index]->getSatellitePosition()) + ")"; - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight +fdescrheight, full_width - 30, desc.c_str(), COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ OFFSET_INNER_MID, ypos_a + 2*fheight +fdescrheight, full_width - 3*OFFSET_INNER_MID, desc.c_str(), COL_MENUCONTENTDARK_TEXT); } else if( !displayNext && g_settings.channellist_foot == 1) { // next Event @@ -1631,8 +1631,8 @@ void CChannelList::paintDetails(int index) snprintf(buf, sizeof(buf), "%s", CurrentNext.next_name.c_str()); int from_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(cFrom); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight+ fdescrheight, full_width - 30 - from_len, buf, colored_event_N ? COL_COLORED_EVENTS_TEXT :COL_MENUCONTENTDARK_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- from_len, ypos_a + 2*fheight+ fdescrheight, from_len, cFrom, colored_event_N ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ OFFSET_INNER_MID, ypos_a + 2*fheight+ fdescrheight, full_width - 3*OFFSET_INNER_MID - from_len, buf, colored_event_N ? COL_COLORED_EVENTS_TEXT :COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- OFFSET_INNER_MID- from_len, ypos_a + 2*fheight+ fdescrheight, from_len, cFrom, colored_event_N ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); } } } From 5a17b434b6e5256915c102cde7a80675cfb5d15c Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 12 Apr 2017 09:31:22 +0200 Subject: [PATCH 07/30] - osd_setup: a bit smaller font for epgplus-items; ... it's now aligned to epgview's fontsizes --- src/gui/osd_setup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index d36a1e7df..60cd9ebfc 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -198,7 +198,7 @@ font_sizes_struct neutrino_font[SNeutrinoSettings::FONT_TYPE_COUNT] = {LOCALE_FONTSIZE_EPG_INFO1 , 17, CNeutrinoFonts::FONT_STYLE_ITALIC , 2}, {LOCALE_FONTSIZE_EPG_INFO2 , 17, CNeutrinoFonts::FONT_STYLE_REGULAR, 2}, {LOCALE_FONTSIZE_EPG_DATE , 15, CNeutrinoFonts::FONT_STYLE_REGULAR, 2}, - {LOCALE_FONTSIZE_EPGPLUS_ITEM , 18, CNeutrinoFonts::FONT_STYLE_REGULAR, 2}, + {LOCALE_FONTSIZE_EPGPLUS_ITEM , 17, CNeutrinoFonts::FONT_STYLE_REGULAR, 2}, {LOCALE_FONTSIZE_EVENTLIST_TITLE , 30, CNeutrinoFonts::FONT_STYLE_REGULAR, 0}, {LOCALE_FONTSIZE_EVENTLIST_ITEMLARGE, 20, CNeutrinoFonts::FONT_STYLE_BOLD , 1}, {LOCALE_FONTSIZE_EVENTLIST_ITEMSMALL, 14, CNeutrinoFonts::FONT_STYLE_REGULAR, 1}, From 31979a4f8776e16744a9fad61901822e456b5b5a Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 12 Apr 2017 10:04:03 +0200 Subject: [PATCH 08/30] - channellist: one more missing OFFSET define --- src/gui/channellist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 7824f0b5c..571b2af6d 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -495,7 +495,7 @@ void CChannelList::calcSize() // calculate height (the infobox below mainbox is handled outside height) if (g_settings.channellist_show_infobox) - info_height = 2*fheight + fdescrheight + 10; + info_height = 2*fheight + fdescrheight + 2*OFFSET_INNER_SMALL; else info_height = 0; height = pig_on_win ? frameBuffer->getScreenHeight(): frameBuffer->getScreenHeightRel(); From 42aca4a4c98d50d4672d26eff8304c65e3ed1836 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 12 Apr 2017 10:04:04 +0200 Subject: [PATCH 09/30] - channelist: rename bool pig_on_win to minitv_is_active --- src/gui/channellist.cpp | 14 +++++++------- src/gui/channellist.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 571b2af6d..8499c38c5 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -125,7 +125,7 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl dline = NULL; cc_minitv = NULL; logo_off = 0; - pig_on_win = false; + minitv_is_active = false; CChannelLogo = NULL; headerNew = true; bouquet = NULL; @@ -484,9 +484,9 @@ void CChannelList::calcSize() fheight = 1; /* avoid div-by-zero crash on invalid font */ footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight()+6; - pig_on_win = ( (g_settings.channellist_additional == 2) /* with miniTV */ && (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_ts) ); + minitv_is_active = ( (g_settings.channellist_additional == 2) && (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_ts) ); // calculate width - full_width = pig_on_win ? (frameBuffer->getScreenWidth()-2*DETAILSLINE_WIDTH) : frameBuffer->getScreenWidthRel(); + full_width = minitv_is_active ? (frameBuffer->getScreenWidth()-2*DETAILSLINE_WIDTH) : frameBuffer->getScreenWidthRel(); if (g_settings.channellist_additional) width = full_width / 3 * 2; @@ -498,7 +498,7 @@ void CChannelList::calcSize() info_height = 2*fheight + fdescrheight + 2*OFFSET_INNER_SMALL; else info_height = 0; - height = pig_on_win ? frameBuffer->getScreenHeight(): frameBuffer->getScreenHeightRel(); + height = minitv_is_active ? frameBuffer->getScreenHeight() : frameBuffer->getScreenHeightRel(); height = height - OFFSET_INTER - info_height; // calculate x position @@ -522,7 +522,7 @@ void CChannelList::calcSize() // calculate width/height of right info_zone and pip-box infozone_width = full_width - width; pig_width = infozone_width; - if ( pig_on_win /* with miniTV */ ) + if (minitv_is_active) pig_height = (pig_width * 9) / 16; else pig_height = 0; @@ -2210,7 +2210,7 @@ void CChannelList::paintBody() liststart = (selected/listmaxshow)*listmaxshow; updateEvents(this->historyMode ? 0:liststart, this->historyMode ? 0:(liststart + listmaxshow)); - if (pig_on_win) // with miniTV + if (minitv_is_active) paintPig(x+width, y+theight, pig_width, pig_height); // paint background for main box @@ -2301,7 +2301,7 @@ std::string CChannelList::MaxChanNr() return to_string(n); } -void CChannelList::paintPig (int _x, int _y, int w, int h) +void CChannelList::paintPig(int _x, int _y, int w, int h) { //init minitv object with basic properties if (cc_minitv == NULL){ diff --git a/src/gui/channellist.h b/src/gui/channellist.h index f5addbe68..75ac35a63 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -131,7 +131,7 @@ private: bool vlist; // "virtual" list, not bouquet bool displayNext; bool displayList; - bool pig_on_win; + bool minitv_is_active; bool headerNew; From 8bfee0b7dcdd689c953019db733909a64497f283 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 12 Apr 2017 13:28:54 +0200 Subject: [PATCH 10/30] - settings: fix calculation for SCROLLBAR_WIDTH ... to work with subtractions too --- src/system/settings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/settings.h b/src/system/settings.h index 520ae7809..fa2ec6e94 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -920,7 +920,7 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO #define OFFSET_INNER_MIN 2 #define OFFSET_INNER_NONE 0 -#define SCROLLBAR_WIDTH OFFSET_INNER_MID + 2*OFFSET_INNER_MIN +#define SCROLLBAR_WIDTH (OFFSET_INNER_MID + 2*OFFSET_INNER_MIN) #define DETAILSLINE_WIDTH 16 // TODO: scale2Res() ? From cf229bb3afba74fa5476be2d48cf026b14b475ac Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 13 Apr 2017 11:20:10 +0200 Subject: [PATCH 11/30] - epgplus: get sure we have enough space for detailsline --- src/gui/epgplus.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 66be1d059..de34c6063 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -803,6 +803,8 @@ void EpgPlus::init() this->usableScreenHeight = headerHeight + timeLineHeight + this->bodyHeight + buttonHeight + OFFSET_INTER + footerHeight; // recalc deltaY this->usableScreenX = getScreenStartX(this->usableScreenWidth); + if (this->usableScreenX < DETAILSLINE_WIDTH) + this->usableScreenX = DETAILSLINE_WIDTH; this->usableScreenY = getScreenStartY(this->usableScreenHeight); this->headerX = this->usableScreenX; From 4ea2f46c7c7751b0f4961a0219e5812a5be48da6 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 13 Apr 2017 11:20:10 +0200 Subject: [PATCH 12/30] - bouquetlist: rework; ... * use OFFSET defines * use CComponentsFooter to paint footer * use CComponentsScrollBar to paint scrollbar * use a bit more offset for items * re-align status icons in items * use same scambled-icon as used in channellist --- src/gui/bouquetlist.cpp | 118 +++++++++++++++++++++------------------- src/gui/bouquetlist.h | 6 +- 2 files changed, 66 insertions(+), 58 deletions(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 4794e2579..4a5b6c9a0 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -3,6 +3,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2009,2011,2013,2015-2017 Stefan Seyfried + Copyright (C) 2017 Sven Hoefer License: GPL @@ -67,7 +68,6 @@ CBouquetList::CBouquetList(const char * const Name) name = g_Locale->getText(LOCALE_BOUQUETLIST_HEAD); else name = Name; - } CBouquetList::~CBouquetList() @@ -411,7 +411,8 @@ int CBouquetList::show(bool bShowChannelList) int h_max_icon = 0; favonly = !bShowChannelList; - for(unsigned int count = 0; count < sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]);count++){ + for (unsigned int count = 0; count < sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]); count++) + { int w_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getRenderWidth(g_Locale->getText(CBouquetListButtons[count].locale)); w_max_text = std::max(w_max_text, w_text); frameBuffer->getIconSize(CBouquetListButtons[count].button, &icol_w, &icol_h); @@ -419,26 +420,32 @@ int CBouquetList::show(bool bShowChannelList) h_max_icon = std::max(h_max_icon, icol_h); } - int need_width = sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0])*(w_max_icon + w_max_text + 20); - CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, ""); - fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); + item_height = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); - width = w_max (need_width, 20); - height = h_max (16 * fheight, 40); + /* + We align width to needed footer space, + but this manual calculation isn't a good idea. + It would be better to get the needed width from + CComponententsFooter class. + */ + width = (sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]))*(w_max_icon + w_max_text + 2*OFFSET_INNER_MID); + height = 16*item_height; - footerHeight = std::max(h_max_icon+8, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight()+8); - theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - listmaxshow = (height - theight - footerHeight)/fheight; - height = theight + footerHeight + listmaxshow * fheight; // recalc height + header_height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); + footer_height = header_height; + listmaxshow = (height - header_height - footer_height)/item_height; + height = header_height + footer_height + listmaxshow*item_height; // recalc height - x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; - y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - height) / 2; + x = getScreenStartX(width); + y = getScreenStartY(height); int lmaxpos= 1; int i= Bouquets.size(); while ((i= i/10)!=0) lmaxpos++; + CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, ""); + COSDFader fader(g_settings.theme.menu_Content_alpha); fader.StartFadeIn(); @@ -471,7 +478,7 @@ int CBouquetList::show(bool bShowChannelList) { selected = oldselected; if(fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); + timeoutEnd = CRCInput::calcTimeoutEnd(1); msg = 0; } else loop=false; @@ -563,7 +570,7 @@ int CBouquetList::show(bool bShowChannelList) pos = 1; } } else { - chn = chn * 10 + CRCInput::getNumericValue(msg); + chn = chn*10 + CRCInput::getNumericValue(msg); pos++; } @@ -591,6 +598,7 @@ int CBouquetList::show(bool bShowChannelList) fader.StopFade(); CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); + if (save_bouquets) { save_bouquets = false; #if 0 @@ -602,7 +610,8 @@ int CBouquetList::show(bool bShowChannelList) if (g_settings.epg_scan == CEpgScan::SCAN_SEL) CEpgScan::getInstance()->Start(); } - if(zapOnExit) + + if (zapOnExit) return (selected); return (res); @@ -610,13 +619,13 @@ int CBouquetList::show(bool bShowChannelList) void CBouquetList::hide() { - frameBuffer->paintBackgroundBoxRel(x,y, width,height+10); + frameBuffer->paintBackgroundBoxRel(x, y, width, height); CInfoClock::getInstance()->enableInfoClock(!CInfoClock::getInstance()->isBlocked()); } void CBouquetList::paintItem(int pos) { - int ypos = y+ theight+0 + pos*fheight; + int ypos = y + header_height + pos*item_height; bool iscurrent = true; int npos = liststart + pos; const char * lname = NULL; @@ -633,8 +642,8 @@ void CBouquetList::paintItem(int pos) i_radius = RADIUS_LARGE; if (i_radius) - frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, bgcolor, i_radius); if (npos < (int) Bouquets.size()) lname = (Bouquets[npos]->zapitBouquet && Bouquets[npos]->zapitBouquet->bFav) ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : Bouquets[npos]->channelList->getName(); @@ -657,33 +666,33 @@ void CBouquetList::paintItem(int pos) } } - if(npos < (int) Bouquets.size()) { - char tmp[10]; - sprintf((char*) tmp, "%d", npos+ 1); + if (npos < (int) Bouquets.size()) { + char num[10]; + sprintf((char*) num, "%d", npos + 1); int iw = 0, ih = 0; if ((g_settings.epg_scan == CEpgScan::SCAN_SEL) && Bouquets[npos]->zapitBouquet && Bouquets[npos]->zapitBouquet->bScanEpg) { frameBuffer->getIconSize(NEUTRINO_ICON_EPG, &iw, &ih); if (iw && ih) { - int icon_x = (x+width-2) - RADIUS_LARGE/2 - iw; - frameBuffer->paintIcon(NEUTRINO_ICON_EPG, icon_x - iw, ypos, fheight); - iw = iw + 4 + RADIUS_LARGE/2; + int icon_x = x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iw; + frameBuffer->paintIcon(NEUTRINO_ICON_EPG, icon_x, ypos, item_height); + iw = iw + OFFSET_INNER_MID; } } if (Bouquets[npos]->zapitBouquet && Bouquets[npos]->zapitBouquet->bUseCI) { - int iw2; - frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED2, &iw2, &ih); + int iw2 = 0; + frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED, &iw2, &ih); if (iw2 && ih) { - int icon_x = (x+width-2) - RADIUS_LARGE/2 - iw - iw2 - 2; - frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED2, icon_x - iw2, ypos, fheight); - iw = iw + iw2 + 4 + RADIUS_LARGE/2; + int icon_x = x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iw - iw2; + frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, icon_x, ypos, item_height); + iw = iw + iw2 + OFFSET_INNER_MID; } } - int numpos = x+5+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); + int numpos = x + OFFSET_INNER_MID + numwidth - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(num); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos, ypos + item_height, numwidth + OFFSET_INNER_SMALL, num, color, item_height); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10, ypos+ fheight, width- numwidth- 20- 15 - iw, lname, color); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID, ypos + item_height, width - numwidth - 2*OFFSET_INNER_MID - iw - SCROLLBAR_WIDTH, lname, color); //CVFD::getInstance()->showMenuText(0, bouq->channelList->getName(), -1, true); } } @@ -691,7 +700,7 @@ void CBouquetList::paintItem(int pos) void CBouquetList::paintHead() { std::string icon(""); - CComponentsHeader header(x, y, width, theight, name, icon, CComponentsHeader::CC_BTN_LEFT | CComponentsHeader::CC_BTN_RIGHT | CComponentsHeader::CC_BTN_MENU); + CComponentsHeader header(x, y, width, header_height, name, icon, CComponentsHeader::CC_BTN_LEFT | CComponentsHeader::CC_BTN_RIGHT | CComponentsHeader::CC_BTN_MENU); header.paint(CC_SAVE_SCREEN_NO); } @@ -711,33 +720,32 @@ void CBouquetList::paint() _lastnum /= 10; } - frameBuffer->paintBoxRel(x, y+theight, width, height - theight - footerHeight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, y + header_height, width, height - header_height - footer_height, COL_MENUCONTENT_PLUS_0); - int numbuttons = sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]); -#if 0 - if (favonly) /* this actually shows favorites and providers button, but both are active anyway */ - numbuttons = 2; + int numButtons = sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]); - ::paintButtons(x, y + (height - footerHeight), width, numbuttons, CBouquetListButtons, width, footerHeight); -#endif if (favonly) - frameBuffer->paintBoxRel(x, y + (height - footerHeight), width, footerHeight, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); //round - else - ::paintButtons(x, y + (height - footerHeight), width, numbuttons, CBouquetListButtons, width, footerHeight); - - if(!Bouquets.empty()) { - for(unsigned int count=0;countpaintBoxRel(x, y + height - footer_height, width, footer_height, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); + } + else + { + CComponentsFooter footer; + footer.paintButtons(x, y + height - footer_height, width, footer_height, numButtons, CBouquetListButtons); + } + + if (!Bouquets.empty()) + { + for (unsigned int count = 0; count < listmaxshow; count++) + { paintItem(count); } } - int ypos = y+ theight; - int sb = fheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PASSIVE_PLUS_0); - int listmaxshow_tmp = listmaxshow ? listmaxshow : 1;//avoid division by zero - int sbc= ((bsize - 1)/ listmaxshow_tmp)+ 1; /* bsize is > 0, so sbc is also > 0 */ - int sbs= (selected/listmaxshow_tmp); + int _listmaxshow = listmaxshow ? listmaxshow : 1; //avoid division by zero + int total_pages = ((bsize - 1) / _listmaxshow) + 1; + int current_page = selected / _listmaxshow; - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page); } diff --git a/src/gui/bouquetlist.h b/src/gui/bouquetlist.h index 04043e34e..94c7a617e 100644 --- a/src/gui/bouquetlist.h +++ b/src/gui/bouquetlist.h @@ -87,9 +87,9 @@ class CBouquetList : public CListHelpers unsigned int liststart; unsigned int listmaxshow; unsigned int numwidth; - int fheight; // Fonthoehe Bouquetlist-Inhalt - int theight; // Fonthoehe Bouquetlist-Titel - int footerHeight; + int item_height; + int header_height; + int footer_height; int width; int height; From b4bb9ef5eafb32ac903f0c82cd97ff3143b54b4c Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 13 Apr 2017 17:32:24 +0200 Subject: [PATCH 13/30] fix init cl_force_repaint --- src/gui/components/cc_frm_clock.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index a13193e09..f11a27f18 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -74,6 +74,9 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, setClockFormat(prformat_str, secformat_str); cl_col_text = COL_MENUCONTENT_TEXT; + //enable refresh of all segments on each interval as default + cl_force_repaint = true; + //init default font cl_font = font; cl_font_style = font_style; @@ -87,9 +90,6 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, //set default text background behavior cc_txt_save_screen = false; - //enable refresh of all segments on each interval as default - cl_force_repaint = true; - //set default running clock properties cl_interval = interval_seconds; cl_timer = NULL; From fb0dc47e35c06a790109b5c59094170ed7ee3e0b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 13 Apr 2017 23:28:35 +0200 Subject: [PATCH 14/30] CComponentsFooter: avoid crash because possible divisions by 0 --- src/gui/components/cc_frm_footer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 853b4465a..3532e05f3 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -111,6 +111,9 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con if (chain) chain->clear(); + if (label_count == 0) + return; + /* set general available full basic space for button chain, * in this case this is footer width */ @@ -372,7 +375,6 @@ void CComponentsFooter::paintButtons(const int& x_pos, this->setButtonFont(font); this->setContextButton(context_buttons); this->setButtonLabels(content, label_count, 0, label_width); - this->paint(do_save_bg); } From dbc4a487e4f81d1a702d5816c3b69d80ddac52bf Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 11 Apr 2017 07:16:54 +0200 Subject: [PATCH 15/30] CComponentsTimer: use sleep() instead mySleep() Had some problems with mySleep() related to select() which was used inside mySleep() --- src/gui/components/cc_timer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index a7b7e13ca..ab6523840 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -64,7 +64,7 @@ void CComponentsTimer::runSharedTimerAction() tm_mutex.lock(); OnTimer(); if (!tm_enable_nano) - mySleep(tm_interval); + sleep(tm_interval); else usleep((useconds_t)tm_interval); tm_mutex.unlock(); From f4762f78a5ed11ee4156e811393836698bf959d8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 16 Apr 2017 16:53:06 +0200 Subject: [PATCH 16/30] CComponentsChannelLogo: add missing type --- src/gui/components/cc_item_picture.cpp | 1 + src/gui/components/cc_types.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 1870092af..2900ceb3a 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -385,6 +385,7 @@ CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_p void CComponentsChannelLogo::init(const uint64_t& channelId, const std::string& channelName, bool allow_scale) { + cc_item_type = CC_ITEMTYPE_CHANNEL_LOGO; channel_name = ""; channel_id = 0; alt_pic_name = ""; diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 83b22f8d3..297cc5b66 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -41,6 +41,7 @@ typedef enum CC_ITEMTYPE_GENERIC, CC_ITEMTYPE_ITEM, CC_ITEMTYPE_PICTURE, + CC_ITEMTYPE_CHANNEL_LOGO, CC_ITEMTYPE_TEXT, CC_ITEMTYPE_TEXT_INFOBOX, CC_ITEMTYPE_SHAPE_SQUARE, From 29a01bd2d8975b56017caf342c3e651e3fde9417 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 16 Apr 2017 16:53:06 +0200 Subject: [PATCH 17/30] CComponentsChannelLogo: use separat var for pic name inside setChannel() picname is a class attribut and should not be touched here till new content exists. Btw. setChannel() is eqiuvalent to setPicture() from base class, so it makes sense to use setPicture() inside setChannel() after picname is known. Explicit call of initCCTitem() is not required. --- src/gui/components/cc_item_picture.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 2900ceb3a..257586e3c 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -416,6 +416,8 @@ void CComponentsChannelLogo::setAltLogo(const char* picture_name) void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::string& channelName) { need_init = true; + string image = pic_name; + if (channelId || !channelName.empty()){ if ((channel_id == channelId) && (channel_name == channelName)) need_init = false; @@ -426,16 +428,16 @@ void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::st int dummy; - has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, pic_name, &dummy, &dummy); + has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, image, &dummy, &dummy); if (!has_logo)//no logo was found, use altrenate icon or logo - pic_name = alt_pic_name; + image = alt_pic_name; //if logo or alternate image still not available, set has logo to false - has_logo = !pic_name.empty(); + has_logo = !image.empty(); //refresh object - initCCItem(); + setPicture(image); //set has_logo to false if no dimensions were detected if (width && height) From f499d3d38723e57f1e777c66f5c41e1cde3b5ea3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 16 Apr 2017 16:53:06 +0200 Subject: [PATCH 18/30] CComponentsPicture: init missing vars for old dimension dimensions --- src/gui/components/cc_item_picture.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 257586e3c..1826431d7 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -74,8 +74,8 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, //CComponents x = x_old = x_pos; y = y_old = y_pos; - width = dx = dxc = w; - height = dy = dyc = h; + width = width_old = dx = dxc = w; + height = height_old = dy = dyc = h; pic_name = pic_name_old = image_name; shadow = shadow_mode; shadow_w = OFFSET_SHADOW; From 069379930a6b5d7f25016513580fefedb02fc6c7 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 16 Apr 2017 16:53:06 +0200 Subject: [PATCH 19/30] CComponentsItem: add missing methodes for position setters Parent items were not considered for position calculation. --- src/gui/components/cc_item.cpp | 14 ++++++++++++++ src/gui/components/cc_item.h | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index b783f82d8..54c335c9a 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -261,6 +261,20 @@ bool CComponentsItem::isAdded() return false; } +void CComponentsItem::setXPos(const int& xpos) +{ + CCDraw::setXPos(xpos); + if (cc_parent) + cc_xr = cc_parent->getXPos() + x; +} + +void CComponentsItem::setYPos(const int& ypos) +{ + CCDraw::setYPos(ypos); + if (cc_parent) + cc_yr = cc_parent->getYPos() + y; +} + void CComponentsItem::setXPosP(const uint8_t& xpos_percent) { int x_tmp = cc_parent ? xpos_percent*cc_parent->getWidth() : xpos_percent*frameBuffer->getScreenWidth(); diff --git a/src/gui/components/cc_item.h b/src/gui/components/cc_item.h index 4f5f42da5..37677a813 100644 --- a/src/gui/components/cc_item.h +++ b/src/gui/components/cc_item.h @@ -134,6 +134,11 @@ class CComponentsItem : public CComponents ///returns current number of page location of current item, see: cc_page_number virtual u_int8_t getPageNumber(){return cc_page_number;}; + ///set screen x-position, parameter as int + virtual void setXPos(const int& xpos); + ///set screen y-position, parameter as int + virtual void setYPos(const int& ypos); + ///set screen x-position, parameter as uint8_t, percent x value related to current width of parent form or screen virtual void setXPosP(const uint8_t& xpos_percent); ///set screen y-position, parameter as uint8_t, percent y value related to current height of parent form or screen From 5361296ff48b4517eac502688d28479df69c1923 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 16 Apr 2017 16:53:06 +0200 Subject: [PATCH 20/30] CComponentsPicture: add explicit methodes to set image position --- src/gui/components/cc_item_picture.cpp | 18 ++++++++++++++++++ src/gui/components/cc_item_picture.h | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 1826431d7..4bcbc14a1 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -148,6 +148,24 @@ void CComponentsPicture::setHeight(const int& h, bool keep_aspect) initCCItem(); } +void CComponentsPicture::setXPos(const int& xpos) +{ + CComponentsItem::setXPos(xpos); + if (xpos == x) + return; + need_init = true; + initCCItem(); +} + +void CComponentsPicture::setYPos(const int& ypos) +{ + CComponentsItem::setYPos(ypos); + if (ypos == y) + return; + need_init = true; + initCCItem(); +} + void CComponentsPicture::initCCItem() { if (pic_name.empty() || !need_init){ diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index 0781b446e..7bf8953d0 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -162,6 +162,11 @@ class CComponentsPicture : public CComponentsItem ///set height of object and image related to current screen size, see also CComponentsItem::setHeightP(), parameter as uint8_t virtual void setHeightP(const uint8_t& h_percent){CComponentsItem::setHeightP(h_percent), do_scale = true; need_init = hasChanges(); initCCItem();} + ///set screen x-position, parameter as int + virtual void setXPos(const int& xpos); + ///set screen y-position, parameter as int + virtual void setYPos(const int& ypos); + ///return paint mode of internal image, true=image was painted, please do not to confuse with isPainted()! isPainted() is related to item itself. virtual inline bool isPicPainted(){return is_image_painted;}; From 9ac706b86c875556da906305d3307e086dc84186 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 17 Apr 2017 15:04:34 +0200 Subject: [PATCH 21/30] CComponentsForm: try to fix fit items inside forms Some items had offsets on screen. Was seen eg. in message windows. --- src/gui/components/cc_frm.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index d124f3395..87cb5f66d 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -375,6 +375,7 @@ void CComponentsForm::paintCCItems() if (cc_parent){ this_x = auto_x = cc_xr; this_y = auto_y = cc_yr; + w_parent_frame = cc_parent->getFrameThickness(); } //init and handle scrollbar @@ -482,7 +483,7 @@ void CComponentsForm::paintCCItems() //Is it too wide or too high, it will be shortened and displayed in the log. //This should be avoid! //checkwidth and adapt if required - int right_frm = (cc_parent ? cc_xr : x) + this_w - 2*fr_thickness; + int right_frm = (cc_parent ? cc_xr : x) + this_w/* - 2*fr_thickness*/; int right_item = cc_item->getRealXPos() + w_item; int w_diff = right_item - right_frm; int new_w = w_item - w_diff; From e1f51050b213c823919b6ad40773e4d7ce3ca94f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 17 Apr 2017 15:07:56 +0200 Subject: [PATCH 22/30] CComponentsWindow: try to fix header and footer arrangement Header and footer were placed too much on left side. --- src/gui/components/cc_frm_window.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 80455a5ad..acf06e1b4 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -201,7 +201,7 @@ void CComponentsWindow::initHeader() //set header properties //TODO: assigned properties with internal header objekt have no effect! if (ccw_head){ ccw_head->setWidth(width-2*fr_thickness); - ccw_head->setPos(0, 0); + ccw_head->setPos(fr_thickness, fr_thickness); ccw_head->setIcon(ccw_icon_name); ccw_head->setCaption(ccw_caption, ccw_align_mode, ccw_col_head_text); ccw_head->setContextButton(ccw_buttons); @@ -219,8 +219,8 @@ void CComponentsWindow::initFooter() if (ccw_footer){ if (ccw_h_footer) ccw_footer->setHeight(ccw_h_footer); - ccw_footer->setPos(0, cc_yr + height - ccw_footer->getHeight()- fr_thickness); - ccw_footer->setWidth(width-2*fr_thickness); + ccw_footer->setPos(cc_xr + fr_thickness, cc_yr + height - ccw_footer->getHeight()- fr_thickness); + ccw_footer->setWidth(width/*-2*fr_thickness*/); ccw_footer->enableShadow(false/*shadow*/); ccw_footer->setCorner(corner_rad-fr_thickness, CORNER_BOTTOM); ccw_footer->setButtonFont(ccw_button_font); From 42db55e61de803e8dc610e754ded097e8d31b02a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 17 Apr 2017 15:51:54 +0200 Subject: [PATCH 23/30] CComponentsHeader: Reduce offset between clock and right border. Was too large --- src/gui/components/cc_frm_header.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index acdee9363..351b6cc3e 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -475,7 +475,7 @@ void CComponentsHeader::initCaption() int clock_w = cch_cl_enable ? cch_cl_obj->getWidth() : 0; //set x position of clock - cch_cl_obj->setXPos(width - buttons_w - clock_w - cch_offset); + cch_cl_obj->setXPos(width - buttons_w - clock_w); //set required width of caption object cc_text_w -= (clock_w + cch_offset); From cbba7b78f46ded09a80940579cc203dbeeb3ee96 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 17 Apr 2017 16:36:02 +0200 Subject: [PATCH 24/30] CComponentsFrmClock: remove unnecessary call of cch_cl_obj->setYPos() --- src/gui/components/cc_frm_header.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 351b6cc3e..f8a1038cd 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -413,7 +413,6 @@ void CComponentsHeader::initClock() //set clock form properties if (cch_cl_obj){ - cch_cl_obj->setYPos(cch_items_y); cch_cl_obj->setHeight(height); //disallow paint of clock, if disabled and exit method From 04f9468ddb4eca0c3b8b2787d9016b06554638af Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 17 Apr 2017 16:42:24 +0200 Subject: [PATCH 25/30] CComponentsFrmClock: use correct setHeight() --- src/gui/components/cc_frm_clock.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index f11a27f18..297406e9f 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -59,8 +59,8 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, { cc_item_type = CC_ITEMTYPE_FRM_CLOCK; - x = x_pos; - y = y_pos; + x = cc_xr = x_old = x_pos; + y = cc_yr = y_old = y_pos; shadow = shadow_mode; shadow_w = OFFSET_SHADOW; @@ -84,8 +84,8 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, initClockFont(0, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight()); //init general clock dimensions - height = cl_font->getHeight(); - width = cl_font->getRenderWidth(cl_format_str); + height = height_old= cl_font->getHeight(); + width = width_old = cl_font->getRenderWidth(cl_format_str); //set default text background behavior cc_txt_save_screen = false; @@ -429,9 +429,9 @@ void CComponentsFrmClock::setHeight(const int& h) int f_height = cl_font->getHeight(); if (h != f_height){ dprintf(DEBUG_DEBUG, "\033[33m[CComponentsFrmClock]\t[%s - %d], font height is different than current height [%d], using [%d] ...\033[0m\n", __func__, __LINE__, h, f_height); - CCDraw::setHeight(f_height); + CComponentsItem::setHeight(f_height); }else - CCDraw::setHeight(h); + CComponentsItem::setHeight(h); initCCLockItems(); } @@ -443,9 +443,9 @@ void CComponentsFrmClock::setWidth(const int& w) int f_width = cl_font->getRenderWidth(cl_format_str); if (w != f_width){ dprintf(DEBUG_NORMAL, "\033[33m[CComponentsFrmClock]\t[%s - %d], font width is different than current width [%d], using [%d] ...\033[0m\n", __func__, __LINE__, w, f_width); - CCDraw::setWidth(f_width); + CComponentsItem::setWidth(f_width); }else - CCDraw::setWidth(w); + CComponentsItem::setWidth(w); initCCLockItems(); } From b8822803d9d59a95b8d54dbb10108ee623af61c3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 17 Apr 2017 16:56:42 +0200 Subject: [PATCH 26/30] CSignalBar: use global offsets for init of min height --- src/gui/components/cc_frm_signalbars.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index 018ad066f..6ffd03c40 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -34,7 +34,7 @@ #include #include -#define SB_MIN_HEIGHT 12 +#define SB_MIN_HEIGHT OFFSET_INNER_MID #define REF_PERCENT_TXT "100% " using namespace std; @@ -55,8 +55,8 @@ void CSignalBar::initVarSigBar(const int& xpos, const int& ypos, const int& w, c corner_rad = 0; corner_type = 0; - append_x_offset = 2; - append_y_offset = 2; + append_x_offset = OFFSET_INNER_MIN; + append_y_offset = OFFSET_INNER_MIN; sb_scale_height = -1; dy_font = CNeutrinoFonts::getInstance(); From 0e94c6830b25e91337e560eeacf82176af157881 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 17 Apr 2017 17:00:48 +0200 Subject: [PATCH 27/30] CComponentsForm: use global default width for scrollbar --- src/gui/components/cc_frm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 87cb5f66d..c202c6742 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -68,7 +68,7 @@ CComponentsForm::CComponentsForm( const int x_pos, const int y_pos, const int w, page_count = 1; cur_page = 0; sb = NULL; - w_sb = 15; + w_sb = SCROLLBAR_WIDTH; page_scroll_mode = PG_SCROLL_M_UP_DOWN_KEY; From f74724ceb655b6f04a7b029ab58fa526423bbfd6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 17 Apr 2017 17:41:34 +0200 Subject: [PATCH 28/30] CSignalBox: remove CC_APPEND flag Should be gradually removed in all affected classes --- src/gui/components/cc_frm_signalbars.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index 6ffd03c40..1ef19cbd4 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -330,7 +330,7 @@ void CSignalBox::initSignalItems() sbar->setScaleHeight(scale_h); sbar->enableTboxSaveScreen(cc_txt_save_screen); - snrbar->setDimensionsAll(vertical ? sbar_x : CC_APPEND, vertical ? CC_APPEND : 1, sbar_w, sbar_h); + snrbar->setDimensionsAll(vertical ? sbar_x : sbar->getXPos() + sbar->getWidth() + append_x_offset, vertical ? sbar->getYPos() + sbar->getHeight() + append_y_offset : 1, sbar_w, sbar_h); snrbar->setFrontEnd(sbx_frontend); snrbar->setTextColor(sbx_caption_color); snrbar->setActiveColor(sbx_active_color); From f6482eb04260945b6d75a3cc62b25b1909adb989 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 18 Apr 2017 19:09:32 +0200 Subject: [PATCH 29/30] fix download pic from ssl url --- src/driver/pictureviewer/pictureviewer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 8b22b68aa..f93779996 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -123,6 +123,7 @@ std::string CPictureViewer::DownloadImage(std::string url) curl_easy_setopt(ch, CURLOPT_URL, url.c_str()); curl_easy_setopt(ch, CURLOPT_CONNECTTIMEOUT, 3); curl_easy_setopt(ch, CURLOPT_TIMEOUT, 4); + curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 0L); CURLcode res = curl_easy_perform(ch); if (res != CURLE_OK){ printf("[%s] curl_easy_perform() failed:%s\n",__func__, curl_easy_strerror(res)); From a3bf23d9c90996fc414df4a057304ab8abc1b236 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 19 Apr 2017 17:19:43 +0200 Subject: [PATCH 30/30] try to fix version check for avformat codecpar --- src/driver/audiodec/ffmpegdec.cpp | 8 ++++---- src/driver/record.cpp | 6 +++--- src/driver/streamts.cpp | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index 695f67d89..dc49aea02 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -223,7 +223,7 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state, Status=DATA_ERR; return Status; } -#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 )) AVCodecContext *c = avc->streams[best_stream]->codec; #else AVCodecContext *c = avcodec_alloc_context3(codec); @@ -460,7 +460,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover) if (!is_stream) { GetMeta(avc->metadata); for(unsigned int i = 0; i < avc->nb_streams; i++) { -#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 )) if (avc->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) #else if (avc->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) @@ -481,7 +481,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover) DeInit(); return false; } -#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 )) if (!codec) codec = avcodec_find_decoder(avc->streams[best_stream]->codec->codec_id); samplerate = avc->streams[best_stream]->codec->sample_rate; @@ -511,7 +511,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover) printf("CFfmpegDec: format %s (%s) duration %ld\n", avc->iformat->name, type_info.c_str(), total_time); for(unsigned int i = 0; i < avc->nb_streams; i++) { -#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 )) if (avc->streams[i]->codec->bit_rate > 0) bitrate += avc->streams[i]->codec->bit_rate; #else diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 0c234cbe6..ace7de81e 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -1943,7 +1943,7 @@ void CStreamRec::FillMovieInfo(CZapitChannel * /*channel*/, APIDList & /*apid_li for (unsigned i = 0; i < ofcx->nb_streams; i++) { AVStream *st = ofcx->streams[i]; -#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 )) AVCodecContext * codec = st->codec; #else AVCodecParameters * codec = st->codecpar; @@ -2176,7 +2176,7 @@ bool CStreamRec::Open(CZapitChannel * channel) stream_index = -1; int stid = 0x200; for (unsigned i = 0; i < ifcx->nb_streams; i++) { -#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 )) AVCodecContext * iccx = ifcx->streams[i]->codec; AVStream *ost = avformat_new_stream(ofcx, iccx->codec); avcodec_copy_context(ost->codec, iccx); @@ -2232,7 +2232,7 @@ void CStreamRec::run() break; if (pkt.stream_index < 0) continue; -#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 )) AVCodecContext *codec = ifcx->streams[pkt.stream_index]->codec; #else AVCodecParameters *codec = ifcx->streams[pkt.stream_index]->codecpar; diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index d2f4a2d3c..9d23e25fc 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -846,7 +846,7 @@ bool CStreamStream::Open() av_dict_copy(&ofcx->metadata, ifcx->metadata, 0); int stid = 0x200; for (unsigned i = 0; i < ifcx->nb_streams; i++) { -#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 )) AVCodecContext * iccx = ifcx->streams[i]->codec; AVStream *ost = avformat_new_stream(ofcx, iccx->codec); avcodec_copy_context(ost->codec, iccx); @@ -919,7 +919,7 @@ void CStreamStream::run() if (pkt.stream_index < 0) continue; -#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 )) AVCodecContext *codec = ifcx->streams[pkt.stream_index]->codec; #else AVCodecParameters *codec = ifcx->streams[pkt.stream_index]->codecpar;