12static inline int MAGAZINE(
int page) {
return page / 256; };
17 for (
int i = 0; i < 256; i++)
19 for (
int bit = 0; bit < 8; bit++)
30 bool numeric_input =
false;
206 if (mag > 8 || mag < 1)
215 int_to_subpage_t::const_iterator subpageIter;
216 subpageIter = page->
subpages.begin();
217 while (subpageIter != page->
subpages.end())
231 str += QString(
"%1").arg(subpage->
subpagenum,2,16,QChar(
'0'));
246 spaces.fill(
' ', 27 - str.length());
247 str =
" <" + str + spaces +
" > ";
252 int startPos = selected - 5;
253 startPos = std::max(startPos, 0);
254 if (startPos + 9 >= count)
255 startPos = count - 10;
257 str =
" <" + str.mid(startPos * 3, 27) +
" > ";
264 if (page < 0x100 || page > 0x899)
280 QMutexLocker lock(mag.lock);
283 int_to_page_t::iterator iter;
284 iter = mag.pages.begin();
285 while (iter != mag.pages.end())
294 mag.current_page = 0;
295 mag.current_subpage = 0;
296 mag.loadingpage.active =
false;
310 int vbimode,
int lang,
int flags)
313 if (magazine < 1 || magazine > 8)
316 for(
int m = 1; m <= 8; m++)
333 if (!isMagazineSerialMode && m != magazine)
339 int lastSubPage =
m_magazines[m - 1].current_subpage;
341 LOG(VB_VBI, LOG_DEBUG,
342 QString(
"AddPageHeader(p %1, sp %2, lang %3, mag %4, lp %5, lsp %6"
344 .arg(page).arg(subpage).arg(lang).arg(m).arg(lastPage)
345 .arg(lastSubPage).arg(isMagazineSerialMode));
347 if ((page != lastPage || subpage != lastSubPage) &&
354 .pages[lastPage].subpages[lastSubPage]);
355 m_magazines[m - 1].pages[lastPage].pagenum = lastPage;
374 m_magazines[magazine - 1].current_subpage = subpage;
376 for (
auto & line : ttpage->
data)
383 ttpage->
flags = flags;
388 std::fill_n(ttpage->
data[0].data(), 8,
' ');
392 for (
uint j = 8; j < 40; j++)
408 const uint8_t* buf,
int vbimode)
418 if (magazine < 1 || magazine > 8)
421 int currentpage =
m_magazines[magazine - 1].current_page;
443 b1 =
hamm8(buf, &err);
444 b2 =
hamm8(buf + 37, &err);
451 b2 =
hamm84(buf + 37, &err);
458 if (b1 != 0 || !(b2 & 8))
461 for (ptrdiff_t i = 0; i < 6; ++i)
467 b1 =
hamm16(buf+1+(6*i), &err);
468 b2 =
hamm16(buf+3+(6*i), &err);
469 b3 =
hamm16(buf+5+(6*i), &err);
475 b1 = (
hamm84(buf+2+(6*i), &err) * 16) +
476 hamm84(buf+1+(6*i), &err);
477 b2 = (
hamm84(buf+4+(6*i), &err) * 16) +
478 hamm84(buf+3+(6*i), &err);
479 b3 = (
hamm84(buf+6+(6*i), &err) * 16) +
480 hamm84(buf+5+(6*i), &err);
488 int x = (b2 >> 7) | ((b3 >> 5) & 0x06);
489 int nTmp = (magazine ^ x);
490 ttpage->
floflink[i] = (( nTmp ? nTmp : 8) * 256) + b1;
500 if (( row >= 1 ) && ( row <= 24 ))
504 for (
uint j = 0; j < 40; j++)
527 [[maybe_unused]]
int page,
528 [[maybe_unused]]
int subpage,
530 [[maybe_unused]]
int lang)
539 int page,
int direction)
const
543 if (mag > 8 || mag < 1)
548 int_to_page_t::const_iterator pageIter;
559 int_to_page_t::const_reverse_iterator iter;
565 res = &pageIter->second;
575 res = &pageIter->second;
579 res = &pageIter->second;
587 int page,
int subpage,
int direction)
const
591 if (mag > 8 || mag < 1)
596 int_to_page_t::const_iterator pageIter;
602 auto subpageIter = ttpage->
subpages.cbegin();
606 subpageIter = ttpage->
subpages.find(subpage);
608 if (subpageIter == ttpage->
subpages.cend())
612 return &(subpageIter->second);
618 if (subpageIter == ttpage->
subpages.cend())
620 auto iter = ttpage->
subpages.crbegin();
621 res = &(iter->second);
625 res = &(subpageIter->second);
632 if (subpageIter == ttpage->
subpages.cend())
633 subpageIter = ttpage->
subpages.cbegin();
635 res = &(subpageIter->second);
int_to_subpage_t subpages
std::array< uint8_t, 256 > m_bitswap
void AddTeletextData(int magazine, int row, const uint8_t *buf, int vbimode)
virtual void HeaderUpdated(int page, int subpage, tt_line_array &page_ptr, int lang)
void AddPageHeader(int page, int subpage, const uint8_t *buf, int vbimode, int lang, int flags)
const TeletextPage * FindPage(int page, int dir=0) const
virtual void PageUpdated(int page, int subpage)
std::array< TeletextMagazine, 8 > m_magazines
TeletextSubPage * FindSubPage(void)
void SetPage(int page, int subpage)
bool KeyPress(const QString &Key, bool &Exit)
const TeletextSubPage * FindSubPageInternal(int page, int subpage, int direction) const
const TeletextPage * FindPageInternal(int page, int direction) const
std::array< char, 3 > m_pageinput
int subpagenum
the wanted subpage
int flof
page has FastText links
std::array< int, 6 > floflink
FastText links (FLOF)
bool active
data has arrived since page last cleared
bool subtitle
page is subtitle page
std::array< tt_line_array, 25 > data
page data
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static constexpr const char * ACTION_7
static constexpr const char * ACTION_5
static constexpr const char * ACTION_0
static constexpr const char * ACTION_3
static constexpr const char * ACTION_1
static constexpr const char * ACTION_4
static constexpr const char * ACTION_6
static constexpr const char * ACTION_8
static constexpr const char * ACTION_2
static constexpr const char * ACTION_9
MBASE_PUBLIC long long copy(QFile &dst, QFile &src, uint block_size=0)
Copies src file to dst file.
static eu8 clamp(eu8 value, eu8 low, eu8 high)
static int MAGAZINE(int page)
std::array< uint8_t, 40 > tt_line_array
static constexpr uint8_t TP_INTERRUPTED_SEQ
static constexpr uint8_t TP_MAGAZINE_SERIAL
#define ACTION_NEXTSUBPAGE
#define ACTION_TOGGLEBACKGROUND
#define ACTION_PREVSUBPAGE
#define ACTION_MENUYELLOW
int hamm8(const uint8_t *p, int *err)
int hamm84(const uint8_t *p, int *err)
int hamm16(const uint8_t *p, int *err)
@ VBI_DVB_SUBTITLE
< DVB packet