Index: configure
===================================================================
--- configure	(revision 17749)
+++ configure	(working copy)
@@ -158,6 +158,7 @@
   echo "  --disable-hdhomerun      disable support for HDHomeRun boxes"
   echo "  --disable-v4l            disable Video4Linux support"
   echo "  --disable-ivtv           disable ivtv support (PVR-x50) req. v4l support"
+  echo "  --disable-hdpvr          disable HD-PVR support"
   echo "  --disable-dvb            disable DVB support"
   echo "  --dvb-path=HDRLOC        location of directory containing"
   echo "                           'linux/dvb/frontend.h', not the"
@@ -892,6 +893,7 @@
     hdhomerun
     iptv
     ivtv
+    hdpvr
     joystick_menu
     libfftw3
     lirc
@@ -1049,6 +1051,7 @@
 firewire_deps="backend"
 iptv_deps="backend"
 ivtv_deps="backend v4l"
+hdpvr_deps="backend v4l"
 hdhomerun_deps="backend"
 opengl_deps="GL_gl_h"
 opengl_deps_any="windows x11"
@@ -1181,6 +1184,7 @@
 hdhomerun="yes"
 iptv="yes"
 ivtv="yes"
+hdpvr="yes"
 joystick_menu="default"
 lamemp3="yes"
 lirc="yes"
@@ -1618,6 +1622,7 @@
     enable  darwin
     disable dvb
     disable ivtv
+    disable hdpvr
     ldver=$(ld -v 2>&1 | sed -e s/^[^-]*-//)
     osxver=$(uname -r | cut -c 1)
     if [[ ${ldver%.*} -lt "82" && ${osxver} = "9" && ${arch} = "x86_32" ]]; then
@@ -1648,6 +1653,7 @@
     disable dv1394
     disable dvb
     disable ivtv
+    disable hdpvr
     enable  memalign_hack
     disable network
     enable opengl
@@ -3017,6 +3023,7 @@
 if enabled backend; then
   echo "Video4Linux sup.          ${v4l-no}"
   echo "ivtv support              ${ivtv-no}"
+  echo "hdpvr support             ${hdpvr-no}"
   echo "FireWire support          ${firewire-no}"
   echo "DVB support               ${dvb-no} [$dvb_path]"
   echo "DBox2 support             ${dbox2-no}"
Index: libs/libmythtv/cardutil.h
===================================================================
--- libs/libmythtv/cardutil.h	(revision 17750)
+++ libs/libmythtv/cardutil.h	(working copy)
@@ -53,6 +53,7 @@
         FIREWIRE  = 9,
         HDHOMERUN = 10,
         FREEBOX   = 11,
+        HDPVR     = 12,
     };
 
     static enum CARD_TYPES toCardType(const QString &name)
@@ -81,6 +82,8 @@
             return HDHOMERUN;
         if ("FREEBOX" == name)
             return FREEBOX;
+        if ("HDPVR" == name)
+            return HDPVR;
         return ERROR_UNKNOWN;
     }
 
@@ -95,7 +98,8 @@
     static bool         IsUnscanable(const QString &rawtype)
     {
         return
-            (rawtype == "FIREWIRE")  || (rawtype == "DBOX2");
+            (rawtype == "FIREWIRE")  || (rawtype == "DBOX2") ||
+            (rawtype == "HDPVR");
     }
 
     static bool         IsEITCapable(const QString &rawtype)
@@ -119,7 +123,9 @@
 
     static bool         IsTuningAnalog(const QString &rawtype)
     {
-        return (rawtype == "V4L");
+        return
+            (rawtype == "V4L")    || (rawtype == "MPEG") ||
+            (rawtype == "HDPVR");
     }
 
     /// Convenience function for GetCardIDs(const QString&, QString, QString)
@@ -146,6 +152,8 @@
         { return get_on_cardid("cardtype", cardid).upper(); }
     static QString      GetVideoDevice(uint cardid)
         { return get_on_cardid("videodevice", cardid); }
+    static QString      GetAudioDevice(uint cardid)
+        { return get_on_cardid("audiodevice", cardid); }
     static QString      GetVBIDevice(uint cardid)
         { return get_on_cardid("vbidevice", cardid); }
     static uint         GetHDHRTuner(uint cardid)
