From 43ec74f63594dd063f458a39a19f429337bc25e3 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 4 Oct 2014 15:24:59 +0000
Subject: update config.guess


diff --git a/make/config.guess b/make/config.guess
index d622a44..b79252d 100755
--- a/make/config.guess
+++ b/make/config.guess
@@ -1,14 +1,12 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011, 2012 Free Software Foundation, Inc.
+#   Copyright 1992-2013 Free Software Foundation, Inc.
 
-timestamp='2012-02-10'
+timestamp='2013-06-10'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# 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
@@ -22,19 +20,17 @@ timestamp='2012-02-10'
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner.  Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 #
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
+# Originally written by Per Bothner.
 #
 # You can get the latest version of this script from:
 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -54,9 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+	# If the system lacks a compiler, then just pick glibc.
+	# We could probably try harder.
+	LIBC=gnu
+
+	eval $set_cc_for_build
+	cat <<-EOF > $dummy.c
+	#include <features.h>
+	#if defined(__UCLIBC__)
+	LIBC=uclibc
+	#elif defined(__dietlibc__)
+	LIBC=dietlibc
+	#else
+	LIBC=gnu
+	#endif
+	EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	;;
+esac
+
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -200,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
 	echo "${machine}-${os}${release}"
 	exit ;;
+    *:Bitrig:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+	exit ;;
     *:OpenBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -302,7 +321,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
 	echo arm-unknown-riscos
 	exit ;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -801,6 +820,9 @@ EOF
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit ;;
+    *:MINGW64*:*)
+	echo ${UNAME_MACHINE}-pc-mingw64
+	exit ;;
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
@@ -852,21 +874,21 @@ EOF
 	exit ;;
     *:GNU:*:*)
 	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
     aarch64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     aarch64_be:Linux:*:*)
 	UNAME_MACHINE=aarch64_be
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -879,59 +901,54 @@ EOF
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    arc:Linux:*:* | arceb:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     arm*:Linux:*:*)
 	eval $set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_EABI__
 	then
-	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	else
 	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 		| grep -q __ARM_PCS_VFP
 	    then
-		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
 	    else
-		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
 	    fi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     cris:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
     crisv32:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
     frv:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     hexagon:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     i*86:Linux:*:*)
-	LIBC=gnu
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
-	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
@@ -950,54 +967,63 @@ EOF
 	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
+    or1k:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     or32:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     padre:Linux:*:*)
-	echo sparc-unknown-linux-gnu
+	echo sparc-unknown-linux-${LIBC}
 	exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+	echo hppa64-unknown-linux-${LIBC}
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
-	  *)    echo hppa-unknown-linux-gnu ;;
+	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+	  *)    echo hppa-unknown-linux-${LIBC} ;;
 	esac
 	exit ;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
+	echo powerpc64-unknown-linux-${LIBC}
 	exit ;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
+	echo powerpc-unknown-linux-${LIBC}
+	exit ;;
+    ppc64le:Linux:*:*)
+	echo powerpc64le-unknown-linux-${LIBC}
+	exit ;;
+    ppcle:Linux:*:*)
+	echo powerpcle-unknown-linux-${LIBC}
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
-	echo ${UNAME_MACHINE}-ibm-linux
+	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
 	exit ;;
     sh64*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     tile*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-gnu
+	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1201,6 +1227,9 @@ EOF
     BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
 	echo i586-pc-haiku
 	exit ;;
+    x86_64:Haiku:*:*)
+	echo x86_64-unknown-haiku
+	exit ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
 	exit ;;
@@ -1227,19 +1256,21 @@ EOF
 	exit ;;
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-	case $UNAME_PROCESSOR in
-	    i386)
-		eval $set_cc_for_build
-		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-		      grep IS_64BIT_ARCH >/dev/null
-		  then
-		      UNAME_PROCESSOR="x86_64"
-		  fi
-		fi ;;
-	    unknown) UNAME_PROCESSOR=powerpc ;;
-	esac
+	eval $set_cc_for_build
+	if test "$UNAME_PROCESSOR" = unknown ; then
+	    UNAME_PROCESSOR=powerpc
+	fi
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		case $UNAME_PROCESSOR in
+		    i386) UNAME_PROCESSOR=x86_64 ;;
+		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
+		esac
+	    fi
+	fi
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
@@ -1256,7 +1287,7 @@ EOF
     NEO-?:NONSTOP_KERNEL:*:*)
 	echo neo-tandem-nsk${UNAME_RELEASE}
 	exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
