C# Wrapper for libvlc 0.9.0 - Testers Required

This forum is about all development around libVLC.
Marx
Blank Cone
Blank Cone
Posts: 21
Joined: 08 Jun 2008 12:17

C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Marx » 11 Jun 2008 19:08

I've spent the last few days building a C# wrapper to the new API. Anything that has been depreciated has been removed. So far, I've implemented most of the API and I'm able to play media files and attach the process to a window:

libvlc_core
libvlc_media_player (libvlc_audio, libvlc_video)
libvlc_media_list
libvlc_media

I have a version of the following implemented, although I will be rewriting this as I've integrated it for testing purposes:

libvlc_exception
libvlc_log

The following are yet to be implemented. If I get some time this weekend, I should get the bulk of it done.

libvlc_event
libvlc_media_library
libvlc_media_discoverer
libvlc_vlm

The full wrapper should be ready for testing next week. At this stage, I will need some people to test functionality. I'll be migrating a frontend built in C# from the old API to this new API.

If anyone is interested, leave a message here and I'll notify everyone when its ready.

MuraliKaundinya
New Cone
New Cone
Posts: 2
Joined: 11 Jun 2008 03:17

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby MuraliKaundinya » 12 Jun 2008 01:58

I will be interested in testing those APIs. It would help me a lot if there were any supporting documentation on how to use the new APIs. At a minimum if you could show a sample on the sequence of function calls I need to make to play media from a URL and test all the error handling correctly, it will be helpful.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Jean-Baptiste Kempf » 12 Jun 2008 02:10

Topic stickied to see more coverage.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Marx
Blank Cone
Blank Cone
Posts: 21
Joined: 08 Jun 2008 12:17

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Marx » 12 Jun 2008 15:15

Thanks j-b...

MuraliKaundinya, the wrapper exposes the libvlc API almost identically. I've just had to modify the naming scheme, expose handles and arrange the methods in a structure appropriate for C#.

Without worry about cleaning up, etc., this is the basics of loading a file and playing it:

Code: Select all

