Пример #1
0
        public void Initialize()
        {
            if (_mpvHandle != IntPtr.Zero)
            {
                _mpvTerminateDestroy(_mpvHandle);
            }

            string   fullexepath = System.Reflection.Assembly.GetExecutingAssembly().Location;
            FileInfo fi          = new FileInfo(fullexepath);

            fullexepath           = Path.Combine(fi.Directory.FullName, Environment.Is64BitProcess ? "x64" : "x86", "mpv-1.dll");
            _libMpvDll            = LoadLibraryEx(fullexepath, IntPtr.Zero, 0);
            _mpvCreate            = (MpvCreate)GetDllType(typeof(MpvCreate), "mpv_create");
            _mpvInitialize        = (MpvInitialize)GetDllType(typeof(MpvInitialize), "mpv_initialize");
            _mpvTerminateDestroy  = (MpvTerminateDestroy)GetDllType(typeof(MpvTerminateDestroy), "mpv_terminate_destroy");
            _mpvCommand           = (MpvCommand)GetDllType(typeof(MpvCommand), "mpv_command");
            _mpvSetOption         = (MpvSetOption)GetDllType(typeof(MpvSetOption), "mpv_set_option");
            _mpvSetOptionString   = (MpvSetOptionString)GetDllType(typeof(MpvSetOptionString), "mpv_set_option_string");
            _mpvGetPropertyString = (MpvGetPropertystring)GetDllType(typeof(MpvGetPropertystring), "mpv_get_property");
            _mpvSetProperty       = (MpvSetProperty)GetDllType(typeof(MpvSetProperty), "mpv_set_property");
            _mpvFree = (MpvFree)GetDllType(typeof(MpvFree), "mpv_free");

            if (_libMpvDll == IntPtr.Zero)
            {
                return;
            }

            _mpvHandle = _mpvCreate.Invoke();
            if (_mpvHandle == IntPtr.Zero)
            {
                return;
            }

            _mpvInitialize.Invoke(_mpvHandle);
        }
Пример #2
0
        private void LoadMpvDynamic()
        {
            var platform = PlatformCheck.RunningPlatform();

            if (platform == Platform.Windows)
            {
                _libMpvDll = LoadLibrary(_libMpvPath);  // "mpv-1.dll"); // The dll is included in the DEV builds by lachs0r: https://mpv.srsfckn.biz/
            }
            else if (platform == Platform.Linux)
            {
                _libMpvDll = dlopen(_libMpvPath, RTLD_NOW);  //("/usr/lib/x86_64-linux-gnu/libmpv.so.1", RTLD_NOW);
            }
            else
            {
                throw new NotImplementedException();
            }


            _mpvCreate            = (MpvCreate)GetDllType(typeof(MpvCreate), "mpv_create");
            _mpvInitialize        = (MpvInitialize)GetDllType(typeof(MpvInitialize), "mpv_initialize");
            _mpvTerminateDestroy  = (MpvTerminateDestroy)GetDllType(typeof(MpvTerminateDestroy), "mpv_terminate_destroy");
            _mpvCommand           = (MpvCommand)GetDllType(typeof(MpvCommand), "mpv_command");
            _mpvSetOption         = (MpvSetOption)GetDllType(typeof(MpvSetOption), "mpv_set_option");
            _mpvSetOptionString   = (MpvSetOptionString)GetDllType(typeof(MpvSetOptionString), "mpv_set_option_string");
            _mpvGetPropertyString = (MpvGetPropertystring)GetDllType(typeof(MpvGetPropertystring), "mpv_get_property");
            _mpvSetProperty       = (MpvSetProperty)GetDllType(typeof(MpvSetProperty), "mpv_set_property");
            _mpvFree            = (MpvFree)GetDllType(typeof(MpvFree), "mpv_free");
            _mpvObserveProperty = (MpvObserveProperty)GetDllType(typeof(MpvObserveProperty), "mpv_observe_property");
        }
Пример #3
0
 private void LoadMpvDynamic()
 {
     _libMpvDll            = LoadLibrary("mpv-1.dll");
     _mpvCreate            = (MpvCreate)GetDllType(typeof(MpvCreate), "mpv_create");
     _mpvInitialize        = (MpvInitialize)GetDllType(typeof(MpvInitialize), "mpv_initialize");
     _mpvTerminateDestroy  = (MpvTerminateDestroy)GetDllType(typeof(MpvTerminateDestroy), "mpv_terminate_destroy");
     _mpvCommand           = (MpvCommand)GetDllType(typeof(MpvCommand), "mpv_command");
     _mpvSetOption         = (MpvSetOption)GetDllType(typeof(MpvSetOption), "mpv_set_option");
     _mpvSetOptionString   = (MpvSetOptionString)GetDllType(typeof(MpvSetOptionString), "mpv_set_option_string");
     _mpvGetPropertyString = (MpvGetPropertystring)GetDllType(typeof(MpvGetPropertystring), "mpv_get_property");
     _mpvSetProperty       = (MpvSetProperty)GetDllType(typeof(MpvSetProperty), "mpv_set_property");
 }
