C# Wrapper for libvlc 0.9.0 - Testers Required

This forum is about all development around libVLC.
benshole
New Cone
New Cone
Posts: 6
Joined: 29 Sep 2008 18:06

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby benshole » 24 Nov 2008 13:00

I think i found a solution to the problem i was having changing media. I thought i would just throw it up here incase anyone else was having a similar issue.

The problem i was having was that when calling video_set_parent the libvlc_core object was losing its handle.
I sorted it by creating a new instance of lib_vlc core and all other object whenever changing media. I initially didnt think about doing this as i thought it would mean waiting for VLC to load in the background again. However this doesn't seem to be the case.

However there is still an issue when closing the forms application as it appears VLC doesn't die gracefully. I get a debug request whenever i close the program.
I'm not sure if this is due to libvlc or the c# wrapper. But its certainly annoying thats for sure!

Beardless2
Cone that earned his stripes
Cone that earned his stripes
Posts: 125
Joined: 02 Feb 2007 09:53

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Beardless2 » 23 Dec 2008 15:36

"However there is still an issue when closing the forms application as it appears VLC doesn't die gracefully. I get a debug request whenever i close the program.
I'm not sure if this is due to libvlc or the c# wrapper. But its certainly annoying thats for sure!"

I think its libvlc. I have used a Delphi wrapper and the ActiveX plugins and i have problems with destroying vlc. Stopping the video before destroying does seem to help a bit but i am still getting it to hang.

e.beckers
New Cone
New Cone
Posts: 5
Joined: 23 Dec 2008 15:10

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby e.beckers » 23 Dec 2008 15:48

Hi

I think there is a memory leak in the "C#" wrapper.
I've made a small simple application which plays 1 video over and over again.
The more times you play the video, the more memory gets consumed until you reach a point where the system is out of memory.
On my pc it leaks +/- 512Kbyte for each time the file gets played.
Note that the memory leak does not happen when playing the file in VLC.exe itself

For those interested, the demo app (with source) can be downloaded from:
http://www.sendspace.com/file/ngmgej

to test simply:
- donwload & unrar it to a folder
- run it (VlcMemoryLeak\VlcMemoryLeak\bin\Debug\VlcMemoryLeak.exe)
- click on the open file button and select a movie
- when its playing the movie, take a note of the memory usage in the task manager
- wait until movie is played >10 times
- look at the memory usage in the task manager again...

T0T4L
New Cone
New Cone
Posts: 6
Joined: 04 May 2007 20:44

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby T0T4L » 17 Jan 2009 19:00

Hello guys,

I need to know if it's possible to set a Buffertime (ora http caching) and how using this wrapper.

Thanks in advance!

elund
Blank Cone
Blank Cone
Posts: 18
Joined: 22 Jan 2009 10:42

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby elund » 27 Jan 2009 15:20

Sorry, I've been busy on project work. I'll be releasing the source of the Media player interface and wrapper soon.
Hi Marx!

Nice work! Did you ever release the source of the Media Player interface?

I want to test your C# Wrapper, because I have some problems with the other 2 wrappers discussed in this forum.
A GUI would be very nice for a flying start :)

Thanks in advance, Elund

astlin
New Cone
New Cone
Posts: 3
Joined: 27 Jan 2009 12:25

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby astlin » 27 Jan 2009 20:04

exception while running Marx_libvlc_wrapper_test.exe: System.BadImageFormatException:
HRESULT: 0x8007000B
в Marx_libvlc_wrapper.Marx_libvlc_exception.libvlc_exception_init(libvlc_exception_struct& ex)
в Marx_libvlc_wrapper.Marx_libvlc_exception.init(libvlc_exception_struct& ex) в C:\Users\DNA User\Documents\Visual Studio 2008\Projects\Ma
rx_libvlc_wrapper\Marx_libvlc_wrapper\Marx_libvlc_exception.cs:line 50
в Marx_libvlc_wrapper.Marx_libvlc_exception..ctor(libvlc_exception_struct& ex) в C:\Users\DNA User\Documents\Visual Studio 2008\Projects\M
arx_libvlc_wrapper\Marx_libvlc_wrapper\Marx_libvlc_exception.cs:line 41
в Marx_libvlc_wrapper_test.Program.Main(String[] args) в C:\Users\DNA User\Documents\Visual Studio 2008\Projects\Marx_libvlc_wrapper\Marx_
libvlc_wrapper_test\Program.cs:line 49

