]> git.vomp.tv Git - vompclient.git/commitdiff
Live radio
authorChris Tallon <chris@vomp.tv>
Sun, 6 Apr 2008 16:05:01 +0000 (16:05 +0000)
committerChris Tallon <chris@vomp.tv>
Sun, 6 Apr 2008 16:05:01 +0000 (16:05 +0000)
playerliveradio.cc

index f956bde9f667a10194a12d8b4225c53ddf1908a9..c5a1a7cf95d1ec25629eca4438d2e92c6fb6687b 100644 (file)
@@ -126,6 +126,7 @@ void PlayerLiveRadio::setChannel(ULONG index)
   i.instruction = I_SETCHANNEL;
   i.channelIndex = index;
   instructions.push(i);  
+  logger->log("PlayerLiveRadio", Log::DEBUG, "posted setChannel instruction, now %i in queue", instructions.size());
   threadSignalNoLock();
 }
 
@@ -204,13 +205,9 @@ void PlayerLiveRadio::switchState(UCHAR newState)
           audio->setStreamType(Audio::MPEG2_PES);
           audio->systemMuteOff();      
           audio->doMuting();              
-//          audio->sync();
           audio->play();
           audio->pause();
-
           demuxer->reset();
-//          demuxer->seek();
-
           afeed.start();
           
           state = newState;
@@ -246,6 +243,22 @@ void PlayerLiveRadio::switchState(UCHAR newState)
           state = newState;
           return;        
         }
+        case S_PREBUFFERING:
+        {
+          vdr->stopStreaming();
+          clearStreamChunks();
+          afeed.stop();
+          audio->stop();
+          audio->reset();
+          audio->play();
+          audio->pause();
+          demuxer->reset();
+          afeed.start();
+
+          state = newState;
+          preBufferCount = 0;
+          return;        
+        }
         default:
         {
           logger->log("PlayerLiveRadio", Log::EMERG, "Thread called state %u to state %u which is not supported", state, newState);
@@ -271,37 +284,19 @@ void PlayerLiveRadio::switchState(UCHAR newState)
         }
         case S_PREBUFFERING: // IS THIS HOW IT WORKS?
         {
-        /*
           vdr->stopStreaming();
           clearStreamChunks();
-          vfeed.stop();
           afeed.stop();
-          video->stop();
-          video->blank();
           audio->stop();
-          audio->unPause();
           audio->reset();
-
-          video->reset();
-          video->sync();
-          video->play();
-          video->pause();
-
-          audio->setStreamType(Audio::MPEG2_PES);
-          audio->sync();
           audio->play();
           audio->pause();
-
           demuxer->reset();
-          demuxer->seek();
-
           afeed.start();
-          vfeed.start();
 
           state = newState;
-                    preBufferCount = 0;
+          preBufferCount = 0;
           return;
-          */
         }
         default:
         {
@@ -326,6 +321,7 @@ void PlayerLiveRadio::optimizeInstructionQueue()
     i = instructions.front();
     if (i.instruction == I_SETCHANNEL)
     {
+      logger->log("PlayerLiveRadio", Log::DEBUG, "Optimised out setch to %i", i.channelIndex);
       instructions.pop();  // if this is the first of more than 1 command, currently it cannot possibly be relevant
     }
     else if (i.instruction == I_STOP)
@@ -341,7 +337,11 @@ void PlayerLiveRadio::threadMethod()
   {
     while(!instructions.empty())
     {
-      if (instructions.size() > 1) optimizeInstructionQueue();
+      if (instructions.size() > 1)
+      {
+        logger->log("PlayerLiveRadio", Log::DEBUG, "Should optimise");
+        optimizeInstructionQueue();
+      }
 
       struct PLInstruction i = instructions.front();
       instructions.pop();