diff --git a/mythtv/libs/libmythtv/teletextreader.cpp b/mythtv/libs/libmythtv/teletextreader.cpp
index 0e9870e9a2..48a77c8b79 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 | | |
316 | | // update the last fetched page if the magazine is the same |
317 | | // and the page no. is different |
318 | 310 | |
319 | | if ((page != lastPage || subpage != lastSubPage) && |
320 | | m_magazines[magazine - 1].loadingpage.active) |
| 311 | for(int m = 1; m <= 8; m++) |
321 | 312 | { |
322 | | TeletextSubPage *ttpage = FindSubPage(lastPage, lastSubPage); |
323 | | if (!ttpage) |
| 313 | // ETS 300 706, chapter 7.2.1: |
| 314 | // The transmission of a given page begins with, and includes, its page |
| 315 | // header packet. It is terminated by and excludes the next page header |
| 316 | // packet having the same magazine address in parallel transmission |
| 317 | // mode, or any magazine address in serial transmission mode. |
| 318 | // ETS 300 706, chapter 9.3.1.3: |
| 319 | // When set to '1' the service is designated to be in Serial mode and |
| 320 | // the transmission of a page is terminated by the next page header with |
| 321 | // a different page number. |
| 322 | // When set to '0' the service is designated to be in Parallel mode and |
| 323 | // the transmission of a page is terminated by the next page header with |
| 324 | // a different page number but the same magazine number. The same |
| 325 | // setting shall be used for all page headers in the service. |
| 326 | |
| 327 | bool isMagazineSerialMode = flags & TP_MAGAZINE_SERIAL; |
| 328 | if (!(isMagazineSerialMode) && m != magazine) |
324 | 329 | { |
325 | | ttpage = &(m_magazines[magazine - 1] |
326 | | .pages[lastPage].subpages[lastSubPage]); |
327 | | m_magazines[magazine - 1].pages[lastPage].pagenum = lastPage; |
328 | | ttpage->subpagenum = lastSubPage; |
| 330 | continue; // in parallel mode only process magazine |
329 | 331 | } |
330 | 332 | |
331 | | memcpy(ttpage, &m_magazines[magazine - 1].loadingpage, |
332 | | sizeof(TeletextSubPage)); |
| 333 | int lastPage = m_magazines[m - 1].current_page; |
| 334 | int lastSubPage = m_magazines[m - 1].current_subpage; |
333 | 335 | |
334 | | m_magazines[magazine - 1].loadingpage.active = false; |
| 336 | LOG(VB_VBI, LOG_DEBUG, |
| 337 | QString("AddPageHeader(p %1, sp %2, lang %3, mag %4, lp %5, lsp %6" |
| 338 | " sm %7)") |
| 339 | .arg(page).arg(subpage).arg(lang).arg(m).arg(lastPage) |
| 340 | .arg(lastSubPage).arg(isMagazineSerialMode)); |
335 | 341 | |
336 | | PageUpdated(lastPage, lastSubPage); |
| 342 | if ((page != lastPage || subpage != lastSubPage) && |
| 343 | m_magazines[m - 1].loadingpage.active) |
| 344 | { |
| 345 | TeletextSubPage *ttpage = FindSubPage(lastPage, lastSubPage); |
| 346 | if (!ttpage) |
| 347 | { |
| 348 | ttpage = &(m_magazines[m - 1] |
| 349 | .pages[lastPage].subpages[lastSubPage]); |
| 350 | m_magazines[m - 1].pages[lastPage].pagenum = lastPage; |
| 351 | ttpage->subpagenum = lastSubPage; |
| 352 | } |
| 353 | |
| 354 | memcpy(ttpage, &m_magazines[m - 1].loadingpage, |
| 355 | sizeof(TeletextSubPage)); |
| 356 | |
| 357 | m_magazines[m - 1].loadingpage.active = false; |
| 358 | |
| 359 | PageUpdated(lastPage, lastSubPage); |
| 360 | } |
337 | 361 | } |
338 | 362 | |
339 | 363 | m_fetchpage = page; |