]> git.vomp.tv Git - vompclient.git/commitdiff
One message queue only. Player events go back to parent only.
authorChris Tallon <chris@vomp.tv>
Mon, 16 Oct 2006 23:37:22 +0000 (23:37 +0000)
committerChris Tallon <chris@vomp.tv>
Mon, 16 Oct 2006 23:37:22 +0000 (23:37 +0000)
And Finally: WSS switching on PAL line 23!!

26 files changed:
command.cc
message.h
objects.mk
player.cc
player.h
timerreceiver.h
vchannelselect.cc
vconnect.cc
vepg.cc
vepgsettimer.cc
view.h
viewman.cc
viewman.h
vlivebanner.cc
vmute.cc
voptions.cc
vquestion.cc
vquestion.h
vrecmove.cc
vrecordingmenu.cc
vserverselect.cc
vserverselect.h
vvideolive.cc
vvideorec.cc
vvideorec.h
vvolume.cc

index 08750ce659cc44f0961b95db16ceba7d8517a02e..e6ba5eec38ffdd878401d3d23d37830431ea8b91 100644 (file)
@@ -240,57 +240,75 @@ void Command::processMessage(Message* m)
 {
   logger->log("Command", Log::DEBUG, "processing message %i", m->message);
 
-  switch(m->message)
+  // Timer handling is very weird at the mo. Take them out here and convert
+  if (m->message == Message::TIMER)
   {
-    case Message::STANDBY:
-    {
-      doStandby();
-      break;
-    }
-    case Message::STOP_PLAYBACK:
-    {
-      handleCommand(Remote::STOP); // an odd way of doing it, but so simple
-      break;
-    }
-    case Message::STREAM_END:
-    {
-      VVideoLive::getInstance()->streamEnd();
-      break;
-    }
-    case Message::VDR_CONNECTED:
-    {
-      doJustConnected((VConnect*)m->from);
-      break;
-    }
-    case Message::TIMER:
-    {
-      // FIXME - go to one message queue only - then instead of having
-      // objects deriving from messagequeues, make them derive from
-      // messagereceiver - then one messagequeue can deliver any message to anywhere
+    // FIXME - go to one message queue only - then instead of having
+    // objects deriving from messagequeues, make them derive from
+    // messagereceiver - then one messagequeue can deliver any message to anywhere
 
-      // deliver timer
+    // deliver timer
 
-      ((TimerReceiver*)m->to)->timercall(m->parameter);
-      handleCommand(Remote::NA_NONE); // in case any timer has posted messages to viewman,
-                                      // run viewman message queue here. FIXME improve this!
-      break;
-    }
-    case Message::SCREENSHOT:
-    {
-      Osd::getInstance()->screenShot("/out.jpg");
-      break;
-    }
-    case Message::CONNECTION_LOST:
-    {
-      doFromTheTop(true);
-      break;
-    }
-    case Message::UDP_BUTTON:
+    logger->log("Command", Log::DEBUG, "sending timer");
+    ((TimerReceiver*)m->to)->timercall(m->parameter);
+//    handleCommand(Remote::NA_NONE); // in case any timer has posted messages to viewman,
+//                                    // run viewman message queue here. FIXME improve this!
+//    break;
+  }
+  else if (m->to == this)
+  {
+    switch(m->message)
     {
-      handleCommand(m->parameter);
-      break;
+      case Message::STANDBY:
+      {
+        doStandby();
+        break;
+      }
+
+
+      // << FIXME OBSELETE
+      case Message::STOP_PLAYBACK:
+      {
+        handleCommand(Remote::STOP); // an odd way of doing it, but so simple
+        break;
+      }
+      case Message::STREAM_END:
+      {
+        VVideoLive::getInstance()->streamEnd();
+        break;
+      }
+
+      // Also connection_lost comes from player - anywhere else?
+      // FIXME OBSELETE >>
+
+
+      case Message::VDR_CONNECTED:
+      {
+        doJustConnected((VConnect*)m->from);
+        break;
+      }
+      case Message::SCREENSHOT:
+      {
+        Osd::getInstance()->screenShot("/out.jpg");
+        break;
+      }
+      case Message::CONNECTION_LOST:
+      {
+        doFromTheTop(true);
+        break;
+      }
+      case Message::UDP_BUTTON:
+      {
+        handleCommand(m->parameter);
+        break;
+      }
     }
   }
+  else
+  {
+    logger->log("Command", Log::DEBUG, "Sending message to viewman");
+    viewman->processMessage(m);
+  }
 }
 
 void Command::handleCommand(int button)
index c0084ce7fcee8280559d10d2a3a9fb70b438b56c..8a9b2938a9e8cc7ee8634275cd9ce9ac343b3023 100644 (file)
--- a/message.h
+++ b/message.h
@@ -64,6 +64,7 @@ class Message
     const static ULONG CONNECTION_LOST = 19;
     const static ULONG MOVE_RECORDING = 20;
     const static ULONG UDP_BUTTON = 21;
+    const static ULONG PLAYER_EVENT = 22;
 };
 
 #endif
index 1eb44f808b87d8184bdbdacf9fc7690eefb06419..d5805b2582665cf1af3cfda73cfd2f1ca5869fd3 100644 (file)
@@ -11,6 +11,6 @@ OBJECTS1 = command.o log.o tcp.o dsock.o thread.o timers.o i18n.o mutex.o     \
            vchannellist.o vwelcome.o vvideolive.o vvideorec.o vepgsettimer.o  \\r
            vchannelselect.o vserverselect.o vconnect.o vepg.o vrecmove.o      \\r
            widget.o wselectlist.o wjpeg.o wsymbol.o wbutton.o                 \\r
-                                        woptionbox.o wtextbox.o                                            \\r
+                                        woptionbox.o wtextbox.o wwss.o                                     \\r
            fonts/helvB24.o fonts/helvB18.o                                    \\r
            remote.o led.o mtd.o video.o audio.o osd.o surface.o\r
index 6306a79cf38b5ae1ef61b5ad28f5d4eb1d804df4..6a2ce33f39d3c027b97d6cc3c78dbb5e708a35ce 100644 (file)
--- a/player.cc
+++ b/player.cc
 
 // ----------------------------------- Called from outside, one offs or info funcs
 
