Index: config.h
===================================================================
--- config.h	(revision 0)
+++ config.h	(revision 0)
@@ -0,0 +1,1596 @@
+/* -------- This file has been automatically generated by configure ---------
+   Note: Any changes in it will be lost when you run configure again. */
+
+/* Protect against multiple inclusion */
+#ifndef MPLAYER_CONFIG_H
+#define MPLAYER_CONFIG_H
+
+#define CONFIGURATION "--with-twiizers"
+
+#ifndef CODECS2HTML
+#include "osdep/plat_gekko.h"
+#endif
+
+/* make sure we never get lavformat's poll() emulation, the results are
+   horrible if the X libs try to actually use it, see MPlayer-users
+   Message-ID: <45D49541.8060101@infernix.net>
+   Date: Thu, 15 Feb 2007 18:15:45 +0100
+   Subject: [MPlayer-users] Crash with backtrace when playing back demuxed...
+*/
+#define HAVE_SYS_POLL_H 1
+
+/* yes, we have inttypes.h */
+#define HAVE_INTTYPES_H 1
+
+/* int_fastXY_t emulation */
+
+
+/* libdvdcss */
+#define HAVE_ERRNO_H 1
+
+/* libdvdcss + libdvdread */
+#define HAVE_LIMITS_H 1
+
+/* libdvdcss + libfaad2 */
+#define HAVE_UNISTD_H 1
+
+/* libfaad2 + libdvdread */
+#define STDC_HEADERS 1
+
+/* libfaad2 */
+#define HAVE_MEMCPY 1
+#define HAVE_STRCHR 1
+
+/* libdvdread */
+#define HAVE_UINTPTR_T 1
+
+/* name of messages charset */
+#define MSG_CHARSET "UTF-8"
+
+/* Runtime CPU detection */
+#undef RUNTIME_CPUDETECT
+
+/* Dynamic a/v plugins */
+#undef CONFIG_DYNAMIC_PLUGINS
+
+/* "restrict" keyword */
+#define restrict __restrict
+
+/* __builtin_expect branch prediction hint */
+#define HAVE_BUILTIN_EXPECT 1
+#ifdef HAVE_BUILTIN_EXPECT
+#define likely(x) __builtin_expect ((x) != 0, 1)
+#define unlikely(x) __builtin_expect ((x) != 0, 0)
+#else
+#define likely(x) (x)
+#define unlikely(x) (x)
+#endif
+
+/* attribute(used) as needed by some compilers */
+#if (__GNUC__ * 100 + __GNUC_MINOR__ >= 300)
+# define attribute_used __attribute__((used))
+#else
+# define attribute_used
+#endif
+
+/* extern symbol prefix */
+#define EXTERN_PREFIX ""
+
+/* compiler support for named assembler arguments */
+#define NAMED_ASM_ARGS 1
+
+/* enable/disable SIGHANDLER */
+#undef CONFIG_SIGHANDLER
+
+/* enable/disable automatic gdb attach on crash, requires SIGHANDLER */
+#undef CONFIG_CRASH_DEBUG
+
+/* Toggles debugging informations */
+#undef MP_DEBUG
+
+/* Indicates that libcdio is available for VCD and CD-DA playback */
+#undef CONFIG_LIBCDIO
+
+/* Indicates that Ogle's libdvdread is available for DVD playback */
+#define CONFIG_DVDREAD 1
+
+/* Indicates that dvdread is internal */
+
+
+/* Additional options for libdvdread/libdvdcss */
+#undef DVD_STRUCT_IN_DVD_H
+#undef DVD_STRUCT_IN_LINUX_CDROM_H
+#undef DVD_STRUCT_IN_SYS_CDIO_H
+#undef DVD_STRUCT_IN_SYS_DVDIO_H
+
+
+
+
+
+
+
+
+/* Common data directory (for fonts, etc) */
+#define MPLAYER_DATADIR "/apps/mplayer"
+#define MPLAYER_CONFDIR "/apps/mplayer"
+#define MPLAYER_LIBDIR "/apps/mplayer"
+
+/* Define this to compile stream-caching support, it can be enabled via
+   -cache <kilobytes> */
+#undef CONFIG_STREAM_CACHE
+
+/* Define if you are using Xvid library */
+#undef CONFIG_XVID4
+
+/* Define if you are using the X.264 library */
+#undef CONFIG_X264
+
+/* Define if you are using libnut */
+#undef CONFIG_LIBNUT
+
+/* Define to include support for libdv-0.9.5 */
+#undef CONFIG_LIBDV095
+
+/* Indicates if libmp3lame is available
+   Note: for mencoder */
+
+
+
+
+/* Undefine this if you do not want to select mono audio (left or right)
+   with a stereo MPEG layer 2/3 audio stream. The command line option
+   -stereo has three possible values (0 for stereo, 1 for left-only, 2 for
+   right-only), with 0 being the default.
+   */
+#define CONFIG_FAKE_MONO 1
+
+/* Undefine this if your sound card driver has no working select().
+   If you have kernel Oops, player hangups, or just no audio, you should
+   try to recompile MPlayer with this option disabled! */
+#define HAVE_AUDIO_SELECT 1
+
+/* define this to use iconv(3) function to codepage conversions */
+#undef CONFIG_ICONV
+
+/* define this to use nl_langinfo function */
+#define HAVE_LANGINFO 1
+
+/* define this to use RTC (/dev/rtc) for video timers */
+#undef HAVE_RTC
+
+/* set up max. outburst. use 65536 for ALSA 0.5, for others 16384 is enough */
+#define MAX_OUTBURST 65536
+
+/* set up audio OUTBURST. Do not change this! */
+#define OUTBURST 512
+
+/* Define this if your system has the header file for the OSS sound interface */
+#undef HAVE_SYS_SOUNDCARD_H
+
+/* Define this if your system has the header file for the OSS sound interface
+ * in /usr/include */
+#undef HAVE_SOUNDCARD_H
+
+/* Define this if your system has the sysinfo header */
+#undef HAVE_SYS_SYSINFO_H
+
+/* Define this if your system has the "malloc.h" header file */
+#define HAVE_MALLOC_H 1
+
+/* memalign is mapped to malloc if unsupported */
+#define HAVE_MEMALIGN 1
+
+
+
+/* assembler handling of .align */
+#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t"
+
+/* Define this if your system has the "alloca.h" header file */
+#define HAVE_ALLOCA_H 1
+
+/* Define this if your system has the "byteswap.h" header file */
+#undef HAVE_BYTESWAP_H
+
+/* Define this if your system has the "sys/mman.h" header file */
+#undef HAVE_SYS_MMAN_H
+#define MAP_FAILED ((void *) -1)
+
+/* Define this if you have the elf dynamic linker -ldl library */
+#undef HAVE_LIBDL
+
+/* Define this if you have the kstat kernel statistics library */
+#undef HAVE_LIBKSTAT
+
+/* Define this if you have zlib */
+#undef CONFIG_ZLIB
+
+/* Define this if you have shm support */
+#undef HAVE_SHM
+
+/* Define this if your system has strsep */
+#define HAVE_STRSEP 1
+
+/* Define this if your system has vsscanf */
+#define HAVE_VSSCANF 1
+
+/* Define this if your system has swab */
+#define HAVE_SWAB 1
+
+/* Define this if your system has posix select */
+#undef HAVE_POSIX_SELECT
+
+/* Define this if your system has gettimeofday */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define this if your system has glob */
+#undef HAVE_GLOB
+
+/* Define this if your system has setenv */
+#define HAVE_SETENV 1
+#ifndef HAVE_SETENV
+int setenv(const char *name, const char *val, int overwrite);
+#endif
+
+/* Define this if your system has sysi86 */
+
+
+
+/* Define this if your system has pthreads */
+#undef HAVE_PTHREADS
+
+/* LIRC (remote control, see www.lirc.org) support: */
+#undef CONFIG_LIRC
+
+/* Apple Remote (remote control, see http://docs.info.apple.com/article.html?artnum=302504) support: */
+
+
+/* Apple IR Remote (Linux remote control driver) */
+
+
+/* Support for maemo (http://www.maemo.org) */
+
+
+/*
+ * LIRCCD (LIRC client daemon)
+ * See http://www.dolda2000.cjb.net/~fredrik/lirccd/
+ */
+#undef CONFIG_LIRCC
+
+/* DVD navigation support using libdvdnav */
+#define CONFIG_DVDNAV 1
+
+/* Define this to enable MPEG 1/2 image postprocessing (requires a FAST CPU!) */
+#define MPEG12_POSTPROC 1
+
+/* maximum alignment used by libmpeg2 */
+#define ATTRIBUTE_ALIGNED_MAX 16
+
+/* Win32 DLL support */
+#undef CONFIG_WIN32DLL
+#define WIN32_PATH ""
+
+/* Mac OS X specific features */
+
+
+
+
+
+
+
+/* Build our Win32-loader */
+#undef WIN32_LOADER
+
+/* FFmpeg */
+/* Define this to enable image postprocessing in libavcodec (requires a FAST CPU!) */
+#define CONFIG_LIBPOSTPROC 1
+#define CONFIG_LIBPOSTPROC_A 1
+#undef CONFIG_LIBPOSTPROC_SO
+
+/* Define this if you enabled thread support for libavcodec */
+#undef HAVE_THREADS
+#ifdef HAVE_THREADS
+#define ENABLE_THREADS 1
+#else
+#define ENABLE_THREADS 0
+#endif
+
+/* ffmpeg's libavcodec support (requires libavcodec source) */
+#define CONFIG_LIBAVCODEC 1
+#define CONFIG_LIBAVCODEC_A 1
+#undef CONFIG_LIBAVCODEC_SO
+#define CONFIG_MPEGAUDIO_HP 1
+
+/* ffmpeg's libavformat support (requires libavformat source) */
+#define CONFIG_LIBAVFORMAT 1
+#define CONFIG_LIBAVFORMAT_A 1
+#undef CONFIG_LIBAVFORMAT_SO
+
+#define CONFIG_LIBAVUTIL 1
+#define CONFIG_LIBAVUTIL_A 1
+#undef CONFIG_LIBAVUTIL_SO
+
+/* Use libavcodec's decoders */
+#define CONFIG_DECODERS 1
+#define ENABLE_DECODERS 1
+/* Use libavcodec's encoders */
+#define CONFIG_ENCODERS 1
+#define ENABLE_ENCODERS 1
+
+/* Use libavformat's demuxers */
+#define CONFIG_DEMUXERS 1
+#define ENABLE_DEMUXERS 1
+/* Use libavformat's muxers */
+
+
+/* Use these registers in FFmpeg x86 inline asm. No proper detection yet. */
+#define HAVE_EBX_AVAILABLE 1
+#ifndef MP_DEBUG
+#define HAVE_EBP_AVAILABLE 1
+#endif
+
+#define CONFIG_GPL 1
+#define ENABLE_SMALL 0
+#define ENABLE_GRAY 0
+
+/* Use AMR codecs from libavcodec. */
+
+#undef CONFIG_LIBAMR_NB
+#undef CONFIG_LIBAMR_WB
+
+/* Use specific parts from FFmpeg. */
+#define CONFIG_AASC_DECODER 1
+#define ENABLE_AASC_DECODER 1
+#define CONFIG_AMV_DECODER 1
+#define ENABLE_AMV_DECODER 1
+#define CONFIG_ASV1_DECODER 1
+#define ENABLE_ASV1_DECODER 1
+#define CONFIG_ASV2_DECODER 1
+#define ENABLE_ASV2_DECODER 1
+#define CONFIG_AVS_DECODER 1
+#define ENABLE_AVS_DECODER 1
+#define CONFIG_BETHSOFTVID_DECODER 1
+#define ENABLE_BETHSOFTVID_DECODER 1
+#define CONFIG_BFI_DECODER 1
+#define ENABLE_BFI_DECODER 1
+#define CONFIG_BMP_DECODER 1
+#define ENABLE_BMP_DECODER 1
+#define CONFIG_C93_DECODER 1
+#define ENABLE_C93_DECODER 1
+#define CONFIG_CAVS_DECODER 1
+#define ENABLE_CAVS_DECODER 1
+#define CONFIG_CINEPAK_DECODER 1
+#define ENABLE_CINEPAK_DECODER 1
+#define CONFIG_CLJR_DECODER 1
+#define ENABLE_CLJR_DECODER 1
+#define CONFIG_CSCD_DECODER 1
+#define ENABLE_CSCD_DECODER 1
+#define CONFIG_CYUV_DECODER 1
+#define ENABLE_CYUV_DECODER 1
+#define CONFIG_DNXHD_DECODER 1
+#define ENABLE_DNXHD_DECODER 1
+#define CONFIG_DSICINVIDEO_DECODER 1
+#define ENABLE_DSICINVIDEO_DECODER 1
+#define CONFIG_DVVIDEO_DECODER 1
+#define ENABLE_DVVIDEO_DECODER 1
+#define ENABLE_DXA_DECODER 0
+#define CONFIG_EACMV_DECODER 1
+#define ENABLE_EACMV_DECODER 1
+#define CONFIG_EATGV_DECODER 1
+#define ENABLE_EATGV_DECODER 1
+#define CONFIG_EIGHTBPS_DECODER 1
+#define ENABLE_EIGHTBPS_DECODER 1
+#define CONFIG_EIGHTSVX_EXP_DECODER 1
+#define ENABLE_EIGHTSVX_EXP_DECODER 1
+#define CONFIG_EIGHTSVX_FIB_DECODER 1
+#define ENABLE_EIGHTSVX_FIB_DECODER 1
+#define CONFIG_ESCAPE124_DECODER 1
+#define ENABLE_ESCAPE124_DECODER 1
+#define CONFIG_FFV1_DECODER 1
+#define ENABLE_FFV1_DECODER 1
+#define CONFIG_FFVHUFF_DECODER 1
+#define ENABLE_FFVHUFF_DECODER 1
+#define ENABLE_FLASHSV_DECODER 0
+#define CONFIG_FLIC_DECODER 1
+#define ENABLE_FLIC_DECODER 1
+#define CONFIG_FLV_DECODER 1
+#define ENABLE_FLV_DECODER 1
+#define CONFIG_FOURXM_DECODER 1
+#define ENABLE_FOURXM_DECODER 1
+#define CONFIG_FRAPS_DECODER 1
+#define ENABLE_FRAPS_DECODER 1
+#define CONFIG_GIF_DECODER 1
+#define ENABLE_GIF_DECODER 1
+#define CONFIG_H261_DECODER 1
+#define ENABLE_H261_DECODER 1
+#define CONFIG_H263_DECODER 1
+#define ENABLE_H263_DECODER 1
+#define CONFIG_H263I_DECODER 1
+#define ENABLE_H263I_DECODER 1
+#define CONFIG_H264_DECODER 1
+#define ENABLE_H264_DECODER 1
+#define CONFIG_HUFFYUV_DECODER 1
+#define ENABLE_HUFFYUV_DECODER 1
+#define CONFIG_IDCIN_DECODER 1
+#define ENABLE_IDCIN_DECODER 1
+#define CONFIG_INDEO2_DECODER 1
+#define ENABLE_INDEO2_DECODER 1
+#define CONFIG_INDEO3_DECODER 1
+#define ENABLE_INDEO3_DECODER 1
+#define CONFIG_INTERPLAY_VIDEO_DECODER 1
+#define ENABLE_INTERPLAY_VIDEO_DECODER 1
+#define CONFIG_JPEGLS_DECODER 1
+#define ENABLE_JPEGLS_DECODER 1
+#define CONFIG_KMVC_DECODER 1
+#define ENABLE_KMVC_DECODER 1
+#define CONFIG_LOCO_DECODER 1
+#define ENABLE_LOCO_DECODER 1
+#define CONFIG_MDEC_DECODER 1
+#define ENABLE_MDEC_DECODER 1
+#define CONFIG_MIMIC_DECODER 1
+#define ENABLE_MIMIC_DECODER 1
+#define CONFIG_MJPEG_DECODER 1
+#define ENABLE_MJPEG_DECODER 1
+#define CONFIG_MJPEGB_DECODER 1
+#define ENABLE_MJPEGB_DECODER 1
+#define CONFIG_MMVIDEO_DECODER 1
+#define ENABLE_MMVIDEO_DECODER 1
+#define CONFIG_MOTIONPIXELS_DECODER 1
+#define ENABLE_MOTIONPIXELS_DECODER 1
+#define ENABLE_MPEG_XVMC_DECODER 0
+#define CONFIG_MPEG1VIDEO_DECODER 1
+#define ENABLE_MPEG1VIDEO_DECODER 1
+#define CONFIG_MPEG2VIDEO_DECODER 1
+#define ENABLE_MPEG2VIDEO_DECODER 1
+#define CONFIG_MPEG4_DECODER 1
+#define ENABLE_MPEG4_DECODER 1
+#define CONFIG_MPEGVIDEO_DECODER 1
+#define ENABLE_MPEGVIDEO_DECODER 1
+#define CONFIG_MSMPEG4V1_DECODER 1
+#define ENABLE_MSMPEG4V1_DECODER 1
+#define CONFIG_MSMPEG4V2_DECODER 1
+#define ENABLE_MSMPEG4V2_DECODER 1
+#define CONFIG_MSMPEG4V3_DECODER 1
+#define ENABLE_MSMPEG4V3_DECODER 1
+#define CONFIG_MSRLE_DECODER 1
+#define ENABLE_MSRLE_DECODER 1
+#define CONFIG_MSVIDEO1_DECODER 1
+#define ENABLE_MSVIDEO1_DECODER 1
+#define CONFIG_MSZH_DECODER 1
+#define ENABLE_MSZH_DECODER 1
+#define CONFIG_NUV_DECODER 1
+#define ENABLE_NUV_DECODER 1
+#define CONFIG_PCX_DECODER 1
+#define ENABLE_PCX_DECODER 1
+#define ENABLE_PNG_DECODER 0
+#define CONFIG_PTX_DECODER 1
+#define ENABLE_PTX_DECODER 1
+#define CONFIG_QDRAW_DECODER 1
+#define ENABLE_QDRAW_DECODER 1
+#define CONFIG_QPEG_DECODER 1
+#define ENABLE_QPEG_DECODER 1
+#define CONFIG_QTRLE_DECODER 1
+#define ENABLE_QTRLE_DECODER 1
+#define CONFIG_RAWVIDEO_DECODER 1
+#define ENABLE_RAWVIDEO_DECODER 1
+#define CONFIG_RL2_DECODER 1
+#define ENABLE_RL2_DECODER 1
+#define CONFIG_ROQ_DECODER 1
+#define ENABLE_ROQ_DECODER 1
+#define CONFIG_RPZA_DECODER 1
+#define ENABLE_RPZA_DECODER 1
+#define CONFIG_RV10_DECODER 1
+#define ENABLE_RV10_DECODER 1
+#define CONFIG_RV20_DECODER 1
+#define ENABLE_RV20_DECODER 1
+#define CONFIG_SGI_DECODER 1
+#define ENABLE_SGI_DECODER 1
+#define CONFIG_SMACKER_DECODER 1
+#define ENABLE_SMACKER_DECODER 1
+#define CONFIG_SMC_DECODER 1
+#define ENABLE_SMC_DECODER 1
+#define CONFIG_SNOW_DECODER 1
+#define ENABLE_SNOW_DECODER 1
+#define CONFIG_SP5X_DECODER 1
+#define ENABLE_SP5X_DECODER 1
+#define CONFIG_SUNRAST_DECODER 1
+#define ENABLE_SUNRAST_DECODER 1
+#define CONFIG_SVQ1_DECODER 1
+#define ENABLE_SVQ1_DECODER 1
+#define CONFIG_SVQ3_DECODER 1
+#define ENABLE_SVQ3_DECODER 1
+#define CONFIG_TARGA_DECODER 1
+#define ENABLE_TARGA_DECODER 1
+#define CONFIG_THEORA_DECODER 1
+#define ENABLE_THEORA_DECODER 1
+#define CONFIG_THP_DECODER 1
+#define ENABLE_THP_DECODER 1
+#define CONFIG_TIERTEXSEQVIDEO_DECODER 1
+#define ENABLE_TIERTEXSEQVIDEO_DECODER 1
+#define CONFIG_TIFF_DECODER 1
+#define ENABLE_TIFF_DECODER 1
+#define CONFIG_TRUEMOTION1_DECODER 1
+#define ENABLE_TRUEMOTION1_DECODER 1
+#define CONFIG_TRUEMOTION2_DECODER 1
+#define ENABLE_TRUEMOTION2_DECODER 1
+#define CONFIG_TSCC_DECODER 1
+#define ENABLE_TSCC_DECODER 1
+#define CONFIG_TXD_DECODER 1
+#define ENABLE_TXD_DECODER 1
+#define CONFIG_ULTI_DECODER 1
+#define ENABLE_ULTI_DECODER 1
+#define CONFIG_VB_DECODER 1
+#define ENABLE_VB_DECODER 1
+#define CONFIG_VC1_DECODER 1
+#define ENABLE_VC1_DECODER 1
+#define CONFIG_VCR1_DECODER 1
+#define ENABLE_VCR1_DECODER 1
+#define CONFIG_VMDVIDEO_DECODER 1
+#define ENABLE_VMDVIDEO_DECODER 1
+#define CONFIG_VMNC_DECODER 1
+#define ENABLE_VMNC_DECODER 1
+#define CONFIG_VP3_DECODER 1
+#define ENABLE_VP3_DECODER 1
+#define CONFIG_VP5_DECODER 1
+#define ENABLE_VP5_DECODER 1
+#define CONFIG_VP6_DECODER 1
+#define ENABLE_VP6_DECODER 1
+#define CONFIG_VP6A_DECODER 1
+#define ENABLE_VP6A_DECODER 1
+#define CONFIG_VP6F_DECODER 1
+#define ENABLE_VP6F_DECODER 1
+#define CONFIG_VQA_DECODER 1
+#define ENABLE_VQA_DECODER 1
+#define CONFIG_WMV1_DECODER 1
+#define ENABLE_WMV1_DECODER 1
+#define CONFIG_WMV2_DECODER 1
+#define ENABLE_WMV2_DECODER 1
+#define CONFIG_WMV3_DECODER 1
+#define ENABLE_WMV3_DECODER 1
+#define CONFIG_WNV1_DECODER 1
+#define ENABLE_WNV1_DECODER 1
+#define CONFIG_XAN_WC3_DECODER 1
+#define ENABLE_XAN_WC3_DECODER 1
+#define CONFIG_XL_DECODER 1
+#define ENABLE_XL_DECODER 1
+#define CONFIG_XSUB_DECODER 1
+#define ENABLE_XSUB_DECODER 1
+#define CONFIG_ZLIB_DECODER 1
+#define ENABLE_ZLIB_DECODER 1
+#define ENABLE_ZMBV_DECODER 0
+#define CONFIG_AC3_DECODER 1
+#define ENABLE_AC3_DECODER 1
+#define CONFIG_ALAC_DECODER 1
+#define ENABLE_ALAC_DECODER 1
+#define CONFIG_APE_DECODER 1
+#define ENABLE_APE_DECODER 1
+#define CONFIG_ATRAC3_DECODER 1
+#define ENABLE_ATRAC3_DECODER 1
+#define CONFIG_COOK_DECODER 1
+#define ENABLE_COOK_DECODER 1
+#define CONFIG_DCA_DECODER 1
+#define ENABLE_DCA_DECODER 1
+#define CONFIG_DSICINAUDIO_DECODER 1
+#define ENABLE_DSICINAUDIO_DECODER 1
+#define CONFIG_FLAC_DECODER 1
+#define ENABLE_FLAC_DECODER 1
+#define CONFIG_IMC_DECODER 1
+#define ENABLE_IMC_DECODER 1
+#define CONFIG_MACE3_DECODER 1
+#define ENABLE_MACE3_DECODER 1
+#define CONFIG_MACE6_DECODER 1
+#define ENABLE_MACE6_DECODER 1
+#define CONFIG_MLP_DECODER 1
+#define ENABLE_MLP_DECODER 1
+#define CONFIG_MP2_DECODER 1
+#define ENABLE_MP2_DECODER 1
+#define CONFIG_MP3_DECODER 1
+#define ENABLE_MP3_DECODER 1
+#define CONFIG_MP3ADU_DECODER 1
+#define ENABLE_MP3ADU_DECODER 1
+#define CONFIG_MP3ON4_DECODER 1
+#define ENABLE_MP3ON4_DECODER 1
+#define CONFIG_MPC7_DECODER 1
+#define ENABLE_MPC7_DECODER 1
+#define CONFIG_MPC8_DECODER 1
+#define ENABLE_MPC8_DECODER 1
+#define CONFIG_NELLYMOSER_DECODER 1
+#define ENABLE_NELLYMOSER_DECODER 1
+#define CONFIG_QDM2_DECODER 1
+#define ENABLE_QDM2_DECODER 1
+#define CONFIG_RA_144_DECODER 1
+#define ENABLE_RA_144_DECODER 1
+#define CONFIG_RA_288_DECODER 1
+#define ENABLE_RA_288_DECODER 1
+#define CONFIG_SHORTEN_DECODER 1
+#define ENABLE_SHORTEN_DECODER 1
+#define CONFIG_SMACKAUD_DECODER 1
+#define ENABLE_SMACKAUD_DECODER 1
+#define CONFIG_SONIC_DECODER 1
+#define ENABLE_SONIC_DECODER 1
+#define CONFIG_TRUESPEECH_DECODER 1
+#define ENABLE_TRUESPEECH_DECODER 1
+#define CONFIG_TTA_DECODER 1
+#define ENABLE_TTA_DECODER 1
+#define CONFIG_VMDAUDIO_DECODER 1
+#define ENABLE_VMDAUDIO_DECODER 1
+#define CONFIG_VORBIS_DECODER 1
+#define ENABLE_VORBIS_DECODER 1
+#define CONFIG_WAVPACK_DECODER 1
+#define ENABLE_WAVPACK_DECODER 1
+#define CONFIG_WMAV1_DECODER 1
+#define ENABLE_WMAV1_DECODER 1
+#define CONFIG_WMAV2_DECODER 1
+#define ENABLE_WMAV2_DECODER 1
+#define CONFIG_WS_SND1_DECODER 1
+#define ENABLE_WS_SND1_DECODER 1
+#define CONFIG_PCM_ALAW_DECODER 1
+#define ENABLE_PCM_ALAW_DECODER 1
+#define CONFIG_PCM_DVD_DECODER 1
+#define ENABLE_PCM_DVD_DECODER 1
+#define CONFIG_PCM_F32BE_DECODER 1
+#define ENABLE_PCM_F32BE_DECODER 1
+#define CONFIG_PCM_MULAW_DECODER 1
+#define ENABLE_PCM_MULAW_DECODER 1
+#define CONFIG_PCM_S8_DECODER 1
+#define ENABLE_PCM_S8_DECODER 1
+#define CONFIG_PCM_S16BE_DECODER 1
+#define ENABLE_PCM_S16BE_DECODER 1
+#define CONFIG_PCM_S16LE_DECODER 1
+#define ENABLE_PCM_S16LE_DECODER 1
+#define CONFIG_PCM_S16LE_PLANAR_DECODER 1
+#define ENABLE_PCM_S16LE_PLANAR_DECODER 1
+#define CONFIG_PCM_S24BE_DECODER 1
+#define ENABLE_PCM_S24BE_DECODER 1
+#define CONFIG_PCM_S24DAUD_DECODER 1
+#define ENABLE_PCM_S24DAUD_DECODER 1
+#define CONFIG_PCM_S24LE_DECODER 1
+#define ENABLE_PCM_S24LE_DECODER 1
+#define CONFIG_PCM_S32BE_DECODER 1
+#define ENABLE_PCM_S32BE_DECODER 1
+#define CONFIG_PCM_S32LE_DECODER 1
+#define ENABLE_PCM_S32LE_DECODER 1
+#define CONFIG_PCM_U8_DECODER 1
+#define ENABLE_PCM_U8_DECODER 1
+#define CONFIG_PCM_U16BE_DECODER 1
+#define ENABLE_PCM_U16BE_DECODER 1
+#define CONFIG_PCM_U16LE_DECODER 1
+#define ENABLE_PCM_U16LE_DECODER 1
+#define CONFIG_PCM_U24BE_DECODER 1
+#define ENABLE_PCM_U24BE_DECODER 1
+#define CONFIG_PCM_U24LE_DECODER 1
+#define ENABLE_PCM_U24LE_DECODER 1
+#define CONFIG_PCM_U32BE_DECODER 1
+#define ENABLE_PCM_U32BE_DECODER 1
+#define CONFIG_PCM_U32LE_DECODER 1
+#define ENABLE_PCM_U32LE_DECODER 1
+#define CONFIG_PCM_ZORK_DECODER 1
+#define ENABLE_PCM_ZORK_DECODER 1
+#define CONFIG_INTERPLAY_DPCM_DECODER 1
+#define ENABLE_INTERPLAY_DPCM_DECODER 1
+#define CONFIG_ROQ_DPCM_DECODER 1
+#define ENABLE_ROQ_DPCM_DECODER 1
+#define CONFIG_SOL_DPCM_DECODER 1
+#define ENABLE_SOL_DPCM_DECODER 1
+#define CONFIG_XAN_DPCM_DECODER 1
+#define ENABLE_XAN_DPCM_DECODER 1
+#define CONFIG_ADPCM_4XM_DECODER 1
+#define ENABLE_ADPCM_4XM_DECODER 1
+#define CONFIG_ADPCM_ADX_DECODER 1
+#define ENABLE_ADPCM_ADX_DECODER 1
+#define CONFIG_ADPCM_CT_DECODER 1
+#define ENABLE_ADPCM_CT_DECODER 1
+#define CONFIG_ADPCM_EA_DECODER 1
+#define ENABLE_ADPCM_EA_DECODER 1
+#define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 1
+#define ENABLE_ADPCM_EA_MAXIS_XA_DECODER 1
+#define CONFIG_ADPCM_EA_R1_DECODER 1
+#define ENABLE_ADPCM_EA_R1_DECODER 1
+#define CONFIG_ADPCM_EA_R2_DECODER 1
+#define ENABLE_ADPCM_EA_R2_DECODER 1
+#define CONFIG_ADPCM_EA_R3_DECODER 1
+#define ENABLE_ADPCM_EA_R3_DECODER 1
+#define CONFIG_ADPCM_EA_XAS_DECODER 1
+#define ENABLE_ADPCM_EA_XAS_DECODER 1
+#define CONFIG_ADPCM_G726_DECODER 1
+#define ENABLE_ADPCM_G726_DECODER 1
+#define CONFIG_ADPCM_IMA_AMV_DECODER 1
+#define ENABLE_ADPCM_IMA_AMV_DECODER 1
+#define CONFIG_ADPCM_IMA_DK3_DECODER 1
+#define ENABLE_ADPCM_IMA_DK3_DECODER 1
+#define CONFIG_ADPCM_IMA_DK4_DECODER 1
+#define ENABLE_ADPCM_IMA_DK4_DECODER 1
+#define CONFIG_ADPCM_IMA_EA_EACS_DECODER 1
+#define ENABLE_ADPCM_IMA_EA_EACS_DECODER 1
+#define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 1
+#define ENABLE_ADPCM_IMA_EA_SEAD_DECODER 1
+#define CONFIG_ADPCM_IMA_QT_DECODER 1
+#define ENABLE_ADPCM_IMA_QT_DECODER 1
+#define CONFIG_ADPCM_IMA_SMJPEG_DECODER 1
+#define ENABLE_ADPCM_IMA_SMJPEG_DECODER 1
+#define CONFIG_ADPCM_IMA_WAV_DECODER 1
+#define ENABLE_ADPCM_IMA_WAV_DECODER 1
+#define CONFIG_ADPCM_IMA_WS_DECODER 1
+#define ENABLE_ADPCM_IMA_WS_DECODER 1
+#define CONFIG_ADPCM_MS_DECODER 1
+#define ENABLE_ADPCM_MS_DECODER 1
+#define CONFIG_ADPCM_SBPRO_2_DECODER 1
+#define ENABLE_ADPCM_SBPRO_2_DECODER 1
+#define CONFIG_ADPCM_SBPRO_3_DECODER 1
+#define ENABLE_ADPCM_SBPRO_3_DECODER 1
+#define CONFIG_ADPCM_SBPRO_4_DECODER 1
+#define ENABLE_ADPCM_SBPRO_4_DECODER 1
+#define CONFIG_ADPCM_SWF_DECODER 1
+#define ENABLE_ADPCM_SWF_DECODER 1
+#define CONFIG_ADPCM_THP_DECODER 1
+#define ENABLE_ADPCM_THP_DECODER 1
+#define CONFIG_ADPCM_XA_DECODER 1
+#define ENABLE_ADPCM_XA_DECODER 1
+#define CONFIG_ADPCM_YAMAHA_DECODER 1
+#define ENABLE_ADPCM_YAMAHA_DECODER 1
+#define CONFIG_DVBSUB_DECODER 1
+#define ENABLE_DVBSUB_DECODER 1
+#define CONFIG_DVDSUB_DECODER 1
+#define ENABLE_DVDSUB_DECODER 1
+#define ENABLE_LIBA52_DECODER 0
+#define ENABLE_LIBAMR_NB_DECODER 0
+#define ENABLE_LIBAMR_WB_DECODER 0
+#define ENABLE_LIBDIRAC_DECODER 0
+#define ENABLE_LIBFAAD_DECODER 0
+#define ENABLE_LIBGSM_DECODER 0
+#define ENABLE_LIBGSM_MS_DECODER 0
+#define ENABLE_LIBSCHROEDINGER_DECODER 0
+#define ENABLE_MPEG4AAC_DECODER 0
+#define ENABLE_ASV1_ENCODER 0
+#define ENABLE_ASV2_ENCODER 0
+#define ENABLE_BMP_ENCODER 0
+#define ENABLE_DNXHD_ENCODER 0
+#define ENABLE_DVVIDEO_ENCODER 0
+#define ENABLE_FFV1_ENCODER 0
+#define ENABLE_FFVHUFF_ENCODER 0
+#define ENABLE_FLASHSV_ENCODER 0
+#define ENABLE_FLV_ENCODER 0
+#define ENABLE_GIF_ENCODER 0
+#define ENABLE_H261_ENCODER 0
+#define ENABLE_H263_ENCODER 0
+#define ENABLE_H263P_ENCODER 0
+#define ENABLE_HUFFYUV_ENCODER 0
+#define ENABLE_JPEGLS_ENCODER 0
+#define ENABLE_LJPEG_ENCODER 0
+#define ENABLE_MJPEG_ENCODER 0
+#define CONFIG_MPEG1VIDEO_ENCODER 1
+#define ENABLE_MPEG1VIDEO_ENCODER 1
+#define ENABLE_MPEG2VIDEO_ENCODER 0
+#define ENABLE_MPEG4_ENCODER 0
+#define ENABLE_MSMPEG4V1_ENCODER 0
+#define ENABLE_MSMPEG4V2_ENCODER 0
+#define ENABLE_MSMPEG4V3_ENCODER 0
+#define ENABLE_PAM_ENCODER 0
+#define ENABLE_PBM_ENCODER 0
+#define ENABLE_PGM_ENCODER 0
+#define ENABLE_PGMYUV_ENCODER 0
+#define ENABLE_PNG_ENCODER 0
+#define ENABLE_PPM_ENCODER 0
+#define ENABLE_QTRLE_ENCODER 0
+#define ENABLE_RAWVIDEO_ENCODER 0
+#define ENABLE_ROQ_ENCODER 0
+#define ENABLE_RV10_ENCODER 0
+#define ENABLE_RV20_ENCODER 0
+#define ENABLE_SGI_ENCODER 0
+#define CONFIG_SNOW_ENCODER 1
+#define ENABLE_SNOW_ENCODER 1
+#define ENABLE_SVQ1_ENCODER 0
+#define ENABLE_TARGA_ENCODER 0
+#define ENABLE_TIFF_ENCODER 0
+#define ENABLE_WMV1_ENCODER 0
+#define ENABLE_WMV2_ENCODER 0
+#define ENABLE_ZLIB_ENCODER 0
+#define ENABLE_ZMBV_ENCODER 0
+#define ENABLE_AC3_ENCODER 0
+#define ENABLE_FLAC_ENCODER 0
+#define ENABLE_MP2_ENCODER 0
+#define ENABLE_SONIC_ENCODER 0
+#define ENABLE_SONIC_LS_ENCODER 0
+#define ENABLE_VORBIS_ENCODER 0
+#define ENABLE_WMAV1_ENCODER 0
+#define ENABLE_WMAV2_ENCODER 0
+#define ENABLE_PCM_ALAW_ENCODER 0
+#define ENABLE_PCM_F32BE_ENCODER 0
+#define ENABLE_PCM_MULAW_ENCODER 0
+#define ENABLE_PCM_S8_ENCODER 0
+#define ENABLE_PCM_S16BE_ENCODER 0
+#define ENABLE_PCM_S16LE_ENCODER 0
+#define ENABLE_PCM_S24BE_ENCODER 0
+#define ENABLE_PCM_S24DAUD_ENCODER 0
+#define ENABLE_PCM_S24LE_ENCODER 0
+#define ENABLE_PCM_S32BE_ENCODER 0
+#define ENABLE_PCM_S32LE_ENCODER 0
+#define ENABLE_PCM_U8_ENCODER 0
+#define ENABLE_PCM_U16BE_ENCODER 0
+#define ENABLE_PCM_U16LE_ENCODER 0
+#define ENABLE_PCM_U24BE_ENCODER 0
+#define ENABLE_PCM_U24LE_ENCODER 0
+#define ENABLE_PCM_U32BE_ENCODER 0
+#define ENABLE_PCM_U32LE_ENCODER 0
+#define ENABLE_PCM_ZORK_ENCODER 0
+#define ENABLE_ROQ_DPCM_ENCODER 0
+#define ENABLE_ADPCM_ADX_ENCODER 0
+#define ENABLE_ADPCM_G726_ENCODER 0
+#define ENABLE_ADPCM_IMA_QT_ENCODER 0
+#define ENABLE_ADPCM_IMA_WAV_ENCODER 0
+#define ENABLE_ADPCM_MS_ENCODER 0
+#define ENABLE_ADPCM_SWF_ENCODER 0
+#define ENABLE_ADPCM_YAMAHA_ENCODER 0
+#define ENABLE_DVBSUB_ENCODER 0
+#define ENABLE_DVDSUB_ENCODER 0
+#define ENABLE_LIBAMR_NB_ENCODER 0
+#define ENABLE_LIBAMR_WB_ENCODER 0
+#define ENABLE_LIBDIRAC_ENCODER 0
+#define ENABLE_LIBFAAC_ENCODER 0
+#define ENABLE_LIBGSM_ENCODER 0
+#define ENABLE_LIBGSM_MS_ENCODER 0
+#define ENABLE_LIBMP3LAME_ENCODER 0
+#define ENABLE_LIBSCHROEDINGER_ENCODER 0
+#define ENABLE_LIBTHEORA_ENCODER 0
+#define ENABLE_LIBVORBIS_ENCODER 0
+#define ENABLE_LIBX264_ENCODER 0
+#define ENABLE_LIBXVID_ENCODER 0
+#define CONFIG_AAC_PARSER 1
+#define ENABLE_AAC_PARSER 1
+#define CONFIG_AC3_PARSER 1
+#define ENABLE_AC3_PARSER 1
+#define CONFIG_CAVSVIDEO_PARSER 1
+#define ENABLE_CAVSVIDEO_PARSER 1
+#define CONFIG_DCA_PARSER 1
+#define ENABLE_DCA_PARSER 1
+#define CONFIG_DIRAC_PARSER 1
+#define ENABLE_DIRAC_PARSER 1
+#define CONFIG_DVBSUB_PARSER 1
+#define ENABLE_DVBSUB_PARSER 1
+#define CONFIG_DVDSUB_PARSER 1
+#define ENABLE_DVDSUB_PARSER 1
+#define CONFIG_H261_PARSER 1
+#define ENABLE_H261_PARSER 1
+#define CONFIG_H263_PARSER 1
+#define ENABLE_H263_PARSER 1
+#define CONFIG_H264_PARSER 1
+#define ENABLE_H264_PARSER 1
+#define CONFIG_MJPEG_PARSER 1
+#define ENABLE_MJPEG_PARSER 1
+#define CONFIG_MLP_PARSER 1
+#define ENABLE_MLP_PARSER 1
+#define CONFIG_MPEG4VIDEO_PARSER 1
+#define ENABLE_MPEG4VIDEO_PARSER 1
+#define CONFIG_MPEGAUDIO_PARSER 1
+#define ENABLE_MPEGAUDIO_PARSER 1
+#define CONFIG_MPEGVIDEO_PARSER 1
+#define ENABLE_MPEGVIDEO_PARSER 1
+#define CONFIG_PNM_PARSER 1
+#define ENABLE_PNM_PARSER 1
+#define CONFIG_VC1_PARSER 1
+#define ENABLE_VC1_PARSER 1
+#define CONFIG_VP3_PARSER 1
+#define ENABLE_VP3_PARSER 1
+#define CONFIG_AAC_DEMUXER 1
+#define ENABLE_AAC_DEMUXER 1
+#define CONFIG_AC3_DEMUXER 1
+#define ENABLE_AC3_DEMUXER 1
+#define CONFIG_AIFF_DEMUXER 1
+#define ENABLE_AIFF_DEMUXER 1
+#define CONFIG_AMR_DEMUXER 1
+#define ENABLE_AMR_DEMUXER 1
+#define CONFIG_APC_DEMUXER 1
+#define ENABLE_APC_DEMUXER 1
+#define CONFIG_APE_DEMUXER 1
+#define ENABLE_APE_DEMUXER 1
+#define CONFIG_ASF_DEMUXER 1
+#define ENABLE_ASF_DEMUXER 1
+#define CONFIG_AU_DEMUXER 1
+#define ENABLE_AU_DEMUXER 1
+#define CONFIG_AVI_DEMUXER 1
+#define ENABLE_AVI_DEMUXER 1
+#define ENABLE_AVISYNTH_DEMUXER 0
+#define CONFIG_AVS_DEMUXER 1
+#define ENABLE_AVS_DEMUXER 1
+#define CONFIG_BETHSOFTVID_DEMUXER 1
+#define ENABLE_BETHSOFTVID_DEMUXER 1
+#define CONFIG_BFI_DEMUXER 1
+#define ENABLE_BFI_DEMUXER 1
+#define CONFIG_C93_DEMUXER 1
+#define ENABLE_C93_DEMUXER 1
+#define CONFIG_DAUD_DEMUXER 1
+#define ENABLE_DAUD_DEMUXER 1
+#define CONFIG_DIRAC_DEMUXER 1
+#define ENABLE_DIRAC_DEMUXER 1
+#define CONFIG_DSICIN_DEMUXER 1
+#define ENABLE_DSICIN_DEMUXER 1
+#define CONFIG_DTS_DEMUXER 1
+#define ENABLE_DTS_DEMUXER 1
+#define CONFIG_DV_DEMUXER 1
+#define ENABLE_DV_DEMUXER 1
+#define CONFIG_DXA_DEMUXER 1
+#define ENABLE_DXA_DEMUXER 1
+#define CONFIG_EA_DEMUXER 1
+#define ENABLE_EA_DEMUXER 1
+#define CONFIG_EA_CDATA_DEMUXER 1
+#define ENABLE_EA_CDATA_DEMUXER 1
+#define CONFIG_FFM_DEMUXER 1
+#define ENABLE_FFM_DEMUXER 1
+#define CONFIG_FLAC_DEMUXER 1
+#define ENABLE_FLAC_DEMUXER 1
+#define CONFIG_FLIC_DEMUXER 1
+#define ENABLE_FLIC_DEMUXER 1
+#define CONFIG_FLV_DEMUXER 1
+#define ENABLE_FLV_DEMUXER 1
+#define CONFIG_FOURXM_DEMUXER 1
+#define ENABLE_FOURXM_DEMUXER 1
+#define CONFIG_GSM_DEMUXER 1
+#define ENABLE_GSM_DEMUXER 1
+#define CONFIG_GXF_DEMUXER 1
+#define ENABLE_GXF_DEMUXER 1
+#define CONFIG_H261_DEMUXER 1
+#define ENABLE_H261_DEMUXER 1
+#define CONFIG_H263_DEMUXER 1
+#define ENABLE_H263_DEMUXER 1
+#define CONFIG_H264_DEMUXER 1
+#define ENABLE_H264_DEMUXER 1
+#define CONFIG_IDCIN_DEMUXER 1
+#define ENABLE_IDCIN_DEMUXER 1
+#define CONFIG_IFF_DEMUXER 1
+#define ENABLE_IFF_DEMUXER 1
+#define CONFIG_IMAGE2_DEMUXER 1
+#define ENABLE_IMAGE2_DEMUXER 1
+#define CONFIG_IMAGE2PIPE_DEMUXER 1
+#define ENABLE_IMAGE2PIPE_DEMUXER 1
+#define CONFIG_INGENIENT_DEMUXER 1
+#define ENABLE_INGENIENT_DEMUXER 1
+#define CONFIG_IPMOVIE_DEMUXER 1
+#define ENABLE_IPMOVIE_DEMUXER 1
+#define CONFIG_LMLM4_DEMUXER 1
+#define ENABLE_LMLM4_DEMUXER 1
+#define CONFIG_M4V_DEMUXER 1
+#define ENABLE_M4V_DEMUXER 1
+#define CONFIG_MATROSKA_DEMUXER 1
+#define ENABLE_MATROSKA_DEMUXER 1
+#define CONFIG_MJPEG_DEMUXER 1
+#define ENABLE_MJPEG_DEMUXER 1
+#define CONFIG_MLP_DEMUXER 1
+#define ENABLE_MLP_DEMUXER 1
+#define CONFIG_MM_DEMUXER 1
+#define ENABLE_MM_DEMUXER 1
+#define CONFIG_MMF_DEMUXER 1
+#define ENABLE_MMF_DEMUXER 1
+#define CONFIG_MOV_DEMUXER 1
+#define ENABLE_MOV_DEMUXER 1
+#define CONFIG_MP3_DEMUXER 1
+#define ENABLE_MP3_DEMUXER 1
+#define CONFIG_MPC_DEMUXER 1
+#define ENABLE_MPC_DEMUXER 1
+#define CONFIG_MPC8_DEMUXER 1
+#define ENABLE_MPC8_DEMUXER 1
+#define CONFIG_MPEGPS_DEMUXER 1
+#define ENABLE_MPEGPS_DEMUXER 1
+#define CONFIG_MPEGTS_DEMUXER 1
+#define ENABLE_MPEGTS_DEMUXER 1
+#define CONFIG_MPEGTSRAW_DEMUXER 1
+#define ENABLE_MPEGTSRAW_DEMUXER 1
+#define CONFIG_MPEGVIDEO_DEMUXER 1
+#define ENABLE_MPEGVIDEO_DEMUXER 1
+#define CONFIG_MSNWC_TCP_DEMUXER 1
+#define ENABLE_MSNWC_TCP_DEMUXER 1
+#define CONFIG_MTV_DEMUXER 1
+#define ENABLE_MTV_DEMUXER 1
+#define CONFIG_MVI_DEMUXER 1
+#define ENABLE_MVI_DEMUXER 1
+#define CONFIG_MXF_DEMUXER 1
+#define ENABLE_MXF_DEMUXER 1
+#define CONFIG_NSV_DEMUXER 1
+#define ENABLE_NSV_DEMUXER 1
+#define CONFIG_NUT_DEMUXER 1
+#define ENABLE_NUT_DEMUXER 1
+#define CONFIG_NUV_DEMUXER 1
+#define ENABLE_NUV_DEMUXER 1
+#define CONFIG_OGG_DEMUXER 1
+#define ENABLE_OGG_DEMUXER 1
+#define CONFIG_OMA_DEMUXER 1
+#define ENABLE_OMA_DEMUXER 1
+#define CONFIG_PCM_ALAW_DEMUXER 1
+#define ENABLE_PCM_ALAW_DEMUXER 1
+#define CONFIG_PCM_MULAW_DEMUXER 1
+#define ENABLE_PCM_MULAW_DEMUXER 1
+#define CONFIG_PCM_S16BE_DEMUXER 1
+#define ENABLE_PCM_S16BE_DEMUXER 1
+#define CONFIG_PCM_S16LE_DEMUXER 1
+#define ENABLE_PCM_S16LE_DEMUXER 1
+#define CONFIG_PCM_S8_DEMUXER 1
+#define ENABLE_PCM_S8_DEMUXER 1
+#define CONFIG_PCM_U16BE_DEMUXER 1
+#define ENABLE_PCM_U16BE_DEMUXER 1
+#define CONFIG_PCM_U16LE_DEMUXER 1
+#define ENABLE_PCM_U16LE_DEMUXER 1
+#define CONFIG_PCM_U8_DEMUXER 1
+#define ENABLE_PCM_U8_DEMUXER 1
+#define CONFIG_PVA_DEMUXER 1
+#define ENABLE_PVA_DEMUXER 1
+#define CONFIG_RAWVIDEO_DEMUXER 1
+#define ENABLE_RAWVIDEO_DEMUXER 1
+#define ENABLE_REDIR_DEMUXER 0
+#define CONFIG_RL2_DEMUXER 1
+#define ENABLE_RL2_DEMUXER 1
+#define CONFIG_RM_DEMUXER 1
+#define ENABLE_RM_DEMUXER 1
+#define CONFIG_ROQ_DEMUXER 1
+#define ENABLE_ROQ_DEMUXER 1
+#define CONFIG_RPL_DEMUXER 1
+#define ENABLE_RPL_DEMUXER 1
+#define ENABLE_RTSP_DEMUXER 0
+#define ENABLE_SDP_DEMUXER 0
+#define CONFIG_SEGAFILM_DEMUXER 1
+#define ENABLE_SEGAFILM_DEMUXER 1
+#define CONFIG_SHORTEN_DEMUXER 1
+#define ENABLE_SHORTEN_DEMUXER 1
+#define CONFIG_SIFF_DEMUXER 1
+#define ENABLE_SIFF_DEMUXER 1
+#define CONFIG_SMACKER_DEMUXER 1
+#define ENABLE_SMACKER_DEMUXER 1
+#define CONFIG_SOL_DEMUXER 1
+#define ENABLE_SOL_DEMUXER 1
+#define CONFIG_STR_DEMUXER 1
+#define ENABLE_STR_DEMUXER 1
+#define CONFIG_SWF_DEMUXER 1
+#define ENABLE_SWF_DEMUXER 1
+#define CONFIG_THP_DEMUXER 1
+#define ENABLE_THP_DEMUXER 1
+#define CONFIG_TIERTEXSEQ_DEMUXER 1
+#define ENABLE_TIERTEXSEQ_DEMUXER 1
+#define CONFIG_TTA_DEMUXER 1
+#define ENABLE_TTA_DEMUXER 1
+#define CONFIG_TXD_DEMUXER 1
+#define ENABLE_TXD_DEMUXER 1
+#define CONFIG_VC1_DEMUXER 1
+#define ENABLE_VC1_DEMUXER 1
+#define CONFIG_VC1T_DEMUXER 1
+#define ENABLE_VC1T_DEMUXER 1
+#define CONFIG_VMD_DEMUXER 1
+#define ENABLE_VMD_DEMUXER 1
+#define CONFIG_VOC_DEMUXER 1
+#define ENABLE_VOC_DEMUXER 1
+#define CONFIG_WAV_DEMUXER 1
+#define ENABLE_WAV_DEMUXER 1
+#define CONFIG_WC3_DEMUXER 1
+#define ENABLE_WC3_DEMUXER 1
+#define CONFIG_WSAUD_DEMUXER 1
+#define ENABLE_WSAUD_DEMUXER 1
+#define CONFIG_WSVQA_DEMUXER 1
+#define ENABLE_WSVQA_DEMUXER 1
+#define CONFIG_WV_DEMUXER 1
+#define ENABLE_WV_DEMUXER 1
+#define CONFIG_XA_DEMUXER 1
+#define ENABLE_XA_DEMUXER 1
+#define CONFIG_YUV4MPEGPIPE_DEMUXER 1
+#define ENABLE_YUV4MPEGPIPE_DEMUXER 1
+#define ENABLE_LIBNUT_DEMUXER 0
+#define ENABLE_AC3_MUXER 0
+#define ENABLE_ADTS_MUXER 0
+#define ENABLE_AIFF_MUXER 0
+#define ENABLE_AMR_MUXER 0
+#define ENABLE_ASF_MUXER 0
+#define ENABLE_ASF_STREAM_MUXER 0
+#define ENABLE_AU_MUXER 0
+#define ENABLE_AVI_MUXER 0
+#define ENABLE_AVM2_MUXER 0
+#define ENABLE_CRC_MUXER 0
+#define ENABLE_DAUD_MUXER 0
+#define ENABLE_DIRAC_MUXER 0
+#define ENABLE_DTS_MUXER 0
+#define ENABLE_DV_MUXER 0
+#define ENABLE_FFM_MUXER 0
+#define ENABLE_FLAC_MUXER 0
+#define ENABLE_FLV_MUXER 0
+#define ENABLE_FRAMECRC_MUXER 0
+#define ENABLE_GIF_MUXER 0
+#define ENABLE_GXF_MUXER 0
+#define ENABLE_H261_MUXER 0
+#define ENABLE_H263_MUXER 0
+#define ENABLE_H264_MUXER 0
+#define ENABLE_IMAGE2_MUXER 0
+#define ENABLE_IMAGE2PIPE_MUXER 0
+#define ENABLE_IPOD_MUXER 0
+#define ENABLE_M4V_MUXER 0
+#define ENABLE_MATROSKA_MUXER 0
+#define ENABLE_MATROSKA_AUDIO_MUXER 0
+#define ENABLE_MJPEG_MUXER 0
+#define ENABLE_MMF_MUXER 0
+#define ENABLE_MOV_MUXER 0
+#define ENABLE_MP2_MUXER 0
+#define ENABLE_MP3_MUXER 0
+#define ENABLE_MP4_MUXER 0
+#define ENABLE_MPEG1SYSTEM_MUXER 0
+#define ENABLE_MPEG1VCD_MUXER 0
+#define ENABLE_MPEG1VIDEO_MUXER 0
+#define ENABLE_MPEG2DVD_MUXER 0
+#define ENABLE_MPEG2SVCD_MUXER 0
+#define ENABLE_MPEG2VIDEO_MUXER 0
+#define ENABLE_MPEG2VOB_MUXER 0
+#define ENABLE_MPEGTS_MUXER 0
+#define ENABLE_MPJPEG_MUXER 0
+#define ENABLE_NULL_MUXER 0
+#define ENABLE_NUT_MUXER 0
+#define ENABLE_OGG_MUXER 0
+#define ENABLE_PCM_ALAW_MUXER 0
+#define ENABLE_PCM_MULAW_MUXER 0
+#define ENABLE_PCM_S16BE_MUXER 0
+#define ENABLE_PCM_S16LE_MUXER 0
+#define ENABLE_PCM_S8_MUXER 0
+#define ENABLE_PCM_U16BE_MUXER 0
+#define ENABLE_PCM_U16LE_MUXER 0
+#define ENABLE_PCM_U8_MUXER 0
+#define ENABLE_PSP_MUXER 0
+#define ENABLE_RAWVIDEO_MUXER 0
+#define ENABLE_RM_MUXER 0
+#define ENABLE_ROQ_MUXER 0
+#define ENABLE_RTP_MUXER 0
+#define ENABLE_SWF_MUXER 0
+#define ENABLE_TG2_MUXER 0
+#define ENABLE_TGP_MUXER 0
+#define ENABLE_VC1T_MUXER 0
+#define ENABLE_VOC_MUXER 0
+#define ENABLE_WAV_MUXER 0
+#define ENABLE_YUV4MPEGPIPE_MUXER 0
+#define ENABLE_LIBNUT_MUXER 0
+#define ENABLE_FILE_PROTOCOL 0
+#define ENABLE_HTTP_PROTOCOL 0
+#define ENABLE_PIPE_PROTOCOL 0
+#define ENABLE_RTP_PROTOCOL 0
+#define ENABLE_TCP_PROTOCOL 0
+#define ENABLE_UDP_PROTOCOL 0
+#define CONFIG_DUMP_EXTRADATA_BSF 1
+#define ENABLE_DUMP_EXTRADATA_BSF 1
+#define CONFIG_H264_MP4TOANNEXB_BSF 1
+#define ENABLE_H264_MP4TOANNEXB_BSF 1
+#define CONFIG_IMX_DUMP_HEADER_BSF 1
+#define ENABLE_IMX_DUMP_HEADER_BSF 1
+#define CONFIG_MJPEGA_DUMP_HEADER_BSF 1
+#define ENABLE_MJPEGA_DUMP_HEADER_BSF 1
+#define CONFIG_MP3_HEADER_COMPRESS_BSF 1
+#define ENABLE_MP3_HEADER_COMPRESS_BSF 1
+#define CONFIG_MP3_HEADER_DECOMPRESS_BSF 1
+#define ENABLE_MP3_HEADER_DECOMPRESS_BSF 1
+#define CONFIG_MOV2TEXTSUB_BSF 1
+#define ENABLE_MOV2TEXTSUB_BSF 1
+#define CONFIG_NOISE_BSF 1
+#define ENABLE_NOISE_BSF 1
+#define CONFIG_REMOVE_EXTRADATA_BSF 1
+#define ENABLE_REMOVE_EXTRADATA_BSF 1
+#define CONFIG_TEXT2MOVSUB_BSF 1
+#define ENABLE_TEXT2MOVSUB_BSF 1
+
+#undef CONFIG_LIBDIRAC
+#undef CONFIG_LIBFAAC
+
+#undef CONFIG_LIBSCHROEDINGER
+#undef CONFIG_LIBX264
+#undef CONFIG_LIBXVID
+
+/* Use codec libs included in mplayer CVS / source dist: */
+#define CONFIG_MP3LIB 1
+#define CONFIG_LIBA52 1
+#define CONFIG_LIBMPEG2 1
+
+/* XAnim DLL support */
+#undef CONFIG_XANIM
+/* Default search path */
+#undef XACODEC_PATH
+
+/* RealPlayer DLL support */
+#undef CONFIG_REALCODECS
+/* Default search path */
+#undef REALCODEC_PATH
+
+/* LIVE555 Streaming Media library support */
+#undef CONFIG_LIVE555
+
+/* libnemesi Streaming Media library support */
+#undef CONFIG_LIBNEMESI
+
+/* Use 3dnow/mmxext/sse/mmx optimized fast memcpy() [maybe buggy... signal 4]*/
+#undef CONFIG_FASTMEMCPY
+
+/* Use UnRAR executable for Vobsubs */
+#undef CONFIG_UNRAR_EXEC
+
+/* gui support, please do not edit this option */
+#undef CONFIG_GUI
+#undef CONFIG_GTK2
+
+/* Audio output drivers */
+#undef CONFIG_OSS_AUDIO
+#define PATH_DEV_DSP ""
+#define PATH_DEV_MIXER ""
+#undef CONFIG_ALSA
+#undef CONFIG_ALSA5
+#undef CONFIG_ALSA9
+#undef CONFIG_ALSA1X
+
+#undef CONFIG_ESD
+#undef CONFIG_ESD_LATENCY
+#undef CONFIG_PULSE
+
+
+
+#undef HAVE_SYS_ASOUNDLIB_H
+#undef HAVE_ALSA_ASOUNDLIB_H
+#undef CONFIG_SUN_AUDIO
+
+
+#undef CONFIG_NAS
+
+/* Enable fast OSD/SUB renderer (looks ugly, but uses less CPU power) */
+#undef FAST_OSD
+#undef FAST_OSD_TABLE
+
+/* Enable TV Interface support */
+#undef CONFIG_TV
+
+/* Enable Video 4 Linux TV interface support */
+#undef CONFIG_TV_V4L
+
+/* Enable Video 4 Linux 1 TV interface support */
+
+
+/* Enable Video 4 Linux 2 TV interface support */
+#undef CONFIG_TV_V4L2
+
+/* Enable DirectShow TV interface support */
+#undef CONFIG_TV_DSHOW
+
+/* *BSD BrookTree headers */
+
+
+
+/* Enable *BSD BrookTree TV interface support */
+
+
+/* Enable TV Teletext Interface support */
+#undef CONFIG_TV_TELETEXT
+
+/* Enable Radio Interface support */
+#undef CONFIG_RADIO
+
+/* Enable Capture for Radio Interface support */
+#undef CONFIG_RADIO_CAPTURE
+
+/* Enable Video 4 Linux Radio interface support */
+#undef CONFIG_RADIO_V4L
+
+/* Enable Video 4 Linux 2 Radio interface support */
+#undef CONFIG_RADIO_V4L2
+
+/* Enable *BSD BrookTree Radio interface support */
+#undef CONFIG_RADIO_BSDBT848
+
+/* Enable Video 4 Linux 2 MPEG PVR support */
+#undef CONFIG_PVR
+
+/* Define if your processor stores words with the most significant
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
+#define WORDS_BIGENDIAN 1
+
+/* Define if your processor can access unaligned data in a fast way */
+
+
+#define ENABLE_X86 0
+#define ENABLE_X86_32 0
+#define ENABLE_X86_64 0
+#define ENABLE_IA64 0
+#define ENABLE_SPARC 0
+#define ENABLE_ARM 0
+#define ENABLE_ARMV4L 0
+#define ENABLE_SH 0
+#define ARCH_POWERPC 1
+#define ENABLE_POWERPC 1
+#define ARCH_PPC 1
+#define ENABLE_PPC 1
+#define ENABLE_ALPHA 0
+#define ENABLE_SGI_MIPS 0
+#define ENABLE_PA_RISC 0
+#define ENABLE_S390 0
+#define ENABLE_S390X 0
+#define ENABLE_VAX 0
+#define ENABLE_BFIN 0
+#define ENABLE_XTENSA 0
+#define ENABLE_GENERIC 0
+
+/* For the PPC.  G5 has the dcbzl when in 64bit mode but G4s and earlier do not
+   have the instruction. */
+#undef HAVE_DCBZL
+
+/* Define this for Cygwin build for win32 */
+
+
+/* Define this to any prefered value from 386 up to infinity with step 100 */
+#define __CPU__ ppc
+
+#undef MP_WORDSIZE
+
+#undef CONFIG_VCD
+
+#ifdef sun
+#define	DEFAULT_CDROM_DEVICE	"/vol/dev/aliases/cdrom0"
+#define DEFAULT_DVD_DEVICE	DEFAULT_CDROM_DEVICE
+#elif defined(WIN32) || defined(__OS2__)
+#define DEFAULT_CDROM_DEVICE    "D:"
+#define DEFAULT_DVD_DEVICE	DEFAULT_CDROM_DEVICE
+#elif defined(__APPLE__) || defined(__DARWIN__)
+#define DEFAULT_CDROM_DEVICE    "/dev/disk1"
+#define DEFAULT_DVD_DEVICE	"/dev/rdiskN"
+#elif defined(__OpenBSD__)
+#define DEFAULT_CDROM_DEVICE	"/dev/rcd0a"
+#define DEFAULT_DVD_DEVICE	DEFAULT_CDROM_DEVICE
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#define DEFAULT_CDROM_DEVICE	"/dev/acd0"
+#define DEFAULT_DVD_DEVICE	DEFAULT_CDROM_DEVICE
+#elif defined(__DragonFly__)
+#define DEFAULT_CDROM_DEVICE	"/dev/cd0"
+#define DEFAULT_DVD_DEVICE	DEFAULT_CDROM_DEVICE
+#elif defined(__AMIGAOS4__)
+#define DEFAULT_CDROM_DEVICE    "a1ide.device:2"
+#define DEFAULT_DVD_DEVICE	DEFAULT_CDROM_DEVICE
+#elif defined(GEKKO)
+#define DEFAULT_CDROM_DEVICE    "/dev/di"
+#define DEFAULT_DVD_DEVICE     "/dev/di"
+#else
+#define DEFAULT_CDROM_DEVICE    "/dev/cdrom"
+#define DEFAULT_DVD_DEVICE	"/dev/dvd"
+#endif
+
+
+/*----------------------------------------------------------------------------
+**
+** NOTE: Instead of modifying these definitions here, use the
+**       --enable/--disable options of the ./configure script!
+**       See ./configure --help for details.
+**
+*---------------------------------------------------------------------------*/
+
+/* C99 *lrint* and round* functions available */
+#undef HAVE_LLRINT
+#define HAVE_LRINT 1
+#define HAVE_LRINTF 1
+#define HAVE_ROUND 1
+#define HAVE_ROUNDF 1
+
+/* mkstemp support */
+#define HAVE_MKSTEMP 1
+
+/* nanosleep support */
+#undef HAVE_NANOSLEEP
+
+/* SMB support */
+#undef CONFIG_LIBSMBCLIENT
+
+/* termcap flag for getch2.c */
+#undef HAVE_TERMCAP
+
+/* termios flag for getch2.c */
+#undef HAVE_TERMIOS
+#undef HAVE_TERMIOS_H
+#undef HAVE_SYS_TERMIOS_H
+
+/* enable PNG support */
+#undef CONFIG_PNG
+
+/* enable JPEG support */
+#undef CONFIG_JPEG
+
+/* enable PNM support */
+#undef CONFIG_PNM
+
+/* enable md5sum support */
+#undef CONFIG_MD5SUM
+
+/* enable yuv4mpeg support */
+#undef CONFIG_YUV4MPEG
+
+/* enable GIF support */
+#undef CONFIG_GIF
+#undef CONFIG_GIF_4
+
+
+/* enable bitmap font support */
+#define CONFIG_BITMAP_FONT 1
+
+/* enable FreeType support */
+#undef CONFIG_FREETYPE
+
+/* enable Fontconfig support */
+#undef CONFIG_FONTCONFIG
+
+/* enable SSA/ASS support */
+#undef CONFIG_ASS
+
+/* enable FriBiDi usage */
+#undef CONFIG_FRIBIDI
+
+/* enable ENCA usage */
+#undef CONFIG_ENCA
+
+/* liblzo support */
+#undef CONFIG_LIBLZO
+
+/* libmad support */
+#undef CONFIG_LIBMAD
+
+/* enable OggVorbis support */
+#define CONFIG_OGGVORBIS 1
+#define CONFIG_TREMOR 1
+
+/* enable Speex support */
+#undef CONFIG_SPEEX
+
+/* enable musepack support */
+#undef CONFIG_MUSEPACK
+
+/* enable OggTheora support */
+#undef CONFIG_OGGTHEORA
+
+/* enable FAAD (AAC) support */
+#define CONFIG_FAAD 1
+#define CONFIG_FAAD_INTERNAL 1
+
+/* enable FAAC (AAC encoder) support */
+#undef CONFIG_FAAC
+
+/* enable libdca support */
+#undef CONFIG_LIBDCA
+
+/* enable LADSPA plugin support */
+#undef CONFIG_LADSPA
+
+/* enable network */
+#undef CONFIG_NETWORK
+
+/* enable ftp support */
+#undef CONFIG_FTP
+
+/* enable vstream support */
+#undef CONFIG_VSTREAM
+
+/* enable winsock2 instead of Unix functions*/
+#undef HAVE_WINSOCK2
+
+/* define this to use inet_aton() instead of inet_pton() */
+#undef HAVE_ATON
+
+/* socklen_t support */
+#ifndef CODECS2HTML
+#undef HAVE_SOCKLEN_T
+#ifndef HAVE_SOCKLEN_T
+#define HAVE_SOCKLEN_T 1
+typedef int socklen_t;
+#endif
+#endif
+
+/* enables / disables cdparanoia support */
+#undef CONFIG_CDDA
+#undef CONFIG_CDDB
+
+/* enables / disables VIDIX usage */
+#undef CONFIG_VIDIX
+#undef CONFIG_VIDIX_DRV_CYBERBLADE
+#undef CONFIG_VIDIX_DRV_IVTV
+#undef CONFIG_VIDIX_DRV_MACH64
+#undef CONFIG_VIDIX_DRV_MGA
+#undef CONFIG_VIDIX_DRV_MGA_CRTC2
+#undef CONFIG_VIDIX_DRV_NVIDIA
+#undef CONFIG_VIDIX_DRV_PM3
+#undef CONFIG_VIDIX_DRV_RADEON
+#undef CONFIG_VIDIX_DRV_RAGE128
+#undef CONFIG_VIDIX_DRV_S3
+#undef CONFIG_VIDIX_DRV_SIS
+#undef CONFIG_VIDIX_DRV_UNICHROME
+
+
+/* enables / disables new input joystick support */
+#undef CONFIG_JOYSTICK
+
+/* enables / disables QTX codecs */
+#undef CONFIG_QTX_CODECS
+#undef CONFIG_QTX_CODECS_WIN32
+
+/* enables / disables osd menu */
+#define CONFIG_MENU 1
+
+/* enables / disables subtitles sorting */
+#define CONFIG_SORTSUB 1
+
+/* XMMS input plugin support */
+#undef CONFIG_XMMS
+#define XMMS_INPUT_PLUGIN_DIR ""
+
+/* enables inet6 support */
+#undef HAVE_AF_INET6
+
+/* do we have gethostbyname2? */
+#undef HAVE_GETHOSTBYNAME2
+
+/* Extension defines */
+#define ENABLE_ALTIVEC 0
+#define ENABLE_MMX 0
+#define ENABLE_MMX2 0
+#define ENABLE_3DNOW 0
+#define ENABLE_3DNOWEX 0
+#define ENABLE_SSE 0
+#define ENABLE_SSE2 0
+#define ENABLE_SSSE3 0
+#define ENABLE_FAST_CMOV 0
+#define ENABLE_CMOV 0
+#define ENABLE_ARMV5TE 0
+#define ENABLE_ARMV6 0
+#define ENABLE_IWMMXT 0
+#define ENABLE_MLIB 0
+#define ENABLE_MMI 0
+#define ENABLE_SH4 0
+#define ENABLE_VIS 0
+#define ENABLE_MVI 0
+
+	// enables usage of altivec.h
+
+/* libvo options */
+#define SCREEN_SIZE_X 1
+#define SCREEN_SIZE_Y 1
+#undef CONFIG_X11
+#undef CONFIG_XV
+#undef HAVE_XVMC
+#undef CONFIG_XF86VM
+#undef CONFIG_XF86XK
+#undef CONFIG_XINERAMA
+#undef CONFIG_GL
+#undef GL_WIN32
+#undef CONFIG_DGA
+#undef CONFIG_DGA1
+#undef CONFIG_DGA2
+#undef CONFIG_SDL
+/* defined for SDLlib with keyrepeat bugs (before 1.2.1) */
+
+
+#undef CONFIG_GGI
+#undef CONFIG_GGIWMH
+#undef CONFIG_3DFX
+#undef CONFIG_S3FB
+#undef CONFIG_WII
+#undef CONFIG_TDFXFB
+#undef CONFIG_XVR100
+
+#undef CONFIG_DIRECTFB
+
+#undef CONFIG_DFBMGA
+#undef CONFIG_ZR
+#undef CONFIG_BL
+#undef CONFIG_MGA
+#undef CONFIG_XMGA
+#undef CONFIG_FBDEV
+#undef CONFIG_DXR2
+#undef CONFIG_DXR3
+#undef CONFIG_IVTV
+#undef CONFIG_V4L2_DECODER
+#undef CONFIG_DVB
+#undef CONFIG_DVB_HEAD
+#undef CONFIG_DVBIN 
+#undef CONFIG_SVGALIB
+#undef CONFIG_VESA
+#undef CONFIG_XSS
+#undef CONFIG_XDPMS
+#undef CONFIG_AA
+#undef CONFIG_CACA
+#undef CONFIG_TGA
+#undef CONFIG_TOOLAME
+#undef CONFIG_TWOLAME
+
+/* used by GUI: */
+
+
+#if defined(CONFIG_GL) || defined(CONFIG_X11) || defined(CONFIG_XV)
+#define X11_FULLSCREEN 1
+#endif
+
+#endif /* MPLAYER_CONFIG_H */
Index: stream/stream_dvd.c
===================================================================
--- stream/stream_dvd.c	(revision 27458)
+++ stream/stream_dvd.c	(working copy)
@@ -1081,6 +1081,7 @@
 
 static int ifo_stream_open (stream_t *stream, int mode, void *opts, int *file_format)
 {
+#ifndef GEKKO
     char *ext;
     char* filename;
     struct stream_priv_s *spriv;
@@ -1107,6 +1108,9 @@
     stream->url=strdup("dvd://");
 
     return open_s(stream, mode, spriv, file_format);
+#else
+    return STREAM_UNSUPPORTED;
+#endif
 }
 
 const stream_info_t stream_info_dvd = {
Index: stream/stream.c
===================================================================
--- stream/stream.c	(revision 27458)
+++ stream/stream.c	(working copy)
@@ -5,12 +5,14 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifndef __MINGW32__
+#if !defined (__MINGW32__) && !defined (GEKKO)
 #include <sys/ioctl.h>
 #include <sys/wait.h>
 #endif
 #include <fcntl.h>
+#ifndef GEKKO
 #include <strings.h>
+#endif
 
 #include "config.h"
 
Index: libao2/ao_mpegpes.c
===================================================================
--- libao2/ao_mpegpes.c	(revision 27458)
+++ libao2/ao_mpegpes.c	(working copy)
@@ -149,6 +149,8 @@
 		mp_msg(MSGT_VO, MSGL_ERR, "AO_MPEGPES, Unrecognized options\n");
 		return -1;
 	}
