Build Procedure for PiOmxTextures

Building PiOmxTextures (POT for convenience) involves building a few components:

  • Build ffmpeg;
  • patch and rebuild Qt Multimedia;
  • build the whatever component you want in POT, which includes:
    • test app using the POT library;
    • POT library;
    • POT plugin;
    • proof-of-concept player (POCPlayer).

NOTE: Starting from POT v5.1.0 (and maybe even some commits before it), patching Qt Multimedia is not needed anymore. But please, remember that your application NEEDS a shared OpenGL context. To enable refer to Qt docs on Qt::AA_ShareOpenGLContexts. Also note that qmlscene sets it by default, so qmlscene is always working (unless you explicitly disable it).

Build ffmpeg

Building ffmpeg and preparing the other 3rdparty deps is simple: go to piomxtextures_tools and run the prepare_3rdparty.sh script. This should also build ffmpeg:

export RPI_SYSROOT= (e.g. /opt/rpi/sysroot)
export COMPILER_PATH= (where arm-linux-gnueabihf-gcc is positioned)
cd /piomxtextures_tools
./prepare_3rdparty.sh  n(n is the number of threads)

Patch and Rebuild Qt Multimedia

Unfortunately, still a patch to QtMultimedia is needed, so go into the qtmultimedia dir of your Qt source tree (latest tested is Qt 5.4.1) and patch using the patch provided in tools:

patch -p1 < /piomxtextures_tools/qt_multimedia_patch_5.4.0.patch
$QMAKE_PATH CONFIG+=raspberry
make -jn
make install

Build Components in POT

POT source tree contains a few things, but you can build those pretty independently. Use qmake to build the project or any of the subprojects.
If you’re interested in the Qt plugin, once built, you should have the new openmaxil plugin in your Qt install dir (read the output of make). When using, if an error like this is returned when running an application using the plugin:

luca@raspberrypi ~ $ ./piomxtextures_pocplayer
* failed to open vchiq instance

then set the permissions appropriately:

sudo chmod a+rw /dev/vchiq

Or better add your user to the video group. Same stands for input devices:

sudo usermod -a -G video 
sudo usermod -a -G input

Old Build Procedure (prev cfe5a9e)

Building PiOmxTextures (POT for convenience) is a little convoluted. Some work should probably be done to make it simpler. However it requires three main steps:

  • Build ffmpeg;
  • build the POT library;
  • build the POT Qt plugin.

Building ffmpeg

Building ffmpeg should be pretty simple if a proper sysroot is available. A script is provided in the POT repo:

export RPI_SYSROOT= (e.g. /opt/rpi/sysroot)
export COMPILER_PATH= (where arm-linux-gnueabihf-gcc is positioned)
cd tools
./compile_ffmpeg.sh n(n is the number of threads)

After this, ffmpeg libs will be placed in the 3rdparty directory and nothing more needs to be done.

NOTE: I had to modify the libssh pkgconfig file ($RPI_SYSROOT/usr/lib/arm-linux-gnueabihf/pkgconfig/libssh.pc) to:

prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib/arm-linux-gnueabihf
includedir=${prefix}/include

Name: libssh
Description: The SSH Library
Version: 0.5.4
Libs: -L{libdir} -lssh
Cflags: -I{includedir}

Building POT lib

POT lib is needed to get an interface to hardware video and audio decoding/playback. A script is provided to prepare the POT lib and the sources for the Qt driver:

export QMAKE_PATH=
./prepare_openmaxil_backend.sh

Now you have to copy the directory of the plugin to the src/plugins subdirectory of your Qt source tree. Once finished, this plugin will be built.

Building POT Qt driver

Unfortunately, still a patch to QtMultimedia is needed, so go into the qtmultimedia dir of your Qt source tree (I tested on the Qt 5.4.0 tree) and patch using the patch provided in tools:

cp -a /openmaxil_backend /qtmultimedia/src/plugins/openmaxil
patch -p1 < /tools/qt_multimedia_patch_5.4.0.patch
$QMAKE_PATH CONFIG+=raspberry
make -jn
make install

Now you should have the new openmaxil plugin in your Qt prefix. When using, remember that libPiOmxTextures.so* must be in the runtime library path when using the plugin. If an error like this is returned when running an application using the plugin:

luca@raspberrypi ~ $ ./POCPlayer
* failed to open vchiq instance

then set the permissions appropriately:

sudo chmod a+rw /dev/vchiq

Or better add your user to the video group. Same stands for input devices:

sudo usermod -a -G video
sudo usermod -a -G input

Leave a Reply

Your email address will not be published.