-Player::Player(MessageQueue* messageQueue, bool tIsRecording, bool tIsRadio)
+Player::Player(MessageQueue* tmessageQueue, void* tmessageReceiver, bool tIsRecording, bool tIsRadio)
 : vfeed(this), afeed(this)
 {
-  commandMessageQueue = messageQueue;
+  messageQueue = tmessageQueue;
+  messageReceiver = tmessageReceiver;
   audio = Audio::getInstance();
   video = Video::getInstance();
   logger = Log::getInstance();
@@ -691,10 +692,13 @@ void Player::restartAtFrame(ULONG newFrame)
 
 void Player::doConnectionLost()
 {
+  logger->log("Player", Log::DEBUG, "Connection lost, sending message");
   Message* m = new Message();
-  m->message = Message::CONNECTION_LOST;
-  m->to = this;
-  commandMessageQueue->postMessage(m);
+  m->to = messageReceiver;
+  m->from = this;
+  m->message = Message::PLAYER_EVENT;
+  m->parameter = Player::CONNECTION_LOST;
+  messageQueue->postMessage(m);
 }
 
 // ----------------------------------- Callback
@@ -716,11 +720,25 @@ void Player::call(void* caller)
     {
       logger->log("Player", Log::DEBUG, "Demuxer said video is 4:3 aspect, switching TV");
       video->setAspectRatio(Video::ASPECT4X3);
+
+      Message* m = new Message();
+      m->from = this;
+      m->to = messageReceiver;
+      m->message = Message::PLAYER_EVENT;
+      m->parameter = Player::ASPECT43;
+      messageQueue->postMessage(m);
     }
     else if (dxCurrentAspect == Demuxer::ASPECT_16_9)
     {
       logger->log("Player", Log::DEBUG, "Demuxer said video is 16:9 aspect, switching TV");
       video->setAspectRatio(Video::ASPECT16X9);
+
+      Message* m = new Message();
+      m->from = this;
+      m->to = messageReceiver;
+      m->message = Message::PLAYER_EVENT;
+      m->parameter = Player::ASPECT169;
+      messageQueue->postMessage(m);
     }
     else
     {
@@ -762,9 +780,12 @@ void Player::threadMethod()
       {
         threadCheckExit();
         Message* m = new Message(); // Must be done after this thread finishes, and must break into master mutex
-        m->message = Message::STOP_PLAYBACK;
-        logger->log("Player", Log::DEBUG, "Posting message to %p...", commandMessageQueue);
-        commandMessageQueue->postMessage(m);
+        m->to = messageReceiver;
+        m->from = this;
+        m->message = Message::PLAYER_EVENT;
+        m->parameter = STOP_PLAYBACK;
+        logger->log("Player", Log::DEBUG, "Posting message to %p...", messageQueue);
+        messageQueue->postMessage(m);
         logger->log("Player", Log::DEBUG, "Message posted...");
         return;
       }
@@ -886,9 +907,12 @@ void Player::threadFeedLive()
   threadCheckExit();
 
   Message* m = new Message(); // Must be done after this thread finishes, and must break into master mutex
-  m->message = Message::STREAM_END;
-  logger->log("Player", Log::DEBUG, "Posting message to %p...", commandMessageQueue);
-  commandMessageQueue->postMessage(m);
+  m->to = messageReceiver;
+  m->from = this;
+  m->message = Message::PLAYER_EVENT;
+  m->parameter = Player::STREAM_END;
+  logger->log("Player", Log::DEBUG, "Posting message to %p...", messageQueue);
+  messageQueue->postMessage(m);
   logger->log("Player", Log::DEBUG, "Message posted...");
 }
 
@@ -991,11 +1015,14 @@ void Player::threadFeedPlay()
 
   threadCheckExit();
 
+
   Message* m = new Message(); // Must be done after this thread finishes, and must break into master mutex
-  m->message = Message::STOP_PLAYBACK;  // recording
-  logger->log("Player", Log::DEBUG, "Posting message to %p...", commandMessageQueue);
-  commandMessageQueue->postMessage(m);
-  logger->log("Player", Log::DEBUG, "Message posted...");
+  m->to = messageReceiver;
+  m->from = this;
+  m->message = Message::PLAYER_EVENT;
+  m->parameter = Player::STOP_PLAYBACK;
+  logger->log("Player", Log::DEBUG, "Posting message to %p...", messageQueue);
+  messageQueue->postMessage(m);
 }
 
 void Player::threadFeedScan()
