Index: libs/libmythtv/pchdtvsignalmonitor.h
===================================================================
--- libs/libmythtv/pchdtvsignalmonitor.h	(revision 12619)
+++ libs/libmythtv/pchdtvsignalmonitor.h	(working copy)
@@ -1,41 +0,0 @@
-// -*- Mode: c++ -*-
-// Copyright (c) 2005, Daniel Thor Kristjansson
-
-#ifndef PCHDTVSIGNALMONITOR_H
-#define PCHDTVSIGNALMONITOR_H
-
-#include "dtvsignalmonitor.h"
-
-class Channel;
-
-class pcHDTVSignalMonitor: public DTVSignalMonitor
-{
-    Q_OBJECT
-  public:
-    pcHDTVSignalMonitor(int db_cardnum, Channel *_channel,
-                        uint _flags = kDTVSigMon_WaitForSig,
-                        const char *_name = "pcHDTVSignalMonitor");
-    ~pcHDTVSignalMonitor();
-
-    void Stop();
-
-  public slots:
-    void deleteLater(void);
-
-  private:
-    pcHDTVSignalMonitor();
-    pcHDTVSignalMonitor(const pcHDTVSignalMonitor&);
-
-    virtual void UpdateValues();
-
-    static int GetSignal(int fd, uint input, bool usingv4l2);
-
-    static void *TableMonitorThread(void *param);
-    void RunTableMonitor();
-
-    bool      usingv4l2;
-    bool      dtvMonitorRunning;
-    pthread_t table_monitor_thread;
-};
-
-#endif // PCHDTVSIGNALMONITOR_H
Index: libs/libmythtv/hdtvrecorder.h
===================================================================
--- libs/libmythtv/hdtvrecorder.h	(revision 12619)
+++ libs/libmythtv/hdtvrecorder.h	(working copy)
@@ -1,110 +0,0 @@
-// -*- Mode: c++ -*-
-/**
- *  HDTVRecorder
- *  Copyright (c) 2003-2004 by Brandon Beattie, Doug Larrick, 
- *    Jason Hoos, and Daniel Thor Kristjansson
- *  Device ringbuffer added by John Poet
- *  Distributed as part of MythTV under GPL v2 and later.
- */
-
-#ifndef HDTVRECORDER_H_
-#define HDTVRECORDER_H_
-
-#include "dtvrecorder.h"
-#include "tsstats.h"
-#include "streamlisteners.h"
-
-struct AVFormatContext;
-struct AVPacket;
-
-/** \class HDTVRecorder
- *  \brief This is a specialization of DTVRecorder used to 
- *         handle streams from bttv drivers, such as the
- *         vendor drivers for the the HD-2000 and HD-3000.
- *
- *  \sa DTVRecorder, DVBRecorder
- */
-class HDTVRecorder : public DTVRecorder,
-                     public MPEGSingleProgramStreamListener,
-                     public ATSCMainStreamListener
-{
-    friend class ATSCStreamData;
-    friend class TSPacketProcessor;
-
-  public:
-    enum {report_loops = 20000};
-
-    HDTVRecorder(TVRec *rec);
-   ~HDTVRecorder();
-
-    void SetOptionsFromProfile(RecordingProfile *profile,
-                               const QString &videodev,
-                               const QString &audiodev,
-                               const QString &vbidev);
-
-    void StartRecording(void);
-    void StopRecording(void);
-
-    void Pause(bool clear = false);
-    bool IsPaused(void) const;
-
-    void Reset(void);
-
-    bool Open(void);
-
-    void SetStreamData(MPEGStreamData*);
-    MPEGStreamData* GetStreamData(void);
-    ATSCStreamData* GetATSCStreamData(void) { return _atsc_stream_data; }
-
-    void HandleSingleProgramPAT(ProgramAssociationTable*);
-    void HandleSingleProgramPMT(ProgramMapTable*);
-
-    void HandleSTT(const SystemTimeTable*) {}
-    void HandleMGT(const MasterGuideTable*);
-    void HandleVCT(uint, const VirtualChannelTable*);
-
-  private:
-    void TeardownAll(void);
-
-    int  ProcessData    (const unsigned char *buffer, uint len);
-    int  ResyncStream   (const unsigned char *buffer, uint pos, uint len);
-    bool ProcessTSPacket(const TSPacket &tspacket);
-
-    static void *boot_ringbuffer(void *);
-    void fill_ringbuffer(void);
-    int ringbuf_read(unsigned char *buffer, size_t count);
-
- private:
-    ATSCStreamData* _atsc_stream_data;
-
-    // statistics
-    TSStats _ts_stats;
-    long long _resync_count;
-    size_t loop;
-
-    // Data for managing the device ringbuffer
-    struct {
-        pthread_t        thread;
-        mutable pthread_mutex_t lock;
-        mutable pthread_mutex_t lock_stats;
-
-        bool             run;
-        bool             eof;
-        bool             error;
-        bool             request_pause;
-        bool             paused;
-        size_t           size;
-        size_t           used;
-        size_t           max_used;
-        size_t           avg_used;
-        size_t           avg_cnt;
-        size_t           dev_read_size;
-        size_t           min_read;
-        unsigned char  * buffer;
-        unsigned char  * readPtr;
-        unsigned char  * writePtr;
-        unsigned char  * endPtr;
-    } ringbuf;
-};
-
-#endif
Index: libs/libmythtv/hdtvrecorder.cpp
===================================================================
--- libs/libmythtv/hdtvrecorder.cpp	(revision 12619)
+++ libs/libmythtv/hdtvrecorder.cpp	(working copy)
@@ -1,909 +0,0 @@
-/* HDTVRecorder
-   Version 0.1
-   July 4th, 2003
-   GPL License (c)
-   By Brandon Beattie
-
-   Portions of this code taken from mpegrecorder
-
-   Modified Oct. 2003 by Doug Larrick
-   * decodes MPEG-TS locally (does not use libavformat) for flexibility
-   * output format is MPEG-TS omitting unneeded PIDs, for smaller files
-     and no audio stutter on stations with >1 audio stream
-   * Emits proper keyframe data to recordedmarkup db, enabling seeking
-
-   Oct. 22, 2003:
-   * delay until GOP before writing output stream at start and reset
-     (i.e. channel change)
-   * Rewrite PIDs after channel change to be the same as before, so
-     decoder can follow
-
-   Oct. 27, 2003 by Jason Hoos:
-   * if no GOP is detected within the first 30 frames of the stream, then
-     assume that it's safe to treat a picture start as a GOP.
-
-   Oct. 30, 2003 by Jason Hoos:
-   * added code to rewrite PIDs in the MPEG PAT and PMT tables.  fixes 
-     a problem with stations (particularly, WGN in Chicago) that list their 
-     programs in reverse order in the PAT, which was confusing ffmpeg 
-     (ffmpeg was looking for program 5, but only program 2 was left in 
-     the stream, so it choked).
-
-   Nov. 3, 2003 by Doug Larrick:
-   * code to enable selecting a program number for stations with
-     multiple programs
-   * always renumber PIDs to match outgoing program number (#1:
-     0x10 (base), 0x11 (video), 0x14 (audio))
-   * change expected keyframe distance to 30 frames to see if this
-     lets people seek past halfway in recordings
-
-   Jan 30, 2004 by Daniel Kristjansson
-   * broke out tspacket to handle TS packets
-   * added CRC check on PAT & PMT packets
-   Sept 27, 2004
-   * added decoding of most ATSC Tables
-   * added multiple audio support
-
-
-   References / example code: 
-     ATSC standards a.54, a.69 (www.atsc.org)
-     ts2pes from mpegutils from dvb (www.linuxtv.org)
-     bbinfo from Brent Beyeler, beyeler@home.com
-*/
-
-// C includes
-#include <cstdio>
-#include <cstdlib>
-#include <cerrno>
-#include <ctime>
-#include <fcntl.h>
-#include <pthread.h>
-#include <unistd.h>
-
-// C system includes
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-
-// C++ includes
-#include <iostream>
-using namespace std;
-
-// MythTV system include
-#include "videodev_myth.h"
-
-// MythTV includes
-#include "hdtvrecorder.h"
-#include "RingBuffer.h"
-#include "mythcontext.h"
-#include "mythdbcon.h"
-#include "programinfo.h"
-#include "channel.h"
-#include "mpegtables.h"
-#include "atsctables.h"
-#include "atscstreamdata.h"
-#include "tv_rec.h"
-
-// AVLib/FFMPEG includes
-#include "../libavcodec/avcodec.h"
-#include "../libavformat/avformat.h"
-#include "../libavformat/mpegts.h"
-
-#define REPORT_RING_STATS 1
-
-#define DEFAULT_SUBCHANNEL 1
-
-#define WHACK_A_BUG_VIDEO 0
-#define WHACK_A_BUG_AUDIO 0
-
-#if FAKE_VIDEO
-    static int fake_video_index = 0;
-#define FAKE_VIDEO_NUM 4
-    static const char* FAKE_VIDEO_FILES[FAKE_VIDEO_NUM] =
-        {
-            "/video/abc.ts",
-            "/video/wb.ts",
-            "/video/abc2.ts",
-            "/video/nbc.ts",
-        };
-#endif
-
-HDTVRecorder::HDTVRecorder(TVRec *rec)
-    : DTVRecorder(rec),
-      _atsc_stream_data(NULL),
-      _resync_count(0)
-{
-    SetStreamData(new ATSCStreamData(-1, DEFAULT_SUBCHANNEL));
-
-    _buffer_size = TSPacket::SIZE * 1500;
-    if ((_buffer = new unsigned char[_buffer_size])) {
-        // make valgrind happy, initialize buffer memory
-        memset(_buffer, 0xFF, _buffer_size);
-    }
-
-    VERBOSE(VB_RECORD, QString("HD buffer size %1 KB").arg(_buffer_size/1024));
-
-    ringbuf.run = false;
-    ringbuf.buffer = 0;
-    pthread_mutex_init(&ringbuf.lock, NULL);
-    pthread_mutex_init(&ringbuf.lock_stats, NULL);
-    loop = random() % (report_loops / 2);
-}
-
-void HDTVRecorder::TeardownAll(void)
-{
-    // Make SURE that the ringbuffer thread is cleaned up
-    StopRecording();
-
-    if (_stream_fd >= 0)
-    {
-        close(_stream_fd);
-        _stream_fd = -1;
-    }
-    
-    SetStreamData(NULL);
-
-    if (_buffer)
-    {
-        delete[] _buffer;
-        _buffer = NULL;
-    }
-}
-
-HDTVRecorder::~HDTVRecorder()
-{
-    TeardownAll();
-    pthread_mutex_destroy(&ringbuf.lock);
-    pthread_mutex_destroy(&ringbuf.lock_stats);
-}
-
-void HDTVRecorder::SetOptionsFromProfile(RecordingProfile *profile,
-                                         const QString &videodev,
-                                         const QString &audiodev,
-                                         const QString &vbidev)
-{
-    (void)audiodev;
-    (void)vbidev;
-    (void)profile;
-
-    SetOption("videodevice", videodev);
-    SetOption("tvformat", gContext->GetSetting("TVFormat"));
-    SetOption("vbiformat", gContext->GetSetting("VbiFormat"));
-}
-
-bool HDTVRecorder::Open()
-{
-    if (!_atsc_stream_data || !_buffer)
-        return false;
-
-#if FAKE_VIDEO
-    // open file instead of device
-    if (_stream_fd >=0 && close(_stream_fd))
-    {
-        VERBOSE(VB_IMPORTANT,
-                QString("HDTVRecorder::Open(): Error, failed to close "
-                        "existing fd (%1)").arg(strerror(errno)));
-        return false;
-    }
-
-    _stream_fd = open(FAKE_VIDEO_FILES[fake_video_index], O_RDWR);
-    VERBOSE(VB_IMPORTANT, QString("Opened fake video source %1").arg(FAKE_VIDEO_FILES[fake_video_index]));
-    fake_video_index = (fake_video_index+1)%FAKE_VIDEO_NUM;
-#else
-    if (_stream_fd <= 0)
-        _stream_fd = open(videodevice.ascii(), O_RDWR);
-#endif
-    if (_stream_fd <= 0)
-    {
-        VERBOSE(VB_IMPORTANT, QString("Can't open video device: %1 chanfd = %2")
-                .arg(videodevice).arg(_stream_fd));
-        perror("open video:");
-    }
-    return (_stream_fd>0);
-}
-
-void HDTVRecorder::SetStreamData(MPEGStreamData *xdata)
-{
-    ATSCStreamData *data = dynamic_cast<ATSCStreamData*>(xdata);
-
-    if (data == _atsc_stream_data)
-        return;
-
-    ATSCStreamData *old_data = _atsc_stream_data;
-    _atsc_stream_data = data;
-    if (old_data)
-        delete old_data;
-
-    if (data)
-    {
-        data->AddMPEGSPListener(this);
-        data->AddATSCMainListener(this);
-    }
-}
-
-MPEGStreamData *HDTVRecorder::GetStreamData(void)
-{
-    return _atsc_stream_data;
-}
-
-bool readchan(int chanfd, unsigned char* buffer, int dlen) {
-    int len = read(chanfd, buffer, dlen); // read next byte
-    if (dlen != len)
-    {
-        if (len < 0)
-        {
-            VERBOSE(VB_IMPORTANT, QString("HD1 error reading from device"));
-            perror("read");
-        }
-        else if (len == 0)
-            VERBOSE(VB_IMPORTANT, QString("HD2 end of file found in packet"));
-        else 
-            VERBOSE(VB_IMPORTANT, QString("HD3 partial read. This shouldn't happen!"));
-    }
-    return (dlen == len);
-}
-
-bool syncchan(int chanfd, int dlen, int keepsync) {
-    unsigned char b[188];
-    int i, j;
-    for (i=0; i<dlen; i++) {
-        if (!readchan(chanfd, b, 1))
-            break;
-        if (SYNC_BYTE == b[0])
-        {
-            if (readchan(chanfd, &b[1], TSPacket::SIZE-1)) {
-                i += (TSPacket::SIZE - 1);
-                for (j=0; j<keepsync; j++)
-                {
-                    if (!readchan(chanfd, b, TSPacket::SIZE))
-                        return false;
-                    i += TSPacket::SIZE;
-                    if (SYNC_BYTE != b[0])
-                        break;
-                }
-                if (j==keepsync)
-                {
-                    VERBOSE(VB_RECORD,
-                            QString("HD4 obtained device stream sync after reading %1 bytes").
-                            arg(dlen));
-                    return true;
-                }
-                continue;
-            }
-            break;
-        }
-    }
-    VERBOSE(VB_IMPORTANT, QString("HD5 Error: could not obtain sync"));
-    return false;
-}
-
-void * HDTVRecorder::boot_ringbuffer(void * arg)
-{
-    HDTVRecorder *dtv = (HDTVRecorder *)arg;
-    dtv->fill_ringbuffer();
-    return NULL;
-}
-
-void HDTVRecorder::fill_ringbuffer(void)
-{
-    int       errcnt = 0;
-    int       len;
-    size_t    unused, used;
-    size_t    contiguous;
-    size_t    read_size;
-    bool      run, request_pause, paused;
-
-    pthread_mutex_lock(&ringbuf.lock);
-    ringbuf.run = true;
-    pthread_mutex_unlock(&ringbuf.lock);
-
-    for (;;)
-    {
-        pthread_mutex_lock(&ringbuf.lock);
-        run = ringbuf.run;
-        unused = ringbuf.size - ringbuf.used;
-        request_pause = ringbuf.request_pause;
-        paused = ringbuf.paused;
-        pthread_mutex_unlock(&ringbuf.lock);
-
-        if (!run)
-            break;
-
-        if (request_pause)
-        {
-            pthread_mutex_lock(&ringbuf.lock);
-            ringbuf.paused = true;
-            pthread_mutex_unlock(&ringbuf.lock);
-
-            pauseWait.wakeAll();
-            if (tvrec)
-                tvrec->RecorderPaused();
-
-            usleep(1000);
-            continue;
-        }
-        else if (paused)
-        {
-            pthread_mutex_lock(&ringbuf.lock);
-            ringbuf.writePtr = ringbuf.readPtr = ringbuf.buffer;
-            ringbuf.used = 0;
-            ringbuf.paused = false;
-            pthread_mutex_unlock(&ringbuf.lock);
-        }
-
-        contiguous = ringbuf.endPtr - ringbuf.writePtr;
-
-        while (unused < TSPacket::SIZE && contiguous > TSPacket::SIZE)
-        {
-            usleep(500);
-
-            pthread_mutex_lock(&ringbuf.lock);
-            unused = ringbuf.size - ringbuf.used;
-            request_pause = ringbuf.request_pause;
-            pthread_mutex_unlock(&ringbuf.lock);
-
-            if (request_pause)
-                break;
-        }
-        if (request_pause)
-            continue;
-
-        read_size = unused > contiguous ? contiguous : unused;
-        if (read_size > ringbuf.dev_read_size)
-            read_size = ringbuf.dev_read_size;
-
-        len = read(_stream_fd, ringbuf.writePtr, read_size);
-
-        if (len < 0)
-        {
-            if (errno == EINTR)
-                continue;
-
-            VERBOSE(VB_IMPORTANT, QString("HD7 error reading from %1")
-                    .arg(videodevice));
-            perror("read");
-            if (++errcnt > 5)
-            {
-                pthread_mutex_lock(&ringbuf.lock);
-                ringbuf.error = true;
-                pthread_mutex_unlock(&ringbuf.lock);
-
-                break;
-            }
-
-            usleep(500);
-            continue;
-        }
-        else if (len == 0)
-        {
-            if (++errcnt > 5)
-            {
-                VERBOSE(VB_IMPORTANT, QString("HD8 %1 end of file found.")
-                        .arg(videodevice));
-
-                pthread_mutex_lock(&ringbuf.lock);
-                ringbuf.eof = true;
-                pthread_mutex_unlock(&ringbuf.lock);
-
-                break;
-            }
-            usleep(500);
-            continue;
-        }
-
-        errcnt = 0;
-
-        pthread_mutex_lock(&ringbuf.lock);
-        ringbuf.used += len;
-        used = ringbuf.used;
-        ringbuf.writePtr += len;
-        pthread_mutex_unlock(&ringbuf.lock);
-
-#ifdef REPORT_RING_STATS
-        pthread_mutex_lock(&ringbuf.lock_stats);
-
-        if (ringbuf.max_used < used)
-            ringbuf.max_used = used;
-
-        ringbuf.avg_used = ((ringbuf.avg_used * ringbuf.avg_cnt) + used)
-                           / ++ringbuf.avg_cnt;
-        pthread_mutex_unlock(&ringbuf.lock_stats);
-#endif
-
-        if (ringbuf.writePtr == ringbuf.endPtr)
-            ringbuf.writePtr = ringbuf.buffer;
-    }
-
-    close(_stream_fd);
-    _stream_fd = -1;
-}
-
-/* read count bytes from ring into buffer */
-int HDTVRecorder::ringbuf_read(unsigned char *buffer, size_t count)
-{
-    size_t          avail;
-    size_t          cnt = count;
-    size_t          min_read;
-    unsigned char  *cPtr = buffer;
-
-    bool            dev_error = false;
-    bool            dev_eof = false;
-
-    pthread_mutex_lock(&ringbuf.lock);
-    avail = ringbuf.used;
-    pthread_mutex_unlock(&ringbuf.lock);
-
-    min_read = cnt < ringbuf.min_read ? cnt : ringbuf.min_read;
-
-    while (min_read > avail)
-    {
-        usleep(50000);
-
-        if (request_pause || dev_error || dev_eof)
-            return 0;
-
-        pthread_mutex_lock(&ringbuf.lock);
-        dev_error = ringbuf.error;
-        dev_eof = ringbuf.eof;
-        avail = ringbuf.used;
-        pthread_mutex_unlock(&ringbuf.lock);
-    }
-    if (cnt > avail)
-        cnt = avail;
-
-    if (ringbuf.readPtr + cnt > ringbuf.endPtr)
-    {
-        size_t      len;
-
-        // Process as two pieces
-        len = ringbuf.endPtr - ringbuf.readPtr;
-        memcpy(cPtr, ringbuf.readPtr, len);
-        cPtr += len;
-        len = cnt - len;
-
-        // Wrap arround to begining of buffer
-        ringbuf.readPtr = ringbuf.buffer;
-        memcpy(cPtr, ringbuf.readPtr, len);
-        ringbuf.readPtr += len;
-    }
-    else
-    {
-        memcpy(cPtr, ringbuf.readPtr, cnt);
-        ringbuf.readPtr += cnt;
-    }
-
-    pthread_mutex_lock(&ringbuf.lock);
-    ringbuf.used -= cnt;
-    pthread_mutex_unlock(&ringbuf.lock);
-
-    if (ringbuf.readPtr == ringbuf.endPtr)
-        ringbuf.readPtr = ringbuf.buffer;
-    else
-    {
-#ifdef REPORT_RING_STATS
-        size_t samples, avg, max;
-
-        if (++loop == report_loops)
-        {
-            loop = 0;
-            pthread_mutex_lock(&ringbuf.lock_stats);
-            avg = ringbuf.avg_used;
-            samples = ringbuf.avg_cnt;
-            max = ringbuf.max_used;
-            ringbuf.avg_used = 0;
-            ringbuf.avg_cnt = 0;
-            ringbuf.max_used = 0;
-            pthread_mutex_unlock(&ringbuf.lock_stats);
-
-            VERBOSE(VB_IMPORTANT, QString("%1 ringbuf avg %2% max %3%"
-                                          " samples %4")
-                    .arg(videodevice)
-                    .arg((static_cast<double>(avg)
-                          / ringbuf.size) * 100.0)
-                    .arg((static_cast<double>(max)
-                          / ringbuf.size) * 100.0)
-                    .arg(samples));
-        }
-        else
-#endif
-            usleep(25);
-    }
-
-    return cnt;
-}
-
-void HDTVRecorder::StartRecording(void)
-{
-    bool            pause;
-    bool            dev_error, dev_eof;
-    int             len;
-
-    const int unsyncpackets = 50; // unsynced packets to look at before giving up
-    const int syncpackets   = 10; // synced packets to require before starting recording
-
-    VERBOSE(VB_RECORD, QString("StartRecording"));
-
-    if (!Open())
-    {
-        _error = true;        
-        return;
-    }
-
-    _request_recording = true;
-    _recording = true;
-
-    // Setup device ringbuffer
-    delete[] ringbuf.buffer;
-
-//    ringbuf.size = 60 * 1024 * TSPacket::SIZE;
-    ringbuf.size = gContext->GetNumSetting("HDRingbufferSize", 50*188);
-    ringbuf.size *= 1024;
-
-    if ((ringbuf.buffer =
-         new unsigned char[ringbuf.size + TSPacket::SIZE]) == NULL)
-    {
-        VERBOSE(VB_IMPORTANT, "Failed to allocate HDTVRecorder ring buffer.");
-        _error = true;
-        return;
-    }
-
-    memset(ringbuf.buffer, 0xFF, ringbuf.size + TSPacket::SIZE);
-    ringbuf.endPtr = ringbuf.buffer + ringbuf.size;
-    ringbuf.readPtr = ringbuf.writePtr = ringbuf.buffer;
-    ringbuf.dev_read_size = TSPacket::SIZE * 48;
-    ringbuf.min_read = TSPacket::SIZE * 4;
-    ringbuf.used = 0;
-    ringbuf.max_used = 0;
-    ringbuf.avg_used = 0;
-    ringbuf.avg_cnt = 0;
-    ringbuf.request_pause = false;
-    ringbuf.paused = false;
-    ringbuf.error = false;
-    ringbuf.eof = false;
-
-    VERBOSE(VB_RECORD, QString("HD ring buffer size %1 KB")
-            .arg(ringbuf.size/1024));
-
-    // sync device stream so it starts with a valid ts packet
-    if (!syncchan(_stream_fd, TSPacket::SIZE*unsyncpackets, syncpackets))
-    {
-        _error = true;
-        return;
-    }
-
-    // create thread to fill the ringbuffer
-    pthread_create(&ringbuf.thread, NULL, boot_ringbuffer,
-                   reinterpret_cast<void *>(this));
-
-    int remainder = 0;
-    // TRANSFER DATA
-    while (_request_recording) 
-    {
-        pthread_mutex_lock(&ringbuf.lock);
-        dev_error = ringbuf.error;
-        dev_eof = ringbuf.eof;
-        pause = ringbuf.paused;
-        pthread_mutex_unlock(&ringbuf.lock);
-
-        if (request_pause)
-        {
-            pthread_mutex_lock(&ringbuf.lock);
-            ringbuf.request_pause = true;
-            pthread_mutex_unlock(&ringbuf.lock);
-
-            usleep(1000);
-            continue;
-        }
-        else if (pause)
-        {
-            pthread_mutex_lock(&ringbuf.lock);
-            ringbuf.request_pause = false;
-            pthread_mutex_unlock(&ringbuf.lock);
-
-            usleep(1500);
-            continue;
-        }
-
-        if (dev_error)
-        {
-            VERBOSE(VB_IMPORTANT, "HDTV: device error detected");
-            _error = true;
-            break;
-        }
-
-        if (dev_eof)
-            break;
-
-        len = ringbuf_read(&(_buffer[remainder]), _buffer_size - remainder);
-
-        if (len == 0)
-            continue;
-
-        len += remainder;
-        remainder = ProcessData(_buffer, len);
-        if (remainder > 0 && (len > remainder)) // leftover bytes
-            memmove(_buffer, &(_buffer[len - remainder]), remainder);
-    }
-
-    FinishRecording();
-    _recording = false;
-}
-
-void HDTVRecorder::StopRecording(void)
-{
-    TVRec *rec = tvrec;
-    tvrec = NULL; // don't notify of pause..
-
-    bool ok = true;
-    if (!IsPaused())
-    {
-        Pause();
-        ok = WaitForPause(250);
-    }
-
-    _request_recording = false;
-
-    pthread_mutex_lock(&ringbuf.lock);
-    bool run = ringbuf.run;
-    ringbuf.run = false;
-    pthread_mutex_unlock(&ringbuf.lock);
-
-    if (run)
-        pthread_join(ringbuf.thread, NULL);
-
-    if (!ok)
-    {
-        // Better to have a memory leak, then a segfault?
-        VERBOSE(VB_IMPORTANT, "DTV ringbuffer not cleaned up!\n");
-    }
-    else
-    {
-        delete[] ringbuf.buffer;
-        ringbuf.buffer = 0;
-    }
-    tvrec = rec;
-}
-
-void HDTVRecorder::Pause(bool /*clear*/)
-{
-    pthread_mutex_lock(&ringbuf.lock);
-    ringbuf.paused = false;
-    pthread_mutex_unlock(&ringbuf.lock);
-    request_pause = true;
-}
-
-bool HDTVRecorder::IsPaused(void) const
-{
-    pthread_mutex_lock(&ringbuf.lock);
-    bool paused = ringbuf.paused;
-    pthread_mutex_unlock(&ringbuf.lock);
-
-    return paused;
-}
-
-int HDTVRecorder::ResyncStream(const unsigned char *buffer,
-                               uint curr_pos, uint len)
-{
-    // Search for two sync bytes 188 bytes apart, 
-    uint pos = curr_pos;
-    uint nextpos = pos + TSPacket::SIZE;
-    if (nextpos >= len)
-        return -1; // not enough bytes; caller should try again
-    
-    while (buffer[pos] != SYNC_BYTE || buffer[nextpos] != SYNC_BYTE)
-    {
-        pos++;
-        nextpos++;
-        if (nextpos == len)
-            return -2; // not found
-    }
-
-    return pos;
-}
-
-void HDTVRecorder::HandleSingleProgramPAT(ProgramAssociationTable *pat)
-{
-    if (!pat)
-        return;
-
-    int next = (pat->tsheader()->ContinuityCounter()+1)&0xf;
-    pat->tsheader()->SetContinuityCounter(next);
-    BufferedWrite(*(reinterpret_cast<TSPacket*>(pat->tsheader())));
-}
-
-void HDTVRecorder::HandleSingleProgramPMT(ProgramMapTable* pmt)
-{
-    if (!pmt)
-        return;
-
-    int next = (pmt->tsheader()->ContinuityCounter()+1)&0xf;
-    pmt->tsheader()->SetContinuityCounter(next);
-    BufferedWrite(*(reinterpret_cast<TSPacket*>(pmt->tsheader())));
-}
-
-/** \fn HDTVRecorder::HandleMGT(const MasterGuideTable*)
- *  \brief Handles Master Guide Table, by enabling the 
- *         scanning of all PIDs listed.
- */
-void HDTVRecorder::HandleMGT(const MasterGuideTable *mgt)
-{
-    for (unsigned int i=0; i<mgt->TableCount(); i++)
-        GetStreamData()->AddListeningPID(mgt->TablePID(i));
-}
-
-/** \fn HDTVRecorder::HandleVCT(uint, const VirtualChannelTable*)
- *  \brief Handles Virtual Channel Tables by finding the program
- *         number to use.
- *  \bug Assumes there is only one VCT, may break on Cable.
- */
-void HDTVRecorder::HandleVCT(uint /*tsid*/, const VirtualChannelTable *vct)
-{
-    if (vct->ChannelCount() < 1)
-    {
-        VERBOSE(VB_IMPORTANT,
-                "HDTVRecorder::HandleVCT: table has no channels");
-        return;
-    }
-
-    bool found = false;    
-    VERBOSE(VB_RECORD, QString("Desired channel %1_%2")
-            .arg(GetATSCStreamData()->DesiredMajorChannel())
-            .arg(GetATSCStreamData()->DesiredMinorChannel()));
-    for (uint i = 0; i < vct->ChannelCount(); i++)
-    {
-        int maj = GetATSCStreamData()->DesiredMajorChannel();
-        int min = GetATSCStreamData()->DesiredMinorChannel();
-        if ((maj == -1 || vct->MajorChannel(i) == (uint)maj) &&
-            (vct->MinorChannel(i) == (uint)min))
-        {
-            uint pnum = (uint) GetATSCStreamData()->DesiredProgram();
-            if (vct->ProgramNumber(i) != pnum)
-            {
-                VERBOSE(VB_RECORD, 
-                        QString("Resetting desired program from %1"
-                                " to %2")
-                        .arg(GetATSCStreamData()->DesiredProgram())
-                        .arg(vct->ProgramNumber(i)));
-                // Do a (partial?) reset here if old desired
-                // program is not 0?
-                GetATSCStreamData()->SetDesiredProgram(vct->ProgramNumber(i));
-            }
-            found = true;
-        }
-    }
-    if (!found)
-    {
-        VERBOSE(VB_IMPORTANT, 
-                QString("Desired channel %1_%2 not found;"
-                        " using %3_%4 instead.")
-                .arg(GetATSCStreamData()->DesiredMajorChannel())
-                .arg(GetATSCStreamData()->DesiredMinorChannel())
-                .arg(vct->MajorChannel(0))
-                .arg(vct->MinorChannel(0)));
-        VERBOSE(VB_IMPORTANT, vct->toString());
-        GetATSCStreamData()->SetDesiredProgram(vct->ProgramNumber(0));
-    }
-}
-
-bool HDTVRecorder::ProcessTSPacket(const TSPacket &tspacket)
-{
-    bool ok = !tspacket.TransportError();
-    if (ok && !tspacket.ScramplingControl())
-    {
-        if (tspacket.HasAdaptationField())
-            GetStreamData()->HandleAdaptationFieldControl(&tspacket);
-        if (tspacket.HasPayload())
-        {
-            const unsigned int lpid = tspacket.PID();
-            // Pass or reject frames based on PID, and parse info from them
-            if (lpid == GetStreamData()->VideoPIDSingleProgram())
-            {
-                _buffer_packets = !FindMPEG2Keyframes(&tspacket);
-                BufferedWrite(tspacket);
-            }
-            else if (GetStreamData()->IsAudioPID(lpid))
-                BufferedWrite(tspacket);
-            else if (GetStreamData()->IsListeningPID(lpid))
-                GetStreamData()->HandleTSTables(&tspacket);
-            else if (GetStreamData()->IsWritingPID(lpid))
-                BufferedWrite(tspacket);
-            else if (GetATSCStreamData()->VersionMGT()>=0)
-                _ts_stats.IncrPIDCount(lpid);
-        }
-    }
-    return ok;
-}
-
-int HDTVRecorder::ProcessData(const unsigned char *buffer, uint len)
-{
-    uint pos = 0;
-
-    while (pos + 187 < len) // while we have a whole packet left
-    {
-        if (buffer[pos] != SYNC_BYTE)
-        {
-            _resync_count++;
-            if (25 == _resync_count) 
-                VERBOSE(VB_RECORD, QString("Resyncing many of times, suppressing error messages"));
-            else if (25 > _resync_count)
-                VERBOSE(VB_RECORD, QString("Resyncing"));
-            int newpos = ResyncStream(buffer, pos, len);
-            if (newpos == -1)
-                return len - pos;
-            if (newpos == -2)
-                return TSPacket::SIZE;
-
-            pos = newpos;
-        }
-
-        const TSPacket *pkt = reinterpret_cast<const TSPacket*>(&buffer[pos]);
-        if (ProcessTSPacket(*pkt))
-        {
-            pos += TSPacket::SIZE; // Advance to next TS packet
-            _ts_stats.IncrTSPacketCount();
-            if (0 == _ts_stats.TSPacketCount()%1000000)
-                VERBOSE(VB_RECORD, _ts_stats.toString());
-        }
-        else
-        { // Let it resync in case of dropped bytes
-            pos++;
-        }
-    }
-
-    return len - pos;
-}
-
-void HDTVRecorder::Reset(void)
-{
-    VERBOSE(VB_RECORD, "HDTVRecorder::Reset(void)");
-    DTVRecorder::Reset();
-
-    _error = false;
-    _resync_count = 0;
-    _ts_stats.Reset();
-
-    if (curRecording)
-    {
-        curRecording->ClearPositionMap(MARK_GOP_BYFRAME);
-    }
-
-    if (_stream_fd >= 0) 
-    {
-        if (!IsPaused())
-        {
-            Pause();
-            WaitForPause();
-        }
-        int ret = close(_stream_fd);
-        if (ret < 0) 
-        {
-            perror("close");
-            return;
-        }
-#if FAKE_VIDEO
-        // open file instead of device
-        _stream_fd = open(FAKE_VIDEO_FILES[fake_video_index], O_RDWR);
-        VERBOSE(VB_IMPORTANT, QString("Opened fake video source %1").arg(FAKE_VIDEO_FILES[fake_video_index]));
-        fake_video_index = (fake_video_index+1)%FAKE_VIDEO_NUM;
-#else
-        _stream_fd = open(videodevice.ascii(), O_RDWR);
-#endif
-        if (_stream_fd < 0)
-        {
-            VERBOSE(VB_IMPORTANT, QString("HD1 Can't open video device: %1 chanfd = %2").
-                    arg(videodevice).arg(_stream_fd));
-            perror("open video");
-            return;
-        }
-        else
-        {
-            pthread_mutex_lock(&ringbuf.lock);
-            ringbuf.used = 0;
-            ringbuf.max_used = 0;
-            ringbuf.readPtr = ringbuf.writePtr = ringbuf.buffer;
-            pthread_mutex_unlock(&ringbuf.lock);
-        }
-        Unpause();
-    }
-}
Index: libs/libmythtv/cardutil.h
===================================================================
--- libs/libmythtv/cardutil.h	(revision 12619)
+++ libs/libmythtv/cardutil.h	(working copy)
@@ -48,7 +48,6 @@
         ATSC,
         V4L,
         MPEG,
