[vlc-devel] CLI Bindings : AccessViolationException on player

Damien maitredede at gmail.com
Thu Dec 10 15:56:15 CET 2009

> 2009/12/9 Developer <developer at noknok.net>
>> Ok, from a command line:
>> vlc -I dummy -vvv --extraintf=logger --logfile=z:\ffmpeg\VlcLog.txt
>>  "z:\tempdata\sin.avi"
>   The program starts, the video plays (directx window) and the log file is
> filled with a lot of text.
>  When launching my program directly from commandline (microsoft
> framework), instanciating VLC with same parameters, log file is not created
> and the media video seems to be a smiley
> What do you mean by running directly from commandline (mircrosoft
> framework)?   Are you meaning executing a SHELL COMMAND from within say C#?

To test, here what I have done :

Start, Execute, "cmd"

cd /d "C:\program file\videolan\vlc"
vlc -I dummy -vvv --extraintf=logger --logfile=D:\VlcLog.txt  "D:\a.avi"

--> Video is played inside a Directx window, vlc opens its own log console
window aside.

Then I copy my program into vlc dir.
My code :
                System.Console.WriteLine("OS is {0} version {1}",
Environment.OSVersion.Platform, Environment.OSVersion.VersionString);
                string video = @"d:\a.avi";
                string[] vlcargs = new string[]
                    "-I", "dummy",                      /* no interface */
                    "--ignore-config",            /* don't use/overwrite the
config */

                using (VLC instance = new VLC(vlcargs))
                    Console.WriteLine("Waiting for 'Enter' key press to

Nothing happen : I see the "waiting" message, I see some log messages (in
same console window), but until I press enter, there is no more feedback, no
other window, no CPU activity...
Even if I replace the "Console.Readline()" with "instance.Run()" it doesn't
change anything...

Compiled with VS2008 (target is framework 2.0), Windows 7 Ultimate x86,
running in either debugger or using commandline, strings seem not to be
handled correctly :

> [0x3cacc6c] main playlist debug: adding item `☺' ( ☺ )
Same binary, launched with mono :
>From commandline : ..\..\Mono-\bin\mono Test-vs2008.exe
Strings seems to be handled correctly :

>  [0x201fdac] main playlist debug: adding item `a.avi' ( d:\a.avi )
> But still nothing happen (no feedback).

If I replace "dummy" interface with "qt" interface, nothing happens too.

Same behavior if compiled with VS2010 targeting 3.0.

Now, using this code :
                using (VLC instance = new VLC(vlcargs))
                    Console.WriteLine("Loading Media : >{0}<", video);
                    Media media = new Media(instance, video);
                    media.MetaChanged += new

                    Console.WriteLine("Media.Location : >{0}<",
                    Console.WriteLine("Creating Player from media...");
                    Player player = new Player(media);

                    Console.WriteLine("Waiting for 'Enter' key press to
with method event handler :

        static void media_MetaChanged(Media media, MetaType type)
            System.Console.WriteLine("Media : " + media.Location + "\tMeta :
" + type + "\tValue=" + media.GetMeta(type));

Running from commandline, with Mono :
- Media is created, reading the Media.Location property returns the same
- When calling the Player.Play() method, I see in console :
[0x21a8e84] main input debug: Creating an input for 'a.avi'
[0x21a8f24] main input debug: Creating an input for 'a.avi'
Media : d:\a.avi        Meta : NowPlaying       Value=

  at (wrapper managed-to-native) VideoLAN.LibVLC.LibVLC.PlayerPlay
(VideoLAN.LibVLC.PlayerHandle,VideoLAN.LibVLC.NativeException) <0x00004>
  at (wrapper managed-to-native) VideoLAN.LibVLC.LibVLC.PlayerPlay
(VideoLAN.LibVLC.PlayerHandle,VideoLAN.LibVLC.NativeException) <0xffffffff>
  at VideoLAN.LibVLC.Player.Play () <0x00023>
  at Damien.Program.Main (string[]) <0x003d1>
  at (wrapper runtime-invoke) Damien.Program.runtime_invoke_void_object
(object,intptr,intptr,intptr) <0xffffffff>

This application has requested the Runtime to terminate it in an unusual
Please contact the application's support team for more information.

It seems that there is a native error occuring, that make mono crash.

Running my program directly from commandline (so it uses the Microsoft
Framework), behavior is the same (native crash) also with the bad string

I hope there is enough details to help find a start of debugging/workaround


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20091210/f04ebb43/attachment.html>

More information about the vlc-devel mailing list