void _CreateRTPCamera(int streamsCount) { MultipleNetworkCameraSource c; if (_cameraSource != null) { _cameraSource.Close(); } _cameraSource = (c = new MultipleNetworkCameraSource()); string profileType = Configuration.CamSettings.streamCodec == CameraConfigurations.EStreamCodec.Ovrvision ? "Ovrvision" : "None"; _InitCameraRenderers(); /*if(Configuration.CamSettings.CameraType==CameraConfigurations.ECameraType.WebCamera) * c.StreamsCount = 2; * else c.StreamsCount = 1;*/ c.SeparateStreams = Configuration.CamSettings.SeparateStreams; c.CameraStreams = Configuration.CamSettings.CameraStreams; c.StreamsCount = streamsCount; c.TargetNode = gameObject; c.port = Settings.Instance.GetPortValue("VideoPort", 0); c.RobotConnector = RobotConnector; c.Init(_robotIfo, profileType); if (OnCameraSourceCreated != null) { OnCameraSourceCreated(this, _cameraSource); } _cameraSource.GetBaseTexture().OnFrameGrabbed += OnFrameGrabbed; m_grabbedFrames = 0; if (Debugger) { Debugger.RemoveDebugElement(_cameraDebugElem);; _cameraDebugElem = new DebugCameraCaptureElement(_cameraSource.GetBaseTexture()); Debugger.AddDebugElement(_cameraDebugElem);; } //request netvalue port if (RobotConnector.Connector.RobotCommunicator != null) { RobotConnector.Connector.RobotCommunicator.SetData("", "NetValuePort", ServiceName + "," + RobotConnector.Connector.DataCommunicator.GetPort().ToString(), false, false); } }
void _CreateMediaCamera() { FileCameraSource c = new FileCameraSource(); _cameraSource = c; c.TargetNode = gameObject; c.Init(_robotIfo); _cameraSource.GetBaseTexture().OnFrameGrabbed += OnFrameGrabbed; }
protected override void OnCameraSourceCreated(TxKitEyes creator, ICameraSource src) { base.OnCameraSourceCreated(creator, src); if (_imgSampler != null) { _imgSampler.Destroy(); } _imgSampler = new ImageSampler(src.GetBaseTexture()); _imgSampler.OnImageSampled += OnImageArrived; }
void _CreateMediaCamera() { FileCameraSource c = new FileCameraSource(); _cameraSource = c; _InitCameraRenderers(); c.TargetNode = gameObject; c.Init(_robotIfo); _cameraSource.GetBaseTexture().OnFrameGrabbed += OnFrameGrabbed; if (OnCameraSourceCreated != null) { OnCameraSourceCreated(this, _cameraSource); } }
public void SetRemoteHost(string IP,RobotConnector.TargetPorts ports) { _remoteHostIP = IP; /* MultipleNetworkCameraSource c; _cameraSource = (c=new MultipleNetworkCameraSource()); c.TargetNode=gameObject; c.Host = IP; c.port = port; c.Init();*/ if(this.CameraType==CameraSourceType.Remote) { if (_cameraSource != null) { _cameraSource.Close(); _cameraSource=null; } MultipleNetworkCameraSource c; _cameraSource = (c = new MultipleNetworkCameraSource ()); c.StreamsCount = 2; c.TargetNode = gameObject; c.Host = IP; c.port = Settings.Instance.GetPortValue("VideoPort",0); c.Init (); _cameraSource.GetBaseTexture ().OnFrameGrabbed += OnFrameGrabbed; m_grabbedFrames=0; //disable the renderes until we video stream starts //_camRenderer[0].Disable(); //_camRenderer[1].Disable(); _videoPorts=new uint[2]{0,0}; _videoPorts[0]=c.Texture.Player.GetVideoPort(0); _videoPorts[1]=c.Texture.Player.GetVideoPort(1); RobotConnector.Connector.SendData("VideoPorts",_videoPorts[0].ToString()+","+_videoPorts[1].ToString(),true); if(_audioPlayer!=null) { int port= Settings.Instance.GetPortValue("AudioPort",0); _audioPlayer.SetIP(IP,0,false); _audioPlayer.CreateStream(); _audioPlayer.Play(); _audioPort=_audioPlayer.GetAudioPort(); RobotConnector.Connector.SendData("AudioPort",_audioPort.ToString(),true); } if(_audioStreamer!=null) { _audioStreamer.SetIP(IP,7010,false);//port should be dynamically assigned from remote side _audioStreamer.Stream(); } for(int i=0;i<2;++i) _camRenderer[i].CamSource=_cameraSource; if (Debugger) { Debugger.RemoveDebugElement(_cameraDebugElem);; _cameraDebugElem=new DebugCameraCaptureElement(_cameraSource.GetBaseTexture()); Debugger.AddDebugElement(_cameraDebugElem);; } } { //request camera settings RobotConnector.Connector.SendData("CameraParameters","",false); //request netvalue port RobotConnector.Connector.RobotCommunicator.SetData ("NetValuePort", "AVStreamServiceModule,"+RobotConnector.Connector.DataCommunicator.Port.ToString(), false,false); } }