[vlc-devel] commit: Basic tests for the media player, fix time units ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sat Feb 21 17:46:09 CET 2009
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Feb 21 18:45:47 2009 +0200| [6bc5c775567a83d01b1fdc179acf781635f1ebbc] | committer: Rémi Denis-Courmont
Basic tests for the media player, fix time units
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6bc5c775567a83d01b1fdc179acf781635f1ebbc
---
bindings/cil/src/player.cs | 5 +++--
bindings/cil/tests/testvlc.cs | 37 +++++++++++++++++++++++++++++++++----
2 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/bindings/cil/src/player.cs b/bindings/cil/src/player.cs
index fb17b1e..2e3d54b 100644
--- a/bindings/cil/src/player.cs
+++ b/bindings/cil/src/player.cs
@@ -193,7 +193,7 @@ namespace VideoLAN.LibVLC
}
/**
- * Total length in microseconds of the playback (if known).
+ * Total length in milliseconds of the playback (if known).
*/
public long Length
{
@@ -206,7 +206,7 @@ namespace VideoLAN.LibVLC
}
/**
- * Playback position in microseconds from the start (if applicable).
+ * Playback position in milliseconds from the start (if applicable).
* Setting this value might not work depending on the underlying
* media capability and file format.
*
@@ -229,6 +229,7 @@ namespace VideoLAN.LibVLC
/**
* Playback position as a fraction of the total (if applicable).
+ * At start, this is 0; at the end, this is 1.
* Setting this value might not work depending on the underlying
* media capability and file format.
*
diff --git a/bindings/cil/tests/testvlc.cs b/bindings/cil/tests/testvlc.cs
index 1e0c9c2..3868cad 100644
--- a/bindings/cil/tests/testvlc.cs
+++ b/bindings/cil/tests/testvlc.cs
@@ -35,6 +35,21 @@ namespace VideoLAN.LibVLC.Test
Console.WriteLine (" preparsed: {0}", m.IsPreparsed);
}
+ private static void DumpPlayer (Player p)
+ {
+ if (!p.IsPlaying)
+ return;
+
+ int percent = (int)(p.Position * 100);
+ Console.Write ("{0} of {1} ms ({2}%)\r", p.Time, p.Length,
+ percent);
+ }
+
+ private static void Sleep (int msec)
+ {
+ System.Threading.Thread.Sleep (msec);
+ }
+
public static int Main (string[] args)
{
string[] argv = new string[]{
@@ -46,13 +61,27 @@ namespace VideoLAN.LibVLC.Test
Console.WriteLine (" (compiled with {0})", VLC.Compiler);
VLC vlc = new VLC (argv);
- Media m = new Media (vlc, "/dev/null");
- DumpMedia (m);
+ foreach (string mrl in args)
+ {
+ Media media = new Media (vlc, mrl);
+ Player player = new Player (media);
+
+ DumpMedia (media);
+ DumpMedia ((Media)media.Clone ());
- DumpMedia ((Media)m.Clone ());
+ player.Play ();
+ do
+ {
+ DumpPlayer (player);
+ Sleep (500);
+ }
+ while (player.IsPlaying);
+ player.Stop ();
+ media.Dispose ();
+ player.Dispose ();
+ }
vlc.Dispose ();
- m.Dispose ();
return 0;
}
};
More information about the vlc-devel
mailing list