index 8c02d7ffe96e088888f6862a4ab329853614b339..39a4d871502364a9c47715542dce2c3639060d23 100644 (file)
--- a/player.h
+++ b/player.h
@@ -48,7 +48,7 @@
 class Player : public Thread_TYPE, public Callback
 {
   public:
-    Player(MessageQueue* messageQueue, bool isRecording, bool isRadio);
+    Player(MessageQueue* messageQueue, void* messageReceiver, bool isRecording, bool isRadio);
     virtual ~Player();
 
     int init();
@@ -81,6 +81,16 @@ class Player : public Thread_TYPE, public Callback
     const static UCHAR S_STOP = 6;
     const static UCHAR S_JUMP = 7;
 
+    // Player events
+
+    // FIXME so far this just duplicates the old system + the wss
+
+    const static UCHAR CONNECTION_LOST = 1;
+    const static UCHAR STOP_PLAYBACK = 2;
+    const static UCHAR STREAM_END = 3;
+    const static UCHAR ASPECT43 = 4;
+    const static UCHAR ASPECT169 = 5;
+
 #ifdef DEV
     void test1();
     void test2();
@@ -101,7 +111,8 @@ class Player : public Thread_TYPE, public Callback
     void doConnectionLost();
     void restartAtFrame(ULONG newFrame);
 
-    MessageQueue* commandMessageQueue;
+    MessageQueue* messageQueue;
+    void* messageReceiver;
     Log* logger;
     Audio* audio;
     Video* video;
index 68e5064480fac0a7841eec610e302799bff566ed..9e0f301f0d5e357c79c478d6ff93d15cd828a81c 100755 (executable)
@@ -25,7 +25,7 @@ class TimerReceiver
 {
   public:
     virtual ~TimerReceiver() {}
-    virtual void timercall(int clientReference)=0;
+    virtual void timercall(int clientReference)=0; // Master lock will be locked!
 };
 
 #endif
index 8a48f05cdd8156a54a0ec8ba7812b4d9a3d71832..d362c6ef834b2535681bf95c9017042c341483b6 100644 (file)
@@ -159,7 +159,7 @@ int VChannelSelect::handleCommand(int command)
           m->to = videoLive;
           m->message = Message::CHANNEL_CHANGE;
           m->parameter = (first * 100) + (second * 10) + third;
-          ViewMan::getInstance()->postMessage(m);
+          Command::getInstance()->postMessageNoLock(m);
         }
 
         return 4;
@@ -182,7 +182,7 @@ void VChannelSelect::timercall(int clientReference)
   m->from = this;
   m->to = ViewMan::getInstance();
   m->message = Message::CLOSE_ME;
-  ViewMan::getInstance()->postMessage(m);
+  Command::getInstance()->postMessageNoLock(m);
 
   // Is there valid data?
   if ((first > 0) || (second > 0) || (third > 0))
@@ -205,6 +205,6 @@ void VChannelSelect::timercall(int clientReference)
     m->to = videoLive;
     m->message = Message::CHANNEL_CHANGE;
     m->parameter = newChannel;
-    ViewMan::getInstance()->postMessage(m);
+    Command::getInstance()->postMessage(m);
   }
 }
index 7292b71aa74463f0054ec04ee4d0a9c1b1dcb66c..e87b5554eff1c540be7c81ff9f2dedfd2bdc4a35 100644 (file)
@@ -159,6 +159,7 @@ void VConnect::threadMethod()
 
   Message* m = new Message(); // Must be done after this thread ends
   m->from = this;
+  m->to = Command::getInstance();
   m->message = Message::VDR_CONNECTED;
   Command::getInstance()->postMessage(m);
 }
diff --git a/vepg.cc b/vepg.cc
index 94ad220b71baeac1830fc38dcfa1cbece3badb5b..85e1ddde7344a98b500a606e7b569e29fd934a5b 100644 (file)
--- a/vepg.cc
+++ b/vepg.cc
@@ -383,7 +383,7 @@ int VEpg::handleCommand(int command)
         m->from = this;
         m->to = videoLive;
         m->message = Message::EPG_CLOSE;
-        ViewMan::getInstance()->postMessage(m);
+        Command::getInstance()->postMessageNoLock(m);
       }
       return 4;\r
     }\r
index b406fed87674e3bd0d3353d196198fc5bc1e1907..57ef730c4b7b84b3f3e774e3a83ff98ea0828f21 100644 (file)
@@ -266,6 +266,5 @@ void VEpgSetTimer::doit()
   m->message = Message::ADD_VIEW;
   m->to = viewman;
   m->parameter = (ULONG)vi;
-
-  viewman->postMessage(m);
+  Command::getInstance()->postMessageNoLock(m);
 }
diff --git a/view.h b/view.h
index 4da134f682eb3a6da2680998f436b9ebc27e2ebb..5cc6009e64c4f9baa49e32bfed1899324ee97399 100644 (file)
--- a/view.h
+++ b/view.h
@@ -38,7 +38,7 @@ class View : public Box
 
     virtual void draw();
     virtual int handleCommand(int command);
