Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Added binding for fullscreen functions
Browse files Browse the repository at this point in the history
Based on work by
- @LinoBarreca on Apr 17, 2015 (#44 (comment))
- @samarthshroff #514
  • Loading branch information
Samarth authored and jeremyVignelles committed Feb 27, 2019
1 parent ffd3e87 commit 3551c88
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Runtime.InteropServices;

namespace Vlc.DotNet.Core.Interops.Signatures
{
/// <summary>
/// Get current fullscreen status.
/// </summary>
[LibVlcFunction("libvlc_get_fullscreen")]
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int GetFullScreen(IntPtr mediaPlayerInstance);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Runtime.InteropServices;

namespace Vlc.DotNet.Core.Interops.Signatures
{
/// <summary>
/// Set fullscreen.
/// </summary>
[LibVlcFunction("libvlc_set_fullscreen")]
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void SetFullScreen(IntPtr mediaPlayerInstance, int value);
}
15 changes: 15 additions & 0 deletions src/Vlc.DotNet.Core.Interops/VlcManager.GetFullScreen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using Vlc.DotNet.Core.Interops.Signatures;

namespace Vlc.DotNet.Core.Interops
{
public sealed partial class VlcManager
{
public int GetFullScreen(VlcMediaPlayerInstance mediaPlayerInstance)
{
if (mediaPlayerInstance == IntPtr.Zero)
throw new ArgumentException("Media player instance is not initialized.");
return myLibraryLoader.GetInteropDelegate<GetFullScreen>().Invoke(mediaPlayerInstance);
}
}
}
15 changes: 15 additions & 0 deletions src/Vlc.DotNet.Core.Interops/VlcManager.SetFullScreen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using Vlc.DotNet.Core.Interops.Signatures;

namespace Vlc.DotNet.Core.Interops
{
public sealed partial class VlcManager
{
public void SetFullScreen(VlcMediaPlayerInstance mediaPlayerInstance, bool fullScreen)
{
if (mediaPlayerInstance == IntPtr.Zero)
throw new ArgumentException("Media player instance is not initialized.");
myLibraryLoader.GetInteropDelegate<SetFullScreen>().Invoke(mediaPlayerInstance, fullScreen ? 1 : 0);
}
}
}
6 changes: 6 additions & 0 deletions src/Vlc.DotNet.Core/IVideoManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,11 @@ public interface IVideoManagement
IAdjustmentsManagement Adjustments { get; }
bool IsMouseInputEnabled { set; }
bool IsKeyInputEnabled { set; }

/// <summary>
/// Gets or set the fullscreen mode for the player.
/// <c>true</c> if the player is playing fullscreen
/// </summary>
bool FullScreen { get; set; }
}
}
16 changes: 16 additions & 0 deletions src/Vlc.DotNet.Core/VideoManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ public string Deinterlace
set { myManager.SetVideoDeinterlace(myMediaPlayer, value); }
}

/// <summary>
/// Gets or set the fullscreen mode for the player.
/// <c>true</c> if the player is playing fullscreen
/// </summary>
public bool FullScreen
{
get
{
return myManager.GetFullScreen(myMediaPlayer) != 0;
}
set
{
myManager.SetFullScreen(myMediaPlayer, value);
}
}

public IMarqueeManagement Marquee { get; private set; }
public ILogoManagement Logo { get; private set; }
public IAdjustmentsManagement Adjustments { get; private set; }
Expand Down

0 comments on commit 3551c88

Please sign in to comment.