Skip to content

Instantly share code, notes, and snippets.

@danielvijge
Created August 3, 2012 11:26
Show Gist options
  • Save danielvijge/3246790 to your computer and use it in GitHub Desktop.
Save danielvijge/3246790 to your computer and use it in GitHub Desktop.
XBMC for CuBox (Native VMeta version) - based on https://github.com/huceke/xbmc/commits/marvell-dove
diff --git a/configure.in b/configure.in
index bca9239..abe2b49 100755
--- a/configure.in
+++ b/configure.in
@@ -151,6 +151,12 @@ AC_ARG_WITH([arch],
[use_arch=$withval],
[use_arch=no])
+AC_ARG_WITH([platform],
+ [AS_HELP_STRING([--with-platform],
+ [use a pre-configured config for common arm boards])],
+ [use_platform=$withval],
+ [use_platform=none])
+
AC_ARG_WITH([cpu],
[AS_HELP_STRING([--with-cpu],
[build with given cpu passing to ffmpeg (default is no)])],
@@ -517,6 +523,33 @@ case $host in
esac
AC_SUBST([ARCH])
+case $use_platform in
+ marvell-dove)
+ target_platform=target_marvell_dove
+ use_neon=no
+ use_texturepacker=yes
+ use_texturepacker_native=yes
+ use_arch="arm"
+ use_cpu=cortex-a8
+ use_armv5te="no"
+ use_armv6t2="no"
+ use_armv6="yes"
+ use_armvfp="yes"
+ use_hardcoded_tables="yes"
+ use_alsa="yes"
+ USE_TEXTUREPACKER_NATIVE_ROOT="$TEXTUREPACKER_NATIVE_ROOT"
+ ARCH="arm"
+ AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_MARVELL_DOVE")
+ AC_DEFINE(HAS_MARVELL_DOVE, [1], [Define if supporting Marvell Armada 510 (Dove)])
+ CFLAGS="$CFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a8 -mfpu=vfpv3-d16 -mthumb -marm -O3 -ftree-vectorize"
+ CXXFLAGS="$CXXFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a8 -mfpu=vfpv3-d16 -mthumb -marm -O3 -ftree-vectorize"
+ FFMPEG_EXTRACFLAGS="$FFMPEG_EXTRACFLAGS -mtune=cortex-a8 -mfpu=vfpv3-d16 -O3 -ftree-vectorize -mthumb -marm"
+ USE_MARVELL_DOVE=1
+ ;;
+ *)
+ use_alsa="yes"
+esac
+
# platform debug flags
if test "$use_debug" = "yes"; then
final_message="$final_message\n Debugging:\tYes"
@@ -571,6 +604,11 @@ if test "$host_vendor" = "apple" ; then
LIBS="$LIBS -framework DiskArbitration"
LIBS="$LIBS -framework ApplicationServices"
fi
+elif test "$target_platform" = "target_marvell_dove"; then
+ CFLAGS="$CFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
+ CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
+ ARCH="arm"
+ use_arch="arm"
elif test "$use_arch" = "arm"; then
CFLAGS="$CFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
@@ -1949,6 +1987,7 @@ AC_SUBST(USE_LIBAFPCLIENT)
AC_SUBST(USE_AIRPLAY)
AC_SUBST(USE_VDA)
AC_SUBST(USE_OPENMAX)
+AC_SUBST(USE_MARVELL_DOVE)
AC_SUBST(USE_PULSE)
AC_SUBST(USE_XRANDR)
AC_SUBST(USE_ALSA)
@@ -2055,6 +2094,8 @@ XB_CONFIG_MODULE([lib/ffmpeg], [
sed -ie "s/^HAVE_GNU_AS=yes/!HAVE_GNU_AS=yes/" config.mak
fi
else
+ #CFLAGS="$CFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a8 -mfpu=vfpv3-d16 -mthumb-interwork"
+ #CXXFLAGS="$CXXFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a8 -mfpu=vfpv3-d16 -mthumb-interwork"
CFLAGS="" \
LDFLAGS="$(echo "$LDFLAGS" | sed "s/-Wl,-Bsymbolic-functions//g")" \
./configure \
@@ -2065,6 +2106,10 @@ XB_CONFIG_MODULE([lib/ffmpeg], [
`if test "$use_arch" != "no"; then echo --arch=$use_arch; fi`\
`if test "$use_cpu" != "no"; then echo --cpu=$use_cpu; fi`\
`if test "$use_neon" = "yes"; then echo --enable-neon; else echo --disable-neon; fi`\
+ `if test "$use_armv5te" = "yes"; then echo --enable-armv5te; else echo --disable-armv5te; fi`\
+ `if test "$use_armv6t2" = "yes"; then echo --enable-armv6t2; else echo --disable-armv6t2; fi`\
+ `if test "$use_armv6" = "yes"; then echo --enable-armv6; else echo --disable-armv6; fi`\
+ `if test "$use_armvfp" = "yes"; then echo --enable-armvfp; else echo --disable-armvfp; fi`\
--target-os=$(tolower $(uname -s)) \
--disable-muxers \
--enable-muxer=spdif \
@@ -2088,6 +2133,7 @@ XB_CONFIG_MODULE([lib/ffmpeg], [
--enable-protocol=http \
--enable-pthreads \
--enable-runtime-cpudetect \
+ `if test "$use_hardcoded_tables" = "yes"; then echo --enable-hardcoded-tables; else echo --disable-hardcoded-tables; fi`\
--custom-libname-with-major="\$(FULLNAME)-\$(LIBMAJOR)-${ARCH}\$(SLIBSUF)" \
`case $host_cpu in i?86*) echo --disable-pic ;; *) echo --enable-pic ;; esac` \
--cc="$CC" &&
diff --git a/tools/marvell-dove/Makefile.include b/tools/marvell-dove/Makefile.include
new file mode 100644
index 0000000..f162833
--- /dev/null
+++ b/tools/marvell-dove/Makefile.include
@@ -0,0 +1,13 @@
+SDKSTAGE=/opt/xbmc-cubox/buildroot/output/staging
+XBMCPREFIX=/opt/xbmc-cubox/xbmc-bin
+TARGETFS=/opt/xbmc-cubox/buildroot/output/target
+TOOLCHAIN=/opt/xbmc-cubox/buildroot/output/host/usr/
+BUILDROOT=/opt/xbmc-cubox/buildroot
+USE_BUILDROOT=1
+BASE_URL=http://mirrors.xbmc.org/build-deps/darwin-libs
+TARBALLS_LOCATION=/opt/xbmc-tarballs
+RETRIEVE_TOOL=/usr/bin/curl
+RETRIEVE_TOOL_FLAGS=-Ls --create-dirs --output $(TARBALLS_LOCATION)/$(ARCHIVE)
+ARCHIVE_TOOL=/bin/tar
+ARCHIVE_TOOL_FLAGS=xf
+JOBS=7
diff --git a/tools/marvell-dove/depends/Makefile b/tools/marvell-dove/depends/Makefile
new file mode 100644
index 0000000..591fddb
--- /dev/null
+++ b/tools/marvell-dove/depends/Makefile
@@ -0,0 +1,37 @@
+include ../Makefile.include
+
+ifeq ($(USE_BUILDROOT),1)
+ BUILDTOOLS =
+ SUBDIRS = libjpeg-turbo tiff jasper fribidi libass libmodplug libcdio librtmp libbluray libnfs yajl boost xbmc
+else
+ BUILDTOOLS = help2man autoconf automake libtool pkg-config yasm cmake patchelf
+ SUBDIRS = liblzo2 tiff libnfs jasper xbmc
+endif
+
+IMAGENAME = xbmc-rbp-`date +'%y%m%d'`
+
+.PHONY: buildtools subdirs
+
+all: buildtools subdirs
+
+buildtools:
+ for d in $(BUILDTOOLS); do $(MAKE) -C $$d; done
+
+subdirs:
+ for d in $(SUBDIRS); do $(MAKE) -C $$d; done
+
+clean:
+ for d in $(BUILDTOOLS); do $(MAKE) -C $$d clean; done
+ for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done
+
+distclean::
+ for d in $(BUILDTOOLS); do $(MAKE) -C $$d distclean; done
+ for d in $(SUBDIRS); do $(MAKE) -C $$d distclean; done
+ rm -rf $(XBMCPREFIX)
+
+image:
+ make -C $(BUILDROOT) tarroot IMAGE=$(CURDIR)/$(IMAGENAME) TAR_COMPRESSOR=
+ echo "S111xbmc S110rc.local" | cat $(TARGETFS)/etc/init.d/rc.deps - > $(CURDIR)/packaging/etc/init.d/rc.deps
+ cd packaging; tar -uf $(CURDIR)/$(IMAGENAME).tar *
+ tar -uf $(CURDIR)/$(IMAGENAME).tar $(XBMCPREFIX)
+ gzip $(IMAGENAME).tar
diff --git a/tools/marvell-dove/depends/autoconf/.gitignore b/tools/marvell-dove/depends/autoconf/.gitignore
new file mode 100644
index 0000000..e832e48
--- /dev/null
+++ b/tools/marvell-dove/depends/autoconf/.gitignore
@@ -0,0 +1 @@
+autoconf-2.63
diff --git a/tools/marvell-dove/depends/autoconf/Makefile b/tools/marvell-dove/depends/autoconf/Makefile
new file mode 100644
index 0000000..2a5ca9e
--- /dev/null
+++ b/tools/marvell-dove/depends/autoconf/Makefile
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+
+# lib name, version
+LIBNAME=autoconf
+VERSION=2.63
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+export PREFIX=$(XBMCPREFIX)
+export PATH:=$(PREFIX)/bin:$(PATH)
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(SOURCE)/bin/autoconf
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ -rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
diff --git a/tools/marvell-dove/depends/automake/.gitignore b/tools/marvell-dove/depends/automake/.gitignore
new file mode 100644
index 0000000..409d7e1
--- /dev/null
+++ b/tools/marvell-dove/depends/automake/.gitignore
@@ -0,0 +1 @@
+automake-1.10.3
diff --git a/tools/marvell-dove/depends/automake/Makefile b/tools/marvell-dove/depends/automake/Makefile
new file mode 100644
index 0000000..38c5d64
--- /dev/null
+++ b/tools/marvell-dove/depends/automake/Makefile
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+
+# lib name, version
+LIBNAME=automake
+VERSION=1.10.3
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+export PREFIX=$(XBMCPREFIX)
+export PATH:=$(PREFIX)/bin:$(PATH)
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(SOURCE)/bin/automake
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ -rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
diff --git a/tools/marvell-dove/depends/boost/.gitignore b/tools/marvell-dove/depends/boost/.gitignore
new file mode 100644
index 0000000..d89e0c7
--- /dev/null
+++ b/tools/marvell-dove/depends/boost/.gitignore
@@ -0,0 +1 @@
+boost_1_44_0
diff --git a/tools/marvell-dove/depends/boost/.installed b/tools/marvell-dove/depends/boost/.installed
new file mode 100644
index 0000000..e69de29
diff --git a/tools/marvell-dove/depends/boost/Makefile b/tools/marvell-dove/depends/boost/Makefile
new file mode 100644
index 0000000..9c19293
--- /dev/null
+++ b/tools/marvell-dove/depends/boost/Makefile
@@ -0,0 +1,32 @@
+include ../../Makefile.include
+include ../depends.mk
+
+LIBNAME=boost
+VERSION=1_44_0
+SOURCE=$(LIBNAME)_$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+export PATH:=$(TOOLCHAIN)/bin:$(PATH)
+
+all: .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+.installed: $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cat user-config.jam-arm.in > $(SOURCE)/tools/build/v2/user-config.jam
+ sed -e 's:arm-unknown-linux-gnueabi:$(HOST):g' -i $(SOURCE)/tools/build/v2/user-config.jam
+ cd $(SOURCE); ./bootstrap.sh --prefix=$(PREFIX) --with-libraries=thread
+ cd $(SOURCE); ./bjam --prefix=$(PREFIX) toolset=gcc --toolset-root=$(TOOLCHAIN) --architecture=arm install
+ touch .installed
+
+clean:
+ rm -rf $(SOURCE) .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
+
diff --git a/tools/marvell-dove/depends/boost/user-config.jam-arm.in b/tools/marvell-dove/depends/boost/user-config.jam-arm.in
new file mode 100644
index 0000000..7af27c8
--- /dev/null
+++ b/tools/marvell-dove/depends/boost/user-config.jam-arm.in
@@ -0,0 +1,4 @@
+using gcc : : arm-unknown-linux-gnueabi-g++ :
+ <cflags>"-fvisibility-inlines-hidden -DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS"
+ <cxxflags>"-fvisibility-inlines-hidden -DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS"
+;
diff --git a/tools/marvell-dove/depends/cmake/.gitignore b/tools/marvell-dove/depends/cmake/.gitignore
new file mode 100644
index 0000000..5acc817
--- /dev/null
+++ b/tools/marvell-dove/depends/cmake/.gitignore
@@ -0,0 +1 @@
+cmake-2.8.4
diff --git a/tools/marvell-dove/depends/cmake/Makefile b/tools/marvell-dove/depends/cmake/Makefile
new file mode 100644
index 0000000..a081187
--- /dev/null
+++ b/tools/marvell-dove/depends/cmake/Makefile
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+
+APPNAME=cmake
+VERSION=2.8.4
+SOURCE=$(APPNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+PREFIX:=$(XBMCPREFIX)
+export PATH:=$(PREFIX)/bin:$(PATH)
+CONFIGURE=./bootstrap --prefix=$(PREFIX)
+
+APP=$(SOURCE)/$(APPNAME)
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(APP) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ -rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(APP): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
diff --git a/tools/marvell-dove/depends/depends.mk b/tools/marvell-dove/depends/depends.mk
new file mode 100755
index 0000000..75dfe6a
--- /dev/null
+++ b/tools/marvell-dove/depends/depends.mk
@@ -0,0 +1,54 @@
+export CFLAGS=-pipe -mabi=aapcs-linux -Wno-psabi -Wa,-mno-warn-deprecated
+ifeq ($(USE_BUILDROOT),1)
+ export HOST=arm-unknown-linux-gnueabi
+ export BUILD=i686-linux
+ export PREFIX=$(XBMCPREFIX)
+ export SYSROOT=$(BUILDROOT)/output/host/usr/arm-unknown-linux-gnueabi/sysroot
+ export CFLAGS+=-I$(XBMCPREFIX)/include -isystem$(SYSROOT)/usr/include -isystem$(SYSROOT)/usr/include -isystem$(PREFIX)/include -isystem$(PREFIX)/usr/include/mysql
+ export CXXFLAGS=$(CFLAGS)
+ export CPPFLAGS=$(CFLAGS)
+ export LDFLAGS=-L$(XBMCPREFIX)/lib
+ export LD=$(TOOLCHAIN)/bin/$(HOST)-ld --sysroot=$(SYSROOT)
+ export CC=$(TOOLCHAIN)/bin/$(HOST)-gcc --sysroot=$(SYSROOT)
+ export CXX=$(TOOLCHAIN)/bin/$(HOST)-g++ --sysroot=$(SYSROOT)
+ export OBJDUMP=$(TOOLCHAIN)/bin/$(HOST)-objdump
+ export RANLIB=$(TOOLCHAIN)/bin/$(HOST)-ranlib
+ export STRIP=$(TOOLCHAIN)/bin/$(HOST)-strip
+ export AR=$(TOOLCHAIN)/bin/$(HOST)-ar
+ export CXXCPP=$(CXX) -E
+ export PKG_CONFIG_PATH=$(PREFIX)/lib/pkgconfig
+ export PYTHON_VERSION=2.7
+ export PATH:=$(PREFIX)/bin:$(BUILDROOT)/output/host/usr/bin:$(PATH)
+ export TEXTUREPACKER_NATIVE_ROOT=/usr
+ export PYTHON_LDFLAGS=-L$(SDKSTAGE)/usr/lib -lpython$(PYTHON_VERSION) -lpthread -ldl -lutil -lm
+else
+ export HOST=arm-bcm2708-linux-gnueabi
+ export BUILD=i686-linux
+ export PREFIX=${XBMCPREFIX}
+ export TARGETFS
+ export SYSROOT=/usr/local/bcm-gcc/arm-bcm2708-linux-gnueabi/sys-root
+ export RLINK_PATH=-Wl,-rpath-link,${SYSROOT}/lib -Wl,-rpath-link,${TARGETFS}/lib -Wl,-rpath-link,${TARGETFS}/usr/lib/
+ export CFLAGS+=-isystem${XBMCPREFIX}/include -isystem${SDKSTAGE}/usr/include
+ export CFLAGS+=-L${XBMCPREFIX}/lib -L${SYSROOT}/lib -L${TARGETFS}/lib -L${TARGETFS}/usr/lib ${RLINK_PATH}
+ export CXXFLAGS=${CFLAGS}
+ export CPPFLAGS=${CFLAGS}
+ export LDFLAGS=${RLINK_PATH} -L${TARGETFS}/lib -L${TARGETFS}/usr/lib -L${XBMCPREFIX}/lib
+ export LD=${TOOLCHAIN}/bin/${HOST}-ld
+ export AR=${TOOLCHAIN}/bin/${HOST}-ar
+ export CC=${TOOLCHAIN}/bin/${HOST}-gcc
+ export CXX=${TOOLCHAIN}/bin/${HOST}-g++
+ export CXXCPP=${CXX} -E
+ export RANLIB=${TOOLCHAIN}/bin/${HOST}-ranlib
+ export STRIP=${TOOLCHAIN}/bin/${HOST}-strip
+ export OBJDUMP=${TOOLCHAIN}/bin/${HOST}-objdump
+ #export ACLOCAL=aclocal -I ${SDKSTAGE}/usr/share/aclocal -I ${TARGETFS}/usr/share/aclocal-1.11
+ export PKG_CONFIG_LIBDIR=${PREFIX}/lib/pkgconfig:${SDKSTAGE}/lib/pkgconfig:${SDKSTAGE}/usr/lib/pkgconfig
+ export PKG_CONFIG_PATH=$(PREFIX)/bin/pkg-config
+ export PYTHON_VERSION=2.6
+ export PATH:=${PREFIX}/bin:$(PATH):${TOOLCHAIN}/bin
+ export TEXTUREPACKER_NATIVE_ROOT=/usr
+ export PYTHON_LDFLAGS=-L$(SDKSTAGE)/usr/lib -lpython$(PYTHON_VERSION)
+endif
+export PYTHON_CPPFLAGS=-I$(SDKSTAGE)/usr/include/python$(PYTHON_VERSION)
+export PYTHON_SITE_PKG=$(SDKSTAGE)/usr/lib/python$(PYTHON_VERSION)/site-packages
+export PYTHON_NOVERSIONCHECK=no-check
diff --git a/tools/marvell-dove/depends/fribidi/.gitignore b/tools/marvell-dove/depends/fribidi/.gitignore
new file mode 100644
index 0000000..46f7c57
--- /dev/null
+++ b/tools/marvell-dove/depends/fribidi/.gitignore
@@ -0,0 +1 @@
+fribidi-0.19.1
diff --git a/tools/marvell-dove/depends/fribidi/.installed b/tools/marvell-dove/depends/fribidi/.installed
new file mode 100644
index 0000000..e69de29
diff --git a/tools/marvell-dove/depends/fribidi/Makefile b/tools/marvell-dove/depends/fribidi/Makefile
new file mode 100644
index 0000000..fbb82f0
--- /dev/null
+++ b/tools/marvell-dove/depends/fribidi/Makefile
@@ -0,0 +1,42 @@
+include ../../Makefile.include
+include ../depends.mk
+
+# lib name, version
+LIBNAME=fribidi
+VERSION=0.19.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST) \
+ --disable-docs
+
+LIBDYLIB=$(SOURCE)/.libs/lib$(LIBNAME).so
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
diff --git a/tools/marvell-dove/depends/help2man/.gitignore b/tools/marvell-dove/depends/help2man/.gitignore
new file mode 100644
index 0000000..eecdd7b
--- /dev/null
+++ b/tools/marvell-dove/depends/help2man/.gitignore
@@ -0,0 +1 @@
+help2man-1.38.2
diff --git a/tools/marvell-dove/depends/help2man/Makefile b/tools/marvell-dove/depends/help2man/Makefile
new file mode 100644
index 0000000..e8e53a5
--- /dev/null
+++ b/tools/marvell-dove/depends/help2man/Makefile
@@ -0,0 +1,40 @@
+include ../../Makefile.include
+
+# lib name, version
+LIBNAME=help2man
+VERSION=1.38.2
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+export PREFIX=$(XBMCPREFIX)
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+LIBDYLIB=$(SOURCE)/help2man
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ -rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
diff --git a/tools/marvell-dove/depends/jasper/.gitignore b/tools/marvell-dove/depends/jasper/.gitignore
new file mode 100644
index 0000000..7030c19
--- /dev/null
+++ b/tools/marvell-dove/depends/jasper/.gitignore
@@ -0,0 +1 @@
+jasper-1.900.1
diff --git a/tools/marvell-dove/depends/jasper/.installed b/tools/marvell-dove/depends/jasper/.installed
new file mode 100644
index 0000000..e69de29
diff --git a/tools/marvell-dove/depends/jasper/Makefile b/tools/marvell-dove/depends/jasper/Makefile
new file mode 100644
index 0000000..8898a56
--- /dev/null
+++ b/tools/marvell-dove/depends/jasper/Makefile
@@ -0,0 +1,43 @@
+include ../../Makefile.include
+include ../depends.mk
+
+# lib name, version
+LIBNAME=jasper
+VERSION=1.900.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).zip
+ARCHIVE_TOOL=unzip
+ARCHIVE_TOOL_FLAGS=
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST)
+
+LIBDYLIB=$(SOURCE)/$(LIBNAME)/.libs/$(LIBNAME).so
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
diff --git a/tools/marvell-dove/depends/libass/.gitignore b/tools/marvell-dove/depends/libass/.gitignore
new file mode 100644
index 0000000..2b21369
--- /dev/null
+++ b/tools/marvell-dove/depends/libass/.gitignore
@@ -0,0 +1 @@
+libass-0.9.11
diff --git a/tools/marvell-dove/depends/libass/.installed b/tools/marvell-dove/depends/libass/.installed
new file mode 100644
index 0000000..e69de29
diff --git a/tools/marvell-dove/depends/libass/Makefile b/tools/marvell-dove/depends/libass/Makefile
new file mode 100644
index 0000000..8827462
--- /dev/null
+++ b/tools/marvell-dove/depends/libass/Makefile
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+include ../depends.mk
+
+# lib name, version
+LIBNAME=libass
+VERSION=0.9.11
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST)
+
+LIBDYLIB=$(SOURCE)/$(LIBNAME)/.libs/$(LIBNAME).so
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
diff --git a/tools/marvell-dove/depends/libbluray/.gitignore b/tools/marvell-dove/depends/libbluray/.gitignore
new file mode 100644
index 0000000..c08d0a5
--- /dev/null
+++ b/tools/marvell-dove/depends/libbluray/.gitignore
@@ -0,0 +1 @@
+libblueray-20110213.20739ed
diff --git a/tools/marvell-dove/depends/libbluray/.installed b/tools/marvell-dove/depends/libbluray/.installed
new file mode 100644
index 0000000..e69de29
diff --git a/tools/marvell-dove/depends/libbluray/Makefile b/tools/marvell-dove/depends/libbluray/Makefile
new file mode 100644
index 0000000..e547956
--- /dev/null
+++ b/tools/marvell-dove/depends/libbluray/Makefile
@@ -0,0 +1,40 @@
+include ../../Makefile.include
+include ../depends.mk
+
+# lib name, version
+LIBNAME=libblueray
+VERSION=20110213.20739ed
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tgz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --exec-prefix=$(PREFIX) --host=$(HOST)
+
+LIBDYLIB=$(SOURCE)/.libs/$(LIBNAME).so
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ mkdir $(SOURCE)
+ cd $(SOURCE); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); ./bootstrap
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
diff --git a/tools/marvell-dove/depends/libcdio/.gitignore b/tools/marvell-dove/depends/libcdio/.gitignore
new file mode 100644
index 0000000..d79f4ef
--- /dev/null
+++ b/tools/marvell-dove/depends/libcdio/.gitignore
@@ -0,0 +1 @@
+libcdio-0.82
diff --git a/tools/marvell-dove/depends/libcdio/.installed b/tools/marvell-dove/depends/libcdio/.installed
new file mode 100644
index 0000000..e69de29
diff --git a/tools/marvell-dove/depends/libcdio/Makefile b/tools/marvell-dove/depends/libcdio/Makefile
new file mode 100644
index 0000000..24d24b8
--- /dev/null
+++ b/tools/marvell-dove/depends/libcdio/Makefile
@@ -0,0 +1,42 @@
+include ../../Makefile.include
+include ../depends.mk
+
+# lib name, version
+LIBNAME=libcdio
+VERSION=0.82
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST)
+
+LIBDYLIB=$(SOURCE)/.libs/(LIBNAME).so
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ cp $(SOURCE)/include/cdio/cdtext.h $(PREFIX)/include/cdio/
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
diff --git a/tools/marvell-dove/depends/libjpeg-turbo/.gitignore b/tools/marvell-dove/depends/libjpeg-turbo/.gitignore
new file mode 100644
index 0000000..3debbff
--- /dev/null
+++ b/tools/marvell-dove/depends/libjpeg-turbo/.gitignore
@@ -0,0 +1 @@
+libjpeg-turbo-1.1.1
diff --git a/tools/marvell-dove/depends/libjpeg-turbo/.installed b/tools/marvell-dove/depends/libjpeg-turbo/.installed
new file mode 100644
index 0000000..e69de29
diff --git a/tools/marvell-dove/depends/libjpeg-turbo/Makefile b/tools/marvell-dove/depends/libjpeg-turbo/Makefile
new file mode 100644
index 0000000..8e911b3
--- /dev/null
+++ b/tools/marvell-dove/depends/libjpeg-turbo/Makefile
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+include ../depends.mk
+
+# lib name, version
+LIBNAME=libjpeg-turbo
+VERSION=1.1.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST) \
+ --with-jpeg8
+
+LIBDYLIB=$(SOURCE)/.libs/lib$(LIBNAME).so
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
diff --git a/tools/marvell-dove/depends/liblzo2/.gitignore b/tools/marvell-dove/depends/liblzo2/.gitignore
new file mode 100644
index 0000000..ef00f81
--- /dev/null
+++ b/tools/marvell-dove/depends/liblzo2/.gitignore
@@ -0,0 +1 @@
+lzo-2.03
diff --git a/tools/marvell-dove/depends/liblzo2/Makefile b/tools/marvell-dove/depends/liblzo2/Makefile
new file mode 100644
index 0000000..7b62706
--- /dev/null
+++ b/tools/marvell-dove/depends/liblzo2/Makefile
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+include ../depends.mk
+
+# lib name, version
+LIBNAME=lzo
+VERSION=2.03
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST)
+
+LIBDYLIB=$(SOURCE)/src/.libs/lib$(LIBNAME)2.so
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
diff --git a/tools/marvell-dove/depends/libmodplug/.gitignore b/tools/marvell-dove/depends/libmodplug/.gitignore
new file mode 100644
index 0000000..fd1711b
--- /dev/null
+++ b/tools/marvell-dove/depends/libmodplug/.gitignore
@@ -0,0 +1 @@
+libmodplug-0.8.7
diff --git a/tools/marvell-dove/depends/libmodplug/.installed b/tools/marvell-dove/depends/libmodplug/.installed
new file mode 100644
index 0000000..e69de29
diff --git a/tools/marvell-dove/depends/libmodplug/Makefile b/tools/marvell-dove/depends/libmodplug/Makefile
new file mode 100644
index 0000000..5fb6649
--- /dev/null
+++ b/tools/marvell-dove/depends/libmodplug/Makefile
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+include ../depends.mk
+
+# lib name, version
+LIBNAME=libmodplug
+VERSION=0.8.7
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST)
+
+LIBDYLIB=$(SOURCE)/.libs/$(LIBNAME).so
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
diff --git a/tools/marvell-dove/depends/libnfs/.gitignore b/tools/marvell-dove/depends/libnfs/.gitignore
new file mode 100644
index 0000000..72f8fd7
--- /dev/null
+++ b/tools/marvell-dove/depends/libnfs/.gitignore
@@ -0,0 +1 @@
+libnfs-0804e67
diff --git a/tools/marvell-dove/depends/libnfs/.installed b/tools/marvell-dove/depends/libnfs/.installed
new file mode 100644
index 0000000..e69de29
diff --git a/tools/marvell-dove/depends/libnfs/001_fix_hanewin.patch b/tools/marvell-dove/depends/libnfs/001_fix_hanewin.patch
new file mode 100644
index 0000000..507fbe6
--- /dev/null
+++ b/tools/marvell-dove/depends/libnfs/001_fix_hanewin.patch
@@ -0,0 +1,12 @@
+--- lib/libnfs.c 2011-09-02 12:45:30.000000000 +0200
++++ lib/libnfs.c 2011-12-04 21:16:07.000000000 +0100
+@@ -666,6 +666,9 @@
+ if (res->GETATTR3res_u.resok.obj_attributes.type == NF3DIR) {
+ st.st_mode |= S_IFDIR ;
+ }
++ if (res->GETATTR3res_u.resok.obj_attributes.type == NF3REG) {
++ st.st_mode |= S_IFREG ;
++ }
+ st.st_nlink = res->GETATTR3res_u.resok.obj_attributes.nlink;
+ st.st_uid = res->GETATTR3res_u.resok.obj_attributes.uid;
+ st.st_gid = res->GETATTR3res_u.resok.obj_attributes.gid;
diff --git a/tools/marvell-dove/depends/libnfs/Makefile b/tools/marvell-dove/depends/libnfs/Makefile
new file mode 100644
index 0000000..852c44e
--- /dev/null
+++ b/tools/marvell-dove/depends/libnfs/Makefile
@@ -0,0 +1,42 @@
+include ../../Makefile.include
+include ../depends.mk
+
+# lib name, version
+LIBNAME=libnfs
+VERSION=0804e67
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure CFLAGS=-D_FILE_OFFSET_BITS=64 --prefix=$(PREFIX) --host=$(HOST)
+
+SO_NAME=$(SOURCE)/lib/libnfs.so
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(SO_NAME) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ -rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); patch -p0 < ../001_fix_hanewin.patch
+ cd $(SOURCE); ./bootstrap
+ cd $(SOURCE); $(CONFIGURE)
+
+$(SO_NAME): $(SOURCE)
+ make -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+ rm -rf $(SOURCE)
+
+distclean::
+ rm -rf $(SOURCE) .installed
diff --git a/tools/marvell-dove/depends/librtmp/.gitignore b/tools/marvell-dove/depends/librtmp/.gitignore
new file mode 100644
index 0000000..2ca1020
--- /dev/null
+++ b/tools/marvell-dove/depends/librtmp/.gitignore
@@ -0,0 +1 @@
+rtmpdump-2.4
diff --git a/tools/marvell-dove/depends/librtmp/.installed b/tools/marvell-dove/depends/librtmp/.installed
new file mode 100644
index 0000000..e69de29
diff --git a/tools/marvell-dove/depends/librtmp/Makefile b/tools/marvell-dove/depends/librtmp/Makefile
new file mode 100644
index 0000000..d866f36
--- /dev/null
+++ b/tools/marvell-dove/depends/librtmp/Makefile
@@ -0,0 +1,40 @@
+include ../../Makefile.include
+include ../depends.mk
+
+# lib name, version
+LIBNAME=rtmpdump
+VERSION=2.4
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+
+LIBDYLIB=$(SOURCE)/$(LIBNAME)/.libs/$(LIBNAME).so
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE)/librtmp; patch -p0 < ../../prefix.patch
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)/librtmp CROSS_COMPILE=$(TOOLCHAIN)/bin/$(HOST)- PREFIX=$(PREFIX) CC="$(CC)" LD="$(LD)"
+
+.installed:
+ make -C $(SOURCE)/librtmp install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
diff --git a/tools/marvell-dove/depends/librtmp/prefix.patch b/tools/marvell-dove/depends/librtmp/prefix.patch
new file mode 100644
index 0000000..6c12d06
--- /dev/null
+++ b/tools/marvell-dove/depends/librtmp/prefix.patch
@@ -0,0 +1,21 @@
+--- ../Makefile 2010-06-30 15:58:35.000000000 -0400
++++ ../Makefile.2 2011-03-31 16:19:52.813884882 -0400
+@@ -1,6 +1,6 @@
+ VERSION=v2.3
+
+-prefix=/usr/local
++prefix=$(PREFIX)
+
+ CC=$(CROSS_COMPILE)gcc
+ LD=$(CROSS_COMPILE)ld
+
+--- Makefile 2010-06-30 15:58:35.000000000 -0400
++++ Makefile.2 2011-03-31 16:19:52.813884882 -0400
+@@ -1,6 +1,6 @@
+ VERSION=v2.3
+
+-prefix=/usr/local
++prefix=$(PREFIX)
+
+ CC=$(CROSS_COMPILE)gcc
+ LD=$(CROSS_COMPILE)ld
diff --git a/tools/marvell-dove/depends/libtool/.gitignore b/tools/marvell-dove/depends/libtool/.gitignore
new file mode 100644
index 0000000..717e6ef
--- /dev/null
+++ b/tools/marvell-dove/depends/libtool/.gitignore
@@ -0,0 +1 @@
+libtool-2.2.6
diff --git a/tools/marvell-dove/depends/libtool/Makefile b/tools/marvell-dove/depends/libtool/Makefile
new file mode 100644
index 0000000..b6edefe
--- /dev/null
+++ b/tools/marvell-dove/depends/libtool/Makefile
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+
+# lib name, version
+LIBNAME=libtool
+VERSION=2.2.6
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE)a.tar.gz
+
+# configuration settings
+export PREFIX=$(XBMCPREFIX)
+export PATH:=$(PREFIX)/bin:$(PATH)
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(SOURCE)/bin/libtool
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ -rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
diff --git a/tools/marvell-dove/depends/patchelf/.gitignore b/tools/marvell-dove/depends/patchelf/.gitignore
new file mode 100644
index 0000000..28b53ff
--- /dev/null
+++ b/tools/marvell-dove/depends/patchelf/.gitignore
@@ -0,0 +1 @@
+patchelf-0.6pre25969
diff --git a/tools/marvell-dove/depends/patchelf/Makefile b/tools/marvell-dove/depends/patchelf/Makefile
new file mode 100644
index 0000000..7846462
--- /dev/null
+++ b/tools/marvell-dove/depends/patchelf/Makefile
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+
+# lib name, version
+LIBNAME=patchelf
+VERSION=0.6pre25969
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+export PREFIX=$(XBMCPREFIX)
+export PATH:=$(PREFIX)/bin:$(PATH)
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(SOURCE)/src/patchelf
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ -rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
diff --git a/tools/marvell-dove/depends/pkg-config/.gitignore b/tools/marvell-dove/depends/pkg-config/.gitignore
new file mode 100644
index 0000000..b6b0a86
--- /dev/null
+++ b/tools/marvell-dove/depends/pkg-config/.gitignore
@@ -0,0 +1 @@
+pkg-config-0.23
diff --git a/tools/marvell-dove/depends/pkg-config/Makefile b/tools/marvell-dove/depends/pkg-config/Makefile
new file mode 100644
index 0000000..716e6e3
--- /dev/null
+++ b/tools/marvell-dove/depends/pkg-config/Makefile
@@ -0,0 +1,42 @@
+include ../../Makefile.include
+
+# lib name, version
+# lib name, version
+LIBNAME=pkg-config
+VERSION=0.23
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+PREFIX:=$(XBMCPREFIX)
+export PATH:=$(PREFIX)/bin:$(PATH)
+CONFIGURE=./configure --prefix=$(PREFIX) --enable-indirect-deps --with-pc-path=$(PREFIX)/lib/pkgconfig:$(PREFIX)/share/pkgconfig
+
+LIBDYLIB=$(SOURCE)/bin/pkg-config
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ -rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
diff --git a/tools/marvell-dove/depends/tiff/.gitignore b/tools/marvell-dove/depends/tiff/.gitignore
new file mode 100644
index 0000000..48e2237
--- /dev/null
+++ b/tools/marvell-dove/depends/tiff/.gitignore
@@ -0,0 +1 @@
+tiff-3.8.2
diff --git a/tools/marvell-dove/depends/tiff/.installed b/tools/marvell-dove/depends/tiff/.installed
new file mode 100644
index 0000000..e69de29
diff --git a/tools/marvell-dove/depends/tiff/Makefile b/tools/marvell-dove/depends/tiff/Makefile
new file mode 100644
index 0000000..e6539c3
--- /dev/null
+++ b/tools/marvell-dove/depends/tiff/Makefile
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+include ../depends.mk
+
+# lib name, version
+LIBNAME=tiff
+VERSION=3.8.2
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST)
+
+LIBDYLIB=$(SOURCE)/libtiff/.libs/lib$(LIBNAME).so
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)
+
+.installed:
+ make -C $(SOURCE) install
+ touch $@
+
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
diff --git a/tools/marvell-dove/depends/xbmc/Makefile b/tools/marvell-dove/depends/xbmc/Makefile
new file mode 100755
index 0000000..f8e7362
--- /dev/null
+++ b/tools/marvell-dove/depends/xbmc/Makefile
@@ -0,0 +1,33 @@
+include ../../Makefile.include
+include ../depends.mk
+
+SOURCE=../../../../
+
+ifeq ($(USE_BUILDROOT),1)
+ export PATH:=$(PREFIX)/bin:$(BUILDROOT)/output/host/usr/bin:$(SYSROOT)/usr/bin:$(PATH)
+endif
+
+CONFIGURE=./configure --prefix=$(PREFIX) --build=$(BUILD) --host=$(HOST) \
+ --disable-vdpau --disable-vaapi --disable-crystalhd --disable-vdadecoder \
+ --disable-vtbdecoder --disable-vtbdecoder --disable-projectm \
+ --enable-gles --disable-pulse --disable-projectm --enable-dbus \
+ --disable-optimizations --enable-debug --with-platform=marvell-dove
+
+#CONFIGURE=./configure --prefix=$(PREFIX) --build=$(BUILD) --host=$(HOST) \
+# --enable-gles --enable-external-python --disable-sdl --disable-x11 --disable-xrandr \
+# --disable-optical-drive --disable-dvdcss --disable-joystick --disable-debug \
+# --disable-crystalhd --disable-vda --disable-vtbdecoder --disable-vaapi --disable-vdpau \
+# --enable-platform-raspberry-pi --disable-openmax --disable-pulse --disable-projectm \
+# --enable-dbus
+
+all: configure
+
+clean:
+distclean:
+ cd $(SOURCE);
+
+configure:
+ cd $(SOURCE); ./bootstrap
+ cd $(SOURCE); $(CONFIGURE)
+ #cd $(SOURCE); make -j $(JOBS)
+ #cd $(SOURCE); make install
diff --git a/tools/marvell-dove/depends/yajl/.gitignore b/tools/marvell-dove/depends/yajl/.gitignore
new file mode 100644
index 0000000..0a99d31
--- /dev/null
+++ b/tools/marvell-dove/depends/yajl/.gitignore
@@ -0,0 +1 @@
+lloyd-yajl-f4b2b1a
diff --git a/tools/marvell-dove/depends/yajl/.installed b/tools/marvell-dove/depends/yajl/.installed
new file mode 100644
index 0000000..e69de29
diff --git a/tools/marvell-dove/depends/yajl/Makefile b/tools/marvell-dove/depends/yajl/Makefile
new file mode 100644
index 0000000..22386ad
--- /dev/null
+++ b/tools/marvell-dove/depends/yajl/Makefile
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+include ../depends.mk
+
+# lib name, version
+LIBNAME=yajl
+VERSION=2.0.1
+SOURCE=lloyd-$(LIBNAME)-f4b2b1a
+ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
+BASE_URL=http://github.com/lloyd/yajl/tarball/2.0.1
+CMAKE=cmake
+# configuration settings
+LIBDYLIB=$(SOURCE)/build/$(LIBNAME)-$(VERSION)/lib/libyajl.so
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); mkdir build; cd build; $(CMAKE) -DCMAKE_INSTALL_PREFIX='$(PREFIX)' ../
+
+$(LIBDYLIB): $(SOURCE)
+ make -j $(JOBS) -C $(SOURCE)/build
+
+.installed:
+ make -C $(SOURCE)/build install
+ touch $@
+
+clean:
+ make -C $(SOURCE)/build clean
+ rm -f .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
+
diff --git a/tools/marvell-dove/setup-sdk.sh b/tools/marvell-dove/setup-sdk.sh
new file mode 100755
index 0000000..ebcf70e
--- /dev/null
+++ b/tools/marvell-dove/setup-sdk.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+SCRIPT_PATH=$(cd `dirname $0` && pwd)
+
+USE_BUILDROOT=1
+
+if [ "$USE_BUILDROOT" = "1" ]; then
+ BUILDROOT=/opt/xbmc-cubox/buildroot
+ TARBALLS=/opt/xbmc-tarballs
+ XBMCPREFIX=/opt/xbmc-cubox/xbmc-bin
+
+ SDKSTAGE=$BUILDROOT/output/staging
+ TARGETFS=$BUILDROOT/output/target
+ TOOLCHAIN=$BUILDROOT/output/host/usr/
+else
+ TARBALLS=/opt/xbmc-tarballs
+ SDKSTAGE=/opt/cubox-rootfs
+ XBMCPREFIX=/opt/xbmc-cubox/xbmc-bin
+ TARGETFS=/opt/cubox-rootfs
+ TOOLCHAIN=/usr/local/cubox-gcc
+ BUILDROOT=/opt/cubox-rootfs
+fi
+
+sudo mkdir -p $XBMCPREFIX
+sudo chmod 777 $XBMCPREFIX
+mkdir -p $XBMCPREFIX/lib
+mkdir -p $XBMCPREFIX/include
+
+echo "SDKSTAGE=$SDKSTAGE" > $SCRIPT_PATH/Makefile.include
+echo "XBMCPREFIX=$XBMCPREFIX" >> $SCRIPT_PATH/Makefile.include
+echo "TARGETFS=$TARGETFS" >> $SCRIPT_PATH/Makefile.include
+echo "TOOLCHAIN=$TOOLCHAIN" >> $SCRIPT_PATH/Makefile.include
+echo "BUILDROOT=$BUILDROOT" >> $SCRIPT_PATH/Makefile.include
+echo "USE_BUILDROOT=$USE_BUILDROOT" >> $SCRIPT_PATH/Makefile.include
+echo "BASE_URL=http://mirrors.xbmc.org/build-deps/darwin-libs" >> $SCRIPT_PATH/Makefile.include
+echo "TARBALLS_LOCATION=$TARBALLS" >> $SCRIPT_PATH/Makefile.include
+echo "RETRIEVE_TOOL=/usr/bin/curl" >> $SCRIPT_PATH/Makefile.include
+echo "RETRIEVE_TOOL_FLAGS=-Ls --create-dirs --output \$(TARBALLS_LOCATION)/\$(ARCHIVE)" >> $SCRIPT_PATH/Makefile.include
+echo "ARCHIVE_TOOL=/bin/tar" >> $SCRIPT_PATH/Makefile.include
+echo "ARCHIVE_TOOL_FLAGS=xf" >> $SCRIPT_PATH/Makefile.include
+echo "JOBS=$((`grep -c processor /proc/cpuinfo` -1))" >> $SCRIPT_PATH/Makefile.include
diff --git a/xbmc/cores/AudioRenderers/ALSADirectSound.cpp b/xbmc/cores/AudioRenderers/ALSADirectSound.cpp
index 2ebacb3..3e17d13 100644
--- a/xbmc/cores/AudioRenderers/ALSADirectSound.cpp
+++ b/xbmc/cores/AudioRenderers/ALSADirectSound.cpp
@@ -112,7 +112,7 @@ bool CALSADirectSound::Initialize(IAudioCallback* pCallback, const CStdString& d
if (!m_bPassthrough)
m_amp.SetVolume(m_nCurrentVolume);
- m_dwFrameCount = 512;
+ m_dwFrameCount = 1024;
m_dwNumPackets = 16;
m_uiBufferSize = 0;
@@ -253,13 +253,13 @@ bool CALSADirectSound::Initialize(IAudioCallback* pCallback, const CStdString& d
nErr = snd_pcm_hw_params_set_periods_near(m_pPlayHandle, hw_params, &m_dwNumPackets, NULL);
CHECK_ALSA_RETURN(LOGERROR,"hw_params_set_periods",nErr);
- nErr = snd_pcm_hw_params_get_buffer_size(hw_params, &m_uiBufferSize);
- CHECK_ALSA_RETURN(LOGERROR,"hw_params_get_buffer_size",nErr);
-
/* Assign them to the playback handle and free the parameters structure */
nErr = snd_pcm_hw_params(m_pPlayHandle, hw_params);
CHECK_ALSA_RETURN(LOGERROR,"snd_pcm_hw_params",nErr);
+ nErr = snd_pcm_hw_params_get_buffer_size(hw_params, &m_uiBufferSize);
+ CHECK_ALSA_RETURN(LOGERROR,"hw_params_get_buffer_size",nErr);
+
nErr = snd_pcm_sw_params_current(m_pPlayHandle, sw_params);
CHECK_ALSA_RETURN(LOGERROR,"sw_params_current",nErr);
diff --git a/xbmc/cores/VideoRenderers/DoveOverlayRenderer.cpp b/xbmc/cores/VideoRenderers/DoveOverlayRenderer.cpp
new file mode 100644
index 0000000..9091651
--- /dev/null
+++ b/xbmc/cores/VideoRenderers/DoveOverlayRenderer.cpp
@@ -0,0 +1,614 @@
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://www.solid-run.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * Original Dove Overlay Rendere written by Rabeeh Khoury from Solid-Run <support@solid-run.com>
+ *
+ */
+
+#include "system.h"
+#if (defined HAVE_CONFIG_H) && (!defined WIN32)
+#include "config.h"
+#endif
+
+#if defined(HAS_MARVELL_DOVE)
+
+#undef COLOR_KEY_BLACK
+#define COLOR_KEY_ALPHA
+#include "DoveOverlayRenderer.h"
+#include "dovefb.h"
+#include "utils/log.h"
+#include <stdlib.h>
+#include <malloc.h>
+#include "utils/fastmemcpy.h"
+#include "guilib/GraphicContext.h"
+
+#if defined(CLASSNAME)
+#undef CLASSNAME
+#endif
+
+#define CLASSNAME "CDoveOverlayRenderer"
+
+CDoveOverlayRenderer::CDoveOverlayRenderer()
+{
+ memset(m_SoftPicture, 0, sizeof(OutputBuffer) * NUM_BUFFERS);
+
+ for(int i = 0; i < NUM_BUFFERS; i++)
+ {
+ m_yuvBuffers[i].plane[0] = NULL;
+ m_yuvBuffers[i].plane[1] = NULL;
+ m_yuvBuffers[i].plane[2] = NULL;
+
+ m_SoftPicture[i].pPicture = (IppVmetaPicture *)malloc(sizeof(IppVmetaPicture));
+ if(m_SoftPicture[i].pPicture)
+ memset(m_SoftPicture[i].pPicture, 0, sizeof(IppVmetaPicture));
+ }
+
+ m_DllMiscGen = new DllLibMiscGen();
+ m_DllVMETA = new DllLibVMETA();
+
+ UnInit();
+}
+
+CDoveOverlayRenderer::~CDoveOverlayRenderer()
+{
+ UnInit();
+
+ for(int i = 0; i < NUM_BUFFERS; i++)
+ {
+ if(m_SoftPicture[i].pPicture)
+ free(m_SoftPicture[i].pPicture);
+ m_SoftPicture[i].pPicture = NULL;
+ }
+
+ m_DllVMETA->Unload();
+ m_DllMiscGen->Unload();
+
+ delete m_DllMiscGen;
+ delete m_DllVMETA;
+}
+
+
+void CDoveOverlayRenderer::ManageDisplay()
+{
+ CRect view;
+
+ view.x1 = (float)g_settings.m_ResInfo[m_resolution].Overscan.left;
+ view.y1 = (float)g_settings.m_ResInfo[m_resolution].Overscan.top;
+ view.x2 = (float)g_settings.m_ResInfo[m_resolution].Overscan.right;
+ view.y2 = (float)g_settings.m_ResInfo[m_resolution].Overscan.bottom;
+
+ m_sourceRect.x1 = (float)g_settings.m_currentVideoSettings.m_CropLeft;
+ m_sourceRect.y1 = (float)g_settings.m_currentVideoSettings.m_CropTop;
+ m_sourceRect.x2 = (float)m_sourceWidth - g_settings.m_currentVideoSettings.m_CropRight;
+ m_sourceRect.y2 = (float)m_sourceHeight - g_settings.m_currentVideoSettings.m_CropBottom;
+
+ CalcNormalDisplayRect(view.x1, view.y1, view.Width(), view.Height(), GetAspectRatio() * g_settings.m_fPixelRatio, g_settings.m_fZoomAmount, g_settings.m_fVerticalShift);
+
+ if (CONF_FLAGS_FORMAT_MASK(m_iFlags) == CONF_FLAGS_FORMAT_UYVY)
+ {
+ m_overlaySurface.videoMode = DOVEFB_VMODE_YUV422PACKED_SWAPYUorV;
+ m_overlaySurface.viewPortInfo.ycPitch = (m_sourceRect.x2 - m_sourceRect.x1) * 2;
+ m_overlaySurface.viewPortInfo.uvPitch = 0;
+ }
+ else if (CONF_FLAGS_FORMAT_MASK(m_iFlags) == CONF_FLAGS_FORMAT_YV12)
+ {
+ m_overlaySurface.videoMode = DOVEFB_VMODE_YUV420PLANAR;
+ m_overlaySurface.viewPortInfo.ycPitch = m_sourceRect.x2 - m_sourceRect.x1;
+ m_overlaySurface.viewPortInfo.uvPitch = (m_sourceRect.x2 - m_sourceRect.x1) / 2;
+ }
+
+ m_overlaySurface.viewPortInfo.srcWidth = m_sourceRect.x2 - m_sourceRect.x1;
+ m_overlaySurface.viewPortInfo.srcHeight = m_sourceRect.y2 - m_sourceRect.y1;
+ m_overlaySurface.viewPortInfo.zoomXSize = m_destRect.x2 - m_destRect.x1;
+ m_overlaySurface.viewPortInfo.zoomYSize = m_destRect.y2 - m_destRect.y1;
+
+ m_overlaySurface.viewPortOffset.xOffset = m_destRect.x1;
+ m_overlaySurface.viewPortOffset.yOffset = m_destRect.y1;
+
+}
+
+bool CDoveOverlayRenderer::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height,
+ float fps, unsigned int flags, unsigned int format)
+{
+ if (CONF_FLAGS_FORMAT_MASK(flags) == CONF_FLAGS_FORMAT_NV12)
+ {
+ CLog::Log(LOGERROR, "%s::%s - Bad format\n", CLASSNAME, __func__);
+ return false;
+ }
+
+ if (CONF_FLAGS_FORMAT_MASK(flags) != CONF_FLAGS_FORMAT_UYVY && CONF_FLAGS_FORMAT_MASK(flags) != CONF_FLAGS_FORMAT_YV12)
+ {
+ CLog::Log(LOGERROR, "%s::%s - Unkown format 0x%x", CLASSNAME, __func__, CONF_FLAGS_FORMAT_MASK(flags));
+ return false;
+ }
+
+ memset (&m_overlaySurface, 0, sizeof(m_overlaySurface));
+ m_overlaySurface.videoBufferAddr.startAddr = 0;
+ m_overlaySurface.videoBufferAddr.length = 0;//frameSize;
+ m_overlaySurface.videoBufferAddr.inputData = 0;
+ m_overlaySurface.videoBufferAddr.frameID = 0;
+
+ m_sourceWidth = width;
+ m_sourceHeight = height;
+ m_iFlags = flags;
+
+ // Calculate the input frame aspect ratio.
+ CalculateFrameAspectRatio(d_width, d_height);
+ ChooseBestResolution(fps);
+ SetViewMode(g_settings.m_currentVideoSettings.m_ViewMode);
+ ManageDisplay();
+
+ CLog::Log(LOGDEBUG, "%s::%s - Setting ycPitch to %d, uvPitch to %d\n", CLASSNAME, __func__,
+ m_overlaySurface.viewPortInfo.ycPitch ,m_overlaySurface.viewPortInfo.uvPitch);
+
+ CLog::Log(LOGDEBUG, "m_sourceRect.x1 %f m_sourceRect.x2 %f m_sourceRect.y1 %f m_sourceRect.y2 %f m_sourceFrameRatio %f\n",
+ m_sourceRect.x1, m_sourceRect.x2, m_sourceRect.y1, m_sourceRect.y2, m_sourceFrameRatio);
+ CLog::Log(LOGDEBUG, "m_destRect.x1 %f m_destRect.x2 %f m_destRect.y1 %f m_destRect.y2 %f\n",
+ m_destRect.x1, m_destRect.x2, m_destRect.y1, m_destRect.y2);
+
+ m_enabled = 0;
+
+ // Open the framebuffer
+ m_overlayfd = open("/dev/fb1", O_RDWR);
+ if (m_overlayfd == -1)
+ {
+ CLog::Log(LOGERROR, "%s::%s - Failed to open framebuffer", CLASSNAME, __func__);
+ return false;
+ }
+
+ int srcMode = SHM_NORMAL;
+
+ if (ioctl(m_overlayfd, DOVEFB_IOCTL_SET_SRC_MODE, &srcMode) == -1)
+ {
+ CLog::Log(LOGERROR, "%s::%s - Failed to enable video overlay\n", CLASSNAME, __func__);
+ return false;
+ }
+
+ if (ioctl(m_overlayfd, DOVEFB_IOCTL_SET_VIDEO_MODE, &m_overlaySurface.videoMode) == -1)
+ {
+ CLog::Log(LOGERROR, "%s::%s - Failed to setup video mode\n", CLASSNAME, __func__);
+ return false;
+ }
+
+ if (ioctl(m_overlayfd, DOVEFB_IOCTL_SET_VIEWPORT_INFO, &m_overlaySurface.viewPortInfo) != 0)
+ {
+ CLog::Log(LOGERROR, "%s::%s - Failed to setup video port\n", CLASSNAME, __func__);
+ return false;
+ }
+
+ if (ioctl(m_overlayfd, DOVEFB_IOCTL_SET_VID_OFFSET, &m_overlaySurface.viewPortOffset) != 0)
+ {
+ CLog::Log(LOGERROR, "%s::%s - Failed to setup video port offset\n", CLASSNAME, __func__);
+ return false;
+ }
+
+ int interpolation = 3; // bi-linear interpolation
+
+ if (ioctl(m_overlayfd, DOVEFB_IOCTL_SET_INTERPOLATION_MODE, &interpolation) != 0)
+ {
+ CLog::Log(LOGERROR, "%s::%s - Failed to setup video interpolation mode\n", CLASSNAME, __func__);
+ return false;
+ }
+
+ struct _sColorKeyNAlpha alpha;
+
+ memset (&alpha, 0, sizeof(alpha));
+
+ alpha.mode = DOVEFB_ENABLE_RGB_COLORKEY_MODE;
+ alpha.alphapath = DOVEFB_GRA_PATH_ALPHA;
+ alpha.config = 0xff;//c0;
+#ifdef COLOR_KEY_ALPHA
+ alpha.Y_ColorAlpha = 0x02020200;
+ alpha.U_ColorAlpha = 0x05050500;
+ alpha.V_ColorAlpha = 0x07070700;
+#endif
+#ifdef COLOR_KEY_BLACK
+ alpha.Y_ColorAlpha = 0x0;
+ alpha.U_ColorAlpha = 0x0;
+ alpha.V_ColorAlpha = 0x0;
+#endif
+
+ if (ioctl(m_overlayfd, DOVEFB_IOCTL_SET_COLORKEYnALPHA, &alpha) == -1)
+ {
+ CLog::Log(LOGERROR, "%s::%s - Failed to configure alpha\n", CLASSNAME, __func__);
+ return false;
+ }
+
+ for (unsigned int i = 0; i < NUM_BUFFERS; i++)
+ {
+ FreeYV12Image(i);
+ CreateYV12Image(i, m_sourceWidth, m_sourceHeight);
+ }
+
+ m_currentBuffer = 0;
+ m_bConfigured = true;
+
+ CLog::Log(LOGDEBUG, "%s::%s - Proper format, continuing\n", CLASSNAME, __func__);
+
+ return m_bConfigured;
+}
+
+unsigned int CDoveOverlayRenderer::PreInit()
+{
+ if(!m_DllVMETA->Load() || !m_DllMiscGen->Load())
+ return false;
+
+ UnInit();
+
+ m_currentBuffer = 0;
+
+ m_resolution = g_guiSettings.m_LookAndFeelResolution;
+ if ( m_resolution == RES_WINDOW )
+ m_resolution = RES_DESKTOP;
+
+ return true;
+}
+
+int CDoveOverlayRenderer::GetImage(YV12Image *image, int source, bool readonly)
+{
+ if(!image)
+ return -1;
+
+ /* take next available buffer */
+ if( source == AUTOSOURCE)
+ source = NextYV12Image();
+
+ YV12Image &im = m_yuvBuffers[source];
+
+ for(int p = 0; p < MAX_PLANES; p++)
+ {
+ image->plane[p] = im.plane[p];
+ image->stride[p] = im.stride[p];
+ }
+
+ image->width = im.width;
+ image->height = im.height;
+ image->flags = im.flags;
+ image->cshift_x = im.cshift_x;
+ image->cshift_y = im.cshift_y;
+
+ return source;
+}
+
+void CDoveOverlayRenderer::ReleaseImage(int source, bool preserve)
+{
+}
+
+void CDoveOverlayRenderer::FlipPage(int source)
+{
+ if (!m_bConfigured)
+ return;
+
+ ManageDisplay();
+
+ IppVmetaPicture *pPicture = m_SoftPicture[m_currentBuffer].pPicture;
+
+ struct shm_private_info info;
+ info.method = SHM_VMETA;
+ ioctl(m_overlayfd, DOVEFB_IOCTL_SET_SRC_MODE, &info.method);
+
+ m_overlaySurface.videoBufferAddr.frameID = 0;
+
+ if(pPicture && pPicture->nPhyAddr)
+ {
+ m_overlaySurface.videoBufferAddr.startAddr = (unsigned char *)pPicture->nPhyAddr;
+ m_overlaySurface.videoBufferAddr.length = pPicture->nBufSize;
+ }
+ else
+ {
+ m_overlaySurface.videoBufferAddr.startAddr = NULL;
+ m_overlaySurface.videoBufferAddr.length = 0;
+ }
+
+ //ioctl by Solid-Run not in marvel kernel
+ //if(ioctl(m_overlayfd, DOVEFB_IOCTL_NEXT_FRAME_PRESENT, &m_SoftPicture[m_currentBuffer].buf) != 0)
+
+ if(ioctl(m_overlayfd, DOVEFB_IOCTL_FLIP_VID_BUFFER, &m_overlaySurface) != 0)
+ CLog::Log(LOGERROR, "%s::%s - Error flipping\n", CLASSNAME, __func__);
+
+ if (m_enabled == 0)
+ {
+ m_enabled = 1;
+
+ if (ioctl(m_overlayfd, DOVEFB_IOCTL_SWITCH_VID_OVLY, &m_enabled) == -1)
+ CLog::Log(LOGERROR, "%s::%s - Failed to enable video overlay\n", CLASSNAME, __func__);
+
+ }
+
+ /*
+ * Is only needed for DOVEFB_IOCTL_NEXT_FRAME_PRESENT
+ *
+ if (ioctl(m_overlayfd, DOVEFB_IOCTL_WAIT_VSYNC, 0) != 0)
+ CLog::Log(LOGERROR, "%s::%s - Error waiting for vsync\n", CLASSNAME, __func__);
+ */
+
+ if( source >= 0 && source < NUM_BUFFERS )
+ m_currentBuffer = source;
+ else
+ m_currentBuffer = NextYV12Image();
+}
+
+void CDoveOverlayRenderer::Reset()
+{
+}
+
+void CDoveOverlayRenderer::Update(bool bPauseDrawing)
+{
+}
+
+void CDoveOverlayRenderer::AddProcessor(YV12Image *image, DVDVideoPicture *pDvdVideoPicture)
+{
+ if (!m_bConfigured)
+ return;
+
+ DrawSlice(pDvdVideoPicture);
+}
+
+void CDoveOverlayRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha)
+{
+ if (!m_bConfigured)
+ return;
+
+#ifdef COLOR_KEY_ALPHA
+ glEnable(GL_SCISSOR_TEST);
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+#endif
+}
+
+bool CDoveOverlayRenderer::RenderCapture(CRenderCapture* capture)
+{
+ CLog::Log(LOGERROR, "%s::%s - Not implemented\n", CLASSNAME, __func__);
+ return true;
+}
+
+
+unsigned int CDoveOverlayRenderer::DrawSlice(DVDVideoPicture *pDvdVideoPicture)
+{
+ Ipp32u nPhyAddr = 0;
+ Ipp32u nBufSize = 0;
+
+ if(pDvdVideoPicture->vmeta)
+ {
+ IppVmetaPicture *pPicture = (IppVmetaPicture *)pDvdVideoPicture->vmeta;
+ nPhyAddr = pPicture->nPhyAddr;
+ nBufSize = pPicture->nBufSize;
+ }
+
+ IppVmetaPicture *pPicture = m_SoftPicture[m_currentBuffer].pPicture;
+
+ m_SoftPicture[m_currentBuffer].buf[0] = NULL;
+ m_SoftPicture[m_currentBuffer].buf[1] = NULL;
+ m_SoftPicture[m_currentBuffer].buf[2] = NULL;
+
+ if(!pPicture)
+ return false;
+
+ if(nPhyAddr)
+ {
+ // Decoder allocated buffer
+ pPicture->nPhyAddr = nPhyAddr;
+ pPicture->nBufSize = nBufSize;
+ m_SoftPicture[m_currentBuffer].bFree = false;
+ m_SoftPicture[m_currentBuffer].buf[0] = (unsigned char *)pPicture->nPhyAddr;
+ m_SoftPicture[m_currentBuffer].buf[1] = (unsigned char *)pPicture->nPhyAddr +
+ (pDvdVideoPicture->iLineSize[0] * pDvdVideoPicture->iHeight);
+ m_SoftPicture[m_currentBuffer].buf[2] = (unsigned char *)pPicture->nPhyAddr +
+ (pDvdVideoPicture->iLineSize[0] * pDvdVideoPicture->iHeight) +
+ (pDvdVideoPicture->iLineSize[1] * pDvdVideoPicture->iHeight / 2);
+ }
+ else
+ {
+ // Software decoding. Allocate buffer for ouput
+ if(CONF_FLAGS_FORMAT_MASK(m_iFlags) != CONF_FLAGS_FORMAT_YV12)
+ return false;
+
+ unsigned int memSize = (pDvdVideoPicture->iLineSize[0] * pDvdVideoPicture->iHeight) +
+ (pDvdVideoPicture->iLineSize[1] * pDvdVideoPicture->iHeight / 2) +
+ (pDvdVideoPicture->iLineSize[2] * pDvdVideoPicture->iHeight / 2);
+
+ if(!pPicture->pBuf)
+ pPicture->pBuf = (Ipp8u*)m_DllVMETA->vdec_os_api_dma_alloc(memSize, VMETA_DIS_BUF_ALIGN, &(pPicture->nPhyAddr));
+
+ if(!pPicture->pBuf)
+ {
+ CLog::Log(LOGERROR, "%s::%s - Failed to alloc memory\n", CLASSNAME, __func__);
+ return false;
+ }
+
+ m_SoftPicture[m_currentBuffer].bFree = true;
+ m_SoftPicture[m_currentBuffer].buf[0] = (unsigned char *)pPicture->nPhyAddr;
+ m_SoftPicture[m_currentBuffer].buf[1] = (unsigned char *)pPicture->nPhyAddr +
+ (pDvdVideoPicture->iLineSize[0] * pDvdVideoPicture->iHeight);
+ m_SoftPicture[m_currentBuffer].buf[2] = (unsigned char *)pPicture->nPhyAddr +
+ (pDvdVideoPicture->iLineSize[0] * pDvdVideoPicture->iHeight) +
+ (pDvdVideoPicture->iLineSize[1] * pDvdVideoPicture->iHeight / 2);
+
+ unsigned char *dst = (unsigned char *)pPicture->pBuf;
+
+ memset(dst, 0, memSize);
+
+ /*
+ int i;
+
+ unsigned char *src = pDvdVideoPicture->data[0];
+ for(i = 0; i < pDvdVideoPicture->iHeight; i++)
+ {
+ fast_memcpy(dst, src, pDvdVideoPicture->iLineSize[0]);
+ src += pDvdVideoPicture->iLineSize[0];
+ dst += pDvdVideoPicture->iLineSize[0];
+ }
+
+ src = pDvdVideoPicture->data[1];
+ for(i = 0; i < pDvdVideoPicture->iHeight / 2; i++)
+ {
+ fast_memcpy(dst, src, pDvdVideoPicture->iLineSize[1]);
+ src += pDvdVideoPicture->iLineSize[1];
+ dst += pDvdVideoPicture->iLineSize[1];
+ }
+
+ src = pDvdVideoPicture->data[2];
+ for(i = 0; i < pDvdVideoPicture->iHeight / 2; i++)
+ {
+ fast_memcpy(dst, src, pDvdVideoPicture->iLineSize[2]);
+ src += pDvdVideoPicture->iLineSize[2];
+ dst += pDvdVideoPicture->iLineSize[2];
+ }
+ */
+
+ fast_memcpy( dst, (unsigned char *)pDvdVideoPicture->data[0], pDvdVideoPicture->iLineSize[0] * pDvdVideoPicture->iHeight );
+ dst += pDvdVideoPicture->iLineSize[0] * pDvdVideoPicture->iHeight;
+ fast_memcpy( dst, (unsigned char *)pDvdVideoPicture->data[1], pDvdVideoPicture->iLineSize[1] * pDvdVideoPicture->iHeight / 2 );
+ dst += pDvdVideoPicture->iLineSize[1] * pDvdVideoPicture->iHeight / 2;
+ fast_memcpy( dst, (unsigned char *)pDvdVideoPicture->data[2], pDvdVideoPicture->iLineSize[2] * pDvdVideoPicture->iHeight / 2 );
+ }
+ return 0;
+}
+
+void CDoveOverlayRenderer::UnInit()
+{
+ CLog::Log(LOGDEBUG, "%s::%s\n", CLASSNAME, __func__);
+
+ memset(m_FreeBufAddr, 0, MAX_QUEUE_NUM * sizeof(unsigned char*));
+ if(m_overlayfd)
+ ioctl(m_overlayfd, DOVEFB_IOCTL_GET_FREELIST, &m_FreeBufAddr);
+
+ if(m_enabled)
+ {
+ m_enabled = 0;
+
+ if (ioctl(m_overlayfd, DOVEFB_IOCTL_WAIT_VSYNC, 0) != 0)
+ CLog::Log(LOGERROR, "%s::%s - Error waiting for vsync\n", CLASSNAME, __func__);
+
+ if(ioctl(m_overlayfd, DOVEFB_IOCTL_SWITCH_VID_OVLY, &m_enabled) == -1)
+ CLog::Log(LOGERROR, "%s::%s Failed to disable video overlay\n", CLASSNAME, __func__);
+ }
+
+ if (m_overlayfd > 0)
+ close(m_overlayfd);
+
+ for(int i = 0; i < NUM_BUFFERS; i++)
+ {
+ FreeYV12Image(i);
+ if(m_SoftPicture[i].bFree)
+ {
+ if(m_SoftPicture[i].pPicture && m_SoftPicture[i].pPicture->pBuf)
+ m_DllVMETA->vdec_os_api_dma_free(m_SoftPicture[i].pPicture->pBuf);
+ m_SoftPicture[i].pPicture->pBuf = NULL;
+ m_SoftPicture[i].bFree = false;
+ }
+ }
+
+ m_currentBuffer = 0;
+ m_iFlags = 0;
+ m_bConfigured = false;
+ m_overlayfd = -1;
+ m_sourceWidth = 0;
+ m_sourceHeight = 0;
+
+ memset(&m_overlaySurface, 0, sizeof(struct _sOvlySurface));
+ memset(&m_overlayPlaneInfo, 0, sizeof(struct _sViewPortInfo));
+}
+
+void CDoveOverlayRenderer::CreateThumbnail(CBaseTexture* texture, unsigned int width, unsigned int height)
+{
+ CLog::Log(LOGDEBUG, "%s::%s Was asked to create thumbnail (width = %d, height = %d\n",
+ CLASSNAME, __func__, width, height);
+}
+
+bool CDoveOverlayRenderer::Supports(EDEINTERLACEMODE mode)
+{
+ return false;
+}
+
+bool CDoveOverlayRenderer::Supports(ERENDERFEATURE feature)
+{
+ return false;
+}
+
+bool CDoveOverlayRenderer::SupportsMultiPassRendering()
+{
+ return false;
+}
+
+bool CDoveOverlayRenderer::Supports(EINTERLACEMETHOD method)
+{
+ return false;
+}
+
+bool CDoveOverlayRenderer::Supports(ESCALINGMETHOD method)
+{
+ if(method == VS_SCALINGMETHOD_NEAREST || method == VS_SCALINGMETHOD_LINEAR)
+ return true;
+
+ return false;
+}
+
+EINTERLACEMETHOD CDoveOverlayRenderer::AutoInterlaceMethod()
+{
+ return VS_INTERLACEMETHOD_NONE;
+}
+
+unsigned int CDoveOverlayRenderer::NextYV12Image()
+{
+ return (m_currentBuffer + 1) % NUM_BUFFERS;
+}
+
+bool CDoveOverlayRenderer::CreateYV12Image(unsigned int index, unsigned int width, unsigned int height)
+{
+ YV12Image &im = m_yuvBuffers[index];
+
+ im.width = width;
+ im.height = height;
+ im.cshift_x = 1;
+ im.cshift_y = 1;
+
+ unsigned paddedWidth = (im.width + 15) & ~15;
+
+ im.stride[0] = paddedWidth;
+ im.stride[1] = paddedWidth >> im.cshift_x;
+ im.stride[2] = paddedWidth >> im.cshift_x;
+
+ im.planesize[0] = im.stride[0] * im.height;
+ im.planesize[1] = im.stride[1] * ( im.height >> im.cshift_y );
+ im.planesize[2] = im.stride[2] * ( im.height >> im.cshift_y );
+
+ /*
+ for (int i = 0; i < MAX_PLANES; i++)
+ im.plane[i] = new BYTE[im.planesize[i]];
+ */
+
+ return true;
+}
+
+bool CDoveOverlayRenderer::FreeYV12Image(unsigned int index)
+{
+ YV12Image &im = m_yuvBuffers[index];
+
+ for (int i = 0; i < MAX_PLANES; i++)
+ {
+ //delete[] im.plane[i];
+ im.plane[i] = NULL;
+ }
+
+ memset(&im , 0, sizeof(YV12Image));
+
+ return true;
+}
+#endif
diff --git a/xbmc/cores/VideoRenderers/DoveOverlayRenderer.h b/xbmc/cores/VideoRenderers/DoveOverlayRenderer.h
new file mode 100644
index 0000000..320cc1c
--- /dev/null
+++ b/xbmc/cores/VideoRenderers/DoveOverlayRenderer.h
@@ -0,0 +1,206 @@
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#if defined(HAS_MARVELL_DOVE)
+
+#undef __u8
+#undef byte
+
+#include "../../settings/VideoSettings.h"
+#include "../dvdplayer/DVDCodecs/Video/DVDVideoCodec.h"
+#include "../dvdplayer/DVDCodecs/Video/DllVMETA.h"
+#include "RenderFlags.h"
+#include "BaseRenderer.h"
+#include "settings/GUISettings.h"
+#include "settings/Settings.h"
+
+class CRenderCapture;
+class CBaseTexture;
+
+#undef ALIGN
+#define ALIGN(value, alignment) (((value)+((alignment)-1))&~((alignment)-1))
+
+#define AUTOSOURCE -1
+
+#define IMAGE_FLAG_WRITING 0x01 /* image is in use after a call to GetImage, caller may be reading or writing */
+#define IMAGE_FLAG_READING 0x02 /* image is in use after a call to GetImage, caller is only reading */
+#define IMAGE_FLAG_DYNAMIC 0x04 /* image was allocated due to a call to GetImage */
+#define IMAGE_FLAG_RESERVED 0x08 /* image is reserved, must be asked for specifically used to preserve images */
+#define IMAGE_FLAG_READY 0x16 /* image is ready to be uploaded to texture memory */
+#define IMAGE_FLAG_INUSE (IMAGE_FLAG_WRITING | IMAGE_FLAG_READING | IMAGE_FLAG_RESERVED)
+
+extern "C"
+{
+#include <sys/ioctl.h>
+#include <linux/fb.h>
+#include "dovefb.h"
+}
+
+struct DRAWRECT
+{
+ float left;
+ float top;
+ float right;
+ float bottom;
+};
+
+enum EFIELDSYNC
+{
+ FS_NONE,
+ FS_TOP, // FS_ODD,
+ FS_BOT // FS_EVEN
+};
+
+struct YUVRANGE
+{
+ int y_min, y_max;
+ int u_min, u_max;
+ int v_min, v_max;
+};
+
+struct YUVCOEF
+{
+ float r_up, r_vp;
+ float g_up, g_vp;
+ float b_up, b_vp;
+};
+
+/*
+enum RenderMethod
+{
+ RENDER_GLSL=0x01,
+ RENDER_SW=0x04,
+ RENDER_POT=0x10
+};
+
+enum RenderQuality
+{
+ RQ_LOW=1,
+ RQ_SINGLEPASS,
+ RQ_MULTIPASS,
+ RQ_SOFTWARE
+};
+*/
+
+#define PLANE_Y 0
+#define PLANE_U 1
+#define PLANE_V 2
+
+#define FIELD_FULL 0
+#define FIELD_ODD 1
+#define FIELD_EVEN 2
+
+#define NUM_BUFFERS 3
+
+#define MAX_QUEUE_NUM 60
+
+extern YUVRANGE yuv_range_lim;
+extern YUVRANGE yuv_range_full;
+extern YUVCOEF yuv_coef_bt601;
+extern YUVCOEF yuv_coef_bt709;
+extern YUVCOEF yuv_coef_ebu;
+extern YUVCOEF yuv_coef_smtp240m;
+
+typedef struct _OutputBuffer
+{
+ IppVmetaPicture *pPicture;
+ bool bFree;
+ unsigned char *buf[3];
+} OutputBuffer;
+
+class CDoveOverlayRenderer : public CBaseRenderer
+{
+ public:
+ CDoveOverlayRenderer();
+ virtual ~CDoveOverlayRenderer();
+
+ virtual void Update(bool bPauseDrawing);
+ virtual void SetupScreenshot() {};
+
+ bool RenderCapture(CRenderCapture* capture);
+
+ void CreateThumbnail(CBaseTexture *texture, unsigned int width, unsigned int height);
+
+ // Player functions
+ virtual void ManageDisplay();
+ virtual bool Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height,
+ float fps, unsigned int flags, unsigned int format);
+ virtual bool IsConfigured() { return m_bConfigured; }
+ virtual int GetImage(YV12Image *image, int source = AUTOSOURCE, bool readonly = false);
+ virtual void ReleaseImage(int source, bool preserve = false);
+ virtual unsigned int DrawSlice(DVDVideoPicture *pDvdVideoPicture);
+ virtual void FlipPage(int source);
+ virtual unsigned int PreInit();
+ virtual void UnInit();
+ virtual void Reset(); /* resets renderer after seek for example */
+
+ virtual void AddProcessor(YV12Image *image, DVDVideoPicture *pDvdVideoPicture);
+
+ virtual void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255);
+
+ // Feature support
+ virtual bool SupportsMultiPassRendering();
+ virtual bool Supports(ERENDERFEATURE feature);
+ virtual bool Supports(EDEINTERLACEMODE mode);
+ virtual bool Supports(EINTERLACEMETHOD method);
+ virtual bool Supports(ESCALINGMETHOD method);
+
+ virtual EINTERLACEMETHOD AutoInterlaceMethod();
+
+ private:
+ unsigned int NextYV12Image();
+ bool CreateYV12Image(unsigned int index, unsigned int width, unsigned int height);
+ bool FreeYV12Image(unsigned int index);
+
+ bool m_bConfigured;
+ unsigned int m_iFlags;
+
+ YV12Image m_yuvBuffers[NUM_BUFFERS];
+ unsigned int m_currentBuffer;
+
+ // The Overlay handlers
+ int m_overlayfd;
+
+ int m_enabled;
+ struct _sOvlySurface m_overlaySurface;
+ struct _sViewPortInfo m_overlayPlaneInfo;
+
+ DllLibMiscGen *m_DllMiscGen;
+ DllLibVMETA *m_DllVMETA;
+
+ OutputBuffer m_SoftPicture[NUM_BUFFERS];
+
+ unsigned char *m_FreeBufAddr[MAX_QUEUE_NUM];
+};
+
+inline int NP2( unsigned x )
+{
+ --x;
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+ return ++x;
+}
+#endif
diff --git a/xbmc/cores/VideoRenderers/Makefile.in b/xbmc/cores/VideoRenderers/Makefile.in
index 5bcaf6a..bbd3da0 100644
--- a/xbmc/cores/VideoRenderers/Makefile.in
+++ b/xbmc/cores/VideoRenderers/Makefile.in
@@ -16,9 +16,12 @@ SRCS+= LinuxRendererGL.cpp \
endif
ifeq (@USE_OPENGLES@,1)
-SRCS+= LinuxRendererGLES.cpp \
- OverlayRendererGL.cpp \
-
+SRCS+= OverlayRendererGL.cpp
+ifeq (@USE_MARVELL_DOVE@,1)
+SRCS+= DoveOverlayRenderer.cpp
+else
+SRCS+= LinuxRendererGLES.cpp
+endif
endif
LIB=VideoRenderer.a
diff --git a/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp b/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp
index a1a37d0..77ccaad 100644
--- a/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp
+++ b/xbmc/cores/VideoRenderers/OverlayRendererGL.cpp
@@ -27,7 +27,9 @@
#ifdef HAS_GL
#include "LinuxRendererGL.h"
#elif HAS_GLES == 2
+#if !defined(HAS_MARVELL_DOVE)
#include "LinuxRendererGLES.h"
+#endif
#include "guilib/MatrixGLES.h"
#endif
#include "RenderManager.h"
diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp
index b917860..4899116 100644
--- a/xbmc/cores/VideoRenderers/RenderManager.cpp
+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp
@@ -38,6 +38,8 @@
#if defined(HAS_GL)
#include "LinuxRendererGL.h"
+#elif defined(HAS_MARVELL_DOVE)
+ #include "DoveOverlayRenderer.h"
#elif HAS_GLES == 2
#include "LinuxRendererGLES.h"
#elif defined(HAS_DX)
@@ -312,6 +314,8 @@ unsigned int CXBMCRenderManager::PreInit()
{
#if defined(HAS_GL)
m_pRenderer = new CLinuxRendererGL();
+#elif defined(HAS_MARVELL_DOVE)
+ m_pRenderer = new CDoveOverlayRenderer();
#elif HAS_GLES == 2
m_pRenderer = new CLinuxRendererGLES();
#elif defined(HAS_DX)
@@ -760,7 +764,11 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic)
if(pic.format == DVDVideoPicture::FMT_YUV420P)
{
+#ifdef HAS_MARVELL_DOVE
+ m_pRenderer->AddProcessor(&image, &pic);
+#else
CDVDCodecUtils::CopyPicture(&image, &pic);
+#endif
}
else if(pic.format == DVDVideoPicture::FMT_NV12)
{
@@ -769,7 +777,11 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic)
else if(pic.format == DVDVideoPicture::FMT_YUY2
|| pic.format == DVDVideoPicture::FMT_UYVY)
{
+#ifdef HAS_MARVELL_DOVE
+ m_pRenderer->AddProcessor(&image, &pic);
+#else
CDVDCodecUtils::CopyYUV422PackedPicture(&image, &pic);
+#endif
}
else if(pic.format == DVDVideoPicture::FMT_DXVA)
{
diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h
index 7f8dbce..83b5f9c 100644
--- a/xbmc/cores/VideoRenderers/RenderManager.h
+++ b/xbmc/cores/VideoRenderers/RenderManager.h
@@ -25,6 +25,8 @@
#if defined (HAS_GL)
#include "LinuxRendererGL.h"
+#elif defined(HAS_MARVELL_DOVE)
+ #include "DoveOverlayRenderer.h"
#elif HAS_GLES == 2
#include "LinuxRendererGLES.h"
#elif defined(HAS_DX)
@@ -169,6 +171,8 @@ public:
#ifdef HAS_GL
CLinuxRendererGL *m_pRenderer;
+#elif defined(HAS_MARVELL_DOVE)
+ CDoveOverlayRenderer *m_pRenderer;
#elif HAS_GLES == 2
CLinuxRendererGLES *m_pRenderer;
#elif defined(HAS_DX)
diff --git a/xbmc/cores/VideoRenderers/dovefb.h b/xbmc/cores/VideoRenderers/dovefb.h
new file mode 100644
index 0000000..4a4a562
--- /dev/null
+++ b/xbmc/cores/VideoRenderers/dovefb.h
@@ -0,0 +1,517 @@
+/*
+ * linux/include/video/dovefb.h -- Marvell frame buffer for DOVE
+ *
+ *
+ * Copyright (C) Marvell Semiconductor Company. All rights reserved.
+ *
+ * Written by Green Wan <gwan@marvell.com>
+ *
+ * Adapted from: linux/drivers/video/skeletonfb.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive for
+ * more details.
+ *
+ */
+#ifndef _DOVEFB_H_
+#define _DOVEFB_H_
+
+/* ---------------------------------------------- */
+/* Header Files */
+/* ---------------------------------------------- */
+#include <linux/fb.h>
+
+/* ---------------------------------------------- */
+/* IOCTL Definition */
+/* ---------------------------------------------- */
+#define DOVEFB_IOC_MAGIC 'm'
+#define DOVEFB_IOCTL_CONFIG_CURSOR _IO(DOVEFB_IOC_MAGIC, 0)
+#define DOVEFB_IOCTL_DUMP_REGS _IO(DOVEFB_IOC_MAGIC, 1)
+#define DOVEFB_IOCTL_CLEAR_IRQ _IO(DOVEFB_IOC_MAGIC, 2)
+
+/*
+ * There are many video mode supported.
+ */
+#define DOVEFB_IOCTL_SET_VIDEO_MODE _IO(DOVEFB_IOC_MAGIC, 3)
+#define DOVEFB_IOCTL_GET_VIDEO_MODE _IO(DOVEFB_IOC_MAGIC, 4)
+/* Request a new video buffer from driver. User program needs to free
+ * this memory.
+ */
+#define DOVEFB_IOCTL_CREATE_VID_BUFFER _IO(DOVEFB_IOC_MAGIC, 5)
+
+/* Configure viewport in driver. */
+#define DOVEFB_IOCTL_SET_VIEWPORT_INFO _IO(DOVEFB_IOC_MAGIC, 6)
+#define DOVEFB_IOCTL_GET_VIEWPORT_INFO _IO(DOVEFB_IOC_MAGIC, 7)
+
+/* Flip the video buffer from user mode. Vide buffer can be separated into:
+ * a. Current-used buffer - user program put any data into it. It will be
+ * displayed immediately.
+ * b. Requested from driver but not current-used - user programe can put any
+ * data into it. It will be displayed after calling
+ * DOVEFB_IOCTL_FLIP_VID_BUFFER.
+ * User program should free this memory when they don't use it any more.
+ * c. User program alloated - user program can allocated a contiguos DMA
+ * buffer to store its video data. And flip it to driver. Notices that
+ * this momory should be free by user programs. Driver won't take care of
+ * this.
+ */
+#define DOVEFB_IOCTL_FLIP_VID_BUFFER _IO(DOVEFB_IOC_MAGIC, 8)
+
+/* Get the current buffer information. User program could use it to display
+ * anything directly. If developer wants to allocate multiple video layers,
+ * try to use DOVEFB_IOCTL_CREATE_VID_BUFFER to request a brand new video
+ * buffer.
+ */
+#define DOVEFB_IOCTL_GET_BUFF_ADDR _IO(DOVEFB_IOC_MAGIC, 9)
+
+/* Get/Set offset position of screen */
+#define DOVEFB_IOCTL_SET_VID_OFFSET _IO(DOVEFB_IOC_MAGIC, 10)
+#define DOVEFB_IOCTL_GET_VID_OFFSET _IO(DOVEFB_IOC_MAGIC, 11)
+
+/* Turn on the memory toggle function to improve the frame rate while playing
+ * movie.
+ */
+#define DOVEFB_IOCTL_SET_MEMORY_TOGGLE _IO(DOVEFB_IOC_MAGIC, 12)
+
+/* Turn on the memory toggle function to improve the frame rate while playing
+ * movie.
+ */
+#define DOVEFB_IOCTL_SET_COLORKEYnALPHA _IO(DOVEFB_IOC_MAGIC, 13)
+#define DOVEFB_IOCTL_GET_COLORKEYnALPHA _IO(DOVEFB_IOC_MAGIC, 14)
+#define DOVEFB_IOCTL_SWITCH_GRA_OVLY _IO(DOVEFB_IOC_MAGIC, 15)
+#define DOVEFB_IOCTL_SWITCH_VID_OVLY _IO(DOVEFB_IOC_MAGIC, 16)
+
+/* For Vmeta integration */
+#define DOVEFB_IOCTL_GET_FREELIST _IO(DOVEFB_IOC_MAGIC, 17)
+
+/* Wait for vsync happen. */
+#define DOVEFB_IOCTL_WAIT_VSYNC _IO(DOVEFB_IOC_MAGIC, 18)
+
+/* for xv+vmeta/sw decoder w/o memory move. */
+#define DOVEFB_IOCTL_GET_FBPA _IO(DOVEFB_IOC_MAGIC, 19)
+#define DOVEFB_IOCTL_GET_FBID _IO(DOVEFB_IOC_MAGIC, 20)
+#define DOVEFB_IOCTL_SET_SRC_MODE _IO(DOVEFB_IOC_MAGIC, 21)
+#define DOVEFB_IOCTL_GET_SRC_MODE _IO(DOVEFB_IOC_MAGIC, 22)
+
+/* Dynamic get EDID data */
+#define DOVEFB_IOCTL_GET_EDID_INFO _IO(DOVEFB_IOC_MAGIC, 23)
+#define DOVEFB_IOCTL_GET_EDID_DATA _IO(DOVEFB_IOC_MAGIC, 24)
+#define DOVEFB_IOCTL_SET_EDID_INTERVAL _IO(DOVEFB_IOC_MAGIC, 25)
+
+/* Video overlay ioctls */
+#define DOVEFB_IOCTL_NEXT_FRAME_PRESENT _IO(DOVEFB_IOC_MAGIC, 26)
+#define DOVEFB_IOCTL_SET_INTERPOLATION_MODE _IO(DOVEFB_IOC_MAGIC, 27)
+
+/* clear framebuffer: Makes resolution or color space changes look nicer */
+#define FBIO_CLEAR_FRAMEBUFFER _IO(FB_IOC_MAGIC, 19)
+
+/* Global alpha blend controls - Maintaining compatibility with existing
+ user programs. */
+#define FBIOPUT_VIDEO_ALPHABLEND 0xeb
+#define FBIOPUT_GLOBAL_ALPHABLEND 0xe1
+#define FBIOPUT_GRAPHIC_ALPHABLEND 0xe2
+
+/* color swapping */
+#define FBIOPUT_SWAP_GRAPHIC_RED_BLUE 0xe3
+#define FBIOPUT_SWAP_GRAPHIC_U_V 0xe4
+#define FBIOPUT_SWAP_GRAPHIC_Y_UV 0xe5
+#define FBIOPUT_SWAP_VIDEO_RED_BLUE 0xe6
+#define FBIOPUT_SWAP_VIDEO_U_V 0xe7
+#define FBIOPUT_SWAP_VIDEO_Y_UV 0xe8
+
+/* colorkey compatibility */
+#define FBIOGET_CHROMAKEYS 0xe9
+#define FBIOPUT_CHROMAKEYS 0xea
+
+#define DOVEFB_VMODE_RGB565 0x100
+#define DOVEFB_VMODE_BGR565 0x101
+#define DOVEFB_VMODE_RGB1555 0x102
+#define DOVEFB_VMODE_BGR1555 0x103
+#define DOVEFB_VMODE_RGB888PACK 0x104
+#define DOVEFB_VMODE_BGR888PACK 0x105
+#define DOVEFB_VMODE_RGB888UNPACK 0x106
+#define DOVEFB_VMODE_BGR888UNPACK 0x107
+#define DOVEFB_VMODE_RGBA888 0x108
+#define DOVEFB_VMODE_BGRA888 0x109
+
+#define DOVEFB_VMODE_YUV422PACKED 0x0
+#define DOVEFB_VMODE_YUV422PACKED_SWAPUV 0x1
+#define DOVEFB_VMODE_YUV422PACKED_SWAPYUorV 0x2
+#define DOVEFB_VMODE_YUV422PLANAR 0x3
+#define DOVEFB_VMODE_YUV422PLANAR_SWAPUV 0x4
+#define DOVEFB_VMODE_YUV422PLANAR_SWAPYUorV 0x5
+#define DOVEFB_VMODE_YUV420PLANAR 0x6
+#define DOVEFB_VMODE_YUV420PLANAR_SWAPUV 0x7
+#define DOVEFB_VMODE_YUV420PLANAR_SWAPYUorV 0x8
+
+#define DOVEFB_HWCMODE_1BITMODE 0x0
+#define DOVEFB_HWCMODE_2BITMODE 0x1
+
+#define DOVEFB_DISABLE_COLORKEY_MODE 0x0
+#define DOVEFB_ENABLE_Y_COLORKEY_MODE 0x1
+#define DOVEFB_ENABLE_U_COLORKEY_MODE 0x2
+#define DOVEFB_ENABLE_V_COLORKEY_MODE 0x4
+#define DOVEFB_ENABLE_RGB_COLORKEY_MODE 0x3
+#define DOVEFB_ENABLE_R_COLORKEY_MODE 0x5
+#define DOVEFB_ENABLE_G_COLORKEY_MODE 0x6
+#define DOVEFB_ENABLE_B_COLORKEY_MODE 0x7
+
+#define DOVEFB_VID_PATH_ALPHA 0x0
+#define DOVEFB_GRA_PATH_ALPHA 0x1
+#define DOVEFB_CONFIG_ALPHA 0x2
+
+#define DOVEFB_SYNC_COLORKEY_TO_CHROMA 1
+#define DOVEFB_SYNC_CHROMA_TO_COLORKEY 2
+
+/* Compatible to pxa168. */
+#define FB_IOCTL_SET_COLORKEYnALPHA _IO(FB_IOC_MAGIC, 13)
+#define FB_IOCTL_GET_COLORKEYnALPHA _IO(FB_IOC_MAGIC, 14)
+#define FB_VID_PATH_ALPHA 0x0
+#define FB_GRA_PATH_ALPHA 0x1
+#define FB_CONFIG_ALPHA 0x2
+
+#define FB_SYNC_COLORKEY_TO_CHROMA 1
+#define FB_SYNC_CHROMA_TO_COLORKEY 2
+
+#define DOVEFB_FB_NUM 2
+
+/* ---------------------------------------------- */
+/* Data Structure */
+/* ---------------------------------------------- */
+struct _sEdidInfo {
+ int connect; /* is monitor connected */
+ /* =0, monitor is disconnected.
+ =1, monitor is connected and EDID is ready.
+ =2, return fake EDID.
+ =3, monitor is connected, but EDID failed. */
+ int change; /* is edid data changed */
+ int extension; /* the number of extension edid block */
+ int interval; /* the interval to check edid */
+};
+/*
+ * The follow structures are used to pass data from
+ * user space into the kernel for the creation of
+ * overlay surfaces and setting the video mode.
+ */
+
+#define DOVEFBVideoMode signed int
+
+struct _sViewPortInfo {
+ unsigned short srcWidth; /* video source size */
+ unsigned short srcHeight;
+ unsigned short zoomXSize; /* size after zooming */
+ unsigned short zoomYSize;
+ unsigned short ycPitch;
+ unsigned short uvPitch;
+};
+
+struct _sViewPortOffset {
+ unsigned short xOffset; /* position on screen */
+ unsigned short yOffset;
+};
+
+struct _sVideoBufferAddr {
+ unsigned char frameID; /* which frame wants */
+ unsigned char *startAddr; /* new buffer (PA) */
+ unsigned char *inputData; /* input buf address (VA) */
+ unsigned int length; /* input data's length */
+};
+
+struct dovefb_chroma {
+ u_char mode;
+ u_char y_alpha;
+ u_char y;
+ u_char y1;
+ u_char y2;
+ u_char u_alpha;
+ u_char u;
+ u_char u1;
+ u_char u2;
+ u_char v_alpha;
+ u_char v;
+ u_char v1;
+ u_char v2;
+};
+
+struct _sColorKeyNAlpha {
+ unsigned int mode;
+ unsigned int alphapath;
+ unsigned int config;
+ unsigned int Y_ColorAlpha;
+ unsigned int U_ColorAlpha;
+ unsigned int V_ColorAlpha;
+};
+
+struct _sOvlySurface {
+ DOVEFBVideoMode videoMode;
+ struct _sViewPortInfo viewPortInfo;
+ struct _sViewPortOffset viewPortOffset;
+ struct _sVideoBufferAddr videoBufferAddr;
+};
+
+struct _sCursorConfig {
+ unsigned char enable; /* enable cursor or not */
+ unsigned char mode; /* 1bit or 2bit mode */
+ unsigned int color1; /* foreground color */
+ unsigned int color2; /* background color */
+ unsigned short xoffset;
+ unsigned short yoffset;
+ unsigned short width;
+ unsigned short height;
+ unsigned char *pBuffer; /* cursor data */
+};
+
+#define SHM_NORMAL 0x01
+#define SHM_VMETA 0x02
+#define SHM_SOFTWARE_MAP 0x04
+
+struct shm_private_info {
+ unsigned int method;
+ unsigned int fbid;
+ unsigned int format;
+ unsigned int width;
+ unsigned int height;
+ unsigned long fb_pa;
+};
+
+/* MAX bytes per yuv pixel. */
+#define MAX_YUV_PIXEL 2
+
+/* Dumb interface */
+#define DOVEFB_PINS_DUMB_24 0
+#define DOVEFB_PINS_DUMB_18_SPI 1
+#define DOVEFB_PINS_DUMB_18_GPIO 2
+#define DOVEFB_PINS_DUMB_16_SPI 3
+#define DOVEFB_PINS_DUMB_16_GPIO 4
+#define DOVEFB_PINS_DUMB_12_SPI_GPIO 5
+#define DOVEFB_PINS_SMART_18_SPI 6
+#define DOVEFB_PINS_SMART_16_SPI 7
+#define DOVEFB_PINS_SMART_8_SPI_GPIO 8
+
+/* Dumb interface pin allocation */
+#define DOVEFB_DUMB_PANEL_RGB565 0
+#define DOVEFB_DUMB_PANEL_RGB565_UPPER 1
+#define DOVEFB_DUMB_PANEL_RGB666 2
+#define DOVEFB_DUMB_PANEL_RGB666_UPPER 3
+#define DOVEFB_DUMB_PANEL_RGB444 4
+#define DOVEFB_DUMB_PANEL_RGB444_UPPER 5
+#define DOVEFB_DUMB_PANEL_RGB888 6
+
+/* Max fb buffer. 2048x2048-32bits */
+#define DEFAULT_FB_SIZE (2048 * 2048 * 4)
+
+/*
+ * Buffer pixel format
+ * bit0 is for rb swap.
+ * bit12 is for Y UorV swap
+ */
+/*
+#define PIX_FMT_RGB565 0
+#define PIX_FMT_BGR565 1
+#define PIX_FMT_RGB1555 2
+#define PIX_FMT_BGR1555 3
+#define PIX_FMT_RGB888PACK 4
+#define PIX_FMT_BGR888PACK 5
+#define PIX_FMT_RGB888UNPACK 6
+#define PIX_FMT_BGR888UNPACK 7
+#define PIX_FMT_RGBA888 8
+#define PIX_FMT_BGRA888 9
+#define PIX_FMT_YUV422PACK 10
+#define PIX_FMT_YVU422PACK 11
+#define PIX_FMT_YUV422PLANAR 12
+#define PIX_FMT_YVU422PLANAR 13
+#define PIX_FMT_YUV420PLANAR 14
+#define PIX_FMT_YVU420PLANAR 15
+#define PIX_FMT_PSEUDOCOLOR 20
+#define PIX_FMT_UYVY422PACK (0x1000|PIX_FMT_YUV422PACK)
+*/
+
+#ifdef __KERNEL__
+#include <linux/interrupt.h>
+
+enum dovefb_type {
+ DOVEFB_GFX_PLANE,
+ DOVEFB_OVLY_PLANE
+};
+
+#define MRVL_AXI_CLK 0
+#define MRVL_EXT_CLK0 1
+#define MRVL_PLL_CLK 2
+#define MRVL_EXT_CLK1 3
+
+struct dovefb_layer_info {
+ struct device *dev;
+ enum dovefb_type type;
+ struct dovefb_info *info;
+ struct fb_info *fb_info;
+
+ void *reg_base;
+
+ unsigned long new_addr;
+ dma_addr_t fb_start_dma;
+ void *fb_start;
+ int fb_size;
+ atomic_t w_intr;
+ wait_queue_head_t w_intr_wq;
+ struct mutex access_ok;
+ struct _sOvlySurface surface;
+ struct _sColorKeyNAlpha ckey_alpha;
+ /* Following used to bypass vide frame queuing */
+ unsigned int vid_ovly_phys_addr_y;
+ unsigned int vid_ovly_phys_addr_u;
+ unsigned int vid_ovly_phys_addr_v;
+
+ unsigned char *hwc_buf;
+ unsigned int pseudo_palette[16];
+ struct tasklet_struct tasklet;
+ char *mode_option;
+
+ int ddc_polling_disable;
+ struct timer_list get_edid_timer;
+ unsigned char* raw_edid;
+ struct _sEdidInfo edid_info;
+ struct work_struct work_queue;
+
+ int pix_fmt;
+ unsigned is_blanked:1;
+ unsigned cursor_enabled:1;
+ unsigned cursor_cfg:1;
+ unsigned active:1;
+ unsigned enabled:1;
+ unsigned checkbuf_timer_exist:1;
+
+ /*
+ * 0: DMA mem is from DMA region.
+ * 1: DMA mem is from normal region.
+ */
+ unsigned mem_status:1;
+
+ /*
+ * current frame id for mapping to user.
+ */
+ int cur_fbid;
+ int src_mode;
+
+ unsigned int reserved;
+};
+
+/*
+ * Dove LCD controller private state.
+ */
+struct dovefb_info {
+ struct device *dev;
+ int id;
+
+ void *reg_base;
+ struct dovefb_layer_info *gfx_plane;
+ struct dovefb_layer_info *vid_plane;
+
+ struct fb_videomode dft_vmode;
+ struct fb_videomode out_vmode;
+ int fixed_output;
+
+ char *mode_option;
+ struct clk *clk;
+ int clk_src;
+ int io_pin_allocation;
+
+ int pix_fmt;
+ unsigned edid:1;
+ unsigned panel_rbswap:1;
+ unsigned edid_en:1;
+
+ /* Hardware cursor related registers */
+ unsigned int LCD_SPU_HWC_HPXL_VLN_saved_value;
+ unsigned int LCD_SPU_ALPHA_COLOR1_saved_value;
+ unsigned int LCD_SPU_ALPHA_COLOR2_saved_value;
+
+ /* Colorkey related registers */
+ unsigned int LCD_SPU_COLORKEY_Y_saved_value;
+ unsigned int LCD_SPU_COLORKEY_U_saved_value;
+ unsigned int LCD_SPU_COLORKEY_V_saved_value;
+ unsigned int LCD_SPU_DMA_CTRL1_saved_value;
+ unsigned int LCD_SPU_ADV_REG_saved_value;
+};
+
+/*
+ * Dove fb machine information
+ */
+struct dovefb_mach_info {
+ char id_gfx[16];
+ char id_ovly[16];
+ int clk_src;
+ int accurate_clk;
+ char *clk_name;
+ int num_modes;
+ struct fb_videomode *modes;
+
+ /*
+ * Pix_fmt
+ */
+ unsigned pix_fmt;
+
+ /*
+ * I/O pin allocation.
+ */
+ unsigned io_pin_allocation:4;
+
+ /*
+ * auto poll EDID data periodically
+ */
+ unsigned ddc_polling_disable:1;
+
+ /*
+ * Monitor sense
+ */
+ int (*mon_sense)(int *connect_status);
+
+ /*
+ * I2C bus and address to read DDC data through. -1 not available
+ */
+ int ddc_i2c_adapter;
+ int ddc_i2c_address;
+
+ /*
+ * secondary i2c pair for two display on same LCD.
+ */
+ int secondary_ddc_mode;
+ int ddc_i2c_adapter_2nd;
+ int ddc_i2c_address_2nd;
+
+ /*
+ * Dumb panel -- assignment of R/G/B component info to the 24
+ * available external data lanes.
+ */
+ unsigned panel_rgb_type:4;
+ unsigned panel_rgb_reverse_lanes:1;
+
+ /*
+ * Dumb panel -- GPIO output data.
+ */
+ unsigned gpio_output_mask:8;
+ unsigned gpio_output_data:8;
+
+ /*
+ * Dumb panel -- configurable output signal polarity.
+ */
+ unsigned invert_composite_blank:1;
+ unsigned invert_pix_val_ena:1;
+ unsigned invert_pixclock:1;
+ unsigned invert_vsync:1;
+ unsigned invert_hsync:1;
+ unsigned panel_rbswap:1;
+ unsigned active:1;
+ unsigned enable_lcd0:1;
+};
+
+struct dovebl_platform_data;
+
+int clcd_platform_init(struct dovefb_mach_info *lcd0_dmi_data,
+ struct dovefb_mach_info *lcd0_vid_dmi_data,
+ struct dovefb_mach_info *lcd1_dmi_data,
+ struct dovefb_mach_info *lcd1_vid_dmi_data,
+ struct dovebl_platform_data *backlight_data);
+
+
+#endif /* _KERNEL_ */
+#endif /* _DOVEFB_H_ */
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp
index 5cdc226..65f03be 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp
@@ -33,6 +33,7 @@
#endif
#include "Video/DVDVideoCodecFFmpeg.h"
#include "Video/DVDVideoCodecOpenMax.h"
+#include "Video/DVDVideoCodecVMETA.h"
#include "Video/DVDVideoCodecLibMpeg2.h"
#if defined(HAVE_LIBCRYSTALHD)
#include "Video/DVDVideoCodecCrystalHD.h"
@@ -162,8 +163,17 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne
#elif defined(_LINUX) && !defined(__APPLE__)
hwSupport += "VAAPI:no ";
#endif
+#if defined(HAS_MARVELL_DOVE)
+ hwSupport += "VMETA:yes ";
+#else
+ hwSupport += "VMETA:no ";
+#endif
CLog::Log(LOGDEBUG, "CDVDFactoryCodec: compiled in hardware support: %s", hwSupport.c_str());
+#if defined(HAS_MARVELL_DOVE)
+ CLog::Log(LOGINFO, "Trying VMETA Video Decoder...");
+ if ( (pCodec = OpenCodec(new CDVDVideoCodecVMETA(), hint, options)) ) return pCodec;
+#endif
// dvd's have weird still-frames in it, which is not fully supported in ffmpeg
if(hint.stills && (hint.codec == CODEC_ID_MPEG2VIDEO || hint.codec == CODEC_ID_MPEG1VIDEO))
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h
index e4bd9c9..59de190 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h
@@ -42,7 +42,6 @@ struct OpenMaxVideoBuffer;
class CDVDVideoCodecVideoToolBox;
struct __CVBuffer;
#endif
-
// should be entirely filled by all codecs
struct DVDVideoPicture
{
@@ -76,6 +75,11 @@ struct DVDVideoPicture
};
#endif
};
+#ifdef HAS_MARVELL_DOVE
+ struct {
+ void *vmeta;
+ };
+#endif
unsigned int iFlags;
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVMETA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVMETA.cpp
new file mode 100644
index 0000000..567c0d8
--- /dev/null
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVMETA.cpp
@@ -0,0 +1,680 @@
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#if (defined HAVE_CONFIG_H) && (!defined WIN32)
+ #include "config.h"
+#elif defined(_WIN32)
+#include "system.h"
+#endif
+
+#if defined(HAS_MARVELL_DOVE)
+#include "DVDStreamInfo.h"
+#include "DVDVideoCodecVMETA.h"
+#include "DynamicDll.h"
+
+#include "utils/log.h"
+#include "linux/XMemUtils.h"
+#include "DVDClock.h"
+
+#include <sys/time.h>
+#include <inttypes.h>
+
+#ifdef CLASSNAME
+#undef CLASSNAME
+#endif
+#define CLASSNAME "CDVDVideoCodecVMETA"
+
+#include "utils/BitstreamConverter.h"
+
+#define STREAM_VDECBUF_SIZE (2048*1024) //must equal to or greater than 64k and multiple of 128, because of vMeta limitted
+#define STREAM_VDECBUF_NUM 5
+#define STREAM_PICBUF_NUM 16
+
+CDVDVideoCodecVMETA::CDVDVideoCodecVMETA()
+{
+ m_is_open = false;
+ m_extradata = NULL;
+ m_extrasize = 0;
+ m_converter = NULL;
+ m_video_convert = false;
+ m_video_codec_name = "";
+ m_Frames = 0;
+
+ m_DllMiscGen = new DllLibMiscGen();
+ m_DllVMETA = new DllLibVMETA();
+
+ m_pDecState = NULL;
+ m_pCbTable = NULL;
+}
+
+CDVDVideoCodecVMETA::~CDVDVideoCodecVMETA()
+{
+ if (m_is_open)
+ Dispose();
+}
+
+bool CDVDVideoCodecVMETA::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options)
+{
+ if(!m_DllVMETA->Load() || !m_DllMiscGen->Load())
+ return false;
+
+ bool bSendCodecConfig = false;
+
+ m_decoded_width = hints.width;
+ m_decoded_height = hints.height;
+ m_picture_width = m_decoded_width;
+ m_picture_height = m_decoded_height;
+
+ if(!m_decoded_width || !m_decoded_height)
+ return false;
+
+ m_converter = new CBitstreamConverter();
+ m_video_convert = m_converter->Open(hints.codec, (uint8_t *)hints.extradata, hints.extrasize, true);
+
+ if(m_video_convert)
+ {
+ if(m_converter->GetExtraData() != NULL && m_converter->GetExtraSize() > 0)
+ {
+ m_extrasize = m_converter->GetExtraSize();
+ m_extradata = (uint8_t *)malloc(m_extrasize);
+ memcpy(m_extradata, m_converter->GetExtraData(), m_converter->GetExtraSize());
+ }
+ }
+ else
+ {
+ if(hints.extrasize > 0 && hints.extradata != NULL)
+ {
+ m_extrasize = hints.extrasize;
+ m_extradata = (uint8_t *)malloc(m_extrasize);
+ memcpy(m_extradata, hints.extradata, hints.extrasize);
+ }
+ }
+
+ memset(&m_VDecParSet, 0, sizeof(IppVmetaDecParSet));
+ memset(&m_VDecInfo, 0, sizeof(IppVmetaDecInfo));
+
+ switch (hints.codec)
+ {
+ case CODEC_ID_H264:
+ {
+ switch(hints.profile)
+ {
+ case FF_PROFILE_H264_BASELINE:
+ m_video_codec_name = "vmeta-h264";
+ break;
+ case FF_PROFILE_H264_MAIN:
+ m_video_codec_name = "vmeta-h264";
+ break;
+ case FF_PROFILE_H264_HIGH:
+ m_video_codec_name = "vmeta-h264";
+ break;
+ case FF_PROFILE_UNKNOWN:
+ m_video_codec_name = "vmeta-h264";
+ break;
+ default:
+ m_video_codec_name = "vmeta-h264";
+ break;
+ }
+
+ m_VDecParSet.strm_fmt = IPP_VIDEO_STRM_FMT_H264;
+ }
+ break;
+ /*
+ case CODEC_ID_MPEG4:
+ m_VDecParSet.strm_fmt = IPP_VIDEO_STRM_FMT_MPG4;
+ m_video_codec_name = "vmeta-mpeg4";
+ bSendCodecConfig = true;
+ break;
+ */
+ case CODEC_ID_MPEG2VIDEO:
+ m_VDecParSet.strm_fmt = IPP_VIDEO_STRM_FMT_MPG2;
+ m_video_codec_name = "vmeta-mpeg2";
+ bSendCodecConfig = true;
+ break;
+ /*
+ case CODEC_ID_H263:
+ m_VDecParSet.strm_fmt = IPP_VIDEO_STRM_FMT_H263;
+ m_video_codec_name = "vmeta-h263";
+ bSendCodecConfig = true;
+ break;
+ */
+ case CODEC_ID_VC1:
+ m_VDecParSet.strm_fmt = IPP_VIDEO_STRM_FMT_VC1;
+ m_video_codec_name = "vmeta-vc1";
+ bSendCodecConfig = true;
+ break;
+ default:
+ CLog::Log(LOGDEBUG, "%s::%s CodecID 0x%08x not supported by VMETA decoder\n", CLASSNAME, __func__, hints.codec);
+ return false;
+ break;
+ }
+
+ m_VDecParSet.opt_fmt = IPP_YCbCr422I;
+
+ IppCodecStatus ret;
+
+ if(m_DllMiscGen->miscInitGeneralCallbackTable(&m_pCbTable) != 0)
+ {
+ CLog::Log(LOGERROR, "%s::%s Error : miscInitGeneralCallbackTable\n", CLASSNAME, __func__);
+ Dispose();
+ return false;
+ }
+
+ ret = m_DllVMETA->DecoderInitAlloc_Vmeta(&m_VDecParSet, m_pCbTable, &m_pDecState);
+ if(ret != IPP_STATUS_NOERR)
+ {
+ CLog::Log(LOGERROR, "%s::%s Error : DecoderInitAlloc_Vmeta\n", CLASSNAME, __func__);
+ Dispose();
+ return false;
+ }
+
+ for (size_t i = 0; i < STREAM_VDECBUF_NUM; i++)
+ {
+ IppVmetaBitstream *pStream = NULL;
+ pStream = (IppVmetaBitstream *)malloc(sizeof(IppVmetaBitstream));
+ memset(pStream, 0, sizeof(IppVmetaBitstream));
+
+ /*
+ pStream->nBufSize = STREAM_VDECBUF_SIZE;
+ pStream->pBuf = (Ipp8u*)m_DllVMETA->vdec_os_api_dma_alloc(pStream->nBufSize, VMETA_STRM_BUF_ALIGN, &pStream->nPhyAddr);
+ if(pStream->pBuf == NULL)
+ {
+ Dispose();
+ return false;
+ }
+ */
+
+ m_input_buffers.push_back(pStream);
+ m_input_available.push(pStream);
+ }
+
+ for (size_t i = 0; i < STREAM_PICBUF_NUM; i++)
+ {
+ IppVmetaPicture *pPicture = NULL;
+ pPicture = (IppVmetaPicture *)malloc(sizeof(IppVmetaPicture));
+ memset(pPicture, 0, sizeof(IppVmetaPicture));
+ pPicture->pUsrData0 = (void *)i;
+
+ m_output_buffers.push_back(pPicture);
+ m_output_available.push(pPicture);
+ }
+
+ m_Frames = 0;
+ m_is_open = true;
+
+ if(bSendCodecConfig)
+ SendCodecConfig();
+
+ CLog::Log(LOGDEBUG, "%s::%s - VMETA Decoder opened with codec : %s [%dx%d]", CLASSNAME, __func__,
+ m_video_codec_name.c_str(), m_decoded_width, m_decoded_height);
+
+ return true;
+}
+
+void CDVDVideoCodecVMETA::Dispose()
+{
+ m_is_open = false;
+
+ if(m_extradata)
+ free(m_extradata);
+ m_extradata = NULL;
+ m_extrasize = 0;
+
+ if(m_converter)
+ delete m_converter;
+ m_converter = NULL;
+ m_video_convert = false;
+ m_video_codec_name = "";
+
+ if(m_pDecState)
+ {
+ m_DllVMETA->DecodeSendCmd_Vmeta(IPPVC_STOP_DECODE_STREAM, NULL, NULL, m_pDecState);
+
+ Reset();
+
+ m_DllVMETA->DecoderFree_Vmeta(&m_pDecState);
+ }
+ m_pDecState = NULL;
+
+ if(m_pCbTable)
+ {
+ m_DllMiscGen->miscFreeGeneralCallbackTable(&m_pCbTable);
+ }
+ m_pCbTable = NULL;
+
+ for (size_t i = 0; i < m_input_buffers.size(); i++)
+ {
+ IppVmetaBitstream *pStream = m_input_buffers[i];
+ if(pStream->pBuf)
+ m_DllVMETA->vdec_os_api_dma_free(pStream->pBuf);
+ free(m_input_buffers[i]);
+ }
+
+ m_input_buffers.clear();
+
+ while(!m_input_available.empty())
+ m_input_available.pop();
+
+ for (size_t i = 0; i < m_output_buffers.size(); i++)
+ {
+ IppVmetaPicture *pPicture = m_output_buffers[i];
+ if(pPicture->pBuf)
+ m_DllVMETA->vdec_os_api_dma_free(pPicture->pBuf);
+ free(m_output_buffers[i]);
+ }
+
+ m_output_buffers.clear();
+
+ while(!m_output_available.empty())
+ m_output_available.pop();
+
+ m_Frames = 0;
+
+ m_DllVMETA->Unload();
+ m_DllMiscGen->Unload();
+
+ delete m_DllMiscGen;
+ delete m_DllVMETA;
+}
+
+void CDVDVideoCodecVMETA::SetDropState(bool bDrop)
+{
+ m_drop_state = bDrop;
+}
+
+IppCodecStatus CDVDVideoCodecVMETA::SendCodecConfig()
+{
+ IppCodecStatus retCodec;
+
+ if(m_extradata == NULL || m_extrasize == 0 || m_pDecState == NULL || m_input_available.empty())
+ return IPP_STATUS_ERR;
+
+ IppVmetaBitstream *pStream = m_input_available.front();
+
+ if(pStream->pBuf)
+ m_DllVMETA->vdec_os_api_dma_free(pStream->pBuf);
+
+ pStream->nBufSize = ((m_extrasize + 65*1024) + 127) & ~127;
+ pStream->nDataLen = m_extrasize;
+ pStream->pBuf = (Ipp8u*)m_DllVMETA->vdec_os_api_dma_alloc(pStream->nBufSize, VMETA_STRM_BUF_ALIGN, &pStream->nPhyAddr);
+ pStream->nFlag = IPP_VMETA_STRM_BUF_END_OF_UNIT;
+
+ if(!pStream->pBuf)
+ {
+ printf("%s::%s Error : Allocate streambuffer\n", CLASSNAME, __func__);
+ return IPP_STATUS_ERR;
+ }
+
+ memcpy(pStream->pBuf, m_extradata, m_extrasize);
+
+ retCodec = m_DllVMETA->DecoderPushBuffer_Vmeta(IPP_VMETA_BUF_TYPE_STRM, (void *)pStream, m_pDecState);
+
+ if(retCodec != IPP_STATUS_NOERR)
+ {
+ printf("%s::%s Error : Push streambuffer\n", CLASSNAME, __func__);
+ return IPP_STATUS_ERR;
+ }
+
+ m_input_available.pop();
+
+ return IPP_STATUS_NOERR;
+}
+
+IppCodecStatus CDVDVideoCodecVMETA::DecodeInternal(uint8_t *pData, unsigned int *iSize, double dts, double pts)
+{
+ void *pPopTmp;
+ IppVmetaBitstream *pStream;
+ IppVmetaPicture *pPicture;
+ IppCodecStatus retCodec;
+
+ retCodec = m_DllVMETA->DecodeFrame_Vmeta(&m_VDecInfo, m_pDecState);
+
+ //printf("m_input_available.size() %d m_output_available.size() %d m_output_ready.size() %d\n",
+ // m_input_available.size(), m_output_available.size(), m_output_ready.size());
+
+ switch(retCodec)
+ {
+ case IPP_STATUS_WAIT_FOR_EVENT:
+ //printf("IPP_STATUS_WAIT_FOR_EVENT\n");
+ break;
+ case IPP_STATUS_NEED_INPUT:
+ if(m_input_available.empty())
+ CLog::Log(LOGDEBUG, "IPP_STATUS_NEED_INPUT no free input buffers\n");
+ if(!m_input_available.empty() && *iSize != 0)
+ {
+ //printf("IPP_STATUS_NEED_INPUT\n");
+ IppVmetaBitstream *pStream = m_input_available.front();
+
+ if(pStream->pBuf)
+ m_DllVMETA->vdec_os_api_dma_free(pStream->pBuf);
+
+ // make sure we allocate enough space for padding. not sure how many the decoder needs. 65*1024 seems fair enough.
+ pStream->nBufSize = ((*iSize + 65*1024) + 127) & ~127;
+ pStream->pBuf = (Ipp8u*)m_DllVMETA->vdec_os_api_dma_alloc(pStream->nBufSize, VMETA_STRM_BUF_ALIGN, &pStream->nPhyAddr);
+ if(!pStream->pBuf)
+ {
+ CLog::Log(LOGERROR, "%s::%s Error : Allocate streambuffer\n", CLASSNAME, __func__);
+ return IPP_STATUS_ERR;
+ }
+
+ // the vmeta decoder needs a padding of 0x88 at the end of a frame
+ pStream->nDataLen = *iSize;
+ pStream->nFlag = IPP_VMETA_STRM_BUF_END_OF_UNIT;
+ memset(pStream->pBuf, 0x88, pStream->nBufSize);
+ memcpy(pStream->pBuf, pData, *iSize);
+
+ retCodec = m_DllVMETA->DecoderPushBuffer_Vmeta(IPP_VMETA_BUF_TYPE_STRM, (void *)pStream, m_pDecState);
+
+ if(retCodec != IPP_STATUS_NOERR)
+ {
+ CLog::Log(LOGERROR, "%s::%s Error : Push streambuffer\n", CLASSNAME, __func__);
+ return IPP_STATUS_ERR;
+ }
+
+ m_input_available.pop();
+ *iSize = 0;
+ }
+ break;
+ case IPP_STATUS_END_OF_STREAM:
+ //printf("IPP_STATUS_END_OF_STREAM\n");
+ break;
+ case IPP_STATUS_NEED_OUTPUT_BUF:
+ if(m_output_available.empty())
+ CLog::Log(LOGDEBUG, "IPP_STATUS_FRAME_COMPLETE no free pictures buffers\n");
+ //printf("IPP_STATUS_NEED_OUTPUT_BUF\n");
+ if(!m_output_available.empty())
+ {
+ IppVmetaPicture *pPicture = m_output_available.front();
+ m_output_available.pop();
+ if(!pPicture)
+ return IPP_STATUS_ERR;
+
+ if(m_VDecInfo.seq_info.dis_buf_size > pPicture->nBufSize)
+ {
+ if(pPicture->pBuf)
+ m_DllVMETA->vdec_os_api_dma_free(pPicture->pBuf);
+
+ pPicture->pBuf = NULL;
+ pPicture->pBuf = (Ipp8u*)m_DllVMETA->vdec_os_api_dma_alloc(m_VDecInfo.seq_info.dis_buf_size, VMETA_DIS_BUF_ALIGN, &(pPicture->nPhyAddr));
+ pPicture->nBufSize = m_VDecInfo.seq_info.dis_buf_size;
+ //printf("vdec_os_api_dma_alloc pPicture->pBuf 0x%08x nr %d\n", (unsigned int)pPicture->pBuf, (int)pPicture->pUsrData0);
+ }
+ if(pPicture->pBuf == NULL)
+ {
+ CLog::Log(LOGERROR, "%s::%s Error : Allocate picture\n", CLASSNAME, __func__);
+ m_output_available.push(pPicture);
+ return IPP_STATUS_ERR;
+ }
+ m_DllVMETA->DecoderPushBuffer_Vmeta(IPP_VMETA_BUF_TYPE_PIC, (void*)pPicture, m_pDecState);
+ }
+ break;
+ case IPP_STATUS_RETURN_INPUT_BUF:
+ //printf("IPP_STATUS_RETURN_INPUT_BUF\n");
+ for(;;)
+ {
+ m_DllVMETA->DecoderPopBuffer_Vmeta(IPP_VMETA_BUF_TYPE_STRM, &pPopTmp, m_pDecState);
+ pStream = (IppVmetaBitstream*)pPopTmp;
+ if(pStream == NULL)
+ break;
+ m_input_available.push(pStream);
+ }
+ break;
+ case IPP_STATUS_FRAME_COMPLETE:
+ for(;;)
+ {
+ m_DllVMETA->DecoderPopBuffer_Vmeta(IPP_VMETA_BUF_TYPE_STRM, &pPopTmp, m_pDecState);
+ pStream = (IppVmetaBitstream*)pPopTmp;
+ if(pStream == NULL)
+ break;
+ m_input_available.push(pStream);
+ }
+ //printf("IPP_STATUS_FRAME_COMPLETE\n");
+ {
+ // The gstreamer plugins says this is needed for DOVE
+ IppCodecStatus suspendRet;
+ if(m_DllVMETA->vdec_os_api_suspend_check())
+ {
+ suspendRet = m_DllVMETA->DecodeSendCmd_Vmeta(IPPVC_PAUSE, NULL, NULL, m_pDecState);
+ if(suspendRet == IPP_STATUS_NOERR)
+ {
+ m_DllVMETA->vdec_os_api_suspend_ready();
+ suspendRet = m_DllVMETA->DecodeSendCmd_Vmeta(IPPVC_RESUME, NULL, NULL, m_pDecState);
+ if(suspendRet != IPP_STATUS_NOERR)
+ {
+ CLog::Log(LOGERROR, "%s::%s resume failed\n", CLASSNAME, __func__);
+ }
+ }
+ else
+ {
+ CLog::Log(LOGERROR, "%s::%s pause failed\n", CLASSNAME, __func__);
+ }
+ }
+
+ m_DllVMETA->DecoderPopBuffer_Vmeta(IPP_VMETA_BUF_TYPE_PIC, &pPopTmp, m_pDecState);
+ pPicture = (IppVmetaPicture *)pPopTmp;
+ if(pPicture)
+ {
+ pPicture->pUsrData1 = (void*)m_Frames;
+ m_output_ready.push(pPicture);
+
+ m_Frames++;
+ }
+ }
+ break;
+ case IPP_STATUS_NEW_VIDEO_SEQ:
+ if(m_VDecInfo.seq_info.picROI.width != 0 && m_VDecInfo.seq_info.picROI.height != 0)
+ {
+ m_picture_width = m_VDecInfo.seq_info.picROI.width;
+ m_picture_height = m_VDecInfo.seq_info.picROI.height;
+ CLog::Log(LOGDEBUG, "%s::%s New sequence picture dimension [%dx%d]\n",
+ CLASSNAME, __func__, m_picture_width, m_picture_height);
+ }
+ for(;;)
+ {
+ m_DllVMETA->DecoderPopBuffer_Vmeta(IPP_VMETA_BUF_TYPE_PIC, &pPopTmp, m_pDecState);
+ pPicture = (IppVmetaPicture *)pPopTmp;
+ if(pPicture == NULL)
+ break;
+ m_output_available.push(pPicture);
+ }
+ break;
+ default:
+ return IPP_STATUS_ERR;
+ break;
+ }
+
+ return retCodec;
+}
+
+int CDVDVideoCodecVMETA::Decode(uint8_t *pData, int iSize, double dts, double pts)
+{
+ IppCodecStatus retCodec;
+
+ if (pData || iSize > 0)
+ {
+ unsigned int demuxer_bytes = (unsigned int)iSize;
+ uint8_t *demuxer_content = pData;
+
+ if(m_video_convert)
+ {
+ m_converter->Convert(pData, iSize);
+ demuxer_bytes = m_converter->GetConvertSize();
+ demuxer_content = m_converter->GetConvertBuffer();
+ if(!demuxer_bytes && demuxer_bytes < 1)
+ {
+ return VC_BUFFER;
+ }
+ }
+
+ m_pts_queue.push(pts);
+
+ double start = CDVDClock::GetAbsoluteClock();
+ for(;;)
+ {
+ retCodec = DecodeInternal(demuxer_content, &demuxer_bytes, dts, pts);
+ if(retCodec == IPP_STATUS_FRAME_COMPLETE || retCodec == IPP_STATUS_NEED_INPUT || retCodec == IPP_STATUS_ERR)
+ break;
+
+ // decoding timeout.
+ // TODO: should we store the decoding data and try it on the next decode again ?
+ if((CDVDClock::GetAbsoluteClock() - start) > (double)DVD_MSEC_TO_TIME(500))
+ {
+ CLog::Log(LOGERROR, "%s::%s decoder timeout\n", CLASSNAME, __func__);
+ break;
+ }
+ }
+ }
+
+ int ret = VC_BUFFER;
+
+ if(m_output_ready.size())
+ ret |= VC_PICTURE;
+
+ return ret;
+}
+
+bool CDVDVideoCodecVMETA::GetPicture(DVDVideoPicture *pDvdVideoPicture)
+{
+ // clone the video picture buffer settings.
+ bool bRet = false;
+
+ if(!m_output_ready.empty())
+ {
+ IppVmetaPicture *pPicture = m_output_ready.front();
+ m_output_ready.pop();
+
+ if(!pPicture)
+ {
+ CLog::Log(LOGERROR, "%s::%s Error : Picture NULL\n", CLASSNAME, __func__);
+ return false;
+ }
+
+ pDvdVideoPicture->vmeta = pPicture;
+
+ pDvdVideoPicture->dts = DVD_NOPTS_VALUE;
+ pDvdVideoPicture->pts = DVD_NOPTS_VALUE;
+ pDvdVideoPicture->format = DVDVideoPicture::FMT_UYVY;
+
+ pDvdVideoPicture->iDisplayWidth = m_decoded_width;
+ pDvdVideoPicture->iDisplayHeight = m_decoded_height;
+ pDvdVideoPicture->iWidth = m_picture_width;
+ pDvdVideoPicture->iHeight = m_picture_height;
+
+ unsigned char *pDisplayStart = ((Ipp8u*)pPicture->pic.ppPicPlane[0]) + (pPicture->pic.picROI.y)*(pPicture->pic.picPlaneStep[0]) + ((pPicture->pic.picROI.x)<<1);
+
+ pDvdVideoPicture->data[0] = pDisplayStart;
+ pDvdVideoPicture->iLineSize[0] = ALIGN (m_picture_width, 4);
+ pDvdVideoPicture->data[1] = pDvdVideoPicture->data[0] + pDvdVideoPicture->iLineSize[0] * ALIGN (m_picture_width, 2);
+ pDvdVideoPicture->iLineSize[1] = ALIGN (m_picture_height, 8) / 2;
+ pDvdVideoPicture->data[2] = (BYTE *)pDisplayStart;
+ pDvdVideoPicture->iLineSize[2] = pDvdVideoPicture->iLineSize[1];
+ if (!m_pts_queue.empty())
+ {
+ //pDvdVideoPicture->pts = m_pts_queue.front();
+ m_pts_queue.pop();
+ }
+
+ /*
+ printf("%d : pic width [%dx%d] [%d:%d:%d] [0x%08x:0x%08x:0x%08x] %f\n",
+ (unsigned int)pPicture->pUsrData1 , pDvdVideoPicture->iDisplayWidth, pDvdVideoPicture->iDisplayHeight,
+ pDvdVideoPicture->iLineSize[0], pDvdVideoPicture->iLineSize[1], pDvdVideoPicture->iLineSize[2],
+ (unsigned int)pDvdVideoPicture->data[0], (unsigned int)pDvdVideoPicture->data[1],
+ (unsigned int)pDvdVideoPicture->data[2], (double)pDvdVideoPicture->pts / (double)DVD_TIME_BASE);
+ */
+
+#undef ALIGN
+
+ pDvdVideoPicture->iFlags = DVP_FLAG_ALLOCATED;
+ pDvdVideoPicture->iFlags |= m_drop_state ? DVP_FLAG_DROPPED : 0;
+ bRet = true;
+ }
+ /*
+ else
+ {
+ pDvdVideoPicture->iFlags = DVP_FLAG_DROPPED;
+ bRet = false;
+ }
+ */
+
+ return bRet;
+}
+
+bool CDVDVideoCodecVMETA::ClearPicture(DVDVideoPicture* pDvdVideoPicture)
+{
+ // release any previous retained image buffer ref that
+ // has not been passed up to renderer (ie. dropped frames, etc).
+ if(pDvdVideoPicture->vmeta)
+ {
+ IppVmetaPicture *pPicture = (IppVmetaPicture *)pDvdVideoPicture->vmeta;
+ //printf("CDVDVideoCodecVMETA::ClearPicture 0x%08x 0x%08x 0x%08x\n", pDvdVideoPicture->vmeta, pPicture, pPicture->pBuf);
+ m_output_available.push(pPicture);
+ pDvdVideoPicture->vmeta = NULL;
+ }
+
+ memset(pDvdVideoPicture, 0, sizeof(DVDVideoPicture));
+ return true;
+}
+
+void CDVDVideoCodecVMETA::Reset(void)
+{
+ if(!m_is_open)
+ return;
+
+ IppVmetaBitstream *pStream = NULL;
+ IppVmetaPicture *pPicture = NULL;
+
+ while(!m_output_ready.empty())
+ {
+ pPicture = m_output_ready.front();
+ m_output_ready.pop();
+ m_output_available.push(pPicture);
+ }
+
+ pPicture = NULL;
+
+ for(;;) {
+ m_DllVMETA->DecoderPopBuffer_Vmeta(IPP_VMETA_BUF_TYPE_STRM, (void**)&pStream, m_pDecState);
+ if(pStream != NULL)
+ {
+ m_input_available.push(pStream);
+ }
+ else
+ {
+ break;
+ }
+ }
+ for(;;) {
+ m_DllVMETA->DecoderPopBuffer_Vmeta(IPP_VMETA_BUF_TYPE_PIC, (void**)&pPicture, m_pDecState);
+ if(pPicture != NULL)
+ {
+ m_output_available.push(pPicture);
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ while (!m_pts_queue.empty())
+ m_pts_queue.pop();
+
+}
+#endif
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVMETA.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVMETA.h
new file mode 100644
index 0000000..cf7d68d
--- /dev/null
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVMETA.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#if defined(HAS_MARVELL_DOVE)
+#include "DVDVideoCodec.h"
+
+#include "DllVMETA.h"
+
+#include <queue>
+#include <vector>
+
+#define ALIGN(x, n) (((x) + (n) - 1) & (~((n) - 1)))
+
+class CBitstreamConverter;
+class DllLibMiscGen;
+class DllLibVMETA;
+
+class CDVDVideoCodecVMETA : public CDVDVideoCodec
+{
+public:
+ CDVDVideoCodecVMETA();
+ ~CDVDVideoCodecVMETA();
+
+ // Required overrides
+ bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options);
+ void Dispose(void);
+ IppCodecStatus SendCodecConfig();
+ IppCodecStatus DecodeInternal(uint8_t *pData, unsigned int *iSize, double dts, double pts);
+ int DecodeInternal(uint8_t *demuxer_content, int demuxer_bytes);
+ int Decode(uint8_t *pData, int iSize, double dts, double pts);
+ void Reset(void);
+ void SetDropState(bool bDrop);
+ bool GetPicture(DVDVideoPicture *pDvdVideoPicture);
+ bool ClearPicture(DVDVideoPicture* pDvdVideoPicture);
+ int GetFrameCount() { return m_Frames; };
+ const char* GetName() { return m_video_codec_name.c_str(); };
+protected:
+ // Video format
+ bool m_drop_state;
+ unsigned int m_decoded_width;
+ unsigned int m_decoded_height;
+ unsigned int m_picture_width;
+ unsigned int m_picture_height;
+ bool m_is_open;
+ bool m_Pause;
+ bool m_setStartTime;
+ uint8_t *m_extradata;
+ int m_extrasize;
+ CBitstreamConverter *m_converter;
+ bool m_video_convert;
+ CStdString m_video_codec_name;
+
+ MiscGeneralCallbackTable *m_pCbTable;
+ IppVmetaDecParSet m_VDecParSet;
+ IppVmetaDecInfo m_VDecInfo;
+ void *m_pDecState;
+
+ std::queue<IppVmetaBitstream*> m_input_available;
+ std::vector<IppVmetaBitstream*> m_input_buffers;
+ unsigned int m_input_size;
+
+ std::queue<IppVmetaPicture*> m_output_ready;
+ std::queue<IppVmetaPicture*> m_output_available;
+ std::vector<IppVmetaPicture*> m_output_buffers;
+ std::queue<double> m_pts_queue;
+
+ unsigned int m_Frames;
+
+ DllLibMiscGen *m_DllMiscGen;
+ DllLibVMETA *m_DllVMETA;
+};
+#endif
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DllVMETA.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DllVMETA.h
new file mode 100644
index 0000000..bbead6d
--- /dev/null
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DllVMETA.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#if (defined HAVE_CONFIG_H) && (!defined WIN32)
+ #include "config.h"
+#elif defined(_WIN32)
+#include "system.h"
+#endif
+
+#if defined(HAS_MARVELL_DOVE)
+#include "DynamicDll.h"
+
+extern "C"
+{
+#include <marvell-ipp/codecVC.h>
+#include <marvell-ipp/vdec_os_api.h>
+#include <marvell-ipp/misc.h>
+}
+
+class DllLibMiscGenInterface
+{
+public:
+ virtual ~DllLibMiscGenInterface() {}
+ virtual int miscInitGeneralCallbackTable(MiscGeneralCallbackTable **ppDstCBTable) = 0;
+ virtual int miscFreeGeneralCallbackTable(MiscGeneralCallbackTable **ppSrcCBTable) = 0;
+};
+
+class DllLibMiscGen : public DllDynamic, DllLibMiscGenInterface
+{
+ DECLARE_DLL_WRAPPER(DllLibMiscGen, "/usr/lib/libmiscgen.so")
+
+ DEFINE_METHOD1(int, miscInitGeneralCallbackTable, (MiscGeneralCallbackTable **p1))
+ DEFINE_METHOD1(int, miscFreeGeneralCallbackTable, (MiscGeneralCallbackTable **p1))
+
+ BEGIN_METHOD_RESOLVE()
+ RESOLVE_METHOD(miscInitGeneralCallbackTable)
+ RESOLVE_METHOD(miscFreeGeneralCallbackTable)
+ END_METHOD_RESOLVE()
+};
+
+class DllLibVMETAInterface
+{
+public:
+ virtual ~DllLibVMETAInterface() {}
+ virtual IppCodecStatus DecoderPushBuffer_Vmeta(IppVmetaBufferType nBufType, void *pBufPtr, void *pSrcDecoderState) = 0;
+ virtual IppCodecStatus DecoderPopBuffer_Vmeta(IppVmetaBufferType nBufType, void **ppBufPtr, void *pSrcDecoderState) = 0;
+ virtual IppCodecStatus DecoderInitAlloc_Vmeta(IppVmetaDecParSet *pVmetaDecParSet,
+ MiscGeneralCallbackTable *pSrcCallbackTable, void **ppDstDecoderState) = 0;
+ virtual IppCodecStatus DecoderFree_Vmeta(void **pSrcDecoderState) = 0;
+ virtual IppCodecStatus DecodeSendCmd_Vmeta(int cmd, void *pInParam, void *pOutParam, void *pSrcDecoderState) = 0;
+ virtual IppCodecStatus DecodeFrame_Vmeta(IppVmetaDecInfo *pDecInfo, void *pSrcDstDecoderState) = 0;
+ virtual void *vdec_os_api_dma_alloc(UNSG32 size, UNSG32 align, UNSG32 *pPhysical) = 0;
+ virtual void vdec_os_api_dma_free(void *ptr) = 0;
+ virtual SIGN32 vdec_os_api_suspend_check(void) = 0;
+ virtual void vdec_os_api_suspend_ready(void) = 0;
+};
+
+class DllLibVMETA : public DllDynamic, DllLibVMETAInterface
+{
+ DECLARE_DLL_WRAPPER(DllLibVMETA, "/usr/lib/libcodecvmetadec.so")
+
+ DEFINE_METHOD3(IppCodecStatus, DecoderPushBuffer_Vmeta, (IppVmetaBufferType p1, void *p2, void *p3))
+ DEFINE_METHOD3(IppCodecStatus, DecoderPopBuffer_Vmeta, (IppVmetaBufferType p1, void **p2, void *p3))
+ DEFINE_METHOD3(IppCodecStatus, DecoderInitAlloc_Vmeta, (IppVmetaDecParSet *p1, MiscGeneralCallbackTable *p2, void **p3))
+ DEFINE_METHOD1(IppCodecStatus, DecoderFree_Vmeta, (void **p1))
+ DEFINE_METHOD4(IppCodecStatus, DecodeSendCmd_Vmeta, (int p1, void *p2, void *p3, void *p4))
+ DEFINE_METHOD2(IppCodecStatus, DecodeFrame_Vmeta, (IppVmetaDecInfo *p1, void *p2))
+ DEFINE_METHOD3(void *, vdec_os_api_dma_alloc, (UNSG32 p1, UNSG32 p2, UNSG32 *p3))
+ DEFINE_METHOD1(void, vdec_os_api_dma_free, (void *p1))
+ DEFINE_METHOD0(SIGN32, vdec_os_api_suspend_check)
+ DEFINE_METHOD0(void, vdec_os_api_suspend_ready)
+
+ BEGIN_METHOD_RESOLVE()
+ RESOLVE_METHOD(DecoderPushBuffer_Vmeta)
+ RESOLVE_METHOD(DecoderPopBuffer_Vmeta)
+ RESOLVE_METHOD(DecoderInitAlloc_Vmeta)
+ RESOLVE_METHOD(DecoderFree_Vmeta)
+ RESOLVE_METHOD(DecodeSendCmd_Vmeta)
+ RESOLVE_METHOD(DecodeFrame_Vmeta)
+ RESOLVE_METHOD(vdec_os_api_dma_alloc)
+ RESOLVE_METHOD(vdec_os_api_dma_free)
+ RESOLVE_METHOD(vdec_os_api_suspend_check)
+ RESOLVE_METHOD(vdec_os_api_suspend_ready)
+ END_METHOD_RESOLVE()
+};
+#endif
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in
index 1dce256..47da087 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in
@@ -27,6 +27,11 @@ SRCS += OpenMax.cpp \
DVDVideoCodecOpenMax.cpp \
endif
+ifeq (@USE_MARVELL_DOVE@,1)
+SRCS += DVDVideoCodecVMETA.cpp \
+
+endif
+
LIB=Video.a
diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp
index 35c36ed..001c94e 100644
--- a/xbmc/guilib/GUIFontTTF.cpp
+++ b/xbmc/guilib/GUIFontTTF.cpp
@@ -668,8 +668,14 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c
// really interests us anyway.
float rx0 = (float)MathUtils::round_int(x[0]);
float rx3 = (float)MathUtils::round_int(x[3]);
+ /* Error: bad instruction on for marvell arm */
+#if defined(TARGET_MARVELL_DOVE)
+ x[1] = (float)floor(x[1] + 0.5f);
+ x[2] = (float)floor(x[2] + 0.5f);
+#else
x[1] = (float)MathUtils::truncate_int(x[1]);
x[2] = (float)MathUtils::truncate_int(x[2]);
+#endif
if (rx0 > x[0])
x[1] += 1;
if (rx3 > x[3])
diff --git a/xbmc/threads/Atomics.cpp b/xbmc/threads/Atomics.cpp
index 5b09f18..5b4e480 100644
--- a/xbmc/threads/Atomics.cpp
+++ b/xbmc/threads/Atomics.cpp
@@ -46,6 +46,11 @@ long cas(volatile long *pAddr, long expectedVal, long swapVal)
return prev;
}
+#elif defined(TARGET_MARVELL_DOVE)
+long cas(volatile long* pAddr, long expectedVal, long swapVal)
+{
+ return(__sync_val_compare_and_swap(pAddr, expectedVal, swapVal));
+}
#elif defined(__arm__)
long cas(volatile long* pAddr, long expectedVal, long swapVal)
{
@@ -188,6 +193,25 @@ long AtomicIncrement(volatile long* pAddr)
return val;
}
+#elif defined(TARGET_MARVELL_DOVE)
+
+long AtomicIncrement(volatile long* pAddr)
+{
+ register long val;
+ asm volatile (
+ "1: \n"
+ "ldrex %0, [%1] \n" // (val = *pAddr)
+ "add %0, #1 \n" // (val += 1)
+ "strex r1, %0, [%1] \n"
+ "cmp r1, #0 \n"
+ "bne 1b \n"
+ : "=&r" (val)
+ : "r"(pAddr)
+ : "r1"
+ );
+ return val;
+}
+
#elif defined(__arm__)
long AtomicIncrement(volatile long* pAddr)
@@ -267,6 +291,25 @@ long AtomicAdd(volatile long* pAddr, long amount)
return val;
}
+#elif defined(TARGET_MARVELL_DOVE)
+
+long AtomicAdd(volatile long* pAddr, long amount)
+{
+ register long val;
+ asm volatile (
+ "1: \n"
+ "ldrex %0, [%1] \n" // (val = *pAddr)
+ "add %0, %2 \n" // (val += amount)
+ "strex r1, %0, [%1] \n"
+ "cmp r1, #0 \n"
+ "bne 1b \n"
+ : "=&r" (val)
+ : "r"(pAddr), "r"(amount)
+ : "r1"
+ );
+ return val;
+}
+
#elif defined(__arm__)
long AtomicAdd(volatile long* pAddr, long amount)
@@ -345,6 +388,26 @@ long AtomicDecrement(volatile long* pAddr)
return val;
}
+#elif defined(TARGET_MARVELL_DOVE)
+
+long AtomicDecrement(volatile long* pAddr)
+{
+ register long val;
+ asm volatile (
+ "1: \n"
+ "ldrex %0, [%1] \n" // (val = *pAddr)
+ "sub %0, #1 \n" // (val -= 1)
+ "strex r1, %0, [%1] \n"
+ "cmp r1, #0 \n"
+ "bne 1b \n"
+ : "=&r" (val)
+ : "r"(pAddr)
+ : "r1"
+ );
+
+ return val;
+}
+
#elif defined(__arm__)
long AtomicDecrement(volatile long* pAddr)
@@ -425,6 +488,26 @@ long AtomicSubtract(volatile long* pAddr, long amount)
return val;
}
+#elif defined(TARGET_MARVELL_DOVE)
+
+long AtomicSubtract(volatile long* pAddr, long amount)
+{
+ register long val;
+ asm volatile (
+ "1: \n"
+ "ldrex %0, [%1] \n" // (val = *pAddr)
+ "sub %0, %2 \n" // (val -= amount)
+ "strex r1, %0, [%1] \n"
+ "cmp r1, #0 \n"
+ "bne 1b \n"
+ : "=&r" (val)
+ : "r"(pAddr), "r"(amount)
+ : "r1"
+ );
+
+ return val;
+}
+
#elif defined(__arm__)
long AtomicSubtract(volatile long* pAddr, long amount)
diff --git a/xbmc/utils/BitstreamConverter.cpp b/xbmc/utils/BitstreamConverter.cpp
new file mode 100644
index 0000000..037ff08
--- /dev/null
+++ b/xbmc/utils/BitstreamConverter.cpp
@@ -0,0 +1,911 @@
+/*
+ * Copyright (C) 2010 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+
+#include "BitstreamConverter.h"
+
+void CBitstreamConverter::bits_reader_set( bits_reader_t *br, uint8_t *buf, int len )
+{
+ br->buffer = br->start = buf;
+ br->offbits = 0;
+ br->length = len;
+ br->oflow = 0;
+}
+
+uint32_t CBitstreamConverter::read_bits( bits_reader_t *br, int nbits )
+{
+ int i, nbytes;
+ uint32_t ret = 0;
+ uint8_t *buf;
+
+ buf = br->buffer;
+ nbytes = (br->offbits + nbits)/8;
+ if ( ((br->offbits + nbits) %8 ) > 0 )
+ nbytes++;
+ if ( (buf + nbytes) > (br->start + br->length) ) {
+ br->oflow = 1;
+ return 0;
+ }
+ for ( i=0; i<nbytes; i++ )
+ ret += buf[i]<<((nbytes-i-1)*8);
+ i = (4-nbytes)*8+br->offbits;
+ ret = ((ret<<i)>>i)>>((nbytes*8)-nbits-br->offbits);
+
+ br->offbits += nbits;
+ br->buffer += br->offbits / 8;
+ br->offbits %= 8;
+
+ return ret;
+}
+
+void CBitstreamConverter::skip_bits( bits_reader_t *br, int nbits )
+{
+ br->offbits += nbits;
+ br->buffer += br->offbits / 8;
+ br->offbits %= 8;
+ if ( br->buffer > (br->start + br->length) ) {
+ br->oflow = 1;
+ }
+}
+
+uint32_t CBitstreamConverter::get_bits( bits_reader_t *br, int nbits )
+{
+ int i, nbytes;
+ uint32_t ret = 0;
+ uint8_t *buf;
+
+ buf = br->buffer;
+ nbytes = (br->offbits + nbits)/8;
+ if ( ((br->offbits + nbits) %8 ) > 0 )
+ nbytes++;
+ if ( (buf + nbytes) > (br->start + br->length) ) {
+ br->oflow = 1;
+ return 0;
+ }
+ for ( i=0; i<nbytes; i++ )
+ ret += buf[i]<<((nbytes-i-1)*8);
+ i = (4-nbytes)*8+br->offbits;
+ ret = ((ret<<i)>>i)>>((nbytes*8)-nbits-br->offbits);
+
+ return ret;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////
+// GStreamer h264 parser
+// Copyright (C) 2005 Michal Benes <michal.benes@itonis.tv>
+// (C) 2008 Wim Taymans <wim.taymans@gmail.com>
+// gsth264parse.c:
+// * License as published by the Free Software Foundation; either
+// * version 2.1 of the License, or (at your option) any later version.
+void CBitstreamConverter::nal_bs_init(nal_bitstream *bs, const uint8_t *data, size_t size)
+{
+ bs->data = data;
+ bs->end = data + size;
+ bs->head = 0;
+ // fill with something other than 0 to detect
+ // emulation prevention bytes
+ bs->cache = 0xffffffff;
+}
+
+uint32_t CBitstreamConverter::nal_bs_read(nal_bitstream *bs, int n)
+{
+ uint32_t res = 0;
+ int shift;
+
+ if (n == 0)
+ return res;
+
+ // fill up the cache if we need to
+ while (bs->head < n)
+ {
+ uint8_t a_byte;
+ bool check_three_byte;
+
+ check_three_byte = true;
+next_byte:
+ if (bs->data >= bs->end)
+ {
+ // we're at the end, can't produce more than head number of bits
+ n = bs->head;
+ break;
+ }
+ // get the byte, this can be an emulation_prevention_three_byte that we need
+ // to ignore.
+ a_byte = *bs->data++;
+ if (check_three_byte && a_byte == 0x03 && ((bs->cache & 0xffff) == 0))
+ {
+ // next byte goes unconditionally to the cache, even if it's 0x03
+ check_three_byte = false;
+ goto next_byte;
+ }
+ // shift bytes in cache, moving the head bits of the cache left
+ bs->cache = (bs->cache << 8) | a_byte;
+ bs->head += 8;
+ }
+
+ // bring the required bits down and truncate
+ if ((shift = bs->head - n) > 0)
+ res = bs->cache >> shift;
+ else
+ res = bs->cache;
+
+ // mask out required bits
+ if (n < 32)
+ res &= (1 << n) - 1;
+ bs->head = shift;
+
+ return res;
+}
+
+bool CBitstreamConverter::nal_bs_eos(nal_bitstream *bs)
+{
+ return (bs->data >= bs->end) && (bs->head == 0);
+}
+
+// read unsigned Exp-Golomb code
+int CBitstreamConverter::nal_bs_read_ue(nal_bitstream *bs)
+{
+ int i = 0;
+
+ while (nal_bs_read(bs, 1) == 0 && !nal_bs_eos(bs) && i < 32)
+ i++;
+
+ return ((1 << i) - 1 + nal_bs_read(bs, i));
+}
+
+void CBitstreamConverter::parseh264_sps(uint8_t *sps, uint32_t sps_size, bool *interlaced, int32_t *max_ref_frames)
+{
+ nal_bitstream bs;
+ sps_info_struct sps_info;
+
+ nal_bs_init(&bs, sps, sps_size);
+
+ sps_info.profile_idc = nal_bs_read(&bs, 8);
+ nal_bs_read(&bs, 1); // constraint_set0_flag
+ nal_bs_read(&bs, 1); // constraint_set1_flag
+ nal_bs_read(&bs, 1); // constraint_set2_flag
+ nal_bs_read(&bs, 1); // constraint_set3_flag
+ nal_bs_read(&bs, 4); // reserved
+ sps_info.level_idc = nal_bs_read(&bs, 8);
+ sps_info.sps_id = nal_bs_read_ue(&bs);
+
+ if (sps_info.profile_idc == 100 ||
+ sps_info.profile_idc == 110 ||
+ sps_info.profile_idc == 122 ||
+ sps_info.profile_idc == 244 ||
+ sps_info.profile_idc == 44 ||
+ sps_info.profile_idc == 83 ||
+ sps_info.profile_idc == 86)
+ {
+ sps_info.chroma_format_idc = nal_bs_read_ue(&bs);
+ if (sps_info.chroma_format_idc == 3)
+ sps_info.separate_colour_plane_flag = nal_bs_read(&bs, 1);
+ sps_info.bit_depth_luma_minus8 = nal_bs_read_ue(&bs);
+ sps_info.bit_depth_chroma_minus8 = nal_bs_read_ue(&bs);
+ sps_info.qpprime_y_zero_transform_bypass_flag = nal_bs_read(&bs, 1);
+
+ sps_info.seq_scaling_matrix_present_flag = nal_bs_read (&bs, 1);
+ if (sps_info.seq_scaling_matrix_present_flag)
+ {
+ /* TODO: unfinished */
+ }
+ }
+ sps_info.log2_max_frame_num_minus4 = nal_bs_read_ue(&bs);
+ if (sps_info.log2_max_frame_num_minus4 > 12)
+ { // must be between 0 and 12
+ return;
+ }
+ sps_info.pic_order_cnt_type = nal_bs_read_ue(&bs);
+ if (sps_info.pic_order_cnt_type == 0)
+ {
+ sps_info.log2_max_pic_order_cnt_lsb_minus4 = nal_bs_read_ue(&bs);
+ }
+ else if (sps_info.pic_order_cnt_type == 1)
+ { // TODO: unfinished
+ /*
+ delta_pic_order_always_zero_flag = gst_nal_bs_read (bs, 1);
+ offset_for_non_ref_pic = gst_nal_bs_read_se (bs);
+ offset_for_top_to_bottom_field = gst_nal_bs_read_se (bs);
+
+ num_ref_frames_in_pic_order_cnt_cycle = gst_nal_bs_read_ue (bs);
+ for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ )
+ offset_for_ref_frame[i] = gst_nal_bs_read_se (bs);
+ */
+ }
+
+ sps_info.max_num_ref_frames = nal_bs_read_ue(&bs);
+ sps_info.gaps_in_frame_num_value_allowed_flag = nal_bs_read(&bs, 1);
+ sps_info.pic_width_in_mbs_minus1 = nal_bs_read_ue(&bs);
+ sps_info.pic_height_in_map_units_minus1 = nal_bs_read_ue(&bs);
+
+ sps_info.frame_mbs_only_flag = nal_bs_read(&bs, 1);
+ if (!sps_info.frame_mbs_only_flag)
+ sps_info.mb_adaptive_frame_field_flag = nal_bs_read(&bs, 1);
+
+ sps_info.direct_8x8_inference_flag = nal_bs_read(&bs, 1);
+
+ sps_info.frame_cropping_flag = nal_bs_read(&bs, 1);
+ if (sps_info.frame_cropping_flag)
+ {
+ sps_info.frame_crop_left_offset = nal_bs_read_ue(&bs);
+ sps_info.frame_crop_right_offset = nal_bs_read_ue(&bs);
+ sps_info.frame_crop_top_offset = nal_bs_read_ue(&bs);
+ sps_info.frame_crop_bottom_offset = nal_bs_read_ue(&bs);
+ }
+
+ *interlaced = !sps_info.frame_mbs_only_flag;
+ *max_ref_frames = sps_info.max_num_ref_frames;
+}
+
+const uint8_t *CBitstreamConverter::avc_find_startcode_internal(const uint8_t *p, const uint8_t *end)
+{
+ const uint8_t *a = p + 4 - ((intptr_t)p & 3);
+
+ for (end -= 3; p < a && p < end; p++)
+ {
+ if (p[0] == 0 && p[1] == 0 && p[2] == 1)
+ return p;
+ }
+
+ for (end -= 3; p < end; p += 4)
+ {
+ uint32_t x = *(const uint32_t*)p;
+ if ((x - 0x01010101) & (~x) & 0x80808080) // generic
+ {
+ if (p[1] == 0)
+ {
+ if (p[0] == 0 && p[2] == 1)
+ return p;
+ if (p[2] == 0 && p[3] == 1)
+ return p+1;
+ }
+ if (p[3] == 0)
+ {
+ if (p[2] == 0 && p[4] == 1)
+ return p+2;
+ if (p[4] == 0 && p[5] == 1)
+ return p+3;
+ }
+ }
+ }
+
+ for (end += 3; p < end; p++)
+ {
+ if (p[0] == 0 && p[1] == 0 && p[2] == 1)
+ return p;
+ }
+
+ return end + 3;
+}
+
+const uint8_t *CBitstreamConverter::avc_find_startcode(const uint8_t *p, const uint8_t *end)
+{
+ const uint8_t *out= avc_find_startcode_internal(p, end);
+ if (p<out && out<end && !out[-1])
+ out--;
+ return out;
+}
+
+const int CBitstreamConverter::avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size)
+{
+ const uint8_t *p = buf_in;
+ const uint8_t *end = p + size;
+ const uint8_t *nal_start, *nal_end;
+
+ size = 0;
+ nal_start = avc_find_startcode(p, end);
+
+ for (;;) {
+ while (nal_start < end && !*(nal_start++));
+ if (nal_start == end)
+ break;
+
+ nal_end = avc_find_startcode(nal_start, end);
+ m_dllAvFormat->put_be32(pb, nal_end - nal_start);
+ m_dllAvFormat->put_buffer(pb, nal_start, nal_end - nal_start);
+ size += 4 + nal_end - nal_start;
+ nal_start = nal_end;
+ }
+ return size;
+}
+
+const int CBitstreamConverter::avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
+{
+ ByteIOContext *pb;
+ int ret = m_dllAvFormat->url_open_dyn_buf(&pb);
+ if (ret < 0)
+ return ret;
+
+ avc_parse_nal_units(pb, buf_in, *size);
+
+ m_dllAvUtil->av_freep(buf);
+ *size = m_dllAvFormat->url_close_dyn_buf(pb, buf);
+ return 0;
+}
+
+const int CBitstreamConverter::isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len)
+{
+ // extradata from bytestream h264, convert to avcC atom data for bitstream
+ if (len > 6)
+ {
+ /* check for h264 start code */
+ if (OMX_RB32(data) == 0x00000001 || OMX_RB24(data) == 0x000001)
+ {
+ uint8_t *buf=NULL, *end, *start;
+ uint32_t sps_size=0, pps_size=0;
+ uint8_t *sps=0, *pps=0;
+
+ int ret = avc_parse_nal_units_buf(data, &buf, &len);
+ if (ret < 0)
+ return ret;
+ start = buf;
+ end = buf + len;
+
+ /* look for sps and pps */
+ while (end - buf > 4)
+ {
+ uint32_t size;
+ uint8_t nal_type;
+ size = FFMIN(OMX_RB32(buf), end - buf - 4);
+ buf += 4;
+ nal_type = buf[0] & 0x1f;
+ if (nal_type == 7) /* SPS */
+ {
+ sps = buf;
+ sps_size = size;
+ }
+ else if (nal_type == 8) /* PPS */
+ {
+ pps = buf;
+ pps_size = size;
+ }
+ buf += size;
+ }
+ if (!sps || !pps || sps_size < 4 || sps_size > UINT16_MAX || pps_size > UINT16_MAX)
+ assert(0);
+
+ m_dllAvFormat->put_byte(pb, 1); /* version */
+ m_dllAvFormat->put_byte(pb, sps[1]); /* profile */
+ m_dllAvFormat->put_byte(pb, sps[2]); /* profile compat */
+ m_dllAvFormat->put_byte(pb, sps[3]); /* level */
+ m_dllAvFormat->put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
+ m_dllAvFormat->put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
+
+ m_dllAvFormat->put_be16(pb, sps_size);
+ m_dllAvFormat->put_buffer(pb, sps, sps_size);
+ if (pps)
+ {
+ m_dllAvFormat->put_byte(pb, 1); /* number of pps */
+ m_dllAvFormat->put_be16(pb, pps_size);
+ m_dllAvFormat->put_buffer(pb, pps, pps_size);
+ }
+ m_dllAvUtil->av_free(start);
+ }
+ else
+ {
+ m_dllAvFormat->put_buffer(pb, data, len);
+ }
+ }
+ return 0;
+}
+
+CBitstreamConverter::CBitstreamConverter()
+{
+ m_convert_bitstream = false;
+ m_convertBuffer = NULL;
+ m_convertSize = 0;
+ m_inputBuffer = NULL;
+ m_inputSize = 0;
+ m_to_annexb = false;
+ m_extradata = NULL;
+ m_extrasize = 0;
+ m_convert_3byteTo4byteNALSize = false;
+ m_dllAvUtil = NULL;
+ m_dllAvFormat = NULL;
+ m_convert_bytestream = false;
+ m_convert_vc1 = false;
+}
+
+CBitstreamConverter::~CBitstreamConverter()
+{
+ Close();
+}
+
+bool CBitstreamConverter::Open(enum CodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb)
+{
+ m_to_annexb = to_annexb;
+ m_convert_vc1 = false;
+
+ m_codec = codec;
+
+ switch(codec)
+ {
+ case CODEC_ID_VC1:
+ m_extradata = (uint8_t *)malloc(in_extrasize);
+ memcpy(m_extradata, in_extradata, in_extrasize);
+ m_extrasize = in_extrasize;
+ m_dllAvUtil = new DllAvUtil;
+ m_dllAvFormat = new DllAvFormat;
+ if (!m_dllAvUtil->Load() || !m_dllAvFormat->Load())
+ return false;
+
+ return true;
+ break;
+ case CODEC_ID_H264:
+ if (in_extrasize < 7 || in_extradata == NULL)
+ {
+ CLog::Log(LOGERROR, "CBitstreamConverter::Open avcC data too small or missing\n");
+ return false;
+ }
+ // valid avcC data (bitstream) always starts with the value 1 (version)
+ if(m_to_annexb)
+ {
+ if ( *(char*)in_extradata == 1 )
+ {
+ CLog::Log(LOGINFO, "CBitstreamConverter::Open bitstream to annexb init\n");
+ m_convert_bitstream = BitstreamConvertInit(in_extradata, in_extrasize);
+ return true;
+ }
+ }
+ else
+ {
+ // valid avcC atom data always starts with the value 1 (version)
+ if ( *in_extradata != 1 )
+ {
+ if (in_extradata[0] == 0 && in_extradata[1] == 0 && in_extradata[2] == 0 && in_extradata[3] == 1)
+ {
+ CLog::Log(LOGINFO, "CBitstreamConverter::Open annexb to bitstream init\n");
+ // video content is from x264 or from bytestream h264 (AnnexB format)
+ // NAL reformating to bitstream format needed
+ m_dllAvUtil = new DllAvUtil;
+ m_dllAvFormat = new DllAvFormat;
+ if (!m_dllAvUtil->Load() || !m_dllAvFormat->Load())
+ return false;
+
+ ByteIOContext *pb;
+ if (m_dllAvFormat->url_open_dyn_buf(&pb) < 0)
+ return false;
+ m_convert_bytestream = true;
+ // create a valid avcC atom data from ffmpeg's extradata
+ isom_write_avcc(pb, in_extradata, in_extrasize);
+ // unhook from ffmpeg's extradata
+ in_extradata = NULL;
+ // extract the avcC atom data into extradata then write it into avcCData for VDADecoder
+ in_extrasize = m_dllAvFormat->url_close_dyn_buf(pb, &in_extradata);
+ // make a copy of extradata contents
+ m_extradata = (uint8_t *)malloc(in_extrasize);
+ memcpy(m_extradata, in_extradata, in_extrasize);
+ m_extrasize = in_extrasize;
+ // done with the converted extradata, we MUST free using av_free
+ m_dllAvUtil->av_free(in_extradata);
+ return true;
+ }
+ else
+ {
+ CLog::Log(LOGNOTICE, "CBitstreamConverter::Open invalid avcC atom data");
+ return false;
+ }
+ }
+ else
+ {
+ if (in_extradata[4] == 0xFE)
+ {
+ CLog::Log(LOGINFO, "CBitstreamConverter::Open annexb to bitstream init 3 byte to 4 byte nal\n");
+ // video content is from so silly encoder that think 3 byte NAL sizes
+ // are valid, setup to convert 3 byte NAL sizes to 4 byte.
+ m_dllAvUtil = new DllAvUtil;
+ m_dllAvFormat = new DllAvFormat;
+ if (!m_dllAvUtil->Load() || !m_dllAvFormat->Load())
+ return false;
+
+ in_extradata[4] = 0xFF;
+ m_convert_3byteTo4byteNALSize = true;
+
+ m_extradata = (uint8_t *)malloc(in_extrasize);
+ memcpy(m_extradata, in_extradata, in_extrasize);
+ m_extrasize = in_extrasize;
+ return true;
+ }
+ }
+ }
+ return false;
+ break;
+ default:
+ return false;
+ break;
+ }
+ return false;
+}
+
+void CBitstreamConverter::Close(void)
+{
+ if (m_convert_bitstream)
+ {
+ if (m_sps_pps_context.sps_pps_data)
+ {
+ free(m_sps_pps_context.sps_pps_data);
+ m_sps_pps_context.sps_pps_data = NULL;
+ }
+ if(m_convertBuffer)
+ free(m_convertBuffer);
+ m_convertSize = 0;
+ }
+
+ if (m_convert_bytestream || m_convert_vc1)
+ {
+ if(m_convertBuffer)
+ {
+ m_dllAvUtil->av_free(m_convertBuffer);
+ m_convertBuffer = NULL;
+ }
+ m_convertSize = 0;
+ }
+
+ if(m_extradata)
+ free(m_extradata);
+ m_extradata = NULL;
+ m_extrasize = 0;
+
+ m_inputBuffer = NULL;
+ m_inputSize = 0;
+ m_convert_3byteTo4byteNALSize = false;
+
+ m_convert_bitstream = false;
+
+ if (m_dllAvUtil)
+ {
+ delete m_dllAvUtil;
+ m_dllAvUtil = NULL;
+ }
+ if (m_dllAvFormat)
+ {
+ delete m_dllAvFormat;
+ m_dllAvFormat = NULL;
+ }
+}
+
+bool CBitstreamConverter::Convert(uint8_t *pData, int iSize)
+{
+ if(m_convertBuffer)
+ free(m_convertBuffer);
+ m_convertBuffer = NULL;
+ m_convertSize = 0;
+ m_inputBuffer = NULL;
+ m_inputSize = 0;
+
+ if (pData)
+ {
+ if(m_codec == CODEC_ID_H264)
+ {
+ if(m_to_annexb)
+ {
+ int demuxer_bytes = iSize;
+
+ uint8_t *demuxer_content = pData;
+
+ if (m_convert_bitstream)
+ {
+ // convert demuxer packet from bitstream to bytestream (AnnexB)
+ int bytestream_size = 0;
+ uint8_t *bytestream_buff = NULL;
+
+ BitstreamConvert(demuxer_content, demuxer_bytes, &bytestream_buff, &bytestream_size);
+ if (bytestream_buff && (bytestream_size > 0))
+ {
+ m_convertSize = bytestream_size;
+ m_convertBuffer = bytestream_buff;
+ }
+ else
+ {
+ Close();
+ m_inputBuffer = pData;
+ m_inputSize = iSize;
+ CLog::Log(LOGERROR, "CBitstreamConverter::Convert error converting. disable converter\n");
+ }
+ }
+ else
+ {
+ m_inputBuffer = pData;
+ m_inputSize = iSize;
+ }
+
+ return true;
+ }
+ else
+ {
+ m_inputBuffer = pData;
+ m_inputSize = iSize;
+
+ if (m_convert_bytestream)
+ {
+ if(m_convertBuffer)
+ {
+ m_dllAvUtil->av_free(m_convertBuffer);
+ m_convertBuffer = NULL;
+ }
+ m_convertSize = 0;
+
+ // convert demuxer packet from bytestream (AnnexB) to bitstream
+ ByteIOContext *pb;
+
+ if(m_dllAvFormat->url_open_dyn_buf(&pb) < 0)
+ {
+ return false;
+ }
+ m_convertSize = avc_parse_nal_units(pb, pData, iSize);
+ m_convertSize = m_dllAvFormat->url_close_dyn_buf(pb, &m_convertBuffer);
+ }
+ else if (m_convert_3byteTo4byteNALSize)
+ {
+ if(m_convertBuffer)
+ {
+ m_dllAvUtil->av_free(m_convertBuffer);
+ m_convertBuffer = NULL;
+ }
+ m_convertSize = 0;
+
+ // convert demuxer packet from 3 byte NAL sizes to 4 byte
+ ByteIOContext *pb;
+ if (m_dllAvFormat->url_open_dyn_buf(&pb) < 0)
+ return false;
+
+ uint32_t nal_size;
+ uint8_t *end = pData + iSize;
+ uint8_t *nal_start = pData;
+ while (nal_start < end)
+ {
+ nal_size = OMX_RB24(nal_start);
+ m_dllAvFormat->put_be32(pb, nal_size);
+ nal_start += 3;
+ m_dllAvFormat->put_buffer(pb, nal_start, nal_size);
+ nal_start += nal_size;
+ }
+
+ m_convertSize = m_dllAvFormat->url_close_dyn_buf(pb, &m_convertBuffer);
+ }
+ return true;
+ }
+ }
+ else if (m_codec == CODEC_ID_VC1)
+ {
+ if(!(iSize >= 3 && !pData[0] && !pData[1] && pData[2] == 1) && !m_convert_vc1)
+ m_convert_vc1 = true;
+
+ if(m_convert_vc1)
+ {
+
+ m_inputBuffer = pData;
+ m_inputSize = iSize;
+
+ if(m_convertBuffer)
+ {
+ m_dllAvUtil->av_free(m_convertBuffer);
+ m_convertBuffer = NULL;
+ }
+ m_convertSize = 0;
+
+ ByteIOContext *pb;
+ if (m_dllAvFormat->url_open_dyn_buf(&pb) < 0)
+ return false;
+
+ m_dllAvFormat->put_byte(pb, 0);
+ m_dllAvFormat->put_byte(pb, 0);
+ m_dllAvFormat->put_byte(pb, !m_convert_vc1 ? 0 : 1);
+ m_dllAvFormat->put_byte(pb, !m_convert_vc1 ? 0 : 0xd);
+ m_dllAvFormat->put_buffer(pb, pData, iSize);
+ m_convertSize = m_dllAvFormat->url_close_dyn_buf(pb, &m_convertBuffer);
+ return true;
+ }
+ else
+ {
+ m_inputBuffer = pData;
+ m_inputSize = iSize;
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+
+uint8_t *CBitstreamConverter::GetConvertBuffer()
+{
+ if((m_convert_bitstream || m_convert_bytestream || m_convert_3byteTo4byteNALSize || m_convert_vc1) && m_convertBuffer != NULL)
+ return m_convertBuffer;
+ else
+ return m_inputBuffer;
+}
+
+int CBitstreamConverter::GetConvertSize()
+{
+ if((m_convert_bitstream || m_convert_bytestream || m_convert_3byteTo4byteNALSize || m_convert_vc1) && m_convertBuffer != NULL)
+ return m_convertSize;
+ else
+ return m_inputSize;
+}
+
+uint8_t *CBitstreamConverter::GetExtraData()
+{
+ return m_extradata;
+}
+int CBitstreamConverter::GetExtraSize()
+{
+ return m_extrasize;
+}
+
+bool CBitstreamConverter::BitstreamConvertInit(void *in_extradata, int in_extrasize)
+{
+ // based on h264_mp4toannexb_bsf.c (ffmpeg)
+ // which is Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr>
+ // and Licensed GPL 2.1 or greater
+
+ m_sps_pps_size = 0;
+ m_sps_pps_context.sps_pps_data = NULL;
+
+ // nothing to filter
+ if (!in_extradata || in_extrasize < 6)
+ return false;
+
+ uint16_t unit_size;
+ uint32_t total_size = 0;
+ uint8_t *out = NULL, unit_nb, sps_done = 0;
+ const uint8_t *extradata = (uint8_t*)in_extradata + 4;
+ static const uint8_t nalu_header[4] = {0, 0, 0, 1};
+
+ // retrieve length coded size
+ m_sps_pps_context.length_size = (*extradata++ & 0x3) + 1;
+ if (m_sps_pps_context.length_size == 3)
+ return false;
+
+ // retrieve sps and pps unit(s)
+ unit_nb = *extradata++ & 0x1f; // number of sps unit(s)
+ if (!unit_nb)
+ {
+ unit_nb = *extradata++; // number of pps unit(s)
+ sps_done++;
+ }
+ while (unit_nb--)
+ {
+ unit_size = extradata[0] << 8 | extradata[1];
+ total_size += unit_size + 4;
+ if ( (extradata + 2 + unit_size) > ((uint8_t*)in_extradata + in_extrasize) )
+ {
+ free(out);
+ return false;
+ }
+ out = (uint8_t*)realloc(out, total_size);
+ if (!out)
+ return false;
+
+ memcpy(out + total_size - unit_size - 4, nalu_header, 4);
+ memcpy(out + total_size - unit_size, extradata + 2, unit_size);
+ extradata += 2 + unit_size;
+
+ if (!unit_nb && !sps_done++)
+ unit_nb = *extradata++; // number of pps unit(s)
+ }
+
+ m_sps_pps_context.sps_pps_data = out;
+ m_sps_pps_context.size = total_size;
+ m_sps_pps_context.first_idr = 1;
+
+ return true;
+}
+
+bool CBitstreamConverter::BitstreamConvert(uint8_t* pData, int iSize, uint8_t **poutbuf, int *poutbuf_size)
+{
+ // based on h264_mp4toannexb_bsf.c (ffmpeg)
+ // which is Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr>
+ // and Licensed GPL 2.1 or greater
+
+
+ uint8_t *buf = pData;
+ uint32_t buf_size = iSize;
+ uint8_t unit_type;
+ int32_t nal_size;
+ uint32_t cumul_size = 0;
+ const uint8_t *buf_end = buf + buf_size;
+
+ do
+ {
+ if (buf + m_sps_pps_context.length_size > buf_end)
+ goto fail;
+
+ if (m_sps_pps_context.length_size == 1)
+ nal_size = buf[0];
+ else if (m_sps_pps_context.length_size == 2)
+ nal_size = buf[0] << 8 | buf[1];
+ else
+ nal_size = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
+
+ buf += m_sps_pps_context.length_size;
+ unit_type = *buf & 0x1f;
+
+ if (buf + nal_size > buf_end || nal_size < 0)
+ goto fail;
+
+ // prepend only to the first type 5 NAL unit of an IDR picture
+ if (m_sps_pps_context.first_idr && unit_type == 5)
+ {
+ BitstreamAllocAndCopy(poutbuf, poutbuf_size,
+ m_sps_pps_context.sps_pps_data, m_sps_pps_context.size, buf, nal_size);
+ m_sps_pps_context.first_idr = 0;
+ }
+ else
+ {
+ BitstreamAllocAndCopy(poutbuf, poutbuf_size, NULL, 0, buf, nal_size);
+ if (!m_sps_pps_context.first_idr && unit_type == 1)
+ m_sps_pps_context.first_idr = 1;
+ }
+
+ buf += nal_size;
+ cumul_size += nal_size + m_sps_pps_context.length_size;
+ } while (cumul_size < buf_size);
+
+ return true;
+
+fail:
+ free(*poutbuf);
+ *poutbuf = NULL;
+ *poutbuf_size = 0;
+ return false;
+}
+
+void CBitstreamConverter::BitstreamAllocAndCopy( uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *sps_pps, uint32_t sps_pps_size, const uint8_t *in, uint32_t in_size)
+{
+ // based on h264_mp4toannexb_bsf.c (ffmpeg)
+ // which is Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr>
+ // and Licensed GPL 2.1 or greater
+
+ #define CHD_WB32(p, d) { \
+ ((uint8_t*)(p))[3] = (d); \
+ ((uint8_t*)(p))[2] = (d) >> 8; \
+ ((uint8_t*)(p))[1] = (d) >> 16; \
+ ((uint8_t*)(p))[0] = (d) >> 24; }
+
+ uint32_t offset = *poutbuf_size;
+ uint8_t nal_header_size = offset ? 3 : 4;
+
+ *poutbuf_size += sps_pps_size + in_size + nal_header_size;
+ *poutbuf = (uint8_t*)realloc(*poutbuf, *poutbuf_size);
+ if (sps_pps)
+ memcpy(*poutbuf + offset, sps_pps, sps_pps_size);
+
+ memcpy(*poutbuf + sps_pps_size + nal_header_size + offset, in, in_size);
+ if (!offset)
+ {
+ CHD_WB32(*poutbuf + sps_pps_size, 1);
+ }
+ else
+ {
+ (*poutbuf + offset + sps_pps_size)[0] = 0;
+ (*poutbuf + offset + sps_pps_size)[1] = 0;
+ (*poutbuf + offset + sps_pps_size)[2] = 1;
+ }
+}
+
+
diff --git a/xbmc/utils/BitstreamConverter.h b/xbmc/utils/BitstreamConverter.h
new file mode 100644
index 0000000..ba009c2
--- /dev/null
+++ b/xbmc/utils/BitstreamConverter.h
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2010 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#ifndef _BITSTREAMCONVERTER_H_
+#define _BITSTREAMCONVERTER_H_
+
+#include <stdint.h>
+#include "DllAvUtil.h"
+#include "DllAvFormat.h"
+#include "DllAvFilter.h"
+#include "DllAvCodec.h"
+#include "DllAvCore.h"
+
+typedef struct {
+ uint8_t *buffer, *start;
+ int offbits, length, oflow;
+} bits_reader_t;
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// TODO: refactor this so as not to need these ffmpeg routines.
+// These are not exposed in ffmpeg's API so we dupe them here.
+// AVC helper functions for muxers,
+// * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@smartjog.com>
+// This is part of FFmpeg
+// * License as published by the Free Software Foundation; either
+// * version 2.1 of the License, or (at your option) any later version.
+#define OMX_RB16(x) \
+ ((((const uint8_t*)(x))[0] << 8) | \
+ ((const uint8_t*)(x)) [1])
+
+#define OMX_RB24(x) \
+ ((((const uint8_t*)(x))[0] << 16) | \
+ (((const uint8_t*)(x))[1] << 8) | \
+ ((const uint8_t*)(x))[2])
+
+#define OMX_RB32(x) \
+ ((((const uint8_t*)(x))[0] << 24) | \
+ (((const uint8_t*)(x))[1] << 16) | \
+ (((const uint8_t*)(x))[2] << 8) | \
+ ((const uint8_t*)(x))[3])
+
+#define OMX_WB32(p, d) { \
+ ((uint8_t*)(p))[3] = (d); \
+ ((uint8_t*)(p))[2] = (d) >> 8; \
+ ((uint8_t*)(p))[1] = (d) >> 16; \
+ ((uint8_t*)(p))[0] = (d) >> 24; }
+
+typedef struct
+{
+ const uint8_t *data;
+ const uint8_t *end;
+ int head;
+ uint64_t cache;
+} nal_bitstream;
+
+typedef struct
+{
+ int profile_idc;
+ int level_idc;
+ int sps_id;
+
+ int chroma_format_idc;
+ int separate_colour_plane_flag;
+ int bit_depth_luma_minus8;
+ int bit_depth_chroma_minus8;
+ int qpprime_y_zero_transform_bypass_flag;
+ int seq_scaling_matrix_present_flag;
+
+ int log2_max_frame_num_minus4;
+ int pic_order_cnt_type;
+ int log2_max_pic_order_cnt_lsb_minus4;
+
+ int max_num_ref_frames;
+ int gaps_in_frame_num_value_allowed_flag;
+ int pic_width_in_mbs_minus1;
+ int pic_height_in_map_units_minus1;
+
+ int frame_mbs_only_flag;
+ int mb_adaptive_frame_field_flag;
+
+ int direct_8x8_inference_flag;
+
+ int frame_cropping_flag;
+ int frame_crop_left_offset;
+ int frame_crop_right_offset;
+ int frame_crop_top_offset;
+ int frame_crop_bottom_offset;
+} sps_info_struct;
+
+class CBitstreamConverter
+{
+public:
+ CBitstreamConverter();
+ ~CBitstreamConverter();
+ // Required overrides
+ static void bits_reader_set( bits_reader_t *br, uint8_t *buf, int len );
+ static uint32_t read_bits( bits_reader_t *br, int nbits );
+ static void skip_bits( bits_reader_t *br, int nbits );
+ static uint32_t get_bits( bits_reader_t *br, int nbits );
+
+ bool Open(enum CodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb);
+ void Close(void);
+ bool NeedConvert(void) { return m_convert_bitstream; };
+ bool Convert(uint8_t *pData, int iSize);
+ uint8_t *GetConvertBuffer(void);
+ int GetConvertSize();
+ uint8_t *GetExtraData(void);
+ int GetExtraSize();
+ void parseh264_sps(uint8_t *sps, uint32_t sps_size, bool *interlaced, int32_t *max_ref_frames);
+protected:
+ // bytestream (Annex B) to bistream conversion support.
+ void nal_bs_init(nal_bitstream *bs, const uint8_t *data, size_t size);
+ uint32_t nal_bs_read(nal_bitstream *bs, int n);
+ bool nal_bs_eos(nal_bitstream *bs);
+ int nal_bs_read_ue(nal_bitstream *bs);
+ const uint8_t *avc_find_startcode_internal(const uint8_t *p, const uint8_t *end);
+ const uint8_t *avc_find_startcode(const uint8_t *p, const uint8_t *end);
+ const int avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size);
+ const int avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size);
+ const int isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len);
+ // bitstream to bytestream (Annex B) conversion support.
+ bool BitstreamConvertInit(void *in_extradata, int in_extrasize);
+ bool BitstreamConvert(uint8_t* pData, int iSize, uint8_t **poutbuf, int *poutbuf_size);
+ void BitstreamAllocAndCopy( uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *sps_pps, uint32_t sps_pps_size, const uint8_t *in, uint32_t in_size);
+
+ typedef struct omx_bitstream_ctx {
+ uint8_t length_size;
+ uint8_t first_idr;
+ uint8_t *sps_pps_data;
+ uint32_t size;
+ } omx_bitstream_ctx;
+
+ uint8_t *m_convertBuffer;
+ int m_convertSize;
+ uint8_t *m_inputBuffer;
+ int m_inputSize;
+
+ uint32_t m_sps_pps_size;
+ omx_bitstream_ctx m_sps_pps_context;
+ bool m_convert_bitstream;
+ bool m_to_annexb;
+ bool m_convert_vc1;
+
+ uint8_t *m_extradata;
+ int m_extrasize;
+ bool m_convert_3byteTo4byteNALSize;
+ bool m_convert_bytestream;
+ DllAvUtil *m_dllAvUtil;
+ DllAvFormat *m_dllAvFormat;
+ CodecID m_codec;
+};
+
+#endif
diff --git a/xbmc/utils/Makefile b/xbmc/utils/Makefile
index a420c5b..fed0e10 100644
--- a/xbmc/utils/Makefile
+++ b/xbmc/utils/Makefile
@@ -57,6 +57,7 @@ SRCS=AlarmClock.cpp \
Weather.cpp \
Win32Exception.cpp \
XMLUtils.cpp \
+ BitstreamConverter.cpp \
LIB=utils.a
diff --git a/xbmc/utils/MathUtils.h b/xbmc/utils/MathUtils.h
index 47517b5..6f360f7 100644
--- a/xbmc/utils/MathUtils.h
+++ b/xbmc/utils/MathUtils.h
@@ -63,7 +63,7 @@ namespace MathUtils
sar i, 1
}
#else
-#if defined(__powerpc__) || defined(__ppc__)
+#if defined(__powerpc__) || defined(__ppc__) || defined(TARGET_MARVELL_DOVE)
i = floor(x + round_to_nearest);
#elif defined(__arm__)
// From 'ARM®v7-M Architecture Reference Manual' page A7-569:
diff --git a/xbmc/windowing/WinEventsSDL.cpp b/xbmc/windowing/WinEventsSDL.cpp
index f8b9806..882e097 100644
--- a/xbmc/windowing/WinEventsSDL.cpp
+++ b/xbmc/windowing/WinEventsSDL.cpp
@@ -36,6 +36,7 @@
#endif
#if defined(_LINUX) && !defined(__APPLE__)
+typedef int Status; /* somehow Status typedef is missing, leads error in XKBlib.h */
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include "input/XBMC_keysym.h"
diff --git a/xbmc/windowing/X11/WinSystemX11GLES.cpp b/xbmc/windowing/X11/WinSystemX11GLES.cpp
index a94906d..ea7735f 100644
--- a/xbmc/windowing/X11/WinSystemX11GLES.cpp
+++ b/xbmc/windowing/X11/WinSystemX11GLES.cpp
@@ -34,8 +34,12 @@
using namespace std;
// Comment out one of the following defines to select the colourspace to use
-//#define RGBA8888
+#ifdef HAS_MARVELL_DOVE
+/* For dove we use 32 bit per pixel on graphics overlay */
+#define RGBA8888
+#else
#define RGB565
+#endif
#if defined(RGBA8888)
#define RSIZE 8
@@ -365,7 +369,9 @@ bool CWinSystemX11GLES::RefreshEGLContext()
if ((m_eglWindow == info.info.x11.window) && m_eglSurface && m_eglContext)
{
CLog::Log(LOGWARNING, "EGL: Same window as before, refreshing context");
+#ifndef HAS_MARVELL_DOVE /* Dove GL engine doesn't like the following. Probably EGL_NO_CONTEXT flag */
eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+#endif
eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
return true;
}
@@ -385,11 +391,13 @@ bool CWinSystemX11GLES::RefreshEGLContext()
if (m_eglContext)
eglDestroyContext(m_eglDisplay, m_eglContext);
+#ifndef HAS_MARVELL_DOVE /* Dove GL engine doesn't like the following. Probably EGL_NO_CONTEXT flag */
if ((m_eglContext = eglCreateContext(m_eglDisplay, eglConfig, EGL_NO_CONTEXT, contextAttributes)) == EGL_NO_CONTEXT)
{
CLog::Log(LOGERROR, "EGL Error: Could not create context");
return false;
}
+#endif
if ((m_eglContext = eglCreateContext(m_eglDisplay, eglConfig, m_eglContext, contextAttributes)) == EGL_NO_CONTEXT)
{
diff --git a/xbmc/xbmc.cpp b/xbmc/xbmc.cpp
index b6d3bac..c91b11d 100644
--- a/xbmc/xbmc.cpp
+++ b/xbmc/xbmc.cpp
@@ -98,5 +98,10 @@ int main(int argc, char* argv[])
status = -1;
}
+ // workaround for a bug in the Vivante gpu driver
+#if defined(TARGET_MARVELL_DOVE)
+ _exit(status);
+#else
return status;
+#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment