Hi Marx!Sorry, I've been busy on project work. I'll be releasing the source of the Media player interface and wrapper soon.
Is there missing an implementation of libvlc_media_list_player in the Marx C# Wrapper?Can someone sketch how to create and use a Marx_libvlc_media_list object?
I have now implemented Marx_libvlc_media_list_player:Is there missing an implementation of libvlc_media_list_player in the Marx C# Wrapper?
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
}
}
does anyone konw how to do like this about changing the libvlc_new() function of the parameter args?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);
Code: Select all
[DllImport("libvlc")]
private static extern CoreHandle libvlc_new(int argc, string[] args, ref ExceptionStruct ex);
still no answer?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?
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
Return to “Development around libVLC”
Users browsing this forum: No registered users and 13 guests