---
 libs/libmythtv/cardutil.cpp     |    6 	6 +	0 -	0 !
 libs/libmythtv/cardutil.h       |   11 	7 +	4 -	0 !
 libs/libmythtv/mpegrecorder.cpp |   11 	2 +	9 -	0 !
 libs/libmythtv/tv_rec.cpp       |    6 	2 +	4 -	0 !
 libs/libmythtv/videosource.cpp  |   42 	42 +	0 -	0 !
 libs/libmythtv/videosource.h    |   16 	16 +	0 -	0 !
 6 files changed, 75 insertions(+), 17 deletions(-)

Index: libs/libmythtv/cardutil.h
===================================================================
--- libs/libmythtv/cardutil.h.orig	2010-04-19 17:58:12.000000000 -0400
+++ libs/libmythtv/cardutil.h	2010-06-17 16:17:02.000000000 -0400
@@ -52,7 +52,7 @@
         OFDM      = 5,        DVBT      = 5,
         ATSC      = 6,
         V4L       = 7,
-        MPEG      = 8,
+        MPEG      = 8,        DEMO     = 8,
         FIREWIRE  = 9,
         HDHOMERUN = 10,
         FREEBOX   = 11,
@@ -93,6 +93,8 @@
             return DVBS2;
         if ("IMPORT" == name)
             return IMPORT;
+        if ("DEMO" == name)
+            return DEMO;
         return ERROR_UNKNOWN;
     }
 
@@ -113,7 +115,7 @@
     {
         return
             (rawtype == "FIREWIRE")  || (rawtype == "IMPORT") ||
-            (rawtype == "HDPVR");
+            (rawtype == "HDPVR")     || (rawtype == "DEMO");
     }
 
     static bool         IsEITCapable(const QString &rawtype)
@@ -139,14 +141,15 @@
     {
         return
             (rawtype == "V4L")    || (rawtype == "MPEG") ||
-            (rawtype == "HDPVR");
+            (rawtype == "HDPVR")  || (rawtype == "DEMO");
     }
 
     static bool         IsSingleInputCard(const QString &rawtype)
     {
         return
             (rawtype == "FIREWIRE")  || (rawtype == "FREEBOX") ||
-            (rawtype == "HDHOMERUN") || (rawtype == "IMPORT");
+            (rawtype == "HDHOMERUN") || (rawtype == "IMPORT") ||
+            (rawtype == "DEMO");
     }
 
     /// Convenience function for GetCardIDs()
Index: libs/libmythtv/videosource.h
===================================================================
--- libs/libmythtv/videosource.h.orig	2010-06-08 17:36:16.000000000 -0400
+++ libs/libmythtv/videosource.h	2010-06-17 16:17:02.000000000 -0400
@@ -519,6 +519,22 @@
     TunerCardInput    *input;
 };
 
