|
|
(123 intermediate revisions by 40 users not shown) |
Line 1: |
Line 1: |
− | 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.
| + | #REDIRECT [[Myth on Mac OS X]] |
− | | |
− | 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 osx-packager.pl. My descriptions of changes needed assume that script as a starting point.
| |
− | | |
− | | |
− | ==Changes Needed==
| |
− | Here's a brief summary of chages I made to get further into the build process (updated with Brendan White's config info):
| |
− | | |
− | * Enable backend, 'osx-packager.pl -enable-backend'. Otherwise, the frontend fails when necessary components aren't available. (libmythtv.pro 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: ftp://ftp.trolltech.com/qt/snapshots/qt-mac-free-3.3.6-snapshot-20060311.tar.gz
| |
− | | |
− | * Override URL for libdvdnav in osx-packager.pl, was not available where the script was looking for it. I set it to: http://umn.dl.sourceforge.net/sourceforge/dvd/libdvdnav-0.1.10.tar.gz
| |
− | | |
− | * libdvdnav: Endian byte swapping missing from bswap.h. Probably due to not recognizing the arch. See bswap changes described below.
| |
− | | |
− | * libexif: compile failed. comment out the 'static' in exif-utils.c line 83.
| |
− | | |
− | * libdvdread: Endian byte swapping missing from bswap.h. Probably due to not recognizing the arch. Instead of the generic else case for bswap, you can use the 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)
| |
− | | |
− | MythTV changes:
| |
− | | |
− | * Update osx-packager.pl to add configure parameters used in building MythTV. In the section "configure mythplugins, and mythtv, etc", the 'mythtv' portion should look something like this:
| |
− | | |
− | 'mythtv'
| |
− | => [
| |
− | '--disable-distcc',
| |
− | '--disable-mmx',
| |
− | '--arch=i686',
| |
− | '--extra-cxxflags=-msse -msse2 -msse3',
| |
− | '--prefix=' . $PREFIX,
| |
− | ],
| |
− | | |
− | * Fix libs/libavcodec/liba52/resample.c -- Even though mmx has been disabled, there are some silly assumptions in this file. remove the ifdef that includes resample_mmx.c. Also remove the ifdef ARCH_X86 stanzas.
| |
− | | |
− | * 3rd bswap.h patch, in file 'libs/libmythdvdnav/bswap.h'. See bswap changes described above.
| |
− | | |
− | * Fix libs/libfreemheg/BaseClasses.h (called from Actions.cpp), #include <malloc.h> to #include <sys/malloc.h>
| |
− | | |
− | * This diff, against the released 0.19 codebase, fixes the crash and allows video and audio to work. Note that I did not apply the bswap patch above. It does also fix resample.cpp.
| |
− | <pre>
| |
− | 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"
| |
− | #endif
| |
− |
| |
− | void* a52_resample_init(uint32_t mm_accel,int flags,int chans){
| |
− | void* tmp;
| |
− |
| |
− | -#ifdef ARCH_X86
| |
− | +#ifdef HAVE_MMX
| |
− | if(mm_accel&MM_ACCEL_X86_MMX){
| |
− | tmp=a52_resample_MMX(flags,chans);
| |
− | if(tmp){
| |
− | 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/libmyth/audiooutputca.cpp /Users/ogre/src/mythtv-0.19/libs/libmyth/audiooutputca.cpp
| |
− | --- mythtv-0.19/libs/libmyth/audiooutputca.cpp 2005-10-10 17:30:51.000000000 -0700
| |
− | +++ /Users/ogre/src/mythtv-0.19/libs/libmyth/audiooutputca.cpp 2006-03-16 15:01:02.000000000 -0800
| |
− | @@ -107,8 +107,13 @@
| |
− | bzero(&conv_in_desc, sizeof(AudioStreamBasicDescription));
| |
− | conv_in_desc.mSampleRate = audio_samplerate;
| |
− | conv_in_desc.mFormatID = kAudioFormatLinearPCM;
| |
− | - conv_in_desc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger
| |
− | - | kLinearPCMFormatFlagIsBigEndian;
| |
− | +#ifdef WORDS_BIGENDIAN
| |
− | + conv_in_desc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger
| |
− | + | kLinearPCMFormatFlagIsBigEndian;
| |
− | +#else
| |
− | + conv_in_desc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger;
| |
− | +#endif
| |
− | +
| |
− | conv_in_desc.mBytesPerPacket = audio_bytes_per_sample;
| |
− | conv_in_desc.mFramesPerPacket = 1;
| |
− | conv_in_desc.mBytesPerFrame = audio_bytes_per_sample;
| |
− | 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);
| |
− |
| |
− | +#ifdef HAVE_ALTIVEC
| |
− | if (gContext->GetNumSetting("MacYuvConversion", 1))
| |
− | data->yuvConverter = yuv2vuy_init_altivec();
| |
− | else
| |
− | - data->yuvConverter = NULL;
| |
− | +#endif
| |
− | + 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 @@
| |
− | }
| |
− | }
| |
− |
| |
− | -#ifdef HAVE_ALTIVEC
| |
− | 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;
| |
− | +}
| |
− | +
| |
− | +#ifdef HAVE_ALTIVEC
| |
− | +
| |
− | // 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,
| |
− | | |
− | </pre>
| |
− | | |
− | == Current Status ==
| |
− | | |
− | Application successfully compiles. MythTV menu system displays, and communicates with backend.
| |
− | | |
− | Seg Faults when trying to display video. Doesn't display list of programs from backend.
| |
− | | |
− | MacOS Crash Log shows:
| |
− | | |
− | Thread 5 Crashed:<br>
| |
− | 0 ...ickTimeComponents.component 0x98e0043d <B>YUV420To2VUY_W1x</B> + 671<br>
| |
− | 1 ...ickTimeComponents.component 0x98de371a FinalGlueBeforeTheBlit + 1529<br>
| |
− | 2 ...ickTimeComponents.component 0x98de7a5a PrepareForBlitThenDoBlit + 40<br>
| |
− | 3 ...ickTimeComponents.component 0x98de4207 ScalingCodecComponentDispatch + 2437<br>
| |
− | 4 ...ple.CoreServices.CarbonCore 0x90cc1638 CallComponentDispatch + 34<br>
| |
− | 5 ...ickTimeComponents.component 0x995941c5 ImageCodecDrawBand + 43<br>
| |
− | 6 ...ickTimeComponents.component 0x98c5ab6a BaseCodec_DecompressWorkFunction + 1033<br>
| |
− | 7 ...ple.CoreServices.CarbonCore 0x90ccd75b InvokeComponentMPWorkFunctionUPP + 22<br>
| |
− | 8 ...ickTimeComponents.component 0x98c58c6f BaseCodec_DecompressCallBack_Common + 2713<br>
| |
− | 9 ...ickTimeComponents.component 0x98c5c40c Base_CDBandDecompress + 5748<br>
| |
− | 10 ...ple.CoreServices.CarbonCore 0x90cc1953 CallComponentFunctionCommon + 513<br>
| |
− | 11 ...ickTimeComponents.component 0x98c56f41 Base_CDComponentDispatch + 125<br>
| |
− | 12 ...ickTimeComponents.component 0x98de39e0 ScalingCodecComponentDispatch + 350<br>
| |
− | 13 ...ickTimeComponents.component 0x98df6bf7 YUV420CodecComponentDispatch + 87<br>
| |
− | 14 ...ple.CoreServices.CarbonCore 0x90cc1638 CallComponentDispatch + 34<br>
| |
− | 15 com.apple.QuickTime 0x94439b33 ImageCodecBandDecompress + 43<br>
| |
− | 16 com.apple.QuickTime 0x94427d8f DoBandedDecompress + 15359<br>
| |
− | 17 com.apple.QuickTime 0x94423dee ICMAction + 642<br>
| |
− | 18 com.apple.QuickTime 0x94422ae6 ICMDeviceLoop + 635<br>
| |
− | 19 com.apple.QuickTime 0x9442bc35 <B>DecompressSequenceFrameWhen</B> + 797<br>
| |
− | | |
− | MPlayer and VLC also have the same crash when in Quartz mode. A call to DecompressSequenceFrameWhen results in a crash in YUV420To2VUY.
| |
− | | |
− | ==Useful Links==
| |
− | [http://mplayerhq.hu/pipermail/ffmpeg-devel/2006-February/007608.html ffmpeg updates] for mmx assembly code. | |
− | | |
− | [http://forum.videolan.org/viewtopic.php?t=16725&start=30&sid=b8154ad0dd403ecef0577c343d0b7d45 VLC Forum], thread with post desribing similar crash when using Quartz/Quicktime output.
| |
− | | |
− | ==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.
| |
− | | |
− | [[Category:Developer Documentation]] [[Category:MacOS]]
| |