From 32a840fe83842ddbb715735e531b460af7fd96ce Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 14:39:03 +0100 Subject: [PATCH 01/30] add CListHelpers class this can be used to factor out duplicate code implementations from all the various channel-, bouquet-, eventlists etc... Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/22c09ce84e863c4bdc2e7d84ad5526e48b41a12e Author: Stefan Seyfried Date: 2016-01-16 (Sat, 16 Jan 2016) ------------------ This commit was generated by Migit --- src/gui/widget/Makefile.am | 1 + src/gui/widget/listhelpers.cpp | 71 ++++++++++++++++++++++++++++++++++ src/gui/widget/listhelpers.h | 30 ++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 src/gui/widget/listhelpers.cpp create mode 100644 src/gui/widget/listhelpers.h diff --git a/src/gui/widget/Makefile.am b/src/gui/widget/Makefile.am index ea77f8b29..0788d0319 100644 --- a/src/gui/widget/Makefile.am +++ b/src/gui/widget/Makefile.am @@ -25,6 +25,7 @@ libneutrino_gui_widget_a_SOURCES = \ keyboard_input.cpp \ listbox.cpp \ listframe.cpp \ + listhelpers.cpp \ menue.cpp \ messagebox.cpp \ mountchooser.cpp \ diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp new file mode 100644 index 000000000..0f368a698 --- /dev/null +++ b/src/gui/widget/listhelpers.cpp @@ -0,0 +1,71 @@ +/* + Helper functions for various list implementations in neutrino + Copyright (C) 2016 Stefan Seyfried + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see http://www.gnu.org/licenses/ +*/ + +#include +#include "listhelpers.h" + +#include +#include + +template int CListHelpers::UpDownKey(T list, neutrino_msg_t msg, int lines, int sel) +{ + int step; + if (list.empty()) + return -1; + + if (msg >= CRCInput::RC_MaxRC) { + printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); + return -1; + } + int key = (int)msg; + if (key == g_settings.key_pageup) + step = -lines; + else if (key == g_settings.key_pagedown) + step = lines; + else if (msg == CRCInput::RC_up) + step = -1; + else if (msg == CRCInput::RC_down) + step = 1; + else { + printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); + return -1; + } + int size = (int)list.size(); /* bigger than 0, because we checked for empty() before */ + // printf("CListHelpers:%s: key 0x%04lx lines %d size %d sel %d\n", __func__, msg, lines, size, sel); + int new_sel = sel + step; + if (new_sel < 0) { + if (sel != 0 && step != 1) + new_sel = 0; + else + new_sel = size - 1; + } + else if (new_sel > size - 1) { + if (sel != size - 1) + new_sel = size - 1; + else + new_sel = 0; + } + return new_sel; +} + +/* all used versions need to be prototyped here, to avoid linker errors */ +template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); +template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); +template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); diff --git a/src/gui/widget/listhelpers.h b/src/gui/widget/listhelpers.h new file mode 100644 index 000000000..4ac2274cc --- /dev/null +++ b/src/gui/widget/listhelpers.h @@ -0,0 +1,30 @@ +/* + Helper functions for various list implementations in neutrino + Copyright (C) 2016 Stefan Seyfried + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see http://www.gnu.org/licenses/ +*/ + + +#ifndef __LISTHELPERS__ +#define __LISTHELPERS__ + +class CListHelpers +{ + public: + template int UpDownKey(T list, neutrino_msg_t k, int lines, int sel); +}; +#endif From cd368d8bfbd60acaf51d3af7ab7d75c6e1a14d42 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 15:01:29 +0100 Subject: [PATCH 02/30] use CListHelpers to remove duplicated code CListHelpers::UpDownKey() allows to remove duplicated code from channellist, bouquetlist and bouqueteditor. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c9e72e654f73252c37404449ed1028b3525e6fec Author: Stefan Seyfried Date: 2016-01-16 (Sat, 16 Jan 2016) ------------------ This commit was generated by Migit --- src/gui/bedit/bouqueteditor_bouquets.cpp | 43 ++++-------------------- src/gui/bedit/bouqueteditor_bouquets.h | 3 +- src/gui/bedit/bouqueteditor_channels.cpp | 42 ++++------------------- src/gui/bedit/bouqueteditor_channels.h | 3 +- src/gui/bouquetlist.cpp | 42 ++++------------------- src/gui/bouquetlist.h | 3 +- src/gui/channellist.cpp | 30 ++++------------- src/gui/channellist.h | 3 +- 8 files changed, 33 insertions(+), 136 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index c588464f0..3f829e2b8 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -2,15 +2,7 @@ Neutrino-GUI - DBoxII-Project Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - + Copyright (C) 2009,2011,2013,2016 Stefan Seyfried License: GPL @@ -166,7 +158,7 @@ void CBEBouquetWidget::hide() void CBEBouquetWidget::updateSelection(unsigned int newpos) { - if(newpos == selected) + if (newpos == selected || newpos == (unsigned int)-1) return; unsigned int prev_selected = selected; @@ -272,34 +264,11 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* cancelMoveBouquet(); } } - else if (msg==CRCInput::RC_up || msg==(neutrino_msg_t)g_settings.key_pageup) + else if (msg == CRCInput::RC_up || msg == (neutrino_msg_t)g_settings.key_pageup || + msg == CRCInput::RC_down || msg == (neutrino_msg_t)g_settings.key_pagedown) { - if (!(Bouquets->empty())) { - int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected - step; - - if (new_selected < 0) { - if (selected != 0 && step != 1) - new_selected = 0; - else - new_selected = Bouquets->size() - 1; - } - updateSelection(new_selected); - } - } - else if (msg==CRCInput::RC_down || msg==(neutrino_msg_t)g_settings.key_pagedown) - { - if (!(Bouquets->empty())) { - int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected + step; - if (new_selected > (int) Bouquets->size() - 1) { - if ((selected != Bouquets->size() - 1)) - new_selected = Bouquets->size() - 1; - else - new_selected = 0; - } - updateSelection(new_selected); - } + int new_selected = UpDownKey(*Bouquets, msg, listmaxshow, selected); + updateSelection(new_selected); } else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) { if (!(Bouquets->empty())) { diff --git a/src/gui/bedit/bouqueteditor_bouquets.h b/src/gui/bedit/bouqueteditor_bouquets.h index 1c935b587..256bd25bb 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.h +++ b/src/gui/bedit/bouqueteditor_bouquets.h @@ -39,6 +39,7 @@ #include #include #include +#include #include /* class for handling when bouquets changed. */ @@ -51,7 +52,7 @@ public: virtual void onBouquetsChanged() {}; }; -class CBEBouquetWidget : public CMenuTarget +class CBEBouquetWidget : public CMenuTarget, public CListHelpers { private: diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 3a6a14ba5..8a9ef7157 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -5,14 +5,7 @@ Homepage: http://dbox.cyberphoria.org/ Copyright (C) 2011 CoolStream International Ltd - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - + Copyright (C) 2009,2011,2013,2016 Stefan Seyfried License: GPL @@ -283,7 +276,7 @@ void CBEChannelWidget::hide() void CBEChannelWidget::updateSelection(unsigned int newpos) { - if(newpos == selected) + if (newpos == selected || newpos == (unsigned int)-1) return; unsigned int prev_selected = selected; @@ -360,34 +353,11 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* cancelMoveChannel(); } } - else if (msg==CRCInput::RC_up || msg==(neutrino_msg_t)g_settings.key_pageup) + else if (msg == CRCInput::RC_up || msg == (neutrino_msg_t)g_settings.key_pageup || + msg == CRCInput::RC_down || msg == (neutrino_msg_t)g_settings.key_pagedown) { - if (!(Channels->empty())) { - int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected - step; - - if (new_selected < 0) { - if (selected != 0 && step != 1) - new_selected = 0; - else - new_selected = Channels->size() - 1; - } - updateSelection(new_selected); - } - } - else if (msg==CRCInput::RC_down || msg==(neutrino_msg_t)g_settings.key_pagedown) - { - if (!(Channels->empty())) { - int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected + step; - if (new_selected > (int) Channels->size() - 1) { - if ((selected != Channels->size() - 1)) - new_selected = Channels->size() - 1; - else - new_selected = 0; - } - updateSelection(new_selected); - } + int new_selected = UpDownKey(*Channels, msg, listmaxshow, selected); + updateSelection(new_selected); } else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) { if (!(Channels->empty())) { diff --git a/src/gui/bedit/bouqueteditor_channels.h b/src/gui/bedit/bouqueteditor_channels.h index fd17636fb..d13b9aa74 100644 --- a/src/gui/bedit/bouqueteditor_channels.h +++ b/src/gui/bedit/bouqueteditor_channels.h @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -42,7 +43,7 @@ #include #include -class CBEChannelWidget : public CMenuTarget +class CBEChannelWidget : public CMenuTarget, public CListHelpers { private: diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 59d357aa9..567438610 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -2,15 +2,7 @@ Neutrino-GUI - DBoxII-Project Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - + Copyright (C) 2009,2011,2013,2015-2016 Stefan Seyfried License: GPL @@ -391,6 +383,8 @@ const struct button_label CBouquetListButtons[4] = void CBouquetList::updateSelection(int newpos) { + if (newpos < 0) /* to avoid all callers having to check */ + return; if((int) selected != newpos) { int prev_selected = selected; unsigned int oldliststart = liststart; @@ -528,33 +522,11 @@ int CBouquetList::show(bool bShowChannelList) if (!Bouquets.empty()) updateSelection(Bouquets.size()-1); } - else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup) + else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup || + msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { - if (!Bouquets.empty()) { - int step = ((int) msg == g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected - step; - if (new_selected < 0) { - if (selected != 0 && step != 1) - new_selected = 0; - else - new_selected = Bouquets.size() - 1; - } - updateSelection(new_selected); - } - } - else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) - { - if (!Bouquets.empty()) { - int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected + step; - if (new_selected > (int) Bouquets.size() - 1) { - if ((selected != Bouquets.size() - 1)) - new_selected = Bouquets.size() - 1; - else - new_selected = 0; - } - updateSelection(new_selected); - } + int new_selected = UpDownKey(Bouquets, msg, listmaxshow, selected); + updateSelection(new_selected); } else if(msg == (neutrino_msg_t)g_settings.key_bouquet_up || msg == (neutrino_msg_t)g_settings.key_bouquet_down) { if(bShowChannelList) { diff --git a/src/gui/bouquetlist.h b/src/gui/bouquetlist.h index e767a6c47..1ba8a199e 100644 --- a/src/gui/bouquetlist.h +++ b/src/gui/bouquetlist.h @@ -34,6 +34,7 @@ #define __bouquetlist__ #include +#include #include #include @@ -77,7 +78,7 @@ class CBouquet }; -class CBouquetList +class CBouquetList : public CListHelpers { private: CFrameBuffer *frameBuffer; diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 1540fced1..ad3aefdc4 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2,7 +2,7 @@ Neutrino-GUI - DBoxII-Project Copyright (C) 2001 Steffen Hehn 'McClean' - Copyright (C) 2007-2015 Stefan Seyfried + Copyright (C) 2007-2016 Stefan Seyfried Kommentar: @@ -728,31 +728,13 @@ int CChannelList::show() else if (!empty && msg == (neutrino_msg_t) g_settings.key_list_end) { actzap = updateSelection((*chanlist).size()-1); } - else if (!empty && (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup)) + else if (!empty && (msg == CRCInput::RC_up || (int)msg == g_settings.key_pageup || + msg == CRCInput::RC_down || (int)msg == g_settings.key_pagedown)) { displayList = 1; - int step = ((int) msg == g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected - step; - if (new_selected < 0) { - if (selected != 0 && step != 1) - new_selected = 0; - else - new_selected = (*chanlist).size() - 1; - } - actzap = updateSelection(new_selected); - } - else if (!empty && (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown)) - { - displayList = 1; - int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected + step; - if (new_selected > (int) (*chanlist).size() - 1) { - if ((selected != (*chanlist).size() - 1)) - new_selected = (*chanlist).size() - 1; - else - new_selected = 0; - } - actzap = updateSelection(new_selected); + int new_selected = UpDownKey((*chanlist), msg, listmaxshow, selected); + if (new_selected >= 0) + actzap = updateSelection(new_selected); } else if (!edit_state && (msg == (neutrino_msg_t)g_settings.key_bouquet_up || msg == (neutrino_msg_t)g_settings.key_bouquet_down)) { diff --git a/src/gui/channellist.h b/src/gui/channellist.h index 96014b6b4..21d2babda 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -63,7 +64,7 @@ enum { class CBouquet; -class CChannelList +class CChannelList : public CListHelpers { private: enum state_ From e80e05a986d5b124a26ed45ca9f686762d726b0d Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 15:38:04 +0100 Subject: [PATCH 03/30] eventlist: use CListHelpers::UpDownKey Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5550f89853a4b4a87feb84c8a740df99e740db8f Author: Stefan Seyfried Date: 2016-01-16 (Sat, 16 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/eventlist.cpp | 27 ++++----------------------- src/gui/eventlist.h | 3 ++- src/gui/widget/listhelpers.cpp | 1 + 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 49f76757d..7f6560d49 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -4,7 +4,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Homepage: http://dbox.cyberphoria.org/ - Copyright (C) 2009-2014 Stefan Seyfried + Copyright (C) 2009-2016 Stefan Seyfried License: GPL @@ -359,7 +359,6 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { bool paint_buttonbar = false; //function bar - int step = 0; int prev_selected = selected; // TODO: do we need this at all? Search button is always painted IIUC... if ((g_settings.key_channelList_addremind != (int)CRCInput::RC_nokey) || @@ -367,27 +366,9 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna ((g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) && (g_settings.key_channelList_addrecord != (int)CRCInput::RC_nokey))) paint_buttonbar = true; - - if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup) - { - step = ((int) msg == g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - selected -= step; - if((prev_selected-step) < 0) // because of uint - selected = evtlist.size() - 1; - paintDescription(selected); - } - else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) - { - step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - selected += step; - - if(selected >= evtlist.size()) - { - if (((evtlist.size() / listmaxshow) + 1) * listmaxshow == evtlist.size() + listmaxshow) // last page has full entries - selected = 0; - else - selected = ((step == (int)listmaxshow) && (selected < (((evtlist.size() / listmaxshow) + 1) * listmaxshow))) ? (evtlist.size() - 1) : 0; - } + int new_sel = UpDownKey(evtlist, msg, listmaxshow, selected); + if (new_sel >= 0) { + selected = new_sel; paintDescription(selected); } paintItem(prev_selected - liststart, channel_id); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 9bda01658..a5d9b9737 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -40,11 +40,12 @@ #include "infoviewer.h" #include "widget/menue.h" +#include "widget/listhelpers.h" #include -class CEventList +class CEventList : public CListHelpers { // Eventfinder start public: diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index 0f368a698..7ad2e1cec 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -69,3 +69,4 @@ template int CListHelpers::UpDownKey(T list, neutrino_msg_t msg, int l template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); +template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); From 6b9447a11bd155ddea3e3bf626e6bf7a8f181bc9 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 17:48:30 +0100 Subject: [PATCH 04/30] CListHelpers: allow UpDownKey with int type, too Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/57f20fcbb78c23ec9833e18efb524b5239db7c98 Author: Stefan Seyfried Date: 2016-01-16 (Sat, 16 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/listhelpers.cpp | 25 ++++++++++++++++++------- src/gui/widget/listhelpers.h | 10 +++++++++- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index 7ad2e1cec..c06c3504f 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -24,10 +24,10 @@ #include #include -template int CListHelpers::UpDownKey(T list, neutrino_msg_t msg, int lines, int sel) +static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) { int step; - if (list.empty()) + if (size <= 0) /* list.empty() or similar... */ return -1; if (msg >= CRCInput::RC_MaxRC) { @@ -47,7 +47,6 @@ template int CListHelpers::UpDownKey(T list, neutrino_msg_t msg, int l printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); return -1; } - int size = (int)list.size(); /* bigger than 0, because we checked for empty() before */ // printf("CListHelpers:%s: key 0x%04lx lines %d size %d sel %d\n", __func__, msg, lines, size, sel); int new_sel = sel + step; if (new_sel < 0) { @@ -65,8 +64,20 @@ template int CListHelpers::UpDownKey(T list, neutrino_msg_t msg, int l return new_sel; } +int CListHelpers::_UpDownKey(int size, neutrino_msg_t msg, int lines, int sel, _id) +{ + return upDownKey(size, msg, lines, sel); +} + +template int CListHelpers::_UpDownKey(T list, neutrino_msg_t msg, int lines, int sel, _id) +{ + return upDownKey(list.size(), msg, lines, sel); +} + /* all used versions need to be prototyped here, to avoid linker errors */ -template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); -template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); -template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); -template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); +/* helper macro for the prototypes */ +#define updown_t(x) template int CListHelpers::_UpDownKey(x, neutrino_msg_t, int, int, _id) +updown_t(std::vector); +updown_t(std::vector); +updown_t(std::vector); +updown_t(std::vector); diff --git a/src/gui/widget/listhelpers.h b/src/gui/widget/listhelpers.h index 4ac2274cc..228bd88d7 100644 --- a/src/gui/widget/listhelpers.h +++ b/src/gui/widget/listhelpers.h @@ -21,10 +21,18 @@ #ifndef __LISTHELPERS__ #define __LISTHELPERS__ +/* allow to trick the compiler into overriding template definitions */ +template struct _id { typedef T type; }; class CListHelpers { public: - template int UpDownKey(T list, neutrino_msg_t k, int lines, int sel); + template int UpDownKey(T list, neutrino_msg_t k, int lines, int sel) { + return _UpDownKey(list, k, lines, sel, _id()); + } + private: + /* stackoverflow.com/questions/3052579 */ + template int _UpDownKey(T list, neutrino_msg_t k, int lines, int sel, _id); + int _UpDownKey(int list, neutrino_msg_t k, int lines, int sel, _id); }; #endif From c9d30661cc70e799b8ec03d4510551118c36a006 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 17:51:28 +0100 Subject: [PATCH 05/30] upnpbrowser: use CListHelpers::UpDownKey Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/663c7e3cfc3e8269d9378a4ca08d374525829878 Author: Stefan Seyfried Date: 2016-01-16 (Sat, 16 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/upnpbrowser.cpp | 37 ++++++---------------------------- src/gui/upnpbrowser.h | 3 ++- src/gui/widget/listhelpers.cpp | 2 ++ 3 files changed, 10 insertions(+), 32 deletions(-) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 509300bb0..dd18cee43 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -2,16 +2,7 @@ Neutrino-GUI - DBoxII-Project UPnP Browser (c) 2007 by Jochen Friedrich - - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - + (c) 2009-2011,2016 Stefan Seyfried License: GPL @@ -436,6 +427,8 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) void CUpnpBrowserGui::updateDeviceSelection(int newpos) { + if (newpos < 0) /* do not explode if called with -1 arg... */ + return; if((int) m_selecteddevice != newpos) { int prev_selected = m_selecteddevice; unsigned int oldliststart = m_deviceliststart; @@ -488,28 +481,10 @@ void CUpnpBrowserGui::selectDevice() else if (msg_repeatok == (neutrino_msg_t) g_settings.key_list_end) { updateDeviceSelection(m_devices.size()-1); } - else if (msg_repeatok == CRCInput::RC_up || (int) msg == g_settings.key_pageup) + else if (msg_repeatok == CRCInput::RC_up || (int)msg == g_settings.key_pageup || + msg_repeatok == CRCInput::RC_down || (int)msg == g_settings.key_pagedown) { - int step = ((int) msg == g_settings.key_pageup) ? m_listmaxshow : 1; // browse or step 1 - int new_selected = m_selecteddevice - step; - if (new_selected < 0) { - if (m_selecteddevice != 0 && step != 1) - new_selected = 0; - else - new_selected = m_devices.size() - 1; - } - updateDeviceSelection(new_selected); - } - else if (msg_repeatok == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) - { - int step = ((int) msg == g_settings.key_pagedown) ? m_listmaxshow : 1; // browse or step 1 - int new_selected = m_selecteddevice + step; - if (new_selected > (int) m_devices.size() - 1) { - if ((m_selecteddevice != m_devices.size() - 1)) - new_selected = m_devices.size() - 1; - else - new_selected = 0; - } + int new_selected = UpDownKey(m_devices, msg_repeatok, m_listmaxshow, m_selecteddevice); updateDeviceSelection(new_selected); } else if (msg == CRCInput::RC_right || msg == CRCInput::RC_ok) diff --git a/src/gui/upnpbrowser.h b/src/gui/upnpbrowser.h index 1e7f78051..940122d6a 100644 --- a/src/gui/upnpbrowser.h +++ b/src/gui/upnpbrowser.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -66,7 +67,7 @@ struct UPnPEntry int type; }; -class CUpnpBrowserGui : public CMenuTarget +class CUpnpBrowserGui : public CMenuTarget, public CListHelpers { public: CUpnpBrowserGui(); diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index c06c3504f..1249cc503 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -23,6 +23,7 @@ #include #include +#include static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) { @@ -81,3 +82,4 @@ updown_t(std::vector); updown_t(std::vector); updown_t(std::vector); updown_t(std::vector); +updown_t(std::vector); From 0faf26485bf6537017b216189c1f9b7a778b039b Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 18:18:50 +0100 Subject: [PATCH 06/30] timerlist: use CListHelpers remove duplicated code and use CListHelpers::UpDownKey(). Some variable types had to be changed to avoid typecasts, as a result (int) casts to foo.size() had to be added :-) Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/8f95f259c123927a2800a90484fab5f5ab186838 Author: Stefan Seyfried Date: 2016-01-16 (Sat, 16 Jan 2016) ------------------ This commit was generated by Migit --- src/gui/timerlist.cpp | 62 +++++++--------------------------- src/gui/timerlist.h | 7 ++-- src/gui/widget/listhelpers.cpp | 2 ++ 3 files changed, 19 insertions(+), 52 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 906424103..a0a5faac4 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -458,7 +458,7 @@ void CTimerList::updateEvents(void) height = theight+listmaxshow*fheight*2+footerHeight; // recalc height } - if (selected==timerlist.size() && !(timerlist.empty())) + if (!timerlist.empty() && selected == (int)timerlist.size()) { selected=timerlist.size()-1; liststart = (selected/listmaxshow)*listmaxshow; @@ -519,58 +519,22 @@ int CTimerList::show() loop=false; } - else if ((msg == CRCInput::RC_up || msg == (unsigned int)g_settings.key_pageup) && !(timerlist.empty())) + else if (!timerlist.empty() && + (msg == CRCInput::RC_up || (int)msg == g_settings.key_pageup || + msg == CRCInput::RC_down || (int)msg == g_settings.key_pagedown)) { - int step = 0; int prev_selected = selected; - - step = (msg == (unsigned int)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - selected -= step; - if((prev_selected-step) < 0) // because of uint - selected = timerlist.size() - 1; - - paintItem(prev_selected - liststart); - unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if (oldliststart!=liststart) - { + int oldliststart = liststart; + selected = UpDownKey(timerlist, msg, listmaxshow, selected); + if (selected < 0) /* UpDownKey error */ + selected = prev_selected; + liststart = (selected / listmaxshow) * listmaxshow; + if (oldliststart != liststart) paint(); - } - else - { + else { + paintItem(prev_selected - liststart); paintItem(selected - liststart); } - - paintFoot(); - } - else if ((msg == CRCInput::RC_down || msg == (unsigned int)g_settings.key_pagedown) && !(timerlist.empty())) - { - unsigned int step = 0; - int prev_selected = selected; - - step = (msg == (unsigned int)g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - selected += step; - - if(selected >= timerlist.size()) - { - if (((timerlist.size() / listmaxshow) + 1) * listmaxshow == timerlist.size() + listmaxshow) // last page has full entries - selected = 0; - else - selected = ((step == listmaxshow) && (selected < (((timerlist.size() / listmaxshow) + 1) * listmaxshow))) ? (timerlist.size() - 1) : 0; - } - paintItem(prev_selected - liststart); - - unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if (oldliststart!=liststart) - { - paint(); - } - else - { - paintItem(selected - liststart); - } - paintFoot(); } else if ((msg == CRCInput::RC_right || msg == CRCInput::RC_ok || msg==CRCInput::RC_blue) && !(timerlist.empty())) @@ -719,7 +683,7 @@ void CTimerList::paintItem(int pos) //selected item frameBuffer->paintBoxRel(x,ypos, real_width, 2*fheight, bgcolor, RADIUS_MID); - if (liststart+pos #include +#include #include @@ -43,7 +44,7 @@ class CTimerdClient; -class CTimerList : public CMenuTarget +class CTimerList : public CMenuTarget, public CListHelpers { private: CFrameBuffer *frameBuffer; @@ -54,8 +55,8 @@ class CTimerList : public CMenuTarget int fheight; // fontheight content int theight; // fontheight titel int footerHeight; - unsigned int selected; - unsigned int liststart; + int selected; + int liststart; unsigned int listmaxshow; bool visible; diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index 1249cc503..9d3adf3ab 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -24,6 +24,7 @@ #include #include #include +#include static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) { @@ -83,3 +84,4 @@ updown_t(std::vector); updown_t(std::vector); updown_t(std::vector); updown_t(std::vector); +updown_t(std::vector); From 3a8514bb77c836f62eaa827883570f1eb2738cd6 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 18:30:32 +0100 Subject: [PATCH 07/30] listbox: use CListHelpers Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/156acb1039545cf2c74db0f4c76c57851762aa35 Author: Stefan Seyfried Date: 2016-01-16 (Sat, 16 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/listbox.cpp | 32 ++++++-------------------------- src/gui/widget/listbox.h | 3 ++- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/src/gui/widget/listbox.cpp b/src/gui/widget/listbox.cpp index 836ff5d7f..683fbac03 100644 --- a/src/gui/widget/listbox.cpp +++ b/src/gui/widget/listbox.cpp @@ -186,33 +186,13 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/) { loop = false; } - else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup) + else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup || + msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { - if(getItemCount()!=0) { - int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected - step; - - if (new_selected < 0) { - if (selected != 0 && step != 1) - new_selected = 0; - else - new_selected = getItemCount() - 1; - } - updateSelection(new_selected); - } - } - else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) - { - if(getItemCount()!=0) { - int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected + step; - if (new_selected > (int) getItemCount() - 1) { - if ((selected != getItemCount() - 1)) - new_selected = getItemCount() - 1; - else - new_selected = 0; - } - updateSelection(new_selected); + if (getItemCount() != 0) { + int new_selected = UpDownKey((int)getItemCount(), msg, listmaxshow, selected); + if (new_selected >= 0) + updateSelection(new_selected); } } else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) { diff --git a/src/gui/widget/listbox.h b/src/gui/widget/listbox.h index ce52081e0..26a27f8e6 100644 --- a/src/gui/widget/listbox.h +++ b/src/gui/widget/listbox.h @@ -26,12 +26,13 @@ #define __listbox__ #include "menue.h" +#include "listhelpers.h" #include #include -class CListBox : public CMenuTarget +class CListBox : public CMenuTarget, public CListHelpers { protected: CFrameBuffer* frameBuffer; From f8848e44a72032c19d70fcefe6a1981bbafdfc56 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 20:54:20 +0100 Subject: [PATCH 08/30] make my preferred settings default * no blinkenlights * tv/radio mode toggle * menu timeout 240 seconds * channel list mode "favorites * disable "new zap" mode * big epg info window * no minitv in channel list * volume bar mid bottom * show transponder data in channel list Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/056d41e04326b0df3ff3e4948467e643afd39821 Author: Stefan Seyfried Date: 2016-01-16 (Sat, 16 Jan 2016) ------------------ This commit was generated by Migit --- src/gui/themes.cpp | 5 ++--- src/neutrino.cpp | 30 +++++++++++++++--------------- src/system/settings.cpp | 6 +++--- src/system/settings.h | 2 +- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/gui/themes.cpp b/src/gui/themes.cpp index 13cfc8f1b..78a2cc972 100644 --- a/src/gui/themes.cpp +++ b/src/gui/themes.cpp @@ -324,8 +324,7 @@ void CThemes::getTheme(CConfigFile &configfile) t.menu_Head_Text_green = configfile.getInt32( "menu_Head_Text_green", 0x46 ); t.menu_Head_Text_blue = configfile.getInt32( "menu_Head_Text_blue", 0x00 ); - //t.menu_Head_gradient = configfile.getInt32( "menu_Head_gradient", CC_COLGRAD_LIGHT_2_DARK); - t.menu_Head_gradient = configfile.getInt32( "menu_Head_gradient", 0); + t.menu_Head_gradient = configfile.getInt32("menu_Head_gradient", CC_COLGRAD_OFF); /* no bling */ t.menu_Head_gradient_direction = configfile.getInt32( "menu_Head_gradient_direction", CFrameBuffer::gradientVertical); t.menu_Separator_gradient_enable = configfile.getInt32( "menu_Separator_gradient_enable", 0); @@ -386,7 +385,7 @@ void CThemes::getTheme(CConfigFile &configfile) t.colored_events_blue = configfile.getInt32( "colored_events_blue", 0 ); t.colored_events_channellist = configfile.getInt32( "colored_events_channellist", 0 ); - t.colored_events_infobar = configfile.getInt32( "colored_events_infobar", 2 ); + t.colored_events_infobar = configfile.getInt32("colored_events_infobar", 0); /* no bling bling */ t.clock_Digit_alpha = configfile.getInt32( "clock_Digit_alpha", t.menu_Content_Text_alpha ); t.clock_Digit_red = configfile.getInt32( "clock_Digit_red", t.menu_Content_Text_red ); t.clock_Digit_green = configfile.getInt32( "clock_Digit_green", t.menu_Content_Text_green ); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 22809b8d0..8f4eedfd9 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -387,10 +387,10 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.audio_volume_percent_ac3 = configfile.getInt32("audio_volume_percent_ac3", 100); g_settings.audio_volume_percent_pcm = configfile.getInt32("audio_volume_percent_pcm", 100); - g_settings.channel_mode = configfile.getInt32("channel_mode", LIST_MODE_PROV); - g_settings.channel_mode_radio = configfile.getInt32("channel_mode_radio", LIST_MODE_PROV); - g_settings.channel_mode_initial = configfile.getInt32("channel_mode_initial", -1); - g_settings.channel_mode_initial_radio = configfile.getInt32("channel_mode_initial_radio", -1); + g_settings.channel_mode = configfile.getInt32("channel_mode", LIST_MODE_FAV); + g_settings.channel_mode_radio = configfile.getInt32("channel_mode_radio", LIST_MODE_FAV); + g_settings.channel_mode_initial = configfile.getInt32("channel_mode_initial", LIST_MODE_FAV); + g_settings.channel_mode_initial_radio = configfile.getInt32("channel_mode_initial_radio", LIST_MODE_FAV); if (g_settings.channel_mode_initial > -1) g_settings.channel_mode = g_settings.channel_mode_initial; if (g_settings.channel_mode_initial_radio > -1) @@ -476,10 +476,10 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.infobar_sat_display = configfile.getBool("infobar_sat_display" , true ); g_settings.infobar_show_channeldesc = configfile.getBool("infobar_show_channeldesc" , false ); - g_settings.infobar_subchan_disp_pos = configfile.getInt32("infobar_subchan_disp_pos" , 0 ); + g_settings.infobar_subchan_disp_pos = configfile.getInt32("infobar_subchan_disp_pos", 4); // subchan display in infobar g_settings.infobar_buttons_usertitle = configfile.getBool("infobar_buttons_usertitle", false ); - g_settings.progressbar_gradient = configfile.getBool("progressbar_gradient", true ); - g_settings.progressbar_design = configfile.getInt32("progressbar_design", CProgressBar::PB_COLOR); + g_settings.progressbar_gradient = configfile.getBool("progressbar_gradient", false); + g_settings.progressbar_design = configfile.getInt32("progressbar_design", CProgressBar::PB_MONO); g_settings.progressbar_timescale_red = configfile.getInt32("progressbar_timescale_red", 0); g_settings.progressbar_timescale_green = configfile.getInt32("progressbar_timescale_green", 100); g_settings.progressbar_timescale_yellow = configfile.getInt32("progressbar_timescale_yellow", 70); @@ -487,15 +487,15 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.infobar_show = configfile.getInt32("infobar_show", configfile.getInt32("infobar_cn", 1)); g_settings.infobar_show_channellogo = configfile.getInt32("infobar_show_channellogo" , 3 ); g_settings.infobar_progressbar = configfile.getInt32("infobar_progressbar" , 1 ); // below channel name - g_settings.infobar_casystem_display = configfile.getInt32("infobar_casystem_display", 1 );//discreet ca mode default + g_settings.infobar_casystem_display = configfile.getInt32("infobar_casystem_display", 2); //mini ca mode default g_settings.infobar_casystem_dotmatrix = configfile.getInt32("infobar_casystem_dotmatrix", 0 ); g_settings.infobar_casystem_frame = configfile.getInt32("infobar_casystem_frame", 1 ); g_settings.scrambled_message = configfile.getBool("scrambled_message", true ); - g_settings.volume_pos = configfile.getInt32("volume_pos", CVolumeBar::VOLUMEBAR_POS_TOP_RIGHT ); + g_settings.volume_pos = configfile.getInt32("volume_pos", CVolumeBar::VOLUMEBAR_POS_BOTTOM_CENTER); g_settings.volume_digits = configfile.getBool("volume_digits", true); g_settings.volume_size = configfile.getInt32("volume_size", 26 ); g_settings.menu_pos = configfile.getInt32("menu_pos", CMenuWidget::MENU_POS_CENTER); - g_settings.show_menu_hints = configfile.getBool("show_menu_hints", false); + g_settings.show_menu_hints = configfile.getBool("show_menu_hints", true); g_settings.infobar_show_sysfs_hdd = configfile.getBool("infobar_show_sysfs_hdd" , true ); g_settings.show_mute_icon = configfile.getInt32("show_mute_icon" ,0); g_settings.infobar_show_res = configfile.getInt32("infobar_show_res", 0 ); @@ -518,7 +518,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.pref_subs[i] = configfile.getString(cfg_key, "none"); } g_settings.subs_charset = configfile.getString("subs_charset", "CP1252"); - g_settings.zap_cycle = configfile.getInt32( "zap_cycle", 0 ); + g_settings.zap_cycle = configfile.getInt32("zap_cycle", 1); /* stay in bouquet by default */ //screen saver g_settings.screensaver_delay = configfile.getInt32("screensaver_delay", 1); @@ -703,12 +703,12 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.mode_clock = configfile.getInt32( "mode_clock", 0); g_settings.zapto_pre_time = configfile.getInt32( "zapto_pre_time", 0); g_settings.spectrum = configfile.getBool("spectrum" , false); - g_settings.channellist_additional = configfile.getInt32("channellist_additional", 2); //default minitv + g_settings.channellist_additional = configfile.getInt32("channellist_additional", 1); //default no minitv g_settings.eventlist_additional = configfile.getInt32("eventlist_additional", 0); g_settings.channellist_epgtext_align_right = configfile.getBool("channellist_epgtext_align_right" , false); g_settings.channellist_progressbar_design = configfile.getInt32("channellist_progressbar_design", g_settings.progressbar_design); - g_settings.channellist_foot = configfile.getInt32("channellist_foot" , 1);//default next Event - g_settings.channellist_new_zap_mode = configfile.getInt32("channellist_new_zap_mode", 1); + g_settings.channellist_foot = configfile.getInt32("channellist_foot", 0); //default transponder data + g_settings.channellist_new_zap_mode = configfile.getInt32("channellist_new_zap_mode", 0); g_settings.channellist_sort_mode = configfile.getInt32("channellist_sort_mode", 0);//sort mode: alpha, freq, sat g_settings.channellist_numeric_adjust = configfile.getInt32("channellist_numeric_adjust", 0); g_settings.channellist_show_channellogo = configfile.getInt32("channellist_show_channellogo", 1); @@ -741,7 +741,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.screen_width = configfile.getInt32("screen_width", 0); g_settings.screen_height = configfile.getInt32("screen_height", 0); - g_settings.bigFonts = configfile.getInt32("bigFonts", 0); + g_settings.bigFonts = configfile.getInt32("bigFonts", 1); g_settings.window_size = configfile.getInt32("window_size", 100); g_settings.window_width = configfile.getInt32("window_width", g_settings.window_size); g_settings.window_height = configfile.getInt32("window_height", g_settings.window_size); diff --git a/src/system/settings.cpp b/src/system/settings.cpp index 4ee846df1..8546a2f8c 100644 --- a/src/system/settings.cpp +++ b/src/system/settings.cpp @@ -40,9 +40,9 @@ const struct personalize_settings_t personalize_settings[SNeutrinoSettings::P_SE {"personalize_redbutton" , CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED}, // epg/info //main menu - {"personalize_tv_mode" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, - {"personalize_tv_radio_mode" , CPersonalizeGui::PERSONALIZE_MODE_NOTVISIBLE}, //toggle - {"personalize_radio_mode" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, + {"personalize_tv_mode" , CPersonalizeGui::PERSONALIZE_MODE_NOTVISIBLE}, + {"personalize_tv_radio_mode" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, //toggle + {"personalize_radio_mode" , CPersonalizeGui::PERSONALIZE_MODE_NOTVISIBLE}, {"personalize_timer" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, {"personalize_media" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, diff --git a/src/system/settings.h b/src/system/settings.h index 94b43c66f..c6776d231 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -817,7 +817,7 @@ typedef struct time_settings_t const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_COUNT] = { - { 0, LOCALE_TIMING_MENU }, + { 240, LOCALE_TIMING_MENU }, { 60, LOCALE_TIMING_CHANLIST }, { 240, LOCALE_TIMING_EPG }, { 6, LOCALE_TIMING_INFOBAR }, From 67208da51c937a377ab8864bcd8830b281356253 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 17 Jan 2016 15:22:49 +0100 Subject: [PATCH 09/30] ffmpegdec: fix playback for big-endian arch Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/8e763ca1830a31d12d6df9d6bbdab0c2256e2334 Author: Stefan Seyfried Date: 2016-01-17 (Sun, 17 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/audiodec/ffmpegdec.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index ddcb58c26..4749f70e5 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -243,11 +243,7 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state, mSampleRate = samplerate; mChannels = av_get_channel_layout_nb_channels(AV_CH_LAYOUT_STEREO); -#if __BYTE_ORDER == __LITTLE_ENDIAN audioDecoder->PrepareClipPlay(mChannels, mSampleRate, 16, 1); -#else - audioDecoder->PrepareClipPlay(mChannels, mSampleRate, 16, 0); -#endif AVFrame *frame = NULL; AVPacket rpacket; From 8cdbe8cf499ba95680ec1301172a842a18d0ab84 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 17 Jan 2016 16:42:19 +0100 Subject: [PATCH 10/30] sectionsd: revert "do not adjtime() if less than one second" This is actaully not that useful and add unnecessary complexity. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c4e42e82f0a30aa354e8f5ac5e97a5b6a0267568 Author: Stefan Seyfried Date: 2016-01-17 (Sun, 17 Jan 2016) ------------------ This commit was generated by Migit --- src/eitd/sectionsd.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index d521cf7ad..971e9b856 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -1388,7 +1388,6 @@ bool CTimeThread::setSystemTime(time_t tim, bool force) gettimeofday(&tv, NULL); timediff = int64_t(tim * 1000000 - (tv.tv_usec + tv.tv_sec * 1000000)); localtime_r(&tv.tv_sec, &t); - int absdiff = abs(tim - tv.tv_sec); xprintf("%s: timediff %" PRId64 ", current: %02d.%02d.%04d %02d:%02d:%02d, dvb: %s", name.c_str(), timediff, @@ -1400,9 +1399,7 @@ bool CTimeThread::setSystemTime(time_t tim, bool force) return; } #endif - if (absdiff < 1) /* do not bother for differences less than one second */ - return true; - if (absdiff < 120) { + if (timeset && abs(tim - tv.tv_sec) < 120) { /* abs() is int */ struct timeval oldd; tv.tv_sec = time_t(timediff / 1000000LL); tv.tv_usec = suseconds_t(timediff % 1000000LL); From 023a22b879f735663172a647b4a6273cf4941784 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 17 Jan 2016 16:43:51 +0100 Subject: [PATCH 11/30] sectionsd: try to improve "good time" detection logic Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/70e0543382c19ed4e383e61a7f162de017130d1c Author: Stefan Seyfried Date: 2016-01-17 (Sun, 17 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/eitd/sectionsd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 971e9b856..03100dc3f 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -1503,7 +1503,8 @@ void CTimeThread::run() dvb_time = st.getTime(); success = true; } - } + } else + retry = false; /* reset bogon detector after invalid read() */ } /* default sleep time */ sleep_time = ntprefresh * 60; From a11234b9c7c5a0ca882f6b000511f226d9a784a8 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 17 Jan 2016 16:46:14 +0100 Subject: [PATCH 12/30] configure: remove unused LIBCS_* variables Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/45b4bb0488dea4cb2d93b4f01cc19d04201e8281 Author: Stefan Seyfried Date: 2016-01-17 (Sun, 17 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- configure.ac | 17 +---------------- src/Makefile.am | 1 - 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index ee43d1092..52816c0a2 100644 --- a/configure.ac +++ b/configure.ac @@ -281,23 +281,8 @@ if test `dirname $0` = `pwd`; then else HWLIB_CFLAGS="$HWLIB_CFLAGS "'-D__file__="\"$(subst $(srcdir)/,,$(abspath $<))\""' fi -# -# Check for libtdservicedb - the new one - for testing only -# -#CSL_VERSION=0.0.1 -#FCSL_VERSION=`$PKG_CONFIG --modversion libcoolstream` -#AC_MSG_CHECKING(for package libcoolstream >= $CSL_VERSION) -#if $PKG_CONFIG --atleast-version $CSL_VERSION libcoolstream ; then - #AC_MSG_RESULT(found (version $FCSL_VERSION)) - #LIBCS_CFLAGS=`$PKG_CONFIG --cflags libcoolstream` - #LIBCS_LIBS=`$PKG_CONFIG --libs libcoolstream` -#else - #AC_MSG_ERROR([ -#*** libcoolstream $CSL_VERSION or newer is required! *** - #]) -#fi + AC_SUBST(HWLIB_CFLAGS) -AC_SUBST(LIBCS_LIBS) AC_SUBST(FREETYPE_CFLAGS) AC_SUBST(FREETYPE_LIBS) AC_SUBST(VORBISIDEC_CFLAGS) diff --git a/src/Makefile.am b/src/Makefile.am index 583abd21c..ed805d518 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -114,7 +114,6 @@ neutrino_LDADD = \ @FREETYPE_LIBS@ \ @PNG_LIBS@ \ @BLURAY_LIBS@ \ - @LIBCS_LIBS@ \ @AVFORMAT_LIBS@ \ @AVUTIL_LIBS@ \ @AVCODEC_LIBS@ \ From 2480799cafb87785047348e2dc35b6185e1a1a4f Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Fri, 22 Jan 2016 19:48:09 +0100 Subject: [PATCH 13/30] hardware_caps: more boxtypes, add boxarch Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/71d4ec83390b89ad09f10f7a4dc4a131b13dfae7 Author: Stefan Seyfried Date: 2016-01-22 (Fri, 22 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libcoolstream/hardware_caps.cpp | 47 +++++++++++++++++++++++------ lib/libcoolstream/hardware_caps.h | 6 ++-- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/lib/libcoolstream/hardware_caps.cpp b/lib/libcoolstream/hardware_caps.cpp index 619029162..879efffc3 100644 --- a/lib/libcoolstream/hardware_caps.cpp +++ b/lib/libcoolstream/hardware_caps.cpp @@ -2,35 +2,64 @@ * determine the capabilities of the hardware. * part of libstb-hal * - * (C) 2010-2012 Stefan Seyfried + * (C) 2010-2012,2016 Stefan Seyfried * * License: GPL v2 or later */ +#include "cs_api.h" +#include +#include #include "hardware_caps.h" + static int initialized = 0; static hw_caps_t caps; hw_caps_t *get_hwcaps(void) { if (initialized) return ∩︀ - caps.has_fan = (cs_get_revision() < 8); + int rev = cs_get_revision(); + caps.has_fan = (rev < 8); caps.has_HDMI = 1; - caps.has_SCART = (cs_get_revision() != 10); + caps.has_SCART = (rev != 10); caps.has_SCART_input = 0; caps.has_YUV_cinch = 1; - caps.can_shutdown = (cs_get_revision() > 7); + caps.can_shutdown = (rev > 7); caps.can_cec = 1; caps.display_type = HW_DISPLAY_LINE_TEXT; caps.display_xres = 12; caps.display_yres = 0; caps.can_set_display_brightness = 1; strcpy(caps.boxvendor, "Coolstream"); - if (cs_get_revision() < 8) + /* list of boxnames from neutrinoyparser.cpp */ + strcpy(caps.boxarch, "Nevis"); + switch (rev) { + case 6: + case 7: // Black Stallion Edition strcpy(caps.boxname, "HD1"); - else if (cs_get_revision() == 10) - strcpy(caps.boxname, "ZEE"); - else - strcpy(caps.boxname, "NEO"); + break; + case 8: + strcpy(caps.boxname, "Neo"); + break; + case 9: + strcpy(caps.boxname, "Tank"); + strcpy(caps.boxarch, "Apollo"); + break; + case 10: + strcpy(caps.boxname, "Zee"); + break; + case 11: + strcpy(caps.boxname, "Trinity"); + strcpy(caps.boxarch, "Shiner"); + break; + case 12: + strcpy(caps.boxname, "Zee2"); + strcpy(caps.boxarch, "Kronos"); + break; + default: + strcpy(caps.boxname, "UNKNOWN_BOX"); + strcpy(caps.boxarch, "Unknown"); + fprintf(stderr, "[%s] unhandled box revision %d\n", __func__, rev); + } initialized = 1; return ∩︀ } diff --git a/lib/libcoolstream/hardware_caps.h b/lib/libcoolstream/hardware_caps.h index f91821da5..69865e954 100644 --- a/lib/libcoolstream/hardware_caps.h +++ b/lib/libcoolstream/hardware_caps.h @@ -2,16 +2,13 @@ * determine the capabilities of the hardware. * part of libstb-hal * - * (C) 2010-2012 Stefan Seyfried + * (C) 2010-2012,2016 Stefan Seyfried * * License: GPL v2 or later */ #ifndef __HARDWARE_CAPS_H__ #define __HARDWARE_CAPS_H__ -#include "cs_api.h" -#include - typedef enum { HW_DISPLAY_NONE, @@ -36,6 +33,7 @@ typedef struct hw_caps int can_set_display_brightness; char boxvendor[64]; char boxname[64]; + char boxarch[64]; } hw_caps_t; hw_caps_t *get_hwcaps(void); From acea6c1a9a69b989e064e4b4c7d2b328d591f1a6 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 23 Jan 2016 11:01:59 +0100 Subject: [PATCH 14/30] neutrinoyparser: use hw_caps to find boxname/type/arch Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f199f00705fc80d00a1bf6fc42e068407a93434c Author: Stefan Seyfried Date: 2016-01-23 (Sat, 23 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/nhttpd/tuxboxapi/neutrinoyparser.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp index 1cce6e377..a40af0afc 100644 --- a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp @@ -767,6 +767,7 @@ std::string CNeutrinoYParser::func_get_partition_list(CyhookHandler *, std::str //------------------------------------------------------------------------- std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) { +#if 0 unsigned int system_rev = cs_get_revision(); std::string boxname = "CST "; @@ -811,7 +812,15 @@ std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) boxname += buffer; break; } - +#else + std::string boxname = g_info.hw_caps->boxvendor; + if (boxname.compare("Coolstream") == 0) + boxname = "CST"; /* that's more or less an external API... */ + boxname += " " + std::string(g_info.hw_caps->boxname); + if (!strcmp(g_info.hw_caps->boxname, "Neo") && + CFEManager::getInstance()->getFrontendCount() > 1) + boxname += " Twin"; +#endif return boxname; } //------------------------------------------------------------------------- @@ -819,6 +828,7 @@ std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) //------------------------------------------------------------------------- std::string CNeutrinoYParser::func_get_boxmodel(CyhookHandler *, std::string) { +#if 0 unsigned int system_rev = cs_get_revision(); std::string boxmodel = "Unknown"; @@ -842,7 +852,9 @@ std::string CNeutrinoYParser::func_get_boxmodel(CyhookHandler *, std::string) default: break; } - +#else + std::string boxmodel = std::string(g_info.hw_caps->boxarch); +#endif return boxmodel; } //------------------------------------------------------------------------- From 0aa77127a3ea217748d3d9a5809c7b314e9cac6c Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 23 Jan 2016 13:16:10 +0100 Subject: [PATCH 15/30] infoviewer: get rid of "gotTime" variable It was set from EVT_TIMESET, which is no longer used, and can be replaced easily by the (already used) "timeset" from sectionsd. Races and locking can safely be ignored in this case. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f1075191313d992590c60eaeff7f671a36277f38 Author: Stefan Seyfried Date: 2016-01-23 (Sat, 23 Jan 2016) ------------------ This commit was generated by Migit --- src/gui/infoviewer.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 56f2244b2..9ae9b5cd3 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -143,8 +143,6 @@ void CInfoViewer::Init() recordModeActive = false; is_visible = false; showButtonBar = false; - //gotTime = g_Sectionsd->getIsTimeSet (); - gotTime = timeset; virtual_zap_mode = false; newfreq = true; chanready = 1; @@ -504,7 +502,7 @@ void CInfoViewer::show_current_next(bool new_chan, int epgpos) if (!(info_CurrentNext.flags & (CSectionsdClient::epgflags::has_later | CSectionsdClient::epgflags::has_current | CSectionsdClient::epgflags::not_broadcast))) { neutrino_locale_t loc; - if (!gotTime) + if (!timeset) loc = LOCALE_INFOVIEWER_WAITTIME; else if (showButtonBar) loc = LOCALE_INFOVIEWER_EPGWAIT; @@ -535,8 +533,6 @@ void CInfoViewer::showMovieTitle(const int playState, const t_channel_id &Channe showButtonBar = true; fileplay = true; reset_allScala(); - if (!gotTime) - gotTime = timeset; if (g_settings.radiotext_enable && g_Radiotext) { g_Radiotext->RT_MsgShow = true; @@ -691,8 +687,6 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap newfreq = true; reset_allScala(); - if (!gotTime) - gotTime = timeset; if(!is_visible && !calledFromNumZap) fader.StartFadeIn(); @@ -1431,7 +1425,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) infoViewerBB->showIcon_16_9 (); return messages_return::handled; } else if (msg == NeutrinoMessages::EVT_TIMESET) { - gotTime = true; + // gotTime = true; return messages_return::handled; } #if 0 @@ -1744,7 +1738,7 @@ void CInfoViewer::show_Data (bool calledFromEvent) int seit = (abs(jetzt - info_CurrentNext.current_zeit.startzeit) + 30) / 60; int rest = (info_CurrentNext.current_zeit.dauer / 60) - seit; runningPercent = 0; - if (!gotTime) + if (!timeset) snprintf(runningRest, sizeof(runningRest), "%d %s", info_CurrentNext.current_zeit.dauer / 60, unit_short_minute); else if (jetzt < info_CurrentNext.current_zeit.startzeit) snprintf(runningRest, sizeof(runningRest), "%s %d %s", g_Locale->getText(LOCALE_WORD_IN), seit, unit_short_minute); @@ -1800,7 +1794,7 @@ void CInfoViewer::show_Data (bool calledFromEvent) (calledFromEvent && !(info_CurrentNext.flags & (CSectionsdClient::epgflags::has_next|CSectionsdClient::epgflags::has_current)))) { // no EPG available - display_Info(g_Locale->getText(gotTime ? LOCALE_INFOVIEWER_NOEPG : LOCALE_INFOVIEWER_WAITTIME), NULL); + display_Info(g_Locale->getText(timeset ? LOCALE_INFOVIEWER_NOEPG : LOCALE_INFOVIEWER_WAITTIME), NULL); /* send message. Parental pin check gets triggered on EPG events... */ /* clear old info in getEPG */ CSectionsdClient::CurrentNextInfo dummy; @@ -1861,7 +1855,7 @@ void CInfoViewer::show_Data (bool calledFromEvent) // no EPG available ChanInfoY += height; frameBuffer->paintBox (ChanInfoX + 10, ChanInfoY, BoxEndX, ChanInfoY + height, COL_INFOBAR_PLUS_0); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->RenderString (BoxStartX + ChanWidth + 20, ChanInfoY + height, BoxEndX - (BoxStartX + ChanWidth + 20), g_Locale->getText (gotTime ? LOCALE_INFOVIEWER_NOEPG : LOCALE_INFOVIEWER_WAITTIME), COL_INFOBAR_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->RenderString (BoxStartX + ChanWidth + 20, ChanInfoY + height, BoxEndX - (BoxStartX + ChanWidth + 20), g_Locale->getText (timeset ? LOCALE_INFOVIEWER_NOEPG : LOCALE_INFOVIEWER_WAITTIME), COL_INFOBAR_TEXT); } else { // irgendein EPG gefunden int duration1Width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getRenderWidth (runningRest); From b95452b3bd165f67187d998649db6148c0155d25 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 23 Jan 2016 13:17:56 +0100 Subject: [PATCH 16/30] infoviewer: change show_Data() semantics slightly the "calledFromEvent" parameter was only used to force display of "no EPG available". It was set to true when calling from an "zap complete" or "epg event received" event, which is good, but also when calling from the display update timer, which is "strange". Now setting this parameter to false forces the update of the current event (if available) which is done from display update timer. This fixes the update of the remaining time display with constantly displayed infobar (radio mode). Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/09a8bc88eee28d6e0c37cce0c06c397867a874eb Author: Stefan Seyfried Date: 2016-01-23 (Sat, 23 Jan 2016) ------------------ This commit was generated by Migit --- src/gui/infoviewer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 9ae9b5cd3..5247e0c1c 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -1349,7 +1349,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) snprintf(runningRest, sizeof(runningRest), "%d / %d %s", (curr_pos + 30000) / 60000, (duration - curr_pos + 30000) / 60000, unit_short_minute); display_Info(NULL, NULL, false, CMoviePlayerGui::getInstance().file_prozent, NULL, runningRest); } else if (!IS_WEBTV(current_channel_id)) { - show_Data( true ); + show_Data(false); } } showLcdPercentOver (); @@ -1815,7 +1815,7 @@ void CInfoViewer::show_Data (bool calledFromEvent) if (info_CurrentNext.flags & CSectionsdClient::epgflags::has_current) { - if (info_CurrentNext.current_uniqueKey != last_curr_id) + if (!calledFromEvent || info_CurrentNext.current_uniqueKey != last_curr_id) { last_curr_id = info_CurrentNext.current_uniqueKey; curr_time = runningStart; From 0e475c8ddf6bd0f2fbff3e6d4e4516d6d23560b0 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 24 Jan 2016 11:44:10 +0100 Subject: [PATCH 17/30] sectionsd: try to improve cnthread update filter logic Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0bc1ad6abb030c8b5ceb84b3d48d2f2658e24286 Author: Stefan Seyfried Date: 2016-01-24 (Sun, 24 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/eitd/sectionsd.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 03100dc3f..6e8c6b4e5 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -1719,10 +1719,21 @@ bool CCNThread::shouldSleep() if (eit_version != 0xff) return true; - if (++eit_retry > 1) { - xprintf("%s::%s eit_retry > 1 (%d) -> going to sleep\n", name.c_str(), __func__, eit_retry); + /* on first retry, restart the demux. I'm not sure if it is a driver bug + * or a bug in our logic, but without this, I'm sometimes missing CN events + * and / or the eit_version and thus the update filter will stop working */ + if (++eit_retry < 2) { + xprintf("%s::%s first retry (%d) -> restart demux\n", name.c_str(), __func__, eit_retry); + change(0); /* this also resets lastChanged */ + } + /* ugly, this has been checked before. But timeoutsDMX can be < 0 for multiple reasons, + * and only skipTime should send CNThread finally to sleep if eit_version is not found */ + time_t since = time_monotonic() - lastChanged; + if (since > skipTime) { + xprintf("%s::%s timed out after %lds -> going to sleep\n", name.c_str(), __func__, since); return true; } + /* retry */ sendToSleepNow = false; return false; } From dedd988b69c18aae84fab1fded22bfaaba406ec3 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 24 Jan 2016 12:21:25 +0100 Subject: [PATCH 18/30] Revert "Revert "rcinput/neutrino: avoid the use of EVT_TIMESET"" This reverts commit bfdb68d9cadab223df7450b00d96d4b86eeb8cc7. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c8b0ae41039ab16207b7564a06ac387d3de66b96 Author: Stefan Seyfried Date: 2016-01-24 (Sun, 24 Jan 2016) ------------------ This commit was generated by Migit --- src/driver/rcinput.cpp | 25 +++++++++++++++++++++---- src/neutrino.cpp | 8 ++++++-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index c11368e01..e8346e09e 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -4,7 +4,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' 2003 thegoodguy - Copyright (C) 2008-2012 Stefan Seyfried + Copyright (C) 2008-2014,2016 Stefan Seyfried Copyright (C) 2013-2014 martii License: GPL @@ -519,7 +519,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 //static __u16 rc_last_key = KEY_MAX; static __u16 rc_last_repeat_key = KEY_MAX; - struct timeval tv; struct timeval tvselect; uint64_t InitialTimeout = Timeout; int64_t targetTimeout; @@ -1202,6 +1201,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) { if ((fd_rc[i] != -1) && (FD_ISSET(fd_rc[i], &rfds))) { + uint64_t now_pressed = 0; t_input_event ev; int ret = read(fd_rc[i], &ev, sizeof(t_input_event)); if (ret != sizeof(t_input_event)) { @@ -1214,6 +1214,22 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } if (ev.type == EV_SYN) continue; /* ignore... */ + if (ev.value) { + /* try to compensate for possible changes in wall clock + * kernel ev.time default uses CLOCK_REALTIME, as does gettimeofday(). + * so subtract gettimeofday() from ev.time and then add + * CLOCK_MONOTONIC, which is supposed to not change with settimeofday. + * Everything would be much easier if we could use the post-kernel 3.4 + * EVIOCSCLOCKID ioctl :-) */ + struct timespec t1; + now_pressed = ev.time.tv_usec + ev.time.tv_sec * 1000000ULL; + if (!clock_gettime(CLOCK_MONOTONIC, &t1)) { + struct timeval t2; + gettimeofday(&t2, NULL); + now_pressed += t1.tv_sec * 1000000ULL + t1.tv_nsec / 1000; + now_pressed -= (t2.tv_usec + t2.tv_sec * 1000000ULL); + } + } SHTDCNT::getInstance()->resetSleepTimer(); if (ev.value && firstKey) { firstKey = false; @@ -1260,11 +1276,12 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 #ifdef RCDEBUG printf("rc_last_key %04x rc_last_repeat_key %04x\n\n", rc_last_key, rc_last_repeat_key); #endif - uint64_t now_pressed; bool keyok = true; - +#if 0 + uint64_t now_pressed; tv = ev.time; now_pressed = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); +#endif if (trkey == rc_last_key) { /* only allow selected keys to be repeated */ if (mayRepeat(trkey, bAllowRepeatLR) || diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 1dd14710d..4d1c7dad8 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -5,7 +5,7 @@ and some other guys Homepage: http://dbox.cyberphoria.org/ - Copyright (C) 2006-2014 Stefan Seyfried + Copyright (C) 2006-2016 Stefan Seyfried Copyright (C) 2011 CoolStream International Ltd @@ -1840,7 +1840,11 @@ void CNeutrinoApp::InitZapitClient() void CNeutrinoApp::InitSectiondClient() { g_Sectionsd = new CSectionsdClient; - g_Sectionsd->registerEvent(CSectionsdClient::EVT_TIMESET, 222, NEUTRINO_UDS_NAME); + struct timespec t; + if (clock_gettime(CLOCK_MONOTONIC, &t)) { + dprintf(DEBUG_NORMAL, "CLOCK_MONOTONIC not supported? (%m), falling back to EVT_TIMESET\n"); + g_Sectionsd->registerEvent(CSectionsdClient::EVT_TIMESET, 222, NEUTRINO_UDS_NAME); + } g_Sectionsd->registerEvent(CSectionsdClient::EVT_GOT_CN_EPG, 222, NEUTRINO_UDS_NAME); g_Sectionsd->registerEvent(CSectionsdClient::EVT_EIT_COMPLETE, 222, NEUTRINO_UDS_NAME); g_Sectionsd->registerEvent(CSectionsdClient::EVT_WRITE_SI_FINISHED, 222, NEUTRINO_UDS_NAME); From 23ceb1bbd63ce92b02848e358097335650bf44e0 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 24 Jan 2016 12:23:00 +0100 Subject: [PATCH 19/30] Revert "- listhelpers: satisfy -Werror" This reverts commit 364954ef6b25f6bf3c53ca6a23d3f9c63f00ce4b. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7ed61751201d47858c0052c27c01f20f08481ded Author: Stefan Seyfried Date: 2016-01-24 (Sun, 24 Jan 2016) ------------------ This commit was generated by Migit --- src/gui/widget/listhelpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index 45af70358..9d3adf3ab 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -33,7 +33,7 @@ static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) return -1; if (msg >= CRCInput::RC_MaxRC) { - printf("CListHelpers:%s: invalid key? 0x%X\n", __func__, msg); + printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); return -1; } int key = (int)msg; @@ -46,7 +46,7 @@ static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) else if (msg == CRCInput::RC_down) step = 1; else { - printf("CListHelpers:%s: invalid key? 0x%X\n", __func__, msg); + printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); return -1; } // printf("CListHelpers:%s: key 0x%04lx lines %d size %d sel %d\n", __func__, msg, lines, size, sel); From c0910d6be4d532d3406a0255751ebcf1c2510957 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Thu, 20 Oct 2016 09:11:39 +0200 Subject: [PATCH 20/30] configure: fix short-filename logic if configure was not called from absolute path, detection would fail and huge filenames would be included in binary (noticed in yocto krogoth release) Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4cb524554663edcb2b0dae7fdab9d08d37305731 Author: Stefan Seyfried Date: 2016-10-20 (Thu, 20 Oct 2016) ------------------ This commit was generated by Migit --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 52816c0a2..e2d156dca 100644 --- a/configure.ac +++ b/configure.ac @@ -276,7 +276,7 @@ fi fi # hack to define a short filename also for out-of-tree build -if test `dirname $0` = `pwd`; then +if test `dirname $0` = `pwd` || test "$0" = ./configure; then HWLIB_CFLAGS="$HWLIB_CFLAGS "'-D__file__=__FILE__' else HWLIB_CFLAGS="$HWLIB_CFLAGS "'-D__file__="\"$(subst $(srcdir)/,,$(abspath $<))\""' From 5849aab88c94b60d4f062ae94cb714cc1389cc4e Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 22 Oct 2016 11:40:21 +0200 Subject: [PATCH 21/30] framebuffer_ng: amend struct gradientData_t this is upstream commit 616747e1, no-op here but necessary for code compatibility Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ec9ee6358cb5a3f255986207bbe2f2abf1b7d774 Author: Stefan Seyfried Date: 2016-10-22 (Sat, 22 Oct 2016) ------------------ This commit was generated by Migit --- src/driver/framebuffer_ng.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/driver/framebuffer_ng.h b/src/driver/framebuffer_ng.h index 9ae02af58..b3616cdc5 100644 --- a/src/driver/framebuffer_ng.h +++ b/src/driver/framebuffer_ng.h @@ -45,6 +45,8 @@ typedef struct gradientData_t fb_pixel_t* boxBuf; bool direction; int mode; + int x; + int dx; } gradientData_struct_t; #define CORNER_NONE 0x0 From deb4f311465a548dfcd1ff65f55bfab319715538 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 22 Oct 2016 11:45:16 +0200 Subject: [PATCH 22/30] framebuffer_ng: implement libsigc++ usage this is the framebuffer part of upstream commit 9e3882b7 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/8f5f8781e636bb7ab46bdaec2e3cdb37d5fea12a Author: Stefan Seyfried Date: 2016-10-22 (Sat, 22 Oct 2016) ------------------ This commit was generated by Migit --- src/driver/framebuffer_ng.cpp | 1 + src/driver/framebuffer_ng.h | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/driver/framebuffer_ng.cpp b/src/driver/framebuffer_ng.cpp index 96dbbc206..946f79aa4 100644 --- a/src/driver/framebuffer_ng.cpp +++ b/src/driver/framebuffer_ng.cpp @@ -508,6 +508,7 @@ void CFrameBuffer::paletteSet(struct fb_cmap *map) realcolor[i] = make16color(cmap.red[i], cmap.green[i], cmap.blue[i], cmap.transp[i], rl, ro, gl, go, bl, bo, tl, to); } + OnAfterSetPallette(); } void CFrameBuffer::paintHLineRelInternal2Buf(const int& x, const int& dx, const int& y, const int& box_dx, const fb_pixel_t& col, fb_pixel_t* buf) diff --git a/src/driver/framebuffer_ng.h b/src/driver/framebuffer_ng.h index b3616cdc5..736db44e9 100644 --- a/src/driver/framebuffer_ng.h +++ b/src/driver/framebuffer_ng.h @@ -35,6 +35,8 @@ #include #include +#include + #define fb_pixel_t uint32_t typedef struct fb_var_screeninfo t_fb_var_screeninfo; @@ -75,7 +77,7 @@ typedef struct gradientData_t class CFbAccel; /** Ausfuehrung als Singleton */ -class CFrameBuffer +class CFrameBuffer : public sigc::trackable { friend class CFbAccel; private: @@ -314,6 +316,7 @@ class CFrameBuffer void doPaintMuteIcon(bool mode) { do_paint_mute_icon = mode; } /* blit() is unnecessary, but here to avoid patches to the neutrino code */ void blit(void) {} + sigc::signal OnAfterSetPallette; }; #endif From 2addd15b8cf9c7a0474645ce39e42853519b1b80 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 22 Oct 2016 11:46:34 +0200 Subject: [PATCH 23/30] framebuffer_ng: implement getIconPath this implements upstream commit 1cfe8b44 in framebuffer_ng Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/3f48c41090de4fd222bc8feb1556e9e4cd0c872d Author: Stefan Seyfried Date: 2016-10-22 (Sat, 22 Oct 2016) ------------------ This commit was generated by Migit --- src/driver/framebuffer_ng.cpp | 24 ++++++++++++++---------- src/driver/framebuffer_ng.h | 1 + 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/driver/framebuffer_ng.cpp b/src/driver/framebuffer_ng.cpp index 946f79aa4..283f6066c 100644 --- a/src/driver/framebuffer_ng.cpp +++ b/src/driver/framebuffer_ng.cpp @@ -719,6 +719,18 @@ void CFrameBuffer::setIconBasePath(const std::string & iconPath) iconBasePath += "/"; } +std::string CFrameBuffer::getIconPath(std::string icon_name, std::string file_type) +{ + std::string path, filetype; + filetype = "." + file_type; + path = std::string(ICONSDIR_VAR) + "/" + icon_name + filetype; + if (access(path.c_str(), F_OK)) + path = iconBasePath + "/" + icon_name + filetype; + if (icon_name.find("/", 0) != std::string::npos) + path = icon_name; + return path; +} + void CFrameBuffer::getIconSize(const char * const filename, int* width, int *height) { *width = 0; @@ -816,13 +828,7 @@ bool CFrameBuffer::paintIcon(const std::string & filename, const int x, const in /* we cache and check original name */ it = icon_cache.find(filename); if(it == icon_cache.end()) { - std::string newname = filename; - /* if it is not an absolute path, search in configured paths */ - if (filename.find("/", 0) == std::string::npos) { - newname = ICONSDIR_VAR + filename + ".png"; - if (access(newname.c_str(), F_OK)) - newname = iconBasePath + filename + ".png"; - } + std::string newname = getIconPath(filename); //printf("CFrameBuffer::paintIcon: check for %s\n", newname.c_str());fflush(stdout); data = g_PicViewer->getIcon(newname, &width, &height); @@ -841,9 +847,7 @@ bool CFrameBuffer::paintIcon(const std::string & filename, const int x, const in goto _display; } - newname = ICONSDIR_VAR + filename + ".raw"; - if (access(newname.c_str(), F_OK)) - newname = iconBasePath + filename + ".raw"; + newname = getIconPath(filename, "raw"); lfd = open(newname.c_str(), O_RDONLY); diff --git a/src/driver/framebuffer_ng.h b/src/driver/framebuffer_ng.h index 736db44e9..7599c1f76 100644 --- a/src/driver/framebuffer_ng.h +++ b/src/driver/framebuffer_ng.h @@ -218,6 +218,7 @@ class CFrameBuffer : public sigc::trackable void setIconBasePath(const std::string & iconPath); std::string getIconBasePath(){return iconBasePath;}; + std::string getIconPath(std::string icon_name, std::string file_type = "png"); void getIconSize(const char * const filename, int* width, int *height); /* h is the height of the target "window", if != 0 the icon gets centered in that window */ From 4fb9a66f39464237d0b625e55e178cb6d62f9a0f Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 22 Oct 2016 11:50:38 +0200 Subject: [PATCH 24/30] fix Makefiles to include SIGC_CFLAGS now that the framebuffer class includes libsigc++, the path to it must be known to all parts using framebuffer.h Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7a9373c262cf941d895808bdaf54aaa27898af53 Author: Stefan Seyfried Date: 2016-10-22 (Sat, 22 Oct 2016) ------------------ This commit was generated by Migit --- lib/libdvbsub/Makefile.am | 1 + lib/libtuxtxt/Makefile.am | 1 + src/zapit/src/Makefile.am | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/libdvbsub/Makefile.am b/lib/libdvbsub/Makefile.am index 6ac627d08..aa9082181 100644 --- a/lib/libdvbsub/Makefile.am +++ b/lib/libdvbsub/Makefile.am @@ -4,6 +4,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/zapit/include \ @AVFORMAT_CFLAGS@ \ + @SIGC_CFLAGS@ \ @HWLIB_CFLAGS@ AM_CPPFLAGS += -fno-rtti -fno-exceptions diff --git a/lib/libtuxtxt/Makefile.am b/lib/libtuxtxt/Makefile.am index f40d16044..f3dc7d972 100644 --- a/lib/libtuxtxt/Makefile.am +++ b/lib/libtuxtxt/Makefile.am @@ -6,6 +6,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/zapit/include \ $(FREETYPE_CFLAGS) \ + @SIGC_CFLAGS@ \ @HWLIB_CFLAGS@ AM_CPPFLAGS += -fno-rtti -fno-exceptions diff --git a/src/zapit/src/Makefile.am b/src/zapit/src/Makefile.am index a1dac17bc..0130f3a8a 100644 --- a/src/zapit/src/Makefile.am +++ b/src/zapit/src/Makefile.am @@ -11,6 +11,7 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/lib/libeventserver \ -I$(top_srcdir)/lib/xmltree \ @FREETYPE_CFLAGS@ \ + @SIGC_CFLAGS@ \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libzapit.a From 6abba22cdc2e32e7b2c3de0ce3af3faae28ad6bd Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 22 Oct 2016 12:02:10 +0200 Subject: [PATCH 25/30] record, streamts: use modern AV_CODEC_ID enums this allows to build with current ffmpeg Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5f33ee96fd5b5ee5eafa0415752a948907ea1f6f Author: Stefan Seyfried Date: 2016-10-22 (Sat, 22 Oct 2016) ------------------ This commit was generated by Migit --- src/driver/record.cpp | 2 +- src/driver/streamts.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index fc3eb7f07..255a62859 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -2171,7 +2171,7 @@ void CStreamRec::run() continue; AVCodecContext *codec = ifcx->streams[pkt.stream_index]->codec; - if (bsfc && codec->codec_id == CODEC_ID_H264) { + if (bsfc && codec->codec_id == AV_CODEC_ID_H264) { AVPacket newpkt = pkt; if (av_bitstream_filter_filter(bsfc, codec, NULL, &newpkt.data, &newpkt.size, pkt.data, pkt.size, pkt.flags & AV_PKT_FLAG_KEY) >= 0) { diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index 9edff63c8..aebb0e168 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -899,7 +899,7 @@ void CStreamStream::run() continue; AVCodecContext *codec = ifcx->streams[pkt.stream_index]->codec; - if (bsfc && codec->codec_id == CODEC_ID_H264 ) { + if (bsfc && codec->codec_id == AV_CODEC_ID_H264 ) { AVPacket newpkt = pkt; if (av_bitstream_filter_filter(bsfc, codec, NULL, &newpkt.data, &newpkt.size, pkt.data, pkt.size, pkt.flags & AV_PKT_FLAG_KEY) >= 0) { From c84777c47550b4ebfe68f36652bd7e293c7fdfe1 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 22 Oct 2016 12:08:57 +0200 Subject: [PATCH 26/30] driver/record: make CStreamRec non-public CStreamRec is only used inside CRecordManager::Record, so it can be implemented completely inside record.cpp. The positive side effect is that avformat.h is not included everywhere (e.g. from moviebrowser/mb.h) and thus AVFORMAT_CFLAGS does not need to be added everywhere to fix build failures. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/b8e44c37178b0e4c442c3099251bdd75a5ee6c69 Author: Stefan Seyfried Date: 2016-10-22 (Sat, 22 Oct 2016) ------------------ This commit was generated by Migit --- src/driver/record.cpp | 31 +++++++++++++++++++++++++++++++ src/driver/record.h | 4 ++++ 2 files changed, 35 insertions(+) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 255a62859..1f9b33172 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -63,6 +63,37 @@ #include #include +extern "C" { +#include +} + +class CStreamRec : public CRecordInstance, OpenThreads::Thread +{ + private: + AVFormatContext *ifcx; + AVFormatContext *ofcx; + AVBitStreamFilterContext *bsfc; + bool stopped; + bool interrupt; + time_t time_started; + int stream_index; + + void GetPids(CZapitChannel * channel); + void FillMovieInfo(CZapitChannel * channel, APIDList & apid_list); + bool Start(); + + void Close(); + bool Open(CZapitChannel * channel); + void run(); + void WriteHeader(uint32_t duration); + public: + CStreamRec(const CTimerd::RecordingInfo * const eventinfo, std::string &dir, bool timeshift = false, bool stream_vtxt_pid = false, bool stream_pmt_pid = false, bool stream_subtitle_pids = false); + ~CStreamRec(); + record_error_msg_t Record(); + bool Stop(bool remove_event = true); + static int Interrupt(void * data); +}; + /* TODO: * nextRecording / pending recordings - needs testing * check/fix askUserOnTimerConflict gui/timerlist.cpp -> getOverlappingTimers lib/timerdclient/timerdclient.cpp diff --git a/src/driver/record.h b/src/driver/record.h index 23d3d0936..14ddb721d 100644 --- a/src/driver/record.h +++ b/src/driver/record.h @@ -42,9 +42,11 @@ #include #include +#if 0 extern "C" { #include } +#endif #define REC_MAX_APIDS 10 #define FILENAMEBUFFERSIZE 1024 @@ -242,6 +244,7 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/ #endif }; +#if 0 class CStreamRec : public CRecordInstance, OpenThreads::Thread { private: @@ -268,5 +271,6 @@ class CStreamRec : public CRecordInstance, OpenThreads::Thread bool Stop(bool remove_event = true); static int Interrupt(void * data); }; +#endif #endif From 36356862fd316d383ebfe8b2eacfa10c930cc981 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 22 Oct 2016 12:22:06 +0200 Subject: [PATCH 27/30] helpers.cpp: include fontrenderer.h if Font class is used, the header should be included, too :-) Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/1d5cb346169e0084347d2152ddf0c93ce635ec4e Author: Stefan Seyfried Date: 2016-10-22 (Sat, 22 Oct 2016) ------------------ This commit was generated by Migit --- src/system/helpers.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 2b1a49389..6a21421ff 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -47,6 +47,7 @@ #include #include "debug.h" #include +#include #include #include using namespace std; From b19917d66a13800838ea72a0303d5c59e402a473 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 22 Oct 2016 12:23:09 +0200 Subject: [PATCH 28/30] system/helpers: allow to build with c++11 compilers Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/3684680cb209ee32d2b7f9bfbd1c9ac2e04b18ec Author: Stefan Seyfried Date: 2016-10-22 (Sat, 22 Oct 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/system/helpers.cpp | 2 ++ src/system/helpers.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 6a21421ff..a2f9d3414 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -1086,6 +1086,7 @@ std::vector split(const std::string &s, char delim) return vec; } +#if __cplusplus <= 201103L std::string to_string(int i) { std::stringstream s; @@ -1127,6 +1128,7 @@ std::string to_string(unsigned long long i) s << i; return s.str(); } +#endif /** * C++ version 0.4 std::string style "itoa": diff --git a/src/system/helpers.h b/src/system/helpers.h index 8c1961ffb..1e2c9e372 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -116,12 +116,17 @@ class CFileHelpers uint32_t GetWidth4FB_HW_ACC(const uint32_t _x, const uint32_t _w, const bool max=true); +#if __cplusplus <= 201103L std::string to_string(int); std::string to_string(unsigned int); std::string to_string(long); std::string to_string(unsigned long); std::string to_string(long long); std::string to_string(unsigned long long); +#else +/* hack... */ +#define to_string(x) std::to_string(x) +#endif std::string itoa(int value, int base); From 7c4c0c175f301261b0d8dffde1a6aa509ce2f02e Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 22 Oct 2016 12:33:10 +0200 Subject: [PATCH 29/30] timerlist: fix build with GCC 6.2 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f632ac550519c726be1dca91e7959e13e013a55a Author: Stefan Seyfried Date: 2016-10-22 (Sat, 22 Oct 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/timerlist.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 346363342..4a49cff69 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -573,7 +573,8 @@ struct button_label TimerListButtons[] = { NEUTRINO_ICON_BUTTON_MENU_SMALL, NONEXISTANT_LOCALE }, { NEUTRINO_ICON_BUTTON_PLAY , NONEXISTANT_LOCALE } }; -size_t TimerListButtonsCount = sizeof(TimerListButtons)/sizeof(TimerListButtons[0]); +// int to match the type in paintButtons +int TimerListButtonsCount = sizeof(TimerListButtons)/sizeof(TimerListButtons[0]); #define RemoteBoxFooterButtonCount 3 static const struct button_label RemoteBoxFooterButtons[RemoteBoxFooterButtonCount] = { From f3cc9f75a299a81545de552b5ea123b043d1b13f Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 22 Oct 2016 13:13:28 +0200 Subject: [PATCH 30/30] opkg_manager: use "opkg" instead of "opkg-cl" old releases had "opkg" as compat symlink to -cl, newer releases only have opkg binary, so change to opkg for broader compatibility Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/74bc08a10604e76b2c0164d4c2129faab47c3bba Author: Stefan Seyfried Date: 2016-10-22 (Sat, 22 Oct 2016) ------------------ This commit was generated by Migit --- src/gui/opkg_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index 62c89eaa2..2f0de0890 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -58,7 +58,7 @@ #include #include -#if 0 +#if 1 #define OPKG_CL "opkg" #else #define OPKG_CL "opkg-cl"