]> git.vomp.tv Git - vompclient-marten.git/commitdiff
NTSC support, needs testing
authorChris Tallon <chris@vomp.tv>
Wed, 20 Jul 2005 00:02:02 +0000 (00:02 +0000)
committerChris Tallon <chris@vomp.tv>
Wed, 20 Jul 2005 00:02:02 +0000 (00:02 +0000)
29 files changed:
Makefile
command.cc
command.h
defines.h
main.cc
osd.cc
osd.h
other/wallpaper.jpg [deleted file]
other/wallpaperNTSC.jpg [new file with mode: 0644]
other/wallpaperPAL.jpg [new file with mode: 0644]
tcp.cc
vchannellist.cc
vlivebanner.cc
vlivebanner.h
vmute.cc
vmute.h
vrecordinglist.cc
vrecordingmenu.cc
vrecordingmenu.h
vserverselect.cc
vserverselect.h
vvideolive.cc
vvideolive.h
vvideorec.cc
vvideorec.h
vvolume.cc
vvolume.h
vwelcome.cc
vwelcome.h

index 21f0214c5fdfc4f8284e4fcf7efdfb230c9378b9..e58d89f403b24d3bb9e6f73e0a76550c98df8dba 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
 CC = /opt/crosstool/powerpc-405-linux-gnu/gcc-2.95.3-glibc-2.2.5/bin/powerpc-405-linux-gnu-g++
 STRIP = /opt/crosstool/powerpc-405-linux-gnu/gcc-2.95.3-glibc-2.2.5/bin/powerpc-405-linux-gnu-strip
+
 CXX = $(CC)
 INCLUDES = -I../jpeg-6b
 CXXFLAGS = -Wall -Woverloaded-virtual -Werror $(INCLUDES)
index fe7bd6cba07df32042197c65117da93703e5e884..7c4285ddfb13ac880263211126871ba9055d2dec 100644 (file)
@@ -78,6 +78,8 @@ void Command::run()
 
   mainPid = getpid();
 
+  UCHAR screenSize = Osd::getInstance()->getScreenSize();
+
   // moved from startup because surface delete doesn't work
 
   // just in case
@@ -86,7 +88,7 @@ void Command::run()
 
   // Blue background
   View* v = new View();
-  v->setDimensions(SCREENHEIGHT, SCREENWIDTH);
+  v->setDimensions(Osd::getInstance()->getScreenHeight(), Osd::getInstance()->getScreenWidth());
   v->setBackgroundColour(Colour::VIDEOBLUE);
   v->draw();
   v->show();
@@ -95,7 +97,16 @@ void Command::run()
 
   // Wallpaper
   VWallpaper* w = new VWallpaper();
-  w->init("/wallpaper.jpg");
+  if (screenSize == Osd::PAL)
+  {
+    Log::getInstance()->log("Command", Log::DEBUG, "PAL wallpaper selected");
+    w->init("/wallpaperPAL.jpg");
+  }
+  else
+  {
+    Log::getInstance()->log("Command", Log::DEBUG, "NTSC wallpaper selected");
+    w->init("/wallpaperNTSC.jpg");
+  }
   w->draw();
   w->show();
   viewman->add(w);
