Beispiel #1
0
 public void SetVideoAdjustEnabled(VlcMediaPlayerInstance mediaPlayerInstance, bool value)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     GetInteropDelegate <SetVideoAdjustInteger>().Invoke(mediaPlayerInstance, VideoAdjustOptions.Enable, value ? 1 : 0);
 }
Beispiel #2
0
 public bool CouldPlay(VlcMediaPlayerInstance mediaPlayerInstance)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     return(GetInteropDelegate <CouldPlay>().Invoke(mediaPlayerInstance) == 1);
 }
Beispiel #3
0
 public void SetVideoAdjustGamma(VlcMediaPlayerInstance mediaPlayerInstance, float value)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     GetInteropDelegate <SetVideoAdjustFloat>().Invoke(mediaPlayerInstance, VideoAdjustOptions.Gamma, value);
 }
 public int GetAudioTracksCount(VlcMediaPlayerInstance mediaPlayerInstance)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     return(GetInteropDelegate <GetAudioTracksCount>().Invoke(mediaPlayerInstance));
 }
Beispiel #5
0
 public void ToggleMute(VlcMediaPlayerInstance mediaPlayerInstance)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     GetInteropDelegate <ToggleMute>().Invoke(mediaPlayerInstance);
 }
Beispiel #6
0
 internal AudioOutputDescription(string name, string description, VlcManager manager, VlcMediaPlayerInstance mediaPlayerInstance)
 {
     Name                  = name;
     Description           = description;
     myManager             = manager;
     myMediaPlayerInstance = mediaPlayerInstance;
     Devices               = new AudioOutputDevices(this, manager, myMediaPlayerInstance);
 }
Beispiel #7
0
 public void SetAudioDelay(VlcMediaPlayerInstance mediaPlayerInstance, long delay)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     GetInteropDelegate <SetAudioDelay>().Invoke(mediaPlayerInstance, delay);
 }
 public void SetMediaToMediaPlayer(VlcMediaPlayerInstance mediaPlayerInstance, VlcMediaInstance mediaInstance)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     if (mediaInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media instance is not initialized.");
     }
     GetInteropDelegate <SetMediaToMediaPlayer>().Invoke(mediaPlayerInstance, mediaInstance);
 }
        public void SetVideoAspectRatio(VlcMediaPlayerInstance mediaPlayerInstance, string cropGeometry)
        {
            if (mediaPlayerInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media player instance is not initialized.");
            }
#if NET20
            GetInteropDelegate <SetVideoAspectRatio>().Invoke(mediaPlayerInstance, StringExtensions.ToHGlobalAnsi(cropGeometry));
#else
            GetInteropDelegate <SetVideoAspectRatio>().Invoke(mediaPlayerInstance, cropGeometry.ToHGlobalAnsi());
#endif
        }
Beispiel #10
0
        internal VlcMediaPlayer(VlcManager manager, string[] options)
        {
            Manager = manager;
            Manager.CreateNewInstance(options);

            myMediaPlayerInstance = manager.CreateMediaPlayer();
            RegisterEvents();
            Chapters  = new ChapterManagement(manager, myMediaPlayerInstance);
            SubTitles = new SubTitlesManagement(manager, myMediaPlayerInstance);
            Video     = new VideoManagement(manager, myMediaPlayerInstance);
            Audio     = new AudioManagement(manager, myMediaPlayerInstance);
        }
Beispiel #11
0
 public void TakeSnapshot(VlcMediaPlayerInstance mediaPlayerInstance, FileInfo file, uint width, uint height)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     if (file == null)
     {
         throw new ArgumentNullException("file");
     }
     GetInteropDelegate <TakeSnapshot>().Invoke(mediaPlayerInstance, 0, System.Text.Encoding.UTF8.GetBytes(file.FullName), width, height);
 }
Beispiel #12
0
        public void SetVideoLogoFile(VlcMediaPlayerInstance mediaPlayerInstance, string value)
        {
            if (mediaPlayerInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media player instance is not initialized.");
            }
#if NET20
            GetInteropDelegate <SetVideoLogoString>().Invoke(mediaPlayerInstance, VideoLogoOptions.File, StringExtensions.ToHGlobalAnsi(value));
#else
            GetInteropDelegate <SetVideoLogoString>().Invoke(mediaPlayerInstance, VideoLogoOptions.File, value.ToHGlobalAnsi());
#endif
        }
Beispiel #13
0
        public void SetVideoDeinterlace(VlcMediaPlayerInstance mediaPlayerInstance, string deinterlaceMode)
        {
            if (mediaPlayerInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media player instance is not initialized.");
            }
#if NET20
            GetInteropDelegate <SetVideoDeinterlace>().Invoke(mediaPlayerInstance, StringExtensions.ToHGlobalAnsi(deinterlaceMode));
#else
            GetInteropDelegate <SetVideoDeinterlace>().Invoke(mediaPlayerInstance, deinterlaceMode.ToHGlobalAnsi());
#endif
        }
        public string GetVideoMarqueeText(VlcMediaPlayerInstance mediaPlayerInstance)
        {
            if (mediaPlayerInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media player instance is not initialized.");
            }
#if NET20
            return(IntPtrExtensions.ToStringAnsi(GetInteropDelegate <GetVideoMarqueeString>().Invoke(mediaPlayerInstance, VideoMarqueeOptions.Text)));
#else
            return(GetInteropDelegate <GetVideoMarqueeString>().Invoke(mediaPlayerInstance, VideoMarqueeOptions.Text).ToStringAnsi());
#endif
        }
