How to install MythTV: Difference between revisions

From QNAPedia
Jump to navigation Jump to search
(Created page with "QNAP NAS devices have a relatively fast processor in them. Here is a guide to get MythTV running on them. This guide is no where near complete, it doesn't cover problems that...")
 
 
Line 2,889: Line 2,889:


exit 0</pre>
exit 0</pre>
[[Category:MythTV]]

Latest revision as of 17:48, 26 October 2015

QNAP NAS devices have a relatively fast processor in them. Here is a guide to get MythTV running on them. This guide is no where near complete, it doesn't cover problems that may arise, and assumes a fair amount of linux knowledge and experience. But give it a go even if you don't know much, and I'll try to help (see the section on Problems?).

Initial Setup

Web setup

Following steps performed through the Web interface http://<qnap ip>:1010/

  • Install IPKG from the web interface
    • Application Servers->QPKG Plugins->GetQPKG->Optware IPKG
    • Installation Tab->Browse to .qpkg file->INSTALL
    • QPKG INSTALLED Tab->Optware->Enable
  • Allow console login
    • Network Services->Telnet/SSH
    • Allow SSH connection->APPLY

Console setup

So now you have a terminal with ipkg installed and enabled, log into your qnap device and let's get to work!

ssh admin@<qnap ip>

you should get

[~]

First let's go somewhere with lots of spare room (might also be MD0_DATA for raided drives)

[~] mkdir /share/HDA_DATA/labatory
[~] cd /share/HDA_DATA/labatory

you should see

[/share/HDA_DATA/labatory]

Second let's get some essential utilities for our experimentation

[/share/HDA_DATA/labatory] ipkg install nano gcc make automake ncurses ncursesw wget ncurses-dev
[/share/HDA_DATA/labatory] ipkg install patch coreutils pkgconfig
[/share/HDA_DATA/labatory] ipkg install perl perl-libxml perl-dbi
[/share/HDA_DATA/labatory] ipkg install findutils sed grep gawk


(this step will take a while as these packages are downloaded and installed to your qnap device)

Ok, so now were are ready to start delving into the compilation of the modules required for MythTV. Depending on your setup you will either want to build and install modules for USB tuners or skip that step because you are using a network tuner and start compiling Qt... (Note even if you are using a network tuner you will still need to download and untar the kernel source, it is required for dvb headers)



Using Kernel modules tuners

Get linux and qnap sources. NOTE: YOU DO NOT NEED THIS STEP IF YOU HAVE A HOMERUN HD DEVICE.

wget ftp://ftp.jp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.33.2.tar.gz
wget http://resources.qnap.com/Storage/tsd/QNAP_GPL_3.3.3-20100928.tar.gz
(or ftp://ftp.qnap.com/gpl/QNAP_GPL_3.4.x_20110218.tar.gz)

untar these sources

tar xzvf QNAP_GPL_3.3.3-20100928.tar.gz
tar xzvf linux-2.6.33.2.tar.gz

browse to the folder that corresponds to your QNAP

cd GPL_TS/kernel_cfg
ls

I own a TS-219P

cd TS-219

Copy the kernel config file that corrosponds to your kernel version (type uname -r to find out which one you have) to the kernel source files

ls
uname -r

should return

2.6.33.2
cp ./linux-2.6.33.2-arm.cfg ../../../linux-2.6.33.2/.config

go to that folder

cd ../../../linux-2.6.33.2/
nano .config

enable i2c and media (make sure the following exists in the .config file, do a search)

CONFIG_I2C=m 
CONFIG_MEDIA_SUPPORT=m

setup the ncurses libraries

ln -s /opt/lib/libncurses.so /lib/libncurses.so
ln -s /opt/lib/libncurses.so.5 /lib/libncurses.so.5
ln -s /opt/lib/libncurses.so.5.7 /lib/libncurses.so.5.7
ln -s /opt/lib/libncursesw.so /lib/libncursesw.so
ln -s /opt/lib/libncursesw.so.5 /lib/libncursesw.so.5
ln -s /opt/lib/libncursesw.so.7 /lib/libncursesw.so.7
make oldconfig

Make sure you answer as follows

I2C support (I2C) [M/n/y/?] m
Multimedia support (MEDIA_SUPPORT) [M/n/y/?] m
DVB for Linux (DVB_CORE) [N/m/?] (NEW) m
Support for various USB DVB devices (DVB_USB) [N/m/?] (NEW) m
Customise the frontend modules to build (DVB_FE_CUSTOMISE) [N/y/?] (NEW) y

Start the compilation of the kernel modules

make modules

This will take some time … so go for a swim, read to your kids, or develop a unified field theory.

After it has completed you should be left with loadable dvb usb tuner and support modules.

I2C Problems?

To get the i2c-core.ko module to work, you will need to follow this post http://forum.qnap.com/viewtopic.php?p=194182#p202235

Once all the modules are compiled, I ran

make install

which makes it easier to load the correct modules in the right order using modprobe as per the link to a post below

I have a Hauppage Win Nova-t usb stick, I follow the folloing post to get the correct modules to load and load the firmware. http://forum.qnap.com/viewtopic.php?p=194182#p208102

Compiling Qt

NOTE: Whereas those compiling Qt on firmware 3.5.1 have had success, those on firmware 3.5.2 have not.

Initial Setup

Qt expects certain libraries to be present, happily we have ipkg to fulfill that requirement

ipkg install fontconfig libdb libjpeg libpng libtiff libstdc++ x11 xauth xproto xrender

(this need works to determine exactly what is required for correct compilation of Qt)


Compiling

Get Qt sources

wget http://download.qt-project.org/archive/qt/4.7/qt-everywhere-opensource-src-4.7.4.tar.gz

untar these sources

tar zxf qt-everywhere-opensource-src-4.7.4.tar.gz

let's get started!

cd qt-everywhere-opensource-src-4.7.4

setup X11 paths

export QMAKE_LIBDIR_X11=/opt/lib/
export QMAKE_INCDIR_X11=/opt/include/X11

configure and build Qt

./configure --opensource -confirm-license -release -prefix /opt/Qt-4.7.3 -I /usr/local/mysql/include/mysql -L /usr/local/mysql/lib/mysql -reduce-relocations -qt-libtiff -qt-libpng -qt-libmng -sql-mysql-plugin -no-multimedia -nomake tools -nomake examples -nomake demos -nomake docs -webkit
make
make install

This will take a long time, I am doing this on a 1.2GHz ARM platform and it has taken at least 12 hours. Be patient.

Compiling MythTV

Initial Setup

MythTV also expects certain libraries to be present, again we rely on ipkg (thanks ipkg devs)

ipkg install ffmpeg lame xextensions xvid yasm


Compiling

Get MythTV sources.  While the instructions are for 0.24.1 (released May 15, 2011), it's the same process for 0.24.3 (released Apr 12, 2012).  The 0.24.1 patches also work for 0.24.3.

wget ftp://ftp.osuosl.org/pub/mythtv/old_releases/mythtv-0.24.1.tar.bz2
or
wget ftp://ftp.osuosl.org/pub/mythtv/old_releases/mythtv-0.24.3.tar.bz2

unbz these sources

tar xfj mythtv-0.24.1.tar.bz2

let's get started!

cd mythtv-0.24.1

first we need to patch configure and other files to get it to work on this platform (How to install MythTV#Appendix). there are quite a number of changes to source of MythTV, I don't think the authors ever intended it to be used in this manner ... oh well too bad ^_^  create the patches in the appendix and patch MythTV:

nano mythtv_qnap.patch

PASTE text from five patches in appendix and save file:
  1) configure.patch
  2) mythcdrom-linux.cpp.patch
  3) mythdisplay.cpp.patch
  4) mythxdisplay.cpp.patch
  5) cpsvndir.patch

patch -p2 -i mythtv_qnap.patch

configure and build MythTV (disable frontend not functional?)

./configure --disable-frontend --prefix=/opt --qmake=/opt/Qt-4.7.3/bin/qmake --cpu='i686'

if you have not installed your kernel headers (additional dvb-path for non installed kernel dvb headers, requires confirmation for people building with a network tuner)

./configure --prefix=/opt --qmake=/opt/Qt-4.7.3/bin/qmake [--dvb-path=/share/HDA_DATA/labatory/linux-2.6.33.2/include/]

start building

make
make install

And now it is on to setup ...

MythTV Backend Setup

Mostly steps from http://www.mythtv.org/wiki/User_Manual:Initial_Installation

Database

So currently you should have an "in thoery" working version of MythTV. However it is not setup correctly. Try the following

[/share] # mythbackend 
2011-09-15 22:07:31.138 mythbackend version:  [v0.24.1] www.mythtv.org
2011-09-15 22:07:31.140 Using runtime prefix = /opt
2011-09-15 22:07:31.141 Using configuration directory = /root/.mythtv
2011-09-15 22:07:31.145 Unable to read configuration file mysql.txt
2011-09-15 22:07:31.146 Empty LocalHostName.
2011-09-15 22:07:31.146 Using localhost value of NAS
2011-09-15 22:07:31.244 New DB connection, total: 1
2011-09-15 22:07:31.300 Unable to connect to database!
2011-09-15 22:07:31.300 Driver error was [1/1045]:
QMYSQL: Unable to connect
Database error was:
Access denied for user 'mythtv'@'localhost' (using password: YES)

So now you need to setup the database

/usr/local/mysql/bin/mysql -u root < database/mc.sql -p

Done, let's try again

[/share/HDA_DATA/hackery/mythtv-0.24.1] # mythbackend

If you get the following response:

2011-11-11 09:11:36.186 Empty LocalHostName.
2011-11-11 09:11:36.186 Using localhost value of Caerbannog
QSqlDatabase: QMYSQL3 driver not loaded
QSqlDatabase: available drivers: QSQLITE
2011-11-11 09:11:36.192 Unable to init db connection.
2011-11-11 09:11:36.192 New DB connection, total: 1
2011-11-11 09:11:36.192 MSqlDatabase::OpenDatabase(), db object is not valid!

then the mysql plugin didn't get built. Run the following:

cd qt-everywhere-opensource-src-4.7.4/src/plugins/sqldrivers/mysql/
make; make install

then try again

[/share/HDA_DATA/hackery/mythtv-0.24.1] # mythbackend
2011-09-15 22:20:55.379 mythbackend version:  [v0.24.1] www.mythtv.org
2011-09-15 22:20:55.380 Using runtime prefix = /opt
2011-09-15 22:20:55.381 Using configuration directory = /root/.mythtv
2011-09-15 22:20:55.385 Unable to read configuration file mysql.txt
2011-09-15 22:20:55.386 Empty LocalHostName.
2011-09-15 22:20:55.386 Using localhost value of NAS
2011-09-15 22:20:55.483 New DB connection, total: 1
2011-09-15 22:20:55.512 Connected to database 'mythconverg' at host: localhost
2011-09-15 22:20:55.519 Closing DB connection named 'DBManager0'

-snip-

2011-09-15 22:21:06.329 Upgrading to MythTV schema version 1262
2011-09-15 22:21:06.922 Upgrading to MythTV schema version 1263
2011-09-15 22:21:06.934 Upgrading to MythTV schema version 1264
2011-09-15 22:21:06.946 Database Schema upgrade complete, unlocking.
2011-09-15 22:21:06.969 MediaServer:: No BackendServerIP Address defined
No setting found for this machine's BackendServerIP.
Please run setup on this machine and modify the first page
of the general settings.

Success! Now we have to run mythtv-setup this is a little more indepth an involves setting up a "forwarding X session".

Missing timezone support 

Starting with firmware 3.7.1, mythtv (I tested with 0.26pre) complains about missing timezone support. In case you hit this problem, install timezones into mysql:

> mysql_tzinfo_to_sql /usr/share/zoneinfo | /usr/local/mysql/bin/mysql -u root -p mysql

This installs timezone info from the NAS (which is located in /usr/share/timezone) to mysql. Unfortunately, the information for UTC is missing on the NAS, leaving mythtv still unstartable.

As I could not figure out a clean way how to generate the UTC timezone information, I simply executed the mysql script for the UTC timezone on my linux box and pasted the insert statements into the mysql on the NAS:

> mysql -u root -p mysql
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('UTC', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'UTC');
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;

I am not sure if this is the recommended way but it seems to work, as mythtv starts thereafter.

X11 Forwarding

Server configuration

The following steps are not necessary when connecting with a Windows client using Xming as specified below.