@@ -193,8 +201,10 @@
 
     static QString      ProbeSubTypeName(uint cardid);
 
-    static QStringList  probeInputs(QString device,
-                                    QString cardtype = QString::null);
+    static QStringList  ProbeVideoInputs(QString device,
+                                         QString cardtype = QString::null);
+    static QStringList  ProbeAudioInputs(QString device,
+                                         QString cardtype = QString::null);
     static void         GetCardInputs(uint                cardid,
                                       const QString      &device,
                                       const QString      &cardtype,
@@ -239,11 +249,13 @@
                                    uint32_t &version);
     static bool         GetV4LInfo(int videofd, QString &card, QString &driver)
         { uint32_t dummy; return GetV4LInfo(videofd, card, driver, dummy); }
-    static InputNames   probeV4LInputs(int videofd, bool &ok);
+    static InputNames   ProbeV4LVideoInputs(int videofd, bool &ok);
+    static InputNames   ProbeV4LAudioInputs(int videofd, bool &ok);
 
   private:
-    static QStringList  probeV4LInputs(QString device);
-    static QStringList  probeDVBInputs(QString device);
+    static QStringList  ProbeV4LVideoInputs(QString device);
+    static QStringList  ProbeV4LAudioInputs(QString device);
+    static QStringList  ProbeDVBInputs(QString device);
 };
 
 #endif //_CARDUTIL_H_
Index: libs/libmythtv/videosource.h
===================================================================
--- libs/libmythtv/videosource.h	(revision 17749)
+++ libs/libmythtv/videosource.h	(working copy)
@@ -367,6 +367,22 @@
     }
 };
 
+class TunerCardAudioInput : public ComboBoxSetting, public CaptureCardDBStorage
+{
+    Q_OBJECT
+  public:
+    TunerCardAudioInput(const CaptureCard &parent,
+                        QString dev  = QString::null,
+                        QString type = QString::null);
+
+  public slots:
+    void fillSelections(const QString &device);
+
+  private:
+    QString last_device;
+    QString last_cardtype;
+};
+
 class DVBAudioDevice : public LineEditSetting, public CaptureCardDBStorage
 {
     Q_OBJECT
@@ -453,6 +469,23 @@
     TunerCardInput    *input;
 };
 
+class HDPVRConfigurationGroup: public VerticalConfigurationGroup
+{
+   Q_OBJECT
+
+  public:
+    HDPVRConfigurationGroup(CaptureCard &parent);
+
+  public slots:
+    void probeCard(const QString &device);
+
+  private:
+    CaptureCard         &parent;
+    TransLabelSetting   *cardinfo;
+    TunerCardInput      *videoinput;
+    TunerCardAudioInput *audioinput;
+};
+
 class DVBCardNum;
 class DVBInput;
 class DVBCardName;
Index: libs/libmythtv/libmythtv.pro
===================================================================
--- libs/libmythtv/libmythtv.pro	(revision 17749)
+++ libs/libmythtv/libmythtv.pro	(working copy)
@@ -477,6 +477,11 @@
     using_ivtv:SOURCES += mpegrecorder.cpp
     using_ivtv:DEFINES += USING_IVTV
 
+    # Support for HD-PVR on Linux
+    using_hdpvr:HEADERS *= mpegrecorder.h
+    using_hdpvr:SOURCES *= mpegrecorder.cpp
+    using_hdpvr:DEFINES += USING_HDPVR
+
     # Support for Linux DVB drivers
     using_dvb {
         # Basic DVB types
Index: libs/libmythtv/dbcheck.cpp
===================================================================
--- libs/libmythtv/dbcheck.cpp	(revision 17749)
+++ libs/libmythtv/dbcheck.cpp	(working copy)
@@ -16,7 +16,7 @@
 #define MINIMUM_DBMS_VERSION 5
 
 /// This is the DB schema version expected by the running MythTV instance.
-const QString currentDatabaseVersion = "1221";
+const QString currentDatabaseVersion = "1222";
 
 static bool UpdateDBVersionNumber(const QString &newnumber);
 static bool performActualUpdate(
@@ -4292,6 +4292,21 @@
             return false;
     }
 
+    if (dbver == "1221")
+    {
+        const char *updates[] = {
+"INSERT INTO profilegroups SET name = 'HD-PVR Recorders', "
+"  cardtype = 'HDPVR', is_default = 1;",
+"INSERT INTO recordingprofiles SET name = 'Default',      profilegroup = 13;",
+"INSERT INTO recordingprofiles SET name = 'Live TV',      profilegroup = 13;",
+"INSERT INTO recordingprofiles SET name = 'High Quality', profilegroup = 13;",
+"INSERT INTO recordingprofiles SET name = 'Low Quality',  profilegroup = 13;",
+NULL
+};
+        if (!performActualUpdate(updates, "1222", dbver))
+            return false;
+    }
+
     return true;
 }
 
