コード例 #1
0
        private void CreateGUI()
        {
            _outputType    = new string[3];
            _outputType[0] = "Video File";
            _outputType[1] = "Image Sequence";
            _outputType[2] = "Named Pipe";
            _downScales    = new string[6];
            _downScales[0] = "Original";
            _downScales[1] = "Half";
            _downScales[2] = "Quarter";
            _downScales[3] = "Eighth";
            _downScales[4] = "Sixteenth";
            _downScales[5] = "Custom";
            switch (_movieCapture._downScale)
            {
            default:
            case CaptureBase.DownScale.Original:
                _downScaleIndex = 0;
                break;

            case CaptureBase.DownScale.Half:
                _downScaleIndex = 1;
                break;

            case CaptureBase.DownScale.Quarter:
                _downScaleIndex = 2;
                break;

            case CaptureBase.DownScale.Eighth:
                _downScaleIndex = 3;
                break;

            case CaptureBase.DownScale.Sixteenth:
                _downScaleIndex = 4;
                break;

            case CaptureBase.DownScale.Custom:
                _downScaleIndex = 5;
                break;
            }

            _frameRates     = new string[11];
            _frameRates[0]  = "1";
            _frameRates[1]  = "10";
            _frameRates[2]  = "15";
            _frameRates[3]  = "24";
            _frameRates[4]  = "25";
            _frameRates[5]  = "30";
            _frameRates[6]  = "50";
            _frameRates[7]  = "60";
            _frameRates[8]  = "75";
            _frameRates[9]  = "90";
            _frameRates[10] = "120";
            switch (_movieCapture._frameRate)
            {
            default:
            case CaptureBase.FrameRate.One:
                _frameRateIndex = 0;
                break;

            case CaptureBase.FrameRate.Ten:
                _frameRateIndex = 1;
                break;

            case CaptureBase.FrameRate.Fifteen:
                _frameRateIndex = 2;
                break;

            case CaptureBase.FrameRate.TwentyFour:
                _frameRateIndex = 3;
                break;

            case CaptureBase.FrameRate.TwentyFive:
                _frameRateIndex = 4;
                break;

            case CaptureBase.FrameRate.Thirty:
                _frameRateIndex = 5;
                break;

            case CaptureBase.FrameRate.Fifty:
                _frameRateIndex = 6;
                break;

            case CaptureBase.FrameRate.Sixty:
                _frameRateIndex = 7;
                break;

            case CaptureBase.FrameRate.SeventyFive:
                _frameRateIndex = 8;
                break;

            case CaptureBase.FrameRate.Ninety:
                _frameRateIndex = 9;
                break;

            case CaptureBase.FrameRate.OneTwenty:
                _frameRateIndex = 10;
                break;
            }

            int numVideoCodecs = NativePlugin.GetNumAVIVideoCodecs();

            if (numVideoCodecs > 0)
            {
                _videoCodecNames        = new string[numVideoCodecs + 2];
                _videoCodecNames[0]     = "Uncompressed";
                _videoCodecNames[1]     = "Media Foundation H.264(MP4)";
                _videoCodecConfigurable = new bool[numVideoCodecs];
                for (int i = 0; i < numVideoCodecs; i++)
                {
                    _videoCodecNames[i + 2]    = NativePlugin.GetAVIVideoCodecName(i);
                    _videoCodecConfigurable[i] = NativePlugin.IsConfigureVideoCodecSupported(i);
                }
            }

            int numAudioDevices = NativePlugin.GetNumAVIAudioInputDevices();

            if (numAudioDevices > 0)
            {
                _audioDeviceNames    = new string[numAudioDevices + 1];
                _audioDeviceNames[0] = "Unity";
                for (int i = 0; i < numAudioDevices; i++)
                {
                    _audioDeviceNames[i + 1] = NativePlugin.GetAVIAudioInputDeviceName(i);
                }
            }

            int numAudioCodecs = NativePlugin.GetNumAVIAudioCodecs();

            if (numAudioCodecs > 0)
            {
                _audioCodecNames        = new string[numAudioCodecs + 1];
                _audioCodecNames[0]     = "Uncompressed";
                _audioCodecConfigurable = new bool[numAudioCodecs];
                for (int i = 0; i < numAudioCodecs; i++)
                {
                    _audioCodecNames[i + 1]    = NativePlugin.GetAVIAudioCodecName(i);
                    _audioCodecConfigurable[i] = NativePlugin.IsConfigureAudioCodecSupported(i);
                }
            }

            _movieCapture.SelectCodec(false);
            _movieCapture.SelectAudioCodec(false);
            _movieCapture.SelectAudioDevice(false);
        }