Ticket #5530: csat-eit-20080723.diff

File csat-eit-20080723.diff, 34.4 KB (added by anonymous, 17 years ago)
  • trunk-work/mythtv/libs/libmythtv/libmythtv.pro

     
    192192HEADERS += mpeg/iso6937tables.h
    193193HEADERS += mpeg/tsstats.h           mpeg/streamlisteners.h
    194194HEADERS += mpeg/h264utils.h
     195HEADERS += mpeg/csatcaraibesdescriptors.h
     196HEADERS += mpeg/csatcaraibestables.h
     197HEADERS += mpeg/csatcaraibeseit.h
    195198
    196199SOURCES += mpeg/tspacket.cpp        mpeg/pespacket.cpp
    197200SOURCES += mpeg/mpegtables.cpp      mpeg/atsctables.cpp
     
    205208SOURCES += mpeg/freesat_huffman.cpp
    206209SOURCES += mpeg/iso6937tables.cpp
    207210SOURCES += mpeg/h264utils.cpp
     211SOURCES += mpeg/csatcaraibesdescriptors.cpp
     212SOURCES += mpeg/csatcaraibestables.cpp
     213SOURCES += mpeg/csatcaraibeseit.cpp
    208214
    209215DEFINES += USING_H264TOOLS
    210216
  • trunk-work/mythtv/libs/libmythtv/eithelper.cpp

     
    2020#include "atsctables.h"
    2121#include "dvbtables.h"
    2222#include "premieretables.h"
     23#include "csatcaraibeseit.h"
    2324#include "dishdescriptors.h"
    2425#include "premieredescriptors.h"
    2526#include "util.h"
     
    513514    }
    514515}
    515516
     517// This function gets special eit data from the French provider
     518// Canal Satellite Caraibes. It probably applies to this provider
     519// in France. This EIT is available for all channels for 7-10 days                   
     520void EITHelper::AddEIT(CSatCaraibesEIT *cit)
     521{
     522    QString title         = QString::null;
     523    QString subtitle      = QString::null;
     524    QString description   = QString::null;
     525    QString category      = QString::null;
     526    MythCategoryType category_type = kCategoryNone;
     527    unsigned char subtitle_type=0, audio_props=0, video_props=0;
     528    uint fix = fixup[ 601LL << 32 | 1 << 16 |  0 ] | EITFixUp::kFixGenericDVB;
     529    if (!cit->IsReady()) {
     530        VERBOSE(VB_EIT,LOC+"CSAT EIT NOT READY YET");
     531        return;
     532    }
     533    for (uint i = 0;i < cit->NbSchedules();i++) {
     534        const CSatCaraibesSchedule& schedule = cit->GetSchedule(i);
     535        QString title = schedule.title;
     536        const vector<CSatCaraibesShowing>& showings = schedule.showings;
     537        QMap<uint, QString>::const_iterator sum;
     538        bool sum_available = false;
    516539
     540        if (schedule.key)
     541        {
     542            /* If the summary is not there we go on with the next schedule */
     543            if (!(cit->GetSummary(i, sum))) continue;
     544            sum_available = true;
     545        }
     546        for (vector<CSatCaraibesShowing>::const_iterator it = showings.begin();
     547             it != showings.end();it++) {
     548            QDateTime starttime = (*it).Start;
     549            //    EITFixUp::TimeFix(starttime);
     550            QDateTime endtime   = starttime.addSecs(schedule.duration*60);
     551            uint chanid;
     552            DBEvent *event;
     553            const CSatCaraibesChannelInfo& info = cit->GetChannelInfoFromIndex((*it).channel_index);
     554            chanid = GetChanID(info.tsid,info.serviceid,info.orignetworkid);
     555            VERBOSE(VB_EIT, LOC +
     556                    QString("CSATCARAIBES EIT for NIT %1, TID %2, SID %3, "
     557                            "T: %4, Start: %5, Dur: %6 Thm: %7, summ: %8")
     558                    .arg(info.orignetworkid).arg(info.tsid).arg(info.serviceid)
     559                    .arg(title).arg(starttime.toString()).arg(schedule.duration)
     560                    .arg(schedule.theme).arg((sum_available ? *sum :"No summary")));
     561     
     562            if (!chanid)
     563            {
     564                VERBOSE(VB_EIT, LOC +
     565                        QString("CSATCARAIBES EIT for NIT %1, TID %2, SID %3, "
     566                                "title: %4. Channel not found!")
     567                        .arg(info.orignetworkid).arg(info.tsid).arg(info.serviceid)
     568                        .arg(title));
     569                continue;
     570            }
     571
     572            event = new DBEvent(chanid,
     573                                title, QString::null, sum_available ? (*sum).value():"",
     574                                category,  category_type,
     575                                starttime, endtime, fix,
     576                                subtitle_type,
     577                                audio_props,
     578                                video_props,
     579                                "",  "");
     580            db_events.enqueue(event);*/
     581        }
     582    }
     583}
     584
    517585void EITHelper::PruneEITCache(uint timestamp)
    518586{
    519587    eitcache->PruneOldEntries(timestamp);
     
    856924        fix[ 1094LL << 32 | 1 << 16 | 17028 ] = // NT1
    857925        fix[ 1100LL << 32 | 1 << 16 |  8710 ] = // NRJ 12
    858926        EITFixUp::kEFixForceISO8859_15;
     927
     928    // IntelSat 903 DVB-S french channels (CanalSat Caraibes)
     929    // The original network id is the same as the previous one
     930    // at least transport ids are different
     931    // For now all channels are marked as needing fixup
     932    fix[   601LL << 32 | 1 << 16 |  0 ] =
     933        fix[ 602LL << 32 | 1 << 16 |  0 ] =
     934        fix[ 603LL << 32 | 1 << 16 |  0 ] =
     935        fix[ 604LL << 32 | 1 << 16 |  0 ] =
     936        EITFixUp::kEFixForceISO8859_15;
    859937}
    860938
    861939static int calc_eit_utc_offset(void)
  • trunk-work/mythtv/libs/libmythtv/eithelper.h

     
    5353class ExtendedTextTable;
    5454class DVBEventInformationTable;
    5555class PremiereContentInformationTable;
     56class CSatCaraibesEIT;
    5657
    5758class EITHelper
    5859{
     
    7778                const ExtendedTextTable     *ett);
    7879    void AddEIT(const DVBEventInformationTable *eit);
    7980    void AddEIT(const PremiereContentInformationTable *eit);
     81    void AddEIT(CSatCaraibesEIT *eit);
    8082#else // if !USING_BACKEND
    8183    void AddEIT(uint, uint, const EventInformationTable*) {}
    8284    void AddETT(uint, uint, const ExtendedTextTable*) {}
    8385    void AddEIT(const DVBEventInformationTable*) {}
    8486    void AddEIT(const PremiereContentInformationTable*) {}
     87    void AddEIT(CSatCaraibesEIT *eit) {}
    8588#endif // !USING_BACKEND
    8689
    8790    // EIT cache handling
  • trunk-work/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp

     
    678679            return false;
    679680        return PMTSectionSeen(psip.TableIDExtension(), psip.Section());
    680681    }
    681 
     682/* FIXME: Shoud do something for BAT also, we need only one
     683   and I dont think they change that much */
    682684    return false;
    683685}
    684686
     
    879881        DONE_WITH_PES_PACKET();
    880882    }
    881883
    882     if (!psip->IsCurrent()) // we don't cache the next table, for now
     884    if (!psip->IsCurrent())
     885    {
     886        /* Canal Sat Caraibes: BAT tables have the next flag
     887           Process it instead if
     888         */
     889        if (TableID::BAT == psip->TableID())
     890            HandleTables(tspacket->PID(), *psip);
     891        // we don't cache the next table, for now
    883892        DONE_WITH_PES_PACKET();
     893    }
    884894
    885895    if (tspacket->ScramplingControl())
    886896    { // scrambled! ATSC, DVB require tables not to be scrambled
     
    889899        DONE_WITH_PES_PACKET();
    890900    }
    891901
    892     if (!psip->VerifyPSIP(!_have_CRC_bug))
     902    if (!psip->VerifyPSIP(!_have_CRC_bug && psip->HasCRC()))
    893903    {
    894         VERBOSE(VB_RECORD, "PSIP table is invalid");
     904        VERBOSE(VB_RECORD, QString("PSIP table %1 (pid %2)  is invalid")
     905                .arg(psip->TableID()).arg(tspacket->PID()));
    895906        DONE_WITH_PES_PACKET();
    896907    }
    897908
  • trunk-work/mythtv/libs/libmythtv/mpeg/dvbtables.cpp

     
    148148        return false;
    149149}
    150150
     151void BouquetAssociationTable::Parse(void)
     152{
     153    const unsigned char * p = pesdata() + 8;
     154    uint len;
     155    int looplen;
     156    desc_list_t desc;
     157
     158    len = ((p[0] & 0x0F) << 8) + p[1]; // Name descriptor length
     159    p += 2;
     160    VERBOSE(VB_SIPARSER,"RAW:"<< p[0] << " "<< p[1]<<" "<<p[2]<< " "<<p[3]<< "<>BqtName desc len "<< len << QString::fromLatin1((const char*)(p+2),p[1]));
     161    desc = MPEGDescriptor::ParseOnlyInclude(p, len, DescriptorID::bouquet_name);
     162    if (desc.empty())
     163        VERBOSE(VB_SIPARSER,"Curious: BAT without bouquet name!");
     164    else
     165        bouquet_name = QString::fromLatin1((const char*)(desc[0]+2),
     166                                           MPEGDescriptor(desc[0]).DescriptorLength());
     167    p += len;
     168    looplen = ((p[0] & 0x0F) << 8) + p[1];
     169    p += 2; // Now point on first TS desc
     170    while (looplen > 0) {
     171        _ptrs.push_back(p);    // Add first TS position
     172        VERBOSE(VB_SIPARSER,"TS/NetID" << (p[0]*256+p[1]) << "/"
     173                << (p[2]*256+p[3])<<" looplen "<< looplen);
     174        p += 4;                // Skip TS and network ID
     175        len = ((p[0] & 0x0F) << 8) + p[1];    // Get length of descriptors
     176        p += 2 + len;          // Skip all descriptors
     177        looplen -= 6 + len;
     178    }
     179}
     180
    151181void DVBEventInformationTable::Parse(void) const
    152182{
    153183    _ptrs.clear();
     
    177207    // Dish Network Long Term Future Event Information for all transports
    178208    is_eit |= (TableID::DN_EITbego <= table_id &&
    179209               TableID::DN_EITendo >= table_id);
     210    // Canal Satellite long term EIT for all transports
     211    is_eit |= (table_id == TableID::CSATCARAIBES_CHANNELS ||
     212               table_id == TableID::CSATCARAIBES_THEMES ||
     213               table_id == TableID::CSATCARAIBES_SCHED ||
     214               table_id == TableID::CSATCARAIBES_SUMMARIES);
    180215
    181216    return is_eit;
    182217}
  • trunk-work/mythtv/libs/libmythtv/mpeg/csatcaraibesdescriptors.h

     
     1// -*- Mode: c++ -*-
     2#ifndef _CSATCAR_DESCRIPTORS_H_
     3#define _CSATCAR_DESCRIPTORS_H_
     4
     5#include <stdint.h>
     6#include <inttypes.h>
     7
     8#include <qstring.h>
     9#include <qdatetime.h>
     10
     11#include "dvbdescriptors.h"
     12
     13class CSatCaraibesChannelsDescriptor : public MPEGDescriptor
     14{
     15    public:
     16        CSatCaraibesChannelsDescriptor(const unsigned char* data) : MPEGDescriptor(data)
     17        {
     18            assert(DescriptorID::csat_channels_ind == DescriptorTag());
     19            Parse();
     20        }
     21
     22        void Parse(void);
     23        const QMap<uint,uint>& GetIndexes() const
     24        {
     25            return channels_indexes;
     26        }
     27
     28    private:
     29        /* Maps a Program ID to an index used by the EIT */
     30        QMap<uint,uint> channels_indexes;
     31};
     32
     33#endif // _CSATCAR_DESCRIPTORS_H_
  • trunk-work/mythtv/libs/libmythtv/mpeg/pespacket.cpp

     
    1717
    1818using namespace std;
    1919
     20bool PESPacket::HasCRC(void) const
     21{
     22    /* CRC bit is placed differently for the packet of private type */
     23    if ((StreamID()>=0x80) && (StreamID()<=0xFF))
     24        return (_pesdata[1] & 0x80) >> 7;
     25    else return (_pesdata[4] & 0x2) >> 1;
     26}
     27
    2028// return true if complete or broken
    2129bool PESPacket::AddTSPacket(const TSPacket* packet, bool &broken)
    2230{
  • trunk-work/mythtv/libs/libmythtv/mpeg/csatcaraibestables.cpp

     
     1#include "csatcaraibesdescriptors.h"
     2#include "csatcaraibestables.h"
     3
     4/******************* Schedule ******************************/
     5
     6void CSatCaraibesScheduleTable::Parse()
     7{
     8    uint nb_titles, i;
     9    unsigned char * pos;
     10
     11    /* Skip section length */
     12    nb_titles = psipdata()[1];
     13    pos = psipdata() + 2;
     14    for (i = 0;i < nb_titles;i++) {
     15        _ptrs.push_back(pos);
     16        /* Skip titles */
     17        pos += pos[0] + 1;
     18        /* Skip 4 bytes per showing */
     19        pos += ((pos[0] & 0x70) >> 4) * 4 + 3;
     20    }
     21}
     22
     23/******************* Summaries *******************************/
     24
     25uint CSatCaraibesSummaryTable::TitleKey() const
     26{
     27    uint sched_off = (pesdata()[3] &0x0F)*256+pesdata()[4];
     28    uint sched_sect = pesdata()[8];
     29    return (sched_off + (sched_sect << 12));
     30}
     31
     32/******************* Themes **************************/
     33
     34void CSatCaraibesThemesTable::Parse(void)
     35{
     36    const unsigned char * p = pesdata() + 0x10C;
     37    for (int i = 0x0C;i < 0x100;i += 0x10)
     38    {
     39        _ptrs.push_back((const char *)p);
     40        VERBOSE(VB_EIT,QString("Theme raw: %1 %2 %3 %4").arg(p[0]).arg(p[1]).arg(p[2]).arg(p[3]));
     41        /* Add length of the current title */
     42        p += pesdata()[i] & 0x7F;
     43    }
     44}
     45
     46uint CSatCaraibesThemesTable::GetThemeLength(uint i) const
     47{
     48    return (pesdata()[0x0C + i*0x10] & 0x7F);
     49}
  • trunk-work/mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp

     
    66#include "dvbstreamdata.h"
    77#include "dvbtables.h"
    88#include "premieretables.h"
     9#include "csatcaraibestables.h"
     10#include "csatcaraibeseit.h"
    911#include "eithelper.h"
    1012
    1113#define PREMIERE_ONID 133
     
    1719    : MPEGStreamData(desired_program, cacheTables),
    1820      _desired_netid(desired_netid), _desired_tsid(desired_tsid),
    1921      _dvb_eit_dishnet_long(false),
     22      _dvb_eit_csatcaraibes(true),
    2023      _nit_version(-2), _nito_version(-2)
    2124{
    2225    SetVersionNIT(-1,0);
     
    243246
    244247            return true;
    245248        }
     249        case TableID::BAT:
     250        {
     251            BouquetAssociationTable bat(psip);
     252            /* For now we use the BAT only for Canal Satellite
     253             * Caraibes (French provider)
     254             */
     255            if (bat.BouquetName()=="CanalSatellite Caraibes") {
     256                VERBOSE(VB_SIPARSER,"Bat processed to get channels info, CanalSat Caraibes");
     257                _csat_eit.AddChannelsInfo(&bat);
     258            }
     259            else VERBOSE(VB_SIPARSER,"BAT but not from canalsat");
     260            return true;
     261        }
    246262        case TableID::SDT:
    247263        {
    248264            uint tsid = psip.TableIDExtension();
     
    369385
    370386        return true;
    371387    }
    372 
     388   
     389/* FIXME: Do not hardcode transport here */
     390    if ((_desired_tsid == 601) && (CSATCARAIBES_EIT_PID1 == pid)) {
     391        switch (psip.TableID())
     392        {
     393            case TableID::CSATCARAIBES_THEMES:
     394                if (_csat_eit.HasThemes()) return true;
     395                else
     396                {
     397                    CSatCaraibesThemesTable themes(psip);
     398                    _csat_eit.AddThemes(themes);
     399                }
     400                break;
     401            case TableID::CSATCARAIBES_SCHED:
     402                if (_csat_eit.HasSeenAllSchedules()) return true;
     403                else
     404                {
     405                    CSatCaraibesScheduleTable sched(psip);
     406                    _csat_eit.AddSchedules(sched);
     407                }
     408                break;
     409            case TableID::CSATCARAIBES_SUMMARIES:
     410            {
     411                CSatCaraibesSummaryTable summary(psip);
     412                if (!(summary.IsValid())) return false;
     413                _csat_eit.AddSummary(summary);
     414                break;
     415            }
     416            default:
     417                return false;
     418        }
     419        if (_eit_helper)
     420            _eit_helper->AddEIT(&_csat_eit);
     421    }
    373422    return false;
    374423}
    375424
     
    392441    QMutexLocker locker(&_listener_lock);
    393442    bool want_eit = (_eit_rate >= 0.5f) && HasAnyEIT();
    394443    bool has_eit  = in_use_pids.size();
    395     return want_eit != has_eit;
     444
     445    return ((_desired_tsid == 601) || (want_eit != has_eit));
     446//    return want_eit != has_eit;
    396447}
    397448
    398449bool DVBStreamData::GetEITPIDChanges(const uint_vec_t &cur_pids,
     
    410463        }
    411464
    412465        if (_dvb_eit_dishnet_long &&
    413             find(cur_pids.begin(), cur_pids.end(),
    414                  (uint) DVB_DNLONG_EIT_PID) == cur_pids.end())
     466            (find(cur_pids.begin(), cur_pids.end(),
     467                  (uint) DVB_DNLONG_EIT_PID) == cur_pids.end()))
    415468        {
    416469            add_pids.push_back(DVB_DNLONG_EIT_PID);
    417470        }
    418471
     472/* FIXME: Avoid hardcoding the good transport here */
     473        if (_dvb_eit_csatcaraibes /*&& (_desired_tsid == 601)*/ &&
     474            (find(cur_pids.begin(), cur_pids.end(),
     475                  (uint) CSATCARAIBES_EIT_PID1) == cur_pids.end()))
     476        {
     477            add_pids.push_back(CSATCARAIBES_EIT_PID1);
     478//            VERBOSE(VB_EIT,"Added CSAT PID!");
     479        }
     480
    419481        if (_desired_netid == PREMIERE_ONID &&
    420482            find(cur_pids.begin(), cur_pids.end(),
    421483                 (uint) PREMIERE_EIT_DIREKT_PID) == cur_pids.end())
     
    451513            del_pids.push_back(DVB_DNLONG_EIT_PID);
    452514        }
    453515
     516        if (_dvb_eit_csatcaraibes &&
     517            (find(cur_pids.begin(), cur_pids.end(),
     518                  (uint) CSATCARAIBES_EIT_PID1) /*!=*/ ==  cur_pids.end()))
     519        {
     520            VERBOSE(VB_EIT,"Deleted CSAT PID!");
     521            add_pids.push_back(CSATCARAIBES_EIT_PID1);
     522        }
    454523        if (_desired_netid == PREMIERE_ONID &&
    455524            find(cur_pids.begin(), cur_pids.end(),
    456525                 (uint) PREMIERE_EIT_DIREKT_PID) != cur_pids.end())
  • trunk-work/mythtv/libs/libmythtv/mpeg/mpegtables.h

     
    191191    PREMIERE_EIT_DIREKT_PID = 0x0b11,
    192192    PREMIERE_EIT_SPORT_PID  = 0x0b12,
    193193
     194    // Canal Sat longterm EIT is on pid 0x114 and 0x153
     195    CSATCARAIBES_EIT_PID1 = 0x114,
     196    //    CSATCARAIBES_EIT_PID2 = 0x153,
     197
    194198    ATSC_PSIP_PID = 0x1ffb,
    195199};
    196200
     
    241245        DN_EITbego = 0x80, // always on pid 0x300
    242246        DN_EITendo = 0xfe, // always on pid 0x300
    243247
     248        // Canal Sat Caraibes Longterm EIT data                           
     249        CSATCARAIBES_CHANNELS = 0x90, // always on pid 0x114             
     250        CSATCARAIBES_SCHED = 0x92,    // always on pid 0x114             
     251        CSATCARAIBES_SUMMARIES = 0x94, //always on pid 0x114
     252        CSATCARAIBES_THEMES = 0x91,    //always on pid 0x114
     253
    244254        // ARIB
    245255        ARIBbeg  = 0x80,
    246256        ARIBend  = 0x8f,
  • trunk-work/mythtv/libs/libmythtv/mpeg/streamlisteners.h

     
    3131class DirectedChannelChangeSelectionCodeTable;
    3232
    3333class NetworkInformationTable;
     34class BouquetAssociationTable;
    3435class ServiceDescriptionTable;
    3536class TimeDateTable;
    3637class DVBEventInformationTable;
     
    143144  public:
    144145    virtual void HandleEIT(const DVBEventInformationTable*) = 0;
    145146    virtual void HandleEIT(const PremiereContentInformationTable*) = 0;
     147    virtual void HandleBAT(const BouquetAssociationTable*) = 0;
    146148};
    147149
    148150
  • trunk-work/mythtv/libs/libmythtv/mpeg/dvbdescriptors.h

     
    18121812    QString toString() const { return QString("DVBContentIdentifierDescriptor(stub)"); }
    18131813};
    18141814
     1815/* Used by Canal+ (French Sat provider) in the BAT
     1816   For Canal+: data is 4 bytes, equal to 0x000000C0
     1817*/
     1818class DVBPrivateDataSpecifierDescriptor : public MPEGDescriptor
     1819{
     1820    public:
     1821        DVBPrivateDataSpecifierDescriptor(const unsigned char * data) : MPEGDescriptor(data)
     1822        {
     1823            assert(DescriptorID::private_data_specifier == DescriptorTag());
     1824        }
     1825};
    18151826
    18161827#endif
  • trunk-work/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h

     
    113113    // Listening
    114114    virtual void AddListeningPID(
    115115        uint pid, PIDPriority priority = kPIDPriorityNormal)
    116         { _pids_listening[pid] = priority; }
     116        { _pids_listening[pid] = priority; VERBOSE(VB_RECORD,QString("Added %1 pid").arg(pid));}
    117117    virtual void AddNotListeningPID(uint pid)
    118118        { _pids_notlistening[pid] = kPIDPriorityNormal; }
    119119    virtual void AddWritingPID(
  • trunk-work/mythtv/libs/libmythtv/mpeg/csatcaraibesdescriptors.cpp

     
     1#include "mpegdescriptors.h"
     2#include "csatcaraibesdescriptors.h"
     3
     4/****************** Schedule *******************************/
     5
     6void CSatCaraibesChannelsDescriptor::Parse(void)
     7{
     8    const unsigned char * p = _data+2;
     9
     10    for (uint i = DescriptorLength();i >= 4;)
     11    {
     12        uint key = (p[0] << 8) + p[1];
     13        /* MSBit of LSByte seems to be 1 when it is a radio
     14         * and MSByte seems to be 0 always
     15         */
     16
     17        uint index = (p[2] << 8) + p[3];
     18        channels_indexes.insert(key, index);
     19        i -= 4;
     20        p += 4;
     21        VERBOSE(VB_SIPARSER,"Channel "<<key<<" index "<<index);
     22    }
     23}
  • trunk-work/mythtv/libs/libmythtv/mpeg/dvbtables.h

     
    164164    mutable vector<const unsigned char*> _ptrs; // used to parse
    165165};
    166166
     167/** \class BouquetAssociationTable
     168 *  \brief Tells what channels can be found on each transponder
     169 *  for one bouquet (a bunch of channels from one provider)
     170 *  Note: French Provider Canal+ uses this to associate channels
     171 *  with an index used in their proprietary EIT
     172 */
     173
     174class BouquetAssociationTable : public PSIPTable
     175{
     176    public:
     177        BouquetAssociationTable(const PSIPTable& table) : PSIPTable(table)
     178        {
     179            assert(TableID::BAT == TableID());
     180            Parse();
     181        }
     182        ~BouquetAssociationTable() { ; }
     183
     184        // table_id                 8   0.0       0x4a
     185        // section_syntax_indicator 1   1.0          1
     186        // reserved_future_use      1   1.1          1
     187        // reserved                 2   1.2          3
     188        // section_length          12   1.4          0
     189        // Bouquet ID              16   3.0          0
     190        // reserved                 2   5.0          3
     191        // version_number           5   5.2          0
     192        // current_next_indicator   1   5.7          1
     193        // section_number           8   6.0       0x00
     194        // last_section_number      8   7.0       0x00
     195        // reserved                 4   8         0x0d
     196        // Bouquet descriptors len 12   8.4
     197        // for (i=0;i<N;i++)
     198        // Descriptor();
     199        // reserved                4 10+N.0
     200        // Transport stream loop len 12
     201        // for (i=0;i<N;i++) {
     202        //   transport_stream_id    16
     203        //   original_network_id    16
     204        //   reserved                4
     205        //   transport descriptor len 12
     206        //   for (j=0;j<N;j++)
     207        //     Descriptor();
     208        //  }
     209        //  crc                     32
     210        uint TSID(uint i) const
     211        { return (_ptrs[i][0] << 8) + _ptrs[i][1]; }
     212
     213        /// original_network_id    16   8.0
     214        uint OriginalNetworkID(uint i) const
     215        { return (_ptrs[i][2] << 8) + _ptrs[i][3]; }
     216
     217        /* Returns a pointer to the first descriptor following
     218           the TS and Network ID, and the loop length */
     219        const unsigned char * TransportDescriptors(uint i) const
     220        { return _ptrs[i]+6; }
     221        uint TransportDescriptorsLength(uint i) const
     222        { return ((_ptrs[i][4] &0x0F)<< 8) + _ptrs[i][5]; }
     223        void Parse(void);
     224        uint NBTransports() const
     225        {
     226            return _ptrs.size();
     227        }
     228        QString BouquetName() const
     229        { return bouquet_name; }
     230
     231    private:
     232        /* point on the transport descriptors */
     233        mutable vector<const unsigned char*> _ptrs;
     234        mutable QString bouquet_name;
     235};
     236
    167237class DiscontinuityInformationTable : public PSIPTable
    168238{
    169239    DiscontinuityInformationTable(const PSIPTable& table) : PSIPTable(table)
  • trunk-work/mythtv/libs/libmythtv/mpeg/mpegdescriptors.h

     
    124124        // ATSC
    125125        atsc_stuffing               = 0x80,
    126126        audio_stream                = 0x81,
     127        /* Seems to be used also for user-defined                                 
     128           For CanalSat Caraibes this is used in
     129           the BAT to provide channel indexes */                                 
     130        csat_channels_ind           = 0x81,
    127131        caption_service             = 0x86,
    128132        content_advisory            = 0x87,
    129133
  • trunk-work/mythtv/libs/libmythtv/mpeg/mpegtables.cpp

     
    154154            {
    155155                has_crc = true;
    156156            }
     157// Canal Satellite Caraibes EIT
     158            if ((TableID() == TableID::CSATCARAIBES_THEMES) ||
     159                 (TableID() == TableID::CSATCARAIBES_SUMMARIES))
     160            {
     161                VERBOSE(VB_SIPARSER,QString("No crc for ID %1").arg(TableID()));
     162                has_crc = false;
     163            }
     164            else if (TableID() == TableID::CSATCARAIBES_SCHED)
     165            {
     166                VERBOSE(VB_SIPARSER,QString("Crc for ID %1").arg(TableID()));
     167            }
    157168        }
    158169        break;
    159170    }
  • trunk-work/mythtv/libs/libmythtv/mpeg/pespacket.h

     
    183183    /// 1 bit  Additional Copy Info field is present
    184184    bool HasACI()             const { return (_pesdata[4] & 0x4) >> 2; }
    185185    /// 1 bit  Cyclic Redundancy Check present
    186     virtual bool HasCRC()     const { return (_pesdata[4] & 0x2) >> 1; }
     186    virtual bool HasCRC()     const;
    187187    /// 1 bit  Extension flags are present
    188188    bool HasExtensionFlags()  const { return _pesdata[4] & 0x1; }
    189189
  • trunk-work/mythtv/libs/libmythtv/mpeg/csatcaraibestables.h

     
     1// -*- Mode: c++ -*-
     2#ifndef _CSATCARAIBES_TABLES_H_
     3#define _CSATCARAIBES_TABLES_H_
     4
     5#include <qstring.h>
     6#include <stdint.h>  // uint32_t
     7#include "mpegtables.h"
     8#include "dvbtables.h"
     9
     10class CSatCaraibesScheduleTable : public PSIPTable
     11{
     12    public:
     13        CSatCaraibesScheduleTable(const PSIPTable& table) : PSIPTable(table)
     14        {
     15            Parse();
     16        }
     17
     18        void Parse();
     19        bool IsValid() {
     20            return TableID()==TableID::CSATCARAIBES_SCHED;
     21        }
     22        /* Returns a pointer on the Title: first byte is length, following
     23           bytes are the string itself */
     24        const unsigned char * GetTitle(uint i) const
     25        {
     26            return _ptrs[i];
     27        }
     28        bool ScheduleHasSummary(uint i) const
     29        {
     30            const unsigned char * p = AfterTitle(i);
     31            return (*p & 0x80) >> 7;
     32        }
     33        uint GetNbShowings(uint i) const
     34        {
     35            const unsigned char * p = AfterTitle(i);
     36            return (*p & 0x70) >> 4;
     37        }
     38        const unsigned char * GetShowings(uint i) const
     39        {
     40            return AfterTitle(i) + 3;
     41        }
     42        uint GetDuration(uint i) const
     43        {
     44            const unsigned char * p = AfterTitle(i);
     45            return ( (p[0] & 0x0F)*256 + p[1] ) * 60;
     46        }
     47        uint GetTheme(uint i) const
     48        {
     49            const unsigned char * p = AfterTitle(i);
     50            return (p[2] & 0xF0) >> 4;
     51        }
     52        uint GetKey(uint i) const
     53        {
     54            return Section() << 12 + (_ptrs[i]-pesdata());
     55        }
     56        uint NbSchedules() const
     57        {
     58            return _ptrs.size();
     59        }
     60        /* Numbered from 0 */
     61        const unsigned char * GetSchedule(uint i) const
     62        {
     63            return _ptrs[i];
     64        }
     65 
     66    private:
     67        const unsigned char * AfterTitle(uint i) const
     68        {
     69            return _ptrs[i] + _ptrs[i][0] + 1;
     70        }
     71 
     72        mutable vector<const unsigned char *> _ptrs;
     73};
     74
     75class CSatCaraibesSummaryTable : public PSIPTable
     76{
     77    public:
     78        CSatCaraibesSummaryTable(const PSIPTable & table) : PSIPTable(table)
     79        {
     80        }
     81
     82        bool IsValid() {
     83            return TableID()==TableID::CSATCARAIBES_SUMMARIES;
     84        }
     85        uint TitleKey() const;
     86        uint GetLength() const
     87        {
     88            return pesdata()[11]-6;
     89        }
     90        const char * SummaryString(void) const
     91        {
     92            return (const char*)(pesdata()+18);
     93        }
     94        bool DotsToAppend(void) const
     95        {
     96            return pesdata()[12 + GetLength() - 1] == 0x85;
     97        }
     98};
     99
     100class CSatCaraibesThemesTable : public PSIPTable
     101{
     102    public:
     103        CSatCaraibesThemesTable(const PSIPTable & table) : PSIPTable(table)
     104        {
     105            Parse();
     106        }
     107       
     108        void Parse(void);
     109        uint NbThemes(void) const
     110        {
     111            return _ptrs.size();
     112        }
     113        const char * GetTheme(uint i) const
     114        {
     115            return _ptrs[i];
     116        }
     117        /* Can be zero, just discard this theme */
     118        uint GetThemeLength(uint i) const;
     119    private:
     120        mutable vector<const char *> _ptrs;
     121};
     122
     123#endif // _CSATCARAIBES_TABLES_H_
  • trunk-work/mythtv/libs/libmythtv/mpeg/dvbstreamdata.h

     
    44#define DVBSTREAMDATA_H_
    55
    66#include "mpegstreamdata.h"
     7#include "csatcaraibeseit.h"
    78
     9
    810typedef NetworkInformationTable* nit_ptr_t;
    911typedef vector<const NetworkInformationTable*>  nit_vec_t;
    1012typedef QMap<uint, nit_ptr_t>    nit_cache_t; // section->sdts
     
    195197    bool                      _dvb_eit_dishnet_long;
    196198    /// Tell us if the DVB service has EIT
    197199    dvb_has_eit_t             _dvb_has_eit;
     200    /// true means use the proprietary eit from
     201    /// French provider Canal Satellite Caraibes
     202    bool                      _dvb_eit_csatcaraibes;
    198203
    199204    // Signals
    200205    dvb_main_listener_vec_t   _dvb_main_listeners;
     
    211216    // Premiere private ContentInformationTable
    212217    QMap<uint, int>           _cit_version;
    213218    sections_map_t            _cit_section_seen;
    214 
     219    /// Canal Satellite (French provider)
     220    CSatCaraibesEIT           _csat_eit;
    215221    int                       _nito_version;
    216222    QMap<uint, int>           _sdto_versions;
    217223    sections_t                _nito_section_seen;
  • trunk-work/mythtv/libs/libmythtv/dvbstreamhandler.cpp

     
    483483    QMap<PIDPriority, pid_list_t> priority_queue;
    484484    QMap<PIDPriority, uint> priority_open_cnt;
    485485
     486    VERBOSE(VB_RECORD,"Cycling filters");
    486487    PIDInfoMap::const_iterator cit = _pid_info.begin();
    487488    for (; cit != _pid_info.end(); ++cit)
    488489    {
     
    890891                // NOTE: In theory this will break with ATSC when pid 0x11
    891892                //       is used for random ATSC tables. In practice only
    892893                //       video data has been seen on 0x11.
    893                 sctFilterParams.filter.filter[0] = 0x02;
    894                 sctFilterParams.filter.mask[0]   = 0xbb;
     894                // Changed to get BAT (CSAT CARAIBES): 0x4A
     895                sctFilterParams.filter.filter[0] = 0x00/*0x02*/;
     896                sctFilterParams.filter.mask[0]   = 0x00/*0xb3*/;
    895897                break;
    896898            case 0x1ffb: // assume this is for various ATSC tables
    897899                // MGT 0xC7, Terrestrial VCT 0xC8, Cable VCT 0xC9, RRT 0xCA,
  • trunk-work/mythtv/libs/libmythtv/dtvsignalmonitor.h

     
    100100    void HandleTDT(const TimeDateTable*);
    101101    void HandleNIT(const NetworkInformationTable*);
    102102    void HandleSDT(uint, const ServiceDescriptionTable*);
     103    void HandleBAT(const BouquetAssociationTable*);
    103104
    104105    void IgnoreEncrypted(bool ignore) { ignore_encrypted = ignore; }
    105106
  • trunk-work/mythtv/libs/libmythtv/dtvsignalmonitor.cpp

     
    469469        AddFlags(kDTVSigMon_CryptMatch);
    470470}
    471471
     472void DTVSignalMonitor::HandleBAT(const BouquetAssociationTable * bat)
     473{
     474    VERBOSE(VB_SIPARSER,"BAT detected");
     475 
     476}
     477
    472478ATSCStreamData *DTVSignalMonitor::GetATSCStreamData()
    473479{
    474480    return dynamic_cast<ATSCStreamData*>(stream_data);