Ticket #7701: 0001-unbreak-DVB-channels.conf-compile-tested.patch

File 0001-unbreak-DVB-channels.conf-compile-tested.patch, 7.4 KB (added by dekarl@…, 4 months ago)

third version, now compiles without error, doh.

  • mythtv/libs/libmythtv/dtvconfparser.cpp

    From 2e8613ea81b96fe23b7beefbfd9150eead73f894 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 1/5] unbreak the channels.conf importer for DVB
    
    ChannelUtils knows the original_network_id and transport_id, but DTVMultiplex
    ignored them completely...
    Set SI standard to dvb as VDR style channels.conf we read are always DVB.
    Also import symbol rate for DVB-C/S while here.
    Fix frequency parsing for DVB-S.
    ---
     mythtv/libs/libmythtv/dtvconfparser.cpp |   40 +++++++++++++++++++++++++-----
     mythtv/libs/libmythtv/dtvmultiplex.cpp  |   19 +++++++++++---
     mythtv/libs/libmythtv/dtvmultiplex.h    |    4 ++-
     3 files changed, 51 insertions(+), 12 deletions(-)
    
    diff --git a/mythtv/libs/libmythtv/dtvconfparser.cpp b/mythtv/libs/libmythtv/dtvconfparser.cpp
    index e4bc862..ff659c0 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) 
    230232 
    231233// BBC ONE:754166:I999B8C34D34M16T2G32Y0:T:27500:600:601, 602:0:0:4168:0:0:0 
    232234 
    233     PARSE_SKIP(unknown); 
     235    PARSE_SKIP(unknown); // channel name; bouquet name 
    234236 
    235     PARSE_UINT_1000(mux.frequency); 
     237    // FIXME http://linuxtv.org/vdrwiki/index.php/Syntax_of_channels.conf#Frequency 
     238    // should read the number and multiply by 1,000 until its bigger then 1,000,000 
     239    // to get frequency in Hz. 
     240    // But we have to return the frequency in Hz for DVB-C/T and kHz for DVB-S 
     241    long long frequency; 
     242    PARSE_UINT(frequency); 
     243    while ((frequency>0) && (frequency<1000000)) { 
     244        frequency *= 1000; 
     245    } 
    236246 
    237247    if (it == tokens.end()) 
    238248        return false; 
    bool DTVConfParser::ParseVDR(const QStringList &tokens, int channelNo) 
    286296        } 
    287297    } 
    288298 
    289     for (uint i = 0; i < 6; i++) 
    290         PARSE_SKIP(unknown); 
    291  
     299    // http://linuxtv.org/vdrwiki/index.php/Syntax_of_channels.conf 
     300    QString source; 
     301    PARSE_STR(source); // source: C, S19.2E, T 
     302    if (source[0] == 'S') { 
     303        mux.frequency = frequency / 1000; 
     304    } else { 
     305        mux.frequency = frequency; 
     306    } 
     307    PARSE_UINT_1000(mux.symbolrate); // symbol rate / 1000 
     308    PARSE_SKIP(unknown); // video pid 
     309    PARSE_SKIP(unknown); // audio pid 
     310    PARSE_SKIP(unknown); // teletext pid 
     311    PARSE_SKIP(unknown); // conditional access 
    292312    PARSE_UINT(chan.serviceid); 
     313    PARSE_UINT(mux.original_network_id); 
     314    PARSE_UINT(mux.transport_id); 
     315    PARSE_SKIP(unknown); // radio_id <- VDR custom to make onid/tid/sid unique 
     316 
     317    // VDR is always DVB, it doesn't do ATSC/SCTE (it does analogue TV, but we should only end up here for digital tv) 
     318    mux.sistandard = "dvb"; 
    293319 
    294320    AddChannel(mux, chan); 
    295321 
  • mythtv/libs/libmythtv/dtvmultiplex.cpp

    diff --git a/mythtv/libs/libmythtv/dtvmultiplex.cpp b/mythtv/libs/libmythtv/dtvmultiplex.cpp
    index 35b4666..4c4e25e 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,        networkid, " 
     328        "       transportid " 
    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).toUInt(); 
     351    transport_id = query.value(17).toUInt(); 
    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        "    networkid,          transportid,                 " 
    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