+    NSE-*:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
     NSR-?:NONSTOP_KERNEL:*:*)
@@ -1330,9 +1361,6 @@ EOF
 	exit ;;
 esac
 
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
 eval $set_cc_for_build
 cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
-- 
1.8.3.4


From 79191c2b6d3488dce96443efece8be80f84961b0 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 4 Oct 2014 17:42:41 +0000
Subject: define SYS_HAIKU


diff --git a/libhb/module.defs b/libhb/module.defs
index bb7ffcc..4aa3648 100644
--- a/libhb/module.defs
+++ b/libhb/module.defs
@@ -55,6 +55,8 @@ else ifeq ($(BUILD.system),mingw)
 	LIBHB.GCC.args.extra.dylib++ += -Wl,--enable-auto-import -static
 else ifeq ($(BUILD.system),solaris)
     LIBHB.GCC.D += SYS_SunOS _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64
+else ifeq ($(BUILD.system),haiku)
+    LIBHB.GCC.D += SYS_HAIKU
 else
     LIBHB.platform.D = SYS_UNKNOWN
 endif
-- 
1.8.3.4


From b883cd1f0e0627a8085f92b9010343ea7ea6fc5e Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 4 Oct 2014 17:43:55 +0000
Subject: define HB_NORMAL_PRIORITY


diff --git a/libhb/ports.h b/libhb/ports.h
index 2c0aeb1..42389a7 100644
--- a/libhb/ports.h
+++ b/libhb/ports.h
@@ -48,7 +48,7 @@ void hb_mkdir( char * name );
  ***********************************************************************/
 typedef struct hb_thread_s hb_thread_t;
 
-#if defined( SYS_BEOS )
+#if defined( SYS_BEOS ) || defined( SYS_HAIKU )
 #  define HB_LOW_PRIORITY    5
 #  define HB_NORMAL_PRIORITY 10
 #elif defined( SYS_DARWIN )
-- 
1.8.3.4


From de7da8601b8150a1d7f66677fb439e203f8a5989 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 4 Oct 2014 18:07:13 +0000
Subject: libmp4v2 api


diff --git a/libhb/decmetadata.c b/libhb/decmetadata.c
index 5f6b6af..d330a66 100644
--- a/libhb/decmetadata.c
+++ b/libhb/decmetadata.c
@@ -17,7 +17,7 @@ static int decmp4metadata( hb_title_t *title )
     int result = 0;
     hb_deep_log( 2, "Got an MP4 input, read the metadata");
 
-    input_file = MP4Read( title->path, 0 );
+    input_file = MP4Read( title->path );
 
     if( input_file != MP4_INVALID_FILE_HANDLE )
     { 
@@ -168,7 +168,7 @@ static int decmp4metadata( hb_title_t *title )
             }
         }
 
-        MP4Close( input_file );
+        MP4Close( input_file, 0 );
     }
     return result;
 }
diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c
index 66f02d5..c8c49be 100644
--- a/libhb/muxmp4.c
+++ b/libhb/muxmp4.c
@@ -100,13 +100,13 @@ static int MP4Init( hb_mux_object_t * m )
     if (job->largeFileSize)
     /* Use 64-bit MP4 file */
     {
-        m->file = MP4Create( job->file, MP4_DETAILS_ERROR, MP4_CREATE_64BIT_DATA );
+        m->file = MP4Create( job->file, MP4_CREATE_64BIT_DATA );
         hb_deep_log( 2, "muxmp4: using 64-bit MP4 formatting.");
     }
     else
     /* Limit MP4s to less than 4 GB */
     {
-        m->file = MP4Create( job->file, MP4_DETAILS_ERROR, 0 );
+        m->file = MP4Create( job->file, 0 );
     }
 
     if (m->file == MP4_INVALID_FILE_HANDLE)
@@ -1387,14 +1387,14 @@ static int MP4End( hb_mux_object_t * m )
             MP4TagsFree( tags );
         }
 
-        MP4Close( m->file );
+        MP4Close( m->file, 0 );
 
         if ( job->mp4_optimize )
         {
             hb_log( "muxmp4: optimizing file" );
             char filename[1024]; memset( filename, 0, 1024 );
             snprintf( filename, 1024, "%s.tmp", job->file );
-            MP4Optimize( job->file, filename, MP4_DETAILS_ERROR );
+            MP4Optimize( job->file, filename );
             remove( job->file );
             rename( filename, job->file );
         }
-- 
1.8.3.4


