Ticket #3162: nzmheg.patch

File nzmheg.patch, 9.7 KB (added by dm@…, 17 years ago)

Slightly modified version of patch

  • keys.txt

     
    7575- F7          Toggle Background on/off
    7676- F8          Reveal hidden text.
    7777
    78 When in MHEG ITV Menu mode:
     78When MHEG ITV is enabled:
    7979- F2-F5       Menu Red, Green, Yellow, or Blue, respectively
    80 - F6          Exit ITV Menu
    81 - F7          Toggle Menu Text
     80- F6          Exit key, exits from interactive mode on some channels
     81- F7          Text key, enters interactive mode on some channels
     82- F12         EPG key, enters EPG mode (New Zealand only).
     83  The effect of these keys depends on what is being displayed.  The arrow,
     84  Enter, and 0-9 keys may also be used.
    8285
    8386Without the stickykeys option selected:
    8487
  • libs/libmythtv/tv_play.cpp

     
    417417    REG_KEY("ITV Menu", "MENUBLUE",   "Menu Blue",   "F5");
    418418    REG_KEY("ITV Menu", "TEXTEXIT",   "Menu Exit",   "F6");
    419419    REG_KEY("ITV Menu", "MENUTEXT",   "Menu Text",   "F7");
     420    REG_KEY("ITV Menu", "MENUEPG",    "Menu EPG",    "F12");
    420421/*
    421422  keys already used:
    422423
     
    441442  Global:   F1,
    442443  Playback:                   F7,F8,F9,F10,F11
    443444  Teletext     F2,F3,F4,F5,F6,F7,F8
    444   ITV          F2,F3,F4,F5,F6,F7
     445  ITV          F2,F3,F4,F5,F6,F7,F12
    445446
    446447  Playback: Ctrl-B,Ctrl-G
    447448*/
  • libs/libmythtv/mhi.h

     
    101101    void DrawImage(int x, int y, const QRect &rect, const QImage &image);
    102102
    103103    virtual int GetChannelIndex(const QString &str);
     104    /// Get netId etc from the channel index.
     105    virtual bool GetServiceInfo(int channelId, int &netId, int &origNetId,
     106                                int &transportId, int &serviceId);
    104107    virtual bool TuneTo(int channel);
    105108
    106109    /// Begin playing audio from the specified stream
  • libs/libmythtv/mhi.cpp

     
    327327    int action = 0;
    328328    QMutexLocker locker(&m_keyLock);
    329329
     330    // This supports the UK and NZ key profile registers.
     331    // The UK uses 3, 4 and 5 and NZ 13, 14 and 15.  These are
     332    // similar but the NZ profile also provides an EPG key.
     333
    330334    if (key == "UP")
    331335    {
    332         if (m_keyProfile == 4 || m_keyProfile == 5)
     336        if (m_keyProfile == 4 || m_keyProfile == 5 ||
     337            m_keyProfile == 14 || m_keyProfile == 15)
    333338            action = 1;
    334339    }
    335340    else if (key == "DOWN")
    336341    {
    337         if (m_keyProfile == 4 || m_keyProfile == 5)
     342        if (m_keyProfile == 4 || m_keyProfile == 5 ||
     343            m_keyProfile == 14 || m_keyProfile == 15)
    338344            action = 2;
    339345    }
    340346    else if (key == "LEFT")
    341347    {
    342         if (m_keyProfile == 4 || m_keyProfile == 5)
     348        if (m_keyProfile == 4 || m_keyProfile == 5 ||
     349            m_keyProfile == 14 || m_keyProfile == 15)
    343350            action = 3;
    344351    }
    345352    else if (key == "RIGHT")
    346353    {
    347         if (m_keyProfile == 4 || m_keyProfile == 5)
     354        if (m_keyProfile == 4 || m_keyProfile == 5 ||
     355            m_keyProfile == 14 || m_keyProfile == 15)
    348356            action = 4;
    349357    }
    350358    else if (key == "0" || key == "1" || key == "2" ||
     
    352360             key == "6" || key == "7" || key == "8" ||
    353361             key == "9")
    354362    {
    355         if (m_keyProfile == 4)
     363        if (m_keyProfile == 4 || m_keyProfile == 14)
    356364            action = key.toInt() + 5;
    357365    }
    358366    else if (key == "SELECT")
    359367    {
    360         if (m_keyProfile == 4 || m_keyProfile == 5)
     368        if (m_keyProfile == 4 || m_keyProfile == 5 ||
     369            m_keyProfile == 14 || m_keyProfile == 15)
    361370            action = 15;
    362371    }
    363372    else if (key == "TEXTEXIT")
     
    371380    else if (key == "MENUBLUE")
    372381        action = 103;
    373382    else if (key == "MENUTEXT")
    374         action = 104;
     383        action = m_keyProfile > 12 ? 105 : 104;
     384    else if (key == "MENUEPG")
     385        action = m_keyProfile > 12 ? 300 : 0;
    375386
    376387    if (action != 0)
    377388    {
     
    573584        if (query.exec() && query.isActive() && query.next())
    574585            return query.value(0).toInt();
    575586    }
    576     else if (str == "rec://svc/cur")
     587    else if (str == "rec://svc/cur" || str == "rec://svc/def")
    577588        return m_currentChannel;
    578589    else if (str.startsWith("rec://"))
    579590    {
     
    581592    return -1;
    582593}
    583594
     595// Get netId etc from the channel index.  This is the inverse of GetChannelIndex.
     596bool MHIContext::GetServiceInfo(int channelId, int &netId, int &origNetId,
     597                                int &transportId, int &serviceId)
     598{
     599    MSqlQuery query(MSqlQuery::InitCon());
     600    query.prepare("SELECT networkid, transportid, serviceid "
     601                  "FROM channel, dtv_multiplex "
     602                  "WHERE chanid           = :CHANID AND "
     603                  "      channel.mplexid  = dtv_multiplex.mplexid");
     604    query.bindValue(":CHANID", channelId);
     605    if (query.exec() && query.isActive() && query.next())
     606    {
     607        netId = query.value(0).toInt();
     608        origNetId = netId; // We don't have this in the database.
     609        transportId = query.value(1).toInt();
     610        serviceId = query.value(2).toInt();
     611        return true;
     612    }
     613    else return false;
     614}
     615
    584616bool MHIContext::TuneTo(int channel)
    585617{
    586618    if (!m_isLive)
  • libs/libmythfreemheg/freemheg.h

     
    116116
    117117    // Tuning.  Get the index corresponding to a given channel.
    118118    virtual int GetChannelIndex(const QString &str) = 0;
     119    // Get netId etc from the channel index.
     120    virtual bool GetServiceInfo(int channelId, int &netId, int &origNetId,
     121                                int &transportId, int &serviceId) = 0;
    119122    // Tune to an index returned by GetChannelIndex
    120123    virtual bool TuneTo(int channel) = 0;
    121124
  • libs/libmythfreemheg/Programs.cpp

     
    389389            // Indicates whether to perform a subsequent TIn quietly or normally.
    390390            MHERROR("SI_TuneIndexInfo ResidentProgram is not implemented");
    391391        }
     392
    392393        else if (m_Name.Equal("BSI")) { // SI_GetBasicSI
    393394            // Returns basic SI information about the service indicated by an index
    394395            // returned by GSI.
    395396            // Returns networkID, origNetworkID, transportStreamID, serviceID
    396             MHERROR("SI_GetBasicSI ResidentProgram is not implemented");
     397            if (args.Size() == 5) {
     398                int channelId = GetInt(args.GetAt(0), engine);
     399                int netId, origNetId, transportId, serviceId;
     400                // Look the information up in the database.
     401                bool res = engine->GetContext()->GetServiceInfo(channelId, netId, origNetId,
     402                                transportId, serviceId);
     403                if (res)
     404                {
     405                    engine->FindObject(*(args.GetAt(1)->GetReference()))->SetVariableValue(netId);
     406                    engine->FindObject(*(args.GetAt(2)->GetReference()))->SetVariableValue(origNetId);
     407                    engine->FindObject(*(args.GetAt(3)->GetReference()))->SetVariableValue(transportId);
     408                    engine->FindObject(*(args.GetAt(4)->GetReference()))->SetVariableValue(serviceId);
     409                }
     410                SetSuccessFlag(success, res, engine);
     411            }
     412            else SetSuccessFlag(success, false, engine);
    397413        }
     414
    398415        else if (m_Name.Equal("GBI")) { // GetBootInfo
    399416            // Gets the NB_info field.
    400417            MHERROR("GetBootInfo ResidentProgram is not implemented");
    401418        }
     419
    402420        else if (m_Name.Equal("CCR")) { // CheckContentRef
    403421            // Sees if an item with a particular content reference is available
    404             // in the carousel.
    405             MHERROR("CheckContentRef ResidentProgram is not implemented");
     422            // in the carousel.  This looks like it should block until the file
     423            // is available.  The profile recommends that this should be forked
     424            // rather than called.
     425            if (args.Size() == 3) {
     426                MHUnion un;
     427                un.GetValueFrom(*(args.GetAt(0)), engine);
     428                un.CheckType(MHUnion::U_ContentRef);
     429                MHContentRef fileName;
     430                fileName.Copy(un.m_ContentRefVal);
     431                QString csPath = engine->GetPathName(fileName.m_ContentRef);
     432                bool result = false;
     433                QByteArray text;
     434                // Try to load the object.
     435                if (! csPath.isEmpty())
     436                    result = engine->GetContext()->GetCarouselData(csPath, text);
     437                // Set the result variable.
     438                MHParameter *pResFlag = args.GetAt(1);
     439                engine->FindObject(*(pResFlag->GetReference()))->SetVariableValue(result);
     440                MHParameter *pResCR = args.GetAt(2);
     441                // Copy the file name to the resulting content ref.
     442                engine->FindObject(*(pResCR->GetReference()))->SetVariableValue(fileName);
     443                SetSuccessFlag(success, true, engine);
     444            }
     445            else SetSuccessFlag(success, false, engine);
    406446        }
     447
    407448        else if (m_Name.Equal("CGR")) { // CheckGroupIDRef
    408449            // Sees if an application or scene with a particular group id
    409450            // is available in the carousel.