private void Timer_Tick(object sender, EventArgs e) { if (!this.CaptureInProgress || this.capturePipeline == null || this.capturePipeline.IsCompleted || this.capturePipeline.IsAddingCompleted) { return; } this.CaptureTime = this.capturePipeline.Timer.ElapsedTime; this.FPSPipeline = this.capturePipeline.Timer.FPS; var frame = new CaptureFrame { AbsoluteTime = DateTime.Now, RelativeTime = this.capturePipeline.Timer.ElapsedTime, LeftForce = WIILeftViewModel.ForceFrame, RightForce = WIIRightViewModel.ForceFrame }; if (this.CanCaptureWII) { this.capturePipeline.Enqueue(frame); this.FrameCount++; } this.QueueCount = this.capturePipeline.Count; }
// Use this for initialization void Start() { m_opencvProcessing = new OpencvProcessingInterface(); m_frameCapturer = Camera.main.GetComponent <CaptureFrame>(); m_arSession = UnityARSessionNativeInterface.GetARSessionNativeInterface(); m_state = STATE.WAIT_FOR_TAP; }
public static Navigation LoadResource(Locator locator) { var navigation = new Navigation() { Name = locator.Name, ResLocation = locator.Root, Resources = new Resource[] { } }; var root = Path.Combine(Environment.CurrentDirectory, locator.Root); var directory = new DirectoryInfo(root); var resources = directory.GetFiles().Select((info) => { var resource = new Resource(); var type = PredicateResourceType(info.Extension); if (type == ResourceType.NotSupport) { return(null); } var names = info.Name.Split('.')[0].Split('-'); resource.FullName = info.FullName.Replace(Environment.CurrentDirectory, string.Empty).TrimStart('\\'); resource.Name = info.Name; resource.DisplayName = names.Length > 1 ? names[1] : names[0]; resource.Type = type; if (type == ResourceType.Video) { resource.ImageUrl = CaptureFrame.Capture(resource.FullName, new System.Drawing.Size(640, 317), 10); } return(resource); }).Where(resource => resource != null); var images = directory.GetDirectories() .Select(ctx => { var resource = new Resource(); if (ctx.GetFiles().All((info) => { return(Constants.EXTENSION_IMAGE_RESOURCE.Any(ex => ex.Equals(info.Extension, StringComparison.OrdinalIgnoreCase))); })) { var names = ctx.Name.Split('-'); resource.FullName = ctx.FullName.Replace(Environment.CurrentDirectory, string.Empty); resource.Type = ResourceType.ImageFolder; resource.Name = ctx.Name; resource.DisplayName = names.Length > 1 ? names[1] : names[0]; return(resource); } return(null); }) .Where(ctx => ctx != null); var merge = new List <Resource>(); merge.AddRange(resources); merge.AddRange(images); navigation.Resources = merge.ToArray(); return(navigation); }
public async Task SendScreenCapture(CaptureFrame screenFrame) { PendingSentFrames.Enqueue(DateTimeOffset.Now); var left = screenFrame.Left; var top = screenFrame.Top; var width = screenFrame.Width; var height = screenFrame.Height; for (var i = 0; i < screenFrame.EncodedImageBytes.Length; i += 50_000) { var dto = new CaptureFrameDto() { Left = left, Top = top, Width = width, Height = height, EndOfFrame = false, ImageBytes = screenFrame.EncodedImageBytes.Skip(i).Take(50_000).ToArray(), ImageQuality = _imageQuality }; await SendToViewer(() => RtcSession.SendDto(dto), () => CasterSocket.SendDtoToViewer(dto, ViewerConnectionID)); } var endOfFrameDto = new CaptureFrameDto() { Left = left, Top = top, Width = width, Height = height, EndOfFrame = true, ImageQuality = _imageQuality }; await SendToViewer(() => RtcSession.SendDto(endOfFrameDto), () => CasterSocket.SendDtoToViewer(endOfFrameDto, ViewerConnectionID)); }