-        HDTV,
         FIREWIRE,
         HDHOMERUN,
         CRC_IP,
@@ -75,8 +74,6 @@
             return V4L;
         if ("MPEG" == name)
             return MPEG;
-        if ("HDTV" == name)
-            return HDTV;
         if ("FIREWIRE" == name)
             return FIREWIRE;
         if ("HDHOMERUN" == name)
@@ -91,10 +88,9 @@
     static bool         IsEncoder(const QString &rawtype)
     {
         return
-            (rawtype != "DVB")       && (rawtype != "HDTV")    &&
-            (rawtype != "FIREWIRE")  && (rawtype != "DBOX2")   &&
-            (rawtype != "HDHOMERUN") && (rawtype != "FREEBOX") &&
-            (rawtype != "CRC_IP");
+            (rawtype != "DVB")       && (rawtype != "FIREWIRE")  &&
+            (rawtype != "DBOX2")     && (rawtype != "HDHOMERUN") &&
+            (rawtype != "FREEBOX")   && (rawtype != "CRC_IP");
     }
 
     static bool         IsUnscanable(const QString &rawtype)
@@ -107,8 +103,7 @@
     static bool         IsEITCapable(const QString &rawtype)
     {
         return
-            (rawtype == "DVB")       || (rawtype == "HDTV")  ||
-            (rawtype == "HDHOMERUN");
+            (rawtype == "DVB")       || (rawtype == "HDHOMERUN");
     }
 
     static int          GetCardID(const QString &videodevice,
Index: libs/libmythtv/videosource.h
===================================================================
--- libs/libmythtv/videosource.h	(revision 12619)
+++ libs/libmythtv/videosource.h	(working copy)
@@ -366,22 +366,6 @@
     TunerCardInput    *input;
 };
 
-class pcHDTVConfigurationGroup: public VerticalConfigurationGroup
-{
-    Q_OBJECT
-
-  public:
-    pcHDTVConfigurationGroup(CaptureCard& a_parent);
-
-  public slots:
-    void probeCard(const QString &device);
-
-  private:
-    CaptureCard       &parent;
-    TransLabelSetting *cardinfo;
-    TunerCardInput    *input;
-};
-
 class DVBInput;
 class DVBCardName;
 class DVBCardType;
Index: libs/libmythtv/libmythtv.pro
===================================================================
--- libs/libmythtv/libmythtv.pro	(revision 12619)
+++ libs/libmythtv/libmythtv.pro	(working copy)
@@ -369,9 +369,7 @@
     # Support for Video4Linux devices
     using_v4l {
         HEADERS += channel.h                   analogsignalmonitor.h
-        HEADERS += hdtvrecorder.h              pchdtvsignalmonitor.h
         SOURCES += channel.cpp                 analogsignalmonitor.h
-        SOURCES += hdtvrecorder.cpp            pchdtvsignalmonitor.cpp
 
         DEFINES += USING_V4L
     }
Index: libs/libmythtv/dvbrecorder.h
===================================================================
--- libs/libmythtv/dvbrecorder.h	(revision 12619)
+++ libs/libmythtv/dvbrecorder.h	(working copy)
@@ -53,7 +53,7 @@
  *  \brief This is a specialization of DTVRecorder used to
  *         handle streams from DVB drivers.
  *
