private void ResumeCapture()
	{
		if (_movieCapture != null)
		{
			_movieCapture.ResumeCapture();
		}
	}
示例#2
0
 private void ResumeCapture()
 {
     _movieCapture.ResumeCapture();
 }
    private void DrawControlButtonsGUI()
    {
        EditorGUILayout.BeginHorizontal();
        if (_capture == null)
        {
            GUI.backgroundColor = Color.green;
            if (GUILayout.Button("Start Capture"))
            {
                bool isReady = true;
                if (_sourceType == SourceType.Camera && _cameraNode == null)
                {
                    Debug.LogError("[AVProMovieCapture] Please select a Camera to capture from, or select to capture from Scene.");
                    isReady = false;
                }

                if (isReady)
                {
                    if (!Application.isPlaying)
                    {
                        EditorApplication.isPlaying = true;
                        _queueStart = true;
                    }
                    else
                    {
                        StartCapture();
                        Repaint();
                    }
                }
            }
        }
        else
        {
            GUI.backgroundColor = Color.red;
            if (GUILayout.Button("Stop Capture"))
            {
                StopCapture();
                Repaint();
            }
        }

        EditorGUI.BeginDisabledGroup(_capture == null);
        if (_capture != null && _capture.IsPaused())
        {
            GUI.backgroundColor = Color.green;
            if (GUILayout.Button("Resume Capture"))
            {
                _capture.ResumeCapture();
                Repaint();
            }
        }
        else
        {
            GUI.backgroundColor = Color.yellow;
            if (GUILayout.Button("Pause Capture"))
            {
                _capture.PauseCapture();
                Repaint();
            }
        }
        EditorGUI.EndDisabledGroup();

        EditorGUILayout.EndHorizontal();

        GUI.backgroundColor = Color.white;
    }
