mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-02 10:21:04 +02:00
Merge branch 'ni/tuxbox' into ni/mp/tuxbox
Conflicts:
src/driver/fb_generic.cpp
src/neutrino.cpp
Origin commit data
------------------
Commit: 8a4a5e1ae6
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-02-13 (Mon, 13 Feb 2017)
This commit is contained in:
200
src/neutrino.cpp
200
src/neutrino.cpp
@@ -238,6 +238,7 @@ CNeutrinoApp::CNeutrinoApp()
|
||||
: configfile('\t')
|
||||
{
|
||||
standby_pressed_at.tv_sec = 0;
|
||||
osd_resolution_tmp = -1;
|
||||
#if HAVE_TRIPLEDRAGON || USE_STB_HAL
|
||||
/* this needs to happen before the framebuffer is set up */
|
||||
init_td_api();
|
||||
@@ -324,22 +325,6 @@ static SNeutrinoSettings::usermenu_t usermenu_default[] = {
|
||||
/**************************************************************************************
|
||||
* CNeutrinoApp - loadSetup, load the application-settings *
|
||||
**************************************************************************************/
|
||||
#if HAVE_TRIPLEDRAGON || HAVE_SPARK_HARDWARE || HAVE_GENERIC_HARDWARE
|
||||
#define DEFAULT_X_START_SD 32
|
||||
#define DEFAULT_Y_START_SD 26
|
||||
#define DEFAULT_X_END_SD 694
|
||||
#define DEFAULT_Y_END_SD 570
|
||||
#else
|
||||
#define DEFAULT_X_START_SD 60
|
||||
#define DEFAULT_Y_START_SD 20
|
||||
#define DEFAULT_X_END_SD 1220
|
||||
#define DEFAULT_Y_END_SD 560
|
||||
#endif
|
||||
|
||||
#define DEFAULT_X_START_HD 45 //5 //NI
|
||||
#define DEFAULT_Y_START_HD 30 //5 //NI
|
||||
#define DEFAULT_X_END_HD 1235 //1275
|
||||
#define DEFAULT_Y_END_HD 690 //715
|
||||
|
||||
std::string ttx_font_file = "";
|
||||
|
||||
@@ -357,10 +342,10 @@ int CNeutrinoApp::loadSetup(const char * fname)
|
||||
} else {
|
||||
#ifndef HAVE_GENERIC_HARDWARE
|
||||
/* try to detect bad / broken config file */
|
||||
if (!configfile.getInt32("screen_EndX_crt", 0) ||
|
||||
!configfile.getInt32("screen_EndY_crt", 0) ||
|
||||
!configfile.getInt32("screen_EndX_lcd", 0) ||
|
||||
!configfile.getInt32("screen_EndY_lcd", 0)) {
|
||||
if (!configfile.getInt32("screen_EndX_crt_0", 0) ||
|
||||
!configfile.getInt32("screen_EndY_crt_0", 0) ||
|
||||
!configfile.getInt32("screen_EndX_lcd_0", 0) ||
|
||||
!configfile.getInt32("screen_EndY_lcd_0", 0)) {
|
||||
printf("[neutrino] config file %s is broken, using defaults\n", fname);
|
||||
configfile.clear();
|
||||
} else
|
||||
@@ -803,34 +788,35 @@ int CNeutrinoApp::loadSetup(const char * fname)
|
||||
g_settings.channellist_show_numbers = configfile.getInt32("channellist_show_numbers", 1);
|
||||
|
||||
//screen configuration
|
||||
g_settings.screen_StartX_crt = configfile.getInt32( "screen_StartX_crt", DEFAULT_X_START_SD);
|
||||
g_settings.screen_StartY_crt = configfile.getInt32( "screen_StartY_crt", DEFAULT_Y_START_SD );
|
||||
g_settings.screen_EndX_crt = configfile.getInt32( "screen_EndX_crt", DEFAULT_X_END_SD);
|
||||
g_settings.screen_EndY_crt = configfile.getInt32( "screen_EndY_crt", DEFAULT_Y_END_SD);
|
||||
g_settings.screen_StartX_lcd = configfile.getInt32( "screen_StartX_lcd", DEFAULT_X_START_HD);
|
||||
g_settings.screen_StartY_lcd = configfile.getInt32( "screen_StartY_lcd", DEFAULT_Y_START_HD );
|
||||
g_settings.screen_EndX_lcd = configfile.getInt32( "screen_EndX_lcd", DEFAULT_X_END_HD);
|
||||
g_settings.screen_EndY_lcd = configfile.getInt32( "screen_EndY_lcd", DEFAULT_Y_END_HD);
|
||||
g_settings.screen_preset = configfile.getInt32( "screen_preset", 1);
|
||||
|
||||
g_settings.osd_resolution = (osd_resolution_tmp == -1) ? configfile.getInt32("osd_resolution", 0) : osd_resolution_tmp;
|
||||
g_settings.screen_StartX_crt_0 = configfile.getInt32("screen_StartX_crt_0", 80);
|
||||
g_settings.screen_StartY_crt_0 = configfile.getInt32("screen_StartY_crt_0", 45);
|
||||
g_settings.screen_EndX_crt_0 = configfile.getInt32("screen_EndX_crt_0" , 1280 - g_settings.screen_StartX_crt_0 - 1);
|
||||
g_settings.screen_EndY_crt_0 = configfile.getInt32("screen_EndY_crt_0" , 580 - g_settings.screen_StartY_crt_0 - 1);
|
||||
g_settings.screen_StartX_lcd_0 = configfile.getInt32("screen_StartX_lcd_0", 45); //NI
|
||||
g_settings.screen_StartY_lcd_0 = configfile.getInt32("screen_StartY_lcd_0", 30); //NI
|
||||
g_settings.screen_EndX_lcd_0 = configfile.getInt32("screen_EndX_lcd_0" , 1280 - g_settings.screen_StartX_lcd_0 - 1);
|
||||
g_settings.screen_EndY_lcd_0 = configfile.getInt32("screen_EndY_lcd_0" , 720 - g_settings.screen_StartY_lcd_0 - 1);
|
||||
g_settings.screen_StartX_crt_1 = configfile.getInt32("screen_StartX_crt_1", 80);
|
||||
g_settings.screen_StartY_crt_1 = configfile.getInt32("screen_StartY_crt_1", 45);
|
||||
g_settings.screen_EndX_crt_1 = configfile.getInt32("screen_EndX_crt_1" , 1920 - g_settings.screen_StartX_crt_1 - 1);
|
||||
g_settings.screen_EndY_crt_1 = configfile.getInt32("screen_EndY_crt_1" , 870 - g_settings.screen_StartY_crt_1 - 1);
|
||||
g_settings.screen_StartX_lcd_1 = configfile.getInt32("screen_StartX_lcd_1", 50); //NI
|
||||
g_settings.screen_StartY_lcd_1 = configfile.getInt32("screen_StartY_lcd_1", 45); //NI
|
||||
g_settings.screen_EndX_lcd_1 = configfile.getInt32("screen_EndX_lcd_1" , 1920 - g_settings.screen_StartX_lcd_1 - 1);
|
||||
g_settings.screen_EndY_lcd_1 = configfile.getInt32("screen_EndY_lcd_1" , 1080 - g_settings.screen_StartY_lcd_1 - 1);
|
||||
#if HAVE_TRIPLEDRAGON
|
||||
g_settings.screen_preset = 0; /* does not make sense to have two configurations for that... */
|
||||
#elif ! HAVE_COOLSTREAM
|
||||
g_settings.screen_preset = 1; /* spark is now always using 1280x720 framebuffer */
|
||||
g_settings.screen_preset = configfile.getInt32("screen_preset", COsdSetup::PRESET_CRT);
|
||||
#else
|
||||
g_settings.screen_preset = configfile.getInt32("screen_preset", COsdSetup::PRESET_LCD);
|
||||
#endif
|
||||
g_settings.screen_StartX = g_settings.screen_preset ? g_settings.screen_StartX_lcd : g_settings.screen_StartX_crt;
|
||||
g_settings.screen_StartY = g_settings.screen_preset ? g_settings.screen_StartY_lcd : g_settings.screen_StartY_crt;
|
||||
g_settings.screen_EndX = g_settings.screen_preset ? g_settings.screen_EndX_lcd : g_settings.screen_EndX_crt;
|
||||
g_settings.screen_EndY = g_settings.screen_preset ? g_settings.screen_EndY_lcd : g_settings.screen_EndY_crt;
|
||||
|
||||
g_settings.screen_width = frameBuffer->getScreenWidth(true);
|
||||
g_settings.screen_height = frameBuffer->getScreenHeight(true);
|
||||
setScreenSettings();
|
||||
|
||||
// avoid configuration mismatch
|
||||
if (g_settings.screen_EndX > g_settings.screen_width)
|
||||
g_settings.screen_EndX = g_settings.screen_width;
|
||||
if (g_settings.screen_EndY > g_settings.screen_height)
|
||||
g_settings.screen_EndY = g_settings.screen_height;
|
||||
if (g_settings.screen_EndX >= g_settings.screen_width)
|
||||
g_settings.screen_EndX = g_settings.screen_width - 1;
|
||||
if (g_settings.screen_EndY >= g_settings.screen_height)
|
||||
g_settings.screen_EndY = g_settings.screen_height - 1;
|
||||
|
||||
g_settings.bigFonts = configfile.getInt32("bigFonts", 1); //NI
|
||||
g_settings.window_size = configfile.getInt32("window_size", 100);
|
||||
@@ -1039,6 +1025,56 @@ int CNeutrinoApp::loadSetup(const char * fname)
|
||||
return erg;
|
||||
}
|
||||
|
||||
void CNeutrinoApp::setScreenSettings()
|
||||
{
|
||||
g_settings.screen_width = frameBuffer->getScreenWidth(true);
|
||||
g_settings.screen_height = frameBuffer->getScreenHeight(true);
|
||||
|
||||
switch (g_settings.osd_resolution) {
|
||||
#ifdef ENABLE_CHANGE_OSD_RESOLUTION
|
||||
case 1:
|
||||
{
|
||||
switch (g_settings.screen_preset) {
|
||||
case COsdSetup::PRESET_CRT:
|
||||
g_settings.screen_StartX = g_settings.screen_StartX_crt_1;
|
||||
g_settings.screen_StartY = g_settings.screen_StartY_crt_1;
|
||||
g_settings.screen_EndX = g_settings.screen_EndX_crt_1;
|
||||
g_settings.screen_EndY = g_settings.screen_EndY_crt_1;
|
||||
break;
|
||||
case COsdSetup::PRESET_LCD:
|
||||
default:
|
||||
g_settings.screen_StartX = g_settings.screen_StartX_lcd_1;
|
||||
g_settings.screen_StartY = g_settings.screen_StartY_lcd_1;
|
||||
g_settings.screen_EndX = g_settings.screen_EndX_lcd_1;
|
||||
g_settings.screen_EndY = g_settings.screen_EndY_lcd_1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case 0:
|
||||
default:
|
||||
{
|
||||
switch (g_settings.screen_preset) {
|
||||
case COsdSetup::PRESET_CRT:
|
||||
g_settings.screen_StartX = g_settings.screen_StartX_crt_0;
|
||||
g_settings.screen_StartY = g_settings.screen_StartY_crt_0;
|
||||
g_settings.screen_EndX = g_settings.screen_EndX_crt_0;
|
||||
g_settings.screen_EndY = g_settings.screen_EndY_crt_0;
|
||||
break;
|
||||
case COsdSetup::PRESET_LCD:
|
||||
default:
|
||||
g_settings.screen_StartX = g_settings.screen_StartX_lcd_0;
|
||||
g_settings.screen_StartY = g_settings.screen_StartY_lcd_0;
|
||||
g_settings.screen_EndX = g_settings.screen_EndX_lcd_0;
|
||||
g_settings.screen_EndY = g_settings.screen_EndY_lcd_0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CNeutrinoApp::upgradeSetup(const char * fname)
|
||||
{
|
||||
dprintf(DEBUG_NORMAL, "upgrade/cleanup %s\n", fname);
|
||||
@@ -1453,15 +1489,24 @@ void CNeutrinoApp::saveSetup(const char * fname)
|
||||
configfile.setInt32("channellist_show_numbers", g_settings.channellist_show_numbers);
|
||||
|
||||
//screen configuration
|
||||
configfile.setInt32( "screen_StartX_lcd", g_settings.screen_StartX_lcd );
|
||||
configfile.setInt32( "screen_StartY_lcd", g_settings.screen_StartY_lcd );
|
||||
configfile.setInt32( "screen_EndX_lcd", g_settings.screen_EndX_lcd );
|
||||
configfile.setInt32( "screen_EndY_lcd", g_settings.screen_EndY_lcd );
|
||||
configfile.setInt32( "screen_StartX_crt", g_settings.screen_StartX_crt );
|
||||
configfile.setInt32( "screen_StartY_crt", g_settings.screen_StartY_crt );
|
||||
configfile.setInt32( "screen_EndX_crt", g_settings.screen_EndX_crt );
|
||||
configfile.setInt32( "screen_EndY_crt", g_settings.screen_EndY_crt );
|
||||
configfile.setInt32( "screen_preset", g_settings.screen_preset );
|
||||
configfile.setInt32("osd_resolution" , g_settings.osd_resolution);
|
||||
configfile.setInt32("screen_StartX_lcd_0", g_settings.screen_StartX_lcd_0);
|
||||
configfile.setInt32("screen_StartY_lcd_0", g_settings.screen_StartY_lcd_0);
|
||||
configfile.setInt32("screen_EndX_lcd_0" , g_settings.screen_EndX_lcd_0);
|
||||
configfile.setInt32("screen_EndY_lcd_0" , g_settings.screen_EndY_lcd_0);
|
||||
configfile.setInt32("screen_StartX_crt_0", g_settings.screen_StartX_crt_0);
|
||||
configfile.setInt32("screen_StartY_crt_0", g_settings.screen_StartY_crt_0);
|
||||
configfile.setInt32("screen_EndX_crt_0" , g_settings.screen_EndX_crt_0);
|
||||
configfile.setInt32("screen_EndY_crt_0" , g_settings.screen_EndY_crt_0);
|
||||
configfile.setInt32("screen_StartX_lcd_1", g_settings.screen_StartX_lcd_1);
|
||||
configfile.setInt32("screen_StartY_lcd_1", g_settings.screen_StartY_lcd_1);
|
||||
configfile.setInt32("screen_EndX_lcd_1" , g_settings.screen_EndX_lcd_1);
|
||||
configfile.setInt32("screen_EndY_lcd_1" , g_settings.screen_EndY_lcd_1);
|
||||
configfile.setInt32("screen_StartX_crt_1", g_settings.screen_StartX_crt_1);
|
||||
configfile.setInt32("screen_StartY_crt_1", g_settings.screen_StartY_crt_1);
|
||||
configfile.setInt32("screen_EndX_crt_1" , g_settings.screen_EndX_crt_1);
|
||||
configfile.setInt32("screen_EndY_crt_1" , g_settings.screen_EndY_crt_1);
|
||||
configfile.setInt32("screen_preset" , g_settings.screen_preset);
|
||||
|
||||
//Software-update
|
||||
configfile.setInt32 ("softupdate_mode" , g_settings.softupdate_mode );
|
||||
@@ -1958,7 +2003,37 @@ void CNeutrinoApp::CmdParser(int argc, char **argv)
|
||||
void CNeutrinoApp::SetupFrameBuffer()
|
||||
{
|
||||
frameBuffer->init();
|
||||
if(frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t))) {
|
||||
int setFbMode = 0;
|
||||
osd_resolution_tmp = -1;
|
||||
#ifdef ENABLE_CHANGE_OSD_RESOLUTION
|
||||
frameBuffer->setOsdResolutions();
|
||||
if (frameBuffer->osd_resolutions.empty()) {
|
||||
dprintf(DEBUG_NORMAL, "Error while setting framebuffer mode\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
uint32_t ort;
|
||||
configfile.loadConfig(NEUTRINO_SETTINGS_FILE);
|
||||
ort = configfile.getInt32("osd_resolution", 0);
|
||||
|
||||
size_t resCount = frameBuffer->osd_resolutions.size();
|
||||
|
||||
if (ort > (resCount - 1))
|
||||
osd_resolution_tmp = ort = 0;
|
||||
|
||||
if (resCount == 1)
|
||||
ort = 0;
|
||||
|
||||
setFbMode = frameBuffer->setMode(frameBuffer->osd_resolutions[ort].xRes,
|
||||
frameBuffer->osd_resolutions[ort].yRes,
|
||||
frameBuffer->osd_resolutions[ort].bpp);
|
||||
|
||||
#else
|
||||
/* all other hardware ignores setMode parameters */
|
||||
setFbMode = frameBuffer->setMode(0, 0, 0);
|
||||
#endif
|
||||
|
||||
if (setFbMode == -1) {
|
||||
dprintf(DEBUG_NORMAL, "Error while setting framebuffer mode\n");
|
||||
exit(-1);
|
||||
}
|
||||
@@ -5243,11 +5318,7 @@ bool CNeutrinoApp::adjustToChannelID(const t_channel_id channel_id)
|
||||
}
|
||||
|
||||
/*
|
||||
* commit 523b273a changed the names of config file entries:
|
||||
* casystem_display => infobar_casystem_display
|
||||
* casystem_dotmatrix => infobar_casystem_dotmatrix
|
||||
* casystem_frame => infobar_casystem_frame
|
||||
* convert these, so that users do not need to set up their system again
|
||||
* convert config keys, so that users do not need to set up their system again
|
||||
*/
|
||||
struct __key_rename {
|
||||
const char *from;
|
||||
@@ -5258,6 +5329,14 @@ static struct __key_rename key_rename[] = {
|
||||
{ "casystem_display", "infobar_casystem_display" },
|
||||
{ "casystem_dotmatrix", "infobar_casystem_dotmatrix"},
|
||||
{ "casystem_frame", "infobar_casystem_frame" },
|
||||
{ "screen_StartX_crt", "screen_StartX_crt_0" },
|
||||
{ "screen_StartY_crt", "screen_StartY_crt_0" },
|
||||
{ "screen_EndX_crt", "screen_EndX_crt_0" },
|
||||
{ "screen_EndY_crt", "screen_EndY_crt_0" },
|
||||
{ "screen_StartX_lcd", "screen_StartX_lcd_0" },
|
||||
{ "screen_StartY_lcd", "screen_StartY_lcd_0" },
|
||||
{ "screen_EndX_lcd", "screen_EndX_lcd_0" },
|
||||
{ "screen_EndY_lcd", "screen_EndY_lcd_0" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -5280,7 +5359,7 @@ void CNeutrinoApp::migrateConfig(const char *fname)
|
||||
/* only set new key to old value if the new key does not yet exist */
|
||||
if (configfile.getInt32(to, magic) == magic)
|
||||
configfile.setInt32(to, tmp);
|
||||
/* always remove old key*/
|
||||
/* always remove old key */
|
||||
configfile.deleteKey(from);
|
||||
}
|
||||
/* more complex migration, including converting values etc. could be done here */
|
||||
@@ -5290,4 +5369,3 @@ void CNeutrinoApp::migrateConfig(const char *fname)
|
||||
if (my_system(NEUTRINO_NI_MIGRATION_SCRIPT) != 0)
|
||||
perror(NEUTRINO_NI_MIGRATION_SCRIPT " failed");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user