From c2c03c853c17f67373fd41a1c8e2c2f4b9b110f2 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 7 May 2008 20:49:52 +0000 Subject: [PATCH] Stream end notice for live tv vdr timer gazump --- playerlivetv.cc | 12 +++++++++ vvideolivetv.cc | 66 ++++++++++++++++++++++++++++++++----------------- vvideolivetv.h | 2 ++ 3 files changed, 57 insertions(+), 23 deletions(-) diff --git a/playerlivetv.cc b/playerlivetv.cc index 982bf6d..87d2604 100644 --- a/playerlivetv.cc +++ b/playerlivetv.cc @@ -218,6 +218,18 @@ void PlayerLiveTV::streamReceive(ULONG flag, void* data, ULONG len) logger->log("PlayerLiveTV", Log::DEBUG, "Received a streamchunk from VDR, flag = %lu", flag); + if (flag == 1) + { + if (data) abort(); + + Message* m = new Message(); + m->from = this; + m->to = messageReceiver; + m->message = Message::PLAYER_EVENT; + m->parameter = PlayerLiveTV::STREAM_END; + messageQueue->postMessageFromOuterSpace(m); + } + if (streamChunks.size() < 11) { StreamChunk s; diff --git a/vvideolivetv.cc b/vvideolivetv.cc index 30dcaf2..7197cd7 100644 --- a/vvideolivetv.cc +++ b/vvideolivetv.cc @@ -159,7 +159,7 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V textRed.setBackgroundColour(osdBack); textRed.setPosition(boxRed.getX()+18, 98); textRed.setSize(120, 30); - textRed.setText("Summary"); + textRed.setText(tr("Summary")); osd.add(&textRed); if (streamType == VDR::VIDEO) @@ -167,7 +167,7 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V textGreen.setBackgroundColour(osdBack); textGreen.setPosition(boxGreen.getX()+18, 98); textGreen.setSize(120, 30); - textGreen.setText("Audio"); + textGreen.setText(tr("Audio")); osd.add(&textGreen); } @@ -180,7 +180,7 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V textBlue.setBackgroundColour(osdBack); textBlue.setPosition(boxBlue.getX()+18, 98); textBlue.setSize(90, 30); - textBlue.setText("EPG"); + textBlue.setText(tr("EPG")); osd.add(&textBlue); sl.setBackgroundColour(osdBack); @@ -222,6 +222,13 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V sAudioChannels.setVisible(false); osd.add(&sAudioChannels); + textUnavailable.setBackgroundColour(osdBack); + textUnavailable.setPosition(60, 30); + textUnavailable.setSize(osd.getWidth() - 120, 30); + textUnavailable.setText(tr("Channel Unavailable")); + textUnavailable.setVisible(false); + add(&textUnavailable); + // FIXME painful Region r1 = summary.getRegionR(); Region r2 = osd.getRegionR(); @@ -658,30 +665,40 @@ void VVideoLiveTV::displayOSD(bool newNowNextData) summary.draw(); boxstack->update(this, &osdSummaryRegion); } - else if (!vas) + else { boxstack->update(this, osd.getRegion()); - Timers::getInstance()->setTimerD(this, 1, 4); } + + bool setTimer = true; + if (vas) setTimer = false; + if (summary.getVisible()) setTimer = false; + if (textUnavailable.getVisible()) setTimer = false; + + if (setTimer) Timers::getInstance()->setTimerD(this, 1, 4); } void VVideoLiveTV::clearScreen() { if (!summary.getVisible()) Timers::getInstance()->cancelTimer(this, 1); + textUnavailable.setVisible(false); osd.setVisible(false); + summary.setVisible(false); - if (summary.getVisible()) - { - summary.setVisible(false); - draw(); - boxstack->update(this, &osdSummaryRegion); - } - else - { - draw(); - boxstack->update(this, osd.getRegion()); - } + draw(); + boxstack->update(this); +} + +void VVideoLiveTV::showUnavailable() +{ + Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Show unavailable called"); + textUnavailable.setVisible(true); + textUnavailable.draw(); + + if (!osd.getVisible()) displayOSD(true); + + boxstack->update(this, textUnavailable.getRegion()); } void VVideoLiveTV::setClock() @@ -811,6 +828,14 @@ bool VVideoLiveTV::channelChange(UCHAR changeType, UINT newData) bufferBar.setPercent(0); sAudioChannels.setVisible(false); + // Remove other stuff + if (textUnavailable.getVisible()) + { + textUnavailable.setVisible(false); + draw(); + BoxStack::getInstance()->update(this); + } + return true; } @@ -881,17 +906,12 @@ void VVideoLiveTV::processMessage(Message* m) break; } - /* case PlayerLiveTV::STREAM_END: { - // I can't handle this, send it to command - improve this - Message* m2 = new Message(); // Must be done after this thread finishes, and must break into master mutex - m2->to = Command::getInstance(); - m2->message = Message::STREAM_END; - Command::getInstance()->postMessageNoLock(m2); + // Message comes from playerlivetv through master mutex, so can do anything here + showUnavailable(); break; } - */ case PlayerLiveTV::ASPECT43: { diff --git a/vvideolivetv.h b/vvideolivetv.h index 4c65dff..54a55f6 100644 --- a/vvideolivetv.h +++ b/vvideolivetv.h @@ -107,6 +107,7 @@ class VVideoLiveTV : public Boxx, public TimerReceiver void setNowNextData(); void setSummaryData(); void doAudioChannelSymbol(); + void showUnavailable(); VAudioSelector* vas; @@ -130,6 +131,7 @@ class VVideoLiveTV : public Boxx, public TimerReceiver WSymbol sAspectRatio; WProgressBar bufferBar; WSymbol sAudioChannels; + WTextbox textUnavailable; Boxx summary; WTextbox textSummary; -- 2.39.5