2 * testvlc.cs - tests for libvlc CIL bindings
7 /**********************************************************************
8 * Copyright (C) 2007 RĂ©mi Denis-Courmont. *
9 * This program is free software; you can redistribute and/or modify *
10 * it under the terms of the GNU General Public License as published *
11 * by the Free Software Foundation; version 2 of the license, or (at *
12 * your option) any later version. *
14 * This program is distributed in the hope that it will be useful, *
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
17 * See the GNU General Public License for more details. *
19 * You should have received a copy of the GNU General Public License *
20 * along with this program; if not, you can get it from: *
21 * http://www.gnu.org/copyleft/gpl.html *
22 **********************************************************************/
25 using VideoLAN.LibVLC;
27 namespace VideoLAN.LibVLC.Test
29 public sealed class Test
31 private static void DumpMedia (Media m)
33 Console.WriteLine ("Media: {0} {1} (duration: {2}, {3}preparsed)",
34 m.State, m.Location, m.Duration,
35 m.IsPreparsed ? "" : "not ");
38 private static void WriteMediaState (Media m, State s)
40 Console.WriteLine (" -> {0}", s);
43 private static void DumpPlayer (Player p)
48 int percent = (int)(p.Position * 100);
49 Console.Write ("{0}: {1} of {2} ms ({3}%)\r", p.State,
50 p.Time, p.Length, percent);
53 private static void Sleep (int msec)
55 System.Threading.Thread.Sleep (msec);
58 public static int Main (string[] args)
60 string[] argv = new string[]{
61 "-vv", "-I", "dummy", "--plugin-path=../../modules"
64 Console.WriteLine ("Running on LibVLC {0} ({1})", VLC.Version,
66 Console.WriteLine (" (compiled with {0})", VLC.Compiler);
68 VLC vlc = new VLC (argv);
69 foreach (string mrl in args)
71 Media media = new Media (vlc, mrl);
72 Player player = new Player (media);
75 DumpMedia ((Media)media.Clone ());
76 media.StateChanged += WriteMediaState;
78 /*foreach (MetaType type in Enum.GetValues (typeof (MetaType)))
80 string meta = media.GetMeta (type);
82 Console.WriteLine (" {0}: {1}", type, meta);
91 while (player.IsPlaying);