Exemplo n.º 1
0
        private void Init_Video_Settings()
        {
            //SelectedCameraDevice = _configManager.MainVideoInfo.VideoDevice;
            //SelectedDocDevice = _configManager.DocVideoInfo.VideoDevice;

            //SelectedCameraColorSpace = _cameraDeviceList.FirstOrDefault(vdm => vdm.DeviceName == SelectedCameraDevice)?.VideoFormatModels.FirstOrDefault(vfm => vfm.Colorsapce == _configManager.MainVideoInfo.ColorSpace);
            //SelectedDocColorSpace = _docDeviceList.FirstOrDefault(vdm => vdm.DeviceName == SelectedDocDevice)?.VideoFormatModels.FirstOrDefault(vfm => vfm.Colorsapce == _configManager.DocVideoInfo.ColorSpace);

            //SelectedVedioVGA = $"{_configManager.MainVideoInfo.DisplayWidth}*{_configManager.MainVideoInfo.DisplayHeight}";
            //SelectedDocVGA = $"{_configManager.DocVideoInfo.DisplayWidth}*{_configManager.DocVideoInfo.DisplayHeight}";

            SelectedVedioRate = 0;
            SelectedDocRate   = 0;


            CameraDeviceList.Clear();
            DocDeviceList.Clear();

            CameraColorSpaces.Clear();
            DocColorSpaces.Clear();

            VedioParameterVgaList.Clear();
            DocParameterVgaList.Clear();

            VedioParameterRatesList.Clear();

            var cameraList = _meetingSdkAgent.GetVideoDevices();

            if (cameraList.Result == null)
            {
                HasErrorMsg("-1", "无法获取本机视频设备信息!");
                return;
            }

            _cameraDeviceList = cameraList.Result.ToList();
            _docDeviceList    = cameraList.Result.ToList();

            if (_settingParameter != null)
            {
                var rateList = _settingParameter.VedioParameterRates;
                rateList.ForEach(v => { VedioParameterRatesList.Add(v.VideoBitRate); });
            }
            _cameraDeviceList.ForEach(c => { CameraDeviceList.Add(c.DeviceName); });
            _docDeviceList.ForEach(d => { DocDeviceList.Add(d.DeviceName); });

            CameraDeviceList.Add("");
            DocDeviceList.Add("");
            SetVideoDefaultSetting();


            if (_cameraDeviceList.All(o => o.DeviceName != SelectedCameraDevice))
            {
                SelectedCameraDevice = string.Empty;
            }
            if (_docDeviceList.All(o => o.DeviceName != SelectedDocDevice))
            {
                SelectedDocDevice = string.Empty;
            }
        }
Exemplo n.º 2
0
        private void Loading()
        {
            try
            {
                //获取本地保存的配置
                _configManager = _localDataManager.GetSettingConfigData() ?? new ConfigManager()
                {
                    ServerInfo = new ServerInfo()
                    {
                        BmsServerPort = GlobalData.Instance.LocalSetting.BmsServerPort, ServerIp = GlobalData.Instance.LocalSetting.ServerIp
                    }
                };

                if (_configManager == null)
                {
                    MessageQueueManager.Instance.AddError("读取配置文件时出错!");
                    return;
                }

                if (_configManager.MainVideoInfo == null)
                {
                    _configManager.MainVideoInfo = new VideoInfo();
                }
                if (_configManager.DocVideoInfo == null)
                {
                    _configManager.DocVideoInfo = new VideoInfo();
                }

                CameraDeviceList.Clear();
                DocDeviceList.Clear();

                CameraColorSpaces.Clear();
                DocColorSpaces.Clear();

                VedioParameterVgaList.Clear();
                DocParameterVgaList.Clear();
                VedioParameterRatesList.Clear();


                //摄像头设备
                var cameraList = _meetingSdkAgent.GetVideoDevices();

                if (cameraList.Result == null)
                {
                    MessageQueueManager.Instance.AddError("无法获取本机设备信息!");
                    return;
                }

                _cameraDeviceList = cameraList.Result.ToList();

                string log = "↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓\r\n";
                foreach (var cameraDevice in _cameraDeviceList)
                {
                    log += $"name:{cameraDevice.DeviceName}, ";

                    foreach (var format in cameraDevice.VideoFormatModels)
                    {
                        log += $"{format.ColorspaceName}\r\n";

                        foreach (var size in format.SizeModels)
                        {
                            log += $"size:{size.Width}*{size.Height}\r\n";
                        }
                    }
                }

                log += "↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑\r\n";

                Log.Logger.Information(log);

                var docCameraList = _meetingSdkAgent.GetVideoDevices();

                _docDeviceList = docCameraList.Result.ToList();

                //码率
                var settingLocalData = _localDataManager.GetSettingParameter();
                if (settingLocalData != null)
                {
                    var rateList = settingLocalData.VedioParameterRates;
                    rateList.ForEach(v => { VedioParameterRatesList.Add(v.VideoBitRate); });
                }
                _cameraDeviceList.ForEach(c => { CameraDeviceList.Add(c.DeviceName); });
                _docDeviceList.ForEach(d => { DocDeviceList.Add(d.DeviceName); });
                CameraDeviceList.Add("");
                DocDeviceList.Add("");
                SetDefaultSetting();

                if (_cameraDeviceList.All(o => o.DeviceName != SelectedCameraDevice))
                {
                    SelectedCameraDevice = string.Empty;
                }
                if (_docDeviceList.All(o => o.DeviceName != SelectedDocDevice))
                {
                    SelectedDocDevice = string.Empty;
                }
            }
            catch (Exception ex)
            {
                Log.Logger.Error($"视频设置加载信息发生异常 exception:{ex}");
                MessageQueueManager.Instance.AddError(MessageManager.LoadingError);
            }
        }