- *  \sa DTVRecorder, HDTVRecorder
+ *  \sa DTVRecorder
  */
 class DVBRecorder :
     public DTVRecorder,
Index: libs/libmythtv/dbcheck.cpp
===================================================================
--- libs/libmythtv/dbcheck.cpp	(revision 12619)
+++ libs/libmythtv/dbcheck.cpp	(working copy)
@@ -10,7 +10,7 @@
 #include "mythdbcon.h"
 
 /// This is the DB schema version expected by the running MythTV instance.
-const QString currentDatabaseVersion = "1177";
+const QString currentDatabaseVersion = "1178";
 
 static bool UpdateDBVersionNumber(const QString &newnumber);
 static bool performActualUpdate(const QString updates[], QString version,
@@ -97,15 +97,13 @@
 
 The 'cardtype' is an important field for all cards as it guides the
 interpretation of the rest of the fields, it has several possible
-values: "V4L", "MJPEG", "HDTV", "DVB", "MPEG", "FIREWIRE", "GO7007"
+values: "V4L", "MJPEG", "DVB", "MPEG", "FIREWIRE", "GO7007"
 and  "DBOX2".
 "V4L" indicates a V4L compatible device, this could be a
 true V4L device or something like a Firewire camera with the 
 "firewire->v4l" driver. 
 "MJPEG" describes a Matrox G200 or DC10 card which captures
 individual frames a JPEG images.
-"HDTV" describes a pcHDTV HD-2000 or HD-3000 when using the V4L
-drivers.
 "DVB" can describe any card supported by the Linux DVB
 drivers, including the pcHDTV and other ATSC cards. 
 The "MPEG" type describes a device using the ivtv drivers such as 
@@ -135,8 +133,7 @@
 
 The 'signal_timeout' and 'channel_timeout' indicate in 
 milliseconds how long it should take to get a signal and 
-channel lock respectively. Signal lock detection is 
-currently only supported on "DVB" and "HDTV" card types.
+channel lock respectively.
 
 The 'dvb_swfilter', 'dvb_sat_type', 'dvb_wait_for_seqstart',
 'skipbtaudio', 'dvb_on_demand', and 'dvb_diseqc_type' columns
@@ -209,14 +206,7 @@
 a unique number from 0 to 99.
 
 The 'channum' field contains the channel number to be input to jump
-to a channel. With HDTV using video4linux drivers this field has
-a special meaning. If the field contains only numeric characters
-then the digits up to the last digit are used as the major channel
-number and the last digit is used as the minor channel number.
-If it contains an underscore (_), the default, then the digits before
-the underscore are used as the major channel, and the ones after
-it as the minor channel. If it contains a minus sign (-), then
-the digits after the minus sign are used as the program number.
+to a channel.
 
 The 'sourceid' field contains the \ref videosource_table key, which
 specifies which listings service to use and which input on which video
@@ -2857,6 +2847,50 @@
             return false;
     }
 
