}
internal static CameraDeviceInformation GetDeviceInformation(Native.CameraDeviceStruct device) =>
- new CameraDeviceInformation(device.Type, device.device, GetString(device.name), GetString(device.id));
-
- private static string GetString(char[] word)
- {
- int length = 0;
- while(word[length] != '\0')
- {
- length++;
- }
-
- return new String(word, 0, length);
- }
+ new CameraDeviceInformation(device.Type, device.device, device.name, device.id, device.extraStreamNum);
private event EventHandler<CameraDeviceConnectionChangedEventArgs> _deviceConnectionChanged;
/// <summary>
/// </summary>
/// <since_tizen> 9 </since_tizen>
[EditorBrowsable(EditorBrowsableState.Never)]
- public class CameraDeviceInformation
+ public struct CameraDeviceInformation
{
/// <summary>
/// Initializes a new instance of the <see cref="CameraDeviceInformation"/> class.
/// <param name="device"><see cref="CameraDevice"/></param>
/// <param name="name">The name of camera device</param>
/// <param name="id">The ID of camera device</param>
+ /// <param name="numberOfExtraStream">The number of extra stream</param>
/// <exception cref="ArgumentException">Invalid enumeration.</exception>
/// <exception cref="ArgumentNullException">name or id is null.</exception>
/// <since_tizen> 9 </since_tizen>
[EditorBrowsable(EditorBrowsableState.Never)]
- internal CameraDeviceInformation(CameraDeviceType type, CameraDevice device, string name, string id)
+ internal CameraDeviceInformation(CameraDeviceType type, CameraDevice device, string name, string id, int numberOfExtraStream)
{
ValidationUtil.ValidateEnum(typeof(CameraDeviceType), type, nameof(type));
ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device));
Device = device;
Name = name ?? throw new ArgumentNullException(nameof(name), "name is null");
Id = id ?? throw new ArgumentNullException(nameof(id), "id is null");
+ NumberOfExtraStream = numberOfExtraStream;
}
/// <summary>
public string Id { get; }
/// <summary>
+ /// Gets the number of extra stream.
+ /// </summary>
+ /// <value>The number of extra stream.</value>
+ /// <since_tizen> 9 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int NumberOfExtraStream { get; }
+
+ /// <summary>
/// Returns a string that represents the current object.
/// </summary>
/// <returns>A string that represents the current object.</returns>
/// <since_tizen> 9 </since_tizen>
[EditorBrowsable(EditorBrowsableState.Never)]
public override string ToString() =>
- $"Type:{Type.ToString()}, Device:{Device.ToString()}, Name:{Name}, Id:{Id}";
+ $"Type:{Type.ToString()}, Device:{Device.ToString()}, Name:{Name}, Id:{Id}, NumberOfExtraStream:{NumberOfExtraStream}";
}
}
*/
using System;
+using System.ComponentModel;
using System.Runtime.InteropServices;
using Native = Interop.CameraSettings;
using static Interop.Camera;
}
}
#endregion EXIF tag
+
+ /// <summary>
+ /// Gets the information of extra preview stream.
+ /// </summary>
+ /// <param name="streamId">The stream id.</param>
+ /// <since_tizen> 9 </since_tizen>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ExtraPreviewStreamInfo GetExtraPreviewStreamInfo(int streamId)
+ {
+ GetExtraPreviewStreamFormat(_camera.GetHandle(), streamId, out CameraPixelFormat format,
+ out int width, out int height, out int fps).ThrowIfFailed("Failed to get extra preview stream foramt");
+
+ return new ExtraPreviewStreamInfo(streamId, format, new Size(width, height), fps);
+ }
+
+ /// <summary>
+ /// Sets the information of extra preview stream.
+ /// </summary>
+ /// <param name="info">The extra preview stream information.</param>
+ /// <since_tizen> 9 </since_tizen>
+ /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetExtraPreviewStreamInfo(ExtraPreviewStreamInfo info)
+ {
+ SetExtraPreviewStreamFormat(_camera.GetHandle(), info.StreamId, info.Format,
+ info.Size.Width, info.Size.Height, info.Fps).ThrowIfFailed("Failed to set extra preview stream foramt");
+ }
+ }
+
+ /// <summary>
+ /// Provides the ability to get the information of extra preview stream.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public struct ExtraPreviewStreamInfo
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExtraPreviewStreamInfo"/> class.
+ /// </summary>
+ /// <param name="streamId">The stream id.</param>
+ /// <param name="format">The preview format.</param>
+ /// <param name="size">The preview resolution.</param>
+ /// <param name="fps">The fps.</param>
+ /// <since_tizen> 9 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ExtraPreviewStreamInfo(int streamId, CameraPixelFormat format, Size size, int fps)
+ {
+ StreamId = streamId;
+ Format = format;
+ Size = size;
+ Fps = fps;
+ }
+
+ /// <summary>
+ /// Gets the stream Id.
+ /// </summary>
+ /// <value>The stream Id.</value>
+ /// <since_tizen> 9 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int StreamId { get; set;}
+
+ /// <summary>
+ /// Gets the extra preview format.
+ /// </summary>
+ /// <value></value>
+ /// <since_tizen> 9 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public CameraPixelFormat Format { get; }
+
+ /// <summary>
+ /// Gets the extra preview resolution.
+ /// </summary>
+ /// <value></value>
+ /// <since_tizen> 9 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Size Size { get; }
+
+ /// <summary>
+ /// Gets the fps.
+ /// </summary>
+ /// <value></value>
+ /// <since_tizen> 9 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int Fps { get; }
+
+ /// <summary>
+ /// Returns a string that represents the current object.
+ /// </summary>
+ /// <returns>A string that represents the current object.</returns>
+ /// <since_tizen> 9 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override string ToString() =>
+ $"StreamId:{StreamId}, Format:{Format.ToString()}, Resolution:{Size.Width}x{Size.Height}, Fps:{Fps}";
}
}
[DllImport(Libraries.Camera, EntryPoint = "camera_get_flash_state")]
internal static extern CameraError GetFlashState(CameraDevice device, out CameraFlashState state);
+ [DllImport(Libraries.Camera, EntryPoint = "camera_set_extra_preview_stream_format")]
+ internal static extern CameraError SetExtraPreviewStreamFormat(IntPtr handle, int streamId, CameraPixelFormat format,
+ int width, int height, int fps);
+
+ [DllImport(Libraries.Camera, EntryPoint = "camera_get_extra_preview_stream_format")]
+ internal static extern CameraError GetExtraPreviewStreamFormat(IntPtr handle, int streamId, out CameraPixelFormat format,
+ out int width, out int height, out int fps);
+
+
[DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_cb")]
internal static extern CameraError SetPreviewCallback(IntPtr handle, PreviewCallback callback, IntPtr userData = default);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_unset_hdr_capture_progress_cb")]
internal static extern CameraError UnsetHdrCaptureProgressCallback(IntPtr handle);
+
[NativeStruct("camera_image_data_s", Include="camera.h", PkgConfig="capi-media-camera")]
[StructLayout(LayoutKind.Sequential)]
internal struct StillImageDataStruct
internal CameraDevice device;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
- internal char[] name;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
+ internal string name;
+
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
+ internal string id;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
- internal char[] id;
+ internal int extraStreamNum;
}
[NativeStruct("camera_device_list_s", Include="camera_internal.h", PkgConfig="capi-media-camera")]