Ticket #13016: 0001-Teletext-Magazin-Serial-Mode-implemented-2.patch

File 0001-Teletext-Magazin-Serial-Mode-implemented-2.patch, 3.8 KB (added by Jonatan Lindblad, 7 years ago)

Minor formatting to adhere more closely to the coding standards available at https://www.mythtv.org/wiki/Coding_Standards

  • mythtv/libs/libmythtv/teletextreader.cpp

    diff --git a/mythtv/libs/libmythtv/teletextreader.cpp b/mythtv/libs/libmythtv/teletextreader.cpp
    index 0e9870e9a2..48a77c8b79 100644
    a b void TeletextReader::Reset(void) 
    304304void TeletextReader::AddPageHeader(int page, int subpage, const uint8_t *buf,
    305305                                   int vbimode, int lang, int flags)
    306306{
    307     //LOG(VB_GENERAL, LOG_ERR, QString("AddPageHeader(p %1, sp %2, lang %3)")
    308     //    .arg(page).arg(subpage).arg(lang));
    309 
    310307    int magazine = MAGAZINE(page);
    311308    if (magazine < 1 || magazine > 8)
    312309        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
    318310
    319     if ((page != lastPage || subpage != lastSubPage) &&
    320         m_magazines[magazine - 1].loadingpage.active)
     311    for(int m = 1; m <= 8; m++)
    321312    {
    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)
    324329        {
    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
    329331        }
    330332
    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;
    333335
    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));
    335341
    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        }
    337361    }
    338362
    339363    m_fetchpage = page;