Ticket #8580: mythtv-add_demo_tuner.patch

File mythtv-add_demo_tuner.patch, 7.1 KB (added by johnnyj <johnnyjboss@…>, 14 years ago)

Patch against trunk to add Demo Tuner

  • libs/libmythtv/cardutil.h

    ---
     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(-)
    
    old new  
    5252        OFDM      = 5,        DVBT      = 5,
    5353        ATSC      = 6,
    5454        V4L       = 7,
    55         MPEG      = 8,
     55        MPEG      = 8,        DEMO     = 8,
    5656        FIREWIRE  = 9,
    5757        HDHOMERUN = 10,
    5858        FREEBOX   = 11,
     
    9393            return DVBS2;
    9494        if ("IMPORT" == name)
    9595            return IMPORT;
     96        if ("DEMO" == name)
     97            return DEMO;
    9698        return ERROR_UNKNOWN;
    9799    }
    98100
     
    113115    {
    114116        return
    115117            (rawtype == "FIREWIRE")  || (rawtype == "IMPORT") ||
    116             (rawtype == "HDPVR");
     118            (rawtype == "HDPVR")     || (rawtype == "DEMO");
    117119    }
    118120
    119121    static bool         IsEITCapable(const QString &rawtype)
     
    139141    {
    140142        return
    141143            (rawtype == "V4L")    || (rawtype == "MPEG") ||
    142             (rawtype == "HDPVR");
     144            (rawtype == "HDPVR")  || (rawtype == "DEMO");
    143145    }
    144146
    145147    static bool         IsSingleInputCard(const QString &rawtype)
    146148    {
    147149        return
    148150            (rawtype == "FIREWIRE")  || (rawtype == "FREEBOX") ||
    149             (rawtype == "HDHOMERUN") || (rawtype == "IMPORT");
     151            (rawtype == "HDHOMERUN") || (rawtype == "IMPORT") ||
     152            (rawtype == "DEMO");
    150153    }
    151154
    152155    /// Convenience function for GetCardIDs()
  • libs/libmythtv/videosource.h

    old new  
    519519    TunerCardInput    *input;
    520520};
    521521
     522class DemoConfigurationGroup: public VerticalConfigurationGroup
     523{
     524   Q_OBJECT
     525
     526  public:
     527    DemoConfigurationGroup(CaptureCard &parent);
     528
     529  public slots:
     530    void probeCard(const QString &device);
     531
     532  private:
     533    CaptureCard       &parent;
     534    TransLabelSetting *cardinfo;
     535    TunerCardInput    *input;
     536};
     537
    522538class HDPVRConfigurationGroup: public VerticalConfigurationGroup
    523539{
    524540   Q_OBJECT
  • libs/libmythtv/cardutil.cpp

    old new  
    16441644{
    16451645    bool ok;
    16461646    QStringList ret;
     1647    if (device.endsWith(".mpg"))
     1648    {
     1649        ret += "MPEG2TS";
     1650        return ret;
     1651    }
     1652
    16471653    QByteArray dev = device.toAscii();
    16481654    int videofd = open(dev.constData(), O_RDWR);
    16491655    if (videofd < 0)
  • libs/libmythtv/videosource.cpp

    old new  
    2020#include <QDir>
    2121#include <QProcess>
    2222#include <QDateTime>
     23#include <QFile>
    2324
    2425// MythTV headers
    2526#include "mythconfig.h"
     
    19381939    input->fillSelections(device);
    19391940}
    19401941
     1942DemoConfigurationGroup::DemoConfigurationGroup(CaptureCard &a_parent) :
     1943    VerticalConfigurationGroup(false, true, false, false),
     1944    parent(a_parent), cardinfo(new TransLabelSetting()),
     1945    input(new TunerCardInput(parent))
     1946{
     1947    VideoDevice *device =
     1948        new VideoDevice(parent, 0, 15, QString::null, "ivtv");
     1949
     1950    cardinfo->setLabel(tr("Probed info"));
     1951
     1952    addChild(device);
     1953    addChild(cardinfo);
     1954    //addChild(input);
     1955
     1956    connect(device, SIGNAL(valueChanged(const QString&)),
     1957            this,   SLOT(  probeCard(   const QString&)));
     1958
     1959    probeCard(device->getValue());
     1960}
     1961
     1962void DemoConfigurationGroup::probeCard(const QString &device)
     1963{
     1964    QString cn = tr("Failed to open"), ci = cn, dn = QString::null;
     1965    QFileInfo fileInfo(device);
     1966    if (fileInfo.exists())
     1967    {
     1968        if (fileInfo.isReadable() && (fileInfo.isFile()))
     1969            ci = cn = tr("File Access Success");
     1970    }
     1971    else
     1972    {
     1973        ci = cn = tr("File Access Failure");
     1974    }
     1975    cardinfo->setValue(ci);
     1976    input->fillSelections(device);
     1977}
     1978
    19411979HDPVRConfigurationGroup::HDPVRConfigurationGroup(CaptureCard &a_parent) :
    19421980    VerticalConfigurationGroup(false, true, false, false),
    19431981    parent(a_parent), cardinfo(new TransLabelSetting()),
     
    20162054    addTarget("FREEBOX",   new IPTVConfigurationGroup(parent));
    20172055#endif // USING_IPTV
    20182056
     2057    //for development or testing purposes
     2058    addTarget("DEMO",    new DemoConfigurationGroup(parent));
     2059
    20192060    addTarget("IMPORT",    new ImportConfigurationGroup(parent));
    20202061}
    20212062
     
    22212262    setting->addSelection(QObject::tr("Network recorder"), "FREEBOX");
    22222263#endif // USING_IPTV
    22232264
     2265    setting->addSelection(QObject::tr("Demo recorder"), "DEMO");
    22242266    setting->addSelection(QObject::tr("Import recorder"), "IMPORT");
    22252267}
    22262268
  • libs/libmythtv/mpegrecorder.cpp

    old new  
    307307    (void)audiodev;
    308308    (void)vbidev;
    309309
    310     if (videodev.toLower().left(5) == "file:")
     310    if (videodev.toLower().right(4) == ".mpg")
    311311    {
    312312        deviceIsMpegFile = true;
    313313        bufferSize = 64000;
    314         QString newVideoDev = videodev;
    315         if (newVideoDev.startsWith("file:", Qt::CaseInsensitive))
    316             newVideoDev = newVideoDev.remove(0,5);
    317         SetOption("videodevice", newVideoDev);
    318     }
    319     else
    320     {
    321         SetOption("videodevice", videodev);
    322314    }
    323315
     316    SetOption("videodevice", videodev);
    324317    SetOption("audiodevice", audiodev);
    325318
    326319    SetOption("tvformat", gCoreContext->GetSetting("TVFormat"));
  • libs/libmythtv/tv_rec.cpp

    old new  
    181181        init_run = true;
    182182#endif
    183183    }
    184     else if ((genOpt.cardtype == "IMPORT") ||
    185              (genOpt.cardtype == "MPEG" &&
    186               genOpt.videodev.toLower().left(5) == "file:"))
     184    else if ((genOpt.cardtype == "IMPORT") || (genOpt.cardtype == "DEMO"))
    187185    {
    188186        channel = new DummyChannel(this);
    189187        if (!channel->Open())
     
    976974bool TVRec::SetupRecorder(RecordingProfile &profile)
    977975{
    978976    recorder = NULL;
    979     if (genOpt.cardtype == "MPEG")
     977    if ((genOpt.cardtype == "MPEG") || (genOpt.cardtype == "DEMO"))
    980978    {
    981979#ifdef USING_IVTV
    982980        recorder = new MpegRecorder(this);