public static IPCameraBase CreateCamera(CameraSpec cs) { IPCameraBase cam = null; switch (cs.type) { case CameraType.jpg: cam = new JpegRefreshCamera(); break; case CameraType.mjpg: cam = new MJpegCamera(); break; case CameraType.h264_rtsp_proxy: // h264_rtsp_proxy cameras do not support jpeg output - only stream reflection via live555ProxyServer cam = new H264Camera(); break; case CameraType.vlc_transcode: // VlcCamera does support jpeg output, but not stream reflection cam = new VlcCamera(); break; case CameraType.vlc_transcode_to_html5: // Html5Camera does not support jpeg output - only streaming via VLC's http server. cam = new Html5VideoCamera(); break; default: break; } if (cam != null) { cam.cameraSpec = cs; if (cs.ptzType == PtzType.Dahua) { MJpegCameraProxy.PanTiltZoom.AdvPtz.AssignPtzObj(cs); } else if (cs.ptzType == PtzType.Hikvision) { MJpegCameraProxy.PanTiltZoom.AdvPtz.AssignPtzObj(cs); } } return(cam); }
public string GetRTSPUrl(string id, SimpleHttp.HttpProcessor p) { IPCameraBase cam = GetCameraById(id); if (cam == null || cam.cameraSpec.type != CameraType.h264_rtsp_proxy) { return(""); } cam.ImageLastViewed = DateTime.Now; if (!cam.isRunning) { cam.Start(); int timesWaited = 0; Thread.Sleep(50); while (timesWaited++ < 50) { Thread.Sleep(20); } cam.ImageLastViewed = DateTime.Now; } H264Camera h264cam = (H264Camera)cam; return("rtsp://" + h264cam.access_username + ":" + h264cam.access_password + "@$$$HOST$$$:" + cam.cameraSpec.h264_port + "/proxyStream"); }