-    virtual void processMessage(Message* m);
+    virtual void processMessage(Message* m); // The master lock will be locked
 
     void setBorderOn(UCHAR on);
     void setTitleBarOn(UCHAR on);
index 8ac891e0c13f43ccc425420d7dba1424d013cc37..7b017aac8d56c773c3f3b8f2b914bdbc32363034 100644 (file)
@@ -393,7 +393,7 @@ int ViewMan::handleCommand(UCHAR command)
 
 //  Log::getInstance()->log("ViewMan", Log::DEBUG, "out of handlecommand code, now on to messages");
 
-  processMessageQueue();
+//  processMessageQueue();
 
   return retVal2;
 }
@@ -411,6 +411,7 @@ void ViewMan::processMessage(Message* m)
         return;
       }
     }
+    return;
   }
 
   Log::getInstance()->log("ViewMan", Log::DEBUG, "it's for meeee!");
index 006e07dceb10315d223307212ba039d9fc019d0d..ea56d632bd5e8f630db9b7fa9c8ee883365211e3 100644 (file)
--- a/viewman.h
+++ b/viewman.h
@@ -40,7 +40,7 @@
 
 typedef list<Region> RegionList;
 
-class ViewMan : public MessageQueue
+class ViewMan
 {
   public:
     ViewMan();
@@ -56,6 +56,7 @@ class ViewMan : public MessageQueue
     void updateView(View* toUpdate, Region* regionToUpdate = NULL);
 
     int handleCommand(UCHAR command);
+    void processMessage(Message* m);
 
   private:
     static ViewMan* instance;
@@ -64,8 +65,6 @@ class ViewMan : public MessageQueue
     View* views[20];
     int numViews;
 
-    void processMessage(Message* m);
-
     // New windowing stuff
     void deleteView(int z);
     void repaintRevealed(int x, Region r);
index fe2269d8684c47cfa510e8b100c5602ac71000bf..eb445e30ef7f349e0feb977457f9e362456cd60b 100644 (file)
@@ -243,7 +243,7 @@ int VLiveBanner::handleCommand(int command)
       m->message = Message::EPG;
       m->to = vvideoLive;
       m->from = this;
-      ViewMan::getInstance()->postMessage(m);
+      Command::getInstance()->postMessageNoLock(m);
       return 4;
     }
   }
@@ -260,7 +260,7 @@ void VLiveBanner::timercall(int clientReference)
     m->message = Message::CLOSE_ME;
     m->to = ViewMan::getInstance();
     m->from = this;
-    ViewMan::getInstance()->postMessage(m);
+    Command::getInstance()->postMessageNoLock(m);
   }
   else if (clientReference == 2)
   {
index 91643eaa7d613aca1f4beef8d6d112968371d7d4..921f15a5de48d8cfc7c8db9e9a6eba8eecdb0e42 100644 (file)
--- a/vmute.cc
+++ b/vmute.cc
@@ -64,7 +64,7 @@ void VMute::timercall(int clientReference)
   m->message = Message::CLOSE_ME;
   m->to = ViewMan::getInstance();
   m->from = this;
-  ViewMan::getInstance()->postMessage(m);
+  Command::getInstance()->postMessageNoLock(m);
 }
 
 int VMute::handleCommand(int command)
index e564157f5e9a3b4783492a9e83bdc26fddf8085a..cffacc04af88978190b2fa64a5dc59d3732dca09 100644 (file)
@@ -218,7 +218,7 @@ int VOptions::handleCommand(int command)
       m->message = Message::CLOSE_ME;
       m->from = this;
       m->to = viewman;
-      viewman->postMessage(m);
+      Command::getInstance()->postMessageNoLock(m);
 
       return 2;
     }
@@ -280,7 +280,7 @@ void VOptions::doSave()
   m->message = Message::CHANGED_OPTIONS;
   m->to = parent;
   m->parameter = (ULONG)optionChanges;
-  viewman->postMessage(m);
+  Command::getInstance()->postMessageNoLock(m);
 
 }
 
