public IAsyncOperation <DepthFrameReader> OpenDepthFrameReaderAsync() { return(Task.Run(async() => { if (DepthReader == null) { if (Type == SensorType.NetworkClient) { DepthReader = new DepthFrameReader(this, _networkClient); } else { var depthSourceInfo = _sourceGroup.SourceInfos.FirstOrDefault(si => si.SourceKind == MediaFrameSourceKind.Depth); if (depthSourceInfo != null) { MediaFrameSource depthSource; if (_mediaCapture.FrameSources.TryGetValue(depthSourceInfo.Id, out depthSource)) { var depthMediaReader = await _mediaCapture.CreateFrameReaderAsync(depthSource); DepthReader = new DepthFrameReader(this, depthMediaReader); } } } } await DepthReader?.OpenAsync(); return DepthReader; }).AsAsyncOperation()); }
public IAsyncOperation <DepthFrameReader> OpenDepthFrameReaderAsync() { return(Task.Run(async() => { if (_depthReader == null) { var depthSourceInfo = _sourceGroup.SourceInfos.FirstOrDefault(si => si.SourceKind == MediaFrameSourceKind.Depth); if (depthSourceInfo == null) { return null; } MediaFrameSource depthSource; if (_mediaCapture.FrameSources.TryGetValue(depthSourceInfo.Id, out depthSource)) { var intrinsics = depthSource.TryGetCameraIntrinsics(depthSource.CurrentFormat); var depthMediaReader = await _mediaCapture.CreateFrameReaderAsync(depthSource); _depthReader = new DepthFrameReader(this, depthSource, depthMediaReader); } else { return null; } } await _depthReader.OpenAsync(); return _depthReader; }).AsAsyncOperation()); }
public IAsyncAction CloseAsync() { return(Task.Run(async() => { await _bodyIndexReader?.CloseAsync(); _bodyIndexReader?.Dispose(); _bodyIndexReader = null; await _bodyReader?.CloseAsync(); _bodyReader?.Dispose(); _bodyReader = null; await _colorReader?.CloseAsync(); _colorReader?.Dispose(); _colorReader = null; await _depthReader?.CloseAsync(); _depthReader?.Dispose(); _depthReader = null; _audioReader?.Close(); _audioReader?.Dispose(); _audioReader = null; if (Type != SensorType.NetworkClient) { _mediaCapture?.Dispose(); _mediaCapture = null; } else { _sensorConnection.Dispose(); _sensorConnection = null; } }).AsAsyncAction()); }
internal DepthFrameArrivedEventArgs(DepthFrameReader source, SoftwareBitmap bitmap, CameraIntrinsics intrinsics) { Source = source; Bitmap = bitmap; CameraIntrinsics = intrinsics; }