You mean "libvlc_media.add_option(options, ref ex);"? I tried setting the options as you said, but it doesn't work. What does the "SID" mean? Is it the program ID of the TS stream? But the program ID is always changing.You are setting up the frequency and the other stuff, by adding mrl-options to your mediadiscriptor, right? Then you just have to add ":programs=[SID]" as option to your mediadiscriptor objekt.
I would suggest using this wrapper instead:Hi guys:
Sorry if is not the correct forum, but I'm very interesting in use and help with the .NET interface for VLC, so my question is where can I get a fresh copy of the source or where can a check out the last version (svn repo?).
both wrappers work, with some few modifications. i am going to post my changes to the meedios wrapper in the corresponding thread.1) I'm a c#/mono programmer so I wonder if someone test this libvlc wrapper in c# on linux?
no2) the current wrapper is not a wrapper arround a ActiveX control right?
no3) the native function wrappers are also in C# not VS.NET C++ right?
and finally...
does work, by adding stream output options to the mrl.4) what is the current status of the vlc streaming capabilities of LibVlc and/or the .NET wrapper?
SID is the service identifier that should be in any DVB stream. Imho it describes the Video and Audio PIDs belonging to a channel.You mean "libvlc_media.add_option(options, ref ex);"? I tried setting the options as you said, but it doesn't work. What does the "SID" mean? Is it the program ID of the TS stream? But the program ID is always changing.You are setting up the frequency and the other stuff, by adding mrl-options to your mediadiscriptor, right? Then you just have to add ":programs=[SID]" as option to your mediadiscriptor objekt.
Code: Select all
// Main.cs created with MonoDevelop
// User: bexx at 1:15 AM 11/20/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//
using System;
using VideoLan;
using System.Threading;
namespace DVBsharp
{
public interface VlcDvbChannel
{
String[] mrlOptions
{
get;
}
}
public class SChannel : VlcDvbChannel
{
private readonly String name;
private readonly int frequency;
private readonly int symbolrate;
private readonly int sid;
private readonly bool horizontal;
public SChannel(String name, int frequency, int symbolrate, int sid, bool horizontal)
{
this.name = name;
this.frequency = frequency;
this.symbolrate = symbolrate;
this.sid = sid;
this.horizontal = horizontal;
}
public String Name
{
get { return name; }
}
public int Frequency
{
get { return frequency; }
}
public int Symbolrate
{
get { return symbolrate; }
}
public int Sid
{
get { return sid; }
}
public bool isHorizontal
{
get { return horizontal; }
}
public String[] mrlOptions
{
get { return new String[] {":dvb-frequency="+frequency, ":dvb-srate="+symbolrate, ":dvb-voltage="+(horizontal?"18":"13"), ":program="+sid}; } // program does work for streaming, but does not for playing
}
}
class MainClass
{
public static void Main(string[] args)
{
// init libvlc
VideoLanClient vlc = new VideoLanClient(new String[]{});
// mrl
VlcMedia media = vlc.NewMedia("dvb://");
SChannel chan1 = new SChannel("Das Erste", 11836000, 27500000, 28106, true);
foreach (string option in chan1.mrlOptions)
media.AddOption(option);
//player
VlcMediaPlayer player = vlc.NewMediaPlayer(IntPtr.Zero, media);
player.StateChanged += new EventHandler<StateChangedEventArgs>(StateChanged);
//
Thread.Sleep(10000);
player.Play();
Thread.Sleep(10000);
player.Video.FullScreen = true;
Thread.Sleep(30000);
player.Stop();
}
private static void StateChanged(object sender, StateChangedEventArgs e)
{
Console.WriteLine("State: " + e.NewState);
}
}
}
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);
Return to “Development around libVLC”
Users browsing this forum: No registered users and 9 guests