index b14509c84102cebf59a87cdea465d99256168fd6..ec1571eb96b43ddeafff0045f5424f0cca64400d 100644 (file)
@@ -106,7 +106,7 @@ int VQuestion::handleCommand(int command)
       m->from = this;
       m->to = replyTo;
       m->message = Message::QUESTION_YES;
-      ViewMan::getInstance()->postMessage(m);
+      Command::getInstance()->postMessageNoLock(m);
 
       return 4;
     }
index d69f8fba161fd0bacf39e571f051d1e22787154c..ccddf7f9de7e8bd14d9046b875a5c8992b38378c 100644 (file)
@@ -30,6 +30,7 @@
 #include "viewman.h"
 #include "colour.h"
 #include "i18n.h"
+#include "command.h"
 
 class VQuestion : public View
 {
index b34322accde5014544f327ac7c3f5a02eb2bd9df..7e3dc356217d24eb560a9c9a873566b1f82ca597 100644 (file)
@@ -118,7 +118,7 @@ int VRecMove::handleCommand(int command)
       m->message = Message::MOVE_RECORDING;
       m->to = parent;
       m->parameter = sl.getCurrentOptionData();
-      ViewMan::getInstance()->postMessage(m);
+      Command::getInstance()->postMessageNoLock(m);
 
       return 4;
     }
index 60880b403761763e92afe207a7938029f094cb97..9f53124883184101a28a9b4931d476f37763dda4 100644 (file)
@@ -99,7 +99,7 @@ int VRecordingMenu::handleCommand(int command)
         m->from = this;
         m->to = vRecList;
         m->message = Message::PLAY_SELECTED_RECORDING;
-        ViewMan::getInstance()->postMessage(m);
+        Command::getInstance()->postMessageNoLock(m);
         return 4;
       }
 
@@ -109,7 +109,7 @@ int VRecordingMenu::handleCommand(int command)
         m->from = this;
         m->to = vRecList;
         m->message = Message::RESUME_SELECTED_RECORDING;
-        ViewMan::getInstance()->postMessage(m);
+        Command::getInstance()->postMessageNoLock(m);
         return 4;
       }
 
@@ -196,13 +196,13 @@ void VRecordingMenu::processMessage(Message* m)
       m2->from = this;
       m2->to = ViewMan::getInstance();
       m2->message = Message::CLOSE_ME;
-      ViewMan::getInstance()->postMessage(m2);
+      Command::getInstance()->postMessageNoLock(m2);
 
       m2 = new Message(); // OK. Want this to delete before this message does its job
       m2->from = this;
       m2->to = vRecList;
       m2->message = Message::DELETE_SELECTED_RECORDING;
-      ViewMan::getInstance()->postMessage(m2);
+      Command::getInstance()->postMessageNoLock(m2);
     }
   }
   else if (m->message == Message::MOVE_RECORDING)
@@ -211,13 +211,13 @@ void VRecordingMenu::processMessage(Message* m)
     m2->from = this;
     m2->to = ViewMan::getInstance();
     m2->message = Message::CLOSE_ME;
-    ViewMan::getInstance()->postMessage(m2);
+    Command::getInstance()->postMessageNoLock(m2);
 
     m2 = new Message();
     m2->from = this;
     m2->to = vRecList;
     m2->message = Message::MOVE_RECORDING;
     m2->parameter = m->parameter;
-    ViewMan::getInstance()->postMessage(m2);
+    Command::getInstance()->postMessageNoLock(m2);
   }
 }
index f5bae8179dd24e3921d18c57276cda7008228f5d..12580e73cc2a680e931b8672b9184b23244988e4 100644 (file)
@@ -91,7 +91,7 @@ int VServerSelect::handleCommand(int command)
       m->to = replyTo;
       m->message = Message::SERVER_SELECTED;
       m->parameter = sl.getCurrentOption();
-      ViewMan::getInstance()->postMessage(m);
+      Command::getInstance()->postMessageNoLock(m);
       return 4;
     }
   }