Index: libs/libmythtv/scanwizardscanner.cpp
===================================================================
--- libs/libmythtv/scanwizardscanner.cpp	(revision 17749)
+++ libs/libmythtv/scanwizardscanner.cpp	(working copy)
@@ -510,8 +510,11 @@
 #endif
 
 #ifdef USING_V4L
-    if (("V4L" == card_type) || ("MPEG" == card_type))
+    if (("V4L" == card_type) || ("MPEG" == card_type) ||
+        ("HDPVR" == card_type))
+    {
         channel = new V4LChannel(NULL, device);
+    }
 #endif
 
 #ifdef USING_HDHOMERUN
Index: libs/libmythtv/mpegrecorder.h
===================================================================
--- libs/libmythtv/mpegrecorder.h	(revision 17749)
+++ libs/libmythtv/mpegrecorder.h	(working copy)
@@ -104,6 +104,12 @@
     int audtype, audsamplerate, audbitratel1, audbitratel2, audbitratel3;
     int audvolume;
     unsigned int language; ///< 0 is Main Lang; 1 is SAP Lang; 2 is Dual
+    unsigned int low_mpeg4avgbitrate;
+    unsigned int low_mpeg4peakbitrate;
+    unsigned int medium_mpeg4avgbitrate;
+    unsigned int medium_mpeg4peakbitrate;
+    unsigned int high_mpeg4avgbitrate;
+    unsigned int high_mpeg4peakbitrate;
 
     // Input file descriptors
     int chanfd;
Index: libs/libmythtv/signalmonitor.cpp
===================================================================
--- libs/libmythtv/signalmonitor.cpp	(revision 17749)
+++ libs/libmythtv/signalmonitor.cpp	(working copy)
@@ -93,7 +93,8 @@
 
 #ifdef USING_V4L
     if ((cardtype.upper() == "V4L") ||
-        (cardtype.upper() == "MPEG"))
+        (cardtype.upper() == "MPEG") ||
+        (cardtype.upper() == "HDPVR"))
     {
         V4LChannel *chan = dynamic_cast<V4LChannel*>(channel);
         if (chan)
Index: libs/libmythtv/v4lchannel.cpp
===================================================================
--- libs/libmythtv/v4lchannel.cpp	(revision 17749)
+++ libs/libmythtv/v4lchannel.cpp	(working copy)
@@ -279,7 +279,7 @@
     int videomode_v4l2 = format_to_mode(fmt.upper(), 2);
 
     bool ok = false;
-    InputNames v4l_inputs = CardUtil::probeV4LInputs(videofd, ok);
+    InputNames v4l_inputs = CardUtil::ProbeV4LVideoInputs(videofd, ok);
 
     // Insert info from hardware
     uint valid_cnt = 0;
Index: libs/libmythtv/cardutil.cpp
===================================================================
--- libs/libmythtv/cardutil.cpp	(revision 17750)
+++ libs/libmythtv/cardutil.cpp	(working copy)
@@ -1417,7 +1417,7 @@
     return !card.isEmpty();
 }
 
-InputNames CardUtil::probeV4LInputs(int videofd, bool &ok)
+InputNames CardUtil::ProbeV4LVideoInputs(int videofd, bool &ok)
 {
     (void) videofd;
 
@@ -1482,6 +1482,39 @@
     return list;
 }
 
