C# VLC 1.1 Wrapper

15,271

Solution 1

I'm using http://www.codeproject.com/KB/audio-video/nVLC.aspx - it's excellent and the most recent library I've found for C#.

It should be noted that although the library is listed with GPL license, its author said in comments that it uses the same license libVLC uses, which as of version 2.0 is LGPL.

Solution 2

libvlc.net now has support for libVLC 1.1.x. You'll have to grab the sources from the SVN repository; they haven't officially released this support yet.

http://sourceforge.net/projects/libvlcnet/

Solution 3

I was looking for this too and I have found that most of the .NET wrappers out there either are outdated and don't work right away or have license that don't suit a proprietary software.

Said that, I started to think about building my own wrapper. Since most of the wrappers had too much code and are very confusing to understand and use, the idea of making myself the wrapper was growing. Said that, http://www.helyar.net/2009/libvlc-media-player-in-c-part-2/ is a nice place where to start making your own code.

Note that libvlc and libvlccore have changed license to LGPL. And as Jean-Baptiste Kempf said in one videolan forum thread: "You may grab the dlls (libVLC and libVLCcore) that come along with VLC installation >= 2.0.0."

Now to get it working, you have to put libvlc.dll and libvlccore.dll in the same directory as your exe file as some of the code is pointing to local dir...

To interop with one function from libvlc do the following:

Create a class that will hold the functions you'd like to interop with:

static class LibVlc
    {
        [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr libvlc_new(int argc, [MarshalAs(UnmanagedType.LPArray,
          ArraySubType = UnmanagedType.LPStr)] string[] argv);

        [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl)]
        public static extern void libvlc_release(IntPtr instance);
    }

With help from vlc docs, libvlc.html">http://www.videolan.org/developers/vlc/doc/doxygen/html/group_libvlc.html, you can have only the functions you need and nothing more.

The CallingConvention = CallingConvention.Cdecl is neede for .NET 4.0+. The two above functions won't do anything interesting by themselves. They are just initialising and releasing resources needed by VLC framework.

Careful with file paths (specially when linking to the plugins folder) as they need to have "/" instead of "\" as in "C:/Program Files/..."

Share:
15,271
MorgoZ
Author by

MorgoZ

Updated on June 04, 2022

Comments

  • MorgoZ
    MorgoZ almost 2 years

    Does anyone know about a C# VLC 1.1 Wrapper? I've found some wrappers for older versions of VLC (haven't tried them yet), but none for the new version.

    So if you know of any, please post them.

  • Security Hound
    Security Hound almost 12 years
    I don't understand the purpose of this answer. You claim you have not been able to use it, and you are getting a null result for a method, you really should include the content from the website itself.
  • HFSDev
    HFSDev almost 12 years
    I'll edit my answer since I'm now able to run it. I thought that he could take a look at it eventhough I was not able to get it running.
  • HFSDev
    HFSDev almost 12 years
    Really didn't understand the down vote :/ I was sure that it was something with my code, and not with the blog's post and that it was worth sharing since I had troubles finding it. I think i'm going to get banned if continue to get downvotes like this.
  • Security Hound
    Security Hound almost 12 years
    All you do is link to a 3 year old blog post. This answer does not expand on Spiderdevil's or Sean's answer. Until you either put more effort ( code ) into your answer I cannot remove my downvote. You still did not include the content from the website.
  • HFSDev
    HFSDev almost 12 years
    Maybe now? :) I understand you, but I don't like the idea of copying pasting the content of ones blog without having the user to visit the blog. And the 3 year old blog post saved my life :)