예제 #1
0
        public string StartRecordingVideoFile(string PreferredFileName)
        {
            if (cameraState == VideoCameraState.videoCameraRunning)
            {
                double fps = 25;

                switch (FrameRate)
                {
                case VideoCameraFrameRate.PAL:
                    fps = 25.0;
                    break;

                case VideoCameraFrameRate.NTSC:
                    fps = 29.97;
                    break;

                case VideoCameraFrameRate.Variable:
                    throw new DriverException("The driver simulator can only save video files for simulated analogue video cameras.");

                default:
                    throw new DriverException("Cannot determine FPS rate for video.");
                }

                bitmapPlayer.StartRecording(PreferredFileName, fps, false);

                cameraState = VideoCameraState.videoCameraRecording;

                return(PreferredFileName);
            }
            else
            {
                throw new ASCOM.InvalidOperationException();
            }
        }
        public void EnsureDisconnected()
        {
            dsCapture.Pause();

            dsCapture.CloseResources();

            cameraState = VideoCameraState.videoCameraIdle;
        }
예제 #3
0
        public void StopRecordingVideoFile()
        {
            if (cameraState == VideoCameraState.videoCameraRecording)
            {
                bitmapPlayer.StopRecording();

                cameraState = VideoCameraState.videoCameraRunning;
            }
        }
        public string StartRecordingVideoFile(string preferredFileName)
        {
            if (dsCapture.IsRunning)
            {
                dsCapture.CloseResources();
            }

            dsCapture.SetupFileRecorderGraph(videoInputDevice, videoCompressor, new VideoFormatHelper.SupportedVideoFormat(settings.SelectedVideoFormat), ref frameRate, ref imageWidth, ref imageHeight, preferredFileName);

            dsCapture.Start();

            cameraState = dsCapture.IsRunning ? VideoCameraState.videoCameraRecording : VideoCameraState.videoCameraIdle;

            return(preferredFileName);
        }
        public void EnsureConnected()
        {
            if (!IsConnected)
            {
                dsCapture.CloseResources();

                // TODO: Set a preferred frameRate and image size stored in the configuration

                dsCapture.SetupPreviewOnlyGraph(videoInputDevice, new VideoFormatHelper.SupportedVideoFormat(settings.SelectedVideoFormat), ref frameRate, ref imageWidth, ref imageHeight);

                dsCapture.Start();

                cameraState = dsCapture.IsRunning ? VideoCameraState.videoCameraRunning : VideoCameraState.videoCameraIdle;
            }
        }
예제 #6
0
        public void EnsureDisconnected()
        {
            if (cameraState == VideoCameraState.videoCameraRecording)
            {
                StopRecordingVideoFile();
            }

            if (bitmapPlayer != null)
            {
                cameraState = VideoCameraState.videoCameraError;

                bitmapPlayer.Stop();
            }

            alteredPixels = null;
            bitmapPlayer  = null;
            isConnected   = false;
        }
예제 #7
0
        ///	<exception cref="T:ASCOM.NotConnectedException">Must throw exception if not connected.</exception>
        ///	<exception cref="T:ASCOM.InvalidOperationException">Must throw exception if the current camera state doesn't allow to stop recording the file or no file is currently being recorded.</exception>
        ///	<exception cref="T:ASCOM.DriverException">Must throw exception if there is any other problem as result of which the recording cannot stop.</exception>
        public void StopRecordingVideoFile()
        {
            AssertConnected();

            try
            {
                VideoCameraState currentState = camera.GetCurrentCameraState();

                if (currentState != VideoCameraState.videoCameraRecording)
                {
                    throw new InvalidOperationException("The camera is currently not recording.");
                }

                camera.StopRecordingVideoFile();
            }
            catch (Exception ex)
            {
                throw new DriverException("Error stopping the recording. " + ex.Message, ex);
            }
        }
예제 #8
0
        ///	<exception cref="T:ASCOM.NotConnectedException">Must throw exception if not connected.</exception>
        ///	<exception cref="T:ASCOM.InvalidOperationException">Must throw exception if the current camera state doesn't allow to begin recording a file.</exception>
        ///	<exception cref="T:ASCOM.DriverException">Must throw exception if there is any other problem as a result of which the recording cannot begin.</exception>
        public string StartRecordingVideoFile(string PreferredFileName)
        {
            AssertConnected();

            try
            {
                VideoCameraState currentState = camera.GetCurrentCameraState();

                if (currentState == VideoCameraState.videoCameraRecording)
                {
                    throw new InvalidOperationException("The camera is already recording.");
                }
                else if (currentState != VideoCameraState.videoCameraRunning)
                {
                    throw new InvalidOperationException("The current state of the video camera doesn't allow a recording operation to begin right now.");
                }

                if (Settings.Default.UseBuffering)
                {
                    throw new DriverException("The IVideo Simulator only supports recording in a non-buffering mode.");
                }

                string directory = Path.GetDirectoryName(PreferredFileName);

                if (!Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }

                if (File.Exists(PreferredFileName))
                {
                    throw new DriverException(string.Format("File '{0}' already exists. Video can be recorded only in a non existing file.", PreferredFileName));
                }

                return(camera.StartRecordingVideoFile(PreferredFileName));
            }
            catch (Exception ex)
            {
                throw new DriverException("Error starting the recording. " + ex.Message, ex);
            }
        }