Beispiel #15
0
 public bool IsPlaying(VlcMediaPlayerInstance mediaPlayerInstance)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         return(false);
     }
     //This seems to be called multiple time
     //Eventually throwing an uncaught exception on close
     //An unhandled exception of type 'System.ArgumentException' occurred in Hytera.EEMS.Media.dll
     //Additional information: Media player instance is not initialized.
     //if (mediaPlayerInstance == IntPtr.Zero)
     //    throw new ArgumentException("Media player instance is not initialized.");
     return(GetInteropDelegate <IsPlaying>().Invoke(mediaPlayerInstance) == 1);
 }
Beispiel #16
0
 public void ReleaseMediaPlayer(VlcMediaPlayerInstance mediaPlayerInstance)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         return;
     }
     try
     {
         GetInteropDelegate <ReleaseMediaPlayer>().Invoke(mediaPlayerInstance);
     }
     finally
     {
         mediaPlayerInstance.Pointer = IntPtr.Zero;
     }
 }
Beispiel #17
0
        private void ResetFromMediaCore(Control ctrl)
        {
            VideoHostControlHandle = IntPtr.Zero;
            var mediaInstance = GetMedia().MediaInstance;

            if (ctrl != null)
            {
                ctrl.GetType().GetMethod("RecreateHandle", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(ctrl, null);
            }
            myMediaPlayerInstance.Pointer = IntPtr.Zero;
            myMediaPlayerInstance         = Manager.CreateMediaPlayerFromMedia(mediaInstance);
            RegisterEvents();
            Chapters  = new ChapterManagement(Manager, myMediaPlayerInstance);
            SubTitles = new SubTitlesManagement(Manager, myMediaPlayerInstance);
            Video     = new VideoManagement(Manager, myMediaPlayerInstance);
            Audio     = new AudioManagement(Manager, myMediaPlayerInstance);
            if (ctrl != null)
            {
                VideoHostControlHandle = ctrl.Handle;
            }
        }
Beispiel #18
0
        internal VlcMediaPlayer(VlcManager manager)
        {
            Manager = manager;
#if DEBUG
            Manager.CreateNewInstance(new[]
            {
                //"--extraintf=logger",
                "--verbose=2"
            });
#else
            Manager.CreateNewInstance(new[]
            {
                "--quiet"
            });
#endif
            myMediaPlayerInstance = manager.CreateMediaPlayer();
            RegisterEvents();
            Chapters  = new ChapterManagement(manager, myMediaPlayerInstance);
            SubTitles = new SubTitlesManagement(manager, myMediaPlayerInstance);
            Video     = new VideoManagement(manager, myMediaPlayerInstance);
            Audio     = new AudioManagement(manager, myMediaPlayerInstance);
        }
Beispiel #19
0
 public void SetAudioOutputDevice(VlcMediaPlayerInstance mediaPlayerInstance, string audioOutputDescriptionName, string deviceName)
 {
     GetInteropDelegate <SetAudioOutputDevice>().Invoke(mediaPlayerInstance, StringExtensions.ToHGlobalAnsi(audioOutputDescriptionName), StringExtensions.ToHGlobalAnsi(deviceName));
 }
Beispiel #20
0
 internal AudioOutputDevices(AudioOutputDescription audioOutputDescription, VlcManager manager, VlcMediaPlayerInstance mediaPlayerInstance)
 {
     myAudioOutputDescription = audioOutputDescription;
     myManager             = manager;
     myMediaPlayerInstance = mediaPlayerInstance;
 }
Beispiel #21
0
        internal static List <AudioOutputDescription> GetSubOutputDescription(AudioOutputDescriptionStructure module, VlcManager manager, VlcMediaPlayerInstance mediaPlayerInstance)
        {
            var result = new List <AudioOutputDescription>();

            result.Add(new AudioOutputDescription(module.Name, module.Description, manager, mediaPlayerInstance));
            if (module.NextAudioOutputDescription != IntPtr.Zero)
            {
                AudioOutputDescriptionStructure nextModule = (AudioOutputDescriptionStructure)Marshal.PtrToStructure(module.NextAudioOutputDescription, typeof(AudioOutputDescriptionStructure));
                var data = GetSubOutputDescription(nextModule, manager, mediaPlayerInstance);
                result.AddRange(data);
            }
            return(result);
        }
Beispiel #22
0
 public SubTitlesManagement(VlcManager manager, VlcMediaPlayerInstance mediaPlayerInstance)
 {
     myManager     = manager;
     myMediaPlayer = mediaPlayerInstance;
 }
Beispiel #23
0
 internal AudioOutputsManagement(VlcManager manager, VlcMediaPlayerInstance mediaPlayerInstance)
 {
     myManager             = manager;
     myMediaPlayerInstance = mediaPlayerInstance;
 }
Beispiel #24
0
 internal VideoTracksManagement(VlcManager manager, VlcMediaPlayerInstance mediaPlayerInstance)
 {
     myManager     = manager;
     myMediaPlayer = mediaPlayerInstance;
 }