In case you are still wondering, as mentioned, you do need the java part (and the .so files) but as long as they are packaged in the APK correctly you can still write c/c++, compile it using the NDK and run it on an Android device. I am using libvlc inside a Qt (5.5+) application which runs on Windows and Android (and will soon be done for OSX). This is an extract of the Qt .pro file which picks up the vlc bits
Code: Select all
VLC_ROOT_PATH = C:/mypathto/vlc-2.x.x
VLC_SDK = sdk
INCLUDEPATH += $${VLC_ROOT_PATH}/$${VLC_SDK}/include
INCLUDEPATH += $${VLC_ROOT_PATH}/$${VLC_SDK}/include/vlc/plugins
android {
DEFINES += __MINGW32__ # this stops issues with the build thinking we are on a linux machine when we are not
LIBS += $${VLC_ROOT_PATH}/android_so/libvlcjni.so
}
else {
LIBS += -L$${VLC_ROOT_PATH}
LIBS += -llibvlc -llibvlccore
}
The VLC_ROOT_PATH points to a directory which is just a regular vlc installation (with some modified headers such as including vlc_interface.h in case you want to do device discovery etc). For windows, this links the vlc dll's as normal.
For Android, there is the linking to the ndk compiled libs, but also (and not visible above) is a libvlc.jar file at '$${PROJECT_ROOT}/android/libvlc.jar'. This is automatically pulled in by the Qt build system, I think because we have set ANDROID_PACKAGE_SOURCE_DIR to '$${PWD}/android'. We build our main libvlc based code in a separate library which is statically linked into the main build, and that lib also links 'libvlcjni.so'. The kicker for all of this is that we didn't want to build libvlc (although that will probably change in the future for android). To get around this, I invoked gradle (
https://github.com/mrmaffen/vlc-android-sdk) to pull in precompiled libvlc bits, then extracted the .so's and the .jar file. As implied above, the headers are the same for all versions.
If it works for you, there are some pretty good open source projects for using libvlc in Qt (with varying levels of support for Android), such as
https://github.com/vlc-qt/vlc-qt. We did not end up using one of these because we need to use the callbacks rather than rendering into a widget (or QML item), but if you just want video rendered in a rectangle somewhere you'll probably save some time not re-inventing the wheel.