+
+#ifdef HAVE_DVB_HEAD
 	if(card==-1)
 	{
 		//search the first usable card
@@ -164,6 +166,8 @@
 			}
         	}
 	}
+#endif
+
 	if((card < 1) || (card > 4))
 	{
 		mp_msg(MSGT_VO, MSGL_ERR, "DVB card number must be between 1 and 4\n");
Index: libao2/ao_gekko.c
===================================================================
--- libao2/ao_gekko.c	(revision 0)
+++ libao2/ao_gekko.c	(revision 0)
@@ -0,0 +1,177 @@
+/*
+   ao_gekko.c - MPlayer audio driver for Wii
+
+   Copyright (C) 2008 dhewg
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301 USA.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "config.h"
+#include "libaf/af_format.h"
+#include "audio_out.h"
+#include "audio_out_internal.h"
+#include "mp_msg.h"
+#include "help_mp.h"
+
+#include <ogcsys.h>
+
+static ao_info_t info = {
+	"gekko audio output",
+	"gekko",
+	"Team Twiizers",
+	""
+};
+
+LIBAO_EXTERN(gekko)
+
+#define SFX_BUFFER_SIZE (8*1024)
+#define SFX_BUFFERS 32
+
+static u8 buffer[SFX_BUFFERS][SFX_BUFFER_SIZE] ATTRIBUTE_ALIGN(32);
+static u8 buffer_fill = 0;
+static u8 buffer_play = 0;
+static u8 buffer_free = SFX_BUFFERS;
+static bool playing = false;
+
+static void switch_buffers() {
+	AUDIO_StopDMA();
+
+	if (playing)
+		buffer_free++;
+
+	if (buffer_free == SFX_BUFFERS) {
+		playing = false;
+		return;
+	}
+
+	AUDIO_InitDMA((u32) buffer[buffer_play], SFX_BUFFER_SIZE);
+	AUDIO_StartDMA();
+
+	buffer_play = (buffer_play + 1) % SFX_BUFFERS;
+
+	playing = true;
+}
+
+static int control(int cmd, void *arg) {
+	//mp_msg(MSGT_AO, MSGL_ERR, "[AOGEKKO]: control %d\n", cmd);
+
+	return CONTROL_UNKNOWN;
+}
+
+static int init(int rate, int channels, int format, int flags) {
+	AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
+	AUDIO_RegisterDMACallback(switch_buffers);
+
+	ao_data.buffersize = SFX_BUFFER_SIZE * SFX_BUFFERS;
+	ao_data.outburst = SFX_BUFFER_SIZE;
+	ao_data.channels = 2;
+	ao_data.samplerate = 48000;
+	ao_data.format = AF_FORMAT_S16_BE;
+	ao_data.bps = 192000;
+
+	return 1;
+}
+
+static void reset(void) {
+	u8 i;
+
+	AUDIO_StopDMA();
+
+	for (i = 0; i < SFX_BUFFERS; ++i) {
+		memset(buffer[i], 0, SFX_BUFFER_SIZE);
+		DCFlushRange(buffer[i], SFX_BUFFER_SIZE);
+	}
+
+	buffer_fill = 0;
+	buffer_play = 0;
+	buffer_free = SFX_BUFFERS;
+
+	playing = false;
+}
+
+static void uninit(int immed) {
+	reset();
+
+	AUDIO_RegisterDMACallback(NULL);
+}
+
+static void audio_pause(void) {
+	AUDIO_StopDMA();
+
+	if (playing && (buffer_free < SFX_BUFFERS)) {
+		buffer_play = (buffer_play + 1) % SFX_BUFFERS;
+		buffer_free++;
+	}
+
+	playing = false;
+}
+
+static void audio_resume(void) {
+	switch_buffers();
+}
+
+static int get_space(void) {
+	return (buffer_free - 1) * SFX_BUFFER_SIZE;
+}
+
+static int play(void* data, int len, int flags) {
+	int bl, ret = 0;
+	u8 *s = (u8 *) data;
+
+	while ((len > 0) && (buffer_free > 1)) {
+		bl = len;
+		if (bl > SFX_BUFFER_SIZE)
+			bl = SFX_BUFFER_SIZE;
+
+		memcpy(buffer[buffer_fill], s, bl);
+
+		if (bl < SFX_BUFFER_SIZE)
+			memset(buffer[buffer_fill] + bl, 0, SFX_BUFFER_SIZE - bl);
+
+		DCFlushRange(buffer[buffer_fill], bl);
+
+		buffer_fill = (buffer_fill + 1) % SFX_BUFFERS;
+		buffer_free--;
+
+		len -= bl;
+		s += bl;
+		ret += bl;
+	}
+
+	if (!playing)
+		switch_buffers();
+
+	return ret;
+}
+
+static float get_delay(void) {
+	float b;
+
+	if (buffer_free == SFX_BUFFERS)
+		return 0;
+
+	b = (SFX_BUFFERS - buffer_free) * SFX_BUFFER_SIZE;
+
+	if (playing)
+		b += AUDIO_GetDMABytesLeft();
+
+	return b / 192000.0f;
+}
+
Index: libao2/audio_out.c
===================================================================
--- libao2/audio_out.c	(revision 27458)
+++ libao2/audio_out.c	(working copy)
@@ -35,6 +35,7 @@
 extern ao_functions_t audio_out_mpegpes;
 extern ao_functions_t audio_out_pcm;
 extern ao_functions_t audio_out_pss;
+extern ao_functions_t audio_out_gekko;
 
 const ao_functions_t* const audio_out_drivers[] =
 {
@@ -95,6 +96,9 @@
 #ifdef CONFIG_V4L2_DECODER
         &audio_out_v4l2,
 #endif
+#ifdef GEKKO
+		&audio_out_gekko,
+#endif
         &audio_out_null,
 // should not be auto-selected:
         &audio_out_pcm,
Index: Makefile
===================================================================
--- Makefile	(revision 27458)
+++ Makefile	(working copy)
@@ -599,6 +599,10 @@
 SRCS_MPLAYER-$(VIDIX_SIS)           += vidix/sis_vid.c vidix/sis_bridge.c
 SRCS_MPLAYER-$(VIDIX_UNICHROME)     += vidix/unichrome_vid.c
 
+SRCS_MPLAYER_PORT-$(GEKKO) = osdep/log_console.c \
+							 osdep/gx_supp.c \
+							 osdep/plat_gekko.c
+
 SRCS_MENCODER = mencoder.c \
                 mp_msg-mencoder.c \
                 parser-mecmd.c \
@@ -628,7 +632,7 @@
 
 SRCS_COMMON   += $(SRCS_COMMON-yes) $(SRCS_COMMON-yes-yes) $(SRCS_COMMON-yes-yes-yes)
 SRCS_MENCODER += $(SRCS_MENCODER-yes)
-SRCS_MPLAYER  += $(SRCS_MPLAYER-yes)
+SRCS_MPLAYER  += $(SRCS_MPLAYER-yes) $(SRCS_MPLAYER_PORT-yes)
 
 COMMON_LIBS-$(LIBAVFORMAT_A)      += libavformat/libavformat.a
 COMMON_LIBS-$(LIBAVCODEC_A)       += libavcodec/libavcodec.a
@@ -649,6 +653,7 @@
 
 ALL_PRG-$(MPLAYER)  += mplayer$(EXESUF)
 ALL_PRG-$(MENCODER) += mencoder$(EXESUF)
+ALL_PRG-$(GEKKO)  += mplayer.dol
 
 INSTALL_TARGETS-$(GUI)      += install-gui
 INSTALL_TARGETS-$(MENCODER) += install-mencoder install-mencoder-man
@@ -718,6 +723,14 @@
 
 all: $(ALL_PRG-yes)
 
+ifeq ($(GEKKO),yes)
+upload: mplayer.dol
+	wiiload mplayer.dol
+
+mplayer.dol: mplayer$(EXESUF)
+	$(OBJCOPY) -O binary mplayer$(EXESUF) mplayer.dol
+endif
+
 %.d: %.c
 	$(MPDEPEND_CMD) > $@
 
@@ -862,6 +875,9 @@
 clean:
 	rm -f $(foreach dir,$(DIRS),$(foreach suffix,/*.o /*.a /*.ho /*~, $(addsuffix $(suffix),$(dir))))
 	rm -f mplayer$(EXESUF) mencoder$(EXESUF)
+ifeq ($(GEKKO),yes)
+	rm -f mplayer.dol
+endif
 
 distclean: clean testsclean toolsclean driversclean dhahelperclean dhahelperwinclean
 	rm -rf DOCS/tech/doxygen
Index: cpudetect.c
===================================================================
--- cpudetect.c	(revision 27458)
+++ cpudetect.c	(working copy)
@@ -486,7 +486,7 @@
 
 #ifdef __APPLE__
 #include <sys/sysctl.h>
-#elif __AMIGAOS4__
+#elif defined(__AMIGAOS4__) || defined (GEKKO)
 /* nothing */
 #else
 #include <signal.h>
Index: mixer.c
===================================================================
--- mixer.c	(revision 27458)
+++ mixer.c	(working copy)
@@ -1,5 +1,5 @@
 #include <string.h>
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(GEKKO)
 #include <sys/ioctl.h>
 #endif
 #include <fcntl.h>
Index: mplayer.ld
===================================================================
--- mplayer.ld	(revision 0)
+++ mplayer.ld	(revision 0)
@@ -0,0 +1,388 @@
+/*
+ * Linkscript for GC, automatically sets up DOL structures,
+ * generate ELF file and use objdump, or generate binary
+ * directly.
+ *
+ * PSUL doesn't seem to handle separate text and data sections correctly,
+ * that is why the text and data sections are merged in the header.
+ *
+ * If you want to experiment, it should be quite obvious how to
+ * change the header to list the data separately.
+ */
+
+OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc");
+OUTPUT_ARCH(powerpc:common);
+EXTERN(_start);
+ENTRY(_start);
+
+
+SECTIONS
+{
+
+	/* DOL header (from TITANIK's GC docs) */
+	/* default base address */
+	. = 0x80003f00;
+	.header	:
+	{
+		file_start = .;
+		/*    0000-001B  Text[0..6] sections File Positions */
+		LONG(text_file_start);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+
+		/*    001C-0047  Data[0..10] sections File Positions */
+		LONG(data_file_start);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+
+		/*    0048-0063  Text[0..6] sections Mem Address */
+		LONG(text_mem_start);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+
+		/*    0064-008F  Data[0..10] sections Mem Address */
+		LONG(data_mem_start);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+
+		/*    0090-00AB  Text[0..6] sections Sizes */
+		LONG(text_mem_size);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+
+		/*    00AC-00D7  Data[0..10] sections Sizes */
+		LONG(data_mem_size);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+		LONG(0);
+
+		/*	00D8  BSS Mem address
+			00DC  BSS Size */
+		LONG(bss_mem_start);
+		LONG(bss_mem_size);
+
+		/*    00E0  Entry Point */
+		LONG(ABSOLUTE(_start));
+	}
+
+	/* Program */
+	. = file_start + 0x100;
+	text_mem_start = .;
+
+	.init          :
+	{
+		KEEP (*crt0.o(*.init))
+		KEEP (*(.init))
+	} = 0
+	.plt      : { *(.plt)	}
+	.interp			: { *(.interp) 	}
+	.hash			: { *(.hash) }
+	.dynsym			: { *(.dynsym) }
+	.dynstr			: { *(.dynstr) }
+	.gnu.version	: { *(.gnu.version) }
+	.gnu.version_d	: { *(.gnu.version_d) }
+	.gnu.version_r	: { *(.gnu.version_r) }
+	.rel.init		: { *(.rel.init) }
+	.rela.init		: { *(.rela.init) }
+	.rel.text		: { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
+	.rela.text		: { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
+	.rel.fini		: { *(.rel.fini) }
+	.rela.fini		: { *(.rela.fini) }
+	.rel.rodata		: { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
+	.rela.rodata	: { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
+	.rel.data		: { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
+	.rela.data		: { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
+	.rel.tdata		: { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
+	.rela.tdata		: { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
+	.rel.tbss		: { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
+	.rela.tbss		: { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
+	.rel.ctors		: { *(.rel.ctors) }
+	.rela.ctors		: { *(.rela.ctors) }
+	.rel.dtors		: { *(.rel.dtors) }
+	.rela.dtors		: { *(.rela.dtors) }
+	.rel.got		: { *(.rel.got)	}
+	.rela.got		: { *(.rela.got) }
+	.rela.got1		: { *(.rela.got1) }
+	.rela.got2		: { *(.rela.got2) }
+	.rel.sdata		: { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
+	.rela.sdata		: { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
+	.rel.sbss		: { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
+	.rela.sbss		: { *(.rela.sbss .rela.sbss.* .rel.gnu.linkonce.sb.*) }
+	.rel.sdata2		: { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
+	.rela.sdata2	: { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
+	.rel.sbss2		: { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
+	.rela.sbss2		: { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
+	.rel.bss		: { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
+	.rela.bss		: { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
+	.rel.plt		: { *(.rel.plt) }
+	.rela.plt		: { *(.rela.plt) }
+
+	.text      :
+	{
+		*(.text)
+		*(.text.*)
+		*(.stub)
+		/* .gnu.warning sections are handled specially by elf32.em.  */
+		*(.gnu.warning)
+		*(.gnu.linkonce.t.*)
+		. = ALIGN(32);   /* REQUIRED. LD is flaky without it. */
+	} = 0
+
+	.fini      :
+	{
+		KEEP (*(.fini))
+		. = ALIGN(32);   /* REQUIRED. LD is flaky without it. */
+	} = 0
+	
+	PROVIDE (__etext = .);
+	PROVIDE (_etext = .);
+	PROVIDE (etext = .);
+
+	text_mem_size = . - text_mem_start;
+
+	data_mem_start = .;
+	.rodata   : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) }
+	.rodata1   : { *(.rodata1) }
+	.sdata2   : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) }
+	.sbss2   : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) }
+  /* Adjust the address for the data segment.  We want to adjust up to
+     the same address within the page on the next page up.  */
+  /* Ensure the __preinit_array_start label is properly aligned.  We
+     could instead move the label definition inside the section, but
+     the linker would then create the section even if it turns out to
+     be empty, which isn't pretty.  */
+	. = ALIGN(32 / 8);
+	PROVIDE (__preinit_array_start = .);
+	.preinit_array     : { *(.preinit_array) }
+	PROVIDE (__preinit_array_end = .);
+	PROVIDE (__init_array_start = .);
+	.init_array     : { *(.init_array) }
+	PROVIDE (__init_array_end = .);
+	PROVIDE (__fini_array_start = .);
+	.fini_array     : { *(.fini_array) }
+	PROVIDE (__fini_array_end = .);
+	.data    :
+	{
+		*(.data)
+		*(.data.*)
+		*(.gnu.linkonce.d.*)
+		SORT(CONSTRUCTORS)
+		. = ALIGN(32);   /* REQUIRED. LD is flaky without it. */
+	}
+
+	.data1   : { *(.data1) }
+	.tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
+	.tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
+	.eh_frame : { KEEP (*(.eh_frame)) }
+	.gcc_except_table : { *(.gcc_except_table) }
+	.fixup          : { *(.fixup) }
+	.got1           : { *(.got1) }
+	.got2           : { *(.got2) }
+	.dynamic       : { *(.dynamic) }
+
+	.ctors   :
+	{
+	/*	gcc uses crtbegin.o to find the start of
+		the constructors, so we make sure it is
+		first.  Because this is a wildcard, it
+		doesn't matter if the user does not
+		actually link against crtbegin.o; the
+		linker won't look for a file to match a
+		wildcard.  The wildcard also means that it
+		doesn't matter which directory crtbegin.o
+		is in.  */
+
+		KEEP (*crtbegin.o(.ctors))
+
+    /*	We don't want to include the .ctor section from
+		from the crtend.o file until after the sorted ctors.
+		The .ctor section from the crtend file contains the
+		end of ctors marker and it must be last */
+
+		KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
+		KEEP (*(SORT(.ctors.*)))
+		KEEP (*(.ctors))
+		. = ALIGN(32);   /* REQUIRED. LD is flaky without it. */
+	}
+
+	.dtors         :
+	{
+		KEEP (*crtbegin.o(.dtors))
+		KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
+		KEEP (*(SORT(.dtors.*)))
+		KEEP (*(.dtors))
+		. = ALIGN(32);   /* REQUIRED. LD is flaky without it. */
+	}
+
+	.jcr            : { KEEP (*(.jcr)) }
+	.got		  : { *(.got.plt) *(.got) }
+
+
+	/*	We want the small data sections together, so single-instruction offsets
+		can access them all, and initialized data all before uninitialized, so
+		we can shorten the on-disk segment size.  */
+
+	.sdata     :
+	{
+		*(.sdata)
+		*(.sdata.*)
+		*(.gnu.linkonce.s.*)
+		. = ALIGN(32);   /* REQUIRED. LD is flaky without it. */
+	}
+
+	_edata = .;
+	PROVIDE (edata = .);
+
+	data_mem_size = . - data_mem_start;
+
+	bss_mem_start = .;
+	.sbss      :
+	{
+		__sbss_start = .;
+		PROVIDE (__sbss_start = .);
+		PROVIDE (___sbss_start = .);
+		*(.dynsbss)
+		*(.sbss)
+		*(.sbss.*)
+		*(.gnu.linkonce.sb.*)
+		*(.scommon)
+		PROVIDE (__sbss_end = .);
+		PROVIDE (___sbss_end = .);
+		. = ALIGN(32);   /* REQUIRED. LD is flaky without it. */
+		__sbss_end = .;
+	}
+
+	.bss       :
+	{
+		__bss_start = .;
+		PROVIDE (__bss_start = .);
+		*(.dynbss)
+		*(.bss)
+		*(.bss.*)
+		*(.gnu.linkonce.b.*)
+		*(COMMON)
+	/*	Align here to ensure that the .bss section occupies space up to
+		_end.  Align after .bss to ensure correct alignment even if the
+		.bss section disappears because there are no input sections.  */
+
+		. = ALIGN(32);
+
+		PROVIDE (__bss_end = .);
+		__bss_end = .;
+	}
+ 
+ 	bss_mem_size = . - bss_mem_start;
+
+	/* calculate file addresses */
+	text_file_start = text_mem_start - file_start;
+	data_file_start = data_mem_start - file_start;
+	bss_file_start = bss_mem_start - file_start;
+
+	_end = .;
+	PROVIDE(end = .);
+	/* Stabs debugging sections.  */
+	.stab 0 : { *(.stab) }
+	.stabstr 0 : { *(.stabstr) }
+	.stab.excl 0 : { *(.stab.excl) }
+	.stab.exclstr 0 : { *(.stab.exclstr) }
+	.stab.index 0 : { *(.stab.index) }
+	.stab.indexstr 0 : { *(.stab.indexstr) }
+	.comment 0 : { *(.comment) }
+	/*	DWARF debug sections.
+		Symbols in the DWARF debugging sections are relative to the beginning
+		of the section so we begin them at 0.  */
+	/* DWARF 1 */
+	.debug          0 : { *(.debug) }
+	.line           0 : { *(.line) }
+	/* GNU DWARF 1 extensions */
+	.debug_srcinfo  0 : { *(.debug_srcinfo) }
+	.debug_sfnames  0 : { *(.debug_sfnames) }
+	/* DWARF 1.1 and DWARF 2 */
+	.debug_aranges  0 : { *(.debug_aranges) }
+	.debug_pubnames 0 : { *(.debug_pubnames) }
+	/* DWARF 2 */
+	.debug_info     0 : { *(.debug_info) }
+	.debug_abbrev   0 : { *(.debug_abbrev) }
+	.debug_line     0 : { *(.debug_line) }
+	.debug_frame    0 : { *(.debug_frame) }
+	.debug_str      0 : { *(.debug_str) }
+	.debug_loc      0 : { *(.debug_loc) }
+	.debug_macinfo  0 : { *(.debug_macinfo) }
+	/* SGI/MIPS DWARF 2 extensions */
+	.debug_weaknames 0 : { *(.debug_weaknames) }
+	.debug_funcnames 0 : { *(.debug_funcnames) }
+	.debug_typenames 0 : { *(.debug_typenames) }
+	.debug_varnames  0 : { *(.debug_varnames) }
+	/* These must appear regardless of  .  */
+}
+
+__isIPL = 0;
+__stack_addr = (__bss_start + SIZEOF(.bss) + 0x80000 + 7) & (-8);
+__stack_end = (__bss_start + SIZEOF(.bss));
+__intrstack_addr = (__stack_addr + 0x4000);
+__intrstack_end = (__stack_addr);
+__Arena1Lo = (__intrstack_addr + 31) & (-32);
+__Arena1Hi = (0x816ffff0);
+__Arena2Lo = (0x90000800);
+__Arena2Hi = (0x933E0000);
+
+__gxregs = (__Arena1Hi + 31) & (-32);
+__ipcbufferLo = (0x933e0000);
+__ipcbufferHi = (0x93400000);
+
+/* for backward compatibility with old crt0 */
+PROVIDE (__stack = (0x816ffff0));
+
+PROVIDE(__isIPL = __isIPL);
+PROVIDE(__text_start = text_mem_start);
+PROVIDE(__text_fstart = text_file_start);
+PROVIDE(__data_start = data_mem_start);
+PROVIDE(__data_fstart = data_file_start);
+PROVIDE(__bss_start = bss_mem_start);
+PROVIDE(__bss_fstart = bss_file_start);
+PROVIDE(__stack_addr = __stack_addr);
+PROVIDE(__stack_end = __stack_end);
+PROVIDE(__intrstack_addr = __intrstack_addr);
+PROVIDE(__intrstack_end = __intrstack_end);
+PROVIDE(__Arena1Lo = __Arena1Lo);
+PROVIDE(__Arena1Hi = __Arena1Hi);
+PROVIDE(__Arena2Lo = __Arena2Lo);
+PROVIDE(__Arena2Hi = __Arena2Hi);
+PROVIDE(__ipcbufferLo = __ipcbufferLo);
+PROVIDE(__ipcbufferHi = __ipcbufferHi);
+PROVIDE(__gxregs = __gxregs);
Index: libvo/video_out.c
===================================================================
--- libvo/video_out.c	(revision 27458)
+++ libvo/video_out.c	(working copy)
@@ -113,6 +113,7 @@
 extern vo_functions_t video_out_quartz;
 extern vo_functions_t video_out_pnm;
 extern vo_functions_t video_out_md5sum;
+extern vo_functions_t video_out_gekko;
 
 const vo_functions_t* const video_out_drivers[] =
 {
@@ -219,6 +220,9 @@
 #endif
     &video_out_cvidix,
 #endif
+#ifdef GEKKO
+    &video_out_gekko,
+#endif
         &video_out_null,
 	// should not be auto-selected
 #ifdef HAVE_XVMC
Index: libvo/vo_gekko.c
===================================================================
--- libvo/vo_gekko.c	(revision 0)
+++ libvo/vo_gekko.c	(revision 0)
@@ -0,0 +1,217 @@
+/*
+   vo_gekko.c - MPlayer video driver for Wii
+
+   Copyright (C) 2008 dhewg
+
+   sepp256 - Added YUV frame rendering functions.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301 USA.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <malloc.h>
+
+#include "config.h"
+#include "mp_msg.h"
+#include "subopt-helper.h"
+#include "help_mp.h"
+#include "video_out.h"
+#include "video_out_internal.h"
+#include "mp_fifo.h"
+#include "osd.h"
+#include "sub.h"
+#include "osdep/keycodes.h"
+#include "osdep/log_console.h"
+#include "osdep/gx_supp.h"
+
+#include <gccore.h>
+
+static vo_info_t info = {
+	"gekko video output",
+	"gekko",
+	"Team Twiizers",
+	""
+};
+
+LIBVO_EXTERN(gekko)
+
+static int cam_pos_z = 350;
+
+static opt_t subopts[] = {
+	{ "cam_pos_z", OPT_ARG_INT,  &cam_pos_z, (opt_test_f) int_non_neg },
+	{ NULL }
+};
+
+static u8 *image_buffer[3] = { NULL, NULL, NULL };
+static u32 image_width = 0, image_height = 0;
+
+static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
+						unsigned char *srca, int stride) {
+	vo_draw_alpha_yv12(w, h, src, srca, stride,
+						image_buffer[0] + (y0 * image_width + x0),
+						image_width);
+}
+
+static int draw_slice(uint8_t *image[], int stride[], int w, int h, int x,
+						int y) {
+	int i;
+	u8 *s[3], *d[3];
+
+	s[0] = image[0];
+	s[1] = image[1];
+	s[2] = image[2];
+	d[0] = image_buffer[0] + y * image_width + x;
+	d[1] = image_buffer[1] + y * image_width / 4 + x / 2;
+	d[2] = image_buffer[2] + y * image_width / 4 + x / 2;
+
+	for (i = 0; i < h; ++i) {
+		memcpy(d[0], s[0], w);
+		s[0] += stride[0];
+		d[0] += image_width;
+	}
+
+	for (i = 0; i < h / 2; ++i) {
+		memcpy(d[1], s[1], w / 2);
+		memcpy(d[2], s[2], w / 2);
+		s[1] += stride[1];
+		s[2] += stride[2];
+		d[1] += image_width / 2;
+		d[2] += image_width / 2;
+	}
+
+	return 0;
+}
+
+static void draw_osd(void) {
+	vo_draw_text(image_width, image_height, draw_alpha);
+}
+
+static void flip_page(void) {
+	u16 pitch[3];
+
+	pitch[0] = image_width;
+	pitch[1] = image_width / 2;
+	pitch[2] = image_width / 2;
+
+	GX_RenderYUV(image_width, image_height, image_buffer, pitch);
+}
+
+static int draw_frame(uint8_t *src[]) {
+	mp_msg(MSGT_VO, MSGL_ERR, "[VOGEKKO]: draw_frame\n");
+
+	return 0;
+}
+
+static int query_format(uint32_t format) {
+	switch (format) {
+	case IMGFMT_YV12:
+		return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |
+				VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE;
+	default:
+		return 0;
+	}
+}
+
+static int config(uint32_t width, uint32_t height, uint32_t d_width,
+					uint32_t d_height, uint32_t flags, char *title,
+					uint32_t format) {
+	float sar, par;
+
+	if (image_buffer[0]) {
+		free(image_buffer[0]);
+		free(image_buffer[1]);
+		free(image_buffer[2]);
+		image_buffer[0] = NULL;
+		image_buffer[1] = NULL;
+		image_buffer[2] = NULL;
+	}
+
+	image_buffer[0] = (u8 *) malloc(width * height);
+	image_buffer[1] = (u8 *) malloc(width * height / 4);
+	image_buffer[2] = (u8 *) malloc(width * height / 4);
+
+	image_width = width;
+	image_height = height;
+
+	if (CONF_GetAspectRatio())
+		sar = 16.0f / 9.0f;
+	else
+		sar = 4.0f / 3.0f;
+
+	par = (float) d_width / (float) d_height;
+	par *= (float) vmode->fbWidth / (float) vmode->xfbHeight;
+	par /= sar;
+
+	if (par > sar) {
+		width = vmode->viWidth;
+		height = (float) width / par;
+	} else {
+		height = vmode->viHeight;
+		width = (float) height * par + vmode->viWidth - vmode->fbWidth;
+	}
+
+	mp_msg(MSGT_VO, MSGL_ERR, "[VOGEKKO]: SAR=%0.3f PAR=%0.3f %ux%u -> %ux%u\n",
+			sar, par, image_width, image_height, width, height);
+
+	GX_StartYUV(image_width, image_height, width / 2, height / 2);
+
+	return 0;
+}
+
+static void uninit(void) {
+	if (image_buffer[0]) {
+		free(image_buffer[0]);
+		free(image_buffer[1]);
+		free(image_buffer[2]);
+		image_buffer[0] = NULL;
+		image_buffer[1] = NULL;
+		image_buffer[2] = NULL;
+	}
+
+	image_width = 0;
+	image_height = 0;
+
+	//log_console_enable_video(true);
+}
+
+static void check_events(void) {
+}
+
+static int preinit(const char *arg) {
+	if (subopt_parse(arg, subopts) != 0)
+		mp_msg(MSGT_VO, MSGL_ERR, "[VOGEKKO]: ignoring unknown options: %s\n",
+				arg);
+
+	mp_msg(MSGT_VO, MSGL_ERR, "[VOGEKKO]: cam_pos_z=%d\n", cam_pos_z);
+
+	GX_SetCamPosZ(cam_pos_z);
+
+	log_console_enable_video(false);
+
+	return 0;
+}
+
+static int control(uint32_t request, void *data, ...) {
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		return query_format(*((uint32_t*) data));
+	}
+
+	return VO_NOTIMPL;
+}
Index: config.mak
===================================================================
--- config.mak	(revision 0)
+++ config.mak	(revision 0)
@@ -0,0 +1,558 @@
+# -------- Generated by configure -----------
+
+# Ensure that locale settings do not interfere with shell commands.
+export LC_ALL = C
+
+DOC_LANG = en
+DOC_LANGS = en
+DOC_LANG_ALL = cs de en es fr hu it pl ru zh_CN
+MAN_LANG = en
+MAN_LANGS = en
+MAN_LANG_ALL = cs de en es fr hu it pl ru zh
+
+DESTDIR =
+prefix = $(DESTDIR)/tmp/mplayerhaxx
+BINDIR = $(DESTDIR)/tmp/mplayerhaxx/bin
+DATADIR = $(DESTDIR)/tmp/mplayerhaxx/share/mplayer
+MANDIR = $(DESTDIR)/tmp/mplayerhaxx/share/man
+CONFDIR = $(DESTDIR)/tmp/mplayerhaxx/etc/mplayer
+LIBDIR = $(DESTDIR)/tmp/mplayerhaxx/lib
+
+AR = $(DEVKITPPC)/bin/powerpc-gekko-ar
+CC = $(DEVKITPPC)/bin/powerpc-gekko-gcc
+CXX = $(DEVKITPPC)/bin/powerpc-gekko-gcc
+HOST_CC = gcc
+RANLIB = $(DEVKITPPC)/bin/powerpc-gekko-ranlib
+WINDRES = windres
+INSTALL = install
+INSTALLSTRIP = -s
+OBJCOPY = $(DEVKITPPC)/bin/powerpc-gekko-objcopy
+
+EXTRA_INC = -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/3rd/wii/include
+EXTRAXX_INC = $(EXTRA_INC)
+COMMONFLAGS = -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -std=gnu99 -I. -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -g -O2 -pipe -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float
+CFLAGS = $(COMMONFLAGS) $(EXTRA_INC)
+OPTFLAGS = $(COMMONFLAGS) $(EXTRA_INC)
+CXXFLAGS = $(COMMONFLAGS) -D__STDC_LIMIT_MACROS $(EXTRAXX_INC)
+CFLAGS_DHAHELPER = 
+CFLAGS_FAAD_FIXED = 
+CFLAGS_LIBDVDCSS = 
+CFLAGS_LIBDVDCSS_DVDREAD = -Ilibdvdcss -DHAVE_DVDCSS_DVDCSS_H
+CFLAGS_NO_OMIT_LEAF_FRAME_POINTER = 
+CFLAGS_STACKREALIGN = 
+CFLAGS_SVGALIB_HELPER = 
+CFLAGS_TREMOR_LOW = 
+
+EXTRALIBS = -L$(DEVKITPRO)/libogc/lib/wii -L$(DEVKITPRO)/3rd/wii/lib
+EXTRA_LIB = -static $(COMMONFLAGS) -ldvdread -ldvdnav -lwiiuse -lbte -lfat -ldi -logc -ldb -lm
+EXTRALIBS_MPLAYER = -specs=mplayer.spec 
+EXTRALIBS_MENCODER = 
+
+CHARSET = UTF-8
+HELP_FILE = help/help_mp-en.h
+
+GEKKO = yes
+
+EXESUF = .elf
+
+ARCH_POWERPC = yes
+
+HAVE_=yes
+
+GETCH = getch2-gekko.c
+TIMER = timer-gekko.c
+
+AO_SRCS = ao_gekko.c
+VO_SRCS = vo_gekko.c 
+
+MENCODER = no
+MPLAYER = yes
+
+#internal libraries
+LIBA52 = yes
+LIBMPEG2 = yes
+MP3LIB = yes
+TREMOR_INTERNAL = yes
+
+HAVE_SYS_MMAN_H = no
+HAVE_POSIX_SELECT = no
+
+NEED_GETTIMEOFDAY    = no
+NEED_GLOB    = no
+NEED_MMAP    = 
+NEED_SETENV  = no
+NEED_SHMEM   = no
+NEED_STRSEP  = no
+NEED_SWAB    = no
+NEED_VSSCANF = no
+
+# audio output
+OSS = no
+ALSA9 = 
+ALSA1X = 
+
+# features
+APPLE_IR = auto
+APPLE_REMOTE = auto
+AUDIO_INPUT = 
+BITMAP_FONT = yes
+CDDA = 
+CDDB = no
+COREAUDIO = 
+COREVIDEO = 
+DVBIN = no
+DVDNAV = yes
+DVDREAD = yes
+DVDREAD_INTERNAL = no
+FAAC=no
+FAAD = yes
+FAAD_INTERNAL = yes
+FREETYPE = no
+FTP = no
+GIF = no
+GUI = no
+GUI_GTK = 
+GUI_WIN32 = 
+JOYSTICK = no
+JPEG = no
+LADSPA = no
+LIBASS = no
+LIBDCA = no
+LIBDV = no
+LIBDVDCSS_INTERNAL = yes
+LIBLZO = no
+LIBMAD = no
+LIBMENU = yes
+LIBMENU_DVBIN = no
+LIBNEMESI = no
+LIBNUT = no
+LIBSMBCLIENT = no
+LIBTHEORA = no
+LIBVORBIS = yes
+LIRC = no
+LIVE555 = no
+MACOSX_BUNDLE = auto
+MACOSX_FINDER = no
+MP3LAME = auto
+MUSEPACK = no
+NATIVE_RTSP = no
+NETWORK = no
+PE_EXECUTABLE = 
+PNG = no
+PVR = no
+QTX_CODECS = auto
+QTX_CODECS_WIN32 = 
+QTX_EMULATION = no
+QUARTZ = 
+RADIO=no
+RADIO_CAPTURE=no
+REAL_CODECS = no
+SPEEX = no
+STREAM_CACHE = no
+TOOLAME=no
+TV = no
+TV_BSDBT848 = auto
+TV_DSHOW = no
+TV_TELETEXT = no
+TV_V4L  = 
+TV_V4L1 = no
+TV_V4L2 = no
+TWOLAME=no
+UNRAR_EXEC = no
+VCD = no
+VIDIX = no
+VIDIX_PCIDB = 
+VIDIX_CYBERBLADE=no
+VIDIX_IVTV=no
+VIDIX_MACH64=no
+VIDIX_MGA=no
+VIDIX_MGA_CRTC2=no
+VIDIX_NVIDIA=no
+VIDIX_PM2=no
+VIDIX_PM3=no
+VIDIX_RADEON=no
+VIDIX_RAGE128=no
+VIDIX_S3=no
+VIDIX_SIS=no
+VIDIX_UNICHROME=no
+VSTREAM = no
+WIN32DLL = no
+WIN32_EMULATION = 
+X264 = no
+XANIM_CODECS = no
+XMMS_PLUGINS = no
+XVID4 = no
+ZORAN = no
+
+# FFmpeg
+LIBAVUTIL = yes
+LIBAVUTIL_A = yes
+LIBAVUTIL_SO = auto
+LIBAVCODEC = yes
+LIBAVCODEC_A = yes
+LIBAVCODEC_SO = auto
+LIBAVFORMAT = yes
+LIBAVFORMAT_A = yes
+LIBAVFORMAT_SO = auto
+LIBPOSTPROC = yes
+LIBPOSTPROC_A = yes
+LIBPOSTPROC_SO = auto
+
+BUILD_STATIC=yes
+SRC_PATH=..
+BUILD_ROOT=..
+LIBPREF=lib
+LIBSUF=.a
+LIBNAME=$(LIBPREF)$(NAME)$(LIBSUF)
+
+CONFIG_ENCODERS=yes
+CONFIG_GPL=yes
+CONFIG_MUXERS=no
+CONFIG_LIBAMR=
+CONFIG_LIBAMR_NB=no
+CONFIG_LIBAMR_WB=no
+CONFIG_LIBDIRAC=no
+CONFIG_LIBFAAC=no
+CONFIG_LIBMP3LAME=auto
+CONFIG_LIBSCHROEDINGER=no
+CONFIG_LIBVORBIS=no
+CONFIG_LIBX264=no
+CONFIG_LIBXVID=no
+CONFIG_MLIB = no
+CONFIG_POSTPROC = yes
+# Prevent building libavcodec/imgresample.c with conflicting symbols
+CONFIG_SWSCALE=yes
+CONFIG_ZLIB=no
+
+HAVE_PTHREADS = no
+HAVE_W32THREADS = no
+HAVE_XVMC = no
+
+CONFIG_AASC_DECODER=yes
+CONFIG_AMV_DECODER=yes
+CONFIG_ASV1_DECODER=yes
+CONFIG_ASV2_DECODER=yes
+CONFIG_AVS_DECODER=yes
+CONFIG_BETHSOFTVID_DECODER=yes
+CONFIG_BFI_DECODER=yes
+CONFIG_BMP_DECODER=yes
+CONFIG_C93_DECODER=yes
+CONFIG_CAVS_DECODER=yes
+CONFIG_CINEPAK_DECODER=yes
+CONFIG_CLJR_DECODER=yes
+CONFIG_CSCD_DECODER=yes
+CONFIG_CYUV_DECODER=yes
+CONFIG_DNXHD_DECODER=yes
+CONFIG_DSICINVIDEO_DECODER=yes
+CONFIG_DVVIDEO_DECODER=yes
+CONFIG_EACMV_DECODER=yes
+CONFIG_EATGV_DECODER=yes
+CONFIG_EIGHTBPS_DECODER=yes
+CONFIG_EIGHTSVX_EXP_DECODER=yes
+CONFIG_EIGHTSVX_FIB_DECODER=yes
+CONFIG_ESCAPE124_DECODER=yes
+CONFIG_FFV1_DECODER=yes
+CONFIG_FFVHUFF_DECODER=yes
+CONFIG_FLIC_DECODER=yes
+CONFIG_FLV_DECODER=yes
+CONFIG_FOURXM_DECODER=yes
+CONFIG_FRAPS_DECODER=yes
+CONFIG_GIF_DECODER=yes
+CONFIG_H261_DECODER=yes
+CONFIG_H263_DECODER=yes
+CONFIG_H263I_DECODER=yes
+CONFIG_H264_DECODER=yes
+CONFIG_HUFFYUV_DECODER=yes
+CONFIG_IDCIN_DECODER=yes
+CONFIG_INDEO2_DECODER=yes
+CONFIG_INDEO3_DECODER=yes
+CONFIG_INTERPLAY_VIDEO_DECODER=yes
+CONFIG_JPEGLS_DECODER=yes
+CONFIG_KMVC_DECODER=yes
+CONFIG_LOCO_DECODER=yes
+CONFIG_MDEC_DECODER=yes
+CONFIG_MIMIC_DECODER=yes
+CONFIG_MJPEG_DECODER=yes
+CONFIG_MJPEGB_DECODER=yes
+CONFIG_MMVIDEO_DECODER=yes
+CONFIG_MOTIONPIXELS_DECODER=yes
+CONFIG_MPEG1VIDEO_DECODER=yes
+CONFIG_MPEG2VIDEO_DECODER=yes
+CONFIG_MPEG4_DECODER=yes
+CONFIG_MPEGVIDEO_DECODER=yes
+CONFIG_MSMPEG4V1_DECODER=yes
+CONFIG_MSMPEG4V2_DECODER=yes
+CONFIG_MSMPEG4V3_DECODER=yes
+CONFIG_MSRLE_DECODER=yes
+CONFIG_MSVIDEO1_DECODER=yes
+CONFIG_MSZH_DECODER=yes
+CONFIG_NUV_DECODER=yes
+CONFIG_PCX_DECODER=yes
+CONFIG_PTX_DECODER=yes
+CONFIG_QDRAW_DECODER=yes
+CONFIG_QPEG_DECODER=yes
+CONFIG_QTRLE_DECODER=yes
+CONFIG_RAWVIDEO_DECODER=yes
+CONFIG_RL2_DECODER=yes
+CONFIG_ROQ_DECODER=yes
+CONFIG_RPZA_DECODER=yes
+CONFIG_RV10_DECODER=yes
+CONFIG_RV20_DECODER=yes
+CONFIG_SGI_DECODER=yes
+CONFIG_SMACKER_DECODER=yes
+CONFIG_SMC_DECODER=yes
+CONFIG_SNOW_DECODER=yes
+CONFIG_SP5X_DECODER=yes
+CONFIG_SUNRAST_DECODER=yes
+CONFIG_SVQ1_DECODER=yes
+CONFIG_SVQ3_DECODER=yes
+CONFIG_TARGA_DECODER=yes
+CONFIG_THEORA_DECODER=yes
+CONFIG_THP_DECODER=yes
+CONFIG_TIERTEXSEQVIDEO_DECODER=yes
+CONFIG_TIFF_DECODER=yes
+CONFIG_TRUEMOTION1_DECODER=yes
+CONFIG_TRUEMOTION2_DECODER=yes
+CONFIG_TSCC_DECODER=yes
+CONFIG_TXD_DECODER=yes
+CONFIG_ULTI_DECODER=yes
+CONFIG_VB_DECODER=yes
+CONFIG_VC1_DECODER=yes
+CONFIG_VCR1_DECODER=yes
+CONFIG_VMDVIDEO_DECODER=yes
+CONFIG_VMNC_DECODER=yes
+CONFIG_VP3_DECODER=yes
+CONFIG_VP5_DECODER=yes
+CONFIG_VP6_DECODER=yes
+CONFIG_VP6A_DECODER=yes
+CONFIG_VP6F_DECODER=yes
+CONFIG_VQA_DECODER=yes
+CONFIG_WMV1_DECODER=yes
+CONFIG_WMV2_DECODER=yes
+CONFIG_WMV3_DECODER=yes
+CONFIG_WNV1_DECODER=yes
+CONFIG_XAN_WC3_DECODER=yes
+CONFIG_XL_DECODER=yes
+CONFIG_XSUB_DECODER=yes
+CONFIG_ZLIB_DECODER=yes
+CONFIG_AC3_DECODER=yes
+CONFIG_ALAC_DECODER=yes
+CONFIG_APE_DECODER=yes
+CONFIG_ATRAC3_DECODER=yes
+CONFIG_COOK_DECODER=yes
+CONFIG_DCA_DECODER=yes
+CONFIG_DSICINAUDIO_DECODER=yes
+CONFIG_FLAC_DECODER=yes
+CONFIG_IMC_DECODER=yes
+CONFIG_MACE3_DECODER=yes
+CONFIG_MACE6_DECODER=yes
+CONFIG_MLP_DECODER=yes
+CONFIG_MP2_DECODER=yes
+CONFIG_MP3_DECODER=yes
+CONFIG_MP3ADU_DECODER=yes
+CONFIG_MP3ON4_DECODER=yes
+CONFIG_MPC7_DECODER=yes
+CONFIG_MPC8_DECODER=yes
+CONFIG_NELLYMOSER_DECODER=yes
+CONFIG_QDM2_DECODER=yes
+CONFIG_RA_144_DECODER=yes
+CONFIG_RA_288_DECODER=yes
+CONFIG_SHORTEN_DECODER=yes
+CONFIG_SMACKAUD_DECODER=yes
+CONFIG_SONIC_DECODER=yes
+CONFIG_TRUESPEECH_DECODER=yes
+CONFIG_TTA_DECODER=yes
+CONFIG_VMDAUDIO_DECODER=yes
+CONFIG_VORBIS_DECODER=yes
+CONFIG_WAVPACK_DECODER=yes
+CONFIG_WMAV1_DECODER=yes
+CONFIG_WMAV2_DECODER=yes
+CONFIG_WS_SND1_DECODER=yes
+CONFIG_PCM_ALAW_DECODER=yes
+CONFIG_PCM_DVD_DECODER=yes
+CONFIG_PCM_F32BE_DECODER=yes
+CONFIG_PCM_MULAW_DECODER=yes
+CONFIG_PCM_S8_DECODER=yes
+CONFIG_PCM_S16BE_DECODER=yes
+CONFIG_PCM_S16LE_DECODER=yes
+CONFIG_PCM_S16LE_PLANAR_DECODER=yes
+CONFIG_PCM_S24BE_DECODER=yes
+CONFIG_PCM_S24DAUD_DECODER=yes
+CONFIG_PCM_S24LE_DECODER=yes
+CONFIG_PCM_S32BE_DECODER=yes
+CONFIG_PCM_S32LE_DECODER=yes
+CONFIG_PCM_U8_DECODER=yes
+CONFIG_PCM_U16BE_DECODER=yes
+CONFIG_PCM_U16LE_DECODER=yes
+CONFIG_PCM_U24BE_DECODER=yes
+CONFIG_PCM_U24LE_DECODER=yes
+CONFIG_PCM_U32BE_DECODER=yes
+CONFIG_PCM_U32LE_DECODER=yes
+CONFIG_PCM_ZORK_DECODER=yes
+CONFIG_INTERPLAY_DPCM_DECODER=yes
+CONFIG_ROQ_DPCM_DECODER=yes
+CONFIG_SOL_DPCM_DECODER=yes
+CONFIG_XAN_DPCM_DECODER=yes
+CONFIG_ADPCM_4XM_DECODER=yes
+CONFIG_ADPCM_ADX_DECODER=yes
+CONFIG_ADPCM_CT_DECODER=yes
+CONFIG_ADPCM_EA_DECODER=yes
+CONFIG_ADPCM_EA_MAXIS_XA_DECODER=yes
+CONFIG_ADPCM_EA_R1_DECODER=yes
+CONFIG_ADPCM_EA_R2_DECODER=yes
+CONFIG_ADPCM_EA_R3_DECODER=yes
+CONFIG_ADPCM_EA_XAS_DECODER=yes
+CONFIG_ADPCM_G726_DECODER=yes
+CONFIG_ADPCM_IMA_AMV_DECODER=yes
+CONFIG_ADPCM_IMA_DK3_DECODER=yes
+CONFIG_ADPCM_IMA_DK4_DECODER=yes
+CONFIG_ADPCM_IMA_EA_EACS_DECODER=yes
+CONFIG_ADPCM_IMA_EA_SEAD_DECODER=yes
+CONFIG_ADPCM_IMA_QT_DECODER=yes
+CONFIG_ADPCM_IMA_SMJPEG_DECODER=yes
+CONFIG_ADPCM_IMA_WAV_DECODER=yes
+CONFIG_ADPCM_IMA_WS_DECODER=yes
+CONFIG_ADPCM_MS_DECODER=yes
+CONFIG_ADPCM_SBPRO_2_DECODER=yes
+CONFIG_ADPCM_SBPRO_3_DECODER=yes
+CONFIG_ADPCM_SBPRO_4_DECODER=yes
+CONFIG_ADPCM_SWF_DECODER=yes
+CONFIG_ADPCM_THP_DECODER=yes
+CONFIG_ADPCM_XA_DECODER=yes
+CONFIG_ADPCM_YAMAHA_DECODER=yes
+CONFIG_DVBSUB_DECODER=yes
+CONFIG_DVDSUB_DECODER=yes
+CONFIG_MPEG1VIDEO_ENCODER=yes
+CONFIG_SNOW_ENCODER=yes
+CONFIG_AAC_PARSER=yes
+CONFIG_AC3_PARSER=yes
+CONFIG_CAVSVIDEO_PARSER=yes
+CONFIG_DCA_PARSER=yes
+CONFIG_DIRAC_PARSER=yes
+CONFIG_DVBSUB_PARSER=yes
+CONFIG_DVDSUB_PARSER=yes
+CONFIG_H261_PARSER=yes
+CONFIG_H263_PARSER=yes
+CONFIG_H264_PARSER=yes
+CONFIG_MJPEG_PARSER=yes
+CONFIG_MLP_PARSER=yes
+CONFIG_MPEG4VIDEO_PARSER=yes
+CONFIG_MPEGAUDIO_PARSER=yes
+CONFIG_MPEGVIDEO_PARSER=yes
+CONFIG_PNM_PARSER=yes
+CONFIG_VC1_PARSER=yes
+CONFIG_VP3_PARSER=yes
+CONFIG_AAC_DEMUXER=yes
+CONFIG_AC3_DEMUXER=yes
+CONFIG_AIFF_DEMUXER=yes
+CONFIG_AMR_DEMUXER=yes
+CONFIG_APC_DEMUXER=yes
+CONFIG_APE_DEMUXER=yes
+CONFIG_ASF_DEMUXER=yes
+CONFIG_AU_DEMUXER=yes
+CONFIG_AVI_DEMUXER=yes
+CONFIG_AVS_DEMUXER=yes
+CONFIG_BETHSOFTVID_DEMUXER=yes
+CONFIG_BFI_DEMUXER=yes
+CONFIG_C93_DEMUXER=yes
+CONFIG_DAUD_DEMUXER=yes
+CONFIG_DIRAC_DEMUXER=yes
+CONFIG_DSICIN_DEMUXER=yes
+CONFIG_DTS_DEMUXER=yes
+CONFIG_DV_DEMUXER=yes
+CONFIG_DXA_DEMUXER=yes
+CONFIG_EA_DEMUXER=yes
+CONFIG_EA_CDATA_DEMUXER=yes
+CONFIG_FFM_DEMUXER=yes
+CONFIG_FLAC_DEMUXER=yes
+CONFIG_FLIC_DEMUXER=yes
+CONFIG_FLV_DEMUXER=yes
+CONFIG_FOURXM_DEMUXER=yes
+CONFIG_GSM_DEMUXER=yes
+CONFIG_GXF_DEMUXER=yes
+CONFIG_H261_DEMUXER=yes
+CONFIG_H263_DEMUXER=yes
+CONFIG_H264_DEMUXER=yes
+CONFIG_IDCIN_DEMUXER=yes
+CONFIG_IFF_DEMUXER=yes
+CONFIG_IMAGE2_DEMUXER=yes
+CONFIG_IMAGE2PIPE_DEMUXER=yes
+CONFIG_INGENIENT_DEMUXER=yes
+CONFIG_IPMOVIE_DEMUXER=yes
+CONFIG_LMLM4_DEMUXER=yes
+CONFIG_M4V_DEMUXER=yes
+CONFIG_MATROSKA_DEMUXER=yes
+CONFIG_MJPEG_DEMUXER=yes
+CONFIG_MLP_DEMUXER=yes
+CONFIG_MM_DEMUXER=yes
+CONFIG_MMF_DEMUXER=yes
+CONFIG_MOV_DEMUXER=yes
+CONFIG_MP3_DEMUXER=yes
+CONFIG_MPC_DEMUXER=yes
+CONFIG_MPC8_DEMUXER=yes
+CONFIG_MPEGPS_DEMUXER=yes
+CONFIG_MPEGTS_DEMUXER=yes
+CONFIG_MPEGTSRAW_DEMUXER=yes
+CONFIG_MPEGVIDEO_DEMUXER=yes
+CONFIG_MSNWC_TCP_DEMUXER=yes
+CONFIG_MTV_DEMUXER=yes
+CONFIG_MVI_DEMUXER=yes
+CONFIG_MXF_DEMUXER=yes
+CONFIG_NSV_DEMUXER=yes
+CONFIG_NUT_DEMUXER=yes
+CONFIG_NUV_DEMUXER=yes
+CONFIG_OGG_DEMUXER=yes
+CONFIG_OMA_DEMUXER=yes
+CONFIG_PCM_ALAW_DEMUXER=yes
+CONFIG_PCM_MULAW_DEMUXER=yes
+CONFIG_PCM_S16BE_DEMUXER=yes
+CONFIG_PCM_S16LE_DEMUXER=yes
+CONFIG_PCM_S8_DEMUXER=yes
+CONFIG_PCM_U16BE_DEMUXER=yes
+CONFIG_PCM_U16LE_DEMUXER=yes
+CONFIG_PCM_U8_DEMUXER=yes
+CONFIG_PVA_DEMUXER=yes
+CONFIG_RAWVIDEO_DEMUXER=yes
+CONFIG_RL2_DEMUXER=yes
+CONFIG_RM_DEMUXER=yes
+CONFIG_ROQ_DEMUXER=yes
+CONFIG_RPL_DEMUXER=yes
+CONFIG_SEGAFILM_DEMUXER=yes
+CONFIG_SHORTEN_DEMUXER=yes
+CONFIG_SIFF_DEMUXER=yes
+CONFIG_SMACKER_DEMUXER=yes
+CONFIG_SOL_DEMUXER=yes
+CONFIG_STR_DEMUXER=yes
+CONFIG_SWF_DEMUXER=yes
+CONFIG_THP_DEMUXER=yes
+CONFIG_TIERTEXSEQ_DEMUXER=yes
+CONFIG_TTA_DEMUXER=yes
+CONFIG_TXD_DEMUXER=yes
+CONFIG_VC1_DEMUXER=yes
+CONFIG_VC1T_DEMUXER=yes
+CONFIG_VMD_DEMUXER=yes
+CONFIG_VOC_DEMUXER=yes
+CONFIG_WAV_DEMUXER=yes
+CONFIG_WC3_DEMUXER=yes
+CONFIG_WSAUD_DEMUXER=yes
+CONFIG_WSVQA_DEMUXER=yes
+CONFIG_WV_DEMUXER=yes
+CONFIG_XA_DEMUXER=yes
+CONFIG_YUV4MPEGPIPE_DEMUXER=yes
+CONFIG_=yes
+CONFIG_DUMP_EXTRADATA_BSF=yes
+CONFIG_H264_MP4TOANNEXB_BSF=yes
+CONFIG_IMX_DUMP_HEADER_BSF=yes
+CONFIG_MJPEGA_DUMP_HEADER_BSF=yes
+CONFIG_MP3_HEADER_COMPRESS_BSF=yes
+CONFIG_MP3_HEADER_DECOMPRESS_BSF=yes
+CONFIG_MOV2TEXTSUB_BSF=yes
+CONFIG_NOISE_BSF=yes
+CONFIG_REMOVE_EXTRADATA_BSF=yes
+CONFIG_TEXT2MOVSUB_BSF=yes
+
+DEPEND_CMD   = $(CC) -MM $(CFLAGS) $(filter-out %.h,$^) | sed "s,[0-9a-z._-]*: \($(SRC_DIR)/\)*\([a-z0-9]*/\)[^/]* ,\2&,"
+
+MPDEPEND_CMD     = $(CC) -MM $(CFLAGS)   $(filter-out %.h,$^) | sed -e "s,[0-9a-z._-]*: \([a-z0-9/]*/\)[^/]* ,\1&," -e "s,\(.*\)\.o: ,\1.d &,"
+MPDEPEND_CMD_CXX = $(CC) -MM $(CXXFLAGS) $(filter-out %.h,$^) | sed -e "s,[0-9a-z._-]*: \([a-z0-9/]*/\)[^/]* ,\1&," -e "s,\(.*\)\.o: ,\1.d &,"
+
Index: libdvdcss/device.c
===================================================================
--- libdvdcss/device.c	(revision 27458)
+++ libdvdcss/device.c	(working copy)
@@ -52,9 +52,16 @@
 #if defined( WIN32 ) && !defined( SYS_CYGWIN )
 #   include <io.h>                                                 /* read() */
 #else
+#ifndef GEKKO
 #   include <sys/uio.h>                                      /* struct iovec */
 #endif
+#endif
 
+#ifdef GEKKO
+#    include <di/di.h>
+#    include <malloc.h>
+#endif
+
 #ifdef DARWIN_DVD_IOCTL
 #   include <paths.h>
 #   include <CoreFoundation/CoreFoundation.h>
@@ -81,6 +88,13 @@
 static int libc_read  ( dvdcss_t, void *, int );
 static int libc_readv ( dvdcss_t, struct iovec *, int );
 
+#ifdef GEKKO
+static int di_open  ( dvdcss_t, char const * );
+static int di_seek  ( dvdcss_t, int );
+static int di_read  ( dvdcss_t, void *, int );
+static int di_readv ( dvdcss_t, struct iovec *, int );
+#endif
+
 #ifdef WIN32
 static int win2k_open ( dvdcss_t, char const * );
 static int aspi_open  ( dvdcss_t, char const * );
@@ -95,6 +109,7 @@
 
 int _dvdcss_use_ioctls( dvdcss_t dvdcss )
 {
+#ifndef GEKKO
 #if defined( WIN32 )
     if( dvdcss->b_file )
     {
@@ -144,6 +159,9 @@
         return 0;
     }
 #endif
+#else
+	return 0;
+#endif
 }
 
 void _dvdcss_check ( dvdcss_t dvdcss )
@@ -270,6 +288,10 @@
     }
 
     IOObjectRelease( media_iterator );
+#elif defined GEKKO
+    free( dvdcss->psz_device );
+    dvdcss->psz_device = strdup("/dev/di");
+    print_debug( dvdcss, "defaulting to drive `%s'", dvdcss->psz_device );
 #else
     for( i = 0; ppsz_devices[i]; i++ )
     {
@@ -294,6 +316,15 @@
 
     print_debug( dvdcss, "opening target `%s'", psz_device );
 
+#ifdef GEKKO
+    print_debug( dvdcss, "using Erant's DI API for access" );
+
+    dvdcss->pf_seek = di_seek;
+    dvdcss->pf_read = di_read;
+    dvdcss->pf_readv = di_readv;
+
+    return di_open( dvdcss, psz_device );
+#else
 #if defined( WIN32 )
     dvdcss->b_file = 1;
     /* If device is "X:" or "X:\", we are not actually opening a file. */
@@ -330,6 +361,7 @@
         dvdcss->pf_readv = libc_readv;
         return libc_open( dvdcss, psz_device );
     }
+#endif
 }
 
 #ifndef WIN32
@@ -382,6 +414,10 @@
     }
 
     return 0;
+#elif defined GEKKO
+	print_debug(dvdcss, "DI: deinitializing dvd...");
+	DI_StopMotor();
+	DI_Close();
 #else
     close( dvdcss->i_fd );
 
@@ -971,3 +1007,124 @@
 }
 #endif
 
+#ifdef GEKKO
+static int di_open(dvdcss_t dvdcss, char const * psz_device) {
+	int retry = 20 * 5;
+	int status;
+
+	if (strcmp(psz_device, "/dev/di")) {
+		print_debug(dvdcss, "DI: unknown device '%s'", psz_device);
+		return -1;
+	}
+
+	print_debug(dvdcss, "DI: initializing dvd...");
+	DI_Mount();
+
+	print_debug(dvdcss, "DI: waiting for device to become ready...");
+
+	while (retry > 0) {
+		status = DI_GetStatus();
+
+		if (!(status & DVD_INIT))
+			break;
+		
+		retry--;
+		
+		usleep (200 * 1000);
+	}
+
+	if (status & DVD_NO_DISC) {
+		print_debug(dvdcss, "DI: no disc, dude");
+		DI_Close();
+		return -1;
+	}
+
+	if (!(status & DVD_READY)) {
+		print_debug(dvdcss, "DI: dvd not ready: 0x%x", status);
+		DI_Close();
+		return -1;
+	}
+
+	if (status & DVD_D0)
+		print_debug(dvdcss, "DI: no modchip detected");
+
+	if (status & DVD_A8)
+		print_debug(dvdcss, "DI: modchip detected");
+
+	dvdcss->i_pos = 0;
+
+	return 0;
+}
+
+static int di_seek(dvdcss_t dvdcss, int i_blocks) {
+	if (dvdcss->i_pos == i_blocks )
+		return i_blocks;
+
+	//TODO check this against the disc's max lba
+	dvdcss->i_pos = i_blocks;
+	return dvdcss->i_pos;
+}
+
+static int di_read(dvdcss_t dvdcss, void *buffer, int blocks) {
+	void *bfr;
+	int ret;
+
+	bfr = memalign(32, blocks * DVDCSS_BLOCK_SIZE);
+	if (bfr == NULL) {
+		print_debug(dvdcss, "DI: can't allocate %d bytes",
+					blocks * DVDCSS_BLOCK_SIZE);
+		return -1;
+	}
+
+	ret = DI_ReadDVD(bfr, blocks, dvdcss->i_pos);
+
+	if (ret < 0) {
+		print_debug(dvdcss, "DI: read failed with %d", ret);
+		free(bfr);
+		return -1;
+	}
+
+	dvdcss->i_pos += blocks;
+	memcpy(buffer, bfr, blocks * DVDCSS_BLOCK_SIZE);
+	free(bfr);
+
+	return blocks;
+}
+
+static int di_readv(dvdcss_t dvdcss, struct iovec *iov, int iovcnt) {
+	int len;
+	int i;
+	int ret;
+	void *bfr, *ptr;
+
+	len = 0;
+	for (i = 0; i < iovcnt; ++i)
+		len += iov[i].iov_len;
+
+	bfr = memalign(32, len);
+	if (bfr == NULL) {
+		print_debug(dvdcss, "DI: can't allocate %d bytes",
+					len * DVDCSS_BLOCK_SIZE);
+		return -1;
+	}
+
+	ret = DI_ReadDVD(bfr, len / DVDCSS_BLOCK_SIZE, dvdcss->i_pos);
+	if (ret < 0) {
+		print_debug( dvdcss, "DI: readv failed with %d", ret);
+		free(bfr);
+		return -1;
+	}
+
+	ptr = bfr;
+	for (i = 0; i < iovcnt; ++i) {
+		memcpy(iov[i].iov_base, ptr, iov[i].iov_len);
+		ptr += iov[i].iov_len;
+	}
+
+	dvdcss->i_pos += len / DVDCSS_BLOCK_SIZE;
+	free(bfr);
+
+	return len;
+}
+#endif
+
Index: libdvdcss/device.h
===================================================================
--- libdvdcss/device.h	(revision 27458)
+++ libdvdcss/device.h	(working copy)
@@ -30,10 +30,12 @@
 #   include <io.h>                                                 /* read() */
 #else
 #   include <sys/types.h>
+#ifndef GEKKO
 #   include <sys/uio.h>                                      /* struct iovec */
 #endif
+#endif
 
-#if defined( WIN32 ) && !defined( SYS_CYGWIN )
+#if ( defined( WIN32 ) && !defined( SYS_CYGWIN ) ) || defined ( GEKKO )
 struct iovec
 {
     void *iov_base;     /* Pointer to data. */
Index: libdvdcss/ioctl.c
===================================================================
--- libdvdcss/ioctl.c	(revision 27458)
+++ libdvdcss/ioctl.c	(working copy)
@@ -49,9 +49,11 @@
 #   include <os2.h>
 #   include <sys/ioctl.h>
 #else
+#ifndef GEKKO
 #   include <netinet/in.h>
 #   include <sys/ioctl.h>
 #endif
+#endif
 
 #ifdef DVD_STRUCT_IN_SYS_CDIO_H
 #   include <sys/cdio.h>
@@ -269,6 +271,8 @@
 
     *pi_copyright = p_buffer[ 4 ];
 
+#elif defined( GEKKO )
+	return -1;
 #else
 #   error "DVD ioctls are unavailable on this system"
 
@@ -442,6 +446,8 @@
 
     memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
 
+#elif defined( GEKKO )
+	return -1;
 #else
 #   error "DVD ioctls are unavailable on this system"
 
@@ -606,6 +612,8 @@
 
     memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
 
+#elif defined( GEKKO )
+	return -1;
 #else
 #   error "DVD ioctls are unavailable on this system"
 
@@ -730,6 +738,8 @@
 
     *pi_agid = p_buffer[ 7 ] >> 6;
 
+#elif defined( GEKKO )
+	return -1;
 #else
 #   error "DVD ioctls are unavailable on this system"
 
@@ -864,6 +874,8 @@
 
     memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
 
+#elif defined( GEKKO )
+	return -1;
 #else
 #   error "DVD ioctls are unavailable on this system"
 
@@ -997,6 +1009,8 @@
 
     *pi_asf = p_buffer[ 7 ] & 1;
 
+#elif defined( GEKKO )
+	return -1;
 #else
 #   error "DVD ioctls are unavailable on this system"
 
@@ -1126,6 +1140,8 @@
 
     memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
 
+#elif defined( GEKKO )
+	return -1;
 #else
 #   error "DVD ioctls are unavailable on this system"
 
@@ -1237,6 +1253,8 @@
     i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
                         &sdc, sizeof(sdc), &ulParamLen,
                         NULL, 0, &ulDataLen);
+#elif defined( GEKKO )
+	return -1;
 #else
 #   error "DVD ioctls are unavailable on this system"
 
@@ -1374,6 +1392,8 @@
                          &sdc, sizeof(sdc), &ulParamLen,
                          p_buffer, sizeof(p_buffer), &ulDataLen );
 
+#elif defined( GEKKO )
+	return -1;
 #else
 #   error "DVD ioctls are unavailable on this system"
 
@@ -1511,6 +1531,8 @@
                          &sdc, sizeof(sdc), &ulParamLen,
                          p_buffer, sizeof(p_buffer), &ulDataLen );
 
+#elif defined( GEKKO )
+	return -1;
 #else
 #   error "DVD ioctls are unavailable on this system"
 
@@ -1666,6 +1688,8 @@
     *p_mask = p_buffer[ 5 ];
     *p_scheme = p_buffer[ 6 ];
 
+#elif defined( GEKKO )
+	return -1;
 #else
 #   error "DVD ioctls are unavailable on this system"
 
@@ -1793,6 +1817,8 @@
                          &sdc, sizeof(sdc), &ulParamLen,
                          p_buffer, sizeof(p_buffer), &ulDataLen );
 
+#elif defined( GEKKO )
+	return -1;
 #else
 #   error "DVD ioctls are unavailable on this system"
 
Index: mplayer.c
===================================================================
--- mplayer.c	(revision 27458)
+++ mplayer.c	(working copy)
@@ -15,7 +15,7 @@
 
 // #include <sys/mman.h>
 #include <sys/types.h>
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(GEKKO)
 #include <sys/ioctl.h>
 #include <sys/wait.h>
 #else
@@ -117,6 +117,10 @@
 #include "stream/cache2.h"
 #endif
 
+#ifdef GEKKO
+#include "osdep/plat_gekko.h"
+#endif
+
 //**************************************************************************//
 //             Playtree
 //**************************************************************************//
@@ -726,6 +730,10 @@
   if(how) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_ExitingHow,how);
   mp_msg(MSGT_CPLAYER,MSGL_DBG2,"max framesize was %d bytes\n",max_framesize);
 
+#ifdef GEKKO
+  plat_deinit (rc);
+#endif
+
   exit(rc);
 }
 
@@ -733,7 +741,7 @@
   exit_player_with_rc(how, 1);
 }
 
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(GEKKO)
 static void child_sighandler(int x){  
   pid_t pid;
   while((pid=waitpid(-1,NULL,WNOHANG)) > 0);
@@ -764,7 +772,7 @@
   if(sig_count==6) exit(1);
   if(sig_count>6){
     // can't stop :(
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(GEKKO)
     kill(getpid(),SIGKILL);
 #endif
   }
@@ -1241,6 +1249,7 @@
       (int)sh_video->num_frames,
       (int)sh_video->num_frames_decoded);
 
+#ifndef GEKKO
   // CPU usage
   if (sh_video) {
     if (sh_video->timer > 0.5)
@@ -1257,6 +1266,7 @@
     else
       saddf(line, &pos, width, "??,?%% ");
   }
+#endif
 
   // VO stats
   if (sh_video) 
@@ -2556,6 +2566,10 @@
 
 int gui_no_filename=0;
 
+#ifdef GEKKO
+  plat_init (&argc, &argv);
+#endif
+
   InitTimer();
   srand(GetTimerMS());
   
@@ -2891,7 +2905,7 @@
 current_module = NULL;
 
   /// Catch signals
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(GEKKO)
   signal(SIGCHLD,child_sighandler);
 #endif
 
@@ -3751,6 +3765,8 @@
 	xscreensaver_heartbeat();
     }
 #endif
+
+#ifndef GEKKO
     if (heartbeat_cmd) {
         static unsigned last_heartbeat;
         unsigned now = GetTimerMS();
@@ -3759,6 +3775,7 @@
             system(heartbeat_cmd);
         }
     }
+#endif
 
     frame_time_remaining = sleep_until_update(&time_frame, &aq_sleep_time);
 
Index: mplayer.spec
===================================================================
--- mplayer.spec	(revision 0)
+++ mplayer.spec	(revision 0)
@@ -0,0 +1,2 @@
+*link_start_rvl:
+ -T mplayer.ld%s
Index: osdep/getch2-gekko.c
===================================================================
--- osdep/getch2-gekko.c	(revision 0)
+++ osdep/getch2-gekko.c	(revision 0)
@@ -0,0 +1,139 @@
+/*
+   getch2_gekko.c - MPlayer TermIO driver for Wii
+
+   Copyright (C) 2008 dhewg
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301 USA.
+*/
+
+#include "config.h"
+#include "keycodes.h"
+#include "input/input.h"
+#include "mp_fifo.h"
+
+#include <gccore.h>
+#include <ogc/lwp_watchdog.h>
+#include <wiiuse/wpad.h>
+
+int screen_width = 80;
+int screen_height = 24;
+char *erase_to_end_of_line = NULL;
+
+static int getch2_status=0;
+
+typedef struct {
+	u16 pad;
+	u32 wpad;
+	int key;
+} pad_map;
+
+static const pad_map pad_maps[] = {
+	{ PAD_BUTTON_A,		WPAD_BUTTON_A,		'a' },
+	{ PAD_BUTTON_B,		WPAD_BUTTON_B,		'b' },
+	{ PAD_BUTTON_X,		WPAD_BUTTON_1,		'x' },
+	{ PAD_TRIGGER_Z,	WPAD_BUTTON_HOME,	'z' },
+	{ PAD_TRIGGER_L,	WPAD_BUTTON_MINUS,	'l' },
+	{ PAD_TRIGGER_R,	WPAD_BUTTON_PLUS,	'r' },
+	{ PAD_BUTTON_LEFT,	WPAD_BUTTON_LEFT,	KEY_LEFT },
+	{ PAD_BUTTON_RIGHT,	WPAD_BUTTON_RIGHT,	KEY_RIGHT },
+	{ PAD_BUTTON_UP,	WPAD_BUTTON_UP,		KEY_UP },
+	{ PAD_BUTTON_DOWN,	WPAD_BUTTON_DOWN,	KEY_DOWN }
+};
+
+static const pad_map pad_maps_mod[] = {
+	{ PAD_BUTTON_A,		WPAD_BUTTON_A,		'A' },
+	{ PAD_BUTTON_B,		WPAD_BUTTON_B,		'B' },
+	{ PAD_BUTTON_X,		WPAD_BUTTON_1,		'X' },
+	{ PAD_TRIGGER_Z,	WPAD_BUTTON_HOME,	'Z' },
+	{ PAD_TRIGGER_L,	WPAD_BUTTON_MINUS,	'L' },
+	{ PAD_TRIGGER_R,	WPAD_BUTTON_PLUS,	'R' },
+	{ PAD_BUTTON_LEFT,	WPAD_BUTTON_LEFT,	KEY_KP4 },
+	{ PAD_BUTTON_RIGHT,	WPAD_BUTTON_RIGHT,	KEY_KP6 },
+	{ PAD_BUTTON_UP,	WPAD_BUTTON_UP,		KEY_KP8 },
+	{ PAD_BUTTON_DOWN,	WPAD_BUTTON_DOWN,	KEY_KP2 }
+};
+
+void get_screen_size() {
+}
+
+void getch2_enable() {
+	getch2_status=1;
+}
+
+void getch2_disable() {
+	getch2_status=0;
+}
+
+void getch2(void) {
+	static s64 lt = 0;
+	s64 tt;
+	u16 pad, i;
+	u32 wpad;
+	bool mod;
+
+	if (!getch2_status)
+		return;
+
+	if (reset_pressed || power_pressed) {
+		mplayer_put_key(KEY_CLOSE_WIN);
+		return;
+	}
+
+	tt = gettime();
+	if (ticks_to_millisecs(tt - lt) < (TB_MSPERSEC / 60))
+		return;
+
+	lt = tt;
+	mod = false;
+
+	PAD_ScanPads();
+
+	pad = PAD_ButtonsDown(0);
+	if (PAD_ButtonsHeld(0) & PAD_BUTTON_Y)
+		mod = true;
+
+	WPAD_ScanPads();
+
+	wpad = 0;
+	if (WPAD_Probe (0, NULL) == WPAD_ERR_NONE) {
+		wpad = WPAD_ButtonsDown(0);
+		if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_2)
+			mod = true;
+	}
+
+	if (mod) {
+		for (i = 0; i < sizeof (pad_maps_mod) / sizeof (pad_map); ++i)
+			if ((pad & pad_maps_mod[i].pad) || (wpad & pad_maps_mod[i].wpad)) {
+				mplayer_put_key(pad_maps_mod[i].key);
+				return;
+			}
+	} else {
+		for (i = 0; i < sizeof (pad_maps) / sizeof (pad_map); ++i)
+			if ((pad & pad_maps[i].pad) || (wpad & pad_maps[i].wpad)) {
+				mplayer_put_key(pad_maps[i].key);
+				return;
+			}
+	}
+}
+
+#ifdef HAVE_ICONV
+char* get_term_charset(void) {
+	static const char *codepage = "ASCII";
+
+	return codepage;
+}
+#endif
+
Index: osdep/timer-gekko.c
===================================================================
--- osdep/timer-gekko.c	(revision 0)
+++ osdep/timer-gekko.c	(revision 0)
@@ -0,0 +1,58 @@
+/*
+   MPlayer timer for Wii
+
+   Copyright (C) 2008 dhewg
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301 USA.
+*/
+
+
+#include <unistd.h>
+
+#include <ogc/lwp_watchdog.h>
+
+const char *timer_name = "gekko";
+
+int usec_sleep(int usec_delay) {
+	return usleep(usec_delay);
+}
+
+unsigned int GetTimer(void) {
+	return ticks_to_microsecs(gettime());
+}
+
+unsigned int GetTimerMS(void) {
+	return ticks_to_millisecs(gettime());
+}
+
+static s64 relative = 0;
+
+float GetRelativeTime(void) {
+	s64 t;
+	float res;
+
+	t = gettime();
+	res = (float) ticks_to_nanosecs(diff_ticks(relative, t)) /
+			(float) TB_NSPERSEC;
+	relative = t;
+
+	return res;
+}
+
+void InitTimer(void) {
+	relative = gettime();
+}
+
Index: osdep/log_console.c
===================================================================
--- osdep/log_console.c	(revision 0)
+++ osdep/log_console.c	(revision 0)
@@ -0,0 +1,189 @@
+/*-------------------------------------------------------------
+
+Copyright (C) 2008 dhewg
+
+This software is provided 'as-is', without any express or implied
+warranty.  In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1.	The origin of this software must not be misrepresented; you
+must not claim that you wrote the original software. If you use
+this software in a product, an acknowledgment in the product
+documentation would be appreciated but is not required.
+
+2.	Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3.	This notice may not be removed or altered from any source
+distribution.
+
+-------------------------------------------------------------*/
+
+#include <sys/iosupport.h>
+#include <reent.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "log_console.h"
+
+static bool gecko = false;
+static const devoptab_t *dot_video = NULL;
+static VIRetraceCallback rcb = NULL;
+static char **log = NULL;
+static u16 log_size = 0;
+static u16 log_next = 0;
+static bool log_active = true;
+static bool video_active = true;
+
+static int __out_write(struct _reent *r, int fd, const char *ptr, int len) {
+	u32 level;
+	u16 l;
+
+	if (!ptr || len <= 0)
+		return -1;
+
+	if (video_active) {
+		dot_video->write_r(r, fd, ptr, len);
+	} else {
+		if (log_active) {
+			l = (log_next + 1) % log_size;
+			if (log[l])
+				free(log[l]);
+			log[l] = strndup(ptr, len);
+
+			log_next = l;
+		}
+	}
+
+	if (gecko) {
+		level = IRQ_Disable();
+		usb_sendbuffer(1, ptr, len);
+		IRQ_Restore(level);
+	}
+
+	return len;
+}
+
+const devoptab_t dot_out = {
+	"stdout",	// device name
+	0,			// size of file structure
+	NULL,		// device open
+	NULL,		// device close
+	__out_write,// device write
+	NULL,		// device read
+	NULL,		// device seek
+	NULL,		// device fstat
+	NULL,		// device stat
+	NULL,		// device link
+	NULL,		// device unlink
+	NULL,		// device chdir
+	NULL,		// device rename
+	NULL,		// device mkdir
+	0,			// dirStateSize
+	NULL,		// device diropen_r
+	NULL,		// device dirreset_r
+	NULL,		// device dirnext_r
+	NULL,		// device dirclose_r
+	NULL		// device statvfs_r
+};
+
+void log_console_init(GXRModeObj *vmode, u16 logsize) {
+	u16 i;
+
+	CON_InitEx(vmode, 20, 30, vmode->fbWidth - 40, vmode->xfbHeight - 60);
+	rcb = VIDEO_SetPostRetraceCallback(NULL);
+	VIDEO_SetPostRetraceCallback(rcb);
+
+	gecko = usb_isgeckoalive(1);
+
+	if (log_size && log) {
+		for (i = 0; i < log_size; ++i)
+			if (log[i])
+				free(log[i]);
+
+		free(log);
+	}
+
+	log_size = logsize;
+	log_next = 0;
+
+	if (log_size) {
+		log = (char **) malloc(log_size * sizeof(char *));
+
+		for (i = 0; i < log_size; ++i)
+			log[i] = NULL;
+	}
+
+	log_active = log_size > 0;
+
+	dot_video = devoptab_list[STD_OUT];
+	video_active = true;
+
+	devoptab_list[STD_OUT] = &dot_out;
+	devoptab_list[STD_ERR] = &dot_out;
+}
+
+void log_console_deinit(void) {
+	u16 i;
+
+	if (log_size && log) {
+		for (i = 0; i < log_size; ++i)
+			if (log[i])
+				free(log[i]);
+
+		free(log);
+		log = NULL;
+	}
+
+	log_size = 0;
+	log_next = 0;
+
+	devoptab_list[STD_OUT] = dot_video;
+	devoptab_list[STD_ERR] = dot_video;
+
+	VIDEO_SetPostRetraceCallback(rcb);
+
+	dot_video = NULL;
+}
+
+void log_console_enable_log(bool enable) {
+	if (!log_size)
+		return;
+
+	log_active = enable;
+}
+
+void log_console_enable_video(bool enable) {
+	struct _reent *r = _REENT;
+	u16 i, l;
+
+	if (video_active == enable)
+		return;
+
+	video_active = enable;
+
+	if (enable)
+		VIDEO_SetPostRetraceCallback(rcb);
+	else
+		VIDEO_SetPostRetraceCallback(NULL);
+
+	if (!enable || !log_size)
+		return;
+
+	for (i = 0; i < log_size; ++i) {
+		l = (log_next + 1 + i) % log_size;
+		if (log[l]) {
+			dot_video->write_r(r, 0, log[l], strlen(log[l]));
+			free(log[l]);
+			log[l] = NULL;
+		}
+	}
+
+	fflush(stdout);
+}
+
Index: osdep/log_console.h
===================================================================
--- osdep/log_console.h	(revision 0)
+++ osdep/log_console.h	(revision 0)
@@ -0,0 +1,36 @@
+/*-------------------------------------------------------------
+
+Copyright (C) 2008 dhewg
+
+This software is provided 'as-is', without any express or implied
+warranty.  In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1.	The origin of this software must not be misrepresented; you
+must not claim that you wrote the original software. If you use
+this software in a product, an acknowledgment in the product
+documentation would be appreciated but is not required.
+
+2.	Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3.	This notice may not be removed or altered from any source
+distribution.
+
+-------------------------------------------------------------*/
+
+#ifndef _LOG_CONSOLE_H_
+#define _LOG_CONSOLE_H_
+
+#include <gccore.h>
+
+void log_console_init(GXRModeObj *vmode, u16 logsize);
+void log_console_deinit(void);
+void log_console_enable_log(bool enable);
+void log_console_enable_video(bool enable);
+
+#endif
Index: osdep/plat_gekko.c
===================================================================
--- osdep/plat_gekko.c	(revision 0)
+++ osdep/plat_gekko.c	(revision 0)
@@ -0,0 +1,185 @@
+/*
+   MPlayer Wii port
+
+   Copyright (C) 2008 dhewg
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301 USA.
+*/
+
+#include "../config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <ogcsys.h>
+#include <ogc/lwp_watchdog.h>
+#include <debug.h>
+#include <wiiuse/wpad.h>
+
+#include <fat.h>
+#include <di/di.h>
+
+#include "log_console.h"
+#include "gx_supp.h"
+#include "plat_gekko.h"
+
+#undef abort
+
+bool ios_reloaded = true;
+bool reset_pressed = false;
+bool power_pressed = false;
+
+static char *default_args[] = {
+	"mplayer.dol",
+	"-loop", "0",
+	"-menu",
+	"-menu-startup",
+	"loop.mov"
+};
+
+static void reset_cb (void) {
+	reset_pressed = true;
+}
+
+static void power_cb (void) {
+	power_pressed = true;
+}
+
+int gekko_gettimeofday(struct timeval *tv, void *tz) {
+	u32 us = ticks_to_microsecs(gettime());
+
+	tv->tv_sec = us / TB_USPERSEC;
+	tv->tv_usec = us % TB_USPERSEC;
+
+	return 0;
+}
+
+void gekko_abort(void) {
+	printf("abort() called\n");
+	plat_deinit(-1);
+	exit(-1);
+}
+
+DIR *opendir(const char *name) {
+	return diropen(name);
+}
+
+static struct dirent de;
+
+struct dirent *readdir(DIR *dir) {
+	struct stat st;
+
+	if (dirnext(dir, de.d_name, &st))
+		return NULL;
+
+	return &de;
+}
+
+int closedir(DIR *dir) {
+	return dirclose(dir);
+}
+
+void plat_init (int *argc, char **argv[]) {
+	char buf[MAXPATHLEN];
+
+	DI_Init();
+	VIDEO_Init();
+	PAD_Init();
+
+	AUDIO_Init(NULL);
+	AUDIO_RegisterDMACallback(NULL);
+	AUDIO_StopDMA();
+
+	SYS_SetResetCallback (reset_cb);
+	SYS_SetPowerCallback (power_cb);
+
+#if 0
+	DEBUG_Init(0, 1);
+	_break();
+#endif
+
+	GX_InitVideo();
+
+	log_console_init(vmode, 128);
+	printf("MPlayer Wii port (c) 2008 Team Twiizers\n");
+	printf("Running under IOS%d\n", IOS_GetVersion());
+	printf("VIDEO: %u * %u (%u * %u)\n", vmode->fbWidth, vmode->efbHeight,
+			vmode->viWidth, vmode->viHeight);
+
+	if (!ios_reloaded) {
+		printf("IOS could not be reloaded, exiting.\n");
+		sleep(3);
+
+		exit(0);
+	}
+
+	WPAD_Init();
+	WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS);
+	WPAD_SetIdleTimeout(180);
+
+	if (!fatInitDefault()) {
+		printf("fatInitDefault failed\n");
+		sleep(3);
+
+		exit(0);
+	}
+
+	fatEnableReadAhead(PI_DEFAULT, 32, 128);
+
+	getcwd(buf, MAXPATHLEN);
+	if (!strcmp(buf, "fat:/")) {
+		strcpy(buf, "/apps/mplayer");
+		chdir(buf);
+	}
+
+	setenv("HOME", buf, 1);
+	setenv("DVDCSS_CACHE", "off", 1);
+	setenv("DVDCSS_VERBOSE", "2", 1);
+
+	if (*argc < 2) {
+		*argc = sizeof(default_args) / sizeof(char *);
+		*argv = default_args;
+	}
+}
+
+void plat_deinit (int rc) {
+	DI_Close();
+
+	if (!fatUnmount(PI_DEFAULT)) {
+		printf ("fatUnmount failed\n");
+		fatUnsafeUnmount(PI_DEFAULT);
+	}
+
+	if (power_pressed) {
+		printf("shutting down\n");
+		SYS_ResetSystem(SYS_POWEROFF, 0, 0);
+	}
+
+	log_console_enable_video(true);
+
+	VIDEO_WaitVSync();
+
+	if (vmode->viTVMode & VI_NON_INTERLACE)
+		VIDEO_WaitVSync();
+
+	if (rc != 0)
+		sleep(3);
+
+	log_console_deinit();
+}
+
Index: osdep/plat_gekko.h
===================================================================
--- osdep/plat_gekko.h	(revision 0)
+++ osdep/plat_gekko.h	(revision 0)
@@ -0,0 +1,48 @@
+#ifndef __PLAT_GEKKO_H__
+#define __PLAT_GEKKO_H__
+
+#ifdef GEKKO
+
+#include <sys/time.h>
+#include <sys/dir.h>
+#include <unistd.h>
+
+#include <gctypes.h>
+
+extern bool reset_pressed;
+extern bool power_pressed;
+
+// yeah, i know...
+// there is no _FILE_OFFSET_BITS in newlib and mplayer expects a 64bit off_t,
+// so thats what it gets
+#define off_t s64
+
+#define PATH_MAX MAXPATHLEN
+
+typedef DIR_ITER DIR;
+
+struct dirent {
+	//ino_t d_ino;
+	//off_t d_off;
+	//unsigned short d_reclen;
+	//unsigned char  d_type;
+	char d_name[MAXPATHLEN];
+};
+
+int gekko_gettimeofday(struct timeval *tv, void *tz);
+
+void gekko_abort(void);
+
+#define gettimeofday(TV, TZ) gekko_gettimeofday((TV), (TZ))
+#define abort(x) gekko_abort(x)
+
+DIR *opendir(const char *name);
+struct dirent *readdir(DIR *dir);
+int closedir(DIR *dir);
+
+void plat_init (int *argc, char **argv[]);
+void plat_deinit (int rc);
+
+#endif
+
+#endif
Index: osdep/gx_supp.c
===================================================================
--- osdep/gx_supp.c	(revision 0)
+++ osdep/gx_supp.c	(revision 0)
@@ -0,0 +1,696 @@
+/****************************************************************************
+*	gx_supp.c - Generic GX Support for Emulators
+*	softdev 2007
+*	dhewg 2008
+*	sepp256 2008 - Coded YUV->RGB conversion in TEV.
+*
+*	This program is free software; you can redistribute it and/or modify
+*	it under the terms of the GNU General Public License as published by
+*	the Free Software Foundation; either version 2 of the License, or
+*	(at your option) any later version.
+*
+*	This program is distributed in the hope that it will be useful,
+*	but WITHOUT ANY WARRANTY; without even the implied warranty of
+*	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*	GNU General Public License for more details.
+*
+*	You should have received a copy of the GNU General Public License along
+*	with this program; if not, write to the Free Software Foundation, Inc.,
+*	51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* NGC GX Video Functions
+*
+* These are pretty standard functions to setup and use GX scaling.
+****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "gx_supp.h"
+
+#define DEFAULT_FIFO_SIZE (256 * 1024)
+
+#define HASPECT 320
+#define VASPECT 240
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*** 2D ***/
+static u32 whichfb;
+static u32 *xfb[2];
+GXRModeObj *vmode = NULL;
+
+/*** 3D GX ***/
+static u8 *gp_fifo;
+
+/*** Texture memory ***/
+static u8 *texturemem = NULL,*Ytexture = NULL,*Utexture = NULL,*Vtexture = NULL;
+static u32 texturesize,Ytexsize,UVtexsize;
+
+GXTexObj texobj,YtexObj,UtexObj,VtexObj;
+static Mtx view;
+static u16 vwidth, vheight, oldvwidth, oldvheight;
+static u16 Ywidth, Yheight, UVwidth, UVheight;
+
+/* New texture based scaler */
+typedef struct tagcamera {
+	Vector pos;
+	Vector up;
+	Vector view;
+} camera;
+
+static s16 square[] ATTRIBUTE_ALIGN(32) = {
+	-HASPECT, VASPECT, 0,
+	HASPECT, VASPECT, 0,
+	HASPECT, -VASPECT, 0,
+	-HASPECT, -VASPECT, 0,
+};
+
+static GXColor colors[] ATTRIBUTE_ALIGN(32) = {
+	{0,255,0,255}		//G
+};
+
+static u8 texcoords[] ATTRIBUTE_ALIGN(32) = {
+	0x00, 0x00,
+	0x01, 0x00,
+	0x01, 0x01,
+	0x00, 0x01,
+};
+
+static camera cam = {
+	{ 0.0f, 0.0f, 370.0f },
+	{ 0.0f, 0.5f, 0.0f },
+	{ 0.0f, 0.0f, -0.5f }
+};
+
+void GX_InitVideo() {
+	vmode = VIDEO_GetPreferredMode(NULL);
+
+	vmode->viWidth = 678;
+	vmode->viXOrigin = (VI_MAX_WIDTH_PAL - 678) / 2;
+
+	VIDEO_Configure(vmode);
+
+	xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer(vmode));
+	xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer(vmode));
+	gp_fifo = (u8 *) memalign(32, DEFAULT_FIFO_SIZE);
+
+	VIDEO_ClearFrameBuffer(vmode, xfb[0], COLOR_BLACK);
+	VIDEO_ClearFrameBuffer(vmode, xfb[1], COLOR_BLACK);
+
+	whichfb = 0;
+	VIDEO_SetNextFramebuffer(xfb[whichfb]);
+	VIDEO_SetBlack(FALSE);
+	VIDEO_Flush();
+	VIDEO_WaitVSync();
+
+	if (vmode->viTVMode & VI_NON_INTERLACE)
+		VIDEO_WaitVSync();
+}
+
+void GX_SetCamPosZ(float f) {
+	cam.pos.z = f;
+}
+
+/****************************************************************************
+ * Scaler Support Functions
+ ****************************************************************************/
+static void draw_init(void) {
+	GX_ClearVtxDesc();
+	GX_SetVtxDesc(GX_VA_POS, GX_INDEX8);
+	GX_SetVtxDesc(GX_VA_CLR0, GX_INDEX8);
+	GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
+
+	GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
+	GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
+	GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
+
+	GX_SetArray(GX_VA_POS, square, 3 * sizeof(s16));
+
+	GX_SetNumTexGens(1);
+	GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
+
+	GX_InvalidateTexAll();
+
+	GX_InitTexObj(&texobj, texturemem, vwidth, vheight, GX_TF_RGB565,
+					GX_CLAMP, GX_CLAMP, GX_FALSE);
+}
+
+static void draw_vert(u8 pos, u8 c, f32 s, f32 t) {
+	GX_Position1x8(pos);
+	GX_Color1x8(c);
+	GX_TexCoord2f32(s, t);
+}
+
+static void draw_square(Mtx v) {
+	Mtx m;
+	Mtx mv;
+
+	guMtxIdentity(m);
+	guMtxTransApply(m, m, 0, 0, -100);
+	guMtxConcat(v, m, mv);
+
+	GX_LoadPosMtxImm(mv, GX_PNMTX0);
+	GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
+	draw_vert(0, 0, 0.0, 0.0);
+	draw_vert(1, 0, 1.0, 0.0);
+	draw_vert(2, 0, 1.0, 1.0);
+	draw_vert(3, 0, 0.0, 1.0);
+	GX_End();
+}
+
+/****************************************************************************
+ * StartGX
+ ****************************************************************************/
+void GX_Start(u16 width, u16 height, s16 haspect, s16 vaspect) {
+	static bool inited = false;
+
+	Mtx p;
+	GXColor gxbackground = { 0, 0, 0, 0xff };
+
+	/*** Set new aspect ***/
+	square[0] = square[9] = -haspect;
+	square[3] = square[6] = haspect;
+	square[1] = square[4] = vaspect;
+	square[7] = square[10] = -vaspect;
+
+	/*** Allocate 32byte aligned texture memory ***/
+	texturesize = (width * height) * 2;
+	if (texturemem)
+		free (texturemem);
+
+	texturemem = (u8 *) memalign(32, texturesize);
+
+	memset(texturemem, 0, texturesize);
+
+	/*** Setup for first call to scaler ***/
+	oldvwidth = oldvheight = -1;
+
+	if (inited)
+		return;
+
+	inited = true;
+
+	/*** Clear out FIFO area ***/
+	memset(gp_fifo, 0, DEFAULT_FIFO_SIZE);
+
+	/*** Initialise GX ***/
+	GX_Init(gp_fifo, DEFAULT_FIFO_SIZE);
+	GX_SetCopyClear(gxbackground, 0x00ffffff);
+
+	GX_SetViewport(0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
+	GX_SetDispCopyYScale((f32) vmode->xfbHeight / (f32) vmode->efbHeight);
+	GX_SetScissor(0, 0, vmode->fbWidth, vmode->efbHeight);
+	GX_SetDispCopySrc(0, 0, vmode->fbWidth, vmode->efbHeight);
+	GX_SetDispCopyDst(vmode->fbWidth, vmode->xfbHeight);
+	GX_SetCopyFilter(vmode->aa, vmode->sample_pattern, GX_TRUE,
+						vmode->vfilter);
+	GX_SetFieldMode(vmode->field_rendering,
+					((vmode->viHeight == 2 * vmode->xfbHeight) ?
+					GX_ENABLE : GX_DISABLE));
+	GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
+	GX_SetCullMode(GX_CULL_NONE);
+	GX_CopyDisp(xfb[whichfb ^ 1], GX_TRUE);
+	GX_SetDispCopyGamma(GX_GM_1_0);
+
+	guPerspective(p, 60, 1.33f, 10.0f, 1000.0f);
+	GX_LoadProjectionMtx(p, GX_PERSPECTIVE);
+
+	GX_Flush();
+}
+
+/****************************************************************************
+* GX_Render
+*
+* Pass in a buffer, width and height to update as a tiled RGB565 texture
+****************************************************************************/
+void GX_Render(u16 width, u16 height, u8 *buffer, u16 pitch) {
+	u16 h, w;
+	u64 *dst = (u64 *) texturemem;
+	u64 *src1 = (u64 *) buffer;
+	u64 *src2 = (u64 *) (buffer + pitch);
+	u64 *src3 = (u64 *) (buffer + (pitch * 2));
+	u64 *src4 = (u64 *) (buffer + (pitch * 3));
+	u16 rowpitch = (pitch >> 3) * 3 + pitch % 8;
+
+	vwidth = width;
+	vheight = height;
+
+	whichfb ^= 1;
+
+	if ((oldvheight != vheight) || (oldvwidth != vwidth)) {
+		/** Update scaling **/
+		oldvwidth = vwidth;
+		oldvheight = vheight;
+		draw_init();
+		memset(&view, 0, sizeof(Mtx));
+		guLookAt(view, &cam.pos, &cam.up, &cam.view);
+		GX_SetViewport(0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
+	}
+
+	GX_InvVtxCache();
+	GX_InvalidateTexAll();
+	GX_SetTevOp(GX_TEVSTAGE0, GX_DECAL);
+	GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
+
+	for (h = 0; h < vheight; h += 4) {
+		for (w = 0; w < (vwidth >> 2); w++) {
+			*dst++ = *src1++;
+			*dst++ = *src2++;
+			*dst++ = *src3++;
+			*dst++ = *src4++;
+		}
+
+		src1 += rowpitch;
+		src2 += rowpitch;
+		src3 += rowpitch;
+		src4 += rowpitch;
+	}
+
+	DCFlushRange(texturemem, texturesize);
+
+	GX_SetNumChans(1);
+	GX_LoadTexObj(&texobj, GX_TEXMAP0);
+
+	draw_square(view);
+
+	GX_DrawDone();
+
+	GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
+	GX_SetColorUpdate(GX_TRUE);
+	GX_CopyDisp(xfb[whichfb], GX_TRUE);
+	GX_Flush();
+
+	VIDEO_SetNextFramebuffer(xfb[whichfb]);
+	VIDEO_Flush();
+}
+
+/****************************************************************************
+ * GX_StartYUV - Initialize GX for given width/height.
+ ****************************************************************************/
+void GX_StartYUV(u16 width, u16 height, s16 haspect, s16 vaspect) {
+	static bool inited = false;
+
+	Mtx p;
+	GXColor gxbackground = { 0, 0, 0, 0xff };
+
+	/*** Set new aspect ***/
+	square[0] = square[9] = -haspect;
+	square[3] = square[6] = haspect;
+	square[1] = square[4] = vaspect;
+	square[7] = square[10] = -vaspect;
+
+	/*** Allocate 32byte aligned texture memory ***/
+	Ytexsize = (width*height);
+	UVtexsize = (width*height)/4;
+	if (Ytexture)
+		free (Ytexture);
+	if (Utexture)
+		free (Utexture);
+	if (Vtexture)
+		free (Vtexture);
+
+	Ytexture = (u8 *) memalign(32,Ytexsize);
+	Utexture = (u8 *) memalign(32,UVtexsize);
+	Vtexture = (u8 *) memalign(32,UVtexsize);
+
+	memset(Ytexture, 0, Ytexsize);
+	memset(Utexture, 0, UVtexsize);
+	memset(Vtexture, 0, UVtexsize);
+
+	/*** Setup for first call to scaler ***/
+	oldvwidth = oldvheight = -1;
+
+	if (inited)
+		return;
+
+	inited = true;
+
+	/*** Clear out FIFO area ***/
+	memset(gp_fifo, 0, DEFAULT_FIFO_SIZE);
+
+	/*** Initialise GX ***/
+	GX_Init(gp_fifo, DEFAULT_FIFO_SIZE);
+	GX_SetCopyClear(gxbackground, 0x00ffffff);
+
+	GX_SetViewport(0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
+	GX_SetDispCopyYScale((f32) vmode->xfbHeight / (f32) vmode->efbHeight);
+	GX_SetScissor(0, 0, vmode->fbWidth, vmode->efbHeight);
+	GX_SetDispCopySrc(0, 0, vmode->fbWidth, vmode->efbHeight);
+	GX_SetDispCopyDst(vmode->fbWidth, vmode->xfbHeight);
+	GX_SetCopyFilter(vmode->aa, vmode->sample_pattern, GX_TRUE, vmode->vfilter);
+	GX_SetFieldMode(vmode->field_rendering, ((vmode->viHeight == 2 * vmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
+	GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
+	GX_SetCullMode(GX_CULL_NONE);
+	GX_CopyDisp(xfb[whichfb ^ 1], GX_TRUE);
+	GX_SetDispCopyGamma(GX_GM_1_0);
+
+	guPerspective(p, 60, 1.33f, 10.0f, 1000.0f);
+	GX_LoadProjectionMtx(p, GX_PERSPECTIVE);
+
+	GX_Flush();
+}
+
+/****************************************************************************
+ * draw_initYUV - Internal function to setup TEV for YUV->RGB conversion.
+ ****************************************************************************/
+void draw_initYUV(void){
+	//Setup TEV
+	GX_SetNumChans (1);
+	GX_SetNumTexGens (3);
+	GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
+	GX_SetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX1, GX_IDENTITY);
+#if 0
+	//Y'UV->RGB formulation 1
+	GX_SetNumTevStages(12);
+	GX_SetTevKColor(GX_KCOLOR0, (GXColor) {255,   0,   0, 255});	//R
+	GX_SetTevKColor(GX_KCOLOR1, (GXColor) {  0,   0, 255, 255});	//B
+	GX_SetTevKColor(GX_KCOLOR2, (GXColor) {145,  74,   0, 255});	// {1.13982/2, 0.5806/2, 0}
+	GX_SetTevKColor(GX_KCOLOR3, (GXColor) {  0,  25, 130, 255});	// {0, 0.39465/4, 2.03211/4}
+	//Stage 0: TEVREG0 <- { 0, 2Um, 2Up }
+		GX_SetTevKColorSel(GX_TEVSTAGE0,GX_TEV_KCSEL_K1);
+		GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD1, GX_TEXMAP1,GX_COLOR0A0);
+		GX_SetTevColorIn (GX_TEVSTAGE0, GX_CC_RASC, GX_CC_KONST, GX_CC_TEXC, GX_CC_ZERO);
+		GX_SetTevColorOp (GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_SUBHALF, GX_CS_SCALE_2, GX_ENABLE, GX_TEVREG0);
+		GX_SetTevAlphaIn (GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 1: TEVREG1 <- { 0, 2Up, 2Um }
+		GX_SetTevKColorSel(GX_TEVSTAGE1,GX_TEV_KCSEL_K1);
+		GX_SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD1, GX_TEXMAP1,GX_COLOR0A0);
+		GX_SetTevColorIn (GX_TEVSTAGE1, GX_CC_KONST, GX_CC_RASC, GX_CC_TEXC, GX_CC_ZERO);
+		GX_SetTevColorOp (GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_SUBHALF, GX_CS_SCALE_2, GX_ENABLE, GX_TEVREG1);
+		GX_SetTevAlphaIn (GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 2: TEVREG2 <- { Vp, Vm, 0 }
+		GX_SetTevKColorSel(GX_TEVSTAGE2,GX_TEV_KCSEL_K0);
+		GX_SetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD1, GX_TEXMAP2,GX_COLOR0A0);
+		GX_SetTevColorIn (GX_TEVSTAGE2, GX_CC_RASC, GX_CC_KONST, GX_CC_TEXC, GX_CC_ZERO);
+		GX_SetTevColorOp (GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_SUBHALF, GX_CS_SCALE_1, GX_ENABLE, GX_TEVREG2);
+		GX_SetTevAlphaIn (GX_TEVSTAGE2, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 3: TEVPREV <- { (Vm), (Vp), 0 }
+		GX_SetTevKColorSel(GX_TEVSTAGE3,GX_TEV_KCSEL_K0);
+		GX_SetTevOrder(GX_TEVSTAGE3, GX_TEXCOORD1, GX_TEXMAP2,GX_COLOR0A0);
+		GX_SetTevColorIn (GX_TEVSTAGE3, GX_CC_KONST, GX_CC_RASC, GX_CC_TEXC, GX_CC_ZERO);
+		GX_SetTevColorOp (GX_TEVSTAGE3, GX_TEV_ADD, GX_TB_SUBHALF, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE3, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE3, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 4: TEVPREV <- { (-1.139Vm), (-0.58Vp), 0 }
+		GX_SetTevKColorSel(GX_TEVSTAGE4,GX_TEV_KCSEL_K2);
+		GX_SetTevOrder(GX_TEVSTAGE4, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE4, GX_CC_ZERO, GX_CC_KONST, GX_CC_CPREV, GX_CC_ZERO);
+		GX_SetTevColorOp (GX_TEVSTAGE4, GX_TEV_SUB, GX_TB_ZERO, GX_CS_SCALE_2, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE4, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE4, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 5: TEVPREV <- { (Y') -1.139Vm, (Y') -0.58Vp, (Y') }
+		GX_SetTevKColorSel(GX_TEVSTAGE5,GX_TEV_KCSEL_1);
+		GX_SetTevOrder(GX_TEVSTAGE5, GX_TEXCOORD0, GX_TEXMAP0,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE5, GX_CC_ZERO, GX_CC_ONE, GX_CC_TEXC, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE5, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE5, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE5, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 6: TEVPREV <- {	Y' -1.139Vm (+1.139/2Vp), Y' -0.58Vp (+0.58/2Vm), Y' }
+		GX_SetTevKColorSel(GX_TEVSTAGE6,GX_TEV_KCSEL_K2);
+		GX_SetTevOrder(GX_TEVSTAGE6, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE6, GX_CC_ZERO, GX_CC_KONST, GX_CC_C2, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE6, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE6, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE6, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 7: TEVPREV <- {	Y' -1.139Vm (+1.139Vp), Y' -0.58Vp (+0.58Vm), Y' } = {	Y' (+1.139V), Y' (-0.58V), Y' }
+		GX_SetTevKColorSel(GX_TEVSTAGE7,GX_TEV_KCSEL_K2);
+		GX_SetTevOrder(GX_TEVSTAGE7, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE7, GX_CC_ZERO, GX_CC_KONST, GX_CC_C2, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE7, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE7, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE7, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 8: TEVPREV <- {	Y' +1.139V, Y' -0.58V (-.394/2Up), Y' (-2.032/2Um)}
+		GX_SetTevKColorSel(GX_TEVSTAGE8,GX_TEV_KCSEL_K3);
+		GX_SetTevOrder(GX_TEVSTAGE8, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE8, GX_CC_ZERO, GX_CC_KONST, GX_CC_C1, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE8, GX_TEV_SUB, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE8, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE8, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 9: TEVPREV <- { Y' +1.139V, Y' -0.58V (-.394Up), Y' (-2.032Um)}
+		GX_SetTevKColorSel(GX_TEVSTAGE9,GX_TEV_KCSEL_K3);
+		GX_SetTevOrder(GX_TEVSTAGE9, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE9, GX_CC_ZERO, GX_CC_KONST, GX_CC_C1, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE9, GX_TEV_SUB, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE9, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE9, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 10: TEVPREV <- { Y' +1.139V, Y' -0.58V -.394Up (+.394/2Um), Y' -2.032Um (+2.032/2Up)}
+		GX_SetTevKColorSel(GX_TEVSTAGE10,GX_TEV_KCSEL_K3);
+		GX_SetTevOrder(GX_TEVSTAGE10, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE10, GX_CC_ZERO, GX_CC_KONST, GX_CC_C0, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE10, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE10, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE10, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 11: TEVPREV <- { Y' +1.139V, Y' -0.58V -.394Up (+.394Um), Y' -2.032Um (+2.032Up)} = { Y' +1.139V, Y' -0.58V -.394U, Y' +2.032U}
+		GX_SetTevKColorSel(GX_TEVSTAGE11,GX_TEV_KCSEL_K3);
+		GX_SetTevOrder(GX_TEVSTAGE11, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE11, GX_CC_ZERO, GX_CC_KONST, GX_CC_C0, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE11, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+		GX_SetTevKAlphaSel(GX_TEVSTAGE11,GX_TEV_KASEL_1);
+		GX_SetTevAlphaIn (GX_TEVSTAGE11, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_KONST);
+		GX_SetTevAlphaOp (GX_TEVSTAGE11, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+#else
+	//Y'UV->RGB formulation 2
+	GX_SetNumTevStages(12);
+	GX_SetTevKColor(GX_KCOLOR0, (GXColor) {255,   0,   0,  19});	//R {1, 0, 0, 16*1.164} 
+	GX_SetTevKColor(GX_KCOLOR1, (GXColor) {  0,   0, 255,  42});	//B {0, 0, 1, 0.164}
+	GX_SetTevKColor(GX_KCOLOR2, (GXColor) {204,  104,   0, 255});	// {1.598/2, 0.813/2, 0}
+	GX_SetTevKColor(GX_KCOLOR3, (GXColor) {  0,  25, 129, 255});	// {0, 0.391/4, 2.016/4}
+	//Stage 0: TEVREG0 <- { 0, 2Um, 2Up }; TEVREG0A <- {16*1.164}
+		GX_SetTevKColorSel(GX_TEVSTAGE0,GX_TEV_KCSEL_K1);
+		GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD1, GX_TEXMAP1,GX_COLOR0A0);
+		GX_SetTevColorIn (GX_TEVSTAGE0, GX_CC_RASC, GX_CC_KONST, GX_CC_TEXC, GX_CC_ZERO);
+		GX_SetTevColorOp (GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_SUBHALF, GX_CS_SCALE_2, GX_ENABLE, GX_TEVREG0);
+		GX_SetTevKAlphaSel(GX_TEVSTAGE0,GX_TEV_KASEL_K0_A);
+		GX_SetTevAlphaIn (GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_RASA, GX_CA_KONST, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVREG0);
+	//Stage 1: TEVREG1 <- { 0, 2Up, 2Um }; 
+		GX_SetTevKColorSel(GX_TEVSTAGE1,GX_TEV_KCSEL_K1);
+		GX_SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD1, GX_TEXMAP1,GX_COLOR0A0);
+		GX_SetTevColorIn (GX_TEVSTAGE1, GX_CC_KONST, GX_CC_RASC, GX_CC_TEXC, GX_CC_ZERO);
+		GX_SetTevColorOp (GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_SUBHALF, GX_CS_SCALE_2, GX_ENABLE, GX_TEVREG1);
+		GX_SetTevAlphaIn (GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 2: TEVREG2 <- { Vp, Vm, 0 }
+		GX_SetTevKColorSel(GX_TEVSTAGE2,GX_TEV_KCSEL_K0);
+		GX_SetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD1, GX_TEXMAP2,GX_COLOR0A0);
+		GX_SetTevColorIn (GX_TEVSTAGE2, GX_CC_RASC, GX_CC_KONST, GX_CC_TEXC, GX_CC_ZERO);
+		GX_SetTevColorOp (GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_SUBHALF, GX_CS_SCALE_1, GX_ENABLE, GX_TEVREG2);
+		GX_SetTevAlphaIn (GX_TEVSTAGE2, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 3: TEVPREV <- { (Vm), (Vp), 0 }
+		GX_SetTevKColorSel(GX_TEVSTAGE3,GX_TEV_KCSEL_K0);
+		GX_SetTevOrder(GX_TEVSTAGE3, GX_TEXCOORD1, GX_TEXMAP2,GX_COLOR0A0);
+		GX_SetTevColorIn (GX_TEVSTAGE3, GX_CC_KONST, GX_CC_RASC, GX_CC_TEXC, GX_CC_ZERO);
+		GX_SetTevColorOp (GX_TEVSTAGE3, GX_TEV_ADD, GX_TB_SUBHALF, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE3, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE3, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 4: TEVPREV <- { (-1.598Vm), (-0.813Vp), 0 }; TEVPREVA <- {Y' - 16*1.164}
+		GX_SetTevKColorSel(GX_TEVSTAGE4,GX_TEV_KCSEL_K2);
+		GX_SetTevOrder(GX_TEVSTAGE4, GX_TEXCOORD0, GX_TEXMAP0,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE4, GX_CC_ZERO, GX_CC_KONST, GX_CC_CPREV, GX_CC_ZERO);
+		GX_SetTevColorOp (GX_TEVSTAGE4, GX_TEV_SUB, GX_TB_ZERO, GX_CS_SCALE_2, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevKAlphaSel(GX_TEVSTAGE4,GX_TEV_KASEL_1);
+		GX_SetTevAlphaIn (GX_TEVSTAGE4, GX_CA_ZERO, GX_CA_KONST, GX_CA_A0, GX_CA_TEXA);
+		GX_SetTevAlphaOp (GX_TEVSTAGE4, GX_TEV_SUB, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+	//Stage 5: TEVPREV <- { -1.598Vm (+1.139/2Vp), -0.813Vp +0.813/2Vm), 0 }; TEVREG1A <- {Y' -16*1.164 - Y'*0.164} = {(Y'-16)*1.164}
+		GX_SetTevKColorSel(GX_TEVSTAGE5,GX_TEV_KCSEL_K2);
+		GX_SetTevOrder(GX_TEVSTAGE5, GX_TEXCOORD0, GX_TEXMAP0,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE5, GX_CC_ZERO, GX_CC_KONST, GX_CC_C2, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE5, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevKAlphaSel(GX_TEVSTAGE5,GX_TEV_KASEL_K1_A);
+		GX_SetTevAlphaIn (GX_TEVSTAGE5, GX_CA_ZERO, GX_CA_KONST, GX_CA_TEXA, GX_CA_APREV);
+		GX_SetTevAlphaOp (GX_TEVSTAGE5, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVREG1);
+	//Stage 6: TEVPREV <- {	-1.598Vm (+1.598Vp), -0.813Vp (+0.813Vm), 0 } = {	(+1.598V), (-0.813V), 0 }
+		GX_SetTevKColorSel(GX_TEVSTAGE6,GX_TEV_KCSEL_K2);
+		GX_SetTevOrder(GX_TEVSTAGE6, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE6, GX_CC_ZERO, GX_CC_KONST, GX_CC_C2, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE6, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE6, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE6, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 7: TEVPREV <- {	((Y'-16)*1.164) +1.598V, ((Y'-16)*1.164) -0.813V, ((Y'-16)*1.164) }
+		GX_SetTevKColorSel(GX_TEVSTAGE7,GX_TEV_KCSEL_1);
+		GX_SetTevOrder(GX_TEVSTAGE7, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE7, GX_CC_ZERO, GX_CC_ONE, GX_CC_A1, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE7, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE7, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE7, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 8: TEVPREV <- {	(Y'-16)*1.164 +1.598V, (Y'-16)*1.164 -0.813V (-.394/2Up), (Y'-16)*1.164 (-2.032/2Um)}
+		GX_SetTevKColorSel(GX_TEVSTAGE8,GX_TEV_KCSEL_K3);
+		GX_SetTevOrder(GX_TEVSTAGE8, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE8, GX_CC_ZERO, GX_CC_KONST, GX_CC_C1, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE8, GX_TEV_SUB, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE8, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE8, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 9: TEVPREV <- { (Y'-16)*1.164 +1.598V, (Y'-16)*1.164 -0.813V (-.394Up), (Y'-16)*1.164 (-2.032Um)}
+		GX_SetTevKColorSel(GX_TEVSTAGE9,GX_TEV_KCSEL_K3);
+		GX_SetTevOrder(GX_TEVSTAGE9, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE9, GX_CC_ZERO, GX_CC_KONST, GX_CC_C1, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE9, GX_TEV_SUB, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE9, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE9, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 10: TEVPREV <- { (Y'-16)*1.164 +1.598V, (Y'-16)*1.164 -0.813V -.394Up (+.394/2Um), (Y'-16)*1.164 -2.032Um (+2.032/2Up)}
+		GX_SetTevKColorSel(GX_TEVSTAGE10,GX_TEV_KCSEL_K3);
+		GX_SetTevOrder(GX_TEVSTAGE10, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE10, GX_CC_ZERO, GX_CC_KONST, GX_CC_C0, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE10, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_DISABLE, GX_TEVPREV);
+		GX_SetTevAlphaIn (GX_TEVSTAGE10, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
+		GX_SetTevAlphaOp (GX_TEVSTAGE10, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+	//Stage 11: TEVPREV <- { (Y'-16)*1.164 +1.598V, (Y'-16)*1.164 -0.813V -.394Up (+.394Um), (Y'-16)*1.164 -2.032Um (+2.032Up)} = { (Y'-16)*1.164 +1.139V, (Y'-16)*1.164 -0.58V -.394U, (Y'-16)*1.164 +2.032U}
+		GX_SetTevKColorSel(GX_TEVSTAGE11,GX_TEV_KCSEL_K3);
+		GX_SetTevOrder(GX_TEVSTAGE11, GX_TEXCOORDNULL, GX_TEXMAP_NULL,GX_COLORNULL);
+		GX_SetTevColorIn (GX_TEVSTAGE11, GX_CC_ZERO, GX_CC_KONST, GX_CC_C0, GX_CC_CPREV);
+		GX_SetTevColorOp (GX_TEVSTAGE11, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+		GX_SetTevKAlphaSel(GX_TEVSTAGE11,GX_TEV_KASEL_1);
+		GX_SetTevAlphaIn (GX_TEVSTAGE11, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_KONST);
+		GX_SetTevAlphaOp (GX_TEVSTAGE11, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
+#endif //Y'UV->RGB formulation 2
+
+	//Setup blending
+	GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR); //Fix src alpha
+	GX_SetColorUpdate(GX_ENABLE);
+	GX_SetAlphaUpdate(GX_ENABLE);
+
+	//Setup vertex description/format
+	GX_ClearVtxDesc();
+	GX_SetVtxDesc(GX_VA_POS, GX_INDEX8);
+	GX_SetVtxDesc(GX_VA_CLR0, GX_INDEX8);
+	GX_SetVtxDesc(GX_VA_TEX0, GX_INDEX8);
+	GX_SetVtxDesc(GX_VA_TEX1, GX_INDEX8);
+	GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
+	GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
+	GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_U8, 0);
+	GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX1, GX_TEX_ST, GX_U8, 0);
+
+	GX_SetArray(GX_VA_POS, square, 3 * sizeof(s16));
+	GX_SetArray(GX_VA_CLR0, colors, sizeof(GXColor));
+	GX_SetArray(GX_VA_TEX0, texcoords, 2 * sizeof(u8));
+	GX_SetArray(GX_VA_TEX1, texcoords, 2 * sizeof(u8));
+
+	//init YUV texture objects
+	GX_InitTexObj(&YtexObj, Ytexture, (u16) Ywidth, (u16) Yheight, GX_TF_I8, GX_CLAMP, GX_CLAMP, GX_FALSE); 
+	GX_InitTexObj(&UtexObj, Utexture, (u16) UVwidth, (u16) UVheight, GX_TF_I8, GX_CLAMP, GX_CLAMP, GX_FALSE); 
+	GX_InitTexObj(&VtexObj, Vtexture, (u16) UVwidth, (u16) UVheight, GX_TF_I8, GX_CLAMP, GX_CLAMP, GX_FALSE); 
+}
+
+/****************************************************************************
+* GX_Render - Pass in 3 buffers (Y',U,V planes) and their respective pitches.
+****************************************************************************/
+void GX_RenderYUV(u16 width, u16 height, u8 *buffer[3], u16 *pitch) {
+	Mtx m, mv;
+	u16 h, w;
+	u64 *Ydst = (u64 *) Ytexture;
+	u64 *Udst = (u64 *) Utexture;
+	u64 *Vdst = (u64 *) Vtexture;
+	u64 *Ysrc1 = (u64 *) buffer[0];
+	u64 *Ysrc2 = (u64 *) (buffer[0] + pitch[0]);
+	u64 *Ysrc3 = (u64 *) (buffer[0] + (pitch[0] * 2));
+	u64 *Ysrc4 = (u64 *) (buffer[0] + (pitch[0] * 3));
+	u64 *Usrc1 = (u64 *) buffer[1];
+	u64 *Usrc2 = (u64 *) (buffer[1] + pitch[1]);
+	u64 *Usrc3 = (u64 *) (buffer[1] + (pitch[1] * 2));
+	u64 *Usrc4 = (u64 *) (buffer[1] + (pitch[1] * 3));
+	u64 *Vsrc1 = (u64 *) buffer[2];
+	u64 *Vsrc2 = (u64 *) (buffer[2] + pitch[2]);
+	u64 *Vsrc3 = (u64 *) (buffer[2] + (pitch[2] * 2));
+	u64 *Vsrc4 = (u64 *) (buffer[2] + (pitch[2] * 3));
+	u16 Yrowpitch = (pitch[0] >> 3) * 3 + pitch[0] % 8;
+	u16 UVrowpitch = (pitch[1] >> 3) * 3 + pitch[1] % 8;
+
+	vwidth = width;
+	Ywidth = vwidth;
+	UVwidth = vwidth>>1;
+	vheight = height;
+	Yheight = vheight;
+	UVheight = vheight>>1;
+
+	whichfb ^= 1;
+
+	if ((oldvheight != vheight) || (oldvwidth != vwidth)) {
+		/** Update scaling **/
+		oldvwidth = vwidth;
+		oldvheight = vheight;
+		draw_initYUV();
+		memset(&view, 0, sizeof(Mtx));
+		guLookAt(view, &cam.pos, &cam.up, &cam.view);
+		guMtxIdentity(m);
+		guMtxTransApply(m, m, 0, 0, -100);
+		guMtxConcat(view, m, mv);
+		GX_LoadPosMtxImm(mv, GX_PNMTX0);
+		GX_SetViewport(0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
+	}
+
+	GX_InvVtxCache();
+	GX_InvalidateTexAll();
+
+	//Convert YUV frame to GX textures
+	//Convert Y plane to texture
+	for (h = 0; h < vheight; h+=4) {
+		for (w = 0; w < (vwidth >>3); w++) {
+			*Ydst++ = *Ysrc1++;
+			*Ydst++ = *Ysrc2++;
+			*Ydst++ = *Ysrc3++;
+			*Ydst++ = *Ysrc4++;
+		}
+		Ysrc1 += Yrowpitch;
+		Ysrc2 += Yrowpitch;
+		Ysrc3 += Yrowpitch;
+		Ysrc4 += Yrowpitch;
+	}
+	//Convert U&V planes to textures
+	for (h = 0; h < vheight >> 1; h+=4) {
+		for (w = 0; w < (vwidth >> 4); w++) {
+			*Udst++ = *Usrc1++;
+			*Udst++ = *Usrc2++;
+			*Udst++ = *Usrc3++;
+			*Udst++ = *Usrc4++;
+			*Vdst++ = *Vsrc1++;
+			*Vdst++ = *Vsrc2++;
+			*Vdst++ = *Vsrc3++;
+			*Vdst++ = *Vsrc4++;
+		}
+		Usrc1 += UVrowpitch;
+		Usrc2 += UVrowpitch;
+		Usrc3 += UVrowpitch;
+		Usrc4 += UVrowpitch;
+		Vsrc1 += UVrowpitch;
+		Vsrc2 += UVrowpitch;
+		Vsrc3 += UVrowpitch;
+		Vsrc4 += UVrowpitch;
+	}
+
+	DCFlushRange(Ytexture, Ytexsize);
+	DCFlushRange(Utexture, UVtexsize);
+	DCFlushRange(Vtexture, UVtexsize);
+
+	GX_LoadTexObj(&YtexObj, GX_TEXMAP0);	// MAP0 <- Y
+	GX_LoadTexObj(&UtexObj, GX_TEXMAP1);	// MAP1 <- U	
+	GX_LoadTexObj(&VtexObj, GX_TEXMAP2);	// MAP2 <- V
+
+	//render textures
+	GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
+		GX_Position1x8(0); GX_Color1x8(0); GX_TexCoord1x8(0); GX_TexCoord1x8(0);
+		GX_Position1x8(1); GX_Color1x8(0); GX_TexCoord1x8(1); GX_TexCoord1x8(1);
+		GX_Position1x8(2); GX_Color1x8(0); GX_TexCoord1x8(2); GX_TexCoord1x8(2);
+		GX_Position1x8(3); GX_Color1x8(0); GX_TexCoord1x8(3); GX_TexCoord1x8(3);
+	GX_End();
+
+	GX_SetColorUpdate(GX_TRUE);
+	GX_CopyDisp(xfb[whichfb], GX_TRUE);
+	GX_DrawDone();
+
+	VIDEO_SetNextFramebuffer(xfb[whichfb]);
+	VIDEO_Flush();
+}
+
+#ifdef __cplusplus
+}
+#endif
+
Index: osdep/gx_supp.h
===================================================================
--- osdep/gx_supp.h	(revision 0)
+++ osdep/gx_supp.h	(revision 0)
@@ -0,0 +1,48 @@
+/****************************************************************************
+*   gx_supp.h - Generic GX Scaler 
+*   softdev 2007
+*   dhewg 2008
+*   sepp256 2008 - Coded YUV->RGB conversion in TEV.
+*
+*   This program is free software; you can redistribute it and/or modify
+*   it under the terms of the GNU General Public License as published by
+*   the Free Software Foundation; either version 2 of the License, or
+*   (at your option) any later version.
+*
+*   This program is distributed in the hope that it will be useful,
+*   but WITHOUT ANY WARRANTY; without even the implied warranty of
+*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*   GNU General Public License for more details.
+*
+*   You should have received a copy of the GNU General Public License along
+*   with this program; if not, write to the Free Software Foundation, Inc.,
+*   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* NGC GX Video Functions
+*
+* These are pretty standard functions to setup and use GX scaling.
+****************************************************************************/
+#ifndef _WII_GX_SUPP_H_
+#define _WII_GX_SUPP_H_
+
+#include <gccore.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern GXRModeObj *vmode;
+
+void GX_InitVideo();
+void GX_SetCamPosZ(float f);
+
+void GX_Start(u16 width, u16 height, s16 haspect, s16 vaspect);
+void GX_Render(u16 width, u16 height, u8 *buffer, u16 pitch);
+void GX_StartYUV(u16 width, u16 height, s16 haspect, s16 vaspect);
+void GX_RenderYUV(u16 width, u16 height, u8 *buffer[3], u16 pitch[3]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: libmenu/menu_param.c
===================================================================
--- libmenu/menu_param.c	(revision 27458)
+++ libmenu/menu_param.c	(working copy)
@@ -3,7 +3,9 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#ifndef GEKKO
 #include <dirent.h>
+#endif
 #include <errno.h>
 #include <string.h>
 #include <sys/types.h>
Index: libmenu/menu_console.c
===================================================================
--- libmenu/menu_console.c	(revision 27458)
+++ libmenu/menu_console.c	(working copy)
@@ -222,7 +222,7 @@
 }
 
 static void check_child(menu_t* menu) {
-#ifndef __MINGW32__
+#if !defined (__MINGW32__) && !defined (GEKKO)
   fd_set rfd;
   struct timeval tv;
   int max_fd = mpriv->child_fd[2] > mpriv->child_fd[1] ? mpriv->child_fd[2] :
@@ -276,7 +276,7 @@
 #define close_pipe(pipe) close(pipe[0]); close(pipe[1])
 
 static int run_shell_cmd(menu_t* menu, char* cmd) {
-#ifndef __MINGW32__
+#if !defined (__MINGW32__) && !defined (GEKKO)
   int in[2],out[2],err[2];
 
   mp_msg(MSGT_GLOBAL,MSGL_INFO,MSGTR_LIBMENU_ConsoleRun,cmd);
Index: libmenu/menu_filesel.c
===================================================================
--- libmenu/menu_filesel.c	(revision 27458)
+++ libmenu/menu_filesel.c	(working copy)
@@ -1,7 +1,9 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#ifndef GEKKO
 #include <dirent.h>
+#endif
 #include <errno.h>
 #include <string.h>
 #include <sys/types.h>
@@ -451,6 +453,7 @@
 #endif
       path = wd;
   }
+#ifndef GEKKO
   if (path[0] != '/') {
     if(path[strlen(path)-1] != '/')
       snprintf(b,sizeof(b),"%s/%s/",wd,path);
@@ -474,6 +477,12 @@
       }
     }
   }
+#else
+  if (path[strlen(path)-1]!='/') {
+    sprintf(b,"%s/",path);
+    path = b;
+  }
+#endif
   r = open_dir(menu,path);
 
   return r;
Index: subreader.c
===================================================================
--- subreader.c	(revision 27458)
+++ subreader.c	(working copy)
@@ -13,9 +13,12 @@
 #include <ctype.h>
 
 #include <sys/types.h>
+#include "config.h"
+
+#ifndef GEKKO
 #include <dirent.h>
+#endif
 
-#include "config.h"
 #include "mp_msg.h"
 #include "subreader.h"
 #include "stream/stream.h"
Index: command.c
===================================================================
--- command.c	(revision 27458)
+++ command.c	(working copy)
@@ -3101,7 +3101,7 @@
 	    break;
 
 	case MP_CMD_RUN:
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(GEKKO)
 	    if (!fork()) {
 		execl("/bin/sh", "sh", "-c", cmd->args[0].v.s, NULL);
 		exit(0);
Index: mp_msg.c
===================================================================
--- mp_msg.c	(revision 27458)
+++ mp_msg.c	(working copy)
@@ -21,6 +21,10 @@
 #endif
 #include "mp_msg.h"
 
+#ifdef GEKKO
+#include "osdep/log_console.h"
+#endif
+
 /* maximum message length of mp_msg */
 #define MSGSIZE_MAX 3072
 
@@ -219,7 +223,18 @@
         print_msg_module(stream, mod);
     set_msg_color(stream, lev);
     header = tmp[strlen(tmp)-1] == '\n' || tmp[strlen(tmp)-1] == '\r';
+
+#ifdef GEKKO
+	if (mod == MSGT_STATUSLINE)
+		log_console_enable_log(false);
+#endif
  
     fprintf(stream, "%s", tmp);
     fflush(stream);
+
+#ifdef GEKKO
+	if (mod == MSGT_STATUSLINE)
+		log_console_enable_log(true);
+#endif
+ 
 }
Index: libavutil/internal.h
===================================================================
--- libavutil/internal.h	(revision 14717)
+++ libavutil/internal.h	(working copy)
@@ -272,10 +272,15 @@
 }
 
 #ifndef HAVE_LLRINT
+#ifndef GEKKO
 static av_always_inline av_const long long llrint(double x)
 {
     return rint(x);
 }
+#else
+// WTFBBQ broken libc, eh?
+#define llrint(x) rint(x)
+#endif
 #endif /* HAVE_LLRINT */
 
 #ifndef HAVE_LRINT
Index: libavformat/img2.c
===================================================================
--- libavformat/img2.c	(revision 14717)
+++ libavformat/img2.c	(working copy)
@@ -22,7 +22,10 @@
 
 #include "libavutil/avstring.h"
 #include "avformat.h"
+
+#ifndef GEKKO
 #include <strings.h>
+#endif
 
 typedef struct {
     int img_first;