+InputNames CardUtil::ProbeV4LAudioInputs(int videofd, bool &ok)
+{
+    (void) videofd;
+
+    InputNames list;
+    ok = false;
+
+#ifdef USING_V4L
+    bool usingv4l2 = hasV4L2(videofd);
+
+    // V4L v2 query
+    struct v4l2_audio ain;
+    bzero(&ain, sizeof(ain));
+    while (usingv4l2 && (ioctl(videofd, VIDIOC_ENUMAUDIO, &ain) >= 0))
+    {
+        QString input((char *)ain.name);
+        list[ain.index] = input;
+        ain.index++;
+    }
+    if (ain.index)
+    {
+        ok = true;
+        return list;
+    }
+
+    ok = true;
+#else // if !USING_V4L
+    list[-1] += QObject::tr(
+        "ERROR, Compile with V4L support to query audio inputs");
+#endif // !USING_V4L
+    return list;
+}
+
 InputNames CardUtil::GetConfiguredDVBInputs(uint cardid)
 {
     InputNames list;
@@ -1502,7 +1535,7 @@
     return list;
 }
 
-QStringList CardUtil::probeInputs(QString device, QString cardtype)
+QStringList CardUtil::ProbeVideoInputs(QString device, QString cardtype)
 {
     QStringList ret;
 
@@ -1514,15 +1547,26 @@
         ret += "MPEG2TS";
     }
     else if ("DVB" == cardtype)
-        ret += probeDVBInputs(device);
+        ret += ProbeDVBInputs(device);
     else
-        ret += probeV4LInputs(device);
+        ret += ProbeV4LVideoInputs(device);
 
     return ret;
 }
 
-QStringList CardUtil::probeV4LInputs(QString device)
+QStringList CardUtil::ProbeAudioInputs(QString device, QString cardtype)
 {
+    VERBOSE(VB_IMPORTANT, QString("ProbeAudioInputs(%1,%2)").arg(device).arg(cardtype));
+    QStringList ret;
+
+    if ("HDPVR" == cardtype)
+        ret += ProbeV4LAudioInputs(device);
+
+    return ret;
+}
+
+QStringList CardUtil::ProbeV4LVideoInputs(QString device)
+{
     bool ok;
     QStringList ret;
     int videofd = open(device.ascii(), O_RDWR);
@@ -1532,7 +1576,7 @@
                            "to probe its inputs.").arg(device);
         return ret;
     }
-    InputNames list = CardUtil::probeV4LInputs(videofd, ok);
+    InputNames list = CardUtil::ProbeV4LVideoInputs(videofd, ok);
     close(videofd);
 
     if (!ok)
@@ -1551,10 +1595,43 @@
     return ret;
 }
 
-QStringList CardUtil::probeDVBInputs(QString device)
+QStringList CardUtil::ProbeV4LAudioInputs(QString device)
 {
+    VERBOSE(VB_IMPORTANT, QString("ProbeV4LAudioInputs(%1)").arg(device));
+
+    bool ok;
     QStringList ret;
+    int videofd = open(device.ascii(), O_RDWR);
+    if (videofd < 0)
+    {
+        VERBOSE(VB_IMPORTANT, QString("ProbeAudioInputs() -> couldn't open device"));
+        ret += QObject::tr("Could not open '%1' "
+                           "to probe its inputs.").arg(device);
+        return ret;
+    }
+    InputNames list = CardUtil::ProbeV4LAudioInputs(videofd, ok);
+    close(videofd);
 
+    if (!ok)
+    {
+        ret += list[-1];
+        return ret;
+    }
+
+    InputNames::iterator it;
+    for (it = list.begin(); it != list.end(); ++it)
+    {
+        if (it.key() >= 0)
+            ret += *it;
+    }
+
+    return ret;
+}
+
+QStringList CardUtil::ProbeDVBInputs(QString device)
+{
+    QStringList ret;
+
 #ifdef USING_DVB
     uint cardid = CardUtil::GetFirstCardID(device);
     if (!cardid)
@@ -1639,7 +1716,7 @@
         inputs += "MPEG2TS";
     }
     else if ("DVB" != cardtype)
-        inputs += probeV4LInputs(device);
+        inputs += ProbeV4LVideoInputs(device);
 
     QString dev_label = GetDeviceLabel(cardid, cardtype, device);
 
