]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Buffering progress bar
authorChris Tallon <chris@vomp.tv>
Thu, 1 May 2008 20:28:32 +0000 (20:28 +0000)
committerChris Tallon <chris@vomp.tv>
Thu, 1 May 2008 20:28:32 +0000 (20:28 +0000)
GNUmakefile
objects.mk
playerlivetv.cc
playerlivetv.h
vaudioselector.cc
vvideolivetv.cc
vvideolivetv.h
wprogressbar.cc [new file with mode: 0644]
wprogressbar.h [new file with mode: 0644]

index ebef069c44411ecb97692ea3742c5782daa06204..ec80be730efcd45f0e25a75b499e8f64f5721170 100644 (file)
@@ -53,7 +53,7 @@ debug:
        ../../gdb/gdb-6.7/gdb/gdb /diskless/nfs/mvp/vompclient /diskless/nfs/mvp/core.*
 
 debug2:
-       ../../gdb/gdb-6.7/gdb/gdb /diskless/nfs/wmvp/vompclient /diskless/nfs/wmvp/core.*
+       ../../gdb/gdb-6.7/gdb/gdb /mnt/auto/defiant/diskless/nfs/mvp-dev/vompclient /mnt/auto/defiant/diskless/nfs/mvp-dev/core.*
 
 dev: CXXFLAGS := $(CXXFLAGS_DEV)
 dev: vompclient
index 04784277aa5987480f7d9e1c3a47d49f5bb5e196..23058447464dc1227e7042d20d7239ea962a8df3 100644 (file)
@@ -18,4 +18,5 @@ OBJECTS1 = command.o log.o tcp.o dsock.o thread.o timers.o i18n.o mutex.o     \
            vaudioplayer.o audioplayer.o demuxeraudio.o abstractoption.o       \
            eventdispatcher.o vdrrequestpacket.o vdrresponsepacket.o           \
            vvideolivetv.o                                                     \
