public void stop() { if (imageReader != null) { imageReader.Close(); closeCamera(); stopBackgroundThread(); imageReader = null; } }
public override bool OnUnbind(Intent Intent) { Stop(); Instance = null; ServiceStarted = false; _imageReader?.Close(); _imageReader = null; return(base.OnUnbind(Intent)); }
/// <summary> /// 刷新虚拟显示 /// </summary> private void StartVirtualDisplay() { _imageReader?.Close(); _virtualDisplay?.Release(); _mediaProjection?.Stop(); _mediaProjection = _mediaProjectionManager.GetMediaProjection((int)Result.Ok, _intent); //屏幕宽高 var screenHeight = ScreenMetrics.Instance.GetOrientationAwareScreenHeight(); var screenWidth = ScreenMetrics.Instance.GetOrientationAwareScreenWidth(); InitVirtualDisplay(screenWidth, screenHeight, (int)ScreenMetrics.Instance.DeviceScreenDensity); }
// Closes the current {@link CameraDevice}. public void CloseCamera() { try { mCameraOpenCloseLock.Acquire(); if (null != mCaptureSession) { mCaptureSession.Close(); mCaptureSession = null; } if (null != mCameraDevice) { mCameraDevice.Close(); mCameraDevice = null; } if (null != mImageReader) { mImageReader.Close(); mImageReader = null; } } catch (InterruptedException e) { Crashes.TrackError(e); throw new RuntimeException("Interrupted while trying to lock camera closing.", e); } finally { mCameraOpenCloseLock.Release(); StopBackgroundThread(); } }
public void CloseCamera() { try { CameraOpenCloseLock.Acquire(); if (null != CaptureSession) { CaptureSession.Close(); CaptureSession = null; } if (null != Device) { Device.Close(); Device = null; } if (null != mImageReader) { mImageReader.Close(); mImageReader = null; } } catch (InterruptedException e) { throw new RuntimeException("Interrupted while trying to lock camera closing.", e); } finally { CameraOpenCloseLock.Release(); } }
void CloseCamera() { try { if (null != captureSession) { captureSession.Close(); captureSession = null; } if (null != cameraDevice) { cameraDevice.Close(); cameraDevice = null; } if (null != imageReader) { imageReader.Close(); imageReader = null; } } catch (Exception e) { System.Diagnostics.Debug.WriteLine($"{e.Message} {e.StackTrace}"); } }
/** Closes the current {@link CameraDevice}. */ private void closeCamera() { try { cameraOpenCloseLock.Acquire(); if (null != captureSession) { captureSession.Close(); captureSession = null; } if (null != cameraDevice) { cameraDevice.Close(); cameraDevice = null; } if (null != imageReader) { imageReader.Close(); imageReader = null; } } catch (Java.Lang.InterruptedException e) { throw new Java.Lang.RuntimeException("Interrupted while trying to lock camera closing.", e); } finally { cameraOpenCloseLock.Release(); } }
// Closes the current {@link CameraDevice}. private void CloseCamera() { try { mCameraOpenCloseLock.WaitOne(); if (null != mCaptureSession) { mCaptureSession.Close(); mCaptureSession = null; } if (null != mCameraDevice) { mCameraDevice.Close(); mCameraDevice = null; } if (null != mImageReader) { mImageReader.Close(); mImageReader = null; } } catch (InterruptedException e) { throw new RuntimeException("Interrupted while trying to lock camera closing.", e); } finally { mCameraOpenCloseLock.Release(); } }
// Closes the current {@link CameraDevice}. protected void CloseCamera() { if (CaptureSession == null) { return; } try { CameraOpenCloseLock.Acquire(); if (null != CaptureSession) { try { CaptureSession.StopRepeating(); CaptureSession.AbortCaptures(); } catch (CameraAccessException ex) { #if DEBUG ex.PrintStackTrace(); #endif } catch (IllegalStateException ex) { #if DEBUG ex.PrintStackTrace(); #endif } CaptureSession.Close(); CaptureSession = null; } if (null != CameraDevice) { CameraDevice.Close(); CameraDevice = null; } if (null != _imageReader) { _imageReader.Close(); _imageReader = null; } } catch (InterruptedException ex) { throw new RuntimeException("Interrupted while trying to lock camera closing.", ex); } finally { CameraOpenCloseLock.Release(); } }
// Closes the current {@link CameraDevice}. private void CloseCamera() { if (mCaptureSession == null) { return; } try { mCameraOpenCloseLock.Acquire(); if (mCaptureSession != null) { try { mCaptureSession.StopRepeating(); mCaptureSession.AbortCaptures(); } catch (CameraAccessException e) { e.PrintStackTrace(); } catch (IllegalStateException e) { e.PrintStackTrace(); } mCaptureSession.Close(); mCaptureSession = null; } if (mCameraDevice != null) { mCameraDevice.Close(); mCameraDevice = null; } if (mImageReader != null) { mImageReader.Close(); mImageReader = null; } } catch (InterruptedException e) { throw new RuntimeException("Interrupted while trying to lock camera closing.", e); } finally { mCameraOpenCloseLock.Release(); } }
public void Dispose() { _convertedMat.Release(); _colorCorrectedMat.Release(); _convertedMat = _colorCorrectedMat = null; _lastestPattern?.Dispose(); _lastestPattern = null; _readBitmap?.Recycle(); _readBitmap = null; _virtualDisplay?.Release(); _virtualDisplay = null; _imageReader?.Close(); _imageReader = null; _mediaProjection?.Stop(); _mediaProjection = null; }
// Undone: Call from Dispose() /// <inheritdoc /> protected override async Task CloseCamera() { try { await CameraOpenCloseLock.WaitAsync().ConfigureAwait(false); await base.CloseCamera().ConfigureAwait(false); if (_imageReader != null) { _imageReader.Close(); _imageReader = null; } } catch (InterruptedException e) { throw new RuntimeException("Interrupted while trying to lock camera closing.", e); } finally { CameraOpenCloseLock.Release(); } }
private void Stop() { _imageAvailableListener.ImageAvailable -= PreviewImageAvailable; _imageReader.Close(); }