Name: csapi-multimedia
Summary: Tizen Multimedia API for C#
-Version: 1.0.48
+Version: 1.0.49
Release: 0
Group: Development/Libraries
License: Apache-2.0
static internal class CameraLog
{
internal const string Tag = "Tizen.Multimedia.Camera";
+ internal const string Enter = "[Enter]";
+ internal const string Leave = "[Leave]";
}
/// <summary>
/// Initializes a new instance of the <see cref="Camera"/> Class.
/// </summary>
/// <param name="device">The camera device to access</param>
+ /// <privilege>
+ /// http://tizen.org/privilege/camera
+ /// </privilege>
public Camera(CameraDevice device)
{
CameraErrorFactory.ThrowIfError(Interop.Camera.Create((int)device, out _handle),
RegisterCallbacks();
- _state = CameraState.Created;
+ SetState(CameraState.Created);
}
/// <summary>
{
if (_disposed)
{
+ Log.Error(CameraLog.Tag, "Camera handle is disposed.");
throw new ObjectDisposedException(nameof(Camera));
}
}
/// <summary>
/// Gets the state of the camera.
/// </summary>
+ /// <value> None, Created, Preview, Capturing, Captured </value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraState State
{
get
{
+ ValidateNotDisposed();
+
CameraState val = CameraState.None;
CameraErrorFactory.ThrowIfError(Interop.Camera.GetState(_handle, out val),
"Failed to get camera state");
/// If the hint is set to true, the display will be reused when the camera device is changed with
/// ChangeDevice method.
/// </summary>
- /// <exception cref="ArgumentException">In case of invalid parameters</exception>
+ /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
+ /// <exception cref="InvalidOperationException">Invalid state.</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public bool DisplayReuseHint
{
get
{
+ ValidateNotDisposed();
+
bool val = false;
CameraErrorFactory.ThrowIfError(Interop.Camera.GetDisplayReuseHint(_handle, out val),
set
{
+ ValidateState(CameraState.Preview);
+
CameraErrorFactory.ThrowIfError(Interop.Camera.SetDisplayReuseHint(_handle, value),
"Failed to set display reuse hint.");
}
/// <summary>
/// Gets the facing direction of camera module.
/// </summary>
+ /// <value>A <see cref="CameraFacingDirection"/> that specifies the facing direction of camera device.</value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraFacingDirection Direction
{
get
{
+ ValidateNotDisposed();
+
CameraFacingDirection val = 0;
CameraErrorFactory.ThrowIfError(Interop.Camera.GetFacingDirection(_handle, out val),
/// <summary>
/// Gets the camera device count.
/// </summary>
- /// <remarks>
- /// This returns 2, if the device supports primary and secondary cameras.
- /// Otherwise 1, if the device only supports primary camera.
- /// </remarks>
+ /// <value>This returns 2, if the device supports primary and secondary cameras.
+ /// Otherwise 1, if the device only supports primary camera.</value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int CameraCount
{
get
{
+ ValidateNotDisposed();
+
int val = 0;
CameraErrorFactory.ThrowIfError(Interop.Camera.GetDeviceCount(_handle, out val),
return val;
}
}
-#endregion Properties
+ #endregion Properties
-#region Methods
+ #region Methods
/// <summary>
/// Changes the camera device.
/// </summary>
/// can be kept even though camera device is changed.
/// The camera must be in the <see cref="CameraState.Created"/> or <see cref="CameraState.Preview"/> state.
/// </remarks>
- /// <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 ChangeDevice 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 ChangeDevice feature is not supported.</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void ChangeDevice(CameraDevice device)
{
ValidateState(CameraState.Created, CameraState.Preview);
/// </privilege>
/// <param name="device">The device to get state.</param>
/// <returns>Returns the state of camera device</returns>
- /// <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>
+ /// <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)
{
int val = 0;
return (CameraDeviceState)val;
}
+ /// <summary>
+ /// Gets the flash state.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/camera
+ /// </privilege>
+ /// <param name="device">The device to get state.</param>
+ /// <returns>Returns the flash state of camera device</returns>
+ /// <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 static CameraFlashState GetFlashState(CameraDevice device)
{
CameraFlashState val = CameraFlashState.NotUsed;
/// <summary>
/// Starts capturing and drawing preview frames on the screen.
- /// The display handle must be set using <see cref="Tizen.Multimedia.Camera.SetDisplay"/>
+ /// The display handle must be set using <see cref="CameraDisplay.SetInfo"/>
/// before using this method.
- /// If needed set fps <see cref="Tizen.Multimedia.CameraSetting.PreviewFps"/>, preview resolution
- /// <see cref="Tizen.Multimedia.Camera.PreviewResolution"/>, or preview format <see cref="Tizen.Multimedia.Camera.PreviewFormat"/>
+ /// If needed set fps <see cref="CameraSettings.PreviewFps"/>, preview resolution
+ /// <see cref="CameraSettings.PreviewResolution"/>, or preview format <see cref="CameraSettings.PreviewPixelFormat"/>
/// before using this method.
+ /// The camera must be in the <see cref="CameraState.Created"/> or <see cref="CameraState.Captured"/> state.
/// </summary>
/// <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="UnauthorizedAccessException">In case of access to the resources cannot be granted</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>
public void StartPreview()
{
ValidateState(CameraState.Created, CameraState.Captured);
/// <summary>
/// Stops capturing and drawing preview frames on the screen.
+ /// The camera must be in the <see cref="CameraState.Preview"/> state.
/// </summary>
/// <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="UnauthorizedAccessException">In case of access to the resources cannot be granted</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>
public void StopPreview()
{
+ ValidateState(CameraState.Preview);
+
CameraErrorFactory.ThrowIfError(Interop.Camera.StopPreview(_handle),
"Failed to stop the camera preview.");
/// <summary>
/// Starts capturing of still images.
- /// EventHandler must be set for capturing using <see cref="Tizen.Multimedia.Camera.Capturing"/>
- /// and for completed using <see cref="Tizen.Multimedia.Camera.CaptureCompleted"/> before
- /// calling this method.
+ /// EventHandler must be set for capturing using <see cref="Capturing"/>
+ /// and for completed using <see cref="CaptureCompleted"/> before calling this method.
+ /// The camera must be in the <see cref="CameraState.Preview"/> state.
/// </summary>
/// <privilege>
/// http://tizen.org/privilege/camera
/// <remarks>
/// This function causes the transition of the camera state from Capturing to Captured
/// automatically and the corresponding EventHandlers will be invoked.
- /// The camera's preview should be restarted by calling <see cref="Tizen.Multimedia.Camera.StartPreview"/>
- /// method.
+ /// The preview should be restarted by calling <see cref="StartPreview"/> method after capture is completed.
/// </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="UnauthorizedAccessException">In case of access to the resources cannot be granted</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>
public void StartCapture()
{
ValidateState(CameraState.Preview);
/// <summary>
/// Starts continuously capturing still images.
- /// EventHandler must be set for capturing using <see cref="Tizen.Multimedia.Camera.Capturing"/>
- /// and for completed using <see cref="Tizen.Multimedia.Camera.CaptureCompleted"/> before
- /// calling this method.
+ /// EventHandler must be set for capturing using <see cref="Capturing"/>
+ /// and for completed using <see cref="CaptureCompleted"/> before calling this method.
+ /// The camera must be in the <see cref="CameraState.Preview"/> state.
/// </summary>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
/// <param name="count">The number of still images.</param>
/// <param name="interval">The interval of the capture(milliseconds).</param>
+ /// <param name="cancellationToken">The cancellation token to cancel capturing.</param>
+ /// <seealso cref="System.Threading.CancellationToken"/>
/// <remarks>
/// If this is not supported zero shutter lag occurs. The capture resolution could be
/// changed to the preview resolution. This function causes the transition of the camera state
/// from Capturing to Captured automatically and the corresponding Eventhandlers will be invoked.
- /// Each captured image will be delivered through Eventhandler set using <see cref="Tizen.Multimedia.Camera.Capturing"/> event.
- /// The camera's preview should be restarted by calling <see cref="Tizen.Multimedia.Camera.StartPreview"/> method.
+ /// Each captured image will be delivered through Eventhandler set using <see cref="Capturing"/> event.
+ /// The preview should be restarted by calling <see cref="StartPreview"/> method after capture is completed.
/// </remarks>
- /// <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="UnauthorizedAccessException">In case of access to the resources cannot be granted</exception>
+ /// <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.</exception>
+ /// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
public void StartCapture(int count, int interval, CancellationToken cancellationToken)
{
ValidateState(CameraState.Preview);
/// <summary>
/// Starts camera auto-focusing, asynchronously.
+ /// The camera must be in the <see cref="CameraState.Preview"/> or <see cref="CameraState.Captured"/> state.
/// </summary>
- /// <param name="continuous">Continuous.</param>
+ /// <param name="continuous">Continuous auto focus</param>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
/// <remarks>
/// If continuous status is true, the camera continuously tries to focus.
/// </remarks>
- /// <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="UnauthorizedAccessException">In case of access to the resources cannot be granted</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="ObjectDisposedException">The camera already has been disposed.</exception>
+ /// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
public void StartFocusing(bool continuous)
{
ValidateState(CameraState.Preview, CameraState.Captured);
/// <summary>
/// Stops camera auto focusing.
+ /// The camera must be in the <see cref="CameraState.Preview"/> or <see cref="CameraState.Captured"/> state.
/// </summary>
/// <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="UnauthorizedAccessException">In case of access to the resources cannot be granted</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>
public void StopFocusing()
{
ValidateState(CameraState.Preview, CameraState.Captured);
/// <summary>
/// Starts face detection.
+ /// The camera must be in the <see cref="CameraState.Preview"/> state.
/// </summary>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
/// <remarks>
- /// This should be called after <see cref="Tizen.Multimedia.Camera.StartPreview"/> is started.
- /// The Eventhandler set using <see cref="Tizen.Multimedia.Camera.FaceDetected"/> invoked when the face is detected in preview frame.
+ /// This should be called after <see cref="StartPreview"/> is started.
+ /// The Eventhandler set using <see cref="FaceDetected"/> invoked when the face is detected in preview frame.
/// Internally it starts continuous focus and focusing on the detected face.
/// </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="UnauthorizedAccessException">In case of access to the resources cannot be granted</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>
public void StartFaceDetection()
{
ValidateState(CameraState.Preview);
/// </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="ObjectDisposedException">The camera already has been disposed.</exception>
/// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted</exception>
public void StopFaceDetection()
{
{
_stateChangedCallback = (CameraState previous, CameraState current, bool byPolicy, IntPtr _) =>
{
- _state = current;
+ SetState(current);
Log.Info(CameraLog.Tag, "Camera state changed " + previous.ToString() + " -> " + current.ToString());
StateChanged?.Invoke(this, new CameraStateChangedEventArgs(previous, current, byPolicy));
};
/// <summary>
/// The display mode.
/// </summary>
+ /// <value>A <see cref="CameraDisplayMode"/> that specifies the display mode.</value>
+ /// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
public CameraDisplayMode Mode
{
get
/// The display visibility.
/// True if camera display visible, otherwise false.
/// </summary>
+ /// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
public bool Visible
{
get
/// <summary>
/// The display rotation.
/// </summary>
+ /// <value>A <see cref="CameraRotation"/> that specifies the rotation of camera device.</value>
/// <privilege>
/// http://tizen.org/privilege/camera.
/// </privilege>
+ /// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
public CameraRotation Rotation
{
get
/// <summary>
/// The display flip.
/// </summary>
+ /// <value>A <see cref="CameraFlip"/> that specifies camera flip type.</value>
/// <privilege>
/// http://tizen.org/privilege/camera.
/// </privilege>
+ /// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
public CameraFlip Flip
{
get
/// <summary>
/// the ROI(Region Of Interest) area of display.
/// </summary>
+ /// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
public Rectangle RoiArea
{
get
/// <summary>
/// Sets the display type and handle to show preview images.
+ /// The camera must be in the <see cref="CameraState.Created"/> state.
/// </summary>
/// <param name="displayType">Display type.</param>
/// <param name="preview">MediaView object to display preview.</param>
/// This method must be called before StartPreview() method.
/// In Custom ROI display mode, DisplayRoiArea property must be set before calling this method.
/// </remarks>
- /// <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="UnauthorizedAccessException">In case of access to the resources cannot be granted</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="ObjectDisposedException" > The camera already has been disposed.</exception>
+ /// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
public void SetInfo(CameraDisplayType displayType, MediaView displayHandle)
{
_camera.ValidateState(CameraState.Created);
internal static class CameraErrorFactory
{
- internal static void ThrowIfError(int errorCode, string errorMessage = null,
+ internal static void ThrowIfError(CameraError errorCode, string errorMessage = null,
[CallerMemberName] string caller = null, [CallerLineNumber] int line = 0)
{
- CameraError err = (CameraError)errorCode;
- if (err == CameraError.None)
+ if (errorCode == CameraError.None)
{
return;
}
- Log.Info(CameraLog.Tag, "errorCode : " + err.ToString() + ", Caller : " + caller + ", line " + line.ToString());
+ Log.Info(CameraLog.Tag, "errorCode : " + errorCode.ToString() + ", Caller : " + caller + ", line " + line.ToString());
- switch (err)
+ switch (errorCode)
{
case CameraError.InvalidParameter:
throw new ArgumentException(errorMessage);
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<CameraFlip> _streamFlips;
private List<CameraPtzType> _ptzTypes;
- private delegate int GetRangeDelegate(IntPtr handle, out int min, out int max);
+ private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
private delegate bool IsSupportedDelegate(IntPtr handle);
internal CameraFeatures(Camera camera)
int min = 0;
int max = 0;
- CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out min, out max), "Failed to check feature is suported or not.");
+ CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out min, out max),
+ "Failed to check feature is suported or not.");
return min < max;
}
/// It returns a list containing all the supported preview resolutions.
/// by recorder.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<Size> SupportedPreviewResolutions
{
get
{
if (_previewResolutions == null)
{
- _previewResolutions = new List<Size>();
-
- Interop.CameraFeatures.PreviewResolutionCallback callback = (int width, int height, IntPtr userData) =>
+ try
{
- _previewResolutions.Add(new Size(width, height));
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPreviewResolutions(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported preview resolutions");
+ _previewResolutions = new List<Size>();
+
+ Interop.CameraFeatures.PreviewResolutionCallback callback = (int width, int height, IntPtr userData) =>
+ {
+ _previewResolutions.Add(new Size(width, height));
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPreviewResolutions(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported preview resolutions");
+ }
+ catch
+ {
+ _previewResolutions = null;
+ throw;
+ }
}
return _previewResolutions;
/// <returns>
/// It returns a list containing all the supported capture resolutions.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<Size> SupportedCaptureResolutions
{
get
{
if (_cameraResolutions == null)
{
- _cameraResolutions = new List<Size>();
-
- Interop.CameraFeatures.CaptureResolutionCallback callback = (int width, int height, IntPtr userData) =>
+ try
{
- _cameraResolutions.Add(new Size(width, height));
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedCaptureResolutions(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported capture resolutions");
+ _cameraResolutions = new List<Size>();
+
+ Interop.CameraFeatures.CaptureResolutionCallback callback = (int width, int height, IntPtr userData) =>
+ {
+ _cameraResolutions.Add(new Size(width, height));
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedCaptureResolutions(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported capture resolutions");
+ }
+ catch
+ {
+ _cameraResolutions = null;
+ throw;
+ }
}
return _cameraResolutions;
/// Retrieves all the capture formats supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported capture formats.
+ /// It returns a list containing all the supported <see cref="CameraPixelFormat"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraPixelFormat> SupportedCapturePixelFormats
{
get
{
if (_captureFormats == null)
{
- _captureFormats = new List<CameraPixelFormat>();
-
- Interop.CameraFeatures.CaptureFormatCallback callback = (CameraPixelFormat format, IntPtr userData) =>
+ try
{
- _captureFormats.Add(format);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedCapturePixelFormats(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported capture formats.");
+ _captureFormats = new List<CameraPixelFormat>();
+
+ Interop.CameraFeatures.CaptureFormatCallback callback = (CameraPixelFormat format, IntPtr userData) =>
+ {
+ _captureFormats.Add(format);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedCapturePixelFormats(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported capture formats.");
+ }
+ catch
+ {
+ _captureFormats = null;
+ throw;
+ }
}
return _captureFormats;
/// Retrieves all the preview formats supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported preview formats.
+ /// It returns a list containing all the supported <see cref="CameraPixelFormat"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraPixelFormat> SupportedPreviewPixelFormats
{
get
{
if (_previewFormats == null)
{
- _previewFormats = new List<CameraPixelFormat>();
-
- Interop.CameraFeatures.PreviewFormatCallback callback = (CameraPixelFormat format, IntPtr userData) =>
+ try
{
- _previewFormats.Add(format);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPreviewPixelFormats(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported preview formats.");
+ _previewFormats = new List<CameraPixelFormat>();
+
+ Interop.CameraFeatures.PreviewFormatCallback callback = (CameraPixelFormat format, IntPtr userData) =>
+ {
+ _previewFormats.Add(format);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPreviewPixelFormats(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported preview formats.");
+ }
+ catch
+ {
+ _previewFormats = null;
+ throw;
+ }
}
return _previewFormats;
/// Retrieves all the fps supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported fps.
+ /// It returns a list containing all the supported <see cref="CameraFps"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraFps> SupportedPreviewFps
{
get
{
if (_fps == null)
{
- _fps = new List<CameraFps>();
-
- Interop.CameraFeatures.FpsCallback callback = (CameraFps fps, IntPtr userData) =>
+ try
{
- _fps.Add(fps);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPreviewFps(_camera.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported camera fps");
+ _fps = new List<CameraFps>();
+
+ Interop.CameraFeatures.FpsCallback callback = (CameraFps fps, IntPtr userData) =>
+ {
+ _fps.Add(fps);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPreviewFps(_camera.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported camera fps");
+ }
+ catch
+ {
+ _fps = null;
+ throw;
+ }
}
return _fps;
/// Retrieves all the fps by resolution supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported fps by resolution.
+ /// It returns a list containing all the supported <see cref="CameraFps"/> by resolution.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraFps> GetSupportedPreviewFpsByResolution(int width, int height)
{
- var result = new List<CameraFps>();
-
- Interop.CameraFeatures.FpsByResolutionCallback callback = (CameraFps fps, IntPtr userData) =>
+ if (_fpsByResolution == null)
{
- result.Add(fps);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPreviewFpsByResolution(_camera.GetHandle(),
- width, height, callback, IntPtr.Zero), "Failed to get the supported fps by resolutions.");
+ try
+ {
+ _fpsByResolution = new List<CameraFps>();
- return result;
+ Interop.CameraFeatures.FpsByResolutionCallback callback = (CameraFps fps, IntPtr userData) =>
+ {
+ _fpsByResolution.Add(fps);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPreviewFpsByResolution(_camera.GetHandle(),
+ width, height, callback, IntPtr.Zero), "Failed to get the supported fps by resolutions.");
+ }
+ catch
+ {
+ _fpsByResolution = null;
+ throw;
+ }
+ }
+
+ return _fpsByResolution;
}
/// <summary>
/// Retrieves all the fps by resolution supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported fps by resolution.
+ /// It returns a list containing all the supported <see cref="CameraFps"/> by resolution.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraFps> GetSupportedPreviewFpsByResolution(Size size)
{
return GetSupportedPreviewFpsByResolution(size.Width, size.Height);
}
/// <summary>
- /// Retrieves all the fps by resolution supported by the camera.
+ /// Retrieves all the auto focus modes supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported fps by resolution.
+ /// It returns a list containing all the supported <see cref="CameraAutoFocusMode"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraAutoFocusMode> SupportedAutoFocusModes
{
get
{
if (_autoFocusModes == null)
{
- _autoFocusModes = new List<CameraAutoFocusMode>();
-
- Interop.CameraFeatures.AfModeCallback callback = (CameraAutoFocusMode mode, IntPtr userData) =>
+ try
{
- _autoFocusModes.Add(mode);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedAfModes(_camera.GetHandle(), callback, IntPtr.Zero),
+ _autoFocusModes = new List<CameraAutoFocusMode>();
+
+ Interop.CameraFeatures.AfModeCallback callback = (CameraAutoFocusMode mode, IntPtr userData) =>
+ {
+ _autoFocusModes.Add(mode);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedAfModes(_camera.GetHandle(), callback, IntPtr.Zero),
"Failed to get the supported Auto focus modes.");
+ }
+ catch
+ {
+ _autoFocusModes = null;
+ throw;
+ }
}
return _autoFocusModes;
/// Retrieves all the exposure modes supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported camera exposure modes.
+ /// It returns a list containing all the supported <see cref="CameraExposureMode"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraExposureMode> SupportedExposureModes
{
get
{
if (_exposureModes == null)
{
- _exposureModes = new List<CameraExposureMode>();
-
- Interop.CameraFeatures.ExposureModeCallback callback = (CameraExposureMode mode, IntPtr userData) =>
+ try
{
- _exposureModes.Add(mode);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedExposureModes(_camera.GetHandle(), callback, IntPtr.Zero),
+ _exposureModes = new List<CameraExposureMode>();
+
+ Interop.CameraFeatures.ExposureModeCallback callback = (CameraExposureMode mode, IntPtr userData) =>
+ {
+ _exposureModes.Add(mode);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedExposureModes(_camera.GetHandle(), callback, IntPtr.Zero),
"Failed to get the supported Exposure modes.");
+ }
+ catch
+ {
+ _exposureModes = null;
+ throw;
+ }
}
return _exposureModes;
/// Retrieves all the Iso level supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported camera Iso levels.
+ /// It returns a list containing all the supported <see cref="CameraIsoLevel"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraIsoLevel> SupportedIsoLevels
{
get
{
if (_isoLevels == null)
{
- _isoLevels = new List<CameraIsoLevel>();
-
- Interop.CameraFeatures.IsoCallback callback = (CameraIsoLevel iso, IntPtr userData) =>
+ try
{
- _isoLevels.Add(iso);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedIso(_camera.GetHandle(), callback, IntPtr.Zero),
+ _isoLevels = new List<CameraIsoLevel>();
+
+ Interop.CameraFeatures.IsoCallback callback = (CameraIsoLevel iso, IntPtr userData) =>
+ {
+ _isoLevels.Add(iso);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedIso(_camera.GetHandle(), callback, IntPtr.Zero),
"Failed to get the supported Iso levels.");
+ }
+ catch
+ {
+ _isoLevels = null;
+ throw;
+ }
}
return _isoLevels;
/// Retrieves all the theater modes supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported camera theater modes.
+ /// It returns a list containing all the supported <see cref="CameraTheaterMode"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraTheaterMode> SupportedTheaterModes
{
get
{
if (_theaterModes == null)
{
- _theaterModes = new List<CameraTheaterMode>();
-
- Interop.CameraFeatures.TheaterModeCallback callback = (CameraTheaterMode theaterMode, IntPtr userData) =>
+ try
{
- _theaterModes.Add(theaterMode);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedTheaterModes(_camera.GetHandle(), callback, IntPtr.Zero),
+ _theaterModes = new List<CameraTheaterMode>();
+
+ Interop.CameraFeatures.TheaterModeCallback callback = (CameraTheaterMode theaterMode, IntPtr userData) =>
+ {
+ _theaterModes.Add(theaterMode);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedTheaterModes(_camera.GetHandle(), callback, IntPtr.Zero),
"Failed to get the supported theater modes.");
+ }
+ catch
+ {
+ _theaterModes = null;
+ throw;
+ }
}
return _theaterModes;
}
/// <summary>
- /// Retrieves all the whitebalance mode supported by the camera.
+ /// Retrieves all the whitebalance modes supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported camera white balance modes.
+ /// It returns a list containing all the supported <see cref="CameraWhiteBalance"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraWhiteBalance> SupportedWhiteBalances
{
get
{
if (_whitebalances == null)
{
- _whitebalances = new List<CameraWhiteBalance>();
-
- Interop.CameraFeatures.WhitebalanceCallback callback = (CameraWhiteBalance whiteBalance, IntPtr userData) =>
+ try
{
- _whitebalances.Add(whiteBalance);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedWhitebalance(_camera.GetHandle(), callback, IntPtr.Zero),
+ _whitebalances = new List<CameraWhiteBalance>();
+
+ Interop.CameraFeatures.WhitebalanceCallback callback = (CameraWhiteBalance whiteBalance, IntPtr userData) =>
+ {
+ _whitebalances.Add(whiteBalance);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedWhitebalance(_camera.GetHandle(), callback, IntPtr.Zero),
"Failed to get the supported white balance.");
+ }
+ catch
+ {
+ _whitebalances = null;
+ throw;
+ }
}
return _whitebalances;
/// Retrieves all the flash modes supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported camera flash modes.
+ /// It returns a list containing all the supported <see cref="CameraFlashMode"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraFlashMode> SupportedFlashModes
{
get
{
if (_flashModes == null)
{
- _flashModes = new List<CameraFlashMode>();
-
- Interop.CameraFeatures.FlashModeCallback callback = (CameraFlashMode flashMode, IntPtr userData) =>
+ try
{
- _flashModes.Add(flashMode);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedFlashModes(_camera.GetHandle(), callback, IntPtr.Zero),
+ _flashModes = new List<CameraFlashMode>();
+
+ Interop.CameraFeatures.FlashModeCallback callback = (CameraFlashMode flashMode, IntPtr userData) =>
+ {
+ _flashModes.Add(flashMode);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedFlashModes(_camera.GetHandle(), callback, IntPtr.Zero),
"Failed to get the supported flash modes.");
+ }
+ catch
+ {
+ _flashModes = null;
+ throw;
+ }
}
return _flashModes;
/// Retrieves all the scene modes supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported camera scene modes.
+ /// It returns a list containing all the supported <see cref="CameraSceneMode"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraSceneMode> SupportedSceneModes
{
get
{
if (_sceneModes == null)
{
- _sceneModes = new List<CameraSceneMode>();
-
- Interop.CameraFeatures.SceneModeCallback callback = (CameraSceneMode sceneMode, IntPtr userData) =>
+ try
{
- _sceneModes.Add(sceneMode);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedSceneModes(_camera.GetHandle(), callback, IntPtr.Zero),
+ _sceneModes = new List<CameraSceneMode>();
+
+ Interop.CameraFeatures.SceneModeCallback callback = (CameraSceneMode sceneMode, IntPtr userData) =>
+ {
+ _sceneModes.Add(sceneMode);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedSceneModes(_camera.GetHandle(), callback, IntPtr.Zero),
"Failed to get the supported scene modes.");
+ }
+ catch
+ {
+ _sceneModes = null;
+ throw;
+ }
}
return _sceneModes;
}
/// <summary>
- /// Retrieves all the effects supported by the camera.
+ /// Retrieves all the effect modes supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported camera effects.
+ /// It returns a list containing all the supported <see cref="CameraEffectMode"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraEffectMode> SupportedEffects
{
get
{
if (_effectModes == null)
{
- _effectModes = new List<CameraEffectMode>();
-
- Interop.CameraFeatures.EffectCallback callback = (CameraEffectMode effect, IntPtr userData) =>
+ try
{
- _effectModes.Add(effect);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedEffects(_camera.GetHandle(), callback, IntPtr.Zero),
+ _effectModes = new List<CameraEffectMode>();
+
+ Interop.CameraFeatures.EffectCallback callback = (CameraEffectMode effect, IntPtr userData) =>
+ {
+ _effectModes.Add(effect);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedEffects(_camera.GetHandle(), callback, IntPtr.Zero),
"Failed to get the supported camera effects.");
+ }
+ catch
+ {
+ _effectModes = null;
+ throw;
+ }
}
return _effectModes;
/// Retrieves all the stream rotation supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported camera stream rotations.
+ /// It returns a list containing all the supported <see cref="CameraRotation"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraRotation> SupportedStreamRotations
{
get
{
if (_streamRotations == null)
{
- _streamRotations = new List<CameraRotation>();
-
- Interop.CameraFeatures.StreamRotationCallback callback = (CameraRotation streamRotation, IntPtr userData) =>
+ try
{
- _streamRotations.Add(streamRotation);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedStreamRotations(_camera.GetHandle(), callback, IntPtr.Zero),
+ _streamRotations = new List<CameraRotation>();
+
+ Interop.CameraFeatures.StreamRotationCallback callback = (CameraRotation streamRotation, IntPtr userData) =>
+ {
+ _streamRotations.Add(streamRotation);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedStreamRotations(_camera.GetHandle(), callback, IntPtr.Zero),
"Failed to get the supported camera rotations.");
+ }
+ catch
+ {
+ _streamRotations = null;
+ throw;
+ }
}
return _streamRotations;
/// Retrieves all the flips supported by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported camera flip.
+ /// It returns a list containing all the supported <see cref="CameraFlip"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraFlip> SupportedStreamFlips
{
get
{
if (_streamFlips == null)
{
- _streamFlips = new List<CameraFlip>();
-
- Interop.CameraFeatures.StreamFlipCallback callback = (CameraFlip streamFlip, IntPtr userData) =>
+ try
{
- _streamFlips.Add(streamFlip);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedStreamFlips(_camera.GetHandle(), callback, IntPtr.Zero),
+ _streamFlips = new List<CameraFlip>();
+
+ Interop.CameraFeatures.StreamFlipCallback callback = (CameraFlip streamFlip, IntPtr userData) =>
+ {
+ _streamFlips.Add(streamFlip);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedStreamFlips(_camera.GetHandle(), callback, IntPtr.Zero),
"Failed to get the supported camera flips.");
+ }
+ catch
+ {
+ _streamFlips = null;
+ throw;
+ }
}
return _streamFlips;
/// Retrieves all the ptz types by the camera.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported ptz types.
+ /// It returns a list containing all the supported <see cref="CameraPtzType"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<CameraPtzType> SupportedPtzTypes
{
get
{
if (_ptzTypes.Count == 0)
{
- _ptzTypes = new List<CameraPtzType>();
-
- Interop.CameraFeatures.PtzTypeCallback callback = (CameraPtzType ptzType, IntPtr userData) =>
+ try
{
- _ptzTypes.Add(ptzType);
- return true;
- };
- CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPtzTypes(_camera.GetHandle(), callback, IntPtr.Zero),
+ _ptzTypes = new List<CameraPtzType>();
+
+ Interop.CameraFeatures.PtzTypeCallback callback = (CameraPtzType ptzType, IntPtr userData) =>
+ {
+ _ptzTypes.Add(ptzType);
+ return true;
+ };
+ CameraErrorFactory.ThrowIfError(Interop.CameraFeatures.SupportedPtzTypes(_camera.GetHandle(), callback, IntPtr.Zero),
"Failed to get the supported Ptz types.");
+ }
+ catch
+ {
+ _ptzTypes = null;
+ throw;
+ }
}
return _ptzTypes;
_tiltRange = GetRange(Interop.CameraSettings.GetTiltRange);
}
- private delegate int GetRangeDelegate(IntPtr handle, out int min, out int max);
+ private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
private Range? GetRange(GetRangeDelegate func)
{
int min = 0;
/// <summary>
/// Sets auto focus area.
/// </summary>
+ /// <remarks>
+ /// <see cref="CameraAutoFocusMode"/> should not be the <see cref="CameraAutoFocusMode.None"/>.
+ /// </remarks>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
/// <param name="x">X position</param>
/// <param name="y">Y position</param>
- /// <exception cref="ArgumentException">In case of invalid parameters</exception>
+ /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
+ /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void SetAutoFocusArea(int x, int y)
{
CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetAutoFocusArea(_camera.GetHandle(), x, y),
"Failed to set the autofocus area.");
}
+ /// <summary>
+ /// Sets auto focus area.
+ /// </summary>
+ /// <remarks>
+ /// <see cref="CameraAutoFocusMode"/> should not be the <see cref="CameraAutoFocusMode.None"/>.
+ /// </remarks>
+ /// <privilege>
+ /// http://tizen.org/privilege/camera
+ /// </privilege>
+ /// <param name="pos"><see cref="Point"/> structure including X, Y position</param>
+ /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
+ /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void SetAutoFocusArea(Point pos)
{
CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetAutoFocusArea(_camera.GetHandle(), pos.X, pos.Y),
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void ClearFocusArea()
{
CameraErrorFactory.ThrowIfError(Interop.CameraSettings.ClearAutoFocusArea(_camera.GetHandle()),
/// <summary>
/// The auto focus mode.
/// </summary>
+ /// <value>A <see cref="CameraAutoFocusMode"/> that specifies the auto focus mode.</value>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraAutoFocusMode AutoFocusMode
{
get
"Failed to set camera autofocus mode.");
}
}
- #endregion Auto Focus
+#endregion Auto Focus
#region Contrast
/// <summary>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int Contrast
{
get
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public bool AutoContrast
{
get
/// <remarks>
/// If min value is greater than the max value, it means this feature is not supported.
/// </remarks>
+ /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
public Range ContrastRange
{
get
{
- if (_contrastRange.HasValue == false)
+ if (!_contrastRange.HasValue)
{
throw new NotSupportedException("Contrast is not supported.");
}
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int Brightness
{
get
/// <remarks>
/// If min value is greater than the max value, it means this feature is not supported.
/// </remarks>
+ /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
public Range BrightnessRange
{
get
{
- if (_brightnessRange.HasValue == false)
+ if (!_brightnessRange.HasValue)
{
throw new NotSupportedException("Brightness is not supported.");
}
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int Exposure
{
get
/// <summary>
/// The exposure mode.
/// </summary>
+ /// <value>A <see cref="CameraExposureMode"/> that specifies the exposure mode.</value>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraExposureMode ExposureMode
{
get
/// <remarks>
/// If min value is greater than the max value, it means this feature is not supported.
/// </remarks>
+ /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
public Range ExposureRange
{
get
{
- if (_exposureRange.HasValue == false)
+ if (!_exposureRange.HasValue)
{
throw new NotSupportedException("Exposure is not supported.");
}
return _exposureRange.Value;
}
}
- #endregion Exposure
+#endregion Exposure
#region Zoom
/// <summary>
/// <privilege>
/// http://tizen.org/privilege/camera.
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int ZoomLevel
{
get
/// <remarks>
/// If min value is greater than the max value, it means this feature is not supported.
/// </remarks>
+ /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
public Range ZoomRange
{
get
{
- if (_zoomRange.HasValue == false)
+ if (!_zoomRange.HasValue)
{
throw new NotSupportedException("Zoom is not supported.");
}
/// <summary>
/// The whitebalance mode.
/// </summary>
+ /// <value>A <see cref="CameraWhiteBalance"/> that specifies the white balance mode.</value>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraWhiteBalance WhiteBalance
{
get
/// <summary>
/// The ISO level.
/// </summary>
+ /// <value>A <see cref="CameraIsoLevel"/> that specifies ISO level.</value>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraIsoLevel IsoLevel
{
get
/// <privilege>
/// http://tizen.org/privilege/camera.
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int ImageQuality
{
get
/// <summary>
/// The preview frame rate.
/// </summary>
+ /// <value>A <see cref="CameraFps"/> that specifies preview frame rate.</value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraFps PreviewFps
{
get
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
- /// <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 Size PreviewResolution
{
get
/// Depending on the capture resolution aspect ratio and display resolution,
/// the recommended preview resolution is determined.
/// </remarks>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public Size RecommendedPreviewResolution
{
get
/// <summary>
/// The preview data format.
/// </summary>
- /// <exception cref="ArgumentException">In case of invalid parameters</exception>
+ /// <value>A <see cref="CameraPixelFormat"/> that specifies the pixel format of preview data.</value>
+ /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraPixelFormat PreviewPixelFormat
{
get
/// http://tizen.org/privilege/camera
/// </privilege>
/// <exception cref="ArgumentException">In case of invalid parameters</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public Size CaptureResolution
{
get
/// <summary>
/// Format of an image to be captured.
/// </summary>
+ /// <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="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraPixelFormat CapturePixelFormat
{
get
/// <summary>
/// The bit rate of encoded preview.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int EncodedPreviewBitrate
{
get
/// <summary>
/// GOP(Group Of Pictures) interval of encoded preview.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int EncodedPreviewGopInterval
{
get
/// <summary>
/// The theater mode.
/// </summary>
+ /// <value>A <see cref="CameraTheaterMode"/> that specifies theater mode.</value>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
/// If you want to display the preview image on the external display with the full screen mode,
/// use this property.
/// </remarks>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraTheaterMode TheaterMode
{
get
/// <summary>
/// The camera effect mode.
/// </summary>
+ /// <value>A <see cref="CameraEffectMode"/> that specifies effect mode.</value>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraEffectMode Effect
{
get
/// <summary>
/// The scene mode.
/// </summary>
+ /// <value>A <see cref="CameraSceneMode"/> that specifies scene mode.</value>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraSceneMode SceneMode
{
get
/// <summary>
/// The camera's flash mode.
/// </summary>
+ /// <value>A <see cref="CameraFlashMode"/> that specifies flash mode.</value>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraFlashMode FlashMode
{
get
/// <summary>
/// Gets the camera lens orientation angle.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int LensOrientation
{
get
/// <summary>
/// The stream rotation.
/// </summary>
+ /// <value>A <see cref="CameraRotation"/> that specifies the rotation of camera device.</value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraRotation StreamRotation
{
get
/// <summary>
/// The stream flip.
/// </summary>
+ /// <value>A <see cref="CameraFlip"/> that specifies camera flip type.</value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraFlip StreamFlip
{
get
/// <summary>
/// The mode of HDR(High dynamic range) capture.
/// </summary>
+ /// <value>A <see cref="CameraHdrMode"/> that specifies the HDR mode.</value>
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
/// so that we eventually arrive at a picture that is representative in both dark and bright areas.
/// If this attribute is set, then eventhandler set for HdrCaptureProgress event is invoked.
/// </remarks>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraHdrMode HdrMode
{
get
/// The anti shake feature.
/// If true the antishake feature is enabled, otherwise false.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public bool AntiShake
{
get
/// If video stabilization is enabled, zero shutter lag is disabled.
/// This feature is used to record a video.
/// </remarks>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public bool VideoStabilization
{
get
/// <remarks>
/// In some countries, this operation is not permitted.
/// </remarks>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public bool DisableShutterSound
{
set
/// <summary>
/// Sets the type of PTZ(Pan Tilt Zoom). Mechanical or Electronic.
/// </summary>
+ /// <value>A <see cref="CameraPtzType"/> that specifies the type of PTZ.</value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraPtzType PtzType
{
set
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
- /// <param name="type">ptz move type.</param>
+ /// <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="ObjectDisposedException">The camera already has been disposed.</exception>
public void SetPan(CameraPtzMoveType type, int panStep)
{
CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetPan(_camera.GetHandle(), type, panStep),
/// http://tizen.org/privilege/camera
/// </privilege>
/// <returns>Returns the camera's horizontal position</returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int GetPan()
{
int val = 0;
/// <param name="type">ptz move type</param>
/// <param name="tiltStep">tilt step</param>
/// <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)
{
CameraErrorFactory.ThrowIfError(Interop.CameraSettings.SetTilt(_camera.GetHandle(), type, tiltStep),
/// http://tizen.org/privilege/camera
/// </privilege>
/// <returns>Returns the current vertical position</returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int GetTilt()
{
int val = 0;
/// <remarks>
/// If min value is greater than the max value, it means this feature is not supported.
/// </remarks>
+ /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
public Range PanRange
{
get
{
- if (_panRange.HasValue == false)
+ if (!_panRange.HasValue)
{
throw new NotSupportedException("Pan is not supported.");
}
/// <remarks>
/// If min value is greater than the max value, it means this feature is not supported.
/// </remarks>
+ /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
public Range TiltRange
{
get
{
- if (_tiltRange.HasValue == false)
+ if (!_tiltRange.HasValue)
{
throw new NotSupportedException("Tilt is not supported.");
}
/// The scene mode.
/// true if EXIF tags are enabled in JPEG file, otherwise false.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public bool EnableTag
{
get
/// <summary>
/// The camera image description in the EXIF tag.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public string ImageDescriptionTag
{
get
/// <summary>
/// The software information in the EXIF tag.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public string SoftwareTag
{
get
/// <summary>
/// The geotag(GPS data) in the EXIF tag.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public Location GeoTag
{
get
/// <privilege>
/// http://tizen.org/privilege/camera
/// </privilege>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void RemoveGeoTag()
{
CameraErrorFactory.ThrowIfError(Interop.CameraSettings.RemoveGeotag(_camera.GetHandle()),
/// <summary>
/// The camera orientation in the tag.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public CameraTagOrientation OrientationTag
{
get
internal delegate void DeviceStateChangedCallback(CameraDevice device, CameraDeviceState state, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_create")]
- internal static extern int Create(int device, out IntPtr handle);
+ internal static extern CameraError Create(int device, out IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_change_device")]
- internal static extern int ChangeDevice(IntPtr handle, int device);
+ internal static extern CameraError ChangeDevice(IntPtr handle, int device);
[DllImport(Libraries.Camera, EntryPoint = "camera_destroy")]
- internal static extern int Destroy(IntPtr handle);
+ internal static extern CameraError Destroy(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_device_count")]
- internal static extern int GetDeviceCount(IntPtr handle, out int count);
+ internal static extern CameraError GetDeviceCount(IntPtr handle, out int count);
[DllImport(Libraries.Camera, EntryPoint = "camera_start_preview")]
- internal static extern int StartPreview(IntPtr handle);
+ internal static extern CameraError StartPreview(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_stop_preview")]
- internal static extern int StopPreview(IntPtr handle);
+ internal static extern CameraError StopPreview(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_device_state")]
- internal static extern int GetDeviceState(CameraDevice device, out int state);
+ internal static extern CameraError GetDeviceState(CameraDevice device, out int state);
[DllImport(Libraries.Camera, EntryPoint = "camera_start_capture")]
- internal static extern int StartCapture(IntPtr handle, CapturingCallback captureCallback,
+ internal static extern CameraError StartCapture(IntPtr handle, CapturingCallback captureCallback,
CaptureCompletedCallback completedCallback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_start_continuous_capture")]
- internal static extern int StartContinuousCapture(IntPtr handle, int count, int interval,
+ internal static extern CameraError StartContinuousCapture(IntPtr handle, int count, int interval,
CapturingCallback captureCallback, CaptureCompletedCallback completedCallback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_stop_continuous_capture")]
- internal static extern int StopContinuousCapture(IntPtr handle);
+ internal static extern CameraError StopContinuousCapture(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_state")]
- internal static extern int GetState(IntPtr handle, out CameraState state);
+ internal static extern CameraError GetState(IntPtr handle, out CameraState state);
[DllImport(Libraries.Camera, EntryPoint = "camera_start_focusing")]
- internal static extern int StartFocusing(IntPtr handle, bool continuous);
+ internal static extern CameraError StartFocusing(IntPtr handle, bool continuous);
[DllImport(Libraries.Camera, EntryPoint = "camera_cancel_focusing")]
- internal static extern int CancelFocusing(IntPtr handle);
+ internal static extern CameraError CancelFocusing(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_resolution")]
- internal static extern int SetPreviewResolution(IntPtr handle, int width, int height);
+ internal static extern CameraError SetPreviewResolution(IntPtr handle, int width, int height);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_preview_resolution")]
- internal static extern int GetPreviewResolution(IntPtr handle, out int width, out int height);
+ internal static extern CameraError GetPreviewResolution(IntPtr handle, out int width, out int height);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_recommended_preview_resolution")]
- internal static extern int GetRecommendedPreviewResolution(IntPtr handle, out int width, out int height);
+ internal static extern CameraError GetRecommendedPreviewResolution(IntPtr handle, out int width, out int height);
[DllImport(Libraries.Camera, EntryPoint = "camera_start_face_detection")]
- internal static extern int StartFaceDetection(IntPtr handle, FaceDetectedCallback callback, IntPtr userData);
+ internal static extern CameraError StartFaceDetection(IntPtr handle, FaceDetectedCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_stop_face_detection")]
- internal static extern int StopFaceDetection(IntPtr handle);
+ internal static extern CameraError StopFaceDetection(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_display_reuse_hint")]
- internal static extern int SetDisplayReuseHint(IntPtr handle, bool hint);
+ internal static extern CameraError SetDisplayReuseHint(IntPtr handle, bool hint);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_display_reuse_hint")]
- internal static extern int GetDisplayReuseHint(IntPtr handle, out bool hint);
+ internal static extern CameraError GetDisplayReuseHint(IntPtr handle, out bool hint);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_capture_resolution")]
- internal static extern int SetCaptureResolution(IntPtr handle, int width, int height);
+ internal static extern CameraError SetCaptureResolution(IntPtr handle, int width, int height);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_capture_resolution")]
- internal static extern int GetCaptureResolution(IntPtr handle, out int width, out int height);
+ internal static extern CameraError GetCaptureResolution(IntPtr handle, out int width, out int height);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_capture_format")]
- internal static extern int SetCaptureFormat(IntPtr handle, CameraPixelFormat format);
+ internal static extern CameraError SetCaptureFormat(IntPtr handle, CameraPixelFormat format);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_capture_format")]
- internal static extern int GetCaptureFormat(IntPtr handle, out CameraPixelFormat format);
+ internal static extern CameraError GetCaptureFormat(IntPtr handle, out CameraPixelFormat format);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_format")]
- internal static extern int SetPreviewPixelFormat(IntPtr handle, CameraPixelFormat format);
+ internal static extern CameraError SetPreviewPixelFormat(IntPtr handle, CameraPixelFormat format);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_preview_format")]
- internal static extern int GetPreviewPixelFormat(IntPtr handle, out CameraPixelFormat format);
+ internal static extern CameraError GetPreviewPixelFormat(IntPtr handle, out CameraPixelFormat format);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_facing_direction")]
- internal static extern int GetFacingDirection(IntPtr handle, out CameraFacingDirection direction);
+ internal static extern CameraError GetFacingDirection(IntPtr handle, out CameraFacingDirection direction);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_flash_state")]
- internal static extern int GetFlashState(CameraDevice device, out CameraFlashState state);
+ internal static extern CameraError GetFlashState(CameraDevice device, out CameraFlashState state);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_cb")]
- internal static extern int SetPreviewCallback(IntPtr handle, PreviewCallback callback, IntPtr userData);
+ internal static extern CameraError SetPreviewCallback(IntPtr handle, PreviewCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_unset_preview_cb")]
- internal static extern int UnsetPreviewCallback(IntPtr handle);
+ internal static extern CameraError UnsetPreviewCallback(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_media_packet_preview_cb")]
- internal static extern int SetMediaPacketPreviewCallback(IntPtr handle, MediaPacketPreviewCallback callback, IntPtr userData);
+ internal static extern CameraError SetMediaPacketPreviewCallback(IntPtr handle, MediaPacketPreviewCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_unset_media_packet_preview_cb")]
- internal static extern int UnsetMediaPacketPreviewCallback(IntPtr handle);
+ internal static extern CameraError UnsetMediaPacketPreviewCallback(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_state_changed_cb")]
- internal static extern int SetStateChangedCallback(IntPtr handle, StateChangedCallback callback, IntPtr userData);
+ internal static extern CameraError SetStateChangedCallback(IntPtr handle, StateChangedCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_add_device_state_changed_cb")]
- internal static extern int SetDeviceStateChangedCallback(DeviceStateChangedCallback callback, IntPtr userData, out int callbackId);
+ internal static extern CameraError SetDeviceStateChangedCallback(DeviceStateChangedCallback callback, IntPtr userData, out int callbackId);
[DllImport(Libraries.Camera, EntryPoint = "camera_unset_state_changed_cb")]
- internal static extern int UnsetStateChangedCallback(IntPtr handle);
+ internal static extern CameraError UnsetStateChangedCallback(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_remove_device_state_changed_cb")]
- internal static extern int UnsetDeviceStateChangedCallback(int cbId);
+ internal static extern CameraError UnsetDeviceStateChangedCallback(int cbId);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_interrupted_cb")]
- internal static extern int SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData);
+ internal static extern CameraError SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_unset_interrupted_cb")]
- internal static extern int UnsetInterruptedCallback(IntPtr handle);
+ internal static extern CameraError UnsetInterruptedCallback(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_focus_changed_cb")]
- internal static extern int SetFocusStateChangedCallback(IntPtr handle, FocusStateChangedCallback callback, IntPtr userData);
+ internal static extern CameraError SetFocusStateChangedCallback(IntPtr handle, FocusStateChangedCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_unset_focus_changed_cb")]
- internal static extern int UnsetFocusChangedCallback(IntPtr handle);
+ internal static extern CameraError UnsetFocusChangedCallback(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_error_cb")]
- internal static extern int SetErrorCallback(IntPtr handle, ErrorCallback callback, IntPtr userData);
+ internal static extern CameraError SetErrorCallback(IntPtr handle, ErrorCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_unset_error_cb")]
- internal static extern int UnsetErrorCallback(IntPtr handle);
+ internal static extern CameraError UnsetErrorCallback(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_hdr_capture_progress_cb")]
- internal static extern int SetHdrCaptureProgressCallback(IntPtr handle, HdrCaptureProgressCallback callback, IntPtr userData);
+ internal static extern CameraError SetHdrCaptureProgressCallback(IntPtr handle, HdrCaptureProgressCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_unset_hdr_capture_progress_cb")]
- internal static extern int UnsetHdrCaptureProgressCallback(IntPtr handle);
+ internal static extern CameraError UnsetHdrCaptureProgressCallback(IntPtr handle);
[StructLayout(LayoutKind.Sequential)]
internal struct ImageDataStruct
internal static partial class CameraDisplay
{
[DllImport(Libraries.Camera, EntryPoint = "camera_get_display_mode")]
- internal static extern int GetMode(IntPtr handle, out CameraDisplayMode mode);
+ internal static extern CameraError GetMode(IntPtr handle, out CameraDisplayMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_display_mode")]
- internal static extern int SetMode(IntPtr handle, CameraDisplayMode mode);
+ internal static extern CameraError SetMode(IntPtr handle, CameraDisplayMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_is_display_visible")]
- internal static extern int GetVisible(IntPtr handle, out bool visible);
+ internal static extern CameraError GetVisible(IntPtr handle, out bool visible);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_display_visible")]
- internal static extern int SetVisible(IntPtr handle, bool visible);
+ internal static extern CameraError SetVisible(IntPtr handle, bool visible);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_display_rotation")]
- internal static extern int GetRotation(IntPtr handle, out CameraRotation rotation);
+ internal static extern CameraError GetRotation(IntPtr handle, out CameraRotation rotation);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_display_rotation")]
- internal static extern int SetRotation(IntPtr handle, CameraRotation rotation);
+ internal static extern CameraError SetRotation(IntPtr handle, CameraRotation rotation);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_display_flip")]
- internal static extern int GetFlip(IntPtr handle, out CameraFlip flip);
+ internal static extern CameraError GetFlip(IntPtr handle, out CameraFlip flip);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_display_flip")]
- internal static extern int SetFlip(IntPtr handle, CameraFlip flip);
+ internal static extern CameraError SetFlip(IntPtr handle, CameraFlip flip);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_display_roi_area")]
- internal static extern int GetRoiArea(IntPtr handle, out int x, out int y, out int width, out int height);
+ internal static extern CameraError GetRoiArea(IntPtr handle, out int x, out int y, out int width, out int height);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_display_roi_area")]
- internal static extern int SetRoiArea(IntPtr handle, int x, int y, int width, int height);
+ internal static extern CameraError SetRoiArea(IntPtr handle, int x, int y, int width, int height);
[DllImport(Libraries.Camera, EntryPoint = "camera_set_display")]
- internal static extern int SetInfo(IntPtr handle, CameraDisplayType displayType, IntPtr displayHandle);
+ internal static extern CameraError SetInfo(IntPtr handle, CameraDisplayType displayType, IntPtr displayHandle);
}
}
}
\ No newline at end of file
internal static extern bool IsAutoContrastSupported(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_preview_resolution")]
- internal static extern int SupportedPreviewResolutions(IntPtr handle, PreviewResolutionCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedPreviewResolutions(IntPtr handle, PreviewResolutionCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_capture_resolution")]
- internal static extern int SupportedCaptureResolutions(IntPtr handle, CaptureResolutionCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedCaptureResolutions(IntPtr handle, CaptureResolutionCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_capture_format")]
- internal static extern int SupportedCapturePixelFormats(IntPtr handle, CaptureFormatCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedCapturePixelFormats(IntPtr handle, CaptureFormatCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_preview_format")]
- internal static extern int SupportedPreviewPixelFormats(IntPtr handle, PreviewFormatCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedPreviewPixelFormats(IntPtr handle, PreviewFormatCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_fps")]
- internal static extern int SupportedPreviewFps(IntPtr handle, FpsCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedPreviewFps(IntPtr handle, FpsCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_fps_by_resolution")]
- internal static extern int SupportedPreviewFpsByResolution(IntPtr handle, int width, int height, FpsByResolutionCallback callback, 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 int SupportedAfModes(IntPtr handle, AfModeCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedAfModes(IntPtr handle, AfModeCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_exposure_mode")]
- internal static extern int SupportedExposureModes(IntPtr handle, ExposureModeCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedExposureModes(IntPtr handle, ExposureModeCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_iso")]
- internal static extern int SupportedIso(IntPtr handle, IsoCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedIso(IntPtr handle, IsoCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_theater_mode")]
- internal static extern int SupportedTheaterModes(IntPtr handle, TheaterModeCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedTheaterModes(IntPtr handle, TheaterModeCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_whitebalance")]
- internal static extern int SupportedWhitebalance(IntPtr handle, WhitebalanceCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedWhitebalance(IntPtr handle, WhitebalanceCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_effect")]
- internal static extern int SupportedEffects(IntPtr handle, EffectCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedEffects(IntPtr handle, EffectCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_scene_mode")]
- internal static extern int SupportedSceneModes(IntPtr handle, SceneModeCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedSceneModes(IntPtr handle, SceneModeCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_flash_mode")]
- internal static extern int SupportedFlashModes(IntPtr handle, FlashModeCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedFlashModes(IntPtr handle, FlashModeCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_stream_rotation")]
- internal static extern int SupportedStreamRotations(IntPtr handle, StreamRotationCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedStreamRotations(IntPtr handle, StreamRotationCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_stream_flip")]
- internal static extern int SupportedStreamFlips(IntPtr handle, StreamFlipCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedStreamFlips(IntPtr handle, StreamFlipCallback callback, IntPtr userData);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_ptz_type")]
- internal static extern int SupportedPtzTypes(IntPtr handle, PtzTypeCallback callback, IntPtr userData);
+ internal static extern CameraError SupportedPtzTypes(IntPtr handle, PtzTypeCallback callback, IntPtr userData);
}
}
}
\ No newline at end of file
internal static partial class CameraSettings
{
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_preview_fps")]
- internal static extern int SetPreviewFps(IntPtr handle, CameraFps fps);
+ internal static extern CameraError SetPreviewFps(IntPtr handle, CameraFps fps);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_preview_fps")]
- internal static extern int GetPreviewFps(IntPtr handle, out CameraFps fps);
+ internal static extern CameraError GetPreviewFps(IntPtr handle, out CameraFps fps);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_image_quality")]
- internal static extern int SetImageQuality(IntPtr handle, int quality);
+ internal static extern CameraError SetImageQuality(IntPtr handle, int quality);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_image_quality")]
- internal static extern int GetImageQuality(IntPtr handle, out int quality);
+ internal static extern CameraError GetImageQuality(IntPtr handle, out int quality);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_encoded_preview_bitrate")]
- internal static extern int SetBitrate(IntPtr handle, int bitrate);
+ internal static extern CameraError SetBitrate(IntPtr handle, int bitrate);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_encoded_preview_bitrate")]
- internal static extern int GetBitrate(IntPtr handle, out int bitrate);
+ internal static extern CameraError GetBitrate(IntPtr handle, out int bitrate);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_encoded_preview_gop_interval")]
- internal static extern int SetGopInterval(IntPtr handle, int interval);
+ internal static extern CameraError SetGopInterval(IntPtr handle, int interval);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_encoded_preview_gop_interval")]
- internal static extern int GetGopInterval(IntPtr handle, out int interval);
+ internal static extern CameraError GetGopInterval(IntPtr handle, out int interval);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_zoom")]
- internal static extern int SetZoom(IntPtr handle, int zoom);
+ internal static extern CameraError SetZoom(IntPtr handle, int zoom);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_zoom")]
- internal static extern int GetZoom(IntPtr handle, out int zoom);
+ internal static extern CameraError GetZoom(IntPtr handle, out int zoom);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_zoom_range")]
- internal static extern int GetZoomRange(IntPtr handle, out int min, out int max);
+ internal static extern CameraError GetZoomRange(IntPtr handle, out int min, out int max);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_af_mode")]
- internal static extern int SetAutoFocusMode(IntPtr handle, CameraAutoFocusMode mode);
+ internal static extern CameraError SetAutoFocusMode(IntPtr handle, CameraAutoFocusMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_af_mode")]
- internal static extern int GetAutoFocusMode(IntPtr handle, out CameraAutoFocusMode mode);
+ internal static extern CameraError GetAutoFocusMode(IntPtr handle, out CameraAutoFocusMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_af_area")]
- internal static extern int SetAutoFocusArea(IntPtr handle, int x, int y);
+ internal static extern CameraError SetAutoFocusArea(IntPtr handle, int x, int y);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_clear_af_area")]
- internal static extern int ClearAutoFocusArea(IntPtr handle);
+ internal static extern CameraError ClearAutoFocusArea(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_exposure_mode")]
- internal static extern int SetExposureMode(IntPtr handle, CameraExposureMode mode);
+ internal static extern CameraError SetExposureMode(IntPtr handle, CameraExposureMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_exposure_mode")]
- internal static extern int GetExposureMode(IntPtr handle, out CameraExposureMode mode);
+ internal static extern CameraError GetExposureMode(IntPtr handle, out CameraExposureMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_exposure")]
- internal static extern int SetExposure(IntPtr handle, int value);
+ internal static extern CameraError SetExposure(IntPtr handle, int value);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_exposure")]
- internal static extern int GetExposure(IntPtr handle, out int value);
+ internal static extern CameraError GetExposure(IntPtr handle, out int value);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_exposure_range")]
- internal static extern int GetExposureRange(IntPtr handle, out int min, out int max);
+ internal static extern CameraError GetExposureRange(IntPtr handle, out int min, out int max);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_iso")]
- internal static extern int SetIso(IntPtr handle, CameraIsoLevel iso);
+ internal static extern CameraError SetIso(IntPtr handle, CameraIsoLevel iso);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_iso")]
- internal static extern int GetIso(IntPtr handle, out CameraIsoLevel iso);
+ internal static extern CameraError GetIso(IntPtr handle, out CameraIsoLevel iso);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_theater_mode")]
- internal static extern int SetTheaterMode(IntPtr handle, CameraTheaterMode mode);
+ internal static extern CameraError SetTheaterMode(IntPtr handle, CameraTheaterMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_theater_mode")]
- internal static extern int GetTheaterMode(IntPtr handle, out CameraTheaterMode mode);
+ internal static extern CameraError GetTheaterMode(IntPtr handle, out CameraTheaterMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_brightness")]
- internal static extern int SetBrightness(IntPtr handle, int level);
+ internal static extern CameraError SetBrightness(IntPtr handle, int level);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_brightness")]
- internal static extern int GetBrightness(IntPtr handle, out int level);
+ internal static extern CameraError GetBrightness(IntPtr handle, out int level);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_brightness_range")]
- internal static extern int GetBrightnessRange(IntPtr handle, out int min, out int max);
+ internal static extern CameraError GetBrightnessRange(IntPtr handle, out int min, out int max);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_contrast")]
- internal static extern int SetContrast(IntPtr handle, int level);
+ internal static extern CameraError SetContrast(IntPtr handle, int level);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_contrast")]
- internal static extern int GetContrast(IntPtr handle, out int level);
+ internal static extern CameraError GetContrast(IntPtr handle, out int level);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_contrast_range")]
- internal static extern int GetContrastRange(IntPtr handle, out int min, out int max);
+ internal static extern CameraError GetContrastRange(IntPtr handle, out int min, out int max);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_whitebalance")]
- internal static extern int SetWhitebalance(IntPtr handle, CameraWhiteBalance level);
+ internal static extern CameraError SetWhitebalance(IntPtr handle, CameraWhiteBalance level);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_whitebalance")]
- internal static extern int GetWhiteBalance(IntPtr handle, out CameraWhiteBalance level);
+ internal static extern CameraError GetWhiteBalance(IntPtr handle, out CameraWhiteBalance level);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_effect")]
- internal static extern int SetEffect(IntPtr handle, CameraEffectMode mode);
+ internal static extern CameraError SetEffect(IntPtr handle, CameraEffectMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_effect")]
- internal static extern int GetEffect(IntPtr handle, out CameraEffectMode mode);
+ internal static extern CameraError GetEffect(IntPtr handle, out CameraEffectMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_scene_mode")]
- internal static extern int SetSceneMode(IntPtr handle, CameraSceneMode mode);
+ internal static extern CameraError SetSceneMode(IntPtr handle, CameraSceneMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_scene_mode")]
- internal static extern int GetSceneMode(IntPtr handle, out CameraSceneMode mode);
+ internal static extern CameraError GetSceneMode(IntPtr handle, out CameraSceneMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_tag")]
- internal static extern int EnableTag(IntPtr handle, bool enable);
+ internal static extern CameraError EnableTag(IntPtr handle, bool enable);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_enabled_tag")]
- internal static extern int IsEnabledTag(IntPtr handle, out bool enabled);
+ internal static extern CameraError IsEnabledTag(IntPtr handle, out bool enabled);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tag_image_description")]
- internal static extern int SetImageDescription(IntPtr handle, string description);
+ internal static extern CameraError SetImageDescription(IntPtr handle, string description);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tag_image_description")]
- internal static extern int GetImageDescription(IntPtr handle, out IntPtr description);
+ internal static extern CameraError GetImageDescription(IntPtr handle, out IntPtr description);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tag_software")]
- internal static extern int SetTagSoftware(IntPtr handle, string software);
+ internal static extern CameraError SetTagSoftware(IntPtr handle, string software);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tag_software")]
- internal static extern int GetTagSoftware(IntPtr handle, out IntPtr software);
+ internal static extern CameraError GetTagSoftware(IntPtr handle, out IntPtr software);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tag_orientation")]
- internal static extern int SetTagOrientation(IntPtr handle, CameraTagOrientation orientation);
+ internal static extern CameraError SetTagOrientation(IntPtr handle, CameraTagOrientation orientation);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tag_orientation")]
- internal static extern int GetTagOrientation(IntPtr handle, out CameraTagOrientation orientation);
+ internal static extern CameraError GetTagOrientation(IntPtr handle, out CameraTagOrientation orientation);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_geotag")]
- internal static extern int SetGeotag(IntPtr handle, double latitude, double longtitude, double altitude);
+ internal static extern CameraError SetGeotag(IntPtr handle, double latitude, double longtitude, double altitude);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_geotag")]
- internal static extern int GetGeotag(IntPtr handle, out double latitude, out double longtitude, out double altitude);
+ internal static extern CameraError GetGeotag(IntPtr handle, out double latitude, out double longtitude, out double altitude);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_remove_geotag")]
- internal static extern int RemoveGeotag(IntPtr handle);
+ internal static extern CameraError RemoveGeotag(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_flash_mode")]
- internal static extern int SetFlashMode(IntPtr handle, CameraFlashMode mode);
+ internal static extern CameraError SetFlashMode(IntPtr handle, CameraFlashMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_flash_mode")]
- internal static extern int GetFlashMode(IntPtr handle, out CameraFlashMode mode);
+ internal static extern CameraError GetFlashMode(IntPtr handle, out CameraFlashMode mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_lens_orientation")]
- internal static extern int GetLensOrientation(IntPtr handle, out int angle);
+ internal static extern CameraError GetLensOrientation(IntPtr handle, out int angle);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_stream_rotation")]
- internal static extern int SetStreamRotation(IntPtr handle, CameraRotation mode);
+ internal static extern CameraError SetStreamRotation(IntPtr handle, CameraRotation mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_stream_rotation")]
- internal static extern int GetStreamRotation(IntPtr handle, out CameraRotation mode);
+ internal static extern CameraError GetStreamRotation(IntPtr handle, out CameraRotation mode);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_stream_flip")]
- internal static extern int SetFlip(IntPtr handle, CameraFlip flip);
+ internal static extern CameraError SetFlip(IntPtr handle, CameraFlip flip);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_stream_flip")]
- internal static extern int GetFlip(IntPtr handle, out CameraFlip flip);
+ internal static extern CameraError GetFlip(IntPtr handle, out CameraFlip flip);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_hdr_mode")]
- internal static extern int SetHdrMode(IntPtr handle, CameraHdrMode hdr);
+ internal static extern CameraError SetHdrMode(IntPtr handle, CameraHdrMode hdr);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_hdr_mode")]
- internal static extern int GetHdrMode(IntPtr handle, out CameraHdrMode hdr);
+ internal static extern CameraError GetHdrMode(IntPtr handle, out CameraHdrMode hdr);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_anti_shake")]
- internal static extern int EnableAntiShake(IntPtr handle, bool enable);
+ internal static extern CameraError EnableAntiShake(IntPtr handle, bool enable);
[DllImport(Libraries.Camera, EntryPoint = " camera_attr_is_enabled_anti_shake")]
- internal static extern int IsEnabledAntiShake(IntPtr handle, out bool enabled);
+ internal static extern CameraError IsEnabledAntiShake(IntPtr handle, out bool enabled);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_video_stabilization")]
- internal static extern int EnableVideoStabilization(IntPtr handle, bool enable);
+ internal static extern CameraError EnableVideoStabilization(IntPtr handle, bool enable);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_enabled_video_stabilization")]
- internal static extern int IsEnabledVideoStabilization(IntPtr handle, out bool enabled);
+ internal static extern CameraError IsEnabledVideoStabilization(IntPtr handle, out bool enabled);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_auto_contrast")]
- internal static extern int EnableAutoContrast(IntPtr handle, bool enable);
+ internal static extern CameraError EnableAutoContrast(IntPtr handle, bool enable);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_enabled_auto_contrast")]
- internal static extern int IsEnabledAutoContrast(IntPtr handle, out bool enabled);
+ internal static extern CameraError IsEnabledAutoContrast(IntPtr handle, out bool enabled);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_disable_shutter_sound")]
- internal static extern int DisableShutterSound(IntPtr handle, bool disable);
+ internal static extern CameraError DisableShutterSound(IntPtr handle, bool disable);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_pan")]
- internal static extern int SetPan(IntPtr handle, CameraPtzMoveType type, int step);
+ internal static extern CameraError SetPan(IntPtr handle, CameraPtzMoveType type, int step);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_pan")]
- internal static extern int GetPan(IntPtr handle, out int step);
+ internal static extern CameraError GetPan(IntPtr handle, out int step);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_pan_range")]
- internal static extern int GetPanRange(IntPtr handle, out int min, out int max);
+ internal static extern CameraError GetPanRange(IntPtr handle, out int min, out int max);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tilt")]
- internal static extern int SetTilt(IntPtr handle, CameraPtzMoveType type, int step);
+ internal static extern CameraError SetTilt(IntPtr handle, CameraPtzMoveType type, int step);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tilt")]
- internal static extern int GetTilt(IntPtr handle, out int step);
+ internal static extern CameraError GetTilt(IntPtr handle, out int step);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tilt_range")]
- internal static extern int GetTiltRange(IntPtr handle, out int min, out int max);
+ internal static extern CameraError GetTiltRange(IntPtr handle, out int min, out int max);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_ptz_type")]
- internal static extern int SetPtzType(IntPtr handle, int type);
+ internal static extern CameraError SetPtzType(IntPtr handle, int type);
}
}
}
internal delegate void MuxedStreamCallback(IntPtr stream, int size, ulong offset, IntPtr userData);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_create_audiorecorder")]
- internal static extern int Create(out IntPtr handle);
+ internal static extern RecorderError Create(out IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_create_videorecorder")]
- internal static extern int CreateVideo(IntPtr cameraHandle, out IntPtr handle);
+ internal static extern RecorderError CreateVideo(IntPtr cameraHandle, out IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_destroy")]
- internal static extern int Destroy(IntPtr handle);
+ internal static extern RecorderError Destroy(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_prepare")]
- internal static extern int Prepare(IntPtr handle);
+ internal static extern RecorderError Prepare(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_unprepare")]
- internal static extern int Unprepare(IntPtr handle);
+ internal static extern RecorderError Unprepare(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_start")]
- internal static extern int Start(IntPtr handle);
+ internal static extern RecorderError Start(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_pause")]
- internal static extern int Pause(IntPtr handle);
+ internal static extern RecorderError Pause(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_commit")]
- internal static extern int Commit(IntPtr handle);
+ internal static extern RecorderError Commit(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_cancel")]
- internal static extern int Cancel(IntPtr handle);
+ internal static extern RecorderError Cancel(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_get_state")]
- internal static extern int GetState(IntPtr handle, out RecorderState state);
+ internal static extern RecorderError GetState(IntPtr handle, out RecorderState state);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_sound_stream_info")]
- internal static extern int SetAudioStreamPolicy(IntPtr handle, IntPtr streamInfoHandle);
+ internal static extern RecorderError SetAudioStreamPolicy(IntPtr handle, IntPtr streamInfoHandle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_error_cb")]
- internal static extern int SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData);
+ internal static extern RecorderError SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_error_cb")]
- internal static extern int UnsetErrorCallback(IntPtr handle);
+ internal static extern RecorderError UnsetErrorCallback(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_interrupted_cb")]
- internal static extern int SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData);
+ internal static extern RecorderError SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_interrupted_cb")]
- internal static extern int UnsetInterruptedCallback(IntPtr handle);
+ internal static extern RecorderError UnsetInterruptedCallback(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_state_changed_cb")]
- internal static extern int SetStateChangedCallback(IntPtr handle, StatechangedCallback callback, IntPtr userData);
+ internal static extern RecorderError SetStateChangedCallback(IntPtr handle, StatechangedCallback callback, IntPtr userData);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_state_changed_cb")]
- internal static extern int UnsetStateChangedCallback(IntPtr handle);
+ internal static extern RecorderError UnsetStateChangedCallback(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_status_cb")]
- internal static extern int SetRecordingProgressCallback(IntPtr handle, RecordingProgressCallback callback, IntPtr userData);
+ internal static extern RecorderError SetRecordingProgressCallback(IntPtr handle, RecordingProgressCallback callback, IntPtr userData);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_status_cb")]
- internal static extern int UnsetRecordingProgressCallback(IntPtr handle);
+ internal static extern RecorderError UnsetRecordingProgressCallback(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_audio_stream_cb")]
- internal static extern int SetAudioStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr userData);
+ internal static extern RecorderError SetAudioStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr userData);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_audio_stream_cb")]
- internal static extern int UnsetAudioStreamCallback(IntPtr handle);
+ internal static extern RecorderError UnsetAudioStreamCallback(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_limit_reached_cb")]
- internal static extern int SetLimitReachedCallback(IntPtr handle, RecordingLimitReachedCallback callback, IntPtr userData);
+ internal static extern RecorderError SetLimitReachedCallback(IntPtr handle, RecordingLimitReachedCallback callback, IntPtr userData);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_limit_reached_cb")]
- internal static extern int UnsetLimitReachedCallback(IntPtr handle);
+ internal static extern RecorderError UnsetLimitReachedCallback(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_muxed_stream_cb")]
- internal static extern int SetMuxedStreamCallback(IntPtr handle, MuxedStreamCallback callback, IntPtr userData);
+ internal static extern RecorderError SetMuxedStreamCallback(IntPtr handle, MuxedStreamCallback callback, IntPtr userData);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_muxed_stream_cb")]
- internal static extern int UnsetMuxedStreamCallback(IntPtr handle);
+ internal static extern RecorderError UnsetMuxedStreamCallback(IntPtr handle);
}
}
}
\ No newline at end of file
internal delegate bool VideoEncoderCallback(RecorderVideoCodec codec, IntPtr userData);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_file_format")]
- internal static extern int FileFormats(IntPtr handle, FileFormatCallback callback, IntPtr userData);
+ internal static extern RecorderError FileFormats(IntPtr handle, FileFormatCallback callback, IntPtr userData);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_audio_encoder")]
- internal static extern int AudioEncoders(IntPtr handle, AudioEncoderCallback callback, IntPtr userData);
+ internal static extern RecorderError AudioEncoders(IntPtr handle, AudioEncoderCallback callback, IntPtr userData);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_video_encoder")]
- internal static extern int VideoEncoders(IntPtr handle, VideoEncoderCallback callback, IntPtr userData);
+ internal static extern RecorderError VideoEncoders(IntPtr handle, VideoEncoderCallback callback, IntPtr userData);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_video_resolution")]
- internal static extern int VideoResolution(IntPtr handle, VideoResolutionCallback callback, IntPtr userData);
+ internal static extern RecorderError VideoResolution(IntPtr handle, VideoResolutionCallback callback, IntPtr userData);
}
}
}
\ No newline at end of file
internal static partial class RecorderSettings
{
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_channel")]
- internal static extern int GetAudioChannel(IntPtr handle, out int channelCount);
+ internal static extern RecorderError GetAudioChannel(IntPtr handle, out int channelCount);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_channel")]
- internal static extern int SetAudioChannel(IntPtr handle, int channelCount);
+ internal static extern RecorderError SetAudioChannel(IntPtr handle, int channelCount);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_device")]
- internal static extern int GetAudioDevice(IntPtr handle, out RecorderAudioDevice device);
+ internal static extern RecorderError GetAudioDevice(IntPtr handle, out RecorderAudioDevice device);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_device")]
- internal static extern int SetAudioDevice(IntPtr handle, RecorderAudioDevice device);
+ internal static extern RecorderError SetAudioDevice(IntPtr handle, RecorderAudioDevice device);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_get_audio_level")]
- internal static extern int GetAudioLevel(IntPtr handle, out double dB);
+ internal static extern RecorderError GetAudioLevel(IntPtr handle, out double dB);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_samplerate")]
- internal static extern int GetAudioSampleRate(IntPtr handle, out int sampleRate);
+ internal static extern RecorderError GetAudioSampleRate(IntPtr handle, out int sampleRate);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_samplerate")]
- internal static extern int SetAudioSampleRate(IntPtr handle, int sampleRate);
+ internal static extern RecorderError SetAudioSampleRate(IntPtr handle, int sampleRate);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_encoder_bitrate")]
- internal static extern int GetAudioEncoderBitrate(IntPtr handle, out int bitRate);
+ internal static extern RecorderError GetAudioEncoderBitrate(IntPtr handle, out int bitRate);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_encoder_bitrate")]
- internal static extern int SetAudioEncoderBitrate(IntPtr handle, int bitRate);
+ internal static extern RecorderError SetAudioEncoderBitrate(IntPtr handle, int bitRate);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_video_encoder_bitrate")]
- internal static extern int GetVideoEncoderBitrate(IntPtr handle, out int bitRate);
+ internal static extern RecorderError GetVideoEncoderBitrate(IntPtr handle, out int bitRate);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_video_encoder_bitrate")]
- internal static extern int SetVideoEncoderBitrate(IntPtr handle, int bitRate);
+ internal static extern RecorderError SetVideoEncoderBitrate(IntPtr handle, int bitRate);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_get_audio_encoder")]
- internal static extern int GetAudioEncoder(IntPtr handle, out RecorderAudioCodec codec);
+ internal static extern RecorderError GetAudioEncoder(IntPtr handle, out RecorderAudioCodec codec);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_audio_encoder")]
- internal static extern int SetAudioEncoder(IntPtr handle, RecorderAudioCodec codec);
+ internal static extern RecorderError SetAudioEncoder(IntPtr handle, RecorderAudioCodec codec);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_get_video_encoder")]
- internal static extern int GetVideoEncoder(IntPtr handle, out RecorderVideoCodec codec);
+ internal static extern RecorderError GetVideoEncoder(IntPtr handle, out RecorderVideoCodec codec);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_video_encoder")]
- internal static extern int SetVideoEncoder(IntPtr handle, RecorderVideoCodec codec);
+ internal static extern RecorderError SetVideoEncoder(IntPtr handle, RecorderVideoCodec codec);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_get_file_format")]
- internal static extern int GetFileFormat(IntPtr handle, out RecorderFileFormat format);
+ internal static extern RecorderError GetFileFormat(IntPtr handle, out RecorderFileFormat format);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_file_format")]
- internal static extern int SetFileFormat(IntPtr handle, RecorderFileFormat format);
+ internal static extern RecorderError SetFileFormat(IntPtr handle, RecorderFileFormat format);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_get_filename")]
- internal static extern int GetFileName(IntPtr handle, out IntPtr path);
+ internal static extern RecorderError GetFileName(IntPtr handle, out IntPtr path);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_filename")]
- internal static extern int SetFileName(IntPtr handle, string path);
+ internal static extern RecorderError SetFileName(IntPtr handle, string path);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_size_limit")]
- internal static extern int GetSizeLimit(IntPtr handle, out int kbyte);
+ internal static extern RecorderError GetSizeLimit(IntPtr handle, out int kbyte);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_size_limit")]
- internal static extern int SetSizeLimit(IntPtr handle, int kbyte);
+ internal static extern RecorderError SetSizeLimit(IntPtr handle, int kbyte);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_time_limit")]
- internal static extern int GetTimeLimit(IntPtr handle, out int second);
+ internal static extern RecorderError GetTimeLimit(IntPtr handle, out int second);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_time_limit")]
- internal static extern int SetTimeLimit(IntPtr handle, int second);
+ internal static extern RecorderError SetTimeLimit(IntPtr handle, int second);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_is_muted")]
[return: MarshalAs(UnmanagedType.I1)]
internal static extern bool GetMute(IntPtr handle);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_mute")]
- internal static extern int SetMute(IntPtr handle, bool enable);
+ internal static extern RecorderError SetMute(IntPtr handle, bool enable);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_recording_motion_rate")]
- internal static extern int GetMotionRate(IntPtr handle, out double motionRate);
+ internal static extern RecorderError GetMotionRate(IntPtr handle, out double motionRate);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_recording_motion_rate")]
- internal static extern int SetMotionRate(IntPtr handle, double motionRate);
+ internal static extern RecorderError SetMotionRate(IntPtr handle, double motionRate);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_orientation_tag")]
- internal static extern int GetOrientationTag(IntPtr handle, out RecorderOrientation orientation);
+ internal static extern RecorderError GetOrientationTag(IntPtr handle, out RecorderOrientation orientation);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_orientation_tag")]
- internal static extern int SetOrientationTag(IntPtr handle, RecorderOrientation orientation);
+ internal static extern RecorderError SetOrientationTag(IntPtr handle, RecorderOrientation orientation);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_get_video_resolution")]
- internal static extern int GetVideoResolution(IntPtr handle, out int width, out int height);
+ internal static extern RecorderError GetVideoResolution(IntPtr handle, out int width, out int height);
[DllImport(Libraries.Recorder, EntryPoint = "recorder_set_video_resolution")]
- internal static extern int SetVideoResolution(IntPtr handle, int width, int height);
+ internal static extern RecorderError SetVideoResolution(IntPtr handle, int width, int height);
}
}
}
\ No newline at end of file
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
-using Tizen.Internals.Errors;
namespace Tizen.Multimedia
{
/// <summary>
/// Audio recorder constructor.
/// </summary>
+ /// /// <privilege>
+ /// http://tizen.org/privilege/microphone
+ /// </privilege>
public Recorder()
{
RecorderErrorFactory.ThrowIfError(Interop.Recorder.Create(out _handle),
Setting = new RecorderSettings(this);
RegisterCallbacks();
+
+ SetState(RecorderState.Created);
}
/// <summary>
/// <param name="camera">
/// The camera object.
/// </param>
+ /// <privilege>
+ /// http://tizen.org/privilege/camera
+ /// </privilege>
public Recorder(Camera camera)
{
RecorderErrorFactory.ThrowIfError(Interop.Recorder.CreateVideo(camera.GetHandle(), out _handle),
Setting = new RecorderSettings(this);
RegisterCallbacks();
+
+ SetState(RecorderState.Created);
}
/// <summary>
/// <summary>
/// The current state of the recorder.
/// </summary>
+ /// <value>A <see cref="RecorderState"/> that specifies the state of recorder.</value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public RecorderState State
{
get
{
+ ValidateNotDisposed();
+
RecorderState val = 0;
RecorderErrorFactory.ThrowIfError(Interop.Recorder.GetState(_handle, out val),
#region Methods
/// <summary>
/// Prepare the media recorder for recording.
+ /// The recorder must be in the <see cref="RecorderState.Created"/> state.
+ /// After this method is finished without any exception,
+ /// The state of recorder will be changed to <see cref="RecorderState.Ready"/> state.
/// </summary>
/// <remarks>
/// Before calling the function, it is required to set AudioEncoder,
/// videoencoder and fileformat properties of recorder.
/// </remarks>
/// <privilege>
- /// http://tizen.org/privilege/recorder
+ /// http://tizen.org/privilege/camera or http://tizen.org/privilege/microphone
/// </privilege>
+ /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void Prepare()
{
+ ValidateState(RecorderState.Created);
+
RecorderErrorFactory.ThrowIfError(Interop.Recorder.Prepare(_handle),
"Failed to prepare media recorder for recording");
+
+ SetState(RecorderState.Ready);
}
/// <summary>
/// Resets the media recorder.
+ /// The recorder must be in the <see cref="RecorderState.Ready"/> state.
+ /// After this method is finished without any exception,
+ /// The state of recorder will be changed to <see cref="RecorderState.Created"/> state.
/// </summary>
/// <privilege>
- /// http://tizen.org/privilege/recorder
+ /// http://tizen.org/privilege/camera or http://tizen.org/privilege/microphone
/// </privilege>
+ /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void Unprepare()
{
+ ValidateState(RecorderState.Ready);
+
RecorderErrorFactory.ThrowIfError(Interop.Recorder.Unprepare(_handle),
"Failed to reset the media recorder");
+
+ SetState(RecorderState.Created);
}
/// <summary>
/// Starts the recording.
+ /// The recorder must be in the <see cref="RecorderState.Ready"/> state.
+ /// After this method is finished without any exception,
+ /// The state of recorder will be changed to <see cref="RecorderState.Recording"/> state.
/// </summary>
/// <remarks>
/// If file path has been set to an existing file, this file is removed automatically and updated by new one.
/// The filename should be set before this function is invoked.
/// </remarks>
/// <privilege>
- /// http://tizen.org/privilege/recorder
+ /// http://tizen.org/privilege/camera or http://tizen.org/privilege/microphone
/// </privilege>
+ /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void Start()
{
+ ValidateState(RecorderState.Ready);
+
RecorderErrorFactory.ThrowIfError(Interop.Recorder.Start(_handle),
"Failed to start the media recorder");
+
+ SetState(RecorderState.Recording);
}
/// <summary>
/// Pause the recording.
+ /// The recorder must be in the <see cref="RecorderState.Recording"/> state.
+ /// After this method is finished without any exception,
+ /// The state of recorder will be changed to <see cref="RecorderState.Paused"/> state.
/// </summary>
/// <remarks>
/// Recording can be resumed with Start().
/// </remarks>
/// <privilege>
- /// http://tizen.org/privilege/recorder
+ /// http://tizen.org/privilege/camera or http://tizen.org/privilege/microphone
/// </privilege>
+ /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void Pause()
{
+ ValidateState(RecorderState.Recording);
+
RecorderErrorFactory.ThrowIfError(Interop.Recorder.Pause(_handle),
"Failed to pause the media recorder");
+
+ SetState(RecorderState.Paused);
}
/// <summary>
/// Stops recording and saves the result.
+ /// The recorder must be in the <see cref="RecorderState.Recording"/> or <see cref="RecorderState.Paused"/> state.
+ /// After this method is finished without any exception,
+ /// The state of recorder will be changed to <see cref="RecorderState.Ready"/> state.
/// </summary>
/// <privilege>
- /// http://tizen.org/privilege/recorder
+ /// http://tizen.org/privilege/camera or http://tizen.org/privilege/microphone
/// </privilege>
+ /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void Commit()
{
+ ValidateState(RecorderState.Recording, RecorderState.Paused);
+
RecorderErrorFactory.ThrowIfError(Interop.Recorder.Commit(_handle),
"Failed to save the recorded content");
+
+ SetState(RecorderState.Ready);
}
/// <summary>
/// Cancels the recording.
/// The recording data is discarded and not written in the recording file.
+ /// The recorder must be in the <see cref="RecorderState.Recording"/> or <see cref="RecorderState.Paused"/> state.
+ /// After this method is finished without any exception,
+ /// The state of recorder will be changed to <see cref="RecorderState.Ready"/> state.
/// </summary>
/// <privilege>
- /// http://tizen.org/privilege/recorder
+ /// http://tizen.org/privilege/camera or http://tizen.org/privilege/microphone
/// </privilege>
+ /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void Cancel()
{
+ ValidateState(RecorderState.Recording, RecorderState.Paused);
+
RecorderErrorFactory.ThrowIfError(Interop.Recorder.Cancel(_handle),
"Failed to cancel the recording");
+
+ SetState(RecorderState.Ready);
}
/// <summary>
/// Sets the audio stream policy.
/// </summary>
/// <param name="policy">Policy.</param>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public void SetAudioStreamPolicy(AudioStreamPolicy policy)
{
+ ValidateNotDisposed();
+
RecorderErrorFactory.ThrowIfError(Interop.Recorder.SetAudioStreamPolicy(_handle, policy.Handle),
"Failed to set audio stream policy");
}
{
_stateChangedCallback = (RecorderState previous, RecorderState current, bool byPolicy, IntPtr userData) =>
{
+ SetState(current);
+ Log.Info(RecorderLog.Tag, "Recorder state changed " + previous.ToString() + " -> " + current.ToString());
StateChanged?.Invoke(this, new RecorderStateChangedEventArgs(previous, current, byPolicy));
};
RecorderErrorFactory.ThrowIfError(Interop.Recorder.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero),
internal static class RecorderErrorFactory
{
- internal static void ThrowIfError(int errorCode, string errorMessage = null,
+ internal static void ThrowIfError(RecorderError errorCode, string errorMessage = null,
[CallerMemberName] string caller = null, [CallerLineNumber] int line = 0)
{
- RecorderError err = (RecorderError)errorCode;
- if (err == RecorderError.None)
+ if (errorCode == RecorderError.None)
{
return;
}
- Log.Info(RecorderLog.Tag, "errorCode : " + err.ToString() + ", Caller : " + caller + ", line " + line.ToString());
+ Log.Info(RecorderLog.Tag, "errorCode : " + errorCode.ToString() + ", Caller : " + caller + ", line " + line.ToString());
- switch (err)
+ switch (errorCode)
{
case RecorderError.InvalidParameter:
throw new ArgumentException(errorMessage);
/// Retrieves all the file formats supported by the recorder.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported file
- /// formats by recorder.
+ /// It returns a list containing all the supported <see cref="RecorderFileFormat"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<RecorderFileFormat> SupportedFileFormats
{
get
{
if (_fileFormats == null)
{
- _fileFormats = new List<RecorderFileFormat>();
-
- Interop.RecorderFeatures.FileFormatCallback callback = (RecorderFileFormat format, IntPtr userData) =>
+ try
{
- _fileFormats.Add(format);
- return true;
- };
- RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.FileFormats(_recorder.GetHandle(), callback, IntPtr.Zero),
+ _fileFormats = new List<RecorderFileFormat>();
+
+ Interop.RecorderFeatures.FileFormatCallback callback = (RecorderFileFormat format, IntPtr userData) =>
+ {
+ _fileFormats.Add(format);
+ return true;
+ };
+ RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.FileFormats(_recorder.GetHandle(), callback, IntPtr.Zero),
"Failed to get the supported fileformats");
+ }
+ catch
+ {
+ _fileFormats = null;
+ throw;
+ }
}
return _fileFormats;
/// Retrieves all the audio encoders supported by the recorder.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported audio encoders
- /// by recorder.
+ /// It returns a list containing all the supported <see cref="RecorderAudioCodec"/>.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<RecorderAudioCodec> SupportedAudioEncodings
{
get
{
if (_audioCodec == null)
{
- _audioCodec = new List<RecorderAudioCodec>();
-
- Interop.RecorderFeatures.AudioEncoderCallback callback = (RecorderAudioCodec codec, IntPtr userData) =>
+ try
+ {
+ _audioCodec = new List<RecorderAudioCodec>();
+
+ Interop.RecorderFeatures.AudioEncoderCallback callback = (RecorderAudioCodec codec, IntPtr userData) =>
+ {
+ _audioCodec.Add(codec);
+ return true;
+ };
+ RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.AudioEncoders(_recorder.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported audio encoders");
+ }
+ catch
{
- _audioCodec.Add(codec);
- return true;
- };
- RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.AudioEncoders(_recorder.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported audio encoders");
+ _audioCodec = null;
+ throw;
+ }
}
return _audioCodec;
/// Retrieves all the video encoders supported by the recorder.
/// </summary>
/// <returns>
- /// It returns a list containing all the supported video encoders
+ /// It returns a list containing all the supported <see cref="RecorderVideoCodec"/>.
/// by recorder.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<RecorderVideoCodec> SupportedVideoEncodings
{
get
{
if (_videoCodec == null)
{
- _videoCodec = new List<RecorderVideoCodec>();
-
- Interop.RecorderFeatures.VideoEncoderCallback callback = (RecorderVideoCodec codec, IntPtr userData) =>
+ try
+ {
+ _videoCodec = new List<RecorderVideoCodec>();
+
+ Interop.RecorderFeatures.VideoEncoderCallback callback = (RecorderVideoCodec codec, IntPtr userData) =>
+ {
+ _videoCodec.Add(codec);
+ return true;
+ };
+ RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.VideoEncoders(_recorder.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported video encoders");
+ }
+ catch
{
- _videoCodec.Add(codec);
- return true;
- };
- RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.VideoEncoders(_recorder.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported video encoders");
+ _videoCodec = null;
+ throw;
+ }
}
return _videoCodec;
/// It returns videoresolution list containing the width and height of
/// different resolutions supported by recorder.
/// </returns>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public IEnumerable<Size> SupportedVideoResolutions
{
get
{
if (_videoResolution == null)
{
- _videoResolution = new List<Size>();
-
- Interop.RecorderFeatures.VideoResolutionCallback callback = (int width, int height, IntPtr userData) =>
+ try
+ {
+ _videoResolution = new List<Size>();
+
+ Interop.RecorderFeatures.VideoResolutionCallback callback = (int width, int height, IntPtr userData) =>
+ {
+ _videoResolution.Add(new Size(width, height));
+ return true;
+ };
+ RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.VideoResolution(_recorder.GetHandle(), callback, IntPtr.Zero),
+ "Failed to get the supported video resolutions.");
+ }
+ catch
{
- _videoResolution.Add(new Size(width, height));
- return true;
- };
- RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.VideoResolution(_recorder.GetHandle(), callback, IntPtr.Zero),
- "Failed to get the supported video resolutions.");
+ _videoResolution = null;
+ throw;
+ }
}
return _videoResolution;
/// <summary>
/// The number of audio channel.
/// </summary>
- /// <remarks>
- /// The attribute is applied only in Created state.
+ /// <value>
/// For mono recording, set channel to 1.
/// For stereo recording, set channel to 2.
- /// </remarks>
+ /// </value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int AudioChannel
{
get
/// <summary>
/// The audio device for recording.
/// </summary>
+ /// <value>A <see cref="RecorderAudioDevice"/> that specifies the type of audio device.</value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public RecorderAudioDevice AudioDevice
{
get
/// <remarks>
/// 0dB indicates maximum input level, -300dB indicates minimum input level.
/// </remarks>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public double AudioLevel
{
get
/// <summary>
/// The sampling rate of an audio stream in hertz.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int AudioSampleRate
{
get
/// <summary>
/// The bitrate of an audio encoder in bits per second.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int AudioBitRate
{
get
/// <summary>
/// The bitrate of an video encoder in bits per second.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int VideoBitRate
{
get
/// <summary>
/// The audio codec for encoding an audio stream.
/// </summary>
+ /// <value>A <see cref="RecorderAudioCodec"/> that specifies the type of audio codec.</value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public RecorderAudioCodec AudioCodec
{
get
/// <summary>
/// The video codec for encoding video stream.
/// </summary>
+ /// <value>A <see cref="RecorderVideoCodec"/> that specifies the type of video codec.</value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public RecorderVideoCodec VideoCodec
{
get
/// <summary>
/// The file format for recording media stream.
/// </summary>
+ /// <value>A <see cref="RecorderFileFormat"/> that specifies the file format.</value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public RecorderFileFormat FileFormat
{
get
/// If the same file already exists in the file system, then old file
/// will be overwritten.
/// </remarks>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public string FilePath
{
get
{
IntPtr val;
- int ret = Interop.RecorderSettings.GetFileName(_recorder.GetHandle(), out val);
- if ((RecorderError)ret != RecorderError.None)
+ RecorderError ret = Interop.RecorderSettings.GetFileName(_recorder.GetHandle(), out val);
+ if (ret != RecorderError.None)
{
Log.Error(RecorderLog.Tag, "Failed to get filepath, " + (RecorderError)ret);
}
/// be discarded and not written to the file.
/// The recorder state must be in 'Ready' or 'Created' state.
/// </remarks>
- ///
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int SizeLimit
{
get
/// be discarded and not written to the file.
/// The recorder state must be in 'Ready' or 'Created' state.
/// </remarks>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int TimeLimit
{
get
/// <summary>
/// The mute state of a recorder.
/// </summary>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public bool Mute
{
get
/// If the rate is in range of 0-1, video is recorded in a slow motion mode.
/// If the rate is bigger than 1, video is recorded in a fast motion mode.
/// </remarks>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public double MotionRate
{
get
/// <summary>
/// The orientation in a video metadata tag.
/// </summary>
+ /// <value>A <see cref="RecorderOrientation"/> that specifies the type of orientation.</value>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public RecorderOrientation OrientationTag
{
get
/// <summary>
/// Resolution of the video.
/// </summary>
- /// <privilege>
- /// http://tizen.org/privilege/recorder
- /// </privilege>
/// <exception cref="ArgumentException">In case of invalid parameters</exception>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public Size VideoResolution
{
get
int width = 0;
int height = 0;
- CameraErrorFactory.ThrowIfError(Interop.RecorderSettings.GetVideoResolution(_recorder.GetHandle(), out width, out height),
+ RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.GetVideoResolution(_recorder.GetHandle(), out width, out height),
"Failed to get camera video resolution");
return new Size(width, height);
{
Size res = value;
- CameraErrorFactory.ThrowIfError(Interop.RecorderSettings.SetVideoResolution(_recorder.GetHandle(), res.Width, res.Height),
+ RecorderErrorFactory.ThrowIfError(Interop.RecorderSettings.SetVideoResolution(_recorder.GetHandle(), res.Width, res.Height),
"Failed to set video resolution.");
}
}
{
"dependencies": {
"ElmSharp": "1.1.0-*",
- "NETStandard.Library": "1.6.0",
- "Tizen": "1.0.2",
- "Tizen.Applications": "1.2.4"
+ "NETStandard.Library": "1.6.1",
+ "Tizen": "1.0.3",
+ "Tizen.Applications": "1.3.2"
},
"frameworks": {
"netstandard1.3": {}