index 2af588d081d31d53eedbb81762d111175ed15617..3aa191aa297ece3ca7dfc300f8123b28f65b5f9b 100644 (file)
@@ -34,6 +34,7 @@
 #include "viewman.h"
 #include "i18n.h"
 #include "vdr.h"
+#include "command.h"
 
 using namespace std;
 
index 026f842a883a0a69bd49154d4accaf173fd6ce11..4d274a477036c9339648910bf71dae6190b2a0cc 100644 (file)
@@ -38,8 +38,8 @@ VVideoLive::VVideoLive(ChannelList* tchanList, ULONG tstreamType, VChannelList*
   unavailableView = NULL;
   streamType = tstreamType;
   videoMode = video->getMode();
-  if (streamType == VDR::RADIO) player = new Player(Command::getInstance(), false, true);
-  else                          player = new Player(Command::getInstance(), false, false);
+  if (streamType == VDR::RADIO) player = new Player(Command::getInstance(), this, false, true);
+  else                          player = new Player(Command::getInstance(), this, false, false);
 
   player->init();
   create(video->getScreenWidth(), video->getScreenHeight());
@@ -243,6 +243,41 @@ void VVideoLive::processMessage(Message* m)
     video->setMode(videoMode);
     if (saveUnavailable) showUnavailable(1);
   }
+  else if (m->message == Message::PLAYER_EVENT)
+  {
+    switch(m->parameter)
+    {
+      case Player::CONNECTION_LOST: // connection lost detected
+      {
+        Log::getInstance()->log("VVideoLive", Log::DEBUG, "Received connection lost from player");
+        // I can't handle this, send it to command
+        Message* m = new Message();
+        m->to = Command::getInstance();
+        m->message = Message::CONNECTION_LOST;
+        Command::getInstance()->postMessageNoLock(m);
+        break;
+      }
+      case Player::STREAM_END:
+      {
+        // I can't handle this, send it to command - 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::STREAM_END;
+        Command::getInstance()->postMessageNoLock(m);
+        break;
+      }
+      case Player::ASPECT43:
+      {
+        Log::getInstance()->log("VVideoLive", Log::DEBUG, "Received do WSS 43");
+        break;
+      }
+      case Player::ASPECT169:
+      {
+        Log::getInstance()->log("VVideoLive", Log::DEBUG, "Received do WSS 169");
+        break;
+      }
+    }
+  }
 }
 
 void VVideoLive::doBanner(bool bannerTakesCommands)
index d5788772a2b8aeed86c7c93fb4ca53280f094c19..656b9f93c27a130e73f8019f78444299b86ed594 100644 (file)
@@ -28,7 +28,7 @@ VVideoRec::VVideoRec(Recording* rec)
 
   // TODO Work out if is a radio stream
 
-  player = new Player(Command::getInstance(), true, false);
+  player = new Player(Command::getInstance(), this, true, false);
   player->init();
 
   videoMode = video->getMode();
@@ -76,10 +76,19 @@ VVideoRec::VVideoRec(Recording* rec)
   clocksRegion.w = 170;
   clocksRegion.h = surface->getFontHeight();
 
+
   barBlue.set(0, 0, 150, 150);
 
   barShowing = false;
   stickyBar = false;
+
+  wss.setSurface(surface);
+  wss.setWide(true);
+
+  wssRegion.x = 0;
+  wssRegion.y = 0;
+  wssRegion.w = video->getScreenWidth();
+  wssRegion.h = 10;
 }
 
 VVideoRec::~VVideoRec()
@@ -99,6 +108,7 @@ VVideoRec::~VVideoRec()
 void VVideoRec::draw()
 {
   View::draw();
+  wss.draw();
 }
 
 void VVideoRec::go(ULONG startFrameNum)
@@ -131,7 +141,7 @@ void VVideoRec::go(ULONG startFrameNum)
     m->message = Message::CLOSE_ME;
     m->from = this;
     m->to = viewman;
