[vlc-devel] CLI Bindings : AccessViolationException on player

Damien maitredede at gmail.com
Tue Dec 1 17:36:36 CET 2009


Hi,

I'm trying to use CLI Bindings found in git. I have taken files from git
today.

I'm trying to use the libvlc of my current VLC install :
 - windows 7 ultimate x86
 - libvlc 1.0.3 Goldeneye exported
 - compiled with gcc 4.2.1-sjlj mingw32-2

I'm running this C# code :
--8<----8<----8<----8<----8<----8<----8<----8<----8<--
    class Program
    {
        static void Main(string[] args)
        {
            string vlcPath = VLCTools.SearchVlcPath();
            string vlcPlugins = Path.Combine(vlcPath, "plugins");
            VLCTools.SetEnvironement(vlcPath);

            System.Console.WriteLine("Running on LibVLC {0} ({1})",
VLC.Version, VLC.ChangeSet);
            Console.WriteLine(" (compiled with {0})", VLC.Compiler);

            string[] vlcargs = new string[]{
                "-vvvv",
                "--plugin-path", vlcPlugins
            };

            using (VLC instance = new VLC(vlcargs))
            {
                using (Media media = new Media(instance, @"D:\a.avi"))
                {
                    media.StateChanged += new
Media.StateChange(media_StateChanged);
                    media.MetaChanged += new
Media.MetaChange(media_MetaChanged);
                    media.DurationChanged += new
Media.DurationChange(media_DurationChanged);
                    media.PreparseChanged += new
Media.PreparseChange(media_PreparseChanged);
                    using (Player player = new Player(media))
                    {
                        player.Play();
                        System.Console.ReadLine();
                        player.Stop();
                    }
                }
            }
        }

        static void media_PreparseChanged(Media media, bool preparsed)
        {
            System.Console.WriteLine("Media : " + media.Location +
"\tPreparsed = " + preparsed);
        }

        static void media_DurationChanged(Media media, long duration)
        {
            System.Console.WriteLine("Media : " + media.Location +
"\tDuration = " + duration);
        }

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

        static void media_StateChanged(Media media, State state)
        {
            System.Console.WriteLine("Media : " + media.Location + "\tState
: " + state);
        }
    }
--8<----8<----8<----8<----8<----8<----8<----8<----8<--

It raises an exception on "player.Play()" : AccessViolationException
The error happens when calling the interop function
"LibVLC.PlayerPlay(Handle, ex);".

When the media events are fired, the data I have back seams to be invalid :
media.Location shows me a smiley (control character).

Another problem I have, Marshaler can convert abstract SafeHandles, so when
trying to get HWND property, it raises another exception.

Does someone else have used CLI bindings ?

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


More information about the vlc-devel mailing list