VLCKit

From VideoLAN Wiki
Revision as of 23:38, 23 July 2009 by KPM (talk | contribs) (fixed problem in compilation -- see http://forum.videolan.org/viewtopic.php?t=62802)
Jump to navigation Jump to search

How to build the framework

$ git clone git://git.videolan.org/vlc.git
  • build the core components:
$ cd extras/contrib
$ ./bootstrap
$ make
$ cd ../..
$ ./bootstrap
$ export CC=/Developer/usr/bin/llvm-gcc-4.2
$ export CXX=/Developer/usr/bin/llvm-g++-4.2
$ export OBJC=/Developer/usr/bin/llvm-gcc-4.2
$ ./configure 
$ make

If the second make fails, giving you an error like:

   ld warning: in ///Users/username/dev/vlc/extras/contrib/lib/libx264.a, file is not of required architecture
   Undefined symbols:
      "_x264_encoder_close", referenced from:
      _Close in libx264_plugin_la-x264.o
   etc...

then download and build x264. Then copy libx264.a into vlc/extras/contrib/lib/

  • build the framework:
    • open projects/macosx/framework/VLCKit.xcodeproj
    • make sure the VLCKit target is selected
    • hit build


Basic usage in your application

The code should speak by itself

  // Set up a videoView by hand. You can also do that in the nib file
   videoView = [[VLCVideoView alloc] initWithFrame:[[window contentView] bounds]];
   [[window contentView] addSubview:videoView];
   [videoView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
  
   // Init the player object
   player = [[VLCMediaPlayer alloc] initWithVideoView:videoView];
 
   [player setMedia:[VLCMedia mediaWithPath:@"/to/my/movie"]];
   [player play];

Sample code

You should be able to find sample code in:

  • Framework/Examples: This is the folder that contains the VLC.framework basics usage.
  • vlc-trunk/extras/MacOSX/VLC_app: This is the VLC application that uses the framework intensivly, this is much more advanced.