From 2ff34a50d7fac8a1d4a9d381bbc74bbe66657fa7 Mon Sep 17 00:00:00 2001
From: angelaschmid <angela.schmid@wolke7.net>
Date: Tue, 25 Jul 2017 23:25:59 +0200
Subject: [PATCH] Implemented Teletext Magazin Serial Mode
Only Parallel Mode was implemented, therefor some subtitles where not
displayed when there where not enough teletext page changes in the
magazin where the subtitle pages where gathered.
In Magazin Serial Mode any new page finishes the previously gathered
teletext pages independently of the magazin of the new page.
---
mythtv/libs/libmythtv/teletextreader.cpp | 59 ++++++++++++++++++++------------
1 file changed, 38 insertions(+), 21 deletions(-)
diff --git a/mythtv/libs/libmythtv/teletextreader.cpp b/mythtv/libs/libmythtv/teletextreader.cpp
index 0e9870e9a2..86c9999e36 100644
a
|
b
|
void TeletextReader::Reset(void) |
304 | 304 | void TeletextReader::AddPageHeader(int page, int subpage, const uint8_t *buf, |
305 | 305 | int vbimode, int lang, int flags) |
306 | 306 | { |
307 | | //LOG(VB_GENERAL, LOG_ERR, QString("AddPageHeader(p %1, sp %2, lang %3)") |
308 | | // .arg(page).arg(subpage).arg(lang)); |
309 | | |
310 | 307 | int magazine = MAGAZINE(page); |
311 | 308 | if (magazine < 1 || magazine > 8) |
312 | 309 | return; |
313 | | int lastPage = m_magazines[magazine - 1].current_page; |
314 | | int lastSubPage = m_magazines[magazine - 1].current_subpage; |
315 | 310 | |
316 | | // update the last fetched page if the magazine is the same |
317 | | // and the page no. is different |
| 311 | for(int m = 1; m <= 8; m++) { |
| 312 | |
| 313 | // ETS 300 706, chapter 7.2.1: |
| 314 | // The transmission of a given page begins with, and includes, its page header packet. It is terminated by |
| 315 | // and excludes the next page header packet having the same magazine address in parallel transmission |
| 316 | // mode, or any magazine address in serial transmission mode. |
| 317 | // ETS 300 706, chapter 9.3.1.3: |
| 318 | // When set to '1' the service is designated to be in Serial mode and the transmission of a page is terminated |
| 319 | // by the next page header with a different page number. |
| 320 | // When set to '0' the service is designated to be in Parallel mode and the transmission of a page is terminated |
| 321 | // by the next page header with a different page number but the same magazine number. |
| 322 | // The same setting shall be used for all page headers in the service. |
| 323 | |
| 324 | bool isMagazineSerialMode = flags & TP_MAGAZINE_SERIAL; |
| 325 | if (!(isMagazineSerialMode) && m != magazine) { |
| 326 | continue; // in parallel mode only process magazine |
| 327 | } |
318 | 328 | |
319 | | if ((page != lastPage || subpage != lastSubPage) && |
320 | | m_magazines[magazine - 1].loadingpage.active) |
321 | | { |
322 | | TeletextSubPage *ttpage = FindSubPage(lastPage, lastSubPage); |
323 | | if (!ttpage) |
| 329 | int lastPage = m_magazines[m - 1].current_page; |
| 330 | int lastSubPage = m_magazines[m - 1].current_subpage; |
| 331 | |
| 332 | LOG(VB_VBI, LOG_DEBUG, QString("AddPageHeader(p %1, sp %2, lang %3, mag %4, lp %5, lsp %6 sm %7)") |
| 333 | .arg(page).arg(subpage).arg(lang).arg(m).arg(lastPage).arg(lastSubPage).arg(isMagazineSerialMode)); |
| 334 | |
| 335 | if ((page != lastPage || subpage != lastSubPage) && |
| 336 | m_magazines[m - 1].loadingpage.active) |
324 | 337 | { |
325 | | ttpage = &(m_magazines[magazine - 1] |
326 | | .pages[lastPage].subpages[lastSubPage]); |
327 | | m_magazines[magazine - 1].pages[lastPage].pagenum = lastPage; |
328 | | ttpage->subpagenum = lastSubPage; |
329 | | } |
| 338 | TeletextSubPage *ttpage = FindSubPage(lastPage, lastSubPage); |
| 339 | if (!ttpage) |
| 340 | { |
| 341 | ttpage = &(m_magazines[m - 1] |
| 342 | .pages[lastPage].subpages[lastSubPage]); |
| 343 | m_magazines[m - 1].pages[lastPage].pagenum = lastPage; |
| 344 | ttpage->subpagenum = lastSubPage; |
| 345 | } |
330 | 346 | |
331 | | memcpy(ttpage, &m_magazines[magazine - 1].loadingpage, |
332 | | sizeof(TeletextSubPage)); |
| 347 | memcpy(ttpage, &m_magazines[m - 1].loadingpage, |
| 348 | sizeof(TeletextSubPage)); |
333 | 349 | |
334 | | m_magazines[magazine - 1].loadingpage.active = false; |
| 350 | m_magazines[m - 1].loadingpage.active = false; |
335 | 351 | |
336 | | PageUpdated(lastPage, lastSubPage); |
| 352 | PageUpdated(lastPage, lastSubPage); |
| 353 | } |
337 | 354 | } |
338 | 355 | |
339 | 356 | m_fetchpage = page; |