Esempio n. 1
0
        public void MoveStartUp()
        {
            if (this.CurrentOnvifDevice != null)
            {
                VideoGrabberBaseWrapper vg = this.CurrentDevice;

                if (vg.OnvifDevice != null)
                {
                    if (!string.IsNullOrEmpty(vg.VideoSettings.PresetStartupPosition))
                    {
                        vg.OnvifDevice.GoToPreset(vg.VideoSettings.PresetStartupPosition);
                    }
                    else
                    {
                        vg.OnvifDevice.AbsoluteMove(0, 0);
                    }
                }
            }
        }
Esempio n. 2
0
        private bool ConfigureVideoMixer(Config config)
        {
            this.CurrentOnvifIndex = -1;
            int camara = 0;

            foreach (VideoSetting setting in config.VideoSettings)
            {
                if (setting.IsValid())
                {
                    VideoGrabberBaseWrapper vg = new VideoGrabberBaseWrapper();

                    vg.Name           = string.Format("Camara_{0}", camara);
                    vg.CriticalError += videoGrabberSourceMixer_CriticalError;

                    bool isValid = vg.ConfigureVideoGrabberToVideo(setting);

                    if (isValid)
                    {
                        if (setting.VideoSource == Kenos.Win.VideoSources.IpCamera)
                        {
                            this.CurrentOnvifIndex = camara;
                            if (vg.OnvifDevice.IsPTZSupported)
                            {
                                this.OnvifPTZDevices.Add(camara);
                            }
                        }
                    }

                    if (!isValid)
                    {
                        MixerDestroy();
                        return(false);
                    }

                    _mixerSources.Add(vg);

                    camara++;
                }
            }

            this.VideoSource = VidGrab.TVideoSource.vs_Mixer;
            //this.UseNearestVideoSize(1280, 720, false);

            int cols       = 1;
            int rows       = 1;
            int mixerCount = config.VideoSourceCount <= 0 ? _mixerSources.Count : config.VideoSourceCount;

            if (mixerCount >= 2)
            {
                cols = 2;
            }
            if (mixerCount >= 3)
            {
                cols = 2;
                rows = 2;
            }
            if (mixerCount >= 5)
            {
                cols = 2;
                rows = 2;
            }
            if (mixerCount >= 6)
            {
                cols = 3;
                rows = 2;
            }


            this.Mixer_MosaicLines   = rows;
            this.Mixer_MosaicColumns = cols;

            int idx = 0;

            for (int row = 0; row < rows; row++)
            {
                for (int col = 0; col < cols; col++)
                {
                    idx = (row * cols) + col;

                    if (_mixerSources.Count > idx)
                    {
                        VidGrab.VideoGrabber vg = _mixerSources[idx];

                        this.Mixer_AddToMixer(vg.UniqueID, 0, row + 1, col + 1, 0, 0, true, true);
                    }
                }
            }

            /*
             * double w = 680;
             * double h = 480/2;
             *
             * this.AspectRatioToUse = w/h;
             * this.ASFVideoWidth =(int)(w);
             * this.ASFVideoHeight = (int)h;
             */
            return(true);
        }