[ACR-1279] Add new preview format and update preview data structure 77/185977/3 accepted/tizen/unified/20180813.061353 submit/tizen/20180810.054330
authorJeongmo Yang <jm80.yang@samsung.com>
Mon, 6 Aug 2018 05:01:02 +0000 (14:01 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Wed, 8 Aug 2018 01:01:00 +0000 (10:01 +0900)
[Version] 0.4.12
[Profile] Common
[Issue Type] ACR
[Dependency module] N/A

Change-Id: I6cd9cf7c32a3027daf58b05893894d0ba4119c7c
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
include/camera.h
include/camera_private.h
packaging/capi-media-camera.spec
src/camera.c

index 21e6610..c25ecc9 100644 (file)
@@ -100,6 +100,8 @@ typedef enum {
 /**
  * @brief Enumeration for the camera pixel format.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks If #CAMERA_PIXEL_FORMAT_INVZ is set, the type of display should be #CAMERA_DISPLAY_TYPE_NONE. \n
+ *          Otherwise, camera_start_preview() will return #CAMERA_ERROR_INVALID_OPERATION. (Since 5.0)
  */
 typedef enum {
        CAMERA_PIXEL_FORMAT_INVALID = -1,   /**< Invalid pixel format */
@@ -118,6 +120,7 @@ typedef enum {
        CAMERA_PIXEL_FORMAT_ARGB,           /**< ARGB pixel format */
        CAMERA_PIXEL_FORMAT_JPEG,           /**< Encoded pixel format */
        CAMERA_PIXEL_FORMAT_H264 = 15,      /**< Encoded pixel format : H264 (Since 3.0) */
+       CAMERA_PIXEL_FORMAT_INVZ            /**< Depth pixel format : INVZ (Since 5.0) */
 } camera_pixel_format_e;
 
 /**
@@ -224,37 +227,42 @@ typedef struct {
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 typedef struct {
-       camera_pixel_format_e format;   /**< The format of the frame pixel */
-       int width;                      /**< The width of the frame */
-       int height;                     /**< The height of the frame */
-       int num_of_planes;              /**< The number of planes */
-       unsigned int timestamp;         /**< The timestamp of the frame */
+       camera_pixel_format_e format;   /**< The format of the frame pixel */
+       int width;                      /**< The width of the frame */
+       int height;                     /**< The height of the frame */
+       int num_of_planes;              /**< The number of planes */
+       unsigned int timestamp;         /**< The timestamp of the frame */
        union {
                struct {
-                       unsigned char *yuv;     /**< The yuv data pointer */
-                       unsigned int size;      /**< The size of data */
-               } single_plane;                 /**< single plane frame data */
+                       unsigned char *yuv;     /**< The yuv data pointer */
+                       unsigned int size;      /**< The size of data */
+               } single_plane;             /**< Single plane frame data */
 
                struct {
-                       unsigned char *y;       /**< The y data pointer */
-                       unsigned char *uv;      /**< The uv data pointer */
-                       unsigned int y_size;    /**< The size of y data */
-                       unsigned int uv_size;   /**< The size of uv data */
-               } double_plane;                 /**< double plane frame data */
+                       unsigned char *y;       /**< The y data pointer */
+                       unsigned char *uv;      /**< The uv data pointer */
+                       unsigned int y_size;    /**< The size of y data */
+                       unsigned int uv_size;   /**< The size of uv data */
+               } double_plane;             /**< Double plane frame data */
 
                struct {
-                       unsigned char *y;       /**< The y data pointer */
-                       unsigned char *u;       /**< The u data pointer */
-                       unsigned char *v;       /**< The v data pointer */
-                       unsigned int y_size;    /**< The size of y data */
-                       unsigned int u_size;    /**< The size of u data */
-                       unsigned int v_size;    /**< The size of v data */
-               } triple_plane;                 /**< triple plane frame data */
+                       unsigned char *y;       /**< The y data pointer */
+                       unsigned char *u;       /**< The u data pointer */
+                       unsigned char *v;       /**< The v data pointer */
+                       unsigned int y_size;    /**< The size of y data */
+                       unsigned int u_size;    /**< The size of u data */
+                       unsigned int v_size;    /**< The size of v data */
+               } triple_plane;             /**< Triple plane frame data */
 
                struct {
-                       unsigned char *data;    /**< The encoded data pointer */
-                       unsigned int size;              /**< The size of encoded data */
-               } encoded_plane;
+                       unsigned char *data;    /**< The encoded data pointer */
+                       unsigned int size;      /**< The size of encoded data */
+               } encoded_plane;            /**< Encoded plane frame data */
+
+               struct {
+                       unsigned char *data;    /**< The depth data pointer */
+                       unsigned int size;      /**< The size of depth data */
+               } depth_plane;              /**< Depth plane frame data (Since 5.0) */
        } data;
 } camera_preview_data_s;
 
index 2539101..27bc050 100644 (file)
@@ -80,7 +80,7 @@ typedef struct _camera_stream_data_s {
                struct {
                        unsigned char *data;
                        unsigned int length_data;
-               } encoded;
+               } encoded, depth;
        } data;                         /**< pointer of captured stream */
        int data_type;                  /**< data type */
        unsigned int length_total;      /**< total length of stream buffer (in byte)*/
index 9d8afe1..07b0e55 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-camera
 Summary:    A Camera API
-Version:    0.4.11
+Version:    0.4.12
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index eb0787e..e23cf86 100644 (file)
@@ -875,6 +875,10 @@ static void _camera_preview_frame_create(camera_stream_data_s *stream, int num_b
                        frame->data.encoded_plane.data = buf_pos;
                        frame->data.encoded_plane.size = stream->data.encoded.length_data;
                        total_size = stream->data.encoded.length_data;
+               } else if (stream->format == MM_PIXEL_FORMAT_INVZ) {
+                       frame->data.depth_plane.data = buf_pos;
+                       frame->data.depth_plane.size = stream->data.depth.length_data;
+                       total_size = stream->data.depth.length_data;
                } else {
                        switch (stream->num_planes) {
                        case 1:
@@ -2596,6 +2600,13 @@ int camera_start_preview(camera_h camera)
        LOGD("Enter : preview format %d, display type %d",
                pc->cb_info->preview_format, pc->cb_info->dp_type);
 
+       if (pc->cb_info->preview_format == CAMERA_PIXEL_FORMAT_INVZ &&
+               pc->cb_info->dp_type != CAMERA_DISPLAY_TYPE_NONE) {
+               LOGE("CAMERA_DISPLAY_TYPE_NONE[current %d] should be set with INVZ format",
+                       pc->cb_info->dp_type);
+               return CAMERA_ERROR_INVALID_OPERATION;
+       }
+
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_NO_TIMEOUT);
        if (ret == CAMERA_ERROR_NONE && CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
                ret = _camera_start_evas_rendering(camera);