Page 1 of 1
LibVLC, QT and Mac
Posted: 18 Apr 2012 02:25
by Brit
I have libVLC setup in my QT project and I've finally gotten to a place where it doesn't crash, but I can't seem to play any videos. After I load a video and attempt to play it, the widget just appears blank and has no sound. When I call libvlc_media_player_get_length( m_pMediaPlayer ), I get a return value of 0, which makes me think VLC isn't loading the video at all. I've spent a ton of time searching google for a solution, but haven't found anything that works. I'm about ready to give up.
Rather than post my code, I'll just ask this question: does anyone have LibVLC working on Qt for Mac? Can I look at the code? I'd be happy to update the wiki so other people can get it working, too.
Re: LibVLC, QT and Mac
Posted: 19 Apr 2012 15:04
by some_birdie
Is this only Mac problem? Does your code work on some other OS?
Re: LibVLC, QT and Mac
Posted: 19 Apr 2012 20:51
by Brit
Is this only Mac problem? Does your code work on some other OS?
Yes, I have libVLC working on Windows. There are a few mac-specific calls that have to be done to get it up and running on the Mac. I tried using a bunch of variations of code that I found on the web, but haven't gotten it to work. I don't know if that code only worked with older versions of Qt or VLC, though.
Re: LibVLC, QT and Mac
Posted: 24 Apr 2012 22:41
by Brit
I don't know what happened, but the file loads and plays sound now, but no video appears in the space where it's supposed to. Nobody has gotten this to work in Qt/Mac?
Re: LibVLC, QT and Mac
Posted: 25 Apr 2012 13:31
by Jean-Baptiste Kempf
How did you set the nsview?
Re: LibVLC, QT and Mac
Posted: 30 Apr 2012 19:48
by Brit
Right now, this is the code I'm using. The [this] object is a class I created which is derived from QWidget.
Code: Select all
libvlc_media_player_set_nsobject( m_pMediaPlayer, (void*)this->winId());
I had tried using some other code I found, but it wouldn't compile in C++ (it looks like Objective C to me?):
Code: Select all
_videoWidget = new QMacCocoaViewContainer(0);
_wrapperLayout->addWidget(_videoWidget);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
VLCVideoView *videoView = [[VLCVideoView alloc] init];
_videoWidget->setCocoaView(videoView);
//libvlc_media_player_set_nsobject(_media_player, videoView, &VLCException(this) );
libvlc_media_player_set_nsobject( m_pMediaPlayer, videoView );
//[videoView release];
//[pool release];
I tried commenting out the parts that looked like Objective C (everything in brackets), but the "VLCVideoView" class isn't defined.
I tried some other code I found on the internet, too, but couldn't get it to work, either.
Re: LibVLC, QT and Mac
Posted: 30 Apr 2012 20:14
by Jean-Baptiste Kempf
You need some obj-C for that, yes.
Re: LibVLC, QT and Mac
Posted: 30 Apr 2012 20:20
by Brit
You mean that I need objective C to get that particular piece of code to work, or do you mean it's impossible to get VLC to ever work on the Mac without Objective C?