From fd9fce6c430a06d430a2699efca77d2d59670850 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 4 Oct 2014 18:24:26 +0000
Subject: remove faac dependency


diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c
index 2a7b619..17a40ab 100644
--- a/gtk/src/audiohandler.c
+++ b/gtk/src/audiohandler.c
@@ -70,10 +70,7 @@ ghb_select_audio_codec(gint mux, hb_audio_config_t *aconfig, gint acodec, gint f
         if (hb_audio_encoders[ii].encoder == fallback &&
             !(hb_audio_encoders[ii].muxers & mux))
         {
-            if ( mux == HB_MUX_MKV )
-                fallback = HB_ACODEC_LAME;
-            else
-                fallback = HB_ACODEC_FAAC;
+            fallback = HB_ACODEC_LAME;
             break;
         }
     }
@@ -130,7 +127,7 @@ int ghb_select_fallback( GValue *settings, int mux, int acodec )
             return HB_ACODEC_LAME;
 
         case HB_ACODEC_AAC_PASS:
-            return HB_ACODEC_FAAC;
+            return HB_ACODEC_FFAAC;
 
         case HB_ACODEC_AC3_PASS:
             return HB_ACODEC_AC3;
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 689c3b7..800f3af 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -3767,7 +3767,7 @@ ghb_audio_can_passthru(gint acodec)
 gint
 ghb_get_default_acodec()
 {
-    return HB_ACODEC_FAAC;
+    return HB_ACODEC_LAME;
 }
 
 static void
@@ -4505,13 +4505,9 @@ ghb_validate_audio(GValue *settings)
             {
                 codec = HB_ACODEC_AC3;
             }
-            else if (mux == HB_MUX_MKV)
-            {
-                codec = HB_ACODEC_LAME;
-            }
             else
             {
-                codec = HB_ACODEC_FAAC;
+                codec = HB_ACODEC_LAME;
             }
             value = ghb_lookup_acodec_value(codec);
             ghb_settings_take_value(asettings, "AudioEncoder", value);
@@ -4525,7 +4521,7 @@ ghb_validate_audio(GValue *settings)
             if (codec == HB_ACODEC_VORBIS)
             {
                 a_unsup = "Vorbis";
-                codec = HB_ACODEC_FAAC;
+                codec = HB_ACODEC_LAME;
             }
         }
         if (a_unsup)
diff --git a/gtk/src/preset_xlat.c b/gtk/src/preset_xlat.c
index 8d242fa..33bae8d 100644
--- a/gtk/src/preset_xlat.c
+++ b/gtk/src/preset_xlat.c
@@ -260,7 +260,6 @@ value_map_t denoise_xlat[] =
 
 static value_map_t acodec_xlat[] =
 {
-    {"AAC (faac)", "faac"},
     {"AC3 Passthru", "ac3"},
     {"MP3 (lame)", "lame"},
     {"Vorbis (vorbis)", "vorbis"},
diff --git a/gtk/src/presets.c b/gtk/src/presets.c
index d76d5d2..7bd9d4d 100644
--- a/gtk/src/presets.c
+++ b/gtk/src/presets.c
@@ -2029,8 +2029,6 @@ static value_map_t *vcodec_xlat;
 
 static value_map_t acodec_xlat_compat[] =
 {
-    {"AAC (CoreAudio)", "faac"},
-    {"HE-AAC (CoreAudio)", "faac"},
     {"AC3 (ffmpeg)", "ac3"},
     {"AC3", "ac3"},
     {"MP3 Passthru", "mp3pass"},
diff --git a/libhb/common.c b/libhb/common.c
index 95c9f92..b46465a 100644
--- a/libhb/common.c
+++ b/libhb/common.c
@@ -126,7 +126,6 @@ hb_encoder_t hb_audio_encoders[] =
     { "AAC (CoreAudio)",    "ca_aac",     HB_ACODEC_CA_AAC,       HB_MUX_MP4|HB_MUX_MKV },
     { "HE-AAC (CoreAudio)", "ca_haac",    HB_ACODEC_CA_HAAC,      HB_MUX_MP4|HB_MUX_MKV },
 #endif
-    { "AAC (faac)",         "faac",       HB_ACODEC_FAAC,         HB_MUX_MP4|HB_MUX_MKV },
 #ifdef USE_FDK_AAC
     { "AAC (FDK)",          "fdk_aac",    HB_ACODEC_FDK_AAC,      HB_MUX_MP4|HB_MUX_MKV },
     { "HE-AAC (FDK)",       "fdk_haac",   HB_ACODEC_FDK_HAAC,     HB_MUX_MP4|HB_MUX_MKV },
diff --git a/libhb/common.h b/libhb/common.h
index 8e7afb3..8a691b7 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -945,7 +945,6 @@ extern hb_work_object_t hb_decdca;
 extern hb_work_object_t hb_decavcodeca;
 extern hb_work_object_t hb_decavcodecv;
 extern hb_work_object_t hb_declpcm;
-extern hb_work_object_t hb_encfaac;
 extern hb_work_object_t hb_enclame;
 extern hb_work_object_t hb_encvorbis;
 extern hb_work_object_t hb_muxer;
diff --git a/libhb/encfaac.c b/libhb/encfaac.c
index ffdddc8..5d10d7b 100644
--- a/libhb/encfaac.c
+++ b/libhb/encfaac.c
@@ -1,3 +1,4 @@
+#if 0
 /* encfaac.c
 
    Copyright (c) 2003-2013 HandBrake Team
@@ -287,3 +288,4 @@ int encfaacWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
     return HB_WORK_OK;
 }
 
+#endif /* 0 */
\ No newline at end of file
diff --git a/libhb/hb.c b/libhb/hb.c
index 35e341b..b587089 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -487,7 +487,6 @@ hb_handle_t * hb_init( int verbose, int update_check )
 	hb_register( &hb_decavcodeca );
 	hb_register( &hb_decavcodecv );
 	hb_register( &hb_declpcm );
-	hb_register( &hb_encfaac );
 	hb_register( &hb_enclame );
 	hb_register( &hb_encvorbis );
 	hb_register( &hb_muxer );
@@ -588,7 +587,6 @@ hb_handle_t * hb_init_dl( int verbose, int update_check )
 	hb_register( &hb_decavcodeca );
 	hb_register( &hb_decavcodecv );
 	hb_register( &hb_declpcm );
-	hb_register( &hb_encfaac );
 	hb_register( &hb_enclame );
 	hb_register( &hb_encvorbis );
 	hb_register( &hb_muxer );
diff --git a/libhb/internal.h b/libhb/internal.h
index 4a2f775..b414d44 100644
--- a/libhb/internal.h
+++ b/libhb/internal.h
@@ -409,7 +409,6 @@ enum
     WORK_DECAVCODEC,
     WORK_DECAVCODECV,
     WORK_DECLPCM,
-    WORK_ENCFAAC,
     WORK_ENCLAME,
     WORK_ENCVORBIS,
     WORK_ENC_CA_AAC,
diff --git a/libhb/module.defs b/libhb/module.defs
index 4aa3648..d389eb3 100644
--- a/libhb/module.defs
+++ b/libhb/module.defs
@@ -1,4 +1,4 @@
-__deps__ := A52DEC BZIP2 FAAC FFMPEG FONTCONFIG FREETYPE LAME LIBASS LIBDCA \
+__deps__ := A52DEC BZIP2 FFMPEG FONTCONFIG FREETYPE LAME LIBASS LIBDCA \
     LIBDVDREAD LIBDVDNAV LIBICONV LIBMKV LIBOGG LIBSAMPLERATE LIBTHEORA LIBVORBIS LIBXML2 \
     MP4V2 MPEG2DEC PTHREADW32 X264 ZLIB LIBBLURAY FDKAAC
 
@@ -97,7 +97,7 @@ LIBHB.dll = $(LIBHB.build/)hb.dll
 LIBHB.lib = $(LIBHB.build/)hb.lib
 
 LIBHB.dll.libs = $(foreach n, \
-        a52 ass avcodec avformat avutil avresample dvdnav dvdread faac \
+        a52 ass avcodec avformat avutil avresample dvdnav dvdread \
         fontconfig freetype mkv mpeg2 mp3lame mp4v2 \
         ogg samplerate swscale theora vorbis vorbisenc x264 xml2 bluray, \
         $(CONTRIB.build/)lib/lib$(n).a )
diff --git a/libhb/muxmkv.c b/libhb/muxmkv.c
index a170eb5..27e7ec4 100644
--- a/libhb/muxmkv.c
+++ b/libhb/muxmkv.c
@@ -256,7 +256,6 @@ static int MKVInit( hb_mux_object_t * m )
                 }
                 track->codecID = MK_ACODEC_FLAC;
                 break;
-            case HB_ACODEC_FAAC:
             case HB_ACODEC_FFAAC:
             case HB_ACODEC_CA_AAC:
             case HB_ACODEC_CA_HAAC:
diff --git a/libhb/work.c b/libhb/work.c
index 45d341e..a2dba82 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -135,7 +135,6 @@ hb_work_object_t* hb_codec_encoder(int codec)
     switch (codec)
     {
         case HB_ACODEC_AC3:     return hb_get_work(WORK_ENCAVCODEC_AUDIO);
-        case HB_ACODEC_FAAC:    return hb_get_work(WORK_ENCFAAC);
         case HB_ACODEC_LAME:    return hb_get_work(WORK_ENCLAME);
         case HB_ACODEC_VORBIS:  return hb_get_work(WORK_ENCVORBIS);
         case HB_ACODEC_CA_AAC:  return hb_get_work(WORK_ENC_CA_AAC);
diff --git a/test/module.defs b/test/module.defs
index 7898a86..0aead61 100644
--- a/test/module.defs
+++ b/test/module.defs
@@ -14,7 +14,7 @@ TEST.GCC.L = $(CONTRIB.build/)lib
 TEST.libs = $(LIBHB.a)
 
 TEST.GCC.l = \
-        a52 ass avcodec avformat avutil avresample dvdnav dvdread faac \
+        a52 ass avcodec avformat avutil avresample dvdnav dvdread \
         fontconfig freetype fribidi mkv mpeg2 mp3lame mp4v2 ogg \
         samplerate swscale theoraenc theoradec vorbis vorbisenc x264 \
         bluray xml2 bz2 z
-- 
1.8.3.4


From 098cd340120048de6f9cee0c878b0465e5b275b2 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 4 Oct 2014 18:41:42 +0000
Subject: a52dec private api


diff --git a/libhb/deca52.c b/libhb/deca52.c
index 3c78d15..11f9ab3 100644
--- a/libhb/deca52.c
+++ b/libhb/deca52.c
@@ -387,12 +387,14 @@ static hb_buffer_t* Decode(hb_work_object_t *w)
                                                  pv->channel_layout,
                                                  pv->nchannels);
         }
