[vlc-devel] CLI Bindings : AccessViolationException on player
Damien
maitredede at gmail.com
Thu Dec 10 17:22:31 CET 2009
>
> Try this code please:
>
> (1. _VLC is a local global/private variable)
> (2. Change the appropriate opts items to match yours)
> (3. Call Initialize)
> (4. Call PlayVideo (filename,windowhandle,""))
>
>
I have copied your code (altering it to match bindings in vlc git). Here it
is :
--8<----8<----8<----8<----8<----8<--
public partial class Form1 : Form
{
private VLC _VLC;
private bool _VLCDebug;
private string _VLCPath;
private string _VLCPluginPath;
private bool _IsRunning = false;
internal Form1(string vlcPath, string vlcPlugins)
{
InitializeComponent();
this._VLCPath = vlcPath;
this._VLCPluginPath = vlcPlugins;
}
private void Form1_Shown(object sender, EventArgs e)
{
this.Initialize(true);
this.PlayVideo("D:\\a.avi", this.Handle, string.Empty);
}
public bool Initialize(bool DebugOn)
{
_VLCDebug = DebugOn;
string[] opts = { "-I", "dummy", "--plugin-path=" +
_VLCPluginPath, "--one-instance" };
string[] optsdebug = { "-I", "dummy", "--plugin-path=" +
_VLCPluginPath, "-vvv", "--extraintf=logger", "--logfile=D:\\VlcLog.txt" };
try
{
if (_VLCDebug)
{
_VLC = new VLC(optsdebug);
}
else
{
_VLC = new VLC(opts);
}
_IsRunning = true;
}
catch (Exception ex)
{
_IsRunning = false;
}
return _IsRunning;
}
private void PlayVideo(string fn, IntPtr playwindow, string
EncodeOption)
{
Media mx = new Media(_VLC, fn);
if (!string.IsNullOrEmpty(EncodeOption))
mx.AddOptions(EncodeOption, true);
//Note: You may set playwindow = intptr.zero, which will just
encode your file/not show it
Player player = new Player(_VLC);
player.Media = mx;
this.Text = mx.Location;
mx.Dispose();
player.Play();
}
}
--8<----8<----8<----8<----8<----8<--
Running from VS2008 debugger :
- Media.Location returns a bad string (libvlc_media_get_mrl)
- AccessViolationException when calling LibVLC.PlayerPlay().
Running from commandline with mono :
- Media.Location is good
- crashes at PlayerPlay() too.
Thanks for trying to help.
Damien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20091210/1556b9f5/attachment.html>
More information about the vlc-devel
mailing list