Ejemplo n.º 1
0
 private void DisconnectUSBCamera_Click(object sender, RoutedEventArgs e)
 {
     _videoViewer.Stop();
     _webCamera.Stop();
     _mediaConnector.Disconnect(_webCamera.VideoChannel, _imageProvider);
     _webCamera = null;
 }
Ejemplo n.º 2
0
 private void ConnectUSBCamera_Click(object sender, RoutedEventArgs e)
 {
     _webCamera = new WebCamera();
     _mediaConnector.Connect(_webCamera.VideoChannel, _imageProvider);
     _videoViewer.SetImageProvider(_imageProvider);
     _webCamera.Start();
     _videoViewer.Start();
 }
Ejemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();
            _videoViewer    = new VideoViewerWPF();
            _imageProvider  = new DrawingImageProvider();
            _mediaConnector = new MediaConnector();
            _webCamera      = new WebCamera();

            SetVideoViewer();
            UpdateUSBCameraList();
        }
Ejemplo n.º 4
0
        private void connectBtn_Click(object sender, EventArgs e)
        {
            _webCamera = new WebCamera();

            if (_webCamera != null)
            {
                _mediaConnector.Connect(_webCamera.VideoChannel, _imageProvider);
                _videoViewer.SetImageProvider(_imageProvider);
                _webCamera.Start();
                _videoViewer.Start();
            }
        }
Ejemplo n.º 5
0
        private void connectUsbCamera()
        {
            globalWebCamera = new WebCamera();

            if (globalWebCamera != null)
            {
                globalMediaConnector.Connect(globalWebCamera.VideoChannel, globalImageProvider);
                globalMediaConnector.Connect(globalWebCamera.VideoChannel, globalSnapshotHandler);
                videoViewer.SetImageProvider(globalImageProvider);
                globalWebCamera.Start();
                videoViewer.Start();
            }
        }
Ejemplo n.º 6
0
        public Worker(ILoggerFactory loggerFactory, DuetWifiStatusProvider statusProvider, StreamerSettings streamerSettings)
        {
            FFMpegSetup.Init(loggerFactory.CreateLogger <FFMpegSetup>());
            _logger = loggerFactory.CreateLogger <Worker>();
            _logger.LogInformation($"Starting with settings: {streamerSettings}");
            _statusProvider = statusProvider;
            if (streamerSettings.WebCamUrl != null)
            {
                _webCamera = new MJpegStreamWebCameraProvider(loggerFactory.CreateLogger <MJpegStreamWebCameraProvider>(), streamerSettings);
            }
            else if (streamerSettings.WebCamDevice != null)
            {
                _webCamera = new Video4LinuxWebCameraProvider(loggerFactory.CreateLogger <Video4LinuxWebCameraProvider>(), streamerSettings);
            }
            else
            {
                throw new ArgumentOutOfRangeException("Either webcamUrl or webcamDevice should be enabled");
            }

            _streamerSettings = streamerSettings;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// </summary>
        public MainViewModel()
        {
            var handsAnalyzer        = new HandsAnalyzer();
            var skiColorHandDetector = new SkinColorHandsDetector();

            var drone = new Tello();
            var droneControllerKeyInputEvaluator   = new TelloKeyInputEvaluator();
            var droneControllerHandsInputEvaluator = new DroneControllerHandsInputEvaluator();

            this.app = new CaduhdApp(handsAnalyzer,
                                     skiColorHandDetector,
                                     drone,
                                     droneControllerKeyInputEvaluator,
                                     droneControllerHandsInputEvaluator);

            this.app.Bind(this.UserInterfaceConnector);

            this.webCamera           = new WebCamera(320, 180);
            this.webCamera.NewFrame += this.ProcessWebCameraFrame;
            this.webCamera.On();
            this.keyEventProcessor = new KeyEventProcessor();
        }
Ejemplo n.º 8
0
        public video_chat_room(string myListening, string videop, string aup, string vclient_n, string vclient_ipadd, string client_videop, string client_aup, string camn, string audioinputn, string audiooutputn)
        {
            try
            {
                InitializeComponent();

                string[] splitmessage = myListening.Split(':');
                myListeningUrl         = splitmessage[0];
                videoport              = videop;
                auport                 = aup;
                vclient_name           = vclient_n;
                splitmessage           = vclient_ipadd.Split(':');
                vclient_ipaddress      = splitmessage[0];
                client_videoport       = client_videop;
                client_auport          = client_aup;
                camName                = camn;
                audioinputname         = audioinputn;
                audiooutputname        = audiooutputn;
                close_button.Enabled   = false;
                this.client_label.Text = vclient_name;

                //client
                vconnector      = new MediaConnector();
                mjpegConnection = new MJPEGConnection();
                vprovider       = new DrawingImageProvider();
                this.zoom       = new Zoom();

                videoViewer = new VideoViewerWF()
                {
                    Name      = "Video Preview",
                    Size      = new Size(300, 210),
                    Location  = new Point(20, 20),
                    BackColor = Color.Black
                };

                vvideoViewer = new VideoViewerWF()
                {
                    Name      = "Video Preview",
                    Size      = new Size(300, 210),
                    Location  = new Point(20, 20),
                    BackColor = Color.Black
                };



                connector = new MediaConnector();
                provider  = new DrawingImageProvider();
                videoViewer.SetImageProvider(provider);



                vvideoViewer.SetImageProvider(vprovider);

                groupBox1.Controls.Add(videoViewer);

                webCamera = null;

                foreach (var info in WebCameraFactory.GetDevices())
                {
                    if (info.Name == camName)
                    {
                        webCamera = WebCameraFactory.GetDevice(info);

                        break;
                    }
                }

                if (webCamera == null)
                {
                    MessageBox.Show("Couldn't connect to the camera");
                    return;
                }
                connector.Connect(webCamera.VideoChannel, provider);
                videoSender = webCamera.VideoChannel;

                webCamera.Start();
                videoViewer.Start();
                streamer = new MJPEGStreamer(myListeningUrl, int.Parse(videoport));


                if (!connector.Connect(videoSender, streamer.VideoChannel))
                {
                    MessageBox.Show("Failed to create connection..");
                }
                streamer.ClientConnected    += ClientConnected;
                streamer.ClientDisconnected += ClientDisconnected;

                streamer.Start();



                if (!this.vconnected)
                {
                    IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(this.myListeningUrl), int.Parse(this.auport));



                    this.selectedCodec = new AcmMuLawChatCodec();

                    this.ServerConnect(endPoint, int.Parse(audioinputn), selectedCodec);
                }
                else
                {
                    this.ServerDisconnect();
                }


                this.lblStatus.Text = "Server & camera started\n" + lblStatus.Text;
            }
            catch (Exception ex)
            {
                lblStatus.Text = ex.ToString() + "\n" + lblStatus.Text;
            }
        }