示例#1
0
        /// <summary>
        ///     Create a new one by name VlcMedia
        /// </summary>
        /// <param name="vlc">Vlc Object</param>
        /// <param name="name">Media name</param>
        public static VlcMedia CreateAsNewNode(Vlc vlc, String name)
        {
            GCHandle handle = GCHandle.Alloc(Encoding.UTF8.GetBytes(name), GCHandleType.Pinned);
            var      madia  = new VlcMedia(vlc,
                                           _createMediaAsNewNodeFunction.Delegate(vlc.InstancePointer, handle.AddrOfPinnedObject()));

            handle.Free();
            return(madia);
        }
示例#2
0
        /// <summary>
        ///     Create a new VlcMedia from the given file path
        /// </summary>
        /// <param name="vlc">Vlc Object</param>
        /// <param name="path">path of file</param>
        public static VlcMedia CreateFormPath(Vlc vlc, String path)
        {
            GCHandle handle = GCHandle.Alloc(Encoding.UTF8.GetBytes(path), GCHandleType.Pinned);
            var      media  = new VlcMedia(vlc,
                                           _createMediaFromPathFunction.Delegate(vlc.InstancePointer, handle.AddrOfPinnedObject()));

            handle.Free();
            return(media);
        }
        /// <summary>
        ///     Load LibVlc dlls, and mapping all function.
        /// </summary>
        /// <param name="libVlcDirectory">directory of LibVlc</param>
        /// <exception cref="LibVlcLoadLibraryException">
        ///     Can't load LibVlc dlls, check the platform and LibVlc target platform
        ///     (should be same, x86 or x64).
        /// </exception>
        /// <exception cref="TypeLoadException">A custom attribute type cannot be loaded. </exception>
        /// <exception cref="NoLibVlcFunctionAttributeException">
        ///     For LibVlcFunction, need LibVlcFunctionAttribute to get Infomation
        ///     of function.
        /// </exception>
        /// <exception cref="FunctionNotFoundException">Can't find function in dll.</exception>
        /// <exception cref="VersionStringParseException">Can't parse libvlc version string, it must like "2.2.0-Meta Weatherwax".</exception>
        /// <exception cref="OverflowException">
        ///     At least one component of version represents a number greater than
        ///     <see cref="F:System.Int32.MaxValue" />.
        /// </exception>
        public static void LoadLibVlc(String libVlcDirectory = null)
        {
            LibVlcDirectory = libVlcDirectory == null ? "" : libVlcDirectory;

            if (IsLibLoaded)
            {
                return;
            }

            try
            {
                FileInfo libcore = new FileInfo(Path.Combine(LibVlcDirectory, "libvlccore.dll"));
                FileInfo libvlc  = new FileInfo(Path.Combine(LibVlcDirectory, "libvlc.dll"));
                LibVlcVCoreHandle = Win32Api.LoadLibrary(libcore.FullName);
                LibVlcHandle      = Win32Api.LoadLibrary(libvlc.FullName);
            }
            catch (Win32Exception e)
            {
                throw new LibVlcLoadLibraryException(e);
            }

            _getVersionFunction = new LibVlcFunction <GetVersion>();
            LibVlcVersion       = new LibVlcVersion(GetVersion());

            _getCompilerFunction  = new LibVlcFunction <GetCompiler>();
            _getChangesetFunction = new LibVlcFunction <GetChangeset>();
            _freeFunction         = new LibVlcFunction <Free>();
            _releaseLibVlcModuleDescriptionFunction = new LibVlcFunction <ReleaseLibVlcModuleDescription>();
            _releaseAudioOutputListFunction         = new LibVlcFunction <ReleaseAudioOutputList>();
            _releaseAudioDeviceListFunction         = new LibVlcFunction <ReleaseAudioDeviceList>();
            _releaseTrackDescriptionFunction        = new LibVlcFunction <ReleaseTrackDescription>();
            _releaseTracksFunction = new LibVlcFunction <ReleaseTracks>();

            Vlc.LoadLibVlc();
            VlcError.LoadLibVlc();
            VlcEventManager.LoadLibVlc();
            VlcMedia.LoadLibVlc();
            VlcMediaPlayer.LoadLibVlc();
            AudioEqualizer.LoadLibVlc();
        }
示例#4
0
文件: Vlc.cs 项目: phamvv/Meta.Vlc
 /// <summary>
 ///     通过给定的文件路径创建一个新的 VlcMedia
 /// </summary>
 /// <param name="path">文件路径</param>
 public VlcMedia CreateMediaFromPath(String path)
 {
     return(VlcMedia.CreateFormPath(this, path));
 }
示例#5
0
文件: Vlc.cs 项目: phamvv/Meta.Vlc
 /// <summary>
 ///     通过给定的文件 Url 创建一个新的 VlcMedia,该 Url 的格式必须以 "file://" 开头,参见 "RFC3986".
 /// </summary>
 /// <param name="url">文件 Url</param>
 public VlcMedia CreateMediaFromLocation(String url)
 {
     return(VlcMedia.CreateFormLocation(this, url));
 }
示例#6
0
文件: Vlc.cs 项目: phamvv/Meta.Vlc
 /// <summary>
 ///     通过给定的文件描述符创建一个新的 VlcMedia
 /// </summary>
 /// <param name="fileDescriptor">文件描述符</param>
 public VlcMedia CreateMediaFromFileDescriptor(int fileDescriptor)
 {
     return(VlcMedia.CreateFormFileDescriptor(this, fileDescriptor));
 }
示例#7
0
文件: Vlc.cs 项目: phamvv/Meta.Vlc
 /// <summary>
 ///     通过名称创建一个新的 VlcMedia
 /// </summary>
 /// <param name="name">媒体名称</param>
 public VlcMedia CreateMediaAsNewNode(String name)
 {
     return(VlcMedia.CreateAsNewNode(this, name));
 }