]> git.vomp.tv Git - vompclient.git/commitdiff
WSS files added, and now working on live tv as well
authorChris Tallon <chris@vomp.tv>
Wed, 18 Oct 2006 22:45:11 +0000 (22:45 +0000)
committerChris Tallon <chris@vomp.tv>
Wed, 18 Oct 2006 22:45:11 +0000 (22:45 +0000)
timers.cc
vvideolive.cc
vvideolive.h
vvideorec.cc
wwss.cc [new file with mode: 0644]
wwss.h [new file with mode: 0644]

index 11fb3af19b53faf17e438828c3d522543916d4cf..2980105841a803f4f44d4ad13a42785f8101ae78 100755 (executable)
--- a/timers.cc
+++ b/timers.cc
@@ -305,7 +305,7 @@ void Timers::threadMethod()
       threadUnlock();\r
       //logger->log("Timers", Log::DEBUG, "un-LOCKED -TIMERS- MUTEX (3)");\r
       //printf("\n\n\n WOOOOO \n\n\n The anti deadlock code is working!!! \n\n\n");\r
-      MILLISLEEP(10); // 10ms - too long?\r
+      MILLISLEEP(20); // 10ms - too long? too short?\r
       //logger->log("Timers", Log::DEBUG, "Waiting for LOCK -TIMERS- MUTEX 7");\r
       threadLock();\r
       //logger->log("Timers", Log::DEBUG, "LOCKED -TIMERS- MUTEX 7");\r
index 4d274a477036c9339648910bf71dae6190b2a0cc..e5156645d0711a720649f00f0aeb203d8a7c7c61 100644 (file)
@@ -45,6 +45,14 @@ VVideoLive::VVideoLive(ChannelList* tchanList, ULONG tstreamType, VChannelList*
   create(video->getScreenWidth(), video->getScreenHeight());
   Colour transparent(0, 0, 0, 0);
   setBackgroundColour(transparent);
+
+  wss.setSurface(surface);
+  wss.setWide(true);
+
+  wssRegion.x = 0;
+  wssRegion.y = 6;
+  wssRegion.w = video->getScreenWidth();
+  wssRegion.h = 2;
 }
 
 VVideoLive::~VVideoLive()
@@ -268,12 +276,18 @@ void VVideoLive::processMessage(Message* m)
       }
       case Player::ASPECT43:
       {
-        Log::getInstance()->log("VVideoLive", Log::DEBUG, "Received do WSS 43");
+        Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 43");
+        wss.setWide(false);
+        wss.draw();
+        ViewMan::getInstance()->updateView(this, &wssRegion);
         break;
       }
       case Player::ASPECT169:
       {
-        Log::getInstance()->log("VVideoLive", Log::DEBUG, "Received do WSS 169");
+        Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 169");
+        wss.setWide(true);
+        wss.draw();
+        ViewMan::getInstance()->updateView(this, &wssRegion);
         break;
       }
     }
index f4de463e9671d6547aadfb0acffdcb1c2b319e8c..da90bfda4c55985cc137f87bfbea94384aa778d5 100644 (file)
@@ -38,6 +38,7 @@
 #include "i18n.h"
 #include "vepg.h"
 #include "wtextbox.h"
+#include "wwss.h"
 
 class VEpg;
 class VChannelList;
@@ -93,6 +94,9 @@ class VVideoLive : public View
     void toggleChopSides();
     int videoMode;
     int saveUnavailable;
+
+    Wwss wss;
+    Region wssRegion;
 };
 
 #endif
index 656b9f93c27a130e73f8019f78444299b86ed594..2f48e3ca6aced9bfc593be185c28161bbef5f2fa 100644 (file)
@@ -86,9 +86,9 @@ VVideoRec::VVideoRec(Recording* rec)
   wss.setWide(true);
 
   wssRegion.x = 0;
-  wssRegion.y = 0;
+  wssRegion.y = 6;
   wssRegion.w = video->getScreenWidth();
-  wssRegion.h = 10;
+  wssRegion.h = 2;
 }
 
 VVideoRec::~VVideoRec()
@@ -108,7 +108,6 @@ VVideoRec::~VVideoRec()
 void VVideoRec::draw()
 {
   View::draw();
-  wss.draw();
 }
 
 void VVideoRec::go(ULONG startFrameNum)