-    viewman->postMessage(m);
+    Command::getInstance()->postMessageNoLock(m);
 
     VInfo* vi = new VInfo();
     vi->create(400, 150);
@@ -149,7 +159,7 @@ void VVideoRec::go(ULONG startFrameNum)
     m->message = Message::ADD_VIEW;
     m->to = viewman;
     m->parameter = (ULONG)vi;
-    viewman->postMessage(m);
+    Command::getInstance()->postMessageNoLock(m);
   }
 }
 
@@ -270,6 +280,54 @@ int VVideoRec::handleCommand(int command)
   return 1;
 }
 
+void VVideoRec::processMessage(Message* m)
+{
+  if (m->from != player) return;
+  if (m->message != Message::PLAYER_EVENT) return;
+
+  Log::getInstance()->log("VVideoRec", Log::DEBUG, "Message received");
+
+  switch(m->parameter)
+  {
+    case Player::CONNECTION_LOST: // connection lost detected
+    {
+      // I can't handle this, send it to command
+      Message* m = new Message();
+      m->to = Command::getInstance();
+      m->message = Message::CONNECTION_LOST;
+      Command::getInstance()->postMessageNoLock(m);
+      break;
+    }
+    case Player::STOP_PLAYBACK:
+    {
+      // 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;
+      Command::getInstance()->postMessageNoLock(m);
+      break;
+    }
+    case Player::ASPECT43:
+    {
+      Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 43");
+      wss.setWide(false);
+      wss.draw();
+      ViewMan::getInstance()->updateView(this, &wssRegion);
+      Log::getInstance()->log("VVideoRec", Log::DEBUG, "WSS done");
+      break;
+    }
+    case Player::ASPECT169:
+    {
+      Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 169");
+      wss.setWide(true);
+      wss.draw();
+      ViewMan::getInstance()->updateView(this, &wssRegion);
+      Log::getInstance()->log("VVideoRec", Log::DEBUG, "WSS done");
+      break;
+    }
+  }
+}
+
 void VVideoRec::stopPlay()
 {
   Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre stopPlay");
@@ -380,8 +438,8 @@ void VVideoRec::doBar(int action)
   }
   else
   {
-//    timers->setTimerD(this, 1, 4); // only set the getridofbar timer if not ffwd/fbwd
-//    stickyBar = false;
+    timers->setTimerD(this, 1, 4); // only set the getridofbar timer if not ffwd/fbwd
+    stickyBar = false;
   }
   timers->setTimerD(this, 2, 0, 200000000);
 }
index dfd013ce2de0af9307a50761fa3b6bfebff0461d..775afc321c4539896b53ec4b930076f61f0a5eec 100644 (file)
@@ -32,6 +32,8 @@
 #include "osd.h"
 #include "timers.h"
 #include "timerreceiver.h"
+#include "message.h"
+#include "wwss.h"
 
 //#include "vepg.h" // for testing EPG in NTSC with a NTSC test video
 
@@ -47,6 +49,7 @@ class VVideoRec : public View, public TimerReceiver
     void go(ULONG startPosition);
 
     void timercall(int clientReference);
+    void processMessage(Message* m);
 
   private:
     VDR* vdr;
@@ -73,6 +76,9 @@ class VVideoRec : public View, public TimerReceiver
 
     UINT startMargin;
     UINT endMargin;
+
+    Wwss wss;
+    Region wssRegion;
 };
 
 #endif
index 1c509cb7e4fdbdfe2b10656f4b780307028a5616..fd7cbf6ff15cfd2aacf8a5d196fef972373c5520 100644 (file)
@@ -79,7 +79,7 @@ void VVolume::timercall(int clientReference)
   m->message = Message::CLOSE_ME;
   m->to = ViewMan::getInstance();
   m->from = this;
-  ViewMan::getInstance()->postMessage(m);
+  Command::getInstance()->postMessageNoLock(m);
 }
 
 int VVolume::handleCommand(int command)