[ACR-1715] Change parameter of some APIs 03/279603/5 submit/tizen/20220825.025917
authorJeongmo Yang <jm80.yang@samsung.com>
Fri, 12 Aug 2022 06:55:22 +0000 (15:55 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Thu, 18 Aug 2022 02:36:36 +0000 (11:36 +0900)
- Parameter changed APIs
 : camera_device_connection_changed_cb()
 : camera_supported_device_cb()
- Add new structure for camera device changed callback.
 : camera_device_s

[Version] 0.4.85
[Issue Type] ACR

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

index b338e1b..5f070e0 100644 (file)
@@ -285,6 +285,31 @@ typedef struct {
        } data;
 } camera_preview_data_s;
 
+
+/**
+ * @brief Maximum length of the camera device name.
+ * @since_tizen 7.0
+ */
+#define CAMERA_DEVICE_NAME_MAX_LENGTH   64
+
+/**
+ * @brief Maximum length of the camera device ID.
+ * @since_tizen 7.0
+ */
+#define CAMERA_DEVICE_ID_MAX_LENGTH     64
+
+/**
+ * @brief The structure type for the camera device.
+ * @since_tizen 7.0
+ */
+typedef struct _camera_device_s {
+       camera_device_type_e type;                  /**< The type of camera device */
+       camera_device_e index;                      /**< The index of camera device */
+       char name[CAMERA_DEVICE_NAME_MAX_LENGTH];   /**< The name of camera device */
+       char id[CAMERA_DEVICE_ID_MAX_LENGTH];       /**< The ID of camera device */
+       int extra_stream_num;                       /**< The extra preview stream number of camera device */
+} camera_device_s;
+
 /**
  * @brief The Camera handle.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
@@ -722,18 +747,13 @@ typedef void (*camera_face_detected_cb)(camera_detected_face_s *faces, int count
 /**
  * @brief Called when the connection state of a camera device was changed.
  * @since_tizen 7.0
- * @param[in] type                      The device type
- * @param[in] device                    The device index
- * @param[in] name                      The device name
- * @param[in] id                        The device ID
- * @param[in] extra_preview_stream_num  The number of extra preview stream
+ * @param[in] device                    The camera device
  * @param[in] is_connected              The state of device connection: (@c true = connected, @c false = disconnected)
  * @param[in] user_data                 The user data passed from the callback registration function
  * @see camera_device_manager_add_device_connection_changed_cb()
  * @see camera_device_manager_remove_device_connection_changed_cb()
  */
-typedef void (*camera_device_connection_changed_cb)(camera_device_type_e type, camera_device_e device,
-       const char *name, const char *id, int extra_preview_stream_num, bool is_connected, void *user_data);
+typedef void (*camera_device_connection_changed_cb)(camera_device_s *device, bool is_connected, void *user_data);
 
 /**
  * @brief Called when the extra preview frame is delivered from the camera device.
@@ -806,18 +826,13 @@ typedef bool (*camera_supported_preview_format_cb)(camera_pixel_format_e format,
 /**
  * @brief Called once for the each supported device.
  * @since_tizen 7.0
- * @param[in] type                      The device type
- * @param[in] device                    The device index
- * @param[in] name                      The device name
- * @param[in] id                        The device ID
- * @param[in] extra_preview_stream_num  The number of extra preview stream
- * @param[in] user_data                 The user data passed from the foreach function
+ * @param[in] device    The camera device
+ * @param[in] user_data The user data passed from the foreach function
  * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_foreach_supported_device() will invoke this callback.
- * @see camera_foreach_supported_device()
+ * @pre camera_device_manager_foreach_supported_device() will invoke this callback.
+ * @see camera_device_manager_foreach_supported_device()
  */
-typedef bool (*camera_supported_device_cb)(camera_device_type_e type, camera_device_e device,
-       const char *name, const char *id, int extra_preview_stream_num, void *user_data);
+typedef bool (*camera_supported_device_cb)(camera_device_s *device, void *user_data);
 
 /**
  * @}
index fb99ffb..11876ad 100644 (file)
@@ -38,17 +38,6 @@ extern "C" {
  */
 
 #define CAMERA_DEVICE_MAX        ((CAMERA_DEVICE_CAMERA9 + 1) * 2)
-#define DEVICE_NAME_MAX_LENGTH   64
-#define DEVICE_ID_MAX_LENGTH     64
-
-
-typedef struct _camera_device_s {
-       camera_device_type_e type;
-       camera_device_e index;
-       char name[DEVICE_NAME_MAX_LENGTH];
-       char id[DEVICE_ID_MAX_LENGTH];
-       int extra_stream_num;
-} camera_device_s;
 
 typedef struct _camera_device_list_s {
        unsigned int count;
index f65bcfc..b9258a1 100644 (file)
@@ -1,7 +1,7 @@
 Name:       capi-media-camera
 Summary:    A Camera API
-Version:    0.4.84
-Release:    1
+Version:    0.4.85
+Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index 000304b..c17f9a1 100644 (file)
@@ -6575,8 +6575,7 @@ int camera_device_manager_foreach_supported_device(camera_device_manager_h manag
                        i, device->type, device->index,
                        device->name, device->id, device->extra_stream_num);
 
-               if (!callback(device->type, device->index, device->name,
-                               device->id, device->extra_stream_num, user_data)) {
+               if (!callback(device, user_data)) {
                        CAM_LOG_WARNING("callback is stopped[called:%u,total:%u]",
                                i + 1, device_list.count);
                        break;
index 36a97fc..a188c7a 100644 (file)
@@ -343,18 +343,16 @@ static void _camera_device_state_changed_cb(camera_device_e device, camera_devic
        g_print("\n\tcamera device[%d] state changed to %d\n", device, state);
 }
 
-static void _camera_device_connection_changed_cb(camera_device_type_e type, camera_device_e device,
-       const char *name, const char *id, int extra_preview_stream_num, bool is_connected, void *user_data)
+static void _camera_device_connection_changed_cb(camera_device_s *device, bool is_connected, void *user_data)
 {
        g_print("\n\tcamera device changed[is_connected:%d][Type:%d,index:%d,name:%s,id:%s,exstream:%d]\n",
-               is_connected, type, device, name, id, extra_preview_stream_num);
+               is_connected, device->type, device->index, device->name, device->id, device->extra_stream_num);
 }
 
-static bool _camera_supported_device_cb(camera_device_type_e type, camera_device_e device,
-       const char *name, const char *id, int extra_preview_stream_num, void *user_data)
+static bool _camera_supported_device_cb(camera_device_s *device, void *user_data)
 {
        g_print("\n\tcamera supported device[Type:%d,index:%d,name:%s,id:%s,exstream:%d]\n",
-               type, device, name, id, extra_preview_stream_num);
+               device->type, device->index, device->name, device->id, device->extra_stream_num);
 
        return true;
 }