public List <AudioOutputDescriptionStructure> GetAudioOutputsDescriptions()
        {
            EnsureVlcInstance();

            var first  = GetInteropDelegate <GetAudioOutputsDescriptions>().Invoke(myVlcInstance);
            var result = new List <AudioOutputDescriptionStructure>();

            if (first == IntPtr.Zero)
            {
                return(result);
            }

            try
            {
                var currentPtr = first;
                while (currentPtr != IntPtr.Zero)
                {
                    var current = MarshalHelper.PtrToStructure <AudioOutputDescriptionStructureInternal>(currentPtr);
                    result.Add(new AudioOutputDescriptionStructure
                    {
                        Name        = Utf8InteropStringConverter.Utf8InteropToString(current.Name),
                        Description = Utf8InteropStringConverter.Utf8InteropToString(current.Description)
                    });

                    currentPtr = current.NextAudioOutputDescription;
                }

                return(result);
            }
            finally
            {
                GetInteropDelegate <ReleaseAudioOutputDescription>().Invoke(first);
            }
        }
示例#2
0
 public string GetAudioOutputDeviceName(string audioOutputDescriptionName, int deviceIndex)
 {
     using (var audioOutputInterop = Utf8InteropStringConverter.ToUtf8StringHandle(audioOutputDescriptionName))
     {
         return(Utf8InteropStringConverter.Utf8InteropToString(myLibraryLoader.GetInteropDelegate <GetAudioOutputDeviceName>().Invoke(myVlcInstance, audioOutputInterop, deviceIndex)));
     }
 }
        public IEnumerable <AudioOutputDevice> GetAudioOutputDeviceList(string outputName)
        {
            using (var outputNameHandle = Utf8InteropStringConverter.ToUtf8StringHandle(outputName))
            {
                var deviceList = myLibraryLoader.GetInteropDelegate <GetAudioOutputDeviceList>().Invoke(this.myVlcInstance, outputNameHandle);
                try
                {
                    var result         = new List <AudioOutputDevice>();
                    var currentPointer = deviceList;
                    while (currentPointer != IntPtr.Zero)
                    {
                        var current = MarshalHelper.PtrToStructure <LibvlcAudioOutputDeviceT>(currentPointer);
                        result.Add(new AudioOutputDevice
                        {
                            DeviceIdentifier = Utf8InteropStringConverter.Utf8InteropToString(current.DeviceIdentifier),
                            Description      = Utf8InteropStringConverter.Utf8InteropToString(current.Description)
                        });
                        currentPointer = current.Next;
                    }

                    return(result);
                }
                finally
                {
                    myLibraryLoader.GetInteropDelegate <ReleaseAudioOutputDeviceList>().Invoke(deviceList);
                }
            }
        }
 public VlcMediaInstance CreateNewMediaFromLocation(string mrl)
 {
     using (var handle = Utf8InteropStringConverter.ToUtf8StringHandle(mrl))
     {
         return(VlcMediaInstance.New(this, myLibraryLoader.GetInteropDelegate <CreateNewMediaFromLocation>().Invoke(myVlcInstance, handle)));
     }
 }
