Change some class names.
Add New API - InterruptStarted eventHandler and args.
Change Width, Height property to Size class in StillImage, PreviewFrame.
Change DisableShutterSound property to method.
Some properties are changed private, static.
Change-Id: I7444ddf3e5d437eb987ed0324c3ca32ca1e44f15
Signed-off-by: Haesu Gwon <haesu.gwon@samsung.com>
private IntPtr _handle = IntPtr.Zero;
private bool _disposed = false;
private CameraState _state = CameraState.None;
- private static Dictionary<object, int> _callbackIdInfo = new Dictionary<object, int>();
/// <summary>
/// Initializes a new instance of the <see cref="Camera"/> Class.
CameraErrorFactory.ThrowIfError(Native.Create(device, out _handle),
"Failed to create camera instance");
- Feature = new CameraFeatures(this);
- Setting = new CameraSettings(this);
+ Capabilities = new CameraCapabilities(this);
+ Settings = new CameraSettings(this);
DisplaySettings = new CameraDisplaySettings(this);
RegisterCallbacks();
#region EventHandlers
/// <summary>
+ /// Event that occurs when the camera interrupt is started by policy.
+ /// </summary>
+ public event EventHandler<CameraInterruptStartedEventArgs> InterruptStarted;
+ private Native.InterruptStartedCallback _interruptStartedCallback;
+
+ /// <summary>
/// Event that occurs when an camera is interrupted by policy.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public event EventHandler<EventArgs> CaptureCompleted;
private Native.CaptureCompletedCallback _captureCompletedCallback;
+ private Native.HdrCaptureProgressCallback _hdrCaptureProgressCallback;
+ private event EventHandler<HdrCaptureProgressEventArgs> _hdrCaptureProgress;
+ private object _hdrCaptureProgressEventLock = new object();
+
/// <summary>
/// Event that occurs when there is change in HDR capture progress.
- /// Check whether HdrCapture feature is supported or not before add this EventHandler.
+ /// Check whether <see cref="IsHdrCaptureSupported"/> is supported or not before add this EventHandler.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public event EventHandler<HdrCaptureProgressEventArgs> HdrCaptureProgress;
- private Native.HdrCaptureProgressCallback _hdrCaptureProgressCallback;
+ /// <exception cref="NotSupportedException">In case of HDR feature is not supported.</exception>
+ public event EventHandler<HdrCaptureProgressEventArgs> HdrCaptureProgress
+ {
+ add
+ {
+ lock (_hdrCaptureProgressEventLock)
+ {
+ if (_hdrCaptureProgress == null)
+ {
+ RegisterHdrCaptureProgress();
+ }
+
+ _hdrCaptureProgress += value;
+ }
+ }
+
+ remove
+ {
+ lock (_hdrCaptureProgressEventLock)
+ {
+ _hdrCaptureProgress -= value;
+
+ if (_hdrCaptureProgress == null)
+ {
+ UnregisterHdrCaptureProgress();
+ }
+ }
+ }
+ }
/// <summary>
/// Event that occurs when camera state is changed.
public event EventHandler<CameraStateChangedEventArgs> StateChanged;
private Native.StateChangedCallback _stateChangedCallback;
- #region DeviceStateChanged callback
- internal static Native.DeviceStateChangedCallback _deviceStateChangedCallback;
+ private static Native.DeviceStateChangedCallback _deviceStateChangedCallback;
private static event EventHandler<CameraDeviceStateChangedEventArgs> _deviceStateChanged;
private static object _deviceStateChangedEventLock = new object();
+ private static int _deviceStateCallbackId;
/// <summary>
- /// Set the DeviceStateChanged Callback.
- /// User doesn't need to create camera instance.
- /// This static EventHandler calls platform function every time because each callback function have to remain its own callbackId.
+ /// Event that occurs after the <see cref="CameraDeviceState"/> is changed.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="callback">Callback of type <see cref="Native.DeviceStateChangedCallback"/>.</param>
- /// <param name="callbackId">The Id of registered callback.</param>
- /// <exception cref="InvalidOperationException">In case of any invalid operations</exception>
- /// <exception cref="NotSupportedException">In case of this feature is not supported</exception>
- /// <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="ArgumentException">In case of invalid parameters.</exception>
public static event EventHandler<CameraDeviceStateChangedEventArgs> DeviceStateChanged
{
add
{
lock (_deviceStateChangedEventLock)
{
- _deviceStateChangedCallback = (CameraDevice device, CameraDeviceState state, IntPtr userData) =>
+ if (_deviceStateChanged == null)
{
- _deviceStateChanged?.Invoke(null, new CameraDeviceStateChangedEventArgs(device, state));
- };
- CameraErrorFactory.ThrowIfError(Native.SetDeviceStateChangedCallback(_deviceStateChangedCallback, IntPtr.Zero, out int callbackId),
- "Failed to set interrupt callback");
-
- // Keep current callbackId and EventHandler pair to remove EventHandler later.
- _callbackIdInfo.Add(value, callbackId);
- Log.Info(CameraLog.Tag, "add callbackId " + callbackId.ToString());
+ RegisterDeviceStateChangedCallback();
+ }
_deviceStateChanged += value;
}
{
_deviceStateChanged -= value;
- _callbackIdInfo.TryGetValue(value, out int callbackId);
- Log.Info(CameraLog.Tag, "remove callbackId " + callbackId.ToString());
-
- CameraErrorFactory.ThrowIfError(Native.UnsetDeviceStateChangedCallback(callbackId),
- "Unsetting media packet preview callback failed");
-
- _callbackIdInfo.Remove(value);
-
if (_deviceStateChanged == null)
{
- _deviceStateChangedCallback = null;
+ UnregisterDeviceStateChangedCallback();
}
}
}
}
- #endregion DeviceStateChanged callback
- #region Preview EventHandler
private Native.PreviewCallback _previewCallback;
private event EventHandler<PreviewEventArgs> _preview;
private object _previewEventLock = new object();
if (_preview == null)
{
- CameraErrorFactory.ThrowIfError(Native.UnsetPreviewCallback(_handle),
- "Unsetting preview callback failed");
- _previewCallback = null;
+ UnregisterPreviewCallback();
}
}
}
}
- #endregion Preview EventHandler
- #region MediaPacketPreview EventHandler
private Native.MediaPacketPreviewCallback _mediaPacketPreviewCallback;
private EventHandler<MediaPacketPreviewEventArgs> _mediaPacketPreview;
private object _mediaPacketPreviewEventLock = new object();
if (_mediaPacketPreview == null)
{
- CameraErrorFactory.ThrowIfError(Native.UnsetMediaPacketPreviewCallback(_handle),
- "Unsetting media packet preview callback failed");
- _mediaPacketPreviewCallback = null;
+ UnregisterMediaPacketPreviewCallback();
}
}
}
}
- #endregion MediaPacketPreview EventHandler
#endregion EventHandlers
#region Properties
/// Get/Set the various camera settings.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public CameraSettings Setting { get; }
+ public CameraSettings Settings { get; }
/// <summary>
- /// Gets the various camera features.
+ /// Gets the various camera capabilities.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public CameraFeatures Feature { get; }
+ public CameraCapabilities Capabilities { get; }
/// <summary>
/// Get/set various camera display properties.
/// <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>
- public CameraDeviceState GetDeviceState(CameraDevice device)
+ public static CameraDeviceState GetDeviceState(CameraDevice device)
{
ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device));
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
- /// <exception cref="InvalidOperationException">In case of any invalid operations</exception>
- /// <exception cref="NotSupportedException">In case of this feature is not supported</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.</exception>
- /// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted</exception>
+ /// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
public void StopFaceDetection()
{
if (_faceDetectedCallback == null)
{
RegisterErrorCallback();
RegisterFocusStateChanged();
- RegisterHdrCaptureProgress();
+ RegisterInterruptStartedCallback();
RegisterInterruptedCallback();
RegisterStateChangedCallback();
//Define capturing callback
- _capturingCallback = (IntPtr image, IntPtr postview, IntPtr thumbnail, IntPtr userData) =>
+ _capturingCallback = (IntPtr main, IntPtr postview, IntPtr thumbnail, IntPtr userData) =>
{
- Capturing?.Invoke(this, new CameraCapturingEventArgs(new ImageData(image),
- postview == IntPtr.Zero ? null : new ImageData(postview),
- thumbnail == IntPtr.Zero ? null : new ImageData(thumbnail)));
+ Capturing?.Invoke(this, new CameraCapturingEventArgs(new StillImage(main),
+ postview == IntPtr.Zero ? null : new StillImage(postview),
+ thumbnail == IntPtr.Zero ? null : new StillImage(thumbnail)));
};
//Define captureCompleted callback
};
}
+ private void RegisterInterruptStartedCallback()
+ {
+ _interruptStartedCallback = (CameraPolicy policy, CameraState state, IntPtr userData) =>
+ {
+ InterruptStarted?.Invoke(this, new CameraInterruptStartedEventArgs(policy, state));
+ };
+ CameraErrorFactory.ThrowIfError(Native.SetInterruptStartedCallback(_handle, _interruptStartedCallback, IntPtr.Zero),
+ "Failed to set interrupt callback");
+ }
+
private void RegisterInterruptedCallback()
{
_interruptedCallback = (CameraPolicy policy, CameraState previous, CameraState current, IntPtr userData) =>
"Setting state changed callback failed");
}
+ private static void RegisterDeviceStateChangedCallback()
+ {
+ _deviceStateChangedCallback = (CameraDevice device, CameraDeviceState state, IntPtr userData) =>
+ {
+ _deviceStateChanged?.Invoke(null, new CameraDeviceStateChangedEventArgs(device, state));
+ };
+
+ CameraErrorFactory.ThrowIfError(Native.SetDeviceStateChangedCallback(_deviceStateChangedCallback, IntPtr.Zero, out _deviceStateCallbackId),
+ "Failed to set device state changed callback");
+
+ Log.Info(CameraLog.Tag, "add callbackId " + _deviceStateCallbackId.ToString());
+ }
+
+ private static void UnregisterDeviceStateChangedCallback()
+ {
+ CameraErrorFactory.ThrowIfError(Native.UnsetDeviceStateChangedCallback(_deviceStateCallbackId),
+ "Unsetting device state changed callback failed");
+ _deviceStateChangedCallback = null;
+ _deviceStateCallbackId = 0;
+ }
+
private void RegisterFocusStateChanged()
{
_focusStateChangedCallback = (CameraFocusState state, IntPtr userData) =>
private void RegisterHdrCaptureProgress()
{
- //Hdr Capture can not be supported.
- if (Feature.IsHdrCaptureSupported)
+ _hdrCaptureProgressCallback = (int percent, IntPtr userData) =>
{
- _hdrCaptureProgressCallback = (int percent, IntPtr userData) =>
- {
- HdrCaptureProgress?.Invoke(this, new HdrCaptureProgressEventArgs(percent));
- };
- CameraErrorFactory.ThrowIfError(Native.SetHdrCaptureProgressCallback(_handle, _hdrCaptureProgressCallback, IntPtr.Zero),
- "Setting Hdr capture progress callback failed");
- }
+ _hdrCaptureProgress?.Invoke(this, new HdrCaptureProgressEventArgs(percent));
+ };
+ CameraErrorFactory.ThrowIfError(Native.SetHdrCaptureProgressCallback(_handle, _hdrCaptureProgressCallback, IntPtr.Zero),
+ "Setting Hdr capture progress callback failed");
+ }
+
+ private void UnregisterHdrCaptureProgress()
+ {
+ CameraErrorFactory.ThrowIfError(Native.UnsetHdrCaptureProgressCallback(_handle),
+ "Unsetting hdr capture progress is failed");
+ _hdrCaptureProgressCallback = null;
}
private void RegisterPreviewCallback()
{
_previewCallback = (IntPtr frame, IntPtr userData) =>
{
- _preview?.Invoke(this, new PreviewEventArgs(new PreviewData(frame)));
+ _preview?.Invoke(this, new PreviewEventArgs(new PreviewFrame(frame)));
};
CameraErrorFactory.ThrowIfError(Native.SetPreviewCallback(_handle, _previewCallback, IntPtr.Zero),
"Setting preview callback failed");
}
+ private void UnregisterPreviewCallback()
+ {
+ CameraErrorFactory.ThrowIfError(Native.UnsetPreviewCallback(_handle),
+ "Unsetting preview callback failed");
+ _previewCallback = null;
+ }
+
private void RegisterMediaPacketPreviewCallback()
{
_mediaPacketPreviewCallback = (IntPtr mediaPacket, IntPtr userData) =>
CameraErrorFactory.ThrowIfError(Native.SetMediaPacketPreviewCallback(_handle, _mediaPacketPreviewCallback, IntPtr.Zero),
"Setting media packet preview callback failed");
}
+
+ private void UnregisterMediaPacketPreviewCallback()
+ {
+ CameraErrorFactory.ThrowIfError(Native.UnsetMediaPacketPreviewCallback(_handle),
+ "Unsetting media packet preview callback failed");
+ _mediaPacketPreviewCallback = null;
+ }
#endregion Callback registrations
}
}
using System;
using System.Collections.Generic;
-using NativeFeatures = Interop.CameraFeatures;
+using NativeCapabilities = Interop.CameraCapabilities;
using NativeSettings = Interop.CameraSettings;
namespace Tizen.Multimedia
{
/// <summary>
- /// The CameraFeatures class provides properties
+ /// The CameraCapabilities class provides properties
/// to get various capability information of the camera device.
/// </summary>
- public class CameraFeatures
+ public class CameraCapabilities
{
internal readonly Camera _camera;
- private List<Size> _previewResolutions;
- private List<Size> _cameraResolutions;
- private List<CameraPixelFormat> _captureFormats;
- private List<CameraPixelFormat> _previewFormats;
- private List<CameraFps> _fps;
- private List<CameraFps> _fpsByResolution;
- private List<CameraAutoFocusMode> _autoFocusModes;
- private List<CameraExposureMode> _exposureModes;
- private List<CameraIsoLevel> _isoLevels;
- private List<CameraTheaterMode> _theaterModes;
- private List<CameraWhiteBalance> _whitebalances;
- private List<CameraFlashMode> _flashModes;
- private List<CameraSceneMode> _sceneModes;
- private List<CameraEffectMode> _effectModes;
- private List<Rotation> _streamRotations;
- private List<Flips> _streamFlips;
- private List<CameraPtzType> _ptzTypes;
-
+ private IList<Size> _previewResolutions;
+ private IList<Size> _cameraResolutions;
+ private IList<CameraPixelFormat> _captureFormats;
+ private IList<CameraPixelFormat> _previewFormats;
+ private IList<CameraFps> _fps;
+ private IList<CameraAutoFocusMode> _autoFocusModes;
+ private IList<CameraExposureMode> _exposureModes;
+ private IList<CameraIsoLevel> _isoLevels;
+ private IList<CameraTheaterMode> _theaterModes;
+ private IList<CameraWhiteBalance> _whitebalances;
+ private IList<CameraFlashMode> _flashModes;
+ private IList<CameraSceneMode> _sceneModes;
+ private IList<CameraEffectMode> _effectModes;
+ private IList<Rotation> _streamRotations;
+ private IList<Flips> _streamFlips;
+ private IList<CameraPtzType> _ptzTypes;
private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
private delegate bool IsSupportedDelegate(IntPtr handle);
- internal CameraFeatures(Camera camera)
+ internal CameraCapabilities(Camera camera)
{
_camera = camera;
- IsFaceDetectionSupported = IsFeatureSupported(NativeFeatures.IsFaceDetectionSupported);
- IsMediaPacketPreviewCallbackSupported = IsFeatureSupported(NativeFeatures.IsMediaPacketPreviewCallbackSupported);
- IsZeroShutterLagSupported = IsFeatureSupported(NativeFeatures.IsZeroShutterLagSupported);
- IsContinuousCaptureSupported = IsFeatureSupported(NativeFeatures.IsContinuousCaptureSupported);
- IsHdrCaptureSupported = IsFeatureSupported(NativeFeatures.IsHdrCaptureSupported);
- IsAntiShakeSupported = IsFeatureSupported(NativeFeatures.IsAntiShakeSupported);
- IsVideoStabilizationSupported = IsFeatureSupported(NativeFeatures.IsVideoStabilizationSupported);
- IsAutoContrastSupported = IsFeatureSupported(NativeFeatures.IsAutoContrastSupported);
+ IsFaceDetectionSupported = IsFeatureSupported(NativeCapabilities.IsFaceDetectionSupported);
+ IsMediaPacketPreviewCallbackSupported = IsFeatureSupported(NativeCapabilities.IsMediaPacketPreviewCallbackSupported);
+ IsZeroShutterLagSupported = IsFeatureSupported(NativeCapabilities.IsZeroShutterLagSupported);
+ IsContinuousCaptureSupported = IsFeatureSupported(NativeCapabilities.IsContinuousCaptureSupported);
+ IsHdrCaptureSupported = IsFeatureSupported(NativeCapabilities.IsHdrCaptureSupported);
+ IsAntiShakeSupported = IsFeatureSupported(NativeCapabilities.IsAntiShakeSupported);
+ IsVideoStabilizationSupported = IsFeatureSupported(NativeCapabilities.IsVideoStabilizationSupported);
+ IsAutoContrastSupported = IsFeatureSupported(NativeCapabilities.IsAutoContrastSupported);
IsBrigtnessSupported = CheckRangeValid(NativeSettings.GetBrightnessRange);
IsExposureSupported = CheckRangeValid(NativeSettings.GetExposureRange);
IsZoomSupported = CheckRangeValid(NativeSettings.GetZoomRange);
{
if (_previewResolutions == null)
{
- try
- {
- _previewResolutions = new List<Size>();
-
- NativeFeatures.PreviewResolutionCallback callback = (int width, int height, IntPtr userData) =>
- {
- _previewResolutions.Add(new Size(width, height));
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedPreviewResolutions(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported preview resolutions");
- }
- catch
- {
- _previewResolutions = null;
- throw;
- }
+ _previewResolutions = GetSupportedPreviewResolutions();
}
return _previewResolutions;
{
if (_cameraResolutions == null)
{
- try
- {
- _cameraResolutions = new List<Size>();
-
- NativeFeatures.CaptureResolutionCallback callback = (int width, int height, IntPtr userData) =>
- {
- _cameraResolutions.Add(new Size(width, height));
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedCaptureResolutions(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported capture resolutions");
- }
- catch
- {
- _cameraResolutions = null;
- throw;
- }
+ _cameraResolutions = GetSupportedCaptureResolutions();
}
return _cameraResolutions;
{
if (_captureFormats == null)
{
- try
- {
- _captureFormats = new List<CameraPixelFormat>();
-
- NativeFeatures.CaptureFormatCallback callback = (CameraPixelFormat format, IntPtr userData) =>
- {
- _captureFormats.Add(format);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedCapturePixelFormats(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported capture formats.");
- }
- catch
- {
- _captureFormats = null;
- throw;
- }
+ _captureFormats = GetSupportedCapturePixelFormats();
}
return _captureFormats;
{
if (_previewFormats == null)
{
- try
- {
- _previewFormats = new List<CameraPixelFormat>();
-
- NativeFeatures.PreviewFormatCallback callback = (CameraPixelFormat format, IntPtr userData) =>
- {
- _previewFormats.Add(format);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedPreviewPixelFormats(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported preview formats.");
- }
- catch
- {
- _previewFormats = null;
- throw;
- }
+ _previewFormats = GetSupportedPreviewPixelFormats();
}
return _previewFormats;
{
if (_fps == null)
{
- try
- {
- _fps = new List<CameraFps>();
-
- NativeFeatures.FpsCallback callback = (CameraFps fps, IntPtr userData) =>
- {
- _fps.Add(fps);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedPreviewFps(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported camera fps");
- }
- catch
- {
- _fps = null;
- throw;
- }
+ _fps = GetSupportedPreviewFps();
}
return _fps;
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraFps> GetSupportedPreviewFpsByResolution(int width, int height)
{
- if (_fpsByResolution == null)
- {
- try
- {
- _fpsByResolution = new List<CameraFps>();
-
- NativeFeatures.FpsByResolutionCallback callback = (CameraFps fps, IntPtr userData) =>
- {
- _fpsByResolution.Add(fps);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedPreviewFpsByResolution(_camera.GetHandle(),
- width, height, callback, IntPtr.Zero), "Failed to get the supported fps by resolutions.");
- }
- catch
- {
- _fpsByResolution = null;
- throw;
- }
- }
-
- return _fpsByResolution;
+ return GetSupportedPreviewFpsByResolutions(width, height);
}
/// <summary>
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraFps> GetSupportedPreviewFpsByResolution(Size size)
{
- return GetSupportedPreviewFpsByResolution(size.Width, size.Height);
+ return GetSupportedPreviewFpsByResolutions(size.Width, size.Height);
}
/// <summary>
{
if (_autoFocusModes == null)
{
- try
- {
- _autoFocusModes = new List<CameraAutoFocusMode>();
-
- NativeFeatures.AfModeCallback callback = (CameraAutoFocusMode mode, IntPtr userData) =>
- {
- _autoFocusModes.Add(mode);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedAfModes(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported Auto focus modes.");
- }
- catch
- {
- _autoFocusModes = null;
- throw;
- }
+ _autoFocusModes = GetSupportedAutoFocusModes();
}
return _autoFocusModes;
{
if (_exposureModes == null)
{
- try
- {
- _exposureModes = new List<CameraExposureMode>();
-
- NativeFeatures.ExposureModeCallback callback = (CameraExposureMode mode, IntPtr userData) =>
- {
- _exposureModes.Add(mode);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedExposureModes(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported Exposure modes.");
- }
- catch
- {
- _exposureModes = null;
- throw;
- }
+ _exposureModes = GetSupportedExposureModes();
}
return _exposureModes;
{
if (_isoLevels == null)
{
- try
- {
- _isoLevels = new List<CameraIsoLevel>();
-
- NativeFeatures.IsoCallback callback = (CameraIsoLevel iso, IntPtr userData) =>
- {
- _isoLevels.Add(iso);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedIso(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported Iso levels.");
- }
- catch
- {
- _isoLevels = null;
- throw;
- }
+ _isoLevels = GetSupportedIsoLevels();
}
return _isoLevels;
{
if (_theaterModes == null)
{
- try
- {
- _theaterModes = new List<CameraTheaterMode>();
-
- NativeFeatures.TheaterModeCallback callback = (CameraTheaterMode theaterMode, IntPtr userData) =>
- {
- _theaterModes.Add(theaterMode);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedTheaterModes(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported theater modes.");
- }
- catch
- {
- _theaterModes = null;
- throw;
- }
+ _theaterModes = GetSupportedTheaterModes();
}
return _theaterModes;
{
if (_whitebalances == null)
{
- try
- {
- _whitebalances = new List<CameraWhiteBalance>();
-
- NativeFeatures.WhitebalanceCallback callback = (CameraWhiteBalance whiteBalance, IntPtr userData) =>
- {
- _whitebalances.Add(whiteBalance);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedWhitebalance(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported white balance.");
- }
- catch
- {
- _whitebalances = null;
- throw;
- }
+ _whitebalances = GetSupportedWhitebalances();
}
return _whitebalances;
{
if (_flashModes == null)
{
- try
- {
- _flashModes = new List<CameraFlashMode>();
-
- NativeFeatures.FlashModeCallback callback = (CameraFlashMode flashMode, IntPtr userData) =>
- {
- _flashModes.Add(flashMode);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedFlashModes(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported flash modes.");
- }
- catch
- {
- _flashModes = null;
- throw;
- }
+ _flashModes = GetSupportedFlashModes();
}
return _flashModes;
{
if (_sceneModes == null)
{
- try
- {
- _sceneModes = new List<CameraSceneMode>();
-
- NativeFeatures.SceneModeCallback callback = (CameraSceneMode sceneMode, IntPtr userData) =>
- {
- _sceneModes.Add(sceneMode);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedSceneModes(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported scene modes.");
- }
- catch
- {
- _sceneModes = null;
- throw;
- }
+ _sceneModes = GetSupportedSceneModes();
}
return _sceneModes;
{
if (_effectModes == null)
{
- try
- {
- _effectModes = new List<CameraEffectMode>();
-
- NativeFeatures.EffectCallback callback = (CameraEffectMode effect, IntPtr userData) =>
- {
- _effectModes.Add(effect);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedEffects(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported camera effects.");
- }
- catch
- {
- _effectModes = null;
- throw;
- }
+ _effectModes = GetSupportedEffects();
}
return _effectModes;
{
if (_streamRotations == null)
{
- try
- {
- _streamRotations = new List<Rotation>();
-
- NativeFeatures.StreamRotationCallback callback = (streamRotation, _) =>
- {
- _streamRotations.Add(streamRotation);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedStreamRotations(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported camera rotations.");
- }
- catch
- {
- _streamRotations = null;
- throw;
- }
+ _streamRotations = GetSupportedStreamRotations();
}
return _streamRotations;
{
if (_streamFlips == null)
{
- try
- {
- _streamFlips = new List<Flips>();
-
- NativeFeatures.StreamFlipCallback callback = (streamFlip, _) =>
- {
- _streamFlips.Add(streamFlip);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedStreamFlips(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported camera flips.");
- }
- catch
- {
- _streamFlips = null;
- throw;
- }
+ _streamFlips = GetSupportedStreamFlips();
}
return _streamFlips;
{
if (_ptzTypes.Count == 0)
{
- try
- {
- _ptzTypes = new List<CameraPtzType>();
-
- NativeFeatures.PtzTypeCallback callback = (CameraPtzType ptzType, IntPtr userData) =>
- {
- _ptzTypes.Add(ptzType);
- return true;
- };
- CameraErrorFactory.ThrowIfError(NativeFeatures.SupportedPtzTypes(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported Ptz types.");
- }
- catch
- {
- _ptzTypes = null;
- throw;
- }
+ _ptzTypes = GetSupportedPtzTypes();
}
return _ptzTypes;
}
}
+
+ #region Methods for getting supported values
+ private IList<Size> GetSupportedPreviewResolutions()
+ {
+ List<Size> previewResolutions = new List<Size>();
+
+ NativeCapabilities.PreviewResolutionCallback callback = (int width, int height, IntPtr userData) =>
+ {
+ previewResolutions.Add(new Size(width, height));
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewResolutions(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported preview resolutions");
+
+ return previewResolutions.AsReadOnly();
+ }
+
+ private IList<Size> GetSupportedCaptureResolutions()
+ {
+ List<Size> cameraResolutions = new List<Size>();
+
+ NativeCapabilities.CaptureResolutionCallback callback = (int width, int height, IntPtr userData) =>
+ {
+ cameraResolutions.Add(new Size(width, height));
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedCaptureResolutions(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported capture resolutions");
+
+ return cameraResolutions.AsReadOnly();
+ }
+
+ private IList<CameraPixelFormat> GetSupportedCapturePixelFormats()
+ {
+ List<CameraPixelFormat> captureFormats = new List<CameraPixelFormat>();
+
+ NativeCapabilities.CaptureFormatCallback callback = (CameraPixelFormat format, IntPtr userData) =>
+ {
+ captureFormats.Add(format);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedCapturePixelFormats(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported capture formats.");
+
+ return captureFormats.AsReadOnly();
+ }
+
+ private IList<CameraPixelFormat> GetSupportedPreviewPixelFormats()
+ {
+ List<CameraPixelFormat> previewFormats = new List<CameraPixelFormat>();
+
+ NativeCapabilities.PreviewFormatCallback callback = (CameraPixelFormat format, IntPtr userData) =>
+ {
+ previewFormats.Add(format);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewPixelFormats(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported preview formats.");
+
+ return previewFormats.AsReadOnly();
+ }
+
+ private IList<CameraFps> GetSupportedPreviewFps()
+ {
+ List<CameraFps> previewFps = new List<CameraFps>();
+
+ NativeCapabilities.FpsCallback callback = (CameraFps fps, IntPtr userData) =>
+ {
+ previewFps.Add(fps);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewFps(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported camera fps");
+
+ return previewFps.AsReadOnly();
+ }
+
+ private IList<CameraFps> GetSupportedPreviewFpsByResolutions(int width, int height)
+ {
+ List<CameraFps> fpsByResolution = new List<CameraFps>();
+
+ NativeCapabilities.FpsByResolutionCallback callback = (CameraFps fps, IntPtr userData) =>
+ {
+ fpsByResolution.Add(fps);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewFpsByResolution(_camera.GetHandle(),
+ width, height, callback, IntPtr.Zero), "Failed to get the supported fps by resolutions.");
+
+ return fpsByResolution.AsReadOnly();
+ }
+
+ private IList<CameraAutoFocusMode> GetSupportedAutoFocusModes()
+ {
+ List<CameraAutoFocusMode> autoFocusModes = new List<CameraAutoFocusMode>();
+
+ NativeCapabilities.AfModeCallback callback = (CameraAutoFocusMode mode, IntPtr userData) =>
+ {
+ autoFocusModes.Add(mode);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedAutoFocusModes(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported Auto focus modes.");
+
+ return autoFocusModes.AsReadOnly();
+ }
+
+ private IList<CameraExposureMode> GetSupportedExposureModes()
+ {
+ List<CameraExposureMode> exposureModes = new List<CameraExposureMode>();
+
+ NativeCapabilities.ExposureModeCallback callback = (CameraExposureMode mode, IntPtr userData) =>
+ {
+ exposureModes.Add(mode);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedExposureModes(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported Exposure modes.");
+
+ return exposureModes.AsReadOnly();
+ }
+
+ private IList<CameraIsoLevel> GetSupportedIsoLevels()
+ {
+ List<CameraIsoLevel> isoLevels = new List<CameraIsoLevel>();
+
+ NativeCapabilities.IsoCallback callback = (CameraIsoLevel iso, IntPtr userData) =>
+ {
+ isoLevels.Add(iso);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedIso(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported Iso levels.");
+
+ return isoLevels.AsReadOnly();
+ }
+
+ private IList<CameraTheaterMode> GetSupportedTheaterModes()
+ {
+ List<CameraTheaterMode> theaterModes = new List<CameraTheaterMode>();
+
+ NativeCapabilities.TheaterModeCallback callback = (CameraTheaterMode theaterMode, IntPtr userData) =>
+ {
+ theaterModes.Add(theaterMode);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedTheaterModes(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported theater modes.");
+
+ return theaterModes.AsReadOnly();
+ }
+
+ private IList<CameraWhiteBalance> GetSupportedWhitebalances()
+ {
+ List<CameraWhiteBalance> whitebalances = new List<CameraWhiteBalance>();
+
+ NativeCapabilities.WhitebalanceCallback callback = (CameraWhiteBalance whiteBalance, IntPtr userData) =>
+ {
+ whitebalances.Add(whiteBalance);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedWhitebalance(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported white balance.");
+
+ return whitebalances.AsReadOnly();
+ }
+
+ private IList<CameraFlashMode> GetSupportedFlashModes()
+ {
+ List<CameraFlashMode> flashModes = new List<CameraFlashMode>();
+
+ NativeCapabilities.FlashModeCallback callback = (CameraFlashMode flashMode, IntPtr userData) =>
+ {
+ flashModes.Add(flashMode);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedFlashModes(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported flash modes.");
+
+ return flashModes.AsReadOnly();
+ }
+
+ private IList<CameraSceneMode> GetSupportedSceneModes()
+ {
+ List<CameraSceneMode> sceneModes = new List<CameraSceneMode>();
+
+ NativeCapabilities.SceneModeCallback callback = (CameraSceneMode sceneMode, IntPtr userData) =>
+ {
+ sceneModes.Add(sceneMode);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedSceneModes(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported scene modes.");
+
+ return sceneModes.AsReadOnly();
+ }
+
+ private IList<CameraEffectMode> GetSupportedEffects()
+ {
+ List<CameraEffectMode> effectModes = new List<CameraEffectMode>();
+
+ NativeCapabilities.EffectCallback callback = (CameraEffectMode effect, IntPtr userData) =>
+ {
+ effectModes.Add(effect);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedEffects(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported camera effects.");
+
+ return effectModes.AsReadOnly();
+ }
+
+ private IList<Rotation> GetSupportedStreamRotations()
+ {
+ List<Rotation> streamRotations = new List<Rotation>();
+
+ NativeCapabilities.StreamRotationCallback callback = (Rotation streamRotation, IntPtr userData) =>
+ {
+ streamRotations.Add(streamRotation);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedStreamRotations(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported camera rotations.");
+
+ return streamRotations.AsReadOnly();
+ }
+
+ private IList<Flips> GetSupportedStreamFlips()
+ {
+ List<Flips> streamFlips = new List<Flips>();
+
+ NativeCapabilities.StreamFlipCallback callback = (Flips streamFlip, IntPtr userData) =>
+ {
+ streamFlips.Add(streamFlip);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedStreamFlips(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported camera flips.");
+
+ return streamFlips.AsReadOnly();
+ }
+
+ private IList<CameraPtzType> GetSupportedPtzTypes()
+ {
+ List<CameraPtzType> ptzTypes = new List<CameraPtzType>();
+
+ NativeCapabilities.PtzTypeCallback callback = (CameraPtzType ptzType, IntPtr userData) =>
+ {
+ ptzTypes.Add(ptzType);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPtzTypes(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported Ptz types.");
+
+ return ptzTypes.AsReadOnly();
+ }
+ #endregion Methods for getting supported values
}
}
namespace Tizen.Multimedia
{
/// <summary>
- /// An extended EventArgs class which contains details about the captured image.
+ /// An extended EventArgs class which contains details about the captured still image.
/// </summary>
public class CameraCapturingEventArgs : EventArgs
{
- internal CameraCapturingEventArgs(ImageData img, ImageData post, ImageData thumbnail)
+ internal CameraCapturingEventArgs(StillImage main, StillImage post, StillImage thumbnail)
{
- Image = img;
+ MainImage = main;
PostView = post;
Thumbnail = thumbnail;
}
/// <summary>
- /// The image data of the captured picture.
+ /// The main image data of the captured still image.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public ImageData Image { get; }
+ public StillImage MainImage { get; }
/// <summary>
/// The image data of the postview.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public ImageData PostView { get; }
+ public StillImage PostView { get; }
/// <summary>
/// The image data of the thumbnail.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public ImageData Thumbnail { get; }
+ public StillImage Thumbnail { get; }
}
}
/// The display mode.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ /// <remarks>
+ /// This property is meaningful only in overlay or EVAS surface display type.
+ /// </remarks>
/// <value>A <see cref="CameraDisplayMode"/> that specifies the display mode.</value>
+ /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
/// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
public CameraDisplayMode Mode
{
/// True if camera display visible, otherwise false.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ /// <remarks>
+ /// This property is meaningful only in overlay or EVAS surface display type.
+ /// </remarks>
+ /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
/// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
public bool Visible
{
/// The display rotation.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ /// <remarks>
+ /// This property is meaningful only in overlay or EVAS surface display type.
+ /// </remarks>
/// <value>A <see cref="Rotation"/> that specifies the rotation of camera device.</value>
+ /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
/// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
public Rotation Rotation
{
/// The display flip.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ /// <remarks>
+ /// This property is meaningful only in overlay or EVAS surface display type.
+ /// </remarks>
/// <value>A <see cref="CameraFlip"/> that specifies camera flip type.</value>
+ /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
/// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
public Flips Flip
{
/// the ROI(Region Of Interest) area of display.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ /// <remarks>
+ /// This property is meaningful only in overlay or EVAS surface display type.
+ /// </remarks>
+ /// <exception cref="InvalidOperationException">Display type is incorrect.</exception>
/// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
public Rectangle RoiArea
{
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// An extended EventArgs class which contains details about current state
+ /// of the camera when interrupt is invoked internally in Native FW.
+ /// </summary>
+ public class CameraInterruptStartedEventArgs : EventArgs
+ {
+ internal CameraInterruptStartedEventArgs(CameraPolicy policy, CameraState state)
+ {
+ Policy = policy;
+ State = state;
+ }
+
+ /// <summary>
+ /// Current state of the camera.
+ /// </summary>
+ public CameraState State { get; }
+
+ /// <summary>
+ /// The policy that interrupted the camera.
+ /// </summary>
+ public CameraPolicy Policy { get; }
+ }
+}
+
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of captured image.</value>
- /// <exception cref="ArgumentException">In case of invalid parameters</exception>
+ /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraPixelFormat CapturePixelFormat
{
}
/// <summary>
- /// Disables shutter sound.
- /// If true shutter sound is disabled, otherwise false.
+ /// Turn the shutter sound on or off, if it is permitted by policy.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ /// <param name="shutterSound">Shutter sound On/Off flag</param>
/// <remarks>
+ /// If this value is true, shutter sound will be disabled, otherwise enabled.
/// In some countries, this operation is not permitted.
/// </remarks>
+ /// <exception cref="InvalidOperationException">Disabling shutter sound is not permitted.</exception>
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
- public bool DisableShutterSound
+ public void DisableShutterSound(bool shutterSound)
{
- set
- {
- CameraErrorFactory.ThrowIfError(Native.DisableShutterSound(_camera.GetHandle(), value),
+ CameraErrorFactory.ThrowIfError(Native.DisableShutterSound(_camera.GetHandle(), shutterSound),
"Failed to set disable shutter sound.");
- }
}
#region PTZ(Pan Tilt Zoom), Pan, Tilt
/// <since_tizen> 3 </since_tizen>
/// <param name="type">ptz move type. <seealso cref="CameraPtzMoveType"/></param>
/// <param name="panStep">pan step</param>
- /// <exception cref="ArgumentException">In case of invalid parameters</exception>
+ /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void SetPan(CameraPtzMoveType type, int panStep)
{
/// <since_tizen> 3 </since_tizen>
/// <param name="type">ptz move type</param>
/// <param name="tiltStep">tilt step</param>
- /// <exception cref="ArgumentException">In case of invalid parameters</exception>
+ /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void SetTilt(CameraPtzMoveType type, int tiltStep)
{
/// </summary>
public class PreviewEventArgs : EventArgs
{
- internal PreviewEventArgs(PreviewData preview)
+ internal PreviewEventArgs(PreviewFrame preview)
{
Preview = preview;
}
/// PreviewData frame.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public PreviewData Preview { get; }
+ public PreviewFrame Preview { get; }
}
}
/// <summary>
/// The class containing preview image data.
/// </summary>
- public class PreviewData
+ public class PreviewFrame
{
- internal PreviewData(IntPtr ptr)
+ internal PreviewFrame(IntPtr ptr)
{
var unmanagedStruct = Marshal.PtrToStructure<CameraPreviewDataStruct>(ptr);
Format = unmanagedStruct.Format;
- Width = unmanagedStruct.Width;
- Height = unmanagedStruct.Height;
+ Resolution = new Size(unmanagedStruct.Width, unmanagedStruct.Height);
TimeStamp = unmanagedStruct.TimeStamp;
PlaneType = GetPlaneType(unmanagedStruct);
Plane = ConvertPlane(unmanagedStruct);
public CameraPixelFormat Format { get; }
/// <summary>
- /// The width of the image.
+ /// The resolution of the preview image.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public int Width { get; }
-
- /// <summary>
- /// The height of the image.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Height { get; }
+ public Size Resolution { get; }
/// <summary>
/// The timestamp of preview frame.
public uint TimeStamp { get; }
/// <summary>
- /// The buffer including preview frame.
+ /// The type of preview plane. <see cref="Tizen.Multimedia.PlaneType"/>
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public IPreviewPlane Plane { get; }
+ public PlaneType PlaneType { get; }
/// <summary>
- /// The type of preview plane. <see cref="Tizen.Multimedia.PlaneType"/>
+ /// The buffer including preview frame.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public PlaneType PlaneType { get; }
+ public IPreviewPlane Plane { get; }
}
}
\ No newline at end of file
namespace Tizen.Multimedia
{
/// <summary>
- /// The class containing the captured image data.
+ /// The class containing the captured still image.
/// </summary>
- public class ImageData
+ public class StillImage
{
- internal ImageData(IntPtr ptr)
+ internal StillImage(IntPtr ptr)
{
- var unmanagedStruct = Marshal.PtrToStructure<ImageDataStruct>(ptr);
+ var unmanagedStruct = Marshal.PtrToStructure<StillImageDataStruct>(ptr);
Format = unmanagedStruct.Format;
- Width = unmanagedStruct.Width;
- Height = unmanagedStruct.Height;
+ Resolution = new Size(unmanagedStruct.Width, unmanagedStruct.Height);
if (unmanagedStruct.Data != IntPtr.Zero && unmanagedStruct.DataLength > 0)
{
}
else
{
- Debug.Fail("ImageData is null!");
+ Debug.Fail("CameraStillImage Data is null!");
}
//Exif can be null
}
/// <summary>
- /// The pixel format of the captured image.
+ /// The pixel format of the still image.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public CameraPixelFormat Format { get; }
/// <summary>
- /// The width of the image.
+ /// The resolution of the still image.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public int Width { get; }
+ public Size Resolution { get; }
/// <summary>
- /// The height of the image.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int Height { get; }
-
- /// <summary>
- /// The buffer containing image data.
+ /// The buffer containing still image.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public byte[] Data { get; }
/// <summary>
- /// String containing Exif data.
+ /// The Exif data describing additional metadata of still image.
+ /// Please refer Exif specification for more details.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public byte[] Exif { get; }
}
}
-
internal delegate void InterruptedCallback(CameraPolicy policy, CameraState previous, CameraState current, IntPtr userData);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void InterruptStartedCallback(CameraPolicy policy, CameraState state, IntPtr userData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void FocusStateChangedCallback(CameraFocusState state, IntPtr userData);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[DllImport(Libraries.Camera, EntryPoint = "camera_remove_device_state_changed_cb")]
internal static extern CameraError UnsetDeviceStateChangedCallback(int cbId);
+ [DllImport(Libraries.Camera, EntryPoint = "camera_set_interrupt_started_cb")]
+ internal static extern CameraError SetInterruptStartedCallback(IntPtr handle, InterruptStartedCallback callback, IntPtr userData);
+
+ [DllImport(Libraries.Camera, EntryPoint = "camera_unset_interrupt_started_cb")]
+ internal static extern CameraError UnsetInterruptStartedCallback(IntPtr handle);
+
[DllImport(Libraries.Camera, EntryPoint = "camera_set_interrupted_cb")]
internal static extern CameraError SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData);
internal static extern CameraError UnsetHdrCaptureProgressCallback(IntPtr handle);
[StructLayout(LayoutKind.Sequential)]
- internal struct ImageDataStruct
+ internal struct StillImageDataStruct
{
internal IntPtr Data;
internal uint DataLength;
internal static partial class Interop
{
- internal static partial class CameraFeatures
+ internal static partial class CameraCapabilities
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate bool PreviewResolutionCallback(int Width, int Height, IntPtr userData);
internal static extern CameraError SupportedPreviewFpsByResolution(IntPtr handle, int width, int height, FpsByResolutionCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_af_mode")]
- internal static extern CameraError SupportedAfModes(IntPtr handle, AfModeCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedAutoFocusModes(IntPtr handle, AfModeCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_exposure_mode")]
internal static extern CameraError SupportedExposureModes(IntPtr handle, ExposureModeCallback callback, IntPtr userData);