@@ -276,7 +287,14 @@ void Command::broadcastForServers()
 {
   VInfo* viewWait = new VInfo();
   viewWait->setDimensions(200, 400);
-  viewWait->setScreenPos(170, 200);
+  if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+  {
+    viewWait->setScreenPos(170, 200);
+  }
+  else
+  {
+    viewWait->setScreenPos(160, 150);
+  }
   viewWait->setMainText("\n                        Locating server");
   viewWait->draw();
   viewWait->show();
@@ -301,7 +319,14 @@ int Command::connectToServer(int vectorIndex)
 
   VInfo* viewWait = new VInfo();
   viewWait->setDimensions(200, 400);
-  viewWait->setScreenPos(170, 200);
+  if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+  {
+    viewWait->setScreenPos(170, 200);
+  }
+  else
+  {
+    viewWait->setScreenPos(160, 150);
+  }
   viewWait->setMainText("\n                     Connecting to VDR");
   viewWait->draw();
   viewWait->show();
index c7a0b56791506e5001c4111e1d11827ff76f3721..8e907f621852dbb5ab96cf540b4f11ed1a94cf76 100644 (file)
--- a/command.h
+++ b/command.h
@@ -49,6 +49,7 @@
 #include "vwelcome.h"
 #include "vmute.h"
 #include "colour.h"
+#include "osd.h"
 
 class Command : public MessageQueue
 {
index 9d750fb9d325f80edb0ef1b88cff260ebcb55f0b..0d6f880245dc0eea51b1326c7d10dee9e07d623a 100644 (file)
--- a/defines.h
+++ b/defines.h
@@ -31,8 +31,8 @@ typedef unsigned long long ULLONG;
 //#define SCREENHEIGHT 576
 //#define SCREENHEIGHT 480
 
-extern int SCREENWIDTH;
-extern int SCREENHEIGHT;
+//extern int SCREENWIDTH;
+//extern int SCREENHEIGHT;
 
 ULLONG htonll(ULLONG a);
 ULLONG ntohll(ULLONG a);
diff --git a/main.cc b/main.cc
index 57625f3406e55e65f80092821a696376236a18b7..4bd36b692bfcb104211b657e3f52ef7748d8fdda 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -212,10 +212,13 @@ int main(int argc, char** argv)
     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);
+  // temp hack - simulate ntsc on pal
+//  SCREENHEIGHT = 480;
+//  videoFormat = Video::NTSC;
+
+  success = osd->init("/dev/stbgfx", SCREENHEIGHT, SCREENWIDTH, videoFormat, 1);
   if (success)
   {
     logger->log("Core", Log::INFO, "OSD module initialised");
diff --git a/osd.cc b/osd.cc
index d3253013c3554dc90c1cdc9a6cff2d17467dcd63..5040dbfd4f9e4c0a6674f6a2d8e4e21119701ae9 100644 (file)
--- a/osd.cc
+++ b/osd.cc
@@ -60,7 +60,12 @@ int Osd::getScreenWidth()
   return width;
 }
 
-int Osd::init(char* device, int height, int width, int doubleBuffering)
+int Osd::getScreenSize()
+{
+  return screenSize;
+}
+
+int Osd::init(char* device, int height, int width, UCHAR tscreenSize, int doubleBuffering)
 {
   if (initted) return 0;
 
@@ -75,6 +80,7 @@ int Osd::init(char* device, int height, int width, int doubleBuffering)
 
   this->height = height;
   this->width = width;
+  screenSize = tscreenSize;
 
   Surface::initConversionTables();
 
diff --git a/osd.h b/osd.h
index 1c115045a6c01bb395d737c05279f7f653d1a433..04cc8a0c90f3e1085a68d7c5b180094c93be20e2 100644 (file)
--- a/osd.h
+++ b/osd.h
@@ -36,15 +36,20 @@ class Osd
     ~Osd();
     static Osd* getInstance();
 
-    int init(char* device, int height, int width, int doubleBuffering);
+    int init(char* device, int height, int width, UCHAR tscreenSize, int doubleBuffering);
     int shutdown();
 
     int getFD();
     int getScreenHeight();
     int getScreenWidth();
+    int getScreenSize();
 
     void screenShot(char* fileName);
 
+    // Video formats - AV_SET_VID_DISP_FMT  // here, video, everywhere!
+    const static UCHAR NTSC = 0;
+    const static UCHAR PAL = 1;
+
   private:
     static Osd* instance;
     int initted;
@@ -55,7 +60,7 @@ class Osd
     int fdOsd;
     int width;
     int height;
-
+    UCHAR screenSize;
 };
 
 #endif
diff --git a/other/wallpaper.jpg b/other/wallpaper.jpg
deleted file mode 100644 (file)
index ed56138..0000000
Binary files a/other/wallpaper.jpg and /dev/null differ
diff --git a/other/wallpaperNTSC.jpg b/other/wallpaperNTSC.jpg
new file mode 100644 (file)
index 0000000..5df6cbe
Binary files /dev/null and b/other/wallpaperNTSC.jpg differ
diff --git a/other/wallpaperPAL.jpg b/other/wallpaperPAL.jpg
new file mode 100644 (file)
index 0000000..ed56138
Binary files /dev/null and b/other/wallpaperPAL.jpg differ
diff --git a/tcp.cc b/tcp.cc
index ef78c9625364cfd68241518963bcdf95f0003bf4..0546d6d0378a25693f93704ae4b5fc74124e4fea 100644 (file)
--- a/tcp.cc
+++ b/tcp.cc
@@ -144,12 +144,14 @@ int TCP::isConnected()
   return connected;
 }
 
