private bool _disposed = false;
private CameraState _state = CameraState.None;
PinnedPreviewBuffer<byte> _previewBuffer;
+ private CameraDeviceManager _cameraDeviceManager;
/// <summary>
/// Initializes a new instance of the <see cref="Camera"/> class.
CameraDeviceType cameraDeviceType = CameraDeviceType.BuiltIn;
CameraDevice cameraDevice = device;
- if (CameraDeviceManager.IsSupported || device == CameraDevice.Default)
+ try
{
- var deviceInfo = GetDeviceInformation();
+ _cameraDeviceManager = new CameraDeviceManager();
+ }
+ catch (NotSupportedException)
+ {
+ Log.Info(CameraLog.Tag,
+ $"CameraDeviceManager is not supported. Not error.");
+ }
+
+ if (_cameraDeviceManager != null || device == CameraDevice.Default)
+ {
+ var deviceInfo = _cameraDeviceManager.SupportedDevices;
+
+ // CameraDeviceManager is not used internally anymore.
+ _cameraDeviceManager.Dispose();
+
if (!deviceInfo.Any())
{
- throw new InvalidOperationException("CDM is supported but, there's no available camera device.");
+ throw new InvalidOperationException("CameraDeviceManager is supported but, there's no available camera device.");
}
cameraDeviceType = deviceInfo.First().Type;
CreateNativeCameraDevice(cameraDeviceType, cameraDevice);
}
- private IEnumerable<CameraDeviceInformation> GetDeviceInformation()
- {
- using (var cameraDeviceManager = new CameraDeviceManager())
- {
- return cameraDeviceManager.GetDeviceInformation();
- }
- }
-
private void CreateNativeCameraDevice(CameraDeviceType type, CameraDevice device)
{
if (type == CameraDeviceType.BuiltIn || type == CameraDeviceType.Usb)
/// <exception cref="ArgumentException">In case of invalid parameters.</exception>
/// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
/// <exception cref="NotSupportedException">In case of the ChangeDevice feature is not supported.</exception>
- /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The camera has already been disposed. </exception>
public void ChangeDevice(CameraDevice device)
{
ValidateState(CameraState.Created);
/// <feature> http://tizen.org/feature/camera </feature>
/// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
/// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
- /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The camera has already been disposed. </exception>
/// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
public void StartPreview()
{
/// <feature> http://tizen.org/feature/camera </feature>
/// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
/// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
- /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The camera has already been disposed. </exception>
/// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
public void StopPreview()
{
/// </remarks>
/// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
/// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
- /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The camera has already been disposed. </exception>
/// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
public void StartCapture()
{
/// <exception cref="ArgumentOutOfRangeException">In case of invalid parameters.</exception>
/// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
/// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
- /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The camera has already been disposed. </exception>
/// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
public void StartCapture(int count, int interval, CancellationToken cancellationToken)
{
/// <exception cref="ArgumentException">In case of invalid parameters.</exception>
/// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
/// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
- /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The camera has already been disposed. </exception>
/// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
public void StartFocusing(bool continuous)
{
/// <feature> http://tizen.org/feature/camera </feature>
/// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
/// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
- /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The camera has already been disposed. </exception>
/// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
public void StopFocusing()
{
/// </remarks>
/// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
/// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
- /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The camera has already been disposed. </exception>
/// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
public void StartFaceDetection()
{
/// <feature> http://tizen.org/feature/camera </feature>
/// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
/// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
- /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The camera has already been disposed. </exception>
/// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
public void StopFaceDetection()
{