+    if (dbver == "1177")
+    {
+        QString thequery =
+            "SELECT cardid "
+            "FROM capturecard "
+            "WHERE cardtype='HDTV'";
+
+        MSqlQuery query(MSqlQuery::InitCon());
+        query.prepare(thequery);
+        if (!query.exec())
+        {
+            QString msg =
+                QString("DB Error (Performing database upgrade): \n"
+                        "Query was: %1 \nError was: %2 \nnew version: %3")
+                .arg(thequery)
+                .arg(MythContext::DBErrorMessage(query.lastError()))
+                .arg("1178");
+            VERBOSE(VB_IMPORTANT, msg);
+            return false;
+        }
+
+        QString in = "(";
+
+        while (query.next())
+            in += query.value(0).toString() + ",";
+
+        thequery = "";
+        if (in.length() > 2)
+        {
+            in.truncate(in.length() - 1);
+            thequery =
+                "DELETE FROM cardinput "
+                "WHERE cardid IN " + in + ")";
+        }
+
+        const QString updates[] = {
+"DELETE FROM capturecard WHERE cardtype = 'HDTV';",
+thequery,
+""
+};
+        if (!performActualUpdate(updates, "1178", dbver))
+            return false;
+    }
+
 //"ALTER TABLE cardinput DROP COLUMN preference;" in 0.22
 //"ALTER TABLE channel DROP COLUMN atscsrcid;" in 0.22
 //"ALTER TABLE recordedmarkup DROP COLUMN offset;" in 0.22
