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;
}