Qt MacOsx video not visible

This forum is about all development around libVLC.
amn
New Cone
New Cone
Posts: 6
Joined: 13 Oct 2020 16:23

Qt MacOsx video not visible

Postby amn » 13 Oct 2020 16:58

i'm trying to use vlc4.0 (libvlc and libvlcpp) with Qt(5.14) clang under MacOsx(10.15)
i tried several methods, and i would like some informations about solve them

from https://github.com/videolan/vlc, compilation run fine
that extract libvlc.12.dylib, libvlccore.9.dylib, and /plugins/*/

a) There are two examples of use
i) vlc/doc/libvlc/QtGL
at run time, there is 2 error log messages, the second make crash:
QOpenGLShader::compile(Fragment): ERROR: 0:9: ';' : syntax error: syntax error
Assertion failed: (psz_mrl), function InputSourceInit, file vlc/extras/package/macosx/../../../src/input/input.c, line 2568.
>>> Question : Should we insist in this direction, and if so, how?

ii) vlc/doc/libvlc/QtPlayer
X11 is necessary (from https://www.xquartz.org/)
integraton resumed : libvlc_media_player_set_nsobject(vlcPlayer, (void *)videoWidget->winId());
at excecution, I have the following error:
dyld: Symbol not found: _gll_noop
Referenced from: /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
that I solve by copying the dylib missing in Contents/ (Frameworks/ [with Frameworks/plugins/] and PlugIns/)

then, with

Code: Select all

vlcInstance = libvlc_new(0, NULL); (in player.cpp)
video is playing (I hear the sound) but nothing is displayed, black screen :

Code: Select all

[00007ff3c20a6850] macosx window error: Cannot create vout as Mac OS X interface was not found [00007ff3be913a00] videotoolbox decoder: Using Video Toolbox to decode 'h264' [00007ff3c20992c0] main video output error: video output display creation failed [00007ff3be913a00] videotoolbox decoder error: decoder failure, Abort. [h264 @ 0x7ff3bf0fd400] get_buffer() failed [h264 @ 0x7ff3bf0fd400] thread_get_buffer() failed [h264 @ 0x7ff3bf0fd400] decode_slice_header error [h264 @ 0x7ff3bf0fd400] no frame!
>>> Question : Why the video is not showing?

and with,

Code: Select all

const char * const vlc_args[] = { "--verbose=4" ,"--vout=macosx" //,"--no-plugins-cache" }; vlcInstance = libvlc_new(sizeof(vlc_args) / sizeof(*vlc_args), vlc_args);
video is playing (I hear the sound) but nothing is displayed, black screen again :

Code: Select all

[00007fea806ada50] macosx window error: Cannot create vout as Mac OS X interface was not found [00007fea82419c40] main video output error: video output display creation failed [00007fea81872600] videotoolbox decoder error: decoder failure, Abort.
>>> Question : "--vout=macosx" does not seem to work, what initialization should be specified for a correct vault?

b) Integration into my own project works (without X11), but nothing is displayed, black screen again.
Changing @rpath of 2 libraries to be compatible with my tree structure
echo $RPWD | sudo -S install_name_tool -add_rpath @executable_path/../Frameworks plugins/gui/libmacosx_plugin.dylib
echo $RPWD | sudo -S install_name_tool -add_rpath @executable_path/../Frameworks plugins/audio_filter/libebur128_plugin.dylib

Code: Select all

const char * const vlc_args[] = { "--verbose=2" ,"--vout=macosx" //,"--no-plugins-cache" }; QScreen *screen=QGuiApplication::primaryScreen(); _videoWindow = new QWindow(screen); _videoWidget=QWidget::createWindowContainer(_videoWindow,this); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(_videoWidget); setLayout(layout); _vlcinstance = new VLC::Instance(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args); _m = new VLC::Media(*_vlcinstance, file.toLatin1().data(), VLC::Media::FromLocation); _mp = new VLC::MediaPlayer(*_m); _mp->eventManager() ... int windid = _videoWidget->winId(); _mp->setNsobject((void*)windid); _mp->play();
I hear the video sound, and I receive the events, but vlcdebug says :

Code: Select all

[00007f8bfa8e8990] main libvlc debug: VLC media player - 4.0.0-dev Otto Chriek [00007f8bfa8e8990] main libvlc debug: configured with /Users/amn/vlc/extras/package/macosx/../../../configure '--prefix=/' '--enable-macosx' '--enable-merge-ffmpeg' '--enable-osx-notifications' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-shout' '--enable-ncurses' '--enable-twolame' '--enable-libass' '--enable-macosx-avfoundation' '--disable-skins2' '--disable-xcb' '--disable-caca' '--disable-pulse' '--disable-sdl-image' '--disable-vnc' '--build=x86_64-apple-darwin19' '--host=x86_64-apple-darwin19' '--with-macosx-version-min=10.11' '--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' 'build_alias=x86_64-apple-darwin19' 'host_alias=x86_64-apple-darwin19' 'CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang' 'CFLAGS=-g' 'LDFLAGS=' 'CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++' 'CXXFLAGS=-g' 'OBJC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang' 'OBJCFLAGS=-g' [00007f8bfa8e8990] main libvlc debug: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 FPU [h264 @ 0x7f8bf9d06800] Reinit context to 1280x720, pix_fmt: yuv420p [h264 @ 0x7f8bf9d06800] get_buffer() failed [h264 @ 0x7f8bf9d06800] thread_get_buffer() failed [h264 @ 0x7f8bf9d06800] decode_slice_header error [h264 @ 0x7f8bf9d06800] no frame!
>>> Question : how to correctly create _videoWidget and view the video?

thanks for your help.

amn
New Cone
New Cone
Posts: 6
Joined: 13 Oct 2020 16:23

Re: Qt MacOsx video not visible

Postby amn » 15 Oct 2020 10:07

Forgotten to tell you, the b) point is build with libvlcpp (https://code.videolan.org/videolan/libvlcpp)

amn
New Cone
New Cone
Posts: 6
Joined: 13 Oct 2020 16:23

Re: Qt MacOsx video not visible

Postby amn » 16 Oct 2020 15:50

also trying, but obtain the same black screen:

Code: Select all

NSView *video = [[NSView alloc] init]; QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, _videoWidget); _mp->setNsobject(video);
or:

Code: Select all

NSView *nsview = ( __bridge NSView * )reinterpret_cast<void *>( windid ); _mp->setNsobject(nsview);

amn
New Cone
New Cone
Posts: 6
Joined: 13 Oct 2020 16:23

Re: Qt MacOsx video not visible

Postby amn » 21 Oct 2020 18:14

With this code :

Code: Select all

NSWindow *window = [[[NSApplication sharedApplication] windows] objectAtIndex:0]; NSView *contentView = [window contentView]; NSView *test = [[NSView alloc] initWithFrame:CGRectMake(0,0,150,150)]; [test setWantsLayer:YES]; test.layer.backgroundColor=NSColor.blueColor.CGColor; [contentView addSubview:test positioned:NSWindowAbove relativeTo:nil]; _mp->setNsobject(test); [test release];
I see a blue square, so NSView is correctly initialized, but the video is again not visible.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 23 guests