Commit 4931a926 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Add sound volume, rate, and fullscreen support

parent 2edb3900
...@@ -153,6 +153,9 @@ namespace VideoLAN.VLC ...@@ -153,6 +153,9 @@ namespace VideoLAN.VLC
} }
} }
/**
* Switches to the next playlist item
*/
public void NextItem () public void NextItem ()
{ {
CheckDisposed (); CheckDisposed ();
...@@ -162,6 +165,81 @@ namespace VideoLAN.VLC ...@@ -162,6 +165,81 @@ namespace VideoLAN.VLC
e.Consume (); e.Consume ();
} }
/**
* Normalized audio output volume in percent (must be [0..100]).
*/
public short SoundVolume
{
get
{
CheckDisposed ();
NativeException e = NativeException.Prepare ();
short vol = MediaControlAPI.SoundGetVolume (self, ref e);
e.Consume ();
return vol;
}
set
{
CheckDisposed ();
if ((value < 0) || (value > 100))
throw new ArgumentOutOfRangeException ("Volume not within [0..100]");
NativeException e = NativeException.Prepare ();
MediaControlAPI.SoundSetVolume (self, value, ref e);
e.Consume ();
}
}
/**
* Performance speed rate in percent.
*/
public int Rate
{
get
{
CheckDisposed ();
NativeException e = NativeException.Prepare ();
int rate = MediaControlAPI.GetRate (self, ref e);
e.Consume ();
return rate;
}
set
{
CheckDisposed ();
NativeException e = NativeException.Prepare ();
MediaControlAPI.SetRate (self, value, ref e);
e.Consume ();
}
}
/**
* Fullscreen flag.
*/
public bool Fullscreen
{
get
{
CheckDisposed ();
NativeException e = NativeException.Prepare ();
int ret = MediaControlAPI.GetFullscreen (self, ref e);
e.Consume ();
return ret != 0;
}
set
{
CheckDisposed ();
NativeException e = NativeException.Prepare ();
MediaControlAPI.SetFullscreen (self, value ? 1 : 0, ref e);
e.Consume ();
}
}
public void Dispose () public void Dispose ()
{ {
self.Dispose (); self.Dispose ();
......
...@@ -50,7 +50,22 @@ namespace VideoLAN.VLC ...@@ -50,7 +50,22 @@ namespace VideoLAN.VLC
public static extern IntPtr PlaylistGetList (MediaControlHandle self, ref NativeException e); public static extern IntPtr PlaylistGetList (MediaControlHandle self, ref NativeException e);
[DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_playlist_next_item")] [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_playlist_next_item")]
public static extern void PlaylistNextItem (MediaControlHandle self, ref NativeException e); public static extern void PlaylistNextItem (MediaControlHandle self, ref NativeException e);
}
[DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_sound_get_volume")]
public static extern short SoundGetVolume (MediaControlHandle self, ref NativeException e);
[DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_sound_set_volume")]
public static extern void SoundSetVolume (MediaControlHandle self, short volume, ref NativeException e);
/* SetVisual */
[DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_get_rate")]
public static extern short GetRate (MediaControlHandle self, ref NativeException e);
[DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_set_rate")]
public static extern void SetRate (MediaControlHandle self, int rate, ref NativeException e);
[DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_get_fullscreen")]
public static extern int GetFullscreen (MediaControlHandle self, ref NativeException e);
[DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_set_fullscreen")]
public static extern void SetFullscreen (MediaControlHandle self, int full, ref NativeException e);
};
/** /**
* Abstract safe handle class for non-NULL pointers * Abstract safe handle class for non-NULL pointers
......
...@@ -34,11 +34,18 @@ namespace VideoLAN.VLC ...@@ -34,11 +34,18 @@ namespace VideoLAN.VLC
foreach (string s in args) foreach (string s in args)
mc.AddItem (s); mc.AddItem (s);
Console.WriteLine ("Volume : {0}%", mc.SoundVolume);
Console.WriteLine ("Rate : {0}%", mc.Rate);
Console.WriteLine ("Fullscreen: {0}", mc.Fullscreen);
mc.Fullscreen = false;
/*mc.Play ();*/ /*mc.Play ();*/
Console.ReadLine (); Console.ReadLine ();
mc.Stop (); mc.Stop ();
mc.Clear (); mc.Clear ();
mc.SoundVolume = 100;
mc.Rate = 100;
mc.Dispose (); mc.Dispose ();
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment