Go Back   TechArena Community > Software > Windows Software
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Unable to embed VLC in Qt-Widget MacOS

Windows Software


Reply
 
Thread Tools Search this Thread
  #1  
Old 17-04-2011
Member
 
Join Date: Jan 2011
Posts: 55
Unable to embed VLC in Qt-Widget MacOS
  

I am currently looking to integrate VLC into the custom application which should be portable between Mac and Windows. I have used the Alexander Maringer in the Wiki and I have successfully embedded VLC through Qt-application on the Windows. However I have tried to do the same with the Mac but it did not working. The App is seems to crash every time when I am trying the same. Let me know if you are having any suggestion to meet the requirement of mine. Thanks a lot in advance.

Reply With Quote
  #2  
Old 17-04-2011
Member
 
Join Date: Nov 2008
Posts: 1,192
Re: Unable to embed VLC in Qt-Widget MacOS

Well according to me one should remove the macosx-plugin from the computer and one should try with the 1.0.0 release candidate. QuickTime 4.5 is now having QMacCocoaViewContainer which is wrapping Cocoa NSView into the QWidget. Another one thing you can try libvlc_media_player_set_nsobject apart from the pointer not just to the NSView to render and not the instance of the VLCOpenGLVoutView which is located at the /modules/minimal_macosx/VLCOpenGLVoutView.h location.
Reply With Quote
  #3  
Old 17-04-2011
Member
 
Join Date: Jun 2009
Posts: 1,518
Re: Unable to embed VLC in Qt-Widget MacOS

I am suggesting the following thing which you can use to fix the problem of yours. You need to put libvlc headers and Qt headers in to folder and run the same.
Code:
qmake -project
Now you should edit the .pro file and add the following things.
Code:
LIBS += -L*path to vlc lib* #if you are at windows os
LIBS += -lvlc
Now run the File.
Code:
Qmake
Finally use the following thing on the terminal.
Code:
make or mingw32-make under a Windows OS
Reply With Quote
  #4  
Old 17-04-2011
Member
 
Join Date: Nov 2008
Posts: 1,514
Re: Unable to embed VLC in Qt-Widget MacOS

I am having particular solution which you can use to fix the problem of yours.
You should do the following changes into main.cpp
Code:
- |   QFrame *_videoWidget;

+ |   QMacCocoaViewContainer *_videoWidget;
Now do the following changes into vlc_on_qt.mm.
Code:
+ |   #undef slots  
+ |   // yes, otherwise there's a confilct in some framework's header file 
+ |   // please, suggest a cleaner way to do that.

+ |   #import <VLCKit/VLCKit.h>
___________________________________________________________________________
- |   libvlc_media_player_set_agl (_mp, _videoWidget->winId(), &_vlcexcep); // for vlc 1.0