using vlc 0.9.4, any ideas?

elund
Blank Cone
Blank Cone
Posts: 18
Joined: 22 Jan 2009 10:42

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby elund » 28 Jan 2009 11:51

Hi!

Can someone sketch how to create and use a Marx_libvlc_media_list object?

Thanks in advance, Elund

elund
Blank Cone
Blank Cone
Posts: 18
Joined: 22 Jan 2009 10:42

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby elund » 29 Jan 2009 10:56

Can someone sketch how to create and use a Marx_libvlc_media_list object?
Is there missing an implementation of libvlc_media_list_player in the Marx C# Wrapper?

Best regards, Elund

elund
Blank Cone
Blank Cone
Posts: 18
Joined: 22 Jan 2009 10:42

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby elund » 02 Feb 2009 15:59

Is there missing an implementation of libvlc_media_list_player in the Marx C# Wrapper?
I have now implemented Marx_libvlc_media_list_player:

Code: Select all

using System; using System.Runtime.InteropServices; using System.IO; namespace Marx_libvlc_wrapper { #region Handle for libvlc_media_list_player public class Marx_libvlc_media_list_player_handle : SafeHandle { public Marx_libvlc_media_list_player_handle() : base(IntPtr.Zero, true) { } public override bool IsInvalid { get { return handle == IntPtr.Zero; } } protected override bool ReleaseHandle() { if (!IsInvalid) { libvlc_media_list_player_release(this); handle = IntPtr.Zero; } return true; } protected override void Dispose(bool disposing) { ReleaseHandle(); base.Dispose(disposing); } [DllImport("libvlc")] private static extern void libvlc_media_list_player_release(Marx_libvlc_media_list_player_handle libvlc_media_list_player_handle); } #endregion public class Marx_libvlc_media_list_player { private Marx_libvlc_media_list_player_handle libvlc_media_list_player_handle; #region Constructor public Marx_libvlc_media_list_player(Marx_libvlc_core_handle libvlc_core_handle, ref libvlc_exception_struct ex) { libvlc_media_list_player_handle = libvlc_media_list_player_new(libvlc_core_handle, ref ex); } #endregion #region Properties public Marx_libvlc_media_list_player_handle Handle { get { return libvlc_media_list_player_handle; } } #endregion #region Methods public void set_media_player(Marx_libvlc_media_player_handle libvlc_media_player_handle, ref libvlc_exception_struct ex) { libvlc_media_list_player_set_media_player(libvlc_media_list_player_handle, libvlc_media_player_handle, ref ex); } public void set_media_list(Marx_libvlc_media_list_handle libvlc_media_list_handle, ref libvlc_exception_struct ex) { libvlc_media_list_player_set_media_list(libvlc_media_list_player_handle, libvlc_media_list_handle, ref ex); } public void play(ref libvlc_exception_struct ex) { libvlc_media_list_player_play(libvlc_media_list_player_handle, ref ex); } public void pause(ref libvlc_exception_struct ex) { libvlc_media_list_player_pause(libvlc_media_list_player_handle, ref ex); } public int is_playing(ref libvlc_exception_struct ex) { return libvlc_media_list_player_is_playing(libvlc_media_list_player_handle, ref ex); } //TODO: libvlc_state public void play_item_at_index(int index, ref libvlc_exception_struct ex) { libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_handle, index, ref ex); } public void play_item(Marx_libvlc_media_handle libvlc_media_handle, ref libvlc_exception_struct ex) { libvlc_media_list_player_play_item(libvlc_media_list_player_handle, libvlc_media_handle, ref ex); } public void stop(ref libvlc_exception_struct ex) { libvlc_media_list_player_stop(libvlc_media_list_player_handle, ref ex); } public void next(ref libvlc_exception_struct ex) { libvlc_media_list_player_next(libvlc_media_list_player_handle, ref ex); } #endregion #region DLL Imports [DllImport("libvlc")] private static extern Marx_libvlc_media_list_player_handle libvlc_media_list_player_new(Marx_libvlc_core_handle libvlc_core_handle, ref libvlc_exception_struct ex); [DllImport("libvlc")] private static extern void libvlc_media_list_player_release(Marx_libvlc_media_list_player_handle libvlc_media_list_player_handle); [DllImport("libvlc")] private static extern void libvlc_media_list_player_set_media_player(Marx_libvlc_media_list_player_handle libvlc_media_list_player_handle, Marx_libvlc_media_player_handle libvlc_media_player_handle, ref libvlc_exception_struct ex); [DllImport("libvlc")] private static extern void libvlc_media_list_player_set_media_list(Marx_libvlc_media_list_player_handle libvlc_media_list_player_handle, Marx_libvlc_media_list_handle libvlc_media_list_handle, ref libvlc_exception_struct ex); [DllImport("libvlc")] private static extern void libvlc_media_list_player_play(Marx_libvlc_media_list_player_handle libvlc_media_list_player_handle, ref libvlc_exception_struct ex); [DllImport("libvlc")] private static extern void libvlc_media_list_player_pause(Marx_libvlc_media_list_player_handle libvlc_media_list_player_handle, ref libvlc_exception_struct ex); [DllImport("libvlc")] private static extern int libvlc_media_list_player_is_playing(Marx_libvlc_media_list_player_handle libvlc_media_list_player_handle, ref libvlc_exception_struct ex); //TODO: libvlc_state [DllImport("libvlc")] private static extern void libvlc_media_list_player_play_item_at_index(Marx_libvlc_media_list_player_handle libvlc_media_list_player_handle, int index, ref libvlc_exception_struct ex); [DllImport("libvlc")] private static extern int libvlc_media_list_player_play_item(Marx_libvlc_media_list_player_handle libvlc_media_list_player_handle, Marx_libvlc_media_handle libvlc_media_handle, ref libvlc_exception_struct ex); [DllImport("libvlc")] private static extern void libvlc_media_list_player_stop(Marx_libvlc_media_list_player_handle libvlc_media_list_player_handle, ref libvlc_exception_struct ex); [DllImport("libvlc")] private static extern void libvlc_media_list_player_next(Marx_libvlc_media_list_player_handle libvlc_media_list_player_handle, ref libvlc_exception_struct ex); #endregion } }
I can add media's to a media_list: libvlc_media_list.add_media(libvlc_media.Handle, ref ex);
I can play items at a certain index: libvlc_media_list_player.play_item_at_index(2, ref ex);

But when I call libvlc_media_list_player.play(ref ex); I had expected that it plays all the items in the list.

Is this a wrong understanding of libvlc? Or what do I miss?

Best regards, Elund

tamiro44
Cone that earned his stripes
Cone that earned his stripes
Posts: 131
Joined: 15 Feb 2009 15:21

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby tamiro44 » 15 Feb 2009 16:25

Hi Marx,
Is there any API for setting text on top of the video?
It should be important for various usages and i saw vlc allow this
at the original GUI.

Thanks,
Tamiro.

Jeremiah
Blank Cone
Blank Cone
Posts: 53
Joined: 16 Oct 2008 09:31

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Jeremiah » 05 Mar 2009 11:18

Good job done here.

One thing I found that was a problem for me working with non-english/unicode/UTF-8 filenames is that VLC wouldn't play the file.
To solve this problem... we need to modify the type of the filename string as shown below.

[DllImport("libvlc")]
private static extern VLCMediaHandle libvlc_media_new(VLCCoreHandle vlcCoreHandle, [MarshalAs(UnmanagedType.LPArray)] byte[] mri, ref VLCExceptionDetails ex);


Because the original C++ function definition was: char*, it is not completely accurate to send Uris into libvlc.dll as string. A String type in C# is Unicode (UTF-16) while libvlc.dll uses UTF-8! So no non-english Uris!!!

The code above solves this problem. To set a new media do this.

UTF8Encoding utf8 = new UTF8Encoding();
vlcMediaHandle = libvlc_media_new(vlcCoreHandle, utf8.GetBytes(link), ref ex);
does anyone konw how to do like this about changing the libvlc_new() function of the parameter args?

Code: Select all

[DllImport("libvlc")] private static extern CoreHandle libvlc_new(int argc, string[] args, ref ExceptionStruct ex);
i got puzzled......

blich
New Cone
New Cone
Posts: 2
Joined: 12 Mar 2009 00:53

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby blich » 12 Mar 2009 01:05

Can somebody post a link to the latest version of this? I tried one a link earlier in the thread, but I get the following message when I try to run it. Any ideas?

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at WinControls.VlcWrapper.Marx_libvlc_exception.libvlc_exception_init(libvlc_exception_struct& ex)
at WinControls.VlcWrapper.Marx_libvlc_exception.init(libvlc_exception_struct& ex) in C:\Users\brianlic\Desktop\oi\TestVlc\VlcWrapper\Marx_libvlc_exception.cs:line 50
at WinControls.VlcWrapper.Marx_libvlc_exception..ctor(libvlc_exception_struct& ex) in C:\Users\brianlic\Desktop\oi\TestVlc\VlcWrapper\Marx_libvlc_exception.cs:line 41
at WinControls.VlcWrapper.VlcWrapperUserControl.OnLoad(EventArgs e) in C:\Users\brianlic\Desktop\oi\TestVlc\VlcWrapper\VlcWrapperUserControl.cs:line 131
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

tamiro44
Cone that earned his stripes
Cone that earned his stripes
Posts: 131
Joined: 15 Feb 2009 15:21

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby tamiro44 » 12 Mar 2009 09:07

I think that at the bottom of page two but i'll glad to newer version

Marx libvlc Wrapper for 0.9.0 version 0.0.2 (Alpha Release)
http://www.2shared.com/file/3586524/6c4 ... apper.html

mohamnag
Blank Cone
Blank Cone
Posts: 11
Joined: 12 Mar 2009 16:04

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby mohamnag » 12 Mar 2009 16:31

Hi there,
greate job, I used this lib to play an stream from network but I was unable to find out how to save that stream to a file. It would be much better if I was able to pass the config strings that VLC itself builds to this lib. I mean if I can pass it something like ":sout=#duplicate{dst=display,dst=std{access=file,dst=D:\ghfghg.ps}}" to say the lib to save my stream.
Is there any way?

blich
New Cone
New Cone
Posts: 2
Joined: 12 Mar 2009 00:53

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby blich » 12 Mar 2009 22:17

Weird. I still get the same exception. Is this supported on x64? (Sorry, VLC dev noob).

mohamnag
Blank Cone
Blank Cone
Posts: 11
Joined: 12 Mar 2009 16:04

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby mohamnag » 13 Mar 2009 09:42

Hi there,
greate job, I used this lib to play an stream from network but I was unable to find out how to save that stream to a file. It would be much better if I was able to pass the config strings that VLC itself builds to this lib. I mean if I can pass it something like ":sout=#duplicate{dst=display,dst=std{access=file,dst=D:\ghfghg.ps}}" to say the lib to save my stream.
Is there any way?
still no answer?

tamiro44
Cone that earned his stripes
Cone that earned his stripes
Posts: 131
Joined: 15 Feb 2009 15:21

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby tamiro44 » 15 Mar 2009 08:10

No.
I'll glad to know either.

mohamnag
Blank Cone
Blank Cone
Posts: 11
Joined: 12 Mar 2009 16:04

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby mohamnag » 15 Mar 2009 17:33


tamiro44
Cone that earned his stripes
Cone that earned his stripes
Posts: 131
Joined: 15 Feb 2009 15:21

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby tamiro44 » 15 Mar 2009 17:54

Thanks again

Smurph
New Cone
New Cone
Posts: 1
Joined: 14 Apr 2009 22:51

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby Smurph » 14 Apr 2009 23:01

I keep getting a DLLNotFoundException at runtime regardless of what I do. I have libvlc.dll and the plugins folder in the executable directory. I even added the VLC install directory to the Path variable as recommended elsewhere on this forum. Is there anything else needed to get the test project to run?

Here is my output:
Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'libvlc': T
he specified procedure could not be found. (Exception from HRESULT: 0x8007007F)
at Marx_libvlc_wrapper.Marx_libvlc_exception.libvlc_exception_init(libvlc_exc
eption_struct& ex)
at Marx_libvlc_wrapper.Marx_libvlc_exception.init(libvlc_exception_struct& ex
) in C:\Documents and Settings\me\Desktop\Marx_libvlc_wrapper\Marx_libvlc_w
rapper\Marx_libvlc_wrapper\Marx_libvlc_exception.cs:line 50
at Marx_libvlc_wrapper.Marx_libvlc_exception..ctor(libvlc_exception_struct& e
x) in C:\Documents and Settings\me\Desktop\Marx_libvlc_wrapper\Marx_libvlc_
wrapper\Marx_libvlc_wrapper\Marx_libvlc_exception.cs:line 41
at Marx_libvlc_wrapper_test.Program.Main(String[] args) in C:\Documents and S
ettings\me\Desktop\Marx_libvlc_wrapper\Marx_libvlc_wrapper\Marx_libvlc_wrap
per_test\Program.cs:line 49

tamiro44
Cone that earned his stripes
Cone that earned his stripes
Posts: 131
Joined: 15 Feb 2009 15:21

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby tamiro44 » 16 Apr 2009 08:17

and what about libvlccore.dll?

enrike
New Cone
New Cone
Posts: 7
Joined: 15 Apr 2009 13:48

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby enrike » 16 Apr 2009 11:51

i read in this post that in order to embed the video in a windows form i would need to
"pass the .Handle member of the control you want to play in to video_set_parent."
https://forum.videolan.org/viewtopic.ph ... rm#p158512

I created a Picturebox and passed its Handle to the video player video_set_parent funtion
libvlc_media_player.video_set_parent(libvlc_core.Handle, pictureBox1.Handle, ref ex);

when i try to play the video i get an exception
A first chance exception of type 'System.AccessViolationException' occurred in Marx_libvlc_wrapper.dll
triggered at this line
libvlc_media_player.video_set_parent(libvlc_core.Handle, pictureBox1.Handle, ref ex);

I guess the picturebox does not support video rendering?. what type of control should i use otherwise? I also tried with this.Handle from the Form but this causes the same problem.

thanks

enrike

tamiro44
Cone that earned his stripes
Cone that earned his stripes
Posts: 131
Joined: 15 Feb 2009 15:21

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby tamiro44 » 16 Apr 2009 13:06

Did you take the code from the second page (down)?
viewtopic.php?f=32&t=47385&start=15

enrike
New Cone
New Cone
Posts: 7
Joined: 15 Apr 2009 13:48

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby enrike » 16 Apr 2009 13:33

not sure if you are talking to me ...
i just took it from the Program.cs file that comes with the Marx libvlc wrapper. I downloaded it from a link i found on this thread

tamiro44
Cone that earned his stripes
Cone that earned his stripes
Posts: 131
Joined: 15 Feb 2009 15:21

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby tamiro44 » 16 Apr 2009 13:46

Ok enrike,
But Marx himself has suggeted that we will take it from buttom of page 2
viewtopic.php?f=32&t=47385&start=15


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 34 guests