コード例 #1
0
ファイル: VlcMedia.cs プロジェクト: kgloveyou/xZune.Vlc
        /// <summary>
        /// 通过给定的文件路径创建一个新的 VlcMedia
        /// </summary>
        /// <param name="vlc">Vlc 对象</param>
        /// <param name="path">文件路径</param>
        public static VlcMedia CreateFormPath(Vlc vlc, String path)
        {
            GCHandle handle = GCHandle.Alloc(Encoding.UTF8.GetBytes(path), GCHandleType.Pinned);
            var      media  = new VlcMedia(_createMediaFormPathFunction.Delegate(vlc.InstancePointer, handle.AddrOfPinnedObject()));

            handle.Free();
            return(media);
        }
コード例 #2
0
ファイル: VlcMedia.cs プロジェクト: kgloveyou/xZune.Vlc
        /// <summary>
        /// 通过名称创建一个新的 VlcMedia
        /// </summary>
        /// <param name="vlc">Vlc 对象</param>
        /// <param name="name">媒体名称</param>
        public static VlcMedia CreateAsNewNode(Vlc vlc, String name)
        {
            GCHandle handle = GCHandle.Alloc(Encoding.UTF8.GetBytes(name), GCHandleType.Pinned);
            var      madia  = new VlcMedia(_createMediaAsNewNodeFunction.Delegate(vlc.InstancePointer, handle.AddrOfPinnedObject()));

            handle.Free();
            return(madia);
        }
コード例 #3
0
 public static void Init()
 {
     if (!IsInited)
     {
         xZune.Vlc.Vlc.LoadLibVlc(LibVlcPath);
         Vlc = new xZune.Vlc.Vlc(VlcOption);
     }
 }
コード例 #4
0
ファイル: ApiManager.cs プロジェクト: TheThing/FiloStreamer
 public static void Init()
 {
     if(!IsInited)
     {
         xZune.Vlc.Vlc.LoadLibVlc(LibVlcPath);
         Vlc = new xZune.Vlc.Vlc(VlcOption);
     }
 }
コード例 #5
0
ファイル: VlcMedia.cs プロジェクト: kgloveyou/xZune.Vlc
        /// <summary>
        /// 获取媒体的基本流的描述,注意,在调用该方法之前你需要首先调用 <see cref="ParseMedia"/> 方法,或者至少播放一次.
        /// 否则,你将的得到一个空数组
        /// </summary>
        /// <returns>一个 <see cref="MediaTrackInfo"/> 数组</returns>
        public MediaTrackInfo[] GetTrackInfo()
        {
            IntPtr pointer;
            var    count  = _getTracksInfoFunction.Delegate(InstancePointer, out pointer);
            var    result = new MediaTrackInfo[count];
            var    temp   = pointer;

            for (var i = 0; i < count; i++)
            {
                result[i] = (MediaTrackInfo)Marshal.PtrToStructure(temp, typeof(MediaTrackInfo));
                temp      = (IntPtr)((int)temp + Marshal.SizeOf(typeof(MediaTrackInfo)));
            }

            Vlc.Free(pointer);
            return(result);
        }
コード例 #6
0
ファイル: LibVlcManager.cs プロジェクト: s-arash/xZune.Vlc
        /// <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-xZune 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();
        }
コード例 #7
0
ファイル: VlcMedia.cs プロジェクト: kgloveyou/xZune.Vlc
 /// <summary>
 /// 通过给定的文件描述符创建一个新的 VlcMedia
 /// </summary>
 /// <param name="vlc">Vlc 对象</param>
 /// <param name="fileDescriptor">文件描述符</param>
 public static VlcMedia CreateFormFileDescriptor(Vlc vlc, int fileDescriptor)
 {
     return(new VlcMedia(_createMediaFormFileDescriptorFunction.Delegate(vlc.InstancePointer, fileDescriptor)));
 }
コード例 #8
0
 /// <summary>
 /// 释放当前的 ModuleDescription 资源
 /// </summary>
 public void Dispose()
 {
     Vlc.ReleaseModuleDescription(this);
     Items   = null;
     Pointer = IntPtr.Zero;
 }
