Ticket #10003: mheg.tuning.patch

File mheg.tuning.patch, 8.1 KB (added by David Matthews <dm@…>, 8 years ago)
  • mythtv/libs/libmythtv/interactivetv.cpp

    commit 3a4b9c5d76cfc42ab45170a96ce4f4192a2a9758
    Author: David Matthews <dm@prolingua.co.uk>
    Date:   Sat Aug 13 16:02:32 2011 +0100
    
        Fix problem with MHEG in recordings.
        
        Now uses the sourceid rather than cardid when looking up channel
        entries.  If the look-up does not work properly BBC recordings may
        pop up periodic messages about service errors.
    
    diff --git a/mythtv/libs/libmythtv/interactivetv.cpp b/mythtv/libs/libmythtv/interactivetv.cpp
    index d7a48a8..2cdbea0 100644
    a b InteractiveTV::~InteractiveTV() 
    3333}
    3434
    3535// Start or restart the MHEG engine.
    36 void InteractiveTV::Restart(uint chanid, uint cardid, bool isLive)
     36void InteractiveTV::Restart(uint chanid, uint sourceid, bool isLive)
    3737{
    38     m_context->Restart(chanid, cardid, isLive);
     38    m_context->Restart(chanid, sourceid, isLive);
    3939}
    4040
    4141// Called by the video player to see if the image needs to be updated
  • mythtv/libs/libmythtv/interactivetv.h

    diff --git a/mythtv/libs/libmythtv/interactivetv.h b/mythtv/libs/libmythtv/interactivetv.h
    index 0739390..c8e00e6 100644
    a b class InteractiveTV 
    1717    InteractiveTV(MythPlayer *nvp);
    1818    virtual ~InteractiveTV();
    1919
    20     void Restart(uint chanid, uint cardid, bool isLive);
     20    void Restart(uint chanid, uint sourceid, bool isLive);
    2121    // Process an incoming DSMCC packet.
    2222    void ProcessDSMCCSection(unsigned char *data, int length,
    2323                             int componentTag, unsigned carouselId,
  • mythtv/libs/libmythtv/mhi.cpp

    diff --git a/mythtv/libs/libmythtv/mhi.cpp b/mythtv/libs/libmythtv/mhi.cpp
    index f4777c7..1631495 100644
    a b MHIContext::MHIContext(InteractiveTV *parent) 
    5656      m_updated(false),
    5757      m_displayWidth(StdDisplayWidth), m_displayHeight(StdDisplayHeight),
    5858      m_face_loaded(false), m_engineThread(NULL), m_currentChannel(-1),
    59       m_currentStream(-1),  m_isLive(false),      m_currentCard(0),
     59      m_currentStream(-1),  m_isLive(false),      m_currentSource(-1),
    6060      m_audioTag(-1),       m_videoTag(-1),
    6161      m_lastNbiVersion(NBI_VERSION_UNSET),
    6262      m_videoRect(0, 0, StdDisplayWidth, StdDisplayHeight),
    void MHIContext::StopEngine(void) 
    156156
    157157
    158158// Start or restart the MHEG engine.
    159 void MHIContext::Restart(uint chanid, uint cardid, bool isLive)
     159void MHIContext::Restart(uint chanid, uint sourceid, bool isLive)
    160160{
    161161    int tuneinfo = m_tuneinfo.isEmpty() ? 0 : m_tuneinfo.takeFirst();
    162162
    163     LOG(VB_MHEG, LOG_INFO, QString("[mhi] Restart ch=%1 card=%2 live=%3 tuneinfo=0x%4")
    164         .arg((int)chanid).arg((int)cardid).arg(isLive).arg(tuneinfo,0,16));
     163    LOG(VB_MHEG, LOG_INFO, QString("[mhi] Restart ch=%1 source=%2 live=%3 tuneinfo=0x%4")
     164        .arg((int)chanid).arg((int)sourceid).arg(isLive).arg(tuneinfo,0,16));
    165165
    166     m_currentCard = cardid;
     166    m_currentSource = sourceid;
    167167    m_currentStream = (chanid) ? (int)chanid : -1;
    168168    if (!(tuneinfo & kTuneKeepChnl))
    169169        m_currentChannel = m_currentStream;
    int MHIContext::GetChannelIndex(const QString &str) 
    650650        int serviceID = list[2].toInt(&ok, 16);
    651651        if (!ok)
    652652            break;
    653         // We only return channels that match the current capture card.
     653        // We only return channels that match the current capture source.
    654654        if (list[1].isEmpty()) // TransportID is not specified
    655655        {
    656656            query.prepare(
    657657                "SELECT chanid "
    658                 "FROM channel, dtv_multiplex, cardinput, capturecard "
     658                "FROM channel, dtv_multiplex "
    659659                "WHERE networkid        = :NETID AND"
    660660                "      channel.mplexid  = dtv_multiplex.mplexid AND "
    661661                "      serviceid        = :SERVICEID AND "
    662                 "      channel.sourceid = cardinput.sourceid AND "
    663                 "      cardinput.cardid = capturecard.cardid AND "
    664                 "      cardinput.cardid = :CARDID");
     662                "      channel.sourceid = :SOURCEID");
    665663        }
    666664        else
    667665        {
    int MHIContext::GetChannelIndex(const QString &str) 
    670668                break;
    671669            query.prepare(
    672670                "SELECT chanid "
    673                 "FROM channel, dtv_multiplex, cardinput, capturecard "
     671                "FROM channel, dtv_multiplex "
    674672                "WHERE networkid        = :NETID AND"
    675673                "      channel.mplexid  = dtv_multiplex.mplexid AND "
    676674                "      serviceid        = :SERVICEID AND "
    677675                "      transportid      = :TRANSID AND "
    678                 "      channel.sourceid = cardinput.sourceid AND "
    679                 "      cardinput.cardid = capturecard.cardid AND "
    680                 "      cardinput.cardid = :CARDID");
     676                "      channel.sourceid = :SOURCEID");
    681677            query.bindValue(":TRANSID", transportID);
    682678        }
    683679        query.bindValue(":NETID", netID);
    684680        query.bindValue(":SERVICEID", serviceID);
    685         query.bindValue(":CARDID", m_currentCard);
     681        query.bindValue(":SOURCEID", m_currentSource);
    686682        if (query.exec() && query.isActive() && query.next())
    687683            nResult = query.value(0).toInt();
    688684    }
    int MHIContext::GetChannelIndex(const QString &str) 
    695691            break;
    696692        MSqlQuery query(MSqlQuery::InitCon());
    697693        query.prepare("SELECT chanid "
    698                       "FROM channel, cardinput, capturecard "
     694                      "FROM channel "
    699695                      "WHERE channum = :CHAN AND "
    700                       "      channel.sourceid = cardinput.sourceid AND "
    701                       "      cardinput.cardid = capturecard.cardid AND "
    702                       "      cardinput.cardid = :CARDID");
     696                      "      channel.sourceid = :SOURCEID");
    703697        query.bindValue(":CHAN", channelNo);
    704         query.bindValue(":CARDID", m_currentCard);
     698        query.bindValue(":SOURCEID", m_currentSource);
    705699        if (query.exec() && query.isActive() && query.next())
    706700            nResult = query.value(0).toInt();
    707701    }
  • mythtv/libs/libmythtv/mhi.h

    diff --git a/mythtv/libs/libmythtv/mhi.h b/mythtv/libs/libmythtv/mhi.h
    index 0071c4c..2b10c8b 100644
    a b class MHIContext : public MHContext, public QRunnable 
    5050    // A NetworkBootInfo sub-descriptor is present in the PMT.
    5151    void SetNetBootInfo(const unsigned char *data, uint length);
    5252    /// Restart the MHEG engine.
    53     void Restart(uint chanid, uint cardid, bool isLive);
     53    void Restart(uint chanid, uint sourceid, bool isLive);
    5454    // Offer a key press.  Returns true if it accepts it.
    5555    // This will depend on the current profile.
    5656    bool OfferKey(QString key);
    class MHIContext : public MHContext, public QRunnable 
    176176    int              m_currentChannel;
    177177    int              m_currentStream;
    178178    bool             m_isLive;
    179     int              m_currentCard;
     179    int              m_currentSource;
    180180
    181181    int              m_audioTag;
    182182    int              m_videoTag;
  • mythtv/libs/libmythtv/tv_play.cpp

    diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
    index 623a6a8..7ab94da 100644
    a b void TV::UnpauseLiveTV(PlayerContext *ctx, bool bQuietly /*=false*/) 
    1132611326 */
    1132711327void TV::ITVRestart(PlayerContext *ctx, bool isLive)
    1132811328{
    11329     uint chanid = 0;
    11330     uint cardid = 0;
     11329    uint chanid = -1;
     11330    uint sourceid = -1;
    1133111331
    1133211332    if (ContextIsPaused(ctx, __FILE__, __LINE__))
    1133311333        return;
    1133411334
    1133511335    ctx->LockPlayingInfo(__FILE__, __LINE__);
    1133611336    if (ctx->playingInfo)
     11337    {
    1133711338        chanid = ctx->playingInfo->GetChanID();
     11339        sourceid = ChannelUtil::GetSourceIDForChannel(chanid);
     11340    }
    1133811341    ctx->UnlockPlayingInfo(__FILE__, __LINE__);
    1133911342
    11340     cardid = ctx->GetCardID();
    11341 
    1134211343    ctx->LockDeletePlayer(__FILE__, __LINE__);
    1134311344    if (ctx->player)
    11344         ctx->player->ITVRestart(chanid, cardid, isLive);
     11345        ctx->player->ITVRestart(chanid, sourceid, isLive);
    1134511346    ctx->UnlockDeletePlayer(__FILE__, __LINE__);
    1134611347}
    1134711348