public static void Main(string[] args) { string file = "hrd.avi"; //File to Play (Heavy Rain Demo :) IntPtr hDT = Win32.GetDesktopWindow(); //Handle to Desktop Window (from Win32) Marx_lib_vlc_new libvlc = new Marx_lib_vlc_new(); //Create instance of libvlc Marx_lib_vlc_media_new libvlc_media = new Marx_lib_vlc_media_new(libvlc.Handle, file); //Create instance of selected media Marx_media_player_new libvlc_media_player = new Marx_media_player_new(libvlc_media.Handle); //Create instance of the media player libvlc_media_player.video_set_parent(libvlc.Handle, hDT); //Attach libvlc to the Desktop for output libvlc_media_player.play(); //Play the file Console.ReadLine(); }
That's it. Now as you will notice, I've not passed through any Exception class. That's because I've made use of a class that is integrated into the wrapper. I'm debating if I should expose the exception class and require handles to be passed. I'm leaning towards a faithful replication of libvlc.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Jean-Baptiste Kempf » 12 Jun 2008 21:36

Thanks j-b...
U R welcome. Waiting to see more :D
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Marx
Blank Cone
Blank Cone
Posts: 21
Joined: 08 Jun 2008 12:17

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Marx » 14 Jun 2008 09:47

I spent yesterday restructuring the wrapper and ensuring the naming conventions were consistent. I've also extracted libvlc_exception from the code so that it functions in the same manner as the libvlc API. This version is better suited to handling multiple instances of libvlc running asynchronously.

I have the bulk of the API now wrapped and exposed as C# methods and properties. SafeHandles have been used to wrap the classes exposed by the libvlc API, so type safety and garbage collection are supported.

The following code is an example for the wrapper being used to play a stream from di.fm...

Code: Select all

static void Main(string[] args) { string link = "http://160.79.128.61:7244"; IntPtr hDT = Win32.GetDesktopWindow(); string[] argv = new string[] { "-I", "dummy", "--ignore-config" }; libvlc_exception_struct ex = new libvlc_exception_struct(); //Temporary init for struct (to be removed) ex.b_raised = 0; ex.i_code = 0; ex.psz_message = ""; //Create new libvlc instance, media instance from file and media player instance from media Marx_libvlc_core libvlc_core = new Marx_libvlc_core(argv, ref ex); Marx_libvlc_media libvlc_media = new Marx_libvlc_media(libvlc_core.Handle, link, ref ex); Marx_libvlc_media_player libvlc_media_player = new Marx_libvlc_media_player(libvlc_media.Handle, ref ex); //Dispose of media Handle and force garbage collection libvlc_media.Handle.Dispose(); GC.Collect(); libvlc_media = null; //Set the output Window and play libvlc_media_player.video_set_parent(libvlc_core.Handle, hDT, ref ex); libvlc_media_player.play(ref ex); //Wait for input (play for a while) Console.ReadKey(); //Release Media player resources libvlc_media_player.stop(ref ex); libvlc_media_player.Handle.Dispose(); GC.Collect(); libvlc_media_player = null; /* Bug - Will crash libvlc //Release core resources libvlc_core.Handle.Dispose(); GC.Collect(); libvlc_core = null; */ //Release unreferenced object resources GC.WaitForPendingFinalizers(); Console.ReadKey(); }
I have notice a bug in libvlc_release. If I try to dispose of the Handle, it results in an exception within libvlc. I'm using a nightly build (vlc-0.9.0-git-20080609-0004-win32) for testing purposes.

Can anyone confirm this?

I'm thinking about releasing a version of this tonight (VS 2005) so that people can begin testing whilst I code the rest. Apart for a handful of methods, It will have the following completed:

libvlc_core
libvlc_media
libvlc_media_player
libvlc_audio
libvlc_video
libvlc_media_list
libvlc_exception (struct only at this point)

Check back later, I'll post a link here...

Marx
Blank Cone
Blank Cone
Posts: 21
Joined: 08 Jun 2008 12:17

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Marx » 14 Jun 2008 12:26

This is coming along a little faster than I thought. Here is an updated list of the completed aspects of the wrapper:

libvlc_core
libvlc_media
libvlc_media_player
libvlc_audio
libvlc_video
libvlc_media_list
libvlc_exception (struct only at this point)
libvlc_media_library
libvlc_media_discoverer

This could expand before I release the first test version in the next few hours. :D

Marx
Blank Cone
Blank Cone
Posts: 21
Joined: 08 Jun 2008 12:17

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Marx » 14 Jun 2008 15:48

Well, here is a copy of the alpha version of the C# wrapper for libvlc 0.9.0:

http://www.2shared.com/file/3435685/4dd ... apper.html

Things you will need:

Visual Studio 2005
.NET Framwork 2.0
A nightly build (http://nightlies.videolan.org/build/win32/latest/)

Drop the 'plugins' folder into both the debug and release folders, as well as a copy of libvlc.dll and libvlc libvlccore.dll. Ensure you have 'Enable unmanaged code debugging' checked in the Debug section of the properties.

Compile a debug copy and run...you should hear di.fm...

Marx
Blank Cone
Blank Cone
Posts: 21
Joined: 08 Jun 2008 12:17

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Marx » 18 Jun 2008 15:23

Here is the first screenshot of the C# interface using the wrapper. I'll be uploading some new code soon that add more functions, corrects some bugs and demos the wrapper.

...images have been updated...see further in the thread...
Last edited by Marx on 20 Jun 2008 16:51, edited 1 time in total.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Jean-Baptiste Kempf » 18 Jun 2008 21:17

Nice to see.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Marx
Blank Cone
Blank Cone
Posts: 21
Joined: 08 Jun 2008 12:17

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Marx » 20 Jun 2008 16:51

Thanks J-B, its coming along quite nicely. libvlc is quite well designed and it makes the process a lot easier.

I have added PLS file support to the front-end, so playing streams from the web, or sharing playlists should be straightforward. I also abstracted the interface from the wrapper. This serves two functions, it makes the interface a little agnostic to changes in the underlying wrapper and also allows me to multi-thread the interface. So, no interruptions if the interface is taking its time.

I thought I'd upload a better screenshot...I'll remove the previous one to save some space...

Image

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Jean-Baptiste Kempf » 20 Jun 2008 20:01

Thanks J-B, its coming along quite nicely. libvlc is quite well designed and it makes the process a lot easier.

I have added PLS file support to the front-end, so playing streams from the web, or sharing playlists should be straightforward. I also abstracted the interface from the wrapper. This serves two functions, it makes the interface a little agnostic to changes in the underlying wrapper and also allows me to multi-thread the interface. So, no interruptions if the interface is taking its time.

I thought I'd upload a better screenshot...I'll remove the previous one to save some space...
Yes, I hope the new libvlc is well designed now (3rd redesign ? :D)...

Abstracting the interface is a very very good idea.
However, I would push xspf playlists over pls playlists for many reasons :D
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

ltwally
Blank Cone
Blank Cone
Posts: 14
Joined: 15 Apr 2008 05:21

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby ltwally » 21 Jun 2008 01:36

Can you explain what the benefit of this is, for users? I can already tell that the interface is much more attractive than we're used to with VLC (nothing against you VLC coders!). What other benefits are there? Memory-footprint? Speed? etc etc?

Also, how long till you have binaries available for testing? ;)

Marx
Blank Cone
Blank Cone
Posts: 21
Joined: 08 Jun 2008 12:17

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Marx » 21 Jun 2008 11:09

In terms of how this will benefit end users, the basic idea is to simplify the user interface. The amount of options provided by VLC is unbelievable, however, most users will use less than 20% of them. Those core options are all that is required to play the majority of media. Then there is also the focus of provide a better layout.

The target audience is the new user, technically challanged and those who want to just watch media, not get a Phd in VLC configuration. :lol:

The wrapper DLL and interface are currently sitting around 350K, so its a little larger than the current VLC interface. That said, this is not an issue these days.

The main thrust behind this, is to open libvlc to c# applications with a safe, robust, easy to use wrapper. The wrapper and interface will be open source, so it will be a matter of using the DLL, abstracting the functions required in a class and that will enable anyone to put multithreaded multi-media capabilities in any application very rapidly.

A further benefit is Mono. This should be easy enough to port to other platforms. It would be good to see more apps focus greater attention on the UI, rather than just adding functionality. There is a balance between the two, your app can have all the functionality in the world, however, if it makes new users uncomfortable, or feel technically inadequate (read stupid), then they will abandon it for a different app.

ltwally
Blank Cone
Blank Cone
Posts: 14
Joined: 15 Apr 2008 05:21

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby ltwally » 23 Jun 2008 21:33

Will the "power-user" options still be available, but tucked away? Or will they simply be inaccessible with the C# wrapper/gui ?

Personlly, I rate myself as a power user... but I too would very much like to see a better gui for VLC - especially one that has a more modern "Windows" feel. It's actually been on the top of my wish-list for quite some time.

The preview screenshots look quite attractive. The black with blue-icons.. nice. Will it be skinnable, or at least have a colour chooser, like WMP does?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Jean-Baptiste Kempf » 23 Jun 2008 21:58

Personlly, I rate myself as a power user... but I too would very much like to see a better gui for VLC - especially one that has a more modern "Windows" feel. It's actually been on the top of my wish-list for quite some time.
There is a new GUI in VLC 0.9.0, and this isn't the object of this thread...
But wtf does "a more modern Windows feel" mean ?
Office, Live Messenger, Live Mail, Outlook, WMP, Explorer have all a different look, so what is a windows feel ?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Marx
Blank Cone
Blank Cone
Posts: 21
Joined: 08 Jun 2008 12:17

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Marx » 24 Jun 2008 05:04

There is a new GUI in VLC 0.9.0, and this isn't the object of this thread...
I agree, the purpose of this thread is to test the wrapper and inform people of new releases.
But wtf does "a more modern Windows feel" mean ?
Office, Live Messenger, Live Mail, Outlook, WMP, Explorer have all a different look, so what is a windows feel ?
I think he is referring to Vista's transition to a black colour scheme and how the interface I have been working on fits well with that and glossy screens. VLC's interface is still based upon a style found in business applications and Win2K colour schemes. I know its a result of the cross-OS development tool chain, but Windows users only see the end product and first impressions count.
Will the "power-user" options still be available, but tucked away? Or will they simply be inaccessible with the C# wrapper/gui ?
Anything that is required to watch media will be exposed. I may create a power user version and add some advanced features to it at a later stage. The main purpose of this interface is to serve as a coding example, so I want to keep the features to a mininium and that fits well with deploying it to new users.
The preview screenshots look quite attractive. The black with blue-icons.. nice. Will it be skinnable, or at least have a colour chooser, like WMP does?
Not at this point. That may be a feature of a power user's version. The code will be open source and I'm sure there will be a lot of variations in time.

ltwally
Blank Cone
Blank Cone
Posts: 14
Joined: 15 Apr 2008 05:21

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby ltwally » 24 Jun 2008 20:36

Personlly, I rate myself as a power user... but I too would very much like to see a better gui for VLC - especially one that has a more modern "Windows" feel. It's actually been on the top of my wish-list for quite some time.
...and this isn't the object of this thread...
I did not know that there was another place to discuss the end-user type questions I had about Marx's C# work. Feel free to move my posts to that thread, if it exists.
There is a new GUI in VLC 0.9.0, ....
But wtf does "a more modern Windows feel" mean ?
Office, Live Messenger, Live Mail, Outlook, WMP, Explorer have all a different look, so what is a windows feel ?
I think he is referring to Vista's transition to a black colour scheme and how the interface I have been working on fits well with that and glossy screens. VLC's interface is still based upon a style found in business applications and Win2K colour schemes...
I didn't come here looking to start a flame war, or to insult you. I will only say that I have used VLC for about 4 years, and in that time VLC's interface has not changed, and is really starting to feel out-dated. And, yes, I have tested a 0.9 beta... I was not a fan of the new GUI. So, one of the advantages I'm hoping for with Marx's project is something that just plain looks nicer. I'm sorry if that offends you.

Teddy
New Cone
New Cone
Posts: 1
Joined: 25 Jun 2008 11:21

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Teddy » 25 Jun 2008 15:40

Great :D
I am looking for a vlc-c#-Wrapper, but the wrapper for the version 0.86 are not very good.

Your C#-Wrapper for 0.9 ist fantistic.
five minutes, and a winforms-app is written :lol:
Of cause, I'am interesting on the new "test-version" on the wrapper.

Now, I miss two functions in the libvlc-api:
- to get the total frames of the video
- to get the current frame-position in the video

And I have problems with the function "pause". The video will not halted on the current position. After the stop, the video will start 1-2 second after the pause.
If I use "stop", the period of time is lower

Marx
Blank Cone
Blank Cone
Posts: 21
Joined: 08 Jun 2008 12:17

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Marx » 26 Jun 2008 14:53

Your C#-Wrapper for 0.9 ist fantistic.
five minutes, and a winforms-app is written :lol:
Of cause, I'am interesting on the new "test-version" on the wrapper.
It makes the whole process a lot easier. I started out several weeks ago with those old wrappers and I wasn't impressed either. The redesign of libvlc has help a lot though.
Now, I miss two functions in the libvlc-api:
- to get the total frames of the video
- to get the current frame-position in the video
I'm working on it, I just need some free time. Then I'll finish off the wrapper and release it.
And I have problems with the function "pause". The video will not halted on the current position. After the stop, the video will start 1-2 second after the pause.
If I use "stop", the period of time is lower
The pause function causing a delayed restart of the video is a known issue with libvlc. Several people have now reported it. Keep an eye on the nightly builds, when someone has a chance I'm sure they'll look at it in-depth.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Jean-Baptiste Kempf » 26 Jun 2008 19:38

Marx: How can we help the distribution of your work ?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

atmo
Blank Cone
Blank Cone
Posts: 41
Joined: 28 Jan 2008 12:59

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby atmo » 26 Jun 2008 19:55

Hi,
just after reading the announce of j-b on the dev mailing list I started to read your forum posting, the .NET wrapper my be interesting for the guys working on MediaPortal - which is completly based on C# and .NET and currently sticks on Windows Mediaplayer - may be they want to use something else - if they knew you work?

may be you would like to drop a posting here? http://forum.team-mediaportal.com/newcomers-forum-240/ (or in some of the other english sub forums?) or if you like - there are also german discussion groups...
--
Atmo
a VLC - Windows - Developer

God gives some people a halo. I gave my TV AtmoLight :-) 1 2

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Jean-Baptiste Kempf » 26 Jun 2008 20:45

Hi,
just after reading the announce of j-b on the dev mailing list I started to read your forum posting,
Hey, that was not useless then !
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Cheetah
New Cone
New Cone
Posts: 6
Joined: 19 Jan 2008 12:25

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Cheetah » 27 Jun 2008 01:07

Hi,
just after reading the announce of j-b on the dev mailing list I started to read your forum posting, the .NET wrapper my be interesting for the guys working on MediaPortal - which is completly based on C# and .NET and currently sticks on Windows Mediaplayer - may be they want to use something else - if they knew you work?

may be you would like to drop a posting here? http://forum.team-mediaportal.com/newcomers-forum-240/ (or in some of the other english sub forums?) or if you like - there are also german discussion groups...
They know. There are reasons they chose WMP.

But a plugin for using VLC in MediaPortal already exists based on the 0.8.6 wrapper i believe so I will point the author to this thread.

Marx
Blank Cone
Blank Cone
Posts: 21
Joined: 08 Jun 2008 12:17

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Marx » 28 Jun 2008 19:02

Marx: How can we help the distribution of your work ?
Right now, this is enough. I want to get the wrapper finished and properly tested. It means that I won't have a headache dealing with pre-release versions. When its finished, I'll upload it to a repository where everyone can access it. The idea is to produce a wrapper for each version of VLC that is released.

As for a release of the interface, I normally distribute my freeware software via networks such as CNET, Softpedia, Windowsmarketplace, Tucows, etc.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 20 guests