]> git.vomp.tv Git - vompclient.git/commitdiff
Live tv audio selector
authorChris Tallon <chris@vomp.tv>
Sat, 19 Apr 2008 14:30:40 +0000 (14:30 +0000)
committerChris Tallon <chris@vomp.tv>
Sat, 19 Apr 2008 14:30:40 +0000 (14:30 +0000)
vaudioselector.cc
vvideolivetv.cc
vvideolivetv.h

index d3498202f1a1ebdccf2549b38ece114a167c7e84..2d89a346dbff352ae0f7dc827327eb74165307dc 100644 (file)
@@ -307,7 +307,7 @@ int VAudioSelector::handleCommand(int command)
     }
   }
 
-  return 0;
+  return 1;
 }
 
 void VAudioSelector::processMessage(Message* m)
index b25a5431addfa1d8fba4c896e1616e6c709fd9c4..0fbd44b22e83ed642c9a28bb5cdd30cc93f3553d 100644 (file)
@@ -44,6 +44,8 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V
   vdr = VDR::getInstance();
   boxstack = BoxStack::getInstance();
   video = Video::getInstance();
+  
+  vas = NULL;
 
   chanList = tchanList;
   vchannelList = tvchannelList;
@@ -74,10 +76,12 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V
   
   if ((*chanList)[currentChannelIndex]->type == VDR::VIDEO)
   {
+    streamType = VDR::VIDEO;
     player = new PlayerLiveTV(Command::getInstance(), this, chanList);
   }
   else
   {
+    streamType = VDR::RADIO;
     player = new PlayerLiveRadio(Command::getInstance(), this, chanList);
   }
   player->init();
@@ -157,11 +161,14 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V
   textRed.setText("Summary");
   osd.add(&textRed);  
     
-  textGreen.setBackgroundColour(osdBack);
-  textGreen.setPosition(boxGreen.getX()+18, 98);
-  textGreen.setSize(120, 30);
-  textGreen.setText("Audio");
-  osd.add(&textGreen);  
+  if (streamType == VDR::VIDEO)
+  {
+    textGreen.setBackgroundColour(osdBack);
+    textGreen.setPosition(boxGreen.getX()+18, 98);
+    textGreen.setSize(120, 30);
+    textGreen.setText("Audio");
+    osd.add(&textGreen);  
+  }
     
   textYellow.setBackgroundColour(osdBack);
   textYellow.setPosition(boxYellow.getX()+18, 98);
@@ -189,8 +196,8 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V
   add(&summary);  
   
   textSummary.setBackgroundColour(osdBack);
-  textSummary.setPosition(30, 10);
-  textSummary.setSize(video->getScreenWidth() - 60, 130);
+  textSummary.setPosition(40, 10);
+  textSummary.setSize(video->getScreenWidth() - 80, 130);
   textSummary.setParaMode(true);
   summary.add(&textSummary);
   
@@ -330,14 +337,8 @@ int VVideoLiveTV::handleCommand(int command)
 
     case Remote::GREEN:
     {
-      /*
-      VAudioSelector* vas = new VAudioSelector(this, (*chanList)[currentChannelIndex], ((Player*)player)->getCurrentAudioChannel());
-      vas->setBackgroundColour(Colour::VIEWBACKGROUND);
-      vas->setPosition(0, getHeight()-200);
-      vas->draw();
-      BoxStack::getInstance()->add(vas);
-      BoxStack::getInstance()->update(vas);        
-      */
+      if (streamType == VDR::VIDEO) doAudioSelector();
+      return 2;   
     }
     case Remote::YELLOW:
     {
@@ -513,6 +514,40 @@ void VVideoLiveTV::doKey(int command)
   delete[] keyingString;
 }
 
+void VVideoLiveTV::doAudioSelector()
+{
+  // If the osd is already visisble there might be a timer for it
+  Timers::getInstance()->cancelTimer(this, 1);
+
+  // Cancel keying
+  if (keying)
+  {
+    keying = 0;
+    // and reset the display - this is a copy from setNowNextData
+    char formatChanNum[20];
+    SNPRINTF(formatChanNum, 19, "%0*lu", numberWidth, (*chanList)[osdChannelIndex]->number);
+    osdChanNum.setText(formatChanNum);
+    osdChanName.setText((*chanList)[osdChannelIndex]->name);
+  }
+
+  // Draw the selector
+  vas = new VAudioSelector(this, (*chanList)[currentChannelIndex], ((PlayerLiveTV*)player)->getCurrentAudioChannel());
+  Colour osdBack = Colour(0, 0, 0, 128);
+  vas->setBackgroundColour(osdBack);
+  vas->setPosition(0, osd.getScreenY() - vas->getHeight());
+  vas->draw();
+
+  // make vas != null and displayOSD will not set a timer or do any boxstack update
+  summary.setVisible(false);
+  if (osd.getVisible()) displayOSD(false);
+  else displayOSD(true);
+  draw();
+
+  BoxStack::getInstance()->add(vas);
+  BoxStack::getInstance()->update(this);        
+  BoxStack::getInstance()->update(vas);     
+}      
+      
 void VVideoLiveTV::doEPG()
 {
   if (osd.getVisible()) clearScreen();
@@ -605,7 +640,7 @@ void VVideoLiveTV::displayOSD(bool newNowNextData)
     summary.draw();
     boxstack->update(this, &osdSummaryRegion);
   }
-  else
+  else if (!vas)
   {
     boxstack->update(this, osd.getRegion());
     Timers::getInstance()->setTimerD(this, 1, 4);
@@ -762,6 +797,14 @@ void VVideoLiveTV::processMessage(Message* m)
   {
     video->setMode(videoMode);
   }
+  else if (m->message == Message::CHILD_CLOSE)
+  {
+    if (m->from == vas)
+    {
+      vas = NULL;
+      displayOSD(false);
+    }
+  }
   else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
   {
     Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received change audio channel to %i", m->parameter);
index d5e2047a9c81198bb9774cbe3ec4c5e1a3f82556..c1c2aabac5646d0424e2d118afc946339712a43b 100644 (file)
@@ -39,6 +39,7 @@ class VChannelList;
 class BoxStack;
 class WTextbox;
 class PlayerLive;
+class VAudioSelector;
 
 class VVideoLiveTV : public Boxx, public TimerReceiver
 {
@@ -75,6 +76,7 @@ class VVideoLiveTV : public Boxx, public TimerReceiver
     EventList* eventList;
     int numberWidth;
     int videoMode;
+    ULONG streamType;
 
     UINT currentChannelIndex;
     UINT previousChannelIndex;
@@ -89,6 +91,7 @@ class VVideoLiveTV : public Boxx, public TimerReceiver
     void doKey(int command);
     void doEPG();
     void doSummary();
+    void doAudioSelector();
     void stop();
     UINT upChannel(UINT index);
     UINT downChannel(UINT index);
@@ -101,6 +104,8 @@ class VVideoLiveTV : public Boxx, public TimerReceiver
     void setNowNextData();
     void setSummaryData();
     
+    VAudioSelector* vas;
+    
     Wwss wss;
     Region wssRegion;
     bool dowss;