Ticket #7701: 0005-Teach-DTVMultiplex-and-the-channels.conf-importer-ab.patch

File 0005-Teach-DTVMultiplex-and-the-channels.conf-importer-ab.patch, 6.2 KB (added by dekarl@…, 11 years ago)

patch written to file format description (untested)

  • mythtv/libs/libmythtv/dtvconfparser.cpp

    From b0fd1bbb179ed48c35a6ac5845ee144a3bc3291d Mon Sep 17 00:00:00 2001
    From: Karl Dietz <dekarl@users.sourceforge.net>
    Date: Wed, 11 Jan 2012 20:13:01 +0100
    Subject: [PATCH 5/5] Teach DTVMultiplex and the channels.conf importer about ONID, TID
    
    ChannelUtils knows the original_network_id and transport_id, but DTVMultiplex
    ignored them completely...
    Also import symbol rate for DVB-C/S while here.
    ---
     mythtv/libs/libmythtv/dtvconfparser.cpp |   19 ++++++++++++++-----
     mythtv/libs/libmythtv/dtvmultiplex.cpp  |   19 +++++++++++++++----
     mythtv/libs/libmythtv/dtvmultiplex.h    |    4 +++-
     3 files changed, 32 insertions(+), 10 deletions(-)
    
    diff --git a/mythtv/libs/libmythtv/dtvconfparser.cpp b/mythtv/libs/libmythtv/dtvconfparser.cpp
    index e4bc862..b4229a5 100644
    a b DTVConfParser::return_t DTVConfParser::Parse(void) 
    108108
    109109        str = list[3];
    110110
    111         if ((str == "T") || (str == "C") || (str == "S"))
     111        # http://linuxtv.org/vdrwiki/index.php/Syntax_of_channels.conf
     112        # e.g. C, T, S19.2E
     113        if ((str == "T") || (str == "C") || (str[0] == 'S'))
    112114        {
    113115            if ((type == OFDM) && (str == "T"))
    114116                ok &= ParseVDR(list, channelNo);
    115             else if ((type == QPSK || type == DVBS2) && (str == "S"))
     117            else if ((type == QPSK || type == DVBS2) && (str[0] == 'S'))
    116118                ok &= ParseVDR(list, channelNo);
    117119            else if ((type == QAM) && (str == "C"))
    118120                ok &= ParseVDR(list, channelNo);
    bool DTVConfParser::ParseVDR(const QStringList &tokens, int channelNo) 
    286288        }
    287289    }
    288290
    289     for (uint i = 0; i < 6; i++)
    290         PARSE_SKIP(unknown);
    291 
     291    // http://linuxtv.org/vdrwiki/index.php/Syntax_of_channels.conf
     292    PARSE_SKIP(unknown); // source: C, S19.2, T
     293    PARSE_UINT_1000(mux.symbolrate); // symbol rate / 1000
     294    PARSE_SKIP(unknown); // video pid
     295    PARSE_SKIP(unknown); // audio pid
     296    PARSE_SKIP(unknown); // teletext pid
     297    PARSE_SKIP(unknown); // conditional access
    292298    PARSE_UINT(chan.serviceid);
     299    PARSE_UINT(mux.original_network_id);
     300    PARSE_UINT(mux.transport_id);
     301    PARSE_SKIP(unknown); // radio_id <- VDR custom to make onid/tid/sid unique
    293302
    294303    AddChannel(mux, chan);
    295304
  • mythtv/libs/libmythtv/dtvmultiplex.cpp

    diff --git a/mythtv/libs/libmythtv/dtvmultiplex.cpp b/mythtv/libs/libmythtv/dtvmultiplex.cpp
    index 35b4666..7d1ba5f 100644
    a b DTVMultiplex::DTVMultiplex(const DTVMultiplex &other) : 
    2222    mod_sys(other.mod_sys),
    2323    rolloff(other.rolloff),
    2424    mplex(other.mplex),
    25     sistandard(other.sistandard)
     25    sistandard(other.sistandard),
     26    original_network_id(other.original_network_id),
     27    transport_id(other.transport_id)
    2628{
    2729}
    2830
    DTVMultiplex &DTVMultiplex::operator=(const DTVMultiplex &other) 
    4446    rolloff        = other.rolloff;
    4547    mplex          = other.mplex;
    4648    sistandard     = other.sistandard;
     49    original_network_id = other.original_network_id;
     50    transport_id        = other.transport_id;
    4751    return *this;
    4852}
    4953
    bool DTVMultiplex::FillFromDB(DTVTunerType type, uint mplexid) 
    320324        "       hp_code_rate,      lp_code_rate,   constellation, "
    321325        "       transmission_mode, guard_interval, hierarchy, "
    322326        "       modulation,        bandwidth,      sistandard, "
    323         "       mod_sys,           rolloff "
     327        "       mod_sys,           rolloff,        original_network_id, "
     328        "       transport_id "
    324329        "FROM dtv_multiplex "
    325330        "WHERE dtv_multiplex.mplexid = :MPLEXID");
    326331    query.bindValue(":MPLEXID", mplexid);
    bool DTVMultiplex::FillFromDB(DTVTunerType type, uint mplexid) 
    342347
    343348    mplex = mplexid;
    344349    sistandard = query.value(13).toString();
     350    original_network_id = query.value(16).toString();
     351    transport_id = query.value(17).toString();
    345352
    346353    // Parse the query into our DVBTuning class
    347354    return ParseTuningParams(
    uint ScanDTVTransport::SaveScan(uint scanid) const 
    503510        "    hp_code_rate,       lp_code_rate,    modulation, "
    504511        "    transmission_mode,  guard_interval,  hierarchy,  "
    505512        "    mod_sys,            rolloff,                     "
    506         "    bandwidth,          sistandard,      tuner_type  "
     513        "    bandwidth,          sistandard,      tuner_type, "
     514        "    original_network_id, transport_id, "
    507515        " ) "
    508516        "VALUES "
    509517        " ( :SCANID, "
    uint ScanDTVTransport::SaveScan(uint scanid) const 
    512520        "   :HP_CODE_RATE,      :LP_CODE_RATE,   :MODULATION, "
    513521        "   :TRANSMISSION_MODE, :GUARD_INTERVAL, :HIERARCHY,  "
    514522        "   :MOD_SYS,           :ROLLOFF,                     "
    515         "   :BANDWIDTH,         :SISTANDARD,     :TUNER_TYPE  "
     523        "   :BANDWIDTH,         :SISTANDARD,     :TUNER_TYPE, "
     524        "   :ONID,              :TID                          "
    516525        " );");
    517526
    518527    query.bindValue(":SCANID", scanid);
    uint ScanDTVTransport::SaveScan(uint scanid) const 
    533542    query.bindValue(":BANDWIDTH", bandwidth.toString());
    534543    query.bindValue(":SISTANDARD", sistandard);
    535544    query.bindValue(":TUNER_TYPE", (uint)tuner_type);
     545    query.bindValue(":ONID", original_network_id);
     546    query.bindValue(":TID", transport_id);
    536547
    537548    if (!query.exec())
    538549    {
  • mythtv/libs/libmythtv/dtvmultiplex.h

    diff --git a/mythtv/libs/libmythtv/dtvmultiplex.h b/mythtv/libs/libmythtv/dtvmultiplex.h
    index 273131c..5d07e55 100644
    a b class DTVMultiplex 
    2323{
    2424  public:
    2525    DTVMultiplex()
    26         : frequency(0), symbolrate(0), mplex(0), sistandard(QString::null) { }
     26        : frequency(0), symbolrate(0), mplex(0), sistandard(QString::null), original_network_id(0), transport_id(0) { }
    2727    DTVMultiplex(const DTVMultiplex &other);
    2828    DTVMultiplex &operator=(const DTVMultiplex &other);
    2929    virtual ~DTVMultiplex() { }
    class DTVMultiplex 
    9090    // Optional additional info
    9191    uint             mplex;
    9292    QString          sistandard;
     93    uint             original_network_id;
     94    uint             transport_id;
    9395};
    9496
    9597class ScanDTVTransport : public DTVMultiplex