示例#1
0
        protected override void OnExit(ExitEventArgs e)
        {
            //Clean Media Lib
            MV_Manager.CloseMediaVault();
            MV_Manager.DisposeLog();

            base.OnExit(e);
        }
示例#2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            //Usually its good place to initialize Media Vault Library
            MV_Manager.InitializeMediaVault();

            //MV_Manager.InitializeLog("mvlog.log");
        }
示例#3
0
        /// <summary>
        /// Create new instance of MVPlayer control.
        /// </summary>
        public MVPlayer()
        {
            InitializeComponent();

            if ((LicenseManager.UsageMode == LicenseUsageMode.Runtime))
            {
                if (!MV_Manager.IsInitialized)
                {
                    throw new InvalidOperationException("MediaVault library is not initialized! Call MV_Manager.InitilizeMediaVault() before using this control in runtime!");
                }

                if (MV_Manager.GetMVLibDLL() == null)
                {
                    throw new NullReferenceException("Unable to obtain loaded MVLib! Are you sure initialization was succeeded?");
                }

                IsInDesignMode = false;

                Type mvlibWrapperType = null;

                foreach (Type type in MV_Manager.GetMVLibDLL().GetExportedTypes())
                {
                    if (type.Name == MVLIB_WRAPPER_TYPE)
                    {
                        mvlibWrapperType = type;
                        break;
                    }
                }

                if (mvlibWrapperType == null)
                {
                    throw new InvalidOperationException("Unable to find MVLibWrapper class in loaded assemblies! Check if you dependencies are correct!\n Please visit https://github.com/Kuba-MV/MVLib-DotNet if you need to download additional dependencies!");
                }

                _media_wrapper = Activator.CreateInstance(mvlibWrapperType);

                if (_media_wrapper == null)
                {
                    throw new InvalidOperationException("Unable to create MVLibWrapper instance. Check if your dependencies are correct!");
                }

                _media_wrapper.CreateD3DHwndRenderer(pnD3D.Handle);
            }
            else
            {
                IsInDesignMode = true;
            }

            if (!IsInDesignMode)
            {
                InstallInRenderLoop();
            }
        }
示例#4
0
        /// <summary>
        /// Creates new instance of Media Vault Library Control for WPF
        /// </summary>
        public MVPlayer()
        {
            InitializeComponent();

            if ((LicenseManager.UsageMode == LicenseUsageMode.Runtime))
            {
                if (!MV_Manager.IsInitialized)
                {
                    throw new InvalidOperationException("MediaVault library is not initialized! Call MV_Manager.InitilizeMediaVault() before using this control in runtime!");
                }

                if (MV_Manager.GetMVLibDLL() == null)
                {
                    throw new NullReferenceException("Unable to obtain loaded MVLib! Are you sure initialization was succeeded?");
                }

                Type mvlibWrapperType = null;

                foreach (Type type in MV_Manager.GetMVLibDLL().GetExportedTypes())
                {
                    if (type.Name == MVLIB_WRAPPER_TYPE)
                    {
                        mvlibWrapperType = type;
                        break;
                    }
                }

                if (mvlibWrapperType == null)
                {
                    throw new InvalidOperationException("Unable to find MVLibWrapper class in loaded assemblies! Check if you dependencies are correct!\nPlease visit https://github.com/Kuba-MV/MVLib-DotNet if you need to download additional dependencies!");
                }

                _media_wrapper = Activator.CreateInstance(mvlibWrapperType);

                if (_media_wrapper == null)
                {
                    throw new InvalidOperationException("Unable to create MVLibWrapper instance. Check if your dependencies are correct!");
                }

                _media_wrapper.CreateD3DOffScreenRenderer();

                _d3d_render = new D3DImage();
                _d3d_render.IsFrontBufferAvailableChanged += _d3d_render_IsFrontBufferAvailableChanged;

                videoImage.Source = _d3d_render;

                CompositionTarget.Rendering += CompositionTarget_Rendering;
            }
        }
示例#5
0
        static void Main()
        {
            //Important! Usually it is a best place to initialize library.
            MV_Manager.InitializeMediaVault();

            //You can initialize log for debug purposes.
            //MV_Manager.InitializeLog("mvlog.log");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMain());

            //Important! Close Media Vault engine before exiting from application.
            MV_Manager.CloseMediaVault();

            //Dispose log. You can call this method always even if you didn't initialize log.
            MV_Manager.DisposeLog();
        }