示例#5
0
 public int GetAudioOutputDeviceCount(string outputName)
 {
     using (var outputNameHandle = Utf8InteropStringConverter.ToUtf8StringHandle(outputName))
     {
         return(myLibraryLoader.GetInteropDelegate <GetAudioOutputDeviceCount>().Invoke(myVlcInstance, outputNameHandle));
     }
 }
 public int SetAudioOutput(VlcMediaPlayerInstance mediaPlayerInstance, string outputName)
 {
     using (var outputInterop = Utf8InteropStringConverter.ToUtf8StringHandle(outputName))
     {
         return(myLibraryLoader.GetInteropDelegate <SetAudioOutput>().Invoke(mediaPlayerInstance, outputInterop));
     }
 }
 public string GetVideoAspectRatio(VlcMediaPlayerInstance mediaPlayerInstance)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     return(Utf8InteropStringConverter.Utf8InteropToString(myLibraryLoader.GetInteropDelegate <GetVideoAspectRatio>().Invoke(mediaPlayerInstance)));
 }
 /// <summary>
 /// Sets the application name.
 /// LibVLC passes this as the user agent string when a protocol requires it.
 /// </summary>
 /// <param name="name">human-readable application name, e.g. "FooBar player 1.2.3"</param>
 /// <param name="http">HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0"</param>
 public void SetUserAgent(string name, string http)
 {
     using (var nameInterop = Utf8InteropStringConverter.ToUtf8StringHandle(name))
         using (var httpInterop = Utf8InteropStringConverter.ToUtf8StringHandle(http))
         {
             myLibraryLoader.GetInteropDelegate <SetUserAgent>().Invoke(this.myVlcInstance, nameInterop, httpInterop);
         }
 }
 public void SetAudioOutputDevice(VlcMediaPlayerInstance mediaPlayerInstance, string audioOutputDescriptionName, string deviceName)
 {
     using (var audioOutputInterop = Utf8InteropStringConverter.ToUtf8Interop(audioOutputDescriptionName))
         using (var deviceNameInterop = Utf8InteropStringConverter.ToUtf8Interop(audioOutputDescriptionName))
         {
             GetInteropDelegate <SetAudioOutputDevice>().Invoke(mediaPlayerInstance, audioOutputInterop.DangerousGetHandle(), deviceNameInterop.DangerousGetHandle());
         }
 }
示例#10
0
 public void SetAudioOutputDevice(VlcMediaPlayerInstance mediaPlayerInstance, string audioOutputDescriptionName, string deviceName)
 {
     using (var audioOutputInterop = Utf8InteropStringConverter.ToUtf8StringHandle(audioOutputDescriptionName))
         using (var deviceNameInterop = Utf8InteropStringConverter.ToUtf8StringHandle(audioOutputDescriptionName))
         {
             myLibraryLoader.GetInteropDelegate <SetAudioOutputDevice>().Invoke(mediaPlayerInstance, audioOutputInterop, deviceNameInterop);
         }
 }
 public string GetVideoMarqueeText(VlcMediaPlayerInstance mediaPlayerInstance)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     return(Utf8InteropStringConverter.Utf8InteropToString(GetInteropDelegate <GetVideoMarqueeString>().Invoke(mediaPlayerInstance, VideoMarqueeOptions.Text)));
 }
示例#12
0
        public void SetAudioOutput(string outputName)
        {
            EnsureVlcInstance();

            using (var outputInterop = Utf8InteropStringConverter.ToUtf8Interop(outputName))
            {
                GetInteropDelegate <SetAudioOutput>().Invoke(myVlcInstance, outputInterop.DangerousGetHandle());
            }
        }
