I'm working on a project which involves receive, display and rebroadcast several local network video streams. LibVLC seems to be the way to go, I'd like to use it within Qt Creator/C++/OSX 10.12.1 and I also need the project to be compilable on some Windows 10 machines where I have Qt installed.
I successfully tested some functionalities by installing the offical QT-LibVLC wrapper from projects.tano.si/vlc-qt. Unfortunately the wrapper lacks many LibVLC methods which are essential to my project, so I decided to install full LibVLC.
For now I'm stuck on how to make LibVLC work. I followed all directions at https://wiki.videolan.org/OSXCompile/#Apple_Software for installation and libraries building, and everything went fine.
Then I started a new project in QT, tried adding INCLUDEPATH += . vlc and LIBS +=-lvlc paths to the .pro file in Qt, but it does not work. Also adding paths to the "Framework" folder of the VLC build folder doesn't work.
Anyone knows how the magic trick? Sorry, I know I'm a bit naive, but that's it... Thank you in advance for any answer!
UPDATE:
thanks to eyllanesc suggestion this structure now works for the compiler:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = testVLC
TEMPLATE = app
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
player.cpp \
main.cpp
HEADERS += \
player.h
macx: LIBS += -L$$PWD/../../../../Users/macbookpro15retina/Documents/vlc/build/vlc_install_dir/lib/ -lvlc.5
INCLUDEPATH += $$PWD/../../../../Users/macbookpro15retina/Documents/vlc/build/vlc_install_dir/include
DEPENDPATH += $$PWD/../../../../Users/macbookpro15retina/Documents/vlc/build/vlc_install_dir/include
Unfortunately the application is launched but VLC instance is not initialized. Seems that my VLC installation has something wrong.
SOLVED:
After some tweaking the project compiles and starts correctly. I don't understand why, but the environment variable VLC_PLUGIN_PATH has to be set just before instantiating VLC, otherwise VLC refuses to initialize:
//set environment variable VLC_PLUGIN_PATH
int s = setenv ("VLC_PLUGIN_PATH", "/Users/macbookpro15retina/Documents/vlc/build/vlc_install_dir/lib/vlc/plugins", 1);
// Initialize libVLC
vlcInstance = libvlc_new(0, NULL);
Actually it doesn't work at all if you set it in the Build Environment of QtCreator.
A simple way to include libraries for our application is with the help of Qt Creator, this one has an assistant, to be able to use it just right click on the name of your project:
Then select the Add Library
option.
Then the assistant opened:
And select the type of import, in your case it is advisable to use External Library
.
Then you look for the location of your project and you accept.
Note: In Linux this tool can be opened with the shortcut Ctrl + E