Guest User

Untitled

a guest
Feb 17th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. public interface IVLCObject : IDisposable
  2. {
  3. IntPtr ObjectHandle { get; }
  4.  
  5. bool IsInvalid { get; }
  6. }
  7.  
  8. public interface IVLCMedia : IVLCObject
  9. {
  10. Uri Location { get; }
  11. void AddOption(string mediaOption);
  12. long Duration { get; }
  13. ...
  14. }
  15.  
  16. public interface IVLCMediaPlayer : IVLCObject
  17. {
  18. IVLCMedia Media { get; set; }
  19. bool Play();
  20. void Pause();
  21. void Stop();
  22. ...
  23. }
  24.  
  25. internal class VLCMediaPlayer
  26. : VLCObject<VLCMediaPlayer.libvlc_media_player_release_t>, IVLCMediaPlayer
  27. {
  28. public VLCMediaPlayer(IVLCObject vlcObject)
  29. : base(libvlc_media_player_new(vlcObject,
  30. vlcObject.GetType().GetInterface("IVLCMedia") != null), libvlc_media_player_release)
  31. {
  32. }
  33.  
  34. ....
  35.  
  36. private static IntPtr libvlc_media_player_new(IVLCObject vlcObject, bool fromMedia = false)
  37. {
  38. return Environment.Is64BitProcess
  39. ? fromMedia
  40. ? libvlc_media_player_new_from_media64(vlcObject.ObjectHandle)
  41. : libvlc_media_player_new64(vlcObject.ObjectHandle)
  42. : fromMedia
  43. ? libvlc_media_player_new_from_media32(vlcObject.ObjectHandle)
  44. : libvlc_media_player_new32(vlcObject.ObjectHandle);
  45. }
  46. }
Add Comment
Please, Sign In to add comment