CedarX/libve

= Introduction =

libve is a small proprietary library, which is providing the core of CedarX video decoding functionality. There is some documentation about the use of libve API here. Also the sources of VLC and XBMC media players can be used as examples.

= Using the native Linux library =

There is a Linux armhf blob available at (af9caeac58876819623e8e7ac3ee19798079a102 libvecore.so). Unfortunately it has little practical value because of a serious decoding bug: https://github.com/linux-sunxi/cedarx-libs/issues/1

A good example of a file triggering this bug is Sintel trailer: http://ftp.nluug.nl/ftp/graphics/blender/apricot/trailer/sintel_trailer-1080p.mp4

But don't lose your hope yet and move on to the next section.

= Using libhybris wrapped Android libraries =

First we need to get access to the Android /system directory with the required Android libraries.

One way to do this is just by simply mounting this directory for the vendor provided Android firmware in NAND. But make sure that a recent Android firmware is used (unfortunately ABI keeps changing between releases). This method was successfully tested on Mele A2000 with Mele_HTPC_20130116_V1.3.1.img vendor provided firmware.

mkdir /system mount /dev/nandd /system

An alternative method can be used in the case if your Android blobs are not compatible (cause crashes) or you don't have Android in NAND in the first place. It is possible to build Android from sources for cubieboard (or some other Allwinner A10 hardware) using the instructions from http://martinbrook.blogspot.fi/2013/04/adventures-with-libhybris-and-andriod.html. For convenience, a minimal set of pre-built libraries can be obtained by using the following instructions:

cd / wget http://ssvb.name/files/20130509/system.tar.gz  tar -xzf system.tar.gz   cd /system/lib wget https://github.com/allwinner-dev-team/android_external_cedarx/raw/ef36cd760e9d76a2/CedarAndroidLib/LIB_JB_F23/libcedarv_adapter.so  wget https://github.com/allwinner-dev-team/android_external_cedarx/raw/ef36cd760e9d76a2/CedarAndroidLib/LIB_JB_F23/libcedarv_base.so   wget https://github.com/allwinner-dev-team/android_external_cedarx/raw/ef36cd760e9d76a2/CedarAndroidLib/LIB_JB_F23/libcedarxosal.so   wget https://github.com/allwinner-dev-team/android_external_cedarx/raw/ef36cd760e9d76a2/CedarAndroidLib/LIB_JB_F23/libve.so

Then we need to compile and install libhybris with CedarX libve patches (to some directory of your choice, but *not* into /usr because it would clash with GLESv2 Mali libraries):

git clone -b cedarx git://github.com/ssvb/libhybris.git cd libhybris/hybris ./autogen.sh --prefix=/usr/local/hybris make make install

That's all. Now you should have /usr/local/hybris/lib/libvecore.so library, which is a drop-in replacement for the native libvecore.so

Testing libhybris wrapped Android libraries with VLC
Important: libcedarx needs to be patched with https://github.com/ssvb/libcedarx/commit/e15e6ab4a167e243cf5254d2adc32f70b3b25381 (there is a pending pull request )

The VLC test itself can be done with:

export LD_LIBRARY_PATH=/usr/local/hybris/lib wget http://ftp.nluug.nl/ftp/graphics/blender/apricot/trailer/sintel_trailer-1080p.mp4 ./cvlc --demux ffmpeg --codec cedar --vout cedarfb --no-osd sintel_trailer-1080p.mp4

The Sintel trailer video used in this example normally triggers severe decoding bugs in the native Linux blob. With the libhybris wrapped and loaded Android blobs this video should play perfectly fine.

Testing libhybris wrapped Android libraries with XBMC
First replace libvecore.so with a symlink to the libhybris wrapper:

cd /allwinner/xbmc-pvr-binhf/lib mv libvecore.so libvecore.so.old_native_linux_blob ln -s /usr/local/hybris/lib/libvecore.so libvecore.so

Then run XBMC:

cd /allwinner/xbmc-pvr-binhf/lib/xbmc ./xbmc.bin