+#if 0
         if (pv->use_mix_levels)
         {
             hb_audio_resample_set_mix_levels(pv->resample,
                                              (double)pv->state->slev,
                                              (double)pv->state->clev);
         }
+#endif
         if (hb_audio_resample_update(pv->resample))
         {
             hb_log("deca52: hb_audio_resample_update() failed");
-- 
1.8.3.4


From a6f029447238c8402d6ecc412cd192557ff32fc0 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 4 Oct 2014 18:58:20 +0000
Subject: workaround for mkv


diff --git a/libhb/muxmkv.c b/libhb/muxmkv.c
index 27e7ec4..e2ae3b6 100644
--- a/libhb/muxmkv.c
+++ b/libhb/muxmkv.c
@@ -293,8 +293,7 @@ static int MKVInit( hb_mux_object_t * m )
         {
             // For HE-AAC, write outputSamplingFreq too
             // samplingFreq is half of outputSamplingFreq
-            track->extra.audio.outputSamplingFreq = (float)audio->config.out.samplerate;
-            track->extra.audio.samplingFreq = track->extra.audio.outputSamplingFreq / 2.;
+            track->extra.audio.samplingFreq = audio->config.out.samplerate / 2.;
         }
         else
         {
@@ -361,7 +360,7 @@ static int MKVInit( hb_mux_object_t * m )
             case PGSSUB:
                 track->codecPrivate = NULL;
                 track->codecPrivateSize = 0;
-                track->codecID = MK_SUBTITLE_PGS;
+                track->codecID = "S_HDMV/PGS";
                 break;
             case SSASUB:
                 track->codecID = MK_SUBTITLE_SSA;
-- 
1.8.3.4


From 49285102bda3c265fcfa9279f109f283221fbd74 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sun, 5 Oct 2014 19:11:24 +0000
Subject: link against libnetwork


diff --git a/test/module.defs b/test/module.defs
index 0aead61..86f9912 100644
--- a/test/module.defs
+++ b/test/module.defs
@@ -44,6 +44,8 @@ else ifeq ($(BUILD.system),linux)
     TEST.GCC.l += pthread dl m
 else ifeq ($(BUILD.system),solaris)
     TEST.GCC.l += pthread nsl socket iconv
+else ifeq ($(BUILD.system),haiku)
+    TEST.GCC.l += network iconv
 else ifeq (1-mingw,$(BUILD.cross)-$(BUILD.system))
 ifeq ($(HAS.dlfcn),1)
     TEST.GCC.l += dl
-- 
1.8.3.4

