private void SaveVideos() { List <Video> list = new List <Video>(); foreach (ListViewItem item in lvwVideo.Items) { Video video = new Video(); video.id = item.Text; video.type = GetTypeVideo(item.SubItems[2].Text); if (video.type == Configuration.VIDEO_TYPE_CAMERA && !item.SubItems[1].Text.Contains("dev")) { video.path = "/dev/video" + item.SubItems[1].Text; } else { video.path = item.SubItems[1].Text; } list.Add(video); } VideoConfig videoConfig = new VideoConfig(); videoConfig.configuration = "video_configuration"; videoConfig.videos = list; Configuration.Instance.ListVideo = list; SetVideoInControl(); diskPresenter.SaveVideoConfiguration(videoConfig); this.lblVideoOk.Text = "OK"; }
public List <Video> ReadListVideo() { VideoConfig videoConfig = new VideoConfig(); List <Video> list = new List <Video>(); try { string pathFile = directoryConfiguration + "/" + file_video; string content = disk.ReadTextFile(pathFile); videoConfig = JsonConvert.DeserializeObject <VideoConfig>(content); list = videoConfig.videos; } catch (System.IO.FileNotFoundException e) { Console.WriteLine(e.Message); } catch (Newtonsoft.Json.JsonReaderException ex) { Console.WriteLine(ex.Message); } catch (System.NullReferenceException ex) { Console.WriteLine(ex.Message); } return(list); }
protected override void OnApply() { VideoConfig cfg = (VideoConfig)this.Entity; if (cboFullscreenResolution.SelectedIndex > 0) { string resolution = cboFullscreenResolution.SelectedItem.ToString(); if (!string.IsNullOrWhiteSpace(resolution)) { string[] resData = resolution.Split('x'); uint width; uint height; if (uint.TryParse(resData[0], out width) && uint.TryParse(resData[1], out height)) { cfg.FullscreenResWidth = width; cfg.FullscreenResHeight = height; } } } else { cfg.FullscreenResWidth = 0; cfg.FullscreenResHeight = 0; } ConfigManager.Config.Video = (VideoConfig)this.Entity; ConfigManager.ApplyChanges(); }
private void OpenVideo(Camera getCamera) { List <IntPtr> handelList = new List <IntPtr>(); PictureBox pb = new PictureBox() { BackColor = System.Drawing.Color.Black, Margin = new Padding(3, 0, 3, 0), Dock = DockStyle.Fill }; //Pink 改为 black 2016-3-3 11:25:18…… handelList.Add(pb.Handle); formHostBig.Child = pb; if (gCfg == null) { gCfg = InfoExchange.Clone(cfg);//InitReadVideoConfig(); } gCfg.CameraList.Clear(); getCamera.Position = "1"; gCfg.CameraList.Add(getCamera); if (_curVideoController != null) { _curVideoController.Stop(); _curVideoController.Close(); } _curVideoController = null; System.GC.Collect(); _curVideoController = new VideoController(new FtpConfig(), gCfg, handelList); _curVideoController.OnShowErrMsg += _curVideoController_OnShowErrMsg; _curVideoController.Open(); _curVideoController.Start(); }
void SetFormat(int formatIndex, int frameRate) { int capsCount, capSize; int hr = VideoConfig.GetNumberOfCapabilities(out capsCount, out capSize); DsError.ThrowExceptionForHR(hr); IntPtr pSC = Marshal.AllocHGlobal(capSize); AMMediaType mt = null; try { VideoInfoHeader vih = new VideoInfoHeader(); hr = VideoConfig.GetStreamCaps(formatIndex, out mt, pSC); DsError.ThrowExceptionForHR(hr); if (frameRate > 0) { Marshal.PtrToStructure(mt.formatPtr, vih); vih.AvgTimePerFrame = (long)(10000000.0 / frameRate); Marshal.StructureToPtr(vih, mt.formatPtr, false); } hr = VideoConfig.SetFormat(mt); DsError.ThrowExceptionForHR(hr); } finally { DsUtils.FreeAMMediaType(mt); Marshal.FreeHGlobal(pSC); } }
/// <summary> /// 初始化视频设置 /// </summary> /// <param name="config">视频设置</param> private void InitVideoConfig(VideoConfig config) { IsSetVideoConfig = false; ScreenMode.value = (int)config.ScreenMode; var AllResolution = Screen.resolutions; List <string> resolutionOptions = new List <string>(); foreach (var item in AllResolution) { resolutionOptions.Add(item.ToString()); } Resolution.AddOptions(resolutionOptions); int currentResolutionIndex = resolutionOptions.IndexOf(config.Resolution.ToString()); if (currentResolutionIndex != -1) { Resolution.value = currentResolutionIndex; } else { currentResolutionIndex = resolutionOptions.IndexOf(Screen.currentResolution.ToString()); if (currentResolutionIndex != -1) { Resolution.value = currentResolutionIndex; } else { Resolution.value = 0; } } }
/// <summary> /// 恢复视频设置 /// </summary> /// <param name="config"></param> public void RestoreVideoConfig(VideoConfig config) { if (IsSetAudioConfig == false) { return; } Screen.SetResolution(config.Resolution.width, config.Resolution.height, config.ScreenMode, config.Resolution.refreshRate); }
/// <summary> /// 开始 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonPlayByTime_Click(object sender, RoutedEventArgs e) { DateTime?startTime = dptPlayStartTime.Value; DateTime?endTime = dptPlayEndTime.Value; if (startTime == null || endTime == null || startTime >= endTime) { return; } if (_curVideoPlayBackController != null) { _curVideoPlayBackController.PlayStop(); } var getCamera = videoList.SelectedItem as Camera; if (getCamera != null) { ReadNVRConfig(); VideoConfig gCfg = InfoExchange.Clone(cfg); //InitReadVideoConfig(); gCfg.CameraList.Clear(); getCamera.Position = "1"; getCamera.Ip = nvrConfig.Ip; getCamera.PassWord = nvrConfig.PassWord; getCamera.UserName = nvrConfig.UserName; getCamera.Port = nvrConfig.Port; #region 日志 string msg = string.Format("Ip={0},Port={1},UserName={2},PassWord={3},Channel={4}", nvrConfig.Ip, nvrConfig.Port, nvrConfig.UserName, nvrConfig.PassWord, getCamera.Channel); LogModel log = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_OutIn, FunctionName = "ReadNVRConfig()", Level = LogConstParam.LogLevel_Error, Msg = msg }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log)); #endregion //getCamera.Ip = dvrIp; //getCamera.PassWord = dvrPassW; //getCamera.UserName = dvrUserId; //getCamera.Channel = getCamera.DvrChannel; //System.Windows.Forms.MessageBox.Show(getCamera.Channel); //gCfg.VideoDriver=@"IoDllNew\hk\Talent.Video.HKVideo.dll"; gCfg.CameraList.Add(getCamera); _curVideoPlayBackController = new VideoPlayBackController(gCfg, videoHis.Handle); _curVideoPlayBackController.OnShowErrMsg += _curVideoPlayBackController_OnShowErrMsg; _curVideoPlayBackController.PlayByTime(startTime.Value, endTime.Value); this.ButtonPlayPause.Content = "暂停"; } else { //请选择 } }
/// <summary> /// 构造函数 /// </summary> /// <param name="pConfigFile">配置文件</param> /// <param name="pControlHandel">控件句柄</param> public VideoController(string pConfigFile) { //读取配置 ConfigReader cfgReader = new ConfigReader(pConfigFile); _curPhotoConfig = ConfigReader.ReadPhotoConfig(); _curVideoConfig = ConfigReader.ReadVideoConfig();; _controlHandelList = null; }
public void ConfigureVideo(VideoConfig config) { Task.Run(() => { Debug.WriteLine("VoipChannel.ConfigureVideo On=" + (config.On ? "yes" : "no")); Context.WithState(st => { return(Task.Run(() => { Context.IsVideoEnabled = config.On; })); }).Wait(); }); }
/// <summary> /// 读取NVR配置信息 /// </summary> //private void ReadNVRConfig() //{ // string basePath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "CarMeasureClient"); // string configPath = System.IO.Path.Combine(basePath, this.weightModel.grossweighid + ".xml"); // Talent.Measure.DomainModel.ConfigReader cfgReader1 = new Talent.Measure.DomainModel.ConfigReader(configPath); // this.nvrConfig = ConfigReader.ReadAudioConfig(); //} /// <summary> /// 读取皮重所在衡器的视频配置 /// </summary> private void ReadPiVideoConfig() { var clientName = this.weightModel.tareweigh; //根据计皮衡器获取衡器的视频配置,暂时先写死 string basePath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "CarMeasureClient"); string configPath = System.IO.Path.Combine(basePath, this.weightModel.tareweighid + ".xml"); Talent.Measure.DomainModel.ConfigReader cfgReader1 = new Talent.Measure.DomainModel.ConfigReader(configPath); this.piVideoConfig = ConfigReader.ReadVideoConfig(); this.piNvrConfig = ConfigReader.ReadAudioConfig(); this.piVideoConfig.CameraList = this.piVideoConfig.CameraList.OrderBy(c => c.Position).ToList(); }
private VideoConfig InitReadVideoConfig() { string basePath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "CarMeasureClient"); WeighterClientModel wcm = (this.DataContext as VideoMonitorViewModel).CurClientModel; string configPath = System.IO.Path.Combine(basePath, wcm.ClientId + ".xml"); Talent.Measure.DomainModel.ConfigReader cfgReader1 = new Talent.Measure.DomainModel.ConfigReader(configPath); VideoConfig gCfg = ConfigReader.ReadVideoConfig(); gCfg.CameraList = (from r in gCfg.CameraList select r).OrderBy(c => c.Position).ToList(); return(gCfg); }
public void SaveVideoConfiguration(VideoConfig videoConfig) { try { string jsonOut = JsonConvert.SerializeObject(videoConfig); string pathFile = directoryConfiguration + "/" + file_video; disk.WriteFile(pathFile, jsonOut); } catch (System.IO.IOException e) { Console.WriteLine(e.Message); } }
/// <summary> /// 设置刷新率 /// </summary> /// <param name="drop"></param> public void SetResolution(TMP_Dropdown drop) { try { var resolution = VideoConfig.ToResolution(drop.options[drop.value].text); Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreenMode, resolution.refreshRate); IsSetVideoConfig = true; } catch (ArgumentException e) { Debug.LogError($"设置分辨率非法:{e.Message} "); return; } }
void CoalesceVideo(VideoConfig userConfig, VideoConfig defaultConfig, Version userVersion) { if (string.IsNullOrWhiteSpace(userConfig.CropDetectOptions)) { userConfig.CropDetectOptions = defaultConfig.CropDetectOptions; } if (string.IsNullOrWhiteSpace(userConfig.DeinterlaceOptions)) { userConfig.DeinterlaceOptions = defaultConfig.DeinterlaceOptions; } if (string.IsNullOrWhiteSpace(userConfig.DenoiseOptions) // replace "bad" denoise options from earlier versions || (userConfig.DenoiseOptions == "hqdn3d=4:4:3:3") && (userVersion == null || userVersion <= new Version("2.6.0.0"))) { userConfig.DenoiseOptions = defaultConfig.DenoiseOptions; } if (string.IsNullOrWhiteSpace(userConfig.TonemapOptions)) { userConfig.TonemapOptions = defaultConfig.TonemapOptions; } if (userConfig.Codecs?.Any() != true) { userConfig.Codecs = defaultConfig.Codecs; return; } if (defaultConfig.Codecs?.Any() != true) { return; } foreach (var pair in userConfig.Codecs) { var format = pair.Key; var userCodec = pair.Value; var defaultCodec = defaultConfig.Codecs.GetValueOrDefault(format); if (string.IsNullOrWhiteSpace(userCodec.Preset) && defaultCodec != null) { userCodec.Preset = defaultCodec.Preset; } } }
void CoalesceVideo(VideoConfig userConfig, VideoConfig defaultConfig) { if (userConfig.SizeDivisor < 1) { userConfig.SizeDivisor = defaultConfig.SizeDivisor; } if (!Enum.IsDefined(typeof(SmartSwitchOption), userConfig.Deinterlace)) { userConfig.Deinterlace = defaultConfig.Deinterlace; } if (userConfig.Codecs?.Any() != true) { userConfig.Codecs = defaultConfig.Codecs; return; } if (defaultConfig.Codecs?.Any() != true) { return; } foreach (var pair in userConfig.Codecs) { var format = pair.Key; var userCodec = pair.Value; var defaultCodec = defaultConfig.Codecs.GetValueOrDefault(format); if (defaultCodec != null) { userCodec.QualityRange = new Range <decimal>( userCodec.QualityRange.Min ?? defaultCodec.QualityRange.Min, userCodec.QualityRange.Max ?? defaultCodec.QualityRange.Max); if (userCodec.QualitySteps < 1) { userCodec.QualitySteps = defaultCodec.QualitySteps; } if (string.IsNullOrWhiteSpace(userCodec.Tag)) { userCodec.Tag = defaultCodec.Tag; } } } }
public SnailsPace() { if (_instance != null) { throw new Exception("There was an attempt to create two Snail's Pace instances."); } _instance = this; graphics = new GraphicsDeviceManager(this); inputManager = new Input(); soundManager = new Sound(); gameConfig = new GameConfig(); videoConfig = new VideoConfig(); highScoreList = new Objects.HighScoreList(); initializeGameScreens(); }
private void GetVideoConfiguration() { VideoConfig videoConfig = diskPresenter .ReadVideoConfiguration(); if (videoConfig != null) { foreach (Video vid in videoConfig.videos) { ListViewItem item = new ListViewItem(vid.id, lvwVideo.Items.Count); item.SubItems.Add(vid.path); item.SubItems.Add(GetDescTypeVideo(vid.type)); lvwVideo.Items.Add(item); } } }
private IEnumerator LoadVideoList() { string path = NRealTool.GetNrealResPath() + "/MultiScreenVideoList/MultiScreenVideoConfig.xml"; WWW www = new WWW(path); yield return(www); if (www.isDone && string.IsNullOrEmpty(www.error)) { videoConfig = XmlSerializeHelper.DeSerialize <VideoConfig>(www.text); www.Dispose(); www = null; } else { Debug.LogError(www.error); } }
/// <summary> /// 毛重视频播放 /// </summary> private void OpenMaoVideo() { if (this.showType == 0 || this.showType == 2) { if (weightModel != null && !string.IsNullOrEmpty(weightModel.grosstime)) { if (maoVideoPlayBackController != null) { maoVideoPlayBackController.PlayStop(); } DateTime startTime = dptMZPlayStartTime.Value.Value; // DateTime.Parse(weightModel.JiMaoDate); DateTime endTime = dptMZPlayEndTime.Value.Value; //startTime.AddMinutes(5);//计毛结束时间不晓得服务那边是否有,暂时先给计毛时间加5分钟作为计毛结束时间 if (endTime <= startTime) { return; } var getCamera = maoVideoList.SelectedItem as Camera; if (getCamera != null) { //Talent.ClinetLog.SysLog.Log("选择了视频:" + getCamera.VideoName); if (this.maoVideoConfig != null) { VideoConfig gCfg = InfoExchange.Clone <VideoConfig>(this.maoVideoConfig); gCfg.CameraList.Clear(); //Talent.ClinetLog.SysLog.Log("清空摄像头列表"); getCamera.Position = "1"; getCamera.Ip = maoNvrConfig.Ip; getCamera.Port = maoNvrConfig.Port; getCamera.UserName = maoNvrConfig.UserName; getCamera.PassWord = maoNvrConfig.PassWord; //Talent.ClinetLog.SysLog.Log(string.Format("摄像头信息赋值,Ip={0};Port={1}", getCamera.Ip, getCamera.Port)); gCfg.CameraList.Add(getCamera); //Talent.ClinetLog.SysLog.Log("准备构造摄像头Controller"); maoVideoPlayBackController = new VideoPlayBackController(gCfg, maoVideoHis.Handle); //Talent.ClinetLog.SysLog.Log("构造摄像头Controller完毕,准备设置播放录像的时间段"); maoVideoPlayBackController.PlayByTime(startTime, endTime); //Talent.ClinetLog.SysLog.Log("设置播放录像的时间段完毕"); } } } } }
public VideoConfig ReadVideoConfiguration() { VideoConfig videoConfig = new VideoConfig(); try { string pathFile = directoryConfiguration + "/" + file_video; string content = disk.ReadTextFile(pathFile); videoConfig = JsonConvert.DeserializeObject <VideoConfig>(content); } catch (System.IO.FileNotFoundException e) { Console.WriteLine(e.Message); } catch (Newtonsoft.Json.JsonReaderException ex) { Console.WriteLine(ex.Message); } return(videoConfig); }
/// <summary> /// 初始化 /// </summary> /// <returns></returns> public bool Init(string ConfigFile = "VideoModuleConfig.xml", string layoutConfigFile = "layoutConfig.xml") { //todo config = ConfigHelper <VideoConfig> .LoadXML(ConfigFile, out string err); if (config is null) { this.LogModule.Error($"读取配置文件失败: {err}"); return(false); } this.layoutConfig = LayoutConfig.LoadConfig(layoutConfigFile); if (layoutConfig is null) { this.LogModule.Error($"读取布局配置文件失败: {err}"); return(false); } return(true); }
/// <summary> /// 皮重视频播放 /// </summary> private void OpenPiVideo() { if (this.showType == 0 || this.showType == 1) { if (weightModel != null && !string.IsNullOrEmpty(weightModel.taretime)) { if (piVideoPlayBackController != null) { piVideoPlayBackController.PlayStop(); } DateTime startTime = dptPZPlayStartTime.Value.Value; // DateTime.Parse(weightModel.JiMaoDate); DateTime endTime = dptPZPlayEndTime.Value.Value; //startTime.AddMinutes(5);// if (endTime <= startTime) { return; } var getCamera = piVideoList.SelectedItem as Camera; if (getCamera != null) { if (this.piVideoConfig != null) { VideoConfig gCfg = InfoExchange.Clone <VideoConfig>(this.piVideoConfig); gCfg.CameraList.Clear(); getCamera.Position = "1"; getCamera.Ip = piNvrConfig.Ip; getCamera.Port = piNvrConfig.Port; getCamera.UserName = piNvrConfig.UserName; getCamera.PassWord = piNvrConfig.PassWord; gCfg.CameraList.Add(getCamera); piVideoPlayBackController = new VideoPlayBackController(gCfg, piVideoHis.Handle); piVideoPlayBackController.PlayByTime(startTime, endTime); } } } } }
public AggregatedConfig() { RunEnvironment = RunEnv.ExternalEnv; UserCenterAddress = string.Empty; RtServerAddress = string.Empty; ServerVersionInfo = string.Empty; DeviceNo = string.Empty; DeviceKey = string.Empty; AccountAutoLogin = new LoginConfig(); MainCamera = new VideoConfig() { Type = "主摄像头", }; SecondaryCamera = new VideoConfig() { Type = "辅摄像头" }; AudioConfig = new AudioConfig(); LocalLiveConfig = new LiveConfig() { Description = "本地推流", IsEnabled = true }; RemoteLiveConfig = new LiveConfig() { Description = "服务器推流", IsEnabled = true }; RecordConfig = new RecordConfig() { Description = "录制" }; }
public void ConfigureVideo(VideoConfig config) { InvokeHubChannel <IVoipChannel>(config); }
public bool Open(XmlNode argNode, string argBasePath, bool argIsRemote) { Debug.Assert(null != argNode && !string.IsNullOrEmpty(argBasePath)); try { m_basePath = argBasePath; m_isRemote = argIsRemote; Log.ResourceManager.LogDebugFormat("Prepare for opening a resource service [{0}]", m_language); if (!argIsRemote) { XmlAttribute cfgAttri = null; //Load image config XmlNode imgNode = argNode.SelectSingleNode(s_ImageNode); if (null != imgNode && imgNode.NodeType == XmlNodeType.Element) { string imgCfg = null; cfgAttri = imgNode.Attributes[s_cfgAttri]; if (null != cfgAttri && !string.IsNullOrEmpty(cfgAttri.Value)) { imgCfg = string.Format(@"{0}\{1}\{2}", argBasePath, imgNode.Name, cfgAttri.Value); ImageConfig.Load(imgCfg); } } //Load voice config XmlNode voiceNode = argNode.SelectSingleNode(s_VoiceNode); if (null != voiceNode && voiceNode.NodeType == XmlNodeType.Element) { string voiceCfg = null; cfgAttri = voiceNode.Attributes[s_cfgAttri]; if (null != cfgAttri && !string.IsNullOrEmpty(cfgAttri.Value)) { voiceCfg = string.Format(@"{0}\{1}\{2}", argBasePath, voiceNode.Name, cfgAttri.Value); VoiceConfig.Load(voiceCfg); } } //Load video config XmlNode videoNode = argNode.SelectSingleNode(s_VideoNode); if (null != videoNode && videoNode.NodeType == XmlNodeType.Element) { string videoCfg = null; cfgAttri = videoNode.Attributes[s_cfgAttri]; if (null != cfgAttri && !string.IsNullOrEmpty(cfgAttri.Value)) { videoCfg = string.Format(@"{0}\{1}\{2}", argBasePath, videoNode.Name, cfgAttri.Value); VideoConfig.Load(videoCfg); } } //load text content string textNodePath = string.Format("{0}/{1}", s_textNode, s_categoryNode); XmlNodeList listNodes = argNode.SelectNodes(textNodePath); XmlAttribute nameAttri = null; string textFilePath = null; XmlDocument textDoc = null; foreach (XmlNode node in listNodes) { nameAttri = node.Attributes[s_nameAttri]; if (null == nameAttri || string.IsNullOrEmpty(nameAttri.Value)) { continue; } try { textFilePath = string.Format(@"{0}\{1}\{2}\{3}.xml", argBasePath, s_textNode, m_language, nameAttri.Value); if (!File.Exists(textFilePath)) { Log.ResourceManager.LogWarnFormat("The file[{0}] isn't exist", textFilePath); continue; } textDoc = new XmlDocument(); textDoc.Load(textFilePath); TextCategories.Add(nameAttri.Value, textDoc); } catch (System.Exception ex) { Log.ResourceManager.LogWarn(string.Format("Failed to open text file[{0}]", textFilePath), ex); } } } } catch (System.Exception ex) { m_imageConfig = null; m_voiceConfig = null; m_videoConfig = null; if (null != m_dicTextCategories) { m_dicTextCategories.Clear(); m_dicTextCategories = null; } Log.ResourceManager.LogError("Failed to open a resource service", ex); return(false); } return(true); }
[DllImport(DllPath)] public static extern void SetVideoConfig(VideoConfig config);
public RequestHandler(VideoConfig config) { }
/// <summary> /// 构造函数 /// </summary> /// <param name="pVideoConfig">视频配置</param> /// <param name="pControlHandel">控件句柄</param> public VideoPlayBackController(VideoConfig pVideoConfig, IntPtr pControlHandel) { VideoPlayBackLogger.Debug("==========================开始=============================", ""); _controlHandel = pControlHandel; _curVideoConfig = pVideoConfig; }
public IAsyncAction ConfigureVideoAsync(VideoConfig config) { return(InvokeHubChannelAsync <ICallChannel>(config).AsTask().AsAsyncAction()); }
public IAsyncAction ConfigureVideoAsync(VideoConfig config) { return(Context.WithContextAction(cx => { cx.IsVideoEnabled = config.On; }).AsAsyncAction()); }