Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

This forum is about all development around libVLC.
Jo2003
Blank Cone
Blank Cone
Posts: 67
Joined: 08 Feb 2010 13:29

Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jo2003 » 20 Oct 2012 14:29

I have a problem with libVLC > 2.0.1 on Mac Mountain Lion (64bit) when using libVLC in a Qt application. Every time I try to display the video the app crashes.

I'm using libVLC from VLC (64bit only), Qt 4.8.3, OSX 10.8.2 64bit

This worked fine with libVLC2.0.1 but since 2.0.3 it always crashes. Almost the same code on Windows / Linux works without a problem also with libVLC 2.0.4.

I wrote a simple test application which shows this behavior.

This is mainwindow.h

Code: Select all

#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <vlc/vlc.h> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_pushPlay_clicked(); void on_pushStop_clicked(); void on_pushGetFile_clicked(); private: Ui::MainWindow *ui; libvlc_media_player_t *_player; libvlc_instance_t *_lib; }; #endif // MAINWINDOW_H
This is mainwindow.cpp

Code: Select all

#include "mainwindow.h" #include "ui_mainwindow.h" #include <QFileDialog> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); _lib = NULL; _player = NULL; // create a new libvlc instance ... const char *vlc_args[] = { "--ignore-config", "--intf=dummy", "--no-media-library", "--no-osd", "--no-stats", "--no-video-title-show", #ifdef Q_WS_MAC // vout as well as opengl-provider MIGHT be "minimal_macosx" ... "--vout=macosx", #endif "--verbose=1" }; int argc = sizeof(vlc_args) / sizeof(vlc_args[0]); const char ** argv = vlc_args; _lib = libvlc_new(argc, argv); _player = libvlc_media_player_new(_lib); #ifdef Q_OS_WIN libvlc_media_player_set_hwnd (_player, (void *)ui->frame->winId()); #elif defined Q_OS_MAC libvlc_media_player_set_nsobject(_player, (void *)ui->frame->winId()); #else libvlc_media_player_set_xwindow(_player, ui->frame->winId()); #endif } MainWindow::~MainWindow() { libvlc_media_player_stop(_player); libvlc_media_player_release (_player); libvlc_release(_lib); delete ui; } void MainWindow::on_pushPlay_clicked() { if (ui->lineFile->text() != "") { libvlc_media_t* video = libvlc_media_new_path(_lib, ui->lineFile->text().toUtf8().constData()); if (video) { libvlc_media_player_set_media (_player, video); libvlc_media_release (video); libvlc_media_player_play (_player); } } } void MainWindow::on_pushStop_clicked() { if (libvlc_media_player_is_playing (_player)) { libvlc_media_player_stop (_player); } } void MainWindow::on_pushGetFile_clicked() { QString file = QFileDialog::getOpenFileName(this, tr("Open Media File"), QString(), tr("Matroshka (*.mkv);;Mpeg4 (*.m4?);;All Files (*.*)")); if (file != "") { ui->lineFile->setText(file); } }
Is this a known limitation? As I told it works until 2.0.1 but any newer version crashes. Do I have a problem in my code or is there a workaround?

Here you can download the whole source code as tgz package. http://rt.coujo.de/qtplay.tgz

Thank you for your help!

Best regards,
Jörg

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: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jean-Baptiste Kempf » 22 Oct 2012 11:26

Does it not crash if you remove libvlc_media_player_set_nsobject(_player, (void *)ui->frame->winId()); ?
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.

Jo2003
Blank Cone
Blank Cone
Posts: 67
Joined: 08 Feb 2010 13:29

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jo2003 » 22 Oct 2012 19:49

It doesn't crash if not running this function. But of course there is no video display when starting the playback. Sound is there.

When this function is enabled the program only crashes when starting to play a media file. So running this function in constructor itself doesn't lead to the crash.

Best regards,
Jörg

Jo2003
Blank Cone
Blank Cone
Posts: 67
Joined: 08 Feb 2010 13:29

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jo2003 » 24 Oct 2012 16:15

I can provide 2 app packages (one with 2.0.1, one with 2.0.4) if this helps?!

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: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jean-Baptiste Kempf » 25 Oct 2012 13:21

Because your winId() is not a NSObject. Use QMacCocoaViewContainer
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.

Jo2003
Blank Cone
Blank Cone
Posts: 67
Joined: 08 Feb 2010 13:29

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jo2003 » 25 Oct 2012 14:13

Actually winId() is a NSView object (which inherits from NSObject). Here is the help entry from Qt:
WId QWidget::winId () const
Returns the window system identifier of the widget.
...
On Mac OS X, the type returned depends on which framework Qt was linked against. ... If Qt is using Cocoa, {WId} is a pointer to an NSView.
...
... and as stated - it works with libVLC2.0.1!

