Using libVLC on Mac OS X + Qt5

This forum is about all development around libVLC.
lanamelach
Blank Cone
Blank Cone
Posts: 31
Joined: 18 Nov 2010 13:22

Using libVLC on Mac OS X + Qt5

Postby lanamelach » 13 May 2016 11:57

I've been developing a cross-platform app which can be run on windows and mac. It is based on Qt 5.6 and libVLC v2.2.3. On Windows it works fine, but on Mac it doesn't display video, though the sound from the movie can be heard. I believe the issue is related to this function:

Code: Select all

libvlc_media_player_set_nsobject(vlcPlayer, (void*)videoWidget->winId()); // videoWidget is QFrame *
It seems winId() works very different in Qt4 and Qt5, therefore the code, which worked fine in Qt4, ceased to work in Qt5. I read about QMacCocoaViewContainer. Probably in Qt5 it must be used instead of a simple QWidget or QFrame, but I still haven't managed to make it work as QMacCocoaViewContainer crashes when setting a cocoa view instance:

Code: Select all

QMacCocoaViewContainer container(0); // Many Cocoa objects create temporary autorelease objects, // so create a pool to catch them. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // Create the NSView, set it on the QCocoaViewContainer. NSView *view = [[NSView alloc] init]; container.setCocoaView(view); // here it crashes saying EXC_BAD_ACCESS // Release our reference, since our super class takes ownership and we // don't need it anymore. [view release]; // Clean up our pool as we no longer need it. [pool release]; container.show(); .... libvlc_media_player_set_nsobject(vlcPlayer, (void*)container->cocoaView());
Does anyone know how to fix this?
No milk today

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Using libVLC on Mac OS X + Qt5

Postby Jean-Baptiste Kempf » 28 Jun 2016 10:12

Qt5 changes the handling of Windows. You need to use the extra part of Qt5 for that.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 16 guests