Ejemplo n.º 1
0
        public AudioConfig(VidGrab.VideoGrabber videoGrabber)
            : base(videoGrabber)
        {
            InitializeComponent();

            LoadConfig();
        }
Ejemplo n.º 2
0
        public bool Apply(VidGrab.VideoGrabber capture)
        {
            capture.AudioRecording       = true;
            capture.AudioDeviceRendering = this.AudioDeviceRendering;

            if (!Config.Current.OutputSetting.UseAudioFromCamera)
            {
                capture.AudioDevice = capture.FindIndexInListByName(capture.AudioDevices, this.AudioDevice, false, true);

                capture.AudioRenderer = capture.FindIndexInListByName(capture.AudioRenderers, this.AudioOutputDevice, false, true);
                capture.AudioInput    = capture.FindIndexInListByName(capture.AudioInputs, this.AudioDeviceLine, false, true);
                capture.AudioFormat   = (VidGrab.TAudioFormat)capture.FindIndexInListByName(capture.AudioFormats, this.AudioFormat, false, true);

                capture.AudioInputLevel = 65535; // Maximo valor

                capture.AudioSource = VidGrab.TAudioSource.as_UseExternalAudio;

                if (capture.AudioDevice < 0)
                {
                    string message = "No se encontró el dispositivo de grabación de audio";

                    Logger.Log.Info(message);

                    MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }
            else
            {
                capture.AudioSource = VidGrab.TAudioSource.as_Default;
            }

            return(true);
        }
Ejemplo n.º 3
0
        public bool Apply(VidGrab.VideoGrabber capture)
        {
            if (this.VideoSource == VideoSources.IpCamera)
            {
                if (string.IsNullOrEmpty(this.StreamUrl))
                {
                    string message = "No se puede iniciar la grabación porque no tiene configurado la URL de la camara IP.";
                    Logger.Log.Info(message);

                    MessageBox.Show(message, "Configuración", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    return(false);
                }

                capture.VideoSource = VidGrab.TVideoSource.vs_IPCamera;
                capture.IPCameraURL = this.StreamUrl;

                if (!string.IsNullOrEmpty(this.Username))
                {
                    capture.SetAuthentication(VidGrab.TAuthenticationType.at_IPCamera, this.Username, this.Password);
                }
            }
            else
            {
                capture.VideoSource = VidGrab.TVideoSource.vs_VideoCaptureDevice;

                if (string.IsNullOrEmpty(this.VideoDevice))
                {
                    string message = "No se puede iniciar la grabación porque no tiene configurado un dispositivo de grabación.";
                    Logger.Log.Info(message);

                    MessageBox.Show(message, "Configuración", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    return(false);
                }

                // Captura de audio y video
                capture.VideoDevice = capture.FindIndexInListByName(capture.VideoDevices, this.VideoDevice, false, true);

                if (capture.VideoDevice == -1)
                {
                    MessageBox.Show("No se puede iniciar la grabación porque no tiene configurado un dispositivo de grabación.", "Configuración", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    return(false);
                }

                capture.VideoSize    = capture.FindIndexInListByName(capture.VideoSizes, this.VideoSize, false, true);
                capture.VideoSubtype = capture.FindIndexInListByName(capture.VideoSubtypes, this.VideoFormatSubType, false, true);

                if (!string.IsNullOrEmpty(this.VideoNorma))
                {
                    capture.AnalogVideoStandard = capture.FindIndexInListByName(capture.AnalogVideoStandards, this.VideoNorma, false, true);
                }
            }

            return(true);
        }
Ejemplo n.º 4
0
        public frmConfiguracion(VidGrab.VideoGrabber videoGrabber)
            : this()
        {
            _capture    = videoGrabber;
            tabControls = new Control[] { pnlVideo, pnlAudio, pnlStreaming, pnlOutput };

            tabAudio.Tag     = pnlAudio;
            tabVideo.Tag     = pnlVideo;
            tabStreaming.Tag = pnlStreaming;
            tabOutput.Tag    = pnlOutput;

            // Video
            _videoConfig          = new ConfigControls.VideoConfig(videoGrabber);
            _videoConfig.TopLevel = false;
            _videoConfig.Parent   = pnlVideo;
            _videoConfig.Show();

            // Audio
            _audioConfig          = new ConfigControls.AudioConfig(videoGrabber);
            _audioConfig.TopLevel = false;
            _audioConfig.Parent   = pnlAudio;
            _audioConfig.Show();

            // Streaming
            _streamingConfig          = new ConfigControls.StreamingConfig(videoGrabber);
            _streamingConfig.TopLevel = false;
            _streamingConfig.Parent   = pnlStreaming;
            _streamingConfig.Show();

            // Output
            _outputConfig          = new ConfigControls.OutputConfig(videoGrabber);
            _outputConfig.TopLevel = false;
            _outputConfig.Parent   = pnlOutput;
            _outputConfig.Show();


            int x = pnlTabs.Location.X + 10;
            int y = pnlVideo.Location.Y;
            int w = pnlTabs.Width - 20;

            pnlVideo.Location = new System.Drawing.Point(x, y);
            pnlVideo.Width    = w;

            pnlAudio.Location = new System.Drawing.Point(x, y);
            pnlAudio.Width    = w;

            pnlStreaming.Location = new System.Drawing.Point(x, y);
            pnlStreaming.Width    = w;

            pnlOutput.Location = new System.Drawing.Point(x, y);
            pnlOutput.Width    = w;

            tab_Click(tabVideo, null);
        }
Ejemplo n.º 5
0
 public bool Apply(VidGrab.VideoGrabber capture, ExtraConfig extraConfig)
 {
     if (extraConfig.Video)
     {
         return(ConfigureToVideoOutput(capture, extraConfig));
     }
     else
     {
         return(ConfigureToAudioOutput(capture, extraConfig));
     }
 }
Ejemplo n.º 6
0
 private void btnDestroyComponent_Click(object sender, EventArgs e)
 {
     if (VideoGrabber != null)
     {
         VideoGrabber.Dispose();
         VideoGrabber = null;
     }
     else
     {
         MessageBox.Show("component not yet created");
     }
 }
Ejemplo n.º 7
0
        internal static bool ConfigureVideoCompressor(VidGrab.VideoGrabber capture, string compressor)
        {
            capture.VideoCompressor = capture.FindIndexInListByName(capture.VideoCompressors, compressor, false, true);

            if (capture.VideoCompressor == -1)
            {
                MessageBox.Show("No se encontro el compresor de video", "Video Encoder", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return(false);
            }

            return(true);
        }
Ejemplo n.º 8
0
        internal static bool ConfigureAudioCompressor(VidGrab.VideoGrabber capture, string compressor)
        {
            capture.AudioCompressor = capture.FindIndexInListByName(capture.AudioCompressors, compressor, false, true);

            if (capture.AudioCompressor == -1)
            {
                MessageBox.Show("Para grabar solo audio en formato MP3 se requiere \"LAME Audio Encoder\"", "Audio Encoder", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return(false);
            }

            return(true);
        }
Ejemplo n.º 9
0
            public override bool Apply(VidGrab.VideoGrabber capture, ExtraConfig extraConfig)
            {
                bool isValid       = true;
                bool audioCompress = false;
                bool videoCompress = false;
                var  output        = Config.Current.OutputSetting;

                capture.RecordingMethod = VidGrab.TRecordingMethod.rm_MP4;

                if (!output.Video.UseNativeFormat)
                {
                    videoCompress = true;
                    isValid       = OutputSetting.ConfigureVideoCompressor(capture, this.VideoCompressor);
                }

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

                if (output.Video.UseNativeFormat && !Config.Current.OutputSetting.UseAudioFromCamera)
                {
                    audioCompress = true;
                    isValid       = OutputSetting.ConfigureAudioCompressor(capture, this.AudioCompressor);
                }

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

                if (videoCompress && audioCompress)
                {
                    capture.CompressionType = VidGrab.TCompressionType.ct_AudioVideo;
                    capture.CompressionMode = VidGrab.TCompressionMode.cm_CompressOnTheFly;
                }
                else if (videoCompress)
                {
                    capture.CompressionType = VidGrab.TCompressionType.ct_Video;
                    capture.CompressionMode = VidGrab.TCompressionMode.cm_CompressOnTheFly;
                }
                else if (audioCompress)
                {
                    capture.CompressionType = VidGrab.TCompressionType.ct_Audio;
                    capture.CompressionMode = VidGrab.TCompressionMode.cm_CompressOnTheFly;
                }

                return(true);
            }
Ejemplo n.º 10
0
        public VideoConfig(VidGrab.VideoGrabber videoGrabber)
            : base(videoGrabber)
        {
            InitializeComponent();

            vgPreview.LicenseString = Properties.Settings.Default.DatasteadLicenseKey;
            vgPreview.LicenseString = Properties.Settings.Default.DatasteadLicenseKeyRTSP;

            pnlCamara.Location = pnlCamaraIp.Location;

            cboTipo.SelectedIndex = 0;
            chkHabilitada_CheckedChanged(null, null);

            LoadConfig();
        }
Ejemplo n.º 11
0
        private bool ConfigureToAudioOutput(VidGrab.VideoGrabber capture, ExtraConfig extraConfig)
        {
            Config config = Config.Current;

            // Captura de audio
            capture.VideoRenderer = VidGrab.TVideoRenderer.vr_None;

            capture.CompressionMode         = VidGrab.TCompressionMode.cm_CompressOnTheFly;
            capture.CompressionType         = VidGrab.TCompressionType.ct_Audio;
            capture.RecordingInNativeFormat = false;
            capture.RecordingMethod         = VidGrab.TRecordingMethod.rm_AVI;

            bool isValid = ConfigureAudioCompressor(capture, this.AudioCompressor);

            return(isValid);
        }
Ejemplo n.º 12
0
        public bool Apply(VidGrab.VideoGrabber capture)
        {
            capture.NetworkStreamingType = VidGrab.TNetworkStreamingType.nst_AudioVideoStreaming;

            if (this.Type == StreamingTypes.Audio)
            {
                capture.NetworkStreamingType = VidGrab.TNetworkStreamingType.nst_AudioStreaming;
            }
            if (this.Type == StreamingTypes.Video)
            {
                capture.NetworkStreamingType = VidGrab.TNetworkStreamingType.nst_VideoStreaming;
            }

            capture.ASFNetworkPort     = this.Port;
            capture.ASFNetworkMaxUsers = this.MaxUsers;

            return(true);
        }
Ejemplo n.º 13
0
        private void btnCreateComponent_Click(object sender, EventArgs e)
        {
            if (VideoGrabber == null)
            {
                VideoGrabber = new VidGrab.VideoGrabber();

                VideoGrabber.Parent = this;
                VideoGrabber.Left   = 10;
                VideoGrabber.Top    = 50;

                VideoGrabber.OnPreviewStarted += new System.EventHandler(this.OnPreviewStarted);
                VideoGrabber.OnInactive       += new System.EventHandler(this.OnInactive);
            }
            else
            {
                MessageBox.Show("already created");
            }
        }
Ejemplo n.º 14
0
        internal bool Apply(VidGrab.VideoGrabber capture, ExtraConfig extraConfig)
        {
            capture.VideoRenderer     = VidGrab.TVideoRenderer.vr_AutoSelect;
            capture.DVTimeCodeEnabled = false;
            capture.DVDateTimeEnabled = false;

            // TODO: Ver como hacer para agregar audio de entrada de linea utilizando esta opcion
            capture.RecordingInNativeFormat = this.UseNativeFormat;

            if (this.Format == "mp4")
            {
                return(this.Mp4.Apply(capture, extraConfig));
            }
            else
            {
                return(this.WMV.Apply(capture, extraConfig));
            }
        }
Ejemplo n.º 15
0
        private bool ConfigureToVideoOutput(VidGrab.VideoGrabber capture, ExtraConfig extraConfig)
        {
            this.Video.Apply(capture, extraConfig);

            // capture.ASFFixedFrameRate = true;
            capture.FrameGrabber = VidGrab.TFrameGrabber.fg_Disabled;

            if (Properties.Settings.Default.TextoVideoHabilitado)
            {
                int target = 0;

                capture.SetTextOverlay_TargetDisplay(target, -1);

                Font font = new Font(FontFamily.GenericSansSerif, Properties.Settings.Default.TextoVideoFontSize, FontStyle.Regular);

                capture.SetTextOverlay_Top(target, 0);
                capture.SetTextOverlay_Left(target, -1);
                capture.SetTextOverlay_Right(target, 0);
                capture.SetTextOverlay_Font(target, font.ToHfont());
                capture.SetTextOverlay_HighResFont(target, false);
                capture.SetTextOverlay_VideoAlignment(target, VidGrab.TVideoAlignment.oa_RightBottom);
                capture.SetTextOverlay_Shadow(target, false);
                capture.SetTextOverlay_Transparent(target, false);
                capture.SetTextOverlay_BkColor(target, ColorTranslator.ToWin32(Color.Black));
                capture.SetTextOverlay_FontColor(target, ColorTranslator.ToWin32(Color.White));
                capture.SetTextOverlay_String(target, string.Format(Properties.Settings.Default.TextoVideoTemplate, extraConfig.Etiqueta));

                capture.SetTextOverlay_Enabled(target, true);

                capture.FrameGrabber = VidGrab.TFrameGrabber.fg_CaptureStream;
            }
            else
            {
                capture.FrameGrabber = VidGrab.TFrameGrabber.fg_Disabled;
            }

            return(true);
        }
Ejemplo n.º 16
0
            public override bool Apply(VidGrab.VideoGrabber capture, ExtraConfig extraConfig)
            {
                capture.RecordingMethod = VidGrab.TRecordingMethod.rm_ASF;

                capture.FrameRate         = this.FramesRate;
                capture.ASFVideoFrameRate = this.FramesRate;
                capture.ASFVideoBitRate   = this.VideoBitRate;
                capture.ASFVideoQuality   = this.VideoQuality;

                if (Properties.Settings.Default.WmvProfileVersion == 8)
                {
                    capture.ASFProfileVersion = VidGrab.TASFProfileVersion.apv_ProfileVersion_8;
                }
                else
                {
                    capture.ASFProfileVersion = VidGrab.TASFProfileVersion.apv_ProfileVersion_9;
                }


                capture.CompressionType = VidGrab.TCompressionType.ct_AudioVideo;
                capture.CompressionMode = VidGrab.TCompressionMode.cm_CompressOnTheFly;

                return(true);
            }
Ejemplo n.º 17
0
        public StreamingConfig(VidGrab.VideoGrabber videoGrabber) : base(videoGrabber)
        {
            InitializeComponent();

            LoadConfig();
        }
Ejemplo n.º 18
0
 public ConfigFormBase(VidGrab.VideoGrabber videoGrabber) : this()
 {
     _capture = videoGrabber;
 }
Ejemplo n.º 19
0
 public abstract bool Apply(VidGrab.VideoGrabber capture, ExtraConfig extraConfig);