Index: libs/libmythtv/videosource.cpp
===================================================================
--- libs/libmythtv/videosource.cpp	(revision 17749)
+++ libs/libmythtv/videosource.cpp	(working copy)
@@ -1521,7 +1521,7 @@
     input(new TunerCardInput(parent))
 {
     VideoDevice *device =
-        new VideoDevice(parent, 0, 15, QString::null, "(ivtv|hdpvr)");
+        new VideoDevice(parent, 0, 15, QString::null, "ivtv");
 
     cardinfo->setLabel(tr("Probed info"));
 
@@ -1553,6 +1553,47 @@
     input->fillSelections(device);
 }
 
+HDPVRConfigurationGroup::HDPVRConfigurationGroup(CaptureCard &a_parent) :
+    VerticalConfigurationGroup(false, true, false, false),
+    parent(a_parent), cardinfo(new TransLabelSetting()),
+    videoinput(new TunerCardInput(parent)),
+    audioinput(new TunerCardAudioInput(parent, QString::null, "HDPVR"))
+{
+    VideoDevice *device =
+        new VideoDevice(parent, 0, 15, QString::null, "hdpvr");
+
+    cardinfo->setLabel(tr("Probed info"));
+
+    addChild(device);
+    addChild(cardinfo);
+    addChild(videoinput);
+    addChild(audioinput);
+
+    connect(device, SIGNAL(valueChanged(const QString&)),
+            this,   SLOT(  probeCard(   const QString&)));
+
+    probeCard(device->getValue());
+}
+
+void HDPVRConfigurationGroup::probeCard(const QString &device)
+{
+    QString cn = tr("Failed to open"), ci = cn, dn = QString::null;
+
+    int videofd = open(device.ascii(), O_RDWR);
+    if (videofd >= 0)
+    {
+        if (!CardUtil::GetV4LInfo(videofd, cn, dn))
+            ci = cn = tr("Failed to probe");
+        else if (!dn.isEmpty())
+            ci = cn + "  [" + dn + "]";
+        close(videofd);
+    }
+
+    cardinfo->setValue(ci);
+    videoinput->fillSelections(device);
+    audioinput->fillSelections(device);
+}
+
 CaptureCardGroup::CaptureCardGroup(CaptureCard &parent) :
     TriggeredConfigurationGroup(true, true, false, false)
 {
@@ -1569,6 +1610,9 @@
 # ifdef USING_IVTV
     addTarget("MPEG",      new MPEGConfigurationGroup(parent));
 # endif // USING_IVTV
+# ifdef USING_HDPVR
+    addTarget("HDPVR",     new HDPVRConfigurationGroup(parent));
+# endif // USING_HDPVR
 #endif // USING_V4L
 
 #ifdef USING_DVB
@@ -1755,6 +1799,10 @@
     setting->addSelection(
         QObject::tr("MPEG-2 encoder card (PVR-x50, PVR-500)"), "MPEG");
 # endif // USING_IVTV
+# ifdef USING_HDPVR
+    setting->addSelection(
+        QObject::tr("H.264 encoder card (HD-PVR)"), "HDPVR");
+# endif // USING_HDPVR
 #endif // USING_V4L
 
 #ifdef USING_DVB
@@ -2965,12 +3013,44 @@
 
     last_device = device;
     QStringList inputs =
-        CardUtil::probeInputs(device, last_cardtype);
+        CardUtil::ProbeVideoInputs(device, last_cardtype);
 
     for (QStringList::iterator i = inputs.begin(); i != inputs.end(); ++i)
         addSelection(*i);
 }
 
+TunerCardAudioInput::TunerCardAudioInput(const CaptureCard &parent,
+                                         QString dev, QString type) :
+    ComboBoxSetting(this), CaptureCardDBStorage(this, parent, "audiodevice"),
+    last_device(dev), last_cardtype(type)
+{
+    setLabel(QObject::tr("Audio input"));
+    int cardid = parent.getCardID();
+    if (cardid <= 0)
+        return;
+
+    last_cardtype = CardUtil::GetRawCardType(cardid);
+    last_device   = CardUtil::GetAudioDevice(cardid);
+}
+
+void TunerCardAudioInput::fillSelections(const QString &device)
+{
+    clearSelections();
+
+    if (device.isEmpty())
+        return;
+
+    last_device = device;
+    QStringList inputs =
+        CardUtil::ProbeAudioInputs(device, last_cardtype);
+
+    for (uint i = 0; i < inputs.size(); i++)
+    {
+        addSelection(inputs[i], QString::number(i),
+                     last_device == QString::number(i));
+    }
+}
+
 class DVBExtra : public ConfigurationWizard
 {
   public:
Index: libs/libmythtv/mpegrecorder.cpp
===================================================================
--- libs/libmythtv/mpegrecorder.cpp	(revision 17749)
+++ libs/libmythtv/mpegrecorder.cpp	(working copy)
@@ -93,6 +93,9 @@
     audbitratel1(14),         audbitratel2(14),
     audbitratel3(10),
     audvolume(80),            language(0),
+    low_mpeg4avgbitrate(4500),    low_mpeg4peakbitrate(6000),
+    medium_mpeg4avgbitrate(9000), medium_mpeg4peakbitrate(13500),
+    high_mpeg4avgbitrate(13500),  high_mpeg4peakbitrate(20200),
     // Input file descriptors
     chanfd(-1),               readfd(-1),
     // TS packet handling
@@ -178,6 +181,28 @@
     }
     else if (opt == "mpeg2audvolume")
         audvolume = value;
+    else if (opt.right(16) == "_mpeg4avgbitrate")
+    {
+        if (opt.left(3) == "low")
+            low_mpeg4avgbitrate = value;
+        else if (opt.left(6) == "medium")
+            medium_mpeg4avgbitrate = value;
+        else if (opt.left(4) == "high")
+            high_mpeg4avgbitrate = value;
+        else
+            RecorderBase::SetOption(opt, value);
+    }
+    else if (opt.right(17) == "_mpeg4peakbitrate")
+    {
+        if (opt.left(3) == "low")
+            low_mpeg4peakbitrate = value;
+        else if (opt.left(6) == "medium")
+            medium_mpeg4peakbitrate = value;
+        else if (opt.left(4) == "high")
+            high_mpeg4peakbitrate = value;
+        else
+            RecorderBase::SetOption(opt, value);
+    }
     else
         RecorderBase::SetOption(opt, value);
 }
@@ -274,6 +299,8 @@
         SetOption("videodevice", videodev);
     }
 
+    SetOption("audiodevice", audiodev);
+
     SetOption("tvformat", gContext->GetSetting("TVFormat"));
     SetOption("vbiformat", gContext->GetSetting("VbiFormat"));
 
@@ -679,7 +706,13 @@
 
         add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_STREAM_TYPE,
                      streamtype_ivtv_to_v4l2(GetFilteredStreamType()));
+
     }
+    else
+    {
+        maxbitrate = high_mpeg4peakbitrate;
+        bitrate    = high_mpeg4avgbitrate;
+    }
 
     add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_PEAK,
                  maxbitrate * 1000);
@@ -732,6 +765,29 @@
         _keyframedist = ext_ctrl.value;
     }
 
+    bool ok;
+    int audioinput = audiodevice.toUInt(&ok);
+    if (ok)
+    {
+        struct v4l2_audio ain;
+        bzero(&ain, sizeof(ain));
+        ain.index = audioinput;
+        if (ioctl(chanfd, VIDIOC_ENUMAUDIO, &ain) < 0)
+        {
+            VERBOSE(VB_IMPORTANT, LOC_WARN +
+                    "Unable to get audio input.");
+        }
+        else
+        {
+            ain.index = audioinput;
+            if (ioctl(chanfd, VIDIOC_S_AUDIO, &ain) < 0)
+            {
+                VERBOSE(VB_IMPORTANT, LOC_WARN +
+                        "Unable to set audio input.");
+            }
+        }
+    }
+
     return true;
 }
 
Index: libs/libmythtv/tv_rec.cpp
===================================================================
--- libs/libmythtv/tv_rec.cpp	(revision 17749)
+++ libs/libmythtv/tv_rec.cpp	(working copy)
@@ -209,7 +209,7 @@
         CloseChannel();
         init_run = true;
 #endif
-        if (genOpt.cardtype != "MPEG")
+        if ((genOpt.cardtype != "MPEG") && (genOpt.cardtype != "HDPVR"))
             rbFileExt = "nuv";
     }
 
@@ -952,7 +952,7 @@
  *  \brief Allocates and initializes the RecorderBase instance.
  *
  *  Based on the card type, one of the possible recorders are started.
