예제 #1
0
        public static bool Initialize()
        {
            var errNo = ErrorNumberEnum.PLCM_SAMPLE_OK;

            /*PreInitialize*/
            errNo = WrapperProxy.InstallCallback(addEventCallback, dispatchEventsCallback, addLogCallback, addDeviceCallback,
                                                 displayMediaStatisticsCallback, displayCallStatisticsCallback, displayCodecCapabilities, addAppCallback);
            if (ErrorNumberEnum.PLCM_SAMPLE_OK != errNo)
            {
                log.Error("Register callback functions failed. Error number = " + errNo.ToString());
                return(false);
            }

            /*in wrapper, create instances, load library*/
            errNo = WrapperProxy.PreInitialize();
            if (ErrorNumberEnum.PLCM_SAMPLE_OK != errNo)
            {
                var msg = "Pre-initialization failed. Error number = " + errNo.ToString();
                log.Error(msg);
                throw new Exception(msg);
            }

            /* KVList*/
            confManager.LoadFromXML(@"conf\cfg.xml", @"conf\common.xml");
            LoadSettingsFromConfFile(true);


            errNo = WrapperProxy.Initialize();
            if (ErrorNumberEnum.PLCM_SAMPLE_OK != errNo)
            {
                log.Error("Initialize failed. Error number = " + errNo.ToString());
                return(false);
            }
            var version = WrapperProxy.GetVersion();

            log.Info("**********************************************************************");
            log.Info("        PLCM MFW Sample App Initialized Successful ( version: " + version + " )");
            log.Info("**********************************************************************");

            /*get devices enumerate*/

            return(true);
        }