2 Copyright 2005-2020 Chris Tallon, Marten Richter
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP. If not, see <https://www.gnu.org/licenses/>.
25 #include "playervideolive.h"
27 #include "vteletextview.h"
29 VTeletextView::VTeletextView(TeletextDecoderVBIEBU* TTdecoder, Boxx* playerview, PlayerVideoLive* playerObj)
31 ttdecoder = TTdecoder;
35 if (Video::getInstance()->getFormat() == Video::PAL)
38 setSize(680,22); //Only first line
45 setSize(680,18);//only first line
53 VTeletextView::~VTeletextView()
55 Log::getInstance()->log("VTeletextView", Log::DEBUG, "VTeletextView destruct");
57 BoxStack::getInstance()->update(pv);
58 ttdecoder->unRegisterTeletextView(this);
61 void VTeletextView::draw(bool completedraw, bool onlyfirstline)
63 //Log::getInstance()->log("VTeletextView", Log::ERR, "Start draw");
67 Boxx* drawtarget = NULL;
69 for (y = 0; y < 25; y++)
80 ox = this->getScreenX();
81 oy = this->getScreenY();
84 for (x = 0; x < 40; x++)
86 if (ttdecoder->isDirty(x, y) || completedraw)
88 cTeletextChar c = ttdecoder->getChar(x, y);
90 //Skip Blinking and conceal
91 drawtarget->drawTTChar(ox, oy, x, y, c);
92 ttdecoder->setChar(x, y, c);
95 // Log::getInstance()->log("VTeletextView", Log::ERR, "Line %d",y);
96 if (onlyfirstline) break;
98 // Log::getInstance()->log("VTeletextView", Log::ERR, "Start end");
101 int VTeletextView::handleCommand(int command)
103 if (subtitlemode) return 0; //Ok we are in subtitle mode, we are a slave of the player
109 if(player) player->tellSubtitlesOSDVisible(false); // Only on liveTV
122 // key in teletext page
131 void VTeletextView::doKey(int command)
136 if (command == 9) return; //not allowed
138 pagenums[0] = static_cast<char>(command + 48);
143 else if (keyindigit == 2)
145 page |= command << 4;
146 pagenums[0] = static_cast<char>(48 + ((page & 0xF00) >> 8));
147 pagenums[1] = static_cast<char>(command + 48);
151 else if (keyindigit == 3)
154 pagenums[0] = static_cast<char>(48 + ((page & 0xF00) >> 8));
155 pagenums[1] = static_cast<char>(48 + ((page & 0x0F0) >> 4));
156 pagenums[2] = static_cast<char>(48 + command);
158 ttdecoder->setPage(page);
161 ttdecoder->setKeyinDigits(pagenums, true);
163 toupdate.w = 16 * 40;
164 if (Video::getInstance()->getFormat() == Video::PAL)
176 BoxStack::getInstance()->update(this, &toupdate);
179 void VTeletextView::processMessage(Message* m)
181 if (m->message == Message::TELETEXTUPDATE)
184 BoxStack::getInstance()->update(this);
185 BoxStack::getInstance()->update(pv);
187 else if (m->message == Message::TELETEXTUPDATEFIRSTLINE)
190 toupdate.w = 16 * 40;
191 if (Video::getInstance()->getFormat() == Video::PAL)
203 BoxStack::getInstance()->update(this, &toupdate);