]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Bits of OSD for recording play
authorChris Tallon <chris@vomp.tv>
Sat, 4 Mar 2006 23:53:22 +0000 (23:53 +0000)
committerChris Tallon <chris@vomp.tv>
Sat, 4 Mar 2006 23:53:22 +0000 (23:53 +0000)
box.cc
box.h
colour.h
command.cc
main.cc
player.h
playervideo.h
vvideorec.cc
vvideorec.h
wsymbol.cc
wsymbol.h

diff --git a/box.cc b/box.cc
index 96c085c44e380ca04e62b3cccd166a57969d0646..9c8120bd34e39545b6da38e1e51af3194947a5e3 100644 (file)
--- a/box.cc
+++ b/box.cc
@@ -192,6 +192,11 @@ void Box::rectangle(int x1, int y1, int w, int h, Colour& colour)
   surface->fillblt(offsetX + x1, offsetY + y1, w, h, surface->rgba(colour.red, colour.green, colour.blue, colour.alpha));
 }
 
+void Box::rectangle(Region& region, Colour& colour)
+{
+  surface->fillblt(offsetX + region.x, offsetY + region.y, region.w, region.h, surface->rgba(colour.red, colour.green, colour.blue, colour.alpha));
+}
+
 void Box::drawText(char* text, int x, int y, Colour& colour)
 {
   surface->drawText(text, offsetX + x, offsetY + y, colour.red, colour.green, colour.blue);
diff --git a/box.h b/box.h
index bf3462287138cdeaf317d9e763fad9b03ff5f827..06de5004c53df345ed6c9c0ed8b8222abefd81d9 100644 (file)
--- a/box.h
+++ b/box.h
@@ -49,6 +49,8 @@ class Box
 
     // Drawing functions level 0
     void rectangle(int x1, int y1, int w, int h, Colour& colour);
+    void rectangle(Region& region, Colour& colour);
+
     void drawText(char* text, int x, int y, Colour& colour);
     void drawTextRJ(char* text, int x, int y, Colour& colour);
     void drawTextCentre(char* text, int x, int y, Colour& colour);
index 84de2d66efdf040d8c565997a102f86368dd220c..9067e2ae38dd2d7c6affa6ee85c64a2f75a337f5 100644 (file)
--- a/colour.h
+++ b/colour.h
@@ -33,6 +33,11 @@ class Colour
     Colour(int Tred, int Tgreen, int Tblue, int Talpha)
       { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; }
 
+    void set(int Tred, int Tgreen, int Tblue)
+      { red = Tred; green = Tgreen; blue = Tblue; alpha = 255; }
+
+    void set(int Tred, int Tgreen, int Tblue, int Talpha)
+      { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; }
 
     int red;
     int green;
index ecaf4e1824723d6a053063d4f12e8e1a16de52f4..9edb793a0719b1cdbf42e3e5b4161694686b6b3a 100644 (file)
@@ -575,4 +575,10 @@ void Command::doJustConnected(VConnect* vconnect)
   viewman->updateView(vw);
 
   // Enter pre-keys here
+  handleCommand(Remote::THREE);
+  handleCommand(Remote::DOWN);
+  handleCommand(Remote::OK);
+  handleCommand(Remote::OK);
+  handleCommand(Remote::OK);
+
 }