Пример #4
0
 private void LoadMpvDynamic()
 {
     _libMpvDll            = LoadLibrary("mpv-1.dll"); // The dll is included in the DEV builds by lachs0r: https://mpv.srsfckn.biz/
     _mpvCreate            = (MpvCreate)GetDllType(typeof(MpvCreate), "mpv_create");
     _mpvInitialize        = (MpvInitialize)GetDllType(typeof(MpvInitialize), "mpv_initialize");
     _mpvTerminateDestroy  = (MpvTerminateDestroy)GetDllType(typeof(MpvTerminateDestroy), "mpv_terminate_destroy");
     _mpvCommand           = (MpvCommand)GetDllType(typeof(MpvCommand), "mpv_command");
     _mpvSetOption         = (MpvSetOption)GetDllType(typeof(MpvSetOption), "mpv_set_option");
     _mpvSetOptionString   = (MpvSetOptionString)GetDllType(typeof(MpvSetOptionString), "mpv_set_option_string");
     _mpvGetPropertyString = (MpvGetPropertystring)GetDllType(typeof(MpvGetPropertystring), "mpv_get_property");
     _mpvSetProperty       = (MpvSetProperty)GetDllType(typeof(MpvSetProperty), "mpv_set_property");
     _mpvFree = (MpvFree)GetDllType(typeof(MpvFree), "mpv_free");
 }
Пример #5
0
 private void LoadLibMpvDynamic()
 {
     _mpvCreate            = (MpvCreate)GetDllType(typeof(MpvCreate), "mpv_create");
     _mpvInitialize        = (MpvInitialize)GetDllType(typeof(MpvInitialize), "mpv_initialize");
     _mpvWaitEvent         = (MpvWaitEvent)GetDllType(typeof(MpvWaitEvent), "mpv_wait_event");
     _mpvCommand           = (MpvCommand)GetDllType(typeof(MpvCommand), "mpv_command");
     _mpvSetOption         = (MpvSetOption)GetDllType(typeof(MpvSetOption), "mpv_set_option");
     _mpvSetOptionString   = (MpvSetOptionString)GetDllType(typeof(MpvSetOptionString), "mpv_set_option_string");
     _mpvGetPropertyString = (MpvGetPropertystring)GetDllType(typeof(MpvGetPropertystring), "mpv_get_property");
     _mpvGetPropertyDouble = (MpvGetPropertyDouble)GetDllType(typeof(MpvGetPropertyDouble), "mpv_get_property");
     _mpvSetProperty       = (MpvSetProperty)GetDllType(typeof(MpvSetProperty), "mpv_set_property");
     _mpvFree             = (MpvFree)GetDllType(typeof(MpvFree), "mpv_free");
     _mpvClientApiVersion = (MpvClientApiVersion)GetDllType(typeof(MpvClientApiVersion), "mpv_client_api_version");
 }
Пример #6
0
 private void LoadLibVlcDynamic()
 {
     _mpvCreate            = (MpvCreate)GetDllType(typeof(MpvCreate), "mpv_create");
     _mpvInitialize        = (MpvInitialize)GetDllType(typeof(MpvInitialize), "mpv_initialize");
     _mpvTerminateDestroy  = (MpvTerminateDestroy)GetDllType(typeof(MpvTerminateDestroy), "mpv_terminate_destroy");
     _mpvWaitEvent         = (MpvWaitEvent)GetDllType(typeof(MpvWaitEvent), "mpv_wait_event");
     _mpvCommand           = (MpvCommand)GetDllType(typeof(MpvCommand), "mpv_command");
     _mpvSetOption         = (MpvSetOption)GetDllType(typeof(MpvSetOption), "mpv_set_option");
     _mpvSetOptionString   = (MpvSetOptionString)GetDllType(typeof(MpvSetOptionString), "mpv_set_option_string");
     _mpvGetPropertyString = (MpvGetPropertystring)GetDllType(typeof(MpvGetPropertystring), "mpv_get_property");
     _mpvGetPropertyDouble = (MpvGetPropertyDouble)GetDllType(typeof(MpvGetPropertyDouble), "mpv_get_property");
     _mpvSetProperty       = (MpvSetProperty)GetDllType(typeof(MpvSetProperty), "mpv_set_property");
     _mpvFree = (MpvFree)GetDllType(typeof(MpvFree), "mpv_free");
 }
