/// <summary> /// Initialize the attributes of the capture session and start capture. /// </summary> public override void StartCapture() { if (status != StatusType.NOT_START && status != StatusType.FINISH) { Debug.LogWarning("[VideoCaptureProCtrl::StartCapture] Previous capture not finish yet!"); return; } // Filter out disabled capture component. List <VideoCapturePro> validCaptures = new List <VideoCapturePro>(); if (validCaptures != null && videoCaptures.Length > 0) { foreach (VideoCapturePro videoCapture in videoCaptures) { if (videoCapture != null && videoCapture.gameObject.activeSelf) { validCaptures.Add(videoCapture); } } } videoCaptures = validCaptures.ToArray(); for (int i = 0; i < videoCaptures.Length; i++) { VideoCapturePro videoCapture = (VideoCapturePro)videoCaptures[i]; if (videoCapture == null || !videoCapture.gameObject.activeSelf) { continue; } videoCapture.StartCapture(); } status = StatusType.STARTED; }
/// <summary> /// Initial instance and init variable. /// </summary> protected override void Awake() { base.Awake(); // For easy access the CameraCaptures var. if (videoCaptures == null) { videoCaptures = new VideoCapturePro[0]; } // Create default root folder if not created. if (!Directory.Exists(PathConfig.SaveFolder)) { Directory.CreateDirectory(PathConfig.SaveFolder); } status = StatusType.NOT_START; }
public override void OnInspectorGUI() { VideoCapturePro videoCapture = (VideoCapturePro)target; videoCapture.mode = (VideoCapturePro.ModeType)EditorGUILayout.EnumPopup("Mode", videoCapture.mode); if (videoCapture.mode == VideoCapturePro.ModeType.LIVE_STREAMING) { videoCapture.streamingAddress = EditorGUILayout.TextField("Streaming Server Address", videoCapture.streamingAddress); } videoCapture.format = (VideoCapturePro.FormatType)EditorGUILayout.EnumPopup("Format", videoCapture.format); if (videoCapture.format == VideoCapturePro.FormatType.NORMAL) { if (videoCapture.isDedicated) { videoCapture.frameSize = (VideoCapturePro.FrameSizeType)EditorGUILayout.EnumPopup("Frame Size", videoCapture.frameSize); } videoCapture.stereoFormat = (VideoCapture.StereoType)EditorGUILayout.EnumPopup("Stereo Format", videoCapture.stereoFormat); if (videoCapture.stereoFormat != VideoCapture.StereoType.NONE) { videoCapture.interPupillaryDistance = EditorGUILayout.FloatField("Inter Pupillary Distance", videoCapture.interPupillaryDistance); videoCapture.stereoPackMaterial = (Material)EditorGUILayout.ObjectField("Stereoscopic Material", videoCapture.stereoPackMaterial, typeof(Material)); } } else if (videoCapture.format == VideoCapturePro.FormatType.PANORAMA) { videoCapture.sceneCamera = (Camera)EditorGUILayout.ObjectField("Capture Camera", videoCapture.sceneCamera, typeof(Camera)); videoCapture.panoramaProjection = (VideoCapturePro.PanoramaProjectionType)EditorGUILayout.EnumPopup("Projection Type", videoCapture.panoramaProjection); if (videoCapture.panoramaProjection == VideoCapturePro.PanoramaProjectionType.EQUIRECTANGULAR) { videoCapture.frameSize = (VideoCapturePro.FrameSizeType)EditorGUILayout.EnumPopup("Frame Size", videoCapture.frameSize); videoCapture.sphereOffset = EditorGUILayout.Vector2Field("Offset Spherical Coordinates", videoCapture.sphereOffset); videoCapture.sphereScale = EditorGUILayout.Vector2Field("Offset Spherical Coordinates", videoCapture.sphereScale); } videoCapture._cubemapSize = (VideoCapturePro.CubemapSizeType)EditorGUILayout.EnumPopup("Cubemap Size", videoCapture._cubemapSize); videoCapture.convertMaterial = (Material)EditorGUILayout.ObjectField("Convert Material", videoCapture.convertMaterial, typeof(Material)); videoCapture.outputCubemapMaterial = (Material)EditorGUILayout.ObjectField("Output Cubemap Material", videoCapture.outputCubemapMaterial, typeof(Material)); videoCapture.downSampleMaterial = (Material)EditorGUILayout.ObjectField("Down Sample Material", videoCapture.downSampleMaterial, typeof(Material)); } videoCapture._antiAliasing = (VideoCapturePro.AntiAliasingType)EditorGUILayout.EnumPopup("Anti Aliasing", videoCapture._antiAliasing); videoCapture._targetFramerate = (VideoCapturePro.TargetFramerateType)EditorGUILayout.EnumPopup("Target FrameRate", videoCapture._targetFramerate); videoCapture.isDedicated = EditorGUILayout.Toggle("Dedicated Camera", videoCapture.isDedicated); if (GUI.changed) { EditorUtility.SetDirty(target); } }
public override void OnInspectorGUI() { VideoCapturePro videoCapture = (VideoCapturePro)target; GUILayout.BeginVertical("box"); GUILayout.Label("Capture Mode"); videoCapture.mode = (VideoCapturePro.ModeType)EditorGUILayout.EnumPopup("Mode", videoCapture.mode); //if (videoCapture.mode == VideoCapturePro.ModeType.LIVE_STREAMING) //{ // videoCapture.streamingAddress = EditorGUILayout.TextField("Streaming Server Address", videoCapture.streamingAddress); //} //else //{ videoCapture.customPath = EditorGUILayout.Toggle(new GUIContent("Use Custom Path", "Use external folder Path"), videoCapture.customPath); if (videoCapture.customPath) { videoCapture.customPathFolder = EditorGUILayout.TextField("Custom Path Folder", videoCapture.customPathFolder); PathConfig.SaveFolder = videoCapture.customPathFolder + @"\"; } else { PathConfig.SaveFolder = ""; } GUILayout.Label(PathConfig.SaveFolder); //} GUILayout.EndVertical(); GUILayout.BeginVertical("box"); GUILayout.Label("Capture Format"); videoCapture.format = (VideoCapturePro.FormatType)EditorGUILayout.EnumPopup("Format", videoCapture.format); if (videoCapture.format == VideoCapturePro.FormatType.NORMAL) { if (videoCapture.isDedicated) { videoCapture.frameSize = (VideoCapturePro.FrameSizeType)EditorGUILayout.EnumPopup("Frame Size", videoCapture.frameSize); } } else if (videoCapture.format == VideoCapturePro.FormatType.PANORAMA) { videoCapture.sceneCamera = (Camera)EditorGUILayout.ObjectField("Capture Camera", videoCapture.sceneCamera, typeof(Camera), true); GUILayout.BeginVertical("box"); GUILayout.Label("Projection Format"); videoCapture.panoramaProjection = (VideoCapturePro.PanoramaProjectionType)EditorGUILayout.EnumPopup("Projection Type", videoCapture.panoramaProjection); if (videoCapture.panoramaProjection == VideoCapturePro.PanoramaProjectionType.EQUIRECTANGULAR) { videoCapture.frameSize = (VideoCapturePro.FrameSizeType)EditorGUILayout.EnumPopup("Frame Size", videoCapture.frameSize); videoCapture.sphereOffset = EditorGUILayout.Vector2Field("Offset Spherical Coordinates", videoCapture.sphereOffset); videoCapture.sphereScale = EditorGUILayout.Vector2Field("Offset Spherical Coordinates", videoCapture.sphereScale); } videoCapture._cubemapSize = (VideoCapturePro.CubemapSizeType)EditorGUILayout.EnumPopup("Cubemap Size", videoCapture._cubemapSize); videoCapture.captureGUI = EditorGUILayout.Toggle("Capture GUI", videoCapture.captureGUI); GUILayout.EndVertical(); } videoCapture.stereo = (VideoCapturePro.StereoType)EditorGUILayout.EnumPopup("Stereo Type", videoCapture.stereo); if (videoCapture.stereo != VideoCapturePro.StereoType.NONE) { GUILayout.BeginVertical("box"); GUILayout.Label("Stereo Format"); videoCapture.stereoFormat = (VideoCapturePro.StereoFormatType)EditorGUILayout.EnumPopup("Stereo Format Type", videoCapture.stereoFormat); videoCapture.interPupillaryDistance = EditorGUILayout.FloatField("Inter Pupillary Distance", videoCapture.interPupillaryDistance); GUILayout.EndVertical(); } videoCapture._antiAliasing = (VideoCapturePro.AntiAliasingType)EditorGUILayout.EnumPopup("Anti Aliasing", videoCapture._antiAliasing); videoCapture._targetFramerate = (VideoCapturePro.TargetFramerateType)EditorGUILayout.EnumPopup("Target FrameRate", videoCapture._targetFramerate); videoCapture.isDedicated = EditorGUILayout.Toggle("Dedicated Camera", videoCapture.isDedicated); videoCapture.captureAudioInGPUEncoder = EditorGUILayout.Toggle("Audio Capture by Hardware", videoCapture.captureAudioInGPUEncoder); if (!videoCapture.captureAudioInGPUEncoder) { videoCapture.audioCapture = (AudioCapture)EditorGUILayout.ObjectField("Audio Capture", videoCapture.audioCapture, typeof(AudioCapture), true); } if (GUILayout.Button("Re-Encode Video Resolution to 4K")) { FunctionUtils.EncodeVideo4K(PathConfig.lastVideoFile); } if (GUILayout.Button("Generate GIF Image")) { FunctionUtils.ConvertVideoGif(PathConfig.lastVideoFile); } if (GUILayout.Button("Open Save folder")) { FunctionUtils.OpenSaveFolder(); } GUILayout.EndVertical(); if (GUI.changed) { EditorUtility.SetDirty(target); //#if UNITY_5_4_OR_NEWER // EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); //#endif } }