So now you have a to forward the X session over ssh (compile and run http://en.literateprograms.org/Hello_World_%28C,_Xlib%29 to test the forwarding works).  

Edit sshd_config file in /etc/ssh enable X11forwarding twice in the file (by uncommenting and changing the value to yes)  

X11Forwarding yes

restart the ssh daemon through the Qnap web admin interface to enable these changes.   

In my case the forwarding did still not work. The reason was that sshd was compiled with a xauth path that does not exist on the Qnap NAS. In order to fix this, extract the xauth location from the sshd executable and cerate a symlink so that sshd finds xauth under the expected path (this has to be done on the NAS):

> strings /usr/sbin/sshd | grep xauth
/usr/X11R6/bin/xauth
xauthlocation
maxauthtries
> ln -s /opt/bin/xauth /usr/X11R6/bin/xauth

Client configuration

I'm on windows vista, I installed Xming (an X server for Windows): http://sourceforge.net/projects/xming/  

Edit the X0.hosts file (C:/program files/Xming) and add the ip address of your mythbackend (QNAP) machine

With XLaunch: open an X window, leave all options as-is with the display set at 0

log in to your Qnap box on your windows client with Putty run the following command prior to running mythtv-setup:

export DISPLAY=192.168.X.X:0.0

where the ip address above is the client computer. This may only work if you are on the same local subnet as the NAS (on your home LAN).  Some may need to enabling X11 forwarding to your windows client in your putty session. (Connection > SSH > X11 > enable X11 forwarding + X display location = localhost:0)

On linux simply add -X (the X has to be uppercase!) as argument to the ssh call:

ssh -X <ip.of.your.nas>

mythtv-setup

  • run mythtv-setup, run a scan, populate the channels, I had some issues with fonts and themes here, it was really annoying

Fonts A lot of people are having problems with themes/fonts when running mythtv-setup, where empty squares are displayed instead of letters. If you have this behavior, one solution may be to run the following commands to copy the themes folder and font folder from the source to the install location. It worked for at least one person, so others should report results.

cp -r mythtv-0.24.1/themes/ /opt/share/mythtv/
cp -r mythtv-0.24.1/themes/fonts /opt/share/mythtv/fonts

MythWeb

MythWeb allows control of the MythTV backend from a web interface, including setting up recordings, displaying status

  1. If QNAPfirmware < 3.7.1, install PHP5.3 per steps 1 - 4 here for 219P+; PHP5.3 is included with 3.7.1
  2. copy mythweb source files from zip into Public share
  3. ssh into NAS
  4. cp -r /share/Public/MYTHWEBROOTDIR /share/Web/mythweb
  5. chown -R httpdusr /share/Web/mythweb
  6. chmod -R 755 /share/Web/mythweb
  7. nano /etc/config/apache/apache.conf
    +add "Include /etc/config/apache/extra/mythweb.conf" at very bottom
  8. cp /share/Web/mythweb/mythweb.conf.apache /etc/config/apache/extra/mythweb.conf
  9. nano /etc/config/apache/extra/mythweb.conf
    +edit paths to match /share/Web/mythweb/data and /share/Web/mythweb

Setup authentication (following is DIGEST authentication):

  1. /mnt/ext/opt/apache/bin/htdigest -c  /etc/config/apache/extra/mythweb.password "MythTV" INSERTUSERNAMEHERE
  2. nano /etc/config/apache/extra/mythweb.conf
    +uncomment the directives in the authentication section (7 total in my version)
    +change AuthUserFile to /etc/config/apache/extra/mythweb.password
    +add the following line before the authentication section:
    LoadModule auth_digest_module modules/mod_auth_digest.so

In case you can not get DIGEST authentication to work, use BASIC authentication. This does not provide as much security as DIGEST, but is better than nothing:

  1. /mnt/ext/opt/apache/bin/htpasswd -c /etc/config/apache/extra/mythweb.password INSERTUSERNAMEHERE
  2. nano /etc/config/apache/extra/mythweb.conf
    +uncomment the directives in the authentication section (7 total in my version)
    +change AuthType from Digest to Basic
    +change AuthUserFile to /etc/config/apache/extra/mythweb.password

In case your installing mythweb > 0.24.3 the following step is also needed:

  1. nano /etc/config/apache/extra/mythweb.conf
    +uncomment "setenv include_path" variable and set to MYTHTV_INSTALLPATH/share/mythtv/bindings/php"
    this is needed for mythweb>0.24.3 due to this update. If not done, you'll see the following error in the browser loading mythweb: "Fatal error: Class 'MythBase' not found in /share/MD0_DATA/Web/mythweb/classes/Translate.php on line 16" error.

That's it. you now only need to restart Apache:

  1. /etc/init.d/Qthttpd.sh restart
  2. go to http://NAS-ip-address/mythweb


Mythweb complains about the timezone array being incorrect.  A solution is to run the following commands when mythtv is started (of course, use the appropriate timezone!):

  1. mv /etc/localtime /etc/localtime_old
  2. ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime

These commands are included in the QPKG startup script in the appendix.  You can also setup logging for the backend through mythweb:

  1. Navigate to mythweb->Settings->MythTV and find the LogEnabled flag.
  2. Set LogEnabled to 1 and click save at the bottom.
  3. Find "Backend Logs" at the top.

The Backend Logs page may at first display the following error:

Warning at /share/MD0_DATA/Web/mythweb/modules/backend_log/tmpl/default/backend_log.php, line 30:<br>!!NoTrans: array_keys() expects parameter 1 to be array, null given!!

Warning at /share/MD0_DATA/Web/mythweb/modules/backend_log/tmpl/default/backend_log.php, line 30:<br>!!NoTrans: Invalid argument supplied for foreach()!!

but once there are some log entries, that error will disappear and the entries will show.

MythTV Backend boot scripts

autorun.sh method

Normally would you loose all these nice settings on reboot. You can do this by using the bash script below and following the steps outlined in Running Your Own Application at Startup.

eg

[/share/HDA_DATA/.qpkg/autorun] # cat autorun.sh 
#!/bin/sh

# additional lib path
echo "/opt/lib" >> /etc/ld.so.conf
ldconfig

# create dvb devices
/share/HDA_DATA/.qpkg/autorun/dvb-devices

# set correct locale (remove incorrect)
#localedef -f UTF-8 -i en_AU en_AU.utf8
#localedef --delete-from-archive en_US.utf8

# load kernel modules
insmod /lib/modules/others/i2c-core.ko
insmod /lib/modules/others/dvb-core.ko
insmod /lib/modules/others/dvb-usb.ko
insmod /lib/modules/others/dvb-usb-af903x.ko

# start mythbackend
#mythbackend &

QPKG script method

This method makes mythbackend appear as a QPKG to the QNAP Package Management System and QPKT admin webpage, which allows one to disable/enable and start/stop/restart MythTV. If the "MythTV QPKG" is enabled, the QNAP will start it on boot. Steps to setup are below:

  • SSH/Telnet into the QNAP
  • copy #MythTV.sh in appendix to /share/MD0_DATA/.qpkg/MythTV/MythTV.sh or other location
  • Open /etc/config/qpkg.conf using vi/nano and insert the #addition_to_qpkg.conf snipit in Appendix to the QPKG config file (edit "shell" to match the location of the script above)
  • Login to the QNAP Admin Web UI & go to QPKG to use your Script

Performance

  • User: ybot Testing was done on a QNAP 219P, with a MacBook Pro frontend with gigabit ethernet (Netgear GS105) connection. The frontend is showing 720p DVB streams from the QNAP as it is recording the same HD stream to the harddrive. I haven't seen any issues related to either the HD stream being written to the harddrive or the stream from the harddrive to the network port, both these processes seem robust. In regards to process stats I see the following data:-
    • mythbackend (33M memory footprint)
      • Idle - average 0.0-0.1 CPU usage
      • Recording - average 0.0-2.0 percent CPU
      • Recording + streaming - average 3-5 percent CPU with no >10 percent.
    • mysqld - average 0-1 percent CPU, with occasional 5-10 percent spikes
  • If you are running a network tuner you will need to make sure your network can handle the traffic generated by this (tuner device -> QNAP -> Frontend)
  • Please put in your experiences here!

Further Work

I am looking at several different ways of speeding up compilation and reducing end user pain


Tips (README!)

  • Use the screen utility (ipkg install screen) it helps with long compile sessions.
  • Compilation is pretty CPU intensive so you will see a degradation of performance, just don't use it while it is compiling :)
  • Be smart, this stuff takes time to compile and setup, do a couple of things at once
    • Download all the required source in the background
    • Qt isn't dependent on the kernel modules, get both of them compiling at once


Problems?

http://forum.qnap.com/viewtopic.php?f=24&t=5384


Appendix

Mythtv 0.24.1 source patches

Updated Mythtv 0.24.1 patches works for Mythtv 0.24.3 as well!

configure.patch

thanks to FourG

diff --git a/mythtv/configure b/mythtv/configure
index 1b60cae..e9081e2 100755
--- a/mythtv/configure
+++ b/mythtv/configure
@@ -339,7 +339,6 @@ log(){

 log_file(){
     log BEGIN $1
-    pr -n -t $1 >> $logfile
     log END $1
 }

@@ -2217,7 +2216,7 @@ else
     shlibdir_default="${prefix_default}/${libdir_name}"
 fi

-if enabled_any cpu_override croos_compile || test x"$tune" != x"generic" &&
+if enabled_any cpu_override cross_compile || test x"$tune" != x"generic" &&
     enabled proc_opt; then
     echo "Warning! --enable-proc-opt shouldn't be used with --arch, --cpu or --tune"
     echo "Disabling it now."
@@ -2277,8 +2276,8 @@ if ! check_cmd type mktemp; then
 fi

 tmpfile(){
-    tmp=$(mktemp -u "${TMPDIR}/mythtv_conf.XXXXXXXX")$2 &&
-        (set -C; exec > $tmp) 2>/dev/null ||
+    tmp=$(mktemp "${TMPDIR}/mythtv_conf.XXXXXXXX")$2 &&
+        (set -C; exec >> $tmp) 2>/dev/null ||
         die "Unable to create temporary file in $TMPDIR."
     append TMPFILES $tmp
     eval $1=$tmp
@@ -3987,8 +3986,6 @@ enabled xrandr && check_lib X11/extensions/Xrandr.h XRRSelectInput -lXrandr || d
 enabled xv && check_lib X11/extensions/Xv.h XvPutStill -lXv || disable xv

 if enabled x11; then
-    require libXxf86vm X11/extensions/xf86vmode.h XF86VidModeSetClientVersion -lXxf86vm
-    require libXinerama X11/extensions/Xinerama.h XineramaQueryExtension -lXinerama
     require libXext X11/extensions/Xext.h XMissingExtension -lXext
 fi

mythcdrom-linux.cpp.patch

thanks to FourG

diff --git a/mythtv/libs/libmyth/mythcdrom-linux.cpp b/mythtv/libs/libmyth/mythcdrom-linux.cpp
index 6c5b0d0..c0c6f72 100644
--- a/mythtv/libs/libmyth/mythcdrom-linux.cpp
+++ b/mythtv/libs/libmyth/mythcdrom-linux.cpp
@@ -1,7 +1,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>       // ioctls
-#include <linux/cdrom.h>     // old ioctls for cdrom
 #include <scsi/sg.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -130,8 +129,10 @@ public:
     virtual bool checkOK(void);
     virtual MediaStatus checkMedia(void);
     virtual MediaError eject(bool open_close = true);
+#if defined(SG_IO) && defined(GPCMD_SET_STREAMING)
     virtual void setSpeed(int speed);
     virtual void setSpeed(const char *device, int speed);
+#endif
     virtual bool isSameDevice(const QString &path);
     virtual MediaError lock(void);
     virtual MediaError unlock(void);
@@ -159,18 +160,7 @@ MythCDROM *GetMythCDROMLinux(QObject* par, const char* devicePath,

 int MythCDROMLinux::driveStatus()
 {
-    int drive_status = ioctl(m_DeviceHandle, CDROM_DRIVE_STATUS, CDSL_CURRENT);
-
-    if (drive_status == -1)   // Very unlikely, but we should check
-    {
-        VERBOSE(VB_MEDIA, LOC + ":driveStatus() - ioctl() failed: " + ENO);
-        return CDS_NO_INFO;
-    }
-
-    if (drive_status == CDS_TRAY_OPEN && m_DevicePath.contains("/dev/scd"))
-        return SCSIstatus();
-
-    return drive_status;
+    return 0;
 }
 
 /** \brief Is there blank or eraseable media in the drive?
@@ -178,47 +168,6 @@ int MythCDROMLinux::driveStatus()
 
 bool MythCDROMLinux::hasWritableMedia()
 {
-    unsigned char    buffer[32];
-    CDROMgenericCmd  cgc;
-    CDROMdiscInfo   *di;
-
-
-    memset(buffer, 0, sizeof(buffer));
-    memset(&cgc,   0, sizeof(cgc));
-
-    cgc.cmd[0] = GPCMD_READ_DISC_INFO;
-    cgc.cmd[8] = sizeof(buffer);
-    cgc.quiet  = 1;
-    cgc.buffer = buffer;
-    cgc.buflen = sizeof(buffer);
-    cgc.data_direction = CGC_DATA_READ;
-
-    if (ioctl(m_DeviceHandle, CDROM_SEND_PACKET, &cgc) < 0)
-    {
-        VERBOSE(VB_MEDIA,
-                LOC + ":hasWritableMedia() - failed to send packet to "
-                    + m_DevicePath);
-        return false;
-    }
-
-    di = (CDROMdiscInfo *) buffer;
-
-    switch (di->disc_status)
-    {
-        case MEDIA_IS_EMPTY:
-            return true;
-
-        case MEDIA_IS_APPENDABLE:
-            // It is unlikely that any plugins will support multi-session
-            // writing, so we treat it just like a finished disc:
-
-        case MEDIA_IS_COMPLETE:
-            return di->erasable;
-
-        case MEDIA_IS_OTHER:
-            ;
-    }
-
     return false;
 }
 
@@ -232,392 +181,50 @@ bool MythCDROMLinux::hasWritableMedia()
 
 int MythCDROMLinux::SCSIstatus()
 {
-    unsigned char    buffer[8];
-    CDROMgenericCmd  cgc;
-    CDROMeventStatus *es;
-
-
-    memset(buffer, 0, sizeof(buffer));
-    memset(&cgc,   0, sizeof(cgc));
-
-    cgc.cmd[0] = GPCMD_GET_EVENT_STATUS_NOTIFICATION;
-    cgc.cmd[1] = 1;       // Tell us immediately
-    cgc.cmd[4] = 1 << 4;  // notification class of media
-    cgc.cmd[8] = sizeof(buffer);
-    cgc.quiet  = 1;
-    cgc.buffer = buffer;
-    cgc.buflen = sizeof(buffer);
-    cgc.data_direction = CGC_DATA_READ;
-
-    es = (CDROMeventStatus *) buffer;
-
-    if ((ioctl(m_DeviceHandle, CDROM_SEND_PACKET, &cgc) < 0)
-        || es->nea                           // drive does not support request
-        || (es->notification_class != 0x4))  // notification class mismatch
-    {
-        VERBOSE(VB_MEDIA,
-                LOC + ":SCSIstatus() - failed to send SCSI packet to "
-                    + m_DevicePath);
-        return CDS_TRAY_OPEN;
-    }
-
-    if (es->media_present)
-    {
-        VERBOSE(VB_MEDIA+VB_EXTRA,
-                LOC + ":SCSIstatus() - ioctl() said tray was open,"
-                      "but drive is actually closed with a disc");
-        return CDS_DISC_OK;
-    }
-    else if (es->door_open)
-    {
-        VERBOSE(VB_MEDIA+VB_EXTRA,
-                LOC + ":SCSIstatus() - tray is definitely open");
-        return CDS_TRAY_OPEN;
-    }
-
-    VERBOSE(VB_MEDIA+VB_EXTRA,
-            LOC + ":SCSIstatus() - ioctl() said tray was open,"
-                  " but drive is actually closed with no disc");
-    return CDS_NO_DISC;
+    return 0;
 }
 
 
 MediaError MythCDROMLinux::eject(bool open_close)
 {
-    if (!isDeviceOpen())
-    {
-        if (!openDevice())
-            return MEDIAERR_FAILED;
-    }
-
-    if (open_close)
-        return (ioctl(m_DeviceHandle, CDROMEJECT) == 0) ? MEDIAERR_OK
-                                                        : MEDIAERR_FAILED;
-    else
-    {
-        // If the tray is empty, this will fail (Input/Output error)
-        ioctl(m_DeviceHandle, CDROMCLOSETRAY);
-
-        // This allows us to catch any drives that the OS has problems
-        // detecting the status of (some always report OPEN when empty)
-        if (driveStatus() == CDS_TRAY_OPEN)
-            return MEDIAERR_FAILED;
-        else
-            return MEDIAERR_OK;
-    }
+    return MEDIAERR_FAILED;
 }
 
 
 bool MythCDROMLinux::mediaChanged()
 {
-    return (ioctl(m_DeviceHandle, CDROM_MEDIA_CHANGED, CDSL_CURRENT) > 0);
+    return 0;
 }
 
 bool MythCDROMLinux::checkOK()
 {
-    return (ioctl(m_DeviceHandle, CDROM_DRIVE_STATUS, CDSL_CURRENT) ==
-                  CDS_DISC_OK);
+    return 0;
 }
 
 // Helper function, perform a sanity check on the device
 MediaError MythCDROMLinux::testMedia()
 {
-    //cout << "MythCDROMLinux::testMedia - ";
-    bool OpenedHere = false;
-    if (!isDeviceOpen())
-    {
-        //cout << "Device is not open - ";
-        if (!openDevice())
-        {
-            VERBOSE(VB_MEDIA+VB_EXTRA, LOC + ":testMedia - failed to open '"
-                                           + m_DevicePath +  "' : " +ENO);
-            if (errno == EBUSY)
-                return isMounted() ? MEDIAERR_OK : MEDIAERR_FAILED;
-            else
-                return MEDIAERR_FAILED;
-        }
-        VERBOSE(VB_MEDIA+VB_EXTRA, LOC + ":testMedia - Opened device");
-        OpenedHere = true;
-    }
-
-    // Since the device was is/was open we can get it's status...
-    int Stat = driveStatus();
-
-    // Be nice and close the device if we opened it,
-    // otherwise it might be locked when the user doesn't want it to be.
-    if (OpenedHere)
-        closeDevice();
-
-    if (Stat == -1)
-    {
-        VERBOSE(VB_MEDIA+VB_EXTRA,
-                LOC + ":testMedia - Failed to get drive status of '"
-                    + m_DevicePath + "' : " + ENO);
-        return MEDIAERR_FAILED;
-    }
-
-    return MEDIAERR_OK;
+    return MEDIAERR_FAILED;
 }
 
 MediaStatus MythCDROMLinux::checkMedia()
 {
-    bool OpenedHere = false;
-
-    // If it's not already open we need to at least
-    // TRY to open it for most of these checks to work.
-    if (!isDeviceOpen())
-    {
-        OpenedHere = openDevice();
-
-        if (!OpenedHere)
-        {
-            VERBOSE(VB_MEDIA, LOC + ":checkMedia() - cannot open device '"
-                                  + m_DevicePath + "' : "
-                                  + ENO + "- returning UNKNOWN");
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return setStatus(MEDIASTAT_UNKNOWN, false);
-        }
-    }
-
-    switch (driveStatus())
-    {
-        case CDS_DISC_OK:
-            VERBOSE(VB_MEDIA, m_DevicePath + " Disk OK, type = "
-                              + MediaTypeString(m_MediaType) );
-            // further checking is required
-            break;
-        case CDS_TRAY_OPEN:
-            VERBOSE(VB_MEDIA, m_DevicePath + " Tray open or no disc");
-            // First, send a message to the
-            // plugins to forget the current media type
-            setStatus(MEDIASTAT_OPEN, OpenedHere);
-            // then "clear out" this device
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return MEDIASTAT_OPEN;
-            break;
-        case CDS_NO_DISC:
-            VERBOSE(VB_MEDIA, m_DevicePath + " No disc");
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return setStatus(MEDIASTAT_NODISK, OpenedHere);
-            break;
-        case CDS_NO_INFO:
-        case CDS_DRIVE_NOT_READY:
-            VERBOSE(VB_MEDIA, m_DevicePath + " No info or drive not ready");
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
-        default:
-            VERBOSE(VB_IMPORTANT, "Failed to get drive status of "
-                                  + m_DevicePath + " : " + ENO);
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
-    }
-
-    if (mediaChanged())
-    {
-        VERBOSE(VB_MEDIA, m_DevicePath + " Media changed");
-        // Regardless of the actual status lie here and say
-        // it's open for now, so we can cover the case of a missed open.
-        return setStatus(MEDIASTAT_OPEN, OpenedHere);
-    }
-
-
-    if (isUsable())
-    {
-        VERBOSE(VB_MEDIA+VB_EXTRA, "Disc useable, media unchanged. All good!");
-        if (OpenedHere)
-            closeDevice();
-        return MEDIASTAT_USEABLE;
-    }
-
-    // If we have tried to mount and failed, don't keep trying
-    if (m_Status == MEDIASTAT_ERROR)
-    {
-        VERBOSE(VB_MEDIA+VB_EXTRA, "Disc is unmountable?");
-        if (OpenedHere)
-            closeDevice();
-        return m_Status;
-    }
-
-    if ((m_Status == MEDIASTAT_OPEN) ||
-        (m_Status == MEDIASTAT_UNKNOWN))
-    {
-        VERBOSE(VB_MEDIA, m_DevicePath + " Current status " +
-                MythMediaDevice::MediaStatusStrings[m_Status]);
-        int type = ioctl(m_DeviceHandle, CDROM_DISC_STATUS, CDSL_CURRENT);
-        switch (type)
-        {
-            case CDS_DATA_1:
-            case CDS_DATA_2:
-            {
-                m_MediaType = MEDIATYPE_DATA;
-                VERBOSE(VB_MEDIA, "Found a data disk");
-
-                //grab information from iso9660 (& udf)
-                off_t sr = lseek(m_DeviceHandle,
-                                 (off_t) 2048*16, SEEK_SET);
-
-                struct iso_primary_descriptor buf;
-                ssize_t readin = 0;
-                while ((sr != (off_t) -1) && (readin < 2048))
-                {
-                    ssize_t rr = read(
-                        m_DeviceHandle, ((char*)&buf) + readin, 2048 - readin);
-                    if ((rr < 0) && ((EAGAIN == errno) || (EINTR == errno)))
-                        continue;
-                    else if (rr < 0)
-                        break;
-                    readin += rr;
-                }
-
-                if (readin == 2048)
-                {
-                    m_VolumeID = QString(buf.volume_id).trimmed();
-                    m_KeyID = QString("%1%2")
-                        .arg(m_VolumeID)
-                        .arg(QString(buf.creation_date).left(16));
-                }
-                else
-                {
-                    m_VolumeID = "UNKNOWN";
-                    m_KeyID = m_VolumeID +
-                        QDateTime::currentDateTime().toString(Qt::ISODate);
-                }
-
-                VERBOSE(VB_MEDIA, QString("Volume ID: %1").arg(m_VolumeID));
-
-                // the base class's onDeviceMounted will do fine
-                // grained detection of the type of data on this disc
-                if (isMounted())
-                    onDeviceMounted();
-                else if (!mount()) // onDeviceMounted() called as side-effect
-                    return setStatus(MEDIASTAT_ERROR, OpenedHere);
-
-                if (isMounted())
-                {
-                    // pretend we're NOTMOUNTED so setStatus emits a signal
-                    m_Status = MEDIASTAT_NOTMOUNTED;
-                    return setStatus(MEDIASTAT_MOUNTED, OpenedHere);
-                }
-                else if (m_MediaType == MEDIATYPE_DVD)
-                {
-                    // pretend we're NOTMOUNTED so setStatus emits a signal
-                    m_Status = MEDIASTAT_NOTMOUNTED;
-                    return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                }
-                else
-                    return setStatus(MEDIASTAT_NOTMOUNTED, OpenedHere);
-                break;
-            }
-            case CDS_AUDIO:
-                VERBOSE(VB_MEDIA, "found an audio disk");
-                m_MediaType = MEDIATYPE_AUDIO;
-                return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                break;
-            case CDS_MIXED:
-                m_MediaType = MEDIATYPE_MIXED;
-                VERBOSE(VB_MEDIA, "found a mixed CD");
-                // Note: Mixed mode CDs require an explixit mount call
-                //       since we'll usually want the audio portion.
-                // undefine ASSUME_WANT_AUDIO to change this behavior.
-                #ifdef ASSUME_WANT_AUDIO
-                    return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                #else
-                    mount();
-                    if (isMounted())
-                    {
-                        // pretend we're NOTMOUNTED so setStatus
-                        // emits a signal
-                        m_Status = MEDIASTAT_NOTMOUNTED;
-                        return setStatus(MEDIASTAT_MOUNTED, OpenedHere);
-                    }
-                    else
-                    {
-                        return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                    }
-                #endif
-                break;
-            case CDS_NO_INFO:
-            case CDS_NO_DISC:
-                if (hasWritableMedia())
-                {
-                    VERBOSE(VB_MEDIA, "found a blank or writable disk");
-                    return setStatus(MEDIASTAT_UNFORMATTED, OpenedHere);
-                }
-
-                VERBOSE(VB_MEDIA, "found no disk");
-                m_MediaType = MEDIATYPE_UNKNOWN;
-                return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
-                break;
-            default:
-                VERBOSE(VB_MEDIA, "found unknown disk type: "
-                                  + QString().setNum(type));
-                m_MediaType = MEDIATYPE_UNKNOWN;
-                return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
-        }
-    }
-
-    if (m_AllowEject)
-        unlock();
-    else
-        lock();
-
-    if (OpenedHere)
-        closeDevice();
-
-    VERBOSE(VB_MEDIA+VB_EXTRA,
-            QString("Returning ")
-            + MythMediaDevice::MediaStatusStrings[m_Status]);
-    return m_Status;
+    return setStatus(MEDIASTAT_UNKNOWN, NULL);
 }
 
 MediaError MythCDROMLinux::lock()
 {
-    MediaError ret = MythMediaDevice::lock();
-    if (ret == MEDIAERR_OK)
-        ioctl(m_DeviceHandle, CDROM_LOCKDOOR, 1);
-
-    return ret;
+    return MEDIAERR_FAILED;
 }
 
 MediaError MythCDROMLinux::unlock()
 {
-    if (isDeviceOpen() || openDevice())
-    {
-        VERBOSE(VB_MEDIA+VB_EXTRA, LOC + ":unlock - Unlocking CDROM door");
-        ioctl(m_DeviceHandle, CDROM_LOCKDOOR, 0);
-    }
-    else
-    {
-        VERBOSE(VB_GENERAL, "Failed to open device, CDROM try will remain "
-                            "locked.");
-    }
-
-    return MythMediaDevice::unlock();
+    return MEDIAERR_FAILED;
 }
 
 bool MythCDROMLinux::isSameDevice(const QString &path)
 {
-    dev_t new_rdev;
-    struct stat sb;
-
-    if (stat(path.toLocal8Bit().constData(), &sb) < 0)
-    {
-        VERBOSE(VB_IMPORTANT, LOC + ":isSameDevice() -- " +
-                QString("Failed to stat '%1'")
-                .arg(path) + ENO);
-        return false;
-    }
-    new_rdev = sb.st_rdev;
-
-    // Check against m_DevicePath...
-    if (stat(m_DevicePath.toLocal8Bit().constData(), &sb) < 0)
-    {
-        VERBOSE(VB_IMPORTANT, LOC + ":isSameDevice() -- " +
-                QString("Failed to stat '%1'")
-                .arg(m_DevicePath) + ENO);
-        return false;
-    }
-    return (sb.st_rdev == new_rdev);
+    return false;
 }
 
 #if defined(SG_IO) && defined(GPCMD_SET_STREAMING)
@@ -626,119 +233,9 @@ bool MythCDROMLinux::isSameDevice(const QString &path)
  */
 void MythCDROMLinux::setSpeed(int speed)
 {
-    MythCDROMLinux::setSpeed(m_DevicePath.toLocal8Bit().constData(), speed);
 }
 
 void MythCDROMLinux::setSpeed(const char *device, int speed)
 {
-    int fd;
-    unsigned char buffer[28];
-    unsigned char cmd[16];
-    unsigned char sense[16];
-    struct sg_io_hdr sghdr;
-    struct stat st;
-    int rate = 0;
-
-    memset(&sghdr, 0, sizeof(sghdr));
-    memset(buffer, 0, sizeof(buffer));
-    memset(sense, 0, sizeof(sense));
-    memset(cmd, 0, sizeof(cmd));
-    memset(&st, 0, sizeof(st));
-
-    if ((fd = open(device, O_RDWR | O_NONBLOCK)) == -1)
-    {
-        VERBOSE(VB_MEDIA, LOC_ERR + "Changing CD/DVD speed needs write access");
-        return;
-    }
-
-    if (fstat(fd, &st) == -1)
-    {
-        close(fd);
-        VERBOSE(VB_MEDIA, LOC_ERR +
-                QString("setSpeed() Failed. device %1 not found")
-                .arg(device));
-        return;
-    }
-
-    if (!S_ISBLK(st.st_mode))
-    {
-        close(fd);
-        VERBOSE(VB_MEDIA, LOC_ERR + "setSpeed() Failed. Not a block device");
-        return;
-    }
-
-    if (speed < 0)
-        speed = -1;
-
-    switch(speed)
-    {
-        case 0: // don't touch speed setting
-            close(fd);
-            return;
-        case -1: // restore default value
-        {
-            rate = 0;
-            buffer[0] = 4;
-            VERBOSE(VB_MEDIA, LOC + ":setSpeed() - Restored CD/DVD Speed");
-            break;
-        }
-        default:
-        {
-            // Speed in Kilobyte/Second. 177KB/s is the maximum data rate
-            // for standard Audio CD's.
-
-            rate = (speed > 0 && speed < 100) ? speed * 177 : speed;
-
-            VERBOSE(VB_MEDIA,
-                    (LOC + ":setSpeed() - Limiting CD/DVD Speed to %1KB/s")
-                    .arg(rate));
-            break;
-        }
-    }
-
-    sghdr.interface_id = 'S';
-    sghdr.timeout = 5000;
-    sghdr.dxfer_direction = SG_DXFER_TO_DEV;
-    sghdr.mx_sb_len = sizeof(sense);
-    sghdr.dxfer_len = sizeof(buffer);
-    sghdr.cmd_len = sizeof(cmd);
-    sghdr.sbp = sense;
-    sghdr.dxferp = buffer;
-    sghdr.cmdp = cmd;
-
-    cmd[0] = GPCMD_SET_STREAMING;
-    cmd[10] = sizeof(buffer);
-
-    buffer[8]  = 0xff;
-    buffer[9]  = 0xff;
-    buffer[10] = 0xff;
-    buffer[11] = 0xff;
-
-    buffer[12] = buffer[20] = (rate >> 24) & 0xff;
-    buffer[13] = buffer[21] = (rate >> 16) & 0xff;
-    buffer[14] = buffer[22] = (rate >> 8)  & 0xff;
-    buffer[15] = buffer[23] = rate & 0xff;
-
-    // Note: 0x3e8 == 1000, hence speed = data amount per 1000 milliseconds.
-    buffer[18] = buffer[26] = 0x03;
-    buffer[19] = buffer[27] = 0xe8;
-
-    if (ioctl(fd, SG_IO, &sghdr) < 0)
-    {
-        VERBOSE(VB_MEDIA, LOC_ERR + "Limit CD/DVD Speed Failed");
-    }
-    else
-    {
-        // On my system (2.6.18 + ide-cd),  SG_IO succeeds without doing anything,
-        // while CDROM_SELECT_SPEED works...
-        if (ioctl(fd, CDROM_SELECT_SPEED, speed) < 0)
-        {
-            VERBOSE(VB_MEDIA, LOC_ERR +
-                    "Limit CD/DVD CDROM_SELECT_SPEED Failed");
-        }
-        VERBOSE(VB_MEDIA, LOC + ":setSpeed() - CD/DVD Speed Set Successful");
-    }
-
-    close(fd);
 }
 #endif

mythdisplay.cpp.patch

diff --git a/mythtv/libs/libmythui/mythdisplay.cpp b/mythtv/libs/libmythui/mythdisplay.cpp
index 5de158a..b936e86 100644
--- a/mythtv/libs/libmythui/mythdisplay.cpp
+++ b/mythtv/libs/libmythui/mythdisplay.cpp
@@ -77,7 +77,7 @@
         ret.res    = QSize((uint)width, (uint)height);
     }
 
-#elif defined (Q_WS_X11)
+#elif 0 //defined (Q_WS_X11)
     MythXDisplay *disp = OpenMythXDisplay();
     if (!disp)
         return ret;

mythxdisplay.cpp.patch

thanks to FourG and vinsanity

diff --git a/mythtv/libs/libmythui/mythxdisplay.cpp b/mythtv/libs/libmythui/mythxdisplay.cpp
index 86fbe47..f632e0c 100644
--- a/mythtv/libs/libmythui/mythxdisplay.cpp
+++ b/mythtv/libs/libmythui/mythxdisplay.cpp
@@ -11,10 +11,6 @@
 #ifndef V_INTERLACE
 #define V_INTERLACE (0x010)
 #endif
-extern "C" {
-#include <X11/extensions/Xinerama.h>
-#include <X11/extensions/xf86vmode.h>
-}
 typedef int (*XErrorCallbackType)(Display *, XErrorEvent *);
 typedef std::vector<XErrorEvent>       XErrorVectorType;
 std::map<Display*, XErrorVectorType>   xerrors;
@@ -36,20 +32,6 @@ int GetNumberXineramaScreens(void)
 {
     int nr_xinerama_screens = 0;
 
-#ifdef USING_X11
-    MythXDisplay *d = OpenMythXDisplay();
-    if (d)
-    {
-        nr_xinerama_screens = d->GetNumberXineramaScreens();
-        delete d;
-    }
-#else // if !USING_X11
-#if CONFIG_DARWIN
-    // Mac OS X when not using X11 server supports Xinerama.
-    if (QApplication::desktop())
-        nr_xinerama_screens = QApplication::desktop()->numScreens();
-#endif // CONFIG_DARWIN
-#endif // !USING_X11
     return nr_xinerama_screens;
 }
 
@@ -197,14 +179,7 @@ void MythXDisplay::MoveResizeWin(Window win, const QRect &rect)

 int MythXDisplay::GetNumberXineramaScreens(void)
 {
-    MythXLocker locker(this);
     int nr_xinerama_screens = 0;
-    int event_base = 0, error_base = 0;
-    if (XineramaQueryExtension(m_disp, &event_base, &error_base) &&
-        XineramaIsActive(m_disp))
-    {
-        XFree(XineramaQueryScreens(m_disp, &nr_xinerama_screens));
-    }
     return nr_xinerama_screens;
 }

@@ -226,39 +201,8 @@ QSize MythXDisplay::GetDisplayDimensions(void)
 
 float MythXDisplay::GetRefreshRate(void)
 {
-    XF86VidModeModeLine mode_line;
-    int dot_clock;
-    MythXLocker locker(this);
-
-    if (!XF86VidModeGetModeLine(m_disp, m_screen_num, &dot_clock, &mode_line))
-    {
-        VERBOSE(VB_IMPORTANT, "MythXGetRefreshRate(): "
-                              "X11 ModeLine query failed");
-        return -1;
-    }
-
-    double rate = mode_line.htotal * mode_line.vtotal;
-
-    // Catch bad data from video drivers (divide by zero causes return of NaN)
-    if (rate == 0.0 || dot_clock == 0)
-    {
-        VERBOSE(VB_IMPORTANT, "MythXGetRefreshRate(): "
-                "X11 ModeLine query returned zeroes");
-        return -1;
-    }
-
-    rate = (dot_clock * 1000.0) / rate;
-
-    if (((mode_line.flags & V_INTERLACE) != 0) &&
-        rate > 24.5 && rate < 30.5)
-    {
-        VERBOSE(VB_PLAYBACK, "MythXGetRefreshRate(): "
-                "Doubling refresh rate for interlaced display.");
-        rate *= 2.0;
-    }
-
+    double rate = 60;
     // Assume 60Hz if rate isn't good:
-    if (rate < 20 || rate > 200)
     {
         VERBOSE(VB_PLAYBACK, QString("MythXGetRefreshRate(): "
                 "Unreasonable refresh rate %1Hz reported by X").arg(rate));

cpsvndir.patch

(not needed if installed ipkgs findutils, gawk, sed, and grep?)

thanks to FourG

diff --git a/mythtv/themes/cpsvndir b/mythtv/themes/cpsvndir
index 8486a61..c707415 100644
--- a/mythtv/themes/cpsvndir
+++ b/mythtv/themes/cpsvndir
@@ -45,7 +45,8 @@ fi
 
 # Copy all files and directories except .svn
 cd "$SRC"
-for file in $(find . -name .svn -prune -or -print); do
+#for file in $(find . -name .svn -prune -or -print); do
+for file in $(ls -a); do
     #echo "processing $file"
     if [ -d "$file" -a ! -L "$file" ]; then
         mkdir -p "$DEST/$file"

Mythtv 0.25.1 patch

includes patches for:

  • configure
  • mythcdrom-linux.cpp
  • mythxdisplay.cpp
  • cpsvndir (not needed if installed ipkgs findutils, gawk, sed, and grep?)

(mythdisplay.cpp patch above is incorporated into 0.25.1)

diff -Naur mythtv-0.25.1_org/configure mythtv-0.25.1/configure
--- mythtv-0.25.1_org/configure	2012-06-04 09:29:18.000000000 -0400
+++ mythtv-0.25.1/configure	2012-06-30 06:53:54.264778940 -0400
@@ -358,7 +358,6 @@
 
 log_file(){
     log BEGIN $1
-    pr -n -t $1 >> $logfile
     log END $1
 }
 
@@ -2367,8 +2366,8 @@
 fi
 
 tmpfile(){
-    tmp=$(mktemp -u "${TMPDIR}/mythtv_conf.XXXXXXXX")$2 &&
-        (set -C; exec > $tmp) 2>/dev/null ||
+    tmp=$(mktemp "${TMPDIR}/mythtv_conf.XXXXXXXX")$2 &&
+        (set -C; exec >> $tmp) 2>/dev/null ||
         die "Unable to create temporary file in $TMPDIR."
     append TMPFILES $tmp
     eval $1=$tmp
@@ -4190,8 +4189,6 @@
 enabled xv && check_lib X11/extensions/Xv.h XvPutStill -lXv || disable xv
 
 if enabled x11; then
-    require libXxf86vm X11/extensions/xf86vmode.h XF86VidModeSetClientVersion -lXxf86vm
-    require libXinerama X11/extensions/Xinerama.h XineramaQueryExtension -lXinerama
     require libXext X11/extensions/Xext.h XMissingExtension -lXext
 fi
diff -Naur mythtv-0.25.1_org/libs/libmythbase/mythcdrom-linux.cpp mythtv-0.25.1/libs/libmythbase/mythcdrom-linux.cpp
--- mythtv-0.25.1_org/libs/libmythbase/mythcdrom-linux.cpp	2012-06-04 09:29:18.000000000 -0400
+++ mythtv-0.25.1/libs/libmythbase/mythcdrom-linux.cpp	2012-06-30 07:15:44.295433684 -0400
@@ -1,7 +1,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>       // ioctls
-#include <linux/cdrom.h>     // old ioctls for cdrom
 #include <scsi/sg.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -134,8 +133,10 @@
     virtual bool checkOK(void);
     virtual MythMediaStatus checkMedia(void);
     virtual MythMediaError eject(bool open_close = true);
+#if defined(SG_IO) && defined(GPCMD_SET_STREAMING)
     virtual void setSpeed(int speed);
     virtual void setSpeed(const char *device, int speed);
+#endif
     virtual bool isSameDevice(const QString &path);
     virtual MythMediaError lock(void);
     virtual MythMediaError unlock(void);
@@ -163,18 +164,7 @@
 
 int MythCDROMLinux::driveStatus()
 {
-    int drive_status = ioctl(m_DeviceHandle, CDROM_DRIVE_STATUS, CDSL_CURRENT);
-
-    if (drive_status == -1)   // Very unlikely, but we should check
-    {
-        LOG(VB_MEDIA, LOG_ERR, LOC + ":driveStatus() - ioctl failed: " + ENO);
-        return CDS_NO_INFO;
-    }
-
-    if (drive_status == CDS_TRAY_OPEN && m_DevicePath.contains("/dev/scd"))
-        return SCSIstatus();
-
-    return drive_status;
+    return 0;
 }
 
 /** \brief Is there blank or eraseable media in the drive?
@@ -182,46 +172,6 @@
 
 bool MythCDROMLinux::hasWritableMedia()
 {
-    unsigned char    buffer[32];
-    CDROMgenericCmd  cgc;
-    CDROMdiscInfo   *di;
-
-
-    memset(buffer, 0, sizeof(buffer));
-    memset(&cgc,   0, sizeof(cgc));
-
-    cgc.cmd[0] = GPCMD_READ_DISC_INFO;
-    cgc.cmd[8] = sizeof(buffer);
-    cgc.quiet  = 1;
-    cgc.buffer = buffer;
-    cgc.buflen = sizeof(buffer);
-    cgc.data_direction = CGC_DATA_READ;
-
-    if (ioctl(m_DeviceHandle, CDROM_SEND_PACKET, &cgc) < 0)
-    {
-        LOG(VB_MEDIA, LOG_ERR, LOC +
-            ":hasWritableMedia() - failed to send packet to " + m_DevicePath);
-        return false;
-    }
-
-    di = (CDROMdiscInfo *) buffer;
-
-    switch (di->disc_status)
-    {
-        case MEDIA_IS_EMPTY:
-            return true;
-
-        case MEDIA_IS_APPENDABLE:
-            // It is unlikely that any plugins will support multi-session
-            // writing, so we treat it just like a finished disc:
-
-        case MEDIA_IS_COMPLETE:
-            return di->erasable;
-
-        case MEDIA_IS_OTHER:
-            ;
-    }
-
     return false;
 }
 
@@ -235,413 +185,50 @@
 
 int MythCDROMLinux::SCSIstatus()
 {
-    unsigned char    buffer[8];
-    CDROMgenericCmd  cgc;
-    CDROMeventStatus *es;
-
-
-    memset(buffer, 0, sizeof(buffer));
-    memset(&cgc,   0, sizeof(cgc));
-
-    cgc.cmd[0] = GPCMD_GET_EVENT_STATUS_NOTIFICATION;
-    cgc.cmd[1] = 1;       // Tell us immediately
-    cgc.cmd[4] = 1 << 4;  // notification class of media
-    cgc.cmd[8] = sizeof(buffer);
-    cgc.quiet  = 1;
-    cgc.buffer = buffer;
-    cgc.buflen = sizeof(buffer);
-    cgc.data_direction = CGC_DATA_READ;
-
-    es = (CDROMeventStatus *) buffer;
-
-    if ((ioctl(m_DeviceHandle, CDROM_SEND_PACKET, &cgc) < 0)
-        || es->nea                           // drive does not support request
-        || (es->notification_class != 0x4))  // notification class mismatch
-    {
-        LOG(VB_MEDIA, LOG_ERR, LOC +
-            ":SCSIstatus() - failed to send SCSI packet to " + m_DevicePath);
-        return CDS_TRAY_OPEN;
-    }
-
-    if (es->media_present)
-    {
-        LOG(VB_MEDIA, LOG_DEBUG, LOC + 
-            ":SCSIstatus() - ioctl said tray was open, "
-            "but drive is actually closed with a disc");
-        return CDS_DISC_OK;
-    }
-    else if (es->door_open)
-    {
-        LOG(VB_MEDIA, LOG_DEBUG, LOC + 
-            ":SCSIstatus() - tray is definitely open");
-        return CDS_TRAY_OPEN;
-    }
-
-    LOG(VB_MEDIA, LOG_DEBUG, LOC + ":SCSIstatus() - ioctl said tray was open, "
-                                   "but drive is actually closed with no disc");
-    return CDS_NO_DISC;
+    return 0;
 }
 
 
 MythMediaError MythCDROMLinux::eject(bool open_close)
 {
-    if (!isDeviceOpen())
-    {
-        if (!openDevice())
-            return MEDIAERR_FAILED;
-    }
-
-    if (open_close)
-        return (ioctl(m_DeviceHandle, CDROMEJECT) == 0) ? MEDIAERR_OK
-                                                        : MEDIAERR_FAILED;
-    else
-    {
-        // If the tray is empty, this will fail (Input/Output error)
-        ioctl(m_DeviceHandle, CDROMCLOSETRAY);
-
-        // This allows us to catch any drives that the OS has problems
-        // detecting the status of (some always report OPEN when empty)
-        if (driveStatus() == CDS_TRAY_OPEN)
-            return MEDIAERR_FAILED;
-        else
-            return MEDIAERR_OK;
-    }
+    return MEDIAERR_FAILED;
 }
 
 
 bool MythCDROMLinux::mediaChanged()
 {
-    return (ioctl(m_DeviceHandle, CDROM_MEDIA_CHANGED, CDSL_CURRENT) > 0);
+    return 0;
 }
 
 bool MythCDROMLinux::checkOK()
 {
-    return (ioctl(m_DeviceHandle, CDROM_DRIVE_STATUS, CDSL_CURRENT) ==
-                  CDS_DISC_OK);
+    return 0;
 }
 
 // Helper function, perform a sanity check on the device
 MythMediaError MythCDROMLinux::testMedia()
 {
-    bool OpenedHere = false;
-    if (!isDeviceOpen())
-    {
-        if (!openDevice())
-        {
-            LOG(VB_MEDIA, LOG_DEBUG, LOC + ":testMedia - failed to open '" +
-                                     m_DevicePath +  "' : " +ENO);
-            if (errno == EBUSY)
-                return isMounted() ? MEDIAERR_OK : MEDIAERR_FAILED;
-            else
-                return MEDIAERR_FAILED;
-        }
-        LOG(VB_MEDIA, LOG_DEBUG, LOC + ":testMedia - Opened device");
-        OpenedHere = true;
-    }
-
-    // Since the device was is/was open we can get it's status...
-    int Stat = driveStatus();
-
-    // Be nice and close the device if we opened it,
-    // otherwise it might be locked when the user doesn't want it to be.
-    if (OpenedHere)
-        closeDevice();
-
-    if (Stat == -1)
-    {
-        LOG(VB_MEDIA, LOG_DEBUG, LOC + 
-            ":testMedia - Failed to get drive status of '" + m_DevicePath +
-            "' : " + ENO);
-        return MEDIAERR_FAILED;
-    }
-
-    return MEDIAERR_OK;
+    return MEDIAERR_FAILED;
 }
 
 MythMediaStatus MythCDROMLinux::checkMedia()
 {
-    bool OpenedHere = false;
-
-    // If it's not already open we need to at least
-    // TRY to open it for most of these checks to work.
-    if (!isDeviceOpen())
-    {
-        OpenedHere = openDevice();
-
-        if (!OpenedHere)
-        {
-            LOG(VB_MEDIA, LOG_ERR, LOC + 
-                ":checkMedia() - cannot open device '" + m_DevicePath + "' : " +
-                ENO + "- returning UNKNOWN");
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return setStatus(MEDIASTAT_UNKNOWN, false);
-        }
-    }
-
-    switch (driveStatus())
-    {
-        case CDS_DISC_OK:
-            LOG(VB_MEDIA, LOG_DEBUG, m_DevicePath + " Disk OK, type = " +
-                                     MediaTypeString(m_MediaType) );
-            // further checking is required
-            break;
-        case CDS_TRAY_OPEN:
-            LOG(VB_MEDIA, LOG_DEBUG, m_DevicePath + " Tray open or no disc");
-            // First, send a message to the
-            // plugins to forget the current media type
-            setStatus(MEDIASTAT_OPEN, OpenedHere);
-            // then "clear out" this device
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return MEDIASTAT_OPEN;
-            break;
-        case CDS_NO_DISC:
-            LOG(VB_MEDIA, LOG_DEBUG, m_DevicePath + " No disc");
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return setStatus(MEDIASTAT_NODISK, OpenedHere);
-            break;
-        case CDS_NO_INFO:
-        case CDS_DRIVE_NOT_READY:
-            LOG(VB_MEDIA, LOG_DEBUG, m_DevicePath + 
-                                     " No info or drive not ready");
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
-        default:
-            LOG(VB_GENERAL, LOG_ERR, "Failed to get drive status of " +
-                m_DevicePath + " : " + ENO);
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
-    }
-
-    if (mediaChanged())
-    {
-        LOG(VB_MEDIA, LOG_INFO, m_DevicePath + " Media changed");
-        // Regardless of the actual status lie here and say
-        // it's open for now, so we can cover the case of a missed open.
-        return setStatus(MEDIASTAT_OPEN, OpenedHere);
-    }
-
-
-    if (isUsable())
-    {
-        LOG(VB_MEDIA, LOG_DEBUG, "Disc useable, media unchanged. All good!");
-        if (OpenedHere)
-            closeDevice();
-        return MEDIASTAT_USEABLE;
-    }
-
-    // If we have tried to mount and failed, don't keep trying
-    if (m_Status == MEDIASTAT_ERROR)
-    {
-        LOG(VB_MEDIA, LOG_DEBUG, "Disc is unmountable?");
-        if (OpenedHere)
-            closeDevice();
-        return m_Status;
-    }
-
-    if ((m_Status == MEDIASTAT_OPEN) ||
-        (m_Status == MEDIASTAT_UNKNOWN))
-    {
-        LOG(VB_MEDIA, LOG_INFO, m_DevicePath + " Current status " +
-                MythMediaDevice::MediaStatusStrings[m_Status]);
-        int type = ioctl(m_DeviceHandle, CDROM_DISC_STATUS, CDSL_CURRENT);
-        switch (type)
-        {
-            case CDS_DATA_1:
-            case CDS_DATA_2:
-            {
-                m_MediaType = MEDIATYPE_DATA;
-                LOG(VB_MEDIA, LOG_INFO, "Found a data disk");
-
-                //grab information from iso9660 (& udf)
-                off_t sr = lseek(m_DeviceHandle,
-                                 (off_t) 2048*16, SEEK_SET);
-
-                struct iso_primary_descriptor buf;
-                ssize_t readin = 0;
-                while ((sr != (off_t) -1) && (readin < 2048))
-                {
-                    ssize_t rr = read(
-                        m_DeviceHandle, ((char*)&buf) + readin, 2048 - readin);
-                    if ((rr < 0) && ((EAGAIN == errno) || (EINTR == errno)))
-                        continue;
-                    else if (rr < 0)
-                        break;
-                    readin += rr;
-                }
-
-                if (readin == 2048)
-                {
-                    m_VolumeID = QString(buf.volume_id).trimmed();
-                    m_KeyID = QString("%1%2")
-                        .arg(m_VolumeID)
-                        .arg(QString(buf.creation_date).left(16));
-                }
-                else
-                {
-                    m_VolumeID = "UNKNOWN";
-                    m_KeyID = m_VolumeID +
-                        QDateTime::currentDateTime().toString(Qt::ISODate);
-                }
-
-                LOG(VB_MEDIA, LOG_INFO,
-                    QString("Volume ID: %1").arg(m_VolumeID));
-#ifdef USING_LIBUDF
-                // Check for a DVD/BD disk by reading the UDF root dir.
-                // This allows DVD's to play immediately upon insertion without
-                // calling mount, which either needs pmount or changes to fstab.
-                udf_t *pUdf = udf_open(m_DevicePath.toAscii());
-                if (NULL != pUdf)
-                {
-                    udf_dirent_t *pUdfRoot = udf_get_root(pUdf, true, 0);
-                    if (NULL != pUdfRoot)
-                    {
-                        if (NULL != udf_fopen(pUdfRoot, "VIDEO_TS"))
-                            m_MediaType = MEDIATYPE_DVD;
-                        else if (NULL != udf_fopen(pUdfRoot, "BDMV"))
-                            m_MediaType = MEDIATYPE_BD;
-
-                        udf_dirent_free(pUdfRoot);
-                    }
-                    udf_close(pUdf);
-
-                    if (MEDIATYPE_DATA != m_MediaType)
-                    {
-                        // pretend we're NOTMOUNTED so setStatus emits a signal
-                        m_Status = MEDIASTAT_NOTMOUNTED;
-                        return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                    }
-                }
-#endif
-                // the base class's onDeviceMounted will do fine
-                // grained detection of the type of data on this disc
-                if (isMounted())
-                    onDeviceMounted();
-                else if (!mount()) // onDeviceMounted() called as side-effect
-                    return setStatus(MEDIASTAT_ERROR, OpenedHere);
-
-                if (isMounted())
-                {
-                    // pretend we're NOTMOUNTED so setStatus emits a signal
-                    m_Status = MEDIASTAT_NOTMOUNTED;
-                    return setStatus(MEDIASTAT_MOUNTED, OpenedHere);
-                }
-                else if (m_MediaType == MEDIATYPE_DVD)
-                {
-                    // pretend we're NOTMOUNTED so setStatus emits a signal
-                    m_Status = MEDIASTAT_NOTMOUNTED;
-                    return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                }
-                else
-                    return setStatus(MEDIASTAT_NOTMOUNTED, OpenedHere);
-                break;
-            }
-            case CDS_AUDIO:
-                LOG(VB_MEDIA, LOG_DEBUG, "found an audio disk");
-                m_MediaType = MEDIATYPE_AUDIO;
-                return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                break;
-            case CDS_MIXED:
-                m_MediaType = MEDIATYPE_MIXED;
-                LOG(VB_MEDIA, LOG_DEBUG, "found a mixed CD");
-                // Note: Mixed mode CDs require an explixit mount call
-                //       since we'll usually want the audio portion.
-                // undefine ASSUME_WANT_AUDIO to change this behavior.
-                #ifdef ASSUME_WANT_AUDIO
-                    return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                #else
-                    mount();
-                    if (isMounted())
-                    {
-                        // pretend we're NOTMOUNTED so setStatus
-                        // emits a signal
-                        m_Status = MEDIASTAT_NOTMOUNTED;
-                        return setStatus(MEDIASTAT_MOUNTED, OpenedHere);
-                    }
-                    else
-                    {
-                        return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                    }
-                #endif
-                break;
-            case CDS_NO_INFO:
-            case CDS_NO_DISC:
-                if (hasWritableMedia())
-                {
-                    LOG(VB_MEDIA, LOG_DEBUG, "found a blank or writable disk");
-                    return setStatus(MEDIASTAT_UNFORMATTED, OpenedHere);
-                }
-
-                LOG(VB_MEDIA, LOG_DEBUG, "found no disk");
-                m_MediaType = MEDIATYPE_UNKNOWN;
-                return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
-                break;
-            default:
-                LOG(VB_MEDIA, LOG_DEBUG, "found unknown disk type: " +
-                                         QString::number(type));
-                m_MediaType = MEDIATYPE_UNKNOWN;
-                return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
-        }
-    }
-
-    if (m_AllowEject)
-        unlock();
-    else
-        lock();
-
-    if (OpenedHere)
-        closeDevice();
-
-    LOG(VB_MEDIA, LOG_DEBUG, QString("Returning %1")
-                           .arg(MythMediaDevice::MediaStatusStrings[m_Status]));
-    return m_Status;
+    return setStatus(MEDIASTAT_UNKNOWN, NULL);
 }
 
 MythMediaError MythCDROMLinux::lock()
 {
-    MythMediaError ret = MythMediaDevice::lock();
-    if (ret == MEDIAERR_OK)
-        ioctl(m_DeviceHandle, CDROM_LOCKDOOR, 1);
-
-    return ret;
+    return MEDIAERR_FAILED;
 }
 
 MythMediaError MythCDROMLinux::unlock()
 {
-    if (isDeviceOpen() || openDevice())
-    {
-        LOG(VB_MEDIA, LOG_DEBUG, LOC + ":unlock - Unlocking CDROM door");
-        ioctl(m_DeviceHandle, CDROM_LOCKDOOR, 0);
-    }
-    else
-    {
-        LOG(VB_GENERAL, LOG_INFO, "Failed to open device, CDROM try will "
-                                  "remain locked.");
-    }
-
-    return MythMediaDevice::unlock();
+    return MEDIAERR_FAILED;
 }
 
 bool MythCDROMLinux::isSameDevice(const QString &path)
 {
-    dev_t new_rdev;
-    struct stat sb;
-
-    if (stat(path.toLocal8Bit().constData(), &sb) < 0)
-    {
-        LOG(VB_GENERAL, LOG_ERR, LOC + ":isSameDevice() -- " +
-            QString("Failed to stat '%1'").arg(path) + ENO);
-        return false;
-    }
-    new_rdev = sb.st_rdev;
-
-    // Check against m_DevicePath...
-    if (stat(m_DevicePath.toLocal8Bit().constData(), &sb) < 0)
-    {
-        LOG(VB_GENERAL, LOG_ERR, LOC + ":isSameDevice() -- " +
-            QString("Failed to stat '%1'").arg(m_DevicePath) + ENO);
-        return false;
-    }
-    return (sb.st_rdev == new_rdev);
+    return false;
 }
 
 #if defined(SG_IO) && defined(GPCMD_SET_STREAMING)
@@ -650,121 +237,9 @@
  */
 void MythCDROMLinux::setSpeed(int speed)
 {
-    MythCDROMLinux::setSpeed(m_DevicePath.toLocal8Bit().constData(), speed);
 }
 
 void MythCDROMLinux::setSpeed(const char *device, int speed)
 {
-    int fd;
-    unsigned char buffer[28];
-    unsigned char cmd[16];
-    unsigned char sense[16];
-    struct sg_io_hdr sghdr;
-    struct stat st;
-    int rate = 0;
-
-    memset(&sghdr, 0, sizeof(sghdr));
-    memset(buffer, 0, sizeof(buffer));
-    memset(sense, 0, sizeof(sense));
-    memset(cmd, 0, sizeof(cmd));
-    memset(&st, 0, sizeof(st));
-
-    if ((fd = open(device, O_RDWR | O_NONBLOCK)) == -1)
-    {
-        LOG(VB_MEDIA, LOG_ERR, LOC + 
-            " Changing CD/DVD speed needs write access");
-        return;
-    }
-
-    if (fstat(fd, &st) == -1)
-    {
-        close(fd);
-        LOG(VB_MEDIA, LOG_ERR, LOC +
-            QString(":setSpeed() Failed. device %1 not found") .arg(device));
-        return;
-    }
-
-    if (!S_ISBLK(st.st_mode))
-    {
-        close(fd);
-        LOG(VB_MEDIA, LOG_ERR, LOC + ":setSpeed() Failed. Not a block device");
-        return;
-    }
-
-    if (speed < 0)
-        speed = -1;
-
-    switch(speed)
-    {
-        case 0: // don't touch speed setting
-            close(fd);
-            return;
-        case -1: // restore default value
-        {
-            rate = 0;
-            buffer[0] = 4;
-            LOG(VB_MEDIA, LOG_INFO, LOC + 
-                ":setSpeed() - Restored CD/DVD Speed");
-            break;
-        }
-        default:
-        {
-            // Speed in Kilobyte/Second. 177KB/s is the maximum data rate
-            // for standard Audio CD's.
-
-            rate = (speed > 0 && speed < 100) ? speed * 177 : speed;
-
-            LOG(VB_MEDIA, LOG_INFO, LOC +
-                QString(":setSpeed() - Limiting CD/DVD Speed to %1KB/s")
-                    .arg(rate));
-            break;
-        }
-    }
-
-    sghdr.interface_id = 'S';
-    sghdr.timeout = 5000;
-    sghdr.dxfer_direction = SG_DXFER_TO_DEV;
-    sghdr.mx_sb_len = sizeof(sense);
-    sghdr.dxfer_len = sizeof(buffer);
-    sghdr.cmd_len = sizeof(cmd);
-    sghdr.sbp = sense;
-    sghdr.dxferp = buffer;
-    sghdr.cmdp = cmd;
-
-    cmd[0] = GPCMD_SET_STREAMING;
-    cmd[10] = sizeof(buffer);
-
-    buffer[8]  = 0xff;
-    buffer[9]  = 0xff;
-    buffer[10] = 0xff;
-    buffer[11] = 0xff;
-
-    buffer[12] = buffer[20] = (rate >> 24) & 0xff;
-    buffer[13] = buffer[21] = (rate >> 16) & 0xff;
-    buffer[14] = buffer[22] = (rate >> 8)  & 0xff;
-    buffer[15] = buffer[23] = rate & 0xff;
-
-    // Note: 0x3e8 == 1000, hence speed = data amount per 1000 milliseconds.
-    buffer[18] = buffer[26] = 0x03;
-    buffer[19] = buffer[27] = 0xe8;
-
-    if (ioctl(fd, SG_IO, &sghdr) < 0)
-    {
-        LOG(VB_MEDIA, LOG_ERR, LOC + " Limit CD/DVD Speed Failed");
-    }
-    else
-    {
-        // On my system (2.6.18+ide-cd), SG_IO succeeds without doing anything,
-        // while CDROM_SELECT_SPEED works...
-        if (ioctl(fd, CDROM_SELECT_SPEED, speed) < 0)
-        {
-            LOG(VB_MEDIA, LOG_ERR, LOC + 
-                " Limit CD/DVD CDROM_SELECT_SPEED Failed");
-        }
-        LOG(VB_MEDIA, LOG_INFO, LOC +
-            ":setSpeed() - CD/DVD Speed Set Successful");
-    }
-
-    close(fd);
 }
 #endif
diff -Naur mythtv-0.25.1_org/libs/libmythui/mythxdisplay.cpp mythtv-0.25.1/libs/libmythui/mythxdisplay.cpp
--- mythtv-0.25.1_org/libs/libmythui/mythxdisplay.cpp	2012-06-04 09:29:18.000000000 -0400
+++ mythtv-0.25.1/libs/libmythui/mythxdisplay.cpp	2012-06-30 10:11:35.490709525 -0400
@@ -11,10 +11,6 @@
 #ifndef V_INTERLACE
 #define V_INTERLACE (0x010)
 #endif
-extern "C" {
-#include <X11/extensions/Xinerama.h>
-#include <X11/extensions/xf86vmode.h>
-}
 typedef int (*XErrorCallbackType)(Display *, XErrorEvent *);
 typedef std::vector<XErrorEvent>       XErrorVectorType;
 std::map<Display*, XErrorVectorType>   xerrors;
@@ -144,14 +140,7 @@
 
 int MythXDisplay::GetNumberXineramaScreens(void)
 {
-    MythXLocker locker(this);
     int nr_xinerama_screens = 0;
-    int event_base = 0, error_base = 0;
-    if (XineramaQueryExtension(m_disp, &event_base, &error_base) &&
-        XineramaIsActive(m_disp))
-    {
-        XFree(XineramaQueryScreens(m_disp, &nr_xinerama_screens));
-    }
     return nr_xinerama_screens;
 }
 
@@ -173,35 +162,7 @@
 
 float MythXDisplay::GetRefreshRate(void)
 {
-    XF86VidModeModeLine mode_line;
-    int dot_clock;
-    MythXLocker locker(this);
-
-    if (!XF86VidModeGetModeLine(m_disp, m_screen_num, &dot_clock, &mode_line))
-    {
-        LOG(VB_GENERAL, LOG_ERR, "X11 ModeLine query failed");
-        return -1;
-    }
-
-    double rate = mode_line.htotal * mode_line.vtotal;
-
-    // Catch bad data from video drivers (divide by zero causes return of NaN)
-    if (rate == 0.0 || dot_clock == 0)
-    {
-        LOG(VB_GENERAL, LOG_ERR, "X11 ModeLine query returned zeroes");
-        return -1;
-    }
-
-    rate = (dot_clock * 1000.0) / rate;
-
-    if (((mode_line.flags & V_INTERLACE) != 0) &&
-        rate > 24.5 && rate < 30.5)
-    {
-        LOG(VB_PLAYBACK, LOG_INFO,
-                "Doubling refresh rate for interlaced display.");
-        rate *= 2.0;
-    }
-
+    double rate = 60;
     return rate;
 }
 
 diff -Naur mythtv-0.25.1_org/themes/cpsvndir mythtv-0.25.1/themes/cpsvndir
--- mythtv-0.25.1_org/themes/cpsvndir	2012-06-04 09:29:18.000000000 -0400
+++ mythtv-0.25.1/themes/cpsvndir	2012-06-30 07:39:54.266158308 -0400
@@ -45,7 +45,8 @@
 
 # Copy all files and directories except .svn
 cd "$SRC"
-for file in $(find . -name .svn -prune -or -print); do
+#for file in $(find . -name .svn -prune -or -print); do
+for file in $(ls -a); do
     #echo "processing $file"
     if [ -d "$file" -a ! -L "$file" ]; then
         mkdir -p "$DEST/$file"

MythTV 0.26 pre patch (master as of 7/1/12)

patch below to mythtv/programs/mythtranscode/transcode.cpp isn't required for code past July 16, 2012.  Refer to the patch here.

diff --git a/mythtv/configure b/mythtv/configure
index 5b6d69b..bc3c5c1 100755
--- a/mythtv/configure
+++ b/mythtv/configure
@@ -388,7 +388,6 @@ log(){
 
 log_file(){
     log BEGIN $1
-    pr -n -t $1 >> $logfile
     log END $1
 }
 
@@ -2583,7 +2582,7 @@ fi
 
 tmpfile(){
     tmp=$(mktemp -u "${TMPDIR}/mythtv_conf.XXXXXXXX")$2 &&
-        (set -C; exec > $tmp) 2>/dev/null ||
+        (set -C; exec >> $tmp) 2>/dev/null ||
         die "Unable to create temporary file in $TMPDIR."
     append TMPFILES $tmp
     eval $1=$tmp
@@ -4576,8 +4575,6 @@ enabled xrandr && check_lib X11/extensions/Xrandr.h XRRSelectInput -lXrandr || d
 enabled xv && check_lib X11/extensions/Xv.h XvPutStill -lXv || disable xv
 
 if enabled x11; then
-    require libXxf86vm X11/extensions/xf86vmode.h XF86VidModeSetClientVersion -lXxf86vm
-    require libXinerama X11/extensions/Xinerama.h XineramaQueryExtension -lXinerama
     require libXext X11/extensions/Xext.h XMissingExtension -lXext
 fi
 
diff --git a/mythtv/libs/libmythbase/mythcdrom-linux.cpp b/mythtv/libs/libmythbase/mythcdrom-linux.cpp
index b6ae493..ea2a2e8 100644
--- a/mythtv/libs/libmythbase/mythcdrom-linux.cpp
+++ b/mythtv/libs/libmythbase/mythcdrom-linux.cpp
@@ -1,7 +1,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>       // ioctls
-#include <linux/cdrom.h>     // old ioctls for cdrom
 #include <scsi/sg.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -136,8 +135,10 @@ public:
     virtual bool checkOK(void);
     virtual MythMediaStatus checkMedia(void);
     virtual MythMediaError eject(bool open_close = true);
+#if defined(SG_IO) && defined(GPCMD_SET_STREAMING)
     virtual void setSpeed(int speed);
     virtual void setSpeed(const char *device, int speed);
+#endif
     virtual bool isSameDevice(const QString &path);
     virtual MythMediaError lock(void);
     virtual MythMediaError unlock(void);
@@ -165,18 +166,7 @@ MythCDROM *GetMythCDROMLinux(QObject* par, const char* devicePath,
 
 int MythCDROMLinux::driveStatus()
 {
-    int drive_status = ioctl(m_DeviceHandle, CDROM_DRIVE_STATUS, CDSL_CURRENT);
-
-    if (drive_status == -1)   // Very unlikely, but we should check
-    {
-        LOG(VB_MEDIA, LOG_ERR, LOC + ":driveStatus() - ioctl failed: " + ENO);
-        return CDS_NO_INFO;
-    }
-
-    if (drive_status == CDS_TRAY_OPEN && m_DevicePath.contains("/dev/scd"))
-        return SCSIstatus();
-
-    return drive_status;
+    return 0;
 }
 
 /** \brief Is there blank or eraseable media in the drive?
@@ -184,46 +174,6 @@ int MythCDROMLinux::driveStatus()
 
 bool MythCDROMLinux::hasWritableMedia()
 {
-    unsigned char    buffer[32];
-    CDROMgenericCmd  cgc;
-    CDROMdiscInfo   *di;
-
-
-    memset(buffer, 0, sizeof(buffer));
-    memset(&cgc,   0, sizeof(cgc));
-
-    cgc.cmd[0] = GPCMD_READ_DISC_INFO;
-    cgc.cmd[8] = sizeof(buffer);
-    cgc.quiet  = 1;
-    cgc.buffer = buffer;
-    cgc.buflen = sizeof(buffer);
-    cgc.data_direction = CGC_DATA_READ;
-
-    if (ioctl(m_DeviceHandle, CDROM_SEND_PACKET, &cgc) < 0)
-    {
-        LOG(VB_MEDIA, LOG_ERR, LOC +
-            ":hasWritableMedia() - failed to send packet to " + m_DevicePath);
-        return false;
-    }
-
-    di = (CDROMdiscInfo *) buffer;
-
-    switch (di->disc_status)
-    {
-        case MEDIA_IS_EMPTY:
-            return true;
-
-        case MEDIA_IS_APPENDABLE:
-            // It is unlikely that any plugins will support multi-session
-            // writing, so we treat it just like a finished disc:
-
-        case MEDIA_IS_COMPLETE:
-            return di->erasable;
-
-        case MEDIA_IS_OTHER:
-            ;
-    }
-
     return false;
 }
 
@@ -237,412 +187,50 @@ bool MythCDROMLinux::hasWritableMedia()
 
 int MythCDROMLinux::SCSIstatus()
 {
-    unsigned char    buffer[8];
-    CDROMgenericCmd  cgc;
-    CDROMeventStatus *es;
-
-
-    memset(buffer, 0, sizeof(buffer));
-    memset(&cgc,   0, sizeof(cgc));
-
-    cgc.cmd[0] = GPCMD_GET_EVENT_STATUS_NOTIFICATION;
-    cgc.cmd[1] = 1;       // Tell us immediately
-    cgc.cmd[4] = 1 << 4;  // notification class of media
-    cgc.cmd[8] = sizeof(buffer);
-    cgc.quiet  = 1;
-    cgc.buffer = buffer;
-    cgc.buflen = sizeof(buffer);
-    cgc.data_direction = CGC_DATA_READ;
-
-    es = (CDROMeventStatus *) buffer;
-
-    if ((ioctl(m_DeviceHandle, CDROM_SEND_PACKET, &cgc) < 0)
-        || es->nea                           // drive does not support request
-        || (es->notification_class != 0x4))  // notification class mismatch
-    {
-        LOG(VB_MEDIA, LOG_ERR, LOC +
-            ":SCSIstatus() - failed to send SCSI packet to " + m_DevicePath);
-        return CDS_TRAY_OPEN;
-    }
-
-    if (es->media_present)
-    {
-        LOG(VB_MEDIA, LOG_DEBUG, LOC + 
-            ":SCSIstatus() - ioctl said tray was open, "
-            "but drive is actually closed with a disc");
-        return CDS_DISC_OK;
-    }
-    else if (es->door_open)
-    {
-        LOG(VB_MEDIA, LOG_DEBUG, LOC + 
-            ":SCSIstatus() - tray is definitely open");
-        return CDS_TRAY_OPEN;
-    }
-
-    LOG(VB_MEDIA, LOG_DEBUG, LOC + ":SCSIstatus() - ioctl said tray was open, "
-                                   "but drive is actually closed with no disc");
-    return CDS_NO_DISC;
+    return 0;
 }
 
 
 MythMediaError MythCDROMLinux::eject(bool open_close)
 {
-    if (!isDeviceOpen())
-    {
-        if (!openDevice())
-            return MEDIAERR_FAILED;
-    }
-
-    if (open_close)
-        return (ioctl(m_DeviceHandle, CDROMEJECT) == 0) ? MEDIAERR_OK
-                                                        : MEDIAERR_FAILED;
-    else
-    {
-        // If the tray is empty, this will fail (Input/Output error)
-        ioctl(m_DeviceHandle, CDROMCLOSETRAY);
-
-        // This allows us to catch any drives that the OS has problems
-        // detecting the status of (some always report OPEN when empty)
-        if (driveStatus() == CDS_TRAY_OPEN)
-            return MEDIAERR_FAILED;
-        else
-            return MEDIAERR_OK;
-    }
+    return MEDIAERR_FAILED;
 }
 
 
 bool MythCDROMLinux::mediaChanged()
 {
-    return (ioctl(m_DeviceHandle, CDROM_MEDIA_CHANGED, CDSL_CURRENT) > 0);
+    return 0;
 }
 
 bool MythCDROMLinux::checkOK()
 {
-    return (ioctl(m_DeviceHandle, CDROM_DRIVE_STATUS, CDSL_CURRENT) ==
-                  CDS_DISC_OK);
+    return 0;
 }
 
 // Helper function, perform a sanity check on the device
 MythMediaError MythCDROMLinux::testMedia()
 {
-    bool OpenedHere = false;
-    if (!isDeviceOpen())
-    {
-        if (!openDevice())
-        {
-            LOG(VB_MEDIA, LOG_DEBUG, LOC + ":testMedia - failed to open '" +
-                                     m_DevicePath +  "' : " +ENO);
-            if (errno == EBUSY)
-                return isMounted() ? MEDIAERR_OK : MEDIAERR_FAILED;
-            else
-                return MEDIAERR_FAILED;
-        }
-        LOG(VB_MEDIA, LOG_DEBUG, LOC + ":testMedia - Opened device");
-        OpenedHere = true;
-    }
-
-    // Since the device was is/was open we can get it's status...
-    int Stat = driveStatus();
-
-    // Be nice and close the device if we opened it,
-    // otherwise it might be locked when the user doesn't want it to be.
-    if (OpenedHere)
-        closeDevice();
-
-    if (Stat == -1)
-    {
-        LOG(VB_MEDIA, LOG_DEBUG, LOC + 
-            ":testMedia - Failed to get drive status of '" + m_DevicePath +
-            "' : " + ENO);
-        return MEDIAERR_FAILED;
-    }
-
-    return MEDIAERR_OK;
+    return MEDIAERR_FAILED;
 }
 
 MythMediaStatus MythCDROMLinux::checkMedia()
 {
-    bool OpenedHere = false;
-
-    // If it's not already open we need to at least
-    // TRY to open it for most of these checks to work.
-    if (!isDeviceOpen())
-    {
-        OpenedHere = openDevice();
-
-        if (!OpenedHere)
-        {
-            LOG(VB_MEDIA, LOG_ERR, LOC + 
-                ":checkMedia() - cannot open device '" + m_DevicePath + "' : " +
-                ENO + "- returning UNKNOWN");
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return setStatus(MEDIASTAT_UNKNOWN, false);
-        }
-    }
-
-    switch (driveStatus())
-    {
-        case CDS_DISC_OK:
-            LOG(VB_MEDIA, LOG_DEBUG, m_DevicePath + " Disk OK, type = " +
-                                     MediaTypeString(m_MediaType) );
-            // further checking is required
-            break;
-        case CDS_TRAY_OPEN:
-            LOG(VB_MEDIA, LOG_DEBUG, m_DevicePath + " Tray open or no disc");
-            // First, send a message to the
-            // plugins to forget the current media type
-            setStatus(MEDIASTAT_OPEN, OpenedHere);
-            // then "clear out" this device
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return MEDIASTAT_OPEN;
-            break;
-        case CDS_NO_DISC:
-            LOG(VB_MEDIA, LOG_DEBUG, m_DevicePath + " No disc");
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return setStatus(MEDIASTAT_NODISK, OpenedHere);
-            break;
-        case CDS_NO_INFO:
-        case CDS_DRIVE_NOT_READY:
-            LOG(VB_MEDIA, LOG_DEBUG, m_DevicePath + 
-                                     " No info or drive not ready");
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
-        default:
-            LOG(VB_GENERAL, LOG_ERR, "Failed to get drive status of " +
-                m_DevicePath + " : " + ENO);
-            m_MediaType = MEDIATYPE_UNKNOWN;
-            return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
-    }
-
-    if (mediaChanged())
-    {
-        LOG(VB_MEDIA, LOG_INFO, m_DevicePath + " Media changed");
-        // Regardless of the actual status lie here and say
-        // it's open for now, so we can cover the case of a missed open.
-        return setStatus(MEDIASTAT_OPEN, OpenedHere);
-    }
-
-
-    if (isUsable())
-    {
-        LOG(VB_MEDIA, LOG_DEBUG, "Disc useable, media unchanged. All good!");
-        if (OpenedHere)
-            closeDevice();
-        return MEDIASTAT_USEABLE;
-    }
-
-    // If we have tried to mount and failed, don't keep trying
-    if (m_Status == MEDIASTAT_ERROR)
-    {
-        LOG(VB_MEDIA, LOG_DEBUG, "Disc is unmountable?");
-        if (OpenedHere)
-            closeDevice();
-        return m_Status;
-    }
-
-    if ((m_Status == MEDIASTAT_OPEN) ||
-        (m_Status == MEDIASTAT_UNKNOWN))
-    {
-        LOG(VB_MEDIA, LOG_INFO, m_DevicePath + " Current status " +
-                MythMediaDevice::MediaStatusStrings[m_Status]);
-        int type = ioctl(m_DeviceHandle, CDROM_DISC_STATUS, CDSL_CURRENT);
-        switch (type)
-        {
-            case CDS_DATA_1:
-            case CDS_DATA_2:
-            {
-                m_MediaType = MEDIATYPE_DATA;
-                LOG(VB_MEDIA, LOG_INFO, "Found a data disk");
-
-                //grab information from iso9660 (& udf)
-                off_t sr = lseek(m_DeviceHandle,
-                                 (off_t) 2048*16, SEEK_SET);
-
-                struct iso_primary_descriptor buf;
-                ssize_t readin = 0;
-                while ((sr != (off_t) -1) && (readin < 2048))
-                {
-                    ssize_t rr = read(
-                        m_DeviceHandle, ((char*)&buf) + readin, 2048 - readin);
-                    if ((rr < 0) && ((EAGAIN == errno) || (EINTR == errno)))
-                        continue;
-                    else if (rr < 0)
-                        break;
-                    readin += rr;
-                }
-
-                if (readin == 2048)
-                {
-                    m_VolumeID = QString(buf.volume_id).trimmed();
-                    m_KeyID = QString("%1%2")
-                        .arg(m_VolumeID)
-                        .arg(QString(buf.creation_date).left(16));
-                }
-                else
-                {
-                    m_VolumeID = "UNKNOWN";
-                    m_KeyID = m_VolumeID + MythDate::current_iso_string();
-                }
-
-                LOG(VB_MEDIA, LOG_INFO,
-                    QString("Volume ID: %1").arg(m_VolumeID));
-#ifdef USING_LIBUDF
-                // Check for a DVD/BD disk by reading the UDF root dir.
-                // This allows DVD's to play immediately upon insertion without
-                // calling mount, which either needs pmount or changes to fstab.
-                udf_t *pUdf = udf_open(m_DevicePath.toAscii());
-                if (NULL != pUdf)
-                {
-                    udf_dirent_t *pUdfRoot = udf_get_root(pUdf, true, 0);
-                    if (NULL != pUdfRoot)
-                    {
-                        if (NULL != udf_fopen(pUdfRoot, "VIDEO_TS"))
-                            m_MediaType = MEDIATYPE_DVD;
-                        else if (NULL != udf_fopen(pUdfRoot, "BDMV"))
-                            m_MediaType = MEDIATYPE_BD;
-
-                        udf_dirent_free(pUdfRoot);
-                    }
-                    udf_close(pUdf);
-
-                    if (MEDIATYPE_DATA != m_MediaType)
-                    {
-                        // pretend we're NOTMOUNTED so setStatus emits a signal
-                        m_Status = MEDIASTAT_NOTMOUNTED;
-                        return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                    }
-                }
-#endif
-                // the base class's onDeviceMounted will do fine
-                // grained detection of the type of data on this disc
-                if (isMounted())
-                    onDeviceMounted();
-                else if (!mount()) // onDeviceMounted() called as side-effect
-                    return setStatus(MEDIASTAT_ERROR, OpenedHere);
-
-                if (isMounted())
-                {
-                    // pretend we're NOTMOUNTED so setStatus emits a signal
-                    m_Status = MEDIASTAT_NOTMOUNTED;
-                    return setStatus(MEDIASTAT_MOUNTED, OpenedHere);
-                }
-                else if (m_MediaType == MEDIATYPE_DVD)
-                {
-                    // pretend we're NOTMOUNTED so setStatus emits a signal
-                    m_Status = MEDIASTAT_NOTMOUNTED;
-                    return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                }
-                else
-                    return setStatus(MEDIASTAT_NOTMOUNTED, OpenedHere);
-                break;
-            }
-            case CDS_AUDIO:
-                LOG(VB_MEDIA, LOG_DEBUG, "found an audio disk");
-                m_MediaType = MEDIATYPE_AUDIO;
-                return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                break;
-            case CDS_MIXED:
-                m_MediaType = MEDIATYPE_MIXED;
-                LOG(VB_MEDIA, LOG_DEBUG, "found a mixed CD");
-                // Note: Mixed mode CDs require an explixit mount call
-                //       since we'll usually want the audio portion.
-                // undefine ASSUME_WANT_AUDIO to change this behavior.
-                #ifdef ASSUME_WANT_AUDIO
-                    return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                #else
-                    mount();
-                    if (isMounted())
-                    {
-                        // pretend we're NOTMOUNTED so setStatus
-                        // emits a signal
-                        m_Status = MEDIASTAT_NOTMOUNTED;
-                        return setStatus(MEDIASTAT_MOUNTED, OpenedHere);
-                    }
-                    else
-                    {
-                        return setStatus(MEDIASTAT_USEABLE, OpenedHere);
-                    }
-                #endif
-                break;
-            case CDS_NO_INFO:
-            case CDS_NO_DISC:
-                if (hasWritableMedia())
-                {
-                    LOG(VB_MEDIA, LOG_DEBUG, "found a blank or writable disk");
-                    return setStatus(MEDIASTAT_UNFORMATTED, OpenedHere);
-                }
-
-                LOG(VB_MEDIA, LOG_DEBUG, "found no disk");
-                m_MediaType = MEDIATYPE_UNKNOWN;
-                return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
-                break;
-            default:
-                LOG(VB_MEDIA, LOG_DEBUG, "found unknown disk type: " +
-                                         QString::number(type));
-                m_MediaType = MEDIATYPE_UNKNOWN;
-                return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
-        }
-    }
-
-    if (m_AllowEject)
-        unlock();
-    else
-        lock();
-
-    if (OpenedHere)
-        closeDevice();
-
-    LOG(VB_MEDIA, LOG_DEBUG, QString("Returning %1")
-                           .arg(MythMediaDevice::MediaStatusStrings[m_Status]));
-    return m_Status;
+    return setStatus(MEDIASTAT_UNKNOWN, NULL);
 }
 
 MythMediaError MythCDROMLinux::lock()
 {
-    MythMediaError ret = MythMediaDevice::lock();
-    if (ret == MEDIAERR_OK)
-        ioctl(m_DeviceHandle, CDROM_LOCKDOOR, 1);
-
-    return ret;
+    return MEDIAERR_FAILED;
 }
 
 MythMediaError MythCDROMLinux::unlock()
 {
-    if (isDeviceOpen() || openDevice())
-    {
-        LOG(VB_MEDIA, LOG_DEBUG, LOC + ":unlock - Unlocking CDROM door");
-        ioctl(m_DeviceHandle, CDROM_LOCKDOOR, 0);
-    }
-    else
-    {
-        LOG(VB_GENERAL, LOG_INFO, "Failed to open device, CDROM try will "
-                                  "remain locked.");
-    }
-
-    return MythMediaDevice::unlock();
+    return MEDIAERR_FAILED;
 }
 
 bool MythCDROMLinux::isSameDevice(const QString &path)
 {
-    dev_t new_rdev;
-    struct stat sb;
-
-    if (stat(path.toLocal8Bit().constData(), &sb) < 0)
-    {
-        LOG(VB_GENERAL, LOG_ERR, LOC + ":isSameDevice() -- " +
-            QString("Failed to stat '%1'").arg(path) + ENO);
-        return false;
-    }
-    new_rdev = sb.st_rdev;
-
-    // Check against m_DevicePath...
-    if (stat(m_DevicePath.toLocal8Bit().constData(), &sb) < 0)
-    {
-        LOG(VB_GENERAL, LOG_ERR, LOC + ":isSameDevice() -- " +
-            QString("Failed to stat '%1'").arg(m_DevicePath) + ENO);
-        return false;
-    }
-    return (sb.st_rdev == new_rdev);
+    return false;
 }
 
 #if defined(SG_IO) && defined(GPCMD_SET_STREAMING)
@@ -651,121 +239,9 @@ bool MythCDROMLinux::isSameDevice(const QString &path)
  */
 void MythCDROMLinux::setSpeed(int speed)
 {
-    MythCDROMLinux::setSpeed(m_DevicePath.toLocal8Bit().constData(), speed);
 }
 
 void MythCDROMLinux::setSpeed(const char *device, int speed)
 {
-    int fd;
-    unsigned char buffer[28];
-    unsigned char cmd[16];
-    unsigned char sense[16];
-    struct sg_io_hdr sghdr;
-    struct stat st;
-    int rate = 0;
-
-    memset(&sghdr, 0, sizeof(sghdr));
-    memset(buffer, 0, sizeof(buffer));
-    memset(sense, 0, sizeof(sense));
-    memset(cmd, 0, sizeof(cmd));
-    memset(&st, 0, sizeof(st));
-
-    if ((fd = open(device, O_RDWR | O_NONBLOCK)) == -1)
-    {
-        LOG(VB_MEDIA, LOG_ERR, LOC + 
-            " Changing CD/DVD speed needs write access");
-        return;
-    }
-
-    if (fstat(fd, &st) == -1)
-    {
-        close(fd);
-        LOG(VB_MEDIA, LOG_ERR, LOC +
-            QString(":setSpeed() Failed. device %1 not found") .arg(device));
-        return;
-    }
-
-    if (!S_ISBLK(st.st_mode))
-    {
-        close(fd);
-        LOG(VB_MEDIA, LOG_ERR, LOC + ":setSpeed() Failed. Not a block device");
-        return;
-    }
-
-    if (speed < 0)
-        speed = -1;
-
-    switch(speed)
-    {
-        case 0: // don't touch speed setting
-            close(fd);
-            return;
-        case -1: // restore default value
-        {
-            rate = 0;
-            buffer[0] = 4;
-            LOG(VB_MEDIA, LOG_INFO, LOC + 
-                ":setSpeed() - Restored CD/DVD Speed");
-            break;
-        }
-        default:
-        {
-            // Speed in Kilobyte/Second. 177KB/s is the maximum data rate
-            // for standard Audio CD's.
-
-            rate = (speed > 0 && speed < 100) ? speed * 177 : speed;
-
-            LOG(VB_MEDIA, LOG_INFO, LOC +
-                QString(":setSpeed() - Limiting CD/DVD Speed to %1KB/s")
-                    .arg(rate));
-            break;
-        }
-    }
-
-    sghdr.interface_id = 'S';
-    sghdr.timeout = 5000;
-    sghdr.dxfer_direction = SG_DXFER_TO_DEV;
-    sghdr.mx_sb_len = sizeof(sense);
-    sghdr.dxfer_len = sizeof(buffer);
-    sghdr.cmd_len = sizeof(cmd);
-    sghdr.sbp = sense;
-    sghdr.dxferp = buffer;
-    sghdr.cmdp = cmd;
-
-    cmd[0] = GPCMD_SET_STREAMING;
-    cmd[10] = sizeof(buffer);
-
-    buffer[8]  = 0xff;
-    buffer[9]  = 0xff;
-    buffer[10] = 0xff;
-    buffer[11] = 0xff;
-
-    buffer[12] = buffer[20] = (rate >> 24) & 0xff;
-    buffer[13] = buffer[21] = (rate >> 16) & 0xff;
-    buffer[14] = buffer[22] = (rate >> 8)  & 0xff;
-    buffer[15] = buffer[23] = rate & 0xff;
-
-    // Note: 0x3e8 == 1000, hence speed = data amount per 1000 milliseconds.
-    buffer[18] = buffer[26] = 0x03;
-    buffer[19] = buffer[27] = 0xe8;
-
-    if (ioctl(fd, SG_IO, &sghdr) < 0)
-    {
-        LOG(VB_MEDIA, LOG_ERR, LOC + " Limit CD/DVD Speed Failed");
-    }
-    else
-    {
-        // On my system (2.6.18+ide-cd), SG_IO succeeds without doing anything,
-        // while CDROM_SELECT_SPEED works...
-        if (ioctl(fd, CDROM_SELECT_SPEED, speed) < 0)
-        {
-            LOG(VB_MEDIA, LOG_ERR, LOC + 
-                " Limit CD/DVD CDROM_SELECT_SPEED Failed");
-        }
-        LOG(VB_MEDIA, LOG_INFO, LOC +
-            ":setSpeed() - CD/DVD Speed Set Successful");
-    }
-
-    close(fd);
 }
 #endif
diff --git a/mythtv/libs/libmythtv/analogsignalmonitor.cpp b/mythtv/libs/libmythtv/analogsignalmonitor.cpp
index 82387e4..0776cce 100644
--- a/mythtv/libs/libmythtv/analogsignalmonitor.cpp
+++ b/mythtv/libs/libmythtv/analogsignalmonitor.cpp
@@ -41,7 +41,7 @@ bool AnalogSignalMonitor::VerifyHDPVRaudio(int videofd)
     struct v4l2_queryctrl qctrl;
     qctrl.id = V4L2_CID_MPEG_AUDIO_ENCODING;
 
-    int audtype = V4L2_MPEG_AUDIO_ENCODING_AC3;
+    int audtype = V4L2_MPEG_AUDIO_ENCODING_LAYER_3;
 
     if (ioctl(videofd, VIDIOC_QUERYCTRL, &qctrl) != 0)
     {
diff --git a/mythtv/libs/libmythui/mythxdisplay.cpp b/mythtv/libs/libmythui/mythxdisplay.cpp
index fbb29b2..164a2f3 100644
--- a/mythtv/libs/libmythui/mythxdisplay.cpp
+++ b/mythtv/libs/libmythui/mythxdisplay.cpp
@@ -11,10 +11,6 @@
 #ifndef V_INTERLACE
 #define V_INTERLACE (0x010)
 #endif
-extern "C" {
-#include <X11/extensions/Xinerama.h>
-#include <X11/extensions/xf86vmode.h>
-}
 typedef int (*XErrorCallbackType)(Display *, XErrorEvent *);
 typedef std::vector<XErrorEvent>       XErrorVectorType;
 std::map<Display*, XErrorVectorType>   xerrors;
@@ -144,14 +140,7 @@ void MythXDisplay::MoveResizeWin(Window win, const QRect &rect)
 
 int MythXDisplay::GetNumberXineramaScreens(void)
 {
-    MythXLocker locker(this);
     int nr_xinerama_screens = 0;
-    int event_base = 0, error_base = 0;
-    if (XineramaQueryExtension(m_disp, &event_base, &error_base) &&
-        XineramaIsActive(m_disp))
-    {
-        XFree(XineramaQueryScreens(m_disp, &nr_xinerama_screens));
-    }
     return nr_xinerama_screens;
 }
 
@@ -173,35 +162,7 @@ QSize MythXDisplay::GetDisplayDimensions(void)
 
 float MythXDisplay::GetRefreshRate(void)
 {
-    XF86VidModeModeLine mode_line;
-    int dot_clock;
-    MythXLocker locker(this);
-
-    if (!XF86VidModeGetModeLine(m_disp, m_screen_num, &dot_clock, &mode_line))
-    {
-        LOG(VB_GENERAL, LOG_ERR, "X11 ModeLine query failed");
-        return -1;
-    }
-
-    double rate = mode_line.htotal * mode_line.vtotal;
-
-    // Catch bad data from video drivers (divide by zero causes return of NaN)
-    if (rate == 0.0 || dot_clock == 0)
-    {
-        LOG(VB_GENERAL, LOG_ERR, "X11 ModeLine query returned zeroes");
-        return -1;
-    }
-
-    rate = (dot_clock * 1000.0) / rate;
-
-    if (((mode_line.flags & V_INTERLACE) != 0) &&
-        rate > 24.5 && rate < 30.5)
-    {
-        LOG(VB_PLAYBACK, LOG_INFO,
-                "Doubling refresh rate for interlaced display.");
-        rate *= 2.0;
-    }
-
+    double rate = 60;
     return rate;
 }
 
diff --git a/mythtv/programs/mythtranscode/transcode.cpp b/mythtv/programs/mythtranscode/transcode.cpp
index dcf0e11..eb0bf0a 100644
--- a/mythtv/programs/mythtranscode/transcode.cpp
+++ b/mythtv/programs/mythtranscode/transcode.cpp
@@ -538,7 +538,7 @@ class Cutter
         {
             return false;
         }
-        else if (abs(audioFramesToCut - frames) < audioFramesToCut)
+        else if (llabs(audioFramesToCut - frames) < audioFramesToCut)
         {
             // Drop the packet containing these frames if doing
             // so gets us closer to zero left to drop

QPKG files

addition to qpkg.conf

[MythTV]
Name = MythTV
Version = 0.24.1
Enable = TRUE
QPKG_File = Manual install
Date = 2012-03-06
Shell = /share/MD0_DATA/.qpkg/MythTV/MythTV.sh
Install_Path = /share/MD0_DATA/.qpkg/MythTV
Author = MythTV

MythTV.sh

#!/bin/sh

CONF=/etc/config/qpkg.conf
QPKG_NAME="MythTV"
QPKG_DIR=$(/sbin/getcfg $QPKG_NAME Install_Path -d "" -f $CONF)
QPKG_SCRIPT=$(/sbin/getcfg $QPKG_NAME Shell -d "" -f $CONF)
QPKG_LOGFILE="${QPKG_DIR}/${QPKG_NAME}.log"
 

function check_process_running() {
	# Check if process is already running (ARM version)
	PROCESS_RUNNING=0
	for pid in $(/bin/pidof mythbackend); do
		# Try to find if the process is MythTV
		/bin/grep -q "mythbackend" /proc/$pid/cmdline
		if [ $? == 0 ]; then
			# Process found, save PID and exit loop
			PROCESS_RUNNING=$pid
			return 0
		fi
	done

	# Process not found
	return 1
}
function test_mysql_presence() {
        # Change your mysql database username and password below (mythtv:mythtv)
        # Number of seconds between mysql tries
        mysql_sleep_i=10
        # Maximum number of seconds to wait before giving up
        mysql_sleep_limit=60
        # Wait for mysql to load
        for (( i=0; i<$mysql_sleep_limit; i=i+$mysql_sleep_i )); do
                echo "$i seconds have passed.  Test mysql presence"
                mysql_ready=$(/mnt/ext/usr/local/mysql/bin/mysql -u mythtv --password=mythtv -e 'use mythconverg' 2>&1)
                if [ -z "$mysql_ready" ]; then
                        /bin/echo "mysql became ready in $i seconds"
                        return 0
                fi
                echo "mysql not ready; waiting $mysql_sleep_i seconds for mysql to load"
                /bin/sleep "$mysql_sleep_i"
        done
        /bin/echo "mysql did not load in $mysql_sleep_limit seconds"
        return 1
}
function writelog_info() {
	# Write a message on the QNAP log
	/sbin/write_log "$1" 4
}
function writelog_warning() {
	# Write a message on the QNAP log
	/sbin/write_log "$1" 2
}

case "$1" in
 start)
    ENABLED=$(/sbin/getcfg $QPKG_NAME Enable -u -d FALSE -f $CONF)
    if [ "$ENABLED" != "TRUE" ]; then
        /bin/echo "$QPKG_NAME is disabled."
        exit 1
    fi

	# Check if process is already running
	check_process_running
	if [ $? = 0 ]; then
		/bin/echo "$QPKG_NAME is already running!"
		exit 1
	fi

        # Start logging
	exec > $QPKG_LOGFILE 2>&1

	# Start MythTV
	/bin/grep -q "/opt/lib" /etc/ld.so.conf
	if [ $? != 0 ]; then
		echo "/opt/lib" >> /etc/ld.so.conf
		/sbin/ldconfig
	fi

	# wait for mysql to start.
	# A couple of tests show mysql ready between 30-40s
	#   after start of this QPKG.  60s is to be safe.
	/bin/sleep 60
#Use the code below instead of "/bin/sleep 60" to test presence of mysql dynamically
#This is useful, especially when restarting the QPKG after the NAS is already booted;
# the mythbackend should load immediately, and not have to wait 60s
#        test_mysql_presence
#        if [ $? != 0 ]; then
#                exit 1
#        else
#                /bin/echo "Database found; Execute backend"
#        fi
	export HOME=/root
  /share/MD0_DATA/.qpkg/Optware/bin/mythbackend --daemon
  #if you experience random crashes, try using "--noupnp" flag 
	#/share/MD0_DATA/.qpkg/Optware/bin/mythbackend --noupnp --daemon
	/bin/echo "MythTV Backend started."
	writelog_info "MythTV Backend started."

	#change localtime zone for mythweb
	mv /etc/localtime /etc/localtime_old
	ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime

    ;;

 stop)
  	# Stop the process
	check_process_running
	if [ $? != 0 ]; then
		/bin/echo "$QPKG_NAME is NOT running!"
		exit 1
   	fi

	# Start logging
	exec > $QPKG_LOGFILE 2>&1

	# Kill the process
	/bin/kill -15 $PROCESS_RUNNING
	/bin/sleep 3
    ;;
 restart)
    $0 stop
    $0 start
    ;;

   showlog)
	# Print the current MythTV logfile
	/bin/echo "MythTV QPKG log created: $(/bin/date -r $QPKG_LOGFILE)"
	/bin/cat $QPKG_LOGFILE
	;;

  status)
	# Check if MythTV is running or not
	check_process_running
	if [ $? = 0 ]; then
		/bin/echo "MythTV status: RUNNING."
		exit 0
	else
		/bin/echo "MythTV status: STOPPED."
		exit 1
	fi
	;;

  *)
    /bin/echo "MythTV QPKG"
    /bin/echo "Usage: $0 {start|stop|restart|status|showlog}"
    exit 1
    ;;
esac

exit 0