diff --git a/main.cc b/main.cc
index 649224bfe5c63bb400ac53c3050ec79b04f2431b..84dafac78cd82b5c6bcc77f6737f2994cd5ae053 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -294,13 +294,6 @@ int main(int argc, char** argv)
 
 void shutdown(int code)
 {
-  if (command)
-  {
-    command->shutdown();
-    delete command;
-    logger->log("Core", Log::NOTICE, "Command module shut down");
-  }
-
   if (viewman)
   {
     viewman->shutdown();
@@ -308,6 +301,13 @@ void shutdown(int code)
     logger->log("Core", Log::NOTICE, "ViewMan module shut down");
   }
 
+  if (command) // shut down command here in case views have posted messages
+  {
+    command->shutdown();
+    delete command;
+    logger->log("Core", Log::NOTICE, "Command module shut down");
+  }
+
   if (vdr)
   {
     vdr->shutdown();
index 0b4f990954010e2ac6518b95e2df21e8db9545e4..c4591d15d5220b1112ad66876df13550a9f0e807 100644 (file)
--- a/player.h
+++ b/player.h
@@ -45,6 +45,10 @@ class Player : public Thread, public Callback
     virtual void setPosition(ULLONG position)=0;
     virtual void setLength(ULLONG length)=0;
     virtual void resyncAudio()=0;
+    virtual bool isPaused()=0;
+    virtual bool isFfwd()=0;
+    virtual bool isFbwd()=0;
+
 #ifdef DEV
     virtual void test1()=0;
     virtual void test2()=0;
index e9aa4b970b5fdfe48bac464763c425ddb5fb603e..7d3908bf9e685f8617bdbe91fdbd27ead0917963 100644 (file)
@@ -57,6 +57,11 @@ class PlayerVideo : public Player
     void setPosition(ULLONG position);
     void setLength(ULLONG length);
     void resyncAudio();
+
+    bool isPaused() { return paused; }
+    bool isFfwd() { return ffwd; }
+    bool isFbwd() { return fbwd; }
+
 #ifdef DEV
     void test1();
     void test2();
index 94b571f431b5ed404e2bff4549bc45fb3ba3426f..3d5bd41549378251a1ca0804d9f72c47234ab45e 100644 (file)
@@ -31,8 +31,15 @@ VVideoRec::VVideoRec(Recording* rec)
   myRec = rec;
 
   create(video->getScreenWidth(), video->getScreenHeight());
-  Colour transparent(0, 0, 0, 0);
+  transparent.set(0, 0, 0, 0);
   setBackgroundColour(transparent);
+
+  barRegion.x = 0;
+  barRegion.y = video->getScreenHeight() - 66;   // FIXME, need to be - 1? and below?
+  barRegion.w = video->getScreenWidth();
+  barRegion.h = 66;
+
+  barBlue.set(0, 0, 150, 150);
 }
 
 VVideoRec::~VVideoRec()
@@ -41,6 +48,8 @@ VVideoRec::~VVideoRec()
   delete player;
   Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post delete player");
   Video::getInstance()->setDefaultAspect();
+
+  Timers::getInstance()->cancelTimer(this, 1);
 }
 
 void VVideoRec::draw()
@@ -53,6 +62,7 @@ void VVideoRec::go(ULLONG startPosition)
   ULLONG recLength = vdr->streamRecording(myRec);
   if (recLength)
   {
+    doBar(0);
     player->setLength(recLength);
     player->setPosition(startPosition);
     player->play();
@@ -110,15 +120,18 @@ int VVideoRec::handleCommand(int command)
     case Remote::PAUSE:
     {
       player->togglePause();
+      doBar(0);
       return 2;
     }
     case Remote::SKIPFORWARD:
     {
+      doBar(3);
       player->skipForward(60);
       return 2;
     }
     case Remote::SKIPBACK:
     {
+      doBar(4);
       player->skipBackward(60);
       return 2;
     }
@@ -129,11 +142,13 @@ int VVideoRec::handleCommand(int command)
     }
     case Remote::YELLOW:
     {
+      doBar(2);
       player->skipBackward(10);
       return 2;
     }
     case Remote::BLUE:
     {
+      doBar(1);
       player->skipForward(10);
       return 2;
     }
@@ -144,12 +159,30 @@ int VVideoRec::handleCommand(int command)
       return 2;
     }
 
+    case Remote::OK:
+    {
+      doBar(0);
+      return 2;
+    }
+
+
 //    case Remote::REVERSE:
 //    {
 //      player->toggleFastBackward();
 //      return 2;
 //    }
 
+    case Remote::ZERO: player->jumpToPercent(0); return 2;
+    case Remote::ONE: player->jumpToPercent(10); return 2;
+    case Remote::TWO: player->jumpToPercent(20); return 2;
+    case Remote::THREE: player->jumpToPercent(30); return 2;
+    case Remote::FOUR: player->jumpToPercent(40); return 2;
+    case Remote::FIVE: player->jumpToPercent(50); return 2;
+    case Remote::SIX: player->jumpToPercent(60); return 2;
+    case Remote::SEVEN: player->jumpToPercent(70); return 2;
+    case Remote::EIGHT: player->jumpToPercent(80); return 2;
+    case Remote::NINE: player->jumpToPercent(90); return 2;
+
 #ifdef DEV
     case Remote::RED:
     {
@@ -174,17 +207,6 @@ int VVideoRec::handleCommand(int command)
     }
 #endif
 
-    case Remote::ZERO: player->jumpToPercent(0); return 2;
-    case Remote::ONE: player->jumpToPercent(10); return 2;
-    case Remote::TWO: player->jumpToPercent(20); return 2;
-    case Remote::THREE: player->jumpToPercent(30); return 2;
-    case Remote::FOUR: player->jumpToPercent(40); return 2;
-    case Remote::FIVE: player->jumpToPercent(50); return 2;
-    case Remote::SIX: player->jumpToPercent(60); return 2;
-    case Remote::SEVEN: player->jumpToPercent(70); return 2;
-    case Remote::EIGHT: player->jumpToPercent(80); return 2;
-    case Remote::NINE: player->jumpToPercent(90); return 2;
-
   }
 
   return 1;
