/Multimedia/Vlc/LibVlc/VlcMedia.cs
C# | 66 lines | 43 code | 5 blank | 18 comment | 2 complexity | ebd375ea89e3464caf6654e46376a098 MD5 | raw file
Possible License(s): Apache-2.0
- using System;
-
- namespace Delta.Multimedia.Vlc.LibVlc
- {
- internal class VlcMedia : IDisposable
- {
- #region Handle (Public)
- /// <summary>
- /// The handle of the media data.
- /// </summary>
- public IntPtr Handle
- {
- get;
- private set;
- }
- #endregion
-
- #region State (Public)
- /// <summary>
- /// The current state of the media.
- /// </summary>
- public VlcMediaState State
- {
- get
- {
- return VlcCore.libvlc_media_get_state(Handle);
- }
- }
- #endregion
-
- #region Constructors
- /// <summary>
- /// Create a new vlc media instance.
- /// </summary>
- /// <param name="instance">The manager instance.</param>
- /// <param name="filepath">The path to the file.</param>
- public VlcMedia(VlcInstance instance, string filepath)
- {
- Handle = VlcCore.libvlc_media_new_location(instance.Handle, filepath);
- if (Handle == IntPtr.Zero)
- {
- throw new VlcException();
- }
- }
-
- /// <summary>
- /// Helper constructor to create a wrapper instance from a handle.
- /// </summary>
- /// <param name="setHandle">The handle of the media.</param>
- public VlcMedia(IntPtr setHandle)
- {
- Handle = setHandle;
- }
- #endregion
-
- #region IDisposable Members
- /// <summary>
- /// Unload the media handle.
- /// </summary>
- public void Dispose()
- {
- VlcCore.libvlc_media_release(Handle);
- }
- #endregion
- }
- }