- *  If the card type is "MPEG" a MpegRecorder is started,
+ *  If the card type is "MPEG" or "HDPVR" a MpegRecorder is started,
  *  if the card type is "HDHOMERUN" a HDHRRecorder is started,
  *  if the card type is "FIREWIRE" a FirewireRecorder is started,
  *  if the card type is "DVB" a DVBRecorder is started,
@@ -970,6 +970,12 @@
         recorder = new MpegRecorder(this);
 #endif // USING_IVTV
     }
+    if (genOpt.cardtype == "HDPVR")
+    {
+#ifdef USING_HDPVR
+        recorder = new MpegRecorder(this);
+#endif // USING_HDPVR
+    }
     else if (genOpt.cardtype == "FIREWIRE")
     {
 #ifdef USING_FIREWIRE
@@ -2576,6 +2582,8 @@
     long long bitrate;
     if (genOpt.cardtype == "MPEG")
         bitrate = 10080000LL; // use DVD max bit rate
+    if (genOpt.cardtype == "HDPVR")
+        bitrate = 20200000LL; // Peek bit rate for HD-PVR
     else if (genOpt.cardtype == "DBOX2")
         bitrate = 10080000LL; // use DVD max bit rate
     else if (!CardUtil::IsEncoder(genOpt.cardtype))
Index: libs/libmythtv/recordingprofile.cpp
===================================================================
--- libs/libmythtv/recordingprofile.cpp	(revision 17749)
+++ libs/libmythtv/recordingprofile.cpp	(working copy)
@@ -652,32 +652,43 @@
     };
 };
 
-class MPEG2bitrate : public SliderSetting, public CodecParamStorage
+class AverageBitrate : public SliderSetting, public CodecParamStorage
 {
   public:
-    MPEG2bitrate(const RecordingProfile &parent) :
-        SliderSetting(this, 1000, 16000, 100),
-        CodecParamStorage(this, parent, "mpeg2bitrate")
+    AverageBitrate(const RecordingProfile &parent,
+                   QString setting = "mpeg2bitrate",
+                   uint min_br = 1000, uint max_br = 16000,
+                   uint default_br = 4500, uint increment = 100,
+                   QString label = QString::null) :
+        SliderSetting(this, min_br, max_br, increment),
+        CodecParamStorage(this, parent, setting)
     {
-
-        setLabel(QObject::tr("Bitrate"));
-        setValue(4500);
-        setHelpText(QObject::tr("Bitrate in kilobits/second.  2200Kbps is "
-                    "approximately 1 Gigabyte per hour."));
+        if (label.isEmpty())
+            label = QObject::tr("Avg. Bitrate");
+        setLabel(label);
+        setValue(default_br);
+        setHelpText(QObject::tr(
+                        "Average bit rate in kilobits/second. "
+                        "2200Kbps is approximately 1 Gigabyte per hour."));
     };
 };
 
