Ticket #1155: dvb-multiple-eit2.diff

File dvb-multiple-eit2.diff, 6.6 KB (added by anonymous, 18 years ago)
  • libs/libmythtv/dvbchannel.cpp

     
    136136    channelnames.clear();
    137137    inputChannel.clear();
    138138    inputTuneTo.clear();
     139    sourceid.clear();
    139140   
    140141    MSqlQuery query(MSqlQuery::InitCon());
    141142    query.prepare(
    142143        "SELECT cardinputid, inputname, "
    143144        "       if (tunechan='', 'Undefined', tunechan), "
    144         "       if (startchan, startchan, '') "
     145        "       if (startchan, startchan, ''), "
     146        "       sourceid "
    145147        "FROM cardinput "
    146148        "WHERE cardid = :CARDID");
    147149    query.bindValue(":CARDID", GetCardID());
     
    166168        channelnames[inputNum]    = query.value(1).toString();
    167169        inputTuneTo[inputNum]     = query.value(2).toString();
    168170        inputChannel[inputNum]    = query.value(3).toString();
     171        sourceid[inputNum]        = query.value(4).toString();
    169172    }
    170173
    171174    // print em
  • libs/libmythtv/eithelper.cpp

     
    6262/** \fn EITHelper::ProcessEvents(int)
    6363 *  \brief Inserts events in EIT list.
    6464 *
    65  *  NOTE: This currently takes a mplexid key for the dtv_multiplex table,
    66  *        but it should just take a sourceid key for the channel table.
    67  *
    6865 *  \param mplexid multiplex we are inserting events for.
    6966 *  \return Returns number of events inserted into DB.
    7067 */
    71 uint EITHelper::ProcessEvents(int mplexid)
     68uint EITHelper::ProcessEvents(int srcid)
    7269{
    7370    QMutexLocker locker(&eitList_lock);
    7471
     
    8279        eitList.pop_front();
    8380
    8481        eitList_lock.unlock();
    85         insertCount += UpdateEITList(mplexid, *events);
     82        insertCount += UpdateEITList(srcid, *events);
    8683        QList_Events::iterator it = events->begin();
    8784        for (; it != events->end(); ++it)
    8885            delete *it;
     
    10097        events->erase(events->begin(), subset_end);
    10198       
    10299        eitList_lock.unlock();
    103         insertCount += UpdateEITList(mplexid, subset);
     100        insertCount += UpdateEITList(srcid, subset);
    104101        QList_Events::iterator it = subset.begin();
    105102        for (; it != subset.end(); ++it)
    106103            delete *it;
     
    115112    return insertCount;
    116113}
    117114
    118 int EITHelper::GetChanID(int mplexid, const Event &event) const
     115int EITHelper::GetChanID(int srcid, const Event &event) const
    119116{
    120117    unsigned long long srv = event.ServiceID;
    121     srv |= ((unsigned long long) event.TransportID) << 32;
    122     srv |= (event.ATSC) ? (mplexid << 16) : (event.NetworkID << 16);
     118    srv |= ((unsigned long long) event.TransportID) << 48;
     119    srv |= srcid << 32;
     120    srv |= event.NetworkID << 16;
    123121
    124122    int chanid = srv_to_chanid[srv];
    125123    if (chanid == 0)
    126         srv_to_chanid[srv] = chanid = get_chan_id_from_db(mplexid, event);
     124        srv_to_chanid[srv] = chanid = get_chan_id_from_db(srcid, event);
    127125    return chanid;
    128126}
    129127
    130 uint EITHelper::UpdateEITList(int mplexid, const QList_Events &events)
     128uint EITHelper::UpdateEITList(int srcid, const QList_Events &events)
    131129{
    132130    MSqlQuery query1(MSqlQuery::InitCon());
    133131    MSqlQuery query2(MSqlQuery::InitCon());
     
    137135
    138136    QList_Events::const_iterator e = events.begin();
    139137    for (; e != events.end(); ++e)
    140         if ((chanid = GetChanID(mplexid, **e)) > 0)
     138        if ((chanid = GetChanID(srcid, **e)) > 0)
    141139            counter += update_eit_in_db(query1, query2, chanid, **e);
    142140
    143141    return counter;
    144142}
    145143
    146 static int get_chan_id_from_db(int mplexid, const Event &event)
     144static int get_chan_id_from_db(int srcid, const Event &event)
    147145{
    148146    MSqlQuery query(MSqlQuery::InitCon());
    149147    // Now figure out the chanid for this
     
    153151    if (event.ATSC)
    154152    {
    155153        query.prepare(QString("SELECT chanid, useonairguide FROM channel "
    156                               "WHERE atscsrcid = %1 AND mplexid = %2")
     154                              "WHERE atscsrcid = %1 AND sourceid = %2")
    157155                      .arg(event.ServiceID)
    158                       .arg(mplexid));
     156                      .arg(srcid));
    159157    }
    160158    else
    161159    {
     
    165163                              "WHERE serviceid = %1 AND "
    166164                              "      networkid = %2 AND "
    167165                              "      transportid = %3 AND "
     166                              "      channel.sourceid = %4 AND "
    168167                              "      channel.mplexid = dtv_multiplex.mplexid")
    169168                      .arg(event.ServiceID)
    170169                      .arg(event.NetworkID)
    171                       .arg(event.TransportID));
     170                      .arg(event.TransportID)
     171                      .arg(srcid));
    172172    }
    173173
    174174    if (!query.exec() || !query.isActive())
     
    177177    if (query.size() <= 0)
    178178    {
    179179        VERBOSE(VB_EIT, QString(
    180                     "EITHelper: chanid not found for atscsrcid = %1 "
    181                     "and mplexid = %2, \n\t\t\tso event updates were skipped.")
    182             .arg(event.ServiceID).arg(mplexid));
     180                    "EITHelper: chanid not found for service %1 "
     181                    "on source %2, \n\t\t\tso event updates were skipped.")
     182            .arg(event.ServiceID).arg(srcid));
    183183        return -1;
    184184    }
    185185
  • libs/libmythtv/eitscanner.cpp

     
    9191    {
    9292        if (channel)
    9393        {
    94             int mplex = channel->GetMultiplexID();
    95             if ((mplex > 0) && parser && eitHelper->GetListSize())
     94            int srcid = channel->GetCurrentSourceID();
     95            if ((srcid > 0) && parser && eitHelper->GetListSize())
    9696            {
    97                 eitCount += eitHelper->ProcessEvents(mplex);
     97                eitCount += eitHelper->ProcessEvents(srcid);
    9898                t.start();
    9999            }
    100100        }
  • libs/libmythtv/channelbase.h

     
    6060        { return currentcapchannel; }
    6161    virtual QString GetCurrentInput(void) const
    6262        { return channelnames[GetCurrentInputNum()]; }
     63    virtual int GetCurrentSourceID(void) const
     64        { return sourceid[GetCurrentInputNum()].toInt(); }
    6365    virtual QString GetOrdering(void) const
    6466        { return channelorder; }
    6567    /// \brief Returns true iff commercial detection is not required