Difference between revisions of "VLCKit"

From VideoLAN Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
== How to build the framework ==
 
== How to build the framework ==
  
* '''get the [[Git|VLC Source Code from Git]]''':
+
Follow the quicksteps for your system on the [[OSXCompile | Building on Mac OS X]] page to build VLC.
$ 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:
 
If the second make fails, giving you an error like:
Line 27: Line 13:
 
then download and build x264. Then copy libx264.a into vlc/extras/contrib/lib/
 
then download and build x264. Then copy libx264.a into vlc/extras/contrib/lib/
  
* '''On Snow Leopard some additional flags are required to build a 32-bit copy'''
+
=== To build on Snow Leopard with 32-bit ===
$ cd extras/contrib
+
On 10.6 64-bit compiling is default and also recommended (see [[OSXCompile | Building on Mac OS X]]). To build with 32-bit you need to set the environment as followed:
$ ./bootstrap
+
 
$ make
+
  $ [...]
  $ cd ../..
 
$ ./bootstrap
 
 
  $ export CC=/Developer/usr/bin/llvm-gcc-4.2
 
  $ export CC=/Developer/usr/bin/llvm-gcc-4.2
 
  $ export CXX=/Developer/usr/bin/llvm-g++-4.2
 
  $ export CXX=/Developer/usr/bin/llvm-g++-4.2
Line 40: Line 24:
 
  $ export OBJCFLAGS="-arch i386 -m32"
 
  $ export OBJCFLAGS="-arch i386 -m32"
 
  $ export LDFLAGS="-arch i386"
 
  $ export LDFLAGS="-arch i386"
  $ ./configure
+
  $ [...]
$ make
+
 
 +
=== Build the framework ===
  
* '''build the framework''':
+
* open <code>./vlc/extras/package/macosx/VLCKit.xcodeproj</code>
** open projects/macosx/framework/VLCKit.xcodeproj  
+
* make sure the VLCKit target is selected  
** make sure the VLCKit target is selected  
+
* rightclick on target and build
** hit build
 
  
 
== Basic usage in your application ==
 
== Basic usage in your application ==

Revision as of 16:26, 20 December 2009

How to build the framework

Follow the quicksteps for your system on the Building on Mac OS X page to build VLC.

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/

To build on Snow Leopard with 32-bit

On 10.6 64-bit compiling is default and also recommended (see Building on Mac OS X). To build with 32-bit you need to set the environment as followed:

$ [...]
$ 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
$ export CFLAGS="-arch i386 -m32"
$ export CXXFLAGS="-arch i386 -m32"
$ export OBJCFLAGS="-arch i386 -m32"
$ export LDFLAGS="-arch i386"
$ [...]

Build the framework

  • open ./vlc/extras/package/macosx/VLCKit.xcodeproj
  • make sure the VLCKit target is selected
  • rightclick on target and 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.