MythTV on Mac x86

From MythTV Official Wiki
Revision as of 10:49, 17 March 2006 by NigelPearson (talk | contribs) (libs/libfreemheg/BaseClasses.h error was fixed in r9343)

Jump to: navigation, search

MythTV currently does not display video on the new Intel based Apple Macintosh platforms. This page is intended to share information among the people attempting to get this working.

In the 'contrib' directory of the MythTV source code, there is a perl script which automates the build process for MythTV on MacOS systems. The script is called The descriptions of changes needed assume that script as a starting point.

Changes Needed

Here's a brief summary of chages needed to build MythTV on an Intel based Mac system:

  • Enable backend, ' -enable-backend'. Otherwise, the frontend fails when necessary components aren't available. ( should probably be updated to add mpegdescriptors.cpp/h to the frontend requirements)
  • Update QT version being used. 3.3.4 doesn't compile with gcc 4.0; 3.3.5 compiles but generates a bus error when displaying Myth menus. Using a development snapshot of 3.3.6 seems to work. Replace the QT url in osx-packager with the following: (these snapshots are changed frequently, pick a current one from that directory)
  • Override Host for sourceforge? I found the availability of packages to be spotty on the default host, if it fails, replace the hostname with a working host.
  • libdvdnav: Endian byte swapping missing from src/dvdread/bswap.h The following can be added to use Apple-supplied routines:
#elif defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define B2N_16(x) x = OSSwapBigToHostConstInt16(x) 
#define B2N_32(x) x = OSSwapBigToHostConstInt32(x)
#define B2N_64(x) x = OSSwapBigToHostConstInt64(x)
  • libexif: compile failed. comment out the 'static' in libexif/exif-utils.c near line 83.
  • libdvdread: Endian byte swapping missing from dvdread/bswap.h See bswap.h changes above.

MythTV changes:

  • Update to add configure parameters used in building MythTV. In the section "configure mythplugins, and mythtv, etc", the 'mythtv' portion should look something like this:
 =>  [
       '--extra-cxxflags=-msse -msse2 -msse3', 
       '--prefix=' . $PREFIX,
  • Fix libs/libavcodec/liba52/resample.c -- Apply changes in patch below.
  • 3rd bswap.h patch, in file 'libs/libmythdvdnav/bswap.h'. See bswap changes described above.
  • This diff, against the released 0.19 codebase, fixes the crash and allows video and audio to work. It does also fix resample.cpp.
diff -ur mythtv-0.19/libs/libavcodec/liba52/resample.c /Users/ogre/src/mythtv-0.19/libs/libavcodec/liba52/resample.c
--- mythtv-0.19/libs/libavcodec/liba52/resample.c       2006-01-05 15:19:29.000000000 -0800
+++ /Users/ogre/src/mythtv-0.19/libs/libavcodec/liba52/resample.c       2006-03-16 13:31:42.000000000 -0800
@@ -13,14 +13,14 @@
 #include "resample_c.c"
-#ifdef ARCH_X86
+#ifdef HAVE_MMX
 #include "resample_mmx.c"
 void* a52_resample_init(uint32_t mm_accel,int flags,int chans){
 void* tmp;
-#ifdef ARCH_X86
+#ifdef HAVE_MMX
diff -ur mythtv-0.19/libs/libavcodec/msmpeg4.c /Users/ogre/src/mythtv-0.19/libs/libavcodec/msmpeg4.c
--- mythtv-0.19/libs/libavcodec/msmpeg4.c       2006-01-15 23:14:43.000000000 -0800
+++ /Users/ogre/src/mythtv-0.19/libs/libavcodec/msmpeg4.c       2006-03-16 13:25:10.000000000 -0800
@@ -725,7 +725,7 @@
        necessitate to modify mpegvideo.c. The problem comes from the
        fact they decided to store the quantized DC (which would lead
        to problems if Q could vary !) */
-#if (defined(ARCH_X86) || defined(ARCH_X86_64)) && !defined PIC
+#if defined(HAVE_MMX) && (defined(ARCH_X86) || defined(ARCH_X86_64)) && !defined PIC
     asm volatile(
         "movl %3, %%eax         \n\t"
         "shrl $1, %%eax         \n\t"
diff -ur mythtv-0.19/libs/libmythtv/videoout_quartz.cpp /Users/ogre/src/mythtv-0.19/libs/libmythtv/videoout_quartz.cpp
--- mythtv-0.19/libs/libmythtv/videoout_quartz.cpp      2005-11-26 08:38:42.000000000 -0800
+++ /Users/ogre/src/mythtv-0.19/libs/libmythtv/videoout_quartz.cpp      2006-03-16 13:59:53.000000000 -0800
@@ -1315,10 +1315,12 @@
     data->windowedMode = gContext->GetNumSetting("RunFrontendInWindow", 0);
     data->correctGamma = gContext->GetNumSetting("MacGammaCorrect", 0);
     if (gContext->GetNumSetting("MacYuvConversion", 1))
         data->yuvConverter = yuv2vuy_init_altivec();
-        data->yuvConverter = NULL;
+        data->yuvConverter = yuv2vuy_init_plain();
     if (!CreateQuartzBuffers())
diff -ur mythtv-0.19/libs/libmythtv/yuv2rgb.cpp /Users/ogre/src/mythtv-0.19/libs/libmythtv/yuv2rgb.cpp
--- mythtv-0.19/libs/libmythtv/yuv2rgb.cpp      2006-01-19 21:04:02.000000000 -0800
+++ /Users/ogre/src/mythtv-0.19/libs/libmythtv/yuv2rgb.cpp      2006-03-16 14:06:33.000000000 -0800
@@ -682,7 +682,6 @@
 static void non_vec_yuv420_2vuy (uint8_t * image, uint8_t * py,
                                  uint8_t * pu, uint8_t * pv,
                                  int h_size, int v_size,
@@ -717,6 +716,13 @@
+yuv2vuy_fun yuv2vuy_init_plain(void)
+       return non_vec_yuv420_2vuy;
 // Altivec code adapted from VLC's i420_yuv2.c (thanks to Titer and Paul Jara) 
 #define VEC_NEXT_LINES()                                                    \
diff -ur mythtv-0.19/libs/libmythtv/yuv2rgb.h /Users/ogre/src/mythtv-0.19/libs/libmythtv/yuv2rgb.h
--- mythtv-0.19/libs/libmythtv/yuv2rgb.h        2005-04-21 07:14:28.000000000 -0700
+++ /Users/ogre/src/mythtv-0.19/libs/libmythtv/yuv2rgb.h        2006-03-16 14:01:06.000000000 -0800
@@ -50,6 +50,7 @@
                               int vuy_stride, int y_stride, int uv_stride);
 yuv2vuy_fun yuv2vuy_init_altivec (void);
+yuv2vuy_fun yuv2vuy_init_plain(void);
 typedef void (* vuy2yuv_fun) (uint8_t * image, uint8_t * py,
                               uint8_t * pu, uint8_t * pv,

Current Status

Application successfully compiles. MythTV menu system displays, and communicates with backend.

Useful Links

ffmpeg updates for mmx assembly code.

Other Notes

'/proc/cpuinfo/' is used to determine CPU type in linux builds. In MacOS, "/usr/sbin/system_profiler SPHardwareDataType" could be used to determine the architecture and CPU type.