+class DemoConfigurationGroup: public VerticalConfigurationGroup
+{
+   Q_OBJECT
+
+  public:
+    DemoConfigurationGroup(CaptureCard &parent);
+
+  public slots:
+    void probeCard(const QString &device);
+
+  private:
+    CaptureCard       &parent;
+    TransLabelSetting *cardinfo;
+    TunerCardInput    *input;
+};
+
 class HDPVRConfigurationGroup: public VerticalConfigurationGroup
 {
    Q_OBJECT
Index: libs/libmythtv/cardutil.cpp
===================================================================
--- libs/libmythtv/cardutil.cpp.orig	2010-05-29 18:01:00.000000000 -0400
+++ libs/libmythtv/cardutil.cpp	2010-06-17 16:17:02.000000000 -0400
@@ -1644,6 +1644,12 @@
 {
     bool ok;
     QStringList ret;
+    if (device.endsWith(".mpg"))
+    {
+        ret += "MPEG2TS";
+        return ret;
+    }
+
     QByteArray dev = device.toAscii();
     int videofd = open(dev.constData(), O_RDWR);
     if (videofd < 0)
Index: libs/libmythtv/videosource.cpp
===================================================================
--- libs/libmythtv/videosource.cpp.orig	2010-06-08 17:36:16.000000000 -0400
+++ libs/libmythtv/videosource.cpp	2010-06-17 16:17:02.000000000 -0400
@@ -20,6 +20,7 @@
 #include <QDir>
 #include <QProcess>
 #include <QDateTime>
+#include <QFile>
 
 // MythTV headers
 #include "mythconfig.h"
@@ -1938,6 +1939,43 @@
     input->fillSelections(device);
 }
 
+DemoConfigurationGroup::DemoConfigurationGroup(CaptureCard &a_parent) :
+    VerticalConfigurationGroup(false, true, false, false),
+    parent(a_parent), cardinfo(new TransLabelSetting()),
+    input(new TunerCardInput(parent))
+{
+    VideoDevice *device =
+        new VideoDevice(parent, 0, 15, QString::null, "ivtv");
+
+    cardinfo->setLabel(tr("Probed info"));
+
+    addChild(device);
+    addChild(cardinfo);
+    //addChild(input);
+
+    connect(device, SIGNAL(valueChanged(const QString&)),
+            this,   SLOT(  probeCard(   const QString&)));
+
+    probeCard(device->getValue());
+}
+
+void DemoConfigurationGroup::probeCard(const QString &device)
+{
+    QString cn = tr("Failed to open"), ci = cn, dn = QString::null;
+    QFileInfo fileInfo(device);
+    if (fileInfo.exists())
+    {
+        if (fileInfo.isReadable() && (fileInfo.isFile()))
+            ci = cn = tr("File Access Success");
+    }
+    else
+    {
+        ci = cn = tr("File Access Failure");
+    }
+    cardinfo->setValue(ci);
+    input->fillSelections(device);
+}
+
 HDPVRConfigurationGroup::HDPVRConfigurationGroup(CaptureCard &a_parent) :
     VerticalConfigurationGroup(false, true, false, false),
     parent(a_parent), cardinfo(new TransLabelSetting()),
@@ -2016,6 +2054,9 @@
     addTarget("FREEBOX",   new IPTVConfigurationGroup(parent));
 #endif // USING_IPTV
 
+    //for development or testing purposes
+    addTarget("DEMO",    new DemoConfigurationGroup(parent));
+
     addTarget("IMPORT",    new ImportConfigurationGroup(parent));
 }
 
@@ -2221,6 +2262,7 @@
     setting->addSelection(QObject::tr("Network recorder"), "FREEBOX");
 #endif // USING_IPTV
 
+    setting->addSelection(QObject::tr("Demo recorder"), "DEMO");
     setting->addSelection(QObject::tr("Import recorder"), "IMPORT");
 }
 
Index: libs/libmythtv/mpegrecorder.cpp
===================================================================
--- libs/libmythtv/mpegrecorder.cpp.orig	2010-05-29 18:01:00.000000000 -0400
+++ libs/libmythtv/mpegrecorder.cpp	2010-06-17 16:17:02.000000000 -0400
@@ -307,20 +307,13 @@
     (void)audiodev;
     (void)vbidev;
 
-    if (videodev.toLower().left(5) == "file:")
+    if (videodev.toLower().right(4) == ".mpg")
     {
         deviceIsMpegFile = true;
         bufferSize = 64000;
-        QString newVideoDev = videodev;
-        if (newVideoDev.startsWith("file:", Qt::CaseInsensitive))
-            newVideoDev = newVideoDev.remove(0,5);
-        SetOption("videodevice", newVideoDev);
-    }
-    else
-    {
-        SetOption("videodevice", videodev);
     }
 
+    SetOption("videodevice", videodev);
     SetOption("audiodevice", audiodev);
 
     SetOption("tvformat", gCoreContext->GetSetting("TVFormat"));
Index: libs/libmythtv/tv_rec.cpp
===================================================================
--- libs/libmythtv/tv_rec.cpp.orig	2010-05-24 16:12:34.000000000 -0400
+++ libs/libmythtv/tv_rec.cpp	2010-06-17 16:17:02.000000000 -0400
@@ -181,9 +181,7 @@
         init_run = true;
 #endif
     }
-    else if ((genOpt.cardtype == "IMPORT") ||
-             (genOpt.cardtype == "MPEG" &&
-              genOpt.videodev.toLower().left(5) == "file:"))
+    else if ((genOpt.cardtype == "IMPORT") || (genOpt.cardtype == "DEMO"))
     {
         channel = new DummyChannel(this);
         if (!channel->Open())
@@ -976,7 +974,7 @@
 bool TVRec::SetupRecorder(RecordingProfile &profile)
 {
     recorder = NULL;
-    if (genOpt.cardtype == "MPEG")
+    if ((genOpt.cardtype == "MPEG") || (genOpt.cardtype == "DEMO"))
     {
 #ifdef USING_IVTV
         recorder = new MpegRecorder(this);