Index: libs/libmythtv/scanwizardscanner.cpp
===================================================================
--- libs/libmythtv/scanwizardscanner.cpp	(revision 12619)
+++ libs/libmythtv/scanwizardscanner.cpp	(working copy)
@@ -47,7 +47,6 @@
 
 #ifdef USING_V4L
 #include "channel.h"
-#include "pchdtvsignalmonitor.h"
 #include "analogsignalmonitor.h"
 #endif
 
@@ -423,8 +422,8 @@
     type = (CardUtil::OFDM == cardtype) ? DTVConfParser::OFDM : type;
     type = (CardUtil::QPSK == cardtype) ? DTVConfParser::QPSK : type;
     type = (CardUtil::QAM  == cardtype) ? DTVConfParser::QAM  : type;
-    type = ((CardUtil::ATSC == cardtype) || (CardUtil::HDTV == cardtype) ||
-            (CardUtil::HDHOMERUN == cardtype)) ? DTVConfParser::ATSC : type;
+    type = ((CardUtil::ATSC == cardtype) ||(CardUtil::HDHOMERUN == cardtype)) ?
+        DTVConfParser::ATSC : type;
 
     if (type == DTVConfParser::UNKNOWN)
         return;
@@ -493,7 +492,7 @@
 #endif
 
 #ifdef USING_V4L
-    if (("HDTV" == card_type) || ("V4L" == card_type) || ("MPEG" == card_type))
+    if (("V4L" == card_type) || ("MPEG" == card_type))
         channel = new Channel(NULL, device);
 #endif
 
Index: libs/libmythtv/dtvrecorder.h
===================================================================
--- libs/libmythtv/dtvrecorder.h	(revision 12619)
+++ libs/libmythtv/dtvrecorder.h	(working copy)
@@ -1,6 +1,6 @@
 // -*- Mode: c++ -*-
 /**
- *  DTVRecorder -- base class for DVBRecorder and HDTVRecorder
+ *  DTVRecorder -- base class for Digital Television recorders
  *  Copyright (c) 2003-2004 by Brandon Beattie, Doug Larrick, 
  *    Jason Hoos, and Daniel Thor Kristjansson
  *  Distributed as part of MythTV under GPL v2 and later.
Index: libs/libmythtv/dtvrecorder.cpp
===================================================================
--- libs/libmythtv/dtvrecorder.cpp	(revision 12619)
+++ libs/libmythtv/dtvrecorder.cpp	(working copy)
@@ -1,12 +1,10 @@
 /**
- *  DTVRecorder -- base class for DVBRecorder and HDTVRecorder
+ *  DTVRecorder -- base class for Digital Televison recorders
  *  Copyright 2003-2004 by Brandon Beattie, Doug Larrick, 
  *    Jason Hoos, and Daniel Thor Kristjansson
  *  Distributed as part of MythTV under GPL v2 and later.
  */
 
-using namespace std;
-
 #include "RingBuffer.h"
 #include "programinfo.h"
 #include "mpegtables.h"
@@ -20,15 +18,10 @@
 
 /** \class DTVRecorder
  *  \brief This is a specialization of RecorderBase used to
- *         handle DVB and ATSC streams.
+ *         handle MPEG-2, MPEG-4, MPEG-4 AVC, DVB and ATSC streams.
  *
- *  This class is an abstract class. If you are using a
- *  pcHDTV card with the bttv drivers, ATSC streams are
- *  handled by the HDTVRecorder. If you are using DVB
- *  drivers DVBRecorder is used. If you are using firewire
- *  cable box input the FirewireRecorder is used.
- *
- *  \sa DVBRecorder, HDTVRecorder, FirewireRecorder, DBox2Recorder
+ *  \sa DBox2Recorder, DVBRecorder, FirewireRecorder,
+        HDHRRecoreder, IPTVRecorder
  */
 
 DTVRecorder::DTVRecorder(TVRec *rec) : 
