gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r11974: merge in haiku support from


From: Rob Savoye
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11974: merge in haiku support from branch.
Date: Thu, 25 Feb 2010 20:34:11 -0700
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 11974 [merge]
committer: Rob Savoye <address@hidden>
branch nick: trunk
timestamp: Thu 2010-02-25 20:34:11 -0700
message:
  merge in haiku support from branch.
added:
  gui/am-frag/haiku.am
  gui/gui_haiku.cpp
  gui/haiku.cpp
  gui/haiku_agg_glue.cpp
  gui/haiku_agg_glue.h
  gui/haikusup.h
  libbase/SharedMemHaiku.cpp
  libmedia/haiku/
  libmedia/haiku/AudioDecoderHaiku.cpp
  libmedia/haiku/AudioDecoderHaiku.h
  libmedia/haiku/AudioInputHaiku.cpp
  libmedia/haiku/AudioInputHaiku.h
  libmedia/haiku/MediaHandlerHaiku.cpp
  libmedia/haiku/MediaHandlerHaiku.h
  libmedia/haiku/MediaParserHaiku.cpp
  libmedia/haiku/MediaParserHaiku.h
  libmedia/haiku/VideoConverterHaiku.cpp
  libmedia/haiku/VideoConverterHaiku.h
  libmedia/haiku/VideoDecoderHaiku.cpp
  libmedia/haiku/VideoDecoderHaiku.h
  libmedia/haiku/VideoInputHaiku.cpp
  libmedia/haiku/VideoInputHaiku.h
  libmedia/haiku/adipe.h
  libsound/mkit/
  libsound/mkit/sound_handler_mkit.cpp
  libsound/mkit/sound_handler_mkit.h
modified:
  .bzrignore
  Makefile.am
  configure.ac
  gui/Kde4GlueAgg.cpp
  gui/Makefile.am
  gui/Player.cpp
  gui/aos4.cpp
  gui/fltk_glue_agg.cpp
  gui/gnash.in
  gui/gtk_glue_agg.cpp
  gui/gtk_glue_agg_xv.cpp
  gui/gui.h
  gui/kde_glue_agg.cpp
  gui/riscos_glue_agg.cpp
  libbase/Makefile.am
  libbase/SharedMem.cpp
  libbase/SharedMem.h
  libbase/rc.cpp
  libbase/rc.h
  libbase/utf8.h
  libbase/utility.h
  libcore/FreetypeGlyphsProvider.cpp
  libcore/Makefile.am
  libcore/asobj/String_as.cpp
  libcore/asobj/flash/text/TextField_as.h
  libcore/vm/ASHandlers.cpp
  libmedia/Makefile.am
  libmedia/ffmpeg/AudioInputFfmpeg.cpp
  libmedia/ffmpeg/AudioInputFfmpeg.h
  libmedia/ffmpeg/MediaParserFfmpeg.cpp
  libmedia/ffmpeg/MediaParserFfmpeg.h
  libmedia/ffmpeg/VideoInputFfmpeg.cpp
  libmedia/ffmpeg/VideoInputFfmpeg.h
  libmedia/gst/VideoConverterGst.cpp
  libmedia/gst/VideoConverterGst.h
  libsound/Makefile.am
  libsound/aos4/sound_handler_ahi.h
  libsound/sound_handler.h
  macros/agg.m4
  macros/ffmpeg.m4
  macros/freetype.m4
  macros/incllist
  macros/libslist
  macros/pthreads.m4
  packaging/deb.am
  packaging/debian/rules
=== modified file '.bzrignore'
--- a/.bzrignore        2010-01-31 09:33:44 +0000
+++ b/.bzrignore        2010-02-23 16:26:50 +0000
@@ -36,6 +36,7 @@
 gui/gnash
 gui/gtk-gnash
 gui/kde-gnash
+gui/haiku-gnash
 gui/sdl-gnash
 gui/fb-gnash
 gui/riscos-gnash

=== modified file 'Makefile.am'
--- a/Makefile.am       2010-02-04 00:01:07 +0000
+++ b/Makefile.am       2010-02-23 17:06:43 +0000
@@ -247,6 +247,9 @@
        @echo " XFT_CFLAGS is $(XFT_CFLAGS)"
        @echo " XFT_LIBS is $(XFT_LIBS)"
 endif
+if BUILD_HAIKU_GUI
+       @echo " HAIKU_LIBS is $(HAIKU_LIBS)"
+endif
 if BUILD_GTK_GUI
        @echo " GTK2_CFLAGS is $(GTK2_CFLAGS)"
        @echo " GTK2_LIBS is $(GTK2_LIBS)"
@@ -406,6 +409,9 @@
 if BUILD_AMIGAOS4_GUI
        @echo " Supported GUI: AMIGAOS4"
 endif
+if BUILD_HAIKU_GUI
+       @echo " Supported GUI: Haiku"
+endif
 if XPCOM
        @echo " XPCOM support for Mozilla/Firefox"
 endif

=== modified file 'configure.ac'
--- a/configure.ac      2010-02-24 21:46:20 +0000
+++ b/configure.ac      2010-02-26 03:34:11 +0000
@@ -102,6 +102,10 @@
     DEFAULT_FLASH_PLATFORM_ID="OS4"
     DEFAULT_FLASH_SYSTEM_OS="AmigaOS4"
     ;;    
+  *-haiku*)
+    DEFAULT_FLASH_PLATFORM_ID="HAIKU"
+    DEFAULT_FLASH_SYSTEM_OS="Haiku"
+    ;;    
   *)
     DEFAULT_FLASH_PLATFORM_ID="UNK"
     DEFAULT_FLASH_SYSTEM_OS="Unknown"
@@ -172,8 +176,13 @@
     amigaos4=yes
     AC_DEFINE([AMIGAOS4_HOST], [1], [this is an AmigaOS4 platform])
     ;;
+  *-*haiku*)
+    haiku=yes
+    AC_DEFINE([HAIKU_HOST], [1], [this is a Haiku platform])
+    ;;
 esac
 
+
 AM_CONDITIONAL(PLUGIN_LINK_UNDEFINED, test x$openbsd_os = xopenbsd)
 AM_CONDITIONAL(WIN32, test x$windows = xyes)
 
@@ -207,7 +216,7 @@
   cross_compiling=yes)
 
 AC_ARG_WITH(sysroot,
-  AC_HELP_STRING([--sysroot],
+  AC_HELP_STRING([--with-sysroot],
   [system root directory for cross compiling]),
   with_top_level=${withval} ;
   cross_compiling=yes)
@@ -275,8 +284,9 @@
   *)   AC_MSG_ERROR([bad value ${enableval} for --enable-jemalloc option]) ;;
 esac],jemalloc=yes)
 
-dnl There is some weird stuff going on with NetBSD and jemalloc, so don't 
build it for now.
-if test x"${netbsd}" = x"yes" -o x"${windows}" = x"yes" -o x"${freebsd}" = 
x"yes"; then
+dnl There is some weird stuff going on with NetBSD and jemalloc, so don't 
+dnl build it for now.
+if test x"${netbsd}" = x"yes" -o x"${windows}" = x"yes" -o x"${freebsd}" = 
x"yes" -o x"${haiku}" = x"yes"; then
   jemalloc=no
 fi
 dnl If the compiler doesn't have local thread storage enabled, don't try to
@@ -492,7 +502,7 @@
   *)   AC_MSG_ERROR([bad value ${enableval} for enable-i810-lod-bias option]) 
;;
 esac])
 
-if test x$i810lodbias = xyes; then
+if test x"${i810lodbias}" = xyes; then
     AC_DEFINE([FIX_I810_LOD_BIAS], [], [Fix i810 LOD bias problem])
 fi
 
@@ -516,6 +526,7 @@
 
 has_gtk2=no                     dnl FIXME: has_* shouldn't be in configure but 
in a macro
 
+build_haiku=no
 build_aos4=no                   dnl AmigaOS4 GUI
 build_kde3=no
 build_kde4=no
@@ -533,13 +544,13 @@
 build_alp=no                    dnl Acess Linux Platform using Hiker
 build_dump=no
 AC_ARG_ENABLE(gui,
-  AC_HELP_STRING([--enable-gui=], [Use the specified GUI toolkit 
(default=gtk,kde3)]),
-  if test -n ${enableval}; then
+  AC_HELP_STRING([--enable-gui=], [Use the specified GUI toolkit 
(default=gtk,kde4)]),
+  [if test -n ${enableval}; then
     enableval=`echo ${enableval} | tr '\054' ' ' `
   fi
   while test -n "${enableval}" ; do
     val=`echo ${enableval} | cut -d ' ' -f 1`
-    [case "${val}" in
+    case "${val}" in
       hildon|HILDON|hildon2|HILDON2)
         build_hildon=yes
         AC_DEFINE(USE_HILDON, [1], [Use the Hildon mobile framework])
@@ -595,6 +606,9 @@
       aos4|AOS4)
         build_aos4=yes
         ;;
+      haiku|HAIKU)
+        build_haiku=yes
+        ;;
       dump|DUMP)
         build_dump=yes
         ;;
@@ -611,23 +625,37 @@
 dnl        build_hildon=yes
 dnl        build_alp=yes
 dnl        build_riscos=yes
+dnl        build_aos4=yes
+dnl        build_haiku=yes        
         ;;
-      *) AC_MSG_ERROR([invalid gui ${enableval} given (accept: 
gtk|kde3|kde4|fltk|sdl|riscos|aqua|fb|hildon|alp|qtopia3|qtopia4|dump|aos4)])
+      *) AC_MSG_ERROR([invalid gui ${enableval} given (accept: 
gtk|kde3|kde4|fltk|sdl|riscos|aqua|fb|hildon|alp|qtopia3|qtopia4|dump|aos4|haiku)])
          ;;
-      esac]
+      esac
     enableval=`echo ${enableval} | cut -d ' ' -f 2-6`
     if test "x$val" = "x$enableval"; then
       break;
     fi
-  done,build_gtk=yes;
-if test x$openbsd_os = xopenbsd; then
-  build_kde3=yes;
-  build_qt3=yes;
-else
-  build_kde4=yes;
-  build_qt4=yes;
+  done],
+  [if test x"${openbsd_os}" = x"openbsd"; then
+    build_kde3=yes;
+    build_qt3=yes;
+    build_gtk=yes;
+  else if test x"${haiku}" = xyes; then
+    build_haiku=yes;
+  else
+    build_kde4=yes;
+    build_qt4=yes;
+    build_gtk=yes;
+  fi
+  fi]
+)
+
+if test x"${build_haiku}" = xyes; then
+  if test x"$haiku" != xyes; then
+    echo "        ERROR: Can not build Haiku gui outside of Haiku
+operating system." >&3
+  fi
 fi
-)
 
 add_renderer=
 build_ogl=no
@@ -664,8 +692,9 @@
 add_sound=
 build_sound_sdl=no
 build_sound_ahi=no
+build_sound_mkit=no
 AC_ARG_ENABLE(sound,
-  AC_HELP_STRING([--enable-sound=[[sdl|ahi]]], [Use the specified sound 
handler (default=sdl)]),
+  AC_HELP_STRING([--enable-sound=[[sdl|ahi|mkit]]], [Use the specified sound 
handler (default=sdl)]),
      [case "${enableval}" in
       sdl|SDL|Sdl)
         build_sound_sdl=yes
@@ -675,9 +704,18 @@
         build_sound_ahi=yes
         add_sound="ahi"
         ;;
+      mkit|MKIT|Mkit)
+        build_sound_mkit=yes
+        add_sound="mkit"
+        ;;
      esac],
-  build_sound_sdl=yes
-  add_sound=sdl
+  [if test x"${haiku}" = xyes; then
+     build_sound_mkit=yes
+     add_sound="mkit"
+   else
+     build_sound_sdl=yes
+     add_sound=sdl
+   fi]
 )
 
 if test x$build_ogl = xyes; then
@@ -687,8 +725,8 @@
   if test x$build_fltk = xyes; then
     AC_MSG_ERROR([OpenGL renderer is not supported by FLTK gui. Use 
--enable-renderer=AGG or --enable-gui=kde,gtk,sdl]);
   fi
-  if test x$build_dump = xyes; then
-    AC_MSG_ERROR([OpenGL renderer is not supported by Dump gui. Use 
--enable-renderer=AGG or --enable-gui=kde,gtk,sdl]);
+  if test x"${build_dump}" = xyes -o x"${build_haiku}" = xyes; then
+    AC_MSG_ERROR([OpenGL renderer is not supported by this gui. Use 
--enable-renderer=AGG or --enable-gui=kde,gtk,sdl]);
   fi
    AC_DEFINE([RENDERER_OPENGL], [], [Use OpenGL renderer])
 fi
@@ -788,6 +826,12 @@
  [media_handler=gst; media_handler_specified=true]
 )
 
