]> git.vomp.tv Git - vompclient.git/commitdiff
New code for "use nvram for initial config" RFE #1226500
authorChris Tallon <chris@vomp.tv>
Tue, 12 Jul 2005 01:14:57 +0000 (01:14 +0000)
committerChris Tallon <chris@vomp.tv>
Tue, 12 Jul 2005 01:14:57 +0000 (01:14 +0000)
defines.h
main.cc
mtd.h

index 8b3a337fde41d185aa9606c65ec89243099b43c6..9d750fb9d325f80edb0ef1b88cff260ebcb55f0b 100644 (file)
--- 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 92e53d1fb849941a70cd8ecb862e8f2a9747486d..57625f3406e55e65f80092821a696376236a18b7 100644 (file)
--- 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 c14322229ecf7343f28ade519e8d5cea453401cd..0e3f7de857eee7df0cb96364812b81e6cc98f775 100644 (file)
--- a/mtd.h
+++ b/mtd.h
 
 // 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