Beispiel #1
0
        public MediaTrackInfosStructure[] GetMediaTracksInformations(VlcMediaInstance mediaInstance)
        {
            if (mediaInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media instance is not initialized.");
            }
            var fullBuffer = IntPtr.Zero;
            var cpt        = GetInteropDelegate <GetMediaTracksInformations>().Invoke(mediaInstance, out fullBuffer);

            if (cpt <= 0)
            {
                return(new MediaTrackInfosStructure[0]);
            }
            var result = new MediaTrackInfosStructure[cpt];
            var buffer = fullBuffer;

            for (int index = 0; index < cpt; index++)
            {
                result[index] = (MediaTrackInfosStructure)Marshal.PtrToStructure(buffer, typeof(MediaTrackInfosStructure));
#if X86
                buffer = new IntPtr(buffer.ToInt32() + Marshal.SizeOf(typeof(MediaTrackInfosStructure)));
#else
                buffer = new IntPtr(buffer.ToInt64() + Marshal.SizeOf(typeof(MediaTrackInfosStructure)));
#endif
            }
            Free(fullBuffer);
            return(result);
        }
Beispiel #2
0
 public VlcMediaInstance CloneMedia(VlcMediaInstance mediaInstance)
 {
     if (mediaInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media instance is not initialized.");
     }
     return(VlcMediaInstance.New(this, GetInteropDelegate <CloneMedia>().Invoke(mediaInstance)));
 }
Beispiel #3
0
 public MediaStates GetMediaState(VlcMediaInstance mediaInstance)
 {
     if (mediaInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media instance is not initialized.");
     }
     return(GetInteropDelegate <GetMediaState>().Invoke(mediaInstance));
 }
Beispiel #4
0
        public VlcMediaInstance CreateNewMediaFromLocation(string mrl)
        {
            var handle = GCHandle.Alloc(Encoding.UTF8.GetBytes(mrl), GCHandleType.Pinned);
            var result = VlcMediaInstance.New(this, GetInteropDelegate <CreateNewMediaFromLocation>().Invoke(myVlcInstance, handle.AddrOfPinnedObject()));

            handle.Free();
            return(result);
        }
Beispiel #5
0
 public void ParseMediaAsync(VlcMediaInstance mediaPlayerInstance)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     GetInteropDelegate <ParseMediaAsync>().Invoke(mediaPlayerInstance);
 }
 public VlcMediaEventManagerInstance GetMediaEventManager(VlcMediaInstance mediaInstance)
 {
     if (mediaInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media instance is not initialized.");
     }
     return(new VlcMediaEventManagerInstance(this, GetInteropDelegate <GetMediaEventManager>().Invoke(mediaInstance)));
 }
 public VlcMediaPlayerInstance CreateMediaPlayerFromMedia(VlcMediaInstance mediaInstance)
 {
     if (mediaInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media instance is not initialized.");
     }
     return(new VlcMediaPlayerInstance(this, GetInteropDelegate <CreateMediaPlayerFromMedia>().Invoke(mediaInstance)));
 }
 public bool SaveMediaMetadatas(VlcMediaInstance mediaInstance)
 {
     if (mediaInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media instance is not initialized.");
     }
     return(GetInteropDelegate <SaveMediaMetadatas>().Invoke(mediaInstance) == 1);
 }
Beispiel #9
0
 public bool IsParsedMedia(VlcMediaInstance mediaInstance)
 {
     if (mediaInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media instance is not initialized.");
     }
     return(GetInteropDelegate <IsParsedMedia>().Invoke(mediaInstance) == 1);
 }
Beispiel #10
0
 public void ReleaseMedia(VlcMediaInstance mediaInstance)
 {
     if (mediaInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media instance is not initialized.");
     }
     GetInteropDelegate <ReleaseMedia>().Invoke(mediaInstance);
 }
 public VlcMediaInstance GetMediaFromMediaPlayer(VlcMediaPlayerInstance mediaPlayerInstance)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     return(VlcMediaInstance.New(this, GetInteropDelegate <GetMediaFromMediaPlayer>().Invoke(mediaPlayerInstance)));
 }
Beispiel #12
0
        public string GetMediaMrl(VlcMediaInstance mediaInstance)
        {
            if (mediaInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media instance is not initialized.");
            }
            var ptr = GetInteropDelegate <GetMediaMrl>().Invoke(mediaInstance);

            return(Marshal.PtrToStringAnsi(ptr));
        }