コード例 #9
0
 public void Dispose()
 {
     HandleManager.Remove(this);
     Vlc.Free(InstancePointer);
     InstancePointer = IntPtr.Zero;
 }
コード例 #10
0
 /// <summary>
 /// 通过给定的文件路径创建一个新的 VlcMedia
 /// </summary>
 /// <param name="vlc">Vlc 对象</param>
 /// <param name="path">文件路径</param>
 public static VlcMedia CreateFormPath(Vlc vlc, String path)
 {
     return(new VlcMedia(CreateMediaFormPathFunction.Delegate(vlc.InstancePointer, path)));
 }
コード例 #11
0
 /// <summary>
 /// 通过给定的文件 Url 创建一个新的 VlcMedia,该 Url 的格式必须以 "file://" 开头,参见 "RFC3986".
 /// </summary>
 /// <param name="vlc">Vlc 对象</param>
 /// <param name="url">文件 Url</param>
 public static VlcMedia CreateFormLocation(Vlc vlc, String url)
 {
     return(new VlcMedia(CreateMediaFormLocationFunction.Delegate(vlc.InstancePointer, url)));
 }
コード例 #12
0
 /// <summary>
 /// 通过名称创建一个新的 VlcMedia
 /// </summary>
 /// <param name="vlc">Vlc 对象</param>
 /// <param name="name">媒体名称</param>
 public static VlcMedia CreateAsNewNode(Vlc vlc, String name)
 {
     return(new VlcMedia(CreateMediaAsNewNodeFunction.Delegate(vlc.InstancePointer, name)));
 }
コード例 #13
0
ファイル: VlcMedia.cs プロジェクト: TheThing/FiloStreamer
 /// <summary>
 /// 通过给定的文件路径创建一个新的 VlcMedia
 /// </summary>
 /// <param name="vlc">Vlc 对象</param>
 /// <param name="path">文件路径</param>
 public static VlcMedia CreateFormPath(Vlc vlc,String path)
 {
     return new VlcMedia(CreateMediaFormPathFunction.Delegate(vlc.InstancePointer, path));
 }
コード例 #14
0
ファイル: VlcMedia.cs プロジェクト: TheThing/FiloStreamer
 /// <summary>
 /// 通过给定的文件 Url 创建一个新的 VlcMedia,该 Url 的格式必须以 "file://" 开头,参见 "RFC3986".
 /// </summary>
 /// <param name="vlc">Vlc 对象</param>
 /// <param name="url">文件 Url</param>
 public static VlcMedia CreateFormLocation(Vlc vlc,String url)
 {
     return new VlcMedia(CreateMediaFormLocationFunction.Delegate(vlc.InstancePointer, url));
 }
コード例 #15
0
ファイル: VlcMedia.cs プロジェクト: TheThing/FiloStreamer
 /// <summary>
 /// 通过给定的文件描述符创建一个新的 VlcMedia
 /// </summary>
 /// <param name="vlc">Vlc 对象</param>
 /// <param name="fileDescriptor">文件描述符</param>
 public static VlcMedia CreateFormFileDescriptor(Vlc vlc,int fileDescriptor)
 {
     return new VlcMedia(CreateMediaFormFileDescriptorFunction.Delegate(vlc.InstancePointer, fileDescriptor));
 }
コード例 #16
0
ファイル: VlcMedia.cs プロジェクト: TheThing/FiloStreamer
 /// <summary>
 /// 通过名称创建一个新的 VlcMedia
 /// </summary>
 /// <param name="vlc">Vlc 对象</param>
 /// <param name="name">媒体名称</param>
 public static VlcMedia CreateAsNewNode(Vlc vlc,String name)
 {
     return new VlcMedia(CreateMediaAsNewNodeFunction.Delegate(vlc.InstancePointer, name));
 }
コード例 #17
0
ファイル: VlcMediaPlayer.cs プロジェクト: 19871010/xZune.Vlc
 public static VlcMediaPlayer Create(Vlc vlc)
 {
     return new VlcMediaPlayer(_createMediaPlayerFunction.Delegate(vlc.InstancePointer));
 }
コード例 #18
0
 public static VlcMediaPlayer Create(Vlc vlc)
 {
     return(new VlcMediaPlayer(CreateMediaPlayerFunction.Delegate(vlc.InstancePointer)));
 }