Exemplo n.º 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);
        }
Exemplo n.º 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)));
 }
Exemplo n.º 3
0
 public MediaStates GetMediaState(VlcMediaInstance mediaInstance)
 {
     if (mediaInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media instance is not initialized.");
     }
     return(GetInteropDelegate <GetMediaState>().Invoke(mediaInstance));
 }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
 public void ParseMediaAsync(VlcMediaInstance mediaPlayerInstance)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     GetInteropDelegate <ParseMediaAsync>().Invoke(mediaPlayerInstance);
 }
Exemplo n.º 6
0
 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)));
 }
Exemplo n.º 8
0
 public bool SaveMediaMetadatas(VlcMediaInstance mediaInstance)
 {
     if (mediaInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media instance is not initialized.");
     }
     return(GetInteropDelegate <SaveMediaMetadatas>().Invoke(mediaInstance) == 1);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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)));
 }
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 16
0
 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);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }
Exemplo n.º 19
0
        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();
        }
Exemplo n.º 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)));
        }
Exemplo n.º 21
0
 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);
 }
Exemplo n.º 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)));
        }
Exemplo n.º 23
0
 public static VlcMediaInstance AddOptionToMedia(VlcMediaInstance mediaInstance, VlcManager manager, string option)
Exemplo n.º 24
0
        public static VlcMediaInstance AddOptionToMedia(this VlcMediaInstance mediaInstance, VlcManager manager, string[] option)
#endif
        {
            manager.AddOptionToMedia(mediaInstance, option);
            return(mediaInstance);
        }