Ticket #5443: 5443-recording-profiles-v1.patch

File 5443-recording-profiles-v1.patch, 28.6 KB (added by danielk, 4 years ago)

Adds recording profiles (not finished, only respects 'high' resolution bitrates.)

  • configure

     
    158158  echo "  --disable-hdhomerun      disable support for HDHomeRun boxes" 
    159159  echo "  --disable-v4l            disable Video4Linux support" 
    160160  echo "  --disable-ivtv           disable ivtv support (PVR-x50) req. v4l support" 
     161  echo "  --disable-hdpvr          disable HD-PVR support" 
    161162  echo "  --disable-dvb            disable DVB support" 
    162163  echo "  --dvb-path=HDRLOC        location of directory containing" 
    163164  echo "                           'linux/dvb/frontend.h', not the" 
     
    892893    hdhomerun 
    893894    iptv 
    894895    ivtv 
     896    hdpvr 
    895897    joystick_menu 
    896898    libfftw3 
    897899    lirc 
     
    10491051firewire_deps="backend" 
    10501052iptv_deps="backend" 
    10511053ivtv_deps="backend v4l" 
     1054hdpvr_deps="backend v4l" 
    10521055hdhomerun_deps="backend" 
    10531056opengl_deps="GL_gl_h" 
    10541057opengl_deps_any="windows x11" 
     
    11811184hdhomerun="yes" 
    11821185iptv="yes" 
    11831186ivtv="yes" 
     1187hdpvr="yes" 
    11841188joystick_menu="default" 
    11851189lamemp3="yes" 
    11861190lirc="yes" 
     
    16181622    enable  darwin 
    16191623    disable dvb 
    16201624    disable ivtv 
     1625    disable hdpvr 
    16211626    ldver=$(ld -v 2>&1 | sed -e s/^[^-]*-//) 
    16221627    osxver=$(uname -r | cut -c 1) 
    16231628    if [[ ${ldver%.*} -lt "82" && ${osxver} = "9" && ${arch} = "x86_32" ]]; then 
     
    16481653    disable dv1394 
    16491654    disable dvb 
    16501655    disable ivtv 
     1656    disable hdpvr 
    16511657    enable  memalign_hack 
    16521658    disable network 
    16531659    enable opengl 
     
    30173023if enabled backend; then 
    30183024  echo "Video4Linux sup.          ${v4l-no}" 
    30193025  echo "ivtv support              ${ivtv-no}" 
     3026  echo "hdpvr support             ${hdpvr-no}" 
    30203027  echo "FireWire support          ${firewire-no}" 
    30213028  echo "DVB support               ${dvb-no} [$dvb_path]" 
    30223029  echo "DBox2 support             ${dbox2-no}" 
  • libs/libmythtv/cardutil.h

     
    5353        FIREWIRE  = 9, 
    5454        HDHOMERUN = 10, 
    5555        FREEBOX   = 11, 
     56        HDPVR     = 12, 
    5657    }; 
    5758 
    5859    static enum CARD_TYPES toCardType(const QString &name) 
     
    8182            return HDHOMERUN; 
    8283        if ("FREEBOX" == name) 
    8384            return FREEBOX; 
     85        if ("HDPVR" == name) 
     86            return HDPVR; 
    8487        return ERROR_UNKNOWN; 
    8588    } 
    8689 
     
    9598    static bool         IsUnscanable(const QString &rawtype) 
    9699    { 
    97100        return 
    98             (rawtype == "FIREWIRE")  || (rawtype == "DBOX2"); 
     101            (rawtype == "FIREWIRE")  || (rawtype == "DBOX2") || 
     102            (rawtype == "HDPVR"); 
    99103    } 
    100104 
    101105    static bool         IsEITCapable(const QString &rawtype) 
     
    119123 
    120124    static bool         IsTuningAnalog(const QString &rawtype) 
    121125    { 
    122         return (rawtype == "V4L"); 
     126        return 
     127            (rawtype == "V4L")    || (rawtype == "MPEG") || 
     128            (rawtype == "HDPVR"); 
    123129    } 
    124130 
    125131    /// Convenience function for GetCardIDs(const QString&, QString, QString) 
     
    146152        { return get_on_cardid("cardtype", cardid).upper(); } 
    147153    static QString      GetVideoDevice(uint cardid) 
    148154        { return get_on_cardid("videodevice", cardid); } 
     155    static QString      GetAudioDevice(uint cardid) 
     156        { return get_on_cardid("audiodevice", cardid); } 
    149157    static QString      GetVBIDevice(uint cardid) 
    150158        { return get_on_cardid("vbidevice", cardid); } 
    151159    static uint         GetHDHRTuner(uint cardid) 
     
    193201 
    194202    static QString      ProbeSubTypeName(uint cardid); 
    195203 
    196     static QStringList  probeInputs(QString device, 
    197                                     QString cardtype = QString::null); 
     204    static QStringList  ProbeVideoInputs(QString device, 
     205                                         QString cardtype = QString::null); 
     206    static QStringList  ProbeAudioInputs(QString device, 
     207                                         QString cardtype = QString::null); 
    198208    static void         GetCardInputs(uint                cardid, 
    199209                                      const QString      &device, 
    200210                                      const QString      &cardtype, 
     
    239249                                   uint32_t &version); 
    240250    static bool         GetV4LInfo(int videofd, QString &card, QString &driver) 
    241251        { uint32_t dummy; return GetV4LInfo(videofd, card, driver, dummy); } 
    242     static InputNames   probeV4LInputs(int videofd, bool &ok); 
     252    static InputNames   ProbeV4LVideoInputs(int videofd, bool &ok); 
     253    static InputNames   ProbeV4LAudioInputs(int videofd, bool &ok); 
    243254 
    244255  private: 
    245     static QStringList  probeV4LInputs(QString device); 
    246     static QStringList  probeDVBInputs(QString device); 
     256    static QStringList  ProbeV4LVideoInputs(QString device); 
     257    static QStringList  ProbeV4LAudioInputs(QString device); 
     258    static QStringList  ProbeDVBInputs(QString device); 
    247259}; 
    248260 
    249261#endif //_CARDUTIL_H_ 
  • libs/libmythtv/videosource.h

     
    367367    } 
    368368}; 
    369369 
     370class TunerCardAudioInput : public ComboBoxSetting, public CaptureCardDBStorage 
     371{ 
     372    Q_OBJECT 
     373  public: 
     374    TunerCardAudioInput(const CaptureCard &parent, 
     375                        QString dev  = QString::null, 
     376                        QString type = QString::null); 
     377 
     378  public slots: 
     379    void fillSelections(const QString &device); 
     380 
     381  private: 
     382    QString last_device; 
     383    QString last_cardtype; 
     384}; 
     385 
    370386class DVBAudioDevice : public LineEditSetting, public CaptureCardDBStorage 
    371387{ 
    372388    Q_OBJECT 
     
    453469    TunerCardInput    *input; 
    454470}; 
    455471 
     472class HDPVRConfigurationGroup: public VerticalConfigurationGroup 
     473{ 
     474   Q_OBJECT 
     475 
     476  public: 
     477    HDPVRConfigurationGroup(CaptureCard &parent); 
     478 
     479  public slots: 
     480    void probeCard(const QString &device); 
     481 
     482  private: 
     483    CaptureCard         &parent; 
     484    TransLabelSetting   *cardinfo; 
     485    TunerCardInput      *videoinput; 
     486    TunerCardAudioInput *audioinput; 
     487}; 
     488 
    456489class DVBCardNum; 
    457490class DVBInput; 
    458491class DVBCardName; 
  • libs/libmythtv/libmythtv.pro

     
    477477    using_ivtv:SOURCES += mpegrecorder.cpp 
    478478    using_ivtv:DEFINES += USING_IVTV 
    479479 
     480    # Support for HD-PVR on Linux 
     481    using_hdpvr:HEADERS *= mpegrecorder.h 
     482    using_hdpvr:SOURCES *= mpegrecorder.cpp 
     483    using_hdpvr:DEFINES += USING_HDPVR 
     484 
    480485    # Support for Linux DVB drivers 
    481486    using_dvb { 
    482487        # Basic DVB types 
  • libs/libmythtv/dbcheck.cpp

     
    1616#define MINIMUM_DBMS_VERSION 5 
    1717 
    1818/// This is the DB schema version expected by the running MythTV instance. 
    19 const QString currentDatabaseVersion = "1221"; 
     19const QString currentDatabaseVersion = "1222"; 
    2020 
    2121static bool UpdateDBVersionNumber(const QString &newnumber); 
    2222static bool performActualUpdate( 
     
    42924292            return false; 
    42934293    } 
    42944294 
     4295    if (dbver == "1221") 
     4296    { 
     4297        const char *updates[] = { 
     4298"INSERT INTO profilegroups SET name = 'HD-PVR Recorders', " 
     4299"  cardtype = 'HDPVR', is_default = 1;", 
     4300"INSERT INTO recordingprofiles SET name = 'Default',      profilegroup = 13;", 
     4301"INSERT INTO recordingprofiles SET name = 'Live TV',      profilegroup = 13;", 
     4302"INSERT INTO recordingprofiles SET name = 'High Quality', profilegroup = 13;", 
     4303"INSERT INTO recordingprofiles SET name = 'Low Quality',  profilegroup = 13;", 
     4304NULL 
     4305}; 
     4306        if (!performActualUpdate(updates, "1222", dbver)) 
     4307            return false; 
     4308    } 
     4309 
    42954310    return true; 
    42964311} 
    42974312 
  • libs/libmythtv/scanwizardscanner.cpp

     
    510510#endif 
    511511 
    512512#ifdef USING_V4L 
    513     if (("V4L" == card_type) || ("MPEG" == card_type)) 
     513    if (("V4L" == card_type) || ("MPEG" == card_type) || 
     514        ("HDPVR" == card_type)) 
     515    { 
    514516        channel = new V4LChannel(NULL, device); 
     517    } 
    515518#endif 
    516519 
    517520#ifdef USING_HDHOMERUN 
  • libs/libmythtv/mpegrecorder.h

     
    104104    int audtype, audsamplerate, audbitratel1, audbitratel2, audbitratel3; 
    105105    int audvolume; 
    106106    unsigned int language; ///< 0 is Main Lang; 1 is SAP Lang; 2 is Dual 
     107    unsigned int low_mpeg4avgbitrate; 
     108    unsigned int low_mpeg4peakbitrate; 
     109    unsigned int medium_mpeg4avgbitrate; 
     110    unsigned int medium_mpeg4peakbitrate; 
     111    unsigned int high_mpeg4avgbitrate; 
     112    unsigned int high_mpeg4peakbitrate; 
    107113 
    108114    // Input file descriptors 
    109115    int chanfd; 
  • libs/libmythtv/signalmonitor.cpp

     
    9393 
    9494#ifdef USING_V4L 
    9595    if ((cardtype.upper() == "V4L") || 
    96         (cardtype.upper() == "MPEG")) 
     96        (cardtype.upper() == "MPEG") || 
     97        (cardtype.upper() == "HDPVR")) 
    9798    { 
    9899        V4LChannel *chan = dynamic_cast<V4LChannel*>(channel); 
    99100        if (chan) 
  • libs/libmythtv/v4lchannel.cpp

     
    279279    int videomode_v4l2 = format_to_mode(fmt.upper(), 2); 
    280280 
    281281    bool ok = false; 
    282     InputNames v4l_inputs = CardUtil::probeV4LInputs(videofd, ok); 
     282    InputNames v4l_inputs = CardUtil::ProbeV4LVideoInputs(videofd, ok); 
    283283 
    284284    // Insert info from hardware 
    285285    uint valid_cnt = 0; 
  • libs/libmythtv/cardutil.cpp

     
    14171417    return !card.isEmpty(); 
    14181418} 
    14191419 
    1420 InputNames CardUtil::probeV4LInputs(int videofd, bool &ok) 
     1420InputNames CardUtil::ProbeV4LVideoInputs(int videofd, bool &ok) 
    14211421{ 
    14221422    (void) videofd; 
    14231423 
     
    14821482    return list; 
    14831483} 
    14841484 
     1485InputNames CardUtil::ProbeV4LAudioInputs(int videofd, bool &ok) 
     1486{ 
     1487    (void) videofd; 
     1488 
     1489    InputNames list; 
     1490    ok = false; 
     1491 
     1492#ifdef USING_V4L 
     1493    bool usingv4l2 = hasV4L2(videofd); 
     1494 
     1495    // V4L v2 query 
     1496    struct v4l2_audio ain; 
     1497    bzero(&ain, sizeof(ain)); 
     1498    while (usingv4l2 && (ioctl(videofd, VIDIOC_ENUMAUDIO, &ain) >= 0)) 
     1499    { 
     1500        QString input((char *)ain.name); 
     1501        list[ain.index] = input; 
     1502        ain.index++; 
     1503    } 
     1504    if (ain.index) 
     1505    { 
     1506        ok = true; 
     1507        return list; 
     1508    } 
     1509 
     1510    ok = true; 
     1511#else // if !USING_V4L 
     1512    list[-1] += QObject::tr( 
     1513        "ERROR, Compile with V4L support to query audio inputs"); 
     1514#endif // !USING_V4L 
     1515    return list; 
     1516} 
     1517 
    14851518InputNames CardUtil::GetConfiguredDVBInputs(uint cardid) 
    14861519{ 
    14871520    InputNames list; 
     
    15021535    return list; 
    15031536} 
    15041537 
    1505 QStringList CardUtil::probeInputs(QString device, QString cardtype) 
     1538QStringList CardUtil::ProbeVideoInputs(QString device, QString cardtype) 
    15061539{ 
    15071540    QStringList ret; 
    15081541 
     
    15141547        ret += "MPEG2TS"; 
    15151548    } 
    15161549    else if ("DVB" == cardtype) 
    1517         ret += probeDVBInputs(device); 
     1550        ret += ProbeDVBInputs(device); 
    15181551    else 
    1519         ret += probeV4LInputs(device); 
     1552        ret += ProbeV4LVideoInputs(device); 
    15201553 
    15211554    return ret; 
    15221555} 
    15231556 
    1524 QStringList CardUtil::probeV4LInputs(QString device) 
     1557QStringList CardUtil::ProbeAudioInputs(QString device, QString cardtype) 
    15251558{ 
     1559    VERBOSE(VB_IMPORTANT, QString("ProbeAudioInputs(%1,%2)").arg(device).arg(cardtype)); 
     1560    QStringList ret; 
     1561 
     1562    if ("HDPVR" == cardtype) 
     1563        ret += ProbeV4LAudioInputs(device); 
     1564 
     1565    return ret; 
     1566} 
     1567 
     1568QStringList CardUtil::ProbeV4LVideoInputs(QString device) 
     1569{ 
    15261570    bool ok; 
    15271571    QStringList ret; 
    15281572    int videofd = open(device.ascii(), O_RDWR); 
     
    15321576                           "to probe its inputs.").arg(device); 
    15331577        return ret; 
    15341578    } 
    1535     InputNames list = CardUtil::probeV4LInputs(videofd, ok); 
     1579    InputNames list = CardUtil::ProbeV4LVideoInputs(videofd, ok); 
    15361580    close(videofd); 
    15371581 
    15381582    if (!ok) 
     
    15511595    return ret; 
    15521596} 
    15531597 
    1554 QStringList CardUtil::probeDVBInputs(QString device) 
     1598QStringList CardUtil::ProbeV4LAudioInputs(QString device) 
    15551599{ 
     1600    VERBOSE(VB_IMPORTANT, QString("ProbeV4LAudioInputs(%1)").arg(device)); 
     1601 
     1602    bool ok; 
    15561603    QStringList ret; 
     1604    int videofd = open(device.ascii(), O_RDWR); 
     1605    if (videofd < 0) 
     1606    { 
     1607        VERBOSE(VB_IMPORTANT, QString("ProbeAudioInputs() -> couldn't open device")); 
     1608        ret += QObject::tr("Could not open '%1' " 
     1609                           "to probe its inputs.").arg(device); 
     1610        return ret; 
     1611    } 
     1612    InputNames list = CardUtil::ProbeV4LAudioInputs(videofd, ok); 
     1613    close(videofd); 
    15571614 
     1615    if (!ok) 
     1616    { 
     1617        ret += list[-1]; 
     1618        return ret; 
     1619    } 
     1620 
     1621    InputNames::iterator it; 
     1622    for (it = list.begin(); it != list.end(); ++it) 
     1623    { 
     1624        if (it.key() >= 0) 
     1625            ret += *it; 
     1626    } 
     1627 
     1628    return ret; 
     1629} 
     1630 
     1631QStringList CardUtil::ProbeDVBInputs(QString device) 
     1632{ 
     1633    QStringList ret; 
     1634 
    15581635#ifdef USING_DVB 
    15591636    uint cardid = CardUtil::GetFirstCardID(device); 
    15601637    if (!cardid) 
     
    16391716        inputs += "MPEG2TS"; 
    16401717    } 
    16411718    else if ("DVB" != cardtype) 
    1642         inputs += probeV4LInputs(device); 
     1719        inputs += ProbeV4LVideoInputs(device); 
    16431720 
    16441721    QString dev_label = GetDeviceLabel(cardid, cardtype, device); 
    16451722 
  • libs/libmythtv/videosource.cpp

     
    15211521    input(new TunerCardInput(parent)) 
    15221522{ 
    15231523    VideoDevice *device = 
    1524         new VideoDevice(parent, 0, 15, QString::null, "(ivtv|hdpvr)"); 
     1524        new VideoDevice(parent, 0, 15, QString::null, "ivtv"); 
    15251525 
    15261526    cardinfo->setLabel(tr("Probed info")); 
    15271527 
     
    15531553    input->fillSelections(device); 
    15541554} 
    15551555 
     1556HDPVRConfigurationGroup::HDPVRConfigurationGroup(CaptureCard &a_parent) : 
     1557    VerticalConfigurationGroup(false, true, false, false), 
     1558    parent(a_parent), cardinfo(new TransLabelSetting()), 
     1559    videoinput(new TunerCardInput(parent)), 
     1560    audioinput(new TunerCardAudioInput(parent, QString::null, "HDPVR")) 
     1561{ 
     1562    VideoDevice *device = 
     1563        new VideoDevice(parent, 0, 15, QString::null, "hdpvr"); 
     1564 
     1565    cardinfo->setLabel(tr("Probed info")); 
     1566 
     1567    addChild(device); 
     1568    addChild(cardinfo); 
     1569    addChild(videoinput); 
     1570    addChild(audioinput); 
     1571 
     1572    connect(device, SIGNAL(valueChanged(const QString&)), 
     1573            this,   SLOT(  probeCard(   const QString&))); 
     1574 
     1575    probeCard(device->getValue()); 
     1576} 
     1577 
     1578void HDPVRConfigurationGroup::probeCard(const QString &device) 
     1579{ 
     1580    QString cn = tr("Failed to open"), ci = cn, dn = QString::null; 
     1581 
     1582    int videofd = open(device.ascii(), O_RDWR); 
     1583    if (videofd >= 0) 
     1584    { 
     1585        if (!CardUtil::GetV4LInfo(videofd, cn, dn)) 
     1586            ci = cn = tr("Failed to probe"); 
     1587        else if (!dn.isEmpty()) 
     1588            ci = cn + "  [" + dn + "]"; 
     1589        close(videofd); 
     1590    } 
     1591 
     1592    cardinfo->setValue(ci); 
     1593    videoinput->fillSelections(device); 
     1594    audioinput->fillSelections(device); 
     1595} 
     1596 
    15561597CaptureCardGroup::CaptureCardGroup(CaptureCard &parent) : 
    15571598    TriggeredConfigurationGroup(true, true, false, false) 
    15581599{ 
     
    15691610# ifdef USING_IVTV 
    15701611    addTarget("MPEG",      new MPEGConfigurationGroup(parent)); 
    15711612# endif // USING_IVTV 
     1613# ifdef USING_HDPVR 
     1614    addTarget("HDPVR",     new HDPVRConfigurationGroup(parent)); 
     1615# endif // USING_HDPVR 
    15721616#endif // USING_V4L 
    15731617 
    15741618#ifdef USING_DVB 
     
    17551799    setting->addSelection( 
    17561800        QObject::tr("MPEG-2 encoder card (PVR-x50, PVR-500)"), "MPEG"); 
    17571801# endif // USING_IVTV 
     1802# ifdef USING_HDPVR 
     1803    setting->addSelection( 
     1804        QObject::tr("H.264 encoder card (HD-PVR)"), "HDPVR"); 
     1805# endif // USING_HDPVR 
    17581806#endif // USING_V4L 
    17591807 
    17601808#ifdef USING_DVB 
     
    29653013 
    29663014    last_device = device; 
    29673015    QStringList inputs = 
    2968         CardUtil::probeInputs(device, last_cardtype); 
     3016        CardUtil::ProbeVideoInputs(device, last_cardtype); 
    29693017 
    29703018    for (QStringList::iterator i = inputs.begin(); i != inputs.end(); ++i) 
    29713019        addSelection(*i); 
    29723020} 
    29733021 
     3022TunerCardAudioInput::TunerCardAudioInput(const CaptureCard &parent, 
     3023                                         QString dev, QString type) : 
     3024    ComboBoxSetting(this), CaptureCardDBStorage(this, parent, "audiodevice"), 
     3025    last_device(dev), last_cardtype(type) 
     3026{ 
     3027    setLabel(QObject::tr("Audio input")); 
     3028    int cardid = parent.getCardID(); 
     3029    if (cardid <= 0) 
     3030        return; 
     3031 
     3032    last_cardtype = CardUtil::GetRawCardType(cardid); 
     3033    last_device   = CardUtil::GetAudioDevice(cardid); 
     3034} 
     3035 
     3036void TunerCardAudioInput::fillSelections(const QString &device) 
     3037{ 
     3038    clearSelections(); 
     3039 
     3040    if (device.isEmpty()) 
     3041        return; 
     3042 
     3043    last_device = device; 
     3044    QStringList inputs = 
     3045        CardUtil::ProbeAudioInputs(device, last_cardtype); 
     3046 
     3047    for (uint i = 0; i < inputs.size(); i++) 
     3048    { 
     3049        addSelection(inputs[i], QString::number(i), 
     3050                     last_device == QString::number(i)); 
     3051    } 
     3052} 
     3053 
    29743054class DVBExtra : public ConfigurationWizard 
    29753055{ 
    29763056  public: 
  • libs/libmythtv/mpegrecorder.cpp

     
    9393    audbitratel1(14),         audbitratel2(14), 
    9494    audbitratel3(10), 
    9595    audvolume(80),            language(0), 
     96    low_mpeg4avgbitrate(4500),    low_mpeg4peakbitrate(6000), 
     97    medium_mpeg4avgbitrate(9000), medium_mpeg4peakbitrate(13500), 
     98    high_mpeg4avgbitrate(13500),  high_mpeg4peakbitrate(20200), 
    9699    // Input file descriptors 
    97100    chanfd(-1),               readfd(-1), 
    98101    // TS packet handling 
     
    178181    } 
    179182    else if (opt == "mpeg2audvolume") 
    180183        audvolume = value; 
     184    else if (opt.right(16) == "_mpeg4avgbitrate") 
     185    { 
     186        if (opt.left(3) == "low") 
     187            low_mpeg4avgbitrate = value; 
     188        else if (opt.left(6) == "medium") 
     189            medium_mpeg4avgbitrate = value; 
     190        else if (opt.left(4) == "high") 
     191            high_mpeg4avgbitrate = value; 
     192        else 
     193            RecorderBase::SetOption(opt, value); 
     194    } 
     195    else if (opt.right(17) == "_mpeg4peakbitrate") 
     196    { 
     197        if (opt.left(3) == "low") 
     198            low_mpeg4peakbitrate = value; 
     199        else if (opt.left(6) == "medium") 
     200            medium_mpeg4peakbitrate = value; 
     201        else if (opt.left(4) == "high") 
     202            high_mpeg4peakbitrate = value; 
     203        else 
     204            RecorderBase::SetOption(opt, value); 
     205    } 
    181206    else 
    182207        RecorderBase::SetOption(opt, value); 
    183208} 
     
    274299        SetOption("videodevice", videodev); 
    275300    } 
    276301 
     302    SetOption("audiodevice", audiodev); 
     303 
    277304    SetOption("tvformat", gContext->GetSetting("TVFormat")); 
    278305    SetOption("vbiformat", gContext->GetSetting("VbiFormat")); 
    279306 
     
    679706 
    680707        add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_STREAM_TYPE, 
    681708                     streamtype_ivtv_to_v4l2(GetFilteredStreamType())); 
     709 
    682710    } 
     711    else 
     712    { 
     713        maxbitrate = high_mpeg4peakbitrate; 
     714        bitrate    = high_mpeg4avgbitrate; 
     715    } 
    683716 
    684717    add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_PEAK, 
    685718                 maxbitrate * 1000); 
     
    732765        _keyframedist = ext_ctrl.value; 
    733766    } 
    734767 
     768    bool ok; 
     769    int audioinput = audiodevice.toUInt(&ok); 
     770    if (ok) 
     771    { 
     772        struct v4l2_audio ain; 
     773        bzero(&ain, sizeof(ain)); 
     774        ain.index = audioinput; 
     775        if (ioctl(chanfd, VIDIOC_ENUMAUDIO, &ain) < 0) 
     776        { 
     777            VERBOSE(VB_IMPORTANT, LOC_WARN + 
     778                    "Unable to get audio input."); 
     779        } 
     780        else 
     781        { 
     782            ain.index = audioinput; 
     783            if (ioctl(chanfd, VIDIOC_S_AUDIO, &ain) < 0) 
     784            { 
     785                VERBOSE(VB_IMPORTANT, LOC_WARN + 
     786                        "Unable to set audio input."); 
     787            } 
     788        } 
     789    } 
     790 
    735791    return true; 
    736792} 
    737793 
  • libs/libmythtv/tv_rec.cpp

     
    209209        CloseChannel(); 
    210210        init_run = true; 
    211211#endif 
    212         if (genOpt.cardtype != "MPEG") 
     212        if ((genOpt.cardtype != "MPEG") && (genOpt.cardtype != "HDPVR")) 
    213213            rbFileExt = "nuv"; 
    214214    } 
    215215 
     
    952952 *  \brief Allocates and initializes the RecorderBase instance. 
    953953 * 
    954954 *  Based on the card type, one of the possible recorders are started. 
    955  *  If the card type is "MPEG" a MpegRecorder is started, 
     955 *  If the card type is "MPEG" or "HDPVR" a MpegRecorder is started, 
    956956 *  if the card type is "HDHOMERUN" a HDHRRecorder is started, 
    957957 *  if the card type is "FIREWIRE" a FirewireRecorder is started, 
    958958 *  if the card type is "DVB" a DVBRecorder is started, 
     
    970970        recorder = new MpegRecorder(this); 
    971971#endif // USING_IVTV 
    972972    } 
     973    if (genOpt.cardtype == "HDPVR") 
     974    { 
     975#ifdef USING_HDPVR 
     976        recorder = new MpegRecorder(this); 
     977#endif // USING_HDPVR 
     978    } 
    973979    else if (genOpt.cardtype == "FIREWIRE") 
    974980    { 
    975981#ifdef USING_FIREWIRE 
     
    25762582    long long bitrate; 
    25772583    if (genOpt.cardtype == "MPEG") 
    25782584        bitrate = 10080000LL; // use DVD max bit rate 
     2585    if (genOpt.cardtype == "HDPVR") 
     2586        bitrate = 20200000LL; // Peek bit rate for HD-PVR 
    25792587    else if (genOpt.cardtype == "DBOX2") 
    25802588        bitrate = 10080000LL; // use DVD max bit rate 
    25812589    else if (!CardUtil::IsEncoder(genOpt.cardtype)) 
  • libs/libmythtv/recordingprofile.cpp

     
    652652    }; 
    653653}; 
    654654 
    655 class MPEG2bitrate : public SliderSetting, public CodecParamStorage 
     655class AverageBitrate : public SliderSetting, public CodecParamStorage 
    656656{ 
    657657  public: 
    658     MPEG2bitrate(const RecordingProfile &parent) : 
    659         SliderSetting(this, 1000, 16000, 100), 
    660         CodecParamStorage(this, parent, "mpeg2bitrate") 
     658    AverageBitrate(const RecordingProfile &parent, 
     659                   QString setting = "mpeg2bitrate", 
     660                   uint min_br = 1000, uint max_br = 16000, 
     661                   uint default_br = 4500, uint increment = 100, 
     662                   QString label = QString::null) : 
     663        SliderSetting(this, min_br, max_br, increment), 
     664        CodecParamStorage(this, parent, setting) 
    661665    { 
    662  
    663         setLabel(QObject::tr("Bitrate")); 
    664         setValue(4500); 
    665         setHelpText(QObject::tr("Bitrate in kilobits/second.  2200Kbps is " 
    666                     "approximately 1 Gigabyte per hour.")); 
     666        if (label.isEmpty()) 
     667            label = QObject::tr("Avg. Bitrate"); 
     668        setLabel(label); 
     669        setValue(default_br); 
     670        setHelpText(QObject::tr( 
     671                        "Average bit rate in kilobits/second. " 
     672                        "2200Kbps is approximately 1 Gigabyte per hour.")); 
    667673    }; 
    668674}; 
    669675 
    670 class MPEG2maxBitrate : public SliderSetting, public CodecParamStorage 
     676class PeakBitrate : public SliderSetting, public CodecParamStorage 
    671677{ 
    672678  public: 
    673     MPEG2maxBitrate(const RecordingProfile &parent) : 
    674         SliderSetting(this, 1000, 16000, 100), 
    675         CodecParamStorage(this, parent, "mpeg2maxbitrate") 
     679    PeakBitrate(const RecordingProfile &parent, 
     680                QString setting = "mpeg2maxbitrate", 
     681                uint min_br = 1000, uint max_br = 16000, 
     682                uint default_br = 6000, uint increment = 100, 
     683                QString label = QString::null) : 
     684        SliderSetting(this, min_br, max_br, increment), 
     685        CodecParamStorage(this, parent, setting) 
    676686    { 
    677  
    678         setLabel(QObject::tr("Max. Bitrate")); 
    679         setValue(6000); 
    680         setHelpText(QObject::tr("Maximum Bitrate in kilobits/second.  " 
     687        if (label.isEmpty()) 
     688            label = QObject::tr("Max. Bitrate"); 
     689        setLabel(label); 
     690        setValue(default_br); 
     691        setHelpText(QObject::tr("Maximum bit rate in kilobits/second. " 
    681692                    "2200Kbps is approximately 1 Gigabyte per hour.")); 
    682693    }; 
    683694}; 
     
    819830 
    820831        params = new VerticalConfigurationGroup(false); 
    821832        params->setLabel(QObject::tr("MPEG-2 Parameters")); 
    822         params->addChild(new MPEG2bitrate(parent)); 
     833        params->addChild(new AverageBitrate(parent)); 
    823834        params->addChild(new ScaleBitrate(parent)); 
    824835        //params->addChild(new MPEG4MaxQuality(parent)); 
    825836        //params->addChild(new MPEG4MinQuality(parent)); 
     
    843854        params->setLabel(QObject::tr("MPEG-2 Hardware Encoder")); 
    844855        params->addChild(new MPEG2streamType(parent)); 
    845856        params->addChild(new MPEG2aspectRatio(parent)); 
    846         params->addChild(new MPEG2bitrate(parent)); 
    847         params->addChild(new MPEG2maxBitrate(parent)); 
     857        params->addChild(new AverageBitrate(parent)); 
     858        params->addChild(new PeakBitrate(parent)); 
    848859 
    849860        addTarget("MPEG-2 Hardware Encoder", params); 
     861 
     862        params = new VerticalConfigurationGroup(false); 
     863        params->setLabel(QObject::tr("MPEG-4 AVC Hardware Encoder")); 
     864        ConfigurationGroup *h0 = new HorizontalConfigurationGroup( 
     865            true, false, true, true); 
     866        h0->setLabel(QObject::tr("Low Resolution")); 
     867        h0->addChild(new AverageBitrate(parent, "low_mpeg4avgbitrate", 
     868                                        1000, 13500, 4500, 500)); 
     869        h0->addChild(new PeakBitrate(parent, "low_mpeg4peakbitrate", 
     870                                     1100, 20200, 6000, 500)); 
     871        params->addChild(h0); 
     872        ConfigurationGroup *h1 = new HorizontalConfigurationGroup( 
     873            true, false, true, true); 
     874        h1->setLabel(QObject::tr("Medium Resolution")); 
     875        h1->addChild(new AverageBitrate(parent, "medium_mpeg4avgbitrate", 
     876                                        1000, 13500, 9000, 500)); 
     877        h1->addChild(new PeakBitrate(parent, "medium_mpeg4peakbitrate", 
     878                                     1100, 20200, 11000, 500)); 
     879        params->addChild(h1); 
     880        ConfigurationGroup *h2 = new HorizontalConfigurationGroup( 
     881            true, false, true, true); 
     882        h2->setLabel(QObject::tr("High Resolution")); 
     883        h2->addChild(new AverageBitrate(parent, "high_mpeg4avgbitrate", 
     884                                        1000, 13500, 13500, 500)); 
     885        h2->addChild(new PeakBitrate(parent, "high_mpeg4peakbitrate", 
     886                                     1100, 20200, 20200, 500)); 
     887        params->addChild(h2); 
     888        addTarget("MPEG-4 AVC Hardware Encoder", params); 
    850889    } 
    851890 
    852891    void selectCodecs(QString groupType) 
    853892    { 
    854893        if (!groupType.isNull()) 
    855894        { 
    856             if (groupType == "MPEG") 
     895            if (groupType == "HDPVR") 
     896               codecName->addSelection("MPEG-4 AVC Hardware Encoder"); 
     897            else if (groupType == "MPEG") 
    857898               codecName->addSelection("MPEG-2 Hardware Encoder"); 
    858899            else if (groupType == "MJPEG") 
    859900                codecName->addSelection("Hardware MJPEG"); 
     
    12101251    if (isEncoder) 
    12111252    { 
    12121253        QString tvFormat = gContext->GetSetting("TVFormat"); 
    1213         addChild(new ImageSize(*this, tvFormat, profileName)); 
     1254        if (type.upper() != "HDPVR") 
     1255            addChild(new ImageSize(*this, tvFormat, profileName)); 
    12141256 
    12151257        videoSettings = new VideoCompressionSettings(*this, profileName); 
    12161258        addChild(videoSettings); 
    12171259 
    1218         audioSettings = new AudioCompressionSettings(*this, profileName); 
    1219         addChild(audioSettings); 
     1260        if (type.upper() != "HDPVR") 
     1261        { 
     1262            audioSettings = new AudioCompressionSettings(*this, profileName); 
     1263            addChild(audioSettings); 
     1264        } 
    12201265 
    12211266        if (!profileName.isEmpty() && profileName.left(11) == "Transcoders") 
    12221267        { 
  • libs/libmythtv/scanwizardhelpers.cpp

     
    5959# ifdef USING_IVTV 
    6060    cardTypes += ",'MPEG'"; 
    6161# endif // USING_IVTV 
     62# ifdef USING_HDPVR 
     63    cardTypes += ",'HDPVR'"; 
     64# endif // USING_HDPVR 
    6265#endif // USING_V4L 
    6366 
    6467#ifdef USING_IPTV