From 8203006cf9ee68a8e33e30d48ea6b396d1a7b7e4 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 9 Dec 2008 15:15:29 -0600
Subject: Initial checkin for mythtv-trunk builds

---
 .../DeviceReadBuffer-polltimeout.2.patch           | 219 +++++++
 abs/core-testing/mythtv/trunk/mythtv-svn/PKGBUILD  |  78 +++
 .../mythtv/trunk/mythtv-svn/aacdecoder.cpp.patch   |  12 +
 .../trunk/mythtv-svn/hdpvr-v4lchannel-tweak.patch  | 139 +++++
 .../trunk/mythtv-svn/menu-xml/HOST_SETTINGS.xml    |  87 +++
 .../mythtv/trunk/mythtv-svn/menu-xml/is.xml        |  33 ++
 .../mythtv/trunk/mythtv-svn/menu-xml/knoppmyth.xml |  55 ++
 .../trunk/mythtv-svn/menu-xml/library.xml.patch    |  13 +
 .../trunk/mythtv-svn/menu-xml/mainmenu.xml.patch   |  16 +
 .../mythtv/trunk/mythtv-svn/menu-xml/motion.xml    |  20 +
 .../mythtv-svn/menu-xml/optical_menu.xml.patch     |  15 +
 .../mythtv/trunk/mythtv-svn/menu-xml/setup.xml     | 111 ++++
 .../trunk/mythtv-svn/menu-xml/siriusmenu.xml       | 419 +++++++++++++
 .../mythtv/trunk/mythtv-svn/menu-xml/xmmenu.xml    | 574 ++++++++++++++++++
 .../trunk/mythtv-svn/mpegrecorder-hdpvr-v1.1.patch | 658 +++++++++++++++++++++
 abs/core-testing/mythtv/trunk/mythtv-svn/myth.sh   |   4 +
 .../mythtv/trunk/mythtv-svn/mythbackend            |  37 ++
 .../mythtv/trunk/mythtv-svn/mythbackend.sh         | 117 ++++
 .../trunk/mythtv-svn/mythcommflag-avidemux.2.patch | 179 ++++++
 .../mythtv/trunk/mythtv-svn/mythtv.install         |  55 ++
 .../patches/DeviceReadBuffer-polltimeout.2.patch   | 219 +++++++
 .../trunk/mythtv-svn/patches/aacdecoder.cpp.patch  |  12 +
 .../patches/hdpvr-v4lchannel-tweak.patch           | 139 +++++
 .../patches/mpegrecorder-hdpvr-v1.1.patch          | 658 +++++++++++++++++++++
 .../patches/mythcommflag-avidemux.2.patch          | 179 ++++++
 .../mythtv/trunk/mythtv-svn/smolt_jump.patch       |  30 +
 .../trunk/mythtv-svn/svn_main_menu_popup.patch     | 211 +++++++
 27 files changed, 4289 insertions(+)
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/DeviceReadBuffer-polltimeout.2.patch
 create mode 100755 abs/core-testing/mythtv/trunk/mythtv-svn/PKGBUILD
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/aacdecoder.cpp.patch
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/hdpvr-v4lchannel-tweak.patch
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/HOST_SETTINGS.xml
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/is.xml
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/knoppmyth.xml
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/library.xml.patch
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/mainmenu.xml.patch
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/motion.xml
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/optical_menu.xml.patch
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/setup.xml
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/siriusmenu.xml
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/xmmenu.xml
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/mpegrecorder-hdpvr-v1.1.patch
 create mode 100755 abs/core-testing/mythtv/trunk/mythtv-svn/myth.sh
 create mode 100755 abs/core-testing/mythtv/trunk/mythtv-svn/mythbackend
 create mode 100755 abs/core-testing/mythtv/trunk/mythtv-svn/mythbackend.sh
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/mythcommflag-avidemux.2.patch
 create mode 100755 abs/core-testing/mythtv/trunk/mythtv-svn/mythtv.install
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/patches/DeviceReadBuffer-polltimeout.2.patch
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/patches/aacdecoder.cpp.patch
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/patches/hdpvr-v4lchannel-tweak.patch
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/patches/mpegrecorder-hdpvr-v1.1.patch
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/patches/mythcommflag-avidemux.2.patch
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/smolt_jump.patch
 create mode 100644 abs/core-testing/mythtv/trunk/mythtv-svn/svn_main_menu_popup.patch

diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/DeviceReadBuffer-polltimeout.2.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/DeviceReadBuffer-polltimeout.2.patch
new file mode 100644
index 0000000..5bb713f
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/DeviceReadBuffer-polltimeout.2.patch
@@ -0,0 +1,219 @@
+Index: libs/libmythtv/DeviceReadBuffer.h
+===================================================================
+--- libs/libmythtv/DeviceReadBuffer.h	(revision 18515)
++++ libs/libmythtv/DeviceReadBuffer.h	(working copy)
+@@ -59,7 +59,7 @@
+     void IncrReadPointer(uint len);
+ 
+     bool HandlePausing(void);
+-    bool Poll(void) const;
++    bool Poll(void);
+     uint WaitForUnused(uint bytes_needed) const;
+     uint WaitForUsed  (uint bytes_needed) const;
+ 
+Index: libs/libmythtv/DeviceReadBuffer.cpp
+===================================================================
+--- libs/libmythtv/DeviceReadBuffer.cpp	(revision 18515)
++++ libs/libmythtv/DeviceReadBuffer.cpp	(working copy)
+@@ -90,9 +90,14 @@
+ 
+ void DeviceReadBuffer::Start(void)
+ {
+-    lock.lock();
+-    bool was_running = running;
+-    lock.unlock();
++    bool was_running;
++
++    {
++        QMutexLocker locker(&lock);
++        was_running = running;
++        error = false;
++    }
++
+     if (was_running)
+     {
+         VERBOSE(VB_IMPORTANT, LOC_ERR + "Start(): Already running.");
+@@ -104,6 +109,8 @@
+     {
+         VERBOSE(VB_IMPORTANT,
+                 LOC_ERR + QString("Start(): pthread_create failed.") + ENO);
++
++        QMutexLocker locker(&lock);
+         error = true;
+     }
+ }
+@@ -118,21 +125,25 @@
+     used          = 0;
+     readPtr       = buffer;
+     writePtr      = buffer;
++
++    error         = false;
+ }
+ 
+ void DeviceReadBuffer::Stop(void)
+ {
+     bool was_running = IsRunning();
+-    lock.lock();
+-    run = false;
+-    lock.unlock();
+ 
+     if (!was_running)
+     {
+-        VERBOSE(VB_IMPORTANT, LOC_ERR + "Stop(): Not running.");
++        VERBOSE(VB_IMPORTANT, LOC + "Stop(): Not running.");
+         return;
+     }
+ 
++    {
++        QMutexLocker locker(&lock);
++        run = false;
++    }
++
+     pthread_join(thread, NULL);
+ }
+ 
+@@ -229,10 +240,11 @@
+ {
+     uint      errcnt = 0;
+ 
+-    lock.lock();
+-    run     = true;
+-    running = true;
+-    lock.unlock();
++    {
++        QMutexLocker locker(&lock);
++        run     = true;
++        running = true;
++    }
+ 
+     while (run)
+     {
+@@ -248,6 +260,15 @@
+         if (using_poll && !Poll())
+             continue;
+ 
++        {
++            QMutexLocker locker(&lock);
++            if (error)
++            {
++                VERBOSE(VB_RECORD, LOC + "fill_ringbuffer: error state");
++                break;
++            }
++        }
++
+         // Limit read size for faster return from read
+         size_t read_size =
+             min(dev_read_size, (size_t) WaitForUnused(TSPacket::SIZE));
+@@ -268,9 +289,10 @@
+         }
+     }
+ 
+-    lock.lock();
+-    running = false;
+-    lock.unlock();
++    {
++        QMutexLocker locker(&lock);
++        running = false;
++    }
+ }
+ 
+ bool DeviceReadBuffer::HandlePausing(void)
+@@ -293,7 +315,7 @@
+     return true;
+ }
+ 
+-bool DeviceReadBuffer::Poll(void) const
++bool DeviceReadBuffer::Poll(void)
+ {
+ #ifdef USING_MINGW
+ #warning mingw DeviceReadBuffer::Poll
+@@ -302,31 +324,53 @@
+     return false;
+ #else
+     bool retval = true;
+-    while (true)
++    uint timeout_cnt = 0;
++
++    for (;;)
+     {
+         struct pollfd polls;
+         polls.fd      = _stream_fd;
+         polls.events  = POLLIN;
+         polls.revents = 0;
+ 
+-        int ret = poll(&polls, 1 /*number of polls*/, 10 /*msec*/);
+-        if (IsPauseRequested() || !IsOpen() || !run)
++        int ret = poll(&polls, 1 /*number of polls*/, 250 /*msec*/);
++
++        if (polls.revents & (POLLERR | POLLHUP | POLLNVAL))
+         {
++            VERBOSE(VB_IMPORTANT, LOC + "poll error");
++            error = true;
++            return true;
++        }
++
++        if (!run || !IsOpen() || IsPauseRequested())
++        {
+             retval = false;
+             break; // are we supposed to pause, stop, etc.
+         }
+ 
+         if (ret > 0)
+             break; // we have data to read :)
+-        if ((-1 == ret) && (EOVERFLOW == errno))
+-            break; // we have an error to handle
+-
+-        if ((-1 == ret) && ((EAGAIN == errno) || (EINTR  == errno)))
+-            continue; // errors that tell you to try again
+-        if (ret == 0)
+-            continue; // timed out, try again
+-
+-        usleep(2500);
++        if (ret < 0)
++        {
++            if ((EOVERFLOW == errno))
++                break; // we have an error to handle
++            if ((EAGAIN == errno) || (EINTR  == errno))
++                continue; // errors that tell you to try again
++            usleep(2500);
++        }
++        else //  ret == 0
++        {
++            if (++timeout_cnt > 9)
++            {
++                VERBOSE(VB_RECORD, LOC_ERR + "Poll giving up");
++                QMutexLocker locker(&lock);
++                error = true;
++                return true;
++            }
++            if (timeout_cnt % 2)
++                VERBOSE(VB_RECORD, LOC_ERR + QString("Poll timeout (%1)")
++                        .arg(timeout_cnt));
++        }
+     }
+     return retval;
+ #endif //!USING_MINGW
+@@ -360,9 +404,9 @@
+ 
+         if (++errcnt > 5)
+         {
+-            lock.lock();
++            QMutexLocker locker(&lock);
++            VERBOSE(VB_RECORD, LOC + "Too many errors.");
+             error = true;
+-            lock.unlock();
+             return false;
+         }
+ 
+@@ -376,10 +420,8 @@
+             VERBOSE(VB_IMPORTANT, LOC +
+                     QString("End-Of-File? fd(%1)").arg(_stream_fd));
+ 
+-            lock.lock();
++            QMutexLocker locker(&lock);
+             eof = true;
+-            lock.unlock();
+-
+             return false;
+         }
+         usleep(500);
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/PKGBUILD b/abs/core-testing/mythtv/trunk/mythtv-svn/PKGBUILD
new file mode 100755
index 0000000..b5dc31d
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/PKGBUILD
@@ -0,0 +1,78 @@
+pkgname=mythtv-svn
+pkgver=19295
+pkgrel=1
+pkgdesc="A personal video recorder for Linux"
+url="http://www.mythtv.org"
+license="GPL"
+depends=('lame' 'libmysqlclient' 'alsa-lib'  'wget' 'qt' 'x-server' 'freetype2' 'libmpeg2' 'libxml2' 'libraw1394' 'lirc' 'perl-date-manip' 'libavc1394' 'libdc1394' 'libiec61883')
+makedepends=('subversion')
+conflicts=(mythtv)
+replaces=()
+backup=()
+options=(!strip)
+MAKEFLAGS="-j6"
+install='mythtv.install'
+
+patchs=('DeviceReadBuffer-polltimeout.2.patch' 'hdpvr-v4lchannel-tweak.patch' 'mpegrecorder-hdpvr-v1.1.patch' 'mythcommflag-avidemux.2.patch')
+source=('mythbackend' 'myth.sh'  'smolt_jump.patch' 'svn_main_menu_popup.patch' `echo ${patchs[@]:0}` )
+arch=('i686')
+md5sums=()
+
+
+
+_svntrunk=http://cvs.mythtv.org/svn/trunk/mythtv
+_svnmod=mythtv
+
+build() {
+
+    svn co $_svntrunk --config-dir ./ -r $pkgver $_svnmod
+    cd $startdir/src/mythtv
+    echo "--------------------------applying patches----------------------------------------------------"
+	patch -Np0 -i  $startdir/src/smolt_jump.patch #|| return 1
+	patch -Np0 -i  $startdir/src/svn_main_menu_popup.patch #||return 1
+
+    for i in `echo ${patchs[@]:0} `
+    do
+        echo applying $i
+        echo "------------"
+        patch -Np0  -i ${startdir}/src/$i  #|| return 1
+    done
+    echo "--------------------------done   applying patches----------------------------------------------------"
+    sed -i -e "s/\`(svnversion \$\${SVNTREEDIR} 2>\/dev\/null) || echo Unknown\`/$pkgver/" version.pro
+    make distclean
+    ./configure --prefix=/usr --enable-xvmc --enable-xvmc-pro --enable-opengl-vsync --enable-dvb --enable-firewire --compile-type=release --with-bindings=perl --disable-audio-arts --disable-xrandr 
+    . /etc/profile
+    make
+    make INSTALL_ROOT=$startdir/pkg install
+    
+  #Patch the xml LinHES style
+  cp -r $startdir/menu-xml/*.xml $startdir/pkg/usr/share/mythtv
+  cd $startdir/pkg/usr/share/mythtv
+  patch -p0 < $startdir/menu-xml/mainmenu.xml.patch
+  patch -p0 < $startdir/menu-xml/optical_menu.xml.patch
+  patch -p0 < $startdir/menu-xml/library.xml.patch
+    
+    #   mkdir -p $startdir/pkg/usr/share/mythtv/contrib
+    #   mkdir -p $startdir/pkg/etc/rc.d
+    #   mkdir -p $startdir/pkg/var/log/mythtv
+    #   mkdir -p $startdir/pkg/etc/profile.d
+    #   install -m0755 ../myth.sh $startdir/pkg/etc/profile.d/
+    
+    # install contrib
+    #   mkdir -p $startdir/pkg/usr/local/share/mythtv/contrib || return 1
+    #   cp -rp contrib/* $startdir/pkg/usr/local/share/mythtv/contrib
+    #   echo "-release-fixes"   >  $startdir/pkg/usr/local/share/mythtv/.releasetype   
+    # install -m0755 themes/*.ttf $startdir/pkg/usr/local/share/mythtv/themes/
+    
+    
+    #   mkdir -p $startdir/pkg/usr/lib/
+    #   mv $startdir/pkg/usr/local/lib/perl5 $startdir/pkg/usr/lib/perl5
+    #  cd $startdir/src/mythtv/contrib
+    #  gcc -Wall -o firewire_tester firewire_tester.c -liec61883 -lraw1394
+    # install -m0755 firewire_tester $startdir/pkg/usr/local/bin/firewire_tester
+    #install -m0755  $startdir/pkg/usr/local/share/mythtv/contrib/optimize_mythdb.pl  $startdir/pkg/usr/local/bin/optimize_mythdb.pl 
+    #    cp $startdir/src/myth.find_orphans.pl $startdir/pkg/usr/local/share/mythtv/contrib/myth.find_orphans.pl
+    # install -m0755  $startdir/pkg/usr/local/share/mythtv/contrib/myth.find_orphans.pl  $startdir/pkg/usr/local/bin/myth.find_orphans.pl
+    
+
+}
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/aacdecoder.cpp.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/aacdecoder.cpp.patch
new file mode 100644
index 0000000..8796eb4
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/aacdecoder.cpp.patch
@@ -0,0 +1,12 @@
+--- mythmusic/mythmusic/aacdecoder.cpp.orig	2008-11-19 12:51:48.000000000 -0500
++++ mythmusic/mythmusic/aacdecoder.cpp	2008-11-19 12:52:42.000000000 -0500
+@@ -17,6 +17,9 @@
+ #define FAAD_MODIFIED
+ #endif
+ 
++// LinHES need this undefined
++#undef FAAD_MODIFIED
++
+ // ANSI C headers
+ #include <cstdlib>
+ 
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/hdpvr-v4lchannel-tweak.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/hdpvr-v4lchannel-tweak.patch
new file mode 100644
index 0000000..3535310
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/hdpvr-v4lchannel-tweak.patch
@@ -0,0 +1,139 @@
+Index: libs/libmythtv/v4lchannel.h
+===================================================================
+--- libs/libmythtv/v4lchannel.h	(revision 18874)
++++ libs/libmythtv/v4lchannel.h	(working copy)
+@@ -103,6 +103,8 @@
+     VidModV4L2  videomode_v4l2; ///< Current video mode if 'usingv4l2' is true
+ 
+     int         defaultFreqTable;
++    int         prev_inputNumV4L;
++    v4l2_std_id prev_vid_mode;
+ };
+ 
+ #endif
+Index: libs/libmythtv/v4lchannel.cpp
+===================================================================
+--- libs/libmythtv/v4lchannel.cpp	(revision 18874)
++++ libs/libmythtv/v4lchannel.cpp	(working copy)
+@@ -40,7 +40,8 @@
+       device_name(QString::null),   driver_name(QString::null),
+       curList(NULL),                totalChannels(0),
+       currentFormat(""),            is_dtv(false),
+-      usingv4l2(false),             defaultFreqTable(1)
++      usingv4l2(false),             defaultFreqTable(1),
++      prev_inputNumV4L(-1),         prev_vid_mode(-1)
+ {
+ }
+ 
+@@ -795,62 +796,75 @@
+     {
+         VERBOSE(VB_CHANNEL, LOC + msg + "(v4l v2)");
+ 
+-        int ioctlval = ioctl(videofd, VIDIOC_S_INPUT, &inputNumV4L);
++	int ioctlval;
++	bool streamingDisabled = false;
++	int  streamType = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ 
+-        // ConvertX (wis-go7007) requires streaming to be disabled
+-        // before an input switch, do this if initial switch failed.
+-        bool streamingDisabled = false;
+-        int  streamType = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+-        if ((ioctlval < 0) && (errno == EBUSY))
++        if (prev_inputNumV4L != inputNumV4L)
+         {
+-            ioctlval = ioctl(videofd, VIDIOC_STREAMOFF, &streamType);
++            ioctlval = ioctl(videofd, VIDIOC_S_INPUT, &inputNumV4L);
++
++            // ConvertX (wis-go7007) requires streaming to be disabled
++            // before an input switch, do this if initial switch failed.
++            if ((ioctlval < 0) && (errno == EBUSY))
++            {
++                ioctlval = ioctl(videofd, VIDIOC_STREAMOFF, &streamType);
++                if (ioctlval < 0)
++                {
++                    VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
++                            "\n\t\t\twhile disabling streaming (v4l v2)" + ENO);
++
++                    ok = false;
++                    ioctlval = 0;
++                }
++                else
++                {
++                    streamingDisabled = true;
++
++                    // Resend the input switch ioctl.
++                    ioctlval = ioctl(videofd, VIDIOC_S_INPUT, &inputNumV4L);
++                }
++            }
++
+             if (ioctlval < 0)
+             {
+                 VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
+-                        "\n\t\t\twhile disabling streaming (v4l v2)" + ENO);
++                        "\n\t\t\twhile setting input (v4l v2)" + ENO);
+ 
+                 ok = false;
+-                ioctlval = 0;
+             }
+-            else
+-            {
+-                streamingDisabled = true;
+ 
+-                // Resend the input switch ioctl.
+-                ioctlval = ioctl(videofd, VIDIOC_S_INPUT, &inputNumV4L);
+-            }
++            prev_inputNumV4L = inputNumV4L;
+         }
+ 
+-        if (ioctlval < 0)
+-        {
+-            VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
+-                    "\n\t\t\twhile setting input (v4l v2)" + ENO);
+-
+-            ok = false;
+-        }
+-
+         v4l2_std_id vid_mode = format_to_mode(newFmt, 2);
+-        ioctlval = ioctl(videofd, VIDIOC_S_STD, &vid_mode);
+-        if (ioctlval < 0)
+-        {
+-            VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
+-                    "\n\t\t\twhile setting format (v4l v2)" + ENO);
+ 
+-            ok = false;
+-        }
+-
+-        // ConvertX (wis-go7007) requires streaming to be disabled
+-        // before an input switch, here we try to re-enable streaming.
+-        if (streamingDisabled)
++        if (prev_vid_mode != vid_mode)
+         {
+-            ioctlval = ioctl(videofd, VIDIOC_STREAMON, &streamType);
++            ioctlval = ioctl(videofd, VIDIOC_S_STD, &vid_mode);
+             if (ioctlval < 0)
+             {
+                 VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
+-                        "\n\t\t\twhile reenabling streaming (v4l v2)" + ENO);
++                        "\n\t\t\twhile setting format (v4l v2)" + ENO);
+ 
+                 ok = false;
+             }
++
++            // ConvertX (wis-go7007) requires streaming to be disabled
++            // before an input switch, here we try to re-enable streaming.
++            if (streamingDisabled)
++            {
++                ioctlval = ioctl(videofd, VIDIOC_STREAMON, &streamType);
++                if (ioctlval < 0)
++                {
++                    VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
++                            "\n\t\t\twhile reenabling streaming (v4l v2)" +
++                            ENO);
++
++                    ok = false;
++                }
++            }
++            prev_vid_mode = vid_mode;
+         }
+     }
+ 
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/HOST_SETTINGS.xml b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/HOST_SETTINGS.xml
new file mode 100644
index 0000000..f257920
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/HOST_SETTINGS.xml
@@ -0,0 +1,87 @@
+<mythmenu name="HOST_SETTINGS">
+
+   <button>
+       <type>MV_NETWORK_SETUP_MENU</type>
+      <text>Network Settings</text>
+      <action>EXEC  mythinstall -s network </action>
+   </button>
+
+   <button>
+       <type>MV_SYSTEM_SETUP_MENU</type>
+      <text>System type</text>
+        <action>EXEC  mythinstall -s hostype </action>
+   </button>
+
+   <button>
+       <type>MV_MISC_SETUP_MENU</type>
+      <text>Misc Settings</text>
+       <action>EXEC  mythinstall -s misc </action>
+   </button>
+
+   <button>
+       <type>MV_SOFTWARE_MENU</type>
+      <text>Software</text>
+       <action>EXEC  mythinstall -s  plugins </action>
+   </button>
+
+   <button>
+      <type>MV_SHUTDOWN_SETUP_MENU</type>
+      <text>Shutdown settings</text>
+        <action>EXEC  mythinstall -s sleep </action>
+   </button>
+
+
+<button>
+   <type>MV_ADVANCED_X_SETUP_MENU</type>
+    <text>Display</text>
+    <action>EXEC  mythinstall -s advancedX</action>
+</button>
+
+<button>
+   <type>MV_ADVANCED_SETUP_MENU</type>
+    <text>Advanced settings</text>
+    <action>EXEC  mythinstall -s advanced</action>
+</button>
+
+
+<button>
+       <type>MV_AUDIO_SETUP_MENU</type>
+       <text>Audio settings</text>
+        <action>EXEC  mythinstall -s sound </action>
+</button>
+
+
+<button>
+       <type>MV_ACCESS_SETUP_MENU</type>
+       <text>Access</text>
+       <action>EXEC  mythinstall -s accesscontrol </action>
+</button>
+
+<button>
+       <type>MV_USER_SETUP_MENU</type>
+       <text>Password </text>
+       <action>EXEC  mythinstall -s user </action>
+</button>
+
+<button>
+       <type>MV_WEBACCESS_SETUP_MENU</type>
+       <text>Web security</text>
+       <action>EXEC  mythinstall -s webuser </action>
+</button>
+
+
+
+
+   <!--
+   <button>
+       <type>SETUP_MENU</type>
+       <text>Settings profile manager</text>
+        <action>EXEC  mythinstall -t </action>
+
+   </button>
+   -->
+
+
+
+
+</mythmenu>
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/is.xml b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/is.xml
new file mode 100644
index 0000000..65935cf
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/is.xml
@@ -0,0 +1,33 @@
+<mythmenu name="Internet Steams">
+   <button>
+     <type>MOVIETIMES</type>
+     <text>Apple Trailers</text>
+     <action>MENU appletrailer.xml</action>
+   </button>
+
+   <button>
+     <type>STREAM</type>
+     <text>MythStream</text>
+     <action>PLUGIN mythstream</action>
+     <depends>mythstream</depends>
+    </button>
+
+   <button>
+     <type>STREAM</type>
+     <text>Miro Player</text>
+     <action>EXEC /usr/bin/democracyplayer</action>
+   </button>
+
+   <button>
+     <type>KnoppMyth</type>
+     <text>Sirius Satellite Radio</text>
+     <action>MENU siriusmenu.xml</action>
+   </button>
+
+   <button>
+     <type>KnoppMyth</type>
+     <text>XM Satellite Radio</text>
+     <action>MENU xmmenu.xml</action>
+   </button>
+
+</mythmenu>
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/knoppmyth.xml b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/knoppmyth.xml
new file mode 100644
index 0000000..8aa6134
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/knoppmyth.xml
@@ -0,0 +1,55 @@
+<mythmenu name="KnoppMyth">
+
+   <button>
+     <type>BACKUP</type>
+     <text>Backup KnoppMyth</text>
+     <action>MENU mythbackup.xml</action>
+   </button>
+
+   <button>
+     <type>RESTORE</type>
+     <text>Restore KnoppMyth</text>
+     <action>MENU mythrestore.xml</action>
+   </button>
+   
+   <button>
+     <type>Motion</type>
+     <text>Motion</text>
+     <action>MENU motion.xml</action>
+   </button>
+<!--
+   <button>
+     <type>POWER</type>
+     <text>Power Off </text>
+     <action>EXEC /usr/bin/sudo halt</action>
+   </button>
+   
+   <button>
+     <type>POWER</type>
+     <text>Reboot</text>
+     <action>EXEC /usr/bin/sudo reboot</action>
+   </button>
+
+   <button>
+     <type>VERSION</type>
+     <text>Version</text>
+     <action>EXEC /usr/local/bin/ver.sh</action>
+   </button>
+-->
+
+   <button>
+       <type>MV_SETUP_MENU</type>
+       <text>MythVantage Settings</text>
+       <action>MENU HOST_SETTINGS.xml</action>
+
+   </button>
+<!--
+   <button>
+       <type>MV_TEMPLATE</type>
+       <text>Settings profile manager</text>
+        <action>EXEC  mythinstall -t </action>
+
+   </button>
+-->
+</mythmenu>
+
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/library.xml.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/library.xml.patch
new file mode 100644
index 0000000..ef08f0c
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/library.xml.patch
@@ -0,0 +1,13 @@
+--- library.xml.orig	2008-11-13 11:26:10.000000000 -0500
++++ library.xml	2008-11-19 11:55:55.000000000 -0500
+@@ -120,9 +120,7 @@
+    <button>
+      <type>STREAM</type>
+      <text>Play Online Streams</text>
+-     <text lang="HE">נגן מדיה מכוונת</text>
+-     <action>PLUGIN mythstream</action>
+-     <depends>mythstream</depends>
++     <action>MENU is.xml</action>
+    </button>
+ 
+    <button>
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/mainmenu.xml.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/mainmenu.xml.patch
new file mode 100644
index 0000000..f4f57f1
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/mainmenu.xml.patch
@@ -0,0 +1,16 @@
+--- mainmenu.xml.orig	2008-11-13 11:26:10.000000000 -0500
++++ mainmenu.xml	2008-11-19 12:01:57.000000000 -0500
+@@ -188,6 +188,13 @@
+      <action>MENU util_menu.xml</action>
+    </button>
+ 
++
++   <button>
++     <type>MENU_UTILITIES_SETUP</type>
++     <text>Service Menu</text>
++     <action>MENU knoppmyth.xml</action>
++   </button>
++
+    <!-- <button>
+      <type>SHUTDOWN</type>
+      <text>Shutdown</text>
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/motion.xml b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/motion.xml
new file mode 100644
index 0000000..23ebfe2
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/motion.xml
@@ -0,0 +1,20 @@
+<mythmenu name="Motion">
+
+   <button>
+     <type>MOTION</type>
+     <text>Start Motion</text>
+     <action>EXEC sudo /etc/init.d/motion start</action>
+   </button>
+
+   <button>
+     <type>MOTION</type>
+     <text>Stop Motion</text>
+     <action>EXEC sudo /etc/init.d/motion stop</action>
+   </button>
+   
+   <button>
+     <type>MOTION</type>
+     <text>Clear Motion</text>
+     <action>EXEC /usr/local/bin/cm.sh</action>
+   </button>
+</mythmenu>
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/optical_menu.xml.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/optical_menu.xml.patch
new file mode 100644
index 0000000..7e016a5
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/optical_menu.xml.patch
@@ -0,0 +1,15 @@
+--- optical_menu.xml.orig	2008-11-19 11:52:44.000000000 -0500
++++ optical_menu.xml	2008-11-19 12:32:19.000000000 -0500
+@@ -129,6 +129,12 @@
+    </button>
+ 
+    <button>
++      <type>DVD_RIP</type>
++      <text>Import video files from DVD</text>
++      <action>EXEC /usr/local/bin/importfiles.sh</action>
++   </button>
++
++   <button>
+       <type>EJECT</type>
+       <text>Eject media</text>
+       <text lang="IT">Espelli Media</text>
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/setup.xml b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/setup.xml
new file mode 100644
index 0000000..f56bb6f
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/setup.xml
@@ -0,0 +1,111 @@
+<mythmenu name="MAIN">
+
+   <button>
+     <type>SETUP_GENERAL</type>
+     <text>1. General</text>
+     <text lang="IT">1. Generale</text>
+     <text lang="PT">1. Geral</text>
+     <text lang="SV">1. Generellt</text>
+     <text lang="JA">1. 一般</text>
+     <text lang="DE">1. Allgemeines</text>
+     <text lang="FI">1. Yleiset</text>
+     <text lang="FR">1. Général</text>
+     <text lang="SI">1. Splošno</text>
+     <text lang="ET">1. Üldine</text>
+     <text lang="NB">1 Generelt</text>
+     <text lang="DK">1. Generelt</text>
+     <text lang="ES">1. General</text>
+     <text lang="CZ">1. Obecný</text>
+     <text lang="RU">1. Общие</text>
+     <action>GENERAL</action>
+   </button>
+
+   <button>
+     <type>SETUP_CAPTURE_CARDS</type>
+     <text>2. Capture cards</text>
+     <text lang="IT">2. Schede di Acquisizione</text>
+     <text lang="PT">2. Placas de Captura</text>
+     <text lang="SV">2. TV-kort</text>
+     <text lang="JA">2. キャプチャカード</text>
+     <text lang="DE">2. TV-Karten</text>
+     <text lang="FI">2. TV-kortit</text>
+     <text lang="FR">2. Cartes d'acquisition</text>
+     <text lang="SI">2. Kartice za zajem</text>
+     <text lang="ET">2. TV-kaardid</text>
+     <text lang="NB">2 TV-kort</text>
+     <text lang="DK">2. TV-kort</text>
+     <text lang="ES">2. Capturadoras</text>
+     <text lang="CZ">2. Zachytávací karty</text>
+     <text lang="RU">2. Карты захвата</text>
+     <action>CAPTURE CARDS</action>
+   </button>
+
+   <button>
+     <type>SETUP_VIDEO_SOURCES</type>
+     <text>3. Video sources</text>
+     <text lang="IT">3. Fonte Video</text>
+     <text lang="PT">3. Fontes de Vídeo</text>
+     <text lang="SV">3. Videokällor</text>
+     <text lang="JA">3. ビデオソース</text>
+     <text lang="DE">3. Videoquellen</text>
+     <text lang="FI">3. Kuvanlähteet</text>
+     <text lang="FR">3. Sources vidéo</text>
+     <text lang="SI">3. Video viri</text>
+     <text lang="ET">3. Videosisendid</text>
+     <text lang="NB">3 Videokilder</text>
+     <text lang="DK">3. Videokilder</text>
+     <text lang="ES">3. Fuentes de Vídeo</text>
+     <text lang="CZ">3. Zdroje obrazu</text>
+     <text lang="RU">3. Видео источники</text>
+     <action>VIDEO SOURCES</action>
+   </button>
+
+   <button>
+     <type>SETUP_INPUT_CONNECTIONS</type>
+     <text>4. Input connections</text>
+     <text lang="IT">4. Connessioni di Ingresso</text>
+     <text lang="PT">4. Ligações de Entrada</text>
+     <text lang="SV">4. Anslutningar</text>
+     <text lang="JA">4. 入力とソースの接続</text>
+     <text lang="DE">4. Verknüpfungen</text>
+     <text lang="FI">4. Sisääntuloasetukset</text>
+     <text lang="FR">4. Entrées Vidéos</text>
+     <text lang="SI">4. Vhodne povezave</text>
+     <text lang="ET">4. Sisendite ühendused</text>
+     <text lang="NB">4 Inndata</text>
+     <text lang="DK">4. Indgange</text>
+     <text lang="ES">4. Conexiones</text>
+     <text lang="CZ">4. Připojení vstupů</text>
+     <text lang="RU">4. Соединение входов</text>
+     <action>CARD INPUTS</action>
+   </button>
+
+   <button>
+     <type>SETUP_CHANNEL_EDITOR</type>
+     <text>5. Channel Editor</text>
+     <text lang="IT">5. Modifica Canali</text>
+     <text lang="SV">5. Kanaleditor</text>
+     <text lang="JA">5. チャンネル設定</text>
+     <text lang="DE">5. Sender bearbeiten</text>
+     <text lang="FI">5. Kanavanviritys</text>
+     <text lang="FR">5. Editeur de chaînes</text>
+     <text lang="SI">5. Urejanje kanalov</text>
+     <text lang="ET">5. Kanaliredaktor</text>
+     <text lang="NB">5 Kanalredigerer</text>
+     <text lang="DK">5. Kanal opsætning</text>
+     <text lang="ES">5. Editor Canales</text>
+     <text lang="CZ">5. Editor kanálů</text>
+     <text lang="RU">5. Редактор каналов</text>
+     <action>CHANNEL EDITOR</action>
+   </button>
+
+   <button>
+     <type>SETUP_STORAGE_GROUPS</type>
+     <text>6. Storage Directories</text>
+     <text lang="IT">6. Cartelle</text>
+     <text lang="FI">Tallennusryhmät</text>
+     <text lang="SV">Lagringsgrupper</text>
+     <action>STORAGE GROUPS</action>
+   </button>
+
+</mythmenu>
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/siriusmenu.xml b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/siriusmenu.xml
new file mode 100644
index 0000000..e317b36
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/siriusmenu.xml
@@ -0,0 +1,419 @@
+<mythmenu name="SIRIUS">
+   <button>
+      <type>MUSIC</type>
+      <text>Sirius Hits 1</text>
+      <action>EXEC /usr/bin/cliSipie siriushits1</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>StarLite</text>
+      <action>EXEC /usr/bin/cliSipie starlite</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Sirius Love</text>
+      <action>EXEC /usr/bin/cliSipie siriuslove</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Movin EZ</text>
+      <action>EXEC /usr/bin/cliSipie movineasy</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Sirius Gold</text>
+      <action>EXEC /usr/bin/cliSipie siriusgold</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>'60s Vibrations</text>
+      <action>EXEC /usr/bin/cliSipie 60svibrations</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Totally '70s</text>
+      <action>EXEC /usr/bin/cliSipie totally70s</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Big '80s</text>
+      <action>EXEC /usr/bin/cliSipie big80s</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>ThePulse</text>
+      <action>EXEC /usr/bin/cliSipie thepulse</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Bridge</text>
+      <action>EXEC /usr/bin/cliSipie thebridge</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>BBC Radio 1</text>
+      <action>EXEC /usr/bin/cliSipie bbcradio1</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Super Shuffle</text>
+      <action>EXEC /usr/bin/cliSipie supershuffle</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Elvis Radio</text>
+      <action>EXEC /usr/bin/cliSipie elvisradio</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Classic Vinyl</text>
+      <action>EXEC /usr/bin/cliSipie classicvinyl</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Classic Rewind</text>
+      <action>EXEC /usr/bin/cliSipie classicrewind</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>TheVault</text>
+      <action>EXEC /usr/bin/cliSipie thevault</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Jam_ON</text>
+      <action>EXEC /usr/bin/cliSipie jamon</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Spectrum</text>
+      <action>EXEC /usr/bin/cliSipie thespectrum</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>BuzzSaw</text>
+      <action>EXEC /usr/bin/cliSipie buzzsaw</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Octane</text>
+      <action>EXEC /usr/bin/cliSipie octane</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Alt Nation</text>
+      <action>EXEC /usr/bin/cliSipie altnation</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>1st Wave</text>
+      <action>EXEC /usr/bin/cliSipie firstwave</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Hair Nation</text>
+      <action>EXEC /usr/bin/cliSipie hairnation</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>'90s Alternative</text>
+      <action>EXEC /usr/bin/cliSipie 90salternative</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Garage</text>
+      <action>EXEC /usr/bin/cliSipie undergroundgarage</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Left of Center</text>
+      <action>EXEC /usr/bin/cliSipie leftofcenter</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Hard Attack</text>
+      <action>EXEC /usr/bin/cliSipie hardattack</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Faction</text>
+      <action>EXEC /usr/bin/cliSipie faction</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Punk</text>
+      <action>EXEC /usr/bin/cliSipie punk</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>The Coffee House</text>
+      <action>EXEC /usr/bin/cliSipie coffeehouse</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Margaritaville</text>
+      <action>EXEC /usr/bin/cliSipie radiomargaritaville</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Sirius Disorder</text>
+      <action>EXEC /usr/bin/cliSipie siriusdisorder</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Reggae</text>
+      <action>EXEC /usr/bin/cliSipie reggaerhythms</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Area 33</text>
+      <action>EXEC /usr/bin/cliSipie area33</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Boombox</text>
+      <action>EXEC /usr/bin/cliSipie boombox</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Chill</text>
+      <action>EXEC /usr/bin/cliSipie chill</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>The Beat</text>
+      <action>EXEC /usr/bin/cliSipie thebeat</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Strobe</text>
+      <action>EXEC /usr/bin/cliSipie thestrobe</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Hip-Hop Nation</text>
+      <action>EXEC /usr/bin/cliSipie hiphopnation</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>BackSpin</text>
+      <action>EXEC /usr/bin/cliSipie backspin</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Shade 45</text>
+      <action>EXEC /usr/bin/cliSipie shade45</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Hot Jamz</text>
+      <action>EXEC /usr/bin/cliSipie hotjamz</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Heart  &amp; Soul</text>
+      <action>EXEC /usr/bin/cliSipie heartandsoul</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>SoulTown</text>
+      <action>EXEC /usr/bin/cliSipie soultown</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>New Country</text>
+      <action>EXEC /usr/bin/cliSipie newcountry</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Prime Country</text>
+      <action>EXEC /usr/bin/cliSipie primecountry</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Roadhouse</text>
+      <action>EXEC /usr/bin/cliSipie theroadhouse</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Outlaw Country</text>
+      <action>EXEC /usr/bin/cliSipie outlawcountry</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Bluegrass</text>
+      <action>EXEC /usr/bin/cliSipie bluegrass</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Spirit</text>
+      <action>EXEC /usr/bin/cliSipie spirit</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Praise</text>
+      <action>EXEC /usr/bin/cliSipie praise</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Planet Jazz</text>
+      <action>EXEC /usr/bin/cliSipie planetjazz</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>JazzCafe</text>
+      <action>EXEC /usr/bin/cliSipie jazzcafe</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>PureJazz</text>
+      <action>EXEC /usr/bin/cliSipie purejazz</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Spa 73</text>
+      <action>EXEC /usr/bin/cliSipie spa73</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Blues</text>
+      <action>EXEC /usr/bin/cliSipie siriusblues</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Siriusly Sinatra</text>
+      <action>EXEC /usr/bin/cliSipie siriuslysinatra</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Broadway's Best</text>
+      <action>EXEC /usr/bin/cliSipie broadwaysbest</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Symphony Hall</text>
+      <action>EXEC /usr/bin/cliSipie symphonyhall</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Met Opera Radio</text>
+      <action>EXEC /usr/bin/cliSipie metropolitanopera</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Sirius Pops</text>
+      <action>EXEC /usr/bin/cliSipie siriuspops</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Universo Latino</text>
+      <action>EXEC /usr/bin/cliSipie universolatino</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Rumbon</text>
+      <action>EXEC /usr/bin/cliSipie rumbon</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Martha Stewart</text>
+      <action>EXEC /usr/bin/cliSipie marthastewartlivingradio</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Sirius Stars</text>
+      <action>EXEC /usr/bin/cliSipie siriusstars</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>OutQ Gay Radio</text>
+      <action>EXEC /usr/bin/cliSipie siriusoutq</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Patriot</text>
+      <action>EXEC /usr/bin/cliSipie siriuspatriot</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Left</text>
+      <action>EXEC /usr/bin/cliSipie siriusleft</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>CNN</text>
+      <action>EXEC /usr/bin/cliSipie cnn</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>wrn</text>
+      <action>EXEC /usr/bin/cliSipie wrn</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Blue Collar Comedy</text>
+      <action>EXEC /usr/bin/cliSipie bluecollarcomedy</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Raw Dog Comedy</text>
+      <action>EXEC /usr/bin/cliSipie rawdog</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Laugh Break Comedy</text>
+      <action>EXEC /usr/bin/cliSipie laughbreak</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>thefoxxhole</text>
+      <action>EXEC /usr/bin/cliSipie thefoxxhole</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>lime</text>
+      <action>EXEC /usr/bin/cliSipie lime</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Kids Stuff</text>
+      <action>EXEC /usr/bin/cliSipie kidsstuff</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Catholic Channel</text>
+      <action>EXEC /usr/bin/cliSipie thecatholicchannel</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>EWTN</text>
+      <action>EXEC /usr/bin/cliSipie ewtnglobal</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>christiantalk</text>
+      <action>EXEC /usr/bin/cliSipie christiantalk</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Sirius NFL Radio</text>
+      <action>EXEC /usr/bin/cliSipie siriusnflradio</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Maxim Radio</text>
+      <action>EXEC /usr/bin/cliSipie maximradio</action>
+   </button>
+   <button>
+      <type>MUSIC</type>
+      <text>Cosmo Radio</text>
+      <action>EXEC /usr/bin/cliSipie cosmopolitanradio</action>
+   </button>
+   <button>
+     <type>TV_DELETE</type>
+     <text>Stop Listening</text>
+     <action>EXEC /usr/bin/sipie_kill</action>
+  </button>
+
+</mythmenu>
+
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/xmmenu.xml b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/xmmenu.xml
new file mode 100644
index 0000000..6b26d11
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/menu-xml/xmmenu.xml
@@ -0,0 +1,574 @@
+<!-- Current as of April 25, 2007 -->
+<mythmenu name="XM">
+
+	<button>
+		<type>MUSIC</type>
+		<text>The '40s</text>
+		<action>EXEC /usr/bin/xamp kill 4</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The '50s</text>
+		<action>EXEC /usr/bin/xamp kill 5</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The '60s</text>
+		<action>EXEC /usr/bin/xamp kill 6</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The '70s</text>
+		<action>EXEC /usr/bin/xamp kill 7</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The '80s</text>
+		<action>EXEC /usr/bin/xamp kill 8</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The '90s</text>
+		<action>EXEC /usr/bin/xamp kill 9</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>America</text>
+		<action>EXEC /usr/bin/xamp kill 10</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>X Country</text>
+		<action>EXEC /usr/bin/xamp kill 12</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Willie's Place</text>
+		<action>EXEC /usr/bin/xamp kill 13</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Bluegrass Junction</text>
+		<action>EXEC /usr/bin/xamp kill 14</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Village</text>
+		<action>EXEC /usr/bin/xamp kill 15</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Highway 16</text>
+		<action>EXEC /usr/bin/xamp kill 16</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>US Country</text>
+		<action>EXEC /usr/bin/xamp kill 17</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>20 on 20</text>
+		<action>EXEC /usr/bin/xamp kill 20</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Heart</text>
+		<action>EXEC /usr/bin/xamp kill 23</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Blend</text>
+		<action>EXEC /usr/bin/xamp kill 25</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Flight 26</text>
+		<action>EXEC /usr/bin/xamp kill 26</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Cinemagic</text>
+		<action>EXEC /usr/bin/xamp kill 27</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>On Broadway</text>
+		<action>EXEC /usr/bin/xamp kill 28</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>U-Pop</text>
+		<action>EXEC /usr/bin/xamp kill 29</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>XM Hitlist</text>
+		<action>EXEC /usr/bin/xamp kill 30</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Torch</text>
+		<action>EXEC /usr/bin/xamp kill 31</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Message</text>
+		<action>EXEC /usr/bin/xamp kill 32</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Spirit</text>
+		<action>EXEC /usr/bin/xamp kill 33</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>enLighten</text>
+		<action>EXEC /usr/bin/xamp kill 34</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Deep Tracks</text>
+		<action>EXEC /usr/bin/xamp kill 40</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Boneyard</text>
+		<action>EXEC /usr/bin/xamp kill 41</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>XM Liquid Metal</text>
+		<action>EXEC /usr/bin/xamp kill 42</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>XMU</text>
+		<action>EXEC /usr/bin/xamp kill 43</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Fred</text>
+		<action>EXEC /usr/bin/xamp kill 44</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>XM Cafe</text>
+		<action>EXEC /usr/bin/xamp kill 45</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Top Tracks</text>
+		<action>EXEC /usr/bin/xamp kill 46</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Ethel</text>
+		<action>EXEC /usr/bin/xamp kill 47</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Squizz</text>
+		<action>EXEC /usr/bin/xamp kill 48</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Big Tracks</text>
+		<action>EXEC /usr/bin/xamp kill 49</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Loft</text>
+		<action>EXEC /usr/bin/xamp kill 50</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>XM Music Lab</text>
+		<action>EXEC /usr/bin/xamp kill 51</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Verge</text>
+		<action>EXEC /usr/bin/xamp kill 52</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Fungus</text>
+		<action>EXEC /usr/bin/xamp kill 53</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Lucy</text>
+		<action>EXEC /usr/bin/xamp kill 54</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Soul Street</text>
+		<action>EXEC /usr/bin/xamp kill 60</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Flow</text>
+		<action>EXEC /usr/bin/xamp kill 61</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Suite 62</text>
+		<action>EXEC /usr/bin/xamp kill 62</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Groove</text>
+		<action>EXEC /usr/bin/xamp kill 64</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Rhyme</text>
+		<action>EXEC /usr/bin/xamp kill 65</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>RAW</text>
+		<action>EXEC /usr/bin/xamp kill 66</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The City</text>
+		<action>EXEC /usr/bin/xamp kill 67</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Heat</text>
+		<action>EXEC /usr/bin/xamp kill 68</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Real Jazz</text>
+		<action>EXEC /usr/bin/xamp kill 70</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Watercolors</text>
+		<action>EXEC /usr/bin/xamp kill 71</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Beyond Jazz</text>
+		<action>EXEC /usr/bin/xamp kill 72</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>High Standards</text>
+		<action>EXEC /usr/bin/xamp kill 73</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Bluesville</text>
+		<action>EXEC /usr/bin/xamp kill 74</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Hear Music</text>
+		<action>EXEC /usr/bin/xamp kill 75</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Fine Tuning</text>
+		<action>EXEC /usr/bin/xamp kill 76</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Audio Visions</text>
+		<action>EXEC /usr/bin/xamp kill 77</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Escape</text>
+		<action>EXEC /usr/bin/xamp kill 78</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>On The Rocks</text>
+		<action>EXEC /usr/bin/xamp kill 79</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Move</text>
+		<action>EXEC /usr/bin/xamp kill 80</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>BPM</text>
+		<action>EXEC /usr/bin/xamp kill 81</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The System</text>
+		<action>EXEC /usr/bin/xamp kill 82</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Chrome</text>
+		<action>EXEC /usr/bin/xamp kill 83</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>XM-Chill</text>
+		<action>EXEC /usr/bin/xamp kill 84</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Fuego</text>
+		<action>EXEC /usr/bin/xamp kill 90</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Viva</text>
+		<action>EXEC /usr/bin/xamp kill 91</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Aguila</text>
+		<action>EXEC /usr/bin/xamp kill 92</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Caliente</text>
+		<action>EXEC /usr/bin/xamp kill 94</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Luna</text>
+		<action>EXEC /usr/bin/xamp kill 95</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Air Musique</text>
+		<action>EXEC /usr/bin/xamp kill 100</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Joint</text>
+		<action>EXEC /usr/bin/xamp kill 101</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Sur La Route</text>
+		<action>EXEC /usr/bin/xamp kill 102</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>World Zone</text>
+		<action>EXEC /usr/bin/xamp kill 103</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Ngoma</text>
+		<action>EXEC /usr/bin/xamp kill 104</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>XM Classics</text>
+		<action>EXEC /usr/bin/xamp kill 110</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Vox</text>
+		<action>EXEC /usr/bin/xamp kill 112</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>XM Pops</text>
+		<action>EXEC /usr/bin/xamp kill 113</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>XM Kids</text>
+		<action>EXEC /usr/bin/xamp kill 116</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Bob Edwards Show</text>
+		<action>EXEC /usr/bin/xamp kill 133</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>XM Comedy</text>
+		<action>EXEC /usr/bin/xamp kill 150</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Laugh USA</text>
+		<action>EXEC /usr/bin/xamp kill 151</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Special X</text>
+		<action>EXEC /usr/bin/xamp kill 154</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Agenda</text>
+		<action>EXEC /usr/bin/xamp kill 134</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Oprah and Friends</text>
+		<action>EXEC /usr/bin/xamp kill 156</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>The Virus</text>
+		<action>EXEC /usr/bin/xamp kill 202</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>1 Hit Wonders</text>
+		<action>EXEC /usr/bin/xamp kill 300</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Metalcore</text>
+		<action>EXEC /usr/bin/xamp kill 301</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>New Indie First</text>
+		<action>EXEC /usr/bin/xamp kill 302</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Late Night Mix</text>
+		<action>EXEC /usr/bin/xamp kill 303</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Sessions@AOL</text>
+		<action>EXEC /usr/bin/xamp kill 304</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>Shuffle</text>
+		<action>EXEC /usr/bin/xamp kill 305</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>New Rock First</text>
+		<action>EXEC /usr/bin/xamp kill 306</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>New Country First</text>
+		<action>EXEC /usr/bin/xamp kill 307</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>New Hip Hop First</text>
+		<action>EXEC /usr/bin/xamp kill 308</action>
+	</button>
+
+	<button>
+		<type>MUSIC</type>
+		<text>New Pop First</text>
+		<action>EXEC /usr/bin/xamp kill 309</action>
+	</button>
+
+	<button>
+		<type>TV_DELETE</type>
+		<text>Stop Listening</text>
+		<action>EXEC /usr/bin/xamp kill</action>
+	</button>
+
+</mythmenu>
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/mpegrecorder-hdpvr-v1.1.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/mpegrecorder-hdpvr-v1.1.patch
new file mode 100644
index 0000000..f292b7f
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/mpegrecorder-hdpvr-v1.1.patch
@@ -0,0 +1,658 @@
+Index: libs/libmythtv/mpegrecorder.h
+===================================================================
+--- libs/libmythtv/mpegrecorder.h	(revision 19056)
++++ libs/libmythtv/mpegrecorder.h	(working copy)
+@@ -80,11 +80,13 @@
+     uint GetFilteredAudioLayer(void) const;
+     uint GetFilteredAudioBitRate(uint audio_layer) const;
+ 
++    void RestartEncoding(void);
+     bool StartEncoding(int fd);
+     bool StopEncoding(int fd);
+ 
+     void ResetForNewFile(void);
+ 
++    bool WaitFor_HDPVR(void);
+     void HandleResolutionChanges(void);
+ 
+     inline bool CheckCC(uint pid, uint cc);
+@@ -104,7 +106,6 @@
+     // State
+     bool recording;
+     bool encoding;
+-    bool needs_resolution;
+     mutable QMutex start_stop_encoding_lock;
+     QMutex recording_wait_lock;
+     QWaitCondition recording_wait;
+@@ -113,7 +114,7 @@
+     bool cleartimeonpause;
+ 
+     // Encoding info
+-    int width, height;
++    uint width, height;
+     int bitrate, maxbitrate, streamtype, aspectratio;
+     int audtype, audsamplerate, audbitratel1, audbitratel2, audbitratel3;
+     int audvolume;
+Index: libs/libmythtv/mpegrecorder.cpp
+===================================================================
+--- libs/libmythtv/mpegrecorder.cpp	(revision 19056)
++++ libs/libmythtv/mpegrecorder.cpp	(working copy)
+@@ -19,6 +19,7 @@
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
+ #include <sys/time.h>
++#include <sys/poll.h>
+ 
+ // avlib headers
+ extern "C" {
+@@ -86,7 +87,7 @@
+     requires_special_pause(false),
+     // State
+     recording(false),         encoding(false),
+-    needs_resolution(false),  start_stop_encoding_lock(QMutex::Recursive),
++    start_stop_encoding_lock(QMutex::Recursive),
+     recording_wait_lock(),    recording_wait(),
+     // Pausing state
+     cleartimeonpause(false),
+@@ -487,13 +488,21 @@
+ 
+ bool MpegRecorder::SetFormat(int chanfd)
+ {
++    uint   idx;
+     struct v4l2_format vfmt;
+     bzero(&vfmt, sizeof(vfmt));
+ 
+     vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ 
+-    if (ioctl(chanfd, VIDIOC_G_FMT, &vfmt) < 0)
++    for (idx = 0; idx < 20; ++idx)
+     {
++        if (ioctl(chanfd, VIDIOC_G_FMT, &vfmt) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 10)
++    {
+         VERBOSE(VB_IMPORTANT, LOC_ERR + "Error getting format" + ENO);
+         return false;
+     }
+@@ -501,8 +510,15 @@
+     vfmt.fmt.pix.width = width;
+     vfmt.fmt.pix.height = height;
+ 
+-    if (ioctl(chanfd, VIDIOC_S_FMT, &vfmt) < 0)
++    for (idx = 0; idx < 20; ++idx)
+     {
++        if (ioctl(chanfd, VIDIOC_S_FMT, &vfmt) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 20)
++    {
+         VERBOSE(VB_IMPORTANT, LOC_ERR + "Error setting format" + ENO);
+         return false;
+     }
+@@ -513,10 +529,19 @@
+ /// Set audio language mode
+ bool MpegRecorder::SetLanguageMode(int chanfd)
+ {
++    uint   idx;
+     struct v4l2_tuner vt;
+     bzero(&vt, sizeof(struct v4l2_tuner));
+-    if (ioctl(chanfd, VIDIOC_G_TUNER, &vt) < 0)
++
++    for (idx = 0; idx < 20; ++idx)
+     {
++        if (ioctl(chanfd, VIDIOC_G_TUNER, &vt) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 20)
++    {
+         VERBOSE(VB_IMPORTANT, LOC_WARN + "Unable to get audio mode" + ENO);
+         return false;
+     }
+@@ -549,8 +574,15 @@
+         success = false;
+     }
+ 
+-    if (ioctl(chanfd, VIDIOC_S_TUNER, &vt) < 0)
++    for (idx = 0; idx < 20; ++idx)
+     {
++        if (ioctl(chanfd, VIDIOC_S_TUNER, &vt) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 20)
++    {
+         VERBOSE(VB_IMPORTANT, LOC_WARN + "Unable to set audio mode" + ENO);
+         success = false;
+     }
+@@ -561,10 +593,19 @@
+ bool MpegRecorder::SetRecordingVolume(int chanfd)
+ {
+     // Get volume min/max values
++    uint   idx;
+     struct v4l2_queryctrl qctrl;
+     qctrl.id = V4L2_CID_AUDIO_VOLUME;
+-    if (ioctl(chanfd, VIDIOC_QUERYCTRL, &qctrl) < 0)
++
++    for (idx = 0; idx < 20; ++idx)
+     {
++        if (ioctl(chanfd, VIDIOC_QUERYCTRL, &qctrl) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 20)
++    {
+         VERBOSE(VB_IMPORTANT, LOC_WARN +
+                 "Unable to get recording volume parameters(max/min)" + ENO +
+                 "\n\t\t\tusing default range [0,65535].");
+@@ -582,8 +623,15 @@
+     ctrl.id = V4L2_CID_AUDIO_VOLUME;
+     ctrl.value = ctrl_volume;
+ 
+-    if (ioctl(chanfd, VIDIOC_S_CTRL, &ctrl) < 0)
++    for (idx = 0; idx < 20; ++idx)
+     {
++        if (ioctl(chanfd, VIDIOC_S_CTRL, &ctrl) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 20)
++    {
+         VERBOSE(VB_IMPORTANT, LOC_WARN +
+                 "Unable to set recording volume" + ENO + "\n\t\t\t" +
+                 "If you are using an AverMedia M179 card this is normal.");
+@@ -765,6 +813,7 @@
+ 
+     for (uint i = 0; i < ext_ctrls.size(); i++)
+     {
++        uint   idx;
+         struct v4l2_ext_controls ctrls;
+         bzero(&ctrls, sizeof(struct v4l2_ext_controls));
+ 
+@@ -774,8 +823,15 @@
+         ctrls.count       = 1;
+         ctrls.controls    = &ext_ctrls[i];
+             
+-        if (ioctl(fd, VIDIOC_S_EXT_CTRLS, &ctrls) < 0)
++        for (idx = 0; idx < 20; ++idx)
+         {
++            if (ioctl(fd, VIDIOC_S_EXT_CTRLS, &ctrls) == 0)
++                break;
++            usleep(100 * 1000);
++        }
++
++        if (idx == 20)
++        {
+             QMutexLocker locker(&control_description_lock);
+             VERBOSE(VB_IMPORTANT, QString("mpegrecorder.cpp:set_ctrls(): ") +
+                     QString("Could not set %1 to %2")
+@@ -814,6 +870,30 @@
+     {
+         maxbitrate = high_mpeg4peakbitrate;
+         bitrate    = high_mpeg4avgbitrate;
++
++        // query supported audio codecs and prefer AC3
++        uint   idx;
++        struct v4l2_queryctrl qctrl;
++        qctrl.id = V4L2_CID_MPEG_AUDIO_ENCODING;
++
++        for (idx = 0; idx < 20; ++idx)
++        {
++            if (ioctl(chanfd, VIDIOC_QUERYCTRL, &qctrl) == 0)
++                break;
++            usleep(100 * 1000);
++        }
++
++        if (idx == 20)
++        {
++            VERBOSE(VB_IMPORTANT, LOC_WARN +
++                    "Unable to get supported audio codecs." + ENO);
++        }
++        else
++        {
++            if (qctrl.minimum != qctrl.maximum)
++                add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_AUDIO_ENCODING,
++                             qctrl.maximum);
++        }
+     }
+     maxbitrate = std::max(maxbitrate, bitrate);
+ 
+@@ -837,19 +917,36 @@
+     int audioinput = audiodevice.toUInt(&ok);
+     if (ok)
+     {
++        uint   idx;
+         struct v4l2_audio ain;
+         bzero(&ain, sizeof(ain));
+         ain.index = audioinput;
+-        if (ioctl(chanfd, VIDIOC_ENUMAUDIO, &ain) < 0)
++
++        for (idx = 0; idx < 20; ++idx)
+         {
++            if (ioctl(chanfd, VIDIOC_ENUMAUDIO, &ain) == 0)
++                break;
++            usleep(100 * 1000);
++        }
++
++        if (idx == 20)
++        {
+             VERBOSE(VB_IMPORTANT, LOC_WARN +
+                     "Unable to get audio input.");
+         }
+         else
+         {
+             ain.index = audioinput;
+-            if (ioctl(chanfd, VIDIOC_S_AUDIO, &ain) < 0)
++
++            for (idx = 0; idx < 20; ++idx)
+             {
++                if (ioctl(chanfd, VIDIOC_S_AUDIO, &ain) == 0)
++                    break;
++                usleep(100 * 1000);
++            }
++
++            if (idx == 20)
++            {
+                 VERBOSE(VB_IMPORTANT, LOC_WARN +
+                         "Unable to set audio input.");
+             }
+@@ -1036,17 +1133,26 @@
+     if (deviceIsMpegFile)
+         elapsedTimer.start();
+     else if (_device_read_buffer)
+-        _device_read_buffer->Start();
++    {
++        VERBOSE(VB_RECORD, LOC + "Initial startup of recorder");
+ 
+-    needs_resolution = (driver == "hdpvr");
++        if (StartEncoding(readfd))
++            _device_read_buffer->Start();
++        else
++        {
++            VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to start recording");
++            recording = false;
++            QMutexLocker locker(&recording_wait_lock);
++            recording_wait.wakeAll();
++            _error = true;
++        }
++    }
+ 
+     QByteArray vdevice = videodevice.toAscii();
+     while (encoding && !_error)
+     {
+         if (PauseAndWait(100))
+             continue;
+-
+-        HandleResolutionChanges();
+         
+         if (deviceIsMpegFile)
+         {
+@@ -1090,35 +1196,7 @@
+             {
+                 VERBOSE(VB_IMPORTANT, LOC_ERR + "Device error detected");
+ 
+-                _device_read_buffer->Stop();
+-
+-                QMutexLocker locker(&start_stop_encoding_lock);
+-
+-                StopEncoding(readfd);
+-
+-                // Make sure the next things in the file are a PAT & PMT
+-                if (_stream_data->PATSingleProgram() &&
+-                    _stream_data->PMTSingleProgram())
+-                {
+-                    bool tmp = _wait_for_keyframe_option;
+-                    _wait_for_keyframe_option = false;
+-                    HandleSingleProgramPAT(_stream_data->PATSingleProgram());
+-                    HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
+-                    _wait_for_keyframe_option = tmp;
+-                }
+-
+-                if (StartEncoding(readfd))
+-                {
+-                    _device_read_buffer->Start();
+-                }
+-                else
+-                {
+-                    if (0 != close(readfd))
+-                        VERBOSE(VB_IMPORTANT, LOC_ERR + "Close error" + ENO);
+-                    
+-                    // Force card to be reopened on next iteration..
+-                    readfd = -1;
+-                }
++                RestartEncoding();
+             }
+             else if (_device_read_buffer->IsEOF())
+             {
+@@ -1216,6 +1294,8 @@
+         }
+     }
+ 
++    VERBOSE(VB_RECORD, LOC + "StartRecording finishing up");
++
+     if (_device_read_buffer)
+     {
+         if (_device_read_buffer->IsRunning())
+@@ -1224,6 +1304,7 @@
+         delete _device_read_buffer;
+         _device_read_buffer = NULL;
+     }
++
+     StopEncoding(readfd);
+ 
+     FinishRecording();
+@@ -1373,52 +1454,95 @@
+ 
+         if (!paused)
+         {
++            VERBOSE(VB_RECORD, LOC + "PauseAndWait pause");
++
++            // Some drivers require streaming to be disabled before
++            // an input switch and other channel format setting.
++            if (requires_special_pause)
++                StopEncoding(readfd);
++
+             if (_device_read_buffer)
+             {
+                 QMutex drb_lock;
+                 drb_lock.lock();
+-
+                 _device_read_buffer->SetRequestPause(true);
+-
+                 pauseWait.wait(&drb_lock, timeout);
+             }
+             else
+-            {
+-                paused = true;
+                 pauseWait.wakeAll();
+-            }
+ 
+-            // Some drivers require streaming to be disabled before
+-            // an input switch and other channel format setting.
+-            if (requires_special_pause)
+-                StopEncoding(readfd);
+-
++            paused = true;
+             if (tvrec)
+                 tvrec->RecorderPaused();
+         }
+ 
+         unpauseWait.wait(&waitlock, timeout);
+     }
+-    if (!request_pause)
++
++    if (!request_pause && paused)
+     {
+-        if (paused)
++        VERBOSE(VB_RECORD, LOC + "PauseAndWait unpause");
++
++        if (driver == "hdpvr")
+         {
+-            // Some drivers require streaming to be disabled before
+-            // an input switch and other channel format setting.
+-            if (requires_special_pause)
+-                StartEncoding(readfd);
++            m_h264_parser.Reset();
++            _wait_for_keyframe_option = true;
++            _seen_sps = false;
+ 
+-            if (_device_read_buffer)
+-                _device_read_buffer->SetRequestPause(false);
++            // Sleep any less than 1.5 seconds, and the HD-PVR will
++            // return the old resolution, when the resolution is changing.
++            usleep(1500 * 1000);
++        }
+ 
+-            if (_stream_data)
+-                _stream_data->Reset(_stream_data->DesiredProgram());
+-        }
++        // Some drivers require streaming to be disabled before
++        // an input switch and other channel format setting.
++        if (requires_special_pause)
++            StartEncoding(readfd);
++        
++        if (_device_read_buffer)
++            _device_read_buffer->SetRequestPause(false);
++        
++        if (_stream_data)
++            _stream_data->Reset(_stream_data->DesiredProgram());
++
+         paused = false;
+     }
++
+     return paused;
+ }
+ 
++void MpegRecorder::RestartEncoding(void)
++{
++    VERBOSE(VB_RECORD, LOC + "RestartEncoding");
++
++    _device_read_buffer->Stop();
++    
++    QMutexLocker locker(&start_stop_encoding_lock);
++    
++    StopEncoding(readfd);
++    
++    // Make sure the next things in the file are a PAT & PMT
++    if (_stream_data->PATSingleProgram() &&
++        _stream_data->PMTSingleProgram())
++    {
++        _wait_for_keyframe_option = false;
++        HandleSingleProgramPAT(_stream_data->PATSingleProgram());
++        HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
++    }
++    
++    if (StartEncoding(readfd))
++    {
++        _device_read_buffer->Start();
++    }
++    else
++    {
++        if (0 != close(readfd))
++            VERBOSE(VB_IMPORTANT, LOC_ERR + "Close error" + ENO);
++        
++        readfd = -1;
++    }
++}
++
+ bool MpegRecorder::StartEncoding(int fd)
+ {
+     QMutexLocker locker(&start_stop_encoding_lock);
+@@ -1427,13 +1551,22 @@
+     memset(&command, 0, sizeof(struct v4l2_encoder_cmd));
+     command.cmd = V4L2_ENC_CMD_START;
+ 
++    if (driver == "hdpvr")
++        HandleResolutionChanges();
++
+     VERBOSE(VB_RECORD, LOC + "StartEncoding");
+-    needs_resolution = (driver == "hdpvr");
+ 
+-    for (int idx = 0; idx < 10; ++idx)
++    for (int idx = 0; idx < 20; ++idx)
+     {
+         if (ioctl(fd, VIDIOC_ENCODER_CMD, &command) == 0)
+         {
++            if (driver == "hdpvr")
++            {
++                m_h264_parser.Reset();
++                _wait_for_keyframe_option = true;
++                _seen_sps = false;
++            }
++
+             VERBOSE(VB_RECORD, LOC + "Encoding started");
+             return true;
+         }
+@@ -1444,7 +1577,7 @@
+             return false;
+         }
+ 
+-        usleep(250 * 1000);
++        usleep(100 * 1000);
+     }
+ 
+     VERBOSE(VB_IMPORTANT, LOC_ERR + "StartEncoding - giving up" + ENO);
+@@ -1461,9 +1594,8 @@
+ 
+     VERBOSE(VB_RECORD, LOC + "StopEncoding");
+ 
+-    for (int idx = 0; idx < 10; ++idx)
++    for (int idx = 0; idx < 20; ++idx)
+     {
+-
+         if (ioctl(fd, VIDIOC_ENCODER_CMD, &command) == 0)
+         {
+             VERBOSE(VB_RECORD, LOC + "Encoding stopped");
+@@ -1476,7 +1608,7 @@
+             return false;
+         }
+ 
+-        usleep(250 * 1000);
++        usleep(100 * 1000);
+     }
+ 
+     VERBOSE(VB_IMPORTANT, LOC_ERR + "StopEncoding - giving up" + ENO);
+@@ -1544,7 +1676,7 @@
+ void MpegRecorder::HandleSingleProgramPMT(ProgramMapTable *pmt)
+ {
+     if (!pmt)
+-{
++    {
+         return;
+     }
+ 
+@@ -1564,27 +1696,89 @@
+         DTVRecorder::BufferedWrite(*(reinterpret_cast<TSPacket*>(&buf[i])));
+ }
+ 
++bool MpegRecorder::WaitFor_HDPVR(void)
++{
++    // After a resolution change, it can take the HD-PVR a few
++    // seconds before it is usable again.
++
++    // Tell it to start encoding, then wait for it to actually feed us
++    // some data.
++    QMutexLocker locker(&start_stop_encoding_lock);
++
++    struct v4l2_encoder_cmd command;
++    struct pollfd polls;
++    int    idx;
++
++    memset(&command, 0, sizeof(struct v4l2_encoder_cmd));
++    command.cmd = V4L2_ENC_CMD_START;
++
++    for (idx = 0; idx < 20; ++idx)
++    {
++        if (ioctl(readfd, VIDIOC_ENCODER_CMD, &command) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 20)
++        return false;
++
++    polls.fd      = readfd;
++    polls.events  = POLLIN;
++    polls.revents = 0;
++
++    for (idx = 0; idx < 10; ++idx)
++    {
++        if (poll(&polls, 1, 250) > 0)
++            break;
++    }
++
++    if (idx == 10)
++        return false;
++
++    // HD-PVR should now be "ready"
++    command.cmd = V4L2_ENC_CMD_STOP;
++
++    for (idx = 0; idx < 20; ++idx)
++    {
++        if (ioctl(readfd, VIDIOC_ENCODER_CMD, &command) == 0)
++            return true;
++        usleep(100 * 1000);
++    }
++
++    return false;
++}
++
+ void MpegRecorder::HandleResolutionChanges(void)
+ {
+-    if (!needs_resolution)
+-        return;
+-
+     VERBOSE(VB_RECORD, LOC + "Checking Resolution");
+     struct v4l2_format vfmt;
+     memset(&vfmt, 0, sizeof(vfmt));
+     vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+             
++    if (driver == "hdpvr")
++        WaitFor_HDPVR();
++
++    uint idx;
+     uint pix = 0;
++
++    for (idx = 0; idx < 20; ++idx)
++    {
+     if (0 == ioctl(chanfd, VIDIOC_G_FMT, &vfmt))
+     {
+         VERBOSE(VB_RECORD, LOC + QString("Got Resolution %1x%2")
+                 .arg(vfmt.fmt.pix.width).arg(vfmt.fmt.pix.height));
+         pix = vfmt.fmt.pix.width * vfmt.fmt.pix.height;
+-        needs_resolution = false;
++            break;
++        }
++        // Typically takes 0.9 seconds after a resolution change
++        usleep(100 * 1000);
+     }
+ 
+     if (!pix)
++    {
++        VERBOSE(VB_RECORD, LOC + "Giving up detecting resolution");
+         return; // nothing to do, we don't have a resolution yet
++    }
+ 
+     int old_max = maxbitrate, old_avg = bitrate;
+     if (pix <= 768*568)
+@@ -1609,13 +1803,14 @@
+         if (old_max == old_avg)
+         {
+             VERBOSE(VB_RECORD, LOC +
+-                    QString("Old bitrate %1 CBR").arg(old_avg));
++                    QString("Old bitrate %1 CBR for %2x%3")
++                    .arg(old_avg).arg(width).arg(height));
+         }
+         else
+         {
+             VERBOSE(VB_RECORD, LOC +
+-                    QString("Old bitrate %1/%2 VBR")
+-                    .arg(old_avg).arg(old_max));
++                    QString("Old bitrate %1/%2 VBR for %3x%4")
++                    .arg(old_avg).arg(old_max).arg(width).arg(height));
+         }
+ 
+         if (maxbitrate == bitrate)
+@@ -1642,12 +1837,6 @@
+                      maxbitrate * 1000);
+ 
+         set_ctrls(readfd, ext_ctrls);
++
+     }
+-
+-    // Restart streaming. Shouldn't be needed? seems to be with current driver.
+-    QMutexLocker locker(&start_stop_encoding_lock);
+-    StopEncoding(readfd);
+-    StartEncoding(readfd);
+-
+-    needs_resolution = false;
+ }
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/myth.sh b/abs/core-testing/mythtv/trunk/mythtv-svn/myth.sh
new file mode 100755
index 0000000..fb7122c
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/myth.sh
@@ -0,0 +1,4 @@
+export PATH=$PATH:/usr/local/bin
+# set core file size to 0
+ulimit -c 0
+export MALLOC_CHECK_=0
\ No newline at end of file
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/mythbackend b/abs/core-testing/mythtv/trunk/mythtv-svn/mythbackend
new file mode 100755
index 0000000..f96c6b7
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/mythbackend
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/mythbackend`
+case "$1" in
+  start)
+    stat_busy "Starting MythTV Backend"
+    [ ! -e /var/run/mysqld.pid ] && echo -n "mysqld not started" && stat_fail && exit
+    [ -z "$PID" ] && /usr/local/bin/mythbackend -d -l /var/log/mythbackend.log -v quiet
+    if [ $? -gt 0 ]; then
+      stat_fail
+    else
+      echo $PID > /var/run/mythbackend.pid
+      add_daemon mythbackend
+      stat_done
+    fi
+    ;;
+  stop)
+    stat_busy "Stopping MythTV Backend"
+    [ ! -z "$PID" ]  && kill $PID &>/dev/null
+    if [ $? -gt 0 ]; then
+      stat_fail
+    else
+      rm_daemon mythbackend
+      stat_done
+    fi
+    ;;
+  restart)
+    $0 stop
+    $0 start
+    ;;
+  *)
+    echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/mythbackend.sh b/abs/core-testing/mythtv/trunk/mythtv-svn/mythbackend.sh
new file mode 100755
index 0000000..e7a7b70
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/mythbackend.sh
@@ -0,0 +1,117 @@
+#!/bin/bash
+#
+#	/etc/rc.d/init.d/mythbackend
+#
+# Starts the mythbackend as a daemon
+#
+# chkconfig: 345 90 10
+# description: Starts the mythbackend process as a daemon after the XWindows \
+#              system is started, in runlevel 5. This allows scheduled \
+#              recordings to occur without manual intervention.
+# processname: mythbackend
+
+# Copyright (c) by Michael Thomson <linux at m-thomson dot net>
+# With thanks to Stu Tomlinson <stu at nosnilmot dot com>
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+
+# Default values to use if none are supplied in the config file.
+# User who should start the mythbackend processes
+MBE_USER="root"
+# Directory holding the mythbackend binary
+MBE_LOCATION="/usr/local/bin/"
+# Name of mythbackend binary
+MBE_PROG="mythbackend"
+# Full path to mythbackend log file
+MBE_LOGFILE="/var/log/mythtv/mythbackend.log"
+
+# Source function library.
+. /etc/init.d/functions
+
+# Source config file if available
+if [ -f "/etc/sysconfig/mythbackend" ]; then
+  . /etc/sysconfig/mythbackend
+fi
+
+test -x ${MBE_LOCATION}${MBE_PROG} || exit 0
+
+RETVAL=0
+
+#
+#	See how we were called.
+#
+
+start() {
+	# Check if mythbackend is already running
+	if [ ! -f /var/lock/subsys/${MBE_PROG} ]; then
+	    echo -n "Starting ${MBE_PROG}: "
+	    # /usr/local/bin/mythbackend -d -l /some/log/file
+	    #daemon --user ${MBE_USER} ${MBE_LOCATION}${MBE_PROG} -d -l ${MBE_LOGFILE}
+	    ${MBE_LOCATION}${MBE_PROG} -d -l ${MBE_LOGFILE}
+	    RETVAL=$?
+	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/${MBE_PROG}
+	    echo
+	fi
+	return $RETVAL
+}
+
+stop() {
+	echo -n "Stopping ${MBE_PROG}: "
+	killproc ${MBE_LOCATION}${MBE_PROG}
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/${MBE_PROG}
+	echo
+        return $RETVAL
+}
+
+
+restart() {
+	stop
+	start
+}	
+
+reload() {
+	restart
+}	
+
+status_at() {
+ 	status ${MBE_LOCATION}${MBE_PROG}
+}
+
+case "$1" in
+start)
+	start
+	;;
+stop)
+	stop
+	;;
+reload|restart)
+	restart
+	;;
+condrestart)
+	if [ -f /var/lock/subsys/${MBE_PROG} ]; then
+	    restart
+	fi
+	;;
+status)
+	status_at
+	;;
+*)
+	echo "Usage: $0 {start|stop|restart|condrestart|status}"
+	exit 1
+esac
+
+exit $?
+exit $RETVAL
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/mythcommflag-avidemux.2.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/mythcommflag-avidemux.2.patch
new file mode 100644
index 0000000..d26645f
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/mythcommflag-avidemux.2.patch
@@ -0,0 +1,179 @@
+Index: programs/mythcommflag/main.cpp
+===================================================================
+--- programs/mythcommflag/main.cpp	(revision 18596)
++++ programs/mythcommflag/main.cpp	(working copy)
+@@ -300,6 +300,132 @@
+     return COMMFLAG_EXIT_NO_ERROR_WITH_NO_BREAKS;
+ }
+ 
++int GetAviDemux(QString list, QString chanid, QString starttime, const QString &outputfilename)
++{
++    QMap<long long, int> cutlist;
++    QMap<long long, int>::Iterator it;
++    QString result;
++    int startValue = 0;
++    long long myTotalFrames;
++    long long myFrameRate;
++
++    ProgramInfo *pginfo =
++        ProgramInfo::GetProgramFromRecorded(chanid, starttime);
++
++    NuppelVideoPlayer* nvp = new NuppelVideoPlayer("avidemux_export", pginfo);
++
++    myFrameRate = (long long)(nvp->GetFrameRate() * 1000);
++    myTotalFrames = 1000000; //nvp->GetTotalFrameCount();
++
++    if (!pginfo)
++    {
++        VERBOSE(VB_IMPORTANT,
++                QString("No program data exists for channel %1 at %2")
++                .arg(chanid).arg(starttime));
++        return COMMFLAG_BUGGY_EXIT_NO_CHAN_DATA;
++    }
++
++    QString filename = pginfo->GetPlaybackURL(TRUE);
++
++    if (list == "cutlist")
++        pginfo->GetCutList(cutlist);
++    else
++        pginfo->GetCommBreakList(cutlist);
++
++// Formatting of output data
++
++    for (it = cutlist.begin(); it != cutlist.end(); ++it)
++    {
++        if ((it.key() == 0) && (startValue == 0)) // Cutlist starts on first frame,
++            {
++            ++it;
++            startValue = it.key();
++            }
++
++        if ((it.key() != 0) && (startValue == 0)) // Cutlist starts on non-first frame
++            {
++            result += QString("app.addSegment(0,0,%1);").arg(it.key());  
++            startValue = it.key();
++            }
++        else
++           {
++            if  ((*it == MARK_COMM_END) && (startValue != 0) ||
++                (*it == MARK_CUT_END) && (startValue != 0))
++                {
++                 if (result != "")
++                       result += "\n";
++                       startValue = it.key();
++                       result += QString("app.addSegment(0,%1,").arg(it.key()); // Value is a start value
++                }
++            else  
++                {
++                    result += QString("%1);").arg(it.key() - startValue); // Value is an end value
++                }
++           }
++   }
++
++if (it.key() != myTotalFrames)
++    {
++        result += QString("%1);").arg(myTotalFrames);
++    }
++
++// Governs the file output:
++
++    QString tmp = "";
++    ostream *out = &cout;
++
++    if (outputfilename != "-"){
++        QByteArray tmp = outputfilename.toLocal8Bit();
++        out = new fstream(tmp.constData(), ios::app | ios::out );
++        }
++
++    if (outputfilename == ""){
++        VERBOSE(VB_IMPORTANT,
++           QString("Error: AVIDemux output requires the use of the --outputfile option."));
++           return COMMFLAG_EXIT_INVALID_CMDLINE;
++        }
++
++        tmp = QString("//AD  <- Needed to identify//\n"
++                        "//--automatically built--\n"
++                        "//--Project:\n\n"
++                        "var app = new Avidemux();\n\n"
++                        "//** Video **\n"
++                        "// 01 videos source\n" 
++                        "app.load(\"%1\");\n\n"
++                        "app.clearSegments();\n\n"
++                        "%2\n"
++                        "app.markerA=0;\n"
++                        "app.markerB=%3;\n"
++                        "app.rebuildIndex();\n\n"
++                        "//** Postproc **\n"
++                        "app.video.setPostProc(3,3,0);\n\n"
++                        "app.video.setFps1000(%4);\n\n"
++                        "//** Filters **\n\n"
++                        "//** Video Codec conf **\n"
++                        "app.video.codec(\"Copy\",\"CQ=4\",\"0 \");\n\n"
++                        "//** Audio **\n"
++                        "app.audio.reset();\n"
++                        "app.audio.codec(\"copy\",128,0,\"\");\n"
++                        "app.audio.normalizeMode=0;\n"
++                        "app.audio.normalizeValue=0;\n"
++                        "app.audio.delay=0;\n"
++                        "app.audio.mixer(\"NONE\");\n"
++                        "app.setContainer(\"AVI\");\n"
++                        "setSuccess(1);\n"
++                        "//app.Exit();\n\n"
++                        "//End of script\n").arg(filename).arg(result).arg(myTotalFrames).arg(myFrameRate).toLocal8Bit().constData();
++
++        const QByteArray tmp2 = tmp.toLocal8Bit();
++        *out << tmp2.constData() << endl;
++
++        VERBOSE(VB_IMPORTANT,
++                QString("AVIDemux Project generated for %1 at %2 with filename %3.")
++                .arg(chanid).arg(starttime).arg(outputfilename));
++
++    return COMMFLAG_EXIT_NO_ERROR_WITH_NO_BREAKS;
++}
++
++
+ void streamOutCommercialBreakList(
+     ostream &output, const QMap<long long, int> &commercialBreakList)
+ {
+@@ -811,6 +937,8 @@
+     bool clearCutlist = false;
+     bool getCutlist = false;
+     bool getSkipList = false;
++    bool getAviDemuxCutlist = false;
++    bool getAviDemuxSkiplist = false;
+     QString newCutList = QString::null;
+     QMap<QString, QString> settingsOverride;
+ 
+@@ -960,6 +1088,10 @@
+             getCutlist = true;
+         else if (!strcmp(a.argv()[argpos], "--getskiplist"))
+             getSkipList = true;
++        else if (!strcmp(a.argv()[argpos], "--getcutlist-avidemux"))
++            getAviDemuxCutlist = true;
++        else if (!strcmp(a.argv()[argpos], "--getskiplist-avidemux"))
++            getAviDemuxSkiplist = true;
+         else if (!strcmp(a.argv()[argpos], "--setcutlist"))
+             newCutList = (a.argv()[++argpos]);
+         else if (!strcmp(a.argv()[argpos], "-j"))
+@@ -1111,6 +1243,8 @@
+                     "                             #-#[,#-#]...  (ie, 1-100,1520-3012,4091-5094\n"
+                     "--getcutlist                 Display the current cutlist\n"
+                     "--getskiplist                Display the current Commercial Skip list\n"
++                    "--getcutlist-avidemux        Export cutlist as AVIDemux Project File\n"
++                    "--getskiplist-avidemux       Export skiplist as AVIDemux Project File\n"
+                     "-v or --verbose debug-level  Use '-v help' for level info\n"
+                     "--queue                      Insert flagging job into the JobQueue rather than\n"
+                     "                             running flagging in the foreground\n"
+@@ -1223,6 +1357,12 @@
+     if (!newCutList.isNull())
+         return SetCutList(chanid, starttime, newCutList);
+ 
++    if (getAviDemuxCutlist)
++        return GetAviDemux("cutlist", chanid, starttime, outputfilename);
++
++    if (getAviDemuxSkiplist)
++        return GetAviDemux("commflag", chanid, starttime, outputfilename);
++
+     if (getCutlist)
+         return GetMarkupList("cutlist", chanid, starttime);
+ 
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/mythtv.install b/abs/core-testing/mythtv/trunk/mythtv-svn/mythtv.install
new file mode 100755
index 0000000..513852a
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/mythtv.install
@@ -0,0 +1,55 @@
+
+# arg 1:  the new package version
+pre_install () {
+        echo "backing up the database"
+                dbver=`pacman -Q mythtv-svn | awk  ' { print $2 } '`
+        if [ ! -e /data/databases_backup ]
+        then
+                mkdir -p /data/database_backup
+        fi
+        mysqldump -u mythtv -pmythtv mythconverg -c > /data/database_backup/${dbver}.dump.sql
+}
+
+post_install() {
+  	mkdir -p /data/home
+        /usr/sbin/useradd -G users,video,audio,optical -m -d /data/home/mythtv mythtv
+        /usr/sbin/usermod -G users,video,audio,optical mythtv
+#        mkdir /var/log/mythtv
+#        chown -R mythtv:users /var/log/mythtv
+        dbver=`pacman -Q mythtv-svn | awk  ' { print $2 } '`
+        if [ ! -e /data/database_backup ]
+        then
+                mkdir -p /data/database_backup
+        fi
+	chown mythtv:nobody /data/database_backup
+	chmod g+s  /data/database_backup
+        
+	mysqldump -u mythtv -pmythtv mythconverg -c > /data/database_backup/${dbver}.dump.sql
+
+
+}
+pre_upgrade () {
+ pre_install
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+post_upgrade() {
+  post_install
+
+  /bin/true
+}
+
+# arg 1:  the old package version
+pre_remove() {
+  /bin/true
+}
+
+# arg 1:  the old package version
+post_remove() {
+/bint/true
+}
+
+op=$1
+shift
+$op $*
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/patches/DeviceReadBuffer-polltimeout.2.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/patches/DeviceReadBuffer-polltimeout.2.patch
new file mode 100644
index 0000000..5bb713f
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/patches/DeviceReadBuffer-polltimeout.2.patch
@@ -0,0 +1,219 @@
+Index: libs/libmythtv/DeviceReadBuffer.h
+===================================================================
+--- libs/libmythtv/DeviceReadBuffer.h	(revision 18515)
++++ libs/libmythtv/DeviceReadBuffer.h	(working copy)
+@@ -59,7 +59,7 @@
+     void IncrReadPointer(uint len);
+ 
+     bool HandlePausing(void);
+-    bool Poll(void) const;
++    bool Poll(void);
+     uint WaitForUnused(uint bytes_needed) const;
+     uint WaitForUsed  (uint bytes_needed) const;
+ 
+Index: libs/libmythtv/DeviceReadBuffer.cpp
+===================================================================
+--- libs/libmythtv/DeviceReadBuffer.cpp	(revision 18515)
++++ libs/libmythtv/DeviceReadBuffer.cpp	(working copy)
+@@ -90,9 +90,14 @@
+ 
+ void DeviceReadBuffer::Start(void)
+ {
+-    lock.lock();
+-    bool was_running = running;
+-    lock.unlock();
++    bool was_running;
++
++    {
++        QMutexLocker locker(&lock);
++        was_running = running;
++        error = false;
++    }
++
+     if (was_running)
+     {
+         VERBOSE(VB_IMPORTANT, LOC_ERR + "Start(): Already running.");
+@@ -104,6 +109,8 @@
+     {
+         VERBOSE(VB_IMPORTANT,
+                 LOC_ERR + QString("Start(): pthread_create failed.") + ENO);
++
++        QMutexLocker locker(&lock);
+         error = true;
+     }
+ }
+@@ -118,21 +125,25 @@
+     used          = 0;
+     readPtr       = buffer;
+     writePtr      = buffer;
++
++    error         = false;
+ }
+ 
+ void DeviceReadBuffer::Stop(void)
+ {
+     bool was_running = IsRunning();
+-    lock.lock();
+-    run = false;
+-    lock.unlock();
+ 
+     if (!was_running)
+     {
+-        VERBOSE(VB_IMPORTANT, LOC_ERR + "Stop(): Not running.");
++        VERBOSE(VB_IMPORTANT, LOC + "Stop(): Not running.");
+         return;
+     }
+ 
++    {
++        QMutexLocker locker(&lock);
++        run = false;
++    }
++
+     pthread_join(thread, NULL);
+ }
+ 
+@@ -229,10 +240,11 @@
+ {
+     uint      errcnt = 0;
+ 
+-    lock.lock();
+-    run     = true;
+-    running = true;
+-    lock.unlock();
++    {
++        QMutexLocker locker(&lock);
++        run     = true;
++        running = true;
++    }
+ 
+     while (run)
+     {
+@@ -248,6 +260,15 @@
+         if (using_poll && !Poll())
+             continue;
+ 
++        {
++            QMutexLocker locker(&lock);
++            if (error)
++            {
++                VERBOSE(VB_RECORD, LOC + "fill_ringbuffer: error state");
++                break;
++            }
++        }
++
+         // Limit read size for faster return from read
+         size_t read_size =
+             min(dev_read_size, (size_t) WaitForUnused(TSPacket::SIZE));
+@@ -268,9 +289,10 @@
+         }
+     }
+ 
+-    lock.lock();
+-    running = false;
+-    lock.unlock();
++    {
++        QMutexLocker locker(&lock);
++        running = false;
++    }
+ }
+ 
+ bool DeviceReadBuffer::HandlePausing(void)
+@@ -293,7 +315,7 @@
+     return true;
+ }
+ 
+-bool DeviceReadBuffer::Poll(void) const
++bool DeviceReadBuffer::Poll(void)
+ {
+ #ifdef USING_MINGW
+ #warning mingw DeviceReadBuffer::Poll
+@@ -302,31 +324,53 @@
+     return false;
+ #else
+     bool retval = true;
+-    while (true)
++    uint timeout_cnt = 0;
++
++    for (;;)
+     {
+         struct pollfd polls;
+         polls.fd      = _stream_fd;
+         polls.events  = POLLIN;
+         polls.revents = 0;
+ 
+-        int ret = poll(&polls, 1 /*number of polls*/, 10 /*msec*/);
+-        if (IsPauseRequested() || !IsOpen() || !run)
++        int ret = poll(&polls, 1 /*number of polls*/, 250 /*msec*/);
++
++        if (polls.revents & (POLLERR | POLLHUP | POLLNVAL))
+         {
++            VERBOSE(VB_IMPORTANT, LOC + "poll error");
++            error = true;
++            return true;
++        }
++
++        if (!run || !IsOpen() || IsPauseRequested())
++        {
+             retval = false;
+             break; // are we supposed to pause, stop, etc.
+         }
+ 
+         if (ret > 0)
+             break; // we have data to read :)
+-        if ((-1 == ret) && (EOVERFLOW == errno))
+-            break; // we have an error to handle
+-
+-        if ((-1 == ret) && ((EAGAIN == errno) || (EINTR  == errno)))
+-            continue; // errors that tell you to try again
+-        if (ret == 0)
+-            continue; // timed out, try again
+-
+-        usleep(2500);
++        if (ret < 0)
++        {
++            if ((EOVERFLOW == errno))
++                break; // we have an error to handle
++            if ((EAGAIN == errno) || (EINTR  == errno))
++                continue; // errors that tell you to try again
++            usleep(2500);
++        }
++        else //  ret == 0
++        {
++            if (++timeout_cnt > 9)
++            {
++                VERBOSE(VB_RECORD, LOC_ERR + "Poll giving up");
++                QMutexLocker locker(&lock);
++                error = true;
++                return true;
++            }
++            if (timeout_cnt % 2)
++                VERBOSE(VB_RECORD, LOC_ERR + QString("Poll timeout (%1)")
++                        .arg(timeout_cnt));
++        }
+     }
+     return retval;
+ #endif //!USING_MINGW
+@@ -360,9 +404,9 @@
+ 
+         if (++errcnt > 5)
+         {
+-            lock.lock();
++            QMutexLocker locker(&lock);
++            VERBOSE(VB_RECORD, LOC + "Too many errors.");
+             error = true;
+-            lock.unlock();
+             return false;
+         }
+ 
+@@ -376,10 +420,8 @@
+             VERBOSE(VB_IMPORTANT, LOC +
+                     QString("End-Of-File? fd(%1)").arg(_stream_fd));
+ 
+-            lock.lock();
++            QMutexLocker locker(&lock);
+             eof = true;
+-            lock.unlock();
+-
+             return false;
+         }
+         usleep(500);
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/patches/aacdecoder.cpp.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/patches/aacdecoder.cpp.patch
new file mode 100644
index 0000000..8796eb4
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/patches/aacdecoder.cpp.patch
@@ -0,0 +1,12 @@
+--- mythmusic/mythmusic/aacdecoder.cpp.orig	2008-11-19 12:51:48.000000000 -0500
++++ mythmusic/mythmusic/aacdecoder.cpp	2008-11-19 12:52:42.000000000 -0500
+@@ -17,6 +17,9 @@
+ #define FAAD_MODIFIED
+ #endif
+ 
++// LinHES need this undefined
++#undef FAAD_MODIFIED
++
+ // ANSI C headers
+ #include <cstdlib>
+ 
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/patches/hdpvr-v4lchannel-tweak.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/patches/hdpvr-v4lchannel-tweak.patch
new file mode 100644
index 0000000..3535310
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/patches/hdpvr-v4lchannel-tweak.patch
@@ -0,0 +1,139 @@
+Index: libs/libmythtv/v4lchannel.h
+===================================================================
+--- libs/libmythtv/v4lchannel.h	(revision 18874)
++++ libs/libmythtv/v4lchannel.h	(working copy)
+@@ -103,6 +103,8 @@
+     VidModV4L2  videomode_v4l2; ///< Current video mode if 'usingv4l2' is true
+ 
+     int         defaultFreqTable;
++    int         prev_inputNumV4L;
++    v4l2_std_id prev_vid_mode;
+ };
+ 
+ #endif
+Index: libs/libmythtv/v4lchannel.cpp
+===================================================================
+--- libs/libmythtv/v4lchannel.cpp	(revision 18874)
++++ libs/libmythtv/v4lchannel.cpp	(working copy)
+@@ -40,7 +40,8 @@
+       device_name(QString::null),   driver_name(QString::null),
+       curList(NULL),                totalChannels(0),
+       currentFormat(""),            is_dtv(false),
+-      usingv4l2(false),             defaultFreqTable(1)
++      usingv4l2(false),             defaultFreqTable(1),
++      prev_inputNumV4L(-1),         prev_vid_mode(-1)
+ {
+ }
+ 
+@@ -795,62 +796,75 @@
+     {
+         VERBOSE(VB_CHANNEL, LOC + msg + "(v4l v2)");
+ 
+-        int ioctlval = ioctl(videofd, VIDIOC_S_INPUT, &inputNumV4L);
++	int ioctlval;
++	bool streamingDisabled = false;
++	int  streamType = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ 
+-        // ConvertX (wis-go7007) requires streaming to be disabled
+-        // before an input switch, do this if initial switch failed.
+-        bool streamingDisabled = false;
+-        int  streamType = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+-        if ((ioctlval < 0) && (errno == EBUSY))
++        if (prev_inputNumV4L != inputNumV4L)
+         {
+-            ioctlval = ioctl(videofd, VIDIOC_STREAMOFF, &streamType);
++            ioctlval = ioctl(videofd, VIDIOC_S_INPUT, &inputNumV4L);
++
++            // ConvertX (wis-go7007) requires streaming to be disabled
++            // before an input switch, do this if initial switch failed.
++            if ((ioctlval < 0) && (errno == EBUSY))
++            {
++                ioctlval = ioctl(videofd, VIDIOC_STREAMOFF, &streamType);
++                if (ioctlval < 0)
++                {
++                    VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
++                            "\n\t\t\twhile disabling streaming (v4l v2)" + ENO);
++
++                    ok = false;
++                    ioctlval = 0;
++                }
++                else
++                {
++                    streamingDisabled = true;
++
++                    // Resend the input switch ioctl.
++                    ioctlval = ioctl(videofd, VIDIOC_S_INPUT, &inputNumV4L);
++                }
++            }
++
+             if (ioctlval < 0)
+             {
+                 VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
+-                        "\n\t\t\twhile disabling streaming (v4l v2)" + ENO);
++                        "\n\t\t\twhile setting input (v4l v2)" + ENO);
+ 
+                 ok = false;
+-                ioctlval = 0;
+             }
+-            else
+-            {
+-                streamingDisabled = true;
+ 
+-                // Resend the input switch ioctl.
+-                ioctlval = ioctl(videofd, VIDIOC_S_INPUT, &inputNumV4L);
+-            }
++            prev_inputNumV4L = inputNumV4L;
+         }
+ 
+-        if (ioctlval < 0)
+-        {
+-            VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
+-                    "\n\t\t\twhile setting input (v4l v2)" + ENO);
+-
+-            ok = false;
+-        }
+-
+         v4l2_std_id vid_mode = format_to_mode(newFmt, 2);
+-        ioctlval = ioctl(videofd, VIDIOC_S_STD, &vid_mode);
+-        if (ioctlval < 0)
+-        {
+-            VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
+-                    "\n\t\t\twhile setting format (v4l v2)" + ENO);
+ 
+-            ok = false;
+-        }
+-
+-        // ConvertX (wis-go7007) requires streaming to be disabled
+-        // before an input switch, here we try to re-enable streaming.
+-        if (streamingDisabled)
++        if (prev_vid_mode != vid_mode)
+         {
+-            ioctlval = ioctl(videofd, VIDIOC_STREAMON, &streamType);
++            ioctlval = ioctl(videofd, VIDIOC_S_STD, &vid_mode);
+             if (ioctlval < 0)
+             {
+                 VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
+-                        "\n\t\t\twhile reenabling streaming (v4l v2)" + ENO);
++                        "\n\t\t\twhile setting format (v4l v2)" + ENO);
+ 
+                 ok = false;
+             }
++
++            // ConvertX (wis-go7007) requires streaming to be disabled
++            // before an input switch, here we try to re-enable streaming.
++            if (streamingDisabled)
++            {
++                ioctlval = ioctl(videofd, VIDIOC_STREAMON, &streamType);
++                if (ioctlval < 0)
++                {
++                    VERBOSE(VB_IMPORTANT, LOC_ERR + msg +
++                            "\n\t\t\twhile reenabling streaming (v4l v2)" +
++                            ENO);
++
++                    ok = false;
++                }
++            }
++            prev_vid_mode = vid_mode;
+         }
+     }
+ 
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/patches/mpegrecorder-hdpvr-v1.1.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/patches/mpegrecorder-hdpvr-v1.1.patch
new file mode 100644
index 0000000..f292b7f
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/patches/mpegrecorder-hdpvr-v1.1.patch
@@ -0,0 +1,658 @@
+Index: libs/libmythtv/mpegrecorder.h
+===================================================================
+--- libs/libmythtv/mpegrecorder.h	(revision 19056)
++++ libs/libmythtv/mpegrecorder.h	(working copy)
+@@ -80,11 +80,13 @@
+     uint GetFilteredAudioLayer(void) const;
+     uint GetFilteredAudioBitRate(uint audio_layer) const;
+ 
++    void RestartEncoding(void);
+     bool StartEncoding(int fd);
+     bool StopEncoding(int fd);
+ 
+     void ResetForNewFile(void);
+ 
++    bool WaitFor_HDPVR(void);
+     void HandleResolutionChanges(void);
+ 
+     inline bool CheckCC(uint pid, uint cc);
+@@ -104,7 +106,6 @@
+     // State
+     bool recording;
+     bool encoding;
+-    bool needs_resolution;
+     mutable QMutex start_stop_encoding_lock;
+     QMutex recording_wait_lock;
+     QWaitCondition recording_wait;
+@@ -113,7 +114,7 @@
+     bool cleartimeonpause;
+ 
+     // Encoding info
+-    int width, height;
++    uint width, height;
+     int bitrate, maxbitrate, streamtype, aspectratio;
+     int audtype, audsamplerate, audbitratel1, audbitratel2, audbitratel3;
+     int audvolume;
+Index: libs/libmythtv/mpegrecorder.cpp
+===================================================================
+--- libs/libmythtv/mpegrecorder.cpp	(revision 19056)
++++ libs/libmythtv/mpegrecorder.cpp	(working copy)
+@@ -19,6 +19,7 @@
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
+ #include <sys/time.h>
++#include <sys/poll.h>
+ 
+ // avlib headers
+ extern "C" {
+@@ -86,7 +87,7 @@
+     requires_special_pause(false),
+     // State
+     recording(false),         encoding(false),
+-    needs_resolution(false),  start_stop_encoding_lock(QMutex::Recursive),
++    start_stop_encoding_lock(QMutex::Recursive),
+     recording_wait_lock(),    recording_wait(),
+     // Pausing state
+     cleartimeonpause(false),
+@@ -487,13 +488,21 @@
+ 
+ bool MpegRecorder::SetFormat(int chanfd)
+ {
++    uint   idx;
+     struct v4l2_format vfmt;
+     bzero(&vfmt, sizeof(vfmt));
+ 
+     vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ 
+-    if (ioctl(chanfd, VIDIOC_G_FMT, &vfmt) < 0)
++    for (idx = 0; idx < 20; ++idx)
+     {
++        if (ioctl(chanfd, VIDIOC_G_FMT, &vfmt) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 10)
++    {
+         VERBOSE(VB_IMPORTANT, LOC_ERR + "Error getting format" + ENO);
+         return false;
+     }
+@@ -501,8 +510,15 @@
+     vfmt.fmt.pix.width = width;
+     vfmt.fmt.pix.height = height;
+ 
+-    if (ioctl(chanfd, VIDIOC_S_FMT, &vfmt) < 0)
++    for (idx = 0; idx < 20; ++idx)
+     {
++        if (ioctl(chanfd, VIDIOC_S_FMT, &vfmt) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 20)
++    {
+         VERBOSE(VB_IMPORTANT, LOC_ERR + "Error setting format" + ENO);
+         return false;
+     }
+@@ -513,10 +529,19 @@
+ /// Set audio language mode
+ bool MpegRecorder::SetLanguageMode(int chanfd)
+ {
++    uint   idx;
+     struct v4l2_tuner vt;
+     bzero(&vt, sizeof(struct v4l2_tuner));
+-    if (ioctl(chanfd, VIDIOC_G_TUNER, &vt) < 0)
++
++    for (idx = 0; idx < 20; ++idx)
+     {
++        if (ioctl(chanfd, VIDIOC_G_TUNER, &vt) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 20)
++    {
+         VERBOSE(VB_IMPORTANT, LOC_WARN + "Unable to get audio mode" + ENO);
+         return false;
+     }
+@@ -549,8 +574,15 @@
+         success = false;
+     }
+ 
+-    if (ioctl(chanfd, VIDIOC_S_TUNER, &vt) < 0)
++    for (idx = 0; idx < 20; ++idx)
+     {
++        if (ioctl(chanfd, VIDIOC_S_TUNER, &vt) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 20)
++    {
+         VERBOSE(VB_IMPORTANT, LOC_WARN + "Unable to set audio mode" + ENO);
+         success = false;
+     }
+@@ -561,10 +593,19 @@
+ bool MpegRecorder::SetRecordingVolume(int chanfd)
+ {
+     // Get volume min/max values
++    uint   idx;
+     struct v4l2_queryctrl qctrl;
+     qctrl.id = V4L2_CID_AUDIO_VOLUME;
+-    if (ioctl(chanfd, VIDIOC_QUERYCTRL, &qctrl) < 0)
++
++    for (idx = 0; idx < 20; ++idx)
+     {
++        if (ioctl(chanfd, VIDIOC_QUERYCTRL, &qctrl) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 20)
++    {
+         VERBOSE(VB_IMPORTANT, LOC_WARN +
+                 "Unable to get recording volume parameters(max/min)" + ENO +
+                 "\n\t\t\tusing default range [0,65535].");
+@@ -582,8 +623,15 @@
+     ctrl.id = V4L2_CID_AUDIO_VOLUME;
+     ctrl.value = ctrl_volume;
+ 
+-    if (ioctl(chanfd, VIDIOC_S_CTRL, &ctrl) < 0)
++    for (idx = 0; idx < 20; ++idx)
+     {
++        if (ioctl(chanfd, VIDIOC_S_CTRL, &ctrl) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 20)
++    {
+         VERBOSE(VB_IMPORTANT, LOC_WARN +
+                 "Unable to set recording volume" + ENO + "\n\t\t\t" +
+                 "If you are using an AverMedia M179 card this is normal.");
+@@ -765,6 +813,7 @@
+ 
+     for (uint i = 0; i < ext_ctrls.size(); i++)
+     {
++        uint   idx;
+         struct v4l2_ext_controls ctrls;
+         bzero(&ctrls, sizeof(struct v4l2_ext_controls));
+ 
+@@ -774,8 +823,15 @@
+         ctrls.count       = 1;
+         ctrls.controls    = &ext_ctrls[i];
+             
+-        if (ioctl(fd, VIDIOC_S_EXT_CTRLS, &ctrls) < 0)
++        for (idx = 0; idx < 20; ++idx)
+         {
++            if (ioctl(fd, VIDIOC_S_EXT_CTRLS, &ctrls) == 0)
++                break;
++            usleep(100 * 1000);
++        }
++
++        if (idx == 20)
++        {
+             QMutexLocker locker(&control_description_lock);
+             VERBOSE(VB_IMPORTANT, QString("mpegrecorder.cpp:set_ctrls(): ") +
+                     QString("Could not set %1 to %2")
+@@ -814,6 +870,30 @@
+     {
+         maxbitrate = high_mpeg4peakbitrate;
+         bitrate    = high_mpeg4avgbitrate;
++
++        // query supported audio codecs and prefer AC3
++        uint   idx;
++        struct v4l2_queryctrl qctrl;
++        qctrl.id = V4L2_CID_MPEG_AUDIO_ENCODING;
++
++        for (idx = 0; idx < 20; ++idx)
++        {
++            if (ioctl(chanfd, VIDIOC_QUERYCTRL, &qctrl) == 0)
++                break;
++            usleep(100 * 1000);
++        }
++
++        if (idx == 20)
++        {
++            VERBOSE(VB_IMPORTANT, LOC_WARN +
++                    "Unable to get supported audio codecs." + ENO);
++        }
++        else
++        {
++            if (qctrl.minimum != qctrl.maximum)
++                add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_AUDIO_ENCODING,
++                             qctrl.maximum);
++        }
+     }
+     maxbitrate = std::max(maxbitrate, bitrate);
+ 
+@@ -837,19 +917,36 @@
+     int audioinput = audiodevice.toUInt(&ok);
+     if (ok)
+     {
++        uint   idx;
+         struct v4l2_audio ain;
+         bzero(&ain, sizeof(ain));
+         ain.index = audioinput;
+-        if (ioctl(chanfd, VIDIOC_ENUMAUDIO, &ain) < 0)
++
++        for (idx = 0; idx < 20; ++idx)
+         {
++            if (ioctl(chanfd, VIDIOC_ENUMAUDIO, &ain) == 0)
++                break;
++            usleep(100 * 1000);
++        }
++
++        if (idx == 20)
++        {
+             VERBOSE(VB_IMPORTANT, LOC_WARN +
+                     "Unable to get audio input.");
+         }
+         else
+         {
+             ain.index = audioinput;
+-            if (ioctl(chanfd, VIDIOC_S_AUDIO, &ain) < 0)
++
++            for (idx = 0; idx < 20; ++idx)
+             {
++                if (ioctl(chanfd, VIDIOC_S_AUDIO, &ain) == 0)
++                    break;
++                usleep(100 * 1000);
++            }
++
++            if (idx == 20)
++            {
+                 VERBOSE(VB_IMPORTANT, LOC_WARN +
+                         "Unable to set audio input.");
+             }
+@@ -1036,17 +1133,26 @@
+     if (deviceIsMpegFile)
+         elapsedTimer.start();
+     else if (_device_read_buffer)
+-        _device_read_buffer->Start();
++    {
++        VERBOSE(VB_RECORD, LOC + "Initial startup of recorder");
+ 
+-    needs_resolution = (driver == "hdpvr");
++        if (StartEncoding(readfd))
++            _device_read_buffer->Start();
++        else
++        {
++            VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to start recording");
++            recording = false;
++            QMutexLocker locker(&recording_wait_lock);
++            recording_wait.wakeAll();
++            _error = true;
++        }
++    }
+ 
+     QByteArray vdevice = videodevice.toAscii();
+     while (encoding && !_error)
+     {
+         if (PauseAndWait(100))
+             continue;
+-
+-        HandleResolutionChanges();
+         
+         if (deviceIsMpegFile)
+         {
+@@ -1090,35 +1196,7 @@
+             {
+                 VERBOSE(VB_IMPORTANT, LOC_ERR + "Device error detected");
+ 
+-                _device_read_buffer->Stop();
+-
+-                QMutexLocker locker(&start_stop_encoding_lock);
+-
+-                StopEncoding(readfd);
+-
+-                // Make sure the next things in the file are a PAT & PMT
+-                if (_stream_data->PATSingleProgram() &&
+-                    _stream_data->PMTSingleProgram())
+-                {
+-                    bool tmp = _wait_for_keyframe_option;
+-                    _wait_for_keyframe_option = false;
+-                    HandleSingleProgramPAT(_stream_data->PATSingleProgram());
+-                    HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
+-                    _wait_for_keyframe_option = tmp;
+-                }
+-
+-                if (StartEncoding(readfd))
+-                {
+-                    _device_read_buffer->Start();
+-                }
+-                else
+-                {
+-                    if (0 != close(readfd))
+-                        VERBOSE(VB_IMPORTANT, LOC_ERR + "Close error" + ENO);
+-                    
+-                    // Force card to be reopened on next iteration..
+-                    readfd = -1;
+-                }
++                RestartEncoding();
+             }
+             else if (_device_read_buffer->IsEOF())
+             {
+@@ -1216,6 +1294,8 @@
+         }
+     }
+ 
++    VERBOSE(VB_RECORD, LOC + "StartRecording finishing up");
++
+     if (_device_read_buffer)
+     {
+         if (_device_read_buffer->IsRunning())
+@@ -1224,6 +1304,7 @@
+         delete _device_read_buffer;
+         _device_read_buffer = NULL;
+     }
++
+     StopEncoding(readfd);
+ 
+     FinishRecording();
+@@ -1373,52 +1454,95 @@
+ 
+         if (!paused)
+         {
++            VERBOSE(VB_RECORD, LOC + "PauseAndWait pause");
++
++            // Some drivers require streaming to be disabled before
++            // an input switch and other channel format setting.
++            if (requires_special_pause)
++                StopEncoding(readfd);
++
+             if (_device_read_buffer)
+             {
+                 QMutex drb_lock;
+                 drb_lock.lock();
+-
+                 _device_read_buffer->SetRequestPause(true);
+-
+                 pauseWait.wait(&drb_lock, timeout);
+             }
+             else
+-            {
+-                paused = true;
+                 pauseWait.wakeAll();
+-            }
+ 
+-            // Some drivers require streaming to be disabled before
+-            // an input switch and other channel format setting.
+-            if (requires_special_pause)
+-                StopEncoding(readfd);
+-
++            paused = true;
+             if (tvrec)
+                 tvrec->RecorderPaused();
+         }
+ 
+         unpauseWait.wait(&waitlock, timeout);
+     }
+-    if (!request_pause)
++
++    if (!request_pause && paused)
+     {
+-        if (paused)
++        VERBOSE(VB_RECORD, LOC + "PauseAndWait unpause");
++
++        if (driver == "hdpvr")
+         {
+-            // Some drivers require streaming to be disabled before
+-            // an input switch and other channel format setting.
+-            if (requires_special_pause)
+-                StartEncoding(readfd);
++            m_h264_parser.Reset();
++            _wait_for_keyframe_option = true;
++            _seen_sps = false;
+ 
+-            if (_device_read_buffer)
+-                _device_read_buffer->SetRequestPause(false);
++            // Sleep any less than 1.5 seconds, and the HD-PVR will
++            // return the old resolution, when the resolution is changing.
++            usleep(1500 * 1000);
++        }
+ 
+-            if (_stream_data)
+-                _stream_data->Reset(_stream_data->DesiredProgram());
+-        }
++        // Some drivers require streaming to be disabled before
++        // an input switch and other channel format setting.
++        if (requires_special_pause)
++            StartEncoding(readfd);
++        
++        if (_device_read_buffer)
++            _device_read_buffer->SetRequestPause(false);
++        
++        if (_stream_data)
++            _stream_data->Reset(_stream_data->DesiredProgram());
++
+         paused = false;
+     }
++
+     return paused;
+ }
+ 
++void MpegRecorder::RestartEncoding(void)
++{
++    VERBOSE(VB_RECORD, LOC + "RestartEncoding");
++
++    _device_read_buffer->Stop();
++    
++    QMutexLocker locker(&start_stop_encoding_lock);
++    
++    StopEncoding(readfd);
++    
++    // Make sure the next things in the file are a PAT & PMT
++    if (_stream_data->PATSingleProgram() &&
++        _stream_data->PMTSingleProgram())
++    {
++        _wait_for_keyframe_option = false;
++        HandleSingleProgramPAT(_stream_data->PATSingleProgram());
++        HandleSingleProgramPMT(_stream_data->PMTSingleProgram());
++    }
++    
++    if (StartEncoding(readfd))
++    {
++        _device_read_buffer->Start();
++    }
++    else
++    {
++        if (0 != close(readfd))
++            VERBOSE(VB_IMPORTANT, LOC_ERR + "Close error" + ENO);
++        
++        readfd = -1;
++    }
++}
++
+ bool MpegRecorder::StartEncoding(int fd)
+ {
+     QMutexLocker locker(&start_stop_encoding_lock);
+@@ -1427,13 +1551,22 @@
+     memset(&command, 0, sizeof(struct v4l2_encoder_cmd));
+     command.cmd = V4L2_ENC_CMD_START;
+ 
++    if (driver == "hdpvr")
++        HandleResolutionChanges();
++
+     VERBOSE(VB_RECORD, LOC + "StartEncoding");
+-    needs_resolution = (driver == "hdpvr");
+ 
+-    for (int idx = 0; idx < 10; ++idx)
++    for (int idx = 0; idx < 20; ++idx)
+     {
+         if (ioctl(fd, VIDIOC_ENCODER_CMD, &command) == 0)
+         {
++            if (driver == "hdpvr")
++            {
++                m_h264_parser.Reset();
++                _wait_for_keyframe_option = true;
++                _seen_sps = false;
++            }
++
+             VERBOSE(VB_RECORD, LOC + "Encoding started");
+             return true;
+         }
+@@ -1444,7 +1577,7 @@
+             return false;
+         }
+ 
+-        usleep(250 * 1000);
++        usleep(100 * 1000);
+     }
+ 
+     VERBOSE(VB_IMPORTANT, LOC_ERR + "StartEncoding - giving up" + ENO);
+@@ -1461,9 +1594,8 @@
+ 
+     VERBOSE(VB_RECORD, LOC + "StopEncoding");
+ 
+-    for (int idx = 0; idx < 10; ++idx)
++    for (int idx = 0; idx < 20; ++idx)
+     {
+-
+         if (ioctl(fd, VIDIOC_ENCODER_CMD, &command) == 0)
+         {
+             VERBOSE(VB_RECORD, LOC + "Encoding stopped");
+@@ -1476,7 +1608,7 @@
+             return false;
+         }
+ 
+-        usleep(250 * 1000);
++        usleep(100 * 1000);
+     }
+ 
+     VERBOSE(VB_IMPORTANT, LOC_ERR + "StopEncoding - giving up" + ENO);
+@@ -1544,7 +1676,7 @@
+ void MpegRecorder::HandleSingleProgramPMT(ProgramMapTable *pmt)
+ {
+     if (!pmt)
+-{
++    {
+         return;
+     }
+ 
+@@ -1564,27 +1696,89 @@
+         DTVRecorder::BufferedWrite(*(reinterpret_cast<TSPacket*>(&buf[i])));
+ }
+ 
++bool MpegRecorder::WaitFor_HDPVR(void)
++{
++    // After a resolution change, it can take the HD-PVR a few
++    // seconds before it is usable again.
++
++    // Tell it to start encoding, then wait for it to actually feed us
++    // some data.
++    QMutexLocker locker(&start_stop_encoding_lock);
++
++    struct v4l2_encoder_cmd command;
++    struct pollfd polls;
++    int    idx;
++
++    memset(&command, 0, sizeof(struct v4l2_encoder_cmd));
++    command.cmd = V4L2_ENC_CMD_START;
++
++    for (idx = 0; idx < 20; ++idx)
++    {
++        if (ioctl(readfd, VIDIOC_ENCODER_CMD, &command) == 0)
++            break;
++        usleep(100 * 1000);
++    }
++
++    if (idx == 20)
++        return false;
++
++    polls.fd      = readfd;
++    polls.events  = POLLIN;
++    polls.revents = 0;
++
++    for (idx = 0; idx < 10; ++idx)
++    {
++        if (poll(&polls, 1, 250) > 0)
++            break;
++    }
++
++    if (idx == 10)
++        return false;
++
++    // HD-PVR should now be "ready"
++    command.cmd = V4L2_ENC_CMD_STOP;
++
++    for (idx = 0; idx < 20; ++idx)
++    {
++        if (ioctl(readfd, VIDIOC_ENCODER_CMD, &command) == 0)
++            return true;
++        usleep(100 * 1000);
++    }
++
++    return false;
++}
++
+ void MpegRecorder::HandleResolutionChanges(void)
+ {
+-    if (!needs_resolution)
+-        return;
+-
+     VERBOSE(VB_RECORD, LOC + "Checking Resolution");
+     struct v4l2_format vfmt;
+     memset(&vfmt, 0, sizeof(vfmt));
+     vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+             
++    if (driver == "hdpvr")
++        WaitFor_HDPVR();
++
++    uint idx;
+     uint pix = 0;
++
++    for (idx = 0; idx < 20; ++idx)
++    {
+     if (0 == ioctl(chanfd, VIDIOC_G_FMT, &vfmt))
+     {
+         VERBOSE(VB_RECORD, LOC + QString("Got Resolution %1x%2")
+                 .arg(vfmt.fmt.pix.width).arg(vfmt.fmt.pix.height));
+         pix = vfmt.fmt.pix.width * vfmt.fmt.pix.height;
+-        needs_resolution = false;
++            break;
++        }
++        // Typically takes 0.9 seconds after a resolution change
++        usleep(100 * 1000);
+     }
+ 
+     if (!pix)
++    {
++        VERBOSE(VB_RECORD, LOC + "Giving up detecting resolution");
+         return; // nothing to do, we don't have a resolution yet
++    }
+ 
+     int old_max = maxbitrate, old_avg = bitrate;
+     if (pix <= 768*568)
+@@ -1609,13 +1803,14 @@
+         if (old_max == old_avg)
+         {
+             VERBOSE(VB_RECORD, LOC +
+-                    QString("Old bitrate %1 CBR").arg(old_avg));
++                    QString("Old bitrate %1 CBR for %2x%3")
++                    .arg(old_avg).arg(width).arg(height));
+         }
+         else
+         {
+             VERBOSE(VB_RECORD, LOC +
+-                    QString("Old bitrate %1/%2 VBR")
+-                    .arg(old_avg).arg(old_max));
++                    QString("Old bitrate %1/%2 VBR for %3x%4")
++                    .arg(old_avg).arg(old_max).arg(width).arg(height));
+         }
+ 
+         if (maxbitrate == bitrate)
+@@ -1642,12 +1837,6 @@
+                      maxbitrate * 1000);
+ 
+         set_ctrls(readfd, ext_ctrls);
++
+     }
+-
+-    // Restart streaming. Shouldn't be needed? seems to be with current driver.
+-    QMutexLocker locker(&start_stop_encoding_lock);
+-    StopEncoding(readfd);
+-    StartEncoding(readfd);
+-
+-    needs_resolution = false;
+ }
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/patches/mythcommflag-avidemux.2.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/patches/mythcommflag-avidemux.2.patch
new file mode 100644
index 0000000..d26645f
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/patches/mythcommflag-avidemux.2.patch
@@ -0,0 +1,179 @@
+Index: programs/mythcommflag/main.cpp
+===================================================================
+--- programs/mythcommflag/main.cpp	(revision 18596)
++++ programs/mythcommflag/main.cpp	(working copy)
+@@ -300,6 +300,132 @@
+     return COMMFLAG_EXIT_NO_ERROR_WITH_NO_BREAKS;
+ }
+ 
++int GetAviDemux(QString list, QString chanid, QString starttime, const QString &outputfilename)
++{
++    QMap<long long, int> cutlist;
++    QMap<long long, int>::Iterator it;
++    QString result;
++    int startValue = 0;
++    long long myTotalFrames;
++    long long myFrameRate;
++
++    ProgramInfo *pginfo =
++        ProgramInfo::GetProgramFromRecorded(chanid, starttime);
++
++    NuppelVideoPlayer* nvp = new NuppelVideoPlayer("avidemux_export", pginfo);
++
++    myFrameRate = (long long)(nvp->GetFrameRate() * 1000);
++    myTotalFrames = 1000000; //nvp->GetTotalFrameCount();
++
++    if (!pginfo)
++    {
++        VERBOSE(VB_IMPORTANT,
++                QString("No program data exists for channel %1 at %2")
++                .arg(chanid).arg(starttime));
++        return COMMFLAG_BUGGY_EXIT_NO_CHAN_DATA;
++    }
++
++    QString filename = pginfo->GetPlaybackURL(TRUE);
++
++    if (list == "cutlist")
++        pginfo->GetCutList(cutlist);
++    else
++        pginfo->GetCommBreakList(cutlist);
++
++// Formatting of output data
++
++    for (it = cutlist.begin(); it != cutlist.end(); ++it)
++    {
++        if ((it.key() == 0) && (startValue == 0)) // Cutlist starts on first frame,
++            {
++            ++it;
++            startValue = it.key();
++            }
++
++        if ((it.key() != 0) && (startValue == 0)) // Cutlist starts on non-first frame
++            {
++            result += QString("app.addSegment(0,0,%1);").arg(it.key());  
++            startValue = it.key();
++            }
++        else
++           {
++            if  ((*it == MARK_COMM_END) && (startValue != 0) ||
++                (*it == MARK_CUT_END) && (startValue != 0))
++                {
++                 if (result != "")
++                       result += "\n";
++                       startValue = it.key();
++                       result += QString("app.addSegment(0,%1,").arg(it.key()); // Value is a start value
++                }
++            else  
++                {
++                    result += QString("%1);").arg(it.key() - startValue); // Value is an end value
++                }
++           }
++   }
++
++if (it.key() != myTotalFrames)
++    {
++        result += QString("%1);").arg(myTotalFrames);
++    }
++
++// Governs the file output:
++
++    QString tmp = "";
++    ostream *out = &cout;
++
++    if (outputfilename != "-"){
++        QByteArray tmp = outputfilename.toLocal8Bit();
++        out = new fstream(tmp.constData(), ios::app | ios::out );
++        }
++
++    if (outputfilename == ""){
++        VERBOSE(VB_IMPORTANT,
++           QString("Error: AVIDemux output requires the use of the --outputfile option."));
++           return COMMFLAG_EXIT_INVALID_CMDLINE;
++        }
++
++        tmp = QString("//AD  <- Needed to identify//\n"
++                        "//--automatically built--\n"
++                        "//--Project:\n\n"
++                        "var app = new Avidemux();\n\n"
++                        "//** Video **\n"
++                        "// 01 videos source\n" 
++                        "app.load(\"%1\");\n\n"
++                        "app.clearSegments();\n\n"
++                        "%2\n"
++                        "app.markerA=0;\n"
++                        "app.markerB=%3;\n"
++                        "app.rebuildIndex();\n\n"
++                        "//** Postproc **\n"
++                        "app.video.setPostProc(3,3,0);\n\n"
++                        "app.video.setFps1000(%4);\n\n"
++                        "//** Filters **\n\n"
++                        "//** Video Codec conf **\n"
++                        "app.video.codec(\"Copy\",\"CQ=4\",\"0 \");\n\n"
++                        "//** Audio **\n"
++                        "app.audio.reset();\n"
++                        "app.audio.codec(\"copy\",128,0,\"\");\n"
++                        "app.audio.normalizeMode=0;\n"
++                        "app.audio.normalizeValue=0;\n"
++                        "app.audio.delay=0;\n"
++                        "app.audio.mixer(\"NONE\");\n"
++                        "app.setContainer(\"AVI\");\n"
++                        "setSuccess(1);\n"
++                        "//app.Exit();\n\n"
++                        "//End of script\n").arg(filename).arg(result).arg(myTotalFrames).arg(myFrameRate).toLocal8Bit().constData();
++
++        const QByteArray tmp2 = tmp.toLocal8Bit();
++        *out << tmp2.constData() << endl;
++
++        VERBOSE(VB_IMPORTANT,
++                QString("AVIDemux Project generated for %1 at %2 with filename %3.")
++                .arg(chanid).arg(starttime).arg(outputfilename));
++
++    return COMMFLAG_EXIT_NO_ERROR_WITH_NO_BREAKS;
++}
++
++
+ void streamOutCommercialBreakList(
+     ostream &output, const QMap<long long, int> &commercialBreakList)
+ {
+@@ -811,6 +937,8 @@
+     bool clearCutlist = false;
+     bool getCutlist = false;
+     bool getSkipList = false;
++    bool getAviDemuxCutlist = false;
++    bool getAviDemuxSkiplist = false;
+     QString newCutList = QString::null;
+     QMap<QString, QString> settingsOverride;
+ 
+@@ -960,6 +1088,10 @@
+             getCutlist = true;
+         else if (!strcmp(a.argv()[argpos], "--getskiplist"))
+             getSkipList = true;
++        else if (!strcmp(a.argv()[argpos], "--getcutlist-avidemux"))
++            getAviDemuxCutlist = true;
++        else if (!strcmp(a.argv()[argpos], "--getskiplist-avidemux"))
++            getAviDemuxSkiplist = true;
+         else if (!strcmp(a.argv()[argpos], "--setcutlist"))
+             newCutList = (a.argv()[++argpos]);
+         else if (!strcmp(a.argv()[argpos], "-j"))
+@@ -1111,6 +1243,8 @@
+                     "                             #-#[,#-#]...  (ie, 1-100,1520-3012,4091-5094\n"
+                     "--getcutlist                 Display the current cutlist\n"
+                     "--getskiplist                Display the current Commercial Skip list\n"
++                    "--getcutlist-avidemux        Export cutlist as AVIDemux Project File\n"
++                    "--getskiplist-avidemux       Export skiplist as AVIDemux Project File\n"
+                     "-v or --verbose debug-level  Use '-v help' for level info\n"
+                     "--queue                      Insert flagging job into the JobQueue rather than\n"
+                     "                             running flagging in the foreground\n"
+@@ -1223,6 +1357,12 @@
+     if (!newCutList.isNull())
+         return SetCutList(chanid, starttime, newCutList);
+ 
++    if (getAviDemuxCutlist)
++        return GetAviDemux("cutlist", chanid, starttime, outputfilename);
++
++    if (getAviDemuxSkiplist)
++        return GetAviDemux("commflag", chanid, starttime, outputfilename);
++
+     if (getCutlist)
+         return GetMarkupList("cutlist", chanid, starttime);
+ 
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/smolt_jump.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/smolt_jump.patch
new file mode 100644
index 0000000..0fc452a
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/smolt_jump.patch
@@ -0,0 +1,30 @@
+Index: programs/mythfrontend/networkcontrol.cpp
+===================================================================
+--- programs/mythfrontend/networkcontrol.cpp	(revision 19291)
++++ programs/mythfrontend/networkcontrol.cpp	(working copy)
+@@ -83,6 +83,7 @@
+     jumpMap["zoneminderliveview"]    = "ZoneMinder Live View";
+     jumpMap["zoneminderevents"]      = "ZoneMinder Events";
+     jumpMap["snapshot"]              = "ScreenShot";
++    jumpMap["mythsmolt"]             = "MythSmolt";
+ 
+     // These jump point names match the (lowercased) locations from gContext
+     jumpMap["channelrecpriority"]    = "Channel Recording Priorities";
+@@ -191,7 +192,7 @@
+     pthread_create(&command_thread, NULL, CommandThread, this);
+ 
+     gContext->addListener(this);
+-    
++
+     connect(this, SIGNAL(newConnection()), this, SLOT(newConnection()));
+ }
+ 
+@@ -307,7 +308,7 @@
+         cs = new QTextStream(s);
+         cs->setCodec("UTF-8");
+     }
+-    
++
+     if (client)
+     {
+         closedOldConn = true;
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/svn_main_menu_popup.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/svn_main_menu_popup.patch
new file mode 100644
index 0000000..5556683
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/svn_main_menu_popup.patch
@@ -0,0 +1,211 @@
+Index: libs/libmythui/myththemedmenu.h
+===================================================================
+--- libs/libmythui/myththemedmenu.h	(revision 19291)
++++ libs/libmythui/myththemedmenu.h	(working copy)
+@@ -2,6 +2,7 @@
+ #define MYTHTHEMEDMENU_H_
+ 
+ #include "mythscreentype.h"
++#include "mythdialogbox.h"
+ #include "mythuistatetype.h"
+ #include "mythuibuttonlist.h"
+ #include "xmlparsebase.h"
+@@ -77,6 +78,11 @@
+     void ReloadExitKey(void);
+     virtual void aboutToShow(void);
+ 
++    void doMenu();
++    void aboutScreen();
++    MythDialogBox *m_menuPopup;
++    void customEvent(QEvent *event);
++
+   protected:
+     virtual bool keyPressEvent(QKeyEvent *e);
+ 
+Index: libs/libmythui/myththemedmenu.cpp
+===================================================================
+--- libs/libmythui/myththemedmenu.cpp	(revision 19291)
++++ libs/libmythui/myththemedmenu.cpp	(working copy)
+@@ -32,6 +32,7 @@
+     m_callbackdata = NULL;
+ 
+     m_killable = false;
++
+ }
+ 
+ MythThemedMenuState::~MythThemedMenuState()
+@@ -95,7 +96,7 @@
+     m_exitModifier = -1;
+     m_menumode = "";
+     m_buttonList = NULL;
+-
++    m_menuPopup = NULL;
+     if (!m_state)
+     {
+         m_state = new MythThemedMenuState(parent, "themedmenustate");
+@@ -271,6 +272,10 @@
+                 m_wantpop = true;
+             }
+         }
++        else if (action == "MENU")
++        {
++            doMenu();
++        }
+         else
+             handled = false;
+     }
+@@ -292,6 +297,154 @@
+     updateLCD();
+ }
+ 
++void MythThemedMenu::doMenu()
++{
++
++    if (m_menuPopup)
++        return;
++    int allowsd =  GetMythDB()->GetNumSetting("AllowQuitShutdown");
++    int override_menu = GetMythDB()->GetNumSetting("OverRideExitMenu");
++    QString label = "System Menu";
++    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
++    m_menuPopup = new MythDialogBox(label, mainStack, "menuPopup");
++    if (m_menuPopup->Create())
++        mainStack->AddScreen(m_menuPopup);
++    if ( override_menu == 0 )
++    {
++        if ( allowsd != 0 && allowsd !=4  )
++        {
++            m_menuPopup->SetReturnEvent(this,"popmenu_exit");
++            m_menuPopup->AddButton("Shutdown");
++            m_menuPopup->AddButton("Reboot");
++        }
++        else
++        {
++            m_menuPopup->SetReturnEvent(this,"popmenu_noexit");
++        }
++    }
++    if ( override_menu == 5 )
++    { // reboot
++        m_menuPopup->SetReturnEvent(this,"popmenu_reboot");
++        m_menuPopup->AddButton("Reboot");
++    }
++    else if ( override_menu == 2 || override_menu == 4 )
++    { // shutdown
++            m_menuPopup->SetReturnEvent(this,"popmenu_shutdown");
++            m_menuPopup->AddButton("Shutdown");
++    }
++    else if ( override_menu == 3 || override_menu == 6 )
++    { //    both
++        m_menuPopup->SetReturnEvent(this,"popmenu_exit");
++        m_menuPopup->AddButton("Shutdown");
++        m_menuPopup->AddButton("Reboot");
++    }
++    else
++    {
++        m_menuPopup->SetReturnEvent(this,"popmenu_noexit");
++    }
++
++    m_menuPopup->AddButton("About");
++    m_menuPopup->AddButton("Cancel");
++
++}
++void MythThemedMenu::aboutScreen()
++{
++
++    extern const char *myth_source_version;
++    extern const char *myth_source_path;
++    QString distro_line;
++    distro_line="";
++
++    QFile file("/etc/os_myth_release");
++    if ( file.open(QFile::ReadOnly))
++    {
++        QTextStream t( &file );        // use a text stream
++        distro_line = t.readLine();
++        file.close();
++    }
++
++    QString label = "";
++    label.append(QObject::tr("Revision: ") + myth_source_version   + "  \n  Branch:" +  myth_source_path  + "\n" + distro_line );
++
++    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
++    m_menuPopup = new MythDialogBox(label, mainStack, "About");
++    if (m_menuPopup->Create())
++        mainStack->AddScreen(m_menuPopup);
++
++    m_menuPopup->SetReturnEvent(this,"About");
++    m_menuPopup->AddButton("OK!");
++
++}
++
++void MythThemedMenu::customEvent(QEvent *event)
++{
++    if (event->type() == kMythDialogBoxCompletionEventType)
++    {
++        DialogCompletionEvent *dce =
++                dynamic_cast<DialogCompletionEvent*>(event);
++        QString resultid= dce->GetId();
++        int buttonnum  = dce->GetResult();
++        QString halt_cmd=GetMythDB()->GetSetting("HaltCommand");
++        QString reboot_cmd=GetMythDB()->GetSetting("RebootCommand");
++
++        if (resultid == "popmenu_exit")
++        {
++            if (buttonnum == 0)
++            {
++                if (!halt_cmd.isEmpty() )
++                    system(halt_cmd.toAscii());
++            }
++
++            if (buttonnum == 1)
++            {
++                if (!reboot_cmd.isEmpty() )
++                    system(reboot_cmd.toAscii());
++            }
++
++            if (buttonnum == 2)
++            {
++                aboutScreen();
++            }
++        }
++
++        if (resultid == "popmenu_noexit")
++        {
++            if (buttonnum == 0)
++                aboutScreen();
++        }
++
++        if (resultid == "popmenu_reboot")
++        {
++            if (buttonnum == 0)
++            {
++                if (!reboot_cmd.isEmpty() )
++                    system(reboot_cmd.toAscii());
++            }
++
++            if (buttonnum == 1)
++            {
++                aboutScreen();
++            }
++        }
++
++        if (resultid == "popmenu_shutdown")
++        {
++            if (buttonnum == 0)
++            {
++                if (!halt_cmd.isEmpty() )
++                    system(halt_cmd.toAscii());
++            }
++
++            if (buttonnum == 1)
++            {
++                aboutScreen();
++            }
++        }
++
++        m_menuPopup = NULL;
++    }
++}
++
+ /** \brief Parses the element's tags and set the ThemeButton's type,
+  *         text, depends, and action, then adds the button.
+  *
-- 
cgit v0.12