From aa22d1ec51aa01680a103eb0b48375c7e996a92f Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Tue, 12 Jul 2005 01:14:57 +0000 Subject: [PATCH] New code for "use nvram for initial config" RFE #1226500 --- defines.h | 8 ++++++-- main.cc | 46 +++++++++++++++++++++++++++++++++++++++++++++- mtd.h | 17 +++++++++++++++++ 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/defines.h b/defines.h index 8b3a337..9d750fb 100644 --- a/defines.h +++ b/defines.h @@ -27,8 +27,12 @@ typedef unsigned int UINT; typedef unsigned long ULONG; typedef unsigned long long ULLONG; -#define SCREENWIDTH 720 -#define SCREENHEIGHT 576 +//#define SCREENWIDTH 720 +//#define SCREENHEIGHT 576 +//#define SCREENHEIGHT 480 + +extern int SCREENWIDTH; +extern int SCREENHEIGHT; ULLONG htonll(ULLONG a); ULLONG ntohll(ULLONG a); diff --git a/main.cc b/main.cc index 92e53d1..57625f3 100644 --- a/main.cc +++ b/main.cc @@ -57,6 +57,9 @@ VDR* vdr; Video* video; Audio* audio; +int SCREENWIDTH = 0; +int SCREENHEIGHT = 0; + int main(int argc, char** argv) { if ((argc > 1) && (!strcmp(argv[1], "-d"))) debugEnabled = 1; @@ -171,6 +174,47 @@ int main(int argc, char** argv) shutdown(1); } + // Need to init SCREENWIDTH, SCREENHEIGHT and ready the pal/ntsc connection stuff immediately + UCHAR videoFormat = 0; + UCHAR videoConnection = 0; + + short mtdVideoMode = mtd->getVideoMode(); + if (mtdVideoMode == 0) + { + SCREENWIDTH = 720; + SCREENHEIGHT = 480; + videoFormat = Video::NTSC; + videoConnection = Video::COMPOSITE; + logger->log("Core", Log::INFO, "Read from MTD: NTSC 720x480 composite"); + } + else if (mtdVideoMode == 1) + { + SCREENWIDTH = 720; + SCREENHEIGHT = 576; + videoFormat = Video::PAL; + videoConnection = Video::SCART; + logger->log("Core", Log::INFO, "Read from MTD: PAL 720x576 RGB"); + } + else if (mtdVideoMode == 2) + { + SCREENWIDTH = 720; + SCREENHEIGHT = 576; + videoFormat = Video::PAL; + videoConnection = Video::COMPOSITE; + logger->log("Core", Log::INFO, "Read from MTD: PAL 720x576 composite"); + } + else + { + // ? + + SCREENWIDTH = 720; + SCREENHEIGHT = 480; + videoFormat = Video::NTSC; + videoConnection = Video::COMPOSITE; + logger->log("Core", Log::INFO, "MTD gave us no help. Guessing NTSC."); + + } + success = osd->init("/dev/stbgfx", SCREENHEIGHT, SCREENWIDTH, 1); if (success) { @@ -193,7 +237,7 @@ int main(int argc, char** argv) shutdown(1); } - success = video->init(Video::PAL, Video::SCART, Video::ASPECT4X3, Video::NORMAL); + success = video->init(videoFormat, videoConnection, Video::ASPECT4X3, Video::NORMAL); if (success) { logger->log("Core", Log::INFO, "Video module initialised"); diff --git a/mtd.h b/mtd.h index c143222..0e3f7de 100644 --- a/mtd.h +++ b/mtd.h @@ -20,6 +20,23 @@ // Information for this class taken from the mvpmc project - thanks +/* + discussion on short positions: + http://www.shspvr.com/smf/index.php?topic=3765.30 + +It says: +1 = NTSC/composite +2 = PAL/Scart +3 = PAL/Composite + +But with PAL/Scart/RGB I get a value of 1 + +So, am assuming: +0 = NTSC / composite +1 = PAL / scart rgb +2 = PAL / scart composite +*/ + #ifndef MTD_H #define MTD_H -- 2.39.2