示例#13
0
        public VlcMediaInstance CreateNewMediaFromPath(string mrl)
        {
            EnsureVlcInstance();

            using (var handle = Utf8InteropStringConverter.ToUtf8StringHandle(mrl))
            {
                return(VlcMediaInstance.New(this, GetInteropDelegate <CreateNewMediaFromPath>().Invoke(myVlcInstance, handle)));
            }
        }
 /// <summary>
 /// Sets some meta-information about the application.
 /// </summary>
 /// <seealso cref="SetUserAgent" />
 /// <param name="id">Java-style application identifier, e.g. "com.acme.foobar"</param>
 /// <param name="version">application version numbers, e.g. "1.2.3"</param>
 /// <param name="icon">application icon name, e.g. "foobar"</param>
 public void SetAppId(string id, string version, string icon)
 {
     using (var idInterop = Utf8InteropStringConverter.ToUtf8StringHandle(id))
         using (var versionInterop = Utf8InteropStringConverter.ToUtf8StringHandle(version))
             using (var iconInterop = Utf8InteropStringConverter.ToUtf8StringHandle(icon))
             {
                 myLibraryLoader.GetInteropDelegate <SetAppId>().Invoke(this.myVlcInstance, idInterop, versionInterop, iconInterop);
             }
 }
        public VlcMediaInstance CreateNewMediaFromLocation(string mrl)
        {
            EnsureVlcInstance();

            using (var handle = Utf8InteropStringConverter.ToUtf8Interop(mrl))
            {
                return(VlcMediaInstance.New(this, GetInteropDelegate <CreateNewMediaFromLocation>().Invoke(myVlcInstance, handle.DangerousGetHandle())));
            }
        }
        public string GetAudioOutputDeviceName(string audioOutputDescriptionName, int deviceIndex)
        {
            EnsureVlcInstance();

            using (var audioOutputInterop = Utf8InteropStringConverter.ToUtf8Interop(audioOutputDescriptionName))
            {
                return(Utf8InteropStringConverter.Utf8InteropToString(GetInteropDelegate <GetAudioOutputDeviceName>().Invoke(myVlcInstance, audioOutputInterop.DangerousGetHandle(), deviceIndex)));
            }
        }
        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);

            return(Utf8InteropStringConverter.Utf8InteropToString(ptr));
        }
        public string GetMediaMrl(VlcMediaInstance mediaInstance)
        {
            if (mediaInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media instance is not initialized.");
            }
            var ptr = myLibraryLoader.GetInteropDelegate <GetMediaMrl>().Invoke(mediaInstance);

            return(Utf8InteropStringConverter.Utf8InteropToString(ptr));
        }
 public void SetVideoDeinterlace(VlcMediaPlayerInstance mediaPlayerInstance, string deinterlaceMode)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     using (var deinterlaceModeInterop = Utf8InteropStringConverter.ToUtf8Interop(deinterlaceMode))
     {
         GetInteropDelegate <SetVideoDeinterlace>().Invoke(mediaPlayerInstance, deinterlaceModeInterop.DangerousGetHandle());
     }
 }
 public void SetVideoLogoFile(VlcMediaPlayerInstance mediaPlayerInstance, string value)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     using (var valueInterop = Utf8InteropStringConverter.ToUtf8StringHandle(value))
     {
         myLibraryLoader.GetInteropDelegate <SetVideoLogoString>().Invoke(mediaPlayerInstance, VideoLogoOptions.File, valueInterop);
     }
 }
示例#21
0
 public void SetMediaMeta(VlcMediaInstance mediaInstance, MediaMetadatas metadata, string value)
 {
     if (mediaInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media instance is not initialized.");
     }
     using (var handle = Utf8InteropStringConverter.ToUtf8Interop(value))
     {
         GetInteropDelegate <SetMediaMetadata>().Invoke(mediaInstance, metadata, handle.DangerousGetHandle());
     }
 }
        /// <summary>
        /// Get codec description from media elementary stream.
        ///  LibVLC 3.0.0 and later.
        /// </summary>
        /// <param name="type">The media track type</param>
        /// <param name="codec">The codec 4CC</param>
        /// <returns>The codec description</returns>
        public string GetCodecDescription(MediaTrackTypes type, UInt32 codec)
        {
            if (VlcVersionNumber.Major < 3)
            {
                throw new InvalidOperationException($"You need VLC version 3.0 or higher to be able to use {nameof(GetCodecDescription)}");
            }

            var ptr = myLibraryLoader.GetInteropDelegate <GetCodecDescription>().Invoke(type, codec);

            return(Utf8InteropStringConverter.Utf8InteropToString(ptr));
        }
 public void SetVideoMarqueeText(VlcMediaPlayerInstance mediaPlayerInstance, string value)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     using (var valueInterop = Utf8InteropStringConverter.ToUtf8StringHandle(value))
     {
         GetInteropDelegate <SetVideoMarqueeString>().Invoke(mediaPlayerInstance, VideoMarqueeOptions.Text, valueInterop);
     }
 }
        public void SetVideoAspectRatio(VlcMediaPlayerInstance mediaPlayerInstance, string aspectRatio)
        {
            if (mediaPlayerInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media player instance is not initialized.");
            }

            using (var aspectRatioInterop = Utf8InteropStringConverter.ToUtf8StringHandle(aspectRatio))
            {
                myLibraryLoader.GetInteropDelegate <SetVideoAspectRatio>().Invoke(mediaPlayerInstance, aspectRatioInterop);
            }
        }
        public void AddOptionFlagToMedia(VlcMediaInstance mediaInstance, string option, uint flag)
        {
            if (mediaInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media instance is not initialized.");
            }

            using (var handle = Utf8InteropStringConverter.ToUtf8StringHandle(option))
            {
                GetInteropDelegate <AddOptionFlagToMedia>().Invoke(mediaInstance, handle, flag);
            }
        }