Should I enter a bugreport?!

Best regards,
Jörg

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: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jean-Baptiste Kempf » 25 Oct 2012 14:52

Or find the regression...
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.

Rémi Denis-Courmont
Developer
Developer
Posts: 15257
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Rémi Denis-Courmont » 25 Oct 2012 16:11

This is probably an issue in the MacOS video output. I think it expects something else than an NSObject, confusingly enough.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Jo2003
Blank Cone
Blank Cone
Posts: 67
Joined: 08 Feb 2010 13:29

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jo2003 » 01 Nov 2012 13:52

Has this changed between 2.0.1 and 2.0.3?

daeq
New Cone
New Cone
Posts: 2
Joined: 17 Jan 2012 14:59

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby daeq » 13 Dec 2012 20:17

Hello! Have you been able to fix this problem? I have the same issue with Qt 4.8.8 MacOSX 10.8.2. I tried different versions of libvlc, including latest from git, but error remains.

Or is there alternative way to display video in window?

geostein8888
Cone that earned his stripes
Cone that earned his stripes
Posts: 142
Joined: 15 Dec 2010 11:32

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby geostein8888 » 21 Dec 2012 05:50

Hello,
i have the same problem with the crash when i set the nsobject in 2.05, did somebody found out how the siplay has to be so this works with the newer revs?

Georg

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: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jean-Baptiste Kempf » 21 Dec 2012 16:44

Did you try VLC 2.1.0 nightly build?
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.

daeq
New Cone
New Cone
Posts: 2
Joined: 17 Jan 2012 14:59

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby daeq » 13 Feb 2013 10:01

I've tried 2.1.0 nighly build. Problem remains the same.

lanamelach
Blank Cone
Blank Cone
Posts: 31
Joined: 18 Nov 2010 13:22

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby lanamelach » 29 Mar 2013 14:08

Have the same problem with Qt 4.8.4 + Mac OS X 10.6 + libvlc 2.0.5.
No milk today

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby sherington » 29 Mar 2013 19:57

I have been looking into a similar problem that affects my own libvlc bindings on MacOSX. I have been told by some of my users that reverting to vlc 2.0.3 works just fine, but any other version does not, including 2.1.0-git. This is clearly at odds with the original poster who states that vlc 2.0.3 does not work for them.

One of my users however states vlc 2.0.3 does not work for him either, so there's maybe some other factor in play here, but I don't know what it is.

I've diffed the code between 2.0.3 and 2.0.4 but I'm not a Mac developer nor am I a vlc developer, and I can't see anything obvious that might have caused this problem.

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: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jean-Baptiste Kempf » 01 Apr 2013 19:37

Hmm, I think the issue is more related to Qt, but I'll have a look.
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.

lanamelach
Blank Cone
Blank Cone
Posts: 31
Joined: 18 Nov 2010 13:22

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby lanamelach » 08 Apr 2013 08:38

Tested with this code. Works fine with vlc 2.0.1, vlc 2.0.2 and vlc 2.0.3, but with vlc 2.0.4 or 2.0.5 it crashes. Qt 4.8.4, Test platform: OSX 10.6.
No milk today

geostein8888
Cone that earned his stripes
Cone that earned his stripes
Posts: 142
Joined: 15 Dec 2010 11:32

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby geostein8888 » 24 May 2013 06:09

also with the 2.06 this is still an issue, but it looks like nobody is really interested to fix this, so i guess there must be a work around i do not know. I still can't use the versions after 2.01 in my source because of this. So when there is somebody who can give me a hint how to bring newer versions to work on mac i will be very happy.
I'm still confused how there can be such a big change in a .0x version change

Georg

lanamelach
Blank Cone
Blank Cone
Posts: 31
Joined: 18 Nov 2010 13:22

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby lanamelach » 05 Jun 2013 07:25

They don't fix it. Instead admin decided to ban me from this board :)
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: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jean-Baptiste Kempf » 07 Jun 2013 23:35

It was fixed for 2.0.7
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.

Jo2003
Blank Cone
Blank Cone
Posts: 67
Joined: 08 Feb 2010 13:29

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jo2003 » 21 Aug 2013 15:03

I'll try and report. So far I'm still using 2.01.

Best regards,
Jörg

Jo2003
Blank Cone
Blank Cone
Posts: 67
Joined: 08 Feb 2010 13:29

Re: Qt4.8.3 + MacOSX 10.8 + libVLC > 2.0.1 = crash

Postby Jo2003 » 26 Aug 2013 12:37

Yes, it works!

Many thanks for this!

Best regards,
Jörg


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 9 guests