From 67bc576246759082ccc84aecd1ab331c08c41ba8 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 3 May 2008 14:24:59 +0000 Subject: [PATCH] Prev channel and prebuffering osd fixes --- playerlivetv.h | 2 +- vvideolivetv.cc | 22 ++++++++++++++++++---- vvideolivetv.h | 1 + 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/playerlivetv.h b/playerlivetv.h index 0d2c5c6..c06a55b 100644 --- a/playerlivetv.h +++ b/playerlivetv.h @@ -117,7 +117,7 @@ class PlayerLiveTV : public PlayerLive, public Thread_TYPE, public Callback, pub bool videoStartup; bool stopNow; int preBufferCount; - const static int preBufferAmount = 10; + const static int preBufferAmount = 3; void clearStreamChunks(); void chunkToDemuxer(); diff --git a/vvideolivetv.cc b/vvideolivetv.cc index b3c5f27..97a47fe 100644 --- a/vvideolivetv.cc +++ b/vvideolivetv.cc @@ -55,6 +55,7 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V previousChannelIndex = 0; osdChannelIndex = 0; keying = 0; + preBuffering = 0; playing = false; @@ -309,6 +310,8 @@ int VVideoLiveTV::handleCommand(int command) case Remote::PREVCHANNEL: { channelChange(PREVIOUS, 0); + osdChannelIndex = currentChannelIndex; + displayOSD(true); return 2; } case Remote::OK: @@ -713,6 +716,14 @@ void VVideoLiveTV::timercall(int ref) } else { + // We have received a timer, we are not keying. If still prebuffering, don't remove the bar + if (preBuffering < 100) + { + Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Still prebuffering, not removing osd..."); + Timers::getInstance()->setTimerD(this, 1, 2); // reset timer for another 2s + return; + } + osd.setVisible(false); draw(); Message* m = new Message(); @@ -784,6 +795,8 @@ bool VVideoLiveTV::channelChange(UCHAR changeType, UINT newData) previousChannelIndex = currentChannelIndex; currentChannelIndex = newChannel; + preBuffering = 0; + Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Set player to channel %u", currentChannelIndex); player->setChannel(currentChannelIndex); Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Done Set player to channel %u", currentChannelIndex); @@ -918,13 +931,14 @@ void VVideoLiveTV::processMessage(Message* m) } case PlayerLiveTV::PREBUFFERING: { - Log::getInstance()->log("VVideoRec", Log::DEBUG, "Prebuffering - %u", m->tag); - bufferBar.setVisible(true); - bufferBar.setPercent(m->tag); - bufferBar.draw(); + preBuffering = m->tag; + Log::getInstance()->log("VVideoRec", Log::DEBUG, "Prebuffering - %u", preBuffering); + bufferBar.setPercent(preBuffering); if (osd.getVisible()) { + bufferBar.setVisible(true); + bufferBar.draw(); Region r; bufferBar.getRootBoxRegion(&r); BoxStack::getInstance()->update(this, &r); diff --git a/vvideolivetv.h b/vvideolivetv.h index cb04e41..c009154 100644 --- a/vvideolivetv.h +++ b/vvideolivetv.h @@ -79,6 +79,7 @@ class VVideoLiveTV : public Boxx, public TimerReceiver int numberWidth; int videoMode; ULONG streamType; + ULONG preBuffering; UINT currentChannelIndex; UINT previousChannelIndex; -- 2.39.5