Exemplo n.º 1
0
        public string GetEventTypeName(EventTypes eventType)
        {
#if !NET20
            return(GetInteropDelegate <GetEventTypeName>().Invoke(eventType).ToStringAnsi());
#else
            return(IntPtrExtensions.ToStringAnsi(GetInteropDelegate <GetEventTypeName>().Invoke(eventType)));
#endif
        }
Exemplo n.º 2
0
        public string GetLastErrorMessage()
        {
#if !NET20
            return(GetInteropDelegate <GetLastErrorMessage>().Invoke().ToStringAnsi());
#else
            return(IntPtrExtensions.ToStringAnsi(GetInteropDelegate <GetLastErrorMessage>().Invoke()));
#endif
        }
        public string GetCompiler()
        {
#if !NET20
            return(GetInteropDelegate <GetCompiler>().Invoke().ToStringAnsi());
#else
            return(IntPtrExtensions.ToStringAnsi(GetInteropDelegate <GetCompiler>().Invoke()));
#endif
        }
Exemplo n.º 4
0
        public string GetVideoAspectRatio(VlcMediaPlayerInstance mediaPlayerInstance)
        {
            if (mediaPlayerInstance == IntPtr.Zero)
            {
                throw new ArgumentException("Media player instance is not initialized.");
            }
#if NET20
            return(IntPtrExtensions.ToStringAnsi(GetInteropDelegate <GetVideoAspectRatio>().Invoke(mediaPlayerInstance)));
#else
            return(GetInteropDelegate <GetVideoAspectRatio>().Invoke(mediaPlayerInstance).ToStringAnsi());
#endif
        }
Exemplo n.º 5
0
        private void InitVlcLib(string libVlcDllsDirectory)
        {
            if (!Directory.Exists(libVlcDllsDirectory))
                throw new DirectoryNotFoundException(string.Format("The directory : {0} not found.", libVlcDllsDirectory));

            string libVlcFilePath = Path.Combine(libVlcDllsDirectory, "libvlc.dll");
            if (!File.Exists(libVlcFilePath))
                throw new FileNotFoundException("Libvlc library not found in directory.");
            string libVlcCoreFilePath = Path.Combine(libVlcDllsDirectory, "libvlccore.dll");
            if (!File.Exists(libVlcCoreFilePath))
                throw new FileNotFoundException("Libvlccore library not found in directory.");

            myLibVlcCoreDllHandle = Win32Interop.LoadLibrary(libVlcCoreFilePath);
            if (myLibVlcCoreDllHandle == IntPtr.Zero)
                throw new Win32Exception(Marshal.GetLastWin32Error());
            myLibVlcDllHandle = Win32Interop.LoadLibrary(libVlcFilePath);
            if (myLibVlcDllHandle == IntPtr.Zero)
                throw new Win32Exception(Marshal.GetLastWin32Error());

            GetVersion = new LibVlcFunction<GetVersion>(myLibVlcDllHandle);

            var reg = new Regex("^[0-9.]*");
            var match = reg.Match(IntPtrExtensions.ToStringAnsi(GetVersion.Invoke()));
            VlcVersion = new Version(match.Groups[0].Value);

            NewInstance = new LibVlcFunction<NewInstance>(myLibVlcDllHandle, VlcVersion);
            ReleaseInstance = new LibVlcFunction<ReleaseInstance>(myLibVlcDllHandle, VlcVersion);
            RetainInstance = new LibVlcFunction<RetainInstance>(myLibVlcDllHandle, VlcVersion);
            AddInterface = new LibVlcFunction<AddInterface>(myLibVlcDllHandle, VlcVersion);
            SetExitCallback = new LibVlcFunction<SetExitCallback>(myLibVlcDllHandle, VlcVersion);
            Wait = new LibVlcFunction<Wait>(myLibVlcDllHandle, VlcVersion);
            SetUserAgent = new LibVlcFunction<SetUserAgent>(myLibVlcDllHandle, VlcVersion);
            GetCompiler = new LibVlcFunction<GetCompiler>(myLibVlcDllHandle, VlcVersion);
            GetChangeSet = new LibVlcFunction<GetChangeSet>(myLibVlcDllHandle, VlcVersion);
            FreeMemory = new LibVlcFunction<FreeMemory>(myLibVlcDllHandle, VlcVersion);
            //GetModuleDescriptionList = new LibVlcFunction<GetModuleDescriptionList>(myLibVlcDllHandle, VlcVersion);
            //ReleaseModule = new LibVlcFunction<ReleaseModuleDescription>(myLibVlcDllHandle, VlcVersion);

            EventInterops = new LibVlcAsynchronousEvents(myLibVlcDllHandle, VlcVersion);
            MediaPlayerInterops = new LibVlcMediaPlayer(myLibVlcDllHandle, VlcVersion);
            MediaInterops = new LibVlcMedia(myLibVlcDllHandle, VlcVersion);
            MediaListInterops = new LibVlcMediaList(myLibVlcDllHandle, VlcVersion);
            AudioInterops = new LibVlcAudio(myLibVlcDllHandle, VlcVersion);
            VideoInterops = new LibVlcVideo(myLibVlcDllHandle, VlcVersion);
            LoggingInterops = new LibVlcLogging(myLibVlcDllHandle, VlcVersion);
            ErrorHandlingInterops = new LibVlcErrorHandling(myLibVlcDllHandle, VlcVersion);
            MediaListPlayerInterops = new LibVlcMediaListPlayer(myLibVlcDllHandle, VlcVersion);
        }
 public string GetAudioOutputDeviceLongName(string audioOutputDescriptionName, int deviceIndex)
 {
     return(IntPtrExtensions.ToStringAnsi(GetInteropDelegate <GetAudioOutputDeviceLongName>().Invoke(myVlcInstance, StringExtensions.ToHGlobalAnsi(audioOutputDescriptionName), deviceIndex)));
 }