/// <summary> /// Creates a new copy of this instance of the parameter. /// </summary> /// <returns>A new instance of this parameter is returned.</returns> public override LayerParameterBase Clone() { VideoDataParameter p = new VideoDataParameter(); p.Copy(this); return(p); }
/// <summary> /// Copy on parameter to another. /// </summary> /// <param name="src">Specifies the parameter to copy.</param> public override void Copy(LayerParameterBase src) { VideoDataParameter p = (VideoDataParameter)src; m_videoType = p.m_videoType; m_nDeviceID = p.m_nDeviceID; m_strVideoFile = p.m_strVideoFile; m_nSkipFrames = p.m_nSkipFrames; m_nVideoWidth = p.m_nVideoWidth; m_nVideoHeight = p.m_nVideoHeight; }
/// <summary> /// Load the parameter from a binary reader. /// </summary> /// <param name="br">Specifies the binary reader.</param> /// <param name="bNewInstance">When <i>true</i> a new instance is created (the default), otherwise the existing instance is loaded from the binary reader.</param> /// <returns>Returns an instance of the parameter.</returns> public override object Load(System.IO.BinaryReader br, bool bNewInstance = true) { RawProto proto = RawProto.Parse(br.ReadString()); VideoDataParameter p = FromProto(proto); if (!bNewInstance) { Copy(p); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static VideoDataParameter FromProto(RawProto rp) { VideoDataParameter p = new VideoDataParameter(); string strVal; if ((strVal = rp.FindValue("video_type")) != null) { if (strVal == VideoType.VIDEO.ToString()) { p.video_type = VideoType.VIDEO; } else { p.video_type = VideoType.WEBCAM; } } if ((strVal = rp.FindValue("device_id")) != null) { p.device_id = int.Parse(strVal); } if ((strVal = rp.FindValue("video_file")) != null) { p.video_file = strVal; } if ((strVal = rp.FindValue("skip_frames")) != null) { p.skip_frames = uint.Parse(strVal); } if ((strVal = rp.FindValue("video_width")) != null) { p.video_width = uint.Parse(strVal); } if ((strVal = rp.FindValue("video_height")) != null) { p.video_height = uint.Parse(strVal); } return(p); }