-int TCP::sendPacket(void* buf, size_t count)
+int TCP::sendPacket(void* bufR, size_t count)
 {
   size_t bytes_sent = 0;
   int this_write;
   int temp_write;
 
+  unsigned char* buf = (unsigned char*)bufR;
+
   while (bytes_sent < count)
   {
     do
@@ -164,7 +166,7 @@ int TCP::sendPacket(void* buf, size_t count)
       return(this_write);
     }
     bytes_sent += this_write;
-    (unsigned char*)buf += this_write;
+    buf += this_write;
   }
   return(count);
 }
index 67291f52a4d098551276ae682ced110ceb4b2464..3550e14a6741a5da4de14fc18698db5dda9b1db3 100644 (file)
 
 VChannelList::VChannelList(ULONG type)
 {
-  setScreenPos(80, 70);
+  if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+  {
+    setScreenPos(80, 70);
+  }
+  else
+  {
+    setScreenPos(70, 35);
+  }
+
   setDimensions(420, 570);
 
   setBackgroundColour(Colour::VIEWBACKGROUND);
index 871001d8de98a65078e74171d3bd05cb5b83a584..b50ca9089b267183623c140435937fb46ec740b7 100644 (file)
 
 VLiveBanner::VLiveBanner()
 {
-  setScreenPos(130, 370);
+  if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+  {
+    setScreenPos(130, 370);
+  }
+  else
+  {
+    setScreenPos(120, 320);
+  }
+
   setDimensions(120, 500);
 
   setBackgroundColour(Colour::VIEWBACKGROUND);
index b0701dbc29e7a28cbca6bffcf4ebea96e002dc90..90555895d2d9bbe99e732f20d04836f46dabfc56 100644 (file)
@@ -29,6 +29,7 @@
 #include "vdr.h"
 #include "wselectlist.h"
 #include "colour.h"
+#include "osd.h"
 
 class VLiveBanner : public View
 {
index 3adc8812716c549b746ab0d5142c840905db5a99..4233a9eb967758756726411d3c16430c924ecc79 100644 (file)
--- a/vmute.cc
+++ b/vmute.cc
@@ -24,8 +24,16 @@ VMute::VMute()
 {
   isMuted = Audio::getInstance()->toggleUserMute();
 
+  if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+  {
+    setScreenPos(600, 500);
+  }
+  else
+  {
+    setScreenPos(590, 400);
+  }
+
   setDimensions(40, 40);
-  setScreenPos(600, 500);
 
   setBackgroundColour(Colour::VIEWBACKGROUND);
 }
diff --git a/vmute.h b/vmute.h
index 60ef05ea3345bf299b30d2f994efe95100abec22..c89d324d390de2c79e4904cf1c37c2284cc32605 100644 (file)
--- a/vmute.h
+++ b/vmute.h
@@ -28,6 +28,7 @@
 #include "audio.h"
 #include "wsymbol.h"
 #include "colour.h"
+#include "osd.h"
 
 class VMute : public View
 {
index 05d82a9f841b4b8a1feefaf03429ed3e2e1656e5..6eb572d5dc0b3d6f2fa42a31cd6cea50cd2f2605 100644 (file)
 
 VRecordingList::VRecordingList()
 {
-  setScreenPos(80, 70);
+  if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+  {
+    setScreenPos(80, 70);
+  }
+  else
+  {
+    setScreenPos(70, 35);
+  }
+
   setDimensions(420, 570);
 
   setBackgroundColour(Colour::VIEWBACKGROUND);
index 8e1d703bab0975fc7999e1246e4c91695838152f..63c402e296e9e4aaa474a24cb36ee7f16c70ae53 100644 (file)
@@ -24,7 +24,15 @@ VRecordingMenu::VRecordingMenu()
 {
   rec = NULL;
 
-  setScreenPos(260, 190);
+  if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+  {
+    setScreenPos(260, 190);
+  }
+  else
+  {
+    setScreenPos(250, 160);
+  }
+
   setDimensions(140, 200);
 
   setBackgroundColour(Colour::VIEWBACKGROUND);
@@ -109,7 +117,14 @@ int VRecordingMenu::handleCommand(int command)
       vi->setExitable();
       if (summary) vi->setMainText(summary);
       else vi->setMainText("Summary unavailable");
-      vi->setScreenPos(120, 130);
+      if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+      {
+        vi->setScreenPos(120, 130);
+      }
+      else
+      {
+        vi->setScreenPos(110, 90);
+      }
       vi->setDimensions(300, 490);
 
       ViewMan::getInstance()->addNoLock(vi);
@@ -131,7 +146,14 @@ int VRecordingMenu::handleCommand(int command)
       v->setTitleText("Delete recording");
       v->setMainText("Are you sure you want to delete this recording?");
       v->setDefault(VQuestion::NO);
-      v->setScreenPos(230, 160);
+      if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+      {
+        v->setScreenPos(230, 160);
+      }
+      else
+      {
+        v->setScreenPos(220, 140);
+      }
       v->setDimensions(180, 260);
 
       ViewMan::getInstance()->addNoLock(v);
index b21bd5a857b5eddfd8d60a6754090a862bed868d..816b1da8af45eaf228becd44b42aca822c0db81d 100644 (file)
@@ -34,6 +34,7 @@
 #include "vinfo.h"
 #include "vdr.h"
 #include "colour.h"
+#include "osd.h"
 
 class VRecordingList;
 
index 09535416b56a8cb58761f2035aaa731f277c31f9..ddc140a5b08ac70a36423d7fc52dfbb7d45dd9f9 100644 (file)
@@ -28,8 +28,15 @@ VServerSelect::VServerSelect(std::vector<char*>* serverIPs, int* tselectServer)
   // anyway, now it doesn't use a object wide reference.
   selectServer = tselectServer;
 
+  if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+  {
+    setScreenPos(220, 200);
+  }
+  else
+  {
+    setScreenPos(210, 150);
+  }
   setDimensions(200, 300);
-  setScreenPos(220, 200);
   setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
   setTitleBarColour(Colour::TITLEBARBACKGROUND);
index 66553607253d76f3da66d7e58789e89f267292f8..423b3bbf69697655a63ae77b9396e851fdf43d1c 100644 (file)
@@ -30,6 +30,7 @@
 #include "remote.h"
 #include "wselectlist.h"
 #include "colour.h"
+#include "osd.h"
 
 class VServerSelect : public View
 {
index 25b672f6f07ceee740ec4b4e8f8cbe8903c81253..431c48dcc39124f1b3e39a46b9a0067bd24aed55 100644 (file)
@@ -28,7 +28,7 @@ VVideoLive::VVideoLive(List* tchanList)
   chanList = tchanList;
   currentChannel = 0;
 
-  setDimensions(SCREENHEIGHT, SCREENWIDTH);
+  setDimensions(Osd::getInstance()->getScreenHeight(), Osd::getInstance()->getScreenWidth());
   Colour transparent(0, 0, 0, 0);
   setBackgroundColour(transparent);
 }
index 838d805cb06f04d0435ced74b3edf6a3bdab5b03..925650d1104aa674ccb3cebfb521595a27f5322b 100644 (file)
@@ -32,6 +32,7 @@
 #include "viewman.h"
 #include "vchannelselect.h"
 #include "colour.h"
+#include "osd.h"
 
 class VVideoLive : public View
 {
index 793e481218a19d60f69ccd650020ddda3a84a216..70707e9379d02fc4ac829d9fba61e552351bf32e 100644 (file)
@@ -28,7 +28,7 @@ VVideoRec::VVideoRec(Recording* rec)
 
   myRec = rec;
 
-  setDimensions(SCREENHEIGHT, SCREENWIDTH);
+  setDimensions(Osd::getInstance()->getScreenHeight(), Osd::getInstance()->getScreenWidth());
   Colour transparent(0, 0, 0, 0);
   setBackgroundColour(transparent);
 }
index 872a18e4d2c7afc5fd0386355cd79d340b21971f..c1d2632a92f2c12a4ad2d213da0c46e5a2aef5f0 100644 (file)
@@ -29,6 +29,7 @@
 #include "recording.h"
 #include "command.h"
 #include "colour.h"
+#include "osd.h"
 
 class VVideoRec : public View
 {
index 348bf2721367afb23ebd60316e744b1a2a5377b1..6408dc57081e5ad0575621e0ccc556e71512326a 100644 (file)
@@ -24,8 +24,16 @@ VVolume::VVolume()
 {
   displayVolume = Audio::getInstance()->getVolume();
 
+  if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+  {
+    setScreenPos(100, 499);
+  }
+  else
+  {
+    setScreenPos(90, 400);
+  }
+
   setDimensions(31, 227);
-  setScreenPos(100, 499);
 
   setBackgroundColour(Colour::VIEWBACKGROUND);
 }
@@ -36,7 +44,7 @@ void VVolume::draw()
 
   WSymbol* w = new WSymbol;
   w->nextSymbol = WSymbol::VOLUME2;
-  w->setScreenPos(103, 509);
+  w->setScreenPos(screenX + 3, screenY + 10);
   w->draw();
 
   int i = 0;
@@ -44,14 +52,14 @@ void VVolume::draw()
   for(; i < displayVolume; i++)
   {
     w->nextSymbol = WSymbol::VOLBAR;
-    w->setScreenPos(140 + (i * 9), 502);
+    w->setScreenPos(screenX + 40 + (i * 9), screenY + 3);
     w->draw();
   }
 
   for(; i < 20; i++)
   {
     w->nextSymbol = WSymbol::VOLDOT;
-    w->setScreenPos(140 + (i * 9), 512);
+    w->setScreenPos(screenX + 40 + (i * 9), screenY + 13);
     w->draw();
   }
 
index 068f483fa1103a2c663c56bff24c12abd15366b2..380dca4ea1ec235a09bc77558add3b089e423f29 100644 (file)
--- a/vvolume.h
+++ b/vvolume.h
@@ -28,6 +28,7 @@
 #include "audio.h"
 #include "wsymbol.h"
 #include "colour.h"
+#include "osd.h"
 
 class VVolume : public View
 {
index 2a950b6e8b8a4da28dda6d05559733d00fe31414..1cd1031914748aadbdb6a6ed59809ed5c132e41a 100644 (file)
 VWelcome::VWelcome()
 {
   setDimensions(190, 460);
-  setScreenPos(140, 170);
+
+  if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+  {
+    setScreenPos(140, 170);
+  }
+  else
+  {
+    setScreenPos(130, 140);
+  }
 
   setBackgroundColour(Colour::VIEWBACKGROUND);
   setTitleBarOn(1);
@@ -185,7 +193,14 @@ void VWelcome::doRecordingsList()
 
   VInfo* viewWait = new VInfo();
   viewWait->setDimensions(190, 460);
-  viewWait->setScreenPos(140, 170);
+  if (Osd::getInstance()->getScreenSize() == Osd::PAL)
+  {
+    viewWait->setScreenPos(140, 170);
+  }
+  else
+  {
+    viewWait->setScreenPos(130, 140);
+  }
   viewWait->setMainText("\n                  Downloading recordings list");
   viewWait->draw();
   viewWait->show();
index 86ed434139ff2dd3d19971040aebd07c42830b9e..417a16969a5caed1a353f15ef115c516247baec3 100644 (file)
@@ -36,6 +36,7 @@
 #include "command.h"
 #include "message.h"
 #include "colour.h"
+#include "osd.h"
 
 class VWelcome : public View
 {