Merge pull request #3390 from davilla/amlcodec-fixes
authordavilla <davilla@xbmc.org>
Mon, 7 Oct 2013 13:54:50 +0000 (06:54 -0700)
committerdavilla <davilla@xbmc.org>
Mon, 7 Oct 2013 13:54:50 +0000 (06:54 -0700)
Amlcodec fixes

25 files changed:
XBMC.xcodeproj/project.pbxproj
configure.in
lib/ffmpeg/build_xbmc_win32.sh
project/BuildDependencies/scripts/0_package.list
project/BuildDependencies/scripts/dlextract.bat
project/BuildDependencies/scripts/get_mingw_env.txt
project/BuildDependencies/scripts/gnutls_d.bat [new file with mode: 0644]
project/BuildDependencies/scripts/gnutls_d.txt [new file with mode: 0644]
system/settings/settings.xml
tools/darwin/Configurations/App-OSX.xcconfig
tools/darwin/Configurations/App.xcconfig
tools/depends/Makefile.include.in
tools/depends/native/Makefile
tools/depends/native/xz-native/Makefile [new file with mode: 0644]
tools/depends/target/Makefile
tools/depends/target/config.site.in
tools/depends/target/gmp/Makefile [new file with mode: 0644]
tools/depends/target/gnutls/Makefile [new file with mode: 0644]
tools/depends/target/nettle/Makefile [new file with mode: 0644]
xbmc/Application.cpp
xbmc/addons/Skin.cpp
xbmc/linux/OMXCore.cpp
xbmc/linux/OMXCore.h
xbmc/linux/RBP.h
xbmc/osx/OSXGNUReplacements.c

index bb5bddb..9da070b 100644 (file)
                                        "-lsmbclient",
                                        "-lpython2.6",
                                        "-ltag",
+                                       "-lgnutls",
+                                       "-lhogweed",
+                                       "-lnettle",
+                                       "-lgmp",
                                        "-L$XBMC_DEPENDS/lib/mysql",
                                        "-lmysqlclient",
                                );
                                        "-lsmbclient",
                                        "-lpython2.6",
                                        "-ltag",
+                                       "-lgnutls",
+                                       "-lhogweed",
+                                       "-lnettle",
+                                       "-lgmp",
                                        "-L$XBMC_DEPENDS/lib/mysql",
                                        "-lmysqlclient",
                                );
index ec5ea78..9d635d4 100644 (file)
@@ -1031,6 +1031,7 @@ if test "$gcrypt_headers_available" = "yes"; then
    AC_CHECK_LIB([gcrypt],[gcry_control],, AC_MSG_ERROR($missing_library))
    AC_DEFINE([HAVE_GCRYPT],[1],[Define if we have gcrypt])
 fi
+PKG_CHECK_MODULES([GNUTLS], [gnutls], [have_gnutls=yes];AC_DEFINE([HAVE_GNUTLS], [1], [Define if we have gnutls])], AC_MSG_WARN("gnutls not found, ffmpeg TLS support disabled"))
 
 AC_CHECK_LIB([bz2],         [main],, AC_MSG_ERROR($missing_library))
 AC_CHECK_LIB([jpeg],        [main],, AC_MSG_ERROR($missing_library)) # check for cximage
