From 923cd2572da4435dfd3b9b5deacd0de68af303b0 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Tue, 20 Dec 2005 15:53:53 +0000 Subject: [PATCH] Live switching of letterbox/chop sides for 4:3 TVs --- vvideolive.cc | 39 +++++++++++++++++++++++++++++++-------- vvideolive.h | 2 ++ vvideorec.cc | 25 ++++++++++++++++++++++++- vvideorec.h | 4 ++++ 4 files changed, 61 insertions(+), 9 deletions(-) diff --git a/vvideolive.cc b/vvideolive.cc index 74554f1..e7dabd6 100644 --- a/vvideolive.cc +++ b/vvideolive.cc @@ -27,19 +27,19 @@ VVideoLive::VVideoLive(ChannelList* tchanList, ULONG tstreamType) instance = this; vdr = VDR::getInstance(); viewman = ViewMan::getInstance(); + video = Video::getInstance(); + chanList = tchanList; currentChannel = 0; previousChannel = 0; unavailable = 0; unavailableView = NULL; streamType = tstreamType; - videoMode = Video::getInstance()->getMode(); + videoMode = video->getMode(); if (streamType == VDR::RADIO) player = new PlayerVideo(Command::getInstance(), 0, 1); else player = new PlayerVideo(Command::getInstance(), 0, 0); player->init(); - - Video* video = Video::getInstance(); create(video->getScreenWidth(), video->getScreenHeight()); Colour transparent(0, 0, 0, 0); setBackgroundColour(transparent); @@ -49,7 +49,7 @@ VVideoLive::~VVideoLive() { delete player; instance = NULL; - Video::getInstance()->setDefaultAspect(); + video->setDefaultAspect(); } VVideoLive* VVideoLive::getInstance() @@ -126,6 +126,12 @@ int VVideoLive::handleCommand(int command) showEPG(); return 2; } + case Remote::FULL: + case Remote::TV: + { + toggleChopSides(); + return 2; + } case Remote::ZERO ... Remote::NINE: { @@ -133,6 +139,7 @@ int VVideoLive::handleCommand(int command) v->draw(); viewman->add(v); viewman->updateView(v); + return 2; } } @@ -219,7 +226,7 @@ void VVideoLive::processMessage(Message* m) } else if (m->message == Message::EPG_CLOSE) { - Video::getInstance()->setMode(videoMode); + video->setMode(videoMode); if (saveUnavailable) showUnavailable(1); } } @@ -253,7 +260,7 @@ void VVideoLive::showUnavailable(int active) unavailableView = new VInfo(); unavailableView->create(400, 200); - if (Video::getInstance()->getFormat() == Video::PAL) + if (video->getFormat() == Video::PAL) { unavailableView->setScreenPos(170, 200); } @@ -328,8 +335,8 @@ void VVideoLive::showEPG() if (VEpg::getInstance()) return; // already showing! - Video::getInstance()->setMode(Video::QUARTER); - Video::getInstance()->setPosition(170, 5); //TODO need to deal with 4:3 switching + video->setMode(Video::QUARTER); + video->setPosition(170, 5); //TODO need to deal with 4:3 switching VEpg* vepg = new VEpg(this, currentChannel); vepg->draw(); @@ -337,3 +344,19 @@ void VVideoLive::showEPG() viewman->add(vepg); viewman->updateView(vepg); } + +void VVideoLive::toggleChopSides() +{ + if (video->getTVsize() == Video::ASPECT16X9) return; // Means nothing for 16:9 TVs + + if (videoMode == Video::NORMAL) + { + videoMode = Video::LETTERBOX; + video->setMode(Video::LETTERBOX); + } + else + { + videoMode = Video::NORMAL; + video->setMode(Video::NORMAL); + } +} diff --git a/vvideolive.h b/vvideolive.h index 1cc8bb8..3757324 100644 --- a/vvideolive.h +++ b/vvideolive.h @@ -74,6 +74,7 @@ class VVideoLive : public View static VVideoLive* instance; ViewMan* viewman; VDR* vdr; + Video* video; Player* player; ChannelList* chanList; UINT currentChannel; // index in list @@ -89,6 +90,7 @@ class VVideoLive : public View int xpos; void showEPG(); void doNoSuchChannel(); + void toggleChopSides(); int videoMode; int saveUnavailable; }; diff --git a/vvideorec.cc b/vvideorec.cc index 18e0c8a..b0d400f 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -25,10 +25,11 @@ VVideoRec::VVideoRec(Recording* rec) player = new PlayerVideo(Command::getInstance(), 1, 0); // say 0 for radio because buffering will work anyway player->init(); vdr = VDR::getInstance(); + video = Video::getInstance(); + videoMode = video->getMode(); myRec = rec; - Video* video = Video::getInstance(); create(video->getScreenWidth(), video->getScreenHeight()); Colour transparent(0, 0, 0, 0); setBackgroundColour(transparent); @@ -106,6 +107,12 @@ int VVideoRec::handleCommand(int command) player->skipForward(10); return 2; } + case Remote::FULL: + case Remote::TV: + { + toggleChopSides(); + return 2; + } // case Remote::REVERSE: // { @@ -152,3 +159,19 @@ int VVideoRec::handleCommand(int command) return 1; } + +void VVideoRec::toggleChopSides() +{ + if (video->getTVsize() == Video::ASPECT16X9) return; // Means nothing for 16:9 TVs + + if (videoMode == Video::NORMAL) + { + videoMode = Video::LETTERBOX; + video->setMode(Video::LETTERBOX); + } + else + { + videoMode = Video::NORMAL; + video->setMode(Video::NORMAL); + } +} diff --git a/vvideorec.h b/vvideorec.h index cfaf2f5..b32e23c 100644 --- a/vvideorec.h +++ b/vvideorec.h @@ -44,8 +44,12 @@ class VVideoRec : public View private: VDR* vdr; + Video* video; Player* player; Recording* myRec; + + UCHAR videoMode; + void toggleChopSides(); }; #endif -- 2.39.5