示例#26
0
        public void SetVideoCropGeometry(VlcMediaPlayerInstance mediaPlayerInstance, string cropGeometry)
        {
            if (mediaPlayerInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media player instance is not initialized.");
            }

            using (var cropGeometryInterop = Utf8InteropStringConverter.ToUtf8StringHandle(cropGeometry))
            {
                myLibraryLoader.GetInteropDelegate <SetVideoCropGeometry>()
                .Invoke(mediaPlayerInstance, cropGeometryInterop);
            }
        }
 public bool TakeSnapshot(VlcMediaPlayerInstance mediaPlayerInstance, uint outputNumber, string filePath, uint width, uint height)
 {
     if (mediaPlayerInstance == IntPtr.Zero)
     {
         throw new ArgumentException("Media player instance is not initialized.");
     }
     if (filePath == null)
     {
         throw new ArgumentNullException(nameof(filePath));
     }
     using (var filePathHandle = Utf8InteropStringConverter.ToUtf8StringHandle(filePath))
     {
         return(myLibraryLoader.GetInteropDelegate <TakeSnapshot>().Invoke(mediaPlayerInstance, outputNumber, filePathHandle, width, height) == 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;
            }

            using (var handle = Utf8InteropStringConverter.ToUtf8Interop(option))
            {
                GetInteropDelegate <AddOptionToMedia>().Invoke(mediaInstance, handle.DangerousGetHandle());
            }
        }
        /// <summary>
        /// Gets log message debug infos.
        ///
        /// This function retrieves self-debug information about a log message:
        /// - the name of the VLC module emitting the message,
        /// - the name of the source code module (i.e.file) and
        /// - the line number within the source code module.
        ///
        /// The returned module name and file name will be NULL if unknown.
        /// The returned line number will similarly be zero if unknown.
        /// </summary>
        /// <param name="logContext">The log message context (as passed to the <see cref="LogCallback"/>)</param>
        /// <param name="module">The module name storage.</param>
        /// <param name="file">The source code file name storage.</param>
        /// <param name="line">The source code file line number storage.</param>
        public void GetLogContext(IntPtr logContext, out string module, out string file, out uint?line)
        {
            UIntPtr _line;
            IntPtr  _module;
            IntPtr  _file;

            GetInteropDelegate <GetLogContext>().Invoke(logContext, out _module, out _file, out _line);
            if (_line == UIntPtr.Zero)
            {
                line = null;
            }
            else
            {
                line = _line.ToUInt32();
            }

            module = Utf8InteropStringConverter.Utf8InteropToString(_module);
            file   = Utf8InteropStringConverter.Utf8InteropToString(_file);
        }
示例#30
0
        /// <summary>
        /// Gets log message debug infos.
        ///
        /// This function retrieves self-debug information about a log message:
        /// - the name of the VLC module emitting the message,
        /// - the name of the source code module (i.e.file) and
        /// - the line number within the source code module.
        ///
        /// The returned module name and file name will be NULL if unknown.
        /// The returned line number will similarly be zero if unknown.
        /// </summary>
        /// <param name="logContext">The log message context (as passed to the <see cref="LogCallback"/>)</param>
        /// <param name="module">The module name storage.</param>
        /// <param name="file">The source code file name storage.</param>
        /// <param name="line">The source code file line number storage.</param>
        public void GetLogContext(IntPtr logContext, out string module, out string file, out uint?line)
        {
            UIntPtr line2;
            IntPtr  module2;
            IntPtr  file2;

            myLibraryLoader.GetInteropDelegate <GetLogContext>().Invoke(logContext, out module2, out file2, out line2);
            if (line2 == UIntPtr.Zero)
            {
                line = null;
            }
            else
            {
                line = line2.ToUInt32();
            }

            module = Utf8InteropStringConverter.Utf8InteropToString(module2);
            file   = Utf8InteropStringConverter.Utf8InteropToString(file2);
        }