Index: libs/libmythtv/pchdtvsignalmonitor.cpp
===================================================================
--- libs/libmythtv/pchdtvsignalmonitor.cpp	(revision 12619)
+++ libs/libmythtv/pchdtvsignalmonitor.cpp	(working copy)
@@ -1,248 +0,0 @@
-// -*- Mode: c++ -*-
-// Copyright (c) 2005, Daniel Thor Kristjansson
-
-#include <cerrno>
-#include <unistd.h>
-#include <sys/ioctl.h>
-
-#include "videodev_myth.h"
-#include "mythcontext.h"
-#include "pchdtvsignalmonitor.h"
-#include "channel.h"
-#include "atscstreamdata.h"
-#include "mpegtables.h"
-#include "atsctables.h"
-
-#undef DBG_SM
-#define DBG_SM(FUNC, MSG) VERBOSE(VB_CHANNEL, \
-    "pcHDTVSM("<<channel->GetDevice()<<")::"<<FUNC<<": "<<MSG);
-
-/** \fn pcHDTVSignalMonitor::pcHDTVSignalMonitor(int,Channel*,uint,const char*)
- *  \brief Initializes signal lock and signal values.
- *
- *   Start() must be called to actually begin continuous signal
- *   monitoring. The timeout is initialized to the value of
- *   the "ATSCCheckSignalWait" setting in milliseconds, and
- *   the threshold is initialized to the value of the
- *   "ATSCCheckSignalThreshold" setting as a percentage.
- *
- *  \param _db_cardnum     Recorder number to monitor,
- *                         if this is less than 0, SIGNAL events will not be
- *                         sent to the frontend even if SetNotifyFrontend(true)
- *                         is called.
- *  \param _channel        Channel class of device you want monitored
- *  \param _flags          SignalMonitorFlags to start with
- *  \param _name           Instance name for Qt signal/slot debugging
- */
-pcHDTVSignalMonitor::pcHDTVSignalMonitor(int db_cardnum, Channel *_channel,
-                                         uint _flags, const char *_name)
-    : DTVSignalMonitor(db_cardnum, _channel, _flags, _name),
-      usingv4l2(false), dtvMonitorRunning(false)
-{
-    int wait      = gContext->GetNumSetting("ATSCCheckSignalWait", 5000);
-    int threshold = gContext->GetNumSetting("ATSCCheckSignalThreshold", 65);
-
-    signalLock.SetTimeout(wait);
-    signalStrength.SetTimeout(wait);
-    signalStrength.SetThreshold(threshold);
-
-    usingv4l2 = CardUtil::hasV4L2(channel->GetFd());
-}
-
-pcHDTVSignalMonitor::~pcHDTVSignalMonitor()
-{
-    Stop();
-}
-
-void pcHDTVSignalMonitor::deleteLater(void)
-{
-    disconnect(); // disconnect signals we may be sending...
-    Stop();
-    DTVSignalMonitor::deleteLater();
-}
-
-/** \fn pcHDTVSignalMonitor::Stop()
- *  \brief Stops signal monitoring and table monitoring threads.
- */
-void pcHDTVSignalMonitor::Stop()
-{
-    DBG_SM("Stop()", "begin");
-    SignalMonitor::Stop();
-    if (dtvMonitorRunning)
-    {
-        dtvMonitorRunning = false;
-        pthread_join(table_monitor_thread, NULL);
-    }
-    DBG_SM("Stop()", "end");
-}
-
-void *pcHDTVSignalMonitor::TableMonitorThread(void *param)
-{
-    pcHDTVSignalMonitor *mon = (pcHDTVSignalMonitor*) param;
-    mon->RunTableMonitor();
-    return NULL;
-}
-
-void pcHDTVSignalMonitor::RunTableMonitor()
-{
-    dtvMonitorRunning = true;
-    int remainder = 0;
-    int buffer_size = TSPacket::SIZE * 15000;
-    unsigned char *buffer = new unsigned char[buffer_size];
-    if (!buffer)
-        return;
-    bzero(buffer, buffer_size);
-
-    DBG_SM("RunTableMonitor()", "begin (# of pids "
-            <<GetStreamData()->ListeningPIDs().size()<<")");
-    while (dtvMonitorRunning && GetStreamData())
-    {
-        long long len = read(
-            channel->GetFd(), &(buffer[remainder]), buffer_size - remainder);
-
-        if ((0 == len) || (-1 == len))
-        {
-            usleep(100);
-            continue;
-        }
-
-        len += remainder;
-        remainder = GetStreamData()->ProcessData(buffer, len);
-        if (remainder > 0 && (len > remainder)) // leftover bytes
-            memmove(buffer, &(buffer[len - remainder]), remainder);
-    }
-    DBG_SM("RunTableMonitor()", "end");
-}
-
-#define EMIT(SIGNAL_FUNC, SIGNAL_VAL) \
-    do { statusLock.lock(); \
-         SignalMonitorValue val = SIGNAL_VAL; \
-         statusLock.unlock(); \
-         emit SIGNAL_FUNC(val); } while (false)
-
-/** \fn pcHDTVSignalMonitor::UpdateValues()
- *  \brief Queries signal strength and emits status Qt signals.
- *
- *   This uses GetSignal(int,uint,bool) to actually collect the signal values.
- *   It is automatically called by MonitorLoop(), after Start() has been uset
- *   to start the signal monitoring thread.
- */
-void pcHDTVSignalMonitor::UpdateValues()
-{
-    if (!running || exit)
-        return;
-
-    if (dtvMonitorRunning)
-    {
-        EMIT(StatusSignalLock, signalLock);
-        EMIT(StatusSignalStrength, signalStrength);
-        if (IsAllGood())
-            emit AllGood();
-        // TODO dtv signals...
-        update_done = true;
-        return;
-    }
-
-    bool isLocked = false;
-    int sig = GetSignal(
-        channel->GetFd(), channel->GetCurrentInputNum(), usingv4l2);
-
-    {
-        QMutexLocker locker(&statusLock);
-        signalStrength.SetValue(sig);
-        signalLock.SetValue(signalStrength.IsGood());
-        isLocked = signalLock.IsGood();
-    }
-
-    if (isLocked && GetStreamData() &&
-        HasAnyFlag(kDTVSigMon_WaitForPAT | kDTVSigMon_WaitForPMT |
-                   kDTVSigMon_WaitForMGT | kDTVSigMon_WaitForVCT |
-                   kDTVSigMon_WaitForNIT | kDTVSigMon_WaitForSDT))
-    {
-        pthread_create(&table_monitor_thread, NULL,
-                       TableMonitorThread, this);
-        DBG_SM("UpdateValues", "Waiting for table monitor to start");
-        while (!dtvMonitorRunning)
-            usleep(50);
-        DBG_SM("UpdateValues", "Table monitor started");
-    }
-
-    EMIT(StatusSignalLock, signalLock);
-    EMIT(StatusSignalStrength, signalStrength);
-    if (IsAllGood())
-        emit AllGood();
-
-    update_done = true;
-}
-
-#undef EMIT
-
-template<typename V>
-V clamp(V val, V minv, V maxv) { return std::min(maxv, std::max(minv, val)); }
-
-/** \fn pcHDTVSignalMonitor::GetSignal(int,uint,bool)
- *  \brief Returns ATSC signal strength as a percentage from 0 to 100%.
- *
- *  \param fd        File descriptor of V4L device.
- *  \param input     Input of device to monitor.
- *  \param usingv4l2 If true use V4L version 2 ioctls,
- *                   else use V4L version 1 ioctls.
- *  \return ATSC signal strength 0-100. >75 is good.
- */
-int pcHDTVSignalMonitor::GetSignal(int fd, uint input, bool usingv4l2)
-{
-    // the 0 == input test works around a bug in the pcHDTV v4l2 support
-    if (usingv4l2 && (0 == input))
-    {
-        struct v4l2_tuner vsig;
-        memset(&vsig, 0, sizeof(vsig));
-
-        //setting index doesn't currently work with pcHDTV drivers....
-        //vsig.index = input;
-
-        int ioctlval = ioctl(fd, VIDIOC_G_TUNER, &vsig);
-        if (ioctlval != -1)
-        {
-            VERBOSE(VB_CHANNEL,
-                    QString("pcHDTV::GetSignal_v4l2(fd %1, input %2, v4l%3): "
-                            "raw signal(%4)")
-                    .arg(fd).arg(input).arg(usingv4l2 ? 2 : 1).arg(vsig.signal));
-
-            return clamp(vsig.signal, 0, 100);
-        }
-        else
-        {
-            VERBOSE(VB_IMPORTANT,
-                    QString("pcHDTV::GetSignal_v4l2(fd %1, input %2, v4l%3): "
-                            "error(%4)")
-                    .arg(fd).arg(input).arg(usingv4l2 ? 2 : 1).arg(strerror(errno)));
-            // falling through to v4l v1
-        }
-    }
-
-    struct video_signal vsig;
-    memset(&vsig, 0, sizeof(vsig));
-
-    int ioctlval = ioctl(fd, VIDIOCGSIGNAL, &vsig);
-    if (ioctlval == -1) 
-    {
-        VERBOSE(VB_IMPORTANT,
-                QString("pcHDTV::GetSignal_v4l1(fd %1, input %2, v4l%3): "
-                        "error(%4)")
-                .arg(fd).arg(input).arg(usingv4l2 ? 2 : 1).arg(strerror(errno)));
-        return 0;
-    }
-
-    int signal = (input == 0) ? vsig.strength : vsig.aux;
-    int retsig = 0;
-
-    if ((signal & 0xff) == 0x43)
-        retsig = clamp(101 - (signal >> 9), 0, 100);
-
-    VERBOSE(VB_CHANNEL,
-            QString("pcHDTV::GetSignal_v4l1(fd %1, input %2, v4l%3): "
-                    "processed signal(%4)")
-            .arg(fd).arg(input).arg(usingv4l2 ? 2 : 1).arg(retsig));
-
-    return retsig;
-}
Index: libs/libmythtv/datadirect.cpp
===================================================================
--- libs/libmythtv/datadirect.cpp	(revision 12619)
+++ libs/libmythtv/datadirect.cpp	(working copy)
@@ -1837,21 +1837,6 @@
     minor = channum.right(channum.length() - (chansep + 1)).toInt();
 
     freq = get_center_frequency("atsc", "vsb8", "us", freqid);
-
-    // Check if this is connected to an HDTV card.
-    MSqlQuery query(MSqlQuery::DDCon());
-    query.prepare(
-        "SELECT cardtype "
-        "FROM capturecard, cardinput "
-        "WHERE cardinput.cardid = capturecard.cardid AND "
-        "      sourceid         = :SOURCEID");
-    query.bindValue(":SOURCEID", sourceid);
-
-    if (query.exec() && query.isActive() && query.next() &&
-        query.value(0).toString() == "HDTV")
-    {
-        freq -= 1750000; // convert to visual carrier freq.
-    }
 }
 
 static QString process_dd_station(
Index: libs/libmythtv/channelutil.cpp
===================================================================
--- libs/libmythtv/channelutil.cpp	(revision 12619)
+++ libs/libmythtv/channelutil.cpp	(working copy)
@@ -895,18 +895,6 @@
         QString("SELECT chanid FROM channel "
                 "WHERE sourceid=%1 AND serviceID=%1 AND mplexid=%2")
         .arg(source_id).arg(program_number).arg(mplexid),
-        // find based on OLD pcHDTV formatted major and minor channels
-        QString("SELECT chanid FROM channel "
-                "WHERE sourceid=%1 AND channum='%2_%3'")
-        .arg(source_id).arg(major_channel).arg(minor_channel),
-        // find based on OLD pcHDTV formatted major channel and program number
-        QString("SELECT chanid FROM channel "
-                "WHERE sourceid=%1 AND channum='%2-%3'")
-        .arg(source_id).arg(major_channel).arg(program_number),
-        // find based on OLD DVB formatted major and minor channels
-        QString("SELECT chanid FROM channel "
-                "WHERE sourceid=%1 AND channum='%2%3'")
-        .arg(source_id).arg(major_channel).arg(minor_channel),
     };
 
     for (uint i = 0; i < 6; i++)
Index: libs/libmythtv/signalmonitor.cpp
===================================================================
--- libs/libmythtv/signalmonitor.cpp	(revision 12619)
+++ libs/libmythtv/signalmonitor.cpp	(working copy)
@@ -19,7 +19,6 @@
 #endif
 
 #ifdef USING_V4L
-#   include "pchdtvsignalmonitor.h"
 #   include "analogsignalmonitor.h"
 #   include "channel.h"
 #endif
@@ -56,7 +55,8 @@
  *   Additional signals may be implemented, see DTVSignalMonitor and 
  *   DVBSignalMonitor for example.
  *
- *  \sa DTVSignalMonitor DVBSignalMonitor, HDTVSignalMonitor, SignalMonitorValue
+ *  \sa AnalocSignalMonitor, DTVSignalMonitor, DVBSignalMonitor,
+        HDHRSignalMonitor, SignalMonitorValue
  */
 
 void ALRMhandler(int /*sig*/)
@@ -89,12 +89,6 @@
 #endif
 
 #ifdef USING_V4L
-    if (cardtype.upper() == "HDTV")
-    {
-        Channel *hdtvc = dynamic_cast<Channel*>(channel);
-        if (hdtvc)
-            signalMonitor = new pcHDTVSignalMonitor(db_cardnum, hdtvc);
-    }
     if ((cardtype.upper() == "V4L") ||
         (cardtype.upper() == "MPEG"))
     {
Index: libs/libmythtv/videosource.cpp
===================================================================
--- libs/libmythtv/videosource.cpp	(revision 12619)
+++ libs/libmythtv/videosource.cpp	(working copy)
@@ -1298,45 +1298,6 @@
     input->fillSelections(device);
 }
 