Пример #7
0
        internal void Initialize(Visual visual)
        {
            if (_mpvHandle != IntPtr.Zero)
            {
                _mpvTerminateDestroy(_mpvHandle);
            }

            string   fullexepath = System.Reflection.Assembly.GetExecutingAssembly().Location;
            FileInfo fi          = new FileInfo(fullexepath);

            // ReSharper disable once PossibleNullReferenceException
            fullexepath           = Path.Combine(fi.Directory.FullName, Environment.Is64BitProcess ? "x64" : "x86", "mpv-1.dll");
            _libMpvDll            = LoadLibraryEx(fullexepath, IntPtr.Zero, 0);
            _mpvCreate            = (MpvCreate)GetDllType(typeof(MpvCreate), "mpv_create");
            _mpvInitialize        = (MpvInitialize)GetDllType(typeof(MpvInitialize), "mpv_initialize");
            _mpvTerminateDestroy  = (MpvTerminateDestroy)GetDllType(typeof(MpvTerminateDestroy), "mpv_terminate_destroy");
            _mpvCommand           = (MpvCommand)GetDllType(typeof(MpvCommand), "mpv_command");
            _mpvSetOption         = (MpvSetOption)GetDllType(typeof(MpvSetOption), "mpv_set_option");
            _mpvSetOptionString   = (MpvSetOptionString)GetDllType(typeof(MpvSetOptionString), "mpv_set_option_string");
            _mpvGetPropertyString = (MpvGetPropertystring)GetDllType(typeof(MpvGetPropertystring), "mpv_get_property");
            _mpvSetProperty       = (MpvSetProperty)GetDllType(typeof(MpvSetProperty), "mpv_set_property");
            _mpvFree = (MpvFree)GetDllType(typeof(MpvFree), "mpv_free");

            /*
             * _mpvLoadConfigFile = (MpvLoadConfigFile)GetDllType(typeof(MpvLoadConfigFile), "mpv_load_config_file");
             * _mpvRequestLogMessages = (MpvRequestLogMessages) GetDllType(typeof(MpvRequestLogMessages), "mpv_request_log_messages");
             * _mpvRequestEvent = (MpvRequestEvent)GetDllType(typeof(MpvRequestEvent), "mpv_request_event");
             * _mpvWaitEvent = (MpvWaitEvent)GetDllType(typeof(MpvWaitEvent), "mpv_wait_event");
             */
            if (_libMpvDll == IntPtr.Zero)
            {
                return;
            }

            _mpvHandle = _mpvCreate.Invoke();
            if (_mpvHandle == IntPtr.Zero)
            {
                return;
            }

            _mpvInitialize.Invoke(_mpvHandle);
            SetWindowsHandle(visual);
        }
Пример #8
0
 private void LoadLibVlcDynamic()
 {
     _mpvCreate = (MpvCreate)GetDllType(typeof(MpvCreate), "mpv_create");
     _mpvInitialize = (MpvInitialize)GetDllType(typeof(MpvInitialize), "mpv_initialize");
     _mpvTerminateDestroy = (MpvTerminateDestroy)GetDllType(typeof(MpvTerminateDestroy), "mpv_terminate_destroy");
     _mpvWaitEvent = (MpvWaitEvent)GetDllType(typeof(MpvWaitEvent), "mpv_wait_event");
     _mpvCommand = (MpvCommand)GetDllType(typeof(MpvCommand), "mpv_command");
     _mpvSetOption = (MpvSetOption)GetDllType(typeof(MpvSetOption), "mpv_set_option");
     _mpvSetOptionString = (MpvSetOptionString)GetDllType(typeof(MpvSetOptionString), "mpv_set_option_string");
     _mpvGetPropertyString = (MpvGetPropertystring)GetDllType(typeof(MpvGetPropertystring), "mpv_get_property");
     _mpvGetPropertyDouble = (MpvGetPropertyDouble)GetDllType(typeof(MpvGetPropertyDouble), "mpv_get_property");
     _mpvSetProperty = (MpvSetProperty)GetDllType(typeof(MpvSetProperty), "mpv_set_property");
     _mpvFree = (MpvFree)GetDllType(typeof(MpvFree), "mpv_free");
 }