@@ -205,3 +227,63 @@ void VVideoRec::toggleChopSides()
     video->setMode(Video::NORMAL);
   }
 }
+
+void VVideoRec::doBar(int action)
+{
+  rectangle(barRegion, barBlue);
+
+  /* Work out what to display - choices:
+
+  Playing  >
+  Paused   ||
+  FFwd     >>
+  FBwd     <<
+
+  Specials, informed by parameter
+
+  Skip forward 10s    >|
+  Skip backward 10s   |<
+  Skip forward 1m     >>|
+  Skip backward 1m    |<<
+
+  */
+
+  WSymbol w;
+  w.setSurface(surface);
+  w.nextSymbol = 0;
+  w.setSurfaceOffset(76, barRegion.y + 16);
+
+  if (action)
+  {
+    if (action == 1)       w.nextSymbol = WSymbol::SKIPFORWARD;
+    else if (action == 2)  w.nextSymbol = WSymbol::SKIPBACK;
+    else if (action == 3)  w.nextSymbol = WSymbol::SKIPFORWARD2;
+    else if (action == 4)  w.nextSymbol = WSymbol::SKIPBACK2;
+  }
+  else
+  {
+    if (player->isPaused())     w.nextSymbol = WSymbol::PAUSE;
+    else if (player->isFfwd())  ;
+    else if (player->isFbwd())  ;
+    else                        w.nextSymbol = WSymbol::PLAY;
+  }
+
+  w.draw();
+
+  ViewMan::getInstance()->updateView(this, &barRegion);
+  Timers::getInstance()->setTimer(this, 1, (struct timespec){4, 0});
+}
+
+void VVideoRec::timercall(int clientReference)
+{
+  switch(clientReference)
+  {
+    case 1:
+    {
+      // Remove bar
+      rectangle(barRegion, transparent);
+      ViewMan::getInstance()->updateView(this, &barRegion);
+      break;
+    }
+  }
+}
index b32e23c72d4c75c4ee3cb93523ec3b813a9fb44b..709d475841be815b93716aef55c6c7131c724a78 100644 (file)
 #include "command.h"
 #include "colour.h"
 #include "osd.h"
+#include "timers.h"
+#include "timerreceiver.h"
 
 //#include "vepg.h" // for testing EPG in NTSC with a NTSC test video
 
-class VVideoRec : public View
+class VVideoRec : public View, public TimerReceiver
 {
   public:
     VVideoRec(Recording* rec);
@@ -42,14 +44,22 @@ class VVideoRec : public View
     int handleCommand(int command);
     void go(ULLONG startPosition);
 
+    void timercall(int clientReference);
+
   private:
     VDR* vdr;
     Video* video;
     Player* player;
     Recording* myRec;
 
+    Colour transparent;
+    Colour barBlue;
+
     UCHAR videoMode;
     void toggleChopSides();
+
+    void doBar(int action);
+    Region barRegion;
 };
 
 #endif
index 15cbae44636653feb4ce2640e17edce47afbccac..959b875a5447a181d7d2148ca8167b5b498d2292 100644 (file)
@@ -20,8 +20,8 @@
 
 #include "wsymbol.h"
 
