Ticket #5403: mythtv_multiproto.4.patch

File mythtv_multiproto.4.patch, 26.4 KB (added by wagabunda, 16 years ago)

never version of v.3 patch

  • libs/libmythtv/dtvconfparserhelpers.h

     
    3333#define _DTVCONFPARSERHELPERS_H_
    3434
    3535#include <qstring.h>
     36#include "dvbtypes.h"
    3637
    3738// The following are a set of helper classes to allow easy translation
    3839// between the different string representations of various tuning params.
     
    191192    static const DTVParamHelperStruct confTable[];
    192193    static const DTVParamHelperStruct vdrTable[];
    193194    static const DTVParamHelperStruct parseTable[];
     195#ifdef DVB_API_MULTIPROTO
     196    static const uint kDBStrCnt = 15;
     197#else
    194198    static const uint kDBStrCnt = 10;
     199#endif
    195200    static const char *dbStr[kDBStrCnt];
    196201
    197202  public:
    198203    enum
    199204    {
     205#ifdef DVB_API_MULTIPROTO
    200206        kFECNone,
     207        kFEC_1_4,
     208        kFEC_1_3,
     209        kFEC_2_5,
    201210        kFEC_1_2,
     211        kFEC_3_5,
    202212        kFEC_2_3,
    203213        kFEC_3_4,
    204214        kFEC_4_5,
     
    206216        kFEC_6_7,
    207217        kFEC_7_8,
    208218        kFEC_8_9,
     219        kFEC_9_10,
    209220        kFECAuto,
     221#else
     222        kFECNone,
     223        kFEC_1_2,
     224        kFEC_2_3,
     225        kFEC_3_4,
     226        kFEC_4_5,
     227        kFEC_5_6,
     228        kFEC_6_7,
     229        kFEC_7_8,
     230        kFEC_8_9,
     231        kFECAuto,
     232#endif
    210233    };
    211234
    212235    DTVCodeRate(int _default = kFECAuto) : DTVParamHelper(_default) { }
  • libs/libmythtv/dtvconfparserhelpers.cpp

     
    145145
    146146const DTVParamHelperStruct DTVCodeRate::confTable[] =
    147147{
     148#ifdef DVB_API_MULTIPROTO
     149    { "DVBFE_FEC_AUTO", kFECAuto  },
     150    { "DVBFE_FEC_1_4",  kFEC_1_4  },
     151    { "DVBFE_FEC_1_3",  kFEC_1_3  },
     152    { "DVBFE_FEC_2_5",  kFEC_2_5  },
     153    { "DVBFE_FEC_1_2",  kFEC_1_2  },
     154    { "DVBFE_FEC_3_5",  kFEC_3_5  },
     155    { "DVBFE_FEC_2_3",  kFEC_2_3  },
     156    { "DVBFE_FEC_3_4",  kFEC_3_4  },
     157    { "DVBFE_FEC_4_5",  kFEC_4_5  },   
     158    { "DVBFE_FEC_5_6",  kFEC_5_6  },
     159    { "DVBFE_FEC_6_7",  kFEC_6_7  },
     160    { "DVBFE_FEC_7_8",  kFEC_7_8  },
     161    { "DVBFE_FEC_8_9",  kFEC_8_9  },
     162    { "DVBFE_FEC_9_10", kFEC_9_10 },
     163    { "DVBFE_FEC_NONE", kFECNone  },
     164    { NULL,             kFECAuto  },
     165#else
    148166    { "FEC_AUTO", kFECAuto },
    149167    { "FEC_1_2",  kFEC_1_2  },
    150168    { "FEC_2_3",  kFEC_2_3  },
     
    156174    { "FEC_8_9",  kFEC_8_9  },
    157175    { "FEC_NONE", kFECNone },
    158176    { NULL,       kFECAuto },
     177#endif
    159178};
    160179
    161180const DTVParamHelperStruct DTVCodeRate::vdrTable[] =
    162181{
    163182    { "999", kFECAuto },
     183    { "14",  kFEC_1_4 },
     184    { "13",  kFEC_1_3 },
     185    { "25",  kFEC_2_5 },
    164186    { "12",  kFEC_1_2 },
     187    { "35",  kFEC_3_5 },
    165188    { "23",  kFEC_2_3 },
    166189    { "34",  kFEC_3_4 },
    167190    { "45",  kFEC_4_5 },
     
    169192    { "67",  kFEC_6_7 },
    170193    { "78",  kFEC_7_8 },
    171194    { "89",  kFEC_8_9 },
     195    { "910", kFEC_9_10 },
    172196    { "0",   kFECNone },
    173197    { NULL,  kFECAuto }
    174198};
     
    176200const DTVParamHelperStruct DTVCodeRate::parseTable[] =
    177201{
    178202    { "auto", kFECAuto },
     203    { "1/4",  kFEC_1_4 },
     204    { "1/3",  kFEC_1_3 },
     205    { "2/5",  kFEC_2_5 },
    179206    { "1/2",  kFEC_1_2 },
     207    { "3/5",  kFEC_3_5 },
    180208    { "2/3",  kFEC_2_3 },
    181209    { "3/4",  kFEC_3_4 },
    182210    { "4/5",  kFEC_4_5 },
     
    184212    { "6/7",  kFEC_6_7 },
    185213    { "7/8",  kFEC_7_8 },
    186214    { "8/9",  kFEC_8_9 },
     215    { "9/10", kFEC_9_10},
    187216    { "none", kFECNone },
    188217    { NULL,   kFECAuto }
    189218};
     
    191220const char *DTVCodeRate::dbStr[DTVCodeRate::kDBStrCnt] =
    192221{
    193222     "none", ///< kFECNone
     223         "1/4",  ///< kFEC_1_4
     224         "1/3",  ///< kFEC_1_3
     225         "2/5",  ///< kFEC_2_5
    194226     "1/2",  ///< kFEC_1_2
     227         "3/5",  ///< kFEC_3_5
    195228     "2/3",  ///< kFEC_2_3
    196229     "3/4",  ///< kFEC_3_4
    197230     "4/5",  ///< kFEC_4_5
     
    199232     "6/7",  ///< kFEC_6_7
    200233     "7/8",  ///< kFEC_7_8
    201234     "8/9",  ///< kFEC_8_9
    202      "auto"  ///< kFECAuto
     235         "9/10",  ///< kFEC_9_10
     236     "auto",  ///< kFECAuto
    203237};
    204238
    205239const DTVParamHelperStruct DTVModulation::confTable[] =
  • libs/libmythtv/dtvmultiplex.h

     
    1515
    1616// MythTV headers
    1717#include "dtvconfparserhelpers.h"
     18#include "dvbtypes.h"
    1819
    1920class DTVMultiplex
    2021{
  • libs/libmythtv/libmythtv.pro

     
    3737LIBS += -lmythmpeg2-$$LIBVERSION    -lmythdvdnav-$$LIBVERSION
    3838LIBS += -lmythfreemheg-$$LIBVERSION -lmythlivemedia-$$LIBVERSION
    3939LIBS += -lz $$EXTRA_LIBS
     40LIBS += -lrt
    4041
    4142TARGETDEPS += ../libmyth/libmyth-$${MYTH_SHLIB_EXT}
    4243TARGETDEPS += ../libavutil/libmythavutil-$${MYTH_SHLIB_EXT}
  • libs/libmythtv/scanwizardhelpers.h

     
    536536        addSelection("6/7");
    537537        addSelection("7/8");
    538538        addSelection("8/9");
     539#ifdef DVB_API_MULTIPROTO
     540        addSelection("1/4");
     541        addSelection("1/3");
     542        addSelection("2/5");
     543        addSelection("3/5");
     544        addSelection("9/10");
     545#endif
    539546    }
    540547};
    541548
  • libs/libmythtv/dvbchannel.h

     
    100100    int  GetChanID(void) const;
    101101
    102102    void CheckOptions(DTVMultiplex &t) const;
     103#ifdef DVB_API_MULTIPROTO
     104    bool ReadTunerCapabilities(const DTVMultiplex &t);
     105#endif
    103106    bool CheckModulation(DTVModulation modulation) const;
    104107    bool CheckCodeRate(DTVCodeRate rate) const;
    105108
     
    117120    QString           frontend_name;
    118121    DTVTunerType      card_type;
    119122    uint64_t          capabilities;
    120     uint64_t          ext_modulations;
     123        uint64_t          delivery;
    121124    uint64_t          frequency_minimum;
    122125    uint64_t          frequency_maximum;
    123126    uint              symbol_rate_minimum;
  • libs/libmythtv/dvbtypes.h

     
    3939#    define VSB_16        (fe_modulation)(QAM_AUTO+2)
    4040#endif
    4141
    42 #ifdef FE_GET_EXTENDED_INFO
    43   #define dvb_fe_params dvb_frontend_parameters_new
    44 #else
    45   #define dvb_fe_params dvb_frontend_parameters
     42#if (DVB_API_VERSION >= 3 && DVB_API_VERSION_MINOR >= 3)
     43#    define DVB_API_MULTIPROTO
    4644#endif
    4745
    4846class QString;
  • libs/libmythtv/dvbchannel.cpp

     
    1 /*
     1/*   
    22 *  Class DVBChannel
    33 *
    44 * Copyright (C) Kenneth Aafloy 2003
     
    5050
    5151static void drain_dvb_events(int fd);
    5252static bool wait_for_backend(int fd, int timeout_ms);
    53 static struct dvb_fe_params dtvmultiplex_to_dvbparams(
     53static struct dvb_frontend_parameters dtvmultiplex_to_dvbparams(
    5454    DTVTunerType, const DTVMultiplex&);
    5555static DTVMultiplex dvbparams_to_dtvmultiplex(
    56     DTVTunerType, const dvb_fe_params&);
    57 
     56    DTVTunerType, const dvb_frontend_parameters&);
     57#ifdef DVB_API_MULTIPROTO
     58static DTVMultiplex dvbparams_to_dtvmultiplex(const dvbfe_params&);
     59#endif
    5860#define LOC QString("DVBChan(%1:%2): ").arg(GetCardID()).arg(cardnum)
    5961#define LOC_WARN QString("DVBChan(%1:%2) Warning: ") \
    6062                 .arg(GetCardID()).arg(cardnum)
    6163#define LOC_ERR QString("DVBChan(%1:%2) Error: ").arg(GetCardID()).arg(cardnum)
    6264
    6365/** \class DVBChannel
    64  *  \brief Provides interface to the tuning hardware when using DVB drivers
     66 *  \brief Provides interface to the tuning hardware when drivers
    6567 *
    6668 *  \bug Only supports single input cards.
    6769 */
     
    168170        frontend_name       = master->frontend_name;
    169171        card_type           = master->card_type;
    170172        capabilities        = master->capabilities;
    171         ext_modulations     = master->ext_modulations;
     173        delivery            = master->delivery;
    172174        frequency_minimum   = master->frequency_minimum;
    173175        frequency_maximum   = master->frequency_maximum;
    174176        symbol_rate_minimum = master->symbol_rate_minimum;
     
    198200        return false;
    199201    }
    200202
     203    VERBOSE(VB_RECORD, LOC + QString("Using DVB card %1, with frontend '%2'.")
     204            .arg(cardnum).arg(frontend_name));
     205           
     206#ifdef DVB_API_MULTIPROTO
     207    if (ioctl(fd_frontend, DVBFE_GET_DELSYS, &delivery) < 0)
     208    {
     209        VERBOSE(VB_IMPORTANT, LOC_ERR +
     210                "Failed to get frontend delivery." + ENO);
     211
     212        close(fd_frontend);
     213        fd_frontend = -1;
     214        return false;
     215    }
     216    if (DVBFE_DELSYS_DVBS2 == (delivery & DVBFE_DELSYS_DVBS2)){
     217        card_type = DTVTunerType::kTunerTypeDVB_S2;
     218    } else if (DVBFE_DELSYS_DVBS == (delivery & DVBFE_DELSYS_DVBS)){
     219        card_type = DTVTunerType::kTunerTypeQPSK;
     220    } else {
     221        VERBOSE(VB_IMPORTANT, LOC_ERR +
     222                "Tuner does not support DVB-S/DVB-S2." + ENO);
     223        close(fd_frontend);
     224        fd_frontend = -1;
     225        return false;
     226    }
     227#else
    201228    dvb_frontend_info info;
    202229    bzero(&info, sizeof(info));
    203230    if (ioctl(fd_frontend, FE_GET_INFO, &info) < 0)
     
    209236        fd_frontend = -1;
    210237        return false;
    211238    }
    212 
    213 #ifdef FE_GET_EXTENDED_INFO
    214     if (info.caps & FE_HAS_EXTENDED_INFO)
    215     {
    216         bool ok = true;
    217         dvb_fe_caps_extended extinfo;
    218         bzero(&extinfo, sizeof(extinfo));
    219         if (ioctl(fd_frontend, FE_GET_EXTENDED_INFO, &extinfo) < 0)
    220         {
    221             VERBOSE(VB_IMPORTANT, LOC_ERR +
    222                     "Failed to get frontend extended information." + ENO);
    223 
    224             ok = false;
    225         }
    226 
    227         if (ok && (extinfo.modulations & MOD_8PSK))
    228         {
    229             if (ioctl(fd_frontend, FE_SET_STANDARD, FE_DVB_S2) < 0)
    230             {
    231                 VERBOSE(VB_IMPORTANT, LOC_ERR +
    232                         "Failed to set frontend standard to DVB-S2." + ENO);
    233 
    234                 ok = false;
    235             }
    236             else if (ioctl(fd_frontend, FE_GET_INFO, &info) < 0)
    237             {
    238                 VERBOSE(VB_IMPORTANT, LOC_ERR +
    239                         "Failed to get frontend information." + ENO);
    240 
    241                 ok = false;
    242             }
    243         }
    244 
    245         if (!ok)
    246         {
    247             close(fd_frontend);
    248             fd_frontend = -1;
    249             return false;
    250         }
    251 
    252         ext_modulations   = extinfo.modulations;
    253     }
    254 #endif
    255 
     239    card_type           = info.type;
     240    capabilities        = info.caps;   
    256241    frontend_name       = info.name;
    257     card_type           = info.type;
    258     capabilities        = info.caps;
    259242    frequency_minimum   = info.frequency_min;
    260243    frequency_maximum   = info.frequency_max;
    261244    symbol_rate_minimum = info.symbol_rate_min;
    262245    symbol_rate_maximum = info.symbol_rate_max;
     246#endif
    263247
    264     VERBOSE(VB_RECORD, LOC + QString("Using DVB card %1, with frontend '%2'.")
    265             .arg(cardnum).arg(frontend_name));
    266 
    267248    // Turn on the power to the LNB
    268249    if (card_type == DTVTunerType::kTunerTypeQPSK ||
    269250        card_type == DTVTunerType::kTunerTypeDVB_S2)
     
    312293    if (!tuning.FillFromDB(card_type, mplexid))
    313294        return false;
    314295
     296#ifdef DVB_API_MULTIPROTO
     297    if (!ReadTunerCapabilities(tuning)){
     298      VERBOSE(VB_GENERAL, LOC_WARN +
     299                "Unable to read tuner capabilities.");
     300    }
     301#endif
    315302    CheckOptions(tuning);
    316303
    317304    return Tune(tuning, inputname);
     
    402389    SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num);
    403390
    404391    // Try to fix any problems with the multiplex
     392#ifdef DVB_API_MULTIPROTO
     393    if (!ReadTunerCapabilities(tuning)){
     394      VERBOSE(VB_GENERAL, LOC_WARN +
     395                "Unable to read tuner capabilities.");
     396    }
     397#endif
    405398    CheckOptions(tuning);
    406399
    407400    if (!Tune(tuning, inputid))
     
    463456 */
    464457void DVBChannel::CheckOptions(DTVMultiplex &tuning) const
    465458{
     459
    466460    if ((tuning.inversion == DTVInversion::kInversionAuto) &&
    467461        !(capabilities & FE_CAN_INVERSION_AUTO))
    468462    {
     
    593587{
    594588    const DTVModulation m = modulation;
    595589    const uint64_t      c = capabilities;
    596 
    597 #ifdef FE_GET_EXTENDED_INFO
    598     if ((c & FE_HAS_EXTENDED_INFO)            &&
    599         (DTVModulation::kModulation8PSK == m) &&
    600         (ext_modulations & DTVModulation::kModulation8PSK))
    601     {
    602         return true;
    603     }
    604 #endif // FE_GET_EXTENDED_INFO
    605 
     590   
    606591    return
    607592        ((DTVModulation::kModulationQPSK    == m) && (c & FE_CAN_QPSK))     ||
    608593        ((DTVModulation::kModulationQAM16   == m) && (c & FE_CAN_QAM_16))   ||
     
    669654                      bool same_input)
    670655{
    671656    QMutexLocker lock(&tune_lock);
    672 
    673657    if (master)
    674658    {
    675659        VERBOSE(VB_CHANNEL, LOC + "tuning on slave channel");
     
    678662    }
    679663
    680664    bool reset = (force_reset || first_tune);
    681     struct dvb_fe_params params = dtvmultiplex_to_dvbparams(card_type, tuning);
     665    struct dvb_frontend_parameters params = dtvmultiplex_to_dvbparams(card_type, tuning);
    682666
    683     bool is_dvbs = (DTVTunerType::kTunerTypeQPSK   == card_type ||
    684                     DTVTunerType::kTunerTypeDVB_S2 == card_type);
    685 
     667    bool is_dvbs = (DTVTunerType::kTunerTypeQPSK == card_type || DTVTunerType::kTunerTypeDVB_S2 == card_type);
     668   
    686669    bool has_diseqc = (diseqc_tree != NULL);
    687670    if (is_dvbs && !has_diseqc)
    688671    {
     
    701684
    702685        return false;
    703686    }
    704 
    705687    // Remove any events in queue before tuning.
    706688    drain_dvb_events(fd_frontend);
    707689
     
    711693        // configure for new input
    712694        if (!same_input)
    713695            diseqc_settings.Load(inputid);
    714 
    715696        // execute diseqc commands
    716697        if (!diseqc_tree->Execute(diseqc_settings, tuning))
    717698        {
     
    719700                    "Failed to setup DiSEqC devices");
    720701            return false;
    721702        }
    722 
    723703        // retrieve actual intermediate frequency
    724704        DiSEqCDevLNB *lnb = diseqc_tree->FindLNB(diseqc_settings);
    725705        if (!lnb)
     
    752732    // DVB-S is in kHz, other DVB is in Hz
    753733    int     freq_mult = (is_dvbs) ? 1 : 1000;
    754734    QString suffix    = (is_dvbs) ? "kHz" : "Hz";
     735       
     736        VERBOSE(VB_IMPORTANT, LOC_ERR + QString("prev. tuning check: reset: %1, IsEqual: %2").arg(reset).arg(prev_tuning.IsEqual(card_type, tuning, 500 * freq_mult)) );
    755737
    756738    if (reset || !prev_tuning.IsEqual(card_type, tuning, 500 * freq_mult))
    757739    {
    758740        VERBOSE(VB_CHANNEL, LOC + QString("Tune(): Tuning to %1%2")
    759741                .arg(params.frequency).arg(suffix));
    760742
    761 #ifdef FE_GET_EXTENDED_INFO
    762         if (card_type == DTVTunerType::kTunerTypeDVB_S2)
    763         {
    764             if (ioctl(fd_frontend, FE_SET_FRONTEND2, &params) < 0)
    765             {
    766                 VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
    767                         "Setting Frontend(2) tuning parameters failed." + ENO);
    768                 return false;
    769             }
     743#ifdef DVB_API_MULTIPROTO
     744    VERBOSE(VB_GENERAL, LOC_ERR + QString("modulation: %1/%2").arg(tuning.modulation).arg(DTVModulation::kModulation8PSK));
     745           
     746    if (card_type == DTVTunerType::kTunerTypeQPSK || card_type == DTVTunerType::kTunerTypeDVB_S2){
     747      struct dvbfe_params fe_params;
     748      struct dvbfe_params fe_cur_params;
     749   
     750      if (ioctl(fd_frontend, DVBFE_GET_PARAMS, &fe_cur_params) < 0)
     751      {
     752        VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
     753        "Getting frontend tuning parameters failed." + ENO);
     754        return false;
     755      }
     756     VERBOSE(VB_GENERAL, LOC_ERR + QString("current parameters: frequency: %1, delivery: %2").arg(fe_cur_params.frequency).arg(fe_cur_params.delivery)); 
     757     
     758      fe_params.frequency               = params.frequency;
     759      fe_params.inversion               = INVERSION_AUTO;
     760      if (tuning.modulation == DTVModulation::kModulation8PSK){
     761        fe_params.delsys.dvbs2.symbol_rate = tuning.symbolrate;
     762        fe_params.delsys.dvbs2.fec         = DVBFE_FEC_AUTO;
     763        fe_params.delsys.dvbs2.modulation  = DVBFE_MOD_8PSK;
     764        fe_params.delivery                 = DVBFE_DELSYS_DVBS2;
     765      } else{
     766        fe_params.delsys.dvbs.symbol_rate  = tuning.symbolrate;
     767        fe_params.delsys.dvbs.fec          = DVBFE_FEC_AUTO;
     768        fe_params.delsys.dvbs.modulation  = DVBFE_MOD_QPSK;
     769        fe_params.delivery                 = DVBFE_DELSYS_DVBS;
     770      }
     771     
     772      if (fe_cur_params.delivery != fe_params.delivery){
     773        if (ioctl(fd_frontend, DVBFE_SET_DELSYS, &fe_params.delivery) < 0){
     774            VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
     775              "Setting Frontend delivery failed." + ENO);
     776            return false;
    770777        }
    771         else
    772 #endif // FE_GET_EXTENDED_INFO
    773         {
     778      }
     779     
     780      if (ioctl(fd_frontend, DVBFE_SET_PARAMS, &fe_params) < 0){
     781        VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
     782              "Setting Frontend tuning parameters failed." + ENO);
     783        return false;
     784      }
     785     
     786    }
     787    else
     788#endif
    774789            if (ioctl(fd_frontend, FE_SET_FRONTEND, &params) < 0)
    775790            {
    776791                VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
    777792                        "Setting Frontend tuning parameters failed." + ENO);
    778793                return false;
    779794            }
    780         }
    781 
    782795        // Extra delay to add for broken DVB drivers
    783796        if (tuning_delay)
    784797            usleep(tuning_delay * 1000);
     
    831844        return false;
    832845    }
    833846
    834     dvb_fe_params params;
     847    dvb_frontend_parameters params;
    835848    return ioctl(fd_frontend, FE_GET_FRONTEND, &params) >= 0;
    836849}
    837850
     
    845858bool DVBChannel::ProbeTuningParams(DTVMultiplex &tuning) const
    846859{
    847860    QMutexLocker locker(&hw_lock);
     861    uint    mplex;
     862    QString sistandard;
    848863
    849864    if (fd_frontend < 0)
    850865    {
     
    864879        return false;
    865880    }
    866881
    867     dvb_fe_params params;
    868     if (ioctl(fd_frontend, FE_GET_FRONTEND, &params) < 0)
     882#ifdef DVB_API_MULTIPROTO
     883    if (card_type == DTVTunerType::kTunerTypeQPSK || card_type == DTVTunerType::kTunerTypeDVB_S2){
     884      struct dvbfe_params params;
     885      if (ioctl(fd_frontend, DVBFE_GET_PARAMS, &params) < 0){
     886        VERBOSE(VB_IMPORTANT, LOC_ERR +
     887                "Getting Frontend (multiproto) tuning parameters failed." + ENO);
     888
     889        return false;
     890      }
     891      mplex      = tuning.mplex;
     892      sistandard = QDeepCopy<QString>(tuning.sistandard);
     893      tuning     = dvbparams_to_dtvmultiplex(params);
     894    } 
     895    else
     896#endif
    869897    {
     898      struct dvb_frontend_parameters params;
     899      if (ioctl(fd_frontend, FE_GET_FRONTEND, &params) < 0){
    870900        VERBOSE(VB_IMPORTANT, LOC_ERR +
    871901                "Getting Frontend tuning parameters failed." + ENO);
    872902
    873903        return false;
     904      }
     905      mplex      = tuning.mplex;
     906      sistandard = QDeepCopy<QString>(tuning.sistandard);
     907      tuning     = dvbparams_to_dtvmultiplex(card_type, params);
    874908    }
    875 
    876     uint    mplex      = tuning.mplex;
    877     QString sistandard = QDeepCopy<QString>(tuning.sistandard);
    878 
    879     tuning = dvbparams_to_dtvmultiplex(card_type, params);
    880 
    881909    tuning.mplex       = mplex;
    882910    tuning.sistandard  = sistandard;
    883911
     
    10791107    return true;
    10801108}
    10811109
    1082 static struct dvb_fe_params dtvmultiplex_to_dvbparams(
     1110static struct dvb_frontend_parameters dtvmultiplex_to_dvbparams(
    10831111    DTVTunerType tuner_type, const DTVMultiplex &tuning)
    10841112{
    1085     dvb_fe_params params;
     1113    dvb_frontend_parameters params;
    10861114    bzero(&params, sizeof(params));
    10871115
    10881116    params.frequency = tuning.frequency;
    10891117    params.inversion = (fe_spectral_inversion_t) (int) tuning.inversion;
    10901118
    1091     if (DTVTunerType::kTunerTypeQPSK == tuner_type)
     1119    if (DTVTunerType::kTunerTypeQPSK == tuner_type || tuner_type == DTVTunerType::kTunerTypeDVB_S2)
    10921120    {
    10931121        params.u.qpsk.symbol_rate = tuning.symbolrate;
    10941122        params.u.qpsk.fec_inner   = (fe_code_rate_t) (int) tuning.fec;
    10951123    }
    10961124
    1097     if (DTVTunerType::kTunerTypeDVB_S2 == tuner_type)
    1098     {
    1099 #ifdef FE_GET_EXTENDED_INFO
    1100         params.u.qpsk2.symbol_rate = tuning.symbolrate;
    1101         params.u.qpsk2.fec_inner   = (fe_code_rate_t) (int) tuning.fec;
    1102         params.u.qpsk2.modulation  = (fe_modulation_t) (int) tuning.modulation;
    1103 #else // if !FE_GET_EXTENDED_INFO
    1104         VERBOSE(VB_IMPORTANT, "DVBChan Error, MythTV was compiled without "
    1105                 "DVB-S2 headers being present so DVB-S2 tuning will fail.");
    1106 #endif // !FE_GET_EXTENDED_INFO
    1107     }
    1108 
    11091125    if (DTVTunerType::kTunerTypeQAM  == tuner_type)
    11101126    {
    11111127        params.u.qam.symbol_rate  = tuning.symbolrate;
     
    11431159}
    11441160
    11451161static DTVMultiplex dvbparams_to_dtvmultiplex(
    1146     DTVTunerType tuner_type, const dvb_fe_params &params)
     1162    DTVTunerType tuner_type, const dvb_frontend_parameters &params)
    11471163{
    11481164    DTVMultiplex tuning;
    11491165
    11501166    tuning.frequency = params.frequency;
    11511167    tuning.inversion = params.inversion;
    11521168
    1153     if ((DTVTunerType::kTunerTypeQPSK   == tuner_type) ||
    1154         (DTVTunerType::kTunerTypeDVB_S2 == tuner_type))
     1169    if (DTVTunerType::kTunerTypeQPSK   == tuner_type)
    11551170    {
    11561171        tuning.symbolrate     = params.u.qpsk.symbol_rate;
    11571172        tuning.fec            = params.u.qpsk.fec_inner;
     
    11841199
    11851200    return tuning;
    11861201}
     1202
     1203#ifdef DVB_API_MULTIPROTO
     1204
     1205static DTVMultiplex dvbparams_to_dtvmultiplex(const dvbfe_params &params){
     1206   
     1207    DTVMultiplex tuning;
     1208
     1209    tuning.frequency = params.frequency;
     1210    tuning.inversion = params.inversion;
     1211   
     1212    switch(params.delivery){
     1213      case DVBFE_DELSYS_DVBS:
     1214      {
     1215        tuning.symbolrate     = params.delsys.dvbs.symbol_rate;
     1216        tuning.fec            = params.delsys.dvbs.fec;
     1217      } 
     1218        break;
     1219      case DVBFE_DELSYS_DVBS2:
     1220      {
     1221        tuning.symbolrate     = params.delsys.dvbs2.symbol_rate;
     1222        tuning.fec            = params.delsys.dvbs2.fec;
     1223      }
     1224        break; 
     1225    }
     1226    return tuning;
     1227}
     1228
     1229bool DVBChannel::ReadTunerCapabilities(const DTVMultiplex &tuning){
     1230
     1231    VERBOSE(VB_IMPORTANT, "dvbchannel.cpp:ReadTunerCapabilities");
     1232    enum dvbfe_delsys d;
     1233    switch(tuning.modulation){
     1234      case DTVModulation::kModulation8PSK:
     1235        d = DVBFE_DELSYS_DVBS2;
     1236        break;
     1237      case DTVModulation::kModulationQPSK:
     1238        d = DVBFE_DELSYS_DVBS;
     1239        break;
     1240      default:
     1241        VERBOSE(VB_IMPORTANT, LOC_ERR +
     1242          "Failed to determine frontend delivery.");
     1243        //close(fd_frontend);
     1244        //fd_frontend = -1;
     1245        return false;
     1246        break;
     1247    }
     1248   
     1249    struct dvbfe_params params;
     1250    if (ioctl(fd_frontend, DVBFE_GET_PARAMS, &params) < 0)
     1251    {
     1252        VERBOSE(VB_IMPORTANT, LOC_ERR +
     1253                "Failed to get frontend parameters for DVB-S/S2 frontend." + ENO);
     1254        //close(fd_frontend);
     1255        //fd_frontend = -1;
     1256        return false;
     1257    }
     1258    if (params.delivery != d){
     1259      if (ioctl(fd_frontend, DVBFE_SET_DELSYS, &d) < 0){
     1260        VERBOSE(VB_IMPORTANT, LOC_ERR +
     1261                "Failed to set frontend delivery." + ENO);
     1262        //close(fd_frontend);
     1263        //fd_frontend = -1;
     1264        return false;
     1265      }
     1266    }
     1267    VERBOSE(VB_IMPORTANT, "dvbchannel.cpp:ReadTunerCapabilities");
     1268    struct dvbfe_info info;
     1269    if (ioctl(fd_frontend, DVBFE_GET_INFO, &info) < 0){
     1270        VERBOSE(VB_IMPORTANT, LOC_ERR +
     1271                "Failed to get frontend information for DVB-S frontend." + ENO);
     1272      //close(fd_frontend);
     1273      //fd_frontend = -1;
     1274      return false;
     1275    }
     1276   
     1277    capabilities        = FEC_NONE;
     1278   
     1279    dvbfe_modulation m;
     1280    m = info.delsys.dvbs.modulation;
     1281    if (m & DVBFE_MOD_QPSK)    { capabilities |= FE_CAN_QPSK; }
     1282    if (m & DVBFE_MOD_QAM16)   { capabilities |= FE_CAN_QAM_16; }
     1283    if (m & DVBFE_MOD_QAM32)   { capabilities |= FE_CAN_QAM_32; }
     1284    if (m & DVBFE_MOD_QAM64)   { capabilities |= FE_CAN_QAM_64; }
     1285    if (m & DVBFE_MOD_QAM128)  { capabilities |= FE_CAN_QAM_128; }
     1286    if (m & DVBFE_MOD_QAM256)  { capabilities |= FE_CAN_QAM_256; }
     1287    if (m & DVBFE_MOD_QAMAUTO) { capabilities |= FE_CAN_QAM_AUTO; }
     1288   
     1289    dvbfe_fec f;
     1290    f = info.delsys.dvbs.fec;
     1291    if (f & DVBFE_FEC_1_2)  { capabilities |= FE_CAN_FEC_1_2; }
     1292    if (f & DVBFE_FEC_2_3)  { capabilities |= FE_CAN_FEC_2_3; }
     1293    if (f & DVBFE_FEC_3_4)  { capabilities |= FE_CAN_FEC_3_4; }
     1294    if (f & DVBFE_FEC_4_5)  { capabilities |= FE_CAN_FEC_4_5; }
     1295    if (f & DVBFE_FEC_5_6)  { capabilities |= FE_CAN_FEC_5_6; }
     1296    if (f & DVBFE_FEC_6_7)  { capabilities |= FE_CAN_FEC_6_7; }
     1297    if (f & DVBFE_FEC_7_8)  { capabilities |= FE_CAN_FEC_7_8; }
     1298    if (f & DVBFE_FEC_8_9)  { capabilities |= FE_CAN_FEC_8_9; }
     1299    if (f & DVBFE_FEC_AUTO) { capabilities |= FE_CAN_FEC_AUTO;}
     1300   
     1301    fe_spectral_inversion_t i;
     1302    i = info.inversion;
     1303    if (i & INVERSION_AUTO) { capabilities |= FE_CAN_INVERSION_AUTO; }
     1304   
     1305    frontend_name       = info.name;
     1306    frequency_minimum   = info.frequency_min;
     1307    frequency_maximum   = info.frequency_max;
     1308    symbol_rate_minimum = info.symbol_rate_min;
     1309    symbol_rate_maximum = info.symbol_rate_max;
     1310   
     1311    return true;
     1312}
     1313#endif
  • libs/libmythtv/transporteditor.cpp

     
    3838#include "cardutil.h"
    3939#include "mythcontext.h"
    4040#include "mythdbcon.h"
     41#include "dvbtypes.h"
    4142
    4243#define LOC QString("DTVMux: ")
    4344#define LOC_ERR QString("DTVMux, Error: ")
     
    505506    if (CardUtil::QPSK == nType)
    506507    {
    507508        // no modulation options
    508         setVisible(false);
     509        //setVisible(false);
     510                addSelection("QPSK",   "qpsk");
     511                addSelection("8PSK",   "8psk");
    509512    }
    510513    else if ((CardUtil::QAM == nType) || (CardUtil::OFDM == nType))
    511514    {
     
    582585        addSelection("6/7");
    583586        addSelection("7/8");
    584587        addSelection("8/9");
     588#ifdef DVB_API_MULTIPROTO
     589        addSelection("1/4");
     590        addSelection("1/3");
     591        addSelection("2/5");
     592        addSelection("3/5");
     593        addSelection("9/10");
     594#endif
    585595    };
    586596};
    587597
     
    710720        left->addChild(new DTVStandard(id, true, false));
    711721        left->addChild(new Frequency(id, true));
    712722        left->addChild(new DVBSymbolRate(id));
     723                left->addChild(new Modulation(id, nType));
    713724
    714725        right = new VerticalConfigurationGroup(false, true, false, false);
    715726        right->addChild(new DVBInversion(id));