@@ -2639,6 +2640,9 @@ XB_CONFIG_MODULE([lib/ffmpeg], [
     else
       ffmpg_config="$ffmpg_config --disable-libvorbis"
     fi
+    if test "$have_gnutls" = "yes"; then
+      ffmpg_config="$ffmpg_config --enable-gnutls"
+    fi
 
     # handle individual enables
     ffmpg_config="$ffmpg_config --enable-gpl"
@@ -2713,6 +2717,7 @@ XB_CONFIG_MODULE([lib/ffmpeg], [
       `if test "x$use_vaapi" != "xno"; then echo --enable-vaapi; else echo --disable-vaapi; fi` \
       `if test "$use_optimizations" != "no"; then echo --enable-optimizations; else echo --disable-optimizations; fi` \
       --enable-protocol=http \
+      `if test "$have_gnutls" = "yes"; then echo --enable-gnutls; fi` \
       --enable-pthreads \
       --enable-runtime-cpudetect \
       `if test "$use_hardcoded_tables" = "yes"; then echo --enable-hardcoded-tables; else echo --disable-hardcoded-tables; fi`\
index ea5a99c..dbc1b3e 100755 (executable)
@@ -48,6 +48,7 @@ OPTIONS="
 --enable-runtime-cpudetect \
 --enable-avfilter \
 --enable-dxva2 \
+--enable-gnutls \
 --disable-doc"
 
 ./configure --extra-cflags="-fno-common -Iinclude-xbmc-win32/dxva2 -DNDEBUG" --extra-ldflags="-L/xbmc/system/players/dvdplayer" ${OPTIONS} &&
index 15fba31..35fecd4 100644 (file)
@@ -16,3 +16,4 @@ pcre-8.33-win32.zip
 python-2.7.5-win32.7z
 sqlite-3.7.16.1-win32.7z
 taglib-1.8-win32.7z
+gnutls-3.2.3-win32
index 6834209..a9d7fe7 100644 (file)
@@ -22,7 +22,7 @@ echo -------------
 cd %TMP_PATH%
 
 FOR /F "eol=; tokens=1,2" %%f IN (%2) DO (
-  %ZIP% x %%f
+  %ZIP% x -y %%f
 )
 
 FOR /F "tokens=*" %%f IN ('dir /B "*.tar"') DO (
index fe50e35..51ce1de 100644 (file)
@@ -20,10 +20,10 @@ xasm-3.0.2-windows.zip                      http://mirrors.xbmc.org/build-deps/w
 plibc-0.1.6.zip                             http://mirrors.xbmc.org/build-deps/win32/mingw-msys/        http://sourceforge.net/projects/plibc/files/plibc/0.1.6/
 pthreads-w32-2.9.0-mingw32-pre-20110507-2-dev.tar.lzma   http://mirrors.xbmc.org/build-deps/win32/mingw-msys/        http://downloads.sourceforge.net/project/mingw/MinGW/pthreads-w32/pthreads-w32-2.9.0-pre-20110507-2/pthreads-w32-2.9.0-mingw32-pre-20110507-2-dev.tar.lzma
 libpthreadgc-2.9.0-mingw32-pre-20110507-2-dll-2.tar.lzma       http://mirrors.xbmc.org/build-deps/win32/mingw-msys/    http://downloads.sourceforge.net/project/mingw/MinGW/Base/pthreads-w32/pthreads-w32-2.9.0-pre-20110507-2/libpthreadgc-2.9.0-mingw32-pre-20110507-2-dll-2.tar.lzma
-gnutls-dev_2.4.2-1_win32.zip                http://mirrors.xbmc.org/build-deps/win32/mingw-msys/        http://ftp.acc.umu.se/pub/gnome/binaries/win32/dependencies/gnutls-dev_2.4.2-1_win32.zip
 gettext-0.17-1-mingw32-dev.tar.lzma         http://mirrors.xbmc.org/build-deps/win32/mingw-msys/        http://downloads.sourceforge.net/project/mingw/MinGW/gettext/gettext-0.17-1/gettext-0.17-1-mingw32-dev.tar.lzma
 libintl-0.17-1-mingw32-dll-8.tar.lzma       http://mirrors.xbmc.org/build-deps/win32/mingw-msys/        http://sourceforge.net/projects/mingw/files/MinGW/gettext/gettext-0.17-1/
 libiconv-1.13.1-1-mingw32-dll-2.tar.lzma    http://mirrors.xbmc.org/build-deps/win32/mingw-msys/        http://sourceforge.net/projects/mingw/files/MinGW/libiconv/libiconv-1.13.1-1/
 libiconv-1.13.1-1-mingw32-dev.tar.lzma      http://mirrors.xbmc.org/build-deps/win32/mingw-msys/        http://sourceforge.net/projects/mingw/files/MinGW/libiconv/libiconv-1.13.1-1/
 make-3.82-5-mingw32-bin.tar.lzma            http://mirrors.xbmc.org/build-deps/win32/mingw-msys/        http://sourceforge.net/projects/mingw/files/MinGW/Extension/make/make-3.82-mingw32/
-pkg-config-lite-0.28-1_bin-win32.zip       http://mirrors.xbmc.org/build-deps/win32/mingw-msys/        http://sourceforge.net/projects/pkgconfiglite/files/http://sourceforge.net/projects/pkgconfiglite/files/
\ No newline at end of file
+pkg-config-lite-0.28-1_bin-win32.zip       http://mirrors.xbmc.org/build-deps/win32/mingw-msys/            http://sourceforge.net/projects/pkgconfiglite/files/http://sourceforge.net/projects/pkgconfiglite/files/
+gnutls-3.2.3-mingw32.zip                    http://mirrors.xbmc.org/build-deps/win32/mingw-msys/        ftp://ftp.gnutls.org/gcrypt/gnutls/w32/ 
diff --git a/project/BuildDependencies/scripts/gnutls_d.bat b/project/BuildDependencies/scripts/gnutls_d.bat
new file mode 100644 (file)
index 0000000..3935a2a
--- /dev/null
@@ -0,0 +1,13 @@
+@ECHO OFF
+
+SET LOC_PATH=%CD%
+SET FILES=%LOC_PATH%\gnutls_d.txt
+
+CALL dlextract.bat dnssd %FILES%
+
+cd %TMP_PATH%
+
+del gnutls-3.2.3-win32\readme.txt
+xcopy gnutls-3.2.3-win32\* "%XBMC_PATH%\" /E /Q /I /Y
+
+cd %LOC_PATH%
diff --git a/project/BuildDependencies/scripts/gnutls_d.txt b/project/BuildDependencies/scripts/gnutls_d.txt
new file mode 100644 (file)
index 0000000..1c50125
--- /dev/null
@@ -0,0 +1,2 @@
+; filename                          source of the file
+gnutls-3.2.3-win32.zip             http://mirrors.xbmc.org/build-deps/win32/
index 64d6e63..8cbfc2d 100644 (file)
@@ -22,6 +22,9 @@
           <constraints>
             <options>skinthemes</options>
           </constraints>
+          <dependencies>
+            <dependency type="update" setting="lookandfeel.skin" />
+          </dependencies>
           <control type="spinner" format="string" delayed="true" />
         </setting>
         <setting id="lookandfeel.skincolors" type="string" parent="lookandfeel.skin" label="14078" help="36106">
@@ -30,6 +33,9 @@
           <constraints>
             <options>skincolors</options>
           </constraints>
+          <dependencies>
+            <dependency type="update" setting="lookandfeel.skin" />
+          </dependencies>
           <control type="spinner" format="string" delayed="true" />
         </setting>
         <setting id="lookandfeel.font" type="string" parent="lookandfeel.skin" label="13303" help="36107">
@@ -38,6 +44,9 @@
           <constraints>
             <options>skinfonts</options>
           </constraints>
+          <dependencies>
+            <dependency type="update" setting="lookandfeel.skin" />
+          </dependencies>
           <control type="spinner" format="string" delayed="true" />
         </setting>
         <setting id="lookandfeel.skinzoom" type="integer" parent="lookandfeel.skin" label="20109" help="36108">
@@ -48,6 +57,9 @@
             <step>2</step>
             <maximum>20</maximum>
           </constraints>
+          <dependencies>
+            <dependency type="update" setting="lookandfeel.skin" />
+          </dependencies>
           <control type="spinner" format="string">
             <formatlabel>14047</formatlabel>
           </control>
@@ -58,6 +70,9 @@
           <constraints>
             <options>startupwindows</options>
           </constraints>
+          <dependencies>
+            <dependency type="update" setting="lookandfeel.skin" />
+          </dependencies>
           <control type="spinner" format="string" />
         </setting>
         <setting id="lookandfeel.soundskin" type="string" label="15108" help="36110">
@@ -66,6 +81,9 @@
           <constraints>
             <options>skinsounds</options>
           </constraints>
+          <dependencies>
+            <dependency type="update" setting="lookandfeel.skin" />
+          </dependencies>
           <control type="spinner" format="string" />
         </setting>
       </group>
index 3c747dc..38a9902 100644 (file)
@@ -28,6 +28,6 @@ MACOSX_DEPLOYMENT_TARGET = 10.6
 
 
 
-OTHER_LDFLAGS = $(XBMC_OTHER_LDFLAGS_COMMON)
+OTHER_LDFLAGS = $(XBMC_OTHER_LDFLAGS_COMMON) -lgnutls -lhogweed -lnettle -lgmp
 
 GCC_PREPROCESSOR_DEFINITIONS = TARGET_DARWIN_OSX $(XBMC_GCC_PREPROCESSOR_DEFINITIONS_COMMON)
index 90f6849..e721298 100644 (file)
@@ -25,6 +25,6 @@ HEADER_SEARCH_PATHS = $(inherited) $SRCROOT xbmc xbmc/linux xbmc/osx xbmc/cores/
 LIBRARY_SEARCH_PATHS = $(inherited) $(SRCROOT) $(SRCROOT)/lib/libRTV $(SRCROOT)/lib/libXDAAP $(SRCROOT)/lib/cmyth/libcmyth $(SRCROOT)/lib/cmyth/librefmem $(SRCROOT)/lib/libsquish $(SRCROOT)/lib/SlingboxLib $(SRCROOT)/xbmc/interfaces/json-rpc "$(SRCROOT)/lib/ffmpeg/libavcodec" "$(SRCROOT)/lib/ffmpeg/libavutil" "$(SRCROOT)/lib/ffmpeg/libavformat" "$(SRCROOT)/lib/ffmpeg/libavfilter" "$(SRCROOT)/lib/ffmpeg/libavdevice" "$(SRCROOT)/lib/ffmpeg/libswresample" "$(SRCROOT)/lib/ffmpeg/libpostproc" "$(SRCROOT)/lib/ffmpeg/libswscale" "$(SRCROOT)/xbmc/interfaces/python" "$(SRCROOT)/xbmc/interfaces/legacy"
 FRAMEWORK_SEARCH_PATHS = $(inherited) "$(SDKROOT)/System/Library/PrivateFrameworks/" "$(SDKROOT)/System/Library/Frameworks/"
 
-XBMC_OTHER_LDFLAGS_COMMON = $(inherited) -Wl,-headerpad_max_install_names -Wl,-all_load -L$XBMC_DEPENDS/lib -lbz2 -lintl -lexpat -lssl -lgpg-error -lresolv -lffi -lssh -llzo2 -lpcre -lpcrecpp -lfribidi -lfreetype -lfontconfig -lsqlite3 -lsamplerate -ltinyxml -lmicrohttpd -lsmbclient -lpython2.6 -lyajl -ljpeg -lcrypto -lgcrypt -lavdevice -lavfilter -lavcodec -lavformat -lpostproc -lavutil -lswresample -lswscale -ltag -L$XBMC_DEPENDS/lib/mysql -lmysqlclient
+XBMC_OTHER_LDFLAGS_COMMON = $(inherited) -Wl,-headerpad_max_install_names -Wl,-all_load -L$XBMC_DEPENDS/lib -lbz2 -lintl -lexpat -lssl -lgpg-error -lresolv -lffi -lssh -llzo2 -lpcre -lpcrecpp -lfribidi -lfreetype -lfontconfig -lsqlite3 -lsamplerate -ltinyxml -lmicrohttpd -lsmbclient -lpython2.6 -lyajl -ljpeg -lcrypto -lgcrypt -lavdevice -lavfilter -lavcodec -lavformat -lpostproc -lavutil -lswresample -lswscale -ltag -L$XBMC_DEPENDS/lib/mysql -lmysqlclient 
 
 
index 7f7e55b..c7c452d 100644 (file)
@@ -14,6 +14,7 @@ RETRIEVE_TOOL=@CURL@
 ARCHIVE_TOOL=@TAR@
 PREFIX=@prefix@/@deps_dir@
 NATIVEPREFIX=@prefix@/@tool_dir@
+ARCHIVE_TOOL_NATIVE=$(NATIVEPREFIX)/bin/tar
 OS=@platform_os@
 CROSS_COMPILING=@cross_compiling@
 ARCH_DEFINES=@ARCH_DEFINES@
index 8dc74a2..202875c 100644 (file)
@@ -13,7 +13,11 @@ NATIVE= m4-native gettext-native autoconf-native automake-native \
 
 
 ifeq ($(OS),ios)
-  NATIVE += dpkg-native tar-native
+  NATIVE += dpkg-native xz-native tar-native
+endif
+
+ifeq ($(OS),osx)
+  NATIVE += xz-native tar-native
 endif
 
 .PHONY: $(NATIVE) native
@@ -31,6 +35,7 @@ swig-native: pcre-native
 libsdl_image-native: libsdl-native libpng-native libjpeg-turbo-native tiff-native
 distribute-native: python26-native
 distutilscross-native: python26-native distribute-native
+tar-native: xz-native
 
 #liblzo2 has stale packaged automake files that cause borked host/build detection
 liblzo2-native: automake-native
diff --git a/tools/depends/native/xz-native/Makefile b/tools/depends/native/xz-native/Makefile
new file mode 100644 (file)
index 0000000..81fd541
--- /dev/null
@@ -0,0 +1,39 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# app name, version
+APPNAME=xz
+VERSION=5.0.5
+SOURCE=$(APPNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+export LIBTOOL=builds/unix/libtool
+export PATH:=$(PREFIX)/bin:$(PATH)
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+APP=$(SOURCE)/src/xz/xz
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       -rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+       touch $@
+
+$(APP): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(APP)
+       $(MAKE) -C $(PLATFORM) install
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
index 37fae5b..eae2dcc 100644 (file)
@@ -7,7 +7,7 @@ endif
 DEPENDS = \
        pcre expat gettext sqlite3 libgpg-error \
        libgcrypt bzip2 liblzo2 libzip freetype2 fontconfig \
-       openssl libssh2 curl \
+       openssl gmp nettle gnutls libssh2 curl \
        libjpeg-turbo tiff jasper libpng \
        libogg libvorbis libflac libmad fribidi libmpeg2 \
        libass libsamplerate \
@@ -25,7 +25,7 @@ endif
 
 ifeq ($(OS),ios)
   DEPENDS += Backrow
-  EXCLUDED_DEPENDS = libcec libcrystalhd libusb
+  EXCLUDED_DEPENDS = libcec libcrystalhd libusb gmp nettle gnutls
 endif
 
 ifeq ($(OS),osx)
@@ -87,6 +87,8 @@ libzip: $(ZLIB)
 libmp3lame: $(ICONV)
 libpng: $(ZLIB)
 openssl: $(ZLIB)
+gnutls: nettle $(ZLIB)
+nettle: gmp
 pythonmodule-pil: $(ZLIB) libjpeg-turbo libpng freetype2 python26
 libsdl: $(LINUX_SYSTEM_LIBS)
 
index 17d363d..446c342 100644 (file)
@@ -72,6 +72,10 @@ if test "@platform_os@" = "osx"; then
   ac_cv_func_strnlen_working=no
 fi
 
+#gnutls
+gl_cv_func_gettimeofday_clobber=no
+
+
 #samba
 SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=yes
 samba_cv_CC_NEGATIVE_ENUM_VALUES=yes
diff --git a/tools/depends/target/gmp/Makefile b/tools/depends/target/gmp/Makefile
new file mode 100644 (file)
index 0000000..213a7ba
--- /dev/null
@@ -0,0 +1,51 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=gmp
+VERSION=5.1.2
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+# ABI selection
+ifeq ($(OS),linux)
+  ifeq (i686,$(findstring i686,$(HOST)))
+    ABI=ABI=32
+  else
+  ifeq (i386,$(findstring i386,$(HOST)))
+    ABI=ABI=32
+  endif
+  endif
+endif
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-shared $(ABI)
+
+LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/gnutls/Makefile b/tools/depends/target/gnutls/Makefile
new file mode 100644 (file)
index 0000000..7e7ec69
--- /dev/null
@@ -0,0 +1,45 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=gnutls
+VERSION=3.1.14
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.xz
+
+ifeq (darwin, $(findstring darwin, $(HOST)))
+# darwins tar doesn't know about xz - so we need our native version of tar here
+ARCHIVE_TOOL=$(ARCHIVE_TOOL_NATIVE)
+endif
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-shared --without-p11-kit --disable-nls
+
+LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/nettle/Makefile b/tools/depends/target/nettle/Makefile
new file mode 100644 (file)
index 0000000..e487415
--- /dev/null
@@ -0,0 +1,40 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=nettle
+VERSION=2.7.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-shared --disable-openssl
+
+LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
index e033d1b..080f614 100644 (file)
@@ -1571,7 +1571,15 @@ void CApplication::OnSettingChanged(const CSetting *setting)
   if (settingId == "lookandfeel.skin" ||
       settingId == "lookandfeel.font" ||
       settingId == "lookandfeel.skincolors")
-    CApplicationMessenger::Get().ExecBuiltIn("ReloadSkin");
+  {
+    // if the skin changes and the current theme is not the default one, reset
+    // the theme to the default value (which will also change lookandfeel.skincolors
+    // which in turn will reload the skin
+    if (settingId == "lookandfeel.skin" && CSettings::Get().GetString("lookandfeel.skintheme") != "SKINDEFAULT")
+      CSettings::Get().SetString("lookandfeel.skintheme", "SKINDEFAULT");
+    else
+      CApplicationMessenger::Get().ExecBuiltIn("ReloadSkin");
+  }
   else if (settingId == "lookandfeel.skintheme")
   {
     // also set the default color theme
index 1475cc2..35b6bda 100644 (file)
@@ -281,6 +281,12 @@ const INFO::CSkinVariableString* CSkinInfo::CreateSkinVariable(const CStdString&
 
 void CSkinInfo::SettingOptionsSkinColorsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current)
 {
+  CStdString settingValue = ((const CSettingString*)setting)->GetValue();
+  // Remove the .xml extension from the Themes
+  if (URIUtils::HasExtension(settingValue, ".xml"))
+    URIUtils::RemoveExtension(settingValue);
+  current = "SKINDEFAULT";
+
   // There is a default theme (just defaults.xml)
   // any other *.xml files are additional color themes on top of this one.
   
@@ -305,19 +311,18 @@ void CSkinInfo::SettingOptionsSkinColorsFiller(const CSetting *setting, std::vec
   sort(vecColors.begin(), vecColors.end(), sortstringbyname());
 
   for (int i = 0; i < (int) vecColors.size(); ++i)
+  {
     list.push_back(make_pair(vecColors[i], vecColors[i]));
 
-  CStdString settingValue = ((const CSettingString*)setting)->GetValue();
-  // Remove the .xml extension from the Themes
-  if (URIUtils::HasExtension(settingValue, ".xml"))
-    URIUtils::RemoveExtension(settingValue);
-  
-  // Set the choosen theme
-  current = settingValue;
+    if (StringUtils::EqualsNoCase(vecColors[i], settingValue))
+      current = settingValue;
+  }
 }
 
 void CSkinInfo::SettingOptionsSkinFontsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current)
 {
+  CStdString settingValue = ((const CSettingString*)setting)->GetValue();
+  bool currentValueSet = false;
   std::string strPath = g_SkinInfo->GetSkinPath("Font.xml");
 
   CXBMCTinyXML xmlDoc;
@@ -361,6 +366,9 @@ void CSkinInfo::SettingOptionsSkinFontsFiller(const CSetting *setting, std::vect
             list.push_back(make_pair(g_localizeStrings.Get(atoi(idLocAttr)), idAttr));
           else
             list.push_back(make_pair(idAttr, idAttr));
+
+          if (StringUtils::EqualsNoCase(idAttr, settingValue.c_str()))
+            currentValueSet = true;
         }
       }
 
@@ -371,11 +379,19 @@ void CSkinInfo::SettingOptionsSkinFontsFiller(const CSetting *setting, std::vect
   {
     // Since no fontset is defined, there is no selection of a fontset, so disable the component
     list.push_back(make_pair(g_localizeStrings.Get(13278), ""));
+    current = "";
+    currentValueSet = true;
   }
+
+  if (!currentValueSet)
+    current = list[0].second;
 }
 
 void CSkinInfo::SettingOptionsSkinSoundFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current)
 {
+  CStdString settingValue = ((const CSettingString*)setting)->GetValue();
+  current = "SKINDEFAULT";
+
   //find skins...
   CFileItemList items;
   CDirectory::GetDirectory("special://xbmc/sounds/", items);
@@ -401,14 +417,23 @@ void CSkinInfo::SettingOptionsSkinSoundFiller(const CSetting *setting, std::vect
 
   sort(vecSoundSkins.begin(), vecSoundSkins.end(), sortstringbyname());
   for (unsigned int i = 0; i < vecSoundSkins.size(); i++)
+  {
     list.push_back(make_pair(vecSoundSkins[i], vecSoundSkins[i]));
+
+    if (StringUtils::EqualsNoCase(vecSoundSkins[i], settingValue))
+      current = settingValue;
+  }
 }
 
 void CSkinInfo::SettingOptionsSkinThemesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current)
 {
+  // get the choosen theme and remove the extension from the current theme (backward compat)
+  CStdString settingValue = ((const CSettingString*)setting)->GetValue();
+  URIUtils::RemoveExtension(settingValue);
+  current = "SKINDEFAULT";
+
   // there is a default theme (just Textures.xpr/xbt)
   // any other *.xpr|*.xbt files are additional themes on top of this one.
-  const CSettingString *pSettingString = (const CSettingString *)setting;
 
   // add the default Label
   list.push_back(make_pair(g_localizeStrings.Get(15109), "SKINDEFAULT")); // the standard Textures.xpr/xbt will be used
@@ -419,16 +444,19 @@ void CSkinInfo::SettingOptionsSkinThemesFiller(const CSetting *setting, std::vec
 
   // sort the themes for GUI and list them
   for (int i = 0; i < (int) vecTheme.size(); ++i)
+  {
     list.push_back(make_pair(vecTheme[i], vecTheme[i]));
 
-  // set the choosen theme and remove the extension from the current theme (backward compat)
-  CStdString settingValue = pSettingString->GetValue();
-  URIUtils::RemoveExtension(settingValue);
-  current = settingValue;
+    if (StringUtils::EqualsNoCase(vecTheme[i], settingValue))
+      current = settingValue;
+  }
 }
 
 void CSkinInfo::SettingOptionsStartupWindowsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int &current)
 {
+  int settingValue = ((const CSettingInt *)setting)->GetValue();
+  current = -1;
+
   const vector<CStartupWindow> &startupWindows = g_SkinInfo->GetStartupWindows();
 
   for (vector<CStartupWindow>::const_iterator it = startupWindows.begin(); it != startupWindows.end(); it++)
@@ -439,7 +467,14 @@ void CSkinInfo::SettingOptionsStartupWindowsFiller(const CSetting *setting, std:
     int windowID = it->m_id;
 
     list.push_back(make_pair(windowName, windowID));
+
+    if (settingValue == windowID)
+      current = settingValue;
   }
+
+  // if the current value hasn't been properly set, set it to the first window in the list
+  if (current < 0)
+    current = list[0].second;
 }
 
 } /*namespace ADDON*/
index 0e68949..1633a0d 100644 (file)
@@ -32,6 +32,7 @@
 #include "utils/log.h"
 
 #include "OMXClock.h"
+#include "xbmc/linux/RBP.h"
 
 #ifdef TARGET_LINUX
 #include "XMemUtils.h"
 
 static void add_timespecs(struct timespec &time, long millisecs)
 {
-   time.tv_sec  += millisecs / 1000;
-   time.tv_nsec += (millisecs % 1000) * 1000000;
-   if (time.tv_nsec > 1000000000)
+   long long nsec = time.tv_nsec + (long long)millisecs * 1000000;
+   while (nsec > 1000000000)
    {
-      time.tv_sec  += 1;
-      time.tv_nsec -= 1000000000;
+      time.tv_sec += 1;
+      nsec -= 1000000000;
    }
+   time.tv_nsec = nsec;
 }
 
 
@@ -64,22 +65,12 @@ COMXCoreTunel::COMXCoreTunel()
   m_dst_port            = 0;
   m_portSettingsChanged = false;
   m_tunnel_set          = false;
-  m_DllOMX              = new DllOMX();
-
-  if(m_DllOMX)
-    m_DllOMXOpen        = m_DllOMX->Load();
-  else
-    m_DllOMXOpen        = false;
-
+  m_DllOMX              = g_RBP.GetDllOMX();
   pthread_mutex_init(&m_lock, NULL);
 }
 
 COMXCoreTunel::~COMXCoreTunel()
 {
-  if(m_DllOMXOpen)
-    m_DllOMX->Unload();
-  delete m_DllOMX;
-
   pthread_mutex_destroy(&m_lock);
 }
 
@@ -95,8 +86,6 @@ void COMXCoreTunel::UnLock()
 
 void COMXCoreTunel::Initialize(COMXCoreComponent *src_component, unsigned int src_port, COMXCoreComponent *dst_component, unsigned int dst_port)
 {
-  if(!m_DllOMXOpen)
-    return;
   m_src_component  = src_component;
   m_src_port    = src_port;
   m_dst_component  = dst_component;
@@ -110,7 +99,7 @@ bool COMXCoreTunel::IsInitialized()
 
 OMX_ERRORTYPE COMXCoreTunel::Flush()
 {
-  if(!m_DllOMXOpen || !m_src_component || !m_dst_component || !m_tunnel_set || !IsInitialized())
+  if(!m_src_component || !m_dst_component || !m_tunnel_set || !IsInitialized())
     return OMX_ErrorUndefined;
 
   Lock();
@@ -149,9 +138,6 @@ OMX_ERRORTYPE COMXCoreTunel::Flush()
 
 OMX_ERRORTYPE COMXCoreTunel::Deestablish(bool noWait)
 {
-  if(!m_DllOMXOpen)
-    return OMX_ErrorUndefined;
-
   if(!m_src_component || !m_dst_component || !IsInitialized())
     return OMX_ErrorUndefined;
 
@@ -211,9 +197,6 @@ OMX_ERRORTYPE COMXCoreTunel::Deestablish(bool noWait)
 
 OMX_ERRORTYPE COMXCoreTunel::Establish(bool portSettingsChanged, bool enable_ports /* = true */)
 {
-  if(!m_DllOMXOpen)
-    return OMX_ErrorUndefined;
-
   Lock();
 
   OMX_ERRORTYPE omx_err = OMX_ErrorNone;
@@ -319,7 +302,7 @@ OMX_ERRORTYPE COMXCoreTunel::Establish(bool portSettingsChanged, bool enable_por
       UnLock();
       return omx_err;
     }
-    
+
     if(m_dst_component->GetState() == OMX_StateLoaded)
     {
       omx_err = m_dst_component->SetStateForComponent(OMX_StateIdle);
@@ -373,6 +356,9 @@ COMXCoreComponent::COMXCoreComponent()
 
   m_exit = false;
 
+  m_omx_input_use_buffers  = false;
+  m_omx_output_use_buffers = false;
+
   pthread_mutex_init(&m_omx_input_mutex, NULL);
   pthread_mutex_init(&m_omx_output_mutex, NULL);
   pthread_mutex_init(&m_omx_event_mutex, NULL);
@@ -381,15 +367,7 @@ COMXCoreComponent::COMXCoreComponent()
   pthread_cond_init(&m_output_buffer_cond, NULL);
   pthread_cond_init(&m_omx_event_cond, NULL);
 
-  m_omx_input_use_buffers  = false;
-  m_omx_output_use_buffers = false;
-
-  m_DllOMX = new DllOMX();
-
-  if(m_DllOMX)
-    m_DllOMXOpen = m_DllOMX->Load();
-  else
-    m_DllOMXOpen = false;
+  m_DllOMX = g_RBP.GetDllOMX();
 
   pthread_mutex_init(&m_lock, NULL);
 }
@@ -407,10 +385,6 @@ COMXCoreComponent::~COMXCoreComponent()
   pthread_cond_destroy(&m_omx_event_cond);
 
   pthread_mutex_destroy(&m_lock);
-
-  if(m_DllOMXOpen)
-    m_DllOMX->Unload();
-  delete m_DllOMX;
 }
 
 void COMXCoreComponent::Lock()
@@ -428,7 +402,7 @@ void COMXCoreComponent::TransitionToStateLoaded()
   if(!m_handle)
     return;
 
-  if(GetState() != OMX_StateIdle)
+  if(GetState() != OMX_StateLoaded && GetState() != OMX_StateIdle)
     SetStateForComponent(OMX_StateIdle);
 
   if(GetState() != OMX_StateLoaded)
@@ -439,6 +413,9 @@ OMX_ERRORTYPE COMXCoreComponent::EmptyThisBuffer(OMX_BUFFERHEADERTYPE *omx_buffe
 {
   OMX_ERRORTYPE omx_err = OMX_ErrorNone;
 
+  #if defined(OMX_DEBUG_EVENTHANDLER)
+  CLog::Log(LOGDEBUG, "COMXCoreComponent::EmptyThisBuffer component(%s) %p\n", m_componentName.c_str(), omx_buffer);
+  #endif
   if(!m_handle || !omx_buffer)
     return OMX_ErrorUndefined;
 
@@ -456,6 +433,9 @@ OMX_ERRORTYPE COMXCoreComponent::FillThisBuffer(OMX_BUFFERHEADERTYPE *omx_buffer
 {
   OMX_ERRORTYPE omx_err = OMX_ErrorNone;
 
+  #if defined(OMX_DEBUG_EVENTHANDLER)
+  CLog::Log(LOGDEBUG, "COMXCoreComponent::FillThisBuffer component(%s) %p\n", m_componentName.c_str(), omx_buffer);
+  #endif
   if(!m_handle || !omx_buffer)
     return OMX_ErrorUndefined;
 
@@ -559,7 +539,7 @@ void COMXCoreComponent::FlushOutput()
 }
 
 // timeout in milliseconds
-OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetInputBuffer(long timeout)
+OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetInputBuffer(long timeout /*=200*/)
 {
   OMX_BUFFERHEADERTYPE *omx_input_buffer = NULL;
 
@@ -570,8 +550,10 @@ OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetInputBuffer(long timeout)
   struct timespec endtime;
   clock_gettime(CLOCK_REALTIME, &endtime);
   add_timespecs(endtime, timeout);
-  while (1 && !m_flush_input)
+  while (!m_flush_input)
   {
+    if (m_resource_error)
+      break;
     if(!m_omx_input_avaliable.empty())
     {
       omx_input_buffer = m_omx_input_avaliable.front();
@@ -581,7 +563,8 @@ OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetInputBuffer(long timeout)
 
     int retcode = pthread_cond_timedwait(&m_input_buffer_cond, &m_omx_input_mutex, &endtime);
     if (retcode != 0) {
-      CLog::Log(LOGERROR, "COMXCoreComponent::GetInputBuffer %s wait event timeout\n", m_componentName.c_str());
+      if (timeout != 0)
+        CLog::Log(LOGERROR, "COMXCoreComponent::GetInputBuffer %s wait event timeout\n", m_componentName.c_str());
       break;
     }
   }
@@ -589,7 +572,7 @@ OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetInputBuffer(long timeout)
   return omx_input_buffer;
 }
 
-OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetOutputBuffer()
+OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetOutputBuffer(long timeout /*=200*/)
 {
   OMX_BUFFERHEADERTYPE *omx_output_buffer = NULL;
 
@@ -597,17 +580,82 @@ OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetOutputBuffer()
     return NULL;
 
   pthread_mutex_lock(&m_omx_output_mutex);
+  struct timespec endtime;
+  clock_gettime(CLOCK_REALTIME, &endtime);
+  add_timespecs(endtime, timeout);
+  while (!m_flush_output)
+  {
+    if (m_resource_error)
+      break;
+    if(!m_omx_output_available.empty())
+    {
+      omx_output_buffer = m_omx_output_available.front();
+      m_omx_output_available.pop();
+      break;
+    }
+
+    int retcode = pthread_cond_timedwait(&m_output_buffer_cond, &m_omx_output_mutex, &endtime);
+    if (retcode != 0) {
+      CLog::Log(LOGERROR, "COMXCoreComponent::GetOutputBuffer %s wait event timeout\n", m_componentName.c_str());
+      break;
+    }
+  }
+  pthread_mutex_unlock(&m_omx_output_mutex);
+
+  return omx_output_buffer;
+}
+
 
-  if(!m_omx_output_available.empty())
+OMX_ERRORTYPE COMXCoreComponent::WaitForInputDone(long timeout /*=200*/)
+{
+  OMX_ERRORTYPE omx_err = OMX_ErrorNone;
+
+  pthread_mutex_lock(&m_omx_input_mutex);
+  struct timespec endtime;
+  clock_gettime(CLOCK_REALTIME, &endtime);
+  add_timespecs(endtime, timeout);
+  while (m_input_buffer_count != m_omx_input_avaliable.size())
   {
-    omx_output_buffer = m_omx_output_available.front();
-    m_omx_output_available.pop();
+    if (m_resource_error)
+      break;
+    int retcode = pthread_cond_timedwait(&m_input_buffer_cond, &m_omx_input_mutex, &endtime);
+    if (retcode != 0) {
+      if (timeout != 0)
+        CLog::Log(LOGERROR, "COMXCoreComponent::WaitForInputDone %s wait event timeout\n", m_componentName.c_str());
+      omx_err = OMX_ErrorTimeout;
+      break;
+    }
   }
+  pthread_mutex_unlock(&m_omx_input_mutex);
+  return omx_err;
+}
+
+
+OMX_ERRORTYPE COMXCoreComponent::WaitForOutputDone(long timeout /*=200*/)
+{
+  OMX_ERRORTYPE omx_err = OMX_ErrorNone;
 
+  pthread_mutex_lock(&m_omx_output_mutex);
+  struct timespec endtime;
+  clock_gettime(CLOCK_REALTIME, &endtime);
+  add_timespecs(endtime, timeout);
+  while (m_output_buffer_count != m_omx_output_available.size())
+  {
+    if (m_resource_error)
+      break;
+    int retcode = pthread_cond_timedwait(&m_output_buffer_cond, &m_omx_output_mutex, &endtime);
+    if (retcode != 0) {
+      if (timeout != 0)
+        CLog::Log(LOGERROR, "COMXCoreComponent::WaitForOutputDone %s wait event timeout\n", m_componentName.c_str());
+      omx_err = OMX_ErrorTimeout;
+      break;
+    }
+  }
   pthread_mutex_unlock(&m_omx_output_mutex);
-  return omx_output_buffer;
+  return omx_err;
 }
 
+
 OMX_ERRORTYPE COMXCoreComponent::AllocInputBuffers(bool use_buffers /* = false **/)
 {
   OMX_ERRORTYPE omx_err = OMX_ErrorNone;
@@ -678,6 +726,11 @@ OMX_ERRORTYPE COMXCoreComponent::AllocInputBuffers(bool use_buffers /* = false *
   }
 
   omx_err = WaitForCommand(OMX_CommandPortEnable, m_input_port);
+  if(omx_err != OMX_ErrorNone)
+  {
+    CLog::Log(LOGERROR, "COMXCoreComponent::AllocInputBuffers WaitForCommand:OMX_CommandPortEnable failed on %s omx_err(0x%08x)\n", m_componentName.c_str(), omx_err);
+    return omx_err;
+  }
 
   m_flush_input = false;
 
@@ -754,6 +807,11 @@ OMX_ERRORTYPE COMXCoreComponent::AllocOutputBuffers(bool use_buffers /* = false
   }
 
   omx_err = WaitForCommand(OMX_CommandPortEnable, m_output_port);
+  if(omx_err != OMX_ErrorNone)
+  {
+    CLog::Log(LOGERROR, "COMXCoreComponent::AllocOutputBuffers WaitForCommand:OMX_CommandPortEnable failed on %s omx_err(0x%08x)\n", m_componentName.c_str(), omx_err);
+    return omx_err;
+  }
 
   m_flush_output = false;
 
@@ -772,11 +830,11 @@ OMX_ERRORTYPE COMXCoreComponent::FreeInputBuffers()
 
   m_flush_input = true;
 
+  omx_err = DisablePort(m_input_port, false);
+
   pthread_mutex_lock(&m_omx_input_mutex);
   pthread_cond_broadcast(&m_input_buffer_cond);
 
-  omx_err = DisablePort(m_input_port, false);
-
   for (size_t i = 0; i < m_omx_input_buffers.size(); i++)
   {
     uint8_t *buf = m_omx_input_buffers[i]->pBuffer;
@@ -791,8 +849,17 @@ OMX_ERRORTYPE COMXCoreComponent::FreeInputBuffers()
       CLog::Log(LOGERROR, "COMXCoreComponent::FreeInputBuffers error deallocate omx input buffer on component %s omx_err(0x%08x)\n", m_componentName.c_str(), omx_err);
     }
   }
+  pthread_mutex_unlock(&m_omx_input_mutex);
 
-  WaitForCommand(OMX_CommandPortDisable, m_input_port);
+  omx_err = WaitForCommand(OMX_CommandPortDisable, m_input_port);
+  if(omx_err != OMX_ErrorNone)
+  {
+    CLog::Log(LOGERROR, "COMXCoreComponent::FreeInputBuffers WaitForCommand:OMX_CommandPortDisable failed on %s omx_err(0x%08x)\n", m_componentName.c_str(), omx_err);
+  }
+
+  WaitForInputDone(1000);
+
+  pthread_mutex_lock(&m_omx_input_mutex);
   assert(m_omx_input_buffers.size() == m_omx_input_avaliable.size());
 
   m_omx_input_buffers.clear();
@@ -821,11 +888,11 @@ OMX_ERRORTYPE COMXCoreComponent::FreeOutputBuffers()
 
   m_flush_output = true;
 
+  omx_err = DisablePort(m_output_port, false);
+
   pthread_mutex_lock(&m_omx_output_mutex);
   pthread_cond_broadcast(&m_output_buffer_cond);
 
-  omx_err = DisablePort(m_output_port, false);
-
   for (size_t i = 0; i < m_omx_output_buffers.size(); i++)
   {
     uint8_t *buf = m_omx_output_buffers[i]->pBuffer;
@@ -840,8 +907,17 @@ OMX_ERRORTYPE COMXCoreComponent::FreeOutputBuffers()
       CLog::Log(LOGERROR, "COMXCoreComponent::FreeOutputBuffers error deallocate omx output buffer on component %s omx_err(0x%08x)\n", m_componentName.c_str(), omx_err);
     }
   }
+  pthread_mutex_unlock(&m_omx_output_mutex);
+
+  omx_err = WaitForCommand(OMX_CommandPortDisable, m_output_port);
+  if(omx_err != OMX_ErrorNone)
+  {
+    CLog::Log(LOGERROR, "COMXCoreComponent::FreeOutputBuffers WaitForCommand:OMX_CommandPortDisable failed on %s omx_err(0x%08x)\n", m_componentName.c_str(), omx_err);
+  }
+
+  WaitForOutputDone(1000);
 
-  WaitForCommand(OMX_CommandPortDisable, m_output_port);
+  pthread_mutex_lock(&m_omx_output_mutex);
   assert(m_omx_output_buffers.size() == m_omx_output_available.size());
 
   m_omx_output_buffers.clear();
@@ -1009,6 +1085,8 @@ OMX_ERRORTYPE COMXCoreComponent::WaitForEvent(OMX_EVENTTYPE eventType, long time
       }
     }
 
+    if (m_resource_error)
+      break;
     int retcode = pthread_cond_timedwait(&m_omx_event_cond, &m_omx_event_mutex, &endtime);
     if (retcode != 0) 
     {
@@ -1016,7 +1094,7 @@ OMX_ERRORTYPE COMXCoreComponent::WaitForEvent(OMX_EVENTTYPE eventType, long time
         CLog::Log(LOGERROR, "COMXCoreComponent::WaitForEvent %s wait event 0x%08x timeout %ld\n",
                           m_componentName.c_str(), (int)eventType, timeout);
       pthread_mutex_unlock(&m_omx_event_mutex);
-      return OMX_ErrorMax;
+      return OMX_ErrorTimeout;
     }
   }
   pthread_mutex_unlock(&m_omx_event_mutex);
@@ -1076,13 +1154,15 @@ OMX_ERRORTYPE COMXCoreComponent::WaitForCommand(OMX_U32 command, OMX_U32 nData2,
       }
     }
 
+    if (m_resource_error)
+      break;
     int retcode = pthread_cond_timedwait(&m_omx_event_cond, &m_omx_event_mutex, &endtime);
     if (retcode != 0) {
       CLog::Log(LOGERROR, "COMXCoreComponent::WaitForCommand %s wait timeout event.eEvent 0x%08x event.command 0x%08x event.nData2 %d\n", 
         m_componentName.c_str(), (int)OMX_EventCmdComplete, (int)command, (int)nData2);
       
       pthread_mutex_unlock(&m_omx_event_mutex);
-      return OMX_ErrorMax;
+      return OMX_ErrorTimeout;
     }
   }
   pthread_mutex_unlock(&m_omx_event_mutex);
@@ -1110,6 +1190,8 @@ OMX_ERRORTYPE COMXCoreComponent::SetStateForComponent(OMX_STATETYPE state)
   {
     if(omx_err == OMX_ErrorSameState)
     {
+      CLog::Log(LOGERROR, "COMXCoreComponent::SetStateForComponent - %s same state\n",
+        m_componentName.c_str());
       omx_err = OMX_ErrorNone;
     }
     else
@@ -1121,12 +1203,10 @@ OMX_ERRORTYPE COMXCoreComponent::SetStateForComponent(OMX_STATETYPE state)
   else 
   {
     omx_err = WaitForCommand(OMX_CommandStateSet, state);
-    if(omx_err == OMX_ErrorSameState)
+    if (omx_err != OMX_ErrorNone)
     {
-      CLog::Log(LOGERROR, "COMXCoreComponent::SetStateForComponent - %s ignore OMX_ErrorSameState\n", 
-        m_componentName.c_str());
-      UnLock();
-      return OMX_ErrorNone;
+      CLog::Log(LOGERROR, "COMXCoreComponent::WaitForCommand - %s failed with omx_err(0x%x)\n",
+        m_componentName.c_str(), omx_err);
     }
   }
 
@@ -1367,10 +1447,28 @@ bool COMXCoreComponent::Initialize( const std::string &component_name, OMX_INDEX
 {
   OMX_ERRORTYPE omx_err;
 
-  if(!m_DllOMXOpen)
-    return false;
+  m_input_port  = 0;
+  m_output_port = 0;
+  m_handle      = NULL;
+
+  m_input_alignment     = 0;
+  m_input_buffer_size  = 0;
+  m_input_buffer_count  = 0;
+
+  m_output_alignment    = 0;
+  m_output_buffer_size  = 0;
+  m_output_buffer_count = 0;
+  m_flush_input         = false;
+  m_flush_output        = false;
+  m_resource_error      = false;
+
+  m_eos                 = false;
+
+  m_exit = false;
+
+  m_omx_input_use_buffers  = false;
+  m_omx_output_use_buffers = false;
 
-  m_resource_error = false;
   m_componentName = component_name;
   
   m_callbacks.EventHandler    = &COMXCoreComponent::DecoderEventHandlerCallback;
@@ -1389,8 +1487,8 @@ bool COMXCoreComponent::Initialize( const std::string &component_name, OMX_INDEX
       return false;
     }
 
-    CLog::Log(LOGDEBUG, "COMXCoreComponent::Initialize : %s handle %p dllopen : %d\n", 
-          m_componentName.c_str(), m_handle, m_DllOMXOpen);
+    CLog::Log(LOGDEBUG, "COMXCoreComponent::Initialize : %s handle %p\n",
+          m_componentName.c_str(), m_handle);
   }
 
   OMX_PORT_PARAM_TYPE port_param;
@@ -1453,7 +1551,7 @@ bool COMXCoreComponent::Deinitialize(bool free_component /* = false */)
   m_flush_input   = true;
   m_flush_output  = true;
 
-  if(m_handle && m_DllOMXOpen)
+  if(m_handle)
   {
     FlushAll();
 
@@ -1464,8 +1562,8 @@ bool COMXCoreComponent::Deinitialize(bool free_component /* = false */)
 
     if(free_component)
     {
-      CLog::Log(LOGDEBUG, "COMXCoreComponent::Deinitialize : %s handle %p dllopen : %d\n", 
-          m_componentName.c_str(), m_handle, m_DllOMXOpen);
+      CLog::Log(LOGDEBUG, "COMXCoreComponent::Deinitialize : %s handle %p\n",
+          m_componentName.c_str(), m_handle);
       omx_err = m_DllOMX->OMX_FreeHandle(m_handle);
       if (omx_err != OMX_ErrorNone)
       {
@@ -1498,7 +1596,7 @@ OMX_ERRORTYPE COMXCoreComponent::DecoderEventHandlerCallback(
     return OMX_ErrorNone;
 
   COMXCoreComponent *ctx = static_cast<COMXCoreComponent*>(pAppData);
-  return ctx->DecoderEventHandler(hComponent, pAppData, eEvent, nData1, nData2, pEventData);
+  return ctx->DecoderEventHandler(hComponent, eEvent, nData1, nData2, pEventData);
 }
 
 // DecoderEmptyBufferDone -- OMXCore input buffer has been emptied
@@ -1511,7 +1609,7 @@ OMX_ERRORTYPE COMXCoreComponent::DecoderEmptyBufferDoneCallback(
     return OMX_ErrorNone;
 
   COMXCoreComponent *ctx = static_cast<COMXCoreComponent*>(pAppData);
-  return ctx->DecoderEmptyBufferDone( hComponent, pAppData, pBuffer);
+  return ctx->DecoderEmptyBufferDone( hComponent, pBuffer);
 }
 
 // DecoderFillBufferDone -- OMXCore output buffer has been filled
@@ -1524,41 +1622,43 @@ OMX_ERRORTYPE COMXCoreComponent::DecoderFillBufferDoneCallback(
     return OMX_ErrorNone;
 
   COMXCoreComponent *ctx = static_cast<COMXCoreComponent*>(pAppData);
-  return ctx->DecoderFillBufferDone(hComponent, pAppData, pBuffer);
+  return ctx->DecoderFillBufferDone(hComponent, pBuffer);
 }
 
-OMX_ERRORTYPE COMXCoreComponent::DecoderEmptyBufferDone(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer)
+OMX_ERRORTYPE COMXCoreComponent::DecoderEmptyBufferDone(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE* pBuffer)
 {
-  if(!pAppData || m_exit)
+  if(m_exit)
     return OMX_ErrorNone;
 
-  COMXCoreComponent *ctx = static_cast<COMXCoreComponent*>(pAppData);
-
-  pthread_mutex_lock(&ctx->m_omx_input_mutex);
-  ctx->m_omx_input_avaliable.push(pBuffer);
+  #if defined(OMX_DEBUG_EVENTHANDLER)
+  CLog::Log(LOGDEBUG, "COMXCoreComponent::DecoderEmptyBufferDone component(%s) %p %d/%d\n", m_componentName.c_str(), pBuffer, m_omx_input_avaliable.size(), m_input_buffer_count);
+  #endif
+  pthread_mutex_lock(&m_omx_input_mutex);
+  m_omx_input_avaliable.push(pBuffer);
 
   // this allows (all) blocked tasks to be awoken
-  pthread_cond_broadcast(&ctx->m_input_buffer_cond);
+  pthread_cond_broadcast(&m_input_buffer_cond);
 
-  pthread_mutex_unlock(&ctx->m_omx_input_mutex);
+  pthread_mutex_unlock(&m_omx_input_mutex);
 
   return OMX_ErrorNone;
 }
 
-OMX_ERRORTYPE COMXCoreComponent::DecoderFillBufferDone(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer)
+OMX_ERRORTYPE COMXCoreComponent::DecoderFillBufferDone(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE* pBuffer)
 {
-  if(!pAppData || m_exit)
+  if(m_exit)
     return OMX_ErrorNone;
 
-  COMXCoreComponent *ctx = static_cast<COMXCoreComponent*>(pAppData);
-
-  pthread_mutex_lock(&ctx->m_omx_output_mutex);
-  ctx->m_omx_output_available.push(pBuffer);
+  #if defined(OMX_DEBUG_EVENTHANDLER)
+  CLog::Log(LOGDEBUG, "COMXCoreComponent::DecoderFillBufferDone component(%s) %p %d/%d\n", m_componentName.c_str(), pBuffer, m_omx_output_available.size(), m_output_buffer_count);
+  #endif
+  pthread_mutex_lock(&m_omx_output_mutex);
+  m_omx_output_available.push(pBuffer);
 
   // this allows (all) blocked tasks to be awoken
-  pthread_cond_broadcast(&ctx->m_output_buffer_cond);
+  pthread_cond_broadcast(&m_output_buffer_cond);
 
-  pthread_mutex_unlock(&ctx->m_omx_output_mutex);
+  pthread_mutex_unlock(&m_omx_output_mutex);
 
   return OMX_ErrorNone;
 }
@@ -1568,18 +1668,15 @@ OMX_ERRORTYPE COMXCoreComponent::DecoderFillBufferDone(OMX_HANDLETYPE hComponent
 // Component event handler -- OMX event callback
 OMX_ERRORTYPE COMXCoreComponent::DecoderEventHandler(
   OMX_HANDLETYPE hComponent,
-  OMX_PTR pAppData,
   OMX_EVENTTYPE eEvent,
   OMX_U32 nData1,
   OMX_U32 nData2,
   OMX_PTR pEventData)
 {
-  COMXCoreComponent *ctx = static_cast<COMXCoreComponent*>(pAppData);
-
 #ifdef OMX_DEBUG_EVENTS
   CLog::Log(LOGDEBUG,
-    "COMXCore::%s - %s eEvent(0x%x), nData1(0x%lx), nData2(0x%lx), pEventData(0x%p)\n",
-    __func__, (char *)ctx->GetName().c_str(), eEvent, nData1, nData2, pEventData);
+    "COMXCoreComponent::%s - %s eEvent(0x%x), nData1(0x%x), nData2(0x%x), pEventData(0x%p)\n",
+    __func__, GetName().c_str(), eEvent, nData1, nData2, pEventData);
 #endif
 
   AddEvent(eEvent, nData1, nData2);
@@ -1595,91 +1692,91 @@ OMX_ERRORTYPE COMXCoreComponent::DecoderEventHandler(
           {
             case OMX_StateInvalid:
             #if defined(OMX_DEBUG_EVENTHANDLER)
-              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateInvalid\n", CLASSNAME, __func__, ctx->GetName().c_str());
+              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateInvalid\n", CLASSNAME, __func__, GetName().c_str());
             #endif
             break;
             case OMX_StateLoaded:
             #if defined(OMX_DEBUG_EVENTHANDLER)
-              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateLoaded\n", CLASSNAME, __func__, ctx->GetName().c_str());
+              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateLoaded\n", CLASSNAME, __func__, GetName().c_str());
             #endif
             break;
             case OMX_StateIdle:
             #if defined(OMX_DEBUG_EVENTHANDLER)
-              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateIdle\n", CLASSNAME, __func__, ctx->GetName().c_str());
+              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateIdle\n", CLASSNAME, __func__, GetName().c_str());
             #endif
             break;
             case OMX_StateExecuting:
             #if defined(OMX_DEBUG_EVENTHANDLER)
-              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateExecuting\n", CLASSNAME, __func__, ctx->GetName().c_str());
+              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateExecuting\n", CLASSNAME, __func__, GetName().c_str());
             #endif
             break;
             case OMX_StatePause:
             #if defined(OMX_DEBUG_EVENTHANDLER)
-              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StatePause\n", CLASSNAME, __func__, ctx->GetName().c_str());
+              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StatePause\n", CLASSNAME, __func__, GetName().c_str());
             #endif
             break;
             case OMX_StateWaitForResources:
             #if defined(OMX_DEBUG_EVENTHANDLER)
-              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateWaitForResources\n", CLASSNAME, __func__, ctx->GetName().c_str());
+              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateWaitForResources\n", CLASSNAME, __func__, GetName().c_str());
             #endif
             break;
             default:
             #if defined(OMX_DEBUG_EVENTHANDLER)
               CLog::Log(LOGDEBUG,
-                "%s::%s %s - Unknown OMX_Statexxxxx, state(%d)\n", CLASSNAME, __func__, ctx->GetName().c_str(), (int)nData2);
+                "%s::%s %s - Unknown OMX_Statexxxxx, state(%d)\n", CLASSNAME, __func__, GetName().c_str(), (int)nData2);
             #endif
             break;
           }
         break;
         case OMX_CommandFlush:
           #if defined(OMX_DEBUG_EVENTHANDLER)
-          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandFlush, port %d\n", CLASSNAME, __func__, ctx->GetName().c_str(), (int)nData2);
+          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandFlush, port %d\n", CLASSNAME, __func__, GetName().c_str(), (int)nData2);
           #endif
         break;
         case OMX_CommandPortDisable:
           #if defined(OMX_DEBUG_EVENTHANDLER)
-          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandPortDisable, nData1(0x%lx), port %d\n", CLASSNAME, __func__, ctx->GetName().c_str(), nData1, (int)nData2);
+          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandPortDisable, nData1(0x%x), port %d\n", CLASSNAME, __func__, GetName().c_str(), nData1, (int)nData2);
           #endif
         break;
         case OMX_CommandPortEnable:
           #if defined(OMX_DEBUG_EVENTHANDLER)
-          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandPortEnable, nData1(0x%lx), port %d\n", CLASSNAME, __func__, ctx->GetName().c_str(), nData1, (int)nData2);
+          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandPortEnable, nData1(0x%x), port %d\n", CLASSNAME, __func__, GetName().c_str(), nData1, (int)nData2);
           #endif
         break;
         #if defined(OMX_DEBUG_EVENTHANDLER)
         case OMX_CommandMarkBuffer:
-          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandMarkBuffer, nData1(0x%lx), port %d\n", CLASSNAME, __func__, ctx->GetName().c_str(), nData1, (int)nData2);
+          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandMarkBuffer, nData1(0x%x), port %d\n", CLASSNAME, __func__, GetName().c_str(), nData1, (int)nData2);
         break;
         #endif
       }
     break;
     case OMX_EventBufferFlag:
       #if defined(OMX_DEBUG_EVENTHANDLER)
-      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventBufferFlag(input)\n", CLASSNAME, __func__, ctx->GetName().c_str());
+      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventBufferFlag(input)\n", CLASSNAME, __func__, GetName().c_str());
       #endif
       if(nData2 & OMX_BUFFERFLAG_EOS)
       {
-        pthread_mutex_lock(&ctx->m_omx_eos_mutex);
-        ctx->m_eos = true;
-        pthread_mutex_unlock(&ctx->m_omx_eos_mutex);
+        pthread_mutex_lock(&m_omx_eos_mutex);
+        m_eos = true;
+        pthread_mutex_unlock(&m_omx_eos_mutex);
       }
     break;
     case OMX_EventPortSettingsChanged:
       #if defined(OMX_DEBUG_EVENTHANDLER)
-      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventPortSettingsChanged(output)\n", CLASSNAME, __func__, ctx->GetName().c_str());
+      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventPortSettingsChanged(output)\n", CLASSNAME, __func__, GetName().c_str());
       #endif
     break;
     case OMX_EventParamOrConfigChanged:
       #if defined(OMX_DEBUG_EVENTHANDLER)
-      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventParamOrConfigChanged(output)\n", CLASSNAME, __func__, ctx->GetName().c_str());
+      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventParamOrConfigChanged(output)\n", CLASSNAME, __func__, GetName().c_str());
       #endif
     break;
     #if defined(OMX_DEBUG_EVENTHANDLER)
     case OMX_EventMark:
-      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventMark\n", CLASSNAME, __func__, ctx->GetName().c_str());
+      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventMark\n", CLASSNAME, __func__, GetName().c_str());
     break;
     case OMX_EventResourcesAcquired:
-      CLog::Log(LOGDEBUG, "%s::%s %s- OMX_EventResourcesAcquired\n", CLASSNAME, __func__, ctx->GetName().c_str());
+      CLog::Log(LOGDEBUG, "%s::%s %s- OMX_EventResourcesAcquired\n", CLASSNAME, __func__, GetName().c_str());
     break;
     #endif
     case OMX_EventError:
@@ -1687,34 +1784,42 @@ OMX_ERRORTYPE COMXCoreComponent::DecoderEventHandler(
       {
         case OMX_ErrorSameState:
           //#if defined(OMX_DEBUG_EVENTHANDLER)
-          //CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorSameState, same state\n", CLASSNAME, __func__, ctx->GetName().c_str());
+          //CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorSameState, same state\n", CLASSNAME, __func__, GetName().c_str());
           //#endif
         break;
         case OMX_ErrorInsufficientResources:
-          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorInsufficientResources, insufficient resources\n", CLASSNAME, __func__, ctx->GetName().c_str());
-          ctx->m_resource_error = true;
+          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorInsufficientResources, insufficient resources\n", CLASSNAME, __func__, GetName().c_str());
+          m_resource_error = true;
         break;
         case OMX_ErrorFormatNotDetected:
-          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorFormatNotDetected, cannot parse input stream\n", CLASSNAME, __func__, ctx->GetName().c_str());
+          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorFormatNotDetected, cannot parse input stream\n", CLASSNAME, __func__, GetName().c_str());
         break;
         case OMX_ErrorPortUnpopulated:
           // this one is expected for tunneled ports. We always get it from mixer on teardown
-          if(ctx->GetName() != "OMX.broadcom.audio_mixer")
-            CLog::Log(LOGWARNING, "%s::%s %s - OMX_ErrorPortUnpopulated port %d\n", CLASSNAME, __func__, ctx->GetName().c_str(), (int)nData2);
+          if(GetName() != "OMX.broadcom.audio_mixer")
+            CLog::Log(LOGWARNING, "%s::%s %s - OMX_ErrorPortUnpopulated port %d\n", CLASSNAME, __func__, GetName().c_str(), (int)nData2);
         break;
         case OMX_ErrorStreamCorrupt:
-          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorStreamCorrupt, Bitstream corrupt\n", CLASSNAME, __func__, ctx->GetName().c_str());
+          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorStreamCorrupt, Bitstream corrupt\n", CLASSNAME, __func__, GetName().c_str());
+          m_resource_error = true;
         break;
         case OMX_ErrorUnsupportedSetting:
-          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorUnsupportedSetting, unsupported setting\n", CLASSNAME, __func__, ctx->GetName().c_str());
+          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorUnsupportedSetting, unsupported setting\n", CLASSNAME, __func__, GetName().c_str());
         break;
         default:
-          CLog::Log(LOGERROR, "%s::%s %s - OMX_EventError detected, nData1(0x%x), port %d\n",  CLASSNAME, __func__, ctx->GetName().c_str(), nData1, (int)nData2);
+          CLog::Log(LOGERROR, "%s::%s %s - OMX_EventError detected, nData1(0x%x), port %d\n",  CLASSNAME, __func__, GetName().c_str(), nData1, (int)nData2);
         break;
       }
+      // wake things up
+      if (m_resource_error)
+      {
+        pthread_cond_broadcast(&m_output_buffer_cond);
+        pthread_cond_broadcast(&m_input_buffer_cond);
+        pthread_cond_broadcast(&m_omx_event_cond);
+      }
     break;
     default:
-      CLog::Log(LOGWARNING, "%s::%s %s - Unknown eEvent(0x%x), nData1(0x%x), port %d\n", CLASSNAME, __func__, ctx->GetName().c_str(), eEvent, nData1, (int)nData2);
+      CLog::Log(LOGWARNING, "%s::%s %s - Unknown eEvent(0x%x), nData1(0x%x), port %d\n", CLASSNAME, __func__, GetName().c_str(), eEvent, nData1, (int)nData2);
     break;
   }
 
index d6028cd..a580887 100644 (file)
@@ -58,7 +58,6 @@ typedef struct omx_event {
   OMX_U32 nData2;
 } omx_event;
 
-class DllLibOMXCore;
 class COMXCore;
 class COMXCoreComponent;
 class COMXCoreTunel;
@@ -83,7 +82,6 @@ private:
   unsigned int      m_src_port;
   unsigned int      m_dst_port;
   DllOMX            *m_DllOMX;
-  bool              m_DllOMXOpen;
   void              Lock();
   void              UnLock();
   bool              m_tunnel_set;
@@ -129,12 +127,12 @@ public:
     OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBufferHeader);
 
   // OMXCore decoder callback routines.
-  OMX_ERRORTYPE DecoderEventHandler(OMX_HANDLETYPE hComponent, OMX_PTR pAppData,
+  OMX_ERRORTYPE DecoderEventHandler(OMX_HANDLETYPE hComponent,
     OMX_EVENTTYPE eEvent, OMX_U32 nData1, OMX_U32 nData2, OMX_PTR pEventData);
   OMX_ERRORTYPE DecoderEmptyBufferDone(
-    OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer);
+    OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE* pBuffer);
   OMX_ERRORTYPE DecoderFillBufferDone(
-    OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer);
+    OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE* pBuffer);
 
   void TransitionToStateLoaded();
 
@@ -153,7 +151,7 @@ public:
   void FlushOutput();
 
   OMX_BUFFERHEADERTYPE *GetInputBuffer(long timeout=200);
-  OMX_BUFFERHEADERTYPE *GetOutputBuffer();
+  OMX_BUFFERHEADERTYPE *GetOutputBuffer(long timeout=200);
 
   OMX_ERRORTYPE AllocInputBuffers(bool use_buffers = false);
   OMX_ERRORTYPE AllocOutputBuffers(bool use_buffers = false);
@@ -161,6 +159,9 @@ public:
   OMX_ERRORTYPE FreeInputBuffers();
   OMX_ERRORTYPE FreeOutputBuffers();
 
+  OMX_ERRORTYPE WaitForInputDone(long timeout=200);
+  OMX_ERRORTYPE WaitForOutputDone(long timeout=200);
+
   bool IsEOS() { return m_eos; };
   bool BadState() { return m_resource_error; };
   void ResetEos();
@@ -197,7 +198,6 @@ private:
 
   bool          m_exit;
   DllOMX        *m_DllOMX;
-  bool          m_DllOMXOpen;
   pthread_cond_t    m_input_buffer_cond;
   pthread_cond_t    m_output_buffer_cond;
   pthread_cond_t    m_omx_event_cond;
@@ -218,10 +218,10 @@ public:
   // initialize OMXCore and get decoder component
   bool Initialize();
   void Deinitialize();
+  DllOMX *GetDll() { return m_DllOMX; }
 
 protected:
   bool              m_is_open;
-  bool              m_Initialized;
   DllOMX            *m_DllOMX;
 };
 
index 58b6f05..666fac6 100644 (file)
@@ -52,6 +52,7 @@ public:
   void GetDisplaySize(int &width, int &height);
   // stride can be null for packed output
   unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true);
+  DllOMX *GetDllOMX() { return m_OMX ? m_OMX->GetDll() : NULL; }
 
 private:
   DllBcmHost *m_DllBcmHost;
@@ -60,6 +61,7 @@ private:
   int        m_arm_mem;
   int        m_gpu_mem;
   COMXCore   *m_OMX;
+  class DllLibOMXCore;
 };
 
 extern CRBP g_RBP;
index 411e690..f90ae76 100644 (file)
  *  <http://www.gnu.org/licenses/>.
  *
  */
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined(HAVE_GNUTLS)
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -278,9 +283,6 @@ getline (char **lineptr, size_t *n, FILE *stream)
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
 
 #include <string.h>
 #include <ctype.h>
@@ -386,3 +388,4 @@ strverscmp (const char *s1, const char *s2)
       return state;
     }
 }
+#endif