-pcHDTVConfigurationGroup::pcHDTVConfigurationGroup(CaptureCard& a_parent) :
-    VerticalConfigurationGroup(false, true, false, false),
-    parent(a_parent), cardinfo(new TransLabelSetting()),
-    input(new TunerCardInput(parent))
-{
-    VideoDevice    *atsc_device     = new VideoDevice(parent, 0, 64);
-    SignalTimeout  *signal_timeout  = new SignalTimeout(parent, 500, 250);
-    ChannelTimeout *channel_timeout = new ChannelTimeout(parent, 2000, 1750);
-
-    addChild(atsc_device);
-    addChild(cardinfo);
-    addChild(signal_timeout);
-    addChild(channel_timeout);
-    addChild(input);
-
-    connect(atsc_device, SIGNAL(valueChanged(const QString&)),
-            this,        SLOT(  probeCard(   const QString&)));
-
-    probeCard(atsc_device->getValue());
-}
-
-void pcHDTVConfigurationGroup::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);
-    input->fillSelections(device);
-}
-
 CaptureCardGroup::CaptureCardGroup(CaptureCard &parent) :
     TriggeredConfigurationGroup(true, true, false, false)
 {
@@ -1350,7 +1311,6 @@
     
 #ifdef USING_V4L
     addTarget("V4L",       new V4LConfigurationGroup(parent));
-    addTarget("HDTV",      new pcHDTVConfigurationGroup(parent));
 # ifdef USING_IVTV
     addTarget("MPEG",      new MPEGConfigurationGroup(parent));
 # endif // USING_IVTV
@@ -1469,11 +1429,6 @@
         QObject::tr("DVB DTV capture card (v3.x)"), "DVB");
 #endif // USING_DVB
 
-#ifdef USING_V4L
-    setting->addSelection(
-        QObject::tr("pcHDTV DTV capture card (w/V4L drivers)"), "HDTV");
-#endif // USING_V4L
-
 #ifdef USING_FIREWIRE
     setting->addSelection(
         QObject::tr("FireWire cable box"), "FIREWIRE");
Index: libs/libmythtv/tv_rec.cpp
===================================================================
--- libs/libmythtv/tv_rec.cpp	(revision 12619)
+++ libs/libmythtv/tv_rec.cpp	(working copy)
@@ -53,7 +53,6 @@
 #include "recorderbase.h"
 #include "NuppelVideoRecorder.h"
 #include "mpegrecorder.h"
-#include "hdtvrecorder.h"
 #include "dvbrecorder.h"
 #include "dbox2recorder.h"
 #include "hdhrrecorder.h"
@@ -196,7 +195,7 @@
         init_run = true;
 #endif
     }    
-    else // "V4L" or "MPEG", ie, analog TV, or "HDTV"
+    else // "V4L" or "MPEG", ie, analog TV
     {
 #ifdef USING_V4L
         channel = new Channel(this, genOpt.videodev);
@@ -206,7 +205,7 @@
         CloseChannel();
         init_run = true;
 #endif
-        if (genOpt.cardtype != "HDTV" && genOpt.cardtype != "MPEG")
+        if (genOpt.cardtype != "MPEG")
             rbFileExt = "nuv";
     }
 
@@ -794,7 +793,7 @@
  *
  *  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 "HDTV" a HDTVRecorder 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,
  *  otherwise a NuppelVideoRecorder is started.
@@ -811,14 +810,6 @@
         recorder = new MpegRecorder(this);
 #endif // USING_IVTV
     }
-    else if (genOpt.cardtype == "HDTV")
-    {
-#ifdef USING_V4L
-        recorder = new HDTVRecorder(this);
-        ringBuffer->SetWriteBufferSize(4*1024*1024);
-        recorder->SetOption("wait_for_seqstart", genOpt.wait_for_seqstart);
-#endif // USING_V4L
-    }
     else if (genOpt.cardtype == "FIREWIRE")
     {
 #ifdef USING_FIREWIRE
@@ -1796,7 +1787,7 @@
  *  \brief This creates a SignalMonitor instance if one is needed and
  *         begins signal monitoring.
  *
- *   If the channel exists and the cardtype is "DVB", "HDTV" or "HDHomeRun"
+ *   If the channel exists and the cardtype is "DVB" or "HDHomeRun"
  *   a SignalMonitor instance is created and SignalMonitor::Start()
  *   is called to start the signal monitoring thread.
  *
Index: libs/libmythtv/transporteditor.cpp
===================================================================
--- libs/libmythtv/transporteditor.cpp	(revision 12619)
+++ libs/libmythtv/transporteditor.cpp	(working copy)
@@ -226,12 +226,10 @@
     {
         CardUtil::CARD_TYPES typeA = cardtypes[i - 1];
         typeA = (CardUtil::HDHOMERUN == typeA) ? CardUtil::ATSC : typeA;
-        typeA = (CardUtil::HDTV      == typeA) ? CardUtil::ATSC : typeA;
         typeA = (CardUtil::MPEG      == typeA) ? CardUtil::V4L  : typeA;
 
         CardUtil::CARD_TYPES typeB = cardtypes[i + 0];
         typeB = (CardUtil::HDHOMERUN == typeB) ? CardUtil::ATSC : typeB;
-        typeB = (CardUtil::HDTV      == typeB) ? CardUtil::ATSC : typeB;
         typeB = (CardUtil::MPEG      == typeB) ? CardUtil::V4L  : typeB;
 
         if (typeA == typeB)
@@ -526,11 +524,6 @@
         addSelection("QAM-64",   "qam_64");
         addSelection("QAM-256",  "qam_256");
     }
-    else if (CardUtil::HDTV == nType)
-    {
-        addSelection("8-VSB",    "8vsb");
-        setVisible(false);
-    }
     else
     {
         addSelection(QObject::tr("Analog"), "analog");
@@ -731,7 +724,6 @@
         right->addChild(new DVBForwardErrorCorrection(id));
     }
     else if (CardUtil::ATSC      == nType ||
-             CardUtil::HDTV      == nType ||
              CardUtil::HDHOMERUN == nType)
     {
         left->addChild(new DTVStandard(id, false, true));
Index: libs/libmythtv/tv_rec.h
===================================================================
--- libs/libmythtv/tv_rec.h	(revision 12619)
+++ libs/libmythtv/tv_rec.h	(working copy)
@@ -25,7 +25,6 @@
 class RecorderBase;
 class DTVRecorder;
 class DVBRecorder;
-class HDTVRecorder;
 class HDHRRecorder;
 
 class SignalMonitor;
Index: libs/libmythtv/scanwizardhelpers.cpp
===================================================================
--- libs/libmythtv/scanwizardhelpers.cpp	(revision 12619)
+++ libs/libmythtv/scanwizardhelpers.cpp	(working copy)
@@ -54,7 +54,7 @@
 #ifdef USING_V4L
     if (!cardTypes.isEmpty())
         cardTypes += ",";
-    cardTypes += "'V4L','HDTV'";
+    cardTypes += "'V4L'";
 # ifdef USING_IVTV
     cardTypes += ",'MPEG'";
 # endif // USING_IVTV
@@ -412,7 +412,6 @@
                      QString::number(DVBUtilsImport));
         break;
     case CardUtil::ATSC:
-    case CardUtil::HDTV:
     case CardUtil::HDHOMERUN:
         addSelection(tr("Full Scan"),
                      QString::number(FullScan_ATSC), true);
Index: libs/libmythtv/channel.cpp
===================================================================
--- libs/libmythtv/channel.cpp	(revision 12619)
+++ libs/libmythtv/channel.cpp	(working copy)
@@ -343,22 +343,16 @@
 
 int Channel::GetCurrentChannelNum(const QString &channame)
 {
-    // remove part after '-' for (HDTV subchannels)
-    QString real_channame = channame;
-    int pos = channame.find('-');
-    if (pos != -1)
-        real_channame.truncate(pos);
-
     for (int i = 0; i < totalChannels; i++)
     {
-        if (real_channame == curList[i].name)
+        if (channame == curList[i].name)
             return i;
     }
-    VERBOSE(VB_IMPORTANT,
-            QString("Channel::GetCurrentChannelNum(%1): "
-                    "Failed to find Channel '%2'")
-            .arg(channame).arg(real_channame));
 
+    VERBOSE(VB_IMPORTANT, LOC_ERR +
+            QString("GetCurrentChannelNum(%1): "
+                    "Failed to find Channel").arg(channame));
+
     return -1;
 }
 
@@ -815,9 +809,6 @@
             VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
                     "\n\t\t\twhile setting format (v4l v2)" + ENO);
 
-            // Fall through to try v4l version 1, pcHDTV 1.4 (for HD-2000)
-            // drivers don't work with VIDIOC_S_STD ioctl.
-            usingv4l1 = true;
             ok = false;
         }
 