@@ -252,7 +251,6 @@ int VVideoRec::handleCommand(int command)
     case Remote::RED:
     {
       //player->test1();
-      Video::getInstance()->setAspectRatio(Video::ASPECT4X3);
 
 
       /*
@@ -269,7 +267,6 @@ int VVideoRec::handleCommand(int command)
     }
     case Remote::GREEN:
     {
-      Video::getInstance()->setAspectRatio(Video::ASPECT16X9);
       //player->test2();
       return 2;
     }
@@ -300,7 +297,7 @@ void VVideoRec::processMessage(Message* m)
     }
     case Player::STOP_PLAYBACK:
     {
-      // Obselete ish - improve this
+      // FIXME Obselete ish - improve this
       Message* m = new Message(); // Must be done after this thread finishes, and must break into master mutex
       m->to = Command::getInstance();
       m->message = Message::STOP_PLAYBACK;
@@ -313,7 +310,6 @@ void VVideoRec::processMessage(Message* m)
       wss.setWide(false);
       wss.draw();
       ViewMan::getInstance()->updateView(this, &wssRegion);
-      Log::getInstance()->log("VVideoRec", Log::DEBUG, "WSS done");
       break;
     }
     case Player::ASPECT169:
@@ -322,7 +318,6 @@ void VVideoRec::processMessage(Message* m)
       wss.setWide(true);
       wss.draw();
       ViewMan::getInstance()->updateView(this, &wssRegion);
-      Log::getInstance()->log("VVideoRec", Log::DEBUG, "WSS done");
       break;
     }
   }
diff --git a/wwss.cc b/wwss.cc
new file mode 100644 (file)
index 0000000..ed57efc
--- /dev/null
+++ b/wwss.cc
@@ -0,0 +1,110 @@
+/*\r
+    Copyright 2006 Chris Tallon\r
+\r
+    This file is part of VOMP.\r
+\r
+    VOMP is free software; you can redistribute it and/or modify\r
+    it under the terms of the GNU General Public License as published by\r
+    the Free Software Foundation; either version 2 of the License, or\r
+    (at your option) any later version.\r
+\r
+    VOMP is distributed in the hope that it will be useful,\r
+    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+    GNU General Public License for more details.\r
+\r
+    You should have received a copy of the GNU General Public License\r
+    along with VOMP; if not, write to the Free Software\r
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+*/\r
+\r
+#include "wwss.h"\r
+\r
+Wwss::Wwss()\r
+{\r
+}\r
+\r
+Wwss::~Wwss()\r
+{\r
+}\r
+\r
+UINT Wwss::gcd(UINT a, UINT b)\r
+{\r
+  UINT t;\r
+  while (b != 0)\r
+  {\r
+    t = b;\r
+    b = a % b;\r
+    a = t;\r
+  }\r
+  return a;\r
+}\r
+\r
+UINT Wwss::lcm(UINT a, UINT b)\r
+{\r
+  return (a / gcd(a, b)) * b;\r
+}\r
+\r
+void Wwss::setWide(bool twide)\r
+{\r
+  wide = twide;\r
+}\r
+\r
+void Wwss::draw()\r
+{\r
+  // The aspect43 and aspect169 codes are not what they should be according to the docs, but these are what work...\r
+  // (1 = 111000, = 0 000111)\r
+  static UCHAR runIn[]     = {1,1,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1};                       // 29 pos 0\r
+  static UCHAR startCode[] = {0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1};                                 // 24 pos 29\r
+  static UCHAR aspect43[]  = {0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0}; // = 0001   4:3 full frame      // 24 pos 53\r
+  static UCHAR aspect169[] = {1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1}; // = 1110   16:9 anamorphic     // 24 pos 53\r
+  static UCHAR theRest[]   = {0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,                                  // 60 pos 77\r
+                              0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,\r
+                              0,0,0,1,1,1,0,0,0,1,1,1};\r
+  /*\r
+  Real PAL pixel frequency: 13.5 MHz\r
+  WSS element frequency: 5 MHz\r
+  = 2.7 pal pixels per wss element\r
+  * 137 wss elements = 369.9 pal pixels (total code width) (round to 370..)\r
+\r
+  There is also a 11us gap at the start of the pal raster, but since I don't really have any\r
+  idea where our 720 pixels start in the raster I can't calculate an offset.\r
+\r
+  PAL line 23 seems to be MVP line 6.\r
+  */\r
+\r
+  const UINT   Ns = 137;           // Num pix src\r
+  const UINT   Nd = 370;           // Num pix dst         359->395 does something. not the right thing, but something.\r
+  UINT         Nl = lcm(Ns, Nd);   // Num pix in lcm\r
+  UINT         Ss = Nl / Ns;       // Source split (how many lcm px = 1 src px)\r
+  UINT         Sd = Nl / Nd;       // Dst split\r
+  UCHAR src[Ns];\r
+\r
+  memcpy(&src[0], runIn, 29);\r
+  memcpy(&src[29], startCode, 24);\r
+  if (wide) memcpy(&src[53], aspect169, 24);\r
+  else      memcpy(&src[53], aspect43, 24);\r
+  memcpy(&src[77], theRest, 60);\r
+\r
+  float dst[Nd];\r
+  UINT lcmpxbase = 0;\r
+\r
+  for(UINT t = 0; t < Nd; t++) // for every destination pixel\r
+  {\r
+    dst[t] = 0;\r
+    for(UINT lcmpx = lcmpxbase; lcmpx < (lcmpxbase + Sd); lcmpx++)\r
+    {\r
+      if (src[lcmpx / Ss]) dst[t] += (float)1/Sd;\r
+    }\r
+    lcmpxbase += Sd;\r
+  }\r
+\r
+  Colour c;\r
+  UINT value;\r
+  for(UINT q = 0; q < Nd; q++)\r
+  {\r
+    value = (UINT)(dst[q] * 182); // Apparently this is a better number than 255 for the colour value\r
+    c.set(value, value, value);\r
+    drawPixel(q, 6, c);\r
+  }\r
+}\r
diff --git a/wwss.h b/wwss.h
new file mode 100644 (file)
index 0000000..606f12d
--- /dev/null
+++ b/wwss.h
@@ -0,0 +1,46 @@
+/*
+    Copyright 2006 Chris Tallon
+
+    This file is part of VOMP.
+
+    VOMP 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.
+
+    VOMP 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 VOMP; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifndef WWSS_H
+#define WWSS_H
+
+#include <stdio.h>
+#include <string.h>
+
+#include "defines.h"
+#include "widget.h"
+#include "colour.h"
+
+class Wwss : public Widget
+{
+  public:
+    Wwss();
+    ~Wwss();
+    void draw();
+    void setWide(bool wide);
+
+  private:
+    UINT gcd(UINT a, UINT b);
+    UINT lcm(UINT a, UINT b);
+
+    bool wide;
+};
+
+#endif