PageRenderTime 142ms CodeModel.GetById 60ms app.highlight 2ms RepoModel.GetById 79ms app.codeStats 0ms

/Multimedia/Vlc/LibVlc/VlcInstance.cs

#
C# | 43 lines | 30 code | 3 blank | 10 comment | 2 complexity | e9b2207e501ddeb9583b0fb16fca858a MD5 | raw file
 1using System;
 2
 3namespace Delta.Multimedia.Vlc.LibVlc
 4{
 5	internal class VlcInstance : IDisposable
 6	{
 7		#region Handle (Public)
 8		/// <summary>
 9		/// The handle of the vlc manager.
10		/// </summary>
11		public IntPtr Handle
12		{
13			get;
14			private set;
15		}
16		#endregion
17
18		#region Constructors
19		/// <summary>
20		/// Create a new instance of the vlc manager.
21		/// </summary>
22		/// <param name="args">The arguments sent to the manager.</param>
23		public VlcInstance(string[] args)
24		{
25			Handle = VlcCore.libvlc_new(args.Length, args);
26			if (Handle == IntPtr.Zero)
27			{
28				throw new VlcException();
29			}
30		}
31		#endregion
32
33		#region IDisposable Members
34		/// <summary>
35		/// Unload the manager handle.
36		/// </summary>
37		public void Dispose()
38		{
39			VlcCore.libvlc_release(Handle);
40		}
41		#endregion
42	}
43}