예제 #9
0
        public void EnsureConnected()
        {
            if (bitmapPlayer == null)
            {
                bitmapPlayer = new BitmapVideoPlayer(
                    aviTools,
                    Settings.Default.UseEmbeddedVideoSource,
                    Settings.Default.SourceBitmapFilesLocation,
                    useBuffering ? bufferSize : 0);
            }

            alteredPixels = new int[bitmapPlayer.Height, bitmapPlayer.Width];

            SetBitmapPlayerFrameRate();

            bitmapPlayer.Start();

            isConnected = true;

            cameraState = VideoCameraState.videoCameraRunning;
        }
		public void EnsureDisconnected()
		{
			dsCapture.Pause();

			dsCapture.CloseResources();

			cameraState = VideoCameraState.videoCameraIdle;
		}
예제 #11
0
        public void EnsureConnected()
        {
            if (!IsConnected)
            {
                dsCapture.CloseResources();

                // TODO: Set a preferred frameRate and image size stored in the configuration

                dsCapture.SetupGraph(videoInputDevice, Settings.Default.AavOcrEnabled, new VideoFormatHelper.SupportedVideoFormat(Settings.Default.SelectedVideoFormat), ref frameRate, ref imageWidth, ref imageHeight);

                dsCapture.Start();

                cameraState = VideoCameraState.videoCameraRunning;
            }
        }
		public void EnsureConnected()
		{
			if (!IsConnected)
			{
				dsCapture.CloseResources();

				// TODO: Set a preferred frameRate and image size stored in the configuration

				dsCapture.SetupPreviewOnlyGraph(videoInputDevice, ref frameRate, ref imageWidth, ref imageHeight);

				dsCapture.Start();

				cameraState = dsCapture.IsRunning ? VideoCameraState.videoCameraRunning : VideoCameraState.videoCameraIdle;
			}
		}
		public string StartRecordingVideoFile(string preferredFileName)
		{
			if (dsCapture.IsRunning)
				dsCapture.CloseResources();

			dsCapture.SetupFileRecorderGraph(videoInputDevice, videoCompressor, ref frameRate, ref imageWidth, ref imageHeight, preferredFileName);

			dsCapture.Start();

			cameraState = dsCapture.IsRunning ? VideoCameraState.videoCameraRecording : VideoCameraState.videoCameraIdle;

			return preferredFileName;
		}
예제 #14
0
파일: Video.cs 프로젝트: hpavlov/occurec
        private string StartRecordingOcrTestFile(string preferredFileName)
        {
            if (fullAAVSimulation)
            {
                if (cameraState == VideoCameraState.videoCameraRunning)
                {
                    string directory = Path.GetDirectoryName(preferredFileName);
                    string fileName = Path.GetFileName(preferredFileName);

                    if (!Directory.Exists(directory))
                        Directory.CreateDirectory(fileName);

                    if (File.Exists(preferredFileName))
                        throw new DriverException(string.Format("File '{0}' already exists. Video can be recorded only in a non existing file.", preferredFileName));

                    NativeHelpers.StartOcrTestRecording(preferredFileName);
                    cameraState = VideoCameraState.videoCameraRecording;

                    return preferredFileName;
                }
                else
                    throw new DriverException("Camera not running.");
            }
            else
                throw new NotSupportedException();
        }
예제 #15
0
파일: Video.cs 프로젝트: hpavlov/occurec
        public void StopRecordingVideoFile()
        {
            if (fullAAVSimulation && cameraState == VideoCameraState.videoCameraRecording)
            {
                NativeHelpers.StopRecordingVideoFile();

                cameraState = VideoCameraState.videoCameraRunning;
            }
        }
예제 #16
0
파일: Video.cs 프로젝트: hpavlov/occurec
        public void StopRecordingVideoFile()
        {
            if (m_CameraState == VideoCameraState.videoCameraRecording)
            {
                lock (m_SyncLock)
                {
                    if (m_Recorder != null)
                    {
                        m_Recorder.FinishRecording();
                        m_Recorder = null;
                    }
                }

                m_CameraState = VideoCameraState.videoCameraRunning;
            }
        }
예제 #17
0
파일: Video.cs 프로젝트: hpavlov/occurec
        public string StartRecordingVideoFile(string preferredFileName)
        {
            if (m_CameraState == VideoCameraState.videoCameraRunning)
            {
                m_CameraState = VideoCameraState.videoCameraRecording;
                m_PreferredFileName = Path.ChangeExtension(preferredFileName, ".adv");
                return m_PreferredFileName;
            }

            return null;
        }
예제 #18
0
        public string StartRecordingVideoFile(string preferredFileName)
        {
            if (dsCapture.IsRunning)
            {
                if (Path.GetExtension(preferredFileName) != ".aav")
                    preferredFileName = Path.ChangeExtension(preferredFileName, ".aav");

                NativeHelpers.StartRecordingVideoFile(preferredFileName);

                cameraState = VideoCameraState.videoCameraRecording;

                return preferredFileName;
            }

            throw new InvalidOperationException();
        }