Ticket #5443: 5443-recordingprofiles-schema1222-1223.patch

File 5443-recordingprofiles-schema1222-1223.patch, 30.3 KB (added by robert.mcnamara@…, 17 years ago)

Updated Patch for HD-PVR recording profiles

  • 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
     
    30193025if enabled backend; then
    30203026  echo "Video4Linux sup.          ${v4l-no}"
    30213027  echo "ivtv support              ${ivtv-no}"
     3028  echo "hdpvr support             ${hdpvr-no}"
    30223029  echo "FireWire support          ${firewire-no}"
    30233030  echo "DVB support               ${dvb-no} [$dvb_path]"
    30243031  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

     
    365365    }
    366366};
    367367
     368class TunerCardAudioInput : public ComboBoxSetting, public CaptureCardDBStorage
     369{
     370    Q_OBJECT
     371  public:
     372    TunerCardAudioInput(const CaptureCard &parent,
     373                        QString dev  = QString::null,
     374                        QString type = QString::null);
     375
     376  public slots:
     377    void fillSelections(const QString &device);
     378
     379  private:
     380    QString last_device;
     381    QString last_cardtype;
     382};
     383
    368384class DVBAudioDevice : public LineEditSetting, public CaptureCardDBStorage
    369385{
    370386    Q_OBJECT
     
    455471    TunerCardInput    *input;
    456472};
    457473
     474class HDPVRConfigurationGroup: public VerticalConfigurationGroup
     475{
     476   Q_OBJECT
     477
     478  public:
     479    HDPVRConfigurationGroup(CaptureCard &parent);
     480
     481  public slots:
     482    void probeCard(const QString &device);
     483
     484  private:
     485    CaptureCard         &parent;
     486    TransLabelSetting   *cardinfo;
     487    TunerCardInput      *videoinput;
     488    TunerCardAudioInput *audioinput;
     489};
     490
    458491class DVBCardNum;
    459492class DVBInput;
    460493class 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

     
    1717#define MINIMUM_DBMS_VERSION 5
    1818
    1919/// This is the DB schema version expected by the running MythTV instance.
    20 const QString currentDatabaseVersion = "1222";
     20const QString currentDatabaseVersion = "1223";
    2121
    2222static bool UpdateDBVersionNumber(const QString &newnumber);
    2323static bool performActualUpdate(
     
    43004300"UPDATE channel SET commmethod='261' WHERE commmethod='511'",
    43014301NULL
    43024302};
    4303         if (!performActualUpdate(updates, "1221", dbver))
    4304             return false;
    4305     }
    4306 
    4307     if (dbver == "1221")
    4308     {
    4309         bool ok = true;
    4310         MSqlQuery query(MSqlQuery::InitCon());
    4311         query.prepare(
    4312             "SELECT cardid, videodevice "
    4313             "FROM capturecard "
    4314             "WHERE cardtype = 'DVB'");
    4315 
    4316         if (!query.exec())
    4317         {
    4318             MythDB::DBError(
    4319                 "Could not perform select for update to '1222'", query);
    4320             ok = false;
    4321         }
    4322         else
    4323         {
    4324             MSqlQuery query2(MSqlQuery::InitCon());
    4325             while (query.next())
    4326             {
    4327                 bool conv_ok;
    4328                 uint dvbnum = query.value(1).toString().toUInt(&conv_ok);
    4329                 if (!conv_ok)
    4330                     continue;
    4331 
    4332                 QString videodevice =
    4333                     QString("/dev/dvb/adapter%1/frontend0").arg(dvbnum);
    4334 
    4335                 query2.prepare(
    4336                     "UPDATE capturecard "
    4337                     "SET videodevice = :VIDEODEV "
    4338                     "WHERE cardid = :CARDID");
    4339                 query2.bindValue(":VIDEODEV", videodevice);
    4340                 query2.bindValue(":CARDID",   query.value(0).toUInt());
    4341                 if (!query2.exec())
    4342                 {
    4343                     MythDB::DBError(
    4344                         "Could not perform update for '1222'", query2);
    4345                     ok = false;
    4346                 }
    4347             }
    4348         }
    4349 
    4350         if (!ok)
    4351             return false;
    4352 
    4353         const char *updates[] = { NULL };
    43544303        if (!performActualUpdate(updates, "1222", dbver))
    43554304            return false;
    43564305    }
    43574306
     4307    if (dbver == "1222")
     4308    {
     4309        const char *updates[] = {
     4310        "INSERT INTO profilegroups SET name = 'HD-PVR Recorders', "
     4311        "  cardtype = 'HDPVR', is_default = 1;",
     4312        "INSERT INTO recordingprofiles SET name = 'Default',      profilegroup = 13;",
     4313        "INSERT INTO recordingprofiles SET name = 'Live TV',      profilegroup = 13;",
     4314        "INSERT INTO recordingprofiles SET name = 'High Quality', profilegroup = 13;",
     4315        "INSERT INTO recordingprofiles SET name = 'Low Quality',  profilegroup = 13;",
     4316        NULL
     4317    };
     4318        if (!performActualUpdate(updates, "1223", dbver))
     4319            return false;
     4320    }
    43584321
    43594322    return true;
    43604323}
  • 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

     
    14091409    return !card.isEmpty();
    14101410}
    14111411
    1412 InputNames CardUtil::probeV4LInputs(int videofd, bool &ok)
     1412InputNames CardUtil::ProbeV4LVideoInputs(int videofd, bool &ok)
    14131413{
    14141414    (void) videofd;
    14151415
     
    14741474    return list;
    14751475}
    14761476
     1477InputNames CardUtil::ProbeV4LAudioInputs(int videofd, bool &ok)
     1478{
     1479    (void) videofd;
     1480
     1481    InputNames list;
     1482    ok = false;
     1483
     1484#ifdef USING_V4L
     1485    bool usingv4l2 = hasV4L2(videofd);
     1486
     1487    // V4L v2 query
     1488    struct v4l2_audio ain;
     1489    bzero(&ain, sizeof(ain));
     1490    while (usingv4l2 && (ioctl(videofd, VIDIOC_ENUMAUDIO, &ain) >= 0))
     1491    {
     1492        QString input((char *)ain.name);
     1493        list[ain.index] = input;
     1494        ain.index++;
     1495    }
     1496    if (ain.index)
     1497    {
     1498        ok = true;
     1499        return list;
     1500    }
     1501
     1502    ok = true;
     1503#else // if !USING_V4L
     1504    list[-1] += QObject::tr(
     1505        "ERROR, Compile with V4L support to query audio inputs");
     1506#endif // !USING_V4L
     1507    return list;
     1508}
     1509
    14771510InputNames CardUtil::GetConfiguredDVBInputs(uint cardid)
    14781511{
    14791512    InputNames list;
     
    14941527    return list;
    14951528}
    14961529
    1497 QStringList CardUtil::probeInputs(QString device, QString cardtype)
     1530QStringList CardUtil::ProbeVideoInputs(QString device, QString cardtype)
    14981531{
    14991532    QStringList ret;
    15001533
     
    15061539        ret += "MPEG2TS";
    15071540    }
    15081541    else if ("DVB" == cardtype)
    1509         ret += probeDVBInputs(device);
     1542        ret += ProbeDVBInputs(device);
    15101543    else
    1511         ret += probeV4LInputs(device);
     1544        ret += ProbeV4LVideoInputs(device);
    15121545
    15131546    return ret;
    15141547}
    15151548
    1516 QStringList CardUtil::probeV4LInputs(QString device)
     1549QStringList CardUtil::ProbeAudioInputs(QString device, QString cardtype)
    15171550{
     1551    VERBOSE(VB_IMPORTANT, QString("ProbeAudioInputs(%1,%2)").arg(device).arg(cardtype));
     1552    QStringList ret;
     1553
     1554    if ("HDPVR" == cardtype)
     1555        ret += ProbeV4LAudioInputs(device);
     1556
     1557    return ret;
     1558}
     1559
     1560QStringList CardUtil::ProbeV4LVideoInputs(QString device)
     1561{
    15181562    bool ok;
    15191563    QStringList ret;
    15201564    int videofd = open(device.ascii(), O_RDWR);
     
    15241568                           "to probe its inputs.").arg(device);
    15251569        return ret;
    15261570    }
    1527     InputNames list = CardUtil::probeV4LInputs(videofd, ok);
     1571    InputNames list = CardUtil::ProbeV4LVideoInputs(videofd, ok);
    15281572    close(videofd);
    15291573
    15301574    if (!ok)
     
    15431587    return ret;
    15441588}
    15451589
    1546 QStringList CardUtil::probeDVBInputs(QString device)
     1590QStringList CardUtil::ProbeV4LAudioInputs(QString device)
    15471591{
     1592    VERBOSE(VB_IMPORTANT, QString("ProbeV4LAudioInputs(%1)").arg(device));
     1593
     1594    bool ok;
    15481595    QStringList ret;
     1596    int videofd = open(device.ascii(), O_RDWR);
     1597    if (videofd < 0)
     1598    {
     1599        VERBOSE(VB_IMPORTANT, QString("ProbeAudioInputs() -> couldn't open device"));
     1600        ret += QObject::tr("Could not open '%1' "
     1601                           "to probe its inputs.").arg(device);
     1602        return ret;
     1603    }
     1604    InputNames list = CardUtil::ProbeV4LAudioInputs(videofd, ok);
     1605    close(videofd);
    15491606
     1607    if (!ok)
     1608    {
     1609        ret += list[-1];
     1610        return ret;
     1611    }
     1612
     1613    InputNames::iterator it;
     1614    for (it = list.begin(); it != list.end(); ++it)
     1615    {
     1616        if (it.key() >= 0)
     1617            ret += *it;
     1618    }
     1619
     1620    return ret;
     1621}
     1622
     1623QStringList CardUtil::ProbeDVBInputs(QString device)
     1624{
     1625    QStringList ret;
     1626
    15501627#ifdef USING_DVB
    15511628    uint cardid = CardUtil::GetFirstCardID(device);
    15521629    if (!cardid)
     
    16311708        inputs += "MPEG2TS";
    16321709    }
    16331710    else if ("DVB" != cardtype)
    1634         inputs += probeV4LInputs(device);
     1711        inputs += ProbeV4LVideoInputs(device);
    16351712
    16361713    QString dev_label = GetDeviceLabel(cardid, cardtype, device);
    16371714
  • libs/libmythtv/videosource.cpp

     
    15131513    input(new TunerCardInput(parent))
    15141514{
    15151515    VideoDevice *device =
    1516         new VideoDevice(parent, 0, 15, QString::null, "(ivtv|hdpvr)");
     1516        new VideoDevice(parent, 0, 15, QString::null, "ivtv");
    15171517
    15181518    cardinfo->setLabel(tr("Probed info"));
    15191519
     
    15451545    input->fillSelections(device);
    15461546}
    15471547
     1548HDPVRConfigurationGroup::HDPVRConfigurationGroup(CaptureCard &a_parent) :
     1549    VerticalConfigurationGroup(false, true, false, false),
     1550    parent(a_parent), cardinfo(new TransLabelSetting()),
     1551    videoinput(new TunerCardInput(parent)),
     1552    audioinput(new TunerCardAudioInput(parent, QString::null, "HDPVR"))
     1553{
     1554    VideoDevice *device =
     1555        new VideoDevice(parent, 0, 15, QString::null, "hdpvr");
     1556
     1557    cardinfo->setLabel(tr("Probed info"));
     1558
     1559    addChild(device);
     1560    addChild(cardinfo);
     1561    addChild(videoinput);
     1562    addChild(audioinput);
     1563
     1564    connect(device, SIGNAL(valueChanged(const QString&)),
     1565            this,   SLOT(  probeCard(   const QString&)));
     1566
     1567    probeCard(device->getValue());
     1568}
     1569
     1570void HDPVRConfigurationGroup::probeCard(const QString &device)
     1571{
     1572    QString cn = tr("Failed to open"), ci = cn, dn = QString::null;
     1573
     1574    int videofd = open(device.ascii(), O_RDWR);
     1575    if (videofd >= 0)
     1576    {
     1577        if (!CardUtil::GetV4LInfo(videofd, cn, dn))
     1578            ci = cn = tr("Failed to probe");
     1579        else if (!dn.isEmpty())
     1580            ci = cn + "  [" + dn + "]";
     1581        close(videofd);
     1582    }
     1583
     1584    cardinfo->setValue(ci);
     1585    videoinput->fillSelections(device);
     1586    audioinput->fillSelections(device);
     1587}
     1588
    15481589CaptureCardGroup::CaptureCardGroup(CaptureCard &parent) :
    15491590    TriggeredConfigurationGroup(true, true, false, false)
    15501591{
     
    15611602# ifdef USING_IVTV
    15621603    addTarget("MPEG",      new MPEGConfigurationGroup(parent));
    15631604# endif // USING_IVTV
     1605# ifdef USING_HDPVR
     1606    addTarget("HDPVR",     new HDPVRConfigurationGroup(parent));
     1607# endif // USING_HDPVR
    15641608#endif // USING_V4L
    15651609
    15661610#ifdef USING_DVB
     
    17471791    setting->addSelection(
    17481792        QObject::tr("MPEG-2 encoder card (PVR-x50, PVR-500)"), "MPEG");
    17491793# endif // USING_IVTV
     1794# ifdef USING_HDPVR
     1795    setting->addSelection(
     1796        QObject::tr("H.264 encoder card (HD-PVR)"), "HDPVR");
     1797# endif // USING_HDPVR
    17501798#endif // USING_V4L
    17511799
    17521800#ifdef USING_DVB
     
    29583006
    29593007    last_device = device;
    29603008    QStringList inputs =
    2961         CardUtil::probeInputs(device, last_cardtype);
     3009        CardUtil::ProbeVideoInputs(device, last_cardtype);
    29623010
    29633011    for (QStringList::iterator i = inputs.begin(); i != inputs.end(); ++i)
    29643012        addSelection(*i);
    29653013}
    29663014
     3015TunerCardAudioInput::TunerCardAudioInput(const CaptureCard &parent,
     3016                                         QString dev, QString type) :
     3017    ComboBoxSetting(this), CaptureCardDBStorage(this, parent, "audiodevice"),
     3018    last_device(dev), last_cardtype(type)
     3019{
     3020    setLabel(QObject::tr("Audio input"));
     3021    int cardid = parent.getCardID();
     3022    if (cardid <= 0)
     3023        return;
     3024
     3025    last_cardtype = CardUtil::GetRawCardType(cardid);
     3026    last_device   = CardUtil::GetAudioDevice(cardid);
     3027}
     3028
     3029void TunerCardAudioInput::fillSelections(const QString &device)
     3030{
     3031    clearSelections();
     3032
     3033    if (device.isEmpty())
     3034        return;
     3035
     3036    last_device = device;
     3037    QStringList inputs =
     3038        CardUtil::ProbeAudioInputs(device, last_cardtype);
     3039
     3040    for (uint i = 0; i < inputs.size(); i++)
     3041    {
     3042        addSelection(inputs[i], QString::number(i),
     3043                     last_device == QString::number(i));
     3044    }
     3045}
     3046
    29673047class DVBExtra : public ConfigurationWizard
    29683048{
    29693049  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
     
    177180    }
    178181    else if (opt == "mpeg2audvolume")
    179182        audvolume = value;
     183    else if (opt.right(16) == "_mpeg4avgbitrate")
     184    {
     185        if (opt.left(3) == "low")
     186            low_mpeg4avgbitrate = value;
     187        else if (opt.left(6) == "medium")
     188            medium_mpeg4avgbitrate = value;
     189        else if (opt.left(4) == "high")
     190            high_mpeg4avgbitrate = value;
     191        else
     192            RecorderBase::SetOption(opt, value);
     193    }
     194    else if (opt.right(17) == "_mpeg4peakbitrate")
     195    {
     196        if (opt.left(3) == "low")
     197            low_mpeg4peakbitrate = value;
     198        else if (opt.left(6) == "medium")
     199            medium_mpeg4peakbitrate = value;
     200        else if (opt.left(4) == "high")
     201            high_mpeg4peakbitrate = value;
     202        else
     203            RecorderBase::SetOption(opt, value);
     204    }
    180205    else
    181206        RecorderBase::SetOption(opt, value);
    182207}
     
    273298        SetOption("videodevice", videodev);
    274299    }
    275300
     301    SetOption("audiodevice", audiodev);
     302
    276303    SetOption("tvformat", gContext->GetSetting("TVFormat"));
    277304    SetOption("vbiformat", gContext->GetSetting("VbiFormat"));
    278305
     
    676703
    677704        add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_STREAM_TYPE,
    678705                     streamtype_ivtv_to_v4l2(GetFilteredStreamType()));
     706
    679707    }
     708    else
     709    {
     710        maxbitrate = high_mpeg4peakbitrate;
     711        bitrate    = high_mpeg4avgbitrate;
     712    }
    680713
    681714    add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_PEAK,
    682715                 maxbitrate * 1000);
     
    703736        }
    704737    }
    705738
     739    bool ok;
     740    int audioinput = audiodevice.toUInt(&ok);
     741    if (ok)
     742    {
     743        struct v4l2_audio ain;
     744        bzero(&ain, sizeof(ain));
     745        ain.index = audioinput;
     746        if (ioctl(chanfd, VIDIOC_ENUMAUDIO, &ain) < 0)
     747        {
     748            VERBOSE(VB_IMPORTANT, LOC_WARN +
     749                    "Unable to get audio input.");
     750        }
     751        else
     752        {
     753            ain.index = audioinput;
     754            if (ioctl(chanfd, VIDIOC_S_AUDIO, &ain) < 0)
     755            {
     756                VERBOSE(VB_IMPORTANT, LOC_WARN +
     757                        "Unable to set audio input.");
     758            }
     759        }
     760    }
     761
    706762    return true;
    707763}
    708764
  • 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

     
    654654    };
    655655};
    656656
    657 class MPEG2bitrate : public SliderSetting, public CodecParamStorage
     657class AverageBitrate : public SliderSetting, public CodecParamStorage
    658658{
    659659  public:
    660     MPEG2bitrate(const RecordingProfile &parent) :
    661         SliderSetting(this, 1000, 16000, 100),
    662         CodecParamStorage(this, parent, "mpeg2bitrate")
     660    AverageBitrate(const RecordingProfile &parent,
     661                   QString setting = "mpeg2bitrate",
     662                   uint min_br = 1000, uint max_br = 16000,
     663                   uint default_br = 4500, uint increment = 100,
     664                   QString label = QString::null) :
     665        SliderSetting(this, min_br, max_br, increment),
     666        CodecParamStorage(this, parent, setting)
    663667    {
    664 
    665         setLabel(QObject::tr("Bitrate"));
    666         setValue(4500);
    667         setHelpText(QObject::tr("Bitrate in kilobits/second.  2200Kbps is "
    668                     "approximately 1 Gigabyte per hour."));
     668        if (label.isEmpty())
     669            label = QObject::tr("Avg. Bitrate");
     670        setLabel(label);
     671        setValue(default_br);
     672        setHelpText(QObject::tr(
     673                        "Average bit rate in kilobits/second. "
     674                        "2200Kbps is approximately 1 Gigabyte per hour."));
    669675    };
    670676};
    671677
    672 class MPEG2maxBitrate : public SliderSetting, public CodecParamStorage
     678class PeakBitrate : public SliderSetting, public CodecParamStorage
    673679{
    674680  public:
    675     MPEG2maxBitrate(const RecordingProfile &parent) :
    676         SliderSetting(this, 1000, 16000, 100),
    677         CodecParamStorage(this, parent, "mpeg2maxbitrate")
     681    PeakBitrate(const RecordingProfile &parent,
     682                QString setting = "mpeg2maxbitrate",
     683                uint min_br = 1000, uint max_br = 16000,
     684                uint default_br = 6000, uint increment = 100,
     685                QString label = QString::null) :
     686        SliderSetting(this, min_br, max_br, increment),
     687        CodecParamStorage(this, parent, setting)
    678688    {
    679 
    680         setLabel(QObject::tr("Max. Bitrate"));
    681         setValue(6000);
    682         setHelpText(QObject::tr("Maximum Bitrate in kilobits/second.  "
     689        if (label.isEmpty())
     690            label = QObject::tr("Max. Bitrate");
     691        setLabel(label);
     692        setValue(default_br);
     693        setHelpText(QObject::tr("Maximum bit rate in kilobits/second. "
    683694                    "2200Kbps is approximately 1 Gigabyte per hour."));
    684695    };
    685696};
     
    821832
    822833        params = new VerticalConfigurationGroup(false);
    823834        params->setLabel(QObject::tr("MPEG-2 Parameters"));
    824         params->addChild(new MPEG2bitrate(parent));
     835        params->addChild(new AverageBitrate(parent));
    825836        params->addChild(new ScaleBitrate(parent));
    826837        //params->addChild(new MPEG4MaxQuality(parent));
    827838        //params->addChild(new MPEG4MinQuality(parent));
     
    845856        params->setLabel(QObject::tr("MPEG-2 Hardware Encoder"));
    846857        params->addChild(new MPEG2streamType(parent));
    847858        params->addChild(new MPEG2aspectRatio(parent));
    848         params->addChild(new MPEG2bitrate(parent));
    849         params->addChild(new MPEG2maxBitrate(parent));
     859        params->addChild(new AverageBitrate(parent));
     860        params->addChild(new PeakBitrate(parent));
    850861
    851862        addTarget("MPEG-2 Hardware Encoder", params);
     863
     864        params = new VerticalConfigurationGroup(false);
     865        params->setLabel(QObject::tr("MPEG-4 AVC Hardware Encoder"));
     866        ConfigurationGroup *h0 = new HorizontalConfigurationGroup(
     867            true, false, true, true);
     868        h0->setLabel(QObject::tr("Low Resolution"));
     869        h0->addChild(new AverageBitrate(parent, "low_mpeg4avgbitrate",
     870                                        1000, 13500, 4500, 500));
     871        h0->addChild(new PeakBitrate(parent, "low_mpeg4peakbitrate",
     872                                     1100, 20200, 6000, 500));
     873        params->addChild(h0);
     874        ConfigurationGroup *h1 = new HorizontalConfigurationGroup(
     875            true, false, true, true);
     876        h1->setLabel(QObject::tr("Medium Resolution"));
     877        h1->addChild(new AverageBitrate(parent, "medium_mpeg4avgbitrate",
     878                                        1000, 13500, 9000, 500));
     879        h1->addChild(new PeakBitrate(parent, "medium_mpeg4peakbitrate",
     880                                     1100, 20200, 11000, 500));
     881        params->addChild(h1);
     882        ConfigurationGroup *h2 = new HorizontalConfigurationGroup(
     883            true, false, true, true);
     884        h2->setLabel(QObject::tr("High Resolution"));
     885        h2->addChild(new AverageBitrate(parent, "high_mpeg4avgbitrate",
     886                                        1000, 13500, 13500, 500));
     887        h2->addChild(new PeakBitrate(parent, "high_mpeg4peakbitrate",
     888                                     1100, 20200, 20200, 500));
     889        params->addChild(h2);
     890        addTarget("MPEG-4 AVC Hardware Encoder", params);
    852891    }
    853892
    854893    void selectCodecs(QString groupType)
    855894    {
    856895        if (!groupType.isNull())
    857896        {
    858             if (groupType == "MPEG")
     897            if (groupType == "HDPVR")
     898               codecName->addSelection("MPEG-4 AVC Hardware Encoder");
     899            else if (groupType == "MPEG")
    859900               codecName->addSelection("MPEG-2 Hardware Encoder");
    860901            else if (groupType == "MJPEG")
    861902                codecName->addSelection("Hardware MJPEG");
     
    12121253    if (isEncoder)
    12131254    {
    12141255        QString tvFormat = gContext->GetSetting("TVFormat");
    1215         addChild(new ImageSize(*this, tvFormat, profileName));
     1256        if (type.upper() != "HDPVR")
     1257            addChild(new ImageSize(*this, tvFormat, profileName));
    12161258
    12171259        videoSettings = new VideoCompressionSettings(*this, profileName);
    12181260        addChild(videoSettings);
    12191261
    1220         audioSettings = new AudioCompressionSettings(*this, profileName);
    1221         addChild(audioSettings);
     1262        if (type.upper() != "HDPVR")
     1263        {
     1264            audioSettings = new AudioCompressionSettings(*this, profileName);
     1265            addChild(audioSettings);
     1266        }
    12221267
    12231268        if (!profileName.isEmpty() && profileName.left(11) == "Transcoders")
    12241269        {
  • libs/libmythtv/scanwizardhelpers.cpp

     
    6060# ifdef USING_IVTV
    6161    cardTypes += ",'MPEG'";
    6262# endif // USING_IVTV
     63# ifdef USING_HDPVR
     64    cardTypes += ",'HDPVR'";
     65# endif // USING_HDPVR
    6366#endif // USING_V4L
    6467
    6568#ifdef USING_IPTV