Getting started with LibVLC

This forum is about all development around libVLC.
Marc Kupper
New Cone
New Cone
Posts: 8
Joined: 27 Sep 2013 05:43
VLC version: 3.0.7.1
Operating System: Windows

Getting started with LibVLC

Postby Marc Kupper » 27 Sep 2013 05:50

Is there a "hello world" available for LibVLC for Windows? Which language compilers/interpreters should someone use?

mangokm40
Cone that earned his stripes
Cone that earned his stripes
Posts: 130
Joined: 20 May 2010 20:00

Re: Getting started with LibVLC

Postby mangokm40 » 27 Sep 2013 14:22

I use C++ in VS2010 for my libvlc "hobby".

If you Google "doxygen VLC", you can get the documentation page.

You can also start here: wiki.videolan.org/LibVLC.

have fun. :)

Marc Kupper
New Cone
New Cone
Posts: 8
Joined: 27 Sep 2013 05:43
VLC version: 3.0.7.1
Operating System: Windows

Re: Getting started with LibVLC

Postby Marc Kupper » 28 Sep 2013 21:28

Getting and installing VS2010 Express is easy enough though it means this thread might get topic-banned as VS2010 is not open-source. It may be better if we steer people into how to download and set up gcc for Windows. Plus, vlc 2.0.8 was compiled with gcc. VLC 2.1.0's help/about does not say if they use gcc to build the Windows executable or have switched to something else.

For now, I installed VS2010 Express and I then realized there is no explanation of where someone can download LibVLC from. Both http://www.videolan.org/vlc/libvlc.html and https://wiki.videolan.org/LibVLC seem to assume that people already have LibVLC and are silent on how to get it. Google 'download LibVLC' also turned up nothing of interest. I puzzled over that for a moment and then decided to look in C:\Program Files\VideoLAN where I found:
  • C:\Program Files\VideoLAN\VLC\libvlc.dll
  • C:\Program Files\VideoLAN\VLC\sdk\include\vlc\libvlc.h
  • C:\Program Files\VideoLAN\VLC\sdk\lib\libvlc.lib
I found you can't do a direct

Code: Select all

#include "C:/Program Files/VideoLAN/VLC/sdk/include/vlc/libvlc.h"
but instead need to add "C:\Program Files\VideoLAN\VLC\sdk\include" to the list of include directories. If someone is doing a one-off project that uses LibVlc then from VS2010 Express it's Alt-F7 to bring up the project properties / Configuration Properties:
  • VC++ Directories / Include Directories - Add "C:\Program Files\VideoLAN\VLC\sdk\include".
  • VC++ Directories / Library Directories - Add "C:\Program Files\VideoLAN\VLC\sdk\lib".
  • Linker / Input / Additional Dependencies - Add libvlc.lib
How do people that use LibVLC normally deal with that "C:\Program Files\VideoLAN\VLC" is not in the path so that libvlc.dll can be located? For now, I added it to my path.

For testing, my "hello world" was supposed to play a DVD much like running VLC from the command line. This works from the command line "start vlc.exe --fullscreen --no-video-title-show dvd:///F:/#1" When I run the C code below I get "success" from libvlc_new() but there's no evidence the DVD is playing. I know that libvlc.dll is getting loaded. If I pass junk in the vlc_args list then I get an error back about that I should try --help.

Code: Select all

// Test-LibVLC.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <vlc/libvlc.h> int _tmain(int argc, _TCHAR* argv[]) { libvlc_instance_t * vlcInstance; const char * const vlc_args[] = { "--fullscreen", "--no-video-title-show", "dvd:///F:/" }; printf ("Starting VLC...\n"); vlcInstance = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args); if (vlcInstance) { printf ("Success - VLC loaded. Press a key to exit.\n"); getchar(); libvlc_release (vlcInstance); vlcInstance = NULL; } else { fprintf(stderr, "Error, libvlc_new() failed: %s", libvlc_errmsg ()); } return 0; }

mangokm40
Cone that earned his stripes
Cone that earned his stripes
Posts: 130
Joined: 20 May 2010 20:00

Re: Getting started with LibVLC

Postby mangokm40 » 30 Sep 2013 16:39

. I don't compile libvlc. If that's what you wanted to do, I'm sorry. I didn't realize that.
. The page that has the link to download the VLC windows executable also has a link for source code tarball.
. The header files I use are in that source code (the include/vlc directory).
. The libvlc.dll and libvlccore.dll that I link to come from the windows install (or zip) package, currently 2.1.0.
. I also create a libvlc.lib according to these instructions: http://wiki.videolan.org/GenerateLibFromDll
Hope that's of some use to someone. :)

HyperZen
New Cone
New Cone
Posts: 1
Joined: 27 Jul 2017 17:39

Re: Getting started with LibVLC

Postby HyperZen » 27 Jul 2017 17:43

The dll file is inside the tarball located here: https://www.videolan.org/vlc/download-sources.html
Click "VLC source code tar.xz"
It needs to go through 2 rounds of extraction to reach the files.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 7 guests