Ejemplo n.º 1
0
 protected override IEnumerator ExecuteStep()
 {
     Debug.Log("Stopping recording!");
     RecordingLord.StopRecording();
     Router.FireEvent(EndEventName);
     yield return(null);
 }
Ejemplo n.º 2
0
        private void HandleStepStateChanged(Step step, TimelineState state)
        {
            // If playing, check if we're done.

            if (!RegisteredSteps.Any(s => s.IsBusy))
            {
                State = TimelineState.Stopped;

                RecordingLord.StopRecording();

                Camera.main.orthographic = false;

                if (HaxxisGlobalSettings.Instance.IsVgsJob == true)
                {
                    if (TimelineViewBehaviour.Instance.NumRecordingsStartedThisPlayback == 0)
                    {
                        HaxxisGlobalSettings.Instance.ReportVgsError(6, "Choreography had no recording step");
                    }
                }

                if (HaxxisGlobalSettings.Instance.IsVgsJob == true)
                {
                    HaxxisGlobalSettings.Instance.ReportVgsVideoDuration();
                }
            }


            // Check for seek arrival

            if (IsSeeking)
            {
                if (step == SeekTarget)
                {
                    // Hmm I thought something like this was going to be needed...?
                    //if ( state == TimelineState.Playing )

                    IsSeeking = false;

                    if (SeekThrough)
                    {
                        SetNormalSpeed();
                    }
                    else
                    {
                        Pause();
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void Cancel()
        {
            foreach (var step in RegisteredSteps)
            {
                step.Cancel();
            }


            SetNormalSpeed();


            RecordingLord.StopRecording();


            State = TimelineState.Stopped;
        }
Ejemplo n.º 4
0
        public bool Execute()
        {
            var videoCodecSet = false;

            //var videoCodecIndex = -1;

            if (SetVideoCodecOption.IsPresent)
            {
                var name = (string)SetVideoCodecOption.Arguments[0].Value;
                if (RecordingLord.CheckCodec(name))
                {
                    videoCodecSet        = true;
                    RecordingLord.Vcodec = name;
                }

                else
                {
                    Debug.Log("Error:  No match found for video codec \"" + name + "\"");
                    return(false);
                }
            }

            if (SetVideoCodecFromCmdLineArgOption.IsPresent)
            {
                var videoCodecString = CommandLineArgs.GetArgumentValue((string)SetVideoCodecFromCmdLineArgOption.Arguments[0].Value);

                if (string.IsNullOrEmpty(videoCodecString))
                {
                    // Commenting this out to help avoid confusion
                    //Debug.Log("Error:  Cannot set video codec because that command line argument was not found or had no value");
                    return(true);    // Don't report this as an error
                }

                if (RecordingLord.CheckCodec(videoCodecString))
                {
                    videoCodecSet        = true;
                    RecordingLord.Vcodec = videoCodecString;
                }
                else
                {
                    Debug.Log("Error:  No match found for video codec \"" + videoCodecString + "\"");
                    return(false);
                }
            }

            if (videoCodecSet)
            {
                Debug.Log("Video codec index set to " + RecordingLord.Vcodec);
            }

            var frameRateSet = false;
            var frameRate    = 30;

            if (FrameRateOption.IsPresent)
            {
                frameRate    = (int)FrameRateOption.Arguments[0].Value;
                frameRateSet = true;
            }

            if (FrameRateFromCmdLineArgOption.IsPresent)
            {
                var frameRateString = CommandLineArgs.GetArgumentValue((string)FrameRateFromCmdLineArgOption.Arguments[0].Value);

                if (string.IsNullOrEmpty(frameRateString))
                {
                    //Debug.Log("Error:  Cannot set frame rate because that command line argument was not found or had no value");
                    return(false);
                }

                object value = null;
                if (!frameRateString.StringToValueOfType(typeof(int), ref value, true))
                {
                    return(false);
                }

                frameRate    = (int)value;
                frameRateSet = true;
            }

            if (frameRateSet)
            {
                RecordingLord.FrameRate = frameRate;
                Debug.Log("Movie frame rate set to " + RecordingLord.FrameRate);
            }

            var jqualitySet = false;
            var jquality    = 100;

            if (JpegQualityOption.IsPresent)
            {
                jquality    = (int)JpegQualityOption.Arguments[0].Value;
                jqualitySet = true;
            }

            if (JpegQualityFromCmdLineArgOption.IsPresent)
            {
                var jqualityString = CommandLineArgs.GetArgumentValue((string)JpegQualityFromCmdLineArgOption.Arguments[0].Value);

                if (string.IsNullOrEmpty(jqualityString))
                {
                    //Debug.Log("Error:  Cannot set frame rate because that command line argument was not found or had no value");
                    return(false);
                }

                object value = null;
                if (!jqualityString.StringToValueOfType(typeof(int), ref value, true))
                {
                    return(false);
                }

                jquality    = (int)value;
                jqualitySet = true;
            }

            if (jqualitySet)
            {
                RecordingLord.JpegQuality = jquality;
                Debug.Log("Movie JPEG quality set to " + RecordingLord.JpegQuality);
            }

            if (StartOption.IsPresent)
            {
                if (!RecordingLord.IsRecording())
                {
                    // We start recording in a job, which happens as a coroutine.  This fixes (11/10/2015) an issue where videos
                    // were black for several seconds at the beginning, which I think was related to choreography-triggered
                    // video recording that were also being started in jobs.

                    var filename = (string)StartOption.Arguments[0].Value;
                    JobManager.Instance.StartJob(StartRecordingMovie(filename), jobName: "RecordMovieFromDevCmd");
                }
                else
                {
                    Debug.Log("Error:  Movie already being captured");
                    return(false);
                }
            }

            if (StopOption.IsPresent)
            {
                if (RecordingLord.IsRecording())
                {
                    RecordingLord.StopRecording();
                    Debug.Log("Frames captured: " + RecordingLord.FrameTotal + "; total duration " + RecordingLord.Duration + " seconds");
                }
                else
                {
                    Debug.Log("Error:  No movie being captured");
                    return(false);
                }
            }

            if (PauseOption.IsPresent)
            {
                if (!RecordingLord.IsRecording())
                {
                    Debug.Log("Error:  No movie being captured");
                    return(false);
                }
                if (RecordingLord.IsPaused())
                {
                    Debug.Log("Warning:  Pause request made but movie recording is already paused");
                    return(true);
                }
                RecordingLord.PauseRecording();
                Debug.Log("Movie recording paused; duration so far is " + RecordingLord.Duration + " seconds");
            }

            if (ResumeOption.IsPresent)
            {
                if (!RecordingLord.IsRecording())
                {
                    Debug.Log("Error:  No movie being captured");
                    return(false);
                }
                if (!RecordingLord.IsPaused())
                {
                    Debug.Log("Warning:  Resume request made but movie recording is not paused");
                    return(true);
                }
                RecordingLord.ResumeRecording();
                Debug.Log("Movie recording resumed");
            }

            return(true);
        }