示例#4
0
    void MyWindow(int id)
    {
        GUILayout.BeginVertical();

        if (_movieCapture != null)
        {
            GUILayout.Label("Resolution:");
            GUILayout.BeginHorizontal();
            _downScaleIndex = GUILayout.SelectionGrid(_downScaleIndex, _downScales, _downScales.Length);
            switch (_downScaleIndex)
            {
            case 0:
                _movieCapture._downScale = AVProMovieCaptureBase.DownScale.Original;
                break;

            case 1:
                _movieCapture._downScale = AVProMovieCaptureBase.DownScale.Half;
                break;

            case 2:
                _movieCapture._downScale = AVProMovieCaptureBase.DownScale.Quarter;
                break;

            case 3:
                _movieCapture._downScale = AVProMovieCaptureBase.DownScale.Eighth;
                break;

            case 4:
                _movieCapture._downScale = AVProMovieCaptureBase.DownScale.Sixteenth;
                break;

            case 5:
                _movieCapture._downScale = AVProMovieCaptureBase.DownScale.Specific;
                break;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.Width(256));
            if (_movieCapture._downScale == AVProMovieCaptureBase.DownScale.Specific)
            {
                string maxWidthString = GUILayout.TextField(Mathf.FloorToInt(_movieCapture._maxVideoSize.x).ToString(), 4);
                int    maxWidth       = 0;
                if (int.TryParse(maxWidthString, out maxWidth))
                {
                    _movieCapture._maxVideoSize.x = Mathf.Clamp(maxWidth, 0, 4096);
                }

                GUILayout.Label("x", GUILayout.Width(20));

                string maxHeightString = GUILayout.TextField(Mathf.FloorToInt(_movieCapture._maxVideoSize.y).ToString(), 4);
                int    maxHeight       = 0;
                if (int.TryParse(maxHeightString, out maxHeight))
                {
                    _movieCapture._maxVideoSize.y = Mathf.Clamp(maxHeight, 0, 4096);
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Frame Rate:");
            _frameRateIndex = GUILayout.SelectionGrid(_frameRateIndex, _frameRates, _frameRates.Length);
            switch (_frameRateIndex)
            {
            case 0:
                _movieCapture._frameRate = AVProMovieCaptureBase.FrameRate.Fifteen;
                break;

            case 1:
                _movieCapture._frameRate = AVProMovieCaptureBase.FrameRate.TwentyFour;
                break;

            case 2:
                _movieCapture._frameRate = AVProMovieCaptureBase.FrameRate.TwentyFive;
                break;

            case 3:
                _movieCapture._frameRate = AVProMovieCaptureBase.FrameRate.Thirty;
                break;

            case 4:
                _movieCapture._frameRate = AVProMovieCaptureBase.FrameRate.Fifty;
                break;

            case 5:
                _movieCapture._frameRate = AVProMovieCaptureBase.FrameRate.Sixty;
                break;
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(16f);

            _movieCapture._isRealTime = GUILayout.Toggle(_movieCapture._isRealTime, "RealTime");

            GUILayout.Space(16f);



            // Video Codec
            GUILayout.BeginHorizontal();
            if (_shownSection != 0)
            {
                if (GUILayout.Button("+", GUILayout.Width(24)))
                {
                    _shownSection = 0;
                }
            }
            else
            {
                if (GUILayout.Button("-", GUILayout.Width(24)))
                {
                    _shownSection = -1;
                }
            }
            GUILayout.Label("Using Video Codec: " + _movieCapture._codecName);
            if (_movieCapture._codecIndex >= 0 && _videoCodecConfigurable[_movieCapture._codecIndex])
            {
                GUILayout.Space(16f);
                if (GUILayout.Button("Configure Codec"))
                {
                    AVProMovieCapturePlugin.ConfigureVideoCodec(_movieCapture._codecIndex);
                }
            }
            GUILayout.EndHorizontal();

            if (_videoCodecNames != null && _shownSection == 0)
            {
                GUILayout.Label("Select Video Codec:");
                _videoPos = GUILayout.BeginScrollView(_videoPos, GUILayout.Height(100));
                int newCodecIndex = GUILayout.SelectionGrid(-1, _videoCodecNames, 1) - 1;
                GUILayout.EndScrollView();

                if (newCodecIndex >= -1)
                {
                    _movieCapture._codecIndex = newCodecIndex;
                    if (_movieCapture._codecIndex >= 0)
                    {
                        _movieCapture._codecName = _videoCodecNames[_movieCapture._codecIndex + 1];
                    }
                    else
                    {
                        _movieCapture._codecName = "Uncompressed";
                    }

                    _shownSection = -1;
                }

                GUILayout.Space(16f);
            }


            _movieCapture._noAudio = !GUILayout.Toggle(!_movieCapture._noAudio, "Record Audio");
            GUI.enabled            = !_movieCapture._noAudio;

            // Audio Device
            GUILayout.BeginHorizontal();
            if (_shownSection != 1)
            {
                if (GUILayout.Button("+", GUILayout.Width(24)))
                {
                    _shownSection = 1;
                }
            }
            else
            {
                if (GUILayout.Button("-", GUILayout.Width(24)))
                {
                    _shownSection = -1;
                }
            }
            GUILayout.Label("Using Audio Source: " + _movieCapture._audioDeviceName);
            GUILayout.EndHorizontal();
            if (_audioDeviceNames != null && _shownSection == 1)
            {
                GUILayout.Label("Select Audio Source:");
                _audioPos = GUILayout.BeginScrollView(_audioPos, GUILayout.Height(100));
                int newAudioIndex = GUILayout.SelectionGrid(-1, _audioDeviceNames, 1) - 1;
                GUILayout.EndScrollView();

                if (newAudioIndex >= -1)
                {
                    _movieCapture._audioDeviceIndex = newAudioIndex;
                    if (_movieCapture._audioDeviceIndex >= 0)
                    {
                        _movieCapture._audioDeviceName = _audioDeviceNames[_movieCapture._audioDeviceIndex + 1];
                    }
                    else
                    {
                        _movieCapture._audioDeviceName = "Unity";
                    }

                    _shownSection = -1;
                }

                GUILayout.Space(16f);
            }



            // Audio Codec
            GUILayout.BeginHorizontal();
            if (_shownSection != 2)
            {
                if (GUILayout.Button("+", GUILayout.Width(24)))
                {
                    _shownSection = 2;
                }
            }
            else
            {
                if (GUILayout.Button("-", GUILayout.Width(24)))
                {
                    _shownSection = -1;
                }
            }
            GUILayout.Label("Using Audio Codec: " + _movieCapture._audioCodecName);
            if (_movieCapture._audioCodecIndex >= 0 && _audioCodecConfigurable[_movieCapture._audioCodecIndex])
            {
                GUILayout.Space(16f);
                if (GUILayout.Button("Configure Codec"))
                {
                    AVProMovieCapturePlugin.ConfigureAudioCodec(_movieCapture._audioCodecIndex);
                }
            }
            GUILayout.EndHorizontal();

            if (_audioCodecNames != null && _shownSection == 2)
            {
                GUILayout.Label("Select Audio Codec:");
                _audioCodecPos = GUILayout.BeginScrollView(_audioCodecPos, GUILayout.Height(100));
                int newCodecIndex = GUILayout.SelectionGrid(-1, _audioCodecNames, 1) - 1;
                GUILayout.EndScrollView();

                if (newCodecIndex >= -1)
                {
                    _movieCapture._audioCodecIndex = newCodecIndex;
                    if (_movieCapture._audioCodecIndex >= 0)
                    {
                        _movieCapture._audioCodecName = _audioCodecNames[_movieCapture._audioCodecIndex + 1];
                    }
                    else
                    {
                        _movieCapture._audioCodecName = "Uncompressed";
                    }

                    _shownSection = -1;
                }

                GUILayout.Space(16f);
            }

            GUI.enabled = true;

            GUILayout.Space(16f);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Filename Prefix & Ext: ");
            _movieCapture._autoFilenamePrefix    = GUILayout.TextField(_movieCapture._autoFilenamePrefix, 64);
            _movieCapture._autoFilenameExtension = GUILayout.TextField(_movieCapture._autoFilenameExtension, 8);
            GUILayout.EndHorizontal();
            GUILayout.Space(16f);
            GUILayout.Space(16f);

            GUILayout.Label("(Press Esc or CTRL-F5 to stop capture)");

            GUILayout.BeginHorizontal();
            if (!_movieCapture.IsCapturing())
            {
                if (GUILayout.Button("Start Capture"))
                {
                    if (_whenRecordingAutoHideUI)
                    {
                        _showUI = false;
                    }
                    _movieCapture.StartCapture();
                }
            }
            else
            {
                if (!_movieCapture.IsPaused())
                {
                    if (GUILayout.Button("Pause Capture"))
                    {
                        _movieCapture.PauseCapture();
                    }
                }
                else
                {
                    if (GUILayout.Button("Resume Capture"))
                    {
                        _movieCapture.ResumeCapture();
                    }
                }

                if (GUILayout.Button("Stop Capture"))
                {
                    _movieCapture.StopCapture();
                }
            }
            GUILayout.EndHorizontal();

            if (_movieCapture.IsCapturing())
            {
                if (!string.IsNullOrEmpty(_movieCapture.LastFilePath))
                {
                    GUILayout.Label("Writing file: '" + System.IO.Path.GetFileName(_movieCapture.LastFilePath) + "'");
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(_movieCapture.LastFilePath))
                {
                    GUILayout.Label("Last file written: '" + System.IO.Path.GetFileName(_movieCapture.LastFilePath) + "'");
                }
            }
        }

        GUILayout.EndVertical();
    }