+dnl If we're on Haiku, there is only one supported media handler.
+if test x"${build_haiku}" = xyes; then
+     media_handler=ffmpeg
+     media_handler_specified=true
+fi
+
 AC_ARG_ENABLE(lirc, AC_HELP_STRING([--enable-lirc], [Disable support for 
Lirc]),
 [case "${enableval}" in
   yes) lirc=yes ;;
@@ -1120,6 +1164,13 @@
   AC_DEFINE([RENDERER_AGG], [], [Use AntiGrain renderer])
 fi
 
+dnl For Haiku, we know the sysroot is in a non-standard place
+dnl it is important that -lagg comes before -lbe
+if test x"${haiku}" = xyes; then
+  HAIKU_LIBS=-lbe
+  AC_SUBST(HAIKU_LIBS)
+fi
+
 DLOPEN="-dlopen"
 DLPREOPEN="-dlpreopen"
 AC_SUBST(DLOPEN)
@@ -1336,11 +1387,22 @@
 if $LD --help 2>/dev/null | grep as-needed > /dev/null; then
        gcc_cv_ld_as_needed=yes
 fi
-if test x"$gcc_cv_ld_as_needed" = xyes; then
-       LDFLAGS="${LDFLAGS} -Wl,--as-needed"
-fi
+dnl if test x"$gcc_cv_ld_as_needed" = xyes; then
+dnl    LDFLAGS=" -Wl,--as-needed"
+dnl fi
 AC_MSG_RESULT($gcc_cv_ld_as_needed)
 
+dnl AC_MSG_CHECKING(linker --no-undefined support)
+dnl gcc_cv_ld_undef_needed=no
+dnl # Check if linker supports --no-undefined
+dnl if $LD --help 2>/dev/null | grep as-needed > /dev/null; then
+dnl    gcc_cv_ld_undef_needed=yes
+dnl fi
+dnl if test x"$gcc_cv_ld_undef_needed" = xyes; then
+dnl    LDFLAGS=" ${LDFLAGS} -Wl,--no-undefined"
+dnl fi
+dnl AC_MSG_RESULT($gcc_cv_ld_undef_needed)
+
 AC_DEFINE(USE_GIF, [1], [Use the GIF library])
 AC_DEFINE(USE_PNG, [1], [Use the PNG library])
 AM_CONDITIONAL(USE_GIF, true)
@@ -1932,6 +1994,7 @@
 AM_CONDITIONAL(BUILD_RISCOS_GUI,   [ test x$build_riscos = xyes ])
 AM_CONDITIONAL(BUILD_DUMP_GUI,     [ test x$build_dump = xyes ])
 AM_CONDITIONAL(BUILD_AMIGAOS4_GUI, [ test x$build_aos4 = xyes ])
+AM_CONDITIONAL(BUILD_HAIKU_GUI,    [ test x$build_haiku = xyes ])
 
 # plugin building flags
 AM_CONDITIONAL(NPAPI, [test x$npapi = xyes])
@@ -2066,8 +2129,8 @@
   if test x$build_kde3 = xyes; then
     AC_MSG_ERROR([Cairo renderer is not supported by KDE gui. Use 
--enable-renderer=AGG or --enable-gui=gtk]);
   fi
-  if test x$build_dump = xyes; then
-    AC_MSG_ERROR([Cairo renderer is not supported by Dump gui. Use 
--enable-renderer=AGG or --enable-gui=gtk]);
+  if test x"${build_dump}" = xyes -o x"${build_haiku}" = xyes; then
+    AC_MSG_ERROR([Cairo renderer is not supported by this gui. Use 
--enable-renderer=AGG or --enable-gui=gtk]);
   fi
   AC_DEFINE([RENDERER_CAIRO], [], [Use cairo renderer])
 fi
@@ -2076,16 +2139,31 @@
 
 AM_CONDITIONAL(USE_SOUND_SDL, test x$build_sound_sdl = xyes)
 AM_CONDITIONAL(USE_SOUND_AHI, test x$build_sound_ahi = xyes)
+AM_CONDITIONAL(USE_SOUND_MKIT, test x$build_sound_mkit = xyes)
 AM_CONDITIONAL(USE_FFMPEG_ENGINE, test x"$media_handler" = xffmpeg)
 AM_CONDITIONAL(USE_GST_ENGINE, test x"$media_handler" = xgst)
 AM_CONDITIONAL(HAVE_OPENGL, test x"${OPENGL_LIBS}" != x)
-
-if test x$build_sound_sdl = xyes; then
+dnl for now the Haiku media handler is experimental
+AM_CONDITIONAL(USE_HAIKU_ENGINE, test x"$media_handler" = xno)
+
+if test x$build_sound_mkit = xyes; then
+  if test x"${haiku}" != xyes; then
+    AC_MSG_ERROR([Media Kit sound handling is supported only under Haiku]);
+  else
+    AC_DEFINE([SOUND_MKIT],  [1], [Use Haiku's Media Kit for sound handling])
+  fi
+fi
+
+if test x"${build_sound_sdl}" = xyes; then
   AC_DEFINE([SOUND_SDL],  [1], [Use SDL for sound handling])
 fi
 
-if test x$build_sound_ahi = xyes; then
-  AC_DEFINE([SOUND_AHI],  [1], [Use AmigaOS AHI for sound handling])
+if test x"${build_sound_ahi}" = xyes; then
+  if test x"$amigaos4" != xyes; then
+    AC_MSG_ERROR([AHI sound handling is supported only under AmigaOS]);
+  else
+    AC_DEFINE([SOUND_AHI],  [1], [Use AmigaOS AHI for sound handling])
+  fi
 fi
 
 case "${media_handler}" in
@@ -2359,6 +2437,9 @@
 if test x$build_aos4 = xyes; then
   SUPPORTED_GUIS="${SUPPORTED_GUIS},aos4"
 fi
+if test x$build_haiku = xyes; then
+  SUPPORTED_GUIS="${SUPPORTED_GUIS},haiku"
+fi
 SUPPORTED_GUIS="`echo ${SUPPORTED_GUIS} | sed 's/,//'`" # Strip leading comma
 AC_SUBST(SUPPORTED_GUIS)
 
@@ -2449,33 +2530,37 @@
 
 echo "Configurable options are:"
 
-if test x"$i810lodbias" = x"yes"; then
+if test x"${i810lodbias}" = x"yes"; then
   echo "        Intel 810 LOD bias hack enabled"
 else
   echo "        Intel 810 LOD bias hack disabled (default). Use 
--enable-i810-lod-bias to enable."
 fi
 
-if test x"$pthreads" = x"yes"; then
+if test x"${pthreads}" = x"yes"; then
   echo "        POSIX Threads support enabled (default)"
 else
-  echo "        POSIX Thread support disabled."
+  if test x"${build_haiku}" = x"yes"; then
+     echo "        POSIX Thread support built into C library."
+  els
+     echo "        POSIX Thread support disabled."
+  fi
 fi
 
-if test x"$dmalloc" = x"yes"; then
+if test x"${dmalloc}" = x"yes"; then
   echo "        DMalloc support enabled"
   echo "        For a list of the command-line options enter: dmalloc --usage"
 else
   echo "        DMalloc support disabled (default). Use --enable-dmalloc to 
enable."
 fi
 
-if test x"$npapi" = x"yes"; then
+if test x"${npapi}" = x"yes"; then
   echo "        NPAPI plugin enabled (default). Use --disable-npapi to 
disable."
   echo "            NPAPI plugin will be installed in ${FIREFOX_PLUGINS}"
 else
   echo "        NPAPI plugin disabled."
 fi
 
-if test x"$build_kparts3" = x"yes"; then
+if test x"${build_kparts3}" = x"yes"; then
   echo "        KPARTS 3.x plugin enabled (default). Use --disable-kparts3 to 
disable"
   echo "            KPARTS 3.x plugin will be installed in ${KDE3_PLUGINDIR}"
   echo "            KPARTS 3.x service will be installed in 
${KDE3_SERVICESDIR}"
@@ -2485,7 +2570,7 @@
   echo "        KPARTS 3.x plugin disabled."
 fi
 
-if test x"$build_kparts4" = x"yes"; then
+if test x"${build_kparts4}" = x"yes"; then
   echo "        KPARTS 4.x plugin enabled (default). Use --disable-kparts4 to 
disable"
   echo "            KPARTS 4.x plugin will be installed in ${KDE4_PLUGINDIR}"
   echo "            KPARTS 4.x service will be installed in 
${KDE4_SERVICESDIR}"
@@ -2501,48 +2586,48 @@
 dnl --   echo "        Loadable GUI & renderer disabled (default). Use 
--enable-dynamic-gui to enable."
 dnl -- fi
 
-if test x"$ghelp" = x"yes"; then
+if test x"${ghelp}" = x"yes"; then
   echo "        GNOME help enabled"
 else
   echo "        GNOME help disabled (default). Use --enable-ghelp to enable."
 fi
 
-dnl if test x"$extensions" = x"yes"; then
+dnl if test x"${extensions}" = x"yes"; then
 dnl   echo "        Building extensions enabled (default). Use 
--disable-extensions to disable."
 dnl else
 dnl   echo "        Building Gnash extensions disabled."
 dnl fi
 
-if test x"$cygnal" = x"yes"; then
+if test x"${cygnal}" = x"yes"; then
   echo "        Building Cygnal media server enabled (default). Use 
--disable-cygnal to disable."
 else
   echo "        Building Cygnal media server disabled."
 fi
 
-if test x"$debugger" = x"yes"; then
+if test x"${debugger}" = x"yes"; then
   echo "        Building Flash debugger support (default). Use 
--disable-debugger to disable."
 else
   echo "        Building the Flash debugger is disabled."
 fi
 
-if test x"$with-top_level" != x; then
+if test x"${with-top_level}" != x; then
   echo "        Top level for cross compiling support files is: 
$with_top_level"
 fi
 
-if test x$build_gtk = xyes -a x$pixelformat = xrgb565; then
+if test x"${build_gtk}" = xyes -a x"${pixelformat}" = xrgb565; then
   echo "        WARNING: Pixel format RGB565 selected in combination with the" 
>&4
   echo "                 GTK GUI. Only a hacked GTK will work (e.g. on the 
OLPC)." >&4
 fi
 
-if test x"$extensions_list" != x; then
+if test x"${extensions_list}" != x; then
   echo "        Building extensions: ${extensions_list}"
 fi
 
-if test x"$security_list" != x; then
+if test x"${security_list}" != x; then
   echo "        Enabling security features: ${security_list}"
 fi
 
-if test x"$statistics_list" != x; then
+if test x"${statistics_list}" != x; then
   echo "        Enabling statistics collecting for: ${statistics_list}"
 fi
 
@@ -3007,20 +3092,20 @@
 dnl  fi
 fi
 
-if test x"$pthreads" = x"yes"; then
+if test x"${pthreads}" = x"yes"; then
   if test x"$PTHREAD_CFLAGS" != x; then
     echo "        POSIX Threads flags are: $PTHREAD_CFLAGS"
   fi
-  if test x"$PTHREAD_LIBS" != x; then
+  if test x"${PTHREAD_LIBS}" != x; then
     echo "        POSIX Threads lib is: $PTHREAD_LIBS"
   else
-    if test x$cross_compiling = xno; then
+    if test x"${cross_compiling}" = xno; then
       echo "ERROR: No pthread development package installed!" >&3
     fi
   fi
 fi
 
-if test x"$docbook" = x"yes"; then
+if test x"${docbook}" = x"yes"; then
   if test x"$MAKEINFO" = x; then
     echo "        ERROR: no makeinfo tools installed!" >&3
     echo "               Either install it from 
http://www.gnu.org/software/texinfo/"; >&3
@@ -3368,6 +3453,11 @@
   fi
 fi
 
+dnl Haiku
+if test x"${build_haiku}" = xyes -o x"${build_sound_mkit}" = xyes -o 
x"${media_handler}" = x"mkit"; then
+    echo "        Haiku libs are: $HAIKU_LIBS"
+fi
+ 
 dnl XPCOM support for Mozilla/Firefox
 if test x"$xpcom" = x"yes"; then
   if test x"$has_xpcom" = x"yes"; then

=== modified file 'gui/Kde4GlueAgg.cpp'
--- a/gui/Kde4GlueAgg.cpp       2010-01-11 06:41:38 +0000
+++ b/gui/Kde4GlueAgg.cpp       2010-02-23 17:40:25 +0000
@@ -24,6 +24,7 @@
 #include "Kde4GlueAgg.h"
 #include "Renderer.h"
 #include "Renderer_agg.h"
+#include "GnashException.h"
 #include <QImage>
 #include <QRect>
 
@@ -110,7 +111,7 @@
 
     if ( ! _renderer )
     {
-        throw GnashException("Could not create AGG renderer with pixelformat 
ABGR32");
+        throw GnashException(_("Could not create AGG renderer with pixelformat 
ABGR32"));
     }
     return _renderer;
 }

=== modified file 'gui/Makefile.am'
--- a/gui/Makefile.am   2010-02-08 00:05:16 +0000
+++ b/gui/Makefile.am   2010-02-17 05:40:22 +0000
@@ -16,8 +16,8 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 # 
-# build gtk-gnash, kde-gnash, sdl-gnash, fltk-gnash, aqua-gnash, fb-gnash, 
riscos-gnash
-# and dump-gnash
+# build gtk-gnash, kde-gnash, sdl-gnash, fltk-gnash, aqua-gnash, fb-gnash,
+# riscos-gnash, haiku-gnash and dump-gnash
 #
 
 AUTOMAKE_OPTIONS = -Wno-portability
@@ -33,7 +33,7 @@
 # noinst_LTLIBRARIES = libgnashgui.la
 BUILT_SOURCES = .configline
 
-EXTRA_DIST = gnash.in klash3.moc.in klash4.moc.in
+EXTRA_DIST = gnash.in klash3.moc.in klash4.moc.in am-frag
 
 # If python support is enabled, built that too
 if HAS_PYTHON
@@ -58,6 +58,7 @@
        -I$(top_srcdir)/libsound \
        -I$(top_srcdir)/libmedia/ffmpeg \
        -I$(top_srcdir)/libmedia/gst \
+       -I$(top_srcdir)/libmedia/haiku \
        -DLOCALEDIR=\"$(localedir)\" \
        -DPLUGINSDIR=\"$(pluginsdir)\" \
        -DLIBAVCODEC_IDENT=\"$(LIBAVCODEC_IDENT)\" \
@@ -200,7 +201,7 @@
 
 if BUILD_AQUA_GUI
 BUILT_SOURCES += bundle
-EXTRA_DIST += Gnash.app am-frag
+EXTRA_DIST += Gnash.app
 endif
 
 # Build the QTOPIA gui
@@ -230,6 +231,11 @@
 include $(srcdir)/am-frag/aos4.am
 endif
 
+# Build the Haiku gui
+if BUILD_HAIKU_GUI
+include $(srcdir)/am-frag/haiku.am
+endif
+
 # Build the FLTK gui
 if BUILD_FLTK_GUI
 include $(srcdir)/am-frag/fltk.am

=== modified file 'gui/Player.cpp'
--- a/gui/Player.cpp    2010-02-11 19:50:37 +0000
+++ b/gui/Player.cpp    2010-02-23 16:53:29 +0000
@@ -52,6 +52,8 @@
 # include "MediaHandlerFfmpeg.h"
 #elif defined(USE_GST)
 # include "MediaHandlerGst.h"
+#elif defined(USE_HAIKU_ENGINE)
+# include "MediaHandlerHaiku.h"
 #endif
 
 #include "GnashSystemIOHeaders.h" // for write() 
@@ -177,22 +179,19 @@
 {
 
     if (_doSound) {
+        try {
 #ifdef SOUND_SDL
-        try {
             _soundHandler.reset(sound::create_sound_handler_sdl(_audioDump));
-        } catch (SoundException& ex) {
-            log_error(_("Could not create sound handler: %s."
-                " Will continue w/out sound."), ex.what());
-        }
-        if (! _audioDump.empty()) {
-            // add a silent stream to the audio pool so that our output file
-            // is homogenous;  we actually want silent wave data when no sounds
-            // are playing on the stage
-            _soundHandler->attach_aux_streamer(silentStream, (void*) this);
-        }
+#elif defined(SOUND_GST)
+            _soundHandler.reset(media::create_sound_handler_gst());
 #elif defined(SOUND_AHI)
-        try {
             _soundHandler.reset(sound::create_sound_handler_aos4(_audioDump));
+#elif defined(SOUND_MKIT)
+            _soundHandler.reset(sound::create_sound_handler_mkit(_audioDump));
+#else
+            log_error(_("Sound requested but no sound support compiled in"));
+            return;
+#endif
         } catch (SoundException& ex) {
             log_error(_("Could not create sound handler: %s."
                 " Will continue w/out sound."), ex.what());
@@ -203,12 +202,6 @@
             // are playing on the stage
             _soundHandler->attach_aux_streamer(silentStream, (void*) this);
         }
-#elif defined(SOUND_GST)
-        _soundHandler.reset(media::create_sound_handler_gst());
-#else
-        log_error(_("Sound requested but no sound support compiled in"));
-        return;
-#endif
     }
 }
 
@@ -219,6 +212,8 @@
         _mediaHandler.reset( new gnash::media::ffmpeg::MediaHandlerFfmpeg() );
 #elif defined(USE_GST)
         _mediaHandler.reset( new gnash::media::gst::MediaHandlerGst() );
+#elif defined(USE_HAIKU_ENGINE)
+        _mediaHandler.reset( new gnash::media::haiku::MediaHandlerHaiku() );
 #else
         log_error(_("No media support compiled in"));
         return;
@@ -795,6 +790,10 @@
     return createAOS4Gui(_windowID, _scale, _doLoop, *_runResources);
 #endif
 
+#ifdef GUI_HAIKU
+    return createHaikuGui(_windowID, _scale, _doLoop, *_runResources);
+#endif
+
 #ifdef GUI_DUMP
     return createDumpGui(_windowID, _scale, _doLoop, *_runResources);
 #endif

=== added file 'gui/am-frag/haiku.am'
--- a/gui/am-frag/haiku.am      1970-01-01 00:00:00 +0000
+++ b/gui/am-frag/haiku.am      2010-02-23 16:26:50 +0000
@@ -0,0 +1,41 @@
+# 
+#   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# 
+# 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+# 
+
+#
+# Build the Haiku gui
+#
+
+if BUILD_HAIKU_GUI
+bin_PROGRAMS += haiku-gnash
+haiku_gnash_SOURCES = $(GUI_SRCS) gui_haiku.cpp haiku.cpp haikusup.h
+haiku_gnash_CPPFLAGS = -DGUI_HAIKU -DGUI_CONFIG=\"HAIKU\" \
+       $(AM_CPPFLAGS) $(HAIKU_CFLAGS)
+haiku_gnash_LDFLAGS = $(LIBLTDL) -export-dynamic $(AM_LDFLAGS)
+haiku_gnash_LDADD = $(GNASH_LIBS)
+# all-local: haiku-gnash$(EXEEXT)
+#      echo
+
+if BUILD_AGG_RENDERER
+haiku_gnash_CPPFLAGS += $(AGG_CFLAGS)
+# -lbe must be after -lagg
+haiku_gnash_LDADD += $(top_builddir)/backend/libgnashagg.la \
+       $(AGG_LIBS) $(HAIKU_LIBS)
+haiku_gnash_SOURCES += haiku_agg_glue.cpp haiku_agg_glue.h
+endif                          # BUILD_AGG_RENDERER
+
+endif                          # BUILD_HAIKU_GUI
+

=== modified file 'gui/aos4.cpp'
--- a/gui/aos4.cpp      2010-01-11 06:41:38 +0000
+++ b/gui/aos4.cpp      2010-02-23 16:53:29 +0000
@@ -877,47 +877,4 @@
 #endif
                                                "\n\nCopyright (C) 2005, 2006, 
2007, "
                                "2008, 2009, 2010 The Free Software Foundation"
-                                               "\n\nAmigaOS4 Version by Andrea 
Palmat? - http://www.amigasoft.net";;
-
-       PrintMsg(about);
-}
-
-struct GnashPrefs *
-AOS4Gui::ReadPrefs(void)
-{
-    RcInitFile& _rcfile = RcInitFile::getDefaultInstance();
-       struct GnashPrefs *localprefs;
-
-       localprefs = (struct GnashPrefs *) malloc(sizeof(GnashPrefs));
-       memset(localprefs, 0, sizeof(GnashPrefs));
-
-       localprefs->verbosity                   = _rcfile.verbosityLevel();
-       localprefs->logtofile                   = _rcfile.useWriteLog();
-       strncpy(localprefs->logfilename,        _rcfile.getDebugLog().c_str(),  
                 254);
-       localprefs->logparser                   = _rcfile.useParserDump();
-       localprefs->logswf                      = _rcfile.useActionDump();
-       localprefs->logmalformedswf     = _rcfile.showMalformedSWFErrors();
-       localprefs->logactionscript             = _rcfile.showASCodingErrors();
-       localprefs->loglocalconn                = _rcfile.getLCTrace();
-       localprefs->connectlocalhost    = _rcfile.useLocalHost();
-       localprefs->connectlocaldomain  = _rcfile.useLocalDomain();
-       localprefs->disablessl                  = _rcfile.insecureSSL();
-       strncpy(localprefs->sharedobjdir,       
_rcfile.getSOLSafeDir().c_str(),                 254);
-       localprefs->dontwriteso                 = _rcfile.getSOLReadOnly();
-       localprefs->onlylocalso                 = _rcfile.getSOLLocalDomain();
-       localprefs->disablelocal                = _rcfile.getLocalConnection();
-       localprefs->nettimeout                  = _rcfile.getStreamsTimeout();
-       localprefs->usesound                    = _rcfile.useSound();
-       localprefs->savemedia                   = _rcfile.saveStreamingMedia();
-       localprefs->savedynamic                 = _rcfile.saveLoadedMedia();
-       strncpy(localprefs->savemediadir,       _rcfile.getMediaDir().c_str(),  
                 254);
-       strncpy(localprefs->playerversion,      
_rcfile.getFlashVersionString().c_str(), 31);
-       strncpy(localprefs->detectedos,         
_rcfile.getFlashSystemOS().c_str(),      31);
-       strncpy(localprefs->urlopener,          
_rcfile.getURLOpenerFormat().c_str(),    254);
-       localprefs->maxsizemovielib             = 
_rcfile.getMovieLibraryLimit();
-       localprefs->startpaused                 = _rcfile.startStopped();
-       return localprefs;
-}
-
-} // namespace gnash
-
+                                               "\n\nAmigaOS4 Version by Andrea 
Palmat
\ No newline at end of file

=== modified file 'gui/fltk_glue_agg.cpp'
--- a/gui/fltk_glue_agg.cpp     2010-01-11 06:41:38 +0000
+++ b/gui/fltk_glue_agg.cpp     2010-02-23 17:06:43 +0000
@@ -48,6 +48,8 @@
 FltkAggGlue::createRenderHandler()
 {
     _renderer = create_Renderer_agg("RGB24");
+    if (_renderer == NULL)
+        throw GnashException(_("Could not create AGG renderer with pixelformat 
RGB24"));
     return _renderer;
 }
 

=== modified file 'gui/gnash.in'
--- a/gui/gnash.in      2010-01-01 17:48:26 +0000
+++ b/gui/gnash.in      2010-02-17 22:24:51 +0000
@@ -27,7 +27,7 @@
 
 #!/bin/sh
 
-GUIS="gtk kde kde4 sdl fltk aqua riscos fb alp hildon"
+GUIS="gtk kde kde4 sdl fltk aqua riscos fb alp hildon haiku"
 THIS_DIR="`dirname $0`"
 
 if test "$1" = "-G"; then

=== modified file 'gui/gtk_glue_agg.cpp'
--- a/gui/gtk_glue_agg.cpp      2010-01-11 06:41:38 +0000
+++ b/gui/gtk_glue_agg.cpp      2010-02-23 17:06:43 +0000
@@ -87,6 +87,13 @@
     gdk_image_destroy(tmpimage);
 
     _agg_renderer = create_Renderer_agg(pixelformat);
+    if (! _agg_renderer) {
+        boost::format fmt = boost::format(
+            _("Could not create AGG renderer with pixelformat %s")
+            ) % pixelformat;
+        throw GnashException(fmt.str());
+    }
+
     return _agg_renderer;
 }
 

=== modified file 'gui/gtk_glue_agg_xv.cpp'
--- a/gui/gtk_glue_agg_xv.cpp   2010-01-01 17:48:26 +0000
+++ b/gui/gtk_glue_agg_xv.cpp   2010-02-23 17:06:43 +0000
@@ -105,8 +105,16 @@
 Renderer*
 GtkAggXvGlue::createRenderHandler()
 {
-    _agg_renderer = create_Renderer_agg(findPixelFormat(_xv_format).c_str());
-    return _agg_renderer;
+    std::string pixelformat = findPixelFormat(_xv_format);
+    _agg_renderer = create_Renderer_agg(pixelformat.c_str());
+    if (_agg_renderer == NULL) {
+        boost::format fmt = boost::format(
+            _("Could not create AGG renderer with pixelformat %s")
+            ) % pixelformat;
+        throw GnashException(fmt.str());
+    }
+
+     return _agg_renderer;
 }
 
 void

=== modified file 'gui/gui.h'
--- a/gui/gui.h 2010-02-11 19:50:37 +0000
+++ b/gui/gui.h 2010-02-23 16:26:50 +0000
@@ -642,6 +642,7 @@
 std::auto_ptr<Gui> createAQUAGui(unsigned long xid, float scale, bool loop, 
RunResources& r);
 std::auto_ptr<Gui> createRISCOSGui(unsigned long xid, float scale, bool loop, 
RunResources& r);
 std::auto_ptr<Gui> createAOS4Gui(unsigned long xid, float scale, bool loop, 
RunResources& r);
+std::auto_ptr<Gui> createHaikuGui(unsigned long xid, float scale, bool loop, 
RunResources& r);
 std::auto_ptr<Gui> createDumpGui(unsigned long xid, float scale, bool loop, 
RunResources& r);
 
  

=== added file 'gui/gui_haiku.cpp'
--- a/gui/gui_haiku.cpp 1970-01-01 00:00:00 +0000
+++ b/gui/gui_haiku.cpp 2010-02-17 05:39:01 +0000
@@ -0,0 +1,47 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "gui.h"
+#include "GnashException.h"
+
+#ifdef GUI_HAIKU
+#include "haikusup.h"
+#endif
+
+namespace gnash {
+
+#ifdef GUI_HAIKU
+std::auto_ptr<Gui> createHaikuGui(unsigned long windowid, float scale, bool 
do_loop, RunResources& r)
+{
+    return std::auto_ptr<Gui>(new HaikuGui(windowid, scale, do_loop, r));
+}
+#else // ! GUI_HAIKU
+std::auto_ptr<Gui> createHaikuGui(unsigned long , float, bool, 
RunResourcesfloat , bool , unsigned int )
+{
+    throw GnashException("Support for Haiku gui was not compiled in");
+}
+#endif // ! GUI_HAIKU
+
+} // namespace gnash
+

=== added file 'gui/haiku.cpp'
--- a/gui/haiku.cpp     1970-01-01 00:00:00 +0000
+++ b/gui/haiku.cpp     2010-02-16 20:28:47 +0000
@@ -0,0 +1,522 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "RunResources.h"
+
+#include "gnash.h"
+#include "adipe.h"
+#include "haikusup.h"
+
+
+#include <interface/Font.h>
+#include <Application.h>
+#include <Alert.h>
+#include <Window.h>
+#include <Screen.h>
+#include <MessageRunner.h>
+
+using namespace std;
+
+#ifndef RENDERER_AGG
+#error Haiku gui requires AGG renderer
+#endif
+
+namespace gnash
+{
+
+const int32 GNASH_PULSE = 'GPLS';
+
+
+class BeWin : public BWindow
+{
+    HaikuGui *_gui;
+    BRect _unfullscreen_frame;
+    bool _fullscreen;
+public:
+    BeWin(BRect frame, const char *title, HaikuGui *gui)
+    : BWindow(frame, title, B_TITLED_WINDOW, 0), _gui(gui),
+        _fullscreen(false)
+    {
+    }
+
+    bool QuitRequested()
+    {
+        be_app_messenger.SendMessage(B_QUIT_REQUESTED);
+        BWindow::QuitRequested();
+        return false;
+    }
+
+    void FrameResized(float width, float height)
+    {
+        BMessage msg(GNASH_RESIZE);
+        if (msg.AddFloat("w", width) != B_OK
+            || msg.AddFloat("h", height) != B_OK)
+            QQ(1);
+        else
+            be_app_messenger.SendMessage(&msg);
+    }
+
+    void setFullscreenEtc()
+    {
+        QQ(8);
+        if (_fullscreen == true)
+            return;
+        _fullscreen = true;
+
+        BScreen s(this);
+        BRect r(s.Frame());
+        _unfullscreen_frame = Frame();
+        MoveTo(0,0);
+        ResizeTo(r.Width(), r.Height());
+    }
+
+    void ScreenChanged(BRect frame, color_space mode)
+    {
+        (void) mode;
+
+        QQ(8);
+        if (_fullscreen == false)
+            return;
+        // XXX perform in beapp thread
+        MoveTo(0,0);
+        ResizeTo(frame.Width(), frame.Height());
+    }
+
+    void unsetFullscreenEtc()
+    {
+        QQ(8);
+        if (_fullscreen == false)
+            return;
+        _fullscreen = false;
+        MoveTo(_unfullscreen_frame.left, _unfullscreen_frame.top);
+        ResizeTo(_unfullscreen_frame.Width(), _unfullscreen_frame.Height());
+    }
+
+
+};
+
+class BeApp : public BApplication
+{
+    HaikuGui *_gui;
+    BWindow *_win;
+    time_t _start_t;
+    time_t _timeout;
+    int32 _mouse_moves_this_pulse;
+    int32 _mousemovedx, _mousemovedy;
+public:
+    BeApp(HaikuGui *gui)
+    : BApplication("application/gnash-player"),
+        _gui(gui), _win(NULL), _start_t(time(NULL)),
+        _timeout(0), _mouse_moves_this_pulse(0),
+        _mousemovedx(0), _mousemovedy(0)
+    {
+    }
+
+    void setTimeout(time_t timeout)
+    {
+        _timeout = timeout;
+    }
+
+    virtual ~BeApp()
+    {
+    }
+
+    bool QuitRequested()
+    {
+        BApplication::QuitRequested();
+        return true;
+    }
+
+    bool Timedout()
+    {
+        return _timeout && time(NULL) - _start_t > _timeout;
+    }
+
+    void setFullscreenEtc()
+    {
+        assert(_win != NULL);
+        static_cast<BeWin*>(_win)->setFullscreenEtc();
+    }
+
+    void unsetFullscreenEtc()
+    {
+        assert(_win != NULL);
+        static_cast<BeWin*>(_win)->unsetFullscreenEtc();
+    }
+
+    void MessageReceived(BMessage *msg)
+    {
+        switch (msg->what)
+        {
+            case GNASH_PULSE:
+                if (_mouse_moves_this_pulse > 3)
+                    _gui->notify_mouse_moved(_mousemovedx, _mousemovedy);
+                _mouse_moves_this_pulse = 0;
+                _gui->GnashPulse();
+                break;
+            case GNASH_RESIZE:
+            {
+                float width, height;
+                if (msg->FindFloat("w", &width) != B_OK
+                    || msg->FindFloat("h", &height) != B_OK)
+                    QQ(1);
+                else
+                    _gui->resize_view(width+1, height+1);
+                break;
+            }
+            case GNASH_HIDDEN:
+            {
+                _gui->Hidden();
+                break;
+            }
+            case GNASH_SHOWN:
+            {
+                _gui->Shown();
+                break;
+            }
+            case GNASH_SET_FULLSCREEN:
+                _gui->setFullscreenEtc();
+                break;
+            case GNASH_UNSET_FULLSCREEN:
+                _gui->unsetFullscreenEtc();
+                break;
+            case GNASH_MOUSE_CLICKED:
+            {
+                bool pressed;
+                int32 mask;
+                if (B_OK != msg->FindBool("pressed", &pressed)
+                    || B_OK != msg->FindInt32("mask", &mask))
+                    QQ(1);
+                else
+                    _gui->notify_mouse_clicked(pressed, mask);
+                break;
+            }
+            case GNASH_MOUSE_MOVED:
+            {
+                ++ _mouse_moves_this_pulse;
+                int32 x, y;
+                if (B_OK != msg->FindInt32("x", &x)
+                    || B_OK != msg->FindInt32("y", &y))
+                    QQ(1);
+                else
+                {
+                    if (_mouse_moves_this_pulse > 3)
+                    {
+                        _mousemovedx = x;
+                        _mousemovedy = y;
+                    } else
+                        _gui->notify_mouse_moved(x, y);
+                }
+                break;
+            }
+            case GNASH_KEY_EVENT:
+            {
+                int32 key, modifiers;
+                bool pressed;
+                if (B_OK != msg->FindInt32("key", &key)
+                    || B_OK != msg->FindInt32("modifiers", &modifiers)
+                    || B_OK != msg->FindBool("pressed", &pressed))
+                    QQ(1);
+                else
+                    _gui->notify_key_event(static_cast<gnash::key::code>(key), 
modifiers, pressed);
+                break;
+            }
+            default:
+                BApplication::MessageReceived(msg);
+        };
+    }
+
+    void
+    ReadyToRun()
+    {
+    }
+
+    bool
+    CreateWindow(int width, int height, int xPosition, int yPosition,
+                const char *title)
+    {
+        assert(_win == NULL);
+        QQ(8);
+        _win = new BeWin(BRect(xPosition, yPosition, xPosition+width-1, 
yPosition+height-1),
+            title, _gui);
+        _win->Show();
+        return true;
+    }
+
+    BWindow**
+    GetWinAddr()
+    {
+        return &_win;
+    }
+};
+
+
+HaikuGui::HaikuGui(unsigned long xid, float scale, bool loop, RunResources& r)
+    : Gui(xid, scale, loop, r), _app(NULL), _rnr(NULL), _glue(this, xid), 
_timeout(0)
+{
+    QQ(8);
+}
+
+HaikuGui::~HaikuGui()
+{
+    GNASH_REPORT_FUNCTION;
+    delete _rnr;
+    delete _app;
+}
+
+bool
+HaikuGui::init(int argc, char **argv[])
+{
+    QQ(8);
+    GNASH_REPORT_FUNCTION;
+    _app = new BeApp(this);
+
+//    if (_xid)
+//            log_error (_("Ignoring request to display in X11 window"));
+
+    char c;
+    int origopterr = opterr;
+
+    optind = 0;
+    opterr = 0;
+
+    while ((c = getopt(argc, *argv, "D:")) != -1) {
+        if (c == 'D') {
+            // Terminate if no filename is given.
+            if (!optarg) {
+                std::cout << 
+                    _("# FATAL:  No filename given with -D argument.") << 
std::endl;      
+                return false;
+            }
+            _sharefilename = optarg;
+        }
+    }
+
+
+    opterr = origopterr;
+
+    BMessage m(GNASH_PULSE);
+    be_app_messenger.SendMessage(&m);
+
+    _glue.init(argc, argv, _app->GetWinAddr(), _sharefilename);
+
+    _renderer.reset(_glue.createRenderHandler(32));
+    if ( ! _renderer ) return false;
+
+    return true;
+}
+
+bool
+HaikuGui::createWindow(const char *title, int width, int height,
+              int xPosition, int yPosition)
+{
+    GNASH_REPORT_FUNCTION;
+    if (xPosition == -1 && yPosition == -1)
+    {
+        xPosition = 200;
+        yPosition = 200;
+    }
+    _width = width;
+    _height = height;
+
+
+
+    if (_xid == 0)
+    {
+        bool b = _app->CreateWindow(width, height, xPosition, yPosition,
+            title);
+        if (b == false)
+            return false;
+    } else {
+    }
+    _glue.prepDrawingArea(_width, _height, 0/*sdl_flags*/);
+    _glue.ViewNeeded();
+    _runResources.setRenderer(_renderer);
+
+    return true;
+}
+
+bool
+HaikuGui::run()
+{
+    GNASH_REPORT_FUNCTION;
+    _app->Run();
+    return ! _app->Timedout();
+}
+
+void
+HaikuGui::renderBuffer()
+{
+    _glue.render();
+}
+
+void
+HaikuGui::setInterval(unsigned int interval)
+{
+    _interval = interval;
+}
+
+void
+HaikuGui::setTimeout(unsigned int timeout)
+{
+    _timeout = timeout;
+    _app->setTimeout((timeout+999)/1000);
+}
+
+void
+HaikuGui::error(const std::string &msg)
+{
+    BAlert *alert =
+        new BAlert("Error", msg.c_str(), "Dismiss", NULL, NULL,
+                B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_STOP_ALERT);
+    alert->Go();
+}
+
+bool
+HaikuGui::yesno(const std::string& question)
+{
+    BAlert *alert =
+        new BAlert("yes/no", question.c_str(), "Yes", "No", NULL,
+                B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
+    int32 answer = alert->Go();
+    return answer == 0;
+}
+
+void
+HaikuGui::setInvalidatedRegions(const InvalidatedRanges& ranges)
+{
+    _glue.setInvalidatedRegions(ranges);
+}
+
+bool
+HaikuGui::createMenu()
+{
+    GNASH_REPORT_FUNCTION;
+    return false;
+}
+
+bool
+HaikuGui::createMenuBar()
+{
+    GNASH_REPORT_FUNCTION;
+    return false;
+}
+
+bool
+HaikuGui::setupEvents()
+{
+    GNASH_REPORT_FUNCTION;
+    return false;
+}
+
+void
+HaikuGui::setFullscreen()
+{
+    BMessage m(GNASH_SET_FULLSCREEN);
+    be_app_messenger.SendMessage(&m);
+}
+
+void
+HaikuGui::setFullscreenEtc()
+{
+    //_glue.BlankScreen();
+    if (_xid != 0)
+    {
+        bool b = _app->CreateWindow(_width, _height, 0, 0,
+                "Gnash");
+        if (b == false)
+        {
+            return;
+        }
+        //_glue.prepDrawingArea(_width+5, _height, 0/*sdl_flags*/);
+        //_glue.prepDrawingArea(_width, _height, 0/*sdl_flags*/);
+        _glue.ViewNeeded();
+    }
+    _app->setFullscreenEtc();
+}
+
+void
+HaikuGui::unsetFullscreen()
+{
+    BMessage m(GNASH_UNSET_FULLSCREEN);
+    be_app_messenger.SendMessage(&m);
+}
+
+void
+HaikuGui::unsetFullscreenEtc()
+{
+    //_glue.BlankScreen();
+    _app->unsetFullscreenEtc();
+    if (_xid != 0)
+    {
+        (*_app->GetWinAddr())->LockLooper();
+        (*_app->GetWinAddr())->Quit();
+        (*_app->GetWinAddr()) = NULL;
+        _glue.ViewNoMore();
+    }
+    //std::cerr << _width << " " << _height << std::endl;
+    //_glue.prepDrawingArea(_width, _height, 0/*sdl_flags*/);
+}
+
+void HaikuGui::GnashPulse()
+{
+    if (_app->Timedout())
+    {
+        _app->Quit();
+        return ;
+    }
+
+    delete _rnr;
+    BMessage m(GNASH_PULSE);
+    _rnr = new BMessageRunner(BMessenger(NULL, _app), &m, 20000, 1);
+    if (_rnr->InitCheck() != B_OK)
+        abort();
+
+    Gui::advance_movie(this);
+}
+
+
+void
+HaikuGui::resize_view(int width, int height)
+{
+    std::cerr << width << " " << height << std::endl;
+    _glue.prepDrawingArea(width, height, 0);
+    Gui::resize_view(width, height);
+}
+
+void
+HaikuGui::Shown()
+{
+    _glue.Shown();
+}
+
+void
+HaikuGui::Hidden()
+{
+    _glue.Hidden();
+}
+
+
+
+};
+

=== added file 'gui/haiku_agg_glue.cpp'
--- a/gui/haiku_agg_glue.cpp    1970-01-01 00:00:00 +0000
+++ b/gui/haiku_agg_glue.cpp    2010-02-16 20:28:47 +0000
@@ -0,0 +1,505 @@
+// haiku_agg_glue.cpp:  Glue between Haiku and Anti-Grain Geometry, for Gnash.
+//
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc.
+//
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "haiku_agg_glue.h"
+#include "log.h"
+#include "Renderer.h"
+#include "Renderer_agg.h"
+#include "gui.h"
+#include <cerrno>
+#include <ostream>
+
+#include "adipe.h"
+
+#include <interface/Font.h>
+#include <Application.h>
+#include <interface/Bitmap.h>
+#include <View.h>
+#include <Window.h>
+
+#include <sys/mman.h>
+
+using namespace std;
+
+namespace gnash
+{
+
+
+class BeV : public BView
+{
+    void Draw(BRect updateRect)
+    {
+        (void) updateRect;
+
+        if (_bitmap == NULL)
+            return ;
+        _bitmap->SetBits(_buf, _width * _height * 4, 0, B_RGBA32);
+        MovePenTo(BPoint(0,0));
+        DrawBitmap(_bitmap);
+    }
+    void *_buf;
+    int32 _width;
+    int32 _height;
+    BBitmap *_bitmap;
+    Gui *_gui;
+    ulong _pressedbuttons;
+public:
+    BeV(Gui *gui)
+    : BView(BRect(0,0,0,0), "BeV", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS 
| B_NAVIGABLE),
+    _buf(NULL), _width(0), _height(0), _bitmap(NULL), _gui(gui), 
_pressedbuttons(0)
+    {
+        SetEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS);
+    }
+
+    virtual ~BeV()
+    {
+        delete _bitmap;
+    }
+
+    void SetBuffer(void *buf, int32 width, int32 height)
+    {
+        _buf = buf;
+        _width = width;
+        _height = height;
+        LockLooper();
+        ResizeTo(width-1,height-1);
+        UnlockLooper();
+        delete _bitmap; _bitmap = NULL;
+        _bitmap = new BBitmap(BRect(0,0,_width-1, _height-1), B_RGBA32);
+    }
+
+enum gnash::key::code gnash_keycode(int code)
+{
+    //key::code
+    //SDLGui::sdl_to_gnash_key(SDL_KeyboardEvent * key)
+    //{
+    gnash::key::code c(gnash::key::INVALID);
+
+    // TODO: take care of CAPS_LOCK and NUM_LOCK and SHIFT
+    // int mod = key->keysym.mod;
+    //int code = key->keysym.sym;
+
+    if(code>= 32 && code <= 127) {
+        c = (gnash::key::code)(code);
+        /*} else if(code >= SDLK_KP0 && code <= SDLK_KP9) {
+          c = (gnash::key::code)(code - SDLK_KP0 + gnash::key::KP_0); 
+          }else if(code >= SDLK_F1 && code <= SDLK_F15) {
+          c = (gnash::key::code)(code - SDLK_F1 + gnash::key::F1);*/
+}else 
+{
+    switch(code) {
+        case B_UP_ARROW:       c = gnash::key::UP;       break;
+        case B_DOWN_ARROW:     c = gnash::key::DOWN;     break;
+        case B_RIGHT_ARROW:    c = gnash::key::RIGHT;    break;
+        case B_LEFT_ARROW:     c = gnash::key::LEFT;     break;
+        case B_INSERT:   c = gnash::key::INSERT;   break;
+        case B_HOME:     c = gnash::key::HOME;     break;
+        case B_END:      c = gnash::key::END;      break;
+        case B_PAGE_UP:   c = gnash::key::PGUP;     break;
+        case B_PAGE_DOWN: c = gnash::key::PGDN;     break;
+                  //case SDLK_RSHIFT:
+                  //case SDLK_LSHIFT:   c = gnash::key::SHIFT;    break;
+                  //case SDLK_RCTRL:
+                  //case SDLK_LCTRL:    c = gnash::key::CONTROL;  break;
+                  //case SDLK_RALT:
+                  //case SDLK_LALT:     c = gnash::key::ALT;      break;
+        default: c = gnash::key::INVALID; break;
+    }
+}
+
+return c;
+//}
+}
+
+
+
+    void KeyDown(const char *bytes, int32 numBytes)
+    {
+        for (int32 i = 0; i < numBytes; ++i)
+        {
+            BMessage msg(GNASH_KEY_EVENT);
+            if (B_OK != msg.AddInt32("key", gnash_keycode(bytes[i]))
+                    || B_OK != msg.AddInt32("modifiers", 0)
+                    || B_OK != msg.AddBool("pressed", true))
+                QQ(1);
+            else
+                be_app_messenger.SendMessage(&msg);
+            //XXX parse multibyte character codes
+        }
+    }
+
+    void KeyUp(const char *bytes, int32 numBytes)
+    {
+        for (int32 i = 0; i < numBytes; ++i)
+        {
+            BMessage msg(GNASH_KEY_EVENT);
+            if (B_OK != msg.AddInt32("key", gnash_keycode(bytes[i]))
+                    || B_OK != msg.AddInt32("modifiers", 0)
+                    || B_OK != msg.AddBool("pressed", false))
+                QQ(1);
+            else
+                be_app_messenger.SendMessage(&msg);
+            //XXX parse multibyte character codes
+        }
+    }
+
+    void MouseMoved(BPoint point, uint32 transit, const BMessage *message)
+    {
+        (void) transit;
+        (void) message;
+
+        BMessage msg(GNASH_MOUSE_MOVED);
+        if (B_OK != msg.AddInt32("x", point.x)
+            || B_OK != msg.AddInt32("y", point.y))
+            QQ(1);
+        else
+            be_app_messenger.SendMessage(&msg);
+    }
+
+    void MouseDown(BPoint where)
+    {
+        (void) where;
+
+        MakeFocus();
+        BPoint mouseWhere;
+        ulong buttons;
+        GetMouse(&mouseWhere, &buttons);
+        // XXX many buttons clicked simultaneously
+        BMessage msg(GNASH_MOUSE_CLICKED);
+        if (B_OK != msg.AddBool("pressed", true)
+            || B_OK != msg.AddInt32("mask", buttons))
+            QQ(1);
+        else
+            be_app_messenger.SendMessage(&msg);
+        _pressedbuttons = buttons;
+    }
+
+    void MouseUp(BPoint where)
+    {
+        (void) where;
+
+        BPoint mouseWhere;
+        ulong buttons;
+        GetMouse(&mouseWhere, &buttons);
+
+        BMessage msg(GNASH_MOUSE_CLICKED);
+        if (B_OK != msg.AddBool("pressed", false)
+            || B_OK != msg.AddInt32("mask", _pressedbuttons & ~buttons))
+            QQ(1);
+        else
+            be_app_messenger.SendMessage(&msg);
+        _pressedbuttons = buttons;
+    }
+};
+
+HaikuAggGlue::HaikuAggGlue(Gui *gui, unsigned long xid)
+    :
+    _offscreenbuf(NULL),
+    _sharebuf(NULL),
+    //_screen(NULL),
+    _width(0),
+    _height(0),
+    _bufsize(0),
+    _agg_renderer(NULL),
+    _view(NULL),
+    _gui(gui),
+    _xid(xid),
+    _sharefd(-1),
+    _viewhidden(false)
+{
+    //GNASH_REPORT_FUNCTION;
+}
+
+HaikuAggGlue::~HaikuAggGlue()
+{
+    //GNASH_REPORT_FUNCTION;
+
+    if (_sharefd != -1)
+    {
+        if (munmap(_sharebuf, _bufsize) == -1)
+            perror("munmap");
+        if (close(_sharefd) == -1)
+            perror("close");
+    }
+
+    delete [] _offscreenbuf;
+}
+
+bool
+HaikuAggGlue::init(int /*argc*/, char*** /*argv*/, BWindow **win, std::string 
sharefilename)
+{
+    //    GNASH_REPORT_FUNCTION;
+    _win = win;
+    assert(_win);
+
+    if (_xid != 0)
+    {
+        _sharefilename = sharefilename;
+
+        _sharefd = open(_sharefilename.c_str(), O_RDWR);
+        if (_sharefd == -1)
+            return false;
+        if (unlink(_sharefilename.c_str()) == -1)
+            QQ(1);
+    }
+
+
+    return true;
+}
+
+
+Renderer*
+HaikuAggGlue::createRenderHandler(int bpp)
+{
+    _bpp = bpp;
+
+    assert(_bpp == 32); // XXX
+
+    const char *pixelformat = "";
+
+    switch (_bpp) {
+        case 32:
+            pixelformat = "BGRA32";
+            // other choices include RGBA32
+            break;
+        case 24:
+            pixelformat = "RGB24";
+            break;
+        case 16:
+            pixelformat = "RGBA16";
+            break;
+      default:
+            log_error (_("AGG's bit depth must be 16, 24 or 32 bits, not 
%d."), _bpp);
+            abort();
+    }
+    _agg_renderer = create_Renderer_agg(pixelformat);
+    if ( ! _agg_renderer )
+    {
+        boost::format fmt = boost::format(
+                    _("Could not create AGG renderer with pixelformat %s")
+                ) % pixelformat;
+        throw GnashException(fmt.str());
+    }
+    return _agg_renderer;
+}
+
+
+void
+HaikuAggGlue::ViewNoMore()
+{
+    _view = NULL;
+}
+
+void
+HaikuAggGlue::ViewNeeded()
+{
+    QQ(8);
+    if (*_win)
+    {
+        QQ(8);
+        if (_view == NULL)
+        {
+            QQ(8);
+            _view = new BeV(_gui);
+            (*_win)->AddChild(_view);
+        }
+        _view->SetBuffer(_offscreenbuf, _width, _height);
+    }
+}
+
+bool
+HaikuAggGlue::prepDrawingArea(int width, int height, boost::uint32_t sdl_flags)
+{
+    (void) sdl_flags;
+
+    assert(width > 0);
+    assert(height > 0);
+    if (_width == width && _height == height)
+        QQ(1);
+        //return true;
+
+    int depth_bytes = _bpp / 8;  // TODO: <Udo> is this correct? Gives 1 for 
15 bit modes!
+
+    assert(_bpp % 8 == 0);
+
+    boost::uint32_t rmask, gmask, bmask, amask;
+
+    switch(_bpp) {
+        case 32: // RGBA32
+            // BGRA32?
+            rmask = 0xFF;
+            gmask = 0xFF << 8;
+            bmask = 0xFF << 16;
+            amask = 0xFF << 24;
+            break;
+        case 24: // RGB24
+            rmask = 0xFF;
+            gmask = 0xFF << 8;
+            bmask = 0xFF << 16;
+            amask = 0;
+            break;
+        case 16: // RGB565: 5 bits for red, 6 bits for green, and 5 bits for 
blue
+            rmask = 0x1F << 11;
+            gmask = 0x3F << 5;
+            bmask = 0x1F;
+            amask = 0;
+            break;
+        default:
+            abort();
+    }
+
+#define CHUNK_SIZE (100 * 100 * depth_bytes)
+
+    int bufsize = static_cast<int>(width * height * depth_bytes / CHUNK_SIZE + 
1) * CHUNK_SIZE;
+
+    if (_xid != 0)
+    {
+        int pagesize = getpagesize();
+        bufsize = ((bufsize + pagesize - 1) / pagesize) * pagesize;
+    }
+
+    if (_bufsize != (unsigned)bufsize)
+    {
+        if (_xid != 0 && _bufsize != 0)
+        {
+            if (msync(_sharebuf, _bufsize, MS_INVALIDATE) != 0)
+                perror("msync");
+            if (munmap(_sharebuf, _bufsize) != 0)
+                perror("munmap");
+        }
+
+        delete [] _offscreenbuf;
+        _bufsize = bufsize;
+        _offscreenbuf = new unsigned char[bufsize];
+        //BlankScreen();
+
+        if (_xid != 0)
+        {
+            _sharebuf =
+                static_cast<unsigned char*>(
+                mmap(
+                    (caddr_t)0,
+                    _bufsize,
+                    PROT_READ|PROT_WRITE,
+                    MAP_SHARED,
+                    _sharefd,
+                    0
+            ));
+            if (_sharebuf == (void*) -1)
+            {
+                perror("mmap");
+                exit(1);
+            }
+            memset(_sharebuf, 0xcc, _bufsize);
+        }
+
+        log_debug (_("SDL-AGG: %i byte offscreen buffer allocated"), bufsize);
+    }
+    _width = width;
+    _height = height;
+
+
+    // Only the AGG renderer has the function init_buffer, which is *not* part 
of
+    // the renderer api. It allows us to change the renderers movie size (and 
buffer
+    // address) during run-time.
+    Renderer_agg_base * renderer =
+        static_cast<Renderer_agg_base *>(_agg_renderer);
+    renderer->init_buffer(_offscreenbuf, bufsize, width, height,
+            width*((_bpp+7)/8));
+
+    if (_view != NULL)
+        ViewNeeded();
+
+    _validbounds.setTo(0, 0, width-1, height-1);
+
+    return true;
+}
+
+// Modified from fb_gui
+void
+HaikuAggGlue::setInvalidatedRegions(const InvalidatedRanges& ranges)
+{
+    _agg_renderer->set_invalidated_regions(ranges);
+    _drawbounds.clear();
+    
+    for (unsigned int rno=0; rno<ranges.size(); rno++) {
+        geometry::Range2d<int> bounds = Intersection(
+            // twips changed to pixels here
+            _agg_renderer->world_to_pixel(ranges.getRange(rno)),
+            _validbounds);
+            
+        // it may happen that a particular range is out of the screen, which
+        // will lead to bounds==null.
+        if (bounds.isNull()) continue;
+        _drawbounds.push_back(bounds);
+    }
+}
+
+void
+HaikuAggGlue::render()
+{
+    if ( _drawbounds.size() == 0 ) return; // nothing to do..
+    
+    for (unsigned int bno=0; bno < _drawbounds.size(); bno++) {
+        geometry::Range2d<int>& bounds = _drawbounds[bno];
+        render(bounds.getMinX(), bounds.getMinY(),
+            bounds.getMaxX(), bounds.getMaxY() );
+    }
+}
+
+void
+HaikuAggGlue::render(int minx, int miny, int maxx, int maxy)
+{
+    if (*_win)
+    {
+        assert(_view);
+        _view->LockLooper();
+        // Update only the invalidated rectangle
+        _view->Invalidate(BRect(minx,miny,maxx,maxy));
+        _view->UnlockLooper();
+    }
+    if (_xid != 0)
+    {
+        if (_viewhidden == false)
+            memmove(_sharebuf, _offscreenbuf, _bufsize);
+    }
+}
+
+void
+HaikuAggGlue::Shown()
+{
+    _viewhidden = false;
+}
+
+void
+HaikuAggGlue::Hidden()
+{
+    _viewhidden = true;
+}
+
+//void
+//HaikuAggGlue::BlankScreen()
+//{
+//    memset(_offscreenbuf, 0xcc, _bufsize);
+//}
+
+
+} // namespace gnash
+

=== added file 'gui/haiku_agg_glue.h'
--- a/gui/haiku_agg_glue.h      1970-01-01 00:00:00 +0000
+++ b/gui/haiku_agg_glue.h      2010-02-16 20:28:47 +0000
@@ -0,0 +1,87 @@
+//
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc.
+//
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef HAIKU_AGG_GLUE_H
+#define HAIKU_AGG_GLUE_H
+
+#include <boost/cstdint.hpp> // for boost::?int??_t 
+#include <Renderer.h>
+
+#include <SupportDefs.h>
+
+class BWindow;
+
+namespace gnash
+{
+
+class Gui;
+class BeV;
+
+/* copy in plugin.cpp */
+const int GNASH_MOUSE_CLICKED = 'GMCL';
+const int GNASH_MOUSE_MOVED = 'GMMV';
+const int GNASH_KEY_EVENT = 'GKKE';
+const int GNASH_RESIZE = 'GRSZ';
+const int GNASH_HIDDEN = 'GHID';
+const int GNASH_SHOWN = 'GSHN';
+
+
+const int GNASH_SET_FULLSCREEN = 'GSFS';
+const int GNASH_UNSET_FULLSCREEN = 'GUFS';
+
+class HaikuAggGlue
+{
+  public:
+    HaikuAggGlue(Gui *gui, unsigned long xid);
+    virtual ~HaikuAggGlue();
+
+    bool init(int argc, char **argv[], BWindow **win, std::string 
sharefilename);
+    Renderer* createRenderHandler(int depth);
+    void setInvalidatedRegions(const InvalidatedRanges& ranges);
+    void ViewNoMore();
+    void ViewNeeded();
+    bool prepDrawingArea(int width, int height, boost::uint32_t sdl_flags);
+    boost::uint32_t maskFlags(boost::uint32_t sdl_flags);
+    void render();
+    void render(int minx, int miny, int maxx, int maxy);
+    void Shown();
+    void Hidden();
+    //void BlankScreen();
+  private:
+    unsigned char   *_offscreenbuf;
+    unsigned char   *_sharebuf;
+    int _width, _height;
+    unsigned int _bufsize;
+    Renderer  *_agg_renderer;
+    
+    geometry::Range2d<int> _validbounds;
+    std::vector< geometry::Range2d<int> > _drawbounds;
+    int _bpp;
+    BWindow **_win;
+    BeV *_view;
+    Gui *_gui;
+    unsigned long _xid;
+    std::string _sharefilename;
+    int _sharefd;
+    bool _viewhidden;
+};
+
+}
+
+#endif
+

=== added file 'gui/haikusup.h'
--- a/gui/haikusup.h    1970-01-01 00:00:00 +0000
+++ b/gui/haikusup.h    2010-02-16 20:28:47 +0000
@@ -0,0 +1,87 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+#ifndef HAIKUGUI_H
+#define HAIKUGUI_H
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "gui.h"
+
+#ifndef RENDERER_AGG
+#error "Haiku GUI needs AGG renderer"
+#endif
+
+#include "haiku_agg_glue.h"
+
+class BMessageRunner;
+
+
+namespace gnash
+{
+class BeApp;
+
+
+
+class HaikuGui : public Gui
+{
+    BeApp *_app;
+    BMessageRunner *_rnr;
+#ifdef RENDERER_AGG
+    HaikuAggGlue _glue;
+#endif
+    unsigned int _timeout;
+    std::string _sharefilename;
+public:
+    HaikuGui(unsigned long xid, float scale, bool loop, RunResources& r);
+    virtual ~HaikuGui();
+
+    virtual bool init(int argc, char **argv[]);
+    void init_dumpfile();
+    virtual bool createWindow(const char *title, int width, int height,
+                              int xPosition = 0, int yPosition = 0);
+    virtual bool run();
+    virtual bool createMenu();
+    virtual bool createMenuBar();
+    virtual bool setupEvents();
+    virtual void setFullscreen();
+    virtual void unsetFullscreen();
+    virtual void setFullscreenEtc();
+    virtual void unsetFullscreenEtc();
+    virtual void renderBuffer();
+    virtual void setInterval(unsigned int interval);
+    virtual void setTimeout(unsigned int timeout);
+    virtual void error(const std::string &msg);
+    virtual bool yesno(const std::string &question);
+
+    void GnashPulse();
+    virtual void resize_view(int width, int height);
+    void Shown();
+    void Hidden();
+
+    void setInvalidatedRegions(const InvalidatedRanges& ranges);
+};
+
+
+};
+
+#endif
+

=== modified file 'gui/kde_glue_agg.cpp'
--- a/gui/kde_glue_agg.cpp      2010-01-11 06:41:38 +0000
+++ b/gui/kde_glue_agg.cpp      2010-02-23 17:40:25 +0000
@@ -21,7 +21,6 @@
 #include "gnashconfig.h"
 #endif
 
-
 #if GNASH_QT_VERSION == 4
 #include <Qt/qpixmap.h>
 #include <Qt/qcolor.h>
@@ -34,6 +33,7 @@
 #include "kde_glue_agg.h"
 #include "Renderer.h"
 #include "Renderer_agg.h"
+#include "GnashException.h"
 
 namespace gnash
 {
@@ -152,9 +152,8 @@
 {
     // QT requires the use of this pixel format...
     _renderer = create_Renderer_agg("BGRA32");
-    if ( ! _renderer )
-    {
-        throw GnashException("Could not create AGG renderer with pixelformat 
BGRA32");
+    if (! _renderer) {
+        throw GnashException(_("Could not create AGG renderer with pixelformat 
BGRA32"));
     }
     return _renderer;
 }

=== modified file 'gui/riscos_glue_agg.cpp'
--- a/gui/riscos_glue_agg.cpp   2010-01-11 06:41:38 +0000
+++ b/gui/riscos_glue_agg.cpp   2010-02-23 17:06:43 +0000
@@ -66,6 +66,9 @@
 RiscosAggGlue::createRenderHandler()
 {
   _agg_renderer = create_Renderer_agg("RGB24");
+  if (! _agg_renderer) {
+      throw GnashException(_("Could not create AGG renderer with pixelformat 
RGB24"));
+  }
   return _agg_renderer;
 }
 

=== modified file 'libbase/Makefile.am'
--- a/libbase/Makefile.am       2010-02-23 15:28:45 +0000
+++ b/libbase/Makefile.am       2010-02-26 03:34:11 +0000
@@ -67,7 +67,6 @@
        log.cpp \
        memory.cpp \
        rc.cpp \
-       SharedMem.cpp \
        sharedlib.cpp \
        string_table.cpp \
        tu_file.cpp \
@@ -86,6 +85,13 @@
        arg_parser.cpp \
        $(NULL)
 
+
+if BUILD_HAIKU_GUI
+libgnashbase_la_SOURCES += SharedMemHaiku.cpp
+else
+libgnashbase_la_SOURCES += SharedMem.cpp
+endif
+
 edit = sed \
        -e 's|@address@hidden|$(DEFAULT_FLASH_PLATFORM_ID)|g' \
        -e 's|@address@hidden|$(DEFAULT_FLASH_MAJOR_VERSION)|g' \
@@ -114,6 +120,10 @@
 libltdlc_la_SOURCES = $(top_srcdir)/libltdl/ltdl.c
 endif
 
+if BUILD_HAIKU_GUI
+  libgnashbase_la_LIBADD += $(HAIKU_LIBS)
+endif
+
 if WIN32
   libgnashbase_la_LIBADD += -lws2_32 -lwinmm
 endif

=== modified file 'libbase/SharedMem.cpp'
--- a/libbase/SharedMem.cpp     2010-02-11 12:15:10 +0000
+++ b/libbase/SharedMem.cpp     2010-02-17 16:56:43 +0000
@@ -25,15 +25,15 @@
 #include <unistd.h>
 #include <dirent.h>
 #include <fcntl.h>
-#if !defined(HAVE_WINSOCK_H) && !defined(__riscos__) && !defined(__OS2__)
-#include <sys/mman.h>
-#include <sys/shm.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
+#if !defined(HAVE_WINSOCK_H) && !defined(__riscos__) && !defined(__OS2__) && 
!defined(HAIKU_HOST)
+# include <sys/mman.h>
+# include <sys/shm.h>
+# include <sys/ipc.h>
+# include <sys/sem.h>
 #elif !defined(__riscos__) && !defined(__OS2__)
-#include <windows.h>
-#include <process.h>
-#include <io.h>
+# include <windows.h>
+# include <process.h>
+# include <io.h>
 #endif
 #include <string>
 #include <vector>
@@ -219,9 +219,7 @@
 #else
 # error "You need SYSV Shared memory support to use this option"
 #endif
-}    
-
-
+}
 
 } // end of gnash namespace
 

=== modified file 'libbase/SharedMem.h'
--- a/libbase/SharedMem.h       2010-02-24 15:26:20 +0000
+++ b/libbase/SharedMem.h       2010-02-26 03:34:11 +0000
@@ -23,10 +23,10 @@
 #include <boost/cstdint.hpp>
 
 #include <sys/types.h>
-#if !defined(HAVE_WINSOCK_H) && !defined(__riscos__) && !defined(__OS2__)
+#if !defined(HAVE_WINSOCK_H) && !defined(__riscos__) && !defined(__OS2__) && 
!defined(__HAIKU__)
 # include <sys/ipc.h>
 # include <sys/shm.h>
-#elif !defined(__riscos__) && !defined(__OS2__)
+#elif !defined(__riscos__) && !defined(__OS2__) && !defined(__HAIKU__)
 # include <windows.h>
 # include <process.h>
 # include <fcntl.h>

=== added file 'libbase/SharedMemHaiku.cpp'
--- a/libbase/SharedMemHaiku.cpp        1970-01-01 00:00:00 +0000
+++ b/libbase/SharedMemHaiku.cpp        2010-02-17 17:57:51 +0000
@@ -0,0 +1,87 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// This is generated by autoconf
+#ifdef HAVE_CONFIG_H
+# include "gnashconfig.h"
+#endif
+
+#include <sys/types.h>
+#if !defined(HAVE_WINSOCK_H) && !defined(__riscos__) && !defined(__OS2__) && 
!defined(__HAIKU__)
+# include <sys/ipc.h>
+# include <sys/shm.h>
+#elif !defined(__riscos__) && !defined(__OS2__) && !defined(__HAIKU__)
+# include <windows.h>
+# include <process.h>
+# include <fcntl.h>
+# include <io.h>
+#endif
+
+#include "log.h"
+#include "rc.h"
+#include "SharedMem.h"
+
+namespace {
+    gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance();
+}
+
+namespace gnash {
+
+SharedMem::SharedMem(size_t size)
+    :
+    _addr(0),
+    _size(size),
+    _semid(0),
+    _shmid(0),
+    _shmkey(0)
+{
+    log_unimpl(_("%s on Haiku"), __FUNCTION__);
+}
+
+SharedMem::~SharedMem()
+{
+    log_unimpl(_("%s on Haiku"), __FUNCTION__);
+}
+
+bool
+SharedMem::lock()
+{
+    log_unimpl(_("%s on Haiku"), __FUNCTION__);
+    return false;
+}
+
+bool
+SharedMem::unlock()
+{
+    log_unimpl(_("%s on Haiku"), __FUNCTION__);
+    return false;
+}
+
+bool
+SharedMem::attach()
+{
+    log_unimpl(_("%s on Haiku"), __FUNCTION__);
+    return false;
+}
+
+} // end of gnash namespace
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

=== modified file 'libbase/rc.cpp'
--- a/libbase/rc.cpp    2010-02-11 08:33:14 +0000
+++ b/libbase/rc.cpp    2010-02-25 02:30:12 +0000
@@ -45,6 +45,11 @@
 
 #include <boost/format.hpp>
 
+#ifdef HAIKU_HOST
+# include <Path.h>
+# include <FindDirectory.h>
+#endif
+
 using std::endl;
 using std::cout;
 using std::cerr;
@@ -152,15 +157,28 @@
 #endif
     
     // Check the users home directory
-#ifndef __amigaos4__
-        char *home = std::getenv("HOME");
+    const char *home = 0;
+    //on AmigaOS we have a GNASH: assign that point to program dir
+#if defined (__amigaos4__)
+    home = "/gnash";
+#elif defined(HAIKU_HOST)
+    BPath bp;
+    if (B_OK != find_directory(B_USER_SETTINGS_DIRECTORY, &bp)) {
+       log_error(_("Failed to find user settings directory"));
+    } else {
+       bp.Append("Gnash");
+       home = bp.Path();
+    }
 #else
-               //on AmigaOS we have a GNASH: assign that point to program dir
-        char *home = "/gnash";
+    home = std::getenv("HOME");
 #endif
     if (home) {
         loadfile = home;
+#ifdef HAIKU_HOST
+        loadfile.append("/gnashrc");
+#else
         loadfile.append("/.gnashrc");
+#endif
         parseFile(loadfile);
     }
 
@@ -544,7 +562,10 @@
                  extractSetting(_sollocaldomain, "solLocalDomain", variable,
                            value)
             ||
-                 extractSetting(_lcdisabled, "LocalConnection", variable,
+                extractSetting(_lcdisabled, "LocalConnection", variable,
+                           value)
+            ||
+                extractSetting(_lctrace, "LCTrace", variable,
                            value)
             ||
                  extractNumber(_movieLibraryLimit, "movieLibraryLimit",
@@ -582,8 +603,7 @@
                              "\"%s\" in rcfile %s line %d")) 
                              % variable % filespec % lineno << endl;
             }
-        }
-        else if (noCaseCompare(action, "include")) {
+        } else if (noCaseCompare(action, "include")) {
             //cout << "Include directive in " << filespec << endl; 
             // TODO: resolve relative paths ?
             // TODO: skip parsing if already parsed ?
@@ -594,8 +614,7 @@
                 cerr << boost::format(_("Warning: empty include "
                             "specification in rcfile %s, line %d"))
                             % filespec % lineno << endl;
-            }
-            else {
+            } else {
                 if ( variable[0] != '/' ) {
                     cerr << boost::format(_("Warning: include specification "
                                 "must be an absolute path in rcfile %s, "
@@ -605,8 +624,7 @@
                     parseFile(variable);
                 }
             }
-        }
-        else {
+        } else {
             cerr << boost::format(_("Warning: unrecognized action \"%s\" in "
                 "rcfile %s, line %d")) % action % filespec % lineno << endl;
         }
@@ -643,32 +661,43 @@
         
         std::string::size_type pos = filelist.find_last_of(':');
         
-        if (pos == std::string::npos)
-        {
+        if (pos == std::string::npos) {
             // no separator: just one file.
             writefile = filelist;
-        }
-        else
-        {
+        } else {
             writefile = filelist.substr(pos + 1);
         }
-    }
-    else
-    {
-        // Check the users home directory    
-#ifndef __amigaos4__
-        char *home = std::getenv("HOME");
+    } else {
+        // Check the users home directory
+        const char *home = NULL;
+#if defined(__amigaos4__)
+        //on AmigaOS we have a GNASH: assign that point to program dir
+        home = "/gnash";
+#elif defined(HAIKU_HOST)
+        BPath bp;
+        if (B_OK != find_directory(B_USER_SETTINGS_DIRECTORY, &bp)) {
+            log_error(_("Failed to find user settings directory"));
+        } else {
+            bp.Append("Gnash");
+            home = bp.Path();
+        }
 #else
-               //on AmigaOS we have a GNASH: assign that point to program dir
-        char *home = "/gnash";
+       //on AmigaOS we have a GNASH: assign that point to program dir
+       home = std::getenv("HOME");
 #endif
         if (home) {
             writefile = home;
-            writefile.append("/.gnashrc");
+#ifdef HAIKU_HOST
+            writefile.append("/gnashrc");
+#else
+           writefile.append("/.gnashrc");
+#endif
         }
     }
     
-    if (writefile.empty()) return false;
+    if (writefile.empty()) {
+       return false;
+    }
 
     return updateFile(writefile);
 
@@ -722,9 +751,10 @@
     cmd << "delay " << _delay << endl <<
     cmd << "verbosity " << _verbosity << endl <<
     cmd << "solReadOnly " << _solreadonly << endl <<
-       cmd << "solLocalDomain " << _sollocaldomain << endl <<
+    cmd << "solLocalDomain " << _sollocaldomain << endl <<
     cmd << "SOLSafeDir " << _solsandbox << endl <<
     cmd << "localConnection " << _lcdisabled << endl <<
+    cmd << "LCTrace " << _lctrace << endl <<
     cmd << "LCShmkey " << std::hex << (boost::uint32_t) _lcshmkey << endl <<
     cmd << "ignoreFSCommand " << _ignoreFSCommand << endl <<    
     cmd << "saveStreamingMedia " << _saveStreamingMedia << endl <<    

=== modified file 'libbase/rc.h'
--- a/libbase/rc.h      2010-02-11 08:33:14 +0000
+++ b/libbase/rc.h      2010-02-17 17:36:28 +0000
@@ -29,11 +29,13 @@
 #include <boost/cstdint.hpp>
 #include <boost/tokenizer.hpp>
 
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__HAIKU__)
 #include <sys/shm.h>
 #else
-typedef boost::uint32_t key_t;
+#ifdef _WIN32
+  typedef boost::uint32_t key_t;
 #endif // _WIN32
+#endif // _WIN32 and __HAIKU__
 
 namespace gnash {
   
@@ -259,6 +261,11 @@
     
     void setLocalConnection(bool x) { _lcdisabled = x; }
     
+    /// \brief Enable tracing all LocalConnection traffic
+    bool getLCTrace() const { return _lctrace; }
+    
+    void setLCTrace(bool x) { _lctrace = x; }
+
     key_t getLCShmKey() const { return static_cast<key_t>(_lcshmkey); }
     
     void setLCShmKey(bool x) { _lcshmkey = x; }

=== modified file 'libbase/utf8.h'
--- a/libbase/utf8.h    2010-01-18 07:35:15 +0000
+++ b/libbase/utf8.h    2010-02-23 17:06:43 +0000
@@ -24,6 +24,7 @@
 #include "dsodefs.h" // For DSOEXPORT
 #include "utility.h"
 #include <string>
+
 #include <boost/cstdint.hpp> // for C99 int types
 #include <limits>
 

=== modified file 'libbase/utility.h'
--- a/libbase/utility.h 2010-01-11 06:41:38 +0000
+++ b/libbase/utility.h 2010-02-17 02:31:29 +0000
@@ -27,6 +27,7 @@
 
 #include <cstdlib>
 #include <cassert>
+#include <cstring>
 #include <string>
 #include <typeinfo>
 
@@ -60,6 +61,45 @@
 };
 #endif
 
+#if defined(__HAIKU__)
+namespace std {
+       class wstring : public std::basic_string<wchar_t>
+       {
+       public:
+               wstring(const char *t)
+                       : std::basic_string<wchar_t>(_ble(t))
+               {
+                       delete [] X;
+               }
+               wstring()
+               {
+               }
+               wstring(const wstring &that)
+                       : std::basic_string<wchar_t>(that)
+               {
+               }
+               wstring(const std::basic_string<wchar_t> &that)
+                       : std::basic_string<wchar_t>(that)
+               {
+               }
+       private:
+               wchar_t *X;
+               
+               wchar_t* _ble(const char *t)
+               {
+                       size_t l = strlen(t);
+                       wchar_t *cp = new wchar_t[l+1];
+                       for (size_t i = 0; i < l; ++i) {
+                               cp[i] = t[i];
+                       }
+                       cp[l] = '\0';
+                       X = cp;
+                       return X;
+               }
+       };
+};
+#endif
+
 namespace gnash {
 
 /// Return (unmangled) name of this instance type. Used for

=== modified file 'libcore/FreetypeGlyphsProvider.cpp'
--- a/libcore/FreetypeGlyphsProvider.cpp        2010-01-22 13:45:28 +0000
+++ b/libcore/FreetypeGlyphsProvider.cpp        2010-02-23 17:06:43 +0000
@@ -51,6 +51,11 @@
 # include <fontconfig/fcfreetype.h>
 #endif
 
+#ifdef HAIKU_HOST
+# include <Path.h>
+# include <FindDirectory.h>
+#endif
+
 #include <string>
 #include <memory> // for auto_ptr
 #include <boost/cstdint.hpp>
@@ -244,7 +249,7 @@
 
     if (m_lib) return; 
 
-    int    error = FT_Init_FreeType(&m_lib);
+    int error = FT_Init_FreeType(&m_lib);
     if (error) {
         std::cerr << boost::format(_("Can't init FreeType! Error "
                     "= %d")) % error << std::endl;
@@ -256,34 +261,44 @@
 void FreetypeGlyphsProvider::close()
 {
     int error = FT_Done_FreeType(m_lib);
-    if (error)
-    {
+    if (error) {
         std::cerr << boost::format(_("Can't close FreeType! Error "
-                "= %d")) % error << std::endl;
+                                     "= %d")) % error << std::endl;
     }
 }
 
-
 // private
 bool
 FreetypeGlyphsProvider::getFontFilename(const std::string &name,
-        bool bold, bool italic, std::string& filename)
+   bool bold, bool italic, std::string& filename)
 {
 
+#ifdef HAIKU_HOST
+    // only returns a default
+    BPath bp;
+    if (B_OK != find_directory(B_BEOS_FONTS_DIRECTORY, &bp)) {
+        log_error(_("Failed to find fonts directory, using hard-coded "
+                    "font filename \"%s\""), DEFAULT_FONTFILE);
+        filename = DEFAULT_FONTFILE;
+        return true;
+    }
+    
+    bp.Append("ttfonts/DejaVuSans.ttf");
+    filename = bp.Path();
+    return true;
+#endif
+    
 #ifdef HAVE_FONTCONFIG
-
-    if (!FcInit ())
-    {
-
-        log_error("Can't init fontconfig library, using hard-"
-                "coded font filename");
+    if (!FcInit ()) {        
+        log_error(_("Can't init fontconfig library, using hard-"
+                "coded font filename \"%s\""), DEFAULT_FONTFILE);
         filename = DEFAULT_FONTFILE;
         return true;
         //return false;
     }
     
     FcResult result;
-
+    
     FcPattern* pat = FcNameParse((const FcChar8*)name.c_str());
     
     FcConfigSubstitute (0, pat, FcMatchPattern);
@@ -303,24 +318,20 @@
     FcPatternDestroy (pat);
 
     FcFontSet* fs = NULL;
-    if (match)
-    {
+    if (match) {
         fs = FcFontSetCreate ();
         FcFontSetAdd (fs, match);
     }
 
-    if ( fs )
-    {
+    if ( fs ) {
 #ifdef GNASH_DEBUG_DEVICEFONTS
         log_debug("Found %d fonts matching the family %s (using "
                 "first)", fs->nfont, name);
 #endif
 
-        for (int j = 0; j < fs->nfont; j++)
-        {
+        for (int j = 0; j < fs->nfont; j++) {
             FcChar8 *file;
-            if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &file) != 
FcResultMatch)
-            {
+            if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &file) != 
FcResultMatch) {
 #ifdef GNASH_DEBUG_DEVICEFONTS
         log_debug("Matching font %d has unknown filename, skipping", j);
 #endif
@@ -347,7 +358,7 @@
 #else
     log_error("Font filename matching not implemented (no fontconfig"
             " support built-in), using hard-coded font filename",
-            name);
+            DEFAULT_FONTFILE);
     filename = DEFAULT_FONTFILE;
     return true;
 #endif

=== modified file 'libcore/Makefile.am'
--- a/libcore/Makefile.am       2010-02-20 07:55:10 +0000
+++ b/libcore/Makefile.am       2010-02-26 03:34:11 +0000
@@ -340,6 +340,10 @@
 #      $(top_builddir)/libsound/libgnashsound.la
 # endif
 
+if BUILD_HAIKU_GUI
+  libgnashcore_la_LIBADD += $(HAIKU_LIBS)
+endif
+
 # Rebuild with GCC 4.x Mudflap support
 mudflap:
        @echo "Rebuilding with GCC Mudflap support"

=== modified file 'libcore/asobj/String_as.cpp'
--- a/libcore/asobj/String_as.cpp       2010-01-25 18:52:20 +0000
+++ b/libcore/asobj/String_as.cpp       2010-02-17 02:54:31 +0000
@@ -646,15 +646,32 @@
         currentLocale = std::locale::classic();
     }
 
-    if (currentLocale == std::locale::classic())
-    {
+    if (currentLocale == std::locale::classic()) {
         LOG_ONCE(
             log_error(_("Your locale probably can't convert non-ascii "
             "DisplayObjects to upper case. Using a UTF8 locale may fix 
this."));
         );
     }
 
-    boost::to_upper(wstr, currentLocale);
+#if !defined(__HAIKU__)
+    try {
+        boost::to_upper(wstr, currentLocale);
+    }
+    catch (std::bad_cast&)
+        {
+            // std::use_facet<wchar_t>(currentLocale) called from
+            // boost::to_upper may throw std::bad_cast
+            log_error(_("bad_cast caught"));
+            std::abort();
+        }
+#else
+    size_t l = wstr.size();
+    for (size_t i = 0; i < l; ++i) {
+        if (wstr[i] >= 'a' && wstr[i] <= 'z') {
+            wstr[i] += 'A' - 'a';
+        }
+    }
+#endif
 
     return as_value(utf8::encodeCanonicalString(wstr, version));
 
@@ -691,7 +708,25 @@
         );
     }
 
-    boost::to_lower(wstr, currentLocale);
+#if !defined(__HAIKU__)
+    try {
+        boost::to_lower(wstr, currentLocale);
+    }
+    catch (std::bad_cast&)
+    {
+        // std::use_facet<wchar_t>(currentLocale) called from
+        // boost::to_lower may throw std::bad_cast
+        log_error(_("bad_cast caught"));
+        std::abort();
+    }
+#else
+    size_t l = wstr.size();
+    for (size_t i = 0; i < l; ++i) {
+        if (wstr[i] >= 'A' && wstr[i] <= 'Z') {
+            wstr[i] -= 'A' - 'a';
+        }
+    }
+#endif
 
     return as_value(utf8::encodeCanonicalString(wstr, version));
 }

=== modified file 'libcore/asobj/flash/text/TextField_as.h'
--- a/libcore/asobj/flash/text/TextField_as.h   2010-02-15 14:55:30 +0000
+++ b/libcore/asobj/flash/text/TextField_as.h   2010-02-17 02:54:31 +0000
@@ -17,16 +17,14 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-#ifndef GNASH_TEXTFIELD_AS_H
-#define GNASH_TEXTFIELD_AS_H
-
-namespace gnash {
-    class as_object;
-    class ObjectURI;
-    class Global_as;
-}
-
-namespace gnash {
+#ifndef GNASH_ASOBJ3_TEXTFIELD_AS_H
+#define GNASH_ASOBJ3_TEXTFIELD_AS_H
+
+namespace gnash {
+
+class as_object;
+class ObjectURI;
+class Global_as;
 
 /// Native function to create a plain object with TextField properties
 //
@@ -40,6 +38,7 @@
 
 } // namespace gnash
 
+// end of GNASH_ASOBJ3_TEXTFIELD_H
 #endif
 
 // local Variables:

=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2010-02-14 23:15:56 +0000
+++ b/libcore/vm/ASHandlers.cpp 2010-02-17 02:54:31 +0000
@@ -513,6 +513,10 @@
     catch (ActionParserException& e) {
         log_swferror(_("Malformed action code: %s"), e.what());
     }
+    catch (std::bad_cast&) {
+       log_error(_("bad_cast caught"));
+       std::abort();
+    }
 }
 
 const char*

=== modified file 'libmedia/Makefile.am'
--- a/libmedia/Makefile.am      2010-02-24 16:57:23 +0000
+++ b/libmedia/Makefile.am      2010-02-26 03:34:11 +0000
@@ -155,6 +155,35 @@
        $(NULL)
 endif
 
+if USE_HAIKU_ENGINE
+   libgnashmedia_la_SOURCES += \
+       haiku/MediaHandlerHaiku.cpp \
+       haiku/MediaParserHaiku.cpp \
+       haiku/AudioDecoderHaiku.cpp \
+       haiku/VideoDecoderHaiku.cpp \
+       haiku/VideoConverterHaiku.cpp \
+       haiku/VideoInputHaiku.cpp \
+       haiku/AudioInputHaiku.cpp \
+       $(NULL)
+
+   noinst_HEADERS += \
+       haiku/MediaHandlerHaiku.h \
+       haiku/MediaParserHaiku.h \
+       haiku/AudioDecoderHaiku.h \
+       haiku/VideoDecoderHaiku.h \
+       haiku/VideoConverterHaiku.h \
+       haiku/VideoInputHaiku.h \
+       haiku/AudioInputHaiku.h \
+       $(NULL)
+
+   libgnashmedia_la_LIBADD += \
+       -lmedia \
+       $(NULL)
+
+   libgnashmedia_la_CPPFLAGS += \
+       $(NULL)
+endif
+
 if HAVE_SPEEX
    libgnashmedia_la_LIBADD += \
        $(SPEEX_LIBS) \

=== modified file 'libmedia/ffmpeg/AudioInputFfmpeg.cpp'
--- a/libmedia/ffmpeg/AudioInputFfmpeg.cpp      2010-01-01 17:48:26 +0000
+++ b/libmedia/ffmpeg/AudioInputFfmpeg.cpp      2010-02-17 02:31:29 +0000
@@ -1,4 +1,4 @@
-// AudioInput.cpp: Audio input base class source file.
+// AudioInputFfmpeg.cpp: Audio input base class source file.
 // 
 //   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 // 
@@ -21,7 +21,8 @@
 
 namespace gnash {
 namespace media {
-    
+namespace ffmpeg {
+ 
 AudioInputFfmpeg::AudioInputFfmpeg()
     :
     _activityLevel(-1),
@@ -50,5 +51,6 @@
     _rate = *rate;
 }
 
-} //media namespace
-} //gnash namespace
+} // gnash.media.ffmpeg namespace
+} // gnash.media namespace
+} // gnash namespace

=== modified file 'libmedia/ffmpeg/AudioInputFfmpeg.h'
--- a/libmedia/ffmpeg/AudioInputFfmpeg.h        2010-01-01 17:48:26 +0000
+++ b/libmedia/ffmpeg/AudioInputFfmpeg.h        2010-02-17 02:31:29 +0000
@@ -1,4 +1,4 @@
-// AudioInput.h: Audio input base class
+// AudioInputFfmpeg.h: Audio input base class
 // 
 //   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 // 
@@ -28,6 +28,7 @@
 
 namespace gnash {
 namespace media {
+namespace ffmpeg {
 
 /// A class representing a single AudioInput device.
 class AudioInputFfmpeg : public AudioInput
@@ -116,8 +117,8 @@
     int _silenceTimeout;
     bool _useEchoSuppression;
 };
-
     
+} // gnash.media.ffmpeg namespace
 } // gnash.media namespace 
 } // gnash namespace
 

=== modified file 'libmedia/ffmpeg/MediaParserFfmpeg.cpp'
--- a/libmedia/ffmpeg/MediaParserFfmpeg.cpp     2010-01-01 17:48:26 +0000
+++ b/libmedia/ffmpeg/MediaParserFfmpeg.cpp     2010-02-17 02:31:29 +0000
@@ -1,4 +1,4 @@
-// MediaParserFfmpeg.cpp: FFMPG media parsers, for Gnash
+// MediaParserFfmpeg.cpp: FFMPEG media parsers, for Gnash
 //
 //   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 //

=== modified file 'libmedia/ffmpeg/MediaParserFfmpeg.h'
--- a/libmedia/ffmpeg/MediaParserFfmpeg.h       2010-01-25 18:52:20 +0000
+++ b/libmedia/ffmpeg/MediaParserFfmpeg.h       2010-02-17 02:31:29 +0000
@@ -1,4 +1,4 @@
-// MediaParserFfmpeg.h: FFMPG media parsers, for Gnash
+// MediaParserFfmpeg.h: FFMEPG media parsers, for Gnash
 // 
 //   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 // 

=== modified file 'libmedia/ffmpeg/VideoInputFfmpeg.cpp'
--- a/libmedia/ffmpeg/VideoInputFfmpeg.cpp      2010-01-01 17:48:26 +0000
+++ b/libmedia/ffmpeg/VideoInputFfmpeg.cpp      2010-02-17 02:31:29 +0000
@@ -1,4 +1,4 @@
-// VideoInputFfmpeg.h: Video input processing using Gstreamer
+// VideoInputFfmpeg.h: Video input processing using Ffmpeg
 // 
 //   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 // 

=== modified file 'libmedia/ffmpeg/VideoInputFfmpeg.h'
--- a/libmedia/ffmpeg/VideoInputFfmpeg.h        2010-01-01 17:48:26 +0000
+++ b/libmedia/ffmpeg/VideoInputFfmpeg.h        2010-02-17 02:31:29 +0000
@@ -36,7 +36,7 @@
     /// be queried from the input device.
     VideoInputFfmpeg();
     
-    /// Destructor for the VideoInputGst class
+    /// Destructor for the VideoInputFfmpeg class
     virtual ~VideoInputFfmpeg();
     
     static void getNames(std::vector<std::string>& /*names*/) {}

=== modified file 'libmedia/gst/VideoConverterGst.cpp'
--- a/libmedia/gst/VideoConverterGst.cpp        2010-01-01 17:48:26 +0000
+++ b/libmedia/gst/VideoConverterGst.cpp        2010-02-17 02:31:29 +0000
@@ -19,12 +19,11 @@
 #include "log.h"
 #include <cassert>
 
-
 namespace gnash {
 namespace media {
 namespace gst {
 
-/// Base class for video image space conversion.
+/// Base class for video image space conversion with gst
 
 VideoConverterGst::VideoConverterGst(ImgBuf::Type4CC srcFormat, 
ImgBuf::Type4CC dstFormat)
     : VideoConverter(srcFormat, dstFormat)

=== modified file 'libmedia/gst/VideoConverterGst.h'
--- a/libmedia/gst/VideoConverterGst.h  2010-01-01 17:48:26 +0000
+++ b/libmedia/gst/VideoConverterGst.h  2010-02-17 02:31:29 +0000
@@ -21,15 +21,13 @@
 #include "VideoConverter.h"
 #include "swfdec_codec_gst.h"
 
-
-
 #include <gst/gst.h>
 
 namespace gnash {
 namespace media {
 namespace gst {
 
-/// Base class for video image space conversion.
+/// Base class for video image space conversion with gst
 
 class VideoConverterGst : public VideoConverter {
 

=== added directory 'libmedia/haiku'
=== added file 'libmedia/haiku/AudioDecoderHaiku.cpp'
--- a/libmedia/haiku/AudioDecoderHaiku.cpp      1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/AudioDecoderHaiku.cpp      2010-02-17 02:21:56 +0000
@@ -0,0 +1,85 @@
+// AudioDecoderHaiku.cpp: Audio decoding using the Haiku media kit.
+// 
+//   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+
+#include "AudioDecoderHaiku.h"
+//#include "MediaParserHaiku.h" // for ExtraAudioInfoHaiku
+#include "FLVParser.h"
+#include "SoundInfo.h"
+#include "MediaParser.h" // for AudioInfo
+
+#include "adipe.h"
+
+//#include <cmath> // for std::ceil
+//#include <algorithm> // for std::copy, std::max
+
+//#define GNASH_DEBUG_AUDIO_DECODING
+
+namespace gnash {
+namespace media {
+namespace haiku {
+
+AudioDecoderHaiku::AudioDecoderHaiku(const AudioInfo& info)
+{
+    QQ(2);
+}
+
+AudioDecoderHaiku::AudioDecoderHaiku(SoundInfo& info)
+{
+    QQ(2);
+}
+
+AudioDecoderHaiku::~AudioDecoderHaiku()
+{
+    QQ(2);
+}
+
+boost::uint8_t*
+AudioDecoderHaiku::decode(const boost::uint8_t* input, boost::uint32_t 
inputSize, boost::uint32_t& outputSize, boost::uint32_t& decodedBytes, bool 
parse)
+{
+    (void) input;
+    (void) parse;
+    boost::uint8_t *t;
+    outputSize = 2048;
+    decodedBytes = inputSize;
+    t = new boost::uint8_t[outputSize];
+
+    boost::uint16_t *data =
+        reinterpret_cast<boost::uint16_t*>(t);
+
+    for (size_t i = 0; i < outputSize / sizeof(boost::uint16_t); ++i)
+    {
+        data[i] = 1000 * sin(i/10.);
+    }
+
+
+    return t;
+}
+
+boost::uint8_t*
+AudioDecoderHaiku::decode(const EncodedAudioFrame& af, boost::uint32_t& 
outputSize)
+{
+    QQ(2);
+    return NULL;
+}
+
+
+} // gnash.media.haiku namespace 
+} // gnash.media namespace 
+} // gnash namespace

=== added file 'libmedia/haiku/AudioDecoderHaiku.h'
--- a/libmedia/haiku/AudioDecoderHaiku.h        1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/AudioDecoderHaiku.h        2010-02-17 02:21:56 +0000
@@ -0,0 +1,103 @@
+// AudioDecoderHaiku.h: Audio decoding using the Haiku media kit.
+// 
+//   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+#ifndef GNASH_AUDIODECODERHAIKU_H
+#define GNASH_AUDIODECODERHAIKU_H
+
+#include "log.h"
+#include "AudioDecoder.h" // for inheritance
+
+// Forward declarations
+namespace gnash {
+    namespace media {
+        class SoundInfo;
+        class AudioInfo;
+    }
+}
+
+namespace gnash {
+namespace media {
+namespace haiku {
+
+/// Haiku media kit based AudioDecoder
+class AudioDecoderHaiku : public AudioDecoder {
+       
+public:
+       /// @param info
+       ///     AudioInfo class with all the info needed to decode
+       ///     the sound correctly. Throws a MediaException on fatal
+       ///     error.
+       AudioDecoderHaiku(const AudioInfo& info);
+
+       /// @param info
+       ///     SoundInfo class with all the info needed to decode
+       ///     the sound correctly. Throws a MediaException on fatal
+       ///     error.
+       AudioDecoderHaiku(SoundInfo& info);
+       ~AudioDecoderHaiku();
+
+    // See dox in AudioDecoder.h
+       boost::uint8_t* decode(const boost::uint8_t* input, boost::uint32_t 
inputSize, boost::uint32_t& outputSize, boost::uint32_t& decodedBytes, bool 
parse);
+
+       boost::uint8_t* decode(const EncodedAudioFrame& af, boost::uint32_t& 
outputSize);
+
+private:
+//
+//     void setup(const AudioInfo& info);
+//     void setup(SoundInfo& info);
+//
+//     boost::uint8_t* decodeFrame(const boost::uint8_t* input, 
boost::uint32_t inputSize, boost::uint32_t& outputSize);
+//
+//     AVCodec* _audioCodec;
+//     AVCodecContext* _audioCodecCtx;
+//     AVCodecParserContext* _parser;
+//
+//     // Use for resampling audio
+//     AudioResamplerFfmpeg _resampler;
+//
+//    /// True if a parser is required to decode the format
+//    bool _needsParsing;
+//
+//    /// Parse input
+//    //
+//    /// @param input
+//    ///     Pointer to frame we want to start parsing at.
+//    ///
+//    /// @param inputSize
+//    ///     Number of bytes available in input
+//    ///
+//    /// @param outFrame
+//    ///     Output parameter, will be set to the start
+//    ///     of first frame found in input.
+//    ///
+//    /// @param outFrameSize
+//    ///     Output parameter, will be set to size in bytes
+//    ///     of the first frame found.
+//    ///
+//    /// @return number of input bytes parsed, or -1 on error
+//    ///
+//    int parseInput(const boost::uint8_t* input, boost::uint32_t inputSize,
+//            boost::uint8_t const ** outFrame, int* outFrameSize);
+};
+       
+} // gnash.media.haiku namespace 
+} // gnash.media namespace 
+} // gnash namespace
+
+#endif // __AUDIODECODERHAIKU_H__

=== added file 'libmedia/haiku/AudioInputHaiku.cpp'
--- a/libmedia/haiku/AudioInputHaiku.cpp        1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/AudioInputHaiku.cpp        2010-02-17 02:21:56 +0000
@@ -0,0 +1,56 @@
+// AudioInputHaiku.cpp: Audio input with Haiku media kit
+// 
+//   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#include "AudioInputHaiku.h"
+#include "gnashconfig.h"
+
+namespace gnash {
+namespace media {
+namespace haiku {
+    
+AudioInputHaiku::AudioInputHaiku()
+    :
+    _activityLevel(-1),
+    _gain(50),
+    _index(0),
+    _muted(true),
+    _rate(8),
+    _silenceLevel(10),
+    _silenceTimeout(2000), 
+    _useEchoSuppression(false)
+{
+} 
+    
+void
+AudioInputHaiku::setRate(int r)
+{
+    // Yes, this isn't pretty, but it is only designed for the 
+    // testsuite to continue passing.
+    if (r >= 44) {
+        _rate = 44;
+        return;
+    }
+    static const int rates[] = { 5, 8, 11, 16, 22, 44 };
+    const int* rate = rates;
+    while (*rate < r) ++rate;
+    _rate = *rate;
+}
+
+} //gnash.media.haiku namespace
+} //gnash.media namespace
+} //gnash namespace

=== added file 'libmedia/haiku/AudioInputHaiku.h'
--- a/libmedia/haiku/AudioInputHaiku.h  1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/AudioInputHaiku.h  2010-02-17 02:21:56 +0000
@@ -0,0 +1,126 @@
+// AudioInputHaiku.h: Audio input with Haiku media kit
+// 
+//   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef GNASH_AUDIOINPUT_HAIKU_H
+#define GNASH_AUDIOINPUT_HAIKU_H
+
+#include "dsodefs.h" //DSOEXPORT
+#include "AudioInput.h"
+
+#include <boost/cstdint.hpp> // for C99 int types
+#include <string>
+#include <vector>
+
+namespace gnash {
+namespace media {
+namespace haiku {
+
+/// A class representing a single AudioInput device.
+class AudioInputHaiku : public AudioInput
+{
+    
+public:
+
+    DSOEXPORT AudioInputHaiku();
+
+    virtual ~AudioInputHaiku() {}
+    
+    //setters and getters
+    virtual void setActivityLevel(double a) {
+        _activityLevel = a;
+    }
+
+    virtual double activityLevel() const {
+        return _activityLevel;
+    }
+    
+    virtual void setGain(double g) {
+        _gain = g;
+    }
+
+    virtual double gain() const {
+        return _gain;
+    }
+    
+    virtual void setIndex(int i) {
+        _index = i;
+    }
+
+    virtual int index() const {
+        return _index; 
+    }
+    
+    virtual bool muted() {
+        return _muted;
+    }
+    
+    virtual void setName(std::string name) {
+        _name = name;
+    }
+
+    virtual const std::string& name() const { return _name; }
+    
+    virtual void setRate(int r);
+
+    virtual int rate() const {
+        return _rate;
+    }
+    
+    virtual void setSilenceLevel(double s) {
+        _silenceLevel = s;
+    }
+    
+    virtual double silenceLevel() const {
+        return _silenceLevel;
+    }
+    
+    virtual void setSilenceTimeout(int s) {
+        _silenceTimeout = s;
+    }
+    
+    virtual int silenceTimeout() const {
+        return _silenceTimeout;
+    }
+    
+    virtual void setUseEchoSuppression(bool e) {
+        _useEchoSuppression = e;
+    }
+
+    virtual bool useEchoSuppression() const {
+        return _useEchoSuppression;
+    }
+    
+private:
+
+    double _activityLevel;
+    double _gain;
+    int _index;
+    bool _muted;
+    std::string _name;
+    int _rate;
+    double _silenceLevel;
+    int _silenceTimeout;
+    bool _useEchoSuppression;
+};
+
+    
+} // gnash.media.haiku namespace
+} // gnash.media namespace 
+} // gnash namespace
+
+#endif 

=== added file 'libmedia/haiku/MediaHandlerHaiku.cpp'
--- a/libmedia/haiku/MediaHandlerHaiku.cpp      1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/MediaHandlerHaiku.cpp      2010-02-17 02:21:56 +0000
@@ -0,0 +1,150 @@
+// MediaHandlerHaiku.cpp: Haiku media kit media handler, for Gnash
+// 
+//   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "log.h"
+#include "MediaHandlerHaiku.h"
+#include "MediaParserHaiku.h"
+#include "VideoDecoderHaiku.h"
+#include "AudioDecoderHaiku.h"
+#include "GnashException.h"
+#include "FLVParser.h"
+#include "VideoConverterHaiku.h"
+#include "VideoInputHaiku.h"
+#include "AudioInputHaiku.h"
+
+#include "adipe.h"
+
+#include "IOChannel.h" // for visibility of destructor
+#include "MediaParser.h" // for visibility of destructor
+
+namespace gnash { 
+namespace media {
+namespace haiku {
+
+std::auto_ptr<MediaParser>
+MediaHandlerHaiku::createMediaParser(std::auto_ptr<IOChannel> stream)
+{
+       std::auto_ptr<MediaParser> parser;
+
+    try {
+        if (isFLV(*stream))
+        {
+            parser.reset(new FLVParser(stream));
+        }
+        else
+        {
+                       parser.reset(new MediaParserHaiku(stream));
+               }
+    }
+    catch (GnashException& ex)
+    {
+        log_error("Could not create Haiku media parser for "
+                "input stream: %s", ex.what());
+        assert(!parser.get());
+    }
+
+       return parser;
+}
+
+std::auto_ptr<VideoDecoder>
+MediaHandlerHaiku::createVideoDecoder(const VideoInfo& info)
+{
+       std::auto_ptr<VideoDecoder> ret(new VideoDecoderHaiku(info));
+       return ret;
+}
+
+std::auto_ptr<VideoConverter>
+MediaHandlerHaiku::createVideoConverter(ImgBuf::Type4CC srcFormat,
+                                         ImgBuf::Type4CC dstFormat)
+{
+    std::auto_ptr<VideoConverter> converter;
+
+    try
+    {
+        converter.reset(new VideoConverterHaiku(srcFormat, dstFormat));
+    }
+    catch (GnashException& ex)
+    {
+        log_error("Could not create Haiku based video converter parser for "
+                "input format: %s", ex.what());
+    }
+    
+    return converter;
+}
+
+
+std::auto_ptr<AudioDecoder>
+MediaHandlerHaiku::createAudioDecoder(const AudioInfo& info)
+{
+       std::auto_ptr<AudioDecoder> ret;
+
+    try
+    {
+        ret.reset(new AudioDecoderHaiku(info));
+    }
+    catch (MediaException& ex)
+    {
+        if ( info.type != FLASH ) throw ex;
+
+        try
+        {
+            ret = createFlashAudioDecoder(info);
+        } 
+        catch (MediaException& ex2)
+        {
+            boost::format err = boost::format(
+                _("MediaHandlerHaiku::createAudioDecoder: %s "
+                  "-- %s")) %
+                ex.what() % ex2.what();
+            throw MediaException(err.str());
+        }
+    }
+
+       return ret;
+}
+
+AudioInput*
+MediaHandlerHaiku::getAudioInput(size_t /*index*/)
+{
+    return new AudioInputHaiku();
+}
+
+VideoInput*
+MediaHandlerHaiku::getVideoInput(size_t /*index*/)
+{
+    return new VideoInputHaiku();
+}
+
+void
+MediaHandlerHaiku::cameraNames(std::vector<std::string>& /*names*/) const
+{
+    QQ(2);
+    log_unimpl("Haiku: camera names");
+}
+
+//size_t
+//MediaHandlerHaiku::getInputPaddingSize() const
+//{
+//    QQ(2);
+////    return FF_INPUT_BUFFER_PADDING_SIZE;
+//}
+
+} // gnash.media.haiku namespace 
+} // gnash.media namespace 
+} // gnash namespace

=== added file 'libmedia/haiku/MediaHandlerHaiku.h'
--- a/libmedia/haiku/MediaHandlerHaiku.h        1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/MediaHandlerHaiku.h        2010-02-17 02:21:56 +0000
@@ -0,0 +1,73 @@
+// MediaHandlerHaiku.h: Haiku media kit media handler, for Gnash
+// 
+//   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef GNASH_MEDIAHANDLERHAIKU_H
+#define GNASH_MEDIAHANDLERHAIKU_H
+
+#include "MediaHandler.h" // for inheritance
+
+#include <memory>
+
+namespace gnash {
+namespace media {
+
+/// Haiku media kit based media handler module
+//
+/// The module implements the MediaHandler factory as required
+/// by Gnash core for a loadable media handler module.
+///
+/// It uses the Haiku media kit
+///
+/// Starting point is MediaHandlerHaiku.
+/// 
+namespace haiku {
+
+/// Haiku based MediaHandler
+class DSOEXPORT MediaHandlerHaiku : public MediaHandler
+{
+public:
+
+       virtual std::auto_ptr<MediaParser>
+        createMediaParser(std::auto_ptr<IOChannel> stream);
+
+       virtual std::auto_ptr<VideoDecoder>
+        createVideoDecoder(const VideoInfo& info);
+       
+       virtual std::auto_ptr<VideoConverter>
+               createVideoConverter(ImgBuf::Type4CC srcFormat,
+                ImgBuf::Type4CC dstFormat);
+
+       virtual std::auto_ptr<AudioDecoder>
+        createAudioDecoder(const AudioInfo& info);
+
+//    virtual size_t getInputPaddingSize() const;
+    
+    virtual VideoInput* getVideoInput(size_t index);
+    
+    virtual AudioInput* getAudioInput(size_t index);
+
+    virtual void cameraNames(std::vector<std::string>& names) const;
+
+};
+
+
+} // gnash.media.haiku namespace 
+} // gnash.media namespace 
+} // namespace gnash
+
+#endif 

=== added file 'libmedia/haiku/MediaParserHaiku.cpp'
--- a/libmedia/haiku/MediaParserHaiku.cpp       1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/MediaParserHaiku.cpp       2010-02-17 02:21:56 +0000
@@ -0,0 +1,73 @@
+// MediaParserHaiku.cpp: Haiku media kit media parsers, for Gnash
+//
+//   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "MediaParserHaiku.h"
+#include "GnashException.h"
+#include "log.h"
+#include "IOChannel.h"
+
+#include "adipe.h"
+
+//#define GNASH_ALLOW_VCODEC_ENV 1
+// Set this to enable a special GNASH_DEFAULT_VCODEC environment variable, 
which
+// is used as a default when the video codec can't be detected. This is a quick
+// hack to make MJPEG HTTP videos work (which can't be detected as their MIME
+// type is just "mixed/multipart"). Perhaps the codec will be configurable via
+// ActionScript sometime. - Udo 
+
+namespace gnash {
+namespace media {
+namespace haiku {
+
+MediaParserHaiku::MediaParserHaiku(std::auto_ptr<IOChannel> stream)
+    : MediaParser(stream)
+{
+    QQ(2);
+}
+
+MediaParserHaiku::~MediaParserHaiku()
+{
+    QQ(2);
+}
+
+bool
+MediaParserHaiku::seek(boost::uint32_t&)
+{
+    QQ(2);
+}
+
+bool
+MediaParserHaiku::parseNextChunk()
+{
+    QQ(2);
+}
+
+boost::uint64_t
+MediaParserHaiku::getBytesLoaded() const
+{
+    QQ(2);
+}
+
+
+} // gnash.media.haiku namespace 
+} // end of gnash::media namespace
+} // end of gnash namespace
+
+#undef PADDING_BYTES
+#undef READ_CHUNKS 

=== added file 'libmedia/haiku/MediaParserHaiku.h'
--- a/libmedia/haiku/MediaParserHaiku.h 1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/MediaParserHaiku.h 2010-02-17 02:21:56 +0000
@@ -0,0 +1,65 @@
+// MediaParserHaiku.h: Haiku media parsers, for Gnash
+// 
+//   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef GNASH_MEDIAPARSER_HAIKU_H
+#define GNASH_MEDIAPARSER_HAIKU_H
+
+#include "MediaParser.h" // for inheritance
+
+#include <vector>
+#include <boost/scoped_array.hpp>
+#include <memory>
+
+// Forward declaration
+namespace gnash {
+       class IOChannel;
+}
+
+namespace gnash {
+namespace media {
+namespace haiku {
+
+/// Haiku media kit based MediaParser
+class MediaParserHaiku : public MediaParser
+{
+public:
+
+       /// Construct a haiku media kit based media parser for given stream
+       //
+       /// Can throw a GnashException if input format couldn't be detected
+       ///
+       MediaParserHaiku(std::auto_ptr<IOChannel> stream);
+
+       ~MediaParserHaiku();
+
+       // See dox in MediaParser.h
+       virtual bool seek(boost::uint32_t&);
+
+       // See dox in MediaParser.h
+       virtual bool parseNextChunk();
+
+       // See dox in MediaParser.h
+       virtual boost::uint64_t getBytesLoaded() const;
+};
+
+
+} // gnash.media.haiku namespace 
+} // gnash.media namespace 
+} // namespace gnash
+
+#endif // __MEDIAPARSER_HAIKU_H__

=== added file 'libmedia/haiku/VideoConverterHaiku.cpp'
--- a/libmedia/haiku/VideoConverterHaiku.cpp    1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/VideoConverterHaiku.cpp    2010-02-17 02:21:56 +0000
@@ -0,0 +1,51 @@
+//   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#include "VideoConverterHaiku.h"
+#include "MediaParser.h"
+#include "log.h"
+#include <cassert>
+
+#include "adipe.h"
+
+
+namespace gnash {
+namespace media {
+namespace haiku {
+
+/// Base class for video image space conversion.
+
+VideoConverterHaiku::VideoConverterHaiku(ImgBuf::Type4CC srcFormat, 
ImgBuf::Type4CC dstFormat)
+    : VideoConverter(srcFormat, dstFormat)
+{
+    QQ(2);
+}
+
+VideoConverterHaiku::~VideoConverterHaiku()
+{
+    QQ(2);
+}
+
+std::auto_ptr<ImgBuf>
+VideoConverterHaiku::convert(const ImgBuf& src)
+{
+    QQ(2);
+}
+
+} // gnash.media.haiku namespace
+} // gnash.media namespace 
+} // gnash namespace
+

=== added file 'libmedia/haiku/VideoConverterHaiku.h'
--- a/libmedia/haiku/VideoConverterHaiku.h      1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/VideoConverterHaiku.h      2010-02-17 02:21:56 +0000
@@ -0,0 +1,47 @@
+//
+//   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+#ifndef GNASH_VIDEOCONVERTERHAIKU_H
+#define GNASH_VIDEOCONVERTERHAIKU_H
+
+#include "VideoConverter.h"
+
+
+
+
+namespace gnash {
+namespace media {
+namespace haiku {
+
+/// Base class for video image space conversion.
+
+class VideoConverterHaiku : public VideoConverter {
+
+public:
+    VideoConverterHaiku(ImgBuf::Type4CC srcFormat, ImgBuf::Type4CC dstFormat);
+    
+    ~VideoConverterHaiku();
+  
+    std::auto_ptr<ImgBuf> convert(const ImgBuf& src);
+};
+
+} // gnash.media.haiku namespace
+} // gnash.media namespace 
+} // gnash namespace
+
+#endif // __VIDEOCONVERTERHAIKU_H__

=== added file 'libmedia/haiku/VideoDecoderHaiku.cpp'
--- a/libmedia/haiku/VideoDecoderHaiku.cpp      1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/VideoDecoderHaiku.cpp      2010-02-17 02:21:56 +0000
@@ -0,0 +1,91 @@
+// VideoDecoderHaiku.cpp: Video decoding using Haiku media kit.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#include "VideoDecoderHaiku.h"
+#include "MediaParserHaiku.h"
+
+namespace gnash {
+namespace media {
+namespace haiku {
+
+VideoDecoderHaiku::VideoDecoderHaiku(const VideoInfo& info)
+    : _count(0)
+{
+    QQ(2);
+}
+
+int
+VideoDecoderHaiku::width() const
+{
+    QQ(2);
+    return 100;
+    //return _width;
+}
+
+int
+VideoDecoderHaiku::height() const
+{
+    QQ(2);
+    return 100;
+    //return _height;
+}
+
+VideoDecoderHaiku::~VideoDecoderHaiku()
+{
+    QQ(2);
+}
+
+void
+VideoDecoderHaiku::push(const EncodedVideoFrame& frame)
+{
+    ++ _count;
+    QQ(2);
+}
+  
+
+std::auto_ptr<GnashImage>
+VideoDecoderHaiku::pop()
+{
+    std::auto_ptr<GnashImage> ret;
+    ret.reset(new ImageRGB(100, 100));
+    boost::uint8_t *d =
+        new boost::uint8_t[100*100*4];
+    for (int i = 0; i < 100*100*4; ++i)
+    {
+        d[i] *= 1 - (boost::uint8_t) 2*(rand()%2);
+        d[i] += (boost::uint8_t) rand()/64;
+    }
+    ret->update(d);
+    delete [] d;
+    -- _count;
+    return ret;
+}
+  
+
+bool
+VideoDecoderHaiku::peek()
+{
+    QQ(2);
+    return _count > 0;
+}
+
+
+} // namespace gnash::media::haiku
+} // namespace gnash::media
+} // namespace gnash

=== added file 'libmedia/haiku/VideoDecoderHaiku.h'
--- a/libmedia/haiku/VideoDecoderHaiku.h        1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/VideoDecoderHaiku.h        2010-02-17 02:21:56 +0000
@@ -0,0 +1,71 @@
+// VideoDecoderHaiku.h: Video decoding using Haiku media kit
+// 
+//   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef GNASH_VIDEODECODERHAIKU_H
+#define GNASH_VIDEODECODERHAIKU_H
+
+#include "GnashImage.h"
+#include "log.h"
+#include "VideoDecoder.h"
+#include "dsodefs.h"
+#include "MediaParser.h" // for videoCodecType enum
+
+#include "adipe.h"
+
+
+
+namespace gnash {
+namespace media {
+namespace haiku {
+
+
+/// Haiku media kit based VideoDecoder
+class DSOEXPORT VideoDecoderHaiku : public VideoDecoder
+{
+public:
+    //VideoDecoderGst(videoCodecType codec_type, int width, int height,
+    //                const boost::uint8_t* extradata, size_t extradatasize);
+    //VideoDecoderGst(GstCaps* caps);
+    VideoDecoderHaiku(const VideoInfo& info);
+    ~VideoDecoderHaiku();
+
+    void push(const EncodedVideoFrame& buffer);
+
+    std::auto_ptr<GnashImage> pop();
+  
+    bool peek();
+
+    /// Get the width of the video
+    //
+    /// @return The width of the video in pixels or 0 if unknown.
+    int width() const;
+
+    /// Get the height of the video
+    //
+    /// @return The height of the video in pixels or 0 if unknown.
+    int height() const;
+
+private:
+    int _count;
+};
+
+
+} // gnash.media.haiku namespace
+} // namespace media
+} // namespace gnash
+#endif // __VIDEODECODERHAIKU_H__

=== added file 'libmedia/haiku/VideoInputHaiku.cpp'
--- a/libmedia/haiku/VideoInputHaiku.cpp        1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/VideoInputHaiku.cpp        2010-02-17 02:21:56 +0000
@@ -0,0 +1,58 @@
+// VideoInputHaiku.h: Video input processing using Haiku
+// 
+//   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#include "VideoInputHaiku.h"
+
+namespace gnash {
+namespace media {
+namespace haiku {
+
+VideoInputHaiku::VideoInputHaiku()
+    :
+    _activityLevel(-1.0),
+    _bandwidth(16384),
+    _currentFPS(0),
+    _fps(15.0),
+    _height(120),
+    _width(160),
+    _index(0),
+    _motionLevel(50),
+    _motionTimeout(2000),
+    _muted(true),
+    _quality(0)
+{
+}
+
+void
+VideoInputHaiku::requestMode(size_t width, size_t height, double fps,
+        bool favorArea)
+{
+    // TODO: check what mode is available and set the best match.
+    _width = width;
+    _height = height;
+    _fps = fps;
+}
+
+
+VideoInputHaiku::~VideoInputHaiku()
+{
+}
+
+} // gnash.media.haiku namespace
+} // gnash.media namespace
+} // gnash namespace

=== added file 'libmedia/haiku/VideoInputHaiku.h'
--- a/libmedia/haiku/VideoInputHaiku.h  1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/VideoInputHaiku.h  2010-02-17 02:21:56 +0000
@@ -0,0 +1,178 @@
+// VideoInputHaiku.h: Video input processing using Haiku media kit
+// 
+//   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// 
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef GNASH_VIDEOINPUTHAIKU_H
+#define GNASH_VIDEOINPUTHAIKU_H
+
+#include <boost/cstdint.hpp> // for C99 int types
+#include "VideoInput.h"
+
+namespace gnash {
+namespace media {
+namespace haiku {
+
+class VideoInputHaiku : public VideoInput
+{
+public:
+
+    /// Constructor for the VideoInputHaiku class
+    //
+    /// TODO: most of these properties need not be stored, but should rather
+    /// be queried from the input device.
+    VideoInputHaiku();
+    
+    /// Destructor for the VideoInputGst class
+    virtual ~VideoInputHaiku();
+    
+    static void getNames(std::vector<std::string>& /*names*/) {}
+    
+    /// Return the current activity level of the webcam
+    //
+    /// @return     A double specifying the amount of motion currently
+    ///             detected by the camera.
+    double activityLevel () const { return _activityLevel; }
+    
+    /// The maximum available bandwidth for outgoing connections
+    //
+    /// TODO: see if this should really be here.
+    size_t bandwidth() const { return _bandwidth; }
+    
+    void setBandwidth(size_t bandwidth) {
+        _bandwidth = bandwidth;
+    }
+
+    /// The current frame rate of the webcam
+    //
+    /// @return     A double specifying the webcam's current FPS
+    double currentFPS() const { return _currentFPS; }
+    
+    /// The maximum FPS rate of the webcam
+    //
+    /// @return     A double specifying the webcam's maximum FPS
+    double fps() const { return _fps; }
+
+    /// Return the height of the webcam's frame
+    size_t height() const { return _height; }
+    
+    /// Return the width of the webcam's frame
+    size_t width() const { return _width; }
+    
+    /// The index of the camera
+    size_t index() const { return _index; }
+    
+    /// Request a native mode most closely matching the passed variables.
+    //
+    /// @param width            The required width
+    /// @param height           The required height
+    /// @param fps              The required frame rate
+    /// @param favorArea        How to match the requested mode.
+    void requestMode(size_t width, size_t height, double fps, bool favorArea);
+
+    /// Set the amount of motion required before notifying the core
+    void setMotionLevel(int m) { _motionLevel = m; }
+
+    /// Return the current motionLevel setting
+    int motionLevel() const { return _motionLevel; }
+    
+    /// Set time without motion in milliseconds before core is notified
+    void setMotionTimeout(int m) { _motionTimeout = m; }
+
+    /// Return the current motionTimeout setting.
+    int motionTimeout() const { return _motionTimeout; }
+    
+    void mute(bool m) { _muted = m; }
+    bool muted() const { return _muted; }
+    
+    /// Return the name of this webcam
+    //
+    /// @return     a string specifying the name of the webcam.
+    const std::string& name() const { return _name; }
+
+    /// Set the quality of the webcam
+    void setQuality(int q) { _quality = q; }
+
+    /// Return the current quality of the webcam
+    int quality() const { return _quality; }
+    
+    /// \brief Function starts up the pipeline designed earlier in code
+    ///      execution. This puts everything into motion.
+    ///
+    /// @return True if the pipeline was started correctly, false otherwise.
+    bool play();
+    
+    /// \brief Function stops the pipeline designed earlier in code execution.
+    ///
+    /// @return True if the pipeline was stopped correctly, false otherwise.
+    bool stop();
+    
+private:
+
+    /// TODO: see which of these need to be retrieved from the camera,
+    /// which of them should be stored like this, and which should
+    /// be stored in the Camera_as relay object.
+
+    /// The currently detected activity level. This should be queried from 
+    /// the camera.
+    double _activityLevel;
+
+    /// The available bandwidth. This probably shouldn't be dealt with by
+    /// the camera class. But maybe it should.
+    size_t _bandwidth;
+
+    /// The current FPS of the camera. This should be queried from the
+    /// camera.
+    double _currentFPS;
+
+    /// The maximum FPS allowed.
+    double _fps;
+
+    /// The height of the frame. This should probably be retrieved from
+    /// the camera
+    size_t _height;
+
+    /// The width of the frame. This should probably be retrieved from
+    /// the camera
+    size_t _width;
+
+    /// The index of this Webcam
+    size_t _index;
+
+    /// The motion level required to trigger a notification to the core
+    int _motionLevel;
+
+    /// The length of inactivity required to trigger a notification to the 
core.
+    int _motionTimeout;
+
+    /// Whether access to the camera is allowed. This depends on the rcfile
+    /// setting
+    bool _muted;
+
+    /// The name of this camera.
+    std::string _name;
+
+    /// The current quality setting.
+    int _quality;
+
+};
+
+
+} // gnash.media.haiku namespace
+} // gnash.media namespace 
+} // gnash namespace
+
+#endif 

=== added file 'libmedia/haiku/adipe.h'
--- a/libmedia/haiku/adipe.h    1970-01-01 00:00:00 +0000
+++ b/libmedia/haiku/adipe.h    2010-02-17 21:15:47 +0000
@@ -0,0 +1,15 @@
+#ifndef __ADIPE_H_
+#define __ADIPE_H_
+
+
+#define QQ_LVL 6
+
+#define QQ(x)  do {                                                    \
+                       if ( (x) <= QQ_LVL )                            \
+                               fprintf(stderr,"QQ %s \t%d \t%s\n",     \
+                                       __FILE__, __LINE__,             \
+                                        __PRETTY_FUNCTION__);          \
+               } while(0)
+
+#endif
+

=== modified file 'libsound/Makefile.am'
--- a/libsound/Makefile.am      2010-02-24 16:57:23 +0000
+++ b/libsound/Makefile.am      2010-02-26 03:34:11 +0000
@@ -62,6 +62,13 @@
  noinst_HEADERS += aos4/sound_handler_ahi.h
 endif
 
+if USE_SOUND_MKIT
+ libgnashsound_la_SOURCES += mkit/sound_handler_mkit.cpp
+ libgnashsound_la_LIBADD += -lmedia
+ noinst_HEADERS += mkit/sound_handler_mkit.h
+endif
+EXTRA_DIST += mkit
+
 libgnashsound_la_LDFLAGS = -release $(VERSION)
 
 if WIN32

=== modified file 'libsound/aos4/sound_handler_ahi.h'
--- a/libsound/aos4/sound_handler_ahi.h 2010-01-11 06:41:38 +0000
+++ b/libsound/aos4/sound_handler_ahi.h 2010-02-17 02:36:21 +0000
@@ -17,10 +17,8 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-
-#ifndef SOUND_HANDLER_AOS4_H
-#define SOUND_HANDLER_AOS4_H
-
+#ifndef SOUND_HANDLER_AHI_H
+#define SOUND_HANDLER_AHI_H
 
 #include "sound_handler.h" // for inheritance
 
@@ -190,4 +188,4 @@
 } // gnash.sound namespace
 } // namespace gnash
 
-#endif // SOUND_HANDLER_SDL_H
+#endif // SOUND_HANDLER_AHI_H

=== added directory 'libsound/mkit'
=== added file 'libsound/mkit/sound_handler_mkit.cpp'
--- a/libsound/mkit/sound_handler_mkit.cpp      1970-01-01 00:00:00 +0000
+++ b/libsound/mkit/sound_handler_mkit.cpp      2010-02-25 01:54:14 +0000
@@ -0,0 +1,467 @@
+// sound_handler_haiku.cpp: Sound handling using Haiku media kit
+//
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+//
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "sound_handler_mkit.h"
+
+#include "SoundInfo.h"
+#include "EmbedSound.h"
+#include "AuxStream.h" // for use..
+
+#include "log.h" // will import boost::format too
+#include "GnashException.h" // for SoundException
+
+#include <vector>
+#include <boost/scoped_array.hpp>
+
+#include <SoundPlayer.h>
+
+// Define this to get debugging call about pausing/unpausing audio
+//#define GNASH_DEBUG_MKIT_AUDIO_PAUSING
+
+// Mixing and decoding debugging
+//#define GNASH_DEBUG_MIXING
+
+/* The volume ranges from 0 - 128 */
+#define MIX_MAXVOLUME 128
+#define ADJUST_VOLUME(s, v)    (s = (s*v)/MIX_MAXVOLUME)
+#define ADJUST_VOLUME_U8(s, v)    (s = (((s-128)*v)/MIX_MAXVOLUME)+128)
+
+namespace { // anonymous
+
+// Header of a wave file
+// http://ftp.iptel.org/pub/sems/doc/full/current/wav__hdr_8c-source.html
+typedef struct{
+     char rID[4];            // 'RIFF'
+     long int rLen;        
+     char wID[4];            // 'WAVE'
+     char fId[4];            // 'fmt '
+     long int pcm_header_len;   // varies...
+     short int wFormatTag;
+     short int nChannels;      // 1,2 for stereo data is (l,r) pairs
+     long int nSamplesPerSec;
+     long int nAvgBytesPerSec;
+     short int nBlockAlign;      
+     short int nBitsPerSample;
+} WAV_HDR;
+
+// Chunk of wave file
+// http://ftp.iptel.org/pub/sems/doc/full/current/wav__hdr_8c-source.html
+typedef struct{
+    char dId[4];            // 'data' or 'fact'
+    long int dLen;
+} CHUNK_HDR;
+
+} // end of anonymous namespace
+
+
+namespace gnash {
+namespace sound {
+
+Mkit_sound_handler::Mkit_sound_handler()
+: _audioopen(false)
+{
+}
+
+Mkit_sound_handler::Mkit_sound_handler(const std::string& wavefile)
+: _audioopen(false)
+{
+    if (! wavefile.empty() ) {
+        file_stream.open(wavefile.c_str());
+        if (file_stream.fail()) {
+            std::cerr << "Unable to write file '" << wavefile << std::endl;
+            exit(EXIT_FAILURE);
+        } else {
+                write_wave_header(file_stream);
+                std::cout << "# Created 44100 16Mhz stereo wave file:" << 
std::endl <<
+                    "AUDIOFILE=" << wavefile << std::endl;
+        }
+    }
+}
+
+void
+Mkit_sound_handler::openAudio()
+{
+    if (_audioopen == true)
+        return;
+    _audioopen = true;
+
+    media_raw_audio_format format;
+    format.format = media_raw_audio_format::B_AUDIO_SHORT;
+    format.channel_count = 2;
+    format.frame_rate = 44100;
+    format.byte_order = (B_HOST_IS_BENDIAN) ?
+        B_MEDIA_BIG_ENDIAN : B_MEDIA_LITTLE_ENDIAN;
+    format.buffer_size = media_raw_audio_format::wildcard.buffer_size;
+
+    _soundplayer.reset(new BSoundPlayer(&format, "Gnash",
+            Mkit_sound_handler::FillNextBuffer, NULL, this));
+    if (B_OK != _soundplayer->InitCheck())
+        throw SoundException(_("Unable to open audio"));
+    _soundplayer->Start();
+}
+
+Mkit_sound_handler::~Mkit_sound_handler()
+{
+    if (_soundplayer != NULL)
+        _soundplayer->Stop(true, true);
+
+//    boost::mutex::scoped_lock lock(_mutex);
+//#ifdef GNASH_DEBUG_HAIKU_AUDIO_PAUSING
+//    log_debug("Pausing Mkit Audio on destruction");
+//#endif
+//    SDL_PauseAudio(1);
+//
+//    lock.unlock();
+
+    // we already locked, so we call 
+    // the base class (non-locking) deleter
+    delete_all_sounds();
+
+    unplugAllInputStreams();
+
+//    SDL_CloseAudio();
+
+    if (file_stream) file_stream.close();
+}
+
+// write a wave header, using the current audioSpec settings
+void
+Mkit_sound_handler::write_wave_header(std::ofstream& outfile)
+{
+    // allocate wav header
+    WAV_HDR wav;
+    CHUNK_HDR chk;
+
+    // setup wav header
+    std::strncpy(wav.rID, "RIFF", 4);
+    std::strncpy(wav.wID, "WAVE", 4);
+    std::strncpy(wav.fId, "fmt ", 4);
+
+    wav.nBitsPerSample = 16;
+    wav.nSamplesPerSec = 44100;
+    wav.nAvgBytesPerSec = 44100;
+    wav.nAvgBytesPerSec *= wav.nBitsPerSample / 8;
+    wav.nAvgBytesPerSec *= 2;
+    wav.nChannels = 2;
+
+    wav.pcm_header_len = 16;
+    wav.wFormatTag = 1;
+    wav.rLen = sizeof(WAV_HDR) + sizeof(CHUNK_HDR);
+    wav.nBlockAlign = 2 * wav.nBitsPerSample / 8;
+
+    // setup chunk header
+    std::strncpy(chk.dId, "data", 4);
+    chk.dLen = 0;
+
+    /* write riff/wav header */
+    outfile.write((char *)&wav, sizeof(WAV_HDR));
+
+    /* write chunk header */
+    outfile.write((char *)&chk, sizeof(CHUNK_HDR));
+
+}
+
+void
+Mkit_sound_handler::FillNextBuffer(void *cookie, void *buffer, size_t size,
+        const media_raw_audio_format &format)
+{
+    (void) format;
+
+    size_t numSamples =
+        size / sizeof(uint16);
+    boost::int16_t *data = (boost::int16_t*) buffer;
+
+    Mkit_sound_handler *that =
+        reinterpret_cast<Mkit_sound_handler*>(cookie);
+
+    that->fetchSamples(data, numSamples);
+}
+
+void
+Mkit_sound_handler::fetchSamples(boost::int16_t* to, unsigned int nSamples)
+{
+    boost::mutex::scoped_lock lock(_mutex);
+    sound_handler::fetchSamples(to, nSamples);
+
+    // TODO: move this to base class !
+    if (file_stream)
+    {
+        // NOTE: if muted, the samples will be silent already
+        boost::uint8_t* stream = reinterpret_cast<boost::uint8_t*>(to);
+        unsigned int len = nSamples*2;
+        file_stream.write((char*) stream, len);
+
+        // now, mute all audio
+        std::fill(to, to+nSamples, 0);
+    }
+
+    // If nothing is left to play there is no reason to keep polling.
+    if ( ! hasInputStreams() )
+    {
+#ifdef GNASH_DEBUG_HAIKU_AUDIO_PAUSING
+        log_debug("Pausing Mkit Audio...");
+#endif
+        sound_handler::pause();
+    }
+}
+
+void
+Mkit_sound_handler::reset()
+{
+    boost::mutex::scoped_lock lock(_mutex);
+    sound_handler::delete_all_sounds();
+    sound_handler::stop_all_sounds();
+}
+
+int
+Mkit_sound_handler::create_sound(std::auto_ptr<SimpleBuffer> data,
+                                std::auto_ptr<media::SoundInfo> sinfo)
+{
+    boost::mutex::scoped_lock lock(_mutex);
+    return sound_handler::create_sound(data, sinfo);
+}
+
+sound_handler::StreamBlockId
+Mkit_sound_handler::addSoundBlock(unsigned char* data,
+        unsigned int dataBytes, unsigned int nSamples,
+        int streamId)
+{
+
+    boost::mutex::scoped_lock lock(_mutex);
+    return sound_handler::addSoundBlock(data, dataBytes, nSamples, streamId);
+}
+
+void
+Mkit_sound_handler::stop_sound(int soundHandle)
+{
+    boost::mutex::scoped_lock lock(_mutex);
+    sound_handler::stop_sound(soundHandle);
+}
+
+
+void
+Mkit_sound_handler::delete_sound(int soundHandle)
+{
+    boost::mutex::scoped_lock lock(_mutex);
+    sound_handler::delete_sound(soundHandle);
+}
+
+void
+Mkit_sound_handler::stop_all_sounds()
+{
+    boost::mutex::scoped_lock lock(_mutex);
+    sound_handler::stop_all_sounds();
+}
+
+
+int
+Mkit_sound_handler::get_volume(int soundHandle)
+{
+    boost::mutex::scoped_lock lock(_mutex);
+    return sound_handler::get_volume(soundHandle);
+}
+
+
+void
+Mkit_sound_handler::set_volume(int soundHandle, int volume)
+{
+    boost::mutex::scoped_lock lock(_mutex);
+    sound_handler::set_volume(soundHandle, volume);
+}
+
+media::SoundInfo*
+Mkit_sound_handler::get_sound_info(int soundHandle)
+{
+    boost::mutex::scoped_lock lock(_mutex);
+    return sound_handler::get_sound_info(soundHandle);
+}
+
+unsigned int
+Mkit_sound_handler::get_duration(int soundHandle)
+{
+    boost::mutex::scoped_lock lock(_mutex);
+    return sound_handler::get_duration(soundHandle);
+}
+
+unsigned int
+Mkit_sound_handler::tell(int soundHandle)
+{
+    boost::mutex::scoped_lock lock(_mutex);
+    return sound_handler::tell(soundHandle);
+}
+
+void 
+Mkit_sound_handler::MixAudio (boost::uint8_t *dst, const boost::uint8_t *src, 
boost::uint32_t len, int volume)
+{
+    //boost::uint16_t format;
+
+    if ( volume == 0 ) 
+    {
+        return;
+    }
+
+    //format = AHIST_S16S;
+
+    /* Actually we have a fixed audio format */
+    //switch (format) 
+    {
+        //case AHIST_S16S:
+        {
+            boost::int16_t src1, src2;
+            int dst_sample;
+            const int max_audioval = ((1<<(16-1))-1);
+            const int min_audioval = -(1<<(16-1));
+
+            len /= 2;
+            while ( len-- ) 
+            {
+                src1 = ((src[0])<<8|src[1]);
+                ADJUST_VOLUME(src1, volume);
+                src2 = ((dst[0])<<8|dst[1]);
+                src += 2;
+                dst_sample = src1+src2;
+                if ( dst_sample > max_audioval ) 
+                {
+                    dst_sample = max_audioval;
+                } 
+                else
+                if ( dst_sample < min_audioval ) 
+                {
+                    dst_sample = min_audioval;
+                }
+                dst[1] = dst_sample & 0xFF;
+                dst_sample >>= 8;
+                dst[0] = dst_sample & 0xFF;
+                dst += 2;
+            }
+        }
+        //break;
+    }
+    
+}
+
+void
+Mkit_sound_handler::mix(boost::int16_t* outSamples, boost::int16_t* inSamples, 
unsigned int nSamples, float volume)
+{
+    //if (!_closing)
+    {
+        unsigned int nBytes = nSamples*2;
+
+        boost::uint8_t *out = reinterpret_cast<boost::uint8_t*>(outSamples);
+        boost::uint8_t* in = reinterpret_cast<boost::uint8_t*>(inSamples);
+
+        MixAudio(out, in, nBytes, MIX_MAXVOLUME*volume);
+    }
+}
+
+void
+Mkit_sound_handler::plugInputStream(std::auto_ptr<InputStream> newStreamer)
+{
+    boost::mutex::scoped_lock lock(_mutex);
+
+    sound_handler::plugInputStream(newStreamer);
+
+    { // TODO: this whole block should only be executed when adding
+      // the first stream.
+
+#ifdef GNASH_DEBUG_Mkit_AUDIO_PAUSING
+        log_debug("Unpausing Mkit Audio on inpust stream plug...");
+#endif
+        openAudio();
+        sound_handler::unpause();
+
+    }
+}
+
+void
+Mkit_sound_handler::mute()
+{
+    boost::mutex::scoped_lock lock(_mutedMutex);
+    sound_handler::mute();
+}
+
+void
+Mkit_sound_handler::unmute()
+{
+    boost::mutex::scoped_lock lock(_mutedMutex);
+    sound_handler::unmute();
+}
+
+bool
+Mkit_sound_handler::is_muted() const
+{
+    boost::mutex::scoped_lock lock(_mutedMutex);
+    return sound_handler::is_muted();
+}
+
+void
+Mkit_sound_handler::pause()
+{
+    log_debug(_("Mkit: Mkit_sound_handler::pause"));
+    if (_soundplayer != NULL)
+        _soundplayer->SetHasData(false);
+    sound_handler::pause();
+    log_debug(_("Mkit: paused"));
+}
+
+void
+Mkit_sound_handler::unpause()
+{
+    if ( hasInputStreams() )
+    {
+        log_debug(_("Mkit: Mkit_sound_handler::unpause"));
+        if (_soundplayer != NULL)
+            _soundplayer->SetHasData(true);
+        sound_handler::unpause();
+        log_debug(_("Mkit: unpaused"));
+    }
+}
+
+
+sound_handler*
+create_sound_handler_mkit()
+// Factory.
+{
+    return new Mkit_sound_handler;
+}
+
+sound_handler*
+create_sound_handler_mkit(const std::string& wave_file)
+// Factory.
+{
+    return new Mkit_sound_handler(wave_file);
+}
+
+
+
+
+
+
+
+
+
+
+
+} // gnash.sound namespace 
+} // namespace gnash
+
+// Local Variables:
+// mode: C++
+// End:

=== added file 'libsound/mkit/sound_handler_mkit.h'
--- a/libsound/mkit/sound_handler_mkit.h        1970-01-01 00:00:00 +0000
+++ b/libsound/mkit/sound_handler_mkit.h        2010-02-25 01:54:14 +0000
@@ -0,0 +1,155 @@
+// sound_handler_haiku.h: Sound handling using Mkit media kit
+//
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+//
+// 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef SOUND_HANDLER_MKIT_H
+#define SOUND_HANDLER_MKIT_H
+
+#include "sound_handler.h" // for inheritance
+
+#include <vector> // for composition (Sounds)
+#include <set> // for composition (InputStreams)
+#include <fstream> // for composition (file_stream)
+#include <boost/thread/mutex.hpp>
+#include <boost/scoped_ptr.hpp>
+
+#include <SoundPlayer.h>
+
+// Forward declarations
+namespace gnash {
+    class SimpleBuffer;
+    namespace sound {
+        class EmbedSound;
+        class InputStream;
+    }
+}
+
+namespace gnash {
+namespace sound {
+
+/// Mkit media kit based sound_handler
+class Mkit_sound_handler : public sound_handler
+{
+    boost::scoped_ptr<BSoundPlayer> _soundplayer;
+
+    /// play buffer handler function
+    static void FillNextBuffer(void *cookie, void *buffer, size_t size,
+            const media_raw_audio_format &format);
+
+    /// @throw SoundException on error
+    void openAudio();
+
+    bool _audioopen;
+
+    /// Mutex for making sure threads doesn't mess things up
+    boost::mutex _mutex;
+
+    /// Mutex protecting _muted (defined in base class)
+    mutable boost::mutex _mutedMutex;
+
+    /// File stream for dump file
+    //
+    /// TODO: move to base class ?
+    ///
+    std::ofstream file_stream;
+
+    // write a .WAV file header
+    void write_wave_header(std::ofstream& outfile);
+
+    // See dox in sound_handler.h
+    void mix(boost::int16_t* outSamples, boost::int16_t* inSamples,
+                unsigned int nSamples, float volume);
+
+    void MixAudio (boost::uint8_t *dst, const boost::uint8_t *src, 
boost::uint32_t len, int volume);
+
+public:
+    Mkit_sound_handler();
+
+    Mkit_sound_handler(const std::string& wave_file);
+
+    ~Mkit_sound_handler();
+
+    // See dox in sound_handler.h
+    virtual int create_sound(std::auto_ptr<SimpleBuffer> data, 
std::auto_ptr<media::SoundInfo> sinfo);
+
+    // See dox in sound_handler.h
+    // overridden to serialize access to the data buffer slot
+    virtual StreamBlockId addSoundBlock(unsigned char* data,
+                                       unsigned int data_bytes,
+                                       unsigned int sample_count,
+                                       int streamId);
+
+    // See dox in sound_handler.h
+    virtual void    stop_sound(int sound_handle);
+
+    // See dox in sound_handler.h
+    virtual void    delete_sound(int sound_handle);
+
+    // See dox in sound_handler.h
+    virtual void reset();
+
+    // See dox in sound_handler.h
+    virtual void    stop_all_sounds();
+
+    // See dox in sound_handler.h
+    virtual int get_volume(int sound_handle);
+
+    // See dox in sound_handler.h
+    virtual void    set_volume(int sound_handle, int volume);
+
+    // See dox in sound_handler.h
+    virtual media::SoundInfo* get_sound_info(int soundHandle);
+
+    // See dox in sound_handler.h
+    // overridden to serialize access to the _muted member
+    virtual void mute();
+
+    // See dox in sound_handler.h
+    // overridden to serialize access to the _muted member
+    virtual void unmute();
+
+    // See dox in sound_handler.h
+    // overridden to serialize access to the _muted member
+    virtual bool is_muted() const;
+
+    // See dox in sound_handler.h
+    // overridden to close audio card
+    virtual void pause();
+
+    // See dox in sound_handler.h
+    // overridden to open audio card
+    virtual void unpause();
+
+    // See dox in sound_handler.h
+    virtual unsigned int get_duration(int sound_handle);
+
+    // See dox in sound_handler.h
+    virtual unsigned int tell(int sound_handle);
+
+    // See dox in sound_handler.h
+    // Overridden to unpause SDL audio
+    void plugInputStream(std::auto_ptr<InputStream> in);
+
+    // See dox in sound_handler.h
+    void fetchSamples(boost::int16_t* to, unsigned int nSamples);
+};
+
+} // gnash.sound namespace 
+} // namespace gnash
+
+#endif // SOUND_HANDLER_MKIT_H

=== modified file 'libsound/sound_handler.h'
--- a/libsound/sound_handler.h  2010-01-11 06:41:38 +0000
+++ b/libsound/sound_handler.h  2010-02-25 01:57:13 +0000
@@ -388,7 +388,7 @@
 
     /// Fetch mixed samples
     //
-    /// We run trough all the plugged InputStreams fetching decoded
+    /// We run through all the plugged InputStreams fetching decoded
     /// audio blocks and mixing them into the given output stream.
     ///
     /// @param to
@@ -584,6 +584,13 @@
 
 /// @throw a SoundException if fails to initialize audio card.
 DSOEXPORT sound_handler* create_sound_handler_aos4(const std::string& 
wave_file);
+
+#elif defined(SOUND_MKIT)
+/// @throw a SoundException if fails to create node.
+DSOEXPORT sound_handler* create_sound_handler_mkit();
+
+/// @throw a SoundException if fails to create node.
+DSOEXPORT sound_handler* create_sound_handler_mkit(const std::string& 
wave_file);
 #endif
 
 } // gnash.sound namespace 

=== modified file 'macros/agg.m4'
--- a/macros/agg.m4     2010-02-05 21:50:22 +0000
+++ b/macros/agg.m4     2010-02-17 21:27:15 +0000
@@ -54,7 +54,14 @@
     for i in $incllist; do
       if test -f $i/agg2/agg_gradient_lut.h; then
         ac_cv_path_agg_incl="-I$i/agg2"
-        agg_include_dir=$i/agg2
+        agg_include_dir="$i/agg2"
+             agg25=yes
+        break
+      fi
+      dnl Haiku uses only agg as the directory, not agg2
+      if test -f $i/agg/agg_gradient_lut.h; then
+        ac_cv_path_agg_incl="-I$i/agg"
+        agg_include_dir="$i/agg"
              agg25=yes
         break
       fi

=== modified file 'macros/ffmpeg.m4'
--- a/macros/ffmpeg.m4  2010-01-15 02:03:37 +0000
+++ b/macros/ffmpeg.m4  2010-02-17 16:56:43 +0000
@@ -14,7 +14,6 @@
 dnl  along with this program; if not, write to the Free Software
 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-
 AC_DEFUN([GNASH_PATH_FFMPEG],
 [
 
@@ -285,7 +284,7 @@
     AC_DEFINE(HAVE_LIBSWSCALE_SWSCALE_H, 1, [Define if swscale.h is found])
   fi
 
-  if test x"$have_ffmpeg_swscale" = "xno" -a $ffmpeg_num_version -ge 520000; 
then
+  if test x"$have_ffmpeg_swscale" = "xno" -a 1$ffmpeg_num_version -ge 
1"520000"; then
      AC_MSG_WARN([Cannot find swscale.h, required for ffmpeg versions >= 
52.0.0 (detected version: $ffmpeg_version)])
      ffmpeg_version_check=
   fi

=== modified file 'macros/freetype.m4'
--- a/macros/freetype.m4        2010-01-01 17:48:26 +0000
+++ b/macros/freetype.m4        2010-02-23 16:26:50 +0000
@@ -41,6 +41,13 @@
         ac_cv_path_freetype_incl="-I$i/freetype2"
              break
       fi
+      dnl Haiku uses only freetype as the directory, not freetype2
+      if test x"${haiku}" = xyes; then
+        if test -f $i/freetype/freetype/freetype.h; then
+          ac_cv_path_freetype_incl="-I$i/freetype"
+               break
+        fi
+      fi
     done
 
     if test x"${ac_cv_path_freetype_incl}" = x ; then
@@ -90,7 +97,7 @@
   dnl If the path hasn't been specified, go look for it.
   if test x"${ac_cv_path_freetype_lib}" = x; then
     dnl freetype-config gives us way too many libraries, which create nasty 
linking
-    dnl dependancy issue, so we strip them off here. The real dependencies are
+    dnl dependancy issues, so we strip them off here. The real dependencies are
     dnl are taken care of by other config tests.
     AC_MSG_CHECKING([for ${libname} library])
     for i in $libslist; do

=== modified file 'macros/incllist'
--- a/macros/incllist   2008-04-30 15:06:33 +0000
+++ b/macros/incllist   2010-02-17 16:56:43 +0000
@@ -1,1 +1,1 @@
-${with_top_level}/include ${prefix}/${host_alias}/include ${prefix}/include 
/sw/include /usr/nekoware/include /usr/freeware/include /usr/pkg/include 
/opt/local/include /usr/local/include /home/latest/include /opt/include 
/opt/mesa/include /opt/include /usr/X11R6/include /usr/X11/include /usr/include 
/usr/pkg/include /usr/local/olpc/include
+${with_top_level}/include ${prefix}/${host_alias}/include ${prefix}/include 
/sw/include /usr/nekoware/include /usr/freeware/include /usr/pkg/include 
/opt/local/include /usr/local/include /home/latest/include /opt/include 
/opt/mesa/include /opt/include /usr/X11R6/include /usr/X11/include /usr/include 
/usr/pkg/include /boot/common/include /boot/develop/headers/3rdparty

=== modified file 'macros/libslist'
--- a/macros/libslist   2008-11-14 22:22:01 +0000
+++ b/macros/libslist   2010-02-17 16:56:43 +0000
@@ -1,1 +1,1 @@
-${with_top_level}/lib ${prefix}/${host_alias}/lib ${prefix}/lib64 
${prefix}/lib32 ${prefix}/lib /usr/local/lib /lib /usr/lib64 /usr/lib32 
/usr/lib /usr/nekoware/lib /usr/freeware/lib /usr/lib /sw/lib /home/latest/lib 
/opt/lib /pkg/lib /opt/local/lib /usr/pkg/lib /usr/X11R6/lib /usr/X11/lib 
/usr/lib/opengl/xorg-x11/lib /usr/lib64/opengl/xorg-x11/lib 
/usr/lib64/opengl/xorg-x11/lib64  /opt/mesa/lib /opt/mesa/lib64 .. ../..
+${with_top_level}/lib ${prefix}/${host_alias}/lib ${prefix}/lib64 
${prefix}/lib32 ${prefix}/lib /usr/local/lib /lib /usr/lib64 /usr/lib32 
/usr/lib /usr/nekoware/lib /usr/freeware/lib /usr/lib /sw/lib /home/latest/lib 
/opt/lib /pkg/lib /opt/local/lib /usr/pkg/lib /usr/X11R6/lib /usr/X11/lib 
/usr/lib/opengl/xorg-x11/lib /usr/lib64/opengl/xorg-x11/lib 
/usr/lib64/opengl/xorg-x11/lib64  /opt/mesa/lib /opt/mesa/lib64 
/boot/common/lib /boot/system/lib/gcc4 /boot/system/lib .. ../..

=== modified file 'macros/pthreads.m4'
--- a/macros/pthreads.m4        2010-01-01 17:48:26 +0000
+++ b/macros/pthreads.m4        2010-02-17 16:56:43 +0000
@@ -114,6 +114,8 @@
     case $flag in
       none)
         AC_MSG_CHECKING([whether pthreads work without any flags])
+        PTHREAD_CFLAGS=""
+        PTHREAD_LIBS=""
         ;;
       -*)
         AC_MSG_CHECKING([whether pthreads work with $flag])
@@ -173,13 +175,13 @@
     CXXFLAGS="$save_CXXFLAGS"
 
     AC_MSG_RESULT($pthreads)
-    if test "x$pthreads" = xyes; then
+    if test "x${pthreads}" = xyes; then
        break;
     fi
 done
 
 dnl Try a manual search, useful for cross-compiling
-if test x"${PTHREAD_LIBS}" = "x"; then
+if test "x${pthreads}" = xyes; then
   AC_MSG_CHECKING([searching for pthread library])
   for i in $libslist; do
     if test -f $i/libpthread.a -o -f $i/libpthread.${shlibext} -o -f 
$i/libpthread.dylib; then
@@ -203,6 +205,7 @@
   done
   if test x"${PTHREAD_LIBS}" = "x"; then
     AC_MSG_RESULT(not found)
+    pthreads=no
   fi
 fi
 

=== modified file 'packaging/deb.am'
--- a/packaging/deb.am  2010-02-26 01:42:37 +0000
+++ b/packaging/deb.am  2010-02-26 03:34:11 +0000
@@ -38,6 +38,10 @@
 # it is "$(NEXT_RELEASE)~bzr.$(BRANCH_NICK)$(BRANCH_REVNO)", but when
 # building alternate packages, we want to rename them so there isn't a
 # name collision.
+
+# This gets more fun, as if we configure with ffmpeg, the two utilities that
+# deal with Gstreamer based input devices, findwebcam and findmicrophone,
+# don't get built. So we strip them out of the packages.
 setup-deb: 
        @snapshot_version="$(SNAPSHOT_VERSION)"; \
        snapshot_dir="gnash-$(SNAPSHOT_VERSION)"; \
@@ -84,6 +88,16 @@
        else \
          sed -e "s:trunk:$${snapshot_version}:" 
$(srcdir)/packaging/debian/changelog > $${snapshot_dir}/debian/changelog; \
        fi; \
+       if test $${ffmpeg} -eq 1; then \
+         if test -e $${snapshot_dir}/debian/gnash-tools.install; then \
+           mv -f $${snapshot_dir}/debian/gnash-tools.install 
$${snapshot_dir}/debian/gnash-tools.install.orig; \
+           sed -e '/webcam/d' -e '/microphone/d' 
$${snapshot_dir}/debian/gnash-tools.install.orig > 
$${snapshot_dir}/debian/gnash-tools.install; \
+         fi; \
+         if test -e $${snapshot_dir}/debian/gnash-tools.manpages; then \
+           mv -f $${snapshot_dir}/debian/gnash-tools.manpages 
$${snapshot_dir}/debian/gnash-tools.manpages.orig; \
+           sed -e '/webcam/d' -e '/microphone/d' 
$${snapshot_dir}/debian/gnash-tools.manpages.orig > 
$${snapshot_dir}/debian/gnash-tools.manpages; \
+         fi; \
+       fi; \
        ubuntu=`uname -a | grep -ci ubuntu`; \
        if test $$ubuntu -eq 1; then \
          if test -e $${snapshot_dir}/debian/gtk-plugin-gnash.dirs; then \

=== modified file 'packaging/debian/rules'
--- a/packaging/debian/rules    2010-02-26 01:42:37 +0000
+++ b/packaging/debian/rules    2010-02-26 03:34:11 +0000
@@ -169,8 +169,8 @@
        fi
 
 #      Make a sub-directory to build all the objects and executables in.
-       if test ! -d $(BUILD_DIRECTORY); then
-         mkdir $(BUILD_DIRECTORY)
+       if test ! -d $(BUILD_DIRECTORY); then \
+         mkdir $(BUILD_DIRECTORY); \
        fi
 
 #      Configure that build subdirectory.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]