-UCHAR WSymbol::widths[] = { 2, 2, 4, 4, 1, 1, 3, 3, 3, 3, 3, 4, 4, 2, 2};
-UCHAR WSymbol::heights[] = { 8, 8, 12, 12, 24, 4, 18, 18, 18, 18, 18, 30, 30, 16, 16};
+UCHAR WSymbol::widths[] = { 2, 2, 4, 4, 1, 1, 3, 3, 3, 3, 3, 4, 4, 2, 2, 3, 5, 5};
+UCHAR WSymbol::heights[] = { 8, 8, 12, 12, 24, 4, 18, 18, 18, 18, 18, 30, 30, 16, 16, 18, 18, 18};
 
 UCHAR WSymbol::symbols[] = {
 
@@ -594,8 +594,133 @@ UCHAR WSymbol::symbols[] = {
 0xFF, 0x00,
 0xFC, 0x00,
 0xF0, 0x00,
-0xC0, 0x00
+0xC0, 0x00,
+
+/*
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+11111100 00001111 11000000
+*/
+
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+0xFC, 0x0F, 0xC0,
+
+/*
+11000000 00000000 00110000 00000000 00001100
+11000000 00000000 11110000 00000000 00111100
+11000000 00000011 11110000 00000000 11111100
+11000000 00001111 11110000 00000011 11111100
+11000000 00111111 11110000 00001111 11111100
+11000000 11111111 11110000 00111111 11111100
+11000011 11111111 11110000 11111111 11111100
+11001111 11111111 11110011 11111111 11111100
+11111111 11111111 11111111 11111111 11111100
+
+11111111 11111111 11111111 11111111 11111100
+11001111 11111111 11110011 11111111 11111100
+11000011 11111111 11110000 11111111 11111100
+11000000 11111111 11110000 00111111 11111100
+11000000 00111111 11110000 00001111 11111100
+11000000 00001111 11110000 00000011 11111100
+11000000 00000011 11110000 00000000 11111100
+11000000 00000000 11110000 00000000 00111100
+11000000 00000000 00110000 00000000 00001100
+*/
+
+0xC0, 0x00, 0x30, 0x00, 0x0C,
+0xC0, 0x00, 0xF0, 0x00, 0x3C,
+0xC0, 0x03, 0xF0, 0x00, 0xFC,
+0xC0, 0x0F, 0xF0, 0x03, 0xFC,
+0xC0, 0x3F, 0xF0, 0x0F, 0xFC,
+0xC0, 0xFF, 0xF0, 0x3F, 0xFC,
+0xC3, 0xFF, 0xF0, 0xFF, 0xFC,
+0xCF, 0xFF, 0xF3, 0xFF, 0xFC,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
+
+0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
+0xCF, 0xFF, 0xF3, 0xFF, 0xFC,
+0xC3, 0xFF, 0xF0, 0xFF, 0xFC,
+0xC0, 0xFF, 0xF0, 0x3F, 0xFC,
+0xC0, 0x3F, 0xF0, 0x0F, 0xFC,
+0xC0, 0x0F, 0xF0, 0x03, 0xFC,
+0xC0, 0x03, 0xF0, 0x00, 0xFC,
+0xC0, 0x00, 0xF0, 0x00, 0x3C,
+0xC0, 0x00, 0x30, 0x00, 0x0C,
+
+/*
+00110000 00000000 00001100 00000000 00000011
+00111100 00000000 00001111 00000000 00000011
+00111111 00000000 00001111 11000000 00000011
+00111111 11000000 00001111 11110000 00000011
+00111111 11110000 00001111 11111100 00000011
+00111111 11111100 00001111 11111111 00000011
+00111111 11111111 00001111 11111111 11000011
+00111111 11111111 11001111 11111111 11110011
+00111111 11111111 11111111 11111111 11111111
+
+00111111 11111111 11111111 11111111 11111111
+00111111 11111111 11001111 11111111 11110011
+00111111 11111111 00001111 11111111 11000011
+00111111 11111100 00001111 11111111 00000011
+00111111 11110000 00001111 11111100 00000011
+00111111 11000000 00001111 11110000 00000011
+00111111 00000000 00001111 11000000 00000011
+00111100 00000000 00001111 00000000 00000011
+00110000 00000000 00001100 00000000 00000011
+*/
 
+0x30, 0x00, 0x0C, 0x00, 0x03,
+0x3C, 0x00, 0x0F, 0x00, 0x03,
+0x3F, 0x00, 0x0F, 0xC0, 0x03,
+0x3F, 0xC0, 0x0F, 0xF0, 0x03,
+0x3F, 0xF0, 0x0F, 0xFC, 0x03,
+0x3F, 0xFC, 0x0F, 0xFF, 0x03,
+0x3F, 0xFF, 0x0F, 0xFF, 0xC3,
+0x3F, 0xFF, 0xCF, 0xFF, 0xF3,
+0x3F, 0xFF, 0xFF, 0xFF, 0xFF,
+
+0x3F, 0xFF, 0xFF, 0xFF, 0xFF,
+0x3F, 0xFF, 0xCF, 0xFF, 0xF3,
+0x3F, 0xFF, 0x0F, 0xFF, 0xC3,
+0x3F, 0xFC, 0x0F, 0xFF, 0x03,
+0x3F, 0xF0, 0x0F, 0xFC, 0x03,
+0x3F, 0xC0, 0x0F, 0xF0, 0x03,
+0x3F, 0x00, 0x0F, 0xC0, 0x03,
+0x3C, 0x00, 0x0F, 0x00, 0x03,
+0x30, 0x00, 0x0C, 0x00, 0x03,
 
 };
 
index 1ece7923b7c681c4b529b1498ac408359eadfc01..3074e127d2b1c01da75d89b392a27806aff0a9d9 100644 (file)
--- a/wsymbol.h
+++ b/wsymbol.h
@@ -49,6 +49,9 @@ class WSymbol : public Widget
     const static UCHAR UNMUTE = 12;
     const static UCHAR LEFTARROW = 13;
     const static UCHAR RIGHTARROW = 14;
+    const static UCHAR PAUSE = 15;
+    const static UCHAR SKIPBACK2 = 16;
+    const static UCHAR SKIPFORWARD2 = 17;
 
   private:
     static UCHAR symbols[];