public VideoStreamViewer(string url, OSAEObject obj, string appName) { InitializeComponent(); Log = new General.OSAELog(appName); screenObject = obj; _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; _mjpeg.Error += _mjpeg_Error; imgWidth = Convert.ToDouble(OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Width").Value); imgHeight = Convert.ToDouble(OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Height").Value); ControlWidth = Convert.ToDouble(OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Name, "Width").Value); imgRatio = ControlWidth / imgWidth; ControlHeight = Convert.ToDouble(imgHeight * imgRatio); streamURI = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Stream Address").Value; // if (imgWidth > 0) { imgWidth = imgWidth); } // if (imgHeight > 0) { imgHeight = Convert.ToDouble(imgHeight); } this.Width = ControlWidth; this.Height = ControlHeight; image.Width = ControlWidth; image.Height = ControlHeight; if (streamURI == null) { Log.Error("Stream Path Not Found: " + streamURI); message.Content = "Can Not Open: " + streamURI; } else { streamURI = renameingSys(streamURI); Log.Info("Streaming: " + streamURI); _mjpeg.ParseStream(new Uri(streamURI)); } }
public MainPage() { this.InitializeComponent(); _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; _mjpeg.Error += _mjpeg_Error; }
//private void btnStart_Click(object sender, EventArgs e) private void start(string cam) { MjpegDecoder mjpeg = new MjpegDecoder(); mjpeg.FrameReady += mjpeg_FrameReady; mjpeg.Error += mjpeg_Error; mjpeg.ParseStream(new Uri(cam)); }
private void btnStart_Click(object sender, EventArgs e) { MjpegDecoder mjpeg = new MjpegDecoder(); mjpeg.FrameReady += mjpeg_FrameReady; mjpeg.Error += mjpeg_Error; mjpeg.ParseStream(new Uri("http://192.168.2.200/img/video.mjpeg")); }
// Code to Initialize your custom User Control public CustomUserControl(OSAEObject sObj, string ControlName) { InitializeComponent(); _controlname = ControlName; screenObject = sObj; objName = sObj.Property("Object Name").Value; CurState = OSAEObjectStateManager.GetObjectStateValue(objName).Value; LastStateChange = OSAEObjectStateManager.GetObjectStateValue(objName).LastStateChange; _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; _mjpeg.Error += _mjpeg_Error; var imgsWidth = OSAEObjectPropertyManager.GetObjectPropertyValue(sObj.Property("Object Name").Value, "Width").Value; var imgsHeight = OSAEObjectPropertyManager.GetObjectPropertyValue(sObj.Property("Object Name").Value, "Height").Value; streamURI = OSAEObjectPropertyManager.GetObjectPropertyValue(sObj.Property("Object Name").Value, "Stream Address").Value; if (imgsWidth != "") { imgWidth = Convert.ToDouble(imgsWidth); } if (imgsHeight != "") { imgHeight = Convert.ToDouble(imgsHeight); } this.Width = imgWidth; this.Height = imgHeight; image.Width = imgWidth; image.Height = imgHeight; if (streamURI == null) { this.Log.Error("Stream Path Not Found: " + streamURI); message.Content = "Can Not Open: " + streamURI; } else { streamURI = renameingSys(streamURI); this.Log.Info("Streaming: " + streamURI); _mjpeg.ParseStream(new Uri(streamURI)); } }
public MainWindow() { InitializeComponent(); //Init a decoder for video and listen for new frames _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; //Init an handler for keyboard this.keyboardEventHandler = new KeyEventHandler(OnButtonKeyDown); listeningToKeyboardEvents = false; try { kinectControler = new KinectControler(); //Init KinectControler handlers this.kinectControler.NewControlDataIsReady += KinectControlerHasNewControl; this.kinectControler.UserDetectionStatusChanged += KinectControlerUserDetectionStatusHasChanged; } catch (Exception ex) { button1.IsEnabled = false; MessageBox.Show("Aucune Kinect n'a été détectée. Pour utiliser la Kinect avec l'application, connectez une Kinect puis relancez le logiciel"); } }
MjpegDecoder mjpeg; //MJPEG decoder appearing on the main Form public Form1() { InitializeComponent(); List<String> tList = new List<String>(); bluetoothBox.Items.Clear(); foreach (string s in SerialPort.GetPortNames()) { tList.Add(s); } tList.Sort(); bluetoothBox.Items.AddRange(tList.ToArray()); bluetoothBox.SelectedIndex = 0; serialPort.BaudRate = 9600; labelSpeed.Text = "Speed: " + tBar.Value; //initilaize the set of codes STOP[0] = 0; FORWARD[0] = (byte)(10 + SPEED_TMP); BACKWARD[0] = (byte)(20 + SPEED_TMP); RIGHT[0] = (byte)(30 + SPEED_TMP); LEFT[0] = (byte)(40 + SPEED_TMP); FWD_RIGHT[0] = (byte)(50 + SPEED_TMP); FWD_LEFT[0] = (byte)(60 + SPEED_TMP); BWD_RIGHT[0] = (byte)(70 + SPEED_TMP); BWD_LEFT[0] = (byte)(80 + SPEED_TMP); mjpeg = new MjpegDecoder(); }
public VideoStreamViewer(string url) { InitializeComponent(); _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; _mjpeg.ParseStream(new Uri(url)); }
public MainWindow() { InitializeComponent(); _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; _mjpeg.Error += _mjpeg_Error; }
public VideoStreamViewer(string url, OSAEObject obj) { InitializeComponent(); screenObject = obj; _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; _mjpeg.Error += _mjpeg_Error; var imgsWidth = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Width").Value; var imgsHeight = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Height").Value; streamURI = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Stream Address").Value; if (imgsWidth != "") { imgWidth = Convert.ToDouble(imgsWidth); } if (imgsHeight != "") { imgHeight = Convert.ToDouble(imgsHeight); } this.Width = imgWidth; this.Height = imgHeight; image.Width = imgWidth; image.Height = imgHeight; if (streamURI == null) { this.Log.Error("Stream Path Not Found: " + streamURI); message.Content = "Can Not Open: " + streamURI; } else { streamURI = renameingSys(streamURI); this.Log.Info("Streaming: " + streamURI); _mjpeg.ParseStream(new Uri(streamURI)); } }
private void btnStart_Click(object sender, EventArgs e) { MjpegDecoder mjpeg = new MjpegDecoder(); mjpeg.FrameReady += mjpeg_FrameReady; mjpeg.Error += mjpeg_Error; mjpeg.ParseStream(new Uri("http://192.192.85.20:11000/getimage"),"admin","pass"); }
public VideoStreamViewer(string url, OSAEObject obj) { InitializeComponent(); screenObject = obj; _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; _mjpeg.ParseStream(new Uri(url)); }
protected override void Initialize() { base.Initialize(); _spriteBatch = new SpriteBatch(this.GraphicsDevice); _mjpeg = new MjpegDecoder(); _mjpeg.ParseStream(new Uri("http://192.168.2.200/img/video.mjpeg")); }
public CameraHandler(CameraDisplay display) { this.display = display; mjpegDecoder = new MjpegDecoder(); processThread = new Thread(new ThreadStart(runProcessing)); originalUpdateThread = new Thread(new ThreadStart(runOriginalUpdate)); }
private WebcamView() { InitializeComponent(); webcam1Decoder = new MjpegDecoder(); webcam2Decoder = new MjpegDecoder(); webcam1Decoder.FrameReady += Webcam1Decoder_FrameReady; webcam2Decoder.FrameReady += Webcam2Decoder_FrameReady; webcam1Decoder.Error += Webcam1Decoder_Error; webcam2Decoder.Error += Webcam2Decoder_Error; }
public Form1() { InitializeComponent(); Closing += new CancelEventHandler(Form1_Closing); mjp = new MjpegDecoder(); mjp.FrameReady += mjp_ready; Form.CheckForIllegalCrossThreadCalls = false; runCheckImgTask(); th = new Thread(StartTakePicture); th.Start(); }
private void Form1_Load(object sender, EventArgs e) { // CenterToScreen(); // this.liveMedia.WindowState = FormWindowState.Maximized; _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; _mjpeg.Error += mjpeg_Error; this.LoadConfig(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); _spriteBatch = new SpriteBatch(this.GraphicsDevice); _mjpeg = new MjpegDecoder(); _mjpeg.ParseStream(new Uri("http://192.168.2.200/img/video.mjpeg")); }
public MainForm() { reply = IpAddress.Send(IPAddress.Parse(IpAdd)); InitializeComponent(); _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; label7.Text = DateTime.Now.ToLongTimeString(); label8.Text = DateTime.Now.ToLongDateString(); timer1.Start(); }
private void CCTVForm_Load(object sender, EventArgs e) { try { MjpegDecoder mjpeg = new MjpegDecoder(); mjpeg.FrameReady += mjpeg_FrameReady; mjpeg.ParseStream(new Uri("http://192.168.6.91:5000")); } catch { MessageBox.Show("CCTV 서버가 실행되지 않았습니다."); } }
private void startButton_Click(object sender, EventArgs e) { startButton.Enabled = false; stopButton.Enabled = true; _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; _mjpeg.ParseStream(new Uri(mjpegTextBox.Text)); _client = new SocketClient(nnetHostTextBox.Text); _client.OnNewFrame += new OnNewFrame(client_OnNewFrame); _client.OnStateChanged += new OnStateChanged(client_OnStateChanged); _client.Start(); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { // need to be out of browser to get past crossdomain.xml not existing on the cam // NOTE: this will only work on cams which properly send MJPEG data to an IE user agent header // I've found several cams (Cisco being one) that tries to be "smart" and sends a single JPEG frame // instead of an MJPEG stream since destkop IE doesn't properly support the MJPEG codec if(Application.Current.IsRunningOutOfBrowser) { MjpegDecoder mjpeg = new MjpegDecoder(); mjpeg.FrameReady += mjpeg_FrameReady; mjpeg.Error += mjpeg_Error; mjpeg.ParseStream(new Uri("http://192.168.2.200/img/video.mjpeg")); } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { // need to be out of browser to get past crossdomain.xml not existing on the cam // NOTE: this will only work on cams which properly send MJPEG data to an IE user agent header // I've found several cams (Cisco being one) that tries to be "smart" and sends a single JPEG frame // instead of an MJPEG stream since destkop IE doesn't properly support the MJPEG codec if (Application.Current.IsRunningOutOfBrowser) { MjpegDecoder mjpeg = new MjpegDecoder(); mjpeg.FrameReady += mjpeg_FrameReady; mjpeg.Error += mjpeg_Error; mjpeg.ParseStream(new Uri("http://192.168.2.200/img/video.mjpeg")); } }
public Form1() { InitializeComponent(); _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; input_ip_box iib = new input_ip_box(); if (DialogResult.OK == iib.ShowDialog()) { pi_ip = iib.get_ip(); label1.Text = pi_ip; } }
private void btn_Connect_Click(object sender, EventArgs e) { //Declare variables string user = Properties.Settings.Default.UserName; string password = Properties.Settings.Default.Password; string adderess = Properties.Settings.Default.ApiAddress; lb_cameras.SelectedItem. //Generate encrypted user token var oUserToken = new TokenAuth.UserToken(user, password, timeout); var encryptedToken = oUserToken.Encrypt(); sEncryptedToken = encryptedToken; //Pull camera list from API string url = "http://" + adderess + ":9000/api/v1/cameras"; //Create Data Table of JSON results DataTable jsonDataDisplay() { using (var webClient = new WebClient()) { String rawJSON = webClient.DownloadString(url); var table = JsonConvert.DeserializeObject <DataTable>(rawJSON); return(table); } } //Populate list from JSON objects lb_cameras.DataSource = jsonDataDisplay(); lb_cameras.DisplayMember = "Name"; lb_cameras.ValueMember = "ID"; //Load MJPEG stream into picture box try { string url3 = "http://" + adderess + ":9000/api/v1/video/" + cameraid + "/mjpeg?token=" + sEncryptedToken; MjpegDecoder mjpeg = new MjpegDecoder(); mjpeg.FrameReady += mjpeg_FrameReady; mjpeg.ParseStream(new Uri(url3)); } catch (System.Net.WebException e1) { MessageBox.Show("Web Exception Thrown: {0}", e1.Message); } }
public Form1() { InitializeComponent(); mjpeg = new MjpegDecoder(); mjpeg.FrameReady += mjpeg_FrameReady; // GoFullscreen(true); var allClasses = DeviceInfoSet.GetAllClassesPresent(); var devices = allClasses.GetDevices(); xbox = (from device in devices where device.ClassName == "XboxComposite" select device).FirstOrDefault(); timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) }; timer.Tick += timerTick; timer.Start(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { DataContext = this; PredefinedPositionsList.Add(new Position(0, 0, "Center")); mjpegLeft = new MjpegDecoder(); mjpegLeft.FrameReady += MjpegLeft_FrameReady; mjpegLeft.Error += MjpegLeft_Error; electricPlotModel = new ElectricPlotModel(); electricPlot.Model = electricPlotModel.DataModel; startTime = DateTime.Now; GetSerialPorts(); GetIPAddresses(); communication = new CommunicationWrapper(); //mjpegRight = new MjpegDecoder(); //mjpegRight.FrameReady += MjpegRight_FrameReady; //mjpegRight.Error += MjpegRight_Error; }
public CameraVM(CameraInfo cam, ObservableCollection <CameraNameWrapper> cameraNameList, ModeColors mode, EventAggregator ea) { CamInfo = cam; this.cameraNameList = cameraNameList; _ea = ea; _ea.GetEvent <CameraSelectEvent>().Subscribe(bePreview); _ea.GetEvent <CameraOutPutEvent>().Subscribe(beOutput); _ea.GetEvent <ClearCameraOutputEvent>().Subscribe(unOutput); _ea.GetEvent <ClearCameraPreviewEvent>().Subscribe(unPreview); _ea.GetEvent <InitSessionResponseReceivedEvent>().Subscribe(OnGetInitSessionResponse, ThreadOption.UIThread); _ea.GetEvent <StreamUriResponseReceivedEvent>().Subscribe(OnGetStreamUri, ThreadOption.UIThread); modeColors = mode; mjpegDecoder = new MjpegDecoder(); mjpegDecoder.FrameReady += FrameReady; mjpegDecoder.Error += MjpegDecoderError; }
public MainWindow() { InitializeComponent(); // Instantiate new decoder streamDecoder = new MjpegDecoder(); // Set FrameReady event handler streamDecoder.FrameReady += mjpeg_FrameReady; // Set error event handler streamDecoder.Error += mjpeg_Error; // Set no data image BitmapImage noDataPic = new BitmapImage(new Uri("images/NoData.png", UriKind.Relative)); this.imgStreamDisplay.Source = noDataPic; }
public BaseControlStation_TabControls(XNADrawPanel xnaDrawPanel) { #region "XNA+++" this.xnaDrawPanel = xnaDrawPanel; this.content = xnaDrawPanel.content; #endregion //************MODEL MAKER********** #region "MODEL INIT" modelMaker_DroneModel = new ModelMaker(xnaDrawPanel.GraphicsDevice, content.Load <Model>("Model/DroneFull")); #endregion #region "IMAGE LIST INIT" IMAGELIST.Add(content.Load <Texture2D>("Image/GUI/1_HUD/AngleBar")); //0 IMAGELIST.Add(content.Load <Texture2D>("Image/GUI/1_HUD/Pointer")); //1 IMAGELIST.Add(content.Load <Texture2D>("Image/GUI/1_HUD/Back")); //2 IMAGELIST.Add(content.Load <Texture2D>("Image/GUI/1_HUD/Bar_H")); //3 IMAGELIST.Add(content.Load <Texture2D>("Image/GUI/1_HUD/Bar_V")); //4 IMAGELIST.Add(content.Load <Texture2D>("Image/GUI/1_HUD/TestBlackSpace")); //5 IMAGELIST.Add(content.Load <Texture2D>("Image/GUI/1_HUD/Navigator")); //6 IMAGELIST.Add(content.Load <Texture2D>("Image/GUI/1_HUD/BackTextureNavigation")); //7 IMAGELIST.Add(content.Load <Texture2D>("Image/GUI/1_HUD/Nut")); //8 IMAGELIST.Add(content.Load <Texture2D>("Image/GUI/1_HUD/NavigatorPin")); //9 IMAGELIST.Add(content.Load <Texture2D>("Image/GUI/1_HUD/CheckUncheckList")); //10 #endregion #region "FONT INIT" CSM_Font = xnaDrawPanel.HaettenschweilerFont; #endregion #region "CAMERA INIT" cam1 = new ArcBallCamera(ArcBallCameraMode.Free); cam1.Target = Vector3.Zero; cam1.Distance = 50; cam2 = new ArcBallCamera(ArcBallCameraMode.Free); cam2.Target = Vector3.Zero; cam2.Distance = 50; cam3 = new ArcBallCamera(ArcBallCameraMode.Free); cam3.Target = Vector3.Zero; cam3.Distance = 50; cam4 = new ArcBallCamera(ArcBallCameraMode.Free); cam4.Target = Vector3.Zero; cam4.Distance = 50; #endregion #region "H_V BAR INIT" ThrottleBar = new HUD.H_V_Bar(xnaDrawPanel.GraphicsDevice, "Throttle", HUD.H_V_Bar.ScrollType.Vertical, HUD.H_V_Bar.PointerAlign.Left, HUD.H_V_Bar.PointerFlow.DownUp, (int)MinThrottle, IMAGELIST, CSM_Font); ElevatorBar = new HUD.H_V_Bar(xnaDrawPanel.GraphicsDevice, "Elevator", HUD.H_V_Bar.ScrollType.Vertical, HUD.H_V_Bar.PointerAlign.Right, HUD.H_V_Bar.PointerFlow.DownUp, (int)MinElevator, IMAGELIST, CSM_Font); RudderBar = new HUD.H_V_Bar(xnaDrawPanel.GraphicsDevice, "Rudder", HUD.H_V_Bar.ScrollType.Horizontal, HUD.H_V_Bar.PointerAlign.Bottom, HUD.H_V_Bar.PointerFlow.LeftRight, (int)MinRudder, IMAGELIST, CSM_Font); AileronBar = new HUD.H_V_Bar(xnaDrawPanel.GraphicsDevice, "Aileron", HUD.H_V_Bar.ScrollType.Horizontal, HUD.H_V_Bar.PointerAlign.Bottom, HUD.H_V_Bar.PointerFlow.LeftRight, (int)MinAileron, IMAGELIST, CSM_Font); #endregion #region "MJPEC DECODER" mJpegDecoder = new MjpegDecoder(); #endregion }
private async void StartStreaming(object sender, EventArgs e) { // Сбрасываем токен для возможности возобновления трансляции if (token.IsCancellationRequested) { cts = new CancellationTokenSource(); token = cts.Token; } if (!streamIsStarted && selectedCamera != null && res != null && fpsSelector.Text != "" && url != null) { pictureBox.BackColor = Color.Black; streamIsStarted = true; await MjpegDecoder.GetByteArray(DrawImage, url, token); } else if (!streamIsStarted && url != null) { MessageBox.Show("Пожалуйста, заполните все поля и нажмите \"Применить\"", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public EnclosureCameraViewer() { InitializeComponent(); m_decoder = new MjpegDecoder(); m_decoder.FrameReady += m_decoder_FrameReady; m_decoder.Error += m_decoder_Error; // Axis camera must be set to allow anonymous viewer login // The IP address below and setting the anonymous viewer login can be // done using the Axis Camera Management Client string ipAddr = GlobalVars.EnclosureCameraIPAddress; string uriString = "http://" + ipAddr + "/axis-cgi/mjpg/video.cgi"; m_decoder.ParseStream(new Uri(uriString)); //m_decoder.ParseStream(new Uri("http://10.103.28.91/axis-cgi/mjpg/video.cgi")); }
public MainWindow() { InitializeComponent(); mjpeg = new MjpegDecoder(); mjpeg.FrameReady += FrameReady; timer = new Timer(); timer.AutoReset = true; timer.Interval = 1000; timer.Elapsed += (sender, e) => { Application.Current.Dispatcher.Invoke(() => { if (!lastText.Equals(source.Text)) { mjpeg.StopStream(); } lastText = source.Text; mjpeg.ParseStream(new Uri(source.Text)); }); }; timer.Start(); }
public Camera(Master controller) : base(controller) { // Set up the camera object. camera = new MjpegDecoder(); camera.FrameReady += Camera_FrameReady; camera.Error += OnCamera_Error; // Subscribe to robot connection event. master._Dashboard_NT.ConnectionEvent += OnRobotConnection; OpenNewWindow = new RelayCommand() { CanExecuteDeterminer = () => true, FunctionToExecute = ShowInNewWindow }; OpenSettingsCommand = new RelayCommand() { CanExecuteDeterminer = () => true, FunctionToExecute = (object parameter) => OpenCameraSettings() }; }
public VideoStreamViewer(string url, OSAEObject obj) { InitializeComponent(); screenObject = obj; _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; _mjpeg.Error += _mjpeg_Error; CamipAddress = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "IP Address").Value; CamPort = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Port").Value; UserName = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Username").Value; Password = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Password").Value; var imgsWidth = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Width").Value; var imgsHeight = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Height").Value; string streamURI = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Stream Address").Value; if (imgsWidth != "") { imgWidth = Convert.ToDouble(imgsWidth); } if (imgsHeight != "") { imgHeight = Convert.ToDouble(imgsHeight); } this.Width = imgWidth; this.Height = imgHeight; image.Width = imgWidth; image.Height = imgHeight; if (streamURI == null) { this.Log.Info("Stream Path Not Found: " + streamURI); message.Content = "Can Not Open: " + streamURI; } else { streamURI = replaceFielddata(streamURI); _mjpeg.ParseStream(new Uri(streamURI)); } }
public VideoStreamViewer(string url, OSAEObject obj) { InitializeComponent(); screenObject = obj; _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; _mjpeg.Error += _mjpeg_Error; CamipAddress = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "IP Address").Value; CamPort = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Port").Value; UserName = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Username").Value; Password = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Password").Value; string streamURI = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Stream Address").Value; if (streamURI == null) { this.Log.Info("Stream Path Not Found: " + streamURI); message.Content = "Can Not Open: " + streamURI; } else { streamURI = replaceFielddata(streamURI); _mjpeg.ParseStream(new Uri(streamURI)); } }
private void MjpegInitialize() { try { _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += MjpegOnFrameReady; _mjpeg.Error += MjpegOnError; _mjpeg.ParseStream(new Uri(ApplicationData.Current.LocalSettings.Values[Settings.CAM_STREAM_URL].ToString()), ApplicationData.Current.LocalSettings.Values[Settings.LOGIN].ToString(), ApplicationData.Current.LocalSettings.Values[Settings.PASSWORD].ToString()); _mainPage.DisplayStatus(string.Empty, MainPage.NotifyType.StatusMessage); } catch(Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " " + ex.InnerException.Message; } _mainPage.DisplayStatus(message, MainPage.NotifyType.ErrorMessage); } }
public Form1() { InitializeComponent(); //Startup s = new Startup(this); timer1.Start(); Setpos(); Location = Properties.Settings.Default.location; Size = Properties.Settings.Default.size; System.Net.ServicePointManager.DefaultConnectionLimit = 100; d1 = new MjpegDecoder(); d1.FrameReady += go1; try { d1.ParseStream(new Uri(Properties.Settings.Default.URILT)); } catch { } d2 = new MjpegDecoder(); d2.FrameReady += go2; try { d2.ParseStream(new Uri(Properties.Settings.Default.URIRT)); } catch { } d3 = new MjpegDecoder(); d3.FrameReady += go3; try { d3.ParseStream(new Uri(Properties.Settings.Default.URILM)); } catch { } d4 = new MjpegDecoder(); d4.FrameReady += go4; try { d4.ParseStream(new Uri(Properties.Settings.Default.URIRM)); } catch { } d5 = new MjpegDecoder(); d5.FrameReady += go5; try { d5.ParseStream(new Uri(Properties.Settings.Default.URIRB)); } catch { } if (Properties.Settings.Default.Usecolor) { BackColor = Properties.Settings.Default.BGColor; mqttViewer1.BackColor = Properties.Settings.Default.BGColor; } else { BackColor = Color.FromArgb(184, 204, 232); mqttViewer1.BackColor = Color.FromArgb(184, 204, 232); } StartMQTT(false); }
private void MainWindow_Load(object sender, EventArgs e) { //Fitting Screen this.Location = new Point(0, 0); this.Size = Screen.PrimaryScreen.WorkingArea.Size; //Fitting Stream -> PictureBoxes this.Controls.Add(input_cam); this.input_cam.SizeMode = PictureBoxSizeMode.StretchImage; this.Controls.Add(output_cam); this.output_cam.SizeMode = PictureBoxSizeMode.StretchImage; this.logoPB.SizeMode = PictureBoxSizeMode.StretchImage; /*RFID Reader Inits*/ mReader = new clsReader(); mReaderInterface = ComInterface.enumTCPIP; mReader.Disconnect(); try { if (mReaderInterface == ComInterface.enumTCPIP) { mReader.InitOnNetwork("192.168.1.100", 23); } else { mReader.InitOnCom(); } string result = mReader.Connect(); if (mReader.IsConnected) { if (mReaderInterface == ComInterface.enumTCPIP) { this.Cursor = Cursors.Arrow; if (!mReader.Login("alien", "password")) { mReader.Disconnect(); return; } } mReader.AutoMode = "On"; } //Stream Inits input_mjpeg = new MjpegDecoder(); input_mjpeg.FrameReady += input_mjpeg_frameReady; output_mjpeg = new MjpegDecoder(); output_mjpeg.FrameReady += output_mjpeg_frameReady; add_cam(); //Timers antennaTimer1.Enabled = true; antennaTimer2.Enabled = true; } catch { inputInfoPanel.BackColor = Color.Red; } //Motion Detection Variables Inits fic = new FilterInfoCollection(FilterCategory.VideoInputDevice); foreach (FilterInfo item in fic) { metroComboBox1.Items.Add(item.Name); } metroComboBox1.SelectedIndex = 0; detector = new MotionDetector(new TwoFramesDifferenceDetector(), new MotionBorderHighlighting()); detector_ks = 0; // Init value }
//#endregion SSVEP #endregion Declarations public MainWindow() { InitializeComponent(); _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; LoadUsers(); // Load the user Profiles #region Instantiate Timers emotivDataCollectionTimer.Interval = new TimeSpan(0, 0, 0, 0, 10); emotivDataCollectionTimer.Tick += emotivDataCollectionTimer_Tick; //SSVEPFlashDuration.Interval = new TimeSpan(0, 0, 0, 0, 125); //SSVEPFlashDuration.Tick += SSVEPFlashDuration_Tick; //SSVEPNoFlashDuration.Interval = new TimeSpan(0, 0, 0, 0, 475); //SSVEPNoFlashDuration.Tick += SSVEPNoFlashDuration_Tick; //SSVEPFlashingPeriod.Interval = new TimeSpan(0, 0, 0, 0, 8); //SSVEPFlashingPeriod.Tick += SSVEPFlashingPeriod_Tick; #endregion Instantiate Timers }
public CarCameraService(MjpegDecoder mjpegDecoder) { _mjpegDecoder = mjpegDecoder; }
public void StartDecoder(string roverIp) { _mjpegDecoder = new MjpegDecoder(); _mjpegDecoder.FrameReady += mjpeg_FrameReady; _mjpegDecoder.ParseStream(new Uri("http://" + roverIp + ":8080/?action=stream"), "", ""); }
public MediaPlayer_MJPEG() { _decoder = new MjpegDecoder(); }
public MainPage() { InitializeComponent(); _mjpeg = new MjpegDecoder(); _mjpeg.FrameReady += mjpeg_FrameReady; }
public Form1() { InitializeComponent(); mjpeg = new MjpegDecoder(); mjpeg.FrameReady += frameReady; }
private void InitMjpegDecoder() { mjpegDecoder = new MjpegDecoder(); mjpegDecoder.FrameReady += MjpegDecoder_FrameReady; mjpegDecoder.Error += MjpegDecoder_ErrorAsync; }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { using (Preferences p = new Preferences(Location, this)) { p.ShowDialog(); if (p.reset == true) { Location = Properties.Settings.Default.location; Size = Properties.Settings.Default.size; p.reload = true; } if (p.reload == true) { Setpos(); d1.StopStream(); d2.StopStream(); d3.StopStream(); d4.StopStream(); d5.StopStream(); d1 = null; d2 = null; d3 = null; d4 = null; d5 = null; Thread.Sleep(200); d1 = new MjpegDecoder(); d1.FrameReady += go1; try { d1.ParseStream(new Uri(Properties.Settings.Default.URILT)); } catch { } d2 = new MjpegDecoder(); d2.FrameReady += go2; try { d2.ParseStream(new Uri(Properties.Settings.Default.URIRT)); } catch { } d3 = new MjpegDecoder(); d3.FrameReady += go3; try { d3.ParseStream(new Uri(Properties.Settings.Default.URILM)); } catch { } d4 = new MjpegDecoder(); d4.FrameReady += go4; try { d4.ParseStream(new Uri(Properties.Settings.Default.URIRM)); } catch { } d5 = new MjpegDecoder(); d5.FrameReady += go5; try { d5.ParseStream(new Uri(Properties.Settings.Default.URIRB)); } catch { } RestartMQTT(); p.reload = false; } if (Properties.Settings.Default.Usecolor) { BackColor = Properties.Settings.Default.BGColor; mqttViewer1.BackColor = Properties.Settings.Default.BGColor; } else { BackColor = Color.FromArgb(184, 204, 232); mqttViewer1.BackColor = Color.FromArgb(184, 204, 232); } p.Close(); } }
// Second field is so that the stream connected from a popup is reused private void InitializeModule(Datum m, SshClient client = null) { // TODO: Replace debug writeline with proper error message if (socketMap.ContainsKey(m.ip)) { Debug.WriteLine("ERROR: Key already in dict"); return; } // Establish connection first string stream; try { if (client == null) { client = new SshClient(m.ip, username, password); client.ConnectionInfo.Timeout = TimeSpan.FromSeconds(5); client.Connect(); } stream = "http://" + m.ip + ":8080/?action=stream"; } catch (Exception z) { // TODO: Make this display somewhere failedConn.Add(m); return; } // WPF visual stuff SolidColorBrush darkGray = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF333333")); SolidColorBrush bordGray = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF000000")); SolidColorBrush foreGray = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFEEEEEE")); GroupBox newGroup = new GroupBox { BorderThickness = new Thickness(0.1), Foreground = Brushes.White, FontWeight = FontWeights.Bold }; StackPanel newStack = new StackPanel(); newGroup.Content = newStack; Border border = new Border { BorderBrush = bordGray, BorderThickness = new Thickness(0.1), CornerRadius = new CornerRadius(8), Margin = new Thickness(3), Background = darkGray }; // Grid nonsense Grid minigrid = new Grid(); ColumnDefinition c1 = new ColumnDefinition(); c1.Width = new GridLength(1, GridUnitType.Star); ColumnDefinition c2 = new ColumnDefinition(); c2.Width = GridLength.Auto; minigrid.ColumnDefinitions.Add(c1); minigrid.ColumnDefinitions.Add(c2); TextBlock roomNum = new TextBlock { FontSize = 14, Text = m.num, Margin = new Thickness(5), Background = darkGray, TextAlignment = TextAlignment.Center, Foreground = foreGray, FontWeight = FontWeights.Bold }; // Module options Menu menu = new Menu(); MenuItem options = new MenuItem { Header = " + ", FontSize = 14, Background = foreGray }; MenuItem move = new MenuItem { Header = "Move to" }; MenuItem delete = new MenuItem { Header = "Delete this module" }; MenuItem reposition = new MenuItem { Header = "Move module position" }; MenuItem editRoom = new MenuItem { Header = "Edit Room #" }; MenuItem editName = new MenuItem { Header = "Edit Name" }; menu.Items.Add(options); options.Items.Add(move); options.Items.Add(delete); options.Items.Add(reposition); options.Items.Add(editRoom); options.Items.Add(editName); minigrid.Children.Add(roomNum); minigrid.Children.Add(menu); roomNum.SetValue(Grid.ColumnProperty, 0); menu.SetValue(Grid.ColumnProperty, 1); Image imgtest = new Image { MaxWidth = 288, MinWidth = 288 }; TextBlock personName = new TextBlock { FontSize = 14, Text = m.name, Margin = new Thickness(1), Background = Brushes.Gray, TextAlignment = TextAlignment.Center }; TextBlock status = new TextBlock { FontSize = 14, Text = "Status: Normal", Margin = new Thickness(1), Background = Brushes.ForestGreen, TextAlignment = TextAlignment.Center }; Button testBtn = new Button { Content = "Reset", Background = Brushes.DarkGray, Foreground = Brushes.White, }; Button disableBtn = new Button { Content = "Disable Alarms", Background = Brushes.DarkGray, Foreground = Brushes.White, }; border.Child = minigrid; newStack.Children.Add(border); newStack.Children.Add(imgtest); newStack.Children.Add(personName); newStack.Children.Add(status); newStack.Children.Add(testBtn); newStack.Children.Add(disableBtn); // TODO: CHANGE THIS LATER WHEN DEALING WITH GROUPS // m.group blah blah groupMap[m.group].Children.Add(newGroup); //Default.Children.Add(newGroup); // Create new stream thread var mjpeg = new MjpegDecoder(); mjpeg.ParseStream(new Uri(stream)); // Repeated code is bad, but I couldnt figure out a way to store the lambda as a method or a variable // Essentially sets the image component to update every frame mjpeg.FrameReady += (o, ev) => { Dispatcher.BeginInvoke(new ThreadStart(delegate { imgtest.Source = ev.BitmapImage; })); }; MJPGMaps grp = new MJPGMaps { img = imgtest, ip = stream }; mjpegs.Add(mjpeg, grp); mjpeg.Error += _mjpg_Error; // Ensure there are no duplicate python script instances running (MIGHT BE UNNECESSARY/BAD) client.RunCommand("sudo killall python3"); // REPLACE SCRIPT.PY WITH NAME OF SCRIPT, MAKE SURE IT TAKES A COMMAND ARGUMENT // Runs in background var script = client.CreateCommand("python3 script.py " + myIPString); script.BeginExecute(); // Associate reset button with the following lambda function testBtn.Click += (o, ev) => { // Kill currently running stream if it exists mjpeg.StopStream(); client.RunCommand("sudo killall mjpg_streamer"); // Line below Directly start from mjpg_streamer; unnecessary for now //client.RunCommand("mjpg_streamer -i \"input_raspicam.so - x 1280 - y 720 - fps 30\" -o output_http.so"); // Start script in background var cmd = client.CreateCommand("bash startcam.sh"); cmd.BeginExecute(); mjpeg.ParseStream(new Uri(stream)); // Need to reset stream source as well mjpeg.FrameReady += (o, ev) => { Dispatcher.BeginInvoke(new ThreadStart(delegate { imgtest.Source = ev.BitmapImage; })); }; mjpeg.Error += _mjpg_Error; //client.RunCommand("sudo killall mjpg_streamer"); //client.RunCommand("./startcam.sh"); }; SocketStuff sck = new SocketStuff { txt = status, enabled = true }; Button message = new Button(); message.ToolTip = new ToolTip { Content = "Cannot remove this until alarms are enabled" }; message.Content = DateTime.UtcNow.ToString("MM-dd-yyyy"); message.Content += " " + DateTime.Now.ToString("t"); message.Content += (" ALARMS DISABLED AT: "); // BEHOLD CRINGE message.Content += roomNum.Text; message.Background = Brushes.Blue; // Disables alarm receiving and sends a message to pi disableBtn.Click += (o, ev) => { byte[] msg; lock (sck) { sck.enabled = !sck.enabled; if (sck.enabled) { sck.txt.Text = "Status: Normal"; sck.txt.Background = Brushes.ForestGreen; disableBtn.Content = "Disable Alarms"; try { msg = Encoding.ASCII.GetBytes("ENABLE<EOF>"); sck.testSck.Send(msg); } catch (Exception exp) { Debug.WriteLine("Socket doesn't exist yet..."); } // Add disabled message to log as a reminder if (messagelog.Children.Contains(message)) { messagelog.Children.Remove(message); } } else { sck.txt.Text = "ALARMS DISABLED"; sck.txt.Background = Brushes.Blue; disableBtn.Content = "Enable Alarms"; try { msg = Encoding.ASCII.GetBytes("DISABLE<EOF>"); sck.testSck.Send(msg); } catch (Exception exp) { Debug.WriteLine("Socket doesn't exist yet..."); } messagelog.Children.Add(message); } } }; // Now to add the target IP address to the map //Debug.WriteLine(popup.ipAddr); try { socketMap.Add(m.ip, sck); } catch (Exception e) { // this should never be a problem as the check happens fairly early Debug.WriteLine("Cant add same key twice"); } // Settings button implementation List <MenuItem> temp = new List <MenuItem>(); foreach (string grptmp in module.group) { MenuItem tmp = new MenuItem { Header = grptmp }; move.Items.Add(tmp); temp.Add(tmp); tmp.Click += (o, exv) => { WrapPanel oldwrp = groupMap[m.group]; WrapPanel newwrp = groupMap[grptmp]; oldwrp.Children.Remove(newGroup); newwrp.Children.Add(newGroup); m.group = grptmp; string testy = JsonConvert.SerializeObject(module, Newtonsoft.Json.Formatting.Indented); Debug.WriteLine(testy); File.WriteAllText("config.json", testy); }; } delete.Click += (o, v) => { groupMap[m.group].Children.Remove(newGroup); mjpegs.Remove(mjpeg); }; reposition.Click += (o, v) => { }; StackPanel editRoomPanel = new StackPanel { Orientation = Orientation.Horizontal }; TextBox editRoomText = new TextBox { Width = 100 }; Button editRoomBtn = new Button { Content = "Submit" }; editRoomPanel.Children.Add(editRoomText); editRoomPanel.Children.Add(editRoomBtn); editRoom.Items.Add(editRoomPanel); editRoomBtn.Click += (o, v) => { if (editRoomText.Text == "") { return; } roomNum.Text = editRoomText.Text; }; StackPanel editNamePanel = new StackPanel { Orientation = Orientation.Horizontal }; TextBox editNameText = new TextBox { Width = 100 }; Button editNameBtn = new Button { Content = "Submit" }; editNamePanel.Children.Add(editNameText); editNamePanel.Children.Add(editNameBtn); editName.Items.Add(editNamePanel); editNameBtn.Click += (o, v) => { if (editNameText.Text == "") { return; } personName.Text = editNameText.Text; }; }
private void playSharedScreen() { _mjpeg = new MjpegDecoder(); _mjpeg.ParseStream(new Uri(URLTextBox.Text)); _mjpeg.FrameReady += mjpeg_FrameReady; }