protected override void Initialize(Interop.Media.MediaTrack mediaTrack) { base.Initialize(mediaTrack); var subtitleTrack = (Interop.Media.SubtitleTrack)Marshal.PtrToStructure(Track, typeof(Interop.Media.SubtitleTrack)); Encoding = InteropHelper.PtrToString(subtitleTrack.Encoding); }
public String VlmGetInfomation(String name) { var nameHandle = InteropHelper.StringToPtr(name); var result = _returnJsonMessageFunction.Delegate(InstancePointer, nameHandle.AddrOfPinnedObject()); nameHandle.Free(); return(InteropHelper.PtrToString(result)); }
internal TrackDescription(IntPtr pointer) { _pointer = pointer; if (pointer != IntPtr.Zero) { Struct = (Interop.MediaPlayer.TrackDescription) Marshal.PtrToStructure(pointer, typeof(Interop.MediaPlayer.TrackDescription)); Name = InteropHelper.PtrToString(Struct.Name); Id = Struct.Id; } }
internal AudioDevice(IntPtr pointer) { _pointer = pointer; if (pointer != IntPtr.Zero) { _struct = (Interop.MediaPlayer.AudioDevice) Marshal.PtrToStructure(pointer, typeof(Interop.MediaPlayer.AudioDevice)); Device = InteropHelper.PtrToString(_struct.Device); Description = InteropHelper.PtrToString(_struct.Description); } }
protected virtual void Initialize(Interop.Media.MediaTrack mediaTrack) { Codec = mediaTrack.Codec; OriginalFourcc = mediaTrack.OriginalFourcc; Id = mediaTrack.Id; Type = mediaTrack.Type; Profile = mediaTrack.Profile; Level = mediaTrack.Level; Bitrate = mediaTrack.Bitrate; Language = InteropHelper.PtrToString(mediaTrack.Language); Description = InteropHelper.PtrToString(mediaTrack.Description); Track = mediaTrack.Track; }
internal ModuleDescription(IntPtr pointer) { _pointer = pointer; if (pointer != IntPtr.Zero) { _struct = (Interop.Core.ModuleDescription) Marshal.PtrToStructure(pointer, typeof(Interop.Core.ModuleDescription)); Name = InteropHelper.PtrToString(_struct.Name); ShortName = InteropHelper.PtrToString(_struct.ShortName); LongName = InteropHelper.PtrToString(_struct.LongName); Help = InteropHelper.PtrToString(_struct.Help); } }
/// <summary> /// 使用已经设定好的路径,载入 LibVlc /// </summary> public static void LoadLibVlc() { if (!IsLibLoaded) { try { FileInfo libcore = new FileInfo(Path.Combine(LibDirectory, @"libvlccore.dll")); FileInfo libvlc = new FileInfo(Path.Combine(LibDirectory, @"libvlc.dll")); LibCoreHandle = Win32Api.LoadLibrary(libcore.FullName); LibHandle = Win32Api.LoadLibrary(libvlc.FullName); } catch (Win32Exception e) { throw new Exception("无法载入 LibVlc 库", e); } _getVersionFunction = new LibVlcFunction <GetVersion>(LibHandle); var versionString = InteropHelper.PtrToString(_getVersionFunction.Delegate()); var match = Regex.Match(versionString, "^[0-9.]*"); if (match.Success) { LibVersion = new Version(match.Groups[0].Value); } var devString = LibDev = versionString.Split(' ', '-')[1]; _newInstanceFunction = new LibVlcFunction <NewInstance>(LibHandle, LibVersion, devString); _releaseInstanceFunction = new LibVlcFunction <ReleaseInstance>(LibHandle, LibVersion, devString); _retainInstanceFunction = new LibVlcFunction <RetainInstance>(LibHandle, LibVersion, devString); _addInterfaceFunction = new LibVlcFunction <AddInterface>(LibHandle, LibVersion, devString); _setExitHandlerFunction = new LibVlcFunction <SetExitHandler>(LibHandle, LibVersion, devString); _waitFunction = new LibVlcFunction <Wait>(LibHandle, LibVersion, devString); _setUserAgentFunction = new LibVlcFunction <SetUserAgent>(LibHandle, LibVersion, devString); _setAppIdFunction = new LibVlcFunction <SetAppId>(LibHandle, LibVersion, devString); _getCompilerFunction = new LibVlcFunction <GetCompiler>(LibHandle, LibVersion, devString); _getChangesetFunction = new LibVlcFunction <GetChangeset>(LibHandle, LibVersion, devString); _freeFunction = new LibVlcFunction <Free>(LibHandle, LibVersion, devString); _releaseLibVlcModuleDescriptionFunction = new LibVlcFunction <ReleaseLibVlcModuleDescription>(LibHandle, LibVersion, devString); _getAudioFilterListFunction = new LibVlcFunction <GetAudioFilterList>(LibHandle, LibVersion, devString); _getVideoFilterListFunction = new LibVlcFunction <GetVideoFilterList>(LibHandle, LibVersion, devString); VlcError.LoadLibVlc(LibHandle, LibVersion, devString); VlcEventManager.LoadLibVlc(LibHandle, LibVersion, devString); VlcMedia.LoadLibVlc(LibHandle, LibVersion, devString); VlcMediaPlayer.LoadLibVlc(LibHandle, LibVersion, devString); IsLibLoaded = true; } }
/// <summary> /// 获取 LibVlc 的变更集(?) /// </summary> public static String GetChangeset() { return(InteropHelper.PtrToString(GetChangesetFunction.Delegate())); }
/// <summary> /// 获取 LibVlc 的编译器信息 /// </summary> public static String GetCompiler() { return(InteropHelper.PtrToString(GetCompilerFunction.Delegate())); }
/// <summary> /// 获取 LibVlc 的版本信息 /// </summary> /// <returns></returns> public static String GetVersion() { return(InteropHelper.PtrToString(GetVersionFunction.Delegate())); }
/// <summary> /// 获取媒体的某个元属性,如果尚未解析元属性,将会返回 NULL. /// 这个方法会自动调用 <see cref="ParseMediaAsync"/> 方法,所以你在之后应该会收到一个 MediaMetaChanged 事件. /// 如果你喜欢同步版本,可以在 GetMeta 之前调用 <see cref="ParseMedia"/> 方法 /// </summary> /// <param name="type">元属性类型</param> /// <returns>返回媒体的某个元属性</returns> public String GetMeta(MetaDataType type) { return(InteropHelper.PtrToString(_getMetaFunction.Delegate(InstancePointer, type))); }
/// <summary> /// 获取媒体的基本编码器的说明 /// </summary> /// <param name="type">由 <see cref="MediaTrack.Type"/> 得来</param> /// <param name="codec">由 <see cref="MediaTrack.Codec"/> 得来</param> /// <returns>返回媒体的基本编码器的说明</returns> public static String GetCodecDescription(TrackType type, int codec) { return(InteropHelper.PtrToString(_getCodecDescriptionFunction.Delegate(type, codec))); }
/// <summary> /// Get the name of a particular equalizer preset. /// </summary> /// <param name="index"></param> /// <returns></returns> public static String GetPresetEqualizerName(uint index) { return(InteropHelper.PtrToString(_getEqualizerPresetNameFunction.Delegate(index))); }
/// <summary> /// Get a readable error message. /// </summary> /// <returns>return a readable LibVlc error message, if there are no error will return <see cref="null" /></returns> /// <exception cref="Exception">A delegate callback throws an exception.</exception> public static String GetErrorMessage() { return(InteropHelper.PtrToString(_errorMessageFunction.Delegate())); }
public static String GetEventTypeName(EventTypes type) { return(InteropHelper.PtrToString(GetTypeNameFunction.Delegate(type))); }
/// <summary> /// Get the current audio output device identifier. /// </summary> public String GetAudioDevice() { return(InteropHelper.PtrToString(_getAudioDeviceFunction.Delegate(InstancePointer))); }