+ |   VLCVideoView *videoView = [[VLCVideoView alloc] init];
+ |   _videoWidget->setCocoaView(videoView);   
+ |   [videoView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
+ |   libvlc_media_player_set_nsobject(_mp, videoView, &_vlcexcep);
I am hoping that it will help you out to solve the problem of yours.
Reply With Quote
  #5  
Old 17-04-2011
Member
 
Join Date: Mar 2009
Posts: 1,360
Re: Unable to embed VLC in Qt-Widget MacOS

Well after using the above mentioned solution you will see that the VLC would be hanging. You can solve the matter by simply creating the symbolic link between lib and modules to the respective directories into the <Application bundle>/Contents/Frameworks/Versions/Current/. Rather than duplicating libraries of the bundle. I am hoping that the solution which would be helpful to solve the problem of yours.
Reply With Quote
  #6  
Old 20-04-2011
Member
 
Join Date: Nov 2008
Posts: 1,259
Re: Unable to embed VLC in Qt-Widget MacOS

I am providing some code of the libvlc wrapper over here which would be helpful to you.
Code:
Constructor 
LCPlayer::VLCPlayer()
   : QWidget()
{
   const char * const vlc_args[] = {
         "-I", "dummy"         // Don't use any interface
         ,"--ignore-config"      // Don't use VLC's config
         ,"--verbose=-1"
         ,"--quiet"
   #ifdef Q_WS_MAC
                  , "--vout=minimal_macosx"
                  , "--opengl-provider=minimal_macosx"
   #endif
      };

      
   int argc = sizeof(vlc_args) / sizeof(vlc_args[0]);

   _vlcinstance   = libvlc_new( argc, vlc_args, &VLCException(this) );
   _media_player   = libvlc_media_player_new( _vlcinstance, &VLCException(this) );
   _media_descr    = NULL;

   #ifdef Q_WS_MAC && VLC_VERSION_1_0
      _videoWidget = NULL;
      _wrapperLayout = new QVBoxLayout;
      _wrapperLayout->setContentsMargins(0,0,0,0);
      setLayout(_wrapperLayout);
   #endif

   // Create a timer to poll player state. That way it works. Using vlc's event manager caused some problems with threads.

        // That's it. Window will be attached once we actually start playing.
}
Code:
 Destructor 
VLCPlayer::~VLCPlayer()
{
   _poller->stop();
   Stop();
   libvlc_media_player_release (_media_player);
   libvlc_release (_vlcinstance);   
}
Load
Code:
void   VLCPlayer::Load( IN QString & url)
{
   Stop();

   if (_media_descr) libvlc_media_release( _media_descr );
   _media_descr = libvlc_media_new (_vlcinstance, url.toAscii(), &VLCException(this) );

   // Creating parameter string 'options'

   libvlc_media_add_option      ( _media_descr,   options,   &VLCException(this) );
   libvlc_media_player_set_media   ( _media_player, _media_descr,   &VLCException(this) );

   attachPlayerToWnd();
}
attachPlayerToWnd()
Code:
// Tell LibVLC to render video into our widget 
void VLCPlayer::attachPlayerToWnd()
{
   #if defined(Q_WS_WIN)
      #if defined( VLC_VERSION_0_9 )
         libvlc_media_player_set_drawable(_media_player, reinterpret_cast<unsigned int>(winId()), &VLCException(this) );
      #elif defined ( VLC_VERSION 1_0 )
         libvlc_media_player_set_hwnd(_media_player, winId(), &VLCException(this) );
      #endif
   #elif defined(Q_WS_MAC)
      #if defined( VLC_VERSION_0_9 )
         libvlc_media_player_set_drawable(_media_player, winId(), &VLCException(this) );
      #elif defined( VLC_VERSION_1_0 )

         _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) );
         [videoView release];
         
         [pool release];

         //@
         _videoWidget->hide();
      #endif
   #elif defined( Q_WS_X11 ) 
      #if defined( VLC_VERSION_0_9 )
         libvlc_media_player_set_drawable(_media_player, winId(), &VLCException(this) );
      #elif defined( VLC_VERSION_1_0 )
         libvlc_media_player_set_xwindow(_media_player, winId(), &VLCException(this) );
      #endif
   #endif
}

 Finally code for the Play and stop options of the VLC.
void   VLCPlayer::Play()
{
   libvlc_media_player_play( _media_player, &VLCException(this) );
   
   #ifdef Q_WS_MAC
      if (_videoWidget) _videoWidget->show();
   #endif

   _poller->start();
}
Reply With Quote
Reply

  TechArena Community > Software > Windows Software
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Unable to embed VLC in Qt-Widget MacOS"
Thread Thread Starter Forum Replies Last Post
Unable to load widget after rebooting LG Revolution GanMan Portable Devices 10 29-12-2011 02:18 PM
Unable to add widget in Sony Ericsson Xperia Arc Harin$Akshi Portable Devices 6 14-05-2011 03:38 PM
Unable to reinstall a Widget 2.0. Tallulah Windows Software 5 19-04-2011 10:42 PM
Embed Weather Widget to Webpage Benjycool Software Development 3 23-05-2009 07:27 PM
Unable to embed an OLE object in an Access OLE field Santanio Windows Software 2 05-05-2009 11:56 AM


All times are GMT +5.5. The time now is 07:23 AM.