Beispiel #13
0
        public MediaStatsStructure GetMediaStats(VlcMediaInstance mediaInstance)
        {
            if (mediaInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media instance is not initialized.");
            }
            var result = new MediaStatsStructure();

            GetInteropDelegate <GetMediaStats>().Invoke(mediaInstance, out result);
            return(result);
        }
Beispiel #14
0
        public void AddOptionFlagToMedia(VlcMediaInstance mediaInstance, string option, uint flag)
        {
            if (mediaInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media instance is not initialized.");
            }
            var handle = GCHandle.Alloc(Encoding.UTF8.GetBytes(option), GCHandleType.Pinned);

            GetInteropDelegate <AddOptionFlagToMedia>().Invoke(mediaInstance, handle.AddrOfPinnedObject(), flag);
            handle.Free();
        }
Beispiel #15
0
        public void SetMediaMeta(VlcMediaInstance mediaInstance, MediaMetadatas metadata, string value)
        {
            if (mediaInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media instance is not initialized.");
            }
            var handle = GCHandle.Alloc(Encoding.UTF8.GetBytes(value), GCHandleType.Pinned);

            GetInteropDelegate <SetMediaMetadata>().Invoke(mediaInstance, metadata, handle.AddrOfPinnedObject());
            handle.Free();
        }
 public void AddOptionToMedia(VlcMediaInstance mediaInstance, string[] options)
 {
     if (mediaInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media instance is not initialized.");
     }
     options = options ?? new string[0];
     foreach (var option in options)
     {
         AddOptionToMedia(mediaInstance, option);
     }
 }
Beispiel #17
0
        public static VlcMediaInstance New(VlcManager manager, IntPtr pointer)
        {
            var instance = allInstances.Find(delegate(VlcMediaInstance i)
            {
                return(i == pointer);
            });

            if (null == instance)
            {
                instance = new VlcMediaInstance(manager, pointer);
                allInstances.Add(instance);
            }
            return(instance);
        }
Beispiel #18
0
        public string GetMediaMeta(VlcMediaInstance mediaInstance, MediaMetadatas metadata)
        {
            if (mediaInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media instance is not initialized.");
            }
            var ptr = GetInteropDelegate <GetMediaMetadata>().Invoke(mediaInstance, metadata);

            if (ptr == IntPtr.Zero)
            {
                return(null);
            }
            return(Marshal.PtrToStringAnsi(ptr));
        }
        public void AddOptionToMedia(VlcMediaInstance mediaInstance, string option)
        {
            if (mediaInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media instance is not initialized.");
            }
            if (string.IsNullOrEmpty(option))
            {
                return;
            }
            var handle = GCHandle.Alloc(Encoding.ASCII.GetBytes(option), GCHandleType.Pinned);

            GetInteropDelegate <AddOptionToMedia>().Invoke(mediaInstance, handle.AddrOfPinnedObject());
            handle.Free();
        }
Beispiel #20
0
        private void OnMediaSubItemTreeAddedInternal(IntPtr ptr)
        {
            var args = (VlcEventArg)Marshal.PtrToStructure(ptr, typeof(VlcEventArg));

            OnMediaSubItemTreeAdded(new VlcMedia(myVlcMediaPlayer, VlcMediaInstance.New(myVlcMediaPlayer.Manager, args.MediaSubItemTreeAdded.MediaInstance)));
        }
 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);
 }
Beispiel #22
0
        private void OnMediaPlayerMediaChangedInternal(IntPtr ptr)
        {
            var args = (VlcEventArg)Marshal.PtrToStructure(ptr, typeof(VlcEventArg));

            OnMediaPlayerMediaChanged(new VlcMedia(this, VlcMediaInstance.New(Manager, args.MediaPlayerMediaChanged.MediaInstance)));
        }
Beispiel #23
0
 public static VlcMediaInstance AddOptionToMedia(VlcMediaInstance mediaInstance, VlcManager manager, string option)
Beispiel #24
0
        public static VlcMediaInstance AddOptionToMedia(this VlcMediaInstance mediaInstance, VlcManager manager, string[] option)
#endif
        {
            manager.AddOptionToMedia(mediaInstance, option);
            return(mediaInstance);
        }