C# Wrapper for libvlc 0.9.0 - Testers Required

This forum is about all development around libVLC.
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

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 14:25

thanks, i just arrived here yesterday and it is such a long topic that i find it difficult to get my head around all the possibilities and different techniques.

i took the code from the page 2 now and updated my code. still get the same exception :

A first chance exception of type 'System.AccessViolationException' occurred in Marx_libvlc_wrapper.dll
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

this time it comes from this line
libvlc_media_player.video_set_parent(libvlc_core.Handle, pictureBox1.Handle, ref ex);

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 15:42

make sure that near to the EXE:
1. libvlc.dll
2. libvlccore.dll
3. plugins folder

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 » 17 Apr 2009 08:00

all are included in the Debug folder next to the exe. they are from version vlc-0.9.9-win32 and i am running Windows Vista Service pack 1

alirezanoori
New Cone
New Cone
Posts: 5
Joined: 28 Apr 2009 23:44

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby alirezanoori » 28 Apr 2009 23:48

I tried to run the wrapper test but I couldn't do it.
Am I doing something wrong? I copied libvlc.dll and plugins folder to debug folder, then ran the program.
Here's the output from console window:
-I: unknown option or missing mandatory argument `--ignore-config'
Try `-I --help' for more information.
The command line options couldn't be loaded, check that they are valid.

Press the RETURN key to continue...


Unhandled Exception: System.EntryPointNotFoundException: Unable to find an entry
point named 'libvlc_media_new' in DLL 'libvlc'.
at Marx_libvlc_wrapper.Marx_libvlc_media.libvlc_media_new(Marx_libvlc_core_ha
ndle libvlc_core_handle, String mri, libvlc_exception_struct& ex)
at Marx_libvlc_wrapper.Marx_libvlc_media..ctor(Marx_libvlc_core_handle libvlc
_core_handle, String filename, libvlc_exception_struct& ex) in H:\My Files\Data\
My Documents\Downloads\Marx_libvlc_wrapper\Marx_libvlc_wrapper\Marx_libvlc_media
.cs:line 79
at Marx_libvlc_wrapper_test.Program.Main(String[] args) in H:\My Files\Data\M
y Documents\Downloads\Marx_libvlc_wrapper\Marx_libvlc_wrapper_test\Program.cs:li
ne 51
Press any key to continue . . .

oppio
New Cone
New Cone
Posts: 4
Joined: 05 May 2009 16:31

Re: C# Wrapper for libvlc 0.9.0 - Testers Required

Postby oppio » 05 May 2009 16:35

Hi all,

I just found this topic about Marx's C# wrapper, I'd like to know what's the highest version of VLC can be used with the wrapper.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 5 guests