-           vvideolive.o vlivebanner.o playerlivetv.o playerliveradio.o
+           vvideolive.o vlivebanner.o playerlivetv.o playerliveradio.o        \
+           wprogressbar.o
index 9e83595cf7d0d38f8148c7f34acb0b06349ef01e..16fef2dde88a9742aa22e406702437dc288e9724 100644 (file)
@@ -153,17 +153,18 @@ void PlayerLiveTV::call(void* caller)
   {
     logger->log("PlayerLiveTV", Log::DEBUG, "Callback from demuxer");
 
-    if (video->getTVsize() == Video::ASPECT4X3)
-    {
-      logger->log("PlayerLiveTV", Log::DEBUG, "TV is 4:3, ignoring aspect switching");
-      return;
-    }
-
     int dxCurrentAspect = demuxer->getAspectRatio();
     if (dxCurrentAspect == Demuxer::ASPECT_4_3)
     {
-      logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer said video is 4:3 aspect, switching TV");
-      video->setAspectRatio(Video::ASPECT4X3);
+      if (video->getTVsize() == Video::ASPECT16X9)
+      {
+        logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer said video is 4:3 aspect, switching TV");
+        video->setAspectRatio(Video::ASPECT4X3);
+      }
+      else
+      {
+        logger->log("PlayerLiveTV", Log::DEBUG, "TV is 4:3, ignoring aspect switching");
+      }
 
       Message* m = new Message();
       m->from = this;
@@ -174,8 +175,15 @@ void PlayerLiveTV::call(void* caller)
     }
     else if (dxCurrentAspect == Demuxer::ASPECT_16_9)
     {
-      logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer said video is 16:9 aspect, switching TV");
-      video->setAspectRatio(Video::ASPECT16X9);
+      if (video->getTVsize() == Video::ASPECT16X9)
+      {
+        logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer said video is 16:9 aspect, switching TV");
+        video->setAspectRatio(Video::ASPECT16X9);
+      }
+      else
+      {
+        logger->log("PlayerLiveTV", Log::DEBUG, "TV is 4:3, ignoring aspect switching");
+      }    
 
       Message* m = new Message();
       m->from = this;
@@ -554,6 +562,7 @@ void PlayerLiveTV::threadMethod()
       {
         ++preBufferCount;
         ULONG percentDone = (ULONG)(preBufferCount / (float)preBufferAmount * 100);
+        logger->log("PlayerLiveTV", Log::DEBUG, "Prebuffering %lu%%", percentDone);
         
         Message* m = new Message();
         m->from = this;
index c06a55b8fdce1def2b7f6152975a98bf6b6230db..0d2c5c691b3bab203cf56c9560b21d6bd03f5739 100644 (file)
@@ -117,7 +117,7 @@ class PlayerLiveTV : public PlayerLive, public Thread_TYPE, public Callback, pub
     bool videoStartup;
     bool stopNow;
     int preBufferCount;
-    const static int preBufferAmount = 3;
+    const static int preBufferAmount = 10;
 
     void clearStreamChunks();
     void chunkToDemuxer();
index 857d10a8d7203772cf23a00bbcc1058f86f6aefd..97306ff6d263ea6e0cfbaa0e7cbbe9f12b7ce691 100644 (file)
@@ -214,16 +214,18 @@ VAudioSelector::VAudioSelector(void* tparent, Channel* channel, int currentAudio
     ac->pestype = channel->apids[i].pid;
     acl.push_back(ac);
   }
-  if (Audio::getInstance()->supportsAc3()) {
-      for (UINT i = 0; i < channel->numDPids; i++)
-      {
-          AudioChannel* ac = new AudioChannel();
-          ac->type = 1;
-          ac->name = new char[strlen(channel->dpids[i].name) + 1];
-          strcpy(ac->name, channel->dpids[i].name);
-          ac->pestype = channel->dpids[i].pid;
-          acl.push_back(ac);
-      }
+  
+  if (Audio::getInstance()->supportsAc3())
+  {
+    for (UINT i = 0; i < channel->numDPids; i++)
+    {
+      AudioChannel* ac = new AudioChannel();
+      ac->type = 1;
+      ac->name = new char[strlen(channel->dpids[i].name) + 1];
+      strcpy(ac->name, channel->dpids[i].name);
+      ac->pestype = channel->dpids[i].pid;
+      acl.push_back(ac);
+    }
   }
     
   int audioChannelListSize = acl.size();
index 8a939e3547969a3fd45a76214bff52910d8cd749..b3c5f27e97f5270cec5a474f20aa741f7c840975 100644 (file)
@@ -211,6 +211,11 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V
   sAspectRatio.setVisible(false);
   osd.add(&sAspectRatio);
   
+  bufferBar.setPosition(osd.getWidth() - 94, 70);
+  bufferBar.setSize(50, 20);
+  bufferBar.setVisible(true);
+  osd.add(&bufferBar);
+  
   // FIXME painful
   Region r1 = summary.getRegionR();
   Region r2 = osd.getRegionR();
@@ -635,7 +640,7 @@ void VVideoLiveTV::displayOSD(bool newNowNextData)
   if (newNowNextData)
   {
     setNowNextData();
-    keying = 0;  
+    keying = 0;
   }
   osd.draw();
   
@@ -783,6 +788,10 @@ bool VVideoLiveTV::channelChange(UCHAR changeType, UINT newData)
   player->setChannel(currentChannelIndex);
   Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Done Set player to channel %u", currentChannelIndex);
 
+  // Blank out the symbols
+  sAspectRatio.setVisible(false);
+  bufferBar.setPercent(0);
+  
   return true;
 }
 
@@ -867,7 +876,7 @@ void VVideoLiveTV::processMessage(Message* m)
       
       case PlayerLiveTV::ASPECT43:
       {
-        if (dowss)
+        if ((video->getTVsize() == Video::ASPECT16X9) && dowss)
         {
           Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 43");
           wss.setWide(false);
@@ -877,14 +886,18 @@ void VVideoLiveTV::processMessage(Message* m)
         
         sAspectRatio.nextSymbol = WSymbol::VIDEOASPECT43;
         sAspectRatio.setVisible(true);
-        osd.draw();
-        BoxStack::getInstance()->update(this, osd.getRegion());
+        
+        if (osd.getVisible()) // don't wake up the whole osd just for a aspect change
+        {
+          osd.draw();
+          BoxStack::getInstance()->update(this, osd.getRegion());
+        }
         
         break;
       }
       case PlayerLiveTV::ASPECT169:
       {
-        if (dowss)
+        if ((video->getTVsize() == Video::ASPECT16X9) && dowss)
         {
           Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 169");
           wss.setWide(true);
@@ -894,14 +907,28 @@ void VVideoLiveTV::processMessage(Message* m)
         
         sAspectRatio.nextSymbol = WSymbol::VIDEOASPECT169;
         sAspectRatio.setVisible(true);
-        osd.draw();
-        BoxStack::getInstance()->update(this, osd.getRegion());
+
+        if (osd.getVisible()) // don't wake up the whole osd just for a aspect change
+        {
+          osd.draw();
+          BoxStack::getInstance()->update(this, osd.getRegion());
+        }
                 
         break;
       }
       case PlayerLiveTV::PREBUFFERING:
       {
         Log::getInstance()->log("VVideoRec", Log::DEBUG, "Prebuffering - %u", m->tag);
+        bufferBar.setVisible(true);
+        bufferBar.setPercent(m->tag);
+        bufferBar.draw();
+
+        if (osd.getVisible())
+        {
+          Region r;
+          bufferBar.getRootBoxRegion(&r);
+          BoxStack::getInstance()->update(this, &r);
+        }
       }
     }
   }
index c814a1f17165a656af3e8305ca71bac249b39977..cb04e4117cf94dcb66d255a60d42c4ecc19e02e7 100644 (file)
@@ -33,6 +33,7 @@
 #include "wselectlist.h"
 #include "timerreceiver.h"
 #include "wsymbol.h"
+#include "wprogressbar.h"
 
 class VChannelList;
 class Video;
@@ -125,6 +126,7 @@ class VVideoLiveTV : public Boxx, public TimerReceiver
     WTextbox textYellow;
     WTextbox textBlue;
     WSymbol sAspectRatio;
+    WProgressBar bufferBar;
     
     Boxx summary;
     WTextbox textSummary;
diff --git a/wprogressbar.cc b/wprogressbar.cc
new file mode 100644 (file)
index 0000000..d61daa0
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+    Copyright 2008 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+*/
+
+#include "wprogressbar.h"
+
+#include "colour.h"
+
+WProgressBar::WProgressBar()
+{
+  percent = 0;
+}
+
+WProgressBar::~WProgressBar()
+{
+}
+
+void WProgressBar::setPercent(UINT tpercent)
+{
+  percent = tpercent;
+  if (percent > 100) percent = 0;
+}
+
+void WProgressBar::draw()
+{
+  if (area.w < 5) return;
+  if (area.h < 5) return;
+  
+  printf("progress bar: %u\n", percent);
+  
+  // Hmm, can't draw two boxes because should not paint on areas
+  // not needing it - this class does not know the background colour
+  
+  rectangle(0, 0, area.w, 2, Colour::LIGHTTEXT); // top
+  rectangle(0, area.h - 2, area.w, 2, Colour::LIGHTTEXT); // bottom
+  rectangle(0, 0, 2, area.h, Colour::LIGHTTEXT); // left
+  rectangle(area.w - 2, 0, 2, area.h, Colour::LIGHTTEXT); // right
+  
+  int progressWidth = (int)((area.w - 4) * (float)percent / 100);
+  rectangle(2, 2, progressWidth, area.h - 4, Colour::SELECTHIGHLIGHT);
+}
+
diff --git a/wprogressbar.h b/wprogressbar.h
new file mode 100644 (file)
index 0000000..7db78e2
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+    Copyright 2008 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+*/
+
+/*
+For now this will be a simple progress bar, but in future maybe the
+recording playback bar could be rolled into this class
+*/
+
+#ifndef WPROGRESSBAR_H
+#define WPROGRESSBAR_H
+
+#include <stdio.h>
+#include <string.h>
+
+#include "defines.h"
+#include "boxx.h"
+
+class WProgressBar : public Boxx
+{
+  public:
+    WProgressBar();
+    ~WProgressBar();
+    void setPercent(UINT percent);
+    void draw();
+
+  private:
+    UINT percent;
+};
+
+#endif
+