-class MPEG2maxBitrate : public SliderSetting, public CodecParamStorage
+class PeakBitrate : public SliderSetting, public CodecParamStorage
 {
   public:
-    MPEG2maxBitrate(const RecordingProfile &parent) :
-        SliderSetting(this, 1000, 16000, 100),
-        CodecParamStorage(this, parent, "mpeg2maxbitrate")
+    PeakBitrate(const RecordingProfile &parent,
+                QString setting = "mpeg2maxbitrate",
+                uint min_br = 1000, uint max_br = 16000,
+                uint default_br = 6000, uint increment = 100,
+                QString label = QString::null) :
+        SliderSetting(this, min_br, max_br, increment),
+        CodecParamStorage(this, parent, setting)
     {
-
-        setLabel(QObject::tr("Max. Bitrate"));
-        setValue(6000);
-        setHelpText(QObject::tr("Maximum Bitrate in kilobits/second.  "
+        if (label.isEmpty())
+            label = QObject::tr("Max. Bitrate");
+        setLabel(label);
+        setValue(default_br);
+        setHelpText(QObject::tr("Maximum bit rate in kilobits/second. "
                     "2200Kbps is approximately 1 Gigabyte per hour."));
     };
 };
@@ -819,7 +830,7 @@
 
         params = new VerticalConfigurationGroup(false);
         params->setLabel(QObject::tr("MPEG-2 Parameters"));
-        params->addChild(new MPEG2bitrate(parent));
+        params->addChild(new AverageBitrate(parent));
         params->addChild(new ScaleBitrate(parent));
         //params->addChild(new MPEG4MaxQuality(parent));
         //params->addChild(new MPEG4MinQuality(parent));
@@ -843,17 +854,47 @@
         params->setLabel(QObject::tr("MPEG-2 Hardware Encoder"));
         params->addChild(new MPEG2streamType(parent));
         params->addChild(new MPEG2aspectRatio(parent));
-        params->addChild(new MPEG2bitrate(parent));
-        params->addChild(new MPEG2maxBitrate(parent));
+        params->addChild(new AverageBitrate(parent));
+        params->addChild(new PeakBitrate(parent));
 
         addTarget("MPEG-2 Hardware Encoder", params);
+
+        params = new VerticalConfigurationGroup(false);
+        params->setLabel(QObject::tr("MPEG-4 AVC Hardware Encoder"));
+        ConfigurationGroup *h0 = new HorizontalConfigurationGroup(
+            true, false, true, true);
+        h0->setLabel(QObject::tr("Low Resolution"));
+        h0->addChild(new AverageBitrate(parent, "low_mpeg4avgbitrate",
+                                        1000, 13500, 4500, 500));
+        h0->addChild(new PeakBitrate(parent, "low_mpeg4peakbitrate",
+                                     1100, 20200, 6000, 500));
+        params->addChild(h0);
+        ConfigurationGroup *h1 = new HorizontalConfigurationGroup(
+            true, false, true, true);
+        h1->setLabel(QObject::tr("Medium Resolution"));
+        h1->addChild(new AverageBitrate(parent, "medium_mpeg4avgbitrate",
+                                        1000, 13500, 9000, 500));
+        h1->addChild(new PeakBitrate(parent, "medium_mpeg4peakbitrate",
+                                     1100, 20200, 11000, 500));
+        params->addChild(h1);
+        ConfigurationGroup *h2 = new HorizontalConfigurationGroup(
+            true, false, true, true);
+        h2->setLabel(QObject::tr("High Resolution"));
+        h2->addChild(new AverageBitrate(parent, "high_mpeg4avgbitrate",
+                                        1000, 13500, 13500, 500));
+        h2->addChild(new PeakBitrate(parent, "high_mpeg4peakbitrate",
+                                     1100, 20200, 20200, 500));
+        params->addChild(h2);
+        addTarget("MPEG-4 AVC Hardware Encoder", params);
     }
 
     void selectCodecs(QString groupType)
     {
         if (!groupType.isNull())
         {
-            if (groupType == "MPEG")
+            if (groupType == "HDPVR")
+               codecName->addSelection("MPEG-4 AVC Hardware Encoder");
+            else if (groupType == "MPEG")
                codecName->addSelection("MPEG-2 Hardware Encoder");
             else if (groupType == "MJPEG")
                 codecName->addSelection("Hardware MJPEG");
@@ -1210,13 +1251,17 @@
     if (isEncoder)
     {
         QString tvFormat = gContext->GetSetting("TVFormat");
-        addChild(new ImageSize(*this, tvFormat, profileName));
+        if (type.upper() != "HDPVR")
+            addChild(new ImageSize(*this, tvFormat, profileName));
 
         videoSettings = new VideoCompressionSettings(*this, profileName);
         addChild(videoSettings);
 
-        audioSettings = new AudioCompressionSettings(*this, profileName);
-        addChild(audioSettings);
+        if (type.upper() != "HDPVR")
+        {
+            audioSettings = new AudioCompressionSettings(*this, profileName);
+            addChild(audioSettings);
+        }
 
         if (!profileName.isEmpty() && profileName.left(11) == "Transcoders")
         {
Index: libs/libmythtv/scanwizardhelpers.cpp
===================================================================
--- libs/libmythtv/scanwizardhelpers.cpp	(revision 17749)
+++ libs/libmythtv/scanwizardhelpers.cpp	(working copy)
@@ -59,6 +59,9 @@
 # ifdef USING_IVTV
     cardTypes += ",'MPEG'";
 # endif // USING_IVTV
+# ifdef USING_HDPVR
+    cardTypes += ",'HDPVR'";
+# endif // USING